wk
2024-06-06 eab888fdae1e2997d9c95a68733b6acaffd58bc5
pages/doorkeeper-page/doorkeeper-index/doorkeeper-index.vue
@@ -1,7 +1,8 @@
<template>
      <view class="appointment">
         <view class="wait-collection"
            style="background: url('https://mx.jzeg.cn:9096/appimg/image/banner/diverbanner.png') no-repeat;background-size:contain">
         <view class="searchview">
            <u-search @change="change" :searchIconSize="40" placeholder="请输入车牌号" height="80" clearabled v-model="carNo" @search="search" @custom="custom" @clear="clear" >
            </u-search >
         </view>
         <uni-table border
            stripe
@@ -19,41 +20,34 @@
               <uni-td align="center">{{ item.productName || '' }}</uni-td>
               <uni-td align="center">{{ item.carNo || '' }}</uni-td>
               <uni-td align="center">{{ item.phone || '' }}</uni-td>
               <uni-td><u-button text="选择"
               <uni-td><u-button text="检查"
                     type="primary"
                     @click="yuYueBtnClick(item)"></u-button></uni-td>
            </uni-tr>
         </uni-table>
         <view v-show="isshow">
            <uni-table border
               stripe
               type="selection"
               @selection-change="selectionChange"
               emptyText="暂无更多数据">
               <uni-tr>
                  <uni-th align="center">检测项</uni-th>
               </uni-tr>
               <uni-tr v-for="(item, index) in inspectData"
                  :key="item.id">
                  <uni-td align="center">{{ item.title  }}</uni-td>
               </uni-tr>
            </uni-table>
            <view class="fourth-line">
               <view class="button-img"
                  @click.stop="toAppointmentClick(item)">确定</view>
            </view>
         </view>
         <u-popup :show="show"
            @close="close"
            @open="open"
            mode="center"
            round="10">
            <view class="receiverPopup">
               <uni-table border
                  stripe
                  type="selection"
                  @selection-change="selectionChange"
                  emptyText="暂无更多数据">
                  <uni-tr>
                     <uni-th align="center">检测项</uni-th>
                  </uni-tr>
                  <uni-tr v-for="(item, index) in inspectData"
                     :key="item.id">
                     <uni-td align="center">{{ item.title  }}</uni-td>
                  </uni-tr>
               </uni-table>
               <view class="receiverPopup__title"><text>确定检查完毕</text></view>
               <view class="receiverPopup__btn"><u-button text="确定"
                     type="primary"
                     @click="popClick"
                     :disabled="canClick"
                     :loading="ClickLoading"></u-button></view>
            </view>
         </u-popup>
@@ -70,8 +64,8 @@
            driverBillOfLoadingData:[],
            inspectData:[],
            isAllSelected:false,
            isshow:false,
            form:{},
            carNo:'',
            ClickLoading:false
         }
      },
@@ -80,9 +74,30 @@
      },
      methods: {
         yuYueBtnClick(item){
            this.inspectData=JSON.parse(item.inspectedResult)
            this.form=item
            this.isshow=true
            if(item.inspectedResult){
               this.inspectData=JSON.parse(item.inspectedResult)
               this.form=item
               this.show = true;
            }else{
               this.inspectData=[]
               this.form=item
               uni.showLoading({ title: '加载中...' });
               this.$reqPost('addCheckLog',{
                           carNo:this.form.carNo,
                           taskId:this.form.id,
                           taskcode:this.form.code,
                        }, 'json').then(res => {
                  if (res.code === 0) {
                     uni.$u.toast('检查成功')
                     this.form={}
                     this.ClickLoading = false;
                     this.show = false;
                     this.TaskCoalList()
                  } else {
                     uni.$u.toast(res.msg ? res.msg : '检查失败')
                  }
               })
            }
         },
         selectionChange(items){
           const allIds = this.inspectData.map(item => item);
@@ -93,50 +108,37 @@
            this.TaskCoalList();
            this.form={}
            this.inspectData=[]
            this.isshow=false
         },
         toAppointmentClick(){
            if(this.isAllSelected==true){
               let arr= this.driverBillOfLoadingData.map(i=>{
                  return {
                     carNo:i.carNo,
                     taskId:i.id,
                     taskcode:i.code,
                     }
               })
               this.show = true;
            }else{
               uni.$u.toast('必须全部检测')
            }
         },
         popClick() {
               this.ClickLoading = true;
               this.inspectData=this.inspectData.map(item=>{
                  return {
                     ...item,
                     valve:"通过"
                  }
               })
               uni.showLoading({ title: '加载中...' });
               this.$reqPost('addCheckLog',{
                           carNo:this.form.carNo,
                           taskId:this.form.id,
                           taskcode:this.form.code,
                           inspectedResult:JSON.stringify(this.inspectData)
                        }, 'json').then(res => {
                  if (res.code === 0) {
                     uni.$u.toast('检查成功')
                     this.form={}
                     this.ClickLoading = false;
                     this.inspectData=[]
                     this.show = false;
                     this.isshow=false
                     this.TaskCoalList()
                  } else {
                     uni.$u.toast(res.msg ? res.msg : '检查失败')
                  }
               })
               if(this.isAllSelected==true){
                  this.ClickLoading = true;
                  this.inspectData=this.inspectData.map(item=>{
                     return {
                        ...item,
                        valve:"通过"
                     }
                  })
                  uni.showLoading({ title: '加载中...' });
                  this.$reqPost('addCheckLog',{
                              carNo:this.form.carNo,
                              taskId:this.form.id,
                              taskcode:this.form.code,
                              inspectedResult:JSON.stringify(this.inspectData)
                           }, 'json').then(res => {
                     if (res.code === 0) {
                        uni.$u.toast('检查成功')
                        this.form={}
                        this.ClickLoading = false;
                        this.inspectData=[]
                        this.show = false;
                        this.TaskCoalList()
                     } else {
                        uni.$u.toast(res.msg ? res.msg : '检查失败')
                     }
                  })
               }else{
                  uni.$u.toast('必须全部检测')
               }
         },
         open() {},
         close() {
@@ -147,17 +149,46 @@
            uni.showLoading({
               title: '加载中...'
            });
            this.$reqGet('getCheckTaskCoal',{flag:0}).then(res => {
               uni.hideLoading();
               this.driverBillOfLoadingData = res.data;
            });
            if(!this.carNo){
               this.$reqGet('getCheckTaskCoal',{flag:0}).then(res => {
                  uni.hideLoading();
                  this.driverBillOfLoadingData = res.data;
               });
            }else{
               this.$reqGet('getCheckTaskCoal',{flag:0,carNo:this.carNo}).then(res => {
                  uni.hideLoading();
                  this.driverBillOfLoadingData = res.data;
               });
            }
            
         },
         change(res) {
            console.log(res)
         },
         search(res) {
            console.log(res)
            this.TaskCoalList()
         },
         clear(res) {
            this.carNo=""
         },
         custom(res) {
            console.log(res)
         }
      }
   };
</script>
<style lang="scss" scoped>
   .searchview{
      margin: 20rpx 0;
      height: 200rpx;
      u-search{
         width: 100rpx;
      }
   }
   .receiverPopup {
      height: vww(110);
      width: 300rpx;
@@ -178,10 +209,6 @@
         }
      }
   }
   .wait-collection {
         width: 100%;
         height: 600rpx;
      }
   ::v-deep.appointment {
      .appointment-description {
         margin: vww(8) 0;
@@ -254,4 +281,9 @@
         }
      }
   }
   .wait-appointment,
   .Reserved {
      position: relative;
      top: vww(-120);
   }
</style>