|
|
@ -143,6 +143,10 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="popup-section"> |
|
|
|
<text class="section-label">自定义理由</text> |
|
|
|
<textarea class="custom-reason-input" v-model="customReason" placeholder="请输入自定义理由..." maxlength="200" /> |
|
|
|
</view> |
|
|
|
<view class="popup-section"> |
|
|
|
<text class="section-label">选择理由</text> |
|
|
|
<view v-for="(item, index) in reasonOptions" :key="item.id" class="reason-row" @tap="toggleReason(index)"> |
|
|
@ -176,6 +180,7 @@ export default { |
|
|
|
reasonImages: [], |
|
|
|
reasonOptions: [], |
|
|
|
reasonChecked: [], |
|
|
|
customReason: '', // 自定义理由输入 |
|
|
|
currentReasonItem: null, |
|
|
|
isPopupOpen: false, // 控制弹窗状态 |
|
|
|
scrollTop: 0 // 记录滚动位置 |
|
|
@ -449,14 +454,29 @@ export default { |
|
|
|
if (res.code == 200) { |
|
|
|
this.reasonOptions = res.result; |
|
|
|
if (item.testingInstructions && item.testingInstructions.trim() !== '') { |
|
|
|
this.reasonChecked = item.testingInstructions.split(',').map(s => s.trim()).filter(Boolean) |
|
|
|
const instructions = item.testingInstructions.split(',').map(s => s.trim()).filter(Boolean) |
|
|
|
// 分离预设理由和自定义理由 |
|
|
|
this.reasonChecked = [] |
|
|
|
this.customReason = '' |
|
|
|
|
|
|
|
instructions.forEach(instruction => { |
|
|
|
const foundOption = this.reasonOptions.find(option => option.reason === instruction) |
|
|
|
if (foundOption) { |
|
|
|
this.reasonChecked.push(instruction) |
|
|
|
} else { |
|
|
|
// 如果不在预设选项中,认为是自定义理由 |
|
|
|
this.customReason = this.customReason ? `${this.customReason},${instruction}` : instruction |
|
|
|
} |
|
|
|
}) |
|
|
|
} else { |
|
|
|
this.reasonChecked = [] |
|
|
|
this.customReason = '' |
|
|
|
} |
|
|
|
this.$nextTick(() => { |
|
|
|
this.reasonChecked = [...this.reasonChecked] |
|
|
|
console.log('[selectReasonForUnqualified] reasonOptions:', this.reasonOptions) |
|
|
|
console.log('[selectReasonForUnqualified] reasonChecked:', this.reasonChecked) |
|
|
|
console.log('[selectReasonForUnqualified] customReason:', this.customReason) |
|
|
|
}) |
|
|
|
} else { |
|
|
|
console.error('[selectReasonForUnqualified] API返回错误:', res) |
|
|
@ -490,7 +510,7 @@ export default { |
|
|
|
uni.chooseMedia({ |
|
|
|
count: 3 - this.reasonImages.length, // 剩余可选择数量 |
|
|
|
mediaType: ['image'], // 只选择图片 |
|
|
|
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机 |
|
|
|
sourceType: ['camera'], // 直接使用相机拍照 |
|
|
|
maxDuration: 30, |
|
|
|
sizeType: [ 'compressed'], |
|
|
|
camera: 'back', |
|
|
@ -560,8 +580,13 @@ export default { |
|
|
|
saveReason() { |
|
|
|
if (this.currentReasonItem) { |
|
|
|
console.log('this.currentReasonItem', this.currentReasonItem) |
|
|
|
// 合并选择的理由和自定义理由 |
|
|
|
const allReasons = [...this.reasonChecked] |
|
|
|
if (this.customReason && this.customReason.trim() !== '') { |
|
|
|
allReasons.push(this.customReason.trim()) |
|
|
|
} |
|
|
|
// 直接更新当前项 |
|
|
|
this.currentReasonItem.testingInstructions = this.reasonChecked.join(',') |
|
|
|
this.currentReasonItem.testingInstructions = allReasons.join(',') |
|
|
|
this.currentReasonItem.testingImages = this.reasonImages.join(',') |
|
|
|
} |
|
|
|
this.closeReasonPopup() |
|
|
@ -1031,6 +1056,28 @@ export default { |
|
|
|
display: block; |
|
|
|
font-weight: 500; |
|
|
|
} |
|
|
|
|
|
|
|
.custom-reason-input { |
|
|
|
width: 100%; |
|
|
|
min-height: 80px; |
|
|
|
padding: 12px; |
|
|
|
border: 1px solid #e0e0e0; |
|
|
|
border-radius: 8px; |
|
|
|
font-size: 14px; |
|
|
|
color: #222; |
|
|
|
background: #fff; |
|
|
|
resize: none; |
|
|
|
box-sizing: border-box; |
|
|
|
|
|
|
|
&::placeholder { |
|
|
|
color: #999; |
|
|
|
} |
|
|
|
|
|
|
|
&:focus { |
|
|
|
border-color: #ffb400; |
|
|
|
outline: none; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.img-list { |
|
|
|
display: flex; |
|
|
|