Commit 502425a6 authored by pengguangpu's avatar pengguangpu

完善退款逻辑;

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