Pārlūkot izejas kodu

fix: 调整分类接口逻辑

周玉环 1 dienu atpakaļ
vecāks
revīzija
c2fefbecee

+ 1 - 1
xinkeaboard-seller/src/layouts/index.js

@@ -11,7 +11,7 @@ class LayoutWrapper extends React.PureComponent {
 
     // 非 apply 页 & currentSite 为空,初始化请求
     if (!isApplyPage) {
-      dispatch({ type: 'global/get_site_list_data' });
+      dispatch({ type: 'global/get_site_list_data', payload: { isAll: true } });
     }
   }
 

+ 1 - 1
xinkeaboard-seller/src/models/common.js

@@ -28,7 +28,7 @@ export default {
     },
     //slodon_获取系统设置信息
     * getSetting({ payload, callback }, { call }) {
-      const response = yield call(sldCommonService, payload, 'get', 'v3/system/seller/setting/getSettingList');
+      const response = yield call(sldCommonService, {...payload, isAll: true }, 'get', 'v3/system/seller/setting/getSettingList');
       if (callback) callback(response);
     },
     //slodon_批量保存设置信息

+ 6 - 0
xinkeaboard-seller/src/models/manage.js

@@ -92,6 +92,12 @@ export default {
       const response = yield call(sldCommonService, payload, 'get', `v3/goods/seller/goodsCategory/getStoreCateList`);
       if (callback) callback(response);
     },
+
+    //逐级获取商户绑定的商品分类,如果有下级,children返回空数组,否则返回null
+    * getOldVendorGoodsCategoryById({ payload, callback }, { call }) {
+      const response = yield call(sldCommonService, payload, 'get', `v3/goods/seller/goodsCategory/listByPId`);
+      if (callback) callback(response);
+    },
   },
 
   reducers: {

+ 1 - 1
xinkeaboard-seller/src/models/project.js

@@ -11,7 +11,7 @@ export default {
   effects: {
     //slodon_获取系统配置信息
     * get_system_info({ payload, callback }, { call }) {
-      const response = yield call(sldCommonService, payload, 'get', `v3/system/seller/setting/getSettingList`);
+      const response = yield call(sldCommonService, {...payload, isAll: true }, 'get', `v3/system/seller/setting/getSettingList`);
       if (callback) callback(response);
     },
     //slodon_获取分类列表_根据分类id获取下级分类

+ 1 - 0
xinkeaboard-seller/src/pages/settledManage/businessInfo/index.js

@@ -183,6 +183,7 @@ export default class BusinessInfo extends Component {
     const { select_cat, site_base_info } = this.state;
     dispatch({
       type: "global/get_site_list_data",
+      payload: { isAll: true },
       callback: async (res) => {
         if (res.state == 200) {
           const siteListData = res.data;

+ 1 - 1
xinkeaboard-seller/src/pages/store/brand_lists.js

@@ -296,7 +296,7 @@ export default class BrandLists extends Component {
     targetOption.loading = true;
     const { dispatch } = this.props;
     let { addData } = this.state;
-    let dis_type = 'manage/getVendorGoodsCategoryById';
+    let dis_type = 'manage/getOldVendorGoodsCategoryById';
     let target_grade = selectedOptions[selectedOptions.length-1].grade*1+1;
     dispatch({
       type: dis_type,

+ 8 - 2
xinkeaboard-seller/src/utils/utils.js

@@ -13,6 +13,7 @@ import request from './request';
 import printJS from 'print-js';
 import { getLocale } from 'umi/locale';
 import defaultSettings from '@/defaultSettings';
+import isEmpty from "lodash/isEmpty"
 
 const Search = Input.Search;
 
@@ -1384,11 +1385,16 @@ export function sldComRequest(method, url, params, data_type = '') {
   const currentSite = state.global.currentSite || localStorage.getItem('currentSite');
   const currentPath = state.routing.location.pathname;
   if (!currentPath.includes('/apply') && !currentPath.includes('/user/login')) {
-    params = Object.assign({}, params ?? {}, { webSite: currentSite })
+    params = Object.assign({}, { webSite: currentSite }, params ?? {})
+  }
+
+  if (params && params.isAll) {
+    delete params.isAll;
+    delete params.webSite;
   }
   if (method == 'get') {
     let tmp_url = apiUrl + `${url}`;
-    if (params != undefined) {
+    if (params != undefined && !isEmpty(params)) {
       tmp_url += `?${stringify(params)}`;
     }
     return request(tmp_url);