From 74073d164925eff4962188405355debb367aaf06 Mon Sep 17 00:00:00 2001 From: yangan <yangan0921@163.com> Date: 星期四, 24 十月 2024 18:13:25 +0800 Subject: [PATCH] feat:小问题修改 --- subPages/addDailyPlan/addDailyPlan.vue | 199 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 184 insertions(+), 15 deletions(-) diff --git a/subPages/addDailyPlan/addDailyPlan.vue b/subPages/addDailyPlan/addDailyPlan.vue index cc9f5ad..8cd2ed2 100644 --- a/subPages/addDailyPlan/addDailyPlan.vue +++ b/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> @@ -39,27 +44,55 @@ class="customer-name_block-input" placeholder="璇疯緭鍏ヨ溅鏁�" border="surround" + :disabled="isNumOk" v-model="value" ></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> - <uni-th align="center">绫诲瀷</uni-th> + <uni-th align="center">瑙勬牸</uni-th> <uni-th align="center">浠撳簱</uni-th> + <uni-th align="center" v-if="isNumOk">鏁伴噺</uni-th> </uni-tr> <uni-tr v-for="(item, index) in subDataList" :key="index"> <uni-td align="center"> <view>{{ item.productName}}</view></uni-td> - <uni-td> - <view class="name">{{ item.orderType }}</view> - </uni-td> - + <uni-td align="center"> + <view>{{ item.productSpecs}}</view></uni-td> 聽 <uni-td align="center"> <view>{{ item.bunkerName }}</view></uni-td> + 聽 <uni-td align="center" v-if="isNumOk"> + <view> + <u-input + v-model="subDataList[index].surplusQuant" + border="surround" + placeholder="璇疯緭鍏ユ暟閲�" /> + </view></uni-td> </uni-tr> </uni-table> </view> @@ -96,7 +129,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,42 +161,69 @@ 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: '', + mapProductNum:'', + activeName:'', + isNumOk:false, + isNumData:[], + checkList2:[], deptList: [], + uncoidCard:'', productName: '', productNameList: [], filedId: '', filedName: '', + unionParams:{}, filedNameList: [], sendDate: '', sendDateStart: '', sendDateEnd: '', customerId: '', + closeOrderIds:'', value:'', customerName: '', customerNameList: [], buildLoading: false, subDataList:[], + isWeighing:'', + orderType:'', } }, 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,18 +240,103 @@ }) }, 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 = []; + } + //鏌ョ湅鏄笉鏄噰璐殑璁℃暟 + if(this.subDataList.find(item=>item.isWeight === 0)){ + this.isNumOk = true; + this.value = 1; + } else{ + this.isNumOk = false; + } + if(this.isNumOk){ + let tempArr = []; + this.subDataList.forEach(item=>{ + tempArr.push(item.productId + ':' + item.surplusQuant); + this.isWeighing = item.isWeight; + this.orderType = item.orderType; + }) + + this.mapProductNum = tempArr.join(",") + }else{ + this.mapProductNum = ''; + } + } + }) + }, confirmBuild() { + let tempArr = []; + this.subDataList.forEach(item=>{ + this.checkList.forEach(val=>{ + if(item.id === val){ + tempArr.push(item.productId + ':' + item.surplusQuant); + } + + }) + + }) + this.mapProductNum = tempArr.join(",") let form = { orderId:this.deptId, carNum:this.value, sendDate:this.sendDate, sendSign:0, + itemIds:this.checkList.join(",") + ',', + closeOrderId:this.closeOrderId, + mapProductNum:this.mapProductNum, + orderType:this.orderType, + isWeighing:this.isWeighing + } this.buildLoading = true this.$reqPost('addDeliveryPlan', form, 'json').then(res => { @@ -209,6 +354,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 +414,8 @@ .main { width: 100%; color: #232323; + overflow: auto; + height: 80vh; .product-info { width: 96%; -- Gitblit v1.9.1