开始接待

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

View File

@@ -105,6 +105,12 @@
<!-- 开始接待表单 --> <!-- 开始接待表单 -->
<scroll-view class="reception-form" scroll-y v-if="activeTab === 'reception'"> <scroll-view class="reception-form" scroll-y v-if="activeTab === 'reception'">
<view class="form-card"> <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"> <view class="form-item">
<text class="form-item__label">客户姓名</text> <text class="form-item__label">客户姓名</text>
<input <input
@@ -118,27 +124,38 @@
<text class="form-item__label">客户电话</text> <text class="form-item__label">客户电话</text>
<input <input
class="form-item__input" class="form-item__input"
v-model="receptionForm.contact" v-model="receptionForm.contact"
@blur="onContactBlur"
type="number" type="number"
placeholder="请输入客户电话" placeholder="请输入客户电话"
placeholder-style="color: #9ca3af" placeholder-style="color: #9ca3af"
/> />
</view> </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"> <view class="form-item">
<text class="form-item__label">性别</text> <text class="form-item__label">性别</text>
<picker <radio-group
mode="selector" class="gender-radio-group"
:range="genderOptions" @change="onGenderChange">
:value="genderIndex" <label
@change="onGenderChange" class="gender-radio"
> v-for="(option, index) in genderOptions"
<view class="form-item__picker"> :key="index">
<text :class="receptionForm.gender ? 'form-item__picker-text' : 'form-item__picker-placeholder'"> <radio
{{ receptionForm.gender || '请选择性别' }} :value="option"
</text> :checked="receptionForm.gender === option"
<text class="form-item__picker-icon"></text> color="#2563eb" />
</view> <text class="gender-radio__text">{{ option }}</text>
</picker> </label>
</radio-group>
</view> </view>
<view class="form-item"> <view class="form-item">
<text class="form-item__label">年龄</text> <text class="form-item__label">年龄</text>
@@ -179,13 +196,16 @@
/> />
</view> </view>
</view> </view>
<view class="form-actions"> <view class="form-actions form-actions--triple">
<view class="form-btn form-btn--cancel" @click="onCancel"> <view class="form-btn form-btn--cancel" @click="onCancel">
<text class="form-btn__text">取消</text> <text class="form-btn__text">取消</text>
</view> </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> <text class="form-btn__text">保存</text>
</view> </view>
<view class="form-btn form-btn--start" @click="onSave('start')">
<text class="form-btn__text">开始接待</text>
</view>
</view> </view>
</scroll-view> </scroll-view>
</view> </view>
@@ -196,7 +216,7 @@
// #ifdef APP // #ifdef APP
import statusBar from "@/uni_modules/uni-nav-bar/components/uni-nav-bar/uni-status-bar"; import statusBar from "@/uni_modules/uni-nav-bar/components/uni-nav-bar/uni-status-bar";
// #endif // #endif
import { API_BASE_URL } from "@/common/config.js"; import { getApiUrl } from "@/common/config.js";
export default { export default {
// #ifdef APP // #ifdef APP
@@ -208,15 +228,24 @@
return { return {
activeTab: 'status', activeTab: 'status',
genderOptions: ["男", "女"], genderOptions: ["男", "女"],
genderIndex: -1, isFetchingContact: false,
receptionForm: { receptionForm: {
customerName: "", customerName: "",
contact: "", contact: "",
gender: "", customerSource: "",
gender: "女",
age: "", age: "",
dealershipId: "",
dealershipName: "",
salesId: "",
salesName: "", salesName: "",
salesPhone: "", salesPhone: "",
detailedAddress: "" recordingCount: 0,
intendedModel: "",
infoCard: "",
remark: "",
detailedAddress: "",
contactCount: 0
}, },
serviceStatusList: [ serviceStatusList: [
{ {
@@ -268,27 +297,83 @@
console.log('查看服务详情', item); console.log('查看服务详情', item);
}, },
onGenderChange(e) { onGenderChange(e) {
this.genderIndex = e.detail.value; this.receptionForm.gender = e.detail.value;
this.receptionForm.gender = this.genderOptions[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() { onCancel() {
// 重置表单 // 重置表单
this.receptionForm = { this.receptionForm = {
customerName: "", customerName: "",
contact: "", contact: "",
gender: "", customerSource: "",
gender: "女",
age: "", age: "",
dealershipId: "",
dealershipName: "",
salesId: "",
salesName: "", salesName: "",
salesPhone: "", salesPhone: "",
detailedAddress: "" recordingCount: 0,
intendedModel: "",
infoCard: "",
remark: "",
detailedAddress: "",
contactCount: 0
}; };
this.genderIndex = -1;
uni.showToast({ uni.showToast({
title: "已取消", title: "已取消",
icon: "none" icon: "none"
}); });
}, },
async onSave() { async onSave(action = 'save') {
// 表单验证 // 表单验证
if (!this.receptionForm.customerName) { if (!this.receptionForm.customerName) {
uni.showToast({ uni.showToast({
@@ -307,21 +392,21 @@
// 构建请求参数 // 构建请求参数
const params = { const params = {
customerName: this.receptionForm.customerName, customerName: this.receptionForm.customerName?.trim(),
contact: this.receptionForm.contact, contact: this.receptionForm.contact?.trim(),
dealershipId: "", customerSource: this.receptionForm.customerSource?.trim() || "",
dealershipName: "", dealershipId: this.receptionForm.dealershipId?.trim() || "",
salesId: "", dealershipName: this.receptionForm.dealershipName?.trim() || "",
salesName: this.receptionForm.salesName || "", salesId: this.receptionForm.salesId?.trim() || "",
recordingCount: 0, salesName: this.receptionForm.salesName?.trim() || "",
intendedModel: "", recordingCount: Number(this.receptionForm.recordingCount) || 0,
infoCard: "", intendedModel: this.receptionForm.intendedModel?.trim() || "",
createTime: "", infoCard: this.receptionForm.infoCard?.trim() || "",
updateTime: "", remark: this.receptionForm.remark?.trim() || "",
remark: "", detailedAddress: this.receptionForm.detailedAddress?.trim() || "",
detailedAddress: this.receptionForm.detailedAddress || "", salesPhone: this.receptionForm.salesPhone?.trim() || "",
salesPhone: this.receptionForm.salesPhone || "", contactCount: Number(this.receptionForm.contactCount) || 0,
contactCount: 0 operationType: action
}; };
try { try {
@@ -329,17 +414,8 @@
title: "保存中..." 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({ const res = await uni.request({
url: url, url: getApiUrl('/api/customerManagement/add'),
method: "POST", method: "POST",
data: params, data: params,
timeout: 10000 timeout: 10000
@@ -663,6 +739,24 @@
margin-bottom: 32rpx; 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 { .form-item:last-child {
margin-bottom: 0; margin-bottom: 0;
} }
@@ -686,6 +780,22 @@
box-sizing: border-box; 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 { .form-item__picker {
flex: 1; flex: 1;
height: 88rpx; height: 88rpx;
@@ -719,6 +829,10 @@
padding-bottom: 40rpx; padding-bottom: 40rpx;
} }
.form-actions--triple {
gap: 16rpx;
}
.form-btn { .form-btn {
flex: 1; flex: 1;
height: 88rpx; height: 88rpx;
@@ -736,6 +850,10 @@
background-color: #007AFF; background-color: #007AFF;
} }
.form-btn--start {
background-color: #10B981;
}
.form-btn__text { .form-btn__text {
font-size: 32rpx; font-size: 32rpx;
font-weight: 500; font-weight: 500;