<template>
	<view class="page">
		<u-navbar :is-back="false" title="设备列表" :border-bottom="false" :background="bgc" title-color='#fff'
					title-size='36' height='44'  id="navbar">
				</u-navbar>

		<u-mask :show="showtip" @click="show = false" :z-index='1000' />
		<view class="tip_box" v-if="showtip">
			<view class="top">
				<view class="txt">
					系统检测到您的设备未联网或者为蓝牙版本,金额充值失败,请靠近设备进行蓝牙充值
				</view>

			</view>
			<view class="bot">
				<view class="bot_left" @click="showtip=false">
					取消
				</view>
				<view class="bot_right" @click="tocz()">
					蓝牙充值
				</view>
			</view>
		</view>
		<view class="fd">
			<!-- 刷新动画 -->
			<view class="shuaxin" v-if="shuaxin">
				<image src="https://api.ccttiot.com/smartmeter/img/static/uO9UFjzbzS9YlabzL4HV" mode="aspectFit"></image>
			</view>
			
			<view class="fd_top u-skeleton-fillet">
				<view class="serch">
					<view class="lt">
						<image src="https://api.ccttiot.com/smartmeter/img/static/uaG7R4JLfYOzBhWfDN0j" mode=""></image><input type="text" v-model="keyword" placeholder="搜索设备名称或SN"/> <view class="sousuo" @click="searchs">搜索</view>
					</view>
				</view>
				<view class="" style="display: flex;">
					<view class="fd_da">
						<view class="fd_lt">
							<!-- :style="{ transform: `translateX(${hua == 2 ? -curtitidx * 120 : curtitidx * 120}rpx)`}" -->
							<view class="fd_tit" v-for="(item,index) in groupLists" :key="index"
								:class="index==curtitidx?'act1':''" @click="changeidx(index)">
								{{item.name.length > 5 ? item.name.slice(0, 5) + '...' : item.name}}
							</view>
						</view>
					</view>
					<view class="right">
						<view class="fd_set iconfont icon-liebiao" @click="showfz = true"></view>
						<view class="" @click="pxshow = !pxshow">
							{{paixutxt}}
						</view>
						<!-- <image style="width: 32rpx;height: 34rpx;margin-left: 10rpx;position: relative;z-index: 99;" src="https://api.ccttiot.com/smartmeter/img/static/uiZneL59hHNJ2EsOE557" mode="aspectFit" @click="btnpx"></image> -->
						<view style="width: 32rpx;height: 34rpx;margin-left: 10rpx;position: relative;z-index: 99;" @click="btnpx" v-if="pxflag">
							<u-icon name="arrow-up-fill" style="position: absolute;top: 0rpx;right: 4rpx;" color="#8883F0" size="24"></u-icon>
							<u-icon style="position: absolute;top: 16rpx;right: 4rpx;" name="arrow-down-fill" color="#333" size="24"></u-icon>
						</view>
						<view style="width: 32rpx;height: 34rpx;margin-left: 10rpx;position: relative;z-index: 99;" @click="btnpxs" v-else>
							<u-icon name="arrow-up-fill" style="position: absolute;top: 0rpx;right: 4rpx;" color="#333" size="24"></u-icon>
							<u-icon style="position: absolute;top: 16rpx;right: 4rpx;" name="arrow-down-fill" color="#8883F0" size="24"></u-icon>
						</view>
						<view class="paixu" v-if="pxshow">
							<view class="paixu_item" v-for="(item,index) in pxlist" :key="index" @click="pxconfirm(item)">
								{{item.label}}
							</view>
						</view>
						<view class="mask" v-if="pxshow" @click="pxshow = false"></view>
					</view>
					<!-- <u-select v-model="pxshow" :list="pxlist" @confirm="pxconfirm"></u-select> -->
				</view>
			</view>
			<u-mask :show="showfz" @click="showfz=false"></u-mask>

			<view class="fz" v-show="showfz">
				<view class="fz_top">
					<view class="iconfont icon-shanchu" @click="showfz=false">

					</view>
					<view class="tit">
						<!-- 店铺管理 -->
					</view>
					<view class="txt" @click="tosetpage()">
						管理
					</view>
				</view>
				<view class="card_cont">
					<view class="cards" v-for="(item,index) in groupLists" :key="index">
						<view class="txt">
							{{item.name}}
						</view>
						<view class="num">
							{{item.deviceCount}}
						</view>
					</view>
					<view class="zhanwei" style="width: 100%;height: 100rpx;">

					</view>
				</view>
			</view>

			<swiper class="swiper" style="height: 100%;" :current='curtitidx' @change="swiperchange"
				@touchstart="touchStart" @touchend="touchEnd">
				<swiper-item v-for="(items,index) in groupLists" :key="index" class="">
					<view class="" v-if="items && items.wateringList && items.wateringList.length == 0"
						style="width: 100%;height: 200rpx;margin: auto;margin-top: 230rpx;text-align: center;">
						<image style="width: 200rpx;height: 200rpx;"
							src="https://api.ccttiot.com/smartmeter/img/static/uZFUpcz0YZZ4f4RjvGg2" mode="aspectFit"></image>
						<view class="" style="font-size: 28rpx;color: #808080;margin-top: 30rpx;">该店铺暂无设备...</view>
					</view>
					<view class="swiper_item">
						<view class="card_box" v-for="(item,indexs) in items.wateringList" :key="indexs">
							<view class="card">
								<view class="card_right" @click="todetail(item.deviceId)">
									<image v-if="item.customPicture" :src="item.customPicture" mode="aspectFit"
										style="border-radius: 20rpx;"></image>
									<image v-else :src="item.picture" mode="aspectFit"></image>
								</view>
								<view class="card_left">
									<view class="card_left_tit" @click="todetail(item.deviceId)">
										{{item.deviceName}}
										<view class="card_left_sta" @click="todetail(item.deviceId)">
											<text v-if="item.modelTags.some(tag => tag == 1)" style="margin-left: 20rpx;background-color: #0f5fe4d4;border: 1px solid #0f5fe4d4;">
												蓝牙
											</text>
											<text v-if="item.modelTags.some(tag => tag == 2) && item.onlineStatus1 == 1">
												WiFi
											</text>
											<text v-if="item.modelTags.some(tag => tag == 2) && item.onlineStatus1 == 0" style="background-color: #ccc;border: 1px solid #ccc;">
												WiFi
											</text>
											<text v-if="item.modelTags.some(tag => tag == 3) && item.onlineStatus1 == 1 || item.modelTags.some(tag => tag == 3) && item.onlineStatus2 == 1">
												4G
											</text>
											<text v-if="item.modelTags.includes(3) && item.onlineStatus1 == 0 && item.onlineStatus2 == 0" style="background-color: #ccc;border: 1px solid #ccc;">
												4G
											</text>
											<text v-if="item.wifi == null && !item.modelTags.some(tag => tag == 3) && !item.modelTags.some(tag => tag == 1)" style="background-color: red;color: #fff;border: 1px solid red;">未配网</text>
										</view>
									</view>
									<view class="sta_txt" v-if="item.status==3" style="color:#fff;background-color: red;">
										维修中
									</view>
									<view class="sta_txt" v-if="item.status==2" style="color:#fff;background-color: #ffba00;">
										使用中
									</view>
									<view class="sta_txt" v-if="item.status==1" style="color:#fff;background-color: #00BA88;">
										空闲
									</view>
									
									<view class="" style="display: flex;align-items: center;">
										<view class="card_left_no" :class="item.onlineStatus == 0 ? 'activewzgl' : ''"
											@click="todetail(item.deviceId)">
											S/N码:{{item.deviceNo}}
										</view>
										<view @click="sremakes(item)" v-if="item.storeId == null" class="dianpu"
											style="border: 1px solid #ccc;padding: 5rpx;font-size:26rpx: border-box;width: 180rpx;border-radius: 20rpx;color: #ccc;text-align: center;margin-top: 10rpx;">
											未分配店铺
										</view>
										<view v-else :class="item.onlineStatus == 0 ? 'activewzgl' : ''"
											style="color: #95989D;padding-top: 20rpx;font-size: 26rpx;"
											@click="todetail(item.deviceId)">
											店铺:{{item.storeName.length > 5 ? item.storeName.slice(0,5) + '...' : item.storeName}}
										</view>
									</view>
								</view>
							</view>
						</view>
					</view>
				</swiper-item>
			</swiper>
		</view>

		<!-- 选择店铺 -->
		<u-select v-model="showshop" :list="shoplist" @confirm="confirms"></u-select>

		<image v-if="curtitidx == 0" class="saoyisao" @click="saoyisao"
			src="https://api.ccttiot.com/smartmeter/img/static/uiDR6MnGHguBRNSYFTVw" mode="aspectFit"></image>

		<!-- #ifdef MP-WEIXIN -->
             <tab-bar :indexs='0'></tab-bar>
		<!-- #endif -->
   

		<view class="dd">
			<u-select v-model="show" :list="list" title='添加方式' @confirm="confirm"></u-select>
		</view>
        
		
		<view class="bluetoothbox" v-if="bluetoothflag">
			<view class="stop">
				正在连接该设备蓝牙
			</view>
			<view class="xtop">
				请将手机与设备尽量靠近
			</view>
			<image src="https://api.ccttiot.com/smartmeter/img/static/ucDphMKsozqwwllJTAKL" mode="aspectFit"></image>
		</view>
		
		<!-- 蓝牙连接失败 -->
		<view class="bluetoothbox" v-if="shibaiflag">
			<image class="img" src="https://api.ccttiot.com/smartmeter/img/static/uTb3vSlbcHdPMFQMBjyL" mode="aspectFit"></image>
			<view class="one">
				蓝牙连接失败
			</view>
			<view class="two">
				请确保手机足够靠近设备
			</view>
			<view class="thr">
				并且设备处于上电状态
			</view>
			<view class="anfour">
				<view class="qx" @click="btnlyqx">
					取消
				</view>
				<view class="cx" @click="btnwifis">
					重新连接
				</view>
			</view>
		</view>
        <view v-if="btnmsk"
        	style="width: 100%;height: 100vh;position: fixed;top: 0;left: 0;background-color: #000;opacity: .1;z-index: 999;">
        </view>
	</view>
