Forráskód Böngészése

编辑,待完善数据

忆雪 10 hónapja
szülő
commit
7289bcf646

+ 118 - 113
src/pageMerchant/mineModule/certification/components/ImgsUpload.vue

@@ -1,113 +1,118 @@
-<template>
-  <view class="imageUpload">
-    <view class="images-box" @click="handlerUploadImg" v-if="fileList.length">
-      <image
-        class="upd-img"
-        v-for="(item, index) of fileList"
-        :key="index"
-        :src="item"
-        mode="aspectFill"
-      ></image>
-    </view>
-
-    <view class="images-box" @click="handlerUploadImg" v-else>
-      <image src="/static/upload.jpg" mode="aspectFill"></image>
-    </view>
-  </view>
-</template>
-
-<script>
-export default {
-  props: {
-    value: {
-      type: String,
-      default: '',
-    },
-  },
-  data() {
-    return {
-      uploadCount: 0,
-      fileList: [],
-    };
-  },
-  onLoad(option) {},
-  onShow() {},
-  created() {},
-  methods: {
-    // 上传头像
-    async handlerUploadImg() {
-      try {
-        const res = await uni.showActionSheet({
-          itemList: ['拍照', '从相册选择'],
-        });
-        if (res.tapIndex === 0) {
-          // 用户选择拍照
-          this.takePhoto();
-        } else if (res.tapIndex === 1) {
-          // 用户选择从相册选择
-          this.chooseImage();
-        }
-      } catch (error) {
-        console.error(error);
-      }
-    },
-    // 拍照
-    takePhoto() {
-      uni.chooseImage({
-        sourceType: ['camera'],
-        count: 1 - this.uploadCount,
-        success: res => {
-          const tempFilePaths = res.tempFilePaths;
-          // 调用上传图片的方法
-          tempFilePaths.map(rs => {
-            this.uploadAvatar(rs);
-          });
-        },
-        fail: error => {
-          console.error(error);
-        },
-      });
-    },
-    //从相册中选择
-    chooseImage() {
-      uni.chooseImage({
-        sourceType: ['album'],
-        count: 9 - this.uploadCount,
-        success: res => {
-          const tempFilePaths = res.tempFilePaths;
-          tempFilePaths.map(rs => {
-            this.uploadAvatar(rs);
-          });
-          // 调用上传图片的方法
-        },
-        fail: error => {
-          console.error(error);
-        },
-      });
-    },
-    // 上传头像
-    uploadAvatar(filePath) {
-      // 在这里实现上传头像的逻辑,将filePath作为参数传入
-      this.fileList.push(filePath);
-      this.uploadCount = this.fileList.length;
-      // 手动触发组件的重新渲染
-      this.$forceUpdate();
-      this.$emit('update', this.fileList, this.value);
-    },
-  },
-};
-</script>
-
-<style lang="scss" scoped>
-.imageUpload {
-  .images-box {
-    width: 100%;
-    height: 400rpx;
-    background-color: pink;
-    image {
-      height: 100%;
-      width: 100%;
-    }
-  }
-}
-</style>
+<template>
+	<view class="imageUpload">
+		<view class="images-box" @click="handlerUploadImg" v-if="fileList.length">
+			<image class="upd-img" v-for="(item, index) of fileList" :key="index" :src="item" mode="aspectFill"></image>
+		</view>
+
+		<view class="images-box" @click="handlerUploadImg" v-else>
+			<image src="/static/upload.jpg" mode="aspectFill"></image>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		props: {
+			value: {
+				type: String,
+				default: '',
+			},
+			imageList: {
+				type: String,
+				default: ""
+			}
+		},
+		data() {
+			return {
+				uploadCount: 0,
+				fileList: [],
+			};
+		},
+		onLoad(option) {},
+		onShow() {
+
+		},
+		mounted() {
+
+			this.fileList = this.imageList.split(',')
+		},
+		created() {},
+		methods: {
+			// 上传头像
+			async handlerUploadImg() {
+				try {
+					const res = await uni.showActionSheet({
+						itemList: ['拍照', '从相册选择'],
+					});
+					if (res.tapIndex === 0) {
+						// 用户选择拍照
+						this.takePhoto();
+					} else if (res.tapIndex === 1) {
+						// 用户选择从相册选择
+						this.chooseImage();
+					}
+				} catch (error) {
+					console.error(error);
+				}
+			},
+			// 拍照
+			takePhoto() {
+				uni.chooseImage({
+					sourceType: ['camera'],
+					count: 1 - this.uploadCount,
+					success: res => {
+						const tempFilePaths = res.tempFilePaths;
+						// 调用上传图片的方法
+						tempFilePaths.map(rs => {
+							this.uploadAvatar(rs);
+						});
+					},
+					fail: error => {
+						console.error(error);
+					},
+				});
+			},
+			//从相册中选择
+			chooseImage() {
+				uni.chooseImage({
+					sourceType: ['album'],
+					count: 9 - this.uploadCount,
+					success: res => {
+						const tempFilePaths = res.tempFilePaths;
+						tempFilePaths.map(rs => {
+							this.uploadAvatar(rs);
+						});
+						// 调用上传图片的方法
+					},
+					fail: error => {
+						console.error(error);
+					},
+				});
+			},
+			// 上传头像
+			uploadAvatar(filePath) {
+				// 在这里实现上传头像的逻辑,将filePath作为参数传入
+				this.fileList.push(filePath);
+				this.uploadCount = this.fileList.length;
+				// 手动触发组件的重新渲染
+				this.$forceUpdate();
+				this.$emit('update', this.fileList, this.value);
+			},
+		},
+	};
+</script>
+
+<style lang="scss" scoped>
+	.imageUpload {
+		.images-box {
+			width: 100%;
+			height: 400rpx;
+			background-color: pink;
+
+			image {
+				height: 100%;
+				width: 100%;
+			}
+		}
+	}
+</style>

