Commit 4421974c by zhangzhen

功能优化

parent 554e2e3e
......@@ -69,3 +69,8 @@ export const orderCancelPay=(data)=>{
return http.post(url)
}
// 检查次卡和月卡使用情况
export const queryCardUse=(data)=>{
let url=`/consumerMonthlyCard/queryCardType`
return http.post(url,data)
}
\ No newline at end of file
......@@ -214,22 +214,22 @@
</view>
</view>
<view v-if="userInfo && (userInfo.secondaryCardList || userInfo.monthlyCardList) && radioChecked" class="flex-col card-use">
<view v-if="userInfo && (secondaryCardList.length || monthlyCardList.length)" class="flex-col card-use">
<text class="text-black text-left">专属权益</text>
<view class="radio-group-box">
<radio-group class="radio-group" @change="onRadioChange">
<label v-if="userInfo.secondaryCardList && userInfo.secondaryCardList[0].singleDuration" class="flex-between">
<view>次卡(剩余{{userInfo.secondaryCardList[0].number}}次)</view>
<label v-if="secondaryCardList.length" class="flex-between">
<view>次卡(剩余{{secondaryCardList[0].number}}次)</view>
<view class="flex-row-center" >
<text>请选择</text>
<radio class='pink radio' value="secondaryCard" :checked="radioChecked=='secondaryCard'?true:false" style="transform:scale(0.7)" />
<radio class='pink radio' :class="radioChecked=='secondaryCard'?'checked':''" value="secondaryCard" :checked="radioChecked=='secondaryCard'?true:false" style="transform:scale(0.7)" />
</view>
</label >
<label v-if="userInfo.monthlyCardList" class="flex-between">
<label v-if="monthlyCardList.length" class="flex-between">
<view>月卡</view>
<view class="flex-row-center" >
<text>请选择</text>
<radio class='pink radio' value="monthlyCard" :checked="radioChecked=='monthlyCard'?true:false" style="transform:scale(0.7)" />
<radio class='pink radio' :class="radioChecked=='monthlyCard'?'checked':''" value="monthlyCard" :checked="radioChecked == 'monthlyCard'?true:false" style="transform:scale(0.7)" />
</view>
</label >
......@@ -447,7 +447,8 @@
orderCreate,
computePrice,
getOrderInfoByNo,
orderCancelPay
orderCancelPay,
queryCardUse
} from "@/api/order"
export default {
......@@ -465,7 +466,7 @@
images: [],
status: 0
},
userInfo:'',
userInfo: uni.getStorageSync("userInfo")||'',
startTime: moment().format("HH:mm"),
endTime: '',
dateIndex: 0,
......@@ -587,7 +588,9 @@
warnTip:'',
activityDate:{},
storeCleanDuration: getSysConfigValue('StoreCleanDuration')? Number(getSysConfigValue('StoreCleanDuration')):30,
radioChecked:''
radioChecked:'',
monthlyCardList:[],
secondaryCardList:[]
};
},
filters: {
......@@ -1209,7 +1212,7 @@
if(this.allDayUseStatus){
this.computePriceInfo =''
}else{
this.onComputePrice();
this.onQueryCardUse();
}
} else if (res.data.code == 401) {
this.$refs.loginPop.open();
......@@ -1229,7 +1232,7 @@
} else {
that.selectCouponIndex = -1
}
that.onComputePrice();
that.onQueryCardUse();
}
},
success(res) {
......@@ -1248,28 +1251,74 @@
})
}
},
onQueryCardUse(){
if(this.userInfo && (this.userInfo.monthlyCardList || this.userInfo.secondaryCardList)){
let params = {
storeId: this.roomInfo.storeId,
roomId: this.roomInfo.id,
orderType: this.orderType,
preStartDate: this.formatAllData.startDateTime,
preEndDate: this.formatAllData.endDateTime,
orderMode: this.modeIndex2 >= 0 || (this.modeIndex>=0 && this.roomLabelList.length && this.roomLabelList[this.modeIndex].openPack==1)? 1 : 0,
packId: this.modeIndex2 >= 0 ? this.packageMode[this.modeIndex2].id : this.modeIndex>=0 && this.roomLabelList.length && this.roomLabelList[this.modeIndex].openPack==1? this.roomLabelList[this.modeIndex].packId : '',
roomLabelId : this.modeIndex >= 0 ? this.roomLabelList[this.modeIndex].id : '',
}
queryCardUse(params).then(res => {
console.log(res,9999)
if(res.data.code == 200){
if(res.data.data && res.data.data.consumerMonthlyCard && res.data.data.consumerMonthlyCard.length){
this.radioChecked = "monthlyCard";
}else if(res.data.data && res.data.data.consumerSecondaryCard && res.data.data.consumerSecondaryCard.length){
this.radioChecked = "secondaryCard";
}else{
this.radioChecked = ""
}
if(this.userInfo.monthlyCardList && res.data.data && res.data.data.consumerMonthlyCard && res.data.data.consumerMonthlyCard.length){
this.monthlyCardList = this.userInfo.monthlyCardList.filter(item => res.data.data.consumerMonthlyCard.includes( item.id))
}else{
this.monthlyCardList = [];
}
if(this.userInfo.secondaryCardList && res.data.data && res.data.data.consumerSecondaryCard && res.data.data.consumerSecondaryCard.length){
this.secondaryCardList = this.userInfo.secondaryCardList.filter(item => res.data.data.consumerSecondaryCard.includes( item.id))
}else{
this.secondaryCardList = [];
}
console.log(this.radioChecked,"4545455")
console.log(this.monthlyCardList)
console.log(this.secondaryCardList)
this.onComputePrice();
}
})
}else{
this.onComputePrice();
}
},
//计算支付金额
onComputePrice(p = null) {
// uni.showLoading({
// title: "加载中..."
// })
this.userInfo = uni.getStorageSync("userInfo")||''
onComputePrice() {
let params = {
storeId: this.roomInfo.storeId,
roomId: this.roomInfo.id,
buyType: this.orderTypeList[this.index].type,
couponId: this.useCouponList.length && this.selectCouponIndex >= 0 ? this.useCouponList[this.selectCouponIndex].id : '',
orderType: this.orderType,
preStartDate: p != null ? p.startDateTime : this.formatAllData.startDateTime,
preEndDate: p != null ? p.endDateTime : this.formatAllData.endDateTime,
orderMode: this.modeIndex2 >= 0 || (this.modeIndex>=0 && this.roomLabelList.length && this.roomLabelList[this.modeIndex].openPack==1)? 1 : 0,
packId: this.modeIndex2 >= 0 ? this.packageMode[this.modeIndex2].id : this.modeIndex>=0 && this.roomLabelList.length && this.roomLabelList[this.modeIndex].openPack==1? this.roomLabelList[this.modeIndex].packId : '',
roomLabelId : this.modeIndex >= 0 ? this.roomLabelList[this.modeIndex].id : '',
secondaryCardId: this.userInfo && this.userInfo.secondaryCardList && this.userInfo.secondaryCardList.length && (!this.radioChecked || this.radioChecked==='secondaryCard') ? this.userInfo.secondaryCardList[0].id:'',
monthlyCardId: this.userInfo && this.userInfo.monthlyCardList && this.userInfo.monthlyCardList.length && (!this.radioChecked || this.radioChecked==='monthlyCard')? this.userInfo.monthlyCardList[0].id:''
}
storeId: this.roomInfo.storeId,
roomId: this.roomInfo.id,
buyType: this.orderTypeList[this.index].type,
couponId: this.useCouponList.length && this.selectCouponIndex >= 0 ? this.useCouponList[this.selectCouponIndex].id : '',
orderType: this.orderType,
preStartDate:this.formatAllData.startDateTime,
preEndDate: this.formatAllData.endDateTime,
orderMode: this.modeIndex2 >= 0 || (this.modeIndex>=0 && this.roomLabelList.length && this.roomLabelList[this.modeIndex].openPack==1)? 1 : 0,
packId: this.modeIndex2 >= 0 ? this.packageMode[this.modeIndex2].id : this.modeIndex>=0 && this.roomLabelList.length && this.roomLabelList[this.modeIndex].openPack==1? this.roomLabelList[this.modeIndex].packId : '',
roomLabelId :this.modeIndex >= 0 ? this.roomLabelList[this.modeIndex].id : '',
}
if(this.radioChecked == "secondaryCard"){
params.secondaryCardId = this.secondaryCardList[0].id
}else if(this.radioChecked == "monthlyCard"){
params.monthlyCardId = this.monthlyCardList[0].id
}
computePrice(params).then(res => {
// uni.hideLoading()
......@@ -1287,11 +1336,6 @@
...obj,
discountText
};
if(!this.radioChecked && this.computePriceInfo.secondaryCardId){
this.radioChecked = "secondaryCard"
}else if(!this.radioChecked && this.computePriceInfo.monthlyCardId){
this.radioChecked = "monthlyCard"
}
} else {
uni.showToast({
icon: "none",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment