// pages/order/user/list/list.js var app = getApp(); Page({ /** * 页面的初始数据 */ data: { statusUserList: [{ id: '', name: "全部" }, { id: 0, name: "待审核" }, { id: 1, name: "已审核" }, { id: 2, name: "审核终止" }, { id: 3, name: "已发货" }, { id: 4, name: "已签收" }, { id: 5, name: "已取消" }, ], statusAdminList: [{ id: '', name: "全部" }, { id: 0, name: "待审核" }, { id: 1, name: "审核通过" }, { id: 2, name: "已终止" }, { id: 3, name: "超时自动取消" }, { id: 4, name: "人工取消" } ], queryList: [{ column: "orderNumber", name: "订单编号", text: "请输入订单编号" }, { column: "dvyFlowId", name: "快递单号", text: "请输入快递单号" }, { column: "prodName", name: "商品名称", text: "请输入商品名称" }, { column: "createTime", name: "下单时间", text: "开始日期 - 结束日期", type: 1 }, ], valueText: "", queryIndex: 3, queryShow: false, skuCode: "", //商品编码SKU status: 0, //订单状态 orderNumber: "", //订单编号 dvyFlowId: "", //快递单号 prodName: "", //商品名称 createTimeEnd: "", createTimeStart: "", current: 0, orderList: [], current: 0, pages: null, loading: true, pageHide: false }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { this.setData({ status: options.status != '' && options.status != null && options.status != undefined ? Number(options.status) + 1 : 0 }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ async onShow() { // if (this.data.pageHide) { // return; // } this.setData({ current: 0, orderList: [], pages: null }); if (!wx.getStorageSync('userInfo')) { return; } await this.initData(); this.setData({ loading: false }) }, async initData(d) { let userInfo = wx.getStorageSync('userInfo'); this.setData({ current: this.data.current + 1, loadding: true }); let { data } = await app.ajax.get({ url: `/admin/bxdorder/queryPage`, data: { orderSaleId: wx.getStorageSync('userInfo').roleType === "0" ? '' : userInfo.userId, status: this.data.statusUserList[this.data.status].id, orderNumber: this.data.orderNumber, createTimeEnd: this.data.createTimeEnd ? this.data.createTimeEnd + ' 23:59:59' : '', createTimeStart: this.data.createTimeStart ? this.data.createTimeStart + ' 00:00:00' : '', dvyFlowId: this.data.dvyFlowId, current: d && d.current != undefined ? d.current : this.data.current, size: 20, } }); this.setData({ current: this.data.current, orderList: this.data.orderList.concat(data.data.records), pages: data.data.pages || null, loadding: false }) // admin/bxdorder/query?activityImgs=&companyId=56&companyName=HZRCS&createTime=¤t=1&desc=create_time&mobile=&orderorderNumber=&orderNumber=&orderSaleName&receiverName=&size=10&status= }, async queryData(e) { this.setData({ orderList: [], status: 0 }) await this.initData({ current: 0 }); }, chooseQuery(e) { //console.log(e) if (this.data.queryIndex == e.currentTarget.dataset.index) { return; } if (e.currentTarget.dataset.index != undefined) { this.setData({ orderNumber: "", //订单编号 dvyFlowId: "", //快递单号 prodName: "", //商品名称 createTimeEnd: "", createTimeStart: "", valueText: "", }) } this.setData({ queryShow: !this.data.queryShow }) }, chooseQueryItem(e) { if (this.data.queryIndex == e.currentTarget.dataset.index) { return; } this.setData({ orderNumber: "", //订单编号 dvyFlowId: "", //快递单号 prodName: "", //商品名称 createTimeEnd: "", createTimeStart: "", valueText: "", }) this.setData({ queryShow: !this.data.queryShow, queryIndex: e.currentTarget.dataset.index }) }, async changeTabbar(e, a) { if (this.data.status == e.detail.index) { return; } this.setData({ orderList: [], current: 0, status: e.detail.index }) await this.initData(0); }, bindinputchange(e) { this.setData({ valueText: e.detail.value, [e.currentTarget.dataset.name]: e.detail.value }) }, bindchange1(e) { this.setData({ createTimeEnd: e.detail.value }) }, bindchange2(e) { this.setData({ createTimeStart: e.detail.value }) }, cleanDate(e) { this.setData({ orderNumber: "", //订单编号 dvyFlowId: "", //快递单号 prodName: "", //商品名称 createTimeEnd: "", createTimeStart: "", valueText: "", }) }, async approve(e) { let row = e.currentTarget.dataset.item; let that = this; wx.showModal({ // title: '提示', title: `确认取消订单${row.orderNumber}吗?`, editable: true, placeholderText: "请输入取消订单原因", complete: async (res) => { if (res.confirm) { if (!res.content) { wx.showToast({ title: '请填写取消订单原因!', icon: "none" }) return; } await app.ajax.post({ url: "/admin/bxdorder/cancel", data: { orderId: row.orderId, cancelReason: res.content, } }); setTimeout(async () => { wx.showToast({ title: '取消订单成功!', }); }, 200); that.setData({ orderList: [], current: 0, pages: null }) await that.initData(); } } }) }, copyText(e) { wx.setClipboardData({ data: e.currentTarget.dataset.ordernumber, }); }, goWuliu(e) { let item = e.currentTarget.dataset.item; wx.navigateTo({ url: `/pages/order/logistics/logistics?dvyFlowId=${item.dvyFlowId}&logisticsCode=${item.logisticsCode}&mobile=${item.mobile}`, }) }, /** * 生命周期函数--监听页面隐藏 */ onHide() { this.setData({ pageHide: true }) }, /** * 生命周期函数--监听页面卸载 */ onUnload() { this.setData({ pageHide: false }) }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom() { }, /** * 用户点击右上角分享 */ onShareAppMessage() { } })