蓝牙充值
This commit is contained in:
		
							parent
							
								
									26ecdffbec
								
							
						
					
					
						commit
						9e277c9059
					
				|  | @ -20,8 +20,8 @@ const install = (Vue, vm) => { | |||
| 	// 	},
 | ||||
| 	// }); 
 | ||||
| 	Vue.prototype.$u.http.setConfig({ | ||||
| 			// baseUrl: 'http://192.168.2.223:3302',
 | ||||
| 			baseUrl: 'https://kang.chuangtewl.com/prod-api', | ||||
| 			baseUrl: 'http://192.168.2.81:3302', | ||||
| 			// baseUrl: 'https://kang.chuangtewl.com/prod-api',
 | ||||
| 			loadingText: '努力加载中~', | ||||
| 			loadingTime: 800, | ||||
| 			// 设置自定义头部content-type
 | ||||
|  |  | |||
|  | @ -1145,7 +1145,7 @@ function init() { | |||
| 												// 	&& devices.devices[0].name != 'SMART_R2XS'
 | ||||
| 												// 	&& devices.devices[0].name != 'SMART_R2XS'
 | ||||
| 												// ) 
 | ||||
| 												if (devices.devices[0].name.indexOf("CTKG") != -1 || devices.devices[0].name.indexOf("CTPO") != -1){ | ||||
| 												if (devices.devices[0].name.indexOf("CTKG") != -1 || devices.devices[0].name.indexOf("CTPO") != -1 || devices.devices[0].name.indexOf("BBLE") != -1){ | ||||
| 													// console.log("跳过",devices.devices[0].name)
 | ||||
| 													// isnotexist = false;
 | ||||
| 													isnotexist = true; | ||||
|  |  | |||
|  | @ -69,7 +69,7 @@ | |||
|          			<view class="name_two">{{item.contactMobile}}</view> | ||||
|          		</view> | ||||
|          		<view class="name"> | ||||
|          			<view class="name_one">详细地址:</view> | ||||
|          			<view class="name_one" style="width: 160rpx;">详细地址:</view> | ||||
|          			<view class="name_two">{{item.address}}</view> | ||||
|          		</view> | ||||
|          		<view class="bot"> | ||||
|  |  | |||
|  | @ -41,7 +41,7 @@ | |||
| 				<view class="two">{{obj.businessTimeStart == undefined ? '' : obj.businessTimeStart}}~{{obj.businessTimeEnd == undefined ? '' : obj.businessTimeEnd}}</view> | ||||
| 			</view> | ||||
| 			<view class="xiao"> | ||||
| 				<view class="one">详细地址:</view> | ||||
| 				<view class="one" style="width: 160rpx;">详细地址:</view> | ||||
| 				<view class="two">{{obj.address}}</view> | ||||
| 			</view> | ||||
| 			<view class="xiao"> | ||||
|  |  | |||
|  | @ -55,7 +55,7 @@ | |||
| 				<view class="thr">{{obj.storeName == undefined ? '--' : obj.storeName}}</view> | ||||
| 			</view> | ||||
| 			<view class="jy"> | ||||
| 				<view class="one">经营地址:</view> | ||||
| 				<view class="one" style="width: 160rpx;">经营地址:</view> | ||||
| 				<view class="two">{{obj.storeAddress == undefined ? '--' : obj.storeAddress}}</view> | ||||
| 			</view> | ||||
| 			<view class="jy"> | ||||
|  |  | |||
|  | @ -40,15 +40,18 @@ | |||
| 					<view class="wbd" v-else style="color: #8883F0;" @click.stop="btnbds(item.deviceId)">未绑定</view> | ||||
| 				</view> | ||||
| 				<view class="bd"> | ||||
| 					<view class="one">经营地址</view> | ||||
| 					<view class="one" style="width: 160rpx;">经营地址</view> | ||||
| 					<view class="one">{{item.storeAddress == undefined ? '--' : item.storeAddress}}</view> | ||||
| 				</view> | ||||
| 				<view class="cen"> | ||||
| 				<view class="cen" v-if="type == 2"> | ||||
| 					<view class="fj">所在房间</view> | ||||
| 					<input type="text" v-model="room" :placeholder="item.room == undefined ? '无' : item.room" | ||||
| 						@click.stop="" /> | ||||
| 					<input type="text" v-model="item.room" :placeholder="item.room == undefined ? '无' : item.room" @change="change(item.room)" @click.stop="" /> | ||||
| 					<view class="btn" @click.stop="btnedit(item.deviceId)" v-if="type == 2">修改</view> | ||||
| 				</view> | ||||
| 				<view class="cen" v-else> | ||||
| 					<view class="fj">所在房间</view> | ||||
| 					<view>{{item.room}}</view> | ||||
| 				</view> | ||||
| 				<view class="devixexq"> | ||||
| 					<view class="xiaoav"> | ||||
| 						<view class="">设备状态</view> | ||||
|  | @ -191,6 +194,9 @@ | |||
| 					url: '/page_user/deviceedit?deviceId=' + deviceId | ||||
| 				}) | ||||
| 			}, | ||||
| 			change(room){ | ||||
| 				this.room = room | ||||
| 			}, | ||||
| 			// 修改房间号 | ||||
| 			btnedit(deviceId) { | ||||
| 				let data = { | ||||
|  | @ -469,7 +475,7 @@ | |||
| 				} | ||||
| 
 | ||||
| 				.zong { | ||||
| 					margin-top: 36rpx; | ||||
| 					margin-top: 14rpx; | ||||
| 					display: flex; | ||||
| 					justify-content: space-between; | ||||
| 					text-align: center; | ||||
|  |  | |||
|  | @ -18,70 +18,153 @@ | |||
| 				<!-- <text>客服</text> --> | ||||
| 			</view> | ||||
| 		</view> | ||||
| 
 | ||||
| 		<!-- 套餐 --> | ||||
| 		<view class="list"> | ||||
| 			<view class="list_item" :class="activeindex == item.suitId ? 'active' : ''" v-for="(item,index) in list" :key="index" | ||||
| 				@click="btnactive(item)"> | ||||
| 				<view class="tit"> | ||||
| 					<text class="tc" :class="activeindex == item.suitId ? 'active' : ''">{{item.name}}</text> <text class="yh" | ||||
| 						:class="activeindex == item.suitId ? 'actives' : ''">{{item.usePoint}}%用户选择</text> | ||||
| 				</view> | ||||
| 				<view class="bot"> | ||||
| 					<view class="price" :class="activeindex == item.suitId ? 'active' : ''"> | ||||
| 						¥{{item.price}} | ||||
| 					</view> | ||||
| 					<view class="time" :class="activeindex == item.suitId ? 'active' : ''"> | ||||
| 						可使用{{item.value}} {{item.timeUnit == 3 ? '分钟' : '小时'}} | ||||
| 					</view> | ||||
| 				</view> | ||||
| 			</view> | ||||
| 		</view> | ||||
| 		<!-- 说明 --> | ||||
| 		<view class="shuom"> | ||||
| 			<view class="shuomtit"> | ||||
| 				设备规格 | ||||
| 			</view> | ||||
| 			<view class="shuomwz"> | ||||
| 				尺寸:{{obj.size == undefined ? '--' : obj.size}} | ||||
| 			</view> | ||||
| 			<view class="shuomwz"> | ||||
| 				面料:{{obj.fabric == undefined ? '--' : obj.fabric}} | ||||
| 			</view> | ||||
| 			<view class="shuomwz"> | ||||
| 				填充物:{{obj.fill == undefined ? '--' : obj.fill}} | ||||
| 			</view> | ||||
| 			<view class="shuomwz"> | ||||
| 				设备地址:{{obj.storeName == undefined ? '' : obj.storeName}} {{obj.room == undefined ? '--' : obj.room}} | ||||
| 			</view> | ||||
| 		</view> | ||||
| 
 | ||||
| 
 | ||||
| 		<!-- 支付 --> | ||||
| 		<view class="tongyi"> | ||||
| 			<u-checkbox-group> | ||||
| 				<u-checkbox v-model="checked" @change="checkboxChange" active-color="#8883F0 ">我已同意 | ||||
| 				</u-checkbox><text>《用户服务协议》</text> | ||||
| 			</u-checkbox-group> | ||||
| 			<view class="zf" @click="btnzhifu" v-if="zhifuflag"> | ||||
| 				立即支付 | ||||
| 			</view> | ||||
| 			<view class="zf" v-else> | ||||
| 				立即支付 | ||||
| 			</view> | ||||
| 		</view> | ||||
|           | ||||
| 		 <!-- 检测蓝牙未开启 --> | ||||
| <!-- 		 <view class="shibai" v-if="lanyaflag"> | ||||
| 		 	<view class="top"> | ||||
| 		 		设备离线 | ||||
| 		 	</view> | ||||
| 		 	<view class="tishi"> | ||||
| 		 		检测到该设备离线,请打开蓝牙进行蓝牙模式 | ||||
| 		 	</view> | ||||
| 		 	<view class="li"> | ||||
| 		 		<view class="wz"> | ||||
| 		 			第一:检查手机蓝牙是否打开 | ||||
| 		 		</view> | ||||
| 		 		<image style="width: 386rpx;height: 263rpx;" | ||||
| 		 			src="https://api.ccttiot.com/smartmeter/img/static/uM4DY4Ee9AgFHLv4bIDR" mode=""></image> | ||||
| 		 	</view> | ||||
| 		 	<view class="li"> | ||||
| 		 		<view class="wz"> | ||||
| 		 			第二:设置小程序蓝牙授权 | ||||
| 		 		</view> | ||||
| 		 		<image style="width: 368rpx;height: 151rpx;" | ||||
| 		 			src="https://api.ccttiot.com/smartmeter/img/static/uAj06uo9qysixLrcFHBn" mode=""></image> | ||||
| 		 		<image style="width: 386rpx;height: 301rpx;" | ||||
| 		 			src="https://api.ccttiot.com/smartmeter/img/static/ugFSKFZn4mzJJHQx3K2Z" mode=""></image> | ||||
| 		 		<image style="width: 386rpx;height: 330rpx;" | ||||
| 		 			src="https://api.ccttiot.com/smartmeter/img/static/uZ4XoCI2KNQzcPKbwGLN" mode=""></image> | ||||
| 		 	</view> | ||||
| 		 	<view class="jxcz" @click="btnjxcz"> | ||||
| 		 		我已知晓 | ||||
| 		 	</view> | ||||
| 		 </view> --> | ||||
| 		  | ||||
| 		 <view class=""> | ||||
| 		 	<!-- 套餐 --> | ||||
| 		 	<view class="list"> | ||||
| 		 		<view class="list_item" :class="activeindex == item.suitId ? 'active' : ''" v-for="(item,index) in list" :key="index" | ||||
| 		 			@click="btnactive(item)"> | ||||
| 		 			<view class="tit"> | ||||
| 		 				<text class="tc" :class="activeindex == item.suitId ? 'active' : ''">{{item.name}}</text> <text class="yh" | ||||
| 		 					:class="activeindex == item.suitId ? 'actives' : ''">{{item.usePoint}}%用户选择</text> | ||||
| 		 			</view> | ||||
| 		 			<view class="bot"> | ||||
| 		 				<view class="price" :class="activeindex == item.suitId ? 'active' : ''"> | ||||
| 		 					¥{{item.price}} | ||||
| 		 				</view> | ||||
| 		 				<view class="time" :class="activeindex == item.suitId ? 'active' : ''"> | ||||
| 		 					可使用{{item.value}} {{item.timeUnit == 3 ? '分钟' : '小时'}} | ||||
| 		 				</view> | ||||
| 		 			</view> | ||||
| 		 		</view> | ||||
| 		 	</view> | ||||
| 		 	<!-- 说明 --> | ||||
| 		 	<view class="shuom"> | ||||
| 		 		<view class="shuomtit"> | ||||
| 		 			设备规格 | ||||
| 		 		</view> | ||||
| 		 		<view class="shuomwz"> | ||||
| 		 			尺寸:{{obj.size == undefined ? '--' : obj.size}} | ||||
| 		 		</view> | ||||
| 		 		<view class="shuomwz"> | ||||
| 		 			面料:{{obj.fabric == undefined ? '--' : obj.fabric}} | ||||
| 		 		</view> | ||||
| 		 		<view class="shuomwz"> | ||||
| 		 			填充物:{{obj.fill == undefined ? '--' : obj.fill}} | ||||
| 		 		</view> | ||||
| 		 		<view class="shuomwz"> | ||||
| 		 			设备地址:{{obj.storeName == undefined ? '' : obj.storeName}} {{obj.room == undefined ? '--' : obj.room}} | ||||
| 		 		</view> | ||||
| 		 	</view> | ||||
| 		 	 | ||||
| 		 	 | ||||
| 		 	<!-- 支付 --> | ||||
| 		 	<view class="tongyi"> | ||||
| 		 		<u-checkbox-group> | ||||
| 		 			<u-checkbox v-model="checked" @change="checkboxChange" active-color="#8883F0 ">我已同意 | ||||
| 		 			</u-checkbox><text>《用户服务协议》</text> | ||||
| 		 		</u-checkbox-group> | ||||
| 		 		<view class="zf" @click="btnzhifu"> | ||||
| 		 			立即支付 | ||||
| 		 		</view> | ||||
| 		 		<!-- <view class="zf" v-else> | ||||
| 		 			立即支付 | ||||
| 		 		</view> --> | ||||
| 		 	</view> | ||||
| 		 </view> | ||||
|         | ||||
| 		<!-- 背景 --> | ||||
| 		<view class="" style="position: fixed;top: 0;left: 0;width: 100%;height: 100vh;z-index: -1;"> | ||||
| 			<image style="width: 100%;height: 100vh;" | ||||
| 				src="https://api.ccttiot.com/smartmeter/img/static/uOiCQSDjukktdvbx5oPw" mode=""></image> | ||||
| 		</view> | ||||
| 		 | ||||
| 		<!-- 客服列表 --> | ||||
| 		<view class="kflist" v-if="kfflag"> | ||||
| 			<view class="kftit"> | ||||
| 				请选择您要联系的客服 | ||||
| 			</view> | ||||
| 			<view class="kfwz"> | ||||
| 				我们根据选择为您提供服务 | ||||
| 			</view> | ||||
| 			<view class="kfshuzu"> | ||||
| 				<view class="item_val" v-for="(item,index) in 1" :key="index"> | ||||
| 					<view class="lt"> | ||||
| 						<image src="https://api.ccttiot.com/smartmeter/img/static/uruHLe3W460sdXr2lcxF" mode=""></image> | ||||
| 					</view> | ||||
| 					<view class="rt"> | ||||
| 						<view class="">官方客服</view> | ||||
| 						<view class="" style="border-bottom: 1px solid #000;" @click="btncall">13850396941</view> | ||||
| 					</view> | ||||
| 				</view> | ||||
| 			</view> | ||||
| 			<view class="qx" @click="kfflag = false"> | ||||
| 				取消 | ||||
| 			</view> | ||||
| 		</view> | ||||
| 		<view class="mask" v-if="kfflag"></view> | ||||
| 		 | ||||
| 		<!-- 蓝牙充值动画 --> | ||||
| 		<view class="czdh"  v-if="jzflag"> | ||||
| 		    <view class="bj"> | ||||
| 		    	<view class="tittop"> | ||||
| 		    		正在充值中,请稍后 | ||||
| 		    	</view> | ||||
| 		    	<view class="bfb"> | ||||
| 		    		{{progress}} % | ||||
| 		    	</view> | ||||
| 		    </view> | ||||
| 		</view> | ||||
| 		 | ||||
| 	</view> | ||||
| </template> | ||||
| 
 | ||||
| <script> | ||||
| 	var xBlufi = require("@/components/blufi/xBlufi.js");   | ||||
| 	export default { | ||||
| 		data() { | ||||
| 			return { | ||||
| 				jine:'', | ||||
| 				jzflag:false, | ||||
| 				progress: 0, | ||||
| 				mac:'', | ||||
| 				deviceId: '', | ||||
| 				name: '', | ||||
| 				czflag: false, | ||||
| 				lanyaflag: false, | ||||
| 				ver_data: '', | ||||
| 				devicesList: [], | ||||
| 				bgc: { | ||||
| 					// backgroundColor: "#8883f0", | ||||
| 				}, | ||||
|  | @ -104,7 +187,10 @@ | |||
| 				suitFeeType:'', | ||||
| 				title:'', | ||||
| 				sbobj:{}, | ||||
| 				onlineStatus:'' | ||||
| 				onlineStatus:'', | ||||
| 				kfflag:false, | ||||
| 				timer:null, | ||||
| 				titflag:false | ||||
| 			} | ||||
| 		}, | ||||
| 		onLoad(option) { | ||||
|  | @ -139,6 +225,16 @@ | |||
| 				}) | ||||
| 			} | ||||
| 		}, | ||||
| 		onUnload: function() { | ||||
| 			if (this.timer) { | ||||
| 				clearInterval(this.timer) | ||||
| 				this.timer = null; | ||||
| 			} | ||||
| 			xBlufi.listenDeviceMsgEvent(false, this.funListenDeviceMsgEvent); | ||||
| 			xBlufi.notifyStartDiscoverBle({ | ||||
| 				'isStart': false | ||||
| 			}) | ||||
| 		}, | ||||
| 		// 分享到好友(会话) | ||||
| 		onShareAppMessage: function() { | ||||
| 			return { | ||||
|  | @ -156,6 +252,29 @@ | |||
| 			} | ||||
| 		}, | ||||
| 		methods: { | ||||
| 			// 点击我已知晓 | ||||
| 			// btnjxcz() { | ||||
| 			// 	this.czflag = false | ||||
| 			// 	xBlufi.initXBlufi(1) | ||||
| 			// 	xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent); | ||||
| 			// 	xBlufi.notifyStartDiscoverBle({ | ||||
| 			// 		'isStart': true | ||||
| 			// 	}) | ||||
| 			// 	setTimeout(() => { | ||||
| 			// 		xBlufi.notifyStartDiscoverBle({ | ||||
| 			// 			'isStart': false | ||||
| 			// 		}) | ||||
| 			// 		if (this.devicesList.length > 0) { | ||||
| 			// 			xBlufi.notifyConnectBle({ | ||||
| 			// 				isStart: true, | ||||
| 			// 				deviceId: this.deviceId, | ||||
| 			// 				name: this.name | ||||
| 			// 			}) | ||||
| 			// 		} | ||||
| 			// 	}, 2000) | ||||
| 			// }, | ||||
| 			 | ||||
| 			 | ||||
| 			// 获取设备套餐列表 | ||||
| 			getlist() { | ||||
| 				this.$u.get(`app/device/${this.id}/withSuitList`).then((res) => { | ||||
|  | @ -163,7 +282,7 @@ | |||
| 						this.list = res.data.suitList | ||||
| 						this.obj = res.data | ||||
| 						this.onlineStatus = res.data.onlineStatus | ||||
| 						// this.getsb(res.data.deviceId) | ||||
| 						this.mac = 'CTKG-' + res.data.mac | ||||
| 					}else if(res.code == 401){ | ||||
| 						uni.navigateTo({ | ||||
| 							url:'/pages/login/login' | ||||
|  | @ -174,11 +293,180 @@ | |||
| 			// 点击支付	 | ||||
| 			btnzhifu() { | ||||
| 				if(this.onlineStatus == 0){ | ||||
| 					uni.showToast({ | ||||
| 						title: '该设备离线,暂不能使用', | ||||
| 						icon: 'none', | ||||
| 						duration: 1000 | ||||
| 					}) | ||||
| 					if (this.ver_data == '') { | ||||
| 						this.czflag = true | ||||
| 						uni.showLoading({ | ||||
| 							title: '蓝牙连接中' | ||||
| 						}) | ||||
| 						let that = this | ||||
| 						xBlufi.initXBlufi(1); | ||||
| 						xBlufi.listenDeviceMsgEvent(true, that.funListenDeviceMsgEvent); | ||||
| 						xBlufi.notifyStartDiscoverBle({ | ||||
| 							'isStart': true | ||||
| 						}) | ||||
| 						setTimeout(() => { | ||||
| 							xBlufi.notifyStartDiscoverBle({ | ||||
| 								'isStart': false | ||||
| 							}) | ||||
| 							if (that.devicesList.length > 0) { | ||||
| 								xBlufi.notifyConnectBle({ | ||||
| 									isStart: true, | ||||
| 									deviceId: that.deviceId, | ||||
| 									name: that.name | ||||
| 								}) | ||||
| 							} | ||||
| 						}, 2000) | ||||
| 						uni.showModal({ | ||||
| 							title: '温馨提示', | ||||
| 							content: `检测到该设备未联网,为您切换为蓝牙模式,支付的时候靠近该设备,并打开蓝牙`, | ||||
| 							showCancel: false, | ||||
| 						}) | ||||
| 						setTimeout(()=>{ | ||||
| 							if(that.ver_data == ''){ | ||||
| 								uni.showToast({ | ||||
| 									title: '未连接成功,如多次失败请点击右上角联系客服咨询', | ||||
| 									icon: 'none', | ||||
| 									duration: 5000 | ||||
| 								}) | ||||
| 								that.czflag = false | ||||
| 								setTimeout(()=>{ | ||||
| 									uni.hideLoading() | ||||
| 								},5000) | ||||
| 							} | ||||
| 						},18000) | ||||
| 					}else{ | ||||
| 						this.zhifuflag = false | ||||
| 						let that = this | ||||
| 						let data = { | ||||
| 							deviceNo: that.id, | ||||
| 							suitId: that.zfobj.suitId, | ||||
| 							money: that.zfobj.price, | ||||
| 							suitTime: that.zfobj.value, | ||||
| 							suitTimeUnit:that.suitTimeUnit, | ||||
| 							suitFeeMode:that.suitFeeMode, | ||||
| 							suitFeeType:that.suitFeeType, | ||||
| 							suitGearAmount:that.suitGearAmount, | ||||
| 							suitGearTime:that.suitGearTime, | ||||
| 							suitPrice:that.suitPrice | ||||
| 						} | ||||
| 						that.$u.post('/app/bill/recharge', data).then(res => { | ||||
| 							if(res.code == 200){ | ||||
| 								that.orderno = res.data | ||||
| 								that.$u.get(`/app/pay/wx/${that.orderno}`).then((res) => { | ||||
| 									if (res.code == 200) { | ||||
| 											uni.requestPayment({ | ||||
| 												provider: 'wxpay', | ||||
| 												timeStamp: res.data.payParams.timeStamp, | ||||
| 												nonceStr: res.data.payParams.nonceStr, | ||||
| 												package: res.data.payParams.packageVal, | ||||
| 												signType: res.data.payParams.signType, | ||||
| 												paySign: res.data.payParams.paySign, | ||||
| 												success: (res) => { | ||||
| 													if (that.timer) { | ||||
| 														clearInterval(this.timer); | ||||
| 														that.timer = null; | ||||
| 													} | ||||
| 													// 111111111111111111111111  | ||||
| 													that.$u.put(`/app/bill/${that.orderno}/refreshPayResult`).then(res =>{ | ||||
| 														// if(res.code == 200){ | ||||
| 															that.$u.get('/app/bill/recharge/device/fail/list').then(res => { | ||||
| 																	if (res.code == 200) { | ||||
| 																		if(res.data.length != 0){ | ||||
| 																			let dingobj = res.data[0].billNo | ||||
| 																			uni.getNetworkType({ | ||||
| 																				success(res) { | ||||
| 																					if (res.networkType !== 'none') { | ||||
| 																						uni.getConnectedBluetoothDevices({ | ||||
| 																							success(res) { | ||||
| 																								that.jzflag = true | ||||
| 																								that.startLoading() | ||||
| 																								setTimeout(()=> { | ||||
| 																									xBlufi.notifySendCustomData({ | ||||
| 																											customData: "time@" + that.jine | ||||
| 																										}) | ||||
| 																								},1500) | ||||
| 																							}, | ||||
| 																							fail(err) { | ||||
| 																								console.error('获取已连接蓝牙设备信息失败:',err) | ||||
| 																							} | ||||
| 																						}) | ||||
| 																						that.$u.get(`/app/bill/recharge/${dingobj}/bluetoothSuccess`).then(res => { | ||||
| 																									if (res.code == 200) { | ||||
| 																										that.zhifuflag = true | ||||
| 																										console.log('蓝牙离线充值成功11') | ||||
| 																										setTimeout(() => { | ||||
| 																											uni.reLaunch({ | ||||
| 																												url:'/pages/index/index?id=' + that.orderno | ||||
| 																											}) | ||||
| 																										},1000) | ||||
| 																									} | ||||
| 																								}) | ||||
| 																					} else { | ||||
| 																						console.log('手机未连接网络') | ||||
| 																						// this.baiflag = false | ||||
| 																					} | ||||
| 																				} | ||||
| 																			}) | ||||
| 																		}else{ | ||||
| 																			uni.getNetworkType({ | ||||
| 																				success(res) { | ||||
| 																					if (res.networkType !== 'none') { | ||||
| 																						uni.getConnectedBluetoothDevices({ | ||||
| 																							success(res) { | ||||
| 																								that.jzflag = true | ||||
| 																								that.startLoading() | ||||
| 																								setTimeout(()=> { | ||||
| 																									xBlufi.notifySendCustomData({ | ||||
| 																											customData: "time@" + that.jine | ||||
| 																										}) | ||||
| 																								},1500) | ||||
| 																							}, | ||||
| 																							fail(err) { | ||||
| 																								console.error('获取已连接蓝牙设备信息失败:',err) | ||||
| 																							} | ||||
| 																						}) | ||||
| 																				        that.zhifuflag = true | ||||
| 																				        setTimeout(() => { | ||||
| 																				        	uni.reLaunch({ | ||||
| 																				        		url:'/pages/index/index?id=' + that.orderno | ||||
| 																				        	}) | ||||
| 																				        },1000) | ||||
| 																					} else { | ||||
| 																						console.log('手机未连接网络') | ||||
| 																						// this.baiflag = false | ||||
| 																					} | ||||
| 																				} | ||||
| 																			}) | ||||
| 																		} | ||||
| 
 | ||||
| 																	} | ||||
| 																}) | ||||
| 														// } | ||||
| 													}) | ||||
| 													// 支付成功逻辑 | ||||
| 													uni.setStorageSync('time', that.expireTimeStr) | ||||
| 												}, | ||||
| 												fail(err) { | ||||
| 													this.zhifuflag = true | ||||
| 													setTimeout(() => { | ||||
| 														this.czflag = false | ||||
| 														uni.hideLoading() | ||||
| 													}, 500) | ||||
| 													// 支付失败逻辑 | ||||
| 													uni.showToast({ | ||||
| 														title: '支付失败', | ||||
| 														icon: 'none', | ||||
| 														duration: 2000 | ||||
| 													}); | ||||
| 												} | ||||
| 											}) | ||||
| 									}else{ | ||||
| 										this.zhifuflag = true | ||||
| 									} | ||||
| 								}) | ||||
| 							} | ||||
| 						}) | ||||
| 					} | ||||
| 				}else{ | ||||
| 					if(this.checked == false){ | ||||
| 						uni.showToast({ | ||||
|  | @ -230,7 +518,6 @@ | |||
| 												that.$u.put(`/app/bill/${that.payNo}/refreshPayResult`).then(res => {}) | ||||
| 												// 支付成功逻辑 | ||||
| 												uni.reLaunch({ | ||||
| 													// url:'/page_user/mydetail?id=' + that.orderno | ||||
| 													url:'/pages/index/index' | ||||
| 												}) | ||||
| 											}, | ||||
|  | @ -269,6 +556,107 @@ | |||
| 					} | ||||
| 				} | ||||
| 			}, | ||||
| 			 | ||||
| 			// 蓝牙充值动画 | ||||
| 			startLoading() { | ||||
| 			   this.isLoading = true; | ||||
| 			   const intervalId = setInterval(() => { | ||||
| 			     this.progress += 100 / 100; // 每次增加 1 | ||||
| 			     if (this.progress >= 99) { | ||||
| 			       clearInterval(intervalId); | ||||
| 			       this.isLoading = false; | ||||
| 			       this.progress = 98; // 确保进度条最终达到98 | ||||
| 			     } | ||||
| 			   }, 15); | ||||
| 			}, | ||||
| 			// 获取附近蓝牙设备列表 | ||||
| 			funListenDeviceMsgEvent: function(options) { | ||||
| 				switch (options.type) {  | ||||
| 					case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS: | ||||
| 						if (options.result) { | ||||
| 							let devicesarr = options.data | ||||
| 							console.log(devicesarr,this.mac,'111'); | ||||
| 							devicesarr.forEach(device => { | ||||
| 								const mac = device.name.substring(4); | ||||
| 								if (device.name.slice(5, 17) == this.mac.slice(5, 17)) { | ||||
| 									this.deviceId = device.deviceId | ||||
| 									this.name = device.name | ||||
| 									this.devicesList.push(device); | ||||
| 									let uniqueDevicesList = Array.from(new Set(this.devicesList)); | ||||
| 									// 将去重后的数组重新赋值给 this.devicesList | ||||
| 									this.devicesList = uniqueDevicesList; | ||||
| 								}  | ||||
| 							}) | ||||
| 						} | ||||
| 						break; | ||||
| 					case xBlufi.XBLUFI_TYPE.TYPE_CONNECTED: | ||||
| 						console.log("连接回调:" + JSON.stringify(options)); | ||||
| 						if (options.result) { | ||||
| 							// console.log('125451245')   | ||||
| 							{ | ||||
| 								xBlufi.notifyInitBleEsp32({ | ||||
| 									deviceId: this.deviceId | ||||
| 								}); | ||||
| 								xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvents); | ||||
| 								this.deviceIds = options.data.deviceId | ||||
| 								this.name = this.name | ||||
| 							} | ||||
| 						}else{ | ||||
| 							 | ||||
| 						} | ||||
| 			 | ||||
| 						break; | ||||
| 					case xBlufi.XBLUFI_TYPE.TYPE_RECIEVE_CUSTON_DATA: | ||||
| 						this.ver_data = this.parseCustomData(options.data) | ||||
| 						console.log("1收到设备发来的自定义数据结果:", this.ver_data); | ||||
| 						setTimeout(()=>{ | ||||
| 							this.czflag = false | ||||
| 							uni.hideLoading() | ||||
| 						},1000) | ||||
| 						break; | ||||
| 					case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_STOP: | ||||
| 						if (options.result) { | ||||
| 							let uniqueDevicesList = Array.from(new Set(this.devicesList)); | ||||
| 							let filteredDevices = uniqueDevicesList.filter(device => device.name.substring(0, 4) === "CTKG"); | ||||
| 							// 将过滤后的数组重新赋值给 this.devicesList | ||||
| 							this.devicesList = filteredDevices; | ||||
| 						} | ||||
| 						break; | ||||
| 					case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_START: | ||||
| 						if (!options.result) { | ||||
| 							this.lanyaflag = true | ||||
| 							uni.showToast({ | ||||
| 								title: '蓝牙未开启', | ||||
| 								icon: 'none', | ||||
| 								duration: 3000 | ||||
| 							}); | ||||
| 							return | ||||
| 						} else { | ||||
| 							this.lanyaflag = false | ||||
| 						} | ||||
| 						break; | ||||
| 				} | ||||
| 			}, | ||||
| 			// 从蓝牙拿到数据进行解析 | ||||
| 			parseCustomData(data) { | ||||
| 				// 将字符串按照 "@" 分割成数组 | ||||
| 				const dataArray = data.split('@'); | ||||
| 				const voltage = parseFloat(dataArray[0].substring(1)); // 去除前缀 "V",并将字符串转换为浮点数 | ||||
| 				const switchState = dataArray[1].substring(1); // 去除前缀 "S" | ||||
| 				const current = parseFloat(dataArray[2].substring(1)); // 去除前缀 "A",并将字符串转换为浮点数 | ||||
| 				const power = parseFloat(dataArray[4].substring(1)); // 去除前缀 "P",并将字符串转换为浮点数 | ||||
| 				const remainingPower = parseFloat(dataArray[5].substring(1)); // 去除前缀 "M",并将字符串转换为浮点数 | ||||
| 				const setMode = dataArray[6].substring(1); // 去除前缀 "T" | ||||
| 				// 返回解析后的数据对象 | ||||
| 				return { | ||||
| 					voltage, | ||||
| 					switchState, | ||||
| 					current, | ||||
| 					power, | ||||
| 					remainingPower, | ||||
| 					setMode | ||||
| 				}; | ||||
| 			}, | ||||
| 
 | ||||
| 			btnactive(item) { | ||||
| 				this.activeindex = item.suitId | ||||
|  | @ -281,6 +669,15 @@ | |||
| 				this.suitGearTime = item.gearTime | ||||
| 				this.suitFeeMode = item.feeMode | ||||
| 				this.suitFeeType = item.feeType | ||||
| 				if(item.timeUnit == 1){ | ||||
| 					this.jine = item.value  * 24 * 60 * 60 | ||||
| 				}else if(item.timeUnit == 2){ | ||||
| 					this.jine = item.value * 60 * 60 | ||||
| 				}else if(item.timeUnit == 3){ | ||||
| 					this.jine = item.value * 60 | ||||
| 				}else if(item.timeUnit == 4){ | ||||
| 					this.jine = item.value | ||||
| 				} | ||||
| 			}, | ||||
| 
 | ||||
| 			btnshouye() { | ||||
|  | @ -293,14 +690,12 @@ | |||
| 			}, | ||||
| 			// 联系客服 | ||||
| 			call() { | ||||
| 				let phoneNumber = '' | ||||
| 				if (this.obj.storeContactMobile == null) { | ||||
| 					phoneNumber = this.obj.userMobile | ||||
| 				} else { | ||||
| 					phoneNumber = this.obj.storeContactMobile | ||||
| 				} | ||||
| 				this.kfflag = true | ||||
| 			}, | ||||
| 			// 拨打客服电话 | ||||
| 			btncall(){ | ||||
| 				uni.makePhoneCall({ | ||||
| 					phoneNumber: phoneNumber, | ||||
| 					phoneNumber: '13850396941', | ||||
| 					success: function(res) { | ||||
| 						console.log('拨打电话成功', res) | ||||
| 					}, | ||||
|  | @ -312,7 +707,9 @@ | |||
| 						}) | ||||
| 					} | ||||
| 				}) | ||||
| 			}, | ||||
| 			} | ||||
| 			 | ||||
| 			 | ||||
| 		} | ||||
| 	} | ||||
| </script> | ||||
|  | @ -325,21 +722,161 @@ | |||
| 
 | ||||
| 	.actives { | ||||
| 		background-color: #fff !important; | ||||
| 		// color: #fff !important; | ||||
| 	} | ||||
| 
 | ||||
| 	/deep/ .u-title { | ||||
| 		padding-bottom: 15rpx; | ||||
| 	} | ||||
| 
 | ||||
| 	// /deep/ .u-icon__icon { | ||||
| 	// 	padding-bottom: 15rpx; | ||||
| 	// } | ||||
| 
 | ||||
| 	.czdh{ | ||||
| 		width: 100%; | ||||
| 		height: 100vh; | ||||
| 		position: fixed; | ||||
| 		top: 0; | ||||
| 		left: 0; | ||||
| 		background-color: rgba(0, 0, 0, .5); | ||||
| 		padding-top: 700rpx; | ||||
| 		.bj{ | ||||
| 			width: 500rpx; | ||||
| 			height: 300rpx; | ||||
| 			background-color: #fff; | ||||
| 			margin: auto; | ||||
| 			border-radius: 20rpx; | ||||
| 			.tittop{ | ||||
| 				width: 100%; | ||||
| 				text-align: center; | ||||
| 				padding-top: 50rpx; | ||||
| 				box-sizing: border-box; | ||||
| 			} | ||||
| 			.bfb{ | ||||
| 				width: 100%; | ||||
| 				text-align: center; | ||||
| 				padding-top: 50rpx; | ||||
| 				box-sizing: border-box; | ||||
| 				font-size: 50rpx; | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
|     .kflist{ | ||||
| 		width: 590rpx; | ||||
| 		height: 874rpx; | ||||
| 		background: #FFFFFF; | ||||
| 		border-radius: 28rpx 28rpx 28rpx 28rpx; | ||||
| 		position: fixed; | ||||
| 		top: 326rpx; | ||||
| 		left: 50%; | ||||
| 		transform: translateX(-50%); | ||||
| 		z-index: 1; | ||||
| 		padding-top: 48rpx; | ||||
| 		box-sizing: border-box; | ||||
| 		.qx{ | ||||
| 			width: 436rpx; | ||||
| 			height: 68rpx; | ||||
| 			background: #A29EFF; | ||||
| 			border-radius: 40rpx 40rpx 40rpx 40rpx; | ||||
| 			text-align: center; | ||||
| 			line-height: 68rpx; | ||||
| 			font-size: 32rpx; | ||||
| 			color: #FFFFFF; | ||||
| 			margin: auto; | ||||
| 			margin-top: 52rpx; | ||||
| 		} | ||||
| 		.kftit{ | ||||
| 			font-size: 40rpx; | ||||
| 			color: #3D3D3D; | ||||
| 			font-size: 500; | ||||
| 			width: 100%; | ||||
| 			text-align: center; | ||||
| 		} | ||||
| 		.kfwz{ | ||||
| 			font-size: 28rpx; | ||||
| 			color: #3D3D3D; | ||||
| 			margin-top: 16rpx; | ||||
| 			width: 100%; | ||||
| 			text-align: center; | ||||
| 		} | ||||
| 		.kfshuzu{ | ||||
| 			 .item_val{ | ||||
| 				 display: flex; | ||||
| 				 align-items: center; | ||||
| 				 padding-left: 30rpx; | ||||
| 				 box-sizing: border-box; | ||||
| 				 width: 528rpx; | ||||
| 				 height: 144rpx; | ||||
| 				 background: #FFFFFF; | ||||
| 				 box-shadow: 0rpx 4rpx 22rpx 0rpx rgba(0,0,0,0.1); | ||||
| 				 border-radius: 20rpx 20rpx 20rpx 20rpx; | ||||
| 				 margin: auto; | ||||
| 				 margin-top: 42rpx; | ||||
| 				 .lt{ | ||||
| 					 margin-right: 34rpx; | ||||
| 				 	image{ | ||||
| 				 		width: 76rpx; | ||||
| 				 		height: 78rpx; | ||||
| 				 	} | ||||
| 				 } | ||||
| 				 .rt{ | ||||
| 					 font-size: 32rpx; | ||||
| 					 color: #3D3D3D; | ||||
| 				 } | ||||
| 			 } | ||||
| 		} | ||||
| 	} | ||||
| 	.mask{ | ||||
| 		position: fixed; | ||||
| 		top: 0; | ||||
| 		left: 0; | ||||
| 		width: 100%; | ||||
| 		height: 100vh; | ||||
| 		background-color: #000; | ||||
| 		opacity: .5; | ||||
| 	} | ||||
| 	page { | ||||
| 		background-color: #F7FAFE; | ||||
| 		overflow: hidden; | ||||
| 	} | ||||
| 	.shibai { | ||||
| 		margin-top: 50rpx; | ||||
| 		text-align: center; | ||||
| 		padding-bottom: 600rpx; | ||||
| 		height: 100vh; | ||||
| 		overflow: scroll; | ||||
| 	 | ||||
| 		.jxcz { | ||||
| 			width: 563rpx; | ||||
| 			height: 100rpx; | ||||
| 			background: #8883F0; | ||||
| 			border-radius: 60rpx 60rpx 60rpx 60rpx; | ||||
| 			text-align: center; | ||||
| 			line-height: 100rpx; | ||||
| 			font-size: 45rpx; | ||||
| 			color: #FFFFFF; | ||||
| 			position: fixed; | ||||
| 			bottom: 62rpx; | ||||
| 			left: 50%; | ||||
| 			transform: translateX(-50%); | ||||
| 		} | ||||
| 	 | ||||
| 		.top { | ||||
| 			font-size: 40rpx; | ||||
| 			color: #3D3D3D; | ||||
| 		} | ||||
| 	 | ||||
| 		.tishi { | ||||
| 			font-size: 31rpx; | ||||
| 			color: #3D3D3D; | ||||
| 			margin-top: 50rpx; | ||||
| 		} | ||||
| 	 | ||||
| 		.li { | ||||
| 			margin-top: 50rpx; | ||||
| 			font-size: 31rpx; | ||||
| 			color: #3D3D3D; | ||||
| 	 | ||||
| 			image { | ||||
| 				margin-top: 30rpx; | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	.pages { | ||||
| 		width: 750rpx; | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ | |||
| 				<image src="https://api.ccttiot.com/smartmeter/img/static/ujJcBAlIiMjakFEBQV8O" mode=""></image> | ||||
| 				<view class="quan"> | ||||
| 					<view class="one"> | ||||
| 						{{detailobj.suitTime == undefined ? '--' : detailobj.suitTime}}{{detailobj.timeUnit == 3 ? '分钟' : '小时'}} | ||||
| 						{{detailobj.suitTime == undefined ? '--' : detailobj.suitTime}}{{detailobj.suitTimeUnit == 3 ? '分钟' : '小时'}} | ||||
| 					</view> | ||||
| 					<view class="two"> | ||||
| 						套餐时长 | ||||
|  | @ -67,7 +67,7 @@ | |||
| 			</view> | ||||
| 			<view class="item_xx"> | ||||
| 				<view class=""> | ||||
| 					租借店铺: | ||||
| 					经营场所: | ||||
| 				</view> | ||||
| 				<view class=""> | ||||
| 					{{detailobj.storeName == undefined ? '--' : detailobj.storeName}} | ||||
|  |  | |||
|  | @ -24,7 +24,7 @@ | |||
| 				 <view style="color: #8883F0;">{{obj.storeName == undefined ? '--' : obj.storeName}}</view> | ||||
| 			</view> | ||||
| 			<view class="xiao"> | ||||
| 				 <view>经营地址</view> | ||||
| 				 <view style="width: 160rpx;">经营地址</view> | ||||
| 				 <view>{{obj.storeAddress == undefined ? '--' : obj.storeAddress}}</view> | ||||
| 			</view> | ||||
| 			<view class="xiao"> | ||||
|  |  | |||
|  | @ -29,15 +29,15 @@ | |||
| 					 <view style="color: #8883F0;" v-if="item.isUsing == true"> <text></text> 进行中 </view> | ||||
| 					 <view style="color: springgreen;" v-if="item.isFinished == true"> <text style="background-color: springgreen;"></text> 已完成 </view> | ||||
| 					 <view class="" v-if="item.isUsing == false && item.isFinished == false"> | ||||
|                             <view v-if="item.status == 1"><text style="background-color: #333;"></text> 未支付</view>		 | ||||
| 							<view v-if="item.status == 2"><text style="background-color: #333;"></text> 支付成功</view>	 | ||||
| 							<view v-if="item.status == 3"><text style="background-color: #333;"></text> 已退款</view>	 | ||||
| 							<view v-if="item.status == 4"><text style="background-color: #333;"></text> 用户取消</view>	 | ||||
| 							<view v-if="item.status == 5"><text style="background-color: #333;"></text> 系统超时取消</view>	 | ||||
| 							<view v-if="item.status == 6"><text style="background-color: #333;"></text> 支付中</view>	 | ||||
| 							<view v-if="item.status == 7"><text style="background-color: #333;"></text> 退款中</view>	 | ||||
| 							<view v-if="item.status == 8"><text style="background-color: #333;"></text> 押金未支付</view>	 | ||||
| 							<view v-if="item.status == 9"><text style="background-color: #333;"></text> 押金已支付</view>	 | ||||
|                             <view v-if="item.status == 1" style="color: #ccc;"><text style="background-color: #ccc;"></text> 未支付</view>		 | ||||
| 							<view v-if="item.status == 2" style="color: springgreen;"><text style="background-color: springgreen;"></text> 支付成功</view>	 | ||||
| 							<view v-if="item.status == 3" style="color: red;"><text style="background-color: red;"></text> 已退款</view>	 | ||||
| 							<view v-if="item.status == 4" style="color: #ccc;"><text style="background-color: #ccc;"></text> 用户取消</view>	 | ||||
| 							<view v-if="item.status == 5" style="color: red;"><text style="background-color: red;"></text> 系统超时取消</view>	 | ||||
| 							<view v-if="item.status == 6" style="color: #ccc;"><text style="background-color: #ccc;"></text> 支付中</view>	 | ||||
| 							<view v-if="item.status == 7" style="color: #ccc;"><text style="background-color: #ccc;"></text> 退款中</view>	 | ||||
| 							<view v-if="item.status == 8" style="color: #ccc;"><text style="background-color: #ccc;"></text> 押金未支付</view>	 | ||||
| 							<view v-if="item.status == 9" style="color: #ccc;"><text style="background-color: #ccc;"></text> 押金已支付</view>	 | ||||
| 					 </view>  | ||||
| 		  	  	  </view> | ||||
| 				  <view class="xiao"> | ||||
|  |  | |||
|  | @ -423,7 +423,7 @@ | |||
| 			box-sizing: border-box; | ||||
| 			height: 40vh; | ||||
| 			overflow-y: scroll; | ||||
| 			padding-bottom: 400rpx; | ||||
| 			padding-bottom: 100rpx; | ||||
| 
 | ||||
| 			.moshi { | ||||
| 				position: absolute; | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user