This commit is contained in:
2024-11-02 11:57:43 +08:00
parent 11ef915934
commit 9e831de60b
9 changed files with 256 additions and 218 deletions

View File

@@ -25,6 +25,7 @@ export interface Goods {
video?: string; video?: string;
// 商品详情 // 商品详情
content?: string; content?: string;
canExpress?: number;
// 商品分类 // 商品分类
category?: string; category?: string;
// 商品分类ID // 商品分类ID
@@ -49,6 +50,9 @@ export interface Goods {
chainStoreRate?: string; chainStoreRate?: string;
memberStoreRate?: string; memberStoreRate?: string;
memberMarketRate?: string; memberMarketRate?: string;
memberStoreCommission?: string;
supplierCommission?: string;
coopCommission?: string;
memberStorePrice?: string; memberStorePrice?: string;
memberMarketPrice?: string; memberMarketPrice?: string;
// 经销商价格 // 经销商价格
@@ -61,6 +65,7 @@ export interface Goods {
dealerGift?: boolean; dealerGift?: boolean;
buyingGiftNum?: number; buyingGiftNum?: number;
priceGiftNum?: number; priceGiftNum?: number;
priceGiftName?: string;
dealerGiftNum?: number; dealerGiftNum?: number;
// 库存计算方式(10下单减库存 20付款减库存) // 库存计算方式(10下单减库存 20付款减库存)
deductStockType?: number; deductStockType?: number;

View File

@@ -43,6 +43,7 @@ export interface Merchant {
keywords?: string; keywords?: string;
// 资质图片 // 资质图片
files?: string; files?: string;
swiper?: string;
// 营业时间 // 营业时间
businessTime?: string; businessTime?: string;
timePeriod1?: string; timePeriod1?: string;

View File

@@ -30,16 +30,16 @@
<a-space class="login-title"> <a-space class="login-title">
<h4 <h4
class="title-btn" class="title-btn"
:class="loginType === 'account' ? 'active' : ''" :class="loginType === 'sms' ? 'active' : ''"
@click="onLoginType('account')" @click="onLoginType('sms')"
>密码登录</h4 >短信登录</h4
> >
<a-divider type="vertical" style="height: 20px" /> <a-divider type="vertical" style="height: 20px" />
<h4 <h4
class="title-btn" class="title-btn"
:class="loginType === 'sms' ? 'active' : ''" :class="loginType === 'account' ? 'active' : ''"
@click="onLoginType('sms')" @click="onLoginType('account')"
>短信登录</h4 >密码登录</h4
> >
</a-space> </a-space>
<template v-if="loginType === 'account'"> <template v-if="loginType === 'account'">
@@ -233,7 +233,7 @@
const loading = ref(false); const loading = ref(false);
// 是否显示tenantId填写输入框 // 是否显示tenantId填写输入框
const showTenantId = ref(true); const showTenantId = ref(true);
const loginType = ref('account'); const loginType = ref('sms');
const config = ref<Config>(); const config = ref<Config>();
// 配置信息 // 配置信息
const { form } = useFormData<User>({ const { form } = useFormData<User>({

View File

@@ -65,8 +65,7 @@
ColumnItem ColumnItem
} from 'ele-admin-pro/es/ele-pro-table/types'; } from 'ele-admin-pro/es/ele-pro-table/types';
import Search from './components/search.vue'; import Search from './components/search.vue';
<<<<<<< HEAD:src/views/shop/bookingCard/index.vue
import CardEdit from './components/cardEdit.vue';
import { import {
pageBookingCard, pageBookingCard,
removeBookingCard, removeBookingCard,
@@ -76,33 +75,17 @@
BookingCard, BookingCard,
BookingCardParam BookingCardParam
} from '@/api/booking/bookingCard/model'; } from '@/api/booking/bookingCard/model';
import { formatNumber } from 'ele-admin-pro/es';
=======
import DealerApplyEdit from './components/dealerApplyEdit.vue';
import {
pageDealerApply,
removeDealerApply,
removeBatchDealerApply
} from '@/api/shop/dealerApply';
import type {
DealerApply,
DealerApplyParam
} from '@/api/shop/dealerApply/model';
>>>>>>> origin/master:src/views/shop/dealerApply/index.vue
// 表格实例 // 表格实例
const tableRef = ref<InstanceType<typeof EleProTable> | null>(null); const tableRef = ref<InstanceType<typeof EleProTable> | null>(null);
// 表格选中数据 // 表格选中数据
<<<<<<< HEAD:src/views/shop/bookingCard/index.vue
const selection = ref<BookingCard[]>([]); const selection = ref<BookingCard[]>([]);
// 当前编辑数据 // 当前编辑数据
const current = ref<BookingCard | null>(null); const current = ref<BookingCard | null>(null);
=======
const selection = ref<DealerApply[]>([]);
// 当前编辑数据
const current = ref<DealerApply | null>(null);
>>>>>>> origin/master:src/views/shop/dealerApply/index.vue
// 是否显示编辑弹窗 // 是否显示编辑弹窗
const showEdit = ref(false); const showEdit = ref(false);
// 是否显示批量移动弹窗 // 是否显示批量移动弹窗
@@ -121,11 +104,8 @@
if (filters) { if (filters) {
where.status = filters.status; where.status = filters.status;
} }
<<<<<<< HEAD:src/views/shop/bookingCard/index.vue
return pageBookingCard({ return pageBookingCard({
=======
return pageDealerApply({
>>>>>>> origin/master:src/views/shop/dealerApply/index.vue
...where, ...where,
...orders, ...orders,
page, page,
@@ -222,21 +202,16 @@
]); ]);
/* 搜索 */ /* 搜索 */
<<<<<<< HEAD:src/views/shop/bookingCard/index.vue
const reload = (where?: BookingCardParam) => { const reload = (where?: BookingCardParam) => {
=======
const reload = (where?: DealerApplyParam) => {
>>>>>>> origin/master:src/views/shop/dealerApply/index.vue
selection.value = []; selection.value = [];
tableRef?.value?.reload({ where: where }); tableRef?.value?.reload({ where: where });
}; };
/* 打开编辑弹窗 */ /* 打开编辑弹窗 */
<<<<<<< HEAD:src/views/shop/bookingCard/index.vue
const openEdit = (row?: BookingCard) => { const openEdit = (row?: BookingCard) => {
=======
const openEdit = (row?: DealerApply) => {
>>>>>>> origin/master:src/views/shop/dealerApply/index.vue
current.value = row ?? null; current.value = row ?? null;
showEdit.value = true; showEdit.value = true;
}; };
@@ -247,15 +222,10 @@
}; };
/* 删除单个 */ /* 删除单个 */
<<<<<<< HEAD:src/views/shop/bookingCard/index.vue
const remove = (row: BookingCard) => { const remove = (row: BookingCard) => {
const hide = message.loading('请求中..', 0); const hide = message.loading('请求中..', 0);
removeBookingCard(row.cardId) removeBookingCard(row.cardId)
=======
const remove = (row: DealerApply) => {
const hide = message.loading('请求中..', 0);
removeDealerApply(row.applyId)
>>>>>>> origin/master:src/views/shop/dealerApply/index.vue
.then((msg) => { .then((msg) => {
hide(); hide();
message.success(msg); message.success(msg);
@@ -280,11 +250,8 @@
maskClosable: true, maskClosable: true,
onOk: () => { onOk: () => {
const hide = message.loading('请求中..', 0); const hide = message.loading('请求中..', 0);
<<<<<<< HEAD:src/views/shop/bookingCard/index.vue
removeBatchBookingCard(selection.value.map((d) => d.cardId)) removeBatchBookingCard(selection.value.map((d) => d.cardId))
=======
removeBatchDealerApply(selection.value.map((d) => d.applyId))
>>>>>>> origin/master:src/views/shop/dealerApply/index.vue
.then((msg) => { .then((msg) => {
hide(); hide();
message.success(msg); message.success(msg);
@@ -304,11 +271,8 @@
}; };
/* 自定义行属性 */ /* 自定义行属性 */
<<<<<<< HEAD:src/views/shop/bookingCard/index.vue
const customRow = (record: BookingCard) => { const customRow = (record: BookingCard) => {
=======
const customRow = (record: DealerApply) => {
>>>>>>> origin/master:src/views/shop/dealerApply/index.vue
return { return {
// 行点击事件 // 行点击事件
onClick: () => { onClick: () => {
@@ -325,11 +289,7 @@
<script lang="ts"> <script lang="ts">
export default { export default {
<<<<<<< HEAD:src/views/shop/bookingCard/index.vue
name: 'BookingCard' name: 'BookingCard'
=======
name: 'DealerApply'
>>>>>>> origin/master:src/views/shop/dealerApply/index.vue
}; };
</script> </script>

View File

@@ -21,31 +21,31 @@
> >
<a-tabs type="card" v-model:active-key="active" @change="onChange"> <a-tabs type="card" v-model:active-key="active" @change="onChange">
<a-tab-pane tab="基本信息" key="base"> <a-tab-pane tab="基本信息" key="base">
<!-- <a-form-item label="商品类型" name="type">--> <!-- <a-form-item label="商品类型" name="type">-->
<!-- <a-space>--> <!-- <a-space>-->
<!-- <a-button--> <!-- <a-button-->
<!-- :type="form.type == 1 ? 'primary' : ''"--> <!-- :type="form.type == 1 ? 'primary' : ''"-->
<!-- @click="onType(1)"--> <!-- @click="onType(1)"-->
<!-- :ghost="form.type == 1"--> <!-- :ghost="form.type == 1"-->
<!-- >实物商品--> <!-- >实物商品-->
<!-- </a-button--> <!-- </a-button-->
<!-- >--> <!-- >-->
<!-- <a-button--> <!-- <a-button-->
<!-- :type="form.type == 2 ? 'primary' : ''"--> <!-- :type="form.type == 2 ? 'primary' : ''"-->
<!-- @click="onType(2)"--> <!-- @click="onType(2)"-->
<!-- :ghost="form.type == 2"--> <!-- :ghost="form.type == 2"-->
<!-- >虚拟商品--> <!-- >虚拟商品-->
<!-- </a-button--> <!-- </a-button-->
<!-- >--> <!-- >-->
<!-- </a-space>--> <!-- </a-space>-->
<!-- <div class="ele-text-placeholder">--> <!-- <div class="ele-text-placeholder">-->
<!-- {{--> <!-- {{-->
<!-- form.type == 1--> <!-- form.type == 1-->
<!-- ? `支持快递邮寄、同城配送或到店自提方式发货`--> <!-- ? `支持快递邮寄、同城配送或到店自提方式发货`-->
<!-- : '电子券码等,线下到店核销,无需备货'--> <!-- : '电子券码等,线下到店核销,无需备货'-->
<!-- }}--> <!-- }}-->
<!-- </div>--> <!-- </div>-->
<!-- </a-form-item>--> <!-- </a-form-item>-->
<a-form-item <a-form-item
v-if="!merchantId" v-if="!merchantId"
label="选择店铺" label="选择店铺"
@@ -103,6 +103,12 @@
v-model:value="form.comments" v-model:value="form.comments"
/> />
</a-form-item> </a-form-item>
<a-form-item label="是否可以快递配送">
<a-select v-model:value="form.canExpress">
<a-select-option :value="1">可以</a-select-option>
<a-select-option :value="0">不可以</a-select-option>
</a-select>
</a-form-item>
<a-form-item label="单位名称" name="unitName"> <a-form-item label="单位名称" name="unitName">
<a-input <a-input
allow-clear allow-clear
@@ -129,26 +135,32 @@
v-model:value="form.price" v-model:value="form.price"
/> />
<a-checkbox v-model:checked="form.priceGift">有赠品</a-checkbox> <a-checkbox v-model:checked="form.priceGift">有赠品</a-checkbox>
<a-input v-if="form.priceGift" v-model:value="form.priceGiftName" style="width: 200px"
placeholder="请输入赠品名称">
<template #prefix>名称</template>
</a-input>
<a-input-number v-if="form.priceGift" v-model:value="form.priceGiftNum" style="width: 200px" <a-input-number v-if="form.priceGift" v-model:value="form.priceGiftNum" style="width: 200px"
placeholder="请输入赠品数量"/> placeholder="请输入赠品数量">
<template #prefix>数量</template>
</a-input-number>
</a-space> </a-space>
<div class="ele-text-placeholder">商品的实际购买金额最低0.01</div> <div class="ele-text-placeholder">商品的实际购买金额最低0.01</div>
</a-form-item> </a-form-item>
<a-form-item label="经销商价" name="dealerPrice" v-if="!merchantId"> <!-- <a-form-item label="经销商价" name="dealerPrice" v-if="!merchantId">-->
<a-space> <!-- <a-space>-->
<a-input-number <!-- <a-input-number-->
:placeholder="`经销商价格`" <!-- :placeholder="`经销商价格`"-->
style="width: 240px" <!-- style="width: 240px"-->
:min="0.01" <!-- :min="0.01"-->
v-model:value="form.dealerPrice" <!-- v-model:value="form.dealerPrice"-->
/> <!-- />-->
<a-checkbox v-model:checked="form.dealerGift">有赠品</a-checkbox> <!-- <a-checkbox v-model:checked="form.dealerGift">有赠品</a-checkbox>-->
<a-input-number v-if="form.dealerGift" v-model:value="form.dealerGiftNum" style="width: 200px" <!-- <a-input-number v-if="form.dealerGift" v-model:value="form.dealerGiftNum" style="width: 200px"-->
placeholder="请输入赠品数量"/> <!-- placeholder="请输入赠品数量"/>-->
</a-space> <!-- </a-space>-->
<div class="ele-text-placeholder">经销商价格</div> <!-- <div class="ele-text-placeholder">经销商价格</div>-->
</a-form-item> <!-- </a-form-item>-->
<a-form-item label="供应商价" name="buyingPrice" v-if="!merchantId"> <a-form-item label="供应商价" name="buyingPrice" v-if="!merchantId">
<a-space> <a-space>
<a-input-number <a-input-number
:placeholder="`供应商价`" :placeholder="`供应商价`"
@@ -205,37 +217,65 @@
</a-space> </a-space>
<div class="ele-text-placeholder">会员店差价比例(%)</div> <div class="ele-text-placeholder">会员店差价比例(%)</div>
</a-form-item> </a-form-item>
<!-- <a-form-item label="会员超市价格" name="memberMarketPrice" v-if="!merchantId">--> <a-form-item label="会员店直推分佣(元)" v-if="!merchantId">
<!-- <a-space>--> <a-space>
<!-- <a-input-number--> <a-input-number
<!-- :placeholder="`请输入会员超市价格`"--> :placeholder="`请输入会员店直推分佣(元)`"
<!-- :min="0.01"--> style="width: 240px"
<!-- style="width: 240px"--> v-model:value="form.memberStoreCommission"
<!-- v-model:value="form.memberMarketPrice"--> />
<!-- />--> </a-space>
<!-- </a-space>--> </a-form-item>
<!-- <div class="ele-text-placeholder">会员超市价格</div>--> <a-form-item label="供应商直推分佣(元)" v-if="!merchantId">
<!-- </a-form-item>--> <a-space>
<!-- <a-form-item label="会员超市差价比例(%)" name="memberMarketRate" v-if="!merchantId">--> <a-input-number
<!-- <a-space>--> :placeholder="`请输入供应商直推分佣(元)`"
<!-- <a-input-number--> style="width: 240px"
<!-- :placeholder="`请输入会员超市差价比例(%)`"--> v-model:value="form.supplierCommission"
<!-- :min="0.01"--> />
<!-- :max="100"--> </a-space>
<!-- style="width: 240px"--> </a-form-item>
<!-- v-model:value="form.memberMarketRate"--> <a-form-item label="合作伙伴直推分佣(元)" v-if="!merchantId">
<!-- />--> <a-space>
<!-- </a-space>--> <a-input-number
<!-- <div class="ele-text-placeholder">会员超市差价比例(%)</div>--> :placeholder="`请输入合作伙伴直推分佣(元)`"
<!-- </a-form-item>--> style="width: 240px"
<!-- <a-form-item label="当前库存" name="stock">--> v-model:value="form.coopCommission"
<!-- <a-input-number--> />
<!-- :placeholder="`商品库存`"--> </a-space>
<!-- style="width: 240px"--> </a-form-item>
<!-- v-model:value="form.stock"-->
<!-- />--> <!-- <a-form-item label="会员超市价格" name="memberMarketPrice" v-if="!merchantId">-->
<!-- <div class="ele-text-placeholder">划线价仅用于商品页展示</div>--> <!-- <a-space>-->
<!-- </a-form-item>--> <!-- <a-input-number-->
<!-- :placeholder="`请输入会员超市价格`"-->
<!-- :min="0.01"-->
<!-- style="width: 240px"-->
<!-- v-model:value="form.memberMarketPrice"-->
<!-- />-->
<!-- </a-space>-->
<!-- <div class="ele-text-placeholder">会员超市价格</div>-->
<!-- </a-form-item>-->
<!-- <a-form-item label="会员超市差价比例(%)" name="memberMarketRate" v-if="!merchantId">-->
<!-- <a-space>-->
<!-- <a-input-number-->
<!-- :placeholder="`请输入会员超市差价比例(%)`"-->
<!-- :min="0.01"-->
<!-- :max="100"-->
<!-- style="width: 240px"-->
<!-- v-model:value="form.memberMarketRate"-->
<!-- />-->
<!-- </a-space>-->
<!-- <div class="ele-text-placeholder">会员超市差价比例(%)</div>-->
<!-- </a-form-item>-->
<!-- <a-form-item label="当前库存" name="stock">-->
<!-- <a-input-number-->
<!-- :placeholder="`商品库存`"-->
<!-- style="width: 240px"-->
<!-- v-model:value="form.stock"-->
<!-- />-->
<!-- <div class="ele-text-placeholder">划线价仅用于商品页展示</div>-->
<!-- </a-form-item>-->
<a-form-item label="是否新品"> <a-form-item label="是否新品">
<a-switch size="small" v-model:checked="form.isNew" :checked-value="1" :un-checked-value="0"/> <a-switch size="small" v-model:checked="form.isNew" :checked-value="1" :un-checked-value="0"/>
</a-form-item> </a-form-item>
@@ -565,6 +605,7 @@ const form = reactive<Goods>({
image: undefined, image: undefined,
video: undefined, video: undefined,
content: undefined, content: undefined,
canExpress: 1,
unitName: '', unitName: '',
categoryId: undefined, categoryId: undefined,
parentName: undefined, parentName: undefined,
@@ -578,6 +619,7 @@ const form = reactive<Goods>({
priceGift: undefined, priceGift: undefined,
dealerGift: undefined, dealerGift: undefined,
priceGiftNum: undefined, priceGiftNum: undefined,
priceGiftName: undefined,
dealerGiftNum: undefined, dealerGiftNum: undefined,
files: undefined, files: undefined,
sales: 0, sales: 0,
@@ -595,6 +637,9 @@ const form = reactive<Goods>({
chainStoreRate: undefined, chainStoreRate: undefined,
memberStoreRate: undefined, memberStoreRate: undefined,
memberMarketRate: undefined, memberMarketRate: undefined,
memberStoreCommission: undefined,
supplierCommission: undefined,
coopCommission: undefined,
stock: 1000, stock: 1000,
deductStockType: 20, deductStockType: 20,
isShow: 1, isShow: 1,
@@ -1005,7 +1050,7 @@ const save = () => {
.then(() => { .then(() => {
loading.value = true; loading.value = true;
if (form.priceGift && !form.priceGiftNum) return message.error('请输入会员赠品数量'); if (form.priceGift && !form.priceGiftNum) return message.error('请输入会员赠品数量');
if (form.dealerGift && !form.dealerGiftNum) return message.error('请输入经销商赠品数量'); // if (form.dealerGift && !form.dealerGiftNum) return message.error('请输入经销商赠品数量');
const formData = { const formData = {
...form, ...form,
content: content.value, content: content.value,

View File

@@ -19,27 +19,27 @@
styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' } styleResponsive ? { md: 19, sm: 19, xs: 24 } : { flex: '1' }
" "
> >
<a-form-item label="商品" name="goodsId"> <!-- <a-form-item label="商品" name="goodsId">-->
<a-select v-model:value="form.goodsId" placeholder="请选择商品"> <!-- <a-select v-model:value="form.goodsId" placeholder="请选择商品">-->
<a-select-option v-for="(item, index) in goodsList" :key="index" :value="item.goodsId"> <!-- <a-select-option v-for="(item, index) in goodsList" :key="index" :value="item.goodsId">-->
{{ item.goodsName }} <!-- {{ item.goodsName }}-->
</a-select-option> <!-- </a-select-option>-->
</a-select> <!-- </a-select>-->
</a-form-item> <!-- </a-form-item>-->
<a-form-item label="店铺类型" name="merchantShopType"> <a-form-item label="店铺类型" name="merchantShopType">
<SelectMerchantType <SelectMerchantType disabled
:placeholder="`请选择店铺类型`" :placeholder="`请选择店铺类型`"
v-model:value="form.merchantShopType" v-model:value="form.merchantShopType"
@done="chooseShopType" @done="chooseShopType"
/> />
</a-form-item> </a-form-item>
<a-form-item label="SKU" v-if="form.goodsId && goodsList.find(v => v.goodsId === form.goodsId)?.goodsSkus"> <!-- <a-form-item label="SKU" v-if="form.goodsId && goodsList.find(v => v.goodsId === form.goodsId)?.goodsSkus">-->
<a-select v-model:value="form.skuId" placeholder="请选择SKU"> <!-- <a-select v-model:value="form.skuId" placeholder="请选择SKU">-->
<a-select-option v-for="(item, index) in goodsList.find(v => v.goodsId === form.goodsId)?.goodsSkus" :key="index" :value="item.id"> <!-- <a-select-option v-for="(item, index) in goodsList.find(v => v.goodsId === form.goodsId)?.goodsSkus" :key="index" :value="item.id">-->
{{ item.sku }} <!-- {{ item.sku }}-->
</a-select-option> <!-- </a-select-option>-->
</a-select> <!-- </a-select>-->
</a-form-item> <!-- </a-form-item>-->
<a-form-item label="比例(%)" name="rate"> <a-form-item label="比例(%)" name="rate">
<a-input-number style="width: 200px" <a-input-number style="width: 200px"
allow-clear allow-clear
@@ -116,14 +116,6 @@ const updateVisible = (value: boolean) => {
// 表单验证规则 // 表单验证规则
const rules = reactive({ const rules = reactive({
goodsIncomeConfigName: [
{
required: true,
type: 'string',
message: '请填写分润配置名称',
trigger: 'blur'
}
]
}); });
const chooseShopType = (data: MerchantType) => { const chooseShopType = (data: MerchantType) => {
@@ -161,17 +153,17 @@ const save = () => {
.catch(() => { .catch(() => {
}); });
}; };
//
const goodsList = ref<Goods[]>([]); // const goodsList = ref<Goods[]>([]);
const getGoodsList = async () => { // const getGoodsList = async () => {
goodsList.value = await listGoods() // goodsList.value = await listGoods()
} // }
watch( watch(
() => props.visible, () => props.visible,
async (visible) => { async (visible) => {
if (visible) { if (visible) {
await getGoodsList() // await getGoodsList()
if (props.data) { if (props.data) {
assignObject(form, props.data); assignObject(form, props.data);
isUpdate.value = true; isUpdate.value = true;

View File

@@ -1,12 +1,12 @@
<!-- 搜索表单 --> <!-- 搜索表单 -->
<template> <template>
<a-space :size="10" style="flex-wrap: wrap"> <a-space :size="10" style="flex-wrap: wrap">
<a-button type="primary" class="ele-btn-icon" @click="add"> <!-- <a-button type="primary" class="ele-btn-icon" @click="add">-->
<template #icon> <!-- <template #icon>-->
<PlusOutlined /> <!-- <PlusOutlined />-->
</template> <!-- </template>-->
<span>添加</span> <!-- <span>添加</span>-->
</a-button> <!-- </a-button>-->
</a-space> </a-space>
</template> </template>

View File

@@ -31,13 +31,13 @@
<template v-if="column.key === 'action'"> <template v-if="column.key === 'action'">
<a-space> <a-space>
<a @click="openEdit(record)">修改</a> <a @click="openEdit(record)">修改</a>
<a-divider type="vertical" /> <!-- <a-divider type="vertical" />-->
<a-popconfirm <!-- <a-popconfirm-->
title="确定要删除此记录吗?" <!-- title="确定要删除此记录吗?"-->
@confirm="remove(record)" <!-- @confirm="remove(record)"-->
> <!-- >-->
<a class="ele-text-danger">删除</a> <!-- <a class="ele-text-danger">删除</a>-->
</a-popconfirm> <!-- </a-popconfirm>-->
</a-space> </a-space>
</template> </template>
</template> </template>
@@ -100,39 +100,39 @@
// 表格列配置 // 表格列配置
const columns = ref<ColumnItem[]>([ const columns = ref<ColumnItem[]>([
{ // {
title: '商品', // title: '商品',
dataIndex: ['goods', 'goodsName'], // dataIndex: ['goods', 'goodsName'],
key: 'goodsId', // key: 'goodsId',
align: 'center', // align: 'center',
}, // },
{ {
title: '店铺类型', title: '店铺类型',
dataIndex: 'merchantShopType', dataIndex: 'merchantShopType',
key: 'merchantShopType', key: 'merchantShopType',
align: 'center', align: 'center',
}, },
{ // {
title: 'SKU', // title: 'SKU',
dataIndex: ['goodsSku', 'sku'], // dataIndex: ['goodsSku', 'sku'],
key: 'spec', // key: 'spec',
align: 'center', // align: 'center',
}, // },
{ {
title: '比例(%)', title: '比例(%)',
dataIndex: 'rate', dataIndex: 'rate',
key: 'rate', key: 'rate',
align: 'center', align: 'center',
}, },
{ // {
title: '创建时间', // title: '创建时间',
dataIndex: 'createTime', // dataIndex: 'createTime',
key: 'createTime', // key: 'createTime',
align: 'center', // align: 'center',
sorter: true, // sorter: true,
ellipsis: true, // ellipsis: true,
customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd') // customRender: ({ text }) => toDateString(text, 'yyyy-MM-dd')
}, // },
{ {
title: '操作', title: '操作',
key: 'action', key: 'action',

View File

@@ -133,22 +133,31 @@
@del="onDeleteFiles" @del="onDeleteFiles"
/> />
</a-form-item> </a-form-item>
<a-form-item label="是否自营" name="ownStore"> <a-form-item label="轮播图" name="swiper">
<a-switch <SelectFile
checked-children="" :placeholder="`请选择图片`"
un-checked-children="" :limit="9"
:checked="form.ownStore === 1" :data="swiper"
@update:checked="updateOwnStore" @done="chooseSwiper"
/> @del="onDeleteSwiper"
</a-form-item>
<a-form-item label="是否推荐" name="recommend">
<a-switch
checked-children=""
un-checked-children=""
:checked="form.recommend === 1"
@update:checked="updateRecommend"
/> />
</a-form-item> </a-form-item>
<!-- <a-form-item label="是否自营" name="ownStore">-->
<!-- <a-switch-->
<!-- checked-children="是"-->
<!-- un-checked-children="否"-->
<!-- :checked="form.ownStore === 1"-->
<!-- @update:checked="updateOwnStore"-->
<!-- />-->
<!-- </a-form-item>-->
<!-- <a-form-item label="是否推荐" name="recommend">-->
<!-- <a-switch-->
<!-- checked-children="是"-->
<!-- un-checked-children="否"-->
<!-- :checked="form.recommend === 1"-->
<!-- @update:checked="updateRecommend"-->
<!-- />-->
<!-- </a-form-item>-->
<a-form-item label="是否在营业" name="recommend"> <a-form-item label="是否在营业" name="recommend">
<a-switch <a-switch
checked-children="" checked-children=""
@@ -157,14 +166,14 @@
@update:checked="updateIsOn" @update:checked="updateIsOn"
/> />
</a-form-item> </a-form-item>
<a-form-item label="是否需要审核" name="goodsReview"> <!-- <a-form-item label="是否需要审核" name="goodsReview">-->
<a-switch <!-- <a-switch-->
checked-children="" <!-- checked-children="是"-->
un-checked-children="" <!-- un-checked-children="否"-->
:checked="form.goodsReview === 1" <!-- :checked="form.goodsReview === 1"-->
@update:checked="updateGoodsReview" <!-- @update:checked="updateGoodsReview"-->
/> <!-- />-->
</a-form-item> <!-- </a-form-item>-->
<a-form-item label="状态" name="status"> <a-form-item label="状态" name="status">
<a-radio-group v-model:value="form.status"> <a-radio-group v-model:value="form.status">
<a-radio :value="0">显示</a-radio> <a-radio :value="0">显示</a-radio>
@@ -270,6 +279,7 @@ const form = reactive<Merchant>({
commission: 0, commission: 0,
keywords: undefined, keywords: undefined,
files: undefined, files: undefined,
swiper: undefined,
ownStore: undefined, ownStore: undefined,
recommend: undefined, recommend: undefined,
isOn: 1, isOn: 1,
@@ -456,6 +466,10 @@ const save = () => {
if (!timeRange.value || !timeRange.value.length) { if (!timeRange.value || !timeRange.value.length) {
return message.error('营业时间不能为空') return message.error('营业时间不能为空')
} }
if (!swiper.value.length) {
return message.error('轮播图不能为空')
}
const formData = { const formData = {
...form, ...form,
keywords: JSON.stringify(form.keywords), keywords: JSON.stringify(form.keywords),
@@ -463,6 +477,7 @@ const save = () => {
}; };
formData.startTime = timeRange.value[0]; formData.startTime = timeRange.value[0];
formData.endTime = timeRange.value[1]; formData.endTime = timeRange.value[1];
formData.swiper = JSON.stringify(swiper.value);
const saveOrUpdate = isUpdate.value ? updateMerchant : addMerchant; const saveOrUpdate = isUpdate.value ? updateMerchant : addMerchant;
saveOrUpdate(formData) saveOrUpdate(formData)
.then((msg) => { .then((msg) => {
@@ -487,6 +502,19 @@ const getMerchantCategoryList = async () => {
}); });
} }
const swiper = ref<ItemType[]>([]);
const chooseSwiper = (data: FileRecord) => {
swiper.value.push({
uid: data.id,
url: data.path,
status: 'done'
});
};
const onDeleteSwiper = (index: number) => {
swiper.value.splice(index, 1);
};
watch( watch(
() => props.visible, () => props.visible,
async (visible) => { async (visible) => {
@@ -494,6 +522,7 @@ watch(
await getMerchantCategoryList() await getMerchantCategoryList()
images.value = []; images.value = [];
files.value = []; files.value = [];
swiper.value = [];
merchantCategoryId.value = []; merchantCategoryId.value = [];
if (props.data) { if (props.data) {
isUpdate.value = true; isUpdate.value = true;
@@ -510,7 +539,7 @@ watch(
arr.map((item) => { arr.map((item) => {
files.value.push({ files.value.push({
uid: uuid(), uid: uuid(),
url: item.url, url: item,
status: 'done' status: 'done'
}); });
}); });
@@ -518,12 +547,18 @@ watch(
if (props.data.keywords) { if (props.data.keywords) {
form.keywords = JSON.parse(props.data.keywords); form.keywords = JSON.parse(props.data.keywords);
} }
if (props.data && props.data.merchantCategoryId) { if (props.data.swiper) {
swiper.value = JSON.parse(props.data.swiper);
}
if (props.data.merchantCategoryId) {
merchantCategoryList.value.forEach(item => { merchantCategoryList.value.forEach(item => {
const cate = item.children?.find(i => i.categoryId === props?.data?.merchantCategoryId) const cate = item.children?.find(i => i.categoryId === props?.data?.merchantCategoryId)
if (cate) merchantCategoryId.value.push(item?.categoryId, cate.categoryId) if (cate) merchantCategoryId.value.push(item?.categoryId, cate.categoryId)
}); });
} }
if (props.data.startTime && props.data.endTime) {
timeRange.value = [props.data.startTime, props.data.endTime];
}
} else { } else {
isUpdate.value = false; isUpdate.value = false;
} }