Commit afd87ac87a75f74989f2eddbf9571c3852354c0f

Authored by gesilong
1 parent 0e6691e6

commit:联调部分内贸资信

  1 +import request from '@/utils/request'
  2 +import { ContentTypeEnum } from '@/utils/httpEnum'
  3 +
  4 +export function domesticCustomerCreditQueryApi(params) {
  5 + return request({
  6 + url: '/procurement/domesticCustomerCredit/query',
  7 + method: 'get',
  8 + params
  9 + })
  10 +}
  11 +
  12 +export function domesticCustomerCreditSaveApi(data) {
  13 + return request({
  14 + url: '/procurement/domesticCustomerCredit',
  15 + method: 'post',
  16 + data,
  17 + contentType: ContentTypeEnum.JSON
  18 + })
  19 +}
  20 +
  21 +export function domesticCustomerCreditGetApi(id) {
  22 + return request({
  23 + url: '/procurement/domesticCustomerCredit/get',
  24 + method: 'get',
  25 + params: { id }
  26 + })
  27 +}
  28 +
  29 +export function getPurchaseDeptApi() {
  30 + return request({
  31 + url: '/system/dept/getPurchaseDept',
  32 + method: 'get'
  33 + })
  34 +}
@@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
9 9
10 <uni-list-item title="单位名称"> 10 <uni-list-item title="单位名称">
11 <template v-slot:footer> 11 <template v-slot:footer>
12 - <uni-easyinput v-model="form.companyName" placeholder="请输入单位名称" :inputBorder="false" /> 12 + <uni-easyinput v-model="form.unitName" placeholder="请输入单位名称" :inputBorder="false" />
13 </template> 13 </template>
14 </uni-list-item> 14 </uni-list-item>
15 15
@@ -49,18 +49,6 @@ @@ -49,18 +49,6 @@
49 </template> 49 </template>
50 </uni-list-item> 50 </uni-list-item>
51 51
52 - <uni-list-item class="amount-item">  
53 - <template v-slot:body>  
54 - <view class="item-title"><text>年营业额</text></view>  
55 - </template>  
56 - <template v-slot:footer>  
57 - <view class="amount-row">  
58 - <uni-easyinput type="digit" v-model="form.annualTurnover" placeholder="请输入" :inputBorder="false" />  
59 - <text class="unit">万元</text>  
60 - </view>  
61 - </template>  
62 - </uni-list-item>  
63 -  
64 <uni-list-item title="法人代表"> 52 <uni-list-item title="法人代表">
65 <template v-slot:footer> 53 <template v-slot:footer>
66 <uni-easyinput v-model="form.legalRepresentative" placeholder="请输入法人代表" :inputBorder="false" /> 54 <uni-easyinput v-model="form.legalRepresentative" placeholder="请输入法人代表" :inputBorder="false" />
@@ -69,7 +57,7 @@ @@ -69,7 +57,7 @@
69 57
70 <uni-list-item title="公司成立时间"> 58 <uni-list-item title="公司成立时间">
71 <template v-slot:footer> 59 <template v-slot:footer>
72 - <uni-datetime-picker type="date" v-model="form.companyFoundedDate" /> 60 + <uni-datetime-picker type="date" v-model="form.companyEstablishedTime" />
73 </template> 61 </template>
74 </uni-list-item> 62 </uni-list-item>
75 63
@@ -81,25 +69,19 @@ @@ -81,25 +69,19 @@
81 69
82 <uni-list-item title="业务负责人"> 70 <uni-list-item title="业务负责人">
83 <template v-slot:footer> 71 <template v-slot:footer>
84 - <uni-easyinput v-model="form.businessOwner" placeholder="请输入业务负责人" :inputBorder="false" /> 72 + <uni-easyinput v-model="form.businessPrincipal" placeholder="请输入业务负责人" :inputBorder="false" />
85 </template> 73 </template>
86 </uni-list-item> 74 </uni-list-item>
87 75
88 <uni-list-item title="职务"> 76 <uni-list-item title="职务">
89 <template v-slot:footer> 77 <template v-slot:footer>
90 - <uni-easyinput v-model="form.position" placeholder="请输入职务" :inputBorder="false" /> 78 + <uni-easyinput v-model="form.businessPrincipalPosition" placeholder="请输入职务" :inputBorder="false" />
91 </template> 79 </template>
92 </uni-list-item> 80 </uni-list-item>
93 81
94 <uni-list-item title="电话"> 82 <uni-list-item title="电话">
95 <template v-slot:footer> 83 <template v-slot:footer>
96 - <uni-easyinput type="number" v-model="form.phone" placeholder="请输入手机号码" :inputBorder="false" />  
97 - </template>  
98 - </uni-list-item>  
99 -  
100 - <uni-list-item title="传真">  
101 - <template v-slot:footer>  
102 - <uni-easyinput v-model="form.fax" placeholder="请输入传真" :inputBorder="false" /> 84 + <uni-easyinput type="number" v-model="form.businessPrincipalPhone" placeholder="请输入手机号码" :inputBorder="false" />
103 </template> 85 </template>
104 </uni-list-item> 86 </uni-list-item>
105 87
@@ -114,17 +96,39 @@ @@ -114,17 +96,39 @@
114 <span>资产状况</span> 96 <span>资产状况</span>
115 </view> 97 </view>
116 98
117 - <uni-list-item title="流动资金"> 99 + <uni-list-item title="生产厂房及办公楼产权">
  100 + <template v-slot:footer>
  101 + <uni-easyinput v-model="form.factoryOfficeProperty" placeholder="请输入" :inputBorder="false" />
  102 + </template>
  103 + </uni-list-item>
  104 +
  105 + <uni-list-item title="生产厂房及办公楼面积">
  106 + <template v-slot:footer>
  107 + <uni-easyinput v-model="form.factoryOfficeArea" placeholder="请输入" :inputBorder="false" />
  108 + </template>
  109 + </uni-list-item>
  110 +
  111 + <uni-list-item title="仓库或货场产权">
  112 + <template v-slot:footer>
  113 + <uni-easyinput v-model="form.warehouseYardProperty" placeholder="请输入" :inputBorder="false" />
  114 + </template>
  115 + </uni-list-item>
  116 +
  117 + <uni-list-item title="仓库或货场产权面积">
  118 + <template v-slot:footer>
  119 + <uni-easyinput v-model="form.warehouseYardArea" placeholder="请输入" :inputBorder="false" />
  120 + </template>
  121 + </uni-list-item>
  122 +
  123 + <uni-list-item title="主要生产设备">
118 <template v-slot:footer> 124 <template v-slot:footer>
119 - <uni-easyinput type="textarea" v-model="form.liquidWorkingCapital" placeholder="1、流动资金 2、购、销结算期限 3、债券债务情况"  
120 - :inputBorder="false" maxlength="2000" /> 125 + <uni-easyinput type="textarea" v-model="form.mainEquipment" placeholder="请输入" :inputBorder="false" maxlength="2000" />
121 </template> 126 </template>
122 </uni-list-item> 127 </uni-list-item>
123 128
124 - <uni-list-item class="mgb10" title="固定资产"> 129 + <uni-list-item class="mgb10" title="正常库存量">
125 <template v-slot:footer> 130 <template v-slot:footer>
126 - <uni-easyinput type="textarea" v-model="form.fixedAssets" placeholder="1、厂房/办公楼产权、面积 2、主要设备投资规模及产权 3、仓库或货场产权、面积 4、正常库存量"  
127 - :inputBorder="false" maxlength="3000" /> 131 + <uni-easyinput v-model="form.normalInventory" placeholder="请输入" :inputBorder="false" />
128 </template> 132 </template>
129 </uni-list-item> 133 </uni-list-item>
130 134
@@ -133,82 +137,93 @@ @@ -133,82 +137,93 @@
133 <span>生产经营环节风险调查</span> 137 <span>生产经营环节风险调查</span>
134 </view> 138 </view>
135 139
136 - <uni-list-item title="收购情况"> 140 + <uni-list-item title="主要品种">
137 <template v-slot:footer> 141 <template v-slot:footer>
138 - <uni-easyinput type="textarea" v-model="form.purchaseSituation"  
139 - placeholder="1、主要品种及收购量 2、经营绩效状况(上年度利润,区分铜/铁等) 4、入库流程及入库品名" :inputBorder="false"  
140 - maxlength="3000" /> 142 + <uni-easyinput v-model="form.mainVarieties" placeholder="请输入" :inputBorder="false" />
141 </template> 143 </template>
142 </uni-list-item> 144 </uni-list-item>
143 - <uni-list-item class="select-item" :class="form.purchaseSourceName ? 'is-filled' : 'is-empty'" clickable  
144 - @click="openSheet('purchaseSource')" :rightText="displayLabel('purchaseSourceName')" showArrow>  
145 - <template v-slot:body>  
146 - <view class="item-title"><text>货源来源</text></view> 145 +
  146 + <uni-list-item title="月度收购量">
  147 + <template v-slot:footer>
  148 + <uni-easyinput v-model="form.monthlyPurchaseVolume" placeholder="请输入" :inputBorder="false" />
147 </template> 149 </template>
148 </uni-list-item> 150 </uni-list-item>
149 - <uni-list-item v-if="showPurchaseSourceOther" class="mgb10" title="其他">  
150 - <template v-slot:footer>  
151 - <uni-easyinput v-model="form.purchaseSourceOther" placeholder="请输入其他货源来源" :inputBorder="false" /> 151 +
  152 + <uni-list-item class="select-item" :class="form.purchaseSource ? 'is-filled' : 'is-empty'" clickable
  153 + @click="openSheet('purchaseSource')" :rightText="displayLabel('purchaseSource')" showArrow>
  154 + <template v-slot:body>
  155 + <view class="item-title"><text>收购来源</text></view>
152 </template> 156 </template>
153 </uni-list-item> 157 </uni-list-item>
154 158
155 - <uni-list-item title="生产情况"> 159 + <uni-list-item title="入库品名">
156 <template v-slot:footer> 160 <template v-slot:footer>
157 - <uni-easyinput type="textarea" v-model="form.productionSituation" placeholder="1、产品介绍 2、产能及对应能耗"  
158 - :inputBorder="false" maxlength="2000" /> 161 + <uni-easyinput v-model="form.stockInProductName" placeholder="请输入" :inputBorder="false" />
159 </template> 162 </template>
160 </uni-list-item> 163 </uni-list-item>
161 164
162 - <uni-list-item title="销售情况"> 165 + <uni-list-item title="产品名称">
163 <template v-slot:footer> 166 <template v-slot:footer>
164 - <uni-easyinput type="textarea" v-model="form.salesSituation" placeholder="销售渠道、销量及操作方式、货款回笼方式、结算期限"  
165 - :inputBorder="false" maxlength="2000" /> 167 + <uni-easyinput v-model="form.productName" placeholder="请输入" :inputBorder="false" />
166 </template> 168 </template>
167 </uni-list-item> 169 </uni-list-item>
168 170
169 - <uni-list-item class="select-item" :class="form.preferentialPolicyName ? 'is-filled' : 'is-empty'" clickable  
170 - @click="openSheet('preferentialPolicy')" :rightText="displayLabel('preferentialPolicyName')" showArrow>  
171 - <template v-slot:body>  
172 - <view class="item-title"><text>是否享受优惠政策</text></view> 171 + <uni-list-item title="产能">
  172 + <template v-slot:footer>
  173 + <uni-easyinput v-model="form.capacity" placeholder="请输入" :inputBorder="false" />
173 </template> 174 </template>
174 </uni-list-item> 175 </uni-list-item>
175 - <uni-list-item class="mgb10" title="详细说明"> 176 +
  177 + <uni-list-item title="销售渠道">
176 <template v-slot:footer> 178 <template v-slot:footer>
177 - <uni-easyinput type="textarea" v-model="form.preferentialPolicyDetail" placeholder="请输入详细说明"  
178 - :inputBorder="false" maxlength="2000" /> 179 + <uni-easyinput v-model="form.salesChannel" placeholder="请输入" :inputBorder="false" />
179 </template> 180 </template>
180 </uni-list-item> 181 </uni-list-item>
181 182
182 - <uni-list-item class="select-item" :class="form.punishmentRecordName ? 'is-filled' : 'is-empty'" clickable  
183 - @click="openSheet('punishmentRecord')" :rightText="displayLabel('punishmentRecordName')" showArrow> 183 + <uni-list-item class="select-item" :class="form.operationMode ? 'is-filled' : 'is-empty'" clickable
  184 + @click="openSheet('operationMode')" :rightText="displayLabel('operationMode')" showArrow>
184 <template v-slot:body> 185 <template v-slot:body>
185 - <view class="item-title"><text>是否有被处罚记录</text></view> 186 + <view class="item-title"><text>操作方式</text></view>
186 </template> 187 </template>
187 </uni-list-item> 188 </uni-list-item>
188 - <uni-list-item class="mgb10" title="实际经营范围与法定经营范围是否相符">  
189 - <template v-slot:footer>  
190 - <uni-easyinput type="textarea" v-model="form.scopeMatch" placeholder="请输入" :inputBorder="false"  
191 - maxlength="2000" /> 189 +
  190 + <uni-list-item class="select-item" :class="form.hasPreferentialPolicy === true || form.hasPreferentialPolicy === false ? 'is-filled' : 'is-empty'" clickable
  191 + @click="openSheet('hasPreferentialPolicy')" :rightText="displayLabel('hasPreferentialPolicy')" showArrow>
  192 + <template v-slot:body>
  193 + <view class="item-title"><text>是否享有优惠政策</text></view>
192 </template> 194 </template>
193 </uni-list-item> 195 </uni-list-item>
194 196
195 - <uni-list-item class="select-item" :class="form.futuresInvestName ? 'is-filled' : 'is-empty'" clickable  
196 - @click="openSheet('futuresInvest')" :rightText="displayLabel('futuresInvestName')" showArrow> 197 + <uni-list-item class="select-item" :class="form.investInFutures === true || form.investInFutures === false ? 'is-filled' : 'is-empty'" clickable
  198 + @click="openSheet('investInFutures')" :rightText="displayLabel('investInFutures')" showArrow>
197 <template v-slot:body> 199 <template v-slot:body>
198 <view class="item-title"><text>是否投资期货</text></view> 200 <view class="item-title"><text>是否投资期货</text></view>
199 </template> 201 </template>
200 </uni-list-item> 202 </uni-list-item>
201 203
202 - <uni-list-item class="select-item" :class="form.investNatureName ? 'is-filled' : 'is-empty'" clickable  
203 - @click="openSheet('investNature')" :rightText="displayLabel('investNatureName')" showArrow> 204 + <uni-list-item class="select-item" :class="form.hasPenaltyRecord === true || form.hasPenaltyRecord === false ? 'is-filled' : 'is-empty'" clickable
  205 + @click="openSheet('hasPenaltyRecord')" :rightText="displayLabel('hasPenaltyRecord')" showArrow>
204 <template v-slot:body> 206 <template v-slot:body>
205 - <view class="item-title"><text>投资性质</text></view> 207 + <view class="item-title"><text>是否有被处罚记录</text></view>
206 </template> 208 </template>
207 </uni-list-item> 209 </uni-list-item>
208 210
209 - <uni-list-item class="mgb10" title="上年度期货盈亏"> 211 + <uni-list-item class="select-item" :class="form.businessScopeMatch === true || form.businessScopeMatch === false ? 'is-filled' : 'is-empty'" clickable
  212 + @click="openSheet('businessScopeMatch')" :rightText="displayLabel('businessScopeMatch')" showArrow>
  213 + <template v-slot:body>
  214 + <view class="item-title"><text>实际经营范围与法定经营范围是否相符</text></view>
  215 + </template>
  216 + </uni-list-item>
  217 +
  218 + <uni-list-item title="常见料质问题">
  219 + <template v-slot:footer>
  220 + <uni-easyinput type="textarea" v-model="form.commonMaterialIssue" placeholder="请输入" :inputBorder="false" maxlength="2000" />
  221 + </template>
  222 + </uni-list-item>
  223 +
  224 + <uni-list-item class="mgb10" title="合作中的其它问题">
210 <template v-slot:footer> 225 <template v-slot:footer>
211 - <uni-easyinput v-model="form.lastYearFuturesProfitLoss" placeholder="请输入" :inputBorder="false" /> 226 + <uni-easyinput type="textarea" v-model="form.otherIssue" placeholder="请输入" :inputBorder="false" maxlength="2000" />
212 </template> 227 </template>
213 </uni-list-item> 228 </uni-list-item>
214 229
@@ -217,57 +232,55 @@ @@ -217,57 +232,55 @@
217 <span>与我司的合作状况</span> 232 <span>与我司的合作状况</span>
218 </view> 233 </view>
219 234
220 - <uni-list-item class="amount-item">  
221 - <template v-slot:body>  
222 - <view class="item-title"><text>合作年限</text></view>  
223 - </template> 235 + <uni-list-item title="首次合作年份">
224 <template v-slot:footer> 236 <template v-slot:footer>
225 - <view class="amount-row">  
226 - <text class="prefix">从</text>  
227 - <uni-easyinput type="digit" v-model="form.cooperationStartYear" placeholder="年份" :inputBorder="false" />  
228 - <text class="suffix">年开始合作</text>  
229 - </view> 237 + <uni-easyinput type="digit" v-model="form.firstCooperationYear" placeholder="请输入4位年份" :inputBorder="false" />
230 </template> 238 </template>
231 </uni-list-item> 239 </uni-list-item>
232 240
233 - <uni-list-item title="主要操作方式">  
234 - <template v-slot:footer>  
235 - <uni-easyinput type="textarea" v-model="form.mainOperationMode" placeholder="请输入"  
236 - :inputBorder="false" maxlength="2000" /> 241 + <uni-list-item class="select-item" :class="form.isNewDevelopment ? 'is-filled' : 'is-empty'" clickable
  242 + @click="openSheet('isNewDevelopment')" :rightText="displayLabel('isNewDevelopment')" showArrow>
  243 + <template v-slot:body>
  244 + <view class="item-title"><text>是否新开发</text></view>
237 </template> 245 </template>
238 </uni-list-item> 246 </uni-list-item>
239 247
240 - <uni-list-item class="select-item" :class="form.badRecordPlanFailName ? 'is-filled' : 'is-empty'" clickable  
241 - @click="openSheet('badRecordPlanFail')" :rightText="displayLabel('badRecordPlanFailName')" showArrow> 248 + <uni-list-item class="select-item" :class="form.hasFailedPlanRecord === true || form.hasFailedPlanRecord === false ? 'is-filled' : 'is-empty'" clickable
  249 + @click="openSheet('hasFailedPlanRecord')" :rightText="displayLabel('hasFailedPlanRecord')" showArrow>
242 <template v-slot:body> 250 <template v-slot:body>
243 <view class="item-title"><text>是否有计划落空的不良记录</text></view> 251 <view class="item-title"><text>是否有计划落空的不良记录</text></view>
244 </template> 252 </template>
245 </uni-list-item> 253 </uni-list-item>
246 - <uni-list-item class="select-item" :class="form.planNotFulfilledName ? 'is-filled' : 'is-empty'" clickable  
247 - @click="openSheet('planNotFulfilled')" :rightText="displayLabel('planNotFulfilledName')" showArrow> 254 + <uni-list-item class="select-item" :class="form.hasPlanPerformanceIssue === true || form.hasPlanPerformanceIssue === false ? 'is-filled' : 'is-empty'" clickable
  255 + @click="openSheet('hasPlanPerformanceIssue')" :rightText="displayLabel('hasPlanPerformanceIssue')" showArrow>
