整理商品管理模块

This commit is contained in:
2024-07-25 19:20:53 +08:00
parent 717c89a58e
commit cf0961afdd
48 changed files with 1814 additions and 965 deletions

View File

@@ -105,37 +105,40 @@
dataIndex: 'brandId',
key: 'brandId',
align: 'center',
width: 90,
width: 90
},
{
title: '品牌名称',
dataIndex: 'brandName',
key: 'brandName',
align: 'center',
align: 'center'
},
{
title: '图标',
dataIndex: 'image',
key: 'image',
align: 'center',
align: 'center'
},
{
title: '备注',
dataIndex: 'comments',
key: 'comments',
align: 'center',
hideInTable: true
},
{
title: '状态',
dataIndex: 'status',
key: 'status',
align: 'center',
hideInTable: true
},
{
title: '排序号',
dataIndex: 'sortNumber',
key: 'sortNumber',
align: 'center',
hideInTable: true
},
{
title: '创建时间',

View File

@@ -23,6 +23,14 @@
styleResponsive ? { md: 24, sm: 24, xs: 24 } : { span: 8 }
"
>
<a-form-item label="选择店铺" name="merchantId" v-if="!form.merchantId">
<SelectMerchant
:placeholder="`选择商户`"
class="input-item"
v-model:value="form.merchantName"
@done="chooseMerchantId"
/>
</a-form-item>
<a-form-item
label="商品类型"
name="type"
@@ -252,29 +260,32 @@
<a-card title="商品参数" :bordered="false" class="goods-form" />
<a-card title="更多设置" :bordered="false" class="goods-form" />
<a-card :bordered="false" class="goods-form">
<a-button type="primary" block size="large" @click="save">保存</a-button>
</a-card>
<div class="body-bottom"></div>
<a-card
:bordered="false"
class="goods-form"
style="position: fixed; bottom: 0; opacity: 0.9"
>
<a-space :size="20">
<!-- <div style="width: 100px">-->
<!-- <a-button block danger size="large" @click="save"-->
<!-- >删除</a-button-->
<!-- >-->
<!-- </div>-->
<div style="width: 100px">
<a-button block danger size="large" @click="save"
>删除</a-button
>
<a-button type="primary" block size="large" @click="save">保存</a-button>
</div>
<div style="width: 100px">
<a-button block size="large" @click="save">保存草稿</a-button>
</div>
<div style="width: 100px">
<a-button type="primary" block size="large" @click="save"
>上架</a-button
>
</div>
</a-space>
<!-- <div style="width: 100px">-->
<!-- <a-button type="primary" block size="large" @click="save"-->
<!-- >上架</a-button-->
<!-- >-->
<!-- </div>-->
</a-card>
</a-form>
</div>
@@ -309,6 +320,8 @@
import {listSpec} from '@/api/shop/spec';
import {Spec} from "@/api/shop/spec/model";
import { getMerchantName } from "@/utils/merchant";
import router from "@/router";
import { Merchant } from "@/api/shop/merchant/model";
const { currentRoute } = useRouter();
//
@@ -368,6 +381,7 @@
recommend: 0,
sortNumber: undefined,
status: undefined,
merchantName: '',
merchantId: getMerchantId()
});
const skuColumns = ref<ColumnItem[]>([
@@ -450,6 +464,14 @@
trigger: 'blur'
}
],
merchantId: [
{
required: true,
message: '请选择店铺',
type: 'number',
trigger: 'blur'
}
],
categoryId: [
{
required: true,
@@ -689,6 +711,12 @@
form.categoryChildren = value[1].label;
}
/* 搜索 */
const chooseMerchantId = (item: Merchant) => {
form.merchantName = item.merchantName;
form.merchantId = item.merchantId;
};
const onBathSet = () => {
skuList.value.map(d => {
console.log(d);
@@ -880,11 +908,13 @@
skuList.value.map(d => {
d.images = undefined
})
if(getMerchantId()){
form.merchantId = getMerchantId();
form.merchantName = getMerchantName();
}
const formData = {
...form,
content: content.value,
merchantId: getMerchantId(),
merchantName: getMerchantName(),
image: JSON.stringify(imgList.value),
files: JSON.stringify(fileList.value),
goodsSpecs: specList.value,
@@ -899,6 +929,9 @@
category.value = []
resetFields();
message.success(msg);
setTimeout(() => {
router.go(-1)
},1000)
})
.catch((e) => {
loading.value = false;

View File

@@ -0,0 +1,115 @@
<!-- 搜索表单 -->
<template>
<a-space :size="10" style="flex-wrap: wrap">
<a-button type="primary" class="ele-btn-icon" @click="add">
<template #icon>
<PlusOutlined />
</template>
<span>添加</span>
</a-button>
<a-radio-group v-model:value="type" @change="handleSearch">
<a-radio-button value="出售中"
>出售中({{ goodsCount?.totalNum }})</a-radio-button
>
<a-radio-button value="待上架"
>待上架({{ goodsCount?.totalNum2 }})</a-radio-button
>
<a-radio-button value="已售罄"
>已售罄({{ goodsCount?.totalNum3 }})</a-radio-button
>
</a-radio-group>
<a-input-search
allow-clear
placeholder="请输入关键词"
v-model:value="where.keywords"
@pressEnter="reload"
@search="reload"
/>
<a-button @click="reset">重置</a-button>
</a-space>
</template>
<script lang="ts" setup>
import { PlusOutlined } from '@ant-design/icons-vue';
import type { GradeParam } from '@/api/user/grade/model';
import { ref, watch } from 'vue';
import { getCount } from '@/api/shop/goods';
import type { GoodsCount, GoodsParam } from '@/api/shop/goods/model';
import useSearch from '@/utils/use-search';
import { useRouter } from 'vue-router';
const { currentRoute } = useRouter();
const props = withDefaults(
defineProps<{
// 选中的角色
selection?: [];
}>(),
{}
);
const type = ref<string>();
// 统计数据
const goodsCount = ref<GoodsCount>();
// 表单数据
const { where, resetFields } = useSearch<GoodsParam>({
goodsId: undefined,
status: undefined,
isShow: undefined,
stock: undefined,
keywords: ''
});
const emit = defineEmits<{
(e: 'search', where?: GradeParam): void;
(e: 'add'): void;
(e: 'remove'): void;
(e: 'batchMove'): void;
}>();
// 新增
const add = () => {
emit('add');
};
const handleSearch = (e) => {
const text = e.target.value;
resetFields();
if (text === '出售中') {
where.isShow = 1;
}
if (text === '待上架') {
where.isShow = 0;
}
if (text === '已售罄') {
where.stock = 0;
}
emit('search', where);
};
const reload = () => {
getCount().then((data: any) => {
goodsCount.value = data;
});
emit('search', where);
};
/* 重置 */
const reset = () => {
resetFields();
type.value = '';
reload();
};
// watch(
// () => props.selection,
// () => {}
// );
watch(
currentRoute,
() => {
reload();
},
{ immediate: true }
);
</script>

View File

@@ -32,9 +32,25 @@
<a-image v-if="index == 0" :src="img" :width="80" />
</template>
</template>
<template v-if="column.key === 'status'">
<a-tag v-if="record.status === 0" color="green">已上架</a-tag>
<a-tag v-if="record.status === 1" color="red">已下架</a-tag>
<template v-if="column.key === 'salePrice'">
{{ formatNumber(record.salePrice) }}
</template>
<template v-if="column.key === 'isShow'">
<a-tag
v-if="record.isShow === 1"
color="green"
class="cursor-pointer"
@click="onUpdate(record)"
>出售中</a-tag
>
<a-tag
v-if="record.isShow === 0"
color="red"
class="cursor-pointer"
@click="onUpdate(record)"
>已下架</a-tag
>
</template>
<template v-if="column.key === 'action'">
<a-space>
@@ -69,9 +85,15 @@
} from 'ele-admin-pro/es/ele-pro-table/types';
import Search from './components/search.vue';
import GoodsEdit from './components/goodsEdit.vue';
import { pageGoods, removeGoods, removeBatchGoods } from '@/api/shop/goods';
import {
pageGoods,
removeGoods,
removeBatchGoods,
updateGoods
} from '@/api/shop/goods';
import type { Goods, GoodsParam } from '@/api/shop/goods/model';
import { getMerchantId, openPreview, openUrl } from "@/utils/common";
import { getMerchantId, openUrl } from '@/utils/common';
import { formatNumber } from 'ele-admin-pro/es';
//
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
@@ -88,16 +110,7 @@
const loading = ref(true);
//
const datasource: DatasourceFunction = ({
page,
limit,
where,
orders,
filters
}) => {
if (filters) {
where.status = filters.status;
}
const datasource: DatasourceFunction = ({ page, limit, where, orders }) => {
where.merchantId = getMerchantId();
return pageGoods({
...where,
@@ -114,6 +127,10 @@
width: 90,
dataIndex: 'goodsId'
},
{
title: '店铺名称',
dataIndex: 'merchantName'
},
{
title: '封面图',
dataIndex: 'image',
@@ -152,10 +169,10 @@
},
{
title: '状态',
dataIndex: 'status',
dataIndex: 'isShow',
width: 120,
align: 'center',
key: 'status'
key: 'isShow'
},
{
title: '操作',
@@ -169,6 +186,7 @@
/* 搜索 */
const reload = (where?: GoodsParam) => {
console.log(where);
selection.value = [];
tableRef?.value?.reload({ where: where });
};
@@ -184,6 +202,14 @@
showMove.value = true;
};
const onUpdate = (row?: Goods) => {
const isShow = row?.isShow == 0 ? 1 : 0;
updateGoods({ ...row, isShow }).then((msg) => {
message.success(msg);
reload();
});
};
/* 删除单个 */
const remove = (row: Goods) => {
const hide = message.loading('请求中..', 0);

View File

@@ -1,42 +0,0 @@
<!-- 搜索表单 -->
<template>
<a-space :size="10" style="flex-wrap: wrap">
<a-button type="primary" class="ele-btn-icon" @click="add">
<template #icon>
<PlusOutlined />
</template>
<span>添加</span>
</a-button>
</a-space>
</template>
<script lang="ts" setup>
import { PlusOutlined } from '@ant-design/icons-vue';
import type { GradeParam } from '@/api/user/grade/model';
import { watch } from 'vue';
const props = withDefaults(
defineProps<{
// 选中的角色
selection?: [];
}>(),
{}
);
const emit = defineEmits<{
(e: 'search', where?: GradeParam): void;
(e: 'add'): void;
(e: 'remove'): void;
(e: 'batchMove'): void;
}>();
// 新增
const add = () => {
emit('add');
};
watch(
() => props.selection,
() => {}
);
</script>

View File

@@ -5,7 +5,19 @@
<template #icon>
<PlusOutlined />
</template>
<span>添加商户</span>
<span>添加</span>
</a-button>
<a-button class="ele-btn-icon" @click="openUrl(`/shop/index`)">
<span>店铺管理</span>
</a-button>
<a-button class="ele-btn-icon" @click="openUrl(`/shop/apply`)">
<span>入驻申请</span>
</a-button>
<a-button class="ele-btn-icon" @click="openUrl(`/shop/desk`)">
<span>桌号管理</span>
</a-button>
<a-button class="ele-btn-icon" @click="openUrl(`/shop/type`)">
<span>店铺类型</span>
</a-button>
</a-space>
</template>
@@ -14,6 +26,8 @@
import { PlusOutlined } from '@ant-design/icons-vue';
import type { GradeParam } from '@/api/user/grade/model';
import { watch } from 'vue';
import { openUrl } from '@/utils/common';
import router from '@/router';
const props = withDefaults(
defineProps<{
@@ -36,7 +50,9 @@
};
watch(
() => props.selection,
() => {}
() => router.currentRoute,
(route) => {
console.log(route,'route');
}
);
</script>

View File

@@ -30,7 +30,9 @@
</template>
<template v-if="column.key === 'action'">
<a-space>
<a @click="openNew(record.adminUrl)">商家后台</a>
<a @click="openUrl(`/shop/account/${record.merchantId}`)"
>门店用户</a
>
<a-divider type="vertical" />
<a @click="openEdit(record)">修改</a>
<a-divider type="vertical" />
@@ -64,9 +66,13 @@
} from 'ele-admin-pro/es/ele-pro-table/types';
import Search from './components/search.vue';
import MerchantEdit from './components/merchantEdit.vue';
import { pageMerchant, removeMerchant, removeBatchMerchant } from '@/api/shop/merchant';
import {
pageMerchant,
removeMerchant,
removeBatchMerchant
} from '@/api/shop/merchant';
import type { Merchant, MerchantParam } from '@/api/shop/merchant/model';
import {openNew, openPreview} from "@/utils/common";
import { openNew, openPreview, openUrl } from '@/utils/common';
// 表格实例
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
@@ -107,49 +113,49 @@
title: 'ID',
dataIndex: 'merchantId',
key: 'merchantId',
width: 90,
width: 90
},
{
title: '商户名称',
title: '店铺名称',
dataIndex: 'merchantName',
key: 'merchantName',
align: 'center',
align: 'center'
},
{
title: '商户图标',
dataIndex: 'image',
key: 'image',
align: 'center',
align: 'center'
},
{
title: '商户姓名',
dataIndex: 'realName',
key: 'realName',
align: 'center',
align: 'center'
},
{
title: '商户手机号',
dataIndex: 'phone',
key: 'phone',
align: 'center',
align: 'center'
},
{
title: '店铺类型',
dataIndex: 'shopType',
key: 'shopType',
align: 'center',
align: 'center'
},
{
title: '状态',
dataIndex: 'status',
key: 'status',
align: 'center',
align: 'center'
},
{
title: '排序号',
dataIndex: 'sortNumber',
key: 'sortNumber',
align: 'center',
align: 'center'
},
{
title: '创建时间',

View File

@@ -18,7 +18,7 @@
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
"
>
<a-form-item label="选择商户" name="merchantId">
<a-form-item label="选择商户" name="merchantId" v-if="!merchantId">
<SelectMerchant
:placeholder="`选择商户`"
class="input-item"
@@ -26,11 +26,18 @@
@done="chooseMerchantId"
/>
</a-form-item>
<a-form-item label="选择用户" name="userId" v-if="!isUpdate">
<SelectUser
:placeholder="`选择用户`"
class="input-item"
v-model:value="form.nickname"
@done="chooseUserId"
/>
</a-form-item>
<a-form-item label="选择角色" name="roleId">
<SelectRole
:placeholder="`选择角色`"
class="input-item"
:type="`merchant`"
v-model:value="form.roleName"
@done="chooseRoleId"
/>
@@ -40,7 +47,7 @@
allow-clear
placeholder="请输入手机号码"
maxlength="11"
:disabled="isUpdate"
:disabled="true"
v-model:value="form.phone"
/>
</a-form-item>
@@ -75,16 +82,20 @@
import { ref, reactive, watch } from 'vue';
import { Form, message } from 'ant-design-vue';
import { assignObject, uuid } from 'ele-admin-pro';
import { addMerchantAccount, updateMerchantAccount } from '@/api/shop/merchantAccount';
import {
addMerchantAccount,
updateMerchantAccount
} from '@/api/shop/merchantAccount';
import { MerchantAccount } from '@/api/shop/merchantAccount/model';
import { useThemeStore } from '@/store/modules/theme';
import { storeToRefs } from 'pinia';
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
import { FormInstance } from 'ant-design-vue/es/form';
import { FileRecord } from '@/api/system/file/model';
import {DictData} from "@/api/system/dict-data/model";
import {Merchant} from "@/api/shop/merchant/model";
import {Role} from "@/api/system/role/model";
import { DictData } from '@/api/system/dict-data/model';
import { Merchant } from '@/api/shop/merchant/model';
import { Role } from '@/api/system/role/model';
import { User } from '@/api/system/user/model';
// 是否是修改
const isUpdate = ref(false);
@@ -98,6 +109,8 @@
visible: boolean;
// 修改回显的数据
data?: MerchantAccount | null;
// 商户ID
merchantId?: number | null;
}>();
const emit = defineEmits<{
@@ -121,6 +134,7 @@
merchantId: undefined,
merchantName: '',
userId: undefined,
nickname: '',
roleId: undefined,
roleName: '',
comments: undefined,
@@ -153,11 +167,11 @@
trigger: 'blur'
}
],
roleId: [
userId: [
{
required: true,
type: 'number',
message: '请选择角色',
message: '请选择用户',
trigger: 'blur'
}
],
@@ -184,6 +198,14 @@
message: '请填写真实姓名',
trigger: 'blur'
}
],
roleId: [
{
required: true,
type: 'number',
message: '请选择角色权限',
trigger: 'blur'
}
]
});
@@ -193,10 +215,17 @@
form.merchantId = item.merchantId;
};
const chooseUserId = (item: User) => {
form.userId = item.userId;
form.nickname = item.realName ? item.realName : item.nickname;
form.phone = item.phone;
form.realName = item.realName;
};
const chooseRoleId = (item: Role) => {
form.roleId = item.roleId;
form.roleName = item.roleName;
}
};
const { resetFields } = useForm(form, rules);
@@ -210,9 +239,14 @@
.then(() => {
loading.value = true;
const formData = {
...form
...form,
merchantId: Number(props.merchantId)
? props.merchantId
: form.merchantId
};
const saveOrUpdate = isUpdate.value ? updateMerchantAccount : addMerchantAccount;
const saveOrUpdate = isUpdate.value
? updateMerchantAccount
: addMerchantAccount;
saveOrUpdate(formData)
.then((msg) => {
loading.value = false;

View File

@@ -7,13 +7,21 @@
</template>
<span>添加</span>
</a-button>
<a-input-search
allow-clear
placeholder="请输入关键词"
v-model:value="where.keywords"
@pressEnter="reload"
@search="reload"
/>
</a-space>
</template>
<script lang="ts" setup>
import { PlusOutlined } from '@ant-design/icons-vue';
import type { GradeParam } from '@/api/user/grade/model';
import { watch } from 'vue';
import { UserParam } from '@/api/system/user/model';
import useSearch from '@/utils/use-search';
const props = withDefaults(
defineProps<{
@@ -23,8 +31,15 @@
{}
);
// 表单数据
const { where } = useSearch<UserParam>({
userId: undefined,
phone: undefined,
keywords: ''
});
const emit = defineEmits<{
(e: 'search', where?: GradeParam): void;
(e: 'search', where?: UserParam): void;
(e: 'add'): void;
(e: 'remove'): void;
(e: 'batchMove'): void;
@@ -35,6 +50,10 @@
emit('add');
};
const reload = () => {
emit('search', where);
};
watch(
() => props.selection,
() => {}

View File

@@ -30,13 +30,11 @@
</template>
<template v-if="column.key === 'action'">
<a-space>
<a @click="openEdit(record)">修改</a>
<a-divider type="vertical" />
<a-popconfirm
title="确定要删除此记录吗?"
title="确定要移除该门店用户吗?"
@confirm="remove(record)"
>
<a class="ele-text-danger"></a>
<a class="ele-text-danger"></a>
</a-popconfirm>
</a-space>
</template>
@@ -45,13 +43,18 @@
</a-card>
<!-- 编辑弹窗 -->
<MerchantAccountEdit v-model:visible="showEdit" :data="current" @done="reload" />
<MerchantAccountEdit
v-model:visible="showEdit"
:data="current"
:merchantId="merchantId"
@done="reload"
/>
</div>
</div>
</template>
<script lang="ts" setup>
import { createVNode, ref } from 'vue';
import { createVNode, ref, watch } from 'vue';
import { message, Modal } from 'ant-design-vue';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import type { EleProTable } from 'ele-admin-pro';
@@ -62,8 +65,16 @@
} from 'ele-admin-pro/es/ele-pro-table/types';
import Search from './components/search.vue';
import MerchantAccountEdit from './components/merchantAccountEdit.vue';
import { pageMerchantAccount, removeMerchantAccount, removeBatchMerchantAccount } from '@/api/shop/merchantAccount';
import type { MerchantAccount, MerchantAccountParam } from '@/api/shop/merchantAccount/model';
import {
pageMerchantAccount,
removeMerchantAccount,
removeBatchMerchantAccount
} from '@/api/shop/merchantAccount';
import type {
MerchantAccount,
MerchantAccountParam
} from '@/api/shop/merchantAccount/model';
import router from '@/router';
// 表格实例
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
@@ -78,6 +89,8 @@
const showMove = ref(false);
// 加载状态
const loading = ref(true);
// 门店ID
const merchantId = ref(0);
// 表格数据源
const datasource: DatasourceFunction = ({
@@ -90,6 +103,10 @@
if (filters) {
where.status = filters.status;
}
if (merchantId.value > 0) {
where.merchantId = merchantId.value;
}
console.log('>>>>>>>>', merchantId.value);
return pageMerchantAccount({
...where,
...orders,
@@ -101,35 +118,41 @@
// 表格列配置
const columns = ref<ColumnItem[]>([
{
title: 'ID',
dataIndex: 'id',
key: 'id',
title: '用户ID',
dataIndex: 'userId',
key: 'userId',
align: 'center',
width: 90,
width: 90
},
{
title: '店铺名称',
dataIndex: 'merchantName',
key: 'merchantName',
align: 'center'
},
{
title: '账号',
dataIndex: 'phone',
key: 'phone',
align: 'center',
align: 'center'
},
{
title: '真实姓名',
dataIndex: 'realName',
key: 'realName',
align: 'center',
align: 'center'
},
{
title: '角色',
dataIndex: 'roleName',
key: 'roleName',
align: 'center',
align: 'center'
},
{
title: '备注',
dataIndex: 'comments',
key: 'comments',
align: 'center',
align: 'center'
},
{
title: '操作',
@@ -202,7 +225,9 @@
/* 查询 */
const query = () => {
console.log('query()', merchantId.value);
loading.value = true;
reload();
};
/* 自定义行属性 */
@@ -218,7 +243,21 @@
}
};
};
query();
watch(
() => router.currentRoute.value.params.id,
(id) => {
if (id) {
if (id == ':id') {
merchantId.value = 0;
} else {
merchantId.value = Number(id);
}
}
query();
},
{ immediate: true }
);
</script>
<script lang="ts">

View File

@@ -11,6 +11,15 @@
tool-class="ele-toolbar-form"
class="sys-org-table"
>
<template #toolbar>
<search
@search="reload"
:selection="selection"
@add="openEdit"
@remove="removeBatch"
@batchMove="openMove"
/>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'image'">
<a-image :src="record.image" :width="50" />
@@ -21,8 +30,11 @@
</template>
<template v-if="column.key === 'action'">
<a-space>
<a-button :size="`small`" @click="openEdit(record)">详情</a-button>
<a-button :size="`small`"
<a-button :size="`small`" @click="openEdit(record)"
>详情</a-button
>
<a-button
:size="`small`"
title="确定要删除此记录吗?"
:disabled="record.status === 1"
@confirm="remove(record)"
@@ -36,7 +48,11 @@
</a-card>
<!-- 编辑弹窗 -->
<MerchantApplyEdit v-model:visible="showEdit" :data="current" @done="reload" />
<MerchantApplyEdit
v-model:visible="showEdit"
:data="current"
@done="reload"
/>
</div>
</div>
</template>
@@ -51,10 +67,17 @@
DatasourceFunction,
ColumnItem
} from 'ele-admin-pro/es/ele-pro-table/types';
import Search from './components/search.vue';
import Search from '../merchant/components/search.vue';
import MerchantApplyEdit from './components/merchantApplyEdit.vue';
import { pageMerchantApply, removeMerchantApply, removeBatchMerchantApply } from '@/api/shop/merchantApply';
import type { MerchantApply, MerchantApplyParam } from '@/api/shop/merchantApply/model';
import {
pageMerchantApply,
removeMerchantApply,
removeBatchMerchantApply
} from '@/api/shop/merchantApply';
import type {
MerchantApply,
MerchantApplyParam
} from '@/api/shop/merchantApply/model';
// 表格实例
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
@@ -95,25 +118,25 @@
title: 'ID',
dataIndex: 'applyId',
key: 'applyId',
width: 90,
width: 90
},
{
title: '商户名称',
dataIndex: 'merchantName',
key: 'merchantName',
align: 'center',
align: 'center'
},
{
title: '商户姓名',
dataIndex: 'realName',
key: 'realName',
align: 'center',
align: 'center'
},
{
title: '商户手机号',
dataIndex: 'phone',
key: 'phone',
align: 'center',
align: 'center'
},
{
title: '申请时间',
@@ -128,13 +151,13 @@
title: '店铺类型',
dataIndex: 'shopType',
key: 'shopType',
align: 'center',
align: 'center'
},
{
title: '状态',
dataIndex: 'status',
key: 'status',
align: 'center',
align: 'center'
},
{
title: '操作',

View File

@@ -45,7 +45,11 @@
</a-card>
<!-- 编辑弹窗 -->
<MerchantTypeEdit v-model:visible="showEdit" :data="current" @done="reload" />
<MerchantTypeEdit
v-model:visible="showEdit"
:data="current"
@done="reload"
/>
</div>
</div>
</template>
@@ -60,10 +64,17 @@
DatasourceFunction,
ColumnItem
} from 'ele-admin-pro/es/ele-pro-table/types';
import Search from './components/search.vue';
import Search from '../merchant/components/search.vue';
import MerchantTypeEdit from './components/merchantTypeEdit.vue';
import { pageMerchantType, removeMerchantType, removeBatchMerchantType } from '@/api/shop/merchantType';
import type { MerchantType, MerchantTypeParam } from '@/api/shop/merchantType/model';
import {
pageMerchantType,
removeMerchantType,
removeBatchMerchantType
} from '@/api/shop/merchantType';
import type {
MerchantType,
MerchantTypeParam
} from '@/api/shop/merchantType/model';
// 表格实例
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
@@ -105,31 +116,31 @@
dataIndex: 'id',
key: 'id',
align: 'center',
width: 90,
width: 90
},
{
title: '店铺类型',
dataIndex: 'name',
key: 'name',
align: 'center',
align: 'center'
},
{
title: '店铺入驻条件',
dataIndex: 'comments',
key: 'comments',
align: 'center',
align: 'center'
},
{
title: '状态',
dataIndex: 'status',
key: 'status',
align: 'center',
align: 'center'
},
{
title: '排序号',
dataIndex: 'sortNumber',
key: 'sortNumber',
align: 'center',
align: 'center'
},
{
title: '创建时间',

View File

@@ -2,7 +2,7 @@
<template>
<a-space :size="10" style="flex-wrap: wrap">
<SelectMerchantDown
:placeholder="`选择场馆`"
:placeholder="`选择店铺`"
class="input-item"
v-model:value="where.merchantCode"
@change="search"
@@ -14,7 +14,7 @@
@search="search"
@pressEnter="search"
/>
<!-- <a-button @click="getCode">生成支付二维码</a-button>-->
<!-- <a-button @click="getCode">生成支付二维码</a-button>-->
<a-button @click="reset">重置</a-button>
</a-space>
<ele-modal

View File

@@ -1,10 +1,11 @@
<!-- 编辑弹窗 -->
<template>
<ele-modal
:width="500"
:width="800"
:visible="visible"
:maskClosable="false"
:title="isUpdate ? '编辑商品规格' : '添加商品规格'"
:maxable="maxable"
:title="isUpdate ? '编辑规格' : '添加规格'"
:body-style="{ paddingBottom: '28px' }"
@update:visible="updateVisible"
@ok="save"
@@ -13,48 +14,65 @@
ref="formRef"
:model="form"
:rules="rules"
:label-col="styleResponsive ? { md: 5, sm: 5, xs: 24 } : { flex: '90px' }"
:label-col="styleResponsive ? { md: 4, sm: 5, xs: 24 } : { flex: '90px' }"
:wrapper-col="
styleResponsive ? { md: 18, sm: 19, xs: 24 } : { flex: '1' }
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
"
>
<a-form-item label="规格名称" name="specName">
<a-input
allow-clear
:maxlength="100"
placeholder="机型"
placeholder="请输入规格名称"
v-model:value="form.specName"
@pressEnter="save"
/>
</a-form-item>
<a-form-item label="排序号" name="sortNumber" v-if="isUpdate">
<a-input-number
:min="0"
:max="9999"
class="ele-fluid"
placeholder="请输入排序号"
v-model:value="form.sortNumber"
/>
<a-form-item name="specValue">
<a-space direction="vertical" class="ml-[124px]">
<template v-for="(item, index) in spec" :key="index">
<div class="text-left flex items-center leading-10 text-gray-400">
<div class="mr-2">{{ item.value }} :</div>
<CloseCircleOutlined
class="cursor-pointer"
@click="onClose(index)"
/>
</div>
<ele-edit-tag
v-model:data="item.detail"
size="middle"
shape="round"
/>
</template>
<a-card class="ml-[124px]" v-if="showSpecForm">
<a-form-item name="name">
<a-input
allow-clear
placeholder="请输入规格"
v-model:value="name"
/>
</a-form-item>
<a-form-item name="value">
<a-input
allow-clear
placeholder="请输入规格值"
v-model:value="value"
/>
</a-form-item>
<a-space>
<a-button type="primary" @click="addSpecValue">确定</a-button>
<a-button @click="openSpecForm">取消</a-button>
</a-space>
</a-card>
<a-button type="primary" class="mt-5" v-else @click="openSpecForm"
>添加新规格</a-button
>
</a-space>
</a-form-item>
<a-form-item label="描述" name="comments">
<a-textarea
:rows="4"
:maxlength="200"
placeholder="iphone15"
v-model:value="form.comments"
/>
</a-form-item>
<!-- <a-form-item label="状态" name="status">-->
<!-- <a-radio-group v-model:value="form.status">-->
<!-- <a-radio :value="0">已启用</a-radio>-->
<!-- <a-radio :value="1">未启用</a-radio>-->
<!-- </a-radio-group>-->
<!-- </a-form-item>-->
</a-form>
</ele-modal>
</template>
<script lang="ts" setup>
import { CloseCircleOutlined } from '@ant-design/icons-vue';
import { ref, reactive, watch } from 'vue';
import { Form, message } from 'ant-design-vue';
import { assignObject } from 'ele-admin-pro';
@@ -62,7 +80,9 @@
import { Spec } from '@/api/shop/spec/model';
import { useThemeStore } from '@/store/modules/theme';
import { storeToRefs } from 'pinia';
import { ItemType } from 'ele-admin-pro/es/ele-image-upload/types';
import { FormInstance } from 'ant-design-vue/es/form';
import { SpecValue } from '@/api/shop/specValue/model';
// 是否是修改
const isUpdate = ref(false);
@@ -85,16 +105,24 @@
// 提交状态
const loading = ref(false);
// 是否显示最大化切换按钮
const maxable = ref(true);
const showSpecForm = ref(false);
// 表格选中数据
const formRef = ref<FormInstance | null>(null);
const images = ref<ItemType[]>([]);
const spec = ref<SpecValue[]>([]);
const name = ref();
const value = ref();
// 用户信息
const form = reactive<Spec>({
specId: undefined,
specName: '',
specName: undefined,
specValue: undefined,
status: 0,
comments: '',
sortNumber: 100,
status: 0
sortNumber: 100
});
/* 更新visible */
@@ -108,12 +136,48 @@
{
required: true,
type: 'string',
message: '请填写商品规格名称',
message: '请填写规格名称',
trigger: 'blur'
}
]
});
// const validator = (value: string) => {
// return new Promise<void>((_resolve, reject) => {
// setTimeout(() => {
// reject(new Error(value + '不合法, 请重新输入'));
// }, 1000);
// });
// };
// 新增规格
const addSpecValue = () => {
if (!name.value || !value.value) {
message.error(`请输入规格和规格值)`);
return false;
}
const findIndex = spec.value.findIndex((d) => d.value == name.value);
if (findIndex == 0) {
message.error(`${name.value}已存在)`);
return false;
}
spec.value.push({
value: name.value,
detail: [value.value]
});
name.value = '';
value.value = '';
openSpecForm();
};
const openSpecForm = () => {
showSpecForm.value = !showSpecForm.value;
};
const onClose = (index) => {
spec.value.splice(index, 1);
};
const { resetFields } = useForm(form, rules);
/* 保存编辑 */
@@ -125,8 +189,13 @@
.validate()
.then(() => {
loading.value = true;
if (spec.value.length === 0) {
message.error('请添加规格');
return;
}
const formData = {
...form
...form,
specValue: JSON.stringify(spec.value)
};
const saveOrUpdate = isUpdate.value ? updateSpec : addSpec;
saveOrUpdate(formData)
@@ -148,10 +217,15 @@
() => props.visible,
(visible) => {
if (visible) {
images.value = [];
if (props.data) {
assignObject(form, props.data);
if (props.data.specValue) {
spec.value = JSON.parse(props.data.specValue);
}
isUpdate.value = true;
} else {
spec.value = [];
isUpdate.value = false;
}
} else {

View File

@@ -21,16 +21,32 @@
/>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'specValue'">
<a-space direction="vertical">
<template
v-for="(item, index) in JSON.parse(record.specValue)"
:key="index"
>
<div class="text-left">
<span class="text-gray-400 mr-2">{{ item.value }} :</span>
<ele-tag
shape="round"
size="small"
v-for="(sub, subIndex) in item.detail"
:key="subIndex"
>
{{ sub }}
</ele-tag>
</div>
</template>
</a-space>
</template>
<template v-if="column.key === 'status'">
<a-tag v-if="record.status === 0" color="green">已启用</a-tag>
<a-tag v-if="record.status === 1" color="red">未启用</a-tag>
<a-tag v-if="record.status === 0" color="green">显示</a-tag>
<a-tag v-if="record.status === 1" color="red">隐藏</a-tag>
</template>
<template v-if="column.key === 'action'">
<a-space>
<a @click="openSpecValue(record)">规格值</a>
<a-divider type="vertical" />
<a @click="moveUp(record)">上移<ArrowUpOutlined /></a>
<a-divider type="vertical" />
<a @click="openEdit(record)">修改</a>
<a-divider type="vertical" />
<a-popconfirm
@@ -47,13 +63,6 @@
<!-- 编辑弹窗 -->
<SpecEdit v-model:visible="showEdit" :data="current" @done="reload" />
<!-- 规则值弹窗 -->
<SpecValueEdit
v-model:visible="showSpecValueEdit"
:data="current"
@done="reload"
/>
</div>
</div>
</template>
@@ -61,25 +70,17 @@
<script lang="ts" setup>
import { createVNode, ref } from 'vue';
import { message, Modal } from 'ant-design-vue';
import {
ArrowUpOutlined,
ExclamationCircleOutlined
} from '@ant-design/icons-vue';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import type { EleProTable } from 'ele-admin-pro';
import { toDateString } from 'ele-admin-pro';
import type {
DatasourceFunction,
ColumnItem
} from 'ele-admin-pro/es/ele-pro-table/types';
import Search from './components/search.vue';
import SpecEdit from './components/specEdit.vue';
import {
pageSpec,
removeSpec,
removeBatchSpec,
updateSpec
} from '@/api/shop/spec';
import { pageSpec, removeSpec, removeBatchSpec } from '@/api/shop/spec';
import type { Spec, SpecParam } from '@/api/shop/spec/model';
import SpecValueEdit from '../specValue/index.vue';
// 表格实例
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
@@ -90,8 +91,6 @@
const current = ref<Spec | null>(null);
// 是否显示编辑弹窗
const showEdit = ref(false);
// 是否显示规格值弹窗
const showSpecValueEdit = ref(false);
// 是否显示批量移动弹窗
const showMove = ref(false);
// 加载状态
@@ -120,24 +119,49 @@
const columns = ref<ColumnItem[]>([
{
title: 'ID',
width: 90,
dataIndex: 'specId'
dataIndex: 'specId',
key: 'specId',
align: 'center',
width: 90
},
{
title: '规格名称',
dataIndex: 'specName',
width: 240,
key: 'specName'
key: 'specName',
align: 'center'
},
{
title: '规格值',
dataIndex: 'specValue',
key: 'specValue'
},
{
title: '备注',
dataIndex: 'comments',
key: 'comments'
key: 'comments',
align: 'center',
hideInTable: true
},
{
title: '状态',
dataIndex: 'status',
key: 'status',
align: 'center',
hideInTable: true
},
{
title: '创建时间',
dataIndex: 'createTime',
key: 'createTime',
align: 'center',
sorter: true,
ellipsis: true,
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd')
},
{
title: '操作',
key: 'action',
width: 280,
width: 180,
fixed: 'right',
align: 'center',
hideInSetting: true
@@ -156,11 +180,6 @@
showEdit.value = true;
};
const openSpecValue = (row?: Spec) => {
current.value = row ?? null;
showSpecValueEdit.value = true;
};
/* 打开批量移动弹窗 */
const openMove = () => {
showMove.value = true;
@@ -208,17 +227,6 @@
});
};
// 上移
const moveUp = (row?: Spec) => {
updateSpec({
specId: row?.specId,
sortNumber: Number(row?.sortNumber) - 1
}).then((msg) => {
message.success(msg);
reload();
});
};
/* 查询 */
const query = () => {
loading.value = true;
@@ -233,11 +241,10 @@
},
// 行双击事件
onDblclick: () => {
openSpecValue(record);
openEdit(record);
}
};
};
query();
</script>

View File

@@ -45,7 +45,11 @@
</a-card>
<!-- 编辑弹窗 -->
<WechatDepositEdit v-model:visible="showEdit" :data="current" @done="reload" />
<WechatDepositEdit
v-model:visible="showEdit"
:data="current"
@done="reload"
/>
</div>
</div>
</template>
@@ -62,8 +66,15 @@
} from 'ele-admin-pro/es/ele-pro-table/types';
import Search from './components/search.vue';
import WechatDepositEdit from './components/wechatDepositEdit.vue';
import { pageWechatDeposit, removeWechatDeposit, removeBatchWechatDeposit } from '@/api/shop/wechatDeposit';
import type { WechatDeposit, WechatDepositParam } from '@/api/shop/wechatDeposit/model';
import {
pageWechatDeposit,
removeWechatDeposit,
removeBatchWechatDeposit
} from '@/api/shop/wechatDeposit';
import type {
WechatDeposit,
WechatDepositParam
} from '@/api/shop/wechatDeposit/model';
// 表格实例
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
@@ -105,73 +116,73 @@
dataIndex: 'id',
key: 'id',
align: 'center',
width: 90,
width: 90
},
{
title: '订单id',
dataIndex: 'oid',
key: 'oid',
align: 'center',
align: 'center'
},
{
title: '用户id',
dataIndex: 'uid',
key: 'uid',
align: 'center',
align: 'center'
},
{
title: '场地订单号',
dataIndex: 'orderNum',
key: 'orderNum',
align: 'center',
align: 'center'
},
{
title: '付款订单号',
dataIndex: 'wechatOrder',
key: 'wechatOrder',
align: 'center',
align: 'center'
},
{
title: '退款订单号 ',
dataIndex: 'wechatReturn',
key: 'wechatReturn',
align: 'center',
align: 'center'
},
{
title: '场馆名称',
dataIndex: 'siteName',
key: 'siteName',
align: 'center',
align: 'center'
},
{
title: '微信昵称',
dataIndex: 'username',
key: 'username',
align: 'center',
align: 'center'
},
{
title: '手机号码',
dataIndex: 'phone',
key: 'phone',
align: 'center',
align: 'center'
},
{
title: '物品名称',
dataIndex: 'name',
key: 'name',
align: 'center',
align: 'center'
},
{
title: '押金金额',
dataIndex: 'price',
key: 'price',
align: 'center',
align: 'center'
},
{
title: '押金状态1已付款2未付款已退押金',
dataIndex: 'status',
key: 'status',
align: 'center',
align: 'center'
},
{
title: '',