Commit 502425a6 authored by pengguangpu's avatar pengguangpu

完善退款逻辑;

parent 12f5b17b
{
"pages": [
"pages/functioncenter/functioncenter",
"pages/pay_result/pay_result",
"pages/functioncenter/functioncenter",
"pages/login/login",
"pages/logs/logs",
"pages/refund/refund",
......
......@@ -14,13 +14,23 @@ Page({
//是否退款or支付成功
isSuccess:false,
isShowBackHome:false,
failedReason:""
failedReason:"",
//是否需要倒计时
isNeedCountDown:false,
//金额显示
isShowPrice:false,
isShowFailedReason:true
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
//just for test,delete this code
// options.type = 1
// options.isSuccess = false
var payPriceYuan = options.payPriceYuan
var description = options.description
this.setData({
......@@ -29,17 +39,40 @@ Page({
failedReason:options.failedReason
})
if(options.isSuccess==false){
this.setData({
isNeedCountDown:false
})
if(options.type==1){
//退款结果
//退款失败
this.setData({
isSuccess:false,
isShowBackHome:true,
iconUrl:"../../images/icon_fail.png"
iconUrl:"../../images/icon_fail.png",
description:"退款失败",
failedReason:options.failedReason,
isShowFailedReason:true
})
}else{
//支付结果
}
}else{
this.setData({
isNeedCountDown:true
})
if(options.type==1){
//退款结果
//退款成功
this.setData({
isSuccess:true,
isShowBackHome:true,
iconUrl:"../../images/icon_success.png",
description:"退款成功",
isShowFailedReason:false,
isShowPrice:true
})
}else{
//支付结果
}
}
......@@ -47,7 +80,9 @@ Page({
onShow:function(){
//回到首页倒计时
this.startPayCountDown();
if(this.data.isNeedCountDown==true){
this.startPayCountDown()
}
},
/**
......
<view class="page">
<image class="icon-success" src="{{iconUrl}}"/>
<view class="description">{{description}}</view>
<view class="price">¥{{payPriceYuan}}</view>
<view class="btn-go-home"><button type="default" bindtap="backHome" hidden="{{!isShowBackHome}}">回到首页</button>
<view class="price" hidden="{{!isShowPrice}}">¥{{payPriceYuan}}</view>
<!--失败原因-->
<view style="width:100%;display:flex;align-items:center;margin-top:40rpx;" hidden="{{!isShowFailedReason}}">
<text style="width:100%;padding-left:160rpx;padding-right:160rpx;font-size:32rpx;color:#788192;text-align:center;align-self:center;" hidden="{{!isShowFailedReason}}">失败原因:--------</text>
</view>
<!--重新退款-->
<view style="margin-top:120rpx;" hidden="{{!isShowFailedReason}}">
<text class="btn-re-refund">重新退款</text>
</view>
<view class="btn-go-home"><button style="width:572rpx;height:114rpx;display:flex; justify-content:center; align-items:center;font-size:40rpx;" type="default" bindtap="backHome" hidden="{{!isShowBackHome}}">回到首页</button>
</view>
<view class="count-down">{{goHomeCountDown}}</view>
<view class="count-down" hidden="{{!isNeedCountDown}}">{{goHomeCountDown}}</view>
</view>
\ No newline at end of file
......@@ -23,9 +23,10 @@
}
.btn-go-home{
width: 70%;
height: 115rpx;
margin-top: 120rpx;
width: 573rpx;
height: 114rpx;
margin-top: 40rpx;
font-size:40rpx;
}
.count-down{
......@@ -33,3 +34,19 @@
color: #788192;
margin-top: 290rpx;
}
.btn-re-refund{
margin-top: 120rpx;
display: flex;
height: 114rpx;
width: 573rpx;
color: var(--main-color);
font-size: 40rpx;
align-items: center;
justify-content: center;
margin: auto;
border-color:var(--main-color);
border-radius: 10rpx;
border-width: 2rpx;
border:2rpx solid var(--main-color);
}
\ No newline at end of file
......@@ -11,6 +11,7 @@ Page({
marketId: "",
posId: "",
cashierCode: "",
// 支付平台地址
baseUrl: null,
signKey: "",
apiVersion:""
......@@ -54,8 +55,6 @@ Page({
*/
initData(){
this.data.baseUrl = getApp().globalData.BASE_URL;
var localAccountInfo = getApp().globalData.localAccountInfo;
console.info("localAccountInfo==>" + JSON.stringify(localAccountInfo));
if (localAccountInfo.success == true && localAccountInfo.data != null) {
......@@ -97,14 +96,15 @@ Page({
callback: (response) => {
if (response.code == 0) {
//跳转页面
var payPriceYuan = miyapay.fen2Yuan(response.data.C7)
wx.navigateTo({
url: 'pages/pay_result/pay_result?isSuccess=true&payPriceYuan='+payPriceYuan,
})
} else {
//提示报错
my.showToast({
type: 'fail',
content: response.data,
duration: 3000
});
wx.navigateTo({
url: 'pages/pay_result/pay_result?isSuccess=false&failedReason='+response.data,
})
}
}
});
......
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