my-ticket.vue 5.7 KB

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