Commit d6e7e9226023cd404822fd439f9a5b12eb13cf27

Authored by 史婷婷
1 parent 8fd79134

feat: 资信-新增&核心人员-暂存

@@ -60,9 +60,15 @@ @@ -60,9 +60,15 @@
60 <uni-easyinput v-model="form.companyAddress" placeholder="请输入单位地址" :inputBorder="false" /> 60 <uni-easyinput v-model="form.companyAddress" placeholder="请输入单位地址" :inputBorder="false" />
61 </template> 61 </template>
62 </uni-list-item> 62 </uni-list-item>
63 - <uni-list-item title="注册资本(万元)"> 63 + <uni-list-item class="amount-item">
  64 + <template v-slot:body>
  65 + <view class="item-title"><text>注册资本</text></view>
  66 + </template>
64 <template v-slot:footer> 67 <template v-slot:footer>
65 - <uni-easyinput type="number" v-model="form.registeredCapital" placeholder="请输入注册资本" :inputBorder="false" /> 68 + <view class="amount-row">
  69 + <uni-easyinput type="number" v-model="form.registeredCapital" placeholder="0.00" :inputBorder="false" />
  70 + <text class="unit">万元</text>
  71 + </view>
66 </template> 72 </template>
67 </uni-list-item> 73 </uni-list-item>
68 <uni-list-item title="账号"> 74 <uni-list-item title="账号">
@@ -90,20 +96,35 @@ @@ -90,20 +96,35 @@
90 <uni-easyinput v-model="form.businessYears" placeholder="请输入经营年限" :inputBorder="false" /> 96 <uni-easyinput v-model="form.businessYears" placeholder="请输入经营年限" :inputBorder="false" />
91 </template> 97 </template>
92 </uni-list-item> 98 </uni-list-item>
93 - <uni-list-item title="经营范围"> 99 + <uni-list-item class="mgb10" title="经营范围">
94 <template v-slot:footer> 100 <template v-slot:footer>
95 <uni-easyinput type="textarea" v-model="form.businessScope" placeholder="请输入经营范围" :inputBorder="false" /> 101 <uni-easyinput type="textarea" v-model="form.businessScope" placeholder="请输入经营范围" :inputBorder="false" />
96 </template> 102 </template>
97 </uni-list-item> 103 </uni-list-item>
  104 +
  105 + <!-- 核心人员 -->
  106 + <CorePersonnel mode="add" :dateBase="form.corePersonnelList" @change="onCorePersonnelChange"
  107 + :options="genderOptions" />
  108 +
  109 + <view class="title-header">
  110 + <image class="title-header_icon" src="/static/images/title.png" />
  111 + <span>资产经营情况</span>
  112 + </view>
98 113
99 <uni-list-item title="经营场地属性"> 114 <uni-list-item title="经营场地属性">
100 <template v-slot:footer> 115 <template v-slot:footer>
101 <uni-easyinput v-model="form.businessProperty" placeholder="请输入经营场地属性" :inputBorder="false" /> 116 <uni-easyinput v-model="form.businessProperty" placeholder="请输入经营场地属性" :inputBorder="false" />
102 </template> 117 </template>
103 </uni-list-item> 118 </uni-list-item>
104 - <uni-list-item title="占地面积(平方米)"> 119 + <uni-list-item class="amount-item">
  120 + <template v-slot:body>
  121 + <view class="item-title"><text>占地面积</text></view>
  122 + </template>
105 <template v-slot:footer> 123 <template v-slot:footer>
106 - <uni-easyinput v-model="form.landArea" placeholder="请输入占地面积" :inputBorder="false" /> 124 + <view class="amount-row">
  125 + <uni-easyinput type="number" v-model="form.landArea" placeholder="0.00" :inputBorder="false" />
  126 + <text class="unit">平方米</text>
  127 + </view>
107 </template> 128 </template>
108 </uni-list-item> 129 </uni-list-item>
109 <uni-list-item title="仓储条件"> 130 <uni-list-item title="仓储条件">
@@ -138,7 +159,7 @@ @@ -138,7 +159,7 @@
138 </uni-list-item> 159 </uni-list-item>
139 <uni-list-item title="销项发票所开品名与计量单位"> 160 <uni-list-item title="销项发票所开品名与计量单位">
140 <template v-slot:footer> 161 <template v-slot:footer>
141 - <uni-easyinput v-model="form.invoiceItemUnit" placeholder="请输入品名与计量单位" :inputBorder="false" /> 162 + <uni-easyinput v-model="form.invoiceItemUnit" placeholder="请输入" :inputBorder="false" />
142 </template> 163 </template>
143 </uni-list-item> 164 </uni-list-item>
144 <uni-list-item title="认证证书"> 165 <uni-list-item title="认证证书">
@@ -146,9 +167,9 @@ @@ -146,9 +167,9 @@
146 <uni-easyinput v-model="form.certificationCertificate" placeholder="请输入认证证书" :inputBorder="false" /> 167 <uni-easyinput v-model="form.certificationCertificate" placeholder="请输入认证证书" :inputBorder="false" />
147 </template> 168 </template>
148 </uni-list-item> 169 </uni-list-item>
149 - <uni-list-item title="产品与经营范围是否匹配"> 170 + <uni-list-item title="我司售于产品与经营范围是否匹配">
150 <template v-slot:footer> 171 <template v-slot:footer>
151 - <uni-easyinput v-model="form.productMatch" placeholder="请输入是否匹配" :inputBorder="false" /> 172 + <uni-easyinput v-model="form.productMatch" placeholder="请输入" :inputBorder="false" />
152 </template> 173 </template>
153 </uni-list-item> 174 </uni-list-item>
154 <uni-list-item title="主要客户"> 175 <uni-list-item title="主要客户">
@@ -171,12 +192,17 @@ @@ -171,12 +192,17 @@
171 <uni-easyinput v-model="form.industryExperience" placeholder="请输入行业经验" :inputBorder="false" /> 192 <uni-easyinput v-model="form.industryExperience" placeholder="请输入行业经验" :inputBorder="false" />
172 </template> 193 </template>
173 </uni-list-item> 194 </uni-list-item>
174 - <uni-list-item title="是否有经济纠纷等"> 195 + <uni-list-item class="mgb10" title="是否与其他企业有经济纠纷 违规信息 拖欠员工薪资">
175 <template v-slot:footer> 196 <template v-slot:footer>
176 - <uni-easyinput v-model="form.hasDispute" placeholder="请输入情况" :inputBorder="false" /> 197 + <uni-easyinput v-model="form.hasDispute" placeholder="请输入" :inputBorder="false" />
177 </template> 198 </template>
178 </uni-list-item> 199 </uni-list-item>
179 200
  201 + <view class="title-header">
  202 + <image class="title-header_icon" src="/static/images/title.png" />
  203 + <span>与我司合作</span>
  204 + </view>
  205 +
180 <uni-list-item title="与我司合作时间"> 206 <uni-list-item title="与我司合作时间">
181 <template v-slot:footer> 207 <template v-slot:footer>
182 <uni-easyinput v-model="form.cooperationStartDate" placeholder="请输入与我司合作时间" :inputBorder="false" /> 208 <uni-easyinput v-model="form.cooperationStartDate" placeholder="请输入与我司合作时间" :inputBorder="false" />
@@ -189,17 +215,17 @@ @@ -189,17 +215,17 @@
189 </uni-list-item> 215 </uni-list-item>
190 <uni-list-item title="是否口头协议操作"> 216 <uni-list-item title="是否口头协议操作">
191 <template v-slot:footer> 217 <template v-slot:footer>
192 - <uni-easyinput v-model="form.isVerbalAgreement" placeholder="请输入是否口头协议" :inputBorder="false" /> 218 + <uni-easyinput v-model="form.isVerbalAgreement" placeholder="请输入" :inputBorder="false" />
193 </template> 219 </template>
194 </uni-list-item> 220 </uni-list-item>
195 <uni-list-item title="是否签订其他协议(列举)"> 221 <uni-list-item title="是否签订其他协议(列举)">
196 <template v-slot:footer> 222 <template v-slot:footer>
197 - <uni-easyinput v-model="form.otherAgreements" placeholder="请输入其他协议" :inputBorder="false" /> 223 + <uni-easyinput v-model="form.otherAgreements" placeholder="请输入" :inputBorder="false" />
198 </template> 224 </template>
199 </uni-list-item> 225 </uni-list-item>
200 - <uni-list-item title="是否签订长年合同"> 226 + <uni-list-item title="与我司操作是否签订长年合同">
201 <template v-slot:footer> 227 <template v-slot:footer>
202 - <uni-easyinput v-model="form.hasLongTermContract" placeholder="请输入是否签订" :inputBorder="false" /> 228 + <uni-easyinput v-model="form.hasLongTermContract" placeholder="请输入" :inputBorder="false" />
203 </template> 229 </template>
204 </uni-list-item> 230 </uni-list-item>
205 <uni-list-item title="合同类型"> 231 <uni-list-item title="合同类型">
@@ -207,45 +233,54 @@ @@ -207,45 +233,54 @@
207 <uni-easyinput v-model="form.contractType" placeholder="请输入合同类型" :inputBorder="false" /> 233 <uni-easyinput v-model="form.contractType" placeholder="请输入合同类型" :inputBorder="false" />
208 </template> 234 </template>
209 </uni-list-item> 235 </uni-list-item>
210 - <uni-list-item title="是否有过中断及原因"> 236 + <uni-list-item class="mgb10" title="是否有过中断及中断原因">
211 <template v-slot:footer> 237 <template v-slot:footer>
212 - <uni-easyinput v-model="form.hasInterruption" placeholder="请输入中断情况" :inputBorder="false" /> 238 + <uni-easyinput v-model="form.hasInterruption" placeholder="请输入" :inputBorder="false" />
213 </template> 239 </template>
214 </uni-list-item> 240 </uni-list-item>
215 241
216 - <uni-list-item title="结算期限">  
217 - <template v-slot:footer>  
218 - <uni-easyinput v-model="form.settlementPeriod" placeholder="请输入结算期限" :inputBorder="false" /> 242 + <view class="title-header">
  243 + <image class="title-header_icon" src="/static/images/title.png" />
  244 + <span>办事处意见</span>
  245 + </view>
  246 + <uni-list-item class="select-item" :class="form.suggestedCategory ? 'is-filled' : 'is-empty'" clickable
  247 + @click="openSheet('suggestedCategory')" :rightText="displayLabel('suggestedCategoryName')" showArrow>
  248 + <template v-slot:body>
  249 + <view class="item-title"><text>建议客户分类</text></view>
