my-ticket.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. <template>
  2. <view class="my-ticket flex-common-css ">
  3. <Nav title="我的优惠券" titleColor="#333" bgckgroundBox='#fff'></Nav>
  4. <view class="tab-box flex-justify-around bgc-f ">
  5. <view class="tab-but flex-1 flex-direction align-items-center" v-for="(item, index) in tabList" :key="index"
  6. @click="tabStitle(item.status)">
  7. <view class="fs-32 mb-18" :class="status==item.status?'fc-41ABF5':'fc-3'">
  8. {{item.name}}
  9. </view>
  10. <view v-show="status==item.status" class="tab-hr bgc-41ABF5"></view>
  11. </view>
  12. </view>
  13. <view v-if="itemData.length === 0" class="scroll-view-css">
  14. <EnBlank :customSrc='true'>
  15. <template v-slot:blankImg>
  16. <image class="black-custom-img" src="@/static/img/common/no-order.png" mode=""></image>
  17. </template>
  18. </EnBlank>
  19. </view>
  20. <scroll-view v-else :scroll-y="true" class="scroll-view-css" @scrolltolower="scrolltolower">
  21. <view class="list-box">
  22. <view class="item-box display-flex mb-20" v-for="(item,index) in itemData" :key="index">
  23. <view class="item-left flex-direction align-items-center flex-justify-center"
  24. :class="status == 1?'bgc-FCE7E2':'bgc-E6E6E6'">
  25. <view class="align-items-center">
  26. <view class="fs-30 fw-600" :class="status == 1?'fc-FB3D03':'fc-9'">¥</view>
  27. <view class="fs-48 fw-600" :class="status == 1?'fc-FB3D03':'fc-9'">{{item.money}}</view>
  28. </view>
  29. <view class="fs-24" :class="status == 1?'fc-6':'fc-9'">{{item.desc}}</view>
  30. <view class="ball"></view>
  31. <view class="ball-two"></view>
  32. </view>
  33. <view class="item-hr" :class="status == 1?'':'item-hr-two'"></view>
  34. <view class="item-right flex-1 bgc-f">
  35. <view class="fs-28 mb-12 ticket-name text-overflow-ellipsis" :class="status == 1?'fc-3':'fc-9'">
  36. {{item.name}}
  37. </view>
  38. <view class="fs-24 mb-12" :class="status == 1?'fc-FB3D03':'fc-9'">
  39. {{item.time_str}}
  40. </view>
  41. <view class="flex-justify-space">
  42. <view class="fs-24" :class="status == 1?'fc-3':'fc-9'">
  43. 券类型:{{item.scene == 1?'外卖券':'代取券'}}
  44. </view>
  45. <view class="align-items-center" @click="goToUrl(1,item)">
  46. <view class="fs-24 fc-9">规则</view>
  47. <image class="toRight" src="@/static/img/toRight.png" mode=""></image>
  48. </view>
  49. </view>
  50. <view class="item-but fc-FB3D03" v-if="status == 1" @click="goToUrl(0,item)">去使用</view>
  51. <image class="item-img" src="@/static/img/my/ysy.png" mode="" v-else-if="status == 2"></image>
  52. <image class="item-img" src="@/static/img/my/ysx.png" mode="" v-else></image>
  53. </view>
  54. </view>
  55. </view>
  56. </scroll-view>
  57. <view class="bot-but flex-justify-center align-items-center bgc-f" @click="goToUrl(2)">
  58. <view class="fc-41ABF5 fs-32 fw-600 mr-8">去领券中心</view>
  59. <image class="toRight" src="@/static/img/my/to-right.png" mode=""></image>
  60. </view>
  61. </view>
  62. </template>
  63. <script>
  64. import {
  65. couponMember
  66. } from '@/api/coupon.js';
  67. import tools from "@/service/tools";
  68. import EnBlank from "@/components/en-utils/en-blank/en-blank";
  69. export default {
  70. components: {
  71. EnBlank
  72. },
  73. data() {
  74. return {
  75. tabList: [{
  76. name: '待使用',
  77. status: 1
  78. }, {
  79. name: '已使用',
  80. status: 2
  81. }, {
  82. name: '已过期',
  83. status: 3
  84. }, ],
  85. status: 1,
  86. page: 1,
  87. itemData: [],
  88. total: 0,
  89. };
  90. },
  91. onShow() {
  92. this.page = 1;
  93. this.itemData = [];
  94. this.getList();
  95. },
  96. methods: {
  97. getList() {
  98. couponMember({
  99. page: this.page,
  100. status: this.status
  101. }).then((res) => {
  102. if (res.code === 1) {
  103. this.itemData = [...this.itemData, ...res.data.items];
  104. this.total = res.data.total;
  105. }
  106. })
  107. },
  108. tabStitle(status) {
  109. if (this.status != status) {
  110. this.status = status
  111. this.page = 1;
  112. this.itemData = [];
  113. this.getList();
  114. }
  115. },
  116. scrolltolower() {
  117. if (this.itemData.length < this.total) {
  118. this.page += 1;
  119. this.getList();
  120. }
  121. },
  122. goToUrl(type, item) {
  123. if (type == 0) {
  124. // 去使用
  125. if (item.scene == 1) {
  126. // 去外卖
  127. uni.navigateTo({
  128. url: `/pages-my/search-list?ticketId=` + item.id
  129. })
  130. } else {
  131. uni.navigateTo({
  132. url: '/pages-takeout/replace-take'
  133. })
  134. }
  135. } else if (type == 1) {
  136. // 规则
  137. uni.navigateTo({
  138. url: '/pages-my/rule-info?id=' + item.id
  139. })
  140. } else {
  141. // 领券中心
  142. uni.navigateTo({
  143. url: '/pages-my/ticket-centre'
  144. })
  145. }
  146. }
  147. },
  148. }
  149. </script>
  150. <style lang="scss" scoped>
  151. .tab-box {
  152. padding: 22rpx 0 4rpx 0;
  153. }
  154. .tab-hr {
  155. width: 40rpx;
  156. height: 4rpx;
  157. border-radius: 2rpx;
  158. }
  159. .list-box {
  160. padding: 24rpx 20rpx 4rpx;
  161. box-sizing: border-box;
  162. }
  163. .item-hr {
  164. width: 0px;
  165. height: auto;
  166. border-right: 1rpx dashed #FB7850;
  167. }
  168. .item-hr-two {
  169. width: 0px;
  170. height: auto;
  171. border-right: 1rpx dashed #999;
  172. }
  173. .item-left {
  174. width: 200rpx;
  175. height: auto;
  176. padding: 34rpx 36rpx 44rpx;
  177. box-sizing: border-box;
  178. position: relative;
  179. border-radius: 20rpx 0 0 20rpx;
  180. }
  181. .ball {
  182. width: 24rpx;
  183. height: 24rpx;
  184. border-radius: 50%;
  185. position: absolute;
  186. top: -12rpx;
  187. right: -12rpx;
  188. background: #F5F5F5;
  189. z-index: 10;
  190. }
  191. .ball-two {
  192. width: 24rpx;
  193. height: 24rpx;
  194. border-radius: 50%;
  195. position: absolute;
  196. background: #F5F5F5;
  197. z-index: 10;
  198. bottom: -12rpx;
  199. right: -12rpx;
  200. }
  201. .item-right {
  202. padding: 24rpx;
  203. box-sizing: border-box;
  204. border-radius: 0 20rpx 20rpx 0;
  205. position: relative;
  206. }
  207. .ticket-name {
  208. max-width: 280rpx;
  209. }
  210. .toRight {
  211. width: 32rpx;
  212. height: 32rpx;
  213. }
  214. .item-but {
  215. width: 124rpx;
  216. height: 52rpx;
  217. text-align: center;
  218. line-height: 52rpx;
  219. border: 1rpx solid #FB3D03;
  220. border-radius: 200rpx;
  221. position: absolute;
  222. bottom: 55%;
  223. right: 24rpx;
  224. }
  225. .item-img {
  226. width: 88rpx;
  227. height: 88rpx;
  228. position: absolute;
  229. bottom: 40%;
  230. right: 24rpx;
  231. }
  232. .bot-but {
  233. padding-top: 22rpx;
  234. padding-bottom: env(safe-area-inset-bottom);
  235. }
  236. </style>