coupon-product.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. <template>
  2. <view class="container floor clearfix">
  3. <tui-skeleton v-if="skeletonShow" backgroundColor="#fafafa" borderRadius="10rpx" :isLoading ="true" :loadingType="5"></tui-skeleton>
  4. <!-- 楼层 -->
  5. <view class="container-section tui-skeleton">
  6. <view class="floor-item-banner ad_01">
  7. <image class="item-img-gg" :src="appletsBanner"></image>
  8. </view>
  9. <view class="section_page_main clearfix">
  10. <view class="floor-item clearfix" v-for="(pros, idx) in productList" :key="idx" @click.stop="navToDetailPage(pros.productId)">
  11. <image class="item-img tui-skeleton-fillet" :src="pros.image" mode="aspectFill"></image>
  12. <view class="floor-item-content">
  13. <view class="title tui-skeleton-rect">
  14. <text class="mclap-tag" v-if="pros.beautyActFlag == '1'">美博会</text>
  15. <text class="mclap" :class="pros.beautyActFlag == '1' ? 'indent' : ''">{{pros.name}} </text>
  16. </view>
  17. <view class="floor-item-price">
  18. <view class="floor-item-act">
  19. <view class="coupon-tags">优惠券</view>
  20. <template v-if="pros.actStatus===1">
  21. <view class="floor-tags" v-if="PromotionsFormat(pros.promotions)">
  22. {{pros.promotions.name}}
  23. <text v-if="pros.priceFlag != 1">:¥{{pros.price | NumFormat}}</text>
  24. </view>
  25. <view class="floor-tags" v-else>{{pros.promotions.name}}</view>
  26. </template>
  27. <template v-if="pros.actStatus ===0 && pros.ladderPriceFlag===1">
  28. <view class="floor-tags">阶梯价格</view>
  29. </template>
  30. </view>
  31. <view>
  32. <template v-if="userIdentity ===4">
  33. <view class="title-none" v-if="pros.priceFlag === 1">
  34. <text class="p big">¥未公开价格</text>
  35. </view>
  36. <view class="title-none" v-if="pros.priceFlag === 2">
  37. <text class="p big">¥价格仅会员可见</text>
  38. </view>
  39. <view class="price tui-skeleton-rect" v-if="pros.priceFlag === 0"
  40. :class="PromotionsFormat(pros.promotions) ? 'none' : ''">
  41. <text class="p sm">¥</text>
  42. <text class="p big">
  43. {{ (PromotionsFormat(pros.promotions) ? pros.originalPrice : pros.price ) | NumFormat}}
  44. </text>
  45. </view>
  46. </template>
  47. <template v-else>
  48. <view class="title-none" v-if="pros.priceFlag === 1">
  49. <text class="p big">¥未公开价格</text>
  50. </view>
  51. <view class="price tui-skeleton-rect" v-else :class="PromotionsFormat(pros.promotions) ? 'none' : ''">
  52. <text class="p sm">¥</text>
  53. <text class="p big">
  54. {{ (PromotionsFormat(pros.promotions) ? pros.originalPrice : pros.price ) | NumFormat}}
  55. </text>
  56. </view>
  57. </template>
  58. </view>
  59. </view>
  60. </view>
  61. </view>
  62. </view>
  63. <!--加载loadding-->
  64. <tui-loadmore :visible="loadding" :index="3" type="black"></tui-loadmore>
  65. <tui-nomore :visible="!pullUpOn" :backgroundColor="'#F7F7F7'" :text='nomoreText'></tui-nomore>
  66. <!--加载loadding-->
  67. </view>
  68. </view>
  69. </template>
  70. <script>
  71. import { mapState,mapMutations} from 'vuex';
  72. export default{
  73. data(){
  74. return{
  75. userIdentity:0,
  76. productList:[],
  77. appletsBanner:'',
  78. listQuery:{
  79. userId:0,
  80. couponId: 0,
  81. pageSize: 10,
  82. pageNum: 1,
  83. source: 2
  84. },
  85. NavigationBarTitle:'',
  86. nomoreText: '上拉显示更多',
  87. hasNextPage:false,
  88. loadding: false,
  89. pullUpOn: true,
  90. pullFlag: true
  91. }
  92. },
  93. onLoad(option) {
  94. this.listQuery.couponId = option.couponId
  95. this.$api.getComStorage('userInfo').then((resolve) =>{
  96. this.listQuery.userId = resolve.userId ? resolve.userId : 0;
  97. this.userIdentity = resolve.userIdentity
  98. this.QueryCouponActivityList()
  99. })
  100. },
  101. filters: {
  102. NumFormat:function(text) {//处理金额
  103. return Number(text).toFixed(2);
  104. },
  105. },
  106. computed: {
  107. ...mapState(['hasLogin','userInfo','identity'])
  108. },
  109. methods:{
  110. QueryCouponActivityList(){//楼层查看更多
  111. this.ProductService.QueryCouponActivityList(this.listQuery).then(response =>{
  112. let data = response.data
  113. uni.setNavigationBarTitle({title:data.coupon.name});
  114. this.appletsBanner = data.coupon.appletsBanner
  115. this.productList = data.pageInfo.list
  116. this.hasNextPage = data.pageInfo.hasNextPage
  117. this.skeletonShow = false
  118. if(this.hasNextPage){
  119. this.pullUpOn = false
  120. this.nomoreText = '上拉显示更多'
  121. }else{
  122. this.pullUpOn = false
  123. this.loadding = false
  124. this.nomoreText = '已至底部'
  125. }
  126. }).catch(error =>{
  127. this.$util.msg(error.msg,2000)
  128. })
  129. },
  130. OnReachBottomData(){// 上滑加载
  131. this.listQuery.pageNum+=1
  132. this.ProductService.QueryCouponActivityList(this.listQuery).then(response =>{
  133. let data = response.data
  134. uni.setNavigationBarTitle({title:data.coupon.name});
  135. this.hasNextPage = data.pageInfo.hasNextPage
  136. this.productList = this.productList.concat(data.pageInfo.list)
  137. this.skeletonShow = false
  138. if(this.hasNextPage){
  139. this.pullUpOn = false
  140. this.nomoreText = '上拉显示更多'
  141. }else{
  142. this.pullUpOn = false
  143. this.loadding = false
  144. this.nomoreText = '已至底部'
  145. }
  146. }).catch(error =>{
  147. this.$util.msg(error.msg,2000)
  148. })
  149. },
  150. PromotionsFormat(promo){//促销活动类型数据处理
  151. if(promo!=null){
  152. if(promo.type == 1 && promo.mode == 1){
  153. return true
  154. }else{
  155. return false
  156. }
  157. }
  158. return false
  159. },
  160. navToDetailPage(productId) {//跳转商品详情页
  161. this.$api.navigateTo(`/pages/goods/product?id=${productId}`)
  162. }
  163. },
  164. onPullDownRefresh() {
  165. setTimeout(() => {
  166. this.productList = []
  167. this.listQuery.pageNum = 1
  168. this.QueryCouponActivityList()
  169. uni.stopPullDownRefresh()
  170. }, 200)
  171. },
  172. onReachBottom() {
  173. if(this.hasNextPage){
  174. this.loadding = true
  175. this.pullUpOn = true
  176. this.OnReachBottomData()
  177. }
  178. },
  179. onShow() {
  180. }
  181. }
  182. </script>
  183. <style lang="scss">
  184. page{
  185. background-color: #F7F7F7;
  186. }
  187. .container-home{
  188. width: 100%;
  189. height: auto;
  190. }
  191. .container-section{
  192. width: 100%;
  193. height: auto;
  194. background-color: #F7F7F7;
  195. box-sizing: border-box;
  196. padding:24rpx;
  197. }
  198. .floor-item-banner{
  199. width: 100%;
  200. height: 240rpx;
  201. margin-bottom: 20rpx;
  202. .item-img-gg{
  203. width: 100%;
  204. height: 240rpx;
  205. display: block;
  206. border-radius: 16rpx;
  207. }
  208. }
  209. .section_page_main{
  210. width: 100%;
  211. height: auto;
  212. box-sizing: border-box;
  213. .floor-item{
  214. width: 339rpx;
  215. height: 516rpx;
  216. margin-right: 20rpx;
  217. font-size: $font-size-24;
  218. color: $text-color;
  219. background: #FFFFFF;
  220. line-height: 36rpx;
  221. border-radius: 16rpx;
  222. margin-bottom: 20rpx;
  223. float: left;
  224. box-sizing: border-box;
  225. position: relative;
  226. &:nth-child(2n){
  227. margin-right: 0;
  228. }
  229. .item-img{
  230. width: 339rpx;
  231. height: 339rpx;
  232. border-radius: 16rpx 16rpx 0 0;
  233. display: block;
  234. margin-bottom: 8rpx;
  235. }
  236. .floor-item-content{
  237. width: 100%;
  238. padding: 0 20rpx;
  239. box-sizing: border-box;
  240. }
  241. .floor-item-act{
  242. display: block;
  243. width: 100%;
  244. height: 32rpx;
  245. text-align: center;
  246. box-sizing: border-box;
  247. }
  248. .title-none{
  249. font-size: $font-size-26;
  250. color: #FF2A2A;
  251. line-height: 54rpx;
  252. }
  253. .title{
  254. width: 100%;
  255. height: 70rpx;
  256. display: flex;
  257. line-height: 35rpx;
  258. flex-direction: column;
  259. margin: 8rpx 0;
  260. padding: 0;
  261. position: relative;
  262. .mclap{
  263. width: 100%;
  264. line-height:35rpx;
  265. text-overflow:ellipsis;
  266. display: -webkit-box;
  267. word-break: break-all;
  268. -webkit-box-orient: vertical;
  269. -webkit-line-clamp: 2;
  270. overflow: hidden;
  271. font-size: 26rpx;
  272. &.indent{
  273. text-indent: 95rpx;
  274. }
  275. }
  276. .mclap-tag{
  277. display: block;
  278. width: 84rpx;
  279. height: 32rpx;
  280. background-image: linear-gradient(270deg, #f9c023 0%, #f83600 100%);
  281. border-radius: 4rpx 48rpx 4px 4px;
  282. line-height: 32rpx;
  283. font-size: $font-size-22;
  284. color: #FFFFFF;
  285. text-align: center;
  286. position: absolute;
  287. left: 0;
  288. top: 0;
  289. }
  290. }
  291. .price{
  292. color: #FF2A2A;
  293. line-height:54rpx;
  294. &.none{
  295. text-decoration: line-through;
  296. color: #999999;
  297. }
  298. .sm{
  299. font-size: $font-size-24;
  300. }
  301. .big{
  302. font-size: $font-size-28;
  303. }
  304. }
  305. }
  306. }
  307. </style>