1 Commits

Author SHA1 Message Date
b93429ed99 打印机设置修改 2026-04-27 16:53:23 +08:00
3 changed files with 621 additions and 136 deletions

View File

@@ -0,0 +1,300 @@
<template>
<view class="page-gray color-333 u-font-28">
<view class="block">
<picker-item title="打印机品牌" required v-model="form.contentType" :modelValue="form.contentType"
:list="pageData.brandList"></picker-item>
<picker-item title="小票打印" required v-model="form.subType" :modelValue="form.subType"
:list="pageData.receiptsList"></picker-item>
<picker-item title="类型" required v-model="form.connectionType" :modelValue="form.connectionType"
:list="pageData.connectionTypeList"></picker-item>
<view class="u-p-b-14 u-m-b-24 border-bottom">
<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"><span style="color: red;">*</span>打印机编号</view>
<view class="">
<uni-easyinput :inputBorder="false" :padding-none="true" v-model="form.address"
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.port"
placeholder="设置打印机密钥"></uni-easyinput>
</view>
</view>
<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($event,'receiptSize')">
<label class="radio u-m-r-60" v-for="(item,index) in pageData.deciveSizeList" :key="index">
<radio :value="item.value" :checked="form.receiptSize == item.value" class="scale7" />
<text>{{item.label}}</text>
</label>
</radio-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">
<radio-group class="u-flex u-flex-wrap" @change="sizeChange($event,'classifyPrint')">
<label class="radio u-m-r-60" v-for="(item,index) in pageData.classifyPrintList" :key="index">
<radio :value="item.value" :checked="form.classifyPrint == item.value" class="scale7" />
<text>{{item.label}}</text>
</label>
</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 pageData.partList" :key="item.id" :customStyle="{marginBottom: '16rpx',marginRight: '20rpx'}"
: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">
<radio-group class="u-flex u-flex-wrap" @change="sizeChange($event,'printQty')">
<label class="radio u-m-r-60" v-for="(item,index) in pageData.printQtyList" :key="index">
<radio :value="item.value" :checked="form.printQty == item.value" class="scale7" />
<text>{{item.label}}</text>
</label>
</radio-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">
<radio-group class="u-flex u-flex-wrap" @change="sizeChange($event,'printMethod')">
<label class="radio u-m-r-60" v-for="(item,index) in pageData.printMethodList" :key="index">
<radio :value="item.value" :checked="form.printMethod == item.value" class="scale7" />
<text>{{item.label}}</text>
</label>
</radio-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" style="display: flex;">
<up-checkbox-group v-model="form.printType">
<up-checkbox v-for="(item,index) in pageData.printTypeList" :key="index" :customStyle="{marginBottom: '16rpx',marginRight:'40rpx'}" :label="item.label" :name="item.value" ></up-checkbox>
</up-checkbox-group>
</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.status"></my-switch>
</view>
</view>
</view>
<view style="height: 60rpx;"></view>
<view class="">
<view class="btn">
<my-button shape="circle" @click="save">保存</my-button>
</view>
</view>
</view>
</template>
<script setup>
import { ref, reactive } from 'vue';
import { onLoad } from '@dcloudio/uni-app'
import go from '@/commons/utils/go.js';
import pickerItem from './components/picker-item.vue';
import myRadioGroup from './components/my-radio-group.vue';
import { devices, subTypes, brand, receipts,connectionType } from '@/pagePrinter/devices.js'
import { getPrinterDetail, addPrinter, updatePrinter } from '@/http/api/printer.js'
import { categoryPage } from '@/http/api/cateGory.js'
const pageData = reactive({
brandList: brand, // 打印机品牌列表
receiptsList: receipts, // 小票
connectionTypeList: connectionType, // 类型
deciveSizeList: [ // 小票尺寸
{ label: '58mm', value: '58mm' },
{ label: '80mm', value: '80mm' },
],
classifyPrintList: [ // 分类打印
{ label: '打印所有', value: '0' },
{ label: '部分分类(仅打印制作单[厨房])', value: '1' },
],
printQtyList: [ // 打印数量
{ label: '顾客联+商家联「2张」', value: 'c1m1^2' },
{ label: '只打印商家联「1张」', value: 'm1^1' },
{ label: '只打印顾客联「1张」', value: 'c1^1' },
{ label: '2张顾客联+1张商家联「3张」', value: 'c2m1^3' },
],
printMethodList: [ // 打印方式
{ label: '打印全部', value: 'all' },
{ label: '仅打印制作单「厨房」', value: 'one' },
{ label: '仅打印结账单「前台」', value: 'normal' },
],
printTypeList: [ // 打印类型
{ label: '确认退款单', value: 'refund' },
{ label: '交班单', value: 'handover' },
{ label: '排队取号', value: 'queue' },
],
partList: [], // 部分打印
})
let form = reactive({
id: null,
sort: "0",
status: 1,
contentType: '',
subType: '',
connectionType: "network",
printType: [],
name: '',
receiptSize: '58mm',
classifyPrint: '0',
printQty: 'm1^1',
printMethod: "all",
selectcheckbox:[]
})
onLoad((options) => {
getlist()
if (options.id) {
getdetails(options.id)
} else {
}
// Object.assign(option, opt)
})
/**
* 获取商品分类列表
*/
let getlist = async () => {
const res = await categoryPage({
page: 1,
size: 500
})
let arr = []
res.records.forEach(ele => {
arr.push({
id: ele.id,
name: ele.name
})
})
pageData.partList = arr
}
/**
* 获取打印机详情
*/
async function getdetails(id) {
const res = await getPrinterDetail({id: id})
if (res.categoryList) {
let arrs = []
res.categoryList.forEach(eles => {
arrs.push(eles)
})
res.selectcheckbox = arrs
}
form = Object.assign(form, res)
if(form.printType)form.printType = JSON.parse(form.printType)
}
function sizeChange(e, name) {
form[name] = e.detail.value
}
/**
* 保存
*/
async function save() {
// 效验
if (!form.contentType || !form.subType || !form.name || !form.address) {
uni.$utils.showToast("请输入必填项")
return
}
if (form.classifyPrint == 1 && form.selectcheckbox.length == 0) {
uni.$utils.showToast("请选择部分分类")
return
}
// 部分分类处理
if (form.classifyPrint == 1) {
let idstr = ''
let arr = []
form.selectcheckbox.forEach(element => {
idstr += element + ','
arr.push(pageData.partList.filter(ele => ele.id == element)[0])
})
console.log(form.selectcheckbox)
form.categoryIds = idstr.substring(0, idstr.length - 1)
form.categoryIds = JSON.stringify(form.selectcheckbox)
form.categoryList = JSON.stringify(arr)
}
delete form.selectcheckbox;
form.printType = JSON.stringify(form.printType)
if (form.id) {
delete form.createdAt
delete form.updatedAt
const res = updatePrinter({
...form
})
} else {
const res = addPrinter({
...form
})
}
go.back()
}
</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

