diff --git a/apps/web-antd/src/views/system/pharmacy/components/modal.vue b/apps/web-antd/src/views/system/pharmacy/components/modal.vue index 44fa3698..2945f0fa 100644 --- a/apps/web-antd/src/views/system/pharmacy/components/modal.vue +++ b/apps/web-antd/src/views/system/pharmacy/components/modal.vue @@ -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({ diff --git a/apps/web-antd/src/views/system/pharmacy/config/form.ts b/apps/web-antd/src/views/system/pharmacy/config/form.ts index 6582abeb..56e97be2 100644 --- a/apps/web-antd/src/views/system/pharmacy/config/form.ts +++ b/apps/web-antd/src/views/system/pharmacy/config/form.ts @@ -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', diff --git a/apps/web-antd/src/views/system/pharmacy/config/table.ts b/apps/web-antd/src/views/system/pharmacy/config/table.ts index 5da8dee7..e3206f54 100644 --- a/apps/web-antd/src/views/system/pharmacy/config/table.ts +++ b/apps/web-antd/src/views/system/pharmacy/config/table.ts @@ -33,14 +33,6 @@ export const gridOptions: VxeGridProps = { { 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 = { slots: { default: 'is_shipping_free' }, width: 120, }, + { + // 订阅价格波动列(显示为开关) + field: 'subscribe_price_change', + align: 'left', + title: '订阅价格', + slots: { default: 'subscribe_price_change' }, + width: 120, + }, { // 药店二维码列(已从"诊所二维码"改为"药店二维码") field: 'qr_code', diff --git a/apps/web-antd/src/views/system/pharmacy/index.vue b/apps/web-antd/src/views/system/pharmacy/index.vue index f330d881..2fa3a018 100644 --- a/apps/web-antd/src/views/system/pharmacy/index.vue +++ b/apps/web-antd/src/views/system/pharmacy/index.vue @@ -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(); + }); +}; - +