cm-price.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422
  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 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. this.$api.navigateTo('/pages/login/login')
  245. },
  246. goGoodActiveFn(id){
  247. this.$parent.popupShow = false
  248. this.$api.navigateTo('/pages/goods/goods-active?id='+id)
  249. }
  250. },
  251. }
  252. </script>
  253. <style lang="scss">
  254. .tui-flex-1 {
  255. flex: 1;
  256. }
  257. .tui-popup-box {
  258. position: relative;
  259. box-sizing: border-box;
  260. min-height: 220rpx;
  261. padding:24rpx 24rpx 0 24rpx;
  262. }
  263. .tui-scrollview-box{
  264. width: 100%;
  265. height: auto;
  266. float: left;
  267. box-sizing: border-box;
  268. .ladder-main{
  269. width: 100%;
  270. min-height: 240rpx;
  271. border: 1px solid rgba(225,86,22,0.3);
  272. border-radius: 10rpx;
  273. .ladder-item{
  274. width: 100%;
  275. height: 80rpx;
  276. float: left;
  277. border-bottom: 1px solid rgba(225,86,22,0.3);
  278. &:nth-child(1){
  279. .ladder-item-td{
  280. color: #333333;
  281. }
  282. }
  283. &:last-child{
  284. border-bottom: none;
  285. }
  286. .ladder-item-td{
  287. width:50%;
  288. text-align: center;
  289. line-height: 80rpx;
  290. font-size: $font-size-24;
  291. color: $color-system;
  292. box-sizing: border-box;
  293. float: left;
  294. &:nth-child(1){
  295. border-right: 1px solid rgba(225,86,22,0.3);
  296. }
  297. }
  298. }
  299. }
  300. .box-title{
  301. font-size: $font-size-26;
  302. color: $text-color;
  303. text-align: left;
  304. line-height: 56rpx;
  305. .txt{
  306. color: $color-system;
  307. margin: 0 8rpx;
  308. }
  309. }
  310. .box-text{
  311. font-size: $font-size-26;
  312. color: $text-color;
  313. text-align: left;
  314. line-height: 56rpx;
  315. .txt{
  316. color: $color-system;
  317. }
  318. }
  319. .box-product{
  320. width: 100%;
  321. height: auto;
  322. margin-top: 20rpx;
  323. .title{
  324. font-size: $font-size-24;
  325. color: $text-color;
  326. text-align: left;
  327. line-height: 54rpx;
  328. }
  329. .box-product-main{
  330. width: 100%;
  331. height: 136rpx;
  332. float: left;
  333. margin: 10rpx 0;
  334. .image{
  335. width: 134rpx;
  336. height: 134rpx;
  337. border: 1px solid #EBEBEB;
  338. float: left;
  339. image{
  340. width: 100%;
  341. height: 100%;
  342. display: block;
  343. }
  344. }
  345. .info{
  346. width: 540rpx;
  347. height: 134rpx;
  348. float: left;
  349. margin-left: 16rpx;
  350. position: relative;
  351. .name{
  352. width: 100%;
  353. float: left;
  354. line-height: 40rpx;
  355. font-size: $font-size-28;
  356. color: $text-color;
  357. -o-text-overflow: ellipsis;
  358. text-overflow: ellipsis;
  359. display: -webkit-box;
  360. word-break: break-all;
  361. -webkit-box-orient: vertical;
  362. -webkit-line-clamp: 2;
  363. overflow: hidden;
  364. }
  365. .num{
  366. width: 100%;
  367. height: 44rpx;
  368. font-size: $font-size-24;
  369. color: $text-color;
  370. text-align: left;
  371. line-height: 44rpx;
  372. position: absolute;
  373. bottom: 0;
  374. left: 0;
  375. }
  376. }
  377. }
  378. }
  379. }
  380. .tui-popup-btn {
  381. width: 100%;
  382. height: auto;
  383. float: left;
  384. margin-top: 24rpx;
  385. .tui-button{
  386. width: 100%;
  387. height: 88rpx;
  388. background: $btn-confirm;
  389. line-height: 88rpx;
  390. text-align: center;
  391. color: #FFFFFF;
  392. font-size: $font-size-28;
  393. border-radius: 44rpx;
  394. }
  395. }
  396. </style>