Ver código fonte

太多了,不知道写啥

hmp 4 anos atrás
pai
commit
ee6b5ca2b0

+ 17 - 0
App.vue

@@ -1,10 +1,14 @@
 <script>
+	import Global from './assets/http/global.js'
 	export default {
 		onLaunch: function() {
 			//获取审核状态
+			this.$u.vuex('vuex_agenter_type',0)
 			this.$u.vuex('vuex_audit',0)
 			//更新版本
 			this.updateApp()
+			//获取token
+			this.getToken()
 		},
 		methods:{
 			updateApp(){
@@ -29,6 +33,19 @@
 				updateManager.onUpdateFailed(function (res) {
 				  // 新的版本下载失败
 				});
+			},
+			async getToken(){
+				let token = uni.getStorageSync('token')
+				let [, res] = await uni.request({
+					url: Global.tokenUrl,
+					method: 'POST',
+					header: {
+						Authorization: "Basic c2FiZXI6c2FiZXJfc2VjcmV0"
+					},
+				})
+				//否则保存新的token
+				token = res.data.token_type + " " + res.data.access_token
+				uni.setStorageSync('token', token)
 			}
 		}
 	}

+ 4 - 1
assets/colorui/app.css

@@ -1,6 +1,9 @@
 .btn-color{
 	color: #FF9447;
 }