219 </template> 250 </template>
220 </uni-list-item> 251 </uni-list-item>
221 - <uni-list-item title="加工操作方案"> 252 + <uni-list-item class="amount-item">
  253 + <template v-slot:body>
  254 + <view class="item-title"><text>授信额度</text></view>
  255 + </template>
222 <template v-slot:footer> 256 <template v-slot:footer>
223 - <uni-easyinput v-model="form.materialSupplyPlan" placeholder="请输入加工操作方案" :inputBorder="false" /> 257 + <view class="amount-row">
  258 + <uni-easyinput type="number" v-model="form.creditLimit" placeholder="0.00" :inputBorder="false" />
  259 + <text class="unit">万元</text>
  260 + </view>
224 </template> 261 </template>
225 </uni-list-item> 262 </uni-list-item>
226 - <uni-list-item class="select-item" :class="form.suggestedCategory ? 'is-filled' : 'is-empty'" clickable  
227 - @click="openSheet('suggestedCategory')" :rightText="displayLabel('suggestedCategoryName')" showArrow>  
228 - <template v-slot:body>  
229 - <view class="item-title"><text>建议客户分类</text></view> 263 + <uni-list-item title="结算期限">
  264 + <template v-slot:footer>
  265 + <uni-easyinput v-model="form.settlementPeriod" placeholder="请输入结算期限" :inputBorder="false" />
230 </template> 266 </template>
231 </uni-list-item> 267 </uni-list-item>
232 - <uni-list-item title="授信额度(万元)"> 268 + <uni-list-item title="加工操作方案">
233 <template v-slot:footer> 269 <template v-slot:footer>
234 - <uni-easyinput type="number" v-model="form.creditLimit" placeholder="请输入授信额度" :inputBorder="false" /> 270 + <uni-easyinput v-model="form.materialSupplyPlan" placeholder="请输入加工操作方案" :inputBorder="false" />
235 </template> 271 </template>
236 </uni-list-item> 272 </uni-list-item>
237 -  
238 - <uni-list-item class="select-item" :class="form.investigatorName ? 'is-filled' : 'is-empty'" clickable 273 + <uni-list-item class="mgb10 select-item" :class="form.investigatorName ? 'is-filled' : 'is-empty'" clickable
239 @click="openSheet('investigator')" :rightText="form.investigatorName || '请选择调查人'" showArrow> 274 @click="openSheet('investigator')" :rightText="form.investigatorName || '请选择调查人'" showArrow>
240 <template v-slot:body> 275 <template v-slot:body>
241 <view class="item-title"><text>调查人</text></view> 276 <view class="item-title"><text>调查人</text></view>
242 </template> 277 </template>
243 </uni-list-item> 278 </uni-list-item>
244 - <uni-list-item title="主管审核">  
245 - <template v-slot:footer>  
246 - <uni-easyinput v-model="form.supervisorReviewName" placeholder="" :inputBorder="false" disabled />  
247 - </template>  
248 - </uni-list-item> 279 +
  280 + <view class="title-header">
  281 + <image class="title-header_icon" src="/static/images/title.png" />
  282 + <span>职能核对</span>
  283 + </view>
249 284
250 <uni-list-item title="年度总销量"> 285 <uni-list-item title="年度总销量">
251 <template v-slot:footer> 286 <template v-slot:footer>
@@ -263,29 +298,6 @@ @@ -263,29 +298,6 @@
263 </template> 298 </template>
264 </uni-list-item> 299 </uni-list-item>
265 300
266 - <uni-list-item title="公司结算期限">  
267 - <template v-slot:footer>  
268 - <uni-easyinput v-model="form.companySettlementPeriod" placeholder="请输入公司结算期限" :inputBorder="false" />  
269 - </template>  
270 - </uni-list-item>  
271 - <uni-list-item title="公司授信额度(万元)">  
272 - <template v-slot:footer>  
273 - <uni-easyinput type="number" v-model="form.companyCreditLimit" placeholder="请输入公司授信额度"  
274 - :inputBorder="false" />  
275 - </template>  
276 - </uni-list-item>  
277 - <uni-list-item title="公司加工操作方案">  
278 - <template v-slot:footer>  
279 - <uni-easyinput v-model="form.companyMaterialSupplyPlan" placeholder="请输入公司加工操作方案" :inputBorder="false" />  
280 - </template>  
281 - </uni-list-item>  
282 - <uni-list-item class="select-item" :class="form.companySuggestedCategory ? 'is-filled' : 'is-empty'" clickable  
283 - @click="openSheet('companySuggestedCategory')" :rightText="displayLabel('companySuggestedCategoryName')"  
284 - showArrow>  
285 - <template v-slot:body>  
286 - <view class="item-title"><text>客户分类</text></view>  
287 - </template>  
288 - </uni-list-item>  
289 </uni-list> 301 </uni-list>
290 </scroll-view> 302 </scroll-view>
291 303
@@ -307,10 +319,11 @@ import SingleSelectSheet from '@/components/single-select/index.vue' @@ -307,10 +319,11 @@ import SingleSelectSheet from '@/components/single-select/index.vue'
307 import RelateSelectSheet from '@/components/relate-select/index.vue' 319 import RelateSelectSheet from '@/components/relate-select/index.vue'
308 import { generateCreditCode, getAllUser, getDeptUser, createApi } from '@/api/credit_manage.js' 320 import { generateCreditCode, getAllUser, getDeptUser, createApi } from '@/api/credit_manage.js'
309 import { getDicByCodeApi } from '@/api/base.js' 321 import { getDicByCodeApi } from '@/api/base.js'
  322 +import CorePersonnel from './corePersonnel.vue'
