- 重构后台所有管理页面工具栏,移除图标改用纯文字按钮 - 新增商户管理的批量审核功能与商家详情/审核页面 - 新增帖子管理的批量审核/上下架功能与帖子详情/审核页面 - 新增多媒体相册字段的前后台处理逻辑 - 新增微信订阅消息兼容导出层 - 更新站点版本号并优化品牌色变量 - 新增商户/帖子控制器的详情与审核方法 - 新增 .sql 文件忽略规则
1505 行
36 KiB
Vue
1505 行
36 KiB
Vue
<template>
|
||
<view class="create fc-page">
|
||
<!-- 统一顶部深绿质感导航栏,右侧提供独立草稿箱入口 -->
|
||
<fc-navbar title="发布信息" theme="gradient" :show-back="true">
|
||
<template #right>
|
||
<view class="create__draft-entry" @click="goDraftsPage">
|
||
<image class="create__draft-icon" :src="iconUrl('mine-draft')" mode="aspectFit" />
|
||
<text class="create__draft-text">草稿箱</text>
|
||
<text v-if="draftCount > 0" class="create__draft-badge">{{ draftCount }}</text>
|
||
</view>
|
||
</template>
|
||
</fc-navbar>
|
||
|
||
<!-- 1. 分类选择单元格(唯一入口,点击唤起全部分类抽屉,避免同一分类重复展示) -->
|
||
<view class="fc-card create__section">
|
||
<view class="create__cell" @click="openCatDrawer">
|
||
<view class="create__cell-left">
|
||
<text class="create__label">所属分类</text>
|
||
<text class="create__required">*</text>
|
||
</view>
|
||
<view class="create__cell-right">
|
||
<view v-if="currentCat" class="create__selected-cat">
|
||
<image class="create__selected-cat-icon" :src="catIcon(currentCat)" mode="aspectFit" />
|
||
<text class="create__selected-cat-name">{{ currentCat.name }}</text>
|
||
</view>
|
||
<text v-else class="create__cell-ph">请选择信息所属分类</text>
|
||
<text class="create__arrow">›</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 2. 发布身份选择(仅已认证商家展示,个人 / 商家二选一) -->
|
||
<view v-if="isMerchantUser" class="fc-card create__section">
|
||
<view class="create__label-row">
|
||
<text class="create__label">发布身份</text>
|
||
</view>
|
||
<view class="create__identity-group">
|
||
<view
|
||
class="create__identity-item"
|
||
:class="{ 'create__identity-item--active': form.identityType === 'person' }"
|
||
@click="switchIdentity('person')"
|
||
>
|
||
<text class="create__identity-title">个人</text>
|
||
<text class="create__identity-desc">发布便民信息</text>
|
||
</view>
|
||
<view
|
||
class="create__identity-item"
|
||
:class="{ 'create__identity-item--active': form.identityType === 'merchant' }"
|
||
@click="switchIdentity('merchant')"
|
||
>
|
||
<view class="create__identity-title-row">
|
||
<text class="create__identity-title">商家</text>
|
||
<text class="create__merchant-badge">已认证</text>
|
||
</view>
|
||
<text class="create__identity-desc fc-ellipsis">{{ merchantShopName || '展示店铺信息' }}</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 3. 基本信息表单(标题、详细内容、媒体上传) -->
|
||
<view class="fc-card create__section">
|
||
<view class="create__label">标题<text class="create__required">*</text></view>
|
||
<input
|
||
v-model="form.title"
|
||
class="create__input"
|
||
placeholder="一句话清晰概括(如:诚聘配电工 待遇从优 / 急售九成新电动车)"
|
||
maxlength="40"
|
||
placeholder-class="create__ph"
|
||
@input="onFieldInput"
|
||
/>
|
||
|
||
<view class="create__label create__label--mt">详细内容<text class="create__required">*</text></view>
|
||
<textarea
|
||
v-model="form.content"
|
||
class="create__textarea"
|
||
placeholder="补充价格、服务时间、详细要求等,信息越详细真实越容易成交..."
|
||
maxlength="500"
|
||
placeholder-class="create__ph"
|
||
@input="onFieldInput"
|
||
/>
|
||
<text class="create__count">{{ (form.content || '').length }}/500</text>
|
||
|
||
<view class="create__label create__label--mt">图片 / 视频(实拍更具可信度)</view>
|
||
<view class="create__media">
|
||
<view v-for="(m, i) in form.media" :key="m + i" class="create__media-item fc-thumb">
|
||
<image v-if="!isVideo(m)" class="create__media-img" :src="assetUrl(m)" mode="aspectFill" />
|
||
<view v-else class="create__media-video">
|
||
<image class="fc-icon fc-icon--md" :src="iconUrl('plus-ink')" mode="aspectFit" />
|
||
<text class="create__media-video-txt">视频</text>
|
||
</view>
|
||
<view class="create__media-del" @click.stop="removeMedia(i)">
|
||
<text>×</text>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 上传图片按钮 -->
|
||
<view v-if="!uploading && imageCount < 6" class="create__upload" @click="chooseImage">
|
||
<image class="fc-icon fc-icon--md" :src="iconUrl('image')" mode="aspectFit" />
|
||
<text class="create__upload-txt">图片 {{ imageCount }}/6</text>
|
||
</view>
|
||
|
||
<!-- 上传视频按钮 -->
|
||
<view v-if="!uploading && videoCount < 1" class="create__upload" @click="chooseVideo">
|
||
<image class="fc-icon fc-icon--md" :src="iconUrl('plus-ink')" mode="aspectFit" />
|
||
<text class="create__upload-txt">短视频 {{ videoCount }}/1</text>
|
||
</view>
|
||
</view>
|
||
<text v-if="uploading" class="create__uploading">媒体上传中,请稍候…</text>
|
||
</view>
|
||
|
||
<!-- 4. 联系方式与地址定位 -->
|
||
<view class="fc-card create__section">
|
||
<view class="create__row">
|
||
<text class="create__row-label">联系人</text>
|
||
<input
|
||
v-model="form.contact"
|
||
class="create__input create__input--row"
|
||
placeholder="请输入您的称呼(如:李先生)"
|
||
placeholder-class="create__ph"
|
||
@input="onFieldInput"
|
||
/>
|
||
</view>
|
||
|
||
<view class="create__row create__row--line">
|
||
<text class="create__row-label">联系电话</text>
|
||
<input
|
||
v-model="form.phone"
|
||
class="create__input create__input--row"
|
||
type="number"
|
||
maxlength="11"
|
||
placeholder="请输入11位联系手机号"
|
||
placeholder-class="create__ph"
|
||
@input="onFieldInput"
|
||
/>
|
||
</view>
|
||
|
||
<view class="create__row create__row--line" @click="chooseLocation">
|
||
<text class="create__row-label">所在位置</text>
|
||
<view class="create__location">
|
||
<image class="fc-icon fc-icon--sm" :src="iconUrl('location')" mode="aspectFit" />
|
||
<text class="create__location-text fc-ellipsis">{{ form.address || '点击定位/选择商铺' }}</text>
|
||
<text class="create__location-arrow">›</text>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="create__row create__row--line">
|
||
<text class="create__row-label">所属区域</text>
|
||
<fc-area-picker
|
||
class="create__area-picker"
|
||
:areas="areaRows"
|
||
:value="form.areaId"
|
||
variant="plain"
|
||
show-full
|
||
placeholder="请选择省 / 市 / 区"
|
||
@change="onRegionPicked"
|
||
/>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 5. 发布方式与计费(由后台「发布与费用配置」下发) -->
|
||
<view class="fc-card create__section">
|
||
<view class="create__label-row">
|
||
<text class="create__label">发布方式</text>
|
||
<text v-if="publish.mode === 'paid'" class="create__quota">
|
||
套餐额度:剩余 {{ publish.quotaLeft }} 条
|
||
</text>
|
||
</view>
|
||
|
||
<view v-if="publish.mode === 'free'" class="create__free-tip">
|
||
<text>当前处于限时免费模式,所有用户均可直接免费发布!</text>
|
||
</view>
|
||
|
||
<view v-else class="create__plans">
|
||
<view
|
||
v-for="p in plans"
|
||
:key="p.key"
|
||
class="create__plan"
|
||
:class="{ 'create__plan--active': form.plan === p.key }"
|
||
@click="form.plan = p.key"
|
||
>
|
||
<text class="create__plan-name">{{ p.name }}</text>
|
||
<text class="create__plan-price">{{ p.price }}</text>
|
||
<text class="create__plan-desc">{{ p.desc }}</text>
|
||
<text v-if="p.tag" class="create__plan-tag">{{ p.tag }}</text>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 支付方式选择(微信 / 余额) -->
|
||
<view v-if="needPay" class="create__pay">
|
||
<text class="create__pay-label">支付方式</text>
|
||
<view class="create__pay-types">
|
||
<view
|
||
class="create__pay-type"
|
||
:class="{ 'create__pay-type--active': form.payType === 'wxpay' }"
|
||
@click="form.payType = 'wxpay'"
|
||
>
|
||
<image class="fc-icon fc-icon--sm" :src="iconUrl('paywechat')" mode="aspectFit" />
|
||
<text class="create__pay-text">微信支付</text>
|
||
</view>
|
||
<view
|
||
class="create__pay-type"
|
||
:class="{ 'create__pay-type--active': form.payType === 'balance' }"
|
||
@click="form.payType = 'balance'"
|
||
>
|
||
<image class="fc-icon fc-icon--sm" :src="iconUrl('wallet')" mode="aspectFit" />
|
||
<text class="create__pay-text">余额支付(¥{{ balance }})</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 底部固定主控操作栏 -->
|
||
<view class="create__bar">
|
||
<view class="create__bar-draft" @click="saveDraftManual">
|
||
<image class="create__bar-draft-icon" :src="iconUrl('mine-draft')" mode="aspectFit" />
|
||
<text class="create__bar-draft-txt">存草稿</text>
|
||
</view>
|
||
|
||
<view
|
||
class="create__bar-submit"
|
||
:class="{ 'create__bar-submit--disabled': submitting || uploading }"
|
||
@click="submit"
|
||
>
|
||
<text class="create__bar-submit-txt">
|
||
{{ submitting ? '提交中…' : (needPay ? '确认支付并发布' : '立即公开发布') }}
|
||
</text>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="fc-safe-bottom"></view>
|
||
|
||
<!-- ================= 全部分类弹窗选择器抽屉(海量分类由接口返回决定,支持流畅自适应滚动) ================= -->
|
||
<view
|
||
v-if="catDrawerVisible"
|
||
class="cat-drawer-mask"
|
||
:class="{ 'cat-drawer-mask--visible': catDrawerAnim }"
|
||
@click="closeCatDrawer"
|
||
>
|
||
<view
|
||
class="cat-drawer"
|
||
:class="{ 'cat-drawer--visible': catDrawerAnim }"
|
||
@click.stop
|
||
>
|
||
<view class="cat-drawer__header">
|
||
<text class="cat-drawer__title">选择信息分类</text>
|
||
<view class="cat-drawer__close" @click="closeCatDrawer">
|
||
<text class="cat-drawer__close-txt">✕</text>
|
||
</view>
|
||
</view>
|
||
|
||
<scroll-view class="cat-drawer__body" scroll-y :show-scrollbar="false">
|
||
<view class="cat-drawer__grid">
|
||
<view
|
||
v-for="c in categories"
|
||
:key="c.id"
|
||
class="cat-drawer__item"
|
||
:class="{ 'cat-drawer__item--active': form.categoryId === c.id }"
|
||
@click="onSelectDrawerCat(c)"
|
||
>
|
||
<view class="cat-drawer__icon-box">
|
||
<image class="cat-drawer__icon" :src="catIcon(c)" mode="aspectFit" />
|
||
</view>
|
||
<text class="cat-drawer__name">{{ c.name }}</text>
|
||
<view v-if="form.categoryId === c.id" class="cat-drawer__check">✓</view>
|
||
</view>
|
||
</view>
|
||
<view class="cat-drawer__space"></view>
|
||
</scroll-view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
/**
|
||
* 信息发布页面(重构版)
|
||
* 核心优化:
|
||
* 1. 分类选择由接口动态返回决定,统一收敛为「所属分类单元格 + 全部分类抽屉」单一入口,
|
||
* 避免同一分类在页面内重复出现(已选值只展示一次);
|
||
* 2. 彻底剥离草稿箱列表到独立页面 /pages/post/drafts,发布页右上方提供直通入口与存草稿闭环;
|
||
* 3. 支持个人 / 商家身份二选一(已认证商家可切换为商家身份发布并附带门店信息);
|
||
* 4. 严格遵循春绿规范,大厂级布局与无障碍高对比度。
|
||
*/
|
||
import FcNavbar from '@/components/fc-navbar/fc-navbar.vue'
|
||
import FcAreaPicker from '@/components/fc-area-picker/fc-area-picker.vue'
|
||
import homeApi from '@/common/api/home.js'
|
||
import postApi from '@/common/api/post.js'
|
||
import { useUserStore } from '@/common/store/index.js'
|
||
import { iconUrl, categoryIconUrl, loadUiConfig, requestSubscribe } from '@/common/store/ui.js'
|
||
import { pay } from '@/common/utils/pay.js'
|
||
import { assetUrl } from '@/common/utils/format.js'
|
||
import config from '@/common/config/index.js'
|
||
|
||
export default {
|
||
components: { FcNavbar, FcAreaPicker },
|
||
data() {
|
||
return {
|
||
categories: [],
|
||
draftCount: 0,
|
||
currentDraftId: 0, // 当前正在编辑的草稿ID(编辑自某草稿)
|
||
// 平铺服务区域(每条自带省/市/区县),交给级联选择器分组
|
||
areaRows: [],
|
||
submitting: false,
|
||
uploading: false,
|
||
draftTimer: null,
|
||
catDrawerVisible: false,
|
||
catDrawerAnim: false,
|
||
form: {
|
||
categoryId: 0,
|
||
identityType: 'person', // 'person' | 'merchant'
|
||
title: '',
|
||
content: '',
|
||
media: [],
|
||
contact: '',
|
||
phone: '',
|
||
address: '',
|
||
areaId: 0,
|
||
area: '',
|
||
lat: null,
|
||
lng: null,
|
||
plan: 'free',
|
||
payType: config.defaultPayType,
|
||
},
|
||
publish: {
|
||
mode: 'paid',
|
||
singlePrice: 5,
|
||
discountRate: 1,
|
||
discountText: '',
|
||
monthPrice: 19.9,
|
||
monthQuota: 30,
|
||
yearPrice: 168,
|
||
yearQuota: 500,
|
||
quotaLeft: 0,
|
||
freeQuotaLeft: 0,
|
||
freeQuotaCycle: 'daily',
|
||
freeUnlimited: false,
|
||
},
|
||
}
|
||
},
|
||
computed: {
|
||
/** 当前用户是否已认证为商家 */
|
||
isMerchantUser() {
|
||
try {
|
||
const u = useUserStore().state.userInfo
|
||
return !!(u && (u.isMerchant || u.merchantStatus === 1))
|
||
} catch (e) {
|
||
return false
|
||
}
|
||
},
|
||
/** 商家店铺名称 */
|
||
merchantShopName() {
|
||
try {
|
||
const u = useUserStore().state.userInfo
|
||
return (u && u.merchant && u.merchant.shop_name) || ''
|
||
} catch (e) {
|
||
return ''
|
||
}
|
||
},
|
||
/** 当前选中的分类对象 */
|
||
currentCat() {
|
||
return this.categories.find((c) => c.id === this.form.categoryId) || null
|
||
},
|
||
balance() {
|
||
try {
|
||
return useUserStore().state.userInfo?.balance ?? 0
|
||
} catch (e) {
|
||
return 0
|
||
}
|
||
},
|
||
imageCount() {
|
||
return this.form.media.filter((m) => !this.isVideo(m)).length
|
||
},
|
||
videoCount() {
|
||
return this.form.media.filter((m) => this.isVideo(m)).length
|
||
},
|
||
discountRate() {
|
||
const r = Number(this.publish.discountRate)
|
||
return r > 0 && r <= 1 ? r : 1
|
||
},
|
||
singlePriceFinal() {
|
||
return Math.round(Number(this.publish.singlePrice || 0) * this.discountRate * 100) / 100
|
||
},
|
||
discountLabel() {
|
||
return this.discountRate < 1 ? this.publish.discountText || `${Math.round(this.discountRate * 100) / 10} 折` : ''
|
||
},
|
||
plans() {
|
||
const p = this.publish
|
||
if (p.mode === 'free') return []
|
||
const list = []
|
||
const freeLeft = Number(p.freeQuotaLeft)
|
||
const freeUnlimited = p.freeUnlimited === true || freeLeft === -1
|
||
if (p.quotaLeft > 0) {
|
||
list.push({ key: 'quota', name: '套餐额度', price: '免费', desc: `剩余 ${p.quotaLeft} 条`, tag: '可用' })
|
||
} else if (freeUnlimited || freeLeft > 0) {
|
||
const cycle = { daily: '今日', monthly: '本月', total: '累计' }[p.freeQuotaCycle] || '本期'
|
||
list.push({
|
||
key: 'quota',
|
||
name: `${cycle}免费`,
|
||
price: '免费',
|
||
desc: freeUnlimited ? '不限条数' : `${cycle}剩余 ${freeLeft} 条`,
|
||
tag: '可用',
|
||
})
|
||
}
|
||
list.push({
|
||
key: 'single',
|
||
name: '会员单条',
|
||
price: `¥${this.money(this.singlePriceFinal)}`,
|
||
desc: this.discountLabel ? `${this.discountLabel}(原价 ¥${this.money(p.singlePrice)})` : '发布 1 条',
|
||
tag: this.discountLabel ? '会员价' : '',
|
||
})
|
||
list.push({ key: 'month', name: '按月发布', price: `¥${this.money(p.monthPrice)}`, desc: `含 ${p.monthQuota} 条`, tag: '推荐' })
|
||
list.push({ key: 'year', name: '按年发布', price: `¥${this.money(p.yearPrice)}`, desc: `含 ${p.yearQuota} 条`, tag: '更划算' })
|
||
return list
|
||
},
|
||
needPay() {
|
||
return this.publish.mode === 'paid' && this.form.plan !== 'quota'
|
||
},
|
||
},
|
||
onLoad(query) {
|
||
if (query && query.categoryId) this.form.categoryId = Number(query.categoryId)
|
||
if (query && query.title) this.form.title = decodeURIComponent(query.title)
|
||
if (query && query.draftId) {
|
||
this.loadDraftPost(Number(query.draftId))
|
||
} else if (query && query.editId) {
|
||
this.loadEditPost(Number(query.editId))
|
||
}
|
||
loadUiConfig()
|
||
this.init()
|
||
},
|
||
onShow() {
|
||
// 每次切入页面刷新草稿数量,保持右上角数字精准
|
||
this.updateDraftCount()
|
||
},
|
||
methods: {
|
||
iconUrl,
|
||
assetUrl,
|
||
catIcon(c) {
|
||
if (!c) return ''
|
||
return (c.iconKey && iconUrl(c.iconKey)) || categoryIconUrl(c.id)
|
||
},
|
||
/**
|
||
* 页面基础数据初始化
|
||
*/
|
||
async init() {
|
||
try {
|
||
const cats = await homeApi.categories()
|
||
this.categories = Array.isArray(cats) ? cats : []
|
||
// 若未指定分类且已有分类列表,默认选中第一个
|
||
if (!this.form.categoryId && this.categories.length) {
|
||
this.form.categoryId = this.categories[0].id
|
||
}
|
||
} catch (e) {
|
||
uni.showToast({ title: '分类数据加载失败', icon: 'none' })
|
||
}
|
||
|
||
try {
|
||
const rows = await homeApi.areas()
|
||
this.areaRows = Array.isArray(rows) ? rows : []
|
||
} catch (e) {}
|
||
|
||
this.loadPublish()
|
||
this.updateDraftCount()
|
||
},
|
||
/**
|
||
* 刷新草稿箱数量统计
|
||
*/
|
||
async updateDraftCount() {
|
||
try {
|
||
const drafts = await postApi.drafts()
|
||
this.draftCount = Array.isArray(drafts) ? drafts.length : 0
|
||
} catch (e) {
|
||
this.draftCount = 0
|
||
}
|
||
},
|
||
/**
|
||
* 跳转独立草稿箱页面
|
||
*/
|
||
goDraftsPage() {
|
||
uni.navigateTo({
|
||
url: '/pages/post/drafts',
|
||
})
|
||
},
|
||
/**
|
||
* 从草稿中还原数据
|
||
* @param {number} draftId
|
||
*/
|
||
async loadDraftPost(draftId) {
|
||
try {
|
||
const drafts = await postApi.drafts()
|
||
const target = (Array.isArray(drafts) ? drafts : []).find((d) => d.draftId === draftId)
|
||
if (target) {
|
||
this.currentDraftId = draftId
|
||
if (target.categoryId) this.form.categoryId = target.categoryId
|
||
this.form.title = target.title || ''
|
||
this.form.content = target.content || ''
|
||
this.form.contact = target.contact || ''
|
||
this.form.phone = target.phone || ''
|
||
this.form.address = target.address || ''
|
||
this.form.areaId = target.areaId || 0
|
||
this.form.area = target.area || ''
|
||
if (Array.isArray(target.media)) this.form.media = [...target.media]
|
||
uni.showToast({ title: '已载入草稿内容', icon: 'none' })
|
||
}
|
||
} catch (e) {}
|
||
},
|
||
/**
|
||
* 载入重新编辑信息
|
||
* @param {number} id
|
||
*/
|
||
async loadEditPost(id) {
|
||
try {
|
||
const p = await postApi.detail(id)
|
||
if (p) {
|
||
if (p.categoryId) this.form.categoryId = p.categoryId
|
||
this.form.title = p.title || ''
|
||
this.form.content = p.content || ''
|
||
this.form.contact = p.contact || ''
|
||
this.form.phone = p.phone || ''
|
||
this.form.address = p.address || ''
|
||
this.form.areaId = p.areaId || 0
|
||
this.form.area = p.area || ''
|
||
this.form.lat = p.lat || null
|
||
this.form.lng = p.lng || null
|
||
if (Array.isArray(p.media)) this.form.media = [...p.media]
|
||
uni.showToast({ title: '已载入待修改内容', icon: 'none' })
|
||
}
|
||
} catch (e) {}
|
||
},
|
||
/**
|
||
* 读取后台发布计费配置
|
||
*/
|
||
async loadPublish() {
|
||
try {
|
||
const p = await postApi.publishConfig()
|
||
this.publish = { ...this.publish, ...p }
|
||
if (p.mode === 'free') {
|
||
this.form.plan = 'free'
|
||
} else {
|
||
const freeAvailable = p.quotaLeft > 0 || p.freeUnlimited === true || Number(p.freeQuotaLeft) > 0
|
||
this.form.plan = freeAvailable ? 'quota' : 'single'
|
||
}
|
||
} catch (e) {}
|
||
},
|
||
/**
|
||
* 切换发布身份(个人 / 商家)
|
||
* @param {'person'|'merchant'} type
|
||
*/
|
||
switchIdentity(type) {
|
||
this.form.identityType = type
|
||
if (type === 'merchant') {
|
||
// 自动带入商家的认证信息
|
||
const u = useUserStore().state.userInfo
|
||
if (u && u.merchant) {
|
||
if (!this.form.contact && u.merchant.contact_name) {
|
||
this.form.contact = u.merchant.contact_name
|
||
}
|
||
if (!this.form.phone && u.merchant.contact_phone) {
|
||
this.form.phone = u.merchant.contact_phone
|
||
}
|
||
if (!this.form.address && u.merchant.address) {
|
||
this.form.address = u.merchant.address
|
||
}
|
||
}
|
||
}
|
||
},
|
||
/**
|
||
* 打开全部分类弹窗抽屉
|
||
*/
|
||
openCatDrawer() {
|
||
this.catDrawerVisible = true
|
||
setTimeout(() => {
|
||
this.catDrawerAnim = true
|
||
}, 20)
|
||
},
|
||
/**
|
||
* 关闭全部分类抽屉
|
||
*/
|
||
closeCatDrawer() {
|
||
this.catDrawerAnim = false
|
||
setTimeout(() => {
|
||
this.catDrawerVisible = false
|
||
}, 200)
|
||
},
|
||
/**
|
||
* 在抽屉中点选分类
|
||
* @param {Object} c 分类项
|
||
*/
|
||
onSelectDrawerCat(c) {
|
||
this.selectCat(c)
|
||
this.closeCatDrawer()
|
||
},
|
||
/**
|
||
* 选中分类
|
||
* @param {Object} c 分类项
|
||
*/
|
||
selectCat(c) {
|
||
if (!c) return
|
||
this.form.categoryId = c.id
|
||
this.triggerAutoSave()
|
||
},
|
||
money(v) {
|
||
const n = Number(v || 0)
|
||
return Number.isInteger(n) ? String(n) : n.toFixed(2)
|
||
},
|
||
isVideo(url) {
|
||
return /\.(mp4|mov|m4v|avi|webm|mkv)(\?|$)/i.test(String(url || ''))
|
||
},
|
||
chooseImage() {
|
||
if (this.uploading) return
|
||
const remain = 6 - this.imageCount
|
||
if (remain <= 0) return uni.showToast({ title: '最多上传 6 张图片', icon: 'none' })
|
||
uni.chooseImage({
|
||
count: remain,
|
||
success: async (res) => {
|
||
await this.uploadFiles(res.tempFilePaths || [], 'image')
|
||
},
|
||
})
|
||
},
|
||
chooseVideo() {
|
||
if (this.uploading) return
|
||
if (this.videoCount >= 1) return uni.showToast({ title: '最多上传 1 个视频', icon: 'none' })
|
||
uni.chooseVideo({
|
||
maxDuration: 60,
|
||
success: async (res) => {
|
||
await this.uploadFiles([res.tempFilePath], 'video')
|
||
},
|
||
})
|
||
},
|
||
async uploadFiles(paths, type) {
|
||
if (!paths.length) return
|
||
this.uploading = true
|
||
uni.showLoading({ title: '上传中…', mask: true })
|
||
try {
|
||
for (const p of paths) {
|
||
const up = await postApi.uploadMedia(p, type)
|
||
if (up && up.url) this.form.media.push(up.url)
|
||
}
|
||
this.triggerAutoSave()
|
||
uni.hideLoading()
|
||
uni.showToast({ title: '上传成功', icon: 'none' })
|
||
} catch (e) {
|
||
uni.hideLoading()
|
||
uni.showToast({ title: e.message || '上传失败', icon: 'none' })
|
||
} finally {
|
||
this.uploading = false
|
||
}
|
||
},
|
||
removeMedia(i) {
|
||
this.form.media.splice(i, 1)
|
||
this.triggerAutoSave()
|
||
},
|
||
chooseLocation() {
|
||
uni.chooseLocation({
|
||
success: (res) => {
|
||
this.form.address = res.address || res.name
|
||
this.form.lat = typeof res.latitude === 'number' ? res.latitude : null
|
||
this.form.lng = typeof res.longitude === 'number' ? res.longitude : null
|
||
// 定位成功后自动匹配省 / 市 / 区(失败保留用户已选区域)
|
||
this.matchRegionByLocation(this.form.lat, this.form.lng)
|
||
this.triggerAutoSave()
|
||
},
|
||
fail: () => {
|
||
uni.showToast({ title: '请选择所属区域并填写地址', icon: 'none' })
|
||
},
|
||
})
|
||
},
|
||
/** 级联选择器选中服务区域 */
|
||
onRegionPicked(area) {
|
||
this.form.areaId = area ? Number(area.areaId) || 0 : 0
|
||
this.form.area = area ? area.district || '' : ''
|
||
this.triggerAutoSave()
|
||
},
|
||
/**
|
||
* 按经纬度匹配服务区域(后端 /home/locate)
|
||
* @param {number|null} lat
|
||
* @param {number|null} lng
|
||
*/
|
||
async matchRegionByLocation(lat, lng) {
|
||
if (lat == null || lng == null) return
|
||
try {
|
||
const found = await homeApi.locate({ lat, lng })
|
||
if (!found || !found.areaId) return
|
||
this.form.areaId = Number(found.areaId) || 0
|
||
this.form.area = found.district || ''
|
||
} catch (e) {}
|
||
},
|
||
onFieldInput() {
|
||
this.triggerAutoSave()
|
||
},
|
||
triggerAutoSave() {
|
||
if (this.draftTimer) clearTimeout(this.draftTimer)
|
||
this.draftTimer = setTimeout(() => {
|
||
if (this.form.title || this.form.content) {
|
||
this.executeSaveDraft(true)
|
||
}
|
||
}, 1200)
|
||
},
|
||
/**
|
||
* 用户点击手动存草稿
|
||
*/
|
||
async saveDraftManual() {
|
||
if (!this.form.title && !this.form.content) {
|
||
uni.showToast({ title: '内容为空,无需保存', icon: 'none' })
|
||
return
|
||
}
|
||
await this.executeSaveDraft(false)
|
||
},
|
||
/**
|
||
* 执行保存草稿接口
|
||
* @param {boolean} silent 是否静默保存
|
||
*/
|
||
async executeSaveDraft(silent = false) {
|
||
try {
|
||
const payload = {
|
||
...this.form,
|
||
draftId: this.currentDraftId || 0,
|
||
}
|
||
const res = await postApi.saveDraft(payload)
|
||
if (res && res.draftId) {
|
||
this.currentDraftId = res.draftId
|
||
}
|
||
this.updateDraftCount()
|
||
if (!silent) {
|
||
uni.showToast({ title: '已存入草稿箱', icon: 'success' })
|
||
}
|
||
} catch (e) {
|
||
if (!silent) {
|
||
uni.showToast({ title: (e && e.message) || '保存失败', icon: 'none' })
|
||
}
|
||
}
|
||
},
|
||
validate() {
|
||
if (!this.form.categoryId) return '请选择所属分类'
|
||
if (!this.form.title || !this.form.title.trim()) return '请填写标题'
|
||
if (!this.form.content || !this.form.content.trim()) return '请填写详细内容'
|
||
if (!this.form.areaId) return '请选择所属区域'
|
||
if (this.form.phone && !/^1\d{10}$/.test(this.form.phone)) return '请输入正确的11位手机号'
|
||
return ''
|
||
},
|
||
/**
|
||
* 提交发布信息
|
||
*/
|
||
async submit() {
|
||
if (this.submitting) return
|
||
if (this.uploading) {
|
||
uni.showToast({ title: '媒体上传中,请稍候', icon: 'none' })
|
||
return
|
||
}
|
||
const err = this.validate()
|
||
if (err) {
|
||
uni.showToast({ title: err, icon: 'none' })
|
||
return
|
||
}
|
||
|
||
this.submitting = true
|
||
try {
|
||
// 订阅消息授权(审核结果);未配置模板时静默跳过
|
||
await requestSubscribe('audit')
|
||
const res = await postApi.create({ ...this.form })
|
||
|
||
// 若有需要支付的订单
|
||
if (res && res.order) {
|
||
try {
|
||
await pay(res.order, this.form.payType)
|
||
} catch (payErr) {
|
||
uni.showToast({ title: payErr.message || '支付未完成', icon: 'none' })
|
||
return
|
||
}
|
||
}
|
||
|
||
// 若发布成功且当前编辑自草稿,自动删除该草稿
|
||
if (this.currentDraftId) {
|
||
postApi.deleteDraft(this.currentDraftId).catch(() => {})
|
||
}
|
||
|
||
uni.showToast({
|
||
title: res.auditStatus === 0 ? '发布成功,审核中' : '发布成功',
|
||
icon: 'success',
|
||
})
|
||
|
||
setTimeout(() => {
|
||
uni.redirectTo({
|
||
url: `/pages/detail/detail?id=${res.postId}`,
|
||
})
|
||
}, 600)
|
||
} catch (e) {
|
||
uni.showToast({ title: e.message || '发布失败', icon: 'none' })
|
||
} finally {
|
||
this.submitting = false
|
||
}
|
||
},
|
||
},
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss" scoped>
|
||
.create {
|
||
min-height: 100vh;
|
||
background-color: $fc-bg;
|
||
padding-bottom: calc(160rpx + env(safe-area-inset-bottom));
|
||
}
|
||
|
||
/* 顶部独立草稿箱入口按钮 */
|
||
.create__draft-entry {
|
||
display: flex;
|
||
align-items: center;
|
||
background: rgba(255, 255, 255, 0.18);
|
||
border: 1rpx solid rgba(255, 255, 255, 0.35);
|
||
border-radius: 28rpx;
|
||
padding: 8rpx 18rpx;
|
||
position: relative;
|
||
cursor: pointer;
|
||
transition: opacity 0.15s ease;
|
||
|
||
&:active {
|
||
opacity: 0.8;
|
||
}
|
||
}
|
||
|
||
.create__draft-icon {
|
||
width: 28rpx;
|
||
height: 28rpx;
|
||
margin-right: 8rpx;
|
||
}
|
||
|
||
.create__draft-text {
|
||
font-size: 24rpx;
|
||
font-weight: 600;
|
||
color: #ffffff;
|
||
}
|
||
|
||
.create__draft-badge {
|
||
position: absolute;
|
||
top: -10rpx;
|
||
right: -10rpx;
|
||
background: #ff5252;
|
||
color: #ffffff;
|
||
font-size: 18rpx;
|
||
font-weight: 700;
|
||
min-width: 28rpx;
|
||
height: 28rpx;
|
||
border-radius: 14rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
padding: 0 6rpx;
|
||
box-shadow: 0 2rpx 6rpx rgba(0, 0, 0, 0.2);
|
||
}
|
||
|
||
/* 表单卡片区域 */
|
||
.create__section {
|
||
margin: 20rpx 28rpx 0;
|
||
padding: 30rpx 28rpx;
|
||
background: #ffffff;
|
||
border-radius: 24rpx;
|
||
box-shadow: 0 4rpx 16rpx rgba(4, 48, 30, 0.03);
|
||
}
|
||
|
||
.create__label {
|
||
font-size: 28rpx;
|
||
font-weight: 700;
|
||
color: $fc-text;
|
||
display: flex;
|
||
align-items: center;
|
||
|
||
&--mt {
|
||
margin-top: 32rpx;
|
||
margin-bottom: 16rpx;
|
||
}
|
||
}
|
||
|
||
.create__required {
|
||
color: #e02020;
|
||
margin-left: 6rpx;
|
||
font-weight: 700;
|
||
}
|
||
|
||
.create__label-row {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
margin-bottom: 20rpx;
|
||
}
|
||
|
||
/* 分类选择单元格(唯一入口) */
|
||
.create__cell {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
min-height: 88rpx;
|
||
padding: 12rpx 0;
|
||
cursor: pointer;
|
||
}
|
||
|
||
.create__cell-left {
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
|
||
.create__cell-right {
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
|
||
.create__cell-ph {
|
||
font-size: 28rpx;
|
||
color: $fc-text-placeholder;
|
||
}
|
||
|
||
.create__arrow {
|
||
font-size: 36rpx;
|
||
color: #b5c7bc;
|
||
margin-left: 12rpx;
|
||
line-height: 1;
|
||
}
|
||
|
||
.create__selected-cat {
|
||
display: flex;
|
||
align-items: center;
|
||
background: rgba(0, 224, 112, 0.12);
|
||
border: 1rpx solid rgba(0, 224, 112, 0.3);
|
||
border-radius: 30rpx;
|
||
padding: 8rpx 20rpx;
|
||
}
|
||
|
||
.create__selected-cat-icon {
|
||
width: 32rpx;
|
||
height: 32rpx;
|
||
margin-right: 10rpx;
|
||
}
|
||
|
||
.create__selected-cat-name {
|
||
font-size: 26rpx;
|
||
font-weight: 700;
|
||
color: #04874a;
|
||
}
|
||
|
||
/* 2. 身份切换组 */
|
||
.create__identity-group {
|
||
display: grid;
|
||
grid-template-columns: 1fr 1fr;
|
||
gap: 20rpx;
|
||
margin-top: 12rpx;
|
||
}
|
||
|
||
.create__identity-item {
|
||
border: 2rpx solid #e2eee6;
|
||
background: #f8fbf9;
|
||
border-radius: 18rpx;
|
||
padding: 22rpx 20rpx;
|
||
display: flex;
|
||
flex-direction: column;
|
||
transition: all 0.2s ease;
|
||
cursor: pointer;
|
||
|
||
&--active {
|
||
border-color: #00e070;
|
||
background: #edfbf3;
|
||
|
||
.create__identity-title {
|
||
color: #04874a;
|
||
}
|
||
}
|
||
}
|
||
|
||
.create__identity-title-row {
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
|
||
.create__identity-title {
|
||
font-size: 28rpx;
|
||
font-weight: 700;
|
||
color: $fc-text;
|
||
}
|
||
|
||
.create__merchant-badge {
|
||
background: #f5a623;
|
||
color: #ffffff;
|
||
font-size: 18rpx;
|
||
font-weight: 700;
|
||
border-radius: 6rpx;
|
||
padding: 2rpx 8rpx;
|
||
margin-left: 10rpx;
|
||
}
|
||
|
||
.create__identity-desc {
|
||
margin-top: 8rpx;
|
||
font-size: 22rpx;
|
||
color: $fc-text-placeholder;
|
||
}
|
||
|
||
/* 输入框与多行文本 */
|
||
.create__input {
|
||
height: 88rpx;
|
||
background: #f8faf8;
|
||
border-radius: 16rpx;
|
||
border: 1rpx solid #e6f0ea;
|
||
padding: 0 24rpx;
|
||
font-size: 28rpx;
|
||
color: $fc-text;
|
||
margin-top: 16rpx;
|
||
transition: border-color 0.2s ease;
|
||
|
||
&:focus {
|
||
border-color: #00e070;
|
||
background: #ffffff;
|
||
}
|
||
|
||
&--row {
|
||
margin-top: 0;
|
||
text-align: right;
|
||
border: none;
|
||
background: transparent;
|
||
padding: 0;
|
||
}
|
||
}
|
||
|
||
.create__textarea {
|
||
width: 100%;
|
||
height: 200rpx;
|
||
background: #f8faf8;
|
||
border-radius: 16rpx;
|
||
border: 1rpx solid #e6f0ea;
|
||
padding: 20rpx 24rpx;
|
||
font-size: 28rpx;
|
||
color: $fc-text;
|
||
box-sizing: border-box;
|
||
|
||
&:focus {
|
||
border-color: #00e070;
|
||
background: #ffffff;
|
||
}
|
||
}
|
||
|
||
.create__ph {
|
||
color: $fc-text-placeholder;
|
||
font-size: 26rpx;
|
||
}
|
||
|
||
.create__count {
|
||
display: block;
|
||
text-align: right;
|
||
font-size: 22rpx;
|
||
color: $fc-text-placeholder;
|
||
margin-top: 8rpx;
|
||
}
|
||
|
||
/* 媒体上传 */
|
||
.create__media {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
gap: 16rpx;
|
||
margin-top: 16rpx;
|
||
}
|
||
|
||
.create__media-item {
|
||
width: 156rpx;
|
||
height: 156rpx;
|
||
border-radius: 16rpx;
|
||
position: relative;
|
||
background: #f4f7f5;
|
||
overflow: hidden;
|
||
}
|
||
|
||
.create__media-img {
|
||
width: 100%;
|
||
height: 100%;
|
||
}
|
||
|
||
.create__media-video {
|
||
width: 100%;
|
||
height: 100%;
|
||
background: #1a2d23;
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
|
||
.create__media-video-txt {
|
||
font-size: 22rpx;
|
||
color: #ffffff;
|
||
margin-top: 8rpx;
|
||
}
|
||
|
||
.create__media-del {
|
||
position: absolute;
|
||
top: 8rpx;
|
||
right: 8rpx;
|
||
width: 38rpx;
|
||
height: 38rpx;
|
||
border-radius: 50%;
|
||
background: rgba(0, 0, 0, 0.65);
|
||
color: #ffffff;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
font-size: 28rpx;
|
||
line-height: 1;
|
||
}
|
||
|
||
.create__upload {
|
||
width: 156rpx;
|
||
height: 156rpx;
|
||
border-radius: 16rpx;
|
||
border: 2rpx dashed #b8d4c4;
|
||
background: #f9fbf9;
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
justify-content: center;
|
||
cursor: pointer;
|
||
|
||
&:active {
|
||
background: #eef7f2;
|
||
}
|
||
}
|
||
|
||
.create__upload-txt {
|
||
font-size: 20rpx;
|
||
color: $fc-text-sub;
|
||
margin-top: 10rpx;
|
||
}
|
||
|
||
.create__uploading {
|
||
display: block;
|
||
margin-top: 12rpx;
|
||
font-size: 22rpx;
|
||
color: #04874a;
|
||
}
|
||
|
||
/* 联系信息行 */
|
||
.create__row {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
height: 96rpx;
|
||
|
||
&--line {
|
||
border-top: 1rpx solid #f2f6f3;
|
||
}
|
||
}
|
||
|
||
.create__row-label {
|
||
font-size: 28rpx;
|
||
font-weight: 600;
|
||
color: $fc-text;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.create__area-picker {
|
||
flex: 1;
|
||
margin-left: 16rpx;
|
||
}
|
||
.create__location {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: flex-end;
|
||
flex: 1;
|
||
max-width: 500rpx;
|
||
cursor: pointer;
|
||
}
|
||
|
||
.create__location-text {
|
||
font-size: 26rpx;
|
||
color: $fc-text-sub;
|
||
margin: 0 8rpx;
|
||
}
|
||
|
||
.create__location-arrow {
|
||
font-size: 32rpx;
|
||
color: #b5c7bc;
|
||
line-height: 1;
|
||
}
|
||
|
||
/* 发布套餐与计费 */
|
||
.create__free-tip {
|
||
background: rgba(0, 224, 112, 0.1);
|
||
border: 1rpx solid rgba(0, 224, 112, 0.25);
|
||
border-radius: 14rpx;
|
||
padding: 20rpx;
|
||
font-size: 24rpx;
|
||
color: #04874a;
|
||
text-align: center;
|
||
}
|
||
|
||
.create__quota {
|
||
font-size: 22rpx;
|
||
color: #f5a623;
|
||
font-weight: 600;
|
||
}
|
||
|
||
.create__plans {
|
||
display: grid;
|
||
grid-template-columns: repeat(2, 1fr);
|
||
gap: 16rpx;
|
||
}
|
||
|
||
.create__plan {
|
||
border: 2rpx solid #e2eee6;
|
||
background: #f8fbf9;
|
||
border-radius: 18rpx;
|
||
padding: 20rpx;
|
||
position: relative;
|
||
cursor: pointer;
|
||
transition: all 0.2s ease;
|
||
|
||
&--active {
|
||
border-color: #00e070;
|
||
background: #edfbf3;
|
||
|
||
.create__plan-name {
|
||
color: #04874a;
|
||
}
|
||
|
||
.create__plan-price {
|
||
color: #04301e;
|
||
}
|
||
}
|
||
}
|
||
|
||
.create__plan-name {
|
||
font-size: 26rpx;
|
||
font-weight: 700;
|
||
color: $fc-text;
|
||
display: block;
|
||
}
|
||
|
||
.create__plan-price {
|
||
font-size: 32rpx;
|
||
font-weight: 800;
|
||
color: $fc-text;
|
||
margin: 8rpx 0;
|
||
display: block;
|
||
}
|
||
|
||
.create__plan-desc {
|
||
font-size: 20rpx;
|
||
color: $fc-text-placeholder;
|
||
display: block;
|
||
}
|
||
|
||
.create__plan-tag {
|
||
position: absolute;
|
||
top: -12rpx;
|
||
right: 14rpx;
|
||
background: #ff5252;
|
||
color: #ffffff;
|
||
font-size: 18rpx;
|
||
font-weight: 700;
|
||
padding: 2rpx 10rpx;
|
||
border-radius: 8rpx;
|
||
}
|
||
|
||
/* 支付方式 */
|
||
.create__pay {
|
||
margin-top: 24rpx;
|
||
padding-top: 24rpx;
|
||
border-top: 1rpx solid #f2f6f3;
|
||
}
|
||
|
||
.create__pay-label {
|
||
font-size: 26rpx;
|
||
font-weight: 600;
|
||
color: $fc-text;
|
||
margin-bottom: 16rpx;
|
||
display: block;
|
||
}
|
||
|
||
.create__pay-types {
|
||
display: flex;
|
||
gap: 20rpx;
|
||
}
|
||
|
||
.create__pay-type {
|
||
flex: 1;
|
||
height: 84rpx;
|
||
border-radius: 16rpx;
|
||
border: 1rpx solid #e2eee6;
|
||
background: #f8faf8;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
gap: 12rpx;
|
||
cursor: pointer;
|
||
|
||
&--active {
|
||
border-color: #00e070;
|
||
background: #ebfaf0;
|
||
|
||
.create__pay-text {
|
||
color: #04874a;
|
||
font-weight: 700;
|
||
}
|
||
}
|
||
}
|
||
|
||
.create__pay-text {
|
||
font-size: 24rpx;
|
||
color: $fc-text;
|
||
}
|
||
|
||
/* 底部主控操作条 */
|
||
.create__bar {
|
||
position: fixed;
|
||
left: 0;
|
||
right: 0;
|
||
bottom: 0;
|
||
z-index: 90;
|
||
background: #ffffff;
|
||
border-top: 1rpx solid #e8f0eb;
|
||
padding: 18rpx 32rpx calc(18rpx + env(safe-area-inset-bottom));
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 24rpx;
|
||
box-shadow: 0 -4rpx 16rpx rgba(0, 0, 0, 0.04);
|
||
}
|
||
|
||
.create__bar-draft {
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
justify-content: center;
|
||
padding: 0 16rpx;
|
||
cursor: pointer;
|
||
}
|
||
|
||
.create__bar-draft-icon {
|
||
width: 36rpx;
|
||
height: 36rpx;
|
||
opacity: 0.7;
|
||
}
|
||
|
||
.create__bar-draft-txt {
|
||
font-size: 20rpx;
|
||
color: $fc-text-sub;
|
||
margin-top: 4rpx;
|
||
}
|
||
|
||
.create__bar-submit {
|
||
flex: 1;
|
||
height: 92rpx;
|
||
border-radius: 46rpx;
|
||
background: linear-gradient(135deg, #00e070 0%, #00c860 100%);
|
||
box-shadow: 0 8rpx 24rpx rgba(0, 224, 112, 0.3);
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
cursor: pointer;
|
||
transition: opacity 0.15s ease, transform 0.15s ease;
|
||
|
||
&:active {
|
||
transform: scale(0.985);
|
||
}
|
||
|
||
&--disabled {
|
||
opacity: 0.55;
|
||
pointer-events: none;
|
||
}
|
||
}
|
||
|
||
.create__bar-submit-txt {
|
||
font-size: 32rpx;
|
||
font-weight: 700;
|
||
color: #04301e; /* 遵守春绿规范:亮绿上必须深墨绿 */
|
||
letter-spacing: 1rpx;
|
||
}
|
||
|
||
/* ================= 全部分类抽屉弹窗 ================= */
|
||
.cat-drawer-mask {
|
||
position: fixed;
|
||
top: 0;
|
||
left: 0;
|
||
right: 0;
|
||
bottom: 0;
|
||
z-index: 999;
|
||
background: rgba(0, 0, 0, 0);
|
||
transition: background-color 0.2s ease;
|
||
display: flex;
|
||
flex-direction: column;
|
||
justify-content: flex-end;
|
||
|
||
&--visible {
|
||
background: rgba(0, 0, 0, 0.5);
|
||
}
|
||
}
|
||
|
||
.cat-drawer {
|
||
background: #ffffff;
|
||
border-radius: 36rpx 36rpx 0 0;
|
||
max-height: 75vh;
|
||
display: flex;
|
||
flex-direction: column;
|
||
transform: translateY(100%);
|
||
transition: transform 0.22s ease-out;
|
||
padding-bottom: env(safe-area-inset-bottom);
|
||
|
||
&--visible {
|
||
transform: translateY(0);
|
||
}
|
||
}
|
||
|
||
.cat-drawer__header {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
padding: 32rpx 36rpx 20rpx;
|
||
border-bottom: 1rpx solid #f0f4f2;
|
||
}
|
||
|
||
.cat-drawer__title {
|
||
font-size: 32rpx;
|
||
font-weight: 700;
|
||
color: $fc-text;
|
||
}
|
||
|
||
.cat-drawer__close {
|
||
width: 54rpx;
|
||
height: 54rpx;
|
||
border-radius: 50%;
|
||
background: #f2f6f4;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
cursor: pointer;
|
||
}
|
||
|
||
.cat-drawer__close-txt {
|
||
font-size: 24rpx;
|
||
color: #8c9e94;
|
||
line-height: 1;
|
||
}
|
||
|
||
.cat-drawer__body {
|
||
max-height: 60vh;
|
||
padding: 24rpx 32rpx;
|
||
box-sizing: border-box;
|
||
}
|
||
|
||
.cat-drawer__grid {
|
||
display: grid;
|
||
grid-template-columns: repeat(3, 1fr);
|
||
gap: 20rpx;
|
||
}
|
||
|
||
.cat-drawer__item {
|
||
background: #f7faf8;
|
||
border: 2rpx solid #e7efe9;
|
||
border-radius: 20rpx;
|
||
padding: 24rpx 16rpx;
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
justify-content: center;
|
||
position: relative;
|
||
transition: all 0.15s ease;
|
||
cursor: pointer;
|
||
|
||
&--active {
|
||
border-color: #00e070;
|
||
background: #ebfaf0;
|
||
box-shadow: 0 4rpx 16rpx rgba(0, 224, 112, 0.2);
|
||
|
||
.cat-drawer__name {
|
||
color: #04874a;
|
||
font-weight: 700;
|
||
}
|
||
}
|
||
}
|
||
|
||
.cat-drawer__icon-box {
|
||
width: 72rpx;
|
||
height: 72rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
margin-bottom: 12rpx;
|
||
}
|
||
|
||
.cat-drawer__icon {
|
||
width: 60rpx;
|
||
height: 60rpx;
|
||
}
|
||
|
||
.cat-drawer__name {
|
||
font-size: 26rpx;
|
||
color: $fc-text;
|
||
text-align: center;
|
||
}
|
||
|
||
.cat-drawer__check {
|
||
position: absolute;
|
||
top: 8rpx;
|
||
right: 12rpx;
|
||
font-size: 22rpx;
|
||
font-weight: 900;
|
||
color: #04874a;
|
||
}
|
||
|
||
.cat-drawer__space {
|
||
height: 40rpx;
|
||
}
|
||
</style>
|