lisenzhou 2 年前
父节点
当前提交
cd3cca4e99
共有 1 个文件被更改,包括 68 次插入34 次删除
  1. 68
    34
      src/subpackages/pages/marketing/changeVisit/index.jsx

+ 68
- 34
src/subpackages/pages/marketing/changeVisit/index.jsx 查看文件

39
     price: "",
39
     price: "",
40
     successDate: "",
40
     successDate: "",
41
     totalCommission: "", //佣金总额
41
     totalCommission: "", //佣金总额
42
-    currentCommission: 0, //本次结佣
42
+    currentCommission: "", //本次结佣
43
   });
43
   });
44
 
44
 
45
   const [FormData, setFormData] = useState({ ...RenChouData });
45
   const [FormData, setFormData] = useState({ ...RenChouData });
181
   // 进入页面带入当前客户的节点状态
181
   // 进入页面带入当前客户的节点状态
182
   useEffect(() => {
182
   useEffect(() => {
183
     if (channelCustomerInfo?.status && isFirst.current === 1) {
183
     if (channelCustomerInfo?.status && isFirst.current === 1) {
184
-      isFirst.current++
185
-      CutStatus(StatusList.filter((x) => x.id === channelCustomerInfo.status)[0])();
186
-      
184
+      isFirst.current++;
185
+      CutStatus(
186
+        StatusList.filter((x) => x.id === channelCustomerInfo.status)[0]
187
+      )();
187
     }
188
     }
188
   }, [channelCustomerInfo]);
189
   }, [channelCustomerInfo]);
189
 
190
 
250
   };
251
   };
251
 
252
 
252
   const ToSubmit = () => {
253
   const ToSubmit = () => {
254
+    // let params = {};
255
+    // for (let key in FormData) {
256
+    //   if (key !== "dividendsName" && key !== "dividendsPer") {
257
+    //     params[key] = { ...FormData }[key];
258
+    //     // console.log(
259
+    //     //   "🚀 ~ file: index.jsx ~ line 202 ~ ToSubmit ~ FormData",
260
+    //     //   FormData
261
+    //     // );
262
+    //   }
263
+    // }
264
+
265
+    // console.log(
266
+    //   params,
267
+    //   params.currentCommission,
268
+    //   Number(params.totalCommission || 0) -
269
+    //     Number(channelCustomerInfo?.channelCustomer?.settledCommission || 0) >=
270
+    //     Number(params.currentCommission || 0),
271
+    //   "params"
272
+    // );
273
+    // return;
253
     if (CurrentStatusId === 3) {
274
     if (CurrentStatusId === 3) {
254
       fetch({
275
       fetch({
255
         url: API_SURE_CHIP,
276
         url: API_SURE_CHIP,
282
       }
303
       }
283
       params.dividendsName = `${FormData.dividendsName}|${FormData.dividendsPer}%`;
304
       params.dividendsName = `${FormData.dividendsName}|${FormData.dividendsPer}%`;
284
 
305
 
285
-      console.log(
286
-        {
287
-          customerId: id,
288
-          customerSignatory: {
289
-            ...params,
290
-            channelId:
291
-              channelId === "null" || channelId === null ? "" : channelId,
292
-            channelCustomerId,
293
-          },
294
-          totalCommission: Number(params.totalCommission) * 100,
295
-          currentCommission: Number(params.currentCommission) * 100,
296
-        },
297
-        "]]]]"
298
-      );
306
+      if (
307
+        Number(params.totalCommission || 0) -
308
+          Number(channelCustomerInfo?.channelCustomer?.settledCommission || 0) <
309
+        Number(params.currentCommission || 0)
310
+      ) {
311
+        Taro.showToast({
312
+          title: "本次结佣金额不能大于剩余未结佣金额",
313
+          icon: "none",
314
+          duration: 3000,
315
+        });
316
+        return;
317
+      }
318
+
299
       fetch({
319
       fetch({
300
         url: API_SURE_SIGN,
320
         url: API_SURE_SIGN,
301
         method: "put",
321
         method: "put",
308
             channelCustomerId,
328
             channelCustomerId,
309
           },
329
           },
310
           totalCommission: Number(params.totalCommission) * 100,
330
           totalCommission: Number(params.totalCommission) * 100,
311
-          currentCommission: Number(params.currentCommission) * 100,
331
+          currentCommission: Number(params.currentCommission || 0) * 100,
312
         },
332
         },
313
       }).then(() => {
333
       }).then(() => {
314
         Taro.showToast({ title: "修改成功", icon: "none", duration: 2000 });
334
         Taro.showToast({ title: "修改成功", icon: "none", duration: 2000 });
324
         }
344
         }
325
       }
345
       }
326
       params.dividendsName = `${FormData.dividendsName}|${FormData.dividendsPer}%`;
346
       params.dividendsName = `${FormData.dividendsName}|${FormData.dividendsPer}%`;
347
+      if (
348
+        Number(params.totalCommission || 0) -
349
+          Number(channelCustomerInfo?.channelCustomer?.settledCommission || 0) <
350
+        Number(params.currentCommission || 0)
351
+      ) {
352
+        Taro.showToast({
353
+          title: "本次结佣金额不能大于剩余未结佣金额",
354
+          icon: "none",
355
+          duration: 3000,
356
+        });
357
+        return;
358
+      }
327
       fetch({
359
       fetch({
328
         url: API_SURE_BUY,
360
         url: API_SURE_BUY,
329
         method: "put",
361
         method: "put",
335
               channelId === "null" || channelId === null ? "" : channelId,
367
               channelId === "null" || channelId === null ? "" : channelId,
336
             channelCustomerId,
368
             channelCustomerId,
337
           },
369
           },
370
+
371
+          totalCommission: Number(params.totalCommission) * 100,
372
+          currentCommission: Number(params.currentCommission || 0) * 100,
338
         },
373
         },
339
       }).then(() => {
374
       }).then(() => {
340
         Taro.showToast({ title: "修改成功", icon: "none", duration: 2000 });
375
         Taro.showToast({ title: "修改成功", icon: "none", duration: 2000 });
354
         }
389
         }
