|
|
|
@ -27,6 +27,21 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</fui-form-item> |
|
|
|
<!-- 来源渠道 --> |
|
|
|
<fui-form-item |
|
|
|
v-if="formData.source == 1" |
|
|
|
label="来源渠道" |
|
|
|
labelSize='26' |
|
|
|
prop="source_channel" |
|
|
|
background='#434544' |
|
|
|
labelColor='#fff' |
|
|
|
:bottomBorder='false'> |
|
|
|
<view class="input-title" style="margin-right:14rpx;"> |
|
|
|
<view class="input-title" style="margin-right:14rpx;" @click="openCicker('source_channel')"> |
|
|
|
{{ formData.source_channel ? picker_config.source_channel.text : '点击选择' }} |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</fui-form-item> |
|
|
|
<!-- 姓名 --> |
|
|
|
<fui-form-item label="姓名" labelSize='26' prop="name" background='#434544' labelColor='#fff' :bottomBorder='false'> |
|
|
|
<view class="input-title" style="margin-right:14rpx;"> |
|
|
|
@ -198,17 +213,17 @@ |
|
|
|
|
|
|
|
<fui-form-item label="是否报名" labelSize='26' prop="is_bm" background='#434544' labelColor='#fff' :bottomBorder='false'> |
|
|
|
<view class="input-title" style="margin-right:14rpx;"> |
|
|
|
<fui-radio-group name="radio" v-model="formData.is_bm" > |
|
|
|
<fui-radio-group name="radio" v-model="formData.is_bm" :disabled="true"> |
|
|
|
<view class="fui-list__item" style="display: flex;justify-content: flex-end;"> |
|
|
|
<fui-label> |
|
|
|
<view class="fui-align__center"> |
|
|
|
<fui-radio :value="1" checked></fui-radio> |
|
|
|
<fui-radio :value="1" :disabled="true"></fui-radio> |
|
|
|
<text class="fui-text">报名</text> |
|
|
|
</view> |
|
|
|
</fui-label> |
|
|
|
<fui-label :margin="['0','0','0','40rpx']"> |
|
|
|
<view class="fui-align__center"> |
|
|
|
<fui-radio :value="2"></fui-radio> |
|
|
|
<fui-radio :value="2" :disabled="true"></fui-radio> |
|
|
|
<text class="fui-text">未报名</text> |
|
|
|
</view> |
|
|
|
</fui-label> |
|
|
|
@ -463,18 +478,41 @@ |
|
|
|
methods: { |
|
|
|
//初始化 |
|
|
|
async init() { |
|
|
|
await this.getDict('source_channel') //获取字典-来源渠道 |
|
|
|
await this.getDict('source') //获取字典-来源 |
|
|
|
await this.getDict('purchasing_power') //获取字典-购买力 |
|
|
|
await this.getDict('initial_intent') //获取字典-客户初步意向度 |
|
|
|
await this.getDict('cognitive_idea') //获取字典-认知理念 |
|
|
|
await this.getDict('status') //获取字典-客户状态 |
|
|
|
await this.getDict('decision_maker') //获取字典-决策人 |
|
|
|
await this.getDict('distance') //获取字典-距离 |
|
|
|
// this.getStaffList()//获取人员列表 |
|
|
|
// this.getAreaTree()//获取地区树形结构 |
|
|
|
|
|
|
|
await this.getInfo() //获取资源共享-详情(客户资源详情) |
|
|
|
try { |
|
|
|
uni.showLoading({ |
|
|
|
title: '加载中...', |
|
|
|
mask: true |
|
|
|
}); |
|
|
|
|
|
|
|
// 先加载所有字典数据 |
|
|
|
const dictPromises = [ |
|
|
|
this.getDict('source_channel'), //获取字典-来源渠道 |
|
|
|
this.getDict('source'), //获取字典-来源 |
|
|
|
this.getDict('purchasing_power'), //获取字典-购买力 |
|
|
|
this.getDict('initial_intent'), //获取字典-客户初步意向度 |
|
|
|
this.getDict('cognitive_idea'), //获取字典-认知理念 |
|
|
|
this.getDict('status'), //获取字典-客户状态 |
|
|
|
this.getDict('decision_maker'), //获取字典-决策人 |
|
|
|
this.getDict('distance'), //获取字典-距离 |
|
|
|
]; |
|
|
|
|
|
|
|
await Promise.all(dictPromises); |
|
|
|
|
|
|
|
// 加载校区列表 |
|
|
|
await this.get_campus_list(); |
|
|
|
|
|
|
|
// 获取资源共享详情并回显数据 |
|
|
|
await this.getInfo(); |
|
|
|
|
|
|
|
} catch (error) { |
|
|
|
console.error('初始化失败:', error); |
|
|
|
uni.showToast({ |
|
|
|
title: '加载数据失败,请重试', |
|
|
|
icon: 'none' |
|
|
|
}); |
|
|
|
} finally { |
|
|
|
uni.hideLoading(); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
async get_campus_list(){ |
|
|
|
@ -538,6 +576,7 @@ |
|
|
|
decision_maker: customerResource.decision_maker || '', //决策人 |
|
|
|
initial_intent: customerResource.initial_intent || '', //客户初步意向度: high-高, medium-中, low-低 |
|
|
|
status: customerResource.status || '', //客户状态: active-活跃, inactive-不活跃, pending-待定 |
|
|
|
campus: customerResource.campus || '', // 校区 |
|
|
|
|
|
|
|
//六要素信息 |
|
|
|
purchasing_power: sixSpeed.purchase_power || '', //购买力 |
|
|
|
@ -554,24 +593,72 @@ |
|
|
|
|
|
|
|
this.formData.promised_visit_time = this.$util.formatToDateTime(sixSpeed.promised_visit_time, |
|
|
|
'Y-m-d'); //格式化时间(Y-m-d H:i) |
|
|
|
this.formData.optional_class_time = this.$util.formatToDateTime(sixSpeed.promised_visit_time, |
|
|
|
this.formData.optional_class_time = this.$util.formatToDateTime(sixSpeed.preferred_class_time, |
|
|
|
'Y-m-d'); //格式化时间(Y-m-d H:i) |
|
|
|
|
|
|
|
//下拉窗文本回显 |
|
|
|
this.picker_config.source_channel.text = customerResource.source_channel_name || '点击选择' //来源渠道 |
|
|
|
this.picker_config.source.text = customerResource.source_name || '点击选择' //来源 |
|
|
|
this.picker_config.consultant.text = customerResource.consultant_name || '点击选择' //顾问 |
|
|
|
this.picker_config.initial_intent.text = customerResource.initial_intent_name || '点击选择' //客户初步意向度 |
|
|
|
this.picker_config.status.text = customerResource.status_name || '点击选择' //客户状态 |
|
|
|
// 获取校区列表,确保校区选择器数据已加载 |
|
|
|
await this.get_campus_list() |
|
|
|
|
|
|
|
// 等待所有字典数据加载完成后再进行回显 |
|
|
|
await this.setPickerText() |
|
|
|
}, |
|
|
|
|
|
|
|
// 设置选择器文本回显 |
|
|
|
async setPickerText() { |
|
|
|
const { customerResource = {}, sixSpeed = {} } = await this.getResourceDetail() || {} |
|
|
|
|
|
|
|
this.picker_config.decision_maker.text = customerResource.decision_maker || '点击选择' //决策人 |
|
|
|
// 设置选择器文本回显 |
|
|
|
this.setPickerTextByValue('source_channel', this.formData.source_channel, customerResource.source_channel_name) |
|
|
|
this.setPickerTextByValue('source', this.formData.source, customerResource.source_name) |
|
|
|
this.setPickerTextByValue('consultant', this.formData.consultant, customerResource.consultant_name) |
|
|
|
this.setPickerTextByValue('initial_intent', this.formData.initial_intent, customerResource.initial_intent_name) |
|
|
|
this.setPickerTextByValue('status', this.formData.status, customerResource.status_name) |
|
|
|
this.setPickerTextByValue('decision_maker', this.formData.decision_maker, customerResource.decision_maker_name || customerResource.decision_maker) |
|
|
|
this.setPickerTextByValue('campus', this.formData.campus, customerResource.campus_name) |
|
|
|
|
|
|
|
// 六要素相关 |
|
|
|
this.picker_config.purchasing_power.text = sixSpeed.purchase_power_name || '点击选择' //购买力 |
|
|
|
this.picker_config.cognitive_idea.text = sixSpeed.concept_awareness_name || '点击选择' //认知理念 |
|
|
|
this.picker_config.distance.text = sixSpeed.distance || '点击选择' //距离 |
|
|
|
this.setPickerTextByValue('purchasing_power', this.formData.purchasing_power, sixSpeed.purchase_power_name) |
|
|
|
this.setPickerTextByValue('cognitive_idea', this.formData.cognitive_idea, sixSpeed.concept_awareness_name) |
|
|
|
this.setPickerTextByValue('distance', this.formData.distance, sixSpeed.distance_name || sixSpeed.distance) |
|
|
|
}, |
|
|
|
|
|
|
|
await this.get_campus_list()//获取校区 |
|
|
|
// 根据值设置选择器文本 |
|
|
|
setPickerTextByValue(pickerName, value, defaultText) { |
|
|
|
if (!value) { |
|
|
|
this.picker_config[pickerName].text = '点击选择' |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
// 先尝试从选项中找到匹配的文本 |
|
|
|
const options = this.picker_config[pickerName].options || [] |
|
|
|
const option = options.find(opt => opt.value == value) |
|
|
|
|
|
|
|
if (option) { |
|
|
|
this.picker_config[pickerName].text = option.text |
|
|
|
} else if (defaultText) { |
|
|
|
// 如果找不到匹配的选项但有默认文本,则使用默认文本 |
|
|
|
this.picker_config[pickerName].text = defaultText |
|
|
|
} else { |
|
|
|
this.picker_config[pickerName].text = '点击选择' |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
// 获取资源详情(缓存数据,避免重复请求) |
|
|
|
async getResourceDetail() { |
|
|
|
if (this._resourceDetail) { |
|
|
|
return this._resourceDetail |
|
|
|
} |
|
|
|
|
|
|
|
let params = { |
|
|
|
resource_sharing_id: this.resource_sharing_id |
|
|
|
} |
|
|
|
|
|
|
|
let res = await apiRoute.xs_resourceSharingInfo(params) |
|
|
|
if (res.code == 1) { |
|
|
|
this._resourceDetail = res.data |
|
|
|
return res.data |
|
|
|
} |
|
|
|
return null |
|
|
|
}, |
|
|
|
|
|
|
|
//获取字典-课程id选择 |
|
|
|
@ -705,25 +792,17 @@ |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let res = await apiRoute.common_Dictionary({ |
|
|
|
key: key |
|
|
|
}) |
|
|
|
if (res.code != 1) { |
|
|
|
uni.showToast({ |
|
|
|
title: res.msg, |
|
|
|
icon: 'none' |
|
|
|
}) |
|
|
|
// 使用 util.getDict 获取并缓存字典 |
|
|
|
let dictionary = await this.$util.getDict(key) |
|
|
|
if(!dictionary || !Array.isArray(dictionary) || dictionary.length === 0){ |
|
|
|
uni.showToast({ title: '暂无选项', icon: 'none' }) |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
let dictionary = res.data.dictionary |
|
|
|
let arr = [] |
|
|
|
dictionary.forEach((v, k) => { |
|
|
|
arr.push({ |
|
|
|
text: v.name, |
|
|
|
value: v.value, |
|
|
|
}) |
|
|
|
// 处理接口返回的数据结构 [{name: "抖音", value: "1", sort: 0, memo: ""}, ...] |
|
|
|
dictionary.forEach((v) => { |
|
|
|
arr.push({ text: v.name, value: v.value }) |
|
|
|
}) |
|
|
|
|
|
|
|
if (inputName == 'source_channel') { |
|
|
|
@ -733,10 +812,6 @@ |
|
|
|
value: '0', |
|
|
|
}) |
|
|
|
} |
|
|
|
if (inputName == 'status') { |
|
|
|
//插入到arr的头部 |
|
|
|
console.log(arr) |
|
|
|
} |
|
|
|
|
|
|
|
this.picker_config[inputName].options = arr |
|
|
|
}, |
|
|
|
@ -971,15 +1046,26 @@ |
|
|
|
changeCicker(e) { |
|
|
|
console.log('监听-下拉选择器', this.picker_input_name, e) |
|
|
|
let input_name = this.picker_input_name |
|
|
|
|
|
|
|
// 更新表单数据 |
|
|
|
this.formData[input_name] = e.value |
|
|
|
this.picker_config[input_name]['text'] = e.text |
|
|
|
|
|
|
|
// 更新选择器文本 |
|
|
|
this.picker_config[input_name].text = e.text |
|
|
|
|
|
|
|
// 特殊处理:来源选择 |
|
|
|
if (input_name == 'source') { |
|
|
|
if (e.value != 1) { |
|
|
|
this.formData.source_channel = '0' //0=线下 |
|
|
|
if (e.value == 1) { |
|
|
|
// 如果选择了线上,则清空来源渠道,等待用户选择 |
|
|
|
this.formData.source_channel = '' |
|
|
|
this.picker_config.source_channel.text = '点击选择' |
|
|
|
} else { |
|
|
|
this.formData.source_channel = '' //线下 |
|
|
|
// 如果选择了其他来源,则设置来源渠道为线下 |
|
|
|
this.formData.source_channel = '0' //0=线下 |
|
|
|
this.picker_config.source_channel.text = '线下' |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
this.cancelCicker() |
|
|
|
}, |
|
|
|
//关闭下拉选择器 |
|
|
|
|