+.theme-color{
+	color: #FF9447;
+}
 
 .hoverClass{
 	opacity: 0.9;
@@ -28,7 +31,7 @@
 }
 
 .bg-gradual-base {
-	background-image: linear-gradient(45deg, #F67A53, #dc311c);
+	background-image: linear-gradient(to right, #FFC368, #FF8327);
 	color: #ffffff;
 }
 

+ 70 - 10
assets/http/api.js

@@ -1,5 +1,13 @@
 import {http} from './service.js'
 
+//微信api
+const wxApp={
+	getOpenId:p => http.get('/wx-app/getOpenId', {params:p}),
+	getOpenData:p => http.post('/wx-app/getOpenData',p),
+}
+
+//字典
+const dict=p => http.get('/blade-system/dict-biz/dictionary', {params:p})
 
 //文件上传
 let uploadFileUrl='/upload/putfile'
@@ -7,19 +15,71 @@ const uploadFile={
 	submit:p => http.upload(uploadFileUrl, {name:'file',filePath:p}),
 }
 
-//园区api
-let agencyUrl={
-	page:'/agency/agency/getAgencyList',
-	submit:'/agency/agency/submit'
+//活动管理
+const activity = {
+	list:p => http.get('yyzs/cyzh-activity/activity/selectPageWithTag', {params:p,custom: {yyzs: true}}),
+}
+
+//用户管理
+const loginUser={
+	detail:p => http.get('cyzh-ldt/loginuser/detail', {params:p}),
+	submit:p => http.post('cyzh-ldt/loginuser/submit', p),
+	login:p => http.post('cyzh-ldt/loginuser/login', p),
+}
+
+//商户管理
+const shop={
+	list:p => http.get('cyzh-ldt/shop/list', {params:p}),
 }
-const agency = {
-	page:p => http.get(agencyUrl.page, {params:p}),
-	submit:p => http.post(agencyUrl.submit, p),
+
+//商场管理
+const mall={
+	//获取商场列表
+	list:p => http.get('cyzh-ldt/mall/list',{params:p}),
 }
-const test=	(p) => http.get("cyzh_userGoods/usergoods/page", {params:p})
+
+//代理商
+const agenter={
+	list:p => http.get('cyzh-ldt/agenter/list',{params:p}),
+	submit:p => http.post('cyzh-ldt/agenter/submit', p),
+}
+
+//代理类型
+const agenterType={
+	detail:p => http.get('cyzh-ldt/agentertype/detail',{params:p}),
+}
+
+
+//用户银行
+const userBank={
+	detail:p => http.get('cyzh-ldt/userbank/detail',{params:p}),
+	list:p => http.get('cyzh-ldt/userbank/list',{params:p}),
+	appList:p => http.get('cyzh-ldt/userbank/appList',{params:p}),
+	submit:p => http.post('cyzh-ldt/userbank/submit', p),
+	remove:p => http.post('cyzh-ldt/userbank/remove?ids='+p),
+}
+
+//支付
+const pay={
+	payOrder:p => http.get('payment/payOrder/YEE_PAY/SCAN_CODE',{params:p}),
+}
+
+const billRecord={
+	submit:p => http.post('cyzh-ldt/billrecord/submit', p),
+}
+
 
 export const api={
-	test,
+	wxApp,
+	dict,
 	uploadFile,
-	agency
+	activity,
+	loginUser,
+	shop,
+	mall,
+	agenter,
+	agenterType,
+	userBank,
+	pay,
+	billRecord
 }

+ 71 - 65
assets/http/service.js

@@ -1,83 +1,89 @@
 import Request from 'luch-request'
+import Global from "./global.js"
 
-let	baseURL = 'http://localhost:80/'
+let baseURL = Global.baseUrl
 
-let tokenUrl=baseURL+"blade-auth/oauth/token?tenantId=804981&password=ea3c40c0df5477c525543b0e85548004&username=wpadmin"
+let tokenUrl = Global.tokenUrl
 
 //获取token
 const getTokenStorage = () => {
-  let token = ''
-  try {
-    token = uni.getStorageSync('token')
-  } catch (e) {
-  }
-  return token
+	let token = ''
+	try {
+		token = uni.getStorageSync('token')
+	} catch (e) {}
+	return token
 }
 const http = new Request()
-http.setConfig((config) => { /* 设置全局配置 */
-  config.baseURL = baseURL  /* 根域名不同 */
-  config.header = {
-    ...config.header,
-  }
-  return config
+http.setConfig((config) => {
+	/* 设置全局配置 */
+	config.baseURL = baseURL /* 根域名不同 */
+	config.header = {
+		...config.header,
+	}
+	return config
 })
-http.interceptors.request.use((config) => { /* 请求之前拦截器。可以使用async await 做异步操作 */
-  config.header = {
-    ...config.header,
-    "Blade-Auth": getTokenStorage()
-  }
-  return config
+http.interceptors.request.use((config) => {
+	/* 请求之前拦截器。可以使用async await 做异步操作 */
+	config.header = {
+		...config.header,
+		"Blade-Auth": getTokenStorage()
+	}
+	return config
 }, (config) => {
-  return Promise.reject(config)
+	return Promise.reject(config)
 })
 // 是否正在刷新的标记
 let isRefreshing = false
 // 重试队列,每一项将是一个待执行的函数形式
 let requests = []
-http.interceptors.response.use(async (response) => { /* 请求之后拦截器。可以使用async await 做异步操作  */
+http.interceptors.response.use(async (response) => {
+	/* 请求之后拦截器。可以使用async await 做异步操作  */
 	//toekn过期处理 
-      if (response.data.code == 401) {
-          let {config} = response
-          if (!isRefreshing) {
-              isRefreshing = true
-              let token = uni.getStorageSync('token')
-              let [,res] = await uni.request({
-                  url: tokenUrl,
-                  method: 'POST',
-                  header:{
-                  	Authorization:"Basic c2FiZXI6c2FiZXJfc2VjcmV0"
-                  },
-              })
-              //否则保存新的token
-              token=res.data.token_type+" "+res.data.access_token
-              uni.setStorageSync('token', token)
-              requests.forEach(cb => cb())
-              // 重试完了清空这个队列
-              requests = []
-              isRefreshing = false
-              return http.request(config)
-          } else {
-              return new Promise((resolve) => {
-                  // 将resolve放进队列,用一个函数形式来保存,等token刷新后直接执行
-                  requests.push(() => {
-                      resolve(http.request(config))
-                  })
-              })
-          }
-      }
-	  //200 返回数据成功 0
-      if (response.data.code != 200) {
-        return Promise.reject(response)
-      }
-      return response.data
-  }, (err) => { // 请求错误做点什么
-      uni.showToast({
-          icon: 'none',
-          position: 'bottom',
-          title: '网络异常'
-      })
-      return Promise.reject(err)
-  })
+
+	//200 返回数据成功 0
+	if (response.data.code != 200) {
+		return Promise.reject(response)
+	}
+	return response.data
+}, async (err) => { // 请求错误做点什么
+	if (err.data.code == 401) {
+		let {
+			config
+		} = err
+		if (!isRefreshing) {
+			isRefreshing = true
+			let token = uni.getStorageSync('token')
+			let [, res] = await uni.request({
+				url: tokenUrl,
+				method: 'POST',
+				header: {
+					Authorization: "Basic c2FiZXI6c2FiZXJfc2VjcmV0"
+				},
+			})
+			//否则保存新的token
+			token = res.data.token_type + " " + res.data.access_token
+			uni.setStorageSync('token', token)
+			requests.forEach(cb => cb())
+			// 重试完了清空这个队列
+			requests = []
+			isRefreshing = false
+			return http.request(config)
+		} else {
+			return new Promise((resolve) => {
+				// 将resolve放进队列,用一个函数形式来保存,等token刷新后直接执行
+				requests.push(() => {
+					resolve(http.request(config))
+				})
+			})
+		}
+	}
+	uni.showToast({
+		icon: 'none',
+		position: 'bottom',
+		title: '网络异常'
+	})
+	return Promise.reject(err)
+})
 export {
-  http
+	http
 }

+ 102 - 31
components/login.vue

@@ -1,32 +1,50 @@
 <template >
-	<view @touchmove.stop.prevent="clear" v-show="dialogShow">
-		<view class="popup_mask" @touchmove.stop.prevent="clear"></view>
-		<view class="">
-			<view class="dt-login-wrap">
-			  <view class="title">请先登录</view>
-			  <view class="content">
-			  	<view class="userinfo-avatar">
-				   <open-data  type="userAvatarUrl"></open-data>
-			  	</view>
-				<open-data type="userNickName"></open-data>
-				<text class="subtitle">申请获取您的公开信息(昵称,头像)</text>
-			  </view>
-			  <view class="btn-content setBtnCss">
-			  	<button  @click="hide" >暂不登录</button>
-				<button open-type="getUserInfo" @getuserinfo="getuserinfo" >立即登录</button>
-			  </view>
+	<view class="">
+		<!-- 获取手机号 -->
+		<u-modal v-model="phoneShow" content="请授权获取手机号">
+			<button class="cu-btn btn-bg-color round" style="width: 80%;"  slot="confirm-button" open-type="getPhoneNumber" @getphonenumber="getphonenumber" >
+				去授权
+			</button>
+		</u-modal>
+		
+		<!-- 获取头像昵称 -->
+		<view @touchmove.stop.prevent="clear" v-show="dialogShow">
+			<view class="popup_mask" @touchmove.stop.prevent="clear"></view>
+			<view class="">
+				<view class="dt-login-wrap">
+				  <view class="title">请先登录</view>
+				  <view class="content">
+				  	<view class="userinfo-avatar">
+					   <open-data  type="userAvatarUrl"></open-data>
+				  	</view>
+					<open-data type="userNickName"></open-data>
+					<text class="subtitle">申请获取您的公开信息(昵称,头像)</text>
+				  </view>
+				  <view class="btn-content setBtnCss">
+				  	<button  @click="hide" >暂不登录</button>
+					<button open-type="getUserInfo" @getuserinfo="getuserinfo" >立即登录</button>
+				  </view>
+				</view>
 			</view>
 		</view>
 	</view>
+	
 </template>
 <script>
 export default {
 	data() {
 		return {
+			//保存时间七天
+			cacheTime:1*24*60*60*7,
 			dialogShow: false,
 			jscode:'',
 			//邀请码
 			inviteCode:'',
+			userInfo:'',
+			sessionKey:'',
+			
+			//获取手机号
+			phoneShow:false
 		};
 	},
 	beforeDestroy() {
@@ -51,6 +69,7 @@ export default {
 		    this.timer = null
 		  }
 		  this.dialogShow=false;
+		  this.$emit('hide')
 		},
 		async setTimer(){
 		   let respWx = await this.$mpi.wxLogin()
@@ -61,29 +80,47 @@ export default {
 		   },240000) 
 		},
 		async getuserinfo(e) {
+			console.log("获取用户信息",e);
 			if(e.detail.errMsg != 'getUserInfo:ok') {
 			  return
 			}
+			this.userInfo=e.detail.userInfo
 			this.dialogShow=false
 			  try{
-				// this.respLogin = await this.$api.loginByCode({
-				// 	code:this.jscode
-				// })
-				//通过openid查询数据库中该用户是否存在,存在就直接将openid放进缓存中
-				//不存在就将用户基本信息存进数据库中,头像,昵称,openid
-				this.$emit('signIn', resp)
-				console.log(e.detail.userInfo.avatarUrl);
-				console.log(e.detail.userInfo.nickName);
-				return
-				//将openid,sessionKey,和邀请码存进数据库中
-				let resp = await this.$api.loginByWxapp({
-				  openId: this.respLogin.openId,
-				  inviteCode: this.inviteCode
+				this.respLogin = await this.$api.wxApp.getOpenId({
+					code:this.jscode
 				})
-				if (resp) {
+				let openId=this.respLogin.data.openid
+				let unionid=this.respLogin.data.unionid || ''
+				this.sessionKey=this.respLogin.data.session_key
+				//通过openid查询数据库中该用户是否存在
+				
+				let params={
+					nickName:this.userInfo.nickName,
+					avatar:this.userInfo.avatarUrl,
+					gender:this.userInfo.gender,
+					unionid,
+					openid:openId,
+					province:this.userInfo.province,
+					city:this.userInfo.city
+				}
+				//将openid
+				let resp = await this.$api.loginUser.login(params)
+				if (resp.success) {
+					this.$u.toast('登录成功')
 					//登录成功
+					let obj={
+						openId,
+						sessionKey:this.sessionKey,
+						userId:resp.data.id,
+						phone:resp.data.phone
+					}
 					//将openid和sessionkey存进缓存中,有效时间为七天
-					that.$cache.put("openId",this.respLogin.openId,1*24*60*60*7)
+					this.$cache.put("userInfo",obj)
+					this.$u.vuex('vuex_userId',resp.data.id)
+					if(resp.data.phone){
+					  this.$u.vuex('vuex_phone',resp.data.phone)
+					}
 					//移除邀请码
 					this.$cache.remove('inviteCode')
 					this.dialogShow=false
@@ -110,7 +147,41 @@ export default {
 		},
 		clear(){
 			return
+		},
+		//获取手机号
+		showPhoneModal(){
+			this.phoneShow=true
+		},
+		getphonenumber(e){
+			this.$emit('getphonenumber')
+			let params={
+				sessionKey:this.sessionKey,
+				encryptedData:e.detail.encryptedData,
+				iv:e.detail.iv
+			}
+			this.$api.wxApp.getOpenData(params).then(res=>{
+				if (res.success) {
+					let obj=JSON.parse(res.data)
+					let phone=obj.phoneNumber
+					this.cachePhone(phone)
+				}
+			})
+		},
+		cachePhone(phone){
+			let userInfo=this.$cache.get('userInfo')
+			let params={
+				id:userInfo.userId,
+				phone
+			}
+			this.$api.loginUser.submit(params).then(res=>{
+				if (res.success) {
+					userInfo.phone=phone
+					this.$cache.put('userInfo',userInfo)
+					this.$u.vuex('vuex_phone',phone)
+				}
+			})
 		}
+		
 	}
 };
 </script>

+ 4 - 4
main.js

@@ -29,10 +29,6 @@ Vue.prototype.$dateTime = dateTime
 import dialog from 'utils/dialog.js'
 Vue.prototype.$dialog = dialog
 
-//全局变量
-import Global from './utils/global'
-Vue.prototype.$global = Global
-
 //数字处理
 import digital from './utils/digital.js'
 Vue.prototype.$digital = digital
@@ -53,6 +49,10 @@ Vue.prototype.$util = util
 import verify from 'utils/verify.js'
 Vue.prototype.$verify = verify
 
+//全局变量
+import global from './assets/http/global.js'
+Vue.prototype.$global = global
+
 
 
 //跳转

+ 6 - 1
manifest.json

@@ -54,7 +54,12 @@
         "setting" : {
             "urlCheck" : false
         },
-        "usingComponents" : true
+        "usingComponents" : true,
+        "permission" : {
+            "scope.userLocation" : {
+                "desc" : "您的位置信息将用于获取附近优惠"
+            }
+        }
     },
     "mp-alipay" : {
         "usingComponents" : true

+ 158 - 85
pages.json

@@ -3,6 +3,14 @@
 		"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
 	},
 	"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
+		{
+			"path": "pages/gain/gain",
+			"style": {
+				"navigationBarTitleText": "赚积分",
+				"enablePullDownRefresh": false
+			}
+
+		},
 		{
 			"path": "pages/mine/mine",
 			"style": {
@@ -13,120 +21,185 @@
 		{
 			"path": "pages/consume/consume",
 			"style": {
+				"navigationStyle": "custom",
 				"navigationBarTitleText": "花积分"
 			}
 		}, {
-			"path": "pages/gain/gain",
+			"path": "pages/mine/card/card",
 			"style": {
-				"navigationBarTitleText": "赚积分",
+				"navigationBarTitleText": "卡包",
 				"enablePullDownRefresh": false
 			}
 
-		}
-	    ,{
-            "path" : "pages/mine/card/card",
-            "style" :                                                                                    
-            {
-                "navigationBarTitleText": "卡包",
-                "enablePullDownRefresh": false
-            }
-            
-        }
-        ,{
-            "path" : "pages/mine/card/pay-setting",
-            "style" :                                                                                    
-            {
-                "navigationBarTitleText": "支付设置",
-                "enablePullDownRefresh": false
-            }
-            
-        }
-        ,{
-            "path" : "pages/mine/my-points/my-points",
-            "style" :                                                                                    
-            {
-                "navigationBarTitleText": "积分资产",
-                "enablePullDownRefresh": false
-            }
-            
-        }
-        ,{
-            "path" : "pages/mine/my-points/accredit",
-            "style" :                                                                                    
-            {
+		}, {
+			"path": "pages/mine/card/pay-setting",
+			"style": {
+				"navigationBarTitleText": "支付设置",
+				"enablePullDownRefresh": false
+			}
+
+		}, {
+			"path": "pages/mine/my-points/my-points",
+			"style": {
+				"navigationBarTitleText": "积分资产",
+				"enablePullDownRefresh": false
+			}
+
+		}, {
+			"path": "pages/mine/my-points/accredit",
+			"style": {
 				"navigationBarTextStyle": "white",
 				"navigationBarBackgroundColor": "#FF9447",
-                "navigationBarTitleText": "积分授权",
-                "enablePullDownRefresh": false
-            }
-            
-        }
-        ,{
-            "path" : "pages/mine/my-balance/my-balance",
+				"navigationBarTitleText": "积分授权",
+				"enablePullDownRefresh": false
+			}
+
+		}, {
+			"path": "pages/mine/my-balance/my-balance",
+			"style": {
+				"navigationBarTitleText": "余额",
+				"enablePullDownRefresh": false
+			}
+
+		}, {
+			"path": "pages/mine/bill-detail",
+			"style": {
+				"navigationBarTitleText": "账单详情",
+				"enablePullDownRefresh": false
+			}
+
+		}, {
+			"path": "pages/mine/my-points/exchange",
+			"style": {
+				"navigationBarTitleText": "积分通兑",
+				"enablePullDownRefresh": false
+			}
+
+		}, {
+			"path": "pages/checkstand/index",
+			"style": {
+				"navigationBarTitleText": "收银台",
+				"enablePullDownRefresh": false
+			}
+
+		}, {
+			"path": "pages/checkstand/order-res",
+			"style": {
+				"navigationBarTitleText": "支付结果",
+				"enablePullDownRefresh": false
+			}
+
+		}, {
+			"path": "pages/checkstand/pay-qrcode",
+			"style": {
+				"navigationBarTitleText": "付款码",
+				"backgroundColor": "#007AFF",
+				"enablePullDownRefresh": false
+			}
+		}, {
+			"path": "pages/search/search",
+			"style": {
+				"navigationBarTitleText": "搜索",
+				"enablePullDownRefresh": false
+			}
+
+		}, {
+			"path": "pages/agent/agent",
+			"style": {
+				"navigationBarTitleText": "填写资料"
+			}
+
+		}, {
+			"path": "pages/agent/pay",
+			"style": {
+				"navigationBarTitleText": "支付页面"
+			}
+
+		}, {
+			"path": "pages/agent/promote",
+			"style": {
+				"navigationBarTitleText": "去推广"
+			}
+
+		}, {
+			"path": "pages/agent/myPromote",
+			"style": {
+				"navigationBarTitleText": "我的推广"
+			}
+
+		}, {
+			"path": "pages/agent/myIncome/myIncome",
+			"style": {
+				"navigationBarTitleText": "我的收益"
+			}
+
+		}, {
+			"path": "pages/agent/myIncome/todayIncome",
+			"style": {
+				"navigationBarTitleText": "今日收益"
+			}
+
+		}, {
+			"path": "pages/agent/myIncome/detail",
+			"style": {
+				"navigationBarTitleText": "收益详情"
+			}
+
+		}, {
+			"path": "pages/agent/agentDetail",
+			"style": {
+				"navigationStyle": "custom",
+				"navigationBarTitleText": ""
+			}
+
+		}, {
+			"path": "pages/webview/webview",
+			"style": {
+				"navigationBarTitleText": "",
+				"enablePullDownRefresh": false
+			}
+
+		}
+	    ,{
+            "path" : "pages/userBank/userBank",
             "style" :                                                                                    
             {
-                "navigationBarTitleText": "余额",
+                "navigationBarTitleText": "银行",
                 "enablePullDownRefresh": false
             }
             
         }
         ,{
-            "path" : "pages/mine/bill-detail",
+            "path" : "pages/userBank/add",
             "style" :                                                                                    
             {
-                "navigationBarTitleText": "账单详情",
+                "navigationBarTitleText": "添加银行",
                 "enablePullDownRefresh": false
             }
             
         }
         ,{
-            "path" : "pages/mine/my-points/exchange",
+            "path" : "pages/mine/myInfo",
             "style" :                                                                                    
             {
-                "navigationBarTitleText": "积分通兑",
+                "navigationBarTitleText": "我的资料",
                 "enablePullDownRefresh": false
             }
             
         }
-		,{
-		    "path" : "pages/checkstand/index",
-		    "style" :                                                                                    
-		    {
-		        "navigationBarTitleText": "收银台",
-		        "enablePullDownRefresh": false
-		    }
-		    
-		}
-        ,{
-            "path" : "pages/checkstand/order-res",
-            "style" :                                                                                    
-            {
-                "navigationBarTitleText": "支付结果",
-                "enablePullDownRefresh": false
-            }
-            
-        }
-        ,{
-            "path" : "pages/checkstand/pay-qrcode",
-            "style" :                                                                                    
-            {
-                "navigationBarTitleText": "付款码",
-				"backgroundColor": "#007AFF",
-                "enablePullDownRefresh": false
-            }
-            
-        }
     ],
 	"tabBar": {
 		"color": "#555555",
 		"backgroundColor": "#FFFFFF",
 		"borderStyle": "white",
 		"selectedColor": "#222222",
-		"list": [{
-				"pagePath": "pages/mine/mine",
-				"text": "我的",
-				"selectedIconPath": "static/tarbar/mine1.png",
-				"iconPath": "static/tarbar/mine.png"
+		"list": [
+
+			{
+				"pagePath": "pages/gain/gain",
+				"text": "赚积分",
+				"selectedIconPath": "static/tarbar/gain-points1.png",
+				"iconPath": "static/tarbar/gain-points.png"
 			},
 			{
 				"pagePath": "pages/consume/consume",
@@ -135,17 +208,17 @@
 				"iconPath": "static/tarbar/consume-points.png"
 			},
 			{
-				"pagePath": "pages/gain/gain",
-				"text": "赚积分",
-				"selectedIconPath": "static/tarbar/gain-points1.png",
-				"iconPath": "static/tarbar/gain-points.png"
+				"pagePath": "pages/mine/mine",
+				"text": "我的",
+				"selectedIconPath": "static/tarbar/mine1.png",
+				"iconPath": "static/tarbar/mine.png"
 			}
 		]
 	},
 	"globalStyle": {
 		"navigationBarTextStyle": "black",
 		"navigationBarTitleText": "国信数字",
-		"navigationBarBackgroundColor": "#F8F8F8",
-		"backgroundColor": "#F8F8F8"
+		"navigationBarBackgroundColor": "#fff",
+		"backgroundColor": "#fff"
 	}
 }

+ 1 - 1
pages/checkstand/index.vue

@@ -14,7 +14,7 @@
 		},
 		data() {
 			return {
-				logo: "/static/bank/zhaoshang.png",
+				logo: "/static/bank/CMBCHINA.png",
 				buyer: "中国招商银行",
 				orderAmount: 0,
 				inputStyle: {

+ 82 - 4
pages/consume/consume.vue

@@ -1,22 +1,100 @@
 <template>
 	<view>
-		花积分
+		<u-navbar :is-back="false" title=" " >
+			<view class="margin-left-20 text-cut-1" style="width: 100%;z-index: 99;" @click="chooseLocation()">
+				<view v-if="$isEmpty(location)" @click.stop="$u.toast('暂无位置信息')">
+					<u-icon name="map-fill" color="#000" size="34"></u-icon>
+					<text class="padding-left-sm " style="font-size: 34rpx;">暂无位置信息</text>
+				</view>
+				<view class="" v-else>
+					<u-icon name="map-fill" color="#000" size="34"></u-icon>
+					<text class="padding-left-sm " style="font-size: 34rpx;">{{location}}</text>
+				</view>
+			</view>
+		</u-navbar>
+		<tabsSwiper @currentChange="currentChange" ref="tabsSwiper" activeColor="#efc232">
+			<view slot="swiper1">
+				<card1 :list="shopList"></card1>
+			</view>
+			<view slot="swiper2">
+				<card2 :list="mallList"></card2>
+			</view>
+		</tabsSwiper>
 	</view>
 </template>
 
 <script>
+	import card2 from "./comps/card2.vue"
+	import card1 from "./comps/card1.vue"
+	import tabsSwiper from './comps/tabsSwiper.vue'
 	export default {
+		components: {
+			tabsSwiper,
+			card1,
+			card2
+		},
 		data() {
 			return {
+				background: {
+					background: '#FF9549'
+				},
+				location: '珠江新城',
 				
+				//数据列表
+				shopList:[],
+				mallList:[],
+				//当前taginedx
+				current:0,
 			}
 		},
+		onLoad() {
+			this.fetchList()
+		},
 		methods: {
-			
+			fetchList(){
+				if (this.current==0) {
+					this.fetchShopList()
+				}else if (this.current==1) {
+					this.fetchMallList()
+				}
+			},
+			fetchShopList(){
+				this.$api.shop.list().then(res=>{
+					this.shopList=res.data.records
+					this.$forceUpdate()
+					this.$refs.tabsSwiper.initSwiperHeight('.list0')
+				})
+			},
+			fetchMallList(){
+				this.$api.mall.list().then(res=>{
+					this.mallList=res.data.records
+					this.$forceUpdate()
+					this.$refs.tabsSwiper.initSwiperHeight('.list1')
+				})
+			},
+			currentChange(index){
+				this.current=index
+				this.fetchList()
+			},
+			chooseLocation(){
+				console.log("选择位置");
+				let that=this
+				uni.chooseLocation({
+				    success: function (res) {
+						console.log(res);
+						that.location=res.name
+				    },
+					fail: (err) => {
+						console.log(err);
+					}
+				});
+			},
 		}
 	}
 </script>
 
-<style>
-
+<style lang="scss" scoped>
+	page {
+		background-color: #f6f6f6;
+	}
 </style>

+ 66 - 6
pages/gain/gain.vue

@@ -1,22 +1,82 @@
 <template>
-	<view>
+	<view class="page">
+		<u-sticky>
+			<u-tabs active-color="#EF9944" :list="list" :is-scroll="false" :current="current" @change="change"></u-tabs>
+		</u-sticky>
+		<card1 v-if="current==0"></card1>
+		<card2 @login="showLogin" v-else></card2>
 		
+		<login ref="login" @signIn="signIn"></login>
 	</view>
 </template>
-
 <script>
+	import card1 from "./comps/card1.vue"
+	import card2 from "./comps/card2.vue"
+	import login from "@/components/login.vue"
 	export default {
+		components:{
+			card1,card2,login
+		},
 		data() {
 			return {
-				
+				list: [{
+					name: '参与活动'
+				}, {
+					name: '代理推广'
+				}],
+				current: 0
 			}
 		},
-		methods: {
+		onLoad(options) {
+			this.current=options.current || 0
+		},
+		mounted() {
+			
+		},
+		methods:{
+			showLogin(){
+				this.$refs.login.show()
+			},
+			showPhoneModal(){
+				this.$refs.login.showPhoneModal()
+			},
+			signIn(resp){
+				this.judgeAgenterType()
+				if (!this.vuex_phone) {
+					this.showPhoneModal()
+				}
+			},
+			change(e){
+				this.current=e
+				if (this.current==1 && this.$isEmpty(this.vuex_userId)) {
+					this.showLogin()
+					return
+				}
+				if (this.current==1 && this.$isEmpty(this.vuex_phone)) {
+					this.showPhoneModal()
+				}
+			},
+			judgeAgenterType(){
+				let params={
+					userId:this.vuex_userId,
+					enabled:1
+				}
+				this.$api.agenter.list(params).then(res=>{
+					if (!this.$isEmpty(res.data.records)) {
+						let item=res.data.records[0]
+						let type=this.$isEmpty(item.agenterTypeId)?1:2
+						this.$u.vuex('vuex_agenter_type',type)
+					}
+				})
+			}
 			
 		}
 	}
 </script>
 
-<style>
-
+<style lang="scss" scoped>
+	.page{
+		background-color: #f6f6f6;
+		min-height: 100vh;
+	}
 </style>

+ 1 - 1
pages/mine/bill-detail.vue

@@ -1,7 +1,7 @@
 <template>
 	<view>
 		<view class="top">
-			<image src="@/static/bank/zhongguo.png" mode=""></image>
+			<image src="@/static/icon/zhongguo.png" mode=""></image>
 			<text class="title">中国银行</text>
 
 			<view class="data">

+ 152 - 50
pages/mine/mine.vue

@@ -5,23 +5,46 @@
 		<u-modal title="扫描异常"  confirm-color="#dc9b21"  v-model="scanNotify.scan" :content="scanNotify.scanMessage"></u-modal>
 		
 		<view style="position: relative;">
-			<image src="../../static/img/bg.png" class="bg-img"></image>
-			<image src="../../static/img/bg-yin.png" class="shuiyin" mode=""></image>
+			<image src="@/static/icon/bg.png" class="bg-img"></image>
+			<image src="@/static/icon/bg-yin.png" class="shuiyin" mode=""></image>
 			<view class="card">
-				<view class="info">
-					<image class="avatar" src="https://thirdwx.qlogo.cn/mmopen/vi_32/q6EwR5U6zFp8bYbUWb9HmFc5Q3R88x13Q0ZtOcVK5lO8AmtibQDRcuMA2Y7CmyuMCr6icceM3QibIKN2icAAxSvjpA/132"></image>
-					<view class="nickname">
-						<block style="display: flex;">
-							<text >赖德福|德芙值得信赖</text>
-							<view class="cu-tag bg-tag sm round margin-left-20">
-								代理商
-							</view>
-						</block>
+				<view class="info" v-if="vuex_userId">
+					<view class="flex">
+						<image class="avatar" :src="userInfo.avatar"></image>
+						<view class="nickname">
+							<block style="display: flex;">
+								<text >{{userInfo.nickName}}</text>
+								<view v-if="vuex_agenter_type!=0" class="cu-tag bg-tag sm round margin-left-20">
+									<text v-if="vuex_agenter_type==1">独家代理</text>
+									<text v-if="vuex_agenter_type==2">渠道合伙人</text>、
+								</view>
+							</block>
+						</view>
+					</view>
+					<view class="center padding-right-20">
+						<image style="width: 50rpx;height: 50rpx;" src="../../static/icon/setting.png"></image>
+					</view>
+				</view>
+				
+				<view class="info" v-else>
+					<view class="flex">
+						<image class="avatar" src="/static/icon/avatar.png"></image>
+						<view class="nickname">
+							<block style="display: flex;">
+								<text >用户未登录</text>
+								<view @click="showLogin" class="cu-tag bg-tag sm round margin-left-20">
+									点击登录
+								</view>
+							</block>
+						</view>
+					</view>
+					<view class="center padding-right-20" @click="jump()">
+						<image style="width: 50rpx;height: 50rpx;" src="../../static/icon/setting.png"></image>
 					</view>
 				</view>
 				
 				<view class="cu-list grid col-3 no-border" style="border-radius:20rpx ;">
-					<view class="cu-item" @click="item.name=='扫一扫'? scanCode() :$jump(item.path)" v-for="(item,index) in menuList" :key="index">
+					<view class="cu-item" @click="item.name=='扫一扫'? scanCode() :jump(item.path)" v-for="(item,index) in menuList" :key="index">
 						<view class="grid-icon" >
 							<image  style="width: 66rpx;height: 66rpx;" :src="item.icon"/>
 						</view>
@@ -40,13 +63,13 @@
 			<text class="title">我的账户</text>
 			
 			<view class="menu">
-				<view class="item" @click="$jump('/pages/mine/my-points/my-points')">
-					<text>2000</text>
+				<view class="item" @click="jump('/pages/mine/my-points/my-points')">
+					<text>{{userInfo.point || 0}}</text>
 					我的积分
 				</view>
 				
-				<view class="item" @click="$jump('/pages/mine/my-balance/my-balance')">
-					<text>2000</text>
+				<view class="item" @click="jump('/pages/mine/my-balance/my-balance')">
+					<text>{{userInfo.pointValue || 0}}</text>
 					余额
 				</view>
 			</view>
@@ -55,7 +78,7 @@
 		<view class="exchange">
 			<view class="top" style="padding: 20rpx 30rpx 10rpx;">
 				<text>积分通兑</text>
-				<text @click="$jump('/pages/mine/my-points/exchange')">更多 ></text>
+				<text @click="jump('/pages/mine/my-points/exchange')">更多 ></text>
 			</view>
 			
 			<view class="menu-list">
@@ -74,7 +97,7 @@
 					</view>
 				</view>
 				<view class="item item3">
-					<image src="@/static/bank/zhongguo.png" mode=""></image>
+					<image src="@/static/icon/zhongguo.png" mode=""></image>
 					<text class="title" style="color: #CF4948;">中国银行</text>
 					<view class="cu-btn round sm">
 						530:100兑入
@@ -83,14 +106,13 @@
 			</view>
 		</view>
 		
-		<view class="consume">
+		<view class="consume" v-if="false">
 			<view class="top" style="padding: 20rpx 30rpx 10rpx;">
 				<text>赚积分</text>
 				<text>更多 ></text>
 			</view>
-			
 			<view class="cu-list grid col-3 no-border" style="border-radius:20rpx ;">
-				<view class="cu-item" @click="$jump(item.path)" v-for="(item,index) in gainList" :key="index">
+				<view class="cu-item" @click="jump(item.path)" v-for="(item,index) in gainList" :key="index">
 					<view class="grid-icon" >
 						<image  style="width: 160rpx;height: 160rpx;border-radius: 16rpx;" :src="item.icon"/>
 					</view>
@@ -100,14 +122,14 @@
 			</view>
 		</view>
 		
-		<view class="consume">
+		<view class="consume" @click="jump('/pages/gain/gain',1)">
 			<view class="top" style="padding: 20rpx 30rpx 10rpx;">
 				<text>花积分</text>
 				<text>更多 ></text>
 			</view>
 			
 			<view class="cu-list grid col-4 no-border" style="border-radius:20rpx ;">
-				<view class="cu-item" @click="$jump(item.path)" v-for="(item,index) in pointsList" :key="index">
+				<view class="cu-item" @click.stop="jump(item.path)" v-for="(item,index) in pointsList" :key="index">
 					<view class="grid-icon" >
 						<image  style="width: 88rpx;height: 88rpx;" :src="item.icon"/>
 					</view>
@@ -117,18 +139,117 @@
 			</view>
 		</view>
 		
-		
+		<login ref="login"  @signIn="signIn"></login>
 	</view>
 </template>
 
 <script>
+	import login from "@/components/login.vue"
 	export default {
-	
+		components:{
+			login
+		},
 		data() {
 			return {
 				scanNotify:{scan: false,scanMessage:'扫描错误,请稍后重试!' },
 				toumindu: 0.00,
-				menuList:[
+				//功能列表
+				menuList:[],
+				gainList:[],
+				pointsList:[],
+				//用户信息
+				userInfo:{}
+			}
+		},
+		onPageScroll(obj){
+			this.toumindu = obj.scrollTop*0.006;
+		},
+		onLoad() {
+			this.fetchStatic()
+			this.login()
+		},
+		methods: {
+			init(){
+				this.fetchUserInfo()
+				this.judgeAgenterType()
+			},
+			judgeAgenterType(){
+				let params={
+					userId:this.vuex_userId,
+					enabled:1
+				}
+				this.$api.agenter.list(params).then(res=>{
+					if (!this.$isEmpty(res.data.records)) {
+						let item=res.data.records[0]
+						let type=this.$isEmpty(item.agenterTypeId)?1:2
+						this.$u.vuex('vuex_agenter_type',type)
+					}
+				})
+			},
+			fetchUserInfo(){
+				let params={
+					id:this.vuex_userId
+				}
+				this.$api.loginUser.detail(params).then(res=>{
+					this.userInfo=res.data
+				})
+			},
+			// 登录 begin
+			showLogin(){
+				this.$refs.login.show()
+			},
+			showPhoneModal(){
+				this.$refs.login.showPhoneModal()
+			},
+			signIn(resp){
+				if (!this.vuex_phone) {
+					this.showPhoneModal()
+				}
+				this.init()
+			},
+			login(e){
+				if (this.$isEmpty(this.vuex_userId)) {
+					this.showLogin()
+					return
+				}
+				this.init()
+				if (this.$isEmpty(this.vuex_phone)) {
+					this.showPhoneModal()
+				}
+			},
+			// 登录 end
+			
+			scanCode(){
+				const _this = this;
+				this.jump('/pages/checkstand/index')
+				// uni.scanCode({
+				//     success: function (res) {
+				// 		_this.jump('/pages/checkstand/index')
+				//     },
+				// 	fail: (res) => {
+				// 		if(res.errMsg!='scanCode:fail cancel'){
+				// 			this.scanNotify = {scan: true,scanMessage: res.errMsg};
+				// 		}
+				// 	}
+				// });
+			},
+			jump(url,type){
+				if (type==1) {
+					uni.switchTab({
+						url
+					})
+					return
+				}
+				if (this.$isEmpty(this.vuex_userId)) {
+					this.login()
+					return
+				}
+				uni.navigateTo({
+					url
+				})
+			},
+			fetchStatic(){
+				this.menuList=[
 					{
 						icon:'/static/icon/scan.png',
 						name:'扫一扫',
@@ -144,8 +265,8 @@
 						name:'卡包',
 						path:'/pages/mine/card/card'
 					}
-				],
-				gainList:[
+				]
+				this.gainList=[
 					{
 						icon:'/static/icon/daili.png',
 						name:'成为代理',
@@ -161,8 +282,8 @@
 						name:'音乐先锋榜',
 						path:'/pages/mine/card/card'
 					},
-				],
-				pointsList:[
+				]
+				this.pointsList=[
 					{
 						icon:'/static/icon/life.png',
 						name:'生活服务',
@@ -186,26 +307,6 @@
 					
 				]
 			}
-		},
-		onPageScroll(obj){
-			this.toumindu = obj.scrollTop*0.006;
-		},
-
-		methods: {
-			scanCode(){
-				const _this = this;
-				this.$jump('/pages/checkstand/index')
-				// uni.scanCode({
-				//     success: function (res) {
-				// 		_this.$jump('/pages/checkstand/index')
-				//     },
-				// 	fail: (res) => {
-				// 		if(res.errMsg!='scanCode:fail cancel'){
-				// 			this.scanNotify = {scan: true,scanMessage: res.errMsg};
-				// 		}
-				// 	}
-				// });
-			},
 		}
 	}
 </script>
@@ -250,6 +351,7 @@
 		.info{
 			padding: 20rpx 20rpx 0;
 			display: flex;
+			justify-content: space-between;
 			
 			.avatar{
 				width: 100rpx;

+ 1 - 1
pages/mine/my-points/exchange.vue

@@ -12,7 +12,7 @@
 		
 		<view class="card" v-for="(item,index) in 6" :key="index">
 			<view class="left">
-				<image src="../../../static/bank/zhongguo.png" mode=""></image>
+				<image src="@/static/icon/zhongguo.png" mode=""></image>
 				<view class="">
 					<text>中国银行</text>
 				</view>

+ 3 - 3
pages/mine/my-points/my-points.vue

@@ -42,7 +42,7 @@
 			<view @click="$jump('/pages/mine/bill-detail')" class="item" hover-class="hoverClass" v-for="(item,index) in 6" :key="index">
 				<view class="area1">
 					<view class="item-padding">
-						<image src="../../../static/bank/zhongguo.png" mode=""></image>
+						<image src="@/static/icon/zhongguo.png" mode=""></image>
 						<view class="">
 							<text>中国银行</text>
 							<text>7月20日 12:00</text>
@@ -52,7 +52,7 @@
 				<view class="area2 text-area ">
 					<view class="item-padding">
 						<image style="width: 35rpx;height: 35rpx;margin-bottom: -5rpx;" src="@/static/icon/points-value.png"></image>
-						<text style="font-size: 32rpx;margin-left: 10rpx;">-100</text>
+						<text style="font-size: 32rpx;margin-left: 10rpx;color: #F39248;">-100</text>
 					</view>
 				</view>
 				<view class="area3 text-area ">
@@ -184,7 +184,7 @@
 					}
 
 					text:last-child {
-						font-size: 26rpx;
+						font-size: 22rpx;
 						color: #888888;
 					}
 				}

BIN
static/bank/zhaoshang.png


BIN
static/bank/zhongguo.png


BIN
static/img/bg-yin.png


BIN
static/img/bg.png


+ 7 - 1
store/index.js

@@ -12,7 +12,7 @@ try{
 }
 
 // 需要永久存储,且下次APP启动需要取出的,在state中的变量名
-let saveStateKeys = ['vuex_audit'];
+let saveStateKeys = ['vuex_audit','vuex_userId','vuex_phone'];
 
 // 保存变量到本地存储中
 const saveLifeData = function(key, value){
@@ -33,6 +33,12 @@ const store = new Vuex.Store({
 		// 如果上面从本地获取的lifeData对象下有对应的属性,就赋值给state中对应的变量
 		// 加上vuex_前缀,是防止变量名冲突,也让人一目了然
 		vuex_audit: lifeData.vuex_audit ? lifeData.vuex_audit : 0,
+		//代理类型 代理人级别: 1-独家代理 2-战略合作伙伴
+		vuex_agenter_type: lifeData.vuex_agenter_type ? lifeData.vuex_agenter_type : 0,
+		//用户id
+		vuex_userId: lifeData.vuex_userId ? lifeData.vuex_userId : null,
+		//手机号
+		vuex_phone: lifeData.vuex_phone ? lifeData.vuex_phone : null,
 	},
 	mutations: {
 		$uStore(state, payload) {

+ 1 - 0
uni.scss

@@ -1,5 +1,6 @@
 @import 'uview-ui/theme.scss';
 /* 行为相关颜色 */
+$base-color:#FF9447;
 $uni-color-primary: #007aff;
 $uni-color-success: #4cd964;
 $uni-color-warning: #f0ad4e;

+ 0 - 10
utils/global.js

@@ -1,10 +0,0 @@
-let global = {
-
-  wxParams:{
-	  APPID:'wx5d30bdd3d0f579af',//appid
-	  SECRET:"3e3a7793022808fcb63e215bfa1e1f93"
-  },
- 
-}
-
-export default global 

+ 39 - 26
utils/mixin.js

@@ -2,32 +2,45 @@
  * 全局注入器
  */
 let page = {
-  data() {
-    return {
-		
-    }
-  },
-  computed: {
-    //ios底部安全区域
-    safeAreaBottom() {
-      let info = uni.getSystemInfoSync()
-      let safe = 20
-      if (
-        info &&
-        ['devtools', 'ios'].includes(info.platform) &&
-        info.statusBarHeight > safe
-      ) {
-        return info.statusBarHeight - safe
-      }
-      return 0
-    }
-  },
-  methods: {
-    
-  },
-  onLoad(options) {
-	 
-  }
+	data() {
+		return {
+
+		}
+	},
+	computed: {
+		//ios底部安全区域
+		safeAreaBottom() {
+			let info = uni.getSystemInfoSync()
+			let safe = 20
+			if (
+				info && ['devtools', 'ios'].includes(info.platform) &&
+				info.statusBarHeight > safe
+			) {
+				return info.statusBarHeight - safe
+			}
+			return 0
+		}
+	},
+	methods: {
+
+	},
+	onLoad(options) {
+		let currentPage = this.$util.getCurrentRoute()
+		//全局登录拦截
+		if (!this.vuex_userId) {
+			if (currentPage.indexOf('pages/agent/') != -1) {
+				uni.reLaunch({
+					url: "/pages/gain/gain?current=1"
+				})
+				return
+			}
+			if (currentPage.indexOf('pages/mine/') != -1 && currentPage != 'pages/mine/mine') {
+				uni.reLaunch({
+					url: "/pages/mine/mine"
+				})
+			}
+		}
+	}
 }
 
 export default page

+ 22 - 0
utils/util.js

@@ -114,5 +114,27 @@ util.reload = (mescroll) => {
     }
 }
 
+// 刷新当前页面
+util.refreshPage = () => {
+	const pages = getCurrentPages()
+	const currentPage = pages[pages.length - 1]
+	const path = '/' + currentPage.route + vm.$u.queryParams(currentPage.options)
+	if (vm.$u.test.contains(currentPage.route, 'tabbar')) {
+		uni.reLaunch({
+			url: path,
+			fail: (err) => {
+				console.log(err)
+			}
+		})
+	} else {
+		uni.redirectTo({
+			url: path,
+			fail: (err) => {
+				console.log(err)
+			}
+		})
+	}
+}
+
 
 export default util