lilei 2 vuotta sitten
vanhempi
commit
fe13633dbe

+ 40 - 0
api/user.js

@@ -0,0 +1,40 @@
+import request from './request';
+ 
+//  校验手机号是否注册
+export const validateUser = params => {
+  return request({
+    url: `org/apply/validateUser/${params.phone}`,
+    method: 'get'
+  }, true)
+}
+// 获取图片验证码
+export const getCaptcha = randomCode => {
+  return request({
+    url: `org/apply/getCaptcha/${randomCode}`,
+    method: 'get',
+    responseType: 'blob',
+  }, true)
+}
+// 发送短信验证码
+export const sendVerifyCode = params => {
+  return request({
+    url: 'org/apply/sendVerifyCode',
+    method: 'post',
+    data: params
+  }, true)
+}
+// 申请试用
+export const apply = params => {
+  return request({
+    url: 'org/apply/apply',
+    method: 'post',
+    data: params
+  }, true)
+}
+// 获取门店名称
+export const getStore = (token) => {
+  return request({
+    url: 'getStore',
+    method: 'get'
+  })
+}

+ 0 - 377
components/m-icon/m-icon.css

@@ -1,377 +0,0 @@
-@font-face {
-	font-family: uniicons;
-	font-weight: normal;
-	font-style: normal;
-	src: url('https://img-cdn-qiniu.dcloud.net.cn/fonts/uni.ttf?t=1536565627510') format('truetype');
-}
-
-.m-icon {
-	font-family: uniicons;
-	font-size: 48upx;
-	font-weight: normal;
-	font-style: normal;
-	line-height: 1;
-	display: inline-block;
-	text-decoration: none;
-	-webkit-font-smoothing: antialiased;
-}
-
-.m-icon.uni-active {
-	color: #007aff;
-}
-
-.m-icon-contact:before {
-	content: '\e100';
-}
-
-.m-icon-person:before {
-	content: '\e101';
-}
-
-.m-icon-personadd:before {
-	content: '\e102';
-}
-
-.m-icon-contact-filled:before {
-	content: '\e130';
-}
-
-.m-icon-person-filled:before {
-	content: '\e131';
-}
-
-.m-icon-personadd-filled:before {
-	content: '\e132';
-}
-
-.m-icon-phone:before {
-	content: '\e200';
-}
-
-.m-icon-email:before {
-	content: '\e201';
-}
-
-.m-icon-chatbubble:before {
-	content: '\e202';
-}
-
-.m-icon-chatboxes:before {
-	content: '\e203';
-}
-
-.m-icon-phone-filled:before {
-	content: '\e230';
-}
-
-.m-icon-email-filled:before {
-	content: '\e231';
-}
-
-.m-icon-chatbubble-filled:before {
-	content: '\e232';
-}
-
-.m-icon-chatboxes-filled:before {
-	content: '\e233';
-}
-
-.m-icon-weibo:before {
-	content: '\e260';
-}
-
-.m-icon-weixin:before {
-	content: '\e261';
-}
-
-.m-icon-pengyouquan:before {
-	content: '\e262';
-}
-
-.m-icon-chat:before {
-	content: '\e263';
-}
-
-.m-icon-qq:before {
-	content: '\e264';
-}
-
-.m-icon-videocam:before {
-	content: '\e300';
-}
-
-.m-icon-camera:before {
-	content: '\e301';
-}
-
-.m-icon-mic:before {
-	content: '\e302';
-}
-
-.m-icon-location:before {
-	content: '\e303';
-}
-
-.m-icon-mic-filled:before,
-.m-icon-speech:before {
-	content: '\e332';
-}
-
-.m-icon-location-filled:before {
-	content: '\e333';
-}
-
-.m-icon-micoff:before {
-	content: '\e360';
-}
-
-.m-icon-image:before {
-	content: '\e363';
-}
-
-.m-icon-map:before {
-	content: '\e364';
-}
-
-.m-icon-compose:before {
-	content: '\e400';
-}
-
-.m-icon-trash:before {
-	content: '\e401';
-}
-
-.m-icon-upload:before {
-	content: '\e402';
-}
-
-.m-icon-download:before {
-	content: '\e403';
-}
-
-.m-icon-close:before {
-	content: '\e404';
-}
-
-.m-icon-redo:before {
-	content: '\e405';
-}
-
-.m-icon-undo:before {
-	content: '\e406';
-}
-
-.m-icon-refresh:before {
-	content: '\e407';
-}
-
-.m-icon-star:before {
-	content: '\e408';
-}
-
-.m-icon-plus:before {
-	content: '\e409';
-}
-
-.m-icon-minus:before {
-	content: '\e410';
-}
-
-.m-icon-circle:before,
-.m-icon-checkbox:before {
-	content: '\e411';
-}
-
-.m-icon-close-filled:before,
-.m-icon-clear:before {
-	content: '\e434';
-}
-
-.m-icon-refresh-filled:before {
-	content: '\e437';
-}
-
-.m-icon-star-filled:before {
-	content: '\e438';
-}
-
-.m-icon-plus-filled:before {
-	content: '\e439';
-}
-
-.m-icon-minus-filled:before {
-	content: '\e440';
-}
-
-.m-icon-circle-filled:before {
-	content: '\e441';
-}
-
-.m-icon-checkbox-filled:before {
-	content: '\e442';
-}
-
-.m-icon-closeempty:before {
-	content: '\e460';
-}
-
-.m-icon-refreshempty:before {
-	content: '\e461';
-}
-
-.m-icon-reload:before {
-	content: '\e462';
-}
-
-.m-icon-starhalf:before {
-	content: '\e463';
-}
-
-.m-icon-spinner:before {
-	content: '\e464';
-}
-
-.m-icon-spinner-cycle:before {
-	content: '\e465';
-}
-
-.m-icon-search:before {
-	content: '\e466';
-}
-
-.m-icon-plusempty:before {
-	content: '\e468';
-}
-
-.m-icon-forward:before {
-	content: '\e470';
-}
-
-.m-icon-back:before,
-.m-icon-left-nav:before {
-	content: '\e471';
-}
-
-.m-icon-checkmarkempty:before {
-	content: '\e472';
-}
-
-.m-icon-home:before {
-	content: '\e500';
-}
-
-.m-icon-navigate:before {
-	content: '\e501';
-}
-
-.m-icon-gear:before {
-	content: '\e502';
-}
-
-.m-icon-paperplane:before {
-	content: '\e503';
-}
-
-.m-icon-info:before {
-	content: '\e504';
-}
-
-.m-icon-help:before {
-	content: '\e505';
-}
-
-.m-icon-locked:before {
-	content: '\e506';
-}
-
-.m-icon-more:before {
-	content: '\e507';
-}
-
-.m-icon-flag:before {
-	content: '\e508';
-}
-
-.m-icon-home-filled:before {
-	content: '\e530';
-}
-
-.m-icon-gear-filled:before {
-	content: '\e532';
-}
-
-.m-icon-info-filled:before {
-	content: '\e534';
-}
-
-.m-icon-help-filled:before {
-	content: '\e535';
-}
-
-.m-icon-more-filled:before {
-	content: '\e537';
-}
-
-.m-icon-settings:before {
-	content: '\e560';
-}
-
-.m-icon-list:before {
-	content: '\e562';
-}
-
-.m-icon-bars:before {
-	content: '\e563';
-}
-
-.m-icon-loop:before {
-	content: '\e565';
-}
-
-.m-icon-paperclip:before {
-	content: '\e567';
-}
-
-.m-icon-eye:before {
-	content: '\e568';
-}
-
-.m-icon-arrowup:before {
-	content: '\e580';
-}
-
-.m-icon-arrowdown:before {
-	content: '\e581';
-}
-
-.m-icon-arrowleft:before {
-	content: '\e582';
-}
-
-.m-icon-arrowright:before {
-	content: '\e583';
-}
-
-.m-icon-arrowthinup:before {
-	content: '\e584';
-}
-
-.m-icon-arrowthindown:before {
-	content: '\e585';
-}
-
-.m-icon-arrowthinleft:before {
-	content: '\e586';
-}
-
-.m-icon-arrowthinright:before {
-	content: '\e587';
-}
-
-.m-icon-pulldown:before {
-	content: '\e588';
-}
-
-.m-icon-scan:before {
-    content: "\e612";
-}

