<template>
<view :class="disabled ? 'wrapper form-disable' : 'wrapper'">
<u-form
ref="uForm"
:model="form"
:rules="rules"
error-type="toast"
label-width="auto"
label-position="left"
>
<view class="model-box">
<u-form-item
label="保单号"
prop="policyNumber"
required
borderBottom
@longpress="showHighlighPop($event, 'policyNumber')"
>
<u-input
v-model="form.policyNumber"
:color="formatterWarn(form.policyNumber, 'policyNumber')"
placeholder="请输入保单号"
maxlength="128"
border="none"
input-align="right"
></u-input>
<u-icon class="m-l-4" name="edit-pen" color="#999" size="16"></u-icon>
</u-form-item>
<u-form-item
label="保司名称"
prop="companyName"
required
borderBottom
@longpress="showHighlighPop($event, 'companyName')"
>
<view class="input-box flex-row-fe">
<u-input
v-model="form.companyName"
:color="formatterWarn(form.companyName, 'companyName')"
placeholder="请输入或选择保司名称"
@input="handleInsurerInput"
border="none"
input-align="right"
></u-input>
<u-icon
class="m-l-4"
name="edit-pen"
color="#999"
size="16"
></u-icon>
<u-icon
name="arrow-right"
color="#999"
size="14"
@click="showSearchPop('companyName', 'companyList', 'name')"
></u-icon>
</view>
</u-form-item>
<!-- 11111111111111111111111111111 -->
<u-form-item
label="地区"
prop="areaInfo"
required
borderBottom
@longpress="showHighlighPop($event, 'areaInfo')"
>
<view
class="input-box flex-row-fe"
@click="showPop('areaInfo', 'postalAddressNationCode', 'id')"
>
<view
v-html="formatterWarn(form.areaInfo_name, 'areaInfo', 'select')"
></view>
<u-icon name="arrow-right" color="#999" size="14"></u-icon>
</view>
</u-form-item>
<u-form-item
label="商户名称"
prop="merchantName"
required
borderBottom
@longpress="showHighlighPop($event, 'merchantName')"
>
<u-icon
name="error-circle"
color="#333"
size="18"
@click="showWarn('商户名称', '商户名称')"
></u-icon>
<u-input
v-model="form.merchantName"
:color="formatterWarn(form.merchantName, 'merchantName')"
placeholder="请输入商户名称"
maxlength="128"
border="none"
input-align="right"
></u-input>
<u-icon class="m-l-4" name="edit-pen" color="#999" size="16"></u-icon>
</u-form-item>
<u-form-item
label="产品分类"
prop="productTypeName"
required
borderBottom
@longpress="showHighlighPop($event, 'productTypeName')"
>
<view
class="input-box flex-row-fe"
@click="showPop('productTypeName', 'productTypeList', 'id')"
>
<view
v-html="
formatterWarn(
form.productTypeName_name,
'productTypeName',
'select'
)
"
></view>
<u-icon name="arrow-right" color="#999" size="14"></u-icon>
</view>
</u-form-item>
<u-form-item
label="投保产品名称"
prop="skuName"
required
borderBottom
@longpress="showHighlighPop($event, 'skuName')"
>
<view class="input-box flex-row-fe">
<u-input
v-model="form.skuName"
:color="formatterWarn(form.skuName, 'skuName', 'select')"
placeholder="请输入或选择产品名称"
border="none"
input-align="right"
></u-input>
<u-icon
class="m-l-4"
name="edit-pen"
color="#999"
size="16"
></u-icon>
<u-icon
name="arrow-right"
color="#999"
size="14"
@click="showPop('skuName', 'skuList', 'id')"
></u-icon>
</view>
</u-form-item>
<view
style="
background-color: rgba(244, 245, 247, 1);
width: 100%;
padding-left: 26rpx;
"
>
<u-form-item
label="每期保费"
prop="instalmentPremium"
required
borderBottom
@longpress="showHighlighPop($event, 'instalmentPremium')"
>
<!-- 显示时用格式化后的值,输入时处理为原始值 -->
<u-input
:value="formatNumber(form.instalmentPremium)"
@input="handleInput($event, 'instalmentPremium')"
:color="
formatterWarn(form.instalmentPremium, 'instalmentPremium')
"
placeholder="请输入"
maxlength="128"
border="none"
input-align="right"
></u-input>
<u-icon
class="m-l-4"
name="edit-pen"
color="#999"
size="16"
></u-icon>
</u-form-item>
<u-form-item
label="保费单位"
prop="currency"
required
borderBottom
@longpress="showHighlighPop($event, 'currency')"
>
<view
class="input-box flex-row-fe"
@click="showPop('currency', 'currencyList', 'id')"
>
<view
v-html="formatterWarn(form.currency, 'currency', 'select')"
></view>
<u-icon name="arrow-right" color="#999" size="14"></u-icon>
</view>
</u-form-item>
<u-form-item
label="保额"
prop="coverageMoney"
borderBottom
@longpress="showHighlighPop($event, 'coverageMoney')"
>
<u-input
:value="formatNumber(form.coverageMoney)"
@input="handleInput($event, 'coverageMoney')"
:color="formatterWarn(form.coverageMoney, 'coverageMoney')"
placeholder="请输入"
maxlength="128"
border="none"
input-align="right"
></u-input>
<u-icon
class="m-l-4"
name="edit-pen"
color="#999"
size="16"
></u-icon>
</u-form-item>
<u-form-item
label="缴费期"
prop="paymentNum"
required
borderBottom
@longpress="showHighlighPop($event, 'paymentNum')"
>
<view class="section">
<view
class="options"
v-for="(item, index) in payment.options"
:key="index"
>
<radio
:checked="form.paymentNumRadio == index"
@click="selectOption(payment, index, 'paymentNum')"
/>
<text>{{ item.label }}</text>
<!-- 仅当“交X年”或“交至X岁”选中时,显示输入框 -->
<u-input
v-model="form.paymentNum"
v-show="form.paymentNumRadio == index"
:color="formatterWarn(form.paymentNum, 'paymentNum')"
@input="inputChange($event, 'paymentNum')"
type="number"
placeholder="请输入"
maxlength="128"
border="none"
input-align="right"
></u-input>
<u-icon
class="m-l-4"
name="edit-pen"
color="#999"
size="16"
v-show="
item.type !== 'lifetime' && form.paymentNumRadio == index
"
></u-icon>
<text
v-show="form.paymentNumRadio == index && item.type === 'year'"
>年</text
>
<text
v-show="item.type === 'age' && form.paymentNumRadio == index"
>岁</text
>
</view>
</view>
</u-form-item>
<u-form-item
label="缴费频率"
prop="paymentFrequency"
required
borderBottom
@longpress="showHighlighPop($event, 'paymentFrequency')"
>
<view
class="input-box flex-row-fe"
@click="showPop('paymentFrequency', 'paymentFrequency', 'id')"
>
<view
v-html="
formatterWarn(
form.paymentFrequency_name,
'paymentFrequency',
'select'
)
"
></view>
<u-icon name="arrow-right" color="#999" size="14"></u-icon>
</view>
</u-form-item>
<u-form-item
label="保障期"
prop="guaranteeNum"
required
borderBottom
@longpress="showHighlighPop($event, 'guaranteeNum')"
>
<view class="section">
<view
class="options"
v-for="(item, index) in coverage.options"
:key="index"
>
<radio
:checked="form.guaranteeNumRadio == index"
@click="selectOption(coverage, index, 'guaranteeNum')"
/>
<text>{{ item.label }}</text>
<u-input
v-model="form.guaranteeNum"
v-show="form.guaranteeNumRadio == index"
:color="formatterWarn(form.guaranteeNum, 'guaranteeNum')"
type="number"
placeholder="请输入"
maxlength="128"
@input="inputChange($event, 'guaranteeNum')"
border="none"
input-align="right"
></u-input>
<u-icon
class="m-l-4"
name="edit-pen"
color="#999"
size="16"
v-show="
item.type !== 'lifetime' && form.guaranteeNumRadio == index
"
></u-icon>
<text
v-show="
form.guaranteeNumRadio == index && item.type === 'year'
"
>年</text
>
<text
v-show="
form.guaranteeNumRadio == index && item.type === 'age'
"
>岁</text
>
</view>
</view>
</u-form-item>
</view>
<u-form-item
label="是否预缴"
prop="prepayStatus"
required
borderBottom
@longpress="showHighlighPop($event, 'prepayStatus')"
>
<view
class="input-box flex-row-fe"
@click="showPop('prepayStatus', 'prepayStatus', 'id')"
>
<view
v-html="
formatterWarn(form.prepayStatus_name, 'prepayStatus', 'select')
"
></view>
<u-icon name="arrow-right" color="#999" size="14"></u-icon>
</view>
</u-form-item>
<view
style="
background-color: rgba(244, 245, 247, 1);
width: 100%;
padding-left: 26rpx;
"
v-if="form.prepayStatus == '1'"
>
<u-form-item
label="预缴金额"
prop="prepayMoney"
required
borderBottom
@longpress="showHighlighPop($event, 'prepayMoney')"
>
<u-input
:value="formatNumber(form.prepayMoney)"
@input="handleInput($event, 'prepayMoney')"
:color="formatterWarn(form.prepayMoney, 'prepayMoney')"
placeholder="请输入"
maxlength="128"
border="none"
input-align="right"
></u-input>
<u-icon
class="m-l-4"
name="edit-pen"
color="#999"
size="16"
></u-icon>
</u-form-item>
<u-form-item
label="预缴期数"
prop="prepayYear"
required
borderBottom
@longpress="showHighlighPop($event, 'prepayYear')"
>
<u-input
v-model="form.prepayYear"
:color="formatterWarn(form.prepayYear, 'prepayYear')"
placeholder="请输入"
maxlength="128"
@input="inputChange($event, 'prepayYear')"
border="none"
input-align="right"
></u-input>
<u-icon
class="m-l-4"
name="edit-pen"
color="#999"
size="16"
></u-icon>
</u-form-item>
</view>
<u-form-item
label="是否有附加险"
prop="additionFlag"
required
borderBottom
@longpress="showHighlighPop($event, 'additionFlag')"
>
<view
class="input-box flex-row-fe"
@click="showPop('additionFlag', 'additionFlag', 'id')"
>
<view
v-html="
formatterWarn(form.additionFlag_name, 'additionFlag', 'select')
"
></view>
<u-icon name="arrow-right" color="#999" size="14"></u-icon>
</view>
</u-form-item>
<view
style="
background-color: rgba(244, 245, 247, 1);
width: 100%;
padding-left: 26rpx;
"
v-if="form.additionFlag == '1'"
>
<u-form-item
label="附加险名称"
prop="additionSkuInfo"
required
borderBottom
@longpress="showHighlighPop($event, 'additionSkuInfo')"
>
<u-input
v-model="form.additionSkuInfo"
:color="formatterWarn(form.additionSkuInfo, 'additionSkuInfo')"
placeholder="请输入"
maxlength="128"
border="none"
input-align="right"
></u-input>
<u-icon
class="m-l-4"
name="edit-pen"
color="#999"
size="16"
></u-icon>
</u-form-item>
</view>
</view>
</u-form>
<view class="tabbar flex-row-sb safe_bottom">
<u-button
color="#2F288F"
plain
text="暂存"
@click="submit('Staging')"
style="width: 250rpx"
></u-button>
<u-button
color="#2F288F"
text="确定"
style="width: 250rpx"
@click="submit('save')"
></u-button>
</view>
<!-- 选择弹窗start -->
<view class="popup-wrap">
<u-picker
:show="areaCodeshow"
:columns="[columns.areaCodeColumns]"
confirmColor="#2F288F"
@cancel="areaCodeshow = false"
@confirm="areaCodeConfirm"
></u-picker>
<u-picker
:show="popObj.show"
:columns="[popObj.selectColumns]"
:defaultIndex="[0]"
confirmColor="#2F288F"
keyName="name"
closeOnClickOverlay
@confirm="onPickerConfirm"
@close="popObj.show = false"
@cancel="popObj.show = false"
></u-picker>
<u-datetime-picker
:show="timePopObj.show"
confirmColor="#2F288F"
mode="date"
:value="timePopObj.defaultDate"
:minDate="timePopObj.minDate"
:maxDate="timePopObj.maxDate"
closeOnClickOverlay
@close="timePopObj.show = false"
@cancel="timePopObj.show = false"
@confirm="confirmTime"
></u-datetime-picker>
<!-- 搜索选择器 -->
<u-picker-search
:key="searchPickerKey"
:show="popObjSearch.show"
:columns="[popObjSearch.selectColumns]"
:defaultIndex="[0]"
confirmColor="#2F288F"
keyName="name"
closeOnClickOverlay
@confirm="onPickerSearchConfirm"
@close="onPickerSearchClose"
@cancel="onPickerSearchClose"
></u-picker-search>
</view>
</view>
</template>
<script>
import dayjs from "@/uni_modules/uview-ui/libs/util/dayjs.js";
import { POLICYBASICINFOCHECK } from "@/config/checkRules";
import { DICTS } from "@/config/dictionary";
import {
getUuid,
formatDictName,
isEmpty,
goBackByLocalKey,
getBirthDayByIdCard,
geSexByIdCard,
Validator,
} from "@/config/utils";
const columns = DICTS;
export default {
components: {},
data() {
return {
searchPickerKey: 0,
payment: {
options: [
{ label: "交", type: "year", isChecked: false, inputVal: "" },
{ label: "交至", type: "age", isChecked: false, inputVal: "" },
{ label: "终身", type: "lifetime", isChecked: true, inputVal: "" },
],
},
// 保障期配置(结构同缴费期)
coverage: {
options: [
{ label: "保", type: "year", isChecked: false, inputVal: "" },
{ label: "保至", type: "age", isChecked: false, inputVal: "" },
{ label: "终身", type: "lifetime", isChecked: true, inputVal: "" },
],
},
quicklySelectCustomerModel: false,
columns,
disabled: false,
formType: "baseInfo",
form: {
dependentsInfo: [],
guaranteeNumRadio: "2",
paymentNumRadio: "2",
instalmentPremium: "",
},
rules: {},
popObj: {
show: false,
formKey: "",
selectColumns: [],
valueWay: "",
},
// 搜索选择器状态对象
popObjSearch: {
show: false,
formKey: "",
selectColumns: [],
valueWay: "",
},
timePopObj: {
show: false,
minDate: dayjs().subtract(100, "year").valueOf(),
maxDate: dayjs().valueOf(),
defaultDate: dayjs().subtract(20, "year").valueOf(),
},
highlighObj: {
show: false,
key: "",
value: false,
style: {},
},
initPolicyCustodyInfos: {
companyList: [],
currencyList: [],
productTypeList: [],
skuList: [],
},
highlightTabList: [],
updateTabList: [],
isNew: true,
areaCodeshow: false,
idCardPopObj: {
show: false,
mode: "idCard",
formKey: "",
valueWay: "",
clickY: 0,
},
localKey: "",
hasSameBtn: false,
showOcrForm: false,
preOcrFormKey: null,
multipleIDs: false,
customerId: "",
certificateIDModel: false,
certificateParams: {},
};
},
watch: {
form: {
handler(newVal, oldVal) {
let vm = this;
var tempData = uni.getStorageSync(vm.localKey);
let { ...restFrom } = vm.form;
tempData.baseInfo = restFrom;
tempData.baseInfoDetail = restFrom;
tempData.baseInfoHasRead = true;
uni.setStorage({
key: vm.localKey,
data: tempData,
});
},
deep: true,
},
},
async onLoad(opt) {
this.formType = opt.type;
this.disabled = JSON.parse(opt.disabled || "false");
this.isNew = JSON.parse(opt.isNew || "true");
this.highlightTabList = JSON.parse(opt.highlightTabList || "[]");
this.updateTabList = JSON.parse(opt.updateTabList || "[]");
this.localKey = opt.localKey;
var localFormData = uni.getStorageSync(opt.localKey);
this.form = localFormData.baseInfo;
console.log("onload", localFormData.baseInfo);
this.initPolicyCustody();
uni.setNavigationBarTitle({
title: "保单基础信息",
});
},
onUnload() {
// uni.$emit("highlightTabList", this.highlightTabList);
},
methods: {
// 处理保司名称输入事件
handleInsurerInput() {
const inputVal = this.form.companyName.trim().toLowerCase();
if (!inputVal) {
// 清空搜索时恢复完整列表
this.popObjSearch.selectColumns =
this.initPolicyCustodyInfos.companyList;
return;
}
// 过滤匹配项
const filtered = this.initPolicyCustodyInfos.companyList.filter((item) =>
item.name.toLowerCase().includes(inputVal)
);
// 更新搜索弹窗的选项
if (
this.popObjSearch.show &&
this.popObjSearch.formKey === "companyName"
) {
this.popObjSearch.selectColumns = filtered;
}
},
deepClone(source) {
if (source === null || typeof source !== 'object') {
return source;
}
if (Array.isArray(source)) {
return source.map(item => this.deepClone(item));
}
const clone = {};
for (const key in source) {
if (source.hasOwnProperty(key)) {
clone[key] = this.deepClone(source[key]);
}
}
return clone;
},
onPickerSearchClose() {
this.popObjSearch.show = false;
},
// 显示带搜索的选择器
showSearchPop(formKey, selectColumnsKey, valueWay) {
// 递增key值强制重置组件
this.searchPickerKey++;
// 获取完整数据源(深拷贝)
let selectColumns = [];
if (
selectColumnsKey == "companyList" ||
selectColumnsKey == "currencyList" ||
selectColumnsKey == "productTypeList" ||
selectColumnsKey == "skuList"
) {
// 使用深拷贝方法创建新数组
selectColumns = this.deepClone(this.initPolicyCustodyInfos[selectColumnsKey] || []);
} else {
// 使用深拷贝方法创建新数组
selectColumns = this.deepClone(columns[selectColumnsKey] || []);
}
// 重置搜索选择器状态
this.popObjSearch = {
show: true,
formKey,
selectColumns,
valueWay
};
},
// 搜索选择器确认事件
onPickerSearchConfirm(e) {
let vm = this;
this.$set(
this.form,
vm.popObjSearch.formKey,
e.value[0][vm.popObjSearch.valueWay]
);
// 同步显示名称
if (vm.popObjSearch.formKey === "companyName") {
this.$set(this.form, "companyName", e.value[0].name);
}
this.popObjSearch.show = false;
},
formatNumber(value) {
if (!value) return "";
// 先转为数字,再处理千分位
const num = Number(value);
if (isNaN(num)) return value; // 非数字保持原样
return num.toLocaleString("zh-CN"); // 千分位格式化
},
// 处理输入,将千分位字符串还原为原始值(纯数字)
handleInput(val, key) {
// 去除所有非数字字符(保留负号和小数点,根据需求调整)
const rawValue = val.replace(/[^\d.-]/g, "");
// 更新原始值(纯数字)
this.form[key] = rawValue;
},
selectOption(group, index, type) {
group.options.forEach((item, i) => {
item.isChecked = i === index;
});
if (type == "paymentNum") {
this.form.paymentNumRadio = index;
} else if ((type = "guaranteeNum")) {
this.form.guaranteeNumRadio = index;
}
},
// 输入框值绑定
inputChange(event, type) {
const currentValue = event;
this.validateNumber(currentValue, type);
},
// 通用校验函数
validateNumber(value, type) {
if (value === "") {
return { valid: true, message: "", suggestedValue: null };
}
// 检查是否为有效数字
if (!/^\d+$/.test(value)) {
return { valid: false, message: "只能输入数字", suggestedValue: null };
}
const num = parseInt(value, 10);
// 检查是否在范围内
if ((num < 1 || num > 100) && type == "prepayYear") {
uni.$u.toast("数值应该在1-100");
}
if ((num < 1 || num > 200) && type != "prepayYear") {
uni.$u.toast("数值应该在1-200");
}
},
async initPolicyCustody() {
const { data } = await uni.$u.http.get("/app/policyCustody/dict");
this.initPolicyCustodyInfos = data;
if (this.initPolicyCustodyInfos) {
// 确保所有列表都是对象数组格式
this.initPolicyCustodyInfos.companyList = (
this.initPolicyCustodyInfos.companyList || []
).map((company) => ({
id: company,
name: company,
}));
this.initPolicyCustodyInfos.currencyList = (
this.initPolicyCustodyInfos.currencyList || []
).map((company) => ({
id: company,
name: company,
}));
this.initPolicyCustodyInfos.productTypeList = (
this.initPolicyCustodyInfos.productTypeList || []
).map((company) => ({
id: company,
name: company,
}));
this.initPolicyCustodyInfos.skuList = (
this.initPolicyCustodyInfos.skuList || []
).map((company) => ({
id: company,
name: company,
}));
}
console.log("初始化保单托管数据:", this.initPolicyCustodyInfos);
},
// 弹出弹窗
showPop(formKey, selectColumnsKey, valueWay) {
let selectColumns = "";
if (
selectColumnsKey == "companyList" ||
selectColumnsKey == "currencyList" ||
selectColumnsKey == "productTypeList" ||
selectColumnsKey == "skuList"
) {
selectColumns = this.initPolicyCustodyInfos[selectColumnsKey];
} else {
selectColumns = columns[selectColumnsKey];
}
this.popObj = {
show: true,
formKey,
selectColumns,
valueWay,
};
},
formatDictName,
handleComputeInsure(simple) {
let { form } = this;
var validator = new Validator();
form.multipleIDs = true;
var insureRules = POLICYBASICINFOCHECK(form, simple);
insureRules.forEach((ele) => {
var currentValue = _.get(form, ele.key);
var currentRuleList = [
{
strategy: "isNonEmpty",
errorMsg: `【保单基础信息】${ele.name}不能为空`,
},
];
if (ele.rules) {
for (var i = 0; i < ele.rules.length; i++) {
var validateFuncRes = ele.rules[i].func(currentValue);
currentRuleList.push({
strategy: "customerFunc",
func: () => validateFuncRes == true,
errorMsg: `${ele.rules[i].errorMsg}`,
});
}
}
validator.add(currentValue, currentRuleList);
});
console.log("insureRules", insureRules);
var errorList = _.uniq(validator.checkAll());
return errorList;
},
// 弹出提示框
showWarn(title, content) {
uni.showModal({
title,
content,
showCancel: false,
});
},
// 确认选择
onPickerConfirm(e) {
let vm = this;
this.$set(this.form, vm.popObj.formKey, e.value[0][this.popObj.valueWay]);
this.$set(this.form, `${vm.popObj.formKey}_name`, e.value[0].name);
this.popObj.show = false;
},
// 确认时间
confirmTime(e) {
let vm = this;
this.$set(
this.form,
"birthDate",
uni.$u.timeFormat(e.value, "yyyy-mm-dd")
);
this.$set(this.form, "age", vm.calculateAge(this.form.birthDate));
this.timePopObj.show = false;
},
// 计算年龄
calculateAge(birthDate) {
var birthDate = new Date(birthDate);
var today = new Date();
var age = today.getFullYear() - birthDate.getFullYear();
var m = today.getMonth() - birthDate.getMonth();
if (m < 0 || (m === 0 && today.getDate() < birthDate.getDate())) {
age--;
}
return age;
},
areaCodeConfirm(e) {
this.$set(this.form, "phoneAreaCode", e.value[0].id);
this.$set(this.form, "phoneArea", e.value[0].text);
this.areaCodeshow = false;
},
// 将key转化为文字
keyIntoText() {
let otherKeys = [
"observerCardType",
"relationStatus",
"gender",
"maritalStatus",
"certificateType",
"schooling",
"title",
"numberDependents",
"employmentType",
"industryCode",
"retireAge",
"entryHkCardType",
];
otherKeys.forEach((item) => {
if (isEmpty(this.form[item])) {
return false;
}
console.log("columns[item]", columns, item);
let res = columns[item].find(
(item_son) => item_son.id == this.form[item]
);
this.form[`${item}_name`] = res ? res.name : "";
});
console.log(this.form);
},
// 提交
async submit(flag) {
let { localKey, multipleIDs, form } = this;
if (flag != "Staging") {
let errorList = this.handleComputeInsure(true, flag);
if (errorList.length > 0) {
return uni.$u.toast(errorList[0]);
}
}
uni.$emit("baseInfo");
var path = "pages/policy/index";
goBackByLocalKey(localKey, path);
},
// 弹出高亮
showHighlighPop(e, key) {
if (this.isNew) {
return false;
}
this.highlighObj = {
show: true,
key,
value:
this.highlightTabList.findIndex(
(item) => item === `${this.formType}.${key}`
) !== -1,
style: {
top: e.currentTarget.offsetTop + "px",
},
};
},
// 设置高亮
async setHighlight() {
await uni.$u.http.post("/app/subscribeOrder/scalarData", {
fieldName: `${this.formType}.${this.highlighObj.key}`,
orderId: this.form.orderId,
});
this.highlightTabList.push(`${this.formType}.${this.highlighObj.key}`);
this.highlighObj.show = false;
},
// 取消高亮
async cancelHighlight() {
await uni.$u.http.post("/app/subscribeOrder/cancelScalarData", {
fieldName: `${this.formType}.${this.highlighObj.key}`,
orderId: this.form.orderId,
});
let index = this.highlightTabList.findIndex(
(item) => item === `${this.formType}.${this.highlighObj.key}`
);
if (index !== -1) {
this.$delete(this.highlightTabList, index);
}
this.highlighObj.show = false;
},
// 高亮提示处理函数
formatterWarn(text, keyName, type = "input") {
const key = `${this.formType}.${keyName}`;
const keyDetail = `${this.formType}Detail.${keyName}`;
let highlighFlag =
this.highlightTabList.findIndex(
(item) => item === key || item === keyDetail
) !== -1;
let updateFlag =
this.updateTabList.findIndex(
(item) => item === key || item === keyDetail
) !== -1;
let waitFlag = text === "待确认";
if (type === "input") {
// 输入框返回颜色
return updateFlag
? "#FF3141"
: waitFlag || highlighFlag
? "#FF7700"
: "#333333";
} else {
// 上拉选择返回富文本
return `<text class="${
updateFlag ? "cff3" : waitFlag || highlighFlag ? "cff7" : "c333"
}">${isEmpty(text) ? "" : text}</text>`;
}
},
handleSetSamePalce() {
this.hasSameBtn = !this.hasSameBtn;
if (this.hasSameBtn) {
this.form.postalAddress = this.form.residentialAddress;
}
},
handleResidentialAddressChange() {
if (this.hasSameBtn) {
this.form.postalAddress = this.form.residentialAddress;
}
},
},
};
</script>
<style lang="scss" scoped>
.wrapper {
position: relative;
}
.model-box {
margin: 20upx;
background-color: white;
padding: 0 32upx 16upx;
margin-bottom: 200upx;
border-radius: 5upx;
.model-box-title {
font-size: 30upx;
font-weight: bold;
padding: 20upx 0;
border-bottom: 1upx solid rgb(214, 215, 217);
}
.input-box {
flex-grow: 1;
}
.sameBtn {
display: flex;
align-items: center;
align-content: center;
}
.square {
margin: 0 2rpx;
width: 24px;
height: 24px;
border: 1px solid #d6d7d9;
}
.memberCountItem {
padding: 20upx;
border-radius: 10upx;
background: #f4f6f9;
margin-bottom: 10upx;
}
}
.model-box-son {
border-bottom: 20upx solid #f4f6f9;
}
.highlight-pop {
position: absolute;
left: 0;
top: 0;
bottom: 0;
right: 0;
z-index: 10;
.pop-content {
position: absolute;
right: 40upx;
top: 0;
background-color: #333333;
border-radius: 10upx;
transform: translateY(-100%);
&::after {
content: "";
display: block;
position: absolute;
right: 16upx;
bottom: -8upx;
width: 16upx;
height: 16upx;
background-color: #333333;
transform: rotate(45deg);
}
.item {
padding: 10upx 16upx;
font-size: 20upx;
.circle {
width: 20upx;
height: 20upx;
border-radius: 50%;
margin: 0 auto 10upx;
background-color: white;
}
}
.active {
.circle {
background-color: #ff7700;
}
}
}
}
.tabbar {
height: 146upx;
position: fixed;
z-index: 999;
left: 0;
right: 0;
bottom: 0;
background-color: white;
padding: 0 30upx;
box-sizing: content-box;
border-top: 1px solid #f4f6f9;
}
.tabbar-placeholder {
box-sizing: content-box;
height: 146upx;
}
.ocrPic {
width: 57upx;
height: 45upx;
}
.multipleIDsItem {
position: relative;
padding: 0 36rpx;
background: #f5f6fa;
border: 1rpx solid #2f288f;
margin-bottom: 10rpx;
border-radius: 10rpx;
&:first-of-type {
background: #fff;
border: none;
}
.removeBtn {
position: absolute;
right: -12rpx;
top: -12rpx;
}
}
.select-customer-btn {
padding: 14rpx 16rpx;
border-radius: 8rpx;
border: 1rpx solid #2f288f;
color: #2f288f;
font-size: 28rpx;
}
.multipleIDsBtn {
pointer-events: all;
display: flex;
justify-content: center;
align-content: center;
align-items: center;
white-space: nowrap;
width: 48rpx;
height: 48rpx;
margin-left: 10rpx;
border: 1rpx solid #2f288f;
color: #2f288f;
font-size: 40rpx;
line-height: 50rpx;
border-radius: 10rpx;
}
.title {
font-weight: bold;
margin-bottom: 10rpx;
}
.options {
display: flex;
align-items: center;
margin-bottom: 10rpx;
}
::v-deep uni-radio .uni-radio-input {
-webkit-appearance: none;
appearance: none;
margin-right: 5px;
outline: 0;
border: 1px solid #d1d1d1;
background-color: #fff;
border-radius: 50%;
width: 30rpx;
height: 30rpx;
position: relative;
}
::v-deep .uni-radio-input-checked {
background: #2f288f !important;
border: 1px solid #2f288f !important;
}
</style>
同理把产品分类的下拉框里也加个搜索的弹框
最新发布