cm-price.vue 13 KB

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