From 69f6cf78ac6bd43223c318ec82bf57e88461609d Mon Sep 17 00:00:00 2001 From: "zhonghua.li" Date: Sun, 3 May 2026 10:26:52 +0800 Subject: [PATCH] =?UTF-8?q?=E9=AB=98=E5=BE=B7=E5=95=86=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/customer.js | 20 ++++ src/utils/request.js | 5 + src/views/customer/index.vue | 203 ++++++++++++++++++++++++++++++++--- 3 files changed, 212 insertions(+), 16 deletions(-) diff --git a/src/api/customer.js b/src/api/customer.js index 2836709..caba41e 100644 --- a/src/api/customer.js +++ b/src/api/customer.js @@ -150,6 +150,26 @@ export function exportCustomerFlow(params) { }) } +/** + * 高德周边商家检索(地理编码 + place/around) + * @param {{ CITY: string, ADDRESS: string, RADIUS: number, MAX_PAGE: number, maxRecordsOfpage: number }} params + */ +export function searchNearbyMerchants(params) { + return request({ + url: '/customerManagement/searchNearbyMerchants', + method: 'get', + params: { + CITY: params.CITY, + ADDRESS: params.ADDRESS, + RADIUS: params.RADIUS, + MAX_PAGE: params.MAX_PAGE, + maxRecordsOfpage: params.maxRecordsOfpage + }, + timeout: 120000, + skipResponseNormalize: true + }) +} + // 沟通记录相关API // 分页查询沟通记录 export function getCommunicationRecordPage(params) { diff --git a/src/utils/request.js b/src/utils/request.js index 800525d..4765480 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -97,6 +97,11 @@ service.interceptors.response.use( return response.data } + /** 直接返回后端 JSON(如 Spring ResponseEntity),不走 success/code 包装逻辑 */ + if (response.config && response.config.skipResponseNormalize === true) { + return response.data + } + const loginHeaderValues = { 'X-Role-Name': pickValueFromSources( [response.headers, response.data?.data, response.data], diff --git a/src/views/customer/index.vue b/src/views/customer/index.vue index ca25af3..f31e0d5 100644 --- a/src/views/customer/index.vue +++ b/src/views/customer/index.vue @@ -70,23 +70,17 @@ 添加客户 + 导出客流 批量删除 + 高德商户
- -
- 导出客流 -
-
- -
- 导出客流 -
-
+ +
@@ -548,6 +542,76 @@ + + + + + + + + + + + + + + + + + + + +
+ +
{{ nearbySearchResult.message || '—' }}
+
+ 总数:{{ nearbySearchResult.totalCount }} + 中心点:{{ formatGaodeCenter(nearbySearchResult.centerLocation) }} +
+
+ + + +
+ +
+ { + if (this.$refs.gaodeNearbyFormRef) { + this.$refs.gaodeNearbyFormRef.clearValidate() + } + }) + }, + onGaodeMerchantDialogClose() { + this.nearbySearchResult = null + this.gaodeNearbyLoading = false + }, + formatGaodeCenter(loc) { + if (loc == null) return '' + if (typeof loc === 'string') return loc + try { + return JSON.stringify(loc) + } catch (e) { + return String(loc) + } + }, + submitGaodeNearbySearch() { + this.$refs.gaodeNearbyFormRef.validate(valid => { + if (!valid) return + const { CITY, ADDRESS, RADIUS, MAX_PAGE, maxRecordsOfpage } = this.gaodeNearbyForm + this.gaodeNearbyLoading = true + searchNearbyMerchants({ + CITY: String(CITY).trim(), + ADDRESS: String(ADDRESS).trim(), + RADIUS: Number(RADIUS), + MAX_PAGE: Number(MAX_PAGE), + maxRecordsOfpage: Number(maxRecordsOfpage) + }).then(res => { + this.nearbySearchResult = res && typeof res === 'object' ? res : { success: false, message: '响应格式异常' } + if (this.nearbySearchResult.success) { + this.$message.success(this.nearbySearchResult.message || '检索成功') + } else { + this.$message.error(this.nearbySearchResult.message || '检索失败') + } + }).catch(err => { + const rd = err && err.response && err.response.data + if (rd && typeof rd === 'object' && ('success' in rd || 'message' in rd)) { + this.nearbySearchResult = rd + } else { + this.nearbySearchResult = { success: false, message: (err && err.message) || '请求失败' } + } + }).finally(() => { + this.gaodeNearbyLoading = false + }) + }) + }, // 获取列表数据 getList() { this.loading = true @@ -1237,10 +1387,6 @@ export default { margin-bottom: 20px; } -.action-buttons { - margin-top: 10px; -} - .customer-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); @@ -1395,4 +1541,29 @@ export default { color: #909399; font-size: 14px; } + +.gaode-nearby-result { + margin-top: 8px; +} + +.gaode-nearby-meta { + margin-top: 8px; + font-size: 13px; + color: #606266; +} + +.gaode-nearby-meta span { + margin-right: 16px; +} + +/* 高德商户弹窗:label 单行不换行,控件区宽度为原先的 70% */ +.gaode-nearby-form ::v-deep .el-form-item__label { + white-space: nowrap; +} + +.gaode-nearby-form ::v-deep .el-form-item__content > .el-input, +.gaode-nearby-form ::v-deep .el-form-item__content > .el-input-number { + width: 70%; + max-width: 100%; +}