123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250 |
- // pages/tabber/news/index.js
- const app=getApp();
- var id='';
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- selectInfo: {},
- nid:0,
- content:[],
- contentOne:[],
- contentTwo:[],
- contentThree:[],
- contentfour:[],
- one:'',
- two:'',
- three:'',
- four:'',
- five:'',
- six:'',
- inputValue:'',
- show:false,
- type:0,
- focus:false,
- class:'door_Collect_list',
- head_clas:[
- {title:'上门揽收',data_class:'door_Collect_list',dat:'下单时间'},
- {title:'上门送回',data_class:'door_stay_list',dat:'网点签收'},
- {title:'已揽收',data_class:'collect_list',dat:'揽收时间'},
- {title:'待送回',data_class:'stay_list',dat:'网点签收'}
- ],
- inpval:'',
- dat:''
-
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- class Select {
- in = 1
- getSelet(){
- console.log(2);
- return 10
- }
- }
- id=options&&options.id?options.id:wx.getStorageSync('nid')
- this.setData({
- nid:id
- })
- var b = new Select();
- console.log(b.getSelet());
- this.getData(this.data.class)
-
- },
- onPullDownRefresh:function(){
- this.getData(this.data.class)
- },
- openpreview(e){
- wx.previewImage({
- current: e.currentTarget.dataset.url, // 当前显示图片的http链接
- urls: e.currentTarget.dataset.urls.map(v=>{return v.thumb}) || [] // 需要预览的图片http链接列表
- })
- },
- click(e){
- var clsss=e.currentTarget.dataset.class;
- var dat=""
- var data=this.data.head_clas;
- for(var i=0; i<data.length;i++){
- if(data[i].data_class==clsss){
- dat=data[i].dat
- }
- }
- this.setData({
- class:clsss,
- dat:dat,
- inpval: ''
- })
- this.getData(clsss);
- },
- serach(e){
- this.setData({
- inpval:e.detail.value
- })
- },
- onClose(){
- this.setData({
- show:!this.data.show
- })
- },
- getData(clsss=""){
- console.log(clsss);
- var that=this
- app.api.useApi(app.globalData.baseAppUrl + "api/admin/NetworkerDetails", {
- network_id:id,
- class:this.data.class,
- key:this.data.inpval
- }, "get").then(function (res) {
- console.log(res);
- wx.hideLoading();
- if (res.code != 200) {
- wx.showLoading({
- title: res.message.msg,
- })
- setTimeout(function () {
- wx.navigateBack({
- delta: 1
- })
- wx.hideLoading();
- }, 1000);
-
- } else {
-
- if(res.message.data.unit==0 && that.data.head_clas.length==4){
- that.data.head_clas.splice(0,2)
- // head_clas.splice(1,1)
- that.setData({
- class: that.data.head_clas[0].data_class
- })
- that.getData(that.data.class)
- }
- console.log(that.data.head_clas)
- that.setData({
- selectInfo:res.message.data,
- head_clas:that.data.head_clas
- // contentOne:res.message.data.stay_list,
- // contentTwo:res.message.data.collect_list,//上门送回列表
- // content:res.message.data.stay_list,//一揽收
- // content:res.message.data.stay_list,//一揽收
- })
-
- }
- }).catch(function (err) {
-
- console.log(222);
- })
-
- },
- call(e){
- var phone=e.currentTarget.dataset.phone
- if(!phone)
- return;
- wx.makePhoneCall({
- phoneNumber: phone //仅为示例,并非真实的电话号码
- })
- },
- operate:function(e){
- var type=e.currentTarget.dataset.type//0揽收1送回
- console.log(type)
- this.setData({
- show:!this.data.show,
- type,
- focus:true
- })
- },
- finish:function(e){
- var that=this
- var val=e.detail.value;
- this.setData({
- one:val.split('')[0]?val.split('')[0]:'',
- two:val.split('')[1]?val.split('')[1]:'',
- three:val.split('')[2]?val.split('')[2]:'',
- four:val.split('')[3]?val.split('')[3]:'',
- five:val.split('')[4]?val.split('')[4]:'',
- six:val.split('')[5]?val.split('')[5]:''
- })
- if(val.length>=6){
- if(that.data.type==1){
- that.submit()
- }else{
- that.submitValue()
- }
-
- }
-
- },
- submitValue:function(){
- var that=this
- if(that.data.inputValue=='')
- return wx.showToast({title: '存衣码不能为空',icon:'none'})
- app.api.useApi(app.globalData.baseAppUrl + "api/admin/SaveCode", {
- logistic_code: that.data.inputValue,
- network_id:this.data.nid
- }, "post").then(function (res) {
- wx.hideLoading();
- if (res.code== 200) {
- that.setData({
- show:!that.data.show,
- inputValue:'',
- one:'',
- two:'',
- three:'',
- four:'',
- five:'',
- six:''
- })
- if(that.data.type==0)
- wx.navigateTo({
- url: 'bind?id='+res.message.data.order_id+'&pointId='+id,
- })
- }else{
- wx.showToast({title: res.message.msg,icon:'none'})
- }
-
- }).catch(function (err) {
- console.log(222);
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
-
- },
- submit:function(){
- var that=this
- if(that.data.inputValue=='')
- return wx.showToast({title: '取衣码不能为空',icon:'none'})
- app.api.useApi(app.globalData.baseAppUrl + "api/admin/TakeCode", {
- logistic_code: that.data.inputValue,
- network_id:this.data.nid
- }, "post").then(function (res) {
- wx.hideLoading();
- if (res.code== 200) {
- that.setData({
- show:!that.data.show,
- inputValue:'',
- one:'',
- two:'',
- three:'',
- four:'',
- five:'',
- six:''
- })
-
- wx.navigateTo({
- url: 'bind?id='+res.message.data.order_id+'&logistic_code='+res.message.data.logistic_code,
- })
- }else{
- wx.showToast({title: res.message.msg,icon:'none'})
- }
-
- }).catch(function (err) {
- console.log(222);
- })
- },
- })
|