Commit d5f58fb73eec4ee537e12a52541ff2cead773d42
Merge branch 'cjerp-1.0' of http://gitlab.qgutech.com/zhuyuanliang/erp-mobile into cjerp-1.0
Showing
8 changed files
with
798 additions
and
70 deletions
| ... | ... | @@ -193,4 +193,24 @@ export function getContractApi(id) { |
| 193 | 193 | region |
| 194 | 194 | }) |
| 195 | 195 | } |
| 196 | +// 获取备注 | |
| 197 | +export function getCustomerRemarks(customerId) { | |
| 198 | + return request({ | |
| 199 | + url: `${baseUrl}/contractDistributorStandard/getCustomerRemarks`, | |
| 200 | + method: 'get', | |
| 201 | + params: { customerId }, | |
| 202 | + contentType: ContentTypeEnum.JSON, | |
| 203 | + region | |
| 204 | + }) | |
| 205 | +} | |
| 206 | +// 获取具体质量要求 | |
| 207 | +export function getCustomerSpecificQualityRequirements(params) { | |
| 208 | + return request({ | |
| 209 | + url: `${baseUrl}/contractDistributorStandard/getCustomerSpecificQualityRequirements`, | |
| 210 | + method: 'get', | |
| 211 | + params, | |
| 212 | + contentType: ContentTypeEnum.FORM_URLENCODED, | |
| 213 | + region | |
| 214 | + }) | |
| 215 | +} | |
| 196 | 216 | ... | ... |
| ... | ... | @@ -123,9 +123,15 @@ |
| 123 | 123 | <uni-easyinput v-model="form.specialInstructions" placeholder="请输入特别说明" :inputBorder="false" /> |
| 124 | 124 | </template> |
| 125 | 125 | </uni-list-item> |
| 126 | + <uni-list-item v-if="this.customerRemarks.length" class="select-item" :class="defaultRemark ? 'is-filled' : 'is-empty'" clickable | |
| 127 | + @click="openSheet('historyRemarks')" :rightText="defaultRemark || '请选择'" showArrow> | |
| 128 | + <template v-slot:body> | |
| 129 | + <view class="item-title"><text>历史备注</text></view> | |
| 130 | + </template> | |
| 131 | + </uni-list-item> | |
| 126 | 132 | <uni-list-item title="备注"> |
| 127 | 133 | <template v-slot:footer> |
| 128 | - <uni-easyinput v-model="form.remarks" placeholder="请输入备注" :inputBorder="false" /> | |
| 134 | + <uni-easyinput type="textarea" v-model="form.remarks" placeholder="请输入备注" :inputBorder="false" /> | |
| 129 | 135 | </template> |
| 130 | 136 | </uni-list-item> |
| 131 | 137 | <view class="quality"> |
| ... | ... | @@ -134,32 +140,32 @@ |
| 134 | 140 | </view> |
| 135 | 141 | <uni-list-item title="件重条头"> |
| 136 | 142 | <template v-slot:footer> |
| 137 | - <uni-easyinput v-model="form.pieceWeightHead" placeholder="请输入" :inputBorder="false" /> | |
| 143 | + <uni-easyinput type="textarea" v-model="form.pieceWeightHead" placeholder="请输入" :inputBorder="false" /> | |
| 138 | 144 | </template> |
| 139 | 145 | </uni-list-item> |
| 140 | 146 | <uni-list-item title="表面"> |
| 141 | 147 | <template v-slot:footer> |
| 142 | - <uni-easyinput v-model="form.surface" placeholder="请输入" :inputBorder="false" /> | |
| 148 | + <uni-easyinput type="textarea" v-model="form.surface" placeholder="请输入" :inputBorder="false" /> | |
| 143 | 149 | </template> |
| 144 | 150 | </uni-list-item> |
| 145 | 151 | <uni-list-item title="公差"> |
| 146 | 152 | <template v-slot:footer> |
| 147 | - <uni-easyinput v-model="form.tolerance" placeholder="请输入" :inputBorder="false" /> | |
| 153 | + <uni-easyinput type="textarea" v-model="form.tolerance" placeholder="请输入" :inputBorder="false" /> | |
| 148 | 154 | </template> |
| 149 | 155 | </uni-list-item> |
| 150 | 156 | <uni-list-item title="性能"> |
| 151 | 157 | <template v-slot:footer> |
| 152 | - <uni-easyinput v-model="form.performance" placeholder="请输入" :inputBorder="false" /> | |
| 158 | + <uni-easyinput type="textarea" v-model="form.performance" placeholder="请输入" :inputBorder="false" /> | |
| 153 | 159 | </template> |
| 154 | 160 | </uni-list-item> |
| 155 | 161 | <uni-list-item title="成分"> |
| 156 | 162 | <template v-slot:footer> |
| 157 | - <uni-easyinput v-model="form.component" placeholder="请输入" :inputBorder="false" /> | |
| 163 | + <uni-easyinput type="textarea" v-model="form.component" placeholder="请输入" :inputBorder="false" /> | |
| 158 | 164 | </template> |
| 159 | 165 | </uni-list-item> |
| 160 | 166 | <uni-list-item title="包装"> |
| 161 | 167 | <template v-slot:footer> |
| 162 | - <uni-easyinput v-model="form.packaging" placeholder="请输入" :inputBorder="false" /> | |
| 168 | + <uni-easyinput type="textarea" v-model="form.packaging" placeholder="请输入" :inputBorder="false" /> | |
| 163 | 169 | </template> |
| 164 | 170 | </uni-list-item> |
| 165 | 171 | </uni-list> |
| ... | ... | @@ -210,7 +216,7 @@ import SingleSelectSheet from '@/components/single-select/index.vue' |
| 210 | 216 | import RelateSelectSheet from '@/components/relate-select/index.vue' |
| 211 | 217 | import ProductRel from './productRel.vue' |
| 212 | 218 | import CitySelector from '@/components/city-selector/index.vue' |
| 213 | -import { getRetailCodeApi, createContractApi } from '@/api/contract' | |
| 219 | +import { getRetailCodeApi, createContractApi, getCustomerRemarks,getCustomerSpecificQualityRequirements } from '@/api/contract' | |
| 214 | 220 | import { getDicByCodes } from '@/utils/dic' |
| 215 | 221 | import { formatCurrencyToChinese } from '@/utils/common' |
| 216 | 222 | import { workshopQueryApi } from '@/api/devManage' |
| ... | ... | @@ -243,6 +249,13 @@ export default { |
| 243 | 249 | destinationLabel: '', |
| 244 | 250 | workshopIdName: '', |
| 245 | 251 | workshopId: '', |
| 252 | + remarks: '', | |
| 253 | + component: '', | |
| 254 | + packaging: '', | |
| 255 | + performance: '', | |
| 256 | + pieceWeightHead: '', | |
| 257 | + surface: '', | |
| 258 | + tolerance: '', | |
| 246 | 259 | }, |
| 247 | 260 | supplierList: [], |
| 248 | 261 | specialTermsList: [], |
| ... | ... | @@ -255,6 +268,8 @@ export default { |
| 255 | 268 | sumTotal: 0, |
| 256 | 269 | productLineList: [], |
| 257 | 270 | productList: [], |
| 271 | + customerRemarks: [], | |
| 272 | + defaultRemark: '', | |
| 258 | 273 | } |
| 259 | 274 | }, |
| 260 | 275 | created() { |
| ... | ... | @@ -268,7 +283,85 @@ export default { |
| 268 | 283 | } |
| 269 | 284 | }) |
| 270 | 285 | }, |
| 286 | + watch: { | |
| 287 | + 'form.buyer': { | |
| 288 | + handler(newVal, oldVal) { | |
| 289 | + if (newVal) { | |
| 290 | + getCustomerRemarks(newVal).then(res => { | |
| 291 | + const remarksData = res.data || []; | |
| 292 | + this.customerRemarks = remarksData.map((item, index) => ({ | |
| 293 | + label: `客户备注${index + 1}`, | |
| 294 | + value: item, | |
| 295 | + })); | |
| 296 | + if (remarksData.length > 0) { | |
| 297 | + this.defaultRemark = this.customerRemarks[0].label || ''; | |
| 298 | + this.form.remarks = remarksData[0]; | |
| 299 | + } else { | |
| 300 | + this.form.remarks = ''; | |
| 301 | + this.defaultRemark = ''; | |
| 302 | + } | |
| 303 | + }) | |
| 304 | + this.getHistory() | |
| 305 | + } | |
| 306 | + } | |
| 307 | + }, | |
| 308 | + productLineList: { | |
| 309 | + deep: true, | |
| 310 | + handler(newVal, oldVal) { | |
| 311 | + const n = Array.isArray(newVal) ? newVal : [] | |
| 312 | + const o = Array.isArray(oldVal) ? oldVal : [] | |
| 313 | + const changed = [] | |
| 314 | + for (let i = 0; i < n.length; i++) { | |
| 315 | + const ni = n[i] && n[i].productId | |
| 316 | + const oi = o[i] && o[i].productId | |
| 317 | + if (ni !== oi && ni !== undefined) changed.push(ni) | |
| 318 | + } | |
| 319 | + console.log('changed', changed) | |
| 320 | + if (changed.length && this.form.buyer) { | |
| 321 | + const id = changed.join('') | |
| 322 | + this.fetchCustomerQualityRequirements(id) | |
| 323 | + } | |
| 324 | + } | |
| 325 | + }, | |
| 326 | + }, | |
| 271 | 327 | methods: { |
| 328 | + getHistory() { | |
| 329 | + if (!this.productLineList.length || !this.productLineList[0].productId) { | |
| 330 | + return; | |
| 331 | + } | |
| 332 | + const id = this.productLineList.map(it => it.productId).join('') | |
| 333 | + this.fetchCustomerQualityRequirements(id) | |
| 334 | + }, | |
| 335 | + async fetchCustomerQualityRequirements(id) { | |
| 336 | + if (!this.form.buyer || !id) { | |
| 337 | + return; | |
| 338 | + } | |
| 339 | + try { | |
| 340 | + const result = await getCustomerSpecificQualityRequirements({ | |
| 341 | + customerId: this.form.buyer, | |
| 342 | + productIdList:id, | |
| 343 | + }); | |
| 344 | + this.updateFormData(result.data || {}); | |
| 345 | + } catch (error) { | |
| 346 | + console.error('获取客户质量要求失败:', error); | |
| 347 | + // 可以根据需要添加错误提示逻辑 | |
| 348 | + this.$message.error('获取历史数据失败,请稍后重试'); | |
| 349 | + } | |
| 350 | + }, | |
| 351 | + // 提取公共的字段更新方法 | |
| 352 | + updateFormData(result) { | |
| 353 | + const fields = [ | |
| 354 | + 'component', | |
| 355 | + 'packaging', | |
| 356 | + 'performance', | |
| 357 | + 'pieceWeightHead', | |
| 358 | + 'surface', | |
| 359 | + 'tolerance', | |
| 360 | + ]; | |
| 361 | + fields.forEach((field) => { | |
| 362 | + this.form[field] = (this.form[field] || '') + (result[field] || ''); | |
| 363 | + }); | |
| 364 | + }, | |
| 272 | 365 | onProductsChange(products) { |
| 273 | 366 | const list = Array.isArray(products) ? products : [] |
| 274 | 367 | const sumQ = list.reduce((acc, it) => acc + (parseFloat(it.quantity) || 0), 0) |
| ... | ... | @@ -356,14 +449,21 @@ export default { |
| 356 | 449 | setSheet('单价中是否已包含包装费', this.yesNoList) |
| 357 | 450 | } else if (field === 'includesTransportFee') { |
| 358 | 451 | setSheet('单价中是否已包含运费', this.yesNoList) |
| 452 | + } else if (field === 'historyRemarks') { | |
| 453 | + setSheet('历史备注', this.customerRemarks) | |
| 359 | 454 | } |
| 360 | 455 | }, |
| 361 | 456 | onSheetConfirm({ value, label }) { |
| 362 | 457 | const field = this.sheet.field |
| 363 | 458 | if (!field) return |
| 364 | 459 | const v = (value === undefined || value === null) ? '' : value |
| 365 | - this.form[field] = v | |
| 366 | - this.form[field + 'Name'] = label || '' | |
| 460 | + if (field === 'historyRemarks') { | |
| 461 | + this.defaultRemark = label || '' | |
| 462 | + this.form.remarks = v | |
| 463 | + }else{ | |
| 464 | + this.form[field] = v | |
| 465 | + this.form[field + 'Name'] = label || '' | |
| 466 | + } | |
| 367 | 467 | }, |
| 368 | 468 | openRelate(fieldKey) { |
| 369 | 469 | let config = {} | ... | ... |
| ... | ... | @@ -123,9 +123,15 @@ |
| 123 | 123 | <uni-easyinput v-model="form.specialInstructions" placeholder="请输入特别说明" :inputBorder="false" /> |
| 124 | 124 | </template> |
| 125 | 125 | </uni-list-item> |
| 126 | + <uni-list-item v-if="this.customerRemarks.length" class="select-item" :class="defaultRemark ? 'is-filled' : 'is-empty'" clickable | |
| 127 | + @click="openSheet('historyRemarks')" :rightText="defaultRemark || '请选择'" showArrow> | |
| 128 | + <template v-slot:body> | |
| 129 | + <view class="item-title"><text>历史备注</text></view> | |
| 130 | + </template> | |
| 131 | + </uni-list-item> | |
| 126 | 132 | <uni-list-item title="备注"> |
| 127 | 133 | <template v-slot:footer> |
| 128 | - <uni-easyinput v-model="form.remarks" placeholder="请输入备注" :inputBorder="false" /> | |
| 134 | + <uni-easyinput type="textarea" v-model="form.remarks" placeholder="请输入备注" :inputBorder="false" /> | |
| 129 | 135 | </template> |
| 130 | 136 | </uni-list-item> |
| 131 | 137 | <view class="quality"> |
| ... | ... | @@ -134,32 +140,32 @@ |
| 134 | 140 | </view> |
| 135 | 141 | <uni-list-item title="件重条头"> |
| 136 | 142 | <template v-slot:footer> |
| 137 | - <uni-easyinput v-model="form.pieceWeightHead" placeholder="请输入" :inputBorder="false" /> | |
| 143 | + <uni-easyinput type="textarea" v-model="form.pieceWeightHead" placeholder="请输入" :inputBorder="false" /> | |
| 138 | 144 | </template> |
| 139 | 145 | </uni-list-item> |
| 140 | 146 | <uni-list-item title="表面"> |
| 141 | 147 | <template v-slot:footer> |
| 142 | - <uni-easyinput v-model="form.surface" placeholder="请输入" :inputBorder="false" /> | |
| 148 | + <uni-easyinput type="textarea" v-model="form.surface" placeholder="请输入" :inputBorder="false" /> | |
| 143 | 149 | </template> |
| 144 | 150 | </uni-list-item> |
| 145 | 151 | <uni-list-item title="公差"> |
| 146 | 152 | <template v-slot:footer> |
| 147 | - <uni-easyinput v-model="form.tolerance" placeholder="请输入" :inputBorder="false" /> | |
| 153 | + <uni-easyinput type="textarea" v-model="form.tolerance" placeholder="请输入" :inputBorder="false" /> | |
| 148 | 154 | </template> |
| 149 | 155 | </uni-list-item> |
| 150 | 156 | <uni-list-item title="性能"> |
| 151 | 157 | <template v-slot:footer> |
| 152 | - <uni-easyinput v-model="form.performance" placeholder="请输入" :inputBorder="false" /> | |
| 158 | + <uni-easyinput type="textarea" v-model="form.performance" placeholder="请输入" :inputBorder="false" /> | |
| 153 | 159 | </template> |
| 154 | 160 | </uni-list-item> |
| 155 | 161 | <uni-list-item title="成分"> |
| 156 | 162 | <template v-slot:footer> |
| 157 | - <uni-easyinput v-model="form.component" placeholder="请输入" :inputBorder="false" /> | |
| 163 | + <uni-easyinput type="textarea" v-model="form.component" placeholder="请输入" :inputBorder="false" /> | |
| 158 | 164 | </template> |
| 159 | 165 | </uni-list-item> |
| 160 | 166 | <uni-list-item title="包装"> |
| 161 | 167 | <template v-slot:footer> |
| 162 | - <uni-easyinput v-model="form.packaging" placeholder="请输入" :inputBorder="false" /> | |
| 168 | + <uni-easyinput type="textarea" v-model="form.packaging" placeholder="请输入" :inputBorder="false" /> | |
| 163 | 169 | </template> |
| 164 | 170 | </uni-list-item> |
| 165 | 171 | </uni-list> |
| ... | ... | @@ -210,7 +216,7 @@ import SingleSelectSheet from '@/components/single-select/index.vue' |
| 210 | 216 | import RelateSelectSheet from '@/components/relate-select/index.vue' |
| 211 | 217 | import ProductRel from './productRel.vue' |
| 212 | 218 | import CitySelector from '@/components/city-selector/index.vue' |
| 213 | -import { getRetailCodeApi, createContractApi } from '@/api/contract' | |
| 219 | +import { getRetailCodeApi, createContractApi, getCustomerSpecificQualityRequirements,getCustomerRemarks } from '@/api/contract' | |
| 214 | 220 | import { getDicByCodes } from '@/utils/dic' |
| 215 | 221 | import { formatCurrencyToChinese } from '@/utils/common' |
| 216 | 222 | import { workshopQueryApi } from '@/api/devManage' |
| ... | ... | @@ -243,6 +249,13 @@ export default { |
| 243 | 249 | destinationLabel: '', |
| 244 | 250 | workshopIdName: '', |
| 245 | 251 | workshopId: '', |
| 252 | + component: '', | |
| 253 | + packaging: '', | |
| 254 | + performance: '', | |
| 255 | + pieceWeightHead: '', | |
| 256 | + surface: '', | |
| 257 | + tolerance: '', | |
| 258 | + remarks: '', | |
| 246 | 259 | }, |
| 247 | 260 | supplierList: [], |
| 248 | 261 | specialTermsList: [], |
| ... | ... | @@ -255,6 +268,8 @@ export default { |
| 255 | 268 | sumTotal: 0, |
| 256 | 269 | productLineList: [], |
| 257 | 270 | productList: [], |
| 271 | + customerRemarks: [], | |
| 272 | + defaultRemark: '', | |
| 258 | 273 | } |
| 259 | 274 | }, |
| 260 | 275 | created() { |
| ... | ... | @@ -268,7 +283,87 @@ export default { |
| 268 | 283 | } |
| 269 | 284 | }) |
| 270 | 285 | }, |
| 286 | + watch: { | |
| 287 | + 'form.buyer': { | |
| 288 | + handler(newVal, oldVal) { | |
| 289 | + if (newVal) { | |
| 290 | + getCustomerRemarks(newVal).then(res => { | |
| 291 | + const remarksData = res.data || []; | |
| 292 | + this.customerRemarks = remarksData.map((item, index) => ({ | |
| 293 | + label: `客户备注${index + 1}`, | |
| 294 | + value: item, | |
| 295 | + })); | |
| 296 | + if (remarksData.length > 0) { | |
| 297 | + this.defaultRemark = this.customerRemarks[0].label || ''; | |
| 298 | + this.form.remarks = remarksData[0]; | |
| 299 | + } else { | |
| 300 | + this.form.remarks = ''; | |
| 301 | + this.defaultRemark = ''; | |
| 302 | + } | |
| 303 | + }) | |
| 304 | + this.getHistory() | |
| 305 | + } | |
| 306 | + } | |
| 307 | + }, | |
| 308 | + productLineList: { | |
| 309 | + deep: true, | |
| 310 | + handler(newVal, oldVal) { | |
| 311 | + const n = Array.isArray(newVal) ? newVal : [] | |
| 312 | + const o = Array.isArray(oldVal) ? oldVal : [] | |
| 313 | + const changed = [] | |
| 314 | + for (let i = 0; i < n.length; i++) { | |
| 315 | + const ni = n[i] && n[i].productId | |
| 316 | + const oi = o[i] && o[i].productId | |
| 317 | + if (ni !== oi && ni !== undefined) changed.push(ni) | |
| 318 | + } | |
| 319 | + console.log('changed', changed) | |
| 320 | + if (changed.length && this.form.buyer) { | |
| 321 | + const id = changed.join('') | |
| 322 | + this.fetchCustomerQualityRequirements(id) | |
| 323 | + } | |
| 324 | + } | |
| 325 | + }, | |
| 326 | + }, | |
| 271 | 327 | methods: { |
| 328 | + getHistory() { | |
| 329 | + console.log('this.productLineList', this.productLineList[0].productId) | |
| 330 | + if (!this.productLineList.length || !this.productLineList[0].productId) { | |
| 331 | + return; | |
| 332 | + } | |
| 333 | + const id = this.productLineList.map(it => it.productId).join('') | |
| 334 | + this.fetchCustomerQualityRequirements(id) | |
| 335 | + }, | |
| 336 | + async fetchCustomerQualityRequirements(id) { | |
| 337 | + if (!this.form.buyer || !id) { | |
| 338 | + return; | |
| 339 | + } | |
| 340 | + try { | |
| 341 | + const result = await getCustomerSpecificQualityRequirements({ | |
| 342 | + customerId: this.form.buyer, | |
| 343 | + productIdList:id, | |
| 344 | + }); | |
| 345 | + this.updateFormData(result.data || {}); | |
| 346 | + } catch (error) { | |
| 347 | + console.error('获取客户质量要求失败:', error); | |
| 348 | + // 可以根据需要添加错误提示逻辑 | |
| 349 | + this.$message.error('获取历史数据失败,请稍后重试'); | |
| 350 | + } | |
| 351 | + }, | |
| 352 | + // 提取公共的字段更新方法 | |
| 353 | + updateFormData(result) { | |
| 354 | + console.log('result', result) | |
| 355 | + const fields = [ | |
| 356 | + 'component', | |
| 357 | + 'packaging', | |
| 358 | + 'performance', | |
| 359 | + 'pieceWeightHead', | |
| 360 | + 'surface', | |
| 361 | + 'tolerance', | |
| 362 | + ]; | |
| 363 | + fields.forEach((field) => { | |
| 364 | + this.form[field] = (this.form[field] || '') + (result[field] || ''); | |
| 365 | + }); | |
| 366 | + }, | |
| 272 | 367 | onProductsChange(products) { |
| 273 | 368 | const list = Array.isArray(products) ? products : [] |
| 274 | 369 | const sumQ = list.reduce((acc, it) => acc + (parseFloat(it.quantity) || 0), 0) |
| ... | ... | @@ -356,14 +451,21 @@ export default { |
| 356 | 451 | setSheet('单价中是否已包含包装费', this.yesNoList) |
| 357 | 452 | } else if (field === 'includesTransportFee') { |
| 358 | 453 | setSheet('单价中是否已包含运费', this.yesNoList) |
| 454 | + } else if (field === 'historyRemarks') { | |
| 455 | + setSheet('历史备注', this.customerRemarks) | |
| 359 | 456 | } |
| 360 | 457 | }, |
| 361 | 458 | onSheetConfirm({ value, label }) { |
| 362 | 459 | const field = this.sheet.field |
| 363 | 460 | if (!field) return |
| 364 | 461 | const v = (value === undefined || value === null) ? '' : value |
| 365 | - this.form[field] = v | |
| 366 | - this.form[field + 'Name'] = label || '' | |
| 462 | + if (field === 'historyRemarks') { | |
| 463 | + this.defaultRemark = label || '' | |
| 464 | + this.form.remarks = v | |
| 465 | + }else{ | |
| 466 | + this.form[field] = v | |
| 467 | + this.form[field + 'Name'] = label || '' | |
| 468 | + } | |
| 367 | 469 | }, |
| 368 | 470 | openRelate(fieldKey) { |
| 369 | 471 | let config = {} | ... | ... |
| ... | ... | @@ -123,9 +123,15 @@ |
| 123 | 123 | <uni-easyinput v-model="form.specialInstructions" placeholder="请输入特别说明" :inputBorder="false" /> |
| 124 | 124 | </template> |
| 125 | 125 | </uni-list-item> |
| 126 | + <uni-list-item v-if="this.customerRemarks.length" class="select-item" :class="defaultRemark ? 'is-filled' : 'is-empty'" clickable | |
| 127 | + @click="openSheet('historyRemarks')" :rightText="defaultRemark || '请选择'" showArrow> | |
| 128 | + <template v-slot:body> | |
| 129 | + <view class="item-title"><text>历史备注</text></view> | |
| 130 | + </template> | |
| 131 | + </uni-list-item> | |
| 126 | 132 | <uni-list-item title="备注"> |
| 127 | 133 | <template v-slot:footer> |
| 128 | - <uni-easyinput v-model="form.remarks" placeholder="请输入备注" :inputBorder="false" /> | |
| 134 | + <uni-easyinput type="textarea" v-model="form.remarks" placeholder="请输入备注" :inputBorder="false" /> | |
| 129 | 135 | </template> |
| 130 | 136 | </uni-list-item> |
| 131 | 137 | <view class="quality"> |
| ... | ... | @@ -134,32 +140,32 @@ |
| 134 | 140 | </view> |
| 135 | 141 | <uni-list-item title="件重条头"> |
| 136 | 142 | <template v-slot:footer> |
| 137 | - <uni-easyinput v-model="form.pieceWeightHead" placeholder="请输入" :inputBorder="false" /> | |
| 143 | + <uni-easyinput type="textarea" v-model="form.pieceWeightHead" placeholder="请输入" :inputBorder="false" /> | |
| 138 | 144 | </template> |
| 139 | 145 | </uni-list-item> |
| 140 | 146 | <uni-list-item title="表面"> |
| 141 | 147 | <template v-slot:footer> |
| 142 | - <uni-easyinput v-model="form.surface" placeholder="请输入" :inputBorder="false" /> | |
| 148 | + <uni-easyinput type="textarea" v-model="form.surface" placeholder="请输入" :inputBorder="false" /> | |
| 143 | 149 | </template> |
| 144 | 150 | </uni-list-item> |
| 145 | 151 | <uni-list-item title="公差"> |
| 146 | 152 | <template v-slot:footer> |
| 147 | - <uni-easyinput v-model="form.tolerance" placeholder="请输入" :inputBorder="false" /> | |
| 153 | + <uni-easyinput type="textarea" v-model="form.tolerance" placeholder="请输入" :inputBorder="false" /> | |
| 148 | 154 | </template> |
| 149 | 155 | </uni-list-item> |
| 150 | 156 | <uni-list-item title="性能"> |
| 151 | 157 | <template v-slot:footer> |
| 152 | - <uni-easyinput v-model="form.performance" placeholder="请输入" :inputBorder="false" /> | |
| 158 | + <uni-easyinput type="textarea" v-model="form.performance" placeholder="请输入" :inputBorder="false" /> | |
| 153 | 159 | </template> |
| 154 | 160 | </uni-list-item> |
| 155 | 161 | <uni-list-item title="成分"> |
| 156 | 162 | <template v-slot:footer> |
| 157 | - <uni-easyinput v-model="form.component" placeholder="请输入" :inputBorder="false" /> | |
| 163 | + <uni-easyinput type="textarea" v-model="form.component" placeholder="请输入" :inputBorder="false" /> | |
| 158 | 164 | </template> |
| 159 | 165 | </uni-list-item> |
| 160 | 166 | <uni-list-item title="包装"> |
| 161 | 167 | <template v-slot:footer> |
| 162 | - <uni-easyinput v-model="form.packaging" placeholder="请输入" :inputBorder="false" /> | |
| 168 | + <uni-easyinput type="textarea" v-model="form.packaging" placeholder="请输入" :inputBorder="false" /> | |
| 163 | 169 | </template> |
| 164 | 170 | </uni-list-item> |
| 165 | 171 | </uni-list> |
| ... | ... | @@ -210,7 +216,7 @@ import SingleSelectSheet from '@/components/single-select/index.vue' |
| 210 | 216 | import RelateSelectSheet from '@/components/relate-select/index.vue' |
| 211 | 217 | import ProductRel from './productRel.vue' |
| 212 | 218 | import CitySelector from '@/components/city-selector/index.vue' |
| 213 | -import { getRetailCodeApi, createContractApi } from '@/api/contract' | |
| 219 | +import { getRetailCodeApi, createContractApi, getCustomerRemarks,getCustomerSpecificQualityRequirements } from '@/api/contract' | |
| 214 | 220 | import { getDicByCodes } from '@/utils/dic' |
| 215 | 221 | import { formatCurrencyToChinese } from '@/utils/common' |
| 216 | 222 | import { workshopQueryApi } from '@/api/devManage' |
| ... | ... | @@ -243,6 +249,13 @@ export default { |
| 243 | 249 | destinationLabel: '', |
| 244 | 250 | workshopIdName: '', |
| 245 | 251 | workshopId: '', |
| 252 | + remarks: '', | |
| 253 | + component: '', | |
| 254 | + packaging: '', | |
| 255 | + performance: '', | |
| 256 | + pieceWeightHead: '', | |
| 257 | + surface: '', | |
| 258 | + tolerance: '', | |
| 246 | 259 | }, |
| 247 | 260 | supplierList: [], |
| 248 | 261 | specialTermsList: [], |
| ... | ... | @@ -255,6 +268,8 @@ export default { |
| 255 | 268 | sumTotal: 0, |
| 256 | 269 | productLineList: [], |
| 257 | 270 | productList: [], |
| 271 | + customerRemarks: [], | |
| 272 | + defaultRemark: '', | |
| 258 | 273 | } |
| 259 | 274 | }, |
| 260 | 275 | created() { |
| ... | ... | @@ -268,7 +283,86 @@ export default { |
| 268 | 283 | } |
| 269 | 284 | }) |
| 270 | 285 | }, |
| 286 | + watch: { | |
| 287 | + 'form.buyer': { | |
| 288 | + handler(newVal, oldVal) { | |
| 289 | + if (newVal) { | |
| 290 | + getCustomerRemarks(newVal).then(res => { | |
| 291 | + const remarksData = res.data || []; | |
| 292 | + this.customerRemarks = remarksData.map((item, index) => ({ | |
| 293 | + label: `客户备注${index + 1}`, | |
| 294 | + value: item, | |
| 295 | + })); | |
| 296 | + if (remarksData.length > 0) { | |
| 297 | + this.defaultRemark = this.customerRemarks[0].label || ''; | |
| 298 | + this.form.remarks = remarksData[0]; | |
| 299 | + } else { | |
| 300 | + this.form.remarks = ''; | |
| 301 | + this.defaultRemark = ''; | |
| 302 | + } | |
| 303 | + }) | |
| 304 | + this.getHistory() | |
| 305 | + } | |
| 306 | + } | |
| 307 | + }, | |
| 308 | + productLineList: { | |
| 309 | + deep: true, | |
| 310 | + handler(newVal, oldVal) { | |
| 311 | + const n = Array.isArray(newVal) ? newVal : [] | |
| 312 | + const o = Array.isArray(oldVal) ? oldVal : [] | |
| 313 | + const changed = [] | |
| 314 | + for (let i = 0; i < n.length; i++) { | |
| 315 | + const ni = n[i] && n[i].productId | |
| 316 | + const oi = o[i] && o[i].productId | |
| 317 | + if (ni !== oi && ni !== undefined) changed.push(ni) | |
| 318 | + } | |
| 319 | + if (changed.length && this.form.buyer) { | |
| 320 | + const id = changed.join('') | |
| 321 | + this.fetchCustomerQualityRequirements(id) | |
| 322 | + } | |
| 323 | + } | |
| 324 | + }, | |
| 325 | + }, | |
| 271 | 326 | methods: { |
| 327 | + getHistory() { | |
| 328 | + console.log('this.productLineList', this.productLineList[0].productId) | |
| 329 | + if (!this.productLineList.length || !this.productLineList[0].productId) { | |
| 330 | + return; | |
| 331 | + } | |
| 332 | + const id = this.productLineList.map(it => it.productId).join('') | |
| 333 | + this.fetchCustomerQualityRequirements(id) | |
| 334 | + }, | |
| 335 | + async fetchCustomerQualityRequirements(id) { | |
| 336 | + if (!this.form.buyer || !id) { | |
| 337 | + return; | |
| 338 | + } | |
| 339 | + try { | |
| 340 | + const result = await getCustomerSpecificQualityRequirements({ | |
| 341 | + customerId: this.form.buyer, | |
| 342 | + productIdList:id, | |
| 343 | + }); | |
| 344 | + this.updateFormData(result.data || {}); | |
| 345 | + } catch (error) { | |
| 346 | + console.error('获取客户质量要求失败:', error); | |
| 347 | + // 可以根据需要添加错误提示逻辑 | |
| 348 | + this.$message.error('获取历史数据失败,请稍后重试'); | |
| 349 | + } | |
| 350 | + }, | |
| 351 | + // 提取公共的字段更新方法 | |
| 352 | + updateFormData(result) { | |
| 353 | + console.log('result', result) | |
| 354 | + const fields = [ | |
| 355 | + 'component', | |
| 356 | + 'packaging', | |
| 357 | + 'performance', | |
| 358 | + 'pieceWeightHead', | |
| 359 | + 'surface', | |
| 360 | + 'tolerance', | |
| 361 | + ]; | |
| 362 | + fields.forEach((field) => { | |
| 363 | + this.form[field] = (this.form[field] || '') + (result[field] || ''); | |
| 364 | + }); | |
| 365 | + }, | |
| 272 | 366 | onProductsChange(products) { |
| 273 | 367 | const list = Array.isArray(products) ? products : [] |
| 274 | 368 | const sumQ = list.reduce((acc, it) => acc + (parseFloat(it.quantity) || 0), 0) |
| ... | ... | @@ -356,14 +450,21 @@ export default { |
| 356 | 450 | setSheet('单价中是否已包含包装费', this.yesNoList) |
| 357 | 451 | } else if (field === 'includesTransportFee') { |
| 358 | 452 | setSheet('单价中是否已包含运费', this.yesNoList) |
| 453 | + } else if (field === 'historyRemarks') { | |
| 454 | + setSheet('历史备注', this.customerRemarks) | |
| 359 | 455 | } |
| 360 | 456 | }, |
| 361 | 457 | onSheetConfirm({ value, label }) { |
| 362 | 458 | const field = this.sheet.field |
| 363 | 459 | if (!field) return |
| 364 | 460 | const v = (value === undefined || value === null) ? '' : value |
| 365 | - this.form[field] = v | |
| 366 | - this.form[field + 'Name'] = label || '' | |
| 461 | + if (field === 'historyRemarks') { | |
| 462 | + this.defaultRemark = label || '' | |
| 463 | + this.form.remarks = v | |
| 464 | + }else{ | |
| 465 | + this.form[field] = v | |
| 466 | + this.form[field + 'Name'] = label || '' | |
| 467 | + } | |
| 367 | 468 | }, |
| 368 | 469 | openRelate(fieldKey) { |
| 369 | 470 | let config = {} | ... | ... |
| ... | ... | @@ -123,9 +123,15 @@ |
| 123 | 123 | <uni-easyinput v-model="form.specialInstructions" placeholder="请输入特别说明" :inputBorder="false" /> |
| 124 | 124 | </template> |
| 125 | 125 | </uni-list-item> |
| 126 | + <uni-list-item v-if="this.customerRemarks.length" class="select-item" :class="defaultRemark ? 'is-filled' : 'is-empty'" clickable | |
| 127 | + @click="openSheet('historyRemarks')" :rightText="defaultRemark || '请选择'" showArrow> | |
| 128 | + <template v-slot:body> | |
| 129 | + <view class="item-title"><text>历史备注</text></view> | |
| 130 | + </template> | |
| 131 | + </uni-list-item> | |
| 126 | 132 | <uni-list-item title="备注"> |
| 127 | 133 | <template v-slot:footer> |
| 128 | - <uni-easyinput v-model="form.remarks" placeholder="请输入备注" :inputBorder="false" /> | |
| 134 | + <uni-easyinput type="textarea" v-model="form.remarks" placeholder="请输入备注" :inputBorder="false" /> | |
| 129 | 135 | </template> |
| 130 | 136 | </uni-list-item> |
| 131 | 137 | <view class="quality"> |
| ... | ... | @@ -134,32 +140,32 @@ |
| 134 | 140 | </view> |
| 135 | 141 | <uni-list-item title="件重条头"> |
| 136 | 142 | <template v-slot:footer> |
| 137 | - <uni-easyinput v-model="form.pieceWeightHead" placeholder="请输入" :inputBorder="false" /> | |
| 143 | + <uni-easyinput type="textarea" v-model="form.pieceWeightHead" placeholder="请输入" :inputBorder="false" /> | |
| 138 | 144 | </template> |
| 139 | 145 | </uni-list-item> |
| 140 | 146 | <uni-list-item title="表面"> |
| 141 | 147 | <template v-slot:footer> |
| 142 | - <uni-easyinput v-model="form.surface" placeholder="请输入" :inputBorder="false" /> | |
| 148 | + <uni-easyinput type="textarea" v-model="form.surface" placeholder="请输入" :inputBorder="false" /> | |
| 143 | 149 | </template> |
| 144 | 150 | </uni-list-item> |
| 145 | 151 | <uni-list-item title="公差"> |
| 146 | 152 | <template v-slot:footer> |
| 147 | - <uni-easyinput v-model="form.tolerance" placeholder="请输入" :inputBorder="false" /> | |
| 153 | + <uni-easyinput type="textarea" v-model="form.tolerance" placeholder="请输入" :inputBorder="false" /> | |
| 148 | 154 | </template> |
| 149 | 155 | </uni-list-item> |
| 150 | 156 | <uni-list-item title="性能"> |
| 151 | 157 | <template v-slot:footer> |
| 152 | - <uni-easyinput v-model="form.performance" placeholder="请输入" :inputBorder="false" /> | |
| 158 | + <uni-easyinput type="textarea" v-model="form.performance" placeholder="请输入" :inputBorder="false" /> | |
| 153 | 159 | </template> |
| 154 | 160 | </uni-list-item> |
| 155 | 161 | <uni-list-item title="成分"> |
| 156 | 162 | <template v-slot:footer> |
| 157 | - <uni-easyinput v-model="form.component" placeholder="请输入" :inputBorder="false" /> | |
| 163 | + <uni-easyinput type="textarea" v-model="form.component" placeholder="请输入" :inputBorder="false" /> | |
| 158 | 164 | </template> |
| 159 | 165 | </uni-list-item> |
| 160 | 166 | <uni-list-item title="包装"> |
| 161 | 167 | <template v-slot:footer> |
| 162 | - <uni-easyinput v-model="form.packaging" placeholder="请输入" :inputBorder="false" /> | |
| 168 | + <uni-easyinput type="textarea" v-model="form.packaging" placeholder="请输入" :inputBorder="false" /> | |
| 163 | 169 | </template> |
| 164 | 170 | </uni-list-item> |
| 165 | 171 | </uni-list> |
| ... | ... | @@ -210,7 +216,7 @@ import SingleSelectSheet from '@/components/single-select/index.vue' |
| 210 | 216 | import RelateSelectSheet from '@/components/relate-select/index.vue' |
| 211 | 217 | //import ProductRel from './productRel.vue' |
| 212 | 218 | import CitySelector from '@/components/city-selector/index.vue' |
| 213 | -import { getRetailCodeApi, createContractApi } from '@/api/contract' | |
| 219 | +import { getRetailCodeApi, createContractApi, getCustomerRemarks,getCustomerSpecificQualityRequirements } from '@/api/contract' | |
| 214 | 220 | import { getDicByCodes } from '@/utils/dic' |
| 215 | 221 | import { formatCurrencyToChinese } from '@/utils/common' |
| 216 | 222 | import { workshopQueryApi } from '@/api/devManage' |
| ... | ... | @@ -243,6 +249,13 @@ export default { |
| 243 | 249 | destinationLabel: '', |
| 244 | 250 | workshopIdName: '', |
| 245 | 251 | workshopId: '', |
| 252 | + remarks: '', | |
| 253 | + component: '', | |
| 254 | + packaging: '', | |
| 255 | + performance: '', | |
| 256 | + pieceWeightHead: '', | |
| 257 | + surface: '', | |
| 258 | + tolerance: '', | |
| 246 | 259 | }, |
| 247 | 260 | supplierList: [], |
| 248 | 261 | specialTermsList: [], |
| ... | ... | @@ -256,6 +269,8 @@ export default { |
| 256 | 269 | productLineList: [], |
| 257 | 270 | productList: [], |
| 258 | 271 | rawToProdRatioList: [], |
| 272 | + customerRemarks: [], | |
| 273 | + defaultRemark: '', | |
| 259 | 274 | } |
| 260 | 275 | }, |
| 261 | 276 | created() { |
| ... | ... | @@ -269,7 +284,86 @@ export default { |
| 269 | 284 | } |
| 270 | 285 | }) |
| 271 | 286 | }, |
| 287 | + watch: { | |
| 288 | + 'form.buyer': { | |
| 289 | + handler(newVal, oldVal) { | |
| 290 | + if (newVal) { | |
| 291 | + getCustomerRemarks(newVal).then(res => { | |
| 292 | + const remarksData = res.data || []; | |
| 293 | + this.customerRemarks = remarksData.map((item, index) => ({ | |
| 294 | + label: `客户备注${index + 1}`, | |
| 295 | + value: item, | |
| 296 | + })); | |
| 297 | + if (remarksData.length > 0) { | |
| 298 | + this.defaultRemark = this.customerRemarks[0].label || ''; | |
| 299 | + this.form.remarks = remarksData[0]; | |
| 300 | + } else { | |
| 301 | + this.form.remarks = ''; | |
| 302 | + this.defaultRemark = ''; | |
| 303 | + } | |
| 304 | + }) | |
| 305 | + this.getHistory() | |
| 306 | + } | |
| 307 | + } | |
| 308 | + }, | |
| 309 | + productLineList: { | |
| 310 | + deep: true, | |
| 311 | + handler(newVal, oldVal) { | |
| 312 | + const n = Array.isArray(newVal) ? newVal : [] | |
| 313 | + const o = Array.isArray(oldVal) ? oldVal : [] | |
| 314 | + const changed = [] | |
| 315 | + for (let i = 0; i < n.length; i++) { | |
| 316 | + const ni = n[i] && n[i].productId | |
| 317 | + const oi = o[i] && o[i].productId | |
| 318 | + if (ni !== oi && ni !== undefined) changed.push(ni) | |
| 319 | + } | |
| 320 | + if (changed.length && this.form.buyer) { | |
| 321 | + const id = changed.join('') | |
| 322 | + this.fetchCustomerQualityRequirements(id) | |
| 323 | + } | |
| 324 | + } | |
| 325 | + }, | |
| 326 | + }, | |
| 272 | 327 | methods: { |
| 328 | + getHistory() { | |
| 329 | + console.log('this.productLineList', this.productLineList[0].productId) | |
| 330 | + if (!this.productLineList.length || !this.productLineList[0].productId) { | |
| 331 | + return; | |
| 332 | + } | |
| 333 | + const id = this.productLineList.map(it => it.productId).join('') | |
| 334 | + this.fetchCustomerQualityRequirements(id) | |
| 335 | + }, | |
| 336 | + async fetchCustomerQualityRequirements(id) { | |
| 337 | + if (!this.form.buyer || !id) { | |
| 338 | + return; | |
| 339 | + } | |
| 340 | + try { | |
| 341 | + const result = await getCustomerSpecificQualityRequirements({ | |
| 342 | + customerId: this.form.buyer, | |
| 343 | + productIdList:id, | |
| 344 | + }); | |
| 345 | + this.updateFormData(result.data || {}); | |
| 346 | + } catch (error) { | |
| 347 | + console.error('获取客户质量要求失败:', error); | |
| 348 | + // 可以根据需要添加错误提示逻辑 | |
| 349 | + this.$message.error('获取历史数据失败,请稍后重试'); | |
| 350 | + } | |
| 351 | + }, | |
| 352 | + // 提取公共的字段更新方法 | |
| 353 | + updateFormData(result) { | |
| 354 | + console.log('result', result) | |
| 355 | + const fields = [ | |
| 356 | + 'component', | |
| 357 | + 'packaging', | |
| 358 | + 'performance', | |
| 359 | + 'pieceWeightHead', | |
| 360 | + 'surface', | |
| 361 | + 'tolerance', | |
| 362 | + ]; | |
| 363 | + fields.forEach((field) => { | |
| 364 | + this.form[field] = (this.form[field] || '') + (result[field] || ''); | |
| 365 | + }); | |
| 366 | + }, | |
| 273 | 367 | onProductsChange(products) { |
| 274 | 368 | const list = Array.isArray(products) ? products : [] |
| 275 | 369 | const sumQ = list.reduce((acc, it) => acc + (parseFloat(it.quantity) || 0), 0) |
| ... | ... | @@ -360,14 +454,21 @@ export default { |
| 360 | 454 | setSheet('单价中是否已包含包装费', this.yesNoList) |
| 361 | 455 | } else if (field === 'includesTransportFee') { |
| 362 | 456 | setSheet('单价中是否已包含运费', this.yesNoList) |
| 457 | + } else if (field === 'historyRemarks') { | |
| 458 | + setSheet('历史备注', this.customerRemarks) | |
| 363 | 459 | } |
| 364 | 460 | }, |
| 365 | 461 | onSheetConfirm({ value, label }) { |
| 366 | 462 | const field = this.sheet.field |
| 367 | 463 | if (!field) return |
| 368 | 464 | const v = (value === undefined || value === null) ? '' : value |
| 369 | - this.form[field] = v | |
| 370 | - this.form[field + 'Name'] = label || '' | |
| 465 | + if (field === 'historyRemarks') { | |
| 466 | + this.defaultRemark = label || '' | |
| 467 | + this.form.remarks = v | |
| 468 | + }else{ | |
| 469 | + this.form[field] = v | |
| 470 | + this.form[field + 'Name'] = label || '' | |
| 471 | + } | |
| 371 | 472 | }, |
| 372 | 473 | openRelate(fieldKey) { |
| 373 | 474 | let config = {} | ... | ... |
| ... | ... | @@ -122,10 +122,16 @@ |
| 122 | 122 | <template v-slot:footer> |
| 123 | 123 | <uni-easyinput v-model="form.specialInstructions" placeholder="请输入特别说明" :inputBorder="false" /> |
| 124 | 124 | </template> |
| 125 | + </uni-list-item> | |
| 126 | + <uni-list-item v-if="this.customerRemarks.length" class="select-item" :class="defaultRemark ? 'is-filled' : 'is-empty'" clickable | |
| 127 | + @click="openSheet('historyRemarks')" :rightText="defaultRemark || '请选择'" showArrow> | |
| 128 | + <template v-slot:body> | |
| 129 | + <view class="item-title"><text>历史备注</text></view> | |
| 130 | + </template> | |
| 125 | 131 | </uni-list-item> |
| 126 | 132 | <uni-list-item title="备注"> |
| 127 | 133 | <template v-slot:footer> |
| 128 | - <uni-easyinput v-model="form.remarks" placeholder="请输入备注" :inputBorder="false" /> | |
| 134 | + <uni-easyinput type="textarea" v-model="form.remarks" placeholder="请输入备注" :inputBorder="false" /> | |
| 129 | 135 | </template> |
| 130 | 136 | </uni-list-item> |
| 131 | 137 | <view class="quality"> |
| ... | ... | @@ -134,32 +140,32 @@ |
| 134 | 140 | </view> |
| 135 | 141 | <uni-list-item title="件重条头"> |
| 136 | 142 | <template v-slot:footer> |
| 137 | - <uni-easyinput v-model="form.pieceWeightHead" placeholder="请输入" :inputBorder="false" /> | |
| 143 | + <uni-easyinput type="textarea" v-model="form.pieceWeightHead" placeholder="请输入" :inputBorder="false" /> | |
| 138 | 144 | </template> |
| 139 | 145 | </uni-list-item> |
| 140 | 146 | <uni-list-item title="表面"> |
| 141 | 147 | <template v-slot:footer> |
| 142 | - <uni-easyinput v-model="form.surface" placeholder="请输入" :inputBorder="false" /> | |
| 148 | + <uni-easyinput type="textarea" v-model="form.surface" placeholder="请输入" :inputBorder="false" /> | |
| 143 | 149 | </template> |
| 144 | 150 | </uni-list-item> |
| 145 | 151 | <uni-list-item title="公差"> |
| 146 | 152 | <template v-slot:footer> |
| 147 | - <uni-easyinput v-model="form.tolerance" placeholder="请输入" :inputBorder="false" /> | |
| 153 | + <uni-easyinput type="textarea" v-model="form.tolerance" placeholder="请输入" :inputBorder="false" /> | |
| 148 | 154 | </template> |
| 149 | 155 | </uni-list-item> |
| 150 | 156 | <uni-list-item title="性能"> |
| 151 | 157 | <template v-slot:footer> |
| 152 | - <uni-easyinput v-model="form.performance" placeholder="请输入" :inputBorder="false" /> | |
| 158 | + <uni-easyinput type="textarea" v-model="form.performance" placeholder="请输入" :inputBorder="false" /> | |
| 153 | 159 | </template> |
| 154 | 160 | </uni-list-item> |
| 155 | 161 | <uni-list-item title="成分"> |
| 156 | 162 | <template v-slot:footer> |
| 157 | - <uni-easyinput v-model="form.component" placeholder="请输入" :inputBorder="false" /> | |
| 163 | + <uni-easyinput type="textarea" v-model="form.component" placeholder="请输入" :inputBorder="false" /> | |
| 158 | 164 | </template> |
| 159 | 165 | </uni-list-item> |
| 160 | 166 | <uni-list-item title="包装"> |
| 161 | 167 | <template v-slot:footer> |
| 162 | - <uni-easyinput v-model="form.packaging" placeholder="请输入" :inputBorder="false" /> | |
| 168 | + <uni-easyinput type="textarea" v-model="form.packaging" placeholder="请输入" :inputBorder="false" /> | |
| 163 | 169 | </template> |
| 164 | 170 | </uni-list-item> |
| 165 | 171 | </uni-list> |
| ... | ... | @@ -210,7 +216,7 @@ import SingleSelectSheet from '@/components/single-select/index.vue' |
| 210 | 216 | import RelateSelectSheet from '@/components/relate-select/index.vue' |
| 211 | 217 | import ProductRel from './productRel.vue' |
| 212 | 218 | import CitySelector from '@/components/city-selector/index.vue' |
| 213 | -import { getRetailCodeApi, createContractApi } from '@/api/contract' | |
| 219 | +import { getRetailCodeApi, createContractApi, getCustomerRemarks,getCustomerSpecificQualityRequirements } from '@/api/contract' | |
| 214 | 220 | import { getDicByCodes } from '@/utils/dic' |
| 215 | 221 | import { formatCurrencyToChinese } from '@/utils/common' |
| 216 | 222 | import { workshopQueryApi } from '@/api/devManage' |
| ... | ... | @@ -243,6 +249,13 @@ export default { |
| 243 | 249 | destinationLabel: '', |
| 244 | 250 | workshopIdName: '', |
| 245 | 251 | workshopId: '', |
| 252 | + remarks: '', | |
| 253 | + component: '', | |
| 254 | + packaging: '', | |
| 255 | + performance: '', | |
| 256 | + pieceWeightHead: '', | |
| 257 | + surface: '', | |
| 258 | + tolerance: '', | |
| 246 | 259 | }, |
| 247 | 260 | supplierList: [], |
| 248 | 261 | specialTermsList: [], |
| ... | ... | @@ -255,6 +268,8 @@ export default { |
| 255 | 268 | sumTotal: 0, |
| 256 | 269 | productLineList: [], |
| 257 | 270 | productList: [], |
| 271 | + customerRemarks: [], | |
| 272 | + defaultRemark: '', | |
| 258 | 273 | } |
| 259 | 274 | }, |
| 260 | 275 | created() { |
| ... | ... | @@ -268,7 +283,87 @@ export default { |
| 268 | 283 | } |
| 269 | 284 | }) |
| 270 | 285 | }, |
| 286 | + watch: { | |
| 287 | + 'form.buyer': { | |
| 288 | + handler(newVal, oldVal) { | |
| 289 | + if (newVal) { | |
| 290 | + getCustomerRemarks(newVal).then(res => { | |
| 291 | + const remarksData = res.data || []; | |
| 292 | + this.customerRemarks = remarksData.map((item, index) => ({ | |
| 293 | + label: `客户备注${index + 1}`, | |
| 294 | + value: item, | |
| 295 | + })); | |
| 296 | + if (remarksData.length > 0) { | |
| 297 | + this.defaultRemark = this.customerRemarks[0].label || ''; | |
| 298 | + this.form.remarks = remarksData[0]; | |
| 299 | + } else { | |
| 300 | + this.form.remarks = ''; | |
| 301 | + this.defaultRemark = ''; | |
| 302 | + } | |
| 303 | + }) | |
| 304 | + this.getHistory() | |
| 305 | + } | |
| 306 | + } | |
| 307 | + }, | |
| 308 | + productLineList: { | |
| 309 | + deep: true, | |
| 310 | + handler(newVal, oldVal) { | |
| 311 | + const n = Array.isArray(newVal) ? newVal : [] | |
| 312 | + const o = Array.isArray(oldVal) ? oldVal : [] | |
| 313 | + const changed = [] | |
| 314 | + for (let i = 0; i < n.length; i++) { | |
| 315 | + const ni = n[i] && n[i].productId | |
| 316 | + const oi = o[i] && o[i].productId | |
| 317 | + if (ni !== oi && ni !== undefined) changed.push(ni) | |
| 318 | + } | |
| 319 | + console.log('changed', changed) | |
| 320 | + if (changed.length && this.form.buyer) { | |
| 321 | + const id = changed.join('') | |
| 322 | + this.fetchCustomerQualityRequirements(id) | |
| 323 | + } | |
| 324 | + } | |
| 325 | + }, | |
| 326 | + }, | |
| 271 | 327 | methods: { |
| 328 | + getHistory() { | |
| 329 | + console.log('this.productLineList', this.productLineList[0].productId) | |
| 330 | + if (!this.productLineList.length || !this.productLineList[0].productId) { | |
| 331 | + return; | |
| 332 | + } | |
| 333 | + const id = this.productLineList.map(it => it.productId).join('') | |
| 334 | + this.fetchCustomerQualityRequirements(id) | |
| 335 | + }, | |
| 336 | + async fetchCustomerQualityRequirements(id) { | |
| 337 | + if (!this.form.buyer || !id) { | |
| 338 | + return; | |
| 339 | + } | |
| 340 | + try { | |
| 341 | + const result = await getCustomerSpecificQualityRequirements({ | |
| 342 | + customerId: this.form.buyer, | |
| 343 | + productIdList:id, | |
| 344 | + }); | |
| 345 | + this.updateFormData(result.data || {}); | |
| 346 | + } catch (error) { | |
| 347 | + console.error('获取客户质量要求失败:', error); | |
| 348 | + // 可以根据需要添加错误提示逻辑 | |
| 349 | + this.$message.error('获取历史数据失败,请稍后重试'); | |
| 350 | + } | |
| 351 | + }, | |
| 352 | + // 提取公共的字段更新方法 | |
| 353 | + updateFormData(result) { | |
| 354 | + console.log('result', result) | |
| 355 | + const fields = [ | |
| 356 | + 'component', | |
| 357 | + 'packaging', | |
| 358 | + 'performance', | |
| 359 | + 'pieceWeightHead', | |
| 360 | + 'surface', | |
| 361 | + 'tolerance', | |
| 362 | + ]; | |
| 363 | + fields.forEach((field) => { | |
| 364 | + this.form[field] = (this.form[field] || '') + (result[field] || ''); | |
| 365 | + }); | |
| 366 | + }, | |
| 272 | 367 | onProductsChange(products) { |
| 273 | 368 | const list = Array.isArray(products) ? products : [] |
| 274 | 369 | const sumQ = list.reduce((acc, it) => acc + (parseFloat(it.quantity) || 0), 0) |
| ... | ... | @@ -356,14 +451,21 @@ export default { |
| 356 | 451 | setSheet('单价中是否已包含包装费', this.yesNoList) |
| 357 | 452 | } else if (field === 'includesTransportFee') { |
| 358 | 453 | setSheet('单价中是否已包含运费', this.yesNoList) |
| 454 | + } else if (field === 'historyRemarks') { | |
| 455 | + setSheet('历史备注', this.customerRemarks) | |
| 359 | 456 | } |
| 360 | 457 | }, |
| 361 | 458 | onSheetConfirm({ value, label }) { |
| 362 | 459 | const field = this.sheet.field |
| 363 | 460 | if (!field) return |
| 364 | 461 | const v = (value === undefined || value === null) ? '' : value |
| 365 | - this.form[field] = v | |
| 366 | - this.form[field + 'Name'] = label || '' | |
| 462 | + if (field === 'historyRemarks') { | |
| 463 | + this.defaultRemark = label || '' | |
| 464 | + this.form.remarks = v | |
| 465 | + }else{ | |
| 466 | + this.form[field] = v | |
| 467 | + this.form[field + 'Name'] = label || '' | |
| 468 | + } | |
| 367 | 469 | }, |
| 368 | 470 | openRelate(fieldKey) { |
| 369 | 471 | let config = {} | ... | ... |
| ... | ... | @@ -123,9 +123,15 @@ |
| 123 | 123 | <uni-easyinput v-model="form.specialInstructions" placeholder="请输入特别说明" :inputBorder="false" /> |
| 124 | 124 | </template> |
| 125 | 125 | </uni-list-item> |
| 126 | + <uni-list-item v-if="this.customerRemarks.length" class="select-item" :class="defaultRemark ? 'is-filled' : 'is-empty'" clickable | |
| 127 | + @click="openSheet('historyRemarks')" :rightText="defaultRemark || '请选择'" showArrow> | |
| 128 | + <template v-slot:body> | |
| 129 | + <view class="item-title"><text>历史备注</text></view> | |
| 130 | + </template> | |
| 131 | + </uni-list-item> | |
| 126 | 132 | <uni-list-item title="备注"> |
| 127 | 133 | <template v-slot:footer> |
| 128 | - <uni-easyinput v-model="form.remarks" placeholder="请输入备注" :inputBorder="false" /> | |
| 134 | + <uni-easyinput type="textarea" v-model="form.remarks" placeholder="请输入备注" :inputBorder="false" /> | |
| 129 | 135 | </template> |
| 130 | 136 | </uni-list-item> |
| 131 | 137 | <view class="quality"> |
| ... | ... | @@ -134,32 +140,32 @@ |
| 134 | 140 | </view> |
| 135 | 141 | <uni-list-item title="件重条头"> |
| 136 | 142 | <template v-slot:footer> |
| 137 | - <uni-easyinput v-model="form.pieceWeightHead" placeholder="请输入" :inputBorder="false" /> | |
| 143 | + <uni-easyinput type="textarea" v-model="form.pieceWeightHead" placeholder="请输入" :inputBorder="false" /> | |
| 138 | 144 | </template> |
| 139 | 145 | </uni-list-item> |
| 140 | 146 | <uni-list-item title="表面"> |
| 141 | 147 | <template v-slot:footer> |
| 142 | - <uni-easyinput v-model="form.surface" placeholder="请输入" :inputBorder="false" /> | |
| 148 | + <uni-easyinput type="textarea" v-model="form.surface" placeholder="请输入" :inputBorder="false" /> | |
| 143 | 149 | </template> |
| 144 | 150 | </uni-list-item> |
| 145 | 151 | <uni-list-item title="公差"> |
| 146 | 152 | <template v-slot:footer> |
| 147 | - <uni-easyinput v-model="form.tolerance" placeholder="请输入" :inputBorder="false" /> | |
| 153 | + <uni-easyinput type="textarea" v-model="form.tolerance" placeholder="请输入" :inputBorder="false" /> | |
| 148 | 154 | </template> |
| 149 | 155 | </uni-list-item> |
| 150 | 156 | <uni-list-item title="性能"> |
| 151 | 157 | <template v-slot:footer> |
| 152 | - <uni-easyinput v-model="form.performance" placeholder="请输入" :inputBorder="false" /> | |
| 158 | + <uni-easyinput type="textarea" v-model="form.performance" placeholder="请输入" :inputBorder="false" /> | |
| 153 | 159 | </template> |
| 154 | 160 | </uni-list-item> |
| 155 | 161 | <uni-list-item title="成分"> |
| 156 | 162 | <template v-slot:footer> |
| 157 | - <uni-easyinput v-model="form.component" placeholder="请输入" :inputBorder="false" /> | |
| 163 | + <uni-easyinput type="textarea" v-model="form.component" placeholder="请输入" :inputBorder="false" /> | |
| 158 | 164 | </template> |
| 159 | 165 | </uni-list-item> |
| 160 | 166 | <uni-list-item title="包装"> |
| 161 | 167 | <template v-slot:footer> |
| 162 | - <uni-easyinput v-model="form.packaging" placeholder="请输入" :inputBorder="false" /> | |
| 168 | + <uni-easyinput type="textarea" v-model="form.packaging" placeholder="请输入" :inputBorder="false" /> | |
| 163 | 169 | </template> |
| 164 | 170 | </uni-list-item> |
| 165 | 171 | </uni-list> |
| ... | ... | @@ -210,7 +216,7 @@ import SingleSelectSheet from '@/components/single-select/index.vue' |
| 210 | 216 | import RelateSelectSheet from '@/components/relate-select/index.vue' |
| 211 | 217 | import ProductRel from './productRel.vue' |
| 212 | 218 | import CitySelector from '@/components/city-selector/index.vue' |
| 213 | -import { getRetailCodeApi, createContractApi } from '@/api/contract' | |
| 219 | +import { getRetailCodeApi, createContractApi,getCustomerRemarks,getCustomerSpecificQualityRequirements } from '@/api/contract' | |
| 214 | 220 | import { getDicByCodes } from '@/utils/dic' |
| 215 | 221 | import { formatCurrencyToChinese } from '@/utils/common' |
| 216 | 222 | import { workshopQueryApi } from '@/api/devManage' |
| ... | ... | @@ -243,6 +249,13 @@ export default { |
| 243 | 249 | destinationLabel: '', |
| 244 | 250 | workshopIdName: '', |
| 245 | 251 | workshopId: '', |
| 252 | + remarks: '', | |
| 253 | + component: '', | |
| 254 | + packaging: '', | |
| 255 | + performance: '', | |
| 256 | + pieceWeightHead: '', | |
| 257 | + surface: '', | |
| 258 | + tolerance: '', | |
| 246 | 259 | }, |
| 247 | 260 | supplierList: [], |
| 248 | 261 | specialTermsList: [], |
| ... | ... | @@ -255,6 +268,8 @@ export default { |
| 255 | 268 | sumTotal: 0, |
| 256 | 269 | productLineList: [], |
| 257 | 270 | productList: [], |
| 271 | + customerRemarks: [], | |
| 272 | + defaultRemark: '', | |
| 258 | 273 | } |
| 259 | 274 | }, |
| 260 | 275 | created() { |
| ... | ... | @@ -268,7 +283,86 @@ export default { |
| 268 | 283 | } |
| 269 | 284 | }) |
| 270 | 285 | }, |
| 286 | + watch: { | |
| 287 | + 'form.buyer': { | |
| 288 | + handler(newVal, oldVal) { | |
| 289 | + if (newVal) { | |
| 290 | + getCustomerRemarks(newVal).then(res => { | |
| 291 | + const remarksData = res.data || []; | |
| 292 | + this.customerRemarks = remarksData.map((item, index) => ({ | |
| 293 | + label: `客户备注${index + 1}`, | |
| 294 | + value: item, | |
| 295 | + })); | |
| 296 | + if (remarksData.length > 0) { | |
| 297 | + this.defaultRemark = this.customerRemarks[0].label || ''; | |
| 298 | + this.form.remarks = remarksData[0]; | |
| 299 | + } else { | |
| 300 | + this.form.remarks = ''; | |
| 301 | + this.defaultRemark = ''; | |
| 302 | + } | |
| 303 | + }) | |
| 304 | + this.getHistory() | |
| 305 | + } | |
| 306 | + } | |
| 307 | + }, | |
| 308 | + productLineList: { | |
| 309 | + deep: true, | |
| 310 | + handler(newVal, oldVal) { | |
| 311 | + const n = Array.isArray(newVal) ? newVal : [] | |
| 312 | + const o = Array.isArray(oldVal) ? oldVal : [] | |
| 313 | + const changed = [] | |
| 314 | + for (let i = 0; i < n.length; i++) { | |
| 315 | + const ni = n[i] && n[i].productId | |
| 316 | + const oi = o[i] && o[i].productId | |
| 317 | + if (ni !== oi && ni !== undefined) changed.push(ni) | |
| 318 | + } | |
| 319 | + if (changed.length && this.form.buyer) { | |
| 320 | + const id = changed.join('') | |
| 321 | + this.fetchCustomerQualityRequirements(id) | |
| 322 | + } | |
| 323 | + } | |
| 324 | + }, | |
| 325 | + }, | |
| 271 | 326 | methods: { |
| 327 | + getHistory() { | |
| 328 | + console.log('this.productLineList', this.productLineList[0].productId) | |
| 329 | + if (!this.productLineList.length || !this.productLineList[0].productId) { | |
| 330 | + return; | |
| 331 | + } | |
| 332 | + const id = this.productLineList.map(it => it.productId).join('') | |
| 333 | + this.fetchCustomerQualityRequirements(id) | |
| 334 | + }, | |
| 335 | + async fetchCustomerQualityRequirements(id) { | |
| 336 | + if (!this.form.buyer || !id) { | |
| 337 | + return; | |
| 338 | + } | |
| 339 | + try { | |
| 340 | + const result = await getCustomerSpecificQualityRequirements({ | |
| 341 | + customerId: this.form.buyer, | |
| 342 | + productIdList:id, | |
| 343 | + }); | |
| 344 | + this.updateFormData(result.data || {}); | |
| 345 | + } catch (error) { | |
| 346 | + console.error('获取客户质量要求失败:', error); | |
| 347 | + // 可以根据需要添加错误提示逻辑 | |
| 348 | + this.$message.error('获取历史数据失败,请稍后重试'); | |
| 349 | + } | |
| 350 | + }, | |
| 351 | + // 提取公共的字段更新方法 | |
| 352 | + updateFormData(result) { | |
| 353 | + console.log('result', result) | |
| 354 | + const fields = [ | |
| 355 | + 'component', | |
| 356 | + 'packaging', | |
| 357 | + 'performance', | |
| 358 | + 'pieceWeightHead', | |
| 359 | + 'surface', | |
| 360 | + 'tolerance', | |
| 361 | + ]; | |
| 362 | + fields.forEach((field) => { | |
| 363 | + this.form[field] = (this.form[field] || '') + (result[field] || ''); | |
| 364 | + }); | |
| 365 | + }, | |
| 272 | 366 | onProductsChange(products) { |
| 273 | 367 | const list = Array.isArray(products) ? products : [] |
| 274 | 368 | const sumQ = list.reduce((acc, it) => acc + (parseFloat(it.quantity) || 0), 0) |
| ... | ... | @@ -356,14 +450,21 @@ export default { |
| 356 | 450 | setSheet('单价中是否已包含包装费', this.yesNoList) |
| 357 | 451 | } else if (field === 'includesTransportFee') { |
| 358 | 452 | setSheet('单价中是否已包含运费', this.yesNoList) |
| 453 | + } else if (field === 'historyRemarks') { | |
| 454 | + setSheet('历史备注', this.customerRemarks) | |
| 359 | 455 | } |
| 360 | 456 | }, |
| 361 | 457 | onSheetConfirm({ value, label }) { |
| 362 | 458 | const field = this.sheet.field |
| 363 | 459 | if (!field) return |
| 364 | 460 | const v = (value === undefined || value === null) ? '' : value |
| 365 | - this.form[field] = v | |
| 366 | - this.form[field + 'Name'] = label || '' | |
| 461 | + if (field === 'historyRemarks') { | |
| 462 | + this.defaultRemark = label || '' | |
| 463 | + this.form.remarks = v | |
| 464 | + }else{ | |
| 465 | + this.form[field] = v | |
| 466 | + this.form[field + 'Name'] = label || '' | |
| 467 | + } | |
| 367 | 468 | }, |
| 368 | 469 | openRelate(fieldKey) { |
| 369 | 470 | let config = {} | ... | ... |
| ... | ... | @@ -123,9 +123,15 @@ |
| 123 | 123 | <uni-easyinput v-model="form.specialInstructions" placeholder="请输入特别说明" :inputBorder="false" /> |
| 124 | 124 | </template> |
| 125 | 125 | </uni-list-item> |
| 126 | + <uni-list-item v-if="this.customerRemarks.length" class="select-item" :class="defaultRemark ? 'is-filled' : 'is-empty'" clickable | |
| 127 | + @click="openSheet('historyRemarks')" :rightText="defaultRemark || '请选择'" showArrow> | |
| 128 | + <template v-slot:body> | |
| 129 | + <view class="item-title"><text>历史备注</text></view> | |
| 130 | + </template> | |
| 131 | + </uni-list-item> | |
| 126 | 132 | <uni-list-item title="备注"> |
| 127 | 133 | <template v-slot:footer> |
| 128 | - <uni-easyinput v-model="form.remarks" placeholder="请输入备注" :inputBorder="false" /> | |
| 134 | + <uni-easyinput type="textarea" v-model="form.remarks" placeholder="请输入备注" :inputBorder="false" /> | |
| 129 | 135 | </template> |
| 130 | 136 | </uni-list-item> |
| 131 | 137 | <view class="quality"> |
| ... | ... | @@ -134,32 +140,32 @@ |
| 134 | 140 | </view> |
| 135 | 141 | <uni-list-item title="件重条头"> |
| 136 | 142 | <template v-slot:footer> |
| 137 | - <uni-easyinput v-model="form.pieceWeightHead" placeholder="请输入" :inputBorder="false" /> | |
| 143 | + <uni-easyinput type="textarea" v-model="form.pieceWeightHead" placeholder="请输入" :inputBorder="false" /> | |
| 138 | 144 | </template> |
| 139 | 145 | </uni-list-item> |
| 140 | 146 | <uni-list-item title="表面"> |
| 141 | 147 | <template v-slot:footer> |
| 142 | - <uni-easyinput v-model="form.surface" placeholder="请输入" :inputBorder="false" /> | |
| 148 | + <uni-easyinput type="textarea" v-model="form.surface" placeholder="请输入" :inputBorder="false" /> | |
| 143 | 149 | </template> |
| 144 | 150 | </uni-list-item> |
| 145 | 151 | <uni-list-item title="公差"> |
| 146 | 152 | <template v-slot:footer> |
| 147 | - <uni-easyinput v-model="form.tolerance" placeholder="请输入" :inputBorder="false" /> | |
| 153 | + <uni-easyinput type="textarea" v-model="form.tolerance" placeholder="请输入" :inputBorder="false" /> | |
| 148 | 154 | </template> |
| 149 | 155 | </uni-list-item> |
| 150 | 156 | <uni-list-item title="性能"> |
| 151 | 157 | <template v-slot:footer> |
| 152 | - <uni-easyinput v-model="form.performance" placeholder="请输入" :inputBorder="false" /> | |
| 158 | + <uni-easyinput type="textarea" v-model="form.performance" placeholder="请输入" :inputBorder="false" /> | |
| 153 | 159 | </template> |
| 154 | 160 | </uni-list-item> |
| 155 | 161 | <uni-list-item title="成分"> |
| 156 | 162 | <template v-slot:footer> |
| 157 | - <uni-easyinput v-model="form.component" placeholder="请输入" :inputBorder="false" /> | |
| 163 | + <uni-easyinput type="textarea" v-model="form.component" placeholder="请输入" :inputBorder="false" /> | |
| 158 | 164 | </template> |
| 159 | 165 | </uni-list-item> |
| 160 | 166 | <uni-list-item title="包装"> |
| 161 | 167 | <template v-slot:footer> |
| 162 | - <uni-easyinput v-model="form.packaging" placeholder="请输入" :inputBorder="false" /> | |
| 168 | + <uni-easyinput type="textarea" v-model="form.packaging" placeholder="请输入" :inputBorder="false" /> | |
| 163 | 169 | </template> |
| 164 | 170 | </uni-list-item> |
| 165 | 171 | </uni-list> |
| ... | ... | @@ -210,7 +216,7 @@ import SingleSelectSheet from '@/components/single-select/index.vue' |
| 210 | 216 | import RelateSelectSheet from '@/components/relate-select/index.vue' |
| 211 | 217 | import ProductRel from './productRel.vue' |
| 212 | 218 | import CitySelector from '@/components/city-selector/index.vue' |
| 213 | -import { getRetailCodeApi, createContractApi } from '@/api/contract' | |
| 219 | +import { getRetailCodeApi, createContractApi, getCustomerRemarks,getCustomerSpecificQualityRequirements } from '@/api/contract' | |
| 214 | 220 | import { getDicByCodes } from '@/utils/dic' |
| 215 | 221 | import { formatCurrencyToChinese } from '@/utils/common' |
| 216 | 222 | import { workshopQueryApi } from '@/api/devManage' |
| ... | ... | @@ -243,6 +249,13 @@ export default { |
| 243 | 249 | destinationLabel: '', |
| 244 | 250 | workshopIdName: '', |
| 245 | 251 | workshopId: '', |
| 252 | + remarks: '', | |
| 253 | + component: '', | |
| 254 | + packaging: '', | |
| 255 | + performance: '', | |
| 256 | + pieceWeightHead: '', | |
| 257 | + surface: '', | |
| 258 | + tolerance: '', | |
| 246 | 259 | }, |
| 247 | 260 | supplierList: [], |
| 248 | 261 | specialTermsList: [], |
| ... | ... | @@ -255,6 +268,8 @@ export default { |
| 255 | 268 | sumTotal: 0, |
| 256 | 269 | productLineList: [], |
| 257 | 270 | productList: [], |
| 271 | + customerRemarks: [], | |
| 272 | + defaultRemark: '', | |
| 258 | 273 | } |
| 259 | 274 | }, |
| 260 | 275 | created() { |
| ... | ... | @@ -268,7 +283,86 @@ export default { |
| 268 | 283 | } |
| 269 | 284 | }) |
| 270 | 285 | }, |
| 286 | + watch: { | |
| 287 | + 'form.buyer': { | |
| 288 | + handler(newVal, oldVal) { | |
| 289 | + if (newVal) { | |
| 290 | + getCustomerRemarks(newVal).then(res => { | |
| 291 | + const remarksData = res.data || []; | |
| 292 | + this.customerRemarks = remarksData.map((item, index) => ({ | |
| 293 | + label: `客户备注${index + 1}`, | |
| 294 | + value: item, | |
| 295 | + })); | |
| 296 | + if (remarksData.length > 0) { | |
| 297 | + this.defaultRemark = this.customerRemarks[0].label || ''; | |
| 298 | + this.form.remarks = remarksData[0]; | |
| 299 | + } else { | |
| 300 | + this.form.remarks = ''; | |
| 301 | + this.defaultRemark = ''; | |
| 302 | + } | |
| 303 | + }) | |
| 304 | + this.getHistory() | |
| 305 | + } | |
| 306 | + } | |
| 307 | + }, | |
| 308 | + productLineList: { | |
| 309 | + deep: true, | |
| 310 | + handler(newVal, oldVal) { | |
| 311 | + const n = Array.isArray(newVal) ? newVal : [] | |
| 312 | + const o = Array.isArray(oldVal) ? oldVal : [] | |
| 313 | + const changed = [] | |
| 314 | + for (let i = 0; i < n.length; i++) { | |
| 315 | + const ni = n[i] && n[i].productId | |
| 316 | + const oi = o[i] && o[i].productId | |
| 317 | + if (ni !== oi && ni !== undefined) changed.push(ni) | |
| 318 | + } | |
| 319 | + if (changed.length && this.form.buyer) { | |
| 320 | + const id = changed.join('') | |
| 321 | + this.fetchCustomerQualityRequirements(id) | |
| 322 | + } | |
| 323 | + } | |
| 324 | + }, | |
| 325 | + }, | |
| 271 | 326 | methods: { |
| 327 | + getHistory() { | |
| 328 | + console.log('this.productLineList', this.productLineList[0].productId) | |
| 329 | + if (!this.productLineList.length || !this.productLineList[0].productId) { | |
| 330 | + return; | |
| 331 | + } | |
| 332 | + const id = this.productLineList.map(it => it.productId).join('') | |
| 333 | + this.fetchCustomerQualityRequirements(id) | |
| 334 | + }, | |
| 335 | + async fetchCustomerQualityRequirements(id) { | |
| 336 | + if (!this.form.buyer || !id) { | |
| 337 | + return; | |
| 338 | + } | |
| 339 | + try { | |
| 340 | + const result = await getCustomerSpecificQualityRequirements({ | |
| 341 | + customerId: this.form.buyer, | |
| 342 | + productIdList:id, | |
| 343 | + }); | |
| 344 | + this.updateFormData(result.data || {}); | |
| 345 | + } catch (error) { | |
| 346 | + console.error('获取客户质量要求失败:', error); | |
| 347 | + // 可以根据需要添加错误提示逻辑 | |
| 348 | + this.$message.error('获取历史数据失败,请稍后重试'); | |
| 349 | + } | |
| 350 | + }, | |
| 351 | + // 提取公共的字段更新方法 | |
| 352 | + updateFormData(result) { | |
| 353 | + console.log('result', result) | |
| 354 | + const fields = [ | |
| 355 | + 'component', | |
| 356 | + 'packaging', | |
| 357 | + 'performance', | |
| 358 | + 'pieceWeightHead', | |
| 359 | + 'surface', | |
| 360 | + 'tolerance', | |
| 361 | + ]; | |
| 362 | + fields.forEach((field) => { | |
| 363 | + this.form[field] = (this.form[field] || '') + (result[field] || ''); | |
| 364 | + }); | |
| 365 | + }, | |
| 272 | 366 | onProductsChange(products) { |
| 273 | 367 | const list = Array.isArray(products) ? products : [] |
| 274 | 368 | const sumQ = list.reduce((acc, it) => acc + (parseFloat(it.quantity) || 0), 0) |
| ... | ... | @@ -356,14 +450,21 @@ export default { |
| 356 | 450 | setSheet('单价中是否已包含包装费', this.yesNoList) |
| 357 | 451 | } else if (field === 'includesTransportFee') { |
| 358 | 452 | setSheet('单价中是否已包含运费', this.yesNoList) |
| 453 | + } else if (field === 'historyRemarks') { | |
| 454 | + setSheet('历史备注', this.customerRemarks) | |
| 359 | 455 | } |
| 360 | 456 | }, |
| 361 | 457 | onSheetConfirm({ value, label }) { |
| 362 | 458 | const field = this.sheet.field |
| 363 | 459 | if (!field) return |
| 364 | 460 | const v = (value === undefined || value === null) ? '' : value |
| 365 | - this.form[field] = v | |
| 366 | - this.form[field + 'Name'] = label || '' | |
| 461 | + if (field === 'historyRemarks') { | |
| 462 | + this.defaultRemark = label || '' | |
| 463 | + this.form.remarks = v | |
| 464 | + }else{ | |
| 465 | + this.form[field] = v | |
| 466 | + this.form[field + 'Name'] = label || '' | |
| 467 | + } | |
| 367 | 468 | }, |
| 368 | 469 | openRelate(fieldKey) { |
| 369 | 470 | let config = {} | ... | ... |