Forráskód Böngészése

修改配套图片列表的数据格式

zhanghe 7 éve
szülő
commit
5424d63162

+ 1 - 1
src/routes/Campus/search.js

@@ -20,7 +20,7 @@ const Search = ({
       value: 'code', name: '校区编号'
     }],
     selectProps: {
-      defaultValue: field || 'name',
+      defaultValue: field || 'code',
     },
     onSearch: (value) => {
       onSearch(value);

+ 19 - 12
src/routes/MProduct/Add/index.js

@@ -8,7 +8,7 @@ import PageHeaderLayout from '../../../layouts/PageHeaderLayout';
 import CourseSelectModal from './course';
 import SupportSelectModal from './support';
 import PackageSelectModal from './package';
-import { Codes, productType } from '../../../utils/config';
+import { Codes, productType, pageSize } from '../../../utils/config';
 import styles from './index.less';
 
 const RadioGroup = Radio.Group;
@@ -64,10 +64,20 @@ export default class MerchantProductCreate extends PureComponent {
       delete newData.field;
       delete newData.keyword;
     }
-    if (curClickedBtn === Codes.CODE_COURSE) {
+    if (curClickedBtn == Codes.CODE_COURSE) {
       dispatch({
         type: 'course/query',
-        payload: { ...newData, pageNo: 1, pageSize: 10, status: Codes.CODE_NORMAL },
+        payload: { ...newData, pageNo: 1, pageSize },
+      });
+    } else if (curClickedBtn == Codes.CODE_SUPPORT) {
+      dispatch({
+        type: 'support/query',
+        payload: { ...newData, pageNo: 1, pageSize },
+      });
+    } else if (curClickedBtn == Codes.CODE_PACKAGE) {
+      dispatch({
+        type: 'combo/query',
+        payload: { ...newData, pageNo: 1, pageSize },
       });
     }
   }
@@ -116,8 +126,7 @@ export default class MerchantProductCreate extends PureComponent {
           type: 'course/query',
           payload: {
             pageNo: 1,
-            pageSize: 10,
-            status: Codes.CODE_NORMAL,
+            pageSize,
           }
         });
       })
@@ -130,8 +139,7 @@ export default class MerchantProductCreate extends PureComponent {
           type: 'support/query',
           payload: {
             pageNo: 1,
-            pageSize: 10,
-            status: Codes.CODE_NORMAL,
+            pageSize,
           }
         });
       })
@@ -144,8 +152,7 @@ export default class MerchantProductCreate extends PureComponent {
           type: 'combo/query',
           payload: {
             pageNo: 1,
-            pageSize: 10,
-            status: Codes.CODE_NORMAL,
+            pageSize,
           }
         });
       })
@@ -174,11 +181,11 @@ export default class MerchantProductCreate extends PureComponent {
     const data = { ...newFilters, ...tableFilters, pageNo: pagination.current, pageSize: pagination.pageSize };
     Object.keys(data).map(key => data[key] ? null : delete data[key]);
     if (curClickedBtn === Codes.CODE_COURSE) {
-      dispatch({ type: 'course/query', payload: { ...data, status: Codes.CODE_NORMAL } });
+      dispatch({ type: 'course/query', payload: { ...data } });
     } else if (curClickedBtn === Codes.CODE_SUPPORT) {
-      dispatch({ type: 'support/query', payload: { ...data, status: Codes.CODE_NORMAL } });
+      dispatch({ type: 'support/query', payload: { ...data } });
     } else if (curClickedBtn === Codes.CODE_PACKAGE) {
-      dispatch({ type: 'combo/query', payload: { ...data, status: Codes.CODE_PACKAGE } });
+      dispatch({ type: 'combo/query', payload: { ...data } });
     }
   }
 

+ 9 - 6
src/routes/Order/Add/index.js

