cm-price.vue 8.0 KB

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