wk
2024-10-10 79f5c0a7d45842996ef5cfbc33a64a7bfd9bcbd9
pages/driver-page/delivery-my/delivery-my/delivery-my.vue
@@ -35,7 +35,7 @@
               label="车牌号"
               labelWidth="20%"
               borderBottom
               required>
               >
               <u--input v-model="registerFormModel.carNo"
                  placeholder="请输入内容"
                  clearable></u--input>
@@ -46,6 +46,7 @@
               borderBottom
               required v-if="daydata.isWeighing==1">
               <u--input v-model="skin"
               border="surround"
                  placeholder="请输入皮重"
                  clearable></u--input>
            </u-form-item>
@@ -55,6 +56,7 @@
               borderBottom
               required v-if="daydata.isWeighing==1">
               <u--input v-model="hair"
               border="surround"
                  placeholder="请输入毛重"
                  clearable></u--input>
            </u-form-item>
@@ -64,13 +66,15 @@
               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">
            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>         
@@ -90,7 +94,7 @@
               </uni-table>
               <u-form-item prop='contactPicture'>
                  <view class="label-text">
                     <text style="color: #f56c6c;">*</text>原发磅单
                     原发单据
                  </view>
                  <u-upload :fileList="fileList1"
                     @afterRead="afterRead"
@@ -155,7 +159,7 @@
               <view class="fourth">
                  <view class="fourth-icon">
                     <view
                        style="width: 24rpx;height: 24rpx;line-height: 24rpx;background: url('https://mx.jzeg.cn:9096/appimg/image/banner/clock.png') no-repeat;background-size: cover">
                        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>
@@ -163,7 +167,7 @@
               <view class="fourth">
                  <view class="fourth-icon">
                     <view
                        style="width: 26rpx;height: 26rpx;line-height: 26rpx;background: url('https://mx.jzeg.cn:9096/appimg/image/banner/carnNUm.png') no-repeat;background-size: cover;">
                        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>
@@ -195,6 +199,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>
@@ -202,6 +214,7 @@
   import { apiRegister } from '@/api/publicInterface.js';
   import { mapMutations } from 'vuex';
   import { BaseUrl } from '@/api/publicInterface.js';
   import BigNumber from "bignumber.js"
   export default {
      // 监听页面初次渲染完成。注意如果渲染速度快,会在页面进入动画完成前触发
      onReady() {
@@ -220,9 +233,21 @@
                 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,
@@ -241,7 +266,6 @@
            },
            skin:"",
            hair:"",
            clean:"",
            TableData:[],
            radiolist1: [{
                  name: '否',
@@ -295,28 +319,75 @@
                     trigger: ['change', 'blur']
                  }
               ],
               carNo: [{
               idNumber: [{
                     type: 'string',
                     required: true,
                     message: '请输入车牌号',
                     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);
@@ -363,7 +434,7 @@
               });
            });
         },
         yuYueBtnClick(item){
         logoutConfirm() {
            this.$refs.regesterFormRef.validate().then(res => {
            if(this.daydata.orderType=='外购'){
               if(this.daydata.isWeighing==1){
@@ -376,7 +447,7 @@
                     orderTye:this.daydata.orderType,
                     sendDate:this.daydata.sendDate,
                     carNumSurplus:this.daydata.carNumSurplus,
                     yyId:item.id,
                     yyId:this.ids.id,
                     ...this.registerFormModel,
                     tmTaskCoalContact:{
                        coalName:this.daydata.productName,
@@ -390,9 +461,15 @@
                         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 : '预约失败')
                     }
@@ -410,7 +487,7 @@
                     orderTye:this.daydata.orderType,
                     sendDate:this.daydata.sendDate,
                     carNumSurplus:this.daydata.carNumSurplus,
                     yyId:item.id,
                     yyId:this.ids.id,
                     ...this.registerFormModel,
                     tmTaskCoalContact:{                        
                        contactPicture:this.contactPicture,
@@ -421,9 +498,15 @@
                         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 : '预约失败')
                     }
@@ -440,16 +523,22 @@
                  orderTye:this.daydata.orderType,
                  sendDate:this.daydata.sendDate,
                  carNumSurplus:this.daydata.carNumSurplus,
                  yyId:item.id,
                  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 : '预约失败')
                  }
@@ -457,6 +546,123 @@
            }
            })
         },
         logoutCancel() {
            this.logoutShow = false;
         },
         yuYueBtnClick(item){
            this.$refs.regesterFormRef.validate().then(res => {
               if(this.isshow){
                  this.logoutShow = true;
                  this.ids=item
               }else{
                  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 : '预约失败')
                        }
                     })
                  }
               }
            })
         },
         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({
               title: '加载中...'