Commit d4235230faa96a1797cf1ad6f99bf27a07f2c080

Authored by 史婷婷
1 parent 7b15b935

feat: 资信管理-详情增加按钮逻辑

... ... @@ -166,18 +166,20 @@
166 166
167 167 </view>
168 168 </scroll-view>
  169 + <detail-buttons :buttons="displayButtons" @click="handleButtonClick" />
169 170 </view>
170 171 </template>
171 172
172 173 <script>
173   -import { getDetailApi, getByIdCreditHistoryList } from '@/api/credit_manage.js'
  174 +import { getDetailApi, getByIdCreditHistoryList, cancelApi } from '@/api/credit_manage.js'
174 175 import { getDicName } from '@/utils/dic.js'
175 176 import { getDicByCodeApi } from '@/api/base.js'
176 177 import CorePersonnel from './corePersonnel.vue'
  178 +import DetailButtons from '@/components/detail-buttons/index.vue'
177 179
178 180 export default {
179 181 name: 'CreditManageDetail',
180   - components: { CorePersonnel },
  182 + components: { CorePersonnel, DetailButtons },
181 183 data() {
182 184 return {
183 185 form: {},
... ... @@ -185,9 +187,36 @@ export default {
185 187 genderOptions: [],
186 188 categoryOptions: [],
187 189 historyList: [],
  190 + showExamine: false,
  191 + buttons: [
  192 + { text: '编辑', visible: true, variant: 'outline', event: 'edit' },
  193 + { text: '审核详情', visible: true, variant: 'outline', event: 'auditDetail' },
  194 + { text: '审核', visible: true, variant: 'primary', event: 'audit' },
  195 + { text: '申请变更', visible: true, variant: 'outline', event: 'changeApply' },
  196 + { text: '取消', visible: true, variant: 'outline', event: 'cancel', style: { color: 'rgba(0,0,0,0.9)', border: '1px solid #DCDCDC' } },
  197 + ],
188 198 }
189 199 },
190 200 computed: {
  201 + statusFlags() {
  202 + const s = String((this.form && this.form.status) || '')
  203 + return {
  204 + isRefuse: s === 'REFUSE',
  205 + isPass: s === 'PASS',
  206 + isAudit: s === 'AUDIT',
  207 + canExamine: !!this.showExamine,
  208 + }
  209 + },
  210 + displayButtons() {
  211 + const f = this.statusFlags
  212 + return [
  213 + { ...this.buttons[0], visible: f.isRefuse },
  214 + { ...this.buttons[1], visible: true },
  215 + { ...this.buttons[2], visible: f.isAudit && f.canExamine },
  216 + { ...this.buttons[3], visible: f.isPass },
  217 + { ...this.buttons[4], visible: f.isRefuse },
  218 + ]
  219 + }
191 220 },
192 221 created() {
193 222 this.loadEnterpriseTypeOptions()
... ... @@ -196,6 +225,8 @@ export default {
196 225 },
197 226 onLoad(query) {
198 227 const id = (query && (query.id || query.code)) || ''
  228 + const se = (query && (query.todoType === 'WAIT' || query.showExamine === '1' || query.showExamine === true)) || false
  229 + this.showExamine = !!se
199 230 if (id) this.loadDetail(id)
200 231 },
201 232 methods: {
... ... @@ -253,6 +284,61 @@ export default {
253 284 const query = '?id=' + encodeURIComponent(id)
254 285 uni.navigateTo({ url: '/pages/credit_manage/history_detail' + query })
255 286 },
  287 + handleButtonClick(btn) {
  288 + if (!btn || btn.disabled) return
  289 + const map = {
  290 + edit: () => this.onEdit(),
  291 + auditDetail: () => this.onAuditDetail(),
  292 + audit: () => this.onAudit(),
  293 + changeApply: () => this.onChangeApply(),
  294 + cancel: () => this.onCancel(),
  295 + }
  296 + const fn = map[btn.event]
  297 + if (typeof fn === 'function') fn()
  298 + },
  299 + getBusinessId() {
  300 + return (this.form && (this.form.id || this.form.code)) || ''
  301 + },
  302 + onEdit() {
  303 + const id = this.getBusinessId()
  304 + const query = id ? ('?id=' + encodeURIComponent(id)) : ''
  305 + uni.navigateTo({ url: '/pages/credit_manage/modify' + query })
  306 + },
  307 + onAuditDetail() {
  308 + const CACHE_KEY = 'sourceBusinessId'
  309 + uni.setStorageSync(CACHE_KEY, this.getBusinessId())
  310 + uni.navigateTo({ url: '/pages/flow/audit_detail' })
  311 + },
  312 + onAudit() {
  313 + const CACHE_KEY = 'sourceBusinessId'
  314 + uni.setStorageSync(CACHE_KEY, this.getBusinessId())
  315 + uni.navigateTo({ url: '/pages/flow/audit' })
  316 + },
  317 + onChangeApply() {
  318 + const id = this.getBusinessId()
  319 + const query = id ? ('?id=' + encodeURIComponent(id)) : ''
  320 + uni.navigateTo({ url: '/pages/credit_manage/modify' + query })
  321 + },
  322 + onCancel() {
  323 + const id = this.getBusinessId()
  324 + if (!id) return
  325 + uni.showModal({
  326 + title: '系统提示',
  327 + content: '是否确定取消该流程?',
  328 + confirmText: '确定',
  329 + cancelText: '取消',
  330 + success: (res) => {
  331 + if (res && res.confirm) {
  332 + cancelApi(id).then(() => {
  333 + uni.showToast({ title: '已取消', icon: 'none' })
  334 + setTimeout(() => { uni.redirectTo({ url: '/pages/credit_manage/index' }) }, 300)
  335 + }).catch(() => {
  336 + uni.showToast({ title: '取消失败', icon: 'none' })
  337 + })
  338 + }
  339 + }
  340 + })
  341 + },
256 342 getDicName,
257 343 getCategoryClass(categoryName) {
258 344 if (!categoryName) return ''
... ...
... ... @@ -83,7 +83,7 @@ export default {
83 83
84 84 .scroll {
85 85 flex: 1;
86   - padding: 8rpx 0 144rpx 0;
  86 + padding: 8rpx 0 20rpx;
87 87 }
88 88
89 89 .detail-page {
... ...
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   - }
746   -
747   - span {
748   - color: rgba(0, 0, 0, 0.9);
749   - font-size: 32rpx;
750   - line-height: 44rpx;
751   - font-weight: 600;
752   - }
753   - }
754   -}
755   -</style>
\ No newline at end of file