Commit cb5b62e2 by zhangxw

Merge branch 'SAAS+V5.8.4' of http://192.168.3.233:8090/saas_plus/regional-assis…

…tant into SAAS+V5.8.4
2 parents fb513e31 53356a67
......@@ -527,4 +527,8 @@ module.exports = {
'/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";
* 4预发布
* 5cdptest
*/
let index = 2;
let index = 1;
const accountInfo = wx.getAccountInfoSync();
const systemInfo = wx.getSystemInfoSync();
const envName = accountInfo.miniProgram.envVersion;
......
......@@ -48,6 +48,15 @@ module.exports = {
'/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) {
return api.post(
......
......@@ -5,6 +5,7 @@ import {
getDemandStoreListAPI,
getStaffDictListAPI,
addStaffDictListAPI,
getPotentialCustomersPage
// getCarBrandList
} from '../api'
// 表单字段配置
......@@ -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({
data: {
IMG_URL,
......@@ -104,6 +77,7 @@ Page({
onLoad() {
// this.initRegionData()
this.getPotentialCustomerStoreList()
},
// 获取高德省市数据
......@@ -174,6 +148,10 @@ Page({
// VALIDATION_CONFIG[FORM_FIELDS.ADDRESS].required = bySystemMerchant
// VALIDATION_CONFIG[FORM_FIELDS.ADDRESS_DETAIL].required = bySystemMerchant
if (bySystemMerchant && this.potentialCustomerStoreOptions?.length) {
formList[FORM_FIELDS.MERCHANT].options = this.potentialCustomerStoreOptions
}
this.setData({
bySystemMerchant,
formList
......@@ -333,7 +311,7 @@ Page({
? item.value[0]
: item.value
options = options.map(option => {
if (option.value === selectedValue) {
if (String(option.value) === String(selectedValue)) {
option.checked = true
selectedOptions.push(option.value)
}
......@@ -410,7 +388,7 @@ Page({
return
}
// 潜客门店:本地过滤
// 潜客门店:接口搜索
if (this.data.bySystemMerchant) {
const options = await this.getPotentialCustomerStoreList(keyword)
const processedOptions = options.map(option => ({
......@@ -421,7 +399,7 @@ Page({
if (selectedOptions.length > 0) {
const selectedValue = selectedOptions[0]
processedOptions.forEach(option => {
if (option.value === selectedValue) {
if (String(option.value) === String(selectedValue)) {
option.checked = true
}
})
......@@ -448,7 +426,7 @@ Page({
if (selectedOptions.length > 0) {
const selectedValue = selectedOptions[0]
processedOptions.forEach(option => {
if (option.value === selectedValue) {
if (String(option.value) === String(selectedValue)) {
option.checked = true
}
})
......@@ -479,9 +457,13 @@ Page({
const currentIndex = this.data.currentIndex
const item = this.data.formList[currentIndex]
// 找到点击的选项在原始options中的索引
const originalIndex = options.findIndex(option => option.value === value)
const filteredIndex = filteredOptions.findIndex(option => option.value === value)
// 找到点击的选项在原始options中的索引(dataset.value 会被转为字符串)
const originalIndex = options.findIndex(
option => String(option.value) === String(value)
)
const filteredIndex = filteredOptions.findIndex(
option => String(option.value) === String(value)
)
if (item.multi) {
if (originalIndex >= 0) {
......@@ -623,10 +605,10 @@ Page({
const selectedValue = selectedOptions[0] || ''
if (selectedValue) {
const selectedOption = this.data.options.find(
option => option.value === selectedValue
option => String(option.value) === String(selectedValue)
)
if (selectedOption) {
value = selectedValue
value = selectedOption.value
displayValue = selectedOption.text || ''
}
}
......@@ -665,7 +647,7 @@ Page({
buildSubmitData() {
const { formList, bySystemMerchant } = this.data
return {
merchantId: bySystemMerchant ? null : formList[FORM_FIELDS.MERCHANT].value,
merchantId: formList[FORM_FIELDS.MERCHANT].value || null,
merchantName: formList[FORM_FIELDS.MERCHANT].displayValue,
// salesVolume: bySystemMerchant ? formList[FORM_FIELDS.SALES].value : null,
// brand: bySystemMerchant ? formList[FORM_FIELDS.BRANDS].displayValue : null,
......@@ -805,26 +787,44 @@ Page({
// })
// },
/**
* 获取潜客门店列表(临时硬编码)
* 获取潜客门店列表
* @param {String} keyword 搜索关键词(可选)
*/
getPotentialCustomerStoreList(keyword = '') {
return new Promise(resolve => {
let list = MOCK_POTENTIAL_CUSTOMER_STORES
return new Promise((resolve, reject) => {
const params = {
currentPage: 1,
pageSize: 999
}
if (keyword) {
list = list.filter(item => item.storeName.includes(keyword))
params.storeName = keyword
}
const options = list.map(item => ({
text: item.storeName,
value: item.id,
merchantId: item.merchantId
}))
if (!keyword) {
this.setData({
'formList[0].options': options
getPotentialCustomersPage(params)
.then(res => {
let { code, data } = res
if (code == 0) {
const list = (data && data.list) || data || []
const options = list.map(item => ({
text: item.storeName || '-',
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)
})
},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!