代码更新
This commit is contained in:
@@ -3,9 +3,9 @@
|
||||
<view class="block">
|
||||
<!-- <up-popup :show="show" @close="close" @open="open"> -->
|
||||
<picker-item title="打印机品牌" required v-model="form.contentType" :modelValue="form.contentType"
|
||||
:list="brandt.list"></picker-item>
|
||||
:list="pageData.brandList"></picker-item>
|
||||
<picker-item title="小票打印" required v-model="form.subType" :modelValue="form.subType"
|
||||
:list="receipt.list"></picker-item>
|
||||
:list="pageData.receiptsList"></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="">
|
||||
@@ -17,7 +17,7 @@
|
||||
<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>
|
||||
placeholder="设置打印机编号"></uni-easyinput>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-p-b-14 u-m-b-24 border-bottom">
|
||||
@@ -31,13 +31,9 @@
|
||||
<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">
|
||||
<radio value="58mm" :checked="form.receiptSize == '58mm'" class="scale7" />
|
||||
<text>58mm</text>
|
||||
</label>
|
||||
<label class="radio u-m-r-60">
|
||||
<radio value="80mm" :checked="form.receiptSize == '80mm'" class="scale7" />
|
||||
<text>80mm</text>
|
||||
<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>
|
||||
@@ -46,18 +42,10 @@
|
||||
<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">
|
||||
<radio value="0" :checked="form.classifyPrint == '0'" class="scale7" />
|
||||
<text>打印所有</text>
|
||||
<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>
|
||||
<label class="radio u-m-r-60">
|
||||
<radio value="1" :checked="form.classifyPrint == '1'" class="scale7" />
|
||||
<text>部分分类(仅打印制作单[厨房])</text>
|
||||
</label>
|
||||
<!-- <label class="radio u-m-r-60">
|
||||
<radio value="2" :checked="form.classifyPrint == '2'" class="scale7" />
|
||||
<text>部分商品</text>
|
||||
</label> -->
|
||||
</radio-group>
|
||||
</view>
|
||||
</view>
|
||||
@@ -65,46 +53,20 @@
|
||||
<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'}"
|
||||
<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,'tablePrint')">
|
||||
<label class="radio u-m-r-60">
|
||||
<radio value="0" :checked="form.tablePrint == '0'" class="scale7" />
|
||||
<text>打印所有</text>
|
||||
</label>
|
||||
<label class="radio u-m-r-60">
|
||||
<radio value="1" :checked="form.tablePrint == '1'" class="scale7" />
|
||||
<text>打印部分桌台</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,'printQty')">
|
||||
<label class="radio u-m-r-60">
|
||||
<radio value="c1m1^2" :checked="form.printQty == 'c1m1^2'" class="scale7" />
|
||||
<text>顾客联+商家联「2张」</text>
|
||||
</label>
|
||||
<label class="radio u-m-r-60">
|
||||
<radio value="m1^1" :checked="form.printQty == 'm1^1'" class="scale7" />
|
||||
<text>只打印商家联「1张」</text>
|
||||
</label>
|
||||
<label class="radio u-m-r-60">
|
||||
<radio value="c1^1" :checked="form.printQty == 'c1^1'" class="scale7" />
|
||||
<text>只打印顾客联「1张」</text>
|
||||
</label>
|
||||
<label class="radio u-m-r-60">
|
||||
<radio value="c2m1^3" :checked="form.printQty == 'c2m1^3'" class="scale7" />
|
||||
<text>2张顾客联+1张商家联「3张」</text>
|
||||
<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>
|
||||
@@ -113,17 +75,9 @@
|
||||
<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">
|
||||
<radio value="all" :checked="form.printMethod == 'all'" class="scale7" />
|
||||
<text>打印全部</text>
|
||||
</label>
|
||||
<label class="radio u-m-r-60">
|
||||
<radio value="one" :checked="form.printMethod == 'one'" class="scale7" />
|
||||
<text>仅打印制作单[厨房]</text>
|
||||
</label>
|
||||
<label class="radio u-m-r-60">
|
||||
<radio value="normal" :checked="form.printMethod == 'normal'" class="scale7" />
|
||||
<text>仅打印结账单[前台]</text>
|
||||
<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>
|
||||
@@ -134,58 +88,18 @@
|
||||
<view class="title">打印类型</view>
|
||||
<view class="u-m-t-16" style="display: flex;">
|
||||
<up-checkbox-group v-model="form.printType">
|
||||
<up-checkbox :customStyle="{marginBottom: '8px'}" label="确认退款单" name="refund"
|
||||
style="margin-right: 40rpx;font-size: 28rpx;">
|
||||
</up-checkbox>
|
||||
<up-checkbox :customStyle="{marginBottom: '8px'}" label="交班单" name="handover"
|
||||
style="margin-right: 40rpx;font-size: 28rpx;">
|
||||
</up-checkbox>
|
||||
<up-checkbox :customStyle="{marginBottom: '8px'}" label="排队取号" name="queue"
|
||||
style="margin-right: 40rpx;font-size: 28rpx;">
|
||||
</up-checkbox>
|
||||
<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-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,'printReceipt')">
|
||||
<label class="radio u-m-r-60">
|
||||
<radio value="0" class="scale7" />
|
||||
<text>全部打印</text>
|
||||
</label>
|
||||
<label class="radio u-m-r-60">
|
||||
<radio value="1" :checked="form.printReceipt == '1'" class="scale7" />
|
||||
<text>仅厨房</text>
|
||||
</label><label class="radio u-m-r-60">
|
||||
<radio value="2" :checked="form.printReceipt == '2'" class="scale7" />
|
||||
<text>仅前台</text>
|
||||
</label>
|
||||
</radio-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> -->
|
||||
<my-switch v-model="form.status"></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>
|
||||
@@ -197,121 +111,55 @@
|
||||
<!-- 消息提示 -->
|
||||
<up-toast ref="uToastRef"></up-toast>
|
||||
|
||||
<!-- 选择分类 -->
|
||||
<choose-category v-model="chooseCategoryShow"></choose-category>
|
||||
</view>
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
devices,
|
||||
models,
|
||||
subTypes,
|
||||
brand,
|
||||
receipts,
|
||||
} from '@/pagePrinter/devices.js'
|
||||
import {
|
||||
onLoad,
|
||||
} from '@dcloudio/uni-app'
|
||||
import {
|
||||
ref,
|
||||
reactive,
|
||||
computed,
|
||||
watch,
|
||||
onMounted,
|
||||
toRef,
|
||||
getCurrentInstance
|
||||
|
||||
} from 'vue';
|
||||
import { ref, reactive, getCurrentInstance } 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 * as Api from '@/http/yskApi/devices.js'
|
||||
import chooseCategory from './components/choose-category.vue';
|
||||
|
||||
import { devices, models, subTypes, brand, receipts } from '@/pagePrinter/devices.js'
|
||||
import { getPrinterDetail, addPrinter, updatePrinter } from '@/api/printer.js'
|
||||
import { categoryPage } from '@/api/cateGory.js'
|
||||
|
||||
//选择分类
|
||||
let chooseCategoryShow = ref(false)
|
||||
|
||||
function categoryShow() {
|
||||
chooseCategoryShow.value = true
|
||||
}
|
||||
// brand
|
||||
const brandt = reactive({
|
||||
list: brand,
|
||||
selIndex: '',
|
||||
})
|
||||
const refs = getCurrentInstance()
|
||||
// 小票
|
||||
const receipt = reactive({
|
||||
list: receipts,
|
||||
selIndex: '',
|
||||
})
|
||||
let userId = ref(null)
|
||||
//品牌
|
||||
const brands = reactive({
|
||||
list: devices,
|
||||
selIndex: '',
|
||||
})
|
||||
let partList = ref([])
|
||||
//设备尺寸
|
||||
const deciveSize = reactive({
|
||||
list: [{
|
||||
label: '58mm',
|
||||
value: '0'
|
||||
},
|
||||
{
|
||||
label: '80mm',
|
||||
value: '1'
|
||||
},
|
||||
const pageData = reactive({
|
||||
brandList: brand, // 打印机品牌列表
|
||||
receiptsList: receipts, // 小票
|
||||
deciveSizeList: [ // 小票尺寸
|
||||
{ label: '58mm', value: '58mm' },
|
||||
{ label: '80mm', value: '58mm' },
|
||||
],
|
||||
selIndex: 1
|
||||
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 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
|
||||
}
|
||||
//打印份数
|
||||
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 + '行'
|
||||
}))
|
||||
|
||||
let form = reactive({
|
||||
id: null,
|
||||
sort: "0",
|
||||
status: 1,
|
||||
connectionType: "network",
|
||||
@@ -323,10 +171,67 @@
|
||||
printType: ["refund", 'handover', 'queue'],
|
||||
printMethod: "all",
|
||||
selectcheckbox:[]
|
||||
|
||||
|
||||
})
|
||||
|
||||
const refs = getCurrentInstance()
|
||||
|
||||
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.categoryIds) {
|
||||
let arr = res.categoryIds.split(',')
|
||||
let arrs = []
|
||||
console.log(arrs)
|
||||
arr.forEach(eles => {
|
||||
arrs.push(eles)
|
||||
})
|
||||
res.selectcheckbox = arrs
|
||||
}
|
||||
form = Object.assign(form, res)
|
||||
console.log(res)
|
||||
console.log(form)
|
||||
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) {
|
||||
refs.ctx.$refs.uToastRef.show({
|
||||
@@ -348,56 +253,26 @@
|
||||
let arr = []
|
||||
form.selectcheckbox.forEach(element => {
|
||||
idstr += element + ','
|
||||
arr.push(partList.value.filter(ele => ele.id == element)[0])
|
||||
arr.push(pageData.partList.filter(ele => ele.id == element)[0])
|
||||
})
|
||||
form.categoryIds = idstr.substring(0, idstr.length - 1)
|
||||
form.categoryList = JSON.stringify(arr)
|
||||
}
|
||||
if (userId.value) {
|
||||
form.printType = JSON.stringify(form.printType)
|
||||
if (form.id) {
|
||||
delete form.createdAt
|
||||
delete form.updatedAt
|
||||
const res = await Api.tbPrintMachine({
|
||||
const res = updatePrinter({
|
||||
...form
|
||||
}, 'put')
|
||||
})
|
||||
} else {
|
||||
const res = await Api.tbPrintMachine({
|
||||
const res = addPrinter({
|
||||
...form
|
||||
})
|
||||
}
|
||||
go.back()
|
||||
// go.to('/pagePrinter/index/index')
|
||||
}
|
||||
// watch(() => form.config.model, (newval) => {
|
||||
// console.log(newval);
|
||||
// })
|
||||
// const option = reactive({})
|
||||
async function getdetails() {
|
||||
const res = await Api.printerd(userId.value)
|
||||
if (res.categoryIds) {
|
||||
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(form.printType)
|
||||
}
|
||||
onLoad((options) => {
|
||||
getlist()
|
||||
if (options.id) {
|
||||
// 有id是编辑,获取详情
|
||||
userId.value = options.id
|
||||
getdetails()
|
||||
} else {
|
||||
userId.value = null
|
||||
}
|
||||
// Object.assign(option, opt)
|
||||
})
|
||||
// show(()=>{
|
||||
// getlist()
|
||||
// })
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -60,20 +60,13 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
devices,
|
||||
models,
|
||||
subTypes
|
||||
} from '@/pagePrinter/devices.js'
|
||||
import { ref,reactive } from 'vue';
|
||||
import { devices, models, subTypes } from '@/pagePrinter/devices.js'
|
||||
import go from '@/commons/utils/go.js'
|
||||
import {
|
||||
shopConfigprinter,
|
||||
delTableHandle
|
||||
} from '@/http/yskApi/devices.js'
|
||||
import {
|
||||
getCurrentInstance
|
||||
} from 'vue';
|
||||
|
||||
import myModel from '@/components/my-components/my-model.vue'
|
||||
import { updatePrinter, delPrinter } from '@/api/printer.js'
|
||||
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
@@ -81,6 +74,11 @@
|
||||
}
|
||||
})
|
||||
const emit = defineEmits(['init'])
|
||||
const delModel=ref(null)
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
let toUrl = () => {
|
||||
go.to('PAGES_PRINTER_ADD', {
|
||||
id: props.data.id
|
||||
@@ -103,25 +101,33 @@
|
||||
return dayjs(s).format('YYYY-MM-DD HH:mm:ss')
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态修改
|
||||
* @param {Object} d
|
||||
*/
|
||||
async function openDiscountChange(d) {
|
||||
delete props.data.createdAt
|
||||
delete props.data.updatedAt
|
||||
const res = await shopConfigprinter({
|
||||
...props.data,
|
||||
shopId: uni.getStorageSync('shopId'),
|
||||
const res = await updatePrinter({
|
||||
...props.data
|
||||
})
|
||||
emit('init', '')
|
||||
}
|
||||
const refs = getCurrentInstance()
|
||||
// 删除
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
function delTableHandleEvent() {
|
||||
refs.ctx.$refs.delModel.open()
|
||||
delModel.value.open()
|
||||
}
|
||||
//删除分类确认
|
||||
|
||||
/**
|
||||
* 删除分类确认
|
||||
*/
|
||||
async function delModelConfirm() {
|
||||
const res = await delTableHandle(props.data.id)
|
||||
const res = await delPrinter(props.data.id)
|
||||
emit('init', '')
|
||||
refs.ctx.$refs.delModel.close()
|
||||
delModel.value.close()
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,175 +0,0 @@
|
||||
<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-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-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 '../add-printer/components/picker-item.vue'
|
||||
import myRadioGroup from '../add-printer/components/my-radio-group.vue';
|
||||
import * as Api from '@/http/yskApi/devices.js'
|
||||
import chooseCategory from '../add-printer/components/choose-category.vue';
|
||||
|
||||
//选择分类
|
||||
let chooseCategoryShow = ref(false)
|
||||
|
||||
function categoryShow() {
|
||||
chooseCategoryShow.value = true
|
||||
}
|
||||
|
||||
//品牌
|
||||
const brands = reactive({
|
||||
list: devices,
|
||||
brand:brand,
|
||||
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>
|
||||
@@ -3,7 +3,7 @@
|
||||
<div class="w-full" v-for="item in pageData.list " :key="item.id">
|
||||
<printer-item :data="item" @init='init'></printer-item>
|
||||
</div>
|
||||
<view v-if="!pageData.list.length&&pageData.hasAjax">
|
||||
<view v-if="!pageData.list.length">
|
||||
<my-img-empty ></my-img-empty>
|
||||
</view>
|
||||
<view style="height: 100rpx;"></view>
|
||||
@@ -20,41 +20,39 @@
|
||||
|
||||
<script setup>
|
||||
import go from '@/commons/utils/go.js'
|
||||
import {
|
||||
onShow,
|
||||
} from '@dcloudio/uni-app'
|
||||
import {
|
||||
onMounted,
|
||||
reactive
|
||||
} from 'vue';
|
||||
import { onShow } from '@dcloudio/uni-app'
|
||||
import { reactive } from 'vue';
|
||||
import printerItem from './components/printer-item.vue';
|
||||
import * as Api from '@/http/yskApi/devices.js'
|
||||
import { getPrinter } from '@/api/printer.js'
|
||||
|
||||
const pageData = reactive({
|
||||
list: [],
|
||||
hasAjax:false,
|
||||
query: {
|
||||
sort: '',
|
||||
name: '',
|
||||
contentType: ''
|
||||
connectionType: ''
|
||||
}
|
||||
})
|
||||
|
||||
onShow(()=>{
|
||||
init()
|
||||
})
|
||||
|
||||
/**
|
||||
* 获取打印机列表
|
||||
*/
|
||||
async function init() {
|
||||
const res = await getPrinter(pageData.query)
|
||||
pageData.list = res.records
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加打印机
|
||||
*/
|
||||
function toAdd(){
|
||||
go.to('PAGES_PRINTER_ADD',{
|
||||
a:1
|
||||
})
|
||||
}
|
||||
async function init() {
|
||||
const res =await Api.tbPrintMachineGet(pageData.query)
|
||||
pageData.hasAjax=true
|
||||
pageData.list = res
|
||||
// pageData.list = res.filter(v=>v.address)
|
||||
}
|
||||
onShow(()=>{
|
||||
init()
|
||||
})
|
||||
// onMounted(() => {
|
||||
// init()
|
||||
// })
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
Reference in New Issue
Block a user