|
@@ -14,10 +14,11 @@ import { commonExport } from '@/utils/common';
|
|
|
import { useTable } from '@/components/zt/Table/hooks/useTable';
|
|
import { useTable } from '@/components/zt/Table/hooks/useTable';
|
|
|
import SvgIcon from '@/components/custom/svg-icon.vue';
|
|
import SvgIcon from '@/components/custom/svg-icon.vue';
|
|
|
import { useModal } from '@/components/zt/Modal/hooks/useModal';
|
|
import { useModal } from '@/components/zt/Modal/hooks/useModal';
|
|
|
-type Price = { channelId: number | undefined; channelProdPrice: number; id: number };
|
|
|
|
|
|
|
+type Price = { channelId: number | undefined; price: number; id: number };
|
|
|
const importTemplateRef = useTemplateRef('importTemplateRef');
|
|
const importTemplateRef = useTemplateRef('importTemplateRef');
|
|
|
const options = ref<Api.goods.Channel[]>([]);
|
|
const options = ref<Api.goods.Channel[]>([]);
|
|
|
const TypeName = ['企业用户', 'B端用户', 'C端用户'];
|
|
const TypeName = ['企业用户', 'B端用户', 'C端用户'];
|
|
|
|
|
+const statusList = ['商家下架', '上架', '违规下架', '平台审核'];
|
|
|
|
|
|
|
|
const columns: NaiveUI.TableColumn<Api.goods.ShopSku>[] = [
|
|
const columns: NaiveUI.TableColumn<Api.goods.ShopSku>[] = [
|
|
|
{
|
|
{
|
|
@@ -73,42 +74,62 @@ const columns: NaiveUI.TableColumn<Api.goods.ShopSku>[] = [
|
|
|
align: 'center',
|
|
align: 'center',
|
|
|
width: 120
|
|
width: 120
|
|
|
},
|
|
},
|
|
|
- {
|
|
|
|
|
- key: 'purchasePrice',
|
|
|
|
|
- title: '进货价(元)',
|
|
|
|
|
- align: 'center',
|
|
|
|
|
- width: 120,
|
|
|
|
|
- render: row => {
|
|
|
|
|
- if (!row.channelProdList?.length) return '--';
|
|
|
|
|
- if (row.channelProdList) return <div>{row.channelProdList[0].purchasePrice || '--'}</div>;
|
|
|
|
|
- return '--';
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- {
|
|
|
|
|
- key: 'deliveryPrice',
|
|
|
|
|
- title: '出货价/控制价(元)',
|
|
|
|
|
- align: 'center',
|
|
|
|
|
- width: 150,
|
|
|
|
|
- render: row => {
|
|
|
|
|
- if (!row.channelProdList?.length) return '--';
|
|
|
|
|
- if (row.channelProdList) return <div>{row.channelProdList[0].deliveryPrice || '--'}</div>;
|
|
|
|
|
- return '--';
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ // {
|
|
|
|
|
+ // key: 'purchasePrice',
|
|
|
|
|
+ // title: '进货价(元)',
|
|
|
|
|
+ // align: 'center',
|
|
|
|
|
+ // width: 120,
|
|
|
|
|
+ // render: row => {
|
|
|
|
|
+ // if (!row.channelVOS?.length) return '--';
|
|
|
|
|
+ // if (row.channelVOS) return <div>{row.channelVOS[0].purchasePrice || '--'}</div>;
|
|
|
|
|
+ // return '--';
|
|
|
|
|
+ // }
|
|
|
|
|
+ // },
|
|
|
|
|
+ // {
|
|
|
|
|
+ // key: 'deliveryPrice',
|
|
|
|
|
+ // title: '出货价/控制价(元)',
|
|
|
|
|
+ // align: 'center',
|
|
|
|
|
+ // width: 150,
|
|
|
|
|
+ // render: row => {
|
|
|
|
|
+ // if (!row.channelVOS?.length) return '--';
|
|
|
|
|
+ // if (row.channelVOS) return <div>{row.channelVOS[0].deliveryPrice || '--'}</div>;
|
|
|
|
|
+ // return '--';
|
|
|
|
|
+ // }
|
|
|
|
|
+ // },
|
|
|
{
|
|
{
|
|
|
key: 'name',
|
|
key: 'name',
|
|
|
title: '销售渠道及价格',
|
|
title: '销售渠道及价格',
|
|
|
align: 'center',
|
|
align: 'center',
|
|
|
width: 250,
|
|
width: 250,
|
|
|
render: row => {
|
|
render: row => {
|
|
|
- return row.channelProdList?.map(it => {
|
|
|
|
|
|
|
+ return row.channelVOS?.map((it: any) => {
|
|
|
return (
|
|
return (
|
|
|
<div>
|
|
<div>
|
|
|
- {TypeName[Number(it.channelId) - 1]} ({it.channelName || '--'}) : {it.channelProdPrice || '--'}
|
|
|
|
|
|
|
+ {TypeName[Number(it.channelId) - 1]} ({it.channelName || '--'}) : {it.price || '--'}
|
|
|
</div>
|
|
</div>
|
|
|
);
|
|
);
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ key: 'status',
|
|
|
|
|
+ title: '状态',
|
|
|
|
|
+ align: 'center',
|
|
|
|
|
+ width: 120,
|
|
|
|
|
+ render: (row: any) => {
|
|
|
|
|
+ return (
|
|
|
|
|
+ <div class="flex items-center justify-center">
|
|
|
|
|
+ <n-badge color={row.status == 1 ? 'green' : 'red'} value={row.status} dot />
|
|
|
|
|
+ <span class="ml-2">{statusList[row.status]}</span>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ key: 'updateTime',
|
|
|
|
|
+ title: '更新时间',
|
|
|
|
|
+ align: 'center',
|
|
|
|
|
+ width: 120
|
|
|
}
|
|
}
|
|
|
];
|
|
];
|
|
|
const PriceColumns: NaiveUI.TableColumn<Price>[] = [
|
|
const PriceColumns: NaiveUI.TableColumn<Price>[] = [
|
|
@@ -153,16 +174,16 @@ const PriceColumns: NaiveUI.TableColumn<Price>[] = [
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
title: '售价(元)',
|
|
title: '售价(元)',
|
|
|
- key: 'channelProdPrice',
|
|
|
|
|
|
|
+ key: 'price',
|
|
|
align: 'center',
|
|
align: 'center',
|
|
|
width: 250,
|
|
width: 250,
|
|
|
render: row => {
|
|
render: row => {
|
|
|
return (
|
|
return (
|
|
|
<NInputNumber
|
|
<NInputNumber
|
|
|
- value={row.channelProdPrice}
|
|
|
|
|
|
|
+ value={row.price}
|
|
|
precision={2}
|
|
precision={2}
|
|
|
onUpdate:value={value => {
|
|
onUpdate:value={value => {
|
|
|
- row.channelProdPrice = Number(value);
|
|
|
|
|
|
|
+ row.price = Number(value);
|
|
|
}}
|
|
}}
|
|
|
min={0}
|
|
min={0}
|
|
|
/>
|
|
/>
|
|
@@ -186,7 +207,7 @@ const PriceColumns: NaiveUI.TableColumn<Price>[] = [
|
|
|
align: 'center',
|
|
align: 'center',
|
|
|
render: row => {
|
|
render: row => {
|
|
|
return (
|
|
return (
|
|
|
- <div onClick={() => handleDelPrice(row.id)} class={'w-full flex items-center justify-center'}>
|
|
|
|
|
|
|
+ <div onClick={() => handleDelPrice(row.channelId as number)} class={'w-full flex items-center justify-center'}>
|
|
|
<SvgIcon
|
|
<SvgIcon
|
|
|
icon={'proicons:subtract-square'}
|
|
icon={'proicons:subtract-square'}
|
|
|
class={'cursor-pointer text-24px'}
|
|
class={'cursor-pointer text-24px'}
|
|
@@ -216,6 +237,69 @@ const [registerTable, { getTableCheckedRowKeys, refresh, getTableData, getSeachF
|
|
|
label: '商品名称',
|
|
label: '商品名称',
|
|
|
component: 'NInput',
|
|
component: 'NInput',
|
|
|
field: 'skuName'
|
|
field: 'skuName'
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '关键词',
|
|
|
|
|
+ component: 'NInput',
|
|
|
|
|
+ field: 'keywords',
|
|
|
|
|
+ componentProps: {
|
|
|
|
|
+ placeholder: '请输入商品名称/海博商品ID'
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '状态',
|
|
|
|
|
+ field: 'status',
|
|
|
|
|
+ component: 'NSelect',
|
|
|
|
|
+ componentProps: {
|
|
|
|
|
+ options: [
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '商家下架',
|
|
|
|
|
+ value: 0
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '上架',
|
|
|
|
|
+ value: 1
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '违规下架',
|
|
|
|
|
+ value: 2
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '平台审核',
|
|
|
|
|
+ value: 3
|
|
|
|
|
+ }
|
|
|
|
|
+ ]
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '更新时间',
|
|
|
|
|
+ component: 'NDatePicker',
|
|
|
|
|
+ field: 'createTime',
|
|
|
|
|
+ componentProps: {
|
|
|
|
|
+ type: 'datetimerange',
|
|
|
|
|
+ defaultTime: ['00:00:00', '23:59:59']
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '价格范围',
|
|
|
|
|
+ component: 'NInput',
|
|
|
|
|
+ field: 'price',
|
|
|
|
|
+ componentProps: {
|
|
|
|
|
+ separator: '-',
|
|
|
|
|
+ pair: true,
|
|
|
|
|
+ placeholder: ['最低价', '最高价'],
|
|
|
|
|
+ allowInput: (value: string) => !value || /^\d+$/.test(value)
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '海博商品ID',
|
|
|
|
|
+ component: 'NInput',
|
|
|
|
|
+ field: 'hbSkuId'
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '商品编码',
|
|
|
|
|
+ component: 'NInput',
|
|
|
|
|
+ field: 'skuCode'
|
|
|
}
|
|
}
|
|
|
],
|
|
],
|
|
|
inline: false,
|
|
inline: false,
|
|
@@ -227,7 +311,11 @@ const [registerTable, { getTableCheckedRowKeys, refresh, getTableData, getSeachF
|
|
|
keyField: 'id',
|
|
keyField: 'id',
|
|
|
title: '商品列表',
|
|
title: '商品列表',
|
|
|
showAddButton: false,
|
|
showAddButton: false,
|
|
|
- scrollX: 1800
|
|
|
|
|
|
|
+ scrollX: 1800,
|
|
|
|
|
+ fieldMapToTime: [
|
|
|
|
|
+ ['price', ['minPrice', 'maxPrice']],
|
|
|
|
|
+ ['createTime', ['startTime', 'endTime']]
|
|
|
|
|
+ ]
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
|
|
@@ -260,8 +348,8 @@ function openImportModal() {
|
|
|
function handleModalPrice(row: Api.goods.ShopSku) {
|
|
function handleModalPrice(row: Api.goods.ShopSku) {
|
|
|
selectData.value = row;
|
|
selectData.value = row;
|
|
|
|
|
|
|
|
- if (row.channelProdList) {
|
|
|
|
|
- PriceData.value = row.channelProdList?.map(it => {
|
|
|
|
|
|
|
+ if (row.channelVOS) {
|
|
|
|
|
+ PriceData.value = row.channelVOS?.map((it: any) => {
|
|
|
options.value.map(its => {
|
|
options.value.map(its => {
|
|
|
if (its.id == it.channelId) {
|
|
if (its.id == it.channelId) {
|
|
|
its.disabled = true;
|
|
its.disabled = true;
|
|
@@ -271,7 +359,7 @@ function handleModalPrice(row: Api.goods.ShopSku) {
|
|
|
|
|
|
|
|
return {
|
|
return {
|
|
|
channelId: Number(it.channelId),
|
|
channelId: Number(it.channelId),
|
|
|
- channelProdPrice: Number(it.channelProdPrice),
|
|
|
|
|
|
|
+ price: Number(it.price),
|
|
|
id: Number(it.id)
|
|
id: Number(it.id)
|
|
|
};
|
|
};
|
|
|
});
|
|
});
|
|
@@ -285,18 +373,20 @@ function handleAddPrice() {
|
|
|
}
|
|
}
|
|
|
PriceData.value.push({
|
|
PriceData.value.push({
|
|
|
channelId: undefined,
|
|
channelId: undefined,
|
|
|
- channelProdPrice: 1,
|
|
|
|
|
|
|
+ price: 1,
|
|
|
id: dayjs().valueOf()
|
|
id: dayjs().valueOf()
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
function handleDelPrice(id: number) {
|
|
function handleDelPrice(id: number) {
|
|
|
- PriceData.value = PriceData.value.filter(item => item.id != id);
|
|
|
|
|
|
|
+ console.log(id);
|
|
|
|
|
+
|
|
|
|
|
+ PriceData.value = PriceData.value.filter(item => item.channelId != id);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async function handleSubmitPrice() {
|
|
async function handleSubmitPrice() {
|
|
|
if (!PriceData.value.length) {
|
|
if (!PriceData.value.length) {
|
|
|
- window.$message?.error('最少填写一条数据');
|
|
|
|
|
- return;
|
|
|
|
|
|
|
+ // window.$message?.error('最少填写一条数据');
|
|
|
|
|
+ // return;
|
|
|
}
|
|
}
|
|
|
if (!areAllItemsAllFieldsFilled(PriceData.value)) {
|
|
if (!areAllItemsAllFieldsFilled(PriceData.value)) {
|
|
|
window.$message?.error('请填写完整数据');
|
|
window.$message?.error('请填写完整数据');
|
|
@@ -306,12 +396,12 @@ async function handleSubmitPrice() {
|
|
|
const form = {
|
|
const form = {
|
|
|
shopId: selectData.value?.shopId,
|
|
shopId: selectData.value?.shopId,
|
|
|
skuId: selectData.value?.skuId,
|
|
skuId: selectData.value?.skuId,
|
|
|
- purchasePrice: selectData.value?.channelProdList?.length ? selectData.value.channelProdList[0].purchasePrice : null,
|
|
|
|
|
- deliveryPrice: selectData.value?.channelProdList?.length ? selectData.value.channelProdList[0].deliveryPrice : null,
|
|
|
|
|
|
|
+ purchasePrice: selectData.value?.channelVOS?.length ? selectData.value.channelVOS[0].purchasePrice : null,
|
|
|
|
|
+ deliveryPrice: selectData.value?.channelVOS?.length ? selectData.value.channelVOS[0].deliveryPrice : null,
|
|
|
setChannelPriceDtoList: PriceData.value.map(item => {
|
|
setChannelPriceDtoList: PriceData.value.map(item => {
|
|
|
return {
|
|
return {
|
|
|
channelId: item.channelId,
|
|
channelId: item.channelId,
|
|
|
- channelProdPrice: item.channelProdPrice
|
|
|
|
|
|
|
+ channelProdPrice: item.price
|
|
|
};
|
|
};
|
|
|
})
|
|
})
|
|
|
};
|
|
};
|