cm-price.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  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.price | 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.price | 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.price | 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="title">赠送商品:</view>
  126. <view class="box-product-main" v-for="(item, index) in promotions.giftList" :key="index">
  127. <view class="image"><image :src="item.image" mode="widthFix"></image></view>
  128. <view class="info">
  129. <view class="name">{{ item.name }}</view>
  130. <view class="num">X{{ item.number }}</view>
  131. </view>
  132. </view>
  133. </view>
  134. </view>
  135. </template>
  136. <view class="tui-right-flex tui-popup-btn" :style="{ paddingBottom :isIphoneX ? '68rpx' : '0rpx' }">
  137. <view class="tui-flex-1">
  138. <view class="tui-button" v-if="product.promotions.type == 2" @click="hidePopup()">更多凑单商品</view>
  139. <view class="tui-button" v-else @click="hidePopup()">了解</view>
  140. </view>
  141. </view>
  142. </view>
  143. </tui-bottom-popup>
  144. </template>
  145. </view>
  146. </template>
  147. <script>
  148. import { mapState,mapMutations } from 'vuex'
  149. export default{
  150. name:'cm-price',
  151. props:{
  152. product:{
  153. type:Object,
  154. },
  155. userIdentity: {
  156. type: Number,
  157. default: 2
  158. },
  159. ladderPriceList:{
  160. type: Array,
  161. },
  162. promotions:{
  163. type:Object,
  164. }
  165. },
  166. data() {
  167. return{
  168. popupShow:false,
  169. promotionsType:0,
  170. isIphoneX:this.$store.state.isIphoneX,
  171. }
  172. },
  173. filters: {
  174. NumFormat:function(text) {//处理金额
  175. return Number(text).toFixed(2);
  176. },
  177. },
  178. created() {
  179. },
  180. computed: {
  181. ...mapState(['hasLogin','isWxAuthorize'])
  182. },
  183. methods:{
  184. clickPopupShow(type){
  185. this.popupShow = true
  186. this.promotionsType = type
  187. },
  188. hidePopup(){
  189. this.popupShow = false
  190. },
  191. goUpgradeApply(){
  192. this.$api.navigateTo('/pages/login/apply')
  193. },
  194. loginClick(){
  195. this.$api.navigateTo('/pages/login/login')
  196. },
  197. toFixed:function(text) {//处理金额
  198. if(text == null || text === undefined){
  199. return Number(0).toFixed(2);
  200. }else{
  201. return Number(text).toFixed(2);
  202. }
  203. },
  204. },
  205. }
  206. </script>
  207. <style lang="scss">
  208. .tui-flex-1 {
  209. flex: 1;
  210. }
  211. .tui-popup-box {
  212. position: relative;
  213. box-sizing: border-box;
  214. min-height: 220rpx;
  215. padding:24rpx 24rpx 0 24rpx;
  216. }
  217. .tui-scrollview-box{
  218. width: 100%;
  219. height: auto;
  220. float: left;
  221. box-sizing: border-box;
  222. .ladder-main{
  223. width: 100%;
  224. height: 320rpx;
  225. border: 1px solid rgba(225,86,22,0.3);
  226. border-radius: 10rpx;
  227. .ladder-item{
  228. width: 100%;
  229. height: 80rpx;
  230. float: left;
  231. border-bottom: 1px solid rgba(225,86,22,0.3);
  232. &:nth-child(1){
  233. .ladder-item-td{
  234. color: #333333;
  235. }
  236. }
  237. &:last-child{
  238. border-bottom: none;
  239. }
  240. .ladder-item-td{
  241. width:50%;
  242. text-align: center;
  243. line-height: 80rpx;
  244. font-size: $font-size-24;
  245. color: $color-system;
  246. box-sizing: border-box;
  247. float: left;
  248. &:nth-child(1){
  249. border-right: 1px solid rgba(225,86,22,0.3);
  250. }
  251. }
  252. }
  253. }
  254. .box-title{
  255. font-size: $font-size-26;
  256. color: $text-color;
  257. text-align: left;
  258. line-height: 56rpx;
  259. .txt{
  260. color: $color-system;
  261. margin: 0 8rpx;
  262. }
  263. }
  264. .box-text{
  265. font-size: $font-size-26;
  266. color: $text-color;
  267. text-align: left;
  268. line-height: 56rpx;
  269. .txt{
  270. color: $color-system;
  271. }
  272. }
  273. .box-product{
  274. width: 100%;
  275. height: auto;
  276. margin-top: 20rpx;
  277. .title{
  278. font-size: $font-size-24;
  279. color: $text-color;
  280. text-align: left;
  281. line-height: 54rpx;
  282. }
  283. .box-product-main{
  284. width: 100%;
  285. height: 136rpx;
  286. .image{
  287. width: 134rpx;
  288. height: 134rpx;
  289. border: 1px solid #EBEBEB;
  290. float: left;
  291. image{
  292. width: 100%;
  293. height: 100%;
  294. display: block;
  295. }
  296. }
  297. .info{
  298. width: 540rpx;
  299. height: 134rpx;
  300. float: left;
  301. margin-left: 16rpx;
  302. position: relative;
  303. .name{
  304. width: 100%;
  305. float: left;
  306. line-height: 40rpx;
  307. font-size: $font-size-28;
  308. color: $text-color;
  309. -o-text-overflow: ellipsis;
  310. text-overflow: ellipsis;
  311. display: -webkit-box;
  312. word-break: break-all;
  313. -webkit-box-orient: vertical;
  314. -webkit-line-clamp: 2;
  315. overflow: hidden;
  316. }
  317. .num{
  318. width: 100%;
  319. height: 44rpx;
  320. font-size: $font-size-24;
  321. color: $text-color;
  322. text-align: left;
  323. line-height: 44rpx;
  324. position: absolute;
  325. bottom: 0;
  326. left: 0;
  327. }
  328. }
  329. }
  330. }
  331. }
  332. .tui-popup-btn {
  333. width: 100%;
  334. height: auto;
  335. float: left;
  336. margin-top: 24rpx;
  337. .tui-button{
  338. width: 100%;
  339. height: 88rpx;
  340. background: $btn-confirm;
  341. line-height: 88rpx;
  342. text-align: center;
  343. color: #FFFFFF;
  344. font-size: $font-size-28;
  345. border-radius: 14rpx;
  346. }
  347. }
  348. </style>