|
|
|
@ -2,45 +2,37 @@ |
|
|
|
|
var datePicker = require('../../utils/dateSetting') |
|
|
|
|
var request = require('../../utils/http') |
|
|
|
|
var dateUtils = require('../../utils/dateUtils') |
|
|
|
|
var app=getApp() |
|
|
|
|
|
|
|
|
|
Page({ |
|
|
|
|
data: { |
|
|
|
|
logno:'', |
|
|
|
|
|
|
|
|
|
boxArr:[],//转运箱列表
|
|
|
|
|
boxId:'',//转运箱id
|
|
|
|
|
// boxId:'',//转运箱id
|
|
|
|
|
boxNum: '', //转运箱号
|
|
|
|
|
unitTypeArr:[],//物流单位列表
|
|
|
|
|
unitType:'',//物流单位id
|
|
|
|
|
unitType1:'',//物流单位
|
|
|
|
|
|
|
|
|
|
selfOrderCode: '', //物流单号
|
|
|
|
|
list: [{ |
|
|
|
|
'id': 1, |
|
|
|
|
'number': '2023050002', |
|
|
|
|
'time': '2023-5-12 11:32', |
|
|
|
|
'status': '已签收', |
|
|
|
|
'name': '张三', |
|
|
|
|
'num': 'M2023055568' |
|
|
|
|
}], |
|
|
|
|
pipenum: '', |
|
|
|
|
ins: [], |
|
|
|
|
insIdx: 0, //物流所选下标
|
|
|
|
|
date: '', |
|
|
|
|
start: '2023-07-01', // 时间选择器开始时间
|
|
|
|
|
end: '', // 时间选择器结束时间
|
|
|
|
|
|
|
|
|
|
potoSrc: '../../images/addPoto.png', //默认图片
|
|
|
|
|
poto: [], //车辆&转运箱照片 最大长度 4
|
|
|
|
|
|
|
|
|
|
expectedEndTime: '', //预计到达时间
|
|
|
|
|
multiArray: [], |
|
|
|
|
multiIndex: [0, 0, 0, 0, 0], |
|
|
|
|
choose_year: "", |
|
|
|
|
srcArray: [], |
|
|
|
|
phone: '', //物流电话
|
|
|
|
|
|
|
|
|
|
cost: '', //物流费用
|
|
|
|
|
logisticsMen: '', //物流员
|
|
|
|
|
notes: '', //备注
|
|
|
|
|
pipenum: '', |
|
|
|
|
number: '', //数量
|
|
|
|
|
|
|
|
|
|
list: [], |
|
|
|
|
date: '', |
|
|
|
|
start: '2023-07-01', // 时间选择器开始时间
|
|
|
|
|
end: '', // 时间选择器结束时间
|
|
|
|
|
potoSrc: '../../images/addPoto.png', //默认图片
|
|
|
|
|
poto: [], //车辆&转运箱照片 最大长度 4
|
|
|
|
|
sampleCount: '0', //样本数量
|
|
|
|
|
//样本列表
|
|
|
|
|
sampleList: [], |
|
|
|
@ -77,8 +69,8 @@ Page({ |
|
|
|
|
var _this = this; |
|
|
|
|
request.upImgFile(`/feedBack/upload`, imageSrc).then(res => { |
|
|
|
|
var resObj = JSON.parse(res.data) |
|
|
|
|
console.log('upImgFile data =' + resObj.data.url); |
|
|
|
|
console.log('upImgFile res=' + JSON.stringify(res.data)); |
|
|
|
|
// console.log('upImgFile data =' + resObj.data.url);
|
|
|
|
|
// console.log('upImgFile res=' + JSON.stringify(res.data));
|
|
|
|
|
if (resObj.code > 400) { |
|
|
|
|
wx.showModal({ |
|
|
|
|
title: '提示', |
|
|
|
@ -125,6 +117,13 @@ Page({ |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//物流单号
|
|
|
|
|
if (data_id == 'selfOrderCode') { |
|
|
|
|
this.setData({ |
|
|
|
|
selfOrderCode: value |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//物流电话
|
|
|
|
|
if (data_id == 'phone') { |
|
|
|
|
this.setData({ |
|
|
|
@ -146,6 +145,20 @@ Page({ |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//数量
|
|
|
|
|
if (data_id == 'number') { |
|
|
|
|
this.setData({ |
|
|
|
|
number: value |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//转运箱
|
|
|
|
|
if (data_id == 'boxNum') { |
|
|
|
|
this.setData({ |
|
|
|
|
boxNum: value |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//驾驶员
|
|
|
|
|
if (data_id == 'driverMen') { |
|
|
|
|
this.setData({ |
|
|
|
@ -164,9 +177,13 @@ Page({ |
|
|
|
|
scacode() { |
|
|
|
|
wx.scanCode({ |
|
|
|
|
success: (res) => { |
|
|
|
|
console.log(res.result); |
|
|
|
|
var result=res.result |
|
|
|
|
if(result.length>20){ |
|
|
|
|
result=result.slice(5); |
|
|
|
|
console.log(result); |
|
|
|
|
} |
|
|
|
|
this.setData({ |
|
|
|
|
pipenum: res.result |
|
|
|
|
pipenum:result |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
@ -180,8 +197,8 @@ Page({ |
|
|
|
|
maxDuration: 30, |
|
|
|
|
camera: 'back', |
|
|
|
|
success: res => { |
|
|
|
|
console.log(this.data.srcI) |
|
|
|
|
console.log(res.tempFiles[0].tempFilePath) |
|
|
|
|
// console.log(this.data.srcI)
|
|
|
|
|
// console.log(res.tempFiles[0].tempFilePath)
|
|
|
|
|
// this.up();
|
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
@ -222,12 +239,12 @@ Page({ |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
//转运箱
|
|
|
|
|
bindPickerChangeBox(e){ |
|
|
|
|
this.setData({ |
|
|
|
|
boxNum:this.data.boxArr[e.detail.value].boxNum, |
|
|
|
|
boxId:this.data.boxArr[e.detail.value].id |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
// bindPickerChangeBox(e){
|
|
|
|
|
// this.setData({
|
|
|
|
|
// boxNum:this.data.boxArr[e.detail.value].boxNum,
|
|
|
|
|
// boxId:this.data.boxArr[e.detail.value].id
|
|
|
|
|
// })
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
|
|
//日期
|
|
|
|
|
bindDateChange(e) { |
|
|
|
@ -283,7 +300,7 @@ Page({ |
|
|
|
|
'logisticsNo': this.data.selfOrderCode |
|
|
|
|
} |
|
|
|
|
request.post(`/logistics/selectTranLogistics`, reqData).then(res => { |
|
|
|
|
// console.log(res.data);
|
|
|
|
|
console.log(res.data.data); |
|
|
|
|
this.setData({ |
|
|
|
|
sampleList: res.data.data, |
|
|
|
|
sampleCount: res.data.data.length |
|
|
|
@ -292,22 +309,24 @@ Page({ |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
goDetail() { |
|
|
|
|
goDetail(e) { |
|
|
|
|
console.log('goDetail=' + e.currentTarget.dataset.id); |
|
|
|
|
var sample = this.data.sampleList[e.currentTarget.dataset.id] |
|
|
|
|
console.log('==========',sample); |
|
|
|
|
wx.navigateTo({ |
|
|
|
|
url: '../details/details', |
|
|
|
|
url: '../details/details?sample=' + JSON.stringify(sample), |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
//保存样本信息
|
|
|
|
|
saveInfo() { |
|
|
|
|
var temp = this.data; |
|
|
|
|
//处理出发时间
|
|
|
|
|
// var startTime = dateUtils.customizeDateFormat(temp.time);
|
|
|
|
|
//处理到达时间
|
|
|
|
|
var endTime = dateUtils.customizeDateFormat(temp.expectedEndTime); |
|
|
|
|
|
|
|
|
|
// if (this.showErrInfo(startTime, '出发时间不可为空')) return
|
|
|
|
|
if (this.showErrInfo(endTime, '到达时间不可为空')) return |
|
|
|
|
if (this.showErrInfo(this.data.selfOrderCode, '物流单号不可为空')) return |
|
|
|
|
|
|
|
|
|
//处理物流车拍照
|
|
|
|
|
var carPoto = [] |
|
|
|
@ -324,14 +343,14 @@ Page({ |
|
|
|
|
var tempData = { |
|
|
|
|
"barCode": temp.pipenum, //样本条码
|
|
|
|
|
"barCodeImg": "", //物流拍照图
|
|
|
|
|
"boxId":temp.boxId,//转运箱id
|
|
|
|
|
"boxId":'',//转运箱id
|
|
|
|
|
"boxNum": temp.boxNum, //转运箱号
|
|
|
|
|
"carPics": carPoto.toString(), //物流车图片 逗号分隔
|
|
|
|
|
"boxPics": boxPoto.toString(), // 转运箱图片 逗号分隔
|
|
|
|
|
"cost": 0, // 物流费用
|
|
|
|
|
"driverMen": temp.driverMen, //驾驶员
|
|
|
|
|
"cost": temp.cost, // 物流费用
|
|
|
|
|
"driverMen": '', //驾驶员
|
|
|
|
|
"entryDate": temp.date, // 录入日期
|
|
|
|
|
"endDate": '2023-07-06 14:52:53', //startTime
|
|
|
|
|
"endDate": '', //startTime
|
|
|
|
|
"expectedEndTime": endTime, //预计到达时间 endTime
|
|
|
|
|
"institutionName":'',//送检机构名称
|
|
|
|
|
"institutionNo":'', //送检机构编号
|
|
|
|
@ -348,12 +367,12 @@ Page({ |
|
|
|
|
"updateBy": 0, |
|
|
|
|
"updateTime": "" |
|
|
|
|
} |
|
|
|
|
console.log(endTime); |
|
|
|
|
|
|
|
|
|
request.post(`/batch/addTranLogistics`, tempData).then(res => { |
|
|
|
|
console.log(JSON.stringify(res.data)); |
|
|
|
|
// console.log(JSON.stringify(res.data));
|
|
|
|
|
if (res.data.code == 200) { |
|
|
|
|
this.data.selfOrderCode = res.data.data |
|
|
|
|
wx.showToast({ |
|
|
|
|
title: res.data.message, |
|
|
|
|
}) |
|
|
|
|
//保存成功后,查询底部列表
|
|
|
|
|
this.selSampleList(); |
|
|
|
|
} else { |
|
|
|
@ -372,9 +391,10 @@ Page({ |
|
|
|
|
//显示必选项为空提示
|
|
|
|
|
showErrInfo(field, errInfo) { |
|
|
|
|
if (field === undefined || field.length == 0) { |
|
|
|
|
wx.showToast({ |
|
|
|
|
icon: 'error', |
|
|
|
|
title: errInfo, |
|
|
|
|
wx.showModal({ |
|
|
|
|
showCancel:false, |
|
|
|
|
title:'提示', |
|
|
|
|
content:errInfo, |
|
|
|
|
}) |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
@ -384,6 +404,13 @@ Page({ |
|
|
|
|
* 生命周期函数--监听页面加载 |
|
|
|
|
*/ |
|
|
|
|
onLoad(options) { |
|
|
|
|
if(options!==undefined){ |
|
|
|
|
console.log(options.logno); |
|
|
|
|
this.setData({ |
|
|
|
|
logno:options.logno |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
let now = new Date(); //获取时间
|
|
|
|
|
let year = now.getFullYear(); //获取当前年
|
|
|
|
|
let month = now.getMonth() + 1; //获取当前月份
|
|
|
|
@ -402,31 +429,18 @@ Page({ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取物流单号 1.自建物流 2.第三方物流 3.货运物流
|
|
|
|
|
request.get(`/batch/getBatchsNumber?logisticsWay=2`).then(res => { |
|
|
|
|
console.log('getBatchsNumber=' + JSON.stringify(res.data)) |
|
|
|
|
if (res.data.code == 200) { |
|
|
|
|
this.setData({ |
|
|
|
|
selfOrderCode: res.data.data |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
//获取物流机构列表 /dict/type/{dictType}
|
|
|
|
|
// request.get(`/dict/type/unit_type`).then(res => {
|
|
|
|
|
// var array = res.data.data
|
|
|
|
|
// var tempArr = []
|
|
|
|
|
// for (let index = 0; index < array.length; index++) {
|
|
|
|
|
// tempArr.push(array[index].dictLabel)
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// request.get(`/batch/getBatchsNumber?logisticsWay=2`).then(res => {
|
|
|
|
|
// if (res.data.code == 200) {
|
|
|
|
|
// this.data.selfOrderCode = res.data.data
|
|
|
|
|
// this.setData({
|
|
|
|
|
// ins: tempArr
|
|
|
|
|
// selfOrderCode: res.data.data
|
|
|
|
|
// })
|
|
|
|
|
|
|
|
|
|
// //查询物流批次列表
|
|
|
|
|
// this.selSampleList()
|
|
|
|
|
// this.selSampleList(); //查询物流批次列表
|
|
|
|
|
// }
|
|
|
|
|
// })
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//初始化照片按钮
|
|
|
|
|
var tempSrc = [this.data.potoSrc, this.data.potoSrc, this.data.potoSrc, this.data.potoSrc,this.data.potoSrc, this.data.potoSrc, this.data.potoSrc, this.data.potoSrc] |
|
|
|
|
this.setData({ |
|
|
|
@ -441,11 +455,11 @@ Page({ |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
//转运箱
|
|
|
|
|
request.post(`/box/selectTranBox`).then(res => { |
|
|
|
|
this.setData({ |
|
|
|
|
boxArr:res.data.data |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
// request.post(`/box/selectTranBox`).then(res => {
|
|
|
|
|
// this.setData({
|
|
|
|
|
// boxArr:res.data.data
|
|
|
|
|
// })
|
|
|
|
|
// })
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
@ -460,7 +474,13 @@ Page({ |
|
|
|
|
* 生命周期函数--监听页面显示 |
|
|
|
|
*/ |
|
|
|
|
onShow() { |
|
|
|
|
|
|
|
|
|
if(this.data.logno!=undefined){ |
|
|
|
|
this.setData({ |
|
|
|
|
selfOrderCode:this.data.logno |
|
|
|
|
}) |
|
|
|
|
this.selSampleList();
|
|
|
|
|
console.log(this.data.logno); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|