zory 6 天之前
父节点
当前提交
76673c0e39

+ 26 - 0
src/api/model/merPrint.js

@@ -0,0 +1,26 @@
+import config from "@/config";
+import http from "@/utils/request";
+
+export default {
+    list: {
+        url: `${config.API_URL}/merchant/print/list`,
+        name: "-",
+        get: async function (params) {
+            return await http.get(this.url, params);
+        },
+    },
+    test: {
+        url: `${config.API_URL}/print/test`,
+        name: "-",
+        post: async function (params) {
+            return await http.post(this.url, params);
+        },
+    },
+    refresh: {
+        url: `${config.API_URL}/print/refresh`,
+        name: "-",
+        post: async function (params) {
+            return await http.post(this.url, params);
+        },
+    },
+}

+ 7 - 1
src/views/manage/goods/components/table.vue

@@ -19,7 +19,7 @@
                 <span class="status-danger" v-else>未设置</span>
             </template>
         </el-table-column>
-        <el-table-column label="商品标题" prop="product_name" width="200">
+        <el-table-column label="商品标题" prop="product_name">
             <template #default="scope">
                 <span v-if="scope.row.product_name">{{ scope.row.product_name }}</span>
                 <span class="status-danger" v-else>未设置</span>
@@ -37,6 +37,12 @@
                 <div class="status-danger" v-else><sc-status-indicator type="danger"></sc-status-indicator> 禁用</div>
             </template>
         </el-table-column>
+        <el-table-column label="关联打印机" prop="product_name" width="160">
+            <template #default="scope">
+                <span v-if="scope.row.print">{{ scope.row.print.name }}</span>
+                <span class="status-danger" v-else>未设置</span>
+            </template>
+        </el-table-column>
         <el-table-column label="创建时间" prop="create_at" width="180"></el-table-column>
         <el-table-column label="操作" width="200" align="right" fixed="right">
             <template #default="scope">

+ 1 - 1
src/views/manage/print/components/search.vue

@@ -13,7 +13,7 @@
                             </el-input>
                         </el-col>
                         <el-col :span="this.$store.state.global.ismobile?12:4">
-                            <el-input v-model="searchKey.name" placeholder="商品ID" clearable :style="{ width: '100%' }" @keyup.enter="searchForm()">
+                            <el-input v-model="searchKey.name" placeholder="名称" clearable :style="{ width: '100%' }" @keyup.enter="searchForm()">
                                 <template #prepend>名称</template>
                             </el-input>
                         </el-col>

+ 23 - 1
src/views/manage/print/components/table.vue

@@ -43,6 +43,7 @@
         <el-table-column label="操作" width="220" align="right" fixed="right">
             <template #default="scope">
                 <el-button-group>
+                    <el-button text type="warning" size="small" @click="table_bind(scope.row)">绑定门店</el-button>
                     <el-button text type="success" size="small" @click="table_print(scope.row)">打印测试</el-button>
                     <el-popconfirm title="确定删除并解绑该打印机吗?" @confirm="table_del(scope.row, scope.$index)">
                         <template #reference>
@@ -54,13 +55,15 @@
         </el-table-column>
     </scTable>
     <formMain ref="formMain" @success="handleSuccess"></formMain>
+    <storeData ref="storeData" :multiple="false" @success="handleStore"></storeData>
 </template>
 
 <script>
 import formMain from './form';
