Commit 99759fcd by 李伟康

fix(CustomerOpportunities): 修复客户机会组件显示和加载问题

- 移除tabs标签页总数条件判断,始终更新标签页显示
- 在CustomerPopup组件中添加数据加载完成状态控制
- 当任务列表为空时不显示合并推送按钮
- 添加暂无数据显示组件和样式
- 修复TaskItem组件中空值显示问题,统一显示为"-"
- 更新默认图片资源地址
- 优化任务记录详情字段显示逻辑
- 完善确认任务接口调用的错误处理和加载状态
1 parent 72164893
...@@ -24,10 +24,12 @@ ...@@ -24,10 +24,12 @@
<view class="sub-title flex"> <view class="sub-title flex">
<view :class="['sprite-icon', subIcon]"></view> <view :class="['sprite-icon', subIcon]"></view>
{{ subTitle }} {{ subTitle }}
<template v-if="options.type == 'task'"> <template v-if="options.type == 'task' && taskList.length">
<view class="btn flex" @click="confirmAllTask">全部任务合并推送</view> <view class="btn flex" @click="confirmAllTask">全部任务合并推送</view>
</template> </template>
</view> </view>
<template v-if="loadComplete">
<template v-if="taskList.length">
<scroll-view class="content" scroll-y> <scroll-view class="content" scroll-y>
<template v-for="(item, index) in taskList"> <template v-for="(item, index) in taskList">
<task-item :key="index" :item="{ <task-item :key="index" :item="{
...@@ -37,13 +39,21 @@ ...@@ -37,13 +39,21 @@
</template> </template>
<view class="p-b"></view> <view class="p-b"></view>
</scroll-view> </scroll-view>
</template>
<template v-else>
<view class="nothing">
<nothing text="暂无数据" />
</view>
</template>
</template>
</view> </view>
</uni-popup> </uni-popup>
</template> </template>
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import TaskItem from './TaskItem.vue' import TaskItem from './TaskItem.vue'
import Nothing from './Nothing.vue'
export default { export default {
components: { TaskItem }, components: { TaskItem, Nothing },
name: 'CustomerPopup', name: 'CustomerPopup',
inject: ['userInfo'], inject: ['userInfo'],
data() { data() {
...@@ -59,7 +69,8 @@ export default { ...@@ -59,7 +69,8 @@ export default {
{ title: '订单状态', key: 'customerStatus', block: true }, { title: '订单状态', key: 'customerStatus', block: true },
{ title: '订单时间', key: 'orderHandleTime' }, { title: '订单时间', key: 'orderHandleTime' },
], ],
taskList: [] taskList: [],
loadComplete: false,
} }
}, },
watch: {}, watch: {},
...@@ -113,6 +124,8 @@ export default { ...@@ -113,6 +124,8 @@ export default {
return data[key] || '-' return data[key] || '-'
}, },
open(options) { open(options) {
this.loadComplete = false
this.taskList = []
this.options = options this.options = options
this.$refs.popup.open() this.$refs.popup.open()
this.getData(options) this.getData(options)
...@@ -133,9 +146,11 @@ export default { ...@@ -133,9 +146,11 @@ export default {
}[options.type], }[options.type],
{ customerInstanceId } = options.data, { customerInstanceId } = options.data,
data = await uni.$api.customerApi[targetApi]({ merchantId, customerInstanceId }) data = await uni.$api.customerApi[targetApi]({ merchantId, customerInstanceId })
this.loadComplete = true
uni.hideLoading() uni.hideLoading()
this.taskList = data this.taskList = data
} catch (error) { } catch (error) {
this.loadComplete = true
uni.hideLoading() uni.hideLoading()
} }
...@@ -166,18 +181,26 @@ export default { ...@@ -166,18 +181,26 @@ export default {
if (res.confirm) _this.confirmSopTask({ if (res.confirm) _this.confirmSopTask({
taskIds, taskIds,
confirmStatus: 1 confirmStatus: 1
}) }, true)
} }
}) })
}, },
async confirmSopTask(params) { async confirmSopTask(params, all) {
console.log(params) try {
return uni.showLoading({
mask: true,
title: '提交中...'
})
const data = await uni.$api.customerApi.confirmSopTask(params) const data = await uni.$api.customerApi.confirmSopTask(params)
uni.showToast({ uni.showToast({
title: data ? '提交成功' : '提交失败', title: data ? '提交成功' : '提交失败',
icon: "none", icon: "none",
}) })
if (data) this.getData(this.options)
} catch (error) {
uni.hideLoading()
}
} }
} }
} }
...@@ -292,4 +315,8 @@ export default { ...@@ -292,4 +315,8 @@ export default {
height: 28rpx; height: 28rpx;
} }
} }
.nothing {
height: calc(100% - #{toRpx(484)});
}
</style> </style>
\ No newline at end of file \ No newline at end of file
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
</template> </template>
<template v-else> <template v-else>
<text> <text>
{{ item[i.key] }} {{ formatValue(item[i.key]) }}
</text> </text>
</template> </template>
</template> </template>
...@@ -76,29 +76,41 @@ export default { ...@@ -76,29 +76,41 @@ export default {
data() { data() {
return { return {
defaultPoster: 'https://img02.glsx.com.cn/weapp/resource/app-zyzs/equity/tire-tips-1.webp' defaultPoster: 'https://img02.glsx.com.cn/weapp/resource/app-zyzs/common/default-video.webp'
} }
}, },
watch: {}, watch: {},
computed: { computed: {
messageList() { messageList() {
let { type } = this let { type, item } = this,
return type == 'task' ? [ { messageType } = item,
taskList = [
{ label: '目标群', key: 'qwGroupName' }, { label: '目标群', key: 'qwGroupName' },
{ label: '消息类型', key: 'messageType', format: (type) => this.messageType(type) }, { label: '消息类型', key: 'messageType', format: (type) => this.messageType(type) },
{ label: '消息内容', key: 'messageContent' }, { label: '消息内容', key: 'messageContent' },
] : [ ],
taskRecordList = [
{ label: '消息内容', key: 'messageContent' }, { label: '消息内容', key: 'messageContent' },
{ label: '推送时间', key: 'pushTime' }, { label: '推送时间', key: 'pushTime' },
{ { label: '操作人', key: 'confirmBy' },
]
if (type == 'taskRecord') {
if (item.taskStatus == 1) taskRecordList.push({
label: '推送结果', key: 'pushResult', format: (status) => { label: '推送结果', key: 'pushResult', format: (status) => {
return { return {
2: '成功', 2: '成功',
3: '失败', 3: '失败',
}[status] }[status]
} }
}, })
] if (messageType == 4) taskRecordList.push({
label: '浏览人数', key: 'viewTimes'
})
}
return type == 'task' ? taskList : taskRecordList
} }
}, },
mounted() { }, mounted() { },
...@@ -137,6 +149,9 @@ export default { ...@@ -137,6 +149,9 @@ export default {
getImages(mediaIds) { getImages(mediaIds) {
return mediaIds.split(',') return mediaIds.split(',')
}, },
formatValue(value){
return value !== null && value !== '' && value !== undefined ? value : '-'
}
} }
} }
</script> </script>
...@@ -246,12 +261,14 @@ export default { ...@@ -246,12 +261,14 @@ export default {
} }
} }
.video, .image { .video,
.image {
width: 160rpx; width: 160rpx;
height: 160rpx; height: 160rpx;
border-radius: 16rpx; border-radius: 16rpx;
} }
.img-box { .img-box {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
......
...@@ -112,7 +112,7 @@ export default { ...@@ -112,7 +112,7 @@ export default {
this.tableData = [...tableData, ...list] this.tableData = [...tableData, ...list]
this.tableRef().loadComplete = true this.tableRef().loadComplete = true
this.total = total this.total = total
if (total) this.$set(this.tabs, 0, `待执行推送客户(${total})`) this.$set(this.tabs, 0, `待执行推送客户(${total})`)
} catch (error) { } catch (error) {
this.tableRef() && (this.tableRef().loadComplete = true) this.tableRef() && (this.tableRef().loadComplete = true)
} }
...@@ -129,7 +129,7 @@ export default { ...@@ -129,7 +129,7 @@ export default {
this.total = total this.total = total
uni.hideLoading() uni.hideLoading()
} }
if (total) this.$set(this.tabs, 1, `近7日已推送客户(${total})`) this.$set(this.tabs, 1, `近7日已推送客户(${total})`)
} catch (error) { } catch (error) {
this.tableRef() && (this.tableRef().loadComplete = true) this.tableRef() && (this.tableRef().loadComplete = true)
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!