同步代码

This commit is contained in:
GaoHao
2025-02-07 14:49:20 +08:00
commit 0740c3f349
1141 changed files with 167372 additions and 0 deletions

View File

@@ -0,0 +1,154 @@
<template>
<view class="default-box-padding bg-fff u-font-28 border-r-12 box-shadow u-m-b-30">
<view class="u-flex u-row-between u-p-b-24 border-bottom">
<view class="u-flex">
<!-- <text>{{ subTypesName(data.subType)}}</text> -->
<text>{{ data.name}}</text>
<text class="color-999 u-font-24">{{data.address}}</text>
</view>
<view class="u-flex u-col-center">
<template v-if="data.status">
<text class="online">在线状态正常</text>
</template>
<template v-else>
<image class="icon-warning" src="/pagePrinter/static/icon/icon-warning.svg" mode=""></image>
<text class="leave u-m-l-10">离线</text>
</template>
</view>
</view>
<view class="u-m-t-24">
<view class="u-flex u-row-between">
<view class="u-flex u-col-center">
<image class="icon" src="/pagePrinter/static/icon/icon-setting.svg" mode=""></image>
<view class="color-666 u-m-l-10">是否启用</view>
</view>
<view>
<my-switch v-model="data.status" @change="openDiscountChange"></my-switch>
</view>
</view>
<view class="u-flex u-row-between u-m-t-32">
<view class="u-flex u-col-center">
<image class="icon" src="/pagePrinter/static/icon/icon-type.svg" mode=""></image>
<view class="color-666 u-m-l-10">类型</view>
</view>
<view>
{{subTypesName(data.subType)}}
</view>
</view>
<view class="u-flex u-row-between u-m-t-32">
<view class="u-flex u-col-center">
<image class="icon" src="/pagePrinter/static/icon/icon-category.svg" mode=""></image>
<view class="color-666 u-m-l-10">分类</view>
</view>
<view>
{{devicesName(data.contentType)}}
</view>
</view>
<view class="u-m-t-32 u-flex u-row-right gap-20">
<my-button v-if="data.connectionType == 'network'" shape="circle" :width="140" :height="56"
type="cancel" @tap="delTableHandleEvent()" plain>删除</my-button>
<my-button v-if="data.connectionType == 'network'" shape="circle" @click="toUrl" :width="140"
:height="56" plain>编辑</my-button>
</view>
</view>
<!-- 删除弹窗 -->
<my-model desc="确认删除?" ref="delModel" @confirm="delModelConfirm"></my-model>
</view>
</template>
<script setup>
import {
devices,
models,
subTypes
} from '@/pagePrinter/devices.js'
import go from '@/commons/utils/go.js'
import {
shopConfigprinter,
delTableHandle
} from '@/http/yskApi/devices.js'
import {
getCurrentInstance
} from 'vue';
const props = defineProps({
data: {
type: Object,
default: () => {}
}
})
const emit = defineEmits(['init'])
let toUrl = () => {
go.to('PAGES_PRINTER_ADD', {
id: props.data.id
})
}
function devicesName(value) {
return devices.find(item => item.value == value).name
}
function modelsName(value) {
return models.find(item => item.value == value).name
}
function subTypesName(value) {
return subTypes.find(item => item.value == value).name
}
function timeFilter(s) {
return dayjs(s).format('YYYY-MM-DD HH:mm:ss')
}
async function openDiscountChange(d) {
delete props.data.createdAt
delete props.data.updatedAt
const res = await shopConfigprinter({
...props.data,
shopId: uni.getStorageSync('shopId'),
})
emit('init', '')
}
const refs = getCurrentInstance()
// 删除
function delTableHandleEvent() {
refs.ctx.$refs.delModel.open()
}
//删除分类确认
async function delModelConfirm() {
const res = await delTableHandle(props.data.id)
emit('init', '')
refs.ctx.$refs.delModel.close()
}
</script>
<style lang="scss" scoped>
.border-bottom {
border-bottom: 1px solid rgb(240, 240, 240);
}
.box-shadow {
box-shadow: 0 0 5px #eee;
}
.online {
color: #0FC161;
}
.leave {
color: #999;
}
.icon-warning {
width: 34rpx;
height: 30rpx;
}
.icon {
width: 24rpx;
height: 24rpx;
}
</style>

