为什么我bindtap一次触发两次 上代码
发布于 5 年前 作者 junpan 5420 次浏览 来自 问答

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’

})

}

})

}

回到顶部