From 75811022288e2c4832974a1586f442608706c30a Mon Sep 17 00:00:00 2001 From: yangan <yangan0921@163.com> Date: 星期四, 12 九月 2024 17:40:10 +0800 Subject: [PATCH] feat:司机接单pvc吨数提示 --- pages/driver-page/delivery-my/delivery-my/delivery-my.vue | 628 ++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 529 insertions(+), 99 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 a0898d4..33c5c44 100644 --- a/pages/driver-page/delivery-my/delivery-my/delivery-my.vue +++ b/pages/driver-page/delivery-my/delivery-my/delivery-my.vue @@ -35,53 +35,178 @@ label="杞︾墝鍙�" labelWidth="20%" borderBottom - required> + > <u--input v-model="registerFormModel.carNo" placeholder="璇疯緭鍏ュ唴瀹�" clearable></u--input> </u-form-item> - <u-form-item prop="carNo" - label="鏄惁鍏ュ満" + <u-form-item prop="skin" + label="鐨噸" labelWidth="20%" borderBottom - required> - <uni-data-checkbox v-model="value" :localdata="range" @change="change"></uni-data-checkbox> + required v-if="daydata.isWeighing==1"> + <u--input v-model="skin" + border="surround" + placeholder="璇疯緭鍏ョ毊閲�" + clearable></u--input> </u-form-item> - + <u-form-item prop="hair" + label="姣涢噸" + labelWidth="20%" + borderBottom + required v-if="daydata.isWeighing==1"> + <u--input v-model="hair" + border="surround" + placeholder="璇疯緭鍏ユ瘺閲�" + clearable></u--input> + </u-form-item> + <u-form-item prop="clean" + label="鍑�閲�" + labelWidth="20%" + borderBottom + required v-if="daydata.isWeighing==1"> + <u--input v-model="clean" + border="surround" + disabled + placeholder="璇疯緭鍏ュ噣閲�" + clearable></u--input> + </u-form-item> + <uni-table + border + id="table-box" + emptyText="鏆傛棤鏇村鏁版嵁" v-if="daydata.isWeighing==0"> + <uni-tr> + <uni-th align="center" >浜у搧</uni-th> + <uni-th align="center">鏁伴噺</uni-th> + </uni-tr> + <uni-tr v-for="(subItem, index) in tmTaskCoalList" :key="index"> + <uni-td align="center"> + <view class="name">{{ subItem.productName }}</view></uni-td> + 聽 <uni-td align="right"> + <view> + <u--input + placeholder="璇疯緭鍏ヤ骇鍝佹暟閲�" + type='number' + v-model="subItem.productQuantity" + ></u--input> + </view></uni-td> + </uni-tr> + </uni-table> + <u-form-item prop='contactPicture'> + <view class="label-text"> + <text style="color: #f56c6c;">*</text>鍘熷彂鍗曟嵁 + </view> + <u-upload :fileList="fileList1" + @afterRead="afterRead" + @delete="deletePic" + name="1" + multiple + :maxCount="2" + width="250" + height="150" + :previewFullImage="true" + ></u-upload> + </u-form-item> + <!-- <u-form-item labelWidth="20%" + label="绌鸿溅鍑哄巶" + borderBottom + ref="roleRef" + required> + <u-radio-group v-model="registerFormModel.isEmptyCar" + placement="row" + size="30" + shape="circle" + iconSize="20"> + <u-radio labelSize="14px" + size="20px" + v-for="(item, index) in radiolist1" + :key="index" + :label="item.name" + :name="item.value" + ></u-radio> + </u-radio-group> + </u-form-item> --> </u--form> </view> - <view class="details"> - <view class="title"><text>閰嶉�侀�夋嫨</text></view> - <view class=""> - <uni-table border - stripe - emptyText="鏆傛棤鏇村鏁版嵁"> - <uni-tr> - <uni-th align="center">渚涘簲鍟�</uni-th> - <uni-th align="center">浜у搧</uni-th> - <uni-th align="center">杞︽暟</uni-th> - <uni-th align="center">鎿嶄綔</uni-th> - </uni-tr> - <uni-tr v-for="(item, index) in TableData" - :key="item.id"> - <uni-td align="center">{{ item.customerName || '' }}</uni-td> - <uni-td align="center">{{ item.productName||'' }}</uni-td> - <uni-td align="center">{{ item.carNum || '' }}</uni-td> - <uni-td><u-button text="閫夋嫨" - type="primary" - :disabled="item.carNum == item.carNum1" - @click="yuYueBtnClick(item)"></u-button></uni-td> - </uni-tr> - </uni-table> + <!-- <view class="history-numbers"> + <scroll-view :scroll-top="scrollTop" + scroll-y="true" + class="scroll-Y" + > + <view class="history-information" + > + <view class="first"> + <view class="">{{ daydata.customerName || '' }}</view> + <view class=""><u-icon name="arrow-right" + color="#999999" + size="40"></u-icon></view> + </view> + <view class="second"> + <view class="coal-name">{{ daydata.productName || '' }}</view> + <view class="order-type">{{ daydata.orderType || '' }}</view> + </view> + <view class="third"> + <view class="third-line"> + <view class="third-line_text">棰嗗彇鏁�:</view> + <view class="third-line_num">{{ daydata.cars2 }}</view> + </view> + <view class="third-line"> + <view class="third-line_text">鍓╀綑鏁�:</view> + <view class="third-line_num" + >{{ daydata.carNumSurplus1 }}</view> + </view> + </view> + <view class="fourth"> + <view class="fourth-icon"> + <view + style="width: 24rpx;height: 24rpx;line-height: 24rpx;background: url('https://wrzs.czjlchem.com:9090/appimg/image/banner/clock.png') no-repeat;background-size: cover"> + </view> + </view> + <view class="senddate">{{ daydata.sendDate }}</view> + </view> + <view class="fourth"> + <view class="fourth-icon"> + <view + style="width: 26rpx;height: 26rpx;line-height: 26rpx;background: url('https://wrzs.czjlchem.com:9090/appimg/image/banner/carnNUm.png') no-repeat;background-size: cover;"> + </view> + </view> + <view class="senddate">{{ daydata.orderCode }}</view> + </view> + </view> + </scroll-view> + </view> --> + <combined-title + :title="yuYueData.length != 0 ? yuYueData[0].filedName + '鈥斺��' + yuYueData[0].sendDate : '鏆傛棤棰勭害鍒楄〃'"></combined-title> + <view class="appointment-table"> + <uni-table border + stripe + emptyText="鏆傛棤鏇村鏁版嵁"> + <uni-tr> + <uni-th align="center">鏃堕棿娈�</uni-th> + <uni-th align="center">鍙绾�</uni-th> + <uni-th align="center">宸查绾�</uni-th> + <uni-th align="center">鎿嶄綔</uni-th> + </uni-tr> + <uni-tr v-for="(item, index) in yuYueData" + :key="item.id"> + <uni-td align="center">{{ (item.startTime || '') + '-' + (item.endTime || '') }}</uni-td> + <uni-td align="center">{{ item.carNum || '' }}</uni-td> + <uni-td align="center">{{ item.carNum1 || '' }}</uni-td> + <uni-td><u-button text="閫夋嫨" + type="primary" + :disabled="item.carNum == item.carNum1&&!isRCSQ" + @click="yuYueBtnClick(item)"></u-button></uni-td> + </uni-tr> + </uni-table> </view> - </view> - </view> </template> <script> import { apiRegister } from '@/api/publicInterface.js'; import { mapMutations } from 'vuex'; + import { BaseUrl } from '@/api/publicInterface.js'; + import BigNumber from "bignumber.js" export default { // 鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚銆傛敞鎰忓鏋滄覆鏌撻�熷害蹇紝浼氬湪椤甸潰杩涘叆鍔ㄧ敾瀹屾垚鍓嶈Е鍙� onReady() { @@ -89,6 +214,10 @@ }, onLoad(params) { let that=this + if (params.id) { + this.id = params.id + } + this.fileList1 = [] this.GetMyDelivery() uni.getStorage({ key: 'myDelivery', @@ -99,23 +228,46 @@ }, data() { return { + scrollTop: 0, + id:"", value: 0, - range: [{"value": 0,"text": "鍚�" },{"value": 1,"text": "鏄�"}], + daydata:{}, + tmTaskCoalList:[], + range: [{"value": 0,"label": "鍚�" },{"value": 1,"label": "鏄�"}], carNumShow: false, + yuYueData: [], + fileList1: [], //鍥剧墖鍒楄〃 + contactPicture:"", registerFormModel: { phone: '', driver: '', idNumber: '', carNo: '', }, + skin:"", + hair:"", TableData:[], + radiolist1: [{ + name: '鍚�', + value:"0" + }, + { + name: '鏄�', + value:"1" + } + ], rules: { - driver: { + driver: [{ type: 'string', required: true, message: '璇峰~鍐欏鍚�', trigger: ['blur', 'change'] }, + { + pattern: /^[\u4e00-\u9fa5\s]+$/, + message: '濮撳悕鍙兘鏄腑鏂�', + trigger: ['blur', 'change'] + }], idNumber: [{ type: 'string', required: true, @@ -147,59 +299,239 @@ 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'] - } - ], + // 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'] + // } + // ], }, }; }, + computed:{ + clean() { + if(this.daydata.isWeighing==1){ + let xx = BigNumber(this.hair ? this.hair : 0) + let yy = BigNumber(this.skin ? this.skin : 0) + return xx.minus(yy).toNumber() > 0 ? xx.minus(yy).toNumber().toFixed(2) : 0 + }else{ + //鏁伴噺 + if(!this.tmTaskCoalList.length){ + return false + }else{ + const reslut = this.tmTaskCoalList.find(item=>!item.productQuantity); + if(reslut){ + return false + }else{ + return true + } + } + } + } + }, methods: { ...mapMutations(['changeisUploadimg']), + // input鑱氱劍 + inputFocus(v) { + if (v == 1) { + this.isfocus1 = true; + } else { + this.isfocus2 = true; + } + }, + // input澶辩劍 + inputBlur() { + this.isfocus1 = false; + this.isfocus2 = false; + }, + inputChange() { + if (Number(this.originInfoForm.coalContactHair) > 0 && Number(this.originInfoForm.coalContactSkin > + 0)) { + 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){ this.$refs.regesterFormRef.validate().then(res => { - this.$reqPost('saveMyDelivery',{ - coalName:item.productName, - customerId:item.customerId, - deptId:item.deptId, - filedId:item.filedId, - orderPlanId:item.id, - orderTye:item.orderType, - sendDate:item.sendDate, - ...this.registerFormModel - }, 'json').then(res => { - uni.setStorage({ - key: 'myDelivery', - data: this.registerFormModel, - }); - if (res.code === 0) { - uni.$u.toast('棰勭害鎴愬姛') - - } 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: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.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:item.id, + ...this.registerFormModel, + tmTaskCoalContact:{ + contactPicture:this.contactPicture, + numDtoList:numDtoList + } + }, 'json').then(res => { + uni.setStorage({ + key: 'myDelivery', + data: this.registerFormModel, + }); + if (res.code === 0) { + uni.$u.toast('棰勭害鎴愬姛') + 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.GetMyDeliverys() + } else { + uni.$u.toast(res.msg ? res.msg : '棰勭害澶辫触') + } + }) + } }) }, - GetMyDelivery() { - this.$reqGet('myDelivery').then(res => { + 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.TableData=res.data + this.daydata=res.data + this.tmTaskCoalList=res.data.jhOrderPlanList + } + }); + }, + GetMyDelivery() { + uni.showLoading({ + title: '鍔犺浇涓�...' + }); + this.$reqGet('driverYuYueList', {orderPlanId:this.id}).then(res => { + uni.hideLoading(); + 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 } }); } @@ -209,50 +541,148 @@ <style lang="scss" scoped> - ::v-deep.register { - width: 94%; - padding: 0 0 vww(20) 0; - margin: 0 auto; - .details { - margin-top: vww(24); - .title { - color: #111111; - font-weight: 400; - border: 1px solid #eeeeee; - padding: 0 vww(12) 0 vww(12); - border-bottom: none; - height: vww(40); - line-height: vww(40); - background-color: #f5f5f5; + @mixin flex { + display: flex; + justify-content: space-between; + align-items: center; + } + .history-numbers { + width: 100%; + position: relative; + top: vww(10); + + .history-information { + width: 690rpx; + height: 398rpx; + margin: vww(10) 0; + background: #ffffff; + box-shadow: 0rpx 0rpx 14rpx 0rpx rgba(73, 120, 240, 0.14), 0rpx 7rpx 45rpx 0rpx rgba(73, 120, 240, 0.12); + border-radius: 20rpx; + @include flex flex-direction: column; + align-items: flex-start; + justify-content: space-evenly; + overflow: hidden; + + .first { + width: 96%; + height: 34rpx; + font-size: 32rpx; + font-weight: 300; + color: #303030; + @include flex; + margin: vww(10) vww(10) 0; } - .uni-table-scroll { + + .second { width: 100%; - overflow-x: hidden; - .uni-table { - min-width: 0 !important; - .uni-table-tr { - padding: 0; - font-size: vww(13); + height: 31rpx; + font-size: 30rpx; + font-weight: 300; + color: #515151; + margin: vww(10) vww(10) 0; + @include flex; + justify-content: flex-start; + + .coal-name { + min-width: vww(30); + height: vww(20); + margin-right: vww(21); + } + + .order-type { + color: #035cfb; + border: 2px solid #035cfb; + border-radius: 4rpx; + padding: vww(2) vww(4); + text-align: center; + } + } + + .third { + width: 96%; + height: 31rpx; + font-size: 30rpx; + font-weight: 300; + color: #515151; + margin: vww(10) vww(10) 0; + @include flex; + + .third-line { + @include flex; + + &_text { + color: #919090; + } + + &_num { + color: #035cfb; + } + } + } + + .fourth { + width: 100%; + height: 31rpx; + font-size: 30rpx; + font-weight: 300; + color: #515151; + margin: vww(10) vww(10) 0; + @include flex; + + .fourth-icon { + width: vww(13); + height: vww(13); + margin-right: vww(14); + } + + .senddate { + flex: 1; + } + } + } + } + ::v-deep.appointment-table{ + width: 94%; + margin: 0 auto; + // 琛ㄦ牸 + .uni-table-scroll { + width: 100%; + overflow-x: hidden; + + .uni-table { + min-width: 0 !important; + + .uni-table-tr { + padding: 0; + font-size: vww(13); + .uni-table-th { height: vww(32); line-height: vww(20); - padding: vww(5) 0; + padding: vww(5) vww(10); color: #111111; font-weight: 550; background: #f5f5f5; } + .uni-table-td { height: vww(32); line-height: vww(20); padding: vww(5) vww(10); color: #111111; + .u-button { height: vww(23); } } - } } } } } + + ::v-deep.register { + width: 94%; + padding: 0 0 vww(20) 0; + margin: 0 auto; + } </style> \ No newline at end of file -- Gitblit v1.9.1