parking_temp_detail.blade.php 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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. .top-box {
  7. padding: 0 20px;
  8. }
  9. .el-tag {
  10. font-size: 16px;
  11. cursor: pointer;
  12. }
  13. </style>
  14. <div id="app">
  15. <div class="all">
  16. <div class="vue-head">
  17. <div class="vue-main-title">
  18. <div class="vue-main-title-left"></div>
  19. <div class="vue-main-title-content">消息模板信息</div>
  20. </div>
  21. <el-row>
  22. <el-col :span="16">
  23. <div class="top-box">
  24. <div style="padding: 50px 50px;">
  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.name" ></el-input>
  28. </el-form-item>
  29. <el-form-item label="打印头部" label-width="100px">
  30. <el-input v-model="form.print_head" ></el-input>
  31. <span class="help-block">打印头部信息,比如商家名称 建议不超过8个字,会进行加粗处理</span>
  32. </el-form-item>
  33. <el-form-item label="描述" label-width="100px">
  34. <el-input v-model="form.describe" ></el-input>
  35. <span class="help-block">为空则不显示</span>
  36. </el-form-item>
  37. <el-form-item label="是否开启" label-width="100px">
  38. <el-radio v-model="form.status" :label=0>关闭</el-radio>
  39. <el-radio v-model="form.status" :label=1>开启</el-radio>
  40. </el-form-item>
  41. </el-form>
  42. </div>
  43. </div>
  44. </el-col>
  45. </el-row>
  46. </div>
  47. <div class="vue-page">
  48. <div class="vue-center">
  49. <el-button type="primary" @click="submit">提交</el-button>
  50. <el-button @click="backTo">返回列表</el-button>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. <script language='javascript'>
  56. let id = "{{ request()-> id }}"
  57. //vue
  58. var app = new Vue({
  59. el: "#app",
  60. delimiters: ['[[', ']]'],
  61. data() {
  62. return {
  63. form: {
  64. name:'',
  65. print_head:'',
  66. status:0,
  67. describe:''
  68. },
  69. }
  70. },
  71. computed: {
  72. },
  73. mounted() {
  74. if (id) {
  75. this.getTempDetail()
  76. }
  77. },
  78. methods: {
  79. //返回列表
  80. backTo() {
  81. let url = "{!! yzWebUrl('plugin.printer.admin.parking-temp.index') !!}"
  82. window.location.href=url
  83. },
  84. //提交表单
  85. submit() {
  86. if (id) {
  87. this.$http.post("{!! yzWebFullUrl('plugin.printer.admin.parking-temp.edit') !!}", {
  88. temp: {
  89. id,
  90. ...this.form
  91. }
  92. }).then((res) => {
  93. if (res.data.result) {
  94. this.$message.success(res.data.msg)
  95. let url = "{!! yzWebUrl('plugin.printer.admin.parking-temp.index') !!}"
  96. window.location.href=url
  97. } else {
  98. this.$message.error(res.data.msg);
  99. }
  100. })
  101. } else {
  102. if (this.form.print_data < 1) {
  103. this.$message.error('请添加一个键')
  104. } else {
  105. this.$http.post("{!! yzWebFullUrl('plugin.printer.admin.parking-temp.add') !!}", {
  106. temp: {
  107. ...this.form
  108. }
  109. }).then((res) => {
  110. if (res.data.result) {
  111. this.$message.success(res.data.msg)
  112. let url = "{!! yzWebUrl('plugin.printer.admin.parking-temp.index') !!}"
  113. window.location.href=url
  114. } else {
  115. this.$message.error(res.data.msg);
  116. }
  117. })
  118. }
  119. }
  120. },
  121. //获取模板详情
  122. getTempDetail() {
  123. this.$http.post("{!! yzWebFullUrl('plugin.printer.admin.parking-temp.info') !!}", {
  124. id
  125. }).then((res) => {
  126. if (res.data.result) {
  127. let data = res.data.data
  128. this.form.name =data.name
  129. this.form.print_head =data.print_head
  130. this.form.status =data.status
  131. this.form.describe =data.describe
  132. } else {
  133. this.$message.error(res.data.msg);
  134. }
  135. })
  136. }
  137. },
  138. })
  139. </script>
  140. @endsection