Browse Source

10-13-index-store

lhl 3 years ago
parent
commit
4e302af2d2
7 changed files with 55 additions and 21 deletions
  1. 9 0
      api/index.js
  2. 8 4
      pages/category/category.vue
  3. 9 5
      pages/coupon/consumer.vue
  4. 19 8
      pages/index/index.vue
  5. 3 1
      pages/shoping/list.vue
  6. 2 2
      pages/user/user.vue
  7. 5 1
      store/index.js

+ 9 - 0
api/index.js

@@ -41,3 +41,12 @@ export function store_list(data) {
 		data
 	});
 }
+
+//获取门店信息
+export function getStore(data) {
+	return request({
+		url: '/api/store',
+		method: 'get',
+		data
+	});
+}

+ 8 - 4
pages/category/category.vue

@@ -46,7 +46,8 @@ export default {
 		async loadData() {
 			let obj = this;
 			getList({})
-				.then(({ data }) => {
+				.then(({ data }) => {
+					console.log(data,'data++++++++++')
 					this.flist = data.map(function (s) {
 								return s
 							});
@@ -54,14 +55,17 @@ export default {
 						obj.slist.push(...e.children.map(function (s) {
 								return s
 							}));
-					});
+					});
+					console.log(obj.slist,'ddddddddddddd')
 					data.forEach(function(e) {
 						e.children.forEach(function(es) {
 							obj.tlist.push(...es.children.map(function (s) {
 								return s
-							}))
+							}))
+							
 						});
-					});
+					});
+					console.log(obj.tlist,'66666')
 				})
 				.catch(err => {
 					console.log(err);

+ 9 - 5
pages/coupon/consumer.vue

@@ -15,7 +15,7 @@
 		<view class="navbar">
 			<view v-for="(item, index) in navList" :key="index" class="nav-item" :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.text }}</view>
 		</view>
-		<swiper :current="tabCurrentIndex" :style="{ height: maxheight + 'px' }" class="swiper-box" duration="300" @change="changeTab">
+		<swiper :current="tabCurrentIndex" :style="{ height: maxheight + 'px' }" class="swiper-box" duration="300" @change="changeTab" >
 			<swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
 				<scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadData">
 					<!-- 空白页 -->
@@ -47,7 +47,8 @@
 	</view>
 </template>
 
-<script>
+<script>
+import { getUserInfo } from '@/api/login.js';
 import { spreadCommission, userBalance, rechargemoneys } from '@/api/wallet.js';
 // import { mapState } from 'vuex';
 import { getMoneyStyle } from '@/utils/rocessor.js';
