|
@@ -4,9 +4,10 @@
|
|
|
<view class="top">
|
|
|
<text class="title">录入核酸人员</text>
|
|
|
</view>
|
|
|
- <view style="display: flex;">
|
|
|
+ <view style="display: flex;margin-top: 40rpx;">
|
|
|
<u-button type="primary" @click="hs.visible=false" text="返回" style="width: 20px;" size="mini" />
|
|
|
- <u-button type="primary" @click="showHsModal" text="添加" icon="plus" style="width: 20px;" size="mini" />
|
|
|
+ <u-button type="primary" @click="showHsModal" text="添加" v-show="hs.num>hs.list.length" icon="plus"
|
|
|
+ style="width: 20px;" size="mini" />
|
|
|
</view>
|
|
|
<u-row style="margin-top: 70rpx;">
|
|
|
<u-col span="4" style="text-align: center;">姓名</u-col>
|
|
@@ -45,80 +46,90 @@
|
|
|
</picker>
|
|
|
</view>
|
|
|
</view>
|
|
|
+
|
|
|
<view class="item">
|
|
|
<view class="l">境外车牌:</view>
|
|
|
<view class="r">
|
|
|
- <u-input placeholder="输入车牌号" @input="carInputFn" v-model="form.cardNo" />
|
|
|
+ <u-input placeholder="输入车牌号" v-model="form.cardNo" />
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="item">
|
|
|
- <view class="l">规格(米):</view>
|
|
|
+ <view class="l">境外车规格:</view>
|
|
|
<view class="r">
|
|
|
- <u-input type="number" placeholder="输入车辆规格" v-model="form.cardSize" />
|
|
|
+ <u-input type="number" placeholder="输入车辆规格" @input="carSizeInput" v-model="form.cardSize">
|
|
|
+ <text slot="suffix">米</text>
|
|
|
+ </u-input>
|
|
|
</view>
|
|
|
</view>
|
|
|
+
|
|
|
<view class="item">
|
|
|
- <view class="l">载重(吨):</view>
|
|
|
+ <view class="l">预计入场:</view>
|
|
|
<view class="r">
|
|
|
- <u-input type="number" placeholder="输入载重" v-model="form.netWeight" />
|
|
|
+ <view class="r">
|
|
|
+ <uni-datetime-picker placeholder="请选择" @change="expectDayChange" :clear-icon="false" hide-second
|
|
|
+ :start="exprctStart" type="datetime" v-model="form.expectInDay" @close="closeFn" />
|
|
|
+ </view>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="item">
|
|
|
- <view class="l">货物:</view>
|
|
|
+ <view class="l">中国车牌号:</view>
|
|
|
<view class="r">
|
|
|
- <picker v-if="goods.goodsList.length>0" class="p-picker" id="hw" @change="bindPickerChange($event)"
|
|
|
- :value="goods.index" :range="goods.goodsList" range-key="name">
|
|
|
- <text class="p-text">{{goods.goodsList[goods.index].name}}</text>
|
|
|
- <u-icon class="p-icon" name="arrow-down-fill" size="20"></u-icon>
|
|
|
- </picker>
|
|
|
+ <u-input placeholder="中国车牌号" v-model="form.chinaCarNo" />
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="item">
|
|
|
- <view class="l">预计入场:</view>
|
|
|
+ <view class="l">中国司机:</view>
|
|
|
<view class="r">
|
|
|
- <view class="r">
|
|
|
- <uni-datetime-picker placeholder="请选择" type="datetime" v-model="form.expectInDay"
|
|
|
- @close="closeFn" />
|
|
|
- </view>
|
|
|
+ <u-input placeholder="司机姓名" v-model="form.driverName" />
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="item">
|
|
|
- <view class="l">中国车牌号:</view>
|
|
|
+ <view class="l">联系号码:</view>
|
|
|
<view class="r">
|
|
|
- <u-input placeholder="中国车牌号" @input="handler()" v-model="form.chinaCarNo" />
|
|
|
+ <u-input placeholder="司机联系号码" v-model="form.driverPhone" />
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="item">
|
|
|
- <view class="l">中国司机:</view>
|
|
|
+ <view class="l">货物:</view>
|
|
|
<view class="r">
|
|
|
- <u-input placeholder="司机姓名" @input="handler()" v-model="form.driverName" />
|
|
|
+ <picker v-if="goods.goodsList.length>0" class="p-picker" id="hw" @change="whChange($event)"
|
|
|
+ :value="goods.index" :range="goods.goodsList" range-key="name">
|
|
|
+ <text class="p-text">{{goods.goodsList[goods.index].name}}</text>
|
|
|
+ <u-icon class="p-icon" name="arrow-down-fill" size="20"></u-icon>
|
|
|
+ </picker>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="item">
|
|
|
- <view class="l">联系号码:</view>
|
|
|
+ <view class="l">载重:</view>
|
|
|
<view class="r">
|
|
|
- <u-input placeholder="司机联系号码" @input="handler()" v-model="form.driverPhone" />
|
|
|
+ <u-input type="number" placeholder="输入载重" v-model="form.netWeight">
|
|
|
+ <text slot="suffix">吨</text>
|
|
|
+ </u-input>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="item-line">
|
|
|
业务项
|
|
|
</view>
|
|
|
- <view class="item" v-for="item in itemList" :key="item.id" v-if="item.items.length>0">
|
|
|
- <view class="l">{{item.name}}:</view>
|
|
|
+ <view class="item" v-for="item in filterItemList" :key="item.id" v-if="item.items.length>0">
|
|
|
+ <view class="l"><text v-if="needTypeId.indexOf(item.id)!==-1" style="color: red;">*</text>{{item.name}}:
|
|
|
+ </view>
|
|
|
<view class="r">
|
|
|
- <view @click="selectItemFn(item)">
|
|
|
- <u-input placeholder="请选择" v-model="item.itemName" readonly clearable style="width: 120px;">
|
|
|
+ <view @click="selectItemFn(item)" style="width: 150px;">
|
|
|
+ <u-input placeholder="请选择" v-model="item.itemName" readonly clearable >
|
|
|
<u-icon name="close" v-if="item.itemName" slot="suffix" color="#E5E5E5;" size="5"
|
|
|
@click="item.itemName=''"></u-icon>
|
|
|
</u-input>
|
|
|
</view>
|
|
|
- <u-input placeholder="数量" border="surround" v-model="item.num" type="number" style="width: 10px;"
|
|
|
- v-if="item.itemName"></u-input>
|
|
|
- <view style="margin-left: 20rpx;color: red;" v-if="item.itemName">
|
|
|
+ <view style="width: 20px;margin-left: 10rpx;">
|
|
|
+ <u-input placeholder="数量" :disabled="item.inc==0" border="surround" v-model="item.num" type="number"
|
|
|
+ style="width: 15px;" v-if="item.itemName"></u-input>
|
|
|
+ </view>
|
|
|
+ <view style="margin-left:30rpx;color: red;" v-if="item.itemName">
|
|
|
{{item.items.filter(obj=>obj.itemName==item.itemName)[0].price*item.num}}元
|
|
|
</view>
|
|
|
<u-icon name="plus" style="position: absolute;right: 10rpx;"
|
|
|
- v-if="item.itemName&&item.name.indexOf('人员核酸检测')!==-1" @click="addHsFn(true)"></u-icon>
|
|
|
+ v-if="item.itemName&&item.name.indexOf('人')!==-1&&item.name.indexOf('核酸')!==-1"
|
|
|
+ @click="addHsFn(item.num,true)"></u-icon>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="hj" v-show="totalPrice>0">
|
|
@@ -130,9 +141,9 @@
|
|
|
<view class="bottom-safety"></view>
|
|
|
<u-popup :show="car.carInput" :overlay="false" @close="car.carInput=false" borderRadius="10">
|
|
|
<view style="padding: 40rpx;line-height: 60rpx;text-align: center;">
|
|
|
- <view v-for="item in car.filterList" :id="item.id"
|
|
|
- style="margin-bottom: 20rpx;border-bottom: 1rpx solid #E5E5E5;" @click="selectCarNo(item)">
|
|
|
- {{item.cardNo}}({{item.cardSize}})
|
|
|
+ <view v-for="item in filterUnitList" :id="item.id"
|
|
|
+ style="margin-bottom: 20rpx;border-bottom: 1rpx solid #E5E5E5;" @click="selectCarSize(item)">
|
|
|
+ {{item.unit}}
|
|
|
</view>
|
|
|
</view>
|
|
|
</u-popup>
|
|
@@ -177,7 +188,10 @@
|
|
|
filterList: [],
|
|
|
},
|
|
|
customerId: '1',
|
|
|
+ exprctStart: new Date().getTime(),
|
|
|
itemList: [],
|
|
|
+ filterItemList: [],
|
|
|
+ needTypeId: [],
|
|
|
form: {
|
|
|
customerId: '',
|
|
|
customerIndex: 0,
|
|
@@ -189,7 +203,8 @@
|
|
|
netWeight: '',
|
|
|
chinaCarNo: '',
|
|
|
driverName: '',
|
|
|
- driverPhone: ''
|
|
|
+ driverPhone: '',
|
|
|
+ expectInDay: ''
|
|
|
|
|
|
},
|
|
|
show: false,
|
|
@@ -202,6 +217,8 @@
|
|
|
},
|
|
|
carList: [],
|
|
|
driverList: [],
|
|
|
+ unitList: [],
|
|
|
+ filterUnitList: [],
|
|
|
country: {
|
|
|
index: 0,
|
|
|
list: ['越南车', '中国车']
|
|
@@ -212,6 +229,7 @@
|
|
|
},
|
|
|
hs: {
|
|
|
visible: false,
|
|
|
+ num: 1,
|
|
|
list: []
|
|
|
},
|
|
|
modal: {
|
|
@@ -223,19 +241,17 @@
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- onLoad(optsions) {
|
|
|
- this.form.id = optsions.id;
|
|
|
-
|
|
|
- },
|
|
|
onShow() {
|
|
|
this.customerId = uni.getStorageSync('customerId');
|
|
|
- if (!this.form.id) {
|
|
|
- setTimeout(() => {
|
|
|
- this.checkStore();
|
|
|
- }, 1000)
|
|
|
+ },
|
|
|
+ onLoad(options) {
|
|
|
+ this.form.id = options.id;
|
|
|
+ this.getBusinessPeople();
|
|
|
+ if (this.customerId == '1') {
|
|
|
+ this.getCustomerList();
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+ this.getGoodsList();
|
|
|
+ this.getUnit();
|
|
|
},
|
|
|
computed: {
|
|
|
totalPrice() {
|
|
@@ -256,24 +272,9 @@
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
- this.getItemList();
|
|
|
- if (this.customerId == '1') {
|
|
|
- this.getCustomerList();
|
|
|
- }
|
|
|
- this.getCarList();
|
|
|
- this.getDriverList();
|
|
|
- this.getGoodsList();
|
|
|
- if (this.form.id) {
|
|
|
- this.$common.showLoading('加载中...')
|
|
|
- setTimeout(() => {
|
|
|
- this.getBusinessById();
|
|
|
- }, 800)
|
|
|
- }
|
|
|
+
|
|
|
},
|
|
|
methods: {
|
|
|
- closeFn(data) {
|
|
|
- console.log(data);
|
|
|
- },
|
|
|
getBusinessById() {
|
|
|
this.$api.getBusinessById({
|
|
|
id: this.form.id
|
|
@@ -297,14 +298,12 @@
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- this.addHsFn(false)
|
|
|
setTimeout(() => {
|
|
|
this.car.carInput = false;
|
|
|
}, 50)
|
|
|
})
|
|
|
},
|
|
|
- addHsFn(show) {
|
|
|
- this.hs.visible = show;
|
|
|
+ getBusinessPeople() {
|
|
|
this.$api.getBusinessPeople({
|
|
|
businessId: this.form.id
|
|
|
}).then(resp => {
|
|
@@ -323,6 +322,36 @@
|
|
|
this.hs.list = r;
|
|
|
})
|
|
|
},
|
|
|
+ whChange(event) {
|
|
|
+ let index = event.detail.value; //当前picker选中的值
|
|
|
+ this.goods.index = index;
|
|
|
+ let goods = this.goods.goodsList[index];
|
|
|
+ let noNeedIds = goods.noNeedIds.split(',');
|
|
|
+ this.needTypeId = goods.needIds.split(',')
|
|
|
+ this.filterItemList = this.itemList.filter(obj => noNeedIds.indexOf(obj.id) == -1);
|
|
|
+ },
|
|
|
+ carSizeInput() {
|
|
|
+ let carSize = this.form.cardSize;
|
|
|
+ let filterUnitList = this.unitList.filter(obj => obj.unit.indexOf(carSize) !== -1);
|
|
|
+ this.car.carInput = filterUnitList.length > 0;
|
|
|
+ this.filterUnitList = filterUnitList;
|
|
|
+ },
|
|
|
+ getUnit() {
|
|
|
+ this.$api.getUnitList().then(resp => {
|
|
|
+ this.unitList = resp.data;
|
|
|
+ })
|
|
|
+ },
|
|
|
+ selectCarSize(data) {
|
|
|
+ this.form.cardSize = data.unit;
|
|
|
+ this.car.carInput = false;
|
|
|
+ },
|
|
|
+ expectDayChange(date) {
|
|
|
+ this.form.expectInDay = date;
|
|
|
+ },
|
|
|
+ addHsFn(num, show) {
|
|
|
+ this.hs.num = num;
|
|
|
+ this.hs.visible = show;
|
|
|
+ },
|
|
|
showHsModal() {
|
|
|
Object.assign(this.modal, {
|
|
|
visible: true,
|
|
@@ -338,8 +367,8 @@
|
|
|
this.$common.toast('请输入名称');
|
|
|
return;
|
|
|
}
|
|
|
- if (!this.modal.form.phone) {
|
|
|
- this.$common.toast('请输入联系号码');
|
|
|
+ if (this.modal.form.phone && !this.$common.isPhone(this.modal.form.phone)) {
|
|
|
+ this.$common.toast('联系号码不正确');
|
|
|
return;
|
|
|
}
|
|
|
let dbIndex = this.modal.form.index;
|
|
@@ -351,7 +380,7 @@
|
|
|
this.hs.list.push(this.modal.form);
|
|
|
}
|
|
|
this.modal.visible = false;
|
|
|
- this.handler();
|
|
|
+
|
|
|
},
|
|
|
editFn(data) {
|
|
|
Object.assign(this.modal, {
|
|
@@ -370,12 +399,19 @@
|
|
|
getGoodsList() {
|
|
|
this.$api.getGoodsList().then(resp => {
|
|
|
this.goods.goodsList = resp.data;
|
|
|
+ let goods = resp.data[0];
|
|
|
+ let noNeedIds = goods.noNeedIds.split(',');
|
|
|
+ this.needTypeId = goods.needIds.split(',')
|
|
|
+ this.$api.getItemList().then(resp => {
|
|
|
+ let list = resp.data;
|
|
|
+ this.itemList = list;
|
|
|
+ this.filterItemList = list.filter(obj => noNeedIds.indexOf(obj.id) == -1);
|
|
|
+ this.getBusinessById();
|
|
|
+ })
|
|
|
})
|
|
|
},
|
|
|
- getDriverList() {
|
|
|
- this.$api.getDriverList().then(resp => {
|
|
|
- this.driverList = resp.data;
|
|
|
- })
|
|
|
+ handlerTypeItem(goods) {
|
|
|
+
|
|
|
},
|
|
|
idCardInput() {
|
|
|
let val = this.form.driverIdCard;
|
|
@@ -396,22 +432,6 @@
|
|
|
that.driver.show = false;
|
|
|
}, 150)
|
|
|
},
|
|
|
- getCarList() {
|
|
|
- this.$api.getCarList().then(resp => {
|
|
|
- this.carList = resp.data;
|
|
|
- })
|
|
|
- },
|
|
|
- carInputFn() {
|
|
|
- let val = this.form.cardNo;
|
|
|
- let list = this.carList.filter(obj => obj.cardNo.indexOf(val) !== -1);
|
|
|
- if (list.length > 0 && val) {
|
|
|
- this.car.carInput = true;
|
|
|
- this.car.filterList = list;
|
|
|
- } else {
|
|
|
- this.car.carInput = false;
|
|
|
- }
|
|
|
- this.handler();
|
|
|
- },
|
|
|
selectCarNo(item) {
|
|
|
this.form.cardNo = item.cardNo;
|
|
|
this.form.cardSize = item.cardSize;
|
|
@@ -421,7 +441,6 @@
|
|
|
this.goods.index = index == -1 ? 0 : index;
|
|
|
this.country.index = this.country.list.indexOf(item.countryName)
|
|
|
let that = this;
|
|
|
- this.handler();
|
|
|
setTimeout(() => {
|
|
|
this.car.carInput = false;
|
|
|
}, 150)
|
|
@@ -432,11 +451,7 @@
|
|
|
this.customer.customerList = resp.data;
|
|
|
})
|
|
|
},
|
|
|
- getItemList() {
|
|
|
- this.$api.getItemList().then(resp => {
|
|
|
- this.itemList = resp.data;
|
|
|
- })
|
|
|
- },
|
|
|
+
|
|
|
selectItemFn(item) {
|
|
|
this.item = item;
|
|
|
this.show = true;
|
|
@@ -445,76 +460,16 @@
|
|
|
itemSelectFn(data) {
|
|
|
this.show = false;
|
|
|
this.item.itemName = data;
|
|
|
- this.handler();
|
|
|
- },
|
|
|
- handler() {
|
|
|
- let goodsIndex = this.goods.index;
|
|
|
- let countryIndex = this.country.index;
|
|
|
- this.form.goodsName = this.goods.goodsList[goodsIndex].name;
|
|
|
- this.form.countryName = this.country.list[countryIndex];
|
|
|
- this.form.goodsIndex = goodsIndex;
|
|
|
- this.form.countryIndex = countryIndex;
|
|
|
- this.form.peopleJson = JSON.stringify(this.hs.list);
|
|
|
- let customerId = this.customerId;
|
|
|
- if (customerId == '1') {
|
|
|
- let customerIndex = this.customer.index;
|
|
|
- this.form.customerId = this.customer.customerList[customerIndex].id;
|
|
|
- this.form.customerIndex = customerIndex;
|
|
|
- }
|
|
|
- let that = this;
|
|
|
- uni.setStorage({
|
|
|
- key: 'business_' + customerId,
|
|
|
- data: that.form
|
|
|
- })
|
|
|
- },
|
|
|
- checkStore() {
|
|
|
- let customerId = this.customerId;
|
|
|
- let data = uni.getStorageSync('business_' + customerId)
|
|
|
- if (data) {
|
|
|
- let that = this;
|
|
|
- uni.showModal({
|
|
|
- title: '提示',
|
|
|
- content: '您上次录入数据未提交,是否继续?',
|
|
|
- cancelText: '重新录入',
|
|
|
- confirmText: '继续',
|
|
|
- success(res) {
|
|
|
- if (res.confirm) {
|
|
|
- that.rebackStore(data);
|
|
|
- } else {
|
|
|
- uni.removeStorageSync('business_' + customerId)
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
- rebackStore(data) {
|
|
|
- this.form = data;
|
|
|
-
|
|
|
- this.goods.index = data.goodsIndex ? data.goodsIndex : 0;
|
|
|
- this.customer.index = data.customerIndex ? data.customerIndex : 0;
|
|
|
- this.country.index = data.countryIndex ? data.countryIndex : 0;
|
|
|
- this.hs.list = data.peopleJson ? JSON.parse(data.peopleJson) : []
|
|
|
- setTimeout(() => {
|
|
|
- this.car.carInput = false;
|
|
|
- this.driver.show = false;
|
|
|
- }, 150)
|
|
|
},
|
|
|
check() {
|
|
|
- this.handler();
|
|
|
if (!this.form.cardNo) {
|
|
|
this.$common.toast('请录入境外车牌号')
|
|
|
return false;
|
|
|
}
|
|
|
- if (!this.form.cardSize) {
|
|
|
- this.$common.toast('请录入车辆规格')
|
|
|
- return false;
|
|
|
- }
|
|
|
- let inDayTime=this.form.expectInDay;
|
|
|
- if(!inDayTime||inDayTime.length<12){
|
|
|
- this.$common.toast('入场时间不正确')
|
|
|
+ if (!this.$common.isNum(this.form.cardSize)) {
|
|
|
+ this.$common.toast('车辆规格请录入数字')
|
|
|
return false;
|
|
|
}
|
|
|
-
|
|
|
|
|
|
if (!this.form.chinaCarNo) {
|
|
|
this.$common.toast('请录入中国车牌')
|
|
@@ -524,16 +479,34 @@
|
|
|
this.$common.toast('请录入中国司机')
|
|
|
return false;
|
|
|
}
|
|
|
- if (!this.form.driverPhone) {
|
|
|
- this.$common.toast('请录入司机联系号码')
|
|
|
+ if (!this.$common.isPhone(this.form.driverPhone)) {
|
|
|
+ this.$common.toast('司机联系号码不正确')
|
|
|
return false;
|
|
|
}
|
|
|
- let typeList = this.itemList.filter(obj => obj.itemName);
|
|
|
+ if (!this.$common.isNum(this.form.netWeight)) {
|
|
|
+ this.$common.toast('载重必须输入数字')
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ let typeList = this.filterItemList.filter(obj => obj.itemName);
|
|
|
if (typeList.length == 0) {
|
|
|
this.$common.toast('至少选择一项业务项')
|
|
|
return false;
|
|
|
}
|
|
|
- if (typeList.filter(obj => obj.name.indexOf('核酸') !== -1).length > 0 && this.hs.list.length == 0) {
|
|
|
+ let filterItemList = this.filterItemList;
|
|
|
+ for (let j in this.needTypeId) {
|
|
|
+ let id = this.needTypeId[j];
|
|
|
+ for (let i in filterItemList) {
|
|
|
+ let type = filterItemList[i];
|
|
|
+ if (id == type.id && !type.itemName) {
|
|
|
+ this.$common.toast('[' + type.name + ']必选')
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let peopleList=this.hs.list;
|
|
|
+ if (typeList.filter(obj => obj.name.indexOf('人') !== -1 &&
|
|
|
+ obj.name.indexOf('核酸') !== -1).length > 0 &&
|
|
|
+ peopleList.length == 0) {
|
|
|
this.$common.toast('录入核酸检测人员')
|
|
|
return false;
|
|
|
}
|
|
@@ -554,12 +527,14 @@
|
|
|
})
|
|
|
}
|
|
|
this.form.itemJson = JSON.stringify(list);
|
|
|
+ this.form.peopleJson=JSON.stringify(peopleList);
|
|
|
this.form.items = null;
|
|
|
if (this.customerId == '1') {
|
|
|
this.form.customerId = this.customer.customerList[this.customer.index].id;
|
|
|
} else {
|
|
|
this.form.customerId = this.customerId;
|
|
|
}
|
|
|
+ this.form.goodsName = this.goods.goodsList[this.goods.index].name;
|
|
|
|
|
|
return true;
|
|
|
},
|
|
@@ -592,7 +567,6 @@
|
|
|
this.country.index = value;
|
|
|
break;
|
|
|
}
|
|
|
- this.handler();
|
|
|
},
|
|
|
}
|
|
|
}
|