Commit e3fbd569850322421ccc869d0b0c544a915ae991

Authored by gesilong
1 parent 3321d521

commit:目的地改回选择

@@ -88,10 +88,12 @@ @@ -88,10 +88,12 @@
88 <uni-easyinput v-model="form.transportMode" placeholder="请输入运输方式" :inputBorder="false" /> 88 <uni-easyinput v-model="form.transportMode" placeholder="请输入运输方式" :inputBorder="false" />
89 </template> 89 </template>
90 </uni-list-item> 90 </uni-list-item>
91 -  
92 - <uni-list-item title="目的地">  
93 - <template v-slot:footer>  
94 - <uni-easyinput v-model="form.foreignDestination" placeholder="请输入目的地" :inputBorder="false" /> 91 +
  92 + <uni-list-item class="select-item" :class="(Array.isArray(form.destinationId) && form.destinationId.length) ? 'is-filled' : 'is-empty'" clickable
  93 + @click="openCitySelector" :rightText="form.destinationLabel || '请选择'" showArrow>
  94 + <template v-slot:body>
  95 + <view class="item-title"><text>目的地</text></view>
  96 + <CitySelector ref="citySelectorRef" v-model="form.destinationId" @change="onCityChange" />
95 </template> 97 </template>
96 </uni-list-item> 98 </uni-list-item>
97 <uni-list-item class="select-item" :class="form.includesPackagingFeeName ? 'is-filled' : 'is-empty'" clickable 99 <uni-list-item class="select-item" :class="form.includesPackagingFeeName ? 'is-filled' : 'is-empty'" clickable
@@ -228,6 +230,7 @@ @@ -228,6 +230,7 @@
228 import SingleSelectSheet from '@/components/single-select/index.vue' 230 import SingleSelectSheet from '@/components/single-select/index.vue'
229 import RelateSelectSheet from '@/components/relate-select/index.vue' 231 import RelateSelectSheet from '@/components/relate-select/index.vue'
230 import ProductRel from './productRel.vue' 232 import ProductRel from './productRel.vue'
  233 +import CitySelector from '@/components/city-selector/index.vue'
