cm-price-activity.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  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> <text class="txt big">{{ showIndexOfMoney }} </text>
  8. <text class="txt sm">{{ smallMoney }} </text>
  9. </view>
  10. <view class="floor-item-act" v-if="product.activeStatus == 1 && product.ladderList.length > 0">
  11. <text class="tag tag-01">促销</text>
  12. <view class="tag tag-02" @click.stop="clickPopupShow()">活动价</view>
  13. </view>
  14. </view>
  15. <!--促销活动弹窗提示-->
  16. <tui-bottom-popup :radius="true" :show="popupShow" @close="hidePopup()">
  17. <view class="tui-popup-box clearfix">
  18. <template v-if="product.activeStatus == 1">
  19. <view class="tui-scrollview-box">
  20. <view class="ladder-main clearfix">
  21. <view class="ladder-item">
  22. <view class="ladder-item-td">购买数</view> <view class="ladder-item-td">价格</view>
  23. </view>
  24. <view class="ladder-item" v-for="(ladd, index) in product.ladderList" :key="index">
  25. <view class="ladder-item-td">{{ ladd.buyNum }}</view>
  26. <view class="ladder-item-td">{{ ladd.buyPrice | formatPrice }}</view>
  27. </view>
  28. </view>
  29. </view>
  30. </template>
  31. <template v-else>
  32. <view class="tui-scrollview-box">
  33. <view class="box-text">
  34. <text>促销时间:</text>
  35. <text class="txt" v-if="product.promotion.status == 1">不限时</text>
  36. <text class="txt" v-else
  37. >{{ product.promotion.beginTime }}~{{ product.promotion.endTime }}</text
  38. >
  39. </view>
  40. <view class="box-title" v-show="product.promotion.mode == 2">
  41. <text>购买{{ product.promotion.name }}商品,满</text>
  42. <text class="txt"
  43. >¥{{
  44. product.promotion == null ? '0.00' : product.promotion.touchPrice | formatPrice
  45. }}</text
  46. >减
  47. <text class="txt"
  48. >¥{{
  49. product.promotion == null ? '0.00' : product.promotion.reducedPrice | formatPrice
  50. }}</text
  51. >
  52. </view>
  53. <view class="box-title" v-show="product.promotion.mode == 3">
  54. <text>购买{{ product.promotion.name }}商品,满</text>
  55. <text class="txt"
  56. >¥{{
  57. product.promotion == null ? '0.00' : product.promotion.touchPrice | formatPrice
  58. }}</text
  59. >赠送商品
  60. </view>
  61. <view class="box-product" v-show="product.promotion.mode == 3">
  62. <view
  63. class="box-product-main"
  64. v-for="(item, index) in product.promotion.productGifts"
  65. :key="index"
  66. >
  67. <view class="image"><image :src="item.mainImage" mode="widthFix"></image></view>
  68. <view class="info">
  69. <view class="name">{{ item.productName }}</view>
  70. <view class="num">X{{ item.productCount }}</view>
  71. </view>
  72. </view>
  73. </view>
  74. </view>
  75. </template>
  76. <view class="tui-right-flex tui-popup-btn">
  77. <view class="tui-flex-1">
  78. <view
  79. class="tui-button"
  80. v-if="product.promotion.type == 2"
  81. @click="goGoodActiveFn(product.promotion.id)"
  82. >更多凑单商品</view
  83. >
  84. <view class="tui-button" v-else @click="hidePopup()">了解</view>
  85. </view>
  86. </view>
  87. </view>
  88. </tui-bottom-popup>
  89. <!-- </template> -->
  90. </view>
  91. </template>
  92. <script>
  93. import { mapGetters } from 'vuex'
  94. export default {
  95. name: 'cm-price',
  96. props: {
  97. product: {
  98. type: Object
  99. },
  100. userIdentity: {
  101. type: Number,
  102. default: 2
  103. },
  104. ladderList: {
  105. type: Array
  106. },
  107. promotion: {
  108. type: Object
  109. }
  110. },
  111. data() {
  112. return {
  113. productInfo: {},
  114. popupShow: false,
  115. promotionType: 0,
  116. ableUserMoney: '',
  117. showIndexOfMoney: '',
  118. smallMoney: ''
  119. }
  120. },
  121. created() {
  122. this.InfoData(this.product)
  123. },
  124. computed: {
  125. ...mapGetters(['hasLogin', 'isWxAuthorize', 'isIphoneX'])
  126. },
  127. methods: {
  128. InfoData(data) {
  129. this.productInfo = data
  130. if (this.productInfo.price == 0) {
  131. this.showIndexOfMoney = '0'
  132. this.smallMoney = '.00'
  133. } else {
  134. this.ableUserMoney = this.$api.FormatMoney(this.productInfo.price)
  135. let i = this.ableUserMoney.toString().lastIndexOf('.')
  136. if (i == -1) {
  137. this.showIndexOfMoney = this.$api.FormatMoney(this.ableUserMoney)
  138. this.smallMoney = '.00'
  139. } else {
  140. this.smallMoney = this.ableUserMoney.toString().substring(i, i + 3)
  141. this.showIndexOfMoney = this.$api.FormatMoney(this.ableUserMoney.toString().substring(0, i))
  142. if (this.smallMoney.length == 2) {
  143. //补0,实际上用不着
  144. this.smallMoney = this.smallMoney + '0'
  145. }
  146. }
  147. }
  148. console.log('this.showIndexOfMoney', this.showIndexOfMoney)
  149. console.log('this.smallMoney', this.smallMoney)
  150. },
  151. clickPopupShow(type) {
  152. if (this.product.ladderList.length > 0) {
  153. this.popupShow = true
  154. this.promotionType = type
  155. }
  156. },
  157. hidePopup() {
  158. this.popupShow = false
  159. },
  160. promotionFormat(promo) {
  161. //促销活动类型数据处理
  162. if (promo != null) {
  163. if (promo.type == 1 && promo.mode == 1) {
  164. return true
  165. } else {
  166. return false
  167. }
  168. }
  169. return false
  170. },
  171. goUpgradeApply() {
  172. this.$api.navigateTo('/pages/login/apply')
  173. },
  174. loginClick() {
  175. this.$api.navigateTo('/pages/authorize/login')
  176. },
  177. goGoodActiveFn(id) {
  178. this.$parent.popupShow = false
  179. this.$api.navigateTo('/pages/goods/goods-active?id=' + id)
  180. }
  181. }
  182. }
  183. </script>
  184. <style lang="scss">
  185. .tui-flex-1 {
  186. flex: 1;
  187. }
  188. .tui-popup-box {
  189. position: relative;
  190. box-sizing: border-box;
  191. min-height: 220rpx;
  192. padding: 24rpx 24rpx 0 24rpx;
  193. }
  194. .tui-scrollview-box {
  195. width: 100%;
  196. height: auto;
  197. float: left;
  198. box-sizing: border-box;
  199. .ladder-main {
  200. width: 100%;
  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: #ff457b;
  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. // .wrap-main{
  327. // .floor-item-act{
  328. // &::after{
  329. // content: "";
  330. // display: block;
  331. // clear: both;
  332. // }
  333. // .tag{
  334. // margin-right: 10rpx;
  335. // float: left;
  336. // }
  337. // }
  338. // }
  339. </style>