261024
This commit is contained in:
+61
-102
@@ -5,43 +5,49 @@
|
||||
inActiveColor="#808080" @clickItem="onClickItem"/>
|
||||
</view>
|
||||
<view class="card-list">
|
||||
<block v-for="(group, groupIndex) in cardList" :key="groupIndex">
|
||||
<view class="flex flex-col justify-start items-start">
|
||||
<view class="group-title">{{ group.siteNames }}</view>
|
||||
<view @click="openUrl(`/package/card/checkout?cardId=${item.id}`)" class="container"
|
||||
v-for="(item, index) in group.cardList" :key="index">
|
||||
<view class="flex justify-between items-center w-100p p-20">
|
||||
<view class="flex justify-start items-center text-28 font-bold w-100p">
|
||||
<view class="web-text-heading">
|
||||
{{ item.name }}
|
||||
<template v-if="cardList.length">
|
||||
<block v-for="(group, groupIndex) in cardList" :key="groupIndex">
|
||||
<view class="flex flex-col justify-start items-start">
|
||||
<view class="group-title">{{ group.siteNames }}</view>
|
||||
<view @click="doBuy(item.id)" class="container"
|
||||
v-for="(item, index) in group.cardList" :key="index">
|
||||
<view class="flex justify-between items-center w-100p p-20">
|
||||
<view class="flex justify-start items-center text-28 font-bold w-100p">
|
||||
<view class="web-text-heading">
|
||||
{{ item.name }}
|
||||
</view>
|
||||
<view class="ml-10" v-if="item.type === 1">{{
|
||||
item.term
|
||||
}}年
|
||||
</view>
|
||||
<view class="ml-10" v-if="item.type === 3 || item.type === 4">{{
|
||||
item.month
|
||||
}}个月
|
||||
</view>
|
||||
<view v-if="item.type === 2" class="ml-10">
|
||||
{{ item.count }}次
|
||||
</view>
|
||||
<view v-if="item.type === 5" class="ml-10">{{
|
||||
item.discount
|
||||
}}折
|
||||
</view>
|
||||
</view>
|
||||
<view class="ml-10" v-if="item.type === 1">{{
|
||||
item.term
|
||||
}}年
|
||||
</view>
|
||||
<view class="ml-10" v-if="item.type === 3">{{
|
||||
item.month
|
||||
}}个月
|
||||
</view>
|
||||
<view v-if="item.type === 2" class="ml-10">
|
||||
{{ item.count }}次
|
||||
</view>
|
||||
<view v-if="item.type === 4" class="ml-10">{{
|
||||
item.discount
|
||||
}}折
|
||||
<view class="price">
|
||||
<text class="web-text-price">{{ `¥${item.price}` }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="price">
|
||||
<text class="web-text-price">{{ `¥${item.price}` }}</text>
|
||||
<view class="text-25 text-blue pt-10 mx-20" style="line-height: 35rpx" v-if="item.siteNames">
|
||||
可用场馆: {{ item.siteNames }}
|
||||
</view>
|
||||
<view class="text-25 text-gray py-15 mx-20" style="line-height: 35rpx">
|
||||
{{ item.info }}
|
||||
</view>
|
||||
</view>
|
||||
<view class="text-25 text-gray p-20">
|
||||
{{ item.info }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
<block v-if="cardList.length == 0">
|
||||
</block>
|
||||
</template>
|
||||
<uv-empty v-else text="暂无会员卡"/>
|
||||
<block v-if="loading">
|
||||
<uni-card :border="false" :padding="'18px 6px'">
|
||||
<uv-skeleton rows="2" avatar :loading="hideTools" :title="false"></uv-skeleton>
|
||||
</uni-card>
|
||||
@@ -72,6 +78,8 @@ import * as Api from '@/api/booking/card';
|
||||
import {pageWechatDeposit} from '@/api/shop/wechatDeposit';
|
||||
import {getWeek, getKey} from '@/utils/common';
|
||||
import {listThinkVip, listThinkVipByGroup} from "@/api/think/thinkVip";
|
||||
import {listThinkUsersVip} from "@/api/think/thinkUsersVip";
|
||||
import dayjs from "dayjs";
|
||||
|
||||
export default {
|
||||
components: {},
|
||||
@@ -79,6 +87,7 @@ export default {
|
||||
return {
|
||||
isRefresh: false,
|
||||
isLogin: false,
|
||||
loading: true,
|
||||
userId: 0,
|
||||
where: {
|
||||
page: 1,
|
||||
@@ -109,7 +118,8 @@ export default {
|
||||
styleType: 'text',
|
||||
getWeek,
|
||||
// 骨架屏
|
||||
hideTools: true
|
||||
hideTools: true,
|
||||
userVipList: []
|
||||
};
|
||||
},
|
||||
onLoad(option) {
|
||||
@@ -143,48 +153,15 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
async getCardList() {
|
||||
this.loading = true
|
||||
this.cardList = await listThinkVipByGroup({
|
||||
type: this.where.type
|
||||
})
|
||||
this.loading = false
|
||||
this.getUserVipList()
|
||||
},
|
||||
reload() {
|
||||
return;
|
||||
const app = this;
|
||||
const {where, userId} = this;
|
||||
if (userId == 0) {
|
||||
app.openLogin();
|
||||
return;
|
||||
}
|
||||
// where.userId = userId;
|
||||
// uni.showLoading({
|
||||
// title: '数据读取中.'
|
||||
// });
|
||||
app.loadMore = 'loading';
|
||||
Api.pageCard(where)
|
||||
.then((res) => {
|
||||
const list = res.list.map((d) => {
|
||||
return d;
|
||||
});
|
||||
if (app.cardList.length < res.count) {
|
||||
app.cardList = app.cardList.concat(list);
|
||||
app.canReset = true;
|
||||
app.loadMore = 'no-more';
|
||||
} else {
|
||||
app.canReset = false;
|
||||
app.loadMore = 'no-more';
|
||||
}
|
||||
// uni.hideLoading();
|
||||
app.isRefresh = false;
|
||||
app.hideTools = false;
|
||||
})
|
||||
.catch(() => {
|
||||
uni.showToast({
|
||||
title: '请检查您的网络.',
|
||||
icon: 'none'
|
||||
});
|
||||
app.isRefresh = false;
|
||||
app.hideTools = false;
|
||||
});
|
||||
async getUserVipList() {
|
||||
this.userVipList = await listThinkUsersVip()
|
||||
},
|
||||
onClickItem({currentIndex}) {
|
||||
|
||||
@@ -209,38 +186,6 @@ export default {
|
||||
url
|
||||
});
|
||||
},
|
||||
toPay(orderId) {
|
||||
uni.navigateTo({
|
||||
url: '/package/booking/confirm?id=' + orderId
|
||||
});
|
||||
},
|
||||
closeOrder(item) {
|
||||
uni.showModal({
|
||||
title: '确定取消此订单?',
|
||||
success(o) {
|
||||
if (o.confirm) {
|
||||
// Api.updateOrder({
|
||||
// orderStatus: 2,
|
||||
// orderId: item.orderId
|
||||
// })
|
||||
// .then((msg) => {
|
||||
// uni.showToast({
|
||||
// title: msg,
|
||||
// icon: 'none'
|
||||
// });
|
||||
// item.orderStatus = 2;
|
||||
// })
|
||||
// .catch(() => {
|
||||
// uni.showToast({
|
||||
// title: '请检查您的网络.',
|
||||
// icon: 'none'
|
||||
// });
|
||||
// uni.hideLoading();
|
||||
// });
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
// 弹出登录提示框
|
||||
async openLogin() {
|
||||
this.userId = uni.getStorageSync('user_id');
|
||||
@@ -248,6 +193,20 @@ export default {
|
||||
this.$refs.login.open('bottom');
|
||||
return false;
|
||||
}
|
||||
},
|
||||
doBuy(id) {
|
||||
const hasCard = this.userVipList.find(item => item.vid === id)
|
||||
if (hasCard) {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: `您已有该会员卡(${dayjs(hasCard.expireTime * 1000).format('YYYY-MM-DD HH:mm:ss')}过期),继续购买将在该卡上叠加过期时间/次数/金额,是否继续?`,
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
this.openUrl(`/package/card/checkout?cardId=${id}`)
|
||||
}
|
||||
}
|
||||
})
|
||||
} else this.openUrl(`/package/card/checkout?cardId=${id}`)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user