Commit bace7c2f by 岑成威

Merge remote-tracking branch 'origin/saas+v5.8.3' into saas+v5.8.3

2 parents 7dbeb4b9 eaf46cf5
...@@ -26,7 +26,10 @@ ...@@ -26,7 +26,10 @@
<view :class="['sprite-icon', subIcon]"></view> <view :class="['sprite-icon', subIcon]"></view>
{{ subTitle }} {{ subTitle }}
<template v-if="options.type == 'task' && taskList.length"> <template v-if="options.type == 'task' && taskList.length">
<view class="btn flex" @click="confirmAllTask">全部任务合并推送</view> <view class="btn-box flex">
<view class="btn primary-btn flex" @click="confirmAllTask(1)">立即推送</view>
<view class="btn flex" @click="confirmAllTask(2)">暂不推送</view>
</view>
</template> </template>
</view> </view>
<template v-if="loadComplete"> <template v-if="loadComplete">
...@@ -36,7 +39,7 @@ ...@@ -36,7 +39,7 @@
<task-item :key="index" :item="{ <task-item :key="index" :item="{
...item, ...item,
qwGroupName: options.data.qwGroupName qwGroupName: options.data.qwGroupName
}" :num="index" :type="options.type" @confirmTask="confirmTask" /> }" :num="index" :type="options.type"/>
</template> </template>
<view class="p-b"></view> <view class="p-b"></view>
</view> </view>
...@@ -81,15 +84,15 @@ export default { ...@@ -81,15 +84,15 @@ export default {
let { type } = this.options, let { type } = this.options,
title = { title = {
task: '客户基础信息', task: '客户基础信息',
taskRecord: '任务记录' taskRecord: '活动记录'
}[type] }[type]
return title return title
}, },
subTitle() { subTitle() {
let { type } = this.options, let { type } = this.options,
title = { title = {
task: '推送运营任务', task: '推送运营活动',
taskRecord: '任务记录(近7天)' taskRecord: '活动记录(近7天)'
}[type] }[type]
return title return title
}, },
...@@ -161,32 +164,18 @@ export default { ...@@ -161,32 +164,18 @@ export default {
} }
}, },
confirmTask({ confirmStatus, item }) { confirmAllTask(confirmStatus) {
let _this = this
uni.showModal({
title: confirmStatus == 1 ? '确认向客户群推送该营销任务?' : '确认不触达该营销任务?',
content: confirmStatus == 1 ? '推送后将无法撤回。' : '本次任务将终止执行。',
confirmColor: '#347BFF',
success(res) {
if (res.confirm) _this.confirmSopTask({
taskId: item.taskId,
confirmStatus
})
}
})
},
confirmAllTask() {
let _this = this, let _this = this,
{ taskList } = this, { taskList } = this,
taskIds = taskList.filter(item => item.taskStatus == 0).map(item => item.taskId) taskIds = taskList.filter(item => item.taskStatus == 0).map(item => item.taskId)
uni.showModal({ uni.showModal({
title: '确认向客户群推送该营销任务?', title: confirmStatus == 1 ? '确认向客户群推送该营销活动?' : '确认不推送该营销活动?',
content: '推送后将无法撤回。', content: confirmStatus == 1 ? '推送后将无法撤回。' : '本次活动将终止执行。',
confirmColor: '#347BFF', confirmColor: '#347BFF',
success(res) { success(res) {
if (res.confirm) _this.confirmSopTask({ if (res.confirm) _this.confirmSopTask({
taskIds, taskIds,
confirmStatus: 1 confirmStatus
}, true) }, true)
} }
}) })
...@@ -315,15 +304,25 @@ export default { ...@@ -315,15 +304,25 @@ export default {
margin-right: toRpx(18); margin-right: toRpx(18);
} }
.btn { .btn-box {
margin-left: auto; margin-left: auto;
background-color: #2C66F7;
color: #FFFFFF; .btn {
margin-left: toRpx(16);
padding: 0 toRpx(32); padding: 0 toRpx(32);
border-radius: toRpx(16); border-radius: toRpx(8);
height: toRpx(64); border: toRpx(2) solid #DCE1E6;
line-height: toRpx(64); color: #292D33;
font-size: toRpx(28); font-size: toRpx(26);
height: toRpx(56);
line-height: toRpx(56);
}
.primary-btn {
border-color: #2C66F71A;
background-color: #2C66F70D;
color: #2C66F7;
}
} }
} }
...@@ -332,9 +331,11 @@ export default { ...@@ -332,9 +331,11 @@ export default {
height: toRpx(28); height: toRpx(28);
} }
} }
.scroll-content{
.scroll-content {
height: calc(100% - #{toRpx(128)}); height: calc(100% - #{toRpx(128)});
} }
.nothing { .nothing {
height: calc(100% - #{toRpx(484)}); height: calc(100% - #{toRpx(484)});
} }
......
...@@ -47,8 +47,8 @@ ...@@ -47,8 +47,8 @@
</view> </view>
<view class="row-item action-col"> <view class="row-item action-col">
<view class="action-btn primary-btn" v-if="type == 0" @click="pushTask(item)">推送运营任务</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 class="action-btn secondary-btn" @click="viewTaskRecord(item)">查看活动记录</view>
</view> </view>
</view> </view>
<template v-if="noMore"> <template v-if="noMore">
......
<template> <template>
<view class="task-item"> <view class="task-item">
<view class="task-item-title flex"> <view class="task-item-title flex">
<view class="tag flex">任务{{ num + 1 }}</view> <view class="tag flex">活动{{ num + 1 }}</view>
<view class="text flex"> <view class="text flex">
向客户群发送消息 向客户群发送消息
<template v-if="type == 'taskRecord'"> <template v-if="type == 'taskRecord'">
...@@ -10,11 +10,7 @@ ...@@ -10,11 +10,7 @@
</template> </template>
</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" @click="confirmTask(1)">立即推送</view>
<view class="btn" @click="confirmTask(2)">暂不推送</view>
</template>
<template v-else>
<view :class="['status flex', taskStatusClass(item.taskStatus)]">{{ taskStatus(item.taskStatus) }}</view> <view :class="['status flex', taskStatusClass(item.taskStatus)]">{{ taskStatus(item.taskStatus) }}</view>
</template> </template>
</view> </view>
...@@ -39,7 +35,8 @@ ...@@ -39,7 +35,8 @@
</template> </template>
<template v-else> <template v-else>
<!-- <video controls :src="item.mediaIds" class="video" ></video> --> <!-- <video controls :src="item.mediaIds" class="video" ></video> -->
<DomVideoPlayer class="video" ref="domVideoPlayer" :src="item.mediaIds" :poster="defaultPoster" controls /> <DomVideoPlayer class="video" ref="domVideoPlayer" :src="item.mediaIds" :poster="defaultPoster"
controls />
</template> </template>
</template> </template>
<template v-else-if="item.messageType == 4"> <template v-else-if="item.messageType == 4">
...@@ -197,24 +194,6 @@ export default { ...@@ -197,24 +194,6 @@ export default {
.btn-box { .btn-box {
margin-left: auto; margin-left: auto;
.btn {
margin-left: toRpx(16);
padding: 0 toRpx(32);
border-radius: toRpx(8);
border: toRpx(2) solid #DCE1E6;
color: #292D33;
font-size: toRpx(26);
height: toRpx(56);
line-height: toRpx(56);
}
.primary-btn {
border-color: #2C66F71A;
background-color: #2C66F70D;
color: #2C66F7;
}
.status { .status {
display: inline-block; display: inline-block;
padding: 0 toRpx(32); padding: 0 toRpx(32);
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
<view class="tips flex"> <view class="tips flex">
<view class="today flex"> <view class="today flex">
<view class="sprite-icon icon-customer-sop-1"></view> <view class="sprite-icon icon-customer-sop-1"></view>
今日任务({{ toDay }}) 今日活动({{ toDay }})
</view> </view>
<view class="text">根据SOP策略生成营销任务,请及时推送客户</view> <view class="text">根据SOP策略生成营销活动,请及时推送客户</view>
</view> </view>
<view class="tabs-box flex"> <view class="tabs-box flex">
<template v-for="(tab, index) in tabs"> <template v-for="(tab, index) in tabs">
......
...@@ -40,7 +40,8 @@ export default { ...@@ -40,7 +40,8 @@ export default {
}, },
data () { data () {
return { return {
sellerEmployeeList: [] sellerEmployeeList: [],
defaultEmployeeList: []
} }
}, },
watch: { watch: {
...@@ -56,7 +57,7 @@ export default { ...@@ -56,7 +57,7 @@ export default {
return this.$store.state.user.historyStatus return this.$store.state.user.historyStatus
}, },
selectedId () { selectedId () {
if (Array.isArray(this.list) || this.employeeType === 'seller') { if (Array.isArray(this.list) || this.employeeType === 'seller' || this.employeeType === 'default') {
return this.salesPropsUuid return this.salesPropsUuid
} }
return this.$store.state.user.customerInfo.salesUuid || this.salesPropsUuid return this.$store.state.user.customerInfo.salesUuid || this.salesPropsUuid
...@@ -68,6 +69,9 @@ export default { ...@@ -68,6 +69,9 @@ export default {
if (this.employeeType === 'seller') { if (this.employeeType === 'seller') {
return this.sellerEmployeeList return this.sellerEmployeeList
} }
if (this.employeeType === 'default') {
return this.defaultEmployeeList
}
return this.$store.state.user.employeeList return this.$store.state.user.employeeList
} }
}, },
...@@ -94,6 +98,17 @@ export default { ...@@ -94,6 +98,17 @@ export default {
this.sellerEmployeeList = res || [] this.sellerEmployeeList = res || []
return return
} }
if (this.employeeType === 'default') {
if (this.defaultEmployeeList.length) return
const { shopMerchantId, sceneType } = userInfo
const apiTargetName = sceneType == 1 ? 'getEmployeeList' : 'getOrderScreenEmployeeList'
const res = await uni.$api.popupApi[apiTargetName]({
merchantId: shopMerchantId,
sceneList: [sceneType]
})
this.defaultEmployeeList = res || []
return
}
const employeeList = this.$store.state.user.employeeList const employeeList = this.$store.state.user.employeeList
if (employeeList && employeeList.length) return if (employeeList && employeeList.length) return
const { shopMerchantId } = userInfo const { shopMerchantId } = userInfo
......
...@@ -325,6 +325,7 @@ export default { ...@@ -325,6 +325,7 @@ export default {
} }
.goods-box { .goods-box {
width: 100%; width: 100%;
overflow: visible;
.goods-img-wrap { .goods-img-wrap {
position: relative; position: relative;
...@@ -376,17 +377,18 @@ export default { ...@@ -376,17 +377,18 @@ export default {
$goods-item-height: 120px; $goods-item-height: 120px;
$shadow-space: 8px; $shadow-space: 8px;
width: 100%; // 向外扩展滚动视口,配合首尾 margin 消除左右空隙并保留阴影绘制空间
width: calc(100% + #{$shadow-space * 2});
margin: toRpx(28) (-$shadow-space);
height: calc(#{$goods-item-height} + #{$shadow-space * 2}); height: calc(#{$goods-item-height} + #{$shadow-space * 2});
white-space: nowrap; white-space: nowrap;
margin: toRpx(28) 0;
.goods-menu-inner { .goods-menu-inner {
display: flex; display: flex;
flex-wrap: nowrap; flex-wrap: nowrap;
gap: 12px; gap: 12px;
height: $goods-item-height; height: $goods-item-height;
padding: $shadow-space; padding: $shadow-space 0;
box-sizing: content-box; box-sizing: content-box;
} }
...@@ -398,13 +400,21 @@ export default { ...@@ -398,13 +400,21 @@ export default {
height: $goods-item-height; height: $goods-item-height;
display: flex; display: flex;
align-items: stretch; align-items: stretch;
overflow: hidden; overflow: visible;
border: none; border: none;
border-radius: 8px; border-radius: 8px;
background: #FFF; background: #FFF;
box-shadow: 0 2px 8px 0 rgba(44, 102, 247, 0.10); box-shadow: 0 2px 8px 0 rgba(44, 102, 247, 0.10);
cursor: pointer; cursor: pointer;
&:first-child {
margin-left: $shadow-space;
}
&:last-child {
margin-right: $shadow-space;
}
&.active { &.active {
border: 1.5px solid rgba(44, 102, 247, 0.10); border: 1.5px solid rgba(44, 102, 247, 0.10);
background: linear-gradient(0deg, rgba(44, 102, 247, 0.05) 0%, rgba(44, 102, 247, 0.05) 100%), #FFF; background: linear-gradient(0deg, rgba(44, 102, 247, 0.05) 0%, rgba(44, 102, 247, 0.05) 100%), #FFF;
...@@ -417,7 +427,7 @@ export default { ...@@ -417,7 +427,7 @@ export default {
top: 0; top: 0;
z-index: 2; z-index: 2;
padding: 2px 10px; padding: 2px 10px;
border-radius: 0 0 8px 0; border-radius: 8px 0 8px 0;
background: linear-gradient(270deg, #FF6748 0%, #F24724 100%); background: linear-gradient(270deg, #FF6748 0%, #F24724 100%);
font-size: 12px; font-size: 12px;
line-height: normal; line-height: normal;
...@@ -437,6 +447,7 @@ export default { ...@@ -437,6 +447,7 @@ export default {
width: 88px; width: 88px;
height: $goods-item-height; height: $goods-item-height;
overflow: hidden; overflow: hidden;
border-radius: 8px 0 0 8px;
margin-right: toRpx(24); margin-right: toRpx(24);
} }
......
...@@ -293,41 +293,50 @@ export default { ...@@ -293,41 +293,50 @@ export default {
border-radius: 10px; border-radius: 10px;
background: rgba(44, 102, 247, 0.05); background: rgba(44, 102, 247, 0.05);
box-sizing: border-box; box-sizing: border-box;
min-height: 32px;
.customer-count-left { .customer-count-left,
.customer-count-right {
display: flex; display: flex;
align-items: center; align-items: center;
}
.customer-count-left {
gap: 2px; gap: 2px;
min-width: 0; min-width: 0;
flex: 1;
}
.customer-count-right {
gap: 2px;
flex-shrink: 0;
margin-left: 8px;
} }
.customer-count-icon { .customer-count-icon {
width: 16px; width: 16px;
height: 16px; height: 16px;
flex-shrink: 0; flex-shrink: 0;
display: block;
} }
.customer-count-label { .customer-count-label,
font-size: 13px; .customer-count-num,
line-height: normal; .customer-count-unit {
color: #6C6F75; line-height: 16px;
white-space: nowrap; white-space: nowrap;
} }
.customer-count-right { .customer-count-label {
display: flex; font-size: 13px;
align-items: flex-start; color: #6C6F75;
gap: 2px;
flex-shrink: 0;
} }
.customer-count-num, .customer-count-num,
.customer-count-unit { .customer-count-unit {
font-size: 14px; font-size: 14px;
line-height: normal;
font-weight: 500; font-weight: 500;
color: #2C66F7; color: #2C66F7;
white-space: nowrap;
} }
} }
......
...@@ -520,7 +520,7 @@ export default { ...@@ -520,7 +520,7 @@ export default {
methods: { methods: {
handleHomeContentTabClick(index) { handleHomeContentTabClick(index) {
this.homeContentTabIndex = index this.homeContentTabIndex = index
console.log('当前选中标签:', this.currentHomeContentTab) this.getCustomerProfileGroupInfo()
}, },
_syncShowFloatLog() { _syncShowFloatLog() {
this.showFloatLog = FloatLogConfig.isLogBallVisible() this.showFloatLog = FloatLogConfig.isLogBallVisible()
...@@ -709,7 +709,10 @@ export default { ...@@ -709,7 +709,10 @@ export default {
} }
}, },
async changeTab({ item, index }) { async changeTab({ item, index }) {
if (index == 0) this.$refs.messageRef.getMessageSummary() if (index == 0) {
this.$refs.messageRef.getMessageSummary()
this.getCustomerProfileGroupInfo()
}
this.previewOff = index != 0 this.previewOff = index != 0
this.$emit('changeTab', index) this.$emit('changeTab', index)
console.log(this.$refs.leftBox.hasPopupOpen) console.log(this.$refs.leftBox.hasPopupOpen)
...@@ -730,46 +733,74 @@ export default { ...@@ -730,46 +733,74 @@ export default {
* 查询策略首页数据状态(营销活动和客户列表是否有数据) * 查询策略首页数据状态(营销活动和客户列表是否有数据)
*/ */
async getStrategyStatus() { async getStrategyStatus() {
this.$store.state.boutique.boutiqueActivityData = [] // 清空 boutiqueActivityData const { shopMerchantId: merchantId } = uni.$storage.get('userInfo') || {}
const res = await uni.$api.activityApi.getActivityStatusAPI({merchantId: uni.$storage.get('userInfo').shopMerchantId}) if (!merchantId) return
console.log('%c查询策略首页数据状态(营销活动和客户列表是否有数据):', 'color: green;', res)
if (!res) return try {
const res = await uni.$api.activityApi.getActivityStatusAPI({ merchantId })
if (!res) {
this.marketingActivityHasData = false
this.customerListHasData = false
this.activityProductList = []
this.$store.state.boutique.boutiqueActivityData = []
return
}
this.marketingActivityHasData = !!res.marketingActivityHasData this.marketingActivityHasData = !!res.marketingActivityHasData
this.customerListHasData = !!res.customerListHasData this.customerListHasData = !!res.customerListHasData
this.homeContentTabIndex = 0 this.homeContentTabIndex = 0
// 仅「限时产品活动」Tab 展示时才需拉取营销活动商品列表 // 仅「限时产品活动」Tab 展示时才需拉取营销活动商品列表
if (this.marketingActivityHasData || this.customerListHasData) { if (this.marketingActivityHasData) {
this.getActivityProductList() await this.getActivityProductList()
} else {
this.activityProductList = []
this.$store.state.boutique.boutiqueActivityData = []
}
} catch (error) {
console.error('查询策略首页数据状态失败:', error)
} }
}, },
/** /**
* 查询当前进行中的营销活动商品列表 * 查询当前进行中的营销活动商品列表
*/ */
async getActivityProductList() { async getActivityProductList() {
const { shopMerchantId } = uni.$storage.get('userInfo') const { shopMerchantId: merchantId } = uni.$storage.get('userInfo') || {}
console.log('**&&merchantId**', shopMerchantId) if (!merchantId) {
const res = await uni.$api.activityApi.getActivityProductListAPI({merchantId: shopMerchantId}) this.activityProductList = []
console.log('查询当前进行中的营销活动商品列表:', res) this.$store.state.boutique.boutiqueActivityData = []
this.activityProductList = res return
// console.log('查询当前进行中的营销活动商品列表:', res) }
this.$store.state.boutique.boutiqueActivityData = res
try {
const res = await uni.$api.activityApi.getActivityProductListAPI({ merchantId })
const list = Array.isArray(res) ? res : []
this.activityProductList = list
this.$store.state.boutique.boutiqueActivityData = list
} catch (error) {
console.error('查询营销活动商品列表失败:', error)
this.activityProductList = []
this.$store.state.boutique.boutiqueActivityData = []
}
}, },
/** /**
* 查询客户建档分页查询-月按天分组 * 查询客户建档分页查询-月按天分组
*/ */
async getCustomerProfileGroupInfo() { async getCustomerProfileGroupInfo() {
let shopMerchantId = uni.$storage.get('userInfo').shopMerchantId const { shopMerchantId: merchantId } = uni.$storage.get('userInfo') || {}
console.log('getCustomerProfileGroupInfo***merchantId:', uni.$storage.get('userInfo')) if (!merchantId) {
let requestParams = { this.customerProfileList = []
merchantId: shopMerchantId return
} }
const res = await uni.$api.customerApi.getCustomerProfileGroupInfoAPI(requestParams)
console.log('getCustomerProfileGroupInfoAPI-月按天分组:', res) try {
if (res) { const res = await uni.$api.customerApi.getCustomerProfileGroupInfoAPI({ merchantId })
this.customerProfileList = res console.log('getCustomerProfileListInfo***')
this.customerProfileList = Array.isArray(res) ? res : []
} catch (error) {
console.error('查询客户建档分组信息失败:', error)
this.customerProfileList = []
} }
}, },
/** /**
...@@ -807,6 +838,7 @@ export default { ...@@ -807,6 +838,7 @@ export default {
if (res.remainingSkipCount != null) { if (res.remainingSkipCount != null) {
this.prelearnData = { ...this.prelearnData, remainingSkipCount: res.remainingSkipCount } this.prelearnData = { ...this.prelearnData, remainingSkipCount: res.remainingSkipCount }
} }
await this.getPrelearnHome()
} catch (e) { } catch (e) {
// uni.$logger?.local?.info('预学习扣减跳过次数失败', e) // uni.$logger?.local?.info('预学习扣减跳过次数失败', e)
} }
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
<view class="required" v-if="i.required">*</view>{{ i.label }} <view class="required" v-if="i.required">*</view>{{ i.label }}
</view> </view>
<template v-if="i.type == 'input'"> <template v-if="i.type == 'input'">
<view class="input-wrap">
<input <input
:type="i.inputType" :type="i.inputType"
:maxlength="i.maxlength" :maxlength="i.maxlength"
...@@ -24,15 +25,18 @@ ...@@ -24,15 +25,18 @@
:placeholder="`请输入${i.label}`" :placeholder="`请输入${i.label}`"
placeholder-style="color:rgba(51, 51, 51, 0.2);" placeholder-style="color:rgba(51, 51, 51, 0.2);"
confirm-type="done" confirm-type="done"
@input="inputChange($event, i)"
@blur="inputBlur($event, i)" @blur="inputBlur($event, i)"
/> />
<view class="error-text" v-if="i.error && i.errorMsg">{{ i.errorMsg }}</view>
</view>
</template> </template>
<template v-else-if="i.type == 'date'"> <template v-else-if="i.type == 'date'">
<picker <picker
mode="date" mode="date"
fields="day" fields="day"
:start="startDate" :start="getDatePickerStart(i)"
:end="endDate" :end="getDatePickerEnd(i)"
@change="bindDateChange($event, i.valueKey)" @change="bindDateChange($event, i.valueKey)"
:value="customerInfo[i.valueKey]" :value="customerInfo[i.valueKey]"
> >
...@@ -66,6 +70,7 @@ ...@@ -66,6 +70,7 @@
<view class="required" v-if="i.required">*</view>{{ i.label }} <view class="required" v-if="i.required">*</view>{{ i.label }}
</view> </view>
<template v-if="i.type == 'input'"> <template v-if="i.type == 'input'">
<view class="input-wrap">
<input <input
:type="i.inputType" :type="i.inputType"
:maxlength="i.maxlength" :maxlength="i.maxlength"
...@@ -74,15 +79,18 @@ ...@@ -74,15 +79,18 @@
:placeholder="`请输入${i.label}`" :placeholder="`请输入${i.label}`"
placeholder-style="color:rgba(51, 51, 51, 0.2);" placeholder-style="color:rgba(51, 51, 51, 0.2);"
confirm-type="done" confirm-type="done"
@input="inputChange($event, i)"
@blur="inputBlur($event, i)" @blur="inputBlur($event, i)"
/> />
<view class="error-text" v-if="i.error && i.errorMsg">{{ i.errorMsg }}</view>
</view>
</template> </template>
<template v-else-if="i.type == 'date'"> <template v-else-if="i.type == 'date'">
<picker <picker
mode="date" mode="date"
fields="day" fields="day"
:start="startDate" :start="getDatePickerStart(i)"
:end="endDate" :end="getDatePickerEnd(i)"
@change="bindDateChange($event, i.valueKey)" @change="bindDateChange($event, i.valueKey)"
:value="customerInfo[i.valueKey]" :value="customerInfo[i.valueKey]"
> >
...@@ -101,7 +109,7 @@ ...@@ -101,7 +109,7 @@
:class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]" :class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]"
@click="showPopup(i)" @click="showPopup(i)"
> >
<view class="value text-hide">{{ getFieldDisplayValue(i) || '请选择' }}</view> <view class="value text-hide">{{ getFieldDisplayValue(i) || i.placeholder || `请选择${i.label}` }}</view>
<uni-icons class="arrow" type="right" :size="16"></uni-icons> <uni-icons class="arrow" type="right" :size="16"></uni-icons>
</view> </view>
</template> </template>
...@@ -123,11 +131,6 @@ ...@@ -123,11 +131,6 @@
carModelKey="carTypeName" carModelKey="carTypeName"
customBoolean customBoolean
/> />
<reception-sence
ref="receptionSceneVisible"
@select="handleSelect($event, 'receptionSceneVisible')"
:customerInfo="customerInfo"
></reception-sence>
<employee <employee
ref="trafficSourceVisible" ref="trafficSourceVisible"
title="流量来源" title="流量来源"
...@@ -155,7 +158,6 @@ ...@@ -155,7 +158,6 @@
<script type='text/ecmascript-6'> <script type='text/ecmascript-6'>
import CarBrands from '@/components/CarBrands.vue' import CarBrands from '@/components/CarBrands.vue'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import ReceptionSence from '@/components/HomeFrame/components/ReceptionCenter/ReceptionSence.vue'
import Employee from '@/components/Employee.vue' import Employee from '@/components/Employee.vue'
import { validateVin, formatVinInput } from '@/utils/vinVaildate' import { validateVin, formatVinInput } from '@/utils/vinVaildate'
const phoneRex = /^[1]([3-9])[0-9]{9}$/, const phoneRex = /^[1]([3-9])[0-9]{9}$/,
...@@ -191,7 +193,8 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/, ...@@ -191,7 +193,8 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/,
valueKey: 'arrivalDate', valueKey: 'arrivalDate',
key: 'arrivalDate', key: 'arrivalDate',
required: true, required: true,
type: 'date' type: 'date',
dateUnlimited: true
}, },
{ {
label: '流量来源', label: '流量来源',
...@@ -202,14 +205,6 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/, ...@@ -202,14 +205,6 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/,
popKey: 'trafficSourceVisible', popKey: 'trafficSourceVisible',
merchantNameKey: 'merchantName' merchantNameKey: 'merchantName'
} }
// {
// label: '接待场景',
// valueKey: 'receptionSceneName',
// key: 'receptionScene',
// type: 'select',
// required: true,
// popKey: 'receptionSceneVisible'
// }
], ],
default_optionalForm = [{ default_optionalForm = [{
label: '车架号', label: '车架号',
...@@ -223,7 +218,8 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/, ...@@ -223,7 +218,8 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/,
label: '到店日期', label: '到店日期',
valueKey: 'inviteDate', valueKey: 'inviteDate',
key: 'inviteDate', key: 'inviteDate',
type: 'date' type: 'date',
dateFromToday: true
}, },
{ {
label: '建档日期', label: '建档日期',
...@@ -235,11 +231,12 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/, ...@@ -235,11 +231,12 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/,
valueKey: 'sellerName', valueKey: 'sellerName',
key: 'sellerUserId', key: 'sellerUserId',
type: 'select', type: 'select',
popKey: 'residentSaleVisible' popKey: 'residentSaleVisible',
placeholder: '请选择驻店零售'
}] }]
export default { export default {
name: 'AddFiles', name: 'AddFiles',
components: { CarBrands, ReceptionSence, Employee }, components: { CarBrands, Employee },
computed: { computed: {
check () { check () {
let { customerForm, customerInfo } = this, let { customerForm, customerInfo } = this,
...@@ -292,9 +289,7 @@ export default { ...@@ -292,9 +289,7 @@ export default {
carTypeName: '', carTypeName: '',
carChildsBrandId: '', carChildsBrandId: '',
carChildsBrandName: '', carChildsBrandName: '',
receptionScene: '',
arrivalDate: '', arrivalDate: '',
receptionSceneName: '',
standNo: '', standNo: '',
employeeName: '', employeeName: '',
userId: '', userId: '',
...@@ -302,7 +297,7 @@ export default { ...@@ -302,7 +297,7 @@ export default {
sellerName: '', sellerName: '',
sellerUserId: '', sellerUserId: '',
inviteDate: '', inviteDate: '',
filingDate: '' filingDate: dayjs().format('YYYY-MM-DD')
} }
this.inviteDateTouched = false this.inviteDateTouched = false
if (this.customerId) this.findVisitsInfo() if (this.customerId) this.findVisitsInfo()
...@@ -315,6 +310,9 @@ export default { ...@@ -315,6 +310,9 @@ export default {
if (res.inviteDate) res.inviteDate = dayjs(res.inviteDate).format("YYYY-MM-DD") if (res.inviteDate) res.inviteDate = dayjs(res.inviteDate).format("YYYY-MM-DD")
if (res.filingDate) res.filingDate = dayjs(res.filingDate).format("YYYY-MM-DD") if (res.filingDate) res.filingDate = dayjs(res.filingDate).format("YYYY-MM-DD")
this.customerInfo = res this.customerInfo = res
if (!this.customerInfo.filingDate) {
this.customerInfo.filingDate = dayjs().format('YYYY-MM-DD')
}
this.inviteDateTouched = !!res.inviteDate this.inviteDateTouched = !!res.inviteDate
}, },
backPage () { backPage () {
...@@ -357,22 +355,65 @@ export default { ...@@ -357,22 +355,65 @@ export default {
this.customerInfo[field.valueKey] = item.staffName this.customerInfo[field.valueKey] = item.staffName
this.customerInfo[field.key] = item.uuid this.customerInfo[field.key] = item.uuid
} }
} else {
this.customerInfo.receptionSceneName = item.receptionSceneName
this.customerInfo.receptionScene = item.id
} }
}, },
getDatePickerStart (field) {
if (field.dateUnlimited) return '1970-01-01'
if (field.dateFromToday) return dayjs().format('YYYY-MM-DD')
return this.startDate
},
getDatePickerEnd (field) {
return field.dateUnlimited ? '2099-12-31' : this.endDate
},
bindDateChange (e, valueKey) { bindDateChange (e, valueKey) {
const value = e.detail.value const value = e.detail.value
this.customerInfo[valueKey] = value this.customerInfo[valueKey] = value
if (valueKey === 'arrivalDate' && !this.inviteDateTouched) { if (valueKey === 'arrivalDate' && !this.customerInfo.inviteDate) {
this.customerInfo.inviteDate = value this.customerInfo.inviteDate = value
} }
if (valueKey === 'inviteDate') { if (valueKey === 'inviteDate') {
this.inviteDateTouched = true this.inviteDateTouched = true
} }
}, },
getPhoneErrorMsg (phone) {
if (!phone) return '请输入手机号'
if (!/^\d+$/.test(phone)) return '手机号只能包含数字'
if (phone.length < 11) return '手机号应为11位'
if (!phoneRex.test(phone)) return '请输入正确的手机号'
return ''
},
setPhoneFieldError (field, phone) {
const errorMsg = this.getPhoneErrorMsg(phone)
field.error = !!errorMsg
field.errorMsg = errorMsg
return !errorMsg
},
inputChange (e, field) {
if (field.key !== 'customerPhone') return
const value = (e.detail.value || '').replace(/\D/g, '').slice(0, 11)
this.customerInfo.customerPhone = value
if (field.error) {
this.setPhoneFieldError(field, value)
}
},
inputBlur (e, val) { inputBlur (e, val) {
if (val.key === 'customerPhone') {
const phone = (this.customerInfo.customerPhone || '').replace(/\D/g, '')
this.customerInfo.customerPhone = phone
if (phone) {
const valid = this.setPhoneFieldError(val, phone)
if (!valid) {
// uni.showToast({
// title: val.errorMsg,
// icon: 'none'
// })
}
} else {
val.error = false
val.errorMsg = ''
}
return
}
const standNoVal = this.customerInfo.standNo const standNoVal = this.customerInfo.standNo
if (val.key === 'standNo' && standNoVal) { if (val.key === 'standNo' && standNoVal) {
this.customerInfo.standNo = formatVinInput(standNoVal) this.customerInfo.standNo = formatVinInput(standNoVal)
...@@ -411,6 +452,7 @@ export default { ...@@ -411,6 +452,7 @@ export default {
try { try {
this.customerForm.map(e => { this.customerForm.map(e => {
e.error = false e.error = false
e.errorMsg = ''
}) })
let { customerInfo, customerForm, optionalForm } = this, let { customerInfo, customerForm, optionalForm } = this,
{ shopMerchantId, sceneType } = uni.$storage.get("userInfo"), { shopMerchantId, sceneType } = uni.$storage.get("userInfo"),
...@@ -419,7 +461,10 @@ export default { ...@@ -419,7 +461,10 @@ export default {
merchantId: shopMerchantId, merchantId: shopMerchantId,
bussinessScene: sceneType == 0 ? 1 : 2 bussinessScene: sceneType == 0 ? 1 : 2
} }
if (!phoneRex.test(customerInfo.customerPhone)) throw 'customerPhone' const phoneField = customerForm.find(e => e.key === 'customerPhone')
const phone = (customerInfo.customerPhone || '').replace(/\D/g, '')
customerInfo.customerPhone = phone
if (phoneField && !this.setPhoneFieldError(phoneField, phone)) throw 'customerPhone'
customerForm.map(e => { customerForm.map(e => {
params[e.key] = customerInfo[e.key] params[e.key] = customerInfo[e.key]
}) })
...@@ -505,7 +550,18 @@ export default { ...@@ -505,7 +550,18 @@ export default {
} catch (error) { } catch (error) {
const index = this.customerForm.findIndex(e => e.key == error) const index = this.customerForm.findIndex(e => e.key == error)
if (index !== -1) { if (index !== -1) {
this.customerForm[index].error = true const field = this.customerForm[index]
if (error === 'customerPhone') {
this.setPhoneFieldError(field, this.customerInfo.customerPhone)
} else {
field.error = true
}
if (field.errorMsg) {
uni.showToast({
title: field.errorMsg,
icon: 'none'
})
}
} }
uni.hideLoading() uni.hideLoading()
} }
...@@ -586,11 +642,25 @@ export default { ...@@ -586,11 +642,25 @@ export default {
justify-content: space-between; justify-content: space-between;
.form-item { .form-item {
width: toRpx(934); width: toRpx(934);
height: toRpx(80); min-height: toRpx(80);
font-size: toRpx(28); font-size: toRpx(28);
align-items: flex-start;
}
.input-wrap {
width: toRpx(738);
.input {
width: 100%;
}
.error-text {
margin-top: toRpx(8);
font-size: toRpx(24);
line-height: toRpx(32);
color: #f24724;
}
} }
.label { .label {
width: toRpx(192); width: toRpx(192);
height: toRpx(76);
color: #292d33; color: #292d33;
justify-content: center; justify-content: center;
.required { .required {
......
...@@ -42,7 +42,9 @@ ...@@ -42,7 +42,9 @@
<view class="required" v-if="i.required">*</view>{{ i.label }} <view class="required" v-if="i.required">*</view>{{ i.label }}
</view> </view>
<template v-if="i.type == 'readonly'"> <template v-if="i.type == 'readonly'">
<view class="input input--readonly text-hide">{{ getFieldDisplayValue(i) || '-' }}</view> <view :class="['input input--readonly text-hide', { placeholderStyle: !getFieldDisplayValue(i) && i.placeholder }]">
{{ getFieldDisplayValue(i) || (i.placeholder || '-') }}
</view>
</template> </template>
<template v-else-if="i.type == 'input'"> <template v-else-if="i.type == 'input'">
<input <input
...@@ -50,7 +52,7 @@ ...@@ -50,7 +52,7 @@
:maxlength="i.maxlength" :maxlength="i.maxlength"
v-model="customerInfo[i.valueKey]" v-model="customerInfo[i.valueKey]"
:class="['input', { error: i.error }]" :class="['input', { error: i.error }]"
placeholder="请选择" :placeholder="`请输入${i.label}`"
placeholder-style="color:rgba(51, 51, 51, 0.2);" placeholder-style="color:rgba(51, 51, 51, 0.2);"
confirm-type="done" confirm-type="done"
@blur="inputBlur($event, i)" @blur="inputBlur($event, i)"
...@@ -60,14 +62,18 @@ ...@@ -60,14 +62,18 @@
<picker <picker
mode="date" mode="date"
fields="day" fields="day"
:start="startDate" :start="getDatePickerStart(i)"
:end="endDate" :end="getDatePickerEnd(i)"
@change="bindDateChange($event, i.valueKey)" @change="bindDateChange($event, i.valueKey)"
:value="customerInfo[i.valueKey]" :value="customerInfo[i.valueKey]"
> >
<view :class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]"> <view :class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]">
<view class="value text-hide">{{ customerInfo[i.valueKey] || '请选择' }}</view> <view class="value text-hide">{{ customerInfo[i.valueKey] || '请选择' }}</view>
<uni-icons class="arrow" type="right" :size="16"></uni-icons> <image
class="calendar-icon"
:src="require('@/assets/images/common/icon-calendar.png')"
mode="aspectFit"
/>
</view> </view>
</picker> </picker>
</template> </template>
...@@ -95,7 +101,7 @@ ...@@ -95,7 +101,7 @@
:maxlength="i.maxlength" :maxlength="i.maxlength"
v-model="customerInfo[i.valueKey]" v-model="customerInfo[i.valueKey]"
:class="['input', { error: i.error }]" :class="['input', { error: i.error }]"
placeholder="请选择" :placeholder="`请输入${i.label}`"
placeholder-style="color:rgba(51, 51, 51, 0.2);" placeholder-style="color:rgba(51, 51, 51, 0.2);"
confirm-type="done" confirm-type="done"
@blur="inputBlur($event, i)" @blur="inputBlur($event, i)"
...@@ -105,14 +111,18 @@ ...@@ -105,14 +111,18 @@
<picker <picker
mode="date" mode="date"
fields="day" fields="day"
:start="startDate" :start="getDatePickerStart(i)"
:end="endDate" :end="getDatePickerEnd(i)"
@change="bindDateChange($event, i.valueKey)" @change="bindDateChange($event, i.valueKey)"
:value="customerInfo[i.valueKey]" :value="customerInfo[i.valueKey]"
> >
<view :class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]"> <view :class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]">
<view class="value text-hide">{{ customerInfo[i.valueKey] || '请选择' }}</view> <view class="value text-hide">{{ customerInfo[i.valueKey] || '请选择' }}</view>
<uni-icons class="arrow" type="right" :size="16"></uni-icons> <image
class="calendar-icon"
:src="require('@/assets/images/common/icon-calendar.png')"
mode="aspectFit"
/>
</view> </view>
</picker> </picker>
</template> </template>
...@@ -149,7 +159,7 @@ ...@@ -149,7 +159,7 @@
:maxlength="i.maxlength" :maxlength="i.maxlength"
v-model="customerInfo[i.valueKey]" v-model="customerInfo[i.valueKey]"
class="input input--count" class="input input--count"
placeholder="请输入" :placeholder="`请输入${i.label}`"
placeholder-style="color:rgba(51, 51, 51, 0.2);" placeholder-style="color:rgba(51, 51, 51, 0.2);"
confirm-type="done" confirm-type="done"
/> />
...@@ -161,7 +171,7 @@ ...@@ -161,7 +171,7 @@
:class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]" :class="['select flex', { placeholderStyle: !customerInfo[i.valueKey] }]"
@click="showPopup(i.popKey)" @click="showPopup(i.popKey)"
> >
<view class="value text-hide">{{ customerInfo[i.valueKey] || '请选择' }}</view> <view class="value text-hide">{{ customerInfo[i.valueKey] || i.placeholder || '请选择' }}</view>
<uni-icons class="arrow" type="right" :size="16"></uni-icons> <uni-icons class="arrow" type="right" :size="16"></uni-icons>
</view> </view>
</template> </template>
...@@ -237,7 +247,8 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/, ...@@ -237,7 +247,8 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/,
valueKey: 'customerPhone', valueKey: 'customerPhone',
key: 'customerPhone', key: 'customerPhone',
type: 'readonly', type: 'readonly',
required: true required: true,
placeholder: '请输入车主手机号'
}, },
{ {
label: '车型', label: '车型',
...@@ -252,7 +263,8 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/, ...@@ -252,7 +263,8 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/,
valueKey: 'deliveryDate', valueKey: 'deliveryDate',
key: 'deliveryDate', key: 'deliveryDate',
required: true, required: true,
type: 'date' type: 'date',
dateUnlimited: true
}, },
// { // {
// label: '接待场景', // label: '接待场景',
...@@ -282,7 +294,8 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/, ...@@ -282,7 +294,8 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/,
label: '到店日期', label: '到店日期',
valueKey: 'inviteDate', valueKey: 'inviteDate',
key: 'inviteDate', key: 'inviteDate',
type: 'date' type: 'date',
dateFromToday: true
}, },
{ {
label: '驻店零售', label: '驻店零售',
...@@ -309,7 +322,8 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/, ...@@ -309,7 +322,8 @@ const phoneRex = /^[1]([3-9])[0-9]{9}$/,
valueKey: 'contact_name', valueKey: 'contact_name',
key: 'contact_id', key: 'contact_id',
type: 'select', type: 'select',
popKey: 'groupMemberVisible' popKey: 'groupMemberVisible',
placeholder: '请选择群成员'
}, },
{ {
label: '备注', label: '备注',
...@@ -413,15 +427,39 @@ export default { ...@@ -413,15 +427,39 @@ export default {
return map[status] || '' return map[status] || ''
}, },
async getCustormDetail() { async getCustormDetail() {
console.log('getCustormDetailAPI***', this.customerId) if (!this.customerId) {
return false
}
try {
const res = await uni.$api.customerApi.customerProfileInfoAPI({ const res = await uni.$api.customerApi.customerProfileInfoAPI({
id: this.customerId id: this.customerId
}) })
console.log('getCustormDetailAPI***', res) if (!res || typeof res !== 'object') {
if(res) { return false
this.customerForm = res }
if (res.deliveryDate) {
res.deliveryDate = dayjs(res.deliveryDate).format('YYYY-MM-DD')
}
if (res.createdDate) {
res.createdDate = dayjs(res.createdDate).format('YYYY-MM-DD')
}
if (res.inviteDate) {
res.inviteDate = dayjs(res.inviteDate).format('YYYY-MM-DD')
}
Object.assign(this.customerInfo, res)
if (!this.customerInfo.contact_id && res.wxId) {
this.customerInfo.contact_id = res.wxId
}
if (!this.customerInfo.contact_name && res.wxName) {
this.customerInfo.contact_name = res.wxName
}
this.syncDisplayInfo(this.customerInfo)
await this.getCustomerGroupInfo()
return true
} catch (error) {
console.error('getCustormDetail 失败', error)
return false
} }
console.log('getCustomerGroupInfoAPI**customerForm*', this.customerForm)
}, },
async submitCustomerProfileAPI(options = {}) { async submitCustomerProfileAPI(options = {}) {
const { fromReception = false } = options const { fromReception = false } = options
...@@ -579,11 +617,22 @@ export default { ...@@ -579,11 +617,22 @@ export default {
} }
}, },
async getCustomerGroupMemberInfoAPI(contactId) { async getCustomerGroupMemberInfoAPI(contactId) {
const qwGroupId = contactId || this.customerInfo.qwGroupId
if (!qwGroupId) {
this.groupMemberList = []
return false
}
try {
const data = await uni.$api.customerApi.getCustomerGroupMemberInfoAPI({ const data = await uni.$api.customerApi.getCustomerGroupMemberInfoAPI({
qwGroupId: contactId qwGroupId
}) })
console.log('群成员getCustomerGroupMemberInfoAPI***', data)
this.groupMemberList = Array.isArray(data) ? data : [] this.groupMemberList = Array.isArray(data) ? data : []
return this.groupMemberList.length > 0
} catch (error) {
console.error('getCustomerGroupMemberInfoAPI 失败', error)
this.groupMemberList = []
return false
}
}, },
syncDisplayInfo (info = this.customerInfo) { syncDisplayInfo (info = this.customerInfo) {
this.headerSnapshot = { this.headerSnapshot = {
...@@ -625,7 +674,7 @@ export default { ...@@ -625,7 +674,7 @@ export default {
receptionSceneName: '', receptionSceneName: '',
standNo: '', standNo: '',
inviteDate: '', inviteDate: '',
createdDate: '', createdDate: dayjs().format('YYYY-MM-DD'),
employeeName: '', employeeName: '',
userId: '', userId: '',
merchantName: '', merchantName: '',
...@@ -647,6 +696,9 @@ export default { ...@@ -647,6 +696,9 @@ export default {
if (res.inviteDate) res.inviteDate = dayjs(res.inviteDate).format("YYYY-MM-DD") if (res.inviteDate) res.inviteDate = dayjs(res.inviteDate).format("YYYY-MM-DD")
// 合并而非整对象替换,保留 initForm 中已声明的响应式字段(如 contact_name) // 合并而非整对象替换,保留 initForm 中已声明的响应式字段(如 contact_name)
Object.assign(this.customerInfo, res) Object.assign(this.customerInfo, res)
if (!this.customerInfo.createdDate) {
this.customerInfo.createdDate = dayjs().format('YYYY-MM-DD')
}
if (!this.customerInfo.contact_id && res.wxId) { if (!this.customerInfo.contact_id && res.wxId) {
this.customerInfo.contact_id = res.wxId this.customerInfo.contact_id = res.wxId
} }
...@@ -711,6 +763,14 @@ export default { ...@@ -711,6 +763,14 @@ export default {
this.customerInfo.receptionScene = item.id this.customerInfo.receptionScene = item.id
} }
}, },
getDatePickerStart (field) {
if (field.dateUnlimited) return '1970-01-01'
if (field.dateFromToday) return dayjs().format('YYYY-MM-DD')
return this.startDate
},
getDatePickerEnd (field) {
return field.dateUnlimited ? '2099-12-31' : this.endDate
},
bindDateChange (e, valueKey) { bindDateChange (e, valueKey) {
this.customerInfo[valueKey] = e.detail.value this.customerInfo[valueKey] = e.detail.value
}, },
...@@ -1030,6 +1090,12 @@ export default { ...@@ -1030,6 +1090,12 @@ export default {
margin-left: auto; margin-left: auto;
flex-shrink: 0; flex-shrink: 0;
} }
.calendar-icon {
width: 16px;
height: 16px;
margin-left: auto;
flex-shrink: 0;
}
.error { .error {
border: toRpx(2) solid #f24724 !important; border: toRpx(2) solid #f24724 !important;
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!