Commit a28a7d31 by Lin

更新潜客门店列表接口,移除硬编码的模拟数据,优化表单字段验证逻辑,修复潜在客户选项的比较方式,确保数据一致性。

1 parent 890af938
...@@ -527,4 +527,8 @@ module.exports = { ...@@ -527,4 +527,8 @@ module.exports = {
'/rop-dj-business-school-miniprogram/router' '/rop-dj-business-school-miniprogram/router'
) )
}, },
// 获取潜客列表
getPotentialCustomersPage(data) {
return api.post('dj.api.staff.miniprogram.recruitment.demand.potentialCustomers.page', data)
},
} }
...@@ -18,7 +18,7 @@ export const appId = "wx570d9331f9ace0bd"; ...@@ -18,7 +18,7 @@ export const appId = "wx570d9331f9ace0bd";
* 4预发布 * 4预发布
* 5cdptest * 5cdptest
*/ */
let index = 2; let index = 1;
const accountInfo = wx.getAccountInfoSync(); const accountInfo = wx.getAccountInfoSync();
const systemInfo = wx.getSystemInfoSync(); const systemInfo = wx.getSystemInfoSync();
const envName = accountInfo.miniProgram.envVersion; const envName = accountInfo.miniProgram.envVersion;
......
...@@ -48,6 +48,15 @@ module.exports = { ...@@ -48,6 +48,15 @@ module.exports = {
'/rop-dj-staff-miniprogram/router' '/rop-dj-staff-miniprogram/router'
) )
}, },
// 获取潜客门店列表
getPotentialCustomersPage(data) {
return api.post(
'dj.api.staff.miniprogram.recruitment.demand.potentialCustomers.page',
data,
[],
'/rop-dj-staff-miniprogram/router'
)
},
// 招聘管理字典查询 // 招聘管理字典查询
getStaffDictListAPI(data) { getStaffDictListAPI(data) {
return api.post( return api.post(
......
...@@ -5,6 +5,7 @@ import { ...@@ -5,6 +5,7 @@ import {
getDemandStoreListAPI, getDemandStoreListAPI,
getStaffDictListAPI, getStaffDictListAPI,
addStaffDictListAPI, addStaffDictListAPI,
getPotentialCustomersPage
// getCarBrandList // getCarBrandList
} from '../api' } from '../api'
// 表单字段配置 // 表单字段配置
...@@ -36,34 +37,6 @@ const VALIDATION_CONFIG = { ...@@ -36,34 +37,6 @@ const VALIDATION_CONFIG = {
} }
} }
// 潜客门店列表(临时硬编码,后续替换为接口)
const MOCK_POTENTIAL_CUSTOMER_STORES = [
{
id: 1001,
storeName: 'XX汽车服务中心',
merchantId: 5001,
isBind: 1,
cooperationMode: 1,
provinceName: '广东省',
city: '广州市',
districtName: '天河区',
address: '广州市天河区XXX路XX号',
potentialCustomersStatus: 1,
followUpPersonName: '张三',
visitTimes: 3,
firstVisitTime: '03-15',
lastVisitContent: '初步沟通合作意向',
merchantName: 'XX汽车服务有限公司',
isSelf: 1,
createdDate: '2026-03-10 09:30:00',
businessTypeList: [{ businessType: 1 }, { businessType: 2 }],
brandList: [{ mainBrandName: '品牌A', subBrandName: '型号A1' }],
personnelInfoList: [
{ personnelType: 1, personnelName: '李四', personnelPhone: '13800138000' }
]
}
]
Page({ Page({
data: { data: {
IMG_URL, IMG_URL,
...@@ -104,6 +77,7 @@ Page({ ...@@ -104,6 +77,7 @@ Page({
onLoad() { onLoad() {
// this.initRegionData() // this.initRegionData()
this.getPotentialCustomerStoreList()
}, },
// 获取高德省市数据 // 获取高德省市数据
...@@ -174,6 +148,10 @@ Page({ ...@@ -174,6 +148,10 @@ Page({
// VALIDATION_CONFIG[FORM_FIELDS.ADDRESS].required = bySystemMerchant // VALIDATION_CONFIG[FORM_FIELDS.ADDRESS].required = bySystemMerchant
// VALIDATION_CONFIG[FORM_FIELDS.ADDRESS_DETAIL].required = bySystemMerchant // VALIDATION_CONFIG[FORM_FIELDS.ADDRESS_DETAIL].required = bySystemMerchant
if (bySystemMerchant && this.potentialCustomerStoreOptions?.length) {
formList[FORM_FIELDS.MERCHANT].options = this.potentialCustomerStoreOptions
}
this.setData({ this.setData({
bySystemMerchant, bySystemMerchant,
formList formList
...@@ -333,7 +311,7 @@ Page({ ...@@ -333,7 +311,7 @@ Page({
? item.value[0] ? item.value[0]
: item.value : item.value
options = options.map(option => { options = options.map(option => {
if (option.value === selectedValue) { if (String(option.value) === String(selectedValue)) {
option.checked = true option.checked = true
selectedOptions.push(option.value) selectedOptions.push(option.value)
} }
...@@ -410,7 +388,7 @@ Page({ ...@@ -410,7 +388,7 @@ Page({
return return
} }
// 潜客门店:本地过滤 // 潜客门店:接口搜索
if (this.data.bySystemMerchant) { if (this.data.bySystemMerchant) {
const options = await this.getPotentialCustomerStoreList(keyword) const options = await this.getPotentialCustomerStoreList(keyword)
const processedOptions = options.map(option => ({ const processedOptions = options.map(option => ({
...@@ -421,7 +399,7 @@ Page({ ...@@ -421,7 +399,7 @@ Page({
if (selectedOptions.length > 0) { if (selectedOptions.length > 0) {
const selectedValue = selectedOptions[0] const selectedValue = selectedOptions[0]
processedOptions.forEach(option => { processedOptions.forEach(option => {
if (option.value === selectedValue) { if (String(option.value) === String(selectedValue)) {
option.checked = true option.checked = true
} }
}) })
...@@ -448,7 +426,7 @@ Page({ ...@@ -448,7 +426,7 @@ Page({
if (selectedOptions.length > 0) { if (selectedOptions.length > 0) {
const selectedValue = selectedOptions[0] const selectedValue = selectedOptions[0]
processedOptions.forEach(option => { processedOptions.forEach(option => {
if (option.value === selectedValue) { if (String(option.value) === String(selectedValue)) {
option.checked = true option.checked = true
} }
}) })
...@@ -479,9 +457,13 @@ Page({ ...@@ -479,9 +457,13 @@ Page({
const currentIndex = this.data.currentIndex const currentIndex = this.data.currentIndex
const item = this.data.formList[currentIndex] const item = this.data.formList[currentIndex]
// 找到点击的选项在原始options中的索引 // 找到点击的选项在原始options中的索引(dataset.value 会被转为字符串)
const originalIndex = options.findIndex(option => option.value === value) const originalIndex = options.findIndex(
const filteredIndex = filteredOptions.findIndex(option => option.value === value) option => String(option.value) === String(value)
)
const filteredIndex = filteredOptions.findIndex(
option => String(option.value) === String(value)
)
if (item.multi) { if (item.multi) {
if (originalIndex >= 0) { if (originalIndex >= 0) {
...@@ -623,10 +605,10 @@ Page({ ...@@ -623,10 +605,10 @@ Page({
const selectedValue = selectedOptions[0] || '' const selectedValue = selectedOptions[0] || ''
if (selectedValue) { if (selectedValue) {
const selectedOption = this.data.options.find( const selectedOption = this.data.options.find(
option => option.value === selectedValue option => String(option.value) === String(selectedValue)
) )
if (selectedOption) { if (selectedOption) {
value = selectedValue value = selectedOption.value
displayValue = selectedOption.text || '' displayValue = selectedOption.text || ''
} }
} }
...@@ -665,7 +647,7 @@ Page({ ...@@ -665,7 +647,7 @@ Page({
buildSubmitData() { buildSubmitData() {
const { formList, bySystemMerchant } = this.data const { formList, bySystemMerchant } = this.data
return { return {
merchantId: bySystemMerchant ? null : formList[FORM_FIELDS.MERCHANT].value, merchantId: formList[FORM_FIELDS.MERCHANT].value || null,
merchantName: formList[FORM_FIELDS.MERCHANT].displayValue, merchantName: formList[FORM_FIELDS.MERCHANT].displayValue,
// salesVolume: bySystemMerchant ? formList[FORM_FIELDS.SALES].value : null, // salesVolume: bySystemMerchant ? formList[FORM_FIELDS.SALES].value : null,
// brand: bySystemMerchant ? formList[FORM_FIELDS.BRANDS].displayValue : null, // brand: bySystemMerchant ? formList[FORM_FIELDS.BRANDS].displayValue : null,
...@@ -805,26 +787,44 @@ Page({ ...@@ -805,26 +787,44 @@ Page({
// }) // })
// }, // },
/** /**
* 获取潜客门店列表(临时硬编码) * 获取潜客门店列表
* @param {String} keyword 搜索关键词(可选) * @param {String} keyword 搜索关键词(可选)
*/ */
getPotentialCustomerStoreList(keyword = '') { getPotentialCustomerStoreList(keyword = '') {
return new Promise(resolve => { return new Promise((resolve, reject) => {
let list = MOCK_POTENTIAL_CUSTOMER_STORES const params = {
currentPage: 1,
pageSize: 999
}
if (keyword) { if (keyword) {
list = list.filter(item => item.storeName.includes(keyword)) params.storeName = keyword
} }
const options = list.map(item => ({ getPotentialCustomersPage(params)
text: item.storeName, .then(res => {
value: item.id, let { code, data } = res
merchantId: item.merchantId if (code == 0) {
})) const list = (data && data.list) || data || []
if (!keyword) { const options = list.map(item => ({
this.setData({ text: item.storeName || '-',
'formList[0].options': options value: item.merchantId || item.id
}))
if (!keyword) {
this.potentialCustomerStoreOptions = options
if (this.data.bySystemMerchant) {
this.setData({
'formList[0].options': options
})
}
}
resolve(options)
} else {
reject(new Error('获取潜客门店列表失败'))
}
})
.catch(err => {
console.error('获取潜客门店列表失败', err)
reject(err)
}) })
}
resolve(options)
}) })
}, },
......
...@@ -195,9 +195,9 @@ Page({ ...@@ -195,9 +195,9 @@ Page({
// 根据类型取到对应的值 // 根据类型取到对应的值
const { message, ...dialogParams } = dialogOptions[serviceCenterEnum][noticeItem.reminderType || 1]; const { message, ...dialogParams } = dialogOptions[serviceCenterEnum][noticeItem.reminderType || 1];
that.setData({ // that.setData({
isShowingModal: true, // isShowingModal: true,
}); // });
try { try {
await Dialog.alert({ await Dialog.alert({
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!