Commit 09aa324c by 岑成威

fix: 调整签约信息样式

1 parent a45277e7
<template>
<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 class="from-label" v-if="field.type !== 'pdf'">
<view
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 }}
<text class="requiredLabel" v-if="field.required || isSwitchInputRequired(field)">*</text>
</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-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 class="sprite-icon icon-scanIconX"></view>
</view>
......@@ -55,7 +65,7 @@
</template>
<template v-if="field.type === 'radio'">
<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)" />
<view class="radio-name">{{ item.name }}</view>
</label>
......@@ -74,17 +84,24 @@
</view>
</picker>
</template>
<view v-if="field.type === 'switchInput'" class="switch-input-row flex align-center" @click.stop="">
<switch :checked="Number(formData[field.switchKey]) === 1" color="#4673FF" @change="e => handleSwitchChange(e, field)" />
<input
v-if="Number(formData[field.switchKey]) === 1"
class="formInput switch-input"
type="text"
:placeholder="field.placeholder || '请输入'"
v-model="formData[field.remarkKey]"
:maxlength="field.maxlength || 100"
@blur="e => handleBlur(e, { ...field, targetKey: field.remarkKey })"
/>
<view v-if="field.type === 'switchInput'" class="switch-input" @click.stop="">
<view class="switch-input__header flex align-center justify-between">
<view class="from-label">
{{ field.label }}
<text class="requiredLabel" v-if="field.required || isSwitchInputRequired(field)">*</text>
</view>
<switch :checked="Number(formData[field.switchKey]) === 1" color="#4673FF" @change="e => handleSwitchChange(e, field)" />
</view>
<view v-if="Number(formData[field.switchKey]) === 1" class="switch-input__body">
<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>
<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" />
......@@ -457,18 +474,48 @@ export default {
.scanBtn {
margin-left: toRpx(16);
}
.switch-input-row {
.switch-input {
flex: 1;
justify-content: flex-end;
gap: toRpx(24);
switch {
transform: scale(0.85);
}
.switch-input {
flex: 1;
min-width: toRpx(200);
max-width: toRpx(360);
}
width: 100%;
display: flex;
flex-direction: column;
align-items: stretch;
gap: toRpx(16);
}
.switch-input__header {
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>
......@@ -129,7 +129,7 @@
</template>
</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="form-item flex align-start justify-between">
<view class="from-label">身份证国徽面</view>
......@@ -184,7 +184,20 @@
</view>
</template>
</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 class="upload-container mb-24">
<view class="form-item flex align-center justify-between full-width">
<view class="from-label">
......@@ -553,7 +566,7 @@ export default {
isLocation: true
}
],
formFields2: [
formFields2Base: [
{
key: 'payeeName',
label: '收款人姓名',
......@@ -594,7 +607,9 @@ export default {
targetObj: '',
type: 'input',
maxlength: 36
},
}
],
formFieldsReturnSummary: [
{
key: 'returnSummary',
label: '回单摘要',
......@@ -720,6 +735,16 @@ export default {
},
methods: {
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) {
this.query = options
this.formData.handoverTime = dayjs().format('YYYY-MM-DD HH:mm:00')
......@@ -1415,16 +1440,17 @@ export default {
return
}
uni.showLoading({ title: '上传中...' })
// let url = await uploadFile(null, res.tempFilePath)
// let uploadUrl = await uploadFile(null, res.tempFilePath)
let uploadUrl = ''
// #ifdef H5
let url = await uploadFile(res.tempFile, res.tempFilePath)
uploadUrl = await uploadFile(res.tempFile, res.tempFilePath)
// #endif
// #ifdef APP-PLUS
let url = await uploadFile(null, res.tempFilePath)
uploadUrl = await uploadFile(null, res.tempFilePath)
// #endif
url = url + this.videoProcess
console.log('上传视频成功', url)
this.$set(this.formData, field, url)
uploadUrl = uploadUrl + this.videoProcess
console.log('上传视频成功', uploadUrl)
this.$set(this.formData, field, uploadUrl)
uni.hideLoading()
uni.showToast({ title: '上传成功', icon: 'success' })
} catch (error) {
......@@ -1456,16 +1482,17 @@ export default {
return
}
uni.showLoading({ title: '上传中...' })
let uploadUrl = ''
// #ifdef H5
let url = await uploadFile(res.tempFile, res.tempFilePath)
uploadUrl = await uploadFile(res.tempFile, res.tempFilePath)
// #endif
// #ifdef APP-PLUS
let url = await uploadFile(null, res.tempFilePath)
uploadUrl = await uploadFile(null, res.tempFilePath)
// #endif
url = url + this.videoProcess
console.log('上传视频成功', url)
this.$set(this.formData, field, url)
uploadUrl = uploadUrl + this.videoProcess
console.log('上传视频成功', uploadUrl)
this.$set(this.formData, field, uploadUrl)
uni.hideLoading()
uni.showToast({ title: '上传成功', icon: 'success' })
} catch (error) {
......@@ -1578,7 +1605,7 @@ export default {
return
}
}
const formFields2Required = this.formFields2.filter(field => field.required)
const formFields2Required = this.formFields2Base.filter(field => field.required)
for (const field of formFields2Required) {
const value = this.formData[field.targetKey]
if (!value) {
......@@ -1589,7 +1616,7 @@ export default {
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) {
const remark = typeof this.formData.returnSummaryRemark === 'string' ? this.formData.returnSummaryRemark.trim() : this.formData.returnSummaryRemark
if (!remark) {
......@@ -1994,6 +2021,46 @@ export default {
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 {
color: #333333;
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!