</template>

<script>
	var xBlufi = require("@/page_components/blufi/xBlufi.js")
	import uniEcCanvas from '@/components/uni-ec-canvas/uni-ec-canvas.vue'
	import * as echarts from '@/components/uni-ec-canvas/echarts'
	let chart = null
	export default {
		data() {
			return {
				pxshow: false,
				pxlist: [
					{
						value: 'deviceName',
						label: '名称排序'
					},
					{
						value: 'activationTime',
						label: '时间排序'
					},
					{
						value: 'onlineStatus',
						label: '状态排序'
					}
				],
				paixutxt:'名称排序',
				shuaxin: false,
				showshop: false,
				shoplist: [],
				bgc: {
					backgroundColor: "#8883f0",
				},
				ec: {
					lazyLoad: true
				},
				deviceInfo: {},
				loadings: false,
				info: '',
				tittxt: "商户中心",
				titlist: '暂无店铺',
				curtitidx: 0,
				background: ['color1', 'color2', 'color3'],
				indicatorDots: true,
				autoplay: true,
				interval: 2000,
				duration: 500,
				deviceList: [],
				userType: '',
				addflag: false,
				sbflag: true,
				show: false,
				qingqiuflag:true,
				pxdaoxu:'desc',
				list: [{
						value: '1',
						label: '扫码添加'
					},
					{
						value: '2',
						label: '搜索附近设备添加'
					}
				],
				keyword:'',
				qrResult: '',
				showfz: false,
				groupList: [],
				groupLists: [],
				total: '',
				gps: {},
				mac: '',
				deviceId: '',
				showtip: false,
				orderinfo: [],
				storeId: '',
				pagenum: 1,
				wateringList: [],
				pagesize: 10,
				isLoading: false,
				noMoreData: false,
				total: 0,
				shujuflag: false,
				id: '',
                showshop: false,
				touchStartX: 0, // 触屏起始点x
				touchStartY: 0, // 触屏起始点y  
				
				xiaflag:true,
				isMch:false,
				
				bluetoothflag: false,
				shibaiflag: false,
				deviceInfo: {},
				info: '',
				checked: false,
				focus: false,
				timeday: '',
				imglist: '',
				userImgs: '',
				imgflag: true,
				devicesList: [],
				setMode: null,
				vipflag: false,
				cztime: '',
				opflag: true,
				timer: null,
				url: "",
				deviceNo: '',
				btnmsk:false,
				pxzt:'onlineStatus',
				pxflag:true,
				hua:'',
				
				groupListone:[],
				groupListsone:[],
				shoplistone:[],
				wateringListone:[]
			}
		},
		onLoad() {
           this.pagenum = 1
           this.getgroup()
           this.getlist()
           this.deviceId = uni.getStorageSync('deviceIds')
           this.name = uni.getStorageSync('name')
           let that = this
           setTimeout(() => {
           	if (this.userType === '01') { // 注意 '01' 是一个字符串
           		if (uni.getStorageSync('mac')) {
           			this.mac = uni.getStorageSync('mac')
           			uni.getLocation({
           				type: 'wgs84',
           				success: function(lb) {
           					that.gps.lat = lb.latitude
           					that.gps.lon = lb.longitude
           					that.tobind()
           				},
           				fail: function(error) {
           					console.error('获取位置信息失败:', error)
           					that.gps.lat = 0
           					that.gps.lon = 0
           					that.tobind()
           				}
           			})
           		}
           	} else {
           		if (uni.getStorageSync('billNo')) {
           			let billNo = uni.getStorageSync('billNo')
           			this.$u.get(`/app/bill/recharge/${billNo}/bluetoothSuccess`).then((res) => {
           				if (res.code == 200) {
           					uni.removeStorageSync('billNo')
           					this.showtip = false
           					this.order()
           				}
           			})
           		}
           	}
           }, 2000);
		},
		onShow() {
			setTimeout(()=>{
				this.getlists()
			},1000)
			if(uni.getStorageSync('lianjie')){
			    uni.removeStorageSync({
			    	 key: 'lianjie'
			    })
			}
		},
		// 分享到好友(会话)
		onShareAppMessage: function() {
			return {
				title: '创想物联',
				path: '/pages/shouye/index'
			}
		},

		// 分享到朋友圈  
		onShareTimeline: function() {
			return {
				title: '创想物联',
				query: '',
				path: '/pages/shouye/index'
			}
		},
		methods: {
			getlists() {
			  this.$u.get(`/app/device/list?pageNum=${this.pagenum - 1}&pageSize=${this.pagesize}&orderByColumn=${this.pxzt}&isAsc=${this.pxdaoxu}&storeId=${this.storeId == null ? '' : this.storeId}&keyword=${this.keyword}`).then((res) => {
			    if (res.code == 200) {
			      this.wateringListone = res.rows;
			      const deviceMap = new Map();
			      this.groupLists.forEach(store => {
			        store.wateringList.forEach(device => {
			          deviceMap.set(device.deviceId, device); // 假设设备有唯一的 deviceId
			        });
			      });
			      // 遍历新获取的数据
			      this.wateringListone.forEach(newDevice => {
			        // 更新全部分组的 wateringList
			        const allGroup = this.groupLists[0]; // 第一个分组是“全部”
			        const existingDeviceIndex = allGroup.wateringList.findIndex(device => device.deviceId === newDevice.deviceId);
			        if (existingDeviceIndex !== -1) {
			          // 如果设备已存在,则更新
			          allGroup.wateringList[existingDeviceIndex] = newDevice;
			        } else {
			          // 如果设备不存在,则添加
			          allGroup.wateringList.push(newDevice);
			        }
			        // 更新对应店铺分组的 wateringList
			        const storeGroup = this.groupLists.find(store => store.storeId === newDevice.storeId);
			        if (storeGroup) {
			          const existingStoreDeviceIndex = storeGroup.wateringList.findIndex(device => device.deviceId === newDevice.deviceId);
			          if (existingStoreDeviceIndex !== -1) {
			            // 如果设备已存在,则更新
			            storeGroup.wateringList[existingStoreDeviceIndex] = newDevice;
			          } else {
			            // 如果设备不存在,则添加
			            storeGroup.wateringList.push(newDevice);
			          }
			        }
			      });
			      uni.hideLoading();
			    } else {
			      uni.hideLoading();
			    }
			  }).catch((error) => {
			    uni.hideLoading();
			    console.error('请求失败:', error);
			  })
			},
			getgroup() {
				this.$u.get("/app/store/listCount").then((res) => {
					if (res.data != 0) {
						this.groupList = []
						this.groupLists = res.data
						this.groupList = res.data.filter(item => {
							return item.name === '全部'
						})
						this.storeId = this.groupList[0].storeId
						if (res.data.length > 0) {
							let arr = res.data.map(row => ({
								value: row.storeId, // 将storeId赋值给value  
								label: row.name // 将name赋值给label  
							}))
							this.shoplist = arr
							this.shoplist = this.shoplist.slice(1)
						}
					}
				})
			},
			getlist() {
					this.$u.get(`/app/device/list?pageNum=${this.pagenum}&pageSize=${this.pagesize}&orderByColumn=${this.pxzt}&isAsc=${this.pxdaoxu}&storeId=${this.storeId == null ? '' : this.storeId}&keyword=${this.keyword}`).then((res) => {
						if (res.code == 200) {
							this.xiaflag = true
							this.shuaxin = false
							this.total = res.total
							console.log(res.rows.length,'0202020202020202');
							if (this.pagenum > 1) {
								this.pagenum++
								this.wateringList = res.rows
								this.qingqiuflag = true
								this.groupLists.forEach(groupItem => {
								    groupItem.wateringList 
								})
								this.wateringList.forEach(wateringItem => {  
									this.groupLists[this.curtitidx].wateringList.push(wateringItem)
								})
								console.log(this.groupLists);
								uni.hideLoading()
							} else {
								this.pagenum++
								this.wateringList = res.rows  
								this.qingqiuflag = true
								this.groupLists.forEach(groupItem => {  
								    groupItem.wateringList = []
								})
								this.wateringList.forEach(wateringItem => {  
								    this.groupLists[this.curtitidx].wateringList.push(wateringItem);  
								}) 
								console.log(this.groupLists);
								uni.hideLoading()
							} 
							this.isLoading = false
						} else {
							this.shuaxin = false
							this.xiaflag = true
							uni.hideLoading()
						}
					})
			},
			// 选择排序
			pxconfirm(e){
				this.pxshow = false
				this.paixutxt = e.label
				this.pxzt = e.value
				this.pagenum = 1
				this.getlist()
			},
			btnpx(){
				this.pxflag = false
				this.pxdaoxu = 'asc'
				this.pagenum = 1
				this.getlist()
			},
			btnpxs(){
				this.pxflag = true
				this.pxdaoxu = 'desc'
				this.pagenum = 1
				this.getlist()
			},
			funListenDeviceMsgEvent: function(options) {
				switch (options.type) {
					case xBlufi.XBLUFI_TYPE.TYPE_RECIEVE_MY_DATA:
						let loadPercent = options.data;
						let loadText = '文件读取中'
						// console.log("文件读取中", options.data)
						break;
					case xBlufi.XBLUFI_TYPE.TYPE_RECIEVE_CUSTON_DATA:
						let ver_data = this.parseCustomData(options.data)
						this.setMode = Math.floor(ver_data.setMode / 60)
						console.log("1收到设备发来的自定义数据结果:", ver_data, this.setMode)
						break;
					case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS:
						if (options.result) {
							let devicesarr = options.data
							// console.log(devicesarr,'devicesarrdevicesarr') 
							devicesarr.forEach(device => {
								const mac = device.name.slice(-12)
								if (device.name.slice(5, 17) == this.qrResult) {
									this.deviceId = device.deviceId
									this.name = device.name
									this.mac = device.name.slice(5, 17)
								}
							})
						}
						break;
			
					case xBlufi.XBLUFI_TYPE.TYPE_CONNECTED:
						// console.log("连接回调:" + JSON.stringify(options))
						if (options.result) {
							this.bluetoothflag = false
							uni.hideLoading();

							{
								console.log("连接回调options.data.deviceId:" + options.data.deviceId,
									"连接回调options.data.name:" + options.data.name)
							}
						} else {
							this.shibaiflag = true
							this.bluetoothflag = false
							uni.hideLoading()

						}
			
						break;
			
					case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_START:
						if (!options.result) {
							setTimeout(() => {
								uni.hideLoading()
								this.bluetoothflag = false
							}, 3000)
							console.log("蓝牙未开启", options)
							this.shibaiflag = true

							return
						} else {

						}
			
						break;
			
					case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_STOP:
						if (options.result) {
							let uniqueDevicesList = Array.from(new Set(this.devicesList))
							// 将去重后的数组重新赋值给 this.devicesList
							this.devicesList = uniqueDevicesList
							let list = []
							setTimeout(() => {
								this.devicesList = list
							}, 200)
							console.log('蓝牙停止搜索ok')
						} else {
							//蓝牙停止搜索失败
							console.log('蓝牙停止搜索失败')
						}
						this.searching = false
						break
				}
			},
			parseCustomData(data) {
				// 将字符串按照 "@" 分割成数组  
				const dataArray = data.split('@');
			
				// 初始化一个空对象来存储解析后的数据  
				const parsedData = {};
			
				// 前缀到属性名的映射  
				const prefixMap = {
					'V': 'voltage',
					'S': 'switchState',
					'A': 'current',
					'P': 'power',
					'M': 'remainingPower',
					'T': 'setMode',
					'W': 'temperature'
				};
			
				// 遍历数组并解析每个字段  
				for (let i = 0; i < dataArray.length; i++) {
					const field = dataArray[i];
					for (const prefix in prefixMap) {
						if (field.startsWith(prefix)) {
							// 去除前缀并将剩余部分转换为适当的类型(这里默认为浮点数或字符串)  
							const value = field.substring(1);
							const propertyName = prefixMap[prefix];
			
							// 根据需要,这里可以添加更复杂的类型转换逻辑  
							// 但为了简单起见,我们总是尝试将其转换为浮点数,如果失败则保留为字符串  
							parsedData[propertyName] = isNaN(parseFloat(value)) ? value : parseFloat(value);
			
							// 找到了匹配的前缀,跳出内层循环  
							break;
						}
					}
				}
			
				// 返回解析后的数据对象  
				return parsedData;
			},
            btnlyqx() {
            	this.shibaiflag = false
            	this.bluetoothflag = false
            },
			// 未配网 进行配网
			btnwifis(){
				this.btnmsk = false
				this.shibaiflag = false
				this.bluetoothflag = true
				// console.log(this.deviceId,'idididididdidii');
				if (this.setMode == null) {
					xBlufi.initXBlufi(1)
					xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent)
					xBlufi.notifyStartDiscoverBle({
						'isStart': true
					})
				
					// 停止蓝牙搜索  
					setTimeout(() => {
						xBlufi.notifyStartDiscoverBle({
							'isStart': false
						})
						xBlufi.notifyConnectBle({
							isStart: true,
							deviceId: this.deviceId,
							name: this.name
						})
						xBlufi.notifyInitBleEsp32({
							deviceId: this.deviceId
						})
						let name = ''
						let index = this.name.indexOf('-')
						if (index !== -1) {
							name = this.name.slice(index + 1)
						}
						let data = {
							storeId: this.storeId,
							mac: this.mac
						}
						this.$u.put('/app/device/bind', data).then((res) => {
							if (res.code == 200) {
								uni.hideLoading();
								this.shibaiflag = false
								this.bluetoothflag = false
								uni.removeStorageSync('mac');
								let systemInfo = uni.getSystemInfoSync()
								if (systemInfo.platform == 'android') {
									// 当前设备是 Android  
									uni.navigateTo({
										url: '/page_components/wifilist/index?deviceId=' + this
											.deviceId + '&name=' + this.name
									})
								} else if (systemInfo.platform == 'ios') {
									// 当前设备是 iOS  
									uni.navigateTo({
										url: '/page_fenbao/device/wifivideo?deviceId=' + this
											.deviceId + '&name=' + this.name
									})
								}
							} else if (res.msg == '设备编号和mac不能同时为空') {
								this.shibaiflag = true
								this.bluetoothflag = false
							}
						})
					}, 1000)
				} else {
					let name = ''
					let index = this.name.indexOf('-')
					if (index !== -1) {
						name = this.name.slice(index + 1)
					}
					let data = {
						storeId: this.storeId,
						mac: this.mac
					}
					this.$u.put('/app/device/bind', data).then((res) => {
						if (res.code == 200) {
							// uni.showToast({
							// 	title: '绑定成功',
							// 	icon: 'none',
							// 	duration: 2000
							// })
							this.shibaiflag = false
							this.bluetoothflag = false
							uni.hideLoading()
							uni.removeStorageSync('mac');
							let systemInfo = uni.getSystemInfoSync()
							if (systemInfo.platform == 'android') {
								// 当前设备是 Android  
								uni.navigateTo({
									url: '/page_components/wifilist/index?deviceId=' + this.deviceId +
										'&name=' + this.name
								})
							} else if (systemInfo.platform == 'ios') {
								// 当前设备是 iOS  
								uni.navigateTo({
									url: '/page_fenbao/device/wifivideo?deviceId=' + this.deviceId +
										'&name=' + this.name
								})
							}
						} else {
							if (res.msg == '设备编号和mac不能同时为空') {
								this.shibaiflag = true
								this.bluetoothflag = false
								uni.hideLoading()
								// uni.showToast({
								// 	title: '连接失败',
								// 	icon: 'none',
								// 	duration: 2000
								// })
							} else {
								this.shibaiflag = true
								this.bluetoothflag = false
								uni.hideLoading()
								uni.showToast({
									title: res.msg,
									icon: 'none',
									duration: 2000
								})
								// uni.navigateBack()
							}
						}
					})
				}
			},
			
			btnwifi(mac){
				this.qrResult = mac
				this.btnmsk = false
				this.shibaiflag = false
				this.bluetoothflag = true
				// console.log(this.deviceId,'idididididdidii');
				if (this.setMode == null) {
					xBlufi.initXBlufi(1)
					xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent)
					xBlufi.notifyStartDiscoverBle({
						'isStart': true
					})
				
					// 停止蓝牙搜索  
					setTimeout(() => {
						xBlufi.notifyStartDiscoverBle({
							'isStart': false
						})
						xBlufi.notifyConnectBle({
							isStart: true,
							deviceId: this.deviceId,
							name: this.name
						})
						xBlufi.notifyInitBleEsp32({
							deviceId: this.deviceId
						})
						let name = ''
						let index = this.name.indexOf('-')
						if (index !== -1) {
							name = this.name.slice(index + 1)
						}
						let data = {
							storeId: this.storeId,
							mac: this.mac
						}
						this.$u.put('/app/device/bind', data).then((res) => {
							if (res.code == 200) {
								uni.hideLoading();
								this.shibaiflag = false
								this.bluetoothflag = false
								uni.removeStorageSync('mac');
								let systemInfo = uni.getSystemInfoSync()
								if (systemInfo.platform == 'android') {
									// 当前设备是 Android  
									uni.navigateTo({
										url: '/page_components/wifilist/index?deviceId=' + this
											.deviceId + '&name=' + this.name
									})
								} else if (systemInfo.platform == 'ios') {
									// 当前设备是 iOS  
									uni.navigateTo({
										url: '/page_fenbao/device/wifivideo?deviceId=' + this
											.deviceId + '&name=' + this.name
									})
								}
							} else if (res.msg == '设备编号和mac不能同时为空') {
								this.shibaiflag = true
								this.bluetoothflag = false
							}
						})
					}, 1000)
				} else {
					let name = ''
					let index = this.name.indexOf('-')
					if (index !== -1) {
						name = this.name.slice(index + 1)
					}
					let data = {
						storeId: this.storeId,
						mac: this.mac
					}
					this.$u.put('/app/device/bind', data).then((res) => {
						if (res.code == 200) {
							// uni.showToast({
							// 	title: '绑定成功',
							// 	icon: 'none',
							// 	duration: 2000
							// })
							this.shibaiflag = false
							this.bluetoothflag = false
							uni.hideLoading();
							uni.removeStorageSync('mac');
							let systemInfo = uni.getSystemInfoSync()
							if (systemInfo.platform == 'android') {
								// 当前设备是 Android  
								uni.navigateTo({
									url: '/page_components/wifilist/index?deviceId=' + this.deviceId +'&name=' + this.name
								})
							} else if (systemInfo.platform == 'ios') {
								// 当前设备是 iOS  
								uni.navigateTo({
									url: '/page_fenbao/device/wifivideo?deviceId=' + this.deviceId +'&name=' + this.name
								})
							}
						} else {
							if (res.msg == '设备编号和mac不能同时为空') {
								this.shibaiflag = true
								this.bluetoothflag = false
								uni.hideLoading()
								// uni.showToast({
								// 	title: '连接失败',
								// 	icon: 'none',
								// 	duration: 2000
								// })
							} else {
								this.shibaiflag = true
								this.bluetoothflag = false
								uni.hideLoading()
								uni.showToast({
									title: res.msg,
									icon: 'none',
									duration: 2000
								})
								// uni.navigateBack()
							}
						}
					})
				}
			},
			
			// 点击搜索设备
			searchs(){
				this.pagenum = 1
				// this.logins()
				this.getlist()
			},
			
			// 按下
			touchStart(e) {
				this.touchStartX = e.touches[0].clientX;
				this.touchStartY = e.touches[0].clientY;
			},
			// 松开
			touchEnd(e) {
				let deltaX = e.changedTouches[0].clientX - this.touchStartX;
				let deltaY = e.changedTouches[0].clientY - this.touchStartY;
				if (Math.abs(deltaX) > 50 && Math.abs(deltaX) > Math.abs(deltaY)) {
					if (deltaX >= 0) {
						// console.log("左滑")  
						this.hua = 1
					} else {
						// console.log("右滑")  
						this.hua = 2
					}
				} else if (Math.abs(deltaY) > 50 && Math.abs(deltaX) < Math.abs(deltaY)) {
					if (deltaY < 100) {
						console.log("上滑")  
						if(this.qingqiuflag == true){
							let sum = (this.pagenum - 1) * this.pagesize
							console.log(sum,this.total);
							if (this.total > sum) {
								this.qingqiuflag = false
								this.getlist() 
							}
						}
					} else {
						console.log(deltaY)
						if (deltaY > 250) {
							if(this.xiaflag){
								this.xiaflag = false
								this.shuaxin = true
								this.pagenum = 1
								setTimeout(() => {
									this.getlist()
								}, 1000)
							}
						}
					}
				}
			},
            // 获取店铺
            sremakes(item) {
                if(this.shoplist.length == 0){
                     uni.showModal({
                     	title: '提示',
                     	content: '未创建店铺,是否去创建店铺?',
                     	success: function(res) {
                     		if (res.confirm) {
                     			uni.navigateTo({
                     				url:'/page_fenbao/statulist/myshop/shopxx/index'
                     			})
                     		} else if (res.cancel) {
                     			
                     		}
                     	}
                     })
            	}else{
            		this.id = item.deviceId
            		this.showshop = true
            	}
            },

			// 扫一扫绑定设备
			saoyisao() {
				uni.scanCode({
					onlyFromCamera: true,
					scanType: ['qrCode'],
					success: res => {
						function getQueryParam(url, paramName) {
							let regex = new RegExp(`[?&]${paramName}=([^&]*)`)
							let results = regex.exec(url);
							return results ? decodeURIComponent(results[1].replace(/\+/g, ' ')) : null
						}
						let sceneValue = res.result
						let decodedValue = decodeURIComponent(sceneValue)
						let id = getQueryParam(decodedValue, 's')
						// console.log(res, id)
						let that = this
						let data = {
							deviceNo: id
						}
						that.$u.get(`/app/device/isBind?deviceNo=${id}`).then(res => {
							if (res.data == 2) {
								that.$u.get(`/app/device/${id}/withSuitList`).then((res) => {
									if (res.code == 200) {
										uni.navigateTo({
											url: '/page_components/fuwu/index?id=' + id
										})
									}
								})
							} else if (res.data == 1) {
								uni.showModal({
									title: '提示',
									content: '该设备未绑定,你需进行绑定吗?',
									success: function(res) {
										if (res.confirm) {
											that.$u.put("/app/device/bind", data).then(
												res => {
													if (res.code == 200) {
														that.$u.get(`/app/device/${id}/bySn`).then((res) => {
															if (res.code == 200) {
																uni.navigateTo({
																	url: '/page_components/bindsz?id=' + res.data.deviceId
																})
															}
														})
													}
												})
										} else if (res.cancel) {

										}
									}
								})
							} else if (res.data == 0) {
								uni.showModal({
									title: '提示',
									content: '该设备未录入,请先录入',
									success: function(res) {
										if (res.confirm) {
											// uni.navigateTo({
											// 	url: '/page_fenbao/zhuce?sn=' + id
											// })
										} else if (res.cancel) {

										}
									}
								})
							}
						})
					},
					fail: err => {
						console.error('扫描失败:', err)
						uni.showToast({
							title: '扫描失败',
							icon: 'none'
						})
					}
				})
			},
			gettanc() {
				this.$u.get('/app/store/listCount').then((res) => {
					if (res.code == 200) {
						this.total = res.total
						if (res.data.length > 0) {
							// 有数据,追加到列表  
							let arr = res.data.map(row => ({
								value: row.storeId, // 将storeId赋值给value  
								label: row.name // 将name赋值给label  
							}))
							this.shoplist = arr
							this.shoplist = this.shoplist.slice(1)
						}
					}
				})
			},
			confirms(e) {
				this.pagenum = 1
				let data = {
					deviceId: this.id,
					storeId: e[0].value
				}
				this.putdevice(data)
			},
			putdevice(data) {
				this.$u.put('/app/device', data).then((res) => {
					if (res.code == 200) {
						this.getlist()
						uni.showToast({
							title: '修改成功',
							icon: 'success',
							duration: 2000
						})
					}else{
						uni.showToast({
							title: res.msg,
							icon: 'success',
							duration: 2000
						})
					}
				})
			},
			tocz() {
				this.showtip = false
				uni.navigateTo({
					url: '/page_fenbao/device/czDevice?orderinfo=' + JSON.stringify(this.orderinfo)
				})
			},
			checkModelTags(modelTags) {
				return modelTags && modelTags.some(tag => tag === 2);
			},
			order() {
				this.$u.get("/app/bill/recharge/device/fail/list").then((res) => {
					if (res.data.length != 0) {
						this.showtip = true
						this.orderinfo = res.data[0]
					} else {
						this.orderinfo = null
					}
				})
			},
			towifi(mac) {
				uni.navigateTo({
					url: '/page_fenbao/device/wifiDevice?mac=' + mac
				})
			},
			tobind() {
				this.$u.put(`/app/device/bind/${this.mac}`, this.gps).then((res) => {
					if (res.code === 200) {

						let systemInfo = uni.getSystemInfoSync();
						if (systemInfo.platform === 'android') {
							// 当前设备是 Android  
						} else if (systemInfo.platform === 'ios') {
							// console.log('aaaaaaaaaaaa');
							uni.navigateTo({
								url: '/page_components/wifilist/index?deviceId=' + this.deviceId +
									'&name=' + this.name
							})
						}
						uni.showToast({
							title: '绑定成功',
							icon: 'none',
							duration: 2000
						});
						uni.removeStorageSync('mac')
						uni.removeStorageSync('deviceIds')
						uni.removeStorageSync('name')
						this.getDeviceList()
					} else {
						// 处理失败情况
					}
				});
			},
			opendevice() {
				let stause = 0
				if (this.deviceInfo.powerStatus == 1) {
					stause = 0
				} else {
					stause = 1
				}
				// console.log(stause, 'stausestause');
				this.$u.put(`/app/device/${this.deviceInfo.deviceId}/changePower?status=` + stause).then((res) => {
					// this.$forceUpdate()
					if (res.code == 200) {
						setTimeout(() => {
							this.getdevice()
						}, 2000)
						// this.initChart()
					} else {
						uni.showToast({
							title: res.msg,
							icon: 'none'
						})
					}
				}) 
			},
			tosetpage() {
				this.showfz = false
				uni.navigateTo({
					url: '/page_user/fenzu'
				})
			},
			// 点击更换用户模式
			confirm(e) {
				let type = e[0].value
				if (type == '1') {
					this.scanQRCode()
				} else if (type == '2') {
					uni.navigateTo({
						url: '/page_fenbao/device/index'
					})
				}
				// console.log(e);
				// this.mode = e[0].label
				// this.gettype()
			},
			// logins() {
			// 	if (uni.getStorageSync('userType')) {
			// 		this.userType = uni.getStorageSync('userType')
			// 		this.userType = '01'
			// 		if (this.userType == '01') {
			// 			this.getDeviceList()
			// 		} else if (this.userType == '00') {
			// 			this.getdevice()
			// 		}
			// 	} else {

			// 	}
			// 	// this.getuserinfo()
			// },
			// 点击搜索附近设备进行跳转
			btnserch() {
				uni.navigateTo({
					url: '/page_fenbao/device/index'
				})
			},
			async initChart() {
				let value = 100;
				let value2 = this.deviceInfo.surplusElectriQuantity
				const option = {
					// backgroundColor:"#061740",
					title: {
						show: false,
						text: `历史请求满意度`, // 图表标题
						x: 'center',
						y: '20',
						textStyle: {
							color: '#333', //'#fff',
							fontSize: 20,
						},
					},
					series: [{
							type: 'pie', // 饼图类型
							radius: ['98%', '70%'], // 饼图半径,第一个值是内半径,第二个值是外半径
							silent: true,
							clockwise: true,
							startAngle: 90, // 起始角度
							z: 0,
							zlevel: 0,
							data: [{
									value: value,
									name: '占比', // 数据项名称
									itemStyle: {
										normal: {
											color: '#8883F0', // 数据项颜色
										},
									},
									label: {
										normal: {
											position: 'center',
											formatter: ` {a|${value2}}\n\n{b|剩余电量}`, // 标签内容格式
											rich: {
												a: {
													fontSize: 15,
													fontWeight: '700',
													color: '#333',
												},
												b: {
													fontSize: 11,
													color: '#888',
												},
											},
										},
									},
								},
								{
									value: 100 - value,
									name: '',
									label: {
										normal: {
											show: false,
										},
									},
									itemStyle: {
										normal: {
											color: '#173164',
										},
									},
								},
							],
						},
						{
							type: 'gauge', // 仪表盘类型
							radius: '130%', // 仪表盘半径,占图表容器的百分比
							center: ['50%', '50%'], // 仪表盘中心位置
							startAngle: 359,
							endAngle: 359.9,
							splitNumber: 2, // 刻度分割段数
							hoverAnimation: true,
							axisTick: {
								show: true, // 是否显示刻度线
								length: 10, // 刻度线长度
								lineStyle: {
									color: 'auto',
									width: 1,
								},
							},
							splitLine: {
								length: 0, // 刻度线分隔线长度
								lineStyle: {
									width: 1,
									color: '#061740',
								},
							},
							axisLabel: {
								show: false, // 是否显示刻度标签
							},
							pointer: {
								show: false, // 是否显示指针
							},
							axisLine: {
								lineStyle: {
									opacity: 0,
								},
							},
							detail: {
								show: false, // 是否显示仪表盘详情
							},
							data: [{
								value: 0,
								name: '',
							}, ],
						},
					],
				};
				const chart = await this.$refs.chart.init(echarts)
				chart.setOption(option)
				return chart
			},
			// 获取设备详情
			getDevice() {
				this.$u.get("app/device/1").then((res) => {
					// this.$forceUpdate()
					if (res.code == 200) {
						this.deviceInfo = res.data
						this.loadings = true
					}
				})
			},
			getuserinfo() {
				this.$u.get("/app/user/userInfo").then((res) => {
					// this.$forceUpdate()
					if (res.code == 200) {
						// uni.setStorageSync('userType', res.data.userType)
						this.userType = res.data.userType
						this.isMch = res.data.isMch
						if (this.userType == '01') {
							this.getDeviceList()
						} else if (this.userType == '00') {
							this.getdevice()
						}
					} else {
						// this.jmlogin()
					}
				})
			},
			// jmlogin() {
			// 	let taht = this
			// 	wx.login({
			// 		success(res) {
			// 			if (res.code) {
			// 				let data = {
			// 					loginCode: res.code,
			// 					appId:1
			// 				}
			// 				taht.$u.post('/app/auth/wxLogin', data).then(res => {
			// 					if (res.code == 10003) {
			// 						uni.navigateTo({
			// 							url: '/pages/login/login'
			// 						})
			// 					} else if (res.code == 200) {
			// 						uni.setStorageSync('token', res.token)
			// 						taht.logins()
			// 					}
			// 				})
			// 			}
			// 		},
			// 	})
			// },
			getDeviceList() {
				this.$u.get("/app/device/list").then((res) => {
					if (res.code == 200) {
						this.deviceList = res.rows.filter(row => row.isDefault === true)
						this.total = res.total
						if (this.deviceList == '') {
							this.addflag = true
							this.sbflag = false
						} else {
							this.addflag = false
							this.sbflag = true
						}
					}
				})
			},
			swiperchange(e) {
				this.shuaxin = false
				this.pagenum = 1
				this.curtitidx = e.detail.current
				this.storeId = this.groupLists[this.curtitidx].storeId
		        this.getlist()
			},

			getdevice() {
				this.$u.get("/app/device/tenant").then((res) => {
					this.deviceInfo = res.rows.find(item => item.isDefault === true)
					if (this.deviceInfo == undefined) {
						this.addflag = true
						this.sbflag = false
					} else {
						this.addflag = false
						this.sbflag = true
					}
					uni.setStorageSync('deviceId', this.deviceInfo.deviceId)
					this.order()
				})
			},
			changeidx(index) {
				this.pagenum = 1
				this.curtitidx = index
			},
			// 点击导航栏回到首页
			btnshouye() {
				uni.reLaunch({
					url: '/pages/shouye/index'
				})
			},

			toydfx() {
				uni.navigateTo({
					url: "/page_components/eletj"
				})
			},
			todetail(id) {
				uni.navigateTo({
					url: '/page_user/sbdetail?id=' + id
				})
			},
			// 跳转到抄表
			tochaobiao() {
				uni.navigateTo({
					url: '/page_user/cbRecord'
				})
			},
		}
	}
