瀏覽代碼

用户体系优化V1.0.0

zhengjinyi 5 年之前
父節點
當前提交
0e15396f8f

+ 4 - 2
App.vue

@@ -29,13 +29,15 @@
 						this.userID = response.data.userID;						
 						let user_key = {code:response.code,openid:response.data.openid,userID:response.data.userID}
 						this.$store.commit('updateStatus',user_key)
-						uni.setStorageSync('cookieKey','JSESSIONID='+response.data.sessionId)
+						uni.removeStorageSync('sessionid')
+						uni.setStorageSync('sessionid','JSESSIONID='+response.data.sessionId)
 						this.getHomeInformation()
 					}).catch(response =>{
 						this.isLogin = false;
 						this.userID ='';
 						let user_key = {code:response.code,userID:this.userID,openid:''}
-						uni.setStorageSync('cookieKey','JSESSIONID='+response.data)
+						uni.removeStorageSync('sessionid')
+						uni.setStorageSync('sessionid','JSESSIONID='+response.data)
 						this.$store.commit('updateStatus',user_key)
 						this.getHomeInformation()
 					})

+ 54 - 0
api/other.js

@@ -0,0 +1,54 @@
+/**
+ *@des 其他模块接口
+ *@author zhengjinyi
+ *@date 2020/03/19 14:56:57
+ *@param registerByPass
+ */
+import request from '@/common/config/caimeiApi.js'
+
+/**
+ *医美机构正品联盟
+ * @param
+ */
+export function queryMember(params) {
+	return new Promise(function(resolve,reject) {
+		request.get('/home/member',params, res => {
+			if(res.code == '0'){
+				resolve(res)
+			}else{
+				reject(res)
+			}
+		})
+	})
+}
+/**
+ *售后无忧,购物须知
+ * @param
+ */
+export function queryAfterSale(params) {
+	return new Promise(function(resolve,reject) {
+		request.get('/home/afterSale',params, res => {
+			if(res.code == '0'){
+				resolve(res)
+			}else{
+				reject(res)
+			}
+		})
+	})
+}
+/**
+ *取消订单
+ * @param
+ */
+export function cancelOrder(params) {
+	return new Promise(function(resolve,reject) {
+		request.get('/club/authorization',params, res => {
+			if(res.code == '0'){
+				resolve(res)
+			}else{
+				reject(res)
+			}
+		})
+	})
+}
+

+ 118 - 12
api/use.js

