diff --git a/src/api/supplierPhone.js b/src/api/supplierPhone.js new file mode 100644 index 00000000..239cf0f1 --- /dev/null +++ b/src/api/supplierPhone.js @@ -0,0 +1,43 @@ +import request from '@/utils/http' + +/** + * 查询当前服务商分时段电话列表和审批状态 + * @param {Object} params + * @param {number} params.supplierId 服务商 ID + */ +export function getSupplierPhoneList(params) { + return request({ + url: '/supplierAppV2/dispatchApp/supplierPhone/list', + method: 'GET', + params + }) +} + +/** + * 查询当前服务商电话时段变更审批状态 + * @param {Object} params + * @param {number} params.supplierId 服务商 ID + */ +export function getSupplierPhoneApprovalStatus(params) { + return request({ + url: '/supplierAppV2/dispatchApp/supplierPhone/approvalStatus', + method: 'GET', + params + }) +} + +/** + * 提交服务商电话时段变更审批 + * @param {Object} data + * @param {number} data.supplierId 服务商 ID + * @param {string} [data.modifyReason] 修改原因 + * @param {Array} data.phoneList 电话时段草稿列表 + */ +export function submitSupplierPhoneApproval(data) { + return request({ + url: '/supplierAppV2/dispatchApp/supplierPhone/submit', + method: 'POST', + contentType: 'application/json', + data + }) +} diff --git a/src/router/index.js b/src/router/index.js index 936c085b..21aca5b7 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -43,6 +43,22 @@ const routes = [ title: '信息查看', } }, + { + path: '/supplierTimePhone', + name: 'supplierTimePhone', + component: () => import('@/views/index/supplierTimePhone'), + meta:{ + title: '供应商时段电话', + } + }, + { + path: '/supplierTimePhoneEdit', + name: 'supplierTimePhoneEdit', + component: () => import('@/views/index/supplierTimePhoneEdit'), + meta:{ + title: '编辑时段电话', + } + }, { path: '/toDoList', name: 'toDoList', diff --git a/src/utils/validate.js b/src/utils/validate.js new file mode 100644 index 00000000..f38bd709 --- /dev/null +++ b/src/utils/validate.js @@ -0,0 +1,51 @@ +/** + * 校验电话号码 + * 支持:大陆手机号、大陆固话、400电话、港澳手机号 + * @param {string} phone + * @returns {boolean} + */ +export function isValidPhone(phone) { + if (!phone) return false + // 大陆手机号 + const mainlandMobile = /^1[3-9]\d{9}$/ + // 大陆固话:区号(可选) + 7~8位号码 + const mainlandLandline = /^(0\d{2,3}-?)\d{7,8}$/ + // 400电话 + const phone400 = /^400-?\d{3}-?\d{4}$/ + // 港澳手机号(8位,首位5/6/8/9) + const hkMacaoMobile = /^[5689]\d{7}$/ + // 港澳固话 + const hkMacaoLandline = /^(\d{4}-?)?\d{4}$/ + + return ( + mainlandMobile.test(phone) || + mainlandLandline.test(phone) || + phone400.test(phone) || + hkMacaoMobile.test(phone) || + hkMacaoLandline.test(phone) + ) +} + +/** + * 校验时段格式 HH:mm 及起止关系 + * @param {string} startTime + * @param {string} endTime + * @returns {{valid: boolean, message?: string}} + */ +export function validateTimeRange(startTime, endTime) { + const timeRegex = /^([0-1]\d|2[0-3]):([0-5]\d)$/ + if (!startTime || !endTime) { + return { valid: false, message: '请填写完整的起止时段' } + } + if (!timeRegex.test(startTime) || !timeRegex.test(endTime)) { + return { valid: false, message: '时段格式不正确,应为 00:00 ~ 23:59' } + } + const [startH, startM] = startTime.split(':').map(Number) + const [endH, endM] = endTime.split(':').map(Number) + const start = startH * 60 + startM + const end = endH * 60 + endM + if (start > end) { + return { valid: false, message: '开始时间不得晚于结束时间' } + } + return { valid: true } +} diff --git a/src/views/index/supplierTimePhone.vue b/src/views/index/supplierTimePhone.vue new file mode 100644 index 00000000..72ac8fdc --- /dev/null +++ b/src/views/index/supplierTimePhone.vue @@ -0,0 +1,384 @@ + + + + + diff --git a/src/views/index/supplierTimePhoneEdit.vue b/src/views/index/supplierTimePhoneEdit.vue new file mode 100644 index 00000000..78a20440 --- /dev/null +++ b/src/views/index/supplierTimePhoneEdit.vue @@ -0,0 +1,352 @@ + + + + +