@@ -1,31 +1,60 @@
<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="打印机品牌" required v-model="form.contentType" :modelValue="form.contentType"
:list="pageData.brandList"></picker-item>
<picker-item title="小票打印" required v-model="form.subType" :modelValue="form.subType"
:list="pageData.receiptsList"></picker-item>
<picker-item title="类型" required v-model="form.connectionType" :modelValue="form.connectionType"
:list="pageData.connectionTypeList"></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"><span style="color: red;">*</span>打印机名称</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"><span style="color: red;">*</span>打印机编号</view> <view class="title"><span style="color: red;">*</span>设备类型</view>
<view class="u-m-t-16">
<up-radio-group v-model="form.connectionType">
<up-radio v-for="(item,index) in pageData.connectionTypeList" :key="index" :label="item.name"
:name="item.value"></up-radio>
</up-radio-group>
</view>
</view>
<view class="u-p-b-14 u-m-b-24 border-bottom">
<view class="title"><span style="color: red;">*</span>小票类型</view>
<view class="u-m-t-16">
<up-radio-group v-model="form.printType ">
<up-radio v-for="(item,index) in pageData.receiptsList" :key="index" :label="item.name"
:name="item.value"></up-radio>
</up-radio-group>
</view>
</view>
<view class="u-p-b-14 u-m-b-24 border-bottom">
<view class="title"><span style="color: red;">*</span>打印机品牌</view>
<view class="u-m-t-16">
<up-radio-group v-model="form.brand">
<up-radio v-for="(item,index) in pageData.brandList" :key="index" :label="item.name"
:name="item.value"></up-radio>
</up-radio-group>
</view>
</view>
<view class="u-p-b-14 u-m-b-24 border-bottom">
<view class="title"><span style="color: red;">*</span>ip地址/MAC地址</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="ip地址/MAC地址"></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">端口</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">
@@ -39,68 +68,78 @@
</radio-group> </radio-group>
</view> </view>
</view> </view>
<view class="u-p-b-24 u-m-b-24 border-bottom">
<view class="title">分类打印 </view> <view class="u-p-b-14 u-m-b-24 border-bottom">
<view class="title"><span style="color: red;">*</span>打印数量</view>
<view class="u-m-t-16"> <view class="u-m-t-16">
<radio-group class="u-flex u-flex-wrap" @change="sizeChange($event,'classifyPrint')"> <up-number-box input-width="100" v-model="form.printNum"></up-number-box>
</view>
</view>
<view class="u-p-b-14 u-m-b-24 border-bottom">
<view class="title">打印内容</view>
<view class="u-m-t-16">
<view v-for="(pItem,pIndex) in printTypeList" :key="pIndex" class="u-m-b-16">
<view>{{pItem.label}}</view>
<view class="u-m-t-6">
<up-checkbox-group v-model="printContentType[pIndex]">
<up-checkbox :customStyle="{marginBottom: '16rpx',marginRight: '30rpx'}"
v-for="(item,index) in pItem.list" :key="index" :label="item.label"
:name="item.value"></up-checkbox>
</up-checkbox-group>
</view>
</view>
</view>
</view>
<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($event,'classifyPrint')">
<label class="radio u-m-r-60" v-for="(item,index) in pageData.classifyPrintList" :key="index"> <label class="radio u-m-r-60" v-for="(item,index) in pageData.classifyPrintList" :key="index">
<radio :value="item.value" :checked="form.classifyPrint == item.value" class="scale7" /> <radio :value="item.value" :checked="form.classifyPrint == item.value"
:disabled="returnClassifyPrintDisabled(item)" class="scale7" />
<text>{{item.label}}</text> <text>{{item.label}}</text>
</label> </label>
</radio-group> </radio-group> -->
<up-radio-group v-model="form.classifyPrint" placement="column">
<up-radio v-for="(item,index) in pageData.classifyPrintList" :key="index" :label="item.label"
:disabled="returnClassifyPrintDisabled(item)" :name="item.value"></up-radio>
</up-radio-group>
</view> </view>
</view> </view>
<view class="u-p-b-24 u-m-b-24 border-bottom" v-if="form.classifyPrint ==1"> <view class="u-p-b-24 u-m-b-24 border-bottom" v-if="form.classifyPrint ==1">
<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.selectcheckbox"> <up-checkbox-group v-model="form.categoryIds">
<up-checkbox v-for="item in pageData.partList" :key="item.id" :customStyle="{marginBottom: '16rpx',marginRight: '20rpx'}" <up-checkbox v-for="item in pageData.partList" :key="item.id"
:label="item.name" :name="item.id" style="margin-right: 40rpx;font-size: 28rpx;"> :customStyle="{marginBottom: '16rpx',marginRight: '20rpx'}" :label="item.name"
:name="item.id" style="margin-right: 40rpx;font-size: 28rpx;">
</up-checkbox> </up-checkbox>
</up-checkbox-group> </up-checkbox-group>
</view> </view>
</view> </view>
<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($event,'printQty')">
<label class="radio u-m-r-60" v-for="(item,index) in pageData.printQtyList" :key="index">
<radio :value="item.value" :checked="form.printQty == item.value" class="scale7" />
<text>{{item.label}}</text>
</label>
</radio-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">
<radio-group class="u-flex u-flex-wrap" @change="sizeChange($event,'printMethod')">
<label class="radio u-m-r-60" v-for="(item,index) in pageData.printMethodList" :key="index">
<radio :value="item.value" :checked="form.printMethod == item.value" class="scale7" />
<text>{{item.label}}</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-flex u-row-between 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="">
<up-checkbox-group v-model="form.printType"> <my-switch v-model="form.volumeSwitch"></my-switch>
<up-checkbox v-for="(item,index) in pageData.printTypeList" :key="index" :customStyle="{marginBottom: '16rpx',marginRight:'40rpx'}" :label="item.label" :name="item.value" ></up-checkbox>
</up-checkbox-group>
</view> </view>
</view> </view>
<view class="u-p-b-24 u-flex u-row-between u-m-b-24 border-bottom"> <view class="u-p-b-24 u-flex u-row-between u-m-b-24 border-bottom">
<view class="title">打印机状态</view> <view class="title">启用状态</view>
<view class=""> <view class="">
<my-switch v-model="form.status"></my-switch> <my-switch v-model="form.status"></my-switch>
</view> </view>
</view> </view>
</view> </view>
<view style="height: 60rpx;"></view> <view style="height: 60rpx;"></view>
@@ -116,73 +155,152 @@
</template> </template>
<script setup> <script setup>
import { ref, reactive } from 'vue'; import {
import { onLoad } from '@dcloudio/uni-app' ref,
reactive,
watch
} from 'vue';
import {
onLoad
} from '@dcloudio/uni-app'
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';
import myRadioGroup from './components/my-radio-group.vue'; import myRadioGroup from './components/my-radio-group.vue';
import { devices, subTypes, brand, receipts,connectionType } from '@/pagePrinter/devices.js' import {
import { getPrinterDetail, addPrinter, updatePrinter } from '@/http/api/printer.js' devices,
import { categoryPage } from '@/http/api/cateGory.js' subTypes,
brand,
receipts,
connectionType,
printTypeList
} from '@/pagePrinter/devices.js'
import {
getPrinterDetail,
addPrinter,
updatePrinter,
} from '@/http/api/printer.js'
import {
categoryPage
} from '@/http/api/cateGory.js'
// 判断是否可选部分分类打印
function returnClassifyPrintDisabled(item) {
if (item.label != '打印所有') {
if (printContentType.value[1].length <= 0) {
return true
} else {
return false
}
}
return false
}
const pageData = reactive({ const pageData = reactive({
brandList: brand, // 打印机品牌列表 brandList: brand, // 打印机品牌列表
receiptsList: receipts, // 小票 receiptsList: receipts, // 小票
connectionTypeList: connectionType, // 类型 connectionTypeList: connectionType, // 类型
deciveSizeList: [ // 小票尺寸 deciveSizeList: [ // 小票尺寸
{ label: '58mm', value: '58mm' }, {
{ label: '80mm', value: '80mm' }, label: '58mm',
value: '58mm'
},
{
label: '80mm',
value: '80mm'
},
], ],
classifyPrintList: [ // 分类打印 classifyPrintList: [ // 分类打印
{ label: '打印所有', value: '0' }, {
{ label: '部分分类(仅打印制作单[厨房])', value: '1' }, label: '打印所有',
value: '0'
},
{
label: '部分分类(仅打印制作单[厨房])',
value: '1'
},
], ],
printQtyList: [ // 打印数量 printQtyList: [ // 打印数量
{ label: '顾客联+商家联「2张」', value: 'c1m1^2' }, {
{ label: '只打印商家联「1张」', value: 'm1^1' }, label: '顾客联+商家联「2张」',
{ label: '只打印顾客联「1张」', value: 'c1^1' }, value: 'c1m1^2'
{ label: '2张顾客联+1张商家联「3张」', value: 'c2m1^3' }, },
{
label: '只打印商家联「1张」',
value: 'm1^1'
},
{
label: '只打印顾客联「1张」',
value: 'c1^1'
},
{
label: '2张顾客联+1张商家联「3张」',
value: 'c2m1^3'
},
], ],
printMethodList: [ // 打印方式 printMethodList: [ // 打印方式
{ label: '打印全部', value: 'all' }, {
{ label: '打印制作单「厨房」', value: 'one' }, label: '打印全部',
{ label: '仅打印结账单「前台」', value: 'normal' }, value: 'all'
},
{
label: '仅打印制作单「厨房」',
value: 'one'
},
{
label: '仅打印结账单「前台」',
value: 'normal'
},
], ],
printTypeList: [ // 打印类型 printTypeList: [ // 打印类型
{ label: '确认退款单', value: 'refund' }, {
{ label: '交班单', value: 'handover' }, label: '确认退款单',
{ label: '排队取号', value: 'queue' }, value: 'refund'
},
{
label: '交班单',
value: 'handover'
},
{
label: '排队取号',
value: 'queue'
},
], ],
partList: [], // 部分打印 partList: [], // 部分打印
}) })
let form = reactive({ let form = reactive({
id: null, id: null,
sort: "0", sort: "0",
volumeSwitch: 1,
status: 1, status: 1,
contentType: '', brand: '',
subType: '', subType: 'cash',
connectionType: "network", connectionType: "云打印",
printType: [], categoryIds:[],
name: '', name: '',
receiptSize: '58mm', receiptSize: '58mm',
classifyPrint: '0', classifyPrint: '0',
printQty: 'm1^1', printQty: 'm1^1',
printMethod: "all", printMethod: "all",
selectcheckbox:[] printContentType: []
})
const printContentType = ref(printTypeList.map(v => []))
watch(() => printContentType.value, (newval, oldval) => {
if (newval[0].length <= 0) {
form.classifyPrint = '0'
}
}, {
deep: true
}) })
onLoad((options) => { onLoad((options) => {
getlist() getlist()
if (options.id) { if (options.id) {
getdetails(options.id) getdetails(options.id)
} else { } else {}
}
// Object.assign(option, opt) // Object.assign(option, opt)
}) })
/** /**
* 获取商品分类列表 * 获取商品分类列表
*/ */
@@ -200,71 +318,60 @@
}) })
pageData.partList = arr pageData.partList = arr
} }
/** /**
* 获取打印机详情 * 获取打印机详情
*/ */
async function getdetails(id) { async function getdetails(id) {
const res = await getPrinterDetail({id: id}) const res = await getPrinterDetail({
if (res.categoryList) { id: id
let arrs = [] })
res.categoryList.forEach(eles => {
arrs.push(eles) res.categoryIds = res.categoryIds.split(',').filter(v => v);
})
res.selectcheckbox = arrs
}
form = Object.assign(form, res) form = Object.assign(form, res)
if(form.printType)form.printType = JSON.parse(form.printType) const arr = res.printContentType.split(',')
printContentType.value = printTypeList.map(v => {
const listValues = v.list.map(listitem => listitem.value)
const selArr = listValues.filter(listItem => arr.includes(listItem))
return selArr
})
console.log(printContentType.value);
} }
function sizeChange(e, name) { function sizeChange(e, name) {
form[name] = e.detail.value form[name] = e.detail.value
} }
/** /**
* 保存 * 保存
*/ */
async function save() { async function save() {
// 效验 // 效验
if (!form.contentType || !form.subType || !form.name || !form.address) { if (!form.brand || !form.printType || !form.name || !form.address) {
uni.$utils.showToast("请输入必填项") uni.$utils.showToast("请输入必填项")
return return
} }
if (form.classifyPrint == 1 && form.selectcheckbox.length == 0) { if (form.classifyPrint == 1 && form.categoryIds.length == 0) {
uni.$utils.showToast("请选择部分分类") uni.$utils.showToast("请选择部分分类")
return return
} }
// 部分分类处理 console.log('form',form);
if (form.classifyPrint == 1) { const submitJson = {
let idstr = '' ...form,
let arr = [] categoryIds: form.classifyPrint == 0 ? '' : form.categoryIds.join(','),
form.selectcheckbox.forEach(element => { printContentType: printContentType.value.flat().join(',')
idstr += element + ','
arr.push(pageData.partList.filter(ele => ele.id == element)[0])
})
console.log(form.selectcheckbox)
form.categoryIds = idstr.substring(0, idstr.length - 1)
form.categoryIds = JSON.stringify(form.selectcheckbox)
form.categoryList = JSON.stringify(arr)
} }
delete form.selectcheckbox; console.log(submitJson);
form.printType = JSON.stringify(form.printType)
if (form.id) { if (form.id) {
delete form.createdAt delete form.createdAt
delete form.updatedAt delete form.updatedAt
const res = updatePrinter({ const res = updatePrinter(submitJson)
...form
})
} else { } else {
const res = addPrinter({ const res = addPrinter(submitJson)
...form
})
} }
go.back() go.back()
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@@ -11,10 +11,10 @@ export const receipts = [{
value: 'label', value: 'label',
name: '标签' name: '标签'
}, },
{ // {
value: 'kitchen', // value: 'kitchen',
name: '出品' // name: '出品'
}, // },
{ {
value: 'cash', value: 'cash',
name: '小票' name: '小票'
@@ -66,11 +66,89 @@ export const connectionType = [{
name: 'USB' name: 'USB'
}, },
{ {
value: '蓝牙', value: '云打印',
name: '蓝牙' name: '云打印'
}, },
{ {
value: '网', value: '局域网',
name: '网' name: '局域网'
}
]
export const printTypeList = [{
label: '前台',
list: [{
label: '客看单',
value: 'GUEST_ORDER'
},
{
label: '预结算单',
value: 'PRE_ORDER'
},
{
label: '结算单',
value: 'ORDER'
},
{
label: '退菜单',
value: 'RETURN_ORDER'
},
{
label: '退款单',
value: 'REFUND_ORDER'
},
]
},
{
label: '后厨',
list: [{
label: '后厨-整单',
value: 'ALL_KITCHEN'
},
{
label: '后厨-分单',
value: 'ONLY_KITCHEN'
},
{
label: '后厨-退菜单',
value: 'REFUND_KITCHEN'
},
]
},
{
label: '其它',
list: [{
label: '交班单',
value: 'HANDOVER'
},
{
label: '排队取号',
value: 'CALL'
},
{
label: '储值单',
value: 'RECHARGE'
},
{
label: '入库单',
value: 'STOCK'
},
{
label: '盘点单',
value: 'STOCK_CHECK'
},
{
label: '商品报表',
value: 'PRODUCT_REPORT'
},
{
label: '经营日报',
value: 'DAY_REPORT'
},
{
label: '日结单',
value: 'DAY_ORDER'
},
]
} }
] ]