Commit 4e3f6fd6 by 李伟康

修复

1 parent 63fda8c7
......@@ -125,81 +125,67 @@ const getImageVersion = async () => {
return accountInfo?.version || Date.now()
}
/**获取素材配置 */
const getSoureData = async (shopMerchantId, sceneType) => {
const getSoureData = async (shopMerchantId, sceneType, params = {}) => {
try {
const { id } = await getEquityMaterialId({
merchantId: shopMerchantId
const res = await getEquityMaterialId({
merchantId: shopMerchantId,
...params
})
if (id) {
if (res && res.id) {
let data = await getEquityMaterialConfig({
id
}),
{ toolList, materialInfoList } = data,
storageName = `source_${sceneType}_${shopMerchantId}`
let moduleList = moduleList = await imgTransformBase64(materialInfoList, ['thumbnail', 'receptionSourceDetailList', 'screenList'])
data.toolList = await imgTransformBase64(toolList, ['shortTitleUrl'])
data.moduleList = moduleList
uni.setStorageSync(storageName, {
moduleList,
toolList: data.toolList
id: res.id
})
return Promise.resolve(data)
}
if (data) {
let { toolList, materialInfoList } = data,
storageName = `source_${sceneType}_${shopMerchantId}`
if (params.brandId && params.subBrandId) storageName += `_${params.brandId}_${params.subBrandId}`
let hasEquity = materialInfoList.find(e => e.componentName == 'insurance')
if (hasEquity) {
let configList
try {
configList = await findReceptionpriproConfigList({})
uni.$storage.set('findReceptionpriproConfigList', configList)
} catch (error) {
configList = uni.$storage.get('findReceptionpriproConfigList')
}
const toolOtherList = configList.map(i => {
return {
id: hasEquity.id + 100 + i.id,
shortTitle: i.productName,
shortTitleUrl: i.procuctLog
}
})
toolList = toolList.concat(toolOtherList)
const moduleOtherList = configList.map(i => {
return {
id: hasEquity.id + 100 + i.id,
title: i.productName,
shortTitleUrl: i.procuctLog,
productPoster: i.productPoster,
showAlt: false,
componentName: 'CaseCenter',
receptionpriproCusCaseList: i.receptionpriproCusCaseList
}
})
materialInfoList = materialInfoList.concat(moduleOtherList)
}
data.toolList = await imgTransformBase64(toolList, ['shortTitleUrl'])
data.moduleList = await imgTransformBase64(materialInfoList, ['thumbnail', 'receptionSourceDetailList', 'screenList'])
uni.setStorageSync(storageName, {
moduleList: data.moduleList,
toolList: data.toolList
})
return Promise.resolve(data)
}
} else throw '该场景尚未配置素材,请联系总部人员'
} catch (error) {
console.log(error)
uni.showToast({
title: error,
icon: 'none',
duration: 2000
})
}
// return
// const getSoureData = async (channelType = 1, shopMerchantId, sceneType = 0) => {
// const sceneData = await http.uni_request({ url: appConfigUrl }),
// { brandIds, merchantIds, caseCenterIds } = sceneData[sceneType]
// let targetUrl,
// storageName = `source_${sceneType}_data_`
// if (merchantIds.hasOwnProperty(shopMerchantId)) {
// targetUrl = merchantIds[shopMerchantId]
// storageName += `merchantId_${shopMerchantId}`
// } else {
// targetUrl = brandIds[channelType]
// storageName += `channelType_${channelType}`
// }
// let data = await http.uni_request({ url: `${targetUrl}&env=${env}` }),
// { moduleList, toolList } = data
// /**全损无忧 */
// if (caseCenterIds.includes(channelType)) {
// let configList
// try {
// configList = await findReceptionpriproConfigList({})
// uni.$storage.set('findReceptionpriproConfigList', configList)
// } catch (error) {
// configList = uni.$storage.get('findReceptionpriproConfigList')
// }
// const toolOtherList = configList.map(i => {
// return {
// id: 10 + i.id,
// shortTitle: i.productName,
// shortTitleUrl: i.procuctLog
// }
// })
// toolList = toolList.concat(toolOtherList)
// const moduleOtherList = configList.map(i => {
// return {
// id: 10 + i.id,
// title: i.productName,
// shortTitleUrl: i.procuctLog,
// productPoster: i.productPoster,
// showAlt: false,
// componentName: 'CaseCenter',
// receptionpriproCusCaseList: i.receptionpriproCusCaseList
// }
// })
// moduleList = moduleList.concat(moduleOtherList)
// }
// data.moduleList = await imgTransformBase64(moduleList, ['thumbnail', 'receptionSourceDetailList', 'screenList'])
// data.toolList = await imgTransformBase64(toolList, ['shortTitleUrl'])
// uni.setStorageSync(storageName, {
// moduleList,
// toolList
// })
// return Promise.resolve(data)
}
/**批量图片转base64 */
const imgTransformBase64 = async (imgList = [], keyList = []) => {
......
......@@ -23,7 +23,7 @@
ref="carBoxVisible"
position="bottom"
:isFooter="false"
title="请选择车型"
title="请选择车系"
:maxHeight="1000"
back
@close="closeCarBoxVisible"
......@@ -199,6 +199,7 @@ export default {
this.$store.dispatch('setCustomerInfo', customerInfo)
this.$refs.carBoxVisible?.close();
this.$store.dispatch('updateViewKey')
this.$store.dispatch('setCurrentCarInfo', selectItem)
this.$emit('select', {
...item,
...selectItem
......
......@@ -130,7 +130,7 @@ export default {
setTimeout(() => {
this.scrollTop = 0
}, 100);
const { storageKey } = this,
const storageKey = this.getStorageKey(),
insuranceList = uni.getStorageSync(storageKey)
if (insuranceList) {
insuranceList.map(e => e.cost = '')
......@@ -160,10 +160,15 @@ export default {
}
},
mounted () {
const { phone, shopMerchantId } = uni.$storage.get("userInfo")
this.storageKey = `${shopMerchantId}_${phone}_insurance_list`
this.getStorageKey()
},
methods: {
getStorageKey () {
const { phone, shopMerchantId } = uni.$storage.get("userInfo"),
storageKey = `${shopMerchantId}_${phone}_insurance_list`
this.storageKey = storageKey
return storageKey
},
showRow (index) {
let flag = true
if (index == this.viewsTitle.length - 1 && !this.isPreview) flag = false
......
......@@ -6,9 +6,7 @@
* @LastEditTime: 2024-12-25 18:52:46
-->
<template>
<view
class="detail-box"
>
<view class="detail-box">
<view
class="nav-bar"
:style="{ 'z-index': backZindex }"
......@@ -24,7 +22,7 @@
></uni-icons>
</view>
</view>
<template v-for="(item, index) in media">
<template v-for="(item, index) in (useCarConfig ? moduleList :media)">
<view
:class="['view', { showView: id == item.id }, modeName]"
:key="index"
......@@ -137,7 +135,9 @@ export default {
showPayPage: false,
productModelStatus: false,
modeName: '',
pageToolList: []
pageToolList: [],
moduleList: [],
useCarConfig: false
}
},
computed: {
......@@ -145,6 +145,17 @@ export default {
const { channelType } = uni.$storage.get('userInfo')
return channelType
},
shopMerchantId () {
const { shopMerchantId } = uni.$storage.get('userInfo')
return shopMerchantId
},
sceneType () {
const { sceneType } = uni.$storage.get('userInfo')
return sceneType
},
currentCarInfo () {
return this.$store.state.user.currentCarInfo
},
watchStatus () {
return this.$store.state.user.historyStatus
},
......@@ -181,19 +192,21 @@ export default {
watchStatus: {
immediate: true,
handler (newval) {
this.useCarConfig = false
if (newval) this.drawStatus = false
}
},
viewKey: {
immediate: true,
handler (newval) {
this.setPageToolList()
if (this.id) this.setPageData()
}
},
toolList: {
immediate: true,
handler (newval) {
this.setPageToolList()
this.pageToolList = this.toolList
// this.setPageToolList()
}
},
},
......@@ -290,14 +303,33 @@ export default {
let { id } = this
this.scaleValueObject[id] = e
},
setPageToolList () {
if (this.channelType == 1) {
let { carModelId } = this.customerInfo
const isAito = this.aitoCarModelIds?.findIndex(e => e == carModelId)
if (carModelId && isAito == -1) {
this.pageToolList = this.toolList.filter(e => !e.isAito)
} else this.pageToolList = this.toolList
} else this.pageToolList = this.toolList
// setPageToolList () {
// if (this.channelType == 1) {
// let { carModelId } = this.customerInfo
// const isAito = this.aitoCarModelIds?.findIndex(e => e == carModelId)
// if (carModelId && isAito == -1) {
// this.pageToolList = this.toolList.filter(e => !e.isAito)
// } else this.pageToolList = this.toolList
// } else this.pageToolList = this.toolList
// },
async setPageData () {
const { shopMerchantId, sceneType, currentCarInfo } = this,
{ carBrandId, carChildsBrandId } = currentCarInfo,
params = {
brandId: carBrandId,
subBrandId: carChildsBrandId
}
let storageName = `source_${sceneType}_${shopMerchantId}_${carBrandId}_${carChildsBrandId}`
let data = uni.getStorageSync(storageName)
if (data) this.setViewInfo(data)
let requestData = await uni.$api.systemApi.getSoureData(shopMerchantId, sceneType, params)
if (requestData) this.setViewInfo(requestData)
},
setViewInfo (data) {
this.moduleList = data.moduleList
this.pageToolList = data.toolList
this.useCarConfig = true
}
}
}
......
<template>
<view>
<home-frame @preview="preview" @start="start" ref="home" :id="id" @openStep="openStep" @backHome="backHome" @changeTab="changeTab">
<view class="module-box" slot="module">
<home-frame
@preview="preview"
@start="start"
ref="home"
:id="id"
@openStep="openStep"
@backHome="backHome"
@changeTab="changeTab"
>
<view
class="module-box"
slot="module"
>
<template v-for="(i, index) in moduleList">
<view :key="index" :class="['item landscape', i.class]" :style="i.style" @click="toDetail(i)" v-if="i.thumbnail">
<view
:key="index"
:class="['item landscape', i.class]"
:style="i.style"
@click="toDetail(i)"
v-if="i.thumbnail"
>
<template v-if="i.showAlt">
<view class="item-text flex">{{ i.title }}</view>
</template>
<template v-else>
<image class="item-img" :src="i.thumbnail" mode="scaleToFill" @error="errorImg(index)" />
<image
class="item-img"
:src="i.thumbnail"
mode="scaleToFill"
@error="errorImg(index)"
/>
</template>
</view>
</template>
</view>
<template slot="detail">
<detail :id.sync="id" :media="moduleList" :type.sync="type" :toolList="toolList" :aitoCarModelIds="aitoCarModelIds" @back="back" @done="done" ref="detail" />
<detail
:id.sync="id"
:media="moduleList"
:type.sync="type"
:toolList="toolList"
:aitoCarModelIds="aitoCarModelIds"
@back="back"
@done="done"
ref="detail"
/>
</template>
<template slot="content">
<!-- <novice-guide
......@@ -42,7 +73,7 @@ import HomeFrame from '@/components/HomeFrame/index.vue'
export default {
// mixins: [storge],
components: { HomeFrame, detail, NoviceGuide },
data() {
data () {
return {
moduleList: [],
toolList: [],
......@@ -55,20 +86,20 @@ export default {
}
},
computed: {
channelType() {
channelType () {
const { channelType } = uni.$storage.get('userInfo')
return channelType || 1 //默认问界
},
shopMerchantId() {
shopMerchantId () {
const { shopMerchantId } = uni.$storage.get('userInfo')
return shopMerchantId
},
sceneType() {
sceneType () {
const { sceneType } = uni.$storage.get('userInfo')
return sceneType
}
},
onBackPress(options) {
onBackPress (options) {
if (options.from === 'backbutton') {
// 物理返回按钮触发
// 阻止默认行为,即不执行页面返回
......@@ -78,12 +109,11 @@ export default {
// 其他情况允许正常返回
return false
},
onLoad() {
onLoad () {
uni.$api.systemApi.getMockData(true) //获取APP配置信息
this.getSoure()
this.get_Vehicle_Sales_Data()
},
onShow() {
onShow () {
const userInfo = uni.$storage.get('userInfo')
if (!userInfo.shopMerchantId || !userInfo.shopMerchantName) {
uni.$storage.rm('userInfo')
......@@ -97,70 +127,70 @@ export default {
},
methods: {
...mapMutations('audio', ['setReceptionStatus']),
init() {
init () {
this.findPayInfo()
},
/**获取车型&销售数据 */
get_Vehicle_Sales_Data() {
get_Vehicle_Sales_Data () {
const userInfo = uni.$storage.get('userInfo'),
storageCarBrandList = uni.$storage.get('carBrandList'),
storageEmployeeList = uni.$storage.get('employeeList'),
{ shopMerchantId } = userInfo
if (storageCarBrandList) this.$store.dispatch('setCarBrandsList', storageCarBrandList)
if (storageEmployeeList) this.$store.dispatch('setEmployeeList', storageEmployeeList)
/**获取销售人员 */
uni.$api.commonApi
.getEmployeeList({
merchantId: shopMerchantId
})
.then(res => {
this.$store.dispatch('setEmployeeList', res || [])
uni.$storage.set('employeeList', res || [])
})
/**获取品牌车型 */
uni.$api.commonApi.getMerchantCarBrandList([shopMerchantId]).then(({ data }) => {
let list = data[0].carBrandList,
carBrandList = []
carBrandList = [],
brandIdList = []
list?.map(e => {
e.childs.map(i => {
i.brandId = e.id
carBrandList.push(i)
})
brandIdList.push(e.id)
})
this.getSoure(brandIdList)
this.$store.dispatch('setCarBrandsList', carBrandList)
uni.$storage.set('carBrandList', carBrandList)
if (carBrandList.length) {
let index = 0
this.getCarBrandsList(carBrandList, index)
}
})
/**获取销售人员 */
uni.$api.commonApi.getEmployeeList({
merchantId: shopMerchantId
}).then(res => {
this.$store.dispatch('setEmployeeList', res || [])
uni.$storage.set('employeeList', res || [])
})
},
// 查询素材
async getSoure(loadStorage = true) {
const { channelType, shopMerchantId, sceneType } = this
if (loadStorage) {
// let data = uni.getStorageSync(`source_${sceneType}_data_merchantId_${shopMerchantId}`)
// if (!data) data = uni.getStorageSync(`source_${sceneType}_data_channelType_${channelType}`)
let data = uni.getStorageSync(`source_${sceneType}_${shopMerchantId}`)
if (!data) data = uni.getStorageSync(`source_${sceneType}_${channelType}`)
if (data) this.setViewInfo(data)
}
let requestData = await uni.$api.systemApi.getSoureData(shopMerchantId, sceneType)
console.log(requestData)
// let requestData = await uni.$api.systemApi.getSoureData(channelType, shopMerchantId, sceneType)
this.setViewInfo(requestData)
async getSoure (brandIdList) {
const { shopMerchantId, sceneType } = this
let data = uni.getStorageSync(`source_${sceneType}_${shopMerchantId}`)
if (data) this.setViewInfo(data)
let requestData = await uni.$api.systemApi.getSoureData(shopMerchantId, sceneType, {
brandIdList
})
if (requestData) this.setViewInfo(requestData)
},
errorImg(index) {
errorImg (index) {
this.moduleList[index].showAlt = true
},
async start() {
async start () {
if (!this.moduleList.length) return uni.showToast({
title: '该场景尚未配置素材,请联系总部人员',
icon: 'none'
})
if (this.recording) return
uni.showLoading({
mask: true
})
this.$refs.home.startAudio()
this.getSoure(false)
this.clearHistory()
this.id = this.moduleList[0].id
this.type = 'edit'
......@@ -169,14 +199,14 @@ export default {
uni.hideLoading()
}, 1e3)
},
toDetail(item) {
toDetail (item) {
this.chooseItem = item
this.$refs.home.previewRef.open()
},
cancel() {
cancel () {
this.$refs.home.previewRef.close()
},
preview() {
preview () {
let { id, title } = this.chooseItem
this.type = 'preview'
this.id = id
......@@ -184,7 +214,7 @@ export default {
this.cancel()
},
// 完成接待
done(e) {
done (e) {
this.$refs.home.finishRef.close()
if (this.recording) this.$refs.home.stopAudio()
this.recording = false
......@@ -196,14 +226,14 @@ export default {
this.$store.dispatch('clearReceptionTrack')
}, 1500)
},
back() {
back () {
const detailRef = this.$refs.detail
if (detailRef.showPayPage) return (detailRef.showPayPage = false)
if (!this.id) return uni.navigateBack()
if (this.type != 'preview') return this.$refs.home.finishRef.open()
this.backHome()
},
backHome() {
backHome () {
if (this.recording) this.$refs.home.stopAudio(true)
this.$refs.home.finishRef.close()
this.id = ''
......@@ -213,23 +243,23 @@ export default {
this.recording = false
this.$refs.home.$refs.leftBox.getMessageInfo()
},
nextStep() {
nextStep () {
let { id } = this.moduleList[0]
this.type = 'preview'
this.id = id
},
clearHistory() {
clearHistory () {
this.$store.dispatch('clearCustomerInfo')
this.$store.dispatch('clearHistory')
this.$refs.home.setBooks([])
this.$store.dispatch('clearReceptionTrack')
},
openStep() {
openStep () {
this.$refs.home.finishRef.close()
this.$refs.detail.open()
},
// 查询门店支付配置
async findPayInfo() {
async findPayInfo () {
const { shopMerchantId } = uni.$storage.get('userInfo')
const data = await uni.$api.commonApi.findPayInfo({
merchantId: shopMerchantId
......@@ -253,13 +283,13 @@ export default {
})
this.$store.dispatch('setPaymentType', paymentType)
},
changeTab(index) {
changeTab (index) {
this.tabIndex = index
if (index == 0) this.init()
},
/**按序加载车型 */
async getCarBrandsList(carBrandList, index) {
async getCarBrandsList (carBrandList, index) {
const item = carBrandList[index]
if (!item) return
const carList = uni.getStorageSync(`${item.id}_${item.brandId}_carlist`)
......@@ -276,31 +306,11 @@ export default {
}
},
/**素材内容 */
setViewInfo(data) {
setViewInfo (data) {
let { moduleList, toolList, aitoCarModelIds } = data
if (this.channelType == 1) this.aitoCarModelIds = aitoCarModelIds || []
this.moduleList = moduleList
// if (this.moduleList) {
// this.moduleList.push({
// id: 333,
// thumbnail: 'https://img02.glsx.com.cn/weapp/resource/app-tape/home/byd-home-3.webp',
// title: '汽车保险告知书',
// class: 'vertical',
// style: 'width: calc(100vw * (712 / 2346));height: calc(100vmin * (1173 / 768) * (624 / 2346));',
// showAlt: false,
// componentName: 'insurance',
// detailTitle: '汽车保险告知书'
// })
// }
this.toolList = toolList
// if (this.toolList) {
// this.toolList.push({
// id: 333,
// shortTitle: '车险告知书',
// shortTitleUrl: 'https://img02.glsx.com.cn/weapp/resource/app-tape/tool/default/5.png',
// title: '汽车保险告知书'
// })
// }
this.$store.state.user = {
...this.$store.state.user,
...data
......
......@@ -36,6 +36,7 @@ export default {
receptionKey:Date.now(), //接待记录埋点KEY
defaultCarId:'',
customerKey:Date.now(), //客户信息KEY
currentCarInfo:{},//当前选中的车品牌车系
};
},
mutations: {
......@@ -48,6 +49,9 @@ export default {
state.customerInfo = data
state.customerKey = Date.now()
},
setCurrentCarInfo (state, data = {}) {
state.currentCarInfo = data;
},
clearCustomerInfo (state) {
const info = {
customerName: "",
......@@ -97,6 +101,9 @@ export default {
updateViewKey({ state }){
state.viewKey = Date.now();
}
},
setCurrentCarInfo ({ commit }, value) {
commit("setCurrentCarInfo", value);
},
},
};
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!