瀏覽代碼

2021-10-11

hwq 3 年之前
父節點
當前提交
4828ee3a99

+ 4 - 0
.hbuilderx/launch.json

@@ -2,6 +2,10 @@
   // launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数
     "version": "0.0",
     "configurations": [{
+     	"app-plus" : 
+     	{
+     		"launchtype" : "local"
+     	},
      	"default" : 
      	{
      		"launchtype" : "local"

+ 8 - 1
api/index.js

@@ -33,4 +33,11 @@ export function loadIndexs(data) {
 		data
 	});
 }
-
+//获取门店列表
+export function store_list(data) {
+	return request({
+		url: '/api/store_list',
+		method: 'get',
+		data
+	});
+}

+ 1 - 0
api/order.js

@@ -1,4 +1,5 @@
 import request from '@/utils/request'
+import {upFilse} from '@/utils/request'
 
 // 订单确认
 export function confirm(data) {

+ 24 - 0
api/user.js

@@ -25,4 +25,28 @@ export function userinfo(data) {
 		method: 'get',
 		data
 	});
+}
+//获取会员
+export function getVip(data) {
+	return request({
+		url: '/api/level/lst',
+		method: 'get',
+		data
+	});
+}
+//开通会员
+export function becomeVip(data) {
+	return request({
+		url: '/api/level/recharge',
+		method: 'post',
+		data
+	});
+}
+// 获取用户信息
+export function getUserInfo(data) {
+	return request({
+		url: '/api/userinfo',
+		method: 'get',
+		data
+	});
 }

+ 1 - 9
pages.json

@@ -4,9 +4,7 @@
 			"style": {
 				"navigationBarTitleText": "满园春商城",
 				"app-plus": {
-					"titleNView": {
-						"type": "transparent"
-					}
+					"titleNView": false
 				}
 			}
 		}, {
@@ -418,12 +416,6 @@
 				"navigationBarTitleText": "积分兑换"
 			}
 		},
