本次提交内容包括: 1. 替换13个二级分类为真实商业实拍图,同步更新本地与线上数据库 2. 新增会员拨打额度耗尽引导开通会员功能 3. 优化发布页分类选择逻辑,增加会员权益展示 4. 修复分类名称显示问题,完善相关交互逻辑 5. 新增图片同步工具脚本,确保线上线下数据一致性
2774 行
73 KiB
Vue
2774 行
73 KiB
Vue
<template>
|
||
<view class="create fc-page">
|
||
<!-- 统一顶部深绿质感导航栏 -->
|
||
<fc-navbar title="发布信息" theme="gradient" :show-back="true" />
|
||
|
||
<!-- 1. 分类选择(一级大类与二级品类拆分为两行独立输入) -->
|
||
<view class="fc-card create__section">
|
||
<view class="create__cell" @click="openCatStep(1)">
|
||
<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 class="create__cell create__cell--sub" :class="{ 'create__cell--disabled': !currentCat }" @click="openCatStep(2)">
|
||
<view class="create__cell-left">
|
||
<text class="create__label">产品品类</text>
|
||
<text v-if="hasSubCategories" class="create__required">*</text>
|
||
</view>
|
||
<view class="create__cell-right">
|
||
<view v-if="selectedSubCatDisplay" class="create__selected-cat">
|
||
<image class="create__selected-cat-icon" :src="selectedSubCatDisplay.icon" mode="aspectFit" />
|
||
<text class="create__selected-cat-name">{{ selectedSubCatDisplay.name }}</text>
|
||
</view>
|
||
<text v-else class="create__cell-ph">{{ currentCat ? '请选择品类' : '请先选择大类' }}</text>
|
||
<text class="create__arrow">›</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 2. 发布身份选择(个人 / 商家二选一,未认证商家同样展示并支持跳转认证) -->
|
||
<view 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',
|
||
'create__identity-item--unauth': !isMerchantUser
|
||
}"
|
||
@click="switchIdentity('merchant')"
|
||
>
|
||
<view class="create__identity-title-row">
|
||
<text class="create__identity-title">商家</text>
|
||
<text class="create__merchant-badge" :class="'create__merchant-badge--' + merchantBadgeClass">
|
||
{{ merchantBadgeText }}
|
||
</text>
|
||
</view>
|
||
<text class="create__identity-desc fc-ellipsis">{{ merchantDescText }}</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-row create__label--mt">
|
||
<text class="create__label">轮播图片 / 视频</text>
|
||
</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__label-row">
|
||
<text class="create__label">销售价格<text v-if="isFarmCategory" class="create__required">*</text></text>
|
||
</view>
|
||
|
||
<!-- 价格自由输入(支持 1万元 / 2000元/斤 / 面议 等写法,提交时自动拆分数值与单位) -->
|
||
<view class="create__price-box">
|
||
<view class="create__price-input-row">
|
||
<input
|
||
v-model="form.price"
|
||
class="create__price-input"
|
||
type="text"
|
||
placeholder="如:1万元 / 2000元/斤"
|
||
maxlength="16"
|
||
placeholder-class="create__ph"
|
||
@input="onFieldInput"
|
||
/>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 农产品专属规格参数(种植面积、采摘时间、预计量产,仅农产品分类显示) -->
|
||
<view v-if="isFarmCategory">
|
||
<view class="create__label-row create__label--mt">
|
||
<text class="create__label">产地规格信息</text>
|
||
</view>
|
||
|
||
<!-- 种植面积(文本输入) -->
|
||
<view class="create__row">
|
||
<text class="create__row-label">种植面积<text class="create__required">*</text></text>
|
||
<input
|
||
v-model="form.plantArea"
|
||
class="create__input create__input--row"
|
||
placeholder="如:50亩 / 30个大棚"
|
||
maxlength="32"
|
||
placeholder-class="create__ph"
|
||
@input="onFieldInput"
|
||
/>
|
||
</view>
|
||
|
||
<!-- 采摘时间(时间选择) -->
|
||
<view class="create__row create__row--line">
|
||
<text class="create__row-label">采摘时间<text class="create__required">*</text></text>
|
||
<picker
|
||
class="create__picker-flex"
|
||
mode="date"
|
||
:value="form.harvestTime"
|
||
start="2024-01-01"
|
||
end="2030-12-31"
|
||
@change="onHarvestTimeChange"
|
||
>
|
||
<view class="create__picker-inner">
|
||
<text :class="form.harvestTime ? 'create__picker-val' : 'create__picker-ph'">
|
||
{{ form.harvestTime || '选择采摘/上市日期' }}
|
||
</text>
|
||
<text class="create__location-arrow">›</text>
|
||
</view>
|
||
</picker>
|
||
</view>
|
||
|
||
<!-- 量产(范围选择) -->
|
||
<view class="create__row create__row--line">
|
||
<text class="create__row-label">预计量产<text class="create__required">*</text></text>
|
||
<picker
|
||
class="create__picker-flex"
|
||
mode="selector"
|
||
:range="outputRangeOptions"
|
||
:value="outputRangeIndex"
|
||
@change="onOutputRangeChange"
|
||
>
|
||
<view class="create__picker-inner">
|
||
<text :class="form.outputRange ? 'create__picker-val' : 'create__picker-ph'">
|
||
{{ form.outputRange || '选择预计产量范围' }}
|
||
</text>
|
||
<text class="create__location-arrow">›</text>
|
||
</view>
|
||
</picker>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 特色亮点标签(最多5个) -->
|
||
<view class="create__label create__label--mt">特色亮点(最多5个)</view>
|
||
|
||
<!-- 已选标签胶囊 -->
|
||
<view v-if="form.tags && form.tags.length" class="create__tags-wrapper">
|
||
<view
|
||
v-for="(t, i) in form.tags"
|
||
:key="'tag-' + t + i"
|
||
class="create__tag-badge"
|
||
@click="removeTag(i)"
|
||
>
|
||
<text class="create__tag-badge-text">{{ t }}</text>
|
||
<text class="create__tag-badge-del">×</text>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 推荐标签胶囊 -->
|
||
<view v-if="recommendTags.length > 0" class="create__recommend-tags">
|
||
<text class="create__recommend-title">推荐亮点:</text>
|
||
<view class="create__recommend-chips">
|
||
<view
|
||
v-for="rt in recommendTags"
|
||
:key="rt"
|
||
class="create__recommend-chip"
|
||
:class="{ 'create__recommend-chip--disabled': form.tags.includes(rt) }"
|
||
@click="addRecommendTag(rt)"
|
||
>
|
||
+ {{ rt }}
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 手动添加自定义标签 -->
|
||
<view v-if="form.tags.length < 5" class="create__tag-custom-row">
|
||
<input
|
||
v-model="customTagInput"
|
||
class="create__tag-custom-input"
|
||
placeholder="自定义亮点,如:随时看"
|
||
maxlength="8"
|
||
placeholder-class="create__ph"
|
||
confirm-type="done"
|
||
@confirm="addCustomTag"
|
||
/>
|
||
<view class="create__tag-custom-btn" @click="addCustomTag">
|
||
<text class="create__tag-custom-btn-txt">添加</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 5. 详细内容(后置兜底补充:价格、产地规格等结构化字段填完后按需展开描述) -->
|
||
<view class="fc-card create__section">
|
||
<view class="create__label">详细内容<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>
|
||
|
||
<!-- 6. 联系信息(联系人 → 电话 → 位置 → 区域) -->
|
||
<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>
|
||
|
||
<!-- 7. 发布权益与会员特权(置于表单底部发布前,避免干扰顶部核心填写) -->
|
||
<view class="create__member-banner" :class="{ 'create__member-banner--vip': isMember }" @click="goMember">
|
||
<image class="create__member-icon" :src="iconUrl('crown')" mode="aspectFit" />
|
||
<view class="create__member-info">
|
||
<view class="create__member-title-row">
|
||
<text class="create__member-title">{{ isMember ? 'VIP 会员发帖特权生效中' : '开通同城 VIP 会员' }}</text>
|
||
<text v-if="isMember" class="create__member-tag">已开通</text>
|
||
</view>
|
||
<text class="create__member-desc">
|
||
{{ isMember ? '尊享每日海量免费发布、专属身份认证与极速展示' : '尊享每日免费发布、信息置顶折扣、更多拨打次数' }}
|
||
</text>
|
||
</view>
|
||
<view class="create__member-btn-box">
|
||
<text class="create__member-go">{{ isMember ? '权益中心 ›' : '去开通 ›' }}</text>
|
||
</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 ? '提交中…' : submitBtnText }}
|
||
</text>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="fc-safe-bottom"></view>
|
||
|
||
<!-- ================= 付费发布底部收银台弹窗(免费额度与会员额度用尽时拉起) ================= -->
|
||
<view v-if="showPayModal" class="create__cashier-mask" @click="showPayModal = false" @touchmove.stop.prevent>
|
||
<view class="create__cashier" @click.stop>
|
||
<view class="create__cashier-header">
|
||
<text class="create__cashier-title">支付发布费用</text>
|
||
<text class="create__cashier-close" @click="showPayModal = false">✕</text>
|
||
</view>
|
||
|
||
<view class="create__cashier-target">
|
||
<text class="create__cashier-target-sub">
|
||
{{ discountLabel ? `已享会员 ${discountLabel}(原价 ¥${money(publish.singlePrice)})` : '当前免费发布额度已用完,本次按单条计费' }}
|
||
</text>
|
||
<view class="create__cashier-price-row">
|
||
<text class="create__cashier-price-symbol">¥</text>
|
||
<text class="create__cashier-price-val">{{ money(singlePriceFinal) }}</text>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="create__cashier-methods">
|
||
<view
|
||
class="create__cashier-method"
|
||
:class="{ 'create__cashier-method--active': form.payType === 'wxpay' }"
|
||
@click="form.payType = 'wxpay'"
|
||
>
|
||
<image class="fc-icon fc-icon--md" :src="iconUrl('paywechat')" mode="aspectFit" />
|
||
<view class="create__cashier-method-info">
|
||
<text class="create__cashier-method-name">微信支付</text>
|
||
<text class="create__cashier-method-tip">微信安全快捷支付</text>
|
||
</view>
|
||
<view class="create__cashier-radio">
|
||
<view v-if="form.payType === 'wxpay'" class="create__cashier-radio-inner"></view>
|
||
</view>
|
||
</view>
|
||
|
||
<view
|
||
class="create__cashier-method"
|
||
:class="{ 'create__cashier-method--active': form.payType === 'balance' }"
|
||
@click="form.payType = 'balance'"
|
||
>
|
||
<image class="fc-icon fc-icon--md" :src="iconUrl('wallet')" mode="aspectFit" />
|
||
<view class="create__cashier-method-info">
|
||
<text class="create__cashier-method-name">余额支付</text>
|
||
<text class="create__cashier-method-tip">当前可用余额 ¥{{ balance }}</text>
|
||
</view>
|
||
<view class="create__cashier-radio">
|
||
<view v-if="form.payType === 'balance'" class="create__cashier-radio-inner"></view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="create__cashier-vip-banner" @click="goMemberCenter">
|
||
<image class="fc-icon fc-icon--sm" :src="iconUrl('crown')" mode="aspectFit" />
|
||
<text class="create__cashier-vip-text">开通 VIP 会员,尊享海量免费发布额度与专属折扣</text>
|
||
<text class="create__cashier-vip-arrow">去开通 ›</text>
|
||
</view>
|
||
|
||
<view class="create__cashier-btn" :class="{ 'create__cashier-btn--disabled': submitting }" @click="confirmCashierPay">
|
||
<text>{{ submitting ? '处理中…' : `确认支付 ¥${money(singlePriceFinal)} 并发布` }}</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- ================= 分类两步选择抽屉(第一步选一级大类 → 第二步选二级品类) ================= -->
|
||
<view
|
||
v-if="catDrawerVisible"
|
||
class="cat-drawer-mask"
|
||
:class="{ 'cat-drawer-mask--visible': catDrawerAnim }"
|
||
@click="closeCatDrawer"
|
||
@touchmove.stop.prevent
|
||
>
|
||
<view
|
||
class="cat-drawer"
|
||
:class="{ 'cat-drawer--visible': catDrawerAnim }"
|
||
@click.stop
|
||
>
|
||
<view class="cat-drawer__header">
|
||
<text class="cat-drawer__title">{{ catDrawerStepTitle }}</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 v-if="catDrawerStep === 1" class="cat-drawer__grid cat-drawer__grid--parent">
|
||
<view
|
||
v-for="c in categories"
|
||
:key="c.id"
|
||
class="cat-drawer__item cat-drawer__item--parent"
|
||
:class="{ 'cat-drawer__item--active': Number(form.categoryId) === Number(c.id) }"
|
||
@click="onSelectDrawerParentCat(c)"
|
||
>
|
||
<view class="cat-drawer__cover-box cat-drawer__cover-box--parent">
|
||
<image class="cat-drawer__cover" :src="catIcon(c)" mode="aspectFit" />
|
||
</view>
|
||
<view class="cat-drawer__caption">
|
||
<text class="cat-drawer__name">{{ c.name }}</text>
|
||
<text class="cat-drawer__count">{{ (c.children && c.children.length) || 0 }} 个品类 ›</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 第二步:选择该大类下的二级品类(花菜、白菜、紫甘蓝、青甘蓝、青菜等,大图为主文字辅助) -->
|
||
<view v-else class="cat-drawer__grid">
|
||
<view
|
||
v-if="!drawerSubCategories.length"
|
||
class="cat-drawer__item cat-drawer__item--active"
|
||
@click="onSelectDrawerParentOnly"
|
||
>
|
||
<view class="cat-drawer__cover-box">
|
||
<image class="cat-drawer__cover" :src="catIcon(currentCat || {})" mode="aspectFit" />
|
||
</view>
|
||
<view class="cat-drawer__caption">
|
||
<text class="cat-drawer__name">全部</text>
|
||
</view>
|
||
<view class="cat-drawer__check">✓</view>
|
||
</view>
|
||
<view
|
||
v-for="sub in drawerSubCategories"
|
||
:key="sub.id"
|
||
class="cat-drawer__item"
|
||
:class="{ 'cat-drawer__item--active': Number(form.subCategoryId) === Number(sub.id) }"
|
||
@click="onSelectDrawerSubCat(sub)"
|
||
>
|
||
<view class="cat-drawer__cover-box">
|
||
<image class="cat-drawer__cover" :src="catIcon(sub)" mode="aspectFill" />
|
||
</view>
|
||
<view class="cat-drawer__caption">
|
||
<text class="cat-drawer__name">{{ sub.name }}</text>
|
||
</view>
|
||
<view v-if="Number(form.subCategoryId) === Number(sub.id)" class="cat-drawer__check">✓</view>
|
||
</view>
|
||
</view>
|
||
<view class="cat-drawer__space"></view>
|
||
</scroll-view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 支付密码弹窗(余额支付验证) -->
|
||
<fc-pay-password :show="pwdPopup.show" :title="pwdPopup.title" :tip="pwdPopup.tip"
|
||
@close="pwdPopup.show = false" @confirm="onPwdConfirm" />
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
/**
|
||
* 信息发布页面(重构版)
|
||
* 核心优化:
|
||
* 1. 分类选择由接口动态返回决定,统一收敛为「所属分类单元格 + 全部分类抽屉」单一入口,
|
||
* 避免同一分类在页面内重复出现(已选值只展示一次);
|
||
* 2. 草稿箱列表独立于 /pages/post/drafts 页面(发布页不提供入口,用户中心访问),发布页仅保留「存草稿」动作;
|
||
* 3. 支持个人 / 商家身份二选一(已认证商家可切换为商家身份发布并附带门店信息);
|
||
* 4. 表单输入顺序按用户心智模型排布:分类 → 身份 → 标题/图片 → 价格/产地规格 → 详细内容兜底 → 联系方式,
|
||
* 相关字段逻辑分组(field-grouping),校验顺序与视觉顺序一致;
|
||
* 5. 价格为自由文本输入(如:1万元 / 2000元/斤 / 面议),提交时拆分为数值 + 单位与后端结构兼容;
|
||
* 6. 严格遵循春绿规范,大厂级布局与无障碍高对比度。
|
||
*/
|
||
import FcNavbar from '@/components/fc-navbar/fc-navbar.vue'
|
||
import FcAreaPicker from '@/components/fc-area-picker/fc-area-picker.vue'
|
||
import FcPayPassword from '@/components/fc-pay-password/fc-pay-password.vue'
|
||
import homeApi from '@/common/api/home.js'
|
||
import postApi from '@/common/api/post.js'
|
||
import memberApi from '@/common/api/member.js'
|
||
import { useUserStore } from '@/common/store/index.js'
|
||
import { iconUrl, categoryIconUrl, loadUiConfig, requestSubscribe, uiState } 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, FcPayPassword },
|
||
data() {
|
||
return {
|
||
categories: [],
|
||
currentDraftId: 0, // 当前正在编辑的草稿ID(编辑自某草稿)
|
||
isMember: false, // 是否有效期内会员(非会员显示开通引导条)
|
||
// 平铺服务区域(每条自带省/市/区县),交给级联选择器分组
|
||
areaRows: [],
|
||
submitting: false,
|
||
uploading: false,
|
||
showPayModal: false,
|
||
pwdPopup: { show: false, title: '', tip: '' },
|
||
draftTimer: null,
|
||
catDrawerVisible: false,
|
||
catDrawerAnim: false,
|
||
// 分类两步选择:1 = 选一级大类,2 = 选二级品类
|
||
catDrawerStep: 1,
|
||
selectedAllSubCat: false, // 是否显式选中全部二级品类
|
||
customTagInput: '',
|
||
outputRangeOptions: [
|
||
'1000斤以下',
|
||
'1000-5000斤',
|
||
'5000-1万斤',
|
||
'1万-5万斤',
|
||
'5万-10万斤',
|
||
'10万斤以上',
|
||
],
|
||
form: {
|
||
categoryId: 0,
|
||
subCategoryId: 0,
|
||
identityType: 'person', // 'person' | 'merchant'
|
||
title: '',
|
||
content: '',
|
||
media: [],
|
||
price: '',
|
||
isNegotiable: false,
|
||
plantArea: '',
|
||
harvestTime: '',
|
||
outputRange: '',
|
||
tags: [],
|
||
contact: '',
|
||
phone: '',
|
||
address: '',
|
||
province: '',
|
||
city: '',
|
||
areaId: 0,
|
||
area: '',
|
||
lat: null,
|
||
lng: null,
|
||
plan: 'free',
|
||
payType: config.defaultPayType || 'wxpay',
|
||
},
|
||
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: {
|
||
/**
|
||
* 当前用户是否已认证为商家
|
||
* @returns {boolean}
|
||
*/
|
||
isMerchantUser() {
|
||
try {
|
||
const u = useUserStore().state.userInfo
|
||
return !!(u && (u.isMerchant || Number(u.merchantStatus) === 1))
|
||
} catch (e) {
|
||
return false
|
||
}
|
||
},
|
||
/**
|
||
* 商家资质审核状态
|
||
* @returns {number} -1未申请, 0审核中, 1已通过, 2未通过
|
||
*/
|
||
merchantAuditStatus() {
|
||
try {
|
||
const u = useUserStore().state.userInfo
|
||
if (u && u.merchantStatus != null) {
|
||
return Number(u.merchantStatus)
|
||
}
|
||
if (u && u.isMerchant) return 1
|
||
return -1
|
||
} catch (e) {
|
||
return -1
|
||
}
|
||
},
|
||
/**
|
||
* 商家店铺名称
|
||
* @returns {string}
|
||
*/
|
||
merchantShopName() {
|
||
try {
|
||
const u = useUserStore().state.userInfo
|
||
return (u && u.merchant && (u.merchant.shop_name || u.merchant.name)) || ''
|
||
} catch (e) {
|
||
return ''
|
||
}
|
||
},
|
||
/**
|
||
* 商家身份徽章展示文案
|
||
* @returns {string}
|
||
*/
|
||
merchantBadgeText() {
|
||
if (this.isMerchantUser) return '已认证'
|
||
const s = this.merchantAuditStatus
|
||
if (s === 0) return '审核中'
|
||
if (s === 2) return '未通过'
|
||
return '去认证'
|
||
},
|
||
/**
|
||
* 商家身份徽章样式类名
|
||
* @returns {'approved'|'pending'|'rejected'|'unauth'}
|
||
*/
|
||
merchantBadgeClass() {
|
||
if (this.isMerchantUser) return 'approved'
|
||
const s = this.merchantAuditStatus
|
||
if (s === 0) return 'pending'
|
||
if (s === 2) return 'rejected'
|
||
return 'unauth'
|
||
},
|
||
/**
|
||
* 商家身份卡片副描述文案
|
||
* @returns {string}
|
||
*/
|
||
merchantDescText() {
|
||
if (this.isMerchantUser) {
|
||
return this.merchantShopName || '展示店铺专属信息'
|
||
}
|
||
const s = this.merchantAuditStatus
|
||
if (s === 0) return '资质审核中,点击查看'
|
||
if (s === 2) return '资质未通过,点击修改'
|
||
return '未认证,点击立即前往认证'
|
||
},
|
||
/**
|
||
* 当前选中的一级分类对象
|
||
* @returns {Object|null}
|
||
*/
|
||
currentCat() {
|
||
return this.categories.find((c) => Number(c.id) === Number(this.form.categoryId)) || null
|
||
},
|
||
/**
|
||
* 当前选中的二级分类对象
|
||
* @returns {Object|null}
|
||
*/
|
||
currentSubCat() {
|
||
const children = (this.currentCat && this.currentCat.children) || []
|
||
return children.find((s) => Number(s.id) === Number(this.form.subCategoryId)) || null
|
||
},
|
||
/**
|
||
* 当前一级大类是否包含二级子品类
|
||
* @returns {boolean}
|
||
*/
|
||
hasSubCategories() {
|
||
return !!(this.currentCat && Array.isArray(this.currentCat.children) && this.currentCat.children.length > 0)
|
||
},
|
||
/**
|
||
* 页面回显的产品品类信息(支持具体二级分类对象或全部)
|
||
* @returns {{ name: string, icon: string } | null}
|
||
*/
|
||
selectedSubCatDisplay() {
|
||
if (!this.currentCat) return null
|
||
// 1. 若选了具体二级分类
|
||
if (this.currentSubCat) {
|
||
return {
|
||
name: this.currentSubCat.name,
|
||
icon: this.catIcon(this.currentSubCat),
|
||
}
|
||
}
|
||
// 2. 若该一级大类本身没有二级分类,或者显式选择了全部
|
||
if (!this.hasSubCategories || this.selectedAllSubCat) {
|
||
return {
|
||
name: '全部',
|
||
icon: this.catIcon(this.currentCat),
|
||
}
|
||
}
|
||
return null
|
||
},
|
||
/**
|
||
* 当前选中分类是否为农产品类(kind=farm):
|
||
* 决定「种植面积/采摘时间/预计量产」的显隐与必填校验;历史数据无 kind 时按农产品处理
|
||
* @returns {boolean}
|
||
*/
|
||
isFarmCategory() {
|
||
if (!this.currentCat) return true
|
||
return (this.currentCat.kind || 'farm') === 'farm'
|
||
},
|
||
/**
|
||
* 分类抽屉内当前大类下的二级分类列表
|
||
* @returns {Array}
|
||
*/
|
||
drawerSubCategories() {
|
||
return (this.currentCat && Array.isArray(this.currentCat.children)) ? this.currentCat.children : []
|
||
},
|
||
/**
|
||
* 分类抽屉标题(随打开的输入行切换)
|
||
* @returns {string}
|
||
*/
|
||
catDrawerStepTitle() {
|
||
if (this.catDrawerStep === 1) return '选择所属大类'
|
||
return `选择${this.currentCat ? this.currentCat.name : ''}品类`
|
||
},
|
||
/**
|
||
* 预计量产下拉框当前选中索引
|
||
* @returns {number}
|
||
*/
|
||
outputRangeIndex() {
|
||
const idx = this.outputRangeOptions.indexOf(this.form.outputRange)
|
||
return idx >= 0 ? idx : 0
|
||
},
|
||
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 (freeUnlimited || freeLeft > 0) {
|
||
const cycle = { day: '今日', daily: '今日', month: '本月', monthly: '本月', total: '累计' }[p.freeQuotaCycle] || '本期'
|
||
list.push({
|
||
key: 'quota',
|
||
name: `${cycle}免费`,
|
||
price: '免费',
|
||
desc: freeUnlimited ? '不限条数' : `${cycle}剩余 ${freeLeft} 条`,
|
||
tag: '可用',
|
||
})
|
||
} else if (p.quotaLeft > 0) {
|
||
list.push({ key: 'quota', name: '套餐额度', price: '免费', desc: `剩余 ${p.quotaLeft} 条`, tag: '可用' })
|
||
}
|
||
list.push({
|
||
key: 'single',
|
||
name: this.discountLabel ? '会员单条' : '单条发布',
|
||
price: `¥${this.money(this.singlePriceFinal)}`,
|
||
desc: this.discountLabel ? `${this.discountLabel}(原价 ¥${this.money(p.singlePrice)})` : '付费发布 1 条',
|
||
tag: this.discountLabel ? '会员价' : '',
|
||
})
|
||
return list
|
||
},
|
||
needPay() {
|
||
return this.publish.mode === 'paid' && this.form.plan !== 'quota'
|
||
},
|
||
/**
|
||
* 底部发布主按钮文案(免费/有额度时直接发布,无额度时提示立即发布拉起收银台)
|
||
* @returns {string}
|
||
*/
|
||
submitBtnText() {
|
||
const p = this.publish
|
||
if (p.mode === 'free' || p.freeUnlimited === true || Number(p.freeQuotaLeft) === -1) {
|
||
return '立即发布'
|
||
}
|
||
const freeLeft = Number(p.freeQuotaLeft || 0)
|
||
if (freeLeft > 0) {
|
||
const cycle = { day: '今日', daily: '今日', month: '本月', monthly: '本月', total: '免费' }[p.freeQuotaCycle] || '免费'
|
||
return `立即发布(${cycle}剩 ${freeLeft} 条)`
|
||
}
|
||
if (Number(p.quotaLeft || 0) > 0) {
|
||
return `立即发布(会员剩 ${p.quotaLeft} 条)`
|
||
}
|
||
return '立即发布'
|
||
},
|
||
/**
|
||
* 当前选中付费套餐的价格文本(仅用于支付密码弹窗提示)
|
||
*/
|
||
selectedPlanPrice() {
|
||
const plan = this.plans.find((p) => p.key === this.form.plan)
|
||
return plan ? String(plan.price).replace(/[¥元]/g, '') : ''
|
||
},
|
||
/**
|
||
* 当前分类对应的常用农产品亮点标签
|
||
*/
|
||
recommendTags() {
|
||
const catId = Number(this.form.categoryId || 0)
|
||
if (catId === 2) {
|
||
return ['产地直供', '现摘现发', '树上熟', '甜度高', '量大从优', '支持代办']
|
||
}
|
||
return ['基地直发', '高山有机', '现砍现装', '冷链锁鲜', '量大从优', '支持看货']
|
||
},
|
||
},
|
||
onLoad(query) {
|
||
if (query && query.categoryId) this.form.categoryId = Number(query.categoryId)
|
||
if (query && query.subCategoryId) this.form.subCategoryId = Number(query.subCategoryId)
|
||
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()
|
||
},
|
||
/**
|
||
* 页面每次显示时触发:刷新发布额度并同步最新用户资料(如从会员中心开通返回后立即刷新额度)
|
||
*/
|
||
async onShow() {
|
||
this.loadPublish()
|
||
try {
|
||
const userStore = useUserStore()
|
||
if (userStore.isLogin.value) {
|
||
await userStore.fetchProfile()
|
||
}
|
||
} catch (e) {}
|
||
},
|
||
methods: {
|
||
iconUrl,
|
||
assetUrl,
|
||
/**
|
||
* 跳转会员中心开通或续费套餐(关闭收银台弹窗,开卡返回后自动刷新额度)
|
||
*/
|
||
goMemberCenter() {
|
||
this.showPayModal = false
|
||
uni.navigateTo({ url: '/pages/member/index' })
|
||
},
|
||
/**
|
||
* 跳转会员中心(发布页顶部开通引导条)
|
||
*/
|
||
goMember() {
|
||
uni.navigateTo({ url: '/pages/member/index' })
|
||
},
|
||
catIcon(c) {
|
||
if (!c) return ''
|
||
if (c.image && /^https?:\/\/|^\/uploads\/|^\/static\//i.test(c.image)) {
|
||
// 包内自带图标(categories/icons 插画)直接用包内路径;其余拼后端域名,否则裂图
|
||
return /^\/static\/(categories|icons)\//i.test(c.image) ? c.image : assetUrl(c.image)
|
||
}
|
||
return (c.iconKey && iconUrl(c.iconKey)) || categoryIconUrl(c.id)
|
||
},
|
||
/**
|
||
* 页面基础数据初始化(自动加载一二级分类树,并根据定位默认选中当前区域)
|
||
*/
|
||
async init() {
|
||
try {
|
||
const cats = await homeApi.categories()
|
||
this.categories = Array.isArray(cats) ? cats : []
|
||
// 若路由传入的 categoryId 是二级分类,自动反查父级
|
||
if (this.form.categoryId && this.categories.length) {
|
||
const isTop = this.categories.some((c) => Number(c.id) === Number(this.form.categoryId))
|
||
if (!isTop) {
|
||
for (const p of this.categories) {
|
||
const foundSub = (p.children || []).find((s) => Number(s.id) === Number(this.form.categoryId))
|
||
if (foundSub) {
|
||
this.form.categoryId = Number(p.id)
|
||
this.form.subCategoryId = Number(foundSub.id)
|
||
break
|
||
}
|
||
}
|
||
}
|
||
}
|
||
if (!this.form.categoryId && this.categories.length) {
|
||
this.form.categoryId = Number(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) {}
|
||
|
||
// 默认根据定位匹配当前服务区域
|
||
if (!this.form.areaId && typeof uni !== 'undefined' && uni.getLocation) {
|
||
uni.getLocation({
|
||
type: 'gcj02',
|
||
success: (res) => {
|
||
if (!this.form.lat) this.form.lat = res.latitude
|
||
if (!this.form.lng) this.form.lng = res.longitude
|
||
this.matchRegionByLocation(res.latitude, res.longitude)
|
||
},
|
||
fail: () => {},
|
||
})
|
||
}
|
||
|
||
this.loadPublish()
|
||
},
|
||
/**
|
||
* 从草稿中还原数据
|
||
* @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
|
||
if (target.subCategoryId) this.form.subCategoryId = target.subCategoryId
|
||
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.province = target.province || ''
|
||
this.form.city = target.city || ''
|
||
this.form.areaId = target.areaId || 0
|
||
this.form.area = target.area || ''
|
||
this.form.plantArea = target.plantArea || ''
|
||
this.form.harvestTime = target.harvestTime || ''
|
||
this.form.outputRange = target.outputRange || ''
|
||
this.form.lat = target.lat || null
|
||
this.form.lng = target.lng || null
|
||
if (target.identityType) this.form.identityType = target.identityType
|
||
if (target.price != null && target.price > 0) {
|
||
// 数值 + 单位还原为自由文本(如:2000 + 元/斤 → 2000元/斤)
|
||
this.form.price = String(target.price) + (target.priceUnit && target.priceUnit !== '面议' ? target.priceUnit : '')
|
||
} else if (target.priceUnit) {
|
||
this.form.price = target.priceUnit
|
||
}
|
||
if (Array.isArray(target.tags)) this.form.tags = [...target.tags]
|
||
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
|
||
if (p.subCategoryId) this.form.subCategoryId = p.subCategoryId
|
||
this.form.title = p.title || ''
|
||
this.form.content = p.content || ''
|
||
this.form.contact = p.contactName || ''
|
||
this.form.phone = (p.phone && !String(p.phone).includes('*')) ? p.phone : ''
|
||
this.form.address = p.address || ''
|
||
this.form.province = p.province || ''
|
||
this.form.city = p.city || ''
|
||
this.form.areaId = p.areaId || 0
|
||
this.form.area = p.area || ''
|
||
this.form.plantArea = p.plantArea || ''
|
||
this.form.harvestTime = p.harvestTime || ''
|
||
this.form.outputRange = p.outputRange || ''
|
||
this.form.lat = p.lat || null
|
||
this.form.lng = p.lng || null
|
||
if (p.identityType) this.form.identityType = p.identityType
|
||
if (p.price != null && p.price > 0) {
|
||
// 数值 + 单位还原为自由文本(如:2000 + 元/斤 → 2000元/斤)
|
||
this.form.price = String(p.price) + (p.priceUnit && p.priceUnit !== '面议' ? p.priceUnit : '')
|
||
} else if (p.priceUnit) {
|
||
this.form.price = p.priceUnit
|
||
}
|
||
if (Array.isArray(p.tags)) this.form.tags = [...p.tags]
|
||
if (Array.isArray(p.media)) this.form.media = [...p.media]
|
||
uni.showToast({ title: '已载入待修改内容', icon: 'none' })
|
||
}
|
||
} catch (e) {}
|
||
},
|
||
/**
|
||
* 选择采摘日期
|
||
* @param {Object} e
|
||
*/
|
||
onHarvestTimeChange(e) {
|
||
this.form.harvestTime = (e && e.detail && e.detail.value) || ''
|
||
this.triggerAutoSave()
|
||
},
|
||
/**
|
||
* 选择预计量产范围
|
||
* @param {Object} e
|
||
*/
|
||
onOutputRangeChange(e) {
|
||
const idx = Number((e && e.detail && e.detail.value) || 0)
|
||
this.form.outputRange = this.outputRangeOptions[idx] || ''
|
||
this.triggerAutoSave()
|
||
},
|
||
/**
|
||
* 解析自由输入的价格文本(如:1万元 / 2000元/斤 / 面议)
|
||
* 数值部分写入 price 字段,其余文本作为计价单位写入 priceUnit,与后端存储结构兼容
|
||
* @returns {{num:number, unit:string}} num 为数值部分(无数字时为 0),unit 为单位/备注文本
|
||
*/
|
||
parsePriceInput() {
|
||
const raw = String(this.form.price || '').trim()
|
||
if (!raw) return { num: 0, unit: '' }
|
||
const m = raw.match(/^([0-9]+(?:\.[0-9]+)?)\s*(.*)$/)
|
||
if (m) return { num: parseFloat(m[1]) || 0, unit: (m[2] || '').trim() }
|
||
// 纯文本写法(如:面议):数值为 0,整段作为单位展示
|
||
return { num: 0, unit: raw }
|
||
},
|
||
/**
|
||
* 点击添加分类推荐亮点标签
|
||
* @param {string} rt 推荐标签
|
||
*/
|
||
addRecommendTag(rt) {
|
||
if (!rt) return
|
||
if (this.form.tags.includes(rt)) {
|
||
this.removeTag(this.form.tags.indexOf(rt))
|
||
return
|
||
}
|
||
if (this.form.tags.length >= 5) {
|
||
uni.showToast({ title: '最多添加5个标签', icon: 'none' })
|
||
return
|
||
}
|
||
this.form.tags.push(rt)
|
||
this.triggerAutoSave()
|
||
},
|
||
/**
|
||
* 移除已选亮点标签
|
||
* @param {number} idx 标签序号
|
||
*/
|
||
removeTag(idx) {
|
||
this.form.tags.splice(idx, 1)
|
||
this.triggerAutoSave()
|
||
},
|
||
/**
|
||
* 手动添加自定义标签
|
||
*/
|
||
addCustomTag() {
|
||
const tag = (this.customTagInput || '').trim()
|
||
if (!tag) return
|
||
if (this.form.tags.includes(tag)) {
|
||
uni.showToast({ title: '标签已存在', icon: 'none' })
|
||
return
|
||
}
|
||
if (this.form.tags.length >= 5) {
|
||
uni.showToast({ title: '最多添加5个标签', icon: 'none' })
|
||
return
|
||
}
|
||
this.form.tags.push(tag)
|
||
this.customTagInput = ''
|
||
this.triggerAutoSave()
|
||
},
|
||
/**
|
||
* 选中发布套餐卡片(区分单条与会员月卡/年卡特权)
|
||
* @param {Object} p 套餐对象
|
||
*/
|
||
selectPlan(p) {
|
||
if (p.key === 'month' || p.key === 'year') {
|
||
uni.showModal({
|
||
title: '开通会员特权',
|
||
content: `${p.name}为会员特权服务(${p.price} / ${p.desc})。开通后可畅享海量发布额度,是否前往会员中心开通?`,
|
||
confirmText: '去开通',
|
||
cancelText: '再想想',
|
||
confirmColor: '#00e070',
|
||
success: (res) => {
|
||
if (res.confirm) {
|
||
uni.navigateTo({ url: '/pages/member/index' })
|
||
}
|
||
},
|
||
})
|
||
return
|
||
}
|
||
this.form.plan = p.key
|
||
},
|
||
/**
|
||
* 读取后台发布计费配置(顺带刷新会员身份,控制开通引导条显隐)
|
||
*/
|
||
async loadPublish() {
|
||
try {
|
||
const [p, assets] = await Promise.all([
|
||
postApi.publishConfig(),
|
||
memberApi.assets().catch(() => null),
|
||
])
|
||
if (assets && assets.isMember != null) {
|
||
this.isMember = !!assets.isMember
|
||
}
|
||
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) {
|
||
if (type === 'merchant') {
|
||
// 未认证商家时,提示并跳转商家认证页面
|
||
if (!this.isMerchantUser) {
|
||
const status = this.merchantAuditStatus
|
||
let title = '商家认证提示'
|
||
let content = '发布商家信息需先完成商家资质认证,认证后尊享商家标识与店铺展示。是否立即前往认证?'
|
||
let confirmText = '去认证'
|
||
|
||
if (status === 0) {
|
||
content = '您的商家资质正在审核中,工作人员将在1-3个工作日内完成审核。是否前往查看进度?'
|
||
confirmText = '查看进度'
|
||
} else if (status === 2) {
|
||
content = '您的商家资质审核未通过,请核对资料后重新提交。是否前往修改?'
|
||
confirmText = '重新提交'
|
||
}
|
||
|
||
uni.showModal({
|
||
title,
|
||
content,
|
||
confirmText,
|
||
cancelText: '取消',
|
||
confirmColor: '#00e070',
|
||
success: (res) => {
|
||
if (res.confirm) {
|
||
uni.navigateTo({ url: '/pages/merchant/info' })
|
||
}
|
||
},
|
||
})
|
||
return
|
||
}
|
||
this.form.identityType = 'merchant'
|
||
// 自动带入商家的认证信息
|
||
const u = useUserStore().state.userInfo
|
||
if (u && u.merchant) {
|
||
const contact = u.merchant.contact_name || u.merchant.contactName || ''
|
||
const phone = u.merchant.contact_phone || u.merchant.contactPhone || ''
|
||
const address = u.merchant.address || ''
|
||
if (!this.form.contact && contact) {
|
||
this.form.contact = contact
|
||
}
|
||
if (!this.form.phone && phone) {
|
||
this.form.phone = phone
|
||
}
|
||
if (!this.form.address && address) {
|
||
this.form.address = address
|
||
}
|
||
}
|
||
} else {
|
||
this.form.identityType = 'person'
|
||
}
|
||
},
|
||
/**
|
||
* 打开分类抽屉(step=1 选大类,step=2 选品类;选品类前须已选大类)
|
||
* @param {number} step 抽屉步骤
|
||
*/
|
||
openCatStep(step) {
|
||
if (Number(step) === 2 && !this.form.categoryId) {
|
||
uni.showToast({ title: '请先选择大类', icon: 'none' })
|
||
return
|
||
}
|
||
this.catDrawerStep = Number(step) === 2 ? 2 : 1
|
||
this.catDrawerVisible = true
|
||
setTimeout(() => {
|
||
this.catDrawerAnim = true
|
||
}, 20)
|
||
},
|
||
/**
|
||
* 关闭全部分类抽屉
|
||
*/
|
||
closeCatDrawer() {
|
||
this.catDrawerAnim = false
|
||
setTimeout(() => {
|
||
this.catDrawerVisible = false
|
||
}, 200)
|
||
},
|
||
/**
|
||
* 选择一级大类(蔬菜 / 水果等),选中即回填并关闭
|
||
* @param {Object} c 一级大类对象
|
||
*/
|
||
onSelectDrawerParentCat(c) {
|
||
if (!c) return
|
||
this.form.categoryId = Number(c.id)
|
||
const children = (c.children && Array.isArray(c.children)) ? c.children : []
|
||
if (!children.length) {
|
||
// 若该一级分类下无二级子品类,自动归为全部
|
||
this.form.subCategoryId = 0
|
||
this.selectedAllSubCat = true
|
||
} else {
|
||
this.form.subCategoryId = 0
|
||
this.selectedAllSubCat = false
|
||
}
|
||
this.triggerAutoSave()
|
||
this.closeCatDrawer()
|
||
},
|
||
/**
|
||
* 第二步:仅按一级大类发布(选择全部)
|
||
*/
|
||
onSelectDrawerParentOnly() {
|
||
this.form.subCategoryId = 0
|
||
this.selectedAllSubCat = true
|
||
this.triggerAutoSave()
|
||
this.closeCatDrawer()
|
||
},
|
||
/**
|
||
* 第二步:选中二级分类并完成选择
|
||
* @param {Object} sub 二级分类对象
|
||
*/
|
||
onSelectDrawerSubCat(sub) {
|
||
if (!sub) return
|
||
if (sub.pid) {
|
||
this.form.categoryId = Number(sub.pid)
|
||
}
|
||
this.form.subCategoryId = Number(sub.id)
|
||
this.selectedAllSubCat = false
|
||
this.triggerAutoSave()
|
||
this.closeCatDrawer()
|
||
},
|
||
/**
|
||
* 金额展示格式化(整数不带小数,其余保留两位)
|
||
*/
|
||
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 || ''))
|
||
},
|
||
/**
|
||
* 校验上传图片的宽高比与文件大小(用于详情页顶部轮播展示,限制宽高比 0.75~2.2,单张 ≤ 5MB)
|
||
* @param {string} filePath 本地临时路径
|
||
* @param {Object} fileObj chooseImage 返回的 tempFiles[i]
|
||
* @returns {Promise<{ok:boolean, message?:string}>}
|
||
*/
|
||
validateImageForCarousel(filePath, fileObj = null) {
|
||
if (fileObj && fileObj.size && Number(fileObj.size) > 5 * 1024 * 1024) {
|
||
return Promise.resolve({ ok: false, message: '单张图片大小不能超过 5MB' })
|
||
}
|
||
if (typeof uni === 'undefined' || !uni.getImageInfo) {
|
||
return Promise.resolve({ ok: true })
|
||
}
|
||
return new Promise((resolve) => {
|
||
uni.getImageInfo({
|
||
src: filePath,
|
||
success: (info) => {
|
||
const w = Number(info && info.width) || 0
|
||
const h = Number(info && info.height) || 0
|
||
if (w >= 50 && h >= 50) {
|
||
const ratio = w / h
|
||
if (ratio < 0.75 || ratio > 2.2) {
|
||
resolve({
|
||
ok: false,
|
||
message: '为保证轮播展示效果,请上传宽高比在 3:4 ~ 16:9 之间的横图或方图',
|
||
})
|
||
return
|
||
}
|
||
}
|
||
resolve({ ok: true })
|
||
},
|
||
fail: () => resolve({ ok: true }),
|
||
})
|
||
})
|
||
},
|
||
chooseImage() {
|
||
if (this.uploading) return
|
||
const remain = 6 - this.imageCount
|
||
if (remain <= 0) return uni.showToast({ title: '最多上传 6 张图片', icon: 'none' })
|
||
// 直接从相册选择(拍照功能已移除)
|
||
this.pickFromAlbum(remain)
|
||
},
|
||
/** 相册选图:压缩(>1MB 阶梯降质)→ 宽高比与大小校验 → 上传 */
|
||
pickFromAlbum(remain) {
|
||
uni.chooseImage({
|
||
count: remain,
|
||
sizeType: ['original', 'compressed'],
|
||
success: async (res) => {
|
||
const paths = res.tempFilePaths || []
|
||
const files = res.tempFiles || []
|
||
const validPaths = []
|
||
for (let i = 0; i < paths.length; i++) {
|
||
const compressed = await this.compressImageForUpload(paths[i], files[i])
|
||
const check = await this.validateImageForCarousel(compressed.path, { size: compressed.size })
|
||
if (!check.ok) {
|
||
uni.showToast({ title: check.message, icon: 'none', duration: 2600 })
|
||
} else {
|
||
validPaths.push(compressed.path)
|
||
}
|
||
}
|
||
if (validPaths.length) {
|
||
await this.uploadFiles(validPaths, 'image')
|
||
}
|
||
},
|
||
})
|
||
},
|
||
/**
|
||
* 上传前压缩:>1MB 才压缩,按 80/60/45 质量阶梯降质直到 ≤5MB(后端硬限制)
|
||
* gif 不支持压缩接口,直接原样返回
|
||
* @param {string} path 本地临时路径
|
||
* @param {Object} fileObj chooseImage 返回的 tempFiles[i]
|
||
* @returns {Promise<{path:string, size:number}>}
|
||
*/
|
||
async compressImageForUpload(path, fileObj) {
|
||
const fileSize = Number(fileObj && fileObj.size) || 0
|
||
if (/\.gif$/i.test(path)) return { path, size: fileSize }
|
||
if (fileSize > 0 && fileSize <= 1024 * 1024) return { path, size: fileSize }
|
||
if (typeof uni === 'undefined' || !uni.compressImage) return { path, size: fileSize }
|
||
let cur = { path, size: fileSize }
|
||
for (const q of [80, 60, 45]) {
|
||
try {
|
||
const res = await new Promise((resolve, reject) => {
|
||
uni.compressImage({ src: cur.path, quality: q, success: resolve, fail: reject })
|
||
})
|
||
if (!res || !res.tempFilePath) break
|
||
const info = await new Promise((resolve) => {
|
||
uni.getFileInfo({ filePath: res.tempFilePath, success: resolve, fail: () => resolve(null) })
|
||
})
|
||
cur = { path: res.tempFilePath, size: Number(info && info.size) || 0 }
|
||
if (cur.size > 0 && cur.size <= 5 * 1024 * 1024) return cur
|
||
} catch (e) {
|
||
break
|
||
}
|
||
}
|
||
return cur
|
||
},
|
||
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.form.province = area ? area.province || '' : ''
|
||
this.form.city = area ? area.city || '' : ''
|
||
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 || ''
|
||
this.form.province = found.province || ''
|
||
this.form.city = found.city || ''
|
||
} 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 parsedPrice = this.parsePriceInput()
|
||
const payload = {
|
||
...this.form,
|
||
price: parsedPrice.num,
|
||
priceUnit: parsedPrice.unit,
|
||
tags: this.form.tags,
|
||
draftId: this.currentDraftId || 0,
|
||
}
|
||
const res = await postApi.saveDraft(payload)
|
||
if (res && res.draftId) {
|
||
this.currentDraftId = res.draftId
|
||
}
|
||
if (!silent) {
|
||
uni.showToast({ title: '已存入草稿箱', icon: 'success' })
|
||
}
|
||
} catch (e) {
|
||
if (!silent) {
|
||
uni.showToast({ title: (e && e.message) || '保存失败', icon: 'none' })
|
||
}
|
||
}
|
||
},
|
||
/**
|
||
* 表单合法性验证
|
||
* @returns {string} 错误信息,为空则验证通过
|
||
*/
|
||
validate() {
|
||
if (!this.form.categoryId) return '请选择所属大类'
|
||
if (this.hasSubCategories && !this.form.subCategoryId) return '请选择产品品类'
|
||
if (!this.form.title || !this.form.title.trim()) return '请填写标题'
|
||
if (!this.form.content || !this.form.content.trim()) return '请填写详细内容'
|
||
// 校验顺序与表单视觉顺序一致(价格 → 产地规格 → 区域 → 手机号),报错时用户可自上而下定位
|
||
if (this.isFarmCategory && !(this.parsePriceInput().num > 0)) return '请填写销售价格'
|
||
if (this.isFarmCategory) {
|
||
if (!this.form.plantArea || !this.form.plantArea.trim()) return '请填写种植面积'
|
||
if (!this.form.harvestTime) return '请选择采摘时间'
|
||
if (!this.form.outputRange) return '请选择预计量产范围'
|
||
}
|
||
if (this.form.identityType === 'merchant' && !this.isMerchantUser) return '请先完成商家资质认证'
|
||
if (!this.form.areaId) return '请选择所属区域'
|
||
if (this.form.phone && !/^1\d{10}$/.test(this.form.phone)) return '请输入正确的11位手机号'
|
||
return ''
|
||
},
|
||
/**
|
||
* 拉取资产(仅取支付密码状态,失败不阻断流程)
|
||
*/
|
||
async fetchAssetsSafe() {
|
||
try {
|
||
return await memberApi.assets()
|
||
} catch (e) {
|
||
return {}
|
||
}
|
||
},
|
||
/**
|
||
* 支付密码弹窗确认(余额支付验证)
|
||
* @param {string} password
|
||
*/
|
||
async onPwdConfirm(password) {
|
||
this.pwdPopup.show = false
|
||
await this.doSubmit(password)
|
||
},
|
||
/**
|
||
* 点击底部主按钮:校验表单后,若免费/有额度则直接发布,若需付费则拉起底部收银台弹窗
|
||
*/
|
||
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
|
||
}
|
||
|
||
// 若需单条付费,先弹出底部收银台供用户确认支付方式或跳转开通会员
|
||
if (this.needPay) {
|
||
this.showPayModal = true
|
||
return
|
||
}
|
||
|
||
await this.doSubmit()
|
||
},
|
||
/**
|
||
* 收银台弹窗内点击「确认支付并发布」
|
||
*/
|
||
async confirmCashierPay() {
|
||
if (this.submitting) return
|
||
this.showPayModal = false
|
||
|
||
// 后台开启支付密码:余额支付发布需先验证(未设置则引导去余额中心设置)
|
||
if (this.needPay && this.form.payType === 'balance' && uiState.payPasswordEnabled) {
|
||
const assets = await this.fetchAssetsSafe()
|
||
if (!assets.hasPayPassword) {
|
||
uni.showModal({
|
||
title: '需要支付密码',
|
||
content: '开启支付密码验证后才能使用余额支付,请先到「余额中心」设置。',
|
||
confirmText: '去设置',
|
||
success: (r) => {
|
||
if (r.confirm) uni.navigateTo({ url: '/pages/member/recharge' })
|
||
},
|
||
})
|
||
return
|
||
}
|
||
const priceText = ` · ¥${this.money(this.singlePriceFinal)}`
|
||
this.pwdPopup = { show: true, title: '请输入支付密码', tip: `发布付费信息${priceText}` }
|
||
return
|
||
}
|
||
|
||
await this.doSubmit()
|
||
},
|
||
/**
|
||
* 实际提交(submit 校验通过 / 支付密码验证后调用)
|
||
* @param {string} [payPassword] 余额支付密码(开关开启时必传)
|
||
*/
|
||
async doSubmit(payPassword) {
|
||
this.submitting = true
|
||
try {
|
||
// 订阅消息授权(审核结果);未配置模板时静默跳过
|
||
await requestSubscribe('audit')
|
||
const parsedPrice = this.parsePriceInput()
|
||
const payload = {
|
||
...this.form,
|
||
price: parsedPrice.num,
|
||
priceUnit: parsedPrice.unit,
|
||
tags: this.form.tags,
|
||
plan: this.form.plan === 'quota' ? 'free' : this.form.plan,
|
||
payPassword,
|
||
}
|
||
const res = await postApi.create(payload)
|
||
|
||
// 若有需要支付的订单
|
||
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__member-banner {
|
||
margin: 24rpx 28rpx 0;
|
||
padding: 24rpx 26rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
background: linear-gradient(135deg, #f0fdf4, #ffffff 60%, #fffbf0);
|
||
border: 2rpx solid #d4f3e3;
|
||
border-radius: 24rpx;
|
||
box-shadow: 0 4rpx 16rpx rgba(0, 168, 84, 0.05);
|
||
|
||
&--vip {
|
||
background: linear-gradient(135deg, #f7fee7, #ffffff 60%, #ecfdf5);
|
||
border-color: #bef264;
|
||
}
|
||
}
|
||
.create__member-icon {
|
||
width: 56rpx;
|
||
height: 56rpx;
|
||
margin-right: 20rpx;
|
||
flex-shrink: 0;
|
||
}
|
||
.create__member-info {
|
||
flex: 1;
|
||
min-width: 0;
|
||
display: flex;
|
||
flex-direction: column;
|
||
}
|
||
.create__member-title-row {
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
.create__member-title {
|
||
font-size: 28rpx;
|
||
font-weight: 700;
|
||
color: #1e293b;
|
||
}
|
||
.create__member-tag {
|
||
margin-left: 12rpx;
|
||
padding: 2rpx 12rpx;
|
||
border-radius: 999rpx;
|
||
background: linear-gradient(135deg, #00e070, #00d26a);
|
||
color: #ffffff;
|
||
font-size: 20rpx;
|
||
font-weight: 600;
|
||
}
|
||
.create__member-desc {
|
||
margin-top: 6rpx;
|
||
font-size: 22rpx;
|
||
color: #64748b;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
}
|
||
.create__member-btn-box {
|
||
flex-shrink: 0;
|
||
margin-left: 16rpx;
|
||
padding: 8rpx 22rpx;
|
||
border-radius: 999rpx;
|
||
background: #ffffff;
|
||
border: 1rpx solid #00a854;
|
||
box-shadow: 0 2rpx 8rpx rgba(0, 168, 84, 0.08);
|
||
}
|
||
.create__member-go {
|
||
font-size: 24rpx;
|
||
font-weight: 700;
|
||
color: #00a854;
|
||
}
|
||
.create__member-banner:active {
|
||
opacity: 0.88;
|
||
}
|
||
|
||
/* 表单卡片区域 */
|
||
.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--sub {
|
||
border-top: 2rpx solid #f0f4f2;
|
||
}
|
||
|
||
/* 未选大类时品类行置灰不可点 */
|
||
.create__cell--disabled {
|
||
opacity: 0.55;
|
||
}
|
||
|
||
.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;
|
||
}
|
||
|
||
/* 联系卡内身份切换组 */
|
||
.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;
|
||
}
|
||
}
|
||
|
||
&--unauth {
|
||
border-style: dashed;
|
||
background: #fafdfb;
|
||
}
|
||
}
|
||
|
||
.create__identity-title-row {
|
||
display: flex;
|
||
align-items: center;
|
||
}
|
||
|
||
.create__identity-title {
|
||
font-size: 28rpx;
|
||
font-weight: 700;
|
||
color: $fc-text;
|
||
}
|
||
|
||
.create__merchant-badge {
|
||
font-size: 18rpx;
|
||
font-weight: 700;
|
||
border-radius: 6rpx;
|
||
padding: 2rpx 10rpx;
|
||
margin-left: 10rpx;
|
||
line-height: 26rpx;
|
||
display: inline-flex;
|
||
align-items: center;
|
||
|
||
&--approved {
|
||
background: #f5a623;
|
||
color: #4a2600;
|
||
font-weight: 700;
|
||
}
|
||
|
||
&--unauth {
|
||
background: #e6f9ef;
|
||
color: #04874a;
|
||
border: 1rpx solid #b8ebd0;
|
||
}
|
||
|
||
&--pending {
|
||
background: #eff6ff;
|
||
color: #2563eb;
|
||
border: 1rpx solid #bfdbfe;
|
||
}
|
||
|
||
&--rejected {
|
||
background: #fef2f2;
|
||
color: #dc2626;
|
||
border: 1rpx solid #fecaca;
|
||
}
|
||
}
|
||
|
||
.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__negotiable {
|
||
display: flex;
|
||
align-items: center;
|
||
cursor: pointer;
|
||
}
|
||
|
||
.create__checkbox {
|
||
width: 32rpx;
|
||
height: 32rpx;
|
||
border-radius: 8rpx;
|
||
border: 2rpx solid #b8d4c4;
|
||
background: #ffffff;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
margin-right: 10rpx;
|
||
transition: all 0.15s ease;
|
||
|
||
&--checked {
|
||
border-color: #00e070;
|
||
background: #00e070;
|
||
}
|
||
}
|
||
|
||
.create__checkbox-tick {
|
||
font-size: 20rpx;
|
||
font-weight: 900;
|
||
color: #04301e;
|
||
line-height: 1;
|
||
}
|
||
|
||
.create__negotiable-label {
|
||
font-size: 26rpx;
|
||
color: $fc-text-sub;
|
||
}
|
||
|
||
/* 标价与计价单位 */
|
||
.create__price-box {
|
||
margin-top: 16rpx;
|
||
}
|
||
|
||
.create__price-input-row {
|
||
display: flex;
|
||
align-items: center;
|
||
background: #f8faf8;
|
||
border-radius: 16rpx;
|
||
border: 1rpx solid #e6f0ea;
|
||
padding: 0 24rpx;
|
||
height: 92rpx;
|
||
transition: border-color 0.2s ease;
|
||
|
||
&:focus-within {
|
||
border-color: #00e070;
|
||
background: #ffffff;
|
||
}
|
||
}
|
||
|
||
.create__price-input {
|
||
flex: 1;
|
||
height: 88rpx;
|
||
font-size: 32rpx;
|
||
font-weight: 700;
|
||
color: #f5a623;
|
||
}
|
||
|
||
/* 特色亮点标签 */
|
||
.create__tags-wrapper {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
gap: 14rpx;
|
||
margin-top: 16rpx;
|
||
}
|
||
|
||
.create__tag-badge {
|
||
display: inline-flex;
|
||
align-items: center;
|
||
background: #00e070;
|
||
border-radius: 28rpx;
|
||
padding: 8rpx 20rpx;
|
||
cursor: pointer;
|
||
box-shadow: 0 2rpx 8rpx rgba(0, 224, 112, 0.2);
|
||
}
|
||
|
||
.create__tag-badge-text {
|
||
font-size: 24rpx;
|
||
font-weight: 700;
|
||
color: #04301e; /* 亮绿背景严格使用深墨绿 */
|
||
margin-right: 8rpx;
|
||
}
|
||
|
||
.create__tag-badge-del {
|
||
font-size: 26rpx;
|
||
font-weight: 900;
|
||
color: #04301e;
|
||
line-height: 1;
|
||
}
|
||
|
||
/* 推荐标签列表 */
|
||
.create__recommend-tags {
|
||
margin-top: 20rpx;
|
||
padding: 18rpx 20rpx;
|
||
background: #f8fbf9;
|
||
border-radius: 16rpx;
|
||
border: 1rpx dashed #d8eee0;
|
||
}
|
||
|
||
.create__recommend-title {
|
||
font-size: 22rpx;
|
||
color: #04874a;
|
||
font-weight: 600;
|
||
display: block;
|
||
margin-bottom: 12rpx;
|
||
}
|
||
|
||
.create__recommend-chips {
|
||
display: flex;
|
||
flex-wrap: wrap;
|
||
gap: 12rpx;
|
||
}
|
||
|
||
.create__recommend-chip {
|
||
font-size: 22rpx;
|
||
color: #04874a;
|
||
background: #ffffff;
|
||
border: 1rpx solid #cbe9d5;
|
||
border-radius: 24rpx;
|
||
padding: 6rpx 18rpx;
|
||
cursor: pointer;
|
||
transition: all 0.15s ease;
|
||
|
||
&--disabled {
|
||
opacity: 0.45;
|
||
background: #f0f4f1;
|
||
border-color: #dbe4df;
|
||
color: $fc-text-placeholder;
|
||
pointer-events: none;
|
||
}
|
||
}
|
||
|
||
/* 自定义亮点标签输入行 */
|
||
.create__tag-custom-row {
|
||
display: flex;
|
||
align-items: center;
|
||
margin-top: 16rpx;
|
||
gap: 16rpx;
|
||
}
|
||
|
||
.create__tag-custom-input {
|
||
flex: 1;
|
||
height: 72rpx;
|
||
background: #f8faf8;
|
||
border-radius: 14rpx;
|
||
border: 1rpx solid #e6f0ea;
|
||
padding: 0 20rpx;
|
||
font-size: 24rpx;
|
||
color: $fc-text;
|
||
}
|
||
|
||
.create__tag-custom-btn {
|
||
height: 72rpx;
|
||
padding: 0 28rpx;
|
||
background: #04874a;
|
||
border-radius: 14rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
cursor: pointer;
|
||
}
|
||
|
||
.create__tag-custom-btn-txt {
|
||
font-size: 24rpx;
|
||
font-weight: 700;
|
||
color: #ffffff;
|
||
}
|
||
|
||
/* 联系信息行 */
|
||
.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 {
|
||
flex: 1;
|
||
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__grid--parent {
|
||
grid-template-columns: repeat(2, 1fr);
|
||
gap: 24rpx;
|
||
}
|
||
|
||
.cat-drawer__item {
|
||
background: #ffffff;
|
||
border: 3rpx solid #e7efe9;
|
||
border-radius: 20rpx;
|
||
overflow: hidden;
|
||
position: relative;
|
||
transition: all 0.15s ease;
|
||
cursor: pointer;
|
||
|
||
&--active {
|
||
border-color: #00d26a;
|
||
box-shadow: 0 6rpx 20rpx rgba(0, 224, 112, 0.22);
|
||
}
|
||
}
|
||
|
||
/* 大图封面区(浅绿底衬托透明插画,图片为主体便于不识字用户识物) */
|
||
.cat-drawer__cover-box {
|
||
height: 170rpx;
|
||
background: linear-gradient(180deg, #f2fef7, #eafaf1);
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
|
||
&--parent {
|
||
height: 210rpx;
|
||
}
|
||
}
|
||
|
||
.cat-drawer__cover {
|
||
width: 78%;
|
||
height: 78%;
|
||
}
|
||
|
||
/* 底部名称条(文字仅作辅助) */
|
||
.cat-drawer__caption {
|
||
padding: 14rpx 12rpx 16rpx;
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
background: #ffffff;
|
||
}
|
||
|
||
.cat-drawer__name {
|
||
font-size: 28rpx;
|
||
font-weight: 600;
|
||
color: $fc-text;
|
||
text-align: center;
|
||
}
|
||
|
||
.cat-drawer__count {
|
||
margin-top: 4rpx;
|
||
font-size: 20rpx;
|
||
color: $fc-text-muted;
|
||
}
|
||
|
||
.cat-drawer__check {
|
||
position: absolute;
|
||
top: 12rpx;
|
||
right: 12rpx;
|
||
width: 40rpx;
|
||
height: 40rpx;
|
||
border-radius: 50%;
|
||
background: #00d26a;
|
||
color: #ffffff;
|
||
font-size: 24rpx;
|
||
font-weight: 900;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
box-shadow: 0 4rpx 10rpx rgba(0, 210, 106, 0.4);
|
||
}
|
||
|
||
.cat-drawer__space {
|
||
height: 40rpx;
|
||
}
|
||
|
||
/* ================= 付费发布底部收银台弹窗 ================= */
|
||
.create__cashier-mask {
|
||
position: fixed;
|
||
top: 0;
|
||
left: 0;
|
||
right: 0;
|
||
bottom: 0;
|
||
z-index: 1000;
|
||
background: rgba(15, 23, 42, 0.55);
|
||
display: flex;
|
||
flex-direction: column;
|
||
justify-content: flex-end;
|
||
}
|
||
|
||
.create__cashier {
|
||
background: #ffffff;
|
||
border-radius: 36rpx 36rpx 0 0;
|
||
padding: 32rpx 36rpx calc(36rpx + env(safe-area-inset-bottom));
|
||
}
|
||
|
||
.create__cashier-header {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
margin-bottom: 24rpx;
|
||
}
|
||
|
||
.create__cashier-title {
|
||
font-size: 32rpx;
|
||
font-weight: 700;
|
||
color: #1e293b;
|
||
}
|
||
|
||
.create__cashier-close {
|
||
font-size: 28rpx;
|
||
color: #94a3b8;
|
||
padding: 8rpx;
|
||
}
|
||
|
||
.create__cashier-target {
|
||
background: #f8fafc;
|
||
border-radius: 20rpx;
|
||
padding: 24rpx 28rpx;
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
margin-bottom: 28rpx;
|
||
}
|
||
|
||
.create__cashier-target-sub {
|
||
font-size: 24rpx;
|
||
color: #64748b;
|
||
margin-bottom: 10rpx;
|
||
}
|
||
|
||
.create__cashier-price-row {
|
||
display: flex;
|
||
align-items: baseline;
|
||
}
|
||
|
||
.create__cashier-price-symbol {
|
||
font-size: 30rpx;
|
||
font-weight: 700;
|
||
color: #059669;
|
||
margin-right: 4rpx;
|
||
}
|
||
|
||
.create__cashier-price-val {
|
||
font-size: 56rpx;
|
||
font-weight: 800;
|
||
color: #059669;
|
||
}
|
||
|
||
.create__cashier-methods {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 16rpx;
|
||
margin-bottom: 24rpx;
|
||
}
|
||
|
||
.create__cashier-method {
|
||
display: flex;
|
||
align-items: center;
|
||
padding: 24rpx 28rpx;
|
||
border: 2rpx solid #e2e8f0;
|
||
border-radius: 20rpx;
|
||
background: #ffffff;
|
||
|
||
&--active {
|
||
border-color: #00d26a;
|
||
background: #f2fef7;
|
||
}
|
||
}
|
||
|
||
.create__cashier-method-info {
|
||
flex: 1;
|
||
margin-left: 20rpx;
|
||
display: flex;
|
||
flex-direction: column;
|
||
}
|
||
|
||
.create__cashier-method-name {
|
||
font-size: 28rpx;
|
||
font-weight: 600;
|
||
color: #1e293b;
|
||
}
|
||
|
||
.create__cashier-method-tip {
|
||
font-size: 22rpx;
|
||
color: #64748b;
|
||
margin-top: 4rpx;
|
||
}
|
||
|
||
.create__cashier-radio {
|
||
width: 36rpx;
|
||
height: 36rpx;
|
||
border-radius: 50%;
|
||
border: 2rpx solid #cbd5e1;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
}
|
||
|
||
.create__cashier-method--active .create__cashier-radio {
|
||
border-color: #00d26a;
|
||
}
|
||
|
||
.create__cashier-radio-inner {
|
||
width: 20rpx;
|
||
height: 20rpx;
|
||
border-radius: 50%;
|
||
background: #00d26a;
|
||
}
|
||
|
||
.create__cashier-vip-banner {
|
||
display: flex;
|
||
align-items: center;
|
||
background: linear-gradient(90deg, #fffbeb 0%, #fef3c7 100%);
|
||
border: 1rpx solid #fde68a;
|
||
border-radius: 16rpx;
|
||
padding: 20rpx 24rpx;
|
||
margin-bottom: 28rpx;
|
||
}
|
||
|
||
.create__cashier-vip-text {
|
||
flex: 1;
|
||
font-size: 24rpx;
|
||
font-weight: 600;
|
||
color: #92400e;
|
||
margin-left: 12rpx;
|
||
}
|
||
|
||
.create__cashier-vip-arrow {
|
||
font-size: 24rpx;
|
||
font-weight: 700;
|
||
color: #d97706;
|
||
}
|
||
|
||
.create__cashier-btn {
|
||
height: 92rpx;
|
||
border-radius: 46rpx;
|
||
background: linear-gradient(135deg, #00e070 0%, #00d26a 100%);
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
font-size: 30rpx;
|
||
font-weight: 700;
|
||
color: #04301e;
|
||
|
||
&--disabled {
|
||
opacity: 0.6;
|
||
}
|
||
}
|
||
|
||
/* 产地规格选择器样式 */
|
||
.create__picker-flex {
|
||
flex: 1;
|
||
}
|
||
.create__picker-inner {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: flex-end;
|
||
min-height: 60rpx;
|
||
}
|
||
.create__picker-val {
|
||
font-size: 28rpx;
|
||
color: #1e293b;
|
||
font-weight: 500;
|
||
}
|
||
.create__picker-ph {
|
||
font-size: 28rpx;
|
||
color: $fc-text-placeholder;
|
||
}
|
||
</style>
|