248 <template v-slot:body> 256 <template v-slot:body>
249 - <view class="item-title"><text>是否有计划履行不到位现象(时间、数量等)</text></view> 257 + <view class="item-title"><text>是否有计划履行不到位现象</text></view>
250 </template> 258 </template>
251 </uni-list-item> 259 </uni-list-item>
252 260
253 - <uni-list-item title="操作规范性"> 261 + <uni-list-item title="进销账务如何处理">
254 <template v-slot:footer> 262 <template v-slot:footer>
255 - <uni-easyinput type="textarea" v-model="form.operationNorms" placeholder="1、进销账务如何处理 2、开票品名与出库单品名是否一致 3、出库流程是否规范 4、运输发票情况"  
256 - :inputBorder="false" maxlength="3000" /> 263 + <uni-easyinput type="textarea" v-model="form.accountingProcess" placeholder="请输入" :inputBorder="false" maxlength="2000" />
257 </template> 264 </template>
258 </uni-list-item> 265 </uni-list-item>
259 266
260 - <uni-list-item title="常见料质问题">  
261 - <template v-slot:footer>  
262 - <uni-easyinput type="textarea" v-model="form.commonMaterialIssues" placeholder="请输入"  
263 - :inputBorder="false" maxlength="2000" /> 267 + <uni-list-item class="select-item" :class="form.invoiceNameMatch === true || form.invoiceNameMatch === false ? 'is-filled' : 'is-empty'" clickable
  268 + @click="openSheet('invoiceNameMatch')" :rightText="displayLabel('invoiceNameMatch')" showArrow>
  269 + <template v-slot:body>
  270 + <view class="item-title"><text>开票品名与出库单品名是否一致</text></view>
264 </template> 271 </template>
265 </uni-list-item> 272 </uni-list-item>
266 273
267 - <uni-list-item class="mgb10" title="合作中的其他问题"> 274 + <uni-list-item class="select-item" :class="form.outboundProcessStandard === true || form.outboundProcessStandard === false ? 'is-filled' : 'is-empty'" clickable
  275 + @click="openSheet('outboundProcessStandard')" :rightText="displayLabel('outboundProcessStandard')" showArrow>
  276 + <template v-slot:body>
  277 + <view class="item-title"><text>出库流程是否规范</text></view>
  278 + </template>
  279 + </uni-list-item>
  280 +
  281 + <uni-list-item class="mgb10" title="运输方式">
268 <template v-slot:footer> 282 <template v-slot:footer>
269 - <uni-easyinput type="textarea" v-model="form.otherCooperationIssues" placeholder="请输入"  
270 - :inputBorder="false" maxlength="2000" /> 283 + <uni-easyinput v-model="form.transportMode" placeholder="请输入" :inputBorder="false" />
271 </template> 284 </template>
272 </uni-list-item> 285 </uni-list-item>
273 286
@@ -276,22 +289,29 @@ @@ -276,22 +289,29 @@
276 <span>其他</span> 289 <span>其他</span>
277 </view> 290 </view>
278 291
279 - <uni-list-item title="创建日期"> 292 + <uni-list-item title="资信调查人">
280 <template v-slot:footer> 293 <template v-slot:footer>
281 - <uni-datetime-picker type="date" v-model="form.createDate" /> 294 + <uni-easyinput v-model="form.investigatorName" disabled placeholder="" :inputBorder="false" />
282 </template> 295 </template>
283 </uni-list-item> 296 </uni-list-item>
284 297
285 - <uni-list-item title="评审时间"> 298 + <uni-list-item class="select-item" :class="form.purchaseDepartment ? 'is-filled' : 'is-empty'" clickable
  299 + @click="openSheet('purchaseDepartment')" :rightText="displayLabel('purchaseDepartment')" showArrow>
  300 + <template v-slot:body>
  301 + <view class="item-title"><text>采购处</text></view>
  302 + </template>
  303 + </uni-list-item>
  304 +
  305 + <uni-list-item title="评审有效期">
286 <template v-slot:footer> 306 <template v-slot:footer>
287 - <uni-datetime-picker type="date" v-model="form.reviewDate" /> 307 + <uni-datetime-picker type="date" v-model="form.reviewValidUntil" />
288 </template> 308 </template>
289 </uni-list-item> 309 </uni-list-item>
290 310
291 <uni-list-item class="mgb10" title="附件"> 311 <uni-list-item class="mgb10" title="附件">
292 <template v-slot:footer> 312 <template v-slot:footer>
293 <view class="attach-box"> 313 <view class="attach-box">
294 - <view v-for="(f, idx) in form.attachments" :key="idx" class="attach-row"> 314 + <view v-for="(f, idx) in attachmentFiles" :key="idx" class="attach-row">
295 <FileUpload :value="f" @input="onAttachmentInput(idx, $event)" /> 315 <FileUpload :value="f" @input="onAttachmentInput(idx, $event)" />
296 <text class="attach-del" @click.stop="removeAttachment(idx)">删除</text> 316 <text class="attach-del" @click.stop="removeAttachment(idx)">删除</text>
297 </view> 317 </view>
@@ -319,6 +339,8 @@ @@ -319,6 +339,8 @@
319 import FileUpload from '@/components/file-upload/index.vue' 339 import FileUpload from '@/components/file-upload/index.vue'
320 import SingleSelectSheet from '@/components/single-select/index.vue' 340 import SingleSelectSheet from '@/components/single-select/index.vue'
321 import MultiSelectSheet from '@/components/multi-select/index.vue' 341 import MultiSelectSheet from '@/components/multi-select/index.vue'
  342 +import { getDicByCodes, getDicName } from '@/utils/dic.js'
  343 +import { domesticCustomerCreditSaveApi, getPurchaseDeptApi } from '@/api/procure-manage/domesticCustomerCredit.js'
