cm-price.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543
  1. <template name="cm-price">
  2. <!-- 商品详情价格判断 -->
  3. <view class="wrap-main">
  4. <template v-if="!hasLogin">
  5. <view class="p-login grade tui-skeleton-fillet">
  6. <text class="p-no">¥</text>
  7. <uni-grader :grade="Number(product.priceGrade)"></uni-grader>
  8. <view class="floor-item-act">
  9. <template v-if="product.actStatus == 1" >
  10. <view
  11. v-if="product.promotions.type == 1 && product.promotions.mode == 1"
  12. class="floor-tags"
  13. @click.stop="clickPopupShow()"
  14. >
  15. {{ product.promotions.name }}<text v-if="hasLogin">:¥{{ product.price | NumFormat }}</text>
  16. </view>
  17. <view v-else class="floor-tags" @click.stop="clickPopupShow()">{{ product.promotions.name }}</view>
  18. </template>
  19. <template v-else>
  20. <view class="svip-tags" v-if="product.ladderPriceFlag == 2">
  21. <view class="tags none">SVIP</view>
  22. </view>
  23. <view class="svip-tags" v-if="product.ladderPriceFlag == 1">
  24. <view class="tags">SVIP</view> <view class="price">8折</view>
  25. </view>
  26. <view class="svip-tags" v-if="product.ladderPriceFlag == 0">
  27. <view class="tags">SVIP</view>
  28. <view class="price">¥{{ product.price | NumFormat }}</view>
  29. </view>
  30. </template>
  31. </view>
  32. <view v-if="product.actStatus == 0 && product.ladderPriceFlag === 1" class="floor-item-act">
  33. <view class="floor-tags" @click.stop="clickPopupShow()">阶梯价格</view>
  34. </view>
  35. <view class="floor-item-btn"> <view class="btn" @click.stop="loginClick">登录查看价格</view> </view>
  36. </view>
  37. </template>
  38. <template v-else>
  39. <!-- 协销 -->
  40. <template v-if="userIdentity == 1">
  41. <view class="wrap-main-item">
  42. <view
  43. class="p-price tui-skeleton-fillet"
  44. :class="PromotionsFormat(product.promotions) ? 'none' : ''"
  45. >
  46. <text class="txt sm">¥</text>
  47. <text class="txt big">{{
  48. (PromotionsFormat(product.promotions) ? product.originalPrice : product.price) | NumFormat
  49. }}</text>
  50. </view>
  51. <view class="floor-item-act">
  52. <template v-if="product.actStatus == 1" >
  53. <view
  54. v-if="product.promotions.type == 1 && product.promotions.mode == 1"
  55. class="floor-tags"
  56. @click.stop="clickPopupShow(1)"
  57. >
  58. {{ product.promotions.name
  59. }}<text v-if="hasLogin"
  60. >:¥{{
  61. product.promotions == null ? '0.00' : product.promotions.touchPrice | NumFormat
  62. }}</text
  63. >
  64. </view>
  65. <view v-else class="floor-tags" @click.stop="clickPopupShow()">{{
  66. product.promotions.name
  67. }}</view>
  68. </template>
  69. <template v-if="product.svipProductFlag == 1">
  70. <view class="svip-tags">
  71. <view class="tags">SVIP</view>
  72. </view>
  73. </template>
  74. </view>
  75. <view v-if="product.actStatus == 0 && product.ladderPriceFlag == 1" class="floor-item-act">
  76. <view class="floor-tags" @click.stop="clickPopupShow()">阶梯价格</view>
  77. </view>
  78. </view>
  79. </template>
  80. <!-- 资质机构 -->
  81. <template v-if="userIdentity == 2">
  82. <view class="wrap-main-item">
  83. <view v-if="product.priceFlag == 1" class="wrap-main-text">¥未公开价格</view>
  84. <view
  85. v-else
  86. class="p-price tui-skeleton-fillet"
  87. :class="PromotionsFormat(product.promotions) ? 'none' : ''"
  88. >
  89. <text class="txt sm">¥</text>
  90. <text class="txt big">{{
  91. (PromotionsFormat(product.promotions) ? product.originalPrice : product.price) | NumFormat
  92. }}</text>
  93. </view>
  94. <view class="floor-item-act">
  95. <template v-if="product.actStatus == 1" >
  96. <view
  97. v-if="product.promotions.type == 1 && product.promotions.mode == 1"
  98. class="floor-tags"
  99. @click.stop="clickPopupShow(1)"
  100. >
  101. {{ product.promotions.name
  102. }}<text v-if="hasLogin && product.priceFlag != 1"
  103. >:¥{{
  104. product.promotions == null ? '0.00' : product.promotions.touchPrice | NumFormat
  105. }}</text
  106. >
  107. </view>
  108. <view v-else class="floor-tags" @click.stop="clickPopupShow()">{{
  109. product.promotions.name
  110. }}</view>
  111. </template>
  112. <template v-if="product.svipProductFlag == 1">
  113. <view class="svip-tags">
  114. <view class="tags">SVIP</view> <view class="price">{{ product.svipPriceTag }}</view>
  115. </view>
  116. </template>
  117. </view>
  118. <view v-if="product.actStatus == 0 && product.ladderPriceFlag == 1" class="floor-item-act">
  119. <view class="floor-tags" @click.stop="clickPopupShow()">阶梯价格</view>
  120. </view>
  121. </view>
  122. </template>
  123. <!-- 供应商 -->
  124. <template v-if="userIdentity == 3">
  125. <template v-if="product.shopID === shopID">
  126. <view class="wrap-main-item">
  127. <view v-if="product.priceFlag == 1" class="wrap-main-text">¥未公开价格</view>
  128. <view
  129. v-else
  130. class="p-price tui-skeleton-fillet"
  131. :class="PromotionsFormat(product.promotions) ? 'none' : ''"
  132. >
  133. <text class="txt sm">¥</text>
  134. <text class="txt big">{{
  135. (PromotionsFormat(product.promotions) ? product.originalPrice : product.price)
  136. | NumFormat
  137. }}</text>
  138. </view>
  139. <view class="floor-item-act">
  140. <template v-if="product.actStatus == 1" >
  141. <view
  142. v-if="product.promotions.type == 1 && product.promotions.mode == 1"
  143. class="floor-tags"
  144. @click.stop="clickPopupShow(1)"
  145. >
  146. {{ product.promotions.name
  147. }}<text v-if="hasLogin && product.priceFlag != 1"
  148. >:¥{{
  149. product.promotions == null ? '0.00' : product.promotions.touchPrice | NumFormat
  150. }}</text
  151. >
  152. </view>
  153. <view v-else class="floor-tags" @click.stop="clickPopupShow()">{{
  154. product.promotions.name
  155. }}</view>
  156. </template>
  157. <template v-if="product.svipProductFlag == 1">
  158. <view class="svip-tags">
  159. <view class="tags">SVIP</view> <view class="price">{{ product.svipPriceTag }}</view>
  160. </view>
  161. </template>
  162. </view>
  163. <view v-if="product.actStatus == 0 && product.ladderPriceFlag == 1" class="floor-item-act">
  164. <view class="floor-tags" @click.stop="clickPopupShow()">阶梯价格</view>
  165. </view>
  166. </view>
  167. </template>
  168. <template v-else>
  169. <view class="p-login grade tui-skeleton-fillet">
  170. <text class="p-no">¥</text>
  171. <uni-grader :grade="Number(product.priceGrade)"></uni-grader>
  172. </view>
  173. </template>
  174. </template>
  175. <!-- 个人机构 -->
  176. <template v-if="userIdentity == 4">
  177. <template v-if="product.priceFlag == 1">
  178. <text class="wrap-main-text">¥未公开价格</text>
  179. </template>
  180. <template v-if="product.priceFlag == 2">
  181. <text class="wrap-main-text">¥价格仅会员可见</text>
  182. <view class="floor-item-btn">
  183. <view class="btn" @click.stop="goUpgradeApply">升级会员查看价格</view>
  184. </view>
  185. </template>
  186. <template v-if="product.priceFlag == 0">
  187. <view class="wrap-main-item">
  188. <view
  189. class="p-price tui-skeleton-fillet"
  190. :class="PromotionsFormat(product.promotions) ? 'none' : ''"
  191. >
  192. <text class="txt sm">¥</text>
  193. <text class="txt big">{{
  194. (PromotionsFormat(product.promotions) ? product.originalPrice : product.price)
  195. | NumFormat
  196. }}</text>
  197. </view>
  198. <view class="floor-item-act">
  199. <template v-if="product.actStatus == 1" >
  200. <view
  201. v-if="PromotionsFormat(product.promotions)"
  202. class="floor-tags"
  203. @click.stop="clickPopupShow(1)"
  204. >
  205. {{ product.promotions.name
  206. }}<text v-if="hasLogin && product.priceFlag != 1"
  207. >:¥{{
  208. product.promotions == null ? '0.00' : product.promotions.touchPrice | NumFormat
  209. }}</text
  210. >
  211. </view>
  212. <view v-else class="floor-tags" @click.stop="clickPopupShow()">{{
  213. product.promotions.name
  214. }}</view>
  215. </template>
  216. <template v-if="product.svipProductFlag == 1">
  217. <view class="svip-tags">
  218. <view class="tags">SVIP</view> <view class="price">{{ product.svipPriceTag }}</view>
  219. </view>
  220. </template>
  221. </view>
  222. <view v-if="product.actStatus == 0 && product.ladderPriceFlag == 1" class="floor-item-act">
  223. <view class="floor-tags" @click.stop="clickPopupShow()">阶梯价格</view>
  224. </view>
  225. </view>
  226. </template>
  227. </template>
  228. <!--促销活动弹窗提示-->
  229. <tui-bottom-popup :radius="true" :show="popupShow" @close="hidePopup()">
  230. <view class="tui-popup-box clearfix">
  231. <template v-if="product.actStatus == 0 && product.ladderPriceFlag == 1">
  232. <view class="tui-scrollview-box">
  233. <view class="ladder-main clearfix">
  234. <view class="ladder-item">
  235. <view class="ladder-item-td">起订量</view> <view class="ladder-item-td">价格</view>
  236. </view>
  237. <view class="ladder-item" v-for="(ladd, index) in product.ladderPriceList" :key="index">
  238. <view class="ladder-item-td">{{ ladd.numRange }}</view>
  239. <view class="ladder-item-td">{{ ladd.buyPrice | NumFormat }}</view>
  240. </view>
  241. </view>
  242. </view>
  243. </template>
  244. <template v-else>
  245. <view class="tui-scrollview-box">
  246. <view class="box-text">
  247. <text>促销时间:</text>
  248. <text class="txt" v-if="product.promotions.status == 1">不限时</text>
  249. <text class="txt" v-else
  250. >{{ product.promotions.beginTime }} ~ {{ product.promotions.endTime }}</text
  251. >
  252. </view>
  253. <view class="box-title" v-show="product.promotions.mode == 2">
  254. <text>购买{{ product.promotions.name }}商品,满</text>
  255. <text class="txt"
  256. >¥{{
  257. product.promotions == null ? '0.00' : product.promotions.touchPrice | NumFormat
  258. }}</text
  259. >减
  260. <text class="txt"
  261. >¥{{
  262. product.promotions == null
  263. ? '0.00'
  264. : product.promotions.reducedPrice | NumFormat
  265. }}</text
  266. >
  267. </view>
  268. <view class="box-title" v-show="product.promotions.mode == 3">
  269. <text>购买{{ product.promotions.name }}商品,满</text>
  270. <text class="txt"
  271. >¥{{
  272. product.promotions == null ? '0.00' : product.promotions.touchPrice | NumFormat
  273. }}</text
  274. >赠送商品
  275. </view>
  276. <view class="box-product" v-show="product.promotions.mode == 3">
  277. <view
  278. class="box-product-main"
  279. v-for="(item, index) in product.promotions.giftList"
  280. :key="index"
  281. >
  282. <view class="image"><image :src="item.image" mode=""></image></view>
  283. <view class="info">
  284. <view class="name">{{ item.name }}</view>
  285. <view class="num">X{{ item.number }}</view>
  286. </view>
  287. </view>
  288. </view>
  289. </view>
  290. </template>
  291. <view class="tui-right-flex tui-popup-btn" :style="{ paddingBottom: isIphoneX ? '68rpx' : '0rpx' }">
  292. <view class="tui-flex-1">
  293. <view
  294. class="tui-button"
  295. v-if="product.promotions.type == 2"
  296. @click="goGoodActiveFn(product.promotions.id)"
  297. >更多凑单商品</view
  298. >
  299. <view class="tui-button" v-else @click="hidePopup()">了解</view>
  300. </view>
  301. </view>
  302. </view>
  303. </tui-bottom-popup>
  304. </template>
  305. </view>
  306. </template>
  307. <script>
  308. import { mapState, mapMutations } from 'vuex'
  309. import uniGrader from '@/components/uni-grade/uni-grade.vue'
  310. export default {
  311. name: 'cm-price',
  312. components: {
  313. uniGrader
  314. },
  315. props: {
  316. product: {
  317. type: Object
  318. },
  319. userIdentity: {
  320. type: Number,
  321. default: 2
  322. },
  323. shopID: {
  324. type: Number,
  325. default: 2
  326. },
  327. ladderPriceList: {
  328. type: Array
  329. },
  330. promotions: {
  331. type: Object
  332. }
  333. },
  334. data() {
  335. return {
  336. popupShow: false,
  337. promotionsType: 0,
  338. isIphoneX: this.$store.state.isIphoneX
  339. }
  340. },
  341. filters: {
  342. NumFormat: function(text) {
  343. //处理金额
  344. return Number(text).toFixed(2)
  345. }
  346. },
  347. created() {},
  348. computed: {
  349. ...mapState(['hasLogin', 'isWxAuthorize'])
  350. },
  351. methods: {
  352. clickPopupShow(type) {
  353. this.popupShow = true
  354. this.promotionsType = type
  355. },
  356. hidePopup() {
  357. this.popupShow = false
  358. },
  359. PromotionsFormat(promo) {
  360. //促销活动类型数据处理
  361. if (promo != null) {
  362. if (promo.type == 1 && promo.mode == 1) {
  363. return true
  364. } else {
  365. return false
  366. }
  367. }
  368. return false
  369. },
  370. goUpgradeApply() {
  371. // 友盟埋点升级查看价格点击事件
  372. if (process.env.NODE_ENV != 'development') {
  373. this.$uma.trackEvent('Um_Event_ProductUpgrade', {
  374. Um_Key_PageName: '升级查看价格',
  375. Um_Key_SourcePage: '商品详情'
  376. })
  377. }
  378. this.$api.navigateTo('/pages/login/apply')
  379. },
  380. loginClick() {
  381. // 友盟埋点商品详情登录查看价格点击事件
  382. if (process.env.NODE_ENV != 'development') {
  383. this.$uma.trackEvent('Um_Event_ProductLogin', {
  384. Um_Key_PageName: '去登录',
  385. Um_Key_SourcePage: '商品详情登录查看价格'
  386. })
  387. }
  388. this.$api.navigateTo('/pages/login/login')
  389. },
  390. goGoodActiveFn(id) {
  391. this.$parent.popupShow = false
  392. this.$api.navigateTo('/pages/goods/goods-active?id=' + id)
  393. }
  394. }
  395. }
  396. </script>
  397. <style lang="scss">
  398. .tui-flex-1 {
  399. flex: 1;
  400. }
  401. .tui-popup-box {
  402. position: relative;
  403. box-sizing: border-box;
  404. min-height: 220rpx;
  405. padding: 24rpx 24rpx 0 24rpx;
  406. }
  407. .tui-scrollview-box {
  408. width: 100%;
  409. height: auto;
  410. float: left;
  411. box-sizing: border-box;
  412. .ladder-main {
  413. width: 100%;
  414. min-height: 240rpx;
  415. border: 1px solid rgba(225, 86, 22, 0.3);
  416. border-radius: 10rpx;
  417. .ladder-item {
  418. width: 100%;
  419. height: 80rpx;
  420. float: left;
  421. border-bottom: 1px solid rgba(225, 86, 22, 0.3);
  422. &:nth-child(1) {
  423. .ladder-item-td {
  424. color: #333333;
  425. }
  426. }
  427. &:last-child {
  428. border-bottom: none;
  429. }
  430. .ladder-item-td {
  431. width: 50%;
  432. text-align: center;
  433. line-height: 80rpx;
  434. font-size: $font-size-24;
  435. color: $color-system;
  436. box-sizing: border-box;
  437. float: left;
  438. &:nth-child(1) {
  439. border-right: 1px solid rgba(225, 86, 22, 0.3);
  440. }
  441. }
  442. }
  443. }
  444. .box-title {
  445. font-size: $font-size-26;
  446. color: $text-color;
  447. text-align: left;
  448. line-height: 56rpx;
  449. .txt {
  450. color: $color-system;
  451. margin: 0 8rpx;
  452. }
  453. }
  454. .box-text {
  455. font-size: $font-size-26;
  456. color: $text-color;
  457. text-align: left;
  458. line-height: 56rpx;
  459. .txt {
  460. color: $color-system;
  461. }
  462. }
  463. .box-product {
  464. width: 100%;
  465. height: auto;
  466. margin-top: 20rpx;
  467. .title {
  468. font-size: $font-size-24;
  469. color: $text-color;
  470. text-align: left;
  471. line-height: 54rpx;
  472. }
  473. .box-product-main {
  474. width: 100%;
  475. height: 136rpx;
  476. float: left;
  477. margin: 10rpx 0;
  478. .image {
  479. width: 134rpx;
  480. height: 134rpx;
  481. border: 1px solid #ebebeb;
  482. float: left;
  483. image {
  484. width: 100%;
  485. height: 100%;
  486. display: block;
  487. }
  488. }
  489. .info {
  490. width: 540rpx;
  491. height: 134rpx;
  492. float: left;
  493. margin-left: 16rpx;
  494. position: relative;
  495. .name {
  496. width: 100%;
  497. float: left;
  498. line-height: 40rpx;
  499. font-size: $font-size-28;
  500. color: $text-color;
  501. -o-text-overflow: ellipsis;
  502. text-overflow: ellipsis;
  503. display: -webkit-box;
  504. word-break: break-all;
  505. -webkit-box-orient: vertical;
  506. -webkit-line-clamp: 2;
  507. overflow: hidden;
  508. }
  509. .num {
  510. width: 100%;
  511. height: 44rpx;
  512. font-size: $font-size-24;
  513. color: $text-color;
  514. text-align: left;
  515. line-height: 44rpx;
  516. position: absolute;
  517. bottom: 0;
  518. left: 0;
  519. }
  520. }
  521. }
  522. }
  523. }
  524. .tui-popup-btn {
  525. width: 100%;
  526. height: auto;
  527. float: left;
  528. margin-top: 24rpx;
  529. .tui-button {
  530. width: 100%;
  531. height: 88rpx;
  532. background: $btn-confirm;
  533. line-height: 88rpx;
  534. text-align: center;
  535. color: #ffffff;
  536. font-size: $font-size-28;
  537. border-radius: 44rpx;
  538. }
  539. }
  540. </style>