Commit 829e7f3a by 李伟康

feat(customer): 新增策略任务确认功能并优化客户机会组件

- 在customerApi中新增confirmSopTask接口用于策略任务确认
- 重构CustomerOpportunities组件的数据初始化逻辑,修复切换标签时状态重置问题
- 添加tableRef方法统一访问表格引用,避免直接操作$refs可能的空指针异常
- 优化loading显示,在请求完成后确保隐藏loading状态
- 在CustomerPopup组件中新增全部任务合并推送按钮及功能
- 完善CustomerPopup组件中的错误处理机制
- 修复Table组件中时间格式化时可能出现的空值问题
- 为TaskItem组件添加任务确认事件处理功能
- 调整HomeFrame样式以解决transform属性导致的布局问题
1 parent 34db4cd5
...@@ -145,5 +145,15 @@ module.exports = { ...@@ -145,5 +145,15 @@ module.exports = {
projectName: 'pad', projectName: 'pad',
...data ...data
}) })
} },
/**
* 策略任务确认
*/
confirmSopTask(data) {
return http.post({
method: 'dj.pad.api.last.week.sop.task.confirm',
projectName: 'pad',
...data
})
},
} }
...@@ -23,10 +23,13 @@ ...@@ -23,10 +23,13 @@
<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'">
<view class="btn flex" @click="confirmAllTask">全部任务合并推送</view>
</template>
</view> </view>
<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="item" :num="index" :type="options.type" /> <task-item :key="index" :item="item" :num="index" :type="options.type" @confirmTask="confirmTask" />
</template> </template>
<view class="p-b"></view> <view class="p-b"></view>
</scroll-view> </scroll-view>
...@@ -41,7 +44,9 @@ export default { ...@@ -41,7 +44,9 @@ export default {
inject: ['userInfo'], inject: ['userInfo'],
data() { data() {
return { return {
options: {}, options: {
data: {}
},
customerObject: [ customerObject: [
{ title: '客户姓名', key: 'customerName' }, { title: '客户姓名', key: 'customerName' },
{ title: '手机号码', key: 'customerPhone' }, { title: '手机号码', key: 'customerPhone' },
...@@ -83,17 +88,19 @@ export default { ...@@ -83,17 +88,19 @@ export default {
mounted() { }, mounted() { },
methods: { methods: {
open(options) { open(options) {
uni.showLoading({
mask: true,
title: '加载中...'
})
this.options = options this.options = options
this.$refs.popup.open()
this.getData(options) this.getData(options)
}, },
close() { close() {
this.$refs.popup.close() this.$refs.popup.close()
}, },
async getData(options) { async getData(options) {
try {
uni.showLoading({
mask: true,
title: '加载中...'
})
let { shopMerchantId: merchantId } = this.userInfo, let { shopMerchantId: merchantId } = this.userInfo,
targetApi = { targetApi = {
task: 'getTodaySopTaskDetailList', task: 'getTodaySopTaskDetailList',
...@@ -103,8 +110,17 @@ export default { ...@@ -103,8 +110,17 @@ export default {
data = await uni.$api.customerApi[targetApi]({ merchantId, customerInstanceId }) data = await uni.$api.customerApi[targetApi]({ merchantId, customerInstanceId })
uni.hideLoading() uni.hideLoading()
this.taskList = data this.taskList = data
this.$refs.popup.open() } catch (error) {
uni.hideLoading()
}
}, },
confirmTask(options) {
console.log(options)
},
confirmAllTask() {
console.log('全部任务合并推送')
}
} }
} }
</script> </script>
...@@ -196,6 +212,18 @@ export default { ...@@ -196,6 +212,18 @@ export default {
margin-right: 18rpx; margin-right: 18rpx;
} }
.btn {
margin-left: auto;
background-color: #2C66F7;
color: #FFFFFF;
padding: 0 32rpx;
border-radius: 16rpx;
height: 64rpx;
line-height: 64rpx;
color: #2C66F7;
font-size: 28rpx;
}
} }
.content { .content {
......
...@@ -102,7 +102,7 @@ export default { ...@@ -102,7 +102,7 @@ export default {
}, },
methods: { methods: {
lastExecuteTime(time) { lastExecuteTime(time) {
return dayjs(time).format('MM-DD HH:mm') return time ? dayjs(time).format('MM-DD HH:mm') : ''
}, },
getAvatar(name) { getAvatar(name) {
return name.charAt(0) return name.charAt(0)
...@@ -131,7 +131,7 @@ export default { ...@@ -131,7 +131,7 @@ export default {
}[status] }[status]
}, },
orderHandleTime(time) { orderHandleTime(time) {
return dayjs(time).format('YYYY-MM-DD') return time ? dayjs(time).format('YYYY-MM-DD') : ''
}, },
showTagMore(tags, index) { showTagMore(tags, index) {
let query = uni.createSelectorQuery(), let query = uni.createSelectorQuery(),
......
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
</view> </view>
<view class="btn-box flex"> <view class="btn-box flex">
<template v-if="item.taskStatus == 0"> <template v-if="item.taskStatus == 0">
<view class="btn primary-btn">立即推送</view> <view class="btn primary-btn" @click="confirmTask(1)">立即推送</view>
<view class="btn">暂不推送</view> <view class="btn" @click="confirmTask()">暂不推送</view>
</template> </template>
<template v-else> <template v-else>
<view :class="['status flex', { success: item.taskStatus == 1 }]">{{ taskStatus(item.taskStatus) }}</view> <view :class="['status flex', { success: item.taskStatus == 1 }]">{{ taskStatus(item.taskStatus) }}</view>
...@@ -37,7 +37,7 @@ export default { ...@@ -37,7 +37,7 @@ export default {
computed: {}, computed: {},
mounted() { }, mounted() { },
methods: { methods: {
messageType(type){ messageType(type) {
return { return {
1: '文本', 1: '文本',
2: '图片', 2: '图片',
...@@ -45,12 +45,18 @@ export default { ...@@ -45,12 +45,18 @@ export default {
4: '网页链接', 4: '网页链接',
}[type] }[type]
}, },
taskStatus(status){ taskStatus(status) {
return { return {
1: '已推送', 1: '已推送',
2: '暂不推送', 2: '暂不推送',
}[status] }[status]
} },
confirmTask(confirmStatus = 0) {
this.$emit('confirmTask', {
confirmStatus,
item: this.item
})
},
} }
} }
</script> </script>
......
...@@ -51,23 +51,34 @@ export default { ...@@ -51,23 +51,34 @@ export default {
if (val) { if (val) {
this.getTodaySopTaskCustomerPage() this.getTodaySopTaskCustomerPage()
this.getLastWeekSopTaskCustomerPage(false) this.getLastWeekSopTaskCustomerPage(false)
} else this.initRequestParams() } else {
this.tabs = this.$options.data.call(this).tabs
this.tabIndex = 0
this.initRequestParams()
}
}, },
immediate: true, immediate: true,
deep: true deep: true
} }
}, },
computed: { computed: {
}, },
mounted() { mounted() {
}, },
methods: { methods: {
tableRef() {
return this.$refs.table || null
},
initRequestParams() { initRequestParams() {
this.pageNum = 1 this.pageNum = 1
this.pageSize = 10 this.pageSize = 10
this.tableData = [] this.tableData = []
this.$refs.table.loadComplete = false if (this.tableRef()) {
this.$refs.table.noMore = false this.tableRef().loadComplete = false
this.tableRef().noMore = false
}
uni.hideLoading()
}, },
/** /**
* 切换标签 * 切换标签
...@@ -89,38 +100,38 @@ export default { ...@@ -89,38 +100,38 @@ export default {
this.pageNum += 1 this.pageNum += 1
if (tabIndex == 0) this.getTodaySopTaskCustomerPage() if (tabIndex == 0) this.getTodaySopTaskCustomerPage()
else this.getLastWeekSopTaskCustomerPage() else this.getLastWeekSopTaskCustomerPage()
} else this.$refs.table.noMore = true } else this.tableRef().noMore = true
}, },
async getTodaySopTaskCustomerPage() { async getTodaySopTaskCustomerPage() {
try { try {
uni.showLoading({ title: '加载中' }) uni.showLoading({ title: '加载中...', mask: true })
let { shopMerchantId: merchantId } = this.userInfo, let { shopMerchantId: merchantId } = this.userInfo,
{ pageNum, pageSize, tableData } = this, { pageNum, pageSize, tableData } = this,
{ list, total } = await uni.$api.customerApi.getTodaySopTaskCustomerPage({ merchantId, pageNum, pageSize }) { list, total } = await uni.$api.customerApi.getTodaySopTaskCustomerPage({ merchantId, pageNum, pageSize })
uni.hideLoading()
this.tableData = [...tableData, ...list] this.tableData = [...tableData, ...list]
this.$refs.table.loadComplete = true this.tableRef().loadComplete = true
this.total = total this.total = total
if (total) this.$set(this.tabs, 0, `待执行推送客户(${total})`) if (total) this.$set(this.tabs, 0, `待执行推送客户(${total})`)
uni.hideLoading()
} catch (error) { } catch (error) {
this.$refs.table.loadComplete = true this.tableRef() && (this.tableRef().loadComplete = true)
} }
}, },
async getLastWeekSopTaskCustomerPage(assignment = true) { async getLastWeekSopTaskCustomerPage(assignment = true) {
try { try {
if (assignment) uni.showLoading({ title: '加载中' }) if (assignment) uni.showLoading({ title: '加载中...', mask: true })
let { shopMerchantId: merchantId } = this.userInfo, let { shopMerchantId: merchantId } = this.userInfo,
{ pageNum, pageSize, tableData } = this, { pageNum, pageSize, tableData } = this,
{ list, total } = await uni.$api.customerApi.getLastWeekSopTaskCustomerPage({ merchantId, pageNum, pageSize }) { list, total } = await uni.$api.customerApi.getLastWeekSopTaskCustomerPage({ merchantId, pageNum, pageSize })
if (assignment) { if (assignment) {
this.tableData = [...tableData, ...list] this.tableData = [...tableData, ...list]
this.$refs.table.loadComplete = true this.tableRef().loadComplete = true
this.total = total this.total = total
uni.hideLoading() uni.hideLoading()
} }
if (total) this.$set(this.tabs, 1, `近7日已推送客户(${total})`) if (total) this.$set(this.tabs, 1, `近7日已推送客户(${total})`)
} catch (error) { } catch (error) {
this.$refs.table.loadComplete = true this.tableRef() && (this.tableRef().loadComplete = true)
} }
} }
} }
......
...@@ -1312,6 +1312,7 @@ export default { ...@@ -1312,6 +1312,7 @@ export default {
} }
.customer-opportunities-box{ .customer-opportunities-box{
padding: 0; padding: 0;
transform: none;
} }
.app-content-box { .app-content-box {
width: 100%; width: 100%;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!