This commit is contained in:
2024-09-10 10:49:08 +08:00
parent b5fd06b800
commit dd4f5938da
6391 changed files with 722800 additions and 0 deletions

View File

@@ -0,0 +1,216 @@
<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-24 u-m-b-24 border-bottom">
<view class="title">设备尺寸</view>
<view class="u-m-t-16">
<radio-group class="u-flex u-flex-wrap" @change="sizeChange">
<label class="radio u-m-r-60" v-for="(item,index) in deciveSize.list" :key="index">
<radio :value="''+index" :checked="index === deciveSize.selIndex" class="scale7" />
<text>{{item.label}}</text>
</label>
</radio-group>
</view>
</view>
<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-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>
<picker-item title="打印份数" v-model="printerNums.selIndex" rangeKey="label"
:list="printerNums.list"></picker-item>
<picker-item title="出品模式" v-model="form.config.model" rangeKey="name" rangeValue="value"
:list="models"></picker-item>
<picker-item title="打印类型" v-model="form.subType" rangeKey="name" rangeValue="value"
:list="subTypes"></picker-item>
<picker-item title="尾部留空"
v-model="form.config.feet" rangeKey="name" rangeValue="value"
:list="feets"></picker-item>
<view class="u-p-b-24 u-flex u-row-between u-m-b-24 border-bottom">
<view class="title">自动切刀</view>
<view class="">
<my-switch v-model="form.config.autoCut"></my-switch>
</view>
</view>
<view class="u-p-b-24 u-flex u-row-between u-m-b-24 border-bottom">
<view class="title">状态</view>
<view class="">
<my-switch v-model="form.config.autoCut"></my-switch>
</view>
</view>
<view class="u-p-b-24 u-flex u-row-between u-m-b-24 border-bottom">
<view class="title">排序</view>
<view class="">
<uni-number-box v-model="form.sort" ></uni-number-box>
</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 './components/picker-item.vue';
import myRadioGroup from './components/my-radio-group.vue';
import * as Api from '@/http/yskApi/devices.js'
import chooseCategory from './components/choose-category.vue';
//选择分类
let chooseCategoryShow=ref(false)
function categoryShow(){
chooseCategoryShow.value=true
}
//品牌
const brands = reactive({
list: devices,
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,46 @@
<template>
<my-mask :show="modelValue">
<view class="bg-fff content">
<view class="u-flex u-row-between u-p-30">
<view>选择分类</view>
<view>
<uni-icons @click="changeShow" type="closeempty"></uni-icons>
</view>
</view>
<scroll-view scroll-y="true" style="height: 70vh;">
</scroll-view>
<view class="u-flex u-row-between gap-20 u-p-30">
<view class="u-flex-1">
<my-button type="cancel" @tap="changeShow">取消</my-button>
</view>
<view class="u-flex-1">
<my-button>确定</my-button>
</view>
</view>
</view>
</my-mask>
</template>
<script setup>
const props=defineProps({
modelValue:{
type: Boolean,
default: false
}
})
const emits=defineEmits(['update:modelValue'])
function changeShow(isShow){
const show=isShow?true:false
emits('update:modelValue',show)
}
</script>
<style lang="scss" scoped>
.content{
position: absolute;
bottom: 0;
left: 0;
right: 0;
}
</style>

View File

@@ -0,0 +1,70 @@
<template>
<radio-group class="u-flex u-flex-wrap" @change="change">
<label class="radio u-m-r-60" v-for="(item,itemIndex) in list" :key="index">
<radio :value="index" :checked="itemChecked(item,itemIndex)" class="scale7" />
<text>{{item.label}}</text>
</label>
</radio-group>
</template>
<script setup>
import {
computed,
ref,
watch
} from 'vue';
const props = defineProps({
rangeValue: {
type: [String, Number],
default: ''
},
rangeKey: {
type: String,
default: 'label'
},
list: {
type: Array,
default: () => []
},
title: {
type: String,
default: '标题'
},
modelValue: {
type: [String, Number],
default: ''
}
})
function itemChecked(item,itemIndex){
if(!props.rangeValue){
return itemIndex==index.value
}
return item[props.rangeValue]=props.list[index.value][props.rangeKey]
}
function findIndex() {
return props.list.findIndex(v => v[props.rangeValue] == props.modelValue)
}
function findValue() {
return props.list[index.value][props.rangeValue]
}
const computedIndex = props.rangeValue ? findIndex() : props.modelValue
const index = ref(computedIndex)
const emits = defineEmits(['update:modelValue'], )
watch(() => index.value, (newval) => {
const value = props.rangeValue ? findValue() : newval
console.log(value);
emits('update:modelValue', value)
})
function change(e) {
index.value = e.detail.value
}
const selText = computed(() => {
const item = props.list[index.value]
return item ? item[props.rangeKey] : ''
})
</script>
<style>
</style>

View File

@@ -0,0 +1,87 @@
<template>
<view class="u-p-b-24 u-m-b-24 border-bottom">
<view class="title font-bold">{{title}}</view>
<picker
@change="change"
:range-key="rangeKey"
:value="index"
:range="list">
<view class="u-m-t-16 u-flex u-row-between ">
<view class="color-333" v-if="selText">{{selText}}</view>
<view class="color-999" v-else>请选择</view>
<uni-icons type="right" color="#999" size="16"></uni-icons>
</view>
</picker>
</view>
</template>
<script setup>
import {
computed,
ref, watch
} from 'vue';
const props = defineProps({
rangeValue:{
type: [String, Number],
default: ''
},
rangeKey:{
type:String,
default:'label'
},
list: {
type: Array,
default: () => []
},
title: {
type: String,
default: '标题'
},
modelValue: {
type: [String, Number],
default: ''
}
})
function isObj(obj){
return typeof obj ==='object'
}
function findIndex(){
return props.list.findIndex(v=>{
if(isObj(v)){
return v[props.rangeValue]==props.modelValue
}else{
return v==props.modelValue
}
})
}
function findValue(){
const item=props.list[index.value]
if(isObj(item)){
return item[props.rangeValue]
}else{
return item
}
}
const computedIndex=props.rangeValue? findIndex(): props.modelValue
const index = ref(computedIndex)
const emits = defineEmits(['update:modelValue'], )
watch(()=>index.value,(newval)=>{
const value=props.rangeValue?findValue() :newval
console.log(value);
emits('update:modelValue',value)
})
function change(e){
index.value=e.detail.value
}
const selText=computed(()=>{
const item=props.list[index.value]
if(item&&isObj(item)){
return item?item[props.rangeKey]:''
}else{
return item
}
})
</script>
<style>
</style>

44
pagePrinter/devices.js Normal file
View File

@@ -0,0 +1,44 @@
export const devices = [
{
value: 'printer',
name: '本地'
},
{
value: 'yxyPrinter',
name: '云想印'
},
{
value: 'fePrinter',
name: '飞鹅'
}
]
export const models = [
{
value: 'normal',
name: '普通出单'
},
{
value: 'one',
name: '一菜一品'
},
{
value: 'category',
name: '分类出单'
}
]
export const subTypes = [
{
value: 'kitchen',
name: '出品'
},
{
value: 'cash',
name: '小票'
},
{
value: 'label',
name: '标签'
}
]

View File

@@ -0,0 +1,106 @@
<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>
{{modelsName(data.config.model)}}
</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 shape="circle" :width="140" :height="56" type="cancel" plain>删除</my-button>
<my-button shape="circle" :width="140" :height="56" plain>编辑</my-button>
</view>
</view>
</view>
</template>
<script setup>
import { devices, models, subTypes } from '@/pagePrinter/devices.js'
const props = defineProps({
data: {
type: Object,
default: () => {}
}
})
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')
}
</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,63 @@
<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>

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="12" height="12" viewBox="0 0 12 12"><defs><style>.a{fill:#ebd4d4;}.b{clip-path:url(#a);}.c{fill:#666;}</style><clipPath id="a"><circle class="a" cx="6" cy="6" r="6" transform="translate(94 212)"/></clipPath></defs><g class="b" transform="translate(-94 -212)"><path class="c" d="M71.825,64a.672.672,0,0,1,.711.711v.711h.711a.672.672,0,0,1,.711.711v4.98a.672.672,0,0,1-.711.711h-.711v1.423a.672.672,0,0,1-.711.711H66.134a.672.672,0,0,1-.711-.711V71.825h-.711A.672.672,0,0,1,64,71.114v-4.98a.672.672,0,0,1,.711-.711h.711v-.711A.672.672,0,0,1,66.134,64Zm0,5.691H66.134v3.557h5.691Zm1.423-3.557H64.711v4.98h.711V69.691a.672.672,0,0,1,.711-.711h5.691a.672.672,0,0,1,.711.711v1.423h.711Zm-.711.711v.711h-.711v-.711Zm-.711-2.134H66.134v.711h5.691Z" transform="translate(31.02 149.02)"/></g></svg>

After

Width:  |  Height:  |  Size: 878 B

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="12" height="12" viewBox="0 0 12 12"><defs><style>.a{fill:#ebd4d4;}.b{clip-path:url(#a);}.c{fill:#666;}</style><clipPath id="a"><circle class="a" cx="6" cy="6" r="6" transform="translate(107 189)"/></clipPath></defs><g class="b" transform="translate(-107 -189)"><path class="c" d="M11.347,4.3c-.067-.354-.283-.583-.551-.583h-.058a1.4,1.4,0,0,1-1.4-1.4,1.6,1.6,0,0,1,.122-.535.736.736,0,0,0-.248-.89L9.192.875,7.77.085,7.752.077a.751.751,0,0,0-.3-.061.814.814,0,0,0-.579.236A2.054,2.054,0,0,1,5.764.873,2.058,2.058,0,0,1,4.648.241.814.814,0,0,0,4.065,0a.75.75,0,0,0-.3.059L3.751.066,2.279.875,2.261.887a.735.735,0,0,0-.25.889,1.585,1.585,0,0,1,.123.536,1.4,1.4,0,0,1-1.4,1.4H.672c-.267,0-.483.229-.55.583A7.288,7.288,0,0,0,0,5.421a7.287,7.287,0,0,0,.12,1.123c.067.354.283.583.551.583H.731a1.4,1.4,0,0,1,1.4,1.4,1.6,1.6,0,0,1-.122.535.737.737,0,0,0,.248.89l.017.012,1.4.78.018.008a.742.742,0,0,0,.3.061.8.8,0,0,0,.583-.246A2.053,2.053,0,0,1,5.7,9.91a2.071,2.071,0,0,1,1.14.673.8.8,0,0,0,.587.251h0a.741.741,0,0,0,.3-.059l.018-.008,1.446-.8.017-.012a.736.736,0,0,0,.249-.889,1.614,1.614,0,0,1-.123-.536,1.4,1.4,0,0,1,1.4-1.4H10.8c.268,0,.484-.229.551-.583a7.223,7.223,0,0,0,.12-1.123A7.259,7.259,0,0,0,11.347,4.3ZM4,10.006l-1.22-.682A2.331,2.331,0,0,0,2.94,8.53,2.208,2.208,0,0,0,.9,6.328a6.122,6.122,0,0,1-.094-.906A6.136,6.136,0,0,1,.9,4.515a2.207,2.207,0,0,0,2.038-2.2,2.33,2.33,0,0,0-.163-.792l1.3-.713h0a3.876,3.876,0,0,0,.493.418,2.1,2.1,0,0,0,1.2.454A2.106,2.106,0,0,0,6.95,1.234a3.857,3.857,0,0,0,.49-.41h0l1.252.7a2.332,2.332,0,0,0-.163.793,2.207,2.207,0,0,0,2.038,2.2,6.154,6.154,0,0,1,.094.907,6.13,6.13,0,0,1-.094.907,2.207,2.207,0,0,0-2.038,2.2,2.329,2.329,0,0,0,.163.793l-1.267.7a3.935,3.935,0,0,0-.495-.437A2.1,2.1,0,0,0,5.7,9.1a2.1,2.1,0,0,0-1.216.473A3.966,3.966,0,0,0,4,10.006ZM7.74,5.414a2.03,2.03,0,1,0-2.03,2.03A2.033,2.033,0,0,0,7.74,5.414ZM5.71,4.189A1.225,1.225,0,1,1,4.485,5.414,1.226,1.226,0,0,1,5.71,4.189Z" transform="translate(107.266 189.583)"/></g></svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="12" height="12" viewBox="0 0 12 12"><defs><style>.a{fill:#ebd4d4;}.b{clip-path:url(#a);}.c{fill:#666;}</style><clipPath id="a"><circle class="a" cx="6" cy="6" r="6" transform="translate(92 207)"/></clipPath></defs><g class="b" transform="translate(-92 -207)"><g transform="translate(8.104 122.991)"><path class="c" d="M94.819,87.957,90.794,89.44a1.178,1.178,0,0,1-.8,0L85.816,87.96a.738.738,0,0,1,0-1.4l4.179-1.485a1.177,1.177,0,0,1,.8,0l4.025,1.483a.738.738,0,0,1,0,1.392Zm-.262-.713-4.025-1.483a.42.42,0,0,0-.284,0l-4.179,1.485a.014.014,0,0,0-.012.017.014.014,0,0,0,.012.017l4.179,1.485a.417.417,0,0,0,.284,0l4.025-1.483a.014.014,0,0,0,.012-.016.014.014,0,0,0-.012-.018Zm-8.742,5.4,4.421,1.6a.457.457,0,0,0,.315,0l4.259-1.6a.37.37,0,1,1,.262.692l-4.259,1.6a1.208,1.208,0,0,1-.422.076,1.2,1.2,0,0,1-.409-.072l-4.422-1.6a.37.37,0,1,1,.254-.695Z" transform="translate(-0.414)"/><path class="c" d="M89.978,501.885a1.2,1.2,0,0,1-.409-.072l-4.422-1.6a.37.37,0,1,1,.253-.7l4.421,1.6a.459.459,0,0,0,.315,0l4.259-1.6a.37.37,0,0,1,.262.692l-4.259,1.6a1.2,1.2,0,0,1-.421.077Z" transform="translate(0 -409.627)"/></g></g></svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="17.37" height="15" viewBox="0 0 17.37 15"><defs><style>.a{fill:#ff9f2e;}</style></defs><path class="a" d="M104.051,176.877h17.37l-8.684-15Zm9.474-2.369h-1.579V172.93h1.579Zm0-3.157h-1.579v-3.158h1.579Z" transform="translate(-104.051 -161.877)"/></svg>

After

Width:  |  Height:  |  Size: 298 B