Commit acdf60cf by 李伟康

feat(customer): 添加客户机会弹窗功能

- 在CustomerOpportunities组件中添加CustomerPopup组件引用
- 实现openPopup方法用于打开客户详情弹窗
- 创建CustomerPopup组件用于展示客户基础信息和任务记录
- 添加TaskItem组件用于显示任务列表项目
- 在Table组件中实现推送任务和查看任务记录功能
- 优化表格数据显示,添加头像自动生成逻辑
- 调整样式布局以适应新的弹窗界面需求
1 parent 7d0d93a6
<template>
<uni-popup ref="popup" animation :is-mask-click="false">
<view class="popup-box">
<view class="title flex">
{{ title }}
<view class="popup-close flex" @click="close">
<uni-icons type="closeempty" size="20" color="#999EA8"></uni-icons>
</view>
</view>
<view class="customer-detail">
<template v-for="(item, index) in customerObject">
<view class="customer-item flex" :key="index">
<view class="item-title">{{ item.title }}</view>
<view class="item-content text-hide">
<template v-if="item.block">
<view :class="['block', item.status == 1 ? 'success' : 'failed']">{{ item.content }}</view>
</template>
<text v-else>{{ item.content }}</text>
</view>
</view>
</template>
</view>
<view class="sub-title flex">
<view :class="['sprite-icon', subIcon]"></view>
{{ subTitle }}
</view>
<scroll-view class="content" scroll-y>
<template v-for="(item, index) in taskList">
<task-item :key="index" :item="item" :num="index" :type="options.type" />
</template>
<view class="p-b"></view>
</scroll-view>
</view>
</uni-popup>
</template>
<script type='text/ecmascript-6'>
import TaskItem from './TaskItem.vue'
export default {
components: { TaskItem },
name: 'CustomerPopup',
data() {
return {
options: {},
customerObject: [
{ title: '客户姓名', content: '张三' },
{ title: '手机号码', content: '一级' },
{ title: '车型', content: '朋友介绍' },
{ title: '客户群', content: '潜在客户' },
{ title: '订单状态', content: '潜在客户', block: true, status: 1 },
{ title: '订单时间', content: '潜在客户' },
],
taskList: new Array(10).fill({})
}
},
watch: {},
computed: {
title() {
let { type } = this.options,
title = {
task: '客户基础信息',
taskRecord: '任务记录'
}[type]
return title
},
subTitle() {
let { type } = this.options,
title = {
task: '推送运营任务',
taskRecord: '任务记录(近7天)'
}[type]
return title
},
subIcon() {
let { type } = this.options,
icon = {
task: 'icon-customer-task',
taskRecord: 'icon-customer-task-record'
}[type]
return icon
},
},
mounted() { },
methods: {
open(options) {
console.log(options)
this.options = options
this.$refs.popup.open()
},
close() {
this.$refs.popup.close()
}
}
}
</script>
<style scoped lang='scss'>
.popup-box {
width: 56.265985vw;
height: 79.947917vh;
border-radius: 32rpx;
background: linear-gradient(180deg, #E6F0FF 0%, #FFFFFF 40%, #FFFFFF 100%);
.title {
font-size: 40rpx;
font-weight: 500;
color: #292D33;
height: 128rpx;
justify-content: center;
position: relative;
.popup-close {
position: absolute;
height: 100%;
top: 0;
right: 0;
padding: 0 toRpx(48);
font-weight: 400;
color: #999EA8;
}
}
.customer-detail {
background: #FFFFFF;
border: 2rpx solid #F5F7FA;
margin: 0 64rpx;
height: 232rpx;
border-radius: 32rpx;
display: flex;
flex-wrap: wrap;
gap: 24rpx 40rpx;
box-sizing: border-box;
padding: 28rpx 40rpx;
.customer-item {
width: calc(50% - #{toRpx(20)});
box-sizing: border-box;
font-size: 26rpx;
gap: 16rpx;
.item-title {
width: 120rpx;
color: #999EA8;
}
.item-content {
width: calc(100% - #{toRpx(136)});
color: #292D33;
}
.block {
display: inline-block;
padding: 0 16rpx;
border-radius: 8rpx;
font-size: 24rpx;
line-height: 44rpx;
height: 44rpx;
&.success {
background-color: #EAF9F1;
color: #35C376;
}
&.failed {
background-color: #F5F7FA;
color: #999EA8;
}
}
}
}
.sub-title {
font-size: 34rpx;
font-weight: 500;
color: #292D33;
height: 124rpx;
margin: 0 64rpx;
.sprite-icon {
margin-right: 18rpx;
}
}
.content {
height: calc(100% - #{toRpx(484)});
box-sizing: border-box;
}
.p-b {
height: 28rpx;
}
}
</style>
\ No newline at end of file
......@@ -11,11 +11,11 @@
<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">{{ item.avatar }}</view>
<view class="avatar">{{ getAvatar(item.name) }}</view>
<view class="customer-detail">
<view class="name-row">
<text class="name">{{ item.name }}</text>
<text class="car-model">{{ item.carModel }}</text>
<text class="name text-hide">{{ item.name }}</text>
<text class="car-model text-hide">{{ item.carModel }}</text>
</view>
<view class="phone">{{ item.phone }}</view>
<view class="customer-group">{{ item.customerGroup }}</view>
......@@ -43,8 +43,8 @@
</view>
<view class="row-item action-col">
<view class="action-btn primary-btn" v-if="type == 0">推送运营任务</view>
<view class="action-btn secondary-btn">查看任务记录</view>
<view class="action-btn primary-btn" v-if="type == 0" @click="pushTask(item)">推送运营任务</view>
<view class="action-btn secondary-btn" @click="viewTaskRecord(item)">查看任务记录</view>
</view>
</view>
</scroll-view>
......@@ -64,7 +64,6 @@ export default {
return {
tableData: [
{
avatar: '张',
name: '张**',
carModel: '奥迪 A6L',
phone: '136****6789',
......@@ -77,7 +76,6 @@ export default {
follower: '郭莎莎'
},
{
avatar: '李',
name: '李**',
carModel: '宝马 5系',
phone: '138****1234',
......@@ -90,7 +88,6 @@ export default {
follower: '李明'
},
{
avatar: '王',
name: '王**',
carModel: '奔驰 C级',
phone: '139****5678',
......@@ -103,7 +100,6 @@ export default {
follower: '张婷'
},
{
avatar: '赵',
name: '赵**',
carModel: '丰田 凯美瑞',
phone: '137****9876',
......@@ -116,7 +112,6 @@ export default {
follower: '陈晓华'
},
{
avatar: '刘',
name: '刘**',
carModel: '特斯拉 Model 3',
phone: '135****4321',
......@@ -129,7 +124,6 @@ export default {
follower: '刘芳'
},
{
avatar: '陈',
name: '陈**',
carModel: '比亚迪唐',
phone: '134****7890',
......@@ -154,6 +148,9 @@ export default {
})
},
methods: {
getAvatar(name) {
return name.charAt(0)
},
showTagMore(tags, index) {
let query = uni.createSelectorQuery(),
listItem = null,
......@@ -181,7 +178,20 @@ export default {
console.log(error)
}
})
}
},
pushTask(data) {
this.$emit('openPopup',{
type: 'task',
data
})
},
viewTaskRecord(data) {
this.$emit('openPopup',{
type: 'taskRecord',
data
})
},
}
}
</script>
......@@ -283,14 +293,19 @@ export default {
font-weight: 500;
color: #1A1A2E;
margin-right: 12rpx;
max-width: 25%;
}
.car-model {
font-size: 24rpx;
color: #6C6F75;
padding: 0 16rpx;
box-sizing: border-box;
border-radius: 8rpx;
border: 1px solid #DCE1E6
border: 1px solid #DCE1E6;
max-width: calc(75% - #{toRpx(8)});
margin-left: 8rpx;
}
}
......@@ -318,11 +333,12 @@ export default {
.order-status {
display: inline-block;
padding: 6rpx 16rpx;
padding: 0 16rpx;
border-radius: 8rpx;
font-size: 24rpx;
margin-bottom: 16rpx;
line-height: 44rpx;
height: 44rpx;
&.success {
background-color: #EAF9F1;
color: #35C376;
......@@ -375,9 +391,10 @@ export default {
font-size: 26rpx;
color: #292D33;
text-align: center;
word-break: break-all;
.date{
color: #999EA8;
margin-top: 20rpx;
margin-top: 10rpx;
}
}
......
<template>
<view class="task-item">
<view class="task-item-title flex">
<view class="tag flex">任务{{ num + 1 }}</view>
<view class="text flex">
向客户群发送消息
<template v-if="type == 'taskRecord'">
<view class="line"></view>
文本
</template>
</view>
<view class="btn-box flex">
<template v-if="type == 'task'">
<view class="btn primary-btn">立即推送</view>
<view class="btn">暂不推送</view>
</template>
<template v-else>
<view :class="['status flex', { success: item.status != 1 }]">已推送</view>
</template>
</view>
</view>
</view>
</template>
<script type='text/ecmascript-6'>
export default {
name: 'TaskItem',
props: {
item: Object,
type: String,
num: Number,
},
data() {
return {}
},
watch: {},
computed: {},
mounted() { },
methods: {}
}
</script>
<style scoped lang='scss'>
.task-item {
border-radius: 32rpx;
padding: 28rpx;
background-color: #F8FAFC;
margin: 0 64rpx 28rpx;
&-title {
margin-bottom: 16rpx;
.tag {
border: 2rpx solid #DCE1E6;
padding: 0 16rpx;
border-radius: 8rpx;
color: #6C6F75;
font-size: 26rpx;
margin-right: 16rpx;
}
.text {
font-size: 30rpx;
color: #292D33;
}
.line {
width: 2rpx;
height: 32rpx;
margin: 0 16rpx;
background-color: #999EA8;
}
}
.btn-box {
margin-left: auto;
.btn {
margin-left: 16rpx;
padding: 0 32rpx;
border-radius: 8rpx;
border: 2rpx solid #DCE1E6;
color: #292D33;
font-size: 26rpx;
height: 56rpx;
line-height: 56rpx;
}
.primary-btn {
border-color: #2C66F71A;
background-color: #2C66F70D;
color: #2C66F7;
}
.status {
display: inline-block;
padding: 0 32rpx;
border-radius: 8rpx;
font-size: 24rpx;
line-height: 56rpx;
height: 56rpx;
background-color: #ECECEC;
color: #999EA8;
&.success {
background-color: #EAF9F1;
color: #35C376;
}
}
}
}
</style>
\ No newline at end of file
......@@ -18,16 +18,18 @@
</template>
</view>
<view class="customer-content">
<Table :type="tabIndex" />
<Table :type="tabIndex" @openPopup="openPopup" />
</view>
<CustomerPopup ref="customerPopup" />
</view>
</template>
<script type='text/ecmascript-6'>
import dayjs from 'dayjs';
import Table from './components/Table'
import CustomerPopup from './components/CustomerPopup'
export default {
name: 'CustomerOpportunities',
components: { Table },
components: { Table, CustomerPopup },
data() {
return {
tabIndex: 0,
......@@ -48,6 +50,9 @@ export default {
changeTab(index) {
if (index == this.tabIndex) return
this.tabIndex = index
},
openPopup(data) {
this.$refs.customerPopup.open(data)
}
}
}
......
......@@ -611,7 +611,7 @@ export default {
box-sizing: border-box;
flex-direction: column;
position: relative;
z-index: 2;
z-index: 1;
text-align: center;
.account-change {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!