Commit b5203313 by 李伟康

commit 轻改需求

1 parent da0bd622
...@@ -98,15 +98,12 @@ export default { ...@@ -98,15 +98,12 @@ export default {
mounted () { mounted () {
}, },
methods: { methods: {
autoSelect (index = 0, autoHideLoading = true) { autoSelect () {
const { carBrandList, boutiqueDefaultCarBrandId } = this const { carBrandList, boutiqueDefaultCarBrandId } = this
let carIndex = 0 let carIndex = 0
if (boutiqueDefaultCarBrandId) { if (boutiqueDefaultCarBrandId) carIndex = carBrandList.findIndex(e => e.id == boutiqueDefaultCarBrandId)
carIndex = carBrandList.findIndex(e => e.id == boutiqueDefaultCarBrandId) if (carIndex < 0) carIndex = 0
if (carIndex < 0) carIndex = 0 if (carBrandList.length) this.selectCar(carBrandList[carIndex], true)
}
if (index < 0) index = 0
if (carBrandList.length) this.selectCar(carBrandList[carIndex], true, index, autoHideLoading)
}, },
open () { open () {
const userInfo = uni.$storage.get("userInfo"), const userInfo = uni.$storage.get("userInfo"),
...@@ -140,8 +137,13 @@ export default { ...@@ -140,8 +137,13 @@ export default {
this.$refs.carBrandListVisible.open() this.$refs.carBrandListVisible.open()
this.carBrandListOff = true this.carBrandListOff = true
}, },
selectCar (e, auto = false, index, autoHideLoading = true) { selectCar (e, auto = false, carId) {
let { clickFlga } = this if (!e.brandId || !e.id) return uni.showToast({
title: "车型ID或品牌ID为空",
icon: "none",
});
let { clickFlga } = this,
index = 0
if (clickFlga) return if (clickFlga) return
this.clickFlga = true this.clickFlga = true
this.selectItem = { this.selectItem = {
...@@ -154,7 +156,11 @@ export default { ...@@ -154,7 +156,11 @@ export default {
if (carList) { if (carList) {
this.clickFlga = false this.clickFlga = false
this.carlist = carList this.carlist = carList
if (auto && carList.length) this.handleSelect(carList[index]) if (auto && carList.length) {
if (carId) index = carList.findIndex(i => i.id == carId)
if (index < 0) index = 0
this.handleSelect(carList[index])
}
else this.$refs.carBoxVisible.open() else this.$refs.carBoxVisible.open()
} else { } else {
if (!auto) uni.showLoading({ if (!auto) uni.showLoading({
...@@ -165,11 +171,15 @@ export default { ...@@ -165,11 +171,15 @@ export default {
brandId: e.brandId, brandId: e.brandId,
childBrandId: e.id childBrandId: e.id
}).then(res => { }).then(res => {
if (autoHideLoading) uni.hideLoading() uni.hideLoading()
this.carlist = res this.carlist = res
if (res) uni.setStorageSync(`${e.id}_${e.brandId}_carlist`, res) if (res) uni.setStorageSync(`${e.id}_${e.brandId}_carlist`, res)
if (!carList) { if (!carList) {
if (auto && res.length) this.handleSelect(res[index]) if (auto && res.length) {
if (carId) index = res.findIndex(i => i.id == carId)
if (index < 0) index = 0
this.handleSelect(res[index])
}
else this.$refs.carBoxVisible.open() else this.$refs.carBoxVisible.open()
} }
this.clickFlga = false this.clickFlga = false
......
...@@ -261,7 +261,7 @@ export default { ...@@ -261,7 +261,7 @@ export default {
}) })
this.selectList = [...this.selectList, ..._list] this.selectList = [...this.selectList, ..._list]
}, },
clearCanvas () { clearCanvas () {
this.$refs.caseCanvas.clearBoard() this.$refs.caseCanvas.clearBoard()
}, },
}, },
...@@ -310,6 +310,7 @@ export default { ...@@ -310,6 +310,7 @@ export default {
background: #ffffff; background: #ffffff;
border-radius: 16rpx; border-radius: 16rpx;
padding: 16rpx 0; padding: 16rpx 0;
animation: show-view-opacity 0.15s forwards;
.type-item { .type-item {
padding: 0 24rpx; padding: 0 24rpx;
margin-bottom: 8rpx; margin-bottom: 8rpx;
......
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
import NP from 'number-precision' import NP from 'number-precision'
export default { export default {
props: { props: {
currentCar: String, currentCar: [Number, String],
show: Boolean show: Boolean
}, },
data () { data () {
...@@ -103,7 +103,6 @@ export default { ...@@ -103,7 +103,6 @@ export default {
currentCar: { currentCar: {
immediate: true, immediate: true,
handler (newval) { handler (newval) {
console.log(newval)
this.optionalsList = [] this.optionalsList = []
this.init() this.init()
} }
......
...@@ -14,19 +14,22 @@ ...@@ -14,19 +14,22 @@
@click.stop="showSelect" @click.stop="showSelect"
> >
{{currentCarString}} {{currentCarString}}
<view class="sprite-icon icon-arrow-bottom" v-if="carList.length > 1 && !change_disabled"></view> <view
class="sprite-icon icon-arrow-bottom"
v-if="carList.length > 1 && !change_disabled"
></view>
</view> </view>
<view <view
class="pop-box" class="pop-box"
v-show="isSelect" v-show="isSelect"
> >
<view <template v-for="(i,index) in carList">
v-for="i in carList" <view
:key="i.label" :key="i.carModelId"
class="type-item flex" :class="['type-item flex',{active:i.carModelId == currentCarId},{'has-line':showLine(i,index)},{'is-first':index == 0}]"
:class="i == currentCarString ? 'active' : ''" @click="changeCar(i)"
@click="changeCar(i)" >{{i.carModelName}}</view>
>{{i}}</view> </template>
</view> </view>
</view> </view>
<view <view
...@@ -59,7 +62,7 @@ ...@@ -59,7 +62,7 @@
<view class="right-content"> <view class="right-content">
<view :class="['sku-box',isPreview ? 'preview' : '']"> <view :class="['sku-box',isPreview ? 'preview' : '']">
<sku-box <sku-box
:currentCar="currentCarString" :currentCar="currentCarId"
:defaultTabId="tabId" :defaultTabId="tabId"
:show="show && tabIndex == 0" :show="show && tabIndex == 0"
@changePreView="changePreView" @changePreView="changePreView"
...@@ -75,7 +78,7 @@ ...@@ -75,7 +78,7 @@
</view> </view>
<optional-table <optional-table
v-show="tabIndex == 1" v-show="tabIndex == 1"
:currentCar="currentCarString" :currentCar="currentCarId"
:show="show && tabIndex == 1" :show="show && tabIndex == 1"
></optional-table> ></optional-table>
<template v-if="hasOptionals"> <template v-if="hasOptionals">
...@@ -116,9 +119,6 @@ import CarBrands from '@/components/CarBrands.vue' ...@@ -116,9 +119,6 @@ import CarBrands from '@/components/CarBrands.vue'
import CouponPop from './CouponPop.vue' import CouponPop from './CouponPop.vue'
import RiskInformedBox from './RiskInformedBox.vue' import RiskInformedBox from './RiskInformedBox.vue'
import OptionalTable from './OptionalTable.vue' import OptionalTable from './OptionalTable.vue'
const m5 = require("@/assets/images/boutique/index/m5.png")
const m7 = require("@/assets/images/boutique/index/m7.png")
const m9 = require("@/assets/images/boutique/index/m9.png")
export default { export default {
name: 'Reception', name: 'Reception',
components: { SkuBox, CarBrands, CouponPop, RiskInformedBox, OptionalTable }, components: { SkuBox, CarBrands, CouponPop, RiskInformedBox, OptionalTable },
...@@ -126,7 +126,7 @@ export default { ...@@ -126,7 +126,7 @@ export default {
customerType: Number, customerType: Number,
show: Boolean, show: Boolean,
tabId: Number, tabId: Number,
currentCar: String, propCarId: [Number, String],
type: String, type: String,
popupImg: String, popupImg: String,
madiaId: Number, madiaId: Number,
...@@ -143,6 +143,7 @@ export default { ...@@ -143,6 +143,7 @@ export default {
tabs: ['加装', '选装'], tabs: ['加装', '选装'],
tabIndex: 0, tabIndex: 0,
isSelect: false, isSelect: false,
currentCarId: ''
} }
}, },
watch: { watch: {
...@@ -152,13 +153,14 @@ export default { ...@@ -152,13 +153,14 @@ export default {
this.customerInfo = newval this.customerInfo = newval
} }
}, },
currentCar: { propCarId: {
immediate: true, immediate: true,
handler (newval) { handler (newval) {
this.currentCarString = newval this.currentCarId = newval
this.currentCarString = this.carList.find(e => e.carModelId == newval)?.carModelName || ''
} }
}, },
currentCarString: { currentCarId: {
immediate: true, immediate: true,
handler (newval) { handler (newval) {
if (!this.hasOptionals && this.tabIndex == 1) this.tabIndex = 0 if (!this.hasOptionals && this.tabIndex == 1) this.tabIndex = 0
...@@ -166,7 +168,8 @@ export default { ...@@ -166,7 +168,8 @@ export default {
uni.showLoading({ uni.showLoading({
mask: true mask: true
}) })
this.$refs.carBrandRef.autoSelect(this.carList.findIndex(e => e == newval), false) let item = this.carList.find(e => e.carModelId == newval)
this.$refs.carBrandRef.selectCar(item, true, newval)
} }
} }
}, },
...@@ -196,21 +199,18 @@ export default { ...@@ -196,21 +199,18 @@ export default {
watchCustomerInfo () { watchCustomerInfo () {
return this.$store.state.user.customerInfo return this.$store.state.user.customerInfo
}, },
currentIndex () {
return this.carList.findIndex(e => e == this.currentCarString)
},
isPreview () { isPreview () {
return this.type == 'preview' return this.type == 'preview'
}, },
couponText () { couponText () {
return this.customerType == 0 ? '查看客户券码' : '为客户发券' return this.customerType == 0 ? '查看客户券码' : '为客户发券'
}, },
change_disabled () {
return this.customerType == 0 || this.couponPopupRef.pageParams.QRURL
},
couponPopupRef () { couponPopupRef () {
return this.$refs.couponPopup return this.$refs.couponPopup
}, },
change_disabled () {
return this.customerType == 0 || this.$refs?.couponPopup?.pageParams.QRURL
},
receptionTrack () { receptionTrack () {
return this.$store.state.user.receptionTrack return this.$store.state.user.receptionTrack
}, },
...@@ -219,23 +219,19 @@ export default { ...@@ -219,23 +219,19 @@ export default {
}, },
hasOptionals () { hasOptionals () {
let flag = false let flag = false
if (this.show) flag = this.boutiqueMediaConfig[this.currentCarString].optionals && this.boutiqueMediaConfig[this.currentCarString].optionals.length if (this.show) flag = this.boutiqueMediaConfig[this.currentCarId].optionals && this.boutiqueMediaConfig[this.currentCarId].optionals.length
return flag return flag
}, },
carList () { carList () {
let { boutiqueMediaConfig } = this, return this.$store.state.user.boutiqueCarList
carList = []
Object.keys(boutiqueMediaConfig).map(e => carList.push(e))
console.log(carList)
return carList
} }
}, },
methods: { methods: {
changeCar (item) { changeCar (item) {
if (this.change_disabled || this.currentCarString == item) return uni.hideLoading() if (this.change_disabled || this.currentCarId == item.carModelId) return uni.hideLoading()
this.currentCarString = item this.currentCarString = item.carModelName
this.currentCarId = item.carModelId
this.isSelect = false this.isSelect = false
this.updateViewKey = Date.now() this.updateViewKey = Date.now()
this.clearCanvas() this.clearCanvas()
...@@ -309,9 +305,15 @@ export default { ...@@ -309,9 +305,15 @@ export default {
else this.$refs.sku.changeCar(this.currentCarString) else this.$refs.sku.changeCar(this.currentCarString)
this.clearCanvas() this.clearCanvas()
}, },
showSelect(){ showSelect () {
if(this.carList.length == 1 || this.change_disabled) return if (this.carList.length == 1 || this.change_disabled) return
this.isSelect = !this.isSelect this.isSelect = !this.isSelect
},
showLine (item, index) {
let result = true,
{ carList } = this
if (index != 0 && item.id == carList[index - 1].id) result = false
return result
} }
} }
} }
...@@ -361,12 +363,17 @@ export default { ...@@ -361,12 +363,17 @@ export default {
left: 50%; left: 50%;
transform: translateX(-50%); transform: translateX(-50%);
padding: 12rpx 0; padding: 12rpx 0;
animation: show-view-opacity 0.15s forwards;
.type-item { .type-item {
padding: 0 24rpx; padding: 0 24rpx;
margin-bottom: 8rpx; margin: 8rpx 0;
height: 56rpx; height: 56rpx;
color: #292d33; color: #292d33;
font-size: 28rpx; font-size: 28rpx;
position: relative;
&:first-child {
margin-top: 0;
}
&:last-child { &:last-child {
margin-bottom: 0; margin-bottom: 0;
} }
...@@ -374,6 +381,24 @@ export default { ...@@ -374,6 +381,24 @@ export default {
background-color: #ecf1ff; background-color: #ecf1ff;
} }
} }
.has-line {
margin-top: 18rpx;
&::after {
content: '';
width: calc(100% - 48rpx);
height: 2rpx;
background: #f5f5f5;
position: absolute;
left: 50%;
top: -10rpx;
transform: translateX(-50%);
}
}
.is-first {
&::after {
display: none;
}
}
} }
} }
.content-box { .content-box {
......
...@@ -87,7 +87,7 @@ export default { ...@@ -87,7 +87,7 @@ export default {
name: 'SkuBox', name: 'SkuBox',
props: { props: {
defaultTabId: Number, defaultTabId: Number,
currentCar: String, currentCar: [Number,String],
show: Boolean show: Boolean
}, },
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
:show="id == item.id" :show="id == item.id"
@reception="reception" @reception="reception"
:tabId="tabId" :tabId="tabId"
:currentCar="currentCar" :propCarId="currentCarId"
:type="type" :type="type"
:popupImg="item.popupImg" :popupImg="item.popupImg"
@preview="onPreview" @preview="onPreview"
...@@ -118,7 +118,7 @@ export default { ...@@ -118,7 +118,7 @@ export default {
customerType: Number, customerType: Number,
toolList: Array, toolList: Array,
tabId: Number, tabId: Number,
currentCar: String currentCarId: [Number, String]
}, },
mixins: [receptionTrackMixin], mixins: [receptionTrackMixin],
data () { data () {
...@@ -210,7 +210,8 @@ export default { ...@@ -210,7 +210,8 @@ export default {
salesUuid: item.userId, salesUuid: item.userId,
staffName: item.employeeName, staffName: item.employeeName,
receiveCouponDate: item.receiveCouponDate, receiveCouponDate: item.receiveCouponDate,
customerCouponId: item.customerCouponId customerCouponId: item.customerCouponId,
carSeriesId: item.carSeriesId
} }
let [reception] = this.$refs.media1 let [reception] = this.$refs.media1
reception?.clearCustomerReceivedTimer() reception?.clearCustomerReceivedTimer()
......
...@@ -127,7 +127,11 @@ export default { ...@@ -127,7 +127,11 @@ export default {
watch: { watch: {
show: { show: {
handler (val) { handler (val) {
if (val) this.init() if (val) {
this.flag = false
this.list = []
this.init()
}
this.$refs.receptionTips?.close() this.$refs.receptionTips?.close()
}, },
immediate: true immediate: true
...@@ -137,7 +141,6 @@ export default { ...@@ -137,7 +141,6 @@ export default {
methods: { methods: {
init () { init () {
this.customerNameOrPhone = ''; this.customerNameOrPhone = '';
console.log('init')
setTimeout(() => { setTimeout(() => {
this.isSearch = false this.isSearch = false
this.pageNum = 1 this.pageNum = 1
......
...@@ -24,11 +24,8 @@ export default { ...@@ -24,11 +24,8 @@ export default {
employeeList: [], employeeList: [],
paymentType: [], paymentType: [],
haveCustomerAccess: false, haveCustomerAccess: false,
boutiqueMediaConfig: { boutiqueMediaConfig: {},
M5: [], boutiqueCarList:[],
M7: [],
M9: []
},
receptionTrack: {}, //接待记录埋点 receptionTrack: {}, //接待记录埋点
boutiqueDefaultCarBrandId: '' boutiqueDefaultCarBrandId: ''
}; };
...@@ -81,7 +78,7 @@ export default { ...@@ -81,7 +78,7 @@ export default {
}, },
setReceptionTrack ({ state }, { key, value }) { setReceptionTrack ({ state }, { key, value }) {
state.receptionTrack[key] = value state.receptionTrack[key] = value
console.log(JSON.parse(JSON.stringify(state.receptionTrack))) // console.log(JSON.parse(JSON.stringify(state.receptionTrack)))
}, },
clearReceptionTrack ({ state }) { clearReceptionTrack ({ state }) {
state.receptionTrack = {} state.receptionTrack = {}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!