chenyidong 3 kuukautta sitten
vanhempi
commit
1c4153970d

+ 13 - 2
components/ba-tree-picker/ba-tree-picker.vue

@@ -267,7 +267,8 @@
267 267
 				if (parentItem) {
268 268
 					nextIndex = this.treeList.findIndex(item => item.id === parentItem.id) + 1;
269 269
 					parentId = parentItem.id;
270
-					initCheckStatus = parentItem.checkStatus == 2 ? 2 : 0;
270
+					// 当selectParent为false时,父节点状态不影响子节点
271
+				initCheckStatus = this.selectParent && parentItem.checkStatus == 2 ? 2 : 0;
271 272
 				}
272 273
 				list.forEach(item => {
273 274
 					let isLastLevel = true;
@@ -297,11 +298,14 @@
297 298
 					};
298 299
 					
299 300
 					if (this.selectedData.indexOf(itemT.id) >= 0) {
301
+					// 当selectParent为false时,只有叶子节点可以被初始选中
302
+					if (this.selectParent || itemT.isLastLevel) {
300 303
 						itemT.checkStatus = 2;
301 304
 						itemT.orCheckStatus = 2;
302 305
 						itemT.childCheckCount = itemT.children ? itemT.children.length : 0;
303 306
 						this._onItemParentSelect(itemT, nextIndex);
304 307
 					}
308
+				}
305 309
 
306 310
 					this.treeList.splice(nextIndex, 0, itemT);
307 311
 					nextIndex++;
@@ -347,6 +351,11 @@
347 351
 			},
348 352
 			// 节点选中、取消选中
349 353
 			_onItemSelect(item, index) {
354
+				// 当selectParent为false时,只允许选择叶子节点
355
+				if (!this.selectParent && !item.isLastLevel) {
356
+					return;
357
+				}
358
+				
350 359
 				// if(item.Pchildren !== void 0 && item.Pchildren.length > 0) return;
351 360
 				//console.log('_onItemSelect')
352 361
 				//console.log(item)
@@ -387,7 +396,9 @@
387 396
 						break;
388 397
 				}
389 398
 				//子节点 全部选中
390
-				this._onItemChildSelect(item, index);
399
+				if (this.selectParent) {
400
+					this._onItemChildSelect(item, index);
401
+				}
391 402
 				//父节点 选中状态变化
392 403
 				this._onItemParentSelect(item, index, oldCheckStatus);
393 404
 			},

+ 9 - 0
pages.json

@@ -223,6 +223,15 @@
223 223
 				"navigationBarBackgroundColor": "#108cff",
224 224
 				"navigationStyle": "custom"
225 225
 			}
226
+		},
227
+		{
228
+			"path": "pages/commissionForm/index",
229
+			"style": {
230
+				"navigationBarTitleText": "",
231
+				"enablePullDownRefresh": false,
232
+				"navigationBarBackgroundColor": "#108cff",
233
+				"navigationStyle": "custom"
234
+			}
226 235
 		}
227 236
 	],