@@ -117,6 +117,7 @@ export default class CreateOrder extends Component {
     //   payload: data,
     // });
     this.setState({ products: data || [] });
+    this.props.dispatch({ type: 'orderDetail/hideProductModal' });
   }
 
   handleProductModalCancel = () => {
@@ -154,7 +155,11 @@ export default class CreateOrder extends Component {
       if (item.goods && item.goods.length) {
         item.goods.map((goodsItem, index) => {
           if (index == 0) {
-            item.goods[index].selected = true;
+            const defaultQuantity = 1;
+            const defaultPrice = item.goods[0].terminalPrice;
+            item.goods[0].selected = true;
+            item.goods[0].quantity = 1;
+            item.goods[0].rowSum = defaultPrice * defaultQuantity;
           }
         });
       } else {
@@ -269,7 +274,7 @@ export default class CreateOrder extends Component {
           return (
             <InputNumber
               min={1}
-              defaultValue={1}
+              value={text}
               formatter={value => `x ${value}`.replace(/\B(?=(\d{3})+(?!\d))/g, ',')}
               parser={value => value.replace(/\x\s?|(,*)/g, '')}
             />
@@ -281,11 +286,8 @@ export default class CreateOrder extends Component {
       width: '6%',
     },{
       title: '小计',
-      dataIndex: 'total',
+      dataIndex: 'rowSum',
       key: 9,
-      render: (text, record, index) => {
-
-      },
       width: '10%',
     },{
       title: '操作',
@@ -356,6 +358,7 @@ export default class CreateOrder extends Component {
             <Form.Item label="添加商品" {...formItemLayout}>
               <Button onClick={this.handleProductSelectBtnClick} disabled={userInfo.merchantId ? false : true} type="primary" size="small" icon="plus-circle-o">添加</Button>
               <Table
+                bordered
                 scroll={{ x: 1300 }}
                 rowKey={record => record.id}
                 pagination={false}

+ 21 - 16
src/routes/Support/Edit/index.js

@@ -92,7 +92,7 @@ export default class SupportDetail extends PureComponent {
     } else if (curClickedBtn == 'imgBtn') {
       dispatch({
         type: 'supportDetail/saveImgList',
-        payload: { imgList: data },
+        payload: { imgList: data.map(item => item.path) },
       });
     } else if (curClickedBtn == 'cvImgBtn') {
       dispatch({
@@ -179,7 +179,7 @@ export default class SupportDetail extends PureComponent {
       let newImgList;
       let newSupportList;
       if (Array.isArray(imgList) && imgList.length) {
-        newImgList = imgList.map(item => item.id);
+        newImgList = imgList;
       } else {
         newImgList = [];
       }
@@ -277,25 +277,30 @@ export default class SupportDetail extends PureComponent {
     }];
 
     const imgTableColumns = [{
+      title: '位置',
+      dataIndex: 'sort',
+      key: 'sort',
+      render: (text, record, index) => index + 1,
+    },{
       title: '缩略图',
-      dataIndex: 'url',
-      key: 'url',
+      dataIndex: 'path',
+      key: 'path',
       render: (text, record) => (
           <Popover
-            content={<img alt="" src={`${ossHost}/${record.path}`} width={350} />}
+            content={<img alt="" src={`${ossHost}/${text}`} width={350} />}
             title={record.name}
           >
-            <img alt="" src={`${ossHost}/${record.path}`} width={70} />
+            <img alt="" src={`${ossHost}/${text}`} width={70} />
           </Popover>
       ),
-    },{
-      title: '图片编号',
-      dataIndex: 'code',
-      key: 'code',
-    },{
-      title: '图片名称',
-      dataIndex: 'name',
-      key: 'name',
+    // },{
+    //   title: '图片编号',
+    //   dataIndex: 'code',
+    //   key: 'code',
+    // },{
+    //   title: '图片名称',
+    //   dataIndex: 'name',
+    //   key: 'name',
     }];
 
     const formItemLayout = {
@@ -367,7 +372,7 @@ export default class SupportDetail extends PureComponent {
                     emptyText: <span style={{ color: "#C6D0D6" }}>&nbsp;&nbsp;<Icon type="frown-o"/>
                       该配套下不包含任何图片,请选择!</span>
                   }}
-                  dataSource={imgList || []}
+                  dataSource={(imgList || []).map((item,index) => ({ id: index, path: item }))}
                   columns={imgTableColumns}
                   rowKey={record => record.id}
                   bordered
@@ -420,7 +425,7 @@ export default class SupportDetail extends PureComponent {
               onOk={this.handleModalOk}
               onCancel={this.handleModalCancel}
               onSearch={this.handleModalSearch}
-              selTableData={imgList || []}
+              selTableData={[]}
               fsTableDataSource={resource.list || []}
               fsTableLoading={resource.listLoading}
               fsTablePagination={resource.pagination}