category_info.blade.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. @extends('layouts.base')
  2. @section('title', '排行榜分类详情')
  3. @section('content')
  4. <link rel="stylesheet" type="text/css" href="{{static_url('yunshop/goods/vue-goods1.css')}}"/>
  5. <link rel="stylesheet" href="{{static_url('css/public-number.css')}}">
  6. <style>
  7. .dialog-cover {
  8. z-index: 2001
  9. }
  10. .dialog-content {
  11. z-index: 2002
  12. }
  13. .link1 .el-input__inner {
  14. padding: 0
  15. }
  16. </style>
  17. <div class="all">
  18. <div id="app" v-cloak>
  19. <div class="vue-crumbs">
  20. <a @click="goParent">排行榜分类</a> > 排行榜分类详情
  21. </div>
  22. <div class="vue-main">
  23. <div class="vue-main-title">
  24. <div class="vue-main-title-left"></div>
  25. <div class="vue-main-title-content">排行榜分类详情</div>
  26. </div>
  27. <div class="vue-main-form">
  28. <el-form ref="form" :model="form" :rules="rules" label-width="15%">
  29. <el-form-item label="排序" prop="display_order">
  30. <el-input v-model="form.display_order" style="width:70%;" placeholder="请输入排序"></el-input>
  31. </el-form-item>
  32. <el-form-item label="分类名称" prop="name">
  33. <el-input v-model="form.name" style="width:70%;" placeholder="请输入分类名称"></el-input>
  34. </el-form-item>
  35. <el-form-item label="是否显示" prop="enabled">
  36. <el-switch v-model="form.enabled" :active-value="1" :inactive-value="0"></el-switch>
  37. </el-form-item>
  38. </el-form>
  39. </div>
  40. </div>
  41. <!-- 分页 -->
  42. <div class="vue-page">
  43. <div class="vue-center">
  44. <el-button type="primary" @click="submitForm('form')">提交</el-button>
  45. <el-button @click="goBack">返回</el-button>
  46. </div>
  47. </div>
  48. </div>
  49. </div>
  50. <script src="{{resource_get('static/yunshop/tinymce4.7.5/tinymce.min.js')}}"></script>
  51. @include('public.admin.pop')
  52. @include('public.admin.program')
  53. <script>
  54. let id = {!! $id?:0 !!}
  55. let
  56. level = {!! $level?:0 !!}
  57. let
  58. parent_id = {!! $parent_id?:0 !!}
  59. console.log(level)
  60. console.log(parent_id)
  61. var app = new Vue({
  62. el: "#app",
  63. delimiters: ['[[', ']]'],
  64. name: 'test',
  65. data() {
  66. return {
  67. id: id,
  68. form: {
  69. display_order: '0',
  70. name: '',
  71. enabled: 0,
  72. },
  73. loading: false,
  74. rules: {
  75. name: {required: true, message: '请输入分类名称'}
  76. },
  77. type: '',
  78. selNum: '',
  79. }
  80. },
  81. created() {
  82. if (this.id) {
  83. this.submit_url = '{!! yzWebFullUrl('plugin.goods-ranking.admin.category.edit') !!}'
  84. } else {
  85. this.submit_url = '{!! yzWebFullUrl('plugin.goods-ranking.admin.category.add') !!}'
  86. }
  87. this.getData();
  88. },
  89. mounted() {
  90. },
  91. methods: {
  92. clearImg(str, type, index) {
  93. if (!type) {
  94. this.form[str] = "";
  95. this.form[str + '_url'] = "";
  96. } else {
  97. this.form[str].splice(index, 1);
  98. this.form[str + '_url'].splice(index, 1);
  99. }
  100. this.$forceUpdate();
  101. },
  102. //弹窗显示与隐藏的控制
  103. changeLink(item) {
  104. this.show = item;
  105. },
  106. //当前链接的增加
  107. parHref(child, confirm) {
  108. this.show = confirm;
  109. // this.form.link=child;
  110. this.form[this.chooseLink] = child;
  111. },
  112. changeprogram(item) {
  113. this.pro = item;
  114. },
  115. parpro(child, confirm) {
  116. this.pro = confirm;
  117. // this.form.prolink=child;
  118. this.form[this.chooseMiniLink] = child;
  119. },
  120. showLink(type, name) {
  121. if (type == "link") {
  122. this.chooseLink = name;
  123. this.show = true;
  124. } else {
  125. this.chooseMiniLink = name;
  126. this.pro = true;
  127. }
  128. },
  129. getData() {
  130. let json = {};
  131. if (this.id) {
  132. json.id = this.id
  133. } else {
  134. json = {
  135. level: this.level,
  136. parent_id: this.parent_id
  137. }
  138. }
  139. console.log(json)
  140. let loading = this.$loading({
  141. target: document.querySelector(".content"),
  142. background: 'rgba(0, 0, 0, 0)'
  143. });
  144. this.$http.post('{!! yzWebFullUrl('plugin.goods-ranking.admin.category.detail') !!}', json).then(function (response) {
  145. if (response.data.result) {
  146. if (this.id) {
  147. let datas = response.data.data;
  148. this.form.display_order = datas.display_order;
  149. this.form.name = datas.name;
  150. this.form.enabled = datas.enabled || 0;
  151. this.link = response.data.data.link || "";
  152. }
  153. } else {
  154. this.$message({message: response.data.msg, type: 'error'});
  155. }
  156. loading.close();
  157. }, function (response) {
  158. this.$message({message: response.data.msg, type: 'error'});
  159. loading.close();
  160. }
  161. );
  162. },
  163. searchFilter() {
  164. let that = this;
  165. let loading = this.$loading({
  166. target: document.querySelector(".content"),
  167. background: 'rgba(0, 0, 0, 0)'
  168. });
  169. this.$http.post('{!! yzWebFullUrl('filtering.filtering.get-search-label-v2') !!}', {keyword: this.keyword}).then(response => {
  170. if (response.data.result) {
  171. this.filter_list = response.data.data;
  172. } else {
  173. this.$message({message: response.data.msg, type: 'error'});
  174. }
  175. loading.close();
  176. }, response => {
  177. loading.close();
  178. });
  179. },
  180. sureFilter(item) {
  181. let is_exist = 0;
  182. this.form.filter_ids.some((item1, index) => {
  183. if (item1 == item.id) {
  184. is_exist = 1;
  185. this.$message.error("请勿重复选择");
  186. return true;
  187. }
  188. })
  189. if (is_exist == 1) {
  190. return;
  191. }
  192. this.form.filter_ids.push(item.id)
  193. this.filter_names.push(item.name)
  194. },
  195. closeFilter(index) {
  196. this.form.filter_ids.splice(index, 1);
  197. this.filter_names.splice(index, 1);
  198. },
  199. submitForm(formName) {
  200. let that = this;
  201. let json = {
  202. data: {
  203. display_order: this.form.display_order,
  204. name: this.form.name,
  205. enabled: this.form.enabled,
  206. }
  207. };
  208. if (this.id) {
  209. json.data.id = this.id;
  210. }
  211. this.$refs[formName].validate((valid) => {
  212. if (valid) {
  213. let loading = this.$loading({
  214. target: document.querySelector(".content"),
  215. background: 'rgba(0, 0, 0, 0)'
  216. });
  217. this.$http.post(this.submit_url, json).then(response => {
  218. if (response.data.result) {
  219. this.$message({type: 'success', message: '操作成功!'});
  220. this.goBack();
  221. } else {
  222. this.$message({message: response.data.msg, type: 'error'});
  223. }
  224. loading.close();
  225. }, response => {
  226. loading.close();
  227. });
  228. } else {
  229. console.log('error submit!!');
  230. return false;
  231. }
  232. });
  233. },
  234. goBack() {
  235. history.go(-1)
  236. },
  237. goParent() {
  238. window.location.href = `{!! yzWebFullUrl('plugin.goods-ranking.admin.category.index') !!}`;
  239. },
  240. openUpload(str, type, sel) {
  241. console.log(str, type, 'uuuuuuuuuuu');
  242. this.chooseImgName = str;
  243. this.uploadShow = true;
  244. this.type = type
  245. this.selNum = sel
  246. },
  247. changeProp(val) {
  248. if (val == true) {
  249. this.uploadShow = false;
  250. } else {
  251. this.uploadShow = true;
  252. }
  253. },
  254. // 参数:fileList 上传文件的列表信息
  255. sureImg(name, uploadShow, fileList) {
  256. if (fileList.length <= 0) {
  257. return
  258. }
  259. console.log(name)
  260. console.log(fileList)
  261. this.form[name] = fileList[0].attachment;
  262. this.form[name + '_url'] = fileList[0].url;
  263. console.log(this.form[name], 'aaaaa')
  264. console.log(this.form[name + '_url'], 'bbbbb')
  265. },
  266. clearImg(str) {
  267. this.form[str] = "";
  268. this.form[str + '_url'] = "";
  269. this.$forceUpdate();
  270. },
  271. copyLink(type) {
  272. this.$refs[type].select();
  273. document.execCommand("Copy")
  274. this.$message.success("复制成功!");
  275. },
  276. // 字符转义
  277. escapeHTML(a) {
  278. a = "" + a;
  279. return a.replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, "\"").replace(/&apos;/g, "'");
  280. ;
  281. },
  282. },
  283. })
  284. </script>
  285. @endsection