322 344
323 export default { 345 export default {
324 name: 'DomesticTradeAdd', 346 name: 'DomesticTradeAdd',
@@ -327,123 +349,208 @@ export default { @@ -327,123 +349,208 @@ export default {
327 return { 349 return {
328 submitting: false, 350 submitting: false,
329 newAttachment: { id: '', name: '' }, 351 newAttachment: { id: '', name: '' },
  352 + attachmentFiles: [],
330 sheet: { visible: false, title: '', options: [], field: '', value: '' }, 353 sheet: { visible: false, title: '', options: [], field: '', value: '' },
331 multiSheet: { visible: false, title: '', options: [], field: '', value: '' }, 354 multiSheet: { visible: false, title: '', options: [], field: '', value: '' },
  355 + dicOptions: {
  356 + COMPANY_NATURE: [],
  357 + DEVELOP_NEW: [],
  358 + OPERATION_METHOD: [],
  359 + PURCHASE_SOURCE: []
  360 + },
332 yesNoOptions: [ 361 yesNoOptions: [
333 - { label: '是', value: 'YES' },  
334 - { label: '否', value: 'NO' }  
335 - ],  
336 - investNatureOptions: [  
337 - { label: '投机', value: 'SPECULATION' },  
338 - { label: '保值', value: 'HEDGE' },  
339 - { label: '保值为主投机为辅', value: 'HEDGE_MAIN' }  
340 - ],  
341 - companyNatureOptions: [  
342 - { label: '回收公司', value: 'RECYCLE' },  
343 - { label: '贸易公司', value: 'TRADE' },  
344 - { label: '进口拆解', value: 'IMPORT_DISMANTLE' },  
345 - { label: '工业制造', value: 'INDUSTRY_MANUFACTURE' },  
346 - { label: '福利企业', value: 'WELFARE_ENTERPRISE' },  
347 - { label: '其他', value: 'OTHER' }  
348 - ],  
349 - purchaseSourceOptions: [  
350 - { label: '国外进口', value: 'IMPORT' },  
351 - { label: '本企业报废', value: 'SELF_SCRAP' },  
352 - { label: '零散收购', value: 'SCATTERED' },  
353 - { label: '其他', value: 'OTHER' } 362 + { label: '是', value: true },
  363 + { label: '否', value: false }
354 ], 364 ],
  365 + companyNatureOptions: [],
  366 + operationMethodOptions: [],
  367 + developNewOptions: [],
  368 + purchaseSourceOptions: [],
  369 + purchaseDeptOptions: [],
355 form: { 370 form: {
356 - companyName: '', 371 + unitName: '',
357 companyNature: '', 372 companyNature: '',
358 companyNatureName: '', 373 companyNatureName: '',
359 companyNatureOther: '', 374 companyNatureOther: '',
360 bankName: '', 375 bankName: '',
361 bankAccount: '', 376 bankAccount: '',
362 registeredCapital: '', 377 registeredCapital: '',
363 - annualTurnover: '',  
364 legalRepresentative: '', 378 legalRepresentative: '',
365 - companyFoundedDate: '', 379 + companyEstablishedTime: '',
366 address: '', 380 address: '',
367 - businessOwner: '',  
368 - position: '',  
369 - phone: '',  
370 - fax: '', 381 + businessPrincipal: '',
  382 + businessPrincipalPosition: '',
  383 + businessPrincipalPhone: '',
371 legalBusinessRelation: '', 384 legalBusinessRelation: '',
372 - liquidWorkingCapital: '',  
373 - fixedAssets: '',  
374 - purchaseSituation: '', 385 + factoryOfficeProperty: '',
  386 + factoryOfficeArea: '',
  387 + warehouseYardProperty: '',
  388 + warehouseYardArea: '',
  389 + mainEquipment: '',
  390 + normalInventory: '',
  391 + mainVarieties: '',
  392 + monthlyPurchaseVolume: '',
375 purchaseSource: '', 393 purchaseSource: '',
376 - purchaseSourceName: '',  
377 - purchaseSourceOther: '',  
378 - productionSituation: '',  
379 - salesSituation: '',  
380 - preferentialPolicy: '',  
381 - preferentialPolicyName: '',  
382 - preferentialPolicyDetail: '',  
383 - punishmentRecord: '',  
384 - punishmentRecordName: '',  
385 - scopeMatch: '',  
386 - futuresInvest: '',  
387 - futuresInvestName: '',  
388 - investNature: '',  
389 - investNatureName: '',  
390 - lastYearFuturesProfitLoss: '',  
391 - cooperationStartYear: '',  
392 - mainOperationMode: '',  
393 - badRecordPlanFail: '',  
394 - badRecordPlanFailName: '',  
395 - planNotFulfilled: '',  
396 - planNotFulfilledName: '',  
397 - operationNorms: '',  
398 - commonMaterialIssues: '',  
399 - otherCooperationIssues: '',  
400 - createDate: '',  
401 - reviewDate: '',  
402 - attachments: [] 394 + stockInProductName: '',
  395 + productName: '',
  396 + capacity: '',
  397 + salesChannel: '',
  398 + hasPreferentialPolicy: null,
  399 + investInFutures: null,
  400 + hasPenaltyRecord: null,
  401 + businessScopeMatch: null,
  402 + commonMaterialIssue: '',
  403 + otherIssue: '',
  404 + firstCooperationYear: '',
  405 + isNewDevelopment: '',
  406 + operationMode: '',
  407 + hasFailedPlanRecord: null,
  408 + hasPlanPerformanceIssue: null,
  409 + accountingProcess: '',
  410 + invoiceNameMatch: null,
  411 + outboundProcessStandard: null,
  412 + transportMode: '',
  413 + attachmentFileIds: '',
  414 + attachmentFileNames: '',
  415 + investigatorId: '',
  416 + investigatorName: '',
  417 + purchaseDepartment: '',
  418 + reviewValidUntil: ''
403 } 419 }
404 } 420 }
405 }, 421 },
  422 + created() {
  423 + this.loadDicData()
  424 + this.loadPurchaseDeptOptions()
  425 + const u = (this.$store && this.$store.state && this.$store.state.user) ? this.$store.state.user : {}
  426 + this.form.investigatorId = u && u.id ? String(u.id) : ''
  427 + this.form.investigatorName = u && u.name ? String(u.name) : ''
  428 + },
406 computed: { 429 computed: {
407 showCompanyNatureOther() { 430 showCompanyNatureOther() {
408 const v = String(this.form.companyNature || '') 431 const v = String(this.form.companyNature || '')
409 return v.split(',').includes('OTHER') 432 return v.split(',').includes('OTHER')
410 - },  
411 - showPurchaseSourceOther() {  
412 - return this.form.purchaseSource === 'OTHER'  
413 } 433 }
414 }, 434 },
415 - created() {  
416 - this.form.createDate = this.formatDate(new Date())  
417 - },  
418 methods: { 435 methods: {
  436 + async loadDicData() {
  437 + try {
  438 + const results = await getDicByCodes(['COMPANY_NATURE', 'DEVELOP_NEW', 'OPERATION_METHOD', 'PURCHASE_SOURCE'])
  439 + const next = {
  440 + COMPANY_NATURE: (results.COMPANY_NATURE && results.COMPANY_NATURE.data) || [],
  441 + DEVELOP_NEW: (results.DEVELOP_NEW && results.DEVELOP_NEW.data) || [],
  442 + OPERATION_METHOD: (results.OPERATION_METHOD && results.OPERATION_METHOD.data) || [],
  443 + PURCHASE_SOURCE: (results.PURCHASE_SOURCE && results.PURCHASE_SOURCE.data) || []
  444 + }
  445 + this.dicOptions = next
  446 + this.companyNatureOptions = this.dicToSheetOptions(next.COMPANY_NATURE)
  447 + this.developNewOptions = this.dicToSheetOptions(next.DEVELOP_NEW)
  448 + this.operationMethodOptions = this.dicToSheetOptions(next.OPERATION_METHOD)
  449 + this.purchaseSourceOptions = this.dicToSheetOptions(next.PURCHASE_SOURCE)
  450 + this.form.companyNatureName = this.labelsOfOptions(this.companyNatureOptions, this.form.companyNature)
  451 + } catch (e) {
  452 + this.dicOptions = { COMPANY_NATURE: [], DEVELOP_NEW: [], OPERATION_METHOD: [], PURCHASE_SOURCE: [] }
  453 + this.companyNatureOptions = []
  454 + this.developNewOptions = []
  455 + this.operationMethodOptions = []
  456 + this.purchaseSourceOptions = []
  457 + uni.showToast({ title: '字典加载失败', icon: 'none' })
  458 + }
  459 + },
  460 + async loadPurchaseDeptOptions() {
  461 + try {
  462 + const res = await getPurchaseDeptApi()
  463 + const list = (res && res.data) ? res.data : []
  464 + this.purchaseDeptOptions = (Array.isArray(list) ? list : []).map(it => ({
  465 + label: it && it.name != null ? String(it.name) : '',
  466 + value: it && it.id != null ? String(it.id) : ''
  467 + })).filter(it => it.value)
  468 + } catch (e) {
  469 + this.purchaseDeptOptions = []
  470 + }
  471 + },
  472 + getOptionLabel(options, value) {
  473 + const v = value == null ? '' : String(value)
  474 + if (!v) return ''
  475 + const found = (options || []).find(o => String(o.value) === v)
  476 + return found ? String(found.label || '') : ''
  477 + },
  478 + dicToSheetOptions(items) {
  479 + const list = Array.isArray(items) ? items : []
  480 + return list.map(it => ({ label: it && it.name != null ? String(it.name) : '', value: it && it.code != null ? String(it.code) : '' })).filter(it => it.value)
  481 + },
  482 + labelsOfOptions(options, csv) {
  483 + const v = csv == null ? '' : String(csv)
  484 + if (!v) return ''
  485 + const parts = v.split(',').filter(Boolean)
  486 + if (!parts.length) return ''
  487 + const labels = []
  488 + ;(options || []).forEach(opt => {
  489 + const ov = opt && opt.value != null ? String(opt.value) : ''
  490 + if (ov && parts.includes(ov)) labels.push(opt.label != null ? String(opt.label) : '')
  491 + })
  492 + return labels.filter(Boolean).join(',') || ''
  493 + },
419 displayLabel(field) { 494 displayLabel(field) {
420 const m = this.form || {} 495 const m = this.form || {}
421 const map = { 496 const map = {
422 companyNatureName: '请选择公司性质', 497 companyNatureName: '请选择公司性质',
423 - purchaseSourceName: '请选择货源来源',  
424 - preferentialPolicyName: '请选择',  
425 - punishmentRecordName: '请选择',  
426 - futuresInvestName: '请选择',  
427 - investNatureName: '请选择',  
428 - badRecordPlanFailName: '请选择',  
429 - planNotFulfilledName: '请选择' 498 + purchaseSource: '请选择',
  499 + operationMode: '请选择',
  500 + isNewDevelopment: '请选择',
  501 + purchaseDepartment: '请选择',
  502 + hasPreferentialPolicy: '请选择',
  503 + investInFutures: '请选择',
  504 + hasPenaltyRecord: '请选择',
  505 + businessScopeMatch: '请选择',
  506 + hasFailedPlanRecord: '请选择',
  507 + hasPlanPerformanceIssue: '请选择',
  508 + invoiceNameMatch: '请选择',
  509 + outboundProcessStandard: '请选择'
  510 + }
  511 + if (field === 'companyNatureName') {
  512 + const val = m[field]
  513 + return val ? String(val) : map[field]
  514 + }
  515 + if (field === 'purchaseSource') {
  516 + const v = m.purchaseSource
  517 + return v ? getDicName('PURCHASE_SOURCE', String(v), this.dicOptions.PURCHASE_SOURCE) : map[field]
  518 + }
  519 + if (field === 'operationMode') {
  520 + const v = m.operationMode
  521 + return v ? getDicName('OPERATION_METHOD', String(v), this.dicOptions.OPERATION_METHOD) : map[field]
  522 + }
  523 + if (field === 'isNewDevelopment') {
  524 + const v = m.isNewDevelopment
  525 + return v ? getDicName('DEVELOP_NEW', String(v), this.dicOptions.DEVELOP_NEW) : map[field]
  526 + }
  527 + if (field === 'purchaseDepartment') {
  528 + const label = this.getOptionLabel(this.purchaseDeptOptions, m.purchaseDepartment)
  529 + return label || map[field]
430 } 530 }
431 - const val = m[field]  
432 - return val ? String(val) : map[field] 531 + const v = m[field]
  532 + if (v === true) return '是'
  533 + if (v === false) return '否'
  534 + return map[field] || '请选择'
433 }, 535 },
434 openSheet(field) { 536 openSheet(field) {
435 const map = { 537 const map = {
436 - purchaseSource: { title: '货源来源', options: this.purchaseSourceOptions, valueField: 'purchaseSource', nameField: 'purchaseSourceName' },  
437 - preferentialPolicy: { title: '是否享受优惠政策', options: this.yesNoOptions, valueField: 'preferentialPolicy', nameField: 'preferentialPolicyName' },  
438 - punishmentRecord: { title: '是否有被处罚记录', options: this.yesNoOptions, valueField: 'punishmentRecord', nameField: 'punishmentRecordName' },  
439 - futuresInvest: { title: '是否投资期货', options: this.yesNoOptions, valueField: 'futuresInvest', nameField: 'futuresInvestName' },  
440 - investNature: { title: '投资性质', options: this.investNatureOptions, valueField: 'investNature', nameField: 'investNatureName' },  
441 - badRecordPlanFail: { title: '是否有计划落空的不良记录', options: this.yesNoOptions, valueField: 'badRecordPlanFail', nameField: 'badRecordPlanFailName' },  
442 - planNotFulfilled: { title: '是否有计划履行不到位现象', options: this.yesNoOptions, valueField: 'planNotFulfilled', nameField: 'planNotFulfilledName' } 538 + purchaseSource: { title: '收购来源', options: this.purchaseSourceOptions },
  539 + operationMode: { title: '操作方式', options: this.operationMethodOptions },
  540 + isNewDevelopment: { title: '是否新开发', options: this.developNewOptions },
  541 + purchaseDepartment: { title: '采购处', options: this.purchaseDeptOptions },
  542 + hasPreferentialPolicy: { title: '是否享有优惠政策', options: this.yesNoOptions },
  543 + investInFutures: { title: '是否投资期货', options: this.yesNoOptions },
  544 + hasPenaltyRecord: { title: '是否有被处罚记录', options: this.yesNoOptions },
  545 + businessScopeMatch: { title: '实际经营范围与法定经营范围是否相符', options: this.yesNoOptions },
  546 + hasFailedPlanRecord: { title: '是否有计划落空的不良记录', options: this.yesNoOptions },
  547 + hasPlanPerformanceIssue: { title: '是否有计划履行不到位现象', options: this.yesNoOptions },
  548 + invoiceNameMatch: { title: '开票品名与出库单品名是否一致', options: this.yesNoOptions },
  549 + outboundProcessStandard: { title: '出库流程是否规范', options: this.yesNoOptions }
443 } 550 }
444 const cfg = map[field] 551 const cfg = map[field]
445 if (!cfg) return 552 if (!cfg) return
446 - const current = this.form[cfg.valueField] 553 + const current = this.form[field]
447 const match = (cfg.options || []).find(o => String(o.value) === String(current)) 554 const match = (cfg.options || []).find(o => String(o.value) === String(current))
448 this.sheet = { 555 this.sheet = {
449 ...this.sheet, 556 ...this.sheet,
@@ -451,7 +558,7 @@ export default { @@ -451,7 +558,7 @@ export default {
451 title: cfg.title, 558 title: cfg.title,
452 options: cfg.options || [], 559 options: cfg.options || [],
453 field, 560 field,
454 - value: match ? match.value : (current || '') 561 + value: match ? match.value : current
455 } 562 }
456 }, 563 },
457 openMultiSheet(field) { 564 openMultiSheet(field) {
@@ -467,29 +574,8 @@ export default { @@ -467,29 +574,8 @@ export default {
467 }, 574 },
468 onSheetConfirm({ value, label }) { 575 onSheetConfirm({ value, label }) {
469 const field = this.sheet.field 576 const field = this.sheet.field
470 - if (field === 'purchaseSource') {  
471 - this.form.purchaseSource = value || ''  
472 - this.form.purchaseSourceName = label || ''  
473 - if (this.form.purchaseSource !== 'OTHER') this.form.purchaseSourceOther = ''  
474 - } else if (field === 'preferentialPolicy') {  
475 - this.form.preferentialPolicy = value || ''  
476 - this.form.preferentialPolicyName = label || ''  
477 - } else if (field === 'punishmentRecord') {  
478 - this.form.punishmentRecord = value || ''  
479 - this.form.punishmentRecordName = label || ''  
480 - } else if (field === 'futuresInvest') {  
481 - this.form.futuresInvest = value || ''  
482 - this.form.futuresInvestName = label || ''  
483 - } else if (field === 'investNature') {  
484 - this.form.investNature = value || ''  
485 - this.form.investNatureName = label || ''  
486 - } else if (field === 'badRecordPlanFail') {  
487 - this.form.badRecordPlanFail = value || ''  
488 - this.form.badRecordPlanFailName = label || ''  
489 - } else if (field === 'planNotFulfilled') {  
490 - this.form.planNotFulfilled = value || ''  
491 - this.form.planNotFulfilledName = label || ''  
492 - } 577 + if (!field) return
  578 + this.form[field] = value
493 this.sheet.visible = false 579 this.sheet.visible = false
494 }, 580 },
495 onMultiSheetConfirm({ value, label }) { 581 onMultiSheetConfirm({ value, label }) {
@@ -504,13 +590,7 @@ export default { @@ -504,13 +590,7 @@ export default {
504 }, 590 },
505 normalizeCompanyNature(valueStr) { 591 normalizeCompanyNature(valueStr) {
506 const selected = (valueStr ? String(valueStr).split(',').filter(Boolean) : []) 592 const selected = (valueStr ? String(valueStr).split(',').filter(Boolean) : [])
507 - const group = ['IMPORT_DISMANTLE', 'INDUSTRY_MANUFACTURE', 'WELFARE_ENTERPRISE']  
508 - const groupSelected = selected.filter(v => group.includes(v))  
509 - let finalSelected = selected.slice(0)  
510 - if (groupSelected.length > 1) {  
511 - const keep = groupSelected[0]  
512 - finalSelected = finalSelected.filter(v => !group.includes(v) || v === keep)  
513 - } 593 + const finalSelected = selected.slice(0)
514 const orderedValues = [] 594 const orderedValues = []
515 const orderedLabels = [] 595 const orderedLabels = []
516 ;(this.companyNatureOptions || []).forEach(opt => { 596 ;(this.companyNatureOptions || []).forEach(opt => {
@@ -523,32 +603,108 @@ export default { @@ -523,32 +603,108 @@ export default {
523 return { value: orderedValues.join(','), label: orderedLabels.join(',') } 603 return { value: orderedValues.join(','), label: orderedLabels.join(',') }
524 }, 604 },
525 removeAttachment(idx) { 605 removeAttachment(idx) {
526 - const list = Array.isArray(this.form.attachments) ? this.form.attachments.slice(0) : [] 606 + const list = Array.isArray(this.attachmentFiles) ? this.attachmentFiles.slice(0) : []
527 list.splice(idx, 1) 607 list.splice(idx, 1)
528 - this.form.attachments = list 608 + this.attachmentFiles = list
529 }, 609 },
530 onAddAttachment(val) { 610 onAddAttachment(val) {
531 const payload = val || { id: '', name: '' } 611 const payload = val || { id: '', name: '' }
532 if (!payload.id) return 612 if (!payload.id) return
533 - const list = Array.isArray(this.form.attachments) ? this.form.attachments.slice(0) : [] 613 + const list = Array.isArray(this.attachmentFiles) ? this.attachmentFiles.slice(0) : []
534 list.push(payload) 614 list.push(payload)
535 - this.form.attachments = list 615 + this.attachmentFiles = list
536 this.newAttachment = { id: '', name: '' } 616 this.newAttachment = { id: '', name: '' }
537 }, 617 },
538 onAttachmentInput(idx, val) { 618 onAttachmentInput(idx, val) {
539 - const list = Array.isArray(this.form.attachments) ? this.form.attachments.slice(0) : [] 619 + const list = Array.isArray(this.attachmentFiles) ? this.attachmentFiles.slice(0) : []
540 list[idx] = val || { id: '', name: '' } 620 list[idx] = val || { id: '', name: '' }
541 - this.form.attachments = list 621 + this.attachmentFiles = list
542 }, 622 },
543 validate() { 623 validate() {
544 - const phone = String(this.form.phone || '').trim() 624 + const requiredTextFields = [
  625 + { key: 'unitName', label: '单位名称' },
  626 + { key: 'companyNature', label: '公司性质' },
  627 + { key: 'bankName', label: '开户行' },
  628 + { key: 'bankAccount', label: '账号' },
  629 + { key: 'legalRepresentative', label: '法人代表' },
  630 + { key: 'companyEstablishedTime', label: '公司成立时间' },
  631 + { key: 'address', label: '地址' },
  632 + { key: 'businessPrincipal', label: '业务负责人' },
  633 + { key: 'businessPrincipalPosition', label: '职务' },
  634 + { key: 'businessPrincipalPhone', label: '电话' },
  635 + { key: 'legalBusinessRelation', label: '法人与业务负责人关系' },
  636 + { key: 'factoryOfficeProperty', label: '生产厂房及办公楼产权' },
  637 + { key: 'factoryOfficeArea', label: '生产厂房及办公楼面积' },
  638 + { key: 'warehouseYardProperty', label: '仓库或货场产权' },
  639 + { key: 'warehouseYardArea', label: '仓库或货场产权面积' },
  640 + { key: 'mainEquipment', label: '主要生产设备' },
  641 + { key: 'normalInventory', label: '正常库存量' },
  642 + { key: 'mainVarieties', label: '主要品种' },
  643 + { key: 'monthlyPurchaseVolume', label: '月度收购量' },
  644 + { key: 'purchaseSource', label: '收购来源' },
  645 + { key: 'stockInProductName', label: '入库品名' },
  646 + { key: 'productName', label: '产品名称' },
  647 + { key: 'capacity', label: '产能' },
  648 + { key: 'salesChannel', label: '销售渠道' },
  649 + { key: 'firstCooperationYear', label: '首次合作年份' },
  650 + { key: 'isNewDevelopment', label: '是否新开发' },
  651 + { key: 'operationMode', label: '操作方式' },
  652 + { key: 'accountingProcess', label: '进销账务如何处理' },
  653 + { key: 'transportMode', label: '运输方式' },
  654 + { key: 'commonMaterialIssue', label: '常见料质问题' },
  655 + { key: 'otherIssue', label: '合作中的其它问题' },
  656 + { key: 'purchaseDepartment', label: '采购处' },
  657 + { key: 'reviewValidUntil', label: '评审有效期' },
  658 + { key: 'investigatorId', label: '资信调查人ID' }
  659 + ]
  660 + for (let i = 0; i < requiredTextFields.length; i++) {
  661 + const f = requiredTextFields[i]
  662 + const v = this.form && this.form[f.key]
  663 + if (v == null || String(v).trim() === '') {
  664 + uni.showToast({ title: `${f.label}必填`, icon: 'none' })
  665 + return false
  666 + }
  667 + }
  668 +
  669 + const registeredCapital = Number(this.form.registeredCapital)
  670 + if (!Number.isFinite(registeredCapital) || registeredCapital < 0) {
  671 + uni.showToast({ title: '注册资金请填写数字', icon: 'none' })
  672 + return false
  673 + }
  674 +
  675 + const requiredBoolFields = [
  676 + { key: 'hasPreferentialPolicy', label: '是否享有优惠政策' },
  677 + { key: 'investInFutures', label: '是否投资期货' },
  678 + { key: 'hasPenaltyRecord', label: '是否有被处罚记录' },
  679 + { key: 'businessScopeMatch', label: '经营范围是否相符' },
  680 + { key: 'hasFailedPlanRecord', label: '计划落空不良记录' },
  681 + { key: 'hasPlanPerformanceIssue', label: '计划履行不到位现象' },
  682 + { key: 'invoiceNameMatch', label: '开票品名是否一致' },
  683 + { key: 'outboundProcessStandard', label: '出库流程是否规范' }
  684 + ]
  685 + for (let i = 0; i < requiredBoolFields.length; i++) {
  686 + const f = requiredBoolFields[i]
  687 + const v = this.form && this.form[f.key]
  688 + if (!(v === true || v === false)) {
  689 + uni.showToast({ title: `请选择${f.label}`, icon: 'none' })
  690 + return false
  691 + }
  692 + }
  693 +
  694 + const files = Array.isArray(this.attachmentFiles) ? this.attachmentFiles.filter(it => it && it.id) : []
  695 + if (!files.length) {
  696 + uni.showToast({ title: '请上传附件', icon: 'none' })
  697 + return false
  698 + }
  699 +
  700 + const phone = String(this.form.businessPrincipalPhone || '').trim()
545 if (phone && !/^1\d{10}$/.test(phone)) { 701 if (phone && !/^1\d{10}$/.test(phone)) {
546 uni.showToast({ title: '电话请输入11位手机号', icon: 'none' }) 702 uni.showToast({ title: '电话请输入11位手机号', icon: 'none' })
547 return false 703 return false
548 } 704 }
549 - const year = String(this.form.cooperationStartYear || '').trim() 705 + const year = String(this.form.firstCooperationYear || '').trim()
550 if (year && !/^\d{4}$/.test(year)) { 706 if (year && !/^\d{4}$/.test(year)) {
551 - uni.showToast({ title: '合作年限请填写4位年份', icon: 'none' }) 707 + uni.showToast({ title: '首次合作年份请填写4位年份', icon: 'none' })
552 return false 708 return false
553 } 709 }
554 return true 710 return true
@@ -556,16 +712,12 @@ export default { @@ -556,16 +712,12 @@ export default {
556 buildPayload() { 712 buildPayload() {
557 const payload = { ...this.form } 713 const payload = { ...this.form }
558 if (!this.showCompanyNatureOther) payload.companyNatureOther = '' 714 if (!this.showCompanyNatureOther) payload.companyNatureOther = ''
559 - if (payload.purchaseSource !== 'OTHER') payload.purchaseSourceOther = ''  
560 delete payload.companyNatureName 715 delete payload.companyNatureName
561 - delete payload.purchaseSourceName  
562 - delete payload.preferentialPolicyName  
563 - delete payload.punishmentRecordName  
564 - delete payload.futuresInvestName  
565 - delete payload.investNatureName  
566 - delete payload.badRecordPlanFailName  
567 - delete payload.planNotFulfilledName  
568 - payload.attachments = (Array.isArray(payload.attachments) ? payload.attachments : []).filter(it => it && it.id) 716 + delete payload.investigatorName
  717 + payload.registeredCapital = Number(payload.registeredCapital)
  718 + const files = (Array.isArray(this.attachmentFiles) ? this.attachmentFiles : []).filter(it => it && it.id)
  719 + payload.attachmentFileIds = files.map(it => String(it.id || '')).filter(Boolean).join(',')
  720 + payload.attachmentFileNames = files.map(it => String(it.name || '')).filter(Boolean).join(',')
569 return payload 721 return payload
570 }, 722 },
571 async onSubmit() { 723 async onSubmit() {
@@ -574,8 +726,9 @@ export default { @@ -574,8 +726,9 @@ export default {
574 this.submitting = true 726 this.submitting = true
575 const payload = this.buildPayload() 727 const payload = this.buildPayload()
576 try { 728 try {
577 - await this.mockCreate(payload) 729 + await domesticCustomerCreditSaveApi(payload)
578 uni.showToast({ title: '提交成功', icon: 'success' }) 730 uni.showToast({ title: '提交成功', icon: 'success' })
  731 + try { uni.setStorageSync('DOMESTIC_TRADE_LIST_NEED_REFRESH', '1') } catch (e) {}
579 setTimeout(() => { uni.navigateBack() }, 300) 732 setTimeout(() => { uni.navigateBack() }, 300)
580 } catch (e) { 733 } catch (e) {
581 uni.showToast({ title: (e && e.msg) || '提交失败', icon: 'none' }) 734 uni.showToast({ title: (e && e.msg) || '提交失败', icon: 'none' })
@@ -583,15 +736,6 @@ export default { @@ -583,15 +736,6 @@ export default {
583 this.submitting = false 736 this.submitting = false
584 } 737 }
585 }, 738 },
586 - mockCreate() {  
587 - return new Promise(resolve => setTimeout(resolve, 400))  
588 - },  
589 - formatDate(d) {  
590 - const y = d.getFullYear()  
591 - const m = String(d.getMonth() + 1).padStart(2, '0')  
592 - const da = String(d.getDate()).padStart(2, '0')  
593 - return `${y}-${m}-${da}`  
594 - }  
595 } 739 }
596 } 740 }
597 </script> 741 </script>
@@ -3,20 +3,18 @@ @@ -3,20 +3,18 @@
3 <scroll-view class="scroll" scroll-y> 3 <scroll-view class="scroll" scroll-y>
4 <view class="detail-page"> 4 <view class="detail-page">
5 <view class="section"> 5 <view class="section">
6 - <text class="row company">{{ safeText(form.companyName) }}</text> 6 + <text class="row company">{{ safeText(form.unitName) }}</text>
7 <view class="row"><text class="label">公司性质</text><text class="value">{{ safeText(companyNatureName) }}</text></view> 7 <view class="row"><text class="label">公司性质</text><text class="value">{{ safeText(companyNatureName) }}</text></view>
8 <view v-if="showCompanyNatureOther" class="row"><text class="label">其他</text><text class="value">{{ safeText(form.companyNatureOther) }}</text></view> 8 <view v-if="showCompanyNatureOther" class="row"><text class="label">其他</text><text class="value">{{ safeText(form.companyNatureOther) }}</text></view>
9 <view class="row"><text class="label">开户行</text><text class="value">{{ safeText(form.bankName) }}</text></view> 9 <view class="row"><text class="label">开户行</text><text class="value">{{ safeText(form.bankName) }}</text></view>
10 <view class="row"><text class="label">账号</text><text class="value">{{ safeText(form.bankAccount) }}</text></view> 10 <view class="row"><text class="label">账号</text><text class="value">{{ safeText(form.bankAccount) }}</text></view>
11 <view class="row"><text class="label">注册资金(万元)</text><text class="value">{{ safeText(form.registeredCapital) }}</text></view> 11 <view class="row"><text class="label">注册资金(万元)</text><text class="value">{{ safeText(form.registeredCapital) }}</text></view>
12 - <view class="row"><text class="label">年营业额(万元)</text><text class="value">{{ safeText(form.annualTurnover) }}</text></view>  
13 <view class="row"><text class="label">法人代表</text><text class="value">{{ safeText(form.legalRepresentative) }}</text></view> 12 <view class="row"><text class="label">法人代表</text><text class="value">{{ safeText(form.legalRepresentative) }}</text></view>
14 - <view class="row"><text class="label">公司成立时间</text><text class="value">{{ safeText(form.companyFoundedDate) }}</text></view> 13 + <view class="row"><text class="label">公司成立时间</text><text class="value">{{ safeText(form.companyEstablishedTime) }}</text></view>
15 <view class="row"><text class="label">地址</text><text class="value">{{ safeText(form.address) }}</text></view> 14 <view class="row"><text class="label">地址</text><text class="value">{{ safeText(form.address) }}</text></view>
16 - <view class="row"><text class="label">业务负责人</text><text class="value">{{ safeText(form.businessOwner) }}</text></view>  
17 - <view class="row"><text class="label">职务</text><text class="value">{{ safeText(form.position) }}</text></view>  
18 - <view class="row"><text class="label">电话</text><text class="value">{{ safeText(form.phone) }}</text></view>  
19 - <view class="row"><text class="label">传真</text><text class="value">{{ safeText(form.fax) }}</text></view> 15 + <view class="row"><text class="label">业务负责人</text><text class="value">{{ safeText(form.businessPrincipal) }}</text></view>
  16 + <view class="row"><text class="label">职务</text><text class="value">{{ safeText(form.businessPrincipalPosition) }}</text></view>
  17 + <view class="row"><text class="label">电话</text><text class="value">{{ safeText(form.businessPrincipalPhone) }}</text></view>
20 <view class="row"><text class="label">法人与业务负责人关系</text><text class="value">{{ safeText(form.legalBusinessRelation) }}</text></view> 18 <view class="row"><text class="label">法人与业务负责人关系</text><text class="value">{{ safeText(form.legalBusinessRelation) }}</text></view>
21 </view> 19 </view>
22 20
@@ -25,8 +23,12 @@ @@ -25,8 +23,12 @@
25 <span>资产状况</span> 23 <span>资产状况</span>
26 </view> 24 </view>
27 <view class="section"> 25 <view class="section">
28 - <view class="row"><text class="label">流动资金</text><text class="value pre">{{ safeText(form.liquidWorkingCapital) }}</text></view>  
29 - <view class="row"><text class="label">固定资产</text><text class="value pre">{{ safeText(form.fixedAssets) }}</text></view> 26 + <view class="row"><text class="label">生产厂房及办公楼产权</text><text class="value">{{ safeText(form.factoryOfficeProperty) }}</text></view>
  27 + <view class="row"><text class="label">生产厂房及办公楼面积</text><text class="value">{{ safeText(form.factoryOfficeArea) }}</text></view>
  28 + <view class="row"><text class="label">仓库或货场产权</text><text class="value">{{ safeText(form.warehouseYardProperty) }}</text></view>
  29 + <view class="row"><text class="label">仓库或货场产权面积</text><text class="value">{{ safeText(form.warehouseYardArea) }}</text></view>
  30 + <view class="row"><text class="label">主要生产设备</text><text class="value pre">{{ safeText(form.mainEquipment) }}</text></view>
  31 + <view class="row"><text class="label">正常库存量</text><text class="value">{{ safeText(form.normalInventory) }}</text></view>
30 </view> 32 </view>
31 33
32 <view class="title-header"> 34 <view class="title-header">
@@ -34,18 +36,20 @@ @@ -34,18 +36,20 @@
34 <span>生产经营环节风险调查</span> 36 <span>生产经营环节风险调查</span>
35 </view> 37 </view>
36 <view class="section"> 38 <view class="section">
37 - <view class="row"><text class="label">收购情况</text><text class="value pre">{{ safeText(form.purchaseSituation) }}</text></view>  
38 - <view class="row"><text class="label">货源来源</text><text class="value">{{ safeText(purchaseSourceName) }}</text></view>  
39 - <view v-if="showPurchaseSourceOther" class="row"><text class="label">其他</text><text class="value">{{ safeText(form.purchaseSourceOther) }}</text></view>  
40 - <view class="row"><text class="label">生产情况</text><text class="value pre">{{ safeText(form.productionSituation) }}</text></view>  
41 - <view class="row"><text class="label">销售情况</text><text class="value pre">{{ safeText(form.salesSituation) }}</text></view>  
42 - <view class="row"><text class="label">是否享受优惠政策</text><text class="value">{{ safeText(preferentialPolicyName) }}</text></view>  
43 - <view class="row"><text class="label">详细说明</text><text class="value pre">{{ safeText(form.preferentialPolicyDetail) }}</text></view>  
44 - <view class="row"><text class="label">是否有被处罚记录</text><text class="value">{{ safeText(punishmentRecordName) }}</text></view>  
45 - <view class="row"><text class="label">经营范围是否相符</text><text class="value pre">{{ safeText(form.scopeMatch) }}</text></view>  
46 - <view class="row"><text class="label">是否投资期货</text><text class="value">{{ safeText(futuresInvestName) }}</text></view>  
47 - <view class="row"><text class="label">投资性质</text><text class="value">{{ safeText(investNatureName) }}</text></view>  
48 - <view class="row"><text class="label">上年度期货盈亏</text><text class="value">{{ safeText(form.lastYearFuturesProfitLoss) }}</text></view> 39 + <view class="row"><text class="label">主要品种</text><text class="value">{{ safeText(form.mainVarieties) }}</text></view>
  40 + <view class="row"><text class="label">月度收购量</text><text class="value">{{ safeText(form.monthlyPurchaseVolume) }}</text></view>
  41 + <view class="row"><text class="label">收购来源</text><text class="value">{{ safeText(purchaseSourceName) }}</text></view>
  42 + <view class="row"><text class="label">入库品名</text><text class="value">{{ safeText(form.stockInProductName) }}</text></view>
  43 + <view class="row"><text class="label">产品名称</text><text class="value">{{ safeText(form.productName) }}</text></view>
  44 + <view class="row"><text class="label">产能</text><text class="value">{{ safeText(form.capacity) }}</text></view>
  45 + <view class="row"><text class="label">销售渠道</text><text class="value">{{ safeText(form.salesChannel) }}</text></view>
  46 + <view class="row"><text class="label">操作方式</text><text class="value">{{ safeText(operationModeName) }}</text></view>
  47 + <view class="row"><text class="label">是否享有优惠政策</text><text class="value">{{ boolText(form.hasPreferentialPolicy) }}</text></view>
  48 + <view class="row"><text class="label">是否投资期货</text><text class="value">{{ boolText(form.investInFutures) }}</text></view>
  49 + <view class="row"><text class="label">是否有被处罚记录</text><text class="value">{{ boolText(form.hasPenaltyRecord) }}</text></view>
  50 + <view class="row"><text class="label">经营范围是否相符</text><text class="value">{{ boolText(form.businessScopeMatch) }}</text></view>
  51 + <view class="row"><text class="label">常见料质问题</text><text class="value pre">{{ safeText(form.commonMaterialIssue) }}</text></view>
  52 + <view class="row"><text class="label">合作中的其它问题</text><text class="value pre">{{ safeText(form.otherIssue) }}</text></view>
49 </view> 53 </view>
50 54
51 <view class="title-header"> 55 <view class="title-header">
@@ -53,13 +57,14 @@ @@ -53,13 +57,14 @@
53 <span>与我司的合作状况</span> 57 <span>与我司的合作状况</span>
54 </view> 58 </view>
55 <view class="section"> 59 <view class="section">
56 - <view class="row"><text class="label">合作年限</text><text class="value">{{ cooperationYearText }}</text></view>  
57 - <view class="row"><text class="label">主要操作方式</text><text class="value pre">{{ safeText(form.mainOperationMode) }}</text></view>  
58 - <view class="row"><text class="label">计划落空不良记录</text><text class="value">{{ safeText(badRecordPlanFailName) }}</text></view>  
59 - <view class="row"><text class="label">履行不到位现象</text><text class="value">{{ safeText(planNotFulfilledName) }}</text></view>  
60 - <view class="row"><text class="label">操作规范性</text><text class="value pre">{{ safeText(form.operationNorms) }}</text></view>  
61 - <view class="row"><text class="label">常见料质问题</text><text class="value pre">{{ safeText(form.commonMaterialIssues) }}</text></view>  
62 - <view class="row"><text class="label">合作中的其他问题</text><text class="value pre">{{ safeText(form.otherCooperationIssues) }}</text></view> 60 + <view class="row"><text class="label">首次合作年份</text><text class="value">{{ safeText(form.firstCooperationYear) }}</text></view>
  61 + <view class="row"><text class="label">是否新开发</text><text class="value">{{ safeText(isNewDevelopmentName) }}</text></view>
  62 + <view class="row"><text class="label">计划落空不良记录</text><text class="value">{{ boolText(form.hasFailedPlanRecord) }}</text></view>
  63 + <view class="row"><text class="label">履行不到位现象</text><text class="value">{{ boolText(form.hasPlanPerformanceIssue) }}</text></view>
  64 + <view class="row"><text class="label">进销账务如何处理</text><text class="value pre">{{ safeText(form.accountingProcess) }}</text></view>
  65 + <view class="row"><text class="label">开票品名是否一致</text><text class="value">{{ boolText(form.invoiceNameMatch) }}</text></view>
  66 + <view class="row"><text class="label">出库流程是否规范</text><text class="value">{{ boolText(form.outboundProcessStandard) }}</text></view>
  67 + <view class="row"><text class="label">运输方式</text><text class="value">{{ safeText(form.transportMode) }}</text></view>
63 </view> 68 </view>
64 69
65 <view class="title-header"> 70 <view class="title-header">
@@ -67,8 +72,9 @@ @@ -67,8 +72,9 @@
67 <span>其他</span> 72 <span>其他</span>
68 </view> 73 </view>
69 <view class="section"> 74 <view class="section">
70 - <view class="row"><text class="label">创建日期</text><text class="value">{{ safeText(form.createDate) }}</text></view>  
71 - <view class="row"><text class="label">评审时间</text><text class="value">{{ safeText(form.reviewDate) }}</text></view> 75 + <view class="row"><text class="label">资信调查人</text><text class="value">{{ safeText(form.investigatorName) }}</text></view>
  76 + <view class="row"><text class="label">采购处</text><text class="value">{{ safeText(purchaseDepartmentName) }}</text></view>
  77 + <view class="row"><text class="label">评审有效期</text><text class="value">{{ safeText(form.reviewValidUntil) }}</text></view>
72 <view class="row"> 78 <view class="row">
73 <text class="label">附件</text> 79 <text class="label">附件</text>
74 <view class="value"> 80 <view class="value">
@@ -88,6 +94,9 @@ @@ -88,6 +94,9 @@
88 <script> 94 <script>
89 import { downloadFile } from '@/utils/downloadFile.js' 95 import { downloadFile } from '@/utils/downloadFile.js'
90 import DetailButtons from '@/components/detail-buttons/index.vue' 96 import DetailButtons from '@/components/detail-buttons/index.vue'
  97 +import { getDicByCodes, getDicName } from '@/utils/dic.js'
  98 +import { domesticCustomerCreditGetApi } from '@/api/procure-manage/domesticCustomerCredit.js'
  99 +import { getPurchaseDeptApi } from '@/api/procure-manage/domesticCustomerCredit.js'
91 100
92 export default { 101 export default {
93 name: 'DomesticTradeDetail', 102 name: 'DomesticTradeDetail',
@@ -99,6 +108,13 @@ export default { @@ -99,6 +108,13 @@ export default {
99 id: '', 108 id: '',
100 loading: false, 109 loading: false,
101 form: {}, 110 form: {},
  111 + dicOptions: {
  112 + COMPANY_NATURE: [],
  113 + DEVELOP_NEW: [],
  114 + OPERATION_METHOD: [],
  115 + PURCHASE_SOURCE: []
  116 + },
  117 + purchaseDeptOptions: [],
102 buttons: [{ 118 buttons: [{
103 text: '编辑', 119 text: '编辑',
104 visible: true, 120 visible: true,
@@ -114,76 +130,50 @@ export default { @@ -114,76 +130,50 @@ export default {
114 ] 130 ]
115 }, 131 },
116 companyNatureOptions() { 132 companyNatureOptions() {
117 - return [  
118 - { label: '回收公司', value: 'RECYCLE' },  
119 - { label: '贸易公司', value: 'TRADE' },  
120 - { label: '进口拆解', value: 'IMPORT_DISMANTLE' },  
121 - { label: '工业制造', value: 'INDUSTRY_MANUFACTURE' },  
122 - { label: '福利企业', value: 'WELFARE_ENTERPRISE' },  
123 - { label: '其他', value: 'OTHER' }  
124 - ]  
125 - },  
126 - purchaseSourceOptions() {  
127 - return [  
128 - { label: '国外进口', value: 'IMPORT' },  
129 - { label: '本企业报废', value: 'SELF_SCRAP' },  
130 - { label: '零散收购', value: 'SCATTERED' },  
131 - { label: '其他', value: 'OTHER' }  
132 - ]  
133 - },  
134 - yesNoOptions() {  
135 - return [  
136 - { label: '是', value: 'YES' },  
137 - { label: '否', value: 'NO' }  
138 - ]  
139 - },  
140 - investNatureOptions() {  
141 - return [  
142 - { label: '投机', value: 'SPECULATION' },  
143 - { label: '保值', value: 'HEDGE' },  
144 - { label: '保值为主投机为辅', value: 'HEDGE_MAIN' }  
145 - ] 133 + return this.dicToSheetOptions(this.dicOptions.COMPANY_NATURE)
146 }, 134 },
147 attachments() { 135 attachments() {
148 - const arr = this.form && Array.isArray(this.form.attachments) ? this.form.attachments : []  
149 - return arr.filter(it => it && (it.id || it.name)).map(it => ({ id: it.id || '', name: it.name || '' })) 136 + const f = this.form || {}
  137 + const ids = f.attachmentFileIds != null ? String(f.attachmentFileIds) : ''
  138 + const names = f.attachmentFileNames != null ? String(f.attachmentFileNames) : ''
  139 + const idArr = ids ? ids.split(',').map(s => s.trim()).filter(Boolean) : []
  140 + const nameArr = names ? names.split(',') : []
  141 + if (idArr.length) {
  142 + return idArr.map((id, i) => ({ id, name: (nameArr[i] != null ? String(nameArr[i]) : '') }))
  143 + }
  144 + const legacy = Array.isArray(f.attachments) ? f.attachments : []
  145 + return legacy.filter(it => it && (it.id || it.name)).map(it => ({ id: it.id || '', name: it.name || '' }))
150 }, 146 },
151 showCompanyNatureOther() { 147 showCompanyNatureOther() {
152 const v = String((this.form && this.form.companyNature) || '') 148 const v = String((this.form && this.form.companyNature) || '')
153 return v.split(',').includes('OTHER') 149 return v.split(',').includes('OTHER')
154 }, 150 },
155 - showPurchaseSourceOther() {  
156 - return String((this.form && this.form.purchaseSource) || '') === 'OTHER'  
157 - },  
158 companyNatureName() { 151 companyNatureName() {
159 return this.safeText(this.form.companyNatureName) || this.labelsOf(this.companyNatureOptions, this.form.companyNature) 152 return this.safeText(this.form.companyNatureName) || this.labelsOf(this.companyNatureOptions, this.form.companyNature)
160 }, 153 },
161 purchaseSourceName() { 154 purchaseSourceName() {
162 - return this.safeText(this.form.purchaseSourceName) || this.labelOf(this.purchaseSourceOptions, this.form.purchaseSource)  
163 - },  
164 - preferentialPolicyName() {  
165 - return this.safeText(this.form.preferentialPolicyName) || this.labelOf(this.yesNoOptions, this.form.preferentialPolicy)  
166 - },  
167 - punishmentRecordName() {  
168 - return this.safeText(this.form.punishmentRecordName) || this.labelOf(this.yesNoOptions, this.form.punishmentRecord)  
169 - },  
170 - futuresInvestName() {  
171 - return this.safeText(this.form.futuresInvestName) || this.labelOf(this.yesNoOptions, this.form.futuresInvest) 155 + const v = this.form && this.form.purchaseSource != null ? String(this.form.purchaseSource) : ''
  156 + return v ? getDicName('PURCHASE_SOURCE', v, this.dicOptions.PURCHASE_SOURCE) : '-'
172 }, 157 },
173 - investNatureName() {  
174 - return this.safeText(this.form.investNatureName) || this.labelOf(this.investNatureOptions, this.form.investNature) 158 + operationModeName() {
  159 + const v = this.form && this.form.operationMode != null ? String(this.form.operationMode) : ''
  160 + return v ? getDicName('OPERATION_METHOD', v, this.dicOptions.OPERATION_METHOD) : '-'
175 }, 161 },
176 - badRecordPlanFailName() {  
177 - return this.safeText(this.form.badRecordPlanFailName) || this.labelOf(this.yesNoOptions, this.form.badRecordPlanFail) 162 + isNewDevelopmentName() {
  163 + const v = this.form && this.form.isNewDevelopment != null ? String(this.form.isNewDevelopment) : ''
  164 + return v ? getDicName('DEVELOP_NEW', v, this.dicOptions.DEVELOP_NEW) : '-'
178 }, 165 },
179 - planNotFulfilledName() {  
180 - return this.safeText(this.form.planNotFulfilledName) || this.labelOf(this.yesNoOptions, this.form.planNotFulfilled)  
181 - },  
182 - cooperationYearText() {  
183 - const y = this.safeText(this.form.cooperationStartYear)  
184 - return y ? `从${y}年开始合作` : '-' 166 + purchaseDepartmentName() {
  167 + const v = this.form && this.form.purchaseDepartment != null ? String(this.form.purchaseDepartment) : ''
  168 + if (!v) return '-'
  169 + const found = (this.purchaseDeptOptions || []).find(o => String(o.value) === v)
  170 + return found ? String(found.label || '') : v
185 } 171 }
186 }, 172 },
  173 + created() {
  174 + this.loadDicData()
  175 + this.loadPurchaseDeptOptions()
  176 + },
187 onShow() { 177 onShow() {
188 const options = (this.$route && this.$route.query) ? this.$route.query : {} 178 const options = (this.$route && this.$route.query) ? this.$route.query : {}
189 const id = options && options.id ? String(options.id) : '' 179 const id = options && options.id ? String(options.id) : ''
@@ -191,6 +181,35 @@ export default { @@ -191,6 +181,35 @@ export default {
191 this.loadDetail() 181 this.loadDetail()
192 }, 182 },
193 methods: { 183 methods: {
  184 + async loadDicData() {
  185 + try {
  186 + const results = await getDicByCodes(['COMPANY_NATURE', 'DEVELOP_NEW', 'OPERATION_METHOD', 'PURCHASE_SOURCE'])
  187 + this.dicOptions = {
  188 + COMPANY_NATURE: (results.COMPANY_NATURE && results.COMPANY_NATURE.data) || [],
  189 + DEVELOP_NEW: (results.DEVELOP_NEW && results.DEVELOP_NEW.data) || [],
  190 + OPERATION_METHOD: (results.OPERATION_METHOD && results.OPERATION_METHOD.data) || [],
  191 + PURCHASE_SOURCE: (results.PURCHASE_SOURCE && results.PURCHASE_SOURCE.data) || []
  192 + }
  193 + } catch (e) {
  194 + this.dicOptions = { COMPANY_NATURE: [], DEVELOP_NEW: [], OPERATION_METHOD: [], PURCHASE_SOURCE: [] }
  195 + }
  196 + },
  197 + async loadPurchaseDeptOptions() {
  198 + try {
  199 + const res = await getPurchaseDeptApi()
  200 + const list = (res && res.data) ? res.data : []
  201 + this.purchaseDeptOptions = (Array.isArray(list) ? list : []).map(it => ({
  202 + label: it && it.name != null ? String(it.name) : '',
  203 + value: it && it.id != null ? String(it.id) : ''
  204 + })).filter(it => it.value)
  205 + } catch (e) {
  206 + this.purchaseDeptOptions = []
  207 + }
  208 + },
  209 + dicToSheetOptions(items) {
  210 + const list = Array.isArray(items) ? items : []
  211 + return list.map(it => ({ label: it && it.name != null ? String(it.name) : '', value: it && it.code != null ? String(it.code) : '' })).filter(it => it.value)
  212 + },
194 handleButtonClick(btn) { 213 handleButtonClick(btn) {
195 if (!btn || btn.disabled) return 214 if (!btn || btn.disabled) return
196 if (typeof btn.onClick === 'function') return btn.onClick(this.detail, btn.params) 215 if (typeof btn.onClick === 'function') return btn.onClick(this.detail, btn.params)
@@ -200,16 +219,15 @@ export default { @@ -200,16 +219,15 @@ export default {
200 onEdit(params) { 219 onEdit(params) {
201 uni.navigateTo({ url: '/pages/domestic_trade/modify?id=' + this.id }) 220 uni.navigateTo({ url: '/pages/domestic_trade/modify?id=' + this.id })
202 }, 221 },
  222 + boolText(v) {
  223 + if (v === true) return '是'
  224 + if (v === false) return '否'
  225 + return '-'
  226 + },
203 safeText(v) { 227 safeText(v) {
204 const s = v == null ? '' : String(v) 228 const s = v == null ? '' : String(v)
205 return s.trim() ? s : '' 229 return s.trim() ? s : ''
206 }, 230 },
207 - labelOf(options, value) {  
208 - const v = value == null ? '' : String(value)  
209 - if (!v) return '-'  
210 - const found = (options || []).find(o => String(o.value) === v)  
211 - return found ? String(found.label) : v  
212 - },  
213 labelsOf(options, csv) { 231 labelsOf(options, csv) {
214 const v = csv == null ? '' : String(csv) 232 const v = csv == null ? '' : String(csv)
215 if (!v) return '-' 233 if (!v) return '-'
@@ -225,8 +243,13 @@ export default { @@ -225,8 +243,13 @@ export default {
225 async loadDetail() { 243 async loadDetail() {
226 this.loading = true 244 this.loading = true
227 try { 245 try {
228 - const data = await this.mockGetDetail(this.id)  
229 - this.form = data || {} 246 + const res = await domesticCustomerCreditGetApi(this.id)
  247 + const data = (res && res.data) ? res.data : {}
  248 + const u = (this.$store && this.$store.state && this.$store.state.user) ? this.$store.state.user : {}
  249 + if (!data.investigatorName && data.investigatorId && u && String(u.id || '') === String(data.investigatorId || '')) {
  250 + data.investigatorName = u && u.name ? String(u.name) : ''
  251 + }
  252 + this.form = data
230 } catch (e) { 253 } catch (e) {
231 this.form = {} 254 this.form = {}
232 uni.showToast({ title: '详情加载失败', icon: 'none' }) 255 uni.showToast({ title: '详情加载失败', icon: 'none' })
@@ -234,79 +257,6 @@ export default { @@ -234,79 +257,6 @@ export default {
234 this.loading = false 257 this.loading = false
235 } 258 }
236 }, 259 },
237 - mockGetDetail(id) {  
238 - return new Promise(resolve => {  
239 - const stored = this.tryLoadFromStorage(id)  
240 - if (stored) return setTimeout(() => resolve(stored), 180)  
241 - setTimeout(() => resolve(this.buildMockDetail(id)), 180)  
242 - })  
243 - },  
244 - tryLoadFromStorage(id) {  
245 - try {  
246 - const raw = uni.getStorageSync('DOMESTIC_TRADE_RECORDS')  
247 - const arr = Array.isArray(raw) ? raw : (raw && Array.isArray(raw.list) ? raw.list : [])  
248 - if (!id) return arr && arr[0] ? arr[0] : null  
249 - const found = (arr || []).find(it => it && String(it.id || '') === String(id))  
250 - return found || null  
251 - } catch (e) {  
252 - return null  
253 - }  
254 - },  
255 - buildMockDetail(id) {  
256 - const now = new Date()  
257 - const createDate = this.formatDate(now)  
258 - return {  
259 - id: id || '1',  
260 - companyName: '华东商贸有限公司1',  
261 - companyNature: 'RECYCLE,OTHER',  
262 - companyNatureOther: '再生资源综合回收',  
263 - bankName: '中国工商银行上海分行',  
264 - bankAccount: '6222020202020202',  
265 - registeredCapital: '500',  
266 - annualTurnover: '2600',  
267 - legalRepresentative: '张三',  
268 - companyFoundedDate: '2018-06-01',  
269 - address: '上海市浦东新区示例路 88 号',  
270 - businessOwner: '李四',  
271 - position: '总经理',  
272 - phone: '13800000000',  
273 - fax: '021-88888888',  
274 - legalBusinessRelation: '亲属',  
275 - liquidWorkingCapital: '流动资金 300 万;购销结算期限 30 天;债权债务情况正常',  
276 - fixedAssets: '厂房产权自有 2000㎡;主要设备投资 800 万;仓库自有 1200㎡;正常库存量 300 吨',  
277 - purchaseSituation: '主要品种:铜、铁;收购量:月均 1200 吨;上年度利润:铜 120 万,铁 80 万;入库流程规范',  
278 - purchaseSource: 'OTHER',  
279 - purchaseSourceOther: '本地回收站合作渠道',  
280 - productionSituation: '产品:再生铜;产能:月均 800 吨;能耗:电 40 万度/月',  
281 - salesSituation: '渠道:长期客户+现货;回款方式:承兑/转账;结算期限:30-60 天',  
282 - preferentialPolicy: 'NO',  
283 - preferentialPolicyDetail: '',  
284 - punishmentRecord: 'NO',  
285 - scopeMatch: '相符',  
286 - futuresInvest: 'YES',  
287 - investNature: 'HEDGE_MAIN',  
288 - lastYearFuturesProfitLoss: '盈利 15 万',  
289 - cooperationStartYear: '2021',  
290 - mainOperationMode: '现货+月度计划',  
291 - badRecordPlanFail: 'NO',  
292 - planNotFulfilled: 'NO',  
293 - operationNorms: '账务按月对账;开票品名一致;出库流程规范;运输发票齐全',  
294 - commonMaterialIssues: '含杂偏高、含水偏高',  
295 - otherCooperationIssues: '暂无',  
296 - createDate,  
297 - reviewDate: '',  
298 - attachments: [  
299 - { id: 'mock-file-1', name: '资信调查表.pdf' },  
300 - { id: 'mock-file-2', name: '营业执照.jpg' }  
301 - ]  
302 - }  
303 - },  
304 - formatDate(d) {  
305 - const y = d.getFullYear()  
306 - const m = String(d.getMonth() + 1).padStart(2, '0')  
307 - const da = String(d.getDate()).padStart(2, '0')  
308 - return `${y}-${m}-${da}`  
309 - },  
310 onDownload(item) { 260 onDownload(item) {
311 if (!item || !item.id) return 261 if (!item || !item.id) return
312 downloadFile(item.id, item.name || 'download') 262 downloadFile(item.id, item.name || 'download')
@@ -324,7 +274,7 @@ export default { @@ -324,7 +274,7 @@ export default {
324 274
325 .scroll { 275 .scroll {
326 flex: 1; 276 flex: 1;
327 - padding: 8rpx 0 24rpx 0; 277 + padding: 8rpx 0 144rpx;
328 } 278 }
329 279
330 .detail-page { 280 .detail-page {
@@ -18,20 +18,20 @@ @@ -18,20 +18,20 @@
18 <template v-slot="{ item }"> 18 <template v-slot="{ item }">
19 <view class="card" @click.stop="onCardClick(item)"> 19 <view class="card" @click.stop="onCardClick(item)">
20 <view class="card-header"> 20 <view class="card-header">
21 - <text class="title omit2">{{ item.companyName || '-' }}</text>  
22 - <text :class="['status', `status_${item.auditStatus}`]">{{ getAuditStatusText(item.auditStatus) }}</text> 21 + <text class="title omit2">{{ item.unitName || '-' }}</text>
  22 + <text :class="['status', `status_${item.status}`]">{{ getAuditStatusText(item.status) }}</text>
23 </view> 23 </view>
24 <view class="info-row"> 24 <view class="info-row">
25 - <text>公司性质</text><text>{{ item.companyNature || '-' }}</text> 25 + <text>公司性质</text><text>{{ companyNatureText(item) }}</text>
26 </view> 26 </view>
27 <view class="info-row"> 27 <view class="info-row">
28 - <text>电话</text><text>{{ item.phone || '-' }}</text> 28 + <text>电话</text><text>{{ item.businessPrincipalPhone || '-' }}</text>
29 </view> 29 </view>
30 <view class="info-row"> 30 <view class="info-row">
31 - <text>业务负责人</text><text>{{ item.businessOwner || '-' }}</text> 31 + <text>业务负责人</text><text>{{ item.businessPrincipal || '-' }}</text>
32 </view> 32 </view>
33 <view class="info-row"> 33 <view class="info-row">
34 - <text>创建日期</text><text>{{ item.createDate || '-' }}</text> 34 + <text>登记日期</text><text>{{ formatDateOnly(item.createTime) }}</text>
35 </view> 35 </view>
36 </view> 36 </view>
37 </template> 37 </template>
@@ -45,7 +45,7 @@ @@ -45,7 +45,7 @@
45 <view class="form-item"> 45 <view class="form-item">
46 <view class="label">审核状态</view> 46 <view class="label">审核状态</view>
47 <uni-data-checkbox mode="tag" :multiple="false" :value-field="'value'" :text-field="'text'" 47 <uni-data-checkbox mode="tag" :multiple="false" :value-field="'value'" :text-field="'text'"
48 - v-model="model.auditStatus" @change="onAuditStatusChange" :localdata="auditStatusOptions" /> 48 + v-model="model.status" @change="onAuditStatusChange" :localdata="statusOptions" />
49 </view> 49 </view>
50 <view class="form-item"> 50 <view class="form-item">
51 <view class="label">登记日期</view> 51 <view class="label">登记日期</view>
@@ -60,6 +60,8 @@ @@ -60,6 +60,8 @@
60 <script> 60 <script>
61 import CardList from '@/components/card/index.vue' 61 import CardList from '@/components/card/index.vue'
62 import FilterModal from '@/components/filter/index.vue' 62 import FilterModal from '@/components/filter/index.vue'
  63 +import { getDicByCodes, getDicName } from '@/utils/dic.js'
  64 +import { domesticCustomerCreditQueryApi } from '@/api/procure-manage/domesticCustomerCredit.js'
63 65
64 export default { 66 export default {
65 name: 'DomesticTradeList', 67 name: 'DomesticTradeList',
@@ -70,34 +72,42 @@ export default { @@ -70,34 +72,42 @@ export default {
70 searchKeywordDebounced: '', 72 searchKeywordDebounced: '',
71 searchDebounceTimer: null, 73 searchDebounceTimer: null,
72 query: { 74 query: {
73 - companyName: '',  
74 - auditStatus: '', 75 + unitName: '',
  76 + status: '',
75 dateRange: [] 77 dateRange: []
76 }, 78 },
77 extraParams: {}, 79 extraParams: {},
78 currentItems: [], 80 currentItems: [],
79 filterVisible: false, 81 filterVisible: false,
80 filterForm: { 82 filterForm: {
81 - auditStatus: '', 83 + status: '',
82 dateRange: [] 84 dateRange: []
83 }, 85 },
84 - auditStatusOptions: [  
85 - { value: '', text: '全部' },  
86 - { value: 'AUDIT', text: '审核中' },  
87 - { value: 'PASS', text: '通过' },  
88 - { value: 'REFUSE', text: '驳回' },  
89 - { value: 'CANCEL', text: '已取消' } 86 + statusOptions: [
  87 + { value: '', text: '全部' }
90 ], 88 ],
91 - mockAll: [] 89 + dicOptions: {
  90 + AUDIT_STATUS: [],
  91 + COMPANY_NATURE: []
  92 + },
92 } 93 }
93 }, 94 },
94 watch: { 95 watch: {
95 searchKeywordDebounced(v) { 96 searchKeywordDebounced(v) {
96 - this.query = { ...this.query, companyName: v || '' } 97 + this.query = { ...this.query, unitName: v || '' }
97 } 98 }
98 }, 99 },
99 created() { 100 created() {
100 - this.mockAll = this.buildMockList(60) 101 + this.loadDicData()
  102 + },
  103 + onShow() {
  104 + let needRefresh = ''
  105 + try { needRefresh = uni.getStorageSync('DOMESTIC_TRADE_LIST_NEED_REFRESH') } catch (e) {}
  106 + if (!needRefresh) return
  107 + try { uni.removeStorageSync('DOMESTIC_TRADE_LIST_NEED_REFRESH') } catch (e) {}
  108 + if (this.$refs && this.$refs.cardRef && this.$refs.cardRef.reload) {
  109 + this.$refs.cardRef.reload()
  110 + }
101 }, 111 },
102 onReachBottom() { 112 onReachBottom() {
103 if (this.$refs && this.$refs.cardRef && this.$refs.cardRef.onLoadMore) { 113 if (this.$refs && this.$refs.cardRef && this.$refs.cardRef.onLoadMore) {
@@ -111,6 +121,36 @@ export default { @@ -111,6 +121,36 @@ export default {
111 } 121 }
112 }, 122 },
113 methods: { 123 methods: {
  124 + async loadDicData() {
  125 + try {
  126 + const results = await getDicByCodes(['AUDIT_STATUS', 'COMPANY_NATURE'])
  127 + this.dicOptions.AUDIT_STATUS = (results.AUDIT_STATUS && results.AUDIT_STATUS.data) || []
  128 + this.dicOptions.COMPANY_NATURE = (results.COMPANY_NATURE && results.COMPANY_NATURE.data) || []
  129 + const list = Array.isArray(this.dicOptions.AUDIT_STATUS) ? this.dicOptions.AUDIT_STATUS : []
  130 + this.statusOptions = [{ value: '', text: '全部' }].concat(
  131 + list.map(it => ({ value: it && it.code != null ? String(it.code) : '', text: it && it.name != null ? String(it.name) : '' })).filter(it => it.value)
  132 + )
  133 + } catch (e) {
  134 + this.dicOptions.AUDIT_STATUS = []
  135 + this.dicOptions.COMPANY_NATURE = []
  136 + this.statusOptions = [{ value: '', text: '全部' }]
  137 + }
  138 + },
  139 + companyNatureText(item) {
  140 + const v = item && item.companyNature != null ? String(item.companyNature) : ''
  141 + if (!v) return '-'
  142 + const parts = v.split(',').map(s => s.trim()).filter(Boolean)
  143 + if (parts.length > 1) {
  144 + return parts.map(code => getDicName('COMPANY_NATURE', code, this.dicOptions.COMPANY_NATURE)).filter(Boolean).join(',')
  145 + }
  146 + return getDicName('COMPANY_NATURE', v, this.dicOptions.COMPANY_NATURE) || v
  147 + },
  148 + formatDateOnly(v) {
  149 + const s = v == null ? '' : String(v).trim()
  150 + if (!s) return '-'
  151 + if (s.length >= 10) return s.slice(0, 10)
  152 + return s
  153 + },
114 onAdd() { 154 onAdd() {
115 uni.navigateTo({ url: '/pages/domestic_trade/add' }) 155 uni.navigateTo({ url: '/pages/domestic_trade/add' })
116 }, 156 },
@@ -134,7 +174,7 @@ export default { @@ -134,7 +174,7 @@ export default {
134 }, 174 },
135 openFilter() { 175 openFilter() {
136 this.filterForm = { 176 this.filterForm = {
137 - auditStatus: this.query.auditStatus || '', 177 + status: this.query.status || '',
138 dateRange: Array.isArray(this.query.dateRange) ? this.query.dateRange.slice(0) : [] 178 dateRange: Array.isArray(this.query.dateRange) ? this.query.dateRange.slice(0) : []
139 } 179 }
140 this.filterVisible = true 180 this.filterVisible = true
@@ -144,102 +184,46 @@ export default { @@ -144,102 +184,46 @@ export default {
144 }, 184 },
145 onFilterConfirm(payload) { 185 onFilterConfirm(payload) {
146 this.query = { 186 this.query = {
147 - companyName: this.query.companyName || '',  
148 - auditStatus: payload.auditStatus || '', 187 + unitName: this.query.unitName || '',
  188 + status: payload.status || '',
149 dateRange: Array.isArray(payload.dateRange) ? payload.dateRange : [] 189 dateRange: Array.isArray(payload.dateRange) ? payload.dateRange : []
150 } 190 }
151 }, 191 },
152 onAuditStatusChange(e) { 192 onAuditStatusChange(e) {
153 const raw = e && e.detail && e.detail.value !== undefined ? e.detail.value : (e && e.value !== undefined ? e.value : '') 193 const raw = e && e.detail && e.detail.value !== undefined ? e.detail.value : (e && e.value !== undefined ? e.value : '')
154 - this.filterForm.auditStatus = raw 194 + this.filterForm.status = raw
155 }, 195 },
156 getAuditStatusText(status) { 196 getAuditStatusText(status) {
157 - const found = (this.auditStatusOptions || []).find(it => it.value === status)  
158 - return found ? found.text : (status || '-') 197 + const v = status == null ? '' : String(status)
  198 + if (!v) return '-'
  199 + return getDicName('AUDIT_STATUS', v, this.dicOptions.AUDIT_STATUS) || v
159 }, 200 },
160 fetchList({ pageIndex, pageSize, query }) { 201 fetchList({ pageIndex, pageSize, query }) {
161 - const listAll = Array.isArray(this.mockAll) ? this.mockAll : []  
162 const q = query || {} 202 const q = query || {}
163 - const name = (q.companyName || '').trim()  
164 - const status = q.auditStatus || ''  
165 const range = Array.isArray(q.dateRange) ? q.dateRange : [] 203 const range = Array.isArray(q.dateRange) ? q.dateRange : []
166 - const start = range && range.length === 2 ? range[0] : ''  
167 - const end = range && range.length === 2 ? range[1] : ''  
168 -  
169 - let filtered = listAll.slice(0)  
170 - if (name) {  
171 - const kw = name.toLowerCase()  
172 - filtered = filtered.filter(it => String(it.companyName || '').toLowerCase().includes(kw)) 204 + const params = {
  205 + pageIndex,
  206 + pageSize,
  207 + unitName: q.unitName || '',
  208 + status: q.status || '',
  209 + createDateStart: (range && range.length === 2) ? range[0] : '',
  210 + createDateEnd: (range && range.length === 2) ? range[1] : ''
173 } 211 }
174 - if (status) {  
175 - filtered = filtered.filter(it => it.auditStatus === status)  
176 - }  
177 - if (start && end) {  
178 - const s = String(start)  
179 - const ed = String(end)  
180 - filtered = filtered.filter(it => {  
181 - const d = String(it.registerDate || it.createDate || '')  
182 - return d >= s && d <= ed  
183 - })  
184 - }  
185 -  
186 - const totalCount = filtered.length  
187 - const begin = (Number(pageIndex || 1) - 1) * Number(pageSize || 10)  
188 - const endIdx = begin + Number(pageSize || 10)  
189 - const records = filtered.slice(begin, endIdx)  
190 - const hasNext = endIdx < totalCount  
191 -  
192 - return new Promise(resolve => {  
193 - setTimeout(() => resolve({ records, totalCount, hasNext }), 220) 212 + return domesticCustomerCreditQueryApi(params).then(res => {
  213 + const _data = res && res.data ? res.data : {}
  214 + let records = _data.datas || _data.list || _data.records || []
  215 + const totalCount = _data.totalCount || _data.count || 0
  216 + const hasNext = _data.hasNext || false
  217 + records = records.map(it => ({ ...it }))
  218 + return { records, totalCount, hasNext }
  219 + }).catch(() => {
  220 + this.onCardError()
  221 + return { records: [], totalCount: 0, hasNext: false }
194 }) 222 })
195 }, 223 },
196 onCardClick(item) { 224 onCardClick(item) {
197 uni.navigateTo({ url: '/pages/domestic_trade/detail?id=' + item.id }) 225 uni.navigateTo({ url: '/pages/domestic_trade/detail?id=' + item.id })
198 }, 226 },
199 - buildMockList(count) {  
200 - const n = Number(count || 0)  
201 - const natures = ['民营', '国企', '外资', '合资', '其他']  
202 - const statusPool = ['AUDIT', 'PASS', 'REFUSE', 'CANCEL']  
203 - const baseNames = ['华东', '华南', '华北', '西南', '中原', '海纳', '启航', '远成', '融盛', '天泽']  
204 - const owners = ['张三', '李四', '王五', '赵六', '周七', '吴八', '郑九', '钱十']  
205 - const list = []  
206 - for (let i = 0; i < n; i++) {  
207 - const idx = i + 1  
208 - const companyName = `${baseNames[i % baseNames.length]}商贸有限公司${idx}`  
209 - const auditStatus = statusPool[i % statusPool.length]  
210 - const companyNature = natures[i % natures.length]  
211 - const businessOwner = owners[i % owners.length]  
212 - const phone = this.mockPhone(i)  
213 - const daysAgo = i % 40  
214 - const date = this.formatDate(this.addDays(new Date(), -daysAgo))  
215 - list.push({  
216 - id: String(idx),  
217 - companyName,  
218 - companyNature,  
219 - phone,  
220 - businessOwner,  
221 - auditStatus,  
222 - registerDate: date,  
223 - createDate: date  
224 - })  
225 - }  
226 - return list  
227 - },  
228 - mockPhone(i) {  
229 - const s = String(13000000000 + (i % 900000000))  
230 - return s.slice(0, 11)  
231 - },  
232 - addDays(d, days) {  
233 - const dt = new Date(d.getTime())  
234 - dt.setDate(dt.getDate() + Number(days || 0))  
235 - return dt  
236 - },  
237 - formatDate(d) {  
238 - const y = d.getFullYear()  
239 - const m = String(d.getMonth() + 1).padStart(2, '0')  
240 - const da = String(d.getDate()).padStart(2, '0')  
241 - return `${y}-${m}-${da}`  
242 - }  
243 } 227 }
244 } 228 }
245 </script> 229 </script>
@@ -9,7 +9,7 @@ @@ -9,7 +9,7 @@
9 9
10 <uni-list-item title="单位名称"> 10 <uni-list-item title="单位名称">
11 <template v-slot:footer> 11 <template v-slot:footer>
12 - <uni-easyinput v-model="form.companyName" placeholder="请输入单位名称" :inputBorder="false" /> 12 + <uni-easyinput v-model="form.unitName" placeholder="请输入单位名称" :inputBorder="false" />
13 </template> 13 </template>
14 </uni-list-item> 14 </uni-list-item>
15 15
@@ -49,18 +49,6 @@ @@ -49,18 +49,6 @@
49 </template> 49 </template>
50 </uni-list-item> 50 </uni-list-item>
51 51
52 - <uni-list-item class="amount-item">  
53 - <template v-slot:body>  
54 - <view class="item-title"><text>年营业额</text></view>  
55 - </template>  
56 - <template v-slot:footer>  
57 - <view class="amount-row">  
58 - <uni-easyinput type="digit" v-model="form.annualTurnover" placeholder="请输入" :inputBorder="false" />  
59 - <text class="unit">万元</text>  
60 - </view>  
61 - </template>  
62 - </uni-list-item>  
63 -  
64 <uni-list-item title="法人代表"> 52 <uni-list-item title="法人代表">
65 <template v-slot:footer> 53 <template v-slot:footer>
66 <uni-easyinput v-model="form.legalRepresentative" placeholder="请输入法人代表" :inputBorder="false" /> 54 <uni-easyinput v-model="form.legalRepresentative" placeholder="请输入法人代表" :inputBorder="false" />
@@ -69,7 +57,7 @@ @@ -69,7 +57,7 @@
69 57
70 <uni-list-item title="公司成立时间"> 58 <uni-list-item title="公司成立时间">
71 <template v-slot:footer> 59 <template v-slot:footer>
72 - <uni-datetime-picker type="date" v-model="form.companyFoundedDate" /> 60 + <uni-datetime-picker type="date" v-model="form.companyEstablishedTime" />
73 </template> 61 </template>
74 </uni-list-item> 62 </uni-list-item>
75 63
@@ -81,25 +69,19 @@ @@ -81,25 +69,19 @@
81 69
82 <uni-list-item title="业务负责人"> 70 <uni-list-item title="业务负责人">
83 <template v-slot:footer> 71 <template v-slot:footer>
84 - <uni-easyinput v-model="form.businessOwner" placeholder="请输入业务负责人" :inputBorder="false" /> 72 + <uni-easyinput v-model="form.businessPrincipal" placeholder="请输入业务负责人" :inputBorder="false" />
85 </template> 73 </template>
86 </uni-list-item> 74 </uni-list-item>
87 75
88 <uni-list-item title="职务"> 76 <uni-list-item title="职务">
89 <template v-slot:footer> 77 <template v-slot:footer>
90 - <uni-easyinput v-model="form.position" placeholder="请输入职务" :inputBorder="false" /> 78 + <uni-easyinput v-model="form.businessPrincipalPosition" placeholder="请输入职务" :inputBorder="false" />
91 </template> 79 </template>
92 </uni-list-item> 80 </uni-list-item>
93 81
94 <uni-list-item title="电话"> 82 <uni-list-item title="电话">
95 <template v-slot:footer> 83 <template v-slot:footer>
96 - <uni-easyinput type="number" v-model="form.phone" placeholder="请输入手机号码" :inputBorder="false" />  
97 - </template>  
98 - </uni-list-item>  
99 -  
100 - <uni-list-item title="传真">  
101 - <template v-slot:footer>  
102 - <uni-easyinput v-model="form.fax" placeholder="请输入传真" :inputBorder="false" /> 84 + <uni-easyinput type="number" v-model="form.businessPrincipalPhone" placeholder="请输入手机号码" :inputBorder="false" />
103 </template> 85 </template>
104 </uni-list-item> 86 </uni-list-item>
105 87
@@ -114,17 +96,39 @@ @@ -114,17 +96,39 @@
114 <span>资产状况</span> 96 <span>资产状况</span>
115 </view> 97 </view>
116 98
117 - <uni-list-item title="流动资金"> 99 + <uni-list-item title="生产厂房及办公楼产权">
118 <template v-slot:footer> 100 <template v-slot:footer>
119 - <uni-easyinput type="textarea" v-model="form.liquidWorkingCapital" placeholder="1、流动资金 2、购、销结算期限 3、债券债务情况"  
120 - :inputBorder="false" maxlength="2000" /> 101 + <uni-easyinput v-model="form.factoryOfficeProperty" placeholder="请输入" :inputBorder="false" />
121 </template> 102 </template>
122 </uni-list-item> 103 </uni-list-item>
123 104
124 - <uni-list-item class="mgb10" title="固定资产"> 105 + <uni-list-item title="生产厂房及办公楼面积">
125 <template v-slot:footer> 106 <template v-slot:footer>
126 - <uni-easyinput type="textarea" v-model="form.fixedAssets" placeholder="1、厂房/办公楼产权、面积 2、主要设备投资规模及产权 3、仓库或货场产权、面积 4、正常库存量"  
127 - :inputBorder="false" maxlength="3000" /> 107 + <uni-easyinput v-model="form.factoryOfficeArea" placeholder="请输入" :inputBorder="false" />
  108 + </template>
  109 + </uni-list-item>
  110 +
  111 + <uni-list-item title="仓库或货场产权">
  112 + <template v-slot:footer>
  113 + <uni-easyinput v-model="form.warehouseYardProperty" placeholder="请输入" :inputBorder="false" />
  114 + </template>
  115 + </uni-list-item>
  116 +
  117 + <uni-list-item title="仓库或货场产权面积">
  118 + <template v-slot:footer>
  119 + <uni-easyinput v-model="form.warehouseYardArea" placeholder="请输入" :inputBorder="false" />
  120 + </template>
  121 + </uni-list-item>
  122 +
  123 + <uni-list-item title="主要生产设备">
  124 + <template v-slot:footer>
  125 + <uni-easyinput type="textarea" v-model="form.mainEquipment" placeholder="请输入" :inputBorder="false" maxlength="2000" />
  126 + </template>
  127 + </uni-list-item>
  128 +
  129 + <uni-list-item class="mgb10" title="正常库存量">
  130 + <template v-slot:footer>
  131 + <uni-easyinput v-model="form.normalInventory" placeholder="请输入" :inputBorder="false" />
128 </template> 132 </template>
129 </uni-list-item> 133 </uni-list-item>
130 134
@@ -133,82 +137,93 @@ @@ -133,82 +137,93 @@
133 <span>生产经营环节风险调查</span> 137 <span>生产经营环节风险调查</span>
134 </view> 138 </view>
135 139
136 - <uni-list-item title="收购情况"> 140 + <uni-list-item title="主要品种">
137 <template v-slot:footer> 141 <template v-slot:footer>
138 - <uni-easyinput type="textarea" v-model="form.purchaseSituation"  
139 - placeholder="1、主要品种及收购量 2、经营绩效状况(上年度利润,区分铜/铁等) 4、入库流程及入库品名" :inputBorder="false"  
140 - maxlength="3000" /> 142 + <uni-easyinput v-model="form.mainVarieties" placeholder="请输入" :inputBorder="false" />
141 </template> 143 </template>
142 </uni-list-item> 144 </uni-list-item>
143 - <uni-list-item class="select-item" :class="form.purchaseSourceName ? 'is-filled' : 'is-empty'" clickable  
144 - @click="openSheet('purchaseSource')" :rightText="displayLabel('purchaseSourceName')" showArrow>  
145 - <template v-slot:body>  
146 - <view class="item-title"><text>货源来源</text></view> 145 +
  146 + <uni-list-item title="月度收购量">
  147 + <template v-slot:footer>
  148 + <uni-easyinput v-model="form.monthlyPurchaseVolume" placeholder="请输入" :inputBorder="false" />
147 </template> 149 </template>
148 </uni-list-item> 150 </uni-list-item>
149 - <uni-list-item v-if="showPurchaseSourceOther" class="mgb10" title="其他">  
150 - <template v-slot:footer>  
151 - <uni-easyinput v-model="form.purchaseSourceOther" placeholder="请输入其他货源来源" :inputBorder="false" /> 151 +
  152 + <uni-list-item class="select-item" :class="form.purchaseSource ? 'is-filled' : 'is-empty'" clickable
  153 + @click="openSheet('purchaseSource')" :rightText="displayLabel('purchaseSource')" showArrow>
  154 + <template v-slot:body>
  155 + <view class="item-title"><text>收购来源</text></view>
152 </template> 156 </template>
153 </uni-list-item> 157 </uni-list-item>
154 158
155 - <uni-list-item title="生产情况"> 159 + <uni-list-item title="入库品名">
156 <template v-slot:footer> 160 <template v-slot:footer>
157 - <uni-easyinput type="textarea" v-model="form.productionSituation" placeholder="1、产品介绍 2、产能及对应能耗"  
158 - :inputBorder="false" maxlength="2000" /> 161 + <uni-easyinput v-model="form.stockInProductName" placeholder="请输入" :inputBorder="false" />
159 </template> 162 </template>
160 </uni-list-item> 163 </uni-list-item>
161 164
162 - <uni-list-item title="销售情况"> 165 + <uni-list-item title="产品名称">
163 <template v-slot:footer> 166 <template v-slot:footer>
164 - <uni-easyinput type="textarea" v-model="form.salesSituation" placeholder="销售渠道、销量及操作方式、货款回笼方式、结算期限"  
165 - :inputBorder="false" maxlength="2000" /> 167 + <uni-easyinput v-model="form.productName" placeholder="请输入" :inputBorder="false" />
166 </template> 168 </template>
167 </uni-list-item> 169 </uni-list-item>
168 170
169 - <uni-list-item class="select-item" :class="form.preferentialPolicyName ? 'is-filled' : 'is-empty'" clickable  
170 - @click="openSheet('preferentialPolicy')" :rightText="displayLabel('preferentialPolicyName')" showArrow>  
171 - <template v-slot:body>  
172 - <view class="item-title"><text>是否享受优惠政策</text></view> 171 + <uni-list-item title="产能">
  172 + <template v-slot:footer>
  173 + <uni-easyinput v-model="form.capacity" placeholder="请输入" :inputBorder="false" />
173 </template> 174 </template>
174 </uni-list-item> 175 </uni-list-item>
175 - <uni-list-item class="mgb10" title="详细说明"> 176 +
  177 + <uni-list-item title="销售渠道">
176 <template v-slot:footer> 178 <template v-slot:footer>
177 - <uni-easyinput type="textarea" v-model="form.preferentialPolicyDetail" placeholder="请输入详细说明"  
178 - :inputBorder="false" maxlength="2000" /> 179 + <uni-easyinput v-model="form.salesChannel" placeholder="请输入" :inputBorder="false" />
179 </template> 180 </template>
180 </uni-list-item> 181 </uni-list-item>
181 182
182 - <uni-list-item class="select-item" :class="form.punishmentRecordName ? 'is-filled' : 'is-empty'" clickable  
183 - @click="openSheet('punishmentRecord')" :rightText="displayLabel('punishmentRecordName')" showArrow> 183 + <uni-list-item class="select-item" :class="form.operationMode ? 'is-filled' : 'is-empty'" clickable
  184 + @click="openSheet('operationMode')" :rightText="displayLabel('operationMode')" showArrow>
184 <template v-slot:body> 185 <template v-slot:body>
185 - <view class="item-title"><text>是否有被处罚记录</text></view> 186 + <view class="item-title"><text>操作方式</text></view>
186 </template> 187 </template>
187 </uni-list-item> 188 </uni-list-item>
188 - <uni-list-item class="mgb10" title="实际经营范围与法定经营范围是否相符">  
189 - <template v-slot:footer>  
190 - <uni-easyinput type="textarea" v-model="form.scopeMatch" placeholder="请输入" :inputBorder="false"  
191 - maxlength="2000" /> 189 +
  190 + <uni-list-item class="select-item" :class="form.hasPreferentialPolicy === true || form.hasPreferentialPolicy === false ? 'is-filled' : 'is-empty'" clickable
  191 + @click="openSheet('hasPreferentialPolicy')" :rightText="displayLabel('hasPreferentialPolicy')" showArrow>
  192 + <template v-slot:body>
  193 + <view class="item-title"><text>是否享有优惠政策</text></view>
192 </template> 194 </template>
193 </uni-list-item> 195 </uni-list-item>
194 196
195 - <uni-list-item class="select-item" :class="form.futuresInvestName ? 'is-filled' : 'is-empty'" clickable  
196 - @click="openSheet('futuresInvest')" :rightText="displayLabel('futuresInvestName')" showArrow> 197 + <uni-list-item class="select-item" :class="form.investInFutures === true || form.investInFutures === false ? 'is-filled' : 'is-empty'" clickable
  198 + @click="openSheet('investInFutures')" :rightText="displayLabel('investInFutures')" showArrow>
197 <template v-slot:body> 199 <template v-slot:body>
198 <view class="item-title"><text>是否投资期货</text></view> 200 <view class="item-title"><text>是否投资期货</text></view>
199 </template> 201 </template>
200 </uni-list-item> 202 </uni-list-item>
201 203
202 - <uni-list-item class="select-item" :class="form.investNatureName ? 'is-filled' : 'is-empty'" clickable  
203 - @click="openSheet('investNature')" :rightText="displayLabel('investNatureName')" showArrow> 204 + <uni-list-item class="select-item" :class="form.hasPenaltyRecord === true || form.hasPenaltyRecord === false ? 'is-filled' : 'is-empty'" clickable
  205 + @click="openSheet('hasPenaltyRecord')" :rightText="displayLabel('hasPenaltyRecord')" showArrow>
  206 + <template v-slot:body>
  207 + <view class="item-title"><text>是否有被处罚记录</text></view>
  208 + </template>
  209 + </uni-list-item>
  210 +
  211 + <uni-list-item class="select-item" :class="form.businessScopeMatch === true || form.businessScopeMatch === false ? 'is-filled' : 'is-empty'" clickable
  212 + @click="openSheet('businessScopeMatch')" :rightText="displayLabel('businessScopeMatch')" showArrow>
204 <template v-slot:body> 213 <template v-slot:body>
205 - <view class="item-title"><text>投资性质</text></view> 214 + <view class="item-title"><text>实际经营范围与法定经营范围是否相符</text></view>
  215 + </template>
  216 + </uni-list-item>
  217 +
  218 + <uni-list-item title="常见料质问题">
  219 + <template v-slot:footer>
  220 + <uni-easyinput type="textarea" v-model="form.commonMaterialIssue" placeholder="请输入" :inputBorder="false" maxlength="2000" />
206 </template> 221 </template>
207 </uni-list-item> 222 </uni-list-item>
208 223
209 - <uni-list-item class="mgb10" title="上年度期货盈亏"> 224 + <uni-list-item class="mgb10" title="合作中的其它问题">
210 <template v-slot:footer> 225 <template v-slot:footer>
211 - <uni-easyinput v-model="form.lastYearFuturesProfitLoss" placeholder="请输入" :inputBorder="false" /> 226 + <uni-easyinput type="textarea" v-model="form.otherIssue" placeholder="请输入" :inputBorder="false" maxlength="2000" />
212 </template> 227 </template>
213 </uni-list-item> 228 </uni-list-item>
214 229
@@ -217,57 +232,55 @@ @@ -217,57 +232,55 @@
217 <span>与我司的合作状况</span> 232 <span>与我司的合作状况</span>
218 </view> 233 </view>
219 234
220 - <uni-list-item class="amount-item">  
221 - <template v-slot:body>  
222 - <view class="item-title"><text>合作年限</text></view>  
223 - </template> 235 + <uni-list-item title="首次合作年份">
224 <template v-slot:footer> 236 <template v-slot:footer>
225 - <view class="amount-row">  
226 - <text class="prefix">从</text>  
227 - <uni-easyinput type="digit" v-model="form.cooperationStartYear" placeholder="年份" :inputBorder="false" />  
228 - <text class="suffix">年开始合作</text>  
229 - </view> 237 + <uni-easyinput type="digit" v-model="form.firstCooperationYear" placeholder="请输入4位年份" :inputBorder="false" />
230 </template> 238 </template>
231 </uni-list-item> 239 </uni-list-item>
232 240
233 - <uni-list-item title="主要操作方式">  
234 - <template v-slot:footer>  
235 - <uni-easyinput type="textarea" v-model="form.mainOperationMode" placeholder="请输入"  
236 - :inputBorder="false" maxlength="2000" /> 241 + <uni-list-item class="select-item" :class="form.isNewDevelopment ? 'is-filled' : 'is-empty'" clickable
  242 + @click="openSheet('isNewDevelopment')" :rightText="displayLabel('isNewDevelopment')" showArrow>
  243 + <template v-slot:body>
  244 + <view class="item-title"><text>是否新开发</text></view>
237 </template> 245 </template>
238 </uni-list-item> 246 </uni-list-item>
239 247
240 - <uni-list-item class="select-item" :class="form.badRecordPlanFailName ? 'is-filled' : 'is-empty'" clickable  
241 - @click="openSheet('badRecordPlanFail')" :rightText="displayLabel('badRecordPlanFailName')" showArrow> 248 + <uni-list-item class="select-item" :class="form.hasFailedPlanRecord === true || form.hasFailedPlanRecord === false ? 'is-filled' : 'is-empty'" clickable
  249 + @click="openSheet('hasFailedPlanRecord')" :rightText="displayLabel('hasFailedPlanRecord')" showArrow>
242 <template v-slot:body> 250 <template v-slot:body>
243 <view class="item-title"><text>是否有计划落空的不良记录</text></view> 251 <view class="item-title"><text>是否有计划落空的不良记录</text></view>
244 </template> 252 </template>
245 </uni-list-item> 253 </uni-list-item>
246 - <uni-list-item class="select-item" :class="form.planNotFulfilledName ? 'is-filled' : 'is-empty'" clickable  
247 - @click="openSheet('planNotFulfilled')" :rightText="displayLabel('planNotFulfilledName')" showArrow> 254 + <uni-list-item class="select-item" :class="form.hasPlanPerformanceIssue === true || form.hasPlanPerformanceIssue === false ? 'is-filled' : 'is-empty'" clickable
  255 + @click="openSheet('hasPlanPerformanceIssue')" :rightText="displayLabel('hasPlanPerformanceIssue')" showArrow>
248 <template v-slot:body> 256 <template v-slot:body>
249 - <view class="item-title"><text>是否有计划履行不到位现象(时间、数量等)</text></view> 257 + <view class="item-title"><text>是否有计划履行不到位现象</text></view>
250 </template> 258 </template>
251 </uni-list-item> 259 </uni-list-item>
252 260
253 - <uni-list-item title="操作规范性"> 261 + <uni-list-item title="进销账务如何处理">
254 <template v-slot:footer> 262 <template v-slot:footer>
255 - <uni-easyinput type="textarea" v-model="form.operationNorms" placeholder="1、进销账务如何处理 2、开票品名与出库单品名是否一致 3、出库流程是否规范 4、运输发票情况"  
256 - :inputBorder="false" maxlength="3000" /> 263 + <uni-easyinput type="textarea" v-model="form.accountingProcess" placeholder="请输入" :inputBorder="false" maxlength="2000" />
257 </template> 264 </template>
258 </uni-list-item> 265 </uni-list-item>
259 266
260 - <uni-list-item title="常见料质问题">  
261 - <template v-slot:footer>  
262 - <uni-easyinput type="textarea" v-model="form.commonMaterialIssues" placeholder="请输入"  
263 - :inputBorder="false" maxlength="2000" /> 267 + <uni-list-item class="select-item" :class="form.invoiceNameMatch === true || form.invoiceNameMatch === false ? 'is-filled' : 'is-empty'" clickable
  268 + @click="openSheet('invoiceNameMatch')" :rightText="displayLabel('invoiceNameMatch')" showArrow>
  269 + <template v-slot:body>
  270 + <view class="item-title"><text>开票品名与出库单品名是否一致</text></view>
  271 + </template>
  272 + </uni-list-item>
  273 +
  274 + <uni-list-item class="select-item" :class="form.outboundProcessStandard === true || form.outboundProcessStandard === false ? 'is-filled' : 'is-empty'" clickable
  275 + @click="openSheet('outboundProcessStandard')" :rightText="displayLabel('outboundProcessStandard')" showArrow>
  276 + <template v-slot:body>
  277 + <view class="item-title"><text>出库流程是否规范</text></view>
264 </template> 278 </template>
265 </uni-list-item> 279 </uni-list-item>
266 280
267 - <uni-list-item class="mgb10" title="合作中的其他问题"> 281 + <uni-list-item class="mgb10" title="运输方式">
268 <template v-slot:footer> 282 <template v-slot:footer>
269 - <uni-easyinput type="textarea" v-model="form.otherCooperationIssues" placeholder="请输入"  
270 - :inputBorder="false" maxlength="2000" /> 283 + <uni-easyinput v-model="form.transportMode" placeholder="请输入" :inputBorder="false" />
271 </template> 284 </template>
272 </uni-list-item> 285 </uni-list-item>
273 286
@@ -276,22 +289,29 @@ @@ -276,22 +289,29 @@
276 <span>其他</span> 289 <span>其他</span>
277 </view> 290 </view>
278 291
279 - <uni-list-item title="创建日期"> 292 + <uni-list-item title="资信调查人">
280 <template v-slot:footer> 293 <template v-slot:footer>
281 - <uni-datetime-picker type="date" v-model="form.createDate" /> 294 + <uni-easyinput v-model="form.investigatorName" disabled placeholder="" :inputBorder="false" />
282 </template> 295 </template>
283 </uni-list-item> 296 </uni-list-item>
284 297
285 - <uni-list-item title="评审时间"> 298 + <uni-list-item class="select-item" :class="form.purchaseDepartment ? 'is-filled' : 'is-empty'" clickable
  299 + @click="openSheet('purchaseDepartment')" :rightText="displayLabel('purchaseDepartment')" showArrow>
  300 + <template v-slot:body>
  301 + <view class="item-title"><text>采购处</text></view>
  302 + </template>
  303 + </uni-list-item>
  304 +
  305 + <uni-list-item title="评审有效期">
286 <template v-slot:footer> 306 <template v-slot:footer>
287 - <uni-datetime-picker type="date" v-model="form.reviewDate" /> 307 + <uni-datetime-picker type="date" v-model="form.reviewValidUntil" />
288 </template> 308 </template>
289 </uni-list-item> 309 </uni-list-item>
290 310
291 <uni-list-item class="mgb10" title="附件"> 311 <uni-list-item class="mgb10" title="附件">
292 <template v-slot:footer> 312 <template v-slot:footer>
293 <view class="attach-box"> 313 <view class="attach-box">
294 - <view v-for="(f, idx) in form.attachments" :key="idx" class="attach-row"> 314 + <view v-for="(f, idx) in attachmentFiles" :key="idx" class="attach-row">
295 <FileUpload :value="f" @input="onAttachmentInput(idx, $event)" /> 315 <FileUpload :value="f" @input="onAttachmentInput(idx, $event)" />
296 <text class="attach-del" @click.stop="removeAttachment(idx)">删除</text> 316 <text class="attach-del" @click.stop="removeAttachment(idx)">删除</text>
297 </view> 317 </view>
@@ -319,6 +339,8 @@ @@ -319,6 +339,8 @@
319 import FileUpload from '@/components/file-upload/index.vue' 339 import FileUpload from '@/components/file-upload/index.vue'
320 import SingleSelectSheet from '@/components/single-select/index.vue' 340 import SingleSelectSheet from '@/components/single-select/index.vue'
321 import MultiSelectSheet from '@/components/multi-select/index.vue' 341 import MultiSelectSheet from '@/components/multi-select/index.vue'
  342 +import { getDicByCodes, getDicName } from '@/utils/dic.js'
  343 +import { domesticCustomerCreditGetApi, domesticCustomerCreditSaveApi, getPurchaseDeptApi } from '@/api/procure-manage/domesticCustomerCredit.js'
322 344
323 export default { 345 export default {
324 name: 'DomesticTradeModify', 346 name: 'DomesticTradeModify',
@@ -329,80 +351,74 @@ export default { @@ -329,80 +351,74 @@ export default {
329 submitting: false, 351 submitting: false,
330 loading: false, 352 loading: false,
331 newAttachment: { id: '', name: '' }, 353 newAttachment: { id: '', name: '' },
  354 + attachmentFiles: [],
332 sheet: { visible: false, title: '', options: [], field: '', value: '' }, 355 sheet: { visible: false, title: '', options: [], field: '', value: '' },
333 multiSheet: { visible: false, title: '', options: [], field: '', value: '' }, 356 multiSheet: { visible: false, title: '', options: [], field: '', value: '' },
  357 + dicOptions: {
  358 + COMPANY_NATURE: [],
  359 + DEVELOP_NEW: [],
  360 + OPERATION_METHOD: [],
  361 + PURCHASE_SOURCE: []
  362 + },
334 yesNoOptions: [ 363 yesNoOptions: [
335 - { label: '是', value: 'YES' },  
336 - { label: '否', value: 'NO' }  
337 - ],  
338 - investNatureOptions: [  
339 - { label: '投机', value: 'SPECULATION' },  
340 - { label: '保值', value: 'HEDGE' },  
341 - { label: '保值为主投机为辅', value: 'HEDGE_MAIN' }  
342 - ],  
343 - companyNatureOptions: [  
344 - { label: '回收公司', value: 'RECYCLE' },  
345 - { label: '贸易公司', value: 'TRADE' },  
346 - { label: '进口拆解', value: 'IMPORT_DISMANTLE' },  
347 - { label: '工业制造', value: 'INDUSTRY_MANUFACTURE' },  
348 - { label: '福利企业', value: 'WELFARE_ENTERPRISE' },  
349 - { label: '其他', value: 'OTHER' }  
350 - ],  
351 - purchaseSourceOptions: [  
352 - { label: '国外进口', value: 'IMPORT' },  
353 - { label: '本企业报废', value: 'SELF_SCRAP' },  
354 - { label: '零散收购', value: 'SCATTERED' },  
355 - { label: '其他', value: 'OTHER' } 364 + { label: '是', value: true },
  365 + { label: '否', value: false }
356 ], 366 ],
  367 + companyNatureOptions: [],
  368 + operationMethodOptions: [],
  369 + developNewOptions: [],
  370 + purchaseSourceOptions: [],
  371 + purchaseDeptOptions: [],
357 form: { 372 form: {
358 id: '', 373 id: '',
359 - companyName: '', 374 + unitName: '',
360 companyNature: '', 375 companyNature: '',
361 companyNatureName: '', 376 companyNatureName: '',
362 companyNatureOther: '', 377 companyNatureOther: '',
363 bankName: '', 378 bankName: '',
364 bankAccount: '', 379 bankAccount: '',
365 registeredCapital: '', 380 registeredCapital: '',
366 - annualTurnover: '',  
367 legalRepresentative: '', 381 legalRepresentative: '',
368 - companyFoundedDate: '', 382 + companyEstablishedTime: '',
369 address: '', 383 address: '',
370 - businessOwner: '',  
371 - position: '',  
372 - phone: '',  
373 - fax: '', 384 + businessPrincipal: '',
  385 + businessPrincipalPosition: '',
  386 + businessPrincipalPhone: '',
374 legalBusinessRelation: '', 387 legalBusinessRelation: '',
375 - liquidWorkingCapital: '',  
376 - fixedAssets: '',  
377 - purchaseSituation: '', 388 + factoryOfficeProperty: '',
  389 + factoryOfficeArea: '',
  390 + warehouseYardProperty: '',
  391 + warehouseYardArea: '',
  392 + mainEquipment: '',
  393 + normalInventory: '',
  394 + mainVarieties: '',
  395 + monthlyPurchaseVolume: '',
378 purchaseSource: '', 396 purchaseSource: '',
379 - purchaseSourceName: '',  
380 - purchaseSourceOther: '',  
381 - productionSituation: '',  
382 - salesSituation: '',  
383 - preferentialPolicy: '',  
384 - preferentialPolicyName: '',  
385 - preferentialPolicyDetail: '',  
386 - punishmentRecord: '',  
387 - punishmentRecordName: '',  
388 - scopeMatch: '',  
389 - futuresInvest: '',  
390 - futuresInvestName: '',  
391 - investNature: '',  
392 - investNatureName: '',  
393 - lastYearFuturesProfitLoss: '',  
394 - cooperationStartYear: '',  
395 - mainOperationMode: '',  
396 - badRecordPlanFail: '',  
397 - badRecordPlanFailName: '',  
398 - planNotFulfilled: '',  
399 - planNotFulfilledName: '',  
400 - operationNorms: '',  
401 - commonMaterialIssues: '',  
402 - otherCooperationIssues: '',  
403 - createDate: '',  
404 - reviewDate: '',  
405 - attachments: [] 397 + stockInProductName: '',
  398 + productName: '',
  399 + capacity: '',
  400 + salesChannel: '',
  401 + hasPreferentialPolicy: null,
  402 + investInFutures: null,
  403 + hasPenaltyRecord: null,
  404 + businessScopeMatch: null,
  405 + commonMaterialIssue: '',
  406 + otherIssue: '',
  407 + firstCooperationYear: '',
  408 + isNewDevelopment: '',
  409 + operationMode: '',
  410 + hasFailedPlanRecord: null,
  411 + hasPlanPerformanceIssue: null,
  412 + accountingProcess: '',
  413 + invoiceNameMatch: null,
  414 + outboundProcessStandard: null,
  415 + transportMode: '',
  416 + attachmentFileIds: '',
  417 + attachmentFileNames: '',
  418 + investigatorId: '',
  419 + investigatorName: '',
  420 + purchaseDepartment: '',
  421 + reviewValidUntil: ''
406 } 422 }
407 } 423 }
408 }, 424 },
@@ -410,45 +426,121 @@ export default { @@ -410,45 +426,121 @@ export default {
410 showCompanyNatureOther() { 426 showCompanyNatureOther() {
411 const v = String(this.form.companyNature || '') 427 const v = String(this.form.companyNature || '')
412 return v.split(',').includes('OTHER') 428 return v.split(',').includes('OTHER')
413 - },  
414 - showPurchaseSourceOther() {  
415 - return this.form.purchaseSource === 'OTHER'  
416 } 429 }
417 }, 430 },
418 - onLoad(query) { 431 + async onLoad(query) {
419 const id = (query && (query.id || query.code)) ? String(query.id || query.code) : '' 432 const id = (query && (query.id || query.code)) ? String(query.id || query.code) : ''
420 this.id = id 433 this.id = id
421 - this.loadDetail() 434 + await this.loadDicData()
  435 + await this.loadPurchaseDeptOptions()
  436 + await this.loadDetail()
422 }, 437 },
423 methods: { 438 methods: {
  439 + async loadDicData() {
  440 + try {
  441 + const results = await getDicByCodes(['COMPANY_NATURE', 'DEVELOP_NEW', 'OPERATION_METHOD', 'PURCHASE_SOURCE'])
  442 + const next = {
  443 + COMPANY_NATURE: (results.COMPANY_NATURE && results.COMPANY_NATURE.data) || [],
  444 + DEVELOP_NEW: (results.DEVELOP_NEW && results.DEVELOP_NEW.data) || [],
  445 + OPERATION_METHOD: (results.OPERATION_METHOD && results.OPERATION_METHOD.data) || [],
  446 + PURCHASE_SOURCE: (results.PURCHASE_SOURCE && results.PURCHASE_SOURCE.data) || []
  447 + }
  448 + this.dicOptions = next
  449 + this.companyNatureOptions = this.dicToSheetOptions(next.COMPANY_NATURE)
  450 + this.developNewOptions = this.dicToSheetOptions(next.DEVELOP_NEW)
  451 + this.operationMethodOptions = this.dicToSheetOptions(next.OPERATION_METHOD)
  452 + this.purchaseSourceOptions = this.dicToSheetOptions(next.PURCHASE_SOURCE)
  453 + } catch (e) {
  454 + this.dicOptions = { COMPANY_NATURE: [], DEVELOP_NEW: [], OPERATION_METHOD: [], PURCHASE_SOURCE: [] }
  455 + this.companyNatureOptions = []
  456 + this.developNewOptions = []
  457 + this.operationMethodOptions = []
  458 + this.purchaseSourceOptions = []
  459 + uni.showToast({ title: '字典加载失败', icon: 'none' })
  460 + }
  461 + },
  462 + dicToSheetOptions(items) {
  463 + const list = Array.isArray(items) ? items : []
  464 + return list.map(it => ({ label: it && it.name != null ? String(it.name) : '', value: it && it.code != null ? String(it.code) : '' })).filter(it => it.value)
  465 + },
  466 + async loadPurchaseDeptOptions() {
  467 + try {
  468 + const res = await getPurchaseDeptApi()
  469 + const list = (res && res.data) ? res.data : []
  470 + this.purchaseDeptOptions = (Array.isArray(list) ? list : []).map(it => ({
  471 + label: it && it.name != null ? String(it.name) : '',
  472 + value: it && it.id != null ? String(it.id) : ''
  473 + })).filter(it => it.value)
  474 + } catch (e) {
  475 + this.purchaseDeptOptions = []
  476 + }
  477 + },
  478 + getOptionLabel(options, value) {
  479 + const v = value == null ? '' : String(value)
  480 + if (!v) return ''
  481 + const found = (options || []).find(o => String(o.value) === v)
  482 + return found ? String(found.label || '') : ''
  483 + },
424 displayLabel(field) { 484 displayLabel(field) {
425 const m = this.form 485 const m = this.form
426 const map = { 486 const map = {
427 companyNatureName: '请选择公司性质', 487 companyNatureName: '请选择公司性质',
428 - purchaseSourceName: '请选择货源来源',  
429 - preferentialPolicyName: '请选择',  
430 - punishmentRecordName: '请选择',  
431 - futuresInvestName: '请选择',  
432 - investNatureName: '请选择',  
433 - badRecordPlanFailName: '请选择',  
434 - planNotFulfilledName: '请选择' 488 + purchaseSource: '请选择',
  489 + operationMode: '请选择',
  490 + isNewDevelopment: '请选择',
  491 + purchaseDepartment: '请选择',
  492 + hasPreferentialPolicy: '请选择',
  493 + investInFutures: '请选择',
  494 + hasPenaltyRecord: '请选择',
  495 + businessScopeMatch: '请选择',
  496 + hasFailedPlanRecord: '请选择',
  497 + hasPlanPerformanceIssue: '请选择',
  498 + invoiceNameMatch: '请选择',
  499 + outboundProcessStandard: '请选择'
  500 + }
  501 + if (field === 'companyNatureName') {
  502 + const val = m[field]
  503 + return val ? String(val) : map[field]
435 } 504 }
436 - const val = m[field]  
437 - return val ? String(val) : map[field] 505 + if (field === 'purchaseSource') {
  506 + const v = m.purchaseSource
  507 + return v ? getDicName('PURCHASE_SOURCE', String(v), this.dicOptions.PURCHASE_SOURCE) : map[field]
  508 + }
  509 + if (field === 'operationMode') {
  510 + const v = m.operationMode
  511 + return v ? getDicName('OPERATION_METHOD', String(v), this.dicOptions.OPERATION_METHOD) : map[field]
  512 + }
  513 + if (field === 'isNewDevelopment') {
  514 + const v = m.isNewDevelopment
  515 + return v ? getDicName('DEVELOP_NEW', String(v), this.dicOptions.DEVELOP_NEW) : map[field]
  516 + }
  517 + if (field === 'purchaseDepartment') {
  518 + const label = this.getOptionLabel(this.purchaseDeptOptions, m.purchaseDepartment)
  519 + return label || map[field]
  520 + }
  521 + const v = m[field]
  522 + if (v === true) return '是'
  523 + if (v === false) return '否'
  524 + return map[field] || '请选择'
438 }, 525 },
439 openSheet(field) { 526 openSheet(field) {
440 const map = { 527 const map = {
441 - purchaseSource: { title: '货源来源', options: this.purchaseSourceOptions, valueField: 'purchaseSource', nameField: 'purchaseSourceName' },  
442 - preferentialPolicy: { title: '是否享受优惠政策', options: this.yesNoOptions, valueField: 'preferentialPolicy', nameField: 'preferentialPolicyName' },  
443 - punishmentRecord: { title: '是否有被处罚记录', options: this.yesNoOptions, valueField: 'punishmentRecord', nameField: 'punishmentRecordName' },  
444 - futuresInvest: { title: '是否投资期货', options: this.yesNoOptions, valueField: 'futuresInvest', nameField: 'futuresInvestName' },  
445 - investNature: { title: '投资性质', options: this.investNatureOptions, valueField: 'investNature', nameField: 'investNatureName' },  
446 - badRecordPlanFail: { title: '是否有计划落空的不良记录', options: this.yesNoOptions, valueField: 'badRecordPlanFail', nameField: 'badRecordPlanFailName' },  
447 - planNotFulfilled: { title: '是否有计划履行不到位现象', options: this.yesNoOptions, valueField: 'planNotFulfilled', nameField: 'planNotFulfilledName' } 528 + purchaseSource: { title: '收购来源', options: this.purchaseSourceOptions },
  529 + operationMode: { title: '操作方式', options: this.operationMethodOptions },
  530 + isNewDevelopment: { title: '是否新开发', options: this.developNewOptions },
  531 + purchaseDepartment: { title: '采购处', options: this.purchaseDeptOptions },
  532 + hasPreferentialPolicy: { title: '是否享有优惠政策', options: this.yesNoOptions },
  533 + investInFutures: { title: '是否投资期货', options: this.yesNoOptions },
  534 + hasPenaltyRecord: { title: '是否有被处罚记录', options: this.yesNoOptions },
  535 + businessScopeMatch: { title: '实际经营范围与法定经营范围是否相符', options: this.yesNoOptions },
  536 + hasFailedPlanRecord: { title: '是否有计划落空的不良记录', options: this.yesNoOptions },
  537 + hasPlanPerformanceIssue: { title: '是否有计划履行不到位现象', options: this.yesNoOptions },
  538 + invoiceNameMatch: { title: '开票品名与出库单品名是否一致', options: this.yesNoOptions },
  539 + outboundProcessStandard: { title: '出库流程是否规范', options: this.yesNoOptions }
448 } 540 }
449 const cfg = map[field] 541 const cfg = map[field]
450 if (!cfg) return 542 if (!cfg) return
451 - const current = this.form[cfg.valueField] 543 + const current = this.form[field]
452 const match = (cfg.options || []).find(o => String(o.value) === String(current)) 544 const match = (cfg.options || []).find(o => String(o.value) === String(current))
453 this.sheet = { 545 this.sheet = {
454 ...this.sheet, 546 ...this.sheet,
@@ -456,7 +548,7 @@ export default { @@ -456,7 +548,7 @@ export default {
456 title: cfg.title, 548 title: cfg.title,
457 options: cfg.options || [], 549 options: cfg.options || [],
458 field, 550 field,
459 - value: match ? match.value : (current || '') 551 + value: match ? match.value : current
460 } 552 }
461 }, 553 },
462 openMultiSheet(field) { 554 openMultiSheet(field) {
@@ -470,31 +562,10 @@ export default { @@ -470,31 +562,10 @@ export default {
470 value: this.form.companyNature || '' 562 value: this.form.companyNature || ''
471 } 563 }
472 }, 564 },
473 - onSheetConfirm({ value, label }) { 565 + onSheetConfirm({ value }) {
474 const field = this.sheet.field 566 const field = this.sheet.field
475 - if (field === 'purchaseSource') {  
476 - this.form.purchaseSource = value || ''  
477 - this.form.purchaseSourceName = label || ''  
478 - if (this.form.purchaseSource !== 'OTHER') this.form.purchaseSourceOther = ''  
479 - } else if (field === 'preferentialPolicy') {  
480 - this.form.preferentialPolicy = value || ''  
481 - this.form.preferentialPolicyName = label || ''  
482 - } else if (field === 'punishmentRecord') {  
483 - this.form.punishmentRecord = value || ''  
484 - this.form.punishmentRecordName = label || ''  
485 - } else if (field === 'futuresInvest') {  
486 - this.form.futuresInvest = value || ''  
487 - this.form.futuresInvestName = label || ''  
488 - } else if (field === 'investNature') {  
489 - this.form.investNature = value || ''  
490 - this.form.investNatureName = label || ''  
491 - } else if (field === 'badRecordPlanFail') {  
492 - this.form.badRecordPlanFail = value || ''  
493 - this.form.badRecordPlanFailName = label || ''  
494 - } else if (field === 'planNotFulfilled') {  
495 - this.form.planNotFulfilled = value || ''  
496 - this.form.planNotFulfilledName = label || ''  
497 - } 567 + if (!field) return
  568 + this.form[field] = value
498 this.sheet.visible = false 569 this.sheet.visible = false
499 }, 570 },
500 onMultiSheetConfirm({ value }) { 571 onMultiSheetConfirm({ value }) {
@@ -509,13 +580,7 @@ export default { @@ -509,13 +580,7 @@ export default {
509 }, 580 },
510 normalizeCompanyNature(valueStr) { 581 normalizeCompanyNature(valueStr) {
511 const selected = (valueStr ? String(valueStr).split(',').filter(Boolean) : []) 582 const selected = (valueStr ? String(valueStr).split(',').filter(Boolean) : [])
512 - const group = ['IMPORT_DISMANTLE', 'INDUSTRY_MANUFACTURE', 'WELFARE_ENTERPRISE']  
513 - const groupSelected = selected.filter(v => group.includes(v))  
514 - let finalSelected = selected.slice(0)  
515 - if (groupSelected.length > 1) {  
516 - const keep = groupSelected[0]  
517 - finalSelected = finalSelected.filter(v => !group.includes(v) || v === keep)  
518 - } 583 + const finalSelected = selected.slice(0)
519 const orderedValues = [] 584 const orderedValues = []
520 const orderedLabels = [] 585 const orderedLabels = []
521 ;(this.companyNatureOptions || []).forEach(opt => { 586 ;(this.companyNatureOptions || []).forEach(opt => {
@@ -528,32 +593,108 @@ export default { @@ -528,32 +593,108 @@ export default {
528 return { value: orderedValues.join(','), label: orderedLabels.join(',') } 593 return { value: orderedValues.join(','), label: orderedLabels.join(',') }
529 }, 594 },
530 removeAttachment(idx) { 595 removeAttachment(idx) {
531 - const list = Array.isArray(this.form.attachments) ? this.form.attachments.slice(0) : [] 596 + const list = Array.isArray(this.attachmentFiles) ? this.attachmentFiles.slice(0) : []
532 list.splice(idx, 1) 597 list.splice(idx, 1)
533 - this.form.attachments = list 598 + this.attachmentFiles = list
534 }, 599 },
535 onAddAttachment(val) { 600 onAddAttachment(val) {
536 const payload = val || { id: '', name: '' } 601 const payload = val || { id: '', name: '' }
537 if (!payload.id) return 602 if (!payload.id) return
538 - const list = Array.isArray(this.form.attachments) ? this.form.attachments.slice(0) : [] 603 + const list = Array.isArray(this.attachmentFiles) ? this.attachmentFiles.slice(0) : []
539 list.push(payload) 604 list.push(payload)
540 - this.form.attachments = list 605 + this.attachmentFiles = list
541 this.newAttachment = { id: '', name: '' } 606 this.newAttachment = { id: '', name: '' }
542 }, 607 },
543 onAttachmentInput(idx, val) { 608 onAttachmentInput(idx, val) {
544 - const list = Array.isArray(this.form.attachments) ? this.form.attachments.slice(0) : [] 609 + const list = Array.isArray(this.attachmentFiles) ? this.attachmentFiles.slice(0) : []
545 list[idx] = val || { id: '', name: '' } 610 list[idx] = val || { id: '', name: '' }
546 - this.form.attachments = list 611 + this.attachmentFiles = list
547 }, 612 },
548 validate() { 613 validate() {
549 - const phone = String(this.form.phone || '').trim() 614 + const requiredTextFields = [
  615 + { key: 'unitName', label: '单位名称' },
  616 + { key: 'companyNature', label: '公司性质' },
  617 + { key: 'bankName', label: '开户行' },
  618 + { key: 'bankAccount', label: '账号' },
  619 + { key: 'legalRepresentative', label: '法人代表' },
  620 + { key: 'companyEstablishedTime', label: '公司成立时间' },
  621 + { key: 'address', label: '地址' },
  622 + { key: 'businessPrincipal', label: '业务负责人' },
  623 + { key: 'businessPrincipalPosition', label: '职务' },
  624 + { key: 'businessPrincipalPhone', label: '电话' },
  625 + { key: 'legalBusinessRelation', label: '法人与业务负责人关系' },
  626 + { key: 'factoryOfficeProperty', label: '生产厂房及办公楼产权' },
  627 + { key: 'factoryOfficeArea', label: '生产厂房及办公楼面积' },
  628 + { key: 'warehouseYardProperty', label: '仓库或货场产权' },
  629 + { key: 'warehouseYardArea', label: '仓库或货场产权面积' },
  630 + { key: 'mainEquipment', label: '主要生产设备' },
  631 + { key: 'normalInventory', label: '正常库存量' },
  632 + { key: 'mainVarieties', label: '主要品种' },
  633 + { key: 'monthlyPurchaseVolume', label: '月度收购量' },
  634 + { key: 'purchaseSource', label: '收购来源' },
  635 + { key: 'stockInProductName', label: '入库品名' },
  636 + { key: 'productName', label: '产品名称' },
  637 + { key: 'capacity', label: '产能' },
  638 + { key: 'salesChannel', label: '销售渠道' },
  639 + { key: 'firstCooperationYear', label: '首次合作年份' },
  640 + { key: 'isNewDevelopment', label: '是否新开发' },
  641 + { key: 'operationMode', label: '操作方式' },
  642 + { key: 'accountingProcess', label: '进销账务如何处理' },
  643 + { key: 'transportMode', label: '运输方式' },
  644 + { key: 'commonMaterialIssue', label: '常见料质问题' },
  645 + { key: 'otherIssue', label: '合作中的其它问题' },
  646 + { key: 'purchaseDepartment', label: '采购处' },
  647 + { key: 'reviewValidUntil', label: '评审有效期' },
  648 + { key: 'investigatorId', label: '资信调查人ID' }
  649 + ]
  650 + for (let i = 0; i < requiredTextFields.length; i++) {
  651 + const f = requiredTextFields[i]
  652 + const v = this.form && this.form[f.key]
  653 + if (v == null || String(v).trim() === '') {
  654 + uni.showToast({ title: `${f.label}必填`, icon: 'none' })
  655 + return false
  656 + }
  657 + }
  658 +
  659 + const registeredCapital = Number(this.form.registeredCapital)
  660 + if (!Number.isFinite(registeredCapital) || registeredCapital < 0) {
  661 + uni.showToast({ title: '注册资金请填写数字', icon: 'none' })
  662 + return false
  663 + }
  664 +
  665 + const requiredBoolFields = [
  666 + { key: 'hasPreferentialPolicy', label: '是否享有优惠政策' },
  667 + { key: 'investInFutures', label: '是否投资期货' },
  668 + { key: 'hasPenaltyRecord', label: '是否有被处罚记录' },
  669 + { key: 'businessScopeMatch', label: '经营范围是否相符' },
  670 + { key: 'hasFailedPlanRecord', label: '计划落空不良记录' },
  671 + { key: 'hasPlanPerformanceIssue', label: '计划履行不到位现象' },
  672 + { key: 'invoiceNameMatch', label: '开票品名是否一致' },
  673 + { key: 'outboundProcessStandard', label: '出库流程是否规范' }
  674 + ]
  675 + for (let i = 0; i < requiredBoolFields.length; i++) {
  676 + const f = requiredBoolFields[i]
  677 + const v = this.form && this.form[f.key]
  678 + if (!(v === true || v === false)) {
  679 + uni.showToast({ title: `请选择${f.label}`, icon: 'none' })
  680 + return false
  681 + }
  682 + }
  683 +
  684 + const files = Array.isArray(this.attachmentFiles) ? this.attachmentFiles.filter(it => it && it.id) : []
  685 + if (!files.length) {
  686 + uni.showToast({ title: '请上传附件', icon: 'none' })
  687 + return false
  688 + }
  689 +
  690 + const phone = String(this.form.businessPrincipalPhone || '').trim()
550 if (phone && !/^1\d{10}$/.test(phone)) { 691 if (phone && !/^1\d{10}$/.test(phone)) {
551 uni.showToast({ title: '电话请输入11位手机号', icon: 'none' }) 692 uni.showToast({ title: '电话请输入11位手机号', icon: 'none' })
552 return false 693 return false
553 } 694 }
554 - const year = String(this.form.cooperationStartYear || '').trim() 695 + const year = String(this.form.firstCooperationYear || '').trim()
555 if (year && !/^\d{4}$/.test(year)) { 696 if (year && !/^\d{4}$/.test(year)) {
556 - uni.showToast({ title: '合作年限请填写4位年份', icon: 'none' }) 697 + uni.showToast({ title: '首次合作年份请填写4位年份', icon: 'none' })
557 return false 698 return false
558 } 699 }
559 return true 700 return true
@@ -561,16 +702,12 @@ export default { @@ -561,16 +702,12 @@ export default {
561 buildPayload() { 702 buildPayload() {
562 const payload = { ...this.form } 703 const payload = { ...this.form }
563 if (!this.showCompanyNatureOther) payload.companyNatureOther = '' 704 if (!this.showCompanyNatureOther) payload.companyNatureOther = ''
564 - if (payload.purchaseSource !== 'OTHER') payload.purchaseSourceOther = ''  
565 delete payload.companyNatureName 705 delete payload.companyNatureName
566 - delete payload.purchaseSourceName  
567 - delete payload.preferentialPolicyName  
568 - delete payload.punishmentRecordName  
569 - delete payload.futuresInvestName  
570 - delete payload.investNatureName  
571 - delete payload.badRecordPlanFailName  
572 - delete payload.planNotFulfilledName  
573 - payload.attachments = (Array.isArray(payload.attachments) ? payload.attachments : []).filter(it => it && it.id) 706 + delete payload.investigatorName
  707 + payload.registeredCapital = Number(payload.registeredCapital)
  708 + const files = (Array.isArray(this.attachmentFiles) ? this.attachmentFiles : []).filter(it => it && it.id)
  709 + payload.attachmentFileIds = files.map(it => String(it.id || '')).filter(Boolean).join(',')
  710 + payload.attachmentFileNames = files.map(it => String(it.name || '')).filter(Boolean).join(',')
574 return payload 711 return payload
575 }, 712 },
576 async onSubmit() { 713 async onSubmit() {
@@ -579,7 +716,7 @@ export default { @@ -579,7 +716,7 @@ export default {
579 this.submitting = true 716 this.submitting = true
580 const payload = this.buildPayload() 717 const payload = this.buildPayload()
581 try { 718 try {
582 - await this.mockUpdate(payload) 719 + await domesticCustomerCreditSaveApi(payload)
583 uni.showToast({ title: '保存成功', icon: 'success' }) 720 uni.showToast({ title: '保存成功', icon: 'success' })
584 setTimeout(() => { uni.navigateBack() }, 300) 721 setTimeout(() => { uni.navigateBack() }, 300)
585 } catch (e) { 722 } catch (e) {
@@ -591,33 +728,33 @@ export default { @@ -591,33 +728,33 @@ export default {
591 async loadDetail() { 728 async loadDetail() {
592 this.loading = true 729 this.loading = true
593 try { 730 try {
594 - const data = await this.mockGetDetail(this.id) 731 + const res = await domesticCustomerCreditGetApi(this.id)
  732 + const data = res && res.data ? res.data : {}
595 const next = { ...this.form, ...(data || {}) } 733 const next = { ...this.form, ...(data || {}) }
596 next.id = next.id || this.id || '' 734 next.id = next.id || this.id || ''
597 - next.attachments = Array.isArray(next.attachments) ? next.attachments : [] 735 + const u = (this.$store && this.$store.state && this.$store.state.user) ? this.$store.state.user : {}
  736 + if (!next.investigatorId) next.investigatorId = u && u.id ? String(u.id) : ''
  737 + if (!next.investigatorName) next.investigatorName = u && u.name ? String(u.name) : ''
598 this.form = next 738 this.form = next
599 - this.refreshLabelFields() 739 + this.form.companyNatureName = this.labelsOf(this.companyNatureOptions, this.form.companyNature)
  740 + this.attachmentFiles = this.normalizeAttachmentFiles(data || next)
600 } catch (e) { 741 } catch (e) {
601 uni.showToast({ title: '加载失败', icon: 'none' }) 742 uni.showToast({ title: '加载失败', icon: 'none' })
602 } finally { 743 } finally {
603 this.loading = false 744 this.loading = false
604 } 745 }
605 }, 746 },
606 - refreshLabelFields() {  
607 - this.form.companyNatureName = this.labelsOf(this.companyNatureOptions, this.form.companyNature)  
608 - this.form.purchaseSourceName = this.labelOf(this.purchaseSourceOptions, this.form.purchaseSource)  
609 - this.form.preferentialPolicyName = this.labelOf(this.yesNoOptions, this.form.preferentialPolicy)  
610 - this.form.punishmentRecordName = this.labelOf(this.yesNoOptions, this.form.punishmentRecord)  
611 - this.form.futuresInvestName = this.labelOf(this.yesNoOptions, this.form.futuresInvest)  
612 - this.form.investNatureName = this.labelOf(this.investNatureOptions, this.form.investNature)  
613 - this.form.badRecordPlanFailName = this.labelOf(this.yesNoOptions, this.form.badRecordPlanFail)  
614 - this.form.planNotFulfilledName = this.labelOf(this.yesNoOptions, this.form.planNotFulfilled)  
615 - },  
616 - labelOf(options, value) {  
617 - const v = value == null ? '' : String(value)  
618 - if (!v) return ''  
619 - const found = (options || []).find(o => String(o.value) === v)  
620 - return found ? String(found.label) : v 747 + normalizeAttachmentFiles(raw) {
  748 + if (!raw) return []
  749 + const ids = raw.attachmentFileIds != null ? String(raw.attachmentFileIds) : ''
  750 + const names = raw.attachmentFileNames != null ? String(raw.attachmentFileNames) : ''
  751 + const idArr = ids ? ids.split(',').map(s => s.trim()).filter(Boolean) : []
  752 + const nameArr = names ? names.split(',') : []
  753 + if (idArr.length) {
  754 + return idArr.map((id, i) => ({ id, name: (nameArr[i] != null ? String(nameArr[i]) : '') }))
  755 + }
  756 + const legacy = Array.isArray(raw.attachments) ? raw.attachments : []
  757 + return legacy.filter(it => it && (it.id || it.name)).map(it => ({ id: it.id || '', name: it.name || '' }))
621 }, 758 },
622 labelsOf(options, csv) { 759 labelsOf(options, csv) {
623 const v = csv == null ? '' : String(csv) 760 const v = csv == null ? '' : String(csv)
@@ -630,101 +767,6 @@ export default { @@ -630,101 +767,6 @@ export default {
630 if (ov && parts.includes(ov)) labels.push(opt.label != null ? String(opt.label) : '') 767 if (ov && parts.includes(ov)) labels.push(opt.label != null ? String(opt.label) : '')
631 }) 768 })
632 return labels.filter(Boolean).join(',') || '' 769 return labels.filter(Boolean).join(',') || ''
633 - },  
634 - mockGetDetail(id) {  
635 - return new Promise(resolve => {  
636 - const stored = this.tryLoadFromStorage(id)  
637 - if (stored) return setTimeout(() => resolve(stored), 180)  
638 - setTimeout(() => resolve(this.buildMockDetail(id)), 180)  
639 - })  
640 - },  
641 - tryLoadFromStorage(id) {  
642 - try {  
643 - const raw = uni.getStorageSync('DOMESTIC_TRADE_RECORDS')  
644 - const arr = Array.isArray(raw) ? raw : (raw && Array.isArray(raw.list) ? raw.list : [])  
645 - if (!id) return arr && arr[0] ? arr[0] : null  
646 - const found = (arr || []).find(it => it && String(it.id || '') === String(id))  
647 - return found || null  
648 - } catch (e) {  
649 - return null  
650 - }  
651 - },  
652 - buildMockDetail(id) {  
653 - const now = new Date()  
654 - const createDate = this.formatDate(now)  
655 - return {  
656 - id: id || '1',  
657 - companyName: '华东商贸有限公司1',  
658 - companyNature: 'RECYCLE,OTHER',  
659 - companyNatureOther: '再生资源综合回收',  
660 - bankName: '中国工商银行上海分行',  
661 - bankAccount: '6222020202020202',  
662 - registeredCapital: '500',  
663 - annualTurnover: '2600',  
664 - legalRepresentative: '张三',  
665 - companyFoundedDate: '2018-06-01',  
666 - address: '上海市浦东新区示例路 88 号',  
667 - businessOwner: '李四',  
668 - position: '总经理',  
669 - phone: '13800000000',  
670 - fax: '021-88888888',  
671 - legalBusinessRelation: '亲属',  
672 - liquidWorkingCapital: '流动资金 300 万;购销结算期限 30 天;债权债务情况正常',  
673 - fixedAssets: '厂房产权自有 2000㎡;主要设备投资 800 万;仓库自有 1200㎡;正常库存量 300 吨',  
674 - purchaseSituation: '主要品种:铜、铁;收购量:月均 1200 吨;上年度利润:铜 120 万,铁 80 万;入库流程规范',  
675 - purchaseSource: 'OTHER',  
676 - purchaseSourceOther: '本地回收站合作渠道',  
677 - productionSituation: '产品:再生铜;产能:月均 800 吨;能耗:电 40 万度/月',  
678 - salesSituation: '渠道:长期客户+现货;回款方式:承兑/转账;结算期限:30-60 天',  
679 - preferentialPolicy: 'NO',  
680 - preferentialPolicyDetail: '',  
681 - punishmentRecord: 'NO',  
682 - scopeMatch: '相符',  
683 - futuresInvest: 'YES',  
684 - investNature: 'HEDGE_MAIN',  
685 - lastYearFuturesProfitLoss: '盈利 15 万',  
686 - cooperationStartYear: '2021',  
687 - mainOperationMode: '现货+月度计划',  
688 - badRecordPlanFail: 'NO',  
689 - planNotFulfilled: 'NO',  
690 - operationNorms: '账务按月对账;开票品名一致;出库流程规范;运输发票齐全',  
691 - commonMaterialIssues: '含杂偏高、含水偏高',  
692 - otherCooperationIssues: '暂无',  
693 - createDate,  
694 - reviewDate: '',  
695 - attachments: [  
696 - { id: 'mock-file-1', name: '资信调查表.pdf' },  
697 - { id: 'mock-file-2', name: '营业执照.jpg' }  
698 - ]  
699 - }  
700 - },  
701 - mockUpdate(payload) {  
702 - return new Promise(resolve => {  
703 - setTimeout(() => {  
704 - const list = this.loadStorageList()  
705 - const id = payload && payload.id ? String(payload.id) : (this.id ? String(this.id) : String(Date.now()))  
706 - const next = { ...payload, id }  
707 - const idx = list.findIndex(it => it && String(it.id || '') === id)  
708 - if (idx >= 0) list.splice(idx, 1, next)  
709 - else list.unshift(next)  
710 - uni.setStorageSync('DOMESTIC_TRADE_RECORDS', list)  
711 - resolve({ success: true })  
712 - }, 350)  
713 - })  
714 - },  
715 - loadStorageList() {  
716 - try {  
717 - const raw = uni.getStorageSync('DOMESTIC_TRADE_RECORDS')  
718 - return Array.isArray(raw) ? raw.slice(0) : (raw && Array.isArray(raw.list) ? raw.list.slice(0) : [])  
719 - } catch (e) {  
720 - return []  
721 - }  
722 - },  
723 - formatDate(d) {  
724 - const y = d.getFullYear()  
725 - const m = String(d.getMonth() + 1).padStart(2, '0')  
726 - const da = String(d.getDate()).padStart(2, '0')  
727 - return `${y}-${m}-${da}`  
728 } 770 }
729 } 771 }
730 } 772 }