Commit 40a249a6 by jscat

nyx weapp: 功能优化

1. 解决订单页面(order.wxml) 订单重复提交问题(onPay)
parent 2b343df4
// pages/my/my-orders/my-orders.js // pages/my/my-orders/my-orders.js
...@@ -27,6 +27,9 @@ Page({ ...@@ -27,6 +27,9 @@ Page({
// 消息提示框的遮罩层 // 消息提示框的遮罩层
showToast: false, showToast: false,
// 支付按钮可用状态
canClick: true,
}, },
/** /**
...@@ -358,6 +361,10 @@ Page({ ...@@ -358,6 +361,10 @@ Page({
var strUrl = config.order_add_url var strUrl = config.order_add_url
config.debug == 1?console.log("===uploadOrder strUrl "+strUrl):"" config.debug == 1?console.log("===uploadOrder strUrl "+strUrl):""
//先设置支付按钮不可点击
var canClick = false;
_this .setData({ canClick })
// 订单处理, 添加到订单项的条件 // 订单处理, 添加到订单项的条件
// 1. 商品中某一类别的quantity>=1, // 1. 商品中某一类别的quantity>=1,
// 2. defaultStatus==1 // 2. defaultStatus==1
...@@ -392,11 +399,34 @@ Page({ ...@@ -392,11 +399,34 @@ Page({
//表示提交成功 //表示提交成功
console.log("===订单上传成功"); console.log("===订单上传成功");
//重置数据 //重置数据
//设置支付按钮可点击
var canClick = true;
_this .setData({ canClick })
//回到首页 //回到首页
_this.toHome(); _this.toHome();
} }
else if(res.data.resultCode == '000601')
{
//表示重复提交
console.log("===订单重复提交触发");
//重置数据
//设置支付按钮可点击
var canClick = true;
var showToast = true;
_this.setData({ canClick, showToast })
wx.showToast({
icon: 'none',
title: '重复提交, 请3分钟后再试',
duration: 3000,
success: function(){
setTimeout(function(){
var showToast = false
_this.setData({ showToast })
}, 3000)
}
})
}
} }
}) })
......
<view class="page"> <view class="page">
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
<text style="color:#FF6600">¥{{totalPrice}}</text> <text style="color:#FF6600">¥{{totalPrice}}</text>
</view> </view>
<view style="width:200rpx"> <view style="width:200rpx">
<button class="button-red" bindtap="toPay">确定({{totalCount}})</button> <button class="button-red" disabled="{{!canClick}}" bindtap="toPay">确定({{totalCount}})</button>
</view> </view>
</view> </view>
</view> </view>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论