开始接待

This commit is contained in:
ZLI263
2025-11-28 10:11:10 +08:00
parent cca9a36276
commit 3b1202e2d8
2 changed files with 186 additions and 78 deletions

View File

@@ -426,7 +426,7 @@
import ServiceList from './components/ServiceList.vue';
import CustomerProfileModal from './components/CustomerProfileModal.vue';
import { initCustomerProfile, initSummaryList, initPerformanceData } from './utils/dataInit.js';
import { API_BASE_URL } from '@/common/config.js';
import { getApiUrl, API_BASE_URL } from '@/common/config.js';
export default {
// #ifdef APP
@@ -648,8 +648,8 @@
return;
}
// 统一使用完整URL
const url = `${API_BASE_URL}api/audioTextAnalysisFurniture/byParentId?parentId=${parentId}`;
// 统一使用 getApiUrl根据 env.js 配置自动切换环境
const url = `${getApiUrl('/api/audioTextAnalysisFurniture/byParentId')}?parentId=${parentId}`;
const res = await uni.request({
url: url,
@@ -1080,8 +1080,9 @@
.map(key => `${key}=${encodeURIComponent(queryParams[key])}`)
.join('&');
// 统一使用完整URL
const url = `${API_BASE_URL}api/todoItem/list?${queryString}`;
// 统一使用 getApiUrl根据 env.js 配置自动切换环境
const baseUrl = getApiUrl('/api/todoItem/list');
const url = queryString ? `${baseUrl}?${queryString}` : baseUrl;
const res = await uni.request({
url: url,
@@ -1218,8 +1219,8 @@
}
try {
// 统一使用完整URL
const url = `${API_BASE_URL}api/todoItem/updateTodoStatus`;
// 统一使用 getApiUrl根据 env.js 配置自动切换环境
const url = getApiUrl('/api/todoItem/updateTodoStatus');
const res = await uni.request({
url: url,
@@ -1269,14 +1270,8 @@
}
try {
// H5环境下使用代理路径其他环境使用完整URL
let url;
// #ifdef H5
url = `/api/todoItem/delayProcessTodo`;
// #endif
// #ifndef H5
url = `${API_BASE_URL}api/todoItem/delayProcessTodo`;
// #endif
// 统一使用 getApiUrl根据 env.js 配置自动切换环境
const url = getApiUrl('/api/todoItem/delayProcessTodo');
const res = await uni.request({
url: url,
@@ -1326,8 +1321,8 @@
return;
}
// 统一使用域名服务器地址
const url = `${API_BASE_URL}api/audioTextAnalysisFurniture/byParentId?parentId=${parentId}`;
// 统一使用 getApiUrl根据 env.js 配置自动切换环境
const url = `${getApiUrl('/api/audioTextAnalysisFurniture/byParentId')}?parentId=${parentId}`;
const res = await uni.request({
url: url,
@@ -1421,14 +1416,8 @@
return;
}
// H5环境下使用代理路径其他环境使用完整URL
let url;
// #ifdef H5
url = `/api/audioTextAnalysisSop/listByParentId?parentId=${parentId}`;
// #endif
// #ifndef H5
url = `${API_BASE_URL}api/audioTextAnalysisSop/listByParentId?parentId=${parentId}`;
// #endif
// 统一使用 getApiUrl根据 env.js 配置自动切换环境
const url = `${getApiUrl('/api/audioTextAnalysisSop/listByParentId')}?parentId=${parentId}`;
const res = await uni.request({
url: url,
@@ -1645,8 +1634,9 @@
.map(key => `${key}=${encodeURIComponent(queryParams[key])}`)
.join('&');
// 统一使用域名服务器地址
const url = `${API_BASE_URL}api/audioManagement/list?${queryString}`;
// 统一使用 getApiUrl根据 env.js 配置自动切换环境
const baseUrl = getApiUrl('/api/audioManagement/list');
const url = queryString ? `${baseUrl}?${queryString}` : baseUrl;
const res = await uni.request({
url: url,

View File

@@ -105,6 +105,12 @@
<!-- 开始接待表单 -->
<scroll-view class="reception-form" scroll-y v-if="activeTab === 'reception'">
<view class="form-card">
<view class="form-item">
<text class="form-item__label">服务次数</text>
<view class="form-item__text">
<text>{{ receptionForm.contactCount || 0 }}</text>
</view>
</view>
<view class="form-item">
<text class="form-item__label">客户姓名</text>
<input
@@ -118,27 +124,38 @@
<text class="form-item__label">客户电话</text>
<input
class="form-item__input"
v-model="receptionForm.contact"
v-model="receptionForm.contact"
@blur="onContactBlur"
type="number"
placeholder="请输入客户电话"
placeholder-style="color: #9ca3af"
/>
</view>
<view class="form-item">
<text class="form-item__label">客户来源</text>
<input
class="form-item__input"
v-model="receptionForm.customerSource"
placeholder="请输入客户来源"
placeholder-style="color: #9ca3af"
/>
</view>
<view class="form-item">
<text class="form-item__label">性别</text>
<picker
mode="selector"
:range="genderOptions"
:value="genderIndex"
@change="onGenderChange"
>
<view class="form-item__picker">
<text :class="receptionForm.gender ? 'form-item__picker-text' : 'form-item__picker-placeholder'">
{{ receptionForm.gender || '请选择性别' }}
</text>
<text class="form-item__picker-icon"></text>
</view>
</picker>
<radio-group
class="gender-radio-group"
@change="onGenderChange">
<label
class="gender-radio"
v-for="(option, index) in genderOptions"
:key="index">
<radio
:value="option"
:checked="receptionForm.gender === option"
color="#2563eb" />
<text class="gender-radio__text">{{ option }}</text>
</label>
</radio-group>
</view>
<view class="form-item">
<text class="form-item__label">年龄</text>
@@ -179,13 +196,16 @@
/>
</view>
</view>
<view class="form-actions">
<view class="form-actions form-actions--triple">
<view class="form-btn form-btn--cancel" @click="onCancel">
<text class="form-btn__text">取消</text>
</view>
<view class="form-btn form-btn--save" @click="onSave">
<view class="form-btn form-btn--save" @click="onSave('save')">
<text class="form-btn__text">保存</text>
</view>
<view class="form-btn form-btn--start" @click="onSave('start')">
<text class="form-btn__text">开始接待</text>
</view>
</view>
</scroll-view>
</view>
@@ -196,7 +216,7 @@
// #ifdef APP
import statusBar from "@/uni_modules/uni-nav-bar/components/uni-nav-bar/uni-status-bar";
// #endif
import { API_BASE_URL } from "@/common/config.js";
import { getApiUrl } from "@/common/config.js";
export default {
// #ifdef APP
@@ -208,15 +228,24 @@
return {
activeTab: 'status',
genderOptions: ["男", "女"],
genderIndex: -1,
isFetchingContact: false,
receptionForm: {
customerName: "",
contact: "",
gender: "",
customerSource: "",
gender: "女",
age: "",
dealershipId: "",
dealershipName: "",
salesId: "",
salesName: "",
salesPhone: "",
detailedAddress: ""
recordingCount: 0,
intendedModel: "",
infoCard: "",
remark: "",
detailedAddress: "",
contactCount: 0
},
serviceStatusList: [
{
@@ -268,27 +297,83 @@
console.log('查看服务详情', item);
},
onGenderChange(e) {
this.genderIndex = e.detail.value;
this.receptionForm.gender = this.genderOptions[e.detail.value];
this.receptionForm.gender = e.detail.value;
},
onContactBlur() {
this.fetchCustomerByContact();
},
async fetchCustomerByContact() {
const contact = this.receptionForm.contact?.trim();
if (!contact || this.isFetchingContact) {
return;
}
try {
this.isFetchingContact = true;
// 统一使用 getApiUrl根据 env.js 配置自动切换环境
const url = `${getApiUrl('/api/customerManagement/getByContact')}?contact=${encodeURIComponent(contact)}`;
const res = await uni.request({
url: url,
method: 'GET',
timeout: 8000
});
const list = res.data?.data;
if (res.statusCode === 200 && res.data?.success && Array.isArray(list) && list.length) {
const customer = list[0];
this.receptionForm = {
...this.receptionForm,
customerName: customer.customerName || this.receptionForm.customerName,
customerSource: customer.customerSource || this.receptionForm.customerSource,
dealershipId: customer.dealershipId || "",
dealershipName: customer.dealershipName || "",
salesId: customer.salesId || "",
salesName: customer.salesName || "",
salesPhone: customer.salesPhone || "",
recordingCount: customer.recordingCount ?? 0,
intendedModel: customer.intendedModel || "",
infoCard: customer.infoCard || "",
remark: customer.remark || "",
detailedAddress: customer.detailedAddress || "",
contactCount: customer.contactCount ?? 0
};
uni.showToast({
title: "已填充客户信息",
icon: "none"
});
}
// 未获取到数据时,不提示任何信息
} catch (error) {
// 查询失败时,也不提示任何信息
console.error("查询客户信息失败:", error);
} finally {
this.isFetchingContact = false;
}
},
onCancel() {
// 重置表单
this.receptionForm = {
customerName: "",
contact: "",
gender: "",
customerSource: "",
gender: "女",
age: "",
dealershipId: "",
dealershipName: "",
salesId: "",
salesName: "",
salesPhone: "",
detailedAddress: ""
recordingCount: 0,
intendedModel: "",
infoCard: "",
remark: "",
detailedAddress: "",
contactCount: 0
};
this.genderIndex = -1;
uni.showToast({
title: "已取消",
icon: "none"
});
},
async onSave() {
async onSave(action = 'save') {
// 表单验证
if (!this.receptionForm.customerName) {
uni.showToast({
@@ -307,21 +392,21 @@
// 构建请求参数
const params = {
customerName: this.receptionForm.customerName,
contact: this.receptionForm.contact,
dealershipId: "",
dealershipName: "",
salesId: "",
salesName: this.receptionForm.salesName || "",
recordingCount: 0,
intendedModel: "",
infoCard: "",
createTime: "",
updateTime: "",
remark: "",
detailedAddress: this.receptionForm.detailedAddress || "",
salesPhone: this.receptionForm.salesPhone || "",
contactCount: 0
customerName: this.receptionForm.customerName?.trim(),
contact: this.receptionForm.contact?.trim(),
customerSource: this.receptionForm.customerSource?.trim() || "",
dealershipId: this.receptionForm.dealershipId?.trim() || "",
dealershipName: this.receptionForm.dealershipName?.trim() || "",
salesId: this.receptionForm.salesId?.trim() || "",
salesName: this.receptionForm.salesName?.trim() || "",
recordingCount: Number(this.receptionForm.recordingCount) || 0,
intendedModel: this.receptionForm.intendedModel?.trim() || "",
infoCard: this.receptionForm.infoCard?.trim() || "",
remark: this.receptionForm.remark?.trim() || "",
detailedAddress: this.receptionForm.detailedAddress?.trim() || "",
salesPhone: this.receptionForm.salesPhone?.trim() || "",
contactCount: Number(this.receptionForm.contactCount) || 0,
operationType: action
};
try {
@@ -329,17 +414,8 @@
title: "保存中..."
});
// 构建URL
let url;
// #ifdef H5
url = `/api/customerManagement/add`;
// #endif
// #ifndef H5
url = `${API_BASE_URL}api/customerManagement/add`;
// #endif
const res = await uni.request({
url: url,
url: getApiUrl('/api/customerManagement/add'),
method: "POST",
data: params,
timeout: 10000
@@ -663,6 +739,24 @@
margin-bottom: 32rpx;
}
.gender-radio-group {
flex: 1;
display: flex;
gap: 32rpx;
flex-wrap: wrap;
}
.gender-radio {
display: flex;
align-items: center;
gap: 12rpx;
}
.gender-radio__text {
color: #374151;
font-size: 28rpx;
}
.form-item:last-child {
margin-bottom: 0;
}
@@ -686,6 +780,22 @@
box-sizing: border-box;
}
.form-item__text {
flex: 1;
height: 88rpx;
background-color: #f9fafb;
border-radius: 12rpx;
padding: 0 24rpx;
display: flex;
align-items: center;
box-sizing: border-box;
}
.form-item__text text {
font-size: 28rpx;
color: #333;
}
.form-item__picker {
flex: 1;
height: 88rpx;
@@ -719,6 +829,10 @@
padding-bottom: 40rpx;
}
.form-actions--triple {
gap: 16rpx;
}
.form-btn {
flex: 1;
height: 88rpx;
@@ -736,6 +850,10 @@
background-color: #007AFF;
}
.form-btn--start {
background-color: #10B981;
}
.form-btn__text {
font-size: 32rpx;
font-weight: 500;