cm-price.vue 7.2 KB

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