coupon-product.vue 9.4 KB

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