Commit 1b3f0d37 authored by Smile's avatar Smile

需求129 后台-集运-包裹列表-编辑包裹

parent 1c3d1d71
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
:key="$route.fullPath" :key="$route.fullPath"
:validate-on-rule-change="false" :validate-on-rule-change="false"
> >
<div class="page-title">{{ editMode ? $t('编辑包裹') + '-' + (form.consNo) : $t('新建包裹') }}</div> <div class="page-title">{{ editMode ? $t('编辑包裹') + '-' + (form.consNum) : $t('新建包裹') }}</div>
<el-card class="form-section mt-10"> <el-card class="form-section mt-10">
<el-form-item :label="$t('集运仓库')" v-model="form.wareId" prop="wareId" :rules="{ <el-form-item :label="$t('集运仓库')" v-model="form.wareId" prop="wareId" :rules="{
required: true, message: '请选择集运仓库', trigger: 'blur' required: true, message: '请选择集运仓库', trigger: 'blur'
...@@ -38,8 +38,8 @@ ...@@ -38,8 +38,8 @@
</el-form-item> </el-form-item>
<el-form-item :label="$t('电话')" prop="consignorPhone"> <el-form-item :label="$t('电话')" prop="consignorPhone">
<div class="flex"> <div class="flex">
<area-code-selector v-model="form.consignorCountryCode" class="w-200 mr-10" disabled/> <area-code-selector v-model="form.areaCode" class="w-200 mr-10" disabled/>
<el-input v-model="form.consignorPhone" class="w-200" disabled/> <el-input v-model="form.phoneNew" class="w-200" disabled/>
</div> </div>
</el-form-item> </el-form-item>
</el-card> </el-card>
...@@ -180,11 +180,12 @@ ...@@ -180,11 +180,12 @@
<el-card class="form-section mt-10"> <el-card class="form-section mt-10">
<div slot="header" class="card-title1">{{ $t('签收图片') }}</div> <div slot="header" class="card-title1">{{ $t('签收图片') }}</div>
<el-form-item prop="img"> <el-form-item prop="img">
<image-upload v-model="form.imgs"/> <image-upload v-model="form.mediaUrl"/>
</el-form-item> </el-form-item>
</el-card> </el-card>
</el-form> </el-form>
<el-button type="primary" @click="submitForm(0)">{{ $t('添加包裹') }}</el-button><!--草稿--> <el-button type="primary" @click="submitForm(0)" v-if="!editMode">{{ $t('添加包裹') }}</el-button><!--草稿-->
<el-button type="primary" @click="submitForm(1)" v-if="editMode">{{ $t('保存') }}</el-button><!--草稿-->
<el-button @click="$store.dispatch('tagsView/delCurrentView')">{{ $t('取消') }}</el-button> <el-button @click="$store.dispatch('tagsView/delCurrentView')">{{ $t('取消') }}</el-button>
<choose-contact-dialog v-if="!!contactChooseType" :type="2" @choose="onContactChoose" <choose-contact-dialog v-if="!!contactChooseType" :type="2" @choose="onContactChoose"
@close="contactChooseType=null"/> @close="contactChooseType=null"/>
...@@ -204,7 +205,7 @@ import ChooseContactDialog from "@/components/ChooseContactDialog/index.vue"; ...@@ -204,7 +205,7 @@ import ChooseContactDialog from "@/components/ChooseContactDialog/index.vue";
import QuickCreateCustomer from "@/components/QuickCreateCustomer/index.vue"; import QuickCreateCustomer from "@/components/QuickCreateCustomer/index.vue";
import Selector from "@/components/Selector/index.vue"; import Selector from "@/components/Selector/index.vue";
import {getTradeCityList} from "@/api/ecw/region"; import {getTradeCityList} from "@/api/ecw/region";
import {createCons, getConsCourierNumber} from "@/api/ecw/cons"; import {createCons, getCons, getConsCourierNumber, updateCons} from "@/api/ecw/cons";
import {getExpressPage} from "@/api/ecw/express"; import {getExpressPage} from "@/api/ecw/express";
import Template from "@/views/cms/template/index.vue"; import Template from "@/views/cms/template/index.vue";
import ProductSelector from "@/components/ProductSelector/index.vue"; import ProductSelector from "@/components/ProductSelector/index.vue";
...@@ -232,6 +233,7 @@ export default { ...@@ -232,6 +233,7 @@ export default {
form: { form: {
consItemVOList: [], consItemVOList: [],
}, },
isUpdate:false,
rules: {}, rules: {},
warehouseList: [], warehouseList: [],
tradeCityList: [], tradeCityList: [],
...@@ -244,7 +246,12 @@ export default { ...@@ -244,7 +246,12 @@ export default {
expressList: [], expressList: [],
} }
}, },
watch: {}, watch: {
'form.wareId'(val) {
this.form.departureId=this.warehouseList.find(item => item.id === val).shi
this.getOpenedRouterList()
},
},
computed: { computed: {
sum() { sum() {
let sum = { let sum = {
...@@ -312,8 +319,18 @@ export default { ...@@ -312,8 +319,18 @@ export default {
}); });
await this.getTradeCity() await this.getTradeCity()
this.addProduct() this.addProduct()
if (this.$route.query.id) {
console.log('created 加载订单数据')
this.isUpdate=true
this.getCons()
}
}, },
methods: { methods: {
getCons(){
getCons(this.$route.query.id).then(res => {
this.form = res.data
})
},
submitForm(val) { submitForm(val) {
this.form.sumQuantity = Number(this.sum.totalQuatity.toFixed()) this.form.sumQuantity = Number(this.sum.totalQuatity.toFixed())
this.$refs["form"].validate(async (valid, errors) => { this.$refs["form"].validate(async (valid, errors) => {
...@@ -353,7 +370,11 @@ export default { ...@@ -353,7 +370,11 @@ export default {
cancelButtonText: this.$t('前去检查'), cancelButtonText: this.$t('前去检查'),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.createCons() if (val===0){
this.createCons()
}else {
this.updateCons()
}
}).catch(() => { }).catch(() => {
this.$message({ this.$message({
type: 'info', type: 'info',
...@@ -365,6 +386,16 @@ export default { ...@@ -365,6 +386,16 @@ export default {
} }
}, },
updateCons() {
updateCons(this.form).then(res => {
if (res.code === 0){
this.$modal.msgSuccess(this.$t("修改成功"));
this.$router.back()
}else{
this.$message.error(res.msg)
}
})
},
createCons() { createCons() {
createCons(this.form).then(res => { createCons(this.form).then(res => {
if (res.code === 0) { if (res.code === 0) {
...@@ -385,8 +416,8 @@ export default { ...@@ -385,8 +416,8 @@ export default {
consItemVOList: [], consItemVOList: [],
wareId: oldForm.wareId, wareId: oldForm.wareId,
customerNumber: '', customerNumber: '',
consignorPhone: '', phoneNew: '',
consignorCountryCode: '', areaCode: '',
transportId: oldForm.transportId, transportId: oldForm.transportId,
departureId: null, departureId: null,
consigneeCountryId: oldForm.consigneeCountryId, consigneeCountryId: oldForm.consigneeCountryId,
...@@ -396,7 +427,7 @@ export default { ...@@ -396,7 +427,7 @@ export default {
expressId: null, expressId: null,
worth: '', worth: '',
remarks: '', remarks: '',
imgs: [] mediaUrl: []
} }
this.addProduct() this.addProduct()
}, },
...@@ -506,8 +537,8 @@ export default { ...@@ -506,8 +537,8 @@ export default {
} }
this.$set(this.form, 'customerNumber', contact.customerNumber) this.$set(this.form, 'customerNumber', contact.customerNumber)
this.$set(this.form, 'customerId', contact.customerId) this.$set(this.form, 'customerId', contact.customerId)
this.$set(this.form, this.contactChooseType + 'CountryCode', contact.areaCode.replace('+', '')) this.$set(this.form, 'areaCode', contact.areaCode.replace('+', ''))
this.$set(this.form, this.contactChooseType + 'Phone', contact.phoneNew) this.$set(this.form, 'phoneNew', contact.phoneNew)
if (this.contactChooseType == 'consignor') { if (this.contactChooseType == 'consignor') {
this.noConsignee = contact.noConsignee this.noConsignee = contact.noConsignee
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment