Commit 02b8e1d2 by Lin

Merge branch 'saas+v5.8.3' of http://192.168.3.233:8090/glsx/gl_tape into saas+v5.8.3

2 parents 2484c906 80f0150d
......@@ -8,9 +8,9 @@
<view class="header-item action-col">操作</view>
</view>
<template v-if="loadComplete">
<template v-if="list.length">
<template v-if="tableData.length">
<scroll-view class="table-body" scroll-y @scrolltolower="$emit('loadMore')">
<view v-for="(item, index) in list" :key="index" class="table-row">
<view v-for="(item, index) in tableData" :key="index" class="table-row">
<view class="row-item customer-col">
<view class="customer-info">
<view class="avatar">{{ getAvatar(item.customerName) }}</view>
......@@ -86,13 +86,18 @@ export default {
watch: {
list: {
handler(val) {
this.$nextTick(() => {
let query = uni.createSelectorQuery().in(this)
this.tableData = val
setTimeout(() => {
val.forEach((item, index) => {
this.showTagMore(item.tags, index)
query.select(`#tag-list-${index}`).boundingClientRect((data) => {
this.showTagMore(item.tagList, index, data)
}).exec()
})
})
}, 100)
},
immediate: true,
// immediate: true,
deep: true
}
},
......@@ -133,29 +138,33 @@ export default {
orderHandleTime(time) {
return time ? dayjs(time).format('YYYY-MM-DD') : ''
},
showTagMore(tags, index) {
let query = uni.createSelectorQuery(),
listItem = null,
showTagMore(tags, index, listItem) {
let query = uni.createSelectorQuery().in(this),
_this = this,
targetIndex = 0
if (this.tableData[index] && this.tableData[index].hasMoreTags) return
this.$nextTick(() => {
try {
query.select(`#tag-list-${index}`).boundingClientRect((data) => {
listItem = data
}).exec()
tags?.forEach((tag, tagIndex) => {
query.select(`#tag-${index}-${tagIndex}`).boundingClientRect((data) => {
if (listItem && data.top > (listItem.height + listItem.top) && !targetIndex) targetIndex = tagIndex - 1
const promise = new Promise((resolve, reject) => {
tags?.map((tag, tagIndex) => {
query.select(`#tag-${index}-${tagIndex}`).boundingClientRect((data) => {
if (listItem && data.top > (listItem.height + listItem.top) && !targetIndex) {
targetIndex = tagIndex - 1
}
if (targetIndex) resolve(targetIndex)
}).exec()
})
})
promise.then(cutIndex => {
query.select(`#tag-${index}-${cutIndex}`).boundingClientRect((data) => {
let listWidth = listItem.left + listItem.width,
cutWidth = data.left + data.width
if (cutWidth + 34 < listWidth) cutIndex += 1
_this.$set(_this.tableData[index], 'tagList', tags.slice(0, cutIndex))
_this.$set(_this.tableData[index], 'hasMoreTags', true)
}).exec()
})
if (targetIndex != 0) query.select(`#tag-${index}-${targetIndex}`).boundingClientRect((data) => {
let listWidth = listItem.left + listItem.width,
cutWidth = data.left + data.width
if (cutWidth + 34 < listWidth) targetIndex += 1
}).exec()
if (targetIndex) {
this.$set(this.tableData[index], 'tags', tags.slice(0, targetIndex))
this.$set(this.tableData[index], 'hasMoreTags', true)
}
} catch (error) {
console.log(error)
}
......
......@@ -99,8 +99,8 @@ export default {
if (item.taskStatus == 1) taskRecordList.push({
label: '推送结果', key: 'pushResult', format: (status) => {
return {
2: '成功',
3: '失败',
1: '成功',
2: '失败',
}[status] || '-'
}
})
......
......@@ -33,6 +33,7 @@ export default {
tabIndex: Number,
hasBeforeActivity: Boolean,
hasAfterActivity: Boolean,
tabListId: Number,
},
data() {
......@@ -89,8 +90,10 @@ export default {
},
changeCar(newval) {
this.goodsList = []
let { activityData, tabIndex } = this
let carSeriesList = activityData[tabIndex].carSeriesList,
let { activityData, tabListId } = this,
list = activityData.find(e => e.marketingStage == tabListId)
if(!list) return
let carSeriesList = list.carSeriesList,
data = carSeriesList.find(e => e.carSeriesId == newval)
if (data) {
this.goodsIndex = -1
......
......@@ -48,7 +48,7 @@
<view class="sku-box">
<goods-box :currentCar="currentCarId" :activityData="activityData"
:show="show && [0, 1].includes(tabIndex)" @changePreView="currentItem = $event" ref="goodsBox"
:tabIndex="tabIndex" @noActivity="setNoActivity" />
:tabIndex="tabIndex" @noActivity="setNoActivity" :tabListId="tabListId" />
</view>
</template>
<template v-else>
......@@ -67,7 +67,8 @@
<template v-if="tabs.length > 1">
<view class="tabs-box flex">
<template v-for="(i, index) in tabs">
<view :class="['tab flex', { active: index == tabIndex }]" :key="index" @click="changeTab(index)">{{ i
<view :class="['tab flex', { active: index == tabIndex }]" :key="index" @click="changeTab(index)">{{
i.name
}}</view>
</template>
<view :class="['block', `block-${tabIndex}`]"></view>
......@@ -115,7 +116,8 @@ export default {
isSelect: false,
currentCarId: '',
activityData: [],
noActivity: false
noActivity: false,
tabListId: 2
}
},
watch: {
......@@ -135,7 +137,7 @@ export default {
currentCarId: {
immediate: true,
handler(newval) {
if (!this.hasOptionals && this.tabIndex != 0) this.tabIndex = 0
if (this.tabIndex != 0) this.tabIndex = 0
if (this.show && newval && !this.isPreview && this.customerType == 1) {
uni.showLoading({
mask: true
......@@ -158,11 +160,16 @@ export default {
handler(newval) {
if (newval) {
this.isSelect = false
let index = 0
let index = 0,
tabListId = 2
if (this.hasBeforeActivity || this.hasAfterActivity) {
index = 1
tabListId = 1
}
if (this.hasBeforeActivity && this.hasAfterActivity) {
index = 2
tabListId = 0
}
if (this.hasBeforeActivity && this.hasAfterActivity) index = 2
if (newval && this.currentItem && this.tabIndex == index) this.changePreView(this.currentItem, false, false)
}
}
......@@ -175,15 +182,28 @@ export default {
if (newval.length) this.currentItem = null
}
},
hasBeforeActivity: {
immediate: true,
deep: true,
handler(newval) {
let { tabListId } = this
if (newval && tabListId != 0) this.changeTab(0, true, false)
}
},
hasAfterActivity: {
immediate: true,
deep: true,
handler(newval) {
let { tabListId, hasBeforeActivity } = this
if (newval && tabListId != 1 && !hasBeforeActivity) this.changeTab(0, true, false)
}
},
},
computed: {
showActivity() {
let { hasBeforeActivity, hasAfterActivity, tabIndex } = this,
skuIndex = 0
if (hasBeforeActivity || hasAfterActivity) skuIndex = 1
if (hasBeforeActivity && hasAfterActivity) skuIndex = 2
return tabIndex != skuIndex
let { tabListId } = this
return [0, 1].includes(tabListId)
},
watchStatus() {
return this.$store.state.user.historyStatus;
......@@ -225,26 +245,38 @@ export default {
},
tabs() {
let { hasBeforeActivity, hasAfterActivity, hasOptionals } = this,
tabs = ['加装']
if (hasAfterActivity) tabs.unshift('售后钜惠')
if (hasBeforeActivity) tabs.unshift('新享特惠')
if (hasOptionals) tabs.push('选装')
tabs = [{
name: '加装',
id: 2
}]
if (hasAfterActivity) tabs.unshift({
name: '售后钜惠',
id: 1
})
if (hasBeforeActivity) tabs.unshift({
name: '新享特惠',
id: 0
})
if (hasOptionals) tabs.push({
name: '选装',
id: 3
})
return tabs
},
hasBeforeActivity() {
// let { currentCarId } = this,
// hasBeforeActivity = this.activityData.some(e => e.marketingStage == 0),
// hasCar = false
// this.activityData.forEach(e => {
// if (!hasCar) e.carSeriesList.some(e => e.carSeriesId == currentCarId)
// })
// return hasBeforeActivity && hasCar
return this.activityData.some(e => e.marketingStage == 0)
let { currentCarId } = this,
beforeActivityIndex = this.activityData.findIndex(e => e.marketingStage == 0),
hasCar = false
if (!hasCar && beforeActivityIndex > -1) hasCar = this.activityData[beforeActivityIndex].carSeriesList.some(e => e.carSeriesId == currentCarId)
return hasCar
},
hasAfterActivity() {
return this.activityData.some(e => e.marketingStage == 1)
}
let { currentCarId } = this,
afterActivityIndex = this.activityData.findIndex(e => e.marketingStage == 1),
hasCar = false
if (!hasCar && afterActivityIndex > -1) hasCar = this.activityData[afterActivityIndex].carSeriesList.some(e => e.carSeriesId == currentCarId)
return hasCar
},
},
methods: {
......@@ -318,6 +350,7 @@ export default {
if (this.isPreview) return
let key = `${currentItem.carModelName}_${currentItem.id}`,
value = this.receptionTrack[key]
if (!value) return
value.stayDuration += Number(Date.now() - value.entryTime)
this.$store.dispatch("setReceptionTrack", { key, value })
},
......@@ -327,19 +360,20 @@ export default {
clearCanvas() {
this.$refs.receptionCanvas.clearBoard()
},
changeTab(index) {
if (this.tabIndex == index) return
changeTab(index, force = false, changeCar = true) {
if (this.tabIndex == index && !force) return
let skuIndex = 0
if (this.hasBeforeActivity || this.hasAfterActivity) skuIndex = 1
if (this.hasBeforeActivity && this.hasAfterActivity) skuIndex = 2
if (this.tabIndex == skuIndex) this.previewLeave(this.currentItem)
if (this.tabIndex == skuIndex && this.currentItem.carModelName) this.previewLeave(this.currentItem)
let goods = this.$refs.goodsBox
this.tabIndex = index
this.currentItem = null
this.$nextTick(() => {
if (skuIndex == 2 && index < 2) this.$refs.goodsBox.changeCar(this.currentCarId)
if (index == skuIndex) this.$refs.sku.changeCar(this.currentCarId)
this.tabListId = this.tabs[index].id
setTimeout(() => {
if (changeCar && goods && [0, 1].includes(this.tabListId)) goods.changeCar(this.currentCarId)
this.clearCanvas()
})
}, 100)
},
showSelect() {
if (this.carList.length == 1 || this.change_disabled) return
......
<template>
<view class="sku-content">
<view :class="['first-type-box flex',firstClass(list)]">
<view :class="['block',blockClass]"></view>
<template v-for="(i,index) in list">
<view
:class="['first-type-item flex',{active:i.tabId == tabId}]"
:key="index"
@click="changeTabId(i.tabId,index)"
>
<view :class="['sprite-icon',`icon-${i.icon}`]"></view>
{{i.tabName}}
<view :class="['first-type-box flex', firstClass(list)]">
<view :class="['block', blockClass]"></view>
<template v-for="(i, index) in list">
<view :class="['first-type-item flex', { active: i.tabId == tabId }]" :key="index"
@click="changeTabId(i.tabId, index)">
<view :class="['sprite-icon', `icon-${i.icon}`]"></view>
{{ i.tabName }}
</view>
</template>
</view>
<scroll-view
class="second-type-scroll"
scroll-x
enable-flex
>
<scroll-view class="second-type-scroll" scroll-x enable-flex>
<view class="second-type-box flex">
<template v-for="(i,index) in secondList">
<view
:class="['second-type-item flex',secondIndex == index ? 'active' : '']"
:key="index"
@click="secondClick(index)"
>{{i.category}}</view>
<template v-for="(i, index) in secondList">
<view :class="['second-type-item flex', secondIndex == index ? 'active' : '']" :key="index"
@click="secondClick(index)">{{ i.category }}</view>
</template>
<view class="padding-right"></view>
</view>
</scroll-view>
<template v-if="tabId == 2 && secondName == '窗膜'">
<view class="sub-title">品牌</view>
<scroll-view
class="thirdly-type-scroll"
scroll-x
enable-flex
>
<scroll-view class="thirdly-type-scroll" scroll-x enable-flex>
<view class="thirdly-type-box flex">
<template v-for="(i,index) in brandList">
<view
:class="['thirdly-type-item flex',thirdlyIndex == index ? 'active' : '']"
:key="index"
@click="thirdlyClick(index)"
>{{i.brandName}}</view>
<template v-for="(i, index) in brandList">
<view :class="['thirdly-type-item flex', thirdlyIndex == index ? 'active' : '']" :key="index"
@click="thirdlyClick(index)">{{ i.brandName }}</view>
</template>
<view class="padding-right"></view>
</view>
......@@ -51,20 +34,12 @@
</template>
<template v-if="flagObject.goodsFlag">
<template v-if="goodsList.length">
<scroll-view
scroll-y
class="content-scroll-box"
id="content-scroll"
:style="{height:contentHeight}"
:scroll-top="flagObject.scrollTop"
>
<template v-for="(i,index) in goodsList">
<view
:class="['goods-item',goodsIndex == index ? 'active' : '']"
:key="index"
@click="changeGoods(i,index)"
>
<view class="goods-title">{{i.name}}</view>
<scroll-view scroll-y class="content-scroll-box" id="content-scroll" :style="{ height: contentHeight }"
:scroll-top="flagObject.scrollTop">
<template v-for="(i, index) in goodsList">
<view :class="['goods-item', goodsIndex == index ? 'active' : '']" :key="index"
@click="changeGoods(i, index)">
<view class="goods-title">{{ i.name }}</view>
<view class="goods-description">
<rich-text :nodes="i.descriptionText"></rich-text>
</view>
......@@ -87,11 +62,11 @@ export default {
name: 'SkuBox',
props: {
defaultTabId: Number,
currentCar: [Number,String],
currentCar: [Number, String],
show: Boolean
},
data () {
data() {
return {
tabId: '1',
blockIndex: 0,
......@@ -113,20 +88,20 @@ export default {
watch: {
defaultTabId: {
immediate: true,
handler (newval) {
handler(newval) {
if (this.show) this.tabId = newval
}
},
/**切换车型 */
currentCar: {
immediate: true,
handler (newval) {
handler(newval) {
if (this.show && this.requested) this.changeCar(newval)
}
},
show: {
immediate: true,
handler (newval) {
handler(newval) {
if (newval && !this.requested) {
this.requested = true
this.init(this.defaultTabId)
......@@ -135,44 +110,44 @@ export default {
},
watchStatus: {
immediate: true,
handler (newval) {
handler(newval) {
this.tabId = '1'
}
},
},
computed: {
watchStatus () {
watchStatus() {
return this.$store.state.user.historyStatus;
},
blockClass () {
blockClass() {
return ['block-0', 'block-1', 'block-2'][this.blockIndex]
},
boutiqueMediaConfig () {
boutiqueMediaConfig() {
return this.$store.state.user.boutiqueMediaConfig
},
list(){
list() {
let item = this.boutiqueMediaConfig[this.currentCar]
return item?.retrofitting || []
}
},
mounted () {
mounted() {
},
methods: {
changeCar (newval) {
changeCar(newval) {
let [item] = this.boutiqueMediaConfig[newval].retrofitting
this.changeTabId(item.tabId, 0, false)
},
init (tabId) {
init(tabId) {
let index = this.boutiqueMediaConfig[this.currentCar].retrofitting.findIndex(e => e.tabId == tabId)
this.changeTabId(tabId, index, false)
},
changeTabId (tabId, index, filter = true) {
changeTabId(tabId, index, filter = true) {
if (filter && tabId == this.tabId && index == this.blockIndex) return
this.tabId = tabId
this.blockIndex = index
this.setSecondList()
},
async setSecondList () {
async setSecondList() {
let secondList = this.boutiqueMediaConfig[this.currentCar].retrofitting,
index = secondList.findIndex(e => e.tabId == this.tabId)
if (index == -1) index = 0
......@@ -180,7 +155,7 @@ export default {
this.secondList = list
this.secondClick(0, false)
},
setScrollHeight () {
setScrollHeight() {
this.$nextTick(() => {
let query = uni.createSelectorQuery()
query.select(`#content-scroll`).boundingClientRect(data => {
......@@ -189,7 +164,7 @@ export default {
}).exec()
})
},
secondClick (index, filter = true) {
secondClick(index, filter = true) {
if (filter && this.secondIndex == index) return
let { secondList } = this
this.secondIndex = index
......@@ -212,18 +187,18 @@ export default {
this.thirdlyClick(0, false)
} else this.getGoodsList()
},
thirdlyClick (index, filter = true) {
thirdlyClick(index, filter = true) {
if (filter && this.thirdlyIndex == index) return
this.thirdlyIndex = index
this.getGoodsList()
},
changeGoods (item, index, filter = true) {
changeGoods(item, index, filter = true) {
if (filter && this.goodsIndex == index) return
this.goodsIndex = index
this.currentItem = item
this.changePreView()
},
getGoodsList () {
getGoodsList() {
this.goodsList = []
this.flagObject.goodsFlag = false
let { secondIndex, secondList, tabId, brandList, thirdlyIndex, secondName } = this
......@@ -231,15 +206,16 @@ export default {
this.goodsList = goodsList
this.flagObject.goodsFlag = true
this.flagObject.scrollTop = -100
this.changeGoods(goodsList[0], 0, false)
setTimeout(() => {
this.setScrollHeight()
}, 500)
this.changeGoods(goodsList[0], 0, false)
}, 200)
},
changePreView () {
changePreView() {
this.$emit('changePreView', this.currentItem)
},
setGoodsData (data, key) {
setGoodsData(data, key) {
let goodsList = []
data.map(e => {
if (e.description) e.descriptionText = e.description.replace(/<\/?br\s*\/?>|\\n|\n/g, '<br>')
......@@ -247,7 +223,7 @@ export default {
})
return goodsList
},
firstClass (list = []) {
firstClass(list = []) {
return list.length == 2 ? 'two-block' : ''
}
}
......@@ -258,11 +234,13 @@ export default {
.sku-content {
width: 100%;
height: 100%;
.padding-right {
height: toRpx(80);
width: toRpx(40);
flex-shrink: 0;
}
.first-type-box {
width: calc(100% - #{toRpx(64)});
height: toRpx(176);
......@@ -271,6 +249,7 @@ export default {
box-sizing: border-box;
border: toRpx(8) solid #f2f2f2;
position: relative;
.first-type-item {
width: toRpx(280);
height: toRpx(160);
......@@ -284,14 +263,17 @@ export default {
position: relative;
z-index: 2;
opacity: 0.7;
.sprite-icon {
margin-bottom: toRpx(12);
transform: scale(1.45);
}
}
.active {
opacity: 1;
}
.block {
width: toRpx(280);
height: toRpx(160);
......@@ -303,36 +285,46 @@ export default {
transform: translateY(-50%);
transition: all 0.15s;
}
.block-0 {
left: 0;
}
.block-1 {
left: toRpx(280);
}
.block-2 {
left: toRpx(560);
}
}
.two-block {
.first-type-item,
.block {
width: toRpx(420);
}
.block-0 {
left: 0;
}
.block-1 {
left: toRpx(420);
}
}
.second-type-scroll {
width: 100%;
animation: show-view-opacity 0.15s forwards;
.second-type-box {
width: 100%;
gap: toRpx(24);
flex-wrap: nowrap;
padding: toRpx(32) 0 toRpx(24);
.second-type-item {
width: fit-content;
flex-shrink: 0;
......@@ -346,6 +338,7 @@ export default {
justify-content: center;
transition: all 0.15s;
}
.active {
background: #2d66f71a;
font-weight: 500;
......@@ -353,15 +346,18 @@ export default {
}
}
}
.thirdly-type-scroll {
width: 100%;
animation: show-view-opacity 0.15s forwards;
.thirdly-type-box {
width: 100%;
gap: toRpx(24);
flex-wrap: nowrap;
padding-bottom: toRpx(24);
.thirdly-type-item {
flex-shrink: 0;
height: toRpx(80);
......@@ -374,6 +370,7 @@ export default {
justify-content: center;
transition: all 0.15s;
}
.active {
font-weight: 500;
color: #333333;
......@@ -381,12 +378,14 @@ export default {
}
}
}
.sub-title {
font-size: toRpx(24);
color: #999999;
line-height: toRpx(36);
padding-bottom: toRpx(16);
}
.content-scroll-box {
.goods-item {
width: calc(100% - #{toRpx(64)});
......@@ -395,12 +394,14 @@ export default {
padding: toRpx(24) toRpx(32);
margin-bottom: toRpx(24);
transition: all 0.15s;
.goods-title {
font-weight: 500;
font-size: toRpx(28);
color: #333333;
line-height: toRpx(44);
}
.goods-description {
margin-top: toRpx(8);
font-size: toRpx(24);
......@@ -410,20 +411,24 @@ export default {
overflow: hidden;
}
}
.active {
border-color: #333;
.goods-description {
max-height: none;
overflow: auto;
}
}
}
.nothing {
flex-direction: column;
padding-top: toRpx(136);
font-size: toRpx(28);
color: #999999;
line-height: toRpx(40);
&-icon {
width: toRpx(676);
height: toRpx(284);
......@@ -433,5 +438,4 @@ export default {
}
}
}
</style>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!