فهرست منبع

feat: 店铺管理端申请入驻类型切换优化

周玉环 2 روز پیش
والد
کامیت
193a69bf65

+ 2 - 1
xinkeaboard-seller/src/components/SldTableRowThree/index.js

@@ -74,7 +74,7 @@ export default class SldTableRowTwo extends PureComponent {
     //普通输入框
     item_width = item_width != undefined ? item_width : 'auto';
     const uploadButton = (
-      <div>
+      <div key="upload-button">
         <Icon type="plus"/>
         <div className="ant-upload-text">{sldComLanguage('上传图片')}</div>
       </div>
@@ -405,6 +405,7 @@ export default class SldTableRowTwo extends PureComponent {
         </FormItem>
       );
     } else if (val.type == 'upload_img_upload') {
+      // val.fileList = val.fileList.map(item => ({...item, key: item.uid}))
       return <FormItem
         key={index}
         style={{ width: '100%' }}

+ 5 - 0
xinkeaboard-seller/src/components/SldTableRowThree/index.less

@@ -3,6 +3,11 @@
     .ant-form-item-control-wrapper{
       width: 100%;
     }
+
+    .ant-upload.ant-upload-select-picture-card {
+      margin-bottom: 2px !important;
+      margin-right: 0 !important;
+    }
   }
 }
 .sld_det_lr_wrap {

+ 12 - 1
xinkeaboard-seller/src/global.less

@@ -34,6 +34,13 @@ ol {
   padding: 10px;
   background-color: #fff;
   width: 100%;
+
+  :global {
+    .ant-upload.ant-upload-select-picture-card {
+      margin-bottom: 2px !important;
+      margin-right: 0 !important;
+    }
+  }
 }
 
 .common_page_20 {
@@ -262,7 +269,11 @@ body {
 
     .ant-form-explain, .ant-form-extra {
       font-size: 12px;
-      line-height: 15px;
+      // height: 15px !important;
+      // min-height: unset !important;
+      // margin-top: 2px !important;
+      // line-height: 15px !important;
+      // padding-top: 0;
     }
 
     .ant-table-small > .ant-table-content > .ant-table-fixed-left > .ant-table-body-outer > .ant-table-body-inner > table > .ant-table-thead > tr > th {

+ 12 - 2
xinkeaboard-seller/src/models/project.js

@@ -5,6 +5,7 @@ export default {
 
   state: {
     notice: [],
+    cateListData: {}
   },
 
   effects: {
@@ -45,9 +46,12 @@ export default {
       if (callback) callback(response);
     },
     //获取平台商品分类树——有三级的才显示,没有的不显示
-    * get_system_cat_tree_grade3({ payload, callback }, { call }) {
-      const response = yield call(sldCommonService, payload, 'get', 'v3/goods/seller/goodsCategory/getCateList');
+    * get_system_cat_tree_grade3({ payload, callback }, { call, put, select }) {
+      const { webSite } = payload;
+      const cateList = yield select(state => state.project.cateListData[webSite]);
+      const response = cateList?.length ? {data: cateList, state: 200} : yield call(sldCommonService, payload, 'get', 'v3/goods/seller/goodsCategory/getCateList');
       if (callback) callback(response);
+      yield put({ type: 'saveCateList', payload: { [webSite]: response.data } });
     },
     //推手——获取店铺商品列表用于导入推手商品
     * get_goods_list_to_import_spreader({ payload, callback }, { call }) {
@@ -68,5 +72,11 @@ export default {
         notice: action.payload,
       };
     },
+    saveCateList(state, action) {
+      return {
+        ...state,
+        cateListData: Object.assign({}, state.cateListData, action.payload),
+      };
+    }
   },
 };

+ 21 - 3
xinkeaboard-seller/src/pages/goods/add_goods.js

@@ -753,7 +753,24 @@ export default class AddGoods extends Component {
           whitespace: true,
           message: `${sldComLanguage('请输入商品名称')}`,
         }],
-      }, {
+      }, 
+      {
+        type: 'input',
+        label: `${sldComLanguage('商品中文名称')}`,
+        name: 'goodsNameCn',
+        extra: `${sldComLanguage('最多输入200个字')}`,
+        placeholder: `${sldComLanguage('请输入商品中文名称')}`,
+        hide: props.global.currentSite === '2',
+        initialValue: '',
+        required: true,
+        maxLength: 200,
+        rules: [{
+          required: true,
+          whitespace: true,
+          message: `${sldComLanguage('请输入商品中文名称')}`,
+        }],
+      },
+      {
         type: 'input',
         label: `${sldComLanguage('商品广告语')}`,
         name: 'goodsBrief',
@@ -2712,6 +2729,7 @@ export default class AddGoods extends Component {
           params.brandId = values.brandId;//品牌ID
           params.goodsName = values.goodsName;
           params.goodsBrief = values.goodsBrief;//商品广告语
+          params.goodsNameCn = values.goodsNameCn || values.goodsName;//商品中文名称
           params.sellNow = values.sellNow;//发布类型,false-放入仓库(待售);true-立即售卖(在售)
           params.storeIsRecommend = values.storeIsRecommend;//商品推荐,0-不推荐;1-推荐(店铺内是否推荐)
           params.isVatInvoice = values.isVatInvoice;//是否可以开具增值税发票0-不可以;1-可以
@@ -3210,8 +3228,8 @@ export default class AddGoods extends Component {
                       {sldCommonTitleByBg(`${sldComLanguage('基本信息')}`)}
                       {getSldEmptyH(10)}
                       {show_radio_flag &&
-                      <SldTableRowTwo part_width={100} lwidth={10} rwidth={90} form={this.props.form}
-                                      data={goods_base_data}/>
+                      <SldTableRowTwo part_width={100} lwidth={12} rwidth={90} form={this.props.form}
+                                      data={goods_base_data.filter(item => !item.hide)}/>
                       }
                     </div>
 

+ 93 - 71
xinkeaboard-seller/src/pages/settledManage/baseInfo/index.js

@@ -327,9 +327,9 @@ export default class BaseInfo extends Component {
   }
 
   componentDidUpdate(prevProps, prevState) {
-    if (prevState.cur_apply_type !== this.state.cur_apply_type) {
-      this.initData()
-    }
+    // if (prevState.cur_apply_type !== this.state.cur_apply_type) {
+    //   this.initData()
+    // }
   }
 
 
@@ -342,7 +342,8 @@ export default class BaseInfo extends Component {
   };
 
   handleApplyType = (val) => {
-    this.setState({ cur_apply_type: val });
+    this.initData(val)
+    // this.setState({ cur_apply_type: val });
   };
 
   //上传图片 key  name ,info
@@ -360,13 +361,14 @@ export default class BaseInfo extends Component {
   };
 
   //初始化页面数据
-  initData = async () => {
+  initData = (curApplyType) => {
     let { cur_apply_type, apply_type, personal_base_info, personal_front_card_img, personal_back_card_img, company_base_info, business_license_img, legal_front_card_img, legal_back_card_img, replenish_1_img, replenish_2_img, replenish_3_img, show_apply_type_flag } = this.state;
     let tmp_data = getSettleData('baseInfo');
+    const new_cur_apply_type = curApplyType ?? tmp_data.enterType ?? cur_apply_type;
     const localVendorMobile = getSettleData('user_info')?.vendorMobile || getSettleData('vendorMobile');
     if (!tmp_data) {
-      this.setState({ show_apply_type_flag: true });
-      if (cur_apply_type === 0) {
+      this.setState({ show_apply_type_flag: true, cur_apply_type: new_cur_apply_type });
+      if (new_cur_apply_type === 0) {
         personal_base_info.forEach(item => {
           if (item.name === 'contactPhone') {
             item.initialValue = localVendorMobile;
@@ -379,96 +381,116 @@ export default class BaseInfo extends Component {
           }
         });
       }
-
       return false;
     }
-    cur_apply_type = tmp_data.enterType;
-    apply_type[0].initialValue = cur_apply_type;
-    if (cur_apply_type == 0) {
+    apply_type[0].initialValue = new_cur_apply_type;
+    if (new_cur_apply_type == 0) {
       //个人入驻
-      personal_base_info.map(item => {
+      personal_base_info.forEach(item => {
         item.initialValue = tmp_data[item.name];
+        if (item.name === 'contactPhone') {
+            item.initialValue = localVendorMobile;
+        }
       });
+      
 
       //身份证正面图片
-      personal_front_card_img[0].fileList.push({
-        response: {
-          data: {
-            path: tmp_data.personCardUp,
-            url: tmp_data.personCardUpUrl,
+      if (!personal_front_card_img[0].fileList.length) {
+        personal_front_card_img[0].fileList.push({
+          response: {
+            data: {
+              path: tmp_data.personCardUp,
+              url: tmp_data.personCardUpUrl,
+            },
           },
-        },
-        name: tmp_data.personCardUp,
-        uid: tmp_data.personCardUp,
-        status: 'done',
-        thumbUrl: tmp_data.personCardUpUrl,
-      });
+          name: tmp_data.personCardUp,
+          uid: tmp_data.personCardUp,
+          status: 'done',
+          thumbUrl: tmp_data.personCardUpUrl,
+        });
+      }
+      
 
       //身份证反面图片
-      personal_back_card_img[0].fileList.push({
-        response: {
-          data: {
-            path: tmp_data.personCardDown,
-            url: tmp_data.personCardDownUrl,
+      if (!personal_back_card_img[0].fileList.length) {
+        personal_back_card_img[0].fileList.push({
+          response: {
+            data: {
+              path: tmp_data.personCardDown,
+              url: tmp_data.personCardDownUrl,
+            },
           },
-        },
-        name: tmp_data.personCardDown,
-        uid: tmp_data.personCardDown,
-        status: 'done',
-        thumbUrl: tmp_data.personCardDownUrl,
-      });
+          name: tmp_data.personCardDown,
+          uid: tmp_data.personCardDown,
+          status: 'done',
+          thumbUrl: tmp_data.personCardDownUrl,
+        });
+      }
+      
 
     } else {
       //企业入驻
 
       company_base_info.map(item => {
         item.initialValue = tmp_data[item.name];
+        if (item.name === 'contactPhone') {
+          item.initialValue = localVendorMobile;
+        }
       });
 
       //营业执照图片
-      business_license_img[0].fileList.push({
-        response: {
-          data: {
-            path: tmp_data.businessLicenseImage,
-            url: tmp_data.businessLicenseImageUrl,
+      if (!business_license_img[0].fileList.length) {
+        business_license_img[0].fileList.push({
+          response: {
+            data: {
+              path: tmp_data.businessLicenseImage,
+              url: tmp_data.businessLicenseImageUrl,
+            },
           },
-        },
-        name: tmp_data.businessLicenseImage,
-        uid: tmp_data.businessLicenseImage,
-        status: 'done',
-        thumbUrl: tmp_data.businessLicenseImageUrl,
-      });
+          name: tmp_data.businessLicenseImage,
+          uid: tmp_data.businessLicenseImage,
+          status: 'done',
+          thumbUrl: tmp_data.businessLicenseImageUrl,
+        });
+      }
+      
 
       //法人身份证正面图片
-      legal_front_card_img[0].fileList.push({
-        response: {
-          data: {
-            path: tmp_data.personCardUp,
-            url: tmp_data.personCardUpUrl,
+      if (!legal_front_card_img[0].fileList.length) {
+        legal_front_card_img[0].fileList.push({
+          response: {
+            data: {
+              path: tmp_data.personCardUp,
+              url: tmp_data.personCardUpUrl,
+            },
           },
-        },
-        name: tmp_data.personCardUp,
-        uid: tmp_data.personCardUp,
-        status: 'done',
-        thumbUrl: tmp_data.personCardUpUrl,
-      });
+          name: tmp_data.personCardUp,
+          uid: tmp_data.personCardUp,
+          status: 'done',
+          thumbUrl: tmp_data.personCardUpUrl,
+        });
+      }
+      
 
       //法人身份证反面图片
-      legal_back_card_img[0].fileList.push({
-        response: {
-          data: {
-            path: tmp_data.personCardDown,
-            url: tmp_data.personCardDownUrl,
+      if (!legal_back_card_img[0].fileList.length) {
+        legal_back_card_img[0].fileList.push({
+          response: {
+            data: {
+              path: tmp_data.personCardDown,
+              url: tmp_data.personCardDownUrl,
+            },
           },
-        },
-        name: tmp_data.personCardDown,
-        uid: tmp_data.personCardDown,
-        status: 'done',
-        thumbUrl: tmp_data.personCardDownUrl,
-      });
+          name: tmp_data.personCardDown,
+          uid: tmp_data.personCardDown,
+          status: 'done',
+          thumbUrl: tmp_data.personCardDownUrl,
+        });
+      }
+      
 
       //补充认证1图片
-      if (tmp_data.moreQualification1) {
+      if (tmp_data.moreQualification1 && !replenish_1_img[0].fileList.length) {
         replenish_1_img[0].fileList.push({
           response: {
             data: {
@@ -484,7 +506,7 @@ export default class BaseInfo extends Component {
       }
 
       //补充认证2图片
-      if (tmp_data.moreQualification2) {
+      if (tmp_data.moreQualification2 && !replenish_2_img[0].fileList.length) {
         replenish_2_img[0].fileList.push({
           response: {
             data: {
@@ -500,7 +522,7 @@ export default class BaseInfo extends Component {
       }
 
       //补充认证3图片
-      if (tmp_data.moreQualification3) {
+      if (tmp_data.moreQualification3 && !replenish_3_img[0].fileList.length) {
         replenish_3_img[0].fileList.push({
           response: {
             data: {
@@ -517,7 +539,7 @@ export default class BaseInfo extends Component {
 
     }
     this.setState({
-      cur_apply_type,
+      cur_apply_type: new_cur_apply_type,
       apply_type,
       personal_base_info,
       personal_front_card_img,

+ 43 - 35
xinkeaboard-seller/src/pages/settledManage/businessInfo/index.js

@@ -125,7 +125,6 @@ export default class BusinessInfo extends Component {
       width: 200,
     },
   ];
-  select_cat_id = [];//选择的分类id数组,格式:1级-2级-3级
   selectedRows = [];
   selectedRowKeys = [];
 
@@ -218,35 +217,52 @@ export default class BusinessInfo extends Component {
     });
   };
 
+  setCatCache = (siteList, values) => {
+    let params = { };
+    params.siteInfoList = siteList.map(site => ({
+      webSite: site.value,
+      storeName: values[`${site.value}_storeName`],
+      goodsCategoryIds: site.site_select_cat[0].select_cat_id.join(','),
+      selected_keys: site.site_select_cat[0].selected_keys,
+      id: site.id
+    }))
+    saveSettleData('bussinessInfo', JSON.stringify(params));//经营信息存缓存
+
+    return params
+  }
+
 
   //选择分类事件
   handleCatCheck = (checkedKeys, e, webSite) => {
     const select_cat_id = [];
     const { siteList } = this.state;
-      e.checkedNodes.map(item_one=>{
-        if(item_one.props.grade == 3){
-          let tmp_data = item_one.props.path.split('/');
-          select_cat_id.push(`${tmp_data[1]}-${tmp_data[2]}-${item_one.props.categoryId}`);
-        }
-      })
-      const newSiteList = siteList.map(site_info => {
-        if (site_info.value === webSite) {
-          const siteSelectCat = site_info.site_select_cat[0];
-          const newSelectCat = [
-            {
-              ...siteSelectCat,
-              selected_keys: checkedKeys,
-              select_cat_id,
-            }
-          ]
-          return {
-            ...site_info,
-            site_select_cat: newSelectCat
-          };
-        }
-        return site_info;
-      })
-      this.setState({siteList: newSiteList})
+    e.checkedNodes.map(item_one=>{
+      if(item_one.props.grade == 3){
+        let tmp_data = item_one.props.path.split('/');
+        select_cat_id.push(`${tmp_data[1]}-${tmp_data[2]}-${item_one.props.categoryId}`);
+      }
+    })
+    const newSiteList = siteList.map(site_info => {
+      if (site_info.value === webSite) {
+        const siteSelectCat = site_info.site_select_cat[0];
+        const newSelectCat = [
+          {
+            ...siteSelectCat,
+            selected_keys: checkedKeys,
+            select_cat_id,
+          }
+        ]
+        return {
+          ...site_info,
+          site_select_cat: newSelectCat
+        };
+      }
+      return site_info;
+    })
+    this.setState({siteList: newSiteList})
+    // 设置缓存
+    const values = this.props.form.getFieldsValue();
+    this.setCatCache(newSiteList, values)
   };
 
   //店铺等级选择
@@ -320,7 +336,7 @@ export default class BusinessInfo extends Component {
         site.site_select_cat  = [
           {
             ...siteSelectCat,
-            select_cat_id: tempSiteData.goodsCategoryIds,
+            select_cat_id: tempSiteData.goodsCategoryIds?.split(','),
             selected_keys: tempSiteData.selected_keys
           }
         ]
@@ -378,16 +394,8 @@ export default class BusinessInfo extends Component {
             failTip(`${webSite}${sldComLanguage('请选择经营类型~')}`);
             return false;
           }
-          let params = { };
-          params.siteInfoList = siteList.map(site => ({
-            webSite: site.value,
-            storeName: values[`${site.value}_storeName`],
-            goodsCategoryIds: site.site_select_cat[0].select_cat_id.join(','),
-            selected_keys: site.site_select_cat[0].selected_keys,
-            id: site.id
-          }))
           let base_info = JSON.parse(localStorage.getItem('baseInfo').replace(/&quot;/g,"\""));
-          saveSettleData('bussinessInfo', JSON.stringify(params));//经营信息存缓存
+          const params = this.setCatCache(siteList, values)
           let tar_params = {...params};
           tar_params.siteInfoList = tar_params.siteInfoList.map(item => ({
             webSite: item.webSite,

+ 2 - 2
xinkeaboard-seller/src/pages/settledManage/openUp/open_up.js

@@ -179,12 +179,12 @@ export default class openUp extends Component {
               siteInfoList.push({
                 webSite: item.webSite,
                 storeName: item.storeName,
-                goodsCategoryIds: [goodsCategoryId],
+                goodsCategoryIds: goodsCategoryId,
                 selected_keys: [selected_key],
                 id: item.id
               })
             } else {
-              siteInfoList[matchIndex].goodsCategoryIds.push(goodsCategoryId);
+              siteInfoList[matchIndex].goodsCategoryIds = siteInfoList[matchIndex].goodsCategoryIds + `,${goodsCategoryId}`;
               siteInfoList[matchIndex].selected_keys.push(selected_key);
             }
           })