@@ -131,9 +132,12 @@ export default {
 	onShow() {
 		this.loadData();
 		// 获取用户余额
-		userBalance({}).then(({ data }) => {
-			this.money = data.now_money;
-		});
+		// userBalance({}).then(({ data }) => {
+		// 	this.money = data.now_money;
+		// });
+		getUserInfo().then(({data}) => {
+			this.money = data.consumer;
+		})
 	},
 	methods: {
 		// ToChangeInto() {

+ 19 - 8
pages/index/index.vue

@@ -9,7 +9,7 @@
 			<!-- 搜素栏 -->
 			<view class="search flex">
 				<image src="../../static/icon/address.png" class="address"></image>
-				<view class="shop-name clamp" @click.stop="nav('/pages/shoping/list')">{{ storeInfo.name }}</view>
+				<view class="shop-name clamp" @click.stop="canChange == 1?nav('/pages/shoping/list'):''">{{ storeInfo.name }}</view>
 				<view class="input-box flex" @click.stop="clickSearch">
 					<view class=" input-content flex">
 						<view class="iconfont iconsearch"></view>
@@ -32,7 +32,7 @@
 					<text>全部分类</text>
 				</view>
 			</navigator>
-			<navigator url="/pages/shoping/list">
+			<navigator :url="canChange==0 ? '/pages/shoping/list?type=5': ''">
 				<view class="cate-item">
 					<image src="/static/icon/in1.png"></image>
 					<text>附近门店</text>
@@ -131,7 +131,7 @@
 <script>
 import seckill from './seckill';
 import { openMap } from '@/utils/rocessor.js';
-import { loadIndexs, store_list } from '@/api/index.js';
+import { loadIndexs, store_list, getStore } from '@/api/index.js';
 import { interceptor } from '@/utils/loginUtils';
 import { userinfo } from '@/api/user.js';
 import { mapState, mapMutations } from 'vuex';
@@ -168,7 +168,7 @@ export default {
 		};
 	},
 	computed: {
-		...mapState(['loginInterceptor', 'storeInfo']),
+		...mapState(['loginInterceptor', 'storeInfo','canChange']),
 		...mapState('user', ['hasLogin', 'userInfo'])
 	},
 	onLoad(option) {
@@ -177,15 +177,26 @@ export default {
 		if (!agree) {
 			uni.redirectTo({ url: '/pages/contract/start' });
 		}
-
-		if (option.spread) {
+		
+ 		if (option.spread) {
 			// 存储邀请人
 			uni.setStorage({
 				key: 'spread',
 				data: option.spread
 			});
 		}
-		this.getaddress();
+		if(option.store_id) {
+			getStore({
+				id: option.store_id
+			}).then(({data}) => {
+				this.setStoreInfo(data)
+				console.log(data)
+			})
+			this.setCanChange()
+		}else {
+			this.getaddress();
+		}
+		
 	},
 	onShow() {
 		// 判断是否强制登录
@@ -226,7 +237,7 @@ export default {
 	},
 	// #endif
 	methods: {
-		...mapMutations(['setLat', 'setLon', 'setStoreInfo']),
+		...mapMutations(['setLat', 'setLon', 'setStoreInfo','setCanChange']),
 		//获取定位信息
 		getaddress() {
 			console.log('dizhi+++++++++++');

+ 3 - 1
pages/shoping/list.vue

@@ -34,7 +34,7 @@ export default {
 			keyword: '' ,//查询中的内容
 			longitude:121.436289,//经度
 			latitude:28.651485,//纬度
-			type: 0,//3->开通会员选择门店  4->自提选择门店
+			type: 0,//3->开通会员选择门店  4->自提选择门店  5->附近门店进入不做任何操作
 		};
 	},
 	watch: {
@@ -110,6 +110,8 @@ export default {
 					
 				})
 				
+			}else if(this.type == 5) {
+				
 			}else {
 				this.setStoreInfo(item)
 				uni.navigateBack({

+ 2 - 2
pages/user/user.vue

@@ -88,10 +88,10 @@
 						<view class=" icon position-relative"><image class="icon-img" src="../../static/user/commission.png" mode="aspectFit"></image></view>
 						<text>我的佣金</text>
 					</view>
-					<view class="order-item" @click="navTo('/pages/scoreAccumulate/scoreAccumulate')" hover-class="common-hover" :hover-stay-time="50">
+					<!-- <view class="order-item" @click="navTo('/pages/scoreAccumulate/scoreAccumulate')" hover-class="common-hover" :hover-stay-time="50">
 						<view class=" icon position-relative"><image class="icon-img" src="../../static/user/integral.png" mode="aspectFit"></image></view>
 						<text>我的积分</text>
-					</view>
+					</view> -->
 					<view class="order-item" @click="navTo('/pages/coupon/consumer')" hover-class="common-hover" :hover-stay-time="50">
 						<view class=" icon position-relative"><image class="icon-img" src="../../static/user/coupon.png" mode="aspectFit"></image></view>
 						<text>我的消费券</text>

+ 5 - 1
store/index.js

@@ -21,7 +21,8 @@ const store = new Vuex.Store({
 		// #endif
 		latitude: '',
 		longitude: '',
-		storeInfo: {}
+		storeInfo: {},
+		canChange: 1,
 	},
 	mutations: {
 		//保存微信信息
@@ -44,6 +45,9 @@ const store = new Vuex.Store({
 		},
 		setStoreInfo(state,provider) {
 			state.storeInfo = provider
+		},
+		setCanChange(state) {
+			state.canChange = 0
 		}
 	},
 	modules:{