310 323
311 export default { 324 export default {
312 name: 'CreditManageAdd', 325 name: 'CreditManageAdd',
313 - components: { SingleSelectSheet, RelateSelectSheet }, 326 + components: { SingleSelectSheet, RelateSelectSheet, CorePersonnel },
314 data() { 327 data() {
315 return { 328 return {
316 form: { 329 form: {
@@ -361,22 +374,19 @@ export default { @@ -361,22 +374,19 @@ export default {
361 creditLimit: '', 374 creditLimit: '',
362 investigator: '', 375 investigator: '',
363 investigatorName: '', 376 investigatorName: '',
364 - supervisorReviewName: '',  
365 annualTotalSales: '', 377 annualTotalSales: '',
366 mainIndustry: '', 378 mainIndustry: '',
367 annualMaterialOverview: '', 379 annualMaterialOverview: '',
368 - companySettlementPeriod: '',  
369 companyCreditLimit: '', 380 companyCreditLimit: '',
370 - companyMaterialSupplyPlan: '',  
371 - companySuggestedCategory: '',  
372 - companySuggestedCategoryName: '' 381 + corePersonnelList: [],
373 }, 382 },
374 sheet: { visible: false, title: '请选择', field: '', options: [], value: '' }, 383 sheet: { visible: false, title: '请选择', field: '', options: [], value: '' },
375 relate: { visible: false, title: '选择', source: '', display: [], multiple: false, rowKey: 'id', selectedKeys: [], fieldKey: '' }, 384 relate: { visible: false, title: '选择', source: '', display: [], multiple: false, rowKey: 'id', selectedKeys: [], fieldKey: '' },
376 enterpriseTypeOptions: [], 385 enterpriseTypeOptions: [],
377 categoryOptions: [], 386 categoryOptions: [],
378 companyCategoryOptions: [], 387 companyCategoryOptions: [],
379 - investigatorOptions: [] 388 + investigatorOptions: [],
  389 + genderOptions: []
380 } 390 }
381 }, 391 },
382 created() { 392 created() {
@@ -386,6 +396,7 @@ export default { @@ -386,6 +396,7 @@ export default {
386 this.loadCompanyCategoryOptions() 396 this.loadCompanyCategoryOptions()
387 this.loadInvestigatorOptions() 397 this.loadInvestigatorOptions()
388 this.loadInvestigatorDefault() 398 this.loadInvestigatorDefault()
  399 + this.loadGenderOptions()
389 }, 400 },
390 methods: { 401 methods: {
391 async loadSerialNumber() { 402 async loadSerialNumber() {
@@ -401,7 +412,6 @@ export default { @@ -401,7 +412,6 @@ export default {
401 const map = { 412 const map = {
402 enterpriseTypeName: '请选择企业类型', 413 enterpriseTypeName: '请选择企业类型',
403 suggestedCategoryName: '请选择建议客户分类', 414 suggestedCategoryName: '请选择建议客户分类',
404 - companySuggestedCategoryName: '请选择客户分类'  
405 } 415 }
406 const val = m[field] 416 const val = m[field]
407 return val ? String(val) : map[field] 417 return val ? String(val) : map[field]
@@ -416,8 +426,6 @@ export default { @@ -416,8 +426,6 @@ export default {
416 setSheet('企业类型', this.enterpriseTypeOptions) 426 setSheet('企业类型', this.enterpriseTypeOptions)
417 } else if (field === 'suggestedCategory') { 427 } else if (field === 'suggestedCategory') {
418 setSheet('建议客户分类', this.categoryOptions) 428 setSheet('建议客户分类', this.categoryOptions)
419 - } else if (field === 'companySuggestedCategory') {  
420 - setSheet('客户分类', this.companyCategoryOptions)  
421 } else if (field === 'investigator') { 429 } else if (field === 'investigator') {
422 setSheet('调查人', this.investigatorOptions) 430 setSheet('调查人', this.investigatorOptions)
423 } 431 }
@@ -519,12 +527,25 @@ export default { @@ -519,12 +527,25 @@ export default {
519 this.form.investigatorName = u.name || u.userName || '' 527 this.form.investigatorName = u.name || u.userName || ''
520 } catch (e) { } 528 } catch (e) { }
521 }, 529 },
  530 + async loadGenderOptions() {
  531 + try {
  532 + const res = await getDicByCodeApi('GENDER_TYPE')
  533 + const list = res.data || []
  534 + this.genderOptions = (list || []).map(it => ({ label: it.name || '', value: it.code || '' }))
  535 + } catch (e) {
  536 + this.genderOptions = []
  537 + }
  538 + },
  539 + onCorePersonnelChange(data) {
  540 + const list = Array.isArray(data) ? data : []
  541 + this.form.corePersonnelList = list
  542 + },
522 async onSubmit() { 543 async onSubmit() {
523 if (!this.validateRequired()) return 544 if (!this.validateRequired()) return
524 const payload = { ...this.form } 545 const payload = { ...this.form }
  546 + console.log('onSubmit__payload', payload);
525 delete payload.enterpriseTypeName 547 delete payload.enterpriseTypeName
526 delete payload.suggestedCategoryName 548 delete payload.suggestedCategoryName
527 - delete payload.companySuggestedCategoryName  
528 delete payload.companyIdName 549 delete payload.companyIdName
529 delete payload.investigatorName 550 delete payload.investigatorName
530 try { 551 try {
@@ -618,6 +639,21 @@ export default { @@ -618,6 +639,21 @@ export default {
618 } 639 }
619 } 640 }
620 641
  642 + .amount-row {
  643 + flex: 1;
  644 + display: flex;
  645 + align-items: center;
  646 +
  647 + .uni-easyinput {
  648 + flex: 1;
  649 + }
  650 +
  651 + .unit {
  652 + margin-left: 16rpx;
  653 + color: rgba(0, 0, 0, 0.9);
  654 + }
  655 + }
  656 +
621 .item-title, 657 .item-title,
622 .uni-list-item__content { 658 .uni-list-item__content {
623 flex: none; 659 flex: none;
@@ -628,6 +664,8 @@ export default { @@ -628,6 +664,8 @@ export default {
628 width: 162rpx; 664 width: 162rpx;
629 margin-right: 32rpx; 665 margin-right: 32rpx;
630 color: rgba(0, 0, 0, 0.9); 666 color: rgba(0, 0, 0, 0.9);
  667 + padding-right: 0;
  668 +
631 669
632 .required { 670 .required {
633 color: red; 671 color: red;
@@ -676,19 +714,26 @@ export default { @@ -676,19 +714,26 @@ export default {
676 } 714 }
677 715
678 } 716 }
  717 +
679 .title-header { 718 .title-header {
680 - background-color: #fff;  
681 - display: flex;  
682 - align-items: center;  
683 - padding: 24rpx 32rpx;  
684 - border-bottom: 1rpx solid #f0f0f0;  
685 -  
686 - &_icon {  
687 - width: 32rpx;  
688 - height: 28rpx;  
689 - margin-right: 16rpx;  
690 - margin-top: 8rpx;  
691 - } 719 + background-color: #fff;
  720 + display: flex;
  721 + align-items: center;
  722 + padding: 32rpx 32rpx 22rpx;
  723 +
  724 + &_icon {
  725 + width: 32rpx;
  726 + height: 28rpx;
  727 + margin-right: 16rpx;
  728 + margin-top: 8rpx;
692 } 729 }
  730 +
  731 + span {
  732 + color: rgba(0, 0, 0, 0.9);
  733 + font-size: 32rpx;
  734 + line-height: 44rpx;
  735 + font-weight: 600;
  736 + }
  737 + }
693 } 738 }
694 </style> 739 </style>
  1 +<template>
  2 + <view class="core-personnel">
  3 + <view class="header">
  4 + <image class="opCollapse" src="/static/images/title.png" />
  5 + <text class="title">核心人员</text>
  6 + <view class="ops">
  7 + <image v-if="mode === 'add'" class="opAdd" @click="onAdd" src="/static/images/plus.png" />
  8 + <view v-if="mode === 'view'" class="op1" @click="toggleViewCollapse">
  9 + <image class="opAdd" :src="collapsedView ? '/static/images/down.png' : '/static/images/up.png'" />
  10 + <text class="op">{{ collapsedView ? '展开' : '收起' }} </text>
  11 + </view>
  12 +
  13 + </view>
  14 + </view>
  15 +
  16 + <view v-if="mode === 'add'" class="add-list">
  17 + <view v-for="(item, idx) in items" :key="idx" class="block">
  18 + <uni-list v-show="item.collapsed">
  19 + <uni-list-item title="姓名">
  20 + <template v-slot:footer>
  21 + <uni-easyinput v-model="item.name" :inputBorder="false" placeholder="请输入姓名" />
  22 + </template>
  23 + </uni-list-item>
  24 + <uni-list-item class="select-item" :class="item.sexName ? 'is-filled' : 'is-empty'" clickable
  25 + @click="openProductSheet(idx)" :rightText="item.sexName || '请选择性别'" showArrow>
  26 + <template v-slot:body>
  27 + <view class="item-title"><text>性别</text></view>
  28 + </template>
  29 + </uni-list-item>
  30 + </uni-list>
  31 + <uni-list v-show="!item.collapsed">
  32 + <uni-list-item title="姓名">
  33 + <template v-slot:footer>
  34 + <uni-easyinput v-model="item.name" :inputBorder="false" placeholder="请输入姓名" />
  35 + </template>
  36 + </uni-list-item>
  37 + <uni-list-item class="select-item" :class="item.sexName ? 'is-filled' : 'is-empty'" clickable
  38 + @click="openProductSheet(idx)" :rightText="item.sexName || '请选择性别'" showArrow>
  39 + <template v-slot:body>
  40 + <view class="item-title"><text>性别</text></view>
  41 + </template>
  42 + </uni-list-item>
  43 + <uni-list-item title="籍贯">
  44 + <template v-slot:footer>
  45 + <uni-easyinput v-model="item.nativePlace" :inputBorder="false" placeholder="请输入籍贯" />
  46 + </template>
  47 + </uni-list-item>
  48 + <uni-list-item title="年龄">
  49 + <template v-slot:footer>
  50 + <uni-easyinput v-model="item.age" :inputBorder="false" placeholder="请输入年龄" />
  51 + </template>
  52 + </uni-list-item>
  53 + <uni-list-item title="职务">
  54 + <template v-slot:footer>
  55 + <uni-easyinput v-model="item.position" :inputBorder="false" placeholder="请输入职务" />
  56 + </template>
  57 + </uni-list-item>
  58 + <uni-list-item title="手机">
  59 + <template v-slot:footer>
  60 + <uni-easyinput v-model="item.mobile" :inputBorder="false" placeholder="请输入手机" />
  61 + </template>
  62 + </uni-list-item>
  63 + <uni-list-item title="固定电话">
  64 + <template v-slot:footer>
  65 + <uni-easyinput v-model="item.phone" :inputBorder="false" placeholder="请输入固定电话" />
  66 + </template>
  67 + </uni-list-item>
  68 + <uni-list-item title="邮箱地址">
  69 + <template v-slot:footer>
  70 + <uni-easyinput v-model="item.email" :inputBorder="false" placeholder="请输入邮箱地址" />
  71 + </template>
  72 + </uni-list-item>
  73 + <uni-list-item title="现住址">
  74 + <template v-slot:footer>
  75 + <uni-easyinput v-model="item.address" :inputBorder="false" placeholder="请输入现住址" />
  76 + </template>
  77 + </uni-list-item>
  78 + </uni-list>
  79 + <view class="block-ops">
  80 + <div class="del" @click="onRemove(idx)">
  81 + <image src="/static/images/delete.png" class="icon" />
  82 + 删除
  83 + </div>
  84 + <div class="toggle" @click="toggleItem(idx)">
  85 + <image :src="item.collapsed ? '/static/images/up.png' : '/static/images/down.png'"
  86 + class="icon" />
  87 + {{ item.collapsed ? '展开' : '收起' }}
  88 + </div>
  89 + </view>
  90 + </view>
  91 + </view>
  92 +
  93 + <view v-else class="view-list" v-show="!collapsedView">
  94 + <view v-for="(item, idx) in items" :key="'v-' + idx" class="card">
  95 + <view class="row"><text class="label">产品名称</text><text class="value">{{ item.productName }}</text>
  96 + </view>
  97 + <view class="row"><text class="label">行业</text><text class="value">{{ item.industry }}</text></view>
  98 + <view class="row"><text class="label">牌号</text><text class="value">{{ item.brand }}</text></view>
  99 + <view class="row"><text class="label">品质</text><text class="value">{{ item.quality }}</text></view>
  100 + <view class="row"><text class="label">规格</text><text class="value">{{ item.specDisplay }}</text></view>
  101 + <view class="row"><text class="label">状态</text><text class="value">{{ item.status }}</text></view>
  102 + <view class="row"><text class="label">数量</text><text class="value">{{ item.quantity }}</text></view>
  103 + <view class="row"><text class="label">单价</text><text class="value">{{ formatCurrency(item.unitPrice)
  104 + }}</text>
  105 + </view>
  106 + <view class="row"><text class="label">不含税金额</text><text class="value">{{
  107 + formatCurrency(item.amountExcludingTax)
  108 + }}</text></view>
  109 + <view class="row"><text class="label">总金额</text><text class="value">{{ formatCurrency(item.totalAmount)
  110 + }}</text></view>
  111 + <view class="row"><text class="label">发货日期</text><text class="value">{{ item.orderDate }}</text></view>
  112 + </view>
  113 + </view>
  114 + <SingleSelectSheet :visible.sync="sheet.visible" :title="sheet.title" :options="sheet.options"
  115 + v-model="sheet.value" @confirm="onProductConfirm" />
  116 + </view>
  117 +</template>
  118 +<script>
  119 +import SingleSelectSheet from '@/components/single-select/index.vue'
  120 +export default {
  121 + name: 'CorePersonnel',
  122 + props: {
  123 + mode: { type: String, default: 'add' },
  124 + list: { type: Array, default: () => [] },
  125 + max: { type: Number, default: 8 },
  126 + dateBase: { type: String, default: '' },
  127 + options: { type: Array, default: () => [] }
  128 + },
  129 + components: { SingleSelectSheet },
  130 + data() {
  131 + return {
  132 + items: [],
  133 + collapsedView: false,
  134 + sheet: { visible: false, title: '请选择产品', options: [], value: '', idx: -1 }
  135 + }
  136 + },
  137 + computed: {
  138 + selectOptions() {
  139 + const list = Array.isArray(this.options) ? this.options : []
  140 + return list.map(o => ({
  141 + label: o.label != null ? o.label : (o.text != null ? o.text : (o.name != null ? o.name : '')),
  142 + value: o.value != null ? o.value : (o.code != null ? o.code : (o.id != null ? o.id : o.productId))
  143 + }))
  144 + }
  145 + },
  146 + watch: {
  147 + items: {
  148 + handler() { this.emitChange() },
  149 + deep: true
  150 + },
  151 + list: {
  152 + handler(v) {
  153 + // const arr = Array.isArray(v) ? v : []
  154 + // this.items = arr.map(x => ({ ...this.defaultItem(), ...x, collapsed: true }))
  155 + this.items = v.map(x => ({ ...this.defaultItem(), ...x, collapsed: true }))
  156 + console.log('v', v)
  157 + },
  158 + deep: true
  159 + }
  160 + },
  161 + created() {
  162 + const init = Array.isArray(this.list) && this.list.length > 0 ? this.list.map(v => ({ ...this.defaultItem(), ...v, collapsed: false })) : [{ ...this.defaultItem(), collapsed: false }]
  163 + this.items = init
  164 + },
  165 + methods: {
  166 + defaultItem() {
  167 + return { name: '', sex: '', sexName: '', nativePlace: '', age: '', position: '', mobile: '', phone: '', email: '', address: '', collapsed: false }
  168 + },
  169 + onImmediateChange(idx) {
  170 + this.$nextTick(() => this.recalculate(idx))
  171 + },
  172 + toNumber(val) {
  173 + if (typeof val === 'number') return isNaN(val) ? 0 : val
  174 + const n = parseFloat(String(val).replace(/[^0-9.\-]/g, ''))
  175 + return isNaN(n) ? 0 : n
  176 + },
  177 + round(val, digits = 2) {
  178 + const n = Number(val)
  179 + if (isNaN(n)) return 0
  180 + const m = Math.pow(10, digits)
  181 + return Math.round(n * m) / m
  182 + },
  183 + onNumberBlur(idx, field, digits) {
  184 + const it = this.items[idx]
  185 + if (!it) return
  186 + const raw = it[field]
  187 + // 如果为空则保持为空,不自动置为0,仅重新计算依赖字段
  188 + if (raw === '' || raw === null || raw === undefined) {
  189 + this.$set(this.items, idx, it)
  190 + this.recalculate(idx)
  191 + return
  192 + }
  193 + const num = this.toNumber(raw)
  194 + const rounded = this.round(num, digits)
  195 + it[field] = rounded
  196 + this.$set(this.items, idx, it)
  197 + this.recalculate(idx)
  198 + },
  199 + formatCurrency(val) {
  200 + if (val == null || val === '') return ''
  201 + const num = Number(val)
  202 + const pre = isNaN(num) ? '' : '¥'
  203 + const fixed = isNaN(num) ? String(val) : num.toFixed(2)
  204 + return `${pre}${fixed}`
  205 + },
  206 + specOf(item) {
  207 + const t = [item.thickness, item.thicknessTolPos, item.thicknessTolNeg].filter(Boolean).join('/')
  208 + const w = [item.width, item.widthTolPos, item.widthTolNeg].filter(Boolean).join('/')
  209 + const l = [item.length, item.lengthTolPos, item.lengthTolNeg].filter(Boolean).join('/')
  210 + return [t, w, l].filter(Boolean).join(' × ')
  211 + },
  212 + openProductSheet(idx) {
  213 + const opts = this.selectOptions
  214 + const current = this.items[idx] && this.items[idx].sex
  215 + const match = opts.find(o => o.value === current)
  216 + this.sheet = { ...this.sheet, visible: true, title: '请选择性别', options: opts, idx, value: match ? match.value : '' }
  217 + },
  218 + onProductConfirm({ value, label }) {
  219 + const idx = this.sheet.idx
  220 + const it = this.items[idx]
  221 + if (!it) { this.sheet.visible = false; return }
  222 + it.sex = value
  223 + it.sexName = label || ''
  224 + this.$set(this.items, idx, it)
  225 + this.sheet.visible = false
  226 + this.emitChange()
  227 + },
  228 + recalculate(idx) {
  229 + const TAX_RATE = 0.13
  230 + const it = this.items[idx]
  231 + if (!it) return
  232 + const qty = this.toNumber(it.quantity)
  233 + const price = this.toNumber(it.unitPrice)
  234 + const total = this.round(qty * price, 2)
  235 + const excl = this.round(total / (1 + TAX_RATE), 2)
  236 + const next = { ...it, totalAmount: total, amountExcludingTax: excl }
  237 + this.$set(this.items, idx, next)
  238 + },
  239 + recalculateAll() {
  240 + for (let i = 0; i < this.items.length; i++) this.recalculate(i)
  241 + },
  242 + onAdd() {
  243 + if (this.items.length >= this.max) return uni.showToast({ title: `最多添加${this.max}个`, icon: 'none' })
  244 + const obj = this.defaultItem()
  245 + obj.collapsed = true
  246 + this.items.push(obj)
  247 + this.emitChange()
  248 + },
  249 + onRemove(idx) {
  250 + this.items.splice(idx, 1)
  251 + this.emitChange()
  252 + },
  253 + toggleItem(idx) {
  254 + const it = this.items[idx]
  255 + if (!it) return
  256 + it.collapsed = !it.collapsed
  257 + this.$set(this.items, idx, it)
  258 + },
  259 + emitChange() {
  260 + const out = this.items.map(it => ({ ...it, specDisplay: this.specOf(it) }))
  261 + this.$emit('input', out)
  262 + this.$emit('update:value', out)
  263 + this.$emit('change', out)
  264 + },
  265 + onDateChange(idx, e) {
  266 + const it = this.items[idx]
  267 + if (!it) return
  268 + const val = typeof e === 'string' ? e : (e && e.detail && e.detail.value) ? e.detail.value : it.orderDate
  269 + const dateStr = String(val).slice(0, 10)
  270 + const base = this.dateBase ? new Date(this.dateBase) : null
  271 + const d = new Date(dateStr)
  272 + if (base && !isNaN(d.getTime()) && d.getTime() < base.getTime()) {
  273 + uni.showToast({ title: '发货日期不得早于订货日期', icon: 'none' })
  274 + it.orderDate = this.dateBase
  275 + } else {
  276 + it.orderDate = dateStr
  277 + }
  278 + this.$set(this.items, idx, it)
  279 + },
  280 + toggleViewCollapse() {
  281 + this.collapsedView = !this.collapsedView
  282 + }
  283 + }
  284 +}
  285 +</script>
  286 +<style lang="scss" scoped>
  287 +.core-personnel {
  288 + margin-top: 10px;
  289 +}
  290 +
  291 +.header {
  292 + background-color: #fff;
  293 + display: flex;
  294 + align-items: center;
  295 + padding: 24rpx 32rpx;
  296 + border-bottom: 1rpx solid #f0f0f0;
  297 +}
  298 +
  299 +.dot {
  300 + width: 16rpx;
  301 + height: 16rpx;
  302 + background: #3D48A3;
  303 + border-radius: 50%;
  304 + margin-right: 12rpx;
  305 +}
  306 +
  307 +.title {
  308 + font-size: 32rpx;
  309 + color: rgba(0, 0, 0, 0.9);
  310 + font-weight: 600;
  311 +}
  312 +
  313 +.ops {
  314 + margin-left: auto;
  315 +}
  316 +
  317 +.op {
  318 + color: $theme-primary;
  319 + font-size: 28rpx;
  320 + margin-left: 8rpx;
  321 +}
  322 +
  323 +.op1 {
  324 + display: flex;
  325 + align-items: center;
  326 +}
  327 +
  328 +.opAdd {
  329 + color: rgba(0, 0, 0, 0.6);
  330 + width: 40rpx;
  331 + height: 40rpx;
  332 +}
  333 +
  334 +.opCollapse {
  335 + color: rgba(0, 0, 0, 0.6);
  336 + width: 32rpx;
  337 + height: 28rpx;
  338 + margin-right: 16rpx;
  339 + margin-top: 8rpx;
  340 +}
  341 +
  342 +
  343 +.block {
  344 + background: #fff;
  345 + margin-bottom: 20rpx;
  346 +}
  347 +
  348 +::v-deep .uni-list-item__content {
  349 + display: flex;
  350 + justify-content: center;
  351 +}
  352 +
  353 +::v-deep .uni-list {
  354 + background: transparent;
  355 +
  356 + &-item {
  357 + &__container {
  358 + padding: 32rpx;
  359 + }
  360 +
  361 + &__content-title {
  362 + font-size: 28rpx;
  363 + color: rgba(0, 0, 0, 0.9);
  364 + }
  365 +
  366 + &__extra-text {
  367 + font-size: 32rpx;
  368 + }
  369 +
  370 + .uni-easyinput {
  371 + width: 100%;
  372 +
  373 + &__placeholder-class {
  374 + font-size: 32rpx;
  375 + color: rgba(0, 0, 0, 0.4);
  376 + }
  377 +
  378 + &__content {
  379 + border: none;
  380 + display: flex;
  381 +
  382 + &-input {
  383 + padding-left: 0 !important;
  384 + height: 48rpx;
  385 + line-height: 48rpx;
  386 + font-size: 32rpx;
  387 + }
  388 + }
  389 +
  390 + .uni-input-placeholder {
  391 + // z-index: 2;
  392 + }
  393 + }
  394 + }
  395 +}
  396 +
  397 +.block-ops {
  398 + display: flex;
  399 + padding: 20rpx 32rpx 20rpx;
  400 + justify-content: space-around;
  401 +}
  402 +
  403 +.del {
  404 + color: #D54941;
  405 + font-size: 28rpx;
  406 + display: flex;
  407 + align-items: center;
  408 +
  409 + image {
  410 + width: 40rpx;
  411 + height: 40rpx;
  412 + }
  413 +}
  414 +
  415 +.toggle {
  416 + color: $theme-primary;
  417 + font-size: 28rpx;
  418 + display: flex;
  419 + align-items: center;
  420 +
  421 + image {
  422 + width: 40rpx;
  423 + height: 40rpx;
  424 + }
  425 +}
  426 +
  427 +.view-list {
  428 + padding: 24rpx 32rpx;
  429 + background: #ffffff;
  430 +}
  431 +
  432 +.card {
  433 + background: #f3f3f3;
  434 + border-radius: 16rpx;
  435 + padding: 24rpx;
  436 + margin-bottom: 20rpx;
  437 +}
  438 +
  439 +.row {
  440 + display: flex;
  441 + margin-bottom: 20rpx;
  442 +}
  443 +
  444 +.row:last-child {
  445 + margin-bottom: 0;
  446 +}
  447 +
  448 +.label {
  449 + width: 120rpx;
  450 + color: rgba(0, 0, 0, 0.6);
  451 + font-size: 28rpx;
  452 +}
  453 +
  454 +.value {
  455 + flex: 1;
  456 + text-align: right;
  457 + color: rgba(0, 0, 0, 0.9);
  458 + font-size: 28rpx;
  459 +}
  460 +</style>
  1 +<template>
  2 + <view class="page">
  3 + <scroll-view class="scroll" scroll-y>
  4 + <uni-list>
  5 + <uni-list-item class="select-item" :class="form.serialNumber ? 'is-filled' : 'is-empty'">
  6 + <template v-slot:body>
  7 + <view class="item-title"><text class="required">*</text><text>编号</text></view>
  8 + </template>
  9 + <template v-slot:footer>
  10 + <view class="serial-number-row">
  11 + <uni-easyinput v-model="form.serialNumber" placeholder="自动生成编号" :inputBorder="false" disabled />
  12 + <button class="generate-btn" @click="loadSerialNumber">点此生成</button>
  13 + </view>
  14 + </template>
  15 + </uni-list-item>
  16 +
  17 + <uni-list-item title="区域">
  18 + <template v-slot:footer>
  19 + <uni-easyinput v-model="form.region" placeholder="请输入区域" :inputBorder="false" />
  20 + </template>
  21 + </uni-list-item>
  22 + <uni-list-item title="客户简称">
  23 + <template v-slot:footer>
  24 + <uni-easyinput v-model="form.customerShortName" placeholder="请输入客户简称" :inputBorder="false" />
  25 + </template>
  26 + </uni-list-item>
  27 +
  28 + <uni-list-item class="select-item" :class="form.enterpriseType ? 'is-filled' : 'is-empty'" clickable
  29 + @click="openSheet('enterpriseType')" :rightText="displayLabel('enterpriseTypeName')" showArrow>
  30 + <template v-slot:body>
  31 + <view class="item-title"><text>企业类型</text></view>
  32 + </template>
  33 + </uni-list-item>
  34 +
  35 + <uni-list-item class="mgb10" title="登记日期">
  36 + <template v-slot:footer>
  37 + <uni-datetime-picker type="date" v-model="form.registerDate" />
  38 + </template>
  39 + </uni-list-item>
  40 +
  41 + <view class="title-header">
  42 + <image class="title-header_icon" src="/static/images/title.png" />
  43 + <span>基础资料</span>
  44 + </view>
  45 +
  46 + <uni-list-item class="select-item" :class="form.companyId ? 'is-filled' : 'is-empty'" clickable
  47 + @click="openRelate('companyId')" :rightText="form.companyIdName || '请选择单位名称'" showArrow>
  48 + <template v-slot:body>
  49 + <view class="item-title"><text class="required">*</text><text>单位名称</text></view>
  50 + </template>
  51 + </uni-list-item>
  52 +
  53 + <uni-list-item title="企业性质">
  54 + <template v-slot:footer>
  55 + <uni-easyinput v-model="form.companyNature" placeholder="请输入企业性质" :inputBorder="false" />
  56 + </template>
  57 + </uni-list-item>
  58 + <uni-list-item title="单位地址">
  59 + <template v-slot:footer>
  60 + <uni-easyinput v-model="form.companyAddress" placeholder="请输入单位地址" :inputBorder="false" />
  61 + </template>
  62 + </uni-list-item>
  63 + <uni-list-item class="amount-item">
  64 + <template v-slot:body>
  65 + <view class="item-title"><text>注册资本</text></view>
  66 + </template>
  67 + <template v-slot:footer>
  68 + <view class="amount-row">
  69 + <uni-easyinput type="number" v-model="form.registeredCapital" placeholder="0.00" :inputBorder="false" />
  70 + <text class="unit">万元</text>
  71 + </view>
  72 + </template>
  73 + </uni-list-item>
  74 + <uni-list-item title="账号">
  75 + <template v-slot:footer>
  76 + <uni-easyinput v-model="form.bankAccount" placeholder="请输入账号" :inputBorder="false" />
  77 + </template>
  78 + </uni-list-item>
  79 + <uni-list-item title="账开户行">
  80 + <template v-slot:footer>
  81 + <uni-easyinput v-model="form.bankName" placeholder="请输入账开户行" :inputBorder="false" />
  82 + </template>
  83 + </uni-list-item>
  84 + <uni-list-item title="税号">
  85 + <template v-slot:footer>
  86 + <uni-easyinput v-model="form.taxNumber" placeholder="请输入税号" :inputBorder="false" />
  87 + </template>
  88 + </uni-list-item>
  89 + <uni-list-item title="注册时间">
  90 + <template v-slot:footer>
  91 + <uni-datetime-picker type="date" v-model="form.registrationTime" />
  92 + </template>
  93 + </uni-list-item>
  94 + <uni-list-item title="经营年限">
  95 + <template v-slot:footer>
  96 + <uni-easyinput v-model="form.businessYears" placeholder="请输入经营年限" :inputBorder="false" />
  97 + </template>
  98 + </uni-list-item>
  99 + <uni-list-item class="mgb10" title="经营范围">
  100 + <template v-slot:footer>
  101 + <uni-easyinput type="textarea" v-model="form.businessScope" placeholder="请输入经营范围" :inputBorder="false" />
  102 + </template>
  103 + </uni-list-item>
  104 +
  105 + <view class="title-header">
  106 + <image class="title-header_icon" src="/static/images/title.png" />
  107 + <span>资产经营情况</span>
  108 + </view>
  109 +
  110 + <uni-list-item title="经营场地属性">
  111 + <template v-slot:footer>
  112 + <uni-easyinput v-model="form.businessProperty" placeholder="请输入经营场地属性" :inputBorder="false" />
  113 + </template>
  114 + </uni-list-item>
  115 + <uni-list-item class="amount-item">
  116 + <template v-slot:body>
  117 + <view class="item-title"><text>占地面积</text></view>
  118 + </template>
  119 + <template v-slot:footer>
  120 + <view class="amount-row">
  121 + <uni-easyinput type="number" v-model="form.landArea" placeholder="0.00" :inputBorder="false" />
  122 + <text class="unit">平方米</text>
  123 + </view>
  124 + </template>
  125 + </uni-list-item>
  126 + <uni-list-item title="仓储条件">
  127 + <template v-slot:footer>
  128 + <uni-easyinput v-model="form.storageConditions" placeholder="请输入仓储条件" :inputBorder="false" />
  129 + </template>
  130 + </uni-list-item>
  131 + <uni-list-item title="员工人数">
  132 + <template v-slot:footer>
  133 + <uni-easyinput type="number" v-model="form.employeeCount" placeholder="请输入员工人数" :inputBorder="false" />
  134 + </template>
  135 + </uni-list-item>
  136 + <uni-list-item title="设备属性">
  137 + <template v-slot:footer>
  138 + <uni-easyinput v-model="form.equipmentAttributes" placeholder="请输入设备属性" :inputBorder="false" />
  139 + </template>
  140 + </uni-list-item>
  141 + <uni-list-item title="资产评估">
  142 + <template v-slot:footer>
  143 + <uni-easyinput v-model="form.assetEvaluation" placeholder="请输入资产评估" :inputBorder="false" />
  144 + </template>
  145 + </uni-list-item>
  146 + <uni-list-item title="上年度销售额">
  147 + <template v-slot:footer>
  148 + <uni-easyinput v-model="form.lastYearSales" placeholder="请输入上年度销售额" :inputBorder="false" />
  149 + </template>
  150 + </uni-list-item>
  151 + <uni-list-item title="月均销量">
  152 + <template v-slot:footer>
  153 + <uni-easyinput v-model="form.monthlyAvgSales" placeholder="请输入月均销量" :inputBorder="false" />
  154 + </template>
  155 + </uni-list-item>
  156 + <uni-list-item title="销项发票所开品名与计量单位">
  157 + <template v-slot:footer>
  158 + <uni-easyinput v-model="form.invoiceItemUnit" placeholder="请输入" :inputBorder="false" />
  159 + </template>
  160 + </uni-list-item>
  161 + <uni-list-item title="认证证书">
  162 + <template v-slot:footer>
  163 + <uni-easyinput v-model="form.certificationCertificate" placeholder="请输入认证证书" :inputBorder="false" />
  164 + </template>
  165 + </uni-list-item>
  166 + <uni-list-item title="我司售于产品与经营范围是否匹配">
  167 + <template v-slot:footer>
  168 + <uni-easyinput v-model="form.productMatch" placeholder="请输入" :inputBorder="false" />
  169 + </template>
  170 + </uni-list-item>
  171 + <uni-list-item title="主要客户">
  172 + <template v-slot:footer>
  173 + <uni-easyinput v-model="form.majorCustomers" placeholder="请输入主要客户" :inputBorder="false" />
  174 + </template>
  175 + </uni-list-item>
  176 + <uni-list-item title="主营项目">
  177 + <template v-slot:footer>
  178 + <uni-easyinput v-model="form.mainProjects" placeholder="请输入主营项目" :inputBorder="false" />
  179 + </template>
  180 + </uni-list-item>
  181 + <uni-list-item title="从事行业">
  182 + <template v-slot:footer>
  183 + <uni-easyinput v-model="form.industryInvolved" placeholder="请输入从事行业" :inputBorder="false" />
  184 + </template>
  185 + </uni-list-item>
  186 + <uni-list-item title="在该行业中的经验">
  187 + <template v-slot:footer>
  188 + <uni-easyinput v-model="form.industryExperience" placeholder="请输入行业经验" :inputBorder="false" />
  189 + </template>
  190 + </uni-list-item>
  191 + <uni-list-item class="mgb10" title="是否与其他企业有经济纠纷 违规信息 拖欠员工薪资">
  192 + <template v-slot:footer>
  193 + <uni-easyinput v-model="form.hasDispute" placeholder="请输入" :inputBorder="false" />
  194 + </template>
  195 + </uni-list-item>
  196 +
  197 + <view class="title-header">
  198 + <image class="title-header_icon" src="/static/images/title.png" />
  199 + <span>与我司合作</span>
  200 + </view>
  201 +
  202 + <uni-list-item title="与我司合作时间">
  203 + <template v-slot:footer>
  204 + <uni-easyinput v-model="form.cooperationStartDate" placeholder="请输入与我司合作时间" :inputBorder="false" />
  205 + </template>
  206 + </uni-list-item>
  207 + <uni-list-item title="月均操作量">
  208 + <template v-slot:footer>
  209 + <uni-easyinput v-model="form.monthlyAvgVolume" placeholder="请输入月均操作量" :inputBorder="false" />
  210 + </template>
  211 + </uni-list-item>
  212 + <uni-list-item title="是否口头协议操作">
  213 + <template v-slot:footer>
  214 + <uni-easyinput v-model="form.isVerbalAgreement" placeholder="请输入" :inputBorder="false" />
  215 + </template>
  216 + </uni-list-item>
  217 + <uni-list-item title="是否签订其他协议(列举)">
  218 + <template v-slot:footer>
  219 + <uni-easyinput v-model="form.otherAgreements" placeholder="请输入" :inputBorder="false" />
  220 + </template>
  221 + </uni-list-item>
  222 + <uni-list-item title="与我司操作是否签订长年合同">
  223 + <template v-slot:footer>
  224 + <uni-easyinput v-model="form.hasLongTermContract" placeholder="请输入" :inputBorder="false" />
  225 + </template>
  226 + </uni-list-item>
  227 + <uni-list-item title="合同类型">
  228 + <template v-slot:footer>
  229 + <uni-easyinput v-model="form.contractType" placeholder="请输入合同类型" :inputBorder="false" />
  230 + </template>
  231 + </uni-list-item>
  232 + <uni-list-item class="mgb10" title="是否有过中断及中断原因">
  233 + <template v-slot:footer>
  234 + <uni-easyinput v-model="form.hasInterruption" placeholder="请输入" :inputBorder="false" />
  235 + </template>
  236 + </uni-list-item>
  237 +
  238 + <view class="title-header">
  239 + <image class="title-header_icon" src="/static/images/title.png" />
  240 + <span>办事处意见</span>
  241 + </view>
  242 + <uni-list-item class="select-item" :class="form.suggestedCategory ? 'is-filled' : 'is-empty'" clickable
  243 + @click="openSheet('suggestedCategory')" :rightText="displayLabel('suggestedCategoryName')" showArrow>
  244 + <template v-slot:body>
  245 + <view class="item-title"><text>建议客户分类</text></view>
  246 + </template>
  247 + </uni-list-item>
  248 + <uni-list-item class="amount-item">
  249 + <template v-slot:body>
  250 + <view class="item-title"><text>授信额度</text></view>
  251 + </template>
  252 + <template v-slot:footer>
  253 + <view class="amount-row">
  254 + <uni-easyinput type="number" v-model="form.creditLimit" placeholder="0.00" :inputBorder="false" />
  255 + <text class="unit">万元</text>
  256 + </view>
  257 + </template>
  258 + </uni-list-item>
  259 + <uni-list-item title="结算期限">
  260 + <template v-slot:footer>
  261 + <uni-easyinput v-model="form.settlementPeriod" placeholder="请输入结算期限" :inputBorder="false" />
  262 + </template>
  263 + </uni-list-item>
  264 + <uni-list-item title="加工操作方案">
  265 + <template v-slot:footer>
  266 + <uni-easyinput v-model="form.materialSupplyPlan" placeholder="请输入加工操作方案" :inputBorder="false" />
  267 + </template>
  268 + </uni-list-item>
  269 + <uni-list-item class="mgb10 select-item" :class="form.investigatorName ? 'is-filled' : 'is-empty'" clickable
  270 + @click="openSheet('investigator')" :rightText="form.investigatorName || '请选择调查人'" showArrow>
  271 + <template v-slot:body>
  272 + <view class="item-title"><text>调查人</text></view>
  273 + </template>
  274 + </uni-list-item>
  275 + <!-- <uni-list-item class="mgb10" title="主管审核">
  276 + <template v-slot:footer>
  277 + <uni-easyinput v-model="form.supervisorReviewName" placeholder="" :inputBorder="false" disabled />
  278 + </template>
  279 + </uni-list-item> -->
  280 +
  281 + <view class="title-header">
  282 + <image class="title-header_icon" src="/static/images/title.png" />
  283 + <span>职能核对</span>
  284 + </view>
  285 +
  286 + <uni-list-item title="年度总销量">
  287 + <template v-slot:footer>
  288 + <uni-easyinput v-model="form.annualTotalSales" placeholder="请输入年度总销量" :inputBorder="false" />
  289 + </template>
  290 + </uni-list-item>
  291 + <uni-list-item title="主要行业">
  292 + <template v-slot:footer>
  293 + <uni-easyinput v-model="form.mainIndustry" placeholder="请输入主要行业" :inputBorder="false" />
  294 + </template>
  295 + </uni-list-item>
  296 + <uni-list-item title="年度款料概况">
  297 + <template v-slot:footer>
  298 + <uni-easyinput v-model="form.annualMaterialOverview" placeholder="请输入年度款料概况" :inputBorder="false" />
  299 + </template>
  300 + </uni-list-item>
  301 +
  302 + <!-- <uni-list-item title="公司结算期限">
  303 + <template v-slot:footer>
  304 + <uni-easyinput v-model="form.companySettlementPeriod" placeholder="请输入公司结算期限" :inputBorder="false" />
  305 + </template>
  306 + </uni-list-item>
  307 + <uni-list-item title="公司授信额度(万元)">
  308 + <template v-slot:footer>
  309 + <uni-easyinput type="number" v-model="form.companyCreditLimit" placeholder="请输入公司授信额度"
  310 + :inputBorder="false" />
  311 + </template>
  312 + </uni-list-item>
  313 + <uni-list-item title="公司加工操作方案">
  314 + <template v-slot:footer>
  315 + <uni-easyinput v-model="form.companyMaterialSupplyPlan" placeholder="请输入公司加工操作方案" :inputBorder="false" />
  316 + </template>
  317 + </uni-list-item>
  318 + <uni-list-item class="select-item" :class="form.companySuggestedCategory ? 'is-filled' : 'is-empty'" clickable
  319 + @click="openSheet('companySuggestedCategory')" :rightText="displayLabel('companySuggestedCategoryName')"
  320 + showArrow>
  321 + <template v-slot:body>
  322 + <view class="item-title"><text>客户分类</text></view>
  323 + </template>
  324 + </uni-list-item> -->
  325 + </uni-list>
  326 + </scroll-view>
  327 +
  328 + <view class="footer">
  329 + <button class="btn submit" type="primary" @click="onSubmit">提交</button>
  330 + </view>
  331 +
  332 + <SingleSelectSheet :visible.sync="sheet.visible" :title="sheet.title" :options="sheet.options" v-model="sheet.value"
  333 + @confirm="onSheetConfirm" />
  334 + <RelateSelectSheet :visible.sync="relate.visible" :title="relate.title" :source="relate.source"
  335 + :display-fields="relate.display" :multiple="relate.multiple" :row-key="relate.rowKey"
  336 + :selectedKeys.sync="relate.selectedKeys" @confirm="onRelateConfirm" />
  337 + </view>
  338 +
  339 +</template>
  340 +
  341 +<script>
  342 +import SingleSelectSheet from '@/components/single-select/index.vue'
  343 +import RelateSelectSheet from '@/components/relate-select/index.vue'
  344 +import { generateCreditCode, getAllUser, getDeptUser, createApi } from '@/api/credit_manage.js'
  345 +import { getDicByCodeApi } from '@/api/base.js'
  346 +
  347 +export default {
  348 + name: 'CreditManageAdd',
  349 + components: { SingleSelectSheet, RelateSelectSheet },
  350 + data() {
  351 + return {
  352 + form: {
  353 + serialNumber: '',
  354 + region: '',
  355 + customerShortName: '',
  356 + enterpriseType: '',
  357 + enterpriseTypeName: '',
  358 + registerDate: '',
  359 + companyId: '',
  360 + companyIdName: '',
  361 + companyNature: '',
  362 + companyAddress: '',
  363 + registeredCapital: '',
  364 + bankAccount: '',
  365 + bankName: '',
  366 + taxNumber: '',
  367 + registrationTime: '',
  368 + businessYears: '',
  369 + businessScope: '',
  370 + businessProperty: '',
  371 + landArea: '',
  372 + storageConditions: '',
  373 + employeeCount: '',
  374 + equipmentAttributes: '',
  375 + assetEvaluation: '',
  376 + lastYearSales: '',
  377 + monthlyAvgSales: '',
  378 + invoiceItemUnit: '',
  379 + certificationCertificate: '',
  380 + productMatch: '',
  381 + majorCustomers: '',
  382 + mainProjects: '',
  383 + industryInvolved: '',
  384 + industryExperience: '',
  385 + hasDispute: '',
  386 + cooperationStartDate: '',
  387 + monthlyAvgVolume: '',
  388 + isVerbalAgreement: '',
  389 + otherAgreements: '',
  390 + hasLongTermContract: '',
  391 + contractType: '',
  392 + hasInterruption: '',
  393 + settlementPeriod: '',
  394 + materialSupplyPlan: '',
  395 + suggestedCategory: '',
  396 + suggestedCategoryName: '',
  397 + creditLimit: '',
  398 + investigator: '',
  399 + investigatorName: '',
  400 + // supervisorReviewName: '',
  401 + annualTotalSales: '',
  402 + mainIndustry: '',
  403 + annualMaterialOverview: '',
  404 + // companySettlementPeriod: '',
  405 + companyCreditLimit: '',
  406 + // companyMaterialSupplyPlan: '',
  407 + // companySuggestedCategory: '',
  408 + // companySuggestedCategoryName: ''
  409 + },
  410 + sheet: { visible: false, title: '请选择', field: '', options: [], value: '' },
  411 + relate: { visible: false, title: '选择', source: '', display: [], multiple: false, rowKey: 'id', selectedKeys: [], fieldKey: '' },
  412 + enterpriseTypeOptions: [],
  413 + categoryOptions: [],
  414 + companyCategoryOptions: [],
  415 + investigatorOptions: []
  416 + }
  417 + },
  418 + created() {
  419 + this.loadSerialNumber()
  420 + this.loadEnterpriseTypeOptions()
  421 + this.loadCategoryOptions()
  422 + this.loadCompanyCategoryOptions()
  423 + this.loadInvestigatorOptions()
  424 + this.loadInvestigatorDefault()
  425 + },
  426 + methods: {
  427 + async loadSerialNumber() {
  428 + try {
  429 + const res = await generateCreditCode()
  430 + this.form.serialNumber = (res && res.data) || ''
  431 + } catch (e) {
  432 + this.form.serialNumber = ''
  433 + }
  434 + },
  435 + displayLabel(field) {
  436 + const m = this.form
  437 + const map = {
  438 + enterpriseTypeName: '请选择企业类型',
  439 + suggestedCategoryName: '请选择建议客户分类',
  440 + // companySuggestedCategoryName: '请选择客户分类'
  441 + }
  442 + const val = m[field]
  443 + return val ? String(val) : map[field]
  444 + },
  445 + async openSheet(field) {
  446 + const setSheet = (title, options) => {
  447 + const current = this.form[field]
  448 + const match = (options || []).find(o => String(o.label) === String(current) || String(o.value) === String(current))
  449 + this.sheet = { ...this.sheet, visible: true, title, options, field, value: match ? match.value : '' }
  450 + }
  451 + if (field === 'enterpriseType') {
  452 + setSheet('企业类型', this.enterpriseTypeOptions)
  453 + } else if (field === 'suggestedCategory') {
  454 + setSheet('建议客户分类', this.categoryOptions)
  455 + // } else if (field === 'companySuggestedCategory') {
  456 + // setSheet('客户分类', this.companyCategoryOptions)
  457 + } else if (field === 'investigator') {
  458 + setSheet('调查人', this.investigatorOptions)
  459 + }
  460 + },
  461 + onSheetConfirm({ value, label }) {
  462 + const field = this.sheet.field
  463 + if (!field) return
  464 + this.form[field] = value || ''
  465 + this.form[field + 'Name'] = label || ''
  466 + this.sheet.visible = false
  467 + },
  468 + openRelate(fieldKey) {
  469 + let config = {}
  470 + if (fieldKey === 'companyId') {
  471 + config = {
  472 + title: '单位名称',
  473 + source: 'customer',
  474 + rowKey: 'id',
  475 + multiple: false,
  476 + display: [
  477 + { label: '姓名', field: 'name' },
  478 + { label: '编号', field: 'code' },
  479 + { label: '状态', field: 'available', format: v => (v ? '启用' : '停用') }
  480 + ]
  481 + }
  482 + }
  483 + const selectedKeys = this.form[fieldKey] ? [this.form[fieldKey]] : []
  484 + this.sheet.visible = false
  485 + this.relate.title = config.title
  486 + this.relate.source = config.source
  487 + this.relate.display = config.display
  488 + this.relate.multiple = config.multiple
  489 + this.relate.rowKey = config.rowKey
  490 + this.relate.selectedKeys = selectedKeys
  491 + this.relate.fieldKey = fieldKey
  492 + this.$nextTick(() => { this.relate.visible = true })
  493 + },
  494 + onRelateConfirm({ items }) {
  495 + const _fieldKey = this.relate.fieldKey
  496 + const first = (items && items.length > 0) ? items[0] : null
  497 + this.form[_fieldKey] = (first && (first.id || first.code)) || ''
  498 + this.form[_fieldKey + 'Name'] = (first && (first.name || first.text)) || ''
  499 + },
  500 + validateRequired() {
  501 + const checks = [
  502 + { key: 'serialNumber', label: '编号' },
  503 + { key: 'companyId', label: '单位名称' }
  504 + ]
  505 + for (const it of checks) {
  506 + const val = this.form[it.key]
  507 + if (val === undefined || val === null || String(val).trim() === '') {
  508 + uni.showToast({ title: `请先选择${it.label}`, icon: 'none' })
  509 + return false
  510 + }
  511 + }
  512 + return true
  513 + },
  514 + async loadEnterpriseTypeOptions() {
  515 + try {
  516 + const res = await getDicByCodeApi('ENTERPRISE_TYPE')
  517 + const list = res.data || []
  518 + this.enterpriseTypeOptions = (list || []).map(it => ({ label: it.name || '', value: it.code || '' }))
  519 + } catch (e) {
  520 + this.enterpriseTypeOptions = []
  521 + }
  522 + },
  523 + async loadCategoryOptions() {
  524 + try {
  525 + const res = await getDicByCodeApi('CUSTOMER_CATEGORY')
  526 + const list = res.data || []
  527 + this.categoryOptions = (list || []).map(it => ({ label: it.name || '', value: it.code || '' }))
  528 + } catch (e) {
  529 + this.categoryOptions = []
  530 + }
  531 + },
  532 + async loadCompanyCategoryOptions() {
  533 + try {
  534 + const res = await getDicByCodeApi('CUSTOMER_CATEGORY')
  535 + const list = res.data || []
  536 + this.companyCategoryOptions = (list || []).map(it => ({ label: it.name || '', value: it.code || '' }))
  537 + } catch (e) {
  538 + this.companyCategoryOptions = []
  539 + }
  540 + },
  541 + async loadInvestigatorOptions() {
  542 + try {
  543 + const res = await getAllUser()
  544 + const list = res.data || []
  545 + this.investigatorOptions = (list || []).map(it => ({ label: it.name || it.userName || '', value: it.id || it.userId || '' }))
  546 + } catch (e) {
  547 + this.investigatorOptions = []
  548 + }
  549 + },
  550 + async loadInvestigatorDefault() {
  551 + try {
  552 + const res = await getDeptUser()
  553 + const u = (res && res.data) || {}
  554 + this.form.investigator = u.id || u.userId || ''
  555 + this.form.investigatorName = u.name || u.userName || ''
  556 + } catch (e) { }
  557 + },
  558 + async onSubmit() {
  559 + if (!this.validateRequired()) return
  560 + const payload = { ...this.form }
  561 + console.log('onSubmit__payload', payload);
  562 + return;
  563 + delete payload.enterpriseTypeName
  564 + delete payload.suggestedCategoryName
  565 + // delete payload.companySuggestedCategoryName
  566 + delete payload.companyIdName
  567 + delete payload.investigatorName
  568 + try {
  569 + await createApi(payload)
  570 + uni.showToast({ title: '提交成功', icon: 'success' })
  571 + setTimeout(() => uni.navigateBack(), 600)
  572 + } catch (e) {
  573 + uni.showToast({ title: (e && e.msg) || '提交失败', icon: 'none' })
  574 + }
  575 + }
  576 + }
  577 +}
  578 +</script>
  579 +
  580 +<style lang="scss" scoped>
  581 +.page {
  582 + display: flex;
  583 + flex-direction: column;
  584 + height: 100%;
  585 +}
  586 +
  587 +.scroll {
  588 + flex: 1;
  589 + padding: 12rpx 0 160rpx;
  590 +}
  591 +
  592 +.footer {
  593 + position: fixed;
  594 + left: 0;
  595 + right: 0;
  596 + bottom: 0;
  597 + padding: 32rpx;
  598 + padding-bottom: calc(32rpx + env(safe-area-inset-bottom));
  599 + background: #fff;
  600 + box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.06);
  601 +
  602 + .btn {
  603 + height: 80rpx;
  604 + line-height: 80rpx;
  605 + border-radius: 12rpx;
  606 + font-size: 32rpx;
  607 + }
  608 +
  609 + .submit {
  610 + background: $theme-primary;
  611 + color: #fff;
  612 + }
  613 +}
  614 +
  615 +::v-deep .uni-list {
  616 + background: transparent;
  617 +
  618 + &-item {
  619 + &__extra-text {
  620 + font-size: 32rpx;
  621 + }
  622 +
  623 + &__content-title {
  624 + font-size: 32rpx;
  625 + color: rgba(0, 0, 0, 0.9);
  626 + }
  627 +
  628 + &__container {
  629 + padding: 32rpx;
  630 + align-items: center;
  631 +
  632 + .uni-easyinput {
  633 +
  634 + .is-disabled {
  635 + background-color: transparent !important;
  636 + }
  637 +
  638 + &__placeholder-class {
  639 + font-size: 32rpx;
  640 + color: rgba(0, 0, 0, 0.4);
  641 + }
  642 +
  643 + &__content {
  644 + border: none;
  645 +
  646 + &-input {
  647 + padding-left: 0 !important;
  648 + height: 48rpx;
  649 + line-height: 48rpx;
  650 + font-size: 32rpx;
  651 + }
  652 +
  653 + .content-clear-icon {
  654 + font-size: 44rpx !important;
  655 + }
  656 + }
  657 + }
  658 +
  659 + .amount-row {
  660 + flex: 1;
  661 + display: flex;
  662 + align-items: center;
  663 +
  664 + .uni-easyinput {
  665 + flex: 1;
  666 + }
  667 +
  668 + .unit {
  669 + margin-left: 16rpx;
  670 + color: rgba(0, 0, 0, 0.9);
  671 + }
  672 + }
  673 +
  674 + .item-title,
  675 + .uni-list-item__content {
  676 + flex: none;
  677 + min-height: 48rpx;
  678 + line-height: 48rpx;
  679 + font-size: 32rpx;
  680 + position: relative;
  681 + width: 162rpx;
  682 + margin-right: 32rpx;
  683 + color: rgba(0, 0, 0, 0.9);
  684 + padding-right: 0;
  685 +
  686 +
  687 + .required {
  688 + color: red;
  689 + position: absolute;
  690 + top: 50%;
  691 + transform: translateY(-50%);
  692 + left: -16rpx;
  693 + }
  694 + }
  695 +
  696 + }
  697 +
  698 + &.select-item {
  699 + &.is-empty {
  700 + .uni-list-item__extra-text {
  701 + color: rgba(0, 0, 0, 0.4) !important;
  702 + }
  703 + }
  704 +
  705 + &.is-filled {
  706 + .uni-list-item__extra-text {
  707 + color: rgba(0, 0, 0, 0.9) !important;
  708 + }
  709 + }
  710 +
  711 + .serial-number-row {
  712 + display: flex;
  713 + align-items: center;
  714 +
  715 + .generate-btn {
  716 + margin-left: 24rpx;
  717 + height: 64rpx;
  718 + line-height: 64rpx;
  719 + padding: 0 24rpx;
  720 + font-size: 28rpx;
  721 + border-radius: 8rpx;
  722 + background: $theme-primary;
  723 + color: #fff;
  724 + }
  725 + }
  726 +
  727 + }
  728 +
  729 + &.mgb10 {
  730 + margin-bottom: 20rpx;
  731 + }
  732 +
  733 + }
  734 +
  735 + .title-header {
  736 + background-color: #fff;
  737 + display: flex;
  738 + align-items: center;
  739 + padding: 32rpx 32rpx 22rpx;
  740 +
  741 + &_icon {
  742 + width: 32rpx;
  743 + height: 28rpx;
  744 + margin-right: 16rpx;
  745 + margin-top: 8rpx;
  746 + }
  747 +
  748 + span {
  749 + color: rgba(0, 0, 0, 0.9);
  750 + font-size: 32rpx;
  751 + line-height: 44rpx;
  752 + font-weight: 600;
  753 + }
  754 + }
  755 +}
  756 +</style>