cm-price.vue 17 KB

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