Explorar o código

首页接口对接

xhj %!s(int64=3) %!d(string=hai) anos
pai
achega
2b819f2595

+ 6 - 6
App.vue

@@ -8,7 +8,7 @@
 		onLaunch: function(options) {
 			// this.globalData.appInitData();
 			this.globalData.InitUpdateManager();
-			this.globalData.getChatList();
+			// this.globalData.getChatList();
 			// 
 			uni.hideTabBar()
 		},
@@ -41,11 +41,11 @@
 		},
 		globalData: {
 			//获取客服配置
-			getChatList() {
-				req.getRequest('/api/customer/list', {}, res => {
-					req.setStorage('chatService', res);
-				});
-			},
+			// getChatList() {
+			// 	req.getRequest('/api/customer/list', {}, res => {
+			// 		req.setStorage('chatService', res);
+			// 	});
+			// },
 			appInitData() {
 				var getSysInfo = uni.getSystemInfoSync();
 				this.isIPhone = getSysInfo.model.indexOf("iPhone") != -1;

+ 5 - 5
components/integral-nav/index.vue

@@ -86,11 +86,11 @@ export default {
         from.purchaseType = 1;
       }
 
-      req.getRequest('/api/purchase/count', from, res => {
-        this.setData({
-          count: res
-        });
-      });
+      // req.getRequest('/api/purchase/count', from, res => {
+      //   this.setData({
+      //     count: res
+      //   });
+      // });
     },
 
     /**

+ 5 - 5
components/nav-bar/index.vue

@@ -73,11 +73,11 @@
 					from.purchaseType = 1;
 				}
 
-				req.getRequest('/api/purchase/count', from, res => {
-					this.setData({
-						count: res
-					});
-				});
+				// req.getRequest('/api/purchase/count', from, res => {
+				// 	this.setData({
+				// 		count: res
+				// 	});
+				// });
 			},
 
 			// 获取tab导航

+ 8 - 8
components/shopping-cart/index.vue

@@ -41,14 +41,14 @@ export default {
 
   methods: {
     getCount() {
-      req.getRequest('/api/purchase/count', {
-        purchaseType: 1
-      }, data => {
-        this.setData({
-          count: data
-        });
-        // console.log(this);
-      });
+      // req.getRequest('/api/purchase/count', {
+      //   purchaseType: 1
+      // }, data => {
+      //   this.setData({
+      //     count: data
+      //   });
+      //   // console.log(this);
+      // });
     },
 
     goshopCar() {

+ 1 - 1
manifest.json

@@ -112,7 +112,7 @@
     },
     "quickapp" : {},
     "mp-weixin" : {
-        "appid" : "wx184332f2ea1465a4",
+        "appid" : "wx22abcefaf744e04a",
         "setting" : {
             "urlCheck" : false,
             "minified" : true,

+ 2 - 1
pages.json

@@ -63,7 +63,8 @@
 		{
 			"path": "pages/user/user",
 			"style": {
-				"navigationBarTitleText": "我的"
+				"navigationBarTitleText": "",
+				"navigationBarBackgroundColor": "#EB692F"
 			}
 		},
 		{

+ 29 - 368
pages/authorize/authorize.vue

@@ -1,17 +1,17 @@
 <template>
 	<view style="padding: 77rpx;box-sizing: border-box;">
 		<!--pages/authorize/authorize.wxml-->
-		<block v-if="isLong">
+		<block>
 			<view class="authorize-title">
 				<view>您好,</view>
 				<view>欢迎使用皮小电商家版</view>
 			</view>
 			<view style="margin-top: 50rpx;">
 				<view class="input-box">
-					<input placeholder="请输入账号"/>
+					<input v-model="userName" placeholder="请输入账号"/>
 				</view>
 				<view class="input-box ddflex">
-					<input type="text" class="fflex" :password="showPassword" placeholder="请输入密码" value="" />
+					<input v-model="passWord" type="text" class="fflex" :password="!showPassword" placeholder="请输入密码" value="" />
 					<view style="padding: 10rpx;">
 						<image v-if="showPassword" @click="showPassword=false" style="width: 34rpx;height: 15rpx;margin-left: 10rpx;" src="../../static/pages/images/close-eyes.png"></image>
 						<image v-else @click="showPassword=true" style="width: 31rpx;height: 23rpx;margin-left: 10rpx;" src="../../static/pages/images/open-eyes.png"></image>
@@ -19,7 +19,7 @@
 				</view>
 			</view>
 			
-			<button class="login" @click="getWXUserProfile()">授权登录</button>
+			<button class="login" @click="submitLogin()">授权登录</button>
 			<view class="dflex">
 				<image v-if='agree' class="agree-icon" src="../../static/pages/images/agree_h.png" @click="agree=false"></image>
 				<image v-else class="agree-icon" src="../../static/pages/images/agree.png" @click="agree=true"></image>
@@ -31,59 +31,7 @@
 				</view>
 			</view>
 		</block>
-		<block v-if="isphone">
-			<view class="phone">
-				<view class="logo">
-					<image :src="logo"></image>
-					<view>{{ name }}</view>
-				</view>
-			</view>
-			<view class="btn">
-				<button class="btnphone" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">微信手机号快捷绑定</button>
-				<!-- <view class="btngophone r10">手机号验证绑定</view> -->
-				<view class="zanbu" @tap="back">暂不绑定</view>
-				<view hover-class="none" class="xieyi ddflex">
-					<view @click="jump('/mine/page/page?title=用户协议&isXieyi=true')">《用户协议》</view>
-					及
-					<view @click="jump('/mine/page/page?title=隐私声明&isYinsi=true')">《隐私声明》</view>
-				</view>
-				<view class="copy" v-if="about.name && about.recordNumber">{{ about.name ? about.name : '' }}版权所有© {{ about.recordNumber ? about.recordNumber : '' }}</view>
-			</view>
-
-			<!-- 绑定手机号 -->
-			<!-- <block>
-    <view class='phone'>
-      <view class='logo'>
-        <image src='{{about.logo}}'></image>
-      </view>
-    </view>
-    <view class="bgfff form r10">
-      <view class="borbom dflex"><image src="/pages/images/telephone.png"></image><input type="text" placeholder="请输入手机号" /></view>
-      <view class="dflex paw"><image src="/pages/images/paw.png"></image><input type="text" placeholder="请输入验证码" /><text class="huoqu">获取验证码</text></view>
-    </view>
-    <view class="btn">
-      <button class="goloing">立即登录</button>
-      <view class="gophone1 r10">微信手机号快捷绑定</view>
-      <navigator url="/mine/page/page?title=用户协议&isXieyi=true" hover-class="none" class="xieyi">《用户协议》</navigator>
-      <view class='copy'>{{about.name}}版权所有© {{about.recordNumber}}</view>
-    </view>
-  </block> -->
-		</block>
-		<view class="ceng" v-if="isXyShow"></view>
-		<view class="pop-protocol" :style="'bottom:' + XyBottom">
-			<view class="pop-tit">个人隐私保护指引</view>
-			<view class="pop-con">
-				为更好的保障你的个人信息安全及权利行使。我们将通过
-				<text @click="jump('/mine/page/page?title=用户协议&isXieyi=true')">《用户协议》</text>
-				和
-				<text @click="jump('/mine/page/page?title=隐私声明&isYinsi=true')">《隐私声明》</text>
-				帮助你了解我们收集、使用、存储、公开披露个人信息的情况。请仔细阅读并理解本政策的内容,若你同意,请点击下方按钮开始接受我们的服务。
-			</view>
-			<view class="pop-btn">
-				<view class="pop-agree" @click="agn()">同意并继续</view>
-				<view class="pop-no" @click="back()">不同意并退出</view>
-			</view>
-		</view>
+		
 	</view>
 </template>
 
@@ -95,111 +43,22 @@ const req = require('../../utils/request.js');
 export default {
 	data() {
 		return {
-			sessionKey: '',
-			openid: '',
-			about: {},
-			isShow: true,
-			isphone: false,
-			isLong: true,
-			istetphone: 0,
-			configRes: {},
-			logo: '',
-			name: '',
-			isPromote: false, //是否从分销进入
-			isXyShow: true ,//默认显示协议指引
-			XyBottom: '-100%',
-			
 			showPassword:false,
-			agree:false
+			agree:false,
+			userName:'',
+			passWord:''
 		};
 	},
 
 	components: {},
 	props: {},
 	onLoad: function(options) {
-		var agnXY = req.getStorage('agnXY');
-		if (agnXY) {
-			this.isXyShow = false;
-			this.XyBottom = '-100%';
-		}else{
-			setTimeout(res=>{
-				this.XyBottom = 0;
-			},200)
-		}
-
-		app.globalData.getCheckSessoin(json => {
-			this.sessionKey = json.session_key;
-			this.openid = json.openid;
-		});
-		console.log('登录页面===********************' + JSON.stringify(options));
-
-		if (req.getStorage('configRes')) {
-			let configRes = JSON.parse(req.getStorage('configRes'));
-			this.setData({
-				istetphone: configRes.user_bind_mobile,
-				logo: configRes.CONFIG_PROJECT_LOGO,
-				name: configRes.CONFIG_PROJECT_TITLE
-			});
-		} else {
-			req.g('/api/config', res => {
-				req.setStorage('configRes', JSON.stringify(res));
-				this.setData({
-					istetphone: res.user_bind_mobile,
-					logo: res.CONFIG_PROJECT_LOGO,
-					name: res.CONFIG_PROJECT_TITLE
-				});
-			});
-		}
-
-		if (options.bindmobile == 1) {
-			this.isphoneFun();
-		}
-
-		if (options.scene) {
-			this.scene = options.scene;
-			this.loadCodeParams();
-		}
-		this.getAbout();
-		// this.isphone()
+		
 	},
 	onShow: function() {
-		uni.setNavigationBarColor({
-			frontColor: '#000000',
-			backgroundColor: '#FFFFFF'
-		});
-		uni.setNavigationBarTitle({
-			title: '授权登录'
-		}); // this.isshop()
 	},
 	onUnload: function() {
-		// 调用登录的时候会存一个REDIRECT_URL 根据REDIRECT_URL来判断用户是从哪里登录,identification用户点击暂不绑定的标识
-		// console.log(this.identification,req.getStorage('REDIRECT_URL'),app)
-		if (req.getStorage('REDIRECT_URL') == '/pages/user/user' && !this.identification) {
-			// 判断是否开启了强制绑定手机号,并且判断缓存是否有userInfo,是否存在userInfo.mobile电话
-			if (this.istetphone == '1' && req.getStorage('userInfo') && !req.getStorage('userInfo').mobile) {
-				let pages = getCurrentPages();
-				var prevPage = pages[pages.length - 2];
-				prevPage.$vm.setData({
-					noLogin: true
-				});
-				uni.navigateBack({
-					delta: -1
-				});
-				// app.globalData.switchTab('pages/index/index')
-			}
-			// 判断用户是否登录,点击返回键,就跳转到首页,并传个值到user页面,阻止调用接口,防止登录
-			if (!req.getStorage('userInfo')) {
-				let pages = getCurrentPages();
-				var prevPage = pages[pages.length - 2];
-				prevPage.$vm.setData({
-					noLogin: true
-				});
-				uni.navigateBack({
-					delta: -1
-				});
-				// app.globalData.switchTab('pages/index/index')
-			}
-		}
+		
 	},
 	methods: {
 		jump(url) {
@@ -207,224 +66,26 @@ export default {
 				url: url
 			});
 		},
-
-		loadCodeParams() {
-			let _ts = this;
-			return new Promise((resolve, reject) => {
-				if (!_ts.scene) {
-					resolve();
-					return false;
-				}
-
-				req.getRequest(
-					'/api/code/params',
-					{
-						scene: _ts.scene
-					},
-					data => {
-						if (data.scene.split('_')[1] == 'isPromote') {
-							this.isPromote = true;
-						}
-						// console.log("获取用户id====++++++++++++++" + JSON.stringify(data));
-						req.setStorage('pidCode', data.userId);
-						resolve();
-					}
-				);
-			});
-		},
-
-		agn() {
-			this.isXyShow = false;
-			this.XyBottom = '-100%';
-			req.setStorage('agnXY', true);
-		},
-
-		back() {
-			this.XyBottom = '-100%';
-			this.identification = true;
-			// uni.switchTab({
-			// 	url: req.header.appId=='ZQ1VK5oc17I387E'?'/pages/timelyDelivery/index':'/pages/index/index'
-
-			// });
-			if (this.isPromote) {
-				uni.switchTab({
-					url: req.header.appId == 'ZQ1VK5oc17I387E' ? '/pages/timelyDelivery/index' : '/pages/index/index'
-				});
-			} else {
-				uni.navigateBack();
-			}
-		},
-
-		getAbout() {
-			var _this = this;
-			req.getRequest(
-				'/api/aboutAs',
-				{},
-				function(res) {
-					_this.setData({
-						about: res
-					});
-				},
-				true
-			);
-		},
-		getWXUserProfile() {
-			let that = this;
-			try {
-				uni.getUserProfile({
-					desc: '注册',
-					success: res => {
-						// console.log('数据====', JSON.stringify(res));
-						that.toSubmitLogin(res.iv, res.encryptedData);
-					},
-					fail: res => {
-						// console.log('数据====', res);
-						req.msg(res);
-					}
-				});
-			} catch (e) {
-				//  老版
-				wx.getUserInfo({
-					success: function(ress) {
-						// console.log('getUserInfo====', JSON.stringify(ress));
-						that.toSubmitLogin(ress.iv, ress.encryptedData);
-					}
-				});
-			}
-		},
-		toSubmitLogin(iv, encryptedData) {
-			let that = this;
-			if (!encryptedData || !iv) return false;
-			let _params = {
-				sessionKey: this.sessionKey,
-				openId: this.openid,
-				iv: iv,
-				encryptedData: encryptedData
-			};
-			if (req.getStorage('pidCode')) {
-				_params.parentId = req.getStorage('pidCode');
-			}
-			req.postRequest('/api/login', _params, json => {
-				let params = json;
-				// console.log(json);
-				that.setData(params);
-				let url = req.getStorage('REDIRECT_URL');
-				req.setStorage('userInfo', json);
-
-				// req.removeStorage('MERCHANT')
-				if (that.scene) {
-					that.back();
-				} else {
-					// console.log(json.mobile);
-
-					if (that.istetphone != '1') {
-						uni.navigateBack();
-					} else {
-						if (json.mobile) {
-							uni.navigateBack();
-						} else {
-							that.isphoneFun();
-						}
-					}
-				}
-
-				that.isshop();
-			});
-		},
-		//原来的登录
-		bindGetUserInfo(e) {
-			var that = this;
-			let data = e.detail;
-			if (!data.encryptedData || !data.iv) return false;
-			let _params = {
-				sessionKey: this.sessionKey,
-				iv: data.iv,
-				encryptedData: data.encryptedData
-			}; // console.log("!!!!!!!!!!!!!!!!!!!!!!"+_params)
-
-			if (req.getStorage('pidCode')) {
-				_params.parentId = req.getStorage('pidCode');
-			}
-
-			// console.log("登录页面===" + JSON.stringify(_params));
-			req.postRequest('/api/login', _params, json => {
-				let params = json;
-				// console.log(json);
-				that.setData(params);
-				let url = req.getStorage('REDIRECT_URL');
-				req.setStorage('userInfo', json);
-
-				// req.removeStorage('MERCHANT')
-				if (that.scene) {
-					that.back();
-				} else {
-					// console.log(json.mobile);
-
-					if (that.istetphone != '1') {
-						uni.navigateBack();
-					} else {
-						if (json.mobile) {
-							uni.navigateBack();
-						} else {
-							that.isphoneFun();
-						}
-					}
-				}
-
-				that.isshop();
-			});
-		},
-
-		//判断是否开启手机绑定
-		isphoneFun() {
-			this.setData({
-				isphone: true,
-				isLong: false
-			});
-			uni.setNavigationBarTitle({
-				title: '绑定手机号'
-			});
-		},
-
-		getPhoneNumber(e) {
-			let that = this;
-			let _params = {
-				sessionKey: this.sessionKey,
-				iv: e.detail.iv,
-				encryptedData: e.detail.encryptedData
-			};
-			// console.log(e.detail.errMsg);
-
-			if (req.getStorage('pidCode')) {
-				_params.parentId = req.getStorage('pidCode');
-			}
-
-			if (e.detail.errMsg == 'getPhoneNumber:ok') {
-				req.postRequest('/api/weixin/mobile', _params, json => {
-					// console.log(json);
-
-					if (json.mobile) {
-						var userInfo = req.getStorage('userInfo');
-						userInfo.mobile = json.mobile;
-						req.setStorage('userInfo', userInfo);
-
-						if (that.scene) {
-							that.back();
-						} else {
-							uni.navigateBack();
-						}
-					}
-				});
-			} else {
+		submitLogin(){
+			if(!this.userName) return req.msg('请输入账号')
+			if(!this.passWord) return req.msg('请输入密码')
+			if(!this.agree) return req.msg('请阅读以下协议')
+			
+			let dataP = {
+				account:this.userName,
+				password:this.passWord
 			}
-		},
-
-		// 分销的配置
-		isshop() {
-			req.p('/api/distribution/config', data => {
-				// console.log(data);
-				req.setStorage('distribution', data);
-			});
+			
+			req.postRequest('/admin/v2/login',dataP,res=>{
+				let params = res;
+				req.setStorage('userInfo', params);
+				req.setStorage('AUTH_TOKEN', params.token);
+				console.log(params.token)
+				req.msg('登陆成功')
+				setTimeout(()=>{
+					uni.navigateBack()
+				},500)
+			})
 		}
 	}
 };

+ 87 - 134
pages/index/index.vue

@@ -7,23 +7,23 @@
 		<!-- 数据 -->
 		<view class="data-box">
 			<view>
-				<view class="ljsy">10086.75</view>
+				<view class="ljsy">{{statisticData.totalProfit?statisticData.totalProfit:0}}</view>
 				<view class="ljsy-label">累计收益(元)</view>
 			</view>
 
 			<view class="jy ddflex">
 				<view>
-					<view class="jy-data">152</view>
+					<view class="jy-data">{{statisticData.todayOrderCount?statisticData.todayOrderCount:0}}</view>
 					<view class="jy-label">今日订单数</view>
 				</view>
 				<view class="jy-line"></view>
 				<view>
-					<view class="jy-data"><text style="font-size: 22rpx;font-weight: 400;">¥</text>2000.00</view>
+					<view class="jy-data"><text style="font-size: 22rpx;font-weight: 400;">¥</text>{{statisticData.todayTurnover?statisticData.todayTurnover:0}}</view>
 					<view class="jy-label">今日营业额</view>
 				</view>
 				<view class="jy-line"></view>
 				<view>
-					<view class="jy-data"><text style="font-size: 22rpx;font-weight: 400;">¥</text>2000.00</view>
+					<view class="jy-data"><text style="font-size: 22rpx;font-weight: 400;">¥</text>{{statisticData.todayProfit?statisticData.todayProfit:0}}</view>
 					<view class="jy-label">今日收益额</view>
 				</view>
 			</view>
@@ -31,29 +31,29 @@
 
 		<!-- 总数 -->
 		<view class="total-box ddflex">
-			<view class="fflex" v-if="true">
+			<view class="fflex" v-if="!userInfo.storeId">
 				<view class="total-label">商家总数</view>
-				<view class="total-data">385</view>
+				<view class="total-data">{{statisticData.merchantCount?statisticData.merchantCount:0}}</view>
 			</view>
-			<view v-if="true" class="total-data-line"></view>
-			<view class="fflex" v-if="true">
+			<view v-if="!userInfo.storeId" class="total-data-line"></view>
+			<view class="fflex" v-if="!userInfo.storeId">
 				<view class="total-label">门店总数</view>
-				<view class="total-data">6</view>
+				<view class="total-data">{{statisticData.storeCount?statisticData.storeCount:0}}</view>
 			</view>
-			<view v-if="true" class="total-data-line"></view>
+			<view v-if="!userInfo.storeId" class="total-data-line"></view>
 			<view class="fflex">
 				<view class="total-label">设备总数</view>
-				<view class="total-data">226</view>
+				<view class="total-data">{{statisticData.batteryCount?statisticData.batteryCount:0}}</view>
 			</view>
 			<view class="total-data-line"></view>
 			<view class="fflex">
 				<view class="total-label">订单总数</view>
-				<view class="total-data">113</view>
+				<view class="total-data">{{statisticData.totalOrderCount?statisticData.totalOrderCount:0}}</view>
 			</view>
 		</view>
 
 		<!-- nav -->
-		<view v-if="true" class="nav-box ddflex">
+		<view v-if="!userInfo.storeId" class="nav-box ddflex">
 			<view class="nav-item">
 				<image class="nav-item-icon" src="../../static/pages/images/wdsj.png" @click="jumpUrl('/pages/myStore/myStore')"></image>
 				<view class="nav-item-title">我的商家</view>
@@ -62,7 +62,7 @@
 				<image class="nav-item-icon" src="../../static/pages/images/wdmd.png"></image>
 				<view class="nav-item-title">我的门店</view>
 			</view>
-			<view class="nav-item" v-if="true" @click="jumpUrl('/mine/myUser/myUser')">
+			<view class="nav-item" v-if="!userInfo.storeId&&!userInfo.merchantId" @click="jumpUrl('/mine/myUser/myUser')">
 				<image class="nav-item-icon" src="../../static/pages/images/wdyh.png"></image>
 				<view class="nav-item-title">我的用户</view>
 			</view>
@@ -72,7 +72,7 @@
 			</view>
 		</view>
 		
-		<view v-if="true" class="nav-box ddflex" style="padding: 10rpx 30rpx;justify-content: space-between;" @click="jumpUrl('/pages/operationData/operationData')">
+		<view v-if="userInfo.storeId" class="nav-box ddflex" style="padding: 10rpx 30rpx;justify-content: space-between;" @click="jumpUrl('/pages/operationData/operationData')">
 			<view class="nav-item ddflex">
 				<image class="nav-item-icon" src="../../static/pages/images/yysj.png"></image>
 				<view class="nav-item-title">运营数据</view>
@@ -93,7 +93,7 @@
 						@click="timeTypeChange(3)">近30日</view>
 				</view>
 			</view>
-			<view>
+			<view style="height:500rpx">
 				<l-echart ref="chart" @finished="init"></l-echart>
 			</view>
 		</view>
@@ -164,6 +164,11 @@
 				rpxTopxScale: 0,
 
 				timeType: 1, //统计时间 1.按日 2.按月 3.按季度
+				
+				statisticData:{},//统计数据
+				echartData:{},//曲线图
+				
+				userInfo:{},
 
 				// 交易趋势图表数据
 				option: {
@@ -175,16 +180,16 @@
 						confine: true
 					},
 					legend: {
-						data: ['订单', '订单金额'],
-						x: 'right', //可设定图例在左、右、居中
-						y: 'bottom', //可设定图例在上、下、居中
-						padding: [60, 0, 0, 0]
+						data: ['订单', '订单金额','收益金额'],
+						x: 'center', //可设定图例在左、右、居中
+						y: 'top', //可设定图例在上、下、居中
+						padding: [15, 0, 0, 0]
 					},
 					grid: {
 						left: 0,
 						right: 8,
-						bottom: 40,
-						top: 40,
+						bottom: 5,
+						top: 45,
 						containLabel: true
 					},
 					xAxis: [{
@@ -216,7 +221,7 @@
 						}
 					}],
 					series: [{
-							name: '订单',
+							name: '订单',
 							type: 'line',
 							data: [300, 270, 340, 344, 300, 320, 310],
 							barWidth: 10,
@@ -239,6 +244,18 @@
 								barBorderRadius: [15, 15, 0, 0]
 							}
 						},
+						{
+							name: '收益金额',
+							type: 'line',
+							data: [120, 102, 141, 174, 190, 250, 120],
+							barWidth: 10,
+							itemStyle: {
+								// 颜色
+								color: '#FFDC0F',
+								// 给bar设置倒角
+								barBorderRadius: [15, 15, 0, 0]
+							}
+						},
 					]
 				},
 
@@ -340,7 +357,7 @@
 						containLabel: true
 					},
 					series: [{
-						name: '订单',
+						name: '设备出租比例',
 						type: 'pie',
 						center: ['30%', '50%'],
 						radius: ['60%', '80%'],
@@ -526,11 +543,12 @@
 		},
 
 		async onShow() {
-			let _ts = this;
-			await this.getConfig().then(res => {
-				// _ts.getMerchant();
-			});
-
+			await this.getEchartData()
+			await this.getStatisticData()
+			
+			this.init()
+			
+			this.getUserInfo()
 		},
 
 		onUnload() {},
@@ -547,16 +565,23 @@
 				}
 			},
 			// 统计时间切换
-			timeTypeChange(val) {
+			async timeTypeChange(val) {
 				if (this.timeType == val) return false
 				this.timeType = val
+				await this.getEchartData()
+				// await this.getStatisticData()
+				
+				this.init()
 			},
 			init() {
 				this.$refs.chart.init(echarts, async chart => {
 					// let echartData = await this.getEchartData()
-					this.option.xAxis[0].data = ['2023/04/12', '2023/04/12', '2023/04/12', '2023/04/12']
-					this.option.series[0].data = [1, 2, 3, 4]
-					this.option.series[1].data = [1, 2, 3, 4]
+					this.option.legend.itemHeight = 10 * this.rpxTopxScale
+					this.option.legend.itemWidth = 40 * this.rpxTopxScale
+					this.option.xAxis[0].data = this.echartData.orderList.map(item=>{return item.showTime})
+					this.option.series[0].data = this.echartData.orderList.map(item=>{return item.orderCount})
+					this.option.series[1].data = this.echartData.profitList.map(item=>{return item.profit})
+					this.option.series[2].data = this.echartData.turnoverList.map(item=>{return item.turnover})
 					chart.setOption(this.option);
 				});
 				if (this.$refs.chart2) {
@@ -569,39 +594,38 @@
 				}
 				if (this.$refs.chart3) {
 					this.$refs.chart3.init(echarts, async chart => {
-						// // let echartData = await this.getEchartData()
-						// this.option2.yAxis[0].data = ['罗技', '刘涛', '陈楚生', '罗巧红', '李冰冰']
-						// this.option2.series[0].data = [8125, 6802, 5622, 4588, 2458]
 						this.option3.title.textStyle.fontSize = 28 * this.rpxTopxScale
 						this.option3.legend.itemHeight = 10 * this.rpxTopxScale
 						this.option3.legend.itemWidth = 40 * this.rpxTopxScale
+						this.option3.series[0].data[0].value = this.statisticData.noLeaseCount
+						this.option3.series[0].data[1].value = this.statisticData.leaseCount
 						chart.setOption(this.option3);
 					});
 				}
 				if (this.$refs.chart4) {
 					this.$refs.chart4.init(echarts, async chart => {
-						// // let echartData = await this.getEchartData()
-						// this.option2.yAxis[0].data = ['罗技', '刘涛', '陈楚生', '罗巧红', '李冰冰']
-						// this.option2.series[0].data = [8125, 6802, 5622, 4588, 2458]
 						this.option4.title.textStyle.fontSize = 24 * this.rpxTopxScale
+						this.option4.series[0].data[0].value = this.statisticData.leaseCount
+						this.option4.series[0].data[1].value = this.statisticData.noLeaseCount
+						this.option4.series[0].label.normal.formatter = ()=>{return this.statisticData.leaseCount}
 						chart.setOption(this.option4);
 					});
 				}
 				if (this.$refs.chart5) {
 					this.$refs.chart5.init(echarts, async chart => {
-						// // let echartData = await this.getEchartData()
-						// this.option2.yAxis[0].data = ['罗技', '刘涛', '陈楚生', '罗巧红', '李冰冰']
-						// this.option2.series[0].data = [8125, 6802, 5622, 4588, 2458]
 						this.option5.title.textStyle.fontSize = 24 * this.rpxTopxScale
+						this.option5.series[0].data[0].value = this.statisticData.noLeaseCount
+						this.option5.series[0].data[1].value = this.statisticData.leaseCount
+						this.option4.series[0].label.normal.formatter = ()=>{return this.statisticData.noLeaseCount}
 						chart.setOption(this.option5);
 					});
 				}
 				if (this.$refs.chart6) {
 					this.$refs.chart6.init(echarts, async chart => {
-						// // let echartData = await this.getEchartData()
-						// this.option2.yAxis[0].data = ['罗技', '刘涛', '陈楚生', '罗巧红', '李冰冰']
-						// this.option2.series[0].data = [8125, 6802, 5622, 4588, 2458]
 						this.option6.title.textStyle.fontSize = 24 * this.rpxTopxScale
+						this.option6.series[0].data[0].value = this.statisticData.expireCount
+						this.option6.series[0].data[1].value =Number(this.statisticData.batteryCount) - Number(this.statisticData.leaseCount)
+						this.option6.series[0].label.normal.formatter = ()=>{return this.statisticData.expireCount}
 						chart.setOption(this.option6);
 					});
 				}
@@ -609,100 +633,29 @@
 			// 获取图表数据
 			getEchartData() {
 				return new Promise((r, j) => {
-					req.getRequest('/api/v3/recovery/chart', {
-						dayType: this.dayType
-					}, res => {
-						console.log('resres', res)
+					req.getRequest('/admin/v2/statistic/chart', {type: this.timeType}, res => {
+						this.echartData = res
+						console.log('statistic chart', res)
 						r(res)
 					})
 				})
 			},
-			getMerchant() {
-				let _ts = this;
-				if (req.header.appId == 'ZQ1VK5oc17I387E') {
-					// 默认门店
-					let merchant = req.getStorage('defaultMerchant');
-					var timestamp = Date.parse(new Date());
-					merchant.time = timestamp + 1 * 60 * 1000;
-					if (merchant) {
-						req.setStorage('MERCHANT', merchant);
-						_ts.setData({
-							merchant: merchant
-						});
-						console.log('》》》》获取当前的门店>>>>>>>>', merchant);
-						_ts.init(merchant);
-					} else {
-						return new Promise((resolve, reject) => {
-							req.getRequest(
-								'/api/merchant/list', {
-									page: 0,
-									limit: 10000
-								},
-								res => {
-									console.log('获取到门店列表>>>>>>>>', res);
-									var data = res.filter(it => it.isDefault == 1);
-									var timestamp = Date.parse(new Date());
-									res[0].time = timestamp + 1 * 60 * 1000;
-									_ts.setData({
-										merchant: data[0]
-									});
-									// console.log(data)
-									console.log('缓存当前的门店>>>>>>>>', data[0]);
-									req.setStorage('defaultMerchant', data[0]);
-									req.setStorage('MERCHANT', data[0]);
-									_ts.init(data[0]);
-									resolve();
-								}
-							);
-						});
-					}
-				} else {
-					return new Promise((resolve, reject) => {
-						api.getMerchant(_ts.query, req, data => {
-							console.log('data==', data)
-							if (data == 1) {
-								uni.showModal({
-									title: '温馨提示',
-									content: '获取定位失败,请前往设置打开定位权限',
-									showCancel: false,
-									success(res) {
-										if (res.confirm) {
-											// console.log('用户点击确定');
-											uni.openSetting({
-												success(res) {
-													console.log(res
-														.authSetting
-													); // res.authSetting = {
-												}
-											});
-										}
-									}
-								});
-							} else {
-								_ts.merchant = data;
-								_ts.init(data);
-							}
-							resolve();
-						});
-					});
-				}
-			},
-
-			getConfig() {
-				var _this = this;
-				return new Promise((res, rej) => {
-					req.g(
-						'/api/config',
-						data => {
-							req.setStorage('configRes', JSON.stringify(data));
-							this.about = data;
-
-							res(data);
-						},
-						true
-					);
-				});
+			// 获取图表数据
+			getStatisticData() {
+				return new Promise((r, j) => {
+					req.getRequest('/admin/v2/statistic/top', {}, res => {
+						console.log('statistic top', res)
+						this.statisticData = res
+						r(res)
+					})
+				})
 			},
+			// 获取当前用户
+			getUserInfo(){
+				req.getRequest('/admin/v2/userInfo',{},res=>{
+					this.userInfo = res
+				})
+			}
 		},
 		mounted() {
 			const systemInfo = uni.getSystemInfoSync();

+ 49 - 20
pages/myMerchant/myMerchant.vue

@@ -4,8 +4,8 @@
 		<view>
 			<view class="search-box ddflex">
 				<image class="search-icon" src="../../static/images/ssico.png"></image>
-				<input class="fflex" placeholder="请输入门店名称或电话"/>
-				<view class="search-btn">搜索</view>
+				<input class="fflex" confirm-type="search" @confirm="searchFn" placeholder="请输入门店名称或电话"/>
+				<view class="search-btn" @click="searchFn">搜索</view>
 			</view>
 		</view>
 		
@@ -77,36 +77,65 @@
 		props: {},
 		data() {
 			return {
-				systems: {},
-				isTop:0,
+				groupList: [],
+				page: 1,
+				limit: 3,
+				searchValue:'',
+				isQuerying:false,//正在查询数据
 			}
 		},
 		onLoad(options) {
-
+			this.getDataList()
 		},
 		onShow() {
 			
 		},
+		onReachBottom() {
+			this.getDataList(true)
+		},
 		methods: {
-			
+			getDataList(isPage) {
+				if(this.isQuerying) return
+				else this.isQuerying = true
+				if (!isPage) {
+					this.page = 1
+				}
+				let queryParams = {
+					page: this.page,
+					limit: this.limit,
+				}
+				if(this.searchValue){
+					queryParams.name=this.searchValue
+				}
+				req.getRequest(
+					'/admin/v2/store/page',
+					queryParams,
+					data => {
+						if (data != null && data.list.length > 0) {
+							if (!isPage) {
+								this.groupList = data.list
+							} else {
+								this.groupList = this.groupList.concat(data.list)
+							}
+							this.page++
+						} else {
+							if (!isPage)
+								this.groupList = data.list
+							else {}
+						}
+						uni.hideLoading()
+						this.isQuerying = false
+					}
+				)
+			},
+			searchFn(){
+				this.getDataList()
+			}
 		},
 		mounted() {
-			const systemInfo = uni.getSystemInfoSync();
-			// px转换到rpx的比例
-			let pxToRpxScale = 750 / systemInfo.windowWidth;
-			let systems = {
-				ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
-				navigationHeight: 44 * pxToRpxScale // 导航栏的高度
-			};
-			systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
-			this.systems = systems;
+			
 		},
 		onPageScroll: function(e) {
-			if (e.scrollTop > this.systems.barHeight) {
-				this.isTop = 1;
-			} else {
-				this.isTop = 0;
-			}
 		}
 	}
 </script>

+ 64 - 25
pages/myStore/myStore.vue

@@ -4,8 +4,8 @@
 		<view>
 			<view class="search-box ddflex">
 				<image class="search-icon" src="../../static/images/ssico.png"></image>
-				<input class="fflex" placeholder="请输入商家名称或电话"/>
-				<view class="search-btn">搜索</view>
+				<input v-model="searchValue" confirm-type="search" @confirm="searchFn" class="fflex" placeholder="请输入商家名称或电话"/>
+				<view class="search-btn" @click="searchFn">搜索</view>
 			</view>
 		</view>
 		
@@ -14,12 +14,12 @@
 			<view class="sssb-box ddflex">
 				<view class="sssb-item">
 					<view class="sssb-label">商家总数</view>
-					<view class="sssb-data sssb-color">867.00</view>
+					<view class="sssb-data sssb-color">{{statisticData.merchantCount?statisticData.merchantCount:0}}</view>
 				</view>
 				<view class="sssb-line"></view>
 				<view class="sssb-item">
 					<view class="sssb-label">门店总数</view>
-					<view class="sssb-data sssb-color">1915.00</view>
+					<view class="sssb-data sssb-color">{{statisticData.storeCount?statisticData.storeCount:0}}</view>
 				</view>
 			</view>
 		</view>
@@ -45,7 +45,7 @@
 					<image style="width: 26rpx;height: 26rpx;margin-right: 10rpx;" src="../../static/pages/images/address-icon.png"></image>
 					<view class="tover fflex" style="font-size: 24rpx;line-height: 36rpx;color: #A8A5A5;">朝阳区金台路道家园1号</view>
 				</view>
-				<view class="sjyy-data ddflex">
+				<!-- <view class="sjyy-data ddflex">
 					<view class="sjyy-data-item fflex">
 						<view class="sssb-data sssb-color">10242.00</view>
 						<view class="sssb-label">累计收益</view>
@@ -58,7 +58,7 @@
 						<view class="sssb-data sssb-color">9154.00</view>
 						<view class="sssb-label">本月收益</view>
 					</view>
-				</view>
+				</view> -->
 				<view class="sjyy-data ddflex">
 					<view class="sjyy-data-item fflex">
 						<view class="sssb-data sssb-color">56</view>
@@ -92,36 +92,75 @@
 		props: {},
 		data() {
 			return {
-				systems: {},
-				isTop:0,
+				statisticData:{},
+				groupList: [],
+				page: 1,
+				limit: 3,
+				searchValue:'',
+				isQuerying:false,//正在查询数据
 			}
 		},
 		onLoad(options) {
-
+			this.getDataList()
 		},
 		onShow() {
-			
+			this.getStatisticData()
+		},
+		onReachBottom() {
+			this.getDataList(true)
 		},
 		methods: {
-			
+			getStatisticData() {
+				return new Promise((r, j) => {
+					req.getRequest('/admin/v2/statistic/top', {}, res => {
+						console.log('statistic top', res)
+						this.statisticData = res
+						r(res)
+					})
+				})
+			},
+			getDataList(isPage) {
+				if(this.isQuerying) return
+				else this.isQuerying = true
+				if (!isPage) {
+					this.page = 1
+				}
+				let queryParams = {
+					page: this.page,
+					limit: this.limit,
+				}
+				if(this.searchValue){
+					queryParams.name=this.searchValue
+				}
+				req.getRequest(
+					'/admin/v2/merchant/page',
+					queryParams,
+					data => {
+						if (data != null && data.list.length > 0) {
+							if (!isPage) {
+								this.groupList = data.list
+							} else {
+								this.groupList = this.groupList.concat(data.list)
+							}
+							this.page++
+						} else {
+							if (!isPage)
+								this.groupList = data.list
+							else {}
+						}
+						uni.hideLoading()
+						this.isQuerying = false
+					}
+				)
+			},
+			searchFn(){
+				this.getDataList()
+			}
 		},
 		mounted() {
-			const systemInfo = uni.getSystemInfoSync();
-			// px转换到rpx的比例
-			let pxToRpxScale = 750 / systemInfo.windowWidth;
-			let systems = {
-				ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
-				navigationHeight: 44 * pxToRpxScale // 导航栏的高度
-			};
-			systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
-			this.systems = systems;
 		},
 		onPageScroll: function(e) {
-			if (e.scrollTop > this.systems.barHeight) {
-				this.isTop = 1;
-			} else {
-				this.isTop = 0;
-			}
+			
 		}
 	}
 </script>

+ 2 - 2
pages/operationData/operationData.css

@@ -88,7 +88,7 @@
 /* 实时设备数据 */
 .sssb-box{
 	justify-content: space-between;
-	padding: 30rpx 60rpx;
+	padding: 30rpx 30rpx;
 }
 .sssb-item{
 	text-align: center;
@@ -192,7 +192,7 @@
 	background: rgba(242, 242, 242, 0.5);
 	border-radius: 8rpx 8rpx 8rpx 8rpx;
 	margin:20rpx auto 0;
-	padding: 20rpx;
+	padding:40rpx 20rpx;
 }
 .sjyy-data-item{
 	text-align: center;

+ 59 - 24
pages/operationData/operationData.vue

@@ -3,15 +3,15 @@
 		<!-- tab -->
 		<view class="tab-box ddflex">
 			<view :class="'tab-item fflex '+(queryType==1?'tab-item-active':'')" @click="queryTypeChange(1)">
-				<view>我的收益</view>
+				<view>我的</view>
 				<image class="tab-active-icon" src="../../static/images/tab_cur.png"></image>
 			</view>
 			<view :class="'tab-item fflex '+(queryType==2?'tab-item-active':'')" @click="queryTypeChange(2)">
-				<view>商家营业额</view>
+				<view>商家</view>
 				<image class="tab-active-icon" src="../../static/images/tab_cur.png"></image>
 			</view>
 			<view :class="'tab-item fflex '+(queryType==3?'tab-item-active':'')" @click="queryTypeChange(3)">
-				<view>门店营业额</view>
+				<view>门店</view>
 				<image class="tab-active-icon" src="../../static/images/tab_cur.png"></image>
 			</view>
 		</view>
@@ -22,7 +22,7 @@
 			<!-- 图表统计 -->
 			<view class="echart-box">
 				<view class="echart-box-header ddflex">
-					<view class="echart-box-title">收益走势图</view>
+					<view class="echart-box-title">交易趋势</view>
 					<view class="echart-box-timeType ddflex">
 						<view :class="'echart-box-timeType-item '+(timeType==1?'echart-box-timeType-item-acitve':'')"
 							@click="timeTypeChange(1)">今日</view>
@@ -53,7 +53,7 @@
 						<view class="sssb-data">63889次</view>
 					</view>
 				</view>
-				<view class="sssb-box ddflex">
+				<!-- <view class="sssb-box ddflex">
 					<view class="sssb-item">
 						<view class="sssb-label">已下发</view>
 						<view class="sssb-data">509台</view>
@@ -63,7 +63,7 @@
 						<view class="sssb-label">总收益</view>
 						<view class="sssb-data sssb-color">92516元</view>
 					</view>
-				</view>
+				</view> -->
 			</view>
 
 			<!-- 图表统计 -->
@@ -72,14 +72,25 @@
 					<view class="echart-box-title">我的运营情况</view>
 				</view>
 				<view class="sssb-box ddflex">
-					<view class="sssb-item">
-						<view class="sssb-label">营业总额</view>
+					<view class="sssb-item fflex">
 						<view class="sssb-data sssb-color">867.00</view>
+						<view class="sssb-label">营业总额</view>
 					</view>
 					<view class="sssb-line"></view>
-					<view class="sssb-item">
+					<view class="sssb-item fflex">
+						<view class="sssb-data sssb-color">1915.00</view>
 						<view class="sssb-label">收益总额</view>
+					</view>
+				</view>
+				<view class="sssb-box ddflex">
+					<view class="sssb-item fflex">
+						<view class="sssb-data sssb-color">1915.00</view>
+						<view class="sssb-label">收益总额</view>
+					</view>
+					<view class="sssb-line"></view>
+					<view class="sssb-item fflex">
 						<view class="sssb-data sssb-color">1915.00</view>
+						<view class="sssb-label">可分账金额</view>
 					</view>
 				</view>
 				<view style="margin-top: 30rpx;height:500rpx">
@@ -116,14 +127,26 @@
 						</view>
 						<view class="sjyy-btn" @click="jumpUrl('/pages/operationDataPersonal/operationDataPersonal')">运营情况</view>
 					</view>
-					<view class="sjyy-data ddflex">
-						<view class="sjyy-data-item fflex">
-							<view class="sssb-data sssb-color">10242.00</view>
-							<view class="sssb-label">营业总额</view>
+					<view class="sjyy-data">
+						<view class="ddflex">
+							<view class="sjyy-data-item fflex">
+								<view class="sssb-data sssb-color">10242.00</view>
+								<view class="sssb-label">营业总额</view>
+							</view>
+							<view class="sjyy-data-item fflex">
+								<view class="sssb-data sssb-color">1242.00</view>
+								<view class="sssb-label">累计退款</view>
+							</view>
 						</view>
-						<view class="sjyy-data-item fflex">
-							<view class="sssb-data sssb-color">1915.00</view>
-							<view class="sssb-label">收益总额</view>
+						<view class="ddflex" style="margin-top: 40rpx;">
+							<view class="sjyy-data-item fflex">
+								<view class="sssb-data sssb-color">1915.00</view>
+								<view class="sssb-label">收益总额</view>
+							</view>
+							<view class="sjyy-data-item fflex">
+								<view class="sssb-data sssb-color">1915.00</view>
+								<view class="sssb-label">可分账金额</view>
+							</view>
 						</view>
 					</view>
 				</view>
@@ -153,18 +176,30 @@
 						</view>
 						<view class="sjyy-btn" @click="jumpUrl('/pages/operationDataPersonal/operationDataPersonal')">运营情况</view>
 					</view>
-					<view class="sjyy-data ddflex">
+					<view class="sjyy-data ddflex" style="padding: 20rpx;">
 						<image style="width: 26rpx;height: 26rpx;margin-right: 10rpx;" src="../../static/pages/images/address-icon.png"></image>
 						<view class="tover fflex" style="font-size: 24rpx;line-height: 36rpx;color: #A8A5A5;">朝阳区金台路道家园1号</view>
 					</view>
-					<view class="sjyy-data ddflex">
-						<view class="sjyy-data-item fflex">
-							<view class="sssb-data sssb-color">10242.00</view>
-							<view class="sssb-label">营业总额</view>
+					<view class="sjyy-data">
+						<view class="ddflex">
+							<view class="sjyy-data-item fflex">
+								<view class="sssb-data sssb-color">10242.00</view>
+								<view class="sssb-label">营业总额</view>
+							</view>
+							<view class="sjyy-data-item fflex">
+								<view class="sssb-data sssb-color">1242.00</view>
+								<view class="sssb-label">累计退款</view>
+							</view>
 						</view>
-						<view class="sjyy-data-item fflex">
-							<view class="sssb-data sssb-color">1915.00</view>
-							<view class="sssb-label">收益总额</view>
+						<view class="ddflex" style="margin-top: 40rpx;">
+							<view class="sjyy-data-item fflex">
+								<view class="sssb-data sssb-color">1915.00</view>
+								<view class="sssb-label">收益总额</view>
+							</view>
+							<view class="sjyy-data-item fflex">
+								<view class="sssb-data sssb-color">1915.00</view>
+								<view class="sssb-label">可分账金额</view>
+							</view>
 						</view>
 					</view>
 				</view>

+ 1 - 1
pages/operationDataPersonal/operationDataPersonal.css

@@ -86,7 +86,7 @@
 /* 实时设备数据 */
 .sssb-box{
 	justify-content: space-between;
-	padding: 30rpx 60rpx;
+	padding: 30rpx 30rpx;
 }
 .sssb-item{
 	text-align: center;

+ 14 - 3
pages/operationDataPersonal/operationDataPersonal.vue

@@ -6,15 +6,26 @@
 				<view class="echart-box-title">运营情况</view>
 			</view>
 			<view class="sssb-box ddflex">
-				<view class="sssb-item">
-					<view class="sssb-label">营业总额</view>
+				<view class="sssb-item fflex">
 					<view class="sssb-data sssb-color">867.00</view>
+					<view class="sssb-label">营业总额</view>
 				</view>
 				<view class="sssb-line"></view>
-				<view class="sssb-item">
+				<view class="sssb-item fflex">
+					<view class="sssb-data sssb-color">1915.00</view>
+					<view class="sssb-label">累计退款</view>
+				</view>
+			</view>
+			<view class="sssb-box ddflex">
+				<view class="sssb-item fflex">
 					<view class="sssb-label">收益总额</view>
 					<view class="sssb-data sssb-color">1915.00</view>
 				</view>
+				<view class="sssb-line"></view>
+				<view class="sssb-item fflex">
+					<view class="sssb-label">可分账金额</view>
+					<view class="sssb-data sssb-color">1915.00</view>
+				</view>
 			</view>
 			<view style="margin-top: 30rpx;height:500rpx">
 				<view class="echart-title">近一周营业额度(元)图表数据</view>

+ 24 - 408
pages/user/user.vue

@@ -4,12 +4,10 @@
 			<image src="/static/images/wdbg.png" class="wdbg"
 				@click="jumpUrl('mine/userinfo/userinfo')"></image>
 			<view class="minec">
-				<image :src="userInfos.avatar ? userInfos.avatar : '/static/pages/images/userimg.png'" mode="aspectFit"
+				<image :src="userInfos.avatar ? userInfos.avatar : '/static/images/userimg.png'" mode="aspectFit"
 					class="user" @click="jumpUrl('mine/userinfo/userinfo')"></image>
 				<view class="mines" @click="jumpUrl('mine/userinfo/userinfo')" v-if="isLogin">
 					<view class="ddflex">{{userInfos.nickName}}
-						<image :src="config.ordinary_member_icon" class="common-vip"
-							v-if="config.ordinary_member_icon&&!userinfovip.levelGrade"></image>
 					</view>
 					<text class="edu" v-if="userInfos.mobile">{{userInfos.mobile}}</text>
 				</view>
@@ -75,25 +73,9 @@
 
 			</view>
 		</view>
-		<!-- 注册成为会员 -->
-		<view class="mask" :hidden="isHide" @tap="hideRegister"></view>
-		<view class="regi" :hidden="isHide">
-			<view class="regi-tit">注册会员<image src="/static/pages/images/close1.png" class="regi-close"
-					@tap="hideRegister"></image>
-			</view>
-			<view class="phone dflex">
-				<input placeholder="手机号" placeholder-class="placeholder" class="flex"></input>
-				<button open-type="getPhoneNumber" @getphonenumber="getphonenumber" class="getphone dflex">
-					<image src="/static/pages/images/wxico.png"></image>一键获取
-				</button>
-			</view>
-			<view class="regi-btn">立即注册</view>
-		</view>
+		
 		<footer-copyright></footer-copyright>
-		<!-- <view class="placeholder-view" :style="'height:' + (bottomBlankHeignt + 115) + 'rpx'"></view> -->
 		<foot channel="user" :isUpdate="isUpdate"></foot>
-		<update-userinfo :update-info="isUpdateInfo" :update-mobile="isUpdateMobile" v-if="isShowUpdate" @closeUpdate="closeUpdate" @updateInfo="updateInfo" @updateMobile="updateMobile"></update-userinfo>
-		<!-- <web-view src="https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx86937a61b8d50977&redirect_uri=https%3a%2f%2fwebtest.tongyu99.com&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"></web-view> -->
 	</view>
 </template>
 
@@ -113,39 +95,10 @@
 				bottomBlankHeignt: app.globalData.isIPhoneX ? 68 : 0,
 				// merchantId: '',
 				iconSrc: req.public.iconSrc,
-				//头部页面背景链接
-				isUpdate: false,
-				// 是否更新消息
-				isHideVip: true,
-				//隐藏会员
-				isVip: true,
-				//是否是会员
-				isHide: true,
-				//是否隐藏注册会员弹窗
-				IS_secondary_members: 0,
-				distr: "",
-				userinfovip: "",
-				userMoney: "",
-				istetphone: "",
-				logo: "",
-				name: "",
-				is_open_wallet: "",
-				Open_Points_Mall: "",
-				statistics: "",
-				vipList: "",
-				rongkang: req.header.appId,
-				isSign: '',
-				sign: 0,
-				isLogin: false,
-				noLogin: false,
-				is_open_shop: '',
-				isShowSign: false, //是否显示签到按钮
-				config: {},
-				userInfos: {},
-				newsCount: 0,
-				isShowUpdate: false,//是否显示更新信息弹窗
-				isUpdateInfo: false,//更新用户信息
-				isUpdateMobile: false,//绑定手机号
+				
+				isLogin:false,
+				
+				userInfos: null,
 			};
 		},
 
@@ -156,59 +109,26 @@
 		props: {},
 
 		onLoad(options) {
-			app.globalData.getCheckSessoin(json => {
-				this.sessionKey = json.session_key;
-			});
-			uni.setNavigationBarColor({
-				frontColor: this.skinNotColor ? '#000' : '#ffffff',
-				backgroundColor: this.skinNotColor ? '#fff' : req.public.titleTopBgColor
-			});
-
-			if (JSON.parse(req.getStorage('configRes')).IS_secondary_members) {
-				let IS_secondary_members = JSON.parse(req.getStorage('configRes')).IS_secondary_members;
-				console.log(IS_secondary_members)
-				this.setData({
-					IS_secondary_members: IS_secondary_members
-				});
-			}
-			let userInfo = req.getStorage('userInfo');
-			if(req.isAuth()){
-				setTimeout(res=>{
-					if(!userInfo.avatar || userInfo.nickName == '微信用户' || this.userInfos.nickName == '微信用户'){
-						this.isShowUpdate = true
-						this.isUpdateInfo = true
-					}
-					if(userInfo.avatar&&!userInfo.mobile&&(this.userInfos&&!this.userInfos.mobile)){
-						this.isShowUpdate = true
-						this.isUpdateMobile = true
-					}
-				},2000)
+			
+			this.userInfos = req.getStorage('userInfo');
+			if(this.userInfos){
+				this.isLogin = true
+			}else{
+				this.isLogin = false
 			}
+			
 		},
 
 		onShow: function() {
 			this.setData({
 				isUpdate: !this.isUpdate
-			}); // let merchantId = req.getStorage('userInfo').merchantId
-			// this.setData({
-			//   merchantId: merchantId,
-			// })
-
-			// console.log(this.merchantId);
-			// this.getMy();
-			// this.getAbout();
-			// console.log(this.noLogin, 111111111111)
-			let userInfo = req.getStorage('userInfo');
-			// if (userInfo) this.isLogin = true;
-			this.isLogin = req.isAuth();
-			if (this.isLogin) {
-				this.getMy();
-				this.getNewsCount();
-				this.getAbout();
-				this.getRule();
-				this.noLogin = true;
-			} else {
-				this.noLogin = false;
+			});
+			this.userInfos = req.getStorage('userInfo');
+			if(this.userInfos){
+				this.isLogin = true
+				this.getUserInfo()
+			}else{
+				this.isLogin = false
 			}
 		},
 		methods: {
@@ -216,315 +136,11 @@
 				if (!req.isLogin()) return false;
 				app.globalData.navigateTo(url);
 			},
-
-			jumpMerchantManage() {
-				// jumpUrl('pages/web/web')
-				let token = req.getStorage('AUTH_TOKEN');
-				this.jumpUrl('merchant/index?appId=' + req.header.appId + '&token=' + token);
-			},
-			// 是否签到{}
-			isSignFun() {
-				req.getRequest('/api/integral/isSign', {}, res => {
-					this.setData({
-						isSign: res
-					});
-				});
-			},
-
-			gouserInfo() {
-				app.globalData.navigateTo('mine/userinfo/userinfo')
-			},
-			getDistributionConfig() {
-				req.postRequest('/api/distribution/config', {}, res => {
-					this.setData({
-						distr: res
-					});
-				});
-			},
-			// 签到
-			signFun() {
-				req.postRequest('/api/integral/sign', {}, data => {
-					if (data) {
-						req.msg('连续签到' + data.continuityDay + '天' + ',获得' + data.IntegralChange + '积分');
-						this.setData({
-							sign: 1
-						});
-						this.getOpenPonints();
-					}
-				});
-			},
-			getuserVip() {
-				req.getRequest('/api/user/levelDetails', {}, data => {
-					let expireTime = Array;
-
-					if (data.expireTime) {
-						expireTime = data.expireTime.split(" ");
-						data.expireTime = data.expireTime.replace(/-/g, '/');
-					} // 解决苹果不兼容---日期
-					// data.expireTime=data.expireTime.replace(/-/g, '/')
-
-
-					let nowTime = new Date().getTime();
-					let endTime = new Date(data.expireTime).getTime();
-					let times = parseInt((endTime - nowTime) / 1000); // var expireTime= new Date(data.expireTime)
-					// var time1=expireTime.getTime();
-
-					// console.log(times, nowTime, endTime, data.expireTime);
-					this.setData({
-						userinfovip: data,
-						['userinfovip.expireTime']: expireTime[0]
-					});
-
-					if (times <= 0) {
-						this.setData({
-							['userinfovip.end']: true
-						});
-					} else {
-						this.setData({
-							['userinfovip.end']: false
-						});
-					}
-
-					// console.log(data);
-				});
-			},
-			getOpenPonints() {
-				req.getRequest('/api/integral/returnIntegral', {}, res => {
-					this.setData({
-						integral: res
-					})
+			getUserInfo(){
+				req.getRequest('/admin/v2/userInfo',{},res=>{
+					
 				})
-			},
-			getMy() {
-				let that = this;
-				req.getRequest('/api/user/my', {}, data => {
-					// data.merchantId = req.getStorage('userInfo').merchantId
-					data.nickName = req.excludeSpecial(data.nickName);
-					this.userInfos = data;
-					let userInfo = req.getStorage('userInfo');
-					userInfo.isDistriUser = this.userInfos.isDistriUser;
-					req.setStorage('userInfo', userInfo);
-					// that.setData(data); // this.isbindmobile();
-					console.log('userinfo==' + JSON.stringify(data))
-					this.isSignFun();
-					this.getstatistics(data);
-					this.getDistributionConfig();
-					this.getuserVip();
-					this.getuserMoney();
-					this.getVip();
-					this.getOpenPonints();
-					// console.log(this);
-				});
-			},
-
-			getuserMoney() {
-				let is_open_wallet = JSON.parse(req.getStorage('configRes')).is_open_wallet;
-
-				if (is_open_wallet) {
-					if (JSON.parse(is_open_wallet).isOpenWallet == 1) {
-						route.extendNew({}, res => {
-							// console.log(parseFloat(res.all).toFixed(2));
-							if (res) this.setData({
-								userMoney: parseFloat(res.all).toFixed(2)
-							});
-						});
-					}
-				}
-			},
-			getNewsCount(){
-				req.getRequest('/api/v3/fabulous/countComment',{},res=>{
-					this.newsCount = res;
-				})
-			},
-
-			getAbout() {
-				var _this = this;
-
-				req.getRequest('/api/config', {}, function(res) {
-					_this.phone = res.CONFIG_SERVICE_HOT_MOBILE;
-					_this.config = res;
-					_this.setData({
-						istetphone: res.user_bind_mobile,
-						logo: res.CONFIG_PROJECT_LOGO,
-						name: res.CONFIG_PROJECT_TITLE
-					});
-
-					// console.log(res);
-					if (res && res.is_open_wallet) {
-						_this.setData({
-							is_open_wallet: JSON.parse(res.is_open_wallet)
-						});
-					}
-
-					if (res.is_open_shop) {
-						_this.is_open_shop = res.is_open_shop;
-					}
-
-					// if (res.user_bind_mobile == '1') {
-					// 	let userInfo = req.getStorage('userInfo');
-
-					// 	if (userInfo && (userInfo.mobile == null || userInfo.mobile == '')) {
-					// 		app.globalData.openPage('pages/authorize/authorize?bindmobile=1');
-					// 	}
-					// }
-				});
-				// 是否开启积分商城
-				req.getRequest('/api/params/value', {
-					type: 'Open_Points_Mall'
-				}, res => {
-					this.setData({
-						Open_Points_Mall: res
-					});
-				});
-			},
-
-			getphonenumber(event) {
-				const detail = event.detail;
-
-				const _ts = this;
-
-				if (!detail || !detail.encryptedData || !detail.iv) return false;
-				req.postRequest('/api/weixin/mobile', {
-					encryptedData: detail.encryptedData,
-					iv: detail.iv,
-					sessionKey: this.sessionKey
-				}, res => {
-					_ts.getMy();
-				});
-			},
-
-			callPhone() {
-				if (!req.isLogin()) return false;
-				uni.makePhoneCall({
-					phoneNumber: this.phone
-				});
-			},
-
-			showRegister() {
-				//显示注册会员弹窗
-				this.setData({
-					isHide: false
-				});
-			},
-
-			hideRegister() {
-				//隐藏注册会员弹窗
-				this.setData({
-					isHide: true
-				});
-			},
-
-			goUrl() {
-				app.globalData.openPage('mine/vip/vip');
-			},
-
-			// 门店统计
-			getstatistics(data) {
-				let from = {};
-
-				if (data.listShopBase && data.listShopBase != null && data.listShopBase.length > 0) {
-					from.shopId = data.listShopBase[0].id;
-				}
-
-				if (data.listMerchant && data.listMerchant != null && data.listMerchant.length > 0 && data.listShopBase
-					.length < 1) {
-					from.merchantId = data.listMerchant[0].id;
-				}
-
-				req.getRequest('/api/order/statistics', from, data => {
-					this.setData({
-						statistics: data
-					});
-					console.log(data);
-				});
-			},
-			getRule() {
-				let that = this;
-				req.getRequest('/api/integral/config', {}, res => {
-					if (res && res.length > 0) {
-						res.map(it => {
-							if (it.illustrate && it.illustrate.indexOf('签到') > -1) {
-								if (it.state == 2) {
-									that.isShowSign = true;
-								}
-							}
-						})
-					}
-				})
-			},
-			getVipListOrg() {
-				if (this.vipList && this.userinfovip) {
-					if(!this.userinfovip.levelGrade){
-						this.vipList.map((it,index)=>{
-							this.vipList[0].isShowInfo = true;
-						})
-					}else{
-						this.vipList.map((it,index)=>{
-							if(this.userinfovip.level == it.id){
-								if(index < this.vipList.length-1){
-									this.vipList[index+1].isShowInfo = true;
-								}
-							}
-						})
-					}
-				}
-			},
-			getVip() {
-				req.getRequest('/api/levelStrategy/userLevelList', {}, data => {
-					if (data && data.length > 0) {
-						data.map((it,index) => {
-							it.upgradeTerm = JSON.parse(it.upgradeTerm)
-							it.isShowInfo = false
-							// if(index == 0) it.isShowInfo = true;
-							return it;
-						})
-						this.vipList = data
-						this.getVipListOrg();
-					}
-				});
-			},
-			showInfo(index) {
-				if(!this.vipList[index].isShowInfo){
-					this.vipList.map(it=>{
-						it.isShowInfo = false;
-						return it
-					})
-				}
-				this.vipList[index].isShowInfo = !this.vipList[index].isShowInfo
-			},
-			closeUpdate(){
-				this.isShowUpdate = false
-			},
-			updateInfo(e){
-				this.isUpdateInfo = e
-				this.getMy()
-			},
-			updateMobile(e){
-				this.isUpdateMobile = e
-				this.getMy()
-			},
-			// 判断强制绑定手机号
-			// isbindmobile() {
-			//   if (req.getStorage('configRes')) {
-			//     let configRes = JSON.parse(req.getStorage('configRes'))
-			//     this.setData({ istetphone: configRes.user_bind_mobile, logo: configRes.CONFIG_PROJECT_LOGO, name: configRes.CONFIG_PROJECT_TITLE })
-			//   } else {
-			//     req.g('/api/config', (res) => {
-			//       req.setStorage('configRes', JSON.stringify(res))
-			//       this.setData({ istetphone: res.user_bind_mobile, logo: res.CONFIG_PROJECT_LOGO, name: res.CONFIG_PROJECT_TITLE })
-			//     })
-			//   }
-			//   if(this.data.istetphone=='1'){
-			//       // 获取用户手机号
-			//     let userInfo= req.getStorage('userInfo')
-			//     if(userInfo.mobile==null||userInfo.mobile==''){
-			//       console.log("获取用户手机号===============================")
-			//       app.openPage('pages/authorize/authorize?bindmobile=1')
-			//     }
-			//   }
-			// },
-
-
+			}
 		}
 	};
 </script>

+ 71 - 32
utils/request.js

@@ -1,6 +1,6 @@
 const app = getApp();
 const env = {
-	NODE_ENV: 'dev',
+	NODE_ENV: 'pota',
 	dev: {
 		apiUrl: 'https://apitest.zhiqiyun.com'
 	},
@@ -49,21 +49,30 @@ const getToken = (success) => {
 }
 const loadToken = (success) => {
 	let that = this
-	uni.request({
-		url: env[env.NODE_ENV].apiUrl + '/api/access_token',
-		data: {},
-		method: 'get',
-		header: header,
-		success(json) {
-			if (json.statusCode !== 200) return msg(json.data.message);
-			if (json.data.code !== 0) return msg(json.data.msg)
-			setStorage('AUTH_TOKEN', json.data.data);
-			success.call(that, json.data.data);
-		},
-		fail() {
-			msg('access_token 获取失败');
-		}
-	})
+	// uni.request({
+	// 	url: env[env.NODE_ENV].apiUrl + '/api/access_token',
+	// 	data: {},
+	// 	method: 'get',
+	// 	header: header,
+	// 	success(json) {
+	// 		if (json.statusCode !== 200) return msg(json.data.message);
+	// 		if (json.data.code !== 0) return msg(json.data.msg)
+	// 		setStorage('AUTH_TOKEN', json.data.data);
+	// 		success.call(that, json.data.data);
+	// 	},
+	// 	fail() {
+	// 		msg('access_token 获取失败');
+	// 	}
+	// })
+	let token = getStorage('AUTH_TOKEN');
+	if (token) {
+		success.call(this, token);
+		return false;
+	} else {
+		msg('access_token 获取失败');
+		return redirectIndex();
+	}
+	
 }
 
 /**
@@ -176,14 +185,9 @@ const clearValueEmpty = (data) => {
  * @param {*} isLoad 是否显示加载提示
  */
 const baseRequest = (url, data, method, success, isLoad) => {
-	getToken(token => {
+	if(url=='/admin/v2/login'){
 		if (!isLoad) uni.showNavigationBarLoading();
-		header.authorityToken = token;
-		if (url.indexOf('/v3') != -1 || url.indexOf('/paper/create') != -1) {
-			header['content-type'] = 'application/json;charset=UTF-8'
-		} else {
-			header['content-type'] = 'application/x-www-form-urlencoded'
-		}
+		header['content-type'] = 'application/json;charset=UTF-8'
 		uni.request({
 			url: env[env.NODE_ENV].apiUrl + url,
 			data: clearValueEmpty(data),
@@ -194,7 +198,7 @@ const baseRequest = (url, data, method, success, isLoad) => {
 				if (json.statusCode !== 200) return msg(json.data.message);
 				if (json.data.code === 10021 || json.data.code === 10020) {
 					// console.log("第二次执行")
-
+		
 					removeStorage('AUTH_TOKEN');
 					return redirectIndex();
 				}
@@ -211,11 +215,46 @@ const baseRequest = (url, data, method, success, isLoad) => {
 			fail() {
 				if (!isLoad) uni.hideNavigationBarLoading();
 			},
-			// complete(){
-			//  success.call(this, data);
-			// },
 		})
-	})
+	}
+	else{
+		getToken(token => {
+			if (!isLoad) uni.showNavigationBarLoading();
+			header.authorityToken = token;
+			header['content-type'] = 'application/json;charset=UTF-8'
+			uni.request({
+				url: env[env.NODE_ENV].apiUrl + url,
+				data: clearValueEmpty(data),
+				method: method,
+				header: header,
+				success(json) {
+					if (!isLoad) uni.hideNavigationBarLoading();
+					if (json.statusCode !== 200) return msg(json.data.message);
+					if (json.data.code === 10021 || json.data.code === 10020) {
+						// console.log("第二次执行")
+		
+						removeStorage('AUTH_TOKEN');
+						return redirectIndex();
+					}
+					if (json.data.code !== 0) {
+						return msg(json.data.msg)
+					}
+					// console.log("第二次执行")
+					let data = json.data.data;
+					if (typeof data === 'string' && data.indexOf("{") === 0) {
+						data = JSON.parse(data);
+					}
+					success.call(this, data);
+				},
+				fail() {
+					if (!isLoad) uni.hideNavigationBarLoading();
+				},
+				// complete(){
+				//  success.call(this, data);
+				// },
+			})
+		})
+	}
 }
 
 const loadIng = (msg) => {
@@ -227,22 +266,22 @@ const loadIng = (msg) => {
 
 /**POST请求 */
 const postRequest = (url, data, success, isLoad) => {
-	header['content-type'] = 'application/x-www-form-urlencoded'
+	header['content-type'] = 'application/json;charset=UTF-8'
 	baseRequest(url, data, 'post', success, isLoad);
 }
 const postRequestLoding = (url, data, success, isLoding) => {
-	header['content-type'] = 'application/x-www-form-urlencoded'
+	header['content-type'] = 'application/json;charset=UTF-8'
 	baseRequest(url, data, 'post', success, false, isLoding);
 }
 
 /**GET请求 */
 const getRequest = (url, data, success, isLoad) => {
-	header['content-type'] = 'application/x-www-form-urlencoded'
+	header['content-type'] = 'application/json;charset=UTF-8'
 	baseRequest(url, data, 'get', success, isLoad);
 }
 /**Put请求 */
 const putRequest = (url, data, success, isLoad) => {
-	header['content-type'] = 'application/x-www-form-urlencoded'
+	header['content-type'] = 'application/json;charset=UTF-8'
 	baseRequest(url, data, 'put', success, isLoad)
 }
 const putRequestJson = (url, data, success, isLoad) => {