This commit is contained in:
cun-nan 2024-01-16 16:10:03 +08:00
parent b840bd3e99
commit 1321922b30

View File

@ -38,15 +38,6 @@
</view>
<view style="background-color: white;width: 94%;margin: 15px auto;">
<view class="desc" v-if="isOilStorageCard">
<view style="display: flex;">
囤油卡
<span style="display: flex;">(余额{{refuelBalance}}L)</span>
</view>
<view style="display: flex;">
<span style="margin-right: 10px;">- {{oilCardRedece}}L</span>
</view>
</view>
<view class="desc" v-if="isStoreValueCard">
<view style="display: flex;">
@ -54,7 +45,32 @@
<span style="display: flex;">(<span v-if="isUseChildCard">主卡</span>余额{{user.cardBalance}})</span>
</view>
<view style="display: flex;">
<span style="margin-right: 10px;">-{{balanceRedece}}</span>
<span style="margin-right: 10px;display: flex;">
-{{balanceRedece}}
<span style="margin-left: 8px;margin-top: 8px;">
<!-- <uni-data-checkbox v-model="checkBalance" :multiple="true" :localdata="range" @change="changeBalance"></uni-data-checkbox> -->
<!-- <u-checkbox-group> -->
<!-- <u-checkbox v-model="checkBalance" @change="changeBalance"></u-checkbox> -->
<!-- </u-checkbox-group> -->
</span>
</span>
</view>
</view>
<view class="desc">
<view style="display: flex;">
囤油卡
<span style="display: flex;">(余额{{refuelBalance}}L)</span>
</view>
<view style="display: flex;">
<span style="margin-right: 10px;display: flex;">
- {{oilCardRedece}}L
<span style="margin-left: 8px;margin-top: 8px;">
<u-checkbox-group>
<u-checkbox v-model="checkOilCard" :checked="checkOilCard" @change="changeOilCard" :disabled="oilCardRedece==0"></u-checkbox>
</u-checkbox-group>
</span>
</span>
</view>
</view>
@ -64,19 +80,33 @@
<!-- <span style="display: flex;">(满减活动)</span> -->
</view>
<view style="display: flex;">
<span style="margin-right: 10px;">-{{fullRedece}}</span>
<span style="margin-right: 10px;display: flex;">
-{{fullRedece}}
<span style="margin-left: 8px;margin-top: 8px;">
<u-checkbox-group>
<u-checkbox v-model="checkFull" :checked="checkFull" @change="changeFull"></u-checkbox>
</u-checkbox-group>
</span>
</span>
</view>
</view>
<!-- <view class="desc" >
<view class="desc" v-if="cardsList.length>0">
<view style="display: flex;">
优惠券优惠
<span style="display: flex;">(优惠券)</span>
</view>
<view style="display: flex;">
<span style="margin-right: 10px;">-{{couponRedece}}</span>
<span style="margin-right: 10px;display: flex;">
-{{couponRedece}}
<span style="margin-left: 8px;margin-top: 8px;">
<u-checkbox-group>
<u-checkbox v-model="checkCoupon" :checked="checkCoupon" @change="changeCoupon"></u-checkbox>
</u-checkbox-group>
</span>
</span>
</view>
</view>
</view> -->
<view class="desc" v-if="isGradePreferential">
<view style="display: flex;">
@ -84,7 +114,14 @@
<!-- <span style="display: flex;">({{userGrade.name}})</span> -->
</view>
<view style="display: flex;">
<span style="margin-right: 10px;">-{{gradeRedece}}</span>
<span style="margin-right: 10px;display: flex;">
-{{gradeRedece}}
<span style="margin-left: 8px;margin-top: 8px;">
<u-checkbox-group>
<u-checkbox v-model="checkGrade" @change="changeGrade"></u-checkbox>
</u-checkbox-group>
</span>
</span>
</view>
</view>
<view class="desc" v-if="!isFullPreferential && !isGradePreferential && !isOilStorageCard && !isStoreValueCard">无优惠</view>
@ -189,6 +226,8 @@
isGradePreferential:false,
// 使
isFullPreferential:false,
// 使
isCoupons:false,
transferDTO:{
type:0,
amount:0,
@ -198,11 +237,24 @@
},
fixingLevel:{},
isUseChildCard:false,
cardsList:[],
query: {
storeId: uni.getStorageSync("storeId"),
couponType: '',
useStatus: 0,
pageNo: 1,
pageSize: 10
},
checkBalance:false,
checkOilCard:false,
checkFull:false,
checkCoupon:false,
checkGrade:false,
}
},
onLoad(e) {
this.orderNo = e.orderNo
// this.orderNo = "234520240113160238a6efad"
// this.orderNo = "2345202401161204280406d3"
},
onShow() {
this.getOilOrder();
@ -211,13 +263,52 @@
},
methods: {
//
changeBalance(val){
console.log("balance",this.checkBalance,val);
},
//
changeOilCard(val){
console.log("oilcard",this.checkBalance,val);
if (val){
// this.payAmount = this.deductAmount - this.gradeRedece
}
},
//
changeFull(val){
console.log("balance",this.checkBalance,val);
if (val){
this.payAmount = this.deductAmount - this.fullRedece
}else{
this.payAmount = this.deductAmount
}
},
//
changeCoupon(val){
console.log("balance",this.checkBalance,val);
if (val){
this.payAmount = this.deductAmount - this.couponRedece
}else{
this.payAmount = this.deductAmount
}
},
//
changeGrade(val){
console.log("balance",this.checkBalance,val);
if (val){
this.payAmount = this.deductAmount - this.gradeRedece
}else{
this.payAmount = this.deductAmount
}
},
//
payment(){
let map = {
orderNo : this.orderNo,
payAmount : this.payAmount,
// payAmount : "0.01",
discountAmount : this.fullRedece+this.gradeRedece+this.couponRedece,
discountAmount : (this.fullRedece*100+this.gradeRedece*100+this.couponRedece*100)/100,
oilCardAmount : JSON.stringify(this.refuelMoneyAfter),
oilCardLiters : this.oilCardRedece,
balanceAmount : this.balanceRedece,
@ -232,7 +323,6 @@
method: 'post',
data: map,
}).then(res => {
// console.log(res,_this.appltType)
let payProvider = "wxpay"
if (_this.appltType== "WECHAT"){
payProvider = "wxpay"
@ -244,9 +334,7 @@
url: "/business/allOrderInfo/orderStatus",
method: 'post',
data: {"orderNo":_this.orderNo,"status":"payFail"},
}).then((ress)=>{
console.log(ress);
})
}).then((ress)=>{})
uni.showToast({
title:res.data.error,
icon:"none"
@ -321,10 +409,13 @@
// 使
chooseRefuelMoney(){
console.log("oilCard");
let falg = false;
for(let i = 0;i<this.refuelMoney.length;i++){
if (this.refuelMoney[i].oilType == this.oilNameId){
if( this.refuelMoney[i].refuelMoney>0 ){
falg = true
}
this.refuelBalance = this.refuelMoney[i].refuelMoney
if (this.refuelMoney[i].refuelMoney>0){
this.isOilStorageCard = true
@ -335,23 +426,26 @@
}else{
this.oilCardRedece = this.refuelMoney[i].refuelMoney
this.refuelMoneyAfter[i].refuelMoney = 0
if (falg) {
this.chooseCardBalance(1)
}
}
}
}
if (falg == false) {
this.chooseCardBalance(0)
this.chooseGrade(this.user.id,this.user.gradeId)
// this.chooseGrade(this.user.id,this.user.gradeId)
}
},
// 使
chooseCardBalance(val){
console.log("balance");
if (this.user.cardBalance>0) {
this.isStoreValueCard = true;
if (val == 0) {
// 使
if (this.user.cardBalance >= this.oilOrder.orderAmount){
this.balanceRedece = this.oilOrder.orderAmount
if (this.user.cardBalance >= (this.oilOrder.orderAmount - this.couponRedece)){
this.balanceRedece = this.oilOrder.orderAmount - this.couponRedece
} else {
this.balanceRedece = this.user.cardBalance
this.deductAmount = (this.oilOrder.orderAmount*100-this.balanceRedece*100)/100
@ -380,6 +474,7 @@
},
// 使
chooseGrade(userId,gradeId){
console.log("userGrade");
let that = this;
request({
url: "business/userManager/userGrade/isUse",
@ -676,6 +771,7 @@
},
// 使
chooseFullOrCoupon(){
console.log("full");
this.transferDTO.amount = this.deductAmount
this.transferDTO.mtUserLevel = this.userGrade.id
this.transferDTO.oilId = this.oilId
@ -685,7 +781,6 @@
method: 'post',
data:_this.transferDTO,
}).then((res) => {
// console.log(res)
if (res.data.amount>0){
_this.payAmount = res.data.amount - _this.gradeRedece
_this.fullRedece = res.data.favorableAmount
@ -693,10 +788,28 @@
}
})
},
// 使
chooseCoupons(){
console.log("coupons");
request({
url: 'business/marketingActivity/cardFavorable/applet',
method: 'get',
params: this.query
}).then(res => {
if (res.data.records) {
console.log(res.data.records);
this.cardsList = res.data.records
if (this.cardsList.length>0){
this.couponRedece = this.cardsList[0].couponAmount
}
}
})
},
//
countPayMent(){
this.payAmount = this.deductAmount - this.gradeRedece - this.fullRedece - this.couponRedece;
this.payAmount = this.deductAmount;
console.log("111",this.deductAmount, this.gradeRedece, this.fullRedece, this.couponRedece);
},
// id
@ -714,15 +827,14 @@
}
_this.user = res.data.userVo;
_this.user = res.data.userVo;
// console.log(res.data.userVo.refuelMoney);
if (res.data.userVo.refuelMoney!=null && res.data.userVo.refuelMoney!=""){
if (res.data.userVo.refuelMoney){
_this.refuelMoney = JSON.parse(res.data.userVo.refuelMoney)
_this.refuelMoneyAfter = JSON.parse(res.data.userVo.refuelMoney)
_this.chooseRefuelMoney()
}else{
_this.chooseCardBalance(0)
_this.chooseGrade(res.data.userVo.gradeId)
}
_this.chooseGrade(res.data.userVo.id,res.data.userVo.gradeId)
})
},
//
@ -735,12 +847,12 @@
orderNo: _this.orderNo
},
}).then((res) => {
// console.log(res)
if(res.data!=null){
_this.oilOrder = res.data
_this.getStaffList(res.data.staffId)
_this.getStore(res.data.storeId)
_this.getOilNumber(res.data.storeId)
_this.chooseCoupons()
_this.getUser(res.data.userId)
}
})
@ -776,7 +888,6 @@
method: 'get',
}).then((res) => {
res.data.forEach(item => {
// console.log(item);
if (item.oilName == _this.oilOrder.oils) {
_this.oilPrice = item.gbPrice;
_this.oilName = item.oilNames;