123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222 |
- // 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/enter/enter?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);
- })
- }
- })
|