diff --git a/pages/customer/customer.vue b/pages/customer/customer.vue index 4042cbb..bad2bcd 100644 --- a/pages/customer/customer.vue +++ b/pages/customer/customer.vue @@ -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, diff --git a/pages/reception/reception.vue b/pages/reception/reception.vue index f3856f7..7e308da 100644 --- a/pages/reception/reception.vue +++ b/pages/reception/reception.vue @@ -105,6 +105,12 @@ + + 服务次数 + + {{ receptionForm.contactCount || 0 }} + + 客户姓名 客户电话 + + 客户来源 + + 性别 - - - - {{ receptionForm.gender || '请选择性别' }} - - - - + + + 年龄 @@ -179,13 +196,16 @@ /> - + 取消 - + 保存 + + 开始接待 + @@ -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;