cmy 1 éve
szülő
commit
6db7ca8df1

+ 75 - 26
App.vue

@@ -12,7 +12,8 @@
 	import Auth from '@/libs/wechat.js';
 	import Routine from './libs/routine.js';
 	import {
-		colorChange
+		colorChange,
+		get_openid
 	} from '@/api/api.js';
 	import {
 		mapGetters
@@ -31,10 +32,12 @@
 	let orange =
 		'--view-theme: #FE5C2D;--view-priceColor:#FE5C2D;--view-minorColor:rgba(254, 92, 45, 0.5);--view-minorColorT:rgba(254, 92, 45, 0.1);--view-bntColor:#FDB000;--view-assistColor:#FDB000;'
 	let gold =
-	    '--view-theme: #E0A558;--view-priceColor:#DA8C18;--view-minorColor:rgba(224, 165, 88, 0.5);--view-minorColorT:rgba(224, 165, 88, 0.1);--view-bntColor:#1A1A1A;'
-		// #ifdef APP
-	import { getUpApp } from './utils/upApp.js';
-		// #endif
+		'--view-theme: #E0A558;--view-priceColor:#DA8C18;--view-minorColor:rgba(224, 165, 88, 0.5);--view-minorColorT:rgba(224, 165, 88, 0.1);--view-bntColor:#1A1A1A;'
+	// #ifdef APP
+	import {
+		getUpApp
+	} from './utils/upApp.js';
+	// #endif
 
 	export default {
 		globalData: {
@@ -65,7 +68,7 @@
 				if (newCart > 0) {
 					uni.setTabBarBadge({
 						index: 3,
-						text: newCart>99?'99+':newCart+''
+						text: newCart > 99 ? '99+' : newCart + ''
 					})
 				} else {
 					uni.hideTabBarRedDot({
@@ -75,10 +78,36 @@
 			}
 		},
 		onLaunch: async function(option) {
+			let that = this;
+			// #ifdef H5
+			let openid = uni.getStorageSync('openid')||false;
+			if (this.$wechat.isWeixin()&&!openid) {
+				if (!option.query.code) {
+					that.openUrlWeixin();
+					return;
+				} else {
+					let code = '';
+					if (option.query.code instanceof Array) {
+						code = option.query.code[option.query.code.length - 1]
+					} else {
+						code = option.query.code
+					}
+					let res = await get_openid({
+						code: code,
+					}).then((re) => {
+						// 保存openid
+						uni.setStorageSync('openid', re.data.openid);
+					}).catch(error => {
+						console.log(error,'error');
+						// that.openUrlWeixin()
+						uni.hideLoading();
+					});
+				}
+			}
+			// #endif
 			//#ifdef APP
 			plus.screen.lockOrientation("portrait-primary");
 			//#endif
-			let that = this;
 			colorChange('color_change').then(res => {
 				let navigation = res.data.navigation; //判断悬浮导航是否显示
 				let statusColor = res.data.status; //判断显示啥颜色
@@ -145,7 +174,6 @@
 				return false;
 			}
 			if (option.query.hasOwnProperty('scene')) {
-
 				switch (option.scene) {
 					//扫描小程序码
 					case 1047:
@@ -208,14 +236,16 @@
 			} else {
 				this.globalData.isIframe = false;
 			}
-
+			console.log(window.location.pathname, this.isWork(), '66666');
 			if (window.location.pathname !== '/' && !this.isWork()) {
+				console.log('静茹');
 				let snsapiBase = 'snsapi_base';
 				let urlData = location.pathname + location.search;
 				if (!that.$store.getters.isLogin && uni.getStorageSync('authIng')) {
 					uni.setStorageSync('authIng', false)
 				}
 				if (!that.$store.getters.isLogin && Auth.isWeixin()) {
+					console.log('code');
 					let code,
 						state,
 						scope = ''
@@ -236,6 +266,8 @@
 								code: code,
 								snsapi: 'snsapi_base',
 								spread_spid: that.$Cache.get('spid')
+							}).then((re) => {
+								console.log(re, 're');
 							}).catch(error => {
 								uni.hideLoading()
 								return this.$util.Tips({
@@ -256,8 +288,7 @@
 								this.$store.commit('SETUID', res.data.userInfo.uid);
 								this.$store.commit('UPDATE_USERINFO', res.data.userInfo);
 								if (option.query.back_url) {
-									location.replace(decodeURIComponent(decodeURIComponent(option.query
-										.back_url)));
+									location.replace(decodeURIComponent(decodeURIComponent(option.query.back_url)));
 								}
 							}
 						} catch (e) {
@@ -330,6 +361,23 @@
 			// }, 100)
 		},
 		methods: {
+			// 打开微信链接
+			openUrlWeixin() {
+				const appid = 'wxceb554336d5e17f3'
+				// 判断是否真实路由模式
+				let ul = encodeURIComponent(window.location.protocol + '//' + window.location.host + window.location
+					.pathname);
+				// 打开微信授权页面
+				let url =
+					'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' +
+					appid +
+					'&redirect_uri=' +
+					ul +
+					'&response_type=code&scope=snsapi_base&state=' +
+					new Date().getTime() +
+					'#wechat_redirect';
+				window.location.href = url;
+			},
 			// 小程序静默授权
 			silenceAuth(code) {
 				let that = this;
@@ -353,7 +401,7 @@
 					})
 					.catch(err => {
 						return that.$util.Tips({
-							title:err
+							title: err
 						})
 					});
 			},
@@ -367,7 +415,7 @@
 			 */
 			checkUpdateVersion() {
 				//判断微信版本是否 兼容小程序更新机制API的使用
-				if (wx.canIUse('getUpdateManager')) { 
+				if (wx.canIUse('getUpdateManager')) {
 					const updateManager = wx.getUpdateManager();
 					//检测版本更新
 					updateManager.onCheckForUpdate(function(res) {
@@ -424,19 +472,19 @@
 	page {
 		font-family: PingFang SC;
 	}
-	
-	.activityFrame{
-			background-size: 100% 100%;
-			background-repeat: no-repeat;
-			position: absolute;
-			top:0;
-			left:0;
-			width: 100%;
-			height: 100%;
-			z-index: 1;
+
+	.activityFrame {
+		background-size: 100% 100%;
+		background-repeat: no-repeat;
+		position: absolute;
+		top: 0;
+		left: 0;
+		width: 100%;
+		height: 100%;
+		z-index: 1;
 	}
-	
-	.placeholder{
+
+	.placeholder {
 		color: #ccc;
 	}
 
@@ -468,5 +516,6 @@
 		top: 0;
 		bottom: 0;
 	}
+
 	/* #endif */
-</style>
+</style>

+ 5 - 0
api/api.js

@@ -64,6 +64,11 @@ export function setFormId(formId) {
 	});
 }
 
+// 获取openid
+export function get_openid(data) {
+	return request.get("v2/wechat/get_openid", data);
+}
+
 /**
  * 领取优惠卷
  * @param int couponId

+ 3 - 1
components/payment/index.vue

@@ -106,7 +106,7 @@
 		methods: {
 			payType(number, paytype, index) {
 				this.active = index;
-				console.log(this.active,'this.active');
+				// console.log(this.active,'this.active');
 				this.paytype = paytype;
 				this.number = number;
 				this.$emit('changePayType', paytype)
@@ -117,6 +117,8 @@
 				});
 			},
 			goPay: function(number, paytype) {
+				// console.log(paytype,'action0');
+				// console.log(this.isCall,'action1');
 				if (this.isCall) {
 					return this.$emit('onChangeFun', {
 						action: 'payCheck',

+ 19 - 18
libs/login.js

@@ -64,31 +64,32 @@ function _toLogin(push, pathLogin) {
 	path = location.pathname + location.search;
 	// #endif
 
-	if (!pathLogin)
+	if (!pathLogin){
 		pathLogin = '/page/users/login/index'
 	Cache.set('login_back_url', path);
+	}
 	let wechatStatus = uni.getStorageSync('wechatStatus');
 	// #ifdef H5
-	if (isWeixin() && wechatStatus) {
-		let urlData = location.pathname + location.search
-		if (urlData.indexOf('?') !== -1) {
-			urlData += '&go_longin=1';
-		} else {
-			urlData += '?go_longin=1';
-		}
-		if (!Cache.has('snsapiKey')) {
-			auth.oAuth('snsapi_base', urlData);
-		} else {
-			uni.navigateTo({
-				url: '/pages/users/wechat_login/index',
-			});
-		}
-
-	} else {
+	// if (isWeixin() && wechatStatus) {
+	// 	let urlData = location.pathname + location.search
+	// 	if (urlData.indexOf('?') !== -1) {
+	// 		urlData += '&go_longin=1';
+	// 	} else {
+	// 		urlData += '?go_longin=1';
+	// 	}
+	// 	if (!Cache.has('snsapiKey')) {
+	// 		auth.oAuth('snsapi_base', urlData);
+	// 	} else {
+	// 		uni.navigateTo({
+	// 			url: '/pages/users/wechat_login/index',
+	// 		});
+	// 	}
+
+	// } else {
 		uni.navigateTo({
 			url: '/pages/users/login/index'
 		})
-	}
+	// }
 	// #endif
 
 	// #ifdef MP 

+ 2 - 2
manifest.json

@@ -2,8 +2,8 @@
     "name" : "壹柒智能",
     "appid" : "__UNI__70BC0AE",
     "description" : "壹柒智能",
-    "versionName" : "2.7.7",
-    "versionCode" : 277,
+    "versionName" : "2.8.0",
+    "versionCode" : 280,
     "transformPx" : false,
     /* 5+App特有相关 */
     "app-plus" : {

+ 10 - 0
pages/goods/order_confirm/index.vue

@@ -944,7 +944,9 @@
 				let opt = e;
 				let action = opt.action || null;
 				let value = opt.value != undefined ? opt.value : null;
+				console.log(action,'action');
 				action && this[action] && this[action](value);
+				
 			},
 			payClose: function() {
 				this.pay_close = false;
@@ -1883,6 +1885,14 @@
 					quitUrl: '/pages/goods/order_details/index?order_id=' + this.order_id
 					// #endif
 				};
+				// #ifdef H5
+				if(that.payType=='weixin'){
+					data.openid = uni.getStorageSync('openid')||false;
+					if(!data.openid){
+						window.location.reload();
+					}
+				}
+				// #endif
 				if (data.payType == 'yue' && parseFloat(that.userInfo.now_money) < parseFloat(that.totalPrice))
 					return that.$util.Tips({
 						title: '余额不足!'

+ 21 - 13
pages/users/login/index.vue

@@ -12,7 +12,7 @@
 					<view :class="current == 0 ? 'line' : 'none'"></view>
 				</view>
 				<view class="tips-btn" :class="current == 1 ? 'on' : ''" @click="current = 1">
-					<view>注册登录</view>
+					<view>注册账号</view>
 					<view :class="current == 1 ? 'line' : 'none'"></view>
 				</view>
 			</view>
@@ -42,13 +42,19 @@
 						<input type="text" placeholder="输入手机号码" v-model="account" maxlength="11" />
 					</view>
 				</view>
+				<view class="item">
+					<view class="acea-row row-middle">
+						<image src="../static/code_1.png" class="item-img"></image>
+						<input type="password" placeholder="填写登录密码" v-model="password" required />
+					</view>
+				</view>
 				<view class="item">
 					<view class="acea-row row-middle">
 						<image src="../static/phone_1.png" class="itemImg-add"></image>
 						<input type="text" placeholder="输入邀请码" v-model="spread_spid" maxlength="11" />
 					</view>
 				</view>
-				<view class="item">
+				<!-- <view class="item">
 					<view class="acea-row row-middle">
 						<image src="../static/code_2.png" class="item-img"></image>
 						<input type="text" placeholder="填写验证码" maxlength="6" class="codeIput" v-model="captcha" />
@@ -56,7 +62,7 @@
 							{{ text }}
 						</button>
 					</view>
-				</view>
+				</view> -->
 <!-- 				<view class="item" v-if="isShowCode">
 					<view class="acea-row row-middle">
 						<image src="../static/code_2.png" class="item-img"></image>
@@ -65,8 +71,8 @@
 					</view>
 				</view> -->
 			</view>
-			<view class="logon" @click="loginMobile" v-if="current !== 0">登录</view>
 			<view class="logon" @click="submit" v-if="current === 0">登录</view>
+			<view class="logon" @click="register" v-if="current !== 0">注册</view>
 			<!-- #ifdef H5 -->
 			<view class="logon" @click="domApp" style="margin-top: 20rpx;">下载APP</view>
 			<!-- #endif -->
@@ -564,12 +570,12 @@
 				if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.account)) return that.$util.Tips({
 					title: '请输入正确的手机号码'
 				});
-				if (!that.captcha) return that.$util.Tips({
-					title: '请填写验证码'
-				});
-				if (!/^[\w\d]+$/i.test(that.captcha)) return that.$util.Tips({
-					title: '请输入正确的验证码'
-				});
+				// if (!that.captcha) return that.$util.Tips({
+				// 	title: '请填写验证码'
+				// });
+				// if (!/^[\w\d]+$/i.test(that.captcha)) return that.$util.Tips({
+				// 	title: '请输入正确的验证码'
+				// });
 				if (!that.password) return that.$util.Tips({
 					title: '请填写密码'
 				});
@@ -578,15 +584,17 @@
 				});
 				register({
 						account: that.account,
-						captcha: that.captcha,
+						// captcha: that.captcha,
+						captcha: 123456,
 						password: that.password,
-						spread_spid: that.$Cache.get("spid")
+						spread_spid: that.spread_spid
 					})
 					.then(res => {
 						that.$util.Tips({
-							title: res
+							title: res.msg
 						});
 						that.formItem = 1;
+						that.current = 0
 					})
 					.catch(res => {
 						that.$util.Tips({

+ 24 - 19
pages/users/user_cash/index.vue

@@ -113,25 +113,30 @@
 								</picker>
 							</view>
 						</view>
-						<view class='tip'>
-							当前可提现佣金: <text
-								class="price">¥{{userInfo.commissionCount}}</text>,冻结佣金:¥{{userInfo.broken_commission}}
-						</view>
-						<view class='tip'>
-							当前可提现奖金: <text class="price">¥{{userInfo.brokerage_integral}}</text>
-						</view>
-						<view class='tip'>
-							提现手续费: <text class="price">{{withdraw_fee}}%</text>
-						</view>
-						<view class='tip'>
-							到账复投积分: <text class="price">{{true_int}}</text>,到账余额:<text class="price">{{true_ye}}</text>
-						</view>
-						<view class='tip'>
-							实际到账:<text class="price">¥{{true_money}}</text>
-						</view>
-						<view class='tip'>
-							说明: 每笔佣金的冻结期为{{userInfo.broken_day}}天,到期后可提现
-						</view>
+						<template v-if="typeMoneyIndex==0">
+							<view class='tip' >
+								当前可提现佣金: <text
+									class="price">¥{{userInfo.commissionCount}}</text>,冻结佣金:¥{{userInfo.broken_commission}}
+							</view>
+							<view class='tip'>
+								提现手续费: <text class="price">{{withdraw_fee}}%</text>
+							</view>
+							<view class='tip'>
+								到账复投积分: <text class="price">{{true_int}}</text>,到账余额:<text class="price">{{true_ye}}</text>
+							</view>
+							<view class='tip'>
+								实际到账:<text class="price" >¥{{true_money}}</text>
+							</view>
+							<view class='tip'>
+								说明: 每笔佣金的冻结期为{{userInfo.broken_day}}天,到期后可提现
+							</view>
+						</template>
+						<template v-if="typeMoneyIndex==1">
+							<view class='tip' v-if="typeMoneyIndex==1">
+								当前可提现奖金: <text class="price">¥{{userInfo.brokerage_integral}}</text>
+							</view>
+						</template>
+						
 						<button formType="submit" class='bnt bg-color'>提现</button>
 					</form>
 				</view>

+ 2 - 2
vue.config.js

@@ -1,11 +1,11 @@
 module.exports = {
-	productionSourceMap: false, // 生产打包时不输出map文件,增加打包速度
+	productionSourceMap: true, // 生产打包时不输出map文件,增加打包速度
 	configureWebpack: config => {
 		if (process.env.NODE_ENV === 'production') {
 			config.optimization.minimizer[0].options.terserOptions.compress.warnings = false
 			config.optimization.minimizer[0].options.terserOptions.compress.drop_console = true
 			config.optimization.minimizer[0].options.terserOptions.compress.drop_debugger = true
-			config.optimization.minimizer[0].options.terserOptions.compress.pure_funcs = ['console.log']
+			// config.optimization.minimizer[0].options.terserOptions.compress.pure_funcs = ['console.log']
 		}
 	}
 }