打印机部分类型

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,19 +1,19 @@
import http from './http.js' import http from './http.js'
const request=http.request const request = http.request
/** /**
* 增加打印机 * 增加打印机
* @returns * @returns
*/ */
export function tbPrintMachine(data, method = 'post') { export function tbPrintMachine(data, method = 'post') {
return request({ return request({
url: '/api/shop-config/printer', url: '/api/shop-config/printer',
method: method, method: method,
data: { data: {
shopId: uni.getStorageSync('shopId'), shopId: uni.getStorageSync('shopId'),
...data ...data
} }
}) })
} }
/** /**
@ -21,37 +21,46 @@ export function tbPrintMachine(data, method = 'post') {
* @returns * @returns
*/ */
export function tbPrintMachineGet(params) { export function tbPrintMachineGet(params) {
return request({ return request({
url: '/api/shop-config/printer/list', url: '/api/shop-config/printer/list',
method: 'get', method: 'get',
params: { params: {
shopId: uni.getStorageSync('shopId'), shopId: uni.getStorageSync('shopId'),
sort: '', sort: '',
...params ...params
} }
}) })
}
// 打印机部分
export function tbShopCategoryget(params) {
return request({
url: '/api/tbShopCategory',
method: 'get',
params
})
} }
// 修改打印机状态 // 修改打印机状态
export function shopConfigprinter(data) { export function shopConfigprinter(data) {
return request({ return request({
url: '/api/shop-config/printer/update-status', url: '/api/shop-config/printer/update-status',
method: 'post', method: 'post',
data data
}) })
} }
// * 打印机详情 // * 打印机详情
export function printerd(id) { export function printerd(id) {
return request({ return request({
url: '/api/shop-config/printer/' + id, url: '/api/shop-config/printer/' + id,
method: 'get', method: 'get',
}) })
} }
// 删除 // 删除
export function delTableHandle(id) { export function delTableHandle(id) {
return request({ return request({
url: '/api/shop-config/printer/' + id, url: '/api/shop-config/printer/' + id,
method: 'DELETE', method: 'DELETE',
}) })
} }

View File

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

View File

