youhuijuan.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. <template>
  2. <view class="youhuiquan">
  3. <view class="flex justify-between padding-lr bg">
  4. <view v-for="(item,index) in tab" :key="index" class="text-center box"
  5. :class="tabIndex == index?'tanColor':''" @click="bindTab(item.state)">
  6. <view style="z-index: 9;">{{item.name}}</view>
  7. <view class="" :class="tabIndex == index?'line':''"></view>
  8. </view>
  9. </view>
  10. <view class="card-box">
  11. <view class="item" :class="tabIndex == 1 ||tabIndex == 2?'disabled':''" v-for="(item,index) in hongbao" :key="index">
  12. <view class="left">
  13. <view class="money">
  14. <view class="number">
  15. {{item.money}}
  16. </view>
  17. <view class="unit">
  18. 元
  19. </view>
  20. </view>
  21. <view class="limit">
  22. 满{{item.minMoney}}元可用
  23. </view>
  24. </view>
  25. <view class="mid">
  26. <view class="title">
  27. {{item.couponName}}
  28. </view>
  29. <view class="time">
  30. 有效期至:{{item.expirationTime}}
  31. </view>
  32. </view>
  33. <view class="right">
  34. <view class="btn" @tap="shiYong()" v-if="tabIndex == 0">
  35. 立即使用
  36. </view>
  37. <view class="btn" v-else-if="tabIndex == 1">
  38. 已使用
  39. </view>
  40. <view class="btn" v-else-if="tabIndex == 2">
  41. 已失效
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. <!-- <view v-if="tabIndex == 0">
  47. <view v-for="(item,index) in hongbao" :key="index" class="bg padding radius" style="margin: 24upx 32upx;">
  48. <view class="flex justify-between">
  49. <view class="text-lg text-bold">{{item.couponName}}</view>
  50. <view class="text-lg" style="color: #FF130A;">¥<text class="text-df text-xxl">{{item.money}}</text>
  51. </view>
  52. </view>
  53. <view style="color: #999999;">到期时间:{{item.expirationTime}}</view>
  54. <view style="width: 638upx;height: 2upx;border: 2upx dashed #E6E6E6;margin: 29upx auto;"></view>
  55. <view class="flex justify-between">
  56. <view style="color: #999999;">满{{item.minMoney}}元可用</view>
  57. <view class="btn" @tap="shiYong()">立即使用</view>
  58. </view>
  59. </view>
  60. </view>
  61. <view v-if="tabIndex == 1">
  62. <view v-for="(item,index) in hongbao" :key="index" class="bg padding radius " style="margin: 24upx 32upx;position: relative;">
  63. <view class="flex justify-between">
  64. <view class="text-lg text-bold">{{item.couponName}}</view>
  65. <view class="text-lg" style="color: #FF130A;">¥<text class="text-df text-xxl">{{item.money}}</text>
  66. </view>
  67. </view> -->
  68. <!-- <view>到期时间:{{item.expirationTime}}</view> -->
  69. <!-- <view style="width: 638upx;height: 2upx;border: 2upx dashed #E6E6E6;margin: 29upx auto;"></view>
  70. <view class="flex justify-between">
  71. <view style="color: #999999;">满{{item.minMoney}}元可用</view>
  72. </view>
  73. <view style="position: absolute;top: 0;right: 0;">
  74. <image src="../../static/images/my/youhui-user.png" style="width: 120upx;height: 117upx;"></image>
  75. </view>
  76. </view>
  77. </view>
  78. <view v-if="tabIndex == 2">
  79. <view v-for="(item,index) in hongbao" :key="index" class="bg padding radius" style="margin: 24upx 32upx;position: relative;">
  80. <view class="flex justify-between">
  81. <view class="text-lg text-bold">{{item.couponName}}</view>
  82. <view class="text-lg" style="color: #FF130A;">¥<text class="text-df text-xxl">{{item.money}}</text>
  83. </view>
  84. </view>
  85. <view style="color: #999999;">到期时间:{{item.expirationTime}}</view>
  86. <view style="width: 638upx;height: 2upx;border: 2upx dashed #E6E6E6;margin: 29upx auto;"></view>
  87. <view class="flex justify-between">
  88. <view style="color: #999999;">满{{item.minMoney}}元可用</view>
  89. </view>
  90. <view style="position: absolute;top: 0;right: 0;">
  91. <image src="../../static/images/my/shixioa.png" style="width: 120upx;height: 117upx;"></image>
  92. </view>
  93. </view>
  94. </view> -->
  95. <empty v-if="hongbao.length==0"></empty>
  96. </view>
  97. </template>
  98. <script>
  99. import empty from '@/components/empty.vue'
  100. export default {
  101. components:{
  102. empty
  103. },
  104. data() {
  105. return {
  106. tab: [{
  107. name: '可使用',
  108. state: 0
  109. }, {
  110. name: '已使用',
  111. state: 1
  112. }, {
  113. name: '已失效',
  114. state: 2
  115. }],
  116. tabIndex: 0,
  117. hongbao: [],
  118. page: 1,
  119. size: 10,
  120. loadingType: 0,
  121. scrollTop: false,
  122. contentText: {
  123. contentdown: '上拉显示更多',
  124. contentrefresh: '正在加载...',
  125. contentnomore: '没有更多数据了'
  126. }
  127. }
  128. },
  129. onLoad() {
  130. this.getMyList();
  131. },
  132. methods: {
  133. shiYong(){
  134. uni.switchTab({
  135. url:'/pages/index/index'
  136. })
  137. },
  138. getMyList() {
  139. this.loadingType = 1;
  140. uni.showLoading({
  141. title: '加载中...'
  142. });
  143. this.$Request.getT('/app/coupon/selectCouponUserList?page='+this.page+'&limit='+this.size+'&status=' + this.tabIndex).then(res => {
  144. if (res.code == 0) {
  145. if (this.page == 1) {
  146. this.hongbao = [];
  147. }
  148. res.data.list.forEach(d => {
  149. this.hongbao.push(d);
  150. });
  151. if (res.data.list.length === this.size) {
  152. this.loadingType = 0;
  153. } else {
  154. this.loadingType = 3;
  155. }
  156. } else {
  157. this.loadingType = 2;
  158. }
  159. uni.hideLoading();
  160. });
  161. },
  162. bindTab(index) {
  163. this.tabIndex = index
  164. this.hongbao = [];
  165. this.page = 1;
  166. this.getMyList();
  167. }
  168. },
  169. onPageScroll: function(e) {
  170. this.scrollTop = e.scrollTop > 200;
  171. },
  172. onReachBottom: function() {
  173. this.page = this.page + 1;
  174. this.getMyList('');
  175. },
  176. onPullDownRefresh: function() {
  177. this.page = 1;
  178. this.getMyList('Refresh');
  179. }
  180. }
  181. </script>
  182. <style lang="scss" scoped>
  183. .youhuiquan{
  184. .card-box{
  185. padding: 20rpx 32rpx;
  186. background: #F6F6F6;
  187. .item.disabled{
  188. filter: grayscale(1);
  189. }
  190. .item{
  191. display: flex;
  192. background-image: url('../../static/card-bg.png');
  193. background-repeat: no-repeat;
  194. background-size: 100% 196rpx;
  195. .left{
  196. width: 200rpx;
  197. display: flex;
  198. flex-direction: column;
  199. align-items: center;
  200. .money{
  201. display: flex;
  202. align-items: first baseline;
  203. color: #FF6E98;
  204. font-weight: bold;
  205. margin-top: 30rpx;
  206. .number{
  207. font-size: 60rpx;
  208. }
  209. .unit{
  210. font-size: 28rpx;
  211. }
  212. }
  213. .limit{
  214. font-size: 24rpx;
  215. color: #FF6E98;
  216. margin-top: 12rpx;
  217. }
  218. }
  219. .mid{
  220. flex: 1;
  221. padding-left: 30rpx;
  222. .title{
  223. font-weight: 800;
  224. font-size: 32rpx;
  225. color: #222222;
  226. margin-top: 48rpx;
  227. }
  228. .time{
  229. font-size: 24rpx;
  230. color: #AAAAAA;
  231. margin-top: 24rpx;
  232. }
  233. }
  234. .right{
  235. display: flex;
  236. justify-content: center;
  237. align-items: center;
  238. width: 184rpx;
  239. height: 196rpx;
  240. .btn{
  241. width: 136rpx;
  242. height: 44rpx;
  243. line-height: 44rpx;
  244. text-align: center;
  245. background: linear-gradient( 313deg, #FFE6EE 0%, #FFBACA 100%);
  246. border-radius: 36rpx 36rpx 36rpx 36rpx;
  247. font-size: 24rpx;
  248. color: #FF6E98;
  249. border: none;
  250. }
  251. }
  252. }
  253. }
  254. }
  255. page {
  256. background: #F5F5F5;
  257. }
  258. .bg {
  259. background: #FFFFFF;
  260. }
  261. .box {
  262. width: 128upx;
  263. color: #999999;
  264. text-align: center;
  265. font-size: 30upx;
  266. z-index: 1;
  267. }
  268. .line {
  269. width: 128upx;
  270. height: 16upx;
  271. background: #52C375;
  272. position: relative;
  273. top: -18upx;
  274. /* opacity: 0.8; */
  275. z-index: -1;
  276. }
  277. .tanColor {
  278. color: #000000;
  279. font-size: 38upx;
  280. font-weight: 800;
  281. }
  282. .btn {
  283. width: 140upx;
  284. height: 55upx;
  285. border: 2upx solid #FF130A;
  286. border-radius: 30upx;
  287. text-align: center;
  288. line-height: 55upx;
  289. color: #FF130A;
  290. font-size: 24upx;
  291. }
  292. </style>