yangan
2024-10-15 09f598294949f96d91cdf0f583ce10862131b6f5
subPages/addDailyPlan/addDailyPlan.vue
@@ -9,10 +9,15 @@
                  当前选择订单
               </view>
               <view class="selected-info_text">
                  <niceui-data-select-input v-model="deptId"
                  <uni-combox :candidates="customerNameList" placeholder="请选择订单"
                   labelKey="text"
                   valueKey="value"
                   ref='combox'
                   v-model="deptId" @input="(e)=>deptChange(e)"></uni-combox>
                  <!-- <niceui-data-select-input v-model="deptId"
                     :localdata="customerNameList"
                     placeholder="请选择订单"
                     @change="deptChange"></niceui-data-select-input>
                     @change="deptChange"></niceui-data-select-input> -->
               </view>
            </view>
         </view>
@@ -43,8 +48,29 @@
                  ></u--input>
            </view>
         </view>
            <!-- 客户名称 -->
            <view class="customer-name">
            <view class="customer-name_label" style="display: flex; align-items: center;">
               合卡订单
               <view style="width: 50%;margin-left: 30rpx;"><u-button  text='选择需要合卡订单'     :disabled="!deptId" @click="todoUncoid"></u-button></view>
            </view>
            <view class="customer-name_block">
                    <u-input
                    @clear="clearInp"
                    clearable
                     class="customer-name_block-input"
                     placeholder="请选择订单"
                     border="surround"
                     v-model="activeName"
                     :disabled="!deptId"
                  ></u-input>
            </view>
         </view>
             <view class="table">
         <uni-table border stripe 
         @selection-change="selectionChange"
          type="selection"
         emptyText="暂无更多数据">
               <uni-tr>
                   <uni-th align="center">产品名称</uni-th>
@@ -96,7 +122,7 @@
                     v-for="item in customerNameList"
                     @click="selectCustomer(item)">
                     <view class="item-image">
                        <image src="https://mx.jzeg.cn:9096/appimg/image/banner/address.png"
                        <image src="https://wrzs.czjlchem.com:9090/appimg/image/banner/address.png"
                           mode="widthFix"
                           style="width: 18px;"></image>
                     </view>
@@ -128,21 +154,45 @@
         this.sendDate = this.sendDateStart = dayjs().format('YYYY-MM-DD')
         this.sendDateEnd = dayjs().add(7, 'day').format('YYYY-MM-DD')
      },
      onShow(){
         uni.$on('updateData',(data)=>{
            console.log('监听到事件来自 updateData ,携带参数为:' + JSON.parse( JSON.stringify(data)) , JSON.parse(data) .id );
            const params = JSON.parse(data);
            // this.checkList2 = params.map(item=>{
            //    item.text = item.orderCode + '/' + item.customerName;
            //    return item;
            // });
            // let temp = this.checkList2;
            // this.closeOrderIds = temp.map(item=>item.id).join(',')
            this.activeName = params.orderCode  +'/' + params.customerName;
            this.closeOrderId = params.id;
         })
      },
      data() {
         return {
            selfDeliverShow: false,
            deptId: '',
            checkList:[],
            deptName: '',
            activeName:'',
            isNumOk:false,
            isNumData:[],
            checkList2:[],
            deptList: [],
            uncoidCard:'',
            productName: '',
            productNameList: [],
            filedId: '',
            filedName: '',
            unionParams:{},
            filedNameList: [],
            sendDate: '',
            sendDateStart: '',
            sendDateEnd: '',
            customerId: '',
            closeOrderIds:'',
            value:'',
            customerName: '',
            customerNameList: [],
@@ -152,18 +202,18 @@
      },
      computed: {
         abledBuild() {
            return !this.subDataList.length || !this.sendDate || !this.value
            return !this.subDataList.length || !this.sendDate || !this.value || !this.checkList.length
         }
      },
      methods: {
            //查询订单
            getDingdan(){
                    this.$reqGet('getAppOrderList',{orderType:'外销'})
                    this.$reqGet('getAppOrderList',{code:this.deptId})
               .then(res => {
                  uni.hideLoading()
                  if (res.code == 0) {
                     this.customerNameList = res.data.map(item=>{
                        item.text = (item.productNames ? item.productNames : item.productName) + '-' + item.orderCode;
                        item.text =  item.orderCode;
                        item.value = item.id;
                        return item;
                     });
@@ -180,10 +230,59 @@
               })
            },
         deptChange(e) {
            console.log(e,'eee');
            this.subDataList = this.customerNameList.filter(item=>item.id === e).length ?
            this.customerNameList.filter(item=>item.id === e)[0].tmOrderList  : [];
            ;
            console.log(e,this.$refs.combox,'eee');
            this.$reqGet('getAppOrderList',{code:this.$refs.combox.inputVal})
               .then(res => {
                  uni.hideLoading()
                  if (res.code == 0) {
                     this.customerNameList = res.data.map(item=>{
                        item.text =  item.orderCode;
                        item.value = item.id;
                        return item;
                     });
                     if(this.customerNameList.length === 1){
                        this.deptId = this.customerNameList[0].value; //选择当前
                        // if(this.deptId){
                        //    this.deptChange(this.deptId);
                        // }
                        this.unionParams = {
                           orderId:this.customerNameList[0].id,
                           deptId:this.customerNameList[0].deptId,
                           customerId:this.customerNameList[0].customerId,
                           productId:this.customerNameList[0].productId
                        }
                     }else{
                        this.deptId = '';
                     }
                     if(this.deptId){
                  this.subDataList = this.customerNameList.filter(item=>item.id === e).length ?
                     this.customerNameList.filter(item=>item.id === e)[0].tmOrderList  : [];
                  console.log(this.subDataList,'subDataList')
                  const tempArr = this.customerNameList.filter(item=>item.id === e);
                  if(tempArr.length){
                     this.unionParams = {
                           orderId:tempArr[0].id,
                           deptId:tempArr[0].deptId,
                           customerId:tempArr[0].customerId,
                           productId:tempArr[0].productId
                        }
                  }else{
                     this.unionParams = {
                           orderId:'',
                           deptId:'',
                           customerId:'',
                           productId:'',
                        }
                  }
                     }else{
                        this.subDataList = [];
                     }
                  }
               })
            
         },
         confirmBuild() {
@@ -192,6 +291,8 @@
              carNum:this.value,
              sendDate:this.sendDate,
              sendSign:0,
              itemIds:this.checkList.join(",") + ',',
              closeOrderId:this.closeOrderId,
            }
            this.buildLoading = true
            this.$reqPost('addDeliveryPlan', form, 'json').then(res => {
@@ -209,6 +310,28 @@
            }).catch(e => {
               this.buildLoading = false
            })
         },
         selectionChange(item){
            //选择 某个产品
            this.checkList = [];
            console.log(item,'items')
             if(item.detail.index.length){
               item.detail.index.forEach((v) => {
               this.checkList.push(this.subDataList[v].id)
              })
               console.log(this.checkList,'checkList')
             }
         },
         todoUncoid(){
            console.log('todoUncoid');
            uni.navigateTo({
            url: `/subPages/unionCard/unionCard?unionParams=${JSON.stringify(this.unionParams)}&checkArray=${JSON.stringify(this.checkList2) }`
            });
         },
         clearInp(){
            this.closeOrderId = '';
            this.activeName = '';
         }
      },
   }
@@ -247,6 +370,8 @@
   .main {
      width: 100%;
      color: #232323;
      overflow: auto;
      height: 80vh;
      .product-info {
         width: 96%;