printer_detail.blade.php 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. @extends('layouts.base')
  2. @section('content')
  3. @section('title', '打印机信息')
  4. <link rel="stylesheet" type="text/css" href="{{static_url('yunshop/goods/vue-goods1.css')}}" />
  5. <style>
  6. .box-top {
  7. width: 100%;
  8. }
  9. </style>
  10. <div id="app">
  11. <div class="all">
  12. <div class="vue-head">
  13. <div class="vue-main-title">
  14. <div class="vue-main-title-left"></div>
  15. <div class="vue-main-title-content">打印机信息</div>
  16. </div>
  17. <div style="padding:0 50px ;">
  18. <el-card class="box-card">
  19. <div class="top-box">
  20. USER与UKEY, 请前往飞鹅注册查看
  21. </div>
  22. </el-card>
  23. </div>
  24. <div style="padding: 50px 100px;">
  25. <el-form label-position="right" label-width="80px" :model="form">
  26. <el-form-item label="打印机名称" label-width="100px">
  27. <el-input placeholder="请输入打印机名称" v-model="form.title" style="width: 700px;;"></el-input>
  28. </el-form-item>
  29. <el-form-item label="USER" label-width="100px">
  30. <el-input placeholder="请输入USER" v-model="form.user" style="width: 700px;;"></el-input>
  31. </el-form-item>
  32. <el-form-item label="UKEY" label-width="100px">
  33. <el-input placeholder="请输入UKEY" v-model="form.ukey" style="width: 700px;;"></el-input>
  34. </el-form-item>
  35. <el-form-item label="打印机编号" label-width="100px">
  36. <el-input placeholder="请输入打印机编号" v-model="form.printer_sn" style="width: 700px;;"></el-input>
  37. </el-form-item>
  38. <el-form-item label="打印联数" label-width="100px">
  39. <el-input placeholder="请输入打印联数" v-model="form.times" style="width: 700px;;"></el-input>
  40. <p class="help-block">打印联数上限为5联</p>
  41. </el-form-item>
  42. <el-form-item label="是否开启" label-width="100px">
  43. <el-switch v-model="form.status" active-color="#29ba9c" inactive-color="#dcdfe6" :active-value="1" :inactive-value="0">
  44. </el-switch>
  45. </el-form-item>
  46. </el-form>
  47. </div>
  48. </div>
  49. <div class="vue-page">
  50. <div class="vue-center">
  51. <el-button type="primary" @click="submit">提交</el-button>
  52. <el-button @click="backTo">返回列表</el-button>
  53. </div>
  54. </div>
  55. </div>
  56. </div>
  57. <script language='javascript'>
  58. let id = "{{ request()-> id }}"
  59. //vue
  60. var app = new Vue({
  61. el: "#app",
  62. delimiters: ['[[', ']]'],
  63. data() {
  64. return {
  65. form: {
  66. title: '',
  67. user:'',
  68. ukey:'',
  69. printer_sn:'',
  70. times:null,
  71. status:0
  72. },
  73. }
  74. },
  75. computed: {
  76. },
  77. mounted() {
  78. if (id) {
  79. this.getTempDetail(id)
  80. }
  81. },
  82. methods: {
  83. //返回列表
  84. backTo() {
  85. let url = "{!! yzWebUrl('plugin.printer.admin.list.index') !!}"
  86. window.location.href = url
  87. },
  88. //提交表单
  89. submit() {
  90. if (id) {
  91. this.$http.post("{!! yzWebFullUrl('plugin.printer.admin.list.edit') !!}", {
  92. printer: {
  93. id,
  94. title: this.form.title,
  95. user: this.form.user,
  96. ukey: this.form.ukey,
  97. printer_sn: this.form.printer_sn,
  98. times: this.form.times,
  99. status : this.form.status,
  100. }
  101. }).then((res) => {
  102. if (res.data.result) {
  103. this.$message.success(res.data.msg)
  104. let url = "{!! yzWebUrl('plugin.printer.admin.list.index') !!}"
  105. window.location.href = url
  106. } else {
  107. this.$message.error(res.data.msg);
  108. }
  109. })
  110. } else {
  111. this.$http.post("{!! yzWebFullUrl('plugin.printer.admin.list.add') !!}", {
  112. printer: {
  113. id,
  114. title: this.form.title,
  115. user: this.form.user,
  116. ukey: this.form.ukey,
  117. printer_sn: this.form.printer_sn,
  118. times: this.form.times,
  119. status : this.form.status,
  120. }
  121. }).then((res) => {
  122. if (res.data.result) {
  123. this.$message.success(res.data.msg)
  124. let url = "{!! yzWebUrl('plugin.printer.admin.list.index') !!}"
  125. window.location.href = url
  126. } else {
  127. this.$message.error(res.data.msg);
  128. }
  129. })
  130. }
  131. },
  132. //获取模板详情
  133. getTempDetail(id) {
  134. this.$http.post("{!! yzWebFullUrl('plugin.printer.admin.list.info') !!}", {
  135. id
  136. }).then((res) => {
  137. if (res.data.result) {
  138. let data = res.data.data
  139. this.form.title = data.title
  140. this.form.user = data.user
  141. this.form.ukey = data.ukey
  142. this.form.printer_sn = data.printer_sn
  143. this.form.times = data.times
  144. this.form.status = data.status
  145. } else {
  146. this.$message.error(res.data.msg);
  147. }
  148. })
  149. }
  150. },
  151. })
  152. </script>
  153. @endsection