diff --git a/niucloud/app/api/controller/apiController/Common.php b/niucloud/app/api/controller/apiController/Common.php
index d7b25f96..88243d9c 100644
--- a/niucloud/app/api/controller/apiController/Common.php
+++ b/niucloud/app/api/controller/apiController/Common.php
@@ -25,15 +25,15 @@ class Common extends BaseApiService
//获取字典
public function getDictionary(Request $request){
- //获取员工信息
+ //获取字典数据
$where = [
'key'=>$request->param('key','')
];
$res = (new CommonService())->getDictionary($where);
- if(!$res){
- return fail('账户信息有误');
+ if(empty($res)){
+ return fail('字典数据不存在');
}
- return success($res);
+ return success('操作成功', $res);
}
//忘记密码-通过短信验证码进行密码重置(学生/员工通用)
diff --git a/niucloud/app/model/customer_resources/CustomerResources.php b/niucloud/app/model/customer_resources/CustomerResources.php
index cee4efec..6380ef00 100644
--- a/niucloud/app/model/customer_resources/CustomerResources.php
+++ b/niucloud/app/model/customer_resources/CustomerResources.php
@@ -116,6 +116,26 @@ class CustomerResources extends BaseModel
}
}
+ /**
+ * 获取字典数据的辅助方法
+ * @param string $key
+ * @return array
+ */
+ private function getDictionaryData($key)
+ {
+ $dict = \think\facade\Db::table('school_sys_dict')->where('key', $key)->find();
+ $dictionary = [];
+ if ($dict && !empty($dict['dictionary'])) {
+ // 数据库中的字段是双层JSON编码,需要两次解码
+ $jsonString = json_decode($dict['dictionary'], true);
+ if (is_string($jsonString)) {
+ $dictionary = json_decode($jsonString, true) ?: [];
+ } else {
+ $dictionary = $jsonString ?: [];
+ }
+ }
+ return $dictionary;
+ }
/**
* 搜索器:客户资源联系电话
@@ -184,8 +204,7 @@ class CustomerResources extends BaseModel
$key = 'preliminarycustomerintention';
$val = (String)$data['initial_intent'];
if ((!empty($val) || isset($val)) && $val !== '') {
- $dict = Dict::where('key',$key)->find();
- $dictionary = $dict['dictionary'] ?? [];
+ $dictionary = $this->getDictionaryData($key);
// 查找匹配的 name
$res = '';
foreach ($dictionary as $item) {
@@ -211,8 +230,18 @@ class CustomerResources extends BaseModel
$key = 'SourceChannel';
$val = (String)$data['source_channel'];
if ((!empty($val) || isset($val)) && $val !== '') {
- $dict = Dict::where('key',$key)->find();
- $dictionary = $dict['dictionary'] ?? [];
+ // 直接查询正确的表名
+ $dict = \think\facade\Db::table('school_sys_dict')->where('key', $key)->find();
+ $dictionary = [];
+ if ($dict && !empty($dict['dictionary'])) {
+ // 数据库中的字段是双层JSON编码,需要两次解码
+ $jsonString = json_decode($dict['dictionary'], true);
+ if (is_string($jsonString)) {
+ $dictionary = json_decode($jsonString, true) ?: [];
+ } else {
+ $dictionary = $jsonString ?: [];
+ }
+ }
// 查找匹配的 name
$res = '';
$arr = [
@@ -245,8 +274,18 @@ class CustomerResources extends BaseModel
$key = 'source';
$val = (String)$data['source'];
if ((!empty($val) || isset($val)) && $val !== '') {
- $dict = Dict::where('key',$key)->find();
- $dictionary = $dict['dictionary'] ?? [];
+ // 直接查询正确的表名
+ $dict = \think\facade\Db::table('school_sys_dict')->where('key', $key)->find();
+ $dictionary = [];
+ if ($dict && !empty($dict['dictionary'])) {
+ // 数据库中的字段是双层JSON编码,需要两次解码
+ $jsonString = json_decode($dict['dictionary'], true);
+ if (is_string($jsonString)) {
+ $dictionary = json_decode($jsonString, true) ?: [];
+ } else {
+ $dictionary = $jsonString ?: [];
+ }
+ }
// 查找匹配的 name
$res = '';
foreach ($dictionary as $item) {
@@ -272,8 +311,7 @@ class CustomerResources extends BaseModel
$key = 'zy_sex';
$val = (String)$data['gender'];
if ((!empty($val) || isset($val)) && $val !== '') {
- $dict = Dict::where('key',$key)->find();
- $dictionary = $dict['dictionary'] ?? [];
+ $dictionary = $this->getDictionaryData($key);
// 查找匹配的 name
$res = '';
foreach ($dictionary as $item) {
@@ -299,8 +337,7 @@ class CustomerResources extends BaseModel
$key = 'customer_purchasing_power';
$val = (String)$data['purchasing_power'];
if ((!empty($val) || isset($val)) && $val !== '') {
- $dict = Dict::where('key',$key)->find();
- $dictionary = $dict['dictionary'] ?? [];
+ $dictionary = $this->getDictionaryData($key);
// 查找匹配的 name
$res = '';
foreach ($dictionary as $item) {
@@ -326,8 +363,7 @@ class CustomerResources extends BaseModel
$key = 'kh_status';
$val = (String)$data['status'];
if ((!empty($val) || isset($val)) && $val !== '') {
- $dict = Dict::where('key',$key)->find();
- $dictionary = $dict['dictionary'] ?? [];
+ $dictionary = $this->getDictionaryData($key);
// 查找匹配的 name
$res = '';
foreach ($dictionary as $item) {
@@ -353,8 +389,7 @@ class CustomerResources extends BaseModel
$key = 'decision_maker';
$val = (String)$data['decision_maker'] ?? '';
if ((!empty($val) || isset($val)) && $val !== '') {
- $dict = Dict::where('key',$key)->find();
- $dictionary = $dict['dictionary'] ?? [];
+ $dictionary = $this->getDictionaryData($key);
// 查找匹配的 name
$res = $val;
foreach ($dictionary as $item) {
diff --git a/niucloud/app/model/six_speed/SixSpeed.php b/niucloud/app/model/six_speed/SixSpeed.php
index 0911fb2c..21810009 100644
--- a/niucloud/app/model/six_speed/SixSpeed.php
+++ b/niucloud/app/model/six_speed/SixSpeed.php
@@ -99,8 +99,7 @@ class SixSpeed extends BaseModel
$key = 'customer_purchasing_power';
$val = (String)$data['purchase_power'];
if ((!empty($val) || isset($val)) && $val !== '') {
- $dict = Dict::where('key',$key)->find();
- $dictionary = $dict['dictionary'] ?? [];
+ $dictionary = $this->getDictionaryData($key);
// 查找匹配的 name
$res = '';
foreach ($dictionary as $item) {
@@ -115,6 +114,27 @@ class SixSpeed extends BaseModel
}
}
+ /**
+ * 获取字典数据的辅助方法
+ * @param string $key
+ * @return array
+ */
+ private function getDictionaryData($key)
+ {
+ $dict = \think\facade\Db::table('school_sys_dict')->where('key', $key)->find();
+ $dictionary = [];
+ if ($dict && !empty($dict['dictionary'])) {
+ // 数据库中的字段是双层JSON编码,需要两次解码
+ $jsonString = json_decode($dict['dictionary'], true);
+ if (is_string($jsonString)) {
+ $dictionary = json_decode($jsonString, true) ?: [];
+ } else {
+ $dictionary = $jsonString ?: [];
+ }
+ }
+ return $dictionary;
+ }
+
/**
* 获取认知理念类型名称
* @param $value
@@ -126,8 +146,7 @@ class SixSpeed extends BaseModel
$key = 'customer_purchasing_power';
$val = (String)$data['concept_awareness'];
if ((!empty($val) || isset($val)) && $val !== '') {
- $dict = Dict::where('key',$key)->find();
- $dictionary = $dict['dictionary'] ?? [];
+ $dictionary = $this->getDictionaryData($key);
// 查找匹配的 name
$res = '';
foreach ($dictionary as $item) {
diff --git a/niucloud/app/service/api/apiService/CommonService.php b/niucloud/app/service/api/apiService/CommonService.php
index 64fa8638..52e597d7 100644
--- a/niucloud/app/service/api/apiService/CommonService.php
+++ b/niucloud/app/service/api/apiService/CommonService.php
@@ -37,12 +37,32 @@ class CommonService extends BaseApiService
if(!empty($where['key'])){
$model = $model->where('key',$where['key']);
}
- $res = $model->field($field)->find();//员工信息
+ $res = $model->field($field)->find();//字典信息
if($res){
$data = $res->toArray();
- // 模型已经自动处理JSON转换,直接返回dictionary字段
- $res = $data['dictionary'] ?? [];
+ // 手动解析JSON字符串
+ $dictionary = $data['dictionary'] ?? '';
+
+ if(is_string($dictionary)){
+ // 首先解码一层JSON(去掉外层引号)
+ $firstDecode = json_decode($dictionary, true);
+ if($firstDecode !== null && is_string($firstDecode)) {
+ // 如果第一次解码得到字符串,再次解码
+ $parsed = json_decode($firstDecode, true);
+ } else if($firstDecode !== null && is_array($firstDecode)) {
+ // 如果第一次解码就得到数组,直接使用
+ $parsed = $firstDecode;
+ } else {
+ // 如果第一次解码失败,可能不是JSON格式,直接尝试解码原字符串
+ $parsed = json_decode($dictionary, true);
+ }
+
+ $res = $parsed ?: [];
+ } else {
+ // 如果已经是数组,直接使用
+ $res = $dictionary;
+ }
}else{
$res = [];
}
diff --git a/niucloud/app/service/api/apiService/CustomerResourcesService.php b/niucloud/app/service/api/apiService/CustomerResourcesService.php
index 7205cd09..37122cbe 100644
--- a/niucloud/app/service/api/apiService/CustomerResourcesService.php
+++ b/niucloud/app/service/api/apiService/CustomerResourcesService.php
@@ -653,8 +653,8 @@ class CustomerResourcesService extends BaseApiService
return [];
}
- // 查询字典数据
- $dictData = Dict::whereIn('key', $dictKeys)->select()->toArray();
+ // 查询字典数据 - 使用正确的表名
+ $dictData = \think\facade\Db::table('school_sys_dict')->whereIn('key', $dictKeys)->select()->toArray();
//使用 array_column 构建 key => dict 的映射
$dictMap = array_column($dictData, null, 'key'); // 以 key 字段为索引
@@ -663,7 +663,17 @@ class CustomerResourcesService extends BaseApiService
// 构建字段 => 字典项的映射
$result = [];
foreach ($fieldDictMapping as $field => $key) {
- $result[$field] = $dictMap[$key]['dictionary'] ?? [];
+ $dictionary = [];
+ if (isset($dictMap[$key]['dictionary']) && !empty($dictMap[$key]['dictionary'])) {
+ // 数据库中的字段是双层JSON编码,需要两次解码
+ $jsonString = json_decode($dictMap[$key]['dictionary'], true);
+ if (is_string($jsonString)) {
+ $dictionary = json_decode($jsonString, true) ?: [];
+ } else {
+ $dictionary = $jsonString ?: [];
+ }
+ }
+ $result[$field] = $dictionary;
//判断是不是获取的"来源渠道"的字典
if ($field == 'source_channel') {
$append_arr = [
diff --git a/uniapp/pages-market/clue/clue_info.vue b/uniapp/pages-market/clue/clue_info.vue
index 7a2490bb..b8d6d3ae 100644
--- a/uniapp/pages-market/clue/clue_info.vue
+++ b/uniapp/pages-market/clue/clue_info.vue
@@ -536,9 +536,6 @@ export default {
this.currentRecord = null
},
-
-
-
async getCourseInfo(studentId = null) {
if (!this.clientInfo?.resource_id) return
try {
@@ -645,9 +642,10 @@ export default {
if (tabId === 4) await this.getFitnessRecords()
if (tabId === 6) {
this.$navigateToPage(`/pages-market/clue/edit_clues_log`, {
- resource_id: this.clientInfo.resource_id
+ resource_id: this.clientInfo.id
})
}
+ console.log('切换标签页:', this.clientInfo)
if (tabId === 7) this.$navigateToPage(`/pages-market/clue/edit_clues`, {
resource_sharing_id: this.clientInfo.id
})
diff --git a/uniapp/pages-market/clue/edit_clues.vue b/uniapp/pages-market/clue/edit_clues.vue
index 2e021be5..f4f08f31 100644
--- a/uniapp/pages-market/clue/edit_clues.vue
+++ b/uniapp/pages-market/clue/edit_clues.vue
@@ -306,7 +306,7 @@
-
+
diff --git a/uniapp/pages-market/clue/index.vue b/uniapp/pages-market/clue/index.vue
index 52c373c2..addd40a9 100644
--- a/uniapp/pages-market/clue/index.vue
+++ b/uniapp/pages-market/clue/index.vue
@@ -274,6 +274,19 @@
+
+
@@ -378,7 +391,9 @@
deal_type: '',
valid_type: '',
communication_status: '',
- time_range: ''
+ time_range: '',
+ age: '', // 年龄字段,只能输入数字或小数
+ blacklist: '' // 客户判断字段:1可追单,2黑名单
},
// 选择器相关
@@ -394,6 +409,8 @@
validOptions: ['全部', '有效', '无效'],
communicationIndex: 0,
communicationOptions: ['全部', '已沟通', '未沟通'],
+ blacklistIndex: 0,
+ blacklistOptions: ['全部', '可追单', '黑名单'],
//筛选条件
filteredData: {
page: 1, //当前页码
@@ -433,6 +450,8 @@
attendance_type: '', //到课类型
deal_type: '', //成交类型
valid_type: '', //资源有效类型
+ age: '', //年龄
+ blacklist: '', //客户判断:1可追单,2黑名单
},
//数据列表
tableList_1: [], //表格数据
@@ -448,6 +467,8 @@
phone_number: '', //客户资源表-手机号
name: '', //客户资源表-用户姓名
campus_name: '',
+ age: '', //年龄
+ blacklist: '', //客户判断:1可追单,2黑名单
},
//数据列表
tableList_2: [], //表格数据
@@ -511,6 +532,8 @@
},
//初始化
async init() {
+ // 确保选择器数据已初始化
+ this.initSelectorsData();
await this.getUserInfo();
await this.initDictData(); // 初始化字典数据
if (this.segmented_type == 1) {
@@ -519,6 +542,18 @@
await this.getList_2();
}
},
+
+ // 初始化选择器数据
+ initSelectorsData() {
+ // 确保blacklistIndex有效
+ if (this.blacklistIndex < 0 || this.blacklistIndex >= this.blacklistOptions.length) {
+ this.blacklistIndex = 0;
+ }
+ console.log('初始化选择器数据:', {
+ blacklistOptions: this.blacklistOptions,
+ blacklistIndex: this.blacklistIndex
+ });
+ },
// 初始化字典数据
async initDictData() {
@@ -746,6 +781,8 @@
this.filteredData_1.phone_number = '' //客户资源表-手机号
this.filteredData_1.name = '' //客户资源表-用户姓名
this.filteredData_1.campus_name = ''
+ this.filteredData_1.age = '' //年龄
+ this.filteredData_1.blacklist = '' //客户判断
//我的客户
//重置为第一页
@@ -756,6 +793,8 @@
this.filteredData_2.phone_number = '' //客户资源表-手机号
this.filteredData_2.name = '' //客户资源表-用户姓名
this.filteredData_2.campus_name = ''
+ this.filteredData_2.age = '' //年龄
+ this.filteredData_2.blacklist = '' //客户判断
//资源分配
//重置为第一页
await this.resetFilteredData_2()
@@ -1073,6 +1112,20 @@
currentFilterData.course_search = ''
}
+ // 处理年龄字段
+ if (this.searchForm.age) {
+ currentFilterData.age = this.searchForm.age
+ } else {
+ currentFilterData.age = ''
+ }
+
+ // 处理客户判断字段
+ if (this.searchForm.blacklist) {
+ currentFilterData.blacklist = this.searchForm.blacklist
+ } else {
+ currentFilterData.blacklist = ''
+ }
+
console.log('映射后的筛选数据:', currentFilterData)
// 根据当前标签页重置数据并获取列表
@@ -1137,6 +1190,24 @@
this.searchForm.communication_status = this.communicationOptions[this.communicationIndex]
},
+ // 客户判断选择器变化
+ onBlacklistChange(e) {
+ console.log('客户判断选择器变化:', e.detail.value)
+ console.log('当前blacklistOptions:', this.blacklistOptions)
+ this.blacklistIndex = e.detail.value
+ const selectedOption = this.blacklistOptions[this.blacklistIndex]
+ console.log('选中的选项:', selectedOption)
+ // 将中文选项转换为对应的数值:可追单->1,黑名单->2,全部->''
+ if (selectedOption === '可追单') {
+ this.searchForm.blacklist = '1'
+ } else if (selectedOption === '黑名单') {
+ this.searchForm.blacklist = '2'
+ } else {
+ this.searchForm.blacklist = ''
+ }
+ console.log('设置blacklist值为:', this.searchForm.blacklist)
+ },
+
// 重置搜索
async resetSearch() {
this.searchForm = {
@@ -1150,13 +1221,16 @@
deal_type: '',
valid_type: '',
communication_status: '',
- time_range: ''
+ time_range: '',
+ age: '', // 重置年龄字段
+ blacklist: '' // 重置客户判断字段
}
this.sourceIndex = 0
this.attendanceIndex = 0
this.dealIndex = 0
this.validIndex = 0
this.communicationIndex = 0
+ this.blacklistIndex = 0 // 重置客户判断选择器索引
// 重置当前标签页的筛选数据
if (this.segmented_type == 1) {