cm-price.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  1. <template name="cm-price">
  2. <!-- 商品详情价格判断 -->
  3. <view class="wrap-main">
  4. <!-- 协销 -->
  5. <view class="wrap-main-item">
  6. <view
  7. class="p-price tui-skeleton-fillet"
  8. :class="promotionFormat(product.promotion) ? 'none' : ''"
  9. >
  10. <text class="txt sm">¥</text>
  11. <text class="txt big">{{
  12. (promotionFormat(product.promotion) ? product.price : product.retailPrice)
  13. | NumFormat
  14. }}</text>
  15. </view>
  16. <view v-if="product.actStatus == 1" class="floor-item-act">
  17. <view
  18. v-if="product.promotion.type == 1 && product.promotion.mode == 1"
  19. class="floor-tags"
  20. @click.stop="clickPopupShow(1)"
  21. >
  22. {{ product.promotion.name
  23. }}<text v-if="hasLogin"
  24. >:¥{{
  25. product.promotion == null
  26. ? '0.00'
  27. : product.promotion.touchPrice | NumFormat
  28. }}</text
  29. >
  30. </view>
  31. <view v-else class="floor-tags" @click.stop="clickPopupShow()">{{
  32. product.promotion.name
  33. }}</view>
  34. </view>
  35. <view
  36. v-if="product.actStatus == 0 && product.ladderPriceFlag == 1"
  37. class="floor-item-act"
  38. >
  39. <view class="floor-tags" @click.stop="clickPopupShow()">阶梯价格</view>
  40. </view>
  41. </view>
  42. <!--促销活动弹窗提示-->
  43. <tui-bottom-popup :radius="true" :show="popupShow" @close="hidePopup()">
  44. <view class="tui-popup-box clearfix">
  45. <template v-if="product.actStatus == 0 && product.ladderPriceFlag == 1">
  46. <view class="tui-scrollview-box">
  47. <view class="ladder-main clearfix">
  48. <view class="ladder-item">
  49. <view class="ladder-item-td">起订量</view>
  50. <view class="ladder-item-td">价格</view>
  51. </view>
  52. <view
  53. class="ladder-item"
  54. v-for="(ladd, index) in product.ladderPriceList"
  55. :key="index"
  56. >
  57. <view class="ladder-item-td">{{ ladd.buyNumRangeShow }}</view>
  58. <view class="ladder-item-td">{{ ladd.buyPrice | NumFormat }}</view>
  59. </view>
  60. </view>
  61. </view>
  62. </template>
  63. <template v-else>
  64. <view class="tui-scrollview-box">
  65. <view class="box-text">
  66. <text>促销时间:</text>
  67. <text class="txt" v-if="product.promotion.status == 1">不限时</text>
  68. <text class="txt" v-else
  69. >{{ product.promotion.beginTime }}~{{ product.promotion.endTime }}</text
  70. >
  71. </view>
  72. <view class="box-title" v-show="product.promotion.mode == 2">
  73. <text>购买{{ product.promotion.name }}商品,满</text>
  74. <text class="txt"
  75. >¥{{
  76. product.promotion == null
  77. ? '0.00'
  78. : product.promotion.touchPrice | NumFormat
  79. }}</text
  80. >减
  81. <text class="txt"
  82. >¥{{
  83. product.promotion == null
  84. ? '0.00'
  85. : product.promotion.reducedPrice | NumFormat
  86. }}</text
  87. >
  88. </view>
  89. <view class="box-title" v-show="product.promotion.mode == 3">
  90. <text>购买{{ product.promotion.name }}商品,满</text>
  91. <text class="txt"
  92. >¥{{
  93. product.promotion == null
  94. ? '0.00'
  95. : product.promotion.touchPrice | NumFormat
  96. }}</text
  97. >赠送商品
  98. </view>
  99. <view class="box-product" v-show="product.promotion.mode == 3">
  100. <view
  101. class="box-product-main"
  102. v-for="(item, index) in product.promotion.productGifts"
  103. :key="index"
  104. >
  105. <view class="image"
  106. ><image :src="item.mainImage" mode="widthFix"></image
  107. ></view>
  108. <view class="info">
  109. <view class="name">{{ item.productName }}</view>
  110. <view class="num">X{{ item.productCount }}</view>
  111. </view>
  112. </view>
  113. </view>
  114. </view>
  115. </template>
  116. <view
  117. class="tui-right-flex tui-popup-btn"
  118. :style="{ paddingBottom: isIphoneX ? '68rpx' : '0rpx' }"
  119. >
  120. <view class="tui-flex-1">
  121. <view
  122. class="tui-button"
  123. v-if="product.promotion.type == 2"
  124. @click="goGoodActiveFn(product.promotion.id)"
  125. >更多凑单商品</view
  126. >
  127. <view class="tui-button" v-else @click="hidePopup()">了解</view>
  128. </view>
  129. </view>
  130. </view>
  131. </tui-bottom-popup>
  132. <!-- </template> -->
  133. </view>
  134. </template>
  135. <script>
  136. import { mapState, mapMutations } from 'vuex'
  137. import uniGrader from '@/components/uni-grade/uni-grade.vue'
  138. export default {
  139. name: 'cm-price',
  140. components: {
  141. uniGrader
  142. },
  143. props: {
  144. product: {
  145. type: Object
  146. },
  147. userIdentity: {
  148. type: Number,
  149. default: 2
  150. },
  151. shopID: {
  152. type: Number,
  153. default: 2
  154. },
  155. ladderPriceList: {
  156. type: Array
  157. },
  158. promotion: {
  159. type: Object
  160. }
  161. },
  162. data() {
  163. return {
  164. popupShow: false,
  165. promotionType: 0,
  166. isIphoneX: this.$store.state.isIphoneX
  167. }
  168. },
  169. filters: {
  170. NumFormat: function(text) {
  171. //处理金额
  172. return Number(text).toFixed(2)
  173. }
  174. },
  175. created() {},
  176. computed: {
  177. ...mapState(['hasLogin', 'isWxAuthorize'])
  178. },
  179. methods: {
  180. clickPopupShow(type) {
  181. this.popupShow = true
  182. this.promotionType = type
  183. },
  184. hidePopup() {
  185. this.popupShow = false
  186. },
  187. promotionFormat(promo) {
  188. //促销活动类型数据处理
  189. if (promo != null) {
  190. if (promo.type == 1 && promo.mode == 1) {
  191. return true
  192. } else {
  193. return false
  194. }
  195. }
  196. return false
  197. },
  198. goUpgradeApply() {
  199. this.$api.navigateTo('/pages/login/apply')
  200. },
  201. loginClick() {
  202. this.$api.navigateTo('/pages/login/login')
  203. },
  204. goGoodActiveFn(id) {
  205. this.$parent.popupShow = false
  206. this.$api.navigateTo('/pages/goods/goods-active?id=' + id)
  207. }
  208. }
  209. }
  210. </script>
  211. <style lang="scss">
  212. .tui-flex-1 {
  213. flex: 1;
  214. }
  215. .tui-popup-box {
  216. position: relative;
  217. box-sizing: border-box;
  218. min-height: 220rpx;
  219. padding: 24rpx 24rpx 0 24rpx;
  220. }
  221. .tui-scrollview-box {
  222. width: 100%;
  223. height: auto;
  224. float: left;
  225. box-sizing: border-box;
  226. .ladder-main {
  227. width: 100%;
  228. min-height: 240rpx;
  229. border: 1px solid rgba(225, 86, 22, 0.3);
  230. border-radius: 10rpx;
  231. .ladder-item {
  232. width: 100%;
  233. height: 80rpx;
  234. float: left;
  235. border-bottom: 1px solid rgba(225, 86, 22, 0.3);
  236. &:nth-child(1) {
  237. .ladder-item-td {
  238. color: #333333;
  239. }
  240. }
  241. &:last-child {
  242. border-bottom: none;
  243. }
  244. .ladder-item-td {
  245. width: 50%;
  246. text-align: center;
  247. line-height: 80rpx;
  248. font-size: $font-size-24;
  249. color: $color-system;
  250. box-sizing: border-box;
  251. float: left;
  252. &:nth-child(1) {
  253. border-right: 1px solid rgba(225, 86, 22, 0.3);
  254. }
  255. }
  256. }
  257. }
  258. .box-title {
  259. font-size: $font-size-26;
  260. color: $text-color;
  261. text-align: left;
  262. line-height: 56rpx;
  263. .txt {
  264. color: $color-system;
  265. margin: 0 8rpx;
  266. }
  267. }
  268. .box-text{
  269. font-size: $font-size-26;
  270. color: $text-color;
  271. text-align: left;
  272. line-height: 56rpx;
  273. .txt{
  274. color: #ff2a2a;
  275. }
  276. }
  277. .box-product {
  278. width: 100%;
  279. height: auto;
  280. margin-top: 20rpx;
  281. .title {
  282. font-size: $font-size-24;
  283. color: $text-color;
  284. text-align: left;
  285. line-height: 54rpx;
  286. }
  287. .box-product-main {
  288. width: 100%;
  289. height: 136rpx;
  290. float: left;
  291. margin: 10rpx 0;
  292. .image {
  293. width: 134rpx;
  294. height: 134rpx;
  295. border: 1px solid #ebebeb;
  296. float: left;
  297. image {
  298. width: 100%;
  299. height: 100%;
  300. display: block;
  301. }
  302. }
  303. .info {
  304. width: 540rpx;
  305. height: 134rpx;
  306. float: left;
  307. margin-left: 16rpx;
  308. position: relative;
  309. .name {
  310. width: 100%;
  311. float: left;
  312. line-height: 40rpx;
  313. font-size: $font-size-28;
  314. color: $text-color;
  315. -o-text-overflow: ellipsis;
  316. text-overflow: ellipsis;
  317. display: -webkit-box;
  318. word-break: break-all;
  319. -webkit-box-orient: vertical;
  320. -webkit-line-clamp: 2;
  321. overflow: hidden;
  322. }
  323. .num {
  324. width: 100%;
  325. height: 44rpx;
  326. font-size: $font-size-24;
  327. color: $text-color;
  328. text-align: left;
  329. line-height: 44rpx;
  330. position: absolute;
  331. bottom: 0;
  332. left: 0;
  333. }
  334. }
  335. }
  336. }
  337. }
  338. .tui-popup-btn {
  339. width: 100%;
  340. height: auto;
  341. float: left;
  342. margin-top: 24rpx;
  343. .tui-button {
  344. width: 100%;
  345. height: 88rpx;
  346. background: $btn-confirm;
  347. line-height: 88rpx;
  348. text-align: center;
  349. color: #ffffff;
  350. font-size: $font-size-28;
  351. border-radius: 44rpx;
  352. }
  353. }
  354. </style>