|
|
@@ -2,109 +2,107 @@
|
|
|
<view>
|
|
|
<view class="box">
|
|
|
<view class="top">
|
|
|
- <text class="title">{{itemType.name}}</text>
|
|
|
- </view>
|
|
|
- <view class="item-line">
|
|
|
- 基本信息
|
|
|
- </view>
|
|
|
- <view class="item" v-if="!customerId||customerId=='1'">
|
|
|
- <view class="l"><text style="color: red;">*</text>客户:</view>
|
|
|
- <view class="r">
|
|
|
- <picker v-if="customer.list.length>0" class="p-picker" @change="customerChange($event)"
|
|
|
- :value="customer.index" :range="customer.list" range-key="name">
|
|
|
- <text class="p-text">{{customer.list[customer.index].name}}</text>
|
|
|
- <u-icon class="p-icon" name="arrow-down-fill" size="20"></u-icon>
|
|
|
- </picker>
|
|
|
- </view>
|
|
|
+ <text class="title">{{goods.name}}</text>
|
|
|
</view>
|
|
|
<view class="item">
|
|
|
- <view class="l"><text style="color: red;">*</text>车牌号:</view>
|
|
|
+ <view class="l"><text style="color: red;" v-if="goods.needDeclare==1">*</text>申报单号:</view>
|
|
|
<view class="r">
|
|
|
- <u-input @input="carInputFn" placeholder="请填写车牌号" v-model="form.carNo" />
|
|
|
+ <u-input placeholder="申报订单号" v-model="form.declareNo" clearable readonly>
|
|
|
+ <text slot="suffix" style="font-size: 50rpx;" @click="selectDeclare">+</text>
|
|
|
+ </u-input>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="list" v-show="carList.length>0&&showSelect">
|
|
|
- <u-radio-group v-model="form.carNo" placement="column" @change="groupChange">
|
|
|
- <u-radio :customStyle="{marginBottom: '8px'}" v-for="(item, index) in carList" :key="index"
|
|
|
- :label="item.carNo" :name="item.carNo">
|
|
|
- </u-radio>
|
|
|
- </u-radio-group>
|
|
|
- </view>
|
|
|
<view class="item">
|
|
|
- <view class="l">车辆类型:</view>
|
|
|
- <view class="r">
|
|
|
- <picker v-if="type.list.length>0" class="p-picker" id="qy" @change="bindPickerChange($event)"
|
|
|
- :value="type.index" :range="type.list" range-key="name">
|
|
|
- <text class="p-text">{{type.list[type.index].name}}</text>
|
|
|
- <u-icon class="p-icon" name="arrow-down-fill" size="20"></u-icon>
|
|
|
+ <view class="l">企业:</view>
|
|
|
+ <view class="r" style="flex: 12;">
|
|
|
+ <picker :disabled="goods.needDeclare==1" v-if="customer.customerList.length>0" class="p-picker"
|
|
|
+ @change="customerChange($event)" :value="customer.index" :range="customer.customerList"
|
|
|
+ range-key="name">
|
|
|
+ <text class="p-text">{{customer.customerList[customer.index].name}}</text>
|
|
|
</picker>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="item">
|
|
|
- <view class="l">车辆规格:</view>
|
|
|
- <view class="r">
|
|
|
- <u-input placeholder="请填写车辆规格" v-model="form.carSize" />
|
|
|
- </view>
|
|
|
- </view>
|
|
|
- <view class="item" v-if="type.index==1">
|
|
|
- <view class="l">载重(kg):</view>
|
|
|
+ <view class="l"><text style="color: red;">*</text>货主:</view>
|
|
|
<view class="r">
|
|
|
- <u-input placeholder="请填写车辆载重" v-model="form.carWeight" />
|
|
|
+ <u-input placeholder="输入货主" v-model="form.owner">
|
|
|
+ </u-input>
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="item">
|
|
|
<view class="l">作业人员:</view>
|
|
|
<view class="r">
|
|
|
- <u-input placeholder="作业人员" v-model="form.operator" />
|
|
|
+ <u-input placeholder="输入作业人员" v-model="form.operator">
|
|
|
+ </u-input>
|
|
|
</view>
|
|
|
</view>
|
|
|
-
|
|
|
<view class="item">
|
|
|
- <view class="l">作业时间:</view>
|
|
|
+ <view class="l"><text style="color: red;" v-if="goods.needOperateTime">*</text>作业时间:</view>
|
|
|
<view class="r">
|
|
|
- <uni-datetime-picker placeholder="请选择" :clear-icon="false" type="datetime"
|
|
|
- v-model="form.operateTime" />
|
|
|
+ <uni-datetime-picker type="datetime" v-model="form.operateTime" />
|
|
|
</view>
|
|
|
</view>
|
|
|
<view class="item-line">
|
|
|
- 收费明细<text style="color: red;">(总共{{totalPrice}}元)</text>
|
|
|
+ <u-row style="height: 40px;">
|
|
|
+ <u-col span=4>车辆</u-col>
|
|
|
+ <u-col span=8>
|
|
|
+ <u-button type="primary" text="添加" @click="addCar" icon="plus"
|
|
|
+ style="width: 60px;height: 26px;" />
|
|
|
+ </u-col>
|
|
|
+ </u-row>
|
|
|
+ </view>
|
|
|
+ <view class="item" v-for="(car,index) in car.list" :key="index">
|
|
|
+ <view class="l">车牌:</view>
|
|
|
+ <view class="r">
|
|
|
+ <u-input placeholder="车辆" v-model="car.carNo" readonly>
|
|
|
+ <view slot="suffix" style="display: flex;">
|
|
|
+ <u-icon @click="editCar(car)" size="20" name="edit-pen-fill" color="blue"></u-icon>
|
|
|
+ <u-icon style="margin-left:15rpx;" size="20" @click="delCar(car)" name="close-circle-fill"
|
|
|
+ color="red"></u-icon>
|
|
|
+ </view>
|
|
|
+ </u-input>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <view class="item-line" style="margin-top: 30rpx;">
|
|
|
+ 业务项
|
|
|
+ </view>
|
|
|
+ <view class="business-list" v-for="(item,index) in typeList">
|
|
|
+ <u-row>
|
|
|
+ <u-col span="4">
|
|
|
+ <text>
|
|
|
+ <text style="color: red;display: inline;" v-if="item.need==1">*</text> {{item.name}}:
|
|
|
+ </text>
|
|
|
+ </u-col>
|
|
|
+ <u-col span="8" style="display: flex;">
|
|
|
+ <u-row>
|
|
|
+ <u-col span="10" @click="showSelect(item)">
|
|
|
+ {{item.itemName?item.itemName:'请选择'}}
|
|
|
+ </u-col>
|
|
|
+ <u-col span="2" @click="item.itemName='',item.itemId=''" v-if="item.itemId">
|
|
|
+ <u-icon style="margin-left:15rpx;display: inline;" size="20" name="close-circle-fill"
|
|
|
+ color="red"></u-icon>
|
|
|
+ </u-col>
|
|
|
+ </u-row>
|
|
|
+ </u-col>
|
|
|
+ </u-row>
|
|
|
+ <view style="display: flex;position: relative;left: 50%;">
|
|
|
+ <u-number-box style="margin-left: 15rpx;" v-if="item.itemName" :disabled="item.inc==0"
|
|
|
+ v-model="item.num"></u-number-box>
|
|
|
+ <text style="margin-left: 20rpx;color: red;" v-if="item.itemName">
|
|
|
+ ¥{{item.num*item.price}}
|
|
|
+ </text>
|
|
|
+ </view>
|
|
|
+ <u-line></u-line>
|
|
|
+ </view>
|
|
|
+ <view class="hj" v-show="totalPrice>0">
|
|
|
+ 合计:{{totalPrice}}元
|
|
|
</view>
|
|
|
- <u-checkbox-group v-model="checkList" placement="column">
|
|
|
- <uni-list v-for="item in itemType.items">
|
|
|
- <uni-list-item style="display: inline;" :title="item.itemName" :note="item.price+''+item.unit">
|
|
|
- <template v-slot:header>
|
|
|
- <u-checkbox :name="item.id" :disabled="item.need==1" style="display: inline;">
|
|
|
- </u-checkbox>
|
|
|
- </template>
|
|
|
-
|
|
|
- <template v-slot:footer>
|
|
|
- <div style="position: absolute;right: 230rpx;top: 65rpx;">
|
|
|
- <u-number-box :disabled="item.inc==0" v-model="item.num">
|
|
|
- <view slot="minus" class="minus">
|
|
|
- <u-icon name="minus" size="12"></u-icon>
|
|
|
- </view>
|
|
|
- <text v-if="item.inc==0" slot="input"
|
|
|
- style="width: 50px;text-align: center;color: #E5E5E5;"
|
|
|
- class="input">{{item.num}}</text>
|
|
|
- <text v-else slot="input" style="width: 50px;text-align: center;"
|
|
|
- class="input">{{item.num}}</text>
|
|
|
- <view slot="plus" class="plus">
|
|
|
- <u-icon name="plus" size="12"></u-icon>
|
|
|
- </view>
|
|
|
- </u-number-box>
|
|
|
- </div>
|
|
|
- <u-button v-show="item.needRemark" @click="openRemarkFn(item)" style="width: 50px;"
|
|
|
- type="primary" size="mini" text="备注"></u-button>
|
|
|
- </template>
|
|
|
- </uni-list-item>
|
|
|
- </uni-list>
|
|
|
- </u-checkbox-group>
|
|
|
- </view>
|
|
|
- <view v-if="!form.adminConfirmInput">
|
|
|
- <u-button type="primary" text="修改" @click="saveFn"></u-button>
|
|
|
</view>
|
|
|
+ <u-button type="primary" text="确定" @click="saveFn" v-show="perList.indexOf('tb-business-add')!==-1"></u-button>
|
|
|
<!-- ---------------------------------------------------------- -->
|
|
|
<view class="bottom-safety"></view>
|
|
|
+ <u-picker :show="show" :columns="columns" @confirm="confirmFn" keyName="itemName" @cancel="show=false">
|
|
|
+ </u-picker>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
@@ -112,212 +110,370 @@
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
- showRemark: false,
|
|
|
- type: {
|
|
|
- index: 1,
|
|
|
- list: []
|
|
|
- },
|
|
|
+ show: false,
|
|
|
+ columns: [],
|
|
|
customerId: '1',
|
|
|
customer: {
|
|
|
index: 0,
|
|
|
- list: []
|
|
|
+ customerList: [],
|
|
|
+ },
|
|
|
+ goods: {
|
|
|
+ id: '',
|
|
|
+ name: ''
|
|
|
},
|
|
|
+ typeList: [],
|
|
|
+ allTypeList: [],
|
|
|
form: {
|
|
|
+ customerId: '',
|
|
|
+ declareNo: '',
|
|
|
carNo: '',
|
|
|
+ owner: '',
|
|
|
carSize: '',
|
|
|
- carWeight: '',
|
|
|
- operator: '',
|
|
|
- operateTime: ''
|
|
|
-
|
|
|
+ goodsName: '',
|
|
|
+ netWeight: '',
|
|
|
},
|
|
|
- list: [],
|
|
|
- checkList: [],
|
|
|
- businessItems: [],
|
|
|
- itemType: {
|
|
|
- id: '',
|
|
|
- name: '',
|
|
|
+ show: false,
|
|
|
+ item: {
|
|
|
items: []
|
|
|
},
|
|
|
- checkList: [],
|
|
|
- showSelect: false,
|
|
|
- carList: []
|
|
|
+ car: {
|
|
|
+ list: [{
|
|
|
+ id: '',
|
|
|
+ carNo: '',
|
|
|
+ index: 0
|
|
|
+ }]
|
|
|
+ },
|
|
|
+ perList: []
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
totalPrice() {
|
|
|
- let items = this.itemType.items;
|
|
|
- let checkList = this.checkList;
|
|
|
- items = items.filter(obj => checkList.indexOf(obj.id) !== -1);
|
|
|
+ let typeList = this.typeList.filter(obj => obj.itemName);
|
|
|
let price = 0;
|
|
|
- for (let i in items) {
|
|
|
- let item = items[i];
|
|
|
- price = price + item.price * item.num;
|
|
|
+ for (let i in typeList) {
|
|
|
+ let type = typeList[i];
|
|
|
+ price = price + type.price * type.num;
|
|
|
}
|
|
|
return price;
|
|
|
- }
|
|
|
+ },
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
- this.form.id = options.id;
|
|
|
+ let id = options.id;
|
|
|
+ this.form.id = id;
|
|
|
this.customerId = uni.getStorageSync('customerId');
|
|
|
+ this.goods = JSON.parse(options.goodsJson);
|
|
|
+ this.getCustomerList();
|
|
|
let that = this;
|
|
|
- uni.$on('getRemark', data => {
|
|
|
- that.$nextTick(function() {
|
|
|
- let items = that.itemType.items;
|
|
|
- items.filter(obj => obj.id == data.itemId)[0].remark = data.remark;
|
|
|
+ uni.$on('getSelectDeclare', declare => {
|
|
|
+ that.$nextTick(() => {
|
|
|
+ that.handlerSelectDeclare(declare)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ uni.$on('getCar', car => {
|
|
|
+ that.$nextTick(() => {
|
|
|
+ that.handlerCar(car)
|
|
|
})
|
|
|
})
|
|
|
- setTimeout(() => {
|
|
|
- this.showSelect = false;
|
|
|
- }, 1000)
|
|
|
},
|
|
|
onShow() {
|
|
|
this.getOtherBusinessById();
|
|
|
- },
|
|
|
- onBackPress() {
|
|
|
- this.$common.to('/pages/onely-disinfect/Index');
|
|
|
- return true;
|
|
|
+ this.perList = uni.getStorageSync('perList')
|
|
|
},
|
|
|
methods: {
|
|
|
- carInputFn() {
|
|
|
- this.$api.searchCar({
|
|
|
- carNo: this.form.carNo
|
|
|
- }).then(resp => {
|
|
|
- this.carList = resp.data;
|
|
|
- if (this.carList.length > 0) {
|
|
|
- this.showSelect = true;
|
|
|
+ filterItems() {
|
|
|
+ let carList = this.car.list;
|
|
|
+ let filterTypeList = JSON.parse(JSON.stringify(this.allTypeList));
|
|
|
+ if (carList.length == 0) {
|
|
|
+ this.typeList = filterTypeList;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let car = carList[0];
|
|
|
+ let checkCarList = carList.filter(car => car.carType.indexOf('空') == -1);
|
|
|
+ if (checkCarList.length > 0) {
|
|
|
+ car = checkCarList[0];
|
|
|
+ }
|
|
|
+ let carSize = car.carSize;
|
|
|
+ let carType = car.carType;
|
|
|
+ let netWeight = car.netWeight;
|
|
|
+ let tempList = [];
|
|
|
+ for (let i in filterTypeList) {
|
|
|
+ let type = filterTypeList[i];
|
|
|
+ let items = type.items;
|
|
|
+ if (carType) {
|
|
|
+ items = items.filter(item => item.itemType && item.itemType.indexOf(carType) !== -1);
|
|
|
+ console.log(items)
|
|
|
+ }
|
|
|
+ if (carSize && carSize > 1) {
|
|
|
+ items = items.filter(item => item.minLength <= carSize && item.carLength >= carSize);
|
|
|
+ console.log(items)
|
|
|
+ }
|
|
|
+ if (netWeight && netWeight > 1 && carType.indexOf('空') == -1) {
|
|
|
+ items = items.filter(item => item.minWeight <= netWeight && item.maxWeight >= netWeight);
|
|
|
+ console.log(items)
|
|
|
+ }
|
|
|
+ let itemIds = items.map(item => item.id);
|
|
|
+ if (itemIds.indexOf(type.itemId) == -1) {
|
|
|
+ this.cleanItem(type);
|
|
|
}
|
|
|
+ type.items = items;
|
|
|
+ tempList.push(type);
|
|
|
+ }
|
|
|
+ this.typeList = tempList;
|
|
|
+ },
|
|
|
+ getOtherBusinessById() {
|
|
|
+ this.$api.getOtherBusinessById({
|
|
|
+ id: this.form.id
|
|
|
+ }).then(resp => {
|
|
|
+ let data = resp.data;
|
|
|
+ this.car.list = data.cars;
|
|
|
+ let items = data.items;
|
|
|
+ this.form = data;
|
|
|
+ this.getTypeByGoodsId(items);
|
|
|
})
|
|
|
},
|
|
|
- showWin() {
|
|
|
- this.$refs.popup.open('bottom')
|
|
|
+ showSelect(item) {
|
|
|
+ this.columns = [];
|
|
|
+ this.columns.push(item.items);
|
|
|
+ this.show = true;
|
|
|
},
|
|
|
- groupChange(carNo) {
|
|
|
- let list = this.carList;
|
|
|
- let data = list.filter(obj => obj.carNo == carNo).pop();
|
|
|
- this.form.carNo = carNo;
|
|
|
- this.form.carSize = data.carSize;
|
|
|
- this.list = [];
|
|
|
- setTimeout(() => {
|
|
|
- this.showSelect = false;
|
|
|
- }, 1200)
|
|
|
+
|
|
|
+ confirmFn(e) {
|
|
|
+ let selects = e.value;
|
|
|
+ if (selects.length > 0) {
|
|
|
+ let item = selects[0];
|
|
|
+ let typeId = item.typeId;
|
|
|
+ let typeList = this.typeList;
|
|
|
+ typeList.filter(obj => obj.id == typeId).forEach(obj => {
|
|
|
+ obj.itemId = item.id;
|
|
|
+ obj.itemName = item.itemName;
|
|
|
+ obj.inc = item.inc;
|
|
|
+ obj.price = item.price;
|
|
|
+ })
|
|
|
+ }
|
|
|
+ this.show = false;
|
|
|
},
|
|
|
- getItemTypeEnum() {
|
|
|
- this.$api.getItemTypeEnum().then(resp => {
|
|
|
- this.type.list = resp.data;
|
|
|
- this.type.index = this.type.list.map(obj => obj.name).indexOf(this.form.carType)
|
|
|
+ getTypeByGoodsId(items) {
|
|
|
+ this.$api.getTypeByGoodsId({
|
|
|
+ goodsId: this.goods.id
|
|
|
+ }).then(resp => {
|
|
|
+ let list = resp.data;
|
|
|
+ for (let i in items) {
|
|
|
+ let item = items[i];
|
|
|
+ for (let j in list) {
|
|
|
+ let type = list[j];
|
|
|
+ if (type.id == item.itemTypeId) {
|
|
|
+ type.items.filter(obj => obj.id == item.itemId)
|
|
|
+ .forEach(obj => {
|
|
|
+ type.num = item.num;
|
|
|
+ type.price = item.itemPrice;
|
|
|
+ type.itemName = item.itemName;
|
|
|
+ type.itemId = item.itemId;
|
|
|
+ type.inc = obj.inc;
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.typeList = list;
|
|
|
})
|
|
|
},
|
|
|
getCustomerList() {
|
|
|
- let p = {
|
|
|
- judgeStatus: 2,
|
|
|
+ this.$api.getCustomerList({
|
|
|
pageNo: 1,
|
|
|
- pageSize: 30,
|
|
|
- type: 0
|
|
|
- }
|
|
|
- this.$api.getCustomerList(p).then(resp => {
|
|
|
+ pageSize: 100
|
|
|
+ }).then(resp => {
|
|
|
let list = resp.data;
|
|
|
- this.customer.list = list;
|
|
|
- this.customer.index = list.map(obj => obj.id).indexOf(this.form.customerId);
|
|
|
+ let customerId = this.customerId;
|
|
|
+ if (customerId !== '1') {
|
|
|
+ this.customer.index = list.map(obj => obj.id).indexOf(customerId);
|
|
|
+ }
|
|
|
+ this.customer.customerList = list;
|
|
|
})
|
|
|
},
|
|
|
- openRemarkFn(data) {
|
|
|
- this.$common.to('/pages/onely-disinfect/add-remark?itemId=' + data.id + '&title=' + data.itemName +
|
|
|
- '&remark=' + data.remark + '&mustRemark=' + data.mustRemark)
|
|
|
+ customerChange(e) {
|
|
|
+ var value = e.detail.value; //当前picker选中的值
|
|
|
+ this.customer.index = value;
|
|
|
+ },
|
|
|
+ handlerCar(car) {
|
|
|
+ let list = this.car.list;
|
|
|
+ let check = list.filter(obj => obj.carNo == car.carNo).pop();
|
|
|
+ if (check) {
|
|
|
+ check.carSize = car.carSize;
|
|
|
+ check.netWeight = car.netWeight;
|
|
|
+ check.carType = car.carType;
|
|
|
+ } else {
|
|
|
+ this.car.list.push(car);
|
|
|
+ }
|
|
|
+ this.clearEmptyCar();
|
|
|
},
|
|
|
- closeFn() {
|
|
|
- this.$refs.popup.close()
|
|
|
+ clearEmptyCar() {
|
|
|
+ let list = this.car.list;
|
|
|
+ let obj = list.filter(obj => !obj.carNo).pop();
|
|
|
+ if (obj) {
|
|
|
+ this.car.list.splice(list.indexOf(obj), 1);
|
|
|
+ }
|
|
|
+ this.filterItems();
|
|
|
},
|
|
|
- getItemType() {
|
|
|
- this.$api.getItemType({
|
|
|
- id: this.itemType.id
|
|
|
- }).then(resp => {
|
|
|
- let data = resp.data;
|
|
|
- let items = data.items
|
|
|
- .filter(obj => obj.itemType && obj.itemType.indexOf(this.type.list[this.type.index]
|
|
|
- .name) !== -1);
|
|
|
- data.items = items;
|
|
|
- this.itemType = data;
|
|
|
- let businessItems = this.businessItems;
|
|
|
- console.log(this.form.items)
|
|
|
- this.checkList = this.form.items.map(obj => obj.itemId);
|
|
|
- items.forEach(obj => {
|
|
|
- businessItems.forEach(item => {
|
|
|
- if (obj.id == item.itemId) {
|
|
|
- obj.remark = item.remark;
|
|
|
- obj.num = item.num;
|
|
|
+ handlerSelectDeclare(declare) {
|
|
|
+ let oldDeclareNo = this.form.declareNo;
|
|
|
+ if (oldDeclareNo && oldDeclareNo !== declare.declareNo) {
|
|
|
+ this.car.list = [];
|
|
|
+ }
|
|
|
+ this.form.declareNo = declare.declareNo;
|
|
|
+ this.form.cardNo = declare.carNo;
|
|
|
+ this.form.chinaCarNo = declare.chinaCarNo;
|
|
|
+ this.form.netWeight = declare.grossWeight;
|
|
|
+ this.form.owner = declare.sendUnit;
|
|
|
+ let customerList = this.customer.customerList;
|
|
|
+ this.customer.index = customerList.map(customer => customer.id).indexOf(declare.customerId);
|
|
|
+ let carNo = declare.carNo;
|
|
|
+ let grossWeight = declare.grossWeight;
|
|
|
+ let carList = this.car.list;
|
|
|
+ let exit = carList.filter(obj => obj.carNo == carNo).pop();
|
|
|
+ if (!exit) {
|
|
|
+ let car = {
|
|
|
+ carNo: carNo,
|
|
|
+ netWeight: grossWeight,
|
|
|
+ carType: '载重'
|
|
|
+ }
|
|
|
+ this.car.list.push(car)
|
|
|
+ }
|
|
|
+ this.form.cardNo = declare.carNo;
|
|
|
+ this.form.chinaCarNo = declare.chinaCarNo;
|
|
|
+ this.form.netWeight = declare.grossWeight;
|
|
|
+ let chinaCarNo = declare.chinaCarNo;
|
|
|
+ if (chinaCarNo) {
|
|
|
+ let list = [];
|
|
|
+ chinaCarNo.replace(",", ",").split(",").forEach(carNo => {
|
|
|
+ let exit = carList.filter(obj => obj.carNo == carNo).pop();
|
|
|
+ if (!exit) {
|
|
|
+ let car = {
|
|
|
+ carNo: carNo,
|
|
|
+ carType: '空车'
|
|
|
}
|
|
|
- })
|
|
|
+ this.car.list.push(car)
|
|
|
+ }
|
|
|
})
|
|
|
- })
|
|
|
+ }
|
|
|
+ this.clearEmptyCar();
|
|
|
},
|
|
|
- bindPickerChange(e) {
|
|
|
- this.checkList = [];
|
|
|
- let index = e.detail.value;
|
|
|
- this.type.index = index //当前picker选中的值
|
|
|
- this.getItemType();
|
|
|
+
|
|
|
+ selectDeclare() {
|
|
|
+ this.$common.to('/pages/business-entering/declare-select?declareNo=' + this.form.declareNo)
|
|
|
},
|
|
|
- customerChange(e) {
|
|
|
- let index = e.detail.value;
|
|
|
- this.customer.index = index //当前picker选中的值
|
|
|
+ editCar(car) {
|
|
|
+ let goods = this.goods;
|
|
|
+ this.$common.to('/pages/onely-disinfect/car-manager?carJson=' + JSON.stringify(car) + "&needCarSize=" +
|
|
|
+ goods.needCarSize + '&needWeight=' + goods.needWeight)
|
|
|
},
|
|
|
- saveFn() {
|
|
|
- if (!this.form.carNo) {
|
|
|
- this.$common.toast('请输入车牌号')
|
|
|
+ delCar(car) {
|
|
|
+ let list = this.car.list;
|
|
|
+ if (list.length == 1) {
|
|
|
+ this.$common.toast('至少有一辆车');
|
|
|
return;
|
|
|
}
|
|
|
- if (!this.form.operateTime) {
|
|
|
- this.$common.toast('请选择作业时间')
|
|
|
- return;
|
|
|
+ this.car.list.splice(list.indexOf(car), 1);
|
|
|
+ this.filterItems();
|
|
|
+ },
|
|
|
+ check() {
|
|
|
+ let form = this.form;
|
|
|
+ let goods = this.goods;
|
|
|
+ let needDeclare = goods.needDeclare;
|
|
|
+ if (needDeclare == 1 && !form.declareNo) {
|
|
|
+ this.$common.toast('请选择申报单');
|
|
|
+ return false;
|
|
|
}
|
|
|
- let itemList = this.itemType.items;
|
|
|
- let checkList = this.checkList;
|
|
|
- let list = itemList.filter(obj => checkList.indexOf(obj.id) !== -1);
|
|
|
- this.form.itemTypeId = this.itemType.id;
|
|
|
- this.form.items = list;
|
|
|
- this.form.carType = this.type.list[this.type.index].name
|
|
|
- if (this.customerId == '1') {
|
|
|
- this.form.customerId = this.customer.list[this.customer.index].id;
|
|
|
- } else {
|
|
|
- this.form.customerId = this.customerId
|
|
|
+ if (!form.owner) {
|
|
|
+ this.$common.toast('请填写货主');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ let needOperateTime = goods.needOperateTime;
|
|
|
+ let operateTime = form.operateTime;
|
|
|
+ if (!operateTime && needOperateTime == '1') {
|
|
|
+ this.$common.toast('请录入作业时间');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ console.log(operateTime.length)
|
|
|
+ if (operateTime.length < 12) {
|
|
|
+ this.$common.toast('请录入准确的作业时间');
|
|
|
+ return false;
|
|
|
}
|
|
|
- let that = this;
|
|
|
- let content = '确认修改该业务'
|
|
|
- uni.showModal({
|
|
|
- title: '提示',
|
|
|
- content: content,
|
|
|
- success(res) {
|
|
|
- if (res.confirm) {
|
|
|
- that.editFn()
|
|
|
+ let carList = this.car.list;
|
|
|
+ if (carList.length == 0) {
|
|
|
+ this.$common.toast('请录入车辆');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ let needCarSize = goods.needCarSize;
|
|
|
+ let needWeight = goods.needWeight;
|
|
|
+ for (let i in carList) {
|
|
|
+ let car = carList[i];
|
|
|
+ if (needCarSize == 1 && !car.carSize) {
|
|
|
+ this.$common.toast('请补充' + car.carNo + '的规格');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (needWeight == 1 && car.carType.indexOf('重') !== -1 && !car.netWeight) {
|
|
|
+ this.$common.toast('请补充' + car.carNo + '载重');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ let typeList = this.typeList;
|
|
|
+ let selectList = [];
|
|
|
+ for (let i in typeList) {
|
|
|
+ let type = typeList[i];
|
|
|
+ if (type.need == 1 && !type.itemId) {
|
|
|
+ this.$common.toast('【' + type.name + '】必选');
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (type.itemId) {
|
|
|
+ let obj = {
|
|
|
+ typeId: type.id,
|
|
|
+ typeName: type.name,
|
|
|
+ id: type.itemId,
|
|
|
+ num: type.num,
|
|
|
+ price: type.price,
|
|
|
+ remark: type.remark
|
|
|
}
|
|
|
+ selectList.push(obj);
|
|
|
}
|
|
|
- })
|
|
|
+ }
|
|
|
+ this.form.itemJson = JSON.stringify(selectList);
|
|
|
+ this.form.carJson = JSON.stringify(this.car.list);
|
|
|
+ this.form.items = null;
|
|
|
+ this.form.cars = null;
|
|
|
+ let customerList = this.customer.customerList;
|
|
|
+ let index = this.customer.index;
|
|
|
+ let customer = customerList[index];
|
|
|
+ this.form.customerId = customer.id;
|
|
|
+ this.form.customerName = customer.name;
|
|
|
+ this.form.goodsId = this.goods.id;
|
|
|
+ this.form.goodsName = this.goods.name;
|
|
|
+ let chinaCarNo = carList
|
|
|
+ .filter(car => this.$common.isCarNo(car.carNo.toUpperCase()))
|
|
|
+ .map(car => car.carNo.toUpperCase())
|
|
|
+ .join("、");
|
|
|
+ let yueCarNo = carList
|
|
|
+ .filter(car => !this.$common.isCarNo(car.carNo.toUpperCase()))
|
|
|
+ .map(car => car.carNo.toUpperCase())
|
|
|
+ .join("、");
|
|
|
+ this.form.cardNo = yueCarNo;
|
|
|
+ this.form.chinaCarNo = chinaCarNo;
|
|
|
+ return true;
|
|
|
},
|
|
|
- getOtherBusinessById() {
|
|
|
- this.$api.getOtherBusinessById({
|
|
|
- id: this.form.id
|
|
|
- }).then(resp => {
|
|
|
- let data = resp.data;
|
|
|
- this.form = data;
|
|
|
- this.businessItems = data.items;
|
|
|
- this.itemType.id = data.itemTypeId;
|
|
|
- this.getItemType();
|
|
|
- this.getCustomerList();
|
|
|
- this.getItemTypeEnum();
|
|
|
-
|
|
|
- })
|
|
|
+ saveFn() {
|
|
|
+ if (this.check()) {
|
|
|
+ let obj = this.$common.removeNull(this.form);
|
|
|
+ this.$api.editOtherBusiness(obj).then(resp => {
|
|
|
+ if (resp.code == 200) {
|
|
|
+ this.$common.toast('修改成功');
|
|
|
+ setTimeout(() => {
|
|
|
+ this.$common.to('/pages/onely-disinfect/Index')
|
|
|
+ }, 1000)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
- editFn() {
|
|
|
- this.$api.editCarDisinfect(this.$common.removeNull(this.form)).then(resp => {
|
|
|
- if (resp.code == 200) {
|
|
|
- this.$common.toast('修改成功');
|
|
|
- setTimeout(() => {
|
|
|
- this.$common.to('/pages/onely-disinfect/Index')
|
|
|
- }, 1500)
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
+ }
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
@@ -326,17 +482,6 @@
|
|
|
background-color: #fff;
|
|
|
}
|
|
|
|
|
|
- .list {
|
|
|
- position: absolute;
|
|
|
- left: 34%;
|
|
|
- z-index: 999;
|
|
|
- background: #e5e5e5;
|
|
|
- padding: 10rpx 200rpx 10rpx 40rpx;
|
|
|
- border-radius: 10rpx;
|
|
|
- height: 120rpx;
|
|
|
- overflow-y: auto;
|
|
|
- }
|
|
|
-
|
|
|
.hs-item {
|
|
|
text-align: center;
|
|
|
}
|
|
|
@@ -354,6 +499,12 @@
|
|
|
font-weight: bold;
|
|
|
}
|
|
|
|
|
|
+ .business-list {
|
|
|
+ line-height: 75rpx;
|
|
|
+ margin: 4rpx 0 0 48rpx;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
.save-btn {
|
|
|
background-color: #ff4200;
|
|
|
height: 88rpx;
|