coupon.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  1. <template>
  2. <view ref="container">
  3. <view class="tui-coupon-list">
  4. <view class="tui-coupon-item tui-top20" v-for="(item, index) in couponsList" :key="index">
  5. <image src="https://zkzh-2025.oss-cn-beijing.aliyuncs.com/shop/images/bg_coupon_3x.png" class="tui-coupon-bg" mode="widthFix"></image>
  6. <view class="tui-coupon-item-left">
  7. <view class="tui-coupon-price-box" :class="{ 'tui-color-grey': item.receiveCount>0 }">
  8. <view class="tui-coupon-price-sign">¥</view>
  9. <view class="tui-coupon-price" :class="{ 'tui-price-small': false }">{{ item.couponPrice }}</view>
  10. </view>
  11. <view class="tui-coupon-intro">满{{ item.useMinPrice }}元可用</view>
  12. </view>
  13. <view class="tui-coupon-item-right">
  14. <view class="tui-coupon-content">
  15. <view class="tui-coupon-title-box">
  16. <view class="tui-coupon-title">{{ item.couponName }}</view>
  17. </view>
  18. <view class="tui-coupon-rule">
  19. <view class="tui-rule-box tui-padding-btm">
  20. <view class="tui-coupon-circle"></view>
  21. <view class="tui-coupon-text">不可叠加使用</view>
  22. </view>
  23. <view class="tui-rule-box">
  24. <view class="tui-coupon-circle"></view>
  25. <view class="tui-coupon-text">{{ item.limitTime }} 到期</view>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. <view class="tui-btn-box">
  31. <view class="btn receive" @click="show(item)">查看</view>
  32. </view>
  33. </view>
  34. </view>
  35. <Loading :loaded="loadend" :loading="loading"></Loading>
  36. <!--暂无优惠券-->
  37. <view v-if="couponsList.length == 0 && page > 1" class="no-data-box" >
  38. <image src="https://zkzh-2025.oss-cn-beijing.aliyuncs.com/shop/images/no_data.png" mode="aspectFit"></image>
  39. <view class="empty-title">暂无数据</view>
  40. </view>
  41. </view>
  42. </template>
  43. <script>
  44. import { getCompanyCouponIssueList, receive } from '@/api/coupon'
  45. import Loading from '@/components/Loading'
  46. export default {
  47. name: 'getCoupon',
  48. components: {
  49. Loading,
  50. },
  51. props: {},
  52. data: function() {
  53. return {
  54. limit: 10,
  55. couponsList: [],
  56. loading: false,
  57. loadend: false,
  58. page: 1,
  59. limit: 10,
  60. }
  61. },
  62. onLoad(options) {
  63. },
  64. mounted: function() {
  65. },
  66. onShow() {
  67. this.getCompanyCouponIssueList()
  68. },
  69. onReachBottom() {
  70. !this.loading && this.getCompanyCouponIssueList()
  71. },
  72. methods: {
  73. show(item){
  74. uni.navigateTo({
  75. url: '../couponDetails?id=' +item.id
  76. })
  77. },
  78. getCompanyCouponIssueList() {
  79. if (this.loading) return //阻止下次请求(false可以进行请求);
  80. if (this.loadend) return //阻止结束当前请求(false可以进行请求);
  81. this.loading = true
  82. let q = { page: this.page, pageSize: this.limit,couponType:2 }
  83. getCompanyCouponIssueList(q).then(res => {
  84. this.loading = false
  85. this.couponsList.push.apply(this.couponsList, res.data.list)
  86. this.loadend = res.data.list.length < this.limit //判断所有数据是否加载完成;
  87. this.page = this.page + 1
  88. })
  89. },
  90. },
  91. }
  92. </script>
  93. <style lang="less" scoped>
  94. page {
  95. background-color: #f5f5f5;
  96. }
  97. .container {
  98. padding-bottom: env(safe-area-inset-bottom);
  99. }
  100. .top-fixed{
  101. width: 100%;
  102. position: fixed;
  103. top: 0;
  104. left: 0;
  105. z-index: 99999;
  106. .cate-list{
  107. box-sizing: border-box;
  108. background: #fff;
  109. padding: 10upx 27upx;
  110. height: 100upx;
  111. .inner{
  112. display: flex;
  113. }
  114. .item{
  115. flex-shrink: 0;
  116. padding: 0 24upx;
  117. height: 64upx;
  118. line-height: 64upx;
  119. font-size: 28upx;
  120. font-family: PingFang SC;
  121. font-weight: 500;
  122. color: #2BC7B9;
  123. background: #F5FFFE;
  124. border: 1px solid #8AD5CE;
  125. border-radius: 32upx;
  126. margin: 0 20upx 20upx 0;
  127. &.active{
  128. color: #FFFFFF;
  129. background: #2BC7B9;
  130. border: 1px solid #2BC7B9;
  131. }
  132. }
  133. }
  134. }
  135. .tui-coupon-list {
  136. width: 100%;
  137. padding: 0 25rpx;
  138. box-sizing: border-box;
  139. }
  140. .tui-coupon-banner {
  141. width: 100%;
  142. }
  143. .tui-coupon-item {
  144. width: 100%;
  145. height: 210rpx;
  146. position: relative;
  147. display: flex;
  148. align-items: center;
  149. padding-right: 30rpx;
  150. box-sizing: border-box;
  151. overflow: hidden;
  152. }
  153. .tui-coupon-bg {
  154. width: 100%;
  155. height: 210rpx;
  156. position: absolute;
  157. left: 0;
  158. top: 0;
  159. z-index: 1;
  160. }
  161. .tui-coupon-sign {
  162. height: 110rpx;
  163. width: 110rpx;
  164. position: absolute;
  165. z-index: 9;
  166. top: -30rpx;
  167. right: 40rpx;
  168. }
  169. .tui-coupon-item-left {
  170. width: 218rpx;
  171. height: 210rpx;
  172. position: relative;
  173. z-index: 2;
  174. display: flex;
  175. align-items: center;
  176. justify-content: center;
  177. flex-direction: column;
  178. flex-shrink: 0;
  179. }
  180. .tui-coupon-price-box {
  181. display: flex;
  182. color: #e41f19;
  183. align-items: flex-end;
  184. }
  185. .tui-coupon-price-sign {
  186. font-size: 30rpx;
  187. }
  188. .tui-coupon-price {
  189. font-size: 70rpx;
  190. line-height: 68rpx;
  191. font-weight: bold;
  192. }
  193. .tui-price-small {
  194. font-size: 58rpx !important;
  195. line-height: 56rpx !important;
  196. }
  197. .tui-coupon-intro {
  198. background: #f7f7f7;
  199. padding: 8rpx 10rpx;
  200. font-size: 26rpx;
  201. line-height: 26rpx;
  202. font-weight: 400;
  203. color: #666;
  204. margin-top: 18rpx;
  205. }
  206. .tui-coupon-item-right {
  207. flex: 1;
  208. height: 210rpx;
  209. position: relative;
  210. z-index: 2;
  211. display: flex;
  212. align-items: center;
  213. justify-content: space-between;
  214. padding-left: 24rpx;
  215. box-sizing: border-box;
  216. overflow: hidden;
  217. }
  218. .tui-coupon-content {
  219. width: 82%;
  220. display: flex;
  221. flex-direction: column;
  222. justify-content: center;
  223. }
  224. .tui-coupon-title-box {
  225. display: flex;
  226. align-items: center;
  227. }
  228. .tui-coupon-btn {
  229. padding: 6rpx;
  230. background: #ffebeb;
  231. color: #e41f19;
  232. font-size: 25rpx;
  233. line-height: 25rpx;
  234. display: flex;
  235. align-items: center;
  236. justify-content: center;
  237. transform: scale(0.9);
  238. transform-origin: 0 center;
  239. border-radius: 4rpx;
  240. flex-shrink: 0;
  241. }
  242. .tui-color-grey {
  243. color: #888 !important;
  244. }
  245. .tui-bg-grey {
  246. background: #f0f0f0 !important;
  247. color: #888 !important;
  248. }
  249. .tui-coupon-title {
  250. width: 100%;
  251. font-size: 26rpx;
  252. color: #333;
  253. white-space: nowrap;
  254. overflow: hidden;
  255. text-overflow: ellipsis;
  256. }
  257. .tui-coupon-rule {
  258. padding-top: 52rpx;
  259. }
  260. .tui-rule-box {
  261. display: flex;
  262. align-items: center;
  263. transform: scale(0.8);
  264. transform-origin: 0 100%;
  265. }
  266. .tui-padding-btm {
  267. padding-bottom: 6rpx;
  268. }
  269. .tui-coupon-circle {
  270. width: 8rpx;
  271. height: 8rpx;
  272. background: rgb(160, 160, 160);
  273. border-radius: 50%;
  274. }
  275. .tui-coupon-text {
  276. font-size: 28rpx;
  277. line-height: 28rpx;
  278. font-weight: 400;
  279. color: #666;
  280. padding-left: 8rpx;
  281. white-space: nowrap;
  282. }
  283. .tui-top20 {
  284. margin-top: 20rpx;
  285. }
  286. .tui-coupon-title {
  287. font-size: 28rpx;
  288. line-height: 28rpx;
  289. }
  290. .tui-coupon-radio {
  291. transform: scale(0.7);
  292. transform-origin: 100% center;
  293. }
  294. .tui-btn-box {
  295. position: absolute;
  296. right: 20rpx;
  297. bottom: 40rpx;
  298. z-index: 10;
  299. .btn{
  300. width: 155upx;
  301. height: 64upx;
  302. line-height: 64upx;
  303. font-size: 26upx;
  304. font-family: PingFang SC;
  305. font-weight: 500;
  306. text-align: center;
  307. border-radius: 32upx;
  308. margin-left: 15upx;
  309. &.cancel{
  310. border: 1px solid red;
  311. color: red;
  312. }
  313. &.receive{
  314. background: red;
  315. color: #FFFFFF;
  316. }
  317. }
  318. }
  319. </style>