Commit 12f5b17b authored by pengguangpu's avatar pengguangpu

完善退款逻辑;

parent e48f8025
{
"pages": [
"pages/login/login",
"pages/functioncenter/functioncenter",
"pages/pay_result/pay_result",
"pages/login/login",
"pages/logs/logs",
"pages/functioncenter/functioncenter",
"pages/refund/refund",
"pages/balance/balance",
"pages/operation_waiting/operation_waiting",
......
......@@ -5,7 +5,8 @@ Page({
* 页面的初始数据
*/
data: {
aboutSysDialogShow:false,
aboutSysDialogButtons:[{text:'确定'}]
},
/**
......@@ -75,7 +76,15 @@ Page({
},
onAboutSysClicked:function(){
this.setData({
aboutSysDialogShow:true
})
},
onAboutSysDialogClicked:function(e){
this.setData({
aboutSysDialogShow:false
})
},
onCloseClicked:function(){
......
{
"usingComponents": {}
"usingComponents": {
"mp-dialog": "/miniprogram_npm/weui-miniprogram/dialog/dialog"
}
}
\ No newline at end of file
......@@ -36,9 +36,46 @@
<!--line-->
<view class="line"/>
<!--出登录-->
<!--退出登录-->
<view class="logout_layout">
<text class="btn-submit" bindtap="onLogoutClicked">退出登录</text>
</view>
</view>
<!--dialog-->
<mp-dialog title="关于系统" show="{{aboutSysDialogShow}}" buttons="{{aboutSysDialogButtons}}" bindbuttontap="onAboutSysDialogClicked">
<view class="about_sys_dialog">
<view style="display:flex;direction:row;width:100%;margin-top:40rpx;">
<text style="color:#788192;">商户</text>
<text style="flex:1;text-align:right;color:black;">--------</text>
</view>
<view style="display:flex;direction:row;width:100%;margin-top:20rpx;">
<text style="color:#788192;">门店</text>
<text style="flex:1;text-align:right;color:black;">--------</text>
</view>
<view style="display:flex;direction:row;width:100%;margin-top:20rpx;">
<text style="color:#788192;">门店号</text>
<text style="flex:1;text-align:right;color:black;">--------</text>
</view>
<view style="display:flex;direction:row;width:100%;margin-top:20rpx;">
<text style="color:#788192;">SN码</text>
<text style="flex:1;text-align:right;color:black;">--------</text>
</view>
<view style="display:flex;direction:row;width:100%;margin-top:20rpx;">
<text style="color:#788192;">小程序</text>
<text style="flex:1;text-align:right;color:black;">--------</text>
</view>
<view style="display:flex;direction:row;width:100%;margin-top:20rpx;">
<text style="color:#788192;">版本号</text>
<text style="flex:1;text-align:right;color:black;">--------</text>
</view>
</view>
</mp-dialog>
</view>
......@@ -59,3 +59,7 @@
border-width: 2rpx;
border:2rpx solid var(--main-color);
}
.about_sys_dialog{
}
\ No newline at end of file
......@@ -4,10 +4,17 @@ Page({
* 页面的初始数据
*/
data: {
iconUrl:"../../images/icon_success.png",
payPriceYuan:"0.00",
description:"支付成功",
goHomeCountDown:"3秒后跳转到首页",
payCountDownTimer:null,
//type==> 0:支付结果 1:退款结果 默认为0
type:0,
//是否退款or支付成功
isSuccess:false,
isShowBackHome:false,
failedReason:""
},
/**
......@@ -18,8 +25,23 @@ Page({
var description = options.description
this.setData({
payPriceYuan:payPriceYuan,
description:description
description:description,
failedReason:options.failedReason
})
if(options.isSuccess==false){
if(options.type==1){
//退款结果
this.setData({
isShowBackHome:true,
iconUrl:"../../images/icon_fail.png"
})
}
}else{
if(options.type==1){
//退款结果
}
}
},
......
<view class="page">
<image class="icon-success" src="../../images/icon_success.png"/>
<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" >回到首页</button>
<view class="btn-go-home"><button type="default" bindtap="backHome" hidden="{{!isShowBackHome}}">回到首页</button>
</view>
<view class="count-down">{{goHomeCountDown}}</view>
</view>
\ No newline at end of file
// pages/refund/refund.js
var miyapay = require("../../utils/miyapay4.js");
Page({
/**
* 页面的初始数据
*/
data: {
saasid: "",
marketId: "",
posId: "",
cashierCode: "",
baseUrl: null,
signKey: "",
apiVersion:""
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.initData()
},
/**
......@@ -26,6 +34,80 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow: function () {
//声明监听扫码器
wxfaceapp.listenCodePayment({
success(res){
//被扫码回调事件
wxfaceapp.onCodePayEvent(function (res) {
console.log("onCodePayEvent retCode = " + res.replyCode)
//被扫码到的具体的码
console.log("onCodePayEvent code scanned = " + res.code)
//去退款
startRefund(res.code)
})
}
})
},
/**
* 初始化数据
*/
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) {
this.data.saasid = localAccountInfo.data.store.saasid;
if (localAccountInfo.data.store.marketid != null) {
this.data.marketId = localAccountInfo.data.store.marketid;
} else {
this.data.marketId = localAccountInfo.data.store.storeId;
}
this.data.posId = localAccountInfo.data.store.posId;
this.data.cashierCode = localAccountInfo.data.store.operatorId;
this.data.signKey = localAccountInfo.data.store.miyaPayPlatformSignKey;
this.data.baseUrl = localAccountInfo.data.store.miyaPayPlatformUrl + "";
this.data.apiVersion = localAccountInfo.data.store.miyaPayApiVersion;
if (getApp().globalData.useTestPayInfo == true) {
//just for test
this.data.signKey = "nbz9ww27sx4ou6dkr61mf63tth3s6e2d";
this.data.saasid = "miya";
this.data.marketId = "slzf";
this.data.posId = "1";
this.data.cashierCode = "1";
this.data.baseUrl = "https://paytest.miyapay.com/miya/miyapay_response.action";
}
}
},
startRefund:function(orderNo){
miyapay.refund({
baseUrl: this.data.baseUrl,
saasid: this.data.saasid,
marketId: this.data.marketId,
posId: this.data.posId,
cashierCode: this.data.cashierCode,
version: this.data.apiVersion,
orderNo: this.data.orderNo,
refundNo: this.data.refundNo,
refundPrice: this.data.refundPriceFen + "",
signKey: this.data.signKey,
callback: (response) => {
if (response.code == 0) {
//跳转页面
} else {
//提示报错
my.showToast({
type: 'fail',
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