default-template-set.blade.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. @extends('layouts.base')
  2. @section('title', '会员中心1模板设置')
  3. @section('content')
  4. <link rel="stylesheet" type="text/css" href="{{static_url('yunshop/goods/vue-goods1.css')}}"/>
  5. <link rel="stylesheet" type="text/css" href="{{static_url('yunshop/goods/vue-ohter.css')}}"/>
  6. <style>
  7. .el-checkbox-group {
  8. position: relative;
  9. z-index: 0;
  10. }
  11. .el-checkbox {
  12. margin-top: 10px !important;
  13. }
  14. </style>
  15. <div id='re_content'>
  16. <div class="con">
  17. <div class="setting">
  18. <el-form ref="form" label-width="15%">
  19. <div class="block">
  20. <div class="title"><span
  21. style="width: 4px;height: 18px;background-color: #29ba9c;margin-right:15px;display:inline-block;"></span><b>模板管理>会员中心模板1>设置</b>
  22. </div>
  23. <el-tabs v-model="activeName" style="margin-left: 20px">
  24. <el-tab-pane label="应用显示" name="first">
  25. <el-form-item label="模板设置">
  26. <el-switch v-model="form.open_state" :active-value="1"
  27. :inactive-value="0"></el-switch>
  28. <div class="tip">
  29. 开启后按设置内容显示
  30. </div>
  31. <div class="tip">部分应用强制同时显示(隐藏)、排序,如拍卖与拍卖管理</div>
  32. </el-form-item>
  33. <template v-for="(v,k) in this.form.plugin_list">
  34. <el-form-item :label="v.name">
  35. <template v-for="(vv,kk) in v.plugin">
  36. <div style="float: left;margin-right: 20px;margin-bottom: 15px">
  37. <el-checkbox @change="pluginCheckChange(vv.name,vv.status)"
  38. v-model="vv.status"
  39. :true-label="1" :false-label="0"
  40. :disabled="pluginIsDisabled(vv)"
  41. >
  42. [[vv.title]]
  43. </el-checkbox>
  44. <el-input @change="sortChange(vv)" v-model="vv.sort"
  45. style="width: 150px"
  46. placeholder="排序"></el-input>
  47. </div>
  48. </template>
  49. </el-form-item>
  50. </template>
  51. </el-tab-pane>
  52. <el-tab-pane label="tab列表显示" name="second">
  53. <template v-for="(v,k) in this.form.nav_list">
  54. <div style="margin-right: 20px;margin-bottom: 15px">
  55. <el-checkbox v-model="v.status" :true-label="1" :false-label="0">
  56. [[v.name]]
  57. </el-checkbox>
  58. <el-input v-model="v.title" style="width: 150px"
  59. placeholder="名称"></el-input>
  60. <el-input v-model="v.sort" style="width: 150px"
  61. placeholder="排序"></el-input>
  62. </div>
  63. <br>
  64. </template>
  65. </el-tab-pane>
  66. </el-tab-pane>
  67. </el-tabs>
  68. </div>
  69. </el-form>
  70. </div>
  71. <div class="confirm-btn" style="z-index:999;">
  72. <el-button :loading="submit_loading" type="primary" @click="submit">提交</el-button>
  73. </div>
  74. </div>
  75. </div>
  76. <script>
  77. var app = new Vue({
  78. el: "#re_content",
  79. delimiters: ['[[', ']]'],
  80. name: 'test',
  81. data() {
  82. return {
  83. form: {
  84. status: 0,
  85. plugin_list: [],
  86. nav_list: [],
  87. },
  88. is_max: false,
  89. activeName: 'first',
  90. submit_loading: false,
  91. }
  92. },
  93. created() {
  94. // this.getMemberData();
  95. this.getData();
  96. },
  97. mounted() {
  98. },
  99. methods: {
  100. pluginIsDisabled(data) {
  101. if (this.is_max == 0) {
  102. return false;
  103. }
  104. if (data.status == 1) {
  105. return false;
  106. }
  107. return true;
  108. },
  109. sortChange(data) {
  110. this.form.plugin_list.forEach(function (v) {
  111. v.plugin.forEach(function (vv) {
  112. if (vv.name == data.name) {
  113. vv.sort = data.sort;
  114. }
  115. // if (vv.status == 1) {
  116. // count = count + 1;
  117. // }
  118. // if (name != '' && status != -1 && vv.name == name) {
  119. // if(vv.status == 0 && status == 1){
  120. // vv.status = 1;
  121. // count = count + 1;
  122. // }else if(vv.status == 1 && status == 0){
  123. // vv.status = 0;
  124. // count = count - 1;
  125. // }
  126. // }
  127. })
  128. })
  129. },
  130. pluginCheckChange(name, status) {
  131. console.log(name);
  132. var count = 0;
  133. this.form.plugin_list.forEach(function (v) {
  134. v.plugin.forEach(function (vv) {
  135. if (vv.status == 1) {
  136. count = count + 1;
  137. }
  138. if (name != '' && status != -1 && vv.name == name) {
  139. if (vv.status == 0 && status == 1) {
  140. vv.status = 1;
  141. count = count + 1;
  142. } else if (vv.status == 1 && status == 0) {
  143. vv.status = 0;
  144. count = count - 1;
  145. }
  146. }
  147. })
  148. })
  149. if (count == 19) {
  150. this.is_max = true;
  151. } else if (count > 19) {
  152. var lex = 19 - (count - 19);
  153. if (name != '') {
  154. this.$message({message: '存在关联应用,需要已勾选应用少于'+lex+'个才可勾选', type: 'error'});
  155. this.form.plugin_list.forEach(function (v) {
  156. v.plugin.forEach(function (vv) {
  157. if (vv.name == name) {
  158. vv.status = 0;
  159. }
  160. })
  161. })
  162. this.pluginCheckChange('', -1);
  163. } else {
  164. this.is_max = true;
  165. }
  166. } else {
  167. this.is_max = false;
  168. }
  169. console.log(count);
  170. },
  171. getData() {
  172. this.$http.post('{!! yzWebFullUrl('plugin.decorate.admin.decorate-default-template.index') !!}', {
  173. 'id': this.form.id,
  174. 'is_json': 1
  175. }).then(response => {
  176. if (response.data.result) {
  177. this.form = response.data.data;
  178. this.pluginCheckChange('', -1);
  179. } else {
  180. this.$message({message: response.data.msg, type: 'error'});
  181. }
  182. }, response => {
  183. this.$message({message: response.data.msg, type: 'error'});
  184. })
  185. },
  186. submit() {
  187. let that = this;
  188. this.submit_loading = true;
  189. this.$http.post('{!! yzWebFullUrl('plugin.decorate.admin.decorate-default-template.edit') !!}', this.form).then(response => {
  190. if (response.data.result) {
  191. console.log(response.data.data);
  192. // this.form.id = response.data.data;
  193. this.$message({message: response.data.msg, type: 'success'});
  194. this.submit_loading = false;
  195. this.getData();
  196. } else {
  197. this.$message({message: response.data.msg, type: 'error'});
  198. this.submit_loading = false;
  199. }
  200. }, response => {
  201. this.$message({message: response.data.msg, type: 'error'});
  202. this.submit_loading = false;
  203. })
  204. }
  205. },
  206. })
  207. </script>
  208. @endsection