| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294 |
- <template>
- <view>
- <uni-popup ref="popupCoupon" type="bottom" :is-mask-click="false">
- <view class="pop-coupon box-border-box p-24">
- <view class="text-align-center fs-36 fw-600 box-title mb-32">
- 选择优惠券
- <uni-icons @click="closeCoupon" class="box-close" type="closeempty" size="20"></uni-icons>
- </view>
- <view class="flex-justify-around">
- <view @click="setType(1)" class="fs-28 fw-600 mb-24" :class="type == 1?'fc-41ABF5':''">
- 可用优惠券({{expressCouponData.coupon.length?expressCouponData.coupon.length:0}})
- </view>
- <view @click="setType(2)" class="fs-28 fw-600 mb-24" :class="type == 2?'fc-41ABF5':''">
- 可领优惠券({{expressCouponData.receive.length?expressCouponData.receive.length:0}})
- </view>
- </view>
- <view class="scroll-view-css" v-if="type == 1">
- <view v-if="expressCouponData.coupon.length === 0" class="scroll-view-css">
- <EnBlank :customSrc='true'>
- <template v-slot:blankImg>
- <image class="black-custom-img" src="@/static/img/common/no-order.png" mode=""></image>
- </template>
- </EnBlank>
- </view>
- <scroll-view v-else :scroll-y="true" class="scroll-view-css">
- <view class="item-box display-flex mb-20" v-for="(item,i) in expressCouponData.coupon" :key="i"
- @click="setFun(item)">
- <view class="item-left flex-direction align-items-center flex-justify-center bgc-FCE7E2">
- <view class="align-items-center">
- <view class="fs-30 fw-600 fc-FB3D03">¥</view>
- <view class="fs-48 fw-600 fc-FB3D03">{{item.money}}</view>
- </view>
- <view class="fs-24" :class="item.type == 0?'fc-6':'fc-9'">
- 需满{{item.full_money}}元
- </view>
- <view class="ball"></view>
- <view class="ball-two"></view>
- </view>
- <view class="item-hr"></view>
- <view class="item-right flex-1 bgc-f">
- <view class="fs-28 fw-600 mb-12 ticket-name text-overflow-ellipsis w382">
- {{item.name}}
- </view>
- <view class="fs-24 mb-12 fc-FB3D03">
- 有效时间:{{item.time_type_str}}
- </view>
- <view class="fs-24 fc-6">
- 券类型:{{item.scene == 1?'外卖券':'代取券'}}
- </view>
- </view>
- <image v-if="coupon_id==item.id" class="s-icon" src="@/static/img/common/y-select.png"
- mode=""></image>
- <image v-else class="s-icon" src="@/static/img/common/n-select.png" mode=""></image>
- </view>
- </scroll-view>
- </view>
- <view class="scroll-view-css" v-else>
- <view v-if="expressCouponData.receive.length === 0" class="scroll-view-css">
- <EnBlank :customSrc='true'>
- <template v-slot:blankImg>
- <image class="black-custom-img" src="@/static/img/common/no-order.png" mode=""></image>
- </template>
- </EnBlank>
- </view>
- <view v-else class="scroll-view-css">
- <view class=" display-flex mb-20" v-for="(item,i) in expressCouponData.receive" :key="i">
- <view class="item-right flex-direction flex-justify-center flex-1 bgc-f">
- <view class="fs-28 mb-12 ticket-name text-overflow-ellipsis fc-3 fw-600">
- {{item.name}}
- </view>
- <view class="fs-24 fc-6 mb-12">
- 有效时间:{{item.time_type_str}}
- </view>
- <view class="flex-justify-space">
- <view class="fs-24 fc-6">
- 券类型:{{item.scene == 1?'外卖券':'代取券'}}
- </view>
- </view>
- </view>
- <view class="item-hr"></view>
- <view class="item-left flex-direction align-items-center flex-justify-center bgc-FCE7E2">
- <view class="align-items-center">
- <view class="fs-30 fw-600 fc-FB3D03">¥</view>
- <view class="fs-48 fw-600 fc-FB3D03">{{item.money}}</view>
- </view>
- <view class="fs-24 mb-18 fc-6">
- 需满{{item.full_money}}元
- </view>
- <view class="but-box fs-28 fc-f" @click="getFun(item)">立即领取</view>
- <view class="ball"></view>
- <view class="ball-two"></view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </uni-popup>
- </view>
- </template>
- <script>
- import EnBlank from "@/components/en-utils/en-blank/en-blank";
- import {
- getExpressCoupon
- } from '@/api/express.js';
- import {
- receiveCoupon
- } from '@/api/coupon.js';
- import tools from "@/service/tools";
- export default {
- components: {
- EnBlank
- },
- data() {
- return {
- type: 1, //1可用类型 2可领类型
- coupon_id: 1,
- isAJAX: false,
- // 代取优惠券
- expressCouponData: {
- coupon: [], //可用
- receive: [], //可领
- }
- }
- },
- methods: {
- getList(e, id, shop_id) {
- console.log(e, id);
- if (id) {
- this.coupon_id = id;
- } else {
- this.coupon_id = '';
- }
- this.getExpressCoupon()
- },
- // 代取 获取优惠券
- getExpressCoupon() {
- let operate_id = uni.getStorageSync('operate_id');
- let school_id = uni.getStorageSync('school_id');
- getExpressCoupon({
- operate_id: operate_id,
- school_id: school_id
- }).then((res) => {
- if (res.code === 1) {
- this.expressCouponData = res.data;
- this.openPop();
- }
- })
- },
- setType(type) {
- if (type != this.type) {
- this.type = type
- }
- },
- openPop() {
- this.$refs.popupCoupon.open();
- },
- closeCoupon() {
- this.$refs.popupCoupon.close();
- this.$emit('gbCouopnPop', '')
- },
- setFun(item) {
- if (this.coupon_id == item.id) {
- this.coupon_id = ''
- this.$emit('giveCouPon', '');
- this.closeCoupon();
- } else {
- this.$emit('giveCouPon', item);
- this.closeCoupon();
- }
- },
- getFun(item) {
- if (this.isAJAX) {
- return
- }
- this.isAJAX = true;
- receiveCoupon({
- grant_id: item.grant_id,
- coupon_id: item.coupon_id
- }).then((res) => {
- if (res.code === 1) {
- this.isAJAX = false;
- tools.success('领取成功');
- this.expressCouponData = {
- coupon: [], //可用
- receive: [], //可领
- }
- this.getExpressCoupon()
- } else {
- this.isAJAX = false;
- tools.success('领取失败');
- }
- })
- }
- },
- }
- </script>
- <style scoped lang="scss">
- .w382 {
- width: 382rpx;
- }
- .item-box {
- position: relative;
- .s-icon {
- width: 32rpx;
- height: 32rpx;
- position: absolute;
- top: 45%;
- right: 24rpx;
- }
- }
- .pop-coupon {
- width: 100%;
- height: 70vh;
- background-color: #F5F4F9;
- border-radius: 24rpx 24rpx 0rpx 0rpx;
- padding-top: 32rpx !important;
- display: flex;
- flex-direction: column;
- .box-title {
- position: relative;
- .box-close {
- position: absolute;
- right: 22rpx;
- }
- }
- .item-right {
- padding: 24rpx;
- box-sizing: border-box;
- border-radius: 20rpx 0 0 20rpx;
- position: relative;
- }
- .item-hr {
- width: 0px;
- height: auto;
- border-right: 1rpx dashed #FB7850;
- }
- .item-hr-two {
- width: 0px;
- height: auto;
- border-right: 1rpx dashed #999;
- }
- .item-left {
- width: 200rpx;
- height: auto;
- padding: 20rpx 24rpx;
- box-sizing: border-box;
- position: relative;
- border-radius: 0 20rpx 20rpx 0;
- }
- .but-box {
- width: 152rpx;
- height: 52rpx;
- line-height: 52rpx;
- text-align: center;
- background: linear-gradient(225deg, #FB3D03 0%, #FF6901 100%);
- border-radius: 200rpx;
- }
- .ball {
- width: 24rpx;
- height: 24rpx;
- border-radius: 50%;
- position: absolute;
- top: -12rpx;
- left: -12rpx;
- background: #F5F5F5;
- z-index: 2;
- }
- .ball-two {
- width: 24rpx;
- height: 24rpx;
- border-radius: 50%;
- position: absolute;
- background: #F5F5F5;
- z-index: 10;
- bottom: -12rpx;
- left: -12rpx;
- }
- }
- </style>
|