lisenzhou 2 lat temu
rodzic
commit
cdc0326c8a
1 zmienionych plików z 99 dodań i 67 usunięć
  1. 99
    67
      src/subpackages/pages/marketing/changeVisit/index.jsx

+ 99
- 67
src/subpackages/pages/marketing/changeVisit/index.jsx Wyświetl plik

@@ -17,6 +17,7 @@ import {
17 17
 import "./index.scss";
18 18
 import { ROLE_CODE } from "@/constants/user";
19 19
 import { useRef } from "react";
20
+import { useMemo } from "react";
20 21
 
21 22
 export default withLayout((props) => {
22 23
   const { router, person } = props;
@@ -51,15 +52,34 @@ export default withLayout((props) => {
51 52
   const [SuccessDate, setSuccessDate] = useState(null);
52 53
   const [channelCustomerId, setChannelCustomerId] = useState(null);
53 54
   const [channelCustomerInfo, setChannelCustomerIdInfo] = useState({});
54
-  const [StatusList] = useState([
55
-    { name: "认筹", id: 3 },
56
-    { name: "签约", id: 4 },
57
-    { name: "全款到账", id: 6 },
58
-    { name: "结佣", id: 5 },
59
-  ]);
55
+  // const [StatusList,setStatusList] = useState([
56
+  //   { name: "认筹", id: 3 },
57
+  //   { name: "签约", id: 4 },
58
+  //   { name: "全款到账", id: 6 },
59
+  //   { name: "结佣", id: 5 },
60
+  // ]);
60 61
   const [CurrentStatusId, setCurrentStatusId] = useState(3);
61 62
 
62 63
   const [CurrentRoomTypeId, setCurrentRoomTypeId] = useState(null);
64
+  const [isBroker, setIsBroker] = useState(false);
65
+
66
+  const StatusList = useMemo(() => {
67
+    if (isBroker) {
68
+      return [
69
+        { name: "认筹", id: 3 },
70
+        { name: "签约", id: 4 },
71
+        { name: "全款到账", id: 6 },
72
+        { name: "结佣", id: 5 },
73
+      ];
74
+    } else {
75
+      return [
76
+        { name: "认筹", id: 3 },
77
+        { name: "签约", id: 4 },
78
+
79
+        { name: "结佣", id: 5 },
80
+      ];
81
+    }
82
+  }, [isBroker]);
63 83
 
64 84
   useEffect(() => {
65 85
     if (buildingId) {
@@ -83,6 +103,9 @@ export default withLayout((props) => {
83 103
   useEffect(() => {
84 104
     fetch({ url: `${API_CUSTOMER_DETAILINFO}/${id}`, method: "get" }).then(
85 105
       (res) => {
106
+        if (res?.channelCustomer?.recommendPersonType === ROLE_CODE.BROKER) {
107
+          setIsBroker(true);
108
+        }
86 109
         //获取经纪人信息
87 110
         setChannelCustomerIdInfo(res);
88 111
         setAgentsInfo({ name: res.name });
@@ -183,7 +206,7 @@ export default withLayout((props) => {
183 206
     if (channelCustomerInfo?.status && isFirst.current === 1) {
184 207
       isFirst.current++;
185 208
       if (channelCustomerInfo?.status == 2) return;
186
-    
209
+
187 210
       CutStatus(
188 211
         StatusList.filter((x) => x.id === channelCustomerInfo.status)[0]
189 212
       )();
@@ -196,7 +219,8 @@ export default withLayout((props) => {
196 219
 
197 220
   const CutStatus = (item) => {
198 221
     return () => {
199
-      console.log(item, "CutStatus");
222
+      if (!item.id) return;
223
+
200 224
       setCurrentStatusId(item.id);
201 225
       if (item.id - 0 === 3) {
202 226
         setFormData({ ...RenChouData });
@@ -253,6 +277,14 @@ export default withLayout((props) => {
253 277
   };
254 278
 
255 279
   const ToSubmit = () => {
280
+    let brokerParams = {};
281
+
282
+    if (isBroker) {
283
+      (brokerParams.totalCommission = Number(FormData?.totalCommission) * 100),
284
+        (brokerParams.currentCommission =
285
+          Number(FormData?.currentCommission || 0) * 100);
286
+    }
287
+
256 288
     // let params = {};
257 289
     // for (let key in FormData) {
258 290
     //   if (key !== "dividendsName" && key !== "dividendsPer") {
@@ -329,8 +361,7 @@ export default withLayout((props) => {
329 361
               channelId === "null" || channelId === null ? "" : channelId,
330 362
             channelCustomerId,
331 363
           },
332
-          totalCommission: Number(params.totalCommission) * 100,
333
-          currentCommission: Number(params.currentCommission || 0) * 100,
364
+          ...brokerParams,
334 365
         },
335 366
       }).then(() => {
336 367
         Taro.showToast({ title: "修改成功", icon: "none", duration: 2000 });
@@ -370,8 +401,7 @@ export default withLayout((props) => {
370 401
             channelCustomerId,
371 402
           },
372 403
 
373
-          totalCommission: Number(params.totalCommission) * 100,
374
-          currentCommission: Number(params.currentCommission || 0) * 100,
404
+          ...brokerParams,
375 405
         },
376 406
       }).then(() => {
377 407
         Taro.showToast({ title: "修改成功", icon: "none", duration: 2000 });
@@ -415,8 +445,7 @@ export default withLayout((props) => {
415 445
               channelId === "null" || channelId === null ? "" : channelId,
416 446
             channelCustomerId,
417 447
           },
418
-          totalCommission: Number(params.totalCommission) * 100,
419
-          currentCommission: Number(params.currentCommission || 0) * 100,
448
+          ...brokerParams,
420 449
         },
421 450
       }).then(() => {
422 451
         Taro.showToast({ title: "修改成功", icon: "none", duration: 2000 });
@@ -627,68 +656,71 @@ export default withLayout((props) => {
627 656
 
628 657
           {(CurrentStatusId === 4 ||
629 658
             CurrentStatusId === 5 ||
630
-            CurrentStatusId === 6) && (
631
-            <Block>
632
-              <text>佣金总额</text>
633
-              <view className="FormLine flex-h">
634
-                <view className="flex-item">
635
-                  <Input
636
-                    type="number"
637
-                    placeholder="请输入金额"
638
-                    disabled={
639
-                      Number(
640
-                        channelCustomerInfo?.channelCustomer
641
-                          ?.settledCommission || 0
642
-                      ) > 0
643
-                    }
644
-                    value={FormData.totalCommission}
645
-                    onInput={InputChange.bind(this, "totalCommission")}
646
-                  ></Input>
659
+            CurrentStatusId === 6) &&
660
+            isBroker && (
661
+              <Block>
662
+                <text>佣金总额</text>
663
+                <view className="FormLine flex-h">
664
+                  <view className="flex-item">
665
+                    <Input
666
+                      type="number"
667
+                      placeholder="请输入金额"
668
+                      disabled={
669
+                        Number(
670
+                          channelCustomerInfo?.channelCustomer
671
+                            ?.settledCommission || 0
672
+                        ) > 0
673
+                      }
674
+                      value={FormData.totalCommission}
675
+                      onInput={InputChange.bind(this, "totalCommission")}
676
+                    ></Input>
677
+                  </view>
647 678
                 </view>
648
-              </view>
649
-            </Block>
650
-          )}
679
+              </Block>
680
+            )}
651 681
 
652 682
           {(CurrentStatusId === 4 ||
653 683
             CurrentStatusId === 5 ||
654
-            CurrentStatusId === 6) && (
655
-            <Block>
656
-              <text>已结佣金</text>
657
-              <view className="FormLine flex-h">
658
-                <view className="flex-item">
659
-                  <text>
660
-                    {(channelCustomerInfo?.channelCustomer?.settledCommission ||
661
-                      0) / 100}
662
-                  </text>
684
+            CurrentStatusId === 6) &&
685
+            isBroker && (
686
+              <Block>
687
+                <text>已结佣金</text>
688
+                <view className="FormLine flex-h">
689
+                  <view className="flex-item">
690
+                    <text>
691
+                      {(channelCustomerInfo?.channelCustomer
692
+                        ?.settledCommission || 0) / 100}
693
+                    </text>
694
+                  </view>
663 695
                 </view>
664
-              </view>
665
-            </Block>
666
-          )}
696
+              </Block>
697
+            )}
667 698
 
668 699
           {(CurrentStatusId === 4 ||
669 700
             CurrentStatusId === 5 ||
670
-            CurrentStatusId === 6) && (
671
-            <Block>
672
-              <text
673
-                style={{ display: person.brokerManager ? "block" : "none" }}
674
-              >
675
-                本次结佣
676
-              </text>
677
-              <view
678
-                className="FormLine flex-h"
679
-                style={{ display: person.brokerManager ? "block" : "none" }}
680
-              >
681
-                <view className="flex-item">
682
-                  <Input
683
-                    type="number"
684
-                    placeholder="请输入金额"
685
-                    value={FormData.currentCommission}
686
-                    onInput={InputChange.bind(this, "currentCommission")}
687
-                  ></Input>
701
+            CurrentStatusId === 6) &&
702
+            isBroker && (
703
+              <Block>
704
+                <text
705
+                  style={{ display: person.brokerManager ? "block" : "none" }}
706
+                >
707
+                  本次结佣
708
+                </text>
709
+                <view
710
+                  className="FormLine flex-h"
711
+                  style={{ display: person.brokerManager ? "block" : "none" }}
712
+                >
713
+                  <view className="flex-item">
714
+                    <Input
715
+                      type="number"
716
+                      placeholder="请输入金额"
717
+                      value={FormData.currentCommission}
718
+                      onInput={InputChange.bind(this, "currentCommission")}
719
+                    ></Input>
720
+                  </view>
688 721
                 </view>
689
-              </view>
690
-            </Block>
691
-          )}
722
+              </Block>
723
+            )}
692 724
 
693 725
           <text>备注</text>
694 726
           <view className="FormLine flex-h">