Commit cbffddcf by 李嘉林

余额充值

parent 4e104fba
......@@ -8,5 +8,10 @@ export default {
return requestPOST1(
`${process.env.OLSHOP_URL}/pay/payment_cancel?orderSn=${options}`
);
},
getGiftRechargeOrderQuery(options) {
return requestPOST(
`${process.env.OLSHOP_URL}/giftCardTrade/getGiftRechargeOrderQuery`, options
);
}
};
\ No newline at end of file
......@@ -23,12 +23,20 @@
<div v-if="orderDetail.orderType == 5"></div>
<div v-else class="orderPrice" v-html="subTitle">
订单金额:
<span v-if="routeQuery.multiMerchantsFlag"
<span v-if="routeQuery.multiMerchantsFlag || routeQuery.accountBalanceFlag"
>{{ routeQuery.totalMoney }}</span
>
<span v-else>{{ totalMoney }}</span>
</div>
</template>
<!-- 余额充值 -->
<template v-if="routeQuery.accountBalanceFlag">
<div class="balance">
<p>获得{{ balanceRewardsPoints }}积分</p>
<p class="balance-line">|</p>
<p>获得{{ balanceRewardsPrice }}赠金</p>
</div>
</template>
<div class="bottom flex">
<template v-if="orderDetail.orderType == 5"> </template>
<template v-else>
......@@ -145,6 +153,12 @@ export default {
whetherOpenApproval: {
default: 0,
},
balanceRewardsPrice: {
default: 0,
},
balanceRewardsPoints: {
default: 0,
},
},
data() {
return {
......@@ -161,9 +175,15 @@ export default {
return this.datas.componentData["title"];
},
subTitle() {
let totalMoney = this.routeQuery.multiMerchantsFlag
? this.routeQuery.totalMoney
: this.totalMoney;
let totalMoney = 0;
if (this.routeQuery.multiMerchantsFlag) {
totalMoney = this.routeQuery.totalMoney;
} else if (this.routeQuery.accountBalanceFlag) {
totalMoney = this.routeQuery.totalMoney;
} else {
totalMoney = this.totalMoney;
}
console.log(totalMoney,'--totalMoney')
let subTitle = this.datas.componentData["subTitle"];
let replaceList = [
{
......@@ -221,7 +241,10 @@ export default {
if (!this.render) return;
console.log("查看详情");
let h5Url = this.routeQuery.multiMerchantsFlag == 1 ? encodeURIComponent(`/order/orderList`) : encodeURIComponent(`/order/orderDetail?orderSn=${this.orderSn}&isReplace=true`);
let url = `/pages/index/main?from=home&backpath=${h5Url}}`
if (this.routeQuery.accountBalanceFlag) {
h5Url = encodeURIComponent(`/accountBalance/list`);
}
let url = `/pages/index/main?from=home&backpath=${h5Url}`
wx.redirectTo({
url,
});
......@@ -393,7 +416,7 @@ export default {
font-size: 14px;
span {
font-size: 18px;
color: var(--minor-color);
color: #666;
}
}
.price {
......@@ -410,6 +433,16 @@ export default {
color: var(--minor-color);
}
}
.balance{
display: flex;
align-items: center;
justify-content: center;
color: #666;
font-size: 14px;
&-line{
padding: 0 10px;
}
}
.bottom {
margin-top: 10px;
justify-content: space-between;
......
......@@ -66,6 +66,8 @@
:totalMoney="totalMoney"
:whetherOpenEnterprisesWantGoods="whetherOpenEnterprisesWantGoods"
:whetherOpenApproval="whetherOpenApproval"
:balanceRewardsPoints="balanceRewardsPoints"
:balanceRewardsPrice="balanceRewardsPrice"
/>
<payWithGifts
v-if="item.componentCode=='pay-with-gifts' && item.componentInfo.visible==1"
......@@ -104,6 +106,7 @@
<script type="text/ecmascript-6">
import shop from "@/api/shop";
import order from "@/api/order";
import wxPay from "@/api/wxPay";
import promote from "@/api/promote";
import spokesman from "@/api/spokesman";
import { getMiniProgram, query_isEntry } from "@/utils/mayi_fenxiao";
......@@ -157,6 +160,8 @@ export default {
'--main-color':"",
'--minor-color':"",
},
balanceRewardsPrice: 0,
balanceRewardsPoints: 0,
};
},
components: {
......@@ -194,7 +199,8 @@ export default {
this.orderMsg();
}
this.setGiftsKey(); //设置码表
this.getIsReceiveGift()
this.getIsReceiveGift();
this.getBalanceDetail();
// 获取页面数据
if (this.mpApp.globalData.pageList) {
console.log(
......@@ -231,6 +237,18 @@ export default {
this.scrolls(el[0])
},200),
methods: {
async getBalanceDetail() {
if (!this.routeQuery.accountBalanceFlag) return;
let query = {
rechargeOrderSn: this.routeQuery.orderSn
}
let res1 = await wxPay.getGiftRechargeOrderQuery(query);
let res = res1.data;
if (res.ok) {
this.balanceRewardsPrice = Number(res.data.cashback);
this.balanceRewardsPoints = Number(res.data.points);
}
},
scrolls(el){
// this.setFooterShow(el);
if (this.pageData) {
......@@ -335,6 +353,7 @@ export default {
console.log(Number(res.data.totalAmountPayable).toFixed(2),'--Number(res.data.totalAmountPayable).toFixed(2)')
this.inviteelShow = true;
}else {
this.showPage = true;
this.inviteelShow = true;
}
});
......
......@@ -57,6 +57,7 @@ export default {
this.options = JSON.parse(options.ordercode);
options.scene && (this.scene = options.scene);
options.backUrl && (this.backUrl = options.backUrl);
this.totalMoney = Number( JSON.parse(options.ordercode).totalAmount).toFixed(2);
}
this.options_orderType = options.orderType;
......@@ -84,7 +85,20 @@ export default {
});
},
methods: {
testToPaySuccess() {
let _this = this;
let params = `?orderSn=${_this.options.orderSn}`;
if (_this.options.accountBalanceFlag == 1) {
// 余额充值
params+= `&accountBalanceFlag=1&totalMoney=${_this.totalMoney}`
}
wx.redirectTo({
url: `/pages/paySuccess/main${params}`,
});
},
toPay() {
// this.testToPaySuccess();
// return;
wxPay
.to_wx_pay(this.options)
.then((res) => {
......@@ -170,9 +184,13 @@ export default {
}, 500);
return;
}
let params = `?orderSn=${_this.options.orderSn}`;
if (_this.options.accountBalanceFlag == 1) {
// 余额充值
params+= `&accountBalanceFlag=1&totalMoney=${_this.totalMoney}`
}
wx.redirectTo({
url: `/pages/paySuccess/main?orderSn=${_this.options.orderSn}`,
url: `/pages/paySuccess/main${params}`,
});
} else {
let query = {
......
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