123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248 |
- // 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<data.length;i++) {
- city[i] = { value: data[i].city_id, text: data[i].name }
- columns[data[i].city_id]= data[i].shop;
-
- }
- that.setData({
- city: city,
- columns: columns,
- network:data[0].shop,
- value2:data[0].city_id,
- value3:data[0].shop[0].value,
- networker_id:data[0].shop[0]['value']
- })
- }
- }).catch(function (err) {
- console.log(err);
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- const query = wx.createSelectorQuery()
- query.select('#nav').boundingClientRect((res) => {
- 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
- })
- console.log(res.result)
- if(res.result.slice(0,4)=='http'){
- var regstra = new RegExp('(^|&|/?)network_id=([^&|/?]*)', 'i');
- var expa = res.result.match(regstra);
- console.log(expa[2]);
- var regstrb = new RegExp('(^|&|/?)orde_num=([^&|/?]*)', 'i');
- var expb = res.result.match(regstrb);
- console.log(expb[2]);
- wx.navigateTo({
- url: '/pages/signFor/storage?networkid='+expa[2]+'&ordernum='+expb[2],
- })
- }else{
- 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
- })
- }
- })
|