打印机部分类型

This commit is contained in:
duan 2024-10-11 18:25:37 +08:00
parent 82ad5973fb
commit b8e694abb9
4 changed files with 143 additions and 68 deletions

View File

@ -1,5 +1,5 @@
import http from './http.js'
const request=http.request
const request = http.request
/**
* 增加打印机
@ -31,6 +31,15 @@ export function tbPrintMachineGet(params) {
}
})
}
// 打印机部分
export function tbShopCategoryget(params) {
return request({
url: '/api/tbShopCategory',
method: 'get',
params
})
}
// 修改打印机状态
export function shopConfigprinter(data) {
return request({

View File

@ -190,7 +190,9 @@
viewConInfoFlowget({
shopId: uni.getStorageSync("shopId"),
conName: datas.conName,
conTypeId: d
conTypeId: d,
size:100,
page:0
}).then(res => {
datas.list = res.content
})

View File

@ -1,19 +1,19 @@
<template>
<view class="page-gray color-333 u-font-28">
<view class="block">
<picker-item title="打印机品牌" v-model="form.contentType" :modelValue="form.contentType"
<picker-item title="打印机品牌" required v-model="form.contentType" :modelValue="form.contentType"
:list="brandt.list"></picker-item>
<picker-item title="小票打印" v-model="form.subType" :modelValue="form.subType"
<picker-item title="小票打印" required v-model="form.subType" :modelValue="form.subType"
:list="receipt.list"></picker-item>
<view class="u-p-b-14 u-m-b-24 border-bottom">
<view class="title">打印机名称</view>
<view class="title"><span style="color: red;">*</span>打印机名称</view>
<view class="">
<uni-easyinput :inputBorder="false" :padding-none="true" v-model="form.name"
placeholder="设置打印机名称"></uni-easyinput>
</view>
</view>
<view class="u-p-b-14 u-m-b-24 border-bottom">
<view class="title">打印机编号</view>
<view class="title"><span style="color: red;">*</span>打印机编号</view>
<view class="">
<uni-easyinput :inputBorder="false" :padding-none="true" v-model="form.address"
placeholder="设置打印机名称"></uni-easyinput>
@ -23,7 +23,7 @@
<view class="title">打印机密钥</view>
<view class="">
<uni-easyinput :inputBorder="false" :padding-none="true" v-model="form.port"
placeholder="设置打印机名称"></uni-easyinput>
placeholder="设置打印机密钥"></uni-easyinput>
</view>
</view>
<view class="u-p-b-24 u-m-b-24 border-bottom">
@ -60,6 +60,16 @@
</radio-group>
</view>
</view>
<view class="u-p-b-24 u-m-b-24 border-bottom" v-if="form.classifyPrint ==1">
<view class="title">部分打印</view>
<view class="u-m-t-16" style="display: flex;">
<up-checkbox-group v-model="form.selectcheckbox">
<up-checkbox v-for="item in partList" :key="item.id" :customStyle="{marginBottom: '8px'}"
:label="item.name" :name="item.id" style="margin-right: 40rpx;font-size: 28rpx;">
</up-checkbox>
</up-checkbox-group>
</view>
</view>
<!-- <view class="u-p-b-24 u-m-b-24 border-bottom">
<view class="title">桌台打印</view>
<view class="u-m-t-16">
@ -103,19 +113,23 @@
<view class="u-m-t-16">
<radio-group class="u-flex u-flex-wrap" @change="sizeChange($event,'printMethod')">
<label class="radio u-m-r-60">
<radio value="1" :checked="form.printMethod == '1'" class="scale7" />
<text>普通</text>
<radio value="normal" :checked="form.printMethod == '1'" class="scale7" />
<text>普通出菜</text>
</label>
<label class="radio u-m-r-60">
<radio value="2" :checked="form.printMethod == '2'" class="scale7" />
<text>单个菜</text>
<radio value="one" :checked="form.printMethod == '2'" class="scale7" />
<text>一菜一品</text>
</label>
<label class="radio u-m-r-60">
<radio value="callTicket" :checked="form.printMethod == '2'" class="scale7" />
<text>排队取号</text>
</label>
</radio-group>
</view>
</view>
<view class="u-p-b-24 u-m-b-24 border-bottom">
<!-- <view class="u-p-b-24 u-m-b-24 border-bottom">
<view class="title">打印类型</view>
<view class="u-m-t-16" style="display: flex;">
<up-checkbox-group v-model="form.printType">
@ -130,7 +144,7 @@
</up-checkbox>
</up-checkbox-group>
</view>
</view>
</view> -->
@ -197,7 +211,7 @@
models,
subTypes,
brand,
receipts
receipts,
} from '@/pagePrinter/devices.js'
import {
onLoad,
@ -208,7 +222,10 @@
onBeforeUnmount,
reactive,
computed,
watch
watch,
onMounted,
toRef
} from 'vue';
import go from '@/commons/utils/go.js';
import pickerItem from './components/picker-item.vue';
@ -238,7 +255,7 @@
list: devices,
selIndex: '',
})
let partList = ref([])
//
const deciveSize = reactive({
list: [{
@ -252,6 +269,34 @@
],
selIndex: 1
})
onMounted(() => {
getlist()
})
let getlist = async () => {
const res = await Api.tbShopCategoryget({
shopId: uni.getStorageSync("shopId"),
sort: "sort,desc",
page: 0,
size: 500
})
let arr = []
res.content.forEach(ele => {
arr.push({
id: ele.id,
name: ele.name
})
if (ele.childrenList.length > 0) {
ele.childrenList.forEach(element => {
arr.push({
id: element.id,
name: element.name
})
})
}
})
partList.value = arr
}
function sizeChange(e, name) {
form[name] = e.detail.value
@ -277,10 +322,21 @@
status: 0,
connectionType: "network",
printType: [],
name: ''
name: '',
})
async function save() {
//
if (form.classifyPrint == 1) {
let idstr = ''
let arr = []
console.log(form.selectcheckbox, '提交')
form.selectcheckbox.forEach(element => {
idstr += element + ','
arr.push(partList.value.filter(ele => ele.id == element)[0])
})
form.categoryIds = idstr.substring(0, idstr.length - 1)
form.categoryList = JSON.stringify(arr)
}
if (userId.value) {
delete form.createdAt
delete form.updatedAt
@ -302,8 +358,13 @@
// const option = reactive({})
async function getdetails() {
const res = await Api.printerd(userId.value)
let arr = res.categoryIds.split(',')
let arrs = []
arr.forEach(eles => {
arrs.push(eles * 1)
})
res.selectcheckbox = arrs
form = Object.assign(form, res)
form.printType = JSON.parse(res.printType)
}
onLoad((options) => {
if (options.id) {

View File

@ -1,6 +1,6 @@
<template>
<view class="u-p-b-24 u-m-b-24 border-bottom">
<view class="title font-bold">{{title}}</view>
<view class="title font-bold"> <text v-if="required" style="color: red;">*</text>{{title}}</view>
<picker @change="change" range-key="name" :value="value" :range="list">
<view class="u-m-t-16 u-flex u-row-between ">
<view class="color-333" v-if="selText">{{selText}}</view>
@ -28,6 +28,9 @@
},
modelValue: {
type: String,
},
required:{
type:Boolean
}
})
const index = ref(props.modelValue)