123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- import { FormSchema, BasicColumn } from '/@/components/Table';
- import { h } from 'vue';
- import { Switch } from 'ant-design-vue';
- import { useMessage } from '/@/hooks/web/useMessage';
- import { Tinymce } from '/@/components/Tinymce/index';
- export const formSchema: FormSchema[] = [
- {
- field: 'name',
- label: '商品名称',
- component: 'Input',
- required: true,
- },
- {
- field: 'link',
- label: '购买链接',
- component: 'Input',
- },
- {
- field: 'isLaunched',
- label: '是否上架',
- component: 'Switch',
- },
- {
- field: 'steamRoom',
- label: '直播间名称',
- component: 'Input',
- helpMessage: '直播间不能修改',
- required: true,
- colProps: {
- lg: 8,
- md: 8,
- },
- componentProps: {
- disabled: false,
- },
- },
- {
- field: 'desc',
- label: '商品描述',
- component: 'Input',
- render: ({ model, field }) => {
- return h(Tinymce, {
- value: model[field],
- onChange: (value: string) => {
- model[field] = value;
- },
- showImageUpload: true,
- });
- },
- },
- ];
- export const columns: BasicColumn[] = [
- {
- title: 'ID',
- dataIndex: 'id',
- fixed: 'left',
- width: 60,
- },
- {
- title: '商品名称',
- dataIndex: 'name',
- width: 160,
- },
- {
- title: '商品描述',
- dataIndex: 'desc',
- width: 150,
- },
- {
- title: '购买链接',
- dataIndex: 'link',
- slots: { customRender: 'link' },
- width: 150,
- },
- {
- title: '商品分类',
- dataIndex: 'productType',
- slots: { customRender: 'productType' },
- sorter: true,
- width: 120,
- },
- {
- title: '直播间名称',
- dataIndex: 'steamRoom.name',
- sorter: true,
- width: 120,
- },
- {
- title: '零售价格',
- dataIndex: 'unit',
- sorter: true,
- width: 80,
- },
- {
- title: '销售量',
- dataIndex: 'amount',
- sorter: true,
- width: 80,
- },
- {
- title: '市场价',
- dataIndex: 'marketingUnit',
- sorter: true,
- width: 80,
- },
- {
- title: '下单时间',
- dataIndex: 'createTime',
- sorter: true,
- width: 140,
- },
- {
- title: '上架状态',
- dataIndex: 'isLaunched',
- width: 180,
- customRender: ({ record }) => {
- if (!Reflect.has(record, 'pendingStatus')) {
- record.pendingStatus = false;
- }
- return h(Switch, {
- checked: record.isLaunched,
- checkedChildren: '上架',
- unCheckedChildren: '下架',
- loading: false,
- onChange(checked: boolean) {
- record.pendingStatus = true;
- const newStatus = checked ? '1' : '0';
- const { createMessage } = useMessage();
- createMessage.info(`暂未接入` + newStatus);
- },
- });
- },
- },
- {
- title: '操作',
- dataIndex: '',
- slots: { customRender: 'action' },
- fixed: 'right',
- width: 140,
- },
- ];
|