| 123456789101112131415161718192021222324252627 |
- import { request, parseResponseJson } from '@/utils/request'
- /** 拉取运营在系统设置中配置的客服电话(需登录)。 */
- export async function fetchServicePhone() {
- try {
- const res = await request({ url: '/mini/common/service-contact', method: 'GET' })
- const body = parseResponseJson(res)
- if (body.code === 200 && body.data && body.data.servicePhone) {
- return String(body.data.servicePhone).trim()
- }
- } catch {
- // ignore
- }
- return ''
- }
- /** 一键拨号(号码中的空格在拨号前去掉)。 */
- export function dialServicePhone(phone) {
- const raw = String(phone || '')
- .trim()
- .replace(/\s/g, '')
- if (!raw) {
- uni.showToast({ title: '暂未配置客服电话', icon: 'none' })
- return
- }
- uni.makePhoneCall({ phoneNumber: raw })
- }
|