瀏覽代碼

分成数据的提交接口

Yannay 2 月之前
父節點
當前提交
a0b9d080cd
共有 1 個文件被更改,包括 45 次插入98 次删除
  1. 45 98
      pages/orderDetailNew/components/pageFour.vue

+ 45 - 98
pages/orderDetailNew/components/pageFour.vue

@@ -146,8 +146,7 @@
146 146
                         </u-col>
147 147
                         <u-col span="2">
148 148
                             <view class="table-cell">
149
-                                <view
150
-                                    :class="['account-type', item.accountType === 'frontend' ? 'frontend' : 'backend']"
149
+                                <view :class="['account-type', item.accountType == '1' ? 'frontend' : 'backend']"
151 150
                                     @click="toggleAccountType(item)" style="cursor: pointer;">
152 151
                                     {{ item.accountType == '1' ? '前' : '后' }}
153 152
                                 </view>
@@ -294,50 +293,7 @@ export default {
294 293
             },
295 294
             // 分成信息相关的数据
296 295
             profitSharingList: [
297
-                {
298
-                    searchValue: null,
299
-                    createBy: null,
300
-                    createTime: "2025-12-27 13:20:35",
301
-                    updateBy: null,
302
-                    updateTime: null,
303
-                    remark: null,
304
-                    params: {},
305
-                    id: "2004784451068899330",
306
-                    sendFormId: "5464",
307
-                    deptId: "",
308
-                    accountType: "1",
309
-                    userId: "",
310
-                    userName: "小石",
311
-                    commissionRate: 100.00,
312
-                    delFlag: null,
313
-                    clueId: null,
314
-                    receiptFormId: null,
315
-                    isCompanyPerformance: "2",
316
-                    orgName: "运营部",
317
-                    type: null,
318
-                    item: "测试发单-VV",
319
-                    phone: "18692257000",
320
-                    receiptNickName: "开发账号",
321
-                    commissionAmount: null,
322
-                    grossAmount: null,
323
-                    tableFee: "0",
324
-                    benefitFee: "0",
325
-                    freight: "0",
326
-                    checkCodeFee: "0",
327
-                    totalCost: "0",
328
-                    sellingPrice: "0",
329
-                    receiptDate: "2025-12-27 13:19:25",
330
-                    receiptItem: null,
331
-                    category: "首饰",
332
-                    brand: null,
333
-                    code: null,
334
-                    paymentMethod: null,
335
-                    customerServiceName: "其他",
336
-                    identificationName: null,
337
-                    identification: null,
338
-                    nickName: null,
339
-                    personOptions: []
340
-                }
296
+
341 297
             ],
342 298
             // 关联选项列表
343 299
             associationOptions: [],
@@ -367,17 +323,14 @@ export default {
367 323
         },
368 324
         // 添加分成行
