|
|
@@ -7,7 +7,7 @@
|
|
7
|
7
|
<u-row class="info-row" justify="space-between">
|
|
8
|
8
|
<u-col span="5.8">
|
|
9
|
9
|
<view class="info-label">开户人</view>
|
|
10
|
|
- <u-input v-model="paymentInfo.accountHolder" placeholder="请输入开户人姓名" class="info-input" />
|
|
|
10
|
+ <u-input v-model="paymentInfo.customName" placeholder="请输入开户人姓名" class="info-input" />
|
|
11
|
11
|
</u-col>
|
|
12
|
12
|
<u-col span="5.8">
|
|
13
|
13
|
<view class="info-label">银行名称</view>
|
|
|
@@ -37,15 +37,25 @@
|
|
37
|
37
|
</view>
|
|
38
|
38
|
<view class="detail-image-content">
|
|
39
|
39
|
<view class="detail-image-list">
|
|
40
|
|
- <!-- 替换drag事件为touch事件 -->
|
|
|
40
|
+ <!-- 占位符元素 -->
|
|
|
41
|
+ <view v-show="placeholderIndex !== -1" class="detail-image-placeholder"
|
|
|
42
|
+ :style="{ transform: placeholderStyle }">
|
|
|
43
|
+ <u-icon name="arrow-right" size="40rpx" color="#108cff"></u-icon>
|
|
|
44
|
+ </view>
|
|
|
45
|
+
|
|
|
46
|
+ <!-- 图片列表 -->
|
|
41
|
47
|
<view class="detail-image-item" v-for="(item, index) in localDetailImages"
|
|
42
|
|
- :key="'detail-' + index" :style="{ opacity: draggingIndex === index ? 0.5 : 1 }"
|
|
43
|
|
- @touchstart="onTouchStart($event, index)" @touchmove="onTouchMove($event, index)"
|
|
44
|
|
- @touchend="onTouchEnd">
|
|
45
|
|
- <pic-comp :src="item"></pic-comp>
|
|
|
48
|
+ :key="'detail-' + index" :class="{
|
|
|
49
|
+ 'dragging': draggingIndex === index,
|
|
|
50
|
+ 'can-drop': canDropIndex === index
|
|
|
51
|
+ }" @touchstart.stop="onTouchStart($event, index)" @touchmove.stop="onTouchMove($event)"
|
|
|
52
|
+ @touchend.stop="onTouchEnd" @touchcancel.stop="onTouchEnd">
|
|
|
53
|
+ <pic-comp :src="item.value"></pic-comp>
|
|
46
|
54
|
<view class="image-type-tag">{{ getImageType(index) }}</view>
|
|
47
|
|
- <view class="detail-delete-btn" @click="deleteImage(index)">×</view>
|
|
|
55
|
+ <view class="detail-delete-btn" @click.stop="deleteImage(index)">×</view>
|
|
48
|
56
|
</view>
|
|
|
57
|
+
|
|
|
58
|
+ <!-- 上传按钮 -->
|
|
49
|
59
|
<view class="detail-upload-btn" @click="uploadDetailImage">
|
|
50
|
60
|
<u-icon name="plus" size="40rpx" color="#999"></u-icon>
|
|
51
|
61
|
</view>
|
|
|
@@ -59,7 +69,8 @@
|
|
59
|
69
|
<view class="payment-section">
|
|
60
|
70
|
<view class="payment-total-container">
|
|
61
|
71
|
<text class="payment-label">支付总额</text>
|
|
62
|
|
- <text class="payment-amount">¥0.00</text>
|
|
|
72
|
+ <u-input v-model="paymentAmount" placeholder="0.00" class="payment-amount" type="number" decimal="2"
|
|
|
73
|
+ prefix="¥" />
|
|
63
|
74
|
</view>
|
|
64
|
75
|
|
|
65
|
76
|
<view class="payment-buttons-row">
|
|
|
@@ -98,7 +109,7 @@
|
|
98
|
109
|
<u-modal :show="payNowModelShow" :title="'确认支付信息'" :showConfirmButton="false">
|
|
99
|
110
|
<view class="modal-content">
|
|
100
|
111
|
<!-- 支付金额显示 -->
|
|
101
|
|
- <view class="payment-amount-display">¥0.00</view>
|
|
|
112
|
+ <view class="payment-amount-display">¥{{ paymentAmount }}</view>
|
|
102
|
113
|
|
|
103
|
114
|
<!-- 支付信息区域 -->
|
|
104
|
115
|
<view class="payment-info-section">
|
|
|
@@ -142,7 +153,7 @@ export default {
|
|
142
|
153
|
orderDetail: {
|
|
143
|
154
|
handler(newVal) {
|
|
144
|
155
|
if (newVal) {
|
|
145
|
|
- this.paymentInfo.accountHolder = newVal.accountHolder || ''
|
|
|
156
|
+ this.paymentInfo.customName = newVal.customName || ''
|
|
146
|
157
|
this.paymentInfo.bankName = newVal.bankName || ''
|
|
147
|
158
|
this.paymentInfo.bankAccount = newVal.bankCardNumber || ''
|
|
148
|
159
|
this.paymentInfo.idNumber = newVal.idCard || ''
|
|
|
@@ -152,7 +163,10 @@ export default {
|
|
152
|
163
|
},
|
|
153
|
164
|
detailImages: {
|
|
154
|
165
|
handler(newVal) {
|
|
155
|
|
- this.localDetailImages = [...newVal];
|
|
|
166
|
+ this.localDetailImages = newVal.map((item, index) => ({
|
|
|
167
|
+ value: item,
|
|
|
168
|
+ position: index
|
|
|
169
|
+ }));
|
|
156
|
170
|
},
|
|
157
|
171
|
deep: true
|
|
158
|
172
|
}
|
|
|
@@ -167,6 +181,7 @@ export default {
|
|
167
|
181
|
payNowModelShow: false,
|
|
168
|
182
|
unpaidRating: 0, // 未收评级
|
|
169
|
183
|
followUpNotes: '', // 跟进细节
|
|
|
184
|
+ paymentAmount: '0.00', // 支付总额
|
|
170
|
185
|
|
|
171
|
186
|
// 支付信息
|
|
172
|
187
|
paymentInfo: {
|
|
|
@@ -176,11 +191,20 @@ export default {
|
|
176
|
191
|
idNumber: '' // 身份证号
|
|
177
|
192
|
},
|
|
178
|
193
|
// Local copy of detailImages prop to avoid direct mutation
|
|
179
|
|
- localDetailImages: [...this.detailImages],
|
|
|
194
|
+ localDetailImages: this.detailImages.map((item, index) => ({
|
|
|
195
|
+ value: item,
|
|
|
196
|
+ position: index
|
|
|
197
|
+ })),
|
|
180
|
198
|
// 拖拽相关状态
|
|
181
|
199
|
draggingIndex: -1, // 当前正在拖拽的元素索引
|
|
|
200
|
+ placeholderIndex: -1, // 占位符的位置
|
|
|
201
|
+ canDropIndex: -1, // 可以放置的位置
|
|
|
202
|
+ originalIndex: -1, // 拖拽开始时的原始位置
|
|
182
|
203
|
startX: 0, // 触摸起始X坐标
|
|
183
|
|
- startY: 0 // 触摸起始Y坐标
|
|
|
204
|
+ startY: 0, // 触摸起始Y坐标
|
|
|
205
|
+ dragOffsetX: 0, // 拖拽元素的X偏移
|
|
|
206
|
+ dragOffsetY: 0, // 拖拽元素的Y偏移
|
|
|
207
|
+ placeholderStyle: '' // 占位符的样式
|
|
184
|
208
|
};
|
|
185
|
209
|
},
|
|
186
|
210
|
|
|
|
@@ -193,8 +217,12 @@ export default {
|
|
193
|
217
|
sourceType: ['album', 'camera'], // 从相册选择或拍照
|
|
194
|
218
|
success: (res) => {
|
|
195
|
219
|
const tempFilePaths = res.tempFilePaths;
|
|
196
|
|
- // 将图片路径添加到数组中
|
|
197
|
|
- this.localDetailImages = [...this.localDetailImages, ...tempFilePaths];
|
|
|
220
|
+ // 将图片路径转换为对象数组并添加到本地数组
|
|
|
221
|
+ const newImages = tempFilePaths.map((path, index) => ({
|
|
|
222
|
+ value: path,
|
|
|
223
|
+ position: this.localDetailImages.length + index
|
|
|
224
|
+ }));
|
|
|
225
|
+ this.localDetailImages = [...this.localDetailImages, ...newImages];
|
|
198
|
226
|
},
|
|
199
|
227
|
fail: (err) => {
|
|
200
|
228
|
console.error('选择图片失败:', err);
|
|
|
@@ -214,6 +242,11 @@ export default {
|
|
214
|
242
|
success: (res) => {
|
|
215
|
243
|
if (res.confirm) {
|
|
216
|
244
|
this.localDetailImages.splice(index, 1);
|
|
|
245
|
+
|
|
|
246
|
+ // Update position properties after deletion
|
|
|
247
|
+ this.localDetailImages.forEach((item, idx) => {
|
|
|
248
|
+ item.position = idx + 1;
|
|
|
249
|
+ });
|
|
217
|
250
|
}
|
|
218
|
251
|
}
|
|
219
|
252
|
});
|
|
|
@@ -225,81 +258,110 @@ export default {
|
|
225
|
258
|
return types[index] || `细节${index - 4}`;
|
|
226
|
259
|
},
|
|
227
|
260
|
|
|
228
|
|
- // 触摸开始(替代dragstart)
|
|
|
261
|
+ // 触摸开始
|
|
229
|
262
|
onTouchStart(event, index) {
|
|
|
263
|
+ if (this.draggingIndex !== -1) return;
|
|
|
264
|
+
|
|
230
|
265
|
this.draggingIndex = index;
|
|
|
266
|
+ this.originalIndex = index;
|
|
|
267
|
+ this.placeholderIndex = index;
|
|
|
268
|
+ this.canDropIndex = -1;
|
|
|
269
|
+
|
|
231
|
270
|
// 记录触摸起始坐标
|
|
232
|
271
|
this.startX = event.touches[0].clientX;
|
|
233
|
272
|
this.startY = event.touches[0].clientY;
|
|
234
|
|
- console.log('开始拖拽:', index);
|
|
|
273
|
+
|
|
|
274
|
+ // 获取元素位置信息用于计算偏移
|
|
|
275
|
+ const query = uni.createSelectorQuery().in(this);
|
|
|
276
|
+ query.selectAll('.detail-image-item').boundingClientRect(rects => {
|
|
|
277
|
+ if (rects[index]) {
|
|
|
278
|
+ this.dragOffsetX = this.startX - rects[index].left;
|
|
|
279
|
+ this.dragOffsetY = this.startY - rects[index].top;
|
|
|
280
|
+ this.placeholderStyle = `translate(${rects[index].left}px, ${rects[index].top}px)`;
|
|
|
281
|
+ }
|
|
|
282
|
+ }).exec();
|
|
235
|
283
|
},
|
|
236
|
284
|
|
|
237
|
|
- // 触摸移动(替代dragover/drop)
|
|
238
|
|
- onTouchMove(event, currentIndex) {
|
|
239
|
|
- if (this.draggingIndex === -1) return; // 没有正在拖拽的元素则返回
|
|
|
285
|
+ // 触摸移动
|
|
|
286
|
+ onTouchMove(event) {
|
|
|
287
|
+ if (this.draggingIndex === -1) return;
|
|
240
|
288
|
|
|
241
|
289
|
const moveX = event.touches[0].clientX;
|
|
242
|
290
|
const moveY = event.touches[0].clientY;
|
|
243
|
|
- const diffX = moveX - this.startX;
|
|
244
|
|
- const diffY = moveY - this.startY;
|
|
245
|
|
-
|
|
246
|
|
- // 简单的拖拽距离判断(避免轻微滑动就触发交换)
|
|
247
|
|
- if (Math.abs(diffX) > 20 || Math.abs(diffY) > 20) {
|
|
248
|
|
- // 获取当前触摸位置对应的元素索引
|
|
249
|
|
- const targetIndex = this.getTargetIndexByPosition(moveX, moveY);
|
|
250
|
|
- if (targetIndex !== -1 && targetIndex !== this.draggingIndex) {
|
|
251
|
|
- // 交换数组元素(核心排序逻辑)
|
|
252
|
|
- [this.localDetailImages[this.draggingIndex], this.localDetailImages[targetIndex]] =
|
|
253
|
|
- [this.localDetailImages[targetIndex], this.localDetailImages[this.draggingIndex]];
|
|
254
|
|
- // 更新拖拽索引为目标索引(实现连续拖拽)
|
|
255
|
|
- this.draggingIndex = targetIndex;
|
|
256
|
|
- // 重置起始坐标
|
|
257
|
|
- this.startX = moveX;
|
|
258
|
|
- this.startY = moveY;
|
|
|
291
|
+
|
|
|
292
|
+ // 更新拖拽元素的位置
|
|
|
293
|
+ this.$nextTick(() => {
|
|
|
294
|
+ const draggingElement = uni.createSelectorQuery().in(this)
|
|
|
295
|
+ .selectAll('.detail-image-item')[this.draggingIndex];
|
|
|
296
|
+ if (draggingElement) {
|
|
|
297
|
+ // 这里通过CSS类实现拖拽视觉效果,实际位置由数组顺序控制
|
|
259
|
298
|
}
|
|
260
|
|
- }
|
|
|
299
|
+ });
|
|
|
300
|
+
|
|
|
301
|
+ // 计算当前触摸位置对应的目标索引
|
|
|
302
|
+ this.findTargetIndex(moveX, moveY);
|
|
261
|
303
|
},
|
|
262
|
304
|
|
|
263
|
|
- // 触摸结束(替代dragend)
|
|
|
305
|
+ // 触摸结束
|
|
264
|
306
|
onTouchEnd() {
|
|
265
|
|
- console.log('拖拽结束');
|
|
266
|
|
- this.draggingIndex = -1; // 重置拖拽状态
|
|
|
307
|
+ if (this.draggingIndex === -1) return;
|
|
|
308
|
+
|
|
|
309
|
+ // 执行元素交换
|
|
|
310
|
+ if (this.canDropIndex !== -1 && this.canDropIndex !== this.draggingIndex) {
|
|
|
311
|
+ // 交换元素位置
|
|
|
312
|
+ const temp = this.localDetailImages[this.draggingIndex];
|
|
|
313
|
+ this.localDetailImages[this.draggingIndex] = this.localDetailImages[this.canDropIndex];
|
|
|
314
|
+ this.localDetailImages[this.canDropIndex] = temp;
|
|
|
315
|
+
|
|
|
316
|
+ // Update position properties after swap
|
|
|
317
|
+ this.localDetailImages.forEach((item, index) => {
|
|
|
318
|
+ item.position = index + 1;
|
|
|
319
|
+ });
|
|
|
320
|
+ }
|
|
|
321
|
+
|
|
|
322
|
+ // 重置拖拽状态
|
|
|
323
|
+ this.resetDragState();
|
|
267
|
324
|
},
|
|
268
|
325
|
|
|
269
|
|
- // 根据触摸坐标获取目标元素索引(核心辅助方法)
|
|
270
|
|
- getTargetIndexByPosition(x, y) {
|
|
271
|
|
- // 获取所有图片元素的位置信息
|
|
|
326
|
+ // 查找触摸位置对应的目标索引
|
|
|
327
|
+ findTargetIndex(x, y) {
|
|
272
|
328
|
const query = uni.createSelectorQuery().in(this);
|
|
273
|
|
- return new Promise((resolve) => {
|
|
274
|
|
- query.selectAll('.detail-image-item').boundingClientRect(rects => {
|
|
275
|
|
- for (let i = 0; i < rects.length; i++) {
|
|
276
|
|
- const rect = rects[i];
|
|
277
|
|
- // 判断坐标是否在元素范围内
|
|
278
|
|
- if (
|
|
279
|
|
- x >= rect.left &&
|
|
280
|
|
- x <= rect.right &&
|
|
281
|
|
- y >= rect.top &&
|
|
282
|
|
- y <= rect.bottom
|
|
283
|
|
- ) {
|
|
284
|
|
- resolve(i);
|
|
285
|
|
- return;
|
|
286
|
|
- }
|
|
|
329
|
+ query.selectAll('.detail-image-item').boundingClientRect(rects => {
|
|
|
330
|
+ let targetIndex = -1;
|
|
|
331
|
+
|
|
|
332
|
+ // 查找触摸点所在的元素
|
|
|
333
|
+ for (let i = 0; i < rects.length; i++) {
|
|
|
334
|
+ if (i === this.draggingIndex) continue;
|
|
|
335
|
+
|
|
|
336
|
+ const rect = rects[i];
|
|
|
337
|
+ if (x >= rect.left && x <= rect.right && y >= rect.top && y <= rect.bottom) {
|
|
|
338
|
+ targetIndex = i;
|
|
|
339
|
+ break;
|
|
287
|
340
|
}
|
|
288
|
|
- resolve(-1);
|
|
289
|
|
- }).exec();
|
|
290
|
|
- });
|
|
291
|
|
- },
|
|
|
341
|
+ }
|
|
292
|
342
|
|
|
293
|
|
- // 下一步按钮点击事件
|
|
294
|
|
- handleNextClick() {
|
|
295
|
|
- console.log('page3点击了下一步按钮');
|
|
296
|
|
- this.$emit('handleNextClick', {
|
|
297
|
|
- nowPage: 'formThree',
|
|
298
|
|
- form: {
|
|
299
|
|
- // detailImages: this.localDetailImages,
|
|
300
|
|
- // paymentInfo: this.paymentInfo
|
|
|
343
|
+ // 更新可放置位置
|
|
|
344
|
+ this.canDropIndex = targetIndex;
|
|
|
345
|
+
|
|
|
346
|
+ // 如果找到了可放置位置,更新占位符位置
|
|
|
347
|
+ if (targetIndex !== -1) {
|
|
|
348
|
+ this.placeholderIndex = targetIndex;
|
|
|
349
|
+ this.placeholderStyle = `translate(${rects[targetIndex].left}px, ${rects[targetIndex].top}px)`;
|
|
301
|
350
|
}
|
|
302
|
|
- });
|
|
|
351
|
+ }).exec();
|
|
|
352
|
+ },
|
|
|
353
|
+
|
|
|
354
|
+ // 重置拖拽状态
|
|
|
355
|
+ resetDragState() {
|
|
|
356
|
+ this.draggingIndex = -1;
|
|
|
357
|
+ this.placeholderIndex = -1;
|
|
|
358
|
+ this.canDropIndex = -1;
|
|
|
359
|
+ this.originalIndex = -1;
|
|
|
360
|
+ this.startX = 0;
|
|
|
361
|
+ this.startY = 0;
|
|
|
362
|
+ this.dragOffsetX = 0;
|
|
|
363
|
+ this.dragOffsetY = 0;
|
|
|
364
|
+ this.placeholderStyle = '';
|
|
303
|
365
|
},
|
|
304
|
366
|
|
|
305
|
367
|
// 未收按钮点击事件
|
|
|
@@ -318,6 +380,16 @@ export default {
|
|
318
|
380
|
handlePayNowClick() {
|
|
319
|
381
|
console.log('点击了立即支付按钮');
|
|
320
|
382
|
this.payNowModelShow = true;
|
|
|
383
|
+
|
|
|
384
|
+ //让父组件保存数据
|
|
|
385
|
+ this.$emit('handleNeedSave', {
|
|
|
386
|
+ nowPage: 'formThree',
|
|
|
387
|
+ form: {
|
|
|
388
|
+ detailImages: this.localDetailImages,
|
|
|
389
|
+ ...this.paymentInfo,
|
|
|
390
|
+ paymentAmount: this.paymentAmount
|
|
|
391
|
+ }
|
|
|
392
|
+ });
|
|
321
|
393
|
},
|
|
322
|
394
|
|
|
323
|
395
|
// 确认未收按钮点击事件
|
|
|
@@ -339,7 +411,18 @@ export default {
|
|
339
|
411
|
console.log('确认转账');
|
|
340
|
412
|
this.payNowModelShow = false;
|
|
341
|
413
|
// 可以在这里添加转账确认的逻辑
|
|
342
|
|
- }
|
|
|
414
|
+ },
|
|
|
415
|
+ // 下一步按钮点击事件
|
|
|
416
|
+ handleNextClick() {
|
|
|
417
|
+ console.log('page3点击了下一步按钮', this.localDetailImages);
|
|
|
418
|
+ this.$emit('handleNextClick', {
|
|
|
419
|
+ nowPage: 'formThree',
|
|
|
420
|
+ form: {
|
|
|
421
|
+ detailImages: this.localDetailImages,
|
|
|
422
|
+ ...this.paymentInfo
|
|
|
423
|
+ }
|
|
|
424
|
+ });
|
|
|
425
|
+ },
|
|
343
|
426
|
}
|
|
344
|
427
|
}
|
|
345
|
428
|
</script>
|
|
|
@@ -386,13 +469,41 @@ export default {
|
|
386
|
469
|
height: 200rpx;
|
|
387
|
470
|
box-sizing: border-box;
|
|
388
|
471
|
touch-action: none; // 禁止浏览器默认触摸行为
|
|
389
|
|
- transition: opacity 0.2s; // 拖拽时的透明度过渡
|
|
|
472
|
+ transition: all 0.2s ease; // 所有属性过渡效果
|
|
|
473
|
+ z-index: 1;
|
|
|
474
|
+ cursor: move;
|
|
|
475
|
+
|
|
|
476
|
+ &.dragging {
|
|
|
477
|
+ opacity: 0.5;
|
|
|
478
|
+ transform: scale(1.05);
|
|
|
479
|
+ z-index: 100;
|
|
|
480
|
+ }
|
|
|
481
|
+
|
|
|
482
|
+ &.can-drop {
|
|
|
483
|
+ border: 2rpx dashed #108cff;
|
|
|
484
|
+ background-color: rgba(16, 140, 255, 0.1);
|
|
|
485
|
+ }
|
|
390
|
486
|
|
|
391
|
487
|
&:active {
|
|
392
|
488
|
opacity: 0.7;
|
|
393
|
489
|
}
|
|
394
|
490
|
}
|
|
395
|
491
|
|
|
|
492
|
+ // 占位符样式
|
|
|
493
|
+ .detail-image-placeholder {
|
|
|
494
|
+ position: absolute;
|
|
|
495
|
+ width: 200rpx;
|
|
|
496
|
+ height: 200rpx;
|
|
|
497
|
+ border: 2rpx dashed #108cff;
|
|
|
498
|
+ background-color: rgba(16, 140, 255, 0.1);
|
|
|
499
|
+ border-radius: 8rpx;
|
|
|
500
|
+ display: flex;
|
|
|
501
|
+ align-items: center;
|
|
|
502
|
+ justify-content: center;
|
|
|
503
|
+ z-index: 50;
|
|
|
504
|
+ pointer-events: none;
|
|
|
505
|
+ }
|
|
|
506
|
+
|
|
396
|
507
|
.image-type-tag {
|
|
397
|
508
|
position: absolute;
|
|
398
|
509
|
top: 10rpx;
|
|
|
@@ -551,6 +662,19 @@ export default {
|
|
551
|
662
|
font-weight: 600;
|
|
552
|
663
|
color: #f53f3f;
|
|
553
|
664
|
font-family: Consolas, 'Courier New', monospace, -apple-system, BlinkMacSystemFont;
|
|
|
665
|
+ width: auto;
|
|
|
666
|
+ min-width: 150rpx;
|
|
|
667
|
+}
|
|
|
668
|
+
|
|
|
669
|
+.payment-amount .u-input__input {
|
|
|
670
|
+ border: none;
|
|
|
671
|
+ padding: 0;
|
|
|
672
|
+ background: transparent;
|
|
|
673
|
+ font-size: 48rpx;
|
|
|
674
|
+ font-weight: 600;
|
|
|
675
|
+ color: #f53f3f;
|
|
|
676
|
+ font-family: Consolas, 'Courier New', monospace, -apple-system, BlinkMacSystemFont;
|
|
|
677
|
+ text-align: right;
|
|
554
|
678
|
}
|
|
555
|
679
|
|
|
556
|
680
|
/* 支付按钮行样式 */
|