From 1321922b30833ab0075edc9be8fcf8526ab0f2df Mon Sep 17 00:00:00 2001
From: cun-nan <19819293608@163.com>
Date: Tue, 16 Jan 2024 16:10:03 +0800
Subject: [PATCH] bug
---
.../pagesRefuel/orderDetail/index.vue | 177 ++++++++++++++----
1 file changed, 144 insertions(+), 33 deletions(-)
diff --git a/gasStation-uni/pagesRefuel/orderDetail/index.vue b/gasStation-uni/pagesRefuel/orderDetail/index.vue
index d484ed2dd..23b79610c 100644
--- a/gasStation-uni/pagesRefuel/orderDetail/index.vue
+++ b/gasStation-uni/pagesRefuel/orderDetail/index.vue
@@ -38,15 +38,6 @@
-
-
- 囤油卡
- (余额:{{refuelBalance}}L)
-
-
- - {{oilCardRedece}}L
-
-
@@ -54,7 +45,32 @@
(主卡余额:¥{{user.cardBalance}})
- -¥{{balanceRedece}}
+
+ -¥{{balanceRedece}}
+
+
+
+
+
+
+
+
+
+
+
+
+ 囤油卡
+ (余额:{{refuelBalance}}L)
+
+
+
+ - {{oilCardRedece}}L
+
+
+
+
+
+
@@ -64,19 +80,33 @@
- -¥{{fullRedece}}
+
+ -¥{{fullRedece}}
+
+
+
+
+
+
-
+
@@ -84,7 +114,14 @@
- -¥{{gradeRedece}}
+
+ -¥{{gradeRedece}}
+
+
+
+
+
+
无优惠
@@ -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;i0 ){
+ 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
- this.chooseCardBalance(1)
+ 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;