| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241 |
- <template>
- <view>
- <view class="top-box">
- <view class="top-title">
- <view v-if="!userInfo.storeId" @click="showPop=true" class="ddflex" :style="'height: '+ systems.navigationHeight + 'rpx;padding-top:' + systems.ktxStatusHeight + 'rpx;'+'line-height: '+ systems.navigationHeight + 'rpx;'">
- <view>{{actMerchant.name}}</view>
- <image class="dow-ssicon" src="../../static/pages/images/dow-ssicon.png"></image>
- </view>
- </view>
- <view class="search-box ddflex">
- <image class="search-saoma" src="../../static/pages/images/saoma.png"></image>
- <view class="search-input ddflex fflex">
- <image class="search-input-icon" src="../../static/pages/images/search.png"></image>
- <input class="fflex" placeholder="请输入编号查询"/>
- <view class="search-btn">搜索</view>
- </view>
- </view>
- </view>
-
- <view :style="'height: '+ (systems.navigationHeight+systems.ktxStatusHeight+134) + 'rpx;'"></view>
-
- <!-- 机柜 -->
- <view class="machine-item" v-for="item,index in groupList" @click="jumpUrl('/machineAndCell/machineInfo/machineInfo')">
- <view class="ddflex" style="justify-content: space-between;">
- <view class="machine-title fflex tover">{{item.devName}}</view>
- <view class="state">在线</view>
- </view>
- <view class="machine-number">机柜编号:{{item.devId}}</view>
- <view class="machine-info ddflex">
- <view class="ddflex">
- <view class="margin-r40">温度:{{item.cabTemp}}℃</view>
- <view class="margin-r40">仓门数:{{item.doorCount}}</view>
- <view class="margin-r40">电池数:{{item.batNum}}</view>
- </view>
- <view class="fflex tover" style="color: #2A82E4;text-align: right;">
- {{item.storeName}}
- </view>
- </view>
- <view class="address-box ddflex">
- <image class="address-icon" src="../../static/pages/images/address-icon.png"></image>
- <view class="fflex tover">{{item.address}}</view>
- <image class="daohang" src="../../static/pages/images/daohang.png"></image>
- </view>
- </view>
-
- <left-pop v-if="showPop" :showPop="showPop" :btnColor="'#11BB8B'" :showBtn='false' title="解除提醒" width="460rpx"
- @closePop="closePop()" @popSubmit="popSubmit()">
- <view class="" style="height: 100%;flex-direction: column;display: flex;">
- <view @click="closePop()" class="pop-title ddflex" :style="'height: '+ systems.navigationHeight + 'rpx;padding-top:' + systems.ktxStatusHeight + 'rpx;'+'line-height: '+ systems.navigationHeight + 'rpx;'">
- <view>切换门店</view>
- <image class="change-ssicon" src="../../static/pages/images/change.png"></image>
- </view>
- <scroll-view :scroll-y="true" @scrolltolower="loadLeftData" class="pop-content fflex">
- <view :class="'pop-content-item '+(actMerchant.id==item.id?'pop-content-active':'')" v-for="(item,index) in merchantList" @click="changePop(item)">
- <view class="pop-content-name">{{item.name}}</view>
- <image class="pop-content-icon" src=""></image>
- </view>
- </scroll-view>
- </view>
- </left-pop>
-
- <foot channel="machine" :isUpdate="isUpdate"></foot>
- </view>
- </template>
- <script>
- const app = getApp();
- const req = require("../../utils/request.js");
- import foot from "../../components/nav-bar/index";
- import leftPop from "../../components/left-pop/index";
- export default {
- components: {
- foot,
- leftPop
- },
- props: {},
- data() {
- return {
- systems: {},
- isTop:0,
- isUpdate: false,
-
- userInfo:{},
- userType:0,//0管理员 1商家 2门店
-
- showPop: false,
- tempData: null,
-
- groupList: [],
- page: 1,
- limit: 10,
- searchValue:'',
- isQuerying:false,//正在查询数据
-
- merchantList: [],
- merchantPage: 1,
- merchantLimit: 10,
-
- actMerchant:{},//当前门店
- }
- },
- onLoad(options) {
- // 判断当前登录用户身份
- if(req.isLogins(true)){
- this.userInfo = req.getStorage('userInfo')
-
- if(!this.userInfo.storeId){
- this.getMerchantList()
- }
- }else{
- this.getMachineList()
- }
- },
- onShow() {
- this.setData({
- isUpdate: !this.isUpdate
- });
- },
- methods: {
- jumpUrl(url){
- if(req.isLogins(true)){
- uni.navigateTo({
- url:url
- })
- }
- },
- // 弹窗弹出
- openPop(item) {
- this.tempData = JSON.parse(JSON.stringify(item))
- this.showPop = true
- },
- closePop(){
- this.showPop = false
- },
- changePop(item){
- this.actMerchant = item
- req.setStorage('default_merchant',item)
- this.closePop()
- this.getMachineList()
- },
- // 获取机柜列表
- getMachineList(isPage){
- if(this.isQuerying) return
- else this.isQuerying = true
- if (!isPage) {
- this.page = 1
- }
- let queryParams = {
- page: this.page,
- limit: this.limit,
- }
- if(this.searchValue){
- queryParams.devId=this.searchValue
- }
- queryParams.storeId = this.actMerchant.id
- req.getRequest(
- '/admin/v2/cab/page',
- queryParams,
- data => {
- if (data != null && data.list.length > 0) {
- if (!isPage) {
- this.groupList = data.list
- } else {
- this.groupList = this.groupList.concat(data.list)
- }
- this.page++
- } else {
- if (!isPage)
- this.groupList = data.list
- else {}
- }
- uni.hideLoading()
- this.isQuerying = false
- }
- )
- },
- loadLeftData(res){
- this.getMerchantList(true)
- },
- getMerchantList(isPage){
- if (!isPage) {
- this.merchantPage = 1
- }
- let queryParams = {
- page: this.merchantPage,
- limit: this.merchantLimit,
- }
- queryParams.merchantId = req.getStorage('userInfo').merchantId?req.getStorage('userInfo').merchantId:null
- req.getRequest(
- '/admin/v2/store/page',
- queryParams,
- data => {
- if (data != null && data.list.length > 0) {
- if (!isPage) {
- this.merchantList = data.list
- } else {
- this.merchantList = this.merchantList.concat(data.list)
- }
- this.merchantPage++
- } else {
- if (!isPage)
- this.merchantList = data.list
- else {}
- }
- if(!isPage){
- if(req.getStorage('default_merchant')){
- this.actMerchant = req.getStorage('default_merchant')
- }else{
- this.actMerchant = this.merchantList[0]
- }
- this.getMachineList()
- }
- }
- )
- }
- },
- mounted() {
- const systemInfo = uni.getSystemInfoSync();
- // px转换到rpx的比例
- let pxToRpxScale = 750 / systemInfo.windowWidth;
- let systems = {
- ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
- navigationHeight: 44 * pxToRpxScale // 导航栏的高度
- };
- systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
- this.systems = systems;
- },
- onPageScroll: function(e) {
- if (e.scrollTop > this.systems.barHeight) {
- this.isTop = 1;
- } else {
- this.isTop = 0;
- }
- }
- }
- </script>
- <style>
- @import "./machine.css";
- </style>
|