cmy 2 anos atrás
pai
commit
847d876e84

+ 2 - 2
api/order.js

@@ -146,8 +146,8 @@ export function computedOrderkey(data) {
 // 门店地址
 export function storeList(data) {
 	return request({
-		url: '/api/PublicController/store_list',
-		method: 'post',
+		url: '/api/store_list',
+		method: 'get',
 		data
 	});
 }

+ 31 - 12
pages.json

@@ -69,17 +69,18 @@
 			"root": "pages/water",
 			"name": "water",
 			"pages": [{
-				"path": "/waterList",
-				"style": {
-					"navigationBarTitleText": "充水票"
-				}
-			},
-			{
-				"path": "/waterDetail",
-				"style": {
-					"navigationBarTitleText": "水票购买"
+					"path": "/waterList",
+					"style": {
+						"navigationBarTitleText": "充水票"
+					}
+				},
+				{
+					"path": "/waterDetail",
+					"style": {
+						"navigationBarTitleText": "水票购买"
+					}
 				}
-			}]
+			]
 		},
 		{
 			"root": "pages/order",
@@ -120,7 +121,25 @@
 				{
 					"path": "/shopList",
 					"style": {
-						"navigationBarTitleText": "门店列表"
+						"navigationBarTitleText": "门店列表",
+						"app-plus": {
+							"titleNView": {
+								"searchInput": {
+									"backgroundColor": "rgba(231, 231, 231,.7)",
+									"borderRadius": "16px",
+									"placeholder": "请输入关键字",
+									"placeholderColor": "#606266",
+									"align": "left"
+								},
+								"buttons": [{
+									"text": "搜索",
+									"fontSize": "14",
+									"color": "#303133",
+									"background": "rgba(0,0,0,0)",
+									"width": "40px"
+								}]
+							}
+						}
 					}
 				}
 			]
@@ -508,7 +527,7 @@
 				"text": "首页"
 			},
 			{
-				"pagePath": "pages/category/category",
+				"pagePath": "pages/home/category",
 				"iconPath": "static/tabBar/tab-cate.png",
 				"selectedIconPath": "static/tabBar/tab-cate-current.png",
 				"text": "分类"

+ 2 - 6
pages/home/index.vue

@@ -118,12 +118,6 @@
 		getUserInfo,
 		spread
 	} from '@/api/user.js';
-	// import {
-	// 	getBargainList,
-	// 	getProducts,
-	// 	goodsDetail,
-	// 	poster
-	// } from '@/api/product.js';
 	import {
 		saveUrl,
 		interceptor
@@ -137,6 +131,7 @@
 		shareLoad
 	} from '@/utils/wxAuthorized';
 	// #endif
