cm-price.vue 11 KB

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