|
|
@ -1,37 +1,167 @@ |
|
|
|
|
|
|
|
//第三方物流
|
|
|
|
var datePicker = require('../../utils/dateSetting') |
|
|
|
var datePicker = require('../../utils/dateSetting') |
|
|
|
|
|
|
|
var request = require('../../utils/http') |
|
|
|
|
|
|
|
var dateUtils = require('../../utils/dateUtils') |
|
|
|
Page({ |
|
|
|
Page({ |
|
|
|
data: { |
|
|
|
data: { |
|
|
|
list:[ |
|
|
|
selfOrderCode: '', //物流单号
|
|
|
|
{ |
|
|
|
list: [{ |
|
|
|
'id': 1, |
|
|
|
'id': 1, |
|
|
|
'number': '2023050002', |
|
|
|
'number': '2023050002', |
|
|
|
'time': '2023-5-12 11:32', |
|
|
|
'time': '2023-5-12 11:32', |
|
|
|
'status': '已签收', |
|
|
|
'status': '已签收', |
|
|
|
'name': '张三', |
|
|
|
'name': '张三', |
|
|
|
'num': 'M2023055568' |
|
|
|
'num': 'M2023055568' |
|
|
|
}, |
|
|
|
}], |
|
|
|
{ |
|
|
|
|
|
|
|
'id':2, |
|
|
|
|
|
|
|
'number':'2023050002', |
|
|
|
|
|
|
|
'time':'2023-5-12 11:32', |
|
|
|
|
|
|
|
'status':'已签收', |
|
|
|
|
|
|
|
'name':'李四', |
|
|
|
|
|
|
|
'num':'M2023055568' |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
pipenum: '', |
|
|
|
pipenum: '', |
|
|
|
ins: ['顺丰','京东',], |
|
|
|
ins: [], |
|
|
|
|
|
|
|
insIdx: 0, //物流所选下标
|
|
|
|
date: '', |
|
|
|
date: '', |
|
|
|
start:'2020-01-01', |
|
|
|
start: '2023-07-01', // 时间选择器开始时间
|
|
|
|
end:'', |
|
|
|
end: '', // 时间选择器结束时间
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
potoSrc: '../../images/addPoto.png', //默认图片
|
|
|
|
|
|
|
|
poto: [], //车辆&转运箱照片 最大长度 4
|
|
|
|
|
|
|
|
|
|
|
|
time: '', |
|
|
|
expectedEndTime: '', //预计到达时间
|
|
|
|
multiArray: [], |
|
|
|
multiArray: [], |
|
|
|
multiIndex: [0, 0, 0, 0, 0], |
|
|
|
multiIndex: [0, 0, 0, 0, 0], |
|
|
|
choose_year: "", |
|
|
|
choose_year: "", |
|
|
|
srcArray:[] |
|
|
|
srcArray: [], |
|
|
|
|
|
|
|
phone: '', //物流电话
|
|
|
|
|
|
|
|
boxNum: '', //转运箱号
|
|
|
|
|
|
|
|
cost: '', //物流费用
|
|
|
|
|
|
|
|
logisticsMen: '', //物流员
|
|
|
|
|
|
|
|
notes: '', //备注
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sampleCount: '0', //样本数量
|
|
|
|
|
|
|
|
//样本列表
|
|
|
|
|
|
|
|
sampleList: [{ |
|
|
|
|
|
|
|
'id': 1, |
|
|
|
|
|
|
|
'number': '2023050002', |
|
|
|
|
|
|
|
'time': '2023-5-12 11:32', |
|
|
|
|
|
|
|
'status': '已签收', |
|
|
|
|
|
|
|
'name': '张三', |
|
|
|
|
|
|
|
'num': 'M2023055568' |
|
|
|
|
|
|
|
}], |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//物流车、转运箱拍照
|
|
|
|
|
|
|
|
photograph(e) { |
|
|
|
|
|
|
|
var potoIdx = 0; |
|
|
|
|
|
|
|
if (e.target.dataset.id == 'car_1') potoIdx = 0 |
|
|
|
|
|
|
|
if (e.target.dataset.id == 'car_2') potoIdx = 1 |
|
|
|
|
|
|
|
if (e.target.dataset.id == 'box_1') potoIdx = 2 |
|
|
|
|
|
|
|
if (e.target.dataset.id == 'box_2') potoIdx = 3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//回显所拍摄照片
|
|
|
|
|
|
|
|
var _this = this; |
|
|
|
|
|
|
|
wx.chooseMedia({ |
|
|
|
|
|
|
|
count: 1, |
|
|
|
|
|
|
|
mediaType: ['image', 'video'], |
|
|
|
|
|
|
|
sourceType: ['camera'], |
|
|
|
|
|
|
|
sizeType: ['compressed'], |
|
|
|
|
|
|
|
camera: 'back', |
|
|
|
|
|
|
|
success: res => { |
|
|
|
|
|
|
|
_this.upImg(res.tempFiles[0].tempFilePath, potoIdx) //上传照片
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//上传照片 imageSrc照片临时路径 potoIdx 点击的哪一个图片框
|
|
|
|
|
|
|
|
upImg(imageSrc, potoIdx) { |
|
|
|
|
|
|
|
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)); |
|
|
|
|
|
|
|
if (resObj.code > 400) { |
|
|
|
|
|
|
|
wx.showModal({ |
|
|
|
|
|
|
|
title: '提示', |
|
|
|
|
|
|
|
content: resObj.message, |
|
|
|
|
|
|
|
complete: (res) => { |
|
|
|
|
|
|
|
if (res.cancel) {} |
|
|
|
|
|
|
|
if (res.confirm) {} |
|
|
|
|
|
|
|
//上传失败后移除图片
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
//保存图片路径到数组
|
|
|
|
|
|
|
|
// this.data.upImageArr.push(resObj.data.url);
|
|
|
|
|
|
|
|
_this.data.poto[potoIdx] = resObj.data.url |
|
|
|
|
|
|
|
_this.setData({ |
|
|
|
|
|
|
|
poto: _this.data.poto |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//显示回调图片
|
|
|
|
|
|
|
|
addCallBackImage(imageSrc) { |
|
|
|
|
|
|
|
var temp = { |
|
|
|
|
|
|
|
isBtn: false, |
|
|
|
|
|
|
|
imgUrl: imageSrc, |
|
|
|
|
|
|
|
text: imageSrc, |
|
|
|
|
|
|
|
func: "delImage" |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
this.data.imageArr.unshift(temp); |
|
|
|
|
|
|
|
this.setData({ |
|
|
|
|
|
|
|
imageArr: this.data.imageArr |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//文本输入信息
|
|
|
|
|
|
|
|
inputTextInfo(e) { |
|
|
|
|
|
|
|
var data_id = e.target.dataset.id; //组件tag
|
|
|
|
|
|
|
|
var value = e.detail.value; //输入的文本
|
|
|
|
|
|
|
|
//样本编号
|
|
|
|
|
|
|
|
if (data_id == 'barCode') { |
|
|
|
|
|
|
|
this.setData({ |
|
|
|
|
|
|
|
pipenum: value |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//物流电话
|
|
|
|
|
|
|
|
if (data_id == 'phone') { |
|
|
|
|
|
|
|
this.setData({ |
|
|
|
|
|
|
|
phone: value |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//转运箱号
|
|
|
|
|
|
|
|
if (data_id == 'boxNum') { |
|
|
|
|
|
|
|
this.setData({ |
|
|
|
|
|
|
|
boxNum: value |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//物流费用
|
|
|
|
|
|
|
|
if (data_id == 'cost') { |
|
|
|
|
|
|
|
this.setData({ |
|
|
|
|
|
|
|
cost: value |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//物流员
|
|
|
|
|
|
|
|
if (data_id == 'logisticsMen') { |
|
|
|
|
|
|
|
this.setData({ |
|
|
|
|
|
|
|
logisticsMen: value |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//驾驶员
|
|
|
|
|
|
|
|
if (data_id == 'driverMen') { |
|
|
|
|
|
|
|
this.setData({ |
|
|
|
|
|
|
|
driverMen: value |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//备注
|
|
|
|
|
|
|
|
if (data_id == 'notes') { |
|
|
|
|
|
|
|
this.setData({ |
|
|
|
|
|
|
|
notes: value |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
scacode() { |
|
|
|
scacode() { |
|
|
@ -59,15 +189,6 @@ Page({ |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
//上传图片接口地址
|
|
|
|
|
|
|
|
// up(){
|
|
|
|
|
|
|
|
// console.log(this.data.srcI)
|
|
|
|
|
|
|
|
// wx.uploadFile({
|
|
|
|
|
|
|
|
// filePath: this.data.srcI,
|
|
|
|
|
|
|
|
// name: 'file',
|
|
|
|
|
|
|
|
// url: '',
|
|
|
|
|
|
|
|
// })
|
|
|
|
|
|
|
|
// },
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bushPhot() { |
|
|
|
bushPhot() { |
|
|
|
wx.chooseMedia({ |
|
|
|
wx.chooseMedia({ |
|
|
@ -97,8 +218,10 @@ Page({ |
|
|
|
|
|
|
|
|
|
|
|
//送检机构
|
|
|
|
//送检机构
|
|
|
|
bindPickerChange(e) { |
|
|
|
bindPickerChange(e) { |
|
|
|
|
|
|
|
console.log('bindPickerChange = ' + JSON.stringify(e)); |
|
|
|
this.setData({ |
|
|
|
this.setData({ |
|
|
|
index: e.detail.value |
|
|
|
index: e.detail.value, |
|
|
|
|
|
|
|
insIdx:e.detail.value |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
@ -118,7 +241,7 @@ Page({ |
|
|
|
this.data.multiArray[3][this.data.multiIndex[3]] + |
|
|
|
this.data.multiArray[3][this.data.multiIndex[3]] + |
|
|
|
this.data.multiArray[4][this.data.multiIndex[4]]; |
|
|
|
this.data.multiArray[4][this.data.multiIndex[4]]; |
|
|
|
this.setData({ |
|
|
|
this.setData({ |
|
|
|
time: dateStr |
|
|
|
expectedEndTime: dateStr |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
@ -150,7 +273,19 @@ Page({ |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//查询底部列表数据
|
|
|
|
|
|
|
|
selSampleList() { |
|
|
|
|
|
|
|
var reqData = { |
|
|
|
|
|
|
|
'logisticsNo': this.data.selfOrderCode |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
request.post(`/logistics/selectTranLogistics`, reqData).then(res => { |
|
|
|
|
|
|
|
console.log(res.data); |
|
|
|
|
|
|
|
this.setData({ |
|
|
|
|
|
|
|
sampleList: res.data.data, |
|
|
|
|
|
|
|
sampleCount: res.data.data.length |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
goDetail() { |
|
|
|
goDetail() { |
|
|
@ -159,6 +294,85 @@ Page({ |
|
|
|
}) |
|
|
|
}) |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//保存样本信息
|
|
|
|
|
|
|
|
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 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//处理物流车拍照
|
|
|
|
|
|
|
|
var carPoto = [] |
|
|
|
|
|
|
|
var boxPoto = [] |
|
|
|
|
|
|
|
var array = this.data.poto; |
|
|
|
|
|
|
|
for (let index = 0; index < array.length; index++) { |
|
|
|
|
|
|
|
if (index < 2 && array[index] != this.data.potoSrc) { |
|
|
|
|
|
|
|
carPoto.push(array[index]) |
|
|
|
|
|
|
|
} else if (array[index] != this.data.potoSrc) { |
|
|
|
|
|
|
|
boxPoto.push(array[index]) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var tempData = { |
|
|
|
|
|
|
|
"barCode": temp.pipenum, //样本条码
|
|
|
|
|
|
|
|
"barCodeImg": "", //物流拍照图
|
|
|
|
|
|
|
|
"boxNum": temp.boxNum, //转运箱号
|
|
|
|
|
|
|
|
"carPics": carPoto.toString(), //物流车图片 逗号分隔
|
|
|
|
|
|
|
|
"boxPics": boxPoto.toString(), // 转运箱图片 逗号分隔
|
|
|
|
|
|
|
|
"cost": 0, // 物流费用
|
|
|
|
|
|
|
|
"driverMen": temp.driverMen, //驾驶员
|
|
|
|
|
|
|
|
"entryDate": temp.date, // 录入日期
|
|
|
|
|
|
|
|
"endDate": '2023-07-06 14:52:53', //startTime
|
|
|
|
|
|
|
|
"expectedEndTime": endTime, //预计到达时间 endTime
|
|
|
|
|
|
|
|
"institutionName": temp.ins[temp.insIdx].orgName, //送检机构名称
|
|
|
|
|
|
|
|
"institutionNo": temp.ins[temp.insIdx].id, //送检机构编号
|
|
|
|
|
|
|
|
"logisticsMen": temp.logisticsMen, //物流员
|
|
|
|
|
|
|
|
"logisticsNo": temp.selfOrderCode, //物流编号
|
|
|
|
|
|
|
|
"logisticsWay": 2, //物流方式 1自建 2第三方 3货运
|
|
|
|
|
|
|
|
"notes": temp.notes, // 物流备注
|
|
|
|
|
|
|
|
"number": temp.number, // 数量
|
|
|
|
|
|
|
|
"numberplate": "", // 车牌号
|
|
|
|
|
|
|
|
"phone": temp.phone, //物流电话
|
|
|
|
|
|
|
|
"startTime": "", //出发时间
|
|
|
|
|
|
|
|
"tranType": "", //物流方式
|
|
|
|
|
|
|
|
"unitType": temp.insIdx, //物流单位 1.顺丰 2.京东
|
|
|
|
|
|
|
|
"updateBy": 0, |
|
|
|
|
|
|
|
"updateTime": "" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
request.post(`/batch/addTranLogistics`, tempData).then(res => { |
|
|
|
|
|
|
|
console.log(JSON.stringify(res.data)); |
|
|
|
|
|
|
|
if (res.data.code == 200) { |
|
|
|
|
|
|
|
//保存成功后,查询底部列表
|
|
|
|
|
|
|
|
this.selSampleList(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
wx.showModal({ |
|
|
|
|
|
|
|
title: '错误', |
|
|
|
|
|
|
|
content: res.data.message, |
|
|
|
|
|
|
|
showCancel: false, |
|
|
|
|
|
|
|
complete: (res) => { |
|
|
|
|
|
|
|
if (res.confirm) {} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//显示必选项为空提示
|
|
|
|
|
|
|
|
showErrInfo(field, errInfo) { |
|
|
|
|
|
|
|
if (field === undefined || field.length == 0) { |
|
|
|
|
|
|
|
wx.showToast({ |
|
|
|
|
|
|
|
icon: 'error', |
|
|
|
|
|
|
|
title: errInfo, |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 生命周期函数--监听页面加载 |
|
|
|
* 生命周期函数--监听页面加载 |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -170,8 +384,7 @@ Page({ |
|
|
|
end: '' + year + '-' + (Array(2).join(0) + month).slice(-2) + '-' + (Array(2).join(0) + now.getDate()).slice(-2), //当前的时间
|
|
|
|
end: '' + year + '-' + (Array(2).join(0) + month).slice(-2) + '-' + (Array(2).join(0) + now.getDate()).slice(-2), //当前的时间
|
|
|
|
|
|
|
|
|
|
|
|
//开始
|
|
|
|
//开始
|
|
|
|
multiArray: |
|
|
|
multiArray: [ |
|
|
|
[ |
|
|
|
|
|
|
|
[year + "年", year + 1 + "年", year + 2 + "年"], |
|
|
|
[year + "年", year + 1 + "年", year + 2 + "年"], |
|
|
|
datePicker.determineMonth(), |
|
|
|
datePicker.determineMonth(), |
|
|
|
datePicker.determineDay(year, month), |
|
|
|
datePicker.determineDay(year, month), |
|
|
@ -179,6 +392,40 @@ Page({ |
|
|
|
datePicker.determineMinute() |
|
|
|
datePicker.determineMinute() |
|
|
|
], |
|
|
|
], |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取物流单号 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) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setData({ |
|
|
|
|
|
|
|
ins: tempArr |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//查询物流批次列表
|
|
|
|
|
|
|
|
this.selSampleList() |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//初始化照片按钮
|
|
|
|
|
|
|
|
var tempSrc = [this.data.potoSrc, this.data.potoSrc, this.data.potoSrc, this.data.potoSrc] |
|
|
|
|
|
|
|
this.setData({ |
|
|
|
|
|
|
|
poto: tempSrc |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|