<!-- 自主配送 -->
|
<template>
|
<view class="main">
|
<!-- 司机选择的产品信息 -->
|
<view class="product-info">
|
<view class="product-info_block">
|
<view class="selected-info">
|
<view class="selected-info_label">
|
当前选择订单
|
</view>
|
<view class="selected-info_text">
|
<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> -->
|
</view>
|
</view>
|
</view>
|
</view>
|
<view class="bottom-block">
|
<!-- 选择发运时间 -->
|
<view class="send-date">
|
<view class="send-date_label">
|
发运时间
|
</view>
|
<uni-datetime-picker type="date"
|
:clear-icon="false"
|
v-model="sendDate"
|
:start="sendDateStart"
|
:end="sendDateEnd" />
|
</view>
|
<!-- 客户名称 -->
|
<view class="customer-name">
|
<view class="customer-name_label">
|
车数
|
</view>
|
<view class="customer-name_block">
|
<u--input
|
class="customer-name_block-input"
|
placeholder="请输入车数"
|
border="surround"
|
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
|
v-for="item, i in checkList2" :key="i"
|
@clear="clearInp"
|
clearable
|
class="customer-name_block-input"
|
placeholder="请选择订单"
|
border="surround"
|
v-model="item.text"
|
: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-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.bunkerName }}</view></uni-td>
|
</uni-tr>
|
</uni-table>
|
</view>
|
</view>
|
<!-- 提交 -->
|
<view class="confirm-build">
|
<view class="confirm-build_block">
|
<u-button text="确认创建"
|
@click="confirmBuild"
|
:loading="buildLoading"
|
:disabled="abledBuild"></u-button>
|
</view>
|
</view>
|
|
<!-- <view class="">
|
<u-popup :closeable='true'
|
:round="30"
|
mode='bottom'
|
:show="selfDeliverShow"
|
@close="selfDeliverClose"
|
@open="selfDeliverOpen">
|
<view class="name-list-section">
|
<view class="name-list_title">
|
选择客户
|
</view>
|
<view class="name-list_container">
|
<u-empty mode="data"
|
icon="http://cdn.uviewui.com/uview/empty/data.png"
|
text="暂无数据"
|
textSize="30"
|
iconSize="1000"
|
v-if="customerNameList.length===0"></u-empty>
|
<view class="name-list_container_item"
|
v-for="item in customerNameList"
|
@click="selectCustomer(item)">
|
<view class="item-image">
|
<image src="https://wrzs.czjlchem.com:9090/appimg/image/banner/address.png"
|
mode="widthFix"
|
style="width: 18px;"></image>
|
</view>
|
<view class="item-customerName">
|
{{item.customerName}}
|
</view>
|
</view>
|
</view>
|
</view>
|
</u-popup>
|
</view> -->
|
|
</view>
|
</template>
|
|
<script>
|
import NiceUIDataSelectInput from '@/uni_modules/niceui-data-select-input/components/niceui-data-select-input/niceui-data-select-input.vue'
|
const dayjs = require('dayjs')
|
export default {
|
components: {
|
NiceUIDataSelectInput
|
},
|
onLoad() {
|
// this.getCarNoByVarieties()
|
this.getDingdan();
|
// if (this.deptId && this.productName) {
|
// this.getShipToList()
|
// }
|
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(',')
|
|
|
})
|
},
|
data() {
|
return {
|
selfDeliverShow: false,
|
deptId: '',
|
checkList:[],
|
deptName: '',
|
activeName:'',
|
checkList2:[],
|
deptList: [],
|
uncoidCard:'',
|
productName: '',
|
productNameList: [],
|
filedId: '',
|
filedName: '',
|
unionParams:{},
|
filedNameList: [],
|
sendDate: '',
|
sendDateStart: '',
|
sendDateEnd: '',
|
customerId: '',
|
closeOrderIds:'',
|
value:'',
|
customerName: '',
|
customerNameList: [],
|
buildLoading: false,
|
subDataList:[],
|
}
|
},
|
computed: {
|
abledBuild() {
|
return !this.subDataList.length || !this.sendDate || !this.value || !this.checkList.length
|
}
|
},
|
methods: {
|
//查询订单
|
getDingdan(){
|
this.$reqGet('getAppOrderList',{code:this.deptId})
|
.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);
|
}
|
|
}
|
|
console.log(this.customerNameList,'')
|
}
|
})
|
},
|
deptChange(e) {
|
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 : [];
|
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() {
|
let form = {
|
orderId:this.deptId,
|
carNum:this.value,
|
sendDate:this.sendDate,
|
sendSign:0,
|
itemIds:this.checkList.join(",") + ',',
|
closeOrderIds:this.closeOrderIds,
|
}
|
this.buildLoading = true
|
this.$reqPost('addDeliveryPlan', form, 'json').then(res => {
|
this.buildLoading = false
|
if (res.code == 0) {
|
this.$u.toast('创建成功')
|
setTimeout(() => {
|
uni.navigateBack({
|
delta: 1
|
})
|
}, 1500)
|
} else {
|
this.$u.toast(res.msg ? res.msg : '创建失败')
|
}
|
}).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 = '';
|
}
|
},
|
}
|
</script>
|
|
<style lang="scss"
|
scoped>
|
.table{
|
width: 94%;
|
margin-left: 20rpx;
|
/deep/ .uni-table{
|
min-width: 340rpx!important;
|
}
|
}
|
/deep/.u-button {
|
width: 100%;
|
height: 36px !important;
|
line-height: 40px;
|
padding: 0 12px;
|
font-size: 28rpx;
|
font-weight: 300;
|
color: #ffffff !important;
|
background: #497bfb !important;
|
letter-spacing: 4rpx;
|
border-radius: 37rpx 37rpx 37rpx 37rpx !important;
|
box-shadow: 2rpx 3rpx 13rpx 0rpx rgba(43, 98, 239, 0.5), 0rpx 0rpx 9rpx 0rpx rgba(247, 250, 253, 0.29);
|
}
|
|
@mixin flex {
|
display: flex;
|
justify-content: space-between;
|
align-items: center;
|
}
|
|
|
.main {
|
width: 100%;
|
color: #232323;
|
overflow: auto;
|
height: 80vh;
|
|
.product-info {
|
width: 96%;
|
margin: vww(8);
|
margin-top: vww(20);
|
border-radius: 20rpx;
|
position: relative;
|
@include flex;
|
justify-content: center;
|
|
&_block {
|
width: 88%;
|
margin-left: vww(10);
|
@include flex;
|
flex-direction: column;
|
align-items: flex-start;
|
|
.selected-info {
|
width: 100%;
|
display: flex;
|
align-items: center;
|
|
&_label {
|
margin-right: vww(8);
|
}
|
|
&_text {
|
font-weight: bold;
|
}
|
}
|
|
.re-select {
|
position: absolute;
|
width: vww(100);
|
bottom: vww(10);
|
}
|
}
|
}
|
|
.bottom-block {
|
height: vww(200);
|
}
|
|
.send-date,
|
.customer-name {
|
margin: vww(40) vww(20);
|
position: relative;
|
|
&_label {
|
margin: vww(8);
|
}
|
|
&_block {
|
width: 100%;
|
flex: 1;
|
height: vww(35);
|
border: 1px solid #e5e5e5;
|
box-sizing: border-box;
|
border-radius: 4px;
|
padding: 0 5px;
|
padding-left: 10px;
|
position: relative;
|
user-select: none;
|
@include flex;
|
|
&-input {
|
width: 96%;
|
height: 96%;
|
color: #333;
|
position: absolute;
|
left: vww(10);
|
z-index: -1;
|
white-space: nowrap;
|
text-overflow: ellipsis;
|
-o-text-overflow: ellipsis;
|
overflow: hidden;
|
}
|
}
|
}
|
|
.confirm-build {
|
width: 100%;
|
height: vww(60);
|
background-color: #ffffff;
|
position: fixed;
|
bottom: 0;
|
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;
|
display: flex;
|
justify-content: center;
|
align-items: center;
|
|
&_block {
|
width: 94%;
|
}
|
}
|
|
.name-list-section {
|
width: 100%;
|
height: vww(600);
|
position: relative;
|
@include flex;
|
justify-content: center;
|
align-items: flex-start;
|
|
.name-list_title {
|
position: absolute;
|
top: vww(10);
|
font-size: vww(20);
|
}
|
|
.name-list_container {
|
width: 94%;
|
padding-top: vww(10);
|
overflow: scroll;
|
@include flex;
|
justify-content: flex-start;
|
flex-direction: column;
|
margin-top: vww(40);
|
|
&_item {
|
width: 100%;
|
height: vww(50);
|
@include flex;
|
justify-content: flex-start;
|
font-size: vww(18);
|
|
.item-image {
|
height: 100%;
|
display: flex;
|
align-items: center;
|
}
|
|
.item-customerName {
|
color: #252525;
|
margin-left: vww(8);
|
white-space: nowrap;
|
text-overflow: ellipsis;
|
overflow: hidden;
|
}
|
}
|
}
|
}
|
}
|
</style>
|