@@ -167,15 +167,22 @@ export function organizationUpdate(params) {
 }	
 /**
  *机构登录
+ * @param mobileOrEmail 邮箱或手机
+ * @param password	密码
+ * @param source 来源 PC与小程序传:'www'crm就传'crm'
  */
 export function organizationLogin(params) {
 	return new Promise(function(resolve,reject) {
-		request.post('/club/authorization',params, res => {
-			if(res.code == '0'){
-				resolve(res)
-			}else{
-				reject(res)
-			}
+		if( params.mobileOrEmail == ''){
+			uni.showToast({title: '请输入账户名',duration: 2000,mask:true, icon:'none'})
+			return
+		}
+		if( params.password == ''){
+			uni.showToast({title: '请输入密码',duration: 2000,mask:true,icon:'none'})
+			return
+		}
+		request.post('/user/login',params, res => {
+			resolve(res)
 		})
 	})
 }		
@@ -184,7 +191,23 @@ export function organizationLogin(params) {
  */
 export function bindingEmail(params) {
 	return new Promise(function(resolve,reject) {
-		request.post('/club/authorization',params, res => {
+		if( params.email == ''){
+			uni.showToast({title: '请输入邮箱地址',duration: 2000,mask:true, icon:'none'})
+			return
+		}
+		if(!$reg.isEmail(params.email)){
+			uni.showToast({title: '请输入正确的邮箱地址',duration: 2000,mask:true,icon:'none'})
+			return
+		}
+		if( params.code == ''){
+			uni.showToast({title: '请输入邮箱验证码',duration: 2000,mask:true,icon:'none'})
+			return
+		}
+		if(!$reg.isEmailCode(params.code)){
+			uni.showToast({title: '验证码格式不正确',duration: 2000,mask:true,icon:'none'})
+			return
+		}
+		request.post('/user/binding',params, res => {
 			if(res.code == '0'){
 				resolve(res)
 			}else{
@@ -198,7 +221,27 @@ export function bindingEmail(params) {
  */
 export function bindingWechat(params) {
 	return new Promise(function(resolve,reject) {
-		request.post('/club/authorization',params, res => {
+		if( params.linkName == ''){
+			uni.showToast({title: '请输入姓名',duration: 2000,mask:true, icon:'none'})
+			return
+		}
+		if( params.mobile == ''){
+			uni.showToast({title: '请输入手机号',duration: 2000,mask:true,icon:'none'})
+			return
+		}
+		if(!$reg.isMobile(params.mobile)){
+			uni.showToast({title: '验证码格式不正确',duration: 2000,mask:true,icon:'none'})
+			return
+		}
+		if( params.verificationCode == ''){
+			uni.showToast({title: '请输入手机验证码',duration: 2000,mask:true,icon:'none'})
+			return
+		}
+		if(!$reg.isMobileCode(params.verificationCode)){
+			uni.showToast({title: '验证码格式不正确',duration: 2000,mask:true,icon:'none'})
+			return
+		}
+		request.post('/club/bindingWx',params, res => {
 			if(res.code == '0'){
 				resolve(res)
 			}else{
@@ -255,7 +298,7 @@ export function accountInfo(params) {
  */
 export function queryHomeInfo(params) {
 	return new Promise(function(resolve,reject) {
-		request.post('/club/authorization',params, res => {
+		request.get('/home/modules',{params}, res => {
 			if(res.code == '0'){
 				resolve(res)
 			}else{
@@ -283,9 +326,40 @@ export function userInfoLogin(params) {
  *手机修改密码
  */
 export function mobilePassword(params) {
-	
 	return new Promise(function(resolve,reject) {
-		request.post('/club/authorization',params, res => {
+		if( params.mobileOrEmail == ''){
+			uni.showToast({title: '请输入手机号',duration: 2000,mask:true,icon:'none'})
+			return
+		}
+		if(!$reg.isMobile(params.mobileOrEmail)){
+			uni.showToast({title: '手机格式不正确',duration: 2000,mask:true,icon:'none'})
+			return
+		}
+		if( params.activateCode == ''){
+			uni.showToast({title: '请输入手机验证码',duration: 2000,mask:true,icon:'none'})
+			return
+		}
+		if(!$reg.isMobileCode(params.activateCode)){
+			uni.showToast({title: '验证码格式不正确',duration: 2000,mask:true,icon:'none'})
+			return
+		}
+		if( params.passWord == ''){
+			uni.showToast({title: '请输入密码',duration: 2000,mask:true,icon:'none'})
+			return
+		}
+		if(!$reg.checkPwd(params.passWord)){
+			uni.showToast({title: '密码必须为8-16位字母数字的组合',duration: 2000,mask:true,icon:'none'})
+			return
+		}
+		if( params.confirmPwd == ''){
+			uni.showToast({title: '请再次确认密码',duration: 2000,mask:true,icon:'none'})
+			return
+		}
+		if( params.confirmPwd !== params.passWord){
+			uni.showToast({title: '两次输入的密码不一致',duration: 2000,mask:true,icon:'none'})
+			return
+		}
+		request.post('/user/findCompanyPwd',params, res => {
 			if(res.code == '0'){
 				resolve(res)
 			}else{
@@ -299,7 +373,39 @@ export function mobilePassword(params) {
  */
 export function emailPassword(params) {
 	return new Promise(function(resolve,reject) {
-		request.post('/club/authorization',params, res => {
+		if( params.mobileOrEmail == ''){
+			uni.showToast({title: '请输入邮箱',duration: 2000,mask:true,icon:'none'})
+			return
+		}
+		if(!$reg.isEmail(params.mobileOrEmail)){
+			uni.showToast({title: '请输入正确的邮箱地址',duration: 2000,mask:true,icon:'none'})
+			return
+		}
+		if( params.activateCode == ''){
+			uni.showToast({title: '请输入手机验证码',duration: 2000,mask:true,icon:'none'})
+			return
+		}
+		if(!$reg.isEmailCode(params.activateCode)){
+			uni.showToast({title: '验证码格式不正确',duration: 2000,mask:true,icon:'none'})
+			return
+		}
+		if( params.passWord == ''){
+			uni.showToast({title: '请输入密码',duration: 2000,mask:true,icon:'none'})
+			return
+		}
+		if(!$reg.checkPwd(params.passWord)){
+			uni.showToast({title: '密码必须为8-16位字母数字的组合',duration: 2000,mask:true,icon:'none'})
+			return
+		}
+		if( params.confirmPwd == ''){
+			uni.showToast({title: '请再次确认密码',duration: 2000,mask:true,icon:'none'})
+			return
+		}
+		if( params.confirmPwd !== params.passWord){
+			uni.showToast({title: '两次输入的密码不一致',duration: 2000,mask:true,icon:'none'})
+			return
+		}
+		request.post('/user/findCompanyPwd',params, res => {
 			if(res.code == '0'){
 				resolve(res)
 			}else{

+ 26 - 0
api/utils.js

@@ -97,6 +97,32 @@ export function getMobileCode(params) {
 		})
 	});
 }
+/**
+ *小程序机构账号绑定微信,PC微信绑定机构账号
+ */
+export function getbindWechatCode(params) {
+	return new Promise(function(resolve,reject) {
+		if( params.mobile == ''){
+			uni.showToast({title: '请输入手机号',duration: 2000,mask:true, icon:'none'})
+			return
+		}
+		if(!$reg.isMobile(params.mobile)){
+			uni.showToast({title: '请输入正确的手机号',duration: 2000,mask:true,icon:'none'})
+			return
+		}
+		if( params.imgCode == ''){
+			uni.showToast({title: '请输入图形验证码',duration: 2000,mask:true,icon:'none'})
+			return
+		}
+		request.get("/user/note",params, res => {
+			if(res.code == '0'){
+				resolve(res);
+			}else{
+				reject(res)
+			}
+		})
+	});
+}
 /**
  *上传图片
  */

+ 3 - 3
common/config/caimeiApi.js

@@ -18,7 +18,7 @@ const caimeiApi = {
 				'Accept': 'application/json',
 				'Content-Type': 'application/x-www-form-urlencoded', 
 				'X-Token': uni.getStorageSync('token'),
-				'Cookie': uni.getStorageSync('cookieKey')
+				'cookie': uni.getStorageSync('sessionid')
 			},
 			method: 'GET',
 			success: (response) => {
@@ -49,7 +49,7 @@ const caimeiApi = {
 				'Accept': 'application/json',
 				'Content-Type': 'application/x-www-form-urlencoded', 
 				'X-Token':uni.getStorageSync('token'),
-				'Cookie': uni.getStorageSync('cookieKey')
+				'cookie': uni.getStorageSync('sessionid')
 			},
 			method: 'GET',
 			success: (response) => {
@@ -85,7 +85,7 @@ const caimeiApi = {
 				'Accept': 'application/json',
 				'Content-Type': 'application/x-www-form-urlencoded',
 				'X-Token':uni.getStorageSync('token'),
-				'Cookie': uni.getStorageSync('cookieKey')
+				'cookie': uni.getStorageSync('sessionid')
 			},
 			method: 'POST',
 			success: (response) => {

+ 3 - 3
common/config/config.js

@@ -1,11 +1,11 @@
 let URL_CONFIG = ""
 if(process.env.NODE_ENV === 'development'){
     // 开发环境
-	// URL_CONFIG = 'http://192.168.1.22:8008'//本地联调地址
+	URL_CONFIG = 'http://192.168.1.22:8008'//本地联调地址
 	// URL_CONFIG = 'http://192.168.1.24:8107'//俊俊联调地址
-    URL_CONFIG = 'https://spi-b.caimei365.com'//测试地址
+    // URL_CONFIG = 'https://spi-b.caimei365.com'//测试地址
 }else{
     // 生产环境
-    URL_CONFIG = 'https://mall.caimei365.com'
+    URL_CONFIG = 'https://spi.caimei365.com'
 }
 export default URL_CONFIG

+ 30 - 44
components/module/listTemplate/memberList.vue

@@ -35,17 +35,14 @@
 
 <script>
 	import listSkeleton from '@/components/module/listTemplate/listSkeleton'
-	
+	import { queryMember } from "@/api/other.js"
 	export default {
 		name:'MemberList',
 		components:{
 			listSkeleton
 		},
 		props:{
-			serverUrl:{
-				type:String,
-				default:""
-			}
+			
 		},
 	    data(){
 	        return {
@@ -103,48 +100,37 @@
 				if(loadMore) {
 					self.pageNum += 1;
 				}
-				this.$api.get(this.serverUrl,{index:this.pageNum,pageSize:this.pageSize},
-					response => {
-						const code = response.code;
-						const resData = response.data;
-						if(code == 1) { 
-							const resList = resData.results;
-							if(resList && resList.length > 0){
-								self.hasNextPage = resData.hasNextPage;
-								self.totalPage = resData.totalPage;
-								if(loadMore) {
-									self.membersList = [...self.membersList,...resList];
-								} else {
-									self.membersList = [...resList];
-									self.setScrollHeight(self.membersList.length);
-									self.showSkeleton = false;
-								}
-								// 防上拉暴滑
-								self.pullFlag = false;
-								setTimeout(()=>{
-									self.pullFlag = true;
-								},500)
-								// 底部提示文案
-								if(self.hasNextPage) {
-									self.loadingText = '上拉加载更多';
-								} else {
-									self.showLoading = true;
-									self.loadingNow = false;
-								}
-							} else {
-								self.showEmptyTips = true;
-							}
+				queryMember({index:this.pageNum,pageSize:this.pageSize}).then(response =>{
+					const resData = response.data;
+					const resList = resData.results;
+					if(resList && resList.length > 0){
+						self.hasNextPage = resData.hasNextPage;
+						self.totalPage = resData.totalPage;
+						if(loadMore) {
+							self.membersList = [...self.membersList,...resList];
+						} else {
+							self.membersList = [...resList];
+							self.setScrollHeight(self.membersList.length);
+							self.showSkeleton = false;
+						}
+						// 防上拉暴滑
+						self.pullFlag = false;
+						setTimeout(()=>{
+							self.pullFlag = true;
+						},500)
+						// 底部提示文案
+						if(self.hasNextPage) {
+							self.loadingText = '上拉加载更多';
 						} else {
-							uni.showToast({
-								icon: 'none',
-								title: '网络错误,请稍后重试。',
-								duration: 3000
-							})
+							self.showLoading = true;
+							self.loadingNow = false;
 						}
+					} else {
+						self.showEmptyTips = true;
 					}
-				)
-				
-				
+				}).catch(response =>{
+					this.$util.msg(res.msg,2000);
+				})
 			}
 	    }
 	}

+ 1 - 1
components/mpvue-citypicker/mpvueCityPicker.vue

@@ -42,7 +42,7 @@
 		created() {
 			// console.log('provinceData',provinceData)
 			// console.log('cityData',cityData)
-			console.log('areaData',areaData)
+			// console.log('areaData',areaData)
 			// this.init()
 		},
 		props: {

+ 3 - 1
main.js

@@ -20,10 +20,12 @@ const msg = (title, duration=1500, mask=true, icon='none')=>{
 		icon
 	});
 }
-const modal = (title,content,showCancel=false,callBack) =>{
+const modal = (title,content,confirmText,showCancel=false,callBack) =>{
 	uni.showModal({
 		title,
 		content,
+		confirmText,
+		confirmColor:'#E15616',
 		showCancel,
 		success: function (res) {
 			if (res.confirm) {

+ 5 - 5
pages.json

@@ -1,11 +1,6 @@
 {
 	"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
 		{
-			"path": "pages/user-module/password",
-			"style": {
-				"navigationBarTitleText": "修改密码"
-			}
-		},{
 			"path": "pages/tabBar/home/home",
 			"style": {
 				"navigationBarTitleText": "采美采购商城",
@@ -196,6 +191,11 @@
 			"style": {
 				"navigationBarTitleText": "修改资料"
 			}
+		},{
+			"path": "pages/user-module/password",
+			"style": {
+				"navigationBarTitleText": "修改密码"
+			}
 		},{
 			"path": "pages/user/operator/list",
 			"style": {

+ 9 - 12
pages/service/aftersale.vue

@@ -6,7 +6,7 @@
 
 <script>
 	import richTextTemplate from '@/components/module/listTemplate/richTextTemplate'
-	
+	import { queryAfterSale } from "@/api/other.js"
 	export default{
 		components: {
 		   richTextTemplate
@@ -18,24 +18,21 @@
 			}
 		},
 		onLoad(){
-			this.serverUrl = '/home/afterSale';
 			this.type = 'afterSale';
 			this.initData();
 		},
 		methods:{
 			initData(){
 				let self = this;
-				self.$api.get(self.serverUrl,{organizeID:self.userOrganizeID}, response => {
-					if (response.code == "1") {
-						let _data =response.data,
-							type = self.type;
-						if(type) {
-							let html = self.$api.adaptRichTextImg(_data[type]);
-							self.$refs.childTemplate.html = html;
-						}
-					} else {
-						uni.showToast({icon:'none', title: response.msg, duration: 2000});
+				queryAfterSale().then(response =>{
+					let _data =response.data,
+						type = self.type;
+					if(type) {
+						let html = self.$api.adaptRichTextImg(_data[type]);
+						self.$refs.childTemplate.html = html;
 					}
+				}).catch(response =>{
+					this.$util.msg(res.msg,2000);
 				})
 			}
 		}

+ 2 - 2
pages/service/member.vue

@@ -1,6 +1,6 @@
 <template>
 	<view class="container">
-		<member-list ref="childList" :server-url="serverUrl"></member-list>
+		<member-list ref="childList"></member-list>
 	</view>
 </template>
 
@@ -13,7 +13,7 @@
 		},
 	    data(){
 	        return {
-				serverUrl: '/home/member'
+				
 	        }
 	    },
 		onLoad() {

+ 42 - 34
pages/tabBar/home/home.vue

@@ -22,22 +22,15 @@
 				<!-- </uni-swiper-dot> -->
 			</view>
 			<view class="cate-section clearfix">
-				<!-- 自定义分类导航栏 -->
-<!-- 				<view class="tabbar clearfix">
-					<view class="cate-item" v-for="(nav,idx) in productsClassify" :key="idx" @click.stop="navToListPage(nav)">
-						<image class="tui-skeleton-fillet" :src="nav.classifyImage"></image>
-						<text class="tui-skeleton-rect">{{nav.classifyName}}</text>
-					</view>
-				</view> -->
 				<!-- 优选分类 -->
 				<view class="tabbar clearfix">
-					<view class="cate-item-info" @click.stop="this.$api.navToListPage({type:'1',value:mallPageModules.firstModulesName})">
-						<image class="tui-skeleton-fillet" :src="mallPageModules.firstModulesImage"></image>
-						<text class="tui-skeleton-fillet">{{mallPageModules.firstModulesName}}</text>
+					<view class="cate-item-info" @click.stop="this.$api.navToListPage({type:'1',value:firstModulesName})">
+						<image class="tui-skeleton-fillet" :src="firstModulesImage"></image>
+						<text class="tui-skeleton-fillet">{{firstModulesName}}</text>
 					</view>
-					<view class="cate-item-info" @click.stop="this.$api.navToListPage({type:'2',value:mallPageModules.secondModulesName})">
-						<image class="tui-skeleton-fillet" :src="mallPageModules.secondModulesImage"></image>
-						<text class="tui-skeleton-fillet">{{mallPageModules.secondModulesName}}</text>
+					<view class="cate-item-info" @click.stop="this.$api.navToListPage({type:'2',value:secondModulesName})">
+						<image class="tui-skeleton-fillet" :src="secondModulesImage"></image>
+						<text class="tui-skeleton-fillet">{{secondModulesName}}</text>
 					</view>
 					<view class="cate-item-info" @click="showTost">
 						<image class="tui-skeleton-fillet" :src="navInforList[0].icon"></image>
@@ -55,8 +48,8 @@
 			</view>
 			<!-- 热销商品 -->
 			<view class="hotgoods-section">
-				<view class="s-header" @click="this.$api.navToListPage({type:'3',value:mallPageModules.thirdModulesName})">
-					<text class="tip tui-skeleton-fillet">{{mallPageModules.thirdModulesName}}</text>
+				<view class="s-header" @click="this.$api.navToListPage({type:'3',value:thirdModulesName})">
+					<text class="tip tui-skeleton-fillet">{{thirdModulesName}}</text>
 					<text class="tit tui-skeleton-fillet">更多</text>
 					<text class="iconfont icon-xiayibu"></text>
 				</view>
@@ -77,7 +70,7 @@
 									<text class="p big">{{item.retailPrice.toFixed(2)}}</text>
 								</view>
 								<view v-else class="no-price">							
-									<text vi-else class="p-no tui-skeleton-rect" @click.stop="navto('/pages/user-module/login?type=3')">登录查看价格<text class="iconfont icon-xiayibu" style="font-size: 22rpx;margin: 0 6rpx;"></text></text>
+									<text vi-else class="p-no tui-skeleton-rect" @click.stop="navto('/pages/user-module/login-accont?type=3')">登录查看价格<text class="iconfont icon-xiayibu" style="font-size: 22rpx;margin: 0 6rpx;"></text></text>
 								</view>		
 							</view>
 						</view>
@@ -131,7 +124,8 @@
 	import authorize from '@/common/config/authorize.js'
 	import modalLayer from "@/components/modal-layer"
 	import btSearch from '@/components/uni-search/bt-search.vue'
-	import { userInfoLogin } from "@/api/use.js"
+	import { userInfoLogin, queryHomeInfo } from "@/api/use.js"
+	import { queryPreferred } from "@/api/product.js"
 	import { mapMutations} from 'vuex';
 	export default {
 		components:{
@@ -153,7 +147,11 @@
 				hotGoodsList:[],
 				skeletonShow: true,
 				organizeProducts:[],//常用商品
-				mallPageModules:'', //优惠模块分类
+				firstModulesName:'', //优惠模块1
+				secondModulesName:'', //优惠模块2
+				firstModulesImage:'',//优惠模块icon1
+				secondModulesImage:'',//优惠模块icon2
+				thirdModulesName:'', //优惠模块3
 				navInforList:[
 					{text:'会员中心',icon:'https://img.caimei365.com/group1/M00/03/8C/Cmis215XHXSAAZU0AACaPrfbB8I435.png'},
 					{text:'在线客服',icon:'https://img.caimei365.com/group1/M00/03/8D/Cmis215XHXWABv0rAACt9b8scec656.png'}
@@ -184,30 +182,40 @@
 						this.userID = response.data.userID;						
 						let user_key = {code:response.code,openid:response.data.openid,userID:response.data.userID}
 						this.$store.commit('updateStatus',user_key)
-						uni.setStorageSync('cookieKey','JSESSIONID='+response.data.sessionId)
-						// this.getHomeInformation()
+						uni.removeStorageSync('sessionid')
+						uni.setStorageSync('sessionid','JSESSIONID='+response.data.sessionId)
+						this.getHomeInformation()
+						this.getOrganizeProducts()
 					}).catch(response =>{
 						this.isLogin = false;
 						this.userID ='';
+						uni.removeStorageSync('sessionid')
+						uni.setStorageSync('sessionid','JSESSIONID='+response.data)
 						let user_key = {code:response.code,userID:this.userID,openid:''}
 						this.$store.commit('updateStatus',user_key)
-						// this.getHomeInformation()
+						this.getHomeInformation()
+						this.getOrganizeProducts()
 					})
 				})
 			},		
-			getHomeInformation(){				
-				this.$api.get('/home/information',{userID:this.userID,organizeID:this.userOrganizeID}, 
-					response => {
-						if(response.code =='1'){
-							let data = response.data;
-							this.organizeProducts = data.organizeProducts
-							this.bannerImageList = data.bannerImageList
-							this.mallPageModules = data.mallPageModules
-							this.$store.commit('updateAllNum',response.data.count)
-						}
-						this.skeletonShow = false
-					}
-				)
+			getHomeInformation(){		
+				queryHomeInfo({}).then(res =>{
+					let data = res.data;
+					this.bannerImageList = data.bannerImageList
+					this.mallPageModules = data.mallPageModules
+					this.$store.commit('updateAllNum',data.shoppingCartCount)
+					this.firstModulesName= data.firstModulesName
+					this.secondModulesName= data.secondModulesName
+					this.firstModulesImage= data.firstModulesImage
+					this.secondModulesImage= data.secondModulesImage
+					this.thirdModulesName= data.thirdModulesName
+					this.skeletonShow = false;
+				})
+			},
+			getOrganizeProducts(){//获取模块三商品
+				queryPreferred({preferredFlag:100,pageNum:1,pageSize:5}).then(res =>{
+					this.organizeProducts = res.data.results
+				})
 			},
 			//轮播图切换修改背景色
 			swiperChange(e) {

+ 111 - 138
pages/user-module/bindemail.vue

@@ -5,11 +5,10 @@
 		</view>
 		<view class="login-form clearfix">
 			<view class="login-input">
-				<input type="number" 
+				<input type="text" 
 					   v-model="bindEmail"  
 					   maxlength="30" 
 					   class="input" 
-					   @blur="onBlurInput"
 					   placeholder="请输入邮箱地址"
 				/>
 			</view>
@@ -18,43 +17,18 @@
 			<view class="login-input code">
 				<input type="number" 
 					   v-model="bindEmailCode"  
-					   maxlength="6" 
+					   maxlength="4" 
 					   class="input" 
 					   placeholder="请输入邮箱验证码"
 				/>
 			</view>
-			<view class="login-input btn" :class="[isDisabled === true ? 'disabled' : 'none']">
-				<button type="button"
-						@click.stop="getEmailCode" :disabled="isDisabled"
-					    class="input" 
-				>获取验证码</button>
-			</view>
-		</view>
-		<view class="login-form clearfix">
-			<view class="login-btn"  @click="goLogin">绑定</view>
-		</view>
-		<view v-if="isToast" class="model-warp" >
-			<view class="model-alert clearfix">
-				<view class="alert-content">
-					<view class="t-h1">{{toestText}}</view>
-					<view class="t-p">请联系客服获取{{alertText}}后再登录,联系电话{{telPhone}}</view>
-				</view>
-				<view class="alert-btn">
-					<view class="btn btn-confirm" @click="hideToast">确定</view>
-				</view>
+			<view class="login-input btn" :class="[isEmialDisabled  ? 'disabled' : '']" @click.stop="getEmailCodeFn">
+				<button type="button" :disabled="isEmialDisabled" class="input" >{{ emailCodeText }}</button>
 			</view>
 		</view>
-		<!-- 授权按钮 -->
-		<view class="model-warp" :class="[isUserInfo===false ? 'none':'show']">
-			<view class="model-alert">
-				<view class="alert-content">
-					<view class="t-p">采美采购商城需要获取您的微信授权才能正常提供服务</view>
-				</view>
-				<view class="alert-btn">
-					<view class="btn btn-cancel" @click="hideModel">取消</view>
-					<button type="primary" size="small" open-type="getUserInfo" lang="zh_CN" @getuserinfo="getuserinfo" class="btn btn-confirm">授权</button>
-				</view>
-			</view>
+		<view class="login-form btns clearfix">
+			<view class="login-btn none"  @click="bindEmailNone">暂不绑定</view>
+			<view class="login-btn"  @click="bindEmailFrist">绑定</view>
 		</view>
 	</view>
 </template>
@@ -62,20 +36,21 @@
 <script>
 	import { mapMutations } from 'vuex';
 	import authorize from '@/common/config/authorize.js' 
-	var self;
+	import { bindingEmail } from '@/api/use.js' 
+	import { getEmailCode } from "@/api/utils.js"
+	
 	export default{
 		data() {
 			return{
+				userID:'',			//用户ID
 				bindEmail:'',  		//用户绑定邮箱
 				bindEmailCode:'',  	//用户绑定邮箱验证码
-				isDisabled:true,	//获取验证码按钮
-				isToast:false,		//控制显示未输入邀请码提示	
-				isUserInfo:false,	//控制显示授权弹窗
-				nickName:'',		//存储用户名
-				userInfo:'',		//存储微信用户授权信息
-				isSuccess:false,
-				toestText:'',
-				telPhone:'',
+				isEmialDisabled:false,	//获取验证码按钮
+				count: '',				//倒计时
+				emailCodeText: '获取验证码',
+				codeTime: null,
+				codeType:'',		//用户状态 为4状态的跳绑定微信
+				option:'',			//储存上一级页面的option
 				loginType:'',		//跳转类型
 				alertText:'',
 				listType: '',
@@ -86,61 +61,85 @@
 		},
 		onLoad(option) {
 			console.log(option)
+			this.codeType = option.codeType
+			this.option = option
+			this.loginType = option.type;
+			this.id = option.id
+			if(option.listType) {
+				this.listType = option.listType;
+				this.listVal = option.listVal;
+			}
 		},
 		methods:{
 			...mapMutations(['login']),
-			goLogin() {
-				self.$api.get('/login/isEnabled',{userOrganizeID:self.userOrganizeID,invitationCode:self.invitationCode}, res => {
-					if (res.code == "1") {
-						//查看此微信用户是否已经授权过
-						authorize.getSetting().then(res =>{
-							// console.log('是否已授权',res);//0:为取消授权 1:为已授权 2:为未操作
-							if(res == 2){
-								self.isUserInfo = true
-							}else{
-								self.isUserInfo = false
-								self.wxGetUserInfo()
-							}
-						})
-					}else if(res.code =='0'){
-						self.toestText ='请输入邀请码';
-						self.alertText ='邀请码';
-						self.telPhone = res.msg;
-						self.isToast = true;
-					}else if(res.code =='-2'){
-						self.toestText ='邀请码已失效';
-						self.alertText ='新邀请码';
-						self.telPhone = res.msg;
-						self.isToast = true;
-					}else if(res.code =='-3'){
-						self.toestText ='邀请码已被使用';
-						self.alertText ='新邀请码';
-						self.telPhone = res.msg;
-						self.isToast = true;
+			bindEmailFrist(){
+				 let params = {
+						userID:this.userID,
+						email:this.bindEmail,
+						code:this.bindEmailCode
+				}
+				bindingEmail(params).then(res =>{
+					this.$util.msg(res.msg,2000)
+					if(this.codeType == '4'){
+						this.$api.navigateTo(`/pages/user-module/bindwechat?data=${this.option}`)
 					}else{
-						uni.showToast({icon:'none', title: res.msg, duration: 3000});
-						self.isUserInfo = false
+						this.goUserLogininit()
 					}
 				})
 			},
-			onBlurInput(e){//邮箱输入框失去焦点设置按钮
-				if(e.detail.value ===''){
-					this.isDisabled = true
-				}else{
-					this.isDisabled = false
-				}
+			bindEmailNone(){
+				this.$api.switchTabTo('/pages/tabBar/user/user')
 			},
-			getEmailCode(){
-				this.isDisabled = true
+			getEmailCodeFn(){
+				getEmailCode({email:this.bindEmail,status:1}).then(res =>{
+					this.$util.msg('验证邮件已发送至邮箱,请登录邮箱查收',2000)
+					const TIME_COUNT = 60;
+			     	if (!this.codeTime) {
+			       		this.count = TIME_COUNT;
+			       		this.isEmialDisabled = true;
+			       		this.codeTime = setInterval(() => {
+			       			if (this.count > 1 && this.count <= TIME_COUNT) {
+			         			this.count--
+			         			this.emailCodeText = this.count +'s重新发送'
+			        		} else {
+				         		this.isEmialDisabled = false;
+				         		clearInterval(this.codeTime)
+				         		this.codeTime = null
+								this.emailCodeText = '获取验证码'
+			        		}
+			       		},1000)
+			      	}
+				}).catch( res =>{
+					this.$util.msg(res.msg,2000);
+				})
 			},
-			//关闭未填邀请码弹窗
-			hideToast(){
-				self.isToast = false;
+			goUserLogininit(){
+				let url;
+				if(this.loginType) {
+					if(this.loginType=='detilType'){
+						this.$api.redirectTo(`/pages/goods/product?id=${this.id}&page=2`);
+					}else if(this.loginType=='search'){
+						this.$api.redirectTo('/pages/search/search');
+					}else if(this.loginType == 1){
+						url ='/pages/tabBar/cart/cart'
+					}else if(this.loginType == 2){
+						url ='/pages/tabBar/user/user'
+					}else {
+						url ='/pages/tabBar/home/home'
+					}
+					uni.switchTab({
+						url
+					})
+				} else if(this.listType) {
+					this.$api.navToListPage({type:this.listType,value:this.listVal,lType:'4'});
+				}
 			},
-			//关闭未授权用户授权提示弹窗
-			hideModel(){
-				self.isUserInfo = false;
-			}
+		},
+		onShow() {
+			this.$api.getStorage().then((resolve) => {
+				console.log(resolve)
+				this.userID = resolve.userID
+			})
 		}
 	}
 </script>
@@ -175,6 +174,26 @@
 			width: 702rpx;
 			height: auto;
 			padding: 0 24rpx;
+			&.btns{
+				display: flex;
+				margin-top: 80rpx;
+				.login-btn{
+					flex:1;
+					width: 303rpx;
+					height: 88rpx;
+					margin: 0 24rpx;
+					border-radius: 14rpx;
+					font-size: $font-size-28;
+					line-height: 88rpx;
+					color: #FFFFFF;
+					text-align: center;
+					background: $btn-confirm;
+					&.none{
+						background: #999999;
+						color: #FFFFFF;
+					}
+				}
+			}
 			.login-input{
 				width: 654rpx;
 				height: 40rpx;
@@ -193,15 +212,15 @@
 				&.btn{
 					width: 210rpx;
 					float: left;
-					&.none{
+					background: $btn-confirm;
+					.input{
 						background: $btn-confirm;
-						.input{
-							color: #FFFFFF;
-							background: $btn-confirm;
-						}
+						color: #FFFFFF;
 					}
 					&.disabled{
+						background: #F7F7F7;
 						.input{
+							background: #F7F7F7;
 							color: #999999;
 						}
 					}
@@ -217,51 +236,5 @@
 				}
 			}
 		}
-		.login-btn{
-			width: 702rpx;
-			height: 88rpx;
-			border-radius: 14rpx;
-			font-size: $font-size-28;
-			line-height: 88rpx;
-			color: #FFFFFF;
-			margin: 0 auto;
-			text-align: center;
-			background: $btn-confirm;
-			margin-top: 100rpx;
-		}
-		.model-authorization{
-			width: 100%;
-			height: 100%;
-			position: fixed;
-			top: 0;
-			left: 0;
-			z-index: 999;
-			.authorization{
-				width: 518rpx;
-				height: 320rpx;
-				position: absolute;
-				background: rgba(255,255,255,.7);
-				left: 0;
-				right: 0;
-				bottom: 0;
-				top: 0;
-				margin: auto;
-				.to-btn{
-					position: absolute;
-					top: 0;
-					left: 0;
-					right: 0;
-					bottom: 0;
-					margin: auto;
-					width: 70%;
-					height: 88rpx;
-					font-size: $font-size-28;
-					line-height: 88rpx;
-					color: #FFFFFF;
-					text-align: center;
-					border-radius: 44rpx;
-				}
-			}
-		}
 	}
 </style>

+ 113 - 102
pages/user-module/bindwechat.vue

@@ -5,11 +5,10 @@
 		</view>
 		<view class="login-form clearfix">
 			<view class="login-input">
-				<input type="number" 
+				<input type="text" 
 					   v-model="bindLinkName"  
 					   maxlength="30" 
 					   class="input" 
-					   @blur="onBlurInput"
 					   placeholder="请输入姓名"
 				/>
 			</view>
@@ -18,9 +17,8 @@
 			<view class="login-input">
 				<input type="number" 
 					   v-model="bindLinkPhone"  
-					   maxlength="30" 
+					   maxlength="11" 
 					   class="input" 
-					   @blur="onBlurInput"
 					   placeholder="请输入手机号"
 				/>
 			</view>
@@ -28,17 +26,17 @@
 		<view class="login-form clearfix">
 			<view class="login-input code">
 				<input type="number" 
-					   v-model="bindGraphiCode"  
-					   maxlength="4" 
+					   v-model="imageCode"  
+					   maxlength="6" 
 					   class="input" 
 					   placeholder="请输入右侧图形验证码"
 				/>
 			</view>
 			<view class="login-input img-btn">
 				<view class="vscodeimg">
-					<image src="https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=2158189919,2752757953&fm=26&gp=0.jpg" mode=""></image>
+					<image :src="imageCodeUrl" mode=""></image>
 				</view>
-				<view class="vscod-refresh">
+				<view class="vscod-refresh"  @click.stop="getVerificationCode">
 					<text class="iconfont icon-shuaxin"></text>
 					<text class="ref-text">刷新</text>
 				</view>
@@ -47,44 +45,21 @@
 		<view class="login-form clearfix">
 			<view class="login-input code">
 				<input type="number" 
-					   v-model="bindPhoneCode"  
+					   v-model="mobildeCode"  
 					   maxlength="6" 
 					   class="input" 
 					   placeholder="请输入短信验证码"
 				/>
 			</view>
-			<view class="login-input btn" :class="[isDisabled === true ? 'disabled' : 'none']">
+			<view class="login-input btn" :class="[isMobileDisabled  ? 'disabled' : '']" @click.stop="getMobileCodeFn">
 				<button type="button"
-						@click.stop="getEmailCode" :disabled="isDisabled"
+						:disabled="isMobileDisabled"
 					    class="input" 
-				>获取验证码</button>
+				>{{ mobileCodeText }}</button>
 			</view>
 		</view>
 		<view class="login-form clearfix">
-			<view class="login-btn"  @click="goLogin">绑定</view>
-		</view>
-		<view v-if="isToast" class="model-warp" >
-			<view class="model-alert clearfix">
-				<view class="alert-content">
-					<view class="t-h1">{{toestText}}</view>
-					<view class="t-p">请联系客服获取{{alertText}}后再登录,联系电话{{telPhone}}</view>
-				</view>
-				<view class="alert-btn">
-					<view class="btn btn-confirm" @click="hideToast">确定</view>
-				</view>
-			</view>
-		</view>
-		<!-- 授权按钮 -->
-		<view class="model-warp" :class="[isUserInfo===false ? 'none':'show']">
-			<view class="model-alert">
-				<view class="alert-content">
-					<view class="t-p">采美采购商城需要获取您的微信授权才能正常提供服务</view>
-				</view>
-				<view class="alert-btn">
-					<view class="btn btn-cancel" @click="hideModel">取消</view>
-					<button type="primary" size="small" open-type="getUserInfo" lang="zh_CN" @getuserinfo="getuserinfo" class="btn btn-confirm">授权</button>
-				</view>
-			</view>
+			<view class="login-btn"  @click="bindWechatInfo">绑定</view>
 		</view>
 	</view>
 </template>
@@ -92,23 +67,25 @@
 <script>
 	import { mapMutations } from 'vuex';
 	import authorize from '@/common/config/authorize.js' 
+	import { bindingWechat } from "@/api/use.js"
+	import { getImageCode, getbindWechatCode } from "@/api/utils.js"
 	var self;
 	export default{
 		data() {
 			return{
-				bindLinkName:'',  	//用户姓名
-				bindLinkPhone:'',  	//用户手机号
-				bindGraphiCode:'',  //图形验证
-				bindPhoneCode:'',  	//手机验证码
-				isDisabled:true,	//获取验证码按钮
-				isToast:false,		//控制显示未输入邀请码提示	
-				isUserInfo:false,	//控制显示授权弹窗
-				nickName:'',		//存储用户名
-				userInfo:'',		//存储微信用户授权信息
-				isSuccess:false,
-				toestText:'',
-				telPhone:'',
-				loginType:'',		//跳转类型
+				userID:'',
+				bindMobile:'',
+				bindLinkName:'',  		//用户姓名
+				bindLinkPhone:'',  		//用户手机号
+				mobildeCode:'',  		//手机验证码
+				imageCode:'',			//图形验证码
+				imageCodeUrl:'',		//图形验证码地址
+				imageCodetoken:'',		//图形校验token
+				isMobileDisabled:false, //获取手机短信按钮
+				count: '',				//倒计时
+				mobileCodeText: '获取验证码',
+				codeTime: null,
+				loginType:'',			//跳转类型
 				alertText:'',
 				listType: '',
 				listVal: '',
@@ -118,61 +95,95 @@
 		},
 		onLoad(option) {
 			console.log(option)
+			this.codeType = option.codeType
+			this.option = option
+			this.loginType = option.type;
+			this.id = option.id
+			if(option.listType) {
+				this.listType = option.listType;
+				this.listVal = option.listVal;
+			}
+			this.getVerificationCode()
 		},
 		methods:{
 			...mapMutations(['login']),
-			goLogin() {
-				self.$api.get('/login/isEnabled',{userOrganizeID:self.userOrganizeID,invitationCode:self.invitationCode}, res => {
-					if (res.code == "1") {
-						//查看此微信用户是否已经授权过
-						authorize.getSetting().then(res =>{
-							// console.log('是否已授权',res);//0:为取消授权 1:为已授权 2:为未操作
-							if(res == 2){
-								self.isUserInfo = true
-							}else{
-								self.isUserInfo = false
-								self.wxGetUserInfo()
-							}
-						})
-					}else if(res.code =='0'){
-						self.toestText ='请输入邀请码';
-						self.alertText ='邀请码';
-						self.telPhone = res.msg;
-						self.isToast = true;
-					}else if(res.code =='-2'){
-						self.toestText ='邀请码已失效';
-						self.alertText ='新邀请码';
-						self.telPhone = res.msg;
-						self.isToast = true;
-					}else if(res.code =='-3'){
-						self.toestText ='邀请码已被使用';
-						self.alertText ='新邀请码';
-						self.telPhone = res.msg;
-						self.isToast = true;
-					}else{
-						uni.showToast({icon:'none', title: res.msg, duration: 3000});
-						self.isUserInfo = false
-					}
-				})
-			},
-			onBlurInput(e){//邮箱输入框失去焦点设置按钮
-				if(e.detail.value ===''){
-					this.isDisabled = true
-				}else{
-					this.isDisabled = false
+			bindWechatInfo(){
+				let params ={
+						userID:this.userID,
+						mobile:this.bindLinkPhone,
+						linkName:this.bindLinkName,
+						verificationCode:this.mobildeCode,
 				}
+				bindingWechat(params).then(res =>{
+					console.log(res)
+				}).catch(res =>{
+					
+				})
 			},
-			getEmailCode(){
-				this.isDisabled = true
+			getVerificationCode(){//图形验证
+				getImageCode().then(res => {
+					this.imageCodeUrl = res.data.baseImage
+					this.imageCodetoken = res.data.token
+				})
 			},
-			//关闭未填邀请码弹窗
-			hideToast(){
-				self.isToast = false;
+			getMobileCodeFn(){//获取手机验证码
+				let params = {
+						mobile:this.bindLinkPhone,
+						mobileOrEmail:this.bindMobile,
+						platformType:2,
+						imgCode:this.imageCode,
+						token:this.imageCodetoken,
+				}
+				getbindWechatCode(params).then(res =>{
+					this.$util.msg('验证短信已发送',2000)
+					const TIME_COUNT = 60;
+			     	if (!this.codeTime) {
+			       		this.count = TIME_COUNT;
+			       		this.isMobileDisabled = true;
+			       		this.codeTime = setInterval(() => {
+			       			if (this.count > 1 && this.count <= TIME_COUNT) {
+			         			this.count--
+			         			this.mobileCodeText = this.count +'s重新发送'
+			        		} else {
+				         		this.isMobileDisabled = false;
+				         		clearInterval(this.codeTime)
+				         		this.codeTime = null
+								this.mobileCodeText = '获取验证码'
+			        		}
+			       		},1000)
+			      	}
+				}).catch( res =>{
+					this.$util.msg(res.msg,2000)
+				})
 			},
-			//关闭未授权用户授权提示弹窗
-			hideModel(){
-				self.isUserInfo = false;
+			goUserLogininit(){
+				let url;
+				if(this.loginType) {
+					if(this.loginType=='detilType'){
+						this.$api.redirectTo(`/pages/goods/product?id=${this.id}&page=2`);
+					}else if(this.loginType=='search'){
+						this.$api.redirectTo('/pages/search/search');
+					}else if(this.loginType == 1){
+						url ='/pages/tabBar/cart/cart'
+					}else if(this.loginType == 2){
+						url ='/pages/tabBar/user/user'
+					}else {
+						url ='/pages/tabBar/home/home'
+					}
+					uni.switchTab({
+						url
+					})
+				} else if(this.listType) {
+					this.$api.navToListPage({type:this.listType,value:this.listVal,lType:'4'});
+				}
 			}
+		},
+		onShow() {
+			this.$api.getStorage().then((resolve) => {
+				console.log(resolve)
+				this.userID = resolve.userID
+				this.bindMobile = resolve.bindMobile
+			})
 		}
 	}
 </script>
@@ -225,15 +236,15 @@
 				&.btn{
 					width: 210rpx;
 					float: left;
-					&.none{
-						background: $color-system;
-						.input{
-							color: #FFFFFF;
-							background: $color-system;
-						}
+					background: $btn-confirm;
+					.input{
+						color: #FFFFFF;
+						background: $btn-confirm;
 					}
 					&.disabled{
+						background: #F7F7F7;
 						.input{
+							background: #F7F7F7;
 							color: #999999;
 						}
 					}

+ 33 - 158
pages/user-module/login-accont.vue

@@ -7,7 +7,7 @@
 		<view class="login-form">
 			<view class="login-input">
 				<input type="number" 
-					   v-model="accountCode"  
+					   v-model="accountNumber"  
 					   maxlength="30" 
 					   class="input" 
 					   placeholder="请输入邮箱/手机号"
@@ -23,37 +23,15 @@
 				<view class="login-pwd" @click.stop="this.$api.navigateTo('/pages/user-module/password')">忘记密码?</view>
 			</view>
 		</view>
-		<view class="login-btn"  @click="goLogin">登录</view>
+		<view class="login-btn"  @click="confirmLogin">登录</view>
 		<view class="login-btn-last" @click.stop="this.$api.navigateTo('/pages/user-module/login')">授权登录</view>
-		<view v-if="isToast" class="model-warp" >
-			<view class="model-alert clearfix">
-				<view class="alert-content">
-					<view class="t-h1">{{toestText}}</view>
-					<view class="t-p">请联系客服获取{{alertText}}后再登录,联系电话{{telPhone}}</view>
-				</view>
-				<view class="alert-btn">
-					<view class="btn btn-confirm" @click="hideToast">确定</view>
-				</view>
-			</view>
-		</view>
-		<!-- 授权按钮 -->
-		<view class="model-warp" :class="[isUserInfo===false ? 'none':'show']">
-			<view class="model-alert">
-				<view class="alert-content">
-					<view class="t-p">采美采购商城需要获取您的微信授权才能正常提供服务</view>
-				</view>
-				<view class="alert-btn">
-					<view class="btn btn-cancel" @click="hideModel">取消</view>
-					<button type="primary" size="small" open-type="getUserInfo" lang="zh_CN" @getuserinfo="getuserinfo" class="btn btn-confirm">授权</button>
-				</view>
-			</view>
-		</view>
 	</view>
 </template>
 
 <script>
 	import { mapMutations } from 'vuex';
 	import authorize from '@/common/config/authorize.js' 
+	import { organizationLogin } from '@/api/use.js' 
 	var self;
 	export default{
 		data() {
@@ -61,13 +39,8 @@
 				isShowEye:false,
 				iconEyes:'icon-yanjing_yincang_o',
 				iconEyen:'icon-yanjing_xianshi_o',
-				accountCode:'',  //用户登录账号
-				password:'',	 //用户登录密码	
-				isToast:false,	 //控制显示未输入邀请码提示	
-				isUserInfo:false,//控制显示授权弹窗
-				nickName:'',	 //存储用户名
-				userInfo:'',	 //存储微信用户授权信息
-				isSuccess:false,
+				accountNumber:'',  //用户登录账号
+				password:'',	   //用户登录密码	
 				toestText:'',
 				telPhone:'',
 				loginType:'',		//跳转类型
@@ -75,145 +48,47 @@
 				listType: '',
 				listVal: '',
 				detilType:'',
-				id:''//商品ID
+				id:'',				//商品ID
+				option:''			//页面传递参数
 			}
 		},
 		onLoad(option) {
 			console.log(option)
-			self = this;
-			self.loginType = option.type;
-			self.id = option.id
-			if(option.listType) {
-				self.listType = option.listType;
-				self.listVal = option.listVal;
-			}
+			this.option = option
 		},
 		methods:{
 			...mapMutations(['login']),
-			goLogin() {
-				if(this.accountCode === ""){
-					this.$util.msg('请输入账户名',3000);
-					return
-				}
-				if(this.password === ""){
-					this.$util.msg('请输入密码',3000);
-					return
+			confirmLogin(){
+				let params ={
+						mobileOrEmail:this.accountNumber,
+						password:this.password,
+						source:'www',
 				}
-				self.$api.get('/login/isEnabled',{userOrganizeID:self.userOrganizeID,invitationCode:self.invitationCode}, res => {
-					if (res.code == "1") {
-						//查看此微信用户是否已经授权过
-						authorize.getSetting().then(res =>{
-							// console.log('是否已授权',res);//0:为取消授权 1:为已授权 2:为未操作
-							if(res == 2){
-								self.isUserInfo = true
-							}else{
-								self.isUserInfo = false
-								self.wxGetUserInfo()
-							}
+				organizationLogin(params).then(res =>{
+					if(res.code == '0' ){
+						this.storeUpdataeStatus(res.data)
+						this.$api.navigateTo(`/pages/user-module/bindwechat?data=${this.option}&codeType=${res.code}`)
+					}else if(res.code == '4'){
+						this.storeUpdataeStatus(res.data)
+						this.$api.navigateTo(`/pages/user-module/bindemail?data=${this.option}&codeType=${res.code}`)
+					}else if(res.code == '-3'){
+						this.storeUpdataeStatus(res.data)
+						this.$util.modal('',res.msg,'前往修改',true,() =>{
+							 this.$api.navigateTo('/pages/user-module/apply')
 						})
-					}else if(res.code =='0'){
-						self.toestText ='请输入邀请码';
-						self.alertText ='邀请码';
-						self.telPhone = res.msg;
-						self.isToast = true;
-					}else if(res.code =='-2'){
-						self.toestText ='邀请码已失效';
-						self.alertText ='新邀请码';
-						self.telPhone = res.msg;
-						self.isToast = true;
-					}else if(res.code =='-3'){
-						self.toestText ='邀请码已被使用';
-						self.alertText ='新邀请码';
-						self.telPhone = res.msg;
-						self.isToast = true;
 					}else{
-						uni.showToast({icon:'none', title: res.msg, duration: 3000});
-						self.isUserInfo = false
+						this.$util.msg(res.msg,2000);
 					}
 				})
 			},
-			//授权登录 
-			getuserinfo: function (e) {
-			    if (e.detail.userInfo) {
-					self.wxGetUserInfo()
-			    }else{
-					//用户按了拒绝按钮
-					uni.showModal({
-						content: '获取用户信息失败,请允许授权后才能继续使用小程序哦~',
-						showCancel: false,
-						confirmText: '授权',
-						success: function (res) {
-							 if (res.confirm) {
-								uni.openSetting({
-									 success: res => {
-										// console.log(res.authSetting)
-									 },
-									 fail: res => {
-										// console.log(res)
-									 }
-								})
-							 }
-						}
-					})
-			    }
-			 },
-			wxGetUserInfo(){
-				authorize.getCode('weixin').then(wechatcode =>{
-					wx.getUserInfo({
-						success: res => {
-							// console.log('useInfo:',res.userInfo)
-							self.userInfo = res.userInfo;
-							let params ={
-									code:wechatcode,
-									nickName:res.userInfo.nickName,
-									invitationCode:self.invitationCode,
-									userOrganizeID:self.userOrganizeID,
-								}
-							self.goUserLogininit(params);
-						}
-					});	
-				})
-			},
-			goUserLogininit(params){
-				self.$api.lodingGet('/login/register',params, response => {
-					// console.log(response)
-					if (response.code == "1") {
-						self.isUserInfo = false;
-						self.login(self.userInfo);
-						let user_key = {code:response.code,openid:response.data.openid,userID:response.data.userID}
-						uni.setStorageSync('cookieKey','JSESSIONID='+response.data.sessionId);
-						this.$store.commit('updateStatus',user_key)
-						let url;
-						if(self.loginType) {
-							if(self.loginType=='detilType'){
-								self.$api.redirectTo(`/pages/goods/product?id=${self.id}&page=2`);
-							}else if(self.loginType=='search'){
-								self.$api.redirectTo('/pages/search/search');
-							}else if(self.loginType == 1){
-								url ='/pages/tabBar/cart/cart'
-							}else if(self.loginType == 2){
-								url ='/pages/tabBar/user/user'
-							}else {
-								url ='/pages/tabBar/home/home'
-							}
-							uni.switchTab({
-								url
-							})
-						} else if(self.listType) {
-							self.$api.navToListPage({type:self.listType,value:self.listVal,lType:'4'});
-						}
-					} else {
-						this.$util.msg(response.msg,3000);
-					}
-				})
-			},
-			//关闭未填邀请码弹窗
-			hideToast(){
-				self.isToast = false;
-			},
-			//关闭未授权用户授权提示弹窗
-			hideModel(){
-				self.isUserInfo = false;
+			storeUpdataeStatus(data){
+				let user_key = {
+						clubID:data.clubID,
+						shopID:data.shopID,
+						userID:data.userID,
+						bindMobile:data.bindMobile
+				}						
+				this.$store.commit('updateStatus',user_key)
 			},
 			passwordClick() { //密码显隐操作
 				this.isShowEye = !this.isShowEye;

+ 36 - 12
pages/user-module/password.vue

@@ -36,7 +36,7 @@
 			</view>
 			<view class="login-form clearfix">
 				<view class="login-input code">
-					<input type="number" v-model="bindPhoneCode"  maxlength="6" class="input" placeholder="请输入短信验证码"/>
+					<input type="number" v-model="mobileCode"  maxlength="6" class="input" placeholder="请输入短信验证码"/>
 				</view>
 				<view class="login-input btn" :class="[isMobileDisabled  ? 'disabled' : '']" @click.stop="getMobileCodeFn">
 					<button type="button" :disabled="isMobileDisabled" class="input" >{{ mobileCodeText }}</button>
@@ -57,7 +57,7 @@
 				</view>
 			</view>
 			<view class="login-form clearfix">
-				<view class="login-btn"  @click="confirmPassword">修改密码</view>
+				<view class="login-btn"  @click="confirmMobilePassword">修改密码</view>
 			</view>
 		</view>
 		<!-- 邮箱修改 -->
@@ -90,7 +90,7 @@
 				</view>
 			</view>
 			<view class="login-form clearfix">
-				<view class="login-btn"  @click="goLogin">修改密码</view>
+				<view class="login-btn"  @click="confirmEmailPassword">修改密码</view>
 			</view>
 		</view>
 	</view>
@@ -98,8 +98,8 @@
 
 <script>
 	import authorize from '@/common/config/authorize.js' 
-	import { organizationRegister , organizationVerifyRegisterFirst ,organizationVerifyRegisterTwo } from "@/api/use.js"
-	import { getImageCode, getEmailCode, getMobileCode, uploadFileImage } from "@/api/utils.js"
+	import { mobilePassword , emailPassword } from "@/api/use.js"
+	import { getImageCode, getEmailCode, getMobileCode } from "@/api/utils.js"
 	
 	export default{
 		data() {
@@ -108,7 +108,7 @@
 				mobile:'',  		//用户手机号
 				email:'',			//邮箱地址
 				emailCode:'',		//油箱验证码
-				bindPhoneCode:'',  	//手机验证码
+				mobileCode:'',  	//手机验证码
 				password:'',		//新密码
 				passwordCheck:'',   //二次校验新密码
 				isShowEye:false,	//控显
@@ -131,8 +131,33 @@
 			this.getVerificationCode()
 		},
 		methods:{
-			confirmPassword(){
-				
+			confirmMobilePassword(){//手机号修改
+				let params = {
+						mobileOrEmail : this.mobile,
+						activateCode : this.mobileCode,
+						passWord : this.password,
+						confirmPwd : this.passwordCheck,
+						status:1
+					}
+				mobilePassword(params).then(res =>{
+					this.$util.msg(res.msg,2000);
+				}).catch( res =>{
+					this.$util.msg(res.msg,2000);
+				})
+			},
+			confirmEmailPassword(){//邮箱修改密码
+				 let params = {
+						mobileOrEmail : this.email,
+						activateCode : this.emailCode,
+						passWord : this.password,
+						confirmPwd : this.passwordCheck,
+						status:2
+					}
+				emailPassword(params).then(res =>{
+					this.$util.msg(res.msg,2000);
+				}).catch( res =>{
+					this.$util.msg(res.msg,2000);
+				})
 			},
 			getVerificationCode(){//图形验证
 				getImageCode().then(res => {
@@ -140,7 +165,7 @@
 					this.imageCodetoken = res.data.token
 				})
 			},
-			getEmailCodeFn(){
+			getEmailCodeFn(){//获取邮箱验证码
 				getEmailCode({email:this.email,status:3}).then(res =>{
 					this.$util.msg('验证邮件已发送至邮箱,请登录邮箱查收',2000);
 					const TIME_COUNT = 60;
@@ -163,7 +188,7 @@
 					this.$util.msg(res.msg,2000);
 				})
 			},
-			getMobileCodeFn(){
+			getMobileCodeFn(){//获取手机验证码
 				let params = {
 						mobile:this.mobile,
 						activateCodeType:1,
@@ -240,9 +265,8 @@
 				align-items: center;
 				line-height: 80rpx;
 				color: $text-color;
-				font-size: $font-size-24;
+				font-size: $font-size-28;
 				background: #F7F7F7;
-				
 				&.current{
 					color:$color-system;
 					background: #FFFFFF;