coupon.vue 7.1 KB

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