// pages/tabber/news/index.js const app = getApp() Page({ /** * 页面的初始数据 */ data: { selectInfo: {}, orderSn: '', checked: false, show: false, option1: [ { text: '签收身份', value: 0 }, { text: '物流员', value: 1 }, { text: '代收点', value: 2 }, ], city: [ { text: '城市', value: 'a' }, { text: '北京', value: 'b' }, { text: '武汉', value: 'c' }, ], columns: [ { text: '网点', value: 'a' }, { text: '好评排序', value: 'b' }, { text: '销量排序', value: 'c' }, ], value1:1, value2: 'a', value3: 'a', network:0, admin_type:1, networker_id:0, }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { class Select { in = 1 getSelet() { console.log(2); return 10 } } var b = new Select(); console.log(b.getSelet()); this.getcityoth() }, Change(event) { const { picker, value, index } = event.detail; this.setData({ admin_type: event.detail, }) }, Change2(event) { const { picker, value, index } = event.detail; this.setData({ admin_type: event.detail, }) }, Change3(event) { const { picker, value, index } = event.detail; this.setData({ networker_id: event.detail, }) }, show() { this.setData({ show: !this.data.show }) }, onClose() { this.setData({ show: !this.data.show }) }, //h获取顶部 城市身份等信息 getcityoth() { var that = this app.api.useApi(app.globalData.baseAppUrl + "api/admin/ProvinceShop", { }, "get").then(function (res) { if (res.code != 200) { wx.showLoading({ title: res.message.msg, }) setTimeout(function () { wx.hideLoading(); }, 1000); } else { wx.hideLoading(); var data = res.message.data console.log(data) var city = []; var columns ={}; for (var i=0;i { console.log(res); this.setData({ selectInfo: res }) }) query.exec() }, getData: function () { var that = this app.api.useApi(app.globalData.baseAppUrl + "api/admin/FactoryList", { device_id: deviceId, spout_device_id: spoutDeviceId }, "get").then(function (res) { console.log(res); if (res.code != 200) { wx.showLoading({ title: res.message.msg, }) setTimeout(function () { wx.hideLoading(); }, 1000); } else { wx.hideLoading(); var FactoryList = res.message.data.list for (var i in FactoryList) { that.data.factoryName.push(FactoryList[i].external_title) that.data.factoryId.push(FactoryList[i].id) } console.log(that.data.factoryName) that.setData({ factoryName: that.data.factoryName, factoryId: that.data.factoryId, num, content: res.message.data.group }) } }).catch(function (err) { console.log(222); }) }, saoma: function () { var that = this wx.scanCode({ onlyFromCamera: true, success(res) { that.setData({ orderSn: res.result }) that.onSubmit() } }) }, onSubmit: function () { var that = this if (that.data.orderSn == '') return wx.showToast({ title: '物流号不能为空', icon: 'none' }) app.api.useApi(app.globalData.baseAppUrl + "api/admin/CodeSign", { order_no: that.data.orderSn, admin_type:that.data.admin_type,//1物流员;2代收点 networker_id:that.data.networker_id, }, "post").then(function (res) { wx.hideLoading(); if (res.code == 200) wx.showToast({ title: res.message.msg, icon: 'none' }) else wx.showModal({ title: '异常', content: res.message.msg, showCancel: false, success(res) { if (res.confirm) { console.log('用户点击确定') } else if (res.cancel) { console.log('用户点击取消') } } }) if (that.data.checked) that.saoma() }).catch(function (err) { console.log(222); }) }, switchChange: function (e) { console.log(e) this.setData({ checked: e.detail.value }) } })