</script>

<style lang="scss">
	
	.shuaxin {
		width: 100%;
		height: 110rpx;
		z-index: 99;
		// animation: fadeIn 1s forwards;
		text-align: center;

		image {
			width: 80rpx;
			height: 80rpx;
			// transform: translateX(-50%);
			// animation: spin 1s linear infinite;
		}

		view {
			// width: 100%;
			height: 80rpx;
			font-size: 30rpx;
		}
	}

	@keyframes spin {
		from {
			transform: rotate(360deg);
		}

		to {
			transform: rotate(0deg);
		}
	}

	@keyframes fadeIn {
		from {
			opacity: 0.4;
		}

		to {
			opacity: 1;
		}
	}

	.saoyisao {
		width: 90rpx;
		height: 90rpx;
		position: fixed;
		bottom: 240rpx;
		right: 60rpx;
		z-index: 8;
	}

	.title {
		padding-left: 32rpx;
		font-size: 40rpx;
		color: #fff;
		margin-bottom: 30rpx;
		padding-top: 104rpx;
		height: 200rpx;
		background-color: #8883F0;

		text {
			padding-left: 27%;
		}
	}

	/deep/ .u-title {
		padding-bottom: 22rpx;
	}

	/deep/ .u-icon__icon {
		padding-bottom: 22rpx;
	}
    .bluetoothbox {
    	width: 100%;
    	height: 100vh;
    	background-color: #f4f1f6;
    	position: fixed;
    	top: 0;
    	left: 0;
    	z-index: 99;
    	text-align: center;
    
    	.img {
    		margin-top: 400rpx;
    		width: 320rpx;
    		height: 320rpx;
    	}
    
    	.one {
    		font-size: 36rpx;
    		color: #000;
    	}
    
    	.two {
    		margin-top: 30rpx;
    		font-size: 24rpx;
    		color: #ccc;
    	}
    
    	.thr {
    		margin-top: 30rpx;
    		font-size: 28rpx;
    		color: #ccc;
    	}
    
    	.anfour {
    		display: flex;
    		margin-top: 30rpx;
    		justify-content: space-between;
    		padding: 0 220rpx;
    		box-sizing: border-box;
    
    		.qx {
    			width: 100rpx;
    			height: 70rpx;
    			line-height: 70rpx;
    			text-align: center;
    			border: 1px solid #3D3D3D;
    			border-radius: 10rpx;
    		}
    
    		.cx {
    			width: 200rpx;
    			height: 70rpx;
    			line-height: 70rpx;
    			text-align: center;
    			background-color: #8883F0;
    			color: #fff;
    			border-radius: 10rpx;
    		}
    	}
    
    	.stop {
    		font-size: 36rpx;
    		color: #000;
    		margin-top: 380rpx;
    	}
    
    	.xtop {
    		margin-top: 30rpx;
    		font-size: 24rpx;
    		color: #ccc;
    	}
    
    	.xqx {
    		width: 530rpx;
    		height: 90rpx;
    		line-height: 90rpx;
    		border-radius: 20rpx;
    		text-align: center;
    		background-color: #fff;
    		margin: auto;
    		margin-top: 200rpx;
    	}
    
    	image {
    		width: 500rpx;
    		height: 500rpx;
    		margin-top: 100rpx;
    	}
    }
	page {
		background-color: #F0EFFF;
		height: 100%;
		// position: fixed;
		// top: 0;
		// left: 0;
	}

	.activewzgl {
		color: #ccc !important;
	}

	.page {
		height: 100%;
		padding-bottom: 200rpx;
		overflow: hidden;

		.tip_box {
			position: fixed;
			left: 72rpx;
			top: 788rpx;
			width: 610rpx;
			background: #F7FAFE;
			border-radius: 30rpx 30rpx 30rpx 30rpx;
			z-index: 10000000;

			.top {
				padding: 52rpx 38rpx 42rpx 36rpx;

				.txt {
					width: 100%;
					text-align: center;
					font-weight: 500;
					font-size: 32rpx;
					color: #3D3D3D;
				}
			}

			.bot {
				border-top: 2rpx solid #D8D8D8;
				display: flex;
				flex-wrap: nowrap;
				height: 100%;

				.bot_left {
					width: 50%;
					height: 98rpx;
					display: flex;
					align-items: center;
					justify-content: center;
					font-weight: 500;
					font-size: 36rpx;
					color: #3D3D3D;
				}

				.bot_right {
					width: 50%;
					height: 98rpx;
					display: flex;
					align-items: center;
					justify-content: center;
					border-left: 2rpx solid #D8D8D8;
					font-weight: 500;
					font-size: 36rpx;
					color: #4C97E7;

				}

			}
		}

		.noDevice {
			margin-top: 432rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			flex-wrap: wrap;

			.img_box {
				width: 100%;
				display: flex;
				flex-wrap: wrap;
				justify-content: center;

				image {
					width: 252rpx;
					height: 252rpx;
				}

				.tps {
					margin-top: 4rpx;
					width: 100%;
					text-align: center;
					font-weight: 700;
					font-size: 32rpx;
					color: #BDBCBC;
				}
			}

			.addbutn {
				margin-top: 32rpx;
				display: flex;
				align-items: center;
				justify-content: center;
				width: 266rpx;
				height: 96rpx;
				background: #8883F0;
				border-radius: 16rpx;
				font-weight: 500;
				font-size: 36rpx;
				color: #FFFFFF;
			}

			.tip {
				margin-top: 30rpx;
				width: 100%;
				text-align: center;
				font-weight: 400;
				font-size: 40rpx;
				color: #BDBCBC;
			}
		}

		.zhuhu {
			margin-top: 20rpx;
			padding: 0 40rpx;

			.card1 {
				padding: 34rpx 0 0 40rpx;
				width: 670rpx;
				height: 583rpx;
				background: #FFFFFF;
				box-shadow: 0rpx 14rpx 35rpx 0rpx rgba(53, 140, 255, 0.1);
				border-radius: 28rpx 28rpx 28rpx 28rpx;

				.top {
					display: flex;
					flex-wrap: nowrap;
					justify-content: space-between;
					align-items: center;

					.left {
						font-size: 35rpx;
						font-family: HarmonyOS Sans SC, HarmonyOS Sans SC;
						font-weight: 400;
						color: #8883F0;
					}

					.right {
						margin-right: 56rpx;

						.imgs {
							width: 94rpx;
							height: 94rpx;
							vertical-align: bottom;
						}

						.img1 {
							width: 76rpx;
							height: 76rpx;
						}
					}
				}

				.mid {
					margin-top: 54rpx;
					display: flex;
					flex-wrap: nowrap;
					align-content: flex-start;

					.mid_left {
						image {
							width: 37rpx;
							height: 98rpx;
						}
					}

					.mid_right {
						margin-left: 40rpx;
						display: flex;
						flex-wrap: wrap;

						.mid_top {
							width: 100%;
							font-size: 42rpx;
							font-family: HarmonyOS Sans SC, HarmonyOS Sans SC;
							font-weight: 400;
							color: #262B37;
						}

						.mid_bot {
							display: flex;
							flex-wrap: nowrap;
							align-items: center;

							.txt {
								font-size: 26rpx;
								font-family: HarmonyOS Sans SC, HarmonyOS Sans SC;
								font-weight: 400;
								color: #95989D;
							}

							.tip {
								display: flex;
								align-items: center;
								justify-content: center;
								margin-left: 19rpx;
								width: 38rpx;
								height: 23rpx;
								background: rgba(204, 204, 204, 0);
								opacity: 1;
								border: 2rpx solid #8883F0;
								border-radius: 40rpx;
								font-size: 14rpx;
								font-family: HarmonyOS Sans SC, HarmonyOS Sans SC;
								font-weight: 400;
								color: #8883F0;
							}
						}
					}
				}

				.bot {
					margin-top: 83rpx;
					display: flex;
					flex-wrap: nowrap;
					align-items: center;

					.bot_left {
						width: 210rpx;
						height: 190.14rpx;
						margin-right: 34rpx;

						.echarts {
							width: 210rpx;
							height: 190.14rpx;
						}
					}

					.bot_right {
						display: flex;
						flex-wrap: nowrap;

						.cont {
							.tit {
								font-size: 28rpx;
								font-family: HarmonyOS Sans SC, HarmonyOS Sans SC;
								font-weight: 600;
								color: #262B37;
								line-height: 49rpx;
							}

							.txt {
								font-size: 26rpx;
								font-family: HarmonyOS Sans SC, HarmonyOS Sans SC;
								font-weight: 400;
								color: #262B37;
							}
						}
					}
				}
			}

			.card2 {
				padding-top: 40rpx;
				margin-top: 24rpx;
				width: 670rpx;
				height: 254rpx;
				background: #FFFFFF;
				box-shadow: 0rpx 16rpx 40rpx 0rpx rgba(53, 140, 255, 0.1);
				border-radius: 28rpx;

				.tit {
					margin-left: 40rpx;

					font-size: 35rpx;
					font-family: HarmonyOS Sans SC, HarmonyOS Sans SC;
					font-weight: 400;
					color: #8883F0;
				}

				.cont_box {
					margin-top: 32rpx;
					display: flex;
					flex-wrap: nowrap;
					justify-content: space-around;
					text-align: center;

					.cont {
						width: 110rpx;
						display: flex;
						flex-wrap: wrap;
						align-items: center;
						justify-content: center;

						.top {
							font-size: 32rpx;
							font-family: HarmonyOS Sans SC, HarmonyOS Sans SC;
							font-weight: 400;
							color: #262B37;
							width: 110rpx;
						}

						.bot {
							margin-top: 20rpx;
							font-size: 26rpx;
							font-family: HarmonyOS Sans SC, HarmonyOS Sans SC;
							font-weight: 400;
							color: #262B37;
						}
					}
				}
			}

			.card3 {
				padding-top: 40rpx;
				margin-top: 24rpx;
				width: 670rpx;
				height: 318rpx;
				background: #FFFFFF;
				box-shadow: 0rpx 16rpx 40rpx 0rpx rgba(53, 140, 255, 0.1);
				border-radius: 28rpx;

				.tit {
					margin-left: 40rpx;

					font-size: 35rpx;
					font-family: HarmonyOS Sans SC, HarmonyOS Sans SC;
					font-weight: 400;
					color: #8883F0;
				}

				.cont_box {
					margin-top: 32rpx;
					display: flex;
					flex-wrap: nowrap;
					padding-left: 50rpx;
					box-sizing: border-box;

					.cont {
						width: 100rpx;
						display: flex;
						flex-wrap: wrap;
						align-items: center;
						justify-content: center;
						margin-right: 40rpx;

						.top {
							image {
								width: 56rpx;
								height: 56rpx;
							}
						}

						.bot {
							margin-top: 28rpx;
							font-size: 28rpx;
							font-family: HarmonyOS Sans SC, HarmonyOS Sans SC;
							font-weight: 400;
							color: #808080;
						}
					}
				}
			}

			.button {
				margin-left: 76rpx;
				margin-top: 178rpx;
				display: flex;
				justify-content: center;
				align-items: center;
				width: 520rpx;
				height: 104rpx;
				background: #8883F0;
				box-shadow: 0rpx 16rpx 40rpx 0rpx rgba(42, 130, 228, 0.1);
				border-radius: 52rpx 52rpx 52rpx 52rpx;

				font-size: 32rpx;
				font-family: HarmonyOS Sans SC, HarmonyOS Sans SC;
				font-weight: 400;
				color: #FFFFFF;
			}
		}

		@keyframes fadeIn {
			from {
				opacity: 0;
			}

			to {
				opacity: 1;
			}
		}

		.fd {
			margin-top: 20rpx;
			padding: 0 40rpx;
			padding-bottom: 200rpx;
			height: 100%;

			.fz {
				margin: 0 -40rpx;
				position: fixed;
				bottom: 0;
				width: 750rpx;
				height: 830rpx;
				background: #F7FAFE;
				border-radius: 30rpx 30rpx 0 0;
				z-index: 10071;
				opacity: 0;
				animation-name: fadeIn;
				animation-duration: 1s;
				animation-fill-mode: forwards;

				.fz_top {
					margin: 18rpx 0 auto;
					display: flex;
					flex-wrap: nowrap;
					justify-content: space-between;

					.icon-shanchu {
						margin-left: 40rpx;
						font-size: 50rpx;
					}

					.tit {
						font-size: 36rpx;
						font-family: Source Han Sans, Source Han Sans;
						font-weight: 400;
						color: #000000;
					}

					.txt {
						margin-right: 40rpx;
						font-size: 36rpx;
						font-family: Source Han Sans, Source Han Sans;
						font-weight: 400;
						color: #2A82E4;

					}
				}

				.card_cont {
					width: 750rpx;
					padding-left: 30rpx;
					height: 100%;
					overflow-y: auto;
					overflow-x: hidden;

					.cards {
						margin-top: 32rpx;
						display: flex;
						flex-wrap: nowrap;
						align-items: center;
						justify-content: space-between;
						padding: 0 40rpx;
						width: 682rpx;
						border-radius: 30rpx;
						height: 114rpx;
						background: #FFFFFF;
						box-shadow: 0rpx 16rpx 40rpx 0rpx rgba(42, 130, 228, 0.1);

						.txt {
							font-size: 36rpx;
							font-family: Source Han Sans, Source Han Sans;
							font-weight: 400;
							color: #000000;
						}

						.num {
							font-size: 36rpx;
							font-family: Source Han Sans, Source Han Sans;
							font-weight: 400;
							color: #000000;
						}
					}
				}
			}

			.fd_top {
				// display: flex;
				// flex-wrap: nowrap;
				// align-items: center;
                .serch{
                	display: flex;
                	justify-content: space-between;
                	align-items: center;
                	box-sizing: border-box;
                	padding-bottom: 22rpx;
					width: 100%;
                	.lt{
                		display: flex;
                		align-items: center;
                		width: 100%;
                		height: 68rpx;
                		border: 2rpx solid #8883F0;
                		border-radius: 24rpx;
                		padding-left: 30rpx;
                		box-sizing: border-box;
                		.sousuo{
                			width: 140rpx;
                			height: 66rpx;
                			text-align: center;
                			line-height: 66rpx;
                			font-size: 32rpx;
                			color: #FFFFFF;
                			background: #8883F0;
                			border: 2rpx solid #8883F0;
                			border-radius: 0 20rpx 20rpx 0;
                		}
                		image{
                			width: 46rpx;
                			height: 46rpx;
                		}
                		input{
                			width: 460rpx;
                			margin-left: 30rpx;
                			height: 68rpx;
                			line-height: 68rpx;
                		}
                	}
                }
				.fd_da {
					width: 440rpx;
                    overflow: hidden;
					overflow: scroll;
					white-space: nowrap;
					-ms-overflow-style: none;
					/* 去除IE和Edge的默认滚动条 */
					scrollbar-width: none;
					
					/* 去除Firefox的默认滚动条 */
					&::-webkit-scrollbar {
						display: none;
					}
					.fd_lt {
						display: flex;
						transition: transform 0.3s ease;
						padding-top: 10rpx;
						.fd_tit {
							text-align: center;
							padding: 0 15rpx;
							box-sizing: border-box;
							font-size: 34rpx;
							font-weight: 400;
							color: #666;

						}
					}
				}

				.act1 {
					font-size: 36rpx !important;
					font-weight: 700 !important;
					color: #000000 !important;
				}




				.right {
					margin-left: auto;
					display: flex;
					flex-wrap: nowrap;
					align-items: center;
					align-items: center;
                    position: relative;
					.paixu{
						position: absolute;
						top: 64rpx;
						right: 0;
						z-index: 10;
						background-color: #fff;
						padding: 10rpx 20rpx;
						box-sizing: border-box;
						width: 160rpx;
						text-align: center;
						border-radius: 10rpx;
						.paixu_item{
							height: 50rpx;
							line-height: 50rpx;
							border-bottom: 1px solid #ccc;
						}
						.paixu_item:last-of-type{
							border: none;
						}
					}
					.mask{
						width: 100%;
						height: 100vh;
						position: fixed;
						top: 0;
						left: 0;
						background-color: rgba(0,0,0,0.1);
						z-index: 9;
					}
					.fd_set {
						font-size: 60rpx;
					}

					.icon-liebiao {
						// margin-top: 10rpx;
						margin-left: 20rpx;
						font-size: 40rpx;
					}
				}

			}

			.shebei {
				width: 750rpx;
				height: 100vh;
				position: fixed;
				top: 0;
				left: 0;
				text-align: center;
				padding-top: 300rpx;
				font-size: 32rpx;
				color: #ccc;
			}

			.swiper {

				.swiper_item {
					height: 100vh;
					overflow-y: auto;
					padding-bottom: 660rpx;

					.card_box {
						margin-top: 34rpx;
						display: flex;
						flex-wrap: wrap;

						.card {
							display: flex;
							width: 680rpx;
							max-height: 300rpx;
							padding-bottom: 10rpx;
							box-sizing: border-box;
							background: #fff;
							 box-shadow: 0 4px 8px rgba(0,0,0,0.1); 
							border-radius: 24rpx 24rpx 24rpx 24rpx;

							.card_left {
								width: 100%;
								margin-top: 20rpx;
								margin-left: 20rpx;
								position: relative;
								.sta_txt {
									color: #262B37;
									font-size: 26rpx;
									font-weight: 400;
									position: absolute;
									top: -20rpx;
									right: 0;
									width: 100rpx;
									height: 50rpx;
									line-height: 50rpx;
			                        text-align: center;
									border-radius: 30rpx 0 30rpx 0;
								}
								.card_left_tit {
									font-size: 34rpx;
									font-weight: 600;
									color: #333;
									display: flex;
									align-items: center;
								}

								.card_left_sta {
                                    font-weight: 400;
									display: flex;
									flex-wrap: nowrap;
									align-items: center;
									display: flex;
                                    text{
										padding:2rpx 4rpx;
										box-sizing: border-box;
										border: 1px solid #8883F0;
										background-color: #8883F0;
										color: #fff;
										font-size: 20rpx;
										text-align: center;
										border-radius: 10rpx;
										margin-right: 10rpx;
									}
									image {
										width: 23.32rpx;
										height: 36.47rpx;

									}
								}

								.card_left_no {
									padding-top: 15rpx;
									font-size: 26rpx;
									font-family: AlibabaPuHuiTi, AlibabaPuHuiTi;
									font-weight: 400;
									color: #95989D;
									margin-right: 20rpx;
								}
							}

							.card_right {
								margin-top: 30rpx;
								margin-left: auto;
								margin-left: 20rpx;

								image {
									width: 100rpx;
									height: 100rpx;
									border-radius: 10rpx;
								}
							}
						}
					}
				}
			}

		}
	}

	.popup-content {
		text-align: center;

		text {
			display: block;
		}

		.add {
			margin-top: 10rpx;
			font-size: 36rpx;
			color: #000000;
			line-height: 80rpx;
		}

		.saoma {
			margin-top: 68rpx;
			font-size: 40rpx;
			color: #000000;
			line-height: 54rpx;
			border: 1px solid #ccc;
			padding: 30rpx 0;
			box-sizing: border-box;
		}

		.sousuo {
			margin-top: 46rpx;
			font-size: 40rpx;
			color: #000000;
			line-height: 54rpx;
			border: 1px solid #ccc;
			padding: 30rpx 0;
			box-sizing: border-box;
		}
	}
</style>