Commit cbffddcf by 李嘉林

余额充值

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