Commit d0ea8c0c by 李伟康

feat(dailyNewspaper): 新增客户选择功能并优化界面布局

- 在洽谈明细页面添加客户抽屉组件用于选择待接待客户
- 实现客户列表的多选和批量添加到洽谈明细功能
- 添加最大客户数量限制和超出提示功能
- 优化页面布局增加固定标题栏和客户计数显示
- 修复代码中的拼写错误和语法问题
- 更新组件事件传递和参数校验逻辑
1 parent a3c25009
...@@ -3,6 +3,16 @@ ...@@ -3,6 +3,16 @@
<view class="common-title"> <view class="common-title">
</view> </view>
<template v-if="loadComplete"> <template v-if="loadComplete">
<view class="fixed-box flex">
<view class="fixed-title flex">
<view class="sprite-icon icon-negotiation-detail-count"></view>
今日待接待客户数<text class="text-primary">5</text>
</view>
<view class="fixed-btn flex" @click="$refs.CustomerDrawer.open()">
查看客户
<uni-icons type="right" size="12" color="#2C66F7"></uni-icons>
</view>
</view>
<template v-if="list.length"> <template v-if="list.length">
<view class="daily-report-container"> <view class="daily-report-container">
<template v-for="(i, index) in list"> <template v-for="(i, index) in list">
...@@ -41,6 +51,7 @@ ...@@ -41,6 +51,7 @@
<nothing v-else /> <nothing v-else />
</template> </template>
<EditForm ref="editForm" @onDel="delItem" @onConfirm="confirm" /> <EditForm ref="editForm" @onDel="delItem" @onConfirm="confirm" />
<CustomerDrawer ref="CustomerDrawer" @onConfirm="chooseCustomer" />
</view> </view>
</template> </template>
...@@ -50,8 +61,9 @@ import Nothing from '../components/Nothing' ...@@ -50,8 +61,9 @@ import Nothing from '../components/Nothing'
import Footer from '../components/Footer' import Footer from '../components/Footer'
import utils from '@/utils/utils' import utils from '@/utils/utils'
import EditForm from '../components/EditForm' import EditForm from '../components/EditForm'
import CustomerDrawer from './components/CustomerDrawer'
export default { export default {
components: { Table, Nothing, Footer, EditForm }, components: { Table, Nothing, Footer, EditForm, CustomerDrawer },
name: 'edit', name: 'edit',
inject: ['sceneType'], inject: ['sceneType'],
props: { props: {
...@@ -108,7 +120,7 @@ export default { ...@@ -108,7 +120,7 @@ export default {
addItem(index) { addItem(index) {
let { templateData, saveBtn } = this, let { templateData, saveBtn } = this,
parent = this.list[index] parent = this.list[index]
if(!saveBtn) return if (!saveBtn) return
this.list[index].children.push(templateData[index].origin_children) this.list[index].children.push(templateData[index].origin_children)
let data = this.list[index].children[this.list[index].children.length - 1], let data = this.list[index].children[this.list[index].children.length - 1],
c_index = this.list[index].children.length - 1 c_index = this.list[index].children.length - 1
...@@ -119,7 +131,61 @@ export default { ...@@ -119,7 +131,61 @@ export default {
}, },
formatValue(value) { formatValue(value) {
return value !== null && value !== '' && value !== undefined ? value : '-' return value !== null && value !== '' && value !== undefined ? value : '-'
},
chooseCustomer(data) {
let list = JSON.parse(JSON.stringify(this.list)),
inviteDateKey = ['F3-1-1', 'F3-2-1', 'F3-3-1', 'F3-4-1'],
customerPhoneKey = ['F3-1-5', 'F3-2-5', 'F3-3-5', 'F3-4-6'],
customerNameKey = ['F3-1-4', 'F3-2-4', 'F3-3-4', 'F3-4-5'],
staffKey = ['F3-1-8', 'F3-2-8', 'F3-3-8', 'F3-4-2'],
carBandKey = ['F3-1-6', 'F3-2-6', 'F3-3-6', 'F3-4-7']
try {
list.forEach(item => {
if (!item.children) {
item.children = []
}
let len = item.children.length,
maxLength = item.rules.maxLength,
children = item.origin_children
if (len + data.length > maxLength) throw item.label
data.forEach(i => {
const clonedChildren = JSON.parse(JSON.stringify(children)),
{ inviteDate, customerPhone, customerName, advanceUserName, advanceUserId,
carSeriesName,
carSeriesId,
carChildsBrandName,
carChildsBrandId,
carBrand,
carBrandId
} = i
clonedChildren.forEach(clonedChild => {
if (inviteDateKey.includes(clonedChild.key) && inviteDate) clonedChild.value = inviteDate
if (customerPhoneKey.includes(clonedChild.key) && customerPhone) clonedChild.value = customerPhone
if (customerNameKey.includes(clonedChild.key) && customerName) clonedChild.value = customerName
if (staffKey.includes(clonedChild.key) && advanceUserName && advanceUserId) {
clonedChild.value = advanceUserName
clonedChild[clonedChild.key] = advanceUserId
} }
if (carBandKey.includes(clonedChild.key) && carBrand && carChildsBrandName && carSeriesName) {
clonedChild.value = [carBrand, carChildsBrandName, carSeriesName].join('-')
clonedChild[clonedChild.key] = {
vehicleBrandId: carBrandId,
vehicleBrandName: carBrand,
vehicleSubBrandId: carChildsBrandId,
vehicleSubBrandName: carChildsBrandName,
vehicleSeriesId: carSeriesId,
vehicleSeriesName: carSeriesName,
}
}
})
item.children.push(clonedChildren)
})
})
this.list = list
} catch (error) {
this.$emit('maxLengthError', error)
}
},
} }
} }
</script> </script>
...@@ -129,18 +195,62 @@ export default { ...@@ -129,18 +195,62 @@ export default {
height: 100%; height: 100%;
position: relative; position: relative;
.fixed-box {
height: 144rpx;
box-sizing: border-box;
padding: 48rpx 48rpx 32rpx;
position: relative;
z-index: 2;
.fixed-title {
font-size: 34rpx;
font-weight: 500;
line-height: 40rpx;
color: #292D33;
.sprite-icon {
margin-right: 18rpx;
}
.text-primary {
margin-left: 18rpx;
color: #2c66f7;
font-size: 32rpx;
font-weight: 700;
}
}
.fixed-btn {
margin-left: auto;
height: 64rpx;
border-radius: 16rpx;
border: 2rpx solid #2C66F71A;
font-size: 32rpx;
font-weight: 500;
color: #2C66F7;
font-size: 28rpx;
padding: 0 32rpx;
gap: 8rpx;
background-color: #2C66F70D;
}
}
&-container { &-container {
height: calc(100% - #{toRpx(184)}); height: calc(100% - #{toRpx(280)});
padding: 0 48rpx; padding: 0 48rpx;
box-sizing: border-box; box-sizing: border-box;
overflow-y: auto; overflow-y: auto;
transform: translateY(48rpx); // transform: translateY(48rpx);
} }
.common-title { .common-title {
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
&::after {
opacity: 0;
}
} }
.list-box { .list-box {
...@@ -197,7 +307,8 @@ export default { ...@@ -197,7 +307,8 @@ export default {
} }
} }
} }
.disabled{
.disabled {
opacity: .5; opacity: .5;
} }
} }
...@@ -212,7 +323,7 @@ export default { ...@@ -212,7 +323,7 @@ export default {
} }
.footer { .footer {
transform: translateY(48rpx); // transform: translateY(48rpx);
height: 136rpx; height: 136rpx;
.btn { .btn {
......
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
<Detail :templateData="templateData" /> <Detail :templateData="templateData" />
</template> </template>
<template v-else> <template v-else>
<Edit :templateData="templateData" @submitReport="submitReport" @getSaveBtnStatus="saveBtnStatus = $event" :ReportStatus="ReportStatus" /> <Edit :templateData="templateData" @submitReport="submitReport" @getSaveBtnStatus="saveBtnStatus = $event"
:ReportStatus="ReportStatus" @maxLengthError="$emit('maxLengthError',$event)" />
</template> </template>
</view> </view>
</template> </template>
......
...@@ -30,8 +30,8 @@ ...@@ -30,8 +30,8 @@
</view> </view>
</template> </template>
<template v-else> <template v-else>
<picker class="picker" mode="selector" @change="select" :range="item.options" range-key="label"> <picker class="picker" mode="selector" @change="select" :range="item.options || []" range-key="label">
<view :class="['select flex', { 'placeholderStyle': !item.value }]" @click="select"><text <view :class="['select flex', { 'placeholderStyle': !item.value }]" ><text
class="text-hide">{{ item.value || item.placeholder || '请选择' }}</text> class="text-hide">{{ item.value || item.placeholder || '请选择' }}</text>
<view class="sprite-icon icon-icon-select"></view> <view class="sprite-icon icon-icon-select"></view>
</view> </view>
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
<view class="detail-right"> <view class="detail-right">
<component :ref="`ref-${componentName}`" :is="componentName" :templateData="templateData" <component :ref="`ref-${componentName}`" :is="componentName" :templateData="templateData"
:currentDate="currentDate" @changeComponent="changeComponent" @submitReport="submitReport" :currentDate="currentDate" @changeComponent="changeComponent" @submitReport="submitReport"
@saveReportStatus="saveReportStatus" :ReportStatus="reportStatus" /> @saveReportStatus="saveReportStatus" :ReportStatus="reportStatus" @maxLengthError="maxLengthError" />
</view> </view>
</view> </view>
<NoticePopup ref="notice" :title="noticeObj.title" :text="noticeObj.text" :type="noticeObj.type || 'success'" <NoticePopup ref="notice" :title="noticeObj.title" :text="noticeObj.text" :type="noticeObj.type || 'success'"
...@@ -208,7 +208,7 @@ export default { ...@@ -208,7 +208,7 @@ export default {
const setA = new Set(arrA) const setA = new Set(arrA)
return arrB.every(item => setA.has(item)) return arrB.every(item => setA.has(item))
} }
const { templateType, CAR_BRAND_ID, BASE_SCENE_CODE ,STORE_BASE_SCENE_CODE } = this, const { templateType, CAR_BRAND_ID, BASE_SCENE_CODE, STORE_BASE_SCENE_CODE } = this,
data = await uni.$api.dailyTemplateApi.getDailyTemplate(templateType), data = await uni.$api.dailyTemplateApi.getDailyTemplate(templateType),
baseCode = templateType == 2 ? STORE_BASE_SCENE_CODE : BASE_SCENE_CODE baseCode = templateType == 2 ? STORE_BASE_SCENE_CODE : BASE_SCENE_CODE
let templateData = Object.values(data) let templateData = Object.values(data)
...@@ -302,12 +302,12 @@ export default { ...@@ -302,12 +302,12 @@ export default {
this.changeCurrentDate(e) this.changeCurrentDate(e)
}) })
}, },
openNotice({ title, text, type, buttons }, back = true, callBack) { openNotice({ title, text, type, buttons, hideCancel }, back = true, callBack) {
this.noticeObj = { let noticeObj = {
title: title || '重要提示', title: title || '重要提示',
text: text || '确认提交后将不可再编辑,确认继续?', text: text || '确认提交后将不可再编辑,确认继续?',
type: type || 'warning', type: type || 'warning',
buttons: [ }, buttonsObj = [
{ {
text: buttons.cancelText || '取消', text: buttons.cancelText || '取消',
type: 'default', type: 'default',
...@@ -325,7 +325,9 @@ export default { ...@@ -325,7 +325,9 @@ export default {
} }
} }
] ]
} if (hideCancel) buttonsObj.splice(0, 1)
noticeObj.buttons = buttonsObj
this.noticeObj = noticeObj
this.$refs.notice.open() this.$refs.notice.open()
}, },
async getReportDetail() { async getReportDetail() {
...@@ -448,6 +450,18 @@ export default { ...@@ -448,6 +450,18 @@ export default {
this.getReportList() this.getReportList()
this.getReportDetail() this.getReportDetail()
}, 1.5e3) }, 1.5e3)
},
maxLengthError(label) {
this.openNotice(
{
title: '添加失败',
text: `${label}一次最多添加20个客户`,
buttons: {
confirmText: '知道了'
},
hideCancel: true
},
false)
} }
} }
} }
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<text class="uni-calendar__header-text uni-calendar--fixed-width">{{cancelText}}</text> <text class="uni-calendar__header-text uni-calendar--fixed-width">{{cancelText}}</text>
</view> </view>
</template> </template>
<viw :class="['uni-calendar__header-title',{'header-title-center':showBottomBtn}]">{{title}}</viw> <view :class="['uni-calendar__header-title',{'header-title-center':showBottomBtn}]">{{title}}</view>
<template v-if="!showBottomBtn"> <template v-if="!showBottomBtn">
<view <view
class="uni-calendar__header-btn-box" class="uni-calendar__header-btn-box"
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!