qukaidi 4 years ago
parent
commit
11cac3ba9a

+ 11 - 3
pages.json

@@ -306,10 +306,18 @@
 				"navigationBarTitleText": "零售店注册"
 			}
 
-		},{
-            "path" : "register_map",
+		}, {
+			"path": "register_map",
               "style": {
-              	"navigationBarTitleText": "地图"
+				"navigationBarTitleText": "地图",
+				"app-plus": {
+					"titleNView": {
+						"buttons": [{
+							"text": "确认",
+							"fontSize": "16"
+						}]
+					}
+				}
             }
                 
         }]

+ 55 - 23
pages/login/register.vue

@@ -8,7 +8,8 @@
 				</view>
 			</view>
 			<view slot="body">
-				<u-upload :custom-btn="true" max-count="1" class="u-flex u-row-center" :before-upload="storeUpload">
+				<u-upload :custom-btn="true" max-count="1" class="u-flex u-row-center" :action="action" :form-data="licensepicType"
+				 @on-change="getLicensedata">
 					<view slot="addBtn" hover-class="slot-btn__hover" hover-stay-time="150">
 						<u-image width="475rpx" height="303rpx" src="../../static/sailun/upload_preview.png"></u-image>
 					</view>
@@ -16,7 +17,8 @@
 				<view class="u-flex u-row-center" style="color: #787878;margin: 20rpx 0 60rpx 0;">
 					点击上传营业执照
 				</view>
-				<u-upload :custom-btn="true" max-count="1" class="u-flex u-row-center">
+				<u-upload :custom-btn="true" max-count="1" class="u-flex u-row-center" :action="action" :form-data="storepicType"
+				 @on-change="getStoredata">
 					<view slot="addBtn" hover-class="slot-btn__hover" hover-stay-time="150">
 						<u-image width="475rpx" height="303rpx" src="../../static/sailun/upload_preview.png"></u-image>
 					</view>
@@ -30,17 +32,29 @@
 			注:上传完营业执照请确认和营业执照一致。
 		</view>
 		<view style="margin: 30rpx;">
-			<u-button type="primary" :ripple="true" ripple-bg-color="#99d4ff" @click="nextStep">下一步</u-button>
+			<!-- <u-button type="primary" @click="nextStep" v-if="showLicense&&showStore">下一步</u-button> -->
+			<u-button type="primary" @click="nextStep">下一步</u-button>
 		</view>
 	</view>
 </template>
 
 <script>
-	import axios from 'axios'
+	import {
+		request
+	} from '../../common/request/request'
+	require("promise.prototype.finally").shim()
 	export default {
 		data() {
 			return {
-				action: ""
+				action: "http://b2bcnapi.sailuntire.com/allstell/test/app/sailun/appStoreBasicInfo/storeupload",
+				licensepicType: {
+					"pictype": "license"
+				},
+				storepicType: {
+					"pictype": "store"
+				},
+				showLicense:false,
+				showStore:false,
 			};
 		},
 		methods: {
@@ -48,26 +62,44 @@
 				this.$u.route({
 					url: 'pages/login/register_2',
 				})
-			},
-			storeUpload(index, list) {
-				let file = list[0].file.path
-				console.log(file)
-				let param = new FormData() // 创建form对象
-				param.append('file', file) // 通过append向form对象添加数据
-				param.append('pictype', 'store') // 添加form表单中其他数据
-				let config = {
-					headers: {
-						'Content-Type': 'multipart/form-data'
-					}
+				if(this.licenseDate){
+					uni.$emit('licenseData',this.licenseDate)
 				}
-				axios.post('/appStoreBasicInfo/storeupload', param, config)
-					.then(res => {
-						console.log("上传上去了吗")
-						console.log(res)
-					})
-					.catch(err => {
+				uni.$emit('dataUrl',{licenseUrl:this.licenseUrl,storeUrl:this.storeUrl})
+			},
+			getLicensedata(res, index, lists, name) {
+				if (res.statusCode == 200) {
+					this.$u.toast('上传成功');
+					uni.hideLoading();
+					this.licenseUrl = JSON.parse(res.data).data
+					request({
+						url: '/sailun/appStoreBasicInfo/licenseAnalyse',
+						method: 'post',
+						data: {
+							"fileBox": this.licenseUrl,
+						}
+					}).then(res => {
+						if (res.data.code == 0) {
+							this.$u.toast('识别成功');
+							this.licenseDate = res.data.data.wordsResultQuery
+							this.showLicense=true
+						}
+						if (res.data.code == 500) {
+							this.$refs.uToast.show({
+								title: res.data.msg,
+							})
+						}
+					}).catch(err => {
 						console.log(err)
-					})
+					}).finally(() => {})
+				}
+			},
+			getStoredata(res, index, lists, name) {
+				if (res.statusCode == 200) {
+					this.$u.toast('上传成功');
+					this.storeUrl = JSON.parse(res.data).data
+					this.showStore=true
+				}
 			}
 		},
 	}

