From 3a57b78e4de42dbb934d3ecf12006c47f1ff52de Mon Sep 17 00:00:00 2001 From: yangan <yangan0921@163.com> Date: 星期一, 30 十二月 2024 10:36:18 +0800 Subject: [PATCH] feat:临时司机填原发限制&分配吨数输入框修改类型 --- pages/driver-page/delivery-my/delivery-my/delivery-my.vue | 420 +++++++++++++++++++++++++++++++++++++++-------------------- 1 files changed, 276 insertions(+), 144 deletions(-) diff --git a/pages/driver-page/delivery-my/delivery-my/delivery-my.vue b/pages/driver-page/delivery-my/delivery-my/delivery-my.vue index ae3efb0..8aa752c 100644 --- a/pages/driver-page/delivery-my/delivery-my/delivery-my.vue +++ b/pages/driver-page/delivery-my/delivery-my/delivery-my.vue @@ -31,20 +31,32 @@ placeholder="璇疯緭鍏ュ唴瀹�" clearable></u--input> </u-form-item> + <u-form-item label="鏄惁鏈夎溅鐗�" + labelWidth="28%" + borderBottom + > + <u-radio-group + v-model="isCarNo" + @change="radioChange" + placement="row"> + <u-radio labelSize="26" iconSize="40" label="鏄�" name="鏄�" style="margin-right: 30rpx;"></u-radio> + <u-radio labelSize="26" iconSize="40" label="鍚�" name="鍚�"></u-radio> + </u-radio-group> + </u-form-item> <u-form-item prop="carNo" + v-if="isCarNo == '鏄�'" label="杞︾墝鍙�" labelWidth="20%" borderBottom > - <u--input v-model="registerFormModel.carNo" - placeholder="璇疯緭鍏ュ唴瀹�" - clearable></u--input> + <xm-cell special label="杞︾墝鍙�" :value="registerFormModel.carNo" @show="showKeyboard('xmKeyboard')"></xm-cell> + <xm-keyboard-v2 ref="xmKeyboard" @confirm="(v) => registerFormModel.carNo = v"></xm-keyboard-v2> </u-form-item> <u-form-item prop="skin" label="鐨噸" labelWidth="20%" borderBottom - required v-if="daydata.isWeighing==1"> + required v-if="(daydata.isWeighing==1&&daydata.productId=='1818237609508347905')||(daydata.isWeighing==1&&daydata.productId=='1818237832536268801')||(daydata.isWeighing==1&&daydata.productId=='1818211942485995521')"> <u--input v-model="skin" border="surround" placeholder="璇疯緭鍏ョ毊閲�" @@ -54,7 +66,7 @@ label="姣涢噸" labelWidth="20%" borderBottom - required v-if="daydata.isWeighing==1"> + required v-if="(daydata.isWeighing==1&&daydata.productId=='1818237609508347905')||(daydata.isWeighing==1&&daydata.productId=='1818237832536268801')||(daydata.isWeighing==1&&daydata.productId=='1818211942485995521')"> <u--input v-model="hair" border="surround" placeholder="璇疯緭鍏ユ瘺閲�" @@ -64,7 +76,7 @@ label="鍑�閲�" labelWidth="20%" borderBottom - required v-if="daydata.isWeighing==1"> + required v-if="(daydata.isWeighing==1&&daydata.productId=='1818237609508347905')||(daydata.isWeighing==1&&daydata.productId=='1818237832536268801')||(daydata.isWeighing==1&&daydata.productId=='1818211942485995521')"> <u--input v-model="clean" border="surround" disabled @@ -74,7 +86,7 @@ <uni-table border id="table-box" - emptyText="鏆傛棤鏇村鏁版嵁" v-if="daydata.isWeighing==0"> + emptyText="鏆傛棤鏇村鏁版嵁" v-if="daydata.isWeighing == 0 && daydata.productNames.split(',').length <= 1"> <uni-tr> <uni-th align="center" >浜у搧</uni-th> <uni-th align="center">鏁伴噺</uni-th> @@ -92,9 +104,9 @@ </view></uni-td> </uni-tr> </uni-table> - <u-form-item prop='contactPicture'> + <!-- <u-form-item prop='contactPicture'> <view class="label-text"> - <text style="color: #f56c6c;">*</text>鍘熷彂鍗曟嵁 + 鍘熷彂鍗曟嵁 </view> <u-upload :fileList="fileList1" @afterRead="afterRead" @@ -106,7 +118,7 @@ height="150" :previewFullImage="true" ></u-upload> - </u-form-item> + </u-form-item> --> <!-- <u-form-item labelWidth="20%" label="绌鸿溅鍑哄巶" borderBottom @@ -199,6 +211,14 @@ </uni-tr> </uni-table> </view> + <view class="logoutModel"> + <u-modal :show="logoutShow" + :title="logoutTitle" + showCancelButton + :content="logoutContent" + @confirm="logoutConfirm" + @cancel="logoutCancel"></u-modal> + </view> </view> </template> @@ -217,7 +237,7 @@ if (params.id) { this.id = params.id } - this.fileList1 = [] + // this.fileList1 = [] this.GetMyDelivery() uni.getStorage({ key: 'myDelivery', @@ -225,18 +245,31 @@ Object.assign(that.registerFormModel, res.data) } }); + uni.getStorage({ + key: 'isshow', + success: function (res) { + that.isshow=res.data + } + }); + this.ids=null }, data() { return { + ids:null, + logoutShow: false, + logoutTitle: '鎻愮ず', + logoutContent: '鍏ュ満闇�瑕佹壂鎻忚溅鐗岀収鍜屽埛韬唤璇佸叆鍦猴紝璇锋惡甯﹁韩浠借瘉鍘熶欢', + isshow:true, scrollTop: 0, id:"", value: 0, + isCarNo:'鏄�', daydata:{}, tmTaskCoalList:[], range: [{"value": 0,"label": "鍚�" },{"value": 1,"label": "鏄�"}], carNumShow: false, yuYueData: [], - fileList1: [], //鍥剧墖鍒楄〃 + // fileList1: [], //鍥剧墖鍒楄〃 contactPicture:"", registerFormModel: { phone: '', @@ -299,23 +332,30 @@ trigger: ['change', 'blur'] } ], - // carNo: [{ - // type: 'string', - // required: true, - // message: '璇疯緭鍏ヨ溅鐗屽彿', - // trigger: ['blur', 'change'] - // }, - // { - // transform(value) { - // return String(value); - // }, - // validator: (rule, value, callback) => { - // return uni.$u.test.carNo(value); - // }, - // message: '璇疯緭鍏ユ纭殑杞︾墝鍙�', - // trigger: ['change', 'blur'] - // } - // ], + idNumber: [{ + type: 'string', + required: true, + message: '璇疯緭鍏ヨ韩浠借瘉鍙�', + trigger: ['blur', 'change'] + } + ], + carNo: [{ + type: 'string', + required: true, + message: '璇疯緭鍏ヨ溅鐗屽彿', + trigger: ['blur', 'change'] + }, + { + transform(value) { + return String(value); + }, + validator: (rule, value, callback) => { + return uni.$u.test.carNo(value); + }, + message: '璇疯緭鍏ユ纭殑杞︾墝鍙�', + trigger: ['change', 'blur'] + } + ], }, }; }, @@ -342,6 +382,9 @@ }, methods: { ...mapMutations(['changeisUploadimg']), + showKeyboard(ref){ + this.$refs[ref].toShow(this.registerFormModel.carNo) + }, // input鑱氱劍 inputFocus(v) { if (v == 1) { @@ -361,90 +404,132 @@ this.isInputOrigin = true; } }, - deletePic(event) { - this.changeisUploadimg(true); - this[`fileList${event.name}`].splice(event.index, 1); - }, - async afterRead(event) { - // 褰撹缃� mutiple 涓� true 鏃�, file 涓烘暟缁勬牸寮忥紝鍚﹀垯涓哄璞℃牸寮� - let lists = [].concat(event.file); - let fileListLen = this[`fileList${event.name}`].length; - lists.map(item => { - this[`fileList${event.name}`].push({ - ...item, - status: 'uploading', - message: '涓婁紶涓�' - }); - }); - for (let i = 0; i < lists.length; i++) { - const result = await this.uploadFilePromise(lists[i].url, event.name); - let item = this[`fileList${event.name}`][fileListLen]; - this[`fileList${event.name}`].splice( - fileListLen, - 1, - Object.assign(item, { - status: 'success', - message: '涓婁紶鎴愬姛', - url: result - }) - ); - fileListLen++; - } - }, - uploadFilePromise(url, num) { - return new Promise((resolve, reject) => { - let a = uni.uploadFile({ - url: BaseUrl + '/admin/sys-file/uploadUnToken', - filePath: url, - name: 'file', - success: res => { - if (num == 1) { - this.contactPicture = JSON.parse(res.data) - .data.url; - resolve(`${BaseUrl}${JSON.parse(res.data).data.url}`); - } - } - }); - }); - }, - yuYueBtnClick(item){ + // deletePic(event) { + // this.changeisUploadimg(true); + // this[`fileList${event.name}`].splice(event.index, 1); + // }, + // async afterRead(event) { + // // 褰撹缃� mutiple 涓� true 鏃�, file 涓烘暟缁勬牸寮忥紝鍚﹀垯涓哄璞℃牸寮� + // let lists = [].concat(event.file); + // let fileListLen = this[`fileList${event.name}`].length; + // lists.map(item => { + // this[`fileList${event.name}`].push({ + // ...item, + // status: 'uploading', + // message: '涓婁紶涓�' + // }); + // }); + // for (let i = 0; i < lists.length; i++) { + // const result = await this.uploadFilePromise(lists[i].url, event.name); + // let item = this[`fileList${event.name}`][fileListLen]; + // this[`fileList${event.name}`].splice( + // fileListLen, + // 1, + // Object.assign(item, { + // status: 'success', + // message: '涓婁紶鎴愬姛', + // url: result + // }) + // ); + // fileListLen++; + // } + // }, + // uploadFilePromise(url, num) { + // return new Promise((resolve, reject) => { + // let a = uni.uploadFile({ + // url: BaseUrl + '/admin/sys-file/uploadUnToken', + // filePath: url, + // name: 'file', + // success: res => { + // if (num == 1) { + // this.contactPicture = JSON.parse(res.data) + // .data.url; + // resolve(`${BaseUrl}${JSON.parse(res.data).data.url}`); + // } + // } + // }); + // }); + // }, + lohOutLogin(){ this.$refs.regesterFormRef.validate().then(res => { - if(this.daydata.orderType=='澶栬喘'){ - if(this.daydata.isWeighing==1){ - this.$reqPost('saveMyDelivery',{ - productName:this.daydata.productName, - customerId:this.daydata.customerId, - deptId:this.daydata.deptId, - filedId:this.daydata.filedId, - orderPlanId:this.daydata.id, - orderTye:this.daydata.orderType, - sendDate:this.daydata.sendDate, - carNumSurplus:this.daydata.carNumSurplus, - yyId:item.id, - ...this.registerFormModel, - tmTaskCoalContact:{ - coalName:this.daydata.productName, - contactPicture:this.contactPicture, - skin:this.skin, - hair:this.hair, - clean:this.clean - } - }, 'json').then(res => { - uni.setStorage({ - key: 'myDelivery', - data: this.registerFormModel, - }); - if (res.code === 0) { - uni.$u.toast('棰勭害鎴愬姛') - this.GetMyDelivery() - } else { - uni.$u.toast(res.msg ? res.msg : '棰勭害澶辫触') - } - }) + if(this.daydata.orderType=='澶栬喘'){ + if(this.daydata.isWeighing==1){ + this.$reqPost('saveMyDelivery',{ + productName:this.daydata.productName, + customerId:this.daydata.customerId, + deptId:this.daydata.deptId, + filedId:this.daydata.filedId, + orderPlanId:this.daydata.id, + orderTye:this.daydata.orderType, + sendDate:this.daydata.sendDate, + carNumSurplus:this.daydata.carNumSurplus, + yyId:this.ids.id, + ...this.registerFormModel, + tmTaskCoalContact:{ + coalName:this.daydata.productName, + // contactPicture:this.contactPicture, + skin:this.skin, + hair:this.hair, + clean:this.clean + } + }, 'json').then(res => { + uni.setStorage({ + key: 'myDelivery', + data: this.registerFormModel, + }); + uni.setStorage({ + key: 'isshow', + data: false, + }); + this.logoutShow=false + this.isshow=false + if (res.code === 0) { + uni.$u.toast('棰勭害鎴愬姛') + this.GetMyDeliverys() + } else { + uni.$u.toast(res.msg ? res.msg : '棰勭害澶辫触') + } + }) + }else{ + let numDtoList=this.tmTaskCoalList.map(item=>{ + return {tmId:item.productId,num:item.productQuantity,coalName:item.coalName} + }) + this.$reqPost('saveMyDelivery',{ + productName:this.daydata.productName, + customerId:this.daydata.customerId, + deptId:this.daydata.deptId, + filedId:this.daydata.filedId, + orderPlanId:this.daydata.id, + orderTye:this.daydata.orderType, + sendDate:this.daydata.sendDate, + carNumSurplus:this.daydata.carNumSurplus, + yyId:this.ids.id, + ...this.registerFormModel, + tmTaskCoalContact:{ + // contactPicture:this.contactPicture, + numDtoList:numDtoList + } + }, 'json').then(res => { + uni.setStorage({ + key: 'myDelivery', + data: this.registerFormModel, + }); + uni.setStorage({ + key: 'isshow', + data: false, + }); + this.logoutShow=false + this.isshow=false + if (res.code === 0) { + uni.$u.toast('棰勭害鎴愬姛') + this.GetMyDeliverys() + } else { + uni.$u.toast(res.msg ? res.msg : '棰勭害澶辫触') + } + }) + } + }else{ - let numDtoList=this.tmTaskCoalList.map(item=>{ - return {tmId:item.productId,num:item.productQuantity,coalName:item.coalName} - }) this.$reqPost('saveMyDelivery',{ productName:this.daydata.productName, customerId:this.daydata.customerId, @@ -454,52 +539,88 @@ orderTye:this.daydata.orderType, sendDate:this.daydata.sendDate, carNumSurplus:this.daydata.carNumSurplus, - yyId:item.id, - ...this.registerFormModel, - tmTaskCoalContact:{ - contactPicture:this.contactPicture, - numDtoList:numDtoList - } + yyId:this.ids.id, + ...this.registerFormModel }, 'json').then(res => { uni.setStorage({ key: 'myDelivery', data: this.registerFormModel, }); + uni.setStorage({ + key: 'isshow', + data: false, + }); + this.logoutShow=false + this.isshow=false if (res.code === 0) { uni.$u.toast('棰勭害鎴愬姛') - this.GetMyDelivery() + this.GetMyDeliverys() } else { uni.$u.toast(res.msg ? res.msg : '棰勭害澶辫触') } }) } - - }else{ - this.$reqPost('saveMyDelivery',{ - productName:this.daydata.productName, - customerId:this.daydata.customerId, - deptId:this.daydata.deptId, - filedId:this.daydata.filedId, - orderPlanId:this.daydata.id, - orderTye:this.daydata.orderType, - sendDate:this.daydata.sendDate, - carNumSurplus:this.daydata.carNumSurplus, - yyId:item.id, - ...this.registerFormModel - }, 'json').then(res => { - uni.setStorage({ - key: 'myDelivery', - data: this.registerFormModel, - }); - if (res.code === 0) { - uni.$u.toast('棰勭害鎴愬姛') - this.GetMyDelivery() - } else { - uni.$u.toast(res.msg ? res.msg : '棰勭害澶辫触') - } - }) - } }) + }, + logoutConfirm() { + //鍘熷彂鍑�閲嶉檺鍒� + if(this.clean && this.clean > 200){ + this.$u.toast('褰撳墠鍑�閲嶈秴杩囨甯稿�硷紝璇锋鏌ョ毊姣涢噸') + return + + } + if(this.registerFormModel.carNo==""){ + this.lohOutLogin() + }else{ + if(this.registerFormModel.carNo){ + var xreg=/^[浜触娌笣鍐�璞簯杈介粦婀樼殩椴佹柊鑻忔禉璧i剛妗傜敇鏅嬭挋闄曞悏闂借吹绮ら潚钘忓窛瀹佺惣浣块A-Z]{1}[A-Z]{1}(([0-9]{5}[DF]$)|([DF][A-HJ-NP-Z0-9][0-9]{4}$))/; + var creg=/^[浜触娌笣鍐�璞簯杈介粦婀樼殩椴佹柊鑻忔禉璧i剛妗傜敇鏅嬭挋闄曞悏闂借吹绮ら潚钘忓窛瀹佺惣浣块A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9鎸傚璀︽腐婢砞{1}$/; + if(this.registerFormModel.carNo.length == 7){ + if(!creg.test(this.registerFormModel.carNo)) { + uni.$u.toast('璇疯緭鍏ユ纭殑杞︾墝鍙�') + }else { + this.lohOutLogin() + } + } else if(this.registerFormModel.carNo.length == 8){ + if(!xreg.test(this.registerFormModel.carNo)) { + uni.$u.toast('璇疯緭鍏ユ纭殑杞︾墝鍙�') + }else { + this.lohOutLogin() + } + }else { + uni.$u.toast('璇疯緭鍏ユ纭殑杞︾墝鍙�') + } + } + } + }, + logoutCancel() { + this.logoutShow = false; + }, + yuYueBtnClick(item){ + this.$refs.regesterFormRef.validate().then(res => { + if(this.isshow){ + this.logoutShow = true; + this.ids=item + }else{ + this.ids=item + this.logoutConfirm(); + } + }) + }, + GetMyDeliverys() { + this.$reqGet('driverYuYueList', {orderPlanId:this.id}).then(res => { + if (res.code == 0) { + this.yuYueData = res.data; + } else { + this.$u.toast('鍔犺浇澶辫触'); + } + }); + this.$reqGetId('myDelivery',this.id).then(res => { + if (res.data) { + this.daydata=res.data + this.tmTaskCoalList=res.data.jhOrderPlanList + } + }); }, GetMyDelivery() { uni.showLoading({ @@ -519,6 +640,17 @@ this.tmTaskCoalList=res.data.jhOrderPlanList } }); + }, + // + radioChange(name){ + console.log(name,'name'); + if(name === '鏄�'){ + this.registerFormModel.carNo = ''; + }else{ + this.registerFormModel.carNo = ''; + + } + } } }; -- Gitblit v1.9.1