diff --git a/images/addPoto.png b/images/addPoto.png new file mode 100644 index 0000000..01f0874 Binary files /dev/null and b/images/addPoto.png differ diff --git a/pages/about/about.js b/pages/about/about.js index 0502dda..3e2bf6e 100644 --- a/pages/about/about.js +++ b/pages/about/about.js @@ -6,9 +6,9 @@ Page({ */ data: { username:'立即登录' - }, + //绑定微信 bindWx(){ wx.showModal({ title: '绑定微信', @@ -29,18 +29,21 @@ Page({ }) }, + //自建物流查询 goQueryme(){ wx.navigateTo({ url: '../queryme/queryme', }) }, + //第三方物流查询 goQuerythree(){ wx.navigateTo({ url: '../querythree/querythree', }) }, + //货运物流查询 goQueryfrei(){ wx.navigateTo({ url: '../queryfrei/queryfrei', diff --git a/pages/details/details.js b/pages/details/details.js index 0b9417a..812d14c 100644 --- a/pages/details/details.js +++ b/pages/details/details.js @@ -5,14 +5,39 @@ Page({ * 页面的初始数据 */ data: { - + barCode:'', //样本条码 + receiveTime:'', //接收时间 + status:'', //样本状态 + logisticsNo:'', //物流编号 + unitType:'', //物流单位 + entryDate:'', //日期 + cost:'', //物流费用 + expectedEndTime:'', //到达日期 + boxNum:'', //转运箱号 + numberplate:'', //物流车号 + logisticsMen:'', //物流员 + notes:'',//备注 }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { - + console.log(options.sample); + var item = JSON.parse(options.sample) + this.setData({ + barCode:item.barCode, + receiveTime:item.receiveTime, + status:item.status, + logisticsNo:item.logisticsNo, + unitType:item.unitType, + cost:item.cost, + expectedEndTime:item.expectedEndTime, + boxNum:item.boxNum, + numberplate:item.numberplate, + logisticsMen:item.logisticsMen, + notes:item.notes + }) }, /** diff --git a/pages/details/details.wxml b/pages/details/details.wxml index c0b707e..421a0e9 100644 --- a/pages/details/details.wxml +++ b/pages/details/details.wxml @@ -3,11 +3,11 @@ - 2023050002 + {{barCode}} - 2023-5-12 11:32 + {{receiveTime}} @@ -15,39 +15,39 @@ - M2023055568 + {{logisticsNo}} - 顺丰 + {{unitType}} - 2023-5-12 11:32 + {{entryDate}} - 20.00 + {{cost}} - 2023-5-12 16:00 + {{expectedEndTime}} - Z564687 + {{boxNum}} - 京B85D6S + {{numberplate}} - 张三 + {{logisticsMen}} - + {{notes}} diff --git a/pages/feedback/feedback.js b/pages/feedback/feedback.js index 9dfe421..8c953af 100644 --- a/pages/feedback/feedback.js +++ b/pages/feedback/feedback.js @@ -139,6 +139,11 @@ Page({ } }) }, + //删除照片 + delImage(e){ + console.log(e) + //TODO + }, //显示回调图片 addCallBackImage(imageSrc) { @@ -146,7 +151,7 @@ Page({ isBtn: false, imgUrl: imageSrc, text: imageSrc, - func: "" + func: "delImage" }; this.data.imageArr.unshift(temp); this.setData({ diff --git a/pages/feedback/feedback.wxml b/pages/feedback/feedback.wxml index bddf103..bf16c31 100644 --- a/pages/feedback/feedback.wxml +++ b/pages/feedback/feedback.wxml @@ -18,15 +18,12 @@ {{item.text}} - + - - - \ No newline at end of file diff --git a/pages/index/index.js b/pages/index/index.js index fb86a89..3e0c21b 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -60,6 +60,35 @@ Page({ }, msg:[], //首页中间消息列表 }, + + //跳转对应界面 + goLogisticsType(e){ + console.log(JSON.stringify(e)); + var tag = e.currentTarget.dataset.id + var url + //自建物流 + if(tag === 'goMelogistics'){ + url = '../meLogistics/meLogistics' + } + + //第三方 + if(tag === 'goThreelogistics'){ + url = '../threeLogistics/threeLogistics' + } + + //货运 + if(tag === 'goLogistics'){ + url = '../freiLogistics/freiLogistics' + } + + //物流交接 + if(tag === 'goHandover'){ + url = '../handover/handover' + } + wx.navigateTo({ + url: url, + }) + }, //自建物流 goMelogistics(){ @@ -75,10 +104,11 @@ Page({ }) }, - //货运物流 + //物流交接 goHandover(){ wx.navigateTo({ - url: '../handover/handover', + url: '../freiLogistics/freiLogistics', + // url: '../handover/handover', }) }, diff --git a/pages/index/index.wxml b/pages/index/index.wxml index 19dcbd2..566e0de 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -12,16 +12,16 @@ - - + + 自建物流 - + 第三方物流 - + 货运物流 @@ -32,5 +32,5 @@ - + \ No newline at end of file diff --git a/pages/login/login.wxml b/pages/login/login.wxml index a780c22..55f7232 100644 --- a/pages/login/login.wxml +++ b/pages/login/login.wxml @@ -1,17 +1,17 @@ -欢迎回来! +欢迎登录 - + - + - + diff --git a/pages/login/login.wxss b/pages/login/login.wxss index 1aef6d1..a87f097 100644 --- a/pages/login/login.wxss +++ b/pages/login/login.wxss @@ -1,11 +1,28 @@ /* pages/login/login.wxss */ /* pages/login/login.wxss */ -page{ - background: -webkit-linear-gradient(top,#27adb0,#b6f0f0,#f8f8f8); +page { + background: -webkit-linear-gradient(top, #27adb0, #b6f0f0, #f8f8f8); padding-top: 250rpx; } -.text{ +.title { + padding: 40rpx 50rpx; + font-size: 55rpx; + color: #fff; + font-weight: 600; + font-family: 'Courier New', Courier, monospace; +} + + +.box { + background-color: #fff; + width: 650rpx; + border-radius: 10rpx; + margin: 0 auto; + padding: 30rpx 0; +} + +.text { display: flex; /* background-color: #f1f1f1; */ border-radius: 20rpx; @@ -14,23 +31,25 @@ page{ padding: 20rpx; align-items: center; } -.text label{ + +.text label { font-weight: 900; font-size: 30rpx; color: #333; } -.text input{ + +.text input { font-size: 28rpx; background-color: #f5f5f5; width: 70%; height: 60rpx; padding: 0 20rpx; - border-radius: 20rpx; + border-radius: 10rpx; } -.btn{ - border-radius: 20rpx; - height: 60rpx; +.btn { + border-radius: 10rpx; + height: 80rpx; display: flex; align-items: center; justify-content: center; @@ -38,6 +57,6 @@ page{ font-weight: 500; background-color: #259c9e; color: #fff; - margin-top: 30rpx; + margin-top: 50rpx; width: 300rpx !important; } \ No newline at end of file diff --git a/pages/meLogistics/meLogistics.js b/pages/meLogistics/meLogistics.js index c6b7ea2..12aae34 100644 --- a/pages/meLogistics/meLogistics.js +++ b/pages/meLogistics/meLogistics.js @@ -1,122 +1,187 @@ // pages/meLogistics/meLogistics.js -var datePicker = require('../../utils/dateSetting') -const http = require('../../utils/http') +const datePicker = require('../../utils/dateSetting') +const request = require('../../utils/http') +const dateUtils = require('../../utils/dateUtils') //设定当前的时间,将其设定为常量 - - - Page({ data: { - list:[ - { - 'id':1, - 'number':'2023050002', - 'time':'2023-5-12 11:32', - 'status':'已签收', - 'name':'张三', - 'num':'M2023055568' - }, - { - 'id':2, - 'number':'2023050002', - 'time':'2023-5-12 11:32', - 'status':'已签收', - 'name':'李四', - 'num':'M2023055568' - } - ], - pipenum:'', - selfOrderCode:'',//物流单号 - ins: ['xx卫生院','xx门诊',], - bushList:['私家车','大巴','顺丰','其他'], - bush:'', - date: '', - start:'2020-01-01', - end:'', - //开始 - time: '', + pipenum: '', + selfOrderCode: '', //物流单号 + ins: [], //送检机构 服务端获取 + insName: [], //机构列表名称 + insIdx: 0, //当前所选机构下标 + bushList: ['私家车', '大巴', '顺丰', '其他'], //运输方式 服务端获取 + bush: '', //运输方式下标 + date: '', //当天日期 + start: '2020-01-01', + end: '', + + boxNum: '', //转运箱号 + + time: '', //出发时间 multiArray: [], multiIndex: [0, 0, 0, 0, 0], choose_year: "", - //结束 - time1: '', + + time1: '', //到达时间 multiArray1: [], multiIndex1: [0, 0, 0, 0, 0], choose_year1: "", - - srcArray:[] - + numberplate: '', //车牌号 + logisticsMen: '', //物流员 + number: '', //数量 + notes: '', //备注 + driverMen: '', //驾驶员 + srcArray: [], //样本组? + potoSrc: '../../images/addPoto.png', //默认图片 + poto: [], //车辆&转运箱照片 最大长度 4 + tableArr: [], //扫码表数据 + sampleCount: '0', //样本数量 + //样本列表 + sampleList: [{ + 'id': 1, + 'number': '2023050002', + 'time': '2023-5-12 11:32', + 'status': '已签收', + 'name': '张三', + 'num': 'M2023055568' + }, + { + 'id': 2, + 'number': '2023050002', + 'time': '2023-5-12 11:32', + 'status': '已签收', + 'name': '李四', + 'num': 'M2023055568' + }, + { + 'id': 3, + 'number': '2023050002', + 'time': '2023-5-12 11:32', + 'status': '已签收', + 'name': '李四', + 'num': 'M2023055568' + } + ], }, - scacode(){ + //调用摄像头 + scacode() { wx.scanCode({ - success:(res)=>{ + success: (res) => { console.log(res.result); this.setData({ - pipenum:res.result + pipenum: res.result }) } }) }, //样本拍照 - phot(){ + phot() { wx.chooseMedia({ count: 1, - mediaType: ['image','video'], + mediaType: ['image', 'video'], sourceType: ['album', 'camera'], maxDuration: 30, camera: 'back', - success: res=>{ + success: res => { console.log(this.data.srcI) console.log(res.tempFiles[0].tempFilePath) // this.up(); } }) }, - //上传图片接口地址 - // up(){ - // console.log(this.data.srcI) - // wx.uploadFile({ - // filePath: this.data.srcI, - // name: 'file', - // url: '', - // }) - // }, //物流车拍照 - bushPhot(){ + bushPhot() { wx.chooseMedia({ count: 1, - mediaType: ['image','video'], + mediaType: ['image', 'video'], sourceType: ['album', 'camera'], maxDuration: 30, camera: 'back', - success: res=>{ + success: res => { // this.up(); } }) }, //转运箱拍照 - boxPhot(){ + boxPhot(e) { + console.log(e.target.dataset.id); wx.chooseMedia({ count: 1, - mediaType: ['image','video'], + mediaType: ['image', 'video'], sourceType: ['album', 'camera'], maxDuration: 30, camera: 'back', - success: res=>{ + success: res => { // this.up(); } }) }, + //物流车、转运箱拍照 + photograph(e) { + var potoIdx = 0; + console.log(e.target.dataset.id); + if (e.target.dataset.id === 'car_1') { + console.log(e.target.dataset.id); + potoIdx = 0 + } + if (e.target.dataset.id === 'car_2') { + console.log(e.target.dataset.id); + potoIdx = 1 + } + if (e.target.dataset.id === 'box_1') { + console.log(e.target.dataset.id); + potoIdx = 2 + } + if (e.target.dataset.id === 'box_2') { + console.log(e.target.dataset.id); + potoIdx = 3 + } + + //回显所拍摄照片 + var _this = this; + wx.chooseMedia({ + count: 1, + mediaType: ['image', 'video'], + sourceType: ['camera'], + sizeType: ['compressed'], + camera: 'back', + success: res => { + console.log(res.tempFiles[0].tempFilePath) + _this.data.poto[potoIdx] = res.tempFiles[0].tempFilePath + _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 + }); + }, + //送检机构 bindPickerChange(e) { this.setData({ - index: e.detail.value + insIdx: e.detail.value, + insName: this.data.ins[e.detail.value] }) }, @@ -128,10 +193,10 @@ Page({ }, //日期 - bindDateChange(e){ + bindDateChange(e) { // console.log(e.detail.value) this.setData({ - date:e.detail.value + date: e.detail.value }) }, @@ -143,10 +208,12 @@ Page({ this.data.multiArray[2][this.data.multiIndex[2]] + this.data.multiArray[3][this.data.multiIndex[3]] + this.data.multiArray[4][this.data.multiIndex[4]]; + this.setData({ time: dateStr }) - },//开始 + }, + bindMultiPickerChange1: function (e) { var dateStr = this.data.multiArray1[0][this.data.multiIndex1[0]] + this.data.multiArray1[1][this.data.multiIndex1[1]] + @@ -156,7 +223,7 @@ Page({ this.setData({ time1: dateStr }) - },//结束 + }, //当时间选择器呈现并进行滚动选择时间时调用该函数。开始 bindMultiPickerColumnChange: function (e) { @@ -214,10 +281,146 @@ Page({ }) }, - - goDetail(){ + //样本详细信息 + goDetail(e) { + console.log('goDetail=' + e.currentTarget.dataset.id); + var sample = this.data.sampleList[e.currentTarget.dataset.id] wx.navigateTo({ - url: '../details/details', + url: '../details/details?sample=' + JSON.stringify(sample), + }) + }, + + //文本输入信息 + 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 === 'number') { + this.setData({ + number: value + }) + } + + //转运箱号 + if (data_id === 'boxNum') { + this.setData({ + boxNum: value + }) + } + + //车牌号 + if (data_id === 'numberplate') { + this.setData({ + numberplate: 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 + }) + } + }, + + //保存样本信息 + saveInfo() { + var temp = this.data; + //处理出发时间 + var startTime = dateUtils.customizeDateFormat(temp.time); + //处理到达时间 + var endTime = dateUtils.customizeDateFormat(temp.time1); + + //处理物流车拍照 + 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": 1, //物流方式 1自建 2第三方 3货运 + "notes": temp.notes, // 物流备注 + "number": temp.number, // 数量 + "numberplate": "", // 车牌号 + "phone": "", //物流电话 + "startTime": startTime, //出发时间 + "tranType": "1", //物流方式 + "unitType": "", //物流单位 1.顺丰 2.京东(自建物流没有该字段) + "updateBy": 0, + "updateTime": "" + } + + console.log('saveInfo=' + JSON.stringify(tempData)); + request.post(`/batch/addTranLogistics`, tempData).then(res => { + console.log(JSON.stringify(res.data)); + if (res.data.code === 200) { + //保存成功后,查询底部列表 + + } else { + wx.showModal({ + title: '错误', + content: res.data.message, + showCancel: false, + complete: (res) => { + if (res.confirm) {} + } + }) + } + }) + }, + + //查询底部列表数据 + 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 + }) }) }, @@ -229,32 +432,54 @@ Page({ let year = now.getFullYear(); //获取当前年 let month = now.getMonth() + 1; //获取当前月份 this.setData({ - end: '' + year + '-' + (Array(2).join(0) + month).slice(-2) + '-' + (Array(2).join(0) + now.getDate()).slice(-2),//当前的时间 - - //开始 - multiArray:[[year + "年", year + 1 + "年", year + 2 + "年"], - datePicker.determineMonth(), - datePicker.determineDay(year, month), - datePicker.determineHour(), - datePicker.determineMinute() - ], - //结束 - multiArray1:[[year + "年", year + 1 + "年", year + 2 + "年"], - datePicker.determineMonth(), - datePicker.determineDay(year, month), - datePicker.determineHour(), - datePicker.determineMinute() - ], - }), - - //获取物流单号 1.自建物流 2.第三方物流 3.货运物流 - http.get(`/batch/getBatchsNumber?logisticsWay=1`).then(res => { - console.log('getBatchsNumber=' + JSON.stringify(res.data)) - if(res.data.code === 200){ - this.setData({ - selfOrderCode:res.data.data - }) + end: '' + year + '-' + (Array(2).join(0) + month).slice(-2) + '-' + (Array(2).join(0) + now.getDate()).slice(-2), //当前的时间 + //开始 + multiArray: [ + [year + "年", year + 1 + "年", year + 2 + "年"], + datePicker.determineMonth(), + datePicker.determineDay(year, month), + datePicker.determineHour(), + datePicker.determineMinute() + ], + //结束 + multiArray1: [ + [year + "年", year + 1 + "年", year + 2 + "年"], + datePicker.determineMonth(), + datePicker.determineDay(year, month), + datePicker.determineHour(), + datePicker.determineMinute() + ], + }), + + //获取物流单号 1.自建物流 2.第三方物流 3.货运物流 + request.get(`/batch/getBatchsNumber?logisticsWay=1`).then(res => { + console.log('getBatchsNumber=' + JSON.stringify(res.data)) + if (res.data.code === 200) { + this.setData({ + selfOrderCode: res.data.data + }) + } + }) + + //获取送检机构列表 + request.post(`/institution/selectInstitution`).then(res => { + var array = res.data.data + var tempArr = [] + for (let index = 0; index < array.length; index++) { + tempArr.push(array[index].orgName) } + this.setData({ + ins: tempArr + }) + + //查询物流批次列表 + this.selSampleList(); + }) + + //初始化照片按钮 + var tempSrc = [this.data.potoSrc, this.data.potoSrc, this.data.potoSrc, this.data.potoSrc] + this.setData({ + poto: tempSrc }) }, diff --git a/pages/meLogistics/meLogistics.wxml b/pages/meLogistics/meLogistics.wxml index aa3d4fc..ab5c6bd 100644 --- a/pages/meLogistics/meLogistics.wxml +++ b/pages/meLogistics/meLogistics.wxml @@ -1,92 +1,93 @@ - + - + 扫 码 拍 照 - + - + - + - + - + - + - + - + - + - + - + - + - - + + - - + + + 物流车拍照 - + - - + + 转运箱拍照 - + - - + + - 总计:200/管数 + 总计:{{sampleCount}}/管数 - + @@ -98,15 +99,19 @@ 物流员 物流单号 - - {{item.id}} - {{item.number}} - {{item.time}} - {{item.status}} - {{item.name}} - {{item.num}} + + {{index + 1}} + {{item.barCode}} + {{item.receiveTime}} + 已采样 + 已接收 + 已核收 + 已拒收 + 重新采样 + 其它 + {{item.logisticsMen}} + {{item.logisticsNo}} - - + \ No newline at end of file diff --git a/pages/meLogistics/meLogistics.wxss b/pages/meLogistics/meLogistics.wxss index 4c85cb3..8c0de8c 100644 --- a/pages/meLogistics/meLogistics.wxss +++ b/pages/meLogistics/meLogistics.wxss @@ -68,12 +68,13 @@ display: flex; flex-wrap: wrap; justify-content:space-around; - padding: 20rpx 10rpx; + padding: 10rpx 10rpx; + width: 100%; } .bush-img image{ width: 270rpx; height: 230rpx; - margin-top: 10rpx; + margin-top: 5rpx; border: 1rpx solid #999; border-radius: 15rpx; } @@ -117,7 +118,7 @@ align-items: center; flex-wrap: nowrap; white-space: nowrap; - min-width: 200rpx; + min-width: 250rpx; } .tab-top view{ background-color: #51bdbe; @@ -135,5 +136,5 @@ align-items: center; flex-wrap: nowrap; white-space: nowrap; - min-width: 100rpx; + min-width: 70rpx; } diff --git a/utils/dateUtils.js b/utils/dateUtils.js new file mode 100644 index 0000000..3ed27b2 --- /dev/null +++ b/utils/dateUtils.js @@ -0,0 +1,46 @@ +//时间格式处理工具类 + +//将 "2023年7月5日17时5分" 转换为 "2023-07-05 17:05:00" 格式 +const customizeDateFormat = function(dateStr) { + + if(dateStr === undefined || dateStr.length == 0){ + return ""; + } + + var tempDateStr = dateStr.replace('年','-').replace('月','-').replace('日',' ').replace('时',':').replace('分',':')+'00'; + // 2023-7-5 17:5:00 + var tempDateArr = tempDateStr.split(' '); + var ymd = tempDateArr[0].split('-'); //年月日 + var hms = tempDateArr[1].split(':'); //时分秒 + + var year = ymd[0]; //年 + var mot = ymd[1]; //月 + var day = ymd[2]; //日 + //判断月份是否小于10,则前边补 0 + if(mot < 10) { + mot == '0' + mot; + } + //判断日期是否小于10号,则前边补 0 + if(day < 10){ + day == '0' + day; + } + + var hour = hms[0]; //时 + var minute = hms[1]; //分 + var second = hms[2]; //秒 + + //判断小时是否小于10,则前边补 0 + if(hour < 10) { + hour = '0' + hour; + } + + //判断分钟是否小于10,则前边补 0 + if(minute < 10) { + minute == '0' + minute; + } + var returnDate = year + '-' + mot + '-' + day + ' ' + hour + ':' + minute + ':' + second; + return returnDate; +}//暴露出去 +module.exports = { + customizeDateFormat +}; \ No newline at end of file diff --git a/utils/http.js b/utils/http.js index a216d80..8da1414 100644 --- a/utils/http.js +++ b/utils/http.js @@ -71,7 +71,6 @@ const upImgFile = function(url, imgSrc) { // header = Object.assign({}, header, options.header); // } return new Promise((resolve, reject) => { - wx.uploadFile({ url: app.globalData.baseUrl + url, name: "file", @@ -93,28 +92,6 @@ const upImgFile = function(url, imgSrc) { } } }); - - // wx.request({ - // url: app.globalData.baseUrl + url, - // method: options.method, - // data: options.data, - // header: header, - // success: (res) => { - // if (res.data.code == 500) { - // wx.showModal({ - // showCancel: false, - // title: '提示', - // content: res.data.message - // }); - // reject(res.data.message); - // } else { - // resolve(res); - // } - // }, - // fail: (err) => { - // reject(err); - // } - // }); }); };