new-cashier/jeepay-ui-uapp-merchant/pagePrinter/index/index.vue

63 lines
1.3 KiB
Vue

<template>
<view class="min-page bg-gray u-p-30 u-flex u-flex-col u-row-center">
<div class="w-full" v-for="item in pageData.list " :key="item.id">
<printer-item :data="item"></printer-item>
</div>
<view v-if="!pageData.list.length&&pageData.hasAjax">
<my-img-empty ></my-img-empty>
</view>
<view style="height: 100rpx;"></view>
<view class="fixed_b u-fixed">
<my-button shape="circle" @tap="toAdd">
<view>
<text>+</text>
<text>添加云打印机</text>
</view>
</my-button>
</view>
</view>
</template>
<script setup>
import go from '@/commons/utils/go.js'
import {
onMounted,
reactive
} from 'vue';
import printerItem from './components/printer-item.vue';
import * as Api from '@/http/yskApi/devices.js'
const pageData = reactive({
list: [],
hasAjax:false,
query: {
sort: '',
name: '',
contentType: ''
}
})
function toAdd(){
go.to('PAGES_PRINTER_ADD',{
a:1
})
}
async function init() {
const res =await Api.tbPrintMachineGet(pageData.query)
pageData.hasAjax=true
console.log(res);
pageData.list = res.filter(v=>v.address)
}
onMounted(() => {
init()
})
</script>
<style lang="scss" scoped>
.fixed_b{
left: 110rpx;
right: 110rpx;
bottom: calc(env(safe-area-inset-bottom) + 10rpx);
/* #ifdef H5 */
bottom: 30rpx;
/* #endif */
}
</style>