smartswrtch-app/pages/shouye/index.vue

1546 lines
40 KiB
Vue
Raw Normal View History

<template>
<view class="page">
<!-- 用户首页显示 -->
<view class="useryonghu">
<u-navbar :is-back="false" title="创想物联" :border-bottom="false" :background="bgc" title-color='#fff'
title-size='44' height='50'></u-navbar>
<view class="gonggao" @click="btntopgg">
<u-icon name="volume-fill" color="#fff" style="position: absolute;left: 20rpx;" size="32"></u-icon>
<view class="container">
<view class="scroll-text">
<view class="scroll-item">
{{announcements.noticeTitle == null ? '暂无最新公告!!!' : announcements.noticeTitle}}
</view>
</view>
</view>
<u-icon name="arrow-right" color="#fff" style="position: absolute;right: 10rpx;" size="32"></u-icon>
</view>
<view class="ditu">
<view class="dtxs">
<map class='map' id="map" :latitude="latitude" :longitude="longitude" @markertap="handleMarkerClick"
:show-location="true" :markers="covers" :scale="mapScale" @regionchange="regionchange"/>
<image class="picimg" v-if="iconflag"
src="https://api.ccttiot.com/smartmeter/img/static/uEAmNMMt65U10qwijrsJ" mode=""></image>
<!-- <image src="https://api.ccttiot.com/smartmeter/img/static/und1cn16Z7UznhhpNB71" style="width: 100%;height: 100%;" mode=""></image> -->
</view>
<!-- 正在进行中的订单 -->
<view class="ongoing_order" v-if="sylist.length > 0">
2025-02-11 17:34:32 +08:00
<view class="order_top" @click="btnorder">
<view class="order_lt">
<image src="https://api.ccttiot.com/smartmeter/img/static/uFNuOet0fB5Bwe1c26sk" mode="aspectFit">
</image>
<text>您有正在使用中的设备...</text>
</view>
2025-02-11 17:34:32 +08:00
<image v-if="!listflag"
src="https://api.ccttiot.com/smartmeter/img/static/ublEB3HEjyfZbnKS2Ai9" mode="aspectFit"></image>
2025-02-11 17:34:32 +08:00
<image v-if="listflag" style="transform: rotate(180deg);margin-top: 20rpx;"
src="https://api.ccttiot.com/smartmeter/img/static/ublEB3HEjyfZbnKS2Ai9" mode="aspectFit"></image>
</view>
<view class="order_list" v-for="(item,index) in sylist" :key="index" v-if="listflag"
@click="btnitem(item.billNo)">
<text>{{item.deviceName}}</text>
<image src="https://api.ccttiot.com/smartmeter/img/static/uZoBXJ0MLrGUSBFk5lGp" mode="aspectFit"></image>
</view>
</view>
<!-- 正在进行中的订单结束 --><!-- 正在进行中的订单结束 -->
<view class="fujin">
<image src="https://api.ccttiot.com/smartmeter/img/static/uqv3e5ThWL8DqrRNBfoA" mode="aspectFit"
@click="btnindex(5)"></image>
<image @click="onControltap" style="width: 76rpx;height: 76rpx;position: absolute;right: 40rpx;"
src="https://api.ccttiot.com/smartmeter/img/static/uOS9p7Sy1K9WpVQgD3b9" mode="aspectFit"></image>
</view>
<view class="tubiao">
<view class="gr" @click="btnindex(1)">
<image src="https://api.ccttiot.com/smartmeter/img/static/uJBKoGWpRH2lM1NpQU0I" mode="aspectFit"
style="width: 96rpx;height:94rpx;"></image>
<!-- 个人中心 -->
</view>
<view class="gr" @click="btnindex(2)">
<image src="https://api.ccttiot.com/smartmeter/img/static/u8rWtdPtHabALkII23Zr" mode="aspectFit"
style="width: 96rpx;height:94rpx;"></image>
<!-- 我的订单 -->
</view>
<view class="gr" @click="btngeren">
<image src="https://api.ccttiot.com/smartmeter/img/static/u7l3mQi3FG22CShvxBHp" mode="aspectFit"
style="width: 96rpx;height:94rpx;"></image>
</view>
<view class="gr" @click="btnindex(3)">
<image src="https://api.ccttiot.com/smartmeter/img/static/uphoDfOVnT6VEyj6glfF" mode="aspectFit"
style="width: 96rpx;height:94rpx;"></image>
<!-- 附近门店 -->
</view>
<view class="gr" @click="btnindex(6)">
<image src="https://api.ccttiot.com/smartmeter/img/static/u3NDAI21OIGQH0Exdmdd" mode="aspectFit"
style="width: 96rpx;height:94rpx;"></image>
</view>
</view>
<view class="guangg" @click="btnad">
<image :src="imgad" mode="aspectFill"></image>
</view>
<!-- <view class="guangg">
<image src="https://api.ccttiot.com/smartmeter/img/static/u0htqJ2dRrag4RrrZmJM" mode="aspectFill"></image>
</view> -->
<view class="saoma" @click="scanQRCode">
<view>
<image src="https://api.ccttiot.com/smartmeter/img/static/uBh15vzRx6gV0wRQj7gi" mode="aspectFit"></image>
扫一扫
</view>
</view>
</view>
<view class="tip_box" v-if="czflag">
<view class="top">
<view class="txt">
系统检测该设备未联网或者为蓝牙版本,金额充值失败,请靠近设备进行蓝牙充值
</view>
</view>
<view class="bot">
<view class="bot_left" @click="czflag = false">
取消
</view>
<view class="bot_right" @click="tocz()">
蓝牙充值
</view>
</view>
</view>
<view class="mask" v-if="czflag"></view>
<view class="weizf" v-if="weiflag">
<view class="" style="font-size: 50rpx;width: 100%;text-align: right" @click="weiflag = false">
×
</view>
<view class="toptit">
您有一笔未支付订单,请及时去支付!
</view>
<view class="quzf" @click="btnqzf">
去支付
</view>
</view>
<view class="mask" v-if="weiflag"></view>
<!-- 获取手机号弹窗 -->
<view class="huoqutel" v-if="huoqutelflag">
<view class="xxx" @click="huoqutelflag = false">
x
</view>
<view class="top">
请先获取手机号再进行此操作
</view>
<button open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">获取手机号</button>
</view>
<view class="huoqutelflag" v-if="huoqutelflag"></view>
</view>
<view class="shenfentc" v-if="xuanzeflag">
<view class="tcshanc">
<image @click="btnyc" src="https://api.ccttiot.com/smartmeter/img/static/uZu2LmMUJ6YBrLLwm0Sc" mode="" class=""></image>
</view>
<view class="name">
<text>请选择身份</text>
</view>
<image @click="btnsh" src="https://api.ccttiot.com/smartmeter/img/static/uPxW2VnzTrDUKiMDtEOQ" mode="" class="one"></image>
<image @click="btngr" src="https://api.ccttiot.com/smartmeter/img/static/utxOPCr6uGvgsTrgYjeA" mode="" class="two"></image>
</view>
<view class="shenfentcflag" @click="btnyc" v-if="xuanzeflag"></view>
<!-- 公告弹窗 -->
<view class="noticetc" v-if="gonggaoflag">
<view class="name">
创想物联公告
</view>
<view class="biaoti">
{{gonggaoxq.noticeTitle}}
</view>
<!-- <view class="cont" v-html="gonggaoxq.noticeContent"></view> -->
<u-parse :html="gonggaoxq.noticeContent" style="width: 100%;height: 620rpx;background-color: #efefef;padding: 10rpx;box-sizing: border-box;margin-top: 20rpx;"></u-parse>
<view class="btn" @click="btnggtc">
我知道了
</view>
</view>
<view class="mask" v-if="gonggaoflag"></view>
</view>
</template>
<script>
var xBlufi = require("@/page_components/blufi/xBlufi.js");
export default {
data() {
return {
huoqutelflag:false,
weiflag: false,
listflag: false,
params: {
year: true,
month: true,
day: true,
hour: false,
minute: false,
second: false
},
dateindex: 1,
latitude: '', // 初始纬度
longitude: '', // 初始经度
covers: [], // 覆盖物数组
jinweidu: '',
userType: '',
isMch: false,
imgad: '',
listmap: [],
mapScale: 15,
czflag: false,
datetime: 0,
dingobj: '',
mapContext: null,
mapScaleInterval: null,
bgc: {
backgroundColor: "#8883F0",
},
deviceobj: {},
deviceCount: 0,
sylist: [],
networkInterval: null,
wangluo: true,
billNo: '',
phonenumber:'',
iconflag: false,
xuanzeflag:false,
isStaff:null,
dlflag:false,
announcements: {},
gonggaoxq:{},
gonggaoflag:false,
2025-02-11 17:34:32 +08:00
bangdingid:'',
2025-02-27 17:56:35 +08:00
chushihua:'',
}
},
onLoad(option) {
if (option.id) {
this.bangdingid = option.id
}
2025-02-11 17:34:32 +08:00
let that = this
wx.openBluetoothAdapter({
success: function (res) {
console.log('蓝牙适配器初始化成功')
xBlufi.initXBlufi(1)
2025-02-11 17:34:32 +08:00
that.chushihua = 1
},
fail: function (err) {
uni.showToast({
title: '蓝牙权限获取失败,请打开系统蓝牙和定位',
icon: 'none',
duration:3000
})
console.error('蓝牙适配器初始化失败,可能是因为没有权限', err)
}
})
},
// 分享到好友(会话)
onShareAppMessage: function() {
return {
title: '创想物联',
path: '/pages/shouye/index'
}
},
// 分享到朋友圈
onShareTimeline: function() {
return {
title: '创想物联',
query: '',
path: '/pages/shouye/index'
}
},
onShow() {
this.logins()
this.getgonggao()
this.getad()
2025-02-11 17:34:32 +08:00
// this.getzf()
this.gethuidaio()
this.getshiy()
setTimeout(()=>{
this.onControltap()
},1000)
},
onReady() {
this.mapContext = uni.createMapContext('map', this)
this.mapScaleInterval = setInterval(this.updateMarkers, 1000)
},
beforeDestroy() {
// 在组件卸载前清除定时器
if (this.mapScaleInterval) {
clearInterval(this.mapScaleInterval)
this.mapScaleInterval = null
}
// 检测网络状态
if (this.networkInterval) {
clearInterval(this.networkInterval)
this.networkInterval = null
}
},
methods: {
// 点击跳转到个人中心
btngeren(){
uni.navigateTo({
url:'/page_geren/index'
})
},
// 点击头部滚动通知
btntopgg(){
this.$u.get(`/app/notice/${this.announcements.noticeId}`).then(resp =>{
if(resp.code == 200){
this.gonggaoxq = resp.data
this.gonggaoflag = true
}
})
},
// 点击公告我知道了
btnggtc(){
this.gonggaoflag = false
uni.setStorageSync('noticeId', this.announcements.noticeId)
},
// 获取最新公告
getgonggao(){
2025-03-04 16:13:46 +08:00
this.$u.get("/app/notice/new?noticeType=1").then(res =>{
if(res.code == 200){
this.announcements = res.data
this.$u.get(`/app/notice/${res.data.noticeId}`).then(resp =>{
if(resp.code == 200){
this.gonggaoxq = resp.data
if(resp.data.noticeId != uni.getStorageSync('noticeId')){
this.gonggaoflag = true
}
}
})
}
})
},
// 点击隐藏合伙人和商户
btnyc(){
this.xuanzeflag = false
},
// 点击跳转到商户
btnsh(){
this.$u.get("/app/user/userInfo").then((res) => {
if (res.code == 200) {
if(res.data.type == 2 || res.data.type == 3){
if(res.data.phonenumber == ''){
this.huoqutelflag = true
this.xuanzeflag = false
}else{
this.xuanzeflag = false
uni.switchTab({
url: '/pages/tj'
})
}
}else{
uni.showToast({
title: '您不是商户,没有权限进入',
icon: 'none',
duration: 2000
})
}
}else if (res.code == 401) {
uni.reLaunch({
url: '/pages/login/login'
})
}
})
},
// 点击跳转到合伙人
btngr(){
this.$u.get("/app/user/userInfo").then((res) => {
if (res.code == 200) {
if(this.isStaff == true){
if(res.data.phonenumber == ''){
this.huoqutelflag = true
this.xuanzeflag = false
}else{
this.xuanzeflag = false
uni.navigateTo({
url: '/page_fenbao/hehuoren/shouye'
})
}
}else{
uni.showToast({
title: '您不是合伙人,没有权限进入',
icon: 'none',
duration: 2000
})
}
}else if (res.code == 401) {
uni.reLaunch({
url: '/pages/login/login'
})
}
})
},
// 查询拖动到指定为止的店铺
regionchange(e) {
this.iconflag = true
if (e.type == 'end') {
this.jinweidu = e.detail.centerLocation.longitude + ',' + e.detail.centerLocation.latitude
this.$u.get("/app/store/listNearBy?center=" + this.jinweidu + '&radius=' + 20000).then(res => {
if (res.code == 200) {
this.covers = []
this.listmap = res.data
this.listmap.forEach(item => {
const shopCover = {
id: parseFloat(item.storeId),
latitude: item.lat,
longitude: item.lng,
width: 25,
height: 30,
iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uZXgsJE6hXbRSwbKILB4',
// iconPath:item.picture
label: {
content: item.name,
anchorX: this.calculateAnchorX(item.name),
fontWeight: 700,
color: '#8883F0',
borderColor: '#fff',
borderRadius: 5,
bgColor: '#fff'
}
}
this.covers.push(shopCover)
})
}
})
this.iconflag = false
}
},
// 点击弹窗去支付
btnqzf() {
uni.navigateTo({
url: '/page_components/eletj?id=' + this.billNo
})
},
// 检测是否有未支付订单 有的话一直弹窗
2025-02-11 17:34:32 +08:00
// getzf() {
// this.$u.get("app/bill/unpaidTimingList").then((res) => {
// if (res.code == 200) {
// if (res.data.length > 0) {
// this.weiflag = true
// this.billNo = res.data[0].billNo
// }
// }
// })
// },
// 获取是否有无网络
startNetworkCheck() {
this.networkInterval = setInterval(() => {
uni.getNetworkType({
success: (res) => {
if (res.networkType == "none") {
this.wangluo = false
} else {
this.wangluo = true
}
},
fail: (err) => {
console.error('获取网络类型失败', err)
}
})
}, 3000)
},
// 请求正在使用的设备列表
getshiy() {
this.$u.get("app/bill/usingList").then((res) => {
if (res.code == 200) {
this.sylist = res.data
}
})
},
// 点击跳转到使用设备详情
btnitem(deviceId) {
uni.reLaunch({
url: '/page_components/eletj?id=' + deviceId
})
},
// 点击显示使用中设备
btnorder() {
2025-02-11 17:34:32 +08:00
this.listflag = !this.listflag
},
// 点击隐藏使用中设备
2025-02-11 17:34:32 +08:00
// btnorders() {
// this.listflag = false
// },
// 点击广告图进行跳转
btnad() {
this.$u.get("/app/ad").then((res) => {
if (res.code == 200) {
if (res.data.urlType == 1) {
uni.navigateTo({
url: '/page_fenbao/webview?url=' + res.data.url
})
} else {
uni.navigateTo({
url: '/' + res.data.url
})
}
}
})
},
// 均衡地图文字居中
calculateAnchorX(name) {
let chineseLength = 0
let englishLength = 0
for (let i = 0; i < name.length; i++) {
const charCode = name.charCodeAt(i)
if (charCode >= 0x4e00 && charCode <= 0x9fa5) {
chineseLength++
} else if (/[a-zA-Z]/.test(name[i])) {
englishLength = englishLength + 0.3 // 英文长度加1但视为两个中文字符长度
}
}
const totalLength = chineseLength + englishLength * 2;
return -totalLength * 6.5 // 假设每个中文字符对应的 anchorX 偏移是 -6.5
},
// 扫描二维码
scanQRCode() {
uni.scanCode({
onlyFromCamera: true,
scanType: ['qrCode'],
success: res => {
console.log(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')
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({
2025-02-11 17:34:32 +08:00
url: '/page_components/fuwu/index?id=' + id + '&chushihua=' + that.chushihua
})
}
})
} else if (res.data == 1) {
console.log(1);
if(that.phonenumber == ''){
that.huoqutelflag = true
that.xuanzeflag = false
console.log(11);
}else{
console.log(12);
that.xuanzeflag = false
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.data == 0) {
uni.showToast({
title: '该设备未录入',
icon: 'none',
duration:2000
})
}
})
},
fail: err => {
console.error('扫描失败:', err)
uni.showToast({
title: '扫描失败',
icon: 'none'
})
}
})
},
// 请求广告
getad() {
this.$u.get("/app/ad").then((res) => {
if (res.code == 200) {
this.imgad = res.data.picture
}
})
},
btnindex(num) {
if (this.wangluo = true) { //判断是否有网络在进行点击
if (num == 2) {
uni.navigateTo({
url: '/page_fenbao/statulist/question/index'
})
} else if (num == 3) {
uni.navigateTo({
url: '/page_fenbao/statulist/about/index?tit=' + '关于我们'
})
} else if (num == 1) {
uni.navigateTo({
url: '/page_fenbao/statulist/myorder/index'
})
} else if (num == 4) {
uni.navigateTo({
url: '/page_fenbao/statulist/merchant/index'
})
} else if (num == 5) {
uni.navigateTo({
url: '/page_fenbao/statulist/nearby/index'
})
} else if (num == 6) {
if(this.dlflag == true){
if((this.type == 2 || this.type == 3) && this.isStaff == true){
this.xuanzeflag = true
}else if((this.type == 2 || this.type == 3) && this.isStaff != true){
if(this.phonenumber == ''){
this.huoqutelflag = true
this.xuanzeflag = false
}else{
this.xuanzeflag = false
uni.switchTab({
url: '/pages/tj'
})
}
}else if(this.isStaff == true){
if(this.phonenumber == ''){
this.huoqutelflag = true
this.xuanzeflag = false
}else{
this.xuanzeflag = false
uni.navigateTo({
url: '/page_fenbao/hehuoren/shouye'
})
}
}else{
uni.showToast({
title: '您当前没有权限进入',
icon: 'none',
duration: 1000
})
}
}else{
}
} else if (num == 7) {
uni.navigateTo({
url: '/page_fenbao/statulist/fault/yichang/index'
})
}
} else {
uni.showModal({
title: '提示',
content: '请打开网络再进行操作',
success: function(res) {
if (res.confirm) {
} else if (res.cancel) {
}
}
})
}
},
// 商户获取手机号
getPhoneNumber(e){
this.$u.put(`/app/user/bindWxMobile?mobileCode=${e.detail.code}`).then(res =>{
if(res.code == 200){
this.huoqutelflag = false
this.xuanzeflag = false
uni.showToast({
title: '绑定手机号成功',
icon: 'success',
duration: 1000
})
setTimeout(()=>{
this.getuserinfo()
},1000)
}else{
uni.showToast({
title: res.msg,
icon: 'none',
duration: 1000
})
}
})
},
// 点击 地图回到自身最中心点
onControltap(control) {
this.setMapScale()
},
// 地图回正
async setMapScale(e, val) {
let mapContext = uni.createMapContext('map', this);
let setScale = () => {
return new Promise((resolve, reject) => {
mapContext.getScale({
success: r => {
resolve()
}
})
})
};
await setScale()
mapContext.moveToLocation({
success: (res) => {
const timer = setTimeout(() => {
clearTimeout(timer)
}, 500)
}
})
},
// 获取自身位置从而获得附近店铺
getMyLocation() {
uni.getLocation({
type: 'wgs84',
success: (res) => {
console.log(res,'resresres');
this.jinweidu = res.longitude + ',' + res.latitude
this.latitude = Number(res.latitude.toFixed(5)) - 0.005
this.longitude = Number(res.longitude.toFixed(5)) + 0.005
this.setMapScale()
// 请求附近的店铺
this.$u.get("/app/store/listNearBy?center=" + this.jinweidu + '&radius=' + 20000).then(
res => {
if (res.code == 200) {
this.listmap = res.data
res.data.forEach(item => {
const shopCover = {
id: parseFloat(item.storeId),
latitude: item.lat,
longitude: item.lng,
width: 25,
height: 30,
iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uZXgsJE6hXbRSwbKILB4',
label: {
content: item.name,
anchorX: (() => {
if (item.name.length <= 2) {
return -12
} else if (item.name.length <= 3) {
return -20
} else if (item.name.length <= 4) {
return -25
} else if (item.name.length <= 5) {
return -30
} else if (item.name.length <= 6) {
return -35
} else if (item.name.length <= 8) {
return -40
} else if (item.name.length <= 10) {
return -45
} else {
return -item.name.length * 6
}
})(),
fontWeight: 700,
color: '#8883F0',
borderColor: '#fff',
borderRadius: 5,
bgColor: '#fff'
}
}
this.covers.push(shopCover)
})
}
})
},
fail: (err) => {
console.error('获取位置失败:', err)
}
})
},
// 放大缩小 隐藏覆盖物文字
updateMarkers() {
this.mapContext.getScale({
success: (res) => {
this.covers = [] // 清空之前的覆盖物
if (res.scale <= 14) {
this.addMarkersWithoutLabels()
} else {
this.addMarkersWithLabels()
}
},
fail: (error) => {
// console.error('获取地图缩放级别失败:', error);
},
})
},
addMarkersWithoutLabels() {
this.listmap.forEach((item) => {
const shopCover = {
id: parseFloat(item.storeId),
latitude: item.lat,
longitude: item.lng,
width: 25,
height: 30,
iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uZXgsJE6hXbRSwbKILB4',
borderColor: '#fff',
borderRadius: 5,
bgColor: '#fff'
}
this.covers.push(shopCover)
})
},
addMarkersWithLabels() {
this.listmap.forEach((item) => {
const shopCover = {
id: parseFloat(item.storeId),
latitude: item.lat,
longitude: item.lng,
width: 25,
height: 30,
iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uZXgsJE6hXbRSwbKILB4',
label: {
content: item.name,
anchorX: this.calculateAnchorX(item.name),
fontWeight: 700,
color: '#8883F0',
textShadow: '2px 2px 0px white, -2px -2px 0px white, 2px -2px 0px white, -2px 2px 0px white',
borderColor: '#fff',
borderRadius: 5,
bgColor: '#fff'
}
}
this.covers.push(shopCover)
})
},
// 点击地图图标进行页面跳转
handleMarkerClick(event) {
let markerId = event.markerId
uni.navigateTo({
url: '/page_user/mapditu/index?markerId=' + markerId
})
},
logins() {
this.getuserinfo()
},
// 获取个人信息
getuserinfo() {
this.$u.get("/app/user/userInfo").then((res) => {
if (res.code == 200) {
this.phonenumber = res.data.phonenumber
this.type = res.data.type
this.dlflag = true
this.isStaff = res.data.isStaff
this.isMch = res.data.isMch
uni.setStorageSync('userType', res.data)
this.userType = res.data.userType
this.deviceCount = res.data.deviceCount
if(this.bangdingid != '' && this.phonenumber == ''){
this.huoqutelflag = true
}else{
this.getbdsb()
}
} else {
this.jmlogin()
}
})
},
// 绑定设备
getbdsb(){
let that = this
let data = {
deviceNo: that.bangdingid
}
that.$u.get(`/app/device/isBind?deviceNo=${that.bangdingid}`).then(res => {
if (res.data == 2) {
that.$u.get(`/app/device/${that.bangdingid}/withSuitList`).then((res) => {
if (res.code == 200) {
uni.navigateTo({
url: '/page_components/fuwu/index?id=' + that.bangdingid
})
}
})
} 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/${that.bangdingid}/bySn`).then((res) => {
if (res.code == 200) {
uni.navigateTo({
url: '/page_components/bindsz?id=' + res.data.deviceId
})
}
})
}
})
}
}
})
} else if (res.data == 0) {
uni.showModal({
title: '提示',
content: '该设备未录入,请先进行录入',
showCancel:false,
success: function(res) {
if (res.confirm) {
}
}
})
}
})
},
// 静默登录
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()
}
})
}
},
})
},
// 判断是否充值失败 充值失败启用蓝牙离线充值
gethuidaio() {
this.$u.get('/app/bill/recharge/device/fail/list').then(res => {
if (res.code == 200) {
if (res.data.length > 0) {
this.czflag = true
this.dingobj = res.data
} else {
uni.removeStorageSync('time')
}
}
})
},
// 点击进行蓝牙离线充值
tocz() {
this.czflag = false
uni.navigateTo({
url: '/page_fenbao/chongzhi?dingobj=' + JSON.stringify(this.dingobj)
})
},
},
mounted() {
this.getMyLocation() // 获取并设置自身位置的覆盖物
this.startNetworkCheck() //检测网络
}
};
</script>
<style lang="scss">
.gonggao{
width: 680rpx;
height: 60rpx;
position: relative;
display: flex;
align-items: center;
margin-bottom: 10rpx;
background-color: rgba(255, 255, 255, .1);
}
.container {
width: 560rpx;
height: 60rpx; /* 根据需要调整高度 */
display: flex;
align-items: center;
margin: auto;
overflow: hidden;
position: relative;
color: #fff;
box-sizing: border-box;
}
.scroll-text {
width: 100%;
overflow: hidden;
box-sizing: border-box;
display: inline-block;
white-space: nowrap;
animation: scroll 8s linear infinite;
}
.scroll-item {
display: inline-block;
padding: 0 10px;
font-size: 16px;
}
@keyframes scroll {
0% {
transform: translateX(100%);
}
100% {
transform: translateX(-100%);
}
}
.noticetc{
width: 680rpx;
height: 950rpx;
background-color: #fff;
border-radius: 20rpx;
padding: 0 20rpx;
box-sizing: border-box;
position: fixed;
top: 340rpx;
left: 50%;
transform: translateX(-50%);
z-index: 2;
.btn{
width: 600rpx;
height: 100rpx;
line-height: 100rpx;
text-align: center;
border-radius: 50rpx;
background-color: #8883F0;
color: #fff;
font-size: 32rpx;
font-weight: 600;
margin: auto;
margin-top: 30rpx;
}
.name{
width: 100%;
text-align: center;
font-size: 36rpx;
font-weight: 600;
margin-top: 30rpx;
}
.biaoti{
font-size: 32rpx;
margin-top: 20rpx;
}
.cont{
width: 100%;
height: 620rpx;
overflow: scroll;
background-color: #ececec;
margin-top: 20rpx;
padding: 20rpx;
box-sizing: border-box;
}
}
.shenfentc{
width: 632rpx;
height: 498rpx;
background: #FFFFFF;
border-radius: 34rpx 34rpx 34rpx 34rpx;
position: fixed;
text-align: center;
top: 36%;
left: 50%;
transform: translateX(-50%);
z-index: 999;
padding: 20rpx;
box-sizing: border-box;
.tcshanc{
width: 100%;
text-align: right;
image{
width: 46rpx;
height: 46rpx;
}
}
.name{
width: 100%;
text-align: center;
font-weight: 600;
font-size: 40rpx;
color: #3D3D3D;
}
.one{
width: 552rpx;
height: 130rpx;
margin-top: 28rpx;
}
.two{
width: 552rpx;
height: 130rpx;
margin-top: 28rpx;
}
}
.shenfentcflag{
width: 100%;
height: 100vh;
background-color: #000;
z-index: 998;
position: fixed;
top: 0;
left: 0;
opacity: .6;
}
.huoqutelflag{
width: 100%;
height: 100vh;
background-color: #000;
z-index: 998;
position: fixed;
top: 0;
left: 0;
opacity: .6;
}
.huoqutel{
position: fixed;
bottom:0;
left: 50%;
transform: translateX(-50%);
width:100%;
text-align: center;
height: 300rpx;
background-color: #fff;
border-radius: 30rpx;
z-index: 999;
.top{
font-size: 32rpx;
}
.xxx{
font-size: 40rpx;
width: 100%;
text-align: right;
padding-right: 60rpx;
margin-top: 20rpx;
}
button{
margin: auto;
margin-top: 30rpx;
width: 640rpx;
}
}
.weizf {
position: fixed;
z-index: 99;
left: 0;
bottom: 0;
background-color: #fff;
width: 100%;
height: 400rpx;
padding: 30rpx;
box-sizing: border-box;
border-radius: 20rpx 20rpx 0 0;
.toptit {
width: 100%;
text-align: center;
margin-top: 30rpx;
}
.quzf {
width: 100%;
height: 90rpx;
line-height: 90rpx;
text-align: center;
color: #fff;
font-size: 36rpx;
background-color: #8883F0;
margin-top: 60rpx;
border-radius: 20rpx;
}
}
/deep/ .u-title {
padding-bottom: 22rpx;
}
/deep/ .map {
width: 100%;
height: 100%;
}
.dateactive {
background: #E1F3ED;
}
.mask {
width: 100%;
height: 100vh;
position: fixed;
top: 0;
left: 50%;
transform: translateX(-50%);
background-color: #000;
opacity: .6;
}
page {
background: linear-gradient(180deg, #8883F0 10%, rgba(255, 255, 255, 0) 100%);
border-radius: 0rpx 0rpx 0rpx 0rpx;
}
.page {
width: 750rpx;
padding-left: 34rpx;
padding-right: 34rpx;
padding-bottom: 430rpx;
box-sizing: border-box;
overflow: scroll;
height: 100vh;
.tip_box {
position: fixed;
left: 72rpx;
top: 700rpx;
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: #8883F0;
}
}
}
.userdaili {
.gongneng {
width: 680rpx;
height: 304rpx;
background: #FFFFFF;
border-radius: 24rpx 24rpx 24rpx 24rpx;
padding: 0 50rpx;
box-sizing: border-box;
.icons {
display: inline-block;
width: 145rpx;
text-align: center;
image {
margin-top: 34rpx;
width: 50px;
height: 50px;
}
}
}
.ordertongji {
width: 680rpx;
height: 342rpx;
background: #FFFFFF;
border-radius: 24rpx 24rpx 24rpx 24rpx;
.shuju {
display: flex;
justify-content: space-between;
padding: 0 40rpx;
box-sizing: border-box;
margin-top: 24rpx;
.ddje {
text-align: center;
.shu {
font-weight: 500;
font-size: 40rpx;
color: #3D3D3D;
}
.sb {
margin-top: 20rpx;
font-weight: 500;
font-size: 20rpx;
color: #3D3D3D;
}
}
}
.date {
padding-left: 80rpx;
padding-right: 80rpx;
box-sizing: border-box;
display: flex;
justify-content: space-between;
margin-top: 26rpx;
text {
padding: 6rpx 18rpx;
box-sizing: border-box;
background: #eee;
border-radius: 10rpx 10rpx 10rpx 10rpx;
font-size: 26rpx;
color: #808080;
}
}
.orderday {
display: flex;
justify-content: space-between;
width: 100%;
padding: 10rpx 12rpx;
box-sizing: border-box;
text {
margin-right: 10rpx;
border-radius: 20rpx;
text-align: center;
display: inline-block;
width: 148rpx;
height: 84rpx;
text-align: center;
line-height: 84rpx;
}
}
}
.dttitle {
margin: 36rpx 0;
font-weight: 500;
font-size: 36rpx;
color: #3D3D3D;
}
.zhanghu {
margin-top: 32rpx;
width: 680rpx;
height: 264rpx;
background: #FFFFFF;
border-radius: 24rpx 24rpx 24rpx 24rpx;
padding: 36rpx 38rpx;
box-sizing: border-box;
.zhtitle {
display: flex;
justify-content: space-between;
.sj {
display: flex;
justify-content: space-between;
text {
font-size: 26rpx;
color: #3D3D3D;
}
}
.tx {
font-size: 26rpx;
color: #27D089;
}
}
.zhje {
margin-top: 20rpx;
display: flex;
justify-content: space-between;
border-bottom: 1px solid #ccc;
padding-bottom: 20rpx;
text {
font-weight: 500;
font-size: 48rpx;
color: #3D3D3D;
}
.btntx {
width: 156rpx;
height: 42rpx;
background: linear-gradient(270deg, #54DAA1 0%, #19CD82 100%);
border-radius: 40rpx 40rpx 40rpx 40rpx;
font-size: 26rpx;
color: #FFFFFF;
text-align: center;
line-height: 42rpx;
margin-top: 10rpx;
}
}
.buc {
margin-top: 20rpx;
font-size: 26rpx;
color: #979797;
}
}
}
//样式结束
.title {
font-weight: 500;
font-size: 36rpx;
color: #3D3D3D;
line-height: 50rpx;
text-align: left;
font-style: normal;
text-transform: none;
}
.guangg {
margin-top: 10rpx;
margin-bottom: 10rpx;
image {
border-radius: 30rpx;
width: 680rpx;
height: 218rpx;
}
}
.saoma {
width: 750rpx;
height: 166rpx;
background: #FFFFFF;
position: fixed;
left: 0;
bottom: 0;
padding-top: 22rpx;
border-radius: 54rpx 54rpx 0 0;
margin-top: 20rpx;
view {
text-align: center;
width: 676rpx;
height: 102rpx;
background: linear-gradient(270deg, #8883F0 0%, #8883F0 100%);
border-radius: 54rpx 54rpx 54rpx 54rpx;
font-weight: 500;
font-size: 40rpx;
color: #FFFFFF;
margin: auto;
line-height: 102rpx;
}
image {
width: 56rpx;
height: 56rpx;
vertical-align: middle;
margin-right: 10rpx;
margin-bottom: 10rpx;
}
}
.ditu {
width: 100%;
height: 900rpx;
background: #FFFFFF;
border-radius: 38rpx 38rpx 38rpx 38rpx;
padding-top: 16rpx;
position: relative;
.ongoing_order {
width: 622rpx;
max-height: 100%;
background-color: rgba(0, 0, 0, 0.4);
border-radius: 40rpx 40rpx 40rpx 40rpx;
position: absolute;
top: 48rpx;
left: 34rpx;
.order_list {
width: 100%;
height: 110rpx;
border-radius: 40rpx 40rpx 40rpx 40rpx;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 36rpx;
color: #FFFFFF;
padding: 0 38rpx;
padding-right: 56rpx;
box-sizing: border-box;
line-height: 110rpx;
animation: fadeInDown .5s ease-out forwards;
image {
width: 17rpx;
height: 34rpx;
}
}
.order_top {
width: 622rpx;
height: 94rpx;
background: rgba(0, 0, 0, 0.4);
box-shadow: 0rpx 4rpx 10rpx 0rpx rgba(0, 0, 0, 0.3);
border-radius: 40rpx 40rpx 40rpx 40rpx;
display: flex;
align-items: center;
justify-content: space-between;
padding: 18rpx 42rpx;
box-sizing: border-box;
font-weight: 400;
font-size: 36rpx;
color: #FFFFFF;
.order_lt {
display: flex;
align-items: center;
image {
width: 44rpx;
height: 62rpx;
margin-right: 20rpx;
}
}
image {
width: 47rpx;
height: 47rpx;
padding-bottom: 10rpx;
box-sizing: border-box;
}
}
}
.fujin {
position: absolute;
top: 660rpx;
padding-left: 30rpx;
width: 100%;
image {
width: 210rpx;
height: 74rpx;
}
}
.dtxs {
width: 642rpx;
height: 750rpx;
margin: auto;
border-radius: 30rpx;
overflow: hidden;
.picimg {
width: 120rpx;
height: 120rpx;
position: absolute;
left: 50%;
transform: translateX(-50%);
top: 50%;
}
}
.tubiao {
display: flex;
justify-content: space-between;
padding: 30rpx 50rpx;
box-sizing: border-box;
.gr {
text-align: center;
width: 100%;
font-weight: 400;
font-size: 26rpx;
color: #3D3D3D;
image {
display: block;
margin: auto;
margin-bottom: 14rpx;
}
}
}
}
}
@keyframes fadeInDown {
from {
opacity: 0;
transform: translateY(-20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
2024-05-10 17:37:36 +08:00
</style>