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

Merge remote-tracking branch 'origin/master'

sunshihao 2 napja
szülő
commit
6b3af894f4

BIN
xinkeaboard-seller/src/assets/warning.png


+ 42 - 5
xinkeaboard-seller/src/components/BusinessStateSelector/index.js

@@ -1,5 +1,6 @@
-import { Select, message } from "antd";
+import { Select, message, Modal } from "antd";
 import { connect } from "dva/index";
+import router from 'umi/router';
 import { Component } from "react";
 import { businessStateEnum } from "@/utils/utils";
 import styles from "./index.less";
@@ -16,6 +17,7 @@ export default class BusinessStateSelector extends Component {
         value: Number(key),
       })),
       currentBusinessState: "",
+      visible: false,
     };
   }
 
@@ -28,8 +30,12 @@ export default class BusinessStateSelector extends Component {
       },
       callback: (res) => {
         if (res.state === 200) {
-          message.success('设置成功')
-          this.setState({ currentBusinessState: value });
+          if (res.data) {
+            this.setState({ visible: true })
+          } else {
+             message.success('设置成功')
+            this.setState({ currentBusinessState: value });
+          }
         } else {
           message.error(res.msg)
         }
@@ -46,14 +52,28 @@ export default class BusinessStateSelector extends Component {
           this.setState({ currentBusinessState: res.data });
         } else {
           this.setState({ currentBusinessState: 2 });
-          message.error(res.msg)
+          message.error(res.msg);
         }
       },
     });
   }
 
+  confirmModal = () => {
+    router.push({
+      pathname: '/store/decorate_pc',
+      query: {
+        tab: '2'
+      }
+    });
+    this.setState({visible: false})
+  };
+
+  cancelModel = () => {
+    this.setState({visible: false})
+  };
+
   render() {
-    const { stateList, currentBusinessState } = this.state;
+    const { stateList, currentBusinessState, visible } = this.state;
     return stateList.length ? (
       <div className={`${styles.state_warp}`}>
         <span className={`${styles.label}`}>经营状态</span>
@@ -68,6 +88,23 @@ export default class BusinessStateSelector extends Component {
             </Select.Option>
           ))}
         </Select>
+        <Modal
+          visible={visible}
+          onOk={this.confirmModal}
+          onCancel={this.cancelModel}
+          okText="去启用"
+          cancelText="取消"
+          wrapClassName={styles.model_wrap}
+          width={526}
+          height={324}
+        >
+          <div className={styles.model_content}>
+            <div className={styles.model_icon}>
+              <img className={styles.model_img} src={require('../../assets/warning.png')} />
+            </div>
+            <div className={styles.model_tip}>请先在【店铺装修-首页装修】内,装修首页并将“启用状态”更改为“启用”</div>
+          </div>
+        </Modal>
       </div>
     ) : null;
   }

+ 64 - 0
xinkeaboard-seller/src/components/BusinessStateSelector/index.less

@@ -22,3 +22,67 @@
   font-size: 14px;
   font-weight: 700;
 }
+
+.model_wrap {
+  :global {
+    .ant-modal-content {
+      padding: 15px 10px 12px 15px;
+      width: 100%;
+      height: 100%;
+      display: flex;
+      flex-direction: column;
+      justify-content: center;
+      align-items: center;
+    }
+    .ant-modal-footer {
+      border-top: none !important;
+      text-align: center !important;
+
+      :global {
+        .ant-btn {
+          width: 90px;
+          height: 40px;
+          border-radius: 0;
+          font-weight: bold;
+          font-size: 14px;
+          // color: #ffffff;
+        }
+      }
+    }
+
+    .ant-modal-body {
+      flex: 1;
+      height: 100%;
+    }
+  }
+}
+
+.model_content {
+  width: 100%;
+  height: 100%;
+  display: flex;
+  flex-direction: column;
+  // justify-content: center;
+  align-items: center;
+}
+
+.model_icon {
+  width: 146px;
+  height: 146px;
+}
+
+.model_img {
+  width: 100%;
+  height: 100%;
+  object-fit: contain;
+}
+
+.model_tip {
+  width: 100%;
+  height: 34px;
+  line-height: 34px;
+  text-align: center;
+  font-weight: 400;
+  font-size: 14px;
+  color: #282e30;
+}