Browse Source

commit -m 联调接口

zhengjinyi 4 years ago
parent
commit
9f608e97ee

+ 1 - 1
App.vue

@@ -5,7 +5,7 @@
 import Vue from 'vue'
 import { mapState, mapMutations } from 'vuex'
 import authorize from '@/common/config/authorize.js'
-import wxLogin from '@/common/config/wxLogin.js'
+import wxLogin from '@/services/wxLogin.js'
 export default {
 	onLaunch: function() {
 		let self = this

+ 25 - 299
common/config/utilsTools.js

@@ -3,105 +3,8 @@
  * @Author Zhengjingyi
  * @Action 全局公共方法
  */
-import requestUrl from '@/services/ajax.env.js'
-const caimeiApi = {
-	/**
-	 * @封装公共get数据请求方法无加载动画
-	 * @方法参数:请求地址,请求后台需要的参数字段,回调函数
-	 * @自定义请求头信息
-	 */
-	get:function(url,data,callback){
-		 uni.request({
-			url: requestUrl + url,
-			data:data,
-			header: {
-				'Accept': 'application/json',
-				'Content-Type': 'application/x-www-form-urlencoded', 
-				'X-Token': uni.getStorageSync('token') ? uni.getStorageSync('token') : 'token',
-				'cookie': uni.getStorageSync('sessionid')
-			},
-			method: 'GET',
-			success: (response) => {
-				if(response.statusCode !== 200){
-					uni.showToast({icon: 'none',title:'服务器连接错误',duration: 2000})
-					callback(response.statusCode)
-				}else{
-					callback(response.data)
-				}
-			},
-			fail: (error) => {
-				if (error) {
-					uni.showToast({icon: 'none',title: '网络错误,请稍后重试',duration: 2000})
-				}
-			}
-		 })
-	},
-	/**
-	 * @封装公共get数据请求方法有加载动画
-	 * @方法参数:请求地址,请求后台需要的参数字段,回调函数
-	 * @自定义请求头信息
-	 */
-	lodingGet:function(url,data,callback){
-		 uni.showLoading({mask: true,title:'加载中~',})
-		 uni.request({
-			url: requestUrl + url,
-			data:data,
-			header: {
-				'Accept': 'application/json',
-				'Content-Type': 'application/x-www-form-urlencoded', 
-				'X-Token': uni.getStorageSync('token') ? uni.getStorageSync('token') : 'token',
-				'cookie': uni.getStorageSync('sessionid')
-			},
-			method: 'GET',
-			success: (response) => {
-				if(response.statusCode !== 200){
-					uni.showToast({icon: 'none',title: '服务器连接错误',duration: 2000})
-					callback(response.statusCode)
-				}else{
-					callback(response.data)
-				}
-			},
-			fail: (error) => {
-				if (error) {
-					uni.showToast({icon: 'none',title: '网络错误,请稍后重试',duration: 2000})
-				}
-			},
-			complete: () => {
-				setTimeout(function () {
-					uni.hideLoading()
-				}, 250)
-			}
-		 })
-	},
-	/**
-	 * @封装公共post数据请求方法
-	 * @方法参数:请求地址,请求后台需要的参数字段,回调函数
-	 */
-	post:function(url,data,loadingStatus,callback){
-		if(loadingStatus){uni.showLoading({mask: true,title:'加载中~'})}
-		uni.request({
-			url: requestUrl+url,
-			data:data,
-			header: {
-				'Accept': 'application/json',
-				// 'Content-Type': 'application/x-www-form-urlencoded',
-				'Content-Type': 'application/json',
-			},
-			method: 'POST',
-			success: (response) => {
-				console.log(response)
-				if(loadingStatus){uni.hideLoading()}
-				const result = response.data
-				callback(result)
-			},
-			fail: (error) => {
-				uni.hideLoading()
-				if (error) {
-					uni.showToast({icon: 'none',title: '网络错误,请稍后重试',duration: 2000})
-				}
-			}
-		})
-	},
+import requestUrl from '@/services/config.env.js'
+const _Tools = {
 	getComStorage:function(key){// 获取本地Storage
 		return new Promise(function(resolve,reject) {
 			uni.getStorage({
@@ -148,135 +51,6 @@ const caimeiApi = {
 			})
 		})
 	},
-	loginStatus:function(){
-	// 获取用户是否登陆 1:已登陆,否则未登陆
-		return new Promise(function(resolve,reject) {
-			uni.getStorage({
-				key: 'userInfo',
-				success: function (res){
-					if(res.data.code == '1'){
-						resolve(true)
-					} else {
-						resolve(false)
-					}
-				}
-			})
-		})
-	},
-	navToListPage:function({type,value,id,lType} = {}){	
-	// 跳转到列表页
-		if(lType=='4'){
-			const pages = getCurrentPages()
-			const prevPage = pages[pages.length-2]
-			prevPage.refresh = true
-			prevPage.listData = {
-				type: type,
-				from: value,
-				id: id
-			}
-			uni.navigateBack({
-				delta: 1
-			})
-		}else{
-			uni.navigateTo({
-				url:`/pages/goods/goods?type=${type}&from=${value}&id=${id}`
-			})
-		}
-	},
-	navigateToGoods:function({type,value,id,lType} = {}){
-	// 跳转到列表页
-		if(lType=='4'){
-			const pages = getCurrentPages()
-			const prevPage = pages[pages.length-2]
-			prevPage.refresh = true
-			prevPage.listData = {
-				type: type,
-				from: value,
-				id: id
-			}
-			uni.navigateBack({
-				delta: 1
-			})
-		}else{
-			uni.navigateTo({
-				url:`/pages/goods/goods-classify?type=${type}&from=${value}&id=${id}`
-			})
-		}
-	},
-	FlooryNavigateTo:function(pros){
-		if(pros.listType == 1){
-			if(pros.product.productCategory == '1'){
-				uni.navigateTo({
-				  	url:`/pages/goods/product?id=${pros.product.productID}`
-				})
-			}else{
-				uni.navigateTo({
-				  	url:`/second/pages/product/product-details?id=${pros.product.productID}`
-				})
-			}
-		}else{
-			/**
-			 * 页面跳转类型
-			 * 1、二级页面,2、搜索项目仪器,3、直播页面,4、自由页面,5、商品详情,6、仪器项目详情,7、供应商主页
-			 * 8、专题活动页,9、二手市场介绍,10、二手商品列表,11、二手商品发布,12、商品搜索,13、信息详情
-			 * 14、品牌招商介绍页,15、维修保养介绍页,16、首页,17、注册页,18、信息中心,19、供应商列表
-			 **/
-			if(pros.linkType){
-				console.log(pros.linkType)
-				const typeMap = {
-				 	1:`/pages/goods/goods-instrument?linkId=${pros.linkParam.id}`,
-				 	2:`/pages/goods/instrument-details?id=${pros.linkParam.id}`,
-					4:`/h5/pages/activity/activity?title=${pros.crmTitle}&link=${pros.crmLink}`,
-				 	5:`/pages/goods/product?id=${pros.linkParam.id}`,
-				 	7:`/supplier/pages/user/my-shop?shopId=${pros.linkParam.id}`,
-				 	8:'/h5/pages/activity/activity-list',
-				 	9:'/second/pages/form/introduce',
-				 	10:'/second/pages/product/product-list',
-				 	11:'/second/pages/form/form',
-				 	12:`/search/pages/search/search?keyWord=${pros.linkParam.keyword}`,
-				 	13:`/h5/pages/article/path?link=${pros.link}`,
-				 	14:`/h5/pages/article/path?link=${pros.link}`,
-				 	15:`/h5/pages/article/path?link=${pros.link}`,
-				 	17:'/pages/login/register-select',
-				 	18:`/h5/pages/article/path?link=${pros.link}`,
-				 	19:`/search/pages/search/search-supplier?keyWord=${pros.linkParam.keyword}`,
-					21:'/h5/pages/activity/meobohui'
-					
-				}
-				const url = typeMap[pros.linkType]
-				uni.navigateTo({
-				  	url:url
-				})
-			}
-		}
-	},
-	BannerNavigateTo:function(linkType,linkId,linkHref,keyword){//楼层跳转判断
-		if(linkType){
-			const typeMap = {
-				1:`/pages/goods/goods-instrument?linkId=${linkId}`,
-				2:`/pages/goods/instrument-details?id=${linkId}`,
-				4:`/h5/pages/activity/activity?id=${linkId}`,
-				5:`/pages/goods/product?id=${linkId}`,
-				7:`/supplier/pages/user/my-shop?shopId=${linkId}`,
-				8:'/h5/pages/activity/activity-list',
-				9:'/second/pages/form/introduce',
-				10:'/second/pages/product/product-list',
-				11:'/second/pages/form/form',
-				12:`/search/pages/search/search?keyWord=${keyword}`,
-				13:`/h5/pages/article/path?link=${linkHref}`,
-				14:`/h5/pages/article/path?link=${linkHref}`,
-				15:`/h5/pages/article/path?link=${linkHref}`,
-				17:'/pages/login/register-select',
-				18:`/h5/pages/article/path?link=${linkHref}`,
-				19:`/search/pages/search/search-supplier?keyWord=${keyword}`,
-				21:'/h5/pages/activity/meobohui'
-			}
-			const url = typeMap[linkType]
-			uni.navigateTo({
-			 	url:url
-			})
-		}
-	},
 	navigateTo:function(url){
 		//路由跳转:页面之间路由跳转
 		uni.navigateTo({
@@ -295,14 +69,6 @@ const caimeiApi = {
 			url:url
 		})
 	},
-	isNumber:function(value){//验证是否为数字
-	    var patrn = /^(-)?\d+(\.\d+)?$/
-	    if (patrn.exec(value) == null || value == '') {
-	         return false
-	    } else {
-	         return true  
-		}	 
-	},
 	getWindowHeight:function(){
 		// 获取窗口高度
 		const {windowHeight, pixelRatio} = wx.getSystemInfoSync()
@@ -320,76 +86,36 @@ const caimeiApi = {
 		})
 		return html	
 	},
-	FormatMoney:function(num){
-		// 金额千分位
-		return num.toString().replace(/\d+/, function (n) { // 先提取整数部分
-			return n.replace(/(\d)(?=(\d{3})+$)/g, function ($1) { // 对整数部分添加分隔符
-				return $1 + ','
-			})
-		})
-	},
 	formatDate:function(){
 		//获取当前时间
-		let date = new Date()
-		let y = date.getFullYear()
-		let MM = date.getMonth() + 1
-		MM = MM < 10 ? ('0' + MM) : MM
-		let d = date.getDate()
-		d = d < 10 ? ('0' + d) : d
-		let h = date.getHours()
-		h = h < 10 ? ('0' + h) : h
-		let m = date.getMinutes()
-		m = m < 10 ? ('0' + m) : m
-		let s = date.getSeconds()
-		s = s < 10 ? ('0' + s) : s
-	    return y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s
-	},
-	regexSets:function() {
-		let sets = {
-			'companyName': /^[\u4e00-\u9fa5\(\)()\s\da-zA-Z&]{2,50}$/gi,
-			'phoneAndTelephone': /^([1]\d{10}|([\((]?0[0-9]{2,3}[)\)]?[-]?)?([2-9][0-9]{6,7})+(\-[0-9]{1,4})?)$/,
-			'bankNum': /^([1-9]{1})(\d{18})$/,
-			'invalidChar': /^[\s\u4e00-\u9fa5a-z0-9_-]{0,}$/
-		}
-		return sets
+		let date = new Date();
+		let y = date.getFullYear();
+		let MM = date.getMonth() + 1;
+		MM = MM < 10 ? ('0' + MM) : MM;
+		let d = date.getDate();
+		d = d < 10 ? ('0' + d) : d;
+		let h = date.getHours();
+		h = h < 10 ? ('0' + h) : h;
+		let m = date.getMinutes();
+		m = m < 10 ? ('0' + m) : m;
+		let s = date.getSeconds();
+		s = s < 10 ? ('0' + s) : s;
+	    return y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s;
 	},
-	timestampToTime:function(timestamp) {
-		// 时间戳转日期
-	   let date = new Date(timestamp * 1000)//时间戳为10位需*1000,时间戳为13位的话不需乘1000
-	   let Y = date.getFullYear() + '-'
-	   let M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-'
-	   let D = (date.getDate() < 10 ? '0'+date.getDate() : date.getDate()) + ' '
-	   let h = (date.getHours() < 10 ? '0'+date.getHours() : date.getHours()) + ':'
-	   let m = (date.getMinutes() < 10 ? '0'+date.getMinutes() : date.getMinutes()) + ':'
-	   let s = (date.getSeconds() < 10 ? '0'+date.getSeconds() : date.getSeconds())
-	   return `${Y}${M}${D}${h}${m}${s}`
-	}
 }
 
 /**
  *@导出
  */ 
 module.exports = {
-	get: caimeiApi.get,
-	post: caimeiApi.post,
-	lodingGet: caimeiApi.lodingGet,
-	isNumber: caimeiApi.isNumber,
-	FormatMoney: caimeiApi.FormatMoney,
-	navigateTo: caimeiApi.navigateTo,
-	redirectTo: caimeiApi.redirectTo,
-	switchTabTo: caimeiApi.switchTabTo,
-	formatDate: caimeiApi.formatDate,
-	loginStatus: caimeiApi.loginStatus,
-	setStorage: caimeiApi.setStorage,
-	getStorage: caimeiApi.getStorage,
-	getComStorage: caimeiApi.getComStorage,
-	navToListPage: caimeiApi.navToListPage,
-	navigateToGoods: caimeiApi.navigateToGoods,
-	getWindowHeight: caimeiApi.getWindowHeight,
-	adaptRichTextImg: caimeiApi.adaptRichTextImg,
-	getStorageAddressKey: caimeiApi.getStorageAddressKey,
-	regexSets: caimeiApi.regexSets,
-	timestampToTime: caimeiApi.timestampToTime,
-	BannerNavigateTo:caimeiApi.BannerNavigateTo,
-	FlooryNavigateTo:caimeiApi.FlooryNavigateTo 
+	formatDate: _Tools.formatDate,
+	navigateTo: _Tools.navigateTo,
+	redirectTo: _Tools.redirectTo,
+	switchTabTo: _Tools.switchTabTo,
+	setStorage: _Tools.setStorage,
+	getStorage: _Tools.getStorage,
+	getComStorage: _Tools.getComStorage,
+	getWindowHeight: _Tools.getWindowHeight,
+	adaptRichTextImg: _Tools.adaptRichTextImg,
+	getStorageAddressKey: _Tools.getStorageAddressKey,
 }

+ 0 - 61
common/config/wxLogin.js

@@ -1,61 +0,0 @@
-import store from '@/store/index.js'
-import authorize from '@/common/config/authorize.js'
-import ajaxService from '@/services/ajax.service.js'
-import UserService from '@/services/user.service'
-
-const newUserService = new UserService(ajaxService)
-
-// 根据微信的code获取用户登录状态:1已登录过 -1未登录过
-const wxLoginAuthorize = async function(){
-	const wechatCode = await authorize.getCode('weixin');// 根据微信的code获取用户登录状态:1已登录过 -1未登录过
-	const getUserInfo = await authorize.getUserInfo('weixin');
-	newUserService.userInfoLogin({ 
-		code:wechatCode,
-		encryptedData:getUserInfo.encryptedData,
-		iv:getUserInfo.iv
-	})
-	.then(response =>{
-		store.commit('updateStatus',response.data)
-		store.commit('login',response.data);
-		uni.setStorageSync('token',response.data.token)
-		uni.setStorageSync('unionId',response.data.unionId)
-	})
-	.catch(error =>{
-		uni.setStorageSync('unionId',error.data.unionId)
-		store.commit('logout',error.data)
-		store.commit('updateStatus',error.data)
-	})
-}
-const wxLoginQuick = async function(){// 根据微信的code获取用户登录状态:1已登录过 -1未登录过跳转
-		const wechatCode = await authorize.getCode('weixin');// 根据微信的code获取用户登录状态:1已登录过 -1未登录过
-		const getUserInfo = await authorize.getUserInfo('weixin');
-		const params = 
-		newUserService.userInfoLogin({ 
-			code:wechatCode,
-			encryptedData:getUserInfo.encryptedData,
-			iv:getUserInfo.iv
-		})
-		.then(response =>{
-			console.log(response)
-			store.commit('updateStatus',response.data)
-			store.commit('login',response.data);
-			uni.setStorageSync('token',response.data.token)
-			uni.setStorageSync('unionId',response.data.unionId)
-			if(response.data.userIdentity ==1){
-				uni.navigateTo({url:'/seller/pages/index/index'})
-			}else if(response.data.userIdentity === 3){
-				uni.navigateTo({url:'/supplier/pages/index/index'})
-			}else{
-				uni.switchTab({url:'/pages/tabBar/user/user'})
-			}
-		})
-		.catch(error =>{
-			uni.setStorageSync('unionId',error.data.unionId)
-			store.commit('logout',error.data)
-			store.commit('updateStatus',error.data)
-		})
-}
-export default{
-	wxLoginAuthorize,
-	wxLoginQuick
-}

+ 2 - 5
components/cm-module/homeIndex/banner.vue

@@ -2,8 +2,8 @@
 	<view>
 		<view class="swiper-banner-box" >
 			<swiper class="tui-banner-swiper tui-banner tui-skeleton-fillet" :autoplay="true" :interval="5000" :duration="500"  @change="swiperChange" :circular="true">
-				<swiper-item v-for="(item,index) in list" :key="index" @click.stop="NavToDetailPage(item)">
-					<image :src="item.image" class="tui-slide-image" mode="scaleToFill"/>
+				<swiper-item v-for="(item,index) in list" :key="index">
+					<image :src="item" class="tui-slide-image" mode="scaleToFill"/>
 				</swiper-item>
 			</swiper>
 			<view class="swiper__dots-box" v-if="list.length > 1">
@@ -40,9 +40,6 @@
 			swiperChange(e) {//轮播图切换
 				const index = e.detail.current;
 				this.current = index;
-			},
-			NavToDetailPage(floor) {//跳转
-				this.$api.FlooryNavigateTo(floor)
 			}
 		}
 	}

+ 1 - 1
manifest.json

@@ -56,7 +56,7 @@
     "quickapp" : {},
     /* 小程序特有相关 */
     "mp-weixin" : {
-        "appid" : "wxf3cd4ae0cdd11c36",
+        "appid" : "wx2c3b0a7f343235b1",
         "setting" : {
             "urlCheck" : false,
             "minified" : true,

+ 5 - 2
pages.json

@@ -8,7 +8,8 @@
 				"enablePullDownRefresh":true,
 				"backgroundColor":"#F952B7",
 				"backgroundTextStyle":"light",
-				"navigationStyle":"custom"
+				"navigationStyle":"custom",
+				"onReachBottomDistance":100
 			}
 		},
 		{
@@ -70,7 +71,9 @@
 			{
 				"path": "address/address",
 				"style": {
-					"navigationBarTitleText": "地址列表"
+					"navigationBarTitleText": "地址列表",
+					"enablePullDownRefresh":true,
+					"onReachBottomDistance":50
 				}
 			},
 			{

+ 1 - 14
pages/authorize/authorize.vue

@@ -25,7 +25,7 @@
 <script>
 import { mapState, mapMutations } from 'vuex'
 import authorize from '@/common/config/authorize.js'
-import wxLogin from '@/common/config/wxLogin.js'
+import wxLogin from '@/services/wxLogin.js'
 
 export default {
 	data() {
@@ -79,13 +79,6 @@ export default {
 				}
 			})
 		},
-		Getuserinfo: function (e) {//微信授权(暂时弃用)
-		    if (e.detail.userInfo) {
-				this.WxGetUserInfo()
-		    }else{
-				this.$util.msg('授权失败',2000)
-		    }
-		 },
 		undGetuserinfo(){
 			this.hanldBackFn()
 		},
@@ -113,12 +106,6 @@ export default {
 						case '1':
 							self.$api.navigateTo('/pages/login/login')
 							break;
-						case '2':
-							self.$api.navigateTo('/pages/login/register')
-							break;
-						case '3':
-							self.$api.navigateTo('/pages/login/logincode')
-							break;
 						default:
 							setTimeout(()=>{
 								uni.navigateBack({delta: 1});

+ 1 - 1
pages/goods/product.vue

@@ -240,7 +240,7 @@
 	import cmParameter from "@/components/cm-module/productDetails/cm-parameter" //相关参数
 	import cmService from "@/components/cm-module/productDetails/cm-service" //服务项目
 	import authorize from '@/common/config/authorize.js'
-	import wxLogin from "@/common/config/wxLogin.js"
+	import wxLogin from "@/services/wxLogin.js"
 	import { debounce } from '@/common/config/common.js'
 	var isPreviewImg;
 	export default{

+ 32 - 235
pages/goods/search.vue

@@ -22,7 +22,7 @@
 			<scroll-view :style="{'height':(productList.length>4? scrollHeight+'px' : 'auto')}" @scrolltolower="scrolltolower" scroll-y v-if="!showEmpty">
 				<view v-for="(pro,index) in productList" :key="index" :id="pro.id" class="product-list-type commodity-list" @click.stop="navToDetailPage(pro.productId)">
 					<view class="product-list-image">
-						<image class="product-image" :src="pro.image" mode=""></image>
+						<image class="product-image" :src="pro.mainImage" mode=""></image>
 					</view>
 					<view class="product-list-msgs">
 						<view class="product-name">{{ pro.name }}</view>
@@ -30,7 +30,7 @@
 						<view class="product-tags" v-if="pro.activistatus == 1"><text class="tag">活动价</text></view>
 						<view class="product-pric">
 							<view class="price">¥{{ pro.price | PriceFormat }}</view>
-							<view class="carts" @click.stop="handAddCarts">
+							<view class="carts" @click.stop="handAddCarts(pro)">
 								<view class="carts-add">
 									<text class="iconfont icon-gouwuche"></text>
 								</view>
@@ -38,7 +38,7 @@
 						</view>
 					</view>
 				</view>
-				<view v-if="showLoading && productList.length > 4">
+				<view v-if="showLoading && productList.length > 5">
 					<view class="loading-wrapper loading-wrapper-now" v-if="loadingNow">{{loadingText}}<text v-if="loadingText === '已至底部'">‧ ‧ ‧</text></view>
 					<view class="loading-wrapper loading-wrapper-btm" v-else>———<text class="btm-text">已至底部</text>———</view>
 				</view>
@@ -60,7 +60,7 @@
 	import modalLayer from "@/components/modal-layer"
 	import uniGrader from '@/components/uni-grade/uni-grade.vue'
 	import authorize from '@/common/config/authorize.js'
-	import wxLogin from "@/common/config/wxLogin.js"
+	import wxLogin from "@/services/wxLogin.js"
 	
 	export default {
 		components: {
@@ -93,243 +93,29 @@
 				windowHeight: '',
 				showEmpty: false,
 				scrollHeight: '',
-				productList:[
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:1,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:2,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:1,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:2,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:2,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:1,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:2,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:1,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:2,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:1,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:2,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:1,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:2,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:1,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:2,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:1,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:2,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:1,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:2,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:1,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:2,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:1,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:2,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:1,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:2,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:1,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:2,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:1,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:2,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:1,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:2,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:1,
-						price:888,
-					},
-					
-				],//商品列表				productIds:'',//查询价格的商品ID
+				productList:[],//商品列表				productIds:'',//查询价格的商品ID
 				showLoading: false,
 				loadingNow: true,
 				loadingText: '上拉加载更多',
+				hasNextPage:false,
 				pullFlag: true,
 				listQuery:{ 
-					identity:0,
-					keyword:'',
-					sortField:'',
-					sortType:'',
+					name:'',
 					pageNum: 1,
 					pageSize: 20,
 				},
-				total:0,
 				modal:false,
 				contentModalText:'确定删除历史记录?'
 			}
 		},
 		onLoad(option) {
 			console.log(option)
-			if(option.type =='share'){
-				authorize.checkLogin().then(res => {
-					wxLogin.wxLoginAuthorize()
-				})
-				.catch(err => {
-					console.log(new Date +'用户未授权微信信息')
-				})
-			}
-			// this.$api.getStorage().then((resolve) =>{
-			// 	this.userID = resolve.userId ? resolve.userId : 0;
-			// 	this.shopId = resolve.shopId ? resolve.shopId : 0;
-			// 	this.userIdentity = resolve.userIdentity;
-			// 	this.listQuery.identity = this.identity;
-			// 	if(option.keyWord){
-			// 		this.listQuery.keyword = option.keyWord
-			// 		this.setSearchHistoryAdd()
-			// 		this.getListFromServer()
-			// 		this.isFocus = false
-			// 	}else{
-			// 		this.isFocus = true
-			// 		this.InitGetSerachRecord()
-			// 	}
-			// })	
+			this.$api.getStorage().then((resolve) =>{
+				this.userId = resolve.userId ? resolve.userId : 0;
+				this.userIdentity = resolve.userIdentity;
+				this.isFocus = true
+				this.InitGetSerachRecord()
+			})	
 		},
 		filters: {
 			PriceFormat:function(text) {//处理金额
@@ -370,23 +156,23 @@
 				if(loadMore) {
 					this.listQuery.pageNum += 1;
 				}
-				this.ProductService.GetProductSearchList(this.listQuery).then(response =>{
+				this.ProductService.QueryProductList(this.listQuery).then(response =>{
 					this.isShowWrapper = true
-					const resData = JSON.parse(response.data);
-					const resList = resData.items;
-					if(resList && resList.length > 0){
-						this.total = resData.total;
+					const data = response.data;
+					const dataList = data.list;
+					if(dataList && dataList.length > 0){
+						this.hasNextPage = data.hasNextPage;
 						this.showEmpty = false;
 						if(loadMore) {
-							this.productList = [...this.productList,...resList];
+							this.productList = [...this.productList,...dataList];
 						} else {
-							this.productList = [...resList];
+							this.productList = [...dataList];
 						}
 						// 防上拉暴滑
 						this.pullFlag = false;
 						setTimeout(()=>{ this.pullFlag = true; },500)
 						// 底部提示文案
-						if(this.totalPage>this.productList.length) {
+						if(this.hasNextPage) {
 							this.loadingText = '上拉加载更多';
 						} else {
 							this.showLoading = true;
@@ -401,6 +187,17 @@
 					this.$util.msg(error.msg,2000);
 				})
 			},
+			handAddCarts(pro){
+				if(!this.hasLogin){
+					if(!uni.getStorageSync('_WX_State')){
+						this.$api.navigateTo(`/pages/authorize/authorize?type=1`)
+					}else{
+						this.$api.navigateTo(`/pages/login/login`)
+					}
+				}else{
+					this.$util.msg('加入成功',1500,true,'success')
+				}
+			}, 
 			SetSearchHistoryAdd(){//添加搜索记录
 				if (!this.hasLogin) {return false;}
 				this.ProductService.GetAddProductSearchHistory({userId: this.userID,keyword:this.listQuery.keyword}).then(response =>{

+ 84 - 90
pages/login/login.vue

@@ -17,7 +17,7 @@
 		<view class="login-input">
 			<input class="input_code" 
 				   type="number" 
-				   v-model="params.msgCode" 
+				   v-model="params.verificationCode" 
 				   placeholder="请输入短信验证码"
 				   maxlength="6"
 			/>
@@ -33,13 +33,13 @@
 		</view>
 		<!-- 提示信息 -->
 		<view class="logo-message"><text>{{ loginMessage }}</text></view>
-		<button class="login-btn" @click="goLogin" :disabled="isCodeEmpty">登录</button>
+		<view class="login-btn" :class="[isLoginStatus  ? 'disabled' : '']" @click="SubMitLogins">登录</view>
 	</view>
 </template>
 
 <script>
 import authorize from '@/common/config/authorize.js'
-import wxLogin from '@/common/config/wxLogin.js'
+import wxLogin from '@/services/wxLogin.js'
 import { mapState, mapMutations } from 'vuex'
 export default {
 	data() {
@@ -47,81 +47,68 @@ export default {
 			invitationCode: '', //获取用户登录的邀请码
 			loginMessage: '未注册的手机号验证后自动创建呵呵商城账户' ,//登录信息反馈
 			StaticUrl:this.$Static,
+			disabled:false,
 			params:{
 				mobile:'',
-				msgCode:''
+				headImgUrl:'',		//微信头像
+				nickName:'',	    //微信昵称
+				openId:'',		   //微信openId
+				verificationCode:''//短信验证码
 			},
 			count: '',		//倒计时
 			isMobileDisabled:true, //获取手机短信按钮
 			mobileCodeText: '获取验证码',
 			codeTime: null,
+			isLoginStatus:false
 		}
 	},
 	onLoad(option) {},
 	computed: {
 		...mapState(['isWxAuthorize', 'isLoginType', 'isLoginProductId', 'isLoginOrderId']),
-		// 邀请码长度是否符合要求
-		isCodeEmpty() {
-			return this.invitationCode.trim().length < 6
-		},
-		hasError() {
-			return this.loginMessage.length > 0
-		}
 	},
 	methods: {
 		...mapMutations(['login', 'wxLogin']),
-		getUserProfile() {
-			const _that = this
-			// 可以通过 wx.getSetting 先查询一下用户是否授权了 "scope.record" 这个 scope
-			return new Promise((resolve, reject) => {
-				wx.getUserProfile({
-					desc: '用于完善会员资料',
-					success(res) {
-						// 更新用户信息
-						_that.wxLogin(res.userInfo)
-						uni.setStorageSync('profileFlag', true)
-						resolve(res.userInfo)
-					},
-					fail() {
-						_that.$util.msg('授权失败', 2000)
-					}
-				})
-			})
-		},
 		// 登录
-		async goLogin() {
-			const _that = this
-			let wechatUserInfo = uni.getStorageSync('wechatUserInfo')
-			let profileFlag = uni.getStorageSync('profileFlag')
-			console.log(profileFlag);
-			if (!profileFlag) {
-				wechatUserInfo = await this.getUserProfile()
+		SubMitLogins() {		
+			const WechatInfo = uni.getStorageSync('wechatUserInfo')
+			if(this.isLoginStatus){return}
+			if(!this.params.mobile){
+				this.$util.msg('请输入手机号',2000);
+				return
+			}
+			if(!this.$reg.isMobile(this.params.mobile)){
+				this.$util.msg('请输入正确的手机号',2000);
+				return
+			}
+			if( this.params.verificationCode == ''){
+				this.$util.msg('请输入短信验证码',2000);
+				return
 			}
-			// 验证邀请码
-			console.log(this.isWxAuthorize)
-			this.UserService.userInvitation({
-				invitationCode: this.invitationCode,
-				nickName: wechatUserInfo.nickName,
-				openid: uni.getStorageSync('openid')
+			if(!uni.getStorageSync('_WX_State')){
+				this.$api.navigateTo(`/pages/authorize/authorize`)
+				return;
+			}
+			this.params.openId = uni.getStorageSync('openId');
+			this.params.nickName = WechatInfo.nickName
+			this.params.headImgUrl = WechatInfo.avatarUrl
+			this.isLoginStatus = true
+			this.UserService.UserMobileLogin(this.params)
+			.then(response => {
+				// 保存用户信息
+				const _data = JSON.parse(response.data);
+				this.login(_data)
+				this.$store.commit('updateStatus',_data)
+				// 登录成功提示
+				this.$util.msg('登录成功', 1500, false, 'success')
+				this.isLoginStatus = false
+				setTimeout(() => {
+					this.$api.switchTabTo(`/pages/tabBar/index/index`)
+				}, 1500)
+			})
+			.catch(error => {
+				this.$util.msg(error.msg,2000)
+				this.isLoginStatus = false
 			})
-				.then(response => {
-					console.log(response)
-					// 保存用户信息
-					_that.login(response.data)
-					_that.$store.commit('updateStatus', response.data)
-					// 登录成功提示
-					_that.$util.msg('登录成功', 1500, false, 'success')
-					setTimeout(() => {
-						_that.$api.navigateTo(`/pages/index/index`)
-					}, 1500)
-				})
-				.catch(error => {
-					_that.loginMessage = error.msg
-					_that.isUserInfo = false
-					setTimeout(() => {
-						_that.loginMessage = ''
-					}, 2000)
-				})
 		},
 		GetMobileCodeFn(){//获取手机验证码
 			if( this.params.mobile == ''){
@@ -132,36 +119,35 @@ export default {
 				this.$util.msg('请输入正确的手机号',2000);
 				return
 			}
-			let params = {
-					mobile:this.params.mobile,
-					platformType:2,
-					isCheckCaptcha:0,
-			}
 			this.isMobileDisabled = true;
-			this.PublicService.GetBindMobileCode(params)
-				.then(res =>{
-					const TIME_COUNT = 60;
-					this.$util.msg('验证短信已发送',2000)
-			     	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( error =>{
-					this.$util.msg(error.msg,2000)
-					this.isMobileDisabled = false;
-				})
+			this.PublicService.GetheHeSend(
+				{
+					mobile:this.params.mobile,
+				}
+			)
+			.then(res =>{
+				const TIME_COUNT = 60;
+				this.$util.msg('验证短信已发送',2000)
+				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( error =>{
+				this.$util.msg(error.msg,2000)
+				this.isMobileDisabled = false;
+			})
 		},
 		handBlurInput(e){
 			console.log(e)
@@ -172,7 +158,11 @@ export default {
 			}
 		}
 	},
-	onShow() {}
+	onShow() {
+		if(uni.getStorageSync('_WX_State')){
+			wxLogin.wxLoginAuthorize()
+		}
+	}
 }
 </script>
 
@@ -214,6 +204,10 @@ export default {
 		border-radius: 45rpx;
 		color: #fff !important;
 		margin-top: 40rpx;
+		&.disabled{
+			background: #E1E1E1;
+			color: #999999;
+		}
 	}
 	.login-input {
 		margin: 10rpx 0;

+ 5 - 14
pages/tabBar/cart/index.vue

@@ -212,15 +212,6 @@
 					this.initGetCartGoodsList();
 				})	
 			},
-			initLogin(){
-				authorize.checkLogin()
-				.then(res => {
-					this.$api.redirectTo('/pages/login/login?type=4')
-				})
-				.catch(err =>{
-					this.$api.navigateTo('/pages/authorization/authorization?type=0')
-				})
-			},
 			clickPopupShow(pros,type){
 				this.popupShow = true;
 				this.handlerPros = pros;
@@ -761,11 +752,11 @@
 			uni.stopPullDownRefresh()
 		},
 		onShow(){
-			// if(this.hasLogin){
-			// 	this.initData()
-			// }else{
-			// 	this.initLogin()
-			// }
+			if(this.hasLogin){
+				this.initData()
+			}else{
+				this.$api.redirectTo('/pages/login/login')
+			}
 		},
 	}
 </script>

+ 71 - 254
pages/tabBar/index/index.vue

@@ -16,7 +16,7 @@
 			</view>
 		</view>
 		<!-- 主页内容 -->
-		<tui-skeleton v-if="skeletonShow" backgroundColor="#fafafa" borderRadius="10rpx" :isLoading	="true" :loadingType="5"></tui-skeleton>
+		<tui-skeleton v-if="skeletonShow" backgroundColor="#fafafa" borderRadius="10rpx" :isLoading	="true" :loadingType="2"></tui-skeleton>
 		<view class="container-home tui-skeleton" :style="{paddingTop:CustomBar+'px'}">
 			<!-- 轮播 -->
 			<banner :list="bannerImageList"></banner>
@@ -25,8 +25,8 @@
 		<view class="container-section tui-skeleton clearfix">
 			<view class="product-list" v-for="(pro,index) in productList" :key="index" @click.stop="Details(pro)">
 				<view class="product-list-image">
-					<image class="product-image" :src="pro.image" mode=""></image>
-					<image class="product-icon" :src="StaticUrl+'icon-hot.png'" mode="" v-if="pro.activistatus == 1"></image>
+					<image class="product-image" :src="pro.mainImage" mode=""></image>
+					<image class="product-icon" :src="StaticUrl+'icon-hot.png'" mode="" v-if="pro.activeStatus == 1"></image>
 				</view>
 				<view class="product-list-msg">
 					<view class="product-msg-name">{{ pro.name }}</view>
@@ -78,212 +78,15 @@
 				screenWidth:this.screenWidth,
 				capsule:this.capsule,
 				platformClass:this.platformClass,
-				userID:0,
+				userId:0,
 				modallayer:false,
-				isLogin:false,
-				skeletonShow: false,
+				skeletonShow: true,
 				userIdentity:'',
-				productList:[
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:1,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:2,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:1,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:2,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:2,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:1,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:2,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:1,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:2,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:1,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:2,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:1,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:2,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:1,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:2,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:1,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:2,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:1,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:2,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:1,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:2,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:1,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:2,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:1,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:2,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:1,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:2,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:1,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:2,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:1,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:2,
-						price:888,
-					},
-					{
-						image:'https://img.caimei365.com/group1/M00/03/E7/Cmis21__-MOABqnlAAJUIFDLc8U188.jpg',
-						name:'小气泡水氧嫩肤仪小气泡水氧嫩肤仪',
-						activistatus:1,
-						price:888,
-					},
-					
-				],//商品列表
-				bannerImageList:[
-					{image:'https://img.caimei365.com/group1/M00/00/0B/rB-lGGBtan-ASLC1AAKrolQyBrM712.jpg'},
-					{image:'https://img.caimei365.com/group1/M00/00/0A/rB-lGGBkNCWAFXZ_AAKFJ77YqsA272.jpg'},
-					{image:'https://img.caimei365.com/group1/M00/00/08/rB-lGGBZuoeAYOYXAAOpsUwvvgg050.jpg'},
-					{image:'https://img.caimei365.com/group1/M00/03/E5/Cmis21_1bFmAeB-wAAOPdEM9o7c219.jpg'},
-				],//轮播
+				productList:[],//商品列表
+				bannerImageList:[],//轮播
+				pageNum:1,
+				pageSize:20,
+				hasNextPage:false,
 				isScrollTop:false,
 				isRequest:false,
 			}
@@ -304,53 +107,73 @@
 			...mapMutations(['login','logout']),
 			async GetWxAuthorize(){
 				const wechatCode = await authorize.getCode('weixin');// 根据微信的code获取用户登录状态:1已登录过 -1未登录过
-				const getUserInfo = await authorize.getUserInfo('weixin');
-				this.UserService.userInfoLogin({ 
-					code:wechatCode,
-					encryptedData:getUserInfo.encryptedData,
-					iv:getUserInfo.iv
-				})
+				this.UserService.UserWechatAuthorLogin(
+					{ 
+						code:wechatCode,
+					}	
+				)
 				.then(response =>{
-					this.isLogin = true;
-					this.userID = response.data.userId;						
-					this.userIdentity = response.data.userIdentity;						
-					this.clubStatus = response.data.clubStatus;						
-					this.$store.commit('updateStatus',response.data)
-					this.login(response.data);
-					uni.setStorageSync('token',response.data.token)
-					uni.setStorageSync('unionId',response.data.unionId)
-					if(response.data.userIdentity ==1){
-						this.$api.redirectTo('/seller/pages/index/index')
-					}else if(response.data.userIdentity === 3){
-						this.$api.redirectTo('/supplier/pages/index/index')
-					}
-					this.GetHomeInformation()
+					const _data = JSON.parse(response.data);
+					uni.setStorageSync('openId',_data.openId)
+					this.userId = _data.userId;						
+					this.userIdentity = _data.userIdentity;						
+					this.$store.commit('updateStatus',_data)
+					this.login(_data);
+					this.GetHomeBnnner()
+					this.GetHomeProductList()
 				})
 				.catch(error =>{
-					this.isLogin = false;
+					const _data = JSON.parse(error.data);
 					this.logout()
-					uni.setStorageSync('unionId',error.data.unionId)
-					this.$store.commit('updateStatus',error.data)
-					this.GetHomeInformation()
+					this.$store.commit('updateStatus',_data)
+					uni.setStorageSync('openId',_data.openId)
+					this.GetHomeBnnner()
+					this.GetHomeProductList()
 				})
 			},		
-			GetHomeInformation(){//初始化首页数据	
-				this.CommonService.GetHomeModulesDataInfo({ userId:this.userID }).then(res =>{
-					let data = res.data;
-					this.bannerImageList = data.bannerImageList
-					this.mallPageModules = data.mallPageModules
-					this.$store.commit('updateAllNum',data.shoppingCartCount)
+			GetHomeBnnner(){//初始化首页数据	
+				this.CommonService.GetProductCarousel().then(response =>{
+					let data = response.data;
+					this.bannerImageList = data
+					// this.$store.commit('updateAllNum',data.shoppingCartCount)
+				}).catch(error =>{
+					this.$util.msg(error.msg,2000)
+				})
+			},
+			GetHomeProductList(){//初始化首页商品数据
+				this.ProductService.QueryProductList({pageNum:this.pageNum,pageSize:this.pageSize}).then(response =>{
+					let data = response.data;
+					this.productList = data.list
+					this.hasNextPage = data.hasNextPage
 					this.skeletonShow = false;
 				}).catch(error =>{
 					this.$util.msg(error.msg,2000)
 				})
 			},
+			GetOnReachBottomProductList(){//上滑加载更多
+				this.pageNum+=1
+				this.ProductService.QueryProductList({pageNum:this.pageNum,pageSize:this.pageSize}).then(response =>{
+					let data = response.data;
+					this.hasNextPage = data.hasNextPage
+					this.productList = this.productList.concat(data.list) 
+				}).catch(error =>{
+					this.$util.msg(error.msg,2000)
+				})
+			},
 			Details(pro){
 				this.$api.navigateTo(`/pages/goods/product?id=${pro.productId}`)
 			},
 			handAddCarts(pro){
-				this.$util.msg('加入成功',1500,true,'success')
-			},
+				if(!this.hasLogin){
+					if(!uni.getStorageSync('_WX_State')){
+						this.$api.navigateTo(`/pages/authorize/authorize?type=1`)
+					}else{
+						this.$api.navigateTo(`/pages/login/login`)
+					}
+				}else{
+					this.$util.msg('加入成功',1500,true,'success')
+				}
+			}, 
 			handleClick(data){
 				this.$api.navigateTo(`/h5/pages/activity/meobohui`)
 				this.$store.commit('setActivity',data)
@@ -362,20 +185,8 @@
 				uni.setStorageSync('lockTime',Date.now())
 				uni.setStorageSync('isActivityStatus',true)	
 			},
-			async InitAuthorize(){ //是否已授权 0:为取消授权 1:为已授权 2:为未操作
-				authorize.checkLogin()
-				.then(res => {
-					console.log(res);
-					this.GetWxAuthorize()
-				})
-				.catch(err => {
-					this.$api.getComStorage('userInfo').then((resolve) =>{
-						this.userID = resolve.userId ? resolve.userId :0;
-						// this.getHomeInformation()
-					}).catch(error =>{
-						// this.getHomeInformation()
-					})
-				})
+			InitAuthorize(){ //是否已授权 0:为取消授权 1:为已授权 2:为未操作
+				this.GetWxAuthorize();
 			}
 		},
 		onPageScroll(e){//实时获取到滚动的值
@@ -394,6 +205,12 @@
 			// this.getHomeInformation()
 			uni.stopPullDownRefresh()
 		},
+		onReachBottom() {
+			console.log("用户把这个页面上拉100时触发我的")
+			if(this.hasNextPage){
+				this.GetOnReachBottomProductList()
+			}	
+		},
 		onShareAppMessage(res){//分享转发
 			if (res.from === 'button') {
 		      // 来自页面内转发按钮
@@ -508,7 +325,7 @@
 		}
 	}
 	.container-home{
-		background: url(https://static.caimei365.com/app/mini-hehe/icon/icon-index-bg.png)top center no-repeat;
+		background:#F7F7F7 url(https://static.caimei365.com/app/mini-hehe/icon/icon-index-bg.png)top center no-repeat;
 		background-size: contain;
 		min-height: 485rpx;
 	}

+ 33 - 96
pages/tabBar/user/index.vue

@@ -5,9 +5,12 @@
 			<view class="ws-header">
 				<!-- 用户信息 -->
 				<view class="user-info">
-					<image class="user_default" :src="StaticUrl+'icon-default-avatar.png'" mode="widthFix"></image>
+					<image class="user_default" v-if="!hasLogin && isRequest" :src="StaticUrl+'icon-default-avatar.png'" mode="widthFix"></image>
+					<image class="user_default" v-else :src="UserInfo.headImgUrl" mode="widthFix"></image>
 					<view class="user-login" v-if="!hasLogin && isRequest" @click="navigator('/pages/login/login')">登录</view>
-					<view class="user-text" v-else> {{ organizeName }} </view>
+					<view class="user-text" v-else> 
+						{{ UserInfo.userIdentity == 1 ? UserInfo.nickName : UserInfo.name }} 
+					</view>
 				</view>
 				<!-- 背景图 -->
 				<image class="user-bg" :src="StaticUrl+'icon-user-bg@2x.png'" mode="widthFix"></image>
@@ -31,7 +34,7 @@
 					>
 						<image :src="StaticUrl+'icon-order-1@2x.png'" mode="widthFix"></image>
 						<text>待付款</text>
-						<view class="tui-badge tui-badge-box" v-if="paymentCount > 0">
+						<view class="tui-badge tui-badge-box" v-if="hasLogin && paymentCount > 0">
 							<tui-badge :scaleRatio="0.8" type="danger">{{
 								paymentCount | countNum
 							}}</tui-badge>
@@ -43,7 +46,7 @@
 					>
 						<image :src="StaticUrl+'icon-order-2@2x.png'" mode="widthFix"></image>
 						<text>待发货</text>
-						<view class="tui-badge tui-badge-box" v-if="waitShipmentsCount > 0">
+						<view class="tui-badge tui-badge-box" v-if="hasLogin && waitShipmentsCount > 0">
 							<tui-badge :scaleRatio="0.8" type="danger">{{
 								waitShipmentsCount | countNum
 							}}</tui-badge>
@@ -55,7 +58,7 @@
 					>
 						<image :src="StaticUrl+'icon-order-3@2x.png'" mode="widthFix"></image>
 						<text>已发货</text>
-						<view class="tui-badge tui-badge-box" v-if="shipmentsCount > 0">
+						<view class="tui-badge tui-badge-box" v-if="hasLogin && shipmentsCount > 0">
 							<tui-badge :scaleRatio="0.8" type="danger">{{
 								shipmentsCount | countNum
 							}}</tui-badge>
@@ -67,7 +70,7 @@
 					>
 						<image :src="StaticUrl+'icon-order-4@2x.png'" mode="widthFix"></image>
 						<text>退货/款</text>
-						<view class="tui-badge tui-badge-box" v-if="salesReturnCount > 0">
+						<view class="tui-badge tui-badge-box" v-if="hasLogin && salesReturnCount > 0">
 							<tui-badge :scaleRatio="0.8" type="danger">{{
 								salesReturnCount | countNum
 							}}</tui-badge>
@@ -78,7 +81,7 @@
 			<!-- 订单状态区域END -->
 			<!-- 菜单导航区域 -->
 			<view class="place-menu-conten clearfix">
-				<view class="place-menu-cell"  @click="navigator('/pages/user/activity/activity-list')">
+				<view class="place-menu-cell"  @click="navigator('/pages/user/activity/activity-list')" v-if="userIdentity == 2">
 					<view class="place-left">
 						<image class="place-menu-icon" :src="StaticUrl+'icon-user-h@2x.png'" mode=""></image>
 						<text class="place-menu-title">活动专区</text>
@@ -114,7 +117,7 @@
 import nutBadge from '@/components/thorui/tui-badge/tui-badge.vue'
 import { mapState, mapMutations } from 'vuex'
 import authorize from '@/common/config/authorize.js'
-import wxLogin from '@/common/config/wxLogin.js'
+import wxLogin from '@/services/wxLogin.js'
 
 export default {
 	components: {
@@ -124,15 +127,12 @@ export default {
 		return {
 			StaticUrl:this.$Static,
 			CustomBar: this.CustomBar, // 顶部导航栏高度
-			organizeName: '', //采购员组织名称
+			UserInfo: {}, //用户信息
 			isRequest: true,
 			paymentCount: 1, //待付款角标
 			waitShipmentsCount: 20, //待收货角标
 			shipmentsCount: 123, //已发货角标
 			salesReturnCount: 0, //退货/款角标
-			organizeId: '',
-			refresh: false,
-			userIdentity:1
 		}
 	},
 	onLoad() {
@@ -156,74 +156,23 @@ export default {
 	},
 	methods: {
 		...mapMutations(['login', 'logout']),
-		GetUserProfile() {
-			const _that = this
-			// 可以通过 wx.getSetting 先查询一下用户是否授权了 "scope.record" 这个 scope
-			return new Promise((resolve, reject) => {
-				wx.getUserProfile({
-					desc: '用于完善会员资料',
-					success(res) {
-						// 更新用户信息
-						_that.wxLogin(res.userInfo)
-						uni.setStorageSync('profileFlag', true)
-						resolve(res.userInfo)
-					},
-					fail() {
-						_that.$util.msg('授权失败', 2000)
-					}
-				})
-			})
-		},
-		// 登录
-		async goLogin() {
-			const _that = this
-			let wechatUserInfo = uni.getStorageSync('wechatUserInfo')
-			let profileFlag = uni.getStorageSync('profileFlag')
-			console.log(profileFlag);
-			if (!profileFlag) {
-				wechatUserInfo = await this.GetUserProfile()
-			}
-			this.$api.navigateTo(`/pages/login/login`)
-		},
-		// 授权登录验证
-		async GetWxAuthorize() {
-			// 获取微信code
-			const wechatCode = await authorize.getCode('weixin')
-			this.UserService.userInfoLogin({
-				code: wechatCode
-			})
-				.then(res => {
-					// 登录成功  将信息保存在userInfo中 保存在本地和store
-					this.login(res.data)
-					this.organizeId = res.data.organizeId
-					this.getUserInfoPersonal(this.organizeId)
-					this.refresh = true
-					this.isRequest = true
-					uni.stopPullDownRefresh()
-				})
-				.catch(err => {
-					// 缓存游客openid
-					uni.setStorageSync('openid', err.data.openid)
-					this.logout()
-					this.refresh = true
-					this.isRequest = true
-					uni.stopPullDownRefresh()
-				})
+		GetUserInfo(){
+			this.UserInfo = uni.getStorageSync('userInfo')
 		},
 		//初始化个人中心数据
 		getUserInfoPersonal(organizeId) {
 			this.UserService.userInfoPersonal({ organizeId: organizeId })
-				.then(response => {
-					console.log(response)
-					this.organizeName = response.data.organizeName //采购员组织名称
-					this.paymentCount = response.data.paymentCount //待付款
-					this.waitShipmentsCount = response.data.waitShipmentsCount //待收货
-					this.shipmentsCount = response.data.shipmentsCount //已发货
-					this.salesReturnCount = response.data.salesReturnCount //退货/款
-				})
-				.catch(error => {
-					this.$util.msg(error.msg, 2000)
-				})
+			.then(response => {
+				console.log(response)
+				this.organizeName = response.data.organizeName //采购员组织名称
+				this.paymentCount = response.data.paymentCount //待付款
+				this.waitShipmentsCount = response.data.waitShipmentsCount //待收货
+				this.shipmentsCount = response.data.shipmentsCount //已发货
+				this.salesReturnCount = response.data.salesReturnCount //退货/款
+			})
+			.catch(error => {
+				this.$util.msg(error.msg, 2000)
+			})
 		},
 		// 客服
 		handleContact(e) {
@@ -232,31 +181,19 @@ export default {
 		},
 		// 栏目跳转
 		navigator(url) {
-			authorize.checkLogin()
-			.then(res => {
+			if(!uni.getStorageSync('_WX_State')){
+				this.$api.navigateTo('/pages/authorize/authorize')
+			}else{
 				if(this.hasLogin){
 					this.$api.navigateTo(url)
 				}else{
-					this.$api.navigateTo('/pages/login/login?type=0')
+					this.$api.navigateTo('/pages/login/login')
 				}
-			})
-			.catch(err => {
-				this.$api.navigateTo('/pages/authorize/authorize')
-			})
-		},
-
-		onShareAppMessage(res) {
-			//分享转发
-			this.isShareModal = false
-			if (res.from === 'button') {
-				// 来自页面内转发按钮
 			}
-			return {
-				title: '维沙采购商城上线啦,快来采购吧~',
-				path: `/pages/index/index`,
-				imageUrl: 'https://static.caimei365.com/app/wisa/img/icon/icon-index.png'
-			}
-		}
+		},
+	},
+	onShow() {
+		this.GetUserInfo()
 	}
 }
 </script>

+ 83 - 87
pages/user/address/address.vue

@@ -74,20 +74,13 @@
 
 <script>
 import authorize from '@/common/config/authorize.js'
-import { addressList } from '@/common/json/data.json.js' //本地数据
-
-
 export default {
 	data() {
 		return {
 			StaticUrl:this.$Static,
 			isSelect: false,
 			isEmpty: false,
-			isLoadMore: false,
-			userId: '',
-			pageNum: 1,
-			pageSize: 10,
-			addressList: addressList,
+			addressList:[],
 			hasNextPage: false,
 			allowDataStatus: true,
 			wrapperHeight: '100%',
@@ -96,28 +89,19 @@ export default {
 			prevPage: '', //上一个页面
 			modal: false,
 			contentModalText: '',
-			deleteaddressId: 0
+			deleteaddressId: 0,
+			listQuery:{
+				userId: '',
+				pageNum: 1,
+				pageSize: 10,
+			}
 		}
 	},
 	onLoad(option) {
 		if (option.type == 'select') {
 			this.isSelect = true
 		}
-		console.log(option && option)
 		this.setScrollHeight()
-		console.log(this.addressList)
-		// this.initAddressList()
-	},
-	onShow() {
-		this.pageNum = 1
-		// this.addressList = []
-		// this.initAddressList()
-	}
-	,
-	onReachBottom() {
-		if (this.isLoadMore) {
-			this.initAddressList()
-		}
 	},
 	methods: {
 		setScrollHeight() {
@@ -134,37 +118,38 @@ export default {
 				})
 			}, 500)
 		},
-		// 初始化地址列表
-		initAddressList() {
-			this.$api.getComStorage('clubInfo').then(resolve => {
-				// this.userId = resolve.userId
-				// 设置默认地址 测试使用
-				this.userId = resolve.userId
-				let params = { pageNum: this.pageNum, pageSize: this.pageSize, userId: this.userId }
-				this.UserService.QueryAddressList(params)
-					.then(response => {
-						if (response.data.list == '') {
-							this.isEmpty = true
-						} else {
-							this.isEmpty = false
-							let results = []
-							results = response.data.list
-							this.addressList = this.addressList.concat(results)
-							this.pageNum = response.data.pageNum + 1
-							if (response.data.hasNextPage) {
-								this.isLoadMore = false
-							} else {
-								this.isLoadMore = true
-							}
-						}
-					})
-					.catch(error => {
-						this.$util.msg(error.msg, 2000)
-					})
+		GetAddressList() {// 初始化地址列表
+			this.$api.getComStorage('userInfo').then(resolve => {
+				this.listQuery.userId = resolve.userId ? resolve.userId : 0;
+				this.UserService.QueryAddressList(this.listQuery)
+				.then(response => {
+					const data = response.data
+					if (data.list && data.list.length > 0) {
+						this.isEmpty = false
+						this.addressList = data.list
+						this.hasNextPage = data.hasNextPage
+					} else {
+						this.isEmpty = true
+					}
+				})
+				.catch(error => {
+					this.$util.msg(error.msg, 2000)
+				})
+			})
+		},
+		GetOnReachBottomAddressList(){//上滑加载
+			this.listQuery.pageNum += 1
+			this.UserService.QueryAddressList(this.listQuery)
+			.then(response => {
+				const data = response.data
+				this.hasNextPage = data.hasNextPage
+				this.addressList = this.addressList.concat(data.list)
+			})
+			.catch(error => {
+				this.$util.msg(error.msg, 2000)
 			})
 		},
-		//选择地址
-		checkAddress(item) {
+		checkAddress(item) {//选择地址
 			//是否需要返回地址(从订单确认页跳过来选收货地址)
 			if (!this.isSelect) {
 				return
@@ -185,26 +170,21 @@ export default {
 			//用户操作订单
 			let index = e.index
 			if (index == 1) {
-				this.UserService.DeleteNewAddress({
-					addressId: this.deleteaddressId,
-					userId: this.userId
+				this.UserService.DeleteOtherAddress(
+					{
+						addressId: this.deleteaddressId,
+						userId: this.listQuery.userId
+					}
+				)
+				.then(response => {
+					this.$util.msg('删除成功', 2000, true, 'success')
+					setTimeout(() => {
+						this.GetAddressList()
+					}, 2000)
+				})
+				.catch(error => {
+					this.$util.msg(error.msg, 2000)
 				})
-					.then(response => {
-						this.$util.msg('删除成功', 2000, true, 'success')
-						setTimeout(() => {
-							this.pageNum = 1
-							this.addressList = []
-							this.initAddressList()
-						}, 2000)
-					})
-					.catch(error => {
-						this.$util.msg(error.msg, 2000)
-						setTimeout(function() {
-							uni.switchTab({
-								url: '/seller/pages/home/home'
-							})
-						}, 1000)
-					})
 			}
 			this.modal = false
 		},
@@ -219,24 +199,40 @@ export default {
 		},
 		// 修改默认地址
 		setDefaultAddress(id) {
-			this.UserService.DefaultAddress({
-				addressId: id,
-				userId: this.userId
+			this.UserService.SetDefaultOtherAddress(
+				{
+					addressId: id,
+					userId: this.listQuery.userId
+				}
+			)
+			.then(res => {
+				this.$util.msg('设置成功', 1000, true, 'success')
+				setTimeout(() => {
+					this.GetAddressList()
+				}, 1000)
+			})
+			.catch(err => {
+				this.GetAddressList()
 			})
-				.then(res => {
-					if (res.code === 0) {
-						this.pageNum = 1
-						this.addressList = []
-						this.initAddressList()
-					}
-				})
-				.catch(err => {
-					this.pageNum = 1
-					this.addressList = []
-					this.initAddressList()
-				})
 		}
-	}
+	},
+	onPullDownRefresh() {
+		//下拉刷新
+		this.listQuery.pageNum = 1
+		this.GetAddressList()
+		uni.stopPullDownRefresh()
+	},
+	onReachBottom() {
+		console.log("用户把这个页面上拉100时触发我的")
+		if (this.hasNextPage) {
+			this.GetOnReachBottomAddressList()
+		}
+	},
+	onShow() {
+		this.pageNum = 1
+		this.addressList = []
+		this.GetAddressList()
+	},
 }
 </script>
 

+ 19 - 20
pages/user/address/addressManage.vue

@@ -164,7 +164,6 @@ export default {
 			if (this.addType == 1) {
 				this.params = {
 					// 测试id
-					// userId:'13914',
 					userId: this.addressData.userId, //用户id ,只在新增收货地址时传
 					shouHuoRen: this.addressData.shouHuoRen, //收货人
 					townId: this.addressData.townId, //区ID
@@ -178,25 +177,25 @@ export default {
 				this.postAddressData(this.params)
 			}
 		},
-		postAddressData(res) {
+		postAddressData(params) {
 			this.btnText(true)
 			// 保存地址
-			this.UserService.AddNewAddress(res)
-				.then(response => {
-					this.$util.msg('保存成功', 2000, true, 'success')
-					this.btnText(false)
-					setTimeout(() => {
-						uni.navigateBack()
-					}, 2000)
-				})
-				.catch(error => {
-					this.$util.msg(error.msg, 2000)
-					setTimeout(function() {
-						uni.switchTab({
-							url: '/seller/pages/index/index'
-						})
-					}, 1000)
-				})
+			this.UserService.AddOtherSaveAddress(params)
+			.then(response => {
+				this.$util.msg('保存成功', 2000, true, 'success')
+				this.btnText(false)
+				setTimeout(() => {
+					uni.navigateBack()
+				}, 2000)
+			})
+			.catch(error => {
+				this.$util.msg(error.msg, 2000)
+				setTimeout(function() {
+					uni.switchTab({
+						url: '/seller/pages/index/index'
+					})
+				}, 1000)
+			})
 		},
 		btnText(flg) {
 			if (flg) {
@@ -233,8 +232,8 @@ export default {
 		}
 	},
 	onShow() {
-		this.$api.getComStorage('clubInfo').then(resolve => {
-			this.addressData.userId = resolve.userId
+		this.$api.getComStorage('userInfo').then(resolve => {
+			this.addressData.userId = resolve.userId ? resolve.userId : 0
 		})
 	}
 }

+ 0 - 15
services/ajax.env.js

@@ -1,15 +0,0 @@
-let URL_CONFIG = ''
-if(process.env.NODE_ENV === 'development'){
-    // 开发环境
-	// URL_CONFIG = 'http://192.168.2.68:8008'	 //涛涛联调地址
-	// URL_CONFIG = 'http://192.168.2.67:8008'	 //裴裴联调地址
-	// URL_CONFIG = 'http://192.168.2.81:8008'
-	// URL_CONFIG = 'http://192.168.2.75:8008'	 //超超联调地址
-    URL_CONFIG = 'https://spi-b.caimei365.com'	 //采美测试地址
-	// URL_CONFIG = 'https://spi.caimei365.com'
-}else{
-    // 生产环境
-	// URL_CONFIG = 'https://spi-b.caimei365.com'
-    URL_CONFIG = 'https://spi.caimei365.com'
-}
-export default URL_CONFIG

+ 4 - 13
services/ajax.service.js

@@ -1,8 +1,7 @@
 /**
  * ajax请求相关的服务
  */
-import spiServiceUrl from './ajax.env'
-import corServiceUrl from './config.env'
+import ServiceUrl from './config.env'
 import { msg } from '@/utils/util'
 
 class AjaxService {
@@ -10,15 +9,12 @@ class AjaxService {
 		this.name = 'AjaxService'
 	}
 	getBaseUrl (url = '') {
-		return url.indexOf('://') > -1 ? url : url
+		return url.indexOf('://') > -1 ? url : ServiceUrl + url
 	}
 	getHeaders({ header = {} }) {
-		const REV_TOKEN_ENV = uni.getStorageSync('token') ? uni.getStorageSync('token') : 'X-token';
-		const REV_COOKIE_ENV = uni.getStorageSync('sessionid') ? uni.getStorageSync('sessionid') : 'sessionid';
 		header['Accept'] = 'application/json'
-		header['Content-Type'] = 'application/x-www-form-urlencoded'
-		header['X-Token'] = REV_TOKEN_ENV
-		header['cookie'] = REV_COOKIE_ENV
+		// header['Content-Type'] = 'application/x-www-form-urlencoded'
+		header['Content-Type'] = 'application/json'
 		return header
 	}
 	request(options = {}) {
@@ -27,11 +23,6 @@ class AjaxService {
 		if (options.header) {
 			header = Object.assign(header, options.header)
 		}
-		if(options.isHost){
-			url = corServiceUrl + url
-		}else{
-			url = spiServiceUrl + url
-		}
 		let { isLoading = true } = options
 		if (isLoading) {
 			wx.showLoading({ title: '加载中' })

+ 14 - 63
services/common.service.js

@@ -6,69 +6,20 @@ export default class CommonService {
 		Object.assign(this, { AjaxService })
 		this.name = 'CommonService'
 	}
-	/* 首页导航模块商品列表 */
-	GetHomeClassify (data = {}) {
-		return this.AjaxService.get({ url:'/home/classify', data, isLoading: true })
-	}
-	/* 首页初始化 */
+	/* 商城首页轮播图 */
+	GetProductCarousel (data = {}) {
+		return this.AjaxService.get({ 
+			url:'/product/carousel', 
+			data, 
+			isLoading: false ,
+		})
+	}
+	/* 商城首页初始化数据查询 */
 	GetHomeModulesDataInfo (data = {}) {
-		return this.AjaxService.get({ url:'/home/modules', data, isLoading: false })
-	}
-	/* 首页楼层数据 */
-	GetHomeDataInfo (data = {}) {
-		return this.AjaxService.get({ url:'/home/data', data, isLoading: false })
-	}
-	/* 首页楼层查看更多数据 */
-	GetHomeFloorContentDetails (data = {}) {
-		return this.AjaxService.get({ url:'/home/floorContentDetails', data, isLoading: false })
-	}
-	/* 二级页楼层查看更多数据 */
-	GePageFloorContentDetails (data = {}) {
-		return this.AjaxService.get({ url:'/home/pageFloorDetails', data, isLoading: false })
-	}
-	/* 首页顶部三个模块数据 */
-	GetHomeTopDataInfo (data = {}) {
-		return this.AjaxService.get({ url:'/home/top/data', data, isLoading: false })
-	}
-	/* 获取其他服务信息 */
-	QueryAfterSale (data = {}) {
-		return this.AjaxService.get({ url:'/home/afterSale', data, isLoading: false })
-	}
-	/* 首页金刚区分类 */
-	GetHomeInit (data = {}) {
-		return this.AjaxService.get({ url:'/home/init', data, isLoading: false })
-	}
-	/* 首页金刚区二级分类 */
-	GetHomeSubMenu (data = {}) {
-		return this.AjaxService.get({ url:'/home/subMenu', data, isLoading: false })
-	}
-	/* 首页楼层 */
-	GetHomeFloorInfo (data = {}) {
-		return this.AjaxService.get({ url:'/home/floor', data, isLoading: false })
-	}
-	/* 直播专题页图片 */
-	GetHomeLiveAdvertising (data = {}) {
-		return this.AjaxService.get({ url:'/home/live/advertising', data, isLoading: false })
-	}
-	/* 搜索热门关键词 */
-	GetHomeHotSearchTerms (data = {}) {
-		return this.AjaxService.get({ url:'/home/hotSearchTerms', data, isLoading: false })
-	}
-	/* 二级列表楼层 */
-	GetInstrumentPageData (data = {}) {
-		return this.AjaxService.get({ url:'/home/instrumentData', data, isLoading: false })
-	}
-	/* 一级分类 */
-	GetFirstClassly (data = {}) {
-		return this.AjaxService.get({ url:'/product/classify', data, isLoading: false })
-	}
-	/* 根据一级分类获取二、三级分类 */
-	GetProductChildrenClassly (data = {}) {
-		return this.AjaxService.get({ url:'/product/bigType/classify', data, isLoading: false })
-	}
-	/* 根据一、二、三级分类ID查询单条分类 */
-	GetProductOneClassly (data = {}) {
-		return this.AjaxService.get({ url:'/product/typeId/classify', data, isLoading: false })
+		return this.AjaxService.get({ 
+			url:'/home/modules', 
+			data, 
+			isLoading: false ,
+		})
 	}
-	
 }

+ 1 - 70
services/order.service.js

@@ -70,28 +70,6 @@ export default class OrderService {
 			isLoading: true ,
 		})
 	}
-	/**
-	 *获取订单分享码
-	 * @param orderID
-	 */
-	QueryOrderShareCode (data = {}) {
-		return this.AjaxService.get({ 
-			url:'/order/share', 
-			data, 
-			isLoading: false ,
-		})
-	}
-	/**
-	 *获取订单分享码
-	 * @param orderID
-	 */
-	OrderShareCode (data = {}) {
-		return this.AjaxService.get({ 
-			url:'/order/shareCode', 
-			data, isLoading: true,
-			isStatus: true ,
-		})
-	}
 	/**
 	 *机构搜索订单
 	 *@param searchWord 关键词
@@ -118,7 +96,7 @@ export default class OrderService {
 		})
 	}
 	/**
-	 *清订单历史记录
+	 *清订单历史记录
 	 *@param organizeId 用户ID
 	 */
 	ClearOrderHistory (data = {}) {
@@ -128,15 +106,6 @@ export default class OrderService {
 			isLoading: true ,
 		})
 	}
-	/**
-	 *@机构-确认订单初始化数据
-	 *@param userId 用户ID
-	 *@param count	商品数量
-	 *@param productIds 商品IDs
-	 */
-	CreateOrderInfo (data = {}) {
-		return this.AjaxService.get({ url:'/order/confirm', data, isLoading: true })
-	}
 	/**
 	 *@确认订单-获取邮费信息
 	 *@param productIds 商品ID【”,”分割】
@@ -151,28 +120,6 @@ export default class OrderService {
 			isLoading: false ,
 		})
 	}
-	/**
-	 *@确认订单-获取发票信息
-	 *@param userId		用户ID
-	 */
-	GetFindInvoice (data = {}) {
-		return this.AjaxService.get({ 
-			url:'/other/findInvoice', 
-			data, 
-			isLoading: false ,
-		})
-	}
-	/**
-	 *@确认订单-保存发票信息
-	 *@param userId		用户ID
-	 */
-	UpdateInvoice (data = {}) {
-		return this.AjaxService.post({ 
-			url:'/other/invoice', 
-			data, 
-			isLoading: true ,
-		})
-	}
 	/* 提交订单 orderId 订单ID */
 	CreatedOrderSubmit (data = {}) {
 		return this.AjaxService.post({ 
@@ -181,20 +128,4 @@ export default class OrderService {
 			isLoading: true ,
 		})
 	}
-	/* 订单支付,效验付款规则 orderId 订单ID */
-	OrderPaymentValidation (data = {}) {
-		return this.AjaxService.get({ url:'/order/paymentValidation', data, isLoading: false })
-	}
-	/* 余额抵扣 orderId 订单ID */
-	OrderBalanceDeduction (data = {}) {
-		return this.AjaxService.post({ url:'/order/balanceDeduction', data, isLoading: false })
-	}
-	/* 分享订单初始化查询 orderId 订单ID */
-	OrderCommodityData (data = {}) {
-		return this.AjaxService.get({ url:'/order/commodityData', data, isLoading: true })
-	}
-	/*二手订单 打款供应商 */
-	confirmpayment (data = {}) {
-		return this.AjaxService.post({ url:'/order/affirm/payment', data, isLoading: true })
-	}
 }

+ 0 - 28
services/pay.service.js

@@ -6,22 +6,6 @@ export default class PayService {
 		Object.assign(this, { AjaxService })
 		this.name = 'PayService'
 	}
-	/* 小程序支付-查询线上支付开关状态 */
-	PayOrderOnLineSwitch (data = {}) {
-		return this.AjaxService.get({ 
-			url:'/PayOrder/onLineSwitch', 
-			data, 
-			isLoading: false ,
-		})
-	}
-	/* 小程序支付-初始化收银台 */
-	PayOrderCheckoutCounter (data = {}) {
-		return this.AjaxService.get({ 
-			url:'/PayOrder/checkoutCounter', 
-			data, 
-			isLoading: true ,
-		})
-	}
 	/**
 	 *小程序支付-微信支付
 	 *@param  amount支付金额,单位分,必须大于2
@@ -37,16 +21,4 @@ export default class PayService {
 			isLoading: true ,
 		})
 	}
-	/**
-	 *生成支付链接
-	 *@param  unpaidAmount 本次待付款金额
-	 *@param  orderId  主订单ID
-	 */
-	PayOrderPayLink (data = {}) {
-		return this.AjaxService.post({ 
-			url:'/PayOrder/payLink', 
-			data, isLoading: 
-			true 
-		})
-	}
 }

+ 35 - 111
services/product.service.js

@@ -7,70 +7,30 @@ export default class ProductService {
 		this.name = 'ProductService'
 	}
 	/**
-	 * @商城首页-常用商品列表
-	 * @param:userId 用户ID(未登录传0或者''),
-	 * @param:preferredFlag 新品上线(001) 优惠商品(010) 常用商品(100),,
+	 * @查询搜索商品列表
+	 * @param:name 商品名称关键词
 	 * @param:pageNum 页码
-	 * @param:pageSize 每页条数
+	 * @param:pageSize 条数
 	 */
-	queryProductPreferred (data = {}) {
-		return this.AjaxService.get({ url:'/product/preferred', data, isLoading: false })
-	}
-	/**
-	 * @分类-商品列表
-	 * @param:userId 用户ID(未登录传0或者''),
-	 * @param:bigTypeID 
-	 * @param:smallTypeID, 
-	 * @param:tinyTypeID 
-	 * @param:sortType 
-	 * @param:pageNum 页码
-	 * @param:pageSize 每页条数
-	 */
-	GetProductListByTypeID(data = {}) {
-		return this.AjaxService.get({ url:'/product/listByTypeID', data, isLoading: false })
-	}
-	/**
-	 * @商品列表-查询商品价格
-	 * @param:userId 用户ID(未登录传0或者'')
-	 * @param:productID 商品ID','符号拼接
-	 */
-	querySearchProductPrice (data = {}) {
-		return this.AjaxService.get({ url:'/product/listPrice', data, isLoading: false })
-	}
-	
-	/**
-	 * @查询凑单商品页初始化
-	 * @param:promotionsId 促销ID
-	 */
-	queryProductPromotionInfo (data = {}) {
-		return this.AjaxService.get({ url:'/product/promotion/info', data, isLoading: false })
-	}
-	/**
-	 * @查询凑单商品列表
-	 * @param:promotionsId 促销ID
-	 * @param:pageSize 查询条数
-	 * @param:pageNum 查询页数
-	 */
-	queryProductPromotionList (data = {}) {
-		return this.AjaxService.get({ url:'/product/promotion/products', data, isLoading: true })
+	QueryProductList (data = {}) {
+		return this.AjaxService.get({ 
+			url:'/product/list', 
+			data, 
+			isLoading: false ,
+		})
 	}
-	
 	/**
 	 * @商品详情-查询商品详情
 	 * @param:userId 用户ID(未登录传0或者'')
 	 * @param:productIds 商品ID
 	 */
-	queryProductDetils (data = {}) {
-		return this.AjaxService.get({ url:'/product/details', data, isLoading: false })
-	}
-	/**
-	 * @商品详情-相关推荐
-	 * @param:productIds 商品ID
-	 */
-	queryProductDetilsRelevant (data = {}) {
-		return this.AjaxService.get({ url:'/product/details', data, isLoading: false })
+	QueryProductDetils (data = {}) {
+		return this.AjaxService.get({ 
+			url:'/product/details', 
+			data, 
+			isLoading: false ,
+		})
 	}
-	
 	/**
 	 * @加入购物车
 	 * @param:userId 用户ID(必填)
@@ -120,72 +80,36 @@ export default class ProductService {
 			isLoading: true 
 		})
 	}
-	/* 二级列表 */
-	GetPageTopic (data = {}) {
-		return this.AjaxService.get({ url:'/page/topic', data, isLoading: false })
-	}
-	/* 二级列表banner */
-	GetPageTopicBanner (data = {}) {
-		return this.AjaxService.get({ url:'/page/topic/info', data, isLoading: false })
-	}
-	/* 活动专题列表 */
-	GetPromotionsrList (data = {}) {
-		return this.AjaxService.get({ url:'/promotions/list', data, isLoading: true })
-	}
-	/* 搜索项目仪器列表 */
-	GetSearchEquipmentList (data = {}) {
-		return this.AjaxService.get({ url:'/search/query/equipment', data, isLoading: true })
-	}
-	/* 项目仪器详情 */
-	GetEquipmentDetails (data = {}) {
-		return this.AjaxService.get({ url:'/equipment/recommend', data, isLoading: true })
-	}
 	/* 查询搜索历史记录 */
 	GetProductSearchHistory (data = {}) {
-		return this.AjaxService.get({ url:'/product/searchHistory', data, isLoading: false })
+		return this.AjaxService.get({ 
+			url:'/product/searchHistory', 
+			data, 
+			isLoading: false ,
+		})
 	}
 	/* 添加搜索历史记录 */
 	GetAddProductSearchHistory (data = {}) {
-		return this.AjaxService.get({ url:'/product/history/add', data, isLoading: true })
+		return this.AjaxService.get({ 
+			url:'/product/history/add', 
+			data, 
+			isLoading: true ,
+		})
 	}
 	/* 清除搜索历史记录 */
 	GetDeleteProductSearchHistory (data = {}) {
-		return this.AjaxService.get({ url:'/product/searchHistory/delete', data, isLoading: false })
+		return this.AjaxService.get({ 
+			url:'/product/searchHistory/delete', 
+			data, 
+			isLoading: false ,
+		})
 	}
 	/* 搜索商品列表 */
 	GetProductSearchList (data = {}) {
-		return this.AjaxService.get({ url:'/search/query/product', data, isLoading: true })
-	}
-	/* 搜索分类商品列表 */
-	GetSearchProductTypeData (data = {}) {
-		return this.AjaxService.get({ url:'/search/query/product/type', data, isLoading: true })
-	}
-	/* 获取商品评价 */
-	GetProductEvaluate (data = {}) {
-		return this.AjaxService.get({ url:'/product/evaluate', data, isLoading: false })
-	}
-	/* 获取再次购买商品列表 */
-	GetRepeatBuyAgainProductList (data = {}) {
-		return this.AjaxService.get({ url:'/repeat/buyAgain', data, isLoading: true })
-	}
-	/* 新商品搜索查询商品阶梯价格 */
-	GetSearchProductLadderPrice (data = {}) {
-		return this.AjaxService.get({ url:'/product/ladderPrice', data, isLoading: false })
-	}
-	/* 获取分类导航 */
-	GetProductClassify (data = {}) {
-		return this.AjaxService.get({ url:'/product/classify', data, isLoading: true })
-	}
-	/* 获取小程序三个模块商品列表 */
-	GetProductPreferred (data = {}) {
-		return this.AjaxService.get({ url:'/product/preferred', data, isLoading: true })
-	}
-	/* 发票信息回显 */
-	GetPersonalCenterFindInvoice (data = {}) {
-		return this.AjaxService.get({ url:'/personalCenter/findInvoice', data, isLoading: false })
-	}
-	/* 发票信息保存 */
-	GetPersonalCenterInvoice (data = {}) {
-		return this.AjaxService.post({ url:'/personalCenter/invoice', data, isLoading: true })
+		return this.AjaxService.get({ 
+			url:'/search/query/product', 
+			data, 
+			isLoading: true ,
+		})
 	}
 }

+ 1 - 1
services/public.js

@@ -4,7 +4,7 @@
  *@date 2020/03/19 14:56:57
  *@param registerByPass
  */
-import requestUrl from '@/services/ajax.env.js'
+import requestUrl from '@/services/config.env.js'
 import request from '@/common/config/utilsTools.js'
 import $reg from '@/common/config/common.js'
 

+ 12 - 1
services/public.service.js

@@ -11,7 +11,18 @@ export default class PublicService {
 	 */
 	GetAllAddressData (data = {}) {
 		return this.AjaxService.get({ 
-			url:'/club/address', 
+			url:'/other/list', 
+			data, 
+			isLoading: false ,
+		})
+	}
+	/**
+	 * 发送手机验证码
+	 * mobile 手机号
+	 */
+	GetheHeSend (data = {}) {
+		return this.AjaxService.get({ 
+			url:'/user/he/send', 
 			data, 
 			isLoading: true ,
 		})

+ 0 - 36
services/upload.service.js

@@ -1,36 +0,0 @@
-/**
- *上传图片
- */
-import requestUrl from './config.env.js'
-
-export function uploadFileImage(url) {
-	return new Promise(function(resolve,reject) {
-		uni.chooseImage({
-			count: 1, //默认1
-			sizeType: ['original','compressed'], //可以指定是原图还是压缩图,默认二者都有
-			sourceType: ['album'], //从相册选择
-			success: (res) => {
-				const tempFilePaths = res.tempFilePaths;
-				console.log(tempFilePaths)
-				const uploadTask = uni.uploadFile({
-					url : requestUrl+url,
-					filePath: tempFilePaths[0],
-					name: 'file',
-					header: {
-					    "Content-Type": "multipart/form-data",
-					},
-					formData: {
-						'user': 'test'
-					},
-					success: function (res) {
-						console.log(res)
-						resolve(res);
-					},
-					error : function(e){
-						reject(res)
-					}
-				})
-			}
-		});
-	});
-}

+ 10 - 20
services/user.service.js

@@ -9,29 +9,19 @@ export default class UserService {
 		this.name = 'UserService'
 	}
 	/* 初始化授权登录 */
-	userInfoLogin(data = {}) {
-		return this.AjaxService.post({
-			url: '/user/login/auth/applets',
+	UserWechatAuthorLogin(data = {}) {
+		return this.AjaxService.get({
+			url: '/user/he/authorization',
 			data,
 			isLoading: false,
 			isStatus: false,
 			isHost:true
 		})
 	}
-	/* 初始化个人中心数据 */
-	userInfoPersonal(data = {}) {
-		return this.AjaxService.get({
-			url: '/buyer/personal',
-			data,
-			isLoading: false,
-			isStatus: false
-		})
-	}
-
-	/*维沙邀请码绑定*/
-	userInvitation(data = {}) {
+	/* 手机号验证码登录 */
+	UserMobileLogin(data = {}) {
 		return this.AjaxService.post({
-			url: '/buyer/invitation/code',
+			url: '/user/he/mobile/login',
 			data,
 			isLoading: false,
 			isStatus: false
@@ -45,7 +35,7 @@ export default class UserService {
 	 */
 	QueryAddressList(data = {}) {
 		return this.AjaxService.get({
-			url: '/personalCenter/findAddress',
+			url: '/other/findAddress',
 			data,
 			isLoading: true
 		})
@@ -53,7 +43,7 @@ export default class UserService {
 	/**
 	 * @添加&&修改地址
 	 */
-	AddNewAddress(data = {}) {
+	AddOtherSaveAddress(data = {}) {
 		return this.AjaxService.post({
 			url: '/other/saveAddress',
 			data,
@@ -64,7 +54,7 @@ export default class UserService {
 	 * @删除地址
 	 * @param:addressId 地址ID,,
 	 */
-	DeleteNewAddress(data = {}) {
+	DeleteOtherAddress(data = {}) {
 		return this.AjaxService.get({
 			url: '/other/deleteAddress',
 			data,
@@ -76,7 +66,7 @@ export default class UserService {
 	 * @param:userId 用户ID(必传),
 	 * @param:addressId 地址ID,
 	 */
-	DefaultAddress(data = {}) {
+	SetDefaultOtherAddress(data = {}) {
 		return this.AjaxService.get({
 			url: '/other/defaultAddress',
 			data,

+ 56 - 0
services/wxLogin.js

@@ -0,0 +1,56 @@
+import store from '@/store/index.js'
+import authorize from '@/common/config/authorize.js'
+import ajaxService from '@/services/ajax.service.js'
+import UserService from '@/services/user.service'
+
+const newUserService = new UserService(ajaxService)
+
+// 根据微信的code获取用户登录状态:1已登录过 -1未登录过
+const wxLoginAuthorize = async function(){
+	const wechatCode = await authorize.getCode('weixin');// 根据微信的code获取用户登录状态:1已登录过 -1未登录过
+	newUserService.UserWechatAuthorLogin(
+		{ 
+			code:wechatCode
+		}
+	)
+	.then(response =>{
+		const _data = JSON.parse(response.data);
+		store.commit('updateStatus',_data)
+		store.commit('login',_data);
+		uni.setStorageSync('openId',_data.openId)
+		uni.switchTab({url:'/pages/tabBar/index/index'})
+	})
+	.catch(error =>{
+		const _data = JSON.parse(error.data);
+		uni.setStorageSync('openId',_data.openId)
+		store.commit('logout',_data)
+		store.commit('updateStatus',_data)
+	})
+}
+const wxLoginQuick = async function(){// 根据微信的code获取用户登录状态:1已登录过 -1未登录过跳转
+		const wechatCode = await authorize.getCode('weixin');// 根据微信的code获取用户登录状态:1已登录过 -1未登录过
+		const getUserInfo = await authorize.getUserInfo('weixin');
+		const params = 
+		newUserService.UserWechatAuthorLogin(
+			{ 
+				code:wechatCode
+			}
+		)
+		.then(response =>{
+			const _data = JSON.parse(response.data);
+			store.commit('updateStatus',_data)
+			store.commit('login',_data);
+			uni.setStorageSync('openId',_data.openId)
+			uni.switchTab({url:'/pages/tabBar/index/index'})
+		})
+		.catch(error =>{
+			const _data = JSON.parse(response.data);
+			uni.setStorageSync('openId',_data.openId)
+			store.commit('logout',_data)
+			store.commit('updateStatus',_data)
+		})
+}
+export default{
+	wxLoginAuthorize,
+	wxLoginQuick
+}

+ 2 - 12
store/index.js

@@ -9,7 +9,6 @@ const store = new Vuex.Store({
 		isWxAuthorize: false, //是否授权
 		hasLogin: false,
 		userInfo: {}, //登录用户信息
-		identity: 0,   
 		wechatUserInfo: {}, //用户微信相关信息
 		cartNumber: 0,
 		isIphoneX: false,
@@ -41,7 +40,8 @@ const store = new Vuex.Store({
 			state.isWxAuthorize = true
 			// console.log(state.isWxAuthorize)
 			state.wechatUserInfo = provider
-			uni.setStorage({ //缓存用户登陆状态 
+			uni.setStorageSync('_WX_State',true)
+			uni.setStorage({ //缓存用户微信授权信息
 				key: 'wechatUserInfo',
 				data: provider
 			})
@@ -50,16 +50,6 @@ const store = new Vuex.Store({
 			let TIME = api.formatDate()
 			console.log(`${TIME}`, provider)
 			state.userInfo = provider
-			if (state.userInfo) {
-				if (provider.userIdentity) {
-					state.identity = provider.userIdentity
-				} else if (provider.userID == 5261 || provider.userID == 10947 || provider.userID == 11579) {
-					state.identity = 1
-				} else {
-					state.identity = 0
-				}
-			}
-			console.log('用户类型', state.identity)
 			uni.setStorage({ //缓存用户登陆状态
 				key: 'userInfo',
 				data: provider