| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275 | var util = require('../../../utils/util.js');var api = require('../../../config/api.js');//获取应用实例const app = getApp();Page({    data: {        order_status: '',        evaluate_status: '',        orderList: [],        page: 1,        size: 10,        totalPages:0,        tabList: ['全部', '待付款', '待发货', '待收货', '待评价', '维权'],        tabIndex: 0,        orderIds:[],        currentStoreId: ''        // markers: [{        //   iconPath: "/static/images/rider.png",        //   id: 0,        //   latitude: 31.834082,        //   longitude: 117.232939,        //   width: 40,        //   height: 40,        //   callout: {        //     content: '距离你2.77km',        //     color: '#fe7200',        //     display: 'ALWAYS',        //     padding: 10,        //     borderRadius: 30        //   }        // }]    },    toggleTab(e) {        this.setData({            tabIndex: e.currentTarget.dataset.index,            orderList: [],            page: 1,        });        this.switchOrderType(e.currentTarget.dataset.index);    },    swiperChange(e) {        this.setData({            tabIndex: e.detail.current        });        this.switchOrderType(e.detail.current);    },    onLoad: function (options) {        // 页面初始化 options为页面跳转所带来的参数        if (options.tabIndex) {            this.setData({                tabIndex: options.tabIndex            });        }    },    getOrderList() {      let that = this;      wx.showLoading({        title: '加载中...',      });        util.request(api.OrderList,            {                order_status: that.data.order_status,                evaluate_status: that.data.evaluate_status,                page: that.data.page,                size: that.data.size            }).then(function (res) {              if (res.errno === 0) {                let orderList = that.data.orderList.concat(res.data.data);                // console.log(orderList);                that.setData({                  orderList: orderList,                  totalPages: res.data.totalPages                }, () => {                  //获取待付款倒计时                  that.data.orderList.forEach((item, num) => {                    if (item.pay_status == 0 || item.pay_status == 1) {                      util.countdown(that, that.data.orderList, 'orderList', num)                    }                  })                  });                wx.hideLoading();              }        });    },  payOrder(event) {    var that=this;    if (event.target.dataset.orderBizType=='10'){      //校验获取用户id上次活体人脸核身时间是否在可调用范围内      util.request(api.CheckFaceTimeByUserId, {        userId: wx.getStorageSync('userId'),        storeId: wx.getStorageSync('storeId')      }, 'POST').then(function (checkRes) {        if (checkRes.errno === 0) {          //根据用户上次活体人脸核身时间判断出,该用户可以调起人脸接口          if (checkRes.data === true) {            //根据订单号获取是否认证成功,认证成功则调起支付,否则提示            that.checkFace(event);          } else {            //调起支付            wx.redirectTo({              url: '/pages/pay/pay?orderIds=' + event.target.dataset.orderId                + '&actualPrice=' + event.target.dataset.actualPrice + '&isMergePay=0&orderBizType10=true'//此处提交支付属于单笔支付            })          }        }      });    } else {      wx.redirectTo({        url: '/pages/pay/pay?orderIds=' + event.target.dataset.orderId          + '&actualPrice=' + event.target.dataset.actualPrice + '&isMergePay=0'//此处提交支付属于单笔支付      })    }  },   checkFace(event){    util.request(api.GetIsFaceCheckByOrderId, {      orderIds: event.target.dataset.orderId    }).then(function (res) {      if (res.errno === 0) {        if (res.data.isFaceCheck === '1') {          wx.redirectTo({            url: '/pages/pay/pay?orderIds=' + event.target.dataset.orderId              + '&actualPrice=' + event.target.dataset.actualPrice + '&isMergePay=0&orderBizType10=true'//此处提交支付属于单笔支付          })        } else {          wx.showToast({            title: '现场速递商品购买需先认证身份信息再进行支付',            icon: 'none',            duration: 4000          })        }      }    });  },  applyRefund(event) {    wx.navigateTo({      url: '/pages/ucenter/applyRefund/applyRefund?orderId=' + event.target.dataset.orderId        + '&refundMoney=' + event.target.dataset.actualPrice + '&merchOrderSn=' + event.target.dataset.merchOrderSn     })  },     againBuy(event) {      let orderId = event.target.dataset.orderId;      // let goodType = event.target.dataset.goodType;      // if (goodType!= '00'){      //   wx.showModal({      //     title: '提示信息',      //     content: '非保税仓商品不允许再来一单,需门店扫描二维码进行购买',      //     showCancel: false      //   });      //   return;      // }      util.request(api.CartAddByOrder, { orderId: orderId }).then(function (res) {        if (res.errno === 0) {          app.globalData.appCheckCart = '00';          wx.switchTab({            url: '/pages/cart/cart',          });        } else {          wx.showToast({            title: res.errmsg,            image: '/static/images/icon_error.png',            duration: 2000          });        }        });  },  againBuyDisabel(event) {    let goodsType = event.target.dataset.goodsType;    let isStore = event.target.dataset.isStore;    console.log(goodsType);    if (goodsType != '00' && isStore) {      wx.showModal({        title: '提示信息',        content: '非保税仓商品不允许再来一单,需门店扫描二维码进行购买',        showCancel: false      });    }    if (!isStore) {      wx.showModal({        title: '',        content: '该订单非当前门店订单,不允许再来一单,需切换门店进行购买',        showCancel: false      });    }  },      switchOrderType(tabIndex) {        let that = this;        if (tabIndex == 0) {            that.setData({                order_status: '',                evaluate_status: '',            });        } else if (tabIndex == 1) {            that.setData({                order_status: 0,                evaluate_status: '',            });        } else if (tabIndex == 2) {            that.setData({                order_status: 201,                evaluate_status: '',            });        } else if (tabIndex == 3) {            that.setData({              order_status: 300,                evaluate_status: 0,            });        } else if (tabIndex == 4) {          that.setData({            order_status: 301,            evaluate_status: 0,          });        } else if (tabIndex == 5) {          that.setData({            order_status: 401,            evaluate_status: 0,          });        }        that.getOrderList();    },    onReady: function () {        // 页面渲染完成    },    onShow: function () {      let that = this;      // 页面显示      if (wx.getStorageSync('userInfo') && wx.getStorageSync('token')) {        if (wx.getStorageSync('storeId')) {          util.request(api.ChooseStoreId, {            storeId: wx.getStorageSync('storeId'),            merchSn: wx.getStorageSync('merchSn'),            isRefusedLogin: wx.getStorageSync('isRefusedLogin')          }, 'POST').then(function (res) {            if (res.errno === 0) {              wx.setStorageSync('storeId', wx.getStorageSync('storeId'));              wx.setStorageSync('merchSn', wx.getStorageSync('merchSn'));            }          });          that.setData({ orderList: [] });//初始化列表          that.switchOrderType(that.data.tabIndex);          that.setData({            currentStoreId: wx.getStorageSync('storeId')          });        }      } else {        // wx.navigateTo({        //   url: '/pages/auth/btnAuth/btnAuth',        // })      }    },    onHide: function () {        // 页面隐藏    },    onUnload: function () {        // 页面关闭    },    onReachBottom() {      var that = this;      if (that.data.page <= that.data.totalPages) {        that.setData({          page: that.data.page + 1,        });        that.getOrderList();      }    },    getWuliuList(event) {      let shippingNo = event.target.dataset.shippingNo;      let shippingCode = event.target.dataset.shippingCode;      let orderId = event.target.dataset.orderId;      let goodsType = event.target.dataset.goodsType;      wx.navigateTo({        url: '/pages/ucenter/wuliu/wuliu?id=' + shippingNo + '&code=' + shippingCode + '&orderId=' + orderId + '&goodsType=' + goodsType,      });  }})
 |