diff --git a/src/api/admin/userGroupDiscount.js b/src/api/admin/userGroupDiscount.js new file mode 100644 index 0000000..55a1fab --- /dev/null +++ b/src/api/admin/userGroupDiscount.js @@ -0,0 +1,30 @@ +import { http2 } from '@/utils/request.js' + +const formHeaders = { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } } + +// ========== 用户组优惠(用户组 与 商品/商品组 绑定优惠) ========== + +/** 获取用户组优惠列表(可按 user_group_id / good_id / good_group_id 过滤) */ +export const getUserGroupDiscountList = (params) => { + return http2.get('/api/v1/admin/user_group/discount/list', { params }) +} + +/** 获取用户组优惠详情 */ +export const getUserGroupDiscountDetail = (params) => { + return http2.get('/api/v1/admin/user_group/discount/detail', { params }) +} + +/** 添加用户组优惠(将用户组与商品/商品组绑定优惠) */ +export const addUserGroupDiscount = (data) => { + return http2.post('/api/v1/admin/user_group/discount/add', data, formHeaders) +} + +/** 修改用户组优惠(可改绑商品/商品组) */ +export const updateUserGroupDiscount = (data) => { + return http2.post('/api/v1/admin/user_group/discount/update', data, formHeaders) +} + +/** 删除用户组优惠(解绑用户组与商品/商品组的优惠) */ +export const deleteUserGroupDiscount = (params) => { + return http2.delete('/api/v1/admin/user_group/discount/delete', { params }) +} diff --git a/src/config/menus.js b/src/config/menus.js index a404860..43cbf5d 100644 --- a/src/config/menus.js +++ b/src/config/menus.js @@ -47,7 +47,8 @@ export const menus = [ title: '商品管理', icon: 'Goods', children: [ - { path: '/product/manage', title: '商品管理' } + { path: '/product/manage', title: '商品管理' }, + { path: '/product/discount', title: '优惠管理' } ] }, { @@ -70,22 +71,6 @@ export const menus = [ } ] }, - { - path: '/marketing', - title: '优惠营销', - icon: 'Present', - children: [ - { - path: '/marketing/discount', - title: '优惠码管理' - }, - { - path: '/marketing/voucher', - title: '代金券管理' - }, - - ] - }, { path: '/activity', title: '活动管理', diff --git a/src/router/index.js b/src/router/index.js index 8271982..432e704 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -253,6 +253,18 @@ const routes = [ component: () => import('../views/product/ProductGroup.vue'), meta: { title: '商品管理' } }, + { + path: 'discount', + name: 'DiscountManage', + component: () => import('../views/product/DiscountManage.vue'), + meta: { title: '优惠管理' } + }, + { + path: 'discount/voucher/:id/manage', + name: 'VoucherManagement', + component: () => import('../views/marketing/VoucherManagement.vue'), + meta: { title: '代金券分发管理', hidden: true, activeMenu: '/product/discount' } + }, { path: 'list', redirect: '/product/manage' }, { path: 'group', redirect: '/product/manage' } ] @@ -310,43 +322,20 @@ const routes = [ } ] }, - // 优惠营销路由 + // 优惠营销路由(已合并至 /product/discount,保留重定向兼容旧链接) { path: 'marketing', name: 'Marketing', meta: { title: '优惠营销', - icon: 'Present' + icon: 'Present', + hidden: true }, - redirect: '/marketing/discount', + redirect: '/product/discount', children: [ - { - path: 'discount', - name: 'DiscountCode', - component: () => import('../views/marketing/DiscountCode.vue'), - meta: { - title: '优惠码管理' - } - }, - { - path: 'voucher', - name: 'Voucher', - component: () => import('../views/marketing/Voucher.vue'), - meta: { - title: '代金券管理' - } - }, - { - path: 'voucher/:id/manage', - name: 'VoucherManagement', - component: () => import('../views/marketing/VoucherManagement.vue'), - meta: { - title: '代金券详情管理', - hidden: true, - activeMenu: '/marketing/voucher' - } - }, - + { path: 'discount', redirect: '/product/discount' }, + { path: 'voucher', redirect: '/product/discount' }, + { path: 'voucher/:id/manage', redirect: to => `/product/discount/voucher/${to.params.id}/manage` } ] }, // 活动管理路由 diff --git a/src/views/marketing/DiscountCode.vue b/src/views/marketing/DiscountCode.vue deleted file mode 100644 index c3827bf..0000000 --- a/src/views/marketing/DiscountCode.vue +++ /dev/null @@ -1,677 +0,0 @@ - - - - - - - diff --git a/src/views/marketing/DiscountGoods.vue b/src/views/marketing/DiscountGoods.vue index bec943f..6e1b3f0 100644 --- a/src/views/marketing/DiscountGoods.vue +++ b/src/views/marketing/DiscountGoods.vue @@ -161,47 +161,39 @@ - - - 商品 - 商品组 - - - - - - - - - - - - - + +
+
+ 可自由勾选商品组与商品,展开层级查看下属内容 +
+ 已选 {{ checkedSummary.groupCount }} 个商品组 / {{ checkedSummary.productCount }} 个商品 +
+
+ + + +
@@ -234,7 +226,7 @@ - - - - - diff --git a/src/views/marketing/VoucherManagement.vue b/src/views/marketing/VoucherManagement.vue index c9c0a04..bf7bf7f 100644 --- a/src/views/marketing/VoucherManagement.vue +++ b/src/views/marketing/VoucherManagement.vue @@ -50,7 +50,7 @@ const activeTab = ref('user-distribution') const voucherId = computed(() => route.params.id) const goBack = () => { - router.push('/marketing/voucher') + router.push('/product/discount') } diff --git a/src/views/product/DiscountManage.vue b/src/views/product/DiscountManage.vue new file mode 100644 index 0000000..81c31c4 --- /dev/null +++ b/src/views/product/DiscountManage.vue @@ -0,0 +1,1050 @@ + + + + + + + diff --git a/src/views/product/ProductGroup.vue b/src/views/product/ProductGroup.vue index 6c0e8d0..631ce07 100644 --- a/src/views/product/ProductGroup.vue +++ b/src/views/product/ProductGroup.vue @@ -637,6 +637,20 @@ inactive-text="禁止" />
+ + + + + + + + { require_real_name: product.requireRealName ?? product.require_real_name ?? false, sold_out: !!product.soldOut, max_per_user: product.maxPerUser ?? product.max_per_user ?? 0, - send_notice: !!product.sendNotice + send_notice: !!product.sendNotice, + renew_price: (product.renewPrice ?? product.renew_price ?? 0) / 100, + renew_recommend_rebate: product.renewRecommendRebate ?? product.renew_recommend_rebate ?? 0 }) productDialogVisible.value = true @@ -1620,7 +1652,9 @@ const submitProductForm = () => { require_real_name: productForm.require_real_name, sold_out: productForm.sold_out === true, max_per_user: Number(productForm.max_per_user) || 0, - send_notice: productForm.send_notice === true + send_notice: productForm.send_notice === true, + renew_price: Number(productForm.renew_price) || 0, + renew_recommend_rebate: Number(productForm.renew_recommend_rebate) || 0 } let res diff --git a/src/views/product/components/ProductPlanManager.vue b/src/views/product/components/ProductPlanManager.vue index 8825f45..6963eac 100644 --- a/src/views/product/components/ProductPlanManager.vue +++ b/src/views/product/components/ProductPlanManager.vue @@ -274,6 +274,13 @@ + +
+ + +
+
续费时使用的固定价格,为 0 时沿用上方固定价格
+
@@ -386,7 +393,8 @@ const planForm = reactive({ disable: false, show_home: false, can_update: false, - max_per_user: 0 + max_per_user: 0, + renew_fixed_price: 0 }) const planFormRules = { name: [{ required: true, message: '请输入套餐名称', trigger: 'blur' }] @@ -794,7 +802,8 @@ const handleEditPlan = async (row) => { enable_fixed_price: !!(data.enableFixedPrice || data.enable_fixed_price), index: data.index || 0, disable: data.disable || false, show_home: !!(data.showHome || data.show_home), can_update: !!(data.canUpdate || data.can_update), - max_per_user: data.maxPerUser ?? data.max_per_user ?? 0 + max_per_user: data.maxPerUser ?? data.max_per_user ?? 0, + renew_fixed_price: ((data.renewFixedPrice ?? data.renew_fixed_price ?? 0) / 100).toFixed(2) * 1 }) initSelectedArgsFromJson(data.args, extraArgIdsArray) planFormDialogVisible.value = true @@ -852,7 +861,8 @@ const submitPlanForm = () => { inventory: Number(planForm.inventory) || 0, fixed_price: Math.round(Number(planForm.fixed_price) * 100) || 0, index: Number(planForm.index) || 0, show_home: planForm.show_home === true, can_update: planForm.can_update === true, - max_per_user: Number(planForm.max_per_user) || 0 + max_per_user: Number(planForm.max_per_user) || 0, + renew_fixed_price: Math.round(Number(planForm.renew_fixed_price) * 100) || 0 } if (planFormType.value === 'add') submitData.enable_fixed_price = planForm.enable_fixed_price === true let res diff --git a/src/views/user/UserGroup.vue b/src/views/user/UserGroup.vue index 4d9b400..6d40190 100644 --- a/src/views/user/UserGroup.vue +++ b/src/views/user/UserGroup.vue @@ -85,7 +85,7 @@ {{ row.create_time || row.CreateTime || row.CreatedAt || '-' }} - + + + + +
+ + 新增优惠绑定 + + + 刷新 + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + 商品 + 商品组 + + + + + + + + + + + + + +
+ + +
+
+ + +
固定抵扣额与百分比抵扣二选一填写
+
+
+ +