feat: 增加店长审核模式与门店经营有效期
This commit is contained in:
@@ -26,6 +26,22 @@ function canCreateAppointment() {
|
||||
return Number(userInfo.type) !== 3
|
||||
}
|
||||
|
||||
function isShopBusinessExpired() {
|
||||
const userInfo = getApp().globalData.userInfo || {}
|
||||
return Number(userInfo.type) === 2 && userInfo.shopBusinessExpired === true
|
||||
}
|
||||
|
||||
function showBusinessExpiryNotice() {
|
||||
return new Promise(resolve => wx.showModal({
|
||||
title: '门店经营有效期已到期',
|
||||
content: '当前门店暂不能新增普通预约。历史订单、查询和补录不受影响,请联系平台管理员办理续期。',
|
||||
showCancel: false,
|
||||
confirmText: '知道了',
|
||||
success: () => resolve(),
|
||||
fail: () => resolve()
|
||||
}))
|
||||
}
|
||||
|
||||
function buildDraftKey() {
|
||||
const app = getApp()
|
||||
const userInfo = app.globalData.userInfo || {}
|
||||
@@ -1399,6 +1415,10 @@ Page({
|
||||
wx.showToast({ title: '当前账号仅支持查看预约', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (isShopBusinessExpired()) {
|
||||
await showBusinessExpiryNotice()
|
||||
return
|
||||
}
|
||||
let form = this.data.form
|
||||
const manualProductTitle = String(form.manualProductTitle || '').trim()
|
||||
const manualProductImageFileIds = String(form.manualProductImageFileIds || '').trim()
|
||||
@@ -1480,7 +1500,11 @@ Page({
|
||||
markPlanningRefresh()
|
||||
wx.redirectTo({ url: `/pages/appointment-detail/index?id=${result.orderItemId}` })
|
||||
} catch (error) {
|
||||
wx.showToast({ title: error.message || '提交失败', icon: 'none' })
|
||||
if ((error.message || '').includes('有效期') || (error.message || '').includes('到期')) {
|
||||
await showBusinessExpiryNotice()
|
||||
} else {
|
||||
wx.showToast({ title: error.message || '提交失败', icon: 'none' })
|
||||
}
|
||||
} finally {
|
||||
this.setData({ loading: false })
|
||||
}
|
||||
|
||||
@@ -2,16 +2,18 @@ const assert = require('assert')
|
||||
const planningApi = require('../../api/planning')
|
||||
|
||||
let redirectedTo = ''
|
||||
let appGlobalData = {}
|
||||
let lastModal = null
|
||||
global.wx = {
|
||||
getAccountInfoSync: () => ({ miniProgram: { envVersion: 'develop' } }),
|
||||
getDeviceInfo: () => ({ platform: 'devtools' }),
|
||||
removeStorageSync: () => {},
|
||||
setStorageSync: () => {},
|
||||
showToast: () => {},
|
||||
showModal: ({ success }) => success({ confirm: true }),
|
||||
showModal: options => { lastModal = options; if (options.success) options.success({ confirm: true }) },
|
||||
redirectTo: ({ url }) => { redirectedTo = url }
|
||||
}
|
||||
global.getApp = () => ({ globalData: {} })
|
||||
global.getApp = () => ({ globalData: appGlobalData })
|
||||
global.getCurrentPages = () => []
|
||||
|
||||
let definition
|
||||
@@ -34,6 +36,14 @@ function createPage() {
|
||||
}
|
||||
|
||||
async function run() {
|
||||
const expiredPage = createPage()
|
||||
expiredPage.data.canCreateAppointment = true
|
||||
appGlobalData.userInfo = { type: 2, shopBusinessExpired: true }
|
||||
await expiredPage.submit()
|
||||
assert.strictEqual(lastModal.title, '门店经营有效期已到期')
|
||||
assert.strictEqual(lastModal.showCancel, false)
|
||||
appGlobalData = {}
|
||||
|
||||
const page = createPage()
|
||||
Object.assign(page.data.form, {
|
||||
customerUserId: '31',
|
||||
|
||||
Reference in New Issue
Block a user