@ -1,19 +1,19 @@
<template> <template>
<view class="page-gray color-333 u-font-28"> <view class="page-gray color-333 u-font-28">
<view class="block"> <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> :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> :list="receipt.list"></picker-item>
<view class="u-p-b-14 u-m-b-24 border-bottom"> <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=""> <view class="">
<uni-easyinput :inputBorder="false" :padding-none="true" v-model="form.name" <uni-easyinput :inputBorder="false" :padding-none="true" v-model="form.name"
placeholder="设置打印机名称"></uni-easyinput> placeholder="设置打印机名称"></uni-easyinput>
</view> </view>
</view> </view>
<view class="u-p-b-14 u-m-b-24 border-bottom"> <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=""> <view class="">
<uni-easyinput :inputBorder="false" :padding-none="true" v-model="form.address" <uni-easyinput :inputBorder="false" :padding-none="true" v-model="form.address"
placeholder="设置打印机名称"></uni-easyinput> placeholder="设置打印机名称"></uni-easyinput>
@ -23,7 +23,7 @@
<view class="title">打印机密钥</view> <view class="title">打印机密钥</view>
<view class=""> <view class="">
<uni-easyinput :inputBorder="false" :padding-none="true" v-model="form.port" <uni-easyinput :inputBorder="false" :padding-none="true" v-model="form.port"
placeholder="设置打印机名称"></uni-easyinput> placeholder="设置打印机密钥"></uni-easyinput>
</view> </view>
</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">
@ -60,7 +60,17 @@
</radio-group> </radio-group>
</view> </view>
</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" 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="title">桌台打印</view>
<view class="u-m-t-16"> <view class="u-m-t-16">
<radio-group class="u-flex u-flex-wrap" @change="sizeChange($event,'tablePrint')"> <radio-group class="u-flex u-flex-wrap" @change="sizeChange($event,'tablePrint')">
@ -103,34 +113,38 @@
<view class="u-m-t-16"> <view class="u-m-t-16">
<radio-group class="u-flex u-flex-wrap" @change="sizeChange($event,'printMethod')"> <radio-group class="u-flex u-flex-wrap" @change="sizeChange($event,'printMethod')">
<label class="radio u-m-r-60"> <label class="radio u-m-r-60">
<radio value="1" :checked="form.printMethod == '1'" class="scale7" /> <radio value="normal" :checked="form.printMethod == '1'" class="scale7" />
<text>普通</text> <text>普通出菜</text>
</label> </label>
<label class="radio u-m-r-60"> <label class="radio u-m-r-60">
<radio value="2" :checked="form.printMethod == '2'" class="scale7" /> <radio value="one" :checked="form.printMethod == '2'" class="scale7" />
<text>单个菜</text> <text>一菜一品</text>
</label>
<label class="radio u-m-r-60">
<radio value="callTicket" :checked="form.printMethod == '2'" class="scale7" />
<text>排队取号</text>
</label> </label>
</radio-group> </radio-group>
</view> </view>
</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="title">打印类型</view>
<view class="u-m-t-16" style="display: flex;"> <view class="u-m-t-16" style="display: flex;">
<up-checkbox-group v-model="form.printType"> <up-checkbox-group v-model="form.printType">
<up-checkbox :customStyle="{marginBottom: '8px'}" label="确认退款单" name="1" <up-checkbox :customStyle="{marginBottom: '8px'}" label="确认退款单" name="1"
style="margin-right: 40rpx;font-size: 28rpx;"> style="margin-right: 40rpx;font-size: 28rpx;">
</up-checkbox> </up-checkbox>
<up-checkbox :customStyle="{marginBottom: '8px'}" label="交班单" name="2" <up-checkbox :customStyle="{marginBottom: '8px'}" label="交班单" name="2"
style="margin-right: 40rpx;font-size: 28rpx;"> style="margin-right: 40rpx;font-size: 28rpx;">
</up-checkbox> </up-checkbox>
<up-checkbox :customStyle="{marginBottom: '8px'}" label="排队取号" name="3" <up-checkbox :customStyle="{marginBottom: '8px'}" label="排队取号" name="3"
style="margin-right: 40rpx;font-size: 28rpx;"> style="margin-right: 40rpx;font-size: 28rpx;">
</up-checkbox> </up-checkbox>
</up-checkbox-group> </up-checkbox-group>
</view> </view>
</view> </view> -->
@ -197,7 +211,7 @@
models, models,
subTypes, subTypes,
brand, brand,
receipts receipts,
} from '@/pagePrinter/devices.js' } from '@/pagePrinter/devices.js'
import { import {
onLoad, onLoad,
@ -208,7 +222,10 @@
onBeforeUnmount, onBeforeUnmount,
reactive, reactive,
computed, computed,
watch watch,
onMounted,
toRef
} from 'vue'; } from 'vue';
import go from '@/commons/utils/go.js'; import go from '@/commons/utils/go.js';
import pickerItem from './components/picker-item.vue'; import pickerItem from './components/picker-item.vue';
@ -238,7 +255,7 @@
list: devices, list: devices,
selIndex: '', selIndex: '',
}) })
let partList = ref([])
// //
const deciveSize = reactive({ const deciveSize = reactive({
list: [{ list: [{
@ -252,6 +269,34 @@
], ],
selIndex: 1 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) { function sizeChange(e, name) {
form[name] = e.detail.value form[name] = e.detail.value
@ -277,13 +322,24 @@
status: 0, status: 0,
connectionType: "network", connectionType: "network",
printType: [], printType: [],
name: '' name: '',
}) })
async function save() { 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) { if (userId.value) {
delete form.createdAt delete form.createdAt
delete form.updatedAt delete form.updatedAt
const res = await Api.tbPrintMachine({ const res = await Api.tbPrintMachine({
...form ...form
}, 'put') }, 'put')
@ -302,8 +358,13 @@
// const option = reactive({}) // const option = reactive({})
async function getdetails() { async function getdetails() {
const res = await Api.printerd(userId.value) 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 = Object.assign(form, res)
form.printType = JSON.parse(res.printType)
} }
onLoad((options) => { onLoad((options) => {
if (options.id) { if (options.id) {

View File

@ -1,6 +1,6 @@
<template> <template>
<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 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"> <picker @change="change" range-key="name" :value="value" :range="list">
<view class="u-m-t-16 u-flex u-row-between "> <view class="u-m-t-16 u-flex u-row-between ">
<view class="color-333" v-if="selText">{{selText}}</view> <view class="color-333" v-if="selText">{{selText}}</view>
@ -28,6 +28,9 @@
}, },
modelValue: { modelValue: {
type: String, type: String,
},
required:{
type:Boolean
} }
}) })
const index = ref(props.modelValue) const index = ref(props.modelValue)