打印机
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 增加打印机
|
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export function tbPrintMachine(data, method = 'post') {
|
export function tbPrintMachine(data, method = 'post') {
|
||||||
@@ -21,12 +21,34 @@ export function tbPrintMachine(data, method = 'post') {
|
|||||||
*/
|
*/
|
||||||
export function tbPrintMachineGet(params) {
|
export function tbPrintMachineGet(params) {
|
||||||
return request({
|
return request({
|
||||||
url: '/api/tbPrintMachine',
|
url: '/api/shop-config/printer/list',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
params: {
|
params: {
|
||||||
shopId: localStorage.getItem('shopId'),
|
|
||||||
sort: '',
|
|
||||||
...params
|
...params
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
// 删除
|
||||||
|
export function delTableHandle(id) {
|
||||||
|
return request({
|
||||||
|
url: '/api/shop-config/printer/' + id,
|
||||||
|
method: 'DELETE',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// * 打印机详情
|
||||||
|
export function printerd(id) {
|
||||||
|
return request({
|
||||||
|
url: '/api/shop-config/printer/' + id,
|
||||||
|
method: 'get',
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 编辑 新增打印机
|
||||||
|
export function configprinter(data, method = "post") {
|
||||||
|
return request({
|
||||||
|
url: `/api/shop-config/printer`,
|
||||||
|
method: method,
|
||||||
|
data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
144
src/views/devices/details.vue
Normal file
144
src/views/devices/details.vue
Normal file
@@ -0,0 +1,144 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :model="forms">
|
||||||
|
<el-form-item label="打印机品牌">
|
||||||
|
<el-select v-model="forms.contentType" placeholder="请选择打印机品牌">
|
||||||
|
<el-option label="云想印" value="yxyPrinter"></el-option>
|
||||||
|
<el-option label="飞鹅" value="fePrinter"></el-option>
|
||||||
|
<!-- <el-option label="本地" value="local"></el-option> -->
|
||||||
|
<!-- <el-option label="USB" value="printer"></el-option> -->
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="小票打印">
|
||||||
|
<el-select v-model="forms.subType" placeholder="请选择小票打印">
|
||||||
|
<el-option label="标签" value="label"></el-option>
|
||||||
|
<el-option label="出品" value="kitchen"></el-option>
|
||||||
|
<el-option label="小票" value="cash"></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="打印机名称">
|
||||||
|
<el-input v-model="forms.name" style="width: 280px;" placeholder="请输入打印机名称"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<!-- <template v-if="forms.contentType == 'network'"> -->
|
||||||
|
<el-form-item label="打印机编号">
|
||||||
|
<el-input v-model="forms.address" style="width: 280px;" placeholder="请输入打印机编号"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="打印机秘钥">
|
||||||
|
<el-input v-model="forms.port" style="width: 280px;" placeholder="请输入打印机秘钥"></el-input><br />
|
||||||
|
<div style="margin-left: 80px;color: #FF4D4F;">* 可在打印机设备底部查看打印机编号和秘钥(key)</div>
|
||||||
|
</el-form-item>
|
||||||
|
<!-- </template> -->
|
||||||
|
<!-- <template v-if="forms.contentType == 'local'"> <el-form-item label="IP地址">
|
||||||
|
<el-input v-model="forms.address" style="width: 280px;" placeholder="请输入打印机编号"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="端口">
|
||||||
|
<el-input v-model="forms.port" style="width: 280px;" placeholder="请输入打印机秘钥"></el-input><br />
|
||||||
|
<div style="margin-left: 80px;color: #FF4D4F;">* 可在打印机设备底部查看打印机编号和秘钥(key)</div>
|
||||||
|
</el-form-item>
|
||||||
|
</template> -->
|
||||||
|
|
||||||
|
<el-form-item label="小票尺寸">
|
||||||
|
<el-radio-group v-model="forms.receiptSize">
|
||||||
|
<el-radio label="58mm"></el-radio>
|
||||||
|
<el-radio label="80mm"></el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="分类打印">
|
||||||
|
<el-radio-group v-model="forms.classifyPrint">
|
||||||
|
<el-radio label="0">打印所有</el-radio>
|
||||||
|
<el-radio label="1">部分分类</el-radio>
|
||||||
|
<el-radio label="2">部分商品</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="桌台打印">
|
||||||
|
<el-radio-group v-model="forms.tablePrint">
|
||||||
|
<el-radio label="0">打印所有</el-radio>
|
||||||
|
<el-radio label="1">打印部分桌台</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="打印数量">
|
||||||
|
<el-radio-group v-model="forms.printQty">
|
||||||
|
<el-radio label="c1m1^2">顾客联+商家联「2张」</el-radio>
|
||||||
|
<el-radio label="m1^1">只打印商家联「1张」</el-radio>
|
||||||
|
<el-radio label="c1^1">只打印顾客联「1张」</el-radio>
|
||||||
|
<el-radio label="c2m1^3">2张顾客联+1张商家联「3张」</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="打印方式">
|
||||||
|
<el-radio-group v-model="forms.printMethod">
|
||||||
|
<el-radio label="1">普通</el-radio>
|
||||||
|
<el-radio label="2">单个菜</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="打印类型">
|
||||||
|
<el-checkbox-group v-model="forms.printType">
|
||||||
|
<el-checkbox label="1">确认退款单</el-checkbox>
|
||||||
|
<el-checkbox label="2">交班单</el-checkbox>
|
||||||
|
<el-checkbox label="3">排队取号</el-checkbox>
|
||||||
|
</el-checkbox-group>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="打印单据">
|
||||||
|
<el-radio-group v-model="forms.printReceipt">
|
||||||
|
<el-radio label="0">全部打印</el-radio>
|
||||||
|
<el-radio label="1">仅厨房</el-radio>
|
||||||
|
<el-radio label="2">仅前台</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
<div style="margin-left: 80px;color: #FF4D4F;">如果你的店只使用一台小票机,建议选择“全部打印”</div>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="打印机状态">
|
||||||
|
<el-switch v-model="forms.status" :active-value="1" :inactive-value="0"></el-switch>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label-width="80px">
|
||||||
|
<el-button type="primary" @click="$router.go(-1)">返回</el-button>
|
||||||
|
<el-button type="primary" @click="onSubmit">保存</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { configprinter, printerd } from '@/api/devices'
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
forms: {
|
||||||
|
sort: "0",
|
||||||
|
status: "0",
|
||||||
|
connectionType: "network", printType: []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
filters: {
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
if (this.$route.query.id) {
|
||||||
|
this.getList(this.$route.query.id)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
async onSubmit() {
|
||||||
|
|
||||||
|
// 删除时间字段
|
||||||
|
if( this.$route.query.id ){
|
||||||
|
delete this.forms.createdAt
|
||||||
|
delete this.forms.updatedAt
|
||||||
|
}
|
||||||
|
|
||||||
|
const res = await configprinter({
|
||||||
|
shopId: localStorage.getItem('shopId'),
|
||||||
|
...this.forms,
|
||||||
|
},
|
||||||
|
this.$route.query.id ? 'put' : 'post'
|
||||||
|
)
|
||||||
|
this.$router.go(-1)
|
||||||
|
},
|
||||||
|
async getList(id) {
|
||||||
|
const res = await printerd(id)
|
||||||
|
this.forms = res
|
||||||
|
this.forms.printType = JSON.parse(res.printType)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
export const devices = [
|
export const devices = [
|
||||||
{
|
{
|
||||||
value: 'printer',
|
value: 'local',
|
||||||
name: '本地'
|
name: '本地'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 'yxyPrinter',
|
value: 'network',
|
||||||
name: '云想印'
|
name: '云想印'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 'fePrinter',
|
value: 'USB',
|
||||||
name: '飞鹅'
|
name: 'USB打印机'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
<div class="head-container">
|
<div class="head-container">
|
||||||
<el-button type="primary" icon="el-icon-plus" @click="$refs.addDevice.show()">
|
<el-button type="primary" icon="el-icon-plus" @click="toUrl">
|
||||||
添加云打印机
|
添加云打印机
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
@@ -30,11 +30,11 @@
|
|||||||
{{ scope.row.contentType | devicesName }}
|
{{ scope.row.contentType | devicesName }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="出品模式" prop="config.model">
|
<!-- <el-table-column label="出品模式" prop="config.model">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
{{ scope.row.config.model | modelsName }}
|
{{ scope.row.config.model | modelsName }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column> -->
|
||||||
<el-table-column label="打印类型" prop="subType">
|
<el-table-column label="打印类型" prop="subType">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
{{ scope.row.subType | subTypesName }}
|
{{ scope.row.subType | subTypesName }}
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
{{ scope.row.createdAt | timeFilter }}
|
{{ scope.row.createdAt | timeFilter }}
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="排序" sortable prop="sort"></el-table-column>
|
<!-- <el-table-column label="排序" sortable prop="sort"></el-table-column> -->
|
||||||
<el-table-column label="状态" prop="status">
|
<el-table-column label="状态" prop="status">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<el-switch v-model="scope.row.status" :active-value="1" :inactive-value="0"
|
<el-switch v-model="scope.row.status" :active-value="1" :inactive-value="0"
|
||||||
@@ -55,7 +55,7 @@
|
|||||||
<el-table-column label="操作" width="200">
|
<el-table-column label="操作" width="200">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<el-button type="text" icon="el-icon-edit"
|
<el-button type="text" icon="el-icon-edit"
|
||||||
@click="$refs.addDevice.show(scope.row)">编辑</el-button>
|
@click="toUrl(scope.row)">编辑</el-button>
|
||||||
<el-popconfirm title="确定删除吗?" @confirm="delTableHandle([scope.row.id])">
|
<el-popconfirm title="确定删除吗?" @confirm="delTableHandle([scope.row.id])">
|
||||||
<el-button type="text" icon="el-icon-delete" style="margin-left: 20px !important;"
|
<el-button type="text" icon="el-icon-delete" style="margin-left: 20px !important;"
|
||||||
slot="reference">删除</el-button>
|
slot="reference">删除</el-button>
|
||||||
@@ -75,7 +75,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import { devices, models, subTypes } from './devices'
|
import { devices, models, subTypes } from './devices'
|
||||||
import addDevice from './components/addDevice'
|
import addDevice from './components/addDevice'
|
||||||
import { tbPrintMachineGet, tbPrintMachine } from '@/api/devices'
|
import { tbPrintMachineGet, tbPrintMachine, delTableHandle } from '@/api/devices'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@@ -99,16 +99,20 @@ export default {
|
|||||||
},
|
},
|
||||||
filters: {
|
filters: {
|
||||||
devicesName(value) {
|
devicesName(value) {
|
||||||
const item=devices.find(item => item.value == value)
|
if (value == 'yxyPrinter') {
|
||||||
return item?item.name:''
|
return '云想印'
|
||||||
|
} else if (value == 'fePrinter') '飞鹅'
|
||||||
|
// const item=devices.find(item => item.value == value)
|
||||||
|
// return item?item.name:''
|
||||||
},
|
},
|
||||||
modelsName(value) {
|
modelsName(value) {
|
||||||
const item=models.find(item => item.value == value)
|
const item = models.find(item => item.value == value)
|
||||||
return item?item.name:''
|
return item ? item.name : ''
|
||||||
},
|
},
|
||||||
subTypesName(value) {
|
subTypesName(value) {
|
||||||
const item=subTypes.find(item => item.value == value)
|
if (value == "label") return '标签'
|
||||||
return item?item.name:''
|
else if (value == 'kitchen') return '出品'
|
||||||
|
else if (value == 'cash') return '小票'
|
||||||
},
|
},
|
||||||
timeFilter(s) {
|
timeFilter(s) {
|
||||||
return dayjs(s).format('YYYY-MM-DD HH:mm:ss')
|
return dayjs(s).format('YYYY-MM-DD HH:mm:ss')
|
||||||
@@ -118,6 +122,9 @@ export default {
|
|||||||
this.getTableData()
|
this.getTableData()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
toUrl(item) {
|
||||||
|
this.$router.push({ path: '/shop/devices/details', query:{id:item.id}})
|
||||||
|
},
|
||||||
// 切换状态
|
// 切换状态
|
||||||
async statusChange(e, row) {
|
async statusChange(e, row) {
|
||||||
try {
|
try {
|
||||||
@@ -142,13 +149,20 @@ export default {
|
|||||||
this.tableData.page = e - 1
|
this.tableData.page = e - 1
|
||||||
this.getTableData()
|
this.getTableData()
|
||||||
},
|
},
|
||||||
|
// 删除
|
||||||
|
async delTableHandle(item) {
|
||||||
|
const res = await delTableHandle(item)
|
||||||
|
this.getTableData()
|
||||||
|
},
|
||||||
// 获取商品列表
|
// 获取商品列表
|
||||||
async getTableData() {
|
async getTableData() {
|
||||||
this.tableData.loading = true
|
this.tableData.loading = true
|
||||||
try {
|
try {
|
||||||
const res = await tbPrintMachineGet({
|
const res = await tbPrintMachineGet({
|
||||||
name: this.query.name,
|
name: this.query.name,
|
||||||
contentType: this.query.type
|
shopId: localStorage.getItem('shopId'),
|
||||||
|
contentType: this.query.type,
|
||||||
|
sort: '',
|
||||||
})
|
})
|
||||||
this.tableData.loading = false
|
this.tableData.loading = false
|
||||||
this.tableData.data = res
|
this.tableData.data = res
|
||||||
|
|||||||
Reference in New Issue
Block a user