powerbank/page_user/shopdetail.vue

240 lines
6.0 KiB
Vue
Raw Normal View History

2024-05-15 18:01:50 +08:00
<template>
<view class="page">
<u-navbar title="店铺详情" :border-bottom="false" :background="bgc" title-color='#000' title-size='36'
height='38'></u-navbar>
<view class="box">
<view class="shopname">
{{listobj.name}}
</view>
<view class="shoplist">
<view class="tit">
基本信息
</view>
<view class="jiben">
2024-05-17 18:10:58 +08:00
<text class="qian">设备数量</text> <text class="shen">{{listobj.cabinetCount}}</text>
2024-05-15 18:01:50 +08:00
</view>
<view class="jiben">
<text class="qian">营业时间</text> <text class="shen">{{listobj.businessTimeStart}}~{{listobj.businessTimeEnd}}</text>
</view>
<view class="jiben">
<text class="qian">详细地址</text> <text class="shen">{{listobj.address}}</text>
</view>
<view class="jiben">
<text class="qian">创建时间</text> <text class="shen">{{listobj.createTime}}</text>
</view>
</view>
<view class="icons">
2024-05-17 18:10:58 +08:00
<image v-if="flag" src="https://api.ccttiot.com/smartmeter/img/static/uZEG6wcsyjAlik8iKnBZ" mode="" @click="btnpag(1)"></image>
<image v-if="flag" src="https://api.ccttiot.com/smartmeter/img/static/u3GbElGkYzgolFDVMcRF" mode="" @click="btnpag(2)"></image>
<image v-if="flag" src="https://api.ccttiot.com/smartmeter/img/static/umSzDeyl29aEeJDXY3lT" mode="" @click="btnpag(3)"></image>
<image v-if="flag" src="https://api.ccttiot.com/smartmeter/img/static/u54XmWWxo1l0yY1mZtcG" mode="" @click="btnpag(4)"></image>
<image v-if="flags" src="https://api.ccttiot.com/smartmeter/img/static/urIxP74GyW2Puz4uqfN9" style="width: 54rpx;" mode="" @click="btnpag(5)"></image>
2024-05-15 18:01:50 +08:00
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
show: false,
storeId:'',
2024-05-17 18:10:58 +08:00
listobj:{},
flag:false,
flags:false
2024-05-15 18:01:50 +08:00
}
},
onLoad(option) {
2024-05-17 18:10:58 +08:00
this.storeId = option.storeId
let userdata = uni.getStorageSync('userdata').permissions
if (Array.isArray(userdata) && userdata.includes('agent:store:operation')) {
this.flag = true
} else {
this.flag = false
}
if (Array.isArray(userdata) && userdata.includes('agent:device:show')) {
this.flags = true
} else {
this.flags = false
}
this.getdetail()
2024-05-15 18:01:50 +08:00
},
methods: {
getdetail(){
2024-05-17 18:10:58 +08:00
this.$u.get(`/agent/store/${this.storeId}`).then(res => {
2024-05-15 18:01:50 +08:00
if (res.code == 200) {
this.listobj = res.data
}
})
},
btnpag(num){
if(num == 1){
uni.navigateTo({
url:'/page_user/jifei'
})
}else if(num == 2){
uni.navigateTo({
2024-05-17 18:10:58 +08:00
url:'/page_user/shopedit?obj=' + JSON.stringify(this.listobj)
2024-05-15 18:01:50 +08:00
})
}else if(num == 3){
let vm = this
uni.showModal({
title: '提示',
content: '你确定要注销这个店铺吗?',
success: function (res) {
if (res.confirm) {
2024-05-17 18:10:58 +08:00
vm.$u.delete(`/agent/store/${vm.storeId}`).then(res => {
2024-05-15 18:01:50 +08:00
if (res.code == 200) {
uni.showToast({
2024-05-17 18:10:58 +08:00
title: '注销成功',
2024-05-15 18:01:50 +08:00
icon: 'success',
duration: 1000
})
setTimeout(()=>{
uni.navigateBack()
},1500)
}
})
} else if (res.cancel) {
console.log('用户点击了取消');
}
}
});
}else if(num == 4){
uni.scanCode({
onlyFromCamera: true,
scanType: ['qrCode'],
success: res => {
console.log('扫描结果:', res);
},
fail: err => {
console.error('扫描失败:', err);
uni.showToast({
title: '扫描失败',
icon: 'none'
});
}
});
}else if(num == 5){
uni.navigateTo({
url:'/pages/agentpages/devicemanagement/chargepallist/index'
})
}
},
confirm(e) {
let type = e[0].value
if (type == '1') {
this.scanQRCode()
} else if (type == '2') {
uni.navigateTo({
url: '/page_fenbao/device/index'
})
}
},
scanQRCode() {
uni.scanCode({
onlyFromCamera: true,
scanType: ['qrCode'],
success: res => {
console.log('扫描结果:', res);
this.qrResult = res.result; // 将扫描结果存储在数据中
},
fail: err => {
console.error('扫描失败:', err);
uni.showToast({
title: '扫描失败',
icon: 'none'
});
}
});
},
}
}
</script>
<style lang="scss">
page {
background: linear-gradient(180deg, #54DAA1 0%, rgba(255, 255, 255, 0) 100%);
}
.page {
width: 750rpx;
position: fixed;
top: 0;
left: 0;
.box{
width: 750rpx;
height: 1440rpx;
background: #F4F5F7;
border-radius: 0rpx 0rpx 0rpx 0rpx;
padding: 22rpx 36rpx;
box-sizing: border-box;
.shopname{
width: 680rpx;
height: 102rpx;
background: #FFFFFF;
border-radius: 24rpx 24rpx 24rpx 24rpx;
margin: auto;
padding-left: 30rpx;
padding-top: 30rpx;
font-weight: 600;
font-size: 32rpx;
color: #3D3D3D;
}
.shoplist{
padding: 30rpx;
box-sizing: border-box;
width: 680rpx;
height: 376rpx;
background: #FFFFFF;
border-radius: 24rpx 24rpx 24rpx 24rpx;
margin-top: 24rpx;
.tit{
font-weight: 600;
font-size: 28rpx;
color: #3D3D3D;
}
.jiben{
margin-top: 16rpx;
display: flex;
justify-content: space-between;
.qian{
font-size: 24rpx;
color: #808080;
width: 40%;
// margin-right: 20rpx;
}
.shen{
font-size: 24rpx;
color: #3D3D3D;
}
}
}
.icons{
padding-top: 30rpx;
padding-left: 50rpx;
padding-right: 50rpx;
box-sizing: border-box;
flex-wrap: wrap;
width: 680rpx;
height: 170rpx;
background: #FFFFFF;
border-radius: 24rpx 24rpx 24rpx 24rpx;
margin: auto;
display: flex;
justify-content: space-between;
margin-top: 26rpx;
image{
width: 96rpx;
height: 96rpx;
}
}
}
}
</style>