Commit b5203313 by 李伟康

commit 轻改需求

1 parent da0bd622
......@@ -98,15 +98,12 @@ export default {
mounted () {
},
methods: {
autoSelect (index = 0, autoHideLoading = true) {
autoSelect () {
const { carBrandList, boutiqueDefaultCarBrandId } = this
let carIndex = 0
if (boutiqueDefaultCarBrandId) {
carIndex = carBrandList.findIndex(e => e.id == boutiqueDefaultCarBrandId)
if (carIndex < 0) carIndex = 0
}
if (index < 0) index = 0
if (carBrandList.length) this.selectCar(carBrandList[carIndex], true, index, autoHideLoading)
if (boutiqueDefaultCarBrandId) carIndex = carBrandList.findIndex(e => e.id == boutiqueDefaultCarBrandId)
if (carIndex < 0) carIndex = 0
if (carBrandList.length) this.selectCar(carBrandList[carIndex], true)
},
open () {
const userInfo = uni.$storage.get("userInfo"),
......@@ -140,8 +137,13 @@ export default {
this.$refs.carBrandListVisible.open()
this.carBrandListOff = true
},
selectCar (e, auto = false, index, autoHideLoading = true) {
let { clickFlga } = this
selectCar (e, auto = false, carId) {
if (!e.brandId || !e.id) return uni.showToast({
title: "车型ID或品牌ID为空",
icon: "none",
});
let { clickFlga } = this,
index = 0
if (clickFlga) return
this.clickFlga = true
this.selectItem = {
......@@ -154,7 +156,11 @@ export default {
if (carList) {
this.clickFlga = false
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 {
if (!auto) uni.showLoading({
......@@ -165,11 +171,15 @@ export default {
brandId: e.brandId,
childBrandId: e.id
}).then(res => {
if (autoHideLoading) uni.hideLoading()
uni.hideLoading()
this.carlist = res
if (res) uni.setStorageSync(`${e.id}_${e.brandId}_carlist`, res)
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()
}
this.clickFlga = false
......
......@@ -261,7 +261,7 @@ export default {
})
this.selectList = [...this.selectList, ..._list]
},
clearCanvas () {
clearCanvas () {
this.$refs.caseCanvas.clearBoard()
},
},
......@@ -310,6 +310,7 @@ export default {
background: #ffffff;
border-radius: 16rpx;
padding: 16rpx 0;
animation: show-view-opacity 0.15s forwards;
.type-item {
padding: 0 24rpx;
margin-bottom: 8rpx;
......
......@@ -83,7 +83,7 @@
import NP from 'number-precision'
export default {
props: {
currentCar: String,
currentCar: [Number, String],
show: Boolean
},
data () {
......@@ -103,7 +103,6 @@ export default {
currentCar: {
immediate: true,
handler (newval) {
console.log(newval)
this.optionalsList = []
this.init()
}
......
......@@ -14,19 +14,22 @@
@click.stop="showSelect"
>
{{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
class="pop-box"
v-show="isSelect"
>
<view
v-for="i in carList"
:key="i.label"
class="type-item flex"
:class="i == currentCarString ? 'active' : ''"
@click="changeCar(i)"
>{{i}}</view>
<template v-for="(i,index) in carList">
<view
:key="i.carModelId"
:class="['type-item flex',{active:i.carModelId == currentCarId},{'has-line':showLine(i,index)},{'is-first':index == 0}]"
@click="changeCar(i)"
>{{i.carModelName}}</view>
</template>
</view>
</view>
<view
......@@ -59,7 +62,7 @@
<view class="right-content">
<view :class="['sku-box',isPreview ? 'preview' : '']">
<sku-box
:currentCar="currentCarString"
:currentCar="currentCarId"
:defaultTabId="tabId"
:show="show && tabIndex == 0"
@changePreView="changePreView"
......@@ -75,7 +78,7 @@
</view>
<optional-table
v-show="tabIndex == 1"
:currentCar="currentCarString"
:currentCar="currentCarId"
:show="show && tabIndex == 1"
></optional-table>
<template v-if="hasOptionals">
......@@ -116,9 +119,6 @@ import CarBrands from '@/components/CarBrands.vue'
import CouponPop from './CouponPop.vue'
import RiskInformedBox from './RiskInformedBox.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 {
name: 'Reception',
components: { SkuBox, CarBrands, CouponPop, RiskInformedBox, OptionalTable },
......@@ -126,7 +126,7 @@ export default {
customerType: Number,
show: Boolean,
tabId: Number,
currentCar: String,
propCarId: [Number, String],
type: String,
popupImg: String,
madiaId: Number,
......@@ -143,6 +143,7 @@ export default {
tabs: ['加装', '选装'],
tabIndex: 0,
isSelect: false,
currentCarId: ''
}
},
watch: {
......@@ -152,13 +153,14 @@ export default {
this.customerInfo = newval
}
},
currentCar: {
propCarId: {
immediate: true,
handler (newval) {
this.currentCarString = newval
this.currentCarId = newval
this.currentCarString = this.carList.find(e => e.carModelId == newval)?.carModelName || ''
}
},
currentCarString: {
currentCarId: {
immediate: true,
handler (newval) {
if (!this.hasOptionals && this.tabIndex == 1) this.tabIndex = 0
......@@ -166,7 +168,8 @@ export default {
uni.showLoading({
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 {
watchCustomerInfo () {
return this.$store.state.user.customerInfo
},
currentIndex () {
return this.carList.findIndex(e => e == this.currentCarString)
},
isPreview () {
return this.type == 'preview'
},
couponText () {
return this.customerType == 0 ? '查看客户券码' : '为客户发券'
},
change_disabled () {
return this.customerType == 0 || this.couponPopupRef.pageParams.QRURL
},
couponPopupRef () {
return this.$refs.couponPopup
},
change_disabled () {
return this.customerType == 0 || this.$refs?.couponPopup?.pageParams.QRURL
},
receptionTrack () {
return this.$store.state.user.receptionTrack
},
......@@ -219,23 +219,19 @@ export default {
},
hasOptionals () {
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
},
carList () {
let { boutiqueMediaConfig } = this,
carList = []
Object.keys(boutiqueMediaConfig).map(e => carList.push(e))
console.log(carList)
return carList
return this.$store.state.user.boutiqueCarList
}
},
methods: {
changeCar (item) {
if (this.change_disabled || this.currentCarString == item) return uni.hideLoading()
this.currentCarString = item
if (this.change_disabled || this.currentCarId == item.carModelId) return uni.hideLoading()
this.currentCarString = item.carModelName
this.currentCarId = item.carModelId
this.isSelect = false
this.updateViewKey = Date.now()
this.clearCanvas()
......@@ -309,9 +305,15 @@ export default {
else this.$refs.sku.changeCar(this.currentCarString)
this.clearCanvas()
},
showSelect(){
if(this.carList.length == 1 || this.change_disabled) return
showSelect () {
if (this.carList.length == 1 || this.change_disabled) return
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 {
left: 50%;
transform: translateX(-50%);
padding: 12rpx 0;
animation: show-view-opacity 0.15s forwards;
.type-item {
padding: 0 24rpx;
margin-bottom: 8rpx;
margin: 8rpx 0;
height: 56rpx;
color: #292d33;
font-size: 28rpx;
position: relative;
&:first-child {
margin-top: 0;
}
&:last-child {
margin-bottom: 0;
}
......@@ -374,6 +381,24 @@ export default {
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 {
......
......@@ -87,7 +87,7 @@ export default {
name: 'SkuBox',
props: {
defaultTabId: Number,
currentCar: String,
currentCar: [Number,String],
show: Boolean
},
......
......@@ -42,7 +42,7 @@
:show="id == item.id"
@reception="reception"
:tabId="tabId"
:currentCar="currentCar"
:propCarId="currentCarId"
:type="type"
:popupImg="item.popupImg"
@preview="onPreview"
......@@ -118,7 +118,7 @@ export default {
customerType: Number,
toolList: Array,
tabId: Number,
currentCar: String
currentCarId: [Number, String]
},
mixins: [receptionTrackMixin],
data () {
......@@ -210,7 +210,8 @@ export default {
salesUuid: item.userId,
staffName: item.employeeName,
receiveCouponDate: item.receiveCouponDate,
customerCouponId: item.customerCouponId
customerCouponId: item.customerCouponId,
carSeriesId: item.carSeriesId
}
let [reception] = this.$refs.media1
reception?.clearCustomerReceivedTimer()
......
......@@ -30,27 +30,36 @@
</template>
</view>
<view class="center-bg"></view>
<view class="banner-tab-box-content">
<view class="banner-tab-box flex">
<template v-for="(item, index) in carBannerList">
<view
:class="['banner-item',{'has-title':showCarBrand(item,index)},{'is-first':index == 0}]"
:key="index"
>
<view class="banner-title">{{item.title}}</view>
<view class="banner-tab-scroll">
<scroll-view
class="banner-tab-box-content"
scroll-x
:scroll-into-view="bannerTabId"
scroll-with-animation
>
<view class="banner-tab-box flex">
<template v-for="(item, index) in carBannerList">
<view
:class="['banner-tab', `${currentIndex == index ? 'active' : ''}`]"
@click="changeIndex(index)"
:class="['banner-item',{'has-title':showCarBrand(item,index)},{'is-first':index == 0}]"
:key="index"
:id="`car-banner-${index}`"
>
{{ item.name }}
<view class="banner-title">{{item.title}}</view>
<view
:class="['banner-tab', `${currentIndex == index ? 'active' : ''}`]"
@click="changeIndex(index)"
>
{{ item.name }}
</view>
</view>
</view>
</template>
</view>
</template>
<view class="block"></view>
</view>
</scroll-view>
<view class="banner-tab-mask"></view>
</view>
<!-- :autoplay="bannerAutoplay && !previewOff" -->
<swiper
class="swiper"
circular
......@@ -59,7 +68,9 @@
next-margin="448rpx"
@change="swiperChange"
:current="currentIndex"
:autoplay="bannerAutoplay && !previewOff"
>
<!-- :autoplay="bannerAutoplay && !previewOff" -->
<template v-for="(item, index) in carBannerList">
<swiper-item
:key="index"
......@@ -108,7 +119,7 @@
:customerType.sync="customerType"
@reception="reception"
:tabId.sync="tabId"
:currentCar="currentCar"
:currentCarId="currentCarId"
/>
</template>
<template slot="content">
......@@ -165,11 +176,13 @@ export default {
tabId: 1,
recording: false,
carBannerList: [],
currentCar: '',
currentCarId: '',
currentIndex: 0,
bannerAutoplay: true,
previewOff: false,
mediaConfigList: []
mediaConfigList: [],
bannerTabId: 'car-banner-0',
defaultCarId: ''
}
},
onBackPress (options) {
......@@ -243,43 +256,55 @@ export default {
}).then(({ materials, hidePackage }) => {
uni.hideLoading()
let boutiqueMediaConfig = {},
carBannerList = []
carBannerList = [],
boutiqueCarList = []
materials.map(e => {
if (e.carModelName) {
if (e && e.carModelName && e.carModelId) {
const configItems = [
{ key: 'films', configIndex: 1 },
{ key: 'products', configIndex: 2 }
]
let retrofitting = []
carBannerList.push({
title: e.brandName || '',
url: e.carModelDisplayImgUrl || '',
name: e.carModelName
title: e.seriesName || e.brandName || '',
url: e.modelDisplayPicurl || '',
name: e.carModelName,
carModelId: e.carModelId,
seriesId: e.seriesId,
})
boutiqueMediaConfig[e.carModelId] = {}
boutiqueCarList.push({
carModelName: e.carModelName,
carModelId: e.carModelId,
brandId: e.brandId,
brandName: e.brandName,
name: e.seriesName,
id: e.seriesId,
})
boutiqueMediaConfig[e.carModelName] = {}
if (!hidePackage) configItems.unshift({ key: 'packages', configIndex: 0 })
configItems.map(item => {
retrofitting.push({
...defaultConfig[item.configIndex],
list: e[item.key],
})
boutiqueMediaConfig[e.carModelName].retrofitting = retrofitting
boutiqueMediaConfig[e.carModelId].retrofitting = retrofitting
})
e.optionals?.map(item => {
item.checked = false
item.warranty = item.warranty?.replace(/<\/?br\s*\/?>|\n/g, '<br>')
})
boutiqueMediaConfig[e.carModelName].optionals = e.optionals
boutiqueMediaConfig[e.carModelId].optionals = e.optionals
}
})
this.carBannerList = carBannerList.map(e => {
let configList = []
if (boutiqueMediaConfig[e.name]) configList = boutiqueMediaConfig[e.name].retrofitting
if (boutiqueMediaConfig[e.carModelId]) configList = boutiqueMediaConfig[e.carModelId].retrofitting
e.configList = configList
return e
})
this.$store.state.user.boutiqueMediaConfig = boutiqueMediaConfig
this.$store.state.user.boutiqueCarList = boutiqueCarList
}).catch(error => {
console.log(error)
uni.hideLoading()
......@@ -292,10 +317,10 @@ export default {
},
// 查询素材
async getSoure () {
let { moduleList, toolList, boutiqueDefaultCarBrandId } = await uni.$api.systemApi.getBoutiqueMockData(true)
let { moduleList, toolList, defaultCarId } = await uni.$api.systemApi.getBoutiqueMockData(true)
this.moduleList = moduleList
this.toolList = toolList
this.$store.state.user.boutiqueDefaultCarBrandId = boutiqueDefaultCarBrandId
this.defaultCarId = defaultCarId
},
toDetail (item) {
this.chooseItem = item
......@@ -311,7 +336,7 @@ export default {
this.type = "preview";
this.id = id;
this.tabId = tabId
this.currentCar = this.carBannerList[this.currentIndex].name
this.currentCarId = this.carBannerList[this.currentIndex].carModelId
},
back () {
if (!this.id) return uni.navigateBack();
......@@ -331,7 +356,7 @@ export default {
this.$refs.detail.clearCustomerReceivedTimer()
this.id = "";
this.type = "";
this.currentCar = ''
this.currentCarId = ''
this.bannerAutoplay = true
this.previewOff = false
this.customerType = -1
......@@ -356,11 +381,11 @@ export default {
},
jumpPage (id) {
let { carBannerList } = this,
carIndex = 1
if (carBannerList.length == 1) carIndex = 0
carIndex = carBannerList.findIndex(e => e.carModelId == this.defaultCarId)
if (carBannerList.length == 1 || carIndex < 0) carIndex = 0 //只有一个车型或者默认车型没有时
this.id = id ? id : this.moduleList[0].id
this.tabId = 1
this.currentCar = carBannerList[carIndex].name
this.currentCarId = carBannerList[carIndex].carModelId
this.type = "edit"
},
clearHistory () {
......@@ -390,7 +415,7 @@ export default {
setTimeout(() => {
this.id = "";
this.type = "";
this.currentCar = ''
this.currentCarId = ''
this.bannerAutoplay = true
this.customerType = -1
this.setReceptionStatus(e);
......@@ -400,7 +425,7 @@ export default {
},
/**客户邀约接待 */
reception (customer) {
this.currentCar = ''
this.currentCarId = ''
this.$nextTick(() => {
let { customerType } = this
if (customerType == -1) this.start(false) //开始接待
......@@ -408,17 +433,20 @@ export default {
this.jumpPage()
this.$nextTick(() => this.$store.dispatch('setCustomerInfo', customer))
let { carBannerList } = this,
carIndex = 1
if (carBannerList.length == 1) carIndex = 0 //只有一个车型时
currentCar = carBannerList[carIndex].name
carBannerList.map(i => {
if (customer.carModel.includes(i.name)) currentCar = i.name
})
this.currentCar = currentCar
currentCarId = '',
carIndex = carBannerList.findIndex(e => e.carModelId == this.defaultCarId)
/**优先判断客户车型是否在banner中,没有则取默认车型 */
if (carBannerList.findIndex(e => e.carModelId == customer.carSeriesId) != -1) currentCarId = customer.carSeriesId
else {
if (carBannerList.length == 1 || carIndex < 0) carIndex = 0 //只有一个车型或者默认M7没有时
currentCarId = carBannerList[carIndex].carModelId
}
this.currentCarId = currentCarId
})
},
swiperChange (e) {
this.currentIndex = e.detail.current
this.bannerTabId = `car-banner-${e.detail.current}`
},
carClass (index) {
let className = this.currentIndex == index ? 'current-item' : ''
......@@ -443,7 +471,7 @@ export default {
showCarBrand (item, index) {
let result = true,
{ carBannerList } = this
if (index != 0 && item.title == carBannerList[index - 1].title) result = false
if (index != 0 && item.seriesId == carBannerList[index - 1].seriesId) result = false
return result
}
}
......@@ -481,87 +509,91 @@ export default {
}
}
}
.banner-tab-box-content {
.banner-tab-scroll {
width: 1080rpx;
position: relative;
.banner-tab-box {
padding: 32rpx 0 40rpx;
overflow: auto hidden;
flex-wrap: nowrap;
height: 146rpx;
.banner-item {
position: relative;
.banner-tab-box-content {
width: 100%;
.block {
width: 30rpx;
height: 100%;
flex-shrink: 0;
.banner-title {
color: #333333b3;
font-size: 24rpx;
font-weight: 400;
height: 30rpx;
padding-bottom: 8rpx;
opacity: 0;
}
}
.has-title {
padding-left: 40rpx;
.banner-title {
opacity: 1;
.banner-tab-box {
padding: 32rpx 0 20rpx;
height: 126rpx;
.banner-item {
position: relative;
flex-shrink: 0;
.banner-title {
color: #333333b3;
font-size: 24rpx;
font-weight: 400;
height: 30rpx;
margin-bottom: 8rpx;
opacity: 0;
}
}
.has-title {
padding-left: 40rpx;
.banner-title {
opacity: 1;
}
&::after {
position: absolute;
width: 2rpx;
height: 32rpx;
background: #cccccc;
left: 0;
top: 42rpx;
content: '';
}
}
&::after {
position: absolute;
width: 2rpx;
height: 32rpx;
background: #cccccc;
left: 0;
top: 40rpx;
content: '';
.is-first {
padding-left: 0;
&::after {
display: none;
}
}
}
.is-first {
padding-left: 0;
&::after {
display: none;
.banner-tab {
margin-right: 40rpx;
font-weight: 500;
font-size: 36rpx;
color: #333333b3;
line-height: 44rpx;
box-sizing: border-box;
position: relative;
text-align: center;
}
}
.banner-tab {
margin-right: 40rpx;
font-weight: 500;
font-size: 36rpx;
color: #333333b3;
line-height: 44rpx;
min-width: 60rpx;
box-sizing: border-box;
position: relative;
}
.active {
font-weight: 700;
color: #333333;
transition: all 1s;
&::after {
content: '';
position: absolute;
left: 50%;
width: 8rpx;
height: 8rpx;
background: #333333;
border-radius: 100%;
transform: translateX(-50%);
animation: show-dot 0.15s forwards;
}
@keyframes show-dot {
0% {
bottom: 16rpx;
.active {
font-weight: 700;
color: #333333;
&::after {
content: '';
position: absolute;
left: 50%;
width: 8rpx;
height: 8rpx;
background: #333333;
border-radius: 100%;
transform: translateX(-50%);
animation: show-dot 0.15s forwards;
}
100% {
bottom: -16rpx;
@keyframes show-dot {
0% {
bottom: 16rpx;
}
100% {
bottom: -16rpx;
}
}
}
}
}
.banner-tab-mask {
width: 140rpx;
height: 100%;
height: calc(100% - 20rpx);
opacity: 1;
background: linear-gradient(270deg, #e9edfa 0%, #e9edfa00 100%);
position: absolute;
......
......@@ -127,7 +127,11 @@ export default {
watch: {
show: {
handler (val) {
if (val) this.init()
if (val) {
this.flag = false
this.list = []
this.init()
}
this.$refs.receptionTips?.close()
},
immediate: true
......@@ -137,7 +141,6 @@ export default {
methods: {
init () {
this.customerNameOrPhone = '';
console.log('init')
setTimeout(() => {
this.isSearch = false
this.pageNum = 1
......
......@@ -24,11 +24,8 @@ export default {
employeeList: [],
paymentType: [],
haveCustomerAccess: false,
boutiqueMediaConfig: {
M5: [],
M7: [],
M9: []
},
boutiqueMediaConfig: {},
boutiqueCarList:[],
receptionTrack: {}, //接待记录埋点
boutiqueDefaultCarBrandId: ''
};
......@@ -81,7 +78,7 @@ export default {
},
setReceptionTrack ({ state }, { key, value }) {
state.receptionTrack[key] = value
console.log(JSON.parse(JSON.stringify(state.receptionTrack)))
// console.log(JSON.parse(JSON.stringify(state.receptionTrack)))
},
clearReceptionTrack ({ state }) {
state.receptionTrack = {}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!