Commit f1ae7840 by 张立顺

Merge branch 'SAAS+V5.3.0-1117' of 192.168.3.233:saas_plus/sales-assistant into SAAS+V5.3.0-1117

2 parents 91bc6336 01111065
Showing 47 changed files with 642 additions and 784 deletions
......@@ -29,7 +29,7 @@ module.exports = {
method: `${common}uploadImg`,
...data,
noSignAttr: ['file']
})
}, false, 'scrm')
},
/**视频上传
*/
......
......@@ -14,6 +14,13 @@ class CustomerApi {
...data
})
}
// 获取主营品牌车型数据
getCarBrandList(data) {
return api.post({
method: "dj.api.sale.getCarBrandTree",
...data
})
}
// 获取门店的KPI进度数据
getKPIData(data) {
return api.post({
......@@ -40,35 +47,28 @@ class CustomerApi {
return api.post({
method: "dj.api.sale.potential.customer.add",
...data
})
}, true)
}
// 信息完善
editCustomer(data) {
return api.post({
method: "dj.api.sale.potential.customer.edit",
...data
})
}
// 获取省市区数据
getAreaData(data) {
return api.post({
method: "dj.api.sale.map.districts",
...data
})
}, true)
}
// 新增拜访
addVisit(data) {
return api.post({
method: "dj.api.sale.potential.customer.visit.add",
...data
})
}, true)
}
// 结果反馈
reslutFeedbackApi(data) {
return api.post({
method: "dj.api.sale.potential.customer.result.feedback",
...data
})
}, true)
}
// 拜访记录列表
getVisitList(data) {
......@@ -112,6 +112,45 @@ class CustomerApi {
...data
})
}
// 获取门店信息-盈亏情况展业情况预警
getStoreOverviewData(data) {
return api.post({
method: "dj.api.sale.store.overview",
...data
})
}
// 门店经营分析-门店总产值和客单价
queryMerchantOutputAndAtv(data) {
return api.get({
apiProjectName: 'sale',
projectName: 'sale',
...data
}, true, 'merchant', '/merchant/queryMerchantOutputAndAtv')
}
// 门店经营分析-产值趋势
queryMerchantOutputTrend(data) {
return api.get({
apiProjectName: 'sale',
projectName: 'sale',
...data
}, true, 'merchant', '/merchant/queryMerchantOutputTrend')
}
// 门店经营分析-新车交付数、新车到店流量、售后到店流量、成交量
queryMerchantBuyAndTostore(data) {
return api.get({
apiProjectName: 'sale',
projectName: 'sale',
...data
}, true, 'merchant', '/merchant/queryMerchantBuyAndTostore')
}
// 门店经营分析-销售人员
queryServiceSupervisionSale(data) {
return api.get({
apiProjectName: 'sale',
projectName: 'sale',
...data
}, true, 'merchant', '/merchant/queryServiceSupervisionSale')
}
}
export default CustomerApi
\ No newline at end of file
// packageMine/components/CarBrand/CarBrand.js
import mineApi from '~/api/mineApi/index'
import CustomerApi from '~/api/customerApi/index'
import Util from '~/utils/util'
Component({
/**
......@@ -92,7 +92,7 @@ Component({
this.formatData(brandlist)
})
} else {
mineApi.getCarBrandList().then(data => {
CustomerApi.getCarBrandList().then(data => {
wx.$storage.set('car_brand_list', data)
this.dealSelectedList(Util.deepClone(data)).then(brandlist => {
this.formatData(brandlist)
......@@ -164,7 +164,7 @@ Component({
height: _res.bottom
})
})
})
}, true)
},
dealSelectList(index, pidx, cidx) {
let { selectingList } = this.data
......
......@@ -6,7 +6,7 @@
display: grid;
align-items: center;
font-size: 28rpx;
color: #999999;
color: #5A5E66;
position: relative;
}
......
......@@ -11,7 +11,7 @@ Component({
* 组件的属性列表
*/
properties: {
merchantId: Number
},
/**
......@@ -63,7 +63,6 @@ Component({
weekList: [],
weekColumns: [],
currentWeek: {},
merchantId: '',
boardData: {},
leftCurrent: false,
rightCurrent: false,
......@@ -72,19 +71,12 @@ Component({
keys: ['stattime', 'output'],
color: '#69C9FF',
lineColr: '#6ED0BE',
tickCount: 8,
lineList: [],
barList: [],
tickCount: 8
},
},
lifetimes: {
attached() {
// 获取当前页面的merchantId
const merchantId = wx.$router.getPageInstance().options.merchantId
this.setData({
merchantId
})
// 初始化日期为昨天
this.initDate()
// 周数据
......@@ -111,7 +103,6 @@ Component({
selectDate(event) {
const { index } = event.currentTarget.dataset;
const {timeTypeEnum} = this.data
console.log(index, 'dateCurrent')
this.setData({
dateCurrent: index,
timeType: timeTypeEnum[index],
......@@ -125,15 +116,69 @@ Component({
}
this.initDate(timeTypeEnum[index])
},
getAnalysisData() {
async getAnalysisData() {
try {
let params = this.getParams()
const [outputData, buyAndToStoreData, chartData, supervisionSale] = await Promise.all([
CustomerApi.queryMerchantOutputAndAtv(params),
CustomerApi.queryMerchantBuyAndTostore(params),
CustomerApi.queryMerchantOutputTrend(params),
CustomerApi.queryServiceSupervisionSale(params)
])
console.log(chartData)
this.setData({
outputData: outputData?.data?.list || [],
buyAndToStoreData: buyAndToStoreData?.data?.list || [],
supervisionSale: supervisionSale?.data?.list || [],
lineData: chartData?.data?.list || []
})
} catch (error) {
console.error()
}
},
getParams() {
let { merchantId, current, dateCurrent, date, currentWeek } = this.data
const currentPar = ['yanbao', 'quanyi', 'qinggai']
const dateCurrentPar = ['day', 'week', 'month', 'self']
const obj = {
merchantid: merchantId,
business_type: currentPar[current],
queryType: dateCurrentPar[dateCurrent],
brand: "全部",
province: "全部",
city: "全部",
service: "全部",
supervision: "全部",
salesman: "全部"
}
switch (dateCurrent) {
case 0:
obj.startDay = obj.endDay = dayjs(date).format('YYYY-MM-DD')
break;
case 1:
obj.startDay = dayjs(currentWeek.startDate).format('YYYY-MM-DD')
obj.endDay = dayjs(currentWeek.endDate).format('YYYY-MM-DD')
break;
case 2:
obj.startDay = dayjs(date).startOf('month').format('YYYY-MM-DD')
obj.endDay = dayjs(date).endOf('month').format('YYYY-MM-DD')
break;
case 3: {
const [start, end] = date.split('-').map(d => dayjs(d.trim()))
obj.startDay = start.format('YYYY-MM-DD')
obj.endDay = end.format('YYYY-MM-DD')
break;
}
default:
console.warn('[getUsedCarBusinessData] 未知 timeType:', timeType)
}
return obj
},
initDate(type = 'date') {
const now = dayjs();
const {current} = this.data
const setData = (payload) => {
this.setData(payload);
if (current == 0) this.getAnalysisData(this.data.merchantId);
this.getAnalysisData()
};
switch (type) {
......@@ -180,8 +225,8 @@ Component({
const result = await CustomerApi.getWeekSelectData()
const weekColumns = result.map((item, index) => ({
label: `${item.startDate}至${item.endDate}`,
startDate: dayjs(item.startDate).format('YYYY/MM/DD'),
endDate: dayjs(item.endDate).format('YYYY/MM/DD'),
startDate: dayjs(item.startDate).format('YYYY-MM-DD'),
endDate: dayjs(item.endDate).format('YYYY-MM-DD'),
index
}))
this.setData({
......@@ -197,7 +242,6 @@ Component({
},
// 日历的确认
onConfirm(event) {
console.log(event)
const {current} = this.data
const start = event.detail[0]
const end = event.detail[1]
......@@ -205,7 +249,6 @@ Component({
show: false,
date: `${dayjs(start).format('YYYY/MM/DD')}-${dayjs(end).format('YYYY/MM/DD')}`,
});
console.log(current, 'current')
if (current == 0) this.getAnalysisData()
},
// 日选择
......@@ -232,8 +275,6 @@ Component({
const _date = date.split('/')
if (c_value[0] != _date[0] || c_value[1] != _date[1] || c_value[2] != _date[2]) {
const picker = this.selectComponent("#datePicker")
console.log(picker.picker, 'picker')
console.log(date)
this.setData({
minDate: dayjs().subtract(1, 'year').valueOf(),
maxDate: dayjs().valueOf(),
......@@ -247,8 +288,6 @@ Component({
const _date = date.split('/')
if (c_value[0] != _date[0] || c_value[1] != _date[1]) {
const picker = this.selectComponent("#datePicker")
console.log(picker.picker, 'picker')
console.log(date)
this.setData({
minDate: dayjs().subtract(1, 'year').valueOf(),
maxDate: dayjs().valueOf(),
......@@ -260,10 +299,8 @@ Component({
} else if (timeType == 'week') {
const { date, weekColumns} = this.data
const picker = this.selectComponent("#weekPicker")
console.log(picker.getColumnIndex(0), 'picker')
const label = date.replace('-', '至').replace(/\//g, '-');
const index = weekColumns.findIndex(i => i.label == label)
console.log(label, index)
setTimeout(() => {
picker.setColumnIndex(0, index)
}, 0)
......@@ -324,17 +361,14 @@ Component({
dateShow: false,
date: (formatMap[timeType] || (() => ''))()
});
console.log(current, 'current')
if (current == 0) this.getAnalysisData(this.data.merchantId);
},
onChange(e) {
console.log(e, e.detail.getValues(), 'onChange')
currentObj = e.detail
},
// 日选择
onInput(event) {
console.log(dayjs(event.detail).format('YYYY/MM/DD'), 'onInput')
// 防止选择之后,取消选择,导致日期不变
this.setData({
selectedDate: event.detail
......@@ -342,7 +376,6 @@ Component({
},
// 周选择
onWeekChange(event) {
console.log(event, 'weekChange')
const {value} = event.detail
const currentWeek = value
this.setData({
......@@ -406,7 +439,6 @@ Component({
leftCurrent: false,
rightCurrent
});
console.log(currentDisplayDate, 'currentDisplayDate')
} else if (timeType == 'date') {
// 日选择
// 获取当前显示的日期
......@@ -424,10 +456,8 @@ Component({
});
} else if (timeType == 'week') {
const {currentWeek, weekColumns} = this.data
console.log(currentWeek)
if (currentWeek.index < weekColumns.length) {
const nextWeek = weekColumns[currentWeek.index - 1]
console.log(nextWeek)
const nextDate = dayjs(nextWeek.startDate, 'YYYY/MM/DD');
this.setData({
date: `${nextWeek.startDate}-${nextWeek.endDate}`,
......@@ -437,10 +467,8 @@ Component({
rightCurrent: nextWeek.index == 0,
leftCurrent: false
})
console.log(nextWeek == 0, this.data.currentDate)
}
}
console.log(current, 'current')
if (current == 0) this.getAnalysisData(merchantId)
},
handleShow(e) {
......
......@@ -8,7 +8,7 @@
</block>
</view>
</view>
<view class="person-section">销售:{{'迪丽热巴·迪力木拉提'}}</view>
<view class="person-section">销售:{{supervisionSale[0] && supervisionSale[0].saleman}}</view>
<view class="tab-section">
<block wx:for="{{dateList}}" wx:key="index">
<view class="tab {{item.index==dateCurrent?'active':''}}" data-index="{{item.index}}" bind:tap="selectDate">{{item.title}}</view>
......
......@@ -4,7 +4,7 @@
<view class="cell {{item.full ? 'cell-full' : (item.span === 2 ? 'cell-span2' : '')}}">
<view class="cell-label">{{item.label}}</view>
<view class="cell-value {{item.highlight ? 'highlight' : ''}}">
<text class="value-text">{{item.value}}</text>
<text class="value-text">{{item.value || '-'}}</text>
<image wx:if="{{item.isLong}}" class="more-icon" src="{{IMG_URL}}/customer/more-icon.png" mode="aspectFit" data-index="{{index}}" bindtap="onMoreTap" />
</view>
</view>
......
......@@ -8,7 +8,7 @@ Component({
* 组件的属性列表
*/
properties: {
merchantId: Number
},
/**
......@@ -29,11 +29,6 @@ Component({
lifetimes: {
attached() {
// 获取当前页面的merchantId
const merchantId = wx.$router.getPageInstance().options?.merchantId
this.setData({
merchantId
})
// 年份数据
this.generateRecentYears()
},
......@@ -107,7 +102,6 @@ Component({
const { selectedYear, yearColumns } = this.data
if (selectedYear.index > -1) {
const prevYear = yearColumns[selectedYear.index - 1]
console.log(selectedYear.index + 1,)
this.setData({
year: prevYear.value,
rightCurrent: false,
......@@ -164,28 +158,20 @@ Component({
merchantId,
businessType: businessTypeObj[current]
}
// TODO: 接入后端后替换为真实数据
const mock = [
{ month: 1, completed: 9666660000, target: 9666660000, completionRate: 100 },
{ month: 2, completed: 66000000, target: 66000000, completionRate: 100 },
{ month: 3, completed: 56000000, target: 99000000, completionRate: 65 },
{ month: 4, completed: 32000000, target: 66000000, completionRate: 100 },
{ month: 5, completed: 66000000, target: 99000000, completionRate: 100 },
{ month: 6, completed: 4000000, target: 20000000, completionRate: 100 },
{ month: 7, completed: 66000000, target: 66000000, completionRate: 100 },
{ month: 8, completed: 66000000, target: 66000000, completionRate: 100 },
{ month: 9, completed: 66000000, target: 99000000, completionRate: 100 },
{ month: 10, completed: 66000000, target: 300000, completionRate: 100 },
{ month: 11, completed: 90000, target: 2000, completionRate: 100 },
{ month: 12, completed: 2000, target: 2000, completionRate: 100 }
]
const rows = mock.map(m => {
const completed = this.formatCurrency(m.completed, )
const target = this.formatCurrency(m.target)
const completionRate = this.formatCurrency(m.completionRate, true)
return { ...m, completed, target, completionRate }
CustomerApi.getKPIData(params).then(res => {
res?.map(m => {
const completed = this.formatCurrency(m.completed, )
const target = this.formatCurrency(m.target)
const completionRate = this.formatCurrency(m.completionRate, true)
return { ...m, completed, target, completionRate }
})
res?.sort((a, b) => {
return a.month - b.month
})
this.setData({
kpiRows: res
})
})
this.setData({ kpiRows: rows })
}
}
})
\ No newline at end of file
......@@ -2,7 +2,6 @@
.KPI-progress {
padding-bottom: 150rpx;
.header {
margin-bottom: 20rpx;
background: #FFFFFF;
padding-bottom: 24rpx;
.title-section {
......
......@@ -29,9 +29,9 @@
<block wx:for="{{kpiRows}}" wx:key="month">
<view class="kpi-row">
<view class="col month">{{item.month}}月</view>
<view class="col done number">{{item.completed}}</view>
<view class="col target number">{{item.target}}</view>
<view class="col rate number">{{item.completionRate}}</view>
<view class="col done number">{{item.completed || '-'}}</view>
<view class="col target number">{{item.target || '-'}}</view>
<view class="col rate number">{{item.completionRate || '-'}}</view>
</view>
</block>
</view>
......
// components/SelectArea/SelectArea.js
// 直接使用 Vant 的 areaData 作为默认数据源
const { areaList: vantAreaList } = require('@vant/area-data')
// const { areaList: vantAreaList } = require('@vant/area-data')
Component({
options: {
......@@ -12,7 +12,7 @@ Component({
// 2 或 3,表示二级(省/市)或三级(省/市/区)
columnsNum: { type: Number, value: 3 },
value: { type: null, value: '' },
areaList: { type: Object, value: vantAreaList },
areaList: { type: Object },
confirmOnSelect: { type: Boolean, value: false }
},
data: {
......
......@@ -77,7 +77,7 @@ Component({
const initSelected = multiple ? (Array.isArray(values) ? values.slice() : []) : (value !== null && value !== undefined ? value : [])
const display = (options || []).map(item => {
const val = item[vKey]
const checked = initSelected.some(v => v === val)
const checked = initSelected?.some(v => v === val)
return { ...item, checked }
})
this.setData({
......
// packageCustomer/components/StoreMessage/StoreMessage.js
import CustomerApi from '~/api/customerApi/index'
import { IMG_URL } from '~/utils/constantData'
Component({
options: {
addGlobalClass: true
},
properties: {
// 盈亏与展业等摘要信息
summary: {
type: Object,
value: {
profit: { ok: true, text: '盈利情况' },
business: { ok: true, text: '展业情况', warningCount: 0 },
bottomMetric: {
title: '渗透率临近业务兜底指标',
periodIndex: 0.1094, // 10.94%
bottomRequire: 0.5 // 50%
}
}
},
// 兜底指标预警列表
warnings: {
type: Array,
value: [
{ title: '轮胎转化率临近业务兜底指标预警', periodIndex: 0.1094, bottomRequire: 0.5 },
{ title: '安心包转化率临近业务兜底指标预警', periodIndex: 0.1094, bottomRequire: 0.5 },
{ title: '转化率临近业务兜底指标预警', periodIndex: 0.1094, bottomRequire: 0.5 }
]
},
// 驻店人员列表
residents: {
type: Array,
value: [
// { role: '店总', name: '李四', phone: '13510769158' },
// { role: '王五', name: '王五', phone: '13510769158' }
]
},
// 默认展开的折叠项(自定义折叠仍可参考该配置)
defaultActive: {
type: Array,
value: ['bottom', 'residents']
}
merchantId: Number
},
data: {
......@@ -51,53 +18,13 @@ Component({
// 动画对象
businessAnimation: {},
bottomAnimation: {},
infoData: {
displaySituationWarningCount: 5,
safetyIndexWarningCount: 2,
profitAndLoss: 2,
// 展业情况测试数据
displaySituationWarningList: [],
// 兜底指标预警测试数据
safetyIndexWarningList: [{
rule: '轮胎转化率临近业务兜底指标预警',
cycleIndicator: 50,
fallbackIndicator: 20
}, {
rule: '安心包转化率临近业务兜底指标预警',
cycleIndicator: 35,
fallbackIndicator: 25
}, {
rule: '保险产品转化率临近业务兜底指标预警',
cycleIndicator: 28,
fallbackIndicator: 30
}, {
rule: '增值服务转化率临近业务兜底指标预警',
cycleIndicator: 45,
fallbackIndicator: 40
}, {
rule: '客户满意度临近业务兜底指标预警',
cycleIndicator: 38,
fallbackIndicator: 35
}],
storePersonnel: [{
personnelName: '王五王五王五王五王五王五王五王五王五王五王五',
personnelMobile: 13510769158
}, {
personnelName: '王五',
personnelMobile: 13510769158
}]
}
infoData: {},
showPage: false
},
lifetimes: {
attached() {
// 初始化展开状态:仅在有数据时允许展开
const hasBusiness = (this.data.infoData?.displaySituationWarningList || []).length > 0
const hasBottom = (this.data.infoData?.safetyIndexWarningList || []).length > 0
this.setData({
showBusiness: hasBusiness ? false : false,
showBottom: hasBottom ? false : false
})
this.getDetailData()
}
},
......@@ -135,13 +62,23 @@ Component({
}
},
getDetailData() {
let { infoData } = this.data
infoData.safetyIndexWarningList?.forEach(val => {
val.cycleIndicator = this.formatPercent(val.cycleIndicator)
val.fallbackIndicator = this.formatPercent(val.fallbackIndicator)
})
this.setData({
infoData
let { merchantId } = this.data
CustomerApi.getStoreOverviewData({id: merchantId}).then(res => {
res?.safetyIndexWarningList?.forEach(val => {
val.cycleIndicator = this.formatPercent(val.cycleIndicator)
val.fallbackIndicator = this.formatPercent(val.fallbackIndicator)
})
// 初始化展开状态:仅在有数据时允许展开
const hasBusiness = (res.displaySituationWarningList || []).length > 0
const hasBottom = (res?.safetyIndexWarningList || []).length > 0
this.setData({
showBusiness: hasBusiness ? false : false,
showBottom: hasBottom ? false : false
})
this.setData({
infoData: res || {},
showPage: true
})
})
},
formatPercent(n) {
......
......@@ -29,7 +29,6 @@
.resident-item {
color: #292D33;
display: flex;
width: calc(100% - 260rpx);
justify-content: flex-end;
.name {
margin-right: 30rpx;
......
<!--packageCustomer/components/StoreMessage/StoreMessage.wxml-->
<view class="store-message">
<view class="store-message" wx:if="{{showPage}}">
<!-- 盈亏情况 -->
<view class="cell-title">
<view class="title-text">盈亏情况</view>
......@@ -13,7 +13,7 @@
<view class="title-text">展业情况</view>
<view class="status">
<image src="{{IMG_URL}}customer/{{infoData.displaySituation == 1 ? 'success-icon' : 'warning-icon'}}.png" mode=""/>
<text class="status-text mar-r20" wx:if="{{!infoData.displaySituationWarningCount}}">{{ infoData.displaySituation == 1 ? '正常' : '预警' }}</text>
<text class="status-text {{!infoData.displaySituationWarningList.length ? 'mar-r20' : ''}}" wx:if="{{!infoData.displaySituationWarningCount}}">{{ infoData.displaySituation == 1 ? '正常' : '预警' }}</text>
<text class="status-text {{!infoData.displaySituationWarningList.length ? 'mar-r20' : ''}}" wx:if="{{infoData.displaySituationWarningCount}}">{{infoData.displaySituationWarningCount}}项预警</text>
<image wx:if="{{infoData.displaySituationWarningList.length}}" src="{{IMG_URL}}customer/show-icon.png" class="arrow-icon {{showBusiness ? 'open' : ''}}" mode=""/>
</view>
......@@ -38,9 +38,9 @@
<view class="title-text">兜底指标预警</view>
<view class="status">
<image src="{{IMG_URL}}customer/{{infoData.safetyIndexWarning == 1 ? 'success-icon' : 'warning-icon'}}.png" mode=""/>
<text class="status-text mar-r20" wx:if="{{!infoData.safetyIndexWarningCount}}">{{ infoData.safetyIndexWarning == 1 ? '正常' : '预警' }}</text>
<text wx:if="{{infoData.safetyIndexWarningCount}}">{{infoData.safetyIndexWarningCount}}项预警</text>
<image src="{{IMG_URL}}customer/show-icon.png" class="arrow-icon {{showBottom ? 'open' : ''}}" mode=""/>
<text class="status-text {{!infoData.safetyIndexWarningList.length ? 'mar-r20' : ''}}" wx:if="{{!infoData.safetyIndexWarningCount}}">{{ infoData.safetyIndexWarning == 1 ? '正常' : '预警' }}</text>
<text class="status-text {{!infoData.safetyIndexWarningList.length ? 'mar-r20' : ''}}" wx:if="{{infoData.safetyIndexWarningCount}}">{{infoData.safetyIndexWarningCount}}项预警</text>
<image wx:if="{{infoData.safetyIndexWarningList.length}}" src="{{IMG_URL}}customer/show-icon.png" class="arrow-icon {{showBottom ? 'open' : ''}}" mode=""/>
</view>
</view>
<view wx:if="{{infoData.safetyIndexWarningList.length}}" class="collapsible-panel" animation="{{bottomAnimation}}">
......
......@@ -143,12 +143,12 @@ console.log(this.data.isUseNewCanvas)
.select('.ec-canvas')
.fields({ node: true, size: true })
.exec(res => {
const canvasNode = res[0].node
const canvasNode = res[0]?.node
this.canvasNode = canvasNode
const canvasDpr = wx.getSystemInfoSync().pixelRatio
const canvasWidth = res[0].width
const canvasHeight = res[0].height
const canvasWidth = res[0]?.width
const canvasHeight = res[0]?.height
const ctx = canvasNode.getContext('2d')
......
......@@ -4,11 +4,6 @@ Component({
detail: {
type: Object,
value: {}
},
// 动态联系人角色
managers: {
type: Array,
value: []
}
},
data: {},
......
......@@ -26,6 +26,7 @@
align-items: flex-start;
padding-bottom: 32rpx;
.label {
flex-shrink: 0;
width: 112rpx;
font-size: 28rpx;
color: #999EA8;
......@@ -33,6 +34,7 @@
}
.value {
flex: 1;
word-break: break-all;
font-size: 28rpx;
color: #292D33;
}
......
......@@ -48,9 +48,10 @@
<view class="row image-row">
<view class="label">门店门头照片</view>
<view class="value">
<view class="photo-wrap">
<view class="photo-wrap" wx:if="{{detail.storePhoto}}">
<image class="photo" webp src="{{detail.storePhoto}}" />
</view>
<view wx:else>-</view>
</view>
</view>
<view class="row note-row">
......
......@@ -38,103 +38,108 @@ Page({
// 获取潜客详情数据
this.getDetail(pageQuery)
}
// 假数据
this.getDetail()
// 获取行政区域数据
this.getAreaData()
this.setData({
pageType
})
},
onReady() {
this.resultDialog = this.selectComponent('#resultDialog')
},
onShow() {
},
getDetail(par) {
// 假数据
const res = {
code: 0,
message: '',
data: {
status: 1,
remark: '客户意向很高,门店运营里有觉得吃力的地方,希望互相搭把手,让门店生意再上一层楼',
salePotentialCustomerPersonnelInfoDTOList: [{
personnelType: 1,
personnelName: '张三',
personnelPhone: 1351076958
}, {
personnelType: 2,
personnelName: '轮胎转化率临近业务兜底指标预警',
personnelPhone: 1351076958
}],
storeType: 1,
visitCount: 5,
provinceName: '广东',
city: '深圳',
districtName: '南山区',
address: '中海康城',
storeName: '杭州旺泽宝华哥桑纳尼汽车销售服务有限公司',
flowSituation: 2,
businessTypeList: [{
businessSceneType: 1
}, {
businessSceneType: 2
}, {
businessSceneType: 3
}, {
businessSceneType: 4
}, {
businessSceneType: 5
}],
brandList: [{
mainBrandId: 2978,
mainBrand: '鸿蒙智行',
subBrandName: '问界',
subBrandId: 3454
}],
expectedOperationDate: '2025-07-23',
cooperationModeList: [{
businessSceneType: 1,
directSalesFlag: 2
}],
districtId: 440305,
storePhoto: `${this.data.IMG_URL}customer/nothing.png`,
}
getAreaData() {
CustomerApi.getAreaTreeList({}).then(res => {
const areaData = this.convertToVanAreaData(res)
this.setData({
areaList: areaData || []
})
})
},
convertToVanAreaData(originalData) {
const result = {
province_list: {},
city_list: {},
county_list: {}
}
function processDistricts(districts, level = 0) {
districts.forEach(item => {
if (item.level === 0) {
// 国家级,处理其子节点(省份)
processDistricts(item.districts, 1)
} else if (item.level === 1) {
// 省份级别
result.province_list[item.code] = item.name
// 处理城市
item.districts.forEach(city => {
if (city.level === 2) {
result.city_list[city.code] = city.name
// 处理区县
city.districts.forEach(county => {
if (county.level === 3) {
result.county_list[county.code] = county.name
}
})
}
})
}
})
}
// 处理数据
this.progressData(res.data)
return
CustomerApi.getMaterialData({}).then(res => {
processDistricts(originalData.districts)
return result
},
getDetail(par) {
CustomerApi.getCustomerData({id: par.id}).then(res => {
// 处理数据
this.progressData(res)
})
},
progressData(data) {
console.log(data)
const businessSceneNames = {0: '轻改', 1: '权益', 2: '延保'}
data.bizType = data?.businessTypeList?.map(val => { return `${SCENELIST?.find(v => v.value == val.businessSceneType).name}` })?.join('/')
data.bizType_value = data?.businessTypeList?.map(val => { return val.businessSceneType })
data.coopMode = data?.cooperationModeList?.map(val => { return `${businessSceneNames[val.businessSceneType]}${COOPERATIONMODELIST.find(v => v.value == val.directSalesFlag).name}` }).join('/')
data.coopMode_value = data?.cooperationModeList?.map(val => { return val.directSalesFlag })
data.mainCategory = data?.brandList?.map(val => {return `${val.mainBrand}${val.subBrandName}`})?.join('/')
let { baseForm, managerRoles } = this.data
data.bizType = data?.businessTypeList?.map(val => { return `${SCENELIST?.find(v => v.value == val).name}` })?.join('/')
data.bizType_value = data?.businessTypeList?.map(val => { return val })
data.coopMode = COOPERATIONMODELIST.find(v => v.value == data.cooperationMode).name
data.coopMode_value = [data.cooperationMode]
data.mainCategory = data?.salePotentialCustomerBrandDTOList?.map(val => {return `${val.mainBrandName}${val.subBrandName}`})?.join('/')
let selectedMainBrand = []
data?.brandList?.forEach(val => {
data?.salePotentialCustomerBrandDTOList?.forEach(val => {
val.children = [{id: val.subBrandId, name: val.subBrandName}]
val.id = val.mainBrandId
val.name = val.mainBrand
val.name = val.mainBrandName
selectedMainBrand.push(val)
})
data.area_value = [data.provinceId, data.cityId, data.districtId]
data.area_name = [data.provinceName, data.city, data.districtName]
data.flowScale = TRSFFICSTATUSLIST?.find(val => val.value == data.flowSituation)?.name
data.flowScale_value = [data.flowSituation]
data.area = `${data.provinceName} ${data.city} ${data.districtName}`
data.attachmentList = [data.storePhoto]
data.attachmentList = data.storePhoto ? [data.storePhoto] : []
managerRoles?.forEach(item => {
const obj = data.salePotentialCustomerPersonnelInfoDTOList?.find(val => val.personnelType == item.value)
item.checked = obj && Object.keys(obj)?.length
item.personnelName = obj?.personnelName || ''
item.personnelPhone = obj?.personnelPhone || ''
})
// 未保存数据,默认将店总选中
if (managerRoles?.findIndex(v => v.checked) < 0) managerRoles[0].checked = true
baseForm?.forEach(val => {
if (val.key == 'storeName' || val.key == 'mainCategory') val.disabled = true
})
this.setData({
infoData: data,
selectedMainBrand,
remarkLength: data.remark?.length
remarkLength: data.remark?.length,
baseForm,
managerRoles
})
},
......@@ -163,10 +168,9 @@ Page({
})
},
showPopup(e) {
let { type } = e.currentTarget.dataset
console.log(type)
if (!type) return
this[type]()
let { target } = e.currentTarget.dataset
if (!target.callback || target.disabled) return
this[target.callback]()
},
// 选择主营品牌
changemainCategory() {
......@@ -187,14 +191,13 @@ Page({
let arr = []
selected?.forEach(val => {
val.children?.forEach(v => {
arr.push(`${val.name}-${v.name}`)
arr.push(`${val.name}${v.name}`)
})
})
this.setData({
'infoData.mainCategory': arr?.join('/'),
selectedMainBrand: selected
})
console.log(selected)
this.hideBrandPopup()
},
......@@ -261,7 +264,6 @@ Page({
areaConfirm(e) {
const { names, codes } = e.detail
console.log(e.detail)
this.setData({
'infoData.area': names?.join(' '),
'infoData.area_value': codes,
......@@ -289,7 +291,6 @@ Page({
wx.chooseImage({
count: 1,
success(res) {
console.log(res)
let [tempFiles] = res.tempFilePaths
let tempFilesList = tempFiles.split('.')
let imgType = tempFilesList[tempFilesList.length - 1]
......@@ -349,9 +350,8 @@ Page({
wx.navigateBack()
},
handleConfirm() {
let { infoData, managerRoles } = this.data
let { infoData, managerRoles, selectedMainBrand } = this.data
if (!infoData.storeName || !infoData.bizType || !infoData.coopMode || !infoData.mainCategory || !infoData.flowScale || !infoData.area || !infoData.address) return wx.$api.showToast('请填入必填信息')
console.log(managerRoles)
const phoneRex = /^[1]([3-9])[0-9]{9}$/
for (const item of (managerRoles || [])) {
if (item.checked && item.personnelPhone) {
......@@ -375,8 +375,19 @@ Page({
// 空值处理函数
const getValue = (value, defaultValue = '') => value ?? defaultValue
const brand = []
selectedMainBrand?.forEach(item => {
item.children?.forEach(val => {
brand.push({
mainBrandId: item.id,
mainBrandName: item.name,
subBrandId: val.id,
subBrandName: val.name
})
})
})
let params = {
id: infoData.id,
storeName: getValue(storeName),
businessTypeList: getValue(bizType_value?.join(',')),
cooperationMode: getValue(coopMode_value?.[0]),
......@@ -390,20 +401,49 @@ Page({
address: getValue(address),
storePhoto: getValue(attachmentList?.[0]),
remark: getValue(remark),
alePotentialCustomerPersonnelInfoDTOList: managerRoles
salePotentialCustomerPersonnelInfoDTOList: managerRoles
.filter(val => val.checked && (val.personnelName || val.personnelPhone))
.map(val => ({
personnelName: getValue(val.personnelName),
personnelPhone: getValue(val.personnelPhone),
personnelType: getValue(val.value)
}))
})),
salePotentialCustomerBrandDTOList: brand
}
console.log(params)
if (this.data.confirmFlag) return
this.setData({confirmFlag: true})
wx.$api.showLoading()
const methodName = this.data.pageQuery ? 'editCustomer' : 'addCustomer'
CustomerApi[methodName](params).then(res => {
wx.$api.hideLoading()
this.setData({
confirmFlag: false
})
let { code } = res
const okText = '我知道了'
if (this.resultDialog) {
if (code == 0) {
this.resultDialog.open({
type: 'success',
title: this.data.pageQuery ? '您的潜客信息已完善!' : '您的潜客添加完成!',
description: '',
okText
})
} else {
this.resultDialog.open({
type: 'error',
title: '修改失败,请稍后重试',
description: '',
okText
})
}
}
})
},
// 接口请求结果弹窗确认
onDialogOk() {
this.handleCancel()
},
onHide() {
},
......
......@@ -3,6 +3,7 @@
"usingComponents": {
"car-brand": "/components/CarBrand/CarBrand",
"select-popup": "../../components/SelectPopup/SelectPopup",
"select-area": "../../components/SelectArea/SelectArea"
"select-area": "../../components/SelectArea/SelectArea",
"result-dialog": "../../components/ResultDialog/index"
}
}
\ No newline at end of file
......@@ -67,6 +67,8 @@
.image_content {
width: 160rpx;
height: 160rpx;
border-radius: 8rpx;
overflow: hidden;
position: relative;
.image_box {
width: 100%;
......@@ -124,6 +126,7 @@
color: #292D33;
font-size: 26rpx;
padding: 0 40rpx;
font-weight: 500;
image {
width: 32rpx;
height: 32rpx;
......@@ -160,8 +163,7 @@
position: fixed;
bottom: 0;
left: 0;
width: calc(100% - 64rpx);
height: 88rpx;
width: 100%;
line-height: 88rpx;
text-align: center;
font-size: 32rpx;
......
......@@ -3,13 +3,13 @@
<navigation-bar showBack="{{true}}" bind:navbarReady="onNavbarReady">{{pageType == 'edit' ? '信息完善' : '新增潜客'}}</navigation-bar>
<view class="potential-create" style="padding-top: {{navHeight}}px;">
<view class="card">
<view class="section-title">基本信息</view>
<view class="section-title">基础信息</view>
<block wx:for="{{baseForm}}" wx:key="index">
<view class="row">
<view class="label">{{item.label}} <text class="star">*</text></view>
<view class="value" bindtap="showPopup" data-type="{{item.callback}}">
<view class="value" bindtap="showPopup" data-target="{{item}}">
<block wx:if="{{item.type == 'textarea'}}">
<textarea value="{{infoData[item.key]}}" class="textarea" placeholder="请输入" placeholder-class="placeholder-class" auto-height="true" maxlength="{{item.maxLength}}" cursor-spacing="16" bindinput="onInput" data-key="{{item.key}}"/>
<textarea value="{{infoData[item.key]}}" class="textarea" placeholder="请输入" placeholder-class="placeholder-class" auto-height="true" maxlength="{{item.maxLength}}" disabled="{{item.disabled}}" cursor-spacing="16" bindinput="onInput" data-key="{{item.key}}"/>
</block>
<block wx:else>
<block wx:if="{{infoData[item.key]}}">
......@@ -101,4 +101,6 @@
<car-brand id="car-brand" popupShow="{{carBrandPopupShow}}" multiple selectedList="{{selectedMainBrand}}"></car-brand>
</popup>
<select-popup show="{{showSelectPopup}}" options="{{selectOptions}}" multiple="{{selectMultiple}}" values="{{selectValues}}" value="{{selectValue}}" bindconfirm="handlePopupConfirm" title="{{selectTitle}}"></select-popup>
<select-area show="{{showSelectArea}}" bindconfirm="areaConfirm" bindcancel="areaCancel" value="{{infoData.districtId || ''}}"></select-area>
\ No newline at end of file
<select-area show="{{showSelectArea}}" areaList="{{areaList}}" bindconfirm="areaConfirm" bindcancel="areaCancel" value="{{infoData.districtId || ''}}"></select-area>
<!-- 结果弹窗组件:统一反馈弹窗 -->
<result-dialog id="resultDialog" bind:ok="onDialogOk" bind:close="onDialogClose" />
\ No newline at end of file
......@@ -25,6 +25,11 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad(options) {
if (options.id) {
this.setData({
potentialCustomerId: options.id
})
}
},
onReady() {
......@@ -185,10 +190,13 @@ Page({
async getLocation() {
try {
wx.$api.showLoading()
const loc = await wx.getLocation({ type: "gcj02" })
const { latitude, longitude } = loc
const res = await mapApi.detailedAdrress([latitude, longitude])
const locationName = res?.formatted_addresses || res?.address || "已定位"
console.log(res)
const locationName = res?.formatted_address || res?.address || "已定位"
wx.$api.hideLoading()
this.setData({ latitude, longitude, locationName })
} catch (err) {
wx.showToast({ title: "定位失败,请检查权限", icon: "none" })
......@@ -204,38 +212,42 @@ Page({
},
handleConfirm() {
const { infoData } = this.data
const { infoData, potentialCustomerId, locationName } = this.data
if (!infoData.visitTimeText || !infoData.contactName || !infoData.content) return wx.$api.showToast("请输入必填信息")
let params = {
potentialCustomerId,
visitTime: infoData.visitTimeText,
contactPerson: infoData.contactName,
visitContent: infoData.content,
visitPhotos: infoData.attachmentList || [],
checkInLocation: infoData.locationName
visitPhotos: infoData.attachmentList && infoData.attachmentList[0],
checkInLocation: locationName
}
console.log(params, this.resultDialog)
// CustomerApi.addVisit(params).then(res => {
// })
const res = {code: 0}
const okText = '我知道了'
if (this.resultDialog) {
if (res.code == 0) {
this.resultDialog.open({
type: 'success',
title: '新增拜访记录成功!',
description: '',
okText
})
} else {
this.resultDialog.open({
type: 'fail',
title: '新增拜访记录失败,请稍后重试',
description: '',
okText
})
if (this.data.confirmFlag) return
this.setData({confirmFlag: true})
wx.$api.showLoading()
CustomerApi.addVisit(params).then(res => {
this.setData({confirmFlag: false})
wx.$api.hideLoading()
const okText = '我知道了'
let { code } = res
if (this.resultDialog) {
if (code == 0) {
this.resultDialog.open({
type: 'success',
title: '新增拜访记录成功!',
description: '',
okText
})
} else {
this.resultDialog.open({
type: 'fail',
title: '新增拜访记录失败,请稍后重试',
description: '',
okText
})
}
}
}
})
},
// 接口请求结果弹窗确认
......
......@@ -56,6 +56,11 @@ page {
align-items: center;
}
}
.location-row {
padding: 32rpx 40rpx;
align-items: flex-start;
height: auto;
}
.textarea-wrap {
position: relative;
border-bottom: 1rpx solid #EFF0F280;
......@@ -128,8 +133,7 @@ page {
position: fixed;
bottom: 16rpx;
left: 0;
width: calc(100% - 64rpx);
height: 88rpx;
width: 100%;
line-height: 88rpx;
text-align: center;
font-size: 32rpx;
......
......@@ -41,7 +41,7 @@
</view>
</view>
</view>
<view class="row no-border">
<view class="row no-border location-row">
<view class="label">拜访签到</view>
<view class="value location-value">
<text wx:if="{{locationName}}" class="value-text">{{locationName}}</text>
......
......@@ -11,11 +11,11 @@ Page({
data: {
IMG_URL: IMG_URL,
listTabs: ['KPI进度', '经营指标', '门店信息', '资料详情'],
tabIndex: 3,
tabIndex: 0,
infoDetail: {},
statusText: {
1: {label: '老店', color: '#347BFF', background: '#347bff14'},
2: {label: '新店', color: '#35C376', background: '#35c37614'}
1: {label: '新店', color: '#35C376', background: '#35c37614'},
2: {label: '老店', color: '#347BFF', background: '#347bff14'}
},
scrollTop: 0
},
......@@ -24,12 +24,16 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad(options) {
// let { query } = options
// if (query) {
// const pageQuery = JSON.parse(decodeURIComponent(query))
// this.setData({pageQuery})
// }
this.getMerchantDetail()
let { query } = options
if (query) {
const pageQuery = JSON.parse(decodeURIComponent(query))
this.setData({pageQuery})
this.getMerchantDetail(pageQuery)
if (pageQuery.currentTab == 2) {
this.setData({tabIndex: 2})
}
this.setData({tabIndex: 2})
}
},
/**
......@@ -75,7 +79,7 @@ Page({
const items = [
{ label: '主营品牌', value: infoDetail.mainCategory },
{ label: '合作模式', value: infoDetail.coopMode },
{ label: '拜访次数', value: infoDetail.visitCount, highlight: true },
{ label: '拜访次数', value: infoDetail.visitCount != null ? `${infoDetail.visitCount}` : '', highlight: true },
{ label: '流量情况', value: infoDetail.flowScale },
{ label: '展业时间', value: infoDetail.expectBizTime },
{ label: '分润规则', value: infoDetail.profitRule },
......@@ -84,53 +88,10 @@ Page({
this.setData({ infoBoardItems: items })
},
getMerchantDetail() {
// 假数据
const res = {
code: 0,
message: '',
data: {
remark: '客户意向很高,门店运营里有觉得吃力的地方,希望互相搭把手,让门店生意再上一层楼',
salePotentialCustomerPersonnelInfoDTOList: [{
personnelType: 1,
personnelName: '张三',
personnelPhone: 1351076958
}, {
personnelType: 2,
personnelName: '轮胎转化率临近业务兜底指标预警',
personnelPhone: 1351076958
}],
storeType: 1,
visitCount: 5,
provinceName: '广东',
city: '深圳',
districtName: '南山区',
address: '中海康城',
storeName: '杭州旺泽宝华哥桑纳尼汽车销售服务有限公司',
flowSituation: 2,
businessTypeList: [{
businessSceneType: 1
}, {
businessSceneType: 2
}],
brandList: [{
mainBrand: '鸿蒙智行',
subBrandName: '问界',
}],
expectedOperationDate: '2025-07-23',
cooperationModeList: [{
businessSceneType: 1,
directSalesFlag: 2
}],
storePhoto: `${this.data.IMG_URL}customer/nothing.png`,
}
}
// 处理数据回显
this.progressData(res.data)
return
CustomerApi.getMaterialData({merchantId}).then(res => {
getMerchantDetail(pageQuery) {
CustomerApi.getMaterialData({id: pageQuery.merchantId}).then(res => {
// 处理数据回显
this.progressData(res)
})
},
......@@ -139,11 +100,19 @@ Page({
// 主营品牌
data.mainCategory = data?.brandList?.map(val => {return `${val.mainBrand}${val.subBrandName}`})?.join('/')
// 合作模式
data.coopMode = data?.cooperationModeList?.map(val => { return `${businessSceneNames[val.businessSceneType]}${COOPERATIONMODELIST.find(v => v.value == val.directSalesFlag).name}` }).join('/')
data.coopMode = data?.cooperationModeList?.map(val => {
const sceneName = businessSceneNames[val.businessSceneType] || ''
const cooperationItem = COOPERATIONMODELIST.find(v =>
val.directSalesFlag && v.value == val.directSalesFlag
)
const cooperationName = cooperationItem?.name || ''
return `${sceneName}/${cooperationName}`
}).filter(item => item) // 过滤空字符串
.join(',')
// 流量情况
data.flowScale = TRSFFICSTATUSLIST?.find(val => val.value == data.flowSituation)?.name
data.flowScale = data.flowSituation ? TRSFFICSTATUSLIST?.find(val => val.value == data.flowSituation)?.name : ''
// 业务类型
data.bizType = data?.businessTypeList?.map(val => { return `${SCENELIST?.find(v => v.value == val.businessSceneType).name}` })?.join('/')
data.bizType = data?.businessTypeList?.map(val => { return `${SCENELIST?.find(v => v.value == val).name}` })?.join('/')
// 人员类型
data.salePotentialCustomerPersonnelInfoDTOList?.forEach(val => {
val.roleName = ROLELIST?.find(v => v.value == val.personnelType)?.label
......@@ -157,6 +126,7 @@ Page({
},
tabClick(e) {
console.log(e)
const index = typeof e?.detail === 'number' ? e.detail : 0
this.setData({
tabIndex: index,
......
......@@ -9,7 +9,7 @@
</view>
<view class="addr-row">
<image src="{{IMG_URL}}customer/location.png" mode=""/>
<text class="addr-tag">{{infoDetail.provinceName}}{{infoDetail.city}}{{infoDetail.districtName}}{{infoDetail.address}}</text>
<text class="addr-tag">{{infoDetail.address}}</text>
</view>
<info-board items="{{infoBoardItems}}" threshold="{{24}}" clampLines="{{1}}" />
</view>
......@@ -18,13 +18,13 @@
</view>
<view class="tab-content-box" style="min-height: calc(100vh - {{tabHeight}}px - {{navBarHeight}}px);">
<block wx:if="{{tabIndex == 0}}">
<KPI-progress />
<KPI-progress merchantId="{{pageQuery.merchantId}}"/>
</block>
<block wx:elif="{{tabIndex == 1}}">
<business-analysis />
<business-analysis merchantId="{{pageQuery.merchantId}}"/>
</block>
<block wx:elif="{{tabIndex == 2}}">
<store-message />
<store-message merchantId="{{pageQuery.merchantId}}"/>
</block>
<block wx:else>
<material-details detail="{{infoDetail}}"/>
......
import { IMG_URL, COOPERATIONMODELIST, TRSFFICSTATUSLIST, SCENELIST, ROLELIST } from '~/utils/constantData'
import CustomerApi from '~/api/customerApi/index'
import { getUserInfo } from '~/utils/cache/userInfo'
import dayjs from 'dayjs'
Page({
data: {
IMG_URL: IMG_URL,
userInfo: getUserInfo(),
userInfo: {},
navStyle: 'background: #fff;',
showVisitButton: true,
infoBoardItems: [], // 信息看板数据
......@@ -15,8 +16,8 @@ Page({
setScrollTop: 0, // scroll-view的滚动位置
statusText: {
1: {label: '跟进中', color: '#FF9D0A'},
2: {label: '已签约', color: '#35C376'},
3: {label: '未签约', color: '#F24724'},
3: {label: '已签约', color: '#35C376'},
2: {label: '未签约', color: '#F24724'},
4: {label: '已绑定', color: '#347BFF'}
},
visitRecords: [],
......@@ -54,6 +55,9 @@ Page({
const pageQuery = JSON.parse(decodeURIComponent(query))
this.setData({pageQuery})
}
this.setData({
userInfo: getUserInfo()
})
},
onShow() {
......@@ -61,74 +65,27 @@ Page({
this.getPotentialDetail()
// 初始加载数据
this.resetAndLoad()
this.measureLayout()
},
getPotentialDetail() {
// 假数据
const res = {
code: 0,
message: '',
data: {
status: 1,
remark: '客户意向很高,门店运营里有觉得吃力的地方,希望互相搭把手,让门店生意再上一层楼',
salePotentialCustomerPersonnelInfoDTOList: [{
personnelType: 1,
personnelName: '张三',
personnelPhone: 1351076958
}, {
personnelType: 2,
personnelName: '轮胎转化率临近业务兜底指标预警',
personnelPhone: 1351076958
}],
storeType: 1,
visitCount: 5,
provinceName: '广东',
city: '深圳',
districtName: '南山区',
address: '中海康城',
storeName: '杭州旺泽宝华哥桑纳尼汽车销售服务有限公司',
flowSituation: 2,
businessTypeList: [{
businessSceneType: 1
}, {
businessSceneType: 2
}, {
businessSceneType: 3
}, {
businessSceneType: 4
}, {
businessSceneType: 5
}],
brandList: [{
mainBrand: '鸿蒙智行',
subBrandName: '问界',
}],
expectedOperationDate: '2025-07-23',
cooperationModeList: [{
businessSceneType: 1,
directSalesFlag: 2
}],
storePhoto: `${this.data.IMG_URL}customer/nothing.png`,
}
}
// 处理数据回显
this.progressData(res.data)
return
CustomerApi.getCustomerData({id}).then(res => {
let { pageQuery } = this.data
CustomerApi.getCustomerData({id: pageQuery.id}).then(res => {
if (res.isBind == 1) res.potentialCustomersStatus = 4
// 处理数据回显
this.progressData(res)
})
},
progressData(data) {
const businessSceneNames = {0: '轻改', 1: '权益', 2: '延保'}
// 主营品牌
data.mainCategory = data?.brandList?.map(val => {return `${val.mainBrand}${val.subBrandName}`})?.join('/')
data.mainCategory = data?.salePotentialCustomerBrandDTOList?.map(val => {return `${val.mainBrandName}${val.subBrandName}`})?.join('/')
// 合作模式
data.coopMode = data?.cooperationModeList?.map(val => { return `${businessSceneNames[val.businessSceneType]}${COOPERATIONMODELIST.find(v => v.value == val.directSalesFlag).name}` }).join('/')
data.coopMode = COOPERATIONMODELIST.find(v => v.value == data.cooperationMode).name
// 流量情况
data.flowScale = TRSFFICSTATUSLIST?.find(val => val.value == data.flowSituation)?.name
// 业务类型
data.bizType = data?.businessTypeList?.map(val => { return `${SCENELIST?.find(v => v.value == val.businessSceneType).name}` })?.join('/')
data.bizType = data?.businessTypeList?.map(val => { return `${SCENELIST?.find(v => v.value == val).name}` })?.join('/')
// 人员类型
data.salePotentialCustomerPersonnelInfoDTOList?.forEach(val => {
val.roleName = ROLELIST?.find(v => v.value == val.personnelType)?.label
......@@ -159,79 +116,26 @@ Page({
const items = [
{ label: '主营品牌', value: infoDetail.mainCategory },
{ label: '合作模式', value: infoDetail.coopMode },
{ label: '拜访次数', value: infoDetail.visitCount, highlight: true },
{ label: '拜访次数', value: infoDetail.visitCount != null ? `${infoDetail.visitCount}` : '', highlight: true },
{ label: '流量情况', value: infoDetail.flowScale },
[2, 4].includes(infoDetail.status) ? { label: '预计展业时间', value: infoDetail.expectBizTime } : null, // 已签约或已绑定展示
[2, 4].includes(infoDetail.status) ? { label: '分润规则', value: infoDetail.profitRule } : null, // 已签约或已绑定展示
{ label: '业务类型', value: infoDetail.bizType, span: 2, full: [2, 4].includes(infoDetail.status), clampLines: 1, threshold: 16 },
[2, 4].includes(infoDetail.status) ? { label: '上架商品', value: infoDetail.shelfProduct, full: true } : null
[3, 4].includes(infoDetail.potentialCustomersStatus) ? { label: '预计展业时间', value: dayjs(infoDetail.expectedOperationDate).format('YYYY-MM-DD') } : null, // 已签约或已绑定展示
[3, 4].includes(infoDetail.potentialCustomersStatus) ? { label: '分润规则', value: infoDetail.profitRule } : null, // 已签约或已绑定展示
{ label: '业务类型', value: infoDetail.bizType, span: 2, full: [3, 4].includes(infoDetail.potentialCustomersStatus), clampLines: 1, threshold: 16 },
[3, 4].includes(infoDetail.potentialCustomersStatus) ? { label: '上架商品', value: infoDetail.productShelfInfo, full: true } : null
].filter(Boolean)
this.setData({ infoBoardItems: items })
},
// 加载逻辑
resetAndLoad(cb) {
// 假数据
const res = {code: 0}
let { code } = res
const list = this.mockFetch()
if (code == 0) {
this.setData({
visitRecords: list
})
} else {
wx.$api.showToast(message)
}
return
CustomerApi.getVisitList().then(res => {
let { code, data, message } = res
const list = this.mockFetch()
if (code == 0) {
this.setData({
visitRecords: list
})
} else {
wx.$api.showToast(message)
}
})
},
loadMore(cb) {
this.setData({ loading: true })
const { pageNum, pageSize } = this.data
// TODO: 替换为真实接口请求
setTimeout(() => {
const { pageNum, pageSize } = this.data;
const list = this.mockFetch(pageNum, pageSize);
const hasMore = list.length === pageSize && pageNum < 5; // 假设最多 5 页
resetAndLoad() {
let { pageQuery } = this.data
CustomerApi.getVisitList({id: pageQuery.id}).then(res => {
this.setData({
visitRecords: this.data.visitRecords.concat(list),
pageNum: pageNum + 1,
hasMore,
loading: false
});
cb && cb();
}, 400);
},
// 模拟数据
mockFetch() {
return Array.from({ length: 10 }).map((_, i) => {
const id = i + 1
return {
id,
createdBy: id % 2 ? '张三' : '迪丽热巴·迪力木拉提',
visitTime: `2025-09-2${(id % 10)}`,
contactPerson: id % 3 ? '王总' : '古力娜扎',
visitContent: id % 2 ? '客户意向很高。' : '客户意向很高,门店运营里有觉得吃力的地方,希望互相帮助下,让门店营再上一层楼',
checkInLocation: '广东省深圳市龙岗区中海康城 5 栋 26很长的地址',
visitPhotos: id % 4 ? '' : 'https://dummyimage.com/68x68/eeeeee/999999.png&text=\u25A1'
};
});
visitRecords: res || []
})
})
},
// 导航栏就绪,按需记录高度(如需吸顶或内容偏移可使用)
navbarReady(e) {
let navBarHeight = e.detail.height
this.setData({
......@@ -242,8 +146,7 @@ Page({
tabClick(e) {
const index = typeof e?.detail === 'number' ? e.detail : 0
this.setData({
tabIndex: index,
showVisitButton: index != 1
tabIndex: index
})
this.resetAndLoad()
wx.nextTick(() => { this.measureLayout() })
......@@ -266,8 +169,9 @@ Page({
},
onCreateVisit() {
let { pageQuery } = this.data
wx.navigateTo({
url: '/packageCustomer/pages/createVisit/createVisit'
url: `/packageCustomer/pages/createVisit/createVisit?id=${pageQuery.id}`
})
}
});
\ No newline at end of file
......@@ -4,17 +4,17 @@
<view class="container">
<view class="card header-card">
<view class="title-row">
<text class="shop-name">杭州旺泽宝华哥桑纳尼汽车销售服务有限公司</text>
<text class="status" style="color: {{statusText[detailInfo.status].color}}">{{statusText[detailInfo.status].label}}</text>
<text class="shop-name">{{infoDetail.storeName}}</text>
<text class="status" style="color: {{statusText[infoDetail.potentialCustomersStatus].color}}">{{statusText[infoDetail.potentialCustomersStatus].label}}</text>
</view>
<view class="addr-row">
<image src="{{IMG_URL}}customer/location.png" mode=""/>
<text class="addr-tag">广东省深圳市龙岗区中海康城 5栋 26F</text>
<text class="addr-tag">{{infoDetail.provinceName}}{{infoDetail.city}}{{infoDetail.districtName}}{{infoDetail.address}}</text>
</view>
<info-board items="{{infoBoardItems}}" threshold="{{24}}" clampLines="{{1}}" />
<view class="fail-row" wx:if="{{detailInfo.status == 3}}">
<view class="fail-row" wx:if="{{infoDetail.potentialCustomersStatus == 2}}">
<view class="title">战败原因</view>
<view class="content">{{detailInfo.reason}}</view>
<view class="content">{{infoDetail.reason}}</view>
</view>
</view>
<view class="tabbar-anchor" id="tabbarAnchor">
......@@ -38,7 +38,7 @@
<view wx:else class="value">-</view>
</block>
<view class="value" wx:else>{{item[i.key]}}</view>
<view class="value" wx:else>{{item[i.key] || '-'}}</view>
</view>
</block>
</view>
......@@ -51,7 +51,7 @@
</view>
</block>
<block wx:else>
<view class="info-card">
<view class="info-card" style="min-height: calc(100vh - {{tabHeight}}px - {{navBarHeight}}px - 24rpx);">
<view id="markDetail"></view>
<material-details detail="{{infoDetail}}"></material-details>
</view>
......@@ -59,7 +59,8 @@
</view>
</scroll-view>
<!-- 底部固定操作条:新增拜访 -->
<view class="bottom-bar" wx:if="{{showVisitButton && userInfo.loginRole != 1}}">
<!-- potentialCustomersStatus 4是根据isBind绑定状态方便处理造出来的值 -->
<view class="bottom-bar" wx:if="{{tabIndex != 0 && userInfo.loginRole != 1 && infoDetail.potentialCustomersStatus != 3 && infoDetail.potentialCustomersStatus != 4}}">
<view class="inner safe-area-bottom">
<view class="btn" bind:tap="onCreateVisit">新增拜访</view>
</view>
......
......@@ -154,43 +154,46 @@ Page({
},
handleConfirm() {
const { infoData } = this.data
const { infoData, pageQuery } = this.data
if (infoData.result == 1) {
if (!infoData.expectTimeText || !infoData.profitRule || !infoData.productInfo ) return wx.$api.showToast('请填入必填信息')
} else {
if (!infoData.failReason) return wx.$api.showToast('请填入必填信息')
}
const params = {
id: pageQuery.id,
resultFeedbackStatus: infoData.result,
expectedOperationDate: infoData.expectTimeText,
profitRule: infoData.profitRule,
productShelfInfo: infoData.productInfo,
failureReason: infoData.result == 2 ? infoData.failReason : undefined
}
console.log(params)
// CustomerApi.reslutFeedbackApi(params).then(res => {
// })
// TODO: 接入后端提交接口
const res = {code: 1}
const okText = '我知道了'
if (this.resultDialog) {
if (res.code == 0) {
this.resultDialog.open({
type: 'success',
title: '结果反馈成功!',
description: '',
okText
})
} else {
this.resultDialog.open({
type: 'fail',
title: '结果反馈失败,请稍后重试',
description: '',
okText
})
if (this.data.confirmFlag) return
this.setData({confirmFlag: true})
wx.$api.showLoading()
CustomerApi.reslutFeedbackApi(params).then(res => {
wx.$api.hideLoading()
this.setData({confirmFlag: false})
const okText = '我知道了'
let { code } = res
if (this.resultDialog) {
if (code == 0) {
this.resultDialog.open({
type: 'success',
title: '结果反馈成功!',
description: '',
okText
})
} else {
this.resultDialog.open({
type: 'fail',
title: '结果反馈失败,请稍后重试',
description: '',
okText
})
}
}
}
})
},
// 接口请求结果弹窗确认
......
......@@ -79,8 +79,7 @@ page {
position: fixed;
bottom: 16rpx;
left: 0;
width: calc(100% - 64rpx);
height: 88rpx;
width: 100%;
line-height: 88rpx;
text-align: center;
font-size: 32rpx;
......
......@@ -41,7 +41,7 @@
<view class="label">上架产品信息 <text class="star">*</text></view>
</view>
<view class="textarea-wrap">
<textarea class="textarea" maxlength="50" placeholder="请输入" placeholder-class="input-ph" value="{{infoData.productInfo}}" bindinput="onProductInput" />
<textarea class="textarea" maxlength="50" placeholder="请输入" placeholder-class="input-ph" value="{{infoData.productShelfInfo}}" bindinput="onProductInput" />
<view class="counter">{{productLength}}/50</view>
</view>
</block>
......
// pages/tabWorkOrder/components/OrderScreen/OrderScreen.js
import { IMG_URL, PROVINCES, SCENELIST, COOPERATIONMODELIST, TRSFFICSTATUSLIST } from '~/utils/constantData'
import { IMG_URL, SCENELIST, COOPERATIONMODELIST, TRSFFICSTATUSLIST } from '~/utils/constantData'
import CustomerApi from '~/api/customerApi/index'
Component({
......@@ -18,6 +18,8 @@ Component({
if (userInfo.loginRole == 1) {
// 总监获取销售人员数据
this.getSalesList()
// 总监获取省份数据
this.getAreaData()
}
const page = wx.$router.getPageInstance()
const criteria = (this.data.currentTab === 1 ? page.data?.storeSearchObj : page.data?.searchObj) || {}
......@@ -53,11 +55,7 @@ Component({
active: true,
value: ''
}, ...TRSFFICSTATUSLIST],
provinces: [{
name: '全部',
active: true,
value: ''
}, ...PROVINCES],
provinces: [],
salesStaffList: [],
selectedMainBrand: []
},
......@@ -121,7 +119,6 @@ Component({
wx.$api.getViewInfo(
'.btn-box',
res => {
console.log(res)
this.setData({
height: navBarHeight,
btnHeight: res[0].height
......@@ -137,30 +134,44 @@ Component({
})
},
getSalesList() {
// 假数据
const res = {
code: 0,
message: '',
data: [{
staffName: '张四',
value: 1
}]
}
res.data.unshift({
staffName: '全部',
active: true,
value: ''
})
this.setData({
'form.salesStaffList': res.data || []
})
return
CustomerApi.getSalesPersonList({}).then(res => {
console.log(res)
res?.forEach(val => {
val.value = val.userId,
val.staffName = val.userName
})
res.unshift({
staffName: '全部',
active: true,
value: ''
})
this.setData({
'form.salesStaffList': res
}, () => {
const page = wx.$router.getPageInstance()
const criteria = (this.data.currentTab === 1 ? page.data?.storeSearchObj : page.data?.searchObj) || {}
this.applySelectedCriteria(criteria)
})
})
},
init() {
getAreaData() {
CustomerApi.getAreaTreeList({}).then(res => {
const data = res?.districts[0]?.districts
data.unshift({
name: '全部',
active: true,
value: ''
})
data?.forEach(v => {
v.value = v.code
})
this.setData({
'form.provinces': data
}, () => {
const page = wx.$router.getPageInstance()
const criteria = (this.data.currentTab === 1 ? page.data?.storeSearchObj : page.data?.searchObj) || {}
this.applySelectedCriteria(criteria)
})
})
},
showMore(e) {
let { type } = e.currentTarget.dataset
......@@ -210,11 +221,9 @@ Component({
'form.selectedMainBrand': [],
isReset: true
})
this.init()
},
brandConfirm() {
let brandMoudle = this.selectComponent('#car-brand')
console.log(brandMoudle)
this.setData({
'form.selectedMainBrand': brandMoudle && brandMoudle.handleConfirm() || []
})
......@@ -268,6 +277,5 @@ Component({
windowWidth
})
})
this.init()
}
})
\ No newline at end of file
......@@ -13,7 +13,7 @@
</view>
<view class="list-box">
<block wx:for="{{form.selectedMainBrand}}" wx:key="index">
<view class="item flex-1 text-center active" data-index="{{index}}">{{ (item.children && item.children[0] && item.children[0].name) || (item.name || '') }}</view>
<view class="item flex-1 text-center active" data-index="{{index}}">{{item.name}}{{ (item.children && item.children[0] && item.children[0].name) || (item.name || '') }}</view>
</block>
</view>
</view>
......
......@@ -40,15 +40,14 @@ Component({
// 保持原有的状态标签映射
statusText: {
1: { label: '跟进中', color: '#FF9D0A' },
2: { label: '已签约', color: '#35C376' },
3: { label: '未签约', color: '#F24724' },
3: { label: '已签约', color: '#35C376' },
2: { label: '未签约', color: '#F24724' },
4: { label: '已绑定', color: '#347BFF' }
}
},
lifetimes: {
attached() {
this.getPageData()
}
},
......@@ -60,12 +59,11 @@ Component({
this.resetAndLoad()
},
getParams() {
let { boardScopeActive, monthPickerValue, searchObj, statusIndex } = this.data
let { boardScopeActive, monthPickerValue, searchObj, statusIndex, userInfo } = this.data
const statusMap = {
0: 0, // 全部
1: 1, // 待跟进
2: 3, // 已签约
3: 4, // 已绑定
4: 2 // 未签约
}
const obj = {
......@@ -79,27 +77,25 @@ Component({
flowSituation: searchObj?.trafficStatusList?.value,
provinceId: searchObj?.provinces?.value,
salesPersonId: searchObj?.salesStaffList?.value,
status: statusMap[statusIndex]
potentialCustomersStatus: statusIndex == 0 ? undefined : statusMap[statusIndex], // 状态
isBind: statusIndex == 3 ? 1 : undefined, // 是否绑定
isSuperior: userInfo.loginRole != 3 ? 1 : 0,
queryScoure: 3
}
return obj
},
getStatic() {
let params = this.getParams()
delete params.status
console.log(params, '111111111')
// CustomerApi.getPotentialStatic({}).then(res => {
// })
this.setData({
dashboard: {
potentialCustomersCount: 900,
followUpCount: 60,
signedCount: 30,
notSignedCount: 30,
bindCount: 10
}
}, () => {
this.recordTabTop()
delete params.potentialCustomersStatus
delete params.isBind
wx.$api.showLoading()
CustomerApi.getPotentialStatic(params).then(res => {
wx.$api.hideLoading()
this.setData({
dashboard: res || {}
}, () => {
this.recordTabTop()
})
})
},
recordTabTop() {
......@@ -161,14 +157,14 @@ Component({
},
tabClick(e) {
const index = typeof e?.detail === 'number' ? e.detail : 0
this.setData({ statusIndex: index }, () => {
this.setData({ statusIndex: index, copyCustomerList: [] }, () => {
this.resetAndLoad(() => {
this.triggerEvent('needScrollTop', this.data.initialTabTop)
})
})
},
resetAndLoad(cb) {
this.setData({ currentPage: 1, hasMore: true })
this.setData({ currentPage: 1, hasMore: true, copyCustomerList: [] })
this.loadMore(cb)
},
......@@ -177,56 +173,33 @@ Component({
},
async loadMore(cb) {
let { hasMore, copyCustomerList } = this.data
if (!hasMore) return
this.setData({ loading: true })
try {
const { currentPage, pageSize } = this.data
const params = this.getParams()
console.log({
currentPage,
pageSize,
...params
}, '222222222222')
// const res = await mineCustomerApi.getPotentialList({ currentPage, pageSize })
// 假数据
const res = {
list: [{
id: 1
}, {
id: 2
}, {
id: 2
}, {
id: 2
}, {
id: 2
}, {
id: 2
}, {
id: 2
}, {
id: 2
}, {
id: 2
}]
}
const res = await CustomerApi.getPotentialList({ currentPage, pageSize, ...params })
res.list?.forEach(val => {
val.status = 1
if (val.isBind == 1) val.potentialCustomersStatus = 4
})
const nextList = res?.list || []
const total = res?.total || res?.count || 0
const pages = res?.pages || (total ? Math.ceil(total / pageSize) : null)
const hasMore = pages != null ? currentPage < pages : nextList.length === pageSize
const data = copyCustomerList.concat(nextList)
this.setData({
customerList: this.data.customerList.concat(nextList),
customerList: data,
copyCustomerList: data,
currentPage: currentPage + 1,
hasMore,
loading: false
})
cb && cb()
} catch (err) {
console.warn('获取客户列表失败:', err)
this.setData({ loading: false, hasMore: false })
}
cb && cb()
},
// 新增潜客
jump(e) {
......
......@@ -26,9 +26,9 @@
font-size: 28rpx;
border-radius: 4rpx;
opacity: 1;
border: 1rpx solid #e0e0e0;
border: 1rpx solid #e0e0e080;
box-shadow: 0 0 8rpx 0 #0000000f;
color: #757980;
color: #999EA8;
position: relative;
image {
width: 28rpx;
......@@ -72,7 +72,6 @@
/* 列表卡片 */
.list-section {
box-sizing: border-box;
padding: 24rpx 20rpx 0;
background: #F7F8FA;
.list-card {
......@@ -136,6 +135,9 @@
justify-content: center;
}
}
.loading {
pointer-events: none;
}
.fixed-btns {
position: fixed;
right: 20rpx;
......
......@@ -44,43 +44,47 @@
<tab-bar tabList="{{ listTabs }}" bindclick="tabClick" activeIndex="{{ statusIndex }}" />
</view>
<!-- 列表(潜客) -->
<view class="list-section" id="" style="min-height: calc(100vh - {{tabHeight}}px - {{navBarHeight}}px - 24rpx - 172rpx);" >
<view class="list-section {{loading ? 'loading' : ''}}" id="" style="min-height: calc(100vh - {{tabHeight}}px - {{navBarHeight}}px - 24rpx - 172rpx);" >
<block wx:if="{{customerList.length}}">
<block wx:for="{{customerList}}" wx:key="index">
<view class="list-card" bindtap="goDetail" data-item="{{item}}">
<view class="card-header">
<view class="title">{{item.shopName || item.merchantName || '-'}} </view>
<view class="status-tag" style="color: {{statusText[item.status].color}}">{{statusText[item.status].label}}</view>
<view class="title">{{item.storeName || '-'}} </view>
<view class="status-tag" style="color: {{statusText[item.potentialCustomersStatus].color}}">{{statusText[item.potentialCustomersStatus].label}}</view>
</view>
<view class="card-row">
<view class="label">拜访次数</view>
<view class="value">{{item.visitCount || item.visitTimes || 0}}次</view>
<view class="value">{{item.visitTimes != null ? item.visitTimes : '-'}}次</view>
</view>
<view class="card-row">
<view class="label">跟进人</view>
<view class="value">{{item.followUser || item.follower || '-'}} </view>
<view class="value">{{item.followUpPersonName || '-'}} </view>
</view>
<block wx:if="{{item.status == 2 || item.status == 4}}">
<view class="card-row" wx:if="{{item.potentialCustomersStatus == 1}}">
<view class="label">最后跟进</view>
<view class="value">{{item.lastFollowUpTime || '-'}} </view>
</view>
<block wx:if="{{item.potentialCustomersStatus == 3 || item.potentialCustomersStatus == 4}}">
<view class="card-row" >
<view class="label">预计展业时间</view>
<view class="value">{{item.followUser || item.follower || '-'}} </view>
<view class="value">{{item.expectedOperationDate || '-'}} </view>
</view>
<view class="card-row">
<view class="label">分润规则</view>
<view class="value">{{item.followUser || item.follower || '-'}} </view>
<view class="value">{{item.profitRule || '-'}} </view>
</view>
<view class="card-row">
<view class="label">上架产品信息</view>
<view class="value">{{item.followUser || item.follower || '-'}} </view>
<view class="value">{{item.productShelfInfo || '-'}} </view>
</view>
</block>
<view class="card-row" wx:if="{{item.status == 3}}">
<view class="card-row" wx:if="{{item.potentialCustomersStatus == 2}}">
<view class="label">战败原因</view>
<view class="value">{{item.followUser || item.follower || '-'}} </view>
<view class="value">{{item.failureReason || '-'}} </view>
</view>
<view class="card-actions" wx:if="{{userInfo.loginRole != 1}}">
<view wx:if="{{item.status == 1 || item.status == 2}}" class="btn {{item.status == 1 ? 'ghost' : ''}}" catchtap="jump" data-item="{{item}}">信息完善</view>
<view wx:if="{{item.status == 1}}" class="btn" catchtap="jump" data-item="{{item}}" data-name="resultFeedback">结果反馈</view>
<view wx:if="{{item.potentialCustomersStatus == 1 || item.potentialCustomersStatus == 3}}" class="btn {{item.potentialCustomersStatus == 1 ? 'ghost' : ''}}" catchtap="jump" data-item="{{item}}">信息完善</view>
<view wx:if="{{item.potentialCustomersStatus == 1}}" class="btn" catchtap="jump" data-item="{{item}}" data-name="resultFeedback">结果反馈</view>
</view>
</view>
</block>
......
......@@ -9,7 +9,8 @@ const __MIN_YM_TS__ = new Date(__NOW__.getFullYear(), __NOW__.getMonth() - 23, 1
Component({
properties: {
navBarHeight: Number,
searchObj: Object
searchObj: Object,
userInfo: Object
},
data: {
......@@ -34,13 +35,11 @@ Component({
loading: false,
// 门店状态 TabBar
listTabs: ['全部', '新店', '老店'],
statusIndex: 0,
activeStatus: 'all'
statusIndex: 0
},
lifetimes: {
attached() {
this.getPageData()
}
},
......@@ -52,15 +51,7 @@ Component({
this.resetAndLoad()
},
getParams() {
let { boardScopeActive, monthPickerValue, searchObj, statusIndex } = this.data
console.log(searchObj)
const statusMap = {
0: 0, // 全部
1: 1, // 待跟进
2: 3, // 已签约
3: 4, // 已绑定
4: 2 // 未签约
}
let { boardScopeActive, monthPickerValue, searchObj, statusIndex, userInfo } = this.data
const obj = {
isAll: boardScopeActive ? 1 : 0,
year: boardScopeActive ? undefined : new Date(monthPickerValue).getFullYear(),
......@@ -72,40 +63,27 @@ Component({
flowSituation: searchObj?.trafficStatusList?.value,
provinceId: searchObj?.provinces?.value,
salesPersonId: searchObj?.salesStaffList?.value,
status: statusMap[statusIndex]
storeType: statusIndex ? statusIndex : undefined,
isSuperior: userInfo.loginRole != 3 ? 1 : 0
}
return obj
},
getStatic() {
const params = this.getParams()
console.log(params, '11111')
// 假数据
const res = {
code: 0,
message: '',
data: {
total: 900,
newStore: 60,
oldStore: 30,
notOrdered: 30,
ordered: 10
}
}
this.setData({
dashboard: res.data || {}
}, () => {
this.recordTabTop()
})
return
wx.$api.showLoading()
CustomerApi.getStoreStatic(params).then(res => {
wx.$api.hideLoading()
this.setData({
dashboard: res || {}
}, () => {
this.recordTabTop()
})
})
},
recordTabTop() {
const query = wx.createSelectorQuery().in(this)
query.select('.tabbar-anchor').boundingClientRect()
query.exec(res => {
console.log(res, '1111')
const top = res[0]?.top
const height = res[0]?.height
this.setData({
......@@ -155,7 +133,6 @@ Component({
this.closeMonthPicker()
},
// 选择变化:严格参照 createVisit(使用 getValues 返回的带单位字符串)
onMonthChange(e) {
const values = e.detail.getValues()
const year = Number(String(values?.[0] || '').replace(/[年月日时分]/g, ''))
......@@ -168,8 +145,7 @@ Component({
// TabBar 点击(门店状态筛选)
tabClick(e) {
const index = typeof e?.detail === 'number' ? e.detail : 0
const statusMap = ['all', 'new', 'old']
this.setData({ statusIndex: index, activeStatus: statusMap[index] || 'all' }, () => {
this.setData({ statusIndex: index, storeList: [] }, () => {
this.resetAndLoad(() => {
this.triggerEvent('needScrollTop', this.data.initialTabTop)
})
......@@ -178,12 +154,11 @@ Component({
// 列表加载逻辑
resetAndLoad(cb) {
this.setData({ currentPage: 1, hasMore: true })
this.setData({ currentPage: 1, hasMore: true, storeList: [] })
this.loadMore(cb)
},
getMore() {
console.log(222)
},
async loadMore(cb) {
......@@ -191,23 +166,10 @@ Component({
try {
const { currentPage, pageSize } = this.data
const params = this.getParams()
console.log({
currentPage,
pageSize,
...params
}, '22222222')
// 暂用同一接口演示门店列表:真实项目可替换为门店专用接口
// const res = await CustomerApi.getStorePageList({ currentPage, pageSize })
// 假数据
const res = {
list: [{
id: 1
}]
}
const nextList = (res?.list || []).map((item, idx) => {
// 演示数据:根据当前门店状态索引打标 new/old(真实项目用后端字段)
const storeStatus = this.data.statusIndex === 1 ? 'new' : (this.data.statusIndex === 2 ? 'old' : (idx % 2 ? 'new' : 'old'))
return { ...item, storeStatus }
const res = await CustomerApi.getStorePageList({ currentPage, pageSize, ...params })
const nextList = (res.list || []).map(val => {
val.salesUser = val.salePersonnelInfoDTOList?.map(v => { return v.personnelName })?.join('/')
return val
})
const total = res?.total || res?.count || 0
const pages = res?.pages || (total ? Math.ceil(total / pageSize) : null)
......@@ -219,7 +181,6 @@ Component({
loading: false
})
} catch (err) {
console.warn('获取门店列表失败:', err)
this.setData({ loading: false, hasMore: false })
}
cb && cb()
......
......@@ -37,9 +37,9 @@
font-size: 28rpx;
border-radius: 4rpx;
opacity: 1;
border: 1rpx solid #e0e0e0;
border: 1rpx solid #e0e0e080;
box-shadow: 0 0 8rpx 0 #0000000f;
color: #757980;
color: #999EA8;
position: relative;
image {
width: 28rpx;
......@@ -73,8 +73,7 @@
}
}
.list-section {
box-sizing: border-box;
.list-section {
padding: 24rpx 20rpx 0;
background: #F7F8FA;
.list-card {
......@@ -113,7 +112,6 @@
}
.card-row {
display: flex;
align-items: center;
margin-top: 16rpx;
color: #999EA8;
font-size: 28rpx;
......
......@@ -17,23 +17,23 @@
<view class="board-grid">
<view class="grid-item">
<view class="label">门店总数</view>
<view class="value">{{dashboard.total}}</view>
<view class="value">{{dashboard.storeCount}}</view>
</view>
<view class="grid-item">
<view class="label">新店</view>
<view class="value">{{dashboard.newStore}}</view>
<view class="value">{{dashboard.newStoreCount}}</view>
</view>
<view class="grid-item">
<view class="label">老店</view>
<view class="value">{{dashboard.oldStore}}</view>
<view class="value">{{dashboard.oldStoreCount}}</view>
</view>
<view class="grid-item">
<view class="label">未出单</view>
<view class="value">{{dashboard.notOrdered}}</view>
<view class="value">{{dashboard.notSignedCount}}</view>
</view>
<view class="grid-item">
<view class="label">已出单</view>
<view class="value">{{dashboard.ordered}}</view>
<view class="value">{{dashboard.signedCount}}</view>
</view>
</view>
</view>
......@@ -50,28 +50,28 @@
<block wx:for="{{storeList}}" wx:key="index">
<view class="list-card" bindtap="goDetail" data-item="{{item}}">
<view class="card-header">
<view class="status-tag {{item.storeStatus == 'new' ? 'new' : 'old'}}">{{ item.storeStatus == 'new' ? '新店' : '老店' }}</view>
<view class="title">{{item.shopName || item.merchantName || '-'}} </view>
<view class="status-tag {{item.storeType == 1 ? 'new' : 'old'}}">{{ item.storeType == 1 ? '新店' : '老店' }}</view>
<view class="title">{{item.merchantName || '-'}} </view>
</view>
<view class="card-row">
<view class="label">拜访次数</view>
<view class="value">{{item.visitCount || item.visitTimes || 0}}次</view>
<view class="value">{{item.visitTimes != null ? item.visitTimes : '-'}}次</view>
</view>
<view class="card-row">
<view class="label">销售人员</view>
<view class="value">{{item.salesUser || item.follower || '-'}} </view>
<view class="value">{{item.salesUser || '-'}} </view>
</view>
<view class="card-row">
<view class="label">门店地址</view>
<view class="value">{{item.address || item.shopAddress || '-'}} </view>
<view class="value">{{item.address}}</view>
</view>
<view class="card-row">
<view class="label">签约时间</view>
<view class="value">{{item.lastFollow || item.lastFollowTime || '-'}} </view>
<view class="value">{{item.signedTime || '-'}} </view>
</view>
<view class="card-row">
<view class="label">展业时间</view>
<view class="value">{{item.bizTime || item.expectBizTime || '-'}} </view>
<view class="value">{{item.expectedOperationDate || '-'}} </view>
</view>
</view>
</block>
......
......@@ -4,14 +4,14 @@ import { getUserInfo } from '~/utils/cache/userInfo'
const navStyleTransparent = 'background-color: transparent;'
import reportPageTrackMixin from '~/mixins/reportPageTrackMixin'
Page({
// behaviors: [reportPageTrackMixin],
behaviors: [reportPageTrackMixin],
/**
* 页面的初始数据
*/
data: {
IMG_URL,
navStyle: navStyleTransparent,
userInfo: getUserInfo(),
userInfo: {},
tabList: [{
id: 1,
name: '潜客'
......@@ -81,9 +81,14 @@ Page({
},
// 总监有查看某个员工的潜客数据,手动触发时,将员工过滤条件清除
onTabItemTap(e) {
console.log('2222')
// 点击埋点
wx.$track.setTrackData(0, 'customer_page', {}, '')
// 重新加载数据
this.setData({
myTabIdx: 0
}, () => {
this.onShow()
})
},
// 导航栏就绪,记录高度并进行一次测量
......@@ -106,9 +111,19 @@ Page({
})
},
onLoad(options) {
this.setData({
userInfo: getUserInfo()
})
},
onShow() {
// this.onPageShow()
let { myTabIdx } = this.data
const component = myTabIdx == 0 ? 'potentialSection' : 'storeSection'
this.setData({
setScrollTop: 0
})
const coms = this.selectComponent(`#${component}`)
if (coms.getPageData) coms.getPageData()
this.onPageShow()
},
getMore() {
let { myTabIdx } = this.data
......@@ -128,11 +143,14 @@ Page({
scrollToListTop(e) {
let { scrollTop, navBarHeight, fixedHeight } = this.data
if (scrollTop > (e.detail - navBarHeight - fixedHeight)) {
this.setData({
setScrollTop: e.detail - navBarHeight - fixedHeight
})
}
wx.nextTick(() => {
if (scrollTop >= (e.detail - navBarHeight - fixedHeight)) {
this.setData({
setScrollTop: e.detail - navBarHeight - fixedHeight,
scrollTop: e.detail - navBarHeight - fixedHeight
})
}
})
},
// 触底加载转发到当前组件
......@@ -168,7 +186,7 @@ Page({
} else if (key === 'selectedMainBrand') {
// 主营品牌为数组;为空不回显
text = Array.isArray(val)
? val.map(v => (v?.children?.[0]?.name || v?.name || ''))
? val.map(v => (`${v.name}${v?.children?.[0]?.name}`))
.filter(Boolean)
.join('/')
: ''
......@@ -185,7 +203,7 @@ Page({
if (potential) potential.getPageData()
})
} else {
this.setData({ selectedScreenPotential: nextSelected }, () => {
this.setData({ selectedScreenStore: nextSelected }, () => {
const storeSection = this.selectComponent('#storeSection')
if (storeSection) storeSection.getPageData()
})
......@@ -205,25 +223,19 @@ Page({
wx.navigateTo({ url: '/packageCustomer/pages/createPotential/createPotential' })
},
// Tab 切换 + 重测量 + 列表刷新
changeMyTab(e) {
const index = e?.currentTarget?.dataset?.id
const nextIdx = typeof index === 'number' ? index : 0
if (nextIdx === this.data.myTabIdx) return
this.setData({ myTabIdx: nextIdx, setScrollTop: 0 }, () => {
if (nextIdx === 0) {
const comp = this.selectComponent('#potentialSection')
comp && comp.resetAndLoad && comp.resetAndLoad()
} else {
const comp = this.selectComponent('#storeSection')
comp && comp.resetAndLoad && comp.resetAndLoad()
}
})
this.setData({ myTabIdx: nextIdx, setScrollTop: 0 })
const component = nextIdx == 0 ? 'potentialSection' : 'storeSection'
const coms = this.selectComponent(`#${component}`)
if (coms.getPageData) coms.getPageData()
},
onHide() {
// this.onPageHide()
this.onPageHide()
},
onUnload() {
// this.onPageHide()
this.onPageHide()
}
})
\ No newline at end of file
......@@ -31,7 +31,7 @@
<view class="bg_iamge">
<glsx-image src="{{'customer/top-bg.png'}}" class="image_class" />
</view>
<scroll-view class="layout" style="padding-top: calc({{navBarHeight}}px + 172rpx);" scroll-top="{{setScrollTop}}" scroll-y bindscrolltolower="getMore" bindscroll="onPageScroll">
<scroll-view class="layout" style="padding-top: calc({{navBarHeight}}px + 172rpx);" scroll-top="{{setScrollTop}}" lower-threshold="104" scroll-y bindscrolltolower="getMore" bindscroll="onPageScroll">
<view class="container">
<block wx:if="{{myTabIdx==0}}">
<potential-section id="potentialSection"
......@@ -50,6 +50,7 @@
showAddIcon="{{showAddIcon}}"
navBarHeight="{{navBarHeight}}"
searchObj="{{storeSearchObj}}"
userInfo="{{userInfo}}"
/>
</block>
</view>
......
......@@ -27,43 +27,6 @@ export const IMG_VERSION = () => {
return accountInfo.miniProgram.version || '1.0.0'
}
export const PROVINCES = [
{ value: '110000', name: '北京市' },
{ value: '120000', name: '天津市' },
{ value: '130000', name: '河北省' },
{ value: '140000', name: '山西省' },
{ value: '150000', name: '内蒙古自治区' },
{ value: '210000', name: '辽宁省' },
{ value: '220000', name: '吉林省' },
{ value: '230000', name: '黑龙江省' },
{ value: '310000', name: '上海市' },
{ value: '320000', name: '江苏省' },
{ value: '330000', name: '浙江省' },
{ value: '340000', name: '安徽省' },
{ value: '350000', name: '福建省' },
{ value: '360000', name: '江西省' },
{ value: '370000', name: '山东省' },
{ value: '410000', name: '河南省' },
{ value: '420000', name: '湖北省' },
{ value: '430000', name: '湖南省' },
{ value: '440000', name: '广东省' },
{ value: '450000', name: '广西壮族自治区' },
{ value: '460000', name: '海南省' },
{ value: '500000', name: '重庆市' },
{ value: '510000', name: '四川省' },
{ value: '520000', name: '贵州省' },
{ value: '530000', name: '云南省' },
{ value: '540000', name: '西藏自治区' },
{ value: '610000', name: '陕西省' },
{ value: '620000', name: '甘肃省' },
{ value: '630000', name: '青海省' },
{ value: '640000', name: '宁夏回族自治区' },
{ value: '650000', name: '新疆维吾尔自治区' },
{ value: '710000', name: '台湾省' },
{ value: '810000', name: '香港特别行政区' },
{ value: '820000', name: '澳门特别行政区' }
]
export const COOPERATIONMODELIST = [{
name: '直营',
value: 1
......
......@@ -117,25 +117,30 @@ const domain = {
ip: {
// dj: 'http://192.168.1.165:8292',
dj: 'http://192.168.1.150:8293',
scrm: 'https://scrm.dev.glsx.com.cn'
scrm: 'https://scrm.dev.glsx.com.cn',
merchant: 'http://192.168.1.144:8091'
// dj: 'http://192.168.3.189:8385',
// scrm: 'http://192.168.1.165:8292'
},
dev: {
dj: 'http://192.168.3.189:8385',
scrm: 'https://scrm.dev.glsx.com.cn'
scrm: 'https://scrm.dev.glsx.com.cn',
merchant: 'http://192.168.1.144:8091'
},
uat: {
dj: 'https://dj.test.glsx.com.cn',
scrm: 'https://scrm.test.glsx.com.cn'
scrm: 'https://scrm.test.glsx.com.cn',
merchant: 'https://glsx-bi-report.test.glsx.com.cn'
},
prod: {
dj: 'https://dj.glsx.com.cn',
scrm: 'https://scrm.glsx.com.cn'
scrm: 'https://scrm.glsx.com.cn',
merchant: 'https://glsx-bi-report.glsx.com.cn'
},
preRelease: {
dj: 'https://dj.beta.glsx.com.cn',
scrm: 'https://scrm.beta.glsx.com.cn'
scrm: 'https://scrm.beta.glsx.com.cn',
merchant: 'https://glsx-bi-report.beta.glsx.com.cn'
}
}[target[index]]
......
......@@ -3,14 +3,20 @@ import { getSessionId } from '~/utils/cache/storageApi'
import network from '~/utils/network'
/**接口 */
class Request {
get(params, returnAll = false, requestPath) {
return this.request('GET', params, returnAll, requestPath)
get(params, returnAll = false, requestPath, customeUrl) {
return this.request('GET', params, returnAll, requestPath, customeUrl)
}
post(params, returnAll = false, requestPath) {
// console.log(requestPath, 'requestPath')
return this.request('POST', params, returnAll, requestPath)
}
async request(RequestMethods, params, returnAll, requestPath = 'dj') {
async request(
RequestMethods,
params,
returnAll,
requestPath = 'dj',
customeUrl
) {
const type = await network.getNetworkType()
if (type == 'none') return
return new Promise((resolve, reject) => {
......@@ -33,9 +39,10 @@ class Request {
: `/rop-scrm-${projectName}/`
}
params = this.getData(params, requestPath)
// console.log(params.method,'params');
wx.request({
url: `${domain[requestPath]}${path}router?method=${params.method}`,
url: customeUrl
? `${domain[requestPath]}${customeUrl}`
: `${domain[requestPath]}${path}router?method=${params.method}`,
data: params,
method: RequestMethods,
header,
......
......@@ -132,12 +132,12 @@ class TRACK {
setTrackData(eventType, eventCode = '', businessParam = '', batchId, scene) {
// console.log(eventCode, 'eventCode');
let recordList = $Storage.get('recordList'),
{ route } = this.getPageInstance(),
{ route } = this.getPageInstance?.() || {},
prePagePath = this.getPageInstance(2),
userInfo = getUserInfo(),
item = {
loginAccount: userInfo.name,
uuid: userInfo.uuid,
loginAccount: userInfo?.name,
uuid: userInfo?.uuid,
systemSource: 5,
eventTime: new Date().format('yyyy-MM-dd hh:mm:ss'),
eventType,
......@@ -179,7 +179,7 @@ class TRACK {
apiProjectName: 'clue',
recordList
},
'',
true,
'scrm'
)
.then(({ code, data, message }) => {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!