+import storeData from "@/views/manage/components/store";
 export default {
     components: {
-        formMain
+        formMain,storeData
     },
     data(){
         return {
@@ -74,6 +77,25 @@ export default {
         }
     },
     methods: {
+        async handleStore(data){
+            var loading = this.$loading();
+            var resp = await this.$API.print.edit.post({"sn":this.bindData.sn,'id':this.bindData.id,'agent_id':data.agent_id,'store_id':data.store_id});
+            loading.close();
+            if (resp.code == 0) {
+                return this.$message.error(resp.msg);
+            }
+            this.$message.success(resp.msg);
+            var that = this;
+            setTimeout(function(){
+                that.refresh()
+            },1500);
+        },
+        table_bind(data){
+            this.bindData = data;
+            this.$nextTick(() => {
+                this.$refs.storeData.open()
+            })
+        },
         async table_print(data){
             var loading = this.$loading();
             var resp = await this.$API.print.test.post({'sn':data.sn});

+ 263 - 0
src/views/merchant/components/print.vue

@@ -0,0 +1,263 @@
+<!--
+ * @Descripttion: 用户选择器
+ * @version: 1.0
+ * @Author: Zory
+ * @Date: 2024年1月10日21:46:29
+-->
+<template>
+    <el-dialog :title="titleMap[mode]" v-model="visible" :width="800" destroy-on-close @closed="$emit('closed')">
+        <div class="main">
+            <div class="main-left">
+                <div class="main-top">
+                    <el-form class="lv-form-inline" ref="searchForm" :model="searchKey" label-position="right">
+                        <el-row :gutter="10">
+                            <el-col :span="18" :xs="12">
+                                <el-form-item label=" " prop="name">
+                                    <el-input v-model="searchKey.name" placeholder="请输入名称" clearable
+                                        :style="{width: '100%'}"></el-input>
+                                </el-form-item>
+                            </el-col>
+                            <el-col :span="6" :xs="12">
+                                <el-form-item>
+                                    <div class="search-btn">
+                                        <el-button type="primary" @click="searchForm">搜索</el-button>
+                                    </div>
+                                </el-form-item>
+                            </el-col>
+                        </el-row>
+                    </el-form>
+                </div>
+                <div class="main-body-wrap" v-if="!multiple">
+                    <scTable ref="table" :apiObj="list.apiObj" :hideSetting="true" paginationLayout="total, prev, pager, next" :params="searchKey" @current-change="handleCurrentChange" highlight-current-row :row-key="getRowKeys" @sortChange="sortChange">
+                        <el-table-column width="50" fixed="left">
+                            <div class="checkbox"></div>
+                        </el-table-column>
+                        <el-table-column label="序列号" prop="sn" width="220" fixed="left">
+                            <template #default="scope">
+                                <span v-if="scope.row.sn">{{ scope.row.sn }}</span>
+                                <span class="status-danger" v-else>未设置</span>
+                            </template>
+                        </el-table-column>
+                        <el-table-column label="打印机名称" prop="name" width="220">
+                            <template #default="scope">
+                                <span v-if="scope.row.name">{{ scope.row.name }}</span>
+                                <span class="status-danger" v-else>未设置</span>
+                            </template>
+                        </el-table-column>
+                        <el-table-column label="设备状态" prop="device_state" width="160">
+                            <template #default="scope">
+                                <div class="status-success" v-if="scope.row.device_state==0"><sc-status-indicator type="success"></sc-status-indicator> 正常</div>
+                                <div class="status-danger" v-if="scope.row.device_state==1"><sc-status-indicator type="danger"></sc-status-indicator> 开盖</div>
+                                <div class="status-info" v-if="scope.row.device_state==2"><sc-status-indicator type="info"></sc-status-indicator> 粘纸</div>
+                                <div class="status-info" v-if="scope.row.device_state==3"><sc-status-indicator type="info"></sc-status-indicator> 缺纸</div>
+                            </template>
+                        </el-table-column>
+                        <el-table-column label="在线状态" prop="status" width="160">
+                            <template #default="scope">
+                                <div class="status-success" v-if="scope.row.online=='ONLINE'"><sc-status-indicator type="success"></sc-status-indicator> 正常</div>
+                                <div class="status-danger" v-if="scope.row.online=='OFFLINE'"><sc-status-indicator type="danger"></sc-status-indicator> 离线</div>
+                                <div class="status-info" v-if="scope.row.online=='UNACTIVE'"><sc-status-indicator type="info"></sc-status-indicator> 未激活</div>
+                                <div class="status-info" v-if="scope.row.online=='DISABLE'"><sc-status-indicator type="info"></sc-status-indicator> 已禁用</div>
+                            </template>
+                        </el-table-column>
+                        <el-table-column label="创建时间" prop="create_at" width="180"></el-table-column>
+                    </scTable>
+                </div>
+                <div class="main-body-wrap" v-else>
+                    <scTable ref="table" :apiObj="list.apiObj" :hideSetting="true" paginationLayout="total, prev, pager, next" :params="searchKey" @selectionChange="selectionChange" row-key="id" @sortChange="sortChange">
+                        <el-table-column type="selection" width="50" fixed="left"></el-table-column>
+                        <el-table-column label="序列号" prop="sn" width="220" fixed="left">
+                            <template #default="scope">
+                                <span v-if="scope.row.sn">{{ scope.row.sn }}</span>
+                                <span class="status-danger" v-else>未设置</span>
+                            </template>
+                        </el-table-column>
+                        <el-table-column label="打印机名称" prop="name" width="220">
+                            <template #default="scope">
+                                <span v-if="scope.row.name">{{ scope.row.name }}</span>
+                                <span class="status-danger" v-else>未设置</span>
+                            </template>
+                        </el-table-column>
+                        <el-table-column label="设备状态" prop="device_state" width="160">
+                            <template #default="scope">
+                                <div class="status-success" v-if="scope.row.device_state==0"><sc-status-indicator type="success"></sc-status-indicator> 正常</div>
+                                <div class="status-danger" v-if="scope.row.device_state==1"><sc-status-indicator type="danger"></sc-status-indicator> 开盖</div>
+                                <div class="status-info" v-if="scope.row.device_state==2"><sc-status-indicator type="info"></sc-status-indicator> 粘纸</div>
+                                <div class="status-info" v-if="scope.row.device_state==3"><sc-status-indicator type="info"></sc-status-indicator> 缺纸</div>
+                            </template>
+                        </el-table-column>
+                        <el-table-column label="在线状态" prop="status" width="160">
+                            <template #default="scope">
+                                <div class="status-success" v-if="scope.row.online=='ONLINE'"><sc-status-indicator type="success"></sc-status-indicator> 正常</div>
+                                <div class="status-danger" v-if="scope.row.online=='OFFLINE'"><sc-status-indicator type="danger"></sc-status-indicator> 离线</div>
+                                <div class="status-info" v-if="scope.row.online=='UNACTIVE'"><sc-status-indicator type="info"></sc-status-indicator> 未激活</div>
+                                <div class="status-info" v-if="scope.row.online=='DISABLE'"><sc-status-indicator type="info"></sc-status-indicator> 已禁用</div>
+                            </template>
+                        </el-table-column>
+                        <el-table-column label="创建时间" prop="create_at" width="180"></el-table-column>
+                    </scTable>
+                </div>
+            </div>
+        </div>
+		<template #footer>
+			<el-button @click="visible=false" >取 消</el-button>
+			<el-button v-if="mode!='show'" type="primary" :loading="isSaveing" @click="submit()">确 定</el-button>
+		</template>
+    </el-dialog>
+</template>
+
+<script>
+export default{
+    emits: ['success', 'closed'],
+    props: {
+        multiple: { type: Boolean, default: false },
+    },
+    data(){
+        return {
+            loading: false,
+            mode:"add",
+            titleMap:{
+                add:"选择打印机",
+                edit:"选择打印机"
+            },
+            list: {
+                apiObj: this.$API.merPrint.list
+            },
+            visible: false,
+            isSaveing: false,
+            formData:{},
+            searchKey:{},
+            selectData:[]
+        }
+    },
+    methods:{
+        sortChange(event){
+            if (event.order) {
+                var data = {
+                    "field":event.prop,
+                    "order":event.order
+                }
+                this.$refs.table.upData(data)
+            } else {
+                this.$refs.table.reload(this.searchKey)
+            }
+            return ;
+        },
+        submit(){
+            if (this.selectData.length == 0)
+            {
+                return this.$message.error("请选择数据");
+            }
+            this.isSaveing = false;
+            this.visible = false;
+            if (this.multiple){
+                this.$emit('success', this.selectData);
+            } else {
+                this.$emit('success', this.selectData[0]);
+            }
+        },
+        getRowKeys(data){
+            return data.id;
+        },
+        clearAll(){
+            this.selectData = [];
+        },
+        removeUser(index,name){
+            this.selectData.splice(index, 1);
+            console.log(name)
+        },
+        handleCurrentChange(data){
+            this.selectData = [data];
+        },
+        selectionChange(data){
+            this.selectData = data;
+        },
+        searchForm(){
+            this.$refs.table.upData(this.searchKey)
+        },
+        fristName(name){
+            return name.substring(0,1);
+        },
+        open(mode = 'add'){
+            this.mode = mode;
+            this.visible = true;
+            return this
+        },
+        //表单注入数据
+        setData(data){
+            this.formData = data;
+        },
+    }
+}
+</script>
+
+<style lang="scss" scoped>
+.main{
+    display: flex;
+    border: 1px solid #dfe1e6;
+}
+.main-left{
+    overflow: hidden;
+    flex: 1;
+    .main-body-wrap{
+        position: relative;
+        height: 380px;
+    }
+}
+.main-top{
+    position: relative;
+    padding: 10px 0;
+    border-bottom: 1px solid #dfe1e6;
+    &.is-right{
+        height:53px;
+        display:flex;
+        align-items:center;
+        padding:0 10px;
+        justify-content:space-between;
+    }
+}
+.main-body.is-right{
+    padding: 8px 16px;
+    overflow-y: auto;
+    position: relative;
+    height: calc(100% - 53px);
+    max-height: 380px;
+}
+.mx-1{
+    margin: 0 0.5rem 0.5rem 0;
+}
+.main-right{
+    flex: 0.4;
+}
+.el-form-item--default{
+    margin-bottom: 0;
+}
+.checkbox{
+    border:1px solid #dfe1e6;
+    width: 14px;
+    height: 14px;
+    border-radius: 2px;
+    background-color: #fff;
+    cursor: pointer;
+    position:relative
+}
+.current-row .checkbox{
+    background-color: var(--el-color-primary);
+    border-color: var(--el-color-primary);
+}
+.current-row .checkbox:after{
+    transform: rotate(45deg) scaleY(1);
+    box-sizing: content-box;
+    content: "";
+    border: 1px solid #fff;
+    border-left: 0;
+    border-top: 0;
+    height: 7px;
+    left: 4px;
+    position: absolute;
+    top: 1px;
+    width: 3px;
+    transition: transform .15s ease-in 50ms;
+    transform-origin: center;
+}
+</style>

+ 26 - 1
src/views/merchant/goods/components/option.vue

@@ -6,19 +6,22 @@
         <div class="op-header">
             <div class="left-panel">
                 <el-button type="primary" icon="el-icon-plus" @click="table_add()">新增商品</el-button>
+                <el-button type="danger" icon="el-icon-connection" @click="table_print()" :disabled="dataSelect.length>0?false:true">绑定打印机</el-button>
                 <el-button icon="el-icon-document" @click="table_batch_status(1)" :disabled="dataSelect.length>0?false:true">启用</el-button>
                 <el-button icon="el-icon-lock" @click="table_batch_status(0)" :disabled="dataSelect.length>0?false:true">禁用</el-button>
             </div>
         </div>
     </fieldset>
     <formMain ref="formMain" @success="handleSuccess"></formMain>
+    <printData ref="printData" :multiple="false" @success="handlePrint"></printData>
 </template>
 
 <script>
 import formMain from './form';
+import printData from "@/views/merchant/components/print";
 export default {
     components: {
-        formMain
+        formMain,printData
     },
     props: {
         type: { type: String, default: "1" },
@@ -31,6 +34,28 @@ export default {
         }
     },
     methods: {
+        async handlePrint(data){
+            var loading = this.$loading();
+            let submitData = {"id":this.dataSelect,"value":data.sn,"field":"print_id","type":"batch"};
+            var resp = await this.$API.merGoods.batch.post(submitData);
+            loading.close();
+            if (resp.code == 0) {
+                return this.$message.error(resp.msg);
+            }
+            this.$message.success(resp.msg);
+            var that = this;
+            setTimeout(function(){
+                that.refresh()
+            },1500);
+        },
+        table_print(){
+            if (this.dataSelect.length == 0) {
+                return this.$message.error("请选择修改数据")
+            }
+            this.$nextTick(() => {
+                this.$refs.printData.open()
+            })
+        },
         table_add(){
             this.$nextTick(() => {
                 this.$refs.formMain.open()

+ 7 - 1
src/views/merchant/goods/components/table.vue

@@ -7,7 +7,7 @@
                 <span class="status-danger" v-else>未设置</span>
             </template>
         </el-table-column>
-        <el-table-column label="商品标题" prop="product_name" width="200">
+        <el-table-column label="商品标题" prop="product_name">
             <template #default="scope">
                 <span v-if="scope.row.product_name">{{ scope.row.product_name }}</span>
                 <span class="status-danger" v-else>未设置</span>
@@ -25,6 +25,12 @@
                 <div class="status-danger" v-else><sc-status-indicator type="danger"></sc-status-indicator> 禁用</div>
             </template>
         </el-table-column>
+        <el-table-column label="关联打印机" prop="product_name" width="160">
+            <template #default="scope">
+                <span v-if="scope.row.print">{{ scope.row.print.name }}</span>
+                <span class="status-danger" v-else>未设置</span>
+            </template>
+        </el-table-column>
         <el-table-column label="创建时间" prop="create_at" width="180"></el-table-column>
         <el-table-column label="操作" width="200" align="right" fixed="right">
             <template #default="scope">

+ 86 - 0
src/views/merchant/print/components/form.vue

@@ -0,0 +1,86 @@
+<template>
+    <el-dialog :title="titleMap[mode]" v-model="visible" :width="600" destroy-on-close @closed="$emit('closed')" :close-on-click-modal="false" :close-on-press-escape="false">
+        <el-form ref="dialogForm" :model="formData" :rules="rules" label-width="100px" label-position="top">
+            <el-form-item label="序列号" prop="sn">
+                <el-input v-model="formData.sn" clearable placeholder="请输入"></el-input>
+                <div class="el-form-item-msg"></div>
+            </el-form-item>
+            <el-form-item label="打印机名称" prop="name">
+                <el-input v-model="formData.name" clearable placeholder="请输入"></el-input>
+                <div class="el-form-item-msg">可自定义</div>
+            </el-form-item>
+            <el-form-item label="设备密钥" prop="device_key">
+                <el-input v-model="formData.device_key" clearable placeholder="请输入"></el-input>
+                <div class="el-form-item-msg">在打印机底部可以查看</div>
+            </el-form-item>
+        </el-form>
+		<template #footer>
+			<el-button @click="visible=false" >取 消</el-button>
+			<el-button type="primary" :loading="isSaveing" @click="submit()">提交</el-button>
+		</template>
+    </el-dialog>
+</template>
+<script>
+export default {
+    data(){
+        return {
+            loading: false,
+            mode:"add",
+            titleMap:{
+                add:"新增打印机",
+                edit:"编辑打印机信息"
+            },
+            visible: false,
+            isSaveing: false,
+            formData:{},
+            submitState:false,
+            disabled:false,
+            rules:{
+                sn: [
+                    {required: true, message: '请输入'}
+                ],
+                name: [
+                    {required: true, message: '请输入'}
+                ],
+                device_key: [
+                    {required: true, message: '请输入'}
+                ]
+            },
+            sms:""
+        }
+    },
+    methods:{
+        open(mode = 'add'){
+            this.mode = mode;
+            this.visible = true;
+            return this
+        },
+        //表单注入数据
+        setData(data){
+            data.address = data.region+data.address;
+            this.formData = data;
+        },
+        async submit(){
+            var validate = await this.$refs.dialogForm.validate().catch(()=>{});
+            if(!validate){ return false }
+            this.isSaveing = true;
+            let submitData = JSON.parse(JSON.stringify(this.formData));
+            var resp = await this.$API.print.save.post(submitData);
+            this.isSaveing = false;
+            if (resp.code !== 1) {
+                return this.$message.error(resp.msg);
+            }
+            this.$message.success(resp.msg);
+            this.visible = false;
+            this.formData = {};
+            this.submitState = false;
+            this.$emit("success");
+        }
+    }
+}
+</script>
+<style>
+.mt20 {margin-top: 20px;}
+.login-msg-yzm {display: flex;width: 100%;}
+.login-msg-yzm .el-button {margin-left: 10px;--el-button-size:42px;}
+</style>

+ 52 - 0
src/views/merchant/print/components/option.vue

@@ -0,0 +1,52 @@
+<template>
+    <fieldset>
+        <legend>
+            <el-tag type="info">按需操作</el-tag>
+        </legend>
+        <div class="op-header">
+            <div class="left-panel">
+                <el-button type="warning" icon="el-icon-refresh" @click="table_refresh()">查询状态</el-button>
+            </div>
+        </div>
+    </fieldset>
+    <formMain ref="formMain" @success="handleSuccess"></formMain>
+</template>
+
+<script>
+import formMain from './form';
+export default {
+    components: {
+        formMain
+    },
+    props: {
+        type: { type: String, default: "1" },
+        dataSelect: { type: Array, default: () => [] },
+        searchKey: { type: Object, default: () => {} },
+        dataSelectFull: { type: Array, default: () => [] }
+    },
+    data(){
+        return {
+
+        }
+    },
+    methods: {
+        async table_refresh(){
+            var loading = this.$loading();
+            var resp = await this.$API.print.refresh.post({});
+            loading.close();
+            if (resp.code == 0) {
+                return this.$message.error(resp.msg);
+            }
+            this.$message.success(resp.msg);
+        },
+        table_add(){
+            this.$nextTick(() => {
+                this.$refs.formMain.open()
+            })
+        },
+        handleSuccess(){
+            this.$emit("success");
+        },
+    }
+}
+</script>

+ 47 - 0
src/views/merchant/print/components/search.vue

@@ -0,0 +1,47 @@
+<template>
+    <fieldset>
+        <legend>
+            <el-tag type="info">条件筛选</el-tag>
+        </legend>
+        <el-form class="lv-form-inline" ref="searchForm" :model="searchKey" label-position="right" label-width="100px">
+            <div class="search-form">
+                <div class="form-left">
+                    <el-row :gutter="10">
+                        <el-col :span="this.$store.state.global.ismobile?12:4">
+                            <el-input v-model="searchKey.sn" placeholder="请输入" clearable :style="{ width: '100%' }" @keyup.enter="searchForm()">
+                                <template #prepend>序列号</template>
+                            </el-input>
+                        </el-col>
+                        <el-col :span="this.$store.state.global.ismobile?12:4">
+                            <el-input v-model="searchKey.name" placeholder="名称" clearable :style="{ width: '100%' }" @keyup.enter="searchForm()">
+                                <template #prepend>名称</template>
+                            </el-input>
+                        </el-col>
+                        <el-col :span="this.$store.state.global.ismobile?12:4">
+                            <el-date-picker v-model="searchKey.create" :style="{width: '100%'}" placeholder="请选择创建时间" start-placeholder="开始时间" end-placeholder="结束时间" type="daterange" range-separator="至" @change="searchForm" />
+                        </el-col>
+                    </el-row>
+                </div>
+                <div class="form-line"></div>
+                <div class="form-right">
+                    <el-button type="primary" icon="el-icon-search" @click="searchForm">搜索</el-button>
+                </div>
+            </div>
+        </el-form>
+    </fieldset>
+</template>
+
+<script>
+export default {
+    data(){
+        return {
+            searchKey:{}
+        }
+    },
+    methods: {
+        searchForm(){
+            this.$emit("success",this.searchKey);
+        }
+    }
+}
+</script>

+ 151 - 0
src/views/merchant/print/components/table.vue

@@ -0,0 +1,151 @@
+<template>
+    <scTable ref="table" :apiObj="list.apiObj" :params="searchKey" @selectionChange="selectionChange" row-key="id">
+        <el-table-column type="selection" width="50" fixed="left"></el-table-column>
+        <el-table-column label="序列号" prop="sn" width="220" fixed="left">
+            <template #default="scope">
+                <span v-if="scope.row.sn">{{ scope.row.sn }}</span>
+                <span class="status-danger" v-else>未设置</span>
+            </template>
+        </el-table-column>
+        <el-table-column label="打印机名称" prop="name" width="220">
+            <template #default="scope">
+                <span v-if="scope.row.name">{{ scope.row.name }}</span>
+                <span class="status-danger" v-else>未设置</span>
+            </template>
+        </el-table-column>
+        <el-table-column label="所属店铺" prop="status" width="160">
+            <template #default="scope">
+                <span>{{ scope.row.store?scope.row.store.store_name:'未绑定' }}</span>
+            </template>
+        </el-table-column>
+        <el-table-column label="设备状态" prop="device_state" width="160">
+            <template #default="scope">
+                <div class="status-success" v-if="scope.row.device_state==0"><sc-status-indicator type="success"></sc-status-indicator> 正常</div>
+                <div class="status-danger" v-if="scope.row.device_state==1"><sc-status-indicator type="danger"></sc-status-indicator> 开盖</div>
+                <div class="status-info" v-if="scope.row.device_state==2"><sc-status-indicator type="info"></sc-status-indicator> 粘纸</div>
+                <div class="status-info" v-if="scope.row.device_state==3"><sc-status-indicator type="info"></sc-status-indicator> 缺纸</div>
+            </template>
+        </el-table-column>
+        <el-table-column label="在线状态" prop="status" width="160">
+            <template #default="scope">
+                <div class="status-success" v-if="scope.row.online=='ONLINE'"><sc-status-indicator type="success"></sc-status-indicator> 正常</div>
+                <div class="status-danger" v-if="scope.row.online=='OFFLINE'"><sc-status-indicator type="danger"></sc-status-indicator> 离线</div>
+                <div class="status-info" v-if="scope.row.online=='UNACTIVE'"><sc-status-indicator type="info"></sc-status-indicator> 未激活</div>
+                <div class="status-info" v-if="scope.row.online=='DISABLE'"><sc-status-indicator type="info"></sc-status-indicator> 已禁用</div>
+            </template>
+        </el-table-column>
+        <el-table-column label="创建时间" prop="create_at" width="180"></el-table-column>
+        <el-table-column label="操作" width="220" align="right" fixed="right">
+            <template #default="scope">
+                <el-button-group>
+                    <el-button text type="success" size="small" @click="table_print(scope.row)">打印测试</el-button>
+                    <el-popconfirm title="确定删除并解绑该打印机吗?" @confirm="table_del(scope.row, scope.$index)">
+                        <template #reference>
+                            <el-button text type="danger" size="small">删除</el-button>
+                        </template>
+                    </el-popconfirm>                    
+                </el-button-group>
+            </template>
+        </el-table-column>
+    </scTable>
+    <formMain ref="formMain" @success="handleSuccess"></formMain>
+</template>
+
+<script>
+import formMain from './form';
+export default {
+    components: {
+        formMain
+    },
+    data(){
+        return {
+            list: {
+                apiObj: this.$API.merPrint.list
+            },
+            dataSelect:[],
+            dataSelectFull:[],
+            searchKey:{},
+            bindData:{}
+        }
+    },
+    methods: {
+        table_bind(data){
+            this.bindData = data;
+            this.$nextTick(() => {
+                this.$refs.storeData.open()
+            })
+        },
+        async table_print(data){
+            var loading = this.$loading();
+            var resp = await this.$API.print.test.post({'sn':data.sn});
+            loading.close();
+            if (resp.code == 0) {
+                return this.$message.error(resp.msg);
+            }
+            this.$message.success(resp.msg);
+        },
+        refresh(){
+            this.$refs.table.refresh()
+        },
+        upData(data){
+            this.$refs.table.upData(data)
+        },
+        handleSuccess(){
+            this.$refs.table.refresh()
+        },
+        sortChange(event){
+            if (event.order) {
+                var data = {
+                    "field":event.prop,
+                    "order":event.order
+                }
+                this.$refs.table.upData(data)
+            } else {
+                this.$refs.table.reload(this.searchKey)
+            }
+            return ;
+        },
+        selectionChange(event){
+            this.dataSelect = [];
+            var arr = [];
+            var arrCompany = [];
+            event.forEach(function(val,index){
+                arr[index] = val.id;
+                arrCompany[index] = val;
+            });
+            this.dataSelectFull = arrCompany;
+            this.dataSelect = arr;
+            this.$emit("success",this.dataSelect);
+            this.$emit("successFull",this.dataSelectFull);
+        },
+    }
+}
+</script>
+
+<style>
+.desc{
+    color: #999;
+    font-size: 12px;
+}
+.flex-btn{
+    display: flex;
+    flex-wrap: wrap;
+    gap: 5px;
+}
+.flex-tags {
+    display: flex;
+    gap: 2px;
+    flex-wrap: wrap;
+}
+.flex-btn .el-button.is-text{
+    margin-left: 0;
+}
+.flex-tags-size{
+    font-size: 12px;
+}
+.flex-tags-size span{
+    display: block;
+    margin-bottom: 5px;
+    color: #999;
+}
+</style>

+ 47 - 0
src/views/merchant/print/index.vue

@@ -0,0 +1,47 @@
+<template>
+    <el-container class="flex-column">
+        <div class="table-search">
+            <search @success="handleSuccess"></search>
+            <optionBtn @success="handleSuccess" :dataSelect="dataSelect" :dataSelectFull="dataSelectFull" type="3"></optionBtn>
+        </div>
+        <el-main class="nopadding">
+            <div class="table-container">
+                <tablePage ref="tablePage" @success="tableHandle" @successFull="tableHandleFull" type="3"></tablePage>
+            </div>
+        </el-main>
+    </el-container>  
+</template>
+
+<script>
+import search from './components/search';
+import optionBtn from './components/option';
+import tablePage from './components/table';
+export default {
+    components: {
+        search,tablePage,optionBtn
+    },
+    data(){
+        return {
+            searchKey:{},
+            dataSelect:[],
+            dataSelectFull:[],
+        }
+    },
+    methods: {
+        tableHandle(data){
+            this.dataSelect = data;
+        },
+        tableHandleFull(data){
+            this.dataSelectFull = data;
+        },
+        handleSuccess(data){
+            this.$refs.tablePage.upData(data)
+        },
+        handleClick(name){
+            this.activeName = name;
+            this.searchKey.type = name;
+            this.$refs.tablePage.upData(this.searchKey)
+        }
+    }
+}
+</script>

+ 7 - 1
src/views/store/goods/components/table.vue

@@ -7,7 +7,7 @@
                 <span class="status-danger" v-else>未设置</span>
             </template>
         </el-table-column>
-        <el-table-column label="商品标题" prop="product_name" width="200">
+        <el-table-column label="商品标题" prop="product_name">
             <template #default="scope">
                 <span v-if="scope.row.product_name">{{ scope.row.product_name }}</span>
                 <span class="status-danger" v-else>未设置</span>
@@ -25,6 +25,12 @@
                 <div class="status-danger" v-else><sc-status-indicator type="danger"></sc-status-indicator> 禁用</div>
             </template>
         </el-table-column>
+        <el-table-column label="关联打印机" prop="product_name" width="160">
+            <template #default="scope">
+                <span v-if="scope.row.print">{{ scope.row.print.name }}</span>
+                <span class="status-danger" v-else>未设置</span>
+            </template>
+        </el-table-column>
         <el-table-column label="创建时间" prop="create_at" width="180"></el-table-column>
         <el-table-column label="操作" width="200" align="right" fixed="right">
             <template #default="scope">