dryClean-coupon.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. <template>
  2. <view>
  3. <uni-popup ref="popupCoupon" type="bottom">
  4. <view class="pop-coupon box-border-box p-24">
  5. <view class="text-align-center fs-36 fw-600 box-title mb-32">
  6. 选择优惠券
  7. <uni-icons @click="closeCoupon" class="box-close" type="closeempty" size="20"></uni-icons>
  8. </view>
  9. <view class="flex-justify-around">
  10. <view @click="setType(1)" class="fs-28 fw-600 mb-24" :class="type == 1?'fc-41ABF5':''">
  11. 可用优惠券({{expressCouponData.coupon.length}})</view>
  12. <view @click="setType(2)" class="fs-28 fw-600 mb-24" :class="type == 2?'fc-41ABF5':''">
  13. 可领优惠券({{expressCouponData.receive.length}})</view>
  14. </view>
  15. <view class="scroll-view-css" v-if="type == 1">
  16. <view v-if="expressCouponData.coupon.length === 0" class="scroll-view-css">
  17. <EnBlank :customSrc='true'>
  18. <template v-slot:blankImg>
  19. <image class="black-custom-img" src="@/static/img/common/no-order.png" mode=""></image>
  20. </template>
  21. </EnBlank>
  22. </view>
  23. <scroll-view v-else :scroll-y="true" class="scroll-view-css">
  24. <view class="item-box display-flex mb-20" v-for="(item,i) in expressCouponData.coupon" :key="i"
  25. @click="setFun(item)">
  26. <view class="item-left flex-direction align-items-center flex-justify-center bgc-FCE7E2">
  27. <view class="align-items-center">
  28. <view class="fs-30 fw-600 fc-FB3D03">¥</view>
  29. <view class="fs-48 fw-600 fc-FB3D03">{{item.money}}</view>
  30. </view>
  31. <view class="fs-24" :class="item.type == 0?'fc-6':'fc-9'">
  32. 需满{{item.full_money}}元
  33. </view>
  34. <view class="ball"></view>
  35. <view class="ball-two"></view>
  36. </view>
  37. <view class="item-hr"></view>
  38. <view class="item-right flex-1 bgc-f">
  39. <view class="fs-28 fw-600 mb-12 ticket-name text-overflow-ellipsis w382">
  40. {{item.name}}
  41. </view>
  42. <view class="fs-24 mb-12 fc-FB3D03">
  43. 有效时间:{{item.time_type_str}}
  44. </view>
  45. <view class="fs-24 fc-6">
  46. 券类型:{{item.scene == 1?'外卖券':'代取券'}}
  47. </view>
  48. </view>
  49. <image v-if="coupon_id==item.id" class="s-icon" src="@/static/img/common/y-select.png"
  50. mode=""></image>
  51. <image v-else class="s-icon" src="@/static/img/common/n-select.png" mode=""></image>
  52. </view>
  53. </scroll-view>
  54. </view>
  55. <view class="scroll-view-css" v-else>
  56. <view v-if="expressCouponData.receive.length === 0" class="scroll-view-css">
  57. <EnBlank :customSrc='true'>
  58. <template v-slot:blankImg>
  59. <image class="black-custom-img" src="@/static/img/common/no-order.png" mode=""></image>
  60. </template>
  61. </EnBlank>
  62. </view>
  63. <view v-else class="scroll-view-css">
  64. <view class=" display-flex mb-20" v-for="(item,i) in expressCouponData.receive" :key="i">
  65. <view class="item-right flex-direction flex-justify-center flex-1 bgc-f">
  66. <view class="fs-28 mb-12 ticket-name text-overflow-ellipsis fc-3 fw-600">
  67. {{item.name}}
  68. </view>
  69. <view class="fs-24 fc-6 mb-12">
  70. 有效时间:{{item.time_type_str}}
  71. </view>
  72. <view class="flex-justify-space">
  73. <view class="fs-24 fc-6">
  74. 券类型:{{item.scene == 1?'外卖券':'代取券'}}
  75. </view>
  76. </view>
  77. </view>
  78. <view class="item-hr"></view>
  79. <view class="item-left flex-direction align-items-center flex-justify-center bgc-FCE7E2">
  80. <view class="align-items-center">
  81. <view class="fs-30 fw-600 fc-FB3D03">¥</view>
  82. <view class="fs-48 fw-600 fc-FB3D03">{{item.money}}</view>
  83. </view>
  84. <view class="fs-24 mb-18 fc-6">
  85. 需满{{item.full_money}}元
  86. </view>
  87. <view class="but-box fs-28 fc-f" @click="getFun(item)">立即领取</view>
  88. <view class="ball"></view>
  89. <view class="ball-two"></view>
  90. </view>
  91. </view>
  92. </view>
  93. </view>
  94. </view>
  95. </uni-popup>
  96. </view>
  97. </template>
  98. <script>
  99. import EnBlank from "@/components/en-utils/en-blank/en-blank";
  100. import {
  101. getExpressCoupon
  102. } from '@/api/express.js';
  103. import {
  104. receiveCoupon
  105. } from '@/api/coupon.js';
  106. import tools from "@/service/tools";
  107. export default {
  108. components: {
  109. EnBlank
  110. },
  111. data() {
  112. return {
  113. type: 1, //1可用类型 2可领类型
  114. coupon_id: 1,
  115. isAJAX: false,
  116. // 代取优惠券
  117. expressCouponData: {
  118. coupon: [], //可用
  119. receive: [], //可领
  120. }
  121. }
  122. },
  123. methods: {
  124. getList(e, id, shop_id) {
  125. console.log(e, id);
  126. if (id) {
  127. this.coupon_id = id;
  128. } else {
  129. this.coupon_id = '';
  130. }
  131. this.getExpressCoupon()
  132. },
  133. // 代取 获取优惠券
  134. getExpressCoupon() {
  135. let operate_id = uni.getStorageSync('operate_id');
  136. getExpressCoupon({
  137. operate_id: operate_id
  138. }).then((res) => {
  139. if (res.code === 1) {
  140. this.expressCouponData = res.data;
  141. this.openPop();
  142. }
  143. })
  144. },
  145. setType(type) {
  146. if (type != this.type) {
  147. this.type = type
  148. }
  149. },
  150. openPop() {
  151. this.$refs.popupCoupon.open();
  152. },
  153. closeCoupon() {
  154. this.$refs.popupCoupon.close();
  155. },
  156. setFun(item) {
  157. this.$emit('giveCouPon', item);
  158. this.closeCoupon();
  159. },
  160. getFun(item) {
  161. if (this.isAJAX) {
  162. return
  163. }
  164. this.isAJAX = true;
  165. receiveCoupon({
  166. grant_id: item.grant_id,
  167. coupon_id: item.coupon_id
  168. }).then((res) => {
  169. if (res.code === 1) {
  170. this.isAJAX = false;
  171. tools.success('领取成功');
  172. this.expressCouponData = []
  173. this.getExpressCoupon()
  174. } else {
  175. this.isAJAX = false;
  176. tools.success('领取失败');
  177. }
  178. })
  179. }
  180. },
  181. }
  182. </script>
  183. <style scoped lang="scss">
  184. .w382 {
  185. width: 382rpx;
  186. }
  187. .item-box {
  188. position: relative;
  189. .s-icon {
  190. width: 32rpx;
  191. height: 32rpx;
  192. position: absolute;
  193. top: 45%;
  194. right: 24rpx;
  195. }
  196. }
  197. .pop-coupon {
  198. width: 100%;
  199. height: 70vh;
  200. background-color: #F5F4F9;
  201. border-radius: 24rpx 24rpx 0rpx 0rpx;
  202. padding-top: 32rpx !important;
  203. display: flex;
  204. flex-direction: column;
  205. .box-title {
  206. position: relative;
  207. .box-close {
  208. position: absolute;
  209. right: 22rpx;
  210. }
  211. }
  212. .item-right {
  213. padding: 24rpx;
  214. box-sizing: border-box;
  215. border-radius: 20rpx 0 0 20rpx;
  216. position: relative;
  217. }
  218. .item-hr {
  219. width: 0px;
  220. height: auto;
  221. border-right: 1rpx dashed #FB7850;
  222. }
  223. .item-hr-two {
  224. width: 0px;
  225. height: auto;
  226. border-right: 1rpx dashed #999;
  227. }
  228. .item-left {
  229. width: 200rpx;
  230. height: auto;
  231. padding: 20rpx 24rpx;
  232. box-sizing: border-box;
  233. position: relative;
  234. border-radius: 0 20rpx 20rpx 0;
  235. }
  236. .but-box {
  237. width: 152rpx;
  238. height: 52rpx;
  239. line-height: 52rpx;
  240. text-align: center;
  241. background: linear-gradient(225deg, #FB3D03 0%, #FF6901 100%);
  242. border-radius: 200rpx;
  243. }
  244. .ball {
  245. width: 24rpx;
  246. height: 24rpx;
  247. border-radius: 50%;
  248. position: absolute;
  249. top: -12rpx;
  250. left: -12rpx;
  251. background: #F5F5F5;
  252. z-index: 2;
  253. }
  254. .ball-two {
  255. width: 24rpx;
  256. height: 24rpx;
  257. border-radius: 50%;
  258. position: absolute;
  259. background: #F5F5F5;
  260. z-index: 10;
  261. bottom: -12rpx;
  262. left: -12rpx;
  263. }
  264. }
  265. </style>