diff --git a/src/api/regionalSpotManage/index.ts b/src/api/regionalSpotManage/index.ts index 46bf1a81809c943141c9f6b167cc0614434da471..700659871229450fb1da01c591e2aebbeec8e1a7 100644 --- a/src/api/regionalSpotManage/index.ts +++ b/src/api/regionalSpotManage/index.ts @@ -1,4 +1,5 @@ import { tmallabHttp } from '/@/utils/http/axios'; +import { SearchFormType, ListTpyes, UploadTaskType } from '/@/views/regionalSpotManage/types'; enum Api { GetStatus = '/system/opsProduct/IsOpsSupplier', List = '/system/opsProduct/getList', @@ -17,6 +18,14 @@ enum Api { PlatformProBatchGetDetail = '/system/logNegotiationProductOperate/getDetail', } +type ResponseData = { + code: number; + message: string; + data: T; + success: boolean; + time: string; +}; + /** * @description: 区域现货管理列表 */ @@ -25,8 +34,11 @@ export const regionalSpotManageGetStatusApi = () => tmallabHttp.post({ url: Api. /** * @description: 区域现货管理列表 */ -export const regionalSpotManageListApi = (data) => - tmallabHttp.post({ url: Api.List, data }, { errorMessageMode: 'message' }); +export const regionalSpotManageListApi = (data: SearchFormType) => + tmallabHttp.post>( + { url: Api.List, data }, + { errorMessageMode: 'message' }, + ); /** * @description: 获取品牌列表 @@ -93,7 +105,8 @@ export const regionalSpotManageUploadOpsProductApi = (data, file) => /** * @description: 任务中心获取列表 */ -export const taskCenterQueryListApi = (data) => tmallabHttp.post({ url: Api.QueryList, data }); +export const taskCenterQueryListApi = (data: { type: number }) => + tmallabHttp.post>({ url: Api.QueryList, data }); /** * @description: 撤销 diff --git a/src/views/regionalSpotManage/components/list.vue b/src/views/regionalSpotManage/components/list.vue index d62e17c73e5395ae6e669f59f0523f4a2452d2f5..fbb63ec8127689b94bfa5c1ffc696dcebeb2cb0c 100644 --- a/src/views/regionalSpotManage/components/list.vue +++ b/src/views/regionalSpotManage/components/list.vue @@ -25,40 +25,32 @@ regionalSpotManageUploadOpsProductApi, } from '/@/api/regionalSpotManage'; import addProductModal from './addProduct.vue'; + import type { ListTpyes, AreaIds, BrandTypes } from '../types'; const config = import.meta.env; const userInfo: any = getAuthCache('USER__INFO__'); const ghsCode = userInfo.supplier.ghsCode; const ghsName = userInfo.supplier.ghsName; const router = useRouter(); - const list = ref([]); + const list = ref([]); onMounted(async () => { getList(); getAllAreaList(); getGroupOption(); }); const searchForm = ref<{ - brands: any; - goodsNo: any; - areaIds: any; - types: any; + brands: string[]; + goodsNo: string; + areaIds: number[]; + types: string[]; }>({ brands: [], goodsNo: '', areaIds: [], types: [], }); - interface AreaIds { - city?: string; - cityId?: number; - creationTime?: string; - creator?: string; - id?: number; - province?: string; - provinceId?: number; - } const areaIdsOption = ref([]); - const typesOption = ref([]); - const searchBrandList = ref([]); + const typesOption = ref([]); + const searchBrandList = ref([]); const handleSearch = async (value) => { const res = await regionalSpotManageBrandListApi({ brand: value }); if (res.success) { @@ -77,19 +69,16 @@ showQuickJumper: true, showSizeChanger: true, pageSizeOptions: ['10', '20', '30', '50', '100'], - onChange: (current) => { + onChange: (current, size) => { pagination.value.current = current; - getList(); - }, - onShowSizeChange: (size) => { pagination.value.pageSize = size; getList(); }, }); const getList = async () => { const pager = ref({ - pageIndex: 1, - pageSize: 10, + pageIndex: pagination.value.current, + pageSize: pagination.value.pageSize, }); const param = ref({ ...searchForm.value, @@ -101,7 +90,7 @@ const res = await regionalSpotManageListApi(param.value); if (res.success) { list.value = res.data; - pagination.value.total = res.data[0].total; + pagination.value.total = res.data[0].total as number; } else { list.value = []; pagination.value.total = 0; @@ -132,7 +121,7 @@ } }; - const curItem = ref<{ [key: string]: any }>({}); + const curItem = ref({}); // =========查看区域现货 statr =========== const loading1 = ref(false); @@ -167,7 +156,7 @@ // ==========查看区域现货 end ============= const selectedRowKeys = ref([]); - const selectedRows = ref([]); + const selectedRows = ref([]); const onSelectChange = (Keys, Rows) => { selectedRowKeys.value = Keys; selectedRows.value = Rows; @@ -195,7 +184,7 @@ const curArr = delAreaList.value.map((it) => it.cityCode); for (const k of allAreaList.value) { if (curArr.includes(k.cityId)) { - addCheckboxValue.value.push(k.cityId); + addCheckboxValue.value.push(k.cityId as number); k.disabled = true; } } @@ -235,7 +224,7 @@ const delLoading = ref(false); const deleteNum = ref(0); const radioValue = ref(1); - const delAreaList = ref([]); //已添加的区域 + const delAreaList = ref([]); //已添加的区域 const delCheckboxValue = ref([]); const del = async (val) => { curItem.value = val; @@ -336,7 +325,7 @@ }; // ================区域现货商品删除 end===================== - const allAreaList = ref([]); + const allAreaList = ref([]); const getAllAreaList = async () => { const res = await regionalSpotManageGetAreaListApi({}); if (res.success) { @@ -357,7 +346,7 @@ // =====================批量导入 start======================= const productExcelList = ref([]); const importVisible = ref(false); - const impotrCheckboxValue = ref([]); + const impotrCheckboxValue = ref([]); const batchImport = () => { importVisible.value = true; allAreaList.value.forEach((v) => { @@ -445,12 +434,12 @@ v-model:value="searchForm.brands" show-search mode="multiple" - placeholder="请输入品牌名称" + placeholder="请输入搜索品牌名称" style="width: 100%" :default-active-first-option="false" :show-arrow="false" :filter-option="false" - :not-found-content="null" + not-found-content="暂无数据" :maxTagCount="1" @search="handleSearch" > diff --git a/src/views/regionalSpotManage/components/platformProBatch.vue b/src/views/regionalSpotManage/components/platformProBatch.vue index af8b991a5112beb70201fbca586520e6b3632c39..219be2c21bfbd3538c38721cfaefd04bd851a8b0 100644 --- a/src/views/regionalSpotManage/components/platformProBatch.vue +++ b/src/views/regionalSpotManage/components/platformProBatch.vue @@ -19,11 +19,8 @@ showQuickJumper: true, showSizeChanger: true, pageSizeOptions: ['10', '20', '30', '50', '100'], - onChange: (current) => { + onChange: (current, size) => { pagination.value.current = current; - getList(); - }, - onShowSizeChange: (size) => { pagination.value.pageSize = size; getList(); }, diff --git a/src/views/regionalSpotManage/components/upLoadTask.vue b/src/views/regionalSpotManage/components/upLoadTask.vue index 4873e2380972d247d246752eb1c565e9c1951fd4..b701e7fa745d5d2296616b5d7ac4409f55d4ae8c 100644 --- a/src/views/regionalSpotManage/components/upLoadTask.vue +++ b/src/views/regionalSpotManage/components/upLoadTask.vue @@ -6,11 +6,12 @@ taskCenterQueryListApi, taskCenterRevokeExcelUploadApi, } from '/@/api/regionalSpotManage'; + import { UploadTaskType } from '../types'; onMounted(async () => { getList(); }); - let list = ref([]); - let listLoading = ref(false); + const list = ref([]); + const listLoading = ref(false); const downLoad = (url) => { window.open(config.VITE_GLOB_TMALLAB_URL + '/system/excelFile/' + url, '_blank'); }; diff --git a/src/views/regionalSpotManage/types.ts b/src/views/regionalSpotManage/types.ts new file mode 100644 index 0000000000000000000000000000000000000000..52fb24bc1dbdfb9b38374c6b482ca1a95043024e --- /dev/null +++ b/src/views/regionalSpotManage/types.ts @@ -0,0 +1,59 @@ +export interface SearchFormType { + areaIds?: number[]; + brands?: string[]; + goodsNo?: string; + pageIndex?: number; + pageSize?: number; + types?: string[]; +} + +export interface ListTpyes { + brand?: string; + goodsNo?: string; + productName?: string; + productStatus?: boolean; + spec?: string; + total?: number; +} + +export interface AreaIds { + city?: string; + cityId?: number; + creationTime?: string; + creator?: string; + id?: number; + province?: string; + provinceId?: number; + cityCode?: number; + provinceName?: string; + cityName?: string; + disabled?: boolean; +} + +export interface BrandTypes { + agentLevel: string; + applierName: string; + brand: string; + brandPass: boolean; + brandQualification: string; + count: number | null; + createTime: string; + expirationDate: string; + salePlat: number; +} + +export interface UploadTaskType { + createName: string; + createTime: string; + failNum: number; + fileUrl: string; + isRevoke: boolean; + productNum: number; + revokeTime: string | null; + revokeUsername: string | null; + status: number; + successNum: number; + supplierCode: string; + supplierFileName: string; + type: string; +}