初始化上传医疗项目到 medical-mall

This commit is contained in:
2026-04-10 09:03:21 +08:00
parent ca8794ea3a
commit ce124e7119
421 changed files with 15139 additions and 2363 deletions

View File

@@ -1,4 +1,4 @@
<!-- 商家端 - 商品编辑页面 -->
<!-- 机构端 - 服务/商品编辑页面 -->
<template>
<view class="product-edit-page">
<!-- #ifdef MP-WEIXIN -->
@@ -9,26 +9,26 @@
</view>
</view>
<!-- #endif -->
<!-- 商品基本信息 -->
<!-- 服务基本信息 -->
<view class="section">
<view class="section-title">基本信息</view>
<view class="form-item">
<text class="label">商品名称 *</text>
<text class="label">服务名称 *</text>
<input
class="input"
v-model="product.name"
placeholder="请输入商品名称"
placeholder="请输入服务名称"
maxlength="100"
/>
</view>
<view class="form-item">
<text class="label">商品副标题</text>
<text class="label">服务副标题</text>
<input
class="input"
v-model="product.subtitle"
placeholder="请输入商品副标题"
placeholder="请输入服务副标题"
maxlength="200"
/>
</view>
@@ -66,7 +66,7 @@
<!-- 商品图片 -->
<view class="section">
<view class="section-title">商品图片</view>
<view class="section-title">展示图片</view>
<view class="image-section">
<text class="label">主图 *</text>
@@ -101,7 +101,7 @@
<view class="section-title">价格库存</view>
<view class="form-item">
<text class="label">销售价 *</text>
<text class="label">参考价 *</text>
<view class="price-input">
<text class="unit">¥</text>
<input
@@ -114,7 +114,7 @@
</view>
<view class="form-item">
<text class="label">市价</text>
<text class="label">市价</text>
<view class="price-input">
<text class="unit">¥</text>
<input
@@ -127,7 +127,7 @@
</view>
<view class="form-item">
<text class="label">成本</text>
<text class="label">结算成本</text>
<view class="price-input">
<text class="unit">¥</text>
<input
@@ -140,12 +140,12 @@
</view>
<view class="form-item">
<text class="label">VIP独立折扣</text>
<text class="label">长者关怀价/专属补贴</text>
<switch :checked="product.is_vip_discount" @change="e => { product.is_vip_discount = e.detail.value as boolean }" />
</view>
<view class="form-item" v-if="product.is_vip_discount">
<text class="label">VIP折扣率</text>
<text class="label">关怀价折扣率</text>
<input
class="input"
type="digit"
@@ -155,7 +155,7 @@
</view>
<view class="form-item">
<text class="label">库存 *</text>
<text class="label">库存数量/可预约名额 *</text>
<input
class="input"
type="number"
@@ -165,7 +165,7 @@
</view>
<view class="form-item">
<text class="label">库存预警</text>
<text class="label">器械库存预警</text>
<input
class="input"
type="number"
@@ -177,8 +177,8 @@
<!-- 会员阶梯价 -->
<view class="section">
<view class="section-title">会员等级价格 (选填)</view>
<view class="section-desc">若不填写则按照商品销售价或默认折扣计算</view>
<view class="section-title">长者关怀价/专属补贴价 (选填)</view>
<view class="section-desc">若不填写则按照服务参考价或默认折扣计算</view>
<view v-for="(level, index) in memberLevels" :key="index" class="form-item">
<text class="label">{{ level.name }}价格</text>
@@ -188,15 +188,15 @@
class="input"
v-model="level.price"
type="digit"
placeholder="专属折扣价"
placeholder="长者关怀价"
/>
</view>
</view>
</view>
<!-- 商品属性 -->
<!-- 服务属性 -->
<view class="section">
<view class="section-title">商品属性</view>
<view class="section-title">服务属性</view>
<view class="form-item">
<text class="label">商品单位</text>
@@ -208,43 +208,43 @@
</view>
<view class="switch-item">
<text class="label">热卖商品</text>
<text class="label">热门服务</text>
<switch
:checked="product.is_hot"
@change="product.is_hot = !product.is_hot"
color="#007AFF"
color="rgb(66, 121, 240)"
/>
</view>
<view class="switch-item">
<text class="label">新品上架</text>
<text class="label">新增服务</text>
<switch
:checked="product.is_new"
@change="product.is_new = !product.is_new"
color="#007AFF"
color="rgb(66, 121, 240)"
/>
</view>
<view class="switch-item">
<text class="label">推荐商品</text>
<text class="label">推荐服务</text>
<switch
:checked="product.is_featured"
@change="product.is_featured = !product.is_featured"
color="#007AFF"
color="rgb(66, 121, 240)"
/>
</view>
</view>
<!-- 商品详情 -->
<!-- 详情说明 -->
<view class="section">
<view class="section-title">商品详情</view>
<view class="section-title">详情说明</view>
<view class="form-item">
<text class="label">商品描述</text>
<text class="label">服务描述</text>
<textarea
class="textarea"
v-model="product.description"
placeholder="请输入商品详细描述"
placeholder="请输入服务详细说明"
:maxlength="2000"
/>
</view>
@@ -253,7 +253,7 @@
<!-- 提交按钮 -->
<view class="submit-bar">
<view class="submit-btn primary" @click="saveProduct">
{{ isEdit ? '保存修改' : '发布商品' }}
{{ isEdit ? '保存修改' : '发布服务项目' }}
</view>
</view>
</view>
@@ -344,10 +344,10 @@
if (productId && productId !== '') {
this.productId = productId
this.isEdit = true
uni.setNavigationBarTitle({ title: '编辑商品' })
uni.setNavigationBarTitle({ title: '编辑服务' })
this.loadProductDetail(productId)
} else {
uni.setNavigationBarTitle({ title: '添加商品' })
uni.setNavigationBarTitle({ title: '发布服务' })
}
this.initMerchantId()
this.loadCategories()
@@ -450,21 +450,36 @@
if (response.error != null) {
console.error('获取分类失败:', response.error)
return
}
const rawData = response.data as any[]
if (rawData == null) return
for (let i = 0; i < rawData.length; i++) {
const item = rawData[i] as any
this.categories.push({
id: item['id'] != null ? String(item['id']) : '',
name: item['name'] != null ? String(item['name']) : ''
} as CategoryType)
if (rawData != null && rawData.length > 0) {
for (let i = 0; i < rawData.length; i++) {
const item = rawData[i] as any
this.categories.push({
id: item['id'] != null ? String(item['id']) : '',
name: item['name'] != null ? String(item['name']) : ''
} as CategoryType)
}
} else {
// 演示版默认医养分类
this.categories = [
{ id: 'med', name: '医疗服务' },
{ id: 'drug', name: '药品器械' },
{ id: 'care', name: '居家护理' },
{ id: 'life', name: '生活服务' },
{ id: 'health', name: '健康管理' }
] as CategoryType[]
}
} catch (e) {
console.error('获取分类异常:', e)
this.categories = [
{ id: 'med', name: '医疗服务' },
{ id: 'drug', name: '药品器械' },
{ id: 'care', name: '居家护理' },
{ id: 'life', name: '生活服务' },
{ id: 'health', name: '健康管理' }
] as CategoryType[]
}
},
@@ -833,6 +848,8 @@
margin-bottom: 30rpx;
padding-bottom: 20rpx;
border-bottom: 1rpx solid #f5f5f5;
padding-left: 16rpx;
border-left: 6rpx solid rgb(66, 121, 240);
}
.section-desc {
@@ -863,6 +880,7 @@
.price-input {
display: flex;
flex-direction: row;
align-items: center;
border: 1rpx solid #e5e5e5;
border-radius: 8rpx;
@@ -887,6 +905,7 @@
border-radius: 8rpx;
padding: 0 20rpx;
display: flex;
flex-direction: row;
align-items: center;
}
@@ -897,6 +916,7 @@
.switch-item {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
padding: 20rpx 0;
@@ -923,6 +943,7 @@
.image-grid {
display: flex;
flex-direction: row;
flex-wrap: wrap;
gap: 20rpx;
}
@@ -950,6 +971,7 @@
height: 100%;
background-color: #f5f5f5;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
font-size: 60rpx;
@@ -969,6 +991,7 @@
font-size: 28rpx;
border-radius: 50%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
@@ -994,7 +1017,8 @@
}
.submit-btn.primary {
background: linear-gradient(135deg, #007AFF 0%, #5856D6 100%);
background: linear-gradient(135deg, rgb(66, 121, 240) 0%, #5856D6 100%);
color: #fff;
}
</style>