diff --git a/.hbuilderx/launch.json b/.hbuilderx/launch.json index 81f13f4..c279743 100644 --- a/.hbuilderx/launch.json +++ b/.hbuilderx/launch.json @@ -6,6 +6,10 @@ { "launchtype" : "local" }, + "mp-alipay" : + { + "launchtype" : "local" + }, "mp-weixin" : { "launchtype" : "local" diff --git a/common/api.js b/common/api.js index 771f249..8752ef3 100644 --- a/common/api.js +++ b/common/api.js @@ -91,6 +91,7 @@ module.exports = (vm) => { tmsOrg: params => vm.$u.http.get(tmsWebApi + '/org/commonSelect', { params }), projectCode: params => vm.$u.http.get(freightAPI + '/freightProject/commonSelect', { params }),// 项目 payeeCommonSelect: params => vm.$u.http.get(freightAPI + '/freightEnterpriseCollectDriver/payeeCommonSelect', { params }), // 代收人 + freightDriverCommonSelect: params => vm.$u.http.get(freightAdmin + '/freightDriver/tmsCommonSelect', { params }), // 网货司机选择器 driver: params => vm.$u.http.get(tmsServiceApi + '/driver/commonSelect', { params }), // 司机选择器 vehicle: params => vm.$u.http.get(tmsWebApi + '/vehicle/commonSelect', { params }), // 车辆选择器 goodsName: p => vm.$u.http.get(freightAPI + '/freightEnterpriseGoods/commonSelect', { params:{...p,goodsName:p.query }}).then(res=>{ @@ -150,6 +151,7 @@ module.exports = (vm) => { getSensitiveByOrderCode:params => vm.$u.http.get( freightAdmin + '/freightOrder/getSensitiveByOrderCode', {params}), buildMaQrcode:params => vm.$u.http.get( freightAdmin + '/woss/freightOrder/buildMaQrcode', {params}), supplementTrailerVehicle: params => vm.$u.http.get( freightAPI + '/freightOrder/supplementTrailerVehicle', params), // 绑定车挂 + getLatestRemark: params => vm.$u.http.get( freightAPI + '/freightOrder/getLatestRemark', params), // 使用的历史备注 }, freightMaRecord: { add: params => vm.$u.http.post( freightAPI + '/freightMaRecord/add', params,{custom: {toast:true}}), // 出发到达记录日志 diff --git a/manifest.json b/manifest.json index c7bfd6b..f94d780 100644 --- a/manifest.json +++ b/manifest.json @@ -24,7 +24,10 @@ "scope.userLocation" : { "desc" : "获取位置信息" } - } + }, + "requiredPrivateInfos": [ + "chooseLocation" + ] }, "mp-alipay" : { "usingComponents" : true, diff --git a/pages.json b/pages.json index d72f565..bac2217 100644 --- a/pages.json +++ b/pages.json @@ -73,6 +73,12 @@ } }, { + "path": "pages/order/select-remark", + "style": { + "navigationBarTitleText": "填写备注" + } + }, + { "path": "pages/settlement/index", "style": { "navigationBarTitleText": "支付申请", @@ -169,6 +175,12 @@ "style": { "navigationBarTitleText": "选择地址" } + }, + { + "path": "search-driver", + "style": { + "navigationBarTitleText": "选择司机" + } } ] } diff --git a/pages/global/search-address.vue b/pages/global/search-address.vue index bc7f355..9cfe88a 100644 --- a/pages/global/search-address.vue +++ b/pages/global/search-address.vue @@ -115,15 +115,77 @@ export default { }, // 地图选点 selectLocation() { - uni.$once('webview-select', location => { - this.onSelect(location); + wx.chooseLocation({ + latitude: this.lat ? Number(this.lat) : undefined, + longitude: this.lng ? Number(this.lng) : undefined, + }).then(res => { + uni.request({ + url: 'https://restapi.amap.com/v3/geocode/regeo', //逆地理编码接口地址。 + data: { + key: '1b987a62e5685a58cda5933e1bc66044', + location: res.longitude + ',' + res.latitude, + }, + success: response => { + console.info(response); + const regeocode = response?.data?.regeocode || {}; + const addressComponent = regeocode?.addressComponent || {}; + const addressInfo = this.getAddress(response?.data); + let location = { + lng: res.longitude || '', + lat: res.latitude || '', + provinceCode: addressComponent.pcode, + provinceName: addressComponent.pname, + areaCode: addressComponent.adcode, + areaName: addressComponent.district, + address: addressInfo.address, + }; + this.onSelect(location); + }, + }); + // let location = { + // lng: res.longitude || '', + // lat: res.latitude || '', + // provinceCode: '', + // provinceName: '', + // cityCode: '', + // cityName: '', + // areaCode: '', + // areaName: '', + // address: res.address || '', + // }; + // this.onSelect(location); }); - const url = 'https://zeyi-tms-product.oss-cn-hangzhou.aliyuncs.com/webview/location-wx-freight.html'; - const params = { - lat: this.lat ? Number(this.lat) : '', - lng: this.lng ? Number(this.lng) : '', + // uni.$once('webview-select', location => { + // this.onSelect(location); + // }); + // const url = 'https://zeyi-tms-product.oss-cn-hangzhou.aliyuncs.com/webview/location-wx-freight.html'; + // const params = { + // lat: this.lat ? Number(this.lat) : '', + // lng: this.lng ? Number(this.lng) : '', + // }; + // uni.navigateTo({ url: `/pages/common/webview?url=${url}&query=${JSON.stringify(params)}` }); + }, + // 格式化地址 + getAddress(geo) { + const { regeocode = {} } = geo || {}; + const { addressComponent = {} } = regeocode || {}; + const { province, city, district, township, streetNumber } = addressComponent || {}; + const { street, number } = streetNumber || {}; + const formattedAddress = regeocode.formatted_address || regeocode.formattedAddress || ''; + let amapAddress = formattedAddress.replace(province, ''); + amapAddress = amapAddress.replace(city, ''); + amapAddress = amapAddress.replace(district, ''); + amapAddress = amapAddress.replace(township, ''); + amapAddress = amapAddress.replace(street, ''); + amapAddress = amapAddress.replace(number, ''); + return { + formattedAddress, + fullAddress: `${province}${city}${district}${township}${street}${number}`, + address: `${township}${street}${number}${amapAddress}`, + amapAddress, + adcode: addressComponent.adcode, + township, }; - uni.navigateTo({ url: `/pages/common/webview?url=${url}&query=${JSON.stringify(params)}` }); }, }, }; diff --git a/pages/global/search-driver.vue b/pages/global/search-driver.vue new file mode 100644 index 0000000..d3cb1be --- /dev/null +++ b/pages/global/search-driver.vue @@ -0,0 +1,87 @@ + + + + + diff --git a/pages/order/add.vue b/pages/order/add.vue index 3c46c38..b88c3be 100644 --- a/pages/order/add.vue +++ b/pages/order/add.vue @@ -13,8 +13,8 @@ - - + + @@ -45,26 +45,43 @@ - - - - - - - {{ form.driverName }} - - + + + + + + + {{ form.driverName }} + + + + + + 搜索选择 + + - - - - - - + + + + + + + + + + + + + + 粘贴识别 + + @@ -140,9 +157,20 @@ 下单并指派 - + + + + @@ -159,7 +187,9 @@ export default { return { loading: false, showModal: '', + showModal2: '', content: '', + content2: '', carNumber: '', showLoadTime: false, loadTimeDef: new Date(), @@ -190,6 +220,7 @@ export default { distance: '', allowDriverSeeFreightAmountNode: '', waypoints: [{}, {}], + remark: '', }, payeeModel: {}, driverObj: {}, //司机信息 @@ -223,24 +254,7 @@ export default { methods: { clipboard(data) { if (!data) return; - let mobileReg = /1[3456789]\d{9}/; - let vehicleReg = /[京津冀晋蒙辽吉黑沪苏浙皖闽赣鲁豫鄂湘粤桂琼川贵云渝藏陕甘青宁新]{1}[ABCDEFGHJKLMNOPQRSTUVWXY]{1}[0-9A-Z]{5,6}/; - let trailerReg = /[京津冀晋蒙辽吉黑沪苏浙皖闽赣鲁豫鄂湘粤桂琼川贵云渝藏陕甘青宁新]{1}[ABCDEFGHJKLMNPQRSTUVWXY]{1}[0-9A-Z]{4}[挂超]{1}/; - let mobile = mobileReg.exec(data.toUpperCase()); - let vehicle = vehicleReg.exec(data.toUpperCase()); - let trailer = trailerReg.exec(data.toUpperCase()); - let cliMobile = '', - cliVehicle = '', - cliTrailer = ''; - if (mobile && mobile.input) { - cliMobile = mobile[0]; - } - if (vehicle && vehicle.input) { - cliVehicle = vehicle[0]; - } - if (trailer && trailer.input) { - cliTrailer = trailer[0]; - } + let { cliMobile = '', cliVehicle = '', cliTrailer = '' } = this.getClipboardInfo(data); if (cliMobile || cliVehicle || cliTrailer) { this.form = { ...this.form, @@ -263,14 +277,47 @@ export default { } } }, - cliCancel() { - this.showModal = false; + getClipboardInfo(data) { + if (!data) return; + let mobileReg = /1[3456789]\d{9}/; + let vehicleReg = /[京津冀晋蒙辽吉黑沪苏浙皖闽赣鲁豫鄂湘粤桂琼川贵云渝藏陕甘青宁新]{1}[ABCDEFGHJKLMNOPQRSTUVWXY]{1}[0-9A-Z]{5,6}/; + let trailerReg = /[京津冀晋蒙辽吉黑沪苏浙皖闽赣鲁豫鄂湘粤桂琼川贵云渝藏陕甘青宁新]{1}[ABCDEFGHJKLMNPQRSTUVWXY]{1}[0-9A-Z]{4}[挂超]{1}/; + let mobile = mobileReg.exec(data.toUpperCase()); + let vehicle = vehicleReg.exec(data.toUpperCase()); + let trailer = trailerReg.exec(data.toUpperCase()); + let cliMobile = '', + cliVehicle = '', + cliTrailer = ''; + if (mobile && mobile.input) { + cliMobile = mobile[0]; + } + if (vehicle && vehicle.input) { + cliVehicle = vehicle[0]; + } + if (trailer && trailer.input) { + cliTrailer = trailer[0]; + } + return { + cliMobile, + cliVehicle, + cliTrailer, + text: `${cliVehicle ? '车牌号:' : ''}${cliVehicle}\n${cliTrailer ? '车挂号:' : ''}${cliTrailer}\n${cliMobile ? '司机手机号:' : ''}${cliMobile}`, + }; }, cliSubmit() { - this.clipboard(this.content); - this.cliCancel(); + this.showModal = false; + let resInfo = this.getClipboardInfo(this.content); + if (resInfo.text) { + this.showModal2 = true; + this.content2 = resInfo.text; + } else { + uni.showToast({ title: '未识别到信息' }); + } + }, + cliSubmit2() { + this.showModal2 = false; + this.clipboard(this.content2); }, - initConfig() { uni.$u.api.freightOrder.currentFreight({}).then(en => { this.currentFreight = en?.result || {}; @@ -315,6 +362,28 @@ export default { this.computedDistance(); }); }, + selectRemark() { + uni.$once('select-remark', remark => { + console.info(remark); + this.form.remark = remark || ''; + }); + uni.navigateTo({ + url: `/pages/order/select-remark`, + }); + }, + choseDriver() { + uni.$once('select-driver', driver => { + this.form.driverName = driver.name; + this.form.driverMobile = driver.mobile; + this.form.mobile = driver.mobile; + if (driver.mobile) { + this.mobileChange(); + } + }); + uni.navigateTo({ + url: `/pages/global/search-driver`, + }); + }, choseProjectCode() { uni.$once('select-common', option => { this.form.projectCode = option.code; @@ -584,6 +653,12 @@ export default { } } } + .action-text { + background: #f6f8fb; + color: #2673fb; + font-size: 24upx; + padding: 2upx 4upx; + } } } diff --git a/pages/order/select-remark.vue b/pages/order/select-remark.vue new file mode 100644 index 0000000..c5c044e --- /dev/null +++ b/pages/order/select-remark.vue @@ -0,0 +1,70 @@ + + + + diff --git a/pages/settlement/index.vue b/pages/settlement/index.vue index 83b69c7..f73f837 100644 --- a/pages/settlement/index.vue +++ b/pages/settlement/index.vue @@ -1,5 +1,5 @@