View File

@@ -0,0 +1,175 @@
<template>
<view class="page-gray color-333 u-font-28">
<view class="block">
<picker-item title="打印机类型" v-model="brands.selIndex" rangeKey="name" :list="brands.list"></picker-item>
<view class="u-p-b-14 u-m-b-24 border-bottom">
<view class="title">设备号</view>
<view class="">
<uni-easyinput :inputBorder="false" :padding-none="true" v-model="form.form"
placeholder="输入设备号"></uni-easyinput>
</view>
</view>
<view class="u-p-b-24 u-m-b-24 border-bottom">
<view class="title font-bold">商品分类</view>
<view class="u-m-t-16 u-flex u-row-between " @click="categoryShow">
<view class="color-333" v-if="form.sort">{{form.sort}}</view>
<view class="color-999" v-else>请选择</view>
<uni-icons type="right" color="#999" size="16"></uni-icons>
</view>
</view>
</view>
<view style="height: 60rpx;"></view>
<view class="">
<view class="btn">
<my-button shape="circle" @click="save">保存</my-button>
</view>
</view>
<!-- 选择分类 -->
<choose-category v-model="chooseCategoryShow"></choose-category>
</view>
</template>
<script setup>
import {
devices,
models,
subTypes
} from '@/pagePrinter/devices.js'
import {
onLoad,
onShow
} from '@dcloudio/uni-app'
import {
ref,
onBeforeUnmount,
reactive,
computed,
watch
} from 'vue';
import go from '@/commons/utils/go.js';
import pickerItem from '../add-printer/components/picker-item.vue'
import myRadioGroup from '../add-printer/components/my-radio-group.vue';
import * as Api from '@/http/yskApi/devices.js'
import chooseCategory from '../add-printer/components/choose-category.vue';
//选择分类
let chooseCategoryShow = ref(false)
function categoryShow() {
chooseCategoryShow.value = true
}
//品牌
const brands = reactive({
list: devices,
brand:brand,
selIndex: '',
})
//设备尺寸
const deciveSize = reactive({
list: [{
label: '58mm',
value: '0'
},
{
label: '80mm',
value: '1'
},
],
selIndex: 1
})
function sizeChange(e) {
deciveSize.selIndex = e.detail.value
}
//打印份数
const printerNums = reactive({
list: new Array(4).fill(1).map((v, index) => {
return {
label: index * 1 + 1 + '份',
value: '' + index
}
}),
selIndex: 0
})
//尾部留空
const feets = ref([0, 1, 2, 3, 4, 5, 8].map(v => {
return v + '行'
}))
const form = reactive({
id: '',
contentType: '',
config: {
width: '80mm', // 设备尺寸
printerNum: 1, //打印份数
categoryList: '', // 商品分类
model: 'normal', // 出品模式,
feet: '0',
autoCut: 0
},
name: '',
subType: 'kitchen', // 打印类型
status: 0,
sort: ''
})
function save() {
}
watch(() => form.config.model, (newval) => {
console.log(newval);
})
const option = reactive({})
onLoad((opt) => {
console.log(opt);
Object.assign(option, opt)
})
onBeforeUnmount(() => {
})
onShow(() => {})
</script>
<style lang="scss" scoped>
.page-gray {
padding: 32rpx 28rpx;
}
.block {
background-color: #fff;
padding: 32rpx 24rpx;
border-radius: 18rpx;
margin-bottom: 32rpx;
box-shadow: 0 0 5px #eee;
}
.title {
font-weight: 700;
}
.radio {
display: flex;
align-items: center;
}
.fixed_b {
left: 30rpx;
right: 30rpx;
bottom: calc(env(safe-area-inset-bottom) + 10rpx);
/* #ifdef H5 */
bottom: 30rpx;
/* #endif */
}
</style>

View File

@@ -0,0 +1,69 @@
<template>
<view class="min-page bg-gray u-p-30 u-flex u-flex-col ">
<div class="w-full" v-for="item in pageData.list " :key="item.id">
<printer-item :data="item" @init='init'></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 {
onShow,
} from '@dcloudio/uni-app'
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
pageData.list = res
// pageData.list = res.filter(v=>v.address)
}
onShow(()=>{
init()
})
// 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>