Bläddra i källkod

解决联调bug

zhanghe 7 år sedan
förälder
incheckning
c0fe36da51

+ 1 - 1
src/models/tag/detail.js

@@ -97,7 +97,7 @@ export default {
         modalVisible: false,
         currentItem: {
           ...state.currentItem,
-          itemList: action.payload.itemList,
+          productList: action.payload.productList,
         }
       };
     },

+ 17 - 16
src/routes/Tag/Edit/index.js

@@ -5,7 +5,7 @@ import { connect } from 'dva';
 import { Spin, Badge, Table, Radio, Card, Form, Input, Icon, Button, Select } from 'antd';
 import PageHeaderLayout from '../../../layouts/PageHeaderLayout';
 import ItemSortModal from './modal';
-import { Codes, itemStatuses, tagType } from '../../../utils/config';
+import { Codes, itemStatuses, productType } from '../../../utils/config';
 
 @Form.create()
 @connect(state => ({
@@ -38,7 +38,7 @@ export default class TagDetail extends PureComponent {
     const { dispatch } = this.props;
     dispatch({
       type: 'tagDetail/saveSortResult',
-      payload: { itemList: data }
+      payload: { productList: data }
     });
   }
 
@@ -65,13 +65,13 @@ export default class TagDetail extends PureComponent {
           status: Codes.CODE_NORMAL
         };
       } else if (operType == 'update') {
-        const { id, groupId, itemList, name, status } = currentItem;
+        const { id, groupId, productList, name, status } = currentItem;
         data = {
           id,
           groupId,
           name,
           status,
-          itemList: (itemList || []).map(item => item.id),
+          productList: (productList || []).map(item => item.pid),
           ...getFieldsValue(),
         };
       }
@@ -106,29 +106,30 @@ export default class TagDetail extends PureComponent {
     const { itemLoading, currentItem, filters, modalVisible } = tagDetail;
     const { getFieldDecorator } = form;
     const { list } = group;
-    const { itemList, name, code, type, groupId } = currentItem;
+    const { productList, name, code, type, groupId } = currentItem;
 
     const itemTableColumns = [{
       title: '位置',
       dataIndex: 'sort',
       key: 'sort',
+      render: (text, _, index) => index + 1,
     },{
-      title: '品名称',
+      title: '品名称',
       dataIndex: 'name',
       key: 'name',
     },{
-      title: '品状态',
+      title: '品状态',
       dataIndex: 'status',
       key: 'status',
-      render: (text, record) => {
-        const statusMap = {[Codes.CODE_SALE]: 'success', [Codes.CODE_DELETE]: 'error'};
-        return (<Badge status={statusMap[record.status]} text={itemStatuses[record.status]} />);
+      render: text => {
+        const statusMap = {[Codes.CODE_NORMAL]: 'success', [Codes.CODE_DELETE]: 'error'};
+        return (<Badge status={statusMap[text]} text={itemStatuses[text]} />);
       },
     },{
-      title: '品类型',
+      title: '品类型',
       dataIndex: 'type',
       key: 'type',
-      render: (text, record) => (<span>{tagType[record.type]}</span>),
+      render: text => (<span>{productType[text]}</span>),
     }];
 
     const formItemLayout = {
@@ -186,15 +187,15 @@ export default class TagDetail extends PureComponent {
                 )}
               </Form.Item>
               <Form.Item label="商品排序" {...formItemLayout}>
-                <Button onClick={this.handleModalShow} disabled={!(itemList || []).length} type="primary" size="small" icon="edit">排序</Button>
+                <Button onClick={this.handleModalShow} disabled={!(productList || []).length} type="primary" size="small" icon="edit">排序</Button>
               </Form.Item>
               <Form.Item wrapperCol={{ offset: 7, span: 12 }}>
                 <Table
                   locale={{
                     emptyText: <span style={{ color: "#C6D0D6" }}>&nbsp;&nbsp;<Icon type="frown-o"/>
-                      该标签下不包含任何商品,无法排序,请先去关联商品吧!</span>
+                      该标签下未上架任何产品,无法排序,请先去上架产品吧!</span>
                   }}
-                  dataSource={itemList}
+                  dataSource={productList || []}
                   columns={itemTableColumns}
                   rowKey={record => record.id}
                   bordered
@@ -207,7 +208,7 @@ export default class TagDetail extends PureComponent {
               </Form.Item>
             </Form>
             <ItemSortModal
-              itemList={itemList || []}
+              itemList={productList || []}
               rowKeyName="id"
               modalVisible={modalVisible}
               onCancel={this.handleModalCancel}

+ 9 - 8
src/routes/Tag/Edit/modal.js

@@ -1,7 +1,7 @@
 import React, { PureComponent } from 'react';
 import { Badge } from 'antd';
 import SelectModal from '../../../components/SelectModal';
-import { Codes, tagType, itemStatuses } from '../../../utils/config';
+import { Codes, productType, itemStatuses } from '../../../utils/config';
 
 export default class ItemSortModal extends PureComponent {
   render() {
@@ -22,23 +22,24 @@ export default class ItemSortModal extends PureComponent {
         title: '位置',
         dataIndex: 'sort',
         key: 'sort',
+        render: (text, _, index) => index + 1,
       },{
-        title: '品名称',
+        title: '品名称',
         dataIndex: 'name',
         key: 'name',
       },{
-        title: '品状态',
+        title: '品状态',
         dataIndex: 'status',
         key: 'status',
-        render: (text, record) => {
-          const statusMap = {[Codes.CODE_SALE]: 'success', [Codes.CODE_DELETE]: 'error'};
-          return (<Badge status={statusMap[record.status]} text={itemStatuses[record.status]} />);
+        render: text => {
+          const statusMap = {[Codes.CODE_NORMAL]: 'success', [Codes.CODE_DELETE]: 'error'};
+          return (<Badge status={statusMap[text]} text={itemStatuses[text]} />);
         },
       },{
-        title: '品类型',
+        title: '品类型',
         dataIndex: 'type',
         key: 'type',
-        render: (text, record) => (<span>{tagType[record.type]}</span>),
+        render: text => (<span>{productType[text]}</span>),
       }],
     };
 

+ 0 - 2
src/routes/Tag/List/index.js

@@ -6,7 +6,6 @@ import { Card } from 'antd';
 import TableList from './table';
 import Search from './search';
 import PageHeaderLayout from '../../../layouts/PageHeaderLayout';
-import { Codes } from '../../../utils/config';
 
 @connect(state => ({
   tagModel: state.tagModel,
@@ -20,7 +19,6 @@ export default class Tag extends PureComponent {
       payload: {
         pageNo: 1,
         pageSize: 20,
-        domain: Codes.CODE_PJ,
       }
     });
   }

+ 2 - 1
src/routes/TagGroup/Edit/index.js

@@ -68,13 +68,14 @@ export default class GroupDetail extends PureComponent {
           status: Codes.CODE_NORMAL
         };
       } else if (operType == 'update') {
-        const { id, merchantId, status, name, code } = currentItem;
+        const { id, merchantId, status, name, code, tagList } = currentItem;
         data = {
           id,
           merchantId,
           status,
           name,
           code,
+          tagList: (tagList || []).map(item => item.id),
           ...getFieldsValue(),
         };
       }

+ 0 - 2
src/routes/TagGroup/List/index.js

@@ -6,7 +6,6 @@ import { Card } from 'antd';
 import TableList from './table';
 import Search from './search';
 import PageHeaderLayout from '../../../layouts/PageHeaderLayout';
-import { Codes } from '../../../utils/config';
 
 @connect(state => ({
   group: state.group,
@@ -20,7 +19,6 @@ export default class TagGroup extends PureComponent {
       payload: {
         pageNo: 1,
         pageSize: 1000,
-        domain: Codes.CODE_PJ,
       }
     });
   }

+ 2 - 1
src/utils/config.js

@@ -44,7 +44,8 @@ Codes.CODE_SEASON = '季';
 Codes.CODE_ITEM = '件';
 
 module.exports = {
-  apiHost: '/api/v1',
+  // apiHost: 'http://tt-cms.api.ai160.com',
+  apiHost: 'http://192.168.1.40:8500',
   ossHost: 'http://efunimgs.oss-cn-beijing.aliyuncs.com',
   // 每页返回数据量
   pageSize: 20,