231 import { getRetailCodeApi, createContractApi, getCustomerRemarks, getCustomerSpecificQualityRequirements, getDeptApi, getContractApi } from '@/api/contract' 234 import { getRetailCodeApi, createContractApi, getCustomerRemarks, getCustomerSpecificQualityRequirements, getDeptApi, getContractApi } from '@/api/contract'
232 import { getDicByCodes } from '@/utils/dic' 235 import { getDicByCodes } from '@/utils/dic'
233 import { formatCurrencyToChinese } from '@/utils/common' 236 import { formatCurrencyToChinese } from '@/utils/common'
@@ -236,7 +239,7 @@ import { getArea } from '@/api/credit_manage.js' @@ -236,7 +239,7 @@ import { getArea } from '@/api/credit_manage.js'
236 239
237 export default { 240 export default {
238 name: 'AddContractProcess', 241 name: 'AddContractProcess',
239 - components: { SingleSelectSheet, RelateSelectSheet, ProductRel }, 242 + components: { SingleSelectSheet, RelateSelectSheet, ProductRel, CitySelector },
240 data() { 243 data() {
241 return { 244 return {
242 copyId: '', 245 copyId: '',
@@ -263,6 +266,8 @@ export default { @@ -263,6 +266,8 @@ export default {
263 includesTransportFeeName: '否', 266 includesTransportFeeName: '否',
264 unit: '元、公斤、元/公斤', 267 unit: '元、公斤、元/公斤',
265 totalAmountCapital: '', 268 totalAmountCapital: '',
  269 + destinationId: [],
  270 + destinationLabel: '',
266 foreignDestination: '', 271 foreignDestination: '',
267 workshopIdName: '', 272 workshopIdName: '',
268 workshopId: '', 273 workshopId: '',
@@ -314,6 +319,11 @@ export default { @@ -314,6 +319,11 @@ export default {
314 this.loadRegionOptions() 319 this.loadRegionOptions()
315 if (!this.copyId) this.form.orderDate = this.formatDate(new Date()) 320 if (!this.copyId) this.form.orderDate = this.formatDate(new Date())
316 if (this.copyId) this.loadCopyDetail(this.copyId) 321 if (this.copyId) this.loadCopyDetail(this.copyId)
  322 + this.$nextTick(() => {
  323 + if (Array.isArray(this.form.destinationId) && this.form.destinationId.length) {
  324 + this.initDestinationLabel()
  325 + }
  326 + })
317 }, 327 },
318 watch: { 328 watch: {
319 'form.buyer': { 329 'form.buyer': {
@@ -365,6 +375,8 @@ export default { @@ -365,6 +375,8 @@ export default {
365 const includesPackagingFeeName = data.includesPackagingFeeName || (data.includesPackagingFee ? '是' : '否') 375 const includesPackagingFeeName = data.includesPackagingFeeName || (data.includesPackagingFee ? '是' : '否')
366 const includesTransportFeeName = data.includesTransportFeeName || (data.includesTransportFee ? '是' : '否') 376 const includesTransportFeeName = data.includesTransportFeeName || (data.includesTransportFee ? '是' : '否')
367 const m = { ...data, includesPackagingFeeName, includesTransportFeeName } 377 const m = { ...data, includesPackagingFeeName, includesTransportFeeName }
  378 + const destinationId = (m.provinceId && m.cityId && m.districtId) ? [m.provinceId, m.cityId, m.districtId] : (Array.isArray(m.destinationId) ? m.destinationId : [])
  379 + const destinationLabel = (m.provinceName && m.cityName && m.districtName) ? `${m.provinceName} / ${m.cityName} / ${m.districtName}` : (m.destinationLabel || m.foreignDestination || '')
368 380
369 const code = this.form.code 381 const code = this.form.code
370 this.form = { 382 this.form = {
@@ -393,7 +405,9 @@ export default { @@ -393,7 +405,9 @@ export default {
393 packagingRequirements: m.packagingRequirements || '', 405 packagingRequirements: m.packagingRequirements || '',
394 paymentTerms: m.paymentTerms || '', 406 paymentTerms: m.paymentTerms || '',
395 transportMode: m.transportMode || '', 407 transportMode: m.transportMode || '',
396 - foreignDestination: (m.foreignDestination || ''), 408 + destinationId,
  409 + destinationLabel,
  410 + foreignDestination: (destinationLabel || m.foreignDestination || ''),
397 specialInstructions: m.specialInstructions || '', 411 specialInstructions: m.specialInstructions || '',
398 remarks: m.remarks || '', 412 remarks: m.remarks || '',
399 pieceWeightHead: m.pieceWeightHead || '', 413 pieceWeightHead: m.pieceWeightHead || '',
@@ -410,9 +424,13 @@ export default { @@ -410,9 +424,13 @@ export default {
410 deptId: m.deptId || this.form.deptId, 424 deptId: m.deptId || this.form.deptId,
411 code, 425 code,
412 } 426 }
  427 + await this.$nextTick()
  428 + if (Array.isArray(this.form.destinationId) && this.form.destinationId.length) {
  429 + await this.initDestinationLabel()
  430 + this.form.foreignDestination = this.form.destinationLabel || this.form.foreignDestination || ''
  431 + }
413 432
414 const lines = Array.isArray(m.contractStdProcessingLineList) ? m.contractStdProcessingLineList : [] 433 const lines = Array.isArray(m.contractStdProcessingLineList) ? m.contractStdProcessingLineList : []
415 - await this.$nextTick()  
416 const comp = this.$refs.productRel 434 const comp = this.$refs.productRel
417 if (comp && typeof comp.defaultItem === 'function') { 435 if (comp && typeof comp.defaultItem === 'function') {
418 const nextItems = (lines.length ? lines : [{}]).map(x => ({ 436 const nextItems = (lines.length ? lines : [{}]).map(x => ({
@@ -432,6 +450,21 @@ export default { @@ -432,6 +450,21 @@ export default {
432 uni.showToast({ title: '复制失败,请稍后重试', icon: 'none' }) 450 uni.showToast({ title: '复制失败,请稍后重试', icon: 'none' })
433 } 451 }
434 }, 452 },
  453 + async initDestinationLabel() {
  454 + const comp = this.$refs.citySelectorRef
  455 + if (comp && typeof comp.getLabel === 'function') {
  456 + const label = await comp.getLabel()
  457 + this.form.destinationLabel = label || this.form.destinationLabel || ''
  458 + }
  459 + },
  460 + openCitySelector() {
  461 + this.$refs.citySelectorRef && this.$refs.citySelectorRef.open()
  462 + },
  463 + onCityChange(payload) {
  464 + const label = payload && payload.label != null ? payload.label : ''
  465 + this.form.destinationLabel = label
  466 + this.form.foreignDestination = label
  467 + },
435 async loadRegionOptions() { 468 async loadRegionOptions() {
436 try { 469 try {
437 const res = await getArea() 470 const res = await getArea()
@@ -653,10 +686,13 @@ export default { @@ -653,10 +686,13 @@ export default {
653 return out 686 return out
654 } 687 }
655 const lines = (this.productLineList || []).map(it => clean(it)) 688 const lines = (this.productLineList || []).map(it => clean(it))
  689 + const { destinationLabel, destinationId, ...formForSubmit } = this.form
  690 + const destination = destinationId && destinationId.length > 0 ? destinationId[destinationId.length - 1] : ''
656 const payload = clean({ 691 const payload = clean({
657 - ...this.form, 692 + ...formForSubmit,
658 operateType: isCopy ? 'COPY' : 'ADD', 693 operateType: isCopy ? 'COPY' : 'ADD',
659 type: 'PROCESS_STD_AGMT', 694 type: 'PROCESS_STD_AGMT',
  695 + destination,
660 totalQuantity: this.totalQuantity, 696 totalQuantity: this.totalQuantity,
661 totalAmountExcludingTax: this.totalAmountExcludingTax, 697 totalAmountExcludingTax: this.totalAmountExcludingTax,
662 totalAmountIncludingTax: this.totalAmountIncludingTax, 698 totalAmountIncludingTax: this.totalAmountIncludingTax,
@@ -70,9 +70,11 @@ @@ -70,9 +70,11 @@
70 <uni-easyinput v-model="form.transportMode" placeholder="请输入运输方式" :inputBorder="false" /> 70 <uni-easyinput v-model="form.transportMode" placeholder="请输入运输方式" :inputBorder="false" />
71 </template> 71 </template>
72 </uni-list-item> 72 </uni-list-item>
73 - <uni-list-item title="目的地">  
74 - <template v-slot:footer>  
75 - <uni-easyinput v-model="form.foreignDestination" placeholder="请输入目的地" :inputBorder="false" /> 73 + <uni-list-item class="select-item" :class="(Array.isArray(form.destinationId) && form.destinationId.length) ? 'is-filled' : 'is-empty'" clickable
  74 + @click="openCitySelector" :rightText="form.destinationLabel || '请选择'" showArrow>
  75 + <template v-slot:body>
  76 + <view class="item-title"><text>目的地</text></view>
  77 + <CitySelector ref="citySelectorRef" v-model="form.destinationId" @change="onCityChange" />
76 </template> 78 </template>
77 </uni-list-item> 79 </uni-list-item>
78 80
@@ -204,6 +206,7 @@ import SingleSelectSheet from '@/components/single-select/index.vue' @@ -204,6 +206,7 @@ import SingleSelectSheet from '@/components/single-select/index.vue'
204 import RelateSelectSheet from '@/components/relate-select/index.vue' 206 import RelateSelectSheet from '@/components/relate-select/index.vue'
205 import ProductRel from './productRel.vue' 207 import ProductRel from './productRel.vue'
206 import FileUpload from '@/components/file-upload/index.vue' 208 import FileUpload from '@/components/file-upload/index.vue'
  209 +import CitySelector from '@/components/city-selector/index.vue'
207 import { getContractApi, uploadStandardContract } from '@/api/contract' 210 import { getContractApi, uploadStandardContract } from '@/api/contract'
208 import { getDicByCodes } from '@/utils/dic' 211 import { getDicByCodes } from '@/utils/dic'
209 import { formatCurrencyToChinese } from '@/utils/common' 212 import { formatCurrencyToChinese } from '@/utils/common'
@@ -212,7 +215,7 @@ import { getArea } from '@/api/credit_manage.js' @@ -212,7 +215,7 @@ import { getArea } from '@/api/credit_manage.js'
212 215
213 export default { 216 export default {
214 name: 'AgmtViewer', 217 name: 'AgmtViewer',
215 - components: { SingleSelectSheet, RelateSelectSheet, ProductRel, FileUpload }, 218 + components: { SingleSelectSheet, RelateSelectSheet, ProductRel, FileUpload, CitySelector },
216 props: { 219 props: {
217 id: { 220 id: {
218 type: [String, Number], 221 type: [String, Number],
@@ -255,6 +258,8 @@ export default { @@ -255,6 +258,8 @@ export default {
255 packagingRequirements: '', 258 packagingRequirements: '',
256 paymentTerms: '', 259 paymentTerms: '',
257 transportMode: '', 260 transportMode: '',
  261 + destinationId: [],
  262 + destinationLabel: '',
258 foreignDestination: '', 263 foreignDestination: '',
259 specialInstructions: '', 264 specialInstructions: '',
260 remarks: '', 265 remarks: '',
@@ -323,6 +328,8 @@ export default { @@ -323,6 +328,8 @@ export default {
323 const includesPackagingFeeName = data.includesPackagingFeeName || (data.includesPackagingFee ? '是' : '否') 328 const includesPackagingFeeName = data.includesPackagingFeeName || (data.includesPackagingFee ? '是' : '否')
324 const includesTransportFeeName = data.includesTransportFeeName || (data.includesTransportFee ? '是' : '否') 329 const includesTransportFeeName = data.includesTransportFeeName || (data.includesTransportFee ? '是' : '否')
325 const m = { ...data, includesPackagingFeeName, includesTransportFeeName } 330 const m = { ...data, includesPackagingFeeName, includesTransportFeeName }
  331 + const destinationId = (m.provinceId && m.cityId && m.districtId) ? [m.provinceId, m.cityId, m.districtId] : (Array.isArray(m.destinationId) ? m.destinationId : [])
  332 + const destinationLabel = (m.provinceName && m.cityName && m.districtName) ? `${m.provinceName} / ${m.cityName} / ${m.districtName}` : (m.destinationLabel || m.foreignDestination || '')
326 this.form = { 333 this.form = {
327 ...this.form, 334 ...this.form,
328 id: m.id || '', 335 id: m.id || '',
@@ -350,7 +357,9 @@ export default { @@ -350,7 +357,9 @@ export default {
350 packagingRequirements: m.packagingRequirements || '', 357 packagingRequirements: m.packagingRequirements || '',
351 paymentTerms: m.paymentTerms || '', 358 paymentTerms: m.paymentTerms || '',
352 transportMode: m.transportMode || '', 359 transportMode: m.transportMode || '',
353 - foreignDestination: (m.foreignDestination || ''), 360 + destinationId,
  361 + destinationLabel,
  362 + foreignDestination: (destinationLabel || m.foreignDestination || ''),
354 specialInstructions: m.specialInstructions || '', 363 specialInstructions: m.specialInstructions || '',
355 remarks: m.remarks || '', 364 remarks: m.remarks || '',
356 pieceWeightHead: m.pieceWeightHead || '', 365 pieceWeightHead: m.pieceWeightHead || '',
@@ -375,8 +384,28 @@ export default { @@ -375,8 +384,28 @@ export default {
375 const lines = Array.isArray(m.contractStdProcessingLineList) ? m.contractStdProcessingLineList : [] 384 const lines = Array.isArray(m.contractStdProcessingLineList) ? m.contractStdProcessingLineList : []
376 this.productLineList = lines 385 this.productLineList = lines
377 this.onProductsChange(lines) 386 this.onProductsChange(lines)
  387 + await this.$nextTick()
  388 + if (Array.isArray(this.form.destinationId) && this.form.destinationId.length) {
  389 + await this.initDestinationLabel()
  390 + this.form.foreignDestination = this.form.destinationLabel || this.form.foreignDestination || ''
  391 + }
378 } catch (e) { } 392 } catch (e) { }
379 }, 393 },
  394 + async initDestinationLabel() {
  395 + const comp = this.$refs.citySelectorRef
  396 + if (comp && typeof comp.getLabel === 'function') {
  397 + const label = await comp.getLabel()
  398 + this.form.destinationLabel = label || this.form.destinationLabel || ''
  399 + }
  400 + },
  401 + openCitySelector() {
  402 + this.$refs.citySelectorRef && this.$refs.citySelectorRef.open()
  403 + },
  404 + onCityChange(payload) {
  405 + const label = payload && payload.label != null ? payload.label : ''
  406 + this.form.destinationLabel = label
  407 + this.form.foreignDestination = label
  408 + },
380 onProductsChange(products) { 409 onProductsChange(products) {
381 const list = Array.isArray(products) ? products : [] 410 const list = Array.isArray(products) ? products : []
382 this.newProductLineList = list 411 this.newProductLineList = list
@@ -414,6 +414,7 @@ export default { @@ -414,6 +414,7 @@ export default {
414 const data = res && res.data ? res.data : {} 414 const data = res && res.data ? res.data : {}
415 const includesPackagingFeeName = data.includesPackagingFeeName || (data.includesPackagingFee ? '是' : '否') 415 const includesPackagingFeeName = data.includesPackagingFeeName || (data.includesPackagingFee ? '是' : '否')
416 const includesTransportFeeName = data.includesTransportFeeName || (data.includesTransportFee ? '是' : '否') 416 const includesTransportFeeName = data.includesTransportFeeName || (data.includesTransportFee ? '是' : '否')
  417 + const destinationLabel = (data.provinceName && data.cityName && data.districtName) ? `${data.provinceName} / ${data.cityName} / ${data.districtName}` : (data.destinationLabel || data.foreignDestination || '')
417 this.detail = { 418 this.detail = {
418 ...this.detail, 419 ...this.detail,
419 ...data, 420 ...data,
@@ -421,7 +422,7 @@ export default { @@ -421,7 +422,7 @@ export default {
421 regionName: data.regionName || '', 422 regionName: data.regionName || '',
422 deptName: data.deptName || '', 423 deptName: data.deptName || '',
423 includesPackagingFeeName, includesTransportFeeName, 424 includesPackagingFeeName, includesTransportFeeName,
424 - foreignDestination: (data.foreignDestination || ''), 425 + foreignDestination: destinationLabel,
425 } 426 }
426 this.detail = await fillStandardApprovedName(this.detail) 427 this.detail = await fillStandardApprovedName(this.detail)
427 const lines = Array.isArray(data.contractStdProcessingLineList) ? data.contractStdProcessingLineList : [] 428 const lines = Array.isArray(data.contractStdProcessingLineList) ? data.contractStdProcessingLineList : []
@@ -70,9 +70,11 @@ @@ -70,9 +70,11 @@
70 <uni-easyinput v-model="form.transportMode" placeholder="请输入运输方式" :inputBorder="false" /> 70 <uni-easyinput v-model="form.transportMode" placeholder="请输入运输方式" :inputBorder="false" />
71 </template> 71 </template>
72 </uni-list-item> 72 </uni-list-item>
73 - <uni-list-item title="目的地">  
74 - <template v-slot:footer>  
75 - <uni-easyinput v-model="form.foreignDestination" placeholder="请输入目的地" :inputBorder="false" /> 73 + <uni-list-item class="select-item" :class="(Array.isArray(form.destinationId) && form.destinationId.length) ? 'is-filled' : 'is-empty'" clickable
  74 + @click="openCitySelector" :rightText="form.destinationLabel || '请选择'" showArrow>
  75 + <template v-slot:body>
  76 + <view class="item-title"><text>目的地</text></view>
  77 + <CitySelector ref="citySelectorRef" v-model="form.destinationId" @change="onCityChange" />
76 </template> 78 </template>
77 </uni-list-item> 79 </uni-list-item>
78 80
@@ -193,6 +195,7 @@ @@ -193,6 +195,7 @@
193 import SingleSelectSheet from '@/components/single-select/index.vue' 195 import SingleSelectSheet from '@/components/single-select/index.vue'
194 import RelateSelectSheet from '@/components/relate-select/index.vue' 196 import RelateSelectSheet from '@/components/relate-select/index.vue'
195 import ProductRel from './productRel.vue' 197 import ProductRel from './productRel.vue'
  198 +import CitySelector from '@/components/city-selector/index.vue'
196 import { getContractApi, updateContractApi } from '@/api/contract' 199 import { getContractApi, updateContractApi } from '@/api/contract'
197 import { getDicByCodes } from '@/utils/dic' 200 import { getDicByCodes } from '@/utils/dic'
198 import { formatCurrencyToChinese } from '@/utils/common' 201 import { formatCurrencyToChinese } from '@/utils/common'
@@ -201,7 +204,7 @@ import { getArea } from '@/api/credit_manage.js' @@ -201,7 +204,7 @@ import { getArea } from '@/api/credit_manage.js'
201 204
202 export default { 205 export default {
203 name: 'ModifyContractProcess', 206 name: 'ModifyContractProcess',
204 - components: { SingleSelectSheet, RelateSelectSheet, ProductRel }, 207 + components: { SingleSelectSheet, RelateSelectSheet, ProductRel, CitySelector },
205 data() { 208 data() {
206 return { 209 return {
207 id: '', 210 id: '',
@@ -238,6 +241,8 @@ export default { @@ -238,6 +241,8 @@ export default {
238 packagingRequirements: '', 241 packagingRequirements: '',
239 paymentTerms: '', 242 paymentTerms: '',
240 transportMode: '', 243 transportMode: '',
  244 + destinationId: [],
  245 + destinationLabel: '',
241 foreignDestination: '', 246 foreignDestination: '',
242 specialInstructions: '', 247 specialInstructions: '',
243 remarks: '', 248 remarks: '',
@@ -293,6 +298,8 @@ export default { @@ -293,6 +298,8 @@ export default {
293 const includesPackagingFeeName = data.includesPackagingFeeName || (data.includesPackagingFee ? '是' : '否') 298 const includesPackagingFeeName = data.includesPackagingFeeName || (data.includesPackagingFee ? '是' : '否')
294 const includesTransportFeeName = data.includesTransportFeeName || (data.includesTransportFee ? '是' : '否') 299 const includesTransportFeeName = data.includesTransportFeeName || (data.includesTransportFee ? '是' : '否')
295 const m = { ...data, includesPackagingFeeName, includesTransportFeeName } 300 const m = { ...data, includesPackagingFeeName, includesTransportFeeName }
  301 + const destinationId = (m.provinceId && m.cityId && m.districtId) ? [m.provinceId, m.cityId, m.districtId] : (Array.isArray(m.destinationId) ? m.destinationId : [])
  302 + const destinationLabel = (m.provinceName && m.cityName && m.districtName) ? `${m.provinceName} / ${m.cityName} / ${m.districtName}` : (m.destinationLabel || m.foreignDestination || '')
296 this.form = { 303 this.form = {
297 ...this.form, 304 ...this.form,
298 id: m.id || '', 305 id: m.id || '',
@@ -320,7 +327,9 @@ export default { @@ -320,7 +327,9 @@ export default {
320 packagingRequirements: m.packagingRequirements || '', 327 packagingRequirements: m.packagingRequirements || '',
321 paymentTerms: m.paymentTerms || '', 328 paymentTerms: m.paymentTerms || '',
322 transportMode: m.transportMode || '', 329 transportMode: m.transportMode || '',
323 - foreignDestination: (m.foreignDestination || ''), 330 + destinationId,
  331 + destinationLabel,
  332 + foreignDestination: (destinationLabel || m.foreignDestination || ''),
324 specialInstructions: m.specialInstructions || '', 333 specialInstructions: m.specialInstructions || '',
325 remarks: m.remarks || '', 334 remarks: m.remarks || '',
326 pieceWeightHead: m.pieceWeightHead || '', 335 pieceWeightHead: m.pieceWeightHead || '',
@@ -339,8 +348,28 @@ export default { @@ -339,8 +348,28 @@ export default {
339 const lines = Array.isArray(m.contractStdProcessingLineList) ? m.contractStdProcessingLineList : [] 348 const lines = Array.isArray(m.contractStdProcessingLineList) ? m.contractStdProcessingLineList : []
340 this.productLineList = lines 349 this.productLineList = lines
341 this.onProductsChange(lines) 350 this.onProductsChange(lines)
  351 + await this.$nextTick()
  352 + if (Array.isArray(this.form.destinationId) && this.form.destinationId.length) {
  353 + await this.initDestinationLabel()
  354 + this.form.foreignDestination = this.form.destinationLabel || this.form.foreignDestination || ''
  355 + }
342 } catch (e) { } 356 } catch (e) { }
343 }, 357 },
  358 + async initDestinationLabel() {
  359 + const comp = this.$refs.citySelectorRef
  360 + if (comp && typeof comp.getLabel === 'function') {
  361 + const label = await comp.getLabel()
  362 + this.form.destinationLabel = label || this.form.destinationLabel || ''
  363 + }
  364 + },
  365 + openCitySelector() {
  366 + this.$refs.citySelectorRef && this.$refs.citySelectorRef.open()
  367 + },
  368 + onCityChange(payload) {
  369 + const label = payload && payload.label != null ? payload.label : ''
  370 + this.form.destinationLabel = label
  371 + this.form.foreignDestination = label
  372 + },
344 onProductsChange(products) { 373 onProductsChange(products) {
345 const list = Array.isArray(products) ? products : [] 374 const list = Array.isArray(products) ? products : []
346 this.newProductLineList = list 375 this.newProductLineList = list
@@ -504,9 +533,12 @@ export default { @@ -504,9 +533,12 @@ export default {
504 return out 533 return out
505 } 534 }
506 const lines = (this.newProductLineList || []).map(it => clean(it)) 535 const lines = (this.newProductLineList || []).map(it => clean(it))
  536 + const { destinationLabel, destinationId, ...formForSubmit } = this.form
  537 + const destination = destinationId && destinationId.length > 0 ? destinationId[destinationId.length - 1] : ''
507 const payload = clean({ 538 const payload = clean({
508 - ...this.form,  
509 - id: this.form.id, 539 + ...formForSubmit,
  540 + destination,
  541 + id: formForSubmit.id,
510 type: 'PROCESS_STD_AGMT', 542 type: 'PROCESS_STD_AGMT',
511 sumQuantity: this.sumQuantity, 543 sumQuantity: this.sumQuantity,
512 sumAmountExcl: this.sumAmountExcl, 544 sumAmountExcl: this.sumAmountExcl,
@@ -150,11 +150,12 @@ export default { @@ -150,11 +150,12 @@ export default {
150 const data = res && res.data ? res.data : {} 150 const data = res && res.data ? res.data : {}
151 const includesPackagingFeeName = data.includesPackagingFeeName || (data.includesPackagingFee ? '是' : '否') 151 const includesPackagingFeeName = data.includesPackagingFeeName || (data.includesPackagingFee ? '是' : '否')
152 const includesTransportFeeName = data.includesTransportFeeName || (data.includesTransportFee ? '是' : '否') 152 const includesTransportFeeName = data.includesTransportFeeName || (data.includesTransportFee ? '是' : '否')
  153 + const destinationLabel = (data.provinceName && data.cityName && data.districtName) ? `${data.provinceName} / ${data.cityName} / ${data.districtName}` : (data.destinationLabel || data.foreignDestination || '')
153 this.detail = { 154 this.detail = {
154 ...this.detail, 155 ...this.detail,
155 ...data, 156 ...data,
156 includesPackagingFeeName, includesTransportFeeName, 157 includesPackagingFeeName, includesTransportFeeName,
157 - foreignDestination: (data.foreignDestination || ''), 158 + foreignDestination: destinationLabel,
158 } 159 }
159 const lines = Array.isArray(data.contractStdProcessingLineList) ? data.contractStdProcessingLineList : [] 160 const lines = Array.isArray(data.contractStdProcessingLineList) ? data.contractStdProcessingLineList : []
160 this.productList = lines 161 this.productList = lines
@@ -70,9 +70,11 @@ @@ -70,9 +70,11 @@
70 <uni-easyinput v-model="form.transportMode" placeholder="请输入运输方式" :inputBorder="false" /> 70 <uni-easyinput v-model="form.transportMode" placeholder="请输入运输方式" :inputBorder="false" />
71 </template> 71 </template>
72 </uni-list-item> 72 </uni-list-item>
73 - <uni-list-item title="目的地">  
74 - <template v-slot:footer>  
75 - <uni-easyinput v-model="form.foreignDestination" placeholder="请输入目的地" :inputBorder="false" /> 73 + <uni-list-item class="select-item" :class="(Array.isArray(form.destinationId) && form.destinationId.length) ? 'is-filled' : 'is-empty'" clickable
  74 + @click="openCitySelector" :rightText="form.destinationLabel || '请选择'" showArrow>
  75 + <template v-slot:body>
  76 + <view class="item-title"><text>目的地</text></view>
  77 + <CitySelector ref="citySelectorRef" v-model="form.destinationId" @change="onCityChange" />
76 </template> 78 </template>
77 </uni-list-item> 79 </uni-list-item>
78 80
@@ -205,6 +207,7 @@ import SingleSelectSheet from '@/components/single-select/index.vue' @@ -205,6 +207,7 @@ import SingleSelectSheet from '@/components/single-select/index.vue'
205 import RelateSelectSheet from '@/components/relate-select/index.vue' 207 import RelateSelectSheet from '@/components/relate-select/index.vue'
206 import ProductRel from './productRel.vue' 208 import ProductRel from './productRel.vue'
207 import FileUpload from '@/components/file-upload/index.vue' 209 import FileUpload from '@/components/file-upload/index.vue'
  210 +import CitySelector from '@/components/city-selector/index.vue'
208 import { getContractApi, uploadStandardContract } from '@/api/contract' 211 import { getContractApi, uploadStandardContract } from '@/api/contract'
209 import { getDicByCodes } from '@/utils/dic' 212 import { getDicByCodes } from '@/utils/dic'
210 import { formatCurrencyToChinese } from '@/utils/common' 213 import { formatCurrencyToChinese } from '@/utils/common'
@@ -213,7 +216,7 @@ import { getArea } from '@/api/credit_manage.js' @@ -213,7 +216,7 @@ import { getArea } from '@/api/credit_manage.js'
213 216
214 export default { 217 export default {
215 name: 'UploadStandardContractProcess', 218 name: 'UploadStandardContractProcess',
216 - components: { SingleSelectSheet, RelateSelectSheet, ProductRel, FileUpload }, 219 + components: { SingleSelectSheet, RelateSelectSheet, ProductRel, FileUpload, CitySelector },
217 data() { 220 data() {
218 return { 221 return {
219 id: '', 222 id: '',
@@ -250,6 +253,8 @@ export default { @@ -250,6 +253,8 @@ export default {
250 packagingRequirements: '', 253 packagingRequirements: '',
251 paymentTerms: '', 254 paymentTerms: '',
252 transportMode: '', 255 transportMode: '',
  256 + destinationId: [],
  257 + destinationLabel: '',
253 foreignDestination: '', 258 foreignDestination: '',
254 specialInstructions: '', 259 specialInstructions: '',
255 remarks: '', 260 remarks: '',
@@ -308,6 +313,8 @@ export default { @@ -308,6 +313,8 @@ export default {
308 const includesPackagingFeeName = data.includesPackagingFeeName || (data.includesPackagingFee ? '是' : '否') 313 const includesPackagingFeeName = data.includesPackagingFeeName || (data.includesPackagingFee ? '是' : '否')
309 const includesTransportFeeName = data.includesTransportFeeName || (data.includesTransportFee ? '是' : '否') 314 const includesTransportFeeName = data.includesTransportFeeName || (data.includesTransportFee ? '是' : '否')
310 const m = { ...data, includesPackagingFeeName, includesTransportFeeName } 315 const m = { ...data, includesPackagingFeeName, includesTransportFeeName }
  316 + const destinationId = (m.provinceId && m.cityId && m.districtId) ? [m.provinceId, m.cityId, m.districtId] : (Array.isArray(m.destinationId) ? m.destinationId : [])
  317 + const destinationLabel = (m.provinceName && m.cityName && m.districtName) ? `${m.provinceName} / ${m.cityName} / ${m.districtName}` : (m.destinationLabel || m.foreignDestination || '')
311 this.form = { 318 this.form = {
312 ...this.form, 319 ...this.form,
313 id: m.id || '', 320 id: m.id || '',
@@ -335,7 +342,9 @@ export default { @@ -335,7 +342,9 @@ export default {
335 packagingRequirements: m.packagingRequirements || '', 342 packagingRequirements: m.packagingRequirements || '',
336 paymentTerms: m.paymentTerms || '', 343 paymentTerms: m.paymentTerms || '',
337 transportMode: m.transportMode || '', 344 transportMode: m.transportMode || '',
338 - foreignDestination: (m.foreignDestination || ''), 345 + destinationId,
  346 + destinationLabel,
  347 + foreignDestination: (destinationLabel || m.foreignDestination || ''),
339 specialInstructions: m.specialInstructions || '', 348 specialInstructions: m.specialInstructions || '',
340 remarks: m.remarks || '', 349 remarks: m.remarks || '',
341 pieceWeightHead: m.pieceWeightHead || '', 350 pieceWeightHead: m.pieceWeightHead || '',
@@ -360,8 +369,28 @@ export default { @@ -360,8 +369,28 @@ export default {
360 const lines = Array.isArray(m.contractStdProcessingLineList) ? m.contractStdProcessingLineList : [] 369 const lines = Array.isArray(m.contractStdProcessingLineList) ? m.contractStdProcessingLineList : []
361 this.productLineList = lines 370 this.productLineList = lines
362 this.onProductsChange(lines) 371 this.onProductsChange(lines)
  372 + await this.$nextTick()
  373 + if (Array.isArray(this.form.destinationId) && this.form.destinationId.length) {
  374 + await this.initDestinationLabel()
  375 + this.form.foreignDestination = this.form.destinationLabel || this.form.foreignDestination || ''
  376 + }
363 } catch (e) { } 377 } catch (e) { }
364 }, 378 },
  379 + async initDestinationLabel() {
  380 + const comp = this.$refs.citySelectorRef
  381 + if (comp && typeof comp.getLabel === 'function') {
  382 + const label = await comp.getLabel()
  383 + this.form.destinationLabel = label || this.form.destinationLabel || ''
  384 + }
  385 + },
  386 + openCitySelector() {
  387 + this.$refs.citySelectorRef && this.$refs.citySelectorRef.open()
  388 + },
  389 + onCityChange(payload) {
  390 + const label = payload && payload.label != null ? payload.label : ''
  391 + this.form.destinationLabel = label
  392 + this.form.foreignDestination = label
  393 + },
365 onProductsChange(products) { 394 onProductsChange(products) {
366 const list = Array.isArray(products) ? products : [] 395 const list = Array.isArray(products) ? products : []
367 this.newProductLineList = list 396 this.newProductLineList = list
@@ -545,9 +574,12 @@ export default { @@ -545,9 +574,12 @@ export default {
545 return out 574 return out
546 } 575 }
547 const lines = (this.newProductLineList || []).map(it => clean(it)) 576 const lines = (this.newProductLineList || []).map(it => clean(it))
  577 + const { destinationLabel, destinationId, ...formForSubmit } = this.form
  578 + const destination = destinationId && destinationId.length > 0 ? destinationId[destinationId.length - 1] : ''
548 const payload = clean({ 579 const payload = clean({
549 - ...this.form,  
550 - id: this.form.id, 580 + ...formForSubmit,
  581 + destination,
  582 + id: formForSubmit.id,
551 type: 'PROCESS_STD_AGMT', 583 type: 'PROCESS_STD_AGMT',
552 sumQuantity: this.totalQuantity, 584 sumQuantity: this.totalQuantity,
553 sumAmountExcl: this.totalAmountExcludingTax, 585 sumAmountExcl: this.totalAmountExcludingTax,