Parcourir la source

重构实物图卡片位置并修正文件类型逻辑

Yannay il y a 2 mois
Parent
commit
fc57fbc108

+ 18 - 15
pages/orderDetailNew/components/pageOne.vue

@@ -10,21 +10,7 @@
10 10
             </u-col>
11 11
         </u-row>
12 12
 
13
-        <!-- 实物图卡片 -->
14
-        <view class="card_wrap">
15
-            <view class="card-title">实物图</view>
16
-            <view class="image-upload-container">
17
-                <view class="image-list">
18
-                    <view class="image-item" v-for="(item, index) in trueUploadList" :key="'truePic-' + index">
19
-                        <pic-comp @needPreviewPic='previewImageTrue' :src="item.fileUrl"></pic-comp>
20
-                        <view class="delete-btn" @click="deleteImage(item)">×</view>
21
-                    </view>
22
-                    <view class="upload-btn" @click="uploadImage('truePic', currentReceipt.id)">
23
-                        <u-icon name="plus" size="40" color="#999"></u-icon>
24
-                    </view>
25
-                </view>
26
-            </view>
27
-        </view>
13
+        
28 14
 
29 15
         <!-- 聊天记录卡片 -->
30 16
         <view class="card_wrap">
@@ -59,6 +45,23 @@
59 45
             </view>
60 46
         </view>
61 47
 
48
+        <!-- 实物图卡片 -->
49
+        <view class="card_wrap">
50
+            <view class="card-title">实物图</view>
51
+            <view class="image-upload-container">
52
+                <view class="image-list">
53
+                    <view class="image-item" v-for="(item, index) in trueUploadList" :key="'truePic-' + index">
54
+                        <pic-comp @needPreviewPic='previewImageTrue' :src="item.fileUrl"></pic-comp>
55
+                        <view class="delete-btn" @click="deleteImage(item)">×</view>
56
+                    </view>
57
+                    <view class="upload-btn" @click="uploadImage('truePic', currentReceipt.id)">
58
+                        <u-icon name="plus" size="40" color="#999"></u-icon>
59
+                    </view>
60
+                </view>
61
+            </view>
62
+        </view>
63
+        
64
+
62 65
         <!-- 基本信息卡片 -->
63 66
         <view class="info-card">
64 67
             <view class="info-card-title">基本信息</view>

+ 6 - 6
pages/orderDetailNew/mixin/imgUploadAndDownLoad.js

@@ -48,15 +48,15 @@ export default {
48 48
                     pageSize: 1000 // 设置一个较大的值以获取所有数据
49 49
                 }
50 50
                 const response = await uni.$u.api.selectClueFileByDto(params)
