Commit 4f572433 authored by gaodapeng's avatar gaodapeng

增加退款的逻辑

parent 55845311
......@@ -36,3 +36,21 @@ export const ACTION_DIRECT_PAYMENT = "ACTION_DIRECT_PAYMENT";
//兑换券
export const ACTION_CONVERT_COUPON = "ACTION_CONVERT_COUPON";
//退款操作
export const ACTION_REFUND = "ACTION_REFUND";
//退款成功
export const ACTION_REFUND_SUCCESS = "ACTION_REFUND_SUCCESS";
//退款失败
export const ACTION_REFUND_FAILED = "ACTION_REFUND_FAILED";
const FLOW_IDLE = "idle";
const FLOW_COLLECTIONS = "collections";
const FLOW_REFUND = "refund";
export {
FLOW_IDLE,FLOW_COLLECTIONS,FLOW_REFUND
}
......@@ -29,6 +29,8 @@ Component({
scenes: nextProps.scene,
});
console.log("scenes:"+this.data.scenes);
},
methods: {
......
......@@ -723,4 +723,102 @@
color:rgba(91,105,129,1);
line-height:22rpx;
margin-top: 15rpx
}
\ No newline at end of file
}
/* 操作结果页面 */
.operateTopView{
position: relative;
width: 750rpx;
height: 60rpx;
background: rgba(255, 255, 255, 1);
/* border: 2px solid red; */
box-shadow: 0rpx 2rpx 7rpx 0rpx rgba(153, 153, 153, 0.16);
}
.operateBodyView{
position: relative;
display: flex;
flex-direction: column;
align-items: center;
width: 750rpx;
height: 364rpx;
background: #ffffff;
}
.operateResultIcon{
position: relative;
width: 84rpx;
height: 84rpx;
margin-top: 35rpx;
}
.operateResultText{
font-size:26rpx;
font-family:PingFangSC-Medium,PingFang SC;
font-weight:500;
color:rgba(0,122,255,1);
line-height:26rpx;
margin-top: 23rpx;
}
.operateResultDesc{
font-size:21rpx;
font-family:PingFangSC-Regular,PingFang SC;
font-weight:400;
color:rgba(91,105,129,1);
line-height:21rpx;
margin-top: 19rpx;
}
.operateResultBtnContainer{
width: auto;
height: auto;
display: flex;
flex-direction: row;
margin-top: 54rpx;
}
.operateResultConfirmBtn{
width:246rpx;
height:59rpx;
background:rgba(0,122,255,1);
border-radius:5rpx;
border:1rpx solid rgba(151,151,151,1);
flex-direction: row;
display: flex;
align-items: center;
}
.operateResultConfirmBtnText{
font-size:23rpx;
font-family:PingFangSC-Medium,PingFang SC;
font-weight:500;
color:rgba(255,255,255,1);
line-height:33rpx;
text-align: center;
width: 100%;
height: auto;
}
.operateResultCloseBtn{
width:246rpx;
height:59rpx;
background:rgba(255,255,255,1);
border-radius:5rpx;
border:1rpx solid rgba(0,122,255,1);
flex-direction: row;
display: flex;
margin-right:35rpx;
align-items: center;
}
.operateResultCloseBtnText{
font-size:23rpx;
font-family:PingFangSC-Medium,PingFang SC;
font-weight:500;
color:rgba(0,122,255,1);
line-height:33rpx;
text-align: center;
width: 100%;
height: auto;
}
......@@ -283,4 +283,38 @@
<!-- 键盘 -->
<land-keybord scene="{{scene}}" onKeyBordFinished="onKeyBordFinished" onKeyBordClose="onKeyBordClose">
</land-keybord>
<!-- 操作结果页 -->
<view hidden="{{!pageShow['operateResult']}}">
<view class="operateTopView"></view>
<view class="operateBodyView">
<block a:if="{{operateSuccess}}">
<image class="operateResultIcon" mode="aspectFit" src="/images/icon_success.png"/>
<view class="operateResultText">{{operateSuccessRemind}}</view>
<view class="operateResultDesc">{{operateSuccessDesc}}</view>
<view class="operateResultBtnContainer">
<view class="operateResultConfirmBtn">
<view class="operateResultConfirmBtnText">确定</view>
</view>
</view>
</block>
<block a:else>
<image class="operateResultIcon" mode="aspectFit" src="/images/icon_failed.png"/>
<view class="operateResultText">{{operateFailedRemind}}</view>
<view class="operateResultDesc">{{operateFailedDesc}}</view>
<view class="operateResultBtnContainer">
<view class="operateResultCloseBtn">
<view class="operateResultCloseBtnText">关闭</view>
</view>
<view class="operateResultConfirmBtn">
<view class="operateResultConfirmBtnText">重新退款</view>
</view>
</view>
</block>
</view>
</view>
</view>
\ No newline at end of file
......@@ -12,8 +12,11 @@ import { ACTION_GO_HOME } from '../../const/actioncmd'
import { ACTION_GET_ACCOUNT } from '../../const/actioncmd'
import { ACTION_DIRECT_PAYMENT } from '../../const/actioncmd'
import { ACTION_CONVERT_COUPON } from '../../const/actioncmd'
import { ACTION_REFUND } from '../../const/actioncmd'
import { ACTION_REFUND_SUCCESS } from '../../const/actioncmd'
import { ACTION_REFUND_FAILED } from '../../const/actioncmd'
import { FLOW_IDLE, FLOW_COLLECTIONS, FLOW_REFUND} from '../../const/actioncmd'
Page({
data: {
//页面控制相关参数
......@@ -21,8 +24,10 @@ Page({
"home": true,
"landscan": false,
"waitoperate": false,
"payresult": false
"payresult": false,
"operateResult":false
},
flowType:"", //流程类型:用于区分易混淆的流程,以及共同界面使用时用该标识位作为区分
storeName: "--",
/**支付结果页相关参数 */
payFailedReason: "xxxxxxxxxxx",
......@@ -52,7 +57,12 @@ Page({
//折扣
totalDisc: 0.00,
goods: [
]
],
operateSuccess:false,
operateSuccessRemind:"退款成功",
operateSuccessDesc:"退款完成!会在1~2个工作日返还到付款账户",
operateFailedRemind:"退款失败",
operateFailedDesc:"核销失败!无效的订单码",
},
/**跳转页面方法 */
......@@ -61,7 +71,8 @@ Page({
"home": false,
"landscan": false,
"waitoperate": false,
"payresult": false
"payresult": false,
"operateResult":false,
};
//遍历pageShow
for (var key in pageShowTemp) {
......@@ -120,6 +131,9 @@ Page({
});
//跳首页
context.goPage('home');
setData({
flowType: FLOW_IDLE,
})
} else if (res.action == ACTION_GOODS) {
//商品信息同步
my.hideLoading();
......@@ -172,6 +186,16 @@ Page({
if(null != res.data.msg){
context.setData({convertCouponMsg:res.data.msg})
}
} else if(res.action == ACTION_REFUND_SUCCESS){
//跳转到成功页面
context.goPage('operateResult');
} else if(res.action == ACTION_REFUND_FAILED) {
context.setData({
isPaySuccess: false,
});
context.goPage('operateResult');
}
}
......@@ -247,7 +271,11 @@ Page({
* 退款
*/
onHomeRefundClicked() {
this.setData({
flowType :FLOW_REFUND,
scene:4
})
console.log("scene:"+this.data.scene)
},
/**
......@@ -343,9 +371,11 @@ Page({
target: getApp().globalData.frontScreenAppId,
data: commonRequest,
success: (res) => {
flowType = FLOW_COLLECTIONS;
console.log("发送收银事件到前屏小程序 成功 ===》" + JSON.stringify(res));
},
fail: (res) => {
flowType = FLOW_IDLE;
console.log("发送收银事件到前屏小程序 失败 ===》 " + JSON.stringify(res));
//发送失败重试
// context.sendGoToCollections();
......@@ -381,7 +411,6 @@ Page({
});
},
/**landscan页面逻辑方法 */
//把所有的商品数据发送到后屏
sendGoodInfoToFront() {
......@@ -411,7 +440,10 @@ Page({
this.sendPaymentToFront(result)
}else if(this.data.scene == 1){
this.sendGoodsInfoToFront(result)
}
}else if(this.data.scene ==4){
this.sendRefund(result);
return;
}
this.onKeyBordClose();
},
......@@ -615,5 +647,32 @@ Page({
//使用券
useCoupon(e) {
this.setData({ couponUseing: true })
},
//发送退款金额.以分为单位
sendRefund(amount){
var miyapay = require("/utils/miyapay4.js");
var refundAmount = miyapay.yuan2Fen(amount);
console.log("amount"+refundAmount);
my.ix.sendBuddyMessage({
target: getApp().globalData.frontScreenAppId,
data:{
action: ACTION_REFUND,
data: refundAmount
},
success:(res)=>{
//成功发送则
console.log("发送退款金额到前屏小程序成功 ===》" + JSON.stringify(res));
},
fail:(res)=>{
my.showToast({
type: 'fail',
content: '发送退款金额到前屏失败',
duration: 3000,
success: () => {
},
});
}
})
}
});
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