-		{
-			"path": "pages/prefecture/consumer",
-			"style": {
-				"navigationBarTitleText": "消费券兑换"
-			}
-		},
 		{
 			"path": "pages/shareQrCode/index",
 			"style": {

+ 112 - 28
pages/address/addressManage.vue

@@ -10,12 +10,19 @@
 		</view>
 		<view class="row b-b">
 			<text class="tit">地址</text>
-			<pickerAddress class="input" @change="onCityClick">{{addressDetail||'请选择地址'}}</pickerAddress>
+			<picker mode="multiSelector" :range="arrDate" @change="cityChange">
+				<view>{{ addressDetail || '请选择地址(点击选择地址)' }}</view>
+			</picker>
+			<!-- <pickerAddress class="input"  @change="onCityClick">{{ addressDetail || '请选择地址(点击选择地址)' }}</pickerAddress> -->
+		</view>
+		<view class="row b-b" @click="clickMap">
+			<text class="tit">定位</text>
+			<input class="input" type="text" v-model="addressLocation.name" disabled="disabled" placeholder="请在列表选择要定位的地址" placeholder-class="placeholder" />
 			<text class="iconfont iconlocation"></text>
 		</view>
 		<view class="row b-b">
 			<text class="tit">门牌号</text>
-			<input class="input" type="text" v-model="addressData.area" placeholder="楼号、门牌" placeholder-class="placeholder" />
+			<input class="input" type="text" v-model="addressData.area" placeholder="请填写精确地址方便快速送到" placeholder-class="placeholder" />
 		</view>
 
 		<uni-list class="margin-t-20">
@@ -29,7 +36,7 @@
 			></uni-list-item>
 		</uni-list>
 
-		<button class="add-btn" @click="!loading?confirm():''">提交</button>
+		<button class="add-btn" @click="confirm">提交</button>
 	</view>
 </template>
 
@@ -37,8 +44,9 @@
 import uniList from '@/components/uni-list/uni-list.vue';
 import uniListItem from '@/components/uni-list-item/uni-list-item.vue';
 import uniPopup from '@/components/uni-popup/uni-popup.vue';
-import  pickerAddress from '@/components/wangding-pickerAddress/wangding-pickerAddress.vue';
+import pickerAddress from '@/components/wangding-pickerAddress/wangding-pickerAddress.vue';
 import { addressEdit } from '@/api/address.js';
+import { openMap } from '@/utils/rocessor.js';
 export default {
 	components: {
 		uniList,
@@ -60,11 +68,36 @@ export default {
 				area: '',
 				default: false
 			},
-			loading:false
+			// 定位地址
+			addressLocation: {
+				name: '',
+				address: '',
+				errMsg: 'chooseLocation:ok',
+				latitude: '',
+				longitude: '',
+				name: '',
+				// 判断是否地址选择页进入
+				isIndex: false
+			},
+			arrDate:[
+				['浙江省'],
+				['台州市'],
+				['椒江区','黄岩区','路桥区','温岭市','临海市','玉环县'],
+			],
 		};
 	},
 	onLoad(option) {
 		let title = '新增收货地址';
+		// #ifdef MP
+		// 获取地图权限
+		uni.authorize({
+			scope: 'scope.userLocation',
+			success: res => {}
+		});
+		// #endif
+		if (option.isIndex == 3) {
+			this.isIndex = true;
+		}
 		if (option.type === 'edit') {
 			title = '编辑收货地址';
 			let data = JSON.parse(option.data);
@@ -80,7 +113,7 @@ export default {
 				},
 				area: data.detail,
 				default: data.is_default == 1,
-				id: data.id,
+				id: data.id
 			};
 			this.addressDetail = data.province + data.city + data.district;
 		}
@@ -90,31 +123,79 @@ export default {
 		});
 	},
 	methods: {
+		// 选中经纬度
+		clickMap() {
+			uni.showLoading({
+				title: '加载中'
+			});
+			let obj = this;
+			openMap().then(() => {
+				   uni.hideLoading();
+					uni.getLocation({
+						type: 'gcj02',
+						success(e) {
+							uni.chooseLocation({
+								latitude: e.latitude,
+								longitude: e.longitude,
+								success(e) {
+									obj.addressLocation = e;
+								},
+								fail(e) {
+									uni.showModal({
+										title:'地址选择错误',
+										content:JSON.parse(e)
+									})
+									console.log(e);
+								}
+							});
+						},fail(e) {
+							uni.showModal({
+								title:'定位错误',
+								content:JSON.parse(e)
+							})
+						}
+					});
+				})
+				.catch(e => {
+					uni.hideLoading();
+					uni.showModal({
+						title: '提示',
+						content: '您未授权无法调用地图定位功能!',
+						showCancel: false
+					});
+				});
+		},
 		// 选中城市切换
-		onCityClick({data}) {
+		onCityClick({ data }) {
 			let address = this.addressData.address;
 			address.province = data[0];
 			address.city = data[1];
 			address.district = data[2];
 			this.addressDetail = data.join('');
 		},
-		//地图选择地址
-		chooseLocation() {
-			uni.chooseLocation({
-				success: data => {
-					console.log(data);
-					this.addressData.addressName = data.name;
-					this.addressData.address = data.name;
-				}
-			});
+		
+		// 选择地址
+		cityChange:function(e) {
+			console.log(e)
+			let address = this.addressData.address;
+			let type1 = e.detail.value[0];
+			let type2 = e.detail.value[1];
+			let type3 = e.detail.value[2];
+			address.province = this.arrDate[0][type1];
+			console.log(address.province)
+			address.city = this.arrDate[1][type2];
+			console.log(address.city)
+			address.district = this.arrDate[2][type3];
+			console.log(address.district)
+			this.addressDetail = address.province + ' ' + address.city + ' ' + address.district;
 		},
+		
 		// 设置是否为默认地址
 		switchChange(e) {
 			this.addressData.default = e.value;
 		},
 		//提交
 		confirm() {
-			console.log('1');
 			let obj = this;
 			let data = this.addressData;
 			if (!data.name) {
@@ -133,8 +214,10 @@ export default {
 				this.$api.msg('请填写门牌号信息');
 				return;
 			}
-			this.loading = true;
-
+			if(data.area.length<4){
+				this.$api.msg('请填写具体信息精确到门牌号');
+				return;
+			}
 			//this.$api.prePage()获取上一页实例,可直接调用上页所有数据和方法,在App.vue定义
 			addressEdit({
 				real_name: data.name,
@@ -144,22 +227,23 @@ export default {
 					city: data.address.city,
 					district: data.address.district
 				},
-				detail: data.area,
+				detail: obj.addressLocation.name + ',' + data.area,
 				is_default: data.default,
-				id: data.id||""
+				id: data.id || '',
+				longitude: obj.addressLocation.longitude,
+				latitude: obj.addressLocation.latitude
 			}).then(function(e) {
-				obj.$api.prePage().refreshList();
 				uni.showToast({
-					title:'提交成功',
-					duration:2000
+					title: '提交成功',
+					duration: 2000,
+					icon: 'none'
 				});
 				setTimeout(function() {
-					this.loading = false;
+					console.log('返回');
 					uni.navigateBack();
 				}, 800);
-			}).catch((e) => {
-				console.log(e);
-				this.loading = false;
+
+				obj.$api.prePage().refreshList();
 			});
 		}
 	}

+ 84 - 26
pages/index/index.vue

@@ -9,8 +9,8 @@
 			<!-- 搜素栏 -->
 			<view class="search flex">
 				<image src="../../static/icon/address.png" class="address"></image>
-				<view class="shop-name clamp">满园春台州店11111111</view>
-				<view class="input-box flex" @click="clickSearch">
+				<view class="shop-name clamp" @click.stop="nav('/pages/shoping/list')">{{store_name}}</view>
+				<view class="input-box flex" @click.stop="clickSearch">
 					<view class=" input-content flex">
 						<view class="iconfont iconsearch"></view>
 						<view class="input"><input type="text" disabled value="输入关键字搜索" /></view>
@@ -71,10 +71,10 @@
 					<view class="commodity-item" v-for="(item, index) in goodsList" :key="item.id">
 						<image class="commodity-image" :src="item.image" mode=""></image>
 						<view class="commodity-title clamp">{{ item.store_name }}</view>
-						<view class="price">¥{{ item.price }}</view>
+						<view class="price">¥{{ item.ot_price }}</view>
 						<view class="vip-price">
 							<image src="../../static/icon/jf.png" mode=""></image>
-							<text>{{ item.vip_price }}</text>
+							<text>{{ item.price }}</text>
 						</view>
 					</view>
 				</view>
@@ -88,7 +88,7 @@
 				<view class="main-synopsis">买多赚多</view>
 			</view>
 			<view class="main-content ">
-				<view class="content-top flex xfq"  @click="nav('/pages/prefecture/consumer')">
+				<view class="content-top flex xfq"  @click="nav('/pages/prefecture/voucher')">
 					<view class="content-font">
 						<view class="content-title">精选好货 平台推荐</view>
 						<view class="content-synopsis">消费券兑换</view>
@@ -96,13 +96,13 @@
 					<image src="../../static/icon/fanhui.png" class="go" mode=""></image>
 				</view>
 				<view class="commodity flex">
-					<view class="commodity-item" v-for="(item, index) in goodsList" :key="item.id">
+					<view class="commodity-item" v-for="(item, index) in bastList" :key="item.id">
 						<image class="commodity-image" :src="item.image" mode=""></image>
 						<view class="commodity-title clamp">{{ item.store_name }}</view>
-						<view class="price">¥{{ item.price }}</view>
+						<view class="price">¥{{ item.ot_price }}</view>
 						<view class="vip-price">
 							<image src="../../static/icon/xfq.png" mode=""></image>
-							<text>{{ item.vip_price }}</text>
+							<text>{{ item.price }}</text>
 						</view>
 					</view>
 				</view>
@@ -120,11 +120,11 @@
 						{{ item.store_name }}
 					</view>
 					<view class="price-box flex">
-						<view class="yuanprice">{{ item.price }}</view>
+						<view class="yuanprice">{{ item.ot_price }}</view>
 						<image src="../../static/icon/down.png" mode=""></image>
-						<view class="jiang">直降{{ (item.vip_price - item.price).toFixed(2) }}元</view>
+						<view class="jiang">直降{{ (item.ot_price - item.price).toFixed(2) }}元</view>
 					</view>
-					<view class="price">¥{{ item.vip_price }}</view>
+					<view class="price">¥{{ item.price }}</view>
 					<view class="btn">立即购买</view>
 				</view>
 			</view>
@@ -134,10 +134,14 @@
 
 <script>
 import seckill from './seckill';
-import { loadIndexs } from '@/api/index.js';
+import { loadIndexs,store_list } from '@/api/index.js';
 import { interceptor } from '@/utils/loginUtils';
 import { userinfo } from '@/api/user.js';
 import { mapState } from 'vuex';
+import { getProducts } from '@/api/product.js';
+// #ifdef H5
+import { weixindata } from '@/utils/wxAuthorized';
+// #endif
 export default {
 	components: {
 		seckill
@@ -152,9 +156,12 @@ export default {
 			titleNViewBackground: '',
 			swiperCurrent: 0,
 			swiperLength: 0,
+			longitude:121.436289,//经度
+			latitude:28.651485,//纬度
+			store_name:'',//门店姓名
 			carouselList: [], //轮播列表
-			goodsList: [], //最新商品列表
-			bastList: [], //精品推荐列表
+			goodsList: [], //积分商品列表
+			bastList: [], //消费券商品列表
 			bastBanner: [], //促销商品列表
 			menusList: [], //头部菜单
 			userServant: [
@@ -169,11 +176,13 @@ export default {
 		...mapState('user', ['hasLogin', 'userInfo'])
 	},
 	onLoad(option) {
+		
 		let agree = uni.getStorageSync('agree') || false;
 		// 判断是否已经同意协议
 		if (!agree) {
 			uni.redirectTo({ url: '/pages/contract/start' });
 		}
+		
 		if (option.spread) {
 			// 存储邀请人
 			uni.setStorage({
@@ -192,6 +201,39 @@ export default {
 					console.log(e);
 				});
 		}
+		// // #ifdef H5
+		// weixindata().then(wxOjb => {
+		// 	console.log(wxOjb,'123456798')
+		// 	wxOjb.getLocation({
+		// 		type: 'wgs84',
+		// 			success: function(res) {
+		// 				console.log('获取经纬度', res);
+		// 				obj.longitude = res.longitude;
+		// 				obj.latitude = res.latitude;
+		// 				 uni.setStorageSync('longitude', obj.longitude4);
+		// 				 uni.setStorageSync('latitude', obj.latitude4);
+		// 				obj.marker = [
+		// 					{
+		// 						longitude: res.longitude,
+		// 						latitude: res.latitude,
+		// 						iconPath: '/static/img/img19.png',
+		// 						width: '45',
+		// 						height: '45'
+		// 					}
+		// 				];
+		// 				obj.loadData();
+		// 			},
+		// 			fail(e) {
+		// 				console.log('失败', e);
+		// 				// window.location.reload();
+		// 				obj.tishi()
+		// 			}
+		// 		});
+		// }).catch(err => {
+		// 	obj.tishi()
+		// 	console.log(err)
+		// })
+		// // #endif 
 		this.loadData();
 	},
 	// #ifndef MP
@@ -233,17 +275,34 @@ export default {
 		},
 		// 请求载入数据
 		async loadData() {
+			const obj = this;
+			store_list({latitude:obj.latitude,longitude:obj.longitude}).then(({data}) =>{
+				console.log(data)
+				obj.store_name = data.list[0].detailed_address
+			})
 			loadIndexs({}).then(({ data }) => {
 				let goods = data.info;
 				this.carouselList = data.banner;
 				this.swiperLength = this.carouselList.length;
 				this.menusList = data.menus;
-				this.goodsList = goods.firstList; //最新商品
-				console.log(this.goodsList, '123456');
-				this.bastList = goods.bastList; //精品推荐
-				this.bastBanner = goods.bastBanner; //促销单品
-				this.userServant = goods.platoonList; //服务商品
+				this.goodsList = goods.bastList; //最新商品
 			});
+			getProducts({
+				page:1,
+				limit: 2,
+				is_consumer: 1,
+			})
+				.then(({ data }) => {
+					obj.bastList = data.map(e => {
+						e.price = Number(e.price);
+						e.ot_price = Number(e.ot_price);
+						return e;
+					});
+					console.log(obj.bastList,'123456')
+				})
+				.catch(e => {
+					console.log(e);
+				});
 		},
 		//轮播图切换修改背景色
 		swiperChange(e) {
@@ -270,6 +329,7 @@ export default {
 			});
 		},
 		nav(url){
+			console.log(url,'111111111')
 			uni.navigateTo({
 				url
 			})
@@ -316,7 +376,7 @@ page {
 		}
 		.shop-name {
 			position: relative;
-			z-index: 10;
+			z-index: 100;
 			width: 206rpx;
 			font-size: 30rpx;
 			font-family: PingFang SC;
@@ -326,7 +386,7 @@ page {
 		}
 		.input-box {
 			position: relative;
-			z-index: 999;
+			z-index: 99;
 			width: 427rpx;
 			height: 60rpx;
 			background: rgba(39, 170, 116, 0.4);
@@ -580,7 +640,7 @@ page {
 .bastgood-box {
 	margin-top: 20rpx;
 	background-color: #FFFFFF;
-	padding-top: 40rpx;
+	padding: 40rpx 0;
 	.bast-bg {
 		width: 376rpx;
 		height: 34rpx;
@@ -593,17 +653,15 @@ page {
 	.guess-item {
 		display: flex;
 		width: 710rpx;
-		height: 290rpx;
 		background: #ffffff;
 		box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
 		border-radius: 10rpx;
 		padding: 15rpx;
-		padding-bottom: 150rpx;
 		margin: 20rpx auto 0;
 		position: relative;
 		image {
-			width: 260rpx;
-			height: 260rpx;
+			width: 236rpx;
+			height: 236rpx;
 			border-radius: 10rpx;
 		}
 		.guess-box {

+ 0 - 193
pages/prefecture/consumer.vue

@@ -1,193 +0,0 @@
-<template>
-	<view class="container">
-		<view class="jg"></view>
-		<view class="good-wrapper flex" v-for="(good ,index) in list" :key="good.id">
-			<image :src="good.image" mode="" class="good-img"></image>
-			<view class="good-info flex">
-				<view class="tit clamp2">
-					{{good.store_name  }}
-				</view>
-				<view class="price-wrap">
-					<view class="old-price">
-						<text class="old">¥{{good.ot_price}}</text>
-						<image src="../../static/icon/down.png" mode=""></image>
-						<text class="zj">直降{{good.ot_price - good.use_max_integral}}元</text>
-					</view>
-					<view class="integral-wrap">
-						<image src="../../static/icon/jf.png" mode=""></image>
-						<text class="price">{{good.use_max_integral}}</text>
-					</view>
-				</view>
-				<view class="btn">
-					立即购买
-				</view>
-			</view>
-		</view>
-		<view class="jg"></view>
-	</view>
-	
-</template>
-
-<script>
-import { groomList } from '@/api/product.js';
-export default {
-	filters: {
-		toFixed: function(value) {
-			// 判断是否为整数
-			if (value % 1 == 0) {
-				return value;
-			} else {
-				return value.toFixed(2);
-			}
-		}
-	},
-	data() {
-		return {
-			list: [],
-			bannerImg: []
-		};
-	},
-	onLoad(option) {
-		// 加载基础数据
-		this.loadData();
-	},
-	methods: {
-		//详情页
-		navToDetailPage(item) {
-			uni.navigateTo({
-				url: '/pages/product/product?id=' + item.id
-			});
-		},
-		// 轮播图跳转
-		bannerNavToUrl(item) {
-			// #ifdef H5
-			if (item.wap_link.indexOf('http') > 0) {
-				window.location.href = item.wap_link;
-			}
-			// #endif
-			//测试数据没有写id,用title代替
-			uni.navigateTo({
-				url: item.wap_link
-			});
-		},
-		// 请求载入数据
-		async loadData() {
-			groomList({}, 5)
-				.then(({ data }) => {
-					// 保存轮播图
-					this.bannerImg = data.banner;
-					// 保存商品信息
-					this.list = data.list.map(e => {
-						e.price = Number(e.price);
-						e.ot_price = Number(e.ot_price);
-						return e;
-					});
-				})
-				.catch(e => {
-					console.log(e);
-				});
-		}
-	}
-};
-</script>
-
-<style lang="scss" scoped>
-page {
-	background: $page-color-base;
-}
-.jg {
-	height: 20rpx;
-}
-.good-wrapper {
-	width: 690rpx;
-	height: 276rpx;
-	justify-content: flex-start;
-	align-items: flex-start;
-	margin: 0 auto 20rpx;
-	// &:last-of-type {
-	// 	margin-bottom: 0;
-	// }
-	background: #FFFFFF;
-	box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
-	border-radius: 10rpx;
-	padding: 20rpx 25rpx 20rpx 15rpx;
-	.good-img {
-		flex-shrink: 0;
-		background-color: #eee;
-		width: 236rpx;
-		height: 236rpx;
-		border-radius: 10rpx;
-		margin-right: 20rpx;
-	}
-	.good-info {
-		flex-direction: column;
-		align-items: flex-start;
-		width: 100%;
-		height: 100%;
-		position: relative;
-		.tit {
-			padding-top: 10rpx;
-			padding-right: 15rpx;
-			font-size: 32rpx;
-			font-family: PingFang SC;
-			font-weight: bold;
-		}
-		.btn {
-			width: 137rpx;
-			line-height: 52rpx;
-			background: linear-gradient(0deg, #52C696 0%, #52C696 100%);
-			border-radius: 26rpx;
-			font-size: 26rpx;
-			font-family: PingFang SC;
-			font-weight: 500;
-			text-align: center;
-			color: #FFFFFF;
-			position: absolute;
-			bottom: 0;
-			right: 0;
-		}
-		.price-wrap {
-			.old-price {
-				
-				.old {
-					font-size: 26rpx;
-					font-family: PingFang SC;
-					font-weight: 500;
-					text-decoration: line-through;
-					color: #999999;
-				}
-				image {
-					display: inline-block;
-					width: 14rpx;
-					height: 20rpx;
-					margin: 0 6rpx 0 10rpx;
-				}
-				.zj {
-					font-size: 24rpx;
-					font-family: PingFang SC;
-					font-weight: bold;
-					color: #B59467;
-				}
-			}
-			.integral-wrap {
-				display: flex;
-				justify-content: flex-start;
-				padding-top: 14rpx;
-				image {
-					width: 40rpx;
-					height: 40rpx;
-					margin-right: 8rpx;
-				}
-				.price {
-					font-size: 36rpx;
-					font-family: PingFang SC;
-					font-weight: bold;
-					color: #FF6F0F;
-					line-height: 40rpx;
-				}
-			}
-		}
-		
-	}
-}
-</style>

+ 2 - 2
pages/prefecture/detail.vue

@@ -138,8 +138,8 @@
 import share from '@/components/share';
 import uniNumberBox from '@/components/uni-number-box.vue';
 import uniCountdown from '@/components/uni-countdown/uni-countdown.vue';
-import { goodsDetail, cartAdd, collectAdd, collectDel, seckillGoods, groupGoods } from '@/api/product.js';
-import { getShoping } from '@/api/shoping.js';
+import { goodsDetail, cartAdd, collectAdd, collectDel, seckillGoods, groupGoods } from '@/api/product.js';
+import { getShoping } from '@/api/shoping.js'; 
 // #ifdef H5
 import { weixindata } from '@/utils/wxAuthorized';
 import { mapState } from 'vuex';

+ 1 - 2
pages/prefecture/voucher.vue

@@ -34,8 +34,7 @@
 </template>
 
 <script>
-import { groomList, getProducts } from '@/api/product.js';
-
+import { getProducts } from '@/api/product.js';
 import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
 import empty from '@/components/empty';
 

+ 10 - 20
pages/shoping/list.vue

@@ -17,20 +17,6 @@
 					<view class="info-tit">地区:<text class="info-val">{{lss.address}}</text></view>
 					<view class="info-tit">电话:<text class="info-val">{{lss.tel }}</text></view>
 					<view class="info-tit">地址:<text class="info-val">{{lss.detailed_address}}</text></view>
-					<!-- <view class="title clamp">
-						<text>{{ lss.title }}</text>
-					</view>
-					<view class="slider flex">
-						<view class="sales-nub">简介:{{ lss.info }}</view>
-					</view>
-					<view class="goods-money flex">
-						<view class="money-box">
-							<view class="otMoney-box">
-								<text class="otMoney">{{ lss.address }}</text>
-							</view>
-						</view>
-						<view class="cart seckill-action">进入店铺</view>
-					</view> -->
 				</view>
 			</view>
 		</block>
@@ -38,13 +24,15 @@
 	</view>
 </template>
 <script>
-import { getShoping } from '@/api/shoping.js';
+import { store_list } from '@/api/index.js';
 export default {
 	data() {
 		return {
 			// 当前选中的滑块
 			list: [],
-			keyword: '' //查询中的内容
+			keyword: '' ,//查询中的内容
+			longitude:121.436289,//经度
+			latitude:28.651485,//纬度
 		};
 	},
 	watch: {
@@ -88,11 +76,13 @@ export default {
 		//获取商店信息
 		getShoping() {
 			let obj = this;
-			getShoping({
-				mer_id: 0
+			store_list({
+				longitude:121.436289,//经度
+				latitude:28.651485,//纬度
 			})
-				.then(function({ data }) {
-					obj.list = data.map(e => {
+				.then(function({ data }) {
+					console.log(data)
+					obj.list = data.list.map(e => {
 						e.show = true;
 						return e;
 					});

+ 1 - 1
pages/user/user.vue

@@ -15,7 +15,7 @@
 					<view class="portrait-box"><image class="portrait" :src="userInfo.avatar || '/static/error/missing-face.png'"></image></view>
 					<view class="info-box">
 						<view class="username">{{ userInfo.nickname || '游客' }}</view>
-						<view class="font-size-sm" v-if="userInfo.uid">19999999999</view>
+						<view class="font-size-sm" v-if="userInfo.uid">{{ userInfo.uid}}</view>
 					</view>
 				</view>
 				<view class="config">

+ 2 - 1
pages/userinfo/userinfo.vue

@@ -23,7 +23,8 @@
 
 <script>
 import { mapState,mapMutations } from 'vuex';
-import { userEdit,upload,logout } from '@/api/set.js';
+import { userEdit,logout } from '@/api/set.js';
+import { upload } from '@/api/order.js'
 export default {
 	data() {
 		return {

+ 18 - 21
pages/wallet/openMember.vue

@@ -50,13 +50,13 @@
 				<view class="img" style="margin-left: 45rpx;"><image class="img" src="../../static/img/vip-right.png"></image></view>
 			</view>
 			<view class="money-box flex">
-				<view class="money" v-for="(item, index) in 3" @click="changevip(item, index)" :class="{ current: index == choose }">
-					<view class="money-name">会员</view>
+				<view class="money" v-for="(item, index) in payList" @click="changevip(item, index)" :class="{ current: index == choose }">
+					<view class="money-name">{{item.name}}</view>
 					<view class="now-money">
-						<text>500</text>
+						<text>{{(item.money*1)}}</text>
 					</view>
-					<view class="bf-money">¥600</view>
+					<view class="bf-money">¥{{item.money*1.1}}</view>
 					<view class="money-tip" :class="{ moneyc: index == choose }">
 						<image src="../../static/img/good.png" mode=""></image>
 						专属折扣
@@ -86,7 +86,7 @@
 							<image src="https://zhibo.liuniu946.com/img/weixin.png" mode="aspectFill"></image>
 							<view class="zf">微信支付</view>
 						</view>
-						<label class="radio1" @click="changePayType(1)"><radio style="transform:scale(0.7)" value="" :checked="payType == 1" color="#FE4141"></radio></label>
+						<label class="radio1" @click="changePayType(1)"><radio style="transform:scale(0.7)" value="" :checked="payType == 1" color="#52C696"></radio></label>
 					</view>
 					<!-- #endif -->
 					<!-- #ifdef APP-PLUS -->
@@ -95,7 +95,7 @@
 							<view class="icon iconfont iconzhifubao"></view>
 							<view class="zf">支付宝支付</view>
 						</view>
-						<label class="radio1" @click="changePayType(3)"><radio style="transform:scale(0.7)" value="" :checked="payType == 3" color="#FE4141"></radio></label>
+						<label class="radio1" @click="changePayType(3)"><radio style="transform:scale(0.7)" value="" :checked="payType == 3" color="#52C696"></radio></label>
 					</view>
 					<!-- #endif -->
 					<view class="paybox-main flex">
@@ -104,7 +104,7 @@
 							<view class="zf">余额支付</view>
 						</view>
 						<label class="radio" @click="changePayType(2)">
-							<radio style="transform:scale(0.7)" class="rad" value="" :checked="payType == 2" color="#FE4141"></radio>
+							<radio style="transform:scale(0.7)" class="rad" value="" :checked="payType == 2" color="#52C696"></radio>
 						</label>
 					</view>
 				</view>
@@ -168,7 +168,7 @@ export default {
 					title: '团队奖励',
 					tip: '更多团队奖励'
 				}
-			],
+			],
 			state: '',
 			// #ifndef APP-PLUS
 			payType: 1,
@@ -213,11 +213,8 @@ export default {
 		}, //自动拼团是否加载中
 		// 获取vip等级
 		getVip() {
-			getVip({}).then(({ data }) => {
-				data.forEach((sj, index) => {
-					sj.sq = (sj.money * 0.33).toFixed(0);
-					sj.yuan = (sj.sq * 1 + sj.money * 1).toFixed(2);
-				});
+			getVip({}).then(({ data }) => {
+				console.log(data)
 				this.payList = data;
 				// 设置默认选中的对象
 				this.level_id = data[0].id;
@@ -247,15 +244,15 @@ export default {
 				});
 		},
 		submit() {
-			if (this.money == 0) {
-				uni.showModal({
-					title: '提示',
-					content: '请选择要开通的会员'
-				});
-			} else {
+			// if (this.money == 0) {
+			// 	uni.showModal({
+			// 		title: '提示',
+			// 		content: '请选择要开通的会员'
+			// 	});
+			// } else {
+			// }
 				console.log('打开支付弹窗');
 				this.$refs.popupPay.open();
-			}
 		},
 		close() {
 			this.$refs.popupPay.close();
@@ -891,7 +888,7 @@ export default {
 	.zhifu {
 		width: 50%;
 		height: 92rpx;
-		background: linear-gradient(180deg, #fd4646, #ff3535);
+		background: #52C696;
 		text-align: center;
 		line-height: 92rpx;
 		font-size: 32rpx;

文件差異過大導致無法顯示
+ 0 - 0
plugin/jweixin-module/index.js


+ 80 - 50
utils/newRequest.js

@@ -77,6 +77,7 @@ let service = {
 	},
 	// 上传文件
 	upFilse: async function(data) {
+		console.log('--上传文件--upFilse',data)
 		return await new Promise(function(resolve, reject) {
 			let requestData = ''; //保存处理完成后请求数据
 			try {
@@ -86,59 +87,88 @@ let service = {
 				// 请求报错拦截
 				service.request.error(e);
 			}
-			// #ifdef H5
-			let input = event.target.querySelector('input');
-			input.setAttribute("type", 'file');
-			input.setAttribute("name", Object.getOwnPropertyNames(requestData.data)[0]);
-			input.click();
-			input.addEventListener('change', function(e) {
-				console.log(input.files);
-				let f = new FormData();
-				f.append("file", input.files[0]);
-				let xhr = new XMLHttpRequest();
-				xhr.open(requestData.method, service.baseURL + requestData.url, true);
-				// xhr.setRequestHeader("content-type","multipart/form-data");
-				xhr.send(f);
-				xhr.onreadystatechange = function() {
-					if (xhr.readyState == 4 && xhr.status == 200) {
-						let data = JSON.parse(xhr.responseText)
-						resolve(service.response.success(data));
-					} else {
-						reject(service.response.error(xhr.status));
-					}
-				}
-			})
-			// #endif
-			// #ifndef H5
-			// 获取请求key值
-			let fileName = Object.getOwnPropertyNames(requestData.data)[0];
-			// 获取传输的图片
-			let file = requestData.data[fileName][0];
-			// 数据复制用于请求
-			uni.uploadFile({
-				url: service.baseURL + requestData.url,
-				filePath: file,
-				name: fileName,
-				header: {
-					'Content-Type': 'multipart/form-data'
+			let config = {
+				// 上传图片的API
+				upload_img_url: service.baseURL + requestData.url
+			}
+	
+			let Uploader = {
+				// 选择图片
+				choose(num) {
+					return new Promise((resolve, reject) => {
+						uni.chooseImage({
+							count: num,
+							sourceType:['album'],
+							sizeType:['compressed'],
+							success(res) {
+								// console.log(res);
+								// 缓存文件路径
+								resolve(res.tempFilePaths)
+							},
+							fail(err) {
+								console.log(err)
+								reject(err)
+							}
+						})
+					})
 				},
-				success: res => {
-					console.log(res);
-					// 请求成功数据处理
-					try {
-						resolve(service.response.success(res));
-					} catch (e) {
-						reject(service.response.error(e));
-					}
+				// 上传图片
+				upload_one(path) {
+					return new Promise((resolve, reject) => {
+						uni.showLoading({
+							title: '上传中'
+						})
+						uni.uploadFile({
+							url: config.upload_img_url, //仅为示例,非真实的接口地址
+							filePath: path,
+							name: 'file',
+							header: {
+								"Authori-zation": 'Bearer ' + uni.getStorageSync('token')
+							},
+							success: (uploadFileRes) => {
+								if ("string" === typeof uploadFileRes.data) {
+									resolve(JSON.parse(uploadFileRes.data).data)
+								} else {
+									resolve(uploadFileRes.data.data)
+								}
+							},
+							complete() {
+								uni.hideLoading()
+							}
+						});
+					})
 				},
-				// 请求失败数据处理
-				fail: (err) => {
-					console.log(err);
-					reject(service.response.error(err))
+				// 上传多个图片
+				upload(path_arr) {
+					let num = path_arr.length;
+					return new Promise(async (resolve, reject) => {
+						let img_urls = []
+						for (let i = 0; i < num; i++) {
+							let img_url = await this.upload_one(path_arr[i]);
+							img_urls.push(img_url)
+						};
+						resolve(img_urls)
+					})
+				},
+				// 触发上传图片事件
+				choose_and_upload(num) {
+					return new Promise(async (resolve, reject) => {
+						// 选择图片
+						let path_arr = await this.choose(num);
+						// 上传图片
+						await this.upload(path_arr).then((e) => {
+							resolve(e);
+						}).catch((e) => {
+							reject(e)
+						});
+					})
 				}
-			});
-			// #endif
-
+			};
+			Uploader.choose_and_upload(1).then((e) => {
+				resolve(e);
+			}).catch((e) => {
+				console.log(e);
+			})
 		})
 	},
 };

+ 24 - 0
utils/platform.js

@@ -0,0 +1,24 @@
+export function isAndroid() {  
+    var ua = navigator.userAgent,  
+            _isAndroid = ua.indexOf('Android') > -1 || ua.indexOf('Linux') > -1;  
+    return _isAndroid;  
+}  
+
+export function isIOS() {  
+    return !!navigator.userAgent.match(/(i[^;]+\;(U;)? CPU.+Mac OS X)/);  
+}  
+
+export function isPad() {  
+    return navigator.userAgent.toLowerCase().match(/iPad/i) == "ipad";  
+}  
+
+export function isWinPad() {  
+    return navigator.userAgent.indexOf("Windows NT") >= 0;  
+}  
+
+export default {
+	isAndroid,
+	isIOS,
+	isPad,
+	isWinPad
+}

+ 55 - 0
utils/rocessor.js

@@ -54,3 +54,58 @@ export function timeComputed(time) {
 		seconds//倒计时秒数
 	}
 }
+
+export function openMap(e) {
+	console.log(22)
+	var that = this
+	return new Promise((resolve, reject) => {
+		uni.getSetting({
+			success(res) {
+				//这里判断是否有地位权限
+				if (!res.authSetting['scope.userLocation']) {
+					uni.hideLoading();
+					uni.showModal({
+						title: '提示',
+						content: '请求获取位置权限',
+						success: function(res) {
+							if (res.confirm == false) {
+								// 授权失败
+								reject()
+								return false;
+							}
+							uni.openSetting({
+								success(res) {
+									//如果再次拒绝则返回页面并提示
+									if (!res.authSetting['scope.userLocation']) {
+										uni.showModal({
+											title: '此功能需获取位置信息,请重新授权',
+											content: '',
+											// showCancel: false,
+											// cancelText: '',
+											// confirmText: '',
+											success: res => {
+											},
+											// fail: () => {},
+											// complete: () => {}
+										});
+										// wx.showToast({
+										// 	title: '此功能需获取位置信息,请重新设置',
+										// 	duration: 3000,
+										// 	icon: 'none'
+										// })
+									} else {
+										//允许授权,调用地图
+										resolve()
+									}
+								}
+							})
+						}
+					})
+				} else {
+					//如果有定位权限,调用地图
+					resolve()
+				}
+			}
+		})
+	})
+}

+ 125 - 88
utils/wxAuthorized.js

@@ -1,21 +1,29 @@
-import store from '../store';
 import {
 	wechatConfig,
 	share
 } from '@/api/wx';
+import {
+	isAndroid
+} from './platform.js'
+import store from '../store';
 // 保存wx对象
-let weixinObj = require('jweixin-module');
+import weixinObj from "@/plugin/jweixin-module/index.js";
 // 保存分享数据
 let shareData = '';
 // 保存注册返回appId数据
 let appId = '';
+//保存路由对象
+let router = '';
 //微信登录
 /**
  * @param {string} 当前页面地址信息
  */
-export function loginWinxin() {
+export async function loginWinxin() {
 	let pages, page, path;
 	try {
+		if (!router) {
+			router = await setRouter();
+		}
 		pages = getCurrentPages();
 		// 获取跳转前页面
 		page = pages[pages.length - 1];
@@ -26,30 +34,25 @@ export function loginWinxin() {
 	}
 	// 判断是否在登录页
 	if (path != 'pages/redirect/redirect') {
-		setTimeout((e) => {
-			weixinObj.ready(() => {
-				// 调用
-				try {
-					console.log(shareData);
-					weixinSq(shareData, path);
-				} catch (e) {
-					console.log(e);
-					//TODO handle the exception
-				}
-			});
-			weixinObj.error((e) => {
+		weixindata().then(() => {
+			// 调用
+			try {
+				weixinSq();
+			} catch (e) {
 				console.log(e);
-			})
-		}, 10)
-
+				//TODO handle the exception
+			}
+		});
 	}
 };
 // 微信授权登录
 function weixinSq(data, path) {
 	// 微信授权后跳转页面
 	try {
-		let ul = encodeURIComponent(store.state.baseURL + store.state.urlFile + '/pages/redirect/redirect');
+		let ul = encodeURIComponent(store.state.baseURL + store.state.urlFile + '/#/pages/redirect/redirect');
+		console.log(ul, "ul")
 		// 打开微信授权页面
+		
 		let url =
 			'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' +
 			appId +
@@ -58,6 +61,7 @@ function weixinSq(data, path) {
 			'&response_type=code&scope=snsapi_userinfo&state=' +
 			new Date().getTime() +
 			'#wechat_redirect';
+			console.log(url, "url")
 		window.location.href = url;
 	} catch (e) {
 		console.log(e);
@@ -65,65 +69,85 @@ function weixinSq(data, path) {
 };
 
 // 微信注册
-export function weixindata(config) {
-	//注册微信信息
-	let weixinObj = require('jweixin-module');
-	// 保存微信对象到全局仓库
-	store.commit('setWeiChatObj', weixinObj)
-	wechatConfig({
-			url: window.location.href
-		})
-		.then(({
-			data
-		}) => {
-			// 保存appId
-			store.commit('setWeiChatInfo', data)
-			appId = data.appId
-			// 微信信息配置
-			weixinObj.config({
-				debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
-				appId: data.appId, // 必填,企业号的唯一标识,此处填写企业号corpid
-				timestamp: data.timestamp, // 必填,生成签名的时间戳
-				nonceStr: data.nonceStr, // 必填,生成签名的随机串
-				signature: data.signature, // 必填,签名,见附录1
-				jsApiList: data.jsApiList // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
-			});
-			weixinObj.ready((e) => {
-				// 判断是否已经缓存了自定义数据
-				if (!shareData) {
-					share({}).then(({
-						data
-					}) => {
-						shareData = data.data
-						shareLoad(config)
-					});
-				} else {
-					shareLoad(config)
-				}
-			})
-
-		})
-		.catch(e => {
+export async function weixindata(config) {
+	let url;
+	try {
+		// 判断是否存在router
+		if (!router) {
+			router = await setRouter();
+		}
+		if (router.mode === "history") {
+			// 在ios中时候注册为微信刚进入时候的页面
+			if (!window.entryUrl) {
+				window.entryUrl = location.href.split('#')[0]
+			}
+			url = isAndroid() ? location.href.split('#')[0] : window.entryUrl;
+		}
+		if (router.mode === "hash") {
+			url = location.href.split('#')[0];
+		}
+		console.log('开始注册', url);
+	} catch (e) {
+		console.log('错误', e);
+	}
+	return new Promise((ok, error) => {
+		try {
+			//注册微信信息
+			wechatConfig({
+					url
+				})
+				.then(({
+					data
+				}) => {
+					try {
+						// 保存appId
+						appId = data.appId
+						// 微信信息配置
+						weixinObj.config({
+							debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
+							appId: data.appId, // 必填,企业号的唯一标识,此处填写企业号corpid
+							timestamp: data.timestamp, // 必填,生成签名的时间戳
+							nonceStr: data.nonceStr, // 必填,生成签名的随机串
+							signature: data.signature, // 必填,签名,见附录1
+							jsApiList: data.jsApiList // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
+						});
+						weixinObj.ready((e) => {
+							console.log('注册完毕');
+							store.commit('setWeiChatObj', weixinObj)
+							ok(weixinObj)
+						})
+					} catch (e) {
+						console.log(e)
+					}
+				})
+				.catch(e => {
+					error(e);
+					console.log(e);
+				});
+		} catch (e) {
 			console.log(e);
-		});
+			//TODO handle the exception
+		}
+	})
 }
 // 加载分享数据
 function shareLoad(config) {
 	let mess;
 	if (config) {
-		config.link = config.link.replace(/[\?,&]{0,1}from=singlemessage/g, '');
 		mess = {
 			link: config.link, // 分享链接
 			imgUrl: config.imgUrl,
 			desc: config.desc,
 			title: config.title,
 			success: config.success,
-			fail: config.fail
+			fail: config.fail||function (e) {
+				console.log(e);
+			}
 		}
 	} else {
-		console.log('渲染数据');
-		const userInfo = uni.getStorageSync('userInfo')
-		let url = store.state.baseURL + store.state.urlFile + '?spread=' + userInfo.uid;
+		// console.log(window.location.href, 55)
+		// let url = window.location.href + '?spread=' + store.state.userInfo.uid;
+		let url = window.location.href;
 		url = url.replace(/[\?,&]{0,1}from=singlemessage/g, '');
 		mess = {
 			title: shareData.title,
@@ -131,44 +155,57 @@ function shareLoad(config) {
 			imgUrl: shareData.img, // 分享图标
 			desc: shareData.synopsis,
 			success: function() {
-				// uni.showModal({
-				// 	title: '分享',
-				// 	content: '分享成功',
-				// 	showCancel: false,
-				// 	success: res => {
-				//    console.log('分享成功回调接口');
-				// 	},
-				// 	fail: () => {},
-				// 	complete: () => {}
-				// });
+			},
+			fail:function (e) {
+				console.log(e);
 			}
 		}
 	}
-	console.log(mess);
 	// 获取仓库数据
 	// 分享好友
-	weixinObj.updateAppMessageShareData(mess);
+	// weixinObj.updateAppMessageShareData(mess);
+	weixinObj.onMenuShareAppMessage(mess);// 即将废弃
 	// 分享朋友圈
-	weixinObj.updateTimelineShareData(mess)
+	// weixinObj.updateTimelineShareData(mess)
+	weixinObj.onMenuShareTimeline(mess);// 即将废弃
 }
 
-// 加载分享数据
-export function loadShareData () {
-	return new Promise((resolve,reject) => {
-		share({}).then(({
-			data
-		}) => {
-			shareData = data.data
-			resolve(shareData)
-		}).catch((e) => {
-			reject(e);
+// 隐藏功能按钮
+export function weixinhideMenu(config) {
+	console.log(config)
+	weixinObj.ready((e) => {
+		weixinObj.hideMenuItems({
+			menuList: config, // 要隐藏的菜单项,只能隐藏“传播类”和“保护类”按钮,所有menu项见附录3
 		});
 	})
+	
+}
+
+// 保存路由对象
+export function setRouter(route) {
+	return new Promise((ok, err) => {
+		router = getApp().$router;
+		console.log(router,'开始数据');
+		if (!router) {
+			const set = setInterval(() => {
+				router = getApp().$router;
+				console.log(router,'返回数据');
+				if (router) {
+					console.log(router,'结束');
+					clearInterval(set)
+					ok(router)
+				}
+			}, 100);
+		}else{
+			console.log(router,'成功');
+			ok(router)
+		}
+	})
 }
 
 export default {
 	weixinObj,
 	shareData,
 	appId,
-	loadShareData
+	setRouter
 }

部分文件因文件數量過多而無法顯示