+	import util from '@/utils/util.js';
 	export default {
 		data() {
 			return {
@@ -214,6 +209,7 @@
 			// 加载公众号分享
 			shareLoad()
 			// #endif
+			util.$L.getLocation();
 		},
 		onShow: function() {
 			this.loadData();

+ 103 - 61
pages/order/createOrder.vue

@@ -1,20 +1,20 @@
 <template>
 	<view class="padding-t-30">
-		<view class="flex">
-			<view class="">
+		<view class="flex tab-address goodsList">
+			<view class="left">
 				收货方式
 			</view>
-			<view class="flex">
-				<view class="">
+			<view class="flex right">
+				<view class=" item" :class="{action:tabCurrentIndex==1}" @click="tabCurrentIndex=1">
 					配送
 				</view>
-				<view class="">
+				<view class=" item" :class="{action:tabCurrentIndex==2}" @click="tabCurrentIndex=2">
 					自提
 				</view>
 			</view>
 		</view>
 		<!-- 地址 -->
-		<navigator  v-if="tabCurrentIndex == 2" url="/pages/set/address?source=1" class="address-section">
+		<navigator v-if="tabCurrentIndex == 1" url="/pages/set/address?source=1" class="address-section">
 			<view class="order-content" v-if="addressData.real_name">
 				<view class="cen">
 					<view class="top">
@@ -28,31 +28,37 @@
 			</view>
 			<view class="order-content" v-if="!addressData.real_name">
 				<view class="addAddress">
-					<text class="iconfont iconaddition"></text>
+					<text></text>
 					<text>添加收货地址</text>
 				</view>
 			</view>
 		</navigator>
-		<navigator v-if="tabCurrentIndex == 1" url="/pages/order/shopList" class="address-section">
-			<view class="order-content" v-if="shopAddress.name">
-				<text class="iconfont iconlocation"></text>
-				<view class="cen">
-					<view class="top">
-						<text class="name">{{ shopAddress.name }}</text>
-						<text class="mobile">{{ shopAddress.phone }}</text>
+		<navigator v-if="tabCurrentIndex == 2" url="/pages/order/shopList" class="address-section">
+			<view class="shop-box" v-if="shopAddress.name">
+				<view class="shop-top flex">
+					<view class="flex shop-title">
+						<image class="shopImg" :src="shopAddress.image" mode="scaleToFill"></image>
+						<view class="shop-name clamp2">{{ shopAddress.name }}</view>
+					</view>
+					<view class="shop-tip">
+						门店
 					</view>
-					<text class="address">{{ shopAddress.address }}</text>
 				</view>
-				<text class="iconfont iconenter"></text>
+				<view class="shop-content margin-t-10">
+					<view class="shop-address">
+						电话:{{ shopAddress.phone }}
+					</view>
+					<text class="shop-address">
+						地区:{{ shopAddress._detailed_address }}
+					</text>
+				</view>
 			</view>
 			<view class="order-content" v-if="!shopAddress.name">
 				<view class="addAddress">
-					<text class="iconfont iconaddition"></text>
+					<text></text>
 					<text>添加收货地址</text>
 				</view>
 			</view>
-		
-			<image class="a-bg" :src="addressImg"></image>
 		</navigator>
 		<view class="goodsList">
 
@@ -67,9 +73,6 @@
 							<text
 								class="price">¥{{ ls.productInfo.attrInfo ? ls.productInfo.attrInfo.price : ls.productInfo.price }}</text>
 							<text class="number">{{ 'x ' + ls.cart_num + (ls.productInfo.unit_name || '') }}</text>
-							<!-- <view class="number">
-							<uni-number-box class="step" :value="lss.number" :index="indx" @eventChange="numberChange"></uni-number-box>
-						</view> -->
 						</view>
 						<view class="serverSet" v-if="ls.day>0">
 							(<text>服务费:{{ls.day_deducted}}</text>
@@ -81,6 +84,14 @@
 		</view>
 		<!-- 金额明细 -->
 		<view class="yt-list">
+			<view class="yt-list-cell b-b"  v-if="tabCurrentIndex == 2">
+				<text class="cell-tit clamp">姓名</text>
+				<input class="desc" type="text" v-model="addressData.real_name" placeholder="请填写备注信息" placeholder-class="placeholder" />
+			</view>
+			<view class="yt-list-cell b-b"  v-if="tabCurrentIndex == 2">
+				<text class="cell-tit clamp">手机号</text>
+				<input class="desc" type="text" v-model="addressData.phone" placeholder="请填写备注信息" placeholder-class="placeholder" />
+			</view>
 			<view class="yt-list-cell b-b">
 				<text class="cell-tit clamp">运费</text>
 				<text class="cell-tip disabled">{{ Postage }}</text>
@@ -156,7 +167,7 @@
 	export default {
 		data() {
 			return {
-				tabCurrentIndex:2,//1为自提2为配送
+				tabCurrentIndex: 1, //1为自提2为配送
 				// #ifdef APP
 				payType: 'ali',
 				// #ifndef
@@ -262,8 +273,7 @@
 					obj.shopList = data.cartInfo; //商品列表
 					obj.moneyAll = data.priceGroup; //金额数据
 					obj.orderKey = data.orderKey; //订单key
-					obj.system_store = data.system_store;//到店自提列表
-					obj.shopAddress = data.system_store[0]; //选中的地址
+					obj.shopAddress = data.system_store; //到店自提列表
 					// 计算金额
 					this.payMoneyNub();
 				});
@@ -339,7 +349,7 @@
 							wx.requestPayment(data);
 							// #endif
 							// #ifdef APP
-							console.log( e.data.result.jsConfig,'返回数值');
+							console.log(e.data.result.jsConfig, '返回数值');
 							uni.requestPayment({
 								provider: 'wxpay',
 								orderInfo: e.data.result.jsConfig,
@@ -347,7 +357,7 @@
 									obj.paySuccessTo();
 								},
 								fail: (e) => {
-									console.log(e,'支付失败');
+									console.log(e, '支付失败');
 									uni.navigateTo({
 										url: '/pages/order/order?state=0'
 									});
@@ -356,7 +366,7 @@
 							// #endif
 						}
 						// #ifdef APP
-						if(obj.payType == 'ali'){
+						if (obj.payType == 'ali') {
 							uni.requestPayment({
 								provider: 'alipay',
 								orderInfo: e.data.result.jsConfig,
@@ -364,7 +374,7 @@
 									obj.paySuccessTo();
 								},
 								fail: (e) => {
-									console.log(e,'支付失败');
+									console.log(e, '支付失败');
 									uni.navigateTo({
 										url: '/pages/order/order?state=0'
 									});
@@ -410,7 +420,7 @@
 					// #ifdef APP-PLUS
 					from: 'app', //来源
 					// #endif
-					shipping_type: 1, //提货方式 1 快递 2自提
+					shipping_type: obj.tabCurrentIndex, //提货方式 1 快递 2自提
 				};
 				// 判断是否需要读取非默认商家id
 				if (obj.onShopId != -1) {
@@ -491,31 +501,16 @@
 				justify-content: center;
 				align-items: center;
 
-				.iconaddition {
-					font-size: 55rpx;
-					line-height: 1;
-					border-radius: 100rpx;
-					margin-right: 20rpx;
-				}
 			}
 		}
 
-		.iconlocation {
-			flex-shrink: 0;
-			display: flex;
-			align-items: center;
-			justify-content: center;
-			width: 90rpx;
-			color: #888;
-			font-size: 44rpx;
-		}
-
 		.cen {
 			display: flex;
 			flex-direction: column;
-			flex: 1;
 			font-size: 28rpx;
 			color: $font-color-dark;
+			width: 0px;
+			flex-grow: 1;
 		}
 
 		.name {
@@ -529,20 +524,6 @@
 			color: $font-color-light;
 		}
 
-		.icon-you {
-			font-size: 32rpx;
-			color: $font-color-light;
-			margin-right: 30rpx;
-		}
-
-		.a-bg {
-			position: absolute;
-			left: 0;
-			bottom: 0;
-			display: block;
-			width: 100%;
-			height: 5rpx;
-		}
 	}
 
 	.goodsList {
@@ -813,4 +794,65 @@
 			}
 		}
 	}
+
+	.tab-address {
+		margin-bottom: 30rpx;
+		margin-top: 0;
+
+		.left {
+			font-size: $font-base;
+		}
+
+		.right {
+			font-size: $font-sm;
+			color: #FFF;
+			background: $bg-green-gradual;
+			padding: 6rpx;
+			border-radius: 10rpx;
+			line-height: 1;
+
+			.item {
+				padding: 16rpx 20rpx;
+
+				&.action {
+					color: $uni-color-primary;
+					background-color: #FFF;
+					border-radius: 10rpx;
+				}
+			}
+		}
+	}
+	.shop-box{
+		.shop-top {
+			width: 100%;
+			.shop-title{
+				width: 0px;
+				flex-grow: 1;
+				justify-content: flex-start;
+				.shopImg {
+					height: 65rpx;
+					width: 65rpx;
+					border-radius: 100rpx;
+					margin-right: 20rpx;
+					flex-shrink: 0;
+				}
+				.shop-name{
+					font-weight: bold;
+					font-size: $font-lg;
+				}
+			}
+			.shop-tip{
+				color: #FFF;
+				padding: 5rpx 10rpx;
+				font-size: $font-sm;
+				background: linear-gradient(-90deg, #DCB876 0%, #EECD92 100%);
+				border-radius: 5rpx;
+			}
+		}
+		.shop-content{
+			color:  $font-color-light;
+			font-size: $font-sm;
+		}
+	}
+	
 </style>

+ 197 - 151
pages/order/shopList.vue

@@ -1,14 +1,41 @@
 <template>
 	<view class="content b-t">
 		<view class="list" v-for="(item, index) in addressList" :key="index" @click="checkAddress(item)">
-			<view class="wrapper">
-				<view class="address-box">
-					<text class="name">{{ item.name }}</text>
-					<text class="mobile">{{ item.phone }}</text>
-				</view>
-				<view class="u-box">
-					<view class="address">{{ item.address }}</view>
-					<view class="address">{{ item.detailed_address }}</view>
+			<view class="wrapper flex ">
+				<image class="logo margin-r-20" :src="item.image" mode="scaleToFill"></image>
+				<view class="list-content position-relative">
+					<view class="address-box flex">
+						<view class="name clamp">{{ item.name }}</view>
+						<view class="range flex" v-if="item.distance<1000">
+							<text>
+							距离{{ item.distance }}M
+							</text>
+							</view>
+						<view class="range flex" v-else>
+							<image class="address-icon" src="../../static/icon/shopAddress.png" mode="scaleToFill"></image>
+							<text>
+								
+							距离{{ item.range }}KM
+							</text>
+							</view>
+					</view>
+					<view class="u-box">
+						<view class="text flex-start">
+							<image class="icon" src="../../static/icon/shopIcon2.png" mode="widthFix"></image>
+							<text>
+								{{ item.phone }}
+							</text>
+						</view>
+						<view class="text flex-start">
+							<image class="icon" src="../../static/icon/shopIcon1.png" mode="widthFix"></image>
+							<text>
+								{{ item.address + item.detailed_address }}
+							</text>
+						</view>
+					</view>
+					<view class="time">
+						营业时间:{{item.day_time}}
+					</view>
 				</view>
 			</view>
 		</view>
@@ -16,157 +43,176 @@
 </template>
 
 <script>
-export default {
-	data() {
-		return {
-			source: 0,
-			addressList: [], //显示的地址数据
-			value: '', //保存查询值
-			addressListAll: [] //保存地址数据
-		};
-	},
-	// #ifdef APP-PLUS || H5
-	onNavigationBarButtonTap(e) {
-		if (e.text === '搜索') {
+	import {
+		storeList
+	} from '@/api/order.js';
+	import util from '@/utils/util.js';
+	export default {
+		data() {
+			return {
+				source: 0,
+				addressList: [], //显示的地址数据
+				value: '', //保存查询值
+				addressListAll: [], //保存地址数据
+				longitude: '', //经度
+				latitude: '', //未读
+				time:''//保存定时获取对象
+			};
+		},
+		// #ifdef APP-PLUS || H5
+		onNavigationBarButtonTap(e) {
+			if (e.text === '搜索') {
+				this.searchAddressList();
+			}
+		},
+		// 监听原生标题栏搜索输入框输入内容变化事件
+		onNavigationBarSearchInputChanged(e) {
+			this.value = e.text;
+		},
+		// 监听原生标题栏搜索输入框搜索事件,用户点击软键盘上的“搜索”按钮时触发
+		onNavigationBarSearchInputConfirmed() {
 			this.searchAddressList();
-		}
-	},
-	// 监听原生标题栏搜索输入框输入内容变化事件
-	onNavigationBarSearchInputChanged(e) {
-		this.value = e.text;
-	},
-	// 监听原生标题栏搜索输入框搜索事件,用户点击软键盘上的“搜索”按钮时触发
-	onNavigationBarSearchInputConfirmed() {
-		this.searchAddressList();
-	},
-	// #endif
-	onLoad(option) {
-		this.addressListAll = this.addressList = this.$api.prePage().system_store;
-		console.log(this.addressListAll);
-	},
-	methods: {
-		// 地址查询功能
-		searchAddressList() {
-			let obj = this;
-			obj.addressList = obj.addressListAll.filter(e => {
-				// 判断客户是否有输入值并且能查询到
-				if (e.name.indexOf(obj.value) >= 0 && obj.value) {
-					return true;
-				} else if (obj.value.length == 0) {
-					return true;
-				}
-			});
-			console.log(obj.addressList);
 		},
-		//选择地址
-		checkAddress(item) {
-			// 设置商品页面地址
-			this.$api.prePage().shopAddress = item;
-			uni.navigateBack();
+		// #endif
+		onLoad(option) {
+			const that = this;
+			that.longitude = uni.getStorageSync('CACHE_LONGITUDE');
+			that.latitude = uni.getStorageSync('CACHE_LATITUDE');
+			if (!that.longitude) {
+				uni.showModal({
+					title: '获取定位',
+					content: '为了更好的提供最近的门店需要获取您的定位信息',
+					cancelText: '暂不授权',
+					confirmText: '立即授权',
+					success: res => {
+						if (res.cancel) {
+							that.getStoreList();
+						}
+						if (res.confirm) {
+							util.$L.getLocation();
+							that.time = setInterval(()=>{
+								console.log(uni.getStorageSync('CACHE_LONGITUDE'),'获取到金纬度');
+								
+								if(uni.getStorageSync('CACHE_LONGITUDE')){
+									that.longitude = uni.getStorageSync('CACHE_LONGITUDE');
+									that.latitude = uni.getStorageSync('CACHE_LATITUDE');
+									that.getStoreList();
+									clearInterval(that.time)
+								}
+							},1000)
+						}
+					},
+					fail: () => {},
+					complete: () => {}
+				});
+			} else {
+				// 获取当前位置
+				that.getStoreList();
+			}
+		},
+		methods: {
+
+			// 获取列表
+			getStoreList() {
+				storeList({
+					longitude:this.longitude,
+					latitude:this.latitude,
+				}).then((res) => {
+					this.addressListAll = this.addressList = res.data.list;
+				})
+			},
+			// 地址查询功能
+			searchAddressList() {
+				let obj = this;
+				obj.addressList = obj.addressListAll.filter(e => {
+					// 判断客户是否有输入值并且能查询到
+					if (e.name.indexOf(obj.value) >= 0 && obj.value) {
+						return true;
+					} else if (obj.value.length == 0) {
+						return true;
+					}
+				});
+				console.log(obj.addressList);
+			},
+			//选择地址
+			checkAddress(item) {
+				// 设置商品页面地址
+				this.$api.prePage().shopAddress = item;
+				uni.navigateBack();
+			}
 		}
-	}
-};
+	};
 </script>
 
 <style lang="scss">
-page {
-	padding-bottom: 120rpx;
-	padding-top: 20rpx;
-}
-.content {
-	position: relative;
-}
-.list {
-	align-items: center;
-	padding: 20rpx 30rpx;
-	background: #fff;
-	margin: 20rpx;
-	margin-top: 0;
-	.buttom {
-		display: flex;
+	.content {
+		position: relative;
+		padding-top: 30rpx;
+	}
+
+	.list {
 		align-items: center;
-		justify-content: space-between;
-		padding-top: 10rpx;
-		.checkbox {
-			font-size: 44rpx;
-			line-height: 1;
-			padding: 4rpx;
-			color: $font-color-disabled;
-			background: #fff;
-			border-radius: 50px;
-		}
-		.checkbox.checked {
-			color: $base-color;
-		}
-		.default-buttom {
-			display: flex;
-			align-items: center;
-		}
-		.operation {
-			display: flex;
-			align-items: center;
-			.blank {
-				width: 30rpx;
+		padding: 20rpx 30rpx;
+		background: #fff;
+		margin: 0 $page-row-spacing;
+		margin-bottom: $page-row-spacing;
+		border-radius: 20rpx;
+
+		.wrapper {
+			.logo {
+				width: 180rpx;
+				height: 180rpx;
+				border-radius: 10rpx;
+			}
+
+			.list-content {
+				align-self: stretch;
+				display: flex;
+				flex-direction: column;
+				flex: 1;
+
+				.address-box {
+					.range {
+						font-size: $font-sm - 2rpx;
+						color: $font-color-disabled;
+						flex-shrink: 0;
+						.address-icon{
+							width: 28rpx;
+							height: 28rpx;
+						}
+					}
+
+					.name {
+						font-size: $font-lg;
+						font-weight: bold;
+						flex-grow: 1;
+					}
+				}
+
+				.u-box {
+					font-size: $font-sm;
+					color: $font-color-light;
+					margin-top: 16rpx;
+
+					.text {
+						.icon {
+							width: 28rpx;
+							margin-right: 10rpx;
+						}
+					}
+				}
+
+				.time {
+					position: absolute;
+					background: rgba(60, 130, 230, 0.12);
+					border-radius: 20rpx;
+					font-size: $font-sm - 4rpx;
+					color: $base-color;
+					bottom: 0;
+					left: 0;
+					padding: 0 20rpx;
+				}
 			}
-		}
-		.text {
-			padding-left: 10rpx;
-			font-size: 24rpx;
-			color: #666666;
 		}
 	}
-}
-.wrapper {
-	display: flex;
-	flex-direction: column;
-	flex: 1;
-	// border-bottom: 1px solid #f0f0f0;
-	// padding-bottom: 20rpx;
-}
-.address-box {
-	display: flex;
-	align-items: center;
-	justify-content: space-between;
-	.address {
-		font-size: $font-base + 2rpx;
-		color: $font-color-dark;
-	}
-	.mobile {
-		font-size: $font-base;
-		color: rgba(51, 51, 51, 1);
-	}
-}
-.u-box {
-	font-size: $font-base;
-	color: $font-color-light;
-	margin-top: 16rpx;
-	.name {
-		margin-right: 30rpx;
-	}
-}
-.icon-bianji {
-	display: flex;
-	align-items: center;
-	height: 80rpx;
-	font-size: 40rpx;
-	color: $font-color-light;
-	padding-left: 30rpx;
-}
-
-.add-btn {
-	position: fixed;
-	left: 30rpx;
-	right: 30rpx;
-	bottom: 16rpx;
-	z-index: 95;
-	display: flex;
-	align-items: center;
-	justify-content: center;
-	width: 690rpx;
-	height: 80rpx;
-	font-size: $font-lg;
-	color: #fff;
-	background-color: $base-color;
-	border-radius: 10rpx;
-}
 </style>

+ 3 - 3
pages/product/common/productContent.vue

@@ -7,7 +7,7 @@
 				<view class="price margin-l-10">
 					{{ goodsObjact.price }}
 					<!-- <text class="text">/份</text> -->
-					<!-- <text class="m-price" v-if="goodsObjact.ot_price > goodsObjact.price">¥{{ goodsObjact.ot_price }}</text> -->
+					<text class="m-price" v-if="goodsObjact.ot_price > goodsObjact.price">¥{{ goodsObjact.ot_price }}</text>
 				</view>
 			</view>
 			<view class="sales">
@@ -125,13 +125,13 @@
 			height: 64rpx;
 			padding: 10rpx 0;
 			font-size: 26rpx;
-			color: $uni-color-primary;
+			color: $color-red;
 		}
 
 		.price {
 			font-size: 44rpx;
 			font-weight: bold;
-
+			
 			.text {
 				padding-left: 5rpx;
 				color: #b0b0b0;

BIN
static/icon/gpsW.png


BIN
static/icon/shopAddress.png


BIN
static/icon/shopIcon1.png


BIN
static/icon/shopIcon2.png


+ 1 - 1
uni.scss

@@ -4,7 +4,7 @@ $page-row-spacing: 30rpx;
 $page-color-base: #f8f8f8;//页面背景颜色
 $page-color-light: #F4F4F4;
 // 主题颜色
-$base-color: #F65486;//项目颜色
+$base-color: #3C82E6;//项目颜色
 $box-shadow-color:#5dbc7c;//阴影颜色
 $font-color:#5dbc7c;//字体颜色
 $font-color-spec: #5dbc7c;//可操作文字颜色

+ 32 - 376
utils/util.js

@@ -1,350 +1,4 @@
-import {
- 	TOKENNAME,
- 	HTTP_REQUEST_URL
- } from '../config/app.js';
- import store from '../store';
- import {
- 	pathToBase64
- } from '@/plugin/image-tools/index.js';
- // #ifdef APP-PLUS
- // import permision from "permission.js"
- // #endif
  export default {
- 	/**
- 	 * opt  object | string
- 	 * to_url object | string
- 	 * 例:
- 	 * this.Tips('/pages/test/test'); 跳转不提示
- 	 * this.Tips({title:'提示'},'/pages/test/test'); 提示并跳转
- 	 * this.Tips({title:'提示'},{tab:1,url:'/pages/index/index'}); 提示并跳转值table上
- 	 * tab=1 一定时间后跳转至 table上
- 	 * tab=2 一定时间后跳转至非 table上
- 	 * tab=3 一定时间后返回上页面
- 	 * tab=4 关闭所有页面跳转至非table上
- 	 * tab=5 关闭当前页面跳转至table上
- 	 */
- 	Tips: function(opt, to_url) {
- 		if (typeof opt == 'string') {
- 			to_url = opt;
- 			opt = {};
- 		}
- 		let title = opt.title || '',
- 			icon = opt.icon || 'none',
- 			endtime = opt.endtime || 2000,
- 			success = opt.success;
- 		if (title) uni.showToast({
- 			title: title,
- 			icon: icon,
- 			duration: endtime,
- 			success
- 		})
- 		if (to_url != undefined) {
- 			if (typeof to_url == 'object') {
- 				let tab = to_url.tab || 1,
- 					url = to_url.url || '';
- 				switch (tab) {
- 					case 1:
- 						//一定时间后跳转至 table
- 						setTimeout(function() {
- 							uni.switchTab({
- 								url: url
- 							})
- 						}, endtime);
- 						break;
- 					case 2:
- 						//跳转至非table页面
- 						setTimeout(function() {
- 							uni.navigateTo({
- 								url: url,
- 							})
- 						}, endtime);
- 						break;
- 					case 3:
- 						//返回上页面
- 						setTimeout(function() {
- 							// #ifndef H5
- 							uni.navigateBack({
- 								delta: parseInt(url),
- 							})
- 							// #endif
- 							// #ifdef H5
- 							history.back();
- 							// #endif
- 						}, endtime);
- 						break;
- 					case 4:
- 						//关闭当前所有页面跳转至非table页面
- 						setTimeout(function() {
- 							uni.reLaunch({
- 								url: url,
- 							})
- 						}, endtime);
- 						break;
- 					case 5:
- 						//关闭当前页面跳转至非table页面
- 						setTimeout(function() {
- 							uni.redirectTo({
- 								url: url,
- 							})
- 						}, endtime);
- 						break;
- 				}
-
- 			} else if (typeof to_url == 'function') {
- 				setTimeout(function() {
- 					to_url && to_url();
- 				}, endtime);
- 			} else {
- 				//没有提示时跳转不延迟
- 				setTimeout(function() {
- 					uni.navigateTo({
- 						url: to_url,
- 					})
- 				}, title ? endtime : 0);
- 			}
- 		}
- 	},
- 	/**
- 	 * 移除数组中的某个数组并组成新的数组返回
- 	 * @param array array 需要移除的数组
- 	 * @param int index 需要移除的数组的键值
- 	 * @param string | int 值
- 	 * @return array
- 	 * 
- 	 */
- 	ArrayRemove: function(array, index, value) {
- 		const valueArray = [];
- 		if (array instanceof Array) {
- 			for (let i = 0; i < array.length; i++) {
- 				if (typeof index == 'number' && array[index] != i) {
- 					valueArray.push(array[i]);
- 				} else if (typeof index == 'string' && array[i][index] != value) {
- 					valueArray.push(array[i]);
- 				}
- 			}
- 		}
- 		return valueArray;
- 	},
- 	/**
- 	 * 生成海报获取文字
- 	 * @param string text 为传入的文本
- 	 * @param int num 为单行显示的字节长度
- 	 * @return array 
- 	 */
- 	textByteLength: function(text, num) {
- 		let strLength = 0;
- 		let rows = 1;
- 		let str = 0;
- 		let arr = [];
- 		for (let j = 0; j < text.length; j++) {
- 			if (text.charCodeAt(j) > 255) {
- 				strLength += 2;
- 				if (strLength > rows * num) {
- 					strLength++;
- 					arr.push(text.slice(str, j));
- 					str = j;
- 					rows++;
- 				}
- 			} else {
- 				strLength++;
- 				if (strLength > rows * num) {
- 					arr.push(text.slice(str, j));
- 					str = j;
- 					rows++;
- 				}
- 			}
- 		}
- 		arr.push(text.slice(str, text.length));
- 		return [strLength, arr, rows] //  [处理文字的总字节长度,每行显示内容的数组,行数]
- 	},
-
- 	/**
- 	 * 获取分享海报
- 	 * @param array arr2 海报素材
- 	 * @param string store_name 素材文字
- 	 * @param string price 价格
- 	 * @param function successFn 回调函数
- 	 * 
- 	 * 
- 	 */
- 	PosterCanvas: function(arr2, store_name, price, successFn) {
- 		let that = this;
- 		uni.showLoading({
- 			title: '海报生成中',
- 			mask: true
- 		});
- 		const ctx = uni.createCanvasContext('myCanvas');
- 		ctx.clearRect(0, 0, 0, 0);
- 		/**
- 		 * 只能获取合法域名下的图片信息,本地调试无法获取
- 		 * 
- 		 */
- 		uni.getImageInfo({
- 			src: arr2[0],
- 			success: function(res) {
-				console.log(res,'getImageInfo')
- 				const WIDTH = res.width;
- 				const HEIGHT = res.height;
- 				ctx.drawImage(arr2[0], 0, 0, WIDTH, HEIGHT);
- 				ctx.drawImage(arr2[1], 0, 0, WIDTH, WIDTH);
- 				ctx.save();
- 				let r = 90;
- 				let d = r * 2;
- 				let cx = 40;
- 				let cy = 990;
- 				ctx.arc(cx + r, cy + r, r, 0, 2 * Math.PI);
- 				// ctx.clip();
- 				ctx.drawImage(arr2[2], cx, cy,d,d);
- 				ctx.restore();
- 				const CONTENT_ROW_LENGTH = 40;
- 				let [contentLeng, contentArray, contentRows] = that.textByteLength(store_name, CONTENT_ROW_LENGTH);
- 				if (contentRows > 2) {
- 					contentRows = 2;
- 					let textArray = contentArray.slice(0, 2);
- 					textArray[textArray.length - 1] += '……';
- 					contentArray = textArray;
- 				}
- 				ctx.setTextAlign('center');
- 				ctx.setFontSize(32);
- 				let contentHh = 32 * 1.3;
- 				for (let m = 0; m < contentArray.length; m++) {
- 					ctx.fillText(contentArray[m], WIDTH / 2, 820 + contentHh * m);
- 				}
- 				ctx.setTextAlign('center')
- 				ctx.setFontSize(48);
- 				ctx.setFillStyle('red');
- 				ctx.fillText('¥' + price, WIDTH / 2, 880 + contentHh);
- 				ctx.draw(true, function() {
- 					uni.canvasToTempFilePath({
- 						canvasId: 'myCanvas',
- 						fileType: 'png',
- 						destWidth: WIDTH,
- 						destHeight: HEIGHT,
- 						success: function(res) {
- 							uni.hideLoading();
- 							successFn && successFn(res.tempFilePath);
- 						}
- 					})
- 				});
- 			},
- 			fail: function(err) {
- 				uni.hideLoading();
- 				that.Tips({
- 					title: '无法获取图片信息'
- 				});
- 			}
- 		})
- 	},
- 	/*
- 	 * 单图上传
- 	 * @param object opt
- 	 * @param callable successCallback 成功执行方法 data 
- 	 * @param callable errorCallback 失败执行方法 
- 	 */
- 	uploadImageOne: function(opt, successCallback, errorCallback) {
- 		let that = this;
- 		if (typeof opt === 'string') {
- 			let url = opt;
- 			opt = {};
- 			opt.url = url;
- 		}
- 		let count = opt.count || 1,
- 			sizeType = opt.sizeType || ['compressed'],
- 			sourceType = opt.sourceType || ['album', 'camera'],
- 			is_load = opt.is_load || true,
- 			uploadUrl = opt.url || '',
- 			inputName = opt.name || 'pics';
- 		uni.chooseImage({
- 			count: count, //最多可以选择的图片总数  
- 			sizeType: sizeType, // 可以指定是原图还是压缩图,默认二者都有  
- 			sourceType: sourceType, // 可以指定来源是相册还是相机,默认二者都有  
- 			success: function(res) {
-				console.log()
- 				//启动上传等待中...  
- 				uni.showLoading({
- 					title: '图片上传中',
-					mask:true
- 				});
-				uni.uploadFile({
-					url: HTTP_REQUEST_URL + '/api/' + uploadUrl,
-					filePath: res.tempFilePaths[0],
-					name: inputName,
-					formData: {
-						'filename': inputName
-					},
-					header: {
-						// #ifdef MP
-						"Content-Type": "multipart/form-data",
-						// #endif
-						[TOKENNAME]: 'Bearer ' + store.state.app.token
-					},
-					success: function(res) {
-						uni.hideLoading();
-						if (res.statusCode == 403) {
-							that.Tips({
-								title: res.data
-							});
-						} else {
-							let data = res.data ? JSON.parse(res.data) : {};
-							if (data.status == 200) {
-								successCallback && successCallback(data)
-							} else {
-								errorCallback && errorCallback(data);
-								that.Tips({
-									title: data.msg
-								});
-							}
-						}
-					},
-					fail: function(res) {
-						uni.hideLoading();
-						that.Tips({
-							title: '上传图片失败'
-						});
-					}
-				})
- 				// pathToBase64(res.tempFilePaths[0])
- 				// 	.then(imgBase64 => {
- 				// 		console.log(imgBase64);
- 						
- 				// 	})
- 				// 	.catch(error => {
- 				// 		console.error(error)
- 				// 	})
- 			}
- 		})
- 	},
- 	/**
- 	 * 处理服务器扫码带进来的参数
- 	 * @param string param 扫码携带参数
- 	 * @param string k 整体分割符 默认为:&
- 	 * @param string p 单个分隔符 默认为:=
- 	 * @return object
- 	 * 
- 	 */
- 	// #ifdef MP
- 	getUrlParams: function(param, k, p) {
- 		if (typeof param != 'string') return {};
- 		k = k ? k : '&'; //整体参数分隔符
- 		p = p ? p : '='; //单个参数分隔符
- 		var value = {};
- 		if (param.indexOf(k) !== -1) {
- 			param = param.split(k);
- 			for (var val in param) {
- 				if (param[val].indexOf(p) !== -1) {
- 					var item = param[val].split(p);
- 					value[item[0]] = item[1];
- 				}
- 			}
- 		} else if (param.indexOf(p) !== -1) {
- 			var item = param.split(p);
- 			value[item[0]] = item[1];
- 		} else {
- 			return param;
- 		}
- 		return value;
- 	},
- 	// #endif
  	/*
  	 * 合并数组
  	 */
@@ -516,37 +170,39 @@ import {
  				},
  				fail: (err) => {}
  			})
- 		}
- 		// async checkPermission() {
- 		// 	let status = permision.isIOS ? await permision.requestIOS('location') :
- 		// 		await permision.requestAndroid('android.permission.ACCESS_FINE_LOCATION');
+ 		},
+		// #ifdef APP-PLUS
+ 		async checkPermission() {
+ 			let status = permision.isIOS ? await permision.requestIOS('location') :
+ 				await permision.requestAndroid('android.permission.ACCESS_FINE_LOCATION');
 
- 		// 	if (status === null || status === 1) {
- 		// 		status = 1;
- 		// 	} else if (status === 2) {
- 		// 		uni.showModal({
- 		// 			content: "系统定位已关闭",
- 		// 			confirmText: "确定",
- 		// 			showCancel: false,
- 		// 			success: function(res) {}
- 		// 		})
- 		// 	} else if (status.code) {
- 		// 		uni.showModal({
- 		// 			content: status.message
- 		// 		})
- 		// 	} else {
- 		// 		uni.showModal({
- 		// 			content: "需要定位权限",
- 		// 			confirmText: "设置",
- 		// 			success: function(res) {
- 		// 				if (res.confirm) {
- 		// 					permision.gotoAppSetting();
- 		// 				}
- 		// 			}
- 		// 		})
- 		// 	}
- 		// 	return status;
- 		// },
+ 			if (status === null || status === 1) {
+ 				status = 1;
+ 			} else if (status === 2) {
+ 				uni.showModal({
+ 					content: "系统定位已关闭",
+ 					confirmText: "确定",
+ 					showCancel: false,
+ 					success: function(res) {}
+ 				})
+ 			} else if (status.code) {
+ 				uni.showModal({
+ 					content: status.message
+ 				})
+ 			} else {
+ 				uni.showModal({
+ 					content: "需要定位权限",
+ 					confirmText: "设置",
+ 					success: function(res) {
+ 						if (res.confirm) {
+ 							permision.gotoAppSetting();
+ 						}
+ 					}
+ 				})
+ 			}
+ 			return status;
+ 		},
+		// #endif
  	}
 
  }