+ 72 - 7
src/pageMerchant/mineModule/certification/storeInformation.vue

@@ -113,14 +113,15 @@
 
 			<view class="content-box">
 				<u-form-item prop="storeImage">
-					<imgs-upload @update="fileList" :value="1"></imgs-upload>
+					<imgs-upload @update="fileList" :value="1" :imageList="storeInfo.storeImage"></imgs-upload>
 					<p class="upload-text">店铺门面图(需要包含完整牌匾)</p>
 				</u-form-item>
 			</view>
 
 			<view class="content-box">
 				<u-form-item prop="storeInnerImage">
-					<imgs-upload @update="fileList" :value="2"></imgs-upload>
+					<imgs-upload @update="fileList" :value="2"
+						:imageList="storeInfo.storeInnerImage.map(item => item.url).join(',')"></imgs-upload>
 					<p class="upload-text">店内真实环境图</p>
 				</u-form-item>
 			</view>
@@ -152,6 +153,9 @@
 				storeAddress: "",
 				mainBusinessName: "", // 主营业务,
 				ancillaryBusinessName: [], // 辅营业务
+
+				mainBusinessList: [], // 主营业务下拉数组
+				ancillaryBusinessList: [], // 辅营业务数组
 				storeInfo: {
 					region: '',
 					storeAddressDetail: '',
@@ -246,20 +250,48 @@
 				cityLevel3: [],
 
 				list: [], // 数组控制器
-				mainBusinessList: [], // 主营业务下拉数组
-				ancillaryBusinessList: [], // 辅营业务数组
+
 
 			};
 		},
 		onReady() {
 			//如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则。
 			this.$refs.uForm.setRules(this.rules);
+		},
+		created() {
+			this.request()
+		},
+		mounted() {
+
 		},
 		onShow() {
 			this.initCityData();
-			this.request()
-			console.log(this.mainBusinessList, this.ancillaryBusinessList)
+			if (this.$store.state.data.merchantInfo) {
+				this.storeInfo = {
+					region: this.$store.state.data.merchantInfo.merchant.region,
+					storeAddressDetail: this.$store.state.data.merchantInfo.storeAddressDetail,
+					legalRepresentativeName: this.$store.state.data.merchantInfo.legalRepresentativeName,
+					mobileNumber: this.$store.state.data.merchantInfo.mobileNumber,
+					storeName: this.$store.state.data.merchantInfo.storeName,
+					storeImage: this.$store.state.data.merchantInfo.storeImage,
+					storeInnerImage: this.$store.state.data.merchantInfo.storeInnerImage,
+					email: this.$store.state.data.merchantInfo.email,
+					longitude: this.$store.state.data.merchantInfo.merchant.longitude,
+					latitude: this.$store.state.data.merchantInfo.merchant.latitude,
+					opening: this.$store.state.data.merchantInfo.merchant.opening,
+
+					city: this.$store.state.data.merchantInfo.merchant.region.toString().slice(0, -2) + "00",
+					province: this.$store.state.data.merchantInfo.merchant.region.toString().slice(0, -4) + "00",
+					district: this.$store.state.data.merchantInfo.merchant.region,
+					mainBusiness: this.$store.state.data.merchantInfo.merchant.mainBusiness, // 主营业务,
+					ancillaryBusiness: this.$store.state.data.merchantInfo.merchant.ancillaryBusiness, // 辅营业务
+				}
+				console.log(this.$store.state.data.merchantInfo, "this.$store.state.data.merchantInfo")
+				// console.log(this.storeInfo)
+
+			}
 		},