355
       }
390
       }
356
       params.dividendsName = `${FormData.dividendsName}|${FormData.dividendsPer}%`;
391
       params.dividendsName = `${FormData.dividendsName}|${FormData.dividendsPer}%`;
392
+      if (
393
+        Number(params.totalCommission || 0) -
394
+          Number(channelCustomerInfo?.channelCustomer?.settledCommission || 0) <
395
+        Number(params.currentCommission || 0)
396
+      ) {
397
+        Taro.showToast({
398
+          title: "本次结佣金额不能大于剩余未结佣金额",
399
+          icon: "none",
400
+          duration: 3000,
401
+        });
402
+        return;
403
+      }
357
 
404
 
358
-      console.log(
359
-        {
360
-          customerId: id,
361
-          customerSignatory: {
362
-            ...params,
363
-            channelId:
364
-              channelId === "null" || channelId === null ? "" : channelId,
365
-            channelCustomerId,
366
-          },
367
-          totalCommission: Number(params.totalCommission) * 100,
368
-          currentCommission: Number(params.currentCommission) * 100,
369
-        },
370
-        "]]]]"
371
-      );
372
       fetch({
405
       fetch({
373
         url: API_SURE_ALLPAYMENT,
406
         url: API_SURE_ALLPAYMENT,
374
         method: "put",
407
         method: "put",
381
             channelCustomerId,
414
             channelCustomerId,
382
           },
415
           },
383
           totalCommission: Number(params.totalCommission) * 100,
416
           totalCommission: Number(params.totalCommission) * 100,
384
-          currentCommission: Number(params.currentCommission) * 100,
417
+          currentCommission: Number(params.currentCommission || 0) * 100,
385
         },
418
         },
386
       }).then(() => {
419
       }).then(() => {
387
         Taro.showToast({ title: "修改成功", icon: "none", duration: 2000 });
420
         Taro.showToast({ title: "修改成功", icon: "none", duration: 2000 });
600
                   <Input
633
                   <Input
601
                     type="number"
634
                     type="number"
602
                     placeholder="请输入金额"
635
                     placeholder="请输入金额"
636
+                    disabled={Number(channelCustomerInfo?.channelCustomer?.settledCommission||0) >0}
603
                     value={FormData.totalCommission}
637
                     value={FormData.totalCommission}
604
                     onInput={InputChange.bind(this, "totalCommission")}
638
                     onInput={InputChange.bind(this, "totalCommission")}
605
                   ></Input>
639
                   ></Input>