cm-price.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  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-stars :stars="parseInt(product.price1Grade)" :font-size='36' :width-info="180"></uni-stars>
  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 == 4">
  62. <template v-if="product.price1TextFlag == '1'">
  63. <text class="wrap-main-text">¥未公开价格</text>
  64. </template>
  65. <template v-if="product.price1TextFlag == '2'">
  66. <text class="wrap-main-text">¥价格仅会员可见</text>
  67. <view class="floor-item-btn">
  68. <view class="btn" @click.stop="goUpgradeApply">升级会员查看价格</view>
  69. </view>
  70. </template>
  71. <template v-if="product.price1TextFlag == '0'">
  72. <view class="wrap-main-item">
  73. <view class="p-price tui-skeleton-fillet" :class="PromotionsFormat(product.promotions) ? 'none' : ''">
  74. <text class="txt sm">¥</text>
  75. <text class="txt big">{{ (PromotionsFormat(product.promotions) ? product.price1 : product.retailPrice) | NumFormat }}</text>
  76. </view>
  77. <view v-if="product.actStatus==1" class="floor-item-act">
  78. <view v-if="product.promotions.type == 1 && product.promotions.mode == 1" class="floor-tags" @click.stop="clickPopupShow(1)">
  79. {{product.promotions.name}}<text v-if="hasLogin && product.price1TextFlag != '1'">:¥{{ product.promotions == null ? '0.00' : product.promotions.touchPrice | NumFormat }}</text>
  80. </view>
  81. <view v-else class="floor-tags" @click.stop="clickPopupShow()">{{product.promotions.name}}</view>
  82. </view>
  83. <view v-if="product.actStatus ==0 && product.ladderPriceFlag == 1" class="floor-item-act">
  84. <view class="floor-tags" @click.stop="clickPopupShow()">阶梯价格</view>
  85. </view>
  86. </view>
  87. </template>
  88. </template>
  89. <!--促销活动弹窗提示-->
  90. <tui-bottom-popup :radius="true" :show="popupShow" @close="hidePopup()">
  91. <view class="tui-popup-box clearfix">
  92. <template v-if="product.actStatus == 0 && product.ladderPriceFlag == 1">
  93. <view class="tui-scrollview-box">
  94. <view class="ladder-main">
  95. <view class="ladder-item">
  96. <view class="ladder-item-td">起订量</view>
  97. <view class="ladder-item-td">价格</view>
  98. </view>
  99. <view class="ladder-item" v-for="(ladd, index) in product.ladderPriceList" :key="index">
  100. <view class="ladder-item-td">{{ ladd.buyNumRangeShow }}</view>
  101. <view class="ladder-item-td">{{ ladd.buyPrice | NumFormat }}</view>
  102. </view>
  103. </view>
  104. </view>
  105. </template>
  106. <template v-else>
  107. <view class="tui-scrollview-box">
  108. <view class="box-text">
  109. <text>促销时间:</text>
  110. <text class="txt" v-if="product.promotions.status == 1">不限时</text>
  111. <text class="txt" v-else>{{ product.promotions.beginTime }} ~ {{ product.promotions.endTime }}</text>
  112. </view>
  113. <view class="box-title" v-show="product.promotions.mode ==2">
  114. <text>购买{{ product.promotions.name }}商品,满</text>
  115. <text class="txt">¥{{ product.promotions == null ? '0.00' : product.promotions.touchPrice | NumFormat }}</text>减
  116. <text class="txt">¥{{ product.promotions == null ? '0.00' : product.promotions.reducedPrice | NumFormat }}</text>
  117. </view>
  118. <view class="box-title" v-show="product.promotions.mode==3">
  119. <text>购买{{ product.promotions.name }}商品,满</text>
  120. <text class="txt">¥{{ product.promotions == null ? '0.00' : product.promotions.touchPrice | NumFormat }}</text>赠送商品
  121. </view>
  122. <view class="box-product" v-show="product.promotions.mode==3">
  123. <view class="box-product-main" v-for="(item, index) in product.romotions.giftList" :key="index">
  124. <view class="image"><image :src="item.image" mode="widthFix"></image></view>
  125. <view class="info">
  126. <view class="name">{{ item.name }}</view>
  127. <view class="num">X{{ item.number }}</view>
  128. </view>
  129. </view>
  130. </view>
  131. </view>
  132. </template>
  133. <view class="tui-right-flex tui-popup-btn" :style="{ paddingBottom :isIphoneX ? '68rpx' : '0rpx' }">
  134. <view class="tui-flex-1">
  135. <view class="tui-button" v-if="product.promotions.type == 2" @click="goGoodActiveFn(product.promotions.id)">更多凑单商品</view>
  136. <view class="tui-button" v-else @click="hidePopup()">了解</view>
  137. </view>
  138. </view>
  139. </view>
  140. </tui-bottom-popup>
  141. </template>
  142. </view>
  143. </template>
  144. <script>
  145. import { mapState,mapMutations } from 'vuex'
  146. export default{
  147. name:'cm-price',
  148. props:{
  149. product:{
  150. type:Object,
  151. },
  152. userIdentity: {
  153. type: Number,
  154. default: 2
  155. },
  156. ladderPriceList:{
  157. type: Array,
  158. },
  159. promotions:{
  160. type:Object,
  161. }
  162. },
  163. data() {
  164. return{
  165. popupShow:false,
  166. promotionsType:0,
  167. isIphoneX:this.$store.state.isIphoneX,
  168. }
  169. },
  170. filters: {
  171. NumFormat:function(text) {//处理金额
  172. return Number(text).toFixed(2);
  173. },
  174. },
  175. created() {
  176. },
  177. computed: {
  178. ...mapState(['hasLogin','isWxAuthorize'])
  179. },
  180. methods:{
  181. clickPopupShow(type){
  182. this.popupShow = true
  183. this.promotionsType = type
  184. },
  185. hidePopup(){
  186. this.popupShow = false
  187. },
  188. PromotionsFormat(promo){//促销活动类型数据处理
  189. if(promo!=null){
  190. if(promo.type == 1 && promo.mode == 1){
  191. return true
  192. }else{
  193. return false
  194. }
  195. }
  196. return false
  197. },
  198. goUpgradeApply(){
  199. this.$api.navigateTo('/pages/login/apply')
  200. },
  201. loginClick(){
  202. this.$api.navigateTo('/pages/login/login')
  203. },
  204. goGoodActiveFn(id){
  205. this.$parent.popupShow = false
  206. this.$api.navigateTo('/pages/goods/goods-active?id='+id)
  207. }
  208. },
  209. }
  210. </script>
  211. <style lang="scss">
  212. .tui-flex-1 {
  213. flex: 1;
  214. }
  215. .tui-popup-box {
  216. position: relative;
  217. box-sizing: border-box;
  218. min-height: 220rpx;
  219. padding:24rpx 24rpx 0 24rpx;
  220. }
  221. .tui-scrollview-box{
  222. width: 100%;
  223. height: auto;
  224. float: left;
  225. box-sizing: border-box;
  226. .ladder-main{
  227. width: 100%;
  228. height: 320rpx;
  229. border: 1px solid rgba(225,86,22,0.3);
  230. border-radius: 10rpx;
  231. .ladder-item{
  232. width: 100%;
  233. height: 80rpx;
  234. float: left;
  235. border-bottom: 1px solid rgba(225,86,22,0.3);
  236. &:nth-child(1){
  237. .ladder-item-td{
  238. color: #333333;
  239. }
  240. }
  241. &:last-child{
  242. border-bottom: none;
  243. }
  244. .ladder-item-td{
  245. width:50%;
  246. text-align: center;
  247. line-height: 80rpx;
  248. font-size: $font-size-24;
  249. color: $color-system;
  250. box-sizing: border-box;
  251. float: left;
  252. &:nth-child(1){
  253. border-right: 1px solid rgba(225,86,22,0.3);
  254. }
  255. }
  256. }
  257. }
  258. .box-title{
  259. font-size: $font-size-26;
  260. color: $text-color;
  261. text-align: left;
  262. line-height: 56rpx;
  263. .txt{
  264. color: $color-system;
  265. margin: 0 8rpx;
  266. }
  267. }
  268. .box-text{
  269. font-size: $font-size-26;
  270. color: $text-color;
  271. text-align: left;
  272. line-height: 56rpx;
  273. .txt{
  274. color: $color-system;
  275. }
  276. }
  277. .box-product{
  278. width: 100%;
  279. height: auto;
  280. margin-top: 20rpx;
  281. .title{
  282. font-size: $font-size-24;
  283. color: $text-color;
  284. text-align: left;
  285. line-height: 54rpx;
  286. }
  287. .box-product-main{
  288. width: 100%;
  289. height: 136rpx;
  290. .image{
  291. width: 134rpx;
  292. height: 134rpx;
  293. border: 1px solid #EBEBEB;
  294. float: left;
  295. image{
  296. width: 100%;
  297. height: 100%;
  298. display: block;
  299. }
  300. }
  301. .info{
  302. width: 540rpx;
  303. height: 134rpx;
  304. float: left;
  305. margin-left: 16rpx;
  306. position: relative;
  307. .name{
  308. width: 100%;
  309. float: left;
  310. line-height: 40rpx;
  311. font-size: $font-size-28;
  312. color: $text-color;
  313. -o-text-overflow: ellipsis;
  314. text-overflow: ellipsis;
  315. display: -webkit-box;
  316. word-break: break-all;
  317. -webkit-box-orient: vertical;
  318. -webkit-line-clamp: 2;
  319. overflow: hidden;
  320. }
  321. .num{
  322. width: 100%;
  323. height: 44rpx;
  324. font-size: $font-size-24;
  325. color: $text-color;
  326. text-align: left;
  327. line-height: 44rpx;
  328. position: absolute;
  329. bottom: 0;
  330. left: 0;
  331. }
  332. }
  333. }
  334. }
  335. }
  336. .tui-popup-btn {
  337. width: 100%;
  338. height: auto;
  339. float: left;
  340. margin-top: 24rpx;
  341. .tui-button{
  342. width: 100%;
  343. height: 88rpx;
  344. background: $btn-confirm;
  345. line-height: 88rpx;
  346. text-align: center;
  347. color: #FFFFFF;
  348. font-size: $font-size-28;
  349. border-radius: 14rpx;
  350. }
  351. }
  352. </style>