+ 148 - 73
pages/login/register_2.vue

@@ -19,7 +19,7 @@
 						<view style="margin-right: 10rpx;">
 							<u-icon name="home" size="36"></u-icon>
 						</view>
-						<u-input v-model="form.company" placeholder="请输入公司名称" />
+						<u-input v-model="form.company" placeholder="请输入公司名称" :disabled="true" />
 					</u-form-item>
 					<u-form-item prop="name">
 						<view style="margin-right: 10rpx;">
@@ -31,13 +31,13 @@
 						<view style="margin-right: 10rpx;">
 							<u-icon name="phone" size="36"></u-icon>
 						</view>
-						<u-input v-model="form.phone" placeholder="请输入联系电话" type="number"/>
+						<u-input v-model="form.phone" placeholder="请输入联系电话" type="number" />
 					</u-form-item>
 					<u-form-item prop="code">
 						<view style="margin-right: 10rpx;">
 							<u-icon name="lock" size="36"></u-icon>
 						</view>
-						<u-input v-model="form.code" placeholder="请输入验证码" type="number"/>
+						<u-input v-model="form.code" placeholder="请输入验证码" type="number" />
 						<view class="" slot="right">
 							<u-button size="mini" type="primary" @click="getCode" shape="circle">{{codeText}}</u-button>
 						</view>
@@ -46,27 +46,28 @@
 						<view style="margin-right: 10rpx;">
 							<u-icon name="map" size="36"></u-icon>
 						</view>
-						<u-input :select-open="pickerShow" v-model="form.region" placeholder="点击选择省市区" @click="pickerShow = true" :disabled="true"></u-input>
+						<u-input :select-open="pickerShow" v-model="form.region" placeholder="点击选择省市区" @click="pickerShow = true"
+						 :disabled="true"></u-input>
 						<view class="" slot="right">
 							<u-icon name="arrow-right" color="#666666" size="36"></u-icon>
 						</view>
 					</u-form-item>
-					<u-form-item>
+					<u-form-item prop="addressInfo">
 						<view style="margin-right: 10rpx;">
 							<u-icon name="map" size="36"></u-icon>
 						</view>
-						<u-input placeholder="点击选择详细地址" :disabled="true" @click="inMap"></u-input>
+						<u-input placeholder="点击选择详细地址" v-model="form.addressInfo" :disabled="true" @click="inMap"></u-input>
 						<view class="" slot="right">
 							<u-icon name="arrow-right" color="#666666" size="36"></u-icon>
 						</view>
 					</u-form-item>
 				</u-form>
 				<u-verification-code ref="uCode" @change="codeChange"></u-verification-code>
-				<u-picker mode="region" v-model="pickerShow" @confirm="regionConfirm"></u-picker>
+				<u-picker mode="region" v-model="pickerShow" @confirm="regionConfirm" :default-region="defaultRegion"></u-picker>
 			</view>
 		</u-card>
 		<view style="margin: 30rpx;">