369 325
         addSplit() {
370
-            // 生成唯一ID
371
-            const newId = Date.now() + '_' + (this.profitSharingList.length + 1);
372 326
             // 添加新行
373 327
             this.profitSharingList.push({
374
-                id: newId,
375
-                association: '',
376
-                accountType: 'frontend',
377
-                person: '',
328
+                deptId: '',
329
+                accountType: '1',
330
+                userId: '',
378 331
                 personOptions: [],
379 332
                 percentage: 0,
380
-                belongToCompany: false
333
+                isCompanyPerformance: '2'
381 334
             });
382 335
             // 重新计算所有行的比例
383 336
             this.recalculatePercentage();
@@ -407,7 +360,7 @@ export default {
407 360
         },
408 361
         // 切换账户类型
409 362
         toggleAccountType(item) {
410
-            item.accountType = item.accountType === 'frontend' ? 'backend' : 'frontend';
363
+            item.accountType = item.accountType == '1' ? '2' : '1';
411 364
             // 重新计算分成比例
412 365
             this.recalculatePercentage();
413 366
         },
@@ -430,7 +383,7 @@ export default {
430 383
         },
431 384
         // 切换归属公司状态
432 385
         toggleBelongToCompany(item) {
433
-            item.belongToCompany = !item.belongToCompany;
386
+            item.isCompanyPerformance = item.isCompanyPerformance == '1' ? '2' : '1';
434 387
         },
435 388
         // 关联选择变化时,更新分成人选项
436 389
         onAssociationChange(item) {
@@ -479,29 +432,29 @@ export default {
479 432
                 }
480 433
             }
481 434
 
482
-            // 校验前端分成比例总和必须是100%
483
-            const frontendTotal = this.profitSharingList
484
-                .filter(item => item.accountType === '1')
485
-                .reduce((sum, item) => sum + Number(item.commissionRate), 0);
486
-            if (frontendTotal !== 100) {
487
-                uni.showToast({
488
-                    title: '前端分成比例总和必须为100%',
489
-                    icon: 'none'
490
-                });
491
-                return false;
492
-            }
493
-
494
-            // 校验后端分成比例总和必须是100%
495
-            const backendTotal = this.profitSharingList
496
-                .filter(item => item.accountType === '2')
497
-                .reduce((sum, item) => sum + Number(item.commissionRate), 0);
498
-            if (backendTotal !== 100) {
499
-                uni.showToast({
500
-                    title: '后端分成比例总和必须为100%',
501
-                    icon: 'none'
502
-                });
503
-                return false;
504
-            }
435
+            // // 校验前端分成比例总和必须是100%
436
+            // const frontendTotal = this.profitSharingList
437
+            //     .filter(item => item.accountType === '1')
438
+            //     .reduce((sum, item) => sum + Number(item.commissionRate), 0);
439
+            // if (frontendTotal !== 100) {
440
+            //     uni.showToast({
441
+            //         title: '前端分成比例总和必须为100%',
442
+            //         icon: 'none'
443
+            //     });
444
+            //     return false;
445
+            // }
446
+
447
+            // // 校验后端分成比例总和必须是100%
448
+            // const backendTotal = this.profitSharingList
449
+            //     .filter(item => item.accountType === '2')
450
+            //     .reduce((sum, item) => sum + Number(item.commissionRate), 0);
451
+            // if (backendTotal !== 100) {
452
+            //     uni.showToast({
453
+            //         title: '后端分成比例总和必须为100%',
454
+            //         icon: 'none'
455
+            //     });
456
+            //     return false;
457
+            // }
505 458
 
506 459
             return true;
507 460
         },
@@ -552,35 +505,29 @@ export default {
552 505
 
553 506
         //添加分成比例
554 507
         async addProfitSharingList(data) {
555
-            await uni.$u.api.clueCommissionAdd(data);
508
+            if (data.id) {
509
+                //编辑
510
+                await uni.$u.api.clueCommissionUpdate(data);
511
+            } else {
512
+                //新增
513
+                await uni.$u.api.clueCommissionAdd(data);
514
+            }
556 515
         },
557 516
         addShare() {
558 517
             console.log('开始上传')
559
-            // 遍历分成比例列表
560 518
             this.profitSharingList.forEach(item => {
561
-                console.log(item, 'item')
562
-                // 调用添加分成比例接口
563 519
                 this.addProfitSharingList({
564
-                    // 账户类型:1(前端)/2(后端)
565
-                    accountType: item.accountType === 'frontend' ? 1 : 2,
566
-                    // 线索ID
520
+                    id: item.id,
521
+                    accountType: item.accountType == '1' ? 1 : 2,
567 522
                     clueId: this.receiptList[0].clueId,
568
-                    // 分成比例 数字
569
-                    commissionRate: item.percentage,
570
-                    // 主键ID  ???
571
-                    // id: item.id,
572
-                    // 是否归属公司 是1,否2
573
-                    isCompanyPerformance: item.belongToCompany ? 1 : 2,
574
-                    // 收据表单ID
575
-                    // receiptFormId: this.receiptList[0].id,
576
-                    // 发送表单ID
523
+                    commissionRate: item.commissionRate,
524
+                    isCompanyPerformance: item.isCompanyPerformance == '1' ? 1 : 2,
577 525
                     sendFormId: this.receiptList[0].sendFormId,
578
-                    // 用户ID
579
-                    userId: item.person,
580
-                    // 需要根据userId去关联选项列表中找
581
-                    userName: item.personOptions.find(opt => opt.id == item.person)?.label || '',
526
+                    userId: item.userId,
527
+                    userName: item.personOptions.find(opt => opt.id == item.userId)?.label || '',
582 528
                 });
583 529
             });
530
+            uni.$u.toast('上传成功')
584 531
         },
585 532
         //删除分成
586 533
         async deleteRow(id) {