添加套餐管理页面

This commit is contained in:
wangxiaowei
2025-12-14 18:16:31 +08:00
parent 2831eadc54
commit 19542eaf50
3 changed files with 463 additions and 345 deletions

353
src/bundle/setmeal/add.vue Normal file
View File

@ -0,0 +1,353 @@
<route lang="jsonc" type="page">{
"layout": "default",
"style": {
"navigationStyle": "custom"
}
}</route>
<template>
<view class="">
<!-- 改价弹窗 -->
<wd-popup v-model="showExpireTimePooup" lock-scroll custom-style="border-radius: 32rpx 32rpx 0rpx 0rpx;background-color: #F8F9FA;" position="bottom">
<view class="relative pb-56rpx">
<view class="absolute top-18rpx right-30rpx" @click="showExpireTimePooup = false">
<wd-img width="60rpx" height='60rpx' :src="`${OSS}icon/icon_close.png`"></wd-img>
</view>
<view class="text-36rpx text-[#121212] leading-50rpx text-center pt-50rpx pb-40rpx">团购有效期</view>
<view class="bg-white mx-30rpx rounded-10rpx px-30rpx py-32rpx">
<wd-radio-group v-model="form.type" size="large" shape="dot" checked-color="#4C9F44" >
<wd-radio :value="1" border>
<view class="leading-36rpx font-400 text-30rpx ml-12rpx mr-60rpx">指定天数内有效</view>
</wd-radio>
<wd-radio :value="2" border>
<view class="leading-36rpx font-400 text-30rpx ml-12rpx">指定时间段内有效</view>
</wd-radio>
</wd-radio-group>
</view>
<view class="font-400 mx-48rpx h-90rpx leading-90rpx rounded-8rpx text-center mt-80rpx text-[#fff] bg-[#4C9F44] text-30rpx font-400" @click="">确定</view>
</view>
</wd-popup>
<view>
<navbar :title="title" custom-class='!bg-[#fff]' :leftArrow="false"></navbar>
</view>
<view class="add-tabs">
<wd-tabs v-model="tab" @change="Add.handleChangeTab">
<wd-tab title="基础信息"></wd-tab>
<wd-tab title="规格与价格"></wd-tab>
<wd-tab title="套餐详情"></wd-tab>
<wd-tab title="购买须知"></wd-tab>
</wd-tabs>
</view>
<view class="bg-[#FFF6EB] h-64rpx leading-64rpx font-400 text-26rpx text-[#111827] px-30rpx">
<text class="text-[#ED2D2D]">*</text>的为必填项
</view>
<view class="bg-white mt-20rpx p-30rpx">
<!-- 基本信息 -->
<view v-if="tab == 0">
<view class="font-bold text-34rpx text-[#303133] leading-48rpx">基本信息</view>
<view class="flex justify-between items-center mt-28rpx">
<view class="flex items-center">
<view class="text-32rpx leading-44rpx text-#303133 mr-10rpx font-bold">套餐属性</view>
<view class="flex items-center">
<wd-img width="16rpx" height="16rpx" :src="`${OSS}icon/icon_validate.png`"></wd-img>
</view>
</view>
<view class="flex items-center">
<wd-radio-group v-model="form.type" size="large" shape="dot" checked-color="#4C9F44" inline>
<wd-radio :value="1" border>
<view class="leading-36rpx font-400 text-30rpx ml-12rpx mr-60rpx">本地套餐</view>
</wd-radio>
<wd-radio :value="2" border>
<view class="leading-36rpx font-400 text-30rpx ml-12rpx">抖音套餐</view>
</wd-radio>
</wd-radio-group>
</view>
</view>
<view class="flex items-center mt-46rpx" v-if="form.type == 2">
<view class="text-28rpx leading-40rpx text-[#303133] mr-66rpx font-400">抖音skuid</view>
<view class="flex-1">
<wd-input no-border placeholder="请输入抖音skuid"
custom-class="!bg-[#F6F7F8] !rounded-16rpx !px-28rpx !py-20rpx"></wd-input>
</view>
</view>
<view class="mt-28rpx add-textarea">
<view class="flex items-center">
<view class="text-32rpx leading-44rpx text-#303133 mr-10rpx font-bold">团购名称</view>
<view class="flex items-center">
<wd-img width="16rpx" height="16rpx" :src="`${OSS}icon/icon_validate.png`"></wd-img>
</view>
</view>
<wd-textarea v-model="form.name"
custom-class='!rounded-18rpx !border-2rpx !border-[#EFF0EF] !bg-[#F8F9FA] !mt-20rpx'
custom-textarea-class='!bg-[#F8F9FA] !h-100rpx' :maxlength='30' show-word-limit />
</view>
<view class="mt-28rpx add-textarea">
<view class="flex items-center">
<view class="text-32rpx leading-44rpx text-#303133 mr-10rpx font-bold">环境描述</view>
<view class="flex items-center">
<wd-img width="16rpx" height="16rpx" :src="`${OSS}icon/icon_validate.png`"></wd-img>
</view>
</view>
<wd-textarea v-model="form.name"
custom-class='!rounded-18rpx !border-2rpx !border-[#EFF0EF] !bg-[#F8F9FA] !mt-20rpx'
custom-textarea-class='!bg-[#F8F9FA] !h-100rpx' :maxlength='30' show-word-limit />
</view>
<view class="mt-28rpx add-textarea">
<view class="flex items-center mb-28rpx">
<view class="text-32rpx leading-44rpx text-#303133 mr-10rpx font-bold">团购视频</view>
</view>
<wd-upload :file-list="fileList" :limit="1" image-mode="scaleToFill" accept="video" :action="action"
@change="Add.handleUploadFile">
<view
class="border-2rpx border-dashed border-[#E5E5E5] w-184rpx h-184rpx flex flex-col items-center justify-center rounded-16rpx">
<view class="">
<wd-img width="64rpx" height="64rpx" :src="`${OSS}icon/icon_video.png`"
mode="aspectFill" />
</view>
<view class="font-400 text-26rpx leading-36rpx text-#303133">添加视频</view>
</view>
</wd-upload>
</view>
<view class="mt-28rpx add-textarea">
<view class="flex items-center justify-between mb-28rpx">
<view class="flex items-center">
<view class="text-32rpx leading-44rpx text-#303133 mr-10rpx font-bold">团购图片</view>
<view class="flex items-center">
<wd-img width="16rpx" height="16rpx" :src="`${OSS}icon/icon_validate.png`"></wd-img>
</view>
</view>
<view class="font-400 text-26rpx text-[#9CA3AF] leading-36rpx">
最多可上传9张图片
</view>
</view>
<wd-upload :file-list="fileList" :limit="1" image-mode="scaleToFill" accept="video" :action="action"
@change="Add.handleUploadFile">
<view
class="border-2rpx border-dashed border-[#E5E5E5] w-184rpx h-184rpx flex flex-col items-center justify-center rounded-16rpx">
<view class="">
<wd-img width="64rpx" height="64rpx" :src="`${OSS}icon/icon_upload.png`"
mode="aspectFill" />
</view>
<view class="font-400 text-26rpx leading-36rpx text-#303133">添加图片</view>
</view>
</wd-upload>
</view>
</view>
<!-- 规格与价格 -->
<view v-if="tab == 1">
<view class="font-bold text-34rpx text-[#303133] leading-48rpx mb-30rpx">规格与价格</view>
<view class="flex items-center mb-28rpx mr-20rpx justify-between">
<view class="mr-30rpx">
<view class="flex items-center mb-20rpx">
<view class="text-30rpx leading-44rpx text-#303133 mr-10rpx font-bold">门市价</view>
<view class="flex items-center">
<wd-img width="16rpx" height="16rpx" :src="`${OSS}icon/icon_validate.png`"></wd-img>
</view>
</view>
<wd-input no-border placeholder="请输入门市价"
custom-class="!bg-[#F6F7F8] !rounded-16rpx !px-28rpx !py-20rpx"></wd-input>
</view>
<view class="">
<view class="flex items-center mb-20rpx">
<view class="text-30rpx leading-44rpx text-#303133 mr-10rpx font-bold">团购价</view>
<view class="flex items-center">
<wd-img width="16rpx" height="16rpx" :src="`${OSS}icon/icon_validate.png`"></wd-img>
</view>
</view>
<wd-input no-border placeholder="请输入团购价"
custom-class="!bg-[#F6F7F8] !rounded-16rpx !px-28rpx !py-20rpx"></wd-input>
</view>
</view>
<view class=" mb-28rpx">
<view class="mr-30rpx">
<view class="flex items-center mb-20rpx w-[100%]">
<view class="flex items-center justify-between w-[100%]">
<view class="flex items-center">
<view class="text-30rpx leading-44rpx text-#303133 mr-10rpx font-bold">库存</view>
<view class="flex items-center">
<wd-img width="16rpx" height="16rpx"
:src="`${OSS}icon/icon_validate.png`"></wd-img>
</view>
</view>
<view class="font-400 text-24rpx leading-34rpx text-[#9CA3AF]">输入范围1~999</view>
</view>
</view>
<wd-input no-border placeholder="请输入库存"
custom-class="!bg-[#F6F7F8] !rounded-16rpx !px-28rpx !py-20rpx"></wd-input>
</view>
</view>
</view>
<!-- 套餐详情 -->
<view v-if="tab == 2">
<view class="font-bold text-34rpx text-[#303133] leading-48rpx mb-30rpx">套餐详情</view>
<view class=" mb-28rpx">
<view class="mr-30rpx">
<view class="flex items-center mb-20rpx w-[100%]">
<view class="flex items-center justify-between w-[100%]">
<view class="flex items-center">
<view class="text-30rpx leading-44rpx text-#303133 mr-10rpx font-bold">套餐介绍</view>
<view class="flex items-center">
<wd-img width="16rpx" height="16rpx"
:src="`${OSS}icon/icon_validate.png`"></wd-img>
</view>
</view>
<view class="font-400 text-24rpx leading-34rpx text-[#9CA3AF]">每条内容之间需要换行输入</view>
</view>
</view>
<wd-textarea v-model="form.name"
custom-class='!rounded-18rpx !border-2rpx !border-[#EFF0EF] !bg-[#F8F9FA] !mt-20rpx'
custom-textarea-class='!bg-[#F8F9FA]' />
</view>
<view class="mr-30rpx mt-30rpx">
<view class="flex items-center mb-20rpx w-[100%]">
<view class="text-30rpx leading-44rpx text-#303133 mr-10rpx font-bold">其他说明</view>
</view>
<wd-textarea v-model="form.name"
custom-class='!rounded-18rpx !border-2rpx !border-[#EFF0EF] !bg-[#F8F9FA] !mt-20rpx'
custom-textarea-class='!bg-[#F8F9FA]' />
</view>
</view>
</view>
<!-- 购买须知 -->
<view v-if="tab == 3">
<view class="font-bold text-34rpx text-[#303133] leading-48rpx mb-30rpx">购买须知</view>
<view class="mb-28rpx">
<view class="mr-30rpx" @click="showExpireTimePooup = true">
<view class="flex items-center mb-20rpx w-[100%]">
<view class="flex items-center justify-between w-[100%]">
<view class="flex items-center">
<view class="text-30rpx leading-44rpx text-#303133 mr-10rpx font-bold">团购有效期</view>
<view class="flex items-center">
<wd-img width="16rpx" height="16rpx"
:src="`${OSS}icon/icon_validate.png`"></wd-img>
</view>
</view>
</view>
</view>
<view>
<wd-input no-border placeholder="请选择"
disabled
custom-class="!bg-[#F6F7F8] !rounded-16rpx !px-28rpx !py-20rpx">
<template #suffix>
<wd-icon name="arrow-down" size="32rpx" color='#8F8F8F'></wd-icon>
</template>
</wd-input>
</view>
</view>
<view class="mr-30rpx mt-30rpx">
<view class="flex items-center mb-20rpx w-[100%]">
<view class="text-30rpx leading-44rpx text-#303133 mr-10rpx font-bold">其他说明</view>
</view>
<wd-textarea v-model="form.name"
custom-class='!rounded-18rpx !border-2rpx !border-[#EFF0EF] !bg-[#F8F9FA] !mt-20rpx'
custom-textarea-class='!bg-[#F8F9FA]' />
</view>
</view>
</view>
</view>
</view>
</template>
<script lang="ts" setup>
const OSS = inject('OSS')
// 页面标题
const title = ref<string>('新建套餐')
const type = ref<string>('add') // add 新建 edit 编辑
// tab
const tab = ref<number>(0)
// 上传文件
const fileList = ref<any[]>([])
const action = 'https://www.mocky.io/v2/5cc8019d300000980a055e76' // 仅做测试使用,实际请换成真实上传接口
// 表单
const form = reactive<{
type: number,
code: string,
message: string,
name: string
}>({
type: 1,
code: '',
message: '',
name: ''
})
// 日期过滤
const value = ref<number>(Date.now())
// 团购有效期
const showExpireTimePooup = ref<boolean>(false)
onLoad((args) => {
// TODO 如果是编辑页面咋额
type.value = args.type || 'add'
if (type.value === 'edit') {
title.value = '修改套餐信息'
}
})
const Add = {
/**
* 切换tab
*/
handleChangeTab: (e) => {
tab.value = e.name
},
/**
* 图片选择/删除
*/
handleUploadFile: (event: any) => {
fileList.value = event.fileList
},
}
</script>
<style lang="scss">
page {
background: $cz-page-background;
}
.add-tabs {
:deep() {
.wd-tabs__line {
background-color: #4C9F44 !important;
}
}
}
.add-textarea {
:deep() {
.wd-textarea__value,
.wd-textarea__count {
background: transparent !important;
}
}
}
</style>

View File

@ -37,7 +37,7 @@
<view class="w-full fixed bottom-0 left-0 right-0 bg-white h-152rpx">
<view class="flex items-center justify-center text-32rpx leading-44rpx leading-90rpx text-center !mt-34rpx">
<wd-button custom-class="!text-32rpx !w-630rpx !h-90rpx !bg-[#4C9F44] !rounded-8rpx !text-[#fff]">新建套餐</wd-button>
<wd-button custom-class="!text-32rpx !w-630rpx !h-90rpx !bg-[#4C9F44] !rounded-8rpx !text-[#fff]" @click="router.navigateTo('/bundle/setmeal/add?type=add')">新建套餐</wd-button>
</view>
</view>
</view>
@ -66,7 +66,7 @@
const keywords = ref<string>('') // 搜索关键词
// tab
const tab = ref<string>('all')
const tab = ref<string>('list')
const tabList = ref<Array<{title: string, num: number, name: string}>>([
{ title: '已上架', num: 10, name: 'list'},
{ title: '已下架', num: 11, name: 'delist' },