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
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!