cm-price.vue 14 KB

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