+ 0 - 41
components/m-icon/m-icon.vue

@@ -1,41 +0,0 @@
-<template>
-	<view class="m-icon" :class="['m-icon-'+type]" :style="{color:color,'font-size':fontSize}" @click="onClick()"></view>
-</template>
-
-<script>
-	export default {
-		props: {
-			/**
-			 * 图标类型
-			 */
-			type: String,
-			/**
-			 * 图标颜色
-			 */
-			color: String,
-			/**
-			 * 图标大小
-			 */
-			size: {
-				type: [Number, String],
-				default: 24
-			}
-		},
-		computed: {
-			fontSize() {
-				var size = Number(this.size)
-				size = isNaN(size) ? 24 : size
-				return `${size}px`
-			}
-		},
-		methods: {
-			onClick() {
-				this.$emit('click')
-			}
-		}
-	}
-</script>
-
-<style>
-	@import "./m-icon.css";
-</style>

+ 9 - 0
pages.json

@@ -251,6 +251,15 @@
             }
             
         }
+        ,{
+            "path" : "pages/storeManage/storeAuth",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "认证成为门店",
+                "enablePullDownRefresh": false
+            }
+            
+        }
     ],
 	"globalStyle": {
 		"navigationBarTextStyle": "black",

+ 26 - 14
pages/index/index.vue

@@ -26,19 +26,22 @@
 				<view class="userCard-info flex align_center justify_between">
 					<view>
 						<u-image v-if="!hasLogin" src="/static/def_personal_avatar.png" width="90" height="90"></u-image>
-						<open-data v-else type="userAvatarUrl" class="user-photo"></open-data>
+						<u-image v-else :src="avatarUrl||'/static/def_personal_avatar.png'" width="90" height="90"></u-image>
 					</view>
-					<view>
+					<view class="user-info">
 						<view v-if="!hasLogin" style="font-size: 40rpx;">
 							请点击登录
 						</view>
 						<view v-else>
-							<view>{{userInfo.userNameCN}}</view>
+							<view class="user-name">{{userInfo.userNameCN}}</view>
 							<view>{{userInfo.orgName}}</view>
 						</view>
 					</view>
 				</view>
 				<view>
+					<text class="user-rz">
+						认证成为门店
+					</text>
 					<u-icon name="arrow-right"></u-icon>
 				</view>
 			</view>
@@ -99,6 +102,7 @@
 				list:[],
 				vinList: [],
 				orderTodo: null,
+				avatarUrl:''
 			}
 		},
 		computed: {
@@ -144,6 +148,7 @@
 		methods: {
 			pageInit(){
 				if(this.hasLogin){
+					this.avatarUrl = this.userInfo.avatarUrl
 					// 查询是否有数字货架
 					this.getStoreShelf()
 					// 获取扫描记录
@@ -240,9 +245,16 @@
 				})
 			},
 			toUser(){
-				uni.navigateTo({
-					url: this.hasLogin ? '/pages/personData/personData' : '/pages/login/login'
-				})
+				if(this.hasLogin){
+					// 用户详细信息 或 门店认证
+					uni.navigateTo({
+						url: !this.hasLogin ? '/pages/personData/personData' : '/pages/storeManage/storeAuth'
+					})
+				}else{
+					uni.navigateTo({
+						url: '/pages/login/login'
+					})
+				}
 			},
 			toChoosePart(item){
 				if(this.hasShelf){
@@ -344,20 +356,20 @@
 				.userCard-info{
 					> view{
 						&:last-child{
-							margin-left: 1em;
-							line-height: 2em;
+							margin-left: 0.5em;
+							line-height: 1.5em;
+							.user-name{
+								font-size: 1rem;
+							}
 							>view{
 								padding: 0.2em;
 							}
 						}
 					}
 				}
-				.user-photo{
-					display: block;
-					width: 120rpx;
-					height: 120rpx;
-					border-radius: 50%;
-					overflow: hidden;
+				.user-rz{
+					font-size: 0.8rem;
+					color:#58aff5;
 				}
 			}
 		}

+ 20 - 7
pages/personData/personData.vue

@@ -1,13 +1,15 @@
 <template>
     <view class="content">
-       
 		<view class="list-container">
 			<view class="list-item margin-bot">
 				<view class="list-item-left">
 			 		<text>头像</text>
 				</view>
                 <view class="list-item-right">
-					<open-data class="user-photo" type="userAvatarUrl"></open-data>
+					<button class="avatar-wrapper" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
+					  <u-image class="avatar" width="100" height="100" :src="avatarUrl||'/static/def_personal_avatar.png'"></u-image>
+					</button> 
+					<view style="font-size: 0.8rem;text-align: center;"><text v-if="!avatarUrl">点击头像修改</text></view>
                 </view>
 			</view>
 			<view class="list-item border-bottom">
@@ -56,18 +58,18 @@
 	import uniPopup from '@/components/uni-popup/uni-popup.vue'
 	import uniPopupDialog from '@/components/uni-popup/uni-popup-dialog.vue'
     import service from '../../service.js';
-	import mIcon from '../../components/m-icon/m-icon.vue'
     import {
         mapState,
         mapMutations
     } from 'vuex'
     export default {
         components: {
-			mIcon,uniPopup,uniPopupDialog
+			uniPopup,uniPopupDialog
         },
         data() {
             return {
 				title:'',
+				avatarUrl:""
             }
         },
 		onShow() {
@@ -83,8 +85,11 @@
 				return this.$store.state.vuex_storeShelf
 			},
 		},
-		
         methods: {
+		  onChooseAvatar(e) {
+			const { avatarUrl } = e.detail 
+			this.avatarUrl = avatarUrl
+		  },
           loginOut(){
 			  this.$refs.openModal.open()
 		  },
@@ -110,6 +115,16 @@
 	.content{
 		padding: 0;
 		background: rgb(245,245,245);
+		.avatar-wrapper{
+			width:100rpx;
+			height:100rpx;
+			background: none;
+			padding: 0;
+			border-radius: 100%;
+			&::after{
+				border:1px solid #eee;
+			}
+		}
 	}
 	
 	.list-container{
@@ -144,8 +159,6 @@
 			.list-item-right{
 				font-size: 36rpx;
 				color: #666666;
-				display: flex;
-				align-items: center;
 				.back-img{
 					width: 18rpx;
 					height: 34rpx;

+ 3 - 3
pages/storeManage/addPerson.vue

@@ -76,16 +76,16 @@
 			//  初始化数据
 			init(){
 				let data = this.$store.state.vuex_nowStaffData
+				console.log(data)
 				// 编辑信息
-				if(data){
+				if(!!data){
 					this.isEdit = true
 					this.formData = Object.assign({},this.formData,data)
-					console.log(this.formData)
 				}else{
 					this.isEdit = false
 				}
 				uni.setNavigationBarTitle({
-					title:data ? "编辑员工" : '新增员工'
+					title: !!data ? "编辑员工" : '新增员工'
 				})
 			},
 			//  保存

+ 1 - 1
pages/storeManage/personnel.vue

@@ -30,7 +30,7 @@
 			</swiper-item>
 		</swiper>
 		<view class="footer">
-			<u-button @click="editPerson()" :throttle-time="100" :custom-style="{ background: '#066cff', color: '#fff',width:'400rpx' }" shape="circle" type="info">
+			<u-button @click="editPerson(null)" :throttle-time="100" :custom-style="{ background: '#066cff', color: '#fff',width:'400rpx' }" shape="circle" type="info">
 				新增员工
 			</u-button>
 		</view>

+ 190 - 0
pages/storeManage/storeAuth.vue

@@ -0,0 +1,190 @@
+<template>
+	<view class="apply-wrap flex flex_column">
+		<view class="login-form">
+			<u-form :model="form" label-width="180rpx" :error-type="['toast']" ref="uForm">
+				<u-form-item label="门头照片" required prop="storePhoto">
+					<u-upload 
+					@on-success="uploadStorePhoto" 
+					@on-remove="removeStorePhoto" 
+					:file-list="storePhotoList" 
+					:action="action" 
+					:max-size="2 * 1024 * 1024" 
+					:width="200"
+					:height="150"
+					upload-text="上传门头照片"
+					max-count="1"></u-upload>
+				</u-form-item>
+				<u-form-item label="营业执照">
+					<u-upload
+					@on-success="uploadYyzzPhoto" 
+					@on-remove="removeYyzzPhoto" 
+					:file-list="yyzzPhotoList" 
+					:action="action" 
+					:max-size="2 * 1024 * 1024" 
+					:width="200"
+					:height="150"
+					upload-text="上传营业执照"
+					max-count="1"></u-upload>
+				</u-form-item>
+				<u-form-item label="门店名称">
+					<u-input v-model="form.name" maxlength="30" placeholder="请输入门店名称(最多30个字符)"/>
+				</u-form-item>
+				<u-form-item label="所在地区">
+					<u-input v-model="form.label" placeholder="请选择省市区" :disabled="true" @click="openAddress"/>
+					<Address ref="applyAddress" @onConfirm="areaConfirm"></Address>
+				</u-form-item>
+				<u-form-item label="详细地址">
+					<u-input v-model="form.addrDetail" placeholder="请输入详细地址"/>
+				</u-form-item>
+				<u-form-item label="联系人姓名" prop="userName">
+					<u-input v-model="form.userName" placeholder="请输入联系人姓名"/>
+				</u-form-item>
+				<u-form-item label="联系人手机">
+					{{form.contactPhone}}
+				</u-form-item>
+				<u-form-item label="汽配商邀请码">
+					<u-input v-model="form.code" placeholder="如没有可不填"/>
+				</u-form-item>
+			</u-form>
+		</view>
+		<view class="form-btn-con flex justify_center">
+			<u-button class="form-btn" shape="circle" type="info" :custom-style="{ background: '#066cff', color: '#fff',width:'350rpx' }" @click="formSubmit">提交审核</u-button>
+		</view>
+	</view>
+</template>
+
+<script>
+	import Address from '@/components/address.vue'
+	import uniPopup from '@/components/uni-popup/uni-popup.vue'
+	import popupCon from '@/components/uni-popup/popup-con.vue'
+	import { sendVerifyCode, apply, validateUser } from '@/api/user.js'
+	const baseUrl = getApp().globalData.baseUrl
+	export default{
+		components: {
+			Address,
+			uniPopup,
+			popupCon
+		},
+		data(){
+			return{
+				theme: '',
+				form: {
+					name: '',
+					addrProvince: '',
+					addrCity: '',
+					addrDistrict: '',
+					addrDetail: '',
+					contactPhone: '',
+					label: ''
+				},
+				rules: {
+					name: [
+						{ 
+							required: true, 
+							message: '请输入门店名称', 
+							// 可以单个或者同时写两个触发验证方式 
+							trigger: ['change','blur'],
+						}
+					],
+				},
+				areaIdArr: [],  //  省市区id数组
+				action: baseUrl + '/upload',
+				storePhotoList: [],
+				itemIconArr: [], // 门店图片
+				yyzzPhotoList: [],
+				yyzzIconArr: [], // 营业执照图片
+			}
+		},
+		// 必须要在onReady生命周期,因为onLoad生命周期组件可能尚未创建完毕
+		onReady() {
+			this.$refs.uForm.setRules(this.rules);
+		},
+		onLoad() {
+			this.form.contactPhone = this.$store.state.vuex_userInfo.mobile
+		},
+		methods: {
+			// 上传门店图片成功
+			uploadStorePhoto(res){
+				this.itemIconArr.push(res.data)
+			},
+			// 删除门店图片
+			removeStorePhoto(index){
+				this.itemIconArr.splice(index,1)
+			},
+			// 上传营业执照图片成功
+			uploadYyzzPhoto(res){
+				this.yyzzIconArr.push(res.data)
+			},
+			// 删除营业执照图片
+			removeYyzzPhoto(index){
+				this.yyzzIconArr.splice(index,1)
+			},
+			//  表单提交
+			formSubmit(){
+				this.$refs.uForm.validate(valid => {
+					if (valid) {
+						console.log('验证通过');
+						this.submitData()
+					} else {
+						console.log('验证失败');
+					}
+				});
+			},
+			submitData(){
+				let obj = this.form
+				obj.addrProvince = this.areaIdArr[0]  //  省id
+				obj.addrCity = this.areaIdArr[1]  //  市id
+				obj.addrDistrict = this.areaIdArr[2]  //  区id
+				//  申请试用
+				apply(obj).then(res => {
+					console.log(res)
+					if(res.status == 200){
+						 
+					}else{
+						uni.showToast({icon: 'none',title: res.message})
+					}
+				})
+			},
+			//  获取验证码
+			getCodeValidate(){
+				if(this.form.contactPhone){
+					//  校验手机号是否注册过
+					validateUser({phone: this.form.contactPhone}).then(res => {
+						if(res.status == 200){
+							//  图文验证码
+							this.$refs.imageTxtPopup.open()
+						}else{
+							uni.showToast({icon: 'none',title: res.message})
+						}
+					})
+				}else{
+					uni.showToast({icon: 'none',title: '请先输入手机号'})
+				}
+			},
+			//  选择省区市
+			areaConfirm(e) {
+				console.log('已选择的省市区', e)
+				this.areaIdArr = [ e.provinceCode, e.cityCode, e.areaCode ]
+				this.form.label = e.label
+			},
+			openAddress(){
+				//  省市区  回显     参数为省市区id数组
+				this.$refs.applyAddress.open(this.areaIdArr)
+			},
+		}
+	}
+</script>
+<style scoped lang="scss">
+	.apply-wrap{
+		height: 100vh;
+		background-color: #fff;
+		.login-form{
+			padding: 0.7rem 1.5rem;
+			flex-grow: 1;
+			overflow: auto;
+		}
+		.form-btn-con{
+			padding: 1rem;
+		}
+	}
+</style>

+ 0 - 22
pages/user/user.vue

@@ -1,22 +0,0 @@
-<template>
-	<view class="user">
-		会员
-	</view>
-</template>
-
-<script>
-export default {
-	data() {
-		return {
-		};
-	},
-	components: {
-	},
-	onLoad() {},
-	methods: {
-	}
-};
-</script>
-
-<style>
-</style>