This commit is contained in:
3321822538@qq.com 2024-06-11 18:03:16 +08:00
parent ed4965f92a
commit 6de033d8e1
10 changed files with 404 additions and 355 deletions

View File

@ -1,7 +1,7 @@
<template> <template>
<view class="page"> <view class="page">
<u-navbar title="修改店铺" :border-bottom="false" :background="bgc" title-color='#fff' back-icon-color="#fff" title-size='36' <u-navbar title="修改店铺" :border-bottom="false" :background="bgc" title-color='#fff' back-icon-color="#fff"
height='50'></u-navbar> title-size='36' height='50'></u-navbar>
<view class="box"> <view class="box">
<view class="list"> <view class="list">
<view class="listval"> <view class="listval">
@ -19,8 +19,8 @@
style="display: flex;justify-content: space-between;padding: 15rpx 26rpx;box-sizing: border-box;"> style="display: flex;justify-content: space-between;padding: 15rpx 26rpx;box-sizing: border-box;">
<!-- <input type="text" placeholder="请输入营业时间" v-model="yetime" /> --> <!-- <input type="text" placeholder="请输入营业时间" v-model="yetime" /> -->
<view class="" style="font-size: 28rpx;color: #666;" @click="btnyinye(1)">{{ksyy}}</view> <view class="" style="font-size: 28rpx;color: #666;" @click="btnyinye(1)">{{ksyy}}</view>
-- --
<view class="" style="font-size: 28rpx;color: #666;" @click="btnyinye(2)">{{jsyy}}</view> <view class="" style="font-size: 28rpx;color: #666;" @click="btnyinye(2)">{{jsyy}}</view>
</view> </view>
</view> </view>
<view class="listvals" @click="btnregion"> <view class="listvals" @click="btnregion">
@ -59,9 +59,13 @@
门头照片必须清晰方正易于辨识 门头照片必须清晰方正易于辨识
</view> </view>
</view> </view>
<view class="imgbox" @click="btn"> <view class="imgbox">
<image :src="imglist" mode="" <!-- <image :src="imglist" mode="" style="width: 142rpx;height: 142rpx;border-radius: 20rpx;"></image> -->
style="width: 142rpx;height: 142rpx;border-radius: 20rpx;"></image> <button
style="border: 0;outline: none;width: 143rpx;padding-left: 0rpx;height: 143rpx;border-radius: 16rpx;"
type="primary reverse" open-type="chooseAvatar" @chooseavatar="getImage">
<image :src="imglist" mode=""></image>
</button>
</view> </view>
</view> </view>
@ -129,14 +133,14 @@
lxname: '', lxname: '',
lxphone: '', lxphone: '',
xqdz: '', xqdz: '',
ksyy:'开始营业时间', ksyy: '开始营业时间',
jsyy:'结束营业时间', jsyy: '结束营业时间',
yynum:0, yynum: 0,
province:'', province: '',
city:'', city: '',
area:'', area: '',
listobj:{}, listobj: {},
storeId:'' storeId: ''
} }
}, },
onLoad(option) { onLoad(option) {
@ -144,7 +148,7 @@
this.listobj = obj this.listobj = obj
console.log(this.listobj); console.log(this.listobj);
this.shopname = this.listobj.name this.shopname = this.listobj.name
this.ksyy = this.listobj.businessTimeStart this.ksyy = this.listobj.businessTimeStart
this.jsyy = this.listobj.businessTimeEnd this.jsyy = this.listobj.businessTimeEnd
this.regiontext = this.listobj.province + this.listobj.city + this.listobj.county this.regiontext = this.listobj.province + this.listobj.city + this.listobj.county
this.lxname = this.listobj.contactName this.lxname = this.listobj.contactName
@ -158,28 +162,48 @@
this.city = this.listobj.city this.city = this.listobj.city
this.area = this.listobj.county this.area = this.listobj.county
this.storeId = this.listobj.storeId this.storeId = this.listobj.storeId
if(this.selectorvalue == 1){ if (this.selectorvalue == 1) {
this.selectortext = '商场' this.selectortext = '商场'
}else if(this.selectorvalue == 2){ } else if (this.selectorvalue == 2) {
this.selectortext = '学校' this.selectortext = '学校'
}else if(this.selectorvalue == 3){ } else if (this.selectorvalue == 3) {
this.selectortext = '娱乐场所' this.selectortext = '娱乐场所'
}else if(this.selectorvalue == 4){ } else if (this.selectorvalue == 4) {
this.selectortext = '出租房' this.selectortext = '出租房'
}else{ } else {
this.selectortext = '其他' this.selectortext = '其他'
} }
this.getQiniuToken() this.getQiniuToken()
}, },
methods: { methods: {
btnyinye(num){ getImage(e) {
let _this = this
let math = 'static/' + _this.$u.guid(20)
const tempFilePaths = e.detail.avatarUrl
wx.uploadFile({
url: 'https://up-z2.qiniup.com',
name: 'file',
filePath: tempFilePaths,
formData: {
token: _this.token,
key: 'smartmeter/img/' + math
},
success: function(res) {
let str = JSON.parse(res.data)
console.log(str.key)
_this.userImgs = 'https://api.ccttiot.com/' + str.key
_this.imglist = _this.userImgs
}
})
},
btnyinye(num) {
this.show = true this.show = true
this.yynum = num this.yynum = num
}, },
btnyy(e){ btnyy(e) {
if(this.yynum == 1){ if (this.yynum == 1) {
this.ksyy = e.hour + ':' + e.minute this.ksyy = e.hour + ':' + e.minute
}else{ } else {
this.jsyy = e.hour + ':' + e.minute this.jsyy = e.hour + ':' + e.minute
} }
}, },
@ -239,7 +263,7 @@
icon: 'none', icon: 'none',
duration: 1000 duration: 1000
}); });
}else if (this.xqdz == '') { } else if (this.xqdz == '') {
uni.showToast({ uni.showToast({
title: '请输入详细地址', title: '请输入详细地址',
icon: 'none', icon: 'none',
@ -258,35 +282,35 @@
address: this.xqdz, address: this.xqdz,
lng: this.longitude, lng: this.longitude,
lat: this.latitude, lat: this.latitude,
businessTimeStart:this.ksyy, businessTimeStart: this.ksyy,
businessTimeEnd:this.jsyy, businessTimeEnd: this.jsyy,
province:this.province, province: this.province,
city:this.city, city: this.city,
county:this.area, county: this.area,
specificAddress:this.xqdz, specificAddress: this.xqdz,
contactName:this.lxname, contactName: this.lxname,
contactMobile:this.lxphone, contactMobile: this.lxphone,
type:this.selectorvalue, type: this.selectorvalue,
storeId:this.storeId storeId: this.storeId
} }
this.$u.put("/app/store",data).then(res => { this.$u.put("/app/store", data).then(res => {
if (res.code == 500) { if (res.code == 500) {
uni.showToast({ uni.showToast({
title: res.msg, title: res.msg,
icon: 'success', icon: 'success',
duration: 1000 duration: 1000
}) })
}else{ } else {
uni.showToast({ uni.showToast({
title: '修改成功', title: '修改成功',
icon: 'success', icon: 'success',
duration: 1000 duration: 1000
}) })
setTimeout(()=>{ setTimeout(() => {
uni.navigateBack({ uni.navigateBack({
delta: 2 delta: 2
}) })
},1000) }, 1000)
} }
}) })
} }
@ -318,8 +342,8 @@
console.log('选择位置失败', err); console.log('选择位置失败', err);
}, },
complete: (res) => { complete: (res) => {
if (res.errMsg === 'chooseLocation:ok') { if (res.errMsg === 'chooseLocation:ok') {} else if (res.errMsg.indexOf(
} else if (res.errMsg.indexOf('chooseLocation:cancel') === 0) { 'chooseLocation:cancel') === 0) {
uni.showToast({ uni.showToast({
title: '您取消了位置选择', title: '您取消了位置选择',
icon: 'none' icon: 'none'
@ -369,12 +393,14 @@
</script> </script>
<style lang="scss"> <style lang="scss">
/deep/ .u-title{ /deep/ .u-title {
padding-bottom: 22rpx; padding-bottom: 22rpx;
} }
/deep/ .u-icon__icon{
/deep/ .u-icon__icon {
padding-bottom: 22rpx; padding-bottom: 22rpx;
} }
page { page {
background: linear-gradient(180deg, #8883F0 0%, rgba(255, 255, 255, 0) 100%); background: linear-gradient(180deg, #8883F0 0%, rgba(255, 255, 255, 0) 100%);
} }
@ -384,7 +410,8 @@
position: fixed; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
color: #666; color: #666;
.box { .box {
width: 750rpx; width: 750rpx;
height: 1440rpx; height: 1440rpx;
@ -431,7 +458,7 @@
width: 100%; width: 100%;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
padding-right: 45rpx;
.lt { .lt {
padding-top: 40rpx; padding-top: 40rpx;
@ -449,7 +476,7 @@
.imgbox { .imgbox {
width: 33%; width: 33%;
image { image {
width: 142rpx; width: 142rpx;
height: 142rpx; height: 142rpx;

View File

@ -1,7 +1,7 @@
<template> <template>
<view class="page"> <view class="page">
<u-navbar title="创建店铺" :border-bottom="false" :background="bgc" title-color='#fff' back-icon-color="#fff" title-size='36' <u-navbar title="创建店铺" :border-bottom="false" :background="bgc" title-color='#fff' back-icon-color="#fff"
height='50'></u-navbar> title-size='36' height='50'></u-navbar>
<view class="box"> <view class="box">
<view class="list"> <view class="list">
<view class="listval"> <view class="listval">
@ -59,13 +59,16 @@
门头照片必须清晰方正易于辨识 门头照片必须清晰方正易于辨识
</view> </view>
</view> </view>
<view class="imgbox" @click="btn"> <view class="imgbox">
<image v-if="imgflag" <button
src="https://api.ccttiot.com/smartmeter/img/static/uY8CPw9YE6JxPzcHUaqf" mode=""> style="border: 0;outline: none;width: 143rpx;padding-left: 0rpx;height: 143rpx;border-radius: 16rpx;"
</image> type="primary reverse" open-type="chooseAvatar" @chooseavatar="getImage">
<image v-else :src="imglist" mode="" <image v-if="imgflag"
style="width: 142rpx;height: 142rpx;border-radius: 20rpx;"></image> src="https://api.ccttiot.com/smartmeter/img/static/uY8CPw9YE6JxPzcHUaqf" mode="">
</image>
<image v-else :src="imglist" mode=""
style="width: 142rpx;height: 142rpx;border-radius: 20rpx;"></image>
</button>
</view> </view>
</view> </view>
</view> </view>
@ -145,6 +148,27 @@
this.getQiniuToken() this.getQiniuToken()
}, },
methods: { methods: {
getImage(e) {
let _this = this
let math = 'static/' + _this.$u.guid(20)
const tempFilePaths = e.detail.avatarUrl
wx.uploadFile({
url: 'https://up-z2.qiniup.com',
name: 'file',
filePath: tempFilePaths,
formData: {
token: _this.token,
key: 'smartmeter/img/' + math
},
success: function(res) {
let str = JSON.parse(res.data)
console.log(str.key)
_this.userImgs = 'https://api.ccttiot.com/' + str.key
_this.imglist = _this.userImgs
_this.imgflag = false
}
})
},
btnyinye(num) { btnyinye(num) {
this.show = true this.show = true
this.yynum = num this.yynum = num
@ -271,24 +295,23 @@
this.area = e.area.label this.area = e.area.label
}, },
btnjwd() { btnjwd() {
uni.chooseLocation({ uni.chooseLocation({
success: (res) => { success: (res) => {
this.latitude = res.latitude; this.latitude = res.latitude;
this.longitude = res.longitude; this.longitude = res.longitude;
// console.log(this.latitude, this.longitude); },
}, fail: function(err) {
fail: function(err) {
// //
if (err.errMsg && err.errMsg.indexOf('chooseLocation:cancel') === 0) { if (err.errMsg && err.errMsg.indexOf('chooseLocation:cancel') === 0) {
uni.showToast({ uni.showToast({
title: '您取消了位置选择', title: '您取消了位置选择',
icon: 'none' icon: 'none'
}); });
} else { } else {
console.log('选择位置失败', err); console.log('选择位置失败', err);
// //
} }
}, },
}); });
}, },
@ -300,44 +323,46 @@
} }
}); });
}, },
btn() { // btn() {
let _this = this // let _this = this
let math = 'static/' + _this.$u.guid(20) // let math = 'static/' + _this.$u.guid(20)
uni.chooseImage({ // uni.chooseImage({
count: 1, // count: 1,
type: 'all', // type: 'all',
success(res) { // success(res) {
const tempFilePaths = res.tempFiles // const tempFilePaths = res.tempFiles
wx.uploadFile({ // wx.uploadFile({
url: 'https://up-z2.qiniup.com', // url: 'https://up-z2.qiniup.com',
name: 'file', // name: 'file',
filePath: tempFilePaths[0].path, // filePath: tempFilePaths[0].path,
formData: { // formData: {
token: _this.token, //token // token: _this.token, //token
key: 'smartmeter/img/' + math // key: 'smartmeter/img/' + math
}, // },
success: function(res) { // success: function(res) {
let str = JSON.parse(res.data) // let str = JSON.parse(res.data)
console.log(str.key) // console.log(str.key)
_this.userImgs = 'https://api.ccttiot.com/' + str.key // _this.userImgs = 'https://api.ccttiot.com/' + str.key
_this.imglist = _this.userImgs // _this.imglist = _this.userImgs
_this.imgflag = false // _this.imgflag = false
} // }
}); // });
} // }
}) // })
}, // },
} }
} }
</script> </script>
<style lang="scss"> <style lang="scss">
/deep/ .u-title{ /deep/ .u-title {
padding-bottom: 22rpx; padding-bottom: 22rpx;
} }
/deep/ .u-icon__icon{
/deep/ .u-icon__icon {
padding-bottom: 22rpx; padding-bottom: 22rpx;
} }
page { page {
background: linear-gradient(180deg, #8883F0 0%, rgba(255, 255, 255, 0) 100%); background: linear-gradient(180deg, #8883F0 0%, rgba(255, 255, 255, 0) 100%);
} }
@ -394,6 +419,7 @@
width: 100%; width: 100%;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
padding-right: 45rpx;
.lt { .lt {
padding-top: 40rpx; padding-top: 40rpx;

View File

@ -127,35 +127,24 @@
}); });
}, },
calculateAnchorX(name) { calculateAnchorX(name) {
let chineseLength = 0; let chineseLength = 0
let englishLength = 0; let englishLength = 0
for (let i = 0; i < name.length; i++) { for (let i = 0; i < name.length; i++) {
const charCode = name.charCodeAt(i); const charCode = name.charCodeAt(i)
// //
if (charCode >= 0x4e00 && charCode <= 0x9fa5) { if (charCode >= 0x4e00 && charCode <= 0x9fa5) {
chineseLength++; chineseLength++
} else if (/[a-zA-Z]/.test(name[i])) { // } else if (/[a-zA-Z]/.test(name[i])) { //
englishLength = englishLength + 0.3; // 1 englishLength = englishLength + 0.3 // 1
// console.log(englishLength); // console.log(englishLength)
} }
} }
const totalLength = chineseLength + englishLength * 2; // const totalLength = chineseLength + englishLength * 2; //
return -totalLength * 6.5; // anchorX -7 return -totalLength * 6.5 // anchorX -6.5
}, },
// onControltap(control) {
// uni.createMapContext("map", this).moveToLocation({
// longitude: this.longitude,
// latitude: this.latitude
// })
// this.mapScale = 15
// },
onControltap(control) { onControltap(control) {
this.setMapScale() this.setMapScale()
// uni.createMapContext("map", this).moveToLocation({
// longitude: this.longitude,
// latitude: this.latitude,
// })
}, },
// //
async setMapScale(e, val) { async setMapScale(e, val) {
@ -204,6 +193,7 @@
this.jinweidu = res.longitude + ',' + res.latitude this.jinweidu = res.longitude + ',' + res.latitude
this.latitude = Number(res.latitude.toFixed(5)) - 0.005 this.latitude = Number(res.latitude.toFixed(5)) - 0.005
this.longitude = Number(res.longitude.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=' + 1000).then( this.$u.get("/app/store/listNearBy?center=" + this.jinweidu + '&radius=' + 1000).then(
response => { response => {
@ -212,8 +202,7 @@
this.gxlist = response.data; this.gxlist = response.data;
this.gxlist.forEach(item => { this.gxlist.forEach(item => {
// //
const distance = this.getDistance(this.latitude, this const distance = this.getDistance(this.latitude, this.longitude, item.lat, item.lng);
.longitude, item.lat, item.lng);
// //
item.distance = distance; item.distance = distance;
// //
@ -252,31 +241,30 @@
textShadow: '2px 2px 0px white, -2px -2px 0px white, 2px -2px 0px white, -2px 2px 0px white', textShadow: '2px 2px 0px white, -2px -2px 0px white, 2px -2px 0px white, -2px 2px 0px white',
} }
}; };
// console.log(this.gxlist); // console.log(this.gxlist)
this.covers.push(shopCover); // this.covers.push(shopCover) //
}); });
} }
}).catch(error => { }).catch(error => {
console.error('请求店铺列表失败:', error); console.error('请求店铺列表失败:', error)
}); })
}, },
fail: (err) => { fail: (err) => {
console.error('获取位置失败:', err); console.error('获取位置失败:', err);
} }
}); });
}, },
//
getDistance(lat1, lon1, lat2, lon2) { getDistance(lat1, lon1, lat2, lon2) {
const R = 6371000; // const R = 6371000 //
const phi1 = lat1 * Math.PI / 180; // φ, const phi1 = lat1 * Math.PI / 180 //
const phi2 = lat2 * Math.PI / 180; const phi2 = lat2 * Math.PI / 180
const deltaPhi = (lat2 - lat1) * Math.PI / 180; const deltaPhi = (lat2 - lat1) * Math.PI / 180
const deltaLambda = (lon2 - lon1) * Math.PI / 180; const deltaLambda = (lon2 - lon1) * Math.PI / 180
const a = Math.sin(deltaPhi / 2) * Math.sin(deltaPhi / 2) + Math.cos(phi1) * Math.cos(phi2) * Math.sin( const a = Math.sin(deltaPhi / 2) * Math.sin(deltaPhi / 2) + Math.cos(phi1) * Math.cos(phi2) * Math.sin(deltaLambda / 2) * Math.sin(deltaLambda / 2)
deltaLambda / 2) * Math.sin(deltaLambda / 2); const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a))
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); const distance = R * c
const distance = R * c; return distance
return distance;
}, },
handleMarkerClick(event) { handleMarkerClick(event) {

View File

@ -9,13 +9,15 @@
<view class="lxxz"> <view class="lxxz">
<view class="" :class="cutidx==1?'active':''" @click="cutidx=1"> <view class="" :class="cutidx==1?'active':''" @click="cutidx=1">
功能异常 功能异常
<image style="width: 31rpx;height: 19rpx; position: absolute; right: 0;bottom: 0;display: none;" src="https://api.ccttiot.com/smartmeter/img/static/uvHUjXUhUwA0OvSA0O9K" mode=""></image>
</view> </view>
<view class="" :class="cutidx==2?'active':''" @click="cutidx=2"> <view class="" :class="cutidx==2?'active':''" @click="cutidx=2">
意见与建议 意见与建议
<image style="width: 31rpx;height: 19rpx; position: absolute; right: 0;bottom: 0;display: none;" src="https://api.ccttiot.com/smartmeter/img/static/uvHUjXUhUwA0OvSA0O9K" mode=""></image>
</view> </view>
<view class="" :class="cutidx==3?'active':''" @click="cutidx=3"> <view class="" :class="cutidx==3?'active':''" @click="cutidx=3">
其他 其他
<image style="width: 31rpx;height: 19rpx; position: absolute; right: 0;bottom: 0;display: none;" src="https://api.ccttiot.com/smartmeter/img/static/uvHUjXUhUwA0OvSA0O9K" mode=""></image>
</view> </view>
</view> </view>
</view> </view>
@ -41,10 +43,12 @@
</view> --> </view> -->
<view class="icon"> <view class="icon">
<view class="imgbox" v-for="(item,index) in imglist " :key="index"> <view class="imgbox" v-for="(item,index) in imglist " :key="index">
<image :src="item" mode=""></image> <image style="border-radius: 10rpx;" :src="item" mode=""></image>
</view> </view>
<view class="imgbox" @click="btn"> <view class="imgbox" style="width: 17%;">
<image src="https://api.ccttiot.com/smartmeter/img/static/uY8CPw9YE6JxPzcHUaqf" mode=""></image> <button style="border: 0;outline: none;width: 143rpx;padding-left: 0rpx;height: 143rpx;border-radius: 16rpx;" @click="getImage">
<image src="https://api.ccttiot.com/smartmeter/img/static/uY8CPw9YE6JxPzcHUaqf" mode=""></image>
</button>
</view> </view>
</view> </view>
<text>上传问题图片可以让问题快速解决哦!</text> <text>上传问题图片可以让问题快速解决哦!</text>
@ -108,14 +112,6 @@
}, },
updateWordCount() { updateWordCount() {
this.currentCount = this.textValue.trim().replace(/\s+/g, '').length; this.currentCount = this.textValue.trim().replace(/\s+/g, '').length;
// if (this.currentCount > 500) {
// this.textValue = this.textValue.slice(0, this.textValue.lastIndexOf(' ', 500)).trim();
// uni.showToast({
// title: '500',
// icon: 'none'
// });
// }
}, },
sub() { sub() {
if (this.cutidx == -1) { if (this.cutidx == -1) {
@ -151,25 +147,19 @@
}); });
} }
}, },
btn() { getImage(e) {
let _this = this let _this = this
let math = 'static/' + _this.$u.guid(20) let math = 'static/' + _this.$u.guid(20)
uni.chooseMessageFile({ uni.chooseImage({
count: 9, count: 9,
type: 'all', type: 'all',
success(res) { success(res) {
// tempFilePathimgsrc console.log(res);
const tempFilePaths = res.tempFiles const tempFilePaths = res.tempFilePaths[0]
// let tempFilePaths = chooseImageRes.tempFilePaths;
// console.log(tempFilePaths)
// tempFilePaths.forEach(item=>{
// //
// })
wx.uploadFile({ wx.uploadFile({
url: 'https://up-z2.qiniup.com', url: 'https://up-z2.qiniup.com',
name: 'file', name: 'file',
filePath: tempFilePaths[0].path, filePath: tempFilePaths,
formData: { formData: {
token: _this.token, //token token: _this.token, //token
key: 'smartmeter/img/' + math key: 'smartmeter/img/' + math
@ -177,15 +167,12 @@
success: function(res) { success: function(res) {
console.log(res, 'resres'); console.log(res, 'resres');
let str = JSON.parse(res.data) let str = JSON.parse(res.data)
console.log(str.key)
_this.userImgs = 'https://api.ccttiot.com/' + str.key _this.userImgs = 'https://api.ccttiot.com/' + str.key
console.log(_this.userImgs)
_this.imglist.push(_this.userImgs) _this.imglist.push(_this.userImgs)
} }
}); })
} }
}) })
}, },
// token // token
getQiniuToken() { getQiniuToken() {
@ -193,14 +180,7 @@
if (res.code == 200) { if (res.code == 200) {
this.token = res.token this.token = res.token
} }
}); })
// this.$u.get('https://v2.ielts.langsi.online/file/getToken').then(res => {
// console.log(res.data);
// this.token = res.data.token
// }).catch(err => {
// console.log(err)
// })
}, },
} }
} }
@ -216,8 +196,11 @@
font-size: 36rpx; font-size: 36rpx;
line-height: 84rpx; line-height: 84rpx;
text-align: center; text-align: center;
margin-top: 164rpx;
border-radius: 50rpx; border-radius: 50rpx;
position: fixed;
left: 50%;
transform: translateX(-50%);
bottom: 96rpx;
} }
page { page {
@ -243,7 +226,7 @@
display: flex; display: flex;
view { view {
border-radius: 10rpx 10rpx 10rpx 10rpx; border-radius: 15rpx;
border: 2rpx solid #C4C4C4; border: 2rpx solid #C4C4C4;
padding: 14rpx 34rpx 14rpx 34rpx; padding: 14rpx 34rpx 14rpx 34rpx;
box-sizing: border-box; box-sizing: border-box;
@ -272,7 +255,10 @@
.active { .active {
border: 2rpx solid #8883F0 !important; border: 2rpx solid #8883F0 !important;
} image{
display: block !important;
}
}
.problem { .problem {
margin-top: 40rpx; margin-top: 40rpx;

View File

@ -227,14 +227,36 @@
mapFun() { mapFun() {
uni.openLocation({ uni.openLocation({
latitude: this.listobj.lat, latitude: this.listobj.lat,// - /
// - / longitude: this.listobj.lng,// - /
longitude: this.listobj.lng, name: this.mapname, //
// - / address: this.mapaddress //
name: this.mapname,
address: this.mapaddress
}); });
}, },
//
async setMapScale(e, val) {
let mapContext = uni.createMapContext('map', this);
let setScale = () => {
return new Promise((resolve, reject) => {
mapContext.getScale({
success: r => {
this.mapScale = 15
resolve()
}
})
})
};
await setScale();
mapContext.moveToLocation({
success: (res) => {
const timer = setTimeout(() => {
this.mapScale = 15
clearTimeout(timer);
}, 500);
},
})
},
getMyLocation() { getMyLocation() {
uni.getLocation({ uni.getLocation({
@ -243,6 +265,7 @@
this.jinweidu = res.longitude + ',' + res.latitude this.jinweidu = res.longitude + ',' + res.latitude
this.latitude = Number(res.latitude.toFixed(5)) - 0.005 this.latitude = Number(res.latitude.toFixed(5)) - 0.005
this.longitude = Number(res.longitude.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=' + 1000).then( this.$u.get("/app/store/listNearBy?center=" + this.jinweidu + '&radius=' + 1000).then(
res => { res => {

View File

@ -124,28 +124,28 @@
<view class="" style="display: flex;justify-content: space-between;"> <view class="" style="display: flex;justify-content: space-between;">
<view class="cont" style="width: 120rpx;" @click="topage(0)"> <view class="cont" style="width: 120rpx;" @click="topage(0)">
<view class="top"> <view class="top">
<image src="https://api.ccttiot.com/smartmeter/img/static/uj4DT6WructS782RY0J7" mode="" <image src="https://api.ccttiot.com/smartmeter/img/static/uKrpw3p37UHW56IypPJU" mode=""
style="width: 58rpx;height: 56rpx;"></image> style="width: 58rpx;height: 56rpx;"></image>
</view> </view>
<view class="bot">充值记录</view> <view class="bot">充值记录</view>
</view> </view>
<view class="cont" style="width: 60rpx;" @click="topage(1)"> <view class="cont" style="width: 60rpx;" @click="topage(1)">
<view class="top"> <view class="top">
<image src="https://api.ccttiot.com/smartmeter/img/static/uGaAuulryhDmaDwWLuwo" mode="" <image src="https://api.ccttiot.com/smartmeter/img/static/uaS4iFmD786AtBt2tKFs" mode=""
style="width: 58rpx;height: 58rpx;"></image> style="width: 58rpx;height: 58rpx;"></image>
</view> </view>
<view class="bot">归零</view> <view class="bot">归零</view>
</view> </view>
<view class="cont" style="width: 60rpx;" @click="topage(2)"> <view class="cont" style="width: 60rpx;" @click="topage(2)">
<view class="top"> <view class="top">
<image src="https://api.ccttiot.com/smartmeter/img/static/u8QfFAKCq8wE32dFA9Go" mode="" <image src="https://api.ccttiot.com/smartmeter/img/static/ue0X00T1C3fh7TCgjopm" mode=""
style="width: 58rpx;height: 60rpx;"></image> style="width: 58rpx;height: 60rpx;"></image>
</view> </view>
<view class="bot">异常</view> <view class="bot">异常</view>
</view> </view>
<view class="cont" style="width: 120rpx;" @click="toydfx()"> <view class="cont" style="width: 120rpx;" @click="toydfx()">
<view class="top"> <view class="top">
<image src="https://api.ccttiot.com/smartmeter/img/static/u0N4pFke1isIzNrNT6Wh" mode=""> <image src="https://api.ccttiot.com/smartmeter/img/static/uDVSE5BFHQnjG2JTVE62" mode="">
</image> </image>
</view> </view>
<view class="bot">用电分析</view> <view class="bot">用电分析</view>
@ -154,28 +154,28 @@
<view class="" style="display: flex;margin-top: 20rpx;"> <view class="" style="display: flex;margin-top: 20rpx;">
<view class="cont" style="width: 120rpx;" @click="topage(3)"> <view class="cont" style="width: 120rpx;" @click="topage(3)">
<view class="top"> <view class="top">
<image src="https://api.ccttiot.com/smartmeter/img/static/uijv1lOhn2ds1ZS4gEMT" mode="" <image src="https://api.ccttiot.com/smartmeter/img/static/umjPUc8nDKf1JwVqRAeb" mode=""
style="width: 58rpx;height: 60rpx;"></image> style="width: 58rpx;height: 60rpx;"></image>
</view> </view>
<view class="bot">收费方式</view> <view class="bot">收费方式</view>
</view> </view>
<view class="cont" style="width: 60rpx;" @click="topage(4)"> <view class="cont" style="width: 60rpx;" @click="topage(4)">
<view class="top"> <view class="top">
<image src="https://api.ccttiot.com/smartmeter/img/static/ubxoYVnbIK1rk0cfoL3j" mode=""> <image src="https://api.ccttiot.com/smartmeter/img/static/u2Uco0iXf8aure0H2ihz" mode="">
</image> </image>
</view> </view>
<view class="bot">设置</view> <view class="bot">设置</view>
</view> </view>
<view class="cont" style="width: 60rpx;margin-right: 100rpx;" @click="topage(5)"> <view class="cont" style="width: 60rpx;margin-right: 100rpx;" @click="topage(5)">
<view class="top"> <view class="top">
<image src="https://api.ccttiot.com/smartmeter/img/static/uWaQjL7vph474LWTyGfs" mode=""> <image src="https://api.ccttiot.com/smartmeter/img/static/uXdBHA7pzOv2LYL7stJp" mode="">
</image> </image>
</view> </view>
<view class="bot">配网</view> <view class="bot">配网</view>
</view> </view>
<view class="cont" style="width: 60rpx;" @click="topage(6)"> <view class="cont" style="width: 60rpx;" @click="topage(6)">
<view class="top"> <view class="top">
<image src="https://api.ccttiot.com/smartmeter/img/static/udZvVKZIh6brG3cm3YpN" mode=""> <image src="https://api.ccttiot.com/smartmeter/img/static/uAnBmmayp3tVGwXntdaM" mode="">
</image> </image>
</view> </view>
<view class="bot">充值</view> <view class="bot">充值</view>
@ -447,61 +447,72 @@
url: '/page_user/cbRecord?id=' + this.id url: '/page_user/cbRecord?id=' + this.id
}) })
} else if (num == 1) { } else if (num == 1) {
// uni.showModal({
this.$u.put(`/app/device/${this.id}/reset`).then((res) => { title: '提示',
if (res.code == 200) { content: '您确定要将电表时间归零吗?',
console.log(res.data); success: function(res) {
uni.showToast({ if (res.confirm) {
title: res.data, //
icon: 'none', this.$u.put(`/app/device/${this.id}/reset`).then((res) => {
duration: 2000 if (res.code == 200) {
}) console.log(res.data);
this.getDevice(this.id) uni.showToast({
} else if (res.msg == '设备剩余时间不足,无需归零') { title: res.data,
uni.showToast({ icon: 'none',
title: '设备剩余时间不足,无需归零', duration: 2000
icon: 'none', })
duration: 2000 this.getDevice(this.id)
}) } else if (res.msg == '设备剩余时间不足,无需归零') {
}else if(res.code == 500){ uni.showToast({
uni.showToast({ title: '设备剩余时间不足,无需归零',
title: res.msg, icon: 'none',
icon: 'none', duration: 2000
duration: 2000 })
}) }else if(res.code == 500){
// uni.showLoading({ uni.showToast({
// title: '...' title: res.msg,
// }) icon: 'none',
// let vm = this; // this vm duration: 2000
// uni.getNetworkType({ })
// success(res) { // uni.showLoading({
// if (res.networkType !== 'none') { // title: '...'
// uni.getConnectedBluetoothDevices({ // })
// success(res) { // let vm = this; // this vm
// console.log('', res); // uni.getNetworkType({
// xBlufi.notifySendCustomData({ // success(res) {
// customData: "time@" + 0 // if (res.networkType !== 'none') {
// }); // uni.getConnectedBluetoothDevices({
// }, // success(res) {
// fail(err) { // console.log('', res);
// console.error('', err); // xBlufi.notifySendCustomData({
// } // customData: "time@" + 0
// }) // });
// // vm.$u.get(`/app/bill/recharge/${vm.billNo}/bluetoothSuccess`).then(res => { // },
// // if(res.code == 200){ // fail(err) {
// // setTimeout(()=>{ // console.error('', err);
// // uni.hideLoading() // }
// // uni.navigateBack() // })
// // },1000) // // vm.$u.get(`/app/bill/recharge/${vm.billNo}/bluetoothSuccess`).then(res => {
// // } // // if(res.code == 200){
// // }) // // setTimeout(()=>{
// } else { // // uni.hideLoading()
// console.log(''); // // uni.navigateBack()
// } // // },1000)
// } // // }
// }) // // })
// } else {
// console.log('');
// }
// }
// })
}
})
} else if (res.cancel) {
console.log('用户点击了取消');
}
} }
}) })
} else if (num == 2) { // } else if (num == 2) { //
uni.navigateTo({ uni.navigateTo({
url: '/page_fenbao/statulist/fault/yichang/index' url: '/page_fenbao/statulist/fault/yichang/index'

View File

@ -212,28 +212,28 @@
setTimeout(() => { setTimeout(() => {
if (this.userType === '01') { // '01' if (this.userType === '01') { // '01'
if (uni.getStorageSync('mac')) { if (uni.getStorageSync('mac')) {
this.mac = uni.getStorageSync('mac'); this.mac = uni.getStorageSync('mac')
uni.getLocation({ uni.getLocation({
type: 'wgs84', type: 'wgs84',
success: function(lb) { success: function(lb) {
that.gps.lat = lb.latitude; that.gps.lat = lb.latitude
that.gps.lon = lb.longitude; that.gps.lon = lb.longitude
that.tobind() that.tobind()
}, },
fail: function(error) { fail: function(error) {
console.error('获取位置信息失败:', error); console.error('获取位置信息失败:', error)
that.gps.lat = 0; that.gps.lat = 0
that.gps.lon = 0; that.gps.lon = 0
that.tobind() that.tobind()
} }
}); })
} }
} else { } else {
if (uni.getStorageSync('billNo')) { if (uni.getStorageSync('billNo')) {
let billNo = uni.getStorageSync('billNo') let billNo = uni.getStorageSync('billNo')
this.$u.get(`/app/bill/recharge/${billNo}/bluetoothSuccess`).then((res) => { this.$u.get(`/app/bill/recharge/${billNo}/bluetoothSuccess`).then((res) => {
if (res.code == 200) { if (res.code == 200) {
uni.removeStorageSync('billNo'); uni.removeStorageSync('billNo')
this.showtip = false this.showtip = false
this.order() this.order()
} }
@ -392,7 +392,7 @@
changeGp(item, index) { changeGp(item, index) {
console.log(item); // console.log(item);
this.showfz = false this.showfz = false
if (item == 1) { if (item == 1) {
this.getDeviceList() this.getDeviceList()
@ -988,7 +988,6 @@
} }
.bot_right { .bot_right {
// margin-top: 50rpx;
display: flex; display: flex;
flex-wrap: nowrap; flex-wrap: nowrap;
@ -1085,7 +1084,6 @@
margin-top: 32rpx; margin-top: 32rpx;
display: flex; display: flex;
flex-wrap: nowrap; flex-wrap: nowrap;
// justify-content: space-around;
padding-left: 50rpx; padding-left: 50rpx;
box-sizing: border-box; box-sizing: border-box;
@ -1180,10 +1178,6 @@
.card_cont { .card_cont {
width: 750rpx; width: 750rpx;
// display: flex;
// flex-wrap: wrap;
// align-items: baseline;
// justify-content: center;
padding-left: 30rpx; padding-left: 30rpx;
height: 100%; height: 100%;
overflow-y: auto; overflow-y: auto;
@ -1244,7 +1238,7 @@
// width: 100vh; // width: 100vh;
display: flex; display: flex;
transition: transform 0.3s ease; transition: transform 0.3s ease;
padding-top: 10rpx;
.fd_tit { .fd_tit {
text-align: center; text-align: center;
padding: 0 15rpx; padding: 0 15rpx;

View File

@ -1,7 +1,8 @@
<template> <template>
<view class="page"> <view class="page">
<u-navbar :is-back="false" :title="tittxt" :border-bottom="false" :background="bgc" title-color='#fff' title-size='36' height='36' > <u-navbar :is-back="false" :title="tittxt" :border-bottom="false" :background="bgc" title-color='#fff'
title-size='36' height='36'>
</u-navbar> </u-navbar>
<view class="imgbox"> <view class="imgbox">
<image src="https://api.ccttiot.com/smartmeter/img/static/uCqHftk2W2zEPX03DLcb" mode=""></image> <image src="https://api.ccttiot.com/smartmeter/img/static/uCqHftk2W2zEPX03DLcb" mode=""></image>
@ -26,8 +27,9 @@
<view class="input_txt" style="width: 536rpx;font-size: 24rpx;line-height: 32rpx;"> <view class="input_txt" style="width: 536rpx;font-size: 24rpx;line-height: 32rpx;">
您暂未授权共享开关小程序获取你的信息将无法正常使用小程序的功能如需要正常使用请点击授权按钮打开头像昵称等信息的授权 您暂未授权共享开关小程序获取你的信息将无法正常使用小程序的功能如需要正常使用请点击授权按钮打开头像昵称等信息的授权
</view> </view>
<button class="button" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" style="margin-top: 330rpx;margin-left: -10rpx;" > <button class="button" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber"
style="margin-top: 330rpx;margin-left: -10rpx;">
授权登录 授权登录
</button> </button>
</view> </view>
@ -42,83 +44,73 @@
bgc: { bgc: {
backgroundColor: "#7D86EF", backgroundColor: "#7D86EF",
}, },
tittxt:"授权登录", tittxt: "授权登录",
chooseType:true, chooseType: true,
usertype:'', usertype: '',
login:false login: false
} }
}, },
methods: { methods: {
userType(num){ userType(num) {
this.chooseType=false this.chooseType = false
this.login=true this.login = true
if(num==1){ if (num == 1) {
this.usertype='01' this.usertype = '01'
}else{ } else {
this.usertype='00' this.usertype = '00'
} }
}, },
getPhoneNumber(e) { getPhoneNumber(e) {
let that = this; let that = this;
console.log("eeeeeeee", e); console.log("eeeeeeee", e);
const wxLoginAsync = () => { const wxLoginAsync = () => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
wx.login({ wx.login({success(res) {
success(res) { if (res.code) {
if (res.code) { let data = {
console.log('登录!', res);
let data = {
loginCode: res.code, loginCode: res.code,
mobileCode: e.detail.code, mobileCode: e.detail.code,
}; }
resolve(data); resolve(data);
} else { } else {
reject(res.errMsg); reject(res.errMsg)
} }
}, },fail(err) {
fail(err) { reject(err)
reject(err); }
} })
}); })
}); }
}; wxLoginAsync().then(async (data) => {
wxLoginAsync() this.$u.post("/app/auth/wxLogin", data).then((res) => {
.then(async (data) => { if (res.code == 200) {
this.$u.post("/app/auth/wxLogin",data).then((res) => {
// this.$forceUpdate()
if (res.code == 200) {
console.log(res,'resres');
wx.setStorageSync('token', res.token); wx.setStorageSync('token', res.token);
that.ceshi() that.ceshi()
} }
}); })
}).catch((err) => {
}) console.error(err)
.catch((err) => { })
console.error(err);
});
}, },
async ceshi() { async ceshi() {
this.$u.get("/app/user/userInfo").then((res) => { this.$u.get("/app/user/userInfo").then((res) => {
uni.navigateTo({ uni.navigateTo({
url: '/pages/shouye/index' url: '/pages/shouye/index'
}) })
}); })
}, },
} }
} }
</script> </script>
<style lang="scss" > <style lang="scss">
page{ page {
background: #FFFFFF; background: #FFFFFF;
} }
.page { .page {
position: relative; /* 添加相对定位 */ position: relative;
/* 添加相对定位 */
} }
.imgbox { .imgbox {
@ -144,22 +136,30 @@
} }
.inputbox { .inputbox {
position: absolute; /* 或者 fixed根据你的需求 */ position: absolute;
top: 700rpx; /* 调整这里来控制距离顶部的距离 */ /* 或者 fixed根据你的需求 */
top: 700rpx;
width: 750rpx; /* 调整输入框的宽度 */ /* 调整这里来控制距离顶部的距离 */
width: 750rpx;
/* 调整输入框的宽度 */
padding: 100rpx 0; padding: 100rpx 0;
background: #fff; /* 设置背景颜色,这里是红色的半透明 */ background: #fff;
border-radius: 50rpx; /* 设置圆角 */ /* 设置背景颜色,这里是红色的半透明 */
z-index: 999; /* 设置 z-index确保在其他内容上方显示 */ border-radius: 50rpx;
/* 设置圆角 */
z-index: 999;
/* 设置 z-index确保在其他内容上方显示 */
padding-left: 104rpx; padding-left: 104rpx;
.input_txt{
.input_txt {
font-weight: 400; font-weight: 400;
font-size: 32rpx; font-size: 32rpx;
color: #3D3D3D; color: #3D3D3D;
line-height: 44rpx; line-height: 44rpx;
} }
.button{
.button {
margin-top: 64rpx; margin-top: 64rpx;
display: flex; display: flex;
justify-content: center; justify-content: center;
@ -168,10 +168,10 @@
height: 96rpx; height: 96rpx;
background: #8883F0; background: #8883F0;
border-radius: 52rpx 52rpx 52rpx 52rpx; border-radius: 52rpx 52rpx 52rpx 52rpx;
font-weight: 500; font-weight: 500;
font-size: 36rpx; font-size: 36rpx;
color: #FFFFFF; color: #FFFFFF;
} }
} }
</style> </style>

View File

@ -108,19 +108,19 @@
// this.initOtherCovers(); // // this.initOtherCovers(); //
}, },
onShow() { onShow() {
this.logins(); this.logins()
this.getad() this.getad()
this.gethuidaio() this.gethuidaio()
}, },
onReady() { onReady() {
this.mapContext = uni.createMapContext('map', this); this.mapContext = uni.createMapContext('map', this)
this.mapScaleInterval = setInterval(this.updateMarkers, 1000); this.mapScaleInterval = setInterval(this.updateMarkers, 1000)
}, },
beforeDestroy() { beforeDestroy() {
// //
if (this.mapScaleInterval) { if (this.mapScaleInterval) {
clearInterval(this.mapScaleInterval); clearInterval(this.mapScaleInterval)
this.mapScaleInterval = null; this.mapScaleInterval = null
} }
}, },
methods: { methods: {
@ -165,7 +165,7 @@
height: 30, height: 30,
iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uZXgsJE6hXbRSwbKILB4', iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uZXgsJE6hXbRSwbKILB4',
}; };
this.covers.push(shopCover); this.covers.push(shopCover)
}); });
}, },
addMarkersWithLabels() { addMarkersWithLabels() {
@ -186,23 +186,22 @@
rotate: 20 rotate: 20
} }
} }
this.covers.push(shopCover); this.covers.push(shopCover)
}); });
}, },
calculateAnchorX(name) { calculateAnchorX(name) {
let chineseLength = 0; let chineseLength = 0
let englishLength = 0; let englishLength = 0
for (let i = 0; i < name.length; i++) { for (let i = 0; i < name.length; i++) {
const charCode = name.charCodeAt(i); const charCode = name.charCodeAt(i)
if (charCode >= 0x4e00 && charCode <= 0x9fa5) { if (charCode >= 0x4e00 && charCode <= 0x9fa5) {
chineseLength++; chineseLength++
} else if (/[a-zA-Z]/.test(name[i])) { } else if (/[a-zA-Z]/.test(name[i])) {
englishLength = englishLength + 0.3; // 1 englishLength = englishLength + 0.3 // 1
// console.log(englishLength);
} }
} }
const totalLength = chineseLength + englishLength * 2; const totalLength = chineseLength + englishLength * 2;
return -totalLength * 6.5; // anchorX -7 return -totalLength * 6.5 // anchorX -6.5
}, },
scanQRCode() { scanQRCode() {
@ -211,14 +210,14 @@
scanType: ['qrCode'], scanType: ['qrCode'],
success: res => { success: res => {
function getQueryParam(url, paramName) { function getQueryParam(url, paramName) {
let regex = new RegExp(`[?&]${paramName}=([^&]*)`); let regex = new RegExp(`[?&]${paramName}=([^&]*)`)
let results = regex.exec(url); let results = regex.exec(url);
return results ? decodeURIComponent(results[1].replace(/\+/g, ' ')) : null; return results ? decodeURIComponent(results[1].replace(/\+/g, ' ')) : null
} }
let sceneValue = res.result let sceneValue = res.result
let decodedValue = decodeURIComponent(sceneValue); let decodedValue = decodeURIComponent(sceneValue)
let id = getQueryParam(decodedValue, 's') let id = getQueryParam(decodedValue, 's')
console.log(res, id); // console.log(res, id)
this.$u.get(`/app/device/${id}/withSuitList`).then((res) => { this.$u.get(`/app/device/${id}/withSuitList`).then((res) => {
if (res.code == 200) { if (res.code == 200) {
uni.navigateTo({ uni.navigateTo({
@ -228,7 +227,7 @@
}) })
}, },
fail: err => { fail: err => {
console.error('扫描失败:', err); console.error('扫描失败:', err)
uni.showToast({ uni.showToast({
title: '扫描失败', title: '扫描失败',
icon: 'none' icon: 'none'
@ -282,10 +281,6 @@
onControltap(control) { onControltap(control) {
this.setMapScale() this.setMapScale()
// uni.createMapContext("map", this).moveToLocation({
// longitude: this.longitude,
// latitude: this.latitude,
// })
}, },
// //
async setMapScale(e, val) { async setMapScale(e, val) {
@ -319,6 +314,7 @@
this.jinweidu = res.longitude + ',' + res.latitude this.jinweidu = res.longitude + ',' + res.latitude
this.latitude = Number(res.latitude.toFixed(5)) - 0.005 this.latitude = Number(res.latitude.toFixed(5)) - 0.005
this.longitude = Number(res.longitude.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=' + 1000).then( this.$u.get("/app/store/listNearBy?center=" + this.jinweidu + '&radius=' + 1000).then(
res => { res => {
@ -380,7 +376,6 @@
}) })
}, },
logins() { logins() {
if (uni.getStorageSync('userType')) { if (uni.getStorageSync('userType')) {
this.userType = uni.getStorageSync('userType') this.userType = uni.getStorageSync('userType')

View File

@ -164,7 +164,6 @@
// //
gettime() { gettime() {
let data = { let data = {
year: this.yeartime.year, year: this.yeartime.year,
month: this.yeartime.month, month: this.yeartime.month,
groupBy: 'create_date' groupBy: 'create_date'
@ -265,7 +264,7 @@
fontSize: 11, fontSize: 11,
formatter: function(value) { formatter: function(value) {
// 00 // 00
return value + '.00' + '元' return value + '元'
}, },
}, },
splitLine: { splitLine: {
@ -524,7 +523,7 @@
width: 632rpx; width: 632rpx;
height: 88rpx; height: 88rpx;
background: #FFFFFF; background: #FFFFFF;
box-shadow: 0rpx 16rpx 40rpx 0rpx rgba(42, 130, 228, 0.1); // box-shadow: 0rpx 16rpx 40rpx 0rpx rgba(42, 130, 228, 0.1);
opacity: 1; opacity: 1;
border-radius: 30rpx; border-radius: 30rpx;
display: flex; display: flex;