Commit 7c969686 by 李伟康

refactor(components): 优化汽车品牌组件代码结构

- 移除多余的换行和空格以改善代码格式
- 统一方法声明语法移除不必要的空格
- 简化条件逻辑将日志记录包裹在条件判断中
- 清理模板中的冗余换行符提升可读性
- 优化样式表增加必要的间距增强视觉效果
- 删除调试用的 console.log 语句

fix(pages): 移除页面调试日志输出

- 删除优惠券弹窗组件中的调试日志
- 清理客户信息处理流程中的临时输出
- 移除员工选择功能的调试信息
1 parent bcd29cc5
<template>
<view>
<MessageBox
ref="carBrandListVisible"
position="bottom"
:isFooter="false"
title="请选择车品牌"
@close="clickClose"
>
<MessageBox ref="carBrandListVisible" position="bottom" :isFooter="false" title="请选择车品牌" @close="clickClose">
<view class="select-box">
<view
class="select-item"
:class="{ checked: carBrand == item.name }"
@click="selectCar(item)"
v-for="(item, index) in carBrandList"
:key="index"
>
<view class="select-item" :class="{ checked: carBrand == item.name }" @click="selectCar(item)"
v-for="(item, index) in carBrandList" :key="index">
{{ item.name }}
</view>
</view>
</MessageBox>
<MessageBox
ref="carBoxVisible"
position="bottom"
:isFooter="false"
title="请选择车系"
:maxHeight="1000"
back
@close="closeCarBoxVisible"
>
<MessageBox ref="carBoxVisible" position="bottom" :isFooter="false" title="请选择车系" :maxHeight="1000" back
@close="closeCarBoxVisible">
<view class="select-box">
<view
class="select-item"
:class="{ checked: carModel == item.name }"
@click="handleSelect(item)"
v-for="(item, index) in carlist"
:key="index"
>
<view class="select-item" :class="{ checked: carModel == item.name }" @click="handleSelect(item)"
v-for="(item, index) in carlist" :key="index">
{{ item.name }}
</view>
</view>
......@@ -66,7 +43,7 @@ export default {
default: true
}
},
data () {
data() {
return {
carlist: [],
selectItem: {},
......@@ -77,42 +54,42 @@ export default {
watch: {
watchStatus: {
immediate: true,
handler (newval) {
handler(newval) {
this.close()
}
},
},
computed: {
watchStatus () {
watchStatus() {
return this.$store.state.user.historyStatus
},
carModel () {
carModel() {
return this.customBoolean ? this.echoData[this.carModelKey] : this.$store.state.user.customerInfo.carModel
},
carBrandList () {
carBrandList() {
return this.$store.state.user.carBrands || []
},
carBrand () {
carBrand() {
return this.customBoolean ? this.echoData[this.carBrandKey] : this.$store.state.user.customerInfo.carBrand
},
boutiqueDefaultCarBrandId () {
boutiqueDefaultCarBrandId() {
return this.$store.state.user.boutiqueDefaultCarBrandId
},
defaultCarId () {
defaultCarId() {
return this.$store.state.user.defaultCarId || ''
}
},
mounted () {
mounted() {
},
methods: {
autoSelect () {
autoSelect() {
const { carBrandList, boutiqueDefaultCarBrandId, defaultCarId } = this
let carIndex = 0
if (boutiqueDefaultCarBrandId) carIndex = carBrandList.findIndex(e => e.id == boutiqueDefaultCarBrandId)
if (carIndex < 0) carIndex = 0
if (carBrandList.length) this.selectCar(carBrandList[carIndex], true, defaultCarId)
},
open () {
open() {
this.$store.dispatch('setCarBrandOpenStatus', true)
const userInfo = uni.$storage.get("userInfo"),
{ shopMerchantId } = userInfo;
......@@ -146,7 +123,7 @@ export default {
this.$refs.carBrandListVisible.open()
this.carBrandListOff = true
},
selectCar (e, auto = false, carId) {
selectCar(e, auto = false, carId) {
if (!e.brandId || !e.id) return uni.showToast({
title: "车型ID或品牌ID为空",
icon: "none",
......@@ -198,7 +175,7 @@ export default {
})
},
handleSelect (item) {
handleSelect(item) {
const customerInfo = this.$store.state.user.customerInfo,
{ selectItem, linkage } = this
Object.assign(customerInfo, {
......@@ -207,14 +184,14 @@ export default {
oneCarBrand: selectItem.carBrand,
oneCarBrandId: selectItem.carBrandId
})
uni.$logger.local.info(`选择车:
if (linkage) {
uni.$logger.local.info(`选择车:
carModel:${item.name},
carModelId: ${item.id},
carBrand:${customerInfo.carBrand},
carBrandId:${customerInfo.carBrandId},
oneCarBrand:${customerInfo.oneCarBrand},
oneCarBrandId:${customerInfo.oneCarBrandId}`)
if (linkage) {
this.$store.dispatch('setCustomerInfo', customerInfo)
this.$store.dispatch('updateViewKey')
this.$store.dispatch('setCurrentCarInfo', selectItem)
......@@ -226,18 +203,18 @@ export default {
...selectItem
})
},
close () {
close() {
this.$refs?.carBoxVisible?.close();
this.$refs?.carBrandListVisible?.close()
this.carBrandListOff = false
this.$store.dispatch('setCarBrandOpenStatus', false)
},
closeCarBoxVisible () {
closeCarBoxVisible() {
if (this.carBrandListOff) return
else this.$emit('close')
},
clickClose () {
clickClose() {
this.$store.dispatch('setCarBrandOpenStatus', false)
this.$emit('close')
},
......@@ -254,6 +231,7 @@ export default {
overflow-y: scroll;
max-height: 50vh;
padding-bottom: toRpx(60);
.select-item {
text-align: center;
height: toRpx(68);
......@@ -263,6 +241,7 @@ export default {
color: #333;
font-size: toRpx(32);
border-radius: toRpx(8);
&.checked {
border: toRpx(2) solid #292d33;
}
......
......@@ -313,7 +313,6 @@ export default {
},
carInfo: {
handler (newval) {
console.log(newval, '===')
this.pageParams.carInfo = {
carChildsBrandId: newval.carChildsBrandId,
carChildsBrandName: newval.carChildsBrandName,
......@@ -446,7 +445,6 @@ export default {
this.pageParams.customerQr = data
if (customerInfo.inviteRecordId) this.customerInfo = customerInfo
console.log(customerInfo)
} else throw '生成小程序码失败,请重试!'
} else throw message
......@@ -471,7 +469,6 @@ export default {
this.$refs.couponPopup?.close()
},
handleSelect (item, popkey) {
console.log(item, popkey)
this.$refs[popkey].close();
if (popkey == "employeeBoxVisible") {
this.customerInfo.salesUuid = item.uuid;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!