// pages/sorting/enter/enter.js const app =getApp() Page({ /** * 页面的初始数据 */ data: { seal_no:"", user_remark:"", y_good_count:"", s_good_count:"", pj_count:"", standards:"", datainfo:[], phone:'', order_id:"ws20220307185258297291", str:[ {title:'不加工',color:'#F23131',url:'/image/icon/error-red.png',bg:"background: #FFE1E1;"}, {title:'加工',color:'#0F8800',url:'/image/control/success.png',bg:"background: #EBF4EA;"}, {title:'需确认',color:'#6A2A17',url:'/image/icon/icon_xuqueren@3x.png',bg:"background: #FFE5DD;"} ], show:false, isfen:0 }, onPullDownRefresh:function(){ this.getsorting(); }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { this.data.seal_no=options.seal_no; this.data.isfen=options.type; //this.getsorting(); }, onShow(){ this.getsorting(); }, show(){ this.getOrder(); this.setData({ show:!this.data.show }) }, onClose(){ this.setData({ show:!this.data.show }) }, toResult(){ // this.submit(); wx.navigateTo({ url: '/pages/sorting/add/add?seal_no='+this.data.seal_no, }) }, getsorting(){ var that = this; app.api.useApi(app.globalData.baseAppUrl + "api/admin/sorting/entry", { seal_no: this.data.seal_no }, "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 data = res.message.data that.setData({ datainfo:data.data, user_remark:res.message.user_remark, y_good_count:res.message.y_good_count, s_good_count:res.message.s_good_count, seal_no:res.message.seal_no, pj_count:res.message.pj_count, standards:res.message.standards, phone:res.message.phone, order_id:res.message.order_id }) } }).catch(function (err) { console.log(222); }) }, delete(e){ console.log(e) var that = this; app.api.useApi(app.globalData.baseAppUrl + "api/admin/sorting/entry/delete", { id: e.currentTarget.dataset.id, }, "delete").then(function (res) { console.log(res); if (res.code != 200) { wx.showLoading({ title: res.message.msg, }) setTimeout(function () { wx.hideLoading(); }, 1000); } else { var indx=e.currentTarget.dataset.indx; var datainfo= that.data.datainfo datainfo.splice(indx,1); that.setData({ datainfo:datainfo }) wx.hideLoading(); wx.showLoading({ title: res.message.msg, }) setTimeout(function () { this.getsorting(); wx.hideLoading(); }, 1000); } }).catch(function (err) { console.log(222); }) }, click(e){ wx.setClipboardData({ data: e.currentTarget.dataset.no, success (res) { wx.showLoading({ title: '复制成功', }) } }) }, copy(e){ console.log(e) var that = this; app.api.useApi(app.globalData.baseAppUrl + "api/admin/sorting/entry/CopySave", { id: e.currentTarget.dataset.id, }, "post").then(function (res) { console.log(res); if (res.code != 200) { wx.showLoading({ title: res.message.msg, }) setTimeout(function () { wx.hideLoading(); }, 1000); } else { wx.hideLoading(); this.getsorting(); } }).catch(function (err) { console.log(222); }) }, getOrder(e){ console.log(e) var that = this; app.api.useApi(app.globalData.baseAppUrl + "api/admin/sorting/entry/OrderReport", { order_id: that.data.order_id, }, "get").then(function (res) { console.log(res); if (res.code != 200) { wx.showLoading({ title: res.message.msg, }) setTimeout(function () { wx.hideLoading(); }, 1000); } else { let order=res.message.data wx.hideLoading(); that.setData({ order }) } }).catch(function (err) { console.log(222); }) }, submit(e){ var that = this; app.api.useApi(app.globalData.baseAppUrl + "api/admin/sorting/entry/submit", { seal_no: this.data.seal_no, }, "post").then(function (res) { console.log(res); if (res.code != 200) { wx.showLoading({ title: res.message.msg, }) setTimeout(function () { wx.hideLoading(); }, 1000); } else { wx.hideLoading(); wx.showLoading({ title: res.message.msg, }) setTimeout(function () { wx.hideLoading(); wx.navigateBack({ delta: 1 //想要返回的层级 }) }, 1000); } }).catch(function (err) { console.log(222); }) }, coll(e){ wx.makePhoneCall({ phoneNumber: e.currentTarget.dataset.phone, }) } })