51
-                if (orderFileType == '1') {
51
+                //聊天记录1,实物图2,细节图3
52
+                if (orderFileType == '2') {
52 53
                     //如果itemBrand里面有逗号的话说明是多个品牌
53
-
54 54
                     if (itemBrand.indexOf(',') != -1) {
55 55
                         this.trueUploadList = response.rows.filter(item => item.sourceId == receiptID) || []
56 56
                     } else {
57 57
                         this.trueUploadList = response.rows
58 58
                     }
59
-                } else if (orderFileType == '2') {
59
+                } else if (orderFileType == '1') {
60 60
                     if (itemBrand.indexOf(',') != -1) {
61 61
                         this.chatRecordsUploadList = response.rows.filter(item => item.sourceId == receiptID) || []
62 62
                     } else {
@@ -96,8 +96,8 @@ export default {
96 96
         async uploadToServer(filePaths, type, receiptID) {
97 97
             // 实际的上传逻辑
98 98
             try {
99
-                //实物图的话就是1,聊天记录的话就是2,高清细节图的话就是3
100
-                let p = type == 'truePic' ? '1' : type == 'chatRecords' ? '2' : type == 'detailImages' ? '3' : ''
99
+                //聊天记录的话就是1,实物图的话就是2,高清细节图的话就是3
100
+                let p = type == 'truePic' ? '2' : type == 'chatRecords' ? '1' : type == 'detailImages' ? '3' : ''
101 101
                 console.log('当前上传的图片类型是', p)
102 102
                 const res = await Promise.all(filePaths.map(filePath => this.uploadFile(filePath, p)));
103 103
 
@@ -141,7 +141,7 @@ export default {
141 141
         },
142 142
         //绑定订单
143 143
         async bindOrder(orderFileType, receiptID) {
144
-            console.log('当前的收单id', receiptID)
144
+            console.log('当前的收单id', receiptID,'当前的订单文件类型', orderFileType)
145 145
             const res = await uni.$u.api.saveClueFile({
146 146
                 clueId: this.orderDetail.clueId,//线索id
147 147
                 list: this.bindList,

+ 204 - 204
pages/uploadRecord/index.vue

@@ -7,17 +7,17 @@
7 7
 		</u-navbar>
8 8
 		<view class="form_wrap">
9 9
 			<u--form labelPosition="left" labelWidth="80" :model="form" :rules="rules" ref="form" class="form_wrap">
10
-				
10
+
11 11
 				<u-form-item label="线索id">
12
-					{{clueDetail && clueDetail.id ? clueDetail.id : "-"}}
12
+					{{ clueDetail && clueDetail.id ? clueDetail.id : "-" }}
13 13
 				</u-form-item>
14
-				
14
+
15 15
 				<u-form-item label="线索名称">
16
-					{{clueDetail && clueDetail.name ? clueDetail.name : "-"}}
16
+					{{ clueDetail && clueDetail.name ? clueDetail.name : "-" }}
17 17
 				</u-form-item>
18
-				
18
+
19 19
 				<u-form-item label="操作人">
20
-					{{userInfo.nickName}}
20
+					{{ userInfo.nickName }}
21 21
 				</u-form-item>
22 22
 
23 23
 				<u-form-item label="主叫号码" prop="caller">
@@ -40,14 +40,14 @@
40 40
 				</u-form-item>
41 41
 			</u--form>
42 42
 		</view>
43
-		
43
+
44 44
 		<!-- 录音确认对话框 -->
45 45
 		<u-popup :show="showConfirmDialog" mode="center" :closeable="false" :closeOnClickOverlay="false">
46 46
 			<view class="confirm-dialog">
47 47
 				<view class="dialog-title">确认录音</view>
48 48
 				<view class="dialog-content">
49 49
 					<view class="file-info">
50
-						<view class="file-name">{{selectedFile.fileName}}</view>
50
+						<view class="file-name">{{ selectedFile.fileName }}</view>
51 51
 					</view>
52 52
 					<view class="play-section">
53 53
 						<audio :src="selectedFile.filePath" controls class="audio-player"></audio>
@@ -59,226 +59,226 @@
59 59
 				</view>
60 60
 			</view>
61 61
 		</u-popup>
62
-		
62
+
63 63
 		<!-- <drag-button :isDock="true" /> -->
64 64
 	</view>
65 65
 </template>
66 66
 
67 67
 <script>
68
-	export default {
69
-		computed: {
70
-			userInfo() {
71
-				return this.$store.state.user.userInfo;
72
-			},
73
-			filelist(){
74
-				return this.$store.state.call.filelist;
75
-			},
76
-			storeForm() {
77
-				return this.$store.state.call.form;
78
-			},
68
+export default {
69
+	computed: {
70
+		userInfo() {
71
+			return this.$store.state.user.userInfo;
79 72
 		},
80
-		data() {
81
-			return {
82
-				rules: {
83
-					'caller': {
84
-						type: 'string',
85
-						required: true,
86
-						message: '请输入内容',
87
-						trigger: ['blur', 'change']
88
-					},
89
-					'callee': {
90
-						type: 'string',
91
-						required: true,
92
-						message: '请输入内容',
93
-						trigger: ['blur', 'change']
94
-					},
95
-					'fileUrl': {
96
-						type: 'string',
97
-						required: true,
98
-						message: '请输入内容',
99
-						trigger: ['blur', 'change']
100
-					},
73
+		filelist() {
74
+			return this.$store.state.call.filelist;
75
+		},
76
+		storeForm() {
77
+			return this.$store.state.call.form;
78
+		},
79
+	},
80
+	data() {
81
+		return {
82
+			rules: {
83
+				'caller': {
84
+					type: 'string',
85
+					required: true,
86
+					message: '请输入内容',
87
+					trigger: ['blur', 'change']
101 88
 				},
102
-				form: {
103
-					clueId: undefined,
104
-					remark: '',
105
-					fileUrl : undefined,
106
-					fileName : undefined,
107
-					type : '3',
108
-					list : [],
109
-					caller : '',
110
-					callee : ''
89
+				'callee': {
90
+					type: 'string',
91
+					required: true,
92
+					message: '请输入内容',
93
+					trigger: ['blur', 'change']
111 94
 				},
112
-				clueDetail : {},
113
-				// 对话框相关状态
114
-				showConfirmDialog: false,
115
-				selectedFile: {
116
-					filePath: '',
117
-					fileName: ''
95
+				'fileUrl': {
96
+					type: 'string',
97
+					required: true,
98
+					message: '请输入内容',
99
+					trigger: ['blur', 'change']
118 100
 				},
119
-			}
120
-		},
121
-		methods: {
122
-			initFormFromStore() {
123
-				const storeFormData = this.storeForm;
124
-				this.form = {
125
-					...this.form,
126
-					caller: storeFormData.caller || '',
127
-					callee: storeFormData.callee || '',
128
-					fileUrl: storeFormData.fileUrl,
129
-					fileName: storeFormData.fileName,
130
-					remark: storeFormData.remark,
131
-					type: storeFormData.type,
132
-					list: storeFormData.list
133
-				};
134
-				
135
-				uni.$u.api.getClueMainInfoById({id : this.form.clueId}).then(({data})=>{
136
-					this.clueDetail = data;
137
-				})
138
-				
139
-				if(!this.form.callee){
140
-					// 没有准备被叫号码 直接去查线索的telephone
141
-					this.form.callee = this.clueDetail.telephone;
142
-				};
143
-				if(!this.form.caller){
144
-					// 没有准备主叫号码 直接去尝试获取
145
-					this.$store.dispatch("call/getUserPhoneNumber").then(phone=>{
146
-						this.form.caller = phone;
147
-					})
148
-				}
149
-				if(storeFormData.fileUrl){
150
-					// 初始化带了fileUrl 说明是从监听那边跳转的
151
-					this.handleFileChange({ filePath : storeFormData.fileUrl , fileName : storeFormData.fileName });
152
-				}
153
-				this.$store.dispatch("call/resetForm");
154 101
 			},
155
-			
156
-			handleFileChange(file){
157
-				// {
158
-				    // "filePath": "/storage/emulated/0/Recordings/Record/Call/15099989786 2025-11-11 09-41-57.m4a",
159
-				    // "fileName": "15099989786 2025-11-11 09-41-57.m4a"
160
-				// }
161
-				
162
-				const {filePath ,  fileName} = file;
163
-				
164
-				// 显示确认对话框
165
-				this.selectedFile = { filePath, fileName };
166
-				this.showConfirmDialog = true;
102
+			form: {
103
+				clueId: undefined,
104
+				remark: '',
105
+				fileUrl: undefined,
106
+				fileName: undefined,
107
+				type: '3',
108
+				list: [],
109
+				caller: '',
110
+				callee: ''
167 111
 			},
168
-			
169
-			// 取消确认
170
-			cancelConfirm() {
171
-				this.showConfirmDialog = false;
172
-				this.selectedFile = { filePath: '', fileName: '' };
173
-				this.form.fileUrl = undefined;
174
-				this.form.fileName = undefined;
175
-			},
176
-			
177
-			// 确认上传
178
-			async confirmUpload() {
179
-				try {
180
-					// 调用上传接口
181
-					const result = await uni.$u.api.uploadFile(this.selectedFile.filePath);
182
-					if (result && result.data) {
183
-						result.data.remark = this.form.remark;
184
-						result.data.fileName = result.data.name;
185
-						result.data.fileUrl = result.data.url;
186
-						this.form.list = [result.data];
187
-					}
188
-					// 设置表单值
189
-					this.form.fileUrl = this.selectedFile.filePath;
190
-					this.form.fileName = this.selectedFile.fileName;
191
-					
192
-					// 关闭对话框
193
-					this.showConfirmDialog = false;
194
-				} catch (error) {
195
-					uni.hideLoading();
196
-					console.error('上传失败:', error);
197
-					uni.$u.toast('上传失败,请重试');
198
-				}
112
+			clueDetail: {},
113
+			// 对话框相关状态
114
+			showConfirmDialog: false,
115
+			selectedFile: {
116
+				filePath: '',
117
+				fileName: ''
199 118
 			},
200
-			
201
-			handleNavSaveClick() {
202
-				if(!this.form.clueId){
203
-					uni.$u.toast("相关线索id为空");
204
-				}
205
-				this.$refs.form.validate().then(async () => {
206
-					await uni.$u.api.saveClueFile(this.form);
207
-					uni.$u.toast("保存成功");
208
-					this.timer = setTimeout(() => {
209
-						uni.$emit('uploadRecordSuccess');
210
-						uni.navigateBack();
211
-						clearTimeout(this.timer);
212
-					}, 1000)
119
+		}
120
+	},
121
+	methods: {
122
+		initFormFromStore() {
123
+			const storeFormData = this.storeForm;
124
+			this.form = {
125
+				...this.form,
126
+				caller: storeFormData.caller || '',
127
+				callee: storeFormData.callee || '',
128
+				fileUrl: storeFormData.fileUrl,
129
+				fileName: storeFormData.fileName,
130
+				remark: storeFormData.remark,
131
+				type: storeFormData.type,
132
+				list: storeFormData.list
133
+			};
134
+
135
+			uni.$u.api.getClueMainInfoById({ id: this.form.clueId }).then(({ data }) => {
136
+				this.clueDetail = data;
137
+			})
138
+
139
+			if (!this.form.callee) {
140
+				// 没有准备被叫号码 直接去查线索的telephone
141
+				this.form.callee = this.clueDetail.telephone;
142
+			};
143
+			if (!this.form.caller) {
144
+				// 没有准备主叫号码 直接去尝试获取
145
+				this.$store.dispatch("call/getUserPhoneNumber").then(phone => {
146
+					this.form.caller = phone;
213 147
 				})
214
-			},
148
+			}
149
+			if (storeFormData.fileUrl) {
150
+				// 初始化带了fileUrl 说明是从监听那边跳转的
151
+				this.handleFileChange({ filePath: storeFormData.fileUrl, fileName: storeFormData.fileName });
152
+			}
153
+			this.$store.dispatch("call/resetForm");
215 154
 		},
216
-		onLoad(option) {
217
-			this.$store.dispatch("call/getFileList");
218
-			this.form.clueId = option.clueId;
219
-			this.initFormFromStore();
155
+
156
+		handleFileChange(file) {
157
+			// {
158
+			// "filePath": "/storage/emulated/0/Recordings/Record/Call/15099989786 2025-11-11 09-41-57.m4a",
159
+			// "fileName": "15099989786 2025-11-11 09-41-57.m4a"
160
+			// }
161
+
162
+			const { filePath, fileName } = file;
163
+
164
+			// 显示确认对话框
165
+			this.selectedFile = { filePath, fileName };
166
+			this.showConfirmDialog = true;
220 167
 		},
221
-	}
168
+
169
+		// 取消确认
170
+		cancelConfirm() {
171
+			this.showConfirmDialog = false;
172
+			this.selectedFile = { filePath: '', fileName: '' };
173
+			this.form.fileUrl = undefined;
174
+			this.form.fileName = undefined;
175
+		},
176
+
177
+		// 确认上传
178
+		async confirmUpload() {
179
+			try {
180
+				// 调用上传接口
181
+				const result = await uni.$u.api.uploadFile(this.selectedFile.filePath);
182
+				if (result && result.data) {
183
+					result.data.remark = this.form.remark;
184
+					result.data.fileName = result.data.name;
185
+					result.data.fileUrl = result.data.url;
186
+					this.form.list = [result.data];
187
+				}
188
+				// 设置表单值
189
+				this.form.fileUrl = this.selectedFile.filePath;
190
+				this.form.fileName = this.selectedFile.fileName;
191
+
192
+				// 关闭对话框
193
+				this.showConfirmDialog = false;
194
+			} catch (error) {
195
+				uni.hideLoading();
196
+				console.error('上传失败:', error);
197
+				uni.$u.toast('上传失败,请重试');
198
+			}
199
+		},
200
+
201
+		handleNavSaveClick() {
202
+			if (!this.form.clueId) {
203
+				uni.$u.toast("相关线索id为空");
204
+			}
205
+			this.$refs.form.validate().then(async () => {
206
+				await uni.$u.api.saveClueFile(this.form);
207
+				uni.$u.toast("保存成功");
208
+				this.timer = setTimeout(() => {
209
+					uni.$emit('uploadRecordSuccess');
210
+					uni.navigateBack();
211
+					clearTimeout(this.timer);
212
+				}, 1000)
213
+			})
214
+		},
215
+	},
216
+	onLoad(option) {
217
+		this.$store.dispatch("call/getFileList");
218
+		this.form.clueId = option.clueId;
219
+		this.initFormFromStore();
220
+	},
221
+}
222 222
 </script>
223 223
 
224 224
 <style lang="scss" scoped>
225
-	.form_wrap {
226
-		background-color: #fff;
227
-		margin: 20rpx 0;
225
+.form_wrap {
226
+	background-color: #fff;
227
+	margin: 20rpx 0;
228 228
 
229
-		.form_wrap {
230
-			::v-deep .u-form-item__body {
231
-				padding: 20rpx 40rpx;
232
-			}
229
+	.form_wrap {
230
+		::v-deep .u-form-item__body {
231
+			padding: 20rpx 40rpx;
233 232
 		}
234 233
 	}
235
-	
236
-	/* 录音确认对话框样式 */
237
-	.confirm-dialog {
238
-		padding: 40rpx;
239
-		min-width: 500rpx;
240
-		background: #fff;
241
-		border-radius: 20rpx;
242
-		
243
-		.dialog-title {
244
-			text-align: center;
245
-			font-size: 32rpx;
246
-			font-weight: bold;
247
-			color: #333;
248
-			margin-bottom: 40rpx;
249
-		}
250
-		
251
-		.dialog-content {
252
-			margin-bottom: 40rpx;
253
-			
254
-			.file-info {
255
-				margin-bottom: 30rpx;
256
-				
257
-				.file-name {
258
-					background: #f5f5f5;
259
-					padding: 20rpx;
260
-					border-radius: 10rpx;
261
-					font-size: 28rpx;
262
-					color: #333;
263
-					word-break: break-all;
264
-					text-align: center;
265
-				}
266
-			}
267
-			
268
-			.play-section {
269
-				.audio-player {
270
-					width: 100%;
271
-				}
234
+}
235
+
236
+/* 录音确认对话框样式 */
237
+.confirm-dialog {
238
+	padding: 40rpx;
239
+	min-width: 500rpx;
240
+	background: #fff;
241
+	border-radius: 20rpx;
242
+
243
+	.dialog-title {
244
+		text-align: center;
245
+		font-size: 32rpx;
246
+		font-weight: bold;
247
+		color: #333;
248
+		margin-bottom: 40rpx;
249
+	}
250
+
251
+	.dialog-content {
252
+		margin-bottom: 40rpx;
253
+
254
+		.file-info {
255
+			margin-bottom: 30rpx;
256
+
257
+			.file-name {
258
+				background: #f5f5f5;
259
+				padding: 20rpx;
260
+				border-radius: 10rpx;
261
+				font-size: 28rpx;
262
+				color: #333;
263
+				word-break: break-all;
264
+				text-align: center;
272 265
 			}
273 266
 		}
274
-		
275
-		.dialog-buttons {
276
-			display: flex;
277
-			gap: 30rpx;
278
-			
279
-			::v-deep .u-button {
280
-				flex: 1;
267
+
268
+		.play-section {
269
+			.audio-player {
270
+				width: 100%;
281 271
 			}
282 272
 		}
283 273
 	}
274
+
275
+	.dialog-buttons {
276
+		display: flex;
277
+		gap: 30rpx;
278
+
279
+		::v-deep .u-button {
280
+			flex: 1;
281
+		}
282
+	}
283
+}
284 284
 </style>