228 237
 	"globalStyle": {

+ 261 - 0
pages/commissionForm/index.vue

@@ -0,0 +1,261 @@
1
+<template>
2
+  <view class="commission-form-page">
3
+    <u-navbar
4
+      placeholder
5
+      :autoBack="true"
6
+      :title="pageTitle"
7
+      @rightClick="submitForm"
8
+    >
9
+      <view class="u-nav-slot" slot="right"> 保存 </view>
10
+    </u-navbar>
11
+
12
+    <!-- 表单内容 -->
13
+    <view class="follow_form_wrap">
14
+      <u--form
15
+          labelPosition="left"
16
+          labelWidth="130"
17
+          :model="commissionForm"
18
+          :rules="rules"
19
+          ref="commissionFormRef"
20
+          class="form_wrap"
21
+          :errorType="'toast'"
22
+        >
23
+        <u-form-item label="账户类型" prop="accountType" borderBottom :required="true">
24
+          <ld-select
25
+            :list="accountTypeOptions"
26
+            label-key="label"
27
+            value-key="value"
28
+            placeholder="请选择账户类型"
29
+            v-model="commissionForm.accountType"
30
+            :border="false"
31
+          ></ld-select>
32
+          <u-icon slot="right" name="arrow-right"></u-icon>
33
+        </u-form-item>
34
+
35
+        <u-form-item label="分成人" prop="userName" borderBottom :required="true" @click="handleShowCommissionUser">
36
+          <u--input
37
+            v-model="commissionForm.userName"
38
+            disabled style='pointer-events: none !important'
39
+            disabledColor="#ffffff"
40
+            placeholder="点击选择"
41
+            border="none"
42
+          ></u--input>
43
+          <u-icon slot="right" name="arrow-right"></u-icon>
44
+        </u-form-item>
45
+
46
+        <u-form-item label="分成比例(%)" prop="commissionRate" borderBottom :required="true">
47
+          <u--input
48
+            v-model.number="commissionForm.commissionRate"
49
+            type="number"
50
+            placeholder="请输入分成比例(0-100)"
51
+            border="none"
52
+            @blur="validateCommissionRate"
53
+          ></u--input>
54
+        </u-form-item>
55
+
56
+        <u-form-item label="是否归属公司业绩" prop="isCompanyPerformance" borderBottom :required="true">
57
+          <ld-select
58
+            :list="companyPerformanceOptions"
59
+            label-key="label"
60
+            value-key="value"
61
+            placeholder="请选择是否归属公司业绩"
62
+            v-model="commissionForm.isCompanyPerformance"
63
+            :border="false"
64
+          ></ld-select>
65
+          <u-icon slot="right" name="arrow-right"></u-icon>
66
+        </u-form-item>
67
+
68
+        <u-form-item label="关联收单信息" prop="receiptFormId" borderBottom :required="true">
69
+          <ld-select
70
+            :list="receiptList"
71
+            label-key="item"
72
+            value-key="id"
73
+            placeholder="请选择收单信息"
74
+            v-model="commissionForm.receiptFormId"
75
+            :border="false"
76
+          ></ld-select>
77
+          <u-icon slot="right" name="arrow-right"></u-icon>
78
+        </u-form-item>
79
+      </u--form>
80
+    </view>
81
+
82
+    <!-- 分成人选择器 -->
83
+    <ba-tree-picker :selectParent="false" v-if="commissionUserList.length > 0" ref="commissionUser" :multiple='false'
84
+      @select-change="commissionUserSelectChange" border title="分成人" :localdata="commissionUserList" valueKey="id" textKey="label"
85
+      childrenKey="children" :selectedValues="commissionForm.userId" :personNames="commissionForm.userName" />
86
+  </view>
87
+</template>
88
+
89
+<script>
90
+import ldSelect from "@/components/ld-select/ld-select.vue";
91
+import { filterCustomerManager, handleTree } from '@/utils/util';
92
+
93
+export default {
94
+  name: "CommissionForm",
95
+  components: {
96
+    ldSelect
97
+  },
98
+  data() {
99
+    return {
100
+      loading: false,
101
+      commissionForm: {
102
+        id: undefined,
103
+        sendFormId: '',
104
+        clueId: '',
105
+        receiptFormId: '',
106
+        accountType: '1',
107
+        userName: '',
108
+        userId: '',
109
+        commissionRate: undefined,
110
+        isCompanyPerformance: '1'
111
+      },
112
+      receiptList: [],
113
+      commissionUserList: [],
114
+      accountTypeOptions: [
115
+        { label: "前端", value: "1" },
116
+        { label: "后端", value: "2" }
117
+      ],
118
+      companyPerformanceOptions: [
119
+        { label: "是", value: "1" },
120
+        { label: "否", value: "2" }
121
+      ],
122
+      // 表单验证规则
123
+      rules: {
124
+        accountType: [{ required: true, message: "请选择账户类型", trigger: "change" }],
125
+        userName: [{ required: true, message: "请选择分成人", trigger: "blur" }],
126
+        commissionRate: [
127
+          {
128
+            validator: (rule, value, callback) => {
129
+              if (value === undefined || value === null || value === '') {
130
+                callback(new Error("请输入分成比例"));
131
+              } else {
132
+                callback();
133
+              }
134
+            },
135
+            trigger: "blur"
136
+          },
137
+          { type: 'number', min: 0, max: 100, message: '分成比例必须在0-100之间', trigger: "blur" }
138
+        ],
139
+        isCompanyPerformance: [{ required: true, message: "请选择是否归属公司业绩", trigger: "change" }],
140
+        receiptFormId: [{ required: true, message: "请选择关联收单信息", trigger: "change" }]
141
+      },
142
+    };
143
+  },
144
+  computed: {
145
+    pageTitle() {
146
+      return this.commissionForm.id ? "编辑分成" : "新增分成";
147
+    },
148
+  },
149
+  onLoad(options) {
150
+    // 从路由参数获取sendFormId和clueId
151
+    this.commissionForm.sendFormId = options.sendFormId;
152
+    this.commissionForm.clueId = options.clueId;
153
+    this.commissionForm.id = options.id;
154
+    
155
+    // 获取分成人列表
156
+    this.getCommissionUserList();
157
+    
158
+    this.fetchReceiptList().then(() => {
159
+      if (options.id) {
160
+        this.initForm(options.id);
161
+      }
162
+    });
163
+  },
164
+  methods: {
165
+    // 获取分成人列表
166
+    getCommissionUserList() {
167
+      // 获取人员列表
168
+      uni.$u.api.getCustomerManagerAllList().then(res => {
169
+        this.commissionUserList = filterCustomerManager(res.data);
170
+      });
171
+    },
172
+    // 显示分成人选择器
173
+    handleShowCommissionUser() {
174
+      this.$refs.commissionUser._show();
175
+    },
176
+    // 分成人选择变化
177
+    commissionUserSelectChange(ids, names) {
178
+      this.commissionForm.userId = ids[0];
179
+      this.commissionForm.userName = names[0];
180
+    },
181
+    // 获取收单列表
182
+    async fetchReceiptList() {
183
+      try {
184
+        const res = await uni.$u.api.clueReceiptFormListByOrderId(this.commissionForm.sendFormId);
185
+        this.receiptList = res.data || [];
186
+      } catch (error) {
187
+        console.error("获取收单列表失败:", error);
188
+        uni.$u.toast("获取收单列表失败");
189
+      }
190
+    },
191
+    // 初始化表单数据
192
+    async initForm(id) {
193
+      try {
194
+        const res = await uni.$u.api.clueCommissionById(id);
195
+        this.commissionForm = res.data;
196
+      } catch (error) {
197
+        console.error("获取分成详情失败:", error);
198
+        uni.$u.toast("获取分成详情失败");
199
+      }
200
+    },
201
+    // 分成比例验证
202
+    validateCommissionRate() {
203
+      const { commissionRate } = this.commissionForm;
204
+      if (!commissionRate && commissionRate !== 0) return;
205
+      
206
+      const rate = Number(commissionRate);
207
+      if (rate < 0) {
208
+        uni.$u.toast("分成比例不能小于0");
209
+        this.commissionForm.commissionRate = 0;
210
+      } else if (rate > 100) {
211
+        uni.$u.toast("分成比例不能大于100");
212
+        this.commissionForm.commissionRate = 100;
213
+      }
214
+    },
215
+    // 提交表单
216
+    submitForm() {
217
+      this.$refs.commissionFormRef.validate().then(async (valid) => {
218
+        if (valid) {
219
+          await this.handleUpdate();
220
+        } else {
221
+          uni.$u.toast("请检查表单填写是否正确");
222
+        }
223
+      });
224
+    },
225
+    // 更新表单
226
+    async handleUpdate() {
227
+      try {
228
+        this.loading = true;
229
+
230
+        // 根据是否有id判断是新增还是修改
231
+        if (this.commissionForm.id) {
232
+          // 修改
233
+          await uni.$u.api.clueCommissionUpdate(this.commissionForm);
234
+          uni.$u.toast("修改成功");
235
+        } else {
236
+          // 新增
237
+          await uni.$u.api.clueCommissionAdd(this.commissionForm);
238
+          uni.$u.toast("新增成功");
239
+        }
240
+
241
+        // 延迟返回上一页
242
+        setTimeout(() => {
243
+          uni.navigateBack();
244
+        }, 1500);
245
+      } catch (error) {
246
+        console.error("保存失败:", error);
247
+        uni.$u.toast("保存失败,请重试");
248
+      } finally {
249
+        this.loading = false;
250
+      }
251
+    },
252
+  },
253
+};
254
+</script>
255
+
256
+<style lang="scss">
257
+.commission-form-page {
258
+  background-color: #fff;
259
+}
260
+@import "@/static/follow/index.scss";
261
+</style>

+ 46 - 40
pages/orderDetail/page/detail.vue

@@ -73,11 +73,14 @@
73 73
       </view>
74 74
     </view>
75 75
 
76
-        <!-- 跟进状态 -->
76
+    <!-- 跟进状态 -->
77 77
     <view class="order_action_wrap">
78 78
       <view class="action_title">状态:</view>
79
-      <view class="action_buttons" v-if="['1','2'].includes(receiptDetail.status)">
80
-        <u-button 
79
+      <view
80
+        class="action_buttons"
81
+        v-if="['1', '2'].includes(receiptDetail.status)"
82
+      >
83
+        <u-button
81 84
           v-if="receiptDetail.status === '1'"
82 85
           type="success"
83 86
           size="small"
@@ -85,7 +88,7 @@
85 88
           @click="handleOrderForm"
86 89
           customStyle="margin-right: 20rpx;"
87 90
         ></u-button>
88
-        <u-button 
91
+        <u-button
89 92
           v-if="receiptDetail.status === '2'"
90 93
           type="primary"
91 94
           size="small"
@@ -93,7 +96,7 @@
93 96
           @click="handleReceiptForm"
94 97
           customStyle="margin-right: 20rpx;"
95 98
         ></u-button>
96
-        <u-button 
99
+        <u-button
97 100
           v-if="receiptDetail.status === '2'"
98 101
           type="warning"
99 102
           size="small"
@@ -101,7 +104,7 @@
101 104
           @click="handleDenialForm"
102 105
           customStyle="margin-right: 20rpx;"
103 106
         ></u-button>
104
-        <u-button 
107
+        <u-button
105 108
           v-if="receiptDetail.status === '1'"
106 109
           type="error"
107 110
           size="small"
@@ -111,7 +114,7 @@
111 114
         ></u-button>
112 115
       </view>
113 116
       <view v-else class="last_status">
114
-         该订单{{ crmFollowStatusFormat(receiptDetail.status) }}不可再操作
117
+        该订单{{ crmFollowStatusFormat(receiptDetail.status) }}不可再操作
115 118
       </view>
116 119
     </view>
117 120
 
@@ -195,18 +198,10 @@
195 198
         ></upload-file>
196 199
       </template>
197 200
       <template #frontendFollow>
198
-        <clue-follow
199
-          :clueId="clueId"
200
-          ref="clueFollow"
201
-          type="4"
202
-        ></clue-follow>
201
+        <clue-follow :clueId="clueId" ref="clueFollow" type="4"></clue-follow>
203 202
       </template>
204 203
       <template #followRecord>
205
-        <clue-follow
206
-          :clueId="clueId"
207
-          ref="follow"
208
-          type="5"
209
-        ></clue-follow>
204
+        <clue-follow :clueId="clueId" ref="follow" type="5"></clue-follow>
210 205
       </template>
211 206
       <template #receiptInfo>
212 207
         <receipt-form-list
@@ -216,13 +211,13 @@
216 211
           ref="receiptFormList"
217 212
         ></receipt-form-list>
218 213
       </template>
219
-      <!-- <template #commissionInfo>
214
+      <template #commissionInfo>
220 215
         <commission-form-list
221
-          :sendFormId="receiptDetail.id"
222
-          :clueId="receiptDetail.clueId"
216
+          :sendFormId="orderId"
217
+          :clueId="clueId"
223 218
           ref="commissionFormList"
224 219
         ></commission-form-list>
225
-      </template> -->
220
+      </template>
226 221
     </yui-tabs>
227 222
 
228 223
     <u-tabbar
@@ -243,6 +238,11 @@
243 238
         @click="handleAddReceiptForm"
244 239
       ></u-tabbar-item>
245 240
       <u-tabbar-item
241
+        text="新增分成"
242
+        icon="../../static/orderDetail/add_commission.png"
243
+        @click="handleAddCommission"
244
+      ></u-tabbar-item>
245
+      <u-tabbar-item
246 246
         text="添加跟进"
247 247
         icon="../../static/caseDetail/icon-follow.png"
248 248
         @click="handleAddFollow"
@@ -273,13 +273,13 @@ import { selectDictLabel } from "@/utils/util";
273 273
 import uploadFile from "../tabs/uploadFile/index.vue";
274 274
 import clueFollow from "../tabs/followRecord/index.vue";
275 275
 import receiptFormList from "../tabs/receiptFormList/receiptFormList.vue";
276
-// import commissionFormList from "../tabs/commissionFormList/commissionFormList.vue";
276
+import commissionFormList from "../tabs/commissionFormList/commissionFormList.vue";
277 277
 export default {
278 278
   components: {
279 279
     uploadFile,
280 280
     clueFollow,
281 281
     receiptFormList,
282
-    // commissionFormList,
282
+    commissionFormList,
283 283
   },
284 284
   props: {
285 285
     orderId: {
@@ -307,10 +307,6 @@ export default {
307 307
       crmFormStateDict: [],
308 308
       crmHandelStatusDict: [],
309 309
       tabs: [
310
-         {
311
-          label: "收单信息",
312
-          slot: "receiptInfo",
313
-        },
314 310
         {
315 311
           label: "聊天附件",
316 312
           slot: "chatFile",
@@ -339,11 +335,14 @@ export default {
339 335
           label: "跟进记录",
340 336
           slot: "followRecord",
341 337
         },
342
-       
343
-        // {
344
-        //   label: "收单分成",
345
-        //   slot: "commissionInfo",
346
-        // },
338
+        {
339
+          label: "收单信息",
340
+          slot: "receiptInfo",
341
+        },
342
+        {
343
+          label: "收单分成",
344
+          slot: "commissionInfo",
345
+        },
347 346
       ],
348 347
       activeIndex: 0,
349 348
     };
@@ -391,7 +390,7 @@ export default {
391 390
       return text ? text : "-";
392 391
     },
393 392
     crmFormCategoryFormat(v) {
394
-      return v ?  selectDictLabel(this.crmFormCategoryDict, v) : "-";
393
+      return v ? selectDictLabel(this.crmFormCategoryDict, v) : "-";
395 394
     },
396 395
     crmFormTacticFormat(v) {
397 396
       return v ? selectDictLabel(this.crmFormTacticDict, v) : "-";
@@ -433,6 +432,12 @@ export default {
433 432
         url: `/pages/receiptForm/index?orderId=${this.orderId}&clueId=${this.clueId}`,
434 433
       });
435 434
     },
435
+    // 跳转到新增分成页面
436
+    handleAddCommission() {
437
+      uni.navigateTo({
438
+        url: `/pages/commissionForm/index?sendFormId=${this.orderId}&clueId=${this.clueId}`,
439
+      });
440
+    },
436 441
     handleUploadRecord() {
437 442
       uni.navigateTo({
438 443
         url: `/pages/uploadRecord/index?clueId=${this.orderId}`,
@@ -564,7 +569,8 @@ export default {
564 569
         });
565 570
     },
566 571
     getDetail() {
567
-      uni.$u.api.getClueSendFormVoByOrderId({
572
+      uni.$u.api
573
+        .getClueSendFormVoByOrderId({
568 574
           id: this.orderId,
569 575
         })
570 576
         .then((res) => {
@@ -628,9 +634,9 @@ export default {
628 634
 
629 635
   .action_title {
630 636
     font-size: 16px;
631
-    flex : 0 0 50px;
637
+    flex: 0 0 50px;
632 638
   }
633
-  .last_status{
639
+  .last_status {
634 640
     color: #c0c0c7;
635 641
     font-size: 14px;
636 642
   }
@@ -639,7 +645,7 @@ export default {
639 645
     display: grid;
640 646
     grid-template-columns: repeat(2, 1fr);
641 647
     gap: 10px;
642
-    
648
+
643 649
     ::v-deep .u-button {
644 650
       height: 30px !important;
645 651
       font-size: 12px !important;
@@ -656,20 +662,20 @@ export default {
656 662
         color: white !important;
657 663
         border-color: #ffd025 !important;
658 664
       }
659
-      
665
+
660 666
       // 特别样式化不同按钮类型
661 667
       &.u-button--primary {
662 668
         background: #35dbd9 !important;
663 669
         color: white !important;
664 670
         border-color: #35dbd9 !important;
665 671
       }
666
-      
672
+
667 673
       &.u-button--warning {
668 674
         background: #ba9fb0 !important;
669 675
         color: white !important;
670 676
         border-color: #ba9fb0 !important;
671 677
       }
672
-      
678
+
673 679
       &.u-button--error {
674 680
         background: #e53e3e !important;
675 681
         color: white !important;

+ 67 - 299
pages/orderDetail/tabs/commissionFormList/commissionFormList.vue

@@ -1,9 +1,6 @@
1 1
 <template>
2 2
 	<view class="commission-form-list">
3
-		<!-- 头部按钮组 -->
4
-		<view class="commission-header">
5
-			<u-button type="primary" size="mini" icon="plus" @click="handleAdd">新增分成</u-button>
6
-		</view>
3
+		
7 4
 
8 5
 		<!-- 分成信息卡片列表 -->
9 6
 		<view v-if="loading" class="loading_wrap">
@@ -13,336 +10,107 @@
13 10
 			<u-empty text="暂无分成数据"></u-empty>
14 11
 		</view>
15 12
 		<view v-else class="card_list">
16
-			<view class="card_item" v-for="(row, index) in commissionList" :key="row.id">
17
-				<view class="card_header">
18
-					<view class="card_title">{{ row.userName || '-' }}</view>
19
-					<view class="card_actions">
20
-						<u-button size="mini" type="text" @click="handleEdit(row)">编辑</u-button>
21
-						<u-button size="mini" type="text" @click="handleDelete(row.id)" style="color: #f56c6c">删除</u-button>
22
-					</view>
23
-				</view>
24
-				<view class="card_body">
25
-					<view class="info_row">
26
-						<view class="info_label">公司:</view>
27
-						<view class="info_value">{{ row.orgName || '-' }}</view>
28
-					</view>
29
-					<view class="info_row">
30
-						<view class="info_label">账户类型:</view>
31
-						<view class="info_value">{{ row.accountType === '1' ? '前端' : '后端' }}</view>
32
-					</view>
33
-					<view class="info_row">
34
-						<view class="info_label">分成比例:</view>
35
-						<view class="info_value highlight">{{ row.commissionRate || '0' }}%</view>
36
-					</view>
37
-					<view class="info_row">
38
-						<view class="info_label">创建时间:</view>
39
-						<view class="info_value">{{ formatTime(row.createTime) }}</view>
40
-					</view>
41
-				</view>
42
-			</view>
13
+			<commission-item v-for="(row) in commissionList" :key="row.id" :item="row" :type="'2'" @click.native="handleEdit(row)"></commission-item>
43 14
 		</view>
44
-
45
-		<!-- 分页组件 -->
46
-		<u-pagination
47
-			v-if="total > 0"
48
-			:total="total"
49
-			:current="queryParams.pageNum"
50
-			:page-size="queryParams.pageSize"
51
-			@change="handlePageChange"
52
-			:page-sizes="[10, 20, 50, 100]"
53
-			:show-total="true"
54
-		></u-pagination>
55
-
56
-		<!-- 新增/编辑对话框 -->
57
-		<u-popup v-model="dialogVisible" mode="center" width="500rpx" border-radius="16">
58
-			<view class="dialog_header">{{ dialogTitle }}</view>
59
-			<view class="dialog_body">
60
-				<u-form :model="commissionForm" ref="commissionFormRef" label-width="120rpx">
61
-					<u-form-item label="账户类型" prop="accountType" :required="true">
62
-						<u-radio-group v-model="commissionForm.accountType" :disabled="!isEdit">
63
-							<u-radio name="1" label="前端"></u-radio>
64
-							<u-radio name="2" label="后端"></u-radio>
65
-						</u-radio-group>
66
-					</u-form-item>
67
-					<u-form-item label="分成人" prop="userName" :required="true">
68
-						<u-input v-model="commissionForm.userName" placeholder="请选择分成人" :disabled="!isEdit" />
69
-					</u-form-item>
70
-					<u-form-item label="分成比例(%)" prop="commissionRate" :required="true">
71
-						<u-input v-model.number="commissionForm.commissionRate" type="number" placeholder="请输入分成比例(0-100)" />
72
-					</u-form-item>
73
-				</u-form>
74
-			</view>
75
-			<view class="dialog_footer">
76
-				<u-button @click="handleClose">取消</u-button>
77
-				<u-button type="primary" @click="handleSubmit">确定</u-button>
78
-			</view>
79
-		</u-popup>
80 15
 	</view>
81 16
 </template>
82 17
 
83 18
 <script>
84
-export default {
85
-	name: 'CommissionFormList',
86
-	props: {
87
-		sendFormId: {
88
-			type: [Number, String],
89
-			required: true
19
+	import commissionItem from "@/pages/order/components/commission/commissionItem.vue";
20
+
21
+	export default {
22
+		name: 'CommissionFormList',
23
+		components: {
24
+			commissionItem
90 25
 		},
91
-		clueId: {
92
-			type: [Number, String],
93
-			required: true
94
-		}
95
-	},
96
-	data() {
97
-		return {
98
-			commissionList: [],
99
-			total: 0,
100
-			loading: false,
101
-			queryParams: {
102
-				pageNum: 1,
103
-				pageSize: 10
104
-			},
105
-			dialogVisible: false,
106
-			dialogTitle: '新增分成',
107
-			isEdit: true,
108
-			commissionForm: {
109
-				id: null,
110
-				sendFormId: null,
111
-				clueId: null,
112
-				accountType: '1',
113
-				userName: null,
114
-				userId: null,
115
-				commissionRate: 0
26
+		props: {
27
+			sendFormId: {
28
+				type: [Number, String],
29
+				required: true
116 30
 			},
117
-			rules: {
118
-				accountType: [{ required: true, message: '请选择账户类型', trigger: 'change' }],
119
-				userName: [{ required: true, message: '请选择分成人', trigger: 'blur' }],
120
-				commissionRate: [
121
-					{ required: true, message: '请输入分成比例', trigger: 'blur' },
122
-					{ type: 'number', min: 0, max: 100, message: '分成比例必须在0-100之间', trigger: 'blur' }
123
-				]
31
+			clueId: {
32
+				type: [Number, String],
33
+				required: true
124 34
 			}
125
-		}
126
-	},
127
-	methods: {
128
-		async getList() {
35
+		},
36
+		data() {
37
+			return {
38
+				commissionList: [],
39
+				loading: false
40
+			}
41
+		},
42
+		methods: {
43
+			async getList() {
129 44
 			this.loading = true
130 45
 			try {
131
-				const params = {
132
-					...this.queryParams,
46
+				const data = {
133 47
 					sendFormId: this.sendFormId,
48
+					type: '1'
134 49
 				}
135
-				const res = await uni.$u.api.clueCommissionForm.list(params)
50
+				const res = await uni.$u.api.selectCommissionList({}, data);
136 51
 				this.commissionList = res.rows || []
137
-				this.total = res.total || 0
138 52
 			} catch (error) {
139 53
 				uni.$u.toast('获取分成列表失败')
140 54
 			} finally {
141 55
 				this.loading = false
142 56
 			}
143 57
 		},
144
-		// 格式化时间
145
-		formatTime(time) {
146
-			if (!time) return '-'
147
-			const date = new Date(time)
148
-			const year = date.getFullYear()
149
-			const month = String(date.getMonth() + 1).padStart(2, '0')
150
-			const day = String(date.getDate()).padStart(2, '0')
151
-			const hours = String(date.getHours()).padStart(2, '0')
152
-			const minutes = String(date.getMinutes()).padStart(2, '0')
153
-			const seconds = String(date.getSeconds()).padStart(2, '0')
154
-			return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
155
-		},
156
-		handleAdd() {
157
-			this.dialogTitle = '新增分成'
158
-			this.commissionForm = {
159
-				id: null,
160
-				sendFormId: this.sendFormId,
161
-				clueId: this.clueId,
162
-				accountType: '1',
163
-				userName: null,
164
-				userId: null,
165
-				commissionRate: 0
166
-			}
167
-			this.$nextTick(() => {
168
-				if (this.$refs.commissionFormRef) {
169
-					this.$refs.commissionFormRef.clearValidate()
170
-				}
171
-			})
172
-			this.dialogVisible = true
173
-		},
174 58
 		handleEdit(row) {
175
-			this.dialogTitle = '编辑分成'
176
-			// 深拷贝对象,避免直接修改原数据
177
-			this.commissionForm = JSON.parse(JSON.stringify(row))
178
-			this.dialogVisible = true
179
-		},
180
-		handleDelete(id) {
181
-			uni.showModal({
182
-				title: '警告',
183
-				content: '确定要删除这条分成记录吗?删除后将无法恢复!',
184
-				confirmButtonText: '确定删除',
185
-				cancelButtonText: '取消',
186
-				success: (res) => {
187
-					if (res.confirm) {
188
-						this.deleteRow(id)
189
-					}
190
-				}
59
+			// 跳转到编辑分成页面
60
+			uni.navigateTo({
61
+				url: `/pages/commissionForm/index?sendFormId=${this.sendFormId}&clueId=${this.clueId}&id=${row.id}`
191 62
 			})
192 63
 		},
193
-		async deleteRow(id) {
194
-			try {
195
-				await uni.$u.api.clueCommissionForm.remove([id])
196
-				uni.$u.toast('删除成功')
197
-				this.getList()
198
-			} catch (error) {
199
-				uni.$u.toast('删除失败,请稍后重试')
200
-			}
201
-		},
202
-		handleSubmit() {
203
-			this.$refs.commissionFormRef.validate(async (valid) => {
204
-				if (valid) {
205
-					// 显示加载状态
206
-					const loading = uni.showLoading({
207
-						title: this.commissionForm.id ? '编辑中...' : '新增中...',
208
-						mask: true
209
-					})
210
-
211
-					try {
212
-						if (this.commissionForm.id) {
213
-							await uni.$u.api.clueCommissionForm.update(this.commissionForm)
214
-							uni.$u.toast('编辑成功')
215
-						} else {
216
-							await uni.$u.api.clueCommissionForm.add(this.commissionForm)
217
-							uni.$u.toast('新增成功')
64
+			handleDelete(id) {
65
+				uni.showModal({
66
+					title: '警告',
67
+					content: '确定要删除这条分成记录吗?删除后将无法恢复!',
68
+					confirmButtonText: '确定删除',
69
+					cancelButtonText: '取消',
70
+					success: (res) => {
71
+						if (res.confirm) {
72
+							this.deleteRow(id)
218 73
 						}
219
-						this.dialogVisible = false
220
-						this.getList()
221
-					} catch (error) {
222
-						uni.$u.toast('操作失败,请重试')
223
-					} finally {
224
-						uni.hideLoading(loading)
225 74
 					}
75
+				})
76
+			},
77
+			async deleteRow(id) {
78
+				try {
79
+					await uni.$u.api.clueCommissionForm.remove([id])
80
+					uni.$u.toast('删除成功')
81
+					this.getList()
82
+				} catch (error) {
83
+					uni.$u.toast('删除失败,请稍后重试')
226 84
 				}
227
-			})
228
-		},
229
-		handleClose() {
230
-			this.dialogVisible = false
231
-			// 关闭对话框后重置表单
232
-			this.$nextTick(() => {
233
-				if (this.$refs.commissionFormRef) {
234
-					this.$refs.commissionFormRef.clearValidate()
235
-				}
236
-			})
85
+			},
86
+			// 外部调用获取列表
87
+			getListByExternal() {
88
+				this.getList()
89
+			}
237 90
 		},
238
-		handlePageChange(page) {
239
-			this.queryParams.pageNum = page
91
+		created() {
240 92
 			this.getList()
241 93
 		},
242
-		// 外部调用获取列表
243
-		getListByExternal() {
94
+		// 监听页面显示,刷新列表数据
95
+		onShow() {
244 96
 			this.getList()
245 97
 		}
246
-	},
247
-	created() {
248
-		this.getList()
249 98
 	}
250
-}
251 99
 </script>
252 100
 
253 101
 <style lang="scss" scoped>
254
-.commission-form-list {
255
-	padding: 0 20px 20px;
256
-}
257
-
258
-.commission-header {
259
-	margin-bottom: 16px;
260
-}
261
-
262
-.card_list {
263
-	display: flex;
264
-	flex-direction: column;
265
-	gap: 16px;
266
-}
267
-
268
-.card_item {
269
-	background-color: #fff;
270
-	border-radius: 12px;
271
-	padding: 20px;
272
-	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
273
-}
274
-
275
-.card_header {
276
-	display: flex;
277
-	justify-content: space-between;
278
-	align-items: center;
279
-	margin-bottom: 16px;
280
-	padding-bottom: 12px;
281
-	border-bottom: 1px solid #f0f0f0;
282
-}
283
-
284
-.card_title {
285
-	font-size: 18px;
286
-	font-weight: bold;
287
-	color: #202020;
288
-}
289
-
290
-.card_actions {
291
-	display: flex;
292
-	gap: 8px;
293
-}
294
-
295
-.card_body {
296
-	display: flex;
297
-	flex-direction: column;
298
-	gap: 12px;
299
-}
300
-
301
-.info_row {
302
-	display: flex;
303
-	align-items: center;
304
-	font-size: 14px;
305
-}
306
-
307
-.info_label {
308
-	color: #666;
309
-	min-width: 80px;
310
-	font-weight: 500;
311
-}
312
-
313
-.info_value {
314
-	color: #202020;
315
-	flex: 1;
316
-	
317
-	&.highlight {
318
-		color: #108cff;
319
-		font-weight: bold;
320
-		font-size: 16px;
102
+	.commission-form-list {
103
+		padding: 20px 20px 20px;
104
+		background: #f5f6f8;
321 105
 	}
322
-}
323
-
324
-.loading_wrap,
325
-.empty_wrap {
326
-	padding: 40px 20px;
327
-	text-align: center;
328
-}
329
-
330
-.dialog_header {
331
-	padding: 20px;
332
-	font-size: 32rpx;
333
-	font-weight: bold;
334
-	text-align: center;
335
-	border-bottom: 1px solid #e9ecef;
336
-}
337 106
 
338
-.dialog_body {
339
-	padding: 20px;
340
-}
107
+	.commission-header {
108
+		margin-bottom: 16px;
109
+	}
341 110
 
342
-.dialog_footer {
343
-	padding: 20px;
344
-	display: flex;
345
-	justify-content: space-around;
346
-	border-top: 1px solid #e9ecef;
347
-}
111
+	.loading_wrap,
112
+	.empty_wrap {
113
+		padding: 40px 20px;
114
+		text-align: center;
115
+	}
348 116
 </style>

+ 6 - 0
utils/api.js

@@ -103,6 +103,12 @@ const install = (Vue, vm) => {
103 103
 		getReceiptForm:(id,config={})=>http.get(store.state.user.path + '/clueReceiptForm/' + id),
104 104
 		delReceiptForm:(id,config={})=>http.delete(store.state.user.path + '/clueReceiptForm/' + id),
105 105
 		saveClueOrderForm:(data={})=>http.post(store.state.user.path + '/clueSendForm/saveClueOrderForm',data),
106
+		clueReceiptFormListByOrderId:(orderId,config={})=>http.get(store.state.user.path + '/clueReceiptForm/listByOrderId/' + orderId),
107
+		clueCommissionAdd: (data={})=>http.post(store.state.user.path + '/clueCommissionForm',data),
108
+		clueCommissionUpdate: (data={})=>http.put(store.state.user.path + '/clueCommissionForm',data),
109
+		clueCommissionById: (id,config={})=>http.get(store.state.user.path + '/clueCommissionForm/' + id),
110
+		clueCommissionRemove: (ids,config={})=>http.post(store.state.user.path + '/clueCommissionForm/remove',ids),
111
+		getCustomerManagerAllList: ()=>http.post('/system/user/getCustomerManagerAllList')
106 112
 	}
107 113
 }
108 114