cm-price.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. <template name="cm-price">
  2. <!-- 商品详情价格判断 -->
  3. <view class="wrap-main">
  4. <!-- 协销 -->
  5. <template>
  6. <view class="wrap-main-item">
  7. <!-- <view class="p-price tui-skeleton-fillet" :class="PromotionsFormat(product.promotions) ? 'none' : ''">
  8. <text class="txt sm">¥</text>
  9. <text class="txt big">{{ (PromotionsFormat(product.promotions) ? product.price1 : product.retailPrice) | NumFormat }}</text>
  10. </view> -->
  11. <view class="p-price tui-skeleton-fillet">
  12. <text class="txt big">¥{{ (PromotionsFormat(product.promotions) ? product.price1 : product.retailPrice) | NumFormat }}</text>
  13. </view>
  14. <!-- 如果用户登录了就显示优惠价格 -->
  15. <!-- <view v-if="product.actStatus==1" class="floor-item-act">
  16. <view v-if="product.promotions.type == 1 && product.promotions.mode == 1" class="floor-tags" @click.stop="clickPopupShow(1)">
  17. {{product.promotions.name}}<text v-if="hasLogin">:¥{{ product.promotions == null ? '0.00' : product.promotions.touchPrice | NumFormat }}</text>
  18. </view>
  19. <view v-else class="floor-tags" @click.stop="clickPopupShow()">{{product.promotions.name}}</view>
  20. </view>
  21. <view v-if="product.actStatus == 0 && product.ladderPriceFlag == 1" class="floor-item-act">
  22. <view class="floor-tags" @click.stop="clickPopupShow()">阶梯价格</view>
  23. </view> -->
  24. </view>
  25. </template>
  26. <!--促销活动弹窗提示-->
  27. <tui-bottom-popup :radius="true" :show="popupShow" @close="hidePopup()">
  28. <view class="tui-popup-box clearfix">
  29. <template v-if="product.actStatus == 0 && product.ladderPriceFlag == 1">
  30. <view class="tui-scrollview-box">
  31. <view class="ladder-main clearfix">
  32. <view class="ladder-item">
  33. <view class="ladder-item-td">起订量</view>
  34. <view class="ladder-item-td">价格</view>
  35. </view>
  36. <view class="ladder-item" v-for="(ladd, index) in product.ladderPriceList" :key="index">
  37. <view class="ladder-item-td">{{ ladd.buyNumRangeShow }}</view>
  38. <view class="ladder-item-td">{{ ladd.buyPrice | NumFormat }}</view>
  39. </view>
  40. </view>
  41. </view>
  42. </template>
  43. <template v-else>
  44. <view class="tui-scrollview-box">
  45. <view class="box-text">
  46. <text>促销时间:</text>
  47. <text class="txt" v-if="product.promotions.status == 1">不限时</text>
  48. <text class="txt" v-else>{{ product.promotions.beginTime }} ~ {{ product.promotions.endTime }}</text>
  49. </view>
  50. <view class="box-title" v-show="product.promotions.mode ==2">
  51. <text>购买{{ product.promotions.name }}商品,满</text>
  52. <text class="txt">¥{{ product.promotions == null ? '0.00' : product.promotions.touchPrice | NumFormat }}</text>减
  53. <text class="txt">¥{{ product.promotions == null ? '0.00' : product.promotions.reducedPrice | NumFormat }}</text>
  54. </view>
  55. <view class="box-title" v-show="product.promotions.mode==3">
  56. <text>购买{{ product.promotions.name }}商品,满</text>
  57. <text class="txt">¥{{ product.promotions == null ? '0.00' : product.promotions.touchPrice | NumFormat }}</text>赠送商品
  58. </view>
  59. <view class="box-product" v-show="product.promotions.mode==3">
  60. <view class="box-product-main" v-for="(item, index) in product.promotions.giftList" :key="index">
  61. <view class="image"><image :src="item.image" mode="widthFix"></image></view>
  62. <view class="info">
  63. <view class="name">{{ item.name }}</view>
  64. <view class="num">X{{ item.number }}</view>
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. </template>
  70. <view class="tui-right-flex tui-popup-btn" :style="{ paddingBottom :isIphoneX ? '68rpx' : '0rpx' }">
  71. <view class="tui-flex-1">
  72. <view class="tui-button" v-if="product.promotions.type == 2" @click="goGoodActiveFn(product.promotions.id)">更多凑单商品</view>
  73. <view class="tui-button" v-else @click="hidePopup()">了解</view>
  74. </view>
  75. </view>
  76. </view>
  77. </tui-bottom-popup>
  78. <!-- </template> -->
  79. </view>
  80. </template>
  81. <script>
  82. import { mapState,mapMutations } from 'vuex'
  83. import uniGrader from '@/components/uni-grade/uni-grade.vue'
  84. export default{
  85. name:'cm-price',
  86. components:{
  87. uniGrader
  88. },
  89. props:{
  90. product:{
  91. type:Object,
  92. },
  93. userIdentity: {
  94. type: Number,
  95. default: 2
  96. },
  97. shopID: {
  98. type: Number,
  99. default: 2
  100. },
  101. ladderPriceList:{
  102. type: Array,
  103. },
  104. promotions:{
  105. type:Object,
  106. }
  107. },
  108. data() {
  109. return{
  110. popupShow:false,
  111. promotionsType:0,
  112. isIphoneX:this.$store.state.isIphoneX,
  113. }
  114. },
  115. filters: {
  116. NumFormat:function(text) {//处理金额
  117. return Number(text).toFixed(2);
  118. },
  119. },
  120. created() {
  121. },
  122. computed: {
  123. ...mapState(['hasLogin','isWxAuthorize'])
  124. },
  125. methods:{
  126. clickPopupShow(type){
  127. this.popupShow = true
  128. this.promotionsType = type
  129. },
  130. hidePopup(){
  131. this.popupShow = false
  132. },
  133. PromotionsFormat(promo){//促销活动类型数据处理
  134. if(promo!=null){
  135. if(promo.type == 1 && promo.mode == 1){
  136. return true
  137. }else{
  138. return false
  139. }
  140. }
  141. return false
  142. },
  143. goUpgradeApply(){
  144. this.$api.navigateTo('/pages/login/apply')
  145. },
  146. loginClick(){
  147. this.$api.navigateTo('/pages/login/login')
  148. },
  149. goGoodActiveFn(id){
  150. this.$parent.popupShow = false
  151. this.$api.navigateTo('/pages/goods/goods-active?id='+id)
  152. }
  153. },
  154. }
  155. </script>
  156. <style lang="scss">
  157. .tui-flex-1 {
  158. flex: 1;
  159. }
  160. .tui-popup-box {
  161. position: relative;
  162. box-sizing: border-box;
  163. min-height: 220rpx;
  164. padding:24rpx 24rpx 0 24rpx;
  165. }
  166. .tui-scrollview-box{
  167. width: 100%;
  168. height: auto;
  169. float: left;
  170. box-sizing: border-box;
  171. .ladder-main{
  172. width: 100%;
  173. min-height: 240rpx;
  174. border: 1px solid rgba(225,86,22,0.3);
  175. border-radius: 10rpx;
  176. .ladder-item{
  177. width: 100%;
  178. height: 80rpx;
  179. float: left;
  180. border-bottom: 1px solid rgba(225,86,22,0.3);
  181. &:nth-child(1){
  182. .ladder-item-td{
  183. color: #333333;
  184. }
  185. }
  186. &:last-child{
  187. border-bottom: none;
  188. }
  189. .ladder-item-td{
  190. width:50%;
  191. text-align: center;
  192. line-height: 80rpx;
  193. font-size: $font-size-24;
  194. color: $color-system;
  195. box-sizing: border-box;
  196. float: left;
  197. &:nth-child(1){
  198. border-right: 1px solid rgba(225,86,22,0.3);
  199. }
  200. }
  201. }
  202. }
  203. .box-title{
  204. font-size: $font-size-26;
  205. color: $text-color;
  206. text-align: left;
  207. line-height: 56rpx;
  208. .txt{
  209. color: $color-system;
  210. margin: 0 8rpx;
  211. }
  212. }
  213. .box-text{
  214. font-size: $font-size-26;
  215. color: $text-color;
  216. text-align: left;
  217. line-height: 56rpx;
  218. .txt{
  219. color: $color-system;
  220. }
  221. }
  222. .box-product{
  223. width: 100%;
  224. height: auto;
  225. margin-top: 20rpx;
  226. .title{
  227. font-size: $font-size-24;
  228. color: $text-color;
  229. text-align: left;
  230. line-height: 54rpx;
  231. }
  232. .box-product-main{
  233. width: 100%;
  234. height: 136rpx;
  235. float: left;
  236. margin: 10rpx 0;
  237. .image{
  238. width: 134rpx;
  239. height: 134rpx;
  240. border: 1px solid #EBEBEB;
  241. float: left;
  242. image{
  243. width: 100%;
  244. height: 100%;
  245. display: block;
  246. }
  247. }
  248. .info{
  249. width: 540rpx;
  250. height: 134rpx;
  251. float: left;
  252. margin-left: 16rpx;
  253. position: relative;
  254. .name{
  255. width: 100%;
  256. float: left;
  257. line-height: 40rpx;
  258. font-size: $font-size-28;
  259. color: $text-color;
  260. -o-text-overflow: ellipsis;
  261. text-overflow: ellipsis;
  262. display: -webkit-box;
  263. word-break: break-all;
  264. -webkit-box-orient: vertical;
  265. -webkit-line-clamp: 2;
  266. overflow: hidden;
  267. }
  268. .num{
  269. width: 100%;
  270. height: 44rpx;
  271. font-size: $font-size-24;
  272. color: $text-color;
  273. text-align: left;
  274. line-height: 44rpx;
  275. position: absolute;
  276. bottom: 0;
  277. left: 0;
  278. }
  279. }
  280. }
  281. }
  282. }
  283. .tui-popup-btn {
  284. width: 100%;
  285. height: auto;
  286. float: left;
  287. margin-top: 24rpx;
  288. .tui-button{
  289. width: 100%;
  290. height: 88rpx;
  291. background: $btn-confirm;
  292. line-height: 88rpx;
  293. text-align: center;
  294. color: #FFFFFF;
  295. font-size: $font-size-28;
  296. border-radius: 44rpx;
  297. }
  298. }
  299. </style>