my-ticket.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  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.full_money}}元</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)" v-if="status == 1">
  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. mounted() {
  93. this.page = 1;
  94. this.itemData = [];
  95. this.getList();
  96. },
  97. methods: {
  98. getList() {
  99. couponMember({
  100. page: this.page,
  101. status: this.status
  102. }).then((res) => {
  103. if (res.code === 1) {
  104. this.itemData = [...this.itemData, ...res.data.items];
  105. this.total = res.data.total;
  106. }
  107. })
  108. },
  109. tabStitle(status) {
  110. if (this.status != status) {
  111. this.status = status
  112. this.page = 1;
  113. this.itemData = [];
  114. this.getList();
  115. }
  116. },
  117. scrolltolower() {
  118. if (this.itemData.length < this.total) {
  119. this.page += 1;
  120. this.getList();
  121. }
  122. },
  123. goToUrl(type, item) {
  124. if (type == 0) {
  125. // 去使用
  126. if (item.scene == 1) {
  127. // 去外卖
  128. uni.navigateTo({
  129. url: `/pages-my/search-list?ticketId=` + item.id
  130. })
  131. } else {
  132. uni.navigateTo({
  133. url: '/pages-takeout/replace-take'
  134. })
  135. }
  136. } else if (type == 1) {
  137. // 规则
  138. uni.navigateTo({
  139. url: '/pages-my/rule-info?id=' + item.id
  140. })
  141. } else {
  142. // 领券中心
  143. uni.navigateTo({
  144. url: '/pages-my/ticket-centre'
  145. })
  146. }
  147. }
  148. },
  149. }
  150. </script>
  151. <style lang="scss" scoped>
  152. .tab-box {
  153. padding: 22rpx 0 4rpx 0;
  154. }
  155. .tab-hr {
  156. width: 40rpx;
  157. height: 4rpx;
  158. border-radius: 2rpx;
  159. }
  160. .list-box {
  161. padding: 24rpx 20rpx 4rpx;
  162. box-sizing: border-box;
  163. }
  164. .item-hr {
  165. width: 0px;
  166. height: auto;
  167. border-right: 1rpx dashed #FB7850;
  168. }
  169. .item-hr-two {
  170. width: 0px;
  171. height: auto;
  172. border-right: 1rpx dashed #999;
  173. }
  174. .item-left {
  175. width: 200rpx;
  176. height: auto;
  177. padding: 34rpx 36rpx 44rpx;
  178. box-sizing: border-box;
  179. position: relative;
  180. border-radius: 20rpx 0 0 20rpx;
  181. }
  182. .ball {
  183. width: 24rpx;
  184. height: 24rpx;
  185. border-radius: 50%;
  186. position: absolute;
  187. top: -12rpx;
  188. right: -12rpx;
  189. background: #F5F5F5;
  190. z-index: 10;
  191. }
  192. .ball-two {
  193. width: 24rpx;
  194. height: 24rpx;
  195. border-radius: 50%;
  196. position: absolute;
  197. background: #F5F5F5;
  198. z-index: 10;
  199. bottom: -12rpx;
  200. right: -12rpx;
  201. }
  202. .item-right {
  203. padding: 24rpx;
  204. box-sizing: border-box;
  205. border-radius: 0 20rpx 20rpx 0;
  206. position: relative;
  207. }
  208. .ticket-name {
  209. max-width: 280rpx;
  210. }
  211. .toRight {
  212. width: 32rpx;
  213. height: 32rpx;
  214. }
  215. .item-but {
  216. width: 124rpx;
  217. height: 52rpx;
  218. text-align: center;
  219. line-height: 52rpx;
  220. border: 1rpx solid #FB3D03;
  221. border-radius: 200rpx;
  222. position: absolute;
  223. bottom: 55%;
  224. right: 24rpx;
  225. }
  226. .item-img {
  227. width: 88rpx;
  228. height: 88rpx;
  229. position: absolute;
  230. bottom: 40%;
  231. right: 24rpx;
  232. }
  233. .bot-but {
  234. padding-top: 22rpx;
  235. padding-bottom: env(safe-area-inset-bottom);
  236. }
  237. </style>