Files
Wx_AUTS_Prod/Web/pages/index/index.js
2025-11-26 17:42:45 +08:00

416 lines
9.9 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// index.js
// 获取应用实例
const app = getApp()
import {
Goodid,
GetdingdanbyID,
GetshpingxxbyS,
GetdingdanbyPID
} from '../../lib/RequestingCenter.js'
const format = require("../../utils/util.js");
let SCREEN_WIDTH = 750
let RATE = wx.getSystemInfoSync().screenHeight / wx.getSystemInfoSync().screenWidth
var Statusssss = 0;
var ShippingCodesss = "";
var ProjectListIDss = 0;
var sqlids = 0;
Page({
data: {
ScreenTotalW: SCREEN_WIDTH,
ScreenTotalH: SCREEN_WIDTH * RATE,
ScreenH: 220,
isCopyingTextDomID: '', //正在拷贝选中字符串,处于蓝底白字
//未装箱数量
wzxnum: 0,
//装箱中数量
zxznum: 0,
//完成数量
wcddnum: 0,
//全部数量
quanbunum: 0,
scanCode: '',
scanQuCode: '+',
listers: [],
lists: [],
Dingdanlist: [],
//名字搜素
name: '',
// 查询类型
apptype: -1,
ProjectList: [],
option1: [],
//机型
value1: 0,
//选中机型
ProjectListID: 0,
//状态
Stu: 0,
// 订单信息
ShippCode: "",
// 机型
pid: 0
},
//下拉框选择
onConfirm(o) {
var that = this;
let list = []
var names = that.data.name;
let status = Number(that.data.apptype) + 1;
let pid = o.detail
// 机型号码
ProjectListIDss = o.detail
that.setData({
ProjectListID: o.detail
})
wx.showLoading({
title: '请稍后....',
});
GetdingdanbyPID({
ShippingCode: names,
Status: status,
ProjectListID: pid,
sqlid: sqlids
}).then(res => {
console.log(res)
res.Data.userinfo.forEach((x) => {
list.push(x.ShippingCode);
x.projectNameInfo = res.Data.ProjectList.filter(y => y.ID == x.ProjectID)[0].ProjectName;
})
if (res.Status == 200) {
that.setData({
listers: res.Data.userinfo,
ProjectList: res.Data.ProjectList
});
wx.hideLoading();
} else {
app.toast(2, res.Message || "网络繁忙")
}
}, err => {
app.toast(2, "网络繁忙")
}).catch(
err => {
console.log(err)
app.toast("异常", 'error')
}
);
},
onLoad(e) {
var that = this
sqlids = e.Sqlid;
console.log(sqlids)
wx.hideLoading();
wx.showLoading({
title: '请稍后....',
});
Goodid({
Status: Statusssss,
ShippingCode: ShippingCodesss,
ProjectListID: ProjectListIDss,
sqlid: sqlids
}).then(res => {
console.log(res)
if (res.Status == 200) {
let list = []
list.push("全部订单")
let plist = []
let pname = {
value: 0,
text: '全部机型'
};
plist.push(pname);
res.Data.TBL_Projectytpe.forEach((x) => {
plist.push(x)
})
res.Data.userinfo.forEach((x) => {
x.projectNameInfo = res.Data.ProjectList.filter(y => y.ID == x.ProjectID)[0].ProjectName;
})
that.setData({
listers: res.Data.userinfo,
lists: list,
Dingdanlist: res.Data.userinfo,
ProjectList: res.Data.ProjectList,
//未装箱数量
wzxnum: res.wzx,
//装箱中数量
zxznum: res.zxz,
//完成数量
wcddnum: res.shuliabn,
//全部数量
quanbunum: res.quabu,
option1: plist,
value1: 0,
apptype: -1,
});
// console.log(that.data.option1)
} else if (res.Status == 100) {
app.toast(2, "你的帐号已经被管理员禁用了,请联系管理员")
} else {
app.toast(2, res.Message || "网络繁忙")
}
wx.hideLoading();
}, err => {
app.toast(2, "网络繁忙")
}).catch(
err => {
console.log(err)
app.toast("异常", 'error')
}
);
},
//出货单绑定
// bindPickerChange: function (e) {
// var that = this;
// this.setData({
// index: e.detail.value,
// })
// var curIdex = e.detail.value - 1;
// console.log(curIdex)
// var xx = "";
// if (curIdex == -1) {
// xx = "0";
// } else {
// xx = that.data.Dingdanlist[curIdex].ShippingCode;
// // console.log(xx)
// }
// GetdingdanbyID({
// ShippingCode: xx
// }).then(res => {
// if (res.Status == 200) {
// that.setData({
// listers: res.Data.userinfo,
// });
// } else {
// app.toast(2, res.Message || "网络繁忙")
// }
// }, err => {
// app.toast(2, "网络繁忙")
// }).catch(
// err => {
// console.log(err)
// app.toast("异常", 'error')
// }
// );
// },
onShow: function () {
var that = this
wx.hideLoading();
wx.showLoading({
title: '请稍后....',
});
if (sqlids == 1) {
that.setData({
DBname: "uts_zongqing"
})
} else {
that.setData({
DBname: "uts_johao"
})
}
GetshpingxxbyS({
Status: Statusssss,
ShippingCode: ShippingCodesss,
ProjectListID: ProjectListIDss,
sqlid: sqlids
}).then(res => {
console.log(res)
res.Data.userinfo.forEach((x) => {
x.projectNameInfo = res.Data.ProjectList.filter(y => y.ID == x.ProjectID)[0].ProjectName;
})
if (res.Status == 200) {
// console.log(res)
that.setData({
listers: res.Data.userinfo,
ProjectList: res.Data.ProjectList,
//未装箱数量
wzxnum: res.wzx,
//装箱中数量
zxznum: res.zxz,
//完成数量
wcddnum: res.shuliabn,
//全部数量
quanbunum: res.quabu,
// apptype: -1,
});
wx.hideLoading();
} else {
app.toast(2, res.Message || "网络繁忙")
}
}, err => {
app.toast(2, "网络繁忙")
}).catch(
err => {
console.log(err)
app.toast("异常", 'error')
}
);
},
//页面跳转
DianJiDingDan: function (e) {
var xx = this.data.listers.find(ee => {
return ee.ShippingCode == e.currentTarget.id
})
if (xx.Status == 3) {
//物品信息页面
wx.navigateTo({
url: '/pages/autho/index?ShippingCode=' + e.currentTarget.id + '&sqlid=' + sqlids
})
} else {
//物品信息页面
wx.navigateTo({
url: '/pages/OUtBoxBarCode/OUtBoxBarCode?ShippingCode=' + e.currentTarget.id + '&sqlid=' + sqlids
})
}
},
//用户输入订单号码查询
sreach: function () {
var that = this;
let list = []
var names = that.data.name;
wx.hideLoading();
wx.showLoading({
title: '请稍后....',
});
// 订单号码
ShippingCodesss = that.data.name
let status = Number(that.data.apptype) + 1;
let pid = that.data.ProjectListID
GetdingdanbyID({
ShippingCode: names,
Status: status,
ProjectListID: pid,
sqlid: sqlids
}).then(res => {
// console.log(res)
res.Data.userinfo.forEach((x) => {
list.push(x.ShippingCode);
x.projectNameInfo = res.Data.ProjectList.filter(y => y.ID == x.ProjectID)[0].ProjectName;
})
if (res.Status == 200) {
that.setData({
listers: res.Data.userinfo,
ProjectList: res.Data.ProjectList
});
} else {
app.toast(2, res.Message || "网络繁忙")
}
wx.hideLoading();
}, err => {
app.toast(2, "网络繁忙")
}).catch(
err => {
console.log(err)
app.toast("异常", 'error')
}
);
},
//状态查询
selapptype: function (e) {
var that = this;
let sel = Number(e.target.dataset.val);
let list = []
this.setData({
apptype: e.target.dataset.val,
})
wx.hideLoading();
wx.showLoading({
title: '请稍后....',
});
var Stu = sel + 1;
// 状态号码
Statusssss = Stu;
var ShippCode = that.data.name
let pid = that.data.ProjectListID
GetshpingxxbyS({
Status: Stu,
ShippingCode: ShippCode,
ProjectListID: pid,
sqlid: sqlids
}).then(res => {
res.Data.userinfo.forEach((x) => {
list.push(x.ShippingCode);
x.projectNameInfo = res.Data.ProjectList.filter(y => y.ID == x.ProjectID)[0].ProjectName;
})
if (res.Status == 200) {
that.setData({
listers: res.Data.userinfo,
ProjectList: res.Data.ProjectList
});
} else {
app.toast(2, res.Message || "网络繁忙")
}
wx.hideLoading();
}, err => {
app.toast(2, "网络繁忙")
}).catch(
err => {
console.log(err)
app.toast("异常", 'error')
}
);
console.log(Statusssss)
},
getProjectName: function (proID) {
console.log("goes here.")
var retList = this.data.ProjectList.filter(x => x.ID == proID);
if (retList.length > 0)
return retList[0].ProjectName;
return "";
},
onUnload: function () {
var that = this;
},
onHide: function () {
},
onReady: function () {
},
//长按复制
copyText: function (e) {
console.log(e)
var that = this;
var strID = e.currentTarget.id;
var arrSplit = strID.split("_");
const text = arrSplit[1];
that.setData({
isCopyingTextDomID: strID
});
wx.setClipboardData({
data: text,
success: function () {
wx.showToast({
title: '复制成功'
});
//已经copy成功但是依然显示蓝底白字状态1秒钟然后提示用户拷贝成功取消蓝底白字状态。
setTimeout(function () {
that.setData({
isCopyingTextDomID: ''
});
}, 3000);
},
fail: function () {
var that = this;
that.setData({
isCopyingText: false
});
wx.showToast({
title: '复制失败',
icon: 'none',
});
}
});
},
showSuccessCopyProc: function () {
var that = this;
}
})