coupon-product.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  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)">
  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. },
  161. onPullDownRefresh() {
  162. setTimeout(() => {
  163. this.productList = []
  164. this.listQuery.pageNum = 1
  165. this.QueryCouponActivityList()
  166. uni.stopPullDownRefresh()
  167. }, 200)
  168. },
  169. onReachBottom() {
  170. if(this.hasNextPage){
  171. this.loadding = true
  172. this.pullUpOn = true
  173. this.OnReachBottomData()
  174. }
  175. },
  176. onShow() {
  177. }
  178. }
  179. </script>
  180. <style lang="scss">
  181. page{
  182. background-color: #F7F7F7;
  183. }
  184. .container-home{
  185. width: 100%;
  186. height: auto;
  187. }
  188. .container-section{
  189. width: 100%;
  190. height: auto;
  191. background-color: #F7F7F7;
  192. box-sizing: border-box;
  193. padding:24rpx;
  194. }
  195. .floor-item-banner{
  196. width: 100%;
  197. height: 240rpx;
  198. margin-bottom: 20rpx;
  199. .item-img-gg{
  200. width: 100%;
  201. height: 240rpx;
  202. display: block;
  203. border-radius: 16rpx;
  204. }
  205. }
  206. .section_page_main{
  207. width: 100%;
  208. height: auto;
  209. box-sizing: border-box;
  210. .floor-item{
  211. width: 339rpx;
  212. height: 516rpx;
  213. margin-right: 20rpx;
  214. font-size: $font-size-24;
  215. color: $text-color;
  216. background: #FFFFFF;
  217. line-height: 36rpx;
  218. border-radius: 16rpx;
  219. margin-bottom: 20rpx;
  220. float: left;
  221. box-sizing: border-box;
  222. position: relative;
  223. &:nth-child(2n){
  224. margin-right: 0;
  225. }
  226. .item-img{
  227. width: 339rpx;
  228. height: 339rpx;
  229. border-radius: 16rpx 16rpx 0 0;
  230. display: block;
  231. margin-bottom: 8rpx;
  232. }
  233. .floor-item-content{
  234. width: 100%;
  235. padding: 0 20rpx;
  236. box-sizing: border-box;
  237. }
  238. .floor-item-act{
  239. display: block;
  240. width: 100%;
  241. height: 32rpx;
  242. text-align: center;
  243. box-sizing: border-box;
  244. .coupon-tags{
  245. height: 32rpx;
  246. box-sizing: border-box;
  247. border-radius: 8rpx;
  248. background-color: #fff1eb;
  249. line-height: 28rpx;
  250. color: #f94b4b;
  251. text-align: center;
  252. display: inline-block;
  253. padding:0 10rpx;
  254. font-size: $font-size-20;
  255. border: 1px solid #f94b4b;
  256. float: left;
  257. margin-right: 12rpx;
  258. }
  259. .floor-tags{
  260. height: 32rpx;
  261. box-sizing: border-box;
  262. border-radius: 8rpx;
  263. background-color: #FFFFFF;
  264. line-height: 28rpx;
  265. color: $color-system;
  266. text-align: center;
  267. display: inline-block;
  268. padding:0 16rpx;
  269. font-size: $font-size-20;
  270. border: 1px solid #E15616;
  271. float: left;
  272. }
  273. }
  274. .title-none{
  275. font-size: $font-size-26;
  276. color: #FF2A2A;
  277. line-height: 54rpx;
  278. }
  279. .title{
  280. width: 100%;
  281. height: 70rpx;
  282. display: flex;
  283. line-height: 35rpx;
  284. flex-direction: column;
  285. margin: 8rpx 0;
  286. padding: 0;
  287. position: relative;
  288. .mclap{
  289. width: 100%;
  290. line-height:35rpx;
  291. text-overflow:ellipsis;
  292. display: -webkit-box;
  293. word-break: break-all;
  294. -webkit-box-orient: vertical;
  295. -webkit-line-clamp: 2;
  296. overflow: hidden;
  297. font-size: 26rpx;
  298. &.indent{
  299. text-indent: 95rpx;
  300. }
  301. }
  302. .mclap-tag{
  303. display: block;
  304. width: 84rpx;
  305. height: 32rpx;
  306. background-image: linear-gradient(270deg, #f9c023 0%, #f83600 100%);
  307. border-radius: 4rpx 48rpx 4px 4px;
  308. line-height: 32rpx;
  309. font-size: $font-size-22;
  310. color: #FFFFFF;
  311. text-align: center;
  312. position: absolute;
  313. left: 0;
  314. top: 0;
  315. }
  316. }
  317. .price{
  318. color: #FF2A2A;
  319. line-height:54rpx;
  320. &.none{
  321. text-decoration: line-through;
  322. color: #999999;
  323. }
  324. .sm{
  325. font-size: $font-size-24;
  326. }
  327. .big{
  328. font-size: $font-size-28;
  329. }
  330. }
  331. }
  332. }
  333. </style>