浏览代码

Signed-off-by: liuboyan <632697560@qq.com>
修改商家信息

liuboyan 4 年之前
父节点
当前提交
b443d52811
共有 8 个文件被更改,包括 315 次插入10 次删除
  1. 2 2
      config/api.js
  2. 10 0
      pages.json
  3. 3 3
      pages/index/authorize.vue
  4. 2 2
      pages/index/register.vue
  5. 14 2
      pages/user/index.vue
  6. 3 1
      pagesMain/couponList.vue
  7. 8 0
      pagesMain/pickVideo.vue
  8. 273 0
      pagesMain/registerForm.vue

+ 2 - 2
config/api.js

@@ -1,5 +1,5 @@
-const WX_API_BASE = 'https://www.qianjiadi.com/'
-// const WX_API_BASE = 'https://hubw.jihengcc.cn/'
+// const WX_API_BASE = 'https://www.qianjiadi.com/'
+const WX_API_BASE = 'https://hubw.jihengcc.cn/'
 
 module.exports = {
 	//  微信登录

+ 10 - 0
pages.json

@@ -132,6 +132,16 @@
 			"style": {
 				"navigationBarTitleText": "授权用户"
 			}
+		}, {
+			"path": "registerForm",
+			"style": {
+				"navigationBarTitleText": "商户信息"
+			}
+		}, {
+			"path": "pickVideo",
+			"style": {
+				"navigationBarTitleText": "自助采摘"
+			}
 		}]
 	}],
 	"globalStyle": {

+ 3 - 3
pages/index/authorize.vue

@@ -36,14 +36,14 @@
 			goToSignIn() {
 				NET.request(API.authorizeSignIn, {}, 'POST').then(res => {
 					this.$refs.uTips.show({
-						title: '授权码登录成功',
+						title: '授权码登录成功,请重新登录',
 						type: 'success',
 					})
 					setTimeout(() => {
 						uni.switchTab({
-							url: '/pages/index/home'
+							url: '/pages/index/index'
 						});
-					}, 1000)
+					}, 2000)
 				}).catch(res => {
 					this.$refs.uTips.show({
 						title: '授权码登录失败',

+ 2 - 2
pages/index/register.vue

@@ -229,7 +229,7 @@
 						storeImgUrl: this.fileList.join(',')
 					}, 'PUT').then(res => {
 						this.$refs.uTips.show({
-							title: '注册成功',
+							title: '编辑成功',
 							type: 'success',
 						})
 						setTimeout(() => {
@@ -239,7 +239,7 @@
 						}, 1000)
 					}).catch(res => {
 						this.$refs.uTips.show({
-							title: '注册失败',
+							title: '编辑失败',
 							type: 'warning',
 						})
 					})

+ 14 - 2
pages/user/index.vue

@@ -29,7 +29,7 @@
 			</view>
 		</view>
 		<view class="cell-group">
-			<view class="item-btn" @click="">
+			<view class="item-btn" @click="pickClick()">
 				<view class="iconfont icondizhiguanli item-btn-icon"></view>
 				<view class="item-btn-text">自助采摘</view>
 				<view class="iconfont iconfangxiang"></view>
@@ -46,7 +46,7 @@
 			</view>
 		</view>
 		<view class="cell-group">
-			<view class="item-btn" @click="">
+			<view class="item-btn" @click="infoClick()">
 				<view class="iconfont icondizhiguanli item-btn-icon"></view>
 				<view class="item-btn-text">商户信息</view>
 				<view class="iconfont iconfangxiang"></view>
@@ -85,6 +85,12 @@
 					url: '/pagesMain/orderList?type=' + type
 				});
 			},
+			//  自助采摘
+			pickClick() {
+				uni.navigateTo({
+					url: '/pagesMain/pickVideo'
+				});
+			},
 			//  授权
 			authorizeClick() {
 				uni.navigateTo({
@@ -97,6 +103,12 @@
 					url: '/pagesMain/couponList'
 				});
 			},
+			//  商户信息
+			infoClick() {
+				uni.navigateTo({
+					url: '/pagesMain/registerForm'
+				});
+			},
 			//  关于我们
 			aboutUsClick() {
 				uni.navigateTo({

+ 3 - 1
pagesMain/couponList.vue

@@ -201,7 +201,9 @@
 				}
 			}
 		}
