"use strict"; const common_vendor = require("../../common/vendor.js"); const common_config = require("../../common/config.js"); const _sfc_main = { data() { const systemInfo = common_vendor.index.getSystemInfoSync(); const statusBarHeight = systemInfo.statusBarHeight || 20; const navbarHeight = 44; const statusBarHeightRpx = statusBarHeight * 2; const navbarHeightRpx = navbarHeight * 2; const totalNavbarHeight = statusBarHeightRpx + navbarHeightRpx; common_vendor.index.__f__("log", "at pages-subpackage/reception/reception.vue:477", "[Reception][data] 导航栏高度计算:", { statusBarHeight, navbarHeight, statusBarHeightRpx, navbarHeightRpx, totalNavbarHeight }); return { activeTab: "status", navbarTop: totalNavbarHeight + "rpx", // tab栏距离顶部的距离 contentTop: totalNavbarHeight + 72 + "rpx", // 内容区域距离顶部的距离(tab栏高度72rpx) genderOptions: ["男", "女"], isFetchingContact: false, serviceStatusLoading: false, serviceStatusTotal: 0, serviceStatusPage: { current: 1, size: 10 }, serviceStatusQuery: { salesName: "", customerName: "" }, receptionForm: { id: "", customerName: "", contact: "", customerSource: "", gender: "女", age: "", dealershipId: "", dealershipName: "", salesId: "", salesName: "", salesPhone: "", recordingCount: 0, intendedModel: "", infoCard: "", remark: "", detailedAddress: "", contactCount: 0 }, serviceStatusList: [], // 标签管理 tagViewMode: "list", // 'list' 或 'add' 或 'edit' tagList: [], tagLoading: false, tagTotal: 0, tagPage: { current: 1, size: 10 }, tagQuery: { industry: "", tagType: "", tagName: "" }, tagForm: { id: "", industry: "家居行业", tagType: "", name: "", detail: "", remark: "", enabled: true }, tagTypeOptions: ["接待客户", "质检SOP", "客户画像"], showTagTypeDropdown: false, selectedTagItem: null, showTagActionMenu: false }; }, onLoad() { common_vendor.index.__f__("log", "at pages-subpackage/reception/reception.vue:551", "[Reception][onLoad] 页面加载"); this.updateNavbarPosition(); this.fetchServiceStatusList(); this.loadCurrentUserInfo(); }, onShow() { common_vendor.index.__f__("log", "at pages-subpackage/reception/reception.vue:559", "[Reception][onShow] 页面显示"); this.$nextTick(() => { this.updateNavbarPosition(); setTimeout(() => { this.updateNavbarPosition(); common_vendor.index.__f__("log", "at pages-subpackage/reception/reception.vue:567", "[Reception][onShow] 延迟更新后的位置:", { navbarTop: this.navbarTop, contentTop: this.contentTop, computedNavbarTop: this.computedNavbarTop, computedContentTop: this.computedContentTop }); }, 50); }); }, onReady() { common_vendor.index.__f__("log", "at pages-subpackage/reception/reception.vue:578", "[Reception][onReady] 页面渲染完成"); common_vendor.index.__f__("log", "at pages-subpackage/reception/reception.vue:579", "[Reception][onReady] activeTab:", this.activeTab); common_vendor.index.__f__("log", "at pages-subpackage/reception/reception.vue:580", "[Reception][onReady] navbarTop:", this.navbarTop); common_vendor.index.__f__("log", "at pages-subpackage/reception/reception.vue:581", "[Reception][onReady] contentTop:", this.contentTop); common_vendor.index.__f__("log", "at pages-subpackage/reception/reception.vue:582", "[Reception][onReady] computedNavbarTop:", this.computedNavbarTop); common_vendor.index.__f__("log", "at pages-subpackage/reception/reception.vue:583", "[Reception][onReady] computedContentTop:", this.computedContentTop); this.updateNavbarPosition(); const systemInfo = common_vendor.index.getSystemInfoSync(); common_vendor.index.__f__("log", "at pages-subpackage/reception/reception.vue:589", "[Reception][onReady] 系统信息:", { statusBarHeight: systemInfo.statusBarHeight, windowHeight: systemInfo.windowHeight, screenHeight: systemInfo.screenHeight }); setTimeout(() => { const query = common_vendor.index.createSelectorQuery().in(this); query.select(".tabs").boundingClientRect((data) => { common_vendor.index.__f__("log", "at pages-subpackage/reception/reception.vue:600", "[Reception][onReady] tab栏元素信息:", data); if (!data) { common_vendor.index.__f__("error", "at pages-subpackage/reception/reception.vue:602", "[Reception][onReady] tab栏元素未找到!"); this.updateNavbarPosition(); this.$forceUpdate(); } else { common_vendor.index.__f__("log", "at pages-subpackage/reception/reception.vue:607", "[Reception][onReady] tab栏位置:", { top: data.top, left: data.left, width: data.width, height: data.height, expectedTop: this.navbarTop, expectedComputedTop: this.computedNavbarTop, isVisible: data.width > 0 && data.height > 0, isOnScreen: data.top >= 0 && data.top < systemInfo.windowHeight }); if (data.width === 0 || data.height === 0 || data.top < 0) { common_vendor.index.__f__("warn", "at pages-subpackage/reception/reception.vue:620", "[Reception][onReady] tab栏不可见,强制更新位置"); this.updateNavbarPosition(); this.$forceUpdate(); setTimeout(() => { const retryQuery = common_vendor.index.createSelectorQuery().in(this); retryQuery.select(".tabs").boundingClientRect((retryData) => { if (retryData && (retryData.width === 0 || retryData.height === 0)) { common_vendor.index.__f__("error", "at pages-subpackage/reception/reception.vue:628", "[Reception][onReady] tab栏仍然不可见,可能需要检查样式"); } }).exec(); }, 100); } } }).exec(); }, 100); }, computed: { // 计算导航栏和内容区域的位置(使用计算属性确保响应式) computedNavbarTop() { const systemInfo = common_vendor.index.getSystemInfoSync(); const statusBarHeight = systemInfo.statusBarHeight || 20; const navbarHeight = 44; const statusBarHeightRpx = statusBarHeight * 2; const navbarHeightRpx = navbarHeight * 2; const totalNavbarHeight = statusBarHeightRpx + navbarHeightRpx; return totalNavbarHeight + "rpx"; }, computedContentTop() { const systemInfo = common_vendor.index.getSystemInfoSync(); const statusBarHeight = systemInfo.statusBarHeight || 20; const navbarHeight = 44; const statusBarHeightRpx = statusBarHeight * 2; const navbarHeightRpx = navbarHeight * 2; const totalNavbarHeight = statusBarHeightRpx + navbarHeightRpx; return totalNavbarHeight + 72 + "rpx"; } }, methods: { // 计算并更新导航栏和内容区域的位置 updateNavbarPosition() { const systemInfo = common_vendor.index.getSystemInfoSync(); const statusBarHeight = systemInfo.statusBarHeight || 20; const navbarHeight = 44; const statusBarHeightRpx = statusBarHeight * 2; const navbarHeightRpx = navbarHeight * 2; const totalNavbarHeight = statusBarHeightRpx + navbarHeightRpx; const navbarTop = totalNavbarHeight + "rpx"; const contentTop = totalNavbarHeight + 72 + "rpx"; common_vendor.index.__f__("log", "at pages-subpackage/reception/reception.vue:673", "[Reception][updateNavbarPosition] 更新导航栏位置:", { statusBarHeight, navbarHeight, totalNavbarHeight, navbarTop, contentTop, currentNavbarTop: this.navbarTop, currentContentTop: this.contentTop }); this.$set(this, "navbarTop", navbarTop); this.$set(this, "contentTop", contentTop); this.$forceUpdate(); }, /** * 加载当前登录用户信息,填充销售姓名和电话 */ loadCurrentUserInfo() { try { const loginResponse = common_vendor.index.getStorageSync("backend-login-response") || {}; if (loginResponse.userName) { this.receptionForm.salesName = loginResponse.userName; } if (loginResponse.phone) { this.receptionForm.salesPhone = loginResponse.phone; } else if (loginResponse.userName) { this.receptionForm.salesPhone = loginResponse.userName; } if (loginResponse.userId) { this.receptionForm.salesId = String(loginResponse.userId); } } catch (e) { common_vendor.index.__f__("error", "at pages-subpackage/reception/reception.vue:718", "加载当前登录用户信息失败:", e); } }, goBack() { const pages = getCurrentPages(); if (pages.length <= 1) { common_vendor.index.__f__("log", "at pages-subpackage/reception/reception.vue:727", "[Reception][goBack] 当前是第一个页面,无法返回"); return; } common_vendor.index.navigateBack({ fail: (err) => { common_vendor.index.__f__("error", "at pages-subpackage/reception/reception.vue:732", "[Reception][goBack] 返回失败:", err); } }); }, switchTab(tab) { this.activeTab = tab; if (tab === "status") { this.fetchServiceStatusList(); } else if (tab === "reception") { this.loadCurrentUserInfo(); } else if (tab === "tag") { this.tagViewMode = "list"; this.fetchTagList(); } }, onServiceStatusSearch() { if (this.activeTab !== "status") { this.activeTab = "status"; } this.serviceStatusPage.current = 1; this.fetchServiceStatusList({ force: true }); }, onServiceStatusRefresh() { this.serviceStatusPage.current = 1; this.fetchServiceStatusList({ force: true }); }, onServiceStatusReachBottom() { if (this.serviceStatusLoading) return; if (this.serviceStatusList.length >= this.serviceStatusTotal) return; this.serviceStatusPage.current += 1; this.fetchServiceStatusList(); }, async fetchServiceStatusList({ force = false } = {}) { var _a, _b, _c, _d, _e; if (this.serviceStatusLoading && !force) { return; } this.serviceStatusLoading = true; try { const queryParams = { current: this.serviceStatusPage.current, size: this.serviceStatusPage.size, serviceStatus: "服务中" // 默认搜索条件 }; const trimmedSalesName = (_b = (_a = this.serviceStatusQuery) == null ? void 0 : _a.salesName) == null ? void 0 : _b.trim(); const trimmedCustomerName = (_d = (_c = this.serviceStatusQuery) == null ? void 0 : _c.customerName) == null ? void 0 : _d.trim(); if (trimmedSalesName) { queryParams.salesName = trimmedSalesName; } if (trimmedCustomerName) { queryParams.customerName = trimmedCustomerName; } queryParams.serviceStatus = "服务中"; const queryString = Object.keys(queryParams).filter((key) => queryParams[key] !== null && queryParams[key] !== void 0 && queryParams[key] !== "").map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(queryParams[key])}`).join("&"); common_vendor.index.__f__("log", "at pages-subpackage/reception/reception.vue:799", "服务状态查询参数:", JSON.stringify(queryParams)); common_vendor.index.__f__("log", "at pages-subpackage/reception/reception.vue:800", "查询字符串:", queryString); const baseUrl = common_config.getApiUrl("/api/audioManagement/list"); const url = queryString ? `${baseUrl}?${queryString}` : baseUrl; let tenantId = ""; let token = ""; try { tenantId = common_vendor.index.getStorageSync("backend-tenant-id") || ""; token = common_vendor.index.getStorageSync("backend-token") || ""; } catch (e) { common_vendor.index.__f__("error", "at pages-subpackage/reception/reception.vue:813", "获取认证信息失败:", e); } const headers = { "Content-Type": "application/json" }; if (token) { headers["Authorization"] = `Bearer ${token}`; } if (tenantId) { headers["X-Tenant-Id"] = tenantId; } const res = await common_vendor.index.request({ url, method: "POST", data: {}, // POST 请求体为空,参数都在 URL 查询字符串中 header: headers, timeout: 3e4 // 增加超时时间到30秒 }); if (res.statusCode === 200 && res.data && res.data.success) { const records = Array.isArray(res.data.data) ? res.data.data : []; if (records.length === 0) { this.serviceStatusList = []; this.serviceStatusTotal = 0; return; } const mapped = records.map((item) => this.buildServiceStatusItem(item)).filter((item) => item !== null); if (this.serviceStatusPage.current === 1 || force) { this.serviceStatusList = [...mapped]; } else { this.serviceStatusList = [...this.serviceStatusList, ...mapped]; } this.serviceStatusTotal = Number(res.data.total) || 0; } else { this.serviceStatusList = []; this.serviceStatusTotal = 0; common_vendor.index.showToast({ title: ((_e = res.data) == null ? void 0 : _e.message) || "获取服务中列表失败", icon: "none" }); } } catch (error) { common_vendor.index.__f__("error", "at pages-subpackage/reception/reception.vue:865", "获取服务中列表失败:", error); let errorMessage = "获取服务状态失败,请稍后重试"; if (error.errMsg) { if (error.errMsg.includes("timeout")) { errorMessage = "请求超时,请检查网络连接后重试"; } else if (error.errMsg.includes("fail")) { errorMessage = "网络请求失败,请检查网络连接"; } } common_vendor.index.showToast({ title: errorMessage, icon: "none", duration: 3e3 }); } finally { this.serviceStatusLoading = false; } }, buildServiceStatusItem(record = {}) { if (!record || typeof record !== "object") { return null; } const formattedUpdateTime = this.formatDateTime(record.updateTime || record.createTime); const tags = []; if (record.recordingName) { tags.push({ text: `录音:${record.recordingName}`, color: "blue" }); } if (record.intentionLevel) { tags.push({ text: `意向:${record.intentionLevel}`, color: "orange" }); } if (record.projectName) { tags.push({ text: `项目:${record.projectName}`, color: "blue" }); } return { id: record.id || "", staffName: record.salesName || "未分配销售", status: record.syncStatus || "服务中", customerName: record.customerName || "", customerPhone: record.customerPhone || "", tags, durationText: formattedUpdateTime ? `最近更新时间:${formattedUpdateTime}` : "最近暂无更新时间" }; }, formatDateTime(value) { if (!value) { return ""; } const date = new Date(value); if (Number.isNaN(date.getTime())) { return ""; } const year = date.getFullYear(); const month = String(date.getMonth() + 1).padStart(2, "0"); const day = String(date.getDate()).padStart(2, "0"); const hours = String(date.getHours()).padStart(2, "0"); const minutes = String(date.getMinutes()).padStart(2, "0"); const seconds = String(date.getSeconds()).padStart(2, "0"); return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; }, viewServiceDetail(item) { common_vendor.index.__f__("log", "at pages-subpackage/reception/reception.vue:929", "查看服务详情", item); }, async finishService(item) { if (!item || !item.id) { common_vendor.index.showToast({ title: "无法获取服务记录ID", icon: "none" }); return; } common_vendor.index.showModal({ title: "确认结束", content: `确定要结束这条服务记录吗?`, success: async (res) => { var _a, _b; if (res.confirm) { try { common_vendor.index.showLoading({ title: "结束中..." }); const url = common_config.getApiUrl("/api/audioManagement/finishServiceById"); let tenantId = ""; let token = ""; try { tenantId = common_vendor.index.getStorageSync("backend-tenant-id") || ""; token = common_vendor.index.getStorageSync("backend-token") || ""; } catch (e) { common_vendor.index.__f__("error", "at pages-subpackage/reception/reception.vue:959", "获取认证信息失败:", e); } const headers = { "Content-Type": "application/json" }; if (token) { headers["Authorization"] = `Bearer ${token}`; } if (tenantId) { headers["X-Tenant-Id"] = tenantId; } const requestData = { id: item.id }; const finishRes = await common_vendor.index.request({ url, method: "POST", data: requestData, header: headers, timeout: 3e4 }); common_vendor.index.hideLoading(); if (finishRes.statusCode === 200 && finishRes.data && finishRes.data.success) { common_vendor.index.showToast({ title: ((_a = finishRes.data) == null ? void 0 : _a.message) || "结束服务成功", icon: "success" }); this.serviceStatusPage.current = 1; this.fetchServiceStatusList({ force: true }); } else { common_vendor.index.showToast({ title: ((_b = finishRes.data) == null ? void 0 : _b.message) || "结束服务失败", icon: "none" }); } } catch (error) { common_vendor.index.hideLoading(); common_vendor.index.__f__("error", "at pages-subpackage/reception/reception.vue:1004", "结束服务失败:", error); let errorMessage = "结束服务失败,请重试"; if (error.errMsg) { if (error.errMsg.includes("timeout")) { errorMessage = "请求超时,请检查网络连接后重试"; } else if (error.errMsg.includes("fail")) { errorMessage = "网络请求失败,请检查网络连接"; } } common_vendor.index.showToast({ title: errorMessage, icon: "none", duration: 3e3 }); } } } }); }, onGenderChange(e) { this.receptionForm.gender = e.detail.value; }, onContactBlur() { var _a; const contact = (_a = this.receptionForm.contact) == null ? void 0 : _a.trim(); if (!contact) { return; } if (!this.isValidPhoneNumber(contact)) { common_vendor.index.showToast({ title: "请输入有效的手机号", icon: "none" }); return; } this.fetchCustomerByContact(); }, isValidPhoneNumber(phone) { const normalizedPhone = phone == null ? void 0 : phone.trim(); if (!normalizedPhone) { return false; } return /^1[3-9]\d{9}$/.test(normalizedPhone); }, async fetchCustomerByContact() { var _a, _b, _c; const contact = (_a = this.receptionForm.contact) == null ? void 0 : _a.trim(); if (!contact || this.isFetchingContact) { return; } if (!this.isValidPhoneNumber(contact)) { return; } try { this.isFetchingContact = true; const url = `${common_config.getApiUrl("/api/customerManagement/getByContact")}?contact=${encodeURIComponent(contact)}`; let tenantId = ""; let token = ""; try { tenantId = common_vendor.index.getStorageSync("backend-tenant-id") || ""; token = common_vendor.index.getStorageSync("backend-token") || ""; } catch (e) { common_vendor.index.__f__("error", "at pages-subpackage/reception/reception.vue:1068", "获取认证信息失败:", e); } const headers = {}; if (token) { headers["Authorization"] = `Bearer ${token}`; } if (tenantId) { headers["X-Tenant-Id"] = tenantId; } const res = await common_vendor.index.request({ url, method: "GET", header: headers, timeout: 3e4 // 增加超时时间到30秒 }); const list = (_b = res.data) == null ? void 0 : _b.data; if (res.statusCode === 200 && ((_c = res.data) == null ? void 0 : _c.success) && Array.isArray(list) && list.length) { const customer = list[0]; const retrievedId = customer.id || customer.customerId || ""; const resolvedSalesPhone = customer.salesPhone || customer.salesMobile || customer.salesTel || this.receptionForm.salesPhone || ""; this.receptionForm = { ...this.receptionForm, id: retrievedId ? String(retrievedId) : this.receptionForm.id, customerName: customer.customerName || this.receptionForm.customerName, customerSource: customer.customerSource || this.receptionForm.customerSource, dealershipId: customer.dealershipId ? String(customer.dealershipId) : this.receptionForm.dealershipId, dealershipName: customer.dealershipName || this.receptionForm.dealershipName, salesId: customer.salesId ? String(customer.salesId) : this.receptionForm.salesId, salesName: customer.salesName || this.receptionForm.salesName, salesPhone: String(resolvedSalesPhone), recordingCount: customer.recordingCount ?? this.receptionForm.recordingCount, intendedModel: customer.intendedModel || this.receptionForm.intendedModel, infoCard: customer.infoCard || this.receptionForm.infoCard, remark: customer.remark || this.receptionForm.remark, detailedAddress: customer.detailedAddress || this.receptionForm.detailedAddress, contactCount: customer.contactCount ?? this.receptionForm.contactCount }; common_vendor.index.showToast({ title: "已填充客户信息", icon: "none" }); } } catch (error) { common_vendor.index.__f__("error", "at pages-subpackage/reception/reception.vue:1120", "查询客户信息失败:", error); } finally { this.isFetchingContact = false; } }, onCancel() { this.receptionForm = { id: "", customerName: "", contact: "", customerSource: "", gender: "女", age: "", dealershipId: "", dealershipName: "", salesId: "", salesName: "", salesPhone: "", recordingCount: 0, intendedModel: "", infoCard: "", remark: "", detailedAddress: "", contactCount: 0 }; this.loadCurrentUserInfo(); common_vendor.index.showToast({ title: "已取消", icon: "none" }); }, async onSave(action = "save") { var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l; if (!this.receptionForm.customerName) { common_vendor.index.showToast({ title: "请输入客户姓名", icon: "none" }); return; } if (!this.receptionForm.contact) { common_vendor.index.showToast({ title: "请输入客户电话", icon: "none" }); return; } const trimmedContact = (_a = this.receptionForm.contact) == null ? void 0 : _a.trim(); if (!this.isValidPhoneNumber(trimmedContact)) { common_vendor.index.showToast({ title: "请输入有效的客户电话", icon: "none" }); return; } const trimmedSalesPhone = (_b = this.receptionForm.salesPhone) == null ? void 0 : _b.trim(); if (trimmedSalesPhone && !this.isValidPhoneNumber(trimmedSalesPhone)) { common_vendor.index.showToast({ title: "请输入有效的销售电话", icon: "none" }); return; } const normalizedCustomerId = ((_c = this.receptionForm.id) == null ? void 0 : _c.toString().trim()) || ""; const params = { id: normalizedCustomerId, customerName: (_d = this.receptionForm.customerName) == null ? void 0 : _d.trim(), contact: trimmedContact, customerSource: ((_e = this.receptionForm.customerSource) == null ? void 0 : _e.trim()) || "", dealershipId: String(this.receptionForm.dealershipId || "").trim() || "", dealershipName: ((_f = this.receptionForm.dealershipName) == null ? void 0 : _f.trim()) || "", salesId: String(this.receptionForm.salesId || "").trim() || "", salesName: ((_g = this.receptionForm.salesName) == null ? void 0 : _g.trim()) || "", recordingCount: Number(this.receptionForm.recordingCount) || 0, intendedModel: ((_h = this.receptionForm.intendedModel) == null ? void 0 : _h.trim()) || "", infoCard: ((_i = this.receptionForm.infoCard) == null ? void 0 : _i.trim()) || "", remark: ((_j = this.receptionForm.remark) == null ? void 0 : _j.trim()) || "", detailedAddress: ((_k = this.receptionForm.detailedAddress) == null ? void 0 : _k.trim()) || "", salesPhone: trimmedSalesPhone || "", contactCount: Number(this.receptionForm.contactCount) || 0, operationType: action }; try { common_vendor.index.showLoading({ title: "保存中..." }); let tenantId = ""; let token = ""; try { tenantId = common_vendor.index.getStorageSync("backend-tenant-id") || ""; token = common_vendor.index.getStorageSync("backend-token") || ""; } catch (e) { common_vendor.index.__f__("error", "at pages-subpackage/reception/reception.vue:1219", "获取认证信息失败:", e); } const headers = { "Content-Type": "application/json" }; if (token) { headers["Authorization"] = `Bearer ${token}`; } if (tenantId) { headers["X-Tenant-Id"] = tenantId; } const res = await common_vendor.index.request({ url: common_config.getApiUrl("/api/customerManagement/add"), method: "POST", data: params, header: headers, timeout: 3e4 // 增加超时时间到30秒 }); common_vendor.index.hideLoading(); if (res.statusCode === 200 && res.data && res.data.success) { common_vendor.index.showToast({ title: "保存成功", icon: "success" }); this.onCancel(); } else { common_vendor.index.showToast({ title: ((_l = res.data) == null ? void 0 : _l.message) || "保存失败", icon: "none" }); } } catch (error) { common_vendor.index.hideLoading(); common_vendor.index.__f__("error", "at pages-subpackage/reception/reception.vue:1258", "保存失败:", error); common_vendor.index.showToast({ title: "保存失败,请重试", icon: "none" }); } }, // 标签管理相关方法 onTagListSearch() { if (this.activeTab !== "tag") { this.activeTab = "tag"; } this.tagPage.current = 1; this.fetchTagList({ force: true }); }, onTagListRefresh() { this.tagPage.current = 1; this.fetchTagList({ force: true }); }, onTagListReachBottom() { if (this.tagLoading) return; if (this.tagList.length >= this.tagTotal) return; this.tagPage.current += 1; this.fetchTagList(); }, async fetchTagList({ force = false } = {}) { var _a, _b, _c, _d, _e; if (this.tagLoading && !force) { return; } this.tagLoading = true; try { const queryParams = { current: this.tagPage.current, size: this.tagPage.size }; const trimmedTagType = (_b = (_a = this.tagQuery) == null ? void 0 : _a.tagType) == null ? void 0 : _b.trim(); const trimmedTagName = (_d = (_c = this.tagQuery) == null ? void 0 : _c.tagName) == null ? void 0 : _d.trim(); if (trimmedTagType) { queryParams.tagType = trimmedTagType; } if (trimmedTagName) { queryParams.tagName = trimmedTagName; } const url = common_config.getApiUrl("/api/industryTags/list"); let tenantId = ""; let token = ""; try { tenantId = common_vendor.index.getStorageSync("backend-tenant-id") || ""; token = common_vendor.index.getStorageSync("backend-token") || ""; } catch (e) { common_vendor.index.__f__("error", "at pages-subpackage/reception/reception.vue:1312", "获取认证信息失败:", e); } const headers = { "Content-Type": "application/json" }; if (token) { headers["Authorization"] = `Bearer ${token}`; } if (tenantId) { headers["X-Tenant-Id"] = tenantId; } const res = await common_vendor.index.request({ url, method: "POST", data: queryParams, header: headers, timeout: 3e4 // 增加超时时间到30秒 }); if (res.statusCode === 200 && res.data && res.data.success) { const records = Array.isArray(res.data.data) ? res.data.data : []; if (this.tagPage.current === 1 || force) { this.tagList = records; } else { this.tagList = this.tagList.concat(records); } this.tagTotal = Number(res.data.total) || 0; } else { this.tagList = []; this.tagTotal = 0; common_vendor.index.showToast({ title: ((_e = res.data) == null ? void 0 : _e.message) || "获取标签列表失败", icon: "none" }); } } catch (error) { common_vendor.index.__f__("error", "at pages-subpackage/reception/reception.vue:1351", "获取标签列表失败:", error); let errorMessage = "获取标签列表失败,请稍后重试"; if (error.errMsg) { if (error.errMsg.includes("timeout")) { errorMessage = "请求超时,请检查网络连接后重试"; } else if (error.errMsg.includes("fail")) { errorMessage = "网络请求失败,请检查网络连接"; } } common_vendor.index.showToast({ title: errorMessage, icon: "none", duration: 3e3 }); } finally { this.tagLoading = false; } }, showAddTag() { this.tagViewMode = "add"; this.showTagTypeDropdown = false; this.tagForm = { id: "", industry: "家居行业", tagType: "", name: "", detail: "", remark: "", enabled: true }; }, onTagItemClick(item) { }, onTagActionBtnClick(item) { if (this.selectedTagItem && this.selectedTagItem.id === item.id && this.showTagActionMenu) { this.closeTagActionMenu(); return; } this.selectedTagItem = item; this.showTagActionMenu = true; }, closeTagActionMenu() { this.showTagActionMenu = false; this.selectedTagItem = null; }, editTag(item) { this.closeTagActionMenu(); this.tagViewMode = "edit"; this.showTagTypeDropdown = false; this.tagForm = { id: item.id || "", industry: item.industry || "家居行业", tagType: item.tagType || "", name: item.tagName || item.name || "", detail: item.tagDetail || item.detail || "", remark: item.remark || "", enabled: item.enabled !== void 0 ? item.enabled : item.isEnabled !== void 0 ? item.isEnabled : true }; }, async deleteTag(item) { this.closeTagActionMenu(); const tagId = item.id; if (!tagId) { common_vendor.index.showToast({ title: "无法获取标签ID", icon: "none" }); return; } common_vendor.index.showModal({ title: "确认删除", content: `确定要删除标签"${item.tagName || item.name || "未命名标签"}"吗?`, success: async (res) => { var _a, _b; if (res.confirm) { try { common_vendor.index.showLoading({ title: "删除中..." }); const deleteUrl = common_config.getApiUrl(`/api/industryTags/delete/${tagId}`); let tenantId = ""; let token = ""; try { tenantId = common_vendor.index.getStorageSync("backend-tenant-id") || ""; token = common_vendor.index.getStorageSync("backend-token") || ""; } catch (e) { common_vendor.index.__f__("error", "at pages-subpackage/reception/reception.vue:1445", "获取认证信息失败:", e); } const headers = {}; if (token) { headers["Authorization"] = `Bearer ${token}`; } if (tenantId) { headers["X-Tenant-Id"] = tenantId; } const deleteRes = await common_vendor.index.request({ url: deleteUrl, method: "DELETE", header: headers, timeout: 3e4 // 增加超时时间到30秒 }); common_vendor.index.hideLoading(); if (deleteRes.statusCode === 200 && deleteRes.data && deleteRes.data.success) { common_vendor.index.showToast({ title: ((_a = deleteRes.data) == null ? void 0 : _a.message) || "删除成功", icon: "success" }); this.tagPage.current = 1; this.fetchTagList({ force: true }); } else { common_vendor.index.showToast({ title: ((_b = deleteRes.data) == null ? void 0 : _b.message) || "删除失败", icon: "none" }); } } catch (error) { common_vendor.index.hideLoading(); common_vendor.index.__f__("error", "at pages-subpackage/reception/reception.vue:1482", "删除标签失败:", error); let errorMessage = "删除失败,请重试"; if (error.errMsg) { if (error.errMsg.includes("timeout")) { errorMessage = "请求超时,请检查网络连接后重试"; } else if (error.errMsg.includes("fail")) { errorMessage = "网络请求失败,请检查网络连接"; } } common_vendor.index.showToast({ title: errorMessage, icon: "none", duration: 3e3 }); } } } }); }, cancelAddTag() { this.tagViewMode = "list"; this.showTagTypeDropdown = false; this.tagForm = { id: "", industry: "家居行业", tagType: "", name: "", detail: "", remark: "", enabled: true }; }, toggleTagTypeDropdown() { this.showTagTypeDropdown = !this.showTagTypeDropdown; }, selectTagType(option) { this.tagForm.tagType = option; this.showTagTypeDropdown = false; }, closeTagTypeDropdown() { this.showTagTypeDropdown = false; }, onEnabledChange(e) { this.tagForm.enabled = e.detail.value; }, async saveTag() { var _a, _b, _c, _d; if (!this.tagForm.name || !this.tagForm.name.trim()) { common_vendor.index.showToast({ title: "请输入标签名", icon: "none" }); return; } try { common_vendor.index.showLoading({ title: this.tagViewMode === "edit" ? "更新中..." : "保存中..." }); const payload = { industry: ((_a = this.tagForm.industry) == null ? void 0 : _a.trim()) || "", tagType: ((_b = this.tagForm.tagType) == null ? void 0 : _b.trim()) || "", tagName: this.tagForm.name.trim(), tagDetail: ((_c = this.tagForm.detail) == null ? void 0 : _c.trim()) || "", remark: ((_d = this.tagForm.remark) == null ? void 0 : _d.trim()) || "", enabled: this.tagForm.enabled !== void 0 ? this.tagForm.enabled : true }; if (this.tagViewMode === "edit" && this.tagForm.id) { payload.id = this.tagForm.id; } const url = this.tagViewMode === "edit" ? common_config.getApiUrl("/api/industryTags/update") : common_config.getApiUrl("/api/industryTags/add"); const method = this.tagViewMode === "edit" ? "PUT" : "POST"; let tenantId = ""; let token = ""; try { tenantId = common_vendor.index.getStorageSync("backend-tenant-id") || ""; token = common_vendor.index.getStorageSync("backend-token") || ""; } catch (e) { common_vendor.index.__f__("error", "at pages-subpackage/reception/reception.vue:1571", "获取认证信息失败:", e); } const headers = { "Content-Type": "application/json" }; if (token) { headers["Authorization"] = `Bearer ${token}`; } if (tenantId) { headers["X-Tenant-Id"] = tenantId; } const res = await common_vendor.index.request({ url, method, data: payload, header: headers, timeout: 3e4 // 增加超时时间到30秒 }); const { statusCode, data } = res; if (statusCode === 200 && data && (data.success || data.code === 200)) { common_vendor.index.showToast({ title: (data == null ? void 0 : data.message) || (this.tagViewMode === "edit" ? "更新成功" : "保存成功"), icon: "success" }); this.tagViewMode = "list"; this.tagPage.current = 1; this.fetchTagList({ force: true }); } else { throw new Error((data == null ? void 0 : data.message) || (this.tagViewMode === "edit" ? "更新失败" : "保存失败")); } } catch (error) { common_vendor.index.__f__("error", "at pages-subpackage/reception/reception.vue:1607", "保存标签失败:", error); let errorMessage = (error == null ? void 0 : error.message) || (this.tagViewMode === "edit" ? "更新失败,请重试" : "保存失败,请重试"); if (error.errMsg) { if (error.errMsg.includes("timeout")) { errorMessage = "请求超时,请检查网络连接后重试"; } else if (error.errMsg.includes("fail")) { errorMessage = "网络请求失败,请检查网络连接"; } } common_vendor.index.showToast({ title: errorMessage, icon: "none", duration: 3e3 }); } finally { common_vendor.index.hideLoading(); } } } }; if (!Array) { const _easycom_uni_nav_bar2 = common_vendor.resolveComponent("uni-nav-bar"); const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons"); (_easycom_uni_nav_bar2 + _easycom_uni_icons2)(); } const _easycom_uni_nav_bar = () => "../../uni_modules/uni-nav-bar/components/uni-nav-bar/uni-nav-bar.js"; const _easycom_uni_icons = () => "../../uni_modules/uni-icons/components/uni-icons/uni-icons.js"; if (!Math) { (_easycom_uni_nav_bar + _easycom_uni_icons)(); } function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) { return common_vendor.e({ a: common_vendor.o($options.goBack), b: common_vendor.p({ fixed: true, statusBar: true, border: false, title: "AI销冠系统", leftIcon: "left", color: "#333", backgroundColor: "#FFFFFF" }), c: $data.activeTab === "status" ? 1 : "", d: common_vendor.o(($event) => $options.switchTab("status")), e: $data.activeTab === "reception" ? 1 : "", f: common_vendor.o(($event) => $options.switchTab("reception")), g: $data.activeTab === "tag" ? 1 : "", h: common_vendor.o(($event) => $options.switchTab("tag")), i: $options.computedNavbarTop || $data.navbarTop, j: $data.activeTab === "status" }, $data.activeTab === "status" ? common_vendor.e({ k: common_vendor.t($data.serviceStatusTotal), l: common_vendor.o((...args) => $options.onServiceStatusSearch && $options.onServiceStatusSearch(...args)), m: $data.serviceStatusQuery.salesName, n: common_vendor.o(($event) => $data.serviceStatusQuery.salesName = $event.detail.value), o: common_vendor.o((...args) => $options.onServiceStatusSearch && $options.onServiceStatusSearch(...args)), p: $data.serviceStatusQuery.customerName, q: common_vendor.o(($event) => $data.serviceStatusQuery.customerName = $event.detail.value), r: common_vendor.p({ type: "refresh", size: "18", color: "#2A68FF" }), s: common_vendor.o((...args) => $options.onServiceStatusRefresh && $options.onServiceStatusRefresh(...args)), t: common_vendor.f($data.serviceStatusList, (item, index, i0) => { return common_vendor.e({ a: common_vendor.t(item.staffName.charAt(0)), b: common_vendor.t(item.staffName), c: common_vendor.o(($event) => $options.finishService(item), item.id || index), d: "48f55753-2-" + i0, e: common_vendor.t(item.customerName || "未知客户"), f: item.customerPhone }, item.customerPhone ? { g: common_vendor.t(item.customerPhone) } : {}, { h: common_vendor.f(item.tags, (tag, tagIndex, i1) => { return { a: common_vendor.t(tag.text), b: common_vendor.n("tag-" + tag.color), c: tagIndex }; }), i: item.alert }, item.alert ? common_vendor.e({ j: common_vendor.t(item.alert.title), k: item.alert.type === "risk" }, item.alert.type === "risk" ? { l: common_vendor.t(item.alert.message) } : { m: common_vendor.f(item.alert.messages, (msg, msgIndex, i1) => { return { a: common_vendor.t(msg), b: msgIndex }; }) }, { n: common_vendor.n(item.alert.type === "risk" ? "alert-risk-text" : "alert-reminder-text"), o: common_vendor.n(item.alert.type === "risk" ? "alert-risk-box" : "alert-reminder-box") }) : {}, { p: common_vendor.t(item.durationText), q: item.id || index, r: common_vendor.o(($event) => $options.viewServiceDetail(item), item.id || index) }); }), v: common_vendor.p({ type: "bars", size: "16", color: "#007AFF" }), w: !$data.serviceStatusLoading && !$data.serviceStatusList.length }, !$data.serviceStatusLoading && !$data.serviceStatusList.length ? {} : {}, { x: $data.serviceStatusLoading && $data.serviceStatusList.length }, $data.serviceStatusLoading && $data.serviceStatusList.length ? {} : {}, { y: $options.computedContentTop || $data.contentTop, z: common_vendor.o((...args) => $options.onServiceStatusReachBottom && $options.onServiceStatusReachBottom(...args)) }) : {}, { A: $data.activeTab === "reception" }, $data.activeTab === "reception" ? { B: common_vendor.t($data.receptionForm.contactCount || 0), C: $data.receptionForm.customerName, D: common_vendor.o(($event) => $data.receptionForm.customerName = $event.detail.value), E: common_vendor.o((...args) => $options.onContactBlur && $options.onContactBlur(...args)), F: $data.receptionForm.contact, G: common_vendor.o(($event) => $data.receptionForm.contact = $event.detail.value), H: $data.receptionForm.customerSource, I: common_vendor.o(($event) => $data.receptionForm.customerSource = $event.detail.value), J: $data.receptionForm.dealershipName, K: common_vendor.o(($event) => $data.receptionForm.dealershipName = $event.detail.value), L: common_vendor.f($data.genderOptions, (option, index, i0) => { return { a: option, b: $data.receptionForm.gender === option, c: common_vendor.t(option), d: index }; }), M: common_vendor.o((...args) => $options.onGenderChange && $options.onGenderChange(...args)), N: $data.receptionForm.age, O: common_vendor.o(($event) => $data.receptionForm.age = $event.detail.value), P: $data.receptionForm.salesName, Q: common_vendor.o(($event) => $data.receptionForm.salesName = $event.detail.value), R: $data.receptionForm.salesPhone, S: common_vendor.o(($event) => $data.receptionForm.salesPhone = $event.detail.value), T: $data.receptionForm.detailedAddress, U: common_vendor.o(($event) => $data.receptionForm.detailedAddress = $event.detail.value), V: common_vendor.o((...args) => $options.onCancel && $options.onCancel(...args)), W: common_vendor.o(($event) => $options.onSave("save")), X: common_vendor.o(($event) => $options.onSave("start")), Y: $options.computedContentTop || $data.contentTop } : {}, { Z: $data.activeTab === "tag" && $data.tagViewMode === "list" }, $data.activeTab === "tag" && $data.tagViewMode === "list" ? common_vendor.e({ aa: common_vendor.t($data.tagTotal), ab: common_vendor.o((...args) => $options.onTagListSearch && $options.onTagListSearch(...args)), ac: $data.tagQuery.tagType, ad: common_vendor.o(($event) => $data.tagQuery.tagType = $event.detail.value), ae: common_vendor.o((...args) => $options.onTagListSearch && $options.onTagListSearch(...args)), af: $data.tagQuery.tagName, ag: common_vendor.o(($event) => $data.tagQuery.tagName = $event.detail.value), ah: common_vendor.p({ type: "refresh", size: "18", color: "#2A68FF" }), ai: common_vendor.o((...args) => $options.onTagListRefresh && $options.onTagListRefresh(...args)), aj: common_vendor.p({ type: "plus", size: "18", color: "#2A68FF" }), ak: common_vendor.o((...args) => $options.showAddTag && $options.showAddTag(...args)), al: common_vendor.f($data.tagList, (item, index, i0) => { return common_vendor.e({ a: common_vendor.t((item.tagName || item.name || "标").charAt(0)), b: common_vendor.t(item.tagName || item.name || "未命名标签"), c: common_vendor.o(($event) => $options.onTagItemClick(item), index), d: "48f55753-5-" + i0, e: common_vendor.o(($event) => $options.onTagActionBtnClick(item), index), f: item.industry }, item.industry ? { g: common_vendor.t(item.industry) } : {}, { h: common_vendor.o(($event) => $options.onTagItemClick(item), index), i: item.tagDetail || item.detail || item.remark }, item.tagDetail || item.detail || item.remark ? common_vendor.e({ j: item.tagDetail || item.detail }, item.tagDetail || item.detail ? { k: common_vendor.t(item.tagDetail || item.detail) } : {}, { l: item.remark }, item.remark ? { m: common_vendor.t(item.remark) } : {}, { n: common_vendor.o(($event) => $options.onTagItemClick(item), index) }) : {}, { o: $data.selectedTagItem && $data.selectedTagItem.id === item.id && $data.showTagActionMenu }, $data.selectedTagItem && $data.selectedTagItem.id === item.id && $data.showTagActionMenu ? { p: common_vendor.o(($event) => $options.editTag(item), index), q: common_vendor.o(($event) => $options.deleteTag(item), index), r: common_vendor.o(() => { }, index) } : {}, { s: index, t: $data.selectedTagItem && $data.selectedTagItem.id === item.id ? 1 : "" }); }), am: common_vendor.p({ type: "more-filled", size: "20", color: "#999" }), an: $data.showTagActionMenu }, $data.showTagActionMenu ? { ao: common_vendor.o((...args) => $options.closeTagActionMenu && $options.closeTagActionMenu(...args)) } : {}, { ap: !$data.tagLoading && !$data.tagList.length }, !$data.tagLoading && !$data.tagList.length ? {} : {}, { aq: $data.tagLoading && $data.tagList.length }, $data.tagLoading && $data.tagList.length ? {} : {}, { ar: $options.computedContentTop || $data.contentTop, as: common_vendor.o((...args) => $options.onTagListReachBottom && $options.onTagListReachBottom(...args)) }) : {}, { at: $data.activeTab === "tag" && ($data.tagViewMode === "add" || $data.tagViewMode === "edit") }, $data.activeTab === "tag" && ($data.tagViewMode === "add" || $data.tagViewMode === "edit") ? common_vendor.e({ av: $data.tagViewMode === "add" }, $data.tagViewMode === "add" ? { aw: $data.tagForm.industry, ax: common_vendor.o(($event) => $data.tagForm.industry = $event.detail.value) } : {}, { ay: common_vendor.t($data.tagForm.tagType || "请选择标签分类"), az: common_vendor.n($data.tagForm.tagType ? "form-item__picker-text" : "form-item__picker-placeholder"), aA: common_vendor.p({ type: "bottom", size: "16", color: "#9ca3af" }), aB: common_vendor.o((...args) => $options.toggleTagTypeDropdown && $options.toggleTagTypeDropdown(...args)), aC: $data.showTagTypeDropdown }, $data.showTagTypeDropdown ? { aD: common_vendor.f($data.tagTypeOptions, (option, k0, i0) => { return { a: common_vendor.t(option), b: option === $data.tagForm.tagType ? 1 : "", c: option, d: common_vendor.o(($event) => $options.selectTagType(option), option) }; }), aE: common_vendor.o(() => { }) } : {}, { aF: $data.tagForm.name, aG: common_vendor.o(($event) => $data.tagForm.name = $event.detail.value), aH: $data.tagForm.detail, aI: common_vendor.o(($event) => $data.tagForm.detail = $event.detail.value), aJ: $data.tagForm.remark, aK: common_vendor.o(($event) => $data.tagForm.remark = $event.detail.value), aL: $data.tagForm.enabled, aM: common_vendor.o((...args) => $options.onEnabledChange && $options.onEnabledChange(...args)), aN: common_vendor.o((...args) => $options.cancelAddTag && $options.cancelAddTag(...args)), aO: common_vendor.t($data.tagViewMode === "edit" ? "更新" : "保存"), aP: common_vendor.o((...args) => $options.saveTag && $options.saveTag(...args)), aQ: $data.showTagTypeDropdown }, $data.showTagTypeDropdown ? { aR: common_vendor.o((...args) => $options.closeTagTypeDropdown && $options.closeTagTypeDropdown(...args)) } : {}, { aS: $options.computedContentTop || $data.contentTop }) : {}); } const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]); wx.createPage(MiniProgramPage); //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages-subpackage/reception/reception.js.map