|
|
|
@ -51,8 +51,8 @@
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="rcpm">
|
|
|
|
<view class="rcpm">
|
|
|
|
<!-- <button type="primary" class="orderbtn" @click="openCardSelect(item)">预约</button>-->
|
|
|
|
<button type="primary" class="orderbtn" @click="openCardSelect(item)">预约</button>
|
|
|
|
<button type="primary" class="orderbtn" @click="gotoorder">预约</button>
|
|
|
|
<!-- <button type="primary" class="orderbtn" @click="gotoorder">预约</button>-->
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
@ -73,13 +73,18 @@
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 卡片为空提示 -->
|
|
|
|
|
|
|
|
<view v-if="!memberCards || memberCards.length === 0" class="empty-tip">
|
|
|
|
|
|
|
|
无对应会员卡可使用
|
|
|
|
|
|
|
|
</view>
|
|
|
|
|
|
|
|
<view v-else>
|
|
|
|
<view class="course-info">
|
|
|
|
<view class="course-info">
|
|
|
|
<view class="course-row">
|
|
|
|
<view class="course-row">
|
|
|
|
<text class="course-name">{{ currentCourse.courseName }}</text>
|
|
|
|
<text class="course-name">{{ item.courseName}}</text>
|
|
|
|
<text class="deduct">
|
|
|
|
<text class="deduct" v-if="selectedCard && selectedCard.memberChargeType !='days'">
|
|
|
|
需扣 {{ currentCourse.deductType === 'count'
|
|
|
|
需扣 {{ selectedCard.memberChargeType === 'total_fee'
|
|
|
|
? currentCourse.deductCount + '次'
|
|
|
|
? '¥' + selectedCard.chargeFee
|
|
|
|
: '¥' + currentCourse.deductAmount }}
|
|
|
|
: selectedCard.chargeCnt + '次'}}
|
|
|
|
</text>
|
|
|
|
</text>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<!-- ✅ 本次使用卡片 -->
|
|
|
|
<!-- ✅ 本次使用卡片 -->
|
|
|
|
@ -94,6 +99,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 卡片横向滑动 -->
|
|
|
|
<!-- 卡片横向滑动 -->
|
|
|
|
<member-card-scroll
|
|
|
|
<member-card-scroll
|
|
|
|
|
|
|
|
v-if="memberCards && memberCards.length > 0"
|
|
|
|
ref="cardScroll"
|
|
|
|
ref="cardScroll"
|
|
|
|
:cards="memberCards"
|
|
|
|
:cards="memberCards"
|
|
|
|
size="small"
|
|
|
|
size="small"
|
|
|
|
@ -101,18 +107,19 @@
|
|
|
|
:center="false"
|
|
|
|
:center="false"
|
|
|
|
:auto-select="false"
|
|
|
|
:auto-select="false"
|
|
|
|
:default-card-id="defaultCardId"
|
|
|
|
:default-card-id="defaultCardId"
|
|
|
|
:deduct-type="currentCourse.deductType"
|
|
|
|
|
|
|
|
:deduct-count="currentCourse.deductCount"
|
|
|
|
|
|
|
|
:deduct-amount="currentCourse.deductAmount"
|
|
|
|
|
|
|
|
@select="onCardSelect"
|
|
|
|
@select="onCardSelect"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
|
|
<view class="popup-footer">
|
|
|
|
<view v-if="memberCards && memberCards.length > 0" class="popup-footer">
|
|
|
|
<button class="confirm-btn" @click="confirmSelect">确认选择</button>
|
|
|
|
<button class="confirm-btn" @click="confirmSelect">确认选择</button>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</view>
|
|
|
|
</uni-popup>
|
|
|
|
</uni-popup>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<u-toast ref="uToast" />
|
|
|
|
<!-- 是否登录 -->
|
|
|
|
<!-- 是否登录 -->
|
|
|
|
<openlogin ref="loginId" @getPhoneNumber="getPhoneNumber"></openlogin>
|
|
|
|
<openlogin ref="loginId" @getPhoneNumber="getPhoneNumber"></openlogin>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
@ -135,31 +142,27 @@ export default {
|
|
|
|
userid: "",
|
|
|
|
userid: "",
|
|
|
|
id: "",
|
|
|
|
id: "",
|
|
|
|
item: {
|
|
|
|
item: {
|
|
|
|
courseTimeId: 1935590320322428931,
|
|
|
|
courseTimeId: null,
|
|
|
|
claName: "普拉提A班",
|
|
|
|
claName: "",
|
|
|
|
courseName: "普拉提",
|
|
|
|
courseName: "",
|
|
|
|
storeName: "慢瑜伽-三台子店",
|
|
|
|
storeName: "",
|
|
|
|
pic: null,
|
|
|
|
pic: null,
|
|
|
|
claDate: "2025-10-01",
|
|
|
|
claDate: "",
|
|
|
|
weekDay: "星期二",
|
|
|
|
weekDay: "",
|
|
|
|
startTime: "08:00",
|
|
|
|
startTime: "",
|
|
|
|
endTime: "09:30",
|
|
|
|
endTime: "",
|
|
|
|
staffName: "冉洪涛老师",
|
|
|
|
staffName: "",
|
|
|
|
studentCount: 1,
|
|
|
|
studentCount: null,
|
|
|
|
roomName: null,
|
|
|
|
roomName: null,
|
|
|
|
claColor: "#409EFF",
|
|
|
|
claColor: "",
|
|
|
|
claTimeStatus: "1",
|
|
|
|
claTimeStatus: "",
|
|
|
|
bookAttendCnt: "1",
|
|
|
|
bookAttendCnt: "",
|
|
|
|
atClassCnt: "5",
|
|
|
|
atClassCnt: "",
|
|
|
|
lessCnt: "3"
|
|
|
|
lessCnt: ""
|
|
|
|
},
|
|
|
|
},
|
|
|
|
remark: null,
|
|
|
|
remark: null,
|
|
|
|
memberCards: [],
|
|
|
|
memberCards: [],
|
|
|
|
currentCourse: {
|
|
|
|
currentCourse: {
|
|
|
|
courseName: '普拉提A班',
|
|
|
|
|
|
|
|
deductType: 'COUNT',
|
|
|
|
|
|
|
|
deductCount: 1,
|
|
|
|
|
|
|
|
deductAmount: 0
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
defaultCardId: null,
|
|
|
|
defaultCardId: null,
|
|
|
|
// ✅ 用户手动选中的卡(父组件持有)
|
|
|
|
// ✅ 用户手动选中的卡(父组件持有)
|
|
|
|
@ -210,9 +213,9 @@ export default {
|
|
|
|
isCardUsable(card) {
|
|
|
|
isCardUsable(card) {
|
|
|
|
if (!card) return false;
|
|
|
|
if (!card) return false;
|
|
|
|
if (card.status && card.status !== 'ACTIVE') return false;
|
|
|
|
if (card.status && card.status !== 'ACTIVE') return false;
|
|
|
|
if (card.expireDate) {
|
|
|
|
if (card.expiryDate) {
|
|
|
|
const now = new Date();
|
|
|
|
const now = new Date();
|
|
|
|
const expire = new Date(card.expireDate.replace(/-/g, '/'));
|
|
|
|
const expire = new Date(card.expiryDate.replace(/-/g, '/'));
|
|
|
|
if (now > expire) return false;
|
|
|
|
if (now > expire) return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const type = this.currentCourse.deductType;
|
|
|
|
const type = this.currentCourse.deductType;
|
|
|
|
@ -235,15 +238,19 @@ export default {
|
|
|
|
// ✅ 打开弹窗:重置手动选择,用默认卡
|
|
|
|
// ✅ 打开弹窗:重置手动选择,用默认卡
|
|
|
|
async openCardSelect(item) {
|
|
|
|
async openCardSelect(item) {
|
|
|
|
var user = myCache('userInfo');
|
|
|
|
var user = myCache('userInfo');
|
|
|
|
|
|
|
|
item.visitStore=user.visitStore;
|
|
|
|
|
|
|
|
console.log('item',item)
|
|
|
|
const { data: memberCards } =
|
|
|
|
const { data: memberCards } =
|
|
|
|
await uni.$http.post("/api/memberCard/getMemberCardListByCourseTimeId",
|
|
|
|
await uni.$http.post("/api/memberCard/getMemberCardListByCourseTimeId",
|
|
|
|
{visitStore:user.visitStore,
|
|
|
|
item);
|
|
|
|
courseId:item.courseId
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
console.log("memberCards",memberCards)
|
|
|
|
|
|
|
|
//如果为空 则没有适合的卡片
|
|
|
|
//如果为空 则没有适合的卡片
|
|
|
|
this.memberCards = memberCards.data
|
|
|
|
this.memberCards = memberCards.data
|
|
|
|
|
|
|
|
console.log('this.memberCards',this.memberCards)
|
|
|
|
|
|
|
|
if(this.memberCards&&this.memberCards.length > 0){
|
|
|
|
|
|
|
|
this.selectedCard = this.memberCards[0];
|
|
|
|
|
|
|
|
}else{
|
|
|
|
this.selectedCard = null;
|
|
|
|
this.selectedCard = null;
|
|
|
|
|
|
|
|
}
|
|
|
|
this.$refs.cardPopup.open();
|
|
|
|
this.$refs.cardPopup.open();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
@ -252,37 +259,53 @@ export default {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
async confirmSelect() {
|
|
|
|
async confirmSelect() {
|
|
|
|
// ✅ 直接从父组件 computed 拿有效卡
|
|
|
|
|
|
|
|
const card = this.effectiveCard;
|
|
|
|
const card = this.effectiveCard;
|
|
|
|
if (!card) {
|
|
|
|
if (!card) {
|
|
|
|
uni.showToast({ title: '无可用会员卡', icon: 'none' });
|
|
|
|
uni.showToast({ title: '无可用会员卡', icon: 'none' });
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 开启loading
|
|
|
|
|
|
|
|
uni.showLoading({
|
|
|
|
|
|
|
|
title: '预约中...',
|
|
|
|
|
|
|
|
mask: true // 遮罩,防止重复点击
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
try {
|
|
|
|
const { data: res } = await uni.$http.post('/api/course/bookCourse', {
|
|
|
|
const { data: res } = await uni.$http.post('/api/course/bookCourse', {
|
|
|
|
courseTimeId: this.item.courseTimeId,
|
|
|
|
courseTimeId: this.item.courseTimeId,
|
|
|
|
cardId: card.id
|
|
|
|
memberCardId: card.memberCardId,
|
|
|
|
|
|
|
|
memberChargeType: this.selectedCard.memberChargeType,
|
|
|
|
|
|
|
|
chargeCnt: this.selectedCard.chargeCnt,
|
|
|
|
|
|
|
|
chargeFee: this.selectedCard.chargeFee
|
|
|
|
});
|
|
|
|
});
|
|
|
|
if (res && res.success) {
|
|
|
|
if (res && res.success) {
|
|
|
|
myCache('courserefresh', 1);
|
|
|
|
myCache('courserefresh', 1);
|
|
|
|
uni.showModal({
|
|
|
|
this.closeCardSelect();
|
|
|
|
title: '提示',
|
|
|
|
this.$refs.uToast.show({
|
|
|
|
content: '课程已预约!',
|
|
|
|
title: '课程预约成功,请到 我的预约-预约中 查看',
|
|
|
|
cancelText: '返回',
|
|
|
|
type: 'success',
|
|
|
|
confirmText: '确定',
|
|
|
|
duration: 2000
|
|
|
|
success: ress => {
|
|
|
|
|
|
|
|
uni.navigateBack({ delta: 1 });
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
uni.showModal({
|
|
|
|
this.$refs.uToast.show({
|
|
|
|
title: '提示',
|
|
|
|
title: res.message ? res.message : '课程预约失败!',
|
|
|
|
content: res.message ? res.message : '课程预约失败!',
|
|
|
|
type: 'error',
|
|
|
|
cancelText: '取消',
|
|
|
|
duration: 2000
|
|
|
|
confirmText: '确定'
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (err) {
|
|
|
|
|
|
|
|
// 网络异常捕获
|
|
|
|
|
|
|
|
this.$refs.uToast.show({
|
|
|
|
|
|
|
|
title: '预约请求异常,请稍后重试',
|
|
|
|
|
|
|
|
type: 'error',
|
|
|
|
|
|
|
|
duration: 2000
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
|
|
// 不管成功失败、报错,都关闭loading
|
|
|
|
|
|
|
|
uni.hideLoading();
|
|
|
|
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
formatTime(timeStr) {
|
|
|
|
formatTime(timeStr) {
|
|
|
|
return timeStr.slice(0, 5);
|
|
|
|
return timeStr.slice(0, 5);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
@ -819,5 +842,11 @@ export default {
|
|
|
|
border: none;
|
|
|
|
border: none;
|
|
|
|
&::after { border: none; }
|
|
|
|
&::after { border: none; }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.empty-tip {
|
|
|
|
|
|
|
|
padding: 60rpx 20rpx;
|
|
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
|
|
|
color: #999;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
</style>
|
|
|
|
</style>
|
|
|
|
|