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