-			<u-button @click="nextStep" type="primary" :ripple="true" ripple-bg-color="#99d4ff">下一步</u-button>
+			<u-button @click="nextStep" type="primary">下一步</u-button>
 		</view>
 	</view>
 </template>
@@ -81,6 +82,7 @@
 			return {
 				codeText: '',
 				pickerShow: false,
+				defaultRegion: [],
 				form: {
 					store: '',
 					company: '',
@@ -88,97 +90,170 @@
 					phone: "",
 					code: '',
 					region: '',
+					latitude: '',
+					longitude: '',
+					province: "",
+					city: "",
+					district: "",
+					addressInfo: "",
+
 				},
 				rules: {
-					store: [{
-						required: true,
-						message: '请输入门店名称',
-						trigger: 'blur,change'
-					}],
-					company: [{
-						required: true,
-						message: '请输入公司名称',
-						trigger: 'blur,change'
-					}],
-					name: [{
-						required: true,
-						message: '请输入联系人',
-						trigger: 'blur,change'
-					}],
-					phone: [{
-						required: true,
-						message: '请输入联系电话',
-						trigger: 'blur,change'
-					}],
-					code: [{
-						required: true,
-						message: '请输入验证码',
-						trigger: 'blur,change'
-					}],
-					region: [{
-						required: true,
-						message: '请选择地区',
-						trigger: 'change',
-					}],
+					// store: [{
+					// 	required: true,
+					// 	message: '请输入门店名称',
+					// 	trigger: 'blur,change'
+					// }],
+					// company: [{
+					// 	required: true,
+					// 	message: '请输入公司名称',
+					// 	trigger: 'blur,change'
+					// }],
+					// name: [{
+					// 	required: true,
+					// 	message: '请输入联系人',
+					// 	trigger: 'blur,change'
+					// }],
+					// phone: [{
+					// 	required: true,
+					// 	message: '请输入联系电话',
+					// 	trigger: 'blur,change'
+					// }],
+					// code: [{
+					// 	required: true,
+					// 	message: '请输入验证码',
+					// 	trigger: 'blur,change'
+					// }],
+					// region: [{
+					// 	required: true,
+					// 	message: '请选择地区',
+					// 	trigger: 'change',
+					// }],
+					// addressInfo: [{
+					// 	required: true,
+					// 	message: '请选择地区',
+					// 	trigger: 'change',
+					// }],
 				}
 			};
 		},
