重构店铺设置展示与编辑流程
This commit is contained in:
@@ -17,6 +17,8 @@
|
|||||||
"pages/profile/index",
|
"pages/profile/index",
|
||||||
"pages/profile-settings/index",
|
"pages/profile-settings/index",
|
||||||
"pages/shop-settings/index",
|
"pages/shop-settings/index",
|
||||||
|
"pages/shop-profile-edit/index",
|
||||||
|
"pages/shop-tags/index",
|
||||||
"pages/export/index",
|
"pages/export/index",
|
||||||
"pages/password/index",
|
"pages/password/index",
|
||||||
"pages/about/index"
|
"pages/about/index"
|
||||||
|
|||||||
@@ -0,0 +1,150 @@
|
|||||||
|
const shopApi = require('../../api/shop')
|
||||||
|
const { BRAND_CONFIG } = require('../../utils/config')
|
||||||
|
const { chooseImageFilePath, uploadObjectFile, resolveUploadedImagePreviewUrl } = require('../../utils/upload')
|
||||||
|
|
||||||
|
const DEFAULT_SHOP_INTRO = '专注法式、晕染与手绘设计,适合想要温柔质感的客人。'
|
||||||
|
|
||||||
|
function resolveFirstImageUrl(urls) {
|
||||||
|
return Array.isArray(urls) ? String(urls[0] || '').trim() : ''
|
||||||
|
}
|
||||||
|
|
||||||
|
function introLength(value) {
|
||||||
|
return String(value || '').length
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildShopPayload(settings, form) {
|
||||||
|
return {
|
||||||
|
shopName: String(form.shopName || '').trim(),
|
||||||
|
description: String(form.rule || '').trim(),
|
||||||
|
address: settings.address || '',
|
||||||
|
mapProvider: settings.mapProvider || '',
|
||||||
|
longitude: settings.longitude,
|
||||||
|
latitude: settings.latitude,
|
||||||
|
businessHours: settings.businessHours || '',
|
||||||
|
schedulePresetType: settings.schedulePresetType || '',
|
||||||
|
scheduleWorkDays: settings.scheduleWorkDays || '',
|
||||||
|
scheduleRemark: settings.scheduleRemark || '',
|
||||||
|
coverImageFileId: String(form.coverImageFileId || '').trim(),
|
||||||
|
imageFileIds: String(settings.imageFileIds || '').trim(),
|
||||||
|
themePrimaryColor: settings.themePrimaryColor || '',
|
||||||
|
themeSecondaryColor: settings.themeSecondaryColor || '',
|
||||||
|
themeAccentColor: settings.themeAccentColor || '',
|
||||||
|
themePageBgColor: settings.themePageBgColor || '',
|
||||||
|
themeCardBgColor: settings.themeCardBgColor || '',
|
||||||
|
themeBackgroundImageFileId: settings.themeBackgroundImageFileId || '',
|
||||||
|
status: settings.status,
|
||||||
|
authorizationStartDate: settings.authorizationStartDate,
|
||||||
|
authorizationDays: settings.authorizationDays,
|
||||||
|
authorizationExpireTime: settings.authorizationExpireTime
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Page({
|
||||||
|
data: {
|
||||||
|
loading: false,
|
||||||
|
saving: false,
|
||||||
|
coverUploading: false,
|
||||||
|
coverImagePreviewUrl: '',
|
||||||
|
introLength: introLength(DEFAULT_SHOP_INTRO),
|
||||||
|
settingsSnapshot: {},
|
||||||
|
form: {
|
||||||
|
shopName: BRAND_CONFIG.defaultShopName,
|
||||||
|
rule: DEFAULT_SHOP_INTRO,
|
||||||
|
coverImageFileId: ''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
onLoad() {
|
||||||
|
this.loadSettings()
|
||||||
|
},
|
||||||
|
|
||||||
|
async loadSettings() {
|
||||||
|
this.setData({ loading: true })
|
||||||
|
try {
|
||||||
|
const settings = await shopApi.settings()
|
||||||
|
const form = {
|
||||||
|
shopName: settings.shopName || settings.name || this.data.form.shopName,
|
||||||
|
rule: settings.description || DEFAULT_SHOP_INTRO,
|
||||||
|
coverImageFileId: settings.coverImageFileId || ''
|
||||||
|
}
|
||||||
|
this.setData({
|
||||||
|
settingsSnapshot: settings || {},
|
||||||
|
form,
|
||||||
|
introLength: introLength(form.rule),
|
||||||
|
coverImagePreviewUrl: resolveFirstImageUrl(settings.coverImageUrls)
|
||||||
|
})
|
||||||
|
} catch (error) {
|
||||||
|
wx.showToast({ title: error.message || '店铺档案加载失败', icon: 'none' })
|
||||||
|
} finally {
|
||||||
|
this.setData({ loading: false })
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
onInput(event) {
|
||||||
|
const field = event.currentTarget.dataset.field
|
||||||
|
const value = event.detail.value
|
||||||
|
const nextData = { [`form.${field}`]: value }
|
||||||
|
if (field === 'rule') {
|
||||||
|
nextData.introLength = introLength(value)
|
||||||
|
}
|
||||||
|
this.setData(nextData)
|
||||||
|
},
|
||||||
|
|
||||||
|
async chooseCoverImage() {
|
||||||
|
if (this.data.coverUploading || this.data.saving) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const filePath = await chooseImageFilePath()
|
||||||
|
if (!filePath) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.setData({ coverUploading: true })
|
||||||
|
const uploadResult = await uploadObjectFile(filePath)
|
||||||
|
const fileId = String(uploadResult && uploadResult.id ? uploadResult.id : '').trim()
|
||||||
|
if (!fileId) {
|
||||||
|
throw new Error('店铺主图上传失败:上传接口未返回文件ID')
|
||||||
|
}
|
||||||
|
this.setData({
|
||||||
|
'form.coverImageFileId': fileId,
|
||||||
|
coverImagePreviewUrl: resolveUploadedImagePreviewUrl(uploadResult, filePath)
|
||||||
|
})
|
||||||
|
} catch (error) {
|
||||||
|
wx.showToast({ title: error.message || '店铺主图上传失败', icon: 'none' })
|
||||||
|
} finally {
|
||||||
|
this.setData({ coverUploading: false })
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
removeCoverImage() {
|
||||||
|
if (this.data.coverUploading || this.data.saving) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.setData({
|
||||||
|
'form.coverImageFileId': '',
|
||||||
|
coverImagePreviewUrl: ''
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
async save() {
|
||||||
|
const shopName = String(this.data.form.shopName || '').trim()
|
||||||
|
if (!shopName) {
|
||||||
|
wx.showToast({ title: '请填写店铺名称', icon: 'none' })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.setData({ saving: true })
|
||||||
|
try {
|
||||||
|
await shopApi.saveSettings(buildShopPayload(this.data.settingsSnapshot, this.data.form))
|
||||||
|
wx.showToast({ title: '店铺档案已保存', icon: 'success' })
|
||||||
|
wx.navigateBack()
|
||||||
|
} catch (error) {
|
||||||
|
wx.showToast({ title: error.message || '店铺档案保存失败', icon: 'none' })
|
||||||
|
} finally {
|
||||||
|
this.setData({ saving: false })
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
back() {
|
||||||
|
wx.navigateBack()
|
||||||
|
}
|
||||||
|
})
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"navigationBarTitleText": "编辑店铺档案"
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
<view class="page no-tab shop-profile-page">
|
||||||
|
<view wx:if="{{loading}}" class="loading-state">店铺档案加载中</view>
|
||||||
|
<block wx:else>
|
||||||
|
<view class="page-heading">
|
||||||
|
<text class="page-title">编辑店铺档案</text>
|
||||||
|
<text class="page-subtitle">让客人先认识你的店,再决定要不要预约。</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="edit-tip-card">
|
||||||
|
<text class="edit-tip-title">门店第一眼</text>
|
||||||
|
<text class="edit-tip-text">店铺名称、介绍和封面会展示在用户端门店详情页。</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="cover-card">
|
||||||
|
<view wx:if="{{coverImagePreviewUrl}}" class="cover-preview">
|
||||||
|
<image src="{{coverImagePreviewUrl}}" mode="aspectFill"></image>
|
||||||
|
</view>
|
||||||
|
<view wx:else class="cover-preview cover-empty">
|
||||||
|
<text class="cover-empty-title">店铺封面</text>
|
||||||
|
<text class="cover-empty-desc">上传一张能代表风格的作品图</text>
|
||||||
|
</view>
|
||||||
|
<view class="cover-badge">门店封面</view>
|
||||||
|
<view class="cover-actions">
|
||||||
|
<button class="cover-btn" loading="{{coverUploading}}" disabled="{{coverUploading || saving}}" bindtap="chooseCoverImage">{{coverUploading ? '上传中' : '更换主图'}}</button>
|
||||||
|
<button wx:if="{{coverImagePreviewUrl}}" class="cover-remove" disabled="{{coverUploading || saving}}" bindtap="removeCoverImage">移除</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="card form-card">
|
||||||
|
<view class="form-header">
|
||||||
|
<text class="form-kicker">门店档案</text>
|
||||||
|
<text class="form-title">保存后返回主页面查看展示效果</text>
|
||||||
|
</view>
|
||||||
|
<view class="field">
|
||||||
|
<text class="field-label">店铺名称</text>
|
||||||
|
<input value="{{form.shopName}}" data-field="shopName" bindinput="onInput" placeholder="请输入店铺名称" />
|
||||||
|
</view>
|
||||||
|
<view class="field field-column">
|
||||||
|
<text class="field-label">门店介绍</text>
|
||||||
|
<view class="intro-editor">
|
||||||
|
<textarea
|
||||||
|
value="{{form.rule}}"
|
||||||
|
data-field="rule"
|
||||||
|
bindinput="onInput"
|
||||||
|
maxlength="120"
|
||||||
|
auto-height="{{false}}"
|
||||||
|
placeholder="写下门店风格、擅长方向、服务氛围"
|
||||||
|
placeholder-class="intro-placeholder"
|
||||||
|
></textarea>
|
||||||
|
<text class="intro-count">{{introLength}}/120</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<view class="fixed-bottom">
|
||||||
|
<button class="secondary-btn bottom-half-btn" disabled="{{saving || coverUploading}}" bindtap="back">取消</button>
|
||||||
|
<button class="primary-btn bottom-half-btn" loading="{{saving}}" disabled="{{saving || coverUploading}}" bindtap="save">保存档案</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
@@ -0,0 +1,239 @@
|
|||||||
|
.shop-profile-page {
|
||||||
|
background:
|
||||||
|
linear-gradient(180deg, rgba(255, 250, 242, 0.96), rgba(247, 240, 232, 0.96)),
|
||||||
|
linear-gradient(135deg, rgba(89, 121, 102, 0.14), rgba(181, 134, 86, 0.12));
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-heading {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 8rpx;
|
||||||
|
margin: 4rpx 0 22rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-title {
|
||||||
|
color: #2f2a25;
|
||||||
|
font-size: 36rpx;
|
||||||
|
font-weight: 900;
|
||||||
|
line-height: 1.25;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-subtitle,
|
||||||
|
.form-title {
|
||||||
|
color: #8a796a;
|
||||||
|
font-size: 23rpx;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-state {
|
||||||
|
padding: 48rpx 24rpx;
|
||||||
|
color: #7b7167;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.edit-tip-card {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 8rpx;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
padding: 22rpx 24rpx;
|
||||||
|
border-radius: 22rpx;
|
||||||
|
background: #fff0ed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.edit-tip-title {
|
||||||
|
color: #3e312d;
|
||||||
|
font-size: 29rpx;
|
||||||
|
font-weight: 900;
|
||||||
|
}
|
||||||
|
|
||||||
|
.edit-tip-text {
|
||||||
|
color: #9f6c64;
|
||||||
|
font-size: 23rpx;
|
||||||
|
line-height: 1.55;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cover-card {
|
||||||
|
position: relative;
|
||||||
|
height: 340rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
border-radius: 28rpx;
|
||||||
|
background:
|
||||||
|
linear-gradient(135deg, rgba(73, 101, 85, 0.95), rgba(179, 131, 90, 0.95)),
|
||||||
|
radial-gradient(circle at 24% 22%, rgba(255, 245, 223, 0.28), transparent 36%);
|
||||||
|
box-shadow: 0 22rpx 46rpx rgba(83, 64, 44, 0.18);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cover-preview,
|
||||||
|
.cover-preview image {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cover-empty {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 10rpx;
|
||||||
|
color: rgba(255, 255, 255, 0.82);
|
||||||
|
}
|
||||||
|
|
||||||
|
.cover-empty-title {
|
||||||
|
font-size: 36rpx;
|
||||||
|
font-weight: 900;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cover-empty-desc {
|
||||||
|
font-size: 23rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
opacity: 0.86;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cover-badge {
|
||||||
|
position: absolute;
|
||||||
|
top: 26rpx;
|
||||||
|
left: 28rpx;
|
||||||
|
z-index: 2;
|
||||||
|
padding: 8rpx 20rpx;
|
||||||
|
border-radius: 999rpx;
|
||||||
|
background: rgba(255, 244, 222, 0.88);
|
||||||
|
color: #5b4635;
|
||||||
|
font-size: 22rpx;
|
||||||
|
font-weight: 900;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cover-actions {
|
||||||
|
position: absolute;
|
||||||
|
right: 28rpx;
|
||||||
|
bottom: 26rpx;
|
||||||
|
left: 28rpx;
|
||||||
|
display: flex;
|
||||||
|
gap: 12rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cover-btn,
|
||||||
|
.cover-remove {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
min-height: 64rpx;
|
||||||
|
padding: 0 20rpx;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
font-weight: 900;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cover-btn {
|
||||||
|
flex: 1;
|
||||||
|
background: #fff8ed;
|
||||||
|
color: #6d4d35;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cover-remove {
|
||||||
|
min-width: 150rpx;
|
||||||
|
background: rgba(255, 253, 248, 0.18);
|
||||||
|
color: #fffdf8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-card {
|
||||||
|
margin-top: 24rpx;
|
||||||
|
padding: 12rpx 0;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-header {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 6rpx;
|
||||||
|
padding: 26rpx 26rpx 8rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-kicker {
|
||||||
|
color: #92734f;
|
||||||
|
font-size: 22rpx;
|
||||||
|
font-weight: 900;
|
||||||
|
}
|
||||||
|
|
||||||
|
.field {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
min-height: 108rpx;
|
||||||
|
gap: 18rpx;
|
||||||
|
padding: 12rpx 24rpx;
|
||||||
|
border-bottom: 1rpx solid #eee8df;
|
||||||
|
}
|
||||||
|
|
||||||
|
.field:last-child {
|
||||||
|
border-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.field-column {
|
||||||
|
align-items: stretch;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 12rpx;
|
||||||
|
min-height: 232rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.field-label {
|
||||||
|
flex: 0 0 160rpx;
|
||||||
|
color: #625c55;
|
||||||
|
font-size: 26rpx;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.field-column .field-label {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.field input,
|
||||||
|
.intro-editor {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
min-height: 70rpx;
|
||||||
|
padding: 0 22rpx;
|
||||||
|
border: 1rpx solid #eadfd2;
|
||||||
|
border-radius: 18rpx;
|
||||||
|
background: #fff8f2;
|
||||||
|
color: #3d3128;
|
||||||
|
font-size: 28rpx;
|
||||||
|
line-height: 70rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.intro-editor {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
min-height: 156rpx;
|
||||||
|
padding: 18rpx 22rpx 42rpx;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.intro-editor textarea {
|
||||||
|
width: 100%;
|
||||||
|
height: 104rpx;
|
||||||
|
color: #3d3128;
|
||||||
|
font-size: 26rpx;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.intro-placeholder {
|
||||||
|
color: #b4a79b;
|
||||||
|
}
|
||||||
|
|
||||||
|
.intro-count {
|
||||||
|
position: absolute;
|
||||||
|
right: 22rpx;
|
||||||
|
bottom: 12rpx;
|
||||||
|
color: #b2a396;
|
||||||
|
font-size: 20rpx;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fixed-bottom {
|
||||||
|
display: flex;
|
||||||
|
gap: 14rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bottom-half-btn {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
@@ -3,7 +3,6 @@ const tagsApi = require('../../api/tags')
|
|||||||
const dateUtil = require('../../utils/date')
|
const dateUtil = require('../../utils/date')
|
||||||
const { BRAND_CONFIG } = require('../../utils/config')
|
const { BRAND_CONFIG } = require('../../utils/config')
|
||||||
const { markPlanningRefresh } = require('../../utils/planning-refresh')
|
const { markPlanningRefresh } = require('../../utils/planning-refresh')
|
||||||
const { chooseImageFilePath, uploadObjectFile, resolveUploadedImagePreviewUrl } = require('../../utils/upload')
|
|
||||||
|
|
||||||
const PRESETS = [
|
const PRESETS = [
|
||||||
{ value: 'EVERYDAY', label: '全周营业', workDays: [1, 2, 3, 4, 5, 6, 7], startTime: '10:00', endTime: '22:00' },
|
{ value: 'EVERYDAY', label: '全周营业', workDays: [1, 2, 3, 4, 5, 6, 7], startTime: '10:00', endTime: '22:00' },
|
||||||
@@ -29,13 +28,6 @@ const EXCEPTION_TYPES = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
const DEFAULT_SHOP_INTRO = '专注法式、晕染与手绘设计,适合想要温柔质感的客人。'
|
const DEFAULT_SHOP_INTRO = '专注法式、晕染与手绘设计,适合想要温柔质感的客人。'
|
||||||
const DEFAULT_TAG_STYLE = {
|
|
||||||
textColor: '#333333',
|
|
||||||
bgColor: '#FFFFFF',
|
|
||||||
borderColor: '#E5E5E5',
|
|
||||||
sortOrder: 100,
|
|
||||||
frontVisible: 1
|
|
||||||
}
|
|
||||||
|
|
||||||
function copyWorkDays(days) {
|
function copyWorkDays(days) {
|
||||||
if (Array.isArray(days)) {
|
if (Array.isArray(days)) {
|
||||||
@@ -81,10 +73,6 @@ function resolveFirstImageUrl(urls) {
|
|||||||
return Array.isArray(urls) ? String(urls[0] || '').trim() : ''
|
return Array.isArray(urls) ? String(urls[0] || '').trim() : ''
|
||||||
}
|
}
|
||||||
|
|
||||||
function introLength(value) {
|
|
||||||
return String(value || '').length
|
|
||||||
}
|
|
||||||
|
|
||||||
function normalizeTagOption(tag) {
|
function normalizeTagOption(tag) {
|
||||||
const name = String((tag && (tag.displayName || tag.tagName || tag.name)) || '').trim()
|
const name = String((tag && (tag.displayName || tag.tagName || tag.name)) || '').trim()
|
||||||
if (!name) {
|
if (!name) {
|
||||||
@@ -95,18 +83,15 @@ function normalizeTagOption(tag) {
|
|||||||
name,
|
name,
|
||||||
tagName: (tag && tag.tagName) || name,
|
tagName: (tag && tag.tagName) || name,
|
||||||
displayName: (tag && tag.displayName) || name,
|
displayName: (tag && tag.displayName) || name,
|
||||||
textColor: (tag && tag.textColor) || DEFAULT_TAG_STYLE.textColor,
|
textColor: (tag && tag.textColor) || '#333333',
|
||||||
bgColor: (tag && tag.bgColor) || DEFAULT_TAG_STYLE.bgColor,
|
bgColor: (tag && tag.bgColor) || '#FFFFFF',
|
||||||
borderColor: (tag && tag.borderColor) || DEFAULT_TAG_STYLE.borderColor,
|
borderColor: (tag && tag.borderColor) || '#E5E5E5'
|
||||||
sortOrder: (tag && tag.sortOrder) || DEFAULT_TAG_STYLE.sortOrder,
|
|
||||||
frontVisible: (tag && tag.frontVisible) === 0 ? 0 : DEFAULT_TAG_STYLE.frontVisible
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function normalizeTagOptions(tags) {
|
function normalizeTagOptions(tags) {
|
||||||
const source = Array.isArray(tags) ? tags : []
|
|
||||||
const names = new Set()
|
const names = new Set()
|
||||||
return source
|
return (Array.isArray(tags) ? tags : [])
|
||||||
.map(normalizeTagOption)
|
.map(normalizeTagOption)
|
||||||
.filter(Boolean)
|
.filter(Boolean)
|
||||||
.filter(item => {
|
.filter(item => {
|
||||||
@@ -118,60 +103,83 @@ function normalizeTagOptions(tags) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function resolveCurrentShopId() {
|
function buildWorkDaysText(days) {
|
||||||
const app = getApp()
|
const selected = copyWorkDays(days)
|
||||||
const userInfo = (app && app.globalData && app.globalData.userInfo) || {}
|
if (selected.length === 7) {
|
||||||
return userInfo.shopId || (app && app.globalData && app.globalData.shopId) || ''
|
return '周一至周日'
|
||||||
|
}
|
||||||
|
return selected.map(day => WEEKDAYS.find(item => item.value === day)).filter(Boolean).map(item => item.label).join('、') || '未设置营业日'
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildTagPayload(tagName, sourceTag) {
|
function buildShopPayload(settings, form) {
|
||||||
const shopId = resolveCurrentShopId()
|
const workDays = copyWorkDays(form.scheduleWorkDays)
|
||||||
const payload = {
|
return {
|
||||||
tagName,
|
shopName: settings.shopName || settings.name || '',
|
||||||
textColor: (sourceTag && sourceTag.textColor) || DEFAULT_TAG_STYLE.textColor,
|
description: settings.description || '',
|
||||||
bgColor: (sourceTag && sourceTag.bgColor) || DEFAULT_TAG_STYLE.bgColor,
|
address: settings.address || '',
|
||||||
borderColor: (sourceTag && sourceTag.borderColor) || DEFAULT_TAG_STYLE.borderColor,
|
mapProvider: settings.mapProvider || '',
|
||||||
sortOrder: (sourceTag && sourceTag.sortOrder) || DEFAULT_TAG_STYLE.sortOrder,
|
longitude: settings.longitude,
|
||||||
frontVisible: (sourceTag && sourceTag.frontVisible) === 0 ? 0 : DEFAULT_TAG_STYLE.frontVisible
|
latitude: settings.latitude,
|
||||||
|
businessHours: `${form.startTime}-${form.endTime}`,
|
||||||
|
schedulePresetType: form.schedulePresetType,
|
||||||
|
scheduleWorkDays: encodeWorkDays(workDays),
|
||||||
|
scheduleRemark: String(form.scheduleRemark || '').trim(),
|
||||||
|
coverImageFileId: String(settings.coverImageFileId || '').trim(),
|
||||||
|
imageFileIds: String(settings.imageFileIds || '').trim(),
|
||||||
|
themePrimaryColor: settings.themePrimaryColor || '',
|
||||||
|
themeSecondaryColor: settings.themeSecondaryColor || '',
|
||||||
|
themeAccentColor: settings.themeAccentColor || '',
|
||||||
|
themePageBgColor: settings.themePageBgColor || '',
|
||||||
|
themeCardBgColor: settings.themeCardBgColor || '',
|
||||||
|
themeBackgroundImageFileId: settings.themeBackgroundImageFileId || '',
|
||||||
|
status: settings.status,
|
||||||
|
authorizationStartDate: settings.authorizationStartDate,
|
||||||
|
authorizationDays: settings.authorizationDays,
|
||||||
|
authorizationExpireTime: settings.authorizationExpireTime
|
||||||
}
|
}
|
||||||
if (shopId) {
|
}
|
||||||
payload.shopId = shopId
|
|
||||||
|
function resolveForm(settings) {
|
||||||
|
const hours = String(settings.businessHours || '').split('-')
|
||||||
|
const preset = buildPreset(settings.schedulePresetType || 'EVERYDAY')
|
||||||
|
return {
|
||||||
|
startTime: String(settings.startTime || hours[0] || preset.startTime).slice(0, 5),
|
||||||
|
endTime: String(settings.endTime || hours[1] || preset.endTime).slice(0, 5),
|
||||||
|
schedulePresetType: settings.schedulePresetType || preset.value,
|
||||||
|
scheduleWorkDays: copyWorkDays(settings.scheduleWorkDays || preset.workDays),
|
||||||
|
scheduleRemark: settings.scheduleRemark || ''
|
||||||
}
|
}
|
||||||
return payload
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Page({
|
Page({
|
||||||
data: {
|
data: {
|
||||||
presets: PRESETS,
|
loading: false,
|
||||||
|
loaded: false,
|
||||||
|
saving: false,
|
||||||
|
scheduleSheetVisible: false,
|
||||||
|
activeScheduleTab: 'RULE',
|
||||||
|
shopName: BRAND_CONFIG.defaultShopName,
|
||||||
|
shopDescription: DEFAULT_SHOP_INTRO,
|
||||||
|
coverImagePreviewUrl: '',
|
||||||
|
tagList: [],
|
||||||
|
tagCountText: '暂无标签',
|
||||||
|
scheduleSummary: '营业时间未设置',
|
||||||
|
scheduleRemarkText: '点击设置营业日和营业时间',
|
||||||
|
exceptionCountText: '特殊日期 · 0 条',
|
||||||
|
exceptionSummary: '暂无特殊日期',
|
||||||
|
exceptions: [],
|
||||||
|
settingsSnapshot: {},
|
||||||
presetOptions: buildPresetOptions('EVERYDAY'),
|
presetOptions: buildPresetOptions('EVERYDAY'),
|
||||||
weekdays: WEEKDAYS,
|
|
||||||
weekdayOptions: buildWeekdayOptions([1, 2, 3, 4, 5, 6, 7]),
|
weekdayOptions: buildWeekdayOptions([1, 2, 3, 4, 5, 6, 7]),
|
||||||
exceptionTypes: EXCEPTION_TYPES,
|
exceptionTypes: EXCEPTION_TYPES,
|
||||||
exceptionTypeIndex: 0,
|
exceptionTypeIndex: 0,
|
||||||
exceptionTypeLabel: '休息',
|
exceptionTypeLabel: '休息',
|
||||||
exceptions: [],
|
|
||||||
loading: false,
|
|
||||||
saving: false,
|
|
||||||
tagsLoading: false,
|
|
||||||
tagSaving: false,
|
|
||||||
coverUploading: false,
|
|
||||||
coverImagePreviewUrl: '',
|
|
||||||
introLength: introLength(DEFAULT_SHOP_INTRO),
|
|
||||||
tagList: [],
|
|
||||||
tagForm: {
|
|
||||||
id: '',
|
|
||||||
name: ''
|
|
||||||
},
|
|
||||||
form: {
|
form: {
|
||||||
shopName: BRAND_CONFIG.defaultShopName,
|
|
||||||
startTime: '10:00',
|
startTime: '10:00',
|
||||||
endTime: '22:00',
|
endTime: '22:00',
|
||||||
defaultDuration: 60,
|
|
||||||
rule: DEFAULT_SHOP_INTRO,
|
|
||||||
schedulePresetType: 'EVERYDAY',
|
schedulePresetType: 'EVERYDAY',
|
||||||
scheduleWorkDays: [1, 2, 3, 4, 5, 6, 7],
|
scheduleWorkDays: [1, 2, 3, 4, 5, 6, 7],
|
||||||
scheduleRemark: '',
|
scheduleRemark: ''
|
||||||
coverImageFileId: ''
|
|
||||||
},
|
},
|
||||||
exceptionForm: {
|
exceptionForm: {
|
||||||
workDate: dateUtil.formatDate(new Date()),
|
workDate: dateUtil.formatDate(new Date()),
|
||||||
@@ -186,15 +194,9 @@ Page({
|
|||||||
this.loadSettings()
|
this.loadSettings()
|
||||||
},
|
},
|
||||||
|
|
||||||
async loadTags() {
|
onShow() {
|
||||||
this.setData({ tagsLoading: true })
|
if (this.data.loaded) {
|
||||||
try {
|
this.loadSettings()
|
||||||
const tagsData = await tagsApi.listAll()
|
|
||||||
this.setData({ tagList: normalizeTagOptions(tagsData.list || tagsData || []) })
|
|
||||||
} catch (error) {
|
|
||||||
wx.showToast({ title: error.message || '标签加载失败', icon: 'none' })
|
|
||||||
} finally {
|
|
||||||
this.setData({ tagsLoading: false })
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -206,32 +208,30 @@ Page({
|
|||||||
shopApi.scheduleExceptions(),
|
shopApi.scheduleExceptions(),
|
||||||
tagsApi.listAll()
|
tagsApi.listAll()
|
||||||
])
|
])
|
||||||
const hours = String(settings.businessHours || '').split('-')
|
const form = resolveForm(settings || {})
|
||||||
const preset = buildPreset(settings.schedulePresetType || 'EVERYDAY')
|
const exceptionList = (exceptions || []).map(item => ({
|
||||||
const form = {
|
...item,
|
||||||
...this.data.form,
|
startTime: item.startTime ? String(item.startTime).slice(0, 5) : '',
|
||||||
shopName: settings.shopName || settings.name || this.data.form.shopName,
|
endTime: item.endTime ? String(item.endTime).slice(0, 5) : '',
|
||||||
startTime: String(settings.startTime || hours[0] || preset.startTime).slice(0, 5),
|
summary: buildExceptionSummary(item)
|
||||||
endTime: String(settings.endTime || hours[1] || preset.endTime).slice(0, 5),
|
}))
|
||||||
rule: settings.description || this.data.form.rule,
|
const tagList = normalizeTagOptions(tagsData.list || tagsData || [])
|
||||||
schedulePresetType: settings.schedulePresetType || preset.value,
|
|
||||||
scheduleWorkDays: copyWorkDays(settings.scheduleWorkDays || preset.workDays),
|
|
||||||
scheduleRemark: settings.scheduleRemark || '',
|
|
||||||
coverImageFileId: settings.coverImageFileId || ''
|
|
||||||
}
|
|
||||||
this.setData({
|
this.setData({
|
||||||
form,
|
loaded: true,
|
||||||
introLength: introLength(form.rule),
|
settingsSnapshot: settings || {},
|
||||||
|
shopName: settings.shopName || settings.name || this.data.shopName,
|
||||||
|
shopDescription: settings.description || DEFAULT_SHOP_INTRO,
|
||||||
coverImagePreviewUrl: resolveFirstImageUrl(settings.coverImageUrls),
|
coverImagePreviewUrl: resolveFirstImageUrl(settings.coverImageUrls),
|
||||||
|
tagList,
|
||||||
|
tagCountText: tagList.length ? `${tagList.length} 个标签` : '暂无标签',
|
||||||
|
scheduleSummary: `${buildWorkDaysText(form.scheduleWorkDays)} · ${form.startTime} - ${form.endTime}`,
|
||||||
|
scheduleRemarkText: form.scheduleRemark || '全周营业规则',
|
||||||
|
exceptionCountText: `特殊日期 · ${exceptionList.length} 条`,
|
||||||
|
exceptionSummary: exceptionList[0] ? exceptionList[0].summary : '暂无特殊日期',
|
||||||
|
exceptions: exceptionList,
|
||||||
|
form,
|
||||||
presetOptions: buildPresetOptions(form.schedulePresetType),
|
presetOptions: buildPresetOptions(form.schedulePresetType),
|
||||||
weekdayOptions: buildWeekdayOptions(form.scheduleWorkDays),
|
weekdayOptions: buildWeekdayOptions(form.scheduleWorkDays)
|
||||||
exceptions: (exceptions || []).map(item => ({
|
|
||||||
...item,
|
|
||||||
startTime: item.startTime ? String(item.startTime).slice(0, 5) : '',
|
|
||||||
endTime: item.endTime ? String(item.endTime).slice(0, 5) : '',
|
|
||||||
summary: buildExceptionSummary(item)
|
|
||||||
})),
|
|
||||||
tagList: normalizeTagOptions(tagsData.list || tagsData || [])
|
|
||||||
})
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
wx.showToast({ title: error.message || '店铺设置加载失败', icon: 'none' })
|
wx.showToast({ title: error.message || '店铺设置加载失败', icon: 'none' })
|
||||||
@@ -240,146 +240,37 @@ Page({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
editProfile() {
|
||||||
|
wx.navigateTo({ url: '/pages/shop-profile-edit/index' })
|
||||||
|
},
|
||||||
|
|
||||||
|
editTags() {
|
||||||
|
wx.navigateTo({ url: '/pages/shop-tags/index' })
|
||||||
|
},
|
||||||
|
|
||||||
|
openScheduleSheet(event) {
|
||||||
|
this.setData({
|
||||||
|
scheduleSheetVisible: true,
|
||||||
|
activeScheduleTab: event.currentTarget.dataset.tab || 'RULE'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
closeScheduleSheet() {
|
||||||
|
if (this.data.saving) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.setData({ scheduleSheetVisible: false })
|
||||||
|
},
|
||||||
|
|
||||||
|
stopPropagation() {},
|
||||||
|
|
||||||
|
switchScheduleTab(event) {
|
||||||
|
this.setData({ activeScheduleTab: event.currentTarget.dataset.tab || 'RULE' })
|
||||||
|
},
|
||||||
|
|
||||||
onInput(event) {
|
onInput(event) {
|
||||||
const field = event.currentTarget.dataset.field
|
const field = event.currentTarget.dataset.field
|
||||||
const value = event.detail.value
|
this.setData({ [`form.${field}`]: event.detail.value })
|
||||||
const nextData = { [`form.${field}`]: value }
|
|
||||||
if (field === 'rule') {
|
|
||||||
nextData.introLength = introLength(value)
|
|
||||||
}
|
|
||||||
this.setData(nextData)
|
|
||||||
},
|
|
||||||
|
|
||||||
onTagInput(event) {
|
|
||||||
this.setData({ 'tagForm.name': event.detail.value })
|
|
||||||
},
|
|
||||||
|
|
||||||
editTag(event) {
|
|
||||||
const tagId = String(event.currentTarget.dataset.id || '')
|
|
||||||
const tag = this.data.tagList.find(item => String(item.id) === tagId)
|
|
||||||
if (!tag) {
|
|
||||||
wx.showToast({ title: '标签不存在', icon: 'none' })
|
|
||||||
return
|
|
||||||
}
|
|
||||||
this.setData({
|
|
||||||
tagForm: {
|
|
||||||
id: tag.id,
|
|
||||||
name: tag.tagName || tag.name
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
clearTagForm() {
|
|
||||||
this.setData({
|
|
||||||
tagForm: {
|
|
||||||
id: '',
|
|
||||||
name: ''
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
async saveTag() {
|
|
||||||
if (this.data.tagSaving) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const tagName = String(this.data.tagForm.name || '').trim()
|
|
||||||
if (!tagName) {
|
|
||||||
wx.showToast({ title: '请输入标签名称', icon: 'none' })
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const tagId = this.data.tagForm.id
|
|
||||||
const editingTag = tagId
|
|
||||||
? this.data.tagList.find(item => String(item.id) === String(tagId))
|
|
||||||
: null
|
|
||||||
this.setData({ tagSaving: true })
|
|
||||||
try {
|
|
||||||
if (tagId) {
|
|
||||||
await tagsApi.update(tagId, buildTagPayload(tagName, editingTag))
|
|
||||||
wx.showToast({ title: '标签已更新', icon: 'success' })
|
|
||||||
} else {
|
|
||||||
await tagsApi.create(buildTagPayload(tagName, null))
|
|
||||||
wx.showToast({ title: '标签已新增', icon: 'success' })
|
|
||||||
}
|
|
||||||
this.clearTagForm()
|
|
||||||
await this.loadTags()
|
|
||||||
} catch (error) {
|
|
||||||
wx.showToast({ title: error.message || '标签保存失败', icon: 'none' })
|
|
||||||
} finally {
|
|
||||||
this.setData({ tagSaving: false })
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
deleteTag(event) {
|
|
||||||
const tagId = String(event.currentTarget.dataset.id || '')
|
|
||||||
const tag = this.data.tagList.find(item => String(item.id) === tagId)
|
|
||||||
if (!tag) {
|
|
||||||
wx.showToast({ title: '标签不存在', icon: 'none' })
|
|
||||||
return
|
|
||||||
}
|
|
||||||
wx.showModal({
|
|
||||||
title: '删除标签',
|
|
||||||
content: `确认删除标签“${tag.name}”?`,
|
|
||||||
confirmText: '删除',
|
|
||||||
confirmColor: '#d98d8d',
|
|
||||||
success: async result => {
|
|
||||||
if (!result.confirm) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
this.setData({ tagSaving: true })
|
|
||||||
try {
|
|
||||||
await tagsApi.delete(tag.id)
|
|
||||||
if (String(this.data.tagForm.id) === String(tag.id)) {
|
|
||||||
this.clearTagForm()
|
|
||||||
}
|
|
||||||
await this.loadTags()
|
|
||||||
wx.showToast({ title: '标签已删除', icon: 'success' })
|
|
||||||
} catch (error) {
|
|
||||||
wx.showToast({ title: error.message || '标签删除失败', icon: 'none' })
|
|
||||||
} finally {
|
|
||||||
this.setData({ tagSaving: false })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
async chooseCoverImage() {
|
|
||||||
if (this.data.coverUploading || this.data.saving) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
const filePath = await chooseImageFilePath()
|
|
||||||
if (!filePath) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
this.setData({ coverUploading: true })
|
|
||||||
const uploadResult = await uploadObjectFile(filePath)
|
|
||||||
const fileId = String(uploadResult && uploadResult.id ? uploadResult.id : '').trim()
|
|
||||||
if (!fileId) {
|
|
||||||
throw new Error('店铺主图上传失败:上传接口未返回文件ID')
|
|
||||||
}
|
|
||||||
this.setData({
|
|
||||||
'form.coverImageFileId': fileId,
|
|
||||||
coverImagePreviewUrl: resolveUploadedImagePreviewUrl(uploadResult, filePath)
|
|
||||||
})
|
|
||||||
} catch (error) {
|
|
||||||
wx.showToast({ title: error.message || '店铺主图上传失败', icon: 'none' })
|
|
||||||
} finally {
|
|
||||||
this.setData({ coverUploading: false })
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
removeCoverImage() {
|
|
||||||
if (this.data.coverUploading || this.data.saving) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
this.setData({
|
|
||||||
'form.coverImageFileId': '',
|
|
||||||
coverImagePreviewUrl: ''
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
onExceptionInput(event) {
|
|
||||||
this.setData({ [`exceptionForm.${event.currentTarget.dataset.field}`]: event.detail.value })
|
|
||||||
},
|
},
|
||||||
|
|
||||||
selectPreset(event) {
|
selectPreset(event) {
|
||||||
@@ -401,8 +292,9 @@ Page({
|
|||||||
toggleWeekday(event) {
|
toggleWeekday(event) {
|
||||||
const day = Number(event.currentTarget.dataset.value)
|
const day = Number(event.currentTarget.dataset.value)
|
||||||
const workDays = copyWorkDays(this.data.form.scheduleWorkDays)
|
const workDays = copyWorkDays(this.data.form.scheduleWorkDays)
|
||||||
const exists = workDays.includes(day)
|
const nextDays = workDays.includes(day)
|
||||||
const nextDays = exists ? workDays.filter(item => item !== day) : [...workDays, day].sort()
|
? workDays.filter(item => item !== day)
|
||||||
|
: [...workDays, day].sort()
|
||||||
this.setData({
|
this.setData({
|
||||||
'form.schedulePresetType': 'CUSTOM',
|
'form.schedulePresetType': 'CUSTOM',
|
||||||
'form.scheduleWorkDays': nextDays,
|
'form.scheduleWorkDays': nextDays,
|
||||||
@@ -427,6 +319,10 @@ Page({
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onExceptionInput(event) {
|
||||||
|
this.setData({ [`exceptionForm.${event.currentTarget.dataset.field}`]: event.detail.value })
|
||||||
|
},
|
||||||
|
|
||||||
onExceptionDateChange(event) {
|
onExceptionDateChange(event) {
|
||||||
this.setData({ 'exceptionForm.workDate': event.detail.value })
|
this.setData({ 'exceptionForm.workDate': event.detail.value })
|
||||||
},
|
},
|
||||||
@@ -449,31 +345,9 @@ Page({
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
explainDefaultDuration() {
|
async saveSchedule() {
|
||||||
wx.showModal({
|
|
||||||
title: '默认时长',
|
|
||||||
content: '用于手动创建预约或未选择作品时的默认服务时长,会影响可约时间校验和预约结束时间估算。',
|
|
||||||
showCancel: false,
|
|
||||||
confirmText: '知道了'
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
explainShopIntro() {
|
|
||||||
wx.showModal({
|
|
||||||
title: '门店介绍',
|
|
||||||
content: '这里会保存为门店介绍,并展示在用户端门店详情。预约时间、容量和冲突校验仍由店铺排班、特殊日期和员工排班控制。',
|
|
||||||
showCancel: false,
|
|
||||||
confirmText: '知道了'
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
async save() {
|
|
||||||
const form = this.data.form
|
const form = this.data.form
|
||||||
const workDays = copyWorkDays(form.scheduleWorkDays)
|
const workDays = copyWorkDays(form.scheduleWorkDays)
|
||||||
if (!form.shopName) {
|
|
||||||
wx.showToast({ title: '请填写店铺名称', icon: 'none' })
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (!workDays.length) {
|
if (!workDays.length) {
|
||||||
wx.showToast({ title: '请选择营业日', icon: 'none' })
|
wx.showToast({ title: '请选择营业日', icon: 'none' })
|
||||||
return
|
return
|
||||||
@@ -484,23 +358,13 @@ Page({
|
|||||||
}
|
}
|
||||||
this.setData({ saving: true })
|
this.setData({ saving: true })
|
||||||
try {
|
try {
|
||||||
await shopApi.saveSettings({
|
await shopApi.saveSettings(buildShopPayload(this.data.settingsSnapshot, form))
|
||||||
shopName: form.shopName,
|
|
||||||
name: form.shopName,
|
|
||||||
startTime: form.startTime,
|
|
||||||
endTime: form.endTime,
|
|
||||||
businessHours: `${form.startTime}-${form.endTime}`,
|
|
||||||
description: form.rule,
|
|
||||||
schedulePresetType: form.schedulePresetType,
|
|
||||||
scheduleWorkDays: encodeWorkDays(workDays),
|
|
||||||
scheduleRemark: String(form.scheduleRemark || '').trim(),
|
|
||||||
coverImageFileId: String(form.coverImageFileId || '').trim()
|
|
||||||
})
|
|
||||||
markPlanningRefresh()
|
markPlanningRefresh()
|
||||||
wx.showToast({ title: '已保存', icon: 'success' })
|
wx.showToast({ title: '排班已保存', icon: 'success' })
|
||||||
|
this.setData({ scheduleSheetVisible: false })
|
||||||
await this.loadSettings()
|
await this.loadSettings()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
wx.showToast({ title: error.message || '保存失败', icon: 'none' })
|
wx.showToast({ title: error.message || '排班保存失败', icon: 'none' })
|
||||||
} finally {
|
} finally {
|
||||||
this.setData({ saving: false })
|
this.setData({ saving: false })
|
||||||
}
|
}
|
||||||
@@ -527,6 +391,7 @@ Page({
|
|||||||
})
|
})
|
||||||
markPlanningRefresh()
|
markPlanningRefresh()
|
||||||
wx.showToast({ title: '特殊日期已保存', icon: 'success' })
|
wx.showToast({ title: '特殊日期已保存', icon: 'success' })
|
||||||
|
this.setData({ scheduleSheetVisible: false })
|
||||||
await this.loadSettings()
|
await this.loadSettings()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
wx.showToast({ title: error.message || '特殊日期保存失败', icon: 'none' })
|
wx.showToast({ title: error.message || '特殊日期保存失败', icon: 'none' })
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<block wx:else>
|
<block wx:else>
|
||||||
<view class="page-heading">
|
<view class="page-heading">
|
||||||
<text class="page-title">店铺设置</text>
|
<text class="page-title">店铺设置</text>
|
||||||
<text class="page-subtitle">把门店气质写进第一眼</text>
|
<text class="page-subtitle">先看见门店状态,再按需调整细节。</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="cover-card">
|
<view class="cover-card">
|
||||||
@@ -14,119 +14,167 @@
|
|||||||
<text class="cover-empty-title">店铺封面</text>
|
<text class="cover-empty-title">店铺封面</text>
|
||||||
<text class="cover-empty-desc">上传一张能代表风格的作品图</text>
|
<text class="cover-empty-desc">上传一张能代表风格的作品图</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="cover-badge">门店封面</view>
|
<view class="cover-badge">门店档案</view>
|
||||||
<view class="cover-shade">
|
<view class="cover-shade">
|
||||||
<view class="cover-copy">
|
<view class="cover-copy">
|
||||||
<text class="cover-title">{{form.shopName || '店铺主图'}}</text>
|
<text class="cover-title">{{shopName || '店铺主图'}}</text>
|
||||||
<text class="cover-desc">{{form.rule || '色彩、手作与细节管理的预约空间'}}</text>
|
<text class="cover-desc">{{shopDescription || '色彩、手作与细节管理的预约空间'}}</text>
|
||||||
</view>
|
|
||||||
<view class="cover-actions">
|
|
||||||
<button class="cover-btn" loading="{{coverUploading}}" bindtap="chooseCoverImage">更换主图</button>
|
|
||||||
<button wx:if="{{coverImagePreviewUrl}}" class="cover-remove" bindtap="removeCoverImage">移除</button>
|
|
||||||
</view>
|
</view>
|
||||||
|
<button class="cover-btn" bindtap="editProfile">修改档案</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="card form-card">
|
<view id="shop-profile-card" class="section">
|
||||||
<view class="form-header">
|
<view class="section-head">
|
||||||
<view>
|
<view>
|
||||||
<text class="form-kicker">门店档案</text>
|
<text class="section-title">店铺档案</text>
|
||||||
<text class="form-title">展示给客户看的第一段介绍</text>
|
<text class="section-subtitle">展示给客户看的第一段介绍</text>
|
||||||
</view>
|
</view>
|
||||||
|
<text class="section-link" bindtap="editProfile">修改</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="field"><text class="field-label">店铺名称</text><input value="{{form.shopName}}" data-field="shopName" bindinput="onInput" placeholder="请输入店铺名称" /></view>
|
<view class="card profile-summary-card" bindtap="editProfile">
|
||||||
<view class="field">
|
<view class="summary-row">
|
||||||
<view class="label-with-help">
|
<text class="summary-label">店铺名称</text>
|
||||||
<text class="field-label">默认时长</text>
|
<text class="summary-value">{{shopName || '未设置'}}</text>
|
||||||
<text class="help-badge" catchtap="explainDefaultDuration">?</text>
|
|
||||||
</view>
|
</view>
|
||||||
<input type="number" value="{{form.defaultDuration}}" data-field="defaultDuration" bindinput="onInput" />
|
<view class="summary-row summary-row-last">
|
||||||
<text class="muted">分钟</text>
|
<text class="summary-label">门店介绍</text>
|
||||||
</view>
|
<text class="summary-value summary-description">{{shopDescription || '暂未填写门店介绍'}}</text>
|
||||||
<view class="field">
|
|
||||||
<view class="label-with-help">
|
|
||||||
<text class="field-label">门店介绍</text>
|
|
||||||
<text class="help-badge" catchtap="explainShopIntro">?</text>
|
|
||||||
</view>
|
|
||||||
<view class="intro-editor">
|
|
||||||
<textarea
|
|
||||||
value="{{form.rule}}"
|
|
||||||
data-field="rule"
|
|
||||||
bindinput="onInput"
|
|
||||||
maxlength="120"
|
|
||||||
auto-height="{{false}}"
|
|
||||||
placeholder="写下门店风格、擅长方向、服务氛围"
|
|
||||||
placeholder-class="intro-placeholder"
|
|
||||||
></textarea>
|
|
||||||
<text class="intro-count">{{introLength}}/120</text>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="section">
|
<view id="shop-tag-card" class="section">
|
||||||
<view class="section-title">标签设置</view>
|
<view class="section-head">
|
||||||
<view class="card tag-setting-card">
|
<view>
|
||||||
<view class="tag-form-row">
|
<text class="section-title">店铺标签</text>
|
||||||
<input class="tag-input" value="{{tagForm.name}}" bindinput="onTagInput" placeholder="输入标签名称" />
|
<text class="section-subtitle">{{tagCountText}}</text>
|
||||||
<button class="secondary-btn tag-save-btn" loading="{{tagSaving}}" disabled="{{tagSaving || tagsLoading}}" bindtap="saveTag">{{tagForm.id ? '更新' : '新增'}}</button>
|
|
||||||
</view>
|
</view>
|
||||||
<view wx:if="{{tagForm.id}}" class="tag-edit-tip">
|
<text class="section-link" bindtap="editTags">管理</text>
|
||||||
<text>正在编辑“{{tagForm.name}}”</text>
|
</view>
|
||||||
<text class="tag-clear" bindtap="clearTagForm">取消</text>
|
<view class="card tag-summary-card" bindtap="editTags">
|
||||||
|
<view wx:if="{{tagList.length}}" class="tag-cloud">
|
||||||
|
<text
|
||||||
|
wx:for="{{tagList}}"
|
||||||
|
wx:key="id"
|
||||||
|
class="tag-preview"
|
||||||
|
style="background: {{item.bgColor}}; color: {{item.textColor}}; border-color: {{item.borderColor}};"
|
||||||
|
>{{item.name}}</text>
|
||||||
|
<text class="tag-add">+</text>
|
||||||
</view>
|
</view>
|
||||||
<view wx:if="{{tagsLoading}}" class="tag-empty">标签加载中</view>
|
<view wx:else class="empty-inline">还没有标签,点击添加门店特色</view>
|
||||||
<view wx:elif="{{tagList.length}}" class="tag-list">
|
<view class="summary-action-row">
|
||||||
<view wx:for="{{tagList}}" wx:key="id" class="tag-item">
|
<text>用于预约时快速选择和展示</text>
|
||||||
<view class="tag-preview" style="background: {{item.bgColor}}; color: {{item.textColor}}; border-color: {{item.borderColor}};">{{item.name}}</view>
|
<text class="summary-arrow">›</text>
|
||||||
<view class="tag-actions">
|
</view>
|
||||||
<text data-id="{{item.id}}" bindtap="editTag">编辑</text>
|
</view>
|
||||||
<text class="danger" data-id="{{item.id}}" bindtap="deleteTag">删除</text>
|
</view>
|
||||||
</view>
|
|
||||||
|
<view id="shop-schedule-card" class="section">
|
||||||
|
<view class="section-head">
|
||||||
|
<view>
|
||||||
|
<text class="section-title">营业安排</text>
|
||||||
|
<text class="section-subtitle">排班与特殊日期合并管理</text>
|
||||||
|
</view>
|
||||||
|
<text class="section-link" data-tab="RULE" bindtap="openScheduleSheet">修改</text>
|
||||||
|
</view>
|
||||||
|
<view class="card schedule-summary-card" data-tab="RULE" bindtap="openScheduleSheet">
|
||||||
|
<view class="schedule-summary-row">
|
||||||
|
<view class="summary-icon schedule-icon">◷</view>
|
||||||
|
<view class="summary-main">
|
||||||
|
<text class="summary-value">{{scheduleSummary}}</text>
|
||||||
|
<text class="summary-meta">{{scheduleRemarkText}}</text>
|
||||||
</view>
|
</view>
|
||||||
|
<text class="summary-arrow">›</text>
|
||||||
</view>
|
</view>
|
||||||
<view wx:else class="tag-empty">暂无标签,可用于新建预约时快速选择</view>
|
<view id="shop-exception-card" class="schedule-summary-row special-summary-row" data-tab="EXCEPTION" bindtap="openScheduleSheet">
|
||||||
</view>
|
<view class="summary-icon exception-icon">●</view>
|
||||||
</view>
|
<view class="summary-main">
|
||||||
|
<text class="summary-value">{{exceptionCountText}}</text>
|
||||||
<view class="section">
|
<text class="summary-meta">{{exceptionSummary}}</text>
|
||||||
<view class="section-title">店铺排班</view>
|
|
||||||
<view class="card rule-card">
|
|
||||||
<view class="preset-grid">
|
|
||||||
<view wx:for="{{presetOptions}}" wx:key="value" class="preset-chip {{item.active ? 'active' : ''}}" data-value="{{item.value}}" bindtap="selectPreset">{{item.label}}</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="field-block">
|
|
||||||
<view class="field-title">营业日</view>
|
|
||||||
<view class="weekday-grid">
|
|
||||||
<view wx:for="{{weekdayOptions}}" wx:key="value" class="weekday-chip {{item.active ? 'active' : ''}}" data-value="{{item.value}}" bindtap="toggleWeekday">{{item.label}}</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
<text class="summary-arrow">›</text>
|
||||||
|
|
||||||
<view class="field"><text class="field-label">营业开始</text><picker mode="time" value="{{form.startTime}}" bindchange="onStartChange"><view class="field-value">{{form.startTime}}</view></picker></view>
|
|
||||||
<view class="field"><text class="field-label">营业结束</text><picker mode="time" value="{{form.endTime}}" bindchange="onEndChange"><view class="field-value">{{form.endTime}}</view></picker></view>
|
|
||||||
<view class="field"><text class="field-label">排班备注</text><input value="{{form.scheduleRemark}}" data-field="scheduleRemark" bindinput="onInput" placeholder="可选" /></view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view class="section">
|
|
||||||
<view class="section-title">特殊日期</view>
|
|
||||||
<view class="card rule-card">
|
|
||||||
<view class="field"><text class="field-label">日期</text><picker mode="date" value="{{exceptionForm.workDate}}" bindchange="onExceptionDateChange"><view class="field-value">{{exceptionForm.workDate}}</view></picker></view>
|
|
||||||
<view class="field"><text class="field-label">类型</text><picker range="{{exceptionTypes}}" range-key="label" value="{{exceptionTypeIndex}}" bindchange="onExceptionTypeChange"><view class="field-value">{{exceptionTypeLabel}}</view></picker></view>
|
|
||||||
<view wx:if="{{exceptionForm.exceptionType !== 'REST'}}" class="field"><text class="field-label">开始时间</text><picker mode="time" value="{{exceptionForm.startTime}}" bindchange="onExceptionStartChange"><view class="field-value">{{exceptionForm.startTime}}</view></picker></view>
|
|
||||||
<view wx:if="{{exceptionForm.exceptionType !== 'REST'}}" class="field"><text class="field-label">结束时间</text><picker mode="time" value="{{exceptionForm.endTime}}" bindchange="onExceptionEndChange"><view class="field-value">{{exceptionForm.endTime}}</view></picker></view>
|
|
||||||
<view class="field"><text class="field-label">备注</text><input value="{{exceptionForm.remark}}" data-field="remark" bindinput="onExceptionInput" placeholder="可选" /></view>
|
|
||||||
<button class="secondary-btn exception-btn" loading="{{saving}}" bindtap="saveException">保存特殊日期</button>
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<view wx:if="{{exceptions.length}}" class="exception-list">
|
|
||||||
<view wx:for="{{exceptions}}" wx:key="id" class="card exception-card">
|
|
||||||
<text>{{item.summary}}</text>
|
|
||||||
<text wx:if="{{item.remark}}" class="exception-remark">{{item.remark}}</text>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</block>
|
</block>
|
||||||
|
|
||||||
<view class="fixed-bottom"><button class="primary-btn" loading="{{saving}}" bindtap="save">保存设置</button></view>
|
<view wx:if="{{scheduleSheetVisible}}" class="sheet-mask" catchtap="closeScheduleSheet">
|
||||||
|
<view id="schedule-sheet" class="schedule-sheet" catchtap="stopPropagation">
|
||||||
|
<view class="sheet-handle"></view>
|
||||||
|
<view class="sheet-head">
|
||||||
|
<text class="sheet-title">营业安排</text>
|
||||||
|
<text class="sheet-close" bindtap="closeScheduleSheet">×</text>
|
||||||
|
</view>
|
||||||
|
<view class="sheet-tabs">
|
||||||
|
<view class="sheet-tab {{activeScheduleTab === 'RULE' ? 'active' : ''}}" data-tab="RULE" bindtap="switchScheduleTab">常规排班</view>
|
||||||
|
<view class="sheet-tab {{activeScheduleTab === 'EXCEPTION' ? 'active' : ''}}" data-tab="EXCEPTION" bindtap="switchScheduleTab">特殊日期</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<block wx:if="{{activeScheduleTab === 'RULE'}}">
|
||||||
|
<view class="sheet-field-block">
|
||||||
|
<text class="sheet-field-title">营业模式</text>
|
||||||
|
<view class="preset-grid">
|
||||||
|
<view wx:for="{{presetOptions}}" wx:key="value" class="preset-chip {{item.active ? 'active' : ''}}" data-value="{{item.value}}" bindtap="selectPreset">{{item.label}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="sheet-field-block">
|
||||||
|
<text class="sheet-field-title">营业日</text>
|
||||||
|
<view class="weekday-grid">
|
||||||
|
<view wx:for="{{weekdayOptions}}" wx:key="value" class="weekday-chip {{item.active ? 'active' : ''}}" data-value="{{item.value}}" bindtap="toggleWeekday">{{item.label}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="sheet-field">
|
||||||
|
<text class="sheet-field-label">营业开始</text>
|
||||||
|
<picker mode="time" value="{{form.startTime}}" bindchange="onStartChange"><view class="sheet-field-value">{{form.startTime}}</view></picker>
|
||||||
|
</view>
|
||||||
|
<view class="sheet-field">
|
||||||
|
<text class="sheet-field-label">营业结束</text>
|
||||||
|
<picker mode="time" value="{{form.endTime}}" bindchange="onEndChange"><view class="sheet-field-value">{{form.endTime}}</view></picker>
|
||||||
|
</view>
|
||||||
|
<view class="sheet-field">
|
||||||
|
<text class="sheet-field-label">排班备注</text>
|
||||||
|
<input value="{{form.scheduleRemark}}" data-field="scheduleRemark" bindinput="onInput" placeholder="可选" />
|
||||||
|
</view>
|
||||||
|
<button class="primary-btn sheet-save" loading="{{saving}}" disabled="{{saving}}" bindtap="saveSchedule">保存排班</button>
|
||||||
|
</block>
|
||||||
|
|
||||||
|
<block wx:else>
|
||||||
|
<view class="sheet-field">
|
||||||
|
<text class="sheet-field-label">日期</text>
|
||||||
|
<picker mode="date" value="{{exceptionForm.workDate}}" bindchange="onExceptionDateChange"><view class="sheet-field-value">{{exceptionForm.workDate}}</view></picker>
|
||||||
|
</view>
|
||||||
|
<view class="sheet-field">
|
||||||
|
<text class="sheet-field-label">类型</text>
|
||||||
|
<picker range="{{exceptionTypes}}" range-key="label" value="{{exceptionTypeIndex}}" bindchange="onExceptionTypeChange"><view class="sheet-field-value">{{exceptionTypeLabel}}</view></picker>
|
||||||
|
</view>
|
||||||
|
<view wx:if="{{exceptionForm.exceptionType !== 'REST'}}" class="sheet-field">
|
||||||
|
<text class="sheet-field-label">开始时间</text>
|
||||||
|
<picker mode="time" value="{{exceptionForm.startTime}}" bindchange="onExceptionStartChange"><view class="sheet-field-value">{{exceptionForm.startTime}}</view></picker>
|
||||||
|
</view>
|
||||||
|
<view wx:if="{{exceptionForm.exceptionType !== 'REST'}}" class="sheet-field">
|
||||||
|
<text class="sheet-field-label">结束时间</text>
|
||||||
|
<picker mode="time" value="{{exceptionForm.endTime}}" bindchange="onExceptionEndChange"><view class="sheet-field-value">{{exceptionForm.endTime}}</view></picker>
|
||||||
|
</view>
|
||||||
|
<view class="sheet-field">
|
||||||
|
<text class="sheet-field-label">备注</text>
|
||||||
|
<input value="{{exceptionForm.remark}}" data-field="remark" bindinput="onExceptionInput" placeholder="可选" />
|
||||||
|
</view>
|
||||||
|
<button class="primary-btn sheet-save" loading="{{saving}}" disabled="{{saving}}" bindtap="saveException">保存特殊日期</button>
|
||||||
|
<view class="exception-history">
|
||||||
|
<view class="exception-history-head">
|
||||||
|
<text>已配置日期</text>
|
||||||
|
<text>{{exceptions.length}} 条</text>
|
||||||
|
</view>
|
||||||
|
<view wx:if="{{exceptions.length}}" class="exception-history-list">
|
||||||
|
<view wx:for="{{exceptions}}" wx:key="id" class="exception-history-item">
|
||||||
|
<text>{{item.summary}}</text>
|
||||||
|
<text wx:if="{{item.remark}}" class="exception-history-remark">{{item.remark}}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view wx:else class="empty-inline">暂无特殊日期</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
.page {
|
.page {
|
||||||
background:
|
background:
|
||||||
linear-gradient(180deg, rgba(255, 250, 242, 0.96), rgba(247, 240, 232, 0.96)),
|
linear-gradient(180deg, rgba(255, 250, 242, 0.96), rgba(247, 240, 232, 0.96)),
|
||||||
@@ -19,16 +18,22 @@
|
|||||||
line-height: 1.25;
|
line-height: 1.25;
|
||||||
}
|
}
|
||||||
|
|
||||||
.page-subtitle {
|
.page-subtitle,
|
||||||
|
.section-subtitle {
|
||||||
color: #8a796a;
|
color: #8a796a;
|
||||||
font-size: 23rpx;
|
font-size: 23rpx;
|
||||||
line-height: 1.4;
|
line-height: 1.4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.loading-state {
|
||||||
|
padding: 48rpx 24rpx;
|
||||||
|
color: #7b7167;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
.cover-card {
|
.cover-card {
|
||||||
position: relative;
|
position: relative;
|
||||||
height: 340rpx;
|
height: 340rpx;
|
||||||
margin-bottom: 26rpx;
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border-radius: 28rpx;
|
border-radius: 28rpx;
|
||||||
background:
|
background:
|
||||||
@@ -123,222 +128,120 @@
|
|||||||
-webkit-line-clamp: 2;
|
-webkit-line-clamp: 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cover-actions {
|
.cover-btn {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex: 0 0 auto;
|
flex: 0 0 auto;
|
||||||
flex-direction: column;
|
|
||||||
gap: 10rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.cover-btn,
|
|
||||||
.cover-remove {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
min-width: 164rpx;
|
min-width: 164rpx;
|
||||||
min-height: 62rpx;
|
min-height: 62rpx;
|
||||||
padding: 0 20rpx;
|
padding: 0 20rpx;
|
||||||
border-radius: 20rpx;
|
border-radius: 20rpx;
|
||||||
|
background: #fff8ed;
|
||||||
|
color: #6d4d35;
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
font-weight: 900;
|
font-weight: 900;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cover-btn {
|
.section {
|
||||||
background: #fff8ed;
|
margin-top: 26rpx;
|
||||||
color: #6d4d35;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.cover-remove {
|
.section-head {
|
||||||
background: rgba(255, 253, 248, 0.18);
|
|
||||||
color: #fffdf8;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-card,
|
|
||||||
.rule-card {
|
|
||||||
padding: 12rpx 0;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-card {
|
|
||||||
box-shadow: 0 18rpx 36rpx rgba(83, 64, 44, 0.08);
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-header {
|
|
||||||
display: flex;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
padding: 26rpx 26rpx 8rpx;
|
gap: 16rpx;
|
||||||
|
margin: 0 4rpx 16rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-header view {
|
.section-head view {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 6rpx;
|
gap: 6rpx;
|
||||||
}
|
|
||||||
|
|
||||||
.form-kicker {
|
|
||||||
color: #92734f;
|
|
||||||
font-size: 22rpx;
|
|
||||||
font-weight: 900;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-title {
|
|
||||||
color: #8d8175;
|
|
||||||
font-size: 23rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.field {
|
|
||||||
min-height: 108rpx;
|
|
||||||
padding: 12rpx 24rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.field-label,
|
|
||||||
.label-with-help {
|
|
||||||
width: 180rpx;
|
|
||||||
min-width: 180rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.field input,
|
|
||||||
.field-value,
|
|
||||||
.intro-editor {
|
|
||||||
min-height: 70rpx;
|
|
||||||
padding: 0 22rpx;
|
|
||||||
border: 1rpx solid #eadfd2;
|
|
||||||
border-radius: 18rpx;
|
|
||||||
background: #fff8f2;
|
|
||||||
line-height: 70rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.intro-editor {
|
|
||||||
position: relative;
|
|
||||||
flex: 1;
|
|
||||||
min-height: 156rpx;
|
|
||||||
padding: 18rpx 22rpx 42rpx;
|
|
||||||
line-height: 1.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
.intro-editor textarea {
|
|
||||||
width: 100%;
|
|
||||||
height: 104rpx;
|
|
||||||
color: #3d3128;
|
|
||||||
font-size: 26rpx;
|
|
||||||
line-height: 1.5;
|
|
||||||
}
|
|
||||||
|
|
||||||
.intro-placeholder {
|
|
||||||
color: #b4a79b;
|
|
||||||
}
|
|
||||||
|
|
||||||
.intro-count {
|
|
||||||
position: absolute;
|
|
||||||
right: 22rpx;
|
|
||||||
bottom: 12rpx;
|
|
||||||
color: #b2a396;
|
|
||||||
font-size: 20rpx;
|
|
||||||
line-height: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.label-with-help {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.label-with-help .field-label {
|
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.help-badge {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
width: 28rpx;
|
|
||||||
height: 28rpx;
|
|
||||||
margin-left: 8rpx;
|
|
||||||
border-radius: 50%;
|
|
||||||
background: #e5eee9;
|
|
||||||
color: #4e7165;
|
|
||||||
font-size: 20rpx;
|
|
||||||
font-weight: 800;
|
|
||||||
line-height: 28rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.loading-state {
|
|
||||||
padding: 48rpx 24rpx;
|
|
||||||
color: #7b7167;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.section {
|
|
||||||
margin-top: 24rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.section-title {
|
.section-title {
|
||||||
margin: 0 0 16rpx;
|
|
||||||
color: #3f382f;
|
color: #3f382f;
|
||||||
font-size: 30rpx;
|
font-size: 30rpx;
|
||||||
font-weight: 800;
|
font-weight: 800;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tag-setting-card {
|
.section-subtitle {
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 18rpx;
|
|
||||||
padding: 20rpx 24rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tag-form-row {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: minmax(0, 1fr) 150rpx;
|
|
||||||
gap: 12rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tag-input {
|
|
||||||
min-width: 0;
|
|
||||||
height: 70rpx;
|
|
||||||
padding: 0 18rpx;
|
|
||||||
border: 1rpx solid #eadfd2;
|
|
||||||
border-radius: 14rpx;
|
|
||||||
background: #fff8f2;
|
|
||||||
color: #3d3128;
|
|
||||||
font-size: 26rpx;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tag-save-btn {
|
|
||||||
width: 100%;
|
|
||||||
min-width: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tag-edit-tip {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: space-between;
|
|
||||||
gap: 12rpx;
|
|
||||||
color: #7b7167;
|
|
||||||
font-size: 22rpx;
|
font-size: 22rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tag-clear {
|
.section-link {
|
||||||
color: #2f6b55;
|
flex: 0 0 auto;
|
||||||
|
color: #c86a5c;
|
||||||
|
font-size: 24rpx;
|
||||||
|
font-weight: 900;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tag-list {
|
.profile-summary-card,
|
||||||
display: grid;
|
.tag-summary-card,
|
||||||
gap: 12rpx;
|
.schedule-summary-card {
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tag-item {
|
.profile-summary-card {
|
||||||
|
padding: 8rpx 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-row {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
align-items: flex-start;
|
||||||
|
gap: 20rpx;
|
||||||
|
min-height: 92rpx;
|
||||||
|
padding: 22rpx 0;
|
||||||
|
border-bottom: 1rpx solid #eee8df;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-row-last {
|
||||||
|
border-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-label {
|
||||||
|
flex: 0 0 140rpx;
|
||||||
|
color: #8d8175;
|
||||||
|
font-size: 24rpx;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-value {
|
||||||
|
min-width: 0;
|
||||||
|
flex: 1;
|
||||||
|
color: #332c27;
|
||||||
|
font-size: 26rpx;
|
||||||
|
font-weight: 900;
|
||||||
|
line-height: 1.45;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-description {
|
||||||
|
color: #6f655d;
|
||||||
|
font-size: 24rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag-summary-card {
|
||||||
|
padding: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag-cloud {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
|
||||||
gap: 12rpx;
|
gap: 12rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tag-preview {
|
.tag-preview {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
min-width: 0;
|
min-height: 52rpx;
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
min-height: 54rpx;
|
padding: 0 18rpx;
|
||||||
padding: 0 16rpx;
|
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border: 1rpx solid;
|
border: 1rpx solid;
|
||||||
border-radius: 999rpx;
|
border-radius: 999rpx;
|
||||||
@@ -348,35 +251,206 @@
|
|||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tag-actions {
|
.tag-add {
|
||||||
display: flex;
|
display: inline-flex;
|
||||||
flex: 0 0 auto;
|
align-items: center;
|
||||||
gap: 16rpx;
|
justify-content: center;
|
||||||
color: #2f6b55;
|
width: 52rpx;
|
||||||
font-size: 22rpx;
|
height: 52rpx;
|
||||||
font-weight: 800;
|
border: 1rpx dashed #e2b9af;
|
||||||
|
border-radius: 50%;
|
||||||
|
color: #c86a5c;
|
||||||
|
font-size: 36rpx;
|
||||||
|
font-weight: 300;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tag-actions .danger {
|
.empty-inline {
|
||||||
color: #c36a6a;
|
padding: 12rpx 0;
|
||||||
}
|
color: #a0968e;
|
||||||
|
|
||||||
.tag-empty {
|
|
||||||
color: #8c8177;
|
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.rule-card {
|
.summary-action-row {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 12rpx;
|
||||||
|
margin-top: 20rpx;
|
||||||
|
padding-top: 16rpx;
|
||||||
|
border-top: 1rpx solid #eee8df;
|
||||||
|
color: #9a8f86;
|
||||||
|
font-size: 22rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-arrow {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
color: #b7aca3;
|
||||||
|
font-size: 34rpx;
|
||||||
|
font-weight: 300;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.schedule-summary-card {
|
||||||
|
padding: 0 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.schedule-summary-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
gap: 18rpx;
|
gap: 18rpx;
|
||||||
|
min-height: 120rpx;
|
||||||
|
padding: 20rpx 0;
|
||||||
|
border-bottom: 1rpx solid #eee8df;
|
||||||
|
}
|
||||||
|
|
||||||
|
.special-summary-row {
|
||||||
|
border-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-icon {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
flex: 0 0 auto;
|
||||||
|
width: 64rpx;
|
||||||
|
height: 64rpx;
|
||||||
|
border-radius: 22rpx;
|
||||||
|
font-size: 28rpx;
|
||||||
|
font-weight: 900;
|
||||||
|
}
|
||||||
|
|
||||||
|
.schedule-icon {
|
||||||
|
background: #e5eee9;
|
||||||
|
color: #55786d;
|
||||||
|
}
|
||||||
|
|
||||||
|
.exception-icon {
|
||||||
|
background: #fff0ed;
|
||||||
|
color: #c86a5c;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-main {
|
||||||
|
display: flex;
|
||||||
|
flex: 1;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 8rpx;
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-main .summary-value {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.summary-meta {
|
||||||
|
overflow: hidden;
|
||||||
|
color: #9b9188;
|
||||||
|
font-size: 22rpx;
|
||||||
|
line-height: 1.4;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sheet-mask {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
z-index: 30;
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-end;
|
||||||
|
background: rgba(45, 35, 29, 0.36);
|
||||||
|
}
|
||||||
|
|
||||||
|
.schedule-sheet {
|
||||||
|
width: 100%;
|
||||||
|
max-height: 88vh;
|
||||||
|
padding: 14rpx 24rpx calc(22rpx + env(safe-area-inset-bottom));
|
||||||
|
overflow-y: auto;
|
||||||
|
border-radius: 28rpx 28rpx 0 0;
|
||||||
|
background: #fffdf8;
|
||||||
|
box-shadow: 0 -18rpx 38rpx rgba(45, 35, 29, 0.18);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sheet-handle {
|
||||||
|
width: 68rpx;
|
||||||
|
height: 8rpx;
|
||||||
|
margin: 0 auto 20rpx;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
background: #ddd3ca;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sheet-head,
|
||||||
|
.exception-history-head {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 16rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sheet-head {
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sheet-title {
|
||||||
|
color: #332c27;
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: 900;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sheet-close {
|
||||||
|
color: #a59a91;
|
||||||
|
font-size: 40rpx;
|
||||||
|
font-weight: 300;
|
||||||
|
line-height: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sheet-tabs {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
gap: 8rpx;
|
||||||
|
margin-bottom: 18rpx;
|
||||||
|
padding: 6rpx;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
background: #f5efe8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sheet-tab {
|
||||||
|
padding: 14rpx;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
color: #958a80;
|
||||||
|
font-size: 24rpx;
|
||||||
|
font-weight: 900;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sheet-tab.active {
|
||||||
|
background: #fffdf8;
|
||||||
|
color: #c86a5c;
|
||||||
|
box-shadow: 0 6rpx 14rpx rgba(67, 52, 41, 0.07);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sheet-field-block {
|
||||||
|
padding: 18rpx 0;
|
||||||
|
border-bottom: 1rpx solid #eee8df;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sheet-field-title {
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 14rpx;
|
||||||
|
color: #6f665c;
|
||||||
|
font-size: 24rpx;
|
||||||
|
font-weight: 800;
|
||||||
}
|
}
|
||||||
|
|
||||||
.preset-grid,
|
.preset-grid,
|
||||||
.weekday-grid {
|
.weekday-grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
|
gap: 12rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.preset-grid {
|
||||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||||
gap: 16rpx;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.weekday-grid {
|
.weekday-grid {
|
||||||
@@ -385,15 +459,15 @@
|
|||||||
|
|
||||||
.preset-chip,
|
.preset-chip,
|
||||||
.weekday-chip {
|
.weekday-chip {
|
||||||
min-height: 72rpx;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
min-height: 64rpx;
|
||||||
border: 2rpx solid #e3ddd2;
|
border: 2rpx solid #e3ddd2;
|
||||||
border-radius: 12rpx;
|
border-radius: 14rpx;
|
||||||
background: #fffaf2;
|
background: #fffaf2;
|
||||||
color: #5f564c;
|
color: #5f564c;
|
||||||
font-size: 24rpx;
|
font-size: 23rpx;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -404,39 +478,82 @@
|
|||||||
color: #2f6b55;
|
color: #2f6b55;
|
||||||
}
|
}
|
||||||
|
|
||||||
.field-block {
|
.sheet-field {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
align-items: center;
|
||||||
gap: 12rpx;
|
min-height: 88rpx;
|
||||||
|
gap: 18rpx;
|
||||||
|
border-bottom: 1rpx solid #eee8df;
|
||||||
}
|
}
|
||||||
|
|
||||||
.field-title {
|
.sheet-field-label {
|
||||||
|
flex: 0 0 160rpx;
|
||||||
|
color: #625c55;
|
||||||
|
font-size: 25rpx;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sheet-field-value,
|
||||||
|
.sheet-field input {
|
||||||
|
flex: 1;
|
||||||
|
min-width: 0;
|
||||||
|
color: #3f382f;
|
||||||
|
font-size: 26rpx;
|
||||||
|
font-weight: 800;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sheet-field input {
|
||||||
|
height: 58rpx;
|
||||||
|
padding: 0 18rpx;
|
||||||
|
border: 1rpx solid #eadfd2;
|
||||||
|
border-radius: 16rpx;
|
||||||
|
background: #fff8f2;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sheet-save {
|
||||||
|
margin-top: 22rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.exception-history {
|
||||||
|
margin-top: 24rpx;
|
||||||
|
padding: 18rpx;
|
||||||
|
border-radius: 18rpx;
|
||||||
|
background: #faf5ef;
|
||||||
|
}
|
||||||
|
|
||||||
|
.exception-history-head {
|
||||||
color: #6f665c;
|
color: #6f665c;
|
||||||
font-size: 24rpx;
|
font-size: 23rpx;
|
||||||
font-weight: 800;
|
font-weight: 800;
|
||||||
}
|
}
|
||||||
|
|
||||||
.exception-btn {
|
.exception-history-head text:last-child {
|
||||||
width: 100%;
|
color: #a0968e;
|
||||||
margin-top: 8rpx;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
.exception-list {
|
.exception-history-list {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 16rpx;
|
gap: 12rpx;
|
||||||
margin-top: 16rpx;
|
margin-top: 14rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.exception-card {
|
.exception-history-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 8rpx;
|
gap: 6rpx;
|
||||||
color: #3f382f;
|
padding-top: 12rpx;
|
||||||
font-size: 26rpx;
|
border-top: 1rpx solid #eee5da;
|
||||||
|
color: #4f473f;
|
||||||
|
font-size: 23rpx;
|
||||||
|
font-weight: 700;
|
||||||
}
|
}
|
||||||
|
|
||||||
.exception-remark {
|
.exception-history-remark {
|
||||||
color: #7b7167;
|
color: #9a8f86;
|
||||||
font-size: 24rpx;
|
font-size: 21rpx;
|
||||||
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,224 @@
|
|||||||
|
const tagsApi = require('../../api/tags')
|
||||||
|
|
||||||
|
const DEFAULT_TAG_STYLE = {
|
||||||
|
textColor: '#A84F47',
|
||||||
|
bgColor: '#FFF0ED',
|
||||||
|
borderColor: '#F0CFC8',
|
||||||
|
sortOrder: 100,
|
||||||
|
frontVisible: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
const TAG_STYLES = [
|
||||||
|
{ key: 'coral', textColor: '#A84F47', bgColor: '#FFF0ED', borderColor: '#F0CFC8' },
|
||||||
|
{ key: 'sage', textColor: '#4E7A63', bgColor: '#EEF7F0', borderColor: '#D1E2D7' },
|
||||||
|
{ key: 'gold', textColor: '#9A7137', bgColor: '#FFF8E5', borderColor: '#E8D8AE' },
|
||||||
|
{ key: 'plum', textColor: '#80628A', bgColor: '#F6EFF9', borderColor: '#DBCBE1' }
|
||||||
|
]
|
||||||
|
|
||||||
|
function normalizeTagOption(tag) {
|
||||||
|
const name = String((tag && (tag.displayName || tag.tagName || tag.name)) || '').trim()
|
||||||
|
if (!name) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
id: (tag && tag.id) || name,
|
||||||
|
name,
|
||||||
|
tagName: (tag && tag.tagName) || name,
|
||||||
|
displayName: (tag && tag.displayName) || name,
|
||||||
|
textColor: (tag && tag.textColor) || DEFAULT_TAG_STYLE.textColor,
|
||||||
|
bgColor: (tag && tag.bgColor) || DEFAULT_TAG_STYLE.bgColor,
|
||||||
|
borderColor: (tag && tag.borderColor) || DEFAULT_TAG_STYLE.borderColor,
|
||||||
|
sortOrder: (tag && tag.sortOrder) || DEFAULT_TAG_STYLE.sortOrder,
|
||||||
|
frontVisible: (tag && tag.frontVisible) === 0 ? 0 : DEFAULT_TAG_STYLE.frontVisible
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function normalizeTagOptions(tags) {
|
||||||
|
const names = new Set()
|
||||||
|
return (Array.isArray(tags) ? tags : [])
|
||||||
|
.map(normalizeTagOption)
|
||||||
|
.filter(Boolean)
|
||||||
|
.filter(item => {
|
||||||
|
if (names.has(item.name)) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
names.add(item.name)
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolveStyleKey(tag) {
|
||||||
|
const style = TAG_STYLES.find(item => item.bgColor === tag.bgColor && item.borderColor === tag.borderColor)
|
||||||
|
return style ? style.key : TAG_STYLES[0].key
|
||||||
|
}
|
||||||
|
|
||||||
|
function resolveCurrentShopId() {
|
||||||
|
const app = getApp()
|
||||||
|
const userInfo = (app && app.globalData && app.globalData.userInfo) || {}
|
||||||
|
return userInfo.shopId || (app && app.globalData && app.globalData.shopId) || ''
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildTagPayload(form) {
|
||||||
|
const style = TAG_STYLES.find(item => item.key === form.styleKey) || TAG_STYLES[0]
|
||||||
|
const payload = {
|
||||||
|
tagName: String(form.name || '').trim(),
|
||||||
|
textColor: style.textColor,
|
||||||
|
bgColor: style.bgColor,
|
||||||
|
borderColor: style.borderColor,
|
||||||
|
sortOrder: form.sortOrder || DEFAULT_TAG_STYLE.sortOrder,
|
||||||
|
frontVisible: form.frontVisible === 0 ? 0 : DEFAULT_TAG_STYLE.frontVisible
|
||||||
|
}
|
||||||
|
const shopId = resolveCurrentShopId()
|
||||||
|
if (shopId) {
|
||||||
|
payload.shopId = shopId
|
||||||
|
}
|
||||||
|
return payload
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildEmptyForm() {
|
||||||
|
return {
|
||||||
|
id: '',
|
||||||
|
name: '',
|
||||||
|
styleKey: TAG_STYLES[0].key,
|
||||||
|
sortOrder: DEFAULT_TAG_STYLE.sortOrder,
|
||||||
|
frontVisible: DEFAULT_TAG_STYLE.frontVisible
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Page({
|
||||||
|
data: {
|
||||||
|
loading: false,
|
||||||
|
saving: false,
|
||||||
|
tagList: [],
|
||||||
|
tagStyles: TAG_STYLES.map(item => ({ ...item, active: item.key === TAG_STYLES[0].key })),
|
||||||
|
tagForm: buildEmptyForm()
|
||||||
|
},
|
||||||
|
|
||||||
|
onLoad() {
|
||||||
|
this.loadTags()
|
||||||
|
},
|
||||||
|
|
||||||
|
onShow() {
|
||||||
|
if (this.data.tagList.length) {
|
||||||
|
this.loadTags()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
async loadTags() {
|
||||||
|
this.setData({ loading: true })
|
||||||
|
try {
|
||||||
|
const tagsData = await tagsApi.listAll()
|
||||||
|
this.setData({ tagList: normalizeTagOptions(tagsData.list || tagsData || []) })
|
||||||
|
} catch (error) {
|
||||||
|
wx.showToast({ title: error.message || '标签加载失败', icon: 'none' })
|
||||||
|
} finally {
|
||||||
|
this.setData({ loading: false })
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
onTagInput(event) {
|
||||||
|
this.setData({ 'tagForm.name': event.detail.value })
|
||||||
|
},
|
||||||
|
|
||||||
|
selectStyle(event) {
|
||||||
|
const styleKey = event.currentTarget.dataset.key
|
||||||
|
this.setData({
|
||||||
|
'tagForm.styleKey': styleKey,
|
||||||
|
tagStyles: TAG_STYLES.map(item => ({ ...item, active: item.key === styleKey }))
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
editTag(event) {
|
||||||
|
const tagId = String(event.currentTarget.dataset.id || '')
|
||||||
|
const tag = this.data.tagList.find(item => String(item.id) === tagId)
|
||||||
|
if (!tag) {
|
||||||
|
wx.showToast({ title: '标签不存在', icon: 'none' })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const styleKey = resolveStyleKey(tag)
|
||||||
|
this.setData({
|
||||||
|
tagForm: {
|
||||||
|
id: tag.id,
|
||||||
|
name: tag.tagName || tag.name,
|
||||||
|
styleKey,
|
||||||
|
sortOrder: tag.sortOrder,
|
||||||
|
frontVisible: tag.frontVisible
|
||||||
|
},
|
||||||
|
tagStyles: TAG_STYLES.map(item => ({ ...item, active: item.key === styleKey }))
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
clearTagForm() {
|
||||||
|
const tagForm = buildEmptyForm()
|
||||||
|
this.setData({
|
||||||
|
tagForm,
|
||||||
|
tagStyles: TAG_STYLES.map(item => ({ ...item, active: item.key === tagForm.styleKey }))
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
async saveTag() {
|
||||||
|
if (this.data.saving) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const tagName = String(this.data.tagForm.name || '').trim()
|
||||||
|
if (!tagName) {
|
||||||
|
wx.showToast({ title: '请输入标签名称', icon: 'none' })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const tagId = this.data.tagForm.id
|
||||||
|
this.setData({ saving: true })
|
||||||
|
try {
|
||||||
|
const payload = buildTagPayload({ ...this.data.tagForm, name: tagName })
|
||||||
|
if (tagId) {
|
||||||
|
await tagsApi.update(tagId, payload)
|
||||||
|
wx.showToast({ title: '标签已更新', icon: 'success' })
|
||||||
|
} else {
|
||||||
|
await tagsApi.create(payload)
|
||||||
|
wx.showToast({ title: '标签已新增', icon: 'success' })
|
||||||
|
}
|
||||||
|
this.clearTagForm()
|
||||||
|
await this.loadTags()
|
||||||
|
} catch (error) {
|
||||||
|
wx.showToast({ title: error.message || '标签保存失败', icon: 'none' })
|
||||||
|
} finally {
|
||||||
|
this.setData({ saving: false })
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
deleteTag(event) {
|
||||||
|
const tagId = String(event.currentTarget.dataset.id || '')
|
||||||
|
const tag = this.data.tagList.find(item => String(item.id) === tagId)
|
||||||
|
if (!tag) {
|
||||||
|
wx.showToast({ title: '标签不存在', icon: 'none' })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
wx.showModal({
|
||||||
|
title: '删除标签',
|
||||||
|
content: `确认删除标签“${tag.name}”?`,
|
||||||
|
confirmText: '删除',
|
||||||
|
confirmColor: '#d98d8d',
|
||||||
|
success: async result => {
|
||||||
|
if (!result.confirm) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.setData({ saving: true })
|
||||||
|
try {
|
||||||
|
await tagsApi.delete(tag.id)
|
||||||
|
if (String(this.data.tagForm.id) === String(tag.id)) {
|
||||||
|
this.clearTagForm()
|
||||||
|
}
|
||||||
|
await this.loadTags()
|
||||||
|
wx.showToast({ title: '标签已删除', icon: 'success' })
|
||||||
|
} catch (error) {
|
||||||
|
wx.showToast({ title: error.message || '标签删除失败', icon: 'none' })
|
||||||
|
} finally {
|
||||||
|
this.setData({ saving: false })
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
back() {
|
||||||
|
wx.navigateBack()
|
||||||
|
}
|
||||||
|
})
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"navigationBarTitleText": "店铺标签"
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
<view class="page no-tab shop-tags-page">
|
||||||
|
<view wx:if="{{loading}}" class="loading-state">店铺标签加载中</view>
|
||||||
|
<block wx:else>
|
||||||
|
<view class="page-heading">
|
||||||
|
<text class="page-title">店铺标签</text>
|
||||||
|
<text class="page-subtitle">把门店特色整理成可以快速选择的标签。</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="card tag-form-card">
|
||||||
|
<view class="form-kicker">{{tagForm.id ? '编辑标签' : '新增标签'}}</view>
|
||||||
|
<input class="tag-input" value="{{tagForm.name}}" bindinput="onTagInput" placeholder="输入标签名称,例如:日系清透" />
|
||||||
|
<view class="style-row">
|
||||||
|
<text class="style-label">标签颜色</text>
|
||||||
|
<view
|
||||||
|
wx:for="{{tagStyles}}"
|
||||||
|
wx:key="key"
|
||||||
|
class="style-swatch {{item.active ? 'active' : ''}}"
|
||||||
|
style="background: {{item.bgColor}}; border-color: {{item.borderColor}};"
|
||||||
|
data-key="{{item.key}}"
|
||||||
|
bindtap="selectStyle"
|
||||||
|
>
|
||||||
|
<text style="color: {{item.textColor}};">●</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="tag-form-actions">
|
||||||
|
<button wx:if="{{tagForm.id}}" class="secondary-btn cancel-edit-btn" bindtap="clearTagForm">取消编辑</button>
|
||||||
|
<button class="primary-btn tag-save-btn" loading="{{saving}}" disabled="{{saving}}" bindtap="saveTag">{{tagForm.id ? '保存修改' : '添加标签'}}</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="section">
|
||||||
|
<view class="section-head">
|
||||||
|
<text class="section-title">当前标签</text>
|
||||||
|
<text class="section-meta">{{tagList.length}} 个</text>
|
||||||
|
</view>
|
||||||
|
<view class="card tag-list-card">
|
||||||
|
<view wx:if="{{tagList.length}}" class="tag-list">
|
||||||
|
<view wx:for="{{tagList}}" wx:key="id" class="tag-item">
|
||||||
|
<text class="tag-preview" style="background: {{item.bgColor}}; color: {{item.textColor}}; border-color: {{item.borderColor}};">{{item.name}}</text>
|
||||||
|
<view class="tag-actions">
|
||||||
|
<text data-id="{{item.id}}" bindtap="editTag">编辑</text>
|
||||||
|
<text class="danger" data-id="{{item.id}}" bindtap="deleteTag">删除</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view wx:else class="empty-state">暂无标签,先添加一个门店特色吧。</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
@@ -0,0 +1,174 @@
|
|||||||
|
.shop-tags-page {
|
||||||
|
background:
|
||||||
|
linear-gradient(180deg, rgba(255, 250, 242, 0.96), rgba(247, 240, 232, 0.96)),
|
||||||
|
linear-gradient(135deg, rgba(89, 121, 102, 0.14), rgba(181, 134, 86, 0.12));
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-heading {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 8rpx;
|
||||||
|
margin: 4rpx 0 22rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-title {
|
||||||
|
color: #2f2a25;
|
||||||
|
font-size: 36rpx;
|
||||||
|
font-weight: 900;
|
||||||
|
line-height: 1.25;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-subtitle {
|
||||||
|
color: #8a796a;
|
||||||
|
font-size: 23rpx;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading-state {
|
||||||
|
padding: 48rpx 24rpx;
|
||||||
|
color: #7b7167;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag-form-card,
|
||||||
|
.tag-list-card {
|
||||||
|
padding: 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-kicker {
|
||||||
|
color: #92734f;
|
||||||
|
font-size: 22rpx;
|
||||||
|
font-weight: 900;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag-input {
|
||||||
|
width: 100%;
|
||||||
|
height: 78rpx;
|
||||||
|
margin-top: 16rpx;
|
||||||
|
padding: 0 22rpx;
|
||||||
|
border: 1rpx solid #eadfd2;
|
||||||
|
border-radius: 18rpx;
|
||||||
|
background: #fff8f2;
|
||||||
|
color: #3d3128;
|
||||||
|
font-size: 28rpx;
|
||||||
|
line-height: 78rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.style-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 18rpx;
|
||||||
|
margin-top: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.style-label {
|
||||||
|
color: #6f665c;
|
||||||
|
font-size: 24rpx;
|
||||||
|
font-weight: 800;
|
||||||
|
}
|
||||||
|
|
||||||
|
.style-swatch {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 42rpx;
|
||||||
|
height: 42rpx;
|
||||||
|
border: 4rpx solid;
|
||||||
|
border-radius: 50%;
|
||||||
|
box-shadow: 0 0 0 1rpx rgba(55, 44, 35, 0.08);
|
||||||
|
font-size: 22rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.style-swatch.active {
|
||||||
|
box-shadow: 0 0 0 4rpx rgba(200, 106, 92, 0.18);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag-form-actions {
|
||||||
|
display: flex;
|
||||||
|
gap: 12rpx;
|
||||||
|
margin-top: 22rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cancel-edit-btn,
|
||||||
|
.tag-save-btn {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section {
|
||||||
|
margin-top: 26rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-head {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 16rpx;
|
||||||
|
margin: 0 4rpx 16rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-title {
|
||||||
|
color: #3f382f;
|
||||||
|
font-size: 30rpx;
|
||||||
|
font-weight: 800;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-meta {
|
||||||
|
color: #a0968e;
|
||||||
|
font-size: 23rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag-list {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 14rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 16rpx;
|
||||||
|
padding-bottom: 14rpx;
|
||||||
|
border-bottom: 1rpx solid #eee8df;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag-item:last-child {
|
||||||
|
padding-bottom: 0;
|
||||||
|
border-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag-preview {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
min-width: 0;
|
||||||
|
max-width: 100%;
|
||||||
|
min-height: 54rpx;
|
||||||
|
padding: 0 18rpx;
|
||||||
|
overflow: hidden;
|
||||||
|
border: 1rpx solid;
|
||||||
|
border-radius: 999rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
font-weight: 800;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag-actions {
|
||||||
|
display: flex;
|
||||||
|
flex: 0 0 auto;
|
||||||
|
gap: 18rpx;
|
||||||
|
color: #2f6b55;
|
||||||
|
font-size: 23rpx;
|
||||||
|
font-weight: 800;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tag-actions .danger {
|
||||||
|
color: #c36a6a;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-state {
|
||||||
|
padding: 42rpx 18rpx;
|
||||||
|
color: #a0968e;
|
||||||
|
font-size: 24rpx;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
@@ -412,3 +412,11 @@
|
|||||||
- 数据库说明:本次不新增 SQL,不修改初始化 SQL,不需要执行数据库迁移。
|
- 数据库说明:本次不新增 SQL,不修改初始化 SQL,不需要执行数据库迁移。
|
||||||
- 影响范围:影响 `JY-Salon-WeChat/pages/shop-settings/`、`JY-Salon-WeChat/pages/appointment-form/` 与标签 API 封装;预约详情页继续通过既有 `appointment.productTags` 渲染标签。
|
- 影响范围:影响 `JY-Salon-WeChat/pages/shop-settings/`、`JY-Salon-WeChat/pages/appointment-form/` 与标签 API 封装;预约详情页继续通过既有 `appointment.productTags` 渲染标签。
|
||||||
- 验证方式:`JY-Salon-WeChat/api/tags.js`、预约表单页、店铺设置页 JS 语法检查通过;相关文件 `git diff --check` 通过;微信开发者工具运行态验证 `pages/shop-settings/index` 可见“标签设置”区,`pages/appointment-form/index` 可打开手工预约面板并展示标签输入/添加控件;GitNexus staged `detect-changes` 结果为 low risk、0 affected processes。
|
- 验证方式:`JY-Salon-WeChat/api/tags.js`、预约表单页、店铺设置页 JS 语法检查通过;相关文件 `git diff --check` 通过;微信开发者工具运行态验证 `pages/shop-settings/index` 可见“标签设置”区,`pages/appointment-form/index` 可打开手工预约面板并展示标签输入/添加控件;GitNexus staged `detect-changes` 结果为 low risk、0 affected processes。
|
||||||
|
|
||||||
|
## 2026-07-23 店务小程序店铺设置改为展示与按需编辑
|
||||||
|
|
||||||
|
- 变更原因:店务端店铺设置需要降低主页面表单密度,让店铺档案、标签、排班和特殊日期先以信息卡片展示,再按需进入编辑。
|
||||||
|
- 处理方式:`shop-settings` 主页面改为店铺档案、标签和营业安排摘要展示;新增 `shop-profile-edit` 店铺档案二级页,复用店铺设置和封面上传接口;新增 `shop-tags` 标签二级页,复用标签列表、创建、编辑和删除接口;排班与特殊日期在主页面通过同一底部弹层分段表单编辑。排班保存携带当前店铺已有字段,避免后端更新接口清空未编辑字段。
|
||||||
|
- 数据库说明:本次不新增 SQL,不修改初始化 SQL,不需要执行数据库迁移。
|
||||||
|
- 影响范围:影响 `JY-Salon-WeChat/app.json`、`pages/shop-settings/`、新增 `pages/shop-profile-edit/` 和 `pages/shop-tags/`;不影响后端、接口契约和预约业务。
|
||||||
|
- 验证方式:三个新增/修改页面 JavaScript 语法检查通过,四份 JSON 配置可解析,相关文件 `git diff --check` 通过;GitNexus `impact` 对 `shop-settings.loadSettings` 返回 LOW 风险、3 个直接依赖、0 个受影响流程;微信开发者工具连接和主页面运行态结构可见,但当前 AppService 未及时加载新增页面路由,新增路由待开发者工具重新编译后复验。
|
||||||
|
|||||||
+21
-1
@@ -2,7 +2,27 @@
|
|||||||
|
|
||||||
## 当前任务
|
## 当前任务
|
||||||
|
|
||||||
店务小程序预约日期和时间选择入口主题样式调整。
|
店务小程序店铺设置展示与按需编辑改造。
|
||||||
|
|
||||||
|
## 当前任务已完成
|
||||||
|
|
||||||
|
- 已完成效果稿并获得用户确认。
|
||||||
|
- 已提交设计说明 `docs/superpowers/specs/2026-07-23-店铺设置展示与编辑设计.md`。
|
||||||
|
- `pages/shop-settings/` 已改为店铺档案、标签、营业安排摘要展示。
|
||||||
|
- 新增 `pages/shop-profile-edit/` 店铺档案二级编辑页。
|
||||||
|
- 新增 `pages/shop-tags/` 标签二级管理页。
|
||||||
|
- 排班与特殊日期合并为主页面底部弹层表单。
|
||||||
|
- 三个页面 JS 语法检查、JSON 解析和 `git diff --check` 已通过。
|
||||||
|
|
||||||
|
## 当前阻塞点
|
||||||
|
|
||||||
|
- 微信开发者工具自动化连接健康,但 AppService 仍缓存旧页面配置;运行态主页面 WXML 已出现新结构,新增页面路由暂未被当前实例识别。提交前以源码、配置和静态检查为主,后续需重新编译/重启开发者工具后复验新增路由。
|
||||||
|
|
||||||
|
## 下一步
|
||||||
|
|
||||||
|
- 暂存本次需求相关页面、路由、项目记录和进度文件。
|
||||||
|
- 运行 GitNexus `detect-changes --scope staged`。
|
||||||
|
- 创建中文提交并核对提交文件清单。
|
||||||
|
|
||||||
## 已完成
|
## 已完成
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user