Commit 99759fcd by 李伟康

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

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