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 @@ ...@@ -8,9 +8,9 @@
<view class="header-item action-col">操作</view> <view class="header-item action-col">操作</view>
</view> </view>
<template v-if="loadComplete"> <template v-if="loadComplete">
<template v-if="list.length"> <template v-if="tableData.length">
<scroll-view class="table-body" scroll-y @scrolltolower="$emit('loadMore')"> <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="row-item customer-col">
<view class="customer-info"> <view class="customer-info">
<view class="avatar">{{ getAvatar(item.customerName) }}</view> <view class="avatar">{{ getAvatar(item.customerName) }}</view>
...@@ -86,13 +86,18 @@ export default { ...@@ -86,13 +86,18 @@ export default {
watch: { watch: {
list: { list: {
handler(val) { handler(val) {
this.$nextTick(() => { let query = uni.createSelectorQuery().in(this)
this.tableData = val
setTimeout(() => {
val.forEach((item, index) => { 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 deep: true
} }
}, },
...@@ -133,29 +138,33 @@ export default { ...@@ -133,29 +138,33 @@ export default {
orderHandleTime(time) { orderHandleTime(time) {
return time ? dayjs(time).format('YYYY-MM-DD') : '' return time ? dayjs(time).format('YYYY-MM-DD') : ''
}, },
showTagMore(tags, index) { showTagMore(tags, index, listItem) {
let query = uni.createSelectorQuery(), let query = uni.createSelectorQuery().in(this),
listItem = null, _this = this,
targetIndex = 0 targetIndex = 0
if (this.tableData[index] && this.tableData[index].hasMoreTags) return
this.$nextTick(() => { this.$nextTick(() => {
try { try {
query.select(`#tag-list-${index}`).boundingClientRect((data) => { const promise = new Promise((resolve, reject) => {
listItem = data tags?.map((tag, tagIndex) => {
}).exec() query.select(`#tag-${index}-${tagIndex}`).boundingClientRect((data) => {
tags?.forEach((tag, tagIndex) => { if (listItem && data.top > (listItem.height + listItem.top) && !targetIndex) {
query.select(`#tag-${index}-${tagIndex}`).boundingClientRect((data) => { targetIndex = tagIndex - 1
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() }).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) { } catch (error) {
console.log(error) console.log(error)
} }
......
...@@ -99,8 +99,8 @@ export default { ...@@ -99,8 +99,8 @@ export default {
if (item.taskStatus == 1) taskRecordList.push({ if (item.taskStatus == 1) taskRecordList.push({
label: '推送结果', key: 'pushResult', format: (status) => { label: '推送结果', key: 'pushResult', format: (status) => {
return { return {
2: '成功', 1: '成功',
3: '失败', 2: '失败',
}[status] || '-' }[status] || '-'
} }
}) })
......
...@@ -33,6 +33,7 @@ export default { ...@@ -33,6 +33,7 @@ export default {
tabIndex: Number, tabIndex: Number,
hasBeforeActivity: Boolean, hasBeforeActivity: Boolean,
hasAfterActivity: Boolean, hasAfterActivity: Boolean,
tabListId: Number,
}, },
data() { data() {
...@@ -89,8 +90,10 @@ export default { ...@@ -89,8 +90,10 @@ export default {
}, },
changeCar(newval) { changeCar(newval) {
this.goodsList = [] this.goodsList = []
let { activityData, tabIndex } = this let { activityData, tabListId } = this,
let carSeriesList = activityData[tabIndex].carSeriesList, list = activityData.find(e => e.marketingStage == tabListId)
if(!list) return
let carSeriesList = list.carSeriesList,
data = carSeriesList.find(e => e.carSeriesId == newval) data = carSeriesList.find(e => e.carSeriesId == newval)
if (data) { if (data) {
this.goodsIndex = -1 this.goodsIndex = -1
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
<view class="sku-box"> <view class="sku-box">
<goods-box :currentCar="currentCarId" :activityData="activityData" <goods-box :currentCar="currentCarId" :activityData="activityData"
:show="show && [0, 1].includes(tabIndex)" @changePreView="currentItem = $event" ref="goodsBox" :show="show && [0, 1].includes(tabIndex)" @changePreView="currentItem = $event" ref="goodsBox"
:tabIndex="tabIndex" @noActivity="setNoActivity" /> :tabIndex="tabIndex" @noActivity="setNoActivity" :tabListId="tabListId" />
</view> </view>
</template> </template>
<template v-else> <template v-else>
...@@ -67,7 +67,8 @@ ...@@ -67,7 +67,8 @@
<template v-if="tabs.length > 1"> <template v-if="tabs.length > 1">
<view class="tabs-box flex"> <view class="tabs-box flex">
<template v-for="(i, index) in tabs"> <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> }}</view>
</template> </template>
<view :class="['block', `block-${tabIndex}`]"></view> <view :class="['block', `block-${tabIndex}`]"></view>
...@@ -115,7 +116,8 @@ export default { ...@@ -115,7 +116,8 @@ export default {
isSelect: false, isSelect: false,
currentCarId: '', currentCarId: '',
activityData: [], activityData: [],
noActivity: false noActivity: false,
tabListId: 2
} }
}, },
watch: { watch: {
...@@ -135,7 +137,7 @@ export default { ...@@ -135,7 +137,7 @@ export default {
currentCarId: { currentCarId: {
immediate: true, immediate: true,
handler(newval) { 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) { if (this.show && newval && !this.isPreview && this.customerType == 1) {
uni.showLoading({ uni.showLoading({
mask: true mask: true
...@@ -158,11 +160,16 @@ export default { ...@@ -158,11 +160,16 @@ export default {
handler(newval) { handler(newval) {
if (newval) { if (newval) {
this.isSelect = false this.isSelect = false
let index = 0 let index = 0,
tabListId = 2
if (this.hasBeforeActivity || this.hasAfterActivity) { if (this.hasBeforeActivity || this.hasAfterActivity) {
index = 1 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) if (newval && this.currentItem && this.tabIndex == index) this.changePreView(this.currentItem, false, false)
} }
} }
...@@ -175,15 +182,28 @@ export default { ...@@ -175,15 +182,28 @@ export default {
if (newval.length) this.currentItem = null 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: { computed: {
showActivity() { showActivity() {
let { hasBeforeActivity, hasAfterActivity, tabIndex } = this, let { tabListId } = this
skuIndex = 0 return [0, 1].includes(tabListId)
if (hasBeforeActivity || hasAfterActivity) skuIndex = 1
if (hasBeforeActivity && hasAfterActivity) skuIndex = 2
return tabIndex != skuIndex
}, },
watchStatus() { watchStatus() {
return this.$store.state.user.historyStatus; return this.$store.state.user.historyStatus;
...@@ -225,26 +245,38 @@ export default { ...@@ -225,26 +245,38 @@ export default {
}, },
tabs() { tabs() {
let { hasBeforeActivity, hasAfterActivity, hasOptionals } = this, let { hasBeforeActivity, hasAfterActivity, hasOptionals } = this,
tabs = ['加装'] tabs = [{
if (hasAfterActivity) tabs.unshift('售后钜惠') name: '加装',
if (hasBeforeActivity) tabs.unshift('新享特惠') id: 2
if (hasOptionals) tabs.push('选装') }]
if (hasAfterActivity) tabs.unshift({
name: '售后钜惠',
id: 1
})
if (hasBeforeActivity) tabs.unshift({
name: '新享特惠',
id: 0
})
if (hasOptionals) tabs.push({
name: '选装',
id: 3
})
return tabs return tabs
}, },
hasBeforeActivity() { hasBeforeActivity() {
// let { currentCarId } = this, let { currentCarId } = this,
// hasBeforeActivity = this.activityData.some(e => e.marketingStage == 0), beforeActivityIndex = this.activityData.findIndex(e => e.marketingStage == 0),
// hasCar = false hasCar = false
// this.activityData.forEach(e => { if (!hasCar && beforeActivityIndex > -1) hasCar = this.activityData[beforeActivityIndex].carSeriesList.some(e => e.carSeriesId == currentCarId)
// if (!hasCar) e.carSeriesList.some(e => e.carSeriesId == currentCarId) return hasCar
// })
// return hasBeforeActivity && hasCar
return this.activityData.some(e => e.marketingStage == 0)
}, },
hasAfterActivity() { 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: { methods: {
...@@ -318,6 +350,7 @@ export default { ...@@ -318,6 +350,7 @@ export default {
if (this.isPreview) return if (this.isPreview) return
let key = `${currentItem.carModelName}_${currentItem.id}`, let key = `${currentItem.carModelName}_${currentItem.id}`,
value = this.receptionTrack[key] value = this.receptionTrack[key]
if (!value) return
value.stayDuration += Number(Date.now() - value.entryTime) value.stayDuration += Number(Date.now() - value.entryTime)
this.$store.dispatch("setReceptionTrack", { key, value }) this.$store.dispatch("setReceptionTrack", { key, value })
}, },
...@@ -327,19 +360,20 @@ export default { ...@@ -327,19 +360,20 @@ export default {
clearCanvas() { clearCanvas() {
this.$refs.receptionCanvas.clearBoard() this.$refs.receptionCanvas.clearBoard()
}, },
changeTab(index) { changeTab(index, force = false, changeCar = true) {
if (this.tabIndex == index) return if (this.tabIndex == index && !force) return
let skuIndex = 0 let skuIndex = 0
if (this.hasBeforeActivity || this.hasAfterActivity) skuIndex = 1 if (this.hasBeforeActivity || this.hasAfterActivity) skuIndex = 1
if (this.hasBeforeActivity && this.hasAfterActivity) skuIndex = 2 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.tabIndex = index
this.currentItem = null this.currentItem = null
this.$nextTick(() => { this.tabListId = this.tabs[index].id
if (skuIndex == 2 && index < 2) this.$refs.goodsBox.changeCar(this.currentCarId) setTimeout(() => {
if (index == skuIndex) this.$refs.sku.changeCar(this.currentCarId) if (changeCar && goods && [0, 1].includes(this.tabListId)) goods.changeCar(this.currentCarId)
this.clearCanvas() this.clearCanvas()
}) }, 100)
}, },
showSelect() { showSelect() {
if (this.carList.length == 1 || this.change_disabled) return 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!