收藏
回答

为什么我bindtap一次触发两次 上代码


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'

})

}

})

}


回答关注问题邀请回答
收藏

3 个回答

  • Runner
    Runner
    2017-12-11

    catchtap 也一样的 点一下触发两次    改成bindtouchend  只触发一次 可以了


    2017-12-11
    有用
    回复
  • 壮壮
    壮壮
    2017-12-11

    wxml代码再多帖一点,从js里看不出啥异常呢

    2017-12-11
    有用
    回复
  • 西赛德李
    西赛德李
    2017-12-11

    把 bindtap 改成 catchtap 试试看

    2017-12-11
    有用
    回复
登录 后发表内容