Parcourir la source

商户端优惠券图片上传

baijunde il y a 1 an
Parent
commit
91cf8a2572

+ 2 - 2
manifest.json

@@ -2,8 +2,8 @@
     "name" : "掌柜生活商户版",
     "appid" : "__UNI__E0EA6E1",
     "description" : "",
-    "versionName" : "1.0.6",
-    "versionCode" : 106,
+    "versionName" : "1.0.7",
+    "versionCode" : 107,
     "transformPx" : false,
     "app-plus" : {
         /* 5+App特有相关 */

+ 36 - 4
pages/coupon/creatDiscount.vue

@@ -158,7 +158,7 @@
 					<view class="tips">
 						支持jpg,png格式,最多上传5张,每张图片大小不得超过5M。
 					</view>
-					<view class="grid col-4 grid-square flex-sub booder-top">
+					<!-- <view class="grid col-4 grid-square flex-sub booder-top">
 						<view class="bg-img" v-for="(item, index) in headPhotoImg" :key="index" @tap="ViewImage"
 							:data-url="headPhotoImg[index]">
 							<image :src="headPhotoImg[index]" mode="aspectFill"></image>
@@ -171,7 +171,9 @@
 								mode="aspectFill"></image>
 
 						</view>
-					</view>
+					</view> -->
+					<u-upload ref="dUpload" :action="action" :file-list="xqImage" @on-success="detailsSuccess"
+						@on-remove="detailsRemove" max-count="5" width="140rpx" height="140rpx"></u-upload>
 				</view>
 
 			</view>
@@ -200,6 +202,8 @@ export default {
 
 	data() {
 		return {
+			action: configService.apiUrl + '/sys/common/upload', //图片上传地址
+				xqImage: [], //详情图回显
 			headPhotoImg: [],
 			showApplication: false,
 			columns1: [{
@@ -234,6 +238,14 @@ export default {
 		}
 	},
 	methods: {
+		//上传详情图
+		detailsSuccess(res, index, lists) {
+			this.xqImage = lists
+		
+		},
+		detailsRemove(index, lists) {
+			this.xqImage = lists
+		},
 		groupChange(e) {
 			// e=='1'?this.couponWayInfo2='':this.couponWayInfo1=''
 			this.form.couponWay = e == '1' ? '1' : '2'
@@ -460,10 +472,21 @@ export default {
 			
 			
 			else {
+				
+				let temp = []
+				console.log(this.xqImage)
+				if ( this.xqImage.length > 0) {
+					this.xqImage.forEach((item => {
+						temp.push( configService.apiUrl +'/'+item.response.message)
+					}))
+				}
+				
+				
 				let data = {
 					repeatClaim: this.form.repeatClaim ? '1' : '2',
 					couponRangeInfo: this.form.couponRangeInfo.length > 0 ? this.form.couponRangeInfo.join(',') : null,
-					couponPhoto: this.form.couponPhoto.length > 0 ? this.form.couponPhoto.join(',') : null
+					// couponPhoto: this.form.couponPhoto.length > 0 ? this.form.couponPhoto.join(',') : null
+						couponPhoto:temp.length > 0 ? temp.join(',') : null
 				}
 				if (this.productId == '') {
 					this.$http.post("/merchant/localCouponInfo/add", { ...this.form, ...data, merchantId: uni.getStorageSync(USER_INFO).merchantId }).then(res => {
@@ -508,7 +531,16 @@ export default {
 			this.$http.get("/merchant/localCouponInfo/queryById?id=" + this.productId).then(res => {
 				if (res.data.success) {
 					res.data.result.couponRangeInfo = res.data.result.couponRangeInfo ? res.data.result.couponRangeInfo.split(',').filter(id => id) : []
-					res.data.result.couponPhoto = res.data.result.couponPhoto!== null && res.data.result.couponPhoto.length>0? res.data.result.couponPhoto.split(',').filter(id => id) : []
+					// res.data.result.couponPhoto = res.data.result.couponPhoto!== null && res.data.result.couponPhoto.length>0? res.data.result.couponPhoto.split(',').filter(id => id) : []
+					if(res.data.result.couponPhoto){
+						let xqtemp = []
+						xqtemp = res.data.result.couponPhoto.split(',')
+						xqtemp.map(item => {
+							this.xqImage.push({
+								url: item
+							})
+						})
+					}
 					res.data.result.couponWay = res.data.result.couponWay ? res.data.result.couponWay + '' : ''
 					res.data.result.repeatClaim = res.data.result.repeatClaim && res.data.result.repeatClaim == '1' ? true : false
 					this.headPhotoImg=res.data.result.couponPhoto

+ 2 - 13
pages/coupon/creatReduction.vue

@@ -201,8 +201,6 @@ export default {
 		return {
 			action: configService.apiUrl + '/sys/common/upload', //图片上传地址
 				xqImage: [], //详情图回显
-				postImage:[],
-				imageHttp: configService.apiUrl + '/',
 			headPhotoImg: [],
 			showApplication: false,
 			columns1: [{
@@ -243,15 +241,11 @@ export default {
 		    },
 		//上传详情图
 		detailsSuccess(res, index, lists) {
-			console.log(res,lists)
-			// this.postImage.push({url:this.imageHttp + res.message})
-			// this.postImage = lists
 			this.xqImage = lists
 		
 		},
 		detailsRemove(index, lists) {
 			this.xqImage = lists
-			console.log(index)
 		},
 		groupChange(e) {
 			// e=='1'?this.couponWayInfo2='':this.couponWayInfo1=''
@@ -423,16 +417,11 @@ export default {
 				});
 				return
 			} else {
-					// console.log(this.postImage)
 				let temp = []
-				// if (this.postImage.length > 0) {
-				// 	this.postImage.forEach(item => {
-				// 		temp.push(this.imageHttp + item.response.message)
-				// 	})
-				// }
+				console.log(this.xqImage)
 				if ( this.xqImage.length > 0) {
 					this.xqImage.forEach((item => {
-						temp.push(item.url)
+						temp.push( configService.apiUrl +'/'+item.response.message)
 					}))
 				}
 				

+ 33 - 4
pages/coupon/creatcoupon.vue

@@ -150,7 +150,7 @@
 					<view class="tips">
 						支持jpg,png格式,最多上传5张,每张图片大小不得超过5M。
 					</view>
-					<view class="grid col-4 grid-square flex-sub booder-top">
+					<!-- <view class="grid col-4 grid-square flex-sub booder-top">
 						<view class="bg-img" v-for="(item, index) in headPhotoImg" :key="index" @tap="ViewImage"
 							:data-url="headPhotoImg[index]">
 							<image :src="headPhotoImg[index]" mode="aspectFill"></image>
@@ -163,7 +163,9 @@
 								mode="aspectFill"></image>
 
 						</view>
-					</view>
+					</view> -->
+					<u-upload ref="dUpload" :action="action" :file-list="xqImage" @on-success="detailsSuccess"
+						@on-remove="detailsRemove" max-count="5" width="140rpx" height="140rpx"></u-upload>
 				</view>
 
 			</view>
@@ -191,6 +193,8 @@ export default {
 	},
 	data() {
 		return {
+			action: configService.apiUrl + '/sys/common/upload', //图片上传地址
+				xqImage: [], //详情图回显
 			voucherWayInfo1:'',
 			voucherWayInfo2:'',
 			headPhotoImg: [],
@@ -224,6 +228,14 @@ export default {
 		}
 	},
 	methods: {
+		//上传详情图
+		detailsSuccess(res, index, lists) {
+			this.xqImage = lists
+		
+		},
+		detailsRemove(index, lists) {
+			this.xqImage = lists
+		},
 		groupChange(e){
 			// e=='1'?this.voucherWayInfo2='':this.voucherWayInfo1=''
 			this.form.voucherWay=e=='1'?'1':'2'
@@ -415,12 +427,20 @@ export default {
 				});
 				return
 			} else {
+				let temp = []
+				console.log(this.xqImage)
+				if ( this.xqImage.length > 0) {
+					this.xqImage.forEach((item => {
+						temp.push( configService.apiUrl +'/'+item.response.message)
+					}))
+				}
 				
 				let data={
 					voucherWayInfo:this.form.voucherWay=='1'?this.voucherWayInfo1:this.voucherWayInfo2,
 					conditions : this.form.conditionsUse == '2' ? this.form.conditions : '0',
 					voucherRangeInfo : this.form.voucherRangeInfo.length > 0 ? this.form.voucherRangeInfo.join(',') : null,
-					voucherPhoto : this.form.voucherPhoto.length > 0 ? this.form.voucherPhoto.join(',') : null
+					// voucherPhoto : this.form.voucherPhoto.length > 0 ? this.form.voucherPhoto.join(',') : null
+						voucherPhoto:temp.length > 0 ? temp.join(',') : null
 				}
 				if (this.productId == '') {
 					this.$http.post("/merchant/localVoucherInfo/add", { ...this.form,...data, merchantId: uni.getStorageSync(USER_INFO).merchantId }).then(res => {
@@ -459,7 +479,16 @@ export default {
 			this.$http.get("/merchant/localVoucherInfo/queryById?id="+this.productId ).then(res => {
 				if(res.data.success){
 					res.data.result.voucherRangeInfo=res.data.result.voucherRangeInfo?res.data.result.voucherRangeInfo.split(',').filter(id => id ):[]
-					res.data.result.voucherPhoto=res.data.result.voucherPhoto!==null && res.data.result.voucherPhoto.length>0?res.data.result.voucherPhoto.split(',').filter(id => id ):[]
+					// res.data.result.voucherPhoto=res.data.result.voucherPhoto!==null && res.data.result.voucherPhoto.length>0?res.data.result.voucherPhoto.split(',').filter(id => id ):[]
+					if(res.data.result.voucherPhoto){
+						let xqtemp = []
+						xqtemp = res.data.result.voucherPhoto.split(',')
+						xqtemp.map(item => {
+							this.xqImage.push({
+								url: item
+							})
+						})
+					}
 					res.data.result.conditionsUse = res.data.result.conditions == '0' ? '1' : '2'
 					res.data.result.voucherWay = res.data.result.voucherWay? res.data.result.voucherWay+'':''
 					this.voucherWayInfo1=res.data.result.voucherWay=='1'?res.data.result.voucherWayInfo:''

+ 6 - 10
pages/product/creatProduct.vue

@@ -301,7 +301,6 @@ export default {
 			// imageHttp: 'http://192.168.0.36:8080/jeecg-boot/', //上传图片前缀+
 			imageHttp: configService.apiUrl + '/', //上传图片前缀+
 			productId: '',
-			postImage: [], //上传图片详情
 			jindouChecked: false,
 			jifenChecked: false,
 		}
@@ -318,23 +317,17 @@ export default {
 		},
 		//上传详情图
 		detailsSuccess(res, index, lists) {
-			// this.postImage.push({url:this.imageHttp + res.message})
-			this.postImage = lists
+			this.xqImage = lists
 
 		},
 		detailsRemove(index, lists) {
-			this.postImage = lists
+			this.xqImage = lists
 		},
 		//下一步
 		next() {
 			console.log(this.tabIndex);
 			
 			let temp = []
-			if (this.postImage.length > 0) {
-				this.postImage.forEach(item => {
-					temp.push(this.imageHttp + item.response.message)
-				})
-			}
 			if ( this.xqImage.length > 0) {
 				this.xqImage.forEach((item => {
 					temp.push(item.url)
@@ -637,7 +630,10 @@ export default {
 						this.showSellDate = res.data.result.expirationDays + '天后失效'
 					}
 					res.data.result.preBook == 0 ? this.makeChecked = false : this.makeChecked = true
-					this.showRule = res.data.result.refundLabelName + '·' + res.data.result.refundConfirmName
+					if(res.data.result.refundLabelName &&res.data.result.refundConfirmName ){
+						this.showRule = res.data.result.refundLabelName + '·' + res.data.result.refundConfirmName
+					}
+					
 					console.log(this.showRule)
 					uni.setStorage({
 						key: 'group',