Commit 98e0856167528be80cfe640219de95cdacd3dc5f

Authored by gesilong
2 parents 54ad8ef3 ffdab129

Merge branch 'cjerp-1.0_20251220' into cjerp-1.0_shipping

# Conflicts:
#	.idea/workspace.xml
#	pages.json
#	pages/customer/index.vue
#	pages/index.vue
Showing 44 changed files with 1924 additions and 291 deletions

Too many changes to show.

To preserve performance only 44 of 62 files are displayed.

@@ -12,6 +12,7 @@ export const statusMap = { @@ -12,6 +12,7 @@ export const statusMap = {
12 '生产中': '#2BA471', 12 '生产中': '#2BA471',
13 '审核通过': '#2BA471', 13 '审核通过': '#2BA471',
14 '审核中': '#3D48A3', 14 '审核中': '#3D48A3',
  15 + '审批中': '#3D48A3',
15 '已签收': '#E7E7E7', 16 '已签收': '#E7E7E7',
16 '已取消': '#000', 17 '已取消': '#000',
17 '已发货': '#D54941', 18 '已发货': '#D54941',
@@ -19,6 +20,15 @@ export const statusMap = { @@ -19,6 +20,15 @@ export const statusMap = {
19 } 20 }
20 21
21 const baseUrl = '/contract'; 22 const baseUrl = '/contract';
  23 +// 查询当前人所在办事处
  24 +export function getDeptApi(params) {
  25 + return request({
  26 + url: `/system/dept/getDept`,
  27 + method: 'get',
  28 + params
  29 + })
  30 +}
  31 +
22 // 查询合同框架列表 32 // 查询合同框架列表
23 export function queryApi(params) { 33 export function queryApi(params) {
24 return request({ 34 return request({
@@ -139,7 +139,7 @@ export default { @@ -139,7 +139,7 @@ export default {
139 }) 139 })
140 } else if (this.source === 'user') { 140 } else if (this.source === 'user') {
141 // 人员表 141 // 人员表
142 - const params = { pageIndex, pageSize, name, username: name } 142 + const params = { pageIndex, pageSize, name }
143 return userSelector(params).then(res => { 143 return userSelector(params).then(res => {
144 const _data = res.data || {} 144 const _data = res.data || {}
145 const records = _data.datas || _data.records || _data.list || [] 145 const records = _data.datas || _data.records || _data.list || []
@@ -82,7 +82,7 @@ @@ -82,7 +82,7 @@
82 </uni-list-item> 82 </uni-list-item>
83 <uni-list-item title="变更说明"> 83 <uni-list-item title="变更说明">
84 <template v-slot:footer> 84 <template v-slot:footer>
85 - <uni-easyinput v-model="form.changeDescription" placeholder="请输入变更说明" :inputBorder="false" /> 85 + <uni-easyinput type="textarea" v-model="form.changeDescription" placeholder="请输入变更说明" :inputBorder="false" />
86 </template> 86 </template>
87 </uni-list-item> 87 </uni-list-item>
88 </view> 88 </view>
@@ -81,7 +81,7 @@ @@ -81,7 +81,7 @@
81 </uni-list-item> 81 </uni-list-item>
82 <uni-list-item title="变更说明"> 82 <uni-list-item title="变更说明">
83 <template v-slot:footer> 83 <template v-slot:footer>
84 - <uni-easyinput v-model="form.changeDescription" placeholder="请输入变更说明" :inputBorder="false" /> 84 + <uni-easyinput type="textarea" v-model="form.changeDescription" placeholder="请输入变更说明" :inputBorder="false" />
85 </template> 85 </template>
86 </uni-list-item> 86 </uni-list-item>
87 </view> 87 </view>
@@ -21,7 +21,12 @@ @@ -21,7 +21,12 @@
21 <view class="item-title"><text class="required">*</text><text>需方</text></view> 21 <view class="item-title"><text class="required">*</text><text>需方</text></view>
22 </template> 22 </template>
23 </uni-list-item> 23 </uni-list-item>
24 - 24 + <uni-list-item class="select-item" :class="form.stockUpCompanyId ? 'is-filled' : 'is-empty'" clickable
  25 + @click="openRelate('stockUpCompanyId')" :rightText="form.stockUpCompanyName || '请选择备货单位'" showArrow>
  26 + <template v-slot:body>
  27 + <view class="item-title"><text class="required">*</text><text>备货单位/人(生产标准)</text></view>
  28 + </template>
  29 + </uni-list-item>
25 <uni-list-item title="订货日期"> 30 <uni-list-item title="订货日期">
26 <template v-slot:footer> 31 <template v-slot:footer>
27 <uni-datetime-picker type="date" v-model="form.orderDate" /> 32 <uni-datetime-picker type="date" v-model="form.orderDate" />
@@ -39,7 +44,23 @@ @@ -39,7 +44,23 @@
39 <view class="item-title"><text class="required">*</text><text>生产厂</text></view> 44 <view class="item-title"><text class="required">*</text><text>生产厂</text></view>
40 </template> 45 </template>
41 </uni-list-item> 46 </uni-list-item>
42 - <ProductRel mode="add" :deliveryDate="form.orderDate" :deliveryDateBase="form.deliveryDate" @change="onProductsChange" :options="productList" /> 47 + <uni-list-item class="select-item" :class="form.deptName ? 'is-filled' : 'is-empty'">
  48 + <template v-slot:body>
  49 + <view class="item-title"><text class="required">*</text><text>办事处</text></view>
  50 + </template>
  51 + <template v-slot:footer>
  52 + <view class="serial-number-row">
  53 + <uni-easyinput v-model="form.deptName" :inputBorder="false" disabled />
  54 + </view>
  55 + </template>
  56 + </uni-list-item>
  57 + <uni-list-item class="select-item" :class="form.region ? 'is-filled' : 'is-empty'" clickable
  58 + @click="openSheet('region')" :rightText="displayLabel('regionName')" showArrow>
  59 + <template v-slot:body>
  60 + <view class="item-title"><text class="required">*</text><text>区域</text></view>
  61 + </template>
  62 + </uni-list-item>
  63 + <ProductRel ref="productRel" mode="add" :deliveryDate="form.orderDate" :deliveryDateBase="form.deliveryDate" @change="onProductsChange" :options="productList" />
43 <uni-list-item title="合计人民币金额(大写)"> 64 <uni-list-item title="合计人民币金额(大写)">
44 <template v-slot:footer> 65 <template v-slot:footer>
45 <uni-easyinput v-model="form.totalAmountCapital" placeholder="自动计算" :inputBorder="false" disabled /> 66 <uni-easyinput v-model="form.totalAmountCapital" placeholder="自动计算" :inputBorder="false" disabled />
@@ -123,7 +144,7 @@ @@ -123,7 +144,7 @@
123 </uni-list-item> 144 </uni-list-item>
124 <uni-list-item title="备注"> 145 <uni-list-item title="备注">
125 <template v-slot:footer> 146 <template v-slot:footer>
126 - <uni-easyinput type="textarea" v-model="form.remarks" placeholder="请输入备注" :inputBorder="false" /> 147 + <uni-easyinput type="textarea" v-model="form.remarks" placeholder="请输入备注" :inputBorder="false" maxlength="2000"/>
127 </template> 148 </template>
128 </uni-list-item> 149 </uni-list-item>
129 <view class="quality"> 150 <view class="quality">
@@ -208,10 +229,12 @@ import SingleSelectSheet from '@/components/single-select/index.vue' @@ -208,10 +229,12 @@ import SingleSelectSheet from '@/components/single-select/index.vue'
208 import RelateSelectSheet from '@/components/relate-select/index.vue' 229 import RelateSelectSheet from '@/components/relate-select/index.vue'
209 import ProductRel from './productRel.vue' 230 import ProductRel from './productRel.vue'
210 import CitySelector from '@/components/city-selector/index.vue' 231 import CitySelector from '@/components/city-selector/index.vue'
211 -import { getRetailCodeApi, createContractApi, getCustomerRemarks,getCustomerSpecificQualityRequirements } from '@/api/contract' 232 +import { getRetailCodeApi, createContractApi, getCustomerRemarks,getCustomerSpecificQualityRequirements,getDeptApi } from '@/api/contract'
212 import { getDicByCodes } from '@/utils/dic' 233 import { getDicByCodes } from '@/utils/dic'
213 import { formatCurrencyToChinese } from '@/utils/common' 234 import { formatCurrencyToChinese } from '@/utils/common'
214 import { workshopQueryApi } from '@/api/devManage' 235 import { workshopQueryApi } from '@/api/devManage'
  236 +import { getArea } from '@/api/credit_manage.js'
  237 +
215 238
216 export default { 239 export default {
217 name: 'AddContractForeignStd', 240 name: 'AddContractForeignStd',
@@ -223,7 +246,11 @@ export default { @@ -223,7 +246,11 @@ export default {
223 supplier: '', 246 supplier: '',
224 supplierName: '', 247 supplierName: '',
225 buyer: '', 248 buyer: '',
  249 + region: '',
  250 + regionName: '',
226 buyerName: '', 251 buyerName: '',
  252 + stockUpCompanyId: '',
  253 + stockUpCompanyName: '',
227 orderDate: '', 254 orderDate: '',
228 deliveryDate: '', 255 deliveryDate: '',
229 designatedConsignee: '', 256 designatedConsignee: '',
@@ -233,10 +260,10 @@ export default { @@ -233,10 +260,10 @@ export default {
233 executionStandardName: '', 260 executionStandardName: '',
234 executionStandardRemarks: '', 261 executionStandardRemarks: '',
235 includesPackagingFee: false, 262 includesPackagingFee: false,
236 - includesPackagingFeeName: '', 263 + includesPackagingFeeName: '',
237 includesTransportFee: false, 264 includesTransportFee: false,
238 - includesTransportFeeName: '',  
239 - unit: '美元、公斤、元美/公斤', 265 + includesTransportFeeName: '否',
  266 + unit: '美元、公斤、美元/公斤',
240 totalAmountCapital: '', 267 totalAmountCapital: '',
241 destinationId: [], 268 destinationId: [],
242 destinationLabel: '', 269 destinationLabel: '',
@@ -249,6 +276,8 @@ export default { @@ -249,6 +276,8 @@ export default {
249 pieceWeightHead: '', 276 pieceWeightHead: '',
250 surface: '', 277 surface: '',
251 tolerance: '', 278 tolerance: '',
  279 + deptName: '',
  280 + deptId: '',
252 }, 281 },
253 supplierList: [], 282 supplierList: [],
254 specialTermsList: [], 283 specialTermsList: [],
@@ -263,12 +292,15 @@ export default { @@ -263,12 +292,15 @@ export default {
263 productList: [], 292 productList: [],
264 customerRemarks: [], 293 customerRemarks: [],
265 defaultRemark: '', 294 defaultRemark: '',
  295 + regionOptions: [],
266 } 296 }
267 }, 297 },
268 created() { 298 created() {
269 this.loadSuppliers() 299 this.loadSuppliers()
270 this.loadExtraOptions() 300 this.loadExtraOptions()
271 this.initCode() 301 this.initCode()
  302 + this.getDept()
  303 + this.loadRegionOptions()
272 this.form.orderDate = this.formatDate(new Date()) 304 this.form.orderDate = this.formatDate(new Date())
273 this.$nextTick(() => { 305 this.$nextTick(() => {
274 if (Array.isArray(this.form.destinationId) && this.form.destinationId.length) { 306 if (Array.isArray(this.form.destinationId) && this.form.destinationId.length) {
@@ -318,6 +350,24 @@ export default { @@ -318,6 +350,24 @@ export default {
318 }, 350 },
319 }, 351 },
320 methods: { 352 methods: {
  353 + async loadRegionOptions() {
  354 + try {
  355 + const res = await getArea()
  356 + const list = res.data || []
  357 + this.regionOptions = (list || []).map(it => ({ label: it.name || '', value: it.id || '' }))
  358 + } catch (e) {
  359 + this.regionOptions = []
  360 + }
  361 + },
  362 + // 查询当前人所在办事处
  363 + getDept() {
  364 + getDeptApi().then(res => {
  365 + if (res.code === 200) {
  366 + this.form.deptName = res.data.name || ''
  367 + this.form.deptId = res.data.id || ''
  368 + }
  369 + })
  370 + },
321 getHistory() { 371 getHistory() {
322 if (!this.productLineList.length || !this.productLineList[0].productId) { 372 if (!this.productLineList.length || !this.productLineList[0].productId) {
323 return; 373 return;
@@ -403,7 +453,7 @@ export default { @@ -403,7 +453,7 @@ export default {
403 }, 453 },
404 displayLabel(field) { 454 displayLabel(field) {
405 const m = this.form 455 const m = this.form
406 - const map = { supplierName: '请选择供方', buyerName: '请选择需方', workshopIdName: '请选择生产厂' } 456 + const map = { supplierName: '请选择供方', buyerName: '请选择需方', workshopIdName: '请选择生产厂', regionName: '请选择区域' }
407 const val = m[field] 457 const val = m[field]
408 return val ? String(val) : map[field] 458 return val ? String(val) : map[field]
409 }, 459 },
@@ -448,6 +498,8 @@ export default { @@ -448,6 +498,8 @@ export default {
448 setSheet('单价中是否已包含运费', this.yesNoList) 498 setSheet('单价中是否已包含运费', this.yesNoList)
449 } else if (field === 'historyRemarks') { 499 } else if (field === 'historyRemarks') {
450 setSheet('历史备注', this.customerRemarks) 500 setSheet('历史备注', this.customerRemarks)
  501 + }else if (field === 'region') {
  502 + setSheet('区域', this.regionOptions)
451 } 503 }
452 }, 504 },
453 onSheetConfirm({ value, label }) { 505 onSheetConfirm({ value, label }) {
@@ -466,6 +518,8 @@ export default { @@ -466,6 +518,8 @@ export default {
466 let config = {} 518 let config = {}
467 if (fieldKey === 'buyer') { 519 if (fieldKey === 'buyer') {
468 config = { title: '需方', source: 'customer', rowKey: 'id', multiple: false, display: [{ label: '姓名', field: 'name' }, { label: '编号', field: 'code' }, { label: '状态', field: 'available', format: v => (v ? '启用' : '停用') }] } 520 config = { title: '需方', source: 'customer', rowKey: 'id', multiple: false, display: [{ label: '姓名', field: 'name' }, { label: '编号', field: 'code' }, { label: '状态', field: 'available', format: v => (v ? '启用' : '停用') }] }
  521 + } else if (fieldKey === 'stockUpCompanyId') {
  522 + config = { title: '备货单位/人(生产标准)', source: 'customer', rowKey: 'id', multiple: false, display: [{ label: '姓名', field: 'name' }, { label: '编号', field: 'code' }, { label: '状态', field: 'available', format: v => (v ? '启用' : '停用') }] }
469 } 523 }
470 const selectedKeys = this.form[fieldKey] ? [this.form[fieldKey]] : [] 524 const selectedKeys = this.form[fieldKey] ? [this.form[fieldKey]] : []
471 this.sheet.visible = false 525 this.sheet.visible = false
@@ -476,7 +530,17 @@ export default { @@ -476,7 +530,17 @@ export default {
476 const _fieldKey = this.relate.fieldKey 530 const _fieldKey = this.relate.fieldKey
477 const first = (items && items.length > 0) ? items[0] : null 531 const first = (items && items.length > 0) ? items[0] : null
478 this.form[_fieldKey] = (first && first.id) ? first.id : '' 532 this.form[_fieldKey] = (first && first.id) ? first.id : ''
479 - this.form[_fieldKey + 'Name'] = (first && first.name) ? first.name : '' 533 +
  534 + if (_fieldKey === 'stockUpCompanyId') {
  535 + this.form.stockUpCompanyName = (first && first.name) ? first.name : ''
  536 + } else {
  537 + this.form[_fieldKey + 'Name'] = (first && first.name) ? first.name : ''
  538 + }
  539 +
  540 + if (_fieldKey === 'buyer') {
  541 + this.form.stockUpCompanyId = (first && first.id) ? first.id : ''
  542 + this.form.stockUpCompanyName = (first && first.name) ? first.name : ''
  543 + }
480 }, 544 },
481 onRadioSelect(field, nameField, opt) { 545 onRadioSelect(field, nameField, opt) {
482 const val = opt && opt.value != null ? opt.value : '' 546 const val = opt && opt.value != null ? opt.value : ''
@@ -532,10 +596,12 @@ export default { @@ -532,10 +596,12 @@ export default {
532 { key: 'code', label: '编号' }, 596 { key: 'code', label: '编号' },
533 { key: 'supplier', label: '供方' }, 597 { key: 'supplier', label: '供方' },
534 { key: 'buyer', label: '需方' }, 598 { key: 'buyer', label: '需方' },
  599 + { key: 'stockUpCompanyId', label: '备货单位/人(生产标准)' },
535 { key: 'orderDate', label: '订货日期' }, 600 { key: 'orderDate', label: '订货日期' },
536 { key: 'unit', label: '单位' }, 601 { key: 'unit', label: '单位' },
537 { key: 'workshopId', label: '生产厂' }, 602 { key: 'workshopId', label: '生产厂' },
538 { key: 'specialTerms', label: '特别条款要求' }, 603 { key: 'specialTerms', label: '特别条款要求' },
  604 + { key: 'region', label: '区域' },
539 ] 605 ]
540 for (const it of checks) { 606 for (const it of checks) {
541 const val = this.form[it.key] 607 const val = this.form[it.key]
@@ -561,6 +627,7 @@ export default { @@ -561,6 +627,7 @@ export default {
561 uni.showToast({ title: `第${idx + 1}条明细未完整填写`, icon: 'none' }); return false 627 uni.showToast({ title: `第${idx + 1}条明细未完整填写`, icon: 'none' }); return false
562 } 628 }
563 } 629 }
  630 + if (this.$refs.productRel && !this.$refs.productRel.validate()) return false
564 return true 631 return true
565 } 632 }
566 } 633 }
@@ -5,15 +5,22 @@ @@ -5,15 +5,22 @@
5 <view class="section"> 5 <view class="section">
6 <text class="row customer">{{ detail.code }}</text> 6 <text class="row customer">{{ detail.code }}</text>
7 <view class="row" v-if="status === 'STANDARD'"><text class="label">正式合同规范性审核</text><text class="value"><span class="info-status" :style="detail.standardApprovedName ? getStatusCss(detail.standardApprovedName) : ''" >{{ detail.standardApprovedName || '-' }}</span></text></view> 7 <view class="row" v-if="status === 'STANDARD'"><text class="label">正式合同规范性审核</text><text class="value"><span class="info-status" :style="detail.standardApprovedName ? getStatusCss(detail.standardApprovedName) : ''" >{{ detail.standardApprovedName || '-' }}</span></text></view>
  8 + <view v-if="detail.status === 'STANDARD'" :class="['status', `status_${detail.shippingStatusName}`]" />
8 <view class="row"><text class="label">供方</text><text class="value">{{ detail.supplierName || '-' 9 <view class="row"><text class="label">供方</text><text class="value">{{ detail.supplierName || '-'
9 }}</text></view> 10 }}</text></view>
10 <view class="row"><text class="label">需方</text><text class="value">{{ detail.buyerName || '-' 11 <view class="row"><text class="label">需方</text><text class="value">{{ detail.buyerName || '-'
11 }}</text></view> 12 }}</text></view>
  13 + <view class="row"><text class="label">备货单位/人(生产标准)</text><text class="value">{{ detail.stockUpCompanyName || '-'
  14 + }}</text></view>
12 <view class="row"><text class="label">订货日期</text><text class="value">{{ detail.orderDate }}</text> 15 <view class="row"><text class="label">订货日期</text><text class="value">{{ detail.orderDate }}</text>
13 </view> 16 </view>
14 <view class="row"><text class="label">单位</text><text class="value">{{ detail.unit }}</text></view> 17 <view class="row"><text class="label">单位</text><text class="value">{{ detail.unit }}</text></view>
15 <view class="row"><text class="label">生产厂</text><text class="value">{{ detail.workshopName || '-' 18 <view class="row"><text class="label">生产厂</text><text class="value">{{ detail.workshopName || '-'
16 }}</text></view> 19 }}</text></view>
  20 + <view class="row"><text class="label">办事处</text><text class="value">{{ detail.deptName || '-'
  21 + }}</text></view>
  22 + <view class="row"><text class="label">区域</text><text class="value">{{ detail.regionName || '-'
  23 + }}</text></view>
17 </view> 24 </view>
18 25
19 <view class="section1"> 26 <view class="section1">
@@ -106,11 +113,13 @@ @@ -106,11 +113,13 @@
106 </template> 113 </template>
107 114
108 <script> 115 <script>
109 -import { getContractApi, deleteContractApi, uploadStandardContract, uploadSignedContractFile, statusStyle} from '@/api/contract' 116 +import { getContractApi, deleteContractApi, uploadStandardContract, uploadSignedContractFile, statusStyle, statusMap } from '@/api/contract'
110 import ProductRel from './productRel.vue' 117 import ProductRel from './productRel.vue'
111 import DetailButtons from '@/components/detail-buttons/index.vue' 118 import DetailButtons from '@/components/detail-buttons/index.vue'
112 import FileUpload from '@/components/file-upload/index.vue' 119 import FileUpload from '@/components/file-upload/index.vue'
113 import SingleSelectSheet from '@/components/single-select/index.vue' 120 import SingleSelectSheet from '@/components/single-select/index.vue'
  121 +import { fillStandardApprovedName } from '@/utils/dic.js'
  122 +
114 export default { 123 export default {
115 name: 'ContractForeignStdDetail', 124 name: 'ContractForeignStdDetail',
116 components: { ProductRel, DetailButtons, FileUpload, SingleSelectSheet }, 125 components: { ProductRel, DetailButtons, FileUpload, SingleSelectSheet },
@@ -130,10 +139,15 @@ export default { @@ -130,10 +139,15 @@ export default {
130 supplierName: '', 139 supplierName: '',
131 buyer: '', 140 buyer: '',
132 buyerName: '', 141 buyerName: '',
  142 + stockUpCompanyId: '',
  143 + stockUpCompanyName: '',
133 orderDate: '', 144 orderDate: '',
134 unit: '', 145 unit: '',
135 workshopId: '', 146 workshopId: '',
136 workshopName: '', 147 workshopName: '',
  148 + region: '',
  149 + regionName: '',
  150 + deptName: '',
137 designatedConsignee: '', 151 designatedConsignee: '',
138 specialTerms: '', 152 specialTerms: '',
139 specialTermsName: '', 153 specialTermsName: '',
@@ -161,6 +175,7 @@ export default { @@ -161,6 +175,7 @@ export default {
161 packaging: '' 175 packaging: ''
162 }, 176 },
163 statusStyle: statusStyle, 177 statusStyle: statusStyle,
  178 + statusMap: statusMap,
164 productList: [], 179 productList: [],
165 buttons: [{ 180 buttons: [{
166 text: '编辑', 181 text: '编辑',
@@ -199,7 +214,6 @@ export default { @@ -199,7 +214,6 @@ export default {
199 { 214 {
200 text: '审核详情', 215 text: '审核详情',
201 visible: true, 216 visible: true,
202 - variant: 'primary',  
203 event: 'auditDetail' 217 event: 'auditDetail'
204 }, 218 },
205 ], 219 ],
@@ -211,7 +225,7 @@ export default { @@ -211,7 +225,7 @@ export default {
211 const t = this.detail.standardApproved || false 225 const t = this.detail.standardApproved || false
212 const e = this.detail.standardShowExamine || false 226 const e = this.detail.standardShowExamine || false
213 return [ 227 return [
214 - { ...this.buttons[0], visible: (s === 'DRAFT' && this.$auth.hasPermi('contract-manage:foreign-trade-standard-contract:modifyx')) }, 228 + { ...this.buttons[0], visible: (s === 'DRAFT' && this.$auth.hasPermi('contract-manage:foreign-trade-standard-contract:modify')) },
215 { ...this.buttons[1], visible: (s === 'DRAFT' && this.$auth.hasPermi('contract-manage:foreign-trade-standard-contract:delete')) }, 229 { ...this.buttons[1], visible: (s === 'DRAFT' && this.$auth.hasPermi('contract-manage:foreign-trade-standard-contract:delete')) },
216 { ...this.buttons[2], visible: (s !== 'DELETED' && t !== 'AUDIT' && t !== 'PASS' && this.$auth.hasPermi('contract-manage:foreign-trade-standard-contract:upload')) }, 230 { ...this.buttons[2], visible: (s !== 'DELETED' && t !== 'AUDIT' && t !== 'PASS' && this.$auth.hasPermi('contract-manage:foreign-trade-standard-contract:upload')) },
217 { ...this.buttons[3], visible: (s === 'STANDARD' && this.$auth.hasPermi('contract-manage:foreign-trade-standard-contract:upload-seal')) }, 231 { ...this.buttons[3], visible: (s === 'STANDARD' && this.$auth.hasPermi('contract-manage:foreign-trade-standard-contract:upload-seal')) },
@@ -369,10 +383,14 @@ export default { @@ -369,10 +383,14 @@ export default {
369 this.detail = { 383 this.detail = {
370 ...this.detail, 384 ...this.detail,
371 ...data, 385 ...data,
  386 + stockUpCompanyName: data.stockUpCompanyName || '',
  387 + regionName: data.regionName || '',
  388 + deptName: data.deptName || '',
372 includesPackagingFeeName, includesTransportFeeName, 389 includesPackagingFeeName, includesTransportFeeName,
373 destinationId: data.provinceId && data.cityId && data.districtId ? [data.provinceId, data.cityId, data.districtId] : '', 390 destinationId: data.provinceId && data.cityId && data.districtId ? [data.provinceId, data.cityId, data.districtId] : '',
374 destinationLabel: data.provinceName && data.cityName && data.districtName ? `${data.provinceName} / ${data.cityName} / ${data.districtName}` : '', 391 destinationLabel: data.provinceName && data.cityName && data.districtName ? `${data.provinceName} / ${data.cityName} / ${data.districtName}` : '',
375 } 392 }
  393 + this.detail = await fillStandardApprovedName(this.detail)
376 const lines = Array.isArray(data.contractDistributorLineList) ? data.contractDistributorLineList : [] 394 const lines = Array.isArray(data.contractDistributorLineList) ? data.contractDistributorLineList : []
377 this.productList = lines 395 this.productList = lines
378 } catch (e) { 396 } catch (e) {
@@ -410,6 +428,32 @@ export default { @@ -410,6 +428,32 @@ export default {
410 padding: 32rpx; 428 padding: 32rpx;
411 background: #fff; 429 background: #fff;
412 margin-bottom: 20rpx; 430 margin-bottom: 20rpx;
  431 + .status {
  432 + position: absolute;
  433 + top: 16rpx;
  434 + right: 52rpx;
  435 + width: 180rpx;
  436 + height: 146rpx;
  437 + background-repeat: no-repeat;
  438 + background-size: 100% 100%;
  439 + background-position: center;
  440 +
  441 + &_审批中 {
  442 + background-image: url('~@/static/images/contract/status_1.png');
  443 + }
  444 +
  445 + &_生产中 {
  446 + background-image: url('~@/static/images/contract/status_2.png');
  447 + }
  448 +
  449 + &_已发货 {
  450 + background-image: url('~@/static/images/contract/status_3.png');
  451 + }
  452 +
  453 + &_已签收 {
  454 + background-image: url('~@/static/images/contract/status_4.png');
  455 + }
  456 + }
413 } 457 }
414 458
415 .section1 { 459 .section1 {
@@ -61,7 +61,7 @@ @@ -61,7 +61,7 @@
61 <text>订单总额</text><text class="amount" :style="{ color: '#b67a76' }">{{ item.totalAmountIncludingTax ? '¥' : '' }}{{ formatAmount(item.totalAmountIncludingTax) || '-' }}</text> 61 <text>订单总额</text><text class="amount" :style="{ color: '#b67a76' }">{{ item.totalAmountIncludingTax ? '¥' : '' }}{{ formatAmount(item.totalAmountIncludingTax) || '-' }}</text>
62 </view> 62 </view>
63 <view class="info-row" v-if="item.status === 'STANDARD'"> 63 <view class="info-row" v-if="item.status === 'STANDARD'">
64 - <text>正式合同规范性审核状态</text><span class="info-status" :style="item.standardApprovedName ? getStatusCss(item.standardApprovedName) : ''">{{ item.standardApprovedName || '-' }}</span> 64 + <text>标准合同规范性审核状态</text><span class="info-status" :style="item.standardApprovedName ? getStatusCss(item.standardApprovedName) : ''">{{ item.standardApprovedName || '-' }}</span>
65 </view> 65 </view>
66 <view class="info-row"> 66 <view class="info-row">
67 <text>订货日期</text><text>{{ item.orderDate }}</text> 67 <text>订货日期</text><text>{{ item.orderDate }}</text>
@@ -104,11 +104,7 @@ export default { @@ -104,11 +104,7 @@ export default {
104 searchKeyword: '', 104 searchKeyword: '',
105 searchKeywordDebounced: '', 105 searchKeywordDebounced: '',
106 106
107 - tabs: [  
108 - { label: '草稿合同', value: 'DRAFT' },  
109 - { label: '标准合同', value: 'STANDARD' },  
110 - { label: '已删除合同', value: 'DELETED' }  
111 - ], 107 +
112 status: 'DRAFT', 108 status: 'DRAFT',
113 109
114 query: { deptId: '', deptName: '', dateRange: [] }, 110 query: { deptId: '', deptName: '', dateRange: [] },
@@ -126,6 +122,23 @@ export default { @@ -126,6 +122,23 @@ export default {
126 } 122 }
127 }, 123 },
128 computed: { 124 computed: {
  125 + roleCodes() {
  126 + const g = this.$store && this.$store.getters
  127 + return (g && g.roleCodes) || []
  128 + },
  129 + tabs() {
  130 + if (this.roleCodes.includes('constract_admin')) {
  131 + return [
  132 + { label: '草稿合同', value: 'DRAFT' },
  133 + { label: '标准合同', value: 'STANDARD' },
  134 + { label: '已删除合同', value: 'DELETED' }
  135 + ]
  136 + }
  137 + return [
  138 + { label: '草稿合同', value: 'DRAFT' },
  139 + { label: '标准合同', value: 'STANDARD' }
  140 + ]
  141 + },
129 extraCombined() { 142 extraCombined() {
130 return { 143 return {
131 keyword: this.searchKeywordDebounced || undefined, 144 keyword: this.searchKeywordDebounced || undefined,
@@ -344,10 +357,10 @@ export default { @@ -344,10 +357,10 @@ export default {
344 margin-bottom: 0; 357 margin-bottom: 0;
345 } 358 }
346 text { 359 text {
347 - width: 60%; 360 + width: 50%;
348 &:last-child { 361 &:last-child {
349 color: rgba(0,0,0,0.9); 362 color: rgba(0,0,0,0.9);
350 - width: 40%; 363 + width: 50%;
351 } 364 }
352 } 365 }
353 } 366 }
@@ -21,6 +21,12 @@ @@ -21,6 +21,12 @@
21 <view class="item-title"><text class="required">*</text><text>需方</text></view> 21 <view class="item-title"><text class="required">*</text><text>需方</text></view>
22 </template> 22 </template>
23 </uni-list-item> 23 </uni-list-item>
  24 + <uni-list-item class="select-item" :class="form.stockUpCompanyId ? 'is-filled' : 'is-empty'" clickable
  25 + @click="openRelate('stockUpCompanyId')" :rightText="form.stockUpCompanyName || '请选择备货单位'" showArrow>
  26 + <template v-slot:body>
  27 + <view class="item-title"><text class="required">*</text><text>备货单位/人(生产标准)</text></view>
  28 + </template>
  29 + </uni-list-item>
24 30
25 <uni-list-item class="select-item" :class="form.workshopId ? 'is-filled' : 'is-empty'" clickable 31 <uni-list-item class="select-item" :class="form.workshopId ? 'is-filled' : 'is-empty'" clickable
26 @click="openSheet('workshopId')" :rightText="form.workshopName || '请选择生产厂'" showArrow> 32 @click="openSheet('workshopId')" :rightText="form.workshopName || '请选择生产厂'" showArrow>
@@ -28,6 +34,22 @@ @@ -28,6 +34,22 @@
28 <view class="item-title"><text class="required">*</text><text>生产厂</text></view> 34 <view class="item-title"><text class="required">*</text><text>生产厂</text></view>
29 </template> 35 </template>
30 </uni-list-item> 36 </uni-list-item>
  37 + <uni-list-item class="select-item" :class="form.deptName ? 'is-filled' : 'is-empty'">
  38 + <template v-slot:body>
  39 + <view class="item-title"><text class="required">*</text><text>办事处</text></view>
  40 + </template>
  41 + <template v-slot:footer>
  42 + <view class="serial-number-row">
  43 + <uni-easyinput v-model="form.deptName" :inputBorder="false" disabled />
  44 + </view>
  45 + </template>
  46 + </uni-list-item>
  47 + <uni-list-item class="select-item" :class="form.region ? 'is-filled' : 'is-empty'" clickable
  48 + @click="openSheet('region')" :rightText="displayLabel('regionName')" showArrow>
  49 + <template v-slot:body>
  50 + <view class="item-title"><text class="required">*</text><text>区域</text></view>
  51 + </template>
  52 + </uni-list-item>
31 53
32 <uni-list-item title="订货日期"> 54 <uni-list-item title="订货日期">
33 <template v-slot:footer> 55 <template v-slot:footer>
@@ -40,7 +62,7 @@ @@ -40,7 +62,7 @@
40 <uni-easyinput v-model="form.unit" :inputBorder="false" disabled /> 62 <uni-easyinput v-model="form.unit" :inputBorder="false" disabled />
41 </template> 63 </template>
42 </uni-list-item> 64 </uni-list-item>
43 - <ProductRel mode="add" :deliveryDateBase="form.deliveryDate" :deliveryDate="form.orderDate" :list="productLineList" @change="onProductsChange" :options="productList" /> 65 + <ProductRel ref="productRel" mode="add" :deliveryDateBase="form.deliveryDate" :deliveryDate="form.orderDate" :list="productLineList" @change="onProductsChange" :options="productList" />
44 <uni-list-item title="合计人民币金额(大写)"> 66 <uni-list-item title="合计人民币金额(大写)">
45 <template v-slot:footer> 67 <template v-slot:footer>
46 <uni-easyinput v-model="form.totalAmountCapital" placeholder="自动计算" :inputBorder="false" 68 <uni-easyinput v-model="form.totalAmountCapital" placeholder="自动计算" :inputBorder="false"
@@ -121,7 +143,7 @@ @@ -121,7 +143,7 @@
121 </uni-list-item> 143 </uni-list-item>
122 <uni-list-item title="备注"> 144 <uni-list-item title="备注">
123 <template v-slot:footer> 145 <template v-slot:footer>
124 - <uni-easyinput v-model="form.remarks" placeholder="请输入备注" :inputBorder="false" /> 146 + <uni-easyinput v-model="form.remarks" placeholder="请输入备注" :inputBorder="false" maxlength="2000" />
125 </template> 147 </template>
126 </uni-list-item> 148 </uni-list-item>
127 149
@@ -196,6 +218,7 @@ import { getContractApi, updateContractApi } from '@/api/contract' @@ -196,6 +218,7 @@ import { getContractApi, updateContractApi } from '@/api/contract'
196 import { getDicByCodes } from '@/utils/dic' 218 import { getDicByCodes } from '@/utils/dic'
197 import { formatCurrencyToChinese } from '@/utils/common' 219 import { formatCurrencyToChinese } from '@/utils/common'
198 import { workshopQueryApi } from '@/api/devManage' 220 import { workshopQueryApi } from '@/api/devManage'
  221 +import { getArea } from '@/api/credit_manage.js'
199 export default { 222 export default {
200 name: 'ModifyContractForeignStd', 223 name: 'ModifyContractForeignStd',
201 components: { SingleSelectSheet, RelateSelectSheet, ProductRel, CitySelector }, 224 components: { SingleSelectSheet, RelateSelectSheet, ProductRel, CitySelector },
@@ -209,8 +232,14 @@ export default { @@ -209,8 +232,14 @@ export default {
209 supplierName: '', 232 supplierName: '',
210 buyer: '', 233 buyer: '',
211 buyerName: '', 234 buyerName: '',
  235 + stockUpCompanyId: '',
  236 + stockUpCompanyName: '',
212 workshopId: '', 237 workshopId: '',
213 workshopName: '', 238 workshopName: '',
  239 + region: '',
  240 + regionName: '',
  241 + deptName: '',
  242 + deptId: '',
214 orderDate: '', 243 orderDate: '',
215 deliveryDate: '', 244 deliveryDate: '',
216 designatedConsignee: '', 245 designatedConsignee: '',
@@ -220,9 +249,9 @@ export default { @@ -220,9 +249,9 @@ export default {
220 executionStandardName: '', 249 executionStandardName: '',
221 executionStandardRemarks: '', 250 executionStandardRemarks: '',
222 includesPackagingFee: false, 251 includesPackagingFee: false,
223 - includesPackagingFeeName: '', 252 + includesPackagingFeeName: '',
224 includesTransportFee: false, 253 includesTransportFee: false,
225 - includesTransportFeeName: '', 254 + includesTransportFeeName: '',
226 unit: '美元、公斤、美元/公斤', 255 unit: '美元、公斤、美元/公斤',
227 totalAmountCapital: '', 256 totalAmountCapital: '',
228 depositInfo: '', 257 depositInfo: '',
@@ -251,7 +280,8 @@ export default { @@ -251,7 +280,8 @@ export default {
251 totalAmountIncludingTax: 0, 280 totalAmountIncludingTax: 0,
252 productLineList: [], 281 productLineList: [],
253 newProductLineList: [], 282 newProductLineList: [],
254 - productList: [] 283 + productList: [],
  284 + regionOptions: []
255 } 285 }
256 }, 286 },
257 onLoad(query) { 287 onLoad(query) {
@@ -260,6 +290,7 @@ export default { @@ -260,6 +290,7 @@ export default {
260 created() { 290 created() {
261 this.loadSuppliers() 291 this.loadSuppliers()
262 this.loadExtraOptions() 292 this.loadExtraOptions()
  293 + this.loadRegionOptions()
263 this.loadDetail() 294 this.loadDetail()
264 this.$nextTick(() => { 295 this.$nextTick(() => {
265 if (Array.isArray(this.form.destinationId) && this.form.destinationId.length) { 296 if (Array.isArray(this.form.destinationId) && this.form.destinationId.length) {
@@ -268,6 +299,15 @@ export default { @@ -268,6 +299,15 @@ export default {
268 }) 299 })
269 }, 300 },
270 methods: { 301 methods: {
  302 + async loadRegionOptions() {
  303 + try {
  304 + const res = await getArea()
  305 + const list = res.data || []
  306 + this.regionOptions = (list || []).map(it => ({ label: it.name || '', value: it.id || '' }))
  307 + } catch (e) {
  308 + this.regionOptions = []
  309 + }
  310 + },
271 async loadDetail() { 311 async loadDetail() {
272 if (!this.id) return 312 if (!this.id) return
273 try { 313 try {
@@ -284,6 +324,8 @@ export default { @@ -284,6 +324,8 @@ export default {
284 supplierName: m.supplierName || '', 324 supplierName: m.supplierName || '',
285 buyer: m.buyer || (m.customer && m.customer.id) || '', 325 buyer: m.buyer || (m.customer && m.customer.id) || '',
286 buyerName: m.buyerName || (m.customer && m.customer.name) || '', 326 buyerName: m.buyerName || (m.customer && m.customer.name) || '',
  327 + stockUpCompanyId: m.stockUpCompanyId || '',
  328 + stockUpCompanyName: m.stockUpCompanyName || '',
287 orderDate: m.orderDate || '', 329 orderDate: m.orderDate || '',
288 designatedConsignee: m.designatedConsignee || '', 330 designatedConsignee: m.designatedConsignee || '',
289 specialTerms: m.specialTerms || '', 331 specialTerms: m.specialTerms || '',
@@ -313,6 +355,10 @@ export default { @@ -313,6 +355,10 @@ export default {
313 packaging: m.packaging || '', 355 packaging: m.packaging || '',
314 workshopId: m.workshopId || '', 356 workshopId: m.workshopId || '',
315 workshopName: m.workshopName || '', 357 workshopName: m.workshopName || '',
  358 + region: m.region || '',
  359 + regionName: m.regionName || '',
  360 + deptName: m.deptName || '',
  361 + deptId: m.deptId || '',
316 } 362 }
317 const lines = Array.isArray(m.contractDistributorLineList) ? m.contractDistributorLineList : [] 363 const lines = Array.isArray(m.contractDistributorLineList) ? m.contractDistributorLineList : []
318 this.productLineList = lines 364 this.productLineList = lines
@@ -368,7 +414,7 @@ export default { @@ -368,7 +414,7 @@ export default {
368 }, 414 },
369 displayLabel(field) { 415 displayLabel(field) {
370 const m = this.form 416 const m = this.form
371 - const map = { supplierName: '请选择供方', buyerName: '请选择需方', workshopName: '请选择生产厂' } 417 + const map = { supplierName: '请选择供方', buyerName: '请选择需方', workshopName: '请选择生产厂', regionName: '请选择区域' }
372 const val = m[field] 418 const val = m[field]
373 return val ? String(val) : map[field] 419 return val ? String(val) : map[field]
374 }, 420 },
@@ -397,6 +443,8 @@ export default { @@ -397,6 +443,8 @@ export default {
397 setSheet('单价中是否已包含包装费', this.yesNoList) 443 setSheet('单价中是否已包含包装费', this.yesNoList)
398 } else if (field === 'includesTransportFee') { 444 } else if (field === 'includesTransportFee') {
399 setSheet('单价中是否已包含运费', this.yesNoList) 445 setSheet('单价中是否已包含运费', this.yesNoList)
  446 + } else if (field === 'region') {
  447 + setSheet('区域', this.regionOptions)
400 } 448 }
401 }, 449 },
402 onSheetConfirm({ value, label }) { 450 onSheetConfirm({ value, label }) {
@@ -410,6 +458,8 @@ export default { @@ -410,6 +458,8 @@ export default {
410 let config = {} 458 let config = {}
411 if (fieldKey === 'buyer') { 459 if (fieldKey === 'buyer') {
412 config = { title: '需方', source: 'customer', rowKey: 'id', multiple: false, display: [{ label: '姓名', field: 'name' }, { label: '编号', field: 'code' }, { label: '状态', field: 'available', format: v => (v ? '启用' : '停用') }] } 460 config = { title: '需方', source: 'customer', rowKey: 'id', multiple: false, display: [{ label: '姓名', field: 'name' }, { label: '编号', field: 'code' }, { label: '状态', field: 'available', format: v => (v ? '启用' : '停用') }] }
  461 + } else if (fieldKey === 'stockUpCompanyId') {
  462 + config = { title: '备货单位/人(生产标准)', source: 'customer', rowKey: 'id', multiple: false, display: [{ label: '姓名', field: 'name' }, { label: '编号', field: 'code' }, { label: '状态', field: 'available', format: v => (v ? '启用' : '停用') }] }
413 } 463 }
414 const selectedKeys = this.form[fieldKey] ? [this.form[fieldKey]] : [] 464 const selectedKeys = this.form[fieldKey] ? [this.form[fieldKey]] : []
415 this.sheet.visible = false 465 this.sheet.visible = false
@@ -420,7 +470,12 @@ export default { @@ -420,7 +470,12 @@ export default {
420 const _fieldKey = this.relate.fieldKey 470 const _fieldKey = this.relate.fieldKey
421 const first = (items && items.length > 0) ? items[0] : null 471 const first = (items && items.length > 0) ? items[0] : null
422 this.form[_fieldKey] = (first && first.id) ? first.id : '' 472 this.form[_fieldKey] = (first && first.id) ? first.id : ''
423 - this.form[_fieldKey + 'Name'] = (first && first.name) ? first.name : '' 473 +
  474 + if (_fieldKey === 'stockUpCompanyId') {
  475 + this.form.stockUpCompanyName = (first && first.name) ? first.name : ''
  476 + } else {
  477 + this.form[_fieldKey + 'Name'] = (first && first.name) ? first.name : ''
  478 + }
424 }, 479 },
425 onRadioSelect(field, nameField, opt) { 480 onRadioSelect(field, nameField, opt) {
426 const val = opt && opt.value != null ? opt.value : '' 481 const val = opt && opt.value != null ? opt.value : ''
@@ -436,9 +491,11 @@ export default { @@ -436,9 +491,11 @@ export default {
436 { key: 'code', label: '编号' }, 491 { key: 'code', label: '编号' },
437 { key: 'supplier', label: '供方' }, 492 { key: 'supplier', label: '供方' },
438 { key: 'buyer', label: '需方' }, 493 { key: 'buyer', label: '需方' },
  494 + { key: 'stockUpCompanyId', label: '备货单位/人(生产标准)' },
439 { key: 'orderDate', label: '订货日期' }, 495 { key: 'orderDate', label: '订货日期' },
440 { key: 'unit', label: '单位' }, 496 { key: 'unit', label: '单位' },
441 { key: 'workshopId', label: '生产厂' }, 497 { key: 'workshopId', label: '生产厂' },
  498 + { key: 'region', label: '区域' },
442 { key: 'specialTerms', label: '特别条款要求' }, 499 { key: 'specialTerms', label: '特别条款要求' },
443 ] 500 ]
444 for (const it of checks) { 501 for (const it of checks) {
@@ -466,6 +523,7 @@ export default { @@ -466,6 +523,7 @@ export default {
466 uni.showToast({ title: `第${idx + 1}条明细未完整填写`, icon: 'none' }); return false 523 uni.showToast({ title: `第${idx + 1}条明细未完整填写`, icon: 'none' }); return false
467 } 524 }
468 } 525 }
  526 + if (this.$refs.productRel && !this.$refs.productRel.validate()) return false
469 return true 527 return true
470 }, 528 },
471 async onSubmit() { 529 async onSubmit() {
@@ -55,51 +55,51 @@ @@ -55,51 +55,51 @@
55 </uni-list-item> 55 </uni-list-item>
56 <uni-list-item title="厚度(mm)"> 56 <uni-list-item title="厚度(mm)">
57 <template v-slot:footer> 57 <template v-slot:footer>
58 - <uni-easyinput type="digit" v-model="item.thickness" :inputBorder="false" placeholder="请输入厚度" @input="onNonNegativeInput(idx, 'thickness')" @blur="onNonNegativeBlur(idx, 'thickness', 2)" /> 58 + <uni-easyinput type="digit" v-model="item.thickness" :inputBorder="false" placeholder="请输入厚度" @input="onNonNegativeInput(idx, 'thickness')" @blur="onNonNegativeBlur(idx, 'thickness', 9)" />
59 </template> 59 </template>
60 </uni-list-item> 60 </uni-list-item>
61 <uni-list-item title="厚度公差上限(mm)"> 61 <uni-list-item title="厚度公差上限(mm)">
62 <template v-slot:footer> 62 <template v-slot:footer>
63 - <uni-easyinput type="digit" v-model="item.thicknessTolPos" :inputBorder="false"  
64 - placeholder="请输入厚度公差上限" @input="onNonNegativeInput(idx, 'thicknessTolPos')" @blur="onNonNegativeBlur(idx, 'thicknessTolPos', 2)" /> 63 + <uni-easyinput type="text" v-model="item.thicknessTolPos" :inputBorder="false"
  64 + placeholder="请输入厚度公差上限" @input="onNumberInput(idx, 'thicknessTolPos')" @blur="onNumberBlur(idx, 'thicknessTolPos', 9)" />
65 </template> 65 </template>
66 </uni-list-item> 66 </uni-list-item>
67 <uni-list-item title="厚度公差下限(mm)"> 67 <uni-list-item title="厚度公差下限(mm)">
68 <template v-slot:footer> 68 <template v-slot:footer>
69 - <uni-easyinput type="digit" v-model="item.thicknessTolNeg" :inputBorder="false"  
70 - placeholder="请输入厚度公差下限" @input="onNonNegativeInput(idx, 'thicknessTolNeg')" @blur="onNonNegativeBlur(idx, 'thicknessTolNeg', 2)" /> 69 + <uni-easyinput type="text" v-model="item.thicknessTolNeg" :inputBorder="false"
  70 + placeholder="请输入厚度公差下限" @input="onNumberInput(idx, 'thicknessTolNeg')" @blur="onNumberBlur(idx, 'thicknessTolNeg', 9)" />
71 </template> 71 </template>
72 </uni-list-item> 72 </uni-list-item>
73 <uni-list-item title="宽度(mm)"> 73 <uni-list-item title="宽度(mm)">
74 <template v-slot:footer> 74 <template v-slot:footer>
75 - <uni-easyinput type="digit" v-model="item.width" :inputBorder="false" placeholder="请输入宽度" @input="onNonNegativeInput(idx, 'width')" @blur="onNonNegativeBlur(idx, 'width', 2)" /> 75 + <uni-easyinput type="digit" v-model="item.width" :inputBorder="false" placeholder="请输入宽度" @input="onNonNegativeInput(idx, 'width')" @blur="onNonNegativeBlur(idx, 'width', 9)" />
76 </template> 76 </template>
77 </uni-list-item> 77 </uni-list-item>
78 <uni-list-item title="宽度公差上限(mm)"> 78 <uni-list-item title="宽度公差上限(mm)">
79 <template v-slot:footer> 79 <template v-slot:footer>
80 - <uni-easyinput type="digit" v-model="item.widthTolPos" :inputBorder="false" placeholder="请输入宽度公差上限" @input="onNonNegativeInput(idx, 'widthTolPos')" @blur="onNonNegativeBlur(idx, 'widthTolPos', 2)" /> 80 + <uni-easyinput type="text" v-model="item.widthTolPos" :inputBorder="false" placeholder="请输入宽度公差上限" @input="onNumberInput(idx, 'widthTolPos')" @blur="onNumberBlur(idx, 'widthTolPos', 9)" />
81 </template> 81 </template>
82 </uni-list-item> 82 </uni-list-item>
83 <uni-list-item title="宽度公差下限(mm)"> 83 <uni-list-item title="宽度公差下限(mm)">
84 <template v-slot:footer> 84 <template v-slot:footer>
85 - <uni-easyinput type="digit" v-model="item.widthTolNeg" :inputBorder="false" placeholder="请输入宽度公差下限" @input="onNonNegativeInput(idx, 'widthTolNeg')" @blur="onNonNegativeBlur(idx, 'widthTolNeg', 2)" /> 85 + <uni-easyinput type="text" v-model="item.widthTolNeg" :inputBorder="false" placeholder="请输入宽度公差下限" @input="onNumberInput(idx, 'widthTolNeg')" @blur="onNumberBlur(idx, 'widthTolNeg', 9)" />
86 </template> 86 </template>
87 </uni-list-item> 87 </uni-list-item>
88 <uni-list-item title="长度(mm)"> 88 <uni-list-item title="长度(mm)">
89 <template v-slot:footer> 89 <template v-slot:footer>
90 - <uni-easyinput type="digit" v-model="item.length" :inputBorder="false" placeholder="请输入长度" @input="onNonNegativeInput(idx, 'length')" @blur="onNonNegativeBlur(idx, 'length', 2)" /> 90 + <uni-easyinput type="digit" v-model="item.length" :inputBorder="false" placeholder="请输入长度" @input="onNonNegativeInput(idx, 'length')" @blur="onNonNegativeBlur(idx, 'length', 9)" />
91 </template> 91 </template>
92 </uni-list-item> 92 </uni-list-item>
93 <uni-list-item title="长度公差上限(mm)"> 93 <uni-list-item title="长度公差上限(mm)">
94 <template v-slot:footer> 94 <template v-slot:footer>
95 - <uni-easyinput type="digit" v-model="item.lengthTolPos" :inputBorder="false"  
96 - placeholder="请输入长度公差上限" @input="onNonNegativeInput(idx, 'lengthTolPos')" @blur="onNonNegativeBlur(idx, 'lengthTolPos', 2)" /> 95 + <uni-easyinput type="text" v-model="item.lengthTolPos" :inputBorder="false"
  96 + placeholder="请输入长度公差上限" @input="onNumberInput(idx, 'lengthTolPos')" @blur="onNumberBlur(idx, 'lengthTolPos', 9)" />
97 </template> 97 </template>
98 </uni-list-item> 98 </uni-list-item>
99 <uni-list-item title="长度公差下限(mm)"> 99 <uni-list-item title="长度公差下限(mm)">
100 <template v-slot:footer> 100 <template v-slot:footer>
101 - <uni-easyinput type="digit" v-model="item.lengthTolNeg" :inputBorder="false"  
102 - placeholder="请输入长度公差下限" @input="onNonNegativeInput(idx, 'lengthTolNeg')" @blur="onNonNegativeBlur(idx, 'lengthTolNeg', 2)" /> 101 + <uni-easyinput type="text" v-model="item.lengthTolNeg" :inputBorder="false"
  102 + placeholder="请输入长度公差下限" @input="onNumberInput(idx, 'lengthTolNeg')" @blur="onNumberBlur(idx, 'lengthTolNeg', 9)" />
103 </template> 103 </template>
104 </uni-list-item> 104 </uni-list-item>
105 <uni-list-item title="状态"> 105 <uni-list-item title="状态">
@@ -109,12 +109,12 @@ @@ -109,12 +109,12 @@
109 </uni-list-item> 109 </uni-list-item>
110 <uni-list-item title="数量"> 110 <uni-list-item title="数量">
111 <template v-slot:footer> 111 <template v-slot:footer>
112 - <uni-easyinput v-model="item.quantity" type="digit" :inputBorder="false" placeholder="请输入数量kg" @input="onNonNegativeInput(idx, 'quantity')" @blur="onNonNegativeBlur(idx, 'quantity', 2)" /> 112 + <uni-easyinput v-model="item.quantity" type="digit" :inputBorder="false" placeholder="请输入数量kg" @input="onNonNegativeInput(idx, 'quantity')" @blur="onNonNegativeBlur(idx, 'quantity', 9)" />
113 </template> 113 </template>
114 </uni-list-item> 114 </uni-list-item>
115 <uni-list-item title="单价"> 115 <uni-list-item title="单价">
116 <template v-slot:footer> 116 <template v-slot:footer>
117 - <uni-easyinput v-model="item.unitPrice" type="digit" :inputBorder="false" placeholder="请输入销售价格" @input="onNonNegativeInput(idx, 'unitPrice')" @blur="onNonNegativeBlur(idx, 'unitPrice', 2)" /> 117 + <uni-easyinput v-model="item.unitPrice" type="digit" :inputBorder="false" placeholder="请输入销售价格" @input="onNonNegativeInput(idx, 'unitPrice')" @blur="onNonNegativeBlur(idx, 'unitPrice', 9)" />
118 </template> 118 </template>
119 </uni-list-item> 119 </uni-list-item>
120 <uni-list-item title="外贸加工费"> 120 <uni-list-item title="外贸加工费">
@@ -302,6 +302,62 @@ export default { @@ -302,6 +302,62 @@ export default {
302 this.$set(this.items, idx, it) 302 this.$set(this.items, idx, it)
303 if (field === 'quantity' || field === 'unitPrice') this.recalculate(idx) 303 if (field === 'quantity' || field === 'unitPrice') this.recalculate(idx)
304 }, 304 },
  305 + onNumberInput(idx, field) {
  306 + const it = this.items[idx]
  307 + if (!it) return
  308 + let v = String(it[field] != null ? it[field] : '')
  309 + v = v.replace(/[^0-9.-]/g, '')
  310 + if (v.lastIndexOf('-') > 0) {
  311 + const hasMinusAtStart = v.startsWith('-')
  312 + v = v.replace(/-/g, '')
  313 + if (hasMinusAtStart) v = '-' + v
  314 + }
  315 + if ((v.match(/\./g) || []).length > 1) {
  316 + const firstDotIndex = v.indexOf('.')
  317 + v = v.substring(0, firstDotIndex + 1) + v.substring(firstDotIndex + 1).replace(/\./g, '')
  318 + }
  319 + if (v.startsWith('.')) v = '0' + v
  320 + if (v.startsWith('-.')) v = '-0' + v.substring(1)
  321 + it[field] = v
  322 + this.$set(this.items, idx, it)
  323 + },
  324 + onNumberBlur(idx, field, digits) {
  325 + const it = this.items[idx]
  326 + if (!it) return
  327 + const raw = it[field]
  328 + if (raw === '' || raw === null || raw === undefined || raw === '-') {
  329 + this.$set(this.items, idx, it)
  330 + return
  331 + }
  332 + let num = this.toNumber(raw)
  333 + if (isNaN(num)) num = 0
  334 + const rounded = this.round(num, digits)
  335 + it[field] = rounded
  336 + this.$set(this.items, idx, it)
  337 + },
  338 + validate() {
  339 + for (let i = 0; i < this.items.length; i++) {
  340 + const it = this.items[i]
  341 + const check = (pos, neg, label) => {
  342 + if (pos !== '' && pos !== null && pos !== undefined &&
  343 + neg !== '' && neg !== null && neg !== undefined) {
  344 + if (Number(pos) <= Number(neg)) {
  345 + return `第${i + 1}行产品:${label}公差上限必须大于下限`
  346 + }
  347 + }
  348 + return null
  349 + }
  350 + let err = check(it.thicknessTolPos, it.thicknessTolNeg, '厚度')
  351 + if (err) { uni.showToast({ title: err, icon: 'none' }); return false }
  352 +
  353 + err = check(it.widthTolPos, it.widthTolNeg, '宽度')
  354 + if (err) { uni.showToast({ title: err, icon: 'none' }); return false }
  355 +
  356 + err = check(it.lengthTolPos, it.lengthTolNeg, '长度')
  357 + if (err) { uni.showToast({ title: err, icon: 'none' }); return false }
  358 + }
  359 + return true
  360 + },
305 formatCurrency(val) { 361 formatCurrency(val) {
306 if (val == null || val === '') return '' 362 if (val == null || val === '') return ''
307 const num = Number(val) 363 const num = Number(val)
@@ -22,6 +22,13 @@ @@ -22,6 +22,13 @@
22 </template> 22 </template>
23 </uni-list-item> 23 </uni-list-item>
24 24
  25 + <uni-list-item class="select-item" :class="form.stockUpCompanyId ? 'is-filled' : 'is-empty'" clickable
  26 + @click="openRelate('stockUpCompanyId')" :rightText="form.stockUpCompanyName || '请选择备货单位'" showArrow>
  27 + <template v-slot:body>
  28 + <view class="item-title"><text class="required">*</text><text>备货单位/人(生产标准)</text></view>
  29 + </template>
  30 + </uni-list-item>
  31 +
25 <uni-list-item title="订货日期"> 32 <uni-list-item title="订货日期">
26 <template v-slot:footer> 33 <template v-slot:footer>
27 <uni-datetime-picker type="date" v-model="form.orderDate" /> 34 <uni-datetime-picker type="date" v-model="form.orderDate" />
@@ -39,7 +46,24 @@ @@ -39,7 +46,24 @@
39 <view class="item-title"><text class="required">*</text><text>生产厂</text></view> 46 <view class="item-title"><text class="required">*</text><text>生产厂</text></view>
40 </template> 47 </template>
41 </uni-list-item> 48 </uni-list-item>
42 - <ProductRel mode="add" :deliveryDate="form.orderDate" :deliveryDateBase="form.deliveryDate" @change="onProductsChange" :options="productList" /> 49 + <uni-list-item class="select-item" :class="form.deptName ? 'is-filled' : 'is-empty'">
  50 + <template v-slot:body>
  51 + <view class="item-title"><text class="required">*</text><text>办事处</text></view>
  52 + </template>
  53 + <template v-slot:footer>
  54 + <view class="serial-number-row">
  55 + <uni-easyinput v-model="form.deptName" :inputBorder="false" disabled />
  56 + </view>
  57 + </template>
  58 + </uni-list-item>
  59 + <uni-list-item class="select-item" :class="form.region ? 'is-filled' : 'is-empty'" clickable
  60 + @click="openSheet('region')" :rightText="displayLabel('regionName')" showArrow>
  61 + <template v-slot:body>
  62 + <view class="item-title"><text class="required">*</text><text>区域</text></view>
  63 + </template>
  64 + </uni-list-item>
  65 + <ProductRel ref="productRel" mode="add" :deliveryDate="form.orderDate" :deliveryDateBase="form.deliveryDate"
  66 + @change="onProductsChange" :options="productList" />
43 <uni-list-item title="合计人民币金额(大写)"> 67 <uni-list-item title="合计人民币金额(大写)">
44 <template v-slot:footer> 68 <template v-slot:footer>
45 <uni-easyinput v-model="form.totalAmountCapital" placeholder="自动计算" :inputBorder="false" disabled /> 69 <uni-easyinput v-model="form.totalAmountCapital" placeholder="自动计算" :inputBorder="false" disabled />
@@ -123,7 +147,7 @@ @@ -123,7 +147,7 @@
123 </uni-list-item> 147 </uni-list-item>
124 <uni-list-item title="备注"> 148 <uni-list-item title="备注">
125 <template v-slot:footer> 149 <template v-slot:footer>
126 - <uni-easyinput type="textarea" v-model="form.remarks" placeholder="请输入备注" :inputBorder="false" /> 150 + <uni-easyinput type="textarea" v-model="form.remarks" placeholder="请输入备注" :inputBorder="false" maxlength="2000" />
127 </template> 151 </template>
128 </uni-list-item> 152 </uni-list-item>
129 <view class="quality"> 153 <view class="quality">
@@ -208,10 +232,11 @@ import SingleSelectSheet from '@/components/single-select/index.vue' @@ -208,10 +232,11 @@ import SingleSelectSheet from '@/components/single-select/index.vue'
208 import RelateSelectSheet from '@/components/relate-select/index.vue' 232 import RelateSelectSheet from '@/components/relate-select/index.vue'
209 import ProductRel from './productRel.vue' 233 import ProductRel from './productRel.vue'
210 import CitySelector from '@/components/city-selector/index.vue' 234 import CitySelector from '@/components/city-selector/index.vue'
211 -import { getRetailCodeApi, createContractApi, getCustomerSpecificQualityRequirements,getCustomerRemarks } from '@/api/contract' 235 +import { getRetailCodeApi, createContractApi, getCustomerSpecificQualityRequirements,getCustomerRemarks, getDeptApi } from '@/api/contract'
212 import { getDicByCodes } from '@/utils/dic' 236 import { getDicByCodes } from '@/utils/dic'
213 import { formatCurrencyToChinese } from '@/utils/common' 237 import { formatCurrencyToChinese } from '@/utils/common'
214 import { workshopQueryApi } from '@/api/devManage' 238 import { workshopQueryApi } from '@/api/devManage'
  239 +import { getArea } from '@/api/credit_manage.js'
215 240
216 export default { 241 export default {
217 name: 'AddContractForeignStock', 242 name: 'AddContractForeignStock',
@@ -224,6 +249,8 @@ export default { @@ -224,6 +249,8 @@ export default {
224 supplierName: '', 249 supplierName: '',
225 buyer: '', 250 buyer: '',
226 buyerName: '', 251 buyerName: '',
  252 + stockUpCompanyId: '',
  253 + stockUpCompanyName: '',
227 orderDate: '', 254 orderDate: '',
228 deliveryDate: '', 255 deliveryDate: '',
229 designatedConsignee: '', 256 designatedConsignee: '',
@@ -233,16 +260,20 @@ export default { @@ -233,16 +260,20 @@ export default {
233 executionStandardName: '', 260 executionStandardName: '',
234 executionStandardRemarks: '', 261 executionStandardRemarks: '',
235 includesPackagingFee: false, 262 includesPackagingFee: false,
236 - includesPackagingFeeName: '', 263 + includesPackagingFeeName: '',
237 includesTransportFee: false, 264 includesTransportFee: false,
238 - includesTransportFeeName: '', 265 + includesTransportFeeName: '',
239 unit: '美元、公斤、美元/公斤', 266 unit: '美元、公斤、美元/公斤',
240 totalAmountCapital: '', 267 totalAmountCapital: '',
241 destinationId: [], 268 destinationId: [],
242 destinationLabel: '', 269 destinationLabel: '',
243 workshopIdName: '', 270 workshopIdName: '',
244 workshopId: '', 271 workshopId: '',
245 - component: '', 272 + deptName: '',
  273 + deptId: '',
  274 + region: '',
  275 + regionName: '',
  276 + remarks: '',
246 packaging: '', 277 packaging: '',
247 performance: '', 278 performance: '',
248 pieceWeightHead: '', 279 pieceWeightHead: '',
@@ -263,12 +294,15 @@ export default { @@ -263,12 +294,15 @@ export default {
263 productList: [], 294 productList: [],
264 customerRemarks: [], 295 customerRemarks: [],
265 defaultRemark: '', 296 defaultRemark: '',
  297 + regionOptions: [],
266 } 298 }
267 }, 299 },
268 created() { 300 created() {
269 this.loadSuppliers() 301 this.loadSuppliers()
270 this.loadExtraOptions() 302 this.loadExtraOptions()
271 this.initCode() 303 this.initCode()
  304 + this.getDept()
  305 + this.loadRegionOptions()
272 this.form.orderDate = this.formatDate(new Date()) 306 this.form.orderDate = this.formatDate(new Date())
273 this.$nextTick(() => { 307 this.$nextTick(() => {
274 if (Array.isArray(this.form.destinationId) && this.form.destinationId.length) { 308 if (Array.isArray(this.form.destinationId) && this.form.destinationId.length) {
@@ -318,6 +352,24 @@ export default { @@ -318,6 +352,24 @@ export default {
318 }, 352 },
319 }, 353 },
320 methods: { 354 methods: {
  355 + async loadRegionOptions() {
  356 + try {
  357 + const res = await getArea()
  358 + const list = res.data || []
  359 + this.regionOptions = (list || []).map(it => ({ label: it.name || '', value: it.id || '' }))
  360 + } catch (e) {
  361 + this.regionOptions = []
  362 + }
  363 + },
  364 + // 查询当前人所在办事处
  365 + getDept() {
  366 + getDeptApi().then(res => {
  367 + if (res.code === 200) {
  368 + this.form.deptName = res.data.name || ''
  369 + this.form.deptId = res.data.id || ''
  370 + }
  371 + })
  372 + },
321 getHistory() { 373 getHistory() {
322 console.log('this.productLineList', this.productLineList[0].productId) 374 console.log('this.productLineList', this.productLineList[0].productId)
323 if (!this.productLineList.length || !this.productLineList[0].productId) { 375 if (!this.productLineList.length || !this.productLineList[0].productId) {
@@ -405,7 +457,7 @@ export default { @@ -405,7 +457,7 @@ export default {
405 }, 457 },
406 displayLabel(field) { 458 displayLabel(field) {
407 const m = this.form 459 const m = this.form
408 - const map = { supplierName: '请选择供方', buyerName: '请选择需方', workshopIdName: '请选择生产厂' } 460 + const map = { supplierName: '请选择供方', buyerName: '请选择需方', workshopIdName: '请选择生产厂', regionName: '请选择区域' }
409 const val = m[field] 461 const val = m[field]
410 return val ? String(val) : map[field] 462 return val ? String(val) : map[field]
411 }, 463 },
@@ -450,6 +502,8 @@ export default { @@ -450,6 +502,8 @@ export default {
450 setSheet('单价中是否已包含运费', this.yesNoList) 502 setSheet('单价中是否已包含运费', this.yesNoList)
451 } else if (field === 'historyRemarks') { 503 } else if (field === 'historyRemarks') {
452 setSheet('历史备注', this.customerRemarks) 504 setSheet('历史备注', this.customerRemarks)
  505 + }else if (field === 'region') {
  506 + setSheet('区域', this.regionOptions)
453 } 507 }
454 }, 508 },
455 onSheetConfirm({ value, label }) { 509 onSheetConfirm({ value, label }) {
@@ -468,6 +522,8 @@ export default { @@ -468,6 +522,8 @@ export default {
468 let config = {} 522 let config = {}
469 if (fieldKey === 'buyer') { 523 if (fieldKey === 'buyer') {
470 config = { title: '需方', source: 'customer', rowKey: 'id', multiple: false, display: [{ label: '姓名', field: 'name' }, { label: '编号', field: 'code' }, { label: '状态', field: 'available', format: v => (v ? '启用' : '停用') }] } 524 config = { title: '需方', source: 'customer', rowKey: 'id', multiple: false, display: [{ label: '姓名', field: 'name' }, { label: '编号', field: 'code' }, { label: '状态', field: 'available', format: v => (v ? '启用' : '停用') }] }
  525 + } else if (fieldKey === 'stockUpCompanyId') {
  526 + config = { title: '备货单位/人(生产标准)', source: 'customer', rowKey: 'id', multiple: false, display: [{ label: '姓名', field: 'name' }, { label: '编号', field: 'code' }, { label: '状态', field: 'available', format: v => (v ? '启用' : '停用') }] }
471 } 527 }
472 const selectedKeys = this.form[fieldKey] ? [this.form[fieldKey]] : [] 528 const selectedKeys = this.form[fieldKey] ? [this.form[fieldKey]] : []
473 this.sheet.visible = false 529 this.sheet.visible = false
@@ -478,7 +534,17 @@ export default { @@ -478,7 +534,17 @@ export default {
478 const _fieldKey = this.relate.fieldKey 534 const _fieldKey = this.relate.fieldKey
479 const first = (items && items.length > 0) ? items[0] : null 535 const first = (items && items.length > 0) ? items[0] : null
480 this.form[_fieldKey] = (first && first.id) ? first.id : '' 536 this.form[_fieldKey] = (first && first.id) ? first.id : ''
481 - this.form[_fieldKey + 'Name'] = (first && first.name) ? first.name : '' 537 +
  538 + if (_fieldKey === 'stockUpCompanyId') {
  539 + this.form.stockUpCompanyName = (first && first.name) ? first.name : ''
  540 + } else {
  541 + this.form[_fieldKey + 'Name'] = (first && first.name) ? first.name : ''
  542 + }
  543 +
  544 + if (_fieldKey === 'buyer') {
  545 + this.form.stockUpCompanyId = (first && first.id) ? first.id : ''
  546 + this.form.stockUpCompanyName = (first && first.name) ? first.name : ''
  547 + }
482 }, 548 },
483 onRadioSelect(field, nameField, opt) { 549 onRadioSelect(field, nameField, opt) {
484 const val = opt && opt.value != null ? opt.value : '' 550 const val = opt && opt.value != null ? opt.value : ''
@@ -534,9 +600,11 @@ export default { @@ -534,9 +600,11 @@ export default {
534 { key: 'code', label: '编号' }, 600 { key: 'code', label: '编号' },
535 { key: 'supplier', label: '供方' }, 601 { key: 'supplier', label: '供方' },
536 { key: 'buyer', label: '需方' }, 602 { key: 'buyer', label: '需方' },
  603 + { key: 'stockUpCompanyId', label: '备货单位/人(生产标准)' },
537 { key: 'orderDate', label: '订货日期' }, 604 { key: 'orderDate', label: '订货日期' },
538 { key: 'unit', label: '单位' }, 605 { key: 'unit', label: '单位' },
539 { key: 'workshopId', label: '生产厂' }, 606 { key: 'workshopId', label: '生产厂' },
  607 + { key: 'region', label: '区域' },
540 { key: 'specialTerms', label: '特别条款要求' }, 608 { key: 'specialTerms', label: '特别条款要求' },
541 ] 609 ]
542 for (const it of checks) { 610 for (const it of checks) {
@@ -544,6 +612,7 @@ export default { @@ -544,6 +612,7 @@ export default {
544 const empty = (val === undefined || val === null || (typeof val === 'string' && val.trim() === '') || (typeof val === 'number' && isNaN(val))) 612 const empty = (val === undefined || val === null || (typeof val === 'string' && val.trim() === '') || (typeof val === 'number' && isNaN(val)))
545 if (empty) { uni.showToast({ title: `请先选择${it.label}`, icon: 'none' }); return false } 613 if (empty) { uni.showToast({ title: `请先选择${it.label}`, icon: 'none' }); return false }
546 } 614 }
  615 + if (this.$refs.productRel && !this.$refs.productRel.validate()) return false
547 const list = Array.isArray(this.productLineList) ? this.productLineList : [] 616 const list = Array.isArray(this.productLineList) ? this.productLineList : []
548 if (list.length === 0) { 617 if (list.length === 0) {
549 uni.showToast({ title: '请至少添加一条产品明细', icon: 'none' }); return false 618 uni.showToast({ title: '请至少添加一条产品明细', icon: 'none' }); return false
@@ -4,16 +4,29 @@ @@ -4,16 +4,29 @@
4 <view class="detail-page"> 4 <view class="detail-page">
5 <view class="section"> 5 <view class="section">
6 <text class="row customer">{{ detail.code }}</text> 6 <text class="row customer">{{ detail.code }}</text>
7 - <view class="row" v-if="detail.status === 'STANDARD' || detail.status === 'FORMAL'"><text class="label">{{ detail.status === 'STANDARD' ? '标准合同' : '正式合同' }}规范性审核状态</text><text class="value"><span class="info-status" :style="detail.standardApprovedName ? getStatusCss(detail.standardApprovedName) : ''" >{{ detail.standardApprovedName || '-' }}</span></text></view> 7 + <view class="row" v-if="detail.status === 'STANDARD' || detail.status === 'FORMAL'">
  8 + <text class="label">{{ detail.status === 'STANDARD' ? '标准合同' : '正式合同' }}规范性审核状态</text>
  9 + <text class="value">
  10 + <span v-if="detail.status === 'STANDARD'" class="info-status" :style="detail.standardApprovedName ? getStatusCss(detail.standardApprovedName) : ''" >{{ detail.standardApprovedName || '-' }}</span>
  11 + <span v-if="detail.status === 'FORMAL'" class="info-status" :style="detail.formalApprovedName ? getStatusCss(detail.formalApprovedName) : ''" >{{ detail.formalApprovedName || '-' }}</span>
  12 + </text>
  13 + </view>
  14 + <view v-if="detail.status === 'STANDARD'" :class="['status', `status_${detail.shippingStatusName}`]" />
8 <view class="row"><text class="label">供方</text><text class="value">{{ detail.supplierName || '-' 15 <view class="row"><text class="label">供方</text><text class="value">{{ detail.supplierName || '-'
9 }}</text></view> 16 }}</text></view>
10 <view class="row"><text class="label">需方</text><text class="value">{{ detail.buyerName || '-' 17 <view class="row"><text class="label">需方</text><text class="value">{{ detail.buyerName || '-'
11 }}</text></view> 18 }}</text></view>
  19 + <view class="row"><text class="label">备货单位/人(生产标准)</text><text class="value">{{ detail.stockUpCompanyName || '-'
  20 + }}</text></view>
12 <view class="row"><text class="label">订货日期</text><text class="value">{{ detail.orderDate }}</text> 21 <view class="row"><text class="label">订货日期</text><text class="value">{{ detail.orderDate }}</text>
13 </view> 22 </view>
14 <view class="row"><text class="label">单位</text><text class="value">{{ detail.unit }}</text></view> 23 <view class="row"><text class="label">单位</text><text class="value">{{ detail.unit }}</text></view>
15 <view class="row"><text class="label">生产厂</text><text class="value">{{ detail.workshopName || '-' 24 <view class="row"><text class="label">生产厂</text><text class="value">{{ detail.workshopName || '-'
16 }}</text></view> 25 }}</text></view>
  26 + <view class="row"><text class="label">办事处</text><text class="value">{{ detail.deptName || '-'
  27 + }}</text></view>
  28 + <view class="row"><text class="label">区域</text><text class="value">{{ detail.regionName || '-'
  29 + }}</text></view>
17 </view> 30 </view>
18 31
19 <view class="section1"> 32 <view class="section1">
@@ -113,11 +126,12 @@ @@ -113,11 +126,12 @@
113 </template> 126 </template>
114 127
115 <script> 128 <script>
116 -import { getContractApi, deleteContractApi, uploadFormalContract, uploadStandardContract, uploadSignedContractFile, statusStyle } from '@/api/contract' 129 +import { getContractApi, deleteContractApi, uploadFormalContract, uploadStandardContract, uploadSignedContractFile, statusStyle, statusMap } from '@/api/contract'
117 import ProductRel from './productRel.vue' 130 import ProductRel from './productRel.vue'
118 import DetailButtons from '@/components/detail-buttons/index.vue' 131 import DetailButtons from '@/components/detail-buttons/index.vue'
119 import FileUpload from '@/components/file-upload/index.vue' 132 import FileUpload from '@/components/file-upload/index.vue'
120 import SingleSelectSheet from '@/components/single-select/index.vue' 133 import SingleSelectSheet from '@/components/single-select/index.vue'
  134 +import { fillStandardApprovedName, fillFormalApprovedName } from '@/utils/dic.js'
121 135
122 export default { 136 export default {
123 name: 'ContractForeignStockDetail', 137 name: 'ContractForeignStockDetail',
@@ -133,16 +147,22 @@ export default { @@ -133,16 +147,22 @@ export default {
133 standardStandardizedName: '', 147 standardStandardizedName: '',
134 sheet: { visible: false, title: '请选择', options: [], value: '' }, 148 sheet: { visible: false, title: '请选择', options: [], value: '' },
135 statusStyle: statusStyle, 149 statusStyle: statusStyle,
  150 + statusMap: statusMap,
136 detail: { 151 detail: {
137 code: '', 152 code: '',
138 supplier: '', 153 supplier: '',
139 supplierName: '', 154 supplierName: '',
140 buyer: '', 155 buyer: '',
141 buyerName: '', 156 buyerName: '',
  157 + stockUpCompanyId: '',
  158 + stockUpCompanyName: '',
142 orderDate: '', 159 orderDate: '',
143 unit: '', 160 unit: '',
144 workshopId: '', 161 workshopId: '',
145 workshopName: '', 162 workshopName: '',
  163 + deptName: '',
  164 + region: '',
  165 + regionName: '',
146 designatedConsignee: '', 166 designatedConsignee: '',
147 specialTerms: '', 167 specialTerms: '',
148 specialTermsName: '', 168 specialTermsName: '',
@@ -232,19 +252,16 @@ export default { @@ -232,19 +252,16 @@ export default {
232 { 252 {
233 text: '正式合同审核详情', 253 text: '正式合同审核详情',
234 visible: true, 254 visible: true,
235 - variant: 'primary',  
236 event: 'auditDetail1' 255 event: 'auditDetail1'
237 }, 256 },
238 { 257 {
239 text: '正式合同审核详情', 258 text: '正式合同审核详情',
240 visible: true, 259 visible: true,
241 - variant: 'primary',  
242 event: 'auditDetail2' 260 event: 'auditDetail2'
243 }, 261 },
244 { 262 {
245 text: '标准合同审核详情', 263 text: '标准合同审核详情',
246 visible: true, 264 visible: true,
247 - variant: 'primary',  
248 event: 'auditDetail3' 265 event: 'auditDetail3'
249 }, 266 },
250 { 267 {
@@ -451,10 +468,15 @@ export default { @@ -451,10 +468,15 @@ export default {
451 this.detail = { 468 this.detail = {
452 ...this.detail, 469 ...this.detail,
453 ...data, 470 ...data,
  471 + stockUpCompanyName: data.stockUpCompanyName || '',
  472 + regionName: data.regionName || '',
  473 + deptName: data.deptName || '',
454 includesPackagingFeeName, includesTransportFeeName, 474 includesPackagingFeeName, includesTransportFeeName,
455 destinationId: data.provinceId && data.cityId && data.districtId ? [data.provinceId, data.cityId, data.districtId] : '', 475 destinationId: data.provinceId && data.cityId && data.districtId ? [data.provinceId, data.cityId, data.districtId] : '',
456 destinationLabel: data.provinceName && data.cityName && data.districtName ? `${data.provinceName} / ${data.cityName} / ${data.districtName}` : '', 476 destinationLabel: data.provinceName && data.cityName && data.districtName ? `${data.provinceName} / ${data.cityName} / ${data.districtName}` : '',
457 } 477 }
  478 + this.detail = await fillStandardApprovedName(this.detail)
  479 + this.detail = await fillFormalApprovedName(this.detail)
458 const lines = Array.isArray(data.contractDistributorLineList) ? data.contractDistributorLineList : [] 480 const lines = Array.isArray(data.contractDistributorLineList) ? data.contractDistributorLineList : []
459 this.productList = lines 481 this.productList = lines
460 } catch (e) { 482 } catch (e) {
@@ -492,6 +514,32 @@ export default { @@ -492,6 +514,32 @@ export default {
492 padding: 32rpx; 514 padding: 32rpx;
493 background: #fff; 515 background: #fff;
494 margin-bottom: 20rpx; 516 margin-bottom: 20rpx;
  517 + .status {
  518 + position: absolute;
  519 + top: 16rpx;
  520 + right: 52rpx;
  521 + width: 180rpx;
  522 + height: 146rpx;
  523 + background-repeat: no-repeat;
  524 + background-size: 100% 100%;
  525 + background-position: center;
  526 +
  527 + &_审批中 {
  528 + background-image: url('~@/static/images/contract/status_1.png');
  529 + }
  530 +
  531 + &_生产中 {
  532 + background-image: url('~@/static/images/contract/status_2.png');
  533 + }
  534 +
  535 + &_已发货 {
  536 + background-image: url('~@/static/images/contract/status_3.png');
  537 + }
  538 +
  539 + &_已签收 {
  540 + background-image: url('~@/static/images/contract/status_4.png');
  541 + }
  542 + }
495 } 543 }
496 544
497 .section1 { 545 .section1 {
@@ -105,13 +105,6 @@ export default { @@ -105,13 +105,6 @@ export default {
105 return { 105 return {
106 searchKeyword: '', 106 searchKeyword: '',
107 searchKeywordDebounced: '', 107 searchKeywordDebounced: '',
108 -  
109 - tabs: [  
110 - { label: '草稿合同', value: 'DRAFT' },  
111 - { label: '正式合同', value: 'FORMAL' },  
112 - { label: '标准合同', value: 'STANDARD' },  
113 - { label: '已删除合同', value: 'DELETED' }  
114 - ],  
115 status: 'DRAFT', 108 status: 'DRAFT',
116 109
117 query: { deptId: '', deptName: '', dateRange: [] }, 110 query: { deptId: '', deptName: '', dateRange: [] },
@@ -129,6 +122,25 @@ export default { @@ -129,6 +122,25 @@ export default {
129 } 122 }
130 }, 123 },
131 computed: { 124 computed: {
  125 + roleCodes() {
  126 + const g = this.$store && this.$store.getters
  127 + return (g && g.roleCodes) || []
  128 + },
  129 + tabs() {
  130 + if (this.roleCodes.includes('constract_admin')) {
  131 + return [
  132 + { label: '草稿合同', value: 'DRAFT' },
  133 + { label: '正式合同', value: 'FORMAL' },
  134 + { label: '标准合同', value: 'STANDARD' },
  135 + { label: '已删除合同', value: 'DELETED' }
  136 + ]
  137 + }
  138 + return [
  139 + { label: '草稿合同', value: 'DRAFT' },
  140 + { label: '正式合同', value: 'FORMAL' },
  141 + { label: '标准合同', value: 'STANDARD' }
  142 + ]
  143 + },
132 extraCombined() { 144 extraCombined() {
133 return { 145 return {
134 keyword: this.searchKeywordDebounced || undefined, 146 keyword: this.searchKeywordDebounced || undefined,
@@ -359,10 +371,10 @@ export default { @@ -359,10 +371,10 @@ export default {
359 margin-bottom: 0; 371 margin-bottom: 0;
360 } 372 }
361 text { 373 text {
362 - width: 60%; 374 + width: 50%;
363 &:last-child { 375 &:last-child {
364 color: rgba(0,0,0,0.9); 376 color: rgba(0,0,0,0.9);
365 - width: 40%; 377 + width: 50%;
366 } 378 }
367 } 379 }
368 } 380 }
@@ -40,9 +40,30 @@ @@ -40,9 +40,30 @@
40 <uni-easyinput v-model="item.quality" placeholder="请输入品质" :clearable="false" disabled /> 40 <uni-easyinput v-model="item.quality" placeholder="请输入品质" :clearable="false" disabled />
41 </template> 41 </template>
42 </uni-list-item> 42 </uni-list-item>
43 - <uni-list-item title="规格"> 43 + <uni-list-item title="规格(mm)">
44 <template v-slot:footer> 44 <template v-slot:footer>
45 - <uni-easyinput v-model="item.specDisplay" placeholder="自动拼接规格" :clearable="false" disabled /> 45 + <!-- <uni-easyinput v-model="item.specDisplay" placeholder="自动拼接规格" :clearable="false" disabled /> -->
  46 + <view class="value value-spec">
  47 + <view v-if="item.thickness" class="value-spec_val">{{ item.thickness }}</view>
  48 + <view v-if="item.thickness" class="value-spec_box">
  49 + <view v-if="item.thicknessTolPos" class="value-spec_box_1">+{{ item.thicknessTolPos }}
  50 + </view>
  51 + <view v-if="item.thicknessTolNeg" class="value-spec_box_2">-{{ item.thicknessTolNeg }}
  52 + </view>
  53 + </view>
  54 + <view v-if="item.width" class="value-spec_val p12">*</view>
  55 + <view v-if="item.width" class="value-spec_val">{{ item.width }}</view>
  56 + <view v-if="item.width" class="value-spec_box">
  57 + <view v-if="item.widthTolPos" class="value-spec_box_1">+{{ item.widthTolPos }}</view>
  58 + <view v-if="item.widthTolNeg" class="value-spec_box_2">-{{ item.widthTolNeg }}</view>
  59 + </view>
  60 + <view v-if="item.length" class="value-spec_val p12">*</view>
  61 + <view v-if="item.length" class="value-spec_val">{{ item.length }}</view>
  62 + <view v-if="item.length" class="value-spec_box">
  63 + <view v-if="item.lengthTolPos" class="value-spec_box_1">+{{ item.lengthTolPos }}</view>
  64 + <view v-if="item.lengthTolNeg" class="value-spec_box_2">-{{ item.lengthTolNeg }}</view>
  65 + </view>
  66 + </view>
46 </template> 67 </template>
47 </uni-list-item> 68 </uni-list-item>
48 <uni-list-item title="状态"> 69 <uni-list-item title="状态">
@@ -699,4 +720,42 @@ export default { @@ -699,4 +720,42 @@ export default {
699 background: $theme-primary; 720 background: $theme-primary;
700 color: #fff; 721 color: #fff;
701 } 722 }
  723 + .value-spec {
  724 + height: 48rpx;
  725 + display: flex;
  726 + align-items: center;
  727 + color: #000000;
  728 + // justify-content: end;
  729 + &_box {
  730 + position: relative;
  731 + width: 60rpx;
  732 + height: 48rpx;
  733 +
  734 + &_1 {
  735 + font-size: 16rpx;
  736 + position: absolute;
  737 + top: -10rpx;
  738 + left: 0;
  739 + }
  740 +
  741 + &_2 {
  742 + font-size: 16rpx;
  743 + position: absolute;
  744 + bottom: -10rpx;
  745 + left: 0;
  746 + }
  747 + }
  748 +
  749 + &_val {
  750 + font-size: 28rpx;
  751 +
  752 + &.p12 {
  753 + padding-right: 12rpx;
  754 + }
  755 + }
  756 + }
  757 + .row-spec {
  758 + height: 60rpx;
  759 + align-items: center;
  760 + }
702 </style> 761 </style>
@@ -22,12 +22,35 @@ @@ -22,12 +22,35 @@
22 </template> 22 </template>
23 </uni-list-item> 23 </uni-list-item>
24 24
  25 + <uni-list-item class="select-item" :class="form.stockUpCompanyId ? 'is-filled' : 'is-empty'" clickable
  26 + @click="openRelate('stockUpCompanyId')" :rightText="form.stockUpCompanyName || '请选择备货单位'" showArrow>
  27 + <template v-slot:body>
  28 + <view class="item-title"><text class="required">*</text><text>备货单位/人(生产标准)</text></view>
  29 + </template>
  30 + </uni-list-item>
  31 +
25 <uni-list-item class="select-item" :class="form.workshopId ? 'is-filled' : 'is-empty'" clickable 32 <uni-list-item class="select-item" :class="form.workshopId ? 'is-filled' : 'is-empty'" clickable
26 @click="openSheet('workshopId')" :rightText="form.workshopName || '请选择生产厂'" showArrow> 33 @click="openSheet('workshopId')" :rightText="form.workshopName || '请选择生产厂'" showArrow>
27 <template v-slot:body> 34 <template v-slot:body>
28 <view class="item-title"><text class="required">*</text><text>生产厂</text></view> 35 <view class="item-title"><text class="required">*</text><text>生产厂</text></view>
29 </template> 36 </template>
30 </uni-list-item> 37 </uni-list-item>
  38 + <uni-list-item class="select-item" :class="form.deptName ? 'is-filled' : 'is-empty'">
  39 + <template v-slot:body>
  40 + <view class="item-title"><text class="required">*</text><text>办事处</text></view>
  41 + </template>
  42 + <template v-slot:footer>
  43 + <view class="serial-number-row">
  44 + <uni-easyinput v-model="form.deptName" :inputBorder="false" disabled />
  45 + </view>
  46 + </template>
  47 + </uni-list-item>
  48 + <uni-list-item class="select-item" :class="form.region ? 'is-filled' : 'is-empty'" clickable
  49 + @click="openSheet('region')" :rightText="displayLabel('regionName')" showArrow>
  50 + <template v-slot:body>
  51 + <view class="item-title"><text class="required">*</text><text>区域</text></view>
  52 + </template>
  53 + </uni-list-item>
31 54
32 <uni-list-item title="订货日期"> 55 <uni-list-item title="订货日期">
33 <template v-slot:footer> 56 <template v-slot:footer>
@@ -41,7 +64,8 @@ @@ -41,7 +64,8 @@
41 </template> 64 </template>
42 </uni-list-item> 65 </uni-list-item>
43 66
44 - <ProductRel mode="add" :deliveryDate="form.orderDate" :deliveryDateBase="form.deliveryDate" :list="productLineList" @change="onProductsChange" :options="productList" /> 67 + <ProductRel ref="productRel" mode="add" :deliveryDate="form.orderDate" :deliveryDateBase="form.deliveryDate"
  68 + :list="productLineList" @change="onProductsChange" :options="productList" />
45 69
46 <uni-list-item title="合计人民币金额(大写)"> 70 <uni-list-item title="合计人民币金额(大写)">
47 <template v-slot:footer> 71 <template v-slot:footer>
@@ -123,7 +147,7 @@ @@ -123,7 +147,7 @@
123 </uni-list-item> 147 </uni-list-item>
124 <uni-list-item title="备注"> 148 <uni-list-item title="备注">
125 <template v-slot:footer> 149 <template v-slot:footer>
126 - <uni-easyinput v-model="form.remarks" placeholder="请输入备注" :inputBorder="false" /> 150 + <uni-easyinput v-model="form.remarks" placeholder="请输入备注" :inputBorder="false" maxlength="2000" />
127 </template> 151 </template>
128 </uni-list-item> 152 </uni-list-item>
129 153
@@ -198,6 +222,8 @@ import { getContractApi, updateContractApi } from '@/api/contract' @@ -198,6 +222,8 @@ import { getContractApi, updateContractApi } from '@/api/contract'
198 import { getDicByCodes } from '@/utils/dic' 222 import { getDicByCodes } from '@/utils/dic'
199 import { formatCurrencyToChinese } from '@/utils/common' 223 import { formatCurrencyToChinese } from '@/utils/common'
200 import { workshopQueryApi } from '@/api/devManage' 224 import { workshopQueryApi } from '@/api/devManage'
  225 +import { getArea } from '@/api/credit_manage.js'
  226 +
201 export default { 227 export default {
202 name: 'ModifyContractForeignStock', 228 name: 'ModifyContractForeignStock',
203 components: { SingleSelectSheet, RelateSelectSheet, ProductRel, CitySelector }, 229 components: { SingleSelectSheet, RelateSelectSheet, ProductRel, CitySelector },
@@ -211,8 +237,14 @@ export default { @@ -211,8 +237,14 @@ export default {
211 supplierName: '', 237 supplierName: '',
212 buyer: '', 238 buyer: '',
213 buyerName: '', 239 buyerName: '',
  240 + stockUpCompanyId: '',
  241 + stockUpCompanyName: '',
214 workshopId: '', 242 workshopId: '',
215 workshopName: '', 243 workshopName: '',
  244 + region: '',
  245 + regionName: '',
  246 + deptName: '',
  247 + deptId: '',
216 orderDate: '', 248 orderDate: '',
217 deliveryDate: '', 249 deliveryDate: '',
218 designatedConsignee: '', 250 designatedConsignee: '',
@@ -222,9 +254,9 @@ export default { @@ -222,9 +254,9 @@ export default {
222 executionStandardName: '', 254 executionStandardName: '',
223 executionStandardRemarks: '', 255 executionStandardRemarks: '',
224 includesPackagingFee: false, 256 includesPackagingFee: false,
225 - includesPackagingFeeName: '', 257 + includesPackagingFeeName: '',
226 includesTransportFee: false, 258 includesTransportFee: false,
227 - includesTransportFeeName: '', 259 + includesTransportFeeName: '',
228 unit: '美元、公斤、美元/公斤', 260 unit: '美元、公斤、美元/公斤',
229 totalAmountCapital: '', 261 totalAmountCapital: '',
230 depositInfo: '', 262 depositInfo: '',
@@ -253,7 +285,8 @@ export default { @@ -253,7 +285,8 @@ export default {
253 totalAmountIncludingTax: 0, 285 totalAmountIncludingTax: 0,
254 productLineList: [], 286 productLineList: [],
255 newProductLineList: [], 287 newProductLineList: [],
256 - productList: [] 288 + productList: [],
  289 + regionOptions: []
257 } 290 }
258 }, 291 },
259 onLoad(query) { 292 onLoad(query) {
@@ -262,6 +295,7 @@ export default { @@ -262,6 +295,7 @@ export default {
262 created() { 295 created() {
263 this.loadSuppliers() 296 this.loadSuppliers()
264 this.loadExtraOptions() 297 this.loadExtraOptions()
  298 + this.loadRegionOptions()
265 this.loadDetail() 299 this.loadDetail()
266 this.$nextTick(() => { 300 this.$nextTick(() => {
267 if (Array.isArray(this.form.destinationId) && this.form.destinationId.length) { 301 if (Array.isArray(this.form.destinationId) && this.form.destinationId.length) {
@@ -270,6 +304,15 @@ export default { @@ -270,6 +304,15 @@ export default {
270 }) 304 })
271 }, 305 },
272 methods: { 306 methods: {
  307 + async loadRegionOptions() {
  308 + try {
  309 + const res = await getArea()
  310 + const list = res.data || []
  311 + this.regionOptions = (list || []).map(it => ({ label: it.name || '', value: it.id || '' }))
  312 + } catch (e) {
  313 + this.regionOptions = []
  314 + }
  315 + },
273 async loadDetail() { 316 async loadDetail() {
274 if (!this.id) return 317 if (!this.id) return
275 try { 318 try {
@@ -286,6 +329,8 @@ export default { @@ -286,6 +329,8 @@ export default {
286 supplierName: m.supplierName || '', 329 supplierName: m.supplierName || '',
287 buyer: m.buyer || (m.customer && m.customer.id) || '', 330 buyer: m.buyer || (m.customer && m.customer.id) || '',
288 buyerName: m.buyerName || (m.customer && m.customer.name) || '', 331 buyerName: m.buyerName || (m.customer && m.customer.name) || '',
  332 + stockUpCompanyId: m.stockUpCompanyId || '',
  333 + stockUpCompanyName: m.stockUpCompanyName || '',
289 orderDate: m.orderDate || '', 334 orderDate: m.orderDate || '',
290 designatedConsignee: m.designatedConsignee || '', 335 designatedConsignee: m.designatedConsignee || '',
291 specialTerms: m.specialTerms || '', 336 specialTerms: m.specialTerms || '',
@@ -315,6 +360,10 @@ export default { @@ -315,6 +360,10 @@ export default {
315 packaging: m.packaging || '', 360 packaging: m.packaging || '',
316 workshopId: m.workshopId || '', 361 workshopId: m.workshopId || '',
317 workshopName: m.workshopName || '', 362 workshopName: m.workshopName || '',
  363 + region: m.region || '',
  364 + regionName: m.regionName || '',
  365 + deptName: m.deptName || '',
  366 + deptId: m.deptId || '',
318 } 367 }
319 const lines = Array.isArray(m.contractDistributorLineList) ? m.contractDistributorLineList : [] 368 const lines = Array.isArray(m.contractDistributorLineList) ? m.contractDistributorLineList : []
320 this.productLineList = lines 369 this.productLineList = lines
@@ -370,7 +419,7 @@ export default { @@ -370,7 +419,7 @@ export default {
370 }, 419 },
371 displayLabel(field) { 420 displayLabel(field) {
372 const m = this.form 421 const m = this.form
373 - const map = { supplierName: '请选择供方', buyerName: '请选择需方', workshopName: '请选择生产厂' } 422 + const map = { supplierName: '请选择供方', buyerName: '请选择需方', workshopName: '请选择生产厂', regionName: '请选择区域' }
374 const val = m[field] 423 const val = m[field]
375 return val ? String(val) : map[field] 424 return val ? String(val) : map[field]
376 }, 425 },
@@ -399,6 +448,8 @@ export default { @@ -399,6 +448,8 @@ export default {
399 setSheet('单价中是否已包含包装费', this.yesNoList) 448 setSheet('单价中是否已包含包装费', this.yesNoList)
400 } else if (field === 'includesTransportFee') { 449 } else if (field === 'includesTransportFee') {
401 setSheet('单价中是否已包含运费', this.yesNoList) 450 setSheet('单价中是否已包含运费', this.yesNoList)
  451 + } else if (field === 'region') {
  452 + setSheet('区域', this.regionOptions)
402 } 453 }
403 }, 454 },
404 onSheetConfirm({ value, label }) { 455 onSheetConfirm({ value, label }) {
@@ -412,6 +463,8 @@ export default { @@ -412,6 +463,8 @@ export default {
412 let config = {} 463 let config = {}
413 if (fieldKey === 'buyer') { 464 if (fieldKey === 'buyer') {
414 config = { title: '需方', source: 'customer', rowKey: 'id', multiple: false, display: [{ label: '姓名', field: 'name' }, { label: '编号', field: 'code' }, { label: '状态', field: 'available', format: v => (v ? '启用' : '停用') }] } 465 config = { title: '需方', source: 'customer', rowKey: 'id', multiple: false, display: [{ label: '姓名', field: 'name' }, { label: '编号', field: 'code' }, { label: '状态', field: 'available', format: v => (v ? '启用' : '停用') }] }
  466 + } else if (fieldKey === 'stockUpCompanyId') {
  467 + config = { title: '备货单位/人(生产标准)', source: 'customer', rowKey: 'id', multiple: false, display: [{ label: '姓名', field: 'name' }, { label: '编号', field: 'code' }, { label: '状态', field: 'available', format: v => (v ? '启用' : '停用') }] }
415 } 468 }
416 const selectedKeys = this.form[fieldKey] ? [this.form[fieldKey]] : [] 469 const selectedKeys = this.form[fieldKey] ? [this.form[fieldKey]] : []
417 this.sheet.visible = false 470 this.sheet.visible = false
@@ -422,7 +475,12 @@ export default { @@ -422,7 +475,12 @@ export default {
422 const _fieldKey = this.relate.fieldKey 475 const _fieldKey = this.relate.fieldKey
423 const first = (items && items.length > 0) ? items[0] : null 476 const first = (items && items.length > 0) ? items[0] : null
424 this.form[_fieldKey] = (first && first.id) ? first.id : '' 477 this.form[_fieldKey] = (first && first.id) ? first.id : ''
425 - this.form[_fieldKey + 'Name'] = (first && first.name) ? first.name : '' 478 +
  479 + if (_fieldKey === 'stockUpCompanyId') {
  480 + this.form.stockUpCompanyName = (first && first.name) ? first.name : ''
  481 + } else {
  482 + this.form[_fieldKey + 'Name'] = (first && first.name) ? first.name : ''
  483 + }
426 }, 484 },
427 onRadioSelect(field, nameField, opt) { 485 onRadioSelect(field, nameField, opt) {
428 const val = opt && opt.value != null ? opt.value : '' 486 const val = opt && opt.value != null ? opt.value : ''
@@ -438,9 +496,11 @@ export default { @@ -438,9 +496,11 @@ export default {
438 { key: 'code', label: '编号' }, 496 { key: 'code', label: '编号' },
439 { key: 'supplier', label: '供方' }, 497 { key: 'supplier', label: '供方' },
440 { key: 'buyer', label: '需方' }, 498 { key: 'buyer', label: '需方' },
  499 + { key: 'stockUpCompanyId', label: '备货单位/人(生产标准)' },
441 { key: 'orderDate', label: '订货日期' }, 500 { key: 'orderDate', label: '订货日期' },
442 { key: 'unit', label: '单位' }, 501 { key: 'unit', label: '单位' },
443 { key: 'workshopId', label: '生产厂' }, 502 { key: 'workshopId', label: '生产厂' },
  503 + { key: 'region', label: '区域' },
444 { key: 'specialTerms', label: '特别条款要求' }, 504 { key: 'specialTerms', label: '特别条款要求' },
445 ] 505 ]
446 for (const it of checks) { 506 for (const it of checks) {
@@ -448,6 +508,7 @@ export default { @@ -448,6 +508,7 @@ export default {
448 const empty = (val === undefined || val === null || (typeof val === 'string' && val.trim() === '') || (typeof val === 'number' && isNaN(val))) 508 const empty = (val === undefined || val === null || (typeof val === 'string' && val.trim() === '') || (typeof val === 'number' && isNaN(val)))
449 if (empty) { uni.showToast({ title: `请先选择${it.label}`, icon: 'none' }); return false } 509 if (empty) { uni.showToast({ title: `请先选择${it.label}`, icon: 'none' }); return false }
450 } 510 }
  511 + if (this.$refs.productRel && !this.$refs.productRel.validate()) return false
451 const list = Array.isArray(this.newProductLineList) ? this.newProductLineList : [] 512 const list = Array.isArray(this.newProductLineList) ? this.newProductLineList : []
452 if (list.length === 0) { 513 if (list.length === 0) {
453 uni.showToast({ title: '请至少添加一条产品明细', icon: 'none' }); return false 514 uni.showToast({ title: '请至少添加一条产品明细', icon: 'none' }); return false
@@ -55,51 +55,53 @@ @@ -55,51 +55,53 @@
55 </uni-list-item> 55 </uni-list-item>
56 <uni-list-item title="厚度(mm)"> 56 <uni-list-item title="厚度(mm)">
57 <template v-slot:footer> 57 <template v-slot:footer>
58 - <uni-easyinput type="digit" v-model="item.thickness" :inputBorder="false" placeholder="请输入厚度" @input="onNonNegativeInput(idx, 'thickness')" @blur="onNonNegativeBlur(idx, 'thickness', 2)" /> 58 + <uni-easyinput type="digit" v-model="item.thickness" :inputBorder="false" placeholder="请输入厚度" @input="onNonNegativeInput(idx, 'thickness')" @blur="onNonNegativeBlur(idx, 'thickness', 9)" />
59 </template> 59 </template>
60 </uni-list-item> 60 </uni-list-item>
61 <uni-list-item title="厚度公差上限(mm)"> 61 <uni-list-item title="厚度公差上限(mm)">
62 <template v-slot:footer> 62 <template v-slot:footer>
63 - <uni-easyinput type="digit" v-model="item.thicknessTolPos" :inputBorder="false"  
64 - placeholder="请输入厚度公差上限" @input="onNonNegativeInput(idx, 'thicknessTolPos')" @blur="onNonNegativeBlur(idx, 'thicknessTolPos', 2)" /> 63 + <uni-easyinput type="text" v-model="item.thicknessTolPos" :inputBorder="false"
  64 + placeholder="请输入厚度公差上限" @input="onNumberInput(idx, 'thicknessTolPos')" @blur="onNumberBlur(idx, 'thicknessTolPos', 9)" />
65 </template> 65 </template>
66 </uni-list-item> 66 </uni-list-item>
67 <uni-list-item title="厚度公差下限(mm)"> 67 <uni-list-item title="厚度公差下限(mm)">
68 <template v-slot:footer> 68 <template v-slot:footer>
69 - <uni-easyinput type="digit" v-model="item.thicknessTolNeg" :inputBorder="false"  
70 - placeholder="请输入厚度公差下限" @input="onNonNegativeInput(idx, 'thicknessTolNeg')" @blur="onNonNegativeBlur(idx, 'thicknessTolNeg', 2)" /> 69 + <uni-easyinput type="text" v-model="item.thicknessTolNeg" :inputBorder="false"
  70 + placeholder="请输入厚度公差下限" @input="onNumberInput(idx, 'thicknessTolNeg')" @blur="onNumberBlur(idx, 'thicknessTolNeg', 9)" />
71 </template> 71 </template>
72 </uni-list-item> 72 </uni-list-item>
73 <uni-list-item title="宽度(mm)"> 73 <uni-list-item title="宽度(mm)">
74 <template v-slot:footer> 74 <template v-slot:footer>
75 - <uni-easyinput type="digit" v-model="item.width" :inputBorder="false" placeholder="请输入宽度" @input="onNonNegativeInput(idx, 'width')" @blur="onNonNegativeBlur(idx, 'width', 2)" /> 75 + <uni-easyinput type="digit" v-model="item.width" :inputBorder="false" placeholder="请输入宽度" @input="onNonNegativeInput(idx, 'width')" @blur="onNonNegativeBlur(idx, 'width', 9)" />
76 </template> 76 </template>
77 </uni-list-item> 77 </uni-list-item>
78 <uni-list-item title="宽度公差上限(mm)"> 78 <uni-list-item title="宽度公差上限(mm)">
79 <template v-slot:footer> 79 <template v-slot:footer>
80 - <uni-easyinput type="digit" v-model="item.widthTolPos" :inputBorder="false" placeholder="请输入宽度公差(单项+)" @input="onNonNegativeInput(idx, 'widthTolPos')" @blur="onNonNegativeBlur(idx, 'widthTolPos', 2)" /> 80 + <uni-easyinput type="text" v-model="item.widthTolPos" :inputBorder="false"
  81 + placeholder="请输入宽度公差上限" @input="onNumberInput(idx, 'widthTolPos')" @blur="onNumberBlur(idx, 'widthTolPos', 9)" />
81 </template> 82 </template>
82 </uni-list-item> 83 </uni-list-item>
83 <uni-list-item title="宽度公差下限(mm)"> 84 <uni-list-item title="宽度公差下限(mm)">
84 <template v-slot:footer> 85 <template v-slot:footer>
85 - <uni-easyinput type="digit" v-model="item.widthTolNeg" :inputBorder="false" placeholder="请输入宽度公差下限" @input="onNonNegativeInput(idx, 'widthTolNeg')" @blur="onNonNegativeBlur(idx, 'widthTolNeg', 2)" /> 86 + <uni-easyinput type="text" v-model="item.widthTolNeg" :inputBorder="false"
  87 + placeholder="请输入宽度公差下限" @input="onNumberInput(idx, 'widthTolNeg')" @blur="onNumberBlur(idx, 'widthTolNeg', 9)" />
86 </template> 88 </template>
87 </uni-list-item> 89 </uni-list-item>
88 <uni-list-item title="长度(mm)"> 90 <uni-list-item title="长度(mm)">
89 <template v-slot:footer> 91 <template v-slot:footer>
90 - <uni-easyinput type="digit" v-model="item.length" :inputBorder="false" placeholder="请输入长度" @input="onNonNegativeInput(idx, 'length')" @blur="onNonNegativeBlur(idx, 'length', 2)" /> 92 + <uni-easyinput type="digit" v-model="item.length" :inputBorder="false" placeholder="请输入长度" @input="onNonNegativeInput(idx, 'length')" @blur="onNonNegativeBlur(idx, 'length', 9)" />
91 </template> 93 </template>
92 </uni-list-item> 94 </uni-list-item>
93 <uni-list-item title="长度公差上限(mm)"> 95 <uni-list-item title="长度公差上限(mm)">
94 <template v-slot:footer> 96 <template v-slot:footer>
95 - <uni-easyinput type="digit" v-model="item.lengthTolPos" :inputBorder="false"  
96 - placeholder="请输入长度公差上限" @input="onNonNegativeInput(idx, 'lengthTolPos')" @blur="onNonNegativeBlur(idx, 'lengthTolPos', 2)" /> 97 + <uni-easyinput type="text" v-model="item.lengthTolPos" :inputBorder="false"
  98 + placeholder="请输入长度公差上限" @input="onNumberInput(idx, 'lengthTolPos')" @blur="onNumberBlur(idx, 'lengthTolPos', 9)" />
97 </template> 99 </template>
98 </uni-list-item> 100 </uni-list-item>
99 <uni-list-item title="长度公差下限(mm)"> 101 <uni-list-item title="长度公差下限(mm)">
100 <template v-slot:footer> 102 <template v-slot:footer>
101 - <uni-easyinput type="digit" v-model="item.lengthTolNeg" :inputBorder="false"  
102 - placeholder="请输入长度公差下限" @input="onNonNegativeInput(idx, 'lengthTolNeg')" @blur="onNonNegativeBlur(idx, 'lengthTolNeg', 2)" /> 103 + <uni-easyinput type="text" v-model="item.lengthTolNeg" :inputBorder="false"
  104 + placeholder="请输入长度公差下限" @input="onNumberInput(idx, 'lengthTolNeg')" @blur="onNumberBlur(idx, 'lengthTolNeg', 9)" />
103 </template> 105 </template>
104 </uni-list-item> 106 </uni-list-item>
105 <uni-list-item title="状态"> 107 <uni-list-item title="状态">
@@ -109,12 +111,12 @@ @@ -109,12 +111,12 @@
109 </uni-list-item> 111 </uni-list-item>
110 <uni-list-item title="数量"> 112 <uni-list-item title="数量">
111 <template v-slot:footer> 113 <template v-slot:footer>
112 - <uni-easyinput v-model="item.quantity" type="digit" :inputBorder="false" placeholder="请输入数量" @input="onNonNegativeInput(idx, 'quantity')" @blur="onNonNegativeBlur(idx, 'quantity', 2)" /> 114 + <uni-easyinput v-model="item.quantity" type="digit" :inputBorder="false" placeholder="请输入数量" @input="onNonNegativeInput(idx, 'quantity')" @blur="onNonNegativeBlur(idx, 'quantity', 9)" />
113 </template> 115 </template>
114 </uni-list-item> 116 </uni-list-item>
115 <uni-list-item title="单价"> 117 <uni-list-item title="单价">
116 <template v-slot:footer> 118 <template v-slot:footer>
117 - <uni-easyinput v-model="item.unitPrice" disabled type="number" :inputBorder="false" placeholder="请输入单价" @input="onImmediateChange(idx)" @blur="onNumberBlur(idx, 'unitPrice', 0)" /> 119 + <uni-easyinput v-model="item.unitPrice" disabled type="number" :inputBorder="false" placeholder="请输入单价" @input="onImmediateChange(idx)" @blur="onNumberBlur(idx, 'unitPrice', 9)" />
118 </template> 120 </template>
119 </uni-list-item> 121 </uni-list-item>
120 <uni-list-item title="外贸加工费"> 122 <uni-list-item title="外贸加工费">
@@ -305,6 +307,27 @@ export default { @@ -305,6 +307,27 @@ export default {
305 this.$set(this.items, idx, it) 307 this.$set(this.items, idx, it)
306 if (field === 'quantity' || field === 'unitPrice') this.recalculate(idx) 308 if (field === 'quantity' || field === 'unitPrice') this.recalculate(idx)
307 }, 309 },
  310 + validate() {
  311 + for (let i = 0; i < this.items.length; i++) {
  312 + const it = this.items[i]
  313 + const check = (pos, neg, label) => {
  314 + if (pos !== '' && pos !== null && pos !== undefined &&
  315 + neg !== '' && neg !== null && neg !== undefined) {
  316 + if (Number(pos) <= Number(neg)) {
  317 + return `第${i + 1}行产品:${label}公差上限必须大于下限`
  318 + }
  319 + }
  320 + return null
  321 + }
  322 + let err = check(it.thicknessTolPos, it.thicknessTolNeg, '厚度')
  323 + if (err) { uni.showToast({ title: err, icon: 'none' }); return false }
  324 + err = check(it.widthTolPos, it.widthTolNeg, '宽度')
  325 + if (err) { uni.showToast({ title: err, icon: 'none' }); return false }
  326 + err = check(it.lengthTolPos, it.lengthTolNeg, '长度')
  327 + if (err) { uni.showToast({ title: err, icon: 'none' }); return false }
  328 + }
  329 + return true
  330 + },
308 formatCurrency(val) { 331 formatCurrency(val) {
309 if (val == null || val === '') return '' 332 if (val == null || val === '') return ''
310 const num = Number(val) 333 const num = Number(val)
@@ -21,6 +21,12 @@ @@ -21,6 +21,12 @@
21 <view class="item-title"><text class="required">*</text><text>需方</text></view> 21 <view class="item-title"><text class="required">*</text><text>需方</text></view>
22 </template> 22 </template>
23 </uni-list-item> 23 </uni-list-item>
  24 + <uni-list-item class="select-item" :class="form.stockUpCompanyId ? 'is-filled' : 'is-empty'" clickable
  25 + @click="openRelate('stockUpCompanyId')" :rightText="form.stockUpCompanyName || '请选择备货单位'" showArrow>
  26 + <template v-slot:body>
  27 + <view class="item-title"><text class="required">*</text><text>备货单位/人(生产标准)</text></view>
  28 + </template>
  29 + </uni-list-item>
24 30
25 <uni-list-item title="订货日期"> 31 <uni-list-item title="订货日期">
26 <template v-slot:footer> 32 <template v-slot:footer>
@@ -39,7 +45,23 @@ @@ -39,7 +45,23 @@
39 <view class="item-title"><text class="required">*</text><text>生产厂</text></view> 45 <view class="item-title"><text class="required">*</text><text>生产厂</text></view>
40 </template> 46 </template>
41 </uni-list-item> 47 </uni-list-item>
42 - <ProductRel mode="add" :deliveryDate="form.orderDate" :deliveryDateBase="form.deliveryDate" @change="onProductsChange" :options="productList" /> 48 + <uni-list-item class="select-item" :class="form.deptName ? 'is-filled' : 'is-empty'">
  49 + <template v-slot:body>
  50 + <view class="item-title"><text class="required">*</text><text>办事处</text></view>
  51 + </template>
  52 + <template v-slot:footer>
  53 + <view class="serial-number-row">
  54 + <uni-easyinput v-model="form.deptName" :inputBorder="false" disabled />
  55 + </view>
  56 + </template>
  57 + </uni-list-item>
  58 + <uni-list-item class="select-item" :class="form.region ? 'is-filled' : 'is-empty'" clickable
  59 + @click="openSheet('region')" :rightText="displayLabel('regionName')" showArrow>
  60 + <template v-slot:body>
  61 + <view class="item-title"><text class="required">*</text><text>区域</text></view>
  62 + </template>
  63 + </uni-list-item>
  64 + <ProductRel ref="productRel" mode="add" :deliveryDate="form.orderDate" :deliveryDateBase="form.deliveryDate" @change="onProductsChange" :options="productList" />
43 <uni-list-item title="合计人民币金额(大写)"> 65 <uni-list-item title="合计人民币金额(大写)">
44 <template v-slot:footer> 66 <template v-slot:footer>
45 <uni-easyinput v-model="form.totalAmountCapital" placeholder="自动计算" :inputBorder="false" disabled /> 67 <uni-easyinput v-model="form.totalAmountCapital" placeholder="自动计算" :inputBorder="false" disabled />
@@ -123,7 +145,7 @@ @@ -123,7 +145,7 @@
123 </uni-list-item> 145 </uni-list-item>
124 <uni-list-item title="备注"> 146 <uni-list-item title="备注">
125 <template v-slot:footer> 147 <template v-slot:footer>
126 - <uni-easyinput type="textarea" v-model="form.remarks" placeholder="请输入备注" :inputBorder="false" /> 148 + <uni-easyinput type="textarea" v-model="form.remarks" placeholder="请输入备注" :inputBorder="false" maxlength="2000" />
127 </template> 149 </template>
128 </uni-list-item> 150 </uni-list-item>
129 <view class="quality"> 151 <view class="quality">
@@ -208,10 +230,11 @@ import SingleSelectSheet from '@/components/single-select/index.vue' @@ -208,10 +230,11 @@ import SingleSelectSheet from '@/components/single-select/index.vue'
208 import RelateSelectSheet from '@/components/relate-select/index.vue' 230 import RelateSelectSheet from '@/components/relate-select/index.vue'
209 import ProductRel from './productRel.vue' 231 import ProductRel from './productRel.vue'
210 import CitySelector from '@/components/city-selector/index.vue' 232 import CitySelector from '@/components/city-selector/index.vue'
211 -import { getRetailCodeApi, createContractApi, getCustomerRemarks,getCustomerSpecificQualityRequirements } from '@/api/contract' 233 +import { getRetailCodeApi, createContractApi, getCustomerRemarks,getCustomerSpecificQualityRequirements, getDeptApi } from '@/api/contract'
212 import { getDicByCodes } from '@/utils/dic' 234 import { getDicByCodes } from '@/utils/dic'
213 import { formatCurrencyToChinese } from '@/utils/common' 235 import { formatCurrencyToChinese } from '@/utils/common'
214 import { workshopQueryApi } from '@/api/devManage' 236 import { workshopQueryApi } from '@/api/devManage'
  237 +import { getArea } from '@/api/credit_manage.js'
215 238
216 export default { 239 export default {
217 name: 'AddContractForeignUnplan', 240 name: 'AddContractForeignUnplan',
@@ -224,6 +247,8 @@ export default { @@ -224,6 +247,8 @@ export default {
224 supplierName: '', 247 supplierName: '',
225 buyer: '', 248 buyer: '',
226 buyerName: '', 249 buyerName: '',
  250 + stockUpCompanyId: '',
  251 + stockUpCompanyName: '',
227 orderDate: '', 252 orderDate: '',
228 deliveryDate: '', 253 deliveryDate: '',
229 designatedConsignee: '', 254 designatedConsignee: '',
@@ -233,15 +258,19 @@ export default { @@ -233,15 +258,19 @@ export default {
233 executionStandardName: '', 258 executionStandardName: '',
234 executionStandardRemarks: '', 259 executionStandardRemarks: '',
235 includesPackagingFee: false, 260 includesPackagingFee: false,
236 - includesPackagingFeeName: '', 261 + includesPackagingFeeName: '',
237 includesTransportFee: false, 262 includesTransportFee: false,
238 - includesTransportFeeName: '', 263 + includesTransportFeeName: '',
239 unit: '美元、公斤、美元/公斤', 264 unit: '美元、公斤、美元/公斤',
240 totalAmountCapital: '', 265 totalAmountCapital: '',
241 destinationId: [], 266 destinationId: [],
242 destinationLabel: '', 267 destinationLabel: '',
243 workshopIdName: '', 268 workshopIdName: '',
244 workshopId: '', 269 workshopId: '',
  270 + deptName: '',
  271 + deptId: '',
  272 + region: '',
  273 + regionName: '',
245 remarks: '', 274 remarks: '',
246 component: '', 275 component: '',
247 packaging: '', 276 packaging: '',
@@ -263,12 +292,15 @@ export default { @@ -263,12 +292,15 @@ export default {
263 productList: [], 292 productList: [],
264 customerRemarks: [], 293 customerRemarks: [],
265 defaultRemark: '', 294 defaultRemark: '',
  295 + regionOptions: [],
266 } 296 }
267 }, 297 },
268 created() { 298 created() {
269 this.loadSuppliers() 299 this.loadSuppliers()
270 this.loadExtraOptions() 300 this.loadExtraOptions()
271 this.initCode() 301 this.initCode()
  302 + this.getDept()
  303 + this.loadRegionOptions()
272 this.form.orderDate = this.formatDate(new Date()) 304 this.form.orderDate = this.formatDate(new Date())
273 this.$nextTick(() => { 305 this.$nextTick(() => {
274 if (Array.isArray(this.form.destinationId) && this.form.destinationId.length) { 306 if (Array.isArray(this.form.destinationId) && this.form.destinationId.length) {
@@ -317,6 +349,24 @@ export default { @@ -317,6 +349,24 @@ export default {
317 }, 349 },
318 }, 350 },
319 methods: { 351 methods: {
  352 + async loadRegionOptions() {
  353 + try {
  354 + const res = await getArea()
  355 + const list = res.data || []
  356 + this.regionOptions = (list || []).map(it => ({ label: it.name || '', value: it.id || '' }))
  357 + } catch (e) {
  358 + this.regionOptions = []
  359 + }
  360 + },
  361 + // 查询当前人所在办事处
  362 + getDept() {
  363 + getDeptApi().then(res => {
  364 + if (res.code === 200) {
  365 + this.form.deptName = res.data.name || ''
  366 + this.form.deptId = res.data.id || ''
  367 + }
  368 + })
  369 + },
320 getHistory() { 370 getHistory() {
321 console.log('this.productLineList', this.productLineList[0].productId) 371 console.log('this.productLineList', this.productLineList[0].productId)
322 if (!this.productLineList.length || !this.productLineList[0].productId) { 372 if (!this.productLineList.length || !this.productLineList[0].productId) {
@@ -404,7 +454,7 @@ export default { @@ -404,7 +454,7 @@ export default {
404 }, 454 },
405 displayLabel(field) { 455 displayLabel(field) {
406 const m = this.form 456 const m = this.form
407 - const map = { supplierName: '请选择供方', buyerName: '请选择需方', workshopIdName: '请选择生产厂' } 457 + const map = { supplierName: '请选择供方', buyerName: '请选择需方', workshopIdName: '请选择生产厂', regionName: '请选择区域' }
408 const val = m[field] 458 const val = m[field]
409 return val ? String(val) : map[field] 459 return val ? String(val) : map[field]
410 }, 460 },
@@ -449,6 +499,8 @@ export default { @@ -449,6 +499,8 @@ export default {
449 setSheet('单价中是否已包含运费', this.yesNoList) 499 setSheet('单价中是否已包含运费', this.yesNoList)
450 } else if (field === 'historyRemarks') { 500 } else if (field === 'historyRemarks') {
451 setSheet('历史备注', this.customerRemarks) 501 setSheet('历史备注', this.customerRemarks)
  502 + }else if (field === 'region') {
  503 + setSheet('区域', this.regionOptions)
452 } 504 }
453 }, 505 },
454 onSheetConfirm({ value, label }) { 506 onSheetConfirm({ value, label }) {
@@ -467,6 +519,8 @@ export default { @@ -467,6 +519,8 @@ export default {
467 let config = {} 519 let config = {}
468 if (fieldKey === 'buyer') { 520 if (fieldKey === 'buyer') {
469 config = { title: '需方', source: 'customer', rowKey: 'id', multiple: false, display: [{ label: '姓名', field: 'name' }, { label: '编号', field: 'code' }, { label: '状态', field: 'available', format: v => (v ? '启用' : '停用') }] } 521 config = { title: '需方', source: 'customer', rowKey: 'id', multiple: false, display: [{ label: '姓名', field: 'name' }, { label: '编号', field: 'code' }, { label: '状态', field: 'available', format: v => (v ? '启用' : '停用') }] }
  522 + } else if (fieldKey === 'stockUpCompanyId') {
  523 + config = { title: '备货单位/人(生产标准)', source: 'customer', rowKey: 'id', multiple: false, display: [{ label: '姓名', field: 'name' }, { label: '编号', field: 'code' }, { label: '状态', field: 'available', format: v => (v ? '启用' : '停用') }] }
470 } 524 }
471 const selectedKeys = this.form[fieldKey] ? [this.form[fieldKey]] : [] 525 const selectedKeys = this.form[fieldKey] ? [this.form[fieldKey]] : []
472 this.sheet.visible = false 526 this.sheet.visible = false
@@ -477,7 +531,17 @@ export default { @@ -477,7 +531,17 @@ export default {
477 const _fieldKey = this.relate.fieldKey 531 const _fieldKey = this.relate.fieldKey
478 const first = (items && items.length > 0) ? items[0] : null 532 const first = (items && items.length > 0) ? items[0] : null
479 this.form[_fieldKey] = (first && first.id) ? first.id : '' 533 this.form[_fieldKey] = (first && first.id) ? first.id : ''
480 - this.form[_fieldKey + 'Name'] = (first && first.name) ? first.name : '' 534 +
  535 + if (_fieldKey === 'stockUpCompanyId') {
  536 + this.form.stockUpCompanyName = (first && first.name) ? first.name : ''
  537 + } else {
  538 + this.form[_fieldKey + 'Name'] = (first && first.name) ? first.name : ''
  539 + }
  540 +
  541 + if (_fieldKey === 'buyer') {
  542 + this.form.stockUpCompanyId = (first && first.id) ? first.id : ''
  543 + this.form.stockUpCompanyName = (first && first.name) ? first.name : ''
  544 + }
481 }, 545 },
482 onRadioSelect(field, nameField, opt) { 546 onRadioSelect(field, nameField, opt) {
483 const val = opt && opt.value != null ? opt.value : '' 547 const val = opt && opt.value != null ? opt.value : ''
@@ -489,6 +553,7 @@ export default { @@ -489,6 +553,7 @@ export default {
489 } 553 }
490 }, 554 },
491 async onSubmit() { 555 async onSubmit() {
  556 + if (this.$refs.productRel && !this.$refs.productRel.validate()) return
492 if (!this.validateRequired()) return 557 if (!this.validateRequired()) return
493 const confirmRes = await new Promise(resolve => { 558 const confirmRes = await new Promise(resolve => {
494 uni.showModal({ title: '提示', content: '确定新增经销未锁规合同吗?', confirmText: '确定', cancelText: '取消', success: resolve }) 559 uni.showModal({ title: '提示', content: '确定新增经销未锁规合同吗?', confirmText: '确定', cancelText: '取消', success: resolve })
@@ -533,9 +598,11 @@ export default { @@ -533,9 +598,11 @@ export default {
533 { key: 'code', label: '编号' }, 598 { key: 'code', label: '编号' },
534 { key: 'supplier', label: '供方' }, 599 { key: 'supplier', label: '供方' },
535 { key: 'buyer', label: '需方' }, 600 { key: 'buyer', label: '需方' },
  601 + { key: 'stockUpCompanyId', label: '备货单位/人(生产标准)' },
536 { key: 'orderDate', label: '订货日期' }, 602 { key: 'orderDate', label: '订货日期' },
537 { key: 'unit', label: '单位' }, 603 { key: 'unit', label: '单位' },
538 { key: 'workshopId', label: '生产厂' }, 604 { key: 'workshopId', label: '生产厂' },
  605 + { key: 'region', label: '区域' },
539 { key: 'specialTerms', label: '特别条款要求' }, 606 { key: 'specialTerms', label: '特别条款要求' },
540 ] 607 ]
541 for (const it of checks) { 608 for (const it of checks) {
@@ -4,16 +4,31 @@ @@ -4,16 +4,31 @@
4 <view class="detail-page"> 4 <view class="detail-page">
5 <view class="section"> 5 <view class="section">
6 <text class="row customer">{{ detail.code }}</text> 6 <text class="row customer">{{ detail.code }}</text>
7 - <view class="row" v-if="detail.status === 'STANDARD' || detail.status === 'FORMAL'"><text class="label">{{ detail.status === 'STANDARD' ? '标准合同' : '正式合同' }}规范性审核状态</text><text class="value"><span class="info-status" :style="detail.standardApprovedName ? getStatusCss(detail.standardApprovedName) : ''" >{{ detail.standardApprovedName || '-' }}</span></text></view> 7 + <view class="row" v-if="detail.status === 'STANDARD' || detail.status === 'FORMAL'">
  8 + <text class="label">{{ detail.status === 'STANDARD' ? '标准合同' : '正式合同' }}规范性审核状态</text>
  9 + <text class="value">
  10 +
  11 + <span v-if="detail.status === 'STANDARD'" class="info-status" :style="detail.standardApprovedName ? getStatusCss(detail.standardApprovedName) : ''" >{{ detail.standardApprovedName || '-' }}</span>
  12 + <span v-if="detail.status === 'FORMAL'" class="info-status" :style="detail.formalApprovedName ? getStatusCss(detail.formalApprovedName) : ''" >{{ detail.formalApprovedName || '-' }}</span>
  13 +
  14 + </text>
  15 + </view>
  16 + <view v-if="detail.status === 'STANDARD'" :class="['status', `status_${detail.shippingStatusName}`]" />
8 <view class="row"><text class="label">供方</text><text class="value">{{ detail.supplierName || '-' 17 <view class="row"><text class="label">供方</text><text class="value">{{ detail.supplierName || '-'
9 }}</text></view> 18 }}</text></view>
10 <view class="row"><text class="label">需方</text><text class="value">{{ detail.buyerName || '-' 19 <view class="row"><text class="label">需方</text><text class="value">{{ detail.buyerName || '-'
11 }}</text></view> 20 }}</text></view>
  21 + <view class="row"><text class="label">备货单位/人(生产标准)</text><text class="value">{{ detail.stockUpCompanyName || '-'
  22 + }}</text></view>
12 <view class="row"><text class="label">订货日期</text><text class="value">{{ detail.orderDate }}</text> 23 <view class="row"><text class="label">订货日期</text><text class="value">{{ detail.orderDate }}</text>
13 </view> 24 </view>
14 <view class="row"><text class="label">单位</text><text class="value">{{ detail.unit }}</text></view> 25 <view class="row"><text class="label">单位</text><text class="value">{{ detail.unit }}</text></view>
15 <view class="row"><text class="label">生产厂</text><text class="value">{{ detail.workshopName || '-' 26 <view class="row"><text class="label">生产厂</text><text class="value">{{ detail.workshopName || '-'
16 }}</text></view> 27 }}</text></view>
  28 + <view class="row"><text class="label">办事处</text><text class="value">{{ detail.deptName || '-'
  29 + }}</text></view>
  30 + <view class="row"><text class="label">区域</text><text class="value">{{ detail.regionName || '-'
  31 + }}</text></view>
17 </view> 32 </view>
18 33
19 <view class="section1"> 34 <view class="section1">
@@ -114,11 +129,12 @@ @@ -114,11 +129,12 @@
114 </template> 129 </template>
115 130
116 <script> 131 <script>
117 -import { getContractApi, deleteContractApi, uploadFormalContract, uploadStandardContract, uploadSignedContractFile, statusStyle } from '@/api/contract' 132 +import { getContractApi, deleteContractApi, uploadFormalContract, uploadStandardContract, uploadSignedContractFile, statusStyle, statusMap,showContract } from '@/api/contract'
118 import ProductRel from './productRel.vue' 133 import ProductRel from './productRel.vue'
119 import DetailButtons from '@/components/detail-buttons/index.vue' 134 import DetailButtons from '@/components/detail-buttons/index.vue'
120 import FileUpload from '@/components/file-upload/index.vue' 135 import FileUpload from '@/components/file-upload/index.vue'
121 import SingleSelectSheet from '@/components/single-select/index.vue' 136 import SingleSelectSheet from '@/components/single-select/index.vue'
  137 +import { fillStandardApprovedName, fillFormalApprovedName } from '@/utils/dic.js'
122 138
123 export default { 139 export default {
124 name: 'ContractForeignUnplanDetail', 140 name: 'ContractForeignUnplanDetail',
@@ -139,10 +155,15 @@ export default { @@ -139,10 +155,15 @@ export default {
139 supplierName: '', 155 supplierName: '',
140 buyer: '', 156 buyer: '',
141 buyerName: '', 157 buyerName: '',
  158 + stockUpCompanyId: '',
  159 + stockUpCompanyName: '',
142 orderDate: '', 160 orderDate: '',
143 unit: '', 161 unit: '',
144 workshopId: '', 162 workshopId: '',
145 workshopName: '', 163 workshopName: '',
  164 + deptName: '',
  165 + region: '',
  166 + regionName: '',
146 designatedConsignee: '', 167 designatedConsignee: '',
147 specialTerms: '', 168 specialTerms: '',
148 specialTermsName: '', 169 specialTermsName: '',
@@ -171,6 +192,7 @@ export default { @@ -171,6 +192,7 @@ export default {
171 }, 192 },
172 productList: [], 193 productList: [],
173 statusStyle: statusStyle, 194 statusStyle: statusStyle,
  195 + statusMap: statusMap,
174 buttons: [{ 196 buttons: [{
175 text: '编辑', 197 text: '编辑',
176 visible: true, 198 visible: true,
@@ -238,19 +260,16 @@ export default { @@ -238,19 +260,16 @@ export default {
238 { 260 {
239 text: '正式合同审核详情', 261 text: '正式合同审核详情',
240 visible: true, 262 visible: true,
241 - variant: 'primary',  
242 event: 'auditDetail1' 263 event: 'auditDetail1'
243 }, 264 },
244 { 265 {
245 text: '正式合同审核详情', 266 text: '正式合同审核详情',
246 visible: true, 267 visible: true,
247 - variant: 'primary',  
248 event: 'auditDetail2' 268 event: 'auditDetail2'
249 }, 269 },
250 { 270 {
251 text: '标准合同审核详情', 271 text: '标准合同审核详情',
252 visible: true, 272 visible: true,
253 - variant: 'primary',  
254 event: 'auditDetail3' 273 event: 'auditDetail3'
255 }, 274 },
256 { 275 {
@@ -334,8 +353,10 @@ export default { @@ -334,8 +353,10 @@ export default {
334 }) 353 })
335 }, 354 },
336 onLockApply() { 355 onLockApply() {
337 - uni.navigateTo({  
338 - url: '/pages/contract_foreign_unplan/lock_apply?id=' + this.detail.id || '' 356 + showContract(this.detail.id).then(res => {
  357 + uni.navigateTo({
  358 + url: '/pages/contract_foreign_unplan/lock_apply?id=' + this.detail.id || ''
  359 + })
339 }) 360 })
340 }, 361 },
341 onEdit() { 362 onEdit() {
@@ -461,10 +482,15 @@ export default { @@ -461,10 +482,15 @@ export default {
461 this.detail = { 482 this.detail = {
462 ...this.detail, 483 ...this.detail,
463 ...data, 484 ...data,
  485 + stockUpCompanyName: data.stockUpCompanyName || '',
  486 + regionName: data.regionName || '',
  487 + deptName: data.deptName || '',
464 includesPackagingFeeName, includesTransportFeeName, 488 includesPackagingFeeName, includesTransportFeeName,
465 destinationId: data.provinceId && data.cityId && data.districtId ? [data.provinceId, data.cityId, data.districtId] : '', 489 destinationId: data.provinceId && data.cityId && data.districtId ? [data.provinceId, data.cityId, data.districtId] : '',
466 destinationLabel: data.provinceName && data.cityName && data.districtName ? `${data.provinceName} / ${data.cityName} / ${data.districtName}` : '', 490 destinationLabel: data.provinceName && data.cityName && data.districtName ? `${data.provinceName} / ${data.cityName} / ${data.districtName}` : '',
467 } 491 }
  492 + this.detail = await fillStandardApprovedName(this.detail)
  493 + this.detail = await fillFormalApprovedName(this.detail)
468 const lines = Array.isArray(data.contractDistributorLineList) ? data.contractDistributorLineList : [] 494 const lines = Array.isArray(data.contractDistributorLineList) ? data.contractDistributorLineList : []
469 this.productList = lines 495 this.productList = lines
470 } catch (e) { 496 } catch (e) {
@@ -502,6 +528,32 @@ export default { @@ -502,6 +528,32 @@ export default {
502 padding: 32rpx; 528 padding: 32rpx;
503 background: #fff; 529 background: #fff;
504 margin-bottom: 20rpx; 530 margin-bottom: 20rpx;
  531 + .status {
  532 + position: absolute;
  533 + top: 16rpx;
  534 + right: 52rpx;
  535 + width: 180rpx;
  536 + height: 146rpx;
  537 + background-repeat: no-repeat;
  538 + background-size: 100% 100%;
  539 + background-position: center;
  540 +
  541 + &_审批中 {
  542 + background-image: url('~@/static/images/contract/status_1.png');
  543 + }
  544 +
  545 + &_生产中 {
  546 + background-image: url('~@/static/images/contract/status_2.png');
  547 + }
  548 +
  549 + &_已发货 {
  550 + background-image: url('~@/static/images/contract/status_3.png');
  551 + }
  552 +
  553 + &_已签收 {
  554 + background-image: url('~@/static/images/contract/status_4.png');
  555 + }
  556 + }
505 } 557 }
506 558
507 .section1 { 559 .section1 {
@@ -105,13 +105,6 @@ export default { @@ -105,13 +105,6 @@ export default {
105 return { 105 return {
106 searchKeyword: '', 106 searchKeyword: '',
107 searchKeywordDebounced: '', 107 searchKeywordDebounced: '',
108 -  
109 - tabs: [  
110 - { label: '草稿合同', value: 'DRAFT' },  
111 - { label: '正式合同', value: 'FORMAL' },  
112 - { label: '标准合同', value: 'STANDARD' },  
113 - { label: '已删除合同', value: 'DELETED' }  
114 - ],  
115 status: 'DRAFT', 108 status: 'DRAFT',
116 109
117 query: { deptId: '', deptName: '', dateRange: [] }, 110 query: { deptId: '', deptName: '', dateRange: [] },
@@ -129,6 +122,25 @@ export default { @@ -129,6 +122,25 @@ export default {
129 } 122 }
130 }, 123 },
131 computed: { 124 computed: {
  125 + roleCodes() {
  126 + const g = this.$store && this.$store.getters
  127 + return (g && g.roleCodes) || []
  128 + },
  129 + tabs() {
  130 + if (this.roleCodes.includes('constract_admin')) {
  131 + return [
  132 + { label: '草稿合同', value: 'DRAFT' },
  133 + { label: '正式合同', value: 'FORMAL' },
  134 + { label: '标准合同', value: 'STANDARD' },
  135 + { label: '已删除合同', value: 'DELETED' }
  136 + ]
  137 + }
  138 + return [
  139 + { label: '草稿合同', value: 'DRAFT' },
  140 + { label: '正式合同', value: 'FORMAL' },
  141 + { label: '标准合同', value: 'STANDARD' }
  142 + ]
  143 + },
132 extraCombined() { 144 extraCombined() {
133 return { 145 return {
134 keyword: this.searchKeywordDebounced || undefined, 146 keyword: this.searchKeywordDebounced || undefined,
@@ -361,10 +373,10 @@ export default { @@ -361,10 +373,10 @@ export default {
361 margin-bottom: 0; 373 margin-bottom: 0;
362 } 374 }
363 text { 375 text {
364 - width: 60%; 376 + width: 50%;
365 &:last-child { 377 &:last-child {
366 color: rgba(0,0,0,0.9); 378 color: rgba(0,0,0,0.9);
367 - width: 40%; 379 + width: 50%;
368 } 380 }
369 } 381 }
370 } 382 }
@@ -39,9 +39,30 @@ @@ -39,9 +39,30 @@
39 <uni-easyinput v-model="item.quality" placeholder="请输入品质" :clearable="false" disabled /> 39 <uni-easyinput v-model="item.quality" placeholder="请输入品质" :clearable="false" disabled />
40 </template> 40 </template>
41 </uni-list-item> 41 </uni-list-item>
42 - <uni-list-item title="规格"> 42 + <uni-list-item title="规格(mm)">
43 <template v-slot:footer> 43 <template v-slot:footer>
44 - <uni-easyinput v-model="item.specDisplay" placeholder="自动拼接规格" :clearable="false" disabled /> 44 + <!-- <uni-easyinput v-model="item.specDisplay" placeholder="自动拼接规格" :clearable="false" disabled /> -->
  45 + <view class="value value-spec">
  46 + <view v-if="item.thickness" class="value-spec_val">{{ item.thickness }}</view>
  47 + <view v-if="item.thickness" class="value-spec_box">
  48 + <view v-if="item.thicknessTolPos" class="value-spec_box_1">+{{ item.thicknessTolPos }}
  49 + </view>
  50 + <view v-if="item.thicknessTolNeg" class="value-spec_box_2">-{{ item.thicknessTolNeg }}
  51 + </view>
  52 + </view>
  53 + <view v-if="item.width" class="value-spec_val p12">*</view>
  54 + <view v-if="item.width" class="value-spec_val">{{ item.width }}</view>
  55 + <view v-if="item.width" class="value-spec_box">
  56 + <view v-if="item.widthTolPos" class="value-spec_box_1">+{{ item.widthTolPos }}</view>
  57 + <view v-if="item.widthTolNeg" class="value-spec_box_2">-{{ item.widthTolNeg }}</view>
  58 + </view>
  59 + <view v-if="item.length" class="value-spec_val p12">*</view>
  60 + <view v-if="item.length" class="value-spec_val">{{ item.length }}</view>
  61 + <view v-if="item.length" class="value-spec_box">
  62 + <view v-if="item.lengthTolPos" class="value-spec_box_1">+{{ item.lengthTolPos }}</view>
  63 + <view v-if="item.lengthTolNeg" class="value-spec_box_2">-{{ item.lengthTolNeg }}</view>
  64 + </view>
  65 + </view>
45 </template> 66 </template>
46 </uni-list-item> 67 </uni-list-item>
47 <uni-list-item title="状态"> 68 <uni-list-item title="状态">
@@ -699,4 +720,42 @@ export default { @@ -699,4 +720,42 @@ export default {
699 background: $theme-primary; 720 background: $theme-primary;
700 color: #fff; 721 color: #fff;
701 } 722 }
  723 +.value-spec {
  724 + height: 48rpx;
  725 + display: flex;
  726 + align-items: center;
  727 + color: #000000;
  728 + // justify-content: end;
  729 + &_box {
  730 + position: relative;
  731 + width: 60rpx;
  732 + height: 48rpx;
  733 +
  734 + &_1 {
  735 + font-size: 16rpx;
  736 + position: absolute;
  737 + top: -10rpx;
  738 + left: 0;
  739 + }
  740 +
  741 + &_2 {
  742 + font-size: 16rpx;
  743 + position: absolute;
  744 + bottom: -10rpx;
  745 + left: 0;
  746 + }
  747 + }
  748 +
  749 + &_val {
  750 + font-size: 28rpx;
  751 +
  752 + &.p12 {
  753 + padding-right: 12rpx;
  754 + }
  755 + }
  756 + }
  757 + .row-spec {
  758 + height: 60rpx;
  759 + align-items: center;
  760 + }
702 </style> 761 </style>
@@ -108,11 +108,13 @@ export default { @@ -108,11 +108,13 @@ export default {
108 const res = await showContract(this.id) 108 const res = await showContract(this.id)
109 const data = res && res.data ? res.data : {} 109 const data = res && res.data ? res.data : {}
110 this.detail = { 110 this.detail = {
  111 + contractId: data.contractId || '',
111 contractCode: data.contractCode || '', 112 contractCode: data.contractCode || '',
112 customerName: data.customerName || '', 113 customerName: data.customerName || '',
113 deptName: data.deptName || '', 114 deptName: data.deptName || '',
114 workshopName: data.workshopName || '', 115 workshopName: data.workshopName || '',
115 orderType: data.orderType || '', 116 orderType: data.orderType || '',
  117 + contractTypeCode: data.contractType || '',
116 contractType: data.contractType === 'DRAFT_DIST_AGMT' ? '经销订单' : '外贸订单', 118 contractType: data.contractType === 'DRAFT_DIST_AGMT' ? '经销订单' : '外贸订单',
117 orderDate: (data.orderDate || '').slice(0, 10), 119 orderDate: (data.orderDate || '').slice(0, 10),
118 applicationCount: data.applicationCount || '', 120 applicationCount: data.applicationCount || '',
@@ -139,6 +141,7 @@ export default { @@ -139,6 +141,7 @@ export default {
139 if (res.confirm) { 141 if (res.confirm) {
140 specLockDelayApplication({ 142 specLockDelayApplication({
141 ...this.detail, 143 ...this.detail,
  144 + contractType: this.detail.contractTypeCode || '',
142 specLockDate: date, 145 specLockDate: date,
143 delayReason: reason 146 delayReason: reason
144 }).then(res => { 147 }).then(res => {
@@ -22,12 +22,35 @@ @@ -22,12 +22,35 @@
22 </template> 22 </template>
23 </uni-list-item> 23 </uni-list-item>
24 24
  25 + <uni-list-item class="select-item" :class="form.stockUpCompanyId ? 'is-filled' : 'is-empty'" clickable
  26 + @click="openRelate('stockUpCompanyId')" :rightText="form.stockUpCompanyName || '请选择备货单位'" showArrow>
  27 + <template v-slot:body>
  28 + <view class="item-title"><text class="required">*</text><text>备货单位/人(生产标准)</text></view>
  29 + </template>
  30 + </uni-list-item>
  31 +
25 <uni-list-item class="select-item" :class="form.workshopId ? 'is-filled' : 'is-empty'" clickable 32 <uni-list-item class="select-item" :class="form.workshopId ? 'is-filled' : 'is-empty'" clickable
26 @click="openSheet('workshopId')" :rightText="form.workshopName || '请选择生产厂'" showArrow> 33 @click="openSheet('workshopId')" :rightText="form.workshopName || '请选择生产厂'" showArrow>
27 <template v-slot:body> 34 <template v-slot:body>
28 <view class="item-title"><text class="required">*</text><text>生产厂</text></view> 35 <view class="item-title"><text class="required">*</text><text>生产厂</text></view>
29 </template> 36 </template>
30 </uni-list-item> 37 </uni-list-item>
  38 + <uni-list-item class="select-item" :class="form.deptName ? 'is-filled' : 'is-empty'">
  39 + <template v-slot:body>
  40 + <view class="item-title"><text class="required">*</text><text>办事处</text></view>
  41 + </template>
  42 + <template v-slot:footer>
  43 + <view class="serial-number-row">
  44 + <uni-easyinput v-model="form.deptName" :inputBorder="false" disabled />
  45 + </view>
  46 + </template>
  47 + </uni-list-item>
  48 + <uni-list-item class="select-item" :class="form.region ? 'is-filled' : 'is-empty'" clickable
  49 + @click="openSheet('region')" :rightText="displayLabel('regionName')" showArrow>
  50 + <template v-slot:body>
  51 + <view class="item-title"><text class="required">*</text><text>区域</text></view>
  52 + </template>
  53 + </uni-list-item>
31 54
32 <uni-list-item title="订货日期"> 55 <uni-list-item title="订货日期">
33 <template v-slot:footer> 56 <template v-slot:footer>
@@ -41,7 +64,7 @@ @@ -41,7 +64,7 @@
41 </template> 64 </template>
42 </uni-list-item> 65 </uni-list-item>
43 66
44 - <ProductRel mode="add" :deliveryDate="form.orderDate" :deliveryDateBase="form.deliveryDate" :list="productLineList" @change="onProductsChange" :options="productList" /> 67 + <ProductRel ref="productRel" mode="add" :deliveryDate="form.orderDate" :deliveryDateBase="form.deliveryDate" :list="productLineList" @change="onProductsChange" :options="productList" />
45 68
46 <uni-list-item title="合计人民币金额(大写)"> 69 <uni-list-item title="合计人民币金额(大写)">
47 <template v-slot:footer> 70 <template v-slot:footer>
@@ -123,7 +146,7 @@ @@ -123,7 +146,7 @@
123 </uni-list-item> 146 </uni-list-item>
124 <uni-list-item title="备注"> 147 <uni-list-item title="备注">
125 <template v-slot:footer> 148 <template v-slot:footer>
126 - <uni-easyinput v-model="form.remarks" placeholder="请输入备注" :inputBorder="false" /> 149 + <uni-easyinput v-model="form.remarks" placeholder="请输入备注" :inputBorder="false" maxlength="2000" />
127 </template> 150 </template>
128 </uni-list-item> 151 </uni-list-item>
129 152
@@ -198,6 +221,8 @@ import { getContractApi, updateContractApi } from '@/api/contract' @@ -198,6 +221,8 @@ import { getContractApi, updateContractApi } from '@/api/contract'
198 import { getDicByCodes } from '@/utils/dic' 221 import { getDicByCodes } from '@/utils/dic'
199 import { formatCurrencyToChinese } from '@/utils/common' 222 import { formatCurrencyToChinese } from '@/utils/common'
200 import { workshopQueryApi } from '@/api/devManage' 223 import { workshopQueryApi } from '@/api/devManage'
  224 +import { getArea } from '@/api/credit_manage.js'
  225 +
201 export default { 226 export default {
202 name: 'ModifyContractForeignUnplan', 227 name: 'ModifyContractForeignUnplan',
203 components: { SingleSelectSheet, RelateSelectSheet, ProductRel, CitySelector }, 228 components: { SingleSelectSheet, RelateSelectSheet, ProductRel, CitySelector },
@@ -211,8 +236,14 @@ export default { @@ -211,8 +236,14 @@ export default {
211 supplierName: '', 236 supplierName: '',
212 buyer: '', 237 buyer: '',
213 buyerName: '', 238 buyerName: '',
  239 + stockUpCompanyId: '',
  240 + stockUpCompanyName: '',
214 workshopId: '', 241 workshopId: '',
215 workshopName: '', 242 workshopName: '',
  243 + region: '',
  244 + regionName: '',
  245 + deptName: '',
  246 + deptId: '',
216 orderDate: '', 247 orderDate: '',
217 deliveryDate: '', 248 deliveryDate: '',
218 designatedConsignee: '', 249 designatedConsignee: '',
@@ -222,9 +253,9 @@ export default { @@ -222,9 +253,9 @@ export default {
222 executionStandardName: '', 253 executionStandardName: '',
223 executionStandardRemarks: '', 254 executionStandardRemarks: '',
224 includesPackagingFee: false, 255 includesPackagingFee: false,
225 - includesPackagingFeeName: '', 256 + includesPackagingFeeName: '',
226 includesTransportFee: false, 257 includesTransportFee: false,
227 - includesTransportFeeName: '', 258 + includesTransportFeeName: '',
228 unit: '美元、公斤、美元/公斤', 259 unit: '美元、公斤、美元/公斤',
229 totalAmountCapital: '', 260 totalAmountCapital: '',
230 depositInfo: '', 261 depositInfo: '',
@@ -253,7 +284,8 @@ export default { @@ -253,7 +284,8 @@ export default {
253 totalAmountIncludingTax: 0, 284 totalAmountIncludingTax: 0,
254 productLineList: [], 285 productLineList: [],
255 newProductLineList: [], 286 newProductLineList: [],
256 - productList: [] 287 + productList: [],
  288 + regionOptions: []
257 } 289 }
258 }, 290 },
259 onLoad(query) { 291 onLoad(query) {
@@ -262,6 +294,7 @@ export default { @@ -262,6 +294,7 @@ export default {
262 created() { 294 created() {
263 this.loadSuppliers() 295 this.loadSuppliers()
264 this.loadExtraOptions() 296 this.loadExtraOptions()
  297 + this.loadRegionOptions()
265 this.loadDetail() 298 this.loadDetail()
266 this.$nextTick(() => { 299 this.$nextTick(() => {
267 if (Array.isArray(this.form.destinationId) && this.form.destinationId.length) { 300 if (Array.isArray(this.form.destinationId) && this.form.destinationId.length) {
@@ -270,6 +303,15 @@ export default { @@ -270,6 +303,15 @@ export default {
270 }) 303 })
271 }, 304 },
272 methods: { 305 methods: {
  306 + async loadRegionOptions() {
  307 + try {
  308 + const res = await getArea()
  309 + const list = res.data || []
  310 + this.regionOptions = (list || []).map(it => ({ label: it.name || '', value: it.id || '' }))
  311 + } catch (e) {
  312 + this.regionOptions = []
  313 + }
  314 + },
273 async loadDetail() { 315 async loadDetail() {
274 if (!this.id) return 316 if (!this.id) return
275 try { 317 try {
@@ -286,6 +328,8 @@ export default { @@ -286,6 +328,8 @@ export default {
286 supplierName: m.supplierName || '', 328 supplierName: m.supplierName || '',
287 buyer: m.buyer || (m.customer && m.customer.id) || '', 329 buyer: m.buyer || (m.customer && m.customer.id) || '',
288 buyerName: m.buyerName || (m.customer && m.customer.name) || '', 330 buyerName: m.buyerName || (m.customer && m.customer.name) || '',
  331 + stockUpCompanyId: m.stockUpCompanyId || '',
  332 + stockUpCompanyName: m.stockUpCompanyName || '',
289 orderDate: m.orderDate || '', 333 orderDate: m.orderDate || '',
290 designatedConsignee: m.designatedConsignee || '', 334 designatedConsignee: m.designatedConsignee || '',
291 specialTerms: m.specialTerms || '', 335 specialTerms: m.specialTerms || '',
@@ -315,6 +359,10 @@ export default { @@ -315,6 +359,10 @@ export default {
315 packaging: m.packaging || '', 359 packaging: m.packaging || '',
316 workshopId: m.workshopId || '', 360 workshopId: m.workshopId || '',
317 workshopName: m.workshopName || '', 361 workshopName: m.workshopName || '',
  362 + region: m.region || '',
  363 + regionName: m.regionName || '',
  364 + deptName: m.deptName || '',
  365 + deptId: m.deptId || '',
318 } 366 }
319 const lines = Array.isArray(m.contractDistributorLineList) ? m.contractDistributorLineList : [] 367 const lines = Array.isArray(m.contractDistributorLineList) ? m.contractDistributorLineList : []
320 this.productLineList = lines 368 this.productLineList = lines
@@ -370,7 +418,7 @@ export default { @@ -370,7 +418,7 @@ export default {
370 }, 418 },
371 displayLabel(field) { 419 displayLabel(field) {
372 const m = this.form 420 const m = this.form
373 - const map = { supplierName: '请选择供方', buyerName: '请选择需方', workshopName: '请选择生产厂' } 421 + const map = { supplierName: '请选择供方', buyerName: '请选择需方', workshopName: '请选择生产厂', regionName: '请选择区域' }
374 const val = m[field] 422 const val = m[field]
375 return val ? String(val) : map[field] 423 return val ? String(val) : map[field]
376 }, 424 },
@@ -399,6 +447,8 @@ export default { @@ -399,6 +447,8 @@ export default {
399 setSheet('单价中是否已包含包装费', this.yesNoList) 447 setSheet('单价中是否已包含包装费', this.yesNoList)
400 } else if (field === 'includesTransportFee') { 448 } else if (field === 'includesTransportFee') {
401 setSheet('单价中是否已包含运费', this.yesNoList) 449 setSheet('单价中是否已包含运费', this.yesNoList)
  450 + } else if (field === 'region') {
  451 + setSheet('区域', this.regionOptions)
402 } 452 }
403 }, 453 },
404 onSheetConfirm({ value, label }) { 454 onSheetConfirm({ value, label }) {
@@ -412,6 +462,8 @@ export default { @@ -412,6 +462,8 @@ export default {
412 let config = {} 462 let config = {}
413 if (fieldKey === 'buyer') { 463 if (fieldKey === 'buyer') {
414 config = { title: '需方', source: 'customer', rowKey: 'id', multiple: false, display: [{ label: '姓名', field: 'name' }, { label: '编号', field: 'code' }, { label: '状态', field: 'available', format: v => (v ? '启用' : '停用') }] } 464 config = { title: '需方', source: 'customer', rowKey: 'id', multiple: false, display: [{ label: '姓名', field: 'name' }, { label: '编号', field: 'code' }, { label: '状态', field: 'available', format: v => (v ? '启用' : '停用') }] }
  465 + } else if (fieldKey === 'stockUpCompanyId') {
  466 + config = { title: '备货单位/人(生产标准)', source: 'customer', rowKey: 'id', multiple: false, display: [{ label: '姓名', field: 'name' }, { label: '编号', field: 'code' }, { label: '状态', field: 'available', format: v => (v ? '启用' : '停用') }] }
415 } 467 }
416 const selectedKeys = this.form[fieldKey] ? [this.form[fieldKey]] : [] 468 const selectedKeys = this.form[fieldKey] ? [this.form[fieldKey]] : []
417 this.sheet.visible = false 469 this.sheet.visible = false
@@ -422,7 +474,12 @@ export default { @@ -422,7 +474,12 @@ export default {
422 const _fieldKey = this.relate.fieldKey 474 const _fieldKey = this.relate.fieldKey
423 const first = (items && items.length > 0) ? items[0] : null 475 const first = (items && items.length > 0) ? items[0] : null
424 this.form[_fieldKey] = (first && first.id) ? first.id : '' 476 this.form[_fieldKey] = (first && first.id) ? first.id : ''
425 - this.form[_fieldKey + 'Name'] = (first && first.name) ? first.name : '' 477 +
  478 + if (_fieldKey === 'stockUpCompanyId') {
  479 + this.form.stockUpCompanyName = (first && first.name) ? first.name : ''
  480 + } else {
  481 + this.form[_fieldKey + 'Name'] = (first && first.name) ? first.name : ''
  482 + }
426 }, 483 },
427 onRadioSelect(field, nameField, opt) { 484 onRadioSelect(field, nameField, opt) {
428 const val = opt && opt.value != null ? opt.value : '' 485 const val = opt && opt.value != null ? opt.value : ''
@@ -438,9 +495,11 @@ export default { @@ -438,9 +495,11 @@ export default {
438 { key: 'code', label: '编号' }, 495 { key: 'code', label: '编号' },
439 { key: 'supplier', label: '供方' }, 496 { key: 'supplier', label: '供方' },
440 { key: 'buyer', label: '需方' }, 497 { key: 'buyer', label: '需方' },
  498 + { key: 'stockUpCompanyId', label: '备货单位/人(生产标准)' },
441 { key: 'orderDate', label: '订货日期' }, 499 { key: 'orderDate', label: '订货日期' },
442 { key: 'unit', label: '单位' }, 500 { key: 'unit', label: '单位' },
443 { key: 'workshopId', label: '生产厂' }, 501 { key: 'workshopId', label: '生产厂' },
  502 + { key: 'region', label: '区域' },
444 { key: 'specialTerms', label: '特别条款要求' }, 503 { key: 'specialTerms', label: '特别条款要求' },
445 ] 504 ]
446 for (const it of checks) { 505 for (const it of checks) {
@@ -470,8 +529,8 @@ export default { @@ -470,8 +529,8 @@ export default {
470 return true 529 return true
471 }, 530 },
472 async onSubmit() { 531 async onSubmit() {
473 - console.log('onSubmit__payload', payload)  
474 if (!this.validateRequired()) return 532 if (!this.validateRequired()) return
  533 + if (this.$refs.productRel && !this.$refs.productRel.validate()) return
475 const confirmRes = await new Promise(resolve => { 534 const confirmRes = await new Promise(resolve => {
476 uni.showModal({ title: '提示', content: '确定保存当前经销未锁规合同吗?', confirmText: '确定', cancelText: '取消', success: resolve }) 535 uni.showModal({ title: '提示', content: '确定保存当前经销未锁规合同吗?', confirmText: '确定', cancelText: '取消', success: resolve })
477 }) 536 })
@@ -55,51 +55,51 @@ @@ -55,51 +55,51 @@
55 </uni-list-item> 55 </uni-list-item>
56 <uni-list-item title="厚度(mm)"> 56 <uni-list-item title="厚度(mm)">
57 <template v-slot:footer> 57 <template v-slot:footer>
58 - <uni-easyinput type="digit" v-model="item.thickness" :inputBorder="false" placeholder="请输入厚度" @input="onNonNegativeInput(idx, 'thickness')" @blur="onNonNegativeBlur(idx, 'thickness', 2)" /> 58 + <uni-easyinput type="digit" v-model="item.thickness" :inputBorder="false" placeholder="请输入厚度" @input="onNonNegativeInput(idx, 'thickness')" @blur="onNonNegativeBlur(idx, 'thickness', 9)" />
59 </template> 59 </template>
60 </uni-list-item> 60 </uni-list-item>
61 <uni-list-item title="厚度公差上限(mm)"> 61 <uni-list-item title="厚度公差上限(mm)">
62 <template v-slot:footer> 62 <template v-slot:footer>
63 <uni-easyinput type="digit" v-model="item.thicknessTolPos" :inputBorder="false" 63 <uni-easyinput type="digit" v-model="item.thicknessTolPos" :inputBorder="false"
64 - placeholder="请输入厚度公差上限" @input="onNonNegativeInput(idx, 'thicknessTolPos')" @blur="onNonNegativeBlur(idx, 'thicknessTolPos', 2)" /> 64 + placeholder="请输入厚度公差上限" @input="onNonNegativeInput(idx, 'thicknessTolPos')" @blur="onNonNegativeBlur(idx, 'thicknessTolPos', 9)" />
65 </template> 65 </template>
66 </uni-list-item> 66 </uni-list-item>
67 <uni-list-item title="厚度公差下限(mm)"> 67 <uni-list-item title="厚度公差下限(mm)">
68 <template v-slot:footer> 68 <template v-slot:footer>
69 <uni-easyinput type="digit" v-model="item.thicknessTolNeg" :inputBorder="false" 69 <uni-easyinput type="digit" v-model="item.thicknessTolNeg" :inputBorder="false"
70 - placeholder="请输入厚度公差下限" @input="onNonNegativeInput(idx, 'thicknessTolNeg')" @blur="onNonNegativeBlur(idx, 'thicknessTolNeg', 2)" /> 70 + placeholder="请输入厚度公差下限" @input="onNonNegativeInput(idx, 'thicknessTolNeg')" @blur="onNonNegativeBlur(idx, 'thicknessTolNeg', 9)" />
71 </template> 71 </template>
72 </uni-list-item> 72 </uni-list-item>
73 <uni-list-item title="宽度(mm)"> 73 <uni-list-item title="宽度(mm)">
74 <template v-slot:footer> 74 <template v-slot:footer>
75 - <uni-easyinput type="digit" v-model="item.width" :inputBorder="false" placeholder="请输入宽度" @input="onNonNegativeInput(idx, 'width')" @blur="onNonNegativeBlur(idx, 'width', 2)" /> 75 + <uni-easyinput type="digit" v-model="item.width" :inputBorder="false" placeholder="请输入宽度" @input="onNonNegativeInput(idx, 'width')" @blur="onNonNegativeBlur(idx, 'width', 9)" />
76 </template> 76 </template>
77 </uni-list-item> 77 </uni-list-item>
78 <uni-list-item title="宽度公差上限(mm)"> 78 <uni-list-item title="宽度公差上限(mm)">
79 <template v-slot:footer> 79 <template v-slot:footer>
80 - <uni-easyinput type="digit" v-model="item.widthTolPos" :inputBorder="false" placeholder="请输入宽度公差上限" @input="onNonNegativeInput(idx, 'widthTolPos')" @blur="onNonNegativeBlur(idx, 'widthTolPos', 2)" /> 80 + <uni-easyinput type="digit" v-model="item.widthTolPos" :inputBorder="false" placeholder="请输入宽度公差上限" @input="onNonNegativeInput(idx, 'widthTolPos')" @blur="onNonNegativeBlur(idx, 'widthTolPos', 9)" />
81 </template> 81 </template>
82 </uni-list-item> 82 </uni-list-item>
83 <uni-list-item title="宽度公差下限(mm)"> 83 <uni-list-item title="宽度公差下限(mm)">
84 <template v-slot:footer> 84 <template v-slot:footer>
85 - <uni-easyinput type="digit" v-model="item.widthTolNeg" :inputBorder="false" placeholder="请输入宽度公差下限" @input="onNonNegativeInput(idx, 'widthTolNeg')" @blur="onNonNegativeBlur(idx, 'widthTolNeg', 2)" /> 85 + <uni-easyinput type="digit" v-model="item.widthTolNeg" :inputBorder="false" placeholder="请输入宽度公差下限" @input="onNonNegativeInput(idx, 'widthTolNeg')" @blur="onNonNegativeBlur(idx, 'widthTolNeg', 9)" />
86 </template> 86 </template>
87 </uni-list-item> 87 </uni-list-item>
88 <uni-list-item title="长度(mm)"> 88 <uni-list-item title="长度(mm)">
89 <template v-slot:footer> 89 <template v-slot:footer>
90 - <uni-easyinput type="digit" v-model="item.length" :inputBorder="false" placeholder="请输入长度" @input="onNonNegativeInput(idx, 'length')" @blur="onNonNegativeBlur(idx, 'length', 2)" /> 90 + <uni-easyinput type="digit" v-model="item.length" :inputBorder="false" placeholder="请输入长度" @input="onNonNegativeInput(idx, 'length')" @blur="onNonNegativeBlur(idx, 'length', 9)" />
91 </template> 91 </template>
92 </uni-list-item> 92 </uni-list-item>
93 <uni-list-item title="长度公差上限(mm)"> 93 <uni-list-item title="长度公差上限(mm)">
94 <template v-slot:footer> 94 <template v-slot:footer>
95 <uni-easyinput type="digit" v-model="item.lengthTolPos" :inputBorder="false" 95 <uni-easyinput type="digit" v-model="item.lengthTolPos" :inputBorder="false"
96 - placeholder="请输入长度公差上限" @input="onNonNegativeInput(idx, 'lengthTolPos')" @blur="onNonNegativeBlur(idx, 'lengthTolPos', 2)" /> 96 + placeholder="请输入长度公差上限" @input="onNonNegativeInput(idx, 'lengthTolPos')" @blur="onNonNegativeBlur(idx, 'lengthTolPos', 9)" />
97 </template> 97 </template>
98 </uni-list-item> 98 </uni-list-item>
99 <uni-list-item title="长度公差下限(mm)"> 99 <uni-list-item title="长度公差下限(mm)">
100 <template v-slot:footer> 100 <template v-slot:footer>
101 <uni-easyinput type="digit" v-model="item.lengthTolNeg" :inputBorder="false" 101 <uni-easyinput type="digit" v-model="item.lengthTolNeg" :inputBorder="false"
102 - placeholder="请输入长度公差下限" @input="onNonNegativeInput(idx, 'lengthTolNeg')" @blur="onNonNegativeBlur(idx, 'lengthTolNeg', 2)" /> 102 + placeholder="请输入长度公差下限" @input="onNonNegativeInput(idx, 'lengthTolNeg')" @blur="onNonNegativeBlur(idx, 'lengthTolNeg', 9)" />
103 </template> 103 </template>
104 </uni-list-item> 104 </uni-list-item>
105 <uni-list-item title="状态"> 105 <uni-list-item title="状态">
@@ -109,12 +109,12 @@ @@ -109,12 +109,12 @@
109 </uni-list-item> 109 </uni-list-item>
110 <uni-list-item title="数量"> 110 <uni-list-item title="数量">
111 <template v-slot:footer> 111 <template v-slot:footer>
112 - <uni-easyinput v-model="item.quantity" type="digit" :inputBorder="false" placeholder="请输入数量kg" @input="onNonNegativeInput(idx, 'quantity')" @blur="onNonNegativeBlur(idx, 'quantity', 2)" /> 112 + <uni-easyinput v-model="item.quantity" type="digit" :inputBorder="false" placeholder="请输入数量kg" @input="onNonNegativeInput(idx, 'quantity')" @blur="onNonNegativeBlur(idx, 'quantity', 9)" />
113 </template> 113 </template>
114 </uni-list-item> 114 </uni-list-item>
115 <uni-list-item title="单价"> 115 <uni-list-item title="单价">
116 <template v-slot:footer> 116 <template v-slot:footer>
117 - <uni-easyinput v-model="item.unitPrice" type="digit" :inputBorder="false" placeholder="请输入销售价格" @input="onNonNegativeInput(idx, 'unitPrice')" @blur="onNonNegativeBlur(idx, 'unitPrice', 2)" /> 117 + <uni-easyinput v-model="item.unitPrice" type="digit" :inputBorder="false" placeholder="请输入销售价格" @input="onNonNegativeInput(idx, 'unitPrice')" @blur="onNonNegativeBlur(idx, 'unitPrice', 9)" />
118 </template> 118 </template>
119 </uni-list-item> 119 </uni-list-item>
120 <uni-list-item title="外贸加工费"> 120 <uni-list-item title="外贸加工费">
@@ -286,6 +286,73 @@ export default { @@ -286,6 +286,73 @@ export default {
286 const m = Math.pow(10, digits) 286 const m = Math.pow(10, digits)
287 return Math.round(n * m) / m 287 return Math.round(n * m) / m
288 }, 288 },
  289 + onNumberInput(idx, field) {
  290 + const it = this.items[idx]
  291 + if (!it) return
  292 + // 允许负号和小数点
  293 + let v = String(it[field] != null ? it[field] : '')
  294 + // 先只保留数字、小数点、负号
  295 + v = v.replace(/[^0-9.-]/g, '')
  296 + // 处理负号:只有第一个位置可以是负号,如果后面出现负号则移除
  297 + if (v.lastIndexOf('-') > 0) {
  298 + const hasMinusAtStart = v.startsWith('-')
  299 + v = v.replace(/-/g, '')
  300 + if (hasMinusAtStart) v = '-' + v
  301 + }
  302 + // 处理小数点:只保留第一个小数点
  303 + if ((v.match(/\./g) || []).length > 1) {
  304 + const firstDotIndex = v.indexOf('.')
  305 + v = v.substring(0, firstDotIndex + 1) + v.substring(firstDotIndex + 1).replace(/\./g, '')
  306 + }
  307 + // 处理特殊情况:.5 -> 0.5, -.5 -> -0.5
  308 + if (v.startsWith('.')) v = '0' + v
  309 + if (v.startsWith('-.')) v = '-0' + v.substring(1)
  310 +
  311 + it[field] = v
  312 + this.$set(this.items, idx, it)
  313 + },
  314 + onNumberBlur(idx, field, digits = 2) {
  315 + const it = this.items[idx]
  316 + if (!it) return
  317 + let v = it[field]
  318 + if (v === '' || v === '-' || v === null || v === undefined) {
  319 + // 如果为空或只有一个负号,不处理或置空,看需求,这里保持原值或空
  320 + } else {
  321 + // 转为数字并保留小数位
  322 + const num = Number(v)
  323 + if (!isNaN(num)) {
  324 + it[field] = this.round(num, digits)
  325 + } else {
  326 + it[field] = ''
  327 + }
  328 + }
  329 + this.$set(this.items, idx, it)
  330 + },
  331 + validate() {
  332 + for (let i = 0; i < this.items.length; i++) {
  333 + const it = this.items[i]
  334 + const check = (pos, neg, label) => {
  335 + // 只有当上限和下限都有值时才校验
  336 + if (pos !== '' && pos !== null && pos !== undefined &&
  337 + neg !== '' && neg !== null && neg !== undefined) {
  338 + if (Number(pos) <= Number(neg)) {
  339 + return `第${i + 1}行产品:${label}公差上限必须大于下限`
  340 + }
  341 + }
  342 + return null
  343 + }
  344 +
  345 + let err = check(it.thicknessTolPos, it.thicknessTolNeg, '厚度')
  346 + if (err) { uni.showToast({ title: err, icon: 'none' }); return false }
  347 +
  348 + err = check(it.widthTolPos, it.widthTolNeg, '宽度')
  349 + if (err) { uni.showToast({ title: err, icon: 'none' }); return false }
  350 +
  351 + err = check(it.lengthTolPos, it.lengthTolNeg, '长度')
  352 + if (err) { uni.showToast({ title: err, icon: 'none' }); return false }
  353 + }
  354 + return true
  355 + },
289 onNonNegativeBlur(idx, field, digits) { 356 onNonNegativeBlur(idx, field, digits) {
290 const it = this.items[idx] 357 const it = this.items[idx]
291 if (!it) return 358 if (!it) return
@@ -36,7 +36,7 @@ @@ -36,7 +36,7 @@
36 </template> 36 </template>
37 </uni-list-item> 37 </uni-list-item>
38 38
39 - <uni-list-item title="授截止日期"> 39 + <uni-list-item title="授截止日期">
40 <template v-slot:footer> 40 <template v-slot:footer>
41 <uni-datetime-picker type="date" v-model="form.validityTime" /> 41 <uni-datetime-picker type="date" v-model="form.validityTime" />
42 </template> 42 </template>
@@ -211,7 +211,7 @@ export default { @@ -211,7 +211,7 @@ export default {
211 { key: 'company', label: '所属单位' }, 211 { key: 'company', label: '所属单位' },
212 { key: 'materialTypeId', label: '品种' }, 212 { key: 'materialTypeId', label: '品种' },
213 { key: 'hasFrameworkAgreement', label: '是否签订框架合同' }, 213 { key: 'hasFrameworkAgreement', label: '是否签订框架合同' },
214 - { key: 'validityTime', label: '授截止日期' } 214 + { key: 'validityTime', label: '授截止日期' }
215 ] 215 ]
216 for (const it of checks) { 216 for (const it of checks) {
217 const val = this.form[it.key] 217 const val = this.form[it.key]
@@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
9 <view class="row"><text class="label">品种</text><text class="value">{{ form.materialTypeName }}</text></view> 9 <view class="row"><text class="label">品种</text><text class="value">{{ form.materialTypeName }}</text></view>
10 <view class="row"><text class="label">是否签订</text><text class="value">{{ form.hasFrameworkAgreementName 10 <view class="row"><text class="label">是否签订</text><text class="value">{{ form.hasFrameworkAgreementName
11 }}</text></view> 11 }}</text></view>
12 - <view class="row"><text class="label">授截止日期</text><text class="value">{{ form.validityTime }}</text></view> 12 + <view class="row"><text class="label">授截止日期</text><text class="value">{{ form.validityTime }}</text></view>
13 </view> 13 </view>
14 </view> 14 </view>
15 </scroll-view> 15 </scroll-view>
@@ -317,11 +317,11 @@ export default { @@ -317,11 +317,11 @@ export default {
317 } 317 }
318 318
319 text { 319 text {
320 - width: 60%; 320 + width: 50%;
321 321
322 &:last-child { 322 &:last-child {
323 color: rgba(0, 0, 0, 0.9); 323 color: rgba(0, 0, 0, 0.9);
324 - width: 40%; 324 + width: 50%;
325 } 325 }
326 } 326 }
327 } 327 }
@@ -36,7 +36,7 @@ @@ -36,7 +36,7 @@
36 </template> 36 </template>
37 </uni-list-item> 37 </uni-list-item>
38 38
39 - <uni-list-item title="授截止日期"> 39 + <uni-list-item title="授截止日期">
40 <template v-slot:footer> 40 <template v-slot:footer>
41 <uni-datetime-picker type="date" v-model="form.validityTime" /> 41 <uni-datetime-picker type="date" v-model="form.validityTime" />
42 </template> 42 </template>
@@ -160,7 +160,7 @@ export default { @@ -160,7 +160,7 @@ export default {
160 { key: 'company', label: '所属单位' }, 160 { key: 'company', label: '所属单位' },
161 { key: 'materialTypeId', label: '品种' }, 161 { key: 'materialTypeId', label: '品种' },
162 { key: 'hasFrameworkAgreement', label: '是否签订框架合同' }, 162 { key: 'hasFrameworkAgreement', label: '是否签订框架合同' },
163 - { key: 'validityTime', label: '授截止日期' } 163 + { key: 'validityTime', label: '授截止日期' }
164 ] 164 ]
165 for (const it of checks) { 165 for (const it of checks) {
166 const val = this.form[it.key] 166 const val = this.form[it.key]
@@ -21,6 +21,12 @@ @@ -21,6 +21,12 @@
21 <view class="item-title"><text class="required">*</text><text>定作方</text></view> 21 <view class="item-title"><text class="required">*</text><text>定作方</text></view>
22 </template> 22 </template>
23 </uni-list-item> 23 </uni-list-item>
  24 + <uni-list-item class="select-item" :class="form.stockUpCompanyId ? 'is-filled' : 'is-empty'" clickable
  25 + @click="openRelate('stockUpCompanyId')" :rightText="form.stockUpCompanyName || '请选择备货单位'" showArrow>
  26 + <template v-slot:body>
  27 + <view class="item-title"><text class="required">*</text><text>备货单位/人(生产标准)</text></view>
  28 + </template>
  29 + </uni-list-item>
24 30
25 <uni-list-item title="订货日期"> 31 <uni-list-item title="订货日期">
26 <template v-slot:footer> 32 <template v-slot:footer>
@@ -39,7 +45,23 @@ @@ -39,7 +45,23 @@
39 <view class="item-title"><text class="required">*</text><text>生产厂</text></view> 45 <view class="item-title"><text class="required">*</text><text>生产厂</text></view>
40 </template> 46 </template>
41 </uni-list-item> 47 </uni-list-item>
42 - <ProductRel mode="add" :deliveryDateBase="form.deliveryDate" :deliveryDate="form.orderDate" @change="onProductsChange" :options="productList" :rawToProdRatioList="rawToProdRatioList" /> 48 + <uni-list-item class="select-item" :class="form.deptName ? 'is-filled' : 'is-empty'">
  49 + <template v-slot:body>
  50 + <view class="item-title"><text class="required">*</text><text>办事处</text></view>
  51 + </template>
  52 + <template v-slot:footer>
  53 + <view class="serial-number-row">
  54 + <uni-easyinput v-model="form.deptName" :inputBorder="false" disabled />
  55 + </view>
  56 + </template>
  57 + </uni-list-item>
  58 + <uni-list-item class="select-item" :class="form.region ? 'is-filled' : 'is-empty'" clickable
  59 + @click="openSheet('region')" :rightText="displayLabel('regionName')" showArrow>
  60 + <template v-slot:body>
  61 + <view class="item-title"><text class="required">*</text><text>区域</text></view>
  62 + </template>
  63 + </uni-list-item>
  64 + <ProductRel ref="productRel" mode="add" :deliveryDateBase="form.deliveryDate" :deliveryDate="form.orderDate" @change="onProductsChange" :options="productList" :rawToProdRatioList="rawToProdRatioList" />
43 <uni-list-item title="合计人民币金额(大写)"> 65 <uni-list-item title="合计人民币金额(大写)">
44 <template v-slot:footer> 66 <template v-slot:footer>
45 <uni-easyinput v-model="form.totalAmountCapital" placeholder="自动计算" :inputBorder="false" disabled /> 67 <uni-easyinput v-model="form.totalAmountCapital" placeholder="自动计算" :inputBorder="false" disabled />
@@ -123,7 +145,7 @@ @@ -123,7 +145,7 @@
123 </uni-list-item> 145 </uni-list-item>
124 <uni-list-item title="备注"> 146 <uni-list-item title="备注">
125 <template v-slot:footer> 147 <template v-slot:footer>
126 - <uni-easyinput type="textarea" v-model="form.remarks" placeholder="请输入备注" :inputBorder="false" /> 148 + <uni-easyinput type="textarea" v-model="form.remarks" placeholder="请输入备注" :inputBorder="false" maxlength="2000" />
127 </template> 149 </template>
128 </uni-list-item> 150 </uni-list-item>
129 <view class="quality"> 151 <view class="quality">
@@ -208,10 +230,11 @@ import SingleSelectSheet from '@/components/single-select/index.vue' @@ -208,10 +230,11 @@ import SingleSelectSheet from '@/components/single-select/index.vue'
208 import RelateSelectSheet from '@/components/relate-select/index.vue' 230 import RelateSelectSheet from '@/components/relate-select/index.vue'
209 import ProductRel from './productRel.vue' 231 import ProductRel from './productRel.vue'
210 import CitySelector from '@/components/city-selector/index.vue' 232 import CitySelector from '@/components/city-selector/index.vue'
211 -import { getRetailCodeApi, createContractApi, getCustomerRemarks,getCustomerSpecificQualityRequirements } from '@/api/contract' 233 +import { getRetailCodeApi, createContractApi, getCustomerRemarks,getCustomerSpecificQualityRequirements, getDeptApi } from '@/api/contract'
212 import { getDicByCodes } from '@/utils/dic' 234 import { getDicByCodes } from '@/utils/dic'
213 import { formatCurrencyToChinese } from '@/utils/common' 235 import { formatCurrencyToChinese } from '@/utils/common'
214 import { workshopQueryApi } from '@/api/devManage' 236 import { workshopQueryApi } from '@/api/devManage'
  237 +import { getArea } from '@/api/credit_manage.js'
215 238
216 export default { 239 export default {
217 name: 'AddContractProcess', 240 name: 'AddContractProcess',
@@ -224,6 +247,8 @@ export default { @@ -224,6 +247,8 @@ export default {
224 supplierName: '', 247 supplierName: '',
225 buyer: '', 248 buyer: '',
226 buyerName: '', 249 buyerName: '',
  250 + stockUpCompanyId: '',
  251 + stockUpCompanyName: '',
227 orderDate: '', 252 orderDate: '',
228 deliveryDate: '', 253 deliveryDate: '',
229 designatedConsignee: '', 254 designatedConsignee: '',
@@ -233,15 +258,19 @@ export default { @@ -233,15 +258,19 @@ export default {
233 executionStandardName: '', 258 executionStandardName: '',
234 executionStandardRemarks: '', 259 executionStandardRemarks: '',
235 includesPackagingFee: false, 260 includesPackagingFee: false,
236 - includesPackagingFeeName: '', 261 + includesPackagingFeeName: '',
237 includesTransportFee: false, 262 includesTransportFee: false,
238 - includesTransportFeeName: '', 263 + includesTransportFeeName: '',
239 unit: '元、公斤、元/公斤', 264 unit: '元、公斤、元/公斤',
240 totalAmountCapital: '', 265 totalAmountCapital: '',
241 destinationId: [], 266 destinationId: [],
242 destinationLabel: '', 267 destinationLabel: '',
243 workshopIdName: '', 268 workshopIdName: '',
244 workshopId: '', 269 workshopId: '',
  270 + deptName: '',
  271 + deptId: '',
  272 + region: '',
  273 + regionName: '',
245 remarks: '', 274 remarks: '',
246 component: '', 275 component: '',
247 packaging: '', 276 packaging: '',
@@ -261,15 +290,18 @@ export default { @@ -261,15 +290,18 @@ export default {
261 totalAmountIncludingTax: 0, 290 totalAmountIncludingTax: 0,
262 productLineList: [], 291 productLineList: [],
263 productList: [], 292 productList: [],
264 - rawToProdRatioList: [],  
265 customerRemarks: [], 293 customerRemarks: [],
266 defaultRemark: '', 294 defaultRemark: '',
  295 + regionOptions: [],
  296 + rawToProdRatioList: [],
267 } 297 }
268 }, 298 },
269 created() { 299 created() {
270 this.loadSuppliers() 300 this.loadSuppliers()
271 this.loadExtraOptions() 301 this.loadExtraOptions()
272 this.initCode() 302 this.initCode()
  303 + this.getDept()
  304 + this.loadRegionOptions()
273 this.form.orderDate = this.formatDate(new Date()) 305 this.form.orderDate = this.formatDate(new Date())
274 this.$nextTick(() => { 306 this.$nextTick(() => {
275 if (Array.isArray(this.form.destinationId) && this.form.destinationId.length) { 307 if (Array.isArray(this.form.destinationId) && this.form.destinationId.length) {
@@ -318,6 +350,24 @@ export default { @@ -318,6 +350,24 @@ export default {
318 }, 350 },
319 }, 351 },
320 methods: { 352 methods: {
  353 + async loadRegionOptions() {
  354 + try {
  355 + const res = await getArea()
  356 + const list = res.data || []
  357 + this.regionOptions = (list || []).map(it => ({ label: it.name || '', value: it.id || '' }))
  358 + } catch (e) {
  359 + this.regionOptions = []
  360 + }
  361 + },
  362 + // 查询当前人所在办事处
  363 + getDept() {
  364 + getDeptApi().then(res => {
  365 + if (res.code === 200) {
  366 + this.form.deptName = res.data.name || ''
  367 + this.form.deptId = res.data.id || ''
  368 + }
  369 + })
  370 + },
321 getHistory() { 371 getHistory() {
322 console.log('this.productLineList', this.productLineList[0].rawProductId) 372 console.log('this.productLineList', this.productLineList[0].rawProductId)
323 if (!this.productLineList.length || !this.productLineList[0].rawProductId) { 373 if (!this.productLineList.length || !this.productLineList[0].rawProductId) {
@@ -408,7 +458,7 @@ export default { @@ -408,7 +458,7 @@ export default {
408 }, 458 },
409 displayLabel(field) { 459 displayLabel(field) {
410 const m = this.form 460 const m = this.form
411 - const map = { supplierName: '请选择承揽方', buyerName: '请选择定作方', workshopIdName: '请选择生产厂' } 461 + const map = { supplierName: '请选择承揽方', buyerName: '请选择定作方', workshopIdName: '请选择生产厂', regionName: '请选择区域' }
412 const val = m[field] 462 const val = m[field]
413 return val ? String(val) : map[field] 463 return val ? String(val) : map[field]
414 }, 464 },
@@ -453,6 +503,8 @@ export default { @@ -453,6 +503,8 @@ export default {
453 setSheet('单价中是否已包含运费', this.yesNoList) 503 setSheet('单价中是否已包含运费', this.yesNoList)
454 } else if (field === 'historyRemarks') { 504 } else if (field === 'historyRemarks') {
455 setSheet('历史备注', this.customerRemarks) 505 setSheet('历史备注', this.customerRemarks)
  506 + }else if (field === 'region') {
  507 + setSheet('区域', this.regionOptions)
456 } 508 }
457 }, 509 },
458 onSheetConfirm({ value, label }) { 510 onSheetConfirm({ value, label }) {
@@ -471,6 +523,8 @@ export default { @@ -471,6 +523,8 @@ export default {
471 let config = {} 523 let config = {}
472 if (fieldKey === 'buyer') { 524 if (fieldKey === 'buyer') {
473 config = { title: '定作方', source: 'customer', rowKey: 'id', multiple: false, display: [{ label: '姓名', field: 'name' }, { label: '编号', field: 'code' }, { label: '状态', field: 'available', format: v => (v ? '启用' : '停用') }] } 525 config = { title: '定作方', source: 'customer', rowKey: 'id', multiple: false, display: [{ label: '姓名', field: 'name' }, { label: '编号', field: 'code' }, { label: '状态', field: 'available', format: v => (v ? '启用' : '停用') }] }
  526 + } else if (fieldKey === 'stockUpCompanyId') {
  527 + config = { title: '备货单位/人(生产标准)', source: 'customer', rowKey: 'id', multiple: false, display: [{ label: '姓名', field: 'name' }, { label: '编号', field: 'code' }, { label: '状态', field: 'available', format: v => (v ? '启用' : '停用') }] }
474 } 528 }
475 const selectedKeys = this.form[fieldKey] ? [this.form[fieldKey]] : [] 529 const selectedKeys = this.form[fieldKey] ? [this.form[fieldKey]] : []
476 this.sheet.visible = false 530 this.sheet.visible = false
@@ -481,7 +535,17 @@ export default { @@ -481,7 +535,17 @@ export default {
481 const _fieldKey = this.relate.fieldKey 535 const _fieldKey = this.relate.fieldKey
482 const first = (items && items.length > 0) ? items[0] : null 536 const first = (items && items.length > 0) ? items[0] : null
483 this.form[_fieldKey] = (first && first.id) ? first.id : '' 537 this.form[_fieldKey] = (first && first.id) ? first.id : ''
484 - this.form[_fieldKey + 'Name'] = (first && first.name) ? first.name : '' 538 +
  539 + if (_fieldKey === 'stockUpCompanyId') {
  540 + this.form.stockUpCompanyName = (first && first.name) ? first.name : ''
  541 + } else {
  542 + this.form[_fieldKey + 'Name'] = (first && first.name) ? first.name : ''
  543 + }
  544 +
  545 + if (_fieldKey === 'buyer') {
  546 + this.form.stockUpCompanyId = (first && first.id) ? first.id : ''
  547 + this.form.stockUpCompanyName = (first && first.name) ? first.name : ''
  548 + }
485 }, 549 },
486 onRadioSelect(field, nameField, opt) { 550 onRadioSelect(field, nameField, opt) {
487 const val = opt && opt.value != null ? opt.value : '' 551 const val = opt && opt.value != null ? opt.value : ''
@@ -542,9 +606,11 @@ export default { @@ -542,9 +606,11 @@ export default {
542 { key: 'code', label: '编号' }, 606 { key: 'code', label: '编号' },
543 { key: 'supplier', label: '承揽方' }, 607 { key: 'supplier', label: '承揽方' },
544 { key: 'buyer', label: '定作方' }, 608 { key: 'buyer', label: '定作方' },
  609 + { key: 'stockUpCompanyId', label: '备货单位/人(生产标准)' },
545 { key: 'orderDate', label: '订货日期' }, 610 { key: 'orderDate', label: '订货日期' },
546 - { key: 'workshopId', label: '生产厂' },  
547 { key: 'unit', label: '单位' }, 611 { key: 'unit', label: '单位' },
  612 + { key: 'workshopId', label: '生产厂' },
  613 + { key: 'region', label: '区域' },
548 { key: 'specialTerms', label: '特别条款要求' }, 614 { key: 'specialTerms', label: '特别条款要求' },
549 ] 615 ]
550 for (const it of checks) { 616 for (const it of checks) {
@@ -552,6 +618,7 @@ export default { @@ -552,6 +618,7 @@ export default {
552 const empty = (val === undefined || val === null || (typeof val === 'string' && val.trim() === '') || (typeof val === 'number' && isNaN(val))) 618 const empty = (val === undefined || val === null || (typeof val === 'string' && val.trim() === '') || (typeof val === 'number' && isNaN(val)))
553 if (empty) { uni.showToast({ title: `请先选择${it.label}`, icon: 'none' }); return false } 619 if (empty) { uni.showToast({ title: `请先选择${it.label}`, icon: 'none' }); return false }
554 } 620 }
  621 + if (this.$refs.productRel && !this.$refs.productRel.validate()) return false
555 const list = Array.isArray(this.productLineList) ? this.productLineList : [] 622 const list = Array.isArray(this.productLineList) ? this.productLineList : []
556 if (list.length === 0) { 623 if (list.length === 0) {
557 uni.showToast({ title: '请至少添加一条产品明细', icon: 'none' }); return false 624 uni.showToast({ title: '请至少添加一条产品明细', icon: 'none' }); return false
@@ -5,15 +5,22 @@ statusStyl<template> @@ -5,15 +5,22 @@ statusStyl<template>
5 <view class="section"> 5 <view class="section">
6 <text class="row customer">{{ detail.code }}</text> 6 <text class="row customer">{{ detail.code }}</text>
7 <view class="row" v-if="status === 'STANDARD'"><text class="label">正式合同规范性审核</text><text class="value"><span class="info-status" :style="detail.standardApprovedName ? getStatusCss(detail.standardApprovedName) : ''" >{{ detail.standardApprovedName || '-' }}</span></text></view> 7 <view class="row" v-if="status === 'STANDARD'"><text class="label">正式合同规范性审核</text><text class="value"><span class="info-status" :style="detail.standardApprovedName ? getStatusCss(detail.standardApprovedName) : ''" >{{ detail.standardApprovedName || '-' }}</span></text></view>
  8 + <view v-if="detail.status === 'STANDARD'" :class="['status', `status_${detail.shippingStatusName}`]" />
8 <view class="row"><text class="label">承揽方</text><text class="value">{{ detail.supplierName || '-' 9 <view class="row"><text class="label">承揽方</text><text class="value">{{ detail.supplierName || '-'
9 }}</text></view> 10 }}</text></view>
10 <view class="row"><text class="label">定作方</text><text class="value">{{ detail.buyerName || '-' 11 <view class="row"><text class="label">定作方</text><text class="value">{{ detail.buyerName || '-'
11 }}</text></view> 12 }}</text></view>
  13 + <view class="row"><text class="label">备货单位/人(生产标准)</text><text class="value">{{ detail.stockUpCompanyName || '-'
  14 + }}</text></view>
12 <view class="row"><text class="label">订货日期</text><text class="value">{{ detail.orderDate }}</text> 15 <view class="row"><text class="label">订货日期</text><text class="value">{{ detail.orderDate }}</text>
13 </view> 16 </view>
14 <view class="row"><text class="label">单位</text><text class="value">{{ detail.unit }}</text></view> 17 <view class="row"><text class="label">单位</text><text class="value">{{ detail.unit }}</text></view>
15 <view class="row"><text class="label">生产厂</text><text class="value">{{ detail.workshopName || '-' 18 <view class="row"><text class="label">生产厂</text><text class="value">{{ detail.workshopName || '-'
16 - }}</text></view> 19 + }}</text></view>
  20 + <view class="row"><text class="label">办事处</text><text class="value">{{ detail.deptName || '-'
  21 + }}</text></view>
  22 + <view class="row"><text class="label">区域</text><text class="value">{{ detail.regionName || '-'
  23 + }}</text></view>
17 </view> 24 </view>
18 25
19 <view class="section1"> 26 <view class="section1">
@@ -104,12 +111,12 @@ statusStyl<template> @@ -104,12 +111,12 @@ statusStyl<template>
104 </template> 111 </template>
105 112
106 <script> 113 <script>
107 -import { getContractApi, deleteContractApi, uploadStandardContract, statusStyle } from '@/api/contract' 114 +import { getContractApi, deleteContractApi, uploadStandardContract, statusStyle, statusMap } from '@/api/contract'
108 import ProductRel from './productRel.vue' 115 import ProductRel from './productRel.vue'
109 import DetailButtons from '@/components/detail-buttons/index.vue' 116 import DetailButtons from '@/components/detail-buttons/index.vue'
110 import FileUpload from '@/components/file-upload/index.vue' 117 import FileUpload from '@/components/file-upload/index.vue'
111 import SingleSelectSheet from '@/components/single-select/index.vue' 118 import SingleSelectSheet from '@/components/single-select/index.vue'
112 - 119 +import { fillStandardApprovedName } from '@/utils/dic.js'
113 120
114 export default { 121 export default {
115 name: 'ContractProcessDetail', 122 name: 'ContractProcessDetail',
@@ -129,10 +136,15 @@ export default { @@ -129,10 +136,15 @@ export default {
129 supplierName: '', 136 supplierName: '',
130 buyer: '', 137 buyer: '',
131 buyerName: '', 138 buyerName: '',
  139 + stockUpCompanyId: '',
  140 + stockUpCompanyName: '',
132 orderDate: '', 141 orderDate: '',
133 unit: '', 142 unit: '',
134 workshopId: '', 143 workshopId: '',
135 workshopName: '', 144 workshopName: '',
  145 + deptName: '',
  146 + region: '',
  147 + regionName: '',
136 designatedConsignee: '', 148 designatedConsignee: '',
137 specialTerms: '', 149 specialTerms: '',
138 specialTermsName: '', 150 specialTermsName: '',
@@ -161,6 +173,7 @@ export default { @@ -161,6 +173,7 @@ export default {
161 }, 173 },
162 productList: [], 174 productList: [],
163 statusStyle: statusStyle, 175 statusStyle: statusStyle,
  176 + statusMap: statusMap,
164 buttons: [{ 177 buttons: [{
165 text: '编辑', 178 text: '编辑',
166 visible: true, 179 visible: true,
@@ -192,7 +205,6 @@ export default { @@ -192,7 +205,6 @@ export default {
192 { 205 {
193 text: '审核详情', 206 text: '审核详情',
194 visible: true, 207 visible: true,
195 - variant: 'primary',  
196 event: 'auditDetail' 208 event: 'auditDetail'
197 }, 209 },
198 ], 210 ],
@@ -352,13 +364,17 @@ export default { @@ -352,13 +364,17 @@ export default {
352 const data = res && res.data ? res.data : {} 364 const data = res && res.data ? res.data : {}
353 const includesPackagingFeeName = data.includesPackagingFeeName || (data.includesPackagingFee ? '是' : '否') 365 const includesPackagingFeeName = data.includesPackagingFeeName || (data.includesPackagingFee ? '是' : '否')
354 const includesTransportFeeName = data.includesTransportFeeName || (data.includesTransportFee ? '是' : '否') 366 const includesTransportFeeName = data.includesTransportFeeName || (data.includesTransportFee ? '是' : '否')
355 - this.detail = {  
356 - ...this.detail,  
357 - ...data, 367 + this.detail = {
  368 + ...this.detail,
  369 + ...data,
  370 + stockUpCompanyName: data.stockUpCompanyName || '',
  371 + regionName: data.regionName || '',
  372 + deptName: data.deptName || '',
358 includesPackagingFeeName, includesTransportFeeName, 373 includesPackagingFeeName, includesTransportFeeName,
359 destinationId: data.provinceId && data.cityId && data.districtId ? [data.provinceId, data.cityId, data.districtId] : '', 374 destinationId: data.provinceId && data.cityId && data.districtId ? [data.provinceId, data.cityId, data.districtId] : '',
360 destinationLabel: data.provinceName && data.cityName && data.districtName ? `${data.provinceName} / ${data.cityName} / ${data.districtName}` : '', 375 destinationLabel: data.provinceName && data.cityName && data.districtName ? `${data.provinceName} / ${data.cityName} / ${data.districtName}` : '',
361 } 376 }
  377 + this.detail = await fillStandardApprovedName(this.detail)
362 const lines = Array.isArray(data.contractStdProcessingLineList) ? data.contractStdProcessingLineList : [] 378 const lines = Array.isArray(data.contractStdProcessingLineList) ? data.contractStdProcessingLineList : []
363 this.productList = lines 379 this.productList = lines
364 } catch (e) { 380 } catch (e) {
@@ -396,6 +412,32 @@ export default { @@ -396,6 +412,32 @@ export default {
396 padding: 32rpx; 412 padding: 32rpx;
397 background: #fff; 413 background: #fff;
398 margin-bottom: 20rpx; 414 margin-bottom: 20rpx;
  415 + .status {
  416 + position: absolute;
  417 + top: 16rpx;
  418 + right: 52rpx;
  419 + width: 180rpx;
  420 + height: 146rpx;
  421 + background-repeat: no-repeat;
  422 + background-size: 100% 100%;
  423 + background-position: center;
  424 +
  425 + &_审批中 {
  426 + background-image: url('~@/static/images/contract/status_1.png');
  427 + }
  428 +
  429 + &_生产中 {
  430 + background-image: url('~@/static/images/contract/status_2.png');
  431 + }
  432 +
  433 + &_已发货 {
  434 + background-image: url('~@/static/images/contract/status_3.png');
  435 + }
  436 +
  437 + &_已签收 {
  438 + background-image: url('~@/static/images/contract/status_4.png');
  439 + }
  440 + }
399 } 441 }
400 .section1 { 442 .section1 {
401 background: #fff; 443 background: #fff;
@@ -61,7 +61,7 @@ @@ -61,7 +61,7 @@
61 <text>订单总额</text><text class="amount" :style="{ color: '#b67a76' }">{{ item.totalAmountIncludingTax ? '¥' : '' }}{{ formatAmount(item.totalAmountIncludingTax) || '-' }}</text> 61 <text>订单总额</text><text class="amount" :style="{ color: '#b67a76' }">{{ item.totalAmountIncludingTax ? '¥' : '' }}{{ formatAmount(item.totalAmountIncludingTax) || '-' }}</text>
62 </view> 62 </view>
63 <view class="info-row" v-if="item.status === 'STANDARD'"> 63 <view class="info-row" v-if="item.status === 'STANDARD'">
64 - <text>正式合同规范性审核状态</text><span class="info-status" :style="item.standardApprovedName ? getStatusCss(item.standardApprovedName) : ''">{{ item.standardApprovedName || '-' }}</span> 64 + <text>标准合同规范性审核状态</text><span class="info-status" :style="item.standardApprovedName ? getStatusCss(item.standardApprovedName) : ''">{{ item.standardApprovedName || '-' }}</span>
65 </view> 65 </view>
66 <view class="info-row"> 66 <view class="info-row">
67 <text>订货日期</text><text>{{ item.orderDate }}</text> 67 <text>订货日期</text><text>{{ item.orderDate }}</text>
@@ -103,12 +103,6 @@ export default { @@ -103,12 +103,6 @@ export default {
103 return { 103 return {
104 searchKeyword: '', 104 searchKeyword: '',
105 searchKeywordDebounced: '', 105 searchKeywordDebounced: '',
106 -  
107 - tabs: [  
108 - { label: '草稿合同', value: 'DRAFT' },  
109 - { label: '标准合同', value: 'STANDARD' },  
110 - { label: '已删除合同', value: 'DELETED' }  
111 - ],  
112 status: 'DRAFT', 106 status: 'DRAFT',
113 107
114 query: { deptId: '', deptName: '', dateRange: [] }, 108 query: { deptId: '', deptName: '', dateRange: [] },
@@ -126,6 +120,23 @@ export default { @@ -126,6 +120,23 @@ export default {
126 } 120 }
127 }, 121 },
128 computed: { 122 computed: {
  123 + roleCodes() {
  124 + const g = this.$store && this.$store.getters
  125 + return (g && g.roleCodes) || []
  126 + },
  127 + tabs() {
  128 + if (this.roleCodes.includes('constract_admin')) {
  129 + return [
  130 + { label: '草稿合同', value: 'DRAFT' },
  131 + { label: '标准合同', value: 'STANDARD' },
  132 + { label: '已删除合同', value: 'DELETED' }
  133 + ]
  134 + }
  135 + return [
  136 + { label: '草稿合同', value: 'DRAFT' },
  137 + { label: '标准合同', value: 'STANDARD' }
  138 + ]
  139 + },
129 extraCombined() { 140 extraCombined() {
130 return { 141 return {
131 keyword: this.searchKeywordDebounced || undefined, 142 keyword: this.searchKeywordDebounced || undefined,
@@ -359,10 +370,10 @@ export default { @@ -359,10 +370,10 @@ export default {
359 margin-bottom: 0; 370 margin-bottom: 0;
360 } 371 }
361 text { 372 text {
362 - width: 60%; 373 + width: 50%;
363 &:last-child { 374 &:last-child {
364 color: rgba(0,0,0,0.9); 375 color: rgba(0,0,0,0.9);
365 - width: 40%; 376 + width: 50%;
366 } 377 }
367 } 378 }
368 } 379 }
@@ -124,7 +124,7 @@ @@ -124,7 +124,7 @@
124 </uni-list-item> 124 </uni-list-item>
125 <uni-list-item title="备注"> 125 <uni-list-item title="备注">
126 <template v-slot:footer> 126 <template v-slot:footer>
127 - <uni-easyinput v-model="form.remarks" placeholder="请输入备注" :inputBorder="false" /> 127 + <uni-easyinput v-model="form.remarks" placeholder="请输入备注" :inputBorder="false" maxlength="2000" />
128 </template> 128 </template>
129 </uni-list-item> 129 </uni-list-item>
130 130
@@ -199,6 +199,8 @@ import { getContractApi, updateContractApi } from '@/api/contract' @@ -199,6 +199,8 @@ import { getContractApi, updateContractApi } from '@/api/contract'
199 import { getDicByCodes } from '@/utils/dic' 199 import { getDicByCodes } from '@/utils/dic'
200 import { formatCurrencyToChinese } from '@/utils/common' 200 import { formatCurrencyToChinese } from '@/utils/common'
201 import { workshopQueryApi } from '@/api/devManage' 201 import { workshopQueryApi } from '@/api/devManage'
  202 +import { getArea } from '@/api/credit_manage.js'
  203 +
202 export default { 204 export default {
203 name: 'ModifyContractProcess', 205 name: 'ModifyContractProcess',
204 components: { SingleSelectSheet, RelateSelectSheet, ProductRel, CitySelector }, 206 components: { SingleSelectSheet, RelateSelectSheet, ProductRel, CitySelector },
@@ -212,8 +214,14 @@ export default { @@ -212,8 +214,14 @@ export default {
212 supplierName: '', 214 supplierName: '',
213 buyer: '', 215 buyer: '',
214 buyerName: '', 216 buyerName: '',
  217 + stockUpCompanyId: '',
  218 + stockUpCompanyName: '',
215 workshopId: '', 219 workshopId: '',
216 workshopName: '', 220 workshopName: '',
  221 + region: '',
  222 + regionName: '',
  223 + deptName: '',
  224 + deptId: '',
217 orderDate: '', 225 orderDate: '',
218 deliveryDate: '', 226 deliveryDate: '',
219 designatedConsignee: '', 227 designatedConsignee: '',
@@ -223,9 +231,9 @@ export default { @@ -223,9 +231,9 @@ export default {
223 executionStandardName: '', 231 executionStandardName: '',
224 executionStandardRemarks: '', 232 executionStandardRemarks: '',
225 includesPackagingFee: false, 233 includesPackagingFee: false,
226 - includesPackagingFeeName: '', 234 + includesPackagingFeeName: '',
227 includesTransportFee: false, 235 includesTransportFee: false,
228 - includesTransportFeeName: '', 236 + includesTransportFeeName: '',
229 unit: '元、公斤、元/公斤', 237 unit: '元、公斤、元/公斤',
230 totalAmountCapital: '', 238 totalAmountCapital: '',
231 depositInfo: '', 239 depositInfo: '',
@@ -255,6 +263,7 @@ export default { @@ -255,6 +263,7 @@ export default {
255 productLineList: [], 263 productLineList: [],
256 newProductLineList: [], 264 newProductLineList: [],
257 productList: [], 265 productList: [],
  266 + regionOptions: [],
258 rawToProdRatioList: [], 267 rawToProdRatioList: [],
259 } 268 }
260 }, 269 },
@@ -264,6 +273,7 @@ export default { @@ -264,6 +273,7 @@ export default {
264 created() { 273 created() {
265 this.loadSuppliers() 274 this.loadSuppliers()
266 this.loadExtraOptions() 275 this.loadExtraOptions()
  276 + this.loadRegionOptions()
267 this.loadDetail() 277 this.loadDetail()
268 this.$nextTick(() => { 278 this.$nextTick(() => {
269 if (Array.isArray(this.form.destinationId) && this.form.destinationId.length) { 279 if (Array.isArray(this.form.destinationId) && this.form.destinationId.length) {
@@ -272,6 +282,15 @@ export default { @@ -272,6 +282,15 @@ export default {
272 }) 282 })
273 }, 283 },
274 methods: { 284 methods: {
  285 + async loadRegionOptions() {
  286 + try {
  287 + const res = await getArea()
  288 + const list = res.data || []
  289 + this.regionOptions = (list || []).map(it => ({ label: it.name || '', value: it.id || '' }))
  290 + } catch (e) {
  291 + this.regionOptions = []
  292 + }
  293 + },
275 async loadDetail() { 294 async loadDetail() {
276 if (!this.id) return 295 if (!this.id) return
277 try { 296 try {
@@ -288,6 +307,8 @@ export default { @@ -288,6 +307,8 @@ export default {
288 supplierName: m.supplierName || '', 307 supplierName: m.supplierName || '',
289 buyer: m.buyer || (m.customer && m.customer.id) || '', 308 buyer: m.buyer || (m.customer && m.customer.id) || '',
290 buyerName: m.buyerName || (m.customer && m.customer.name) || '', 309 buyerName: m.buyerName || (m.customer && m.customer.name) || '',
  310 + stockUpCompanyId: m.stockUpCompanyId || '',
  311 + stockUpCompanyName: m.stockUpCompanyName || '',
291 orderDate: m.orderDate || '', 312 orderDate: m.orderDate || '',
292 designatedConsignee: m.designatedConsignee || '', 313 designatedConsignee: m.designatedConsignee || '',
293 specialTerms: m.specialTerms || '', 314 specialTerms: m.specialTerms || '',
@@ -317,6 +338,10 @@ export default { @@ -317,6 +338,10 @@ export default {
317 packaging: m.packaging || '', 338 packaging: m.packaging || '',
318 workshopId: m.workshopId || '', 339 workshopId: m.workshopId || '',
319 workshopName: m.workshopName || '', 340 workshopName: m.workshopName || '',
  341 + region: m.region || '',
  342 + regionName: m.regionName || '',
  343 + deptName: m.deptName || '',
  344 + deptId: m.deptId || '',
320 } 345 }
321 const lines = Array.isArray(m.contractStdProcessingLineList) ? m.contractStdProcessingLineList : [] 346 const lines = Array.isArray(m.contractStdProcessingLineList) ? m.contractStdProcessingLineList : []
322 this.productLineList = lines 347 this.productLineList = lines
@@ -453,6 +478,7 @@ export default { @@ -453,6 +478,7 @@ export default {
453 const empty = (val === undefined || val === null || (typeof val === 'string' && val.trim() === '') || (typeof val === 'number' && isNaN(val))) 478 const empty = (val === undefined || val === null || (typeof val === 'string' && val.trim() === '') || (typeof val === 'number' && isNaN(val)))
454 if (empty) { uni.showToast({ title: `请先选择${it.label}`, icon: 'none' }); return false } 479 if (empty) { uni.showToast({ title: `请先选择${it.label}`, icon: 'none' }); return false }
455 } 480 }
  481 + if (this.$refs.productRel && !this.$refs.productRel.validate()) return false
456 const list = Array.isArray(this.newProductLineList) ? this.newProductLineList : [] 482 const list = Array.isArray(this.newProductLineList) ? this.newProductLineList : []
457 if (list.length === 0) { 483 if (list.length === 0) {
458 uni.showToast({ title: '请至少添加一条产品明细', icon: 'none' }); return false 484 uni.showToast({ title: '请至少添加一条产品明细', icon: 'none' }); return false
@@ -87,61 +87,61 @@ @@ -87,61 +87,61 @@
87 87
88 <uni-list-item title="厚度(mm)"> 88 <uni-list-item title="厚度(mm)">
89 <template v-slot:footer> 89 <template v-slot:footer>
90 - <uni-easyinput type="digit" v-model="item.thickness" :inputBorder="false" placeholder="请输入厚度" @input="onNonNegativeInput(idx, 'thickness')" @blur="onNonNegativeBlur(idx, 'thickness', 2)" /> 90 + <uni-easyinput type="digit" v-model="item.thickness" :inputBorder="false" placeholder="请输入厚度" @input="onNonNegativeInput(idx, 'thickness')" @blur="onNonNegativeBlur(idx, 'thickness', 9)" />
91 </template> 91 </template>
92 </uni-list-item> 92 </uni-list-item>
93 <uni-list-item title="厚度公差上限(mm)"> 93 <uni-list-item title="厚度公差上限(mm)">
94 <template v-slot:footer> 94 <template v-slot:footer>
95 - <uni-easyinput type="digit" v-model="item.thicknessTolPos" :inputBorder="false"  
96 - placeholder="请输入厚度公差上限" @input="onNonNegativeInput(idx, 'thicknessTolPos')" @blur="onNonNegativeBlur(idx, 'thicknessTolPos', 2)" /> 95 + <uni-easyinput type="text" v-model="item.thicknessTolPos" :inputBorder="false"
  96 + placeholder="请输入厚度公差上限" @input="onNumberInput(idx, 'thicknessTolPos')" @blur="onNumberBlur(idx, 'thicknessTolPos', 9)" />
97 </template> 97 </template>
98 </uni-list-item> 98 </uni-list-item>
99 <uni-list-item title="厚度公差下限(mm)"> 99 <uni-list-item title="厚度公差下限(mm)">
100 <template v-slot:footer> 100 <template v-slot:footer>
101 - <uni-easyinput type="digit" v-model="item.thicknessTolNeg" :inputBorder="false"  
102 - placeholder="请输入厚度公差下限" @input="onNonNegativeInput(idx, 'thicknessTolNeg')" @blur="onNonNegativeBlur(idx, 'thicknessTolNeg', 2)" /> 101 + <uni-easyinput type="text" v-model="item.thicknessTolNeg" :inputBorder="false"
  102 + placeholder="请输入厚度公差下限" @input="onNumberInput(idx, 'thicknessTolNeg')" @blur="onNumberBlur(idx, 'thicknessTolNeg', 9)" />
103 </template> 103 </template>
104 </uni-list-item> 104 </uni-list-item>
105 <uni-list-item title="宽度(mm)"> 105 <uni-list-item title="宽度(mm)">
106 <template v-slot:footer> 106 <template v-slot:footer>
107 - <uni-easyinput type="digit" v-model="item.width" :inputBorder="false" placeholder="请输入宽度" @input="onNonNegativeInput(idx, 'width')" @blur="onNonNegativeBlur(idx, 'width', 2)" /> 107 + <uni-easyinput type="digit" v-model="item.width" :inputBorder="false" placeholder="请输入宽度" @input="onNonNegativeInput(idx, 'width')" @blur="onNonNegativeBlur(idx, 'width', 9)" />
108 </template> 108 </template>
109 </uni-list-item> 109 </uni-list-item>
110 <uni-list-item title="宽度公差上限(mm)"> 110 <uni-list-item title="宽度公差上限(mm)">
111 <template v-slot:footer> 111 <template v-slot:footer>
112 - <uni-easyinput type="digit" v-model="item.widthTolPos" :inputBorder="false" placeholder="请输入宽度公差上限" @input="onNonNegativeInput(idx, 'widthTolPos')" @blur="onNonNegativeBlur(idx, 'widthTolPos', 2)" /> 112 + <uni-easyinput type="text" v-model="item.widthTolPos" :inputBorder="false" placeholder="请输入宽度公差上限" @input="onNumberInput(idx, 'widthTolPos')" @blur="onNumberBlur(idx, 'widthTolPos', 9)" />
113 </template> 113 </template>
114 </uni-list-item> 114 </uni-list-item>
115 <uni-list-item title="宽度公差下限(mm)"> 115 <uni-list-item title="宽度公差下限(mm)">
116 <template v-slot:footer> 116 <template v-slot:footer>
117 - <uni-easyinput type="digit" v-model="item.widthTolNeg" :inputBorder="false" placeholder="请输入宽度公差下限" @input="onNonNegativeInput(idx, 'widthTolNeg')" @blur="onNonNegativeBlur(idx, 'widthTolNeg', 2)" /> 117 + <uni-easyinput type="text" v-model="item.widthTolNeg" :inputBorder="false" placeholder="请输入宽度公差下限" @input="onNumberInput(idx, 'widthTolNeg')" @blur="onNumberBlur(idx, 'widthTolNeg', 9)" />
118 </template> 118 </template>
119 </uni-list-item> 119 </uni-list-item>
120 <uni-list-item title="长度(mm)"> 120 <uni-list-item title="长度(mm)">
121 <template v-slot:footer> 121 <template v-slot:footer>
122 - <uni-easyinput type="digit" v-model="item.length" :inputBorder="false" placeholder="请输入长度" @input="onNonNegativeInput(idx, 'length')" @blur="onNonNegativeBlur(idx, 'length', 2)" /> 122 + <uni-easyinput type="digit" v-model="item.length" :inputBorder="false" placeholder="请输入长度" @input="onNonNegativeInput(idx, 'length')" @blur="onNonNegativeBlur(idx, 'length', 9)" />
123 </template> 123 </template>
124 </uni-list-item> 124 </uni-list-item>
125 <uni-list-item title="长度公差上限(mm)"> 125 <uni-list-item title="长度公差上限(mm)">
126 <template v-slot:footer> 126 <template v-slot:footer>
127 - <uni-easyinput type="digit" v-model="item.lengthTolPos" :inputBorder="false"  
128 - placeholder="请输入长度公差上限" @input="onNonNegativeInput(idx, 'lengthTolPos')" @blur="onNonNegativeBlur(idx, 'lengthTolPos', 2)" /> 127 + <uni-easyinput type="text" v-model="item.lengthTolPos" :inputBorder="false"
  128 + placeholder="请输入长度公差上限" @input="onNumberInput(idx, 'lengthTolPos')" @blur="onNumberBlur(idx, 'lengthTolPos', 9)" />
129 </template> 129 </template>
130 </uni-list-item> 130 </uni-list-item>
131 <uni-list-item title="长度公差下限(mm)"> 131 <uni-list-item title="长度公差下限(mm)">
132 <template v-slot:footer> 132 <template v-slot:footer>
133 - <uni-easyinput type="digit" v-model="item.lengthTolNeg" :inputBorder="false"  
134 - placeholder="请输入长度公差下限" @input="onNonNegativeInput(idx, 'lengthTolNeg')" @blur="onNonNegativeBlur(idx, 'lengthTolNeg', 2)" /> 133 + <uni-easyinput type="text" v-model="item.lengthTolNeg" :inputBorder="false"
  134 + placeholder="请输入长度公差下限" @input="onNumberInput(idx, 'lengthTolNeg')" @blur="onNumberBlur(idx, 'lengthTolNeg', 9)" />
135 </template> 135 </template>
136 </uni-list-item> 136 </uni-list-item>
137 <uni-list-item title="定作物数量"> 137 <uni-list-item title="定作物数量">
138 <template v-slot:footer> 138 <template v-slot:footer>
139 - <uni-easyinput v-model="item.productQuantity" type="digit" :inputBorder="false" placeholder="请输入数量kg" @input="onNonNegativeInput(idx, 'productQuantity')" @blur="onNonNegativeBlur(idx, 'productQuantity', 2)" /> 139 + <uni-easyinput v-model="item.productQuantity" type="digit" :inputBorder="false" placeholder="请输入数量kg" @input="onNonNegativeInput(idx, 'productQuantity')" @blur="onNonNegativeBlur(idx, 'productQuantity', 9)" />
140 </template> 140 </template>
141 </uni-list-item> 141 </uni-list-item>
142 <uni-list-item title="加工费单价"> 142 <uni-list-item title="加工费单价">
143 <template v-slot:footer> 143 <template v-slot:footer>
144 - <uni-easyinput v-model="item.unitPrice" type="digit" :inputBorder="false" placeholder="请输入销售价格" @input="onNonNegativeInput(idx, 'unitPrice')" @blur="onNonNegativeBlur(idx, 'unitPrice', 2)" /> 144 + <uni-easyinput v-model="item.unitPrice" type="digit" :inputBorder="false" placeholder="请输入销售价格" @input="onNonNegativeInput(idx, 'unitPrice')" @blur="onNonNegativeBlur(idx, 'unitPrice', 9)" />
145 </template> 145 </template>
146 </uni-list-item> 146 </uni-list-item>
147 <uni-list-item title="不含税金额"> 147 <uni-list-item title="不含税金额">
@@ -295,6 +295,45 @@ export default { @@ -295,6 +295,45 @@ export default {
295 defaultItem() { 295 defaultItem() {
296 return { productId:'', productName:'', productGrade:'', productStatus:'', rawProductId: '', rawProductName: '', rawProductGrade: '', industry: '',materialProductRatioRemarks:'', supplyTime: '存料加工', materialProductRatio: '', rawToProdRatioName: '', quality: '', thickness: '', thicknessTolPos: '', thicknessTolNeg: '', width: '', widthTolPos: '', widthTolNeg: '', length: '', lengthTolPos: '', lengthTolNeg: '', productQuantity: '', unitPrice: '', amountExcludingTax: 0, totalAmount: 0, deliveryDate: '' } 296 return { productId:'', productName:'', productGrade:'', productStatus:'', rawProductId: '', rawProductName: '', rawProductGrade: '', industry: '',materialProductRatioRemarks:'', supplyTime: '存料加工', materialProductRatio: '', rawToProdRatioName: '', quality: '', thickness: '', thicknessTolPos: '', thicknessTolNeg: '', width: '', widthTolPos: '', widthTolNeg: '', length: '', lengthTolPos: '', lengthTolNeg: '', productQuantity: '', unitPrice: '', amountExcludingTax: 0, totalAmount: 0, deliveryDate: '' }
297 }, 297 },
  298 + onNumberInput(idx, field) {
  299 + const it = this.items[idx]
  300 + if (!it) return
  301 + let v = String(it[field] != null ? it[field] : '')
  302 + v = v.replace(/[^0-9.-]/g, '')
  303 + if ((v.match(/-/g) || []).length > 1) {
  304 + const first = v.indexOf('-') === 0 ? '-' : ''
  305 + v = first + v.replace(/-/g, '')
  306 + } else if (v.indexOf('-') > 0) {
  307 + v = v.replace(/-/g, '')
  308 + }
  309 + if ((v.match(/\./g) || []).length > 1) {
  310 + const parts = v.split('.')
  311 + v = parts[0] + '.' + parts.slice(1).join('')
  312 + }
  313 + it[field] = v
  314 + this.$set(this.items, idx, it)
  315 + },
  316 + validate() {
  317 + for (let i = 0; i < this.items.length; i++) {
  318 + const it = this.items[i]
  319 + const check = (pos, neg, label) => {
  320 + if (pos !== '' && pos !== null && pos !== undefined &&
  321 + neg !== '' && neg !== null && neg !== undefined) {
  322 + if (Number(pos) <= Number(neg)) {
  323 + return `第${i + 1}行产品:${label}公差上限必须大于下限`
  324 + }
  325 + }
  326 + return null
  327 + }
  328 + let err = check(it.thicknessTolPos, it.thicknessTolNeg, '厚度')
  329 + if (err) { uni.showToast({ title: err, icon: 'none' }); return false }
  330 + err = check(it.widthTolPos, it.widthTolNeg, '宽度')
  331 + if (err) { uni.showToast({ title: err, icon: 'none' }); return false }
  332 + err = check(it.lengthTolPos, it.lengthTolNeg, '长度')
  333 + if (err) { uni.showToast({ title: err, icon: 'none' }); return false }
  334 + }
  335 + return true
  336 + },
298 onNonNegativeInput(idx, field) { 337 onNonNegativeInput(idx, field) {
299 const it = this.items[idx] 338 const it = this.items[idx]
300 if (!it) return 339 if (!it) return
@@ -21,6 +21,13 @@ @@ -21,6 +21,13 @@
21 <view class="item-title"><text class="required">*</text><text>需方</text></view> 21 <view class="item-title"><text class="required">*</text><text>需方</text></view>
22 </template> 22 </template>
23 </uni-list-item> 23 </uni-list-item>
  24 + <uni-list-item class="select-item" :class="form.stockUpCompanyId ? 'is-filled' : 'is-empty'" clickable
  25 + @click="openRelate('stockUpCompanyId')" :rightText="form.stockUpCompanyName || '请选择备货单位'" showArrow>
  26 + <template v-slot:body>
  27 + <view class="item-title"><text class="required">*</text><text>备货单位/人(生产标准)</text></view>
  28 + </template>
  29 + </uni-list-item>
  30 +
24 31
25 <uni-list-item title="订货日期"> 32 <uni-list-item title="订货日期">
26 <template v-slot:footer> 33 <template v-slot:footer>
@@ -39,7 +46,18 @@ @@ -39,7 +46,18 @@
39 <view class="item-title"><text class="required">*</text><text>生产厂</text></view> 46 <view class="item-title"><text class="required">*</text><text>生产厂</text></view>
40 </template> 47 </template>
41 </uni-list-item> 48 </uni-list-item>
42 - <ProductRel mode="add" :deliveryDateBase="form.deliveryDate" :deliveryDate="form.orderDate" @change="onProductsChange" :options="productList" /> 49 + <uni-list-item title="办事处">
  50 + <template v-slot:footer>
  51 + <uni-easyinput v-model="form.deptName" :inputBorder="false" disabled placeholder="自动获取" />
  52 + </template>
  53 + </uni-list-item>
  54 + <uni-list-item class="select-item" :class="form.region ? 'is-filled' : 'is-empty'" clickable
  55 + @click="openSheet('region')" :rightText="displayLabel('regionName')" showArrow>
  56 + <template v-slot:body>
  57 + <view class="item-title"><text class="required">*</text><text>区域</text></view>
  58 + </template>
  59 + </uni-list-item>
  60 + <ProductRel ref="productRel" mode="add" :deliveryDateBase="form.deliveryDate" :deliveryDate="form.orderDate" :list="productLineList" @change="onProductsChange" :options="productList" />
43 <uni-list-item title="合计人民币金额(大写)"> 61 <uni-list-item title="合计人民币金额(大写)">
44 <template v-slot:footer> 62 <template v-slot:footer>
45 <uni-easyinput v-model="form.totalAmountCapital" placeholder="自动计算" :inputBorder="false" disabled /> 63 <uni-easyinput v-model="form.totalAmountCapital" placeholder="自动计算" :inputBorder="false" disabled />
@@ -123,7 +141,7 @@ @@ -123,7 +141,7 @@
123 </uni-list-item> 141 </uni-list-item>
124 <uni-list-item title="备注"> 142 <uni-list-item title="备注">
125 <template v-slot:footer> 143 <template v-slot:footer>
126 - <uni-easyinput type="textarea" v-model="form.remarks" placeholder="请输入备注" :inputBorder="false" /> 144 + <uni-easyinput type="textarea" v-model="form.remarks" placeholder="请输入备注" :inputBorder="false" maxlength="2000" />
127 </template> 145 </template>
128 </uni-list-item> 146 </uni-list-item>
129 <view class="quality"> 147 <view class="quality">
@@ -208,10 +226,11 @@ import SingleSelectSheet from '@/components/single-select/index.vue' @@ -208,10 +226,11 @@ import SingleSelectSheet from '@/components/single-select/index.vue'
208 import RelateSelectSheet from '@/components/relate-select/index.vue' 226 import RelateSelectSheet from '@/components/relate-select/index.vue'
209 import ProductRel from './productRel.vue' 227 import ProductRel from './productRel.vue'
210 import CitySelector from '@/components/city-selector/index.vue' 228 import CitySelector from '@/components/city-selector/index.vue'
211 -import { getRetailCodeApi, createContractApi, getCustomerRemarks,getCustomerSpecificQualityRequirements } from '@/api/contract' 229 +import { getRetailCodeApi, createContractApi, getCustomerRemarks,getCustomerSpecificQualityRequirements, getDeptApi } from '@/api/contract'
212 import { getDicByCodes } from '@/utils/dic' 230 import { getDicByCodes } from '@/utils/dic'
213 import { formatCurrencyToChinese } from '@/utils/common' 231 import { formatCurrencyToChinese } from '@/utils/common'
214 import { workshopQueryApi } from '@/api/devManage' 232 import { workshopQueryApi } from '@/api/devManage'
  233 +import { getArea } from '@/api/credit_manage.js'
215 234
216 export default { 235 export default {
217 name: 'AddContractRetail', 236 name: 'AddContractRetail',
@@ -224,6 +243,8 @@ export default { @@ -224,6 +243,8 @@ export default {
224 supplierName: '', 243 supplierName: '',
225 buyer: '', 244 buyer: '',
226 buyerName: '', 245 buyerName: '',
  246 + stockUpCompanyId: '',
  247 + stockUpCompanyName: '',
227 orderDate: '', 248 orderDate: '',
228 deliveryDate: '', 249 deliveryDate: '',
229 designatedConsignee: '', 250 designatedConsignee: '',
@@ -233,15 +254,19 @@ export default { @@ -233,15 +254,19 @@ export default {
233 executionStandardName: '', 254 executionStandardName: '',
234 executionStandardRemarks: '', 255 executionStandardRemarks: '',
235 includesPackagingFee: false, 256 includesPackagingFee: false,
236 - includesPackagingFeeName: '', 257 + includesPackagingFeeName: '',
237 includesTransportFee: false, 258 includesTransportFee: false,
238 - includesTransportFeeName: '', 259 + includesTransportFeeName: '',
239 unit: '元、公斤、元/公斤', 260 unit: '元、公斤、元/公斤',
240 totalAmountCapital: '', 261 totalAmountCapital: '',
241 destinationId: [], 262 destinationId: [],
242 destinationLabel: '', 263 destinationLabel: '',
243 workshopIdName: '', 264 workshopIdName: '',
244 workshopId: '', 265 workshopId: '',
  266 + deptName: '',
  267 + deptId: '',
  268 + region: '',
  269 + regionName: '',
245 remarks: '', 270 remarks: '',
246 component: '', 271 component: '',
247 packaging: '', 272 packaging: '',
@@ -263,12 +288,15 @@ export default { @@ -263,12 +288,15 @@ export default {
263 productList: [], 288 productList: [],
264 customerRemarks: [], 289 customerRemarks: [],
265 defaultRemark: '', 290 defaultRemark: '',
  291 + regionOptions: [],
266 } 292 }
267 }, 293 },
268 created() { 294 created() {
269 this.loadSuppliers() 295 this.loadSuppliers()
270 this.loadExtraOptions() 296 this.loadExtraOptions()
271 this.initCode() 297 this.initCode()
  298 + this.getDept()
  299 + this.loadRegionOptions()
272 this.form.orderDate = this.formatDate(new Date()) 300 this.form.orderDate = this.formatDate(new Date())
273 this.$nextTick(() => { 301 this.$nextTick(() => {
274 if (Array.isArray(this.form.destinationId) && this.form.destinationId.length) { 302 if (Array.isArray(this.form.destinationId) && this.form.destinationId.length) {
@@ -318,6 +346,24 @@ export default { @@ -318,6 +346,24 @@ export default {
318 }, 346 },
319 }, 347 },
320 methods: { 348 methods: {
  349 + async loadRegionOptions() {
  350 + try {
  351 + const res = await getArea()
  352 + const list = res.data || []
  353 + this.regionOptions = (list || []).map(it => ({ label: it.name || '', value: it.id || '' }))
  354 + } catch (e) {
  355 + this.regionOptions = []
  356 + }
  357 + },
  358 + // 查询当前人所在办事处
  359 + getDept() {
  360 + getDeptApi().then(res => {
  361 + if (res.code === 200) {
  362 + this.form.deptName = res.data.name || ''
  363 + this.form.deptId = res.data.id || ''
  364 + }
  365 + })
  366 + },
321 getHistory() { 367 getHistory() {
322 console.log('this.productLineList', this.productLineList[0].productId) 368 console.log('this.productLineList', this.productLineList[0].productId)
323 if (!this.productLineList.length || !this.productLineList[0].productId) { 369 if (!this.productLineList.length || !this.productLineList[0].productId) {
@@ -405,7 +451,7 @@ export default { @@ -405,7 +451,7 @@ export default {
405 }, 451 },
406 displayLabel(field) { 452 displayLabel(field) {
407 const m = this.form 453 const m = this.form
408 - const map = { supplierName: '请选择供方', buyerName: '请选择需方', workshopIdName: '请选择生产厂' } 454 + const map = { supplierName: '请选择供方', buyerName: '请选择需方', workshopIdName: '请选择生产厂', regionName: '请选择区域' }
409 const val = m[field] 455 const val = m[field]
410 return val ? String(val) : map[field] 456 return val ? String(val) : map[field]
411 }, 457 },
@@ -450,6 +496,8 @@ export default { @@ -450,6 +496,8 @@ export default {
450 setSheet('单价中是否已包含运费', this.yesNoList) 496 setSheet('单价中是否已包含运费', this.yesNoList)
451 } else if (field === 'historyRemarks') { 497 } else if (field === 'historyRemarks') {
452 setSheet('历史备注', this.customerRemarks) 498 setSheet('历史备注', this.customerRemarks)
  499 + }else if (field === 'region') {
  500 + setSheet('区域', this.regionOptions)
453 } 501 }
454 }, 502 },
455 onSheetConfirm({ value, label }) { 503 onSheetConfirm({ value, label }) {
@@ -468,6 +516,8 @@ export default { @@ -468,6 +516,8 @@ export default {
468 let config = {} 516 let config = {}
469 if (fieldKey === 'buyer') { 517 if (fieldKey === 'buyer') {
470 config = { title: '需方', source: 'customer', rowKey: 'id', multiple: false, display: [{ label: '姓名', field: 'name' }, { label: '编号', field: 'code' }, { label: '状态', field: 'available', format: v => (v ? '启用' : '停用') }] } 518 config = { title: '需方', source: 'customer', rowKey: 'id', multiple: false, display: [{ label: '姓名', field: 'name' }, { label: '编号', field: 'code' }, { label: '状态', field: 'available', format: v => (v ? '启用' : '停用') }] }
  519 + } else if (fieldKey === 'stockUpCompanyId') {
  520 + config = { title: '备货单位/人(生产标准)', source: 'customer', rowKey: 'id', multiple: false, display: [{ label: '姓名', field: 'name' }, { label: '编号', field: 'code' }, { label: '状态', field: 'available', format: v => (v ? '启用' : '停用') }] }
471 } 521 }
472 const selectedKeys = this.form[fieldKey] ? [this.form[fieldKey]] : [] 522 const selectedKeys = this.form[fieldKey] ? [this.form[fieldKey]] : []
473 this.sheet.visible = false 523 this.sheet.visible = false
@@ -478,7 +528,17 @@ export default { @@ -478,7 +528,17 @@ export default {
478 const _fieldKey = this.relate.fieldKey 528 const _fieldKey = this.relate.fieldKey
479 const first = (items && items.length > 0) ? items[0] : null 529 const first = (items && items.length > 0) ? items[0] : null
480 this.form[_fieldKey] = (first && first.id) ? first.id : '' 530 this.form[_fieldKey] = (first && first.id) ? first.id : ''
481 - this.form[_fieldKey + 'Name'] = (first && first.name) ? first.name : '' 531 +
  532 + if (_fieldKey === 'stockUpCompanyId') {
  533 + this.form.stockUpCompanyName = (first && first.name) ? first.name : ''
  534 + } else {
  535 + this.form[_fieldKey + 'Name'] = (first && first.name) ? first.name : ''
  536 + }
  537 +
  538 + if (_fieldKey === 'buyer') {
  539 + this.form.stockUpCompanyId = (first && first.id) ? first.id : ''
  540 + this.form.stockUpCompanyName = (first && first.name) ? first.name : ''
  541 + }
482 }, 542 },
483 onRadioSelect(field, nameField, opt) { 543 onRadioSelect(field, nameField, opt) {
484 const val = opt && opt.value != null ? opt.value : '' 544 const val = opt && opt.value != null ? opt.value : ''
@@ -534,9 +594,11 @@ export default { @@ -534,9 +594,11 @@ export default {
534 { key: 'code', label: '编号' }, 594 { key: 'code', label: '编号' },
535 { key: 'supplier', label: '供方' }, 595 { key: 'supplier', label: '供方' },
536 { key: 'buyer', label: '需方' }, 596 { key: 'buyer', label: '需方' },
  597 + { key: 'stockUpCompanyId', label: '备货单位/人(生产标准)' },
537 { key: 'orderDate', label: '订货日期' }, 598 { key: 'orderDate', label: '订货日期' },
538 { key: 'unit', label: '单位' }, 599 { key: 'unit', label: '单位' },
539 { key: 'workshopId', label: '生产厂' }, 600 { key: 'workshopId', label: '生产厂' },
  601 + { key: 'region', label: '区域' },
540 { key: 'specialTerms', label: '特别条款要求' }, 602 { key: 'specialTerms', label: '特别条款要求' },
541 ] 603 ]
542 for (const it of checks) { 604 for (const it of checks) {
@@ -544,6 +606,7 @@ export default { @@ -544,6 +606,7 @@ export default {
544 const empty = (val === undefined || val === null || (typeof val === 'string' && val.trim() === '') || (typeof val === 'number' && isNaN(val))) 606 const empty = (val === undefined || val === null || (typeof val === 'string' && val.trim() === '') || (typeof val === 'number' && isNaN(val)))
545 if (empty) { uni.showToast({ title: `请先选择${it.label}`, icon: 'none' }); return false } 607 if (empty) { uni.showToast({ title: `请先选择${it.label}`, icon: 'none' }); return false }
546 } 608 }
  609 + if (this.$refs.productRel && !this.$refs.productRel.validate()) return false
547 const list = Array.isArray(this.productLineList) ? this.productLineList : [] 610 const list = Array.isArray(this.productLineList) ? this.productLineList : []
548 if (list.length === 0) { 611 if (list.length === 0) {
549 uni.showToast({ title: '请至少添加一条产品明细', icon: 'none' }); return false 612 uni.showToast({ title: '请至少添加一条产品明细', icon: 'none' }); return false
@@ -4,16 +4,23 @@ @@ -4,16 +4,23 @@
4 <view class="detail-page"> 4 <view class="detail-page">
5 <view class="section"> 5 <view class="section">
6 <text class="row customer">{{ detail.code }}</text> 6 <text class="row customer">{{ detail.code }}</text>
7 - <view class="row" v-if="status === 'STANDARD'"><text class="label">正式合同规范性审核</text><text class="value"><span class="info-status" :style="detail.standardApprovedName ? getStatusCss(detail.standardApprovedName) : ''" >{{ detail.standardApprovedName || '-' }}</span></text></view> 7 + <view class="row" v-if="detail.status === 'STANDARD'"><text class="label">正式合同规范性审核</text><text class="value"><span class="info-status" :style="detail.standardApprovedName ? getStatusCss(detail.standardApprovedName) : ''" >{{ detail.standardApprovedName || '-' }}</span></text></view>
  8 + <view v-if="detail.status === 'STANDARD'" :class="['status', `status_${detail.shippingStatusName}`]" />
8 <view class="row"><text class="label">供方</text><text class="value">{{ detail.supplierName || 9 <view class="row"><text class="label">供方</text><text class="value">{{ detail.supplierName ||
9 '-'}}</text></view> 10 '-'}}</text></view>
10 <view class="row"><text class="label">需方</text><text class="value">{{ detail.buyerName || 11 <view class="row"><text class="label">需方</text><text class="value">{{ detail.buyerName ||
11 '-'}}</text></view> 12 '-'}}</text></view>
  13 + <view class="row"><text class="label">备货单位/人(生产标准)</text><text class="value">{{ detail.stockUpCompanyName || '-'
  14 + }}</text></view>
12 <view class="row"><text class="label">订货日期</text><text class="value">{{ detail.orderDate }}</text> 15 <view class="row"><text class="label">订货日期</text><text class="value">{{ detail.orderDate }}</text>
13 </view> 16 </view>
14 <view class="row"><text class="label">单位</text><text class="value">{{ detail.unit }}</text></view> 17 <view class="row"><text class="label">单位</text><text class="value">{{ detail.unit }}</text></view>
15 <view class="row"><text class="label">生产厂</text><text class="value">{{ detail.workshopName || 18 <view class="row"><text class="label">生产厂</text><text class="value">{{ detail.workshopName ||
16 '-'}}</text></view> 19 '-'}}</text></view>
  20 + <view class="row"><text class="label">办事处</text><text class="value">{{ detail.deptName || '-'
  21 + }}</text></view>
  22 + <view class="row"><text class="label">区域</text><text class="value">{{ detail.regionName || '-'
  23 + }}</text></view>
17 </view> 24 </view>
18 25
19 <view class="section1"> 26 <view class="section1">
@@ -53,7 +60,7 @@ @@ -53,7 +60,7 @@
53 }}</text></view> 60 }}</text></view>
54 </view> 61 </view>
55 62
56 - <view class="section" v-if="status === 'STANDARD'"> 63 + <view class="section" v-if="detail.status === 'STANDARD'">
57 <view class="row"><text class="label">规范性合同</text><text class="value" style="color: #3D48A3;">{{ 64 <view class="row"><text class="label">规范性合同</text><text class="value" style="color: #3D48A3;">{{
58 detail.standardFileName || '-' }}</text></view> 65 detail.standardFileName || '-' }}</text></view>
59 <view class="row"><text class="label">合同是否规范</text><text class="value">{{ 66 <view class="row"><text class="label">合同是否规范</text><text class="value">{{
@@ -108,11 +115,12 @@ @@ -108,11 +115,12 @@
108 </template> 115 </template>
109 116
110 <script> 117 <script>
111 -import { getContractApi, deleteContractApi, uploadStandardContract, statusStyle } from '@/api/contract' 118 +import { getContractApi, deleteContractApi, uploadStandardContract, statusStyle, statusMap } from '@/api/contract'
112 import ProductRel from './productRel.vue' 119 import ProductRel from './productRel.vue'
113 import DetailButtons from '@/components/detail-buttons/index.vue' 120 import DetailButtons from '@/components/detail-buttons/index.vue'
114 import FileUpload from '@/components/file-upload/index.vue' 121 import FileUpload from '@/components/file-upload/index.vue'
115 import SingleSelectSheet from '@/components/single-select/index.vue' 122 import SingleSelectSheet from '@/components/single-select/index.vue'
  123 +import { getDicByCodes, getDicName } from '@/utils/dic.js'
116 124
117 export default { 125 export default {
118 name: 'ContractRetailDetail', 126 name: 'ContractRetailDetail',
@@ -154,7 +162,11 @@ export default { @@ -154,7 +162,11 @@ export default {
154 tolerance: '', 162 tolerance: '',
155 performance: '', 163 performance: '',
156 component: '', 164 component: '',
157 - packaging: '' 165 + packaging: '',
  166 + stockUpCompanyId: '',
  167 + stockUpCompanyName: '',
  168 + region: '',
  169 + regionName: '',
158 }, 170 },
159 productList: [], 171 productList: [],
160 fileInfo: { id: '', name: '' }, 172 fileInfo: { id: '', name: '' },
@@ -193,11 +205,12 @@ export default { @@ -193,11 +205,12 @@ export default {
193 { 205 {
194 text: '审核详情', 206 text: '审核详情',
195 visible: true, 207 visible: true,
196 - variant: 'primary',  
197 event: 'auditDetail' 208 event: 'auditDetail'
198 }, 209 },
199 ], 210 ],
200 statusStyle: statusStyle, 211 statusStyle: statusStyle,
  212 + statusMap: statusMap,
  213 + dicOptions: { AUDIT_STATUS: [] }
201 } 214 }
202 }, 215 },
203 computed: { 216 computed: {
@@ -219,6 +232,7 @@ export default { @@ -219,6 +232,7 @@ export default {
219 const status = options && options.status ? options.status : '' 232 const status = options && options.status ? options.status : ''
220 this.id = id 233 this.id = id
221 this.status = status 234 this.status = status
  235 + this.loadAuditStatusDic()
222 this.loadDetail() 236 this.loadDetail()
223 }, 237 },
224 methods: { 238 methods: {
@@ -230,6 +244,20 @@ export default { @@ -230,6 +244,20 @@ export default {
230 backgroundColor: found.bgColor || '#000' 244 backgroundColor: found.bgColor || '#000'
231 } 245 }
232 }, 246 },
  247 + async loadAuditStatusDic() {
  248 + try {
  249 + const results = await getDicByCodes(['AUDIT_STATUS'])
  250 + this.dicOptions.AUDIT_STATUS = (results.AUDIT_STATUS && results.AUDIT_STATUS.data) || []
  251 + this.refreshStandardApprovedName()
  252 + } catch (e) {
  253 + this.dicOptions.AUDIT_STATUS = []
  254 + }
  255 + },
  256 + refreshStandardApprovedName() {
  257 + const code = this.detail && this.detail.standardApproved
  258 + const name = getDicName('AUDIT_STATUS', code, this.dicOptions.AUDIT_STATUS)
  259 + this.detail = { ...this.detail, standardApprovedName: name }
  260 + },
233 onUploadSubmit() { 261 onUploadSubmit() {
234 if (!this.fileInfo.id) { 262 if (!this.fileInfo.id) {
235 uni.showToast({ 263 uni.showToast({
@@ -362,6 +390,7 @@ export default { @@ -362,6 +390,7 @@ export default {
362 } 390 }
363 const lines = Array.isArray(data.contractDistributorLineList) ? data.contractDistributorLineList : [] 391 const lines = Array.isArray(data.contractDistributorLineList) ? data.contractDistributorLineList : []
364 this.productList = lines 392 this.productList = lines
  393 + this.refreshStandardApprovedName()
365 } catch (e) { 394 } catch (e) {
366 this.detail = { ...this.detail } 395 this.detail = { ...this.detail }
367 this.productList = [] 396 this.productList = []
@@ -391,8 +420,35 @@ export default { @@ -391,8 +420,35 @@ export default {
391 padding: 32rpx; 420 padding: 32rpx;
392 background: #fff; 421 background: #fff;
393 margin-bottom: 20rpx; 422 margin-bottom: 20rpx;
  423 + .status {
  424 + position: absolute;
  425 + top: 16rpx;
  426 + right: 52rpx;
  427 + width: 180rpx;
  428 + height: 146rpx;
  429 + background-repeat: no-repeat;
  430 + background-size: 100% 100%;
  431 + background-position: center;
  432 +
  433 + &_审批中 {
  434 + background-image: url('~@/static/images/contract/status_1.png');
  435 + }
  436 +
  437 + &_生产中 {
  438 + background-image: url('~@/static/images/contract/status_2.png');
  439 + }
  440 +
  441 + &_已发货 {
  442 + background-image: url('~@/static/images/contract/status_3.png');
  443 + }
  444 +
  445 + &_已签收 {
  446 + background-image: url('~@/static/images/contract/status_4.png');
  447 + }
  448 + }
394 } 449 }
395 450
  451 +
396 .section1 { 452 .section1 {
397 background: #fff; 453 background: #fff;
398 margin-bottom: 20rpx; 454 margin-bottom: 20rpx;
@@ -61,7 +61,7 @@ @@ -61,7 +61,7 @@
61 <text>订单总额</text><text class="amount" :style="{ color: '#b67a76' }">{{ item.totalAmountIncludingTax ? '¥' : '' }}{{ formatAmount(item.totalAmountIncludingTax) || '-' }}</text> 61 <text>订单总额</text><text class="amount" :style="{ color: '#b67a76' }">{{ item.totalAmountIncludingTax ? '¥' : '' }}{{ formatAmount(item.totalAmountIncludingTax) || '-' }}</text>
62 </view> 62 </view>
63 <view class="info-row" v-if="item.status === 'STANDARD'"> 63 <view class="info-row" v-if="item.status === 'STANDARD'">
64 - <text>正式合同规范性审核状态</text><span class="info-status" :style="item.standardApprovedName ? getStatusCss(item.standardApprovedName) : ''">{{ item.standardApprovedName || '-' }}</span> 64 + <text>标准合同规范性审核状态</text><span class="info-status" :style="item.standardApprovedName ? getStatusCss(item.standardApprovedName) : ''">{{ item.standardApprovedName || '-' }}</span>
65 </view> 65 </view>
66 <view class="info-row"> 66 <view class="info-row">
67 <text>订货日期</text><text>{{ item.orderDate }}</text> 67 <text>订货日期</text><text>{{ item.orderDate }}</text>
@@ -103,21 +103,12 @@ export default { @@ -103,21 +103,12 @@ export default {
103 return { 103 return {
104 searchKeyword: '', 104 searchKeyword: '',
105 searchKeywordDebounced: '', 105 searchKeywordDebounced: '',
106 -  
107 - tabs: [  
108 - { label: '草稿合同', value: 'DRAFT' },  
109 - { label: '标准合同', value: 'STANDARD' },  
110 - { label: '已删除合同', value: 'DELETED' }  
111 - ],  
112 status: 'DRAFT', 106 status: 'DRAFT',
113 -  
114 query: { deptId: '', deptName: '', dateRange: [] }, 107 query: { deptId: '', deptName: '', dateRange: [] },
115 extraParams: {}, 108 extraParams: {},
116 -  
117 batchMode: false, 109 batchMode: false,
118 selectedKeys: [], 110 selectedKeys: [],
119 currentItems: [], 111 currentItems: [],
120 -  
121 filterVisible: false, 112 filterVisible: false,
122 filterForm: { deptId: '', deptName: '', dateRange: [] }, 113 filterForm: { deptId: '', deptName: '', dateRange: [] },
123 deptSelectVisible: false, 114 deptSelectVisible: false,
@@ -126,6 +117,23 @@ export default { @@ -126,6 +117,23 @@ export default {
126 } 117 }
127 }, 118 },
128 computed: { 119 computed: {
  120 + roleCodes() {
  121 + const g = this.$store && this.$store.getters
  122 + return (g && g.roleCodes) || []
  123 + },
  124 + tabs() {
  125 + if (this.roleCodes.includes('constract_admin')) {
  126 + return [
  127 + { label: '草稿合同', value: 'DRAFT' },
  128 + { label: '标准合同', value: 'STANDARD' },
  129 + { label: '已删除合同', value: 'DELETED' }
  130 + ]
  131 + }
  132 + return [
  133 + { label: '草稿合同', value: 'DRAFT' },
  134 + { label: '标准合同', value: 'STANDARD' }
  135 + ]
  136 + },
129 extraCombined() { 137 extraCombined() {
130 return { 138 return {
131 keyword: this.searchKeywordDebounced || undefined, 139 keyword: this.searchKeywordDebounced || undefined,
@@ -359,10 +367,10 @@ export default { @@ -359,10 +367,10 @@ export default {
359 margin-bottom: 0; 367 margin-bottom: 0;
360 } 368 }
361 text { 369 text {
362 - width: 60%; 370 + width: 50%;
363 &:last-child { 371 &:last-child {
364 color: rgba(0,0,0,0.9); 372 color: rgba(0,0,0,0.9);
365 - width: 40%; 373 + width: 50%;
366 } 374 }
367 } 375 }
368 } 376 }
@@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
21 <view class="item-title"><text class="required">*</text><text>需方</text></view> 21 <view class="item-title"><text class="required">*</text><text>需方</text></view>
22 </template> 22 </template>
23 </uni-list-item> 23 </uni-list-item>
24 - 24 +
25 <uni-list-item class="select-item" :class="form.workshopId ? 'is-filled' : 'is-empty'" clickable 25 <uni-list-item class="select-item" :class="form.workshopId ? 'is-filled' : 'is-empty'" clickable
26 @click="openSheet('workshopId')" :rightText="form.workshopName || '请选择生产厂'" showArrow> 26 @click="openSheet('workshopId')" :rightText="form.workshopName || '请选择生产厂'" showArrow>
27 <template v-slot:body> 27 <template v-slot:body>
@@ -40,8 +40,23 @@ @@ -40,8 +40,23 @@
40 <uni-easyinput v-model="form.unit" :inputBorder="false" disabled /> 40 <uni-easyinput v-model="form.unit" :inputBorder="false" disabled />
41 </template> 41 </template>
42 </uni-list-item> 42 </uni-list-item>
43 -  
44 - <ProductRel mode="add" :deliveryDateBase="form.deliveryDate" :deliveryDate="form.orderDate" :list="productLineList" @change="onProductsChange" :options="productList" /> 43 + <uni-list-item class="select-item" :class="form.deptName ? 'is-filled' : 'is-empty'">
  44 + <template v-slot:body>
  45 + <view class="item-title"><text class="required">*</text><text>办事处</text></view>
  46 + </template>
  47 + <template v-slot:footer>
  48 + <view class="serial-number-row">
  49 + <uni-easyinput v-model="form.deptName" :inputBorder="false" disabled />
  50 + </view>
  51 + </template>
  52 + </uni-list-item>
  53 + <uni-list-item class="select-item" :class="form.region ? 'is-filled' : 'is-empty'" clickable
  54 + @click="openSheet('region')" :rightText="displayLabel('regionName')" showArrow>
  55 + <template v-slot:body>
  56 + <view class="item-title"><text class="required">*</text><text>区域</text></view>
  57 + </template>
  58 + </uni-list-item>
  59 + <ProductRel ref="productRel" mode="add" :deliveryDateBase="form.deliveryDate" :deliveryDate="form.orderDate" :list="productLineList" @change="onProductsChange" :options="productList" />
45 60
46 <uni-list-item title="合计人民币金额(大写)"> 61 <uni-list-item title="合计人民币金额(大写)">
47 <template v-slot:footer> 62 <template v-slot:footer>
@@ -124,7 +139,7 @@ @@ -124,7 +139,7 @@
124 </uni-list-item> 139 </uni-list-item>
125 <uni-list-item title="备注"> 140 <uni-list-item title="备注">
126 <template v-slot:footer> 141 <template v-slot:footer>
127 - <uni-easyinput v-model="form.remarks" placeholder="请输入备注" :inputBorder="false" /> 142 + <uni-easyinput v-model="form.remarks" placeholder="请输入备注" :inputBorder="false" maxlength="2000" />
128 </template> 143 </template>
129 </uni-list-item> 144 </uni-list-item>
130 145
@@ -199,6 +214,8 @@ import { getContractApi, updateContractApi } from '@/api/contract' @@ -199,6 +214,8 @@ import { getContractApi, updateContractApi } from '@/api/contract'
199 import { getDicByCodes } from '@/utils/dic' 214 import { getDicByCodes } from '@/utils/dic'
200 import { formatCurrencyToChinese } from '@/utils/common' 215 import { formatCurrencyToChinese } from '@/utils/common'
201 import { workshopQueryApi } from '@/api/devManage' 216 import { workshopQueryApi } from '@/api/devManage'
  217 +import { getArea } from '@/api/credit_manage.js'
  218 +
202 export default { 219 export default {
203 name: 'ModifyContractRetail', 220 name: 'ModifyContractRetail',
204 components: { SingleSelectSheet, RelateSelectSheet, ProductRel, CitySelector }, 221 components: { SingleSelectSheet, RelateSelectSheet, ProductRel, CitySelector },
@@ -212,6 +229,12 @@ export default { @@ -212,6 +229,12 @@ export default {
212 supplierName: '', 229 supplierName: '',
213 buyer: '', 230 buyer: '',
214 buyerName: '', 231 buyerName: '',
  232 + stockUpCompanyId: '',
  233 + stockUpCompanyName: '',
  234 + region: '',
  235 + regionName: '',
  236 + deptName: '',
  237 + deptId: '',
215 workshopId: '', 238 workshopId: '',
216 workshopName: '', 239 workshopName: '',
217 orderDate: '', 240 orderDate: '',
@@ -223,9 +246,9 @@ export default { @@ -223,9 +246,9 @@ export default {
223 executionStandardName: '', 246 executionStandardName: '',
224 executionStandardRemarks: '', 247 executionStandardRemarks: '',
225 includesPackagingFee: false, 248 includesPackagingFee: false,
226 - includesPackagingFeeName: '', 249 + includesPackagingFeeName: '',
227 includesTransportFee: false, 250 includesTransportFee: false,
228 - includesTransportFeeName: '', 251 + includesTransportFeeName: '',
229 unit: '元、公斤、元/公斤', 252 unit: '元、公斤、元/公斤',
230 totalAmountCapital: '', 253 totalAmountCapital: '',
231 depositInfo: '', 254 depositInfo: '',
@@ -254,7 +277,8 @@ export default { @@ -254,7 +277,8 @@ export default {
254 totalAmountIncludingTax: 0, 277 totalAmountIncludingTax: 0,
255 productLineList: [], 278 productLineList: [],
256 newProductLineList: [], 279 newProductLineList: [],
257 - productList: [] 280 + productList: [],
  281 + regionOptions: []
258 } 282 }
259 }, 283 },
260 onLoad(query) { 284 onLoad(query) {
@@ -263,6 +287,7 @@ export default { @@ -263,6 +287,7 @@ export default {
263 created() { 287 created() {
264 this.loadSuppliers() 288 this.loadSuppliers()
265 this.loadExtraOptions() 289 this.loadExtraOptions()
  290 + this.loadRegionOptions()
266 this.loadDetail() 291 this.loadDetail()
267 this.$nextTick(() => { 292 this.$nextTick(() => {
268 if (Array.isArray(this.form.destinationId) && this.form.destinationId.length) { 293 if (Array.isArray(this.form.destinationId) && this.form.destinationId.length) {
@@ -271,6 +296,15 @@ export default { @@ -271,6 +296,15 @@ export default {
271 }) 296 })
272 }, 297 },
273 methods: { 298 methods: {
  299 + async loadRegionOptions() {
  300 + try {
  301 + const res = await getArea()
  302 + const list = res.data || []
  303 + this.regionOptions = (list || []).map(it => ({ label: it.name || '', value: it.id || '' }))
  304 + } catch (e) {
  305 + this.regionOptions = []
  306 + }
  307 + },
274 async loadDetail() { 308 async loadDetail() {
275 if (!this.id) return 309 if (!this.id) return
276 try { 310 try {
@@ -316,6 +350,12 @@ export default { @@ -316,6 +350,12 @@ export default {
316 packaging: m.packaging || '', 350 packaging: m.packaging || '',
317 workshopId: m.workshopId || '', 351 workshopId: m.workshopId || '',
318 workshopName: m.workshopName || '', 352 workshopName: m.workshopName || '',
  353 + stockUpCompanyId: m.stockUpCompanyId || '',
  354 + stockUpCompanyName: m.stockUpCompanyName || '',
  355 + region: m.region || '',
  356 + regionName: m.regionName || '',
  357 + deptName: m.deptName || '',
  358 + deptId: m.deptId || '',
319 } 359 }
320 const lines = Array.isArray(m.contractDistributorLineList) ? m.contractDistributorLineList : [] 360 const lines = Array.isArray(m.contractDistributorLineList) ? m.contractDistributorLineList : []
321 this.productLineList = lines 361 this.productLineList = lines
@@ -371,7 +411,7 @@ export default { @@ -371,7 +411,7 @@ export default {
371 }, 411 },
372 displayLabel(field) { 412 displayLabel(field) {
373 const m = this.form 413 const m = this.form
374 - const map = { supplierName: '请选择供方', buyerName: '请选择需方', workshopName: '请选择生产厂' } 414 + const map = { supplierName: '请选择供方', buyerName: '请选择需方', workshopName: '请选择生产厂', regionName: '请选择区域' }
375 const val = m[field] 415 const val = m[field]
376 return val ? String(val) : map[field] 416 return val ? String(val) : map[field]
377 }, 417 },
@@ -400,6 +440,8 @@ export default { @@ -400,6 +440,8 @@ export default {
400 setSheet('单价中是否已包含包装费', this.yesNoList) 440 setSheet('单价中是否已包含包装费', this.yesNoList)
401 } else if (field === 'includesTransportFee') { 441 } else if (field === 'includesTransportFee') {
402 setSheet('单价中是否已包含运费', this.yesNoList) 442 setSheet('单价中是否已包含运费', this.yesNoList)
  443 + } else if (field === 'region') {
  444 + setSheet('区域', this.regionOptions)
403 } 445 }
404 }, 446 },
405 onSheetConfirm({ value, label }) { 447 onSheetConfirm({ value, label }) {
@@ -413,6 +455,8 @@ export default { @@ -413,6 +455,8 @@ export default {
413 let config = {} 455 let config = {}
414 if (fieldKey === 'buyer') { 456 if (fieldKey === 'buyer') {
415 config = { title: '需方', source: 'customer', rowKey: 'id', multiple: false, display: [{ label: '姓名', field: 'name' }, { label: '编号', field: 'code' }, { label: '状态', field: 'available', format: v => (v ? '启用' : '停用') }] } 457 config = { title: '需方', source: 'customer', rowKey: 'id', multiple: false, display: [{ label: '姓名', field: 'name' }, { label: '编号', field: 'code' }, { label: '状态', field: 'available', format: v => (v ? '启用' : '停用') }] }
  458 + } else if (fieldKey === 'stockUpCompanyId') {
  459 + config = { title: '备货单位/人(生产标准)', source: 'customer', rowKey: 'id', multiple: false, display: [{ label: '姓名', field: 'name' }, { label: '编号', field: 'code' }, { label: '状态', field: 'available', format: v => (v ? '启用' : '停用') }] }
416 } 460 }
417 const selectedKeys = this.form[fieldKey] ? [this.form[fieldKey]] : [] 461 const selectedKeys = this.form[fieldKey] ? [this.form[fieldKey]] : []
418 this.sheet.visible = false 462 this.sheet.visible = false
@@ -423,7 +467,11 @@ export default { @@ -423,7 +467,11 @@ export default {
423 const _fieldKey = this.relate.fieldKey 467 const _fieldKey = this.relate.fieldKey
424 const first = (items && items.length > 0) ? items[0] : null 468 const first = (items && items.length > 0) ? items[0] : null
425 this.form[_fieldKey] = (first && first.id) ? first.id : '' 469 this.form[_fieldKey] = (first && first.id) ? first.id : ''
426 - this.form[_fieldKey + 'Name'] = (first && first.name) ? first.name : '' 470 + if (_fieldKey === 'stockUpCompanyId') {
  471 + this.form.stockUpCompanyName = (first && first.name) ? first.name : ''
  472 + } else {
  473 + this.form[_fieldKey + 'Name'] = (first && first.name) ? first.name : ''
  474 + }this.form[_fieldKey + 'Name'] = (first && first.name) ? first.name : ''
427 }, 475 },
428 onRadioSelect(field, nameField, opt) { 476 onRadioSelect(field, nameField, opt) {
429 const val = opt && opt.value != null ? opt.value : '' 477 const val = opt && opt.value != null ? opt.value : ''
@@ -443,12 +491,15 @@ export default { @@ -443,12 +491,15 @@ export default {
443 { key: 'unit', label: '单位' }, 491 { key: 'unit', label: '单位' },
444 { key: 'workshopId', label: '生产厂' }, 492 { key: 'workshopId', label: '生产厂' },
445 { key: 'specialTerms', label: '特别条款要求' }, 493 { key: 'specialTerms', label: '特别条款要求' },
  494 + { key: 'stockUpCompanyId', label: '备货单位/人(生产标准)' },
  495 + { key: 'region', label: '区域' },
446 ] 496 ]
447 for (const it of checks) { 497 for (const it of checks) {
448 const val = this.form[it.key] 498 const val = this.form[it.key]
449 const empty = (val === undefined || val === null || (typeof val === 'string' && val.trim() === '') || (typeof val === 'number' && isNaN(val))) 499 const empty = (val === undefined || val === null || (typeof val === 'string' && val.trim() === '') || (typeof val === 'number' && isNaN(val)))
450 if (empty) { uni.showToast({ title: `请先选择${it.label}`, icon: 'none' }); return false } 500 if (empty) { uni.showToast({ title: `请先选择${it.label}`, icon: 'none' }); return false }
451 } 501 }
  502 + if (this.$refs.productRel && !this.$refs.productRel.validate()) return false
452 const list = Array.isArray(this.newProductLineList) ? this.newProductLineList : [] 503 const list = Array.isArray(this.newProductLineList) ? this.newProductLineList : []
453 if (list.length === 0) { 504 if (list.length === 0) {
454 uni.showToast({ title: '请至少添加一条产品明细', icon: 'none' }); return false 505 uni.showToast({ title: '请至少添加一条产品明细', icon: 'none' }); return false
@@ -55,51 +55,51 @@ @@ -55,51 +55,51 @@
55 </uni-list-item> 55 </uni-list-item>
56 <uni-list-item title="厚度(mm)"> 56 <uni-list-item title="厚度(mm)">
57 <template v-slot:footer> 57 <template v-slot:footer>
58 - <uni-easyinput type="digit" v-model="item.thickness" :inputBorder="false" placeholder="请输入厚度" @input="onNonNegativeInput(idx, 'thickness')" @blur="onNonNegativeBlur(idx, 'thickness', 2)" /> 58 + <uni-easyinput type="digit" v-model="item.thickness" :inputBorder="false" placeholder="请输入厚度" @input="onNonNegativeInput(idx, 'thickness')" @blur="onNonNegativeBlur(idx, 'thickness', 9)" />
59 </template> 59 </template>
60 </uni-list-item> 60 </uni-list-item>
61 <uni-list-item title="厚度公差上限(mm)"> 61 <uni-list-item title="厚度公差上限(mm)">
62 <template v-slot:footer> 62 <template v-slot:footer>
63 - <uni-easyinput type="digit" v-model="item.thicknessTolPos" :inputBorder="false"  
64 - placeholder="请输入厚度公差上限" @input="onNonNegativeInput(idx, 'thicknessTolPos')" @blur="onNonNegativeBlur(idx, 'thicknessTolPos', 2)" /> 63 + <uni-easyinput type="text" v-model="item.thicknessTolPos" :inputBorder="false"
  64 + placeholder="请输入厚度公差上限" @input="onNumberInput(idx, 'thicknessTolPos')" @blur="onNumberBlur(idx, 'thicknessTolPos', 9)" />
65 </template> 65 </template>
66 </uni-list-item> 66 </uni-list-item>
67 <uni-list-item title="厚度公差下限(mm)"> 67 <uni-list-item title="厚度公差下限(mm)">
68 <template v-slot:footer> 68 <template v-slot:footer>
69 - <uni-easyinput type="digit" v-model="item.thicknessTolNeg" :inputBorder="false"  
70 - placeholder="请输入厚度公差下限" @input="onNonNegativeInput(idx, 'thicknessTolNeg')" @blur="onNonNegativeBlur(idx, 'thicknessTolNeg', 2)" /> 69 + <uni-easyinput type="text" v-model="item.thicknessTolNeg" :inputBorder="false"
  70 + placeholder="请输入厚度公差下限" @input="onNumberInput(idx, 'thicknessTolNeg')" @blur="onNumberBlur(idx, 'thicknessTolNeg', 9)" />
71 </template> 71 </template>
72 </uni-list-item> 72 </uni-list-item>
73 <uni-list-item title="宽度(mm)"> 73 <uni-list-item title="宽度(mm)">
74 <template v-slot:footer> 74 <template v-slot:footer>
75 - <uni-easyinput type="digit" v-model="item.width" :inputBorder="false" placeholder="请输入宽度" @input="onNonNegativeInput(idx, 'width')" @blur="onNonNegativeBlur(idx, 'width', 2)" /> 75 + <uni-easyinput type="digit" v-model="item.width" :inputBorder="false" placeholder="请输入宽度" @input="onNonNegativeInput(idx, 'width')" @blur="onNonNegativeBlur(idx, 'width', 9)" />
76 </template> 76 </template>
77 </uni-list-item> 77 </uni-list-item>
78 <uni-list-item title="宽度公差上限(mm)"> 78 <uni-list-item title="宽度公差上限(mm)">
79 <template v-slot:footer> 79 <template v-slot:footer>
80 - <uni-easyinput type="digit" v-model="item.widthTolPos" :inputBorder="false" placeholder="请输入宽度公差上限" @input="onNonNegativeInput(idx, 'widthTolPos')" @blur="onNonNegativeBlur(idx, 'widthTolPos', 2)" /> 80 + <uni-easyinput type="text" v-model="item.widthTolPos" :inputBorder="false" placeholder="请输入宽度公差上限" @input="onNumberInput(idx, 'widthTolPos')" @blur="onNumberBlur(idx, 'widthTolPos', 9)" />
81 </template> 81 </template>
82 </uni-list-item> 82 </uni-list-item>
83 <uni-list-item title="宽度公差下限(mm)"> 83 <uni-list-item title="宽度公差下限(mm)">
84 <template v-slot:footer> 84 <template v-slot:footer>
85 - <uni-easyinput type="digit" v-model="item.widthTolNeg" :inputBorder="false" placeholder="请输入宽度公差下限" @input="onNonNegativeInput(idx, 'widthTolNeg')" @blur="onNonNegativeBlur(idx, 'widthTolNeg', 2)" /> 85 + <uni-easyinput type="text" v-model="item.widthTolNeg" :inputBorder="false" placeholder="请输入宽度公差下限" @input="onNumberInput(idx, 'widthTolNeg')" @blur="onNumberBlur(idx, 'widthTolNeg', 9)" />
86 </template> 86 </template>
87 </uni-list-item> 87 </uni-list-item>
88 <uni-list-item title="长度(mm)"> 88 <uni-list-item title="长度(mm)">
89 <template v-slot:footer> 89 <template v-slot:footer>
90 - <uni-easyinput type="digit" v-model="item.length" :inputBorder="false" placeholder="请输入长度" @input="onNonNegativeInput(idx, 'length')" @blur="onNonNegativeBlur(idx, 'length', 2)" /> 90 + <uni-easyinput type="digit" v-model="item.length" :inputBorder="false" placeholder="请输入长度" @input="onNonNegativeInput(idx, 'length')" @blur="onNonNegativeBlur(idx, 'length', 9)" />
91 </template> 91 </template>
92 </uni-list-item> 92 </uni-list-item>
93 <uni-list-item title="长度公差上限(mm)"> 93 <uni-list-item title="长度公差上限(mm)">
94 <template v-slot:footer> 94 <template v-slot:footer>
95 - <uni-easyinput type="digit" v-model="item.lengthTolPos" :inputBorder="false"  
96 - placeholder="请输入长度公差上限" @input="onNonNegativeInput(idx, 'lengthTolPos')" @blur="onNonNegativeBlur(idx, 'lengthTolPos', 2)" /> 95 + <uni-easyinput type="text" v-model="item.lengthTolPos" :inputBorder="false"
  96 + placeholder="请输入长度公差上限" @input="onNumberInput(idx, 'lengthTolPos')" @blur="onNumberBlur(idx, 'lengthTolPos', 9)" />
97 </template> 97 </template>
98 </uni-list-item> 98 </uni-list-item>
99 <uni-list-item title="长度公差下限(mm)"> 99 <uni-list-item title="长度公差下限(mm)">
100 <template v-slot:footer> 100 <template v-slot:footer>
101 - <uni-easyinput type="digit" v-model="item.lengthTolNeg" :inputBorder="false"  
102 - placeholder="请输入长度公差下限" @input="onNonNegativeInput(idx, 'lengthTolNeg')" @blur="onNonNegativeBlur(idx, 'lengthTolNeg', 2)" /> 101 + <uni-easyinput type="text" v-model="item.lengthTolNeg" :inputBorder="false"
  102 + placeholder="请输入长度公差下限" @input="onNumberInput(idx, 'lengthTolNeg')" @blur="onNumberBlur(idx, 'lengthTolNeg', 9)" />
103 </template> 103 </template>
104 </uni-list-item> 104 </uni-list-item>
105 <uni-list-item title="状态"> 105 <uni-list-item title="状态">
@@ -109,12 +109,12 @@ @@ -109,12 +109,12 @@
109 </uni-list-item> 109 </uni-list-item>
110 <uni-list-item title="数量kg"> 110 <uni-list-item title="数量kg">
111 <template v-slot:footer> 111 <template v-slot:footer>
112 - <uni-easyinput v-model="item.quantity" type="digit" :inputBorder="false" placeholder="请输入数量kg" @input="onNonNegativeInput(idx, 'quantity')" @blur="onNonNegativeBlur(idx, 'quantity', 2)" /> 112 + <uni-easyinput v-model="item.quantity" type="digit" :inputBorder="false" placeholder="请输入数量kg" @input="onNonNegativeInput(idx, 'quantity')" @blur="onNonNegativeBlur(idx, 'quantity', 9)" />
113 </template> 113 </template>
114 </uni-list-item> 114 </uni-list-item>
115 <uni-list-item title="销售价格"> 115 <uni-list-item title="销售价格">
116 <template v-slot:footer> 116 <template v-slot:footer>
117 - <uni-easyinput v-model="item.unitPrice" type="digit" :inputBorder="false" placeholder="请输入销售价格" @input="onNonNegativeInput(idx, 'unitPrice')" @blur="onNonNegativeBlur(idx, 'unitPrice', 2)" /> 117 + <uni-easyinput v-model="item.unitPrice" type="digit" :inputBorder="false" placeholder="请输入销售价格" @input="onNonNegativeInput(idx, 'unitPrice')" @blur="onNonNegativeBlur(idx, 'unitPrice', 9)" />
118 </template> 118 </template>
119 </uni-list-item> 119 </uni-list-item>
120 <uni-list-item title="不含税金额"> 120 <uni-list-item title="不含税金额">
@@ -259,6 +259,61 @@ export default { @@ -259,6 +259,61 @@ export default {
259 defaultItem() { 259 defaultItem() {
260 return { productId: '', productName: '', industry: '', brand: '', quality: '', thickness: '', thicknessTolPos: '', thicknessTolNeg: '', width: '', widthTolPos: '', widthTolNeg: '', length: '', lengthTolPos: '', lengthTolNeg: '', status: '', quantity: '', unitPrice: '', amountExcludingTax: 0, totalAmount: 0, deliveryDate: '' } 260 return { productId: '', productName: '', industry: '', brand: '', quality: '', thickness: '', thicknessTolPos: '', thicknessTolNeg: '', width: '', widthTolPos: '', widthTolNeg: '', length: '', lengthTolPos: '', lengthTolNeg: '', status: '', quantity: '', unitPrice: '', amountExcludingTax: 0, totalAmount: 0, deliveryDate: '' }
261 }, 261 },
  262 + onNumberInput(idx, field) {
  263 + const it = this.items[idx]
  264 + if (!it) return
  265 + let v = String(it[field] != null ? it[field] : '')
  266 + v = v.replace(/[^0-9.-]/g, '')
  267 + if ((v.match(/-/g) || []).length > 1) {
  268 + const first = v.indexOf('-') === 0 ? '-' : ''
  269 + v = first + v.replace(/-/g, '')
  270 + } else if (v.indexOf('-') > 0) {
  271 + v = v.replace(/-/g, '')
  272 + }
  273 + if ((v.match(/\./g) || []).length > 1) {
  274 + const parts = v.split('.')
  275 + v = parts[0] + '.' + parts.slice(1).join('')
  276 + }
  277 + it[field] = v
  278 + this.$set(this.items, idx, it)
  279 + },
  280 + onNumberBlur(idx, field, digits) {
  281 + const it = this.items[idx]
  282 + if (!it) return
  283 + let raw = it[field]
  284 + if (raw === '' || raw === null || raw === undefined || raw === '-') {
  285 + if (raw === '-') it[field] = ''
  286 + this.$set(this.items, idx, it)
  287 + return
  288 + }
  289 + let val = parseFloat(raw)
  290 + if (isNaN(val)) val = 0
  291 + const m = Math.pow(10, digits)
  292 + const rounded = Math.round(val * m) / m
  293 + it[field] = rounded
  294 + this.$set(this.items, idx, it)
  295 + },
  296 + validate() {
  297 + for (let i = 0; i < this.items.length; i++) {
  298 + const it = this.items[i]
  299 + const check = (pos, neg, label) => {
  300 + if (pos !== '' && pos !== null && pos !== undefined &&
  301 + neg !== '' && neg !== null && neg !== undefined) {
  302 + if (Number(pos) <= Number(neg)) {
  303 + return `第${i + 1}行产品:${label}公差上限必须大于下限`
  304 + }
  305 + }
  306 + return null
  307 + }
  308 + let err = check(it.thicknessTolPos, it.thicknessTolNeg, '厚度')
  309 + if (err) { uni.showToast({ title: err, icon: 'none' }); return false }
  310 + err = check(it.widthTolPos, it.widthTolNeg, '宽度')
  311 + if (err) { uni.showToast({ title: err, icon: 'none' }); return false }
  312 + err = check(it.lengthTolPos, it.lengthTolNeg, '长度')
  313 + if (err) { uni.showToast({ title: err, icon: 'none' }); return false }
  314 + }
  315 + return true
  316 + },
262 onNonNegativeInput(idx, field) { 317 onNonNegativeInput(idx, field) {
263 const it = this.items[idx] 318 const it = this.items[idx]
264 if (!it) return 319 if (!it) return
@@ -21,7 +21,12 @@ @@ -21,7 +21,12 @@
21 <view class="item-title"><text class="required">*</text><text>需方</text></view> 21 <view class="item-title"><text class="required">*</text><text>需方</text></view>
22 </template> 22 </template>
23 </uni-list-item> 23 </uni-list-item>
24 - 24 + <uni-list-item class="select-item" :class="form.stockUpCompanyId ? 'is-filled' : 'is-empty'" clickable
  25 + @click="openRelate('stockUpCompanyId')" :rightText="form.stockUpCompanyName || '请选择备货单位'" showArrow>
  26 + <template v-slot:body>
  27 + <view class="item-title"><text class="required">*</text><text>备货单位/人(生产标准)</text></view>
  28 + </template>
  29 + </uni-list-item>
25 <uni-list-item title="订货日期"> 30 <uni-list-item title="订货日期">
26 <template v-slot:footer> 31 <template v-slot:footer>
27 <uni-datetime-picker type="date" v-model="form.orderDate" /> 32 <uni-datetime-picker type="date" v-model="form.orderDate" />
@@ -39,7 +44,18 @@ @@ -39,7 +44,18 @@
39 <view class="item-title"><text class="required">*</text><text>生产厂</text></view> 44 <view class="item-title"><text class="required">*</text><text>生产厂</text></view>
40 </template> 45 </template>
41 </uni-list-item> 46 </uni-list-item>
42 - <ProductRel mode="add" :deliveryDate="form.orderDate" :deliveryDateBase="form.deliveryDate" @change="onProductsChange" :options="productList" /> 47 + <uni-list-item title="办事处">
  48 + <template v-slot:footer>
  49 + <uni-easyinput v-model="form.deptName" :inputBorder="false" disabled placeholder="自动获取" />
  50 + </template>
  51 + </uni-list-item>
  52 + <uni-list-item class="select-item" :class="form.region ? 'is-filled' : 'is-empty'" clickable
  53 + @click="openSheet('region')" :rightText="displayLabel('regionName')" showArrow>
  54 + <template v-slot:body>
  55 + <view class="item-title"><text class="required">*</text><text>区域</text></view>
  56 + </template>
  57 + </uni-list-item>
  58 + <ProductRel ref="productRel" mode="add" :deliveryDate="form.orderDate" :deliveryDateBase="form.deliveryDate" @change="onProductsChange" :options="productList" />
43 <uni-list-item title="合计人民币金额(大写)"> 59 <uni-list-item title="合计人民币金额(大写)">
44 <template v-slot:footer> 60 <template v-slot:footer>
45 <uni-easyinput v-model="form.totalAmountCapital" placeholder="自动计算" :inputBorder="false" disabled /> 61 <uni-easyinput v-model="form.totalAmountCapital" placeholder="自动计算" :inputBorder="false" disabled />
@@ -123,7 +139,7 @@ @@ -123,7 +139,7 @@
123 </uni-list-item> 139 </uni-list-item>
124 <uni-list-item title="备注"> 140 <uni-list-item title="备注">
125 <template v-slot:footer> 141 <template v-slot:footer>
126 - <uni-easyinput type="textarea" v-model="form.remarks" placeholder="请输入备注" :inputBorder="false" /> 142 + <uni-easyinput type="textarea" v-model="form.remarks" placeholder="请输入备注" :inputBorder="false" maxlength="2000" />
127 </template> 143 </template>
128 </uni-list-item> 144 </uni-list-item>
129 <view class="quality"> 145 <view class="quality">
@@ -208,10 +224,11 @@ import SingleSelectSheet from '@/components/single-select/index.vue' @@ -208,10 +224,11 @@ import SingleSelectSheet from '@/components/single-select/index.vue'
208 import RelateSelectSheet from '@/components/relate-select/index.vue' 224 import RelateSelectSheet from '@/components/relate-select/index.vue'
209 import ProductRel from './productRel.vue' 225 import ProductRel from './productRel.vue'
210 import CitySelector from '@/components/city-selector/index.vue' 226 import CitySelector from '@/components/city-selector/index.vue'
211 -import { getRetailCodeApi, createContractApi,getCustomerRemarks,getCustomerSpecificQualityRequirements } from '@/api/contract' 227 +import { getRetailCodeApi, createContractApi,getCustomerRemarks,getCustomerSpecificQualityRequirements, getDeptApi } from '@/api/contract'
212 import { getDicByCodes } from '@/utils/dic' 228 import { getDicByCodes } from '@/utils/dic'
213 import { formatCurrencyToChinese } from '@/utils/common' 229 import { formatCurrencyToChinese } from '@/utils/common'
214 import { workshopQueryApi } from '@/api/devManage' 230 import { workshopQueryApi } from '@/api/devManage'
  231 +import { getArea } from '@/api/credit_manage.js'
215 232
216 export default { 233 export default {
217 name: 'AddContractStock', 234 name: 'AddContractStock',
@@ -224,6 +241,8 @@ export default { @@ -224,6 +241,8 @@ export default {
224 supplierName: '', 241 supplierName: '',
225 buyer: '', 242 buyer: '',
226 buyerName: '', 243 buyerName: '',
  244 + stockUpCompanyId: '',
  245 + stockUpCompanyName: '',
227 orderDate: '', 246 orderDate: '',
228 deliveryDate: '', 247 deliveryDate: '',
229 designatedConsignee: '', 248 designatedConsignee: '',
@@ -233,15 +252,19 @@ export default { @@ -233,15 +252,19 @@ export default {
233 executionStandardName: '', 252 executionStandardName: '',
234 executionStandardRemarks: '', 253 executionStandardRemarks: '',
235 includesPackagingFee: false, 254 includesPackagingFee: false,
236 - includesPackagingFeeName: '', 255 + includesPackagingFeeName: '',
237 includesTransportFee: false, 256 includesTransportFee: false,
238 - includesTransportFeeName: '', 257 + includesTransportFeeName: '',
239 unit: '元、公斤、元/公斤', 258 unit: '元、公斤、元/公斤',
240 totalAmountCapital: '', 259 totalAmountCapital: '',
241 destinationId: [], 260 destinationId: [],
242 destinationLabel: '', 261 destinationLabel: '',
243 workshopIdName: '', 262 workshopIdName: '',
244 workshopId: '', 263 workshopId: '',
  264 + deptName: '',
  265 + deptId: '',
  266 + region: '',
  267 + regionName: '',
245 remarks: '', 268 remarks: '',
246 component: '', 269 component: '',
247 packaging: '', 270 packaging: '',
@@ -263,12 +286,15 @@ export default { @@ -263,12 +286,15 @@ export default {
263 productList: [], 286 productList: [],
264 customerRemarks: [], 287 customerRemarks: [],
265 defaultRemark: '', 288 defaultRemark: '',
  289 + regionOptions: [],
266 } 290 }
267 }, 291 },
268 created() { 292 created() {
269 this.loadSuppliers() 293 this.loadSuppliers()
270 this.loadExtraOptions() 294 this.loadExtraOptions()
271 this.initCode() 295 this.initCode()
  296 + this.getDept()
  297 + this.loadRegionOptions()
272 this.form.orderDate = this.formatDate(new Date()) 298 this.form.orderDate = this.formatDate(new Date())
273 this.$nextTick(() => { 299 this.$nextTick(() => {
274 if (Array.isArray(this.form.destinationId) && this.form.destinationId.length) { 300 if (Array.isArray(this.form.destinationId) && this.form.destinationId.length) {
@@ -317,6 +343,24 @@ export default { @@ -317,6 +343,24 @@ export default {
317 }, 343 },
318 }, 344 },
319 methods: { 345 methods: {
  346 + async loadRegionOptions() {
  347 + try {
  348 + const res = await getArea()
  349 + const list = res.data || []
  350 + this.regionOptions = (list || []).map(it => ({ label: it.name || '', value: it.id || '' }))
  351 + } catch (e) {
  352 + this.regionOptions = []
  353 + }
  354 + },
  355 + // 查询当前人所在办事处
  356 + getDept() {
  357 + getDeptApi().then(res => {
  358 + if (res.code === 200) {
  359 + this.form.deptName = res.data.name || ''
  360 + this.form.deptId = res.data.id || ''
  361 + }
  362 + })
  363 + },
320 getHistory() { 364 getHistory() {
321 console.log('this.productLineList', this.productLineList[0].productId) 365 console.log('this.productLineList', this.productLineList[0].productId)
322 if (!this.productLineList.length || !this.productLineList[0].productId) { 366 if (!this.productLineList.length || !this.productLineList[0].productId) {
@@ -404,7 +448,7 @@ export default { @@ -404,7 +448,7 @@ export default {
404 }, 448 },
405 displayLabel(field) { 449 displayLabel(field) {
406 const m = this.form 450 const m = this.form
407 - const map = { supplierName: '请选择供方', buyerName: '请选择需方', workshopIdName: '请选择生产厂' } 451 + const map = { supplierName: '请选择供方', buyerName: '请选择需方', workshopIdName: '请选择生产厂', regionName: '请选择区域' }
408 const val = m[field] 452 const val = m[field]
409 return val ? String(val) : map[field] 453 return val ? String(val) : map[field]
410 }, 454 },
@@ -449,6 +493,8 @@ export default { @@ -449,6 +493,8 @@ export default {
449 setSheet('单价中是否已包含运费', this.yesNoList) 493 setSheet('单价中是否已包含运费', this.yesNoList)
450 } else if (field === 'historyRemarks') { 494 } else if (field === 'historyRemarks') {
451 setSheet('历史备注', this.customerRemarks) 495 setSheet('历史备注', this.customerRemarks)
  496 + } else if (field === 'region') {
  497 + setSheet('区域', this.regionOptions)
452 } 498 }
453 }, 499 },
454 onSheetConfirm({ value, label }) { 500 onSheetConfirm({ value, label }) {
@@ -467,6 +513,8 @@ export default { @@ -467,6 +513,8 @@ export default {
467 let config = {} 513 let config = {}
468 if (fieldKey === 'buyer') { 514 if (fieldKey === 'buyer') {
469 config = { title: '需方', source: 'customer', rowKey: 'id', multiple: false, display: [{ label: '姓名', field: 'name' }, { label: '编号', field: 'code' }, { label: '状态', field: 'available', format: v => (v ? '启用' : '停用') }] } 515 config = { title: '需方', source: 'customer', rowKey: 'id', multiple: false, display: [{ label: '姓名', field: 'name' }, { label: '编号', field: 'code' }, { label: '状态', field: 'available', format: v => (v ? '启用' : '停用') }] }
  516 + } else if (fieldKey === 'stockUpCompanyId') {
  517 + config = { title: '备货单位/人(生产标准)', source: 'customer', rowKey: 'id', multiple: false, display: [{ label: '姓名', field: 'name' }, { label: '编号', field: 'code' }, { label: '状态', field: 'available', format: v => (v ? '启用' : '停用') }] }
470 } 518 }
471 const selectedKeys = this.form[fieldKey] ? [this.form[fieldKey]] : [] 519 const selectedKeys = this.form[fieldKey] ? [this.form[fieldKey]] : []
472 this.sheet.visible = false 520 this.sheet.visible = false
@@ -477,7 +525,17 @@ export default { @@ -477,7 +525,17 @@ export default {
477 const _fieldKey = this.relate.fieldKey 525 const _fieldKey = this.relate.fieldKey
478 const first = (items && items.length > 0) ? items[0] : null 526 const first = (items && items.length > 0) ? items[0] : null
479 this.form[_fieldKey] = (first && first.id) ? first.id : '' 527 this.form[_fieldKey] = (first && first.id) ? first.id : ''
480 - this.form[_fieldKey + 'Name'] = (first && first.name) ? first.name : '' 528 +
  529 + if (_fieldKey === 'stockUpCompanyId') {
  530 + this.form.stockUpCompanyName = (first && first.name) ? first.name : ''
  531 + } else {
  532 + this.form[_fieldKey + 'Name'] = (first && first.name) ? first.name : ''
  533 + }
  534 +
  535 + if (_fieldKey === 'buyer') {
  536 + this.form.stockUpCompanyId = (first && first.id) ? first.id : ''
  537 + this.form.stockUpCompanyName = (first && first.name) ? first.name : ''
  538 + }
481 }, 539 },
482 onRadioSelect(field, nameField, opt) { 540 onRadioSelect(field, nameField, opt) {
483 const val = opt && opt.value != null ? opt.value : '' 541 const val = opt && opt.value != null ? opt.value : ''
@@ -543,6 +601,7 @@ export default { @@ -543,6 +601,7 @@ export default {
543 const empty = (val === undefined || val === null || (typeof val === 'string' && val.trim() === '') || (typeof val === 'number' && isNaN(val))) 601 const empty = (val === undefined || val === null || (typeof val === 'string' && val.trim() === '') || (typeof val === 'number' && isNaN(val)))
544 if (empty) { uni.showToast({ title: `请先选择${it.label}`, icon: 'none' }); return false } 602 if (empty) { uni.showToast({ title: `请先选择${it.label}`, icon: 'none' }); return false }
545 } 603 }
  604 + if (this.$refs.productRel && !this.$refs.productRel.validate()) return false
546 const list = Array.isArray(this.productLineList) ? this.productLineList : [] 605 const list = Array.isArray(this.productLineList) ? this.productLineList : []
547 if (list.length === 0) { 606 if (list.length === 0) {
548 uni.showToast({ title: '请至少添加一条产品明细', icon: 'none' }); return false 607 uni.showToast({ title: '请至少添加一条产品明细', icon: 'none' }); return false
@@ -4,16 +4,32 @@ @@ -4,16 +4,32 @@
4 <view class="detail-page"> 4 <view class="detail-page">
5 <view class="section"> 5 <view class="section">
6 <text class="row customer">{{ detail.code }}</text> 6 <text class="row customer">{{ detail.code }}</text>
7 - <view class="row" v-if="detail.status === 'STANDARD' || detail.status === 'FORMAL'"><text class="label">{{ detail.status === 'STANDARD' ? '标准合同' : '正式合同' }}规范性审核状态</text><text class="value"><span class="info-status" :style="detail.standardApprovedName ? getStatusCss(detail.standardApprovedName) : ''" >{{ detail.standardApprovedName || '-' }}</span></text></view> 7 + <view class="row" v-if="detail.status === 'STANDARD' || detail.status === 'FORMAL'">
  8 + <text class="label">{{ detail.status === 'STANDARD' ? '标准合同' : '正式合同' }}规范性审核状态</text>
  9 + <text class="value">
  10 +
  11 + <span v-if="detail.status === 'STANDARD'" class="info-status" :style="detail.standardApprovedName ? getStatusCss(detail.standardApprovedName) : ''" >{{ detail.standardApprovedName || '-' }}</span>
  12 + <span v-if="detail.status === 'FORMAL'" class="info-status" :style="detail.formalApprovedName ? getStatusCss(detail.formalApprovedName) : ''" >{{ detail.formalApprovedName || '-' }}</span>
  13 +
  14 + </text>
  15 + </view>
  16 + <view v-if="detail.status === 'STANDARD'" :class="['status', `status_${detail.shippingStatusName}`]" />
8 <view class="row"><text class="label">供方</text><text class="value">{{ detail.supplierName || '-' 17 <view class="row"><text class="label">供方</text><text class="value">{{ detail.supplierName || '-'
9 }}</text></view> 18 }}</text></view>
10 <view class="row"><text class="label">需方</text><text class="value">{{ detail.buyerName || '-' 19 <view class="row"><text class="label">需方</text><text class="value">{{ detail.buyerName || '-'
11 }}</text></view> 20 }}</text></view>
  21 + <view class="row"><text class="label">备货单位/人(生产标准)</text><text class="value">{{ detail.stockUpCompanyName || '-'
  22 + }}</text></view>
  23 +
12 <view class="row"><text class="label">订货日期</text><text class="value">{{ detail.orderDate }}</text> 24 <view class="row"><text class="label">订货日期</text><text class="value">{{ detail.orderDate }}</text>
13 </view> 25 </view>
14 <view class="row"><text class="label">单位</text><text class="value">{{ detail.unit }}</text></view> 26 <view class="row"><text class="label">单位</text><text class="value">{{ detail.unit }}</text></view>
15 <view class="row"><text class="label">生产厂</text><text class="value">{{ detail.workshopName || '-' 27 <view class="row"><text class="label">生产厂</text><text class="value">{{ detail.workshopName || '-'
16 - }}</text></view> 28 + }}</text></view>
  29 + <view class="row"><text class="label">办事处</text><text class="value">{{ detail.deptName || '-'
  30 + }}</text></view>
  31 + <view class="row"><text class="label">区域</text><text class="value">{{ detail.regionName || '-'
  32 + }}</text></view>
17 </view> 33 </view>
18 34
19 <view class="section1"> 35 <view class="section1">
@@ -108,7 +124,8 @@ @@ -108,7 +124,8 @@
108 </template> 124 </template>
109 125
110 <script> 126 <script>
111 -import { getContractApi, deleteContractApi, uploadFormalContract, uploadStandardContract, statusStyle } from '@/api/contract' 127 +import { getContractApi, deleteContractApi, uploadFormalContract, uploadStandardContract, statusStyle, statusMap } from '@/api/contract'
  128 +import { fillStandardApprovedName, fillFormalApprovedName } from '@/utils/dic.js'
112 import ProductRel from './productRel.vue' 129 import ProductRel from './productRel.vue'
113 import DetailButtons from '@/components/detail-buttons/index.vue' 130 import DetailButtons from '@/components/detail-buttons/index.vue'
114 import FileUpload from '@/components/file-upload/index.vue' 131 import FileUpload from '@/components/file-upload/index.vue'
@@ -130,6 +147,11 @@ export default { @@ -130,6 +147,11 @@ export default {
130 supplierName: '', 147 supplierName: '',
131 buyer: '', 148 buyer: '',
132 buyerName: '', 149 buyerName: '',
  150 + stockUpCompanyId: '',
  151 + stockUpCompanyName: '',
  152 + deptName: '',
  153 + region: '',
  154 + regionName: '',
133 orderDate: '', 155 orderDate: '',
134 unit: '', 156 unit: '',
135 workshopId: '', 157 workshopId: '',
@@ -162,6 +184,7 @@ export default { @@ -162,6 +184,7 @@ export default {
162 }, 184 },
163 productList: [], 185 productList: [],
164 statusStyle: statusStyle, 186 statusStyle: statusStyle,
  187 + statusMap: statusMap,
165 buttons: [{ 188 buttons: [{
166 text: '编辑', 189 text: '编辑',
167 visible: true, 190 visible: true,
@@ -223,19 +246,16 @@ export default { @@ -223,19 +246,16 @@ export default {
223 { 246 {
224 text: '正式合同审核详情', 247 text: '正式合同审核详情',
225 visible: true, 248 visible: true,
226 - variant: 'primary',  
227 event: 'auditDetail1' 249 event: 'auditDetail1'
228 }, 250 },
229 { 251 {
230 text: '正式合同审核详情', 252 text: '正式合同审核详情',
231 visible: true, 253 visible: true,
232 - variant: 'primary',  
233 event: 'auditDetail2' 254 event: 'auditDetail2'
234 }, 255 },
235 { 256 {
236 text: '标准合同审核详情', 257 text: '标准合同审核详情',
237 visible: true, 258 visible: true,
238 - variant: 'primary',  
239 event: 'auditDetail3' 259 event: 'auditDetail3'
240 }, 260 },
241 ], 261 ],
@@ -260,7 +280,7 @@ export default { @@ -260,7 +280,7 @@ export default {
260 { ...this.buttons[5], visible: (s === 'STANDARD' && a !== 'AUDIT' && a !== 'PASS' && this.$auth.hasPermi('contract-manage:distribution-inventory-contract:standard-upload')) }, 280 { ...this.buttons[5], visible: (s === 'STANDARD' && a !== 'AUDIT' && a !== 'PASS' && this.$auth.hasPermi('contract-manage:distribution-inventory-contract:standard-upload')) },
261 { ...this.buttons[6], visible: (s === 'FORMAL' && e && t === 'AUDIT' && this.$auth.hasPermi('contract-manage:distribution-inventory-contract:approve')) }, 281 { ...this.buttons[6], visible: (s === 'FORMAL' && e && t === 'AUDIT' && this.$auth.hasPermi('contract-manage:distribution-inventory-contract:approve')) },
262 { ...this.buttons[7], visible: (s === 'STANDARD' && e && t === 'AUDIT' && this.$auth.hasPermi('contract-manage:distribution-inventory-contract:approve')) }, 282 { ...this.buttons[7], visible: (s === 'STANDARD' && e && t === 'AUDIT' && this.$auth.hasPermi('contract-manage:distribution-inventory-contract:approve')) },
263 - { ...this.buttons[8], visible: (s === 'STANDARD' && f && a === 'AUDIT' && this.$auth.hasPermi('contract-manage:distribution-inventory-contract:restandard-approveview')) }, 283 + { ...this.buttons[8], visible: (s === 'STANDARD' && f && a === 'AUDIT' && this.$auth.hasPermi('contract-manage:distribution-inventory-contract:standard-approve')) },
264 { ...this.buttons[9], visible: (s === 'FORMAL' && t && this.$auth.hasPermi('contract-manage:distribution-inventory-contract:review')) }, 284 { ...this.buttons[9], visible: (s === 'FORMAL' && t && this.$auth.hasPermi('contract-manage:distribution-inventory-contract:review')) },
265 { ...this.buttons[10], visible: (s === 'STANDARD' && t && this.$auth.hasPermi('contract-manage:distribution-inventory-contract:review')) }, 285 { ...this.buttons[10], visible: (s === 'STANDARD' && t && this.$auth.hasPermi('contract-manage:distribution-inventory-contract:review')) },
266 { ...this.buttons[11], visible: (s === 'STANDARD' && a && this.$auth.hasPermi('contract-manage:distribution-inventory-contract:standard-review')) }, 286 { ...this.buttons[11], visible: (s === 'STANDARD' && a && this.$auth.hasPermi('contract-manage:distribution-inventory-contract:standard-review')) },
@@ -425,6 +445,8 @@ export default { @@ -425,6 +445,8 @@ export default {
425 destinationId: data.provinceId && data.cityId && data.districtId ? [data.provinceId, data.cityId, data.districtId] : '', 445 destinationId: data.provinceId && data.cityId && data.districtId ? [data.provinceId, data.cityId, data.districtId] : '',
426 destinationLabel: data.provinceName && data.cityName && data.districtName ? `${data.provinceName} / ${data.cityName} / ${data.districtName}` : '', 446 destinationLabel: data.provinceName && data.cityName && data.districtName ? `${data.provinceName} / ${data.cityName} / ${data.districtName}` : '',
427 } 447 }
  448 + this.detail = await fillStandardApprovedName(this.detail)
  449 + this.detail = await fillFormalApprovedName(this.detail)
428 const lines = Array.isArray(data.contractDistributorLineList) ? data.contractDistributorLineList : [] 450 const lines = Array.isArray(data.contractDistributorLineList) ? data.contractDistributorLineList : []
429 this.productList = lines 451 this.productList = lines
430 } catch (e) { 452 } catch (e) {
@@ -470,6 +492,32 @@ export default { @@ -470,6 +492,32 @@ export default {
470 padding: 32rpx; 492 padding: 32rpx;
471 background: #fff; 493 background: #fff;
472 margin-bottom: 20rpx; 494 margin-bottom: 20rpx;
  495 + .status {
  496 + position: absolute;
  497 + top: 16rpx;
  498 + right: 52rpx;
  499 + width: 180rpx;
  500 + height: 146rpx;
  501 + background-repeat: no-repeat;
  502 + background-size: 100% 100%;
  503 + background-position: center;
  504 +
  505 + &_审批中 {
  506 + background-image: url('~@/static/images/contract/status_1.png');
  507 + }
  508 +
  509 + &_生产中 {
  510 + background-image: url('~@/static/images/contract/status_2.png');
  511 + }
  512 +
  513 + &_已发货 {
  514 + background-image: url('~@/static/images/contract/status_3.png');
  515 + }
  516 +
  517 + &_已签收 {
  518 + background-image: url('~@/static/images/contract/status_4.png');
  519 + }
  520 + }
473 } 521 }
474 .section1 { 522 .section1 {
475 background: #fff; 523 background: #fff;
@@ -547,4 +595,4 @@ export default { @@ -547,4 +595,4 @@ export default {
547 color: rgba(0, 0, 0, 0.6); 595 color: rgba(0, 0, 0, 0.6);
548 font-size: 32rpx; 596 font-size: 32rpx;
549 } 597 }
550 -</style>  
  598 +</style>
@@ -105,13 +105,6 @@ export default { @@ -105,13 +105,6 @@ export default {
105 return { 105 return {
106 searchKeyword: '', 106 searchKeyword: '',
107 searchKeywordDebounced: '', 107 searchKeywordDebounced: '',
108 -  
109 - tabs: [  
110 - { label: '草稿合同', value: 'DRAFT' },  
111 - { label: '正式合同', value: 'FORMAL' },  
112 - { label: '标准合同', value: 'STANDARD' },  
113 - { label: '已删除合同', value: 'DELETED' }  
114 - ],  
115 status: 'DRAFT', 108 status: 'DRAFT',
116 109
117 query: { deptId: '', deptName: '', dateRange: [] }, 110 query: { deptId: '', deptName: '', dateRange: [] },
@@ -129,6 +122,25 @@ export default { @@ -129,6 +122,25 @@ export default {
129 } 122 }
130 }, 123 },
131 computed: { 124 computed: {
  125 + roleCodes() {
  126 + const g = this.$store && this.$store.getters
  127 + return (g && g.roleCodes) || []
  128 + },
  129 + tabs() {
  130 + if (this.roleCodes.includes('constract_admin')) {
  131 + return [
  132 + { label: '草稿合同', value: 'DRAFT' },
  133 + { label: '正式合同', value: 'FORMAL' },
  134 + { label: '标准合同', value: 'STANDARD' },
  135 + { label: '已删除合同', value: 'DELETED' }
  136 + ]
  137 + }
  138 + return [
  139 + { label: '草稿合同', value: 'DRAFT' },
  140 + { label: '正式合同', value: 'FORMAL' },
  141 + { label: '标准合同', value: 'STANDARD' }
  142 + ]
  143 + },
132 extraCombined() { 144 extraCombined() {
133 return { 145 return {
134 keyword: this.searchKeywordDebounced || undefined, 146 keyword: this.searchKeywordDebounced || undefined,
@@ -361,10 +373,10 @@ export default { @@ -361,10 +373,10 @@ export default {
361 margin-bottom: 0; 373 margin-bottom: 0;
362 } 374 }
363 text { 375 text {
364 - width: 60%; 376 + width: 50%;
365 &:last-child { 377 &:last-child {
366 color: rgba(0,0,0,0.9); 378 color: rgba(0,0,0,0.9);
367 - width: 40%; 379 + width: 50%;
368 } 380 }
369 } 381 }
370 } 382 }
@@ -40,9 +40,30 @@ @@ -40,9 +40,30 @@
40 <uni-easyinput v-model="item.quality" placeholder="请输入品质" :clearable="false" disabled /> 40 <uni-easyinput v-model="item.quality" placeholder="请输入品质" :clearable="false" disabled />
41 </template> 41 </template>
42 </uni-list-item> 42 </uni-list-item>
43 - <uni-list-item title="规格"> 43 + <uni-list-item title="规格(mm)">
44 <template v-slot:footer> 44 <template v-slot:footer>
45 - <uni-easyinput v-model="item.specDisplay" placeholder="自动拼接规格" :clearable="false" disabled /> 45 + <!-- <uni-easyinput v-model="item.specDisplay" placeholder="自动拼接规格" :clearable="false" disabled /> -->
  46 + <view class="value value-spec">
  47 + <view v-if="item.thickness" class="value-spec_val">{{ item.thickness }}</view>
  48 + <view v-if="item.thickness" class="value-spec_box">
  49 + <view v-if="item.thicknessTolPos" class="value-spec_box_1">+{{ item.thicknessTolPos }}
  50 + </view>
  51 + <view v-if="item.thicknessTolNeg" class="value-spec_box_2">-{{ item.thicknessTolNeg }}
  52 + </view>
  53 + </view>
  54 + <view v-if="item.width" class="value-spec_val p12">*</view>
  55 + <view v-if="item.width" class="value-spec_val">{{ item.width }}</view>
  56 + <view v-if="item.width" class="value-spec_box">
  57 + <view v-if="item.widthTolPos" class="value-spec_box_1">+{{ item.widthTolPos }}</view>
  58 + <view v-if="item.widthTolNeg" class="value-spec_box_2">-{{ item.widthTolNeg }}</view>
  59 + </view>
  60 + <view v-if="item.length" class="value-spec_val p12">*</view>
  61 + <view v-if="item.length" class="value-spec_val">{{ item.length }}</view>
  62 + <view v-if="item.length" class="value-spec_box">
  63 + <view v-if="item.lengthTolPos" class="value-spec_box_1">+{{ item.lengthTolPos }}</view>
  64 + <view v-if="item.lengthTolNeg" class="value-spec_box_2">-{{ item.lengthTolNeg }}</view>
  65 + </view>
  66 + </view>
46 </template> 67 </template>
47 </uni-list-item> 68 </uni-list-item>
48 <uni-list-item title="状态"> 69 <uni-list-item title="状态">
@@ -699,4 +720,42 @@ export default { @@ -699,4 +720,42 @@ export default {
699 background: $theme-primary; 720 background: $theme-primary;
700 color: #fff; 721 color: #fff;
701 } 722 }
  723 +.value-spec {
  724 + height: 48rpx;
  725 + display: flex;
  726 + align-items: center;
  727 + color: #000000;
  728 + // justify-content: end;
  729 + &_box {
  730 + position: relative;
  731 + width: 60rpx;
  732 + height: 48rpx;
  733 +
  734 + &_1 {
  735 + font-size: 16rpx;
  736 + position: absolute;
  737 + top: -10rpx;
  738 + left: 0;
  739 + }
  740 +
  741 + &_2 {
  742 + font-size: 16rpx;
  743 + position: absolute;
  744 + bottom: -10rpx;
  745 + left: 0;
  746 + }
  747 + }
  748 +
  749 + &_val {
  750 + font-size: 28rpx;
  751 +
  752 + &.p12 {
  753 + padding-right: 12rpx;
  754 + }
  755 + }
  756 + }
  757 + .row-spec {
  758 + height: 60rpx;
  759 + align-items: center;
  760 + }
702 </style> 761 </style>
@@ -22,6 +22,14 @@ @@ -22,6 +22,14 @@
22 </template> 22 </template>
23 </uni-list-item> 23 </uni-list-item>
24 24
  25 + <uni-list-item class="select-item" :class="form.stockUpCompanyId ? 'is-filled' : 'is-empty'" clickable
  26 + @click="openRelate('stockUpCompanyId')" :rightText="form.stockUpCompanyName || '请选择备货单位'" showArrow>
  27 + <template v-slot:body>
  28 + <view class="item-title"><text class="required">*</text><text>备货单位/人(生产标准)</text></view>
  29 + </template>
  30 + </uni-list-item>
  31 +
  32 +
25 <uni-list-item class="select-item" :class="form.workshopId ? 'is-filled' : 'is-empty'" clickable 33 <uni-list-item class="select-item" :class="form.workshopId ? 'is-filled' : 'is-empty'" clickable
26 @click="openSheet('workshopId')" :rightText="form.workshopName || '请选择生产厂'" showArrow> 34 @click="openSheet('workshopId')" :rightText="form.workshopName || '请选择生产厂'" showArrow>
27 <template v-slot:body> 35 <template v-slot:body>
@@ -40,8 +48,18 @@ @@ -40,8 +48,18 @@
40 <uni-easyinput v-model="form.unit" :inputBorder="false" disabled /> 48 <uni-easyinput v-model="form.unit" :inputBorder="false" disabled />
41 </template> 49 </template>
42 </uni-list-item> 50 </uni-list-item>
43 -  
44 - <ProductRel mode="add" :deliveryDate="form.orderDate" :deliveryDateBase="form.deliveryDate" :list="productLineList" @change="onProductsChange" :options="productList" /> 51 + <uni-list-item title="办事处">
  52 + <template v-slot:footer>
  53 + <uni-easyinput v-model="form.deptName" :inputBorder="false" disabled placeholder="自动获取" />
  54 + </template>
  55 + </uni-list-item>
  56 + <uni-list-item class="select-item" :class="form.region ? 'is-filled' : 'is-empty'" clickable
  57 + @click="openSheet('region')" :rightText="displayLabel('regionName')" showArrow>
  58 + <template v-slot:body>
  59 + <view class="item-title"><text class="required">*</text><text>区域</text></view>
  60 + </template>
  61 + </uni-list-item>
  62 + <ProductRel ref="productRel" mode="add" :deliveryDate="form.orderDate" :deliveryDateBase="form.deliveryDate" :list="productLineList" @change="onProductsChange" :options="productList" />
45 63
46 <uni-list-item title="合计人民币金额(大写)"> 64 <uni-list-item title="合计人民币金额(大写)">
47 <template v-slot:footer> 65 <template v-slot:footer>
@@ -124,7 +142,7 @@ @@ -124,7 +142,7 @@
124 </uni-list-item> 142 </uni-list-item>
125 <uni-list-item title="备注"> 143 <uni-list-item title="备注">
126 <template v-slot:footer> 144 <template v-slot:footer>
127 - <uni-easyinput v-model="form.remarks" placeholder="请输入备注" :inputBorder="false" /> 145 + <uni-easyinput v-model="form.remarks" placeholder="请输入备注" :inputBorder="false" maxlength="2000" />
128 </template> 146 </template>
129 </uni-list-item> 147 </uni-list-item>
130 148
@@ -195,10 +213,11 @@ import SingleSelectSheet from '@/components/single-select/index.vue' @@ -195,10 +213,11 @@ import SingleSelectSheet from '@/components/single-select/index.vue'
195 import RelateSelectSheet from '@/components/relate-select/index.vue' 213 import RelateSelectSheet from '@/components/relate-select/index.vue'
196 import ProductRel from './productRel.vue' 214 import ProductRel from './productRel.vue'
197 import CitySelector from '@/components/city-selector/index.vue' 215 import CitySelector from '@/components/city-selector/index.vue'
198 -import { getContractApi, updateContractApi } from '@/api/contract' 216 +import { getContractApi, updateContractApi, getDeptApi } from '@/api/contract'
199 import { getDicByCodes } from '@/utils/dic' 217 import { getDicByCodes } from '@/utils/dic'
200 import { formatCurrencyToChinese } from '@/utils/common' 218 import { formatCurrencyToChinese } from '@/utils/common'
201 import { workshopQueryApi } from '@/api/devManage' 219 import { workshopQueryApi } from '@/api/devManage'
  220 +import { getArea } from '@/api/credit_manage.js'
202 export default { 221 export default {
203 name: 'ModifyContractStock', 222 name: 'ModifyContractStock',
204 components: { SingleSelectSheet, RelateSelectSheet, ProductRel, CitySelector }, 223 components: { SingleSelectSheet, RelateSelectSheet, ProductRel, CitySelector },
@@ -212,8 +231,14 @@ export default { @@ -212,8 +231,14 @@ export default {
212 supplierName: '', 231 supplierName: '',
213 buyer: '', 232 buyer: '',
214 buyerName: '', 233 buyerName: '',
  234 + stockUpCompanyId: '',
  235 + stockUpCompanyName: '',
215 workshopId: '', 236 workshopId: '',
216 workshopName: '', 237 workshopName: '',
  238 + deptName: '',
  239 + deptId: '',
  240 + region: '',
  241 + regionName: '',
217 orderDate: '', 242 orderDate: '',
218 deliveryDate: '', 243 deliveryDate: '',
219 designatedConsignee: '', 244 designatedConsignee: '',
@@ -223,9 +248,9 @@ export default { @@ -223,9 +248,9 @@ export default {
223 executionStandardName: '', 248 executionStandardName: '',
224 executionStandardRemarks: '', 249 executionStandardRemarks: '',
225 includesPackagingFee: false, 250 includesPackagingFee: false,
226 - includesPackagingFeeName: '', 251 + includesPackagingFeeName: '',
227 includesTransportFee: false, 252 includesTransportFee: false,
228 - includesTransportFeeName: '', 253 + includesTransportFeeName: '',
229 unit: '元、公斤、元/公斤', 254 unit: '元、公斤、元/公斤',
230 totalAmountCapital: '', 255 totalAmountCapital: '',
231 depositInfo: '', 256 depositInfo: '',
@@ -254,7 +279,8 @@ export default { @@ -254,7 +279,8 @@ export default {
254 totalAmountIncludingTax: 0, 279 totalAmountIncludingTax: 0,
255 productLineList: [], 280 productLineList: [],
256 newProductLineList: [], 281 newProductLineList: [],
257 - productList: [] 282 + productList: [],
  283 + regionOptions: [],
258 } 284 }
259 }, 285 },
260 onLoad(query) { 286 onLoad(query) {
@@ -264,6 +290,7 @@ export default { @@ -264,6 +290,7 @@ export default {
264 this.loadSuppliers() 290 this.loadSuppliers()
265 this.loadExtraOptions() 291 this.loadExtraOptions()
266 this.loadDetail() 292 this.loadDetail()
  293 + this.loadRegionOptions()
267 this.$nextTick(() => { 294 this.$nextTick(() => {
268 if (Array.isArray(this.form.destinationId) && this.form.destinationId.length) { 295 if (Array.isArray(this.form.destinationId) && this.form.destinationId.length) {
269 this.initDestinationLabel() 296 this.initDestinationLabel()
@@ -271,6 +298,15 @@ export default { @@ -271,6 +298,15 @@ export default {
271 }) 298 })
272 }, 299 },
273 methods: { 300 methods: {
  301 + async loadRegionOptions() {
  302 + try {
  303 + const res = await getArea()
  304 + const list = res.data || []
  305 + this.regionOptions = (list || []).map(it => ({ label: it.name || '', value: it.id || '' }))
  306 + } catch (e) {
  307 + this.regionOptions = []
  308 + }
  309 + },
274 async loadDetail() { 310 async loadDetail() {
275 if (!this.id) return 311 if (!this.id) return
276 try { 312 try {
@@ -287,6 +323,12 @@ export default { @@ -287,6 +323,12 @@ export default {
287 supplierName: m.supplierName || '', 323 supplierName: m.supplierName || '',
288 buyer: m.buyer || (m.customer && m.customer.id) || '', 324 buyer: m.buyer || (m.customer && m.customer.id) || '',
289 buyerName: m.buyerName || (m.customer && m.customer.name) || '', 325 buyerName: m.buyerName || (m.customer && m.customer.name) || '',
  326 + stockUpCompanyId: m.stockUpCompanyId || '',
  327 + stockUpCompanyName: m.stockUpCompanyName || '',
  328 + deptName: m.deptName || '',
  329 + deptId: m.deptId || '',
  330 + region: m.region || '',
  331 + regionName: m.regionName || '',
290 orderDate: m.orderDate || '', 332 orderDate: m.orderDate || '',
291 designatedConsignee: m.designatedConsignee || '', 333 designatedConsignee: m.designatedConsignee || '',
292 specialTerms: m.specialTerms || '', 334 specialTerms: m.specialTerms || '',
@@ -371,7 +413,7 @@ export default { @@ -371,7 +413,7 @@ export default {
371 }, 413 },
372 displayLabel(field) { 414 displayLabel(field) {
373 const m = this.form 415 const m = this.form
374 - const map = { supplierName: '请选择供方', buyerName: '请选择需方', workshopName: '请选择生产厂' } 416 + const map = { supplierName: '请选择供方', buyerName: '请选择需方', workshopName: '请选择生产厂', regionName: '请选择区域' }
375 const val = m[field] 417 const val = m[field]
376 return val ? String(val) : map[field] 418 return val ? String(val) : map[field]
377 }, 419 },
@@ -400,6 +442,8 @@ export default { @@ -400,6 +442,8 @@ export default {
400 setSheet('单价中是否已包含包装费', this.yesNoList) 442 setSheet('单价中是否已包含包装费', this.yesNoList)
401 } else if (field === 'includesTransportFee') { 443 } else if (field === 'includesTransportFee') {
402 setSheet('单价中是否已包含运费', this.yesNoList) 444 setSheet('单价中是否已包含运费', this.yesNoList)
  445 + } else if (field === 'region') {
  446 + setSheet('区域', this.regionOptions)
403 } 447 }
404 }, 448 },
405 onSheetConfirm({ value, label }) { 449 onSheetConfirm({ value, label }) {
@@ -449,6 +493,7 @@ export default { @@ -449,6 +493,7 @@ export default {
449 const empty = (val === undefined || val === null || (typeof val === 'string' && val.trim() === '') || (typeof val === 'number' && isNaN(val))) 493 const empty = (val === undefined || val === null || (typeof val === 'string' && val.trim() === '') || (typeof val === 'number' && isNaN(val)))
450 if (empty) { uni.showToast({ title: `请先选择${it.label}`, icon: 'none' }); return false } 494 if (empty) { uni.showToast({ title: `请先选择${it.label}`, icon: 'none' }); return false }
451 } 495 }
  496 + if (!this.$refs.productRel.validate()) return false
452 const list = Array.isArray(this.newProductLineList) ? this.newProductLineList : [] 497 const list = Array.isArray(this.newProductLineList) ? this.newProductLineList : []
453 if (list.length === 0) { 498 if (list.length === 0) {
454 uni.showToast({ title: '请至少添加一条产品明细', icon: 'none' }); return false 499 uni.showToast({ title: '请至少添加一条产品明细', icon: 'none' }); return false
@@ -55,51 +55,51 @@ @@ -55,51 +55,51 @@
55 </uni-list-item> 55 </uni-list-item>
56 <uni-list-item title="厚度(mm)"> 56 <uni-list-item title="厚度(mm)">
57 <template v-slot:footer> 57 <template v-slot:footer>
58 - <uni-easyinput type="digit" v-model="item.thickness" :inputBorder="false" placeholder="请输入厚度" @input="onNonNegativeInput(idx, 'thickness')" @blur="onNonNegativeBlur(idx, 'thickness', 2)" /> 58 + <uni-easyinput type="digit" v-model="item.thickness" :inputBorder="false" placeholder="请输入厚度" @input="onNonNegativeInput(idx, 'thickness')" @blur="onNonNegativeBlur(idx, 'thickness', 9)" />
59 </template> 59 </template>
60 </uni-list-item> 60 </uni-list-item>
61 <uni-list-item title="厚度公差上限(mm)"> 61 <uni-list-item title="厚度公差上限(mm)">
62 <template v-slot:footer> 62 <template v-slot:footer>
63 - <uni-easyinput type="digit" v-model="item.thicknessTolPos" :inputBorder="false"  
64 - placeholder="请输入厚度公差上限" @input="onNonNegativeInput(idx, 'thicknessTolPos')" @blur="onNonNegativeBlur(idx, 'thicknessTolPos', 2)" /> 63 + <uni-easyinput type="text" v-model="item.thicknessTolPos" :inputBorder="false"
  64 + placeholder="请输入厚度公差上限" @input="onNumberInput(idx, 'thicknessTolPos')" @blur="onNumberBlur(idx, 'thicknessTolPos', 9)" />
65 </template> 65 </template>
66 </uni-list-item> 66 </uni-list-item>
67 <uni-list-item title="厚度公差下限(mm)"> 67 <uni-list-item title="厚度公差下限(mm)">
68 <template v-slot:footer> 68 <template v-slot:footer>
69 - <uni-easyinput type="digit" v-model="item.thicknessTolNeg" :inputBorder="false"  
70 - placeholder="请输入厚度公差下限" @input="onNonNegativeInput(idx, 'thicknessTolNeg')" @blur="onNonNegativeBlur(idx, 'thicknessTolNeg', 2)" /> 69 + <uni-easyinput type="text" v-model="item.thicknessTolNeg" :inputBorder="false"
  70 + placeholder="请输入厚度公差下限" @input="onNumberInput(idx, 'thicknessTolNeg')" @blur="onNumberBlur(idx, 'thicknessTolNeg', 9)" />
71 </template> 71 </template>
72 </uni-list-item> 72 </uni-list-item>
73 <uni-list-item title="宽度(mm)"> 73 <uni-list-item title="宽度(mm)">
74 <template v-slot:footer> 74 <template v-slot:footer>
75 - <uni-easyinput type="digit" v-model="item.width" :inputBorder="false" placeholder="请输入宽度" @input="onNonNegativeInput(idx, 'width')" @blur="onNonNegativeBlur(idx, 'width', 2)" /> 75 + <uni-easyinput type="digit" v-model="item.width" :inputBorder="false" placeholder="请输入宽度" @input="onNonNegativeInput(idx, 'width')" @blur="onNonNegativeBlur(idx, 'width', 9)" />
76 </template> 76 </template>
77 </uni-list-item> 77 </uni-list-item>
78 <uni-list-item title="宽度公差上限(mm)"> 78 <uni-list-item title="宽度公差上限(mm)">
79 <template v-slot:footer> 79 <template v-slot:footer>
80 - <uni-easyinput type="digit" v-model="item.widthTolPos" :inputBorder="false" placeholder="请输入宽度公差上限" @input="onNonNegativeInput(idx, 'widthTolPos')" @blur="onNonNegativeBlur(idx, 'widthTolPos', 2)" /> 80 + <uni-easyinput type="text" v-model="item.widthTolPos" :inputBorder="false" placeholder="请输入宽度公差上限" @input="onNumberInput(idx, 'widthTolPos')" @blur="onNumberBlur(idx, 'widthTolPos', 9)" />
81 </template> 81 </template>
82 </uni-list-item> 82 </uni-list-item>
83 <uni-list-item title="宽度公差下限(mm)"> 83 <uni-list-item title="宽度公差下限(mm)">
84 <template v-slot:footer> 84 <template v-slot:footer>
85 - <uni-easyinput type="digit" v-model="item.widthTolNeg" :inputBorder="false" placeholder="请输入宽度公差下限" @input="onNonNegativeInput(idx, 'widthTolNeg')" @blur="onNonNegativeBlur(idx, 'widthTolNeg', 2)" /> 85 + <uni-easyinput type="text" v-model="item.widthTolNeg" :inputBorder="false" placeholder="请输入宽度公差下限" @input="onNumberInput(idx, 'widthTolNeg')" @blur="onNumberBlur(idx, 'widthTolNeg', 9)" />
86 </template> 86 </template>
87 </uni-list-item> 87 </uni-list-item>
88 <uni-list-item title="长度(mm)"> 88 <uni-list-item title="长度(mm)">
89 <template v-slot:footer> 89 <template v-slot:footer>
90 - <uni-easyinput type="digit" v-model="item.length" :inputBorder="false" placeholder="请输入长度" @input="onNonNegativeInput(idx, 'length')" @blur="onNonNegativeBlur(idx, 'length', 2)" /> 90 + <uni-easyinput type="digit" v-model="item.length" :inputBorder="false" placeholder="请输入长度" @input="onNonNegativeInput(idx, 'length')" @blur="onNonNegativeBlur(idx, 'length', 9)" />
91 </template> 91 </template>
92 </uni-list-item> 92 </uni-list-item>
93 <uni-list-item title="长度公差上限(mm)"> 93 <uni-list-item title="长度公差上限(mm)">
94 <template v-slot:footer> 94 <template v-slot:footer>
95 - <uni-easyinput type="digit" v-model="item.lengthTolPos" :inputBorder="false"  
96 - placeholder="请输入长度公差上限" @input="onNonNegativeInput(idx, 'lengthTolPos')" @blur="onNonNegativeBlur(idx, 'lengthTolPos', 2)" /> 95 + <uni-easyinput type="text" v-model="item.lengthTolPos" :inputBorder="false"
  96 + placeholder="请输入长度公差上限" @input="onNumberInput(idx, 'lengthTolPos')" @blur="onNumberBlur(idx, 'lengthTolPos', 9)" />
97 </template> 97 </template>
98 </uni-list-item> 98 </uni-list-item>
99 <uni-list-item title="长度公差下限(mm)"> 99 <uni-list-item title="长度公差下限(mm)">
100 <template v-slot:footer> 100 <template v-slot:footer>
101 - <uni-easyinput type="digit" v-model="item.lengthTolNeg" :inputBorder="false"  
102 - placeholder="请输入长度公差下限" @input="onNonNegativeInput(idx, 'lengthTolNeg')" @blur="onNonNegativeBlur(idx, 'lengthTolNeg', 2)" /> 101 + <uni-easyinput type="text" v-model="item.lengthTolNeg" :inputBorder="false"
  102 + placeholder="请输入长度公差下限" @input="onNumberInput(idx, 'lengthTolNeg')" @blur="onNumberBlur(idx, 'lengthTolNeg', 9)" />
103 </template> 103 </template>
104 </uni-list-item> 104 </uni-list-item>
105 <uni-list-item title="状态"> 105 <uni-list-item title="状态">
@@ -109,12 +109,12 @@ @@ -109,12 +109,12 @@
109 </uni-list-item> 109 </uni-list-item>
110 <uni-list-item title="数量"> 110 <uni-list-item title="数量">
111 <template v-slot:footer> 111 <template v-slot:footer>
112 - <uni-easyinput v-model="item.quantity" type="digit" :inputBorder="false" placeholder="请输入数量kg" @input="onNonNegativeInput(idx, 'quantity')" @blur="onNonNegativeBlur(idx, 'quantity', 2)" /> 112 + <uni-easyinput v-model="item.quantity" type="digit" :inputBorder="false" placeholder="请输入数量kg" @input="onNonNegativeInput(idx, 'quantity')" @blur="onNonNegativeBlur(idx, 'quantity', 9)" />
113 </template> 113 </template>
114 </uni-list-item> 114 </uni-list-item>
115 <uni-list-item title="单价"> 115 <uni-list-item title="单价">
116 <template v-slot:footer> 116 <template v-slot:footer>
117 - <uni-easyinput v-model="item.unitPrice" type="digit" :inputBorder="false" disabled placeholder="请输入销售价格" @input="onNonNegativeInput(idx, 'unitPrice')" @blur="onNonNegativeBlur(idx, 'unitPrice', 2)" /> 117 + <uni-easyinput v-model="item.unitPrice" type="digit" :inputBorder="false" disabled placeholder="请输入销售价格" @input="onNonNegativeInput(idx, 'unitPrice')" @blur="onNonNegativeBlur(idx, 'unitPrice', 9)" />
118 </template> 118 </template>
119 </uni-list-item> 119 </uni-list-item>
120 <uni-list-item title="不含税金额"> 120 <uni-list-item title="不含税金额">
@@ -257,6 +257,110 @@ export default { @@ -257,6 +257,110 @@ export default {
257 this.recalculateAll() 257 this.recalculateAll()
258 }, 258 },
259 methods: { 259 methods: {
  260 + onNumberInput(idx, field) {
  261 + const it = this.items[idx]
  262 + if (!it) return
  263 + let v = String(it[field] != null ? it[field] : '')
  264 + // Allow numbers, decimal point, and negative sign
  265 + // But since this is a simple input, maybe just allow everything and validate later?
  266 + // Or better, restrict to valid number characters: 0-9, ., -
  267 + v = v.replace(/[^0-9.-]/g, '')
  268 +
  269 + // Handle multiple dots: keep only the first one
  270 + const parts = v.split('.')
  271 + if (parts.length > 2) {
  272 + v = parts[0] + '.' + parts.slice(1).join('')
  273 + }
  274 +
  275 + // Handle multiple negative signs: keep only at start
  276 + if (v.indexOf('-') > 0) {
  277 + v = v.replace(/-/g, '') // remove all
  278 + // Logic to put it back is complex if user types in middle,
  279 + // but standard behavior is usually just stripping invalid ones.
  280 + // Let's just strip non-leading minus
  281 + }
  282 + // A simpler regex approach for "start with optional minus, then digits/dots" is hard in one replace.
  283 + // Let's stick to a simple cleanup:
  284 +
  285 + // 1. Remove anything that is not digit, dot, or minus
  286 + v = v.replace(/[^0-9.-]/g, '')
  287 +
  288 + // 2. Ensure minus is only at index 0
  289 + if (v.lastIndexOf('-') > 0) {
  290 + v = (v.startsWith('-') ? '-' : '') + v.replace(/-/g, '')
  291 + }
  292 +
  293 + // 3. Ensure only one dot
  294 + const firstDotIndex = v.indexOf('.')
  295 + if (firstDotIndex !== -1) {
  296 + const before = v.substring(0, firstDotIndex + 1)
  297 + const after = v.substring(firstDotIndex + 1).replace(/\./g, '')
  298 + v = before + after
  299 + }
  300 +
  301 + // 4. If it starts with dot (or -. ), maybe prefix 0?
  302 + // -0.5 is valid. .5 is valid (becomes 0.5). -.5 becomes -0.5
  303 + if (v.startsWith('.')) v = '0' + v
  304 + if (v.startsWith('-.')) v = '-0' + v.substring(1)
  305 +
  306 + it[field] = v
  307 + this.$set(this.items, idx, it)
  308 + },
  309 + onNumberBlur(idx, field, digits) {
  310 + const it = this.items[idx]
  311 + if (!it) return
  312 + const raw = it[field]
  313 + if (raw === '' || raw === null || raw === undefined || raw === '-') {
  314 + // if just "-", clear it? or keep it? usually clear or 0.
  315 + // If it's optional tolerance, maybe empty string is better than 0 if user cleared it.
  316 + // But previously we used 0 for numbers.
  317 + // However, for tolerances, empty might mean "no tolerance specified".
  318 + // Let's check existing logic. onNonNegativeBlur sets to 0 if empty/invalid.
  319 + // For tolerance, maybe we want to allow empty?
  320 + // The requirement says "两个都有值时,上限 要大于 下限".
  321 + // If I set to 0, then 0 > 0 is false.
  322 + // Let's assume empty is allowed.
  323 + // But wait, "number type".
  324 + // Let's try to parse.
  325 + if (raw === '' || raw === null || raw === undefined) {
  326 + this.$set(this.items, idx, it)
  327 + return
  328 + }
  329 + }
  330 +
  331 + let num = this.toNumber(raw)
  332 + if (isNaN(num)) {
  333 + // If invalid input, maybe reset to empty or 0?
  334 + // Let's set to 0 if it was required, but tolerance might be optional.
  335 + // If the user entered garbage, clear it.
  336 + it[field] = ''
  337 + } else {
  338 + const rounded = this.round(num, digits)
  339 + it[field] = rounded
  340 + }
  341 + this.$set(this.items, idx, it)
  342 + },
  343 + validate() {
  344 + for (let i = 0; i < this.items.length; i++) {
  345 + const it = this.items[i]
  346 + const check = (pos, neg, label) => {
  347 + if (pos !== '' && pos !== null && pos !== undefined &&
  348 + neg !== '' && neg !== null && neg !== undefined) {
  349 + if (Number(pos) <= Number(neg)) {
  350 + return `第${i + 1}行产品:${label}公差上限必须大于下限`
  351 + }
  352 + }
  353 + return null
  354 + }
  355 + let err = check(it.thicknessTolPos, it.thicknessTolNeg, '厚度')
  356 + if (err) { uni.showToast({ title: err, icon: 'none' }); return false }
  357 + err = check(it.widthTolPos, it.widthTolNeg, '宽度')
  358 + if (err) { uni.showToast({ title: err, icon: 'none' }); return false }
  359 + err = check(it.lengthTolPos, it.lengthTolNeg, '长度')
  360 + if (err) { uni.showToast({ title: err, icon: 'none' }); return false }
  361 + }
  362 + return true
  363 + },
260 defaultItem() { 364 defaultItem() {
261 return { productId: '', productName: '', industry: '', brand: '', quality: '', thickness: '', thicknessTolPos: '', thicknessTolNeg: '', width: '', widthTolPos: '', widthTolNeg: '', length: '', lengthTolPos: '', lengthTolNeg: '', status: '', quantity: '', unitPrice: '', amountExcludingTax: 0, totalAmount: 0, deliveryDate: '' } 365 return { productId: '', productName: '', industry: '', brand: '', quality: '', thickness: '', thicknessTolPos: '', thicknessTolNeg: '', width: '', widthTolPos: '', widthTolNeg: '', length: '', lengthTolPos: '', lengthTolNeg: '', status: '', quantity: '', unitPrice: '', amountExcludingTax: 0, totalAmount: 0, deliveryDate: '' }
262 }, 366 },
@@ -339,11 +339,11 @@ export default { @@ -339,11 +339,11 @@ export default {
339 } 339 }
340 340
341 text { 341 text {
342 - width: 60%; 342 + width: 50%;
343 343
344 &:last-child { 344 &:last-child {
345 color: rgba(0, 0, 0, 0.9); 345 color: rgba(0, 0, 0, 0.9);
346 - width: 40%; 346 + width: 50%;
347 } 347 }
348 } 348 }
349 } 349 }
@@ -21,6 +21,13 @@ @@ -21,6 +21,13 @@
21 <view class="item-title"><text class="required">*</text><text>需方</text></view> 21 <view class="item-title"><text class="required">*</text><text>需方</text></view>
22 </template> 22 </template>
23 </uni-list-item> 23 </uni-list-item>
  24 + <uni-list-item class="select-item" :class="form.stockUpCompanyId ? 'is-filled' : 'is-empty'" clickable
  25 + @click="openRelate('stockUpCompanyId')" :rightText="form.stockUpCompanyName || '请选择备货单位'" showArrow>
  26 + <template v-slot:body>
  27 + <view class="item-title"><text class="required">*</text><text>备货单位/人(生产标准)</text></view>
  28 + </template>
  29 + </uni-list-item>
  30 +
24 31
25 <uni-list-item title="订货日期"> 32 <uni-list-item title="订货日期">
26 <template v-slot:footer> 33 <template v-slot:footer>
@@ -39,7 +46,18 @@ @@ -39,7 +46,18 @@
39 <view class="item-title"><text class="required">*</text><text>生产厂</text></view> 46 <view class="item-title"><text class="required">*</text><text>生产厂</text></view>
40 </template> 47 </template>
41 </uni-list-item> 48 </uni-list-item>
42 - <ProductRel mode="add" :deliveryDate="form.orderDate" :deliveryDateBase="form.deliveryDate" @change="onProductsChange" :options="productList" /> 49 + <uni-list-item title="办事处">
  50 + <template v-slot:footer>
  51 + <uni-easyinput v-model="form.deptName" :inputBorder="false" disabled placeholder="自动获取" />
  52 + </template>
  53 + </uni-list-item>
  54 + <uni-list-item class="select-item" :class="form.region ? 'is-filled' : 'is-empty'" clickable
  55 + @click="openSheet('region')" :rightText="displayLabel('regionName')" showArrow>
  56 + <template v-slot:body>
  57 + <view class="item-title"><text class="required">*</text><text>区域</text></view>
  58 + </template>
  59 + </uni-list-item>
  60 + <ProductRel ref="productRel" mode="add" :deliveryDate="form.orderDate" :deliveryDateBase="form.deliveryDate" @change="onProductsChange" :options="productList" />
43 <uni-list-item title="合计人民币金额(大写)"> 61 <uni-list-item title="合计人民币金额(大写)">
44 <template v-slot:footer> 62 <template v-slot:footer>
45 <uni-easyinput v-model="form.totalAmountCapital" placeholder="自动计算" :inputBorder="false" disabled /> 63 <uni-easyinput v-model="form.totalAmountCapital" placeholder="自动计算" :inputBorder="false" disabled />
@@ -123,7 +141,7 @@ @@ -123,7 +141,7 @@
123 </uni-list-item> 141 </uni-list-item>
124 <uni-list-item title="备注"> 142 <uni-list-item title="备注">
125 <template v-slot:footer> 143 <template v-slot:footer>
126 - <uni-easyinput type="textarea" v-model="form.remarks" placeholder="请输入备注" :inputBorder="false" /> 144 + <uni-easyinput type="textarea" v-model="form.remarks" placeholder="请输入备注" :inputBorder="false" maxlength="2000" />
127 </template> 145 </template>
128 </uni-list-item> 146 </uni-list-item>
129 <view class="quality"> 147 <view class="quality">
@@ -208,10 +226,11 @@ import SingleSelectSheet from '@/components/single-select/index.vue' @@ -208,10 +226,11 @@ import SingleSelectSheet from '@/components/single-select/index.vue'
208 import RelateSelectSheet from '@/components/relate-select/index.vue' 226 import RelateSelectSheet from '@/components/relate-select/index.vue'
209 import ProductRel from './productRel.vue' 227 import ProductRel from './productRel.vue'
210 import CitySelector from '@/components/city-selector/index.vue' 228 import CitySelector from '@/components/city-selector/index.vue'
211 -import { getRetailCodeApi, createContractApi, getCustomerRemarks,getCustomerSpecificQualityRequirements } from '@/api/contract' 229 +import { getRetailCodeApi, createContractApi, getCustomerRemarks,getCustomerSpecificQualityRequirements, getDeptApi } from '@/api/contract'
212 import { getDicByCodes } from '@/utils/dic' 230 import { getDicByCodes } from '@/utils/dic'
213 import { formatCurrencyToChinese } from '@/utils/common' 231 import { formatCurrencyToChinese } from '@/utils/common'
214 import { workshopQueryApi } from '@/api/devManage' 232 import { workshopQueryApi } from '@/api/devManage'
  233 +import { getArea } from '@/api/credit_manage.js'
215 234
216 export default { 235 export default {
217 name: 'AddContractUnplan', 236 name: 'AddContractUnplan',
@@ -224,6 +243,8 @@ export default { @@ -224,6 +243,8 @@ export default {
224 supplierName: '', 243 supplierName: '',
225 buyer: '', 244 buyer: '',
226 buyerName: '', 245 buyerName: '',
  246 + stockUpCompanyId: '',
  247 + stockUpCompanyName: '',
227 orderDate: '', 248 orderDate: '',
228 deliveryDate: '', 249 deliveryDate: '',
229 designatedConsignee: '', 250 designatedConsignee: '',
@@ -233,15 +254,19 @@ export default { @@ -233,15 +254,19 @@ export default {
233 executionStandardName: '', 254 executionStandardName: '',
234 executionStandardRemarks: '', 255 executionStandardRemarks: '',
235 includesPackagingFee: false, 256 includesPackagingFee: false,
236 - includesPackagingFeeName: '', 257 + includesPackagingFeeName: '',
237 includesTransportFee: false, 258 includesTransportFee: false,
238 - includesTransportFeeName: '', 259 + includesTransportFeeName: '',
239 unit: '元、公斤、元/公斤', 260 unit: '元、公斤、元/公斤',
240 totalAmountCapital: '', 261 totalAmountCapital: '',
241 destinationId: [], 262 destinationId: [],
242 destinationLabel: '', 263 destinationLabel: '',
243 workshopIdName: '', 264 workshopIdName: '',
244 workshopId: '', 265 workshopId: '',
  266 + deptName: '',
  267 + deptId: '',
  268 + region: '',
  269 + regionName: '',
245 remarks: '', 270 remarks: '',
246 component: '', 271 component: '',
247 packaging: '', 272 packaging: '',
@@ -263,12 +288,15 @@ export default { @@ -263,12 +288,15 @@ export default {
263 productList: [], 288 productList: [],
264 customerRemarks: [], 289 customerRemarks: [],
265 defaultRemark: '', 290 defaultRemark: '',
  291 + regionOptions: [],
266 } 292 }
267 }, 293 },
268 created() { 294 created() {
269 this.loadSuppliers() 295 this.loadSuppliers()
270 this.loadExtraOptions() 296 this.loadExtraOptions()
271 this.initCode() 297 this.initCode()
  298 + this.getDept()
  299 + this.loadRegionOptions()
272 this.form.orderDate = this.formatDate(new Date()) 300 this.form.orderDate = this.formatDate(new Date())
273 this.$nextTick(() => { 301 this.$nextTick(() => {
274 if (Array.isArray(this.form.destinationId) && this.form.destinationId.length) { 302 if (Array.isArray(this.form.destinationId) && this.form.destinationId.length) {
@@ -319,6 +347,24 @@ export default { @@ -319,6 +347,24 @@ export default {
319 }, 347 },
320 }, 348 },
321 methods: { 349 methods: {
  350 + async loadRegionOptions() {
  351 + try {
  352 + const res = await getArea()
  353 + const list = res.data || []
  354 + this.regionOptions = (list || []).map(it => ({ label: it.name || '', value: it.id || '' }))
  355 + } catch (e) {
  356 + this.regionOptions = []
  357 + }
  358 + },
  359 + // 查询当前人所在办事处
  360 + getDept() {
  361 + getDeptApi().then(res => {
  362 + if (res.code === 200) {
  363 + this.form.deptName = res.data.name || ''
  364 + this.form.deptId = res.data.id || ''
  365 + }
  366 + })
  367 + },
322 getHistory() { 368 getHistory() {
323 console.log('this.productLineList', this.productLineList[0].productId) 369 console.log('this.productLineList', this.productLineList[0].productId)
324 if (!this.productLineList.length || !this.productLineList[0].productId) { 370 if (!this.productLineList.length || !this.productLineList[0].productId) {
@@ -407,7 +453,7 @@ export default { @@ -407,7 +453,7 @@ export default {
407 }, 453 },
408 displayLabel(field) { 454 displayLabel(field) {
409 const m = this.form 455 const m = this.form
410 - const map = { supplierName: '请选择供方', buyerName: '请选择需方', workshopIdName: '请选择生产厂' } 456 + const map = { supplierName: '请选择供方', buyerName: '请选择需方', workshopIdName: '请选择生产厂', regionName: '请选择区域' }
411 const val = m[field] 457 const val = m[field]
412 return val ? String(val) : map[field] 458 return val ? String(val) : map[field]
413 }, 459 },
@@ -452,6 +498,8 @@ export default { @@ -452,6 +498,8 @@ export default {
452 setSheet('单价中是否已包含运费', this.yesNoList) 498 setSheet('单价中是否已包含运费', this.yesNoList)
453 } else if (field === 'historyRemarks') { 499 } else if (field === 'historyRemarks') {
454 setSheet('历史备注', this.customerRemarks) 500 setSheet('历史备注', this.customerRemarks)
  501 + } else if (field === 'region') {
  502 + setSheet('区域', this.regionOptions)
455 } 503 }
456 }, 504 },
457 onSheetConfirm({ value, label }) { 505 onSheetConfirm({ value, label }) {
@@ -546,6 +594,7 @@ export default { @@ -546,6 +594,7 @@ export default {
546 const empty = (val === undefined || val === null || (typeof val === 'string' && val.trim() === '') || (typeof val === 'number' && isNaN(val))) 594 const empty = (val === undefined || val === null || (typeof val === 'string' && val.trim() === '') || (typeof val === 'number' && isNaN(val)))
547 if (empty) { uni.showToast({ title: `请先选择${it.label}`, icon: 'none' }); return false } 595 if (empty) { uni.showToast({ title: `请先选择${it.label}`, icon: 'none' }); return false }
548 } 596 }
  597 + if (this.$refs.productRel && !this.$refs.productRel.validate()) return false
549 const list = Array.isArray(this.productLineList) ? this.productLineList : [] 598 const list = Array.isArray(this.productLineList) ? this.productLineList : []
550 if (list.length === 0) { 599 if (list.length === 0) {
551 uni.showToast({ title: '请至少添加一条产品明细', icon: 'none' }); return false 600 uni.showToast({ title: '请至少添加一条产品明细', icon: 'none' }); return false