diff --git a/pages/venue/detail.vue b/pages/venue/detail.vue index 3ef0db1..dfa9121 100644 --- a/pages/venue/detail.vue +++ b/pages/venue/detail.vue @@ -20,14 +20,17 @@ - - + + - + 商户电话 - {{ store.servicePhone }} + + {{ i > 0 ? ',' : '' }}{{ p }} + @@ -76,6 +79,29 @@ export default { discountList() { if (!this.store || !this.store.merchantDiscount) return [] return this.store.merchantDiscount.split('\n') + }, + // xuchao: 客服电话列表:按常见分隔符切分;无分隔符连写的多个11位手机号也自动拆开 + servicePhoneList() { + if (!this.store || !this.store.servicePhone) return [] + const parts = String(this.store.servicePhone).split(/[,,;;、\s\n]+/).filter(Boolean) + const out = [] + parts.forEach(p => { + if (p.length > 11 && /^1[3-9]\d{9}$/.test(p.slice(0, 11))) { + let rest = p + const segs = [] + while (rest.length >= 11 && /^1[3-9]\d{9}$/.test(rest.slice(0, 11))) { + segs.push(rest.slice(0, 11)) + rest = rest.slice(11) + } + if (rest) segs[segs.length - 1] += rest + if (segs.length > 1) { + out.push(...segs) + return + } + } + out.push(p) + }) + return out } }, onLoad(options) { @@ -84,10 +110,10 @@ export default { } }, methods: { - // xuchao: 点击商户电话唤起拨号 - callPhone() { - if (!this.store || !this.store.servicePhone) return - uni.makePhoneCall({ phoneNumber: String(this.store.servicePhone) }) + // xuchao: 点击某个商户电话唤起拨号(多个号码时逐个可点) + callPhone(phone) { + if (!phone) return + uni.makePhoneCall({ phoneNumber: String(phone) }) }, loadDetail(shopId) { const loc = uni.getStorageSync('lng') && uni.getStorageSync('lat')