Explorar o código

fix: 跟进记录增加拍照功能

liujt hai 9 meses
pai
achega
76668f690f

+ 4 - 1
pages/saleManage/contact/components/followList.vue

@@ -121,6 +121,7 @@
 		},
 		methods: {
 			init(data) {
+				console.log('pageName', this.pageName)
 				if (this.pageName == 'businessOpportunity') {
 					this.tableList = JSON.parse(JSON.stringify(data))
 					return
@@ -128,6 +129,7 @@
 				if (data) {
 					this.form = data
 					this.tableList = JSON.parse(JSON.stringify(data.opportunityFollowupList))
+					console.log('tableList', this.tableList)
 				}
 			},
 
@@ -151,10 +153,11 @@
 				if (type == 'edit') {
 					data['index'] = index
 				}
+				console.log('index', JSON.stringify(data))
 				uni.navigateTo({
 					url: '/pages/saleManage/contact/components/followListAdd?type=' + type + '&linkList=' + JSON
 						.stringify(this.linkList) + (type == 'edit' ?
-							'&data=' + JSON.stringify(data) : '')
+							'&data=' + encodeURIComponent(JSON.stringify(data)) : '')
 				})
 			}
 

+ 80 - 2
pages/saleManage/contact/components/followListAdd.vue

@@ -30,6 +30,14 @@
 			<u-cell title="附件" arrow-direction="down">
 				<fileMain slot="value" v-model="form.files"></fileMain>
 			</u-cell>
+			<u-cell title="现场照片" arrow-direction="down">
+				<view slot="value" style="display: flex;align-items: center;width: 100%;">
+					<u-button :plain="true" :hairline="true" style="width: 100rpx;" size='mini' text="拍照上传"  @click="chooseImage"></u-button>
+				</view>
+			</u-cell>
+			<view class="imgList">
+				<u-album :urls="imgs" :multipleSize="160" :rowCount="4"></u-album>
+			</view>
 			
 			
 			<view class="footerButton">
@@ -69,10 +77,11 @@
 					opportunityId: '',
 					stageCode: '',
 					fileId: [],
-					stageName: ''
+					stageName: '',
 				},
 				type: '',
-				linkList:[]
+				linkList:[],
+				imgs: []
 			}
 		},
 
@@ -80,6 +89,7 @@
 			this.type = data.type
 			if (data.data) {
 				this.form = JSON.parse(data.data)
+				this.imgs = this.form.imgs;
 			}
 			this.linkList=JSON.parse(data.linkList).map(item=>{
 				return {
@@ -131,12 +141,66 @@
 				if(this.form.stageCode){
 					this.form.stageName=this.business_stage_code.find(item=>item.value==this.form.stageCode)?.text
 				}
+				this.form.imgs = this.imgs;
 				uni.$emit('updateFollowList', {
 					data: this.form,
 					type: this.type
 				})
 				this.back()
 			},
+			// 上传照片
+			chooseImage() {
+				const _this = this
+				uni.chooseImage({
+					count: 9, //默认9
+					sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
+					sourceType: ['camera'], //现场拍照
+					success: function(res) {
+						uni.showLoading({
+							title: '加载中'
+						})
+
+						_this.uploadFile(res.tempFilePaths).then(res => {
+							res.forEach(item => {
+								let fileNames = item.storePath.split('/')
+								let url = _this.apiUrl +
+									'/main/file/getFile?objectName=' +  item.storePath+
+									'&fullfilename=' + fileNames[fileNames.length -
+										1]
+								_this.imgs.push(url)
+							})
+							uni.hideLoading()
+
+						})
+					}
+				});
+			},
+			uploadFile(list) {
+				let PromiseAll = []
+				const apiUrl = this.apiUrl
+				const token = uni.getStorageSync("token"); //取存本地的token
+				list.forEach(item => {
+					PromiseAll.push(
+						new Promise((resolve, reject) => {
+							uni.uploadFile({
+								url: apiUrl + '/main/file/upload',
+								filePath: item,
+								name: 'multiPartFile',
+								header: {
+									authorization: token
+								},
+								success: (uploadFileRes) => {
+									let data = JSON.parse(uploadFileRes.data)
+									resolve(data.data)
+								}
+							});
+						}),
+					)
+				})
+
+				return Promise.all(PromiseAll)
+
+			},
 
 		}
 	}
@@ -152,6 +216,10 @@
 		padding-bottom: 84rpx;
 	}
 
+	.imgList {
+		padding: 20rpx;
+	}
+
 	.footerButton {
 		width: 100%;
 		height: 84rpx;
@@ -168,6 +236,16 @@
 		}
 	}
 
+	uni-button {
+		width: 100rpx;
+		// height: 50rpx;
+		margin-left: 10rpx;
+		margin-right: 0;
+		color: #fff !important;
+		border: none;
+		background: #157a2c !important;
+
+	}
 	// /deep/.u-button {
 	// 	height: 100%;
 	// }

+ 10 - 14
pages/salesServiceManagement/demandList/add.vue

@@ -224,21 +224,18 @@
 				let data = JSON.parse(JSON.stringify(res));
 				console.log('data111', data.orderCode)
 				this.form = data;
-				this.$set(this.form, 'orderCode', data.orderCode);
+				// this.$set(this.form, 'orderCode', data.orderCode);
 				this.createUserName = data.createUserName;
 				let obj = this.fault_level.find(el => el.value == res.faultLevel)
 				let associationTypeObj = this.associationTypeList.find(el => el.value == res.associationType)
-				this.associationTypeOnchange({
-					"detail": {
-						"value": [associationTypeObj]
-					}
-				});
-				this.sourceCodeOnchange({
-					"detail": {
-						"value": [obj]
-					}
-				});
-				
+				this.form.associationType = associationTypeObj.value;
+				if(res.faultLevel) {
+					this.sourceCodeOnchange({
+						"detail": {
+							"value": [obj]
+						}
+					});
+				}
 			},
 
 			sectionChange(index) {
@@ -284,14 +281,13 @@
 				}
 			},
 			sourceCodeOnchange(e) {
-				console.log('eee', e)
 				const value = e.detail.value;
 				this.form.faultLevel = value[0].value;
 			},
 			associationTypeOnchange(e) {
 				const value = e.detail.value;
 				this.form.associationType = value[0].value;
-				this.form.orderCode = undefined
+				this.form.orderCode = ''
 			},
 			invoiceDialogOpen() {
 				if (!this.form.contactId && this.form.associationType !== '3') {