Commit d02c6104 by liimin

feat: 新增组件并优化现有功能

refactor(HomeFrame): 重构布局和动画性能
feat(ResultSelect): 新增接待结果选择组件
feat(CustomerTypeRadio): 新增客户类型单选组件
feat(ResultList): 新增结果列表组件
style(ButtonGroup): 优化按钮组样式和交互
perf(RecordList): 优化记录列表性能和数据格式化
refactor(FinishStep): 使用新组件重构完成步骤
perf(equity/detail): 优化滑动切换和渲染性能
refactor(equity/index): 优化数据获取和状态管理
refactor(saveRecord): 重构表单布局和验证逻辑
1 parent e01037b1
<template> <template>
<view class="button-group"> <view class="button-group">
<view <template v-for="(item, index) in selectList">
v-for="(item, index) in selectList" <view
:key="index" :key="index"
class="button-item" class="button-item"
:class="{ active: index === selectIndex }" :class="{ active: index === selectIndex }"
@click="chooseType(index, item)" @click="chooseType(index, item)"
:style="{ width: itemWidth + 'rpx', marginRight: index === selectList.length - 1 ? 0 : gap + 'rpx' }" :style="{ width: itemWidth + 'rpx' }"
> >
<text class="label">{{ item[labelKey] }}</text> <text class="label">{{ item[labelKey] }}</text>
<!-- 选中时的背景动画元素 --> <template v-if="item.dot && item.dot()">
<view class="active-bg" v-if="index === selectIndex"></view> <view class="dot"></view>
</view> </template>
<!-- 选中时的背景动画元素 -->
<view class="active-bg" v-if="index === selectIndex"></view>
</view>
<view class="divider" v-if="index < selectList.length - 1" :key="'divider-' + index"></view>
</template>
</view> </view>
</template> </template>
...@@ -30,8 +35,7 @@ export default { ...@@ -30,8 +35,7 @@ export default {
data() { data() {
return { return {
selectIndex: 0, selectIndex: 0,
itemWidth: 104, // 按钮固定宽度 itemWidth: 140, // 按钮固定宽度
gap: 16 // 按钮间距
} }
}, },
methods: { methods: {
...@@ -76,6 +80,17 @@ export default { ...@@ -76,6 +80,17 @@ export default {
z-index: 2; /* 文字在最上层 */ z-index: 2; /* 文字在最上层 */
} }
.dot {
position: absolute;
top: toRpx(8);
right: toRpx(16);
width: toRpx(12);
height: toRpx(12);
border-radius: 100%;
background: #f24724;
z-index: 3;
}
/* 激活状态的背景层 */ /* 激活状态的背景层 */
.active-bg { .active-bg {
position: absolute; position: absolute;
...@@ -95,6 +110,13 @@ export default { ...@@ -95,6 +110,13 @@ export default {
box-shadow: 0 toRpx(2) toRpx(8) rgba(55, 115, 248, 0.15); box-shadow: 0 toRpx(2) toRpx(8) rgba(55, 115, 248, 0.15);
} }
} }
.divider {
width: 1px;
height: toRpx(32);
background: #ebedf0;
margin: 0 toRpx(12);
}
} }
@keyframes pulse-fade { @keyframes pulse-fade {
......
<template>
<radio-group @change="handleChange" class="radio-group">
<template v-for="(item, index) in items">
<label class="radio" :key="index">
<radio :value="item.value" :checked="value == item.value" />
{{ item.label }}
</label>
</template>
</radio-group>
</template>
<script>
export default {
name: "CustomerTypeRadio",
props: {
value: {
type: [String, Number],
default: ''
},
items: {
type: Array,
default: () => [
{
label: "VIP",
value: 'VIP'
},
{
label: "潜客",
value: '潜客'
},
{
label: "普通",
value: '普通'
}
]
}
},
methods: {
handleChange(e) {
this.$emit('input', e.detail.value);
this.$emit('change', e);
}
}
}
</script>
<style scoped lang="scss">
.radio-group {
display: flex;
align-items: center;
height: 100%;
.radio {
display: flex;
align-items: center;
margin-right: toRpx(30);
}
}
</style>
...@@ -16,14 +16,7 @@ ...@@ -16,14 +16,7 @@
<input :type="i.inputType" :maxlength="i.maxlength" v-model="formData[i.key]" class="input" :placeholder="i.placeholder" :disabled="customerType == 0" @input="inputCustomer" placeholder-style="color:#c9c9c9;" /> <input :type="i.inputType" :maxlength="i.maxlength" v-model="formData[i.key]" class="input" :placeholder="i.placeholder" :disabled="customerType == 0" @input="inputCustomer" placeholder-style="color:#c9c9c9;" />
</template> </template>
<template v-else-if="i.type == 'radio'"> <template v-else-if="i.type == 'radio'">
<radio-group @change="radioChange"> <CustomerTypeRadio :value="formData[i.key]" @change="radioChange" />
<template v-for="(item, index) in i.items">
<label class="radio" :key="index">
<radio :value="item.value" :checked="formData[i.key] == item.value" />
{{ item.label }}
</label>
</template>
</radio-group>
</template> </template>
<!-- <template v-else> <!-- <template v-else>
<view <view
...@@ -46,14 +39,7 @@ ...@@ -46,14 +39,7 @@
</template> </template>
<template v-else> <template v-else>
<view class="pop-tips">请完善本次接待结果</view> <view class="pop-tips">请完善本次接待结果</view>
<view class="choose-box"> <ResultList :list="resultList" :value="receptionStatus" @change="chooseResult" />
<template v-for="(i, index) in resultList">
<view :class="['choose-item', `${i.status == receptionStatus ? (i.status == 1 ? 'success' : 'error') : ''}`]" :key="index" @click="chooseResult(i.status)">
<view :class="['sprite-icon', `icon-face-${i.status == receptionStatus ? `${i.icon}-active` : i.icon}`]"></view>
{{ i.text }}
</view>
</template>
</view>
</template> </template>
</view> </view>
</MessageBox> </MessageBox>
...@@ -65,9 +51,15 @@ ...@@ -65,9 +51,15 @@
<script type="text/ecmascript-6"> <script type="text/ecmascript-6">
import { mapMutations } from "vuex"; import { mapMutations } from "vuex";
import ResultList from '@/components/ResultList.vue'
import CustomerTypeRadio from '@/components/CustomerTypeRadio.vue'
const phoneRex = /^[1]([2-9])[0-9]{9}$/; const phoneRex = /^[1]([2-9])[0-9]{9}$/;
export default { export default {
name: 'FinishStep', name: 'FinishStep',
components: {
ResultList,
CustomerTypeRadio
},
props: { props: {
sceneType: { sceneType: {
type: Number, type: Number,
...@@ -105,20 +97,6 @@ export default { ...@@ -105,20 +97,6 @@ export default {
label: "客户类型", label: "客户类型",
key: "customerType", key: "customerType",
type: "radio", type: "radio",
items: [
{
label: "VIP",
value: 'VIP'
},
{
label: "潜客",
value: '潜客'
},
{
label: "普通",
value: '普通'
}
],
placeholder: '请输入客户类型', placeholder: '请输入客户类型',
required: true required: true
}, },
...@@ -407,30 +385,4 @@ export default { ...@@ -407,30 +385,4 @@ export default {
} }
} }
} }
.choose-box {
display: flex;
flex-direction: column;
align-items: center;
.choose-item {
width: 100%;
height: toRpx(128);
border: toRpx(2) solid #e8e8e8;
border-radius: toRpx(16);
display: flex;
align-items: center;
justify-content: center;
margin-top: toRpx(24);
.sprite-icon {
margin-right: toRpx(16);
}
}
.success {
background: #14cc681a;
border-color: #14cc681a;
}
.error {
background: #f247241a;
border-color: #f247241a;
}
}
</style> </style>
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<view class="module-box box-class"> <view class="module-box box-class">
<view class="common-title"> <view class="common-title">
<text class="title-text"> <text class="title-text">
<text class="highlight-type">{{ currentType.typeName }}</text> <text class="highlight-type" @click="changeType">{{ currentType.typeName }}</text>
产品介绍 产品介绍
</text> </text>
<view class="switch-btn flex" @click="changeType"> <view class="switch-btn flex" @click="changeType">
......
...@@ -122,7 +122,7 @@ export default { ...@@ -122,7 +122,7 @@ export default {
]), ]),
uploadTypeList: Object.freeze([ uploadTypeList: Object.freeze([
{ label: '待上传' }, { label: '待上传' },
{ label: '待提交' }, { label: '待提交', dot: () => this.preRecordFailList.length },
]), ]),
itemObject: Object.freeze([ itemObject: Object.freeze([
// { label: '接待结果', key: 'result' }, // { label: '接待结果', key: 'result' },
...@@ -194,6 +194,7 @@ export default { ...@@ -194,6 +194,7 @@ export default {
item = { item = {
"id": null, "id": null,
"merchantId": "44210895", "merchantId": "44210895",
customerType: 'VIP',
"customerName": "1211第五", "customerName": "1211第五",
"phoneNumber": "13512110555", "phoneNumber": "13512110555",
"salesUuid": "77936e318e9844e4af0b099c7ccc98e4", "salesUuid": "77936e318e9844e4af0b099c7ccc98e4",
...@@ -287,11 +288,18 @@ export default { ...@@ -287,11 +288,18 @@ export default {
}, },
async getPreRecordNum () { async getPreRecordNum () {
const preRecordList = await this.recorder.getRecords() const preRecordList = await this.recorder.getRecords()
this.preRecordFailList = preRecordList this.preRecordFailList =this.formatRecordList(preRecordList)
//[{
// result: '',
// customerPhone: '',
// customerType: 'VIP',
// customerName: '',
// carType: '',
// startTime: '',
// endTime: '' }]
}, },
getRecordFail () { formatRecordList(list) {
this.getRecordNum() return list.map(record => {
this.list[0] = this.recordFailList.map(record => {
return { return {
result: record.result, result: record.result,
customerPhone: record.customerPhone, customerPhone: record.customerPhone,
...@@ -303,6 +311,10 @@ export default { ...@@ -303,6 +311,10 @@ export default {
endTime: record.endTime endTime: record.endTime
} }
}) })
},
getRecordFail () {
this.getRecordNum()
this.list[0] = this.formatRecordList(this.recordFailList)
this.flag = true this.flag = true
this.isPrePage = false this.isPrePage = false
this.nothing = !!this.recordFailList.length this.nothing = !!this.recordFailList.length
...@@ -396,24 +408,7 @@ export default { ...@@ -396,24 +408,7 @@ export default {
async submitRecord (val) { async submitRecord (val) {
this.flag = false this.flag = false
delete val.duration delete val.duration
delete val.startTime // delete val.startTime
const { maxUploadNum = 10 } = uni.$storage.get('mock_data')
if (val.recordUrlList.length > maxUploadNum) {
const userInfo = uni.$storage.get('userInfo')
const { customerName, phoneNumber, carModel, salesName } = val || {}
const { name } = userInfo || {}
uni.$logger.error({
msg: `员工: ${name}, 客户: ${customerName}`,
extra: {
'手机号: ': phoneNumber,
'姓名: ': customerName,
'销售: ': salesName,
'车型: ': carModel,
'原因: ': '录音文件过长,数量' + val.recordUrlList.length
}
})
}
val.recordUrlList = val.recordUrlList.slice(0, maxUploadNum)
await this.recorder.save(val) await this.recorder.save(val)
this.getRecordNum() this.getRecordNum()
await this.getPreRecordFail() await this.getPreRecordFail()
......
<template> <template>
<view class="data-container"> <view class="data-container">
<view class="nav-bar" @click="$emit('cancel')"> <view class="nav-bar">
<view class="back" @click="$emit('update:showPayPage', false)"> <view class="back-btn" @click="backClick">
<uni-icons type="left" :size="20" color="#000"></uni-icons> <uni-icons type="left" :size="20" color="#1a1a1a"></uni-icons>
</view> </view>
<view class="title">接待记录</view> <view class="title">接待记录</view>
</view> </view>
<view class="error-tip" v-if="errorTip">以下信息不能为空,请完善信息后保存</view>
<view class="form"> <view class="content-scroll">
<template v-for="(i, index) in formObject"> <view class="error-banner" v-if="errorTip">
<view :class="['form-item', { active: focusIndex == index }]" :key="index"> <uni-icons type="info-filled" :size="16" color="#f45c3d"></uni-icons>
<view class="label required">{{ i.label }}</view> <text>请完善必填信息</text>
<view :class="['value', { error: showError(i.key) }]"> </view>
<template v-if="i.type == 'input'">
<input :type="i.inputType" :maxlength="i.maxlength" v-model="customerInfo[i.key]" class="input" :placeholder="i.placeholder" @focus="focusIndex = index" @blur="resetFocusIndex" /> <view class="form-grid">
</template> <template v-for="(i, index) in formObject">
<template v-else> <view :class="['form-item', { 'radio-type': i.type === 'radio', focused: focusIndex == index, error: showError(i.key) }]" :key="index" @click="handleItemClick(i, index)">
<view :class="['select flex', { placeholderStyle: !customerInfo[i.key] }]" @click="showPopup(i.popKey, index)"> <view class="label-box">
<view class="text-hide">{{ customerInfo[i.key] || i.placeholder }}</view> <text class="label-text">{{ i.label }}</text>
<uni-icons class="arrow" type="right" :size="16"></uni-icons> <text class="required-mark" v-if="true">*</text>
</view>
<view class="input-box">
<template v-if="i.type == 'input'">
<input
:type="i.inputType"
:maxlength="i.maxlength"
v-model="customerInfo[i.key]"
class="uni-input"
:placeholder="i.placeholder"
placeholder-class="input-placeholder"
@focus="focusIndex = index"
@blur="resetFocusIndex"
/>
</template>
<template v-else-if="i.type == 'radio'">
<CustomerTypeRadio :value="customerInfo[i.key]" @change="radioChange" class="radio-group-box" />
</template>
<template v-else>
<view class="select-trigger">
<text :class="['select-text', { placeholder: !customerInfo[i.key] }]">
{{ customerInfo[i.key] || i.placeholder }}
</text>
<uni-icons class="arrow-icon" type="right" :size="14" color="#C0C4CC"></uni-icons>
</view>
</template>
</view> </view>
</template> </view>
</view> </template>
</view> </view>
</template>
</view> </view>
<view class="footer-box">
<view class="cancel-btn" @click="$emit('cancel')">取消</view> <view class="footer-action">
<view class="submit-btn" @click="handleSave">提交</view> <view class="btn cancel" @click="$emit('cancel')">取消</view>
<view class="btn submit" @click="handleSave">保存提交</view>
</view> </view>
<car-brands ref="carBrandListVisible" @select="handleSelect($event, 'carBrandListVisible')" /> <ResultSelect ref="receptionStatusVisible" :value="customerInfo.status" @change="selectReception" maskBackgroundColor="rgba(0,0,0,0)" />
<employee ref="employeeBoxVisible" :salesPropsUuid="customerInfo.salesUuid" @select="handleSelect($event, 'employeeBoxVisible')" />
<MessageBox ref="receptionStatusVisible" position="bottom" :isFooter="false" title="请选择接待结果" :maxHeight="1000">
<view class="select-box">
<view class="select-item" :class="{ checked: customerInfo.receptionStatus == item.label }" @click="selectReception(item.label)" v-for="(item, index) in receptionList" :key="index">
{{ item.label }}
</view>
</view>
</MessageBox>
</view> </view>
</template> </template>
<script type="text/ecmascript-6"> <script type="text/ecmascript-6">
import CarBrands from '@/components/CarBrands.vue' // import CarBrands from '@/components/CarBrands.vue'
import Employee from '@/components/Employee.vue' // import Employee from '@/components/Employee.vue'
import CustomerAutocomplete from '@/components/CustomerAutocomplete.vue' import CustomerAutocomplete from '@/components/CustomerAutocomplete.vue'
import ResultSelect from '@/components/ResultSelect.vue'
import CustomerTypeRadio from '@/components/CustomerTypeRadio.vue'
const phoneRex = /^[1]([3-9])[0-9]{9}$/; const phoneRex = /^[1]([3-9])[0-9]{9}$/;
import utils from "@/utils/utils"; import utils from "@/utils/utils";
export default { export default {
components: { components: {
CarBrands, // CarBrands,
Employee, // Employee,
CustomerAutocomplete CustomerAutocomplete,
ResultSelect,
CustomerTypeRadio
}, },
props: { props: {
customerInfoVal: { customerInfoVal: {
...@@ -62,15 +84,6 @@ export default { ...@@ -62,15 +84,6 @@ export default {
data() { data() {
return { return {
errorTip:false, errorTip:false,
receptionList: Object.freeze([{
label: '成交',
value: 1
},
{
label: '战败',
value: 0
}
]),
formObject: Object.freeze([{ formObject: Object.freeze([{
label: "车主姓名", label: "车主姓名",
placeholder: '车主姓名', placeholder: '车主姓名',
...@@ -82,32 +95,32 @@ export default { ...@@ -82,32 +95,32 @@ export default {
{ {
label: "车主电话", label: "车主电话",
placeholder: '车主电话', placeholder: '车主电话',
key: 'phoneNumber', key: 'customerPhone',
type: 'input', type: 'input',
inputType: 'tel', inputType: 'tel',
maxlength: 11 maxlength: 11
}, },
{
label: "客户类型",
key: "customerType",
type: "radio",
placeholder: '请输入客户类型',
required: true
},
{ {
label: "品牌车型", label: "品牌车型",
placeholder: '品牌车型', placeholder: '品牌车型',
key: 'carModel', key: 'carType',
type: 'select', type: 'input',
popKey: 'carBrandListVisible' maxlength: 20
}, },
{ {
label: "接待结果", label: "接待结果",
key: "receptionStatus", key: "status",
type: "select", type: "select",
popKey: "receptionStatusVisible", popKey: "receptionStatusVisible",
placeholder: '请选择', placeholder: '请选择',
}, }
{
label: "销售姓名",
key: "salesName",
type: "select",
popKey: "employeeBoxVisible",
placeholder: '请选择',
},
]), ]),
focusIndex: -1, focusIndex: -1,
customerInfo:{} customerInfo:{}
...@@ -115,25 +128,21 @@ export default { ...@@ -115,25 +128,21 @@ export default {
}, },
mounted() { mounted() {
this.customerInfo = utils.deepClone(this.customerInfoVal) this.customerInfo = utils.deepClone(this.customerInfoVal)
const i = this.receptionList.findIndex(e => e.value === this.customerInfo.receptionStatus)
this.$set(this.customerInfo, 'receptionStatus', i == -1?'':this.receptionList[i].label)
}, },
methods: { methods: {
selectReception(value) { selectReception(value) {
this.customerInfo.receptionStatus = value this.customerInfo.status = value
this.$refs.receptionStatusVisible.close() this.$refs.receptionStatusVisible.close()
this.resetFocusIndex()
}, },
showError(key) { showError(key) {
let flag = !this.customerInfo[key] let flag = !this.customerInfo[key]
if (key == 'phoneNumber' && this.customerInfo[key]) flag = !phoneRex.test(this.customerInfo[key]) if (key == 'customerPhone' && this.customerInfo[key]) flag = !phoneRex.test(this.customerInfo[key])
return flag return flag
}, },
handleSave() { handleSave() {
const result = this.check(true) const result = this.check(true)
if (!result) return this.errorTip = true if (!result) return this.errorTip = true
const i = this.receptionList.findIndex(e => e.label == this.customerInfo.receptionStatus)
this.customerInfo.receptionStatus = this.receptionList[i].value
this.$emit('submit',this.customerInfo) this.$emit('submit',this.customerInfo)
}, },
check(all = false) { check(all = false) {
...@@ -141,7 +150,7 @@ export default { ...@@ -141,7 +150,7 @@ export default {
try { try {
this.formObject.map(e => { this.formObject.map(e => {
if (!this.customerInfo[e.key]) throw false if (!this.customerInfo[e.key]) throw false
if (!all && e.key == 'phoneNumber' && !phoneRex.test(this.customerInfo[e.key])) { if (!all && e.key == 'customerPhone' && !phoneRex.test(this.customerInfo[e.key])) {
uni.showToast({ uni.showToast({
title: "请输入正确的车主电话", title: "请输入正确的车主电话",
icon: "none", icon: "none",
...@@ -154,208 +163,288 @@ export default { ...@@ -154,208 +163,288 @@ export default {
} }
return flag return flag
}, },
handleSelect(item, popkey) { // handleSelect(item, popkey) {
this.$refs[popkey].close() // this.$refs[popkey].close()
if (popkey == 'employeeBoxVisible') { // if (popkey == 'employeeBoxVisible') {
this.customerInfo.salesUuid = item.uuid // this.customerInfo.salesUuid = item.uuid
this.customerInfo.salesName = item.staffName // this.customerInfo.salesName = item.staffName
} else { // } else {
this.$refs.carBrandListVisible.close() // this.$refs.carBrandListVisible.close()
this.customerInfo.carModel = item.name // this.customerInfo.carModel = item.name
this.customerInfo.carBrand = item.carChildsBrandName // this.customerInfo.carBrand = item.carChildsBrandName
this.customerInfo.carBrandId = item.carChildsBrandId // this.customerInfo.carBrandId = item.carChildsBrandId
this.customerInfo.oneCarBrand = item.carBrand // this.customerInfo.oneCarBrand = item.carBrand
this.customerInfo.oneCarBrandId = item.carBrandId // this.customerInfo.oneCarBrandId = item.carBrandId
} // }
this.resetFocusIndex() // this.resetFocusIndex()
this.errorTip = false // this.errorTip = false
}, // },
showPopup(e, index) { showPopup(e, index) {
this.focusIndex = index this.focusIndex = index
this.$refs[e].open() this.$refs[e].open()
}, },
resetFocusIndex() { handleItemClick(item, index) {
this.focusIndex = -1 if (item.type === 'select') {
this.showPopup(item.popKey, index)
} else {
this.focusIndex = index
}
},
resetFocusIndex() {
this.focusIndex = -1
this.errorTip = false this.errorTip = false
} },
} radioChange (e) {
this.customerInfo.customerType = e.detail.value
},
backClick() {
console.log('backClick')
this.$emit('cancel')
}
}
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.error-tip {
font-size: toRpx(28);
padding: toRpx(32) toRpx(60) toRpx(24);
margin-top: toRpx(100);
margin-bottom: toMinusRpx(80);
text-align: center;
background-color: rgb(254, 237, 234);
color: #f45c3d;
}
.data-container { .data-container {
background: #ffffff59; background: #ffffff;
border-radius: toRpx(48); border-radius: toRpx(24);
margin: toRpx(80) toRpx(66) toRpx(80) 0; margin: toRpx(48) auto;
height: calc(100% - #{toRpx(160)}); width: calc(100% - #{toRpx(64)});
box-shadow: inset 0 0 toRpx(16) 0 #ffffff; height: calc(100% - #{toRpx(96)});
border: toRpx(2) solid #fff; box-shadow: 0 toRpx(8) toRpx(24) rgba(0, 0, 0, 0.05);
box-sizing: border-box; display: flex;
flex-direction: column;
overflow: hidden;
position: relative; position: relative;
// 硬件加速
transform: translateZ(0);
will-change: transform;
}
.nav-bar { .nav-bar {
position: absolute; height: toRpx(100);
width: 100%; display: flex;
height: toRpx(96); align-items: center;
left: 0; justify-content: center;
top: toRpx(28); position: absolute; // 改为 absolute
z-index: 9; top: 0;
text-align: center; left: 0;
font-weight: 700; width: 100%;
font-size: toRpx(32); border-bottom: 1px solid #f5f5f5;
color: #1a1a1a; background-color: #fff;
line-height: toRpx(96); z-index: 999; // 提高层级
.back { .back-btn {
position: absolute; position: absolute;
left: 0; left: 0; // 扩大点击区域
top: 0; top: 0;
height: 100%; height: 100%;
aspect-ratio: 1/1; width: toRpx(100); // 增加宽度
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
z-index: 11; // 确保在最上层
cursor: pointer;
display:none;
&:active {
opacity: 0.7;
}
// 让图标不拦截点击事件
/deep/ .uni-icons {
pointer-events: none;
} }
} }
.form { .title {
display: flex; font-size: toRpx(34);
flex-wrap: wrap; font-weight: 600;
gap: toRpx(80) toRpx(160); color: #1a1a1a;
padding: toRpx(80); }
margin-top: toRpx(60); }
&-item {
width: calc(50% - #{toRpx(80)});
display: flex;
align-items: center;
color: #6c6c70;
font-size: toRpx(30);
height: toRpx(80);
box-sizing: border-box;
.label { .content-scroll {
position: relative; flex: 1;
margin-left: auto; overflow-y: auto;
flex-shrink: 0; margin-top: toRpx(100); // 留出nav-bar的高度
width: toRpx(124); padding: toRpx(32) toRpx(40);
margin-right: toRpx(30); -webkit-overflow-scrolling: touch;
} }
.required { .error-banner {
&::before { display: flex;
content: '*'; align-items: center;
color: #ff0000; justify-content: center;
position: absolute; gap: toRpx(12);
left: toMinusRpx(20); background-color: #fef0f0;
top: 50%; color: #f56c6c;
transform: translate(0, -50%); font-size: toRpx(26);
} padding: toRpx(16);
} border-radius: toRpx(12);
margin-bottom: toRpx(32);
animation: slideDown 0.3s ease-out;
}
.value { .form-grid {
height: toRpx(80); display: grid;
flex: 1; grid-template-columns: repeat(2, 1fr);
border: toRpx(2) solid #e8e8ea; gap: toRpx(32) toRpx(40);
background: #ffffff;
margin-left: toRpx(32); @media screen and (max-width: 768px) {
box-sizing: border-box; grid-template-columns: 1fr;
padding: 0 toRpx(40); }
border-radius: toRpx(8); }
&.error { .form-item {
border: toRpx(2) solid #f24724; display: flex;
border-radius: toRpx(8); flex-direction: column;
gap: toRpx(16);
.label-box {
display: flex;
align-items: center;
.label-text {
font-size: toRpx(28);
color: #606266;
font-weight: 500;
} }
.input, .required-mark {
.select { color: #f56c6c;
width: 100%; margin-left: toRpx(8);
height: 100%; font-size: toRpx(28);
border: none !important;
outline: none;
padding: 0 !important;
font-size: toRpx(30);
color: #333;
&::placeholder {
color: #c9c9c9;
}
} }
}
.placeholderStyle {
color: #999999; .input-box {
height: toRpx(88);
background: #f5f7fa;
border-radius: toRpx(12);
border: 1px solid transparent;
transition: all 0.2s ease;
padding: 0 toRpx(24);
display: flex;
align-items: center;
.uni-input {
flex: 1;
font-size: toRpx(30);
color: #303133;
height: 100%;
} }
.arrow { .input-placeholder {
color: #999 !important; color: #c0c4cc;
margin-left: auto; }
flex-shrink: 0;
.select-trigger {
flex: 1;
display: flex;
align-items: center;
justify-content: space-between;
height: 100%;
.select-text {
font-size: toRpx(30);
color: #303133;
&.placeholder {
color: #c0c4cc;
}
}
} }
}
} }
}
.radio-group-box {
.footer-box { display: flex;
display: flex; align-items: center;
align-items: center; gap: toRpx(48); // 增加单选框之间的间距
justify-content: center; height: 100%;
gap: toRpx(34);
padding: 0 toRpx(280); .radio {
display: flex;
.cancel-btn { align-items: center;
height: toRpx(80); font-size: toRpx(30);
background: #dae9ff; color: #303133;
border-radius: toRpx(48);
line-height: toRpx(80); radio {
text-align: center; transform: scale(0.8);
color: #2c66f7; margin-right: toRpx(8);
flex: 1; }
}
} }
.submit-btn { // 单选框特殊处理:正常状态无边框无背景,只有报错时显示红色边框
height: toRpx(80); &.radio-type .input-box {
background-image: linear-gradient(0deg, #2c66f7 0%, #48a6ff 100%); background: transparent !important;
border-radius: toRpx(48); border: none !important;
line-height: toRpx(80); box-shadow: none !important;
text-align: center; padding: 0;
flex: 1; }
color: #ffffff;
&.focused .input-box {
background: #ffffff;
border-color: #2c66f7;
box-shadow: 0 0 0 2px rgba(44, 102, 247, 0.1);
}
// 错误状态通用处理
&.error .input-box {
background: #fef0f0 !important;
border-color: #f56c6c !important;
border-width: 1px !important;
border-style: solid !important;
box-shadow: none !important;
} }
}
} }
.select-box { .footer-action {
margin: toRpx(40) 0; padding: toRpx(32) toRpx(40);
display: grid; border-top: 1px solid #f5f5f5;
grid-template-columns: repeat(3, 1fr); display: flex;
gap: toRpx(20); gap: toRpx(32);
overflow-y: scroll; background: #ffffff;
max-height: 50vh; flex-shrink: 0;
padding-bottom: toRpx(60);
.btn {
.select-item { flex: 1;
text-align: center; height: toRpx(88);
height: toRpx(68); border-radius: toRpx(44);
line-height: toRpx(68); display: flex;
opacity: 1; align-items: center;
border: toRpx(2) solid #dce0e6; justify-content: center;
color: #292d33; font-size: toRpx(30);
font-size: toRpx(28); font-weight: 500;
border-radius: toRpx(8); transition: all 0.2s;
&:active {
transform: scale(0.98);
}
&.cancel {
background: #f5f7fa;
color: #606266;
}
&.submit {
background: linear-gradient(135deg, #2c66f7 0%, #5c8dff 100%);
color: #ffffff;
box-shadow: 0 toRpx(8) toRpx(16) rgba(44, 102, 247, 0.25);
}
}
}
&.checked { @keyframes slideDown {
border: toRpx(2) solid #292d33; from {
opacity: 0;
transform: translateY(-10px);
}
to {
opacity: 1;
transform: translateY(0);
} }
}
} }
</style> </style>
<template>
<view class="container" @click="handleTouchStart">
<view :class="['home', { show: !id && showHome }]">
<left-side :userInfo="userInfo" :tabIndex.sync="tabIndex" ref="leftBox" @changeTab="changeTab" @stopAudio="stopAudio" @showReadCountTips="showReadCountTips" @closeTips="closeTips" />
<view class="tips-box" :style="tipsObject.style" @click.stop="closeTips">{{ tipsObject.text }}</view>
<right-content :tabIndex="tabIndex" :moduleList="moduleList" :componentName="componentName" :isPermission="isPermission" @start="start" @changeType="$emit('changeType')" @showPage="handleShowPage" />
<store-address v-if="footerBox" />
</view>
<view :class="['detail', { show: id }]">
<slot name="detail" />
</view>
<!-- 未点击开始接待,弹窗 -->
<MessageBox ref="previewRef" @confirm="previewHandler('preview', true)" :popupW="704" content="直接点击素材可进行预览,若面向车主展示,请点击「开始接待」" confirmBtnText="预览素材" @cancel="previewHandler('previewCancel')" @close="previewHandler('previewClose')"></MessageBox>
<finish-reception-dialog ref="finish" @confirm="$emit('openStep')" @cancel="$emit('backHome')" />
<!-- 升级弹框 -->
<update-box />
<slot name="content" />
<web-view @message="handlerMessage" ref="webview" src="/hybrid/html/index.html"></web-view>
<!-- <web-view
ref="studyWebview"
:src="jumpUrl"
v-if="showBeisen"
></web-view> -->
</view>
</template>
<script>
import ReceptionCenter from './components/ReceptionCenter/index.vue'
import RightContent from './components/RightContent.vue'
import FinishReceptionDialog from './components/FinishReceptionDialog.vue'
import StoreAddress from './components/StoreAddress.vue'
import timeout from '@/mixin/timeout'
import recorder from '@/mixin/record/recorder'
import uploader from '@/mixin/record/uploader.js'
import versionCheck from '@/mixin/versionCheck.js'
import LeftSide from './components/LeftSide.vue'
import Material from '@/components/MaterialIndex.vue'
export default {
mixins: [recorder, uploader, timeout, versionCheck],
components: { LeftSide, Material, ReceptionCenter, RightContent, FinishReceptionDialog, StoreAddress },
props: {
id: [String, Number],
moduleList: {
type: Array,
default: () => []
},
bannerKey: String,
loadComplete: Boolean,
swiperNoDataObject: Object,
checkRecordAudio: {
type: Boolean,
default: true
},
swiperCustom: Boolean
},
data() {
return {
studyUrl: '',
jumpUrl: '',
transfer: '',
footerBox: true,
showHome: true,
pointComponentName: 'Point',
userInfo: {},
tabIndex: 0,
showBeisen: false,
tipsObject: {},
autoplay: true,
previewOff: false
}
},
mounted() {
const userInfo = uni.$storage.get('userInfo') || {}
this.userInfo = userInfo
// if (this.checkRecordAudio) permision.requestAndroidPermission('android.permission.RECORD_AUDIO') // 进入界面时检查权限
},
provide() {
return {
showPage: this.handleShowPage,
hideFooter: this.handleFooter
}
},
computed: {
finishRef() {
return this.$refs.finish
},
componentName() {
let tabs = this.$refs.leftBox?.tabs
return tabs ? tabs[this.tabIndex].name : ''
}
},
methods: {
async changeTab({ item, index }) {
this.previewOff = index != 0
this.$emit('changeTab', index)
},
handleFooter(val) {
this.footerBox = val
},
handleShowPage(name, transfer) {
this.transfer = transfer
this.showHome = false
this.pointComponentName = name
},
showReadCountTips(res) {
this.tipsObject = res
},
closeTips() {
this.tipsObject = {
style: '',
text: ''
}
},
previewHandler(name, off = false) {
this.previewOff = off
this.$emit(name)
},
async start() {
this.$emit('start')
}
// async changeType() {
// this.$refs.bizTypeSelector.open()
// },
// chooseBusinessType(item) {
// this.currentType = item
// uni.$storage.set('typeItem', item)
// this.$emit('changeType')
// },
}
}
</script>
<style scoped lang="scss">
.container {
position: relative;
.tips-box {
position: absolute;
color: #ffffff;
font-size: toRpx(28);
width: toRpx(310);
height: toRpx(90);
line-height: toRpx(68);
background-image: url('@/assets/images/home/daliog.png');
background-size: 100% 100%;
z-index: 9;
padding-left: toRpx(60);
text-align: left;
display: none;
opacity: 0;
}
&::after {
content: '';
position: absolute;
left: 0;
top: 0;
width: 100vw;
height: 100vh;
background-image: url('@/assets/images/common/home-bg-1.webp');
background-size: 100% 100%;
z-index: 1;
}
.home,
.detail {
position: fixed;
width: 100%;
height: 100%;
z-index: -1;
top: 0;
left: 0;
visibility: hidden;
opacity: 0;
}
.point-page {
position: fixed;
width: 100%;
height: 100%;
z-index: 2;
top: 0;
left: 0;
}
.home {
display: flex;
height: 100vh;
position: relative;
.store-addr {
position: absolute;
left: 50%;
bottom: toRpx(24);
transform: translateX(-50%);
display: flex;
align-items: center;
.icon-addr {
width: toRpx(32);
height: toRpx(32);
flex-shrink: 0;
}
.addr-text {
font-size: toRpx(24);
color: #999999;
word-wrap: break-word;
white-space: normal;
line-height: toRpx(32);
margin-left: toRpx(4);
flex-shrink: 0;
}
&::before,
&::after {
content: '';
width: toRpx(600);
height: toRpx(2);
margin: 0 toRpx(40);
}
&::before {
background-image: linear-gradient(270deg, #eeeeee 0%, #d8d8d800 100%);
}
&::after {
background-image: linear-gradient(90deg, #eeeeee 0%, #d8d8d800 100%);
}
}
}
.show {
opacity: 1;
position: absolute;
z-index: 2;
visibility: visible;
animation: show-content-left 0.15s forwards;
}
}
@keyframes show-content-left {
0% {
left: 100%;
}
100% {
left: 0;
}
}
.right-side {
flex: 1;
position: relative;
width: calc(100vw - #{toRpx(240)});
.right-content {
height: 100vh;
box-sizing: border-box;
position: relative;
animation: show-box 0.15s forwards;
overflow: hidden;
}
@keyframes show-box {
0% {
left: 100%;
}
100% {
left: 0;
}
}
.start {
height: toRpx(232);
box-sizing: border-box;
margin-right: toRpx(64);
position: relative;
background: url('@/assets/images/home/start-btn.png') no-repeat;
background-size: 100% 100%;
padding-top: toRpx(60);
display: flex;
justify-content: center;
.sprite-icon {
zoom: 2;
}
}
.right-content-box {
width: 100%;
// height: calc(100% - #{toRpx(232)});
height: 100%;
gap: toRpx(48);
box-sizing: border-box;
padding: toRpx(32) 0 toRpx(80);
.box-class {
background: #ffffff59;
backdrop-filter: blur(toRpx(16));
box-shadow: inset 0 0 toRpx(16) 0 #ffffff;
border-radius: toRpx(48);
overflow: hidden;
}
.content-box {
position: relative;
width: 100%;
height: calc(100% - #{toRpx(160)});
.message-box {
height: 100%;
}
}
.content-left,
.content-right {
height: 100%;
flex-shrink: 0;
}
.content-left {
width: calc(100% - #{toRpx(48)});
.common-title {
display: flex;
align-items: center;
/* justify-content: space-between; 不需要space-between,左对齐自然排列 */
padding-right: toRpx(48); /* 保持右侧边距 */
.title-text {
flex: 1; /* 标题占据剩余空间 */
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.switch-btn {
display: flex;
align-items: center;
background: rgba(255, 255, 255, 0.4); /* 半透明白底,融入蓝底 */
border: 1px solid rgba(255, 255, 255, 0.6);
border-radius: toRpx(26);
padding: 0 toRpx(20);
height: toRpx(52);
box-sizing: border-box;
margin-left: toRpx(24);
transition: all 0.2s ease;
cursor: pointer;
text {
font-size: toRpx(24);
color: #5b6b8c; /* 蓝灰色,低调且协调 */
font-weight: 400;
margin-left: toRpx(8);
}
.icon-exchange {
/* 复用 sprite 图标 */
zoom: 0.7;
opacity: 0.7;
/* 移除去色滤镜,让图标自然的色调显露,或者保持微调 */
}
/* 移除之前的 SVG 图标样式 */
&::before {
display: none;
}
&:active {
background: rgba(255, 255, 255, 0.7);
transform: scale(0.98);
}
}
}
.module-box {
height: calc(100% - #{toRpx(235)});
margin-bottom: toRpx(48);
}
.select-type {
position: absolute; /* 改为绝对定位,悬浮 */
right: toRpx(48);
top: 68%; /* 向下调整,避免顶部遮挡 */
transform: translateY(-50%);
width: toRpx(128); /* 加大尺寸 */
height: toRpx(128);
border-radius: 50%;
background: linear-gradient(135deg, #6187e7 0%, #8a6ef5 100%);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
box-shadow: 0 toRpx(8) toRpx(20) rgba(97, 135, 231, 0.5);
z-index: 10;
animation: breathe 3s infinite ease-in-out; /* 呼吸效果 */
.text {
font-size: toRpx(22);
color: #fff;
font-weight: 600;
line-height: 1.2;
text-align: center;
width: toRpx(80);
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.icon-arrow {
display: none; /* 圆形按钮不需要箭头 */
}
/* 流光圆环 */
&::before {
content: '';
position: absolute;
top: toRpx(-8);
left: toRpx(-8);
right: toRpx(-8);
bottom: toRpx(-8);
border-radius: 50%;
border: toRpx(4) solid transparent;
border-top-color: #ffffff;
border-right-color: rgba(255, 255, 255, 0.6);
border-bottom-color: rgba(138, 110, 245, 0.4);
/* 光影辉光效果 */
box-shadow:
0 0 toRpx(16) rgba(97, 135, 231, 0.6),
inset 0 0 toRpx(10) rgba(255, 255, 255, 0.2);
filter: drop-shadow(0 0 toRpx(6) rgba(255, 255, 255, 0.8));
animation: rotate-ring 4s linear infinite;
}
/* 内部高光 */
&::after {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border-radius: 50%;
background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.5) 0%, transparent 60%);
}
&:active {
transform: translateY(-50%) scale(0.9);
box-shadow: 0 toRpx(4) toRpx(10) rgba(97, 135, 231, 0.5);
}
}
@keyframes breathe {
0%,
100% {
transform: translateY(-50%) scale(1);
box-shadow: 0 toRpx(8) toRpx(20) rgba(97, 135, 231, 0.5);
}
50% {
transform: translateY(-50%) scale(1.05);
box-shadow: 0 toRpx(12) toRpx(30) rgba(97, 135, 231, 0.7);
}
}
@keyframes rotate-ring {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
.tool-box {
height: calc(100% - #{toRpx(712)});
.content-box {
width: calc(100% - #{toRpx(96)});
margin: 0 toRpx(48);
}
}
}
.content-right {
width: calc(100% - #{toRpx(1322)});
// width: toRpx(800);
}
}
.app-content-box {
width: 100%;
position: absolute;
left: 0;
top: 0;
opacity: 0;
z-index: -999;
}
.show-content-box {
opacity: 1;
z-index: 1;
}
}
.footer {
border-top: toRpx(2) solid #eff0f2;
font-weight: 600;
font-size: toRpx(32);
margin-top: toRpx(48);
.footer-btn {
justify-content: center;
margin: toRpx(16) auto 0;
}
.confirm {
width: toRpx(608);
height: toRpx(80);
background: #2c66f7;
border-radius: toRpx(40);
color: #fff;
}
.cancel {
width: toRpx(608);
height: toRpx(80);
background: #ffffff00;
border-radius: toRpx(40);
color: #2c66f7;
}
text {
font-size: toRpx(24);
}
}
.lead-page {
height: 100vh;
width: 100vw;
z-index: 999999;
position: fixed;
}
</style>
<template> <template>
<view class="container" @click="handleTouchStart"> <view class="container" @click="handleTouchStart">
<view :class="['home', { show: !id && showHome }]"> <view :class="['home', { show: !activeDetailId && showHome }]">
<left-side :userInfo="userInfo" :tabIndex.sync="tabIndex" ref="leftBox" @changeTab="changeTab" @stopAudio="stopAudio" @showReadCountTips="showReadCountTips" @closeTips="closeTips" /> <left-side :userInfo="userInfo" :tabIndex.sync="tabIndex" ref="leftBox" @changeTab="changeTab" @stopAudio="stopAudio" @showReadCountTips="showReadCountTips" @closeTips="closeTips" />
<view class="tips-box" :style="tipsObject.style" @click.stop="closeTips">{{ tipsObject.text }}</view> <view class="tips-box" :style="tipsObject.style" @click.stop="closeTips">{{ tipsObject.text }}</view>
<view class="right-side"> <view class="right-side">
...@@ -11,9 +11,12 @@ ...@@ -11,9 +11,12 @@
</view> </view>
<store-address v-if="footerBox" /> <store-address v-if="footerBox" />
</view> </view>
<view :class="['detail', { show: id }]"> <view :class="['detail', { show: activeDetailId }]">
<slot name="detail" /> <slot name="detail" />
</view> </view>
<view class="point-page" v-if="!showHome && !activeDetailId">
<component :is="pointComponentName" :transfer="transfer" @close="showHome = true" />
</view>
<!-- 未点击开始接待,弹窗 --> <!-- 未点击开始接待,弹窗 -->
<MessageBox ref="previewRef" @confirm="previewHandler('preview', true)" :popupW="704" content="直接点击素材可进行预览,若面向车主展示,请点击「开始接待」" confirmBtnText="预览素材" @cancel="previewHandler('previewCancel')" @close="previewHandler('previewClose')"></MessageBox> <MessageBox ref="previewRef" @confirm="previewHandler('preview', true)" :popupW="704" content="直接点击素材可进行预览,若面向车主展示,请点击「开始接待」" confirmBtnText="预览素材" @cancel="previewHandler('previewCancel')" @close="previewHandler('previewClose')"></MessageBox>
<finish-reception-dialog ref="finish" @confirm="$emit('openStep')" @cancel="$emit('backHome')" /> <finish-reception-dialog ref="finish" @confirm="$emit('openStep')" @cancel="$emit('backHome')" />
...@@ -37,14 +40,19 @@ import recorder from '@/mixin/record/recorder' ...@@ -37,14 +40,19 @@ import recorder from '@/mixin/record/recorder'
import uploader from '@/mixin/record/uploader.js' import uploader from '@/mixin/record/uploader.js'
import versionCheck from '@/mixin/versionCheck.js' import versionCheck from '@/mixin/versionCheck.js'
import LeftSide from './components/LeftSide.vue' import LeftSide from './components/LeftSide.vue'
import Material from '@/components/MaterialIndex.vue'
import HomeSlot from './components/HomeSlot.vue' import HomeSlot from './components/HomeSlot.vue'
import Order from './components/Order/index.vue' import Order from './components/Order/index.vue'
const TAB_COMPONENTS = {
1: 'ReceptionCenter',
2: 'Order'
}
export default { export default {
mixins: [recorder, uploader, timeout, versionCheck], mixins: [recorder, uploader, timeout, versionCheck],
components: { LeftSide, Material, ReceptionCenter, FinishReceptionDialog, StoreAddress, HomeSlot, Order }, components: { LeftSide, ReceptionCenter, FinishReceptionDialog, StoreAddress, HomeSlot, Order },
props: { props: {
id: [String, Number], activeDetailId: [String, Number],
finishDoneText: String, finishDoneText: String,
finishContene: { finishContene: {
type: String, type: String,
...@@ -97,8 +105,7 @@ export default { ...@@ -97,8 +105,7 @@ export default {
return this.$refs.finish return this.$refs.finish
}, },
componentName() { componentName() {
let tabs = this.$refs.leftBox?.tabs return TAB_COMPONENTS[this.tabIndex] || ''
return tabs ? tabs[this.tabIndex].name : ''
} }
}, },
methods: { methods: {
...@@ -161,6 +168,7 @@ export default { ...@@ -161,6 +168,7 @@ export default {
text-align: left; text-align: left;
display: none; display: none;
opacity: 0; opacity: 0;
will-change: opacity, display; // 优化动画性能
} }
&::after { &::after {
...@@ -173,10 +181,10 @@ export default { ...@@ -173,10 +181,10 @@ export default {
background-image: url('@/assets/images/common/home-bg-1.webp'); background-image: url('@/assets/images/common/home-bg-1.webp');
background-size: 100% 100%; background-size: 100% 100%;
z-index: 1; z-index: 1;
pointer-events: none; // 避免背景图阻挡交互
} }
.home, .home {
.detail {
position: fixed; position: fixed;
width: 100%; width: 100%;
height: 100%; height: 100%;
...@@ -185,6 +193,29 @@ export default { ...@@ -185,6 +193,29 @@ export default {
left: 0; left: 0;
visibility: hidden; visibility: hidden;
opacity: 0; opacity: 0;
will-change: opacity, visibility; // 提示浏览器提前优化
// 使用3D加速,避免重绘
transform: translateZ(0);
}
.detail {
position: fixed;
width: 100vw;
height: 100vh;
left: 0;
top: 0;
z-index: -1;
visibility: hidden;
transform: translateX(100%);
transition: transform 0.5s cubic-bezier(0.19, 1, 0.22, 1), visibility 0.5s;
will-change: transform, visibility; // 提示浏览器提前优化
&.show {
z-index: 2;
visibility: visible;
transform: translateX(0);
}
} }
.point-page { .point-page {
...@@ -250,41 +281,44 @@ export default { ...@@ -250,41 +281,44 @@ export default {
z-index: 2; z-index: 2;
visibility: visible; visibility: visible;
animation: show-content-left 0.15s forwards; animation: show-content-left 0.15s forwards;
will-change: transform;
} }
} }
@keyframes show-content-left { @keyframes show-content-left {
0% { 0% {
left: 100%; transform: translateX(100%);
} }
100% { 100% {
left: 0; transform: translateX(0);
} }
} }
.right-side { .right-side {
flex: 1; flex: 1;
position: relative;
width: calc(100vw - #{toRpx(240)});
.right-content {
height: 100vh;
box-sizing: border-box;
position: relative; position: relative;
animation: show-box 0.15s forwards; width: calc(100vw - #{toRpx(240)});
overflow: hidden; contain: layout style; // 限制样式和布局计算范围
}
@keyframes show-box { .right-content {
0% { height: 100vh;
left: 100%; box-sizing: border-box;
position: relative;
animation: show-box 0.15s forwards;
overflow: hidden;
will-change: transform; // 优化动画
} }
100% { @keyframes show-box {
left: 0; 0% {
transform: translateX(100%);
}
100% {
transform: translateX(0);
}
} }
}
.start { .start {
height: toRpx(232); height: toRpx(232);
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
:type="position" :type="position"
:is-mask-click="false" :is-mask-click="false"
:animation="animation" :animation="animation"
:mask-background-color="maskBackgroundColor"
> >
<view <view
class="tips-wrapper" class="tips-wrapper"
...@@ -111,6 +112,10 @@ export default { ...@@ -111,6 +112,10 @@ export default {
showCancelBtn: { showCancelBtn: {
type: Boolean, type: Boolean,
default: true, default: true,
},
maskBackgroundColor: {
type: String,
default: 'rgba(0, 0, 0, 0.4)'
} }
}, },
methods: { methods: {
...@@ -135,8 +140,10 @@ export default { ...@@ -135,8 +140,10 @@ export default {
<style scoped lang="scss"> <style scoped lang="scss">
.tips-wrapper { .tips-wrapper {
background: #ffffff; background: #ffffff;
border-radius: toRpx(20); border-radius: toRpx(24);
height: 100%; height: 100%;
box-shadow: 0 toRpx(12) toRpx(48) rgba(0, 0, 0, 0.16), 0 toRpx(4) toRpx(16) rgba(0, 0, 0, 0.08);
border: 1px solid rgba(0, 0, 0, 0.06);
.tips-content { .tips-content {
padding: toRpx(48); padding: toRpx(48);
box-sizing: border-box; box-sizing: border-box;
......
<template>
<view class="choose-box">
<template v-for="(i, index) in list">
<view :class="['choose-item', `${i.status == value ? (i.status == '完成' || i.status == 1 ? 'success' : 'error') : ''}`]" :key="index" @click="chooseResult(i.status)">
<view :class="['sprite-icon', `icon-face-${i.status == value ? `${i.icon}-active` : i.icon}`]"></view>
{{ i.text }}
</view>
</template>
</view>
</template>
<script>
export default {
name: "ResultList",
props: {
list: {
type: Array,
default: () => []
},
value: {
type: [String, Number],
default: -1
}
},
methods: {
chooseResult(val) {
this.$emit('input', val);
this.$emit('change', val);
}
}
}
</script>
<style scoped lang="scss">
.choose-box {
display: flex;
flex-direction: column;
align-items: center;
.choose-item {
width: 100%;
height: toRpx(128);
border: toRpx(2) solid #e8e8e8;
border-radius: toRpx(16);
display: flex;
align-items: center;
justify-content: center;
margin-top: toRpx(24);
.sprite-icon {
margin-right: toRpx(16);
}
}
.success {
background: #14cc681a;
border-color: #14cc681a;
}
.error {
background: #f247241a;
border-color: #f247241a;
}
}
</style>
<template>
<MessageBox ref="popup" title="接待结果" :popupW="704" :isFooter="false" :maskBackgroundColor="maskBackgroundColor">
<ResultList :list="list" :value="value" @change="handleChange" />
</MessageBox>
</template>
<script>
import ResultList from './ResultList.vue'
export default {
name: "ResultSelect",
components: {
ResultList
},
props: {
list: {
type: Array,
default: () => [
{
icon: 'success',
text: '结果完美,成交了',
status: "完成"
},
{
icon: 'error',
text: '仍需努力,战败了',
status: "未完成"
}
]
},
value: {
type: [String, Number],
default: -1
},
maskBackgroundColor: {
type: String,
default: 'rgba(0, 0, 0, 0.4)'
}
},
methods: {
open() {
this.$refs.popup.open()
},
close() {
this.$refs.popup.close()
},
handleChange(val) {
this.$emit('input', val);
this.$emit('change', val);
}
}
}
</script>
...@@ -377,7 +377,12 @@ export default { ...@@ -377,7 +377,12 @@ export default {
try { try {
if (str && (str.includes('=') || str.length > 50)) { if (str && (str.includes('=') || str.length > 50)) {
const decrypted = decryptAES(str) const decrypted = decryptAES(str)
if (decrypted) return decrypted if (decrypted) {
if (label == 'Region' && decrypted.includes('.')) {
decrypted = decrypted.split('.')[0]
}
}
return decrypted
} }
} catch (e) { } catch (e) {
console.error(`${label} decryption error`, e) console.error(`${label} decryption error`, e)
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Author: huyue * @Author: huyue
* @Date: 2024-04-08 11:30:30 * @Date: 2024-04-08 11:30:30
* @LastEditors: limin * @LastEditors: limin
* @LastEditTime: 2025-12-29 08:46:10 * @LastEditTime: 2025-12-29 11:40:42
--> -->
<template> <template>
<view class="detail-box" :key="dateilKey"> <view class="detail-box" :key="dateilKey">
...@@ -13,9 +13,12 @@ ...@@ -13,9 +13,12 @@
</view> </view>
</view> </view>
<template v-for="(item, index) in moduleList"> <template v-for="(item, index) in moduleList">
<view :class="['view', getViewClass(item)]" :key="index" @touchstart.stop="touchStart" <view :class="['view', getViewClass(item)]" :style="{ 'animation-duration': swipeConfig.animDuration + 'ms' }" :key="index" @touchstart.stop="touchStart"
@touchend.stop="touchEnd"> @touchend.stop="touchEnd">
<component @full="handleFull" :detail="item" :is="item.componentName" <!-- 优化:仅渲染当前页、上一页、下一页,减少DOM节点 -->
<component
v-if="shouldRender(item)"
@full="handleFull" :detail="item" :is="item.componentName"
:views="item.receptionSourceDetailList || []" :penSwitch="penSwitch" :show="id == item.id" :views="item.receptionSourceDetailList || []" :penSwitch="penSwitch" :show="id == item.id"
:ref="'media' + item.id" :title="item.materialName || ''" :madiaId="item.id" @scale="scale" :ref="'media' + item.id" :title="item.materialName || ''" :madiaId="item.id" @scale="scale"
:ulList="item.ulList" :screenList="item.screenList" @onProductModel="productModelStatus = $event" :ulList="item.ulList" :screenList="item.screenList" @onProductModel="productModelStatus = $event"
...@@ -412,38 +415,42 @@ export default { ...@@ -412,38 +415,42 @@ export default {
}, },
touchEnd(e) { touchEnd(e) {
if (this.modeName || this.isAnimating) return if (this.modeName || this.isAnimating) return
try {
let { pageToolList, drawStatus, startX, screenWidth, id, scaleValueObject, productModelStatus } = this const { pageToolList, drawStatus, startX, screenWidth, id, scaleValueObject, productModelStatus } = this
if (!e || !e.changedTouches || drawStatus || pageToolList.length == 0 || e.changedTouches.length === 0) return // 快速前置检查
if (!e?.changedTouches?.length || drawStatus || !pageToolList.length) return
let touch = e.changedTouches[0]
let diffX = touch.pageX - startX const touch = e.changedTouches[0]
const diffX = touch.pageX - startX
let isDistanceSignificant = Math.abs(diffX) > screenWidth / this.swipeConfig.sensitivity
let index = pageToolList.findIndex(item => item.id == id) // 垂直滑动过大则忽略水平滑动,避免误触
if (Math.abs(this.startY - touch.pageY) > this.swipeConfig.verticalLimit) return
if (Math.abs(this.startY - touch.pageY) > this.swipeConfig.verticalLimit) return
if (!scaleValueObject[id]) scaleValueObject[id] = 1 // 距离检查
if (Math.abs(diffX) <= screenWidth / this.swipeConfig.sensitivity) return
if (isDistanceSignificant && index != -1 && scaleValueObject[id] == 1 && !productModelStatus) {
const isNext = diffX < 0 const index = pageToolList.findIndex(item => item.id == id)
if (index === -1) return
let nextIndex
if (isNext) { // 缩放状态或打开产品弹窗时不切换
nextIndex = index === pageToolList.length - 1 ? 0 : index + 1 if ((scaleValueObject[id] && scaleValueObject[id] !== 1) || productModelStatus) return
this.pendingDirection = 'next'
} else { const isNext = diffX < 0
nextIndex = index === 0 ? pageToolList.length - 1 : index - 1 let nextIndex
this.pendingDirection = 'prev' if (isNext) {
} nextIndex = index === pageToolList.length - 1 ? 0 : index + 1
this.pendingDirection = 'next'
const nextItem = pageToolList[nextIndex] } else {
this.$emit('update:id', nextItem.id) nextIndex = index === 0 ? pageToolList.length - 1 : index - 1
uni.$logger.local.info(`预览${nextItem.title}`) this.pendingDirection = 'prev'
}
} catch (error) {
console.log(error)
} }
const nextItem = pageToolList[nextIndex]
// 使用 nextTick 确保状态更新
this.$nextTick(() => {
this.$emit('update:id', nextItem.id)
})
uni.$logger.local.info(`预览${nextItem.title}`)
}, },
getViewClass(item) { getViewClass(item) {
const isCurrent = item.id == this.id const isCurrent = item.id == this.id
...@@ -502,6 +509,29 @@ export default { ...@@ -502,6 +509,29 @@ export default {
this.$emit('update:id', jumpItem ? jumpItem.id : moduleList[0].id) this.$emit('update:id', jumpItem ? jumpItem.id : moduleList[0].id)
} }
this.currentMediaId = id this.currentMediaId = id
},
// 判断是否应该渲染该组件(性能优化)
shouldRender(item) {
// 如果列表很短,直接全部渲染
if (this.moduleList.length <= 3) return true
const currentIndex = this.moduleList.findIndex(i => i.id == this.id)
if (currentIndex === -1) return false
const targetIndex = this.moduleList.findIndex(i => i.id == item.id)
// 渲染当前页
if (currentIndex === targetIndex) return true
// 渲染上一页(考虑循环)
const prevIndex = currentIndex === 0 ? this.moduleList.length - 1 : currentIndex - 1
if (prevIndex === targetIndex) return true
// 渲染下一页(考虑循环)
const nextIndex = currentIndex === this.moduleList.length - 1 ? 0 : currentIndex + 1
if (nextIndex === targetIndex) return true
return false
} }
} }
} }
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
@start="start" @start="start"
@changeType="changeType" @changeType="changeType"
ref="home" ref="home"
:id="id" :activeDetailId="id"
@openStep="openStep" @openStep="openStep"
@backHome="backHome" @backHome="backHome"
@changeTab="changeTab" @changeTab="changeTab"
...@@ -34,8 +34,9 @@ ...@@ -34,8 +34,9 @@
</template> </template>
<script> <script>
import detail from './detail/detail' import detail from './detail/detail'
import { mapMutations } from 'vuex' import { mapMutations, mapActions } from 'vuex'
import HomeFrame from '@/components/HomeFrame/index.vue' import HomeFrame from '@/components/HomeFrame/index.vue'
export default { export default {
components: { HomeFrame, detail }, components: { HomeFrame, detail },
data () { data () {
...@@ -59,41 +60,33 @@ export default { ...@@ -59,41 +60,33 @@ export default {
return this.$refs.home return this.$refs.home
}, },
previewRef() { previewRef() {
return this.homeRef.previewRef return this.homeRef?.previewRef
}, },
finishRef() { finishRef() {
return this.homeRef.finishRef return this.homeRef?.finishRef
} }
}, },
onBackPress (options) { onBackPress (options) {
if (options.from === 'backbutton') { if (options.from === 'backbutton') {
// 物理返回按钮触发
// 阻止默认行为,即不执行页面返回
this.back() this.back()
return true return true
} }
// 其他情况允许正常返回
return false return false
}, },
async onLoad () { async onLoad () {
// uni.hideLoading() const mockdata = await uni.$api.systemApi.getMockData(true)
const mockdata = await uni.$api.systemApi.getMockData(true) //获取APP配置信息
uni.$storage.set('typeItem', { uni.$storage.set('typeItem', {
typeCode: mockdata?.typeCode || '', typeCode: mockdata?.typeCode || '',
typeName: mockdata?.typeName || '' typeName: mockdata?.typeName || ''
}) })
// if (this.channelType == 1 && mockdata.boutiqueDefaultCarBrandId) {
// this.$store.state.user.boutiqueDefaultCarBrandId = mockdata.boutiqueDefaultCarBrandId //默认车辆品牌 await Promise.all([
// if (mockdata.defaultCarId) this.$store.state.user.defaultCarId = mockdata.defaultCarId //默认车系 this.getHomeSource(mockdata?.typeCode),
// } this.getSource(mockdata?.typeCode)
// this.get_Vehicle_Sales_Data() ])
// this.requested = true
// this.$refs.home.updateApp(true) // 确保初始化时清空id,保证显示首页
this.getHomeSource(mockdata?.typeCode) this.id = ''
this.getSource(mockdata?.typeCode)
// setTimeout(() => {
// this.start()
// }, 1e3)
}, },
async onShow () { async onShow () {
this.init() this.init()
...@@ -101,64 +94,67 @@ export default { ...@@ -101,64 +94,67 @@ export default {
methods: { methods: {
...mapMutations('audio', ['setReceptionStatus']), ...mapMutations('audio', ['setReceptionStatus']),
...mapMutations('material', ['setMaterial']), ...mapMutations('material', ['setMaterial']),
...mapActions(['clearCustomerInfo', 'clearHistory', 'clearReceptionTrack']),
init () { init () {
// this.findPayInfo() if (this.requested && !this.id) this.homeRef?.updateApp()
if (this.requested && !this.id) this.homeRef.updateApp()
}, },
// 查询素材
// 查询素材(优化版:减少循环中的await)
async getSource (typeCode) { async getSource (typeCode) {
const first_res = await uni.$api.commonApi.getPadFolderList({ const first_res = await uni.$api.commonApi.getPadFolderList({
typeCode, typeCode,
status: 0 status: 0
}) })
this.folderList = Array.isArray(first_res?.data) ? first_res.data : [] this.folderList = Array.isArray(first_res?.data) ? first_res.data : []
if (!this.folderList.length) { if (!this.folderList.length) return this.resetLists()
this.moduleList = []
this.toolList = [] // 并行请求所有文件夹内容
return const folderPromises = this.folderList.map(folder =>
} uni.$api.commonApi.getPadMaterialList({
let materials = []
for (let i = 0; i < this.folderList.length; i++) {
const folder = this.folderList[i]
const res = await uni.$api.commonApi.getPadMaterialList({
folderCode: folder.folderCode, folderCode: folder.folderCode,
typeCode: folder.typeCode, typeCode: folder.typeCode,
status: 0 status: 0
}) })
const list = Array.isArray(res?.data) ? res.data : [] )
if (list.length) {
materials = list const results = await Promise.all(folderPromises)
break // 找到第一个有数据的文件夹
} const validResult = results.find(res => Array.isArray(res?.data) && res.data.length > 0)
}
if (!validResult) return this.resetLists()
if (!materials.length) {
this.processMaterials(validResult.data)
},
resetLists() {
this.moduleList = [] this.moduleList = []
this.toolList = [] this.toolList = []
return
}
this.moduleList = materials.map(item => ({
...item,
thumbnail: item.materialUrl,
title: item.materialName,
class: 'landscape',
style: 'width: calc(100vw * (1282 / 2346));height: calc(100vmin * (1173 / 768) * (304 / 2346));',
showAlt: false,
componentName: 'media-component',
materialName: item.materialName,
receptionSourceDetailList: {
detailUrl: item.materialUrl
}
}))
this.toolList = materials.map(item => ({
...item,
shortTitle: item.materialName,
title: item.materialName,
shortTitleUrl: item.materialUrl
}))
}, },
processMaterials(materials) {
this.moduleList = materials.map(item => ({
...item,
thumbnail: item.materialUrl,
title: item.materialName,
class: 'landscape',
style: 'width: calc(100vw * (1282 / 2346));height: calc(100vmin * (1173 / 768) * (304 / 2346));',
showAlt: false,
componentName: 'media-component',
materialName: item.materialName,
receptionSourceDetailList: {
detailUrl: item.materialUrl
}
}))
this.toolList = materials.map(item => ({
...item,
shortTitle: item.materialName,
title: item.materialName,
shortTitleUrl: item.materialUrl
}))
},
// 获取首页素材 // 获取首页素材
async getHomeSource(typeCode) { async getHomeSource(typeCode) {
const res = await uni.$api.commonApi.getPadMaterialList({ const res = await uni.$api.commonApi.getPadMaterialList({
...@@ -168,42 +164,43 @@ export default { ...@@ -168,42 +164,43 @@ export default {
}) })
this.homeList = Array.isArray(res?.data) ? res.data : [] this.homeList = Array.isArray(res?.data) ? res.data : []
}, },
changeType () { changeType () {
const typeItem = uni.$storage.get('typeItem') const typeItem = uni.$storage.get('typeItem')
const typeCode = typeItem?.typeCode || '' const typeCode = typeItem?.typeCode || ''
this.getHomeSource(typeCode) this.getHomeSource(typeCode)
this.getSource(typeCode) this.getSource(typeCode)
}, },
async start (item) { async start (item) {
if (!this.moduleList.length) return uni.showToast({ if (!this.moduleList.length) return uni.showToast({
title: '该场景尚未配置素材,请联系总部人员', title: '该场景尚未配置素材,请联系总部人员',
icon: 'none' icon: 'none'
}) })
const isPermision = await this.homeRef.isPermission() const isPermision = await this.homeRef.isPermission()
if (this.recording || !isPermision) return if (this.recording || !isPermision) return
const material = this.moduleList[0] const material = this.moduleList[0]
this.setMaterial(material) this.setMaterial(material)
// uni.showLoading({
// mask: true
// })
await this.homeRef.startAudio() await this.homeRef.startAudio()
this.clearHistory() this.clearAllHistory()
this.id = +material.id this.id = +material.id
// this.id = 6
this.type = 'edit' this.type = 'edit'
this.recording = true this.recording = true
// setTimeout(() => {
// uni.hideLoading()
// }, 1e3)
}, },
toDetail (index) { toDetail (index) {
let item = this.moduleList[index] this.chooseItem = this.moduleList[index]
this.chooseItem = item this.previewRef?.open()
this.previewRef.open()
}, },
cancel () { cancel () {
this.previewRef.close() this.previewRef?.close()
}, },
preview () { preview () {
let { id, title } = this.chooseItem let { id, title } = this.chooseItem
this.type = 'preview' this.type = 'preview'
...@@ -211,109 +208,60 @@ export default { ...@@ -211,109 +208,60 @@ export default {
uni.$logger.local.info(`预览${title}`) uni.$logger.local.info(`预览${title}`)
this.cancel() this.cancel()
}, },
// 完成接待 // 完成接待
done (e) { done (e) {
this.finishRef.close() this.finishRef?.close()
if (this.recording) this.homeRef.stopAudio() if (this.recording) this.homeRef?.stopAudio()
this.recording = false this.recording = false
setTimeout(() => { setTimeout(() => {
this.id = '' this.id = ''
this.type = '' this.type = ''
this.setReceptionStatus(e) this.setReceptionStatus(e)
this.$store.dispatch('clearHistory') this.clearAllHistory()
this.$store.dispatch('clearReceptionTrack')
}, 1500) }, 1500)
}, },
back () { back () {
const detailRef = this.$refs.detail const detailRef = this.$refs.detail
if (detailRef.showPayPage) return (detailRef.showPayPage = false) if (detailRef?.showPayPage) return (detailRef.showPayPage = false)
if (!this.id) return uni.navigateBack() if (!this.id) return uni.navigateBack()
if (this.type != 'preview') return this.finishRef.open() if (this.type != 'preview') return this.finishRef?.open()
this.backHome() this.backHome()
}, },
backHome () { backHome () {
if (this.recording) this.homeRef.stopAudio(true) if (this.recording) this.homeRef?.stopAudio(true)
this.finishRef.close() this.finishRef?.close()
this.id = '' this.id = ''
this.type = '' this.type = ''
this.clearHistory() this.clearAllHistory()
// this.init()
this.recording = false this.recording = false
// this.$refs.home.$refs.leftBox.getMessageInfo()
}, },
nextStep () { nextStep () {
let { id } = this.moduleList[0] let { id } = this.moduleList[0]
this.type = 'preview' this.type = 'preview'
this.id = id this.id = id
}, },
clearHistory () {
this.$store.dispatch('clearCustomerInfo') clearAllHistory () {
this.$store.dispatch('clearHistory') this.clearCustomerInfo()
// this.$refs.home.setBooks([]) this.clearHistory()
this.$store.dispatch('clearReceptionTrack') this.clearReceptionTrack()
}, },
openStep () { openStep () {
this.finishRef.close() this.finishRef?.close()
this.$refs.detail.open() this.$refs.detail?.open()
}, },
// 查询门店支付配置
// async findPayInfo () {
// const { shopMerchantId } = uni.$storage.get('userInfo')
// const data = await uni.$api.commonApi.findPayInfo({
// merchantId: shopMerchantId
// })
// let paymentType = []
// data.find(item => {
// if (item.paymentType == 1)
// paymentType.push({
// name: '扫码支付',
// type: 1,
// title: '付款二维码',
// ...item
// })
// if (item.paymentType == 2)
// paymentType.push({
// name: '对公账户',
// type: 2,
// title: '付款方式',
// ...item
// })
// })
// this.$store.dispatch('setPaymentType', paymentType)
// },
changeTab (index) { changeTab (index) {
// if (index == 0) this.init() // if (index == 0) this.init()
}, }
},
/**按序加载车型 */ beforeDestroy () {
// async getCarBrandsList (carBrandList, index) { this.backHome()
// const item = carBrandList[index]
// if (!item) return
// const carList = uni.getStorageSync(`${item.id}_${item.brandId}_carlist`)
// if (index < carBrandList.length - 1) {
// index += 1
// if (!carList) {
// const list = await uni.$api.commonApi.getCarBrandsList({
// brandId: item.brandId,
// childBrandId: item.id
// })
// if (list) uni.setStorageSync(`${item.id}_${item.brandId}_carlist`, list)
// this.getCarBrandsList(carBrandList, ++index)
// } else this.getCarBrandsList(carBrandList, ++index)
// }
// },
/**素材内容 */
// setViewInfo (data) {
// let { moduleList, toolList, id } = data
// this.moduleList = moduleList
// this.toolList = toolList
// this.mediaId = id
// this.loadComplete = true
// this.$store.state.user = {
// ...this.$store.state.user,
// ...data
// }
// }
} }
} }
</script> </script>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!