Ver código fonte

增加打标签功能

Yannay 2 meses atrás
pai
commit
73e666f6d0

+ 30 - 15
pages/orderDetailNew/components/orderDetailNewView.vue

@@ -10,12 +10,12 @@
10 10
         </view>
11 11
         <view class="page-item" v-show="activeIndex === 2">
12 12
             <pageThree @handleNextClick="handleNextClick" :orderDetail="detail" @handleNeedSave="handleNeedSave"
13
-                :receiptList="receiptList" @handleConfirmPay="handleConfirmPay" ref="pageThreeComp"
13
+                :currentReceipt="currentReceiptInner" @handleConfirmPay="handleConfirmPay" ref="pageThreeComp"
14 14
                 :orderId="orderId" />
15 15
         </view>
16 16
         <view class="page-item" v-show="activeIndex === 3">
17 17
             <pageFour @confirmInterStore="confirmInterStore" @handleNextClick="handleNextClick" :orderDetail="detail"
18
-                :receiptList="receiptList" />
18
+                :currentReceipt="currentReceiptInner" />
19 19
         </view>
20 20
 
21 21
         <ul class="page">
@@ -43,7 +43,11 @@ export default {
43 43
         orderId: {
44 44
             type: String,
45 45
             default: ''
46
-        }
46
+        },
47
+        currentReceipt: {
48
+            type: Object,
49
+            default: () => { },
50
+        },
47 51
     },
48 52
     components: {
49 53
         pageOne,
@@ -63,12 +67,15 @@ export default {
63 67
             },
64 68
             pageThreeForm: {},
65 69
             fileIds: '',
66
-            //收件信息page4
70
+            //收件信息page4,page3
67 71
             receiptList: [],
68 72
             //订单细节
69 73
             orderDetail: {},
70 74
             // 跟进记录
71 75
             followUpList: [],
76
+
77
+            //当前选中的收单订单
78
+            currentReceiptInner: {},
72 79
         }
73 80
     },
74 81
     name: 'OrderDetailNewView',
@@ -76,7 +83,7 @@ export default {
76 83
         orderId: {
77 84
             handler(newVal) {
78 85
                 if (newVal) {
79
-                    this.fetchReceiptList();
86
+                    // this.fetchReceiptList();
80 87
                 }
81 88
             }, immediate: true
82 89
         },
@@ -88,6 +95,14 @@ export default {
88 95
                 }
89 96
             },
90 97
             deep: true,
98
+        },
99
+        currentReceipt: {
100
+            handler(newVal) {
101
+                if (newVal) {
102
+                    this.currentReceiptInner = newVal;
103
+                    console.log('当前选中的收单订单里面', this.currentReceiptInner)
104
+                }
105
+            }
91 106
         }
92 107
 
93 108
     },
@@ -238,16 +253,16 @@ export default {
238 253
 
239 254
         },
240 255
         // 获取收单列表
241
-        async fetchReceiptList() {
242
-            try {
243
-                const res = await uni.$u.api.clueReceiptFormListByOrderId(this.orderId);
244
-                console.log('这里是收件列表', res)
245
-                this.receiptList = res.data || [];
246
-            } catch (error) {
247
-                console.error("获取收单列表失败:", error);
248
-                uni.$u.toast("获取收单列表失败");
249
-            }
250
-        },
256
+        // async fetchReceiptList() {
257
+        //     try {
258
+        //         const res = await uni.$u.api.clueReceiptFormListByOrderId(this.orderId);
259
+        //         console.log('这里是收件列表', res.data)
260
+        //         this.receiptList = res.data || [];
261
+        //     } catch (error) {
262
+        //         console.error("获取收单列表失败:", error);
263
+        //         uni.$u.toast("获取收单列表失败");
264
+        //     }
265
+        // },
251 266
 
252 267
         //获取跟进记录
