liujd 6 лет назад
Родитель
Сommit
bd113a174a

+ 1 - 0
mobile-code/src/filters/index.js

@@ -26,6 +26,7 @@ Vue.filter('default_img', function(url) {
 
 Vue.filter('default_avatar', function(url) {
 	if (!url) {
+		console.log('url')
 		return require('@/static/images/user/attr-default.png')
 	}
 	return url

+ 12 - 0
mobile-code/src/mixins/globalMixins.js

@@ -27,12 +27,24 @@ export default {
 		if (option.account) {
 			uni.setStorageSync('account', option.account)
 		}
+		if (constant.source == 'mobile') {
+			if (option.shopId) {
+				uni.setStorageSync('shopId', option.shopId)
+			}
+		}
 		uni.setStorageSync('currentQuery', JSON.stringify(option))
 		// 登录
 		if (constant.source == 'business' || constant.source == 'mobile') {
 			if (isLogin()) {
 				if (this.init) {
+					// #ifdef H5
 					this.init()
+					// #endif
+					// #ifdef MP-WEIXIN
+					wxLoginFn().then(res => {
+						this.init()
+					})
+					// #endif
 					// console.log('init', this.init)
 				}
 			} else {

+ 26 - 12
mobile-code/src/pages/home/components/login-popup.vue

@@ -10,7 +10,7 @@
 			<!-- 获取手机号 -->
 			<template v-if="stepIndex == 0">
 				<div class="popup-attr-wrap">
-					<img :src="`${constant.imgUrl}/retail/user/attr-default.png`" mode="widthFix" alt />
+					<img :src="info.smallAvatarUrl" mode="widthFix" alt />
 				</div>
 				<!-- #ifdef H5 -->
 				<div class="creat-account-btn">
@@ -19,7 +19,7 @@
 				<!-- #endif -->
 				<!-- #ifdef MP-WEIXIN -->
 				<div class="creat-account-btn">
-					<button class="button-com red big mini-btn" open-type="getUserInfo" @getuserinfo="getWxAvatar" :plain="true">点击创建头像</button>
+					<button class="button-com red big mini-btn" open-type="getPhoneNumber" @getphonenumber="getWxMobile" :plain="true">点击创建头像</button>
 				</div>
 				<!-- #endif -->
 			</template>
@@ -29,16 +29,20 @@
 					<div class="phone-icon">
 						<i class="iconfont iconshoujihao"></i>
 					</div>
-					<div class="phone-num font-bold">13285979347</div>
+					<div class="phone-num font-bold">{{ wxPhoneInfo }}</div>
 				</div>
 				<div class="creat-account-btn">
-					<button class="button-com red big mini-btn" open-type="getPhoneNumber" @getphonenumber="getWxMobile" :plain="true">点击创建头像</button>
+					<button class="button-com red big" @click="attentionPublish">点击创建头像</button>
+					<!-- <button class="button-com red big mini-btn" open-type="getPhoneNumber" @getphonenumber="getWxMobile" :plain="true">点击创建头像</button> -->
 				</div>
 			</template>
 			<!-- 关注公众号 -->
 			<template v-if="stepIndex == 2">
 				<div class="wx-public-wrap">
-					<div class="app-color-3">国兰华尚关联的公众号</div>
+					<!-- #ifdef MP-WEIXIN -->
+					<official-account></official-account>
+					<!-- #endif -->
+					<!-- <div class="app-color-3">国兰华尚关联的公众号</div>
 					<div class="flex-center-between">
 						<div class="wx-public-left">
 							<div class="wx-public-img">
@@ -50,7 +54,7 @@
 							</div>
 						</div>
 						<button class="button-com wx-public-btn">查看</button>
-					</div>
+					</div> -->
 				</div>
 			</template>
 		</div>
@@ -62,7 +66,7 @@ import AppStep from '@/components/app-step'
 import BottomPopup from '@/components/plugin/bottom-popup'
 import AppClose from '@/components/module/app-close'
 // api
-import { getUser } from '@/utils/auth'
+import { getUser, wxLoginFn } from '@/utils/auth'
 import { getWxPhone } from '@/api/mini'
 export default {
 	name: 'login-popup-module',
@@ -72,10 +76,10 @@ export default {
 		AppClose
 	},
 	props: {
-		stepIndex: {
-			type: Number,
-			default: 0
-		},
+		// stepIndex: {
+		// 	type: Number,
+		// 	default: 0
+		// },
 		show: {
 			type: Boolean,
 			default: false
@@ -87,12 +91,15 @@ export default {
 	},
 	data() {
 		return {
-			constant: this.$constant
+			constant: this.$constant,
+			stepIndex: 0,
+			wxPhoneInfo: ''
 		}
 	},
 	methods: {
 		hidePopup() {
 			this.$emit('hide')
+			this.stepIndex = 0
 		},
 		registerFn() {
 			this.$util.getCheckLogin()
@@ -102,10 +109,17 @@ export default {
 			if (e.detail.errMsg === 'getPhoneNumber:ok') {
 				getWxPhone({ iv: e.detail.iv, encryptedData: e.detail.encryptedData }).then(res => {
 					console.log('用户信息', res)
+					this.wxPhoneInfo = res.data.mobile
+					this.stepIndex = 1
+					wxLoginFn(true)
 				})
 			} else {
 				this.$msg('获取信息失败!')
 			}
+		},
+		// 关注公众号
+		attentionPublish() {
+			this.stepIndex = 2
 		}
 	}
 }

+ 4 - 4
mobile-code/src/pages/home/shop.vue

@@ -7,13 +7,13 @@
 		</div>
 		<div class="list-content">
 			<tui-list-view class="tui-list-view">
-				<tui-list-cell :lineLeft="false" :lineRight="false" class="tui-list">
+				<tui-list-cell :lineLeft="false" :lineRight="false" padding="26rpx 30rpx 26rpx 0" class="tui-list">
 					<div class="list-wrap">
 						<div class="list-label">营业时间</div>
 						<div class="list-val">{{ shop.openTime || '暂无' }}</div>
 					</div>
 				</tui-list-cell>
-				<tui-list-cell @click="phoneCall" :lineLeft="false" :lineRight="false" class="tui-list">
+				<tui-list-cell @click="phoneCall" :lineLeft="false" :lineRight="false" padding="26rpx 30rpx 26rpx 0" class="tui-list">
 					<div class="list-wrap">
 						<div class="list-label">联系电话</div>
 						<div class="list-val">{{ shop.telephone || '暂无' }}</div>
@@ -22,7 +22,7 @@
 						<i class="iconfont iconditu"></i>
 					</div>
 				</tui-list-cell>
-				<tui-list-cell @click="goNavBtn" :lineLeft="false" :lineRight="false" class="tui-list">
+				<tui-list-cell @click="goNavBtn" :lineLeft="false" :lineRight="false" padding="26rpx 30rpx 26rpx 0" class="tui-list">
 					<div class="list-wrap">
 						<div class="list-label">门店地址</div>
 						<div class="list-val">{{ shop.shopFullAddress || '暂无' }}</div>
@@ -127,7 +127,7 @@ export default {
 		.tui-list {
 			width: calc(100% - 20px);
 			@include disFlex(center, space-between);
-			padding-left: 0 !important;
+			// padding-left: 0 !important;
 			margin-left: 20px;
 			.list-wrap {
 				width: calc(100% - 40px);

+ 7 - 4
mobile-code/src/pages/home/user.vue

@@ -29,7 +29,7 @@
 							</div>
 						</div>
 						<div class="user-blo-right login-attr-wrap">
-							<img :src="shopUser.smallAvatarUrl | default_avatar" alt="头像" mode="widthFix" />
+							<img :src="smallAvatarUrl | default_avatar" alt="头像" mode="widthFix" />
 						</div>
 					</div>
 					<div class="user-wrap-bottom">
@@ -50,7 +50,7 @@
 					<button class="button-com" v-if="shopUser.isFull != 1" @click="showPopup">申请会员</button>
 					<!-- #endif -->
 					<!-- #ifdef MP-WEIXIN -->
-					<button class="button-com mini-btn" open-type="getUserInfo" v-if="shopUser.isFull != 1" @getuserinfo="getWxAvatar">申请会员</button>
+					<button class="button-com mini-btn" open-type="getUserInfo" v-if="loginInfo.isFull != 1" @getuserinfo="getWxAvatar">申请会员</button>
 					<!-- #endif -->
 					<button class="button-com" @click="pageToFn({
 					url: '/pages/pay/index',
@@ -150,8 +150,11 @@ export default {
 	computed: {
 		...mapGetters({ shopUser: 'getShopUser' }),
 		// #ifdef MP-WEIXIN
-		...mapGetters({ loginInfo: 'getLoginInfo' })
+		...mapGetters({ loginInfo: 'getLoginInfo' }),
 		// #endif
+		smallAvatarUrl() {
+			return this.shopUser.smallAvatarUrl || ''
+		}
 	},
 	onLoad(option) {
 		// this.init()
@@ -196,7 +199,7 @@ export default {
 					this.popupShow = true
 					getWxInfo({ iv: res.iv, encryptedData: res.encryptedData }).then(subRes => {
 						console.log('用户信息', subRes)
-						this.wxInfo = subRes
+						this.wxInfo = subRes.data
 						this.popupShow = true
 					})
 				},

+ 6 - 0
mobile-code/src/plugins/luch-request_0.0.7/request.js

@@ -90,6 +90,12 @@ class Request {
 		if (source) {
 			config.header['source'] = source
 		}
+		if (constant.source == 'mobile') {
+			const shopId = uni.getStorageSync('shopId') || 0
+			if (shopId) {
+				config.header['shopId'] = shopId
+			}
+		}
 		if (config.config.loading) {
 			uni.showLoading({
 				title: '',