wxml:
<view class="tips">
<view class="font-orange bg-green" bindtap="submitList">提交订单</view>
</view>
js部分:
submitList: function (e) {
var mark = e.detail.value;
var openId = app.globalData.openId;
var orderLists = this.data.orderLists;
var storeId = wx.getStorageSync('storeId');
var orderPrice = this.data.orderPrice;
var allPrice = this.data.allPrice;
var discount = this.data.discount;
var storeInfoList = this.data.storeInfoList;
var cupNumber = this.data.cupNumber;
var activityList = storeInfoList.activityList;
var orderStr = {
"shopId": storeId,
"openid": openId,
"rtPic": allPrice,
"actualMoney": orderPrice,
"discount": discount ,
"remark": mark,
"goodsNum": cupNumber
};
var ordersList = [];
for (var i = 0; i < orderLists.length; i++) {
ordersList[i] = {
'goodsName': orderLists[i].foodName,
'goodsId': orderLists[i].foodId,
"goodsPrice": orderLists[i].foodPrice,
"goodsNumber": orderLists[i].foodQuantity,
"detailPrice": orderLists[i].foodQuantity * orderLists[i].foodPrice
}
}
var orderStrJson = JSON.stringify(orderStr);
var detailListJson = JSON.stringify(ordersList);
wx.request({
url: url,
data: {
"orderStr": orderStrJson,
"detailList": detailListJson
},
header: {
'Content-Type': 'application/json'
},
method: "GET",
dataType: "json",
success: function(res) {
console.log(res);
wx.reLaunch({
url: '/pages/order/order'
})
}
})
}
catchtap 也一样的 点一下触发两次 改成bindtouchend 只触发一次 可以了
wxml代码再多帖一点,从js里看不出啥异常呢
把 bindtap 改成 catchtap 试试看