+		created() {
+			uni.$on('licenseData', (data) => {
+				this.form.store = data.company.words
+				this.form.company = data.company.words
+				this.form.name = data.person.words
+			})
+			uni.$on('addressData', (data) => {
+				console.log(data)
+				this.form.latitude = data.coord.latitude
+				this.form.longitude = data.coord.longitude
+				this.form.addressInfo = data.address
+			})
+			let that = this
+			uni.getLocation({
+				type: 'wgs84',
+				geocode: true,
+				success: function(res) {
+					switch (res.address.province) {
+						case "北京市":
+							{
+								that.city = "直辖市"
+								break;
+							}
+						case "天津市":
+							{
+								that.city = "直辖市"
+								break;
+							}
+						case "上海市":
+							{
+								that.city = "直辖市"
+								break;
+							}
+						case "重庆市":
+							{
+								that.city = "直辖市"
+								break;
+							}
+						default:
+							{
+								that.city = "不是直辖市"
+								break;
+							}
+					}
+					if (that.city == "直辖市") {
+						let RegionData = res.address.province + "," + that.city + "," + res.address.district
+						that.defaultRegion = RegionData.split(",");
+					} else {
+						let RegionData = res.address.province + "," + res.address.city + "," + res.address.district
+						that.defaultRegion = RegionData.split(",");
+					}
+				}
+			});
+		},
 		methods: {
 			nextStep() {
 				this.$refs.uForm.validate(valid => {
 					if (valid) {
-						console.log('验证通过');
+						uni.$emit("formData", this.form)
 						this.$u.route({
 							url: 'pages/login/register_3',
 						})
+
 					} else {
 						console.log('验证失败');
 					}
-					
+
 				});
 			},
 			codeChange(text) {
 				this.codeText = text;
 			},
 			getCode() {
-				console.log(this.form.phone)
-				request({
-					url: '/sailun/appStoreBasicInfo/sendCode',
-					method: 'post',
-					data: {
-						"phoneNumber": parseInt(this.form.phone),
-					},
-				}).then(res => {
-					console.log(res)
-					if(res.data.code==0){
-						if (this.$refs.uCode.canGetCode) {
-							// 模拟向后端请求验证码
-							uni.showLoading({
-								title: '正在获取验证码',
-							})
-							setTimeout(() => {
-								uni.hideLoading();
-								// 通知验证码组件内部开始倒计时
-								this.$refs.uCode.start();
-							}, 1000);
-						} else {
-							this.$u.toast('倒计时结束后再发送');
+				if (this.form.phone) {
+					request({
+						url: '/sailun/appStoreBasicInfo/sendCode',
+						method: 'post',
+						data: {
+							"phoneNumber": parseInt(this.form.phone),
+						},
+					}).then(res => {
+						console.log(res)
+						if (res.data.code == 0) {
+							if (this.$refs.uCode.canGetCode) {
+								// 模拟向后端请求验证码
+								uni.showLoading({
+									title: '正在获取验证码',
+								})
+								setTimeout(() => {
+									uni.hideLoading();
+									// 通知验证码组件内部开始倒计时
+									this.$refs.uCode.start();
+								}, 1000);
+							} else {
+								this.$u.toast('倒计时结束后再发送');
+							}
 						}
-					}
-					if(res.data.code==500){
-						this.$u.toast(res.data.msg);
-					}
-				}).catch(err => {
-					console.log(err)
-				}).finally(() => {
-					this.loading = false;
-					uni.hideLoading();
-				})
+						if (res.data.code == 500) {
+							this.$u.toast(res.data.msg);
+						}
+					}).catch(err => {
+						console.log(err)
+					}).finally(() => {
+
+					})
+				} else {
+					this.$u.toast('请输入手机号');
+				}
+
 			},
 			regionConfirm(e) {
 				this.form.region = e.province.label + '-' + e.city.label + '-' + e.area.label;
+				this.form.province=e.province.label;
+				this.form.city=e.city.label;
+				this.form.district=e.area.label;
 			},
-			inMap(){
+			inMap() {
 				this.$u.route({
 					url: 'pages/login/register_map'
 				})

+ 112 - 36
pages/login/register_3.vue

@@ -34,7 +34,7 @@
 					<scroll-view scroll-y="true" style="height: 300rpx;">
 						<view class="u-flex u-row-center">
 							<u-checkbox-group :wrap="true" @change="checkboxGroupChange">
-								<u-checkbox v-model="item.checked" v-for="(item, index) in list" :key="index" :name="item.name" shape="circle">{{item.name}}</u-checkbox>
+								<u-checkbox v-model="item.checked" v-for="(item, index) in brandList" :key="index" :name="item.name" shape="circle">{{item.name}}</u-checkbox>
 							</u-checkbox-group>
 						</view>
 					</scroll-view>
@@ -92,12 +92,17 @@
 			</u-form-item>
 		</u-form>
 		<view style="margin:0 30rpx;">
-			<u-button @click="nextStep" type="primary" @tap="$u.debounce(submit, 2000,immediate = true)" :loading="loading" :ripple="true" ripple-bg-color="#99d4ff">确认注册</u-button>
+			<u-button @click="nextStep" type="primary" @tap="$u.debounce(submit, 2000,immediate = true)" :loading="loading"
+			 :ripple="true" ripple-bg-color="#99d4ff">确认注册</u-button>
 		</view>
 	</view>
 </template>
 
 <script>
+	import {
+		request
+	} from '../../common/request/request'
+	require("promise.prototype.finally").shim()
 	export default {
 		data() {
 			return {
@@ -108,35 +113,62 @@
 					protocol: false
 				},
 				form2: {},
-				list: [{
-						name: '第一个选项',
-						checked: false,
-						disabled: false
-					},
-					{
-						name: '第二个选项',
-						checked: false,
-						disabled: false
-					},
-					{
-						name: '第三个选项',
-						checked: false,
-						disabled: false
-					},
-					{
-						name: '第四个选项',
-						checked: false,
-						disabled: false
-					},
-					{
-						name: '第五个选项',
-						checked: false,
-						disabled: false
-					}
-				]
+				formData: [],
+				dataUrl: [],
+				agentList: [],
+				brandList: [] //品牌
 			}
 		},
+		created() {
+			uni.$on('formData', (data) => {
+				this.formData = data
+			})
+			uni.$on('dataUrl', (data) => {
+				this.dataUrl = data
+			})
+			this.getAgentArea()
+		},
 		methods: {
+			getAgentArea() {
+				request({
+					url: '/sailun/appStoreBasicInfo/getAgentArea',
+					method: 'post',
+					data: {
+						// "area": this.formData.district,
+						// "city": this.formData.city,
+						// "province": this.formData.province,
+						"area": "市北区",
+						"city": "青岛市",
+						"province": "山东省",
+						"spart": "10",
+						"vkorg": "8100",
+						"vtweg": "10"
+					},
+				}).then(res => {
+					// console.log(res)
+					if (res.data.code == 0) {
+						this.agentList = res.data.Data.data
+						// 从经销商里里面抽取品牌
+						const list = this.agentList.map((item,index) => {
+						    return item.brandList;
+						}).join(",").split(',')
+						//去重
+						const list2=[...new Set(list)]
+						//根据复选框的数据结构重组数组
+						this.brandList = list2.reduce((res,item)=>{
+							res.push({name:item,checked:false,disabled: false})
+							return res;
+						},[]);
+					}
+					if (res.data.code == 500) {
+						this.$u.toast(res.data.msg);
+					}
+				}).catch(err => {
+					console.log(err)
+				}).finally(() => {
+
+				})
+			},
 			checkboxGroupChange(e) {
 				this.cooperations = e
 			},
@@ -150,14 +182,58 @@
 
 			},
 			submit() {
-				this.loading = true
-				setTimeout(() => {
-					this.$u.route({
-						url: 'pages/login/index',
-						type:"reLaunch"
-					})
-					this.loading = false
-				}, 2000)
+				let data = {
+					// "addressInfo": this.formData.addressInfo,
+					"brandAgentLvQueryList": [{
+						"agent_id": "string",
+						"brand": "string",
+						"brandCode": "string",
+						"kunnr": "string",
+						"lvCount": "string",
+						"showLv": "string",
+						"spart": "string",
+						"vkorg": "string",
+						"vtweg": "string"
+					}],
+					"city": "string",
+					"contactName": "string",
+					"district": "string",
+					"jd": "string",
+					"licenseUrl": "string",
+					"mobileCode": "string",
+					"province": "string",
+					"storeImageUrl": "string",
+					"storeName": "string",
+					"storePhone": "string",
+					"version": 0,
+					"wd": "string"
+				}
+				console.log(data)
+				request({
+					url: '/sailun/appStoreBasicInfo/storeReg',
+					method: 'post',
+					data: data
+				}).then(res => {
+
+					console.log(res)
+					if (res.data.code == 0) {
+						this.loading = true
+						setTimeout(() => {
+							this.$u.route({
+								url: 'pages/login/index',
+								type: "reLaunch"
+							})
+							this.loading = false
+						}, 2000)
+					}
+					if (res.data.code == 500) {
+						this.$u.toast(res.data.msg);
+					}
+				}).catch(err => {
+					console.log(err)
+				}).finally(() => {
+
+				})
 			},
 		}
 	}

+ 66 - 23
pages/login/register_map.vue

@@ -1,12 +1,12 @@
 <template>
 	<view>
-		<view class="page-body">
-			<view class="page-section page-section-gap">
-				<map style="width: 100%;height: 100vh;" :markers="markers"  :longitude="longitude" :latitude="latitude" :circles="circles">
-				</map>
-			</view>
+		<map id="myMap" style="width: 750rpx;height: 80vh;" :markers="markers" :longitude="longitude" :latitude="latitude"
+		 @tap="onTap">
+		</map>
+		<view class="">
+			请双击定位<br>
+			{{addressData.address}}
 		</view>
-
 	</view>
 </template>
 
@@ -14,39 +14,82 @@
 	export default {
 		data() {
 			return {
-				circles: [], //圆
 				markers: [], //标记点
-				latitude: 39.9,
-				longitude: 116.4,
+				latitude: 0,
+				longitude: 0,
+				createMap: "",
+				touch: false,
+				addressData:''
 			};
 		},
-		onLoad() {
-			const _this = this;
-			uni.getSystemInfo({
-				success: (res) => {
-					_this.mapHeight = res.screenHeight - res.statusBarHeight
-					_this.mapHeight = _this.mapHeight
-				}
-			})
+		onNavigationBarButtonTap(e) {
+			if (e.index == 0) {
+				this.inBack()
+			}
 		},
 		created() {
-			var that = this
+			let that = this
 			uni.getLocation({
-				type: 'wgs84',
+				type: 'gcj02',
+				geocode: true,
 				success(res) {
-					console.log(res, "当前位置");
 					that.latitude = res.latitude
 					that.longitude = res.longitude
-					//标记点
+					let point = new plus.maps.Point(that.longitude, that.latitude);
+					plus.maps.Map.reverseGeocode(
+						point, {},
+						function(event) {
+							that.addressData= event;
+						},
+						function(e) {}
+					);
 					that.markers = [{
 						id: 1,
 						latitude: res.latitude,
 						longitude: res.longitude,
-						iconPath: '/static/sailun/map-pin.png',
+						iconPath: '/static/sailun/gps-icon.png',
 					}]
 				}
 			});
-		}
+		},
+		onReady() {
+			this.createMap = uni.createMapContext('myMap', this);
+		},
+		methods: {
+			inBack() {
+				uni.$emit("addressData", this.addressData)
+				uni.navigateBack({})
+			},
+			onTap(e) {
+				console.log(e)
+				if (e.type == 'click') {
+					let that = this;
+					this.createMap.getCenterLocation({
+						success(res) {
+							console.log(res)
+							that.latitude = res.latitude
+							that.longitude = res.longitude
+							that.markers = [{
+								id: 1,
+								latitude: that.latitude,
+								longitude: that.longitude,
+								iconPath: '/static/sailun/gps-icon.png',
+							}]
+							let point = new plus.maps.Point(res.longitude, res.latitude);
+							plus.maps.Map.reverseGeocode(
+								point, {},
+								function(event) {
+									that.addressData= event;
+								},
+								function(e) {}
+							);
+						}
+					})
+				}
+			},
+
+		},
+
 	}
 </script>
 

+ 1 - 1
pages/me/setting/setting.vue

@@ -49,7 +49,7 @@
 				</template>
 			</view>
 		</u-card>
-		<u-button type="primary" @click="exit" :ripple="true" ripple-bg-color="#99d4ff" style="margin: 20rpx;">安全退出</u-button>
+		<u-button type="primary" @click="exit" style="margin: 20rpx;">安全退出</u-button>
 	</view>
 </template>
 

BIN
static/sailun/gps-icon.png


BIN
static/sailun/map-pin.png