lhl 2 lat temu
rodzic
commit
4fbef2d24e
4 zmienionych plików z 157 dodań i 14 usunięć
  1. 1 1
      pages/index/index.vue
  2. 20 7
      pages/shop/attestation.vue
  3. 114 5
      pages/shop/rent.vue
  4. 22 1
      pages/user_home/myRent.vue

+ 1 - 1
pages/index/index.vue

@@ -152,7 +152,7 @@
 			}
 			// #endif
 			// 获取定位数据
-			// this.getlocation();
+			this.getlocation();
 		},
 		onShow() {
 			this.getIndex()

+ 20 - 7
pages/shop/attestation.vue

@@ -1,6 +1,7 @@
 <template>
 	<view class="content">
 		<view class="yz-wrap" v-if="stap == 1">
+		<!-- <view class="yz-wrap"> -->
 			<view class="top-wrap flex">
 				<view class="top-left">
 					实名认证<text>*</text>
@@ -24,15 +25,15 @@
 				</view>
 				<input type="idcard" class="sr-inp" placeholder="请输入身份证号" v-model="idcard">
 			</view>
-			<!-- <view class="sr-wrap flex">
+			<view class="sr-wrap flex">
 				<view class="sr-tit">
-					验证码
+					推荐渠道
 				</view>
-				<input type="text" class="sr-inp" placeholder="请输入验证码">
-				<view class="sr-btn">
-					点击获取
+				<input type="text" class="sr-inp" placeholder="请输入推荐渠道" v-model="code">
+				<view class="sr-btn" @click="smget()">
+					扫码获取
 				</view>
-			</view> -->
+			</view>
 		</view>
 		<view class="yz-wrap" v-if="stap == 0">
 			<view class="top-wrap flex">
@@ -99,6 +100,7 @@
 	export default {
 		data() {
 			return {
+				code: '', //推荐渠道
 				stap: 0,
 				sfzz: '',
 				sfzf: '',
@@ -127,6 +129,16 @@
 
 		},
 		methods: {
+			smget() {
+				let that = this
+				// #ifdef MP-WEIXIN
+				uni.scanCode({
+					success: (res) => {
+						that.code = res.result
+					}
+				})
+				// #endif
+			},
 			upimgg(path, name) {
 				let that = this
 				that.upLoad(path).then((urldata) => {
@@ -181,7 +193,8 @@
 				certification({
 					name: that.name,
 					id_number: that.idcard,
-					phone_number: that.phone
+					phone_number: that.phone,
+					code: that.code
 				}).then(res => {
 					uni.showToast({
 						title: '提交成功',

+ 114 - 5
pages/shop/rent.vue

@@ -6,11 +6,27 @@
 			</view>
 			
 		</view>
+		<!-- 推荐渠道 -->
+		<view class="yt-list">
+			<view class="top-wrap flex">
+				<view class="top-left">
+					推荐渠道
+				</view>
+			</view>
+			<view class="contet-list flex" >
+				<view class="tc " style="display: flex;text-align: center;" :class="{'action': is_tj}" @click="couldTj?istj==true:''">
+					推荐渠道
+				</view>
+				<view class="tc" style="display: flex;text-align: center;" :class="{'action': !is_tj}">
+					{{isFj?'最近门店': '选择门店'}}
+				</view>
+			</view>
+		</view>
 		<!-- 门店选择 -->
-		<view class="yt-list tc-wrap" @click="navTo('/pages/shop/shopTab?select=1')">
+		<view class="yt-list tc-wrap" @click="navTo('/pages/shop/shopTab?select=1')" v-if="!is_tj">
 			<view class="top-wrap flex">
 				<view class="top-left">
-					选择门店
+					{{isFj?'最近门店': '选择门店'}}
 				</view>
 			</view>
 			<view class="store-wrap flex" v-if="selctStore && selctStore.id">
@@ -168,6 +184,11 @@
 </template>
 
 <script>
+	// #ifdef MP-WEIXIN
+	import {
+		openMap
+	} from '@/utils/rocessor.js';
+	// #endif
 	// #ifdef H5
 	import weixinObj from "@/plugin/jweixin-module/index.js";
 	// #endif
@@ -192,6 +213,9 @@
 	export default {
 		data() {
 			return {
+				is_tj: false,//是否使用推荐渠道
+				couldTj: false,//是否可用推荐渠道
+				isFj: false,//是否为最近门店
 				selctStore: {
 					id: ''
 				},
@@ -213,6 +237,9 @@
 		},
 		onShow() {
 			this.userinfo()
+			if( this.address.latitude == '') {
+				this.getlocation()
+			}
 		},
 		onReachBottom() {
 
@@ -221,7 +248,85 @@
 
 		},
 		methods: {
-			...mapMutations('user', ['setUserInfo']),
+			...mapMutations('user', ['setUserInfo','setAddress']),
+			// 获取附近门店
+			storeList(source) {
+				let that = this
+				storeList({
+						page: 1,
+						limit: 1,
+						latitude: that.address.latitude,
+						longitude: that.address.longitude,
+					})
+					.then(({
+						data
+					}) => {
+						// console.log(data, '结果');
+						if(data && data.list && data.list.length > 0) {
+							that.selctStore = data.list[0]
+							if(data.list[0].distance*1 <= 100 ) {
+								that.isFj = true
+							}
+						}
+					})
+					.catch(e => {
+						console.log(e);
+					});
+			},
+			// 获取经纬度
+			getlocation() {
+				let obj = this;
+				// #ifdef H5 || APP
+				uni.getLocation({
+					type: 'gcj02',
+					success(e) {
+						obj.getlocationSetInit(e)
+					},
+					fail(e) {
+						if(e.errCode==22){
+							uni.showModal({
+								title: '定位开启错误',
+								content: '请查看是否已经开启定位服务',
+								showCancel: false,
+							});
+						}
+						console.log(e, 'cw');
+					}
+				})
+				// #endif
+				// #ifdef MP-WEIXIN
+				openMap().then((e) => {
+					console.log("授权");
+					wx.getLocation({
+						type: 'gcj02',
+						success: (e) => {
+							console.log(e);
+							// 调用鉴定位置变化事件
+							this.getlocationSetInit(e)
+						},
+						fail() {
+						}
+					})
+				})
+				// #endif
+			},
+			// 获取经纬度完毕后回调处理
+			getlocationSetInit(data) {
+				const obj = this;
+				try {
+					console.log(data, '位置数据');
+					// 保存当前经纬度
+					obj.setAddress({
+						latitude: data.latitude,
+						longitude: data.longitude
+					})
+					this.storeList()
+				} catch (e) {
+					console.log(e, 'cww');
+					this.storeList()
+				}
+			},
+			
 			// 获取使用说明
 			getSm() {
 				details({}, 1).then(res => {
@@ -243,6 +348,10 @@
 					data
 				}) => {
 					this.now_money = data.now_money;
+					if(data.store_id > 0) {
+						this.couldTj = true
+						this.is_tj = true
+					}
 					this.setUserInfo(data)
 				});
 			},
@@ -268,12 +377,12 @@
 			},
 			toBuy() {
 				let that = this
-				if (that.selctStore.id == '') {
+				if (!that.is_tj && that.selctStore.id == '') {
 					return that.$api.msg('请选择门店')
 				}
 				that.loading = true
 				rentCreate({
-					store_id: that.selctStore.id,
+					store_id: that.is_tj?that.userinfo.store_id: that.selctStore.id,
 					rent_id: that.selectTc.id,
 					// #ifdef H5
 					from: 'weixin', //来源

+ 22 - 1
pages/user_home/myRent.vue

@@ -1,5 +1,11 @@
 <template>
 	<view class="content">
+		<view class="top-tit" v-if="dqtime">
+			<view class="tit">
+				电池到期时间: {{dqtime}}
+			</view>
+			
+		</view>
 		<view v-for="(item, index) in list" :key="index" class="order-item">
 			<view class="i-top b-b">
 				<text class="time">订单编号:{{ item.order_id }}</text>
@@ -35,6 +41,7 @@
 </template>
 
 <script>
+	import {getTime} from '@/utils/rocessor.js'
 	import { mapState } from 'vuex'
 	import {
 		getMyRent
@@ -62,7 +69,10 @@
 
 		},
 		computed: {
-			...mapState('user',['userInfo'])
+			...mapState('user',['userInfo']),
+			dqtime() {
+				return this.userInfo.battery_end_time?getTime(): ''
+			}
 		},
 		methods: {
 			navTo(url) {
@@ -317,4 +327,15 @@
 			}
 		}
 	}
+	.top-tit {
+		width: 750rpx;
+		background-color: #fff;
+		padding: 10rpx;
+		.tit {
+			font-size: 28rpx;
+			background-color:rgba(108, 217, 192, 0.4);
+			border-radius: 5rpx;
+			padding: 10rpx;
+		}
+	}
 </style>