index.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. <template>
  2. <view>
  3. <view class="flex align-center justify-between bg padding">
  4. <view v-for="(item,index) in list" :key="index" :class="tabIndex==item.id?'active':'act'"
  5. @click="change(item.id)">
  6. {{item.name}}
  7. <view class="ban" v-if="tabIndex==item.id"></view>
  8. </view>
  9. </view>
  10. <view class="empty" v-if="moneylist.length==0">
  11. <view
  12. style="display: block; width: 90%; margin: 0 auto; position: fixed;top: 35%;left: 0rpx;right: 0rpx;text-align: center;">
  13. <image v-if="globalImages" :src="globalImages + 'images/static/image/emety.png'" style="width: 300rpx;height: 300rpx;"></image>
  14. <view style="color: #CCCCCC;">暂无内容</view>
  15. </view>
  16. </view>
  17. <view class="popup_money" v-else>
  18. <view class="data_select">
  19. <view class="money_box" v-for="(item,index) in moneylist" :key="index">
  20. <view class="box_tit">
  21. <view style="width: 170rpx; height: 170rpx; border-radius: 15rpx; background: linear-gradient(to bottom right, #ff5900, #fd1818);margin-right: 30rpx;">
  22. <view class="money_price"><text>¥</text>{{item.money}}</view>
  23. <view style="color: #fff; font-size: 24rpx; text-align: center;">满¥{{item.minMoney}}可用</view>
  24. </view>
  25. <view style="padding: 40rpx 0;">
  26. <!-- 优惠券类型 0全部可用 1即时代驾 2朋友代叫 3预约代驾 -->
  27. <view class="money_name">{{item.couponName}}</view>
  28. <view style="margin-top: 15rpx; color: #999;" v-if="item.couponType==0">通用</view>
  29. <view style="margin-top: 15rpx; color: #999;" v-if="item.couponType==1">即时代驾</view>
  30. <view style="margin-top: 15rpx; color: #999;" v-if="item.couponType==2">朋友代叫</view>
  31. <view style="margin-top: 15rpx; color: #999;" v-if="item.couponType==3">预约代驾</view>
  32. </view>
  33. </view>
  34. <view class="money_line" style="margin-top: 20rpx;">
  35. <u-line direction="row" color="#E6E6E6" border-style="dashed" />
  36. </view>
  37. <view class="box_bottom">
  38. <!-- <view class="money_use">满{{item.minMoney}}元可使用</view> -->
  39. <view class="money_use" v-if="item.expirationTime">有效期至{{item.expirationTime}}</view>
  40. <view class="money_use" v-else>永久有效</view>
  41. <view class="money_btn">
  42. <view class="lj_use" @click="goIndex" v-if="item.status==0">
  43. 立即使用
  44. </view>
  45. <view class="lj_use2" v-if="item.status==1">
  46. 已使用
  47. </view>
  48. <view class="lj_use3" v-if="item.status==2">
  49. 不可使用
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. </template>
  58. <script>
  59. import { waitForGlobalImages } from '@/utils/globalImageLoader'
  60. export default {
  61. data() {
  62. return {
  63. list: [{
  64. id: 3,
  65. name: '全部'
  66. }, {
  67. id: 0,
  68. name: '可使用'
  69. }, {
  70. id: 1,
  71. name: '已使用'
  72. }, {
  73. id: 2,
  74. name: '已失效'
  75. }],
  76. tabIndex: '3',
  77. page: 1,
  78. limit: 10,
  79. moneylist: [],
  80. globalImages: '',
  81. }
  82. },
  83. onLoad() {
  84. this.hongbao()
  85. waitForGlobalImages().then((path) => {
  86. console.log('✅ 全局图片路径:', path)
  87. this.globalImages = path
  88. })
  89. },
  90. methods: {
  91. goIndex(){
  92. uni.switchTab({
  93. url:'/pages/index/index'
  94. })
  95. },
  96. change(index) {
  97. this.tabIndex = index
  98. this.page = 1
  99. this.hongbao()
  100. },
  101. //获取登录用户的所有红包
  102. hongbao() {
  103. let data = {
  104. page: this.page,
  105. limit: this.limit,
  106. status: this.tabIndex
  107. }
  108. this.$Request.getT('/app/couponUser/getMyCouponList', data).then(res => {
  109. console.log(res)
  110. if (res.code === 0) {
  111. if (this.page == 1) {
  112. this.moneylist = res.data.records
  113. }
  114. if (this.page > 1) {
  115. if (res.data.records.length > 0) {
  116. this.moneylist = this.moneylist.concat(res.data.records)
  117. }
  118. }
  119. // console.log(this.hongbao)
  120. this.totalPage = res.data
  121. }
  122. });
  123. }
  124. },
  125. onReachBottom: function() {
  126. if (this.page < this.totalPage) {
  127. this.page = this.page + 1;
  128. this.hongbao();
  129. }
  130. },
  131. onPullDownRefresh: function() {
  132. this.page = 1;
  133. this.hongbao();
  134. },
  135. }
  136. </script>
  137. <style lang="less">
  138. page {
  139. background-color: #F5F5F5;
  140. }
  141. .bg {
  142. background: #FFFFFF;
  143. }
  144. .act {
  145. color: #999999;
  146. font-size: 30upx;
  147. }
  148. .active {
  149. color: #fe6b01;
  150. // font-size: 38upx;
  151. // font-weight: bold;
  152. position: relative;
  153. }
  154. .ban {
  155. width: 50%;
  156. height: 5rpx;
  157. background: #fe6b01;
  158. opacity: 0.7;
  159. position: absolute;
  160. top: 55rpx;
  161. margin-left: 25%;
  162. }
  163. .empty {
  164. width: 100%;
  165. background: #ffffff;
  166. /* #ifdef MP-WEIXIN */
  167. height: 93vh;
  168. /* #endif */
  169. /* #ifndef MP-WEIXIN */
  170. height: 100vh;
  171. /* #endif */
  172. }
  173. .popup_money {
  174. height: 800upx;
  175. width: 100%;
  176. position: relative;
  177. }
  178. .u-drawer-bottom {
  179. background-color: #FAF7F5 !important;
  180. }
  181. .money_box {
  182. width: 93%;
  183. margin: 0 auto;
  184. background: #ffffff;
  185. border-radius: 14upx;
  186. height: 350rpx;
  187. margin-bottom: 20upx;
  188. margin-top: 20rpx;
  189. padding-top: 40rpx;
  190. }
  191. .box_tit {
  192. width: 90%;
  193. margin: 0 auto;
  194. height: 175upx;
  195. display: flex;
  196. }
  197. .money_name {
  198. flex: 1;
  199. display: flex;
  200. justify-content: left;
  201. align-items: center;
  202. font-size: 32rpx;
  203. letter-spacing: 2upx;
  204. }
  205. .money_price {
  206. width: 100%;
  207. height: 115rpx;
  208. text-align: center;
  209. font-size: 58upx;
  210. font-weight: bold;
  211. color: #fff;
  212. line-height: 115rpx;
  213. }
  214. .money_data {
  215. color: #999999;
  216. font-size: 24rpx;
  217. width: 90%;
  218. margin: 0 auto;
  219. margin-top: -8upx;
  220. }
  221. .u-line {
  222. width: 90% !important;
  223. border-bottom-width: 6upx !important;
  224. margin: 0 auto !important;
  225. margin-top: 22upx !important;
  226. margin-bottom: 22upx !important;
  227. }
  228. .box_bottom {
  229. width: 90%;
  230. margin: 0 auto;
  231. display: flex;
  232. height: 40upx;
  233. }
  234. .money_use {
  235. flex: 1;
  236. color: #999999;
  237. font-size: 24rpx;
  238. display: flex;
  239. justify-content: left;
  240. align-items: center;
  241. }
  242. .lj_use {
  243. width: 150rpx;
  244. border: 2rpx solid #fe6b01;
  245. color: #fff;
  246. text-align: center;
  247. line-height: 48rpx;
  248. border-radius: 40rpx;
  249. font-size: 23rpx;
  250. background: #fe6b01;
  251. }
  252. .lj_use2 {
  253. width: 150rpx;
  254. border: 2rpx solid #f5f5f5;
  255. color: #999;
  256. text-align: center;
  257. line-height: 48rpx;
  258. border-radius: 40rpx;
  259. font-size: 23rpx;
  260. background: #f5f5f5;
  261. }
  262. .lj_use3 {
  263. width: 150rpx;
  264. border: 2rpx solid #f56c6c;
  265. color: #fff;
  266. text-align: center;
  267. line-height: 48rpx;
  268. border-radius: 40rpx;
  269. font-size: 23rpx;
  270. background: #f56c6c;
  271. }
  272. </style>