diff --git a/src/api/index.js b/src/api/index.js index a23a371..40e08eb 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -11,4 +11,5 @@ export { adminApi } from './modules/admin' export { invitationApi } from './modules/invitation' export { depotApi } from './modules/depot' export { userApi } from './modules/user' -export { userLoginApi } from './modules/userLogin' \ No newline at end of file +export { userLoginApi } from './modules/userLogin' +export { priceTemplateApi } from './modules/priceTemplate' \ No newline at end of file diff --git a/src/api/modules/district.js b/src/api/modules/district.js index 5abf902..b42fe47 100644 --- a/src/api/modules/district.js +++ b/src/api/modules/district.js @@ -1,73 +1,23 @@ -import request from '@/utils/axios' +import instance from '../../utils/axios.js' /** - * 获取所有省级数据 + * 地区管理相关接口 */ -export function getProvinces() { - return request({ - url: '/district/provinces', - method: 'get' - }) -} -/** - * 根据省份ID获取城市列表 - */ -export function getCitiesByProvinceId(provinceId) { - return request({ - url: `/district/cities/${provinceId}`, - method: 'get' - }) -} +// 获取省份列表 +export const getProvinces = () => { + return instance.get('/district/provinces'); +}; -/** - * 根据城市ID获取区县列表 - */ -export function getDistrictsByCityId(cityId) { - return request({ - url: `/district/districts/${cityId}`, - method: 'get' - }) -} +// 获取运费信息 +export const getFreInfo = (templateId) => { + return instance.get(`/district/freInfo/${templateId}`); +}; -/** - * 获取省级市级树形结构 - */ -export function getDistrictTree() { - return request({ - url: '/district/getDistrictTree', - method: 'get' - }) -} +// 为了向后兼容,也导出整个对象 +export const districtApi = { + getProvinces, + getFreInfo +}; -/** - * 新增物流模板 - */ -export function createTemplate(data) { - return request({ - url: '/logistics/logistics', - method: 'post', - data: data - }) -} - -/** - * 获取运费信息 - */ -export function getFreInfo(id) { - return request({ - url: '/logistics/logistics/' + id, - method: 'get' - }) -} - -/** - * 更新物流模板 - */ -export function UpdateTemplate(data) { - return request({ - url: '/logistics/logistics', - method: 'put', - data: data - }) -} +export default districtApi; \ No newline at end of file diff --git a/src/layout/Sidebar.vue b/src/layout/Sidebar.vue index 6471567..312709e 100644 --- a/src/layout/Sidebar.vue +++ b/src/layout/Sidebar.vue @@ -75,6 +75,10 @@ const menuData = shallowRef([ title: '店铺列表', path: '/shop/list', permission: 'shop:list:view' + }, + { + title: '价格模板', + path: '/shop/priceTemplate' } ] }, @@ -87,6 +91,11 @@ const menuData = shallowRef([ title: '选品中心', path: '/book/selection/center', permission: 'book:selection:view' + }, + { + title: '自营书品', + path: '/book/shopGoods', + // permission: 'book:shopGoods:view' } ] }, diff --git a/src/router/index.js b/src/router/index.js index 6717821..ec83542 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -113,6 +113,18 @@ const routes = [{ // meta: { title: '物流模板', permission: 'logistics:view' } meta: { title: '物流模板' } + }, + { + path: '/shop/priceTemplate', + component: () => import('@/views/PriceTemplate/index.vue'), + // meta: { title: '价格模板', permission: 'priceTemplate:list:view' } + meta: { title: '价格模板' } + }, + { + path: '/book/shopGoods', + component: () => import('@/views/shopGoods/index.vue'), + // meta: { title: '自营书品', permission: 'book:shopGoods:view' } + meta: { title: '自营书品'} } ] diff --git a/src/views/Task/List.vue b/src/views/Task/List.vue index a252c84..42fe939 100644 --- a/src/views/Task/List.vue +++ b/src/views/Task/List.vue @@ -15,7 +15,7 @@ - 搜索 + 搜索 重置 @@ -119,12 +119,30 @@ - - - - {{ item.label }} - - + +
+ +
+ 孔夫子店铺: + + + {{ item.label }} + + +
+ + +
+ 拼多多店铺: + + + {{ item.label }} + + +
+
@@ -420,11 +438,31 @@ const getShopListData = async () => { const data = response.data; if (data && Array.isArray(data) && data.length > 0) { - // 将店铺数据转换为复选框需要的格式 - shopList.value = data.map(shop => ({ - value: shop.id, - label: shop.shopName || shop.name - })); + // 根据 shop_type 分类店铺数据 + const kfzShops = []; // 孔夫子店铺 (shop_type = 2) + const pddShops = []; // 拼多多店铺 (shop_type = 1) + + data.forEach(shop => { + const shopItem = { + value: shop.id, + label: shop.shopName || shop.name, + shopType: shop.shopType + }; + + // 注意:API返回的shopType是字符串类型 + if (shop.shopType === '2') { + kfzShops.push(shopItem); + } else if (shop.shopType === '1') { + pddShops.push(shopItem); + } + }); + + // 设置分类后的店铺数据 + shopList.value = { + kfzShops, + pddShops + }; + console.log('设置后的 shopList:', shopList.value); } } catch (error) { @@ -568,7 +606,7 @@ const handleAdd = async () => { } // 加载店铺数据 - if (shopList.value.length === 0) { + if (!shopList.value.kfzShops && !shopList.value.pddShops) { await getShopListData(); } diff --git a/src/views/redirectUrl/index.vue b/src/views/redirectUrl/index.vue index 955d926..0121cbe 100644 --- a/src/views/redirectUrl/index.vue +++ b/src/views/redirectUrl/index.vue @@ -1,100 +1,107 @@