feat: 添加新增套餐是否展示在首页参数
Build and Deploy Vue3 / build (push) Successful in 2m26s
Build and Deploy Vue3 / deploy (push) Successful in 55s

This commit is contained in:
2026-03-10 10:49:59 +08:00
parent 2f38932878
commit fe29a8b3d0
2 changed files with 29 additions and 598 deletions
+23 -4
View File
@@ -506,6 +506,13 @@
</el-tag>
</template>
</el-table-column>
<el-table-column label="首页展示" width="90">
<template #default="{ row }">
<el-tag :type="row.showHome || row.show_home ? 'success' : 'info'" size="small">
{{ row.showHome || row.show_home ? '展示' : '不展示' }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" width="180">
<template #default="{ row }">
<el-button type="primary" link @click="handleEditPlan(row)">编辑</el-button>
@@ -702,6 +709,14 @@
<el-radio :value="true">禁用</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="首页展示" prop="show_home">
<el-switch
v-model="planForm.show_home"
active-text="展示"
inactive-text="不展示"
/>
<div class="form-tip">控制商品套餐是否在首页显示</div>
</el-form-item>
</el-form>
</div>
<template #footer>
@@ -1649,7 +1664,8 @@ const planForm = reactive({
fixed_price: 0,
enable_fixed_price: false,
index: 0,
disable: false
disable: false,
show_home: false
})
const planFormRules = {
@@ -2012,7 +2028,8 @@ const handleAddPlan = async () => {
fixed_price: 0,
enable_fixed_price: false,
index: 0,
disable: false
disable: false,
show_home: false
})
planFormDialogVisible.value = true
@@ -2067,7 +2084,8 @@ const handleEditPlan = async (row) => {
fixed_price: ((data.fixedPrice || data.fixed_price || 0) / 100).toFixed(2) * 1, // 分转元
enable_fixed_price: !!(data.enableFixedPrice || data.enable_fixed_price), // 转为布尔值
index: data.index || 0,
disable: data.disable || false
disable: data.disable || false,
show_home: !!(data.showHome || data.show_home) // 转为布尔值
})
// 从已有的args初始化选择状态(包括额外参数)
@@ -2166,7 +2184,8 @@ const submitPlanForm = () => {
extra_arg_ids: extraArgIdsStr || planForm.extra_arg_ids || '',
inventory: Number(planForm.inventory) || 0,
fixed_price: Math.round(Number(planForm.fixed_price) * 100) || 0, // 元转分
index: Number(planForm.index) || 0
index: Number(planForm.index) || 0,
show_home: planForm.show_home === true
}
// 只有创建时才传递 enable_fixed_price
+6 -594
View File
@@ -1,601 +1,13 @@
✅已完成、⚠️部分完成、❌未完成这样显示
-----------------------------------------------------------------------------------------------需要解决
1.商品套餐添加了些参数和接口,需要调整对接,新增禁用套餐固定价格和启用套餐固定价格,在更新商品套餐和创建商品套餐新增参数fixed_price和enable_fixed_price,两个接口都需要这两个参数
{
"openapi": "3.0.1",
"info": {
"title": "默认模块",
"description": "",
"version": "1.0.0"
},
"tags": [],
"paths": {
"/api/v1/admin/good/plan/list": {
"get": {
"summary": "获取商品套餐列表",
"deprecated": false,
"description": "",
"tags": [],
"parameters": [
{
"name": "good_id",
"in": "query",
"description": "商品id",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "Authorization",
"in": "header",
"description": "",
"example": "Bearer {{token}}",
"schema": {
"type": "string",
"default": "Bearer {{token}}"
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {}
}
}
},
"headers": {}
}
},
"security": []
}
},
"/api/v1/admin/good/plan/create": {
"post": {
"summary": "创建商品套餐",
"deprecated": false,
"description": "",
"tags": [],
"parameters": [
{
"name": "Authorization",
"in": "header",
"description": "",
"example": "Bearer {{token}}",
"schema": {
"type": "string",
"default": "Bearer {{token}}"
}
}
],
"requestBody": {
"content": {
"multipart/form-data": {
"schema": {
"type": "object",
"properties": {
"good_id": {
"description": "商品id",
"example": "",
"type": "string"
},
"name": {
"description": "名称",
"example": "",
"type": "string"
},
"note": {
"description": "说明",
"example": "",
"type": "string"
},
"args": {
"description": "参数 json\n{\n\"arg_id\": 参数id,\n\"name\": \"参数名称\"\n\"attr_id\": 参数值id,\n\"value\": \"参数值\"(如果是 select 或 string 类型),\n\"number\": 参数值(如果是 number 类型),\n}",
"example": "",
"type": "string"
},
"extra_arg_ids": {
"description": "额外参数 示例:1,2,3,4",
"example": "",
"type": "string"
},
"index": {
"type": "integer",
"description": "套餐排序索引",
"example": 0
},
"inventory": {
"type": "integer",
"description": "库存数量",
"example": 0
},
"fixed_price": {
"type": "integer",
"description": "套餐固定价格",
"example": 0
},
"enable_fixed_price": {
"type": "integer",
"description": "是否启用套餐固定价格",
"example": 0
}
}
},
"examples": {}
}
},
"required": true
},
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {}
}
}
},
"headers": {}
}
},
"security": []
}
},
"/api/v1/admin/good/plan/detail": {
"get": {
"summary": "获取商品套餐详情",
"deprecated": false,
"description": "",
"tags": [],
"parameters": [
{
"name": "good_id",
"in": "query",
"description": "商品id",
"required": false,
"schema": {
"type": "integer"
}
},
{
"name": "plan_id",
"in": "query",
"description": "套餐id",
"required": false,
"schema": {
"type": "integer"
}
},
{
"name": "Authorization",
"in": "header",
"description": "",
"example": "Bearer {{token}}",
"schema": {
"type": "string",
"default": "Bearer {{token}}"
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {}
}
}
},
"headers": {}
}
},
"security": []
}
},
"/api/v1/admin/good/plan/update": {
"post": {
"summary": "更新商品套餐",
"deprecated": false,
"description": "",
"tags": [],
"parameters": [
{
"name": "Authorization",
"in": "header",
"description": "",
"example": "Bearer {{token}}",
"schema": {
"type": "string",
"default": "Bearer {{token}}"
}
}
],
"requestBody": {
"content": {
"multipart/form-data": {
"schema": {
"type": "object",
"properties": {
"good_id": {
"description": "商品id",
"example": "",
"type": "string"
},
"plan_id": {
"description": "套餐id",
"example": "",
"type": "string"
},
"name": {
"description": "名称",
"example": "",
"type": "string"
},
"note": {
"description": "说明",
"example": "",
"type": "string"
},
"args": {
"description": "参数 json\n{\n\"arg_id\": 参数id,\n\"name\": \"参数名称\"\n\"attr_id\": 参数值id,\n\"value\": \"参数值\"(如果是 select 或 string 类型),\n\"number\": 参数值(如果是 number 类型),\n}",
"example": "",
"type": "string"
},
"extra_arg_ids": {
"description": "额外参数 示例:1,2,3,4",
"example": "",
"type": "string"
},
"index": {
"description": "套餐排序索引",
"example": 0,
"type": "integer"
},
"disable": {
"type": "boolean",
"description": "是否禁用",
"example": ""
},
"inventory": {
"type": "integer",
"description": "库存数量",
"example": 0
},
"fixed_price": {
"type": "integer",
"description": "套餐固定价格",
"example": 0
}
}
},
"examples": {}
}
},
"required": true
},
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {}
}
}
},
"headers": {}
}
},
"security": []
}
},
"/api/v1/admin/good/plan/delete": {
"delete": {
"summary": "删除商品套餐",
"deprecated": false,
"description": "",
"tags": [],
"parameters": [
{
"name": "good_id",
"in": "query",
"description": "商品id",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "plan_id",
"in": "query",
"description": "套餐id",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "Authorization",
"in": "header",
"description": "",
"example": "Bearer {{token}}",
"schema": {
"type": "string",
"default": "Bearer {{token}}"
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {}
}
}
},
"headers": {}
}
},
"security": []
}
},
"/api/v1/admin/good/plan/disable": {
"post": {
"summary": "禁用商品套餐",
"deprecated": false,
"description": "",
"tags": [],
"parameters": [
{
"name": "Authorization",
"in": "header",
"description": "",
"example": "Bearer {{token}}",
"schema": {
"type": "string",
"default": "Bearer {{token}}"
}
}
],
"requestBody": {
"content": {
"multipart/form-data": {
"schema": {
"type": "object",
"properties": {
"good_id": {
"type": "integer",
"description": "商品id",
"example": 0
},
"plan_id": {
"type": "integer",
"description": "套餐id",
"example": 0
}
}
},
"examples": {}
}
},
"required": true
},
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {}
}
}
},
"headers": {}
}
},
"security": []
}
},
"/api/v1/admin/good/plan/enable": {
"post": {
"summary": "启用商品套餐",
"deprecated": false,
"description": "",
"tags": [],
"parameters": [
{
"name": "Authorization",
"in": "header",
"description": "",
"example": "Bearer {{token}}",
"schema": {
"type": "string",
"default": "Bearer {{token}}"
}
}
],
"requestBody": {
"content": {
"multipart/form-data": {
"schema": {
"type": "object",
"properties": {
"good_id": {
"description": "商品id",
"example": 0,
"type": "integer"
},
"plan_id": {
"description": "套餐id",
"example": 0,
"type": "integer"
}
}
},
"examples": {}
}
},
"required": true
},
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {}
}
}
},
"headers": {}
}
},
"security": []
}
},
"/api/v1/admin/good/plan/disable_fixed_price": {
"post": {
"summary": "禁用套餐固定价格",
"deprecated": false,
"description": "",
"tags": [],
"parameters": [
{
"name": "Authorization",
"in": "header",
"description": "",
"example": "Bearer {{token}}",
"schema": {
"type": "string",
"default": "Bearer {{token}}"
}
}
],
"requestBody": {
"content": {
"multipart/form-data": {
"schema": {
"type": "object",
"properties": {
"good_id": {
"description": "商品id",
"example": "",
"type": "string"
},
"plan_id": {
"description": "套餐id",
"example": "",
"type": "string"
}
}
},
"examples": {}
}
},
"required": true
},
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {}
}
}
}
}
},
"security": []
}
},
"/api/v1/admin/good/plan/enable_fixed_price": {
"post": {
"summary": "启用套餐固定价格",
"deprecated": false,
"description": "",
"tags": [],
"parameters": [
{
"name": "Authorization",
"in": "header",
"description": "",
"example": "Bearer {{token}}",
"schema": {
"type": "string",
"default": "Bearer {{token}}"
}
}
],
"requestBody": {
"content": {
"multipart/form-data": {
"schema": {
"type": "object",
"properties": {
"good_id": {
"description": "商品id",
"example": "",
"type": "string"
},
"plan_id": {
"description": "套餐id",
"example": "",
"type": "string"
}
}
},
"examples": {}
}
},
"required": true
},
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {}
}
}
},
"headers": {}
}
},
"security": []
}
}
},
"components": {
"schemas": {},
"responses": {},
"securitySchemes": {}
},
"servers": [],
"security": []
}
自行访问下面的接口地址内容
1.添加了参数show_home 用于控制商品套餐是否在首页显示,http://localhost:5174/product/list在该页面的编辑弹窗和新增弹窗添加show_home参数,是否展示按钮,这是个boolean值,true为展示,false为不展示 ✅已完成
创建商品套餐
POST /api/v1/admin/good/plan/create
接口ID412068533
接口地址:https://app.apifox.com/link/project/5145887/apis/api-412068533
-----------------------------------------------------------------------------------------------需要解决