Explorar o código

7月14日问题修改

zhangli %!s(int64=2) %!d(string=hai) anos
pai
achega
e8f61eef2c
Modificáronse 3 ficheiros con 78 adicións e 6 borrados
  1. 6 3
      config/api.js
  2. 66 3
      pagesMain/customerInfo.vue
  3. 6 0
      pagesMain/giftApply.vue

+ 6 - 3
config/api.js

@@ -2,8 +2,8 @@
 // const API_BASE = 'http://192.168.1.126:30000'
 //const API_BASE = 'http://192.168.1.117:8089'
 //const API_BASE = 'http://192.168.1.145/newApi'
-// const API_BASE = 'http://192.168.1.109/newApi'
-// const API_BASE = 'http://192.168.1.117:8089'
+ //const API_BASE = 'http://192.168.1.109/newApi'
+//const API_BASE = 'http://192.168.1.117:8089'
 
 // const API_BASE = 'http://192.168.1.145/newApi'
 // const API_BASE = 'http://192.168.1.117:8089'
@@ -129,5 +129,8 @@ module.exports = {
 	// 赠送
 	giveGiftStudent: API_BASE + '/v2/sale/center/giveGiftStudent',
 	// 不送
-	giveGiftRefuse:  API_BASE + '/v2/sale/center/giveGiftRefuse'
+	giveGiftRefuse:  API_BASE + '/v2/sale/center/giveGiftRefuse',
+	// 修改头像
+	customerHeadSet:  API_BASE + '/v2/sale/customer/customerHeadSet',
+	
 }

+ 66 - 3
pagesMain/customerInfo.vue

@@ -5,7 +5,10 @@
 				<u-input v-model="form.studentName" placeholder=" " disabled />
 			</u-form-item>
 			<u-form-item v-if="navbarTitle == '客户信息'" label="学生照片" prop="imageFileId" label-position="top">
-				<u-upload max-count="1" :deletable="false" :file-list="form.fileList" index="1" :show-progress="false" :preview-full-image="false"></u-upload>
+				<u-upload v-if="headflag==1" max-count="1" :deletable="false" :file-list="form.fileList" index="1" :show-progress="false" :preview-full-image="false"></u-upload>
+				<u-upload v-else :max-count="1" :action="uploadUrl" :header="uploadHeader" @on-success="uploadSuccess" @on-error="uploadError"
+				 @on-remove="uploadRemove" :file-list="form.fileList" index="1"></u-upload>
+				 <u-button v-if="headflag==0" type="warning" shape="circle" :ripple="true" :custom-style="customStyle" @click="saveHead" style="width: 30%;float: right;display: inline-block;margin-top: -120rpx;">保存头像</u-button>
 			</u-form-item>
 			<u-form-item label="学员性别" prop="sex" placeholder=" " disabled>
 				<text>{{ form.sex == '0' ? '男' : '女' }}</text>
@@ -84,6 +87,11 @@
 		},
 		data() {
 			return {
+				imageFileId:'',
+				uploadUrl: API.uploadFile,
+				uploadHeader: {
+					Authorization: uni.getStorageSync('token')
+				},
 				navbarTitle: '',
 				id: '',
 				form: {
@@ -121,10 +129,31 @@
 				},
 				// 追踪记录
 				recordShow: false,
-				recordList: []
+				recordList: [],
+				headflag:1,
 			}
 		},
 		methods: {
+			uploadSuccess(res, index, lists, name) {
+				this.imageFileId = res.data.id
+				console.log(this.imageFileId)
+				this.$refs.uTips.show({
+					title: '文件上传成功',
+					type: 'success',
+				})
+				return true
+			},
+			//  文件上传失败回调
+			uploadError(res, index, lists, name) {
+				this.$refs.uTips.show({
+					title: error.message,
+					type: 'warning',
+				})
+			},
+			//  移除文件回调
+			uploadRemove(index, lists, name) {
+				this.imageFileId = ""
+			},
 			//  客户信息
 			getCustomerInfo() {
 				NET.request(API.customerDetail, {
@@ -132,7 +161,13 @@
 						if(res.status == 10000) {
 							const result = res.data
 							this.form.studentName = result.studentName
-							this.form.fileList.push(result.imageFileUrl)
+							this.form.studentId = result.studentId
+							this.headflag = result.saleHeadNo
+							console.log(result.imageFileUrl)
+							this.form.fileList = [{
+								url: result.imageFileUrl
+							}]
+							//this.form.fileList.push(result.imageFileUrl)
 							this.form.sex = result.sex
 							this.form.age = result.age
 							this.form.birthday = result.birthday
@@ -194,6 +229,34 @@
 							})
 						}
 					}) 
+			},
+			// 保存头像
+			saveHead() {
+				if(this.imageFileId==""){
+					this.$refs.uTips.show({
+						title: "请上传修改的学生照片",
+						type: 'warning',
+					})
+					return false;
+				}
+				NET.request(API.customerHeadSet, {
+					'studentId':this.form.studentId,
+					'imageFileId':this.imageFileId
+					 }, 'POST').then(res=> {
+						if(res.status == 10000) {
+							this.getCustomerInfo()
+							this.$refs.uTips.show({
+								title: '修改成功',
+								type: 'success',
+							})
+						} else {
+							this.$refs.uTips.show({
+								title: error.message,
+								type: 'warning',
+							})
+						}
+					}
+				) 
 			}
 		}
 	}

+ 6 - 0
pagesMain/giftApply.vue

@@ -225,6 +225,7 @@
 					const giftIds = this.formInfo.filter(item => item.signTwoId != '').map( item => {
 						return item.signTwoId
 					})
+
 					NET.request(API.giveGiftStudent, {
 						id, venueId, giftIds
 					}, 'POST').then(res => {
@@ -241,6 +242,11 @@
 						}
 						this.getData()
 						this.giftShow = false
+					}).catch(error => {
+						this.$refs.uTips.show({
+							title: error.message,
+							type: 'warning',
+						})
 					})
 				}
 			},