253 268
         async getFollowUpList() {

+ 10 - 9
pages/orderDetailNew/components/pageFour.vue

@@ -226,16 +226,17 @@ export default {
226 226
             type: Object,
227 227
             default: () => { },
228 228
         },
229
-        receiptList: {
230
-            type: Array,
229
+        currentReceipt: {
230
+            type: Object,
231 231
             default: () => { },
232 232
         },
233 233
     },
234 234
 
235 235
     watch: {
236
-        receiptList: {
236
+        currentReceipt: {
237 237
             handler(newVal) {
238 238
                 if (newVal) {
239
+                    console.log('这里是page4', newVal)
239 240
                     // "searchValue": null,
240 241
                     // "createBy": "12234",
241 242
                     // "createTime": "2025-12-25 13:39:25",
@@ -275,11 +276,11 @@ export default {
275 276
                     // "bankCardNumber": "333",
276 277
                     // "bankName": "222",
277 278
                     // "customName": "111"
278
-                    const data = newVal[0]
279
+                    const data = newVal
279 280
                     this.warehouseInfo = {
280 281
                         codeStorage: data.code,//编码
281 282
                         expressOrderNo: data.expressOrderNo || '',//快递单号
282
-                        uploadedImage: data.receiptRemark.split(';')[1] || '',//物流图片 截取备注第二部分
283
+                        uploadedImage: data.receiptRemark?.split(';')[1] || '',//物流图片 截取备注第二部分
283 284
                         item: data.item || '',//收单物品
284 285
                         checkCodeFee: data.checkCodeFee || '',//查码费
285 286
                         watchPrice: data.tableFee || '',//表款
@@ -287,7 +288,7 @@ export default {
287 288
                         freight: data.freight || '',//运费
288 289
                         repairAmount: data.repairAmount || '',//维修金额
289 290
                         grossPerformance: data.grossPerformance || '',//毛业绩
290
-                        remarks: data.receiptRemark.split(';')[0] || '',//收单备注  截取备注第一部分
291
+                        remarks: data.receiptRemark?.split(';')[0] || '',//收单备注  截取备注第一部分
291 292
                     }
292 293
                     this.$nextTick(() => {
293 294
                         this.getList()
@@ -439,7 +440,7 @@ export default {
439 440
             const { rows, total } = await uni.$u.api.selectCommissionList({
440 441
                 pageSize: 9999,
441 442
                 pageNum: 1,
442
-            }, { sendFormId: this.receiptList[0].sendFormId, });
443
+            }, { sendFormId: this.currentReceipt.sendFormId, });
443 444
             console.log('分成比例表格数据', rows)
444 445
             this.profitSharingList = rows
445 446
         },
@@ -455,10 +456,10 @@ export default {
455 456
                 const data = {
456 457
                     id: item.id || '',
457 458
                     accountType: item.accountType == '1' ? 1 : 2,
458
-                    clueId: this.receiptList[0].clueId,
459
+                    clueId: this.currentReceipt.clueId,
459 460
                     commissionRate: item.commissionRate,
460 461
                     isCompanyPerformance: item.isCompanyPerformance == '1' ? 1 : 2,
461
-                    sendFormId: this.receiptList[0].sendFormId,
462
+                    sendFormId: this.currentReceipt.sendFormId,
462 463
                     userId: item.userId,
463 464
                     userName: item.userName,
464 465
                 }

+ 5 - 5
pages/orderDetailNew/components/pageThree.vue

@@ -150,8 +150,8 @@ export default {
150 150
             type: String,
151 151
             default: '',
152 152
         },
153
-        receiptList: {
154
-            type: Array,
153
+        currentReceipt: {
154
+            type: Object,
155 155
             default: () => { },
156 156
         },
157 157
     },
@@ -169,11 +169,11 @@ export default {
169 169
             },
170 170
             deep: true,
171 171
         },
172
-        receiptList: {
172
+        currentReceipt: {
173 173
             handler(newVal) {
174 174
                 if (newVal) {
175
-                    console.log('这里是page3的', newVal[0].tableFee)
176
-                    this.paymentAmount = newVal[0].tableFee || '0.00'
175
+                    console.log('这里是page3的', newVal.tableFee)
176
+                    this.paymentAmount = newVal.tableFee || '0.00'
177 177
                 }
178 178
             },
179 179
             deep: true,

+ 39 - 2
pages/orderDetailNew/index.vue

@@ -19,7 +19,12 @@
19 19
             </template>
20 20
         </u-navbar>
21 21
 
22
-        <orderDetailNewView :detail="receiptDetail" :topInfo="topInfo" :orderId="orderId" />
22
+        <u-sticky bgColor="#fff">
23
+            <u-tabs keyName="brand" :list="receiptList" @click="clickReceipt"></u-tabs>
24
+        </u-sticky>
25
+
26
+        <orderDetailNewView :detail="receiptDetail" :topInfo="topInfo" :orderId="orderId"
27
+            :currentReceipt="currentReceipt" />
23 28
 
24 29
         <!-- 通用模态窗 -->
25 30
         <custom-modal :visible="modalVisible" :title="modalConfig.title" :value="modalConfig.value"
@@ -56,6 +61,11 @@ export default {
56 61
             clueId: '',
57 62
             // 订单详情
58 63
             receiptDetail: {},
64
+
65
+            //接单单个订单的receiptList
66
+            receiptList: [],
67
+            //当前选中的收单订单
68
+            currentReceipt: {}
59 69
         }
60 70
     },
61 71
     onLoad(option) {
@@ -69,6 +79,8 @@ export default {
69 79
 
70 80
         //查询订单详情
71 81
         this.getOrderDetail();
82
+        //获取收单列表
83
+        this.getReceiptList();
72 84
     },
73 85
     methods: {
74 86
         handleBrandClick() {
@@ -105,7 +117,20 @@ export default {
105 117
             this.currentEditField = ''
106 118
         },
107 119
         handleAddClick() {
120
+
108 121
             console.log('加一单')
122
+            //判断如果当前有收单的id是‘’的话,说明是新增的收单订单
123
+            if (this.receiptList.some(item => item.id === '')) {
124
+                uni.$u.toast('请先保存新增的收单订单')
125
+                return
126
+            }
127
+
128
+            this.receiptList.push({
129
+                "id": "",//订单id
130
+                "sendFormId": this.orderId,
131
+                "clueId": this.clueId,
132
+                "brand": "新加一单",
133
+            });
109 134
         },
110 135
 
111 136
         //查询订单详情
@@ -114,10 +139,22 @@ export default {
114 139
                 .getClueSendFormVoByOrderId({
115 140
                     id: this.orderId,
116 141
                 })
117
-            console.log('订单详情', res);
142
+            console.log('订单详情', res.data);
118 143
             if (res.code === 200) {
119 144
                 this.receiptDetail = res.data;
120 145
             }
146
+        },
147
+        //获取收单列表
148
+        async getReceiptList() {
149
+            const res = await uni.$u.api.clueReceiptFormListByOrderId(this.orderId);
150
+            console.log('这里是收件列表page', res)
151
+            if (res.code === 200) {
152
+                this.receiptList = res.data || [];
153
+            }
154
+        },
155
+        clickReceipt(item) {
156
+            // console.log('点击了', item);
157
+            this.currentReceipt = item;
121 158
         }
122 159
     }
123 160
 }

+ 66 - 7
pages/pagereceivecenter/pagereceivecenter.vue

@@ -13,6 +13,10 @@ export default {
13 13
                 pageNum: 1,
14 14
                 total: 0
15 15
             },
16
+            tagModalVisible: false,
17
+            tagList: [],
18
+            currentTags: [],
19
+            currentOrder: {}
16 20
         }
17 21
     },
18 22
     onLoad() {
@@ -55,9 +59,20 @@ export default {
55 59
                 //去接单
56 60
                 console.log('去接单', order)
57 61
 
58
-                //跳转接单form
59
-                uni.navigateTo({
60
-                    url: `/pages/orderDetailNew/index?orderId=${order.id}&item=${order.item}&type=${this.type}&clueId=${order.clueId}`,
62
+                //打开模态窗二次确认,确认后跳转接单form
63
+                uni.showModal({
64
+                    title: '确认接单',
65
+                    content: `是否确认接单订单:${order.item}?`,
66
+                    success: (res) => {
67
+                        if (res.confirm) {
68
+                            uni.navigateTo({
69
+                                url: `/pages/orderDetailNew/index?orderId=${order.id}&item=${order.item}&type=${this.type}&clueId=${order.clueId}`,
70
+                            })
71
+                        } else if (res.cancel) {
72
+                            // 用户点击了取消,不执行任何操作
73
+                            uni.$u.toast('已取消接单');
74
+                        }
75
+                    }
61 76
                 })
62 77
             } else if (btnType == 'isBusy') {
63 78
                 //在忙
@@ -74,6 +89,11 @@ export default {
74 89
             } else if (btnType == 'tag') {
75 90
                 //打标签
76 91
                 console.log('打标签', order)
92
+                //打开模态窗
93
+                this.tagModalVisible = true;
94
+                this.getAllTags();
95
+                this.currentTags = order.tags.map(tag => tag.id);
96
+                this.currentOrder = order
77 97
             } else if (btnType == 'share') {
78 98
                 //一键分享
79 99
                 console.log('一键分享', order)
@@ -84,11 +104,19 @@ export default {
84 104
         },
85 105
         // 跳转订单详情
86 106
         toOrderDetail(order) {
107
+            //点卡片看详情
108
+            // if (order.status == '1' || order.status == '2') {
87 109
             uni.navigateTo({
88 110
                 url: `/pages/orderDetailNew/index?orderId=${order.id}&item=${order.item}&type=${this.type}&clueId=${order.clueId}`,
89 111
             })
112
+            // } else {
113
+            //     uni.$u.toast('当前订单无法查看详情');
114
+            //     return;
115
+            // }
116
+
117
+
90 118
         },
91
-        
119
+
92 120
         //滑动加载
93 121
         scrolltolower() {
94 122
             console.log('到底了');
@@ -99,6 +127,26 @@ export default {
99 127
             this.getOrderList();
100 128
         },
101 129
 
130
+        //获取全部标签
131
+        async getAllTags() {
132
+            const res = await uni.$u.api.getClueTagGroupVoList({ tagGroupApplication: '2' })
133
+            console.log('全部标签', res.data[0].clueTagDataList)
134
+            this.tagList = res.data[0].clueTagDataList;
135
+        },
136
+        cancelTag() {
137
+            this.tagModalVisible = false;
138
+        },
139
+        async confirmTag() {
140
+            console.log('确认打标签', this.currentTags)
141
+            // 这里可以添加打标签的逻辑
142
+            const allTags = this.currentTags.map(tag => tag).join(',');
143
+            console.log('allTags', allTags)
144
+            await uni.$u.api.updateTags({
145
+                id: this.currentOrder.id,
146
+                allTags: allTags,
147
+            })
148
+            this.tagModalVisible = false;
149
+        },
102 150
     }
103 151
 }
104 152
 </script>
@@ -113,7 +161,8 @@ export default {
113 161
                     <!-- <orderCard v-for="item in orderList" :key="item.receiptId + item.id" :order="item"
114 162
                         @handleBtnClick="handleBtnClick">
115 163
                     </orderCard> -->
116
-                    <view class="orderCard" v-for="item in orderList"  :key="item.receiptId + item.id" @click.stop="toOrderDetail(item)">
164
+                    <view class="orderCard" v-for="item in orderList" :key="item.receiptId + item.id"
165
+                        @click.stop="toOrderDetail(item)">
117 166
                         <view class="bandAndPrice">
118 167
                             <view class="bandName">{{ item.itemBrand || '暂无品牌' }}</view>
119 168
                             <view class="price">¥{{ item.priceRange }}</view>
@@ -147,7 +196,8 @@ export default {
147 196
 
148 197
                             <view class="btnGroup"
149 198
                                 v-if="item && (item.status == '2' || item.status == null || item.status === undefined)">
150
-                                <view class="card-button willFollow" @click.stop="handleBtnClick('willFollow', item)">待跟进
199
+                                <view class="card-button willFollow" @click.stop="handleBtnClick('willFollow', item)">
200
+                                    待跟进
151 201
                                 </view>
152 202
                                 <view class="card-button isBusy" @click.stop="handleBtnClick('tag', item)">打标签</view>
153 203
                             </view>
@@ -175,7 +225,16 @@ export default {
175 225
 
176 226
 
177 227
 
178
-
228
+        <!-- 打标签模态窗 -->
229
+        <u-modal :show="tagModalVisible" title="选择标签" @confirm="confirmTag" @cancel="cancelTag">
230
+            <view class="slot-content">
231
+                <u-checkbox-group v-model="currentTags" placement="column">
232
+                    <u-checkbox :customStyle="{ marginBottom: '8px' }" v-for="(item, index) in tagList" :key="item.id"
233
+                        :label="item.name" :name="item.id">
234
+                    </u-checkbox>
235
+                </u-checkbox-group>
236
+            </view>
237
+        </u-modal>
179 238
     </view>
180 239
 </template>
181 240