|
@@ -12,13 +12,17 @@ import { fetchGetDictDataList } from '@/service/api/system-manage';
|
|
|
import {
|
|
import {
|
|
|
// fetchGetAllChannelList,
|
|
// fetchGetAllChannelList,
|
|
|
fetchGetChannelList,
|
|
fetchGetChannelList,
|
|
|
|
|
+ fetchGetShopCategories,
|
|
|
fetchImportGoods,
|
|
fetchImportGoods,
|
|
|
fetchProductList,
|
|
fetchProductList,
|
|
|
|
|
+ fetchReset,
|
|
|
fetchSetUpChannels
|
|
fetchSetUpChannels
|
|
|
} from '@/service/api/goods-center/store-goods';
|
|
} from '@/service/api/goods-center/store-goods';
|
|
|
|
|
+import { useAuth } from '@/hooks/business/auth';
|
|
|
import { areAllItemsAllFieldsFilled } from '@/utils/zt';
|
|
import { areAllItemsAllFieldsFilled } from '@/utils/zt';
|
|
|
import { commonExport } from '@/utils/common';
|
|
import { commonExport } from '@/utils/common';
|
|
|
import { useTable } from '@/components/zt/Table/hooks/useTable';
|
|
import { useTable } from '@/components/zt/Table/hooks/useTable';
|
|
|
|
|
+import { useModalFrom } from '@/components/zt/ModalForm/hooks/useModalForm';
|
|
|
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';
|
|
|
// import { businessType } from '../../order-manage/normal-order/normal-order';
|
|
// import { businessType } from '../../order-manage/normal-order/normal-order';
|
|
@@ -27,6 +31,8 @@ const importTemplateRef = useTemplateRef('importTemplateRef');
|
|
|
const loading = ref(false);
|
|
const loading = ref(false);
|
|
|
|
|
|
|
|
const options = ref<Api.goods.Channel[]>([]);
|
|
const options = ref<Api.goods.Channel[]>([]);
|
|
|
|
|
+const typeOptions = ref([]);
|
|
|
|
|
+const loadingCategories = ref(false);
|
|
|
// const TypeName = ['企业用户', 'B端用户', 'C端用户'];
|
|
// const TypeName = ['企业用户', 'B端用户', 'C端用户'];
|
|
|
const statusList = ['商家下架', '上架', '违规下架', '平台审核'];
|
|
const statusList = ['商家下架', '上架', '违规下架', '平台审核'];
|
|
|
const businessType = ref<Record<string, string>>({});
|
|
const businessType = ref<Record<string, string>>({});
|
|
@@ -336,7 +342,10 @@ const [registerTable, { getTableCheckedRowKeys, refresh, getTableData, getSeachF
|
|
|
{
|
|
{
|
|
|
label: '关键词',
|
|
label: '关键词',
|
|
|
component: 'NInput',
|
|
component: 'NInput',
|
|
|
- field: 'keywords'
|
|
|
|
|
|
|
+ field: 'keywords',
|
|
|
|
|
+ componentProps: {
|
|
|
|
|
+ placeholder: '请输入商品名称/海博商品ID'
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
label: '业务类型',
|
|
label: '业务类型',
|
|
@@ -406,7 +415,7 @@ const [registerTable, { getTableCheckedRowKeys, refresh, getTableData, getSeachF
|
|
|
{
|
|
{
|
|
|
label: '海博商品ID',
|
|
label: '海博商品ID',
|
|
|
component: 'NInput',
|
|
component: 'NInput',
|
|
|
- field: 'hbSkuld'
|
|
|
|
|
|
|
+ field: 'hbSkuId'
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
label: '商品编码',
|
|
label: '商品编码',
|
|
@@ -456,6 +465,89 @@ const [registerModalFail, { openModal: openModalFail }] = useModal({
|
|
|
showFooter: false
|
|
showFooter: false
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
|
|
+const [
|
|
|
|
|
+ registerModalForm,
|
|
|
|
|
+ {
|
|
|
|
|
+ openModal: openModalForm,
|
|
|
|
|
+ setFieldsValue: setModalFormValue,
|
|
|
|
|
+ getFieldsValue: getModalFormValue,
|
|
|
|
|
+ closeModal: closeModalForm,
|
|
|
|
|
+ setSubLoading
|
|
|
|
|
+ }
|
|
|
|
|
+] = useModalFrom({
|
|
|
|
|
+ modalConfig: {
|
|
|
|
|
+ title: '重置渠道价格',
|
|
|
|
|
+ isShowHeaderText: false
|
|
|
|
|
+ },
|
|
|
|
|
+ formConfig: {
|
|
|
|
|
+ schemas: [
|
|
|
|
|
+ {
|
|
|
|
|
+ label: '门店名称',
|
|
|
|
|
+ component: 'ApiSelect',
|
|
|
|
|
+ field: 'shopId',
|
|
|
|
|
+ required: true,
|
|
|
|
|
+ componentProps: {
|
|
|
|
|
+ api: fetchGetStoreList,
|
|
|
|
|
+ resultFeild: 'data.list',
|
|
|
|
|
+ labelFeild: 'shopName',
|
|
|
|
|
+ valueFeild: 'shopId',
|
|
|
|
|
+ onUpdateValue: e => {
|
|
|
|
|
+ console.log(e, '门店名称');
|
|
|
|
|
+ if (e) {
|
|
|
|
|
+ getShopCategories(e);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ typeOptions.value = [];
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ field: 'categoryCodes',
|
|
|
|
|
+ label: '分类',
|
|
|
|
|
+ component: 'NInput',
|
|
|
|
|
+ required: true,
|
|
|
|
|
+ render({ model }) {
|
|
|
|
|
+ return (
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <NSelect
|
|
|
|
|
+ v-model:value={model.categoryCodes}
|
|
|
|
|
+ class={'w-400px'}
|
|
|
|
|
+ multiple
|
|
|
|
|
+ loading={loadingCategories.value}
|
|
|
|
|
+ label-field="name"
|
|
|
|
|
+ value-field="code"
|
|
|
|
|
+ placeholder="请先选择门店再选择分类"
|
|
|
|
|
+ options={typeOptions.value}
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ );
|
|
|
|
|
+ },
|
|
|
|
|
+ ifShow({ model }) {
|
|
|
|
|
+ return model.shopId;
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ field: 'channelId',
|
|
|
|
|
+ component: 'ApiSelect',
|
|
|
|
|
+ label: '渠道',
|
|
|
|
|
+ componentProps: {
|
|
|
|
|
+ api: fetchGetChannelList,
|
|
|
|
|
+ labelField: 'channelName',
|
|
|
|
|
+ valueField: 'id',
|
|
|
|
|
+ clearable: true
|
|
|
|
|
+ },
|
|
|
|
|
+ required: true
|
|
|
|
|
+ }
|
|
|
|
|
+ ],
|
|
|
|
|
+ labelWidth: 120,
|
|
|
|
|
+ layout: 'horizontal',
|
|
|
|
|
+ gridProps: {
|
|
|
|
|
+ cols: '1',
|
|
|
|
|
+ itemResponsive: true
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+});
|
|
|
|
|
+
|
|
|
const isDisabledExport = computed(() => {
|
|
const isDisabledExport = computed(() => {
|
|
|
return !getTableCheckedRowKeys().length;
|
|
return !getTableCheckedRowKeys().length;
|
|
|
});
|
|
});
|
|
@@ -550,10 +642,10 @@ function handleDelPrice(index: number) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async function handleSubmitPrice() {
|
|
async function handleSubmitPrice() {
|
|
|
- if (!PriceData.value.length) {
|
|
|
|
|
- window.$message?.error('最少填写一条数据');
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // if (!PriceData.value.length) {
|
|
|
|
|
+ // window.$message?.error('最少填写一条数据');
|
|
|
|
|
+ // return;
|
|
|
|
|
+ // }
|
|
|
if (!areAllItemsAllFieldsFilled(PriceData.value)) {
|
|
if (!areAllItemsAllFieldsFilled(PriceData.value)) {
|
|
|
window.$message?.error('请填写完整数据');
|
|
window.$message?.error('请填写完整数据');
|
|
|
return;
|
|
return;
|
|
@@ -583,7 +675,6 @@ async function handleSubmitPrice() {
|
|
|
} else {
|
|
} else {
|
|
|
setSubModalLoding(false);
|
|
setSubModalLoding(false);
|
|
|
}
|
|
}
|
|
|
- console.log(PriceData.value, 'asdsad');
|
|
|
|
|
}
|
|
}
|
|
|
async function getData() {
|
|
async function getData() {
|
|
|
const { data, error } = await fetchGetChannelList();
|
|
const { data, error } = await fetchGetChannelList();
|
|
@@ -592,6 +683,18 @@ async function getData() {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
getData();
|
|
getData();
|
|
|
|
|
+
|
|
|
|
|
+async function getShopCategories(shopId: any) {
|
|
|
|
|
+ loadingCategories.value = true;
|
|
|
|
|
+ const { data, error } = await fetchGetShopCategories({ shopId });
|
|
|
|
|
+ const categoryCodes = data.map((item: any) => item.code);
|
|
|
|
|
+ setModalFormValue({ categoryCodes });
|
|
|
|
|
+ loadingCategories.value = false;
|
|
|
|
|
+ if (!error) {
|
|
|
|
|
+ typeOptions.value = data;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
async function handleExport() {
|
|
async function handleExport() {
|
|
|
setTableLoading(true);
|
|
setTableLoading(true);
|
|
|
try {
|
|
try {
|
|
@@ -600,6 +703,18 @@ async function handleExport() {
|
|
|
setTableLoading(false);
|
|
setTableLoading(false);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+async function handleSubmit() {
|
|
|
|
|
+ const form = await getModalFormValue();
|
|
|
|
|
+ console.log(form, '表单');
|
|
|
|
|
+ const { error } = await fetchReset(form);
|
|
|
|
|
+ if (!error) {
|
|
|
|
|
+ window.$message?.success('保存成功');
|
|
|
|
|
+ }
|
|
|
|
|
+ setSubLoading(false);
|
|
|
|
|
+ closeModalForm();
|
|
|
|
|
+ refresh();
|
|
|
|
|
+}
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
<template>
|
|
@@ -612,6 +727,9 @@ async function handleExport() {
|
|
|
</template>
|
|
</template>
|
|
|
<template #prefix="{ loading }">
|
|
<template #prefix="{ loading }">
|
|
|
<NSpace>
|
|
<NSpace>
|
|
|
|
|
+ <NButton v-if="useAuth().hasAuth('goods:reset-btn')" size="small" @click="openModalForm">
|
|
|
|
|
+ 渠道价格重置
|
|
|
|
|
+ </NButton>
|
|
|
<NButton size="small" @click="openImportLogModal">导入记录</NButton>
|
|
<NButton size="small" @click="openImportLogModal">导入记录</NButton>
|
|
|
<NButton size="small" @click="openImportModal">导入商品销售渠道及价格</NButton>
|
|
<NButton size="small" @click="openImportModal">导入商品销售渠道及价格</NButton>
|
|
|
<NButton size="small" :disabled="tableData.length == 0" :loading="loading" @click="handleExport">
|
|
<NButton size="small" :disabled="tableData.length == 0" :loading="loading" @click="handleExport">
|
|
@@ -642,6 +760,8 @@ async function handleExport() {
|
|
|
@register="registerLogTable"
|
|
@register="registerLogTable"
|
|
|
></ZTable>
|
|
></ZTable>
|
|
|
</BasicModal>
|
|
</BasicModal>
|
|
|
|
|
+
|
|
|
|
|
+ <BasicModelForm @register-modal-form="registerModalForm" @submit-form="handleSubmit"></BasicModelForm>
|
|
|
</LayoutTable>
|
|
</LayoutTable>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|