-
+		/deep/.u-divider{
+			background-color: transparent!important;
+		}
 		.form-handle {
 			width: 100%;
 			height: 60px;

+ 8 - 0
pagesMain/pickVideo.vue

@@ -0,0 +1,8 @@
+<template>
+</template>
+
+<script>
+</script>
+
+<style>
+</style>

+ 273 - 0
pagesMain/registerForm.vue

@@ -0,0 +1,273 @@
+<template>
+	<view class="container">
+		<u-cell-group class="form-info" :border="false">
+			<u-field label="商家名称" placeholder="请输入商家名称" label-width="180" v-model="shopInfo.name" disabled></u-field>
+			<u-cell-item title="请上传商家图标" :arrow="false">
+				<view slot="label">
+					<u-upload :action="uploadUrl" :file-list="defaultList1" :form-data="uploadData" @on-success="logoUploadSuccess"
+					 @on-error="uploadError" max-count="1"></u-upload>
+				</view>
+			</u-cell-item>
+			<u-cell-item :title="'请上传店铺主图(' + fileList.length + '/3)'" :arrow="false">
+				<view slot="label">
+					<u-upload :action="uploadUrl" :file-list="defaultList2" :form-data="uploadData" @on-success="uploadSuccess"
+					 @on-error="uploadError" @on-remove="uploadRemove" max-count="3"></u-upload>
+				</view>
+			</u-cell-item>
+			<u-cell-item title="请上传身份证正反面" :arrow="false">
+				<view slot="label" class="id-card-box">
+					<cover-image class="id-card" :src="shopInfo.idCardCopyFilePath"></cover-image>
+					<cover-image class="id-card" :src="shopInfo.idCardNationalFilePath"></cover-image>
+				</view>
+			</u-cell-item>
+			<u-cell-item title="请上传营业执照照片" :arrow="false">
+				<view slot="label" class="license-box">
+					<cover-image class="license-img" :src="shopInfo.businessLicenseCopyFilePath"></cover-image>
+				</view>
+			</u-cell-item>
+			<u-field label="法人姓名" placeholder="请输入法人姓名" label-width="180" v-model="shopInfo.duty" disabled></u-field>
+			<u-cell-item title="所在城市" @click="regionShow = true">
+				<text v-show="shopInfo.companyAddressProvince">{{shopInfo.companyAddressProvince}}-{{shopInfo.companyAddressCity}}-{{shopInfo.companyAddressDistrict}}</text>
+			</u-cell-item>
+			<u-field label="联系方式" placeholder="请输入联系方式" label-width="180" v-model="shopInfo.contactTel"></u-field>
+			<u-field label="收款人姓名" placeholder="请输入收款人姓名" label-width="180" v-model="shopInfo.collectionName" disabled></u-field>
+			<u-field label="户名" placeholder="请输入户名" label-width="180" v-model="shopInfo.bankAccountName" disabled></u-field>
+			<u-field label="银行名称" placeholder="请输入银行名称" label-width="180" v-model="shopInfo.bankAllName" disabled></u-field>
+			<u-field label="银行卡号" placeholder="请输入银行卡号" label-width="180" v-model="shopInfo.bankNumber" disabled></u-field>
+		</u-cell-group>
+		<view class="form-handle">
+			<u-button type="success" shape="circle" :ripple="true" @click="edit = true" class="handle-custom" v-if="!edit">编辑</u-button>
+			<u-button type="success" shape="circle" :ripple="true" @click="submitData" class="handle-custom" v-else>提交</u-button>
+		</view>
+		<u-picker mode="region" v-model="regionShow" @confirm="setRegion"></u-picker>
+		<u-top-tips ref="uTips"></u-top-tips>
+	</view>
+</template>
+
+<script>
+	const NET = require('@/utils/request')
+	const API = require('@/config/api')
+	export default {
+		data() {
+			return {
+				edit: false,
+				shopInfo: {
+					name: '',
+					logo: '',
+					idCardCopyFilePath: '',
+					idCardNationalFilePath: '',
+					businessLicenseCopyFilePath: '',
+					duty: '',
+					companyAddressProvince: '',
+					companyAddressCity: '',
+					companyAddressDistrict: '',
+					contactTel: '',
+					collectionName: '',
+					bankAccountName: '',
+					bankAllName: '',
+					bankNumber: '',
+				},
+				regionShow: false,
+				uploadData: {
+					folderId: 0,
+				},
+				uploadUrl: '',
+				fileList: [],
+				defaultList1: [],
+				defaultList2: [],
+			}
+		},
+		onLoad(options) {
+			this.uploadUrl = API.uploadFile
+			NET.request(API.getShopRegisterInfo, {}, 'GET').then(res => {
+				this.shopInfo = {
+					name: res.data.name,
+					logo: res.data.logo,
+					idCardCopyFilePath: res.data.idCardCopyFilePath,
+					idCardNationalFilePath: res.data.idCardNationalFilePath,
+					businessLicenseCopyFilePath: res.data.businessLicenseCopyFilePath,
+					duty: res.data.duty,
+					companyAddressProvince: res.data.companyAddressProvince,
+					companyAddressCity: res.data.companyAddressCity,
+					companyAddressDistrict: res.data.companyAddressDistrict,
+					contactTel: res.data.contactTel,
+					collectionName: res.data.collectionName,
+					bankAccountName: res.data.bankAccountName,
+					bankAllName: res.data.bankAllName,
+					bankNumber: res.data.bankNumber,
+				}
+				this.fileList = res.data.storeImgUrl.split(',')
+				this.defaultList1 = [{
+					url: res.data.logo
+				}]
+				this.defaultList2 = res.data.storeImgUrl.split(',').map(site => {
+					return {
+						url: site
+					}
+				})
+			}).catch(res => {
+				this.$refs.uTips.show({
+					title: '获取注册信息失败',
+					type: 'warning',
+				})
+			})
+		},
+		methods: {
+			//  logo上传成功回调
+			logoUploadSuccess(res, index, lists, name) {
+				this.shopInfo.logo = res.data.url
+				this.$refs.uTips.show({
+					title: 'logo上传成功',
+					type: 'success',
+				})
+				return true
+			},
+			//  文件上传成功回调
+			uploadSuccess(res, index, lists, name) {
+				this.fileList.push(res.data.url)
+				this.$refs.uTips.show({
+					title: '文件上传成功',
+					type: 'success',
+				})
+				return true
+			},
+			//  文件上传失败回调
+			uploadError(res, index, lists, name) {
+				this.$refs.uTips.show({
+					title: '文件上传失败',
+					type: 'warning',
+				})
+			},
+			//  移除文件回调
+			uploadRemove(index, lists, name) {
+				this.fileList.splice(index, 1)
+			},
+			//  设置地址
+			setRegion(data) {
+				this.shopInfo.companyAddressProvince = data.province.label
+				this.shopInfo.companyAddressCity = data.city.label
+				this.shopInfo.companyAddressDistrict = data.area.label
+			},
+			//  提交
+			submitData() {
+				let required = true
+				for (let key in this.shopInfo) {
+					if (!this.shopInfo[key]) {
+						required = false
+					}
+				}
+				if (!required) {
+					this.$refs.uTips.show({
+						title: '请填写必填项',
+						type: 'warning',
+					})
+					return false
+				}
+				if (this.fileList.length != 3) {
+					this.$refs.uTips.show({
+						title: '店铺主页图需上传三张',
+						type: 'warning',
+					})
+					return false
+				}
+				NET.request(API.editShopRegisterInfo, {
+					...this.shopInfo,
+					address: this.shopInfo.companyAddressProvince + '-' + this.shopInfo.companyAddressCity + '-' + this.shopInfo.companyAddressDistrict,
+					companyAddress: this.shopInfo.companyAddressProvince + '-' + this.shopInfo.companyAddressCity + '-' + this.shopInfo
+						.companyAddressDistrict,
+					storeImgUrl: this.fileList.join(',')
+				}, 'PUT').then(res => {
+					this.$refs.uTips.show({
+						title: '编辑成功',
+						type: 'success',
+					})
+					setTimeout(() => {
+						uni.switchTab({
+							url: '/pages/user/index'
+						})
+					}, 1000)
+				}).catch(res => {
+					this.$refs.uTips.show({
+						title: '编辑失败',
+						type: 'warning',
+					})
+				})
+			},
+		},
+	}
+</script>
+
+<style lang="less" scoped>
+	page {
+		width: 100%;
+		height: 100%;
+	}
+
+	.container {
+		width: 100%;
+		height: 100%;
+		float: left;
+		overflow-y: auto;
+
+		.form-info {
+			width: 100%;
+			float: left;
+
+			/deep/.u-label-text {
+				color: #333333;
+			}
+
+			/deep/.u-cell_title {
+				color: #333333;
+			}
+
+			.id-card-box {
+				display: flex;
+
+				.id-card {
+					width: 164px;
+					height: 140px;
+					box-sizing: border-box;
+					margin-right: 14px;
+					border-radius: 6px;
+				}
+			}
+
+			.license-box {
+
+				.license-img {
+					width: 345px;
+					height: 145px;
+				}
+
+			}
+
+			.license-text {
+				width: 345px;
+				height: 30px;
+				margin-top: 5px;
+				font-size: 15px;
+				font-family: PingFang SC;
+				color: #656565;
+				line-height: 30px;
+				text-align: center;
+			}
+		}
+
+		.form-handle {
+			width: calc(100% - 30px);
+			float: left;
+			height: 40px;
+			margin: 30px 15px 20px 15px;
+
+
+			.handle-custom {
+				background-color: #51A539;
+			}
+
+			// /deep/.u-btn--success--disabled {
+			// 	background-color: #999999 !important;
+			// }
+		}
+	}
+</style>