diff --git a/pages/order-list/index.js b/pages/order-list/index.js index 93291167..f429be97 100644 --- a/pages/order-list/index.js +++ b/pages/order-list/index.js @@ -59,6 +59,35 @@ Page({ // 生命周期函数--监听页面初次渲染完成 }, + getOrderStatistics : function () { + var that = this; + wx.request({ + url: 'https://api.it120.cc/' + app.globalData.subDomain + '/order/statistics', + data: { token: app.globalData.token }, + success: (res) => { + wx.hideLoading(); + if (res.data.code == 0) { + var tabClass = that.data.tabClass; + if (res.data.data.count_id_no_pay > 0) { + tabClass[1] = "red-dot" + } + if (res.data.data.count_id_no_transfer > 0) { + tabClass[2] = "red-dot" + } + if (res.data.data.count_id_no_confirm > 0) { + tabClass[3] = "red-dot" + } + if (res.data.data.count_id_success > 0) { + tabClass[4] = "red-dot" + } + + that.setData({ + tabClass: tabClass, + }); + } + } + }) + }, onShow:function(){ // 获取订单列表 wx.showLoading(); @@ -78,32 +107,14 @@ Page({ if (that.data.currentTpye == 4) { postData.status = 4 } + this.getOrderStatistics(); wx.request({ url: 'https://api.it120.cc/' + app.globalData.subDomain + '/order/list', data: postData, success: (res) => { wx.hideLoading(); if (res.data.code == 0) { - var tabClass = that.data.tabClass; - if (that.data.currentTpye == 0) { - for (var i = 0; i < res.data.data.orderList.length; i++) { - var order = res.data.data.orderList[i] - if (order.status == 0) { - tabClass[1] = "red-dot" - } - if (order.status == 1) { - tabClass[2] = "red-dot" - } - if (order.status == 2) { - tabClass[3] = "red-dot" - } - if (order.status == 4) { - tabClass[4] = "red-dot" - } - } - } that.setData({ - tabClass: tabClass, orderList: res.data.data.orderList, logisticsMap : res.data.data.logisticsMap, goodsMap : res.data.data.goodsMap diff --git a/pages/to-pay-order/index.js b/pages/to-pay-order/index.js index 3ff5f185..e53be1a5 100644 --- a/pages/to-pay-order/index.js +++ b/pages/to-pay-order/index.js @@ -74,7 +74,9 @@ Page({ } postData.provinceId = that.data.curAddressData.provinceId; postData.cityId = that.data.curAddressData.cityId; - postData.districtId = that.data.curAddressData.districtId; + if (that.data.curAddressData.districtId) { + postData.districtId = that.data.curAddressData.districtId; + } postData.address = that.data.curAddressData.address; postData.linkMan = that.data.curAddressData.linkMan; postData.mobile = that.data.curAddressData.mobile;