+
 		methods: {
 
 			async request() {
@@ -282,6 +314,18 @@
 						status: 1
 					}
 				})
+				if (this.$store.state.data.merchantInfo) {
+
+					this.mainBusinessName = this.nameFunction([this.$store.state.data.merchantInfo.merchant
+							.mainBusiness
+						],
+						this
+						.mainBusinessList)
+					this.ancillaryBusinessName = this.nameFunction(this.$store.state.data.merchantInfo.merchant
+						.ancillaryBusiness, this.ancillaryBusinessList)
+				}
+
+				console.log(this.ancillaryBusinessList, "这是请i去的")
 			},
 			// 手动选择城市
 			manualGetLocation() {
@@ -414,6 +458,7 @@
 			},
 			// 图片
 			fileList(val, data) {
+				console.log(data, "data")
 				if (data == 1) {
 					this.storeInfo.storeImage = val[0];
 				} else if (data == 2) {
@@ -425,7 +470,27 @@
 					})
 				}
 			},
-			// 点击选择主营业务
+
+			//回显时展示的
+			nameFunction(idArray, services) {
+				let nameString = ''
+				if (idArray.length > 1) {
+					nameString = idArray
+						.map(id => services.find(service => service.id == id))
+						.filter(service => service)
+						.map(service => service.name);
+				} else {
+
+					nameString = idArray
+						.map(id => services.find(service => service.id == id))
+						.filter(service => service)
+						.map(service => service.name)
+						.join(',');
+
+				}
+				return nameString;
+			}
+
 		},
 	};
 </script>

+ 12 - 0
src/pageMerchant/mineModule/openStoreAppealDetail.vue

@@ -92,6 +92,9 @@
 				<view class="img-text">证件正面图</view>
 			</view>
 		</view>
+
+		<view class="btn"><u-button @click="compileHalend" type="primary" shape="circle"  size="large" text="编辑"></u-button></view>
+
 	</view>
 </template>
 
@@ -132,6 +135,11 @@
 			this.request();
 		},
 		methods: {
+			compileHalend(){
+				uni.navigateTo({
+					url:"/pageMerchant/mineModule/certification/storeInformation"
+				})
+			},
 			async request() {
 				const res = await getParentCategoriesData({
 					type: 0
@@ -241,5 +249,9 @@
 				}
 			}
 		}
+		.btn{
+			margin-bottom: 50rpx;
+			padding: 0 20rpx;
+		}
 	}
 </style>