Commit 09aa324c by 岑成威

fix: 调整签约信息样式

1 parent a45277e7
<template> <template>
<view class="form-container formCell"> <view class="form-container formCell">
<view class="form-item flex align-center justify-between" :class="{ 'full-width': field.fullWidth, 'form-item-textarea': field.type === 'textarea' }" v-for="field in formFields" :key="field.key" @click.stop="handleCell(field)"> <view
<view class="from-label" v-if="field.type !== 'pdf'"> class="form-item flex align-center justify-between"
:class="{
'full-width': field.fullWidth,
'form-item-textarea': field.type === 'textarea',
'form-item-switchInput': field.type === 'switchInput'
}"
v-for="field in formFields"
:key="field.key"
@click.stop="handleCell(field)"
>
<view class="from-label" v-if="field.type !== 'pdf' && field.type !== 'switchInput'">
{{ field.label }} {{ field.label }}
<text class="requiredLabel" v-if="field.required || isSwitchInputRequired(field)">*</text> <text class="requiredLabel" v-if="field.required || isSwitchInputRequired(field)">*</text>
</view> </view>
<template v-if="field.type === 'input'" class="flex align-center"> <template v-if="field.type === 'input'">
<input class="formInput" :class="{ formInputDisabled: field.disabled, autolabel: field.placeholder == '自动计算' }" :min="field.min" :max="field.max" v-if="field.targetObj" :type="field.inputType || 'text'" :disabled="field.disabled" :placeholder="field.placeholder || '请输入'" :maxlength="field.maxlength || 100" v-model="formData[field.targetObj][field.targetKey]" :pattern="field.pattern || ''" @input="e => handleInput(e, field)" @blur="e => handleBlur(e, field)" /> <input class="formInput" :class="{ formInputDisabled: field.disabled, autolabel: field.placeholder == '自动计算' }" :min="field.min" :max="field.max" v-if="field.targetObj" :type="field.inputType || 'text'" :disabled="field.disabled" :placeholder="field.placeholder || '请输入'" :maxlength="field.maxlength || 100" v-model="formData[field.targetObj][field.targetKey]" :pattern="field.pattern || ''" @input="e => handleInput(e, field)" @blur="e => handleBlur(e, field)" />
<input class="formInput" :class="{ formInputDisabled: field.disabled, autolabel: field.placeholder == '自动计算' }" :min="field.min" :max="field.max" v-else type="text" :type="field.inputType || 'text'" :disabled="field.disabled" :placeholder="field.placeholder || '请输入'" v-model="formData[field.targetKey]" :maxlength="field.maxlength || 100" :pattern="field.pattern || ''" @input="e => handleInput(e, field)" @blur="e => handleBlur(e, field)" /> <input class="formInput" :class="{ formInputDisabled: field.disabled, autolabel: field.placeholder == '自动计算' }" :min="field.min" :max="field.max" v-else :type="field.inputType || 'text'" :disabled="field.disabled" :placeholder="field.placeholder || '请输入'" v-model="formData[field.targetKey]" :maxlength="field.maxlength || 100" :pattern="field.pattern || ''" @input="e => handleInput(e, field)" @blur="e => handleBlur(e, field)" />
<view v-if="field.isScan" class="flex align-center scanBtn justify-center" @click.stop="scan('vinOcr')"> <view v-if="field.isScan" class="flex align-center scanBtn justify-center" @click.stop="scan('vinOcr')">
<view class="sprite-icon icon-scanIconX"></view> <view class="sprite-icon icon-scanIconX"></view>
</view> </view>
...@@ -55,7 +65,7 @@ ...@@ -55,7 +65,7 @@
</template> </template>
<template v-if="field.type === 'radio'"> <template v-if="field.type === 'radio'">
<radio-group class="radio-group flex align-center" @change="e => radioChange(e, field)"> <radio-group class="radio-group flex align-center" @change="e => radioChange(e, field)">
<label class="uni-list-cell uni-list-cell-pd align-center flex ml-48" v-for="(item, index) in field.radioList" :key="item.value"> <label class="uni-list-cell uni-list-cell-pd align-center flex ml-48" v-for="item in field.radioList" :key="item.value">
<radio style="transform: scale(0.7)" :value="item.value" :checked="getRadioChecked(item.value, field)" /> <radio style="transform: scale(0.7)" :value="item.value" :checked="getRadioChecked(item.value, field)" />
<view class="radio-name">{{ item.name }}</view> <view class="radio-name">{{ item.name }}</view>
</label> </label>
...@@ -74,17 +84,24 @@ ...@@ -74,17 +84,24 @@
</view> </view>
</picker> </picker>
</template> </template>
<view v-if="field.type === 'switchInput'" class="switch-input-row flex align-center" @click.stop=""> <view v-if="field.type === 'switchInput'" class="switch-input" @click.stop="">
<switch :checked="Number(formData[field.switchKey]) === 1" color="#4673FF" @change="e => handleSwitchChange(e, field)" /> <view class="switch-input__header flex align-center justify-between">
<input <view class="from-label">
v-if="Number(formData[field.switchKey]) === 1" {{ field.label }}
class="formInput switch-input" <text class="requiredLabel" v-if="field.required || isSwitchInputRequired(field)">*</text>
type="text" </view>
:placeholder="field.placeholder || '请输入'" <switch :checked="Number(formData[field.switchKey]) === 1" color="#4673FF" @change="e => handleSwitchChange(e, field)" />
v-model="formData[field.remarkKey]" </view>
:maxlength="field.maxlength || 100" <view v-if="Number(formData[field.switchKey]) === 1" class="switch-input__body">
@blur="e => handleBlur(e, { ...field, targetKey: field.remarkKey })" <input
/> class="switch-input__input"
type="text"
:placeholder="field.placeholder || '请输入'"
v-model="formData[field.remarkKey]"
:maxlength="field.maxlength || 100"
@blur="e => handleBlur(e, { ...field, targetKey: field.remarkKey })"
/>
</view>
</view> </view>
<template v-if="field.type === 'textarea'"> <template v-if="field.type === 'textarea'">
<textarea v-if="field.targetObj" :placeholder="'请输入 (' + (field.maxlength || 100) + '字以内)'" v-model="formData[field.targetObj][field.targetKey]" :maxlength="field.maxlength || 100" /> <textarea v-if="field.targetObj" :placeholder="'请输入 (' + (field.maxlength || 100) + '字以内)'" v-model="formData[field.targetObj][field.targetKey]" :maxlength="field.maxlength || 100" />
...@@ -457,18 +474,48 @@ export default { ...@@ -457,18 +474,48 @@ export default {
.scanBtn { .scanBtn {
margin-left: toRpx(16); margin-left: toRpx(16);
} }
.switch-input-row { .switch-input {
flex: 1; flex: 1;
justify-content: flex-end; width: 100%;
gap: toRpx(24); display: flex;
switch { flex-direction: column;
transform: scale(0.85); align-items: stretch;
} gap: toRpx(16);
.switch-input { }
flex: 1;
min-width: toRpx(200); .switch-input__header {
max-width: toRpx(360); width: 100%;
} }
.switch-input__body {
border-radius: toRpx(16);
border: toRpx(2) solid #eff0f2;
background: #f4f5f7;
padding: toRpx(18) toRpx(24);
box-sizing: border-box;
}
.switch-input__input {
width: 100%;
height: toRpx(44);
font-size: toRpx(28);
color: #333333;
padding: 0;
text-align: left;
outline: none;
border: 0;
background: transparent;
}
switch {
transform: scale(0.85);
}
.form-item-switchInput {
flex-direction: column;
align-items: stretch;
justify-content: flex-start;
gap: toRpx(16);
} }
} }
</style> </style>
...@@ -129,7 +129,7 @@ ...@@ -129,7 +129,7 @@
</template> </template>
</view> </view>
</view> </view>
<FormCell :formFields="formFields2" :formData="formData" @handleCell="handleCell" @switchChange="handleSwitchChange" @blurChange="blurChange" /> <FormCell :formFields="formFields2Base" :formData="formData" @handleCell="handleCell" @blurChange="blurChange" />
<view class="upload-container"> <view class="upload-container">
<view class="form-item flex align-start justify-between"> <view class="form-item flex align-start justify-between">
<view class="from-label">身份证国徽面</view> <view class="from-label">身份证国徽面</view>
...@@ -184,7 +184,20 @@ ...@@ -184,7 +184,20 @@
</view> </view>
</template> </template>
</view> </view>
<view class="form-item return-summary-item" @click.stop="">
<view class="return-summary-header flex align-center justify-between">
<view class="from-label">
回单摘要
<text class="requiredLabel" v-if="Number(formData.returnSummarySwitch) === 1">*</text>
</view>
<switch :checked="Number(formData.returnSummarySwitch) === 1" color="#4673FF" @change="onReturnSummarySwitchChange" />
</view>
<view v-if="Number(formData.returnSummarySwitch) === 1" class="return-summary-body">
<input class="return-summary-input" type="text" placeholder="请输入回单摘要" v-model="formData.returnSummaryRemark" maxlength="35" @blur="onReturnSummaryBlur" />
</view>
</view>
</view> </view>
<view class="upload-container mb-24"> <view class="upload-container mb-24">
<view class="form-item flex align-center justify-between full-width"> <view class="form-item flex align-center justify-between full-width">
<view class="from-label"> <view class="from-label">
...@@ -553,7 +566,7 @@ export default { ...@@ -553,7 +566,7 @@ export default {
isLocation: true isLocation: true
} }
], ],
formFields2: [ formFields2Base: [
{ {
key: 'payeeName', key: 'payeeName',
label: '收款人姓名', label: '收款人姓名',
...@@ -594,7 +607,9 @@ export default { ...@@ -594,7 +607,9 @@ export default {
targetObj: '', targetObj: '',
type: 'input', type: 'input',
maxlength: 36 maxlength: 36
}, }
],
formFieldsReturnSummary: [
{ {
key: 'returnSummary', key: 'returnSummary',
label: '回单摘要', label: '回单摘要',
...@@ -720,6 +735,16 @@ export default { ...@@ -720,6 +735,16 @@ export default {
}, },
methods: { methods: {
getImageDisplayUrl, getImageDisplayUrl,
onReturnSummarySwitchChange(e) {
const switchValue = e.detail.value ? 1 : 0
this.$set(this.formData, 'returnSummarySwitch', switchValue)
// 复用原有联动逻辑(保存/恢复默认回单摘要)
this.handleSwitchChange(switchValue, { remarkKey: 'returnSummaryRemark' })
},
onReturnSummaryBlur(e) {
const value = e?.target?._value ?? e?.target?.value ?? ''
this.blurChange(value, { targetKey: 'returnSummaryRemark', remarkKey: 'returnSummaryRemark' })
},
init(options) { init(options) {
this.query = options this.query = options
this.formData.handoverTime = dayjs().format('YYYY-MM-DD HH:mm:00') this.formData.handoverTime = dayjs().format('YYYY-MM-DD HH:mm:00')
...@@ -1415,16 +1440,17 @@ export default { ...@@ -1415,16 +1440,17 @@ export default {
return return
} }
uni.showLoading({ title: '上传中...' }) uni.showLoading({ title: '上传中...' })
// let url = await uploadFile(null, res.tempFilePath) // let uploadUrl = await uploadFile(null, res.tempFilePath)
let uploadUrl = ''
// #ifdef H5 // #ifdef H5
let url = await uploadFile(res.tempFile, res.tempFilePath) uploadUrl = await uploadFile(res.tempFile, res.tempFilePath)
// #endif // #endif
// #ifdef APP-PLUS // #ifdef APP-PLUS
let url = await uploadFile(null, res.tempFilePath) uploadUrl = await uploadFile(null, res.tempFilePath)
// #endif // #endif
url = url + this.videoProcess uploadUrl = uploadUrl + this.videoProcess
console.log('上传视频成功', url) console.log('上传视频成功', uploadUrl)
this.$set(this.formData, field, url) this.$set(this.formData, field, uploadUrl)
uni.hideLoading() uni.hideLoading()
uni.showToast({ title: '上传成功', icon: 'success' }) uni.showToast({ title: '上传成功', icon: 'success' })
} catch (error) { } catch (error) {
...@@ -1456,16 +1482,17 @@ export default { ...@@ -1456,16 +1482,17 @@ export default {
return return
} }
uni.showLoading({ title: '上传中...' }) uni.showLoading({ title: '上传中...' })
let uploadUrl = ''
// #ifdef H5 // #ifdef H5
let url = await uploadFile(res.tempFile, res.tempFilePath) uploadUrl = await uploadFile(res.tempFile, res.tempFilePath)
// #endif // #endif
// #ifdef APP-PLUS // #ifdef APP-PLUS
let url = await uploadFile(null, res.tempFilePath) uploadUrl = await uploadFile(null, res.tempFilePath)
// #endif // #endif
url = url + this.videoProcess uploadUrl = uploadUrl + this.videoProcess
console.log('上传视频成功', url) console.log('上传视频成功', uploadUrl)
this.$set(this.formData, field, url) this.$set(this.formData, field, uploadUrl)
uni.hideLoading() uni.hideLoading()
uni.showToast({ title: '上传成功', icon: 'success' }) uni.showToast({ title: '上传成功', icon: 'success' })
} catch (error) { } catch (error) {
...@@ -1578,7 +1605,7 @@ export default { ...@@ -1578,7 +1605,7 @@ export default {
return return
} }
} }
const formFields2Required = this.formFields2.filter(field => field.required) const formFields2Required = this.formFields2Base.filter(field => field.required)
for (const field of formFields2Required) { for (const field of formFields2Required) {
const value = this.formData[field.targetKey] const value = this.formData[field.targetKey]
if (!value) { if (!value) {
...@@ -1589,7 +1616,7 @@ export default { ...@@ -1589,7 +1616,7 @@ export default {
return return
} }
} }
const returnSummaryField = this.formFields2.find(field => field.type === 'switchInput') const returnSummaryField = this.formFieldsReturnSummary.find(field => field.type === 'switchInput')
if (returnSummaryField && Number(this.formData.returnSummarySwitch) === 1) { if (returnSummaryField && Number(this.formData.returnSummarySwitch) === 1) {
const remark = typeof this.formData.returnSummaryRemark === 'string' ? this.formData.returnSummaryRemark.trim() : this.formData.returnSummaryRemark const remark = typeof this.formData.returnSummaryRemark === 'string' ? this.formData.returnSummaryRemark.trim() : this.formData.returnSummaryRemark
if (!remark) { if (!remark) {
...@@ -1994,6 +2021,46 @@ export default { ...@@ -1994,6 +2021,46 @@ export default {
height: auto; height: auto;
} }
.return-summary-item {
width: 100%;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: stretch;
gap: toRpx(16);
}
.return-summary-header {
width: 100%;
.from-label {
width: auto;
}
switch {
transform: scale(0.85);
}
}
.return-summary-body {
width: 100%;
border-radius: toRpx(16);
border: toRpx(2) solid #eff0f2;
background: #f4f5f7;
padding: toRpx(18) toRpx(24);
box-sizing: border-box;
}
.return-summary-input {
width: 100%;
height: toRpx(44);
font-size: toRpx(28);
color: #333333;
padding: 0;
text-align: left;
outline: none;
border: 0;
background: transparent;
}
.from-label { .from-label {
color: #333333; color: #333333;
font-size: toRpx(28); font-size: toRpx(28);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!