Commit 12f466639a5544c8f9f4dd1438c1cddd24f36468
Merge branch 'cjerp-contract-1.0' into publish_cjerp
Showing
6 changed files
with
160 additions
and
29 deletions
| ... | ... | @@ -88,10 +88,12 @@ |
| 88 | 88 | <uni-easyinput v-model="form.transportMode" placeholder="请输入运输方式" :inputBorder="false" /> |
| 89 | 89 | </template> |
| 90 | 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 | 97 | </template> |
| 96 | 98 | </uni-list-item> |
| 97 | 99 | <uni-list-item class="select-item" :class="form.includesPackagingFeeName ? 'is-filled' : 'is-empty'" clickable |
| ... | ... | @@ -228,6 +230,7 @@ |
| 228 | 230 | import SingleSelectSheet from '@/components/single-select/index.vue' |
| 229 | 231 | import RelateSelectSheet from '@/components/relate-select/index.vue' |
| 230 | 232 | import ProductRel from './productRel.vue' |
| 233 | +import CitySelector from '@/components/city-selector/index.vue' | |
| 231 | 234 | import { getRetailCodeApi, createContractApi, getCustomerRemarks, getCustomerSpecificQualityRequirements, getDeptApi, getContractApi } from '@/api/contract' |
| 232 | 235 | import { getDicByCodes } from '@/utils/dic' |
| 233 | 236 | import { formatCurrencyToChinese } from '@/utils/common' |
| ... | ... | @@ -236,7 +239,7 @@ import { getArea } from '@/api/credit_manage.js' |
| 236 | 239 | |
| 237 | 240 | export default { |
| 238 | 241 | name: 'AddContractProcess', |
| 239 | - components: { SingleSelectSheet, RelateSelectSheet, ProductRel }, | |
| 242 | + components: { SingleSelectSheet, RelateSelectSheet, ProductRel, CitySelector }, | |
| 240 | 243 | data() { |
| 241 | 244 | return { |
| 242 | 245 | copyId: '', |
| ... | ... | @@ -263,6 +266,8 @@ export default { |
| 263 | 266 | includesTransportFeeName: '否', |
| 264 | 267 | unit: '元、公斤、元/公斤', |
| 265 | 268 | totalAmountCapital: '', |
| 269 | + destinationId: [], | |
| 270 | + destinationLabel: '', | |
| 266 | 271 | foreignDestination: '', |
| 267 | 272 | workshopIdName: '', |
| 268 | 273 | workshopId: '', |
| ... | ... | @@ -314,6 +319,11 @@ export default { |
| 314 | 319 | this.loadRegionOptions() |
| 315 | 320 | if (!this.copyId) this.form.orderDate = this.formatDate(new Date()) |
| 316 | 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 | 328 | watch: { |
| 319 | 329 | 'form.buyer': { |
| ... | ... | @@ -365,6 +375,8 @@ export default { |
| 365 | 375 | const includesPackagingFeeName = data.includesPackagingFeeName || (data.includesPackagingFee ? '是' : '否') |
| 366 | 376 | const includesTransportFeeName = data.includesTransportFeeName || (data.includesTransportFee ? '是' : '否') |
| 367 | 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 | 381 | const code = this.form.code |
| 370 | 382 | this.form = { |
| ... | ... | @@ -393,7 +405,9 @@ export default { |
| 393 | 405 | packagingRequirements: m.packagingRequirements || '', |
| 394 | 406 | paymentTerms: m.paymentTerms || '', |
| 395 | 407 | transportMode: m.transportMode || '', |
| 396 | - foreignDestination: (m.foreignDestination || ''), | |
| 408 | + destinationId, | |
| 409 | + destinationLabel, | |
| 410 | + foreignDestination: (destinationLabel || m.foreignDestination || ''), | |
| 397 | 411 | specialInstructions: m.specialInstructions || '', |
| 398 | 412 | remarks: m.remarks || '', |
| 399 | 413 | pieceWeightHead: m.pieceWeightHead || '', |
| ... | ... | @@ -410,9 +424,13 @@ export default { |
| 410 | 424 | deptId: m.deptId || this.form.deptId, |
| 411 | 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 | 433 | const lines = Array.isArray(m.contractStdProcessingLineList) ? m.contractStdProcessingLineList : [] |
| 415 | - await this.$nextTick() | |
| 416 | 434 | const comp = this.$refs.productRel |
| 417 | 435 | if (comp && typeof comp.defaultItem === 'function') { |
| 418 | 436 | const nextItems = (lines.length ? lines : [{}]).map(x => ({ |
| ... | ... | @@ -432,6 +450,21 @@ export default { |
| 432 | 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 | 468 | async loadRegionOptions() { |
| 436 | 469 | try { |
| 437 | 470 | const res = await getArea() |
| ... | ... | @@ -653,10 +686,13 @@ export default { |
| 653 | 686 | return out |
| 654 | 687 | } |
| 655 | 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 | 691 | const payload = clean({ |
| 657 | - ...this.form, | |
| 692 | + ...formForSubmit, | |
| 658 | 693 | operateType: isCopy ? 'COPY' : 'ADD', |
| 659 | 694 | type: 'PROCESS_STD_AGMT', |
| 695 | + destination, | |
| 660 | 696 | totalQuantity: this.totalQuantity, |
| 661 | 697 | totalAmountExcludingTax: this.totalAmountExcludingTax, |
| 662 | 698 | totalAmountIncludingTax: this.totalAmountIncludingTax, | ... | ... |
| ... | ... | @@ -70,9 +70,11 @@ |
| 70 | 70 | <uni-easyinput v-model="form.transportMode" placeholder="请输入运输方式" :inputBorder="false" /> |
| 71 | 71 | </template> |
| 72 | 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 | 78 | </template> |
| 77 | 79 | </uni-list-item> |
| 78 | 80 | |
| ... | ... | @@ -204,6 +206,7 @@ import SingleSelectSheet from '@/components/single-select/index.vue' |
| 204 | 206 | import RelateSelectSheet from '@/components/relate-select/index.vue' |
| 205 | 207 | import ProductRel from './productRel.vue' |
| 206 | 208 | import FileUpload from '@/components/file-upload/index.vue' |
| 209 | +import CitySelector from '@/components/city-selector/index.vue' | |
| 207 | 210 | import { getContractApi, uploadStandardContract } from '@/api/contract' |
| 208 | 211 | import { getDicByCodes } from '@/utils/dic' |
| 209 | 212 | import { formatCurrencyToChinese } from '@/utils/common' |
| ... | ... | @@ -212,7 +215,7 @@ import { getArea } from '@/api/credit_manage.js' |
| 212 | 215 | |
| 213 | 216 | export default { |
| 214 | 217 | name: 'AgmtViewer', |
| 215 | - components: { SingleSelectSheet, RelateSelectSheet, ProductRel, FileUpload }, | |
| 218 | + components: { SingleSelectSheet, RelateSelectSheet, ProductRel, FileUpload, CitySelector }, | |
| 216 | 219 | props: { |
| 217 | 220 | id: { |
| 218 | 221 | type: [String, Number], |
| ... | ... | @@ -255,6 +258,8 @@ export default { |
| 255 | 258 | packagingRequirements: '', |
| 256 | 259 | paymentTerms: '', |
| 257 | 260 | transportMode: '', |
| 261 | + destinationId: [], | |
| 262 | + destinationLabel: '', | |
| 258 | 263 | foreignDestination: '', |
| 259 | 264 | specialInstructions: '', |
| 260 | 265 | remarks: '', |
| ... | ... | @@ -323,6 +328,8 @@ export default { |
| 323 | 328 | const includesPackagingFeeName = data.includesPackagingFeeName || (data.includesPackagingFee ? '是' : '否') |
| 324 | 329 | const includesTransportFeeName = data.includesTransportFeeName || (data.includesTransportFee ? '是' : '否') |
| 325 | 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 | 333 | this.form = { |
| 327 | 334 | ...this.form, |
| 328 | 335 | id: m.id || '', |
| ... | ... | @@ -350,7 +357,9 @@ export default { |
| 350 | 357 | packagingRequirements: m.packagingRequirements || '', |
| 351 | 358 | paymentTerms: m.paymentTerms || '', |
| 352 | 359 | transportMode: m.transportMode || '', |
| 353 | - foreignDestination: (m.foreignDestination || ''), | |
| 360 | + destinationId, | |
| 361 | + destinationLabel, | |
| 362 | + foreignDestination: (destinationLabel || m.foreignDestination || ''), | |
| 354 | 363 | specialInstructions: m.specialInstructions || '', |
| 355 | 364 | remarks: m.remarks || '', |
| 356 | 365 | pieceWeightHead: m.pieceWeightHead || '', |
| ... | ... | @@ -375,8 +384,28 @@ export default { |
| 375 | 384 | const lines = Array.isArray(m.contractStdProcessingLineList) ? m.contractStdProcessingLineList : [] |
| 376 | 385 | this.productLineList = lines |
| 377 | 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 | 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 | 409 | onProductsChange(products) { |
| 381 | 410 | const list = Array.isArray(products) ? products : [] |
| 382 | 411 | this.newProductLineList = list | ... | ... |
| ... | ... | @@ -414,6 +414,7 @@ export default { |
| 414 | 414 | const data = res && res.data ? res.data : {} |
| 415 | 415 | const includesPackagingFeeName = data.includesPackagingFeeName || (data.includesPackagingFee ? '是' : '否') |
| 416 | 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 | 418 | this.detail = { |
| 418 | 419 | ...this.detail, |
| 419 | 420 | ...data, |
| ... | ... | @@ -421,7 +422,7 @@ export default { |
| 421 | 422 | regionName: data.regionName || '', |
| 422 | 423 | deptName: data.deptName || '', |
| 423 | 424 | includesPackagingFeeName, includesTransportFeeName, |
| 424 | - foreignDestination: (data.foreignDestination || ''), | |
| 425 | + foreignDestination: destinationLabel, | |
| 425 | 426 | } |
| 426 | 427 | this.detail = await fillStandardApprovedName(this.detail) |
| 427 | 428 | const lines = Array.isArray(data.contractStdProcessingLineList) ? data.contractStdProcessingLineList : [] | ... | ... |
| ... | ... | @@ -70,9 +70,11 @@ |
| 70 | 70 | <uni-easyinput v-model="form.transportMode" placeholder="请输入运输方式" :inputBorder="false" /> |
| 71 | 71 | </template> |
| 72 | 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 | 78 | </template> |
| 77 | 79 | </uni-list-item> |
| 78 | 80 | |
| ... | ... | @@ -193,6 +195,7 @@ |
| 193 | 195 | import SingleSelectSheet from '@/components/single-select/index.vue' |
| 194 | 196 | import RelateSelectSheet from '@/components/relate-select/index.vue' |
| 195 | 197 | import ProductRel from './productRel.vue' |
| 198 | +import CitySelector from '@/components/city-selector/index.vue' | |
| 196 | 199 | import { getContractApi, updateContractApi } from '@/api/contract' |
| 197 | 200 | import { getDicByCodes } from '@/utils/dic' |
| 198 | 201 | import { formatCurrencyToChinese } from '@/utils/common' |
| ... | ... | @@ -201,7 +204,7 @@ import { getArea } from '@/api/credit_manage.js' |
| 201 | 204 | |
| 202 | 205 | export default { |
| 203 | 206 | name: 'ModifyContractProcess', |
| 204 | - components: { SingleSelectSheet, RelateSelectSheet, ProductRel }, | |
| 207 | + components: { SingleSelectSheet, RelateSelectSheet, ProductRel, CitySelector }, | |
| 205 | 208 | data() { |
| 206 | 209 | return { |
| 207 | 210 | id: '', |
| ... | ... | @@ -238,6 +241,8 @@ export default { |
| 238 | 241 | packagingRequirements: '', |
| 239 | 242 | paymentTerms: '', |
| 240 | 243 | transportMode: '', |
| 244 | + destinationId: [], | |
| 245 | + destinationLabel: '', | |
| 241 | 246 | foreignDestination: '', |
| 242 | 247 | specialInstructions: '', |
| 243 | 248 | remarks: '', |
| ... | ... | @@ -293,6 +298,8 @@ export default { |
| 293 | 298 | const includesPackagingFeeName = data.includesPackagingFeeName || (data.includesPackagingFee ? '是' : '否') |
| 294 | 299 | const includesTransportFeeName = data.includesTransportFeeName || (data.includesTransportFee ? '是' : '否') |
| 295 | 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 | 303 | this.form = { |
| 297 | 304 | ...this.form, |
| 298 | 305 | id: m.id || '', |
| ... | ... | @@ -320,7 +327,9 @@ export default { |
| 320 | 327 | packagingRequirements: m.packagingRequirements || '', |
| 321 | 328 | paymentTerms: m.paymentTerms || '', |
| 322 | 329 | transportMode: m.transportMode || '', |
| 323 | - foreignDestination: (m.foreignDestination || ''), | |
| 330 | + destinationId, | |
| 331 | + destinationLabel, | |
| 332 | + foreignDestination: (destinationLabel || m.foreignDestination || ''), | |
| 324 | 333 | specialInstructions: m.specialInstructions || '', |
| 325 | 334 | remarks: m.remarks || '', |
| 326 | 335 | pieceWeightHead: m.pieceWeightHead || '', |
| ... | ... | @@ -339,8 +348,28 @@ export default { |
| 339 | 348 | const lines = Array.isArray(m.contractStdProcessingLineList) ? m.contractStdProcessingLineList : [] |
| 340 | 349 | this.productLineList = lines |
| 341 | 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 | 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 | 373 | onProductsChange(products) { |
| 345 | 374 | const list = Array.isArray(products) ? products : [] |
| 346 | 375 | this.newProductLineList = list |
| ... | ... | @@ -504,9 +533,12 @@ export default { |
| 504 | 533 | return out |
| 505 | 534 | } |
| 506 | 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 | 538 | const payload = clean({ |
| 508 | - ...this.form, | |
| 509 | - id: this.form.id, | |
| 539 | + ...formForSubmit, | |
| 540 | + destination, | |
| 541 | + id: formForSubmit.id, | |
| 510 | 542 | type: 'PROCESS_STD_AGMT', |
| 511 | 543 | sumQuantity: this.sumQuantity, |
| 512 | 544 | sumAmountExcl: this.sumAmountExcl, | ... | ... |
| ... | ... | @@ -150,11 +150,12 @@ export default { |
| 150 | 150 | const data = res && res.data ? res.data : {} |
| 151 | 151 | const includesPackagingFeeName = data.includesPackagingFeeName || (data.includesPackagingFee ? '是' : '否') |
| 152 | 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 | 154 | this.detail = { |
| 154 | 155 | ...this.detail, |
| 155 | 156 | ...data, |
| 156 | 157 | includesPackagingFeeName, includesTransportFeeName, |
| 157 | - foreignDestination: (data.foreignDestination || ''), | |
| 158 | + foreignDestination: destinationLabel, | |
| 158 | 159 | } |
| 159 | 160 | const lines = Array.isArray(data.contractStdProcessingLineList) ? data.contractStdProcessingLineList : [] |
| 160 | 161 | this.productList = lines | ... | ... |
| ... | ... | @@ -70,9 +70,11 @@ |
| 70 | 70 | <uni-easyinput v-model="form.transportMode" placeholder="请输入运输方式" :inputBorder="false" /> |
| 71 | 71 | </template> |
| 72 | 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 | 78 | </template> |
| 77 | 79 | </uni-list-item> |
| 78 | 80 | |
| ... | ... | @@ -205,6 +207,7 @@ import SingleSelectSheet from '@/components/single-select/index.vue' |
| 205 | 207 | import RelateSelectSheet from '@/components/relate-select/index.vue' |
| 206 | 208 | import ProductRel from './productRel.vue' |
| 207 | 209 | import FileUpload from '@/components/file-upload/index.vue' |
| 210 | +import CitySelector from '@/components/city-selector/index.vue' | |
| 208 | 211 | import { getContractApi, uploadStandardContract } from '@/api/contract' |
| 209 | 212 | import { getDicByCodes } from '@/utils/dic' |
| 210 | 213 | import { formatCurrencyToChinese } from '@/utils/common' |
| ... | ... | @@ -213,7 +216,7 @@ import { getArea } from '@/api/credit_manage.js' |
| 213 | 216 | |
| 214 | 217 | export default { |
| 215 | 218 | name: 'UploadStandardContractProcess', |
| 216 | - components: { SingleSelectSheet, RelateSelectSheet, ProductRel, FileUpload }, | |
| 219 | + components: { SingleSelectSheet, RelateSelectSheet, ProductRel, FileUpload, CitySelector }, | |
| 217 | 220 | data() { |
| 218 | 221 | return { |
| 219 | 222 | id: '', |
| ... | ... | @@ -250,6 +253,8 @@ export default { |
| 250 | 253 | packagingRequirements: '', |
| 251 | 254 | paymentTerms: '', |
| 252 | 255 | transportMode: '', |
| 256 | + destinationId: [], | |
| 257 | + destinationLabel: '', | |
| 253 | 258 | foreignDestination: '', |
| 254 | 259 | specialInstructions: '', |
| 255 | 260 | remarks: '', |
| ... | ... | @@ -308,6 +313,8 @@ export default { |
| 308 | 313 | const includesPackagingFeeName = data.includesPackagingFeeName || (data.includesPackagingFee ? '是' : '否') |
| 309 | 314 | const includesTransportFeeName = data.includesTransportFeeName || (data.includesTransportFee ? '是' : '否') |
| 310 | 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 | 318 | this.form = { |
| 312 | 319 | ...this.form, |
| 313 | 320 | id: m.id || '', |
| ... | ... | @@ -335,7 +342,9 @@ export default { |
| 335 | 342 | packagingRequirements: m.packagingRequirements || '', |
| 336 | 343 | paymentTerms: m.paymentTerms || '', |
| 337 | 344 | transportMode: m.transportMode || '', |
| 338 | - foreignDestination: (m.foreignDestination || ''), | |
| 345 | + destinationId, | |
| 346 | + destinationLabel, | |
| 347 | + foreignDestination: (destinationLabel || m.foreignDestination || ''), | |
| 339 | 348 | specialInstructions: m.specialInstructions || '', |
| 340 | 349 | remarks: m.remarks || '', |
| 341 | 350 | pieceWeightHead: m.pieceWeightHead || '', |
| ... | ... | @@ -360,8 +369,28 @@ export default { |
| 360 | 369 | const lines = Array.isArray(m.contractStdProcessingLineList) ? m.contractStdProcessingLineList : [] |
| 361 | 370 | this.productLineList = lines |
| 362 | 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 | 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 | 394 | onProductsChange(products) { |
| 366 | 395 | const list = Array.isArray(products) ? products : [] |
| 367 | 396 | this.newProductLineList = list |
| ... | ... | @@ -545,9 +574,12 @@ export default { |
| 545 | 574 | return out |
| 546 | 575 | } |
| 547 | 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 | 579 | const payload = clean({ |
| 549 | - ...this.form, | |
| 550 | - id: this.form.id, | |
| 580 | + ...formForSubmit, | |
| 581 | + destination, | |
| 582 | + id: formForSubmit.id, | |
| 551 | 583 | type: 'PROCESS_STD_AGMT', |
| 552 | 584 | sumQuantity: this.totalQuantity, |
| 553 | 585 | sumAmountExcl: this.totalAmountExcludingTax, | ... | ... |