fix: 诊所和药店分开管理
Some checks failed
CI / Test (ubuntu-latest) (push) Has been cancelled
CI / Test (windows-latest) (push) Has been cancelled
CI / Lint (ubuntu-latest) (push) Has been cancelled
CI / Lint (windows-latest) (push) Has been cancelled
CI / Check (ubuntu-latest) (push) Has been cancelled
CI / Check (windows-latest) (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Website on push / Deploy Push Playground Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Docs Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Antd Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Element Ftp (push) Has been cancelled
Deploy Website on push / Deploy Push Naive Ftp (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
CI / CI OK (push) Has been cancelled
Lock Threads / action (push) Has been cancelled
Issue Close Require / close-issues (push) Has been cancelled
Close stale issues / stale (push) Has been cancelled

This commit is contained in:
2025-12-18 09:22:12 +08:00
parent 6a13e3a547
commit 0d701f8158
9 changed files with 121 additions and 28 deletions

View File

@@ -73,7 +73,9 @@ const [Modal, modalApi] = useVbenModal({
formApi.setValues({
...values,
start_time: dayjs(values.start_time || '08:00', 'HH:mm'),
end_time: dayjs(values.end_time || '20:00', 'HH:mm')
end_time: dayjs(values.end_time || '20:00', 'HH:mm'),
// 确保订阅状态有值如果后端没有返回则默认为0订阅
subscribe_price_change: values.subscribe_price_change ?? 0
});
} else {
console.log({

View File

@@ -81,8 +81,8 @@ export const modalFormProps: VbenFormProps = {
},
// 注意已移除门店类型选择字段因为药店管理固定为type=1
{
// 是否包邮字段
component: 'Select',
// 是否包邮字段(单选)
component: 'RadioGroup',
formItemClass: 'col-span-6',
componentProps: {
options: [
@@ -95,6 +95,22 @@ export const modalFormProps: VbenFormProps = {
label: '是否包邮',
rules: 'required',
},
{
// 是否订阅价格波动(单选,新增和编辑时都显示)
component: 'RadioGroup',
formItemClass: 'col-span-6',
componentProps: {
options: [
{ label: '订阅价格波动', value: 0 }, // 0 表示订阅
{ label: '不订阅价格波动', value: 1 }, // 1 表示不订阅
],
placeholder: '是否订阅价格波动',
},
fieldName: 'subscribe_price_change',
label: '是否订阅价格波动',
defaultValue: 0, // 默认订阅
rules: 'required',
},
{
// 联系人姓名字段
component: 'VbenInput',
@@ -190,6 +206,10 @@ export const modalFormProps: VbenFormProps = {
label: 'x',
rules: 'required',
hideLabel: true,
dependencies: {
show: false,
triggerFields: ['id'],
},
renderComponentContent: () => {
return {
default: () => {
@@ -205,6 +225,11 @@ export const modalFormProps: VbenFormProps = {
componentProps: {
placeholder: '请输入中药采购价比例',
},
dependencies: {
show: false,
triggerFields: ['id'],
},
defaultValue: '100',
fieldName: 'z_buy_percent',
label: '中药采购价比例',
rules: 'required',
@@ -217,6 +242,11 @@ export const modalFormProps: VbenFormProps = {
componentProps: {
placeholder: '请输入中药销售比例',
},
dependencies: {
show: false,
triggerFields: ['id'],
},
defaultValue: '100',
fieldName: 'z_sale_percent',
label: '中药销售比例',
rules: 'required',

View File

@@ -33,14 +33,6 @@ export const gridOptions: VxeGridProps<RowType> = {
{ type: 'checkbox', width: 60 }, // 复选框列
{ field: 'id', align: 'left', title: 'ID', width: 100 }, // ID列
{ field: 'name', align: 'left', title: '药店名称' }, // 药店名称列(已从"诊所名称"改为"药店名称"
{
// 类型列(显示为标签)
field: 'type',
align: 'left',
title: '类型',
slots: { default: 'type' },
width: 100,
},
{
// 是否包邮列(显示为开关)
field: 'is_shipping_free',
@@ -49,6 +41,14 @@ export const gridOptions: VxeGridProps<RowType> = {
slots: { default: 'is_shipping_free' },
width: 120,
},
{
// 订阅价格波动列(显示为开关)
field: 'subscribe_price_change',
align: 'left',
title: '订阅价格',
slots: { default: 'subscribe_price_change' },
width: 120,
},
{
// 药店二维码列(已从"诊所二维码"改为"药店二维码"
field: 'qr_code',

View File

@@ -19,6 +19,7 @@ import {
openPcWindowsApiByStore,
openQrCodeApi,
updateStoreShippingFree,
updateStoreSubscribeStatus,
} from '#/views/system/store/api';
// 导入表单弹窗组件
import FormModalDemo from './components/modal.vue';
@@ -145,6 +146,17 @@ const updateShippingFree = (id: number) => {
gridApi.query();
});
};
/**
* 更新药店价格波动订阅状态
* @param id 药店ID
*/
const updateSubscribe = (id: number) => {
updateStoreSubscribeStatus({ id }).then(() => {
message.success('修改成功!');
gridApi.query();
});
};
</script>
<template>
@@ -209,11 +221,6 @@ const updateShippingFree = (id: number) => {
/>
</div>
</template>
<template #type="{ row }">
<Tag :color="row.type === 1 ? 'blue' : 'green'">
{{ row.type === 1 ? '药店' : '诊所' }}
</Tag>
</template>
<template #is_shipping_free="{ row }">
<Switch
:checked="row.is_shipping_free"
@@ -224,6 +231,15 @@ const updateShippingFree = (id: number) => {
@click="updateShippingFree(row.id)"
/>
</template>
<template #subscribe_price_change="{ row }">
<Tag
:color="row.subscribe_price_change === 0 ? 'success' : 'default'"
style="cursor: pointer"
@click="updateSubscribe(row.id)"
>
{{ row.subscribe_price_change === 0 ? '订阅' : '不订阅' }}
</Tag>
</template>
<template #start-time="{ row }">
<Tag color="success">{{ row.start_time }}</Tag>
<br />

View File

@@ -75,3 +75,11 @@ export async function openQrCodeApi(id: number) {
export async function updateStoreShippingFree(data: { id: number }) {
return requestClient.post<any>(`${prefix}update-shipping-free`, data);
}
/**
* 更新门店价格波动订阅状态
* @param data
*/
export async function updateStoreSubscribeStatus(data: { id: number }) {
return requestClient.post<any>(`${prefix}update-subscribe-status`, data);
}

View File

@@ -57,7 +57,9 @@ const [Modal, modalApi] = useVbenModal({
formApi.setValues({
...values,
start_time: dayjs(values.start_time || '08:00', 'HH:mm'),
end_time: dayjs(values.end_time || '20:00', 'HH:mm')
end_time: dayjs(values.end_time || '20:00', 'HH:mm'),
// 确保订阅状态有值如果后端没有返回则默认为0订阅
subscribe_price_change: values.subscribe_price_change ?? 0
});
}
}

View File

@@ -92,7 +92,8 @@ export const modalFormProps: VbenFormProps = {
},
// 注意已移除门店类型选择字段因为诊所管理固定为type=0
{
component: 'Select',
// 是否包邮(单选)
component: 'RadioGroup',
formItemClass: 'col-span-6',
componentProps: {
options: [
@@ -105,6 +106,22 @@ export const modalFormProps: VbenFormProps = {
label: '是否包邮',
rules: 'required',
},
{
// 是否订阅价格波动(单选,新增和编辑时都显示)
component: 'RadioGroup',
formItemClass: 'col-span-6',
componentProps: {
options: [
{ label: '订阅价格波动', value: 0 }, // 0 表示订阅
{ label: '不订阅价格波动', value: 1 }, // 1 表示不订阅
],
placeholder: '是否订阅价格波动',
},
fieldName: 'subscribe_price_change',
label: '是否订阅价格波动',
defaultValue: 0, // 默认订阅
rules: 'required',
},
{
component: 'VbenInput',
formItemClass: 'col-span-6',

View File

@@ -25,13 +25,6 @@ export const gridOptions: VxeGridProps<RowType> = {
{ type: 'checkbox', width: 60 },
{ field: 'id', align: 'left', title: 'ID', width: 100 },
{ field: 'name', align: 'left', title: '诊所名称' },
{
field: 'type',
align: 'left',
title: '类型',
slots: { default: 'type' },
width: 100,
},
{
field: 'is_shipping_free',
align: 'left',
@@ -39,6 +32,14 @@ export const gridOptions: VxeGridProps<RowType> = {
slots: { default: 'is_shipping_free' },
width: 120,
},
{
// 订阅价格波动列(显示为开关)
field: 'subscribe_price_change',
align: 'left',
title: '订阅价格',
slots: { default: 'subscribe_price_change' },
width: 120,
},
{
field: 'qr_code',
align: 'left',

View File

@@ -18,6 +18,7 @@ import {
openPcWindowsApiByStore,
openQrCodeApi,
updateStoreShippingFree,
updateStoreSubscribeStatus,
} from './api';
import FormModalDemo from './components/modal.vue';
import { formOptions } from './config/search';
@@ -118,6 +119,16 @@ const updateShippingFree = (id: number) => {
gridApi.query();
});
};
/**
* 更新价格波动订阅状态
*/
const updateSubscribe = (id: number) => {
updateStoreSubscribeStatus({ id }).then(() => {
message.success('修改成功!');
gridApi.query();
});
};
</script>
<template>
@@ -185,9 +196,6 @@ const updateShippingFree = (id: number) => {
</div>
</template>
<template #type="{ row }">
<Tag :color="row.type === 1 ? 'blue' : 'green'">
{{ row.type === 1 ? '药店' : '诊所' }}
</Tag>
</template>
<template #is_shipping_free="{ row }">
<Switch
@@ -199,6 +207,15 @@ const updateShippingFree = (id: number) => {
@click="updateShippingFree(row.id)"
/>
</template>
<template #subscribe_price_change="{ row }">
<Tag
:color="row.subscribe_price_change === 0 ? 'success' : 'default'"
style="cursor: pointer"
@click="updateSubscribe(row.id)"
>
{{ row.subscribe_price_change === 0 ? '订阅' : '不订阅' }}
</Tag>
</template>
<template #start-time="{ row }">
<Tag color="success">{{ row.start_time }}</Tag>
<br />