Browse Source

[fixbug] 标签可删除、标签类型可修改、标签增加渠道选择

zhanghe 6 years atrás
parent
commit
a2df93e403
2 changed files with 28 additions and 4 deletions
  1. 2 2
      src/common/router.js
  2. 26 2
      src/routes/Tag/Edit/index.js

+ 2 - 2
src/common/router.js

@@ -110,11 +110,11 @@ export const getRouterData = (app) => {
       component: dynamicWrapper(app, ['tag/tag', 'merchant/merchant'], () => import('../routes/Tag/List')),
     },
     '/tag/tagItem/add': {
-      component: dynamicWrapper(app, ['tag/detail', 'group/group', 'tagType/tagType'], () => import('../routes/Tag/Edit')),
+      component: dynamicWrapper(app, ['tag/detail', 'group/group', 'tagType/tagType', 'merchant/merchant'], () => import('../routes/Tag/Edit')),
       name: '创建标签',
     },
     '/tag/tagItem/edit/:id': {
-      component: dynamicWrapper(app, ['tag/detail', 'group/group', 'tagType/tagType'], () => import('../routes/Tag/Edit')),
+      component: dynamicWrapper(app, ['tag/detail', 'group/group', 'tagType/tagType', 'merchant/merchant'], () => import('../routes/Tag/Edit')),
       name: '修改标签',
     },
     '/basic-product/ware': {

+ 26 - 2
src/routes/Tag/Edit/index.js

@@ -12,6 +12,7 @@ import { Codes, itemStatuses, productType } from '../../../utils/config';
   tagDetail: state.tagDetail,
   group: state.group,
   tagType: state.tagType,
+  merchant: state.merchant,
 }))
 export default class TagDetail extends PureComponent {
   componentDidMount() {
@@ -30,6 +31,13 @@ export default class TagDetail extends PureComponent {
         pageSize: 1000,
       },
     });
+    dispatch({
+      type: 'merchant/query',
+      payload: {
+        pageNo: 1,
+        pageSize: 1000,
+      }
+    });
   }
 
   handleModalShow = () => {
@@ -110,10 +118,10 @@ export default class TagDetail extends PureComponent {
   }
 
   render() {
-    const { dispatch, form, tagDetail, group, tagType } = this.props;
+    const { dispatch, form, tagDetail, group, tagType, merchant } = this.props;
     const { itemLoading, currentItem, filters, modalVisible } = tagDetail;
     const { getFieldDecorator } = form;
-    const { productList, name, code, type, groupId, typeCode } = currentItem;
+    const { productList, name, code, type, groupId, typeCode, merchantId } = currentItem;
 
     const itemTableColumns = [{
       title: '位置',
@@ -197,6 +205,22 @@ export default class TagDetail extends PureComponent {
                   </Select>
                 )}
               </Form.Item>
+              <Form.Item label="所属渠道" hasFeedback {...formItemLayout}>
+                {getFieldDecorator('merchantId', {
+                  rules: [{ required: true, type: 'string', message: "渠道为必选项!" }],
+                  initialValue: merchantId,
+                })(
+                  <Select
+                    showSearch
+                    allowClear
+                    placeholder="请输入渠道编号或者名称进行筛选"
+                    optionFilterProp="children"
+                    filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
+                  >
+                    {merchant.list.map(item => <Select.Option value={item.id} key={item.id}>{`${item.name}/${item.code}`}</Select.Option>)}
+                  </Select>
+                )}
+              </Form.Item>
               <Form.Item label="商品排序" {...formItemLayout}>
                 <Button onClick={this.handleModalShow} disabled={!(productList || []).length} type="primary" size="small" icon="edit">排序</Button>
               </Form.Item>