link-category-list.blade.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447
  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" type="text/css" href="{{static_url('yunshop/goods/vue-ohter.css')}}"/>
  6. <style>
  7. .edit-i {
  8. display: none;
  9. }
  10. .el-table_1_column_2:hover .edit-i {
  11. font-weight: 900;
  12. padding: 0;
  13. margin: 0;
  14. display: inline-block;
  15. }
  16. .el-tabs__item, .is-top {
  17. font-size: 16px
  18. }
  19. .el-tabs__active-bar {
  20. height: 3px;
  21. }
  22. /*.el-select .el-input {*/
  23. /* width: 120px;*/
  24. /*}*/
  25. .input-with-select .el-input-group__prepend {
  26. background-color: #fff;
  27. }
  28. </style>
  29. <div class="all">
  30. <div id="app" v-cloak>
  31. <div class="vue-head">
  32. <div class="title" v-if="parent_title" style="margin-bottom: 15px"><span
  33. style="width: 4px;height: 18px;background-color: #29ba9c;margin-right:15px;display:inline-block"></span><b>[[parent_title]]</b>
  34. </div>
  35. <div class="vue-search">
  36. <el-form :inline="true" :model="search_form" class="demo-form-inline">
  37. <el-form-item label="">
  38. <el-input v-model="search_form.id" placeholder="分类id"></el-input>
  39. </el-form-item>
  40. <el-form-item label="">
  41. <el-input v-model="search_form.title" placeholder="分类名"></el-input>
  42. </el-form-item>
  43. <el-form-item>
  44. <el-select v-model="search_form.is_show" placeholder="显示状态">
  45. <el-option
  46. v-for="(item,index) in show_arr"
  47. :key="index"
  48. :label="item.label"
  49. :value="item.value">
  50. </el-option>
  51. </el-select>
  52. </el-form-item>
  53. <el-form-item v-if="is_max">
  54. <el-select v-model="search_form.target_type" placeholder="类型">
  55. <el-option
  56. v-for="(item,index) in type_arr"
  57. :key="index"
  58. :label="item.label"
  59. :value="item.value">
  60. </el-option>
  61. </el-select>
  62. </el-form-item>
  63. <el-button type="primary" @click="changeForm()">搜索</el-button>
  64. </el-form>
  65. </div>
  66. </div>
  67. <div class="vue-main">
  68. <div class="vue-main-form">
  69. <div class="vue-main-title" style="margin-top:-10px">
  70. <div class="title">
  71. <span style="width: 4px;height: 18px;background-color: #29ba9c;margin-right:15px;display:inline-block;"></span><b>分类列表</b>
  72. <el-button style="margin-left: 10px" type="primary" @click="addCategory">添加分类</el-button>
  73. <el-button v-if="search_form.parent_id==0&&reset_state==0" style="margin-left: 10px"
  74. @click="resetCategory" :loading="resetRemindLoading">
  75. 基础数据
  76. </el-button>
  77. <el-button v-if="search_form.parent_id==0&&reset_state==1" style="margin-left: 10px"
  78. :disabled="true">
  79. 基础数据更新中,请勿修改
  80. </el-button>
  81. </div>
  82. </div>
  83. </div>
  84. <div style="margin-bottom:20px">
  85. </div>
  86. <el-table :data="list" style="width: 100%;" align="center" :fit="true" :row-style="{ height: '80px'}">
  87. <el-table-column style="min-height:100px;" min-width="15%" prop="id" label="ID"
  88. align="center"></el-table-column>
  89. <el-table-column style="min-height:100px;" min-width="15%" prop="sort" label="排序"
  90. align="center"></el-table-column>
  91. <el-table-column min-width="15%" prop="title" label="名称" align="center"></el-table-column>
  92. <el-table-column min-width="15%" label="图标" align="center">
  93. <template slot-scope="scope">
  94. <el-link target="_blank" :href="scope.row.cover">
  95. <el-image :src="scope.row.cover" style="height: 80px;width: 80px"></el-image>
  96. </el-link>
  97. </template>
  98. </el-table-column>
  99. <el-table-column v-if="!is_max" min-width="15%" prop="child_count" label="类目数量"
  100. align="center"></el-table-column>
  101. <el-table-column v-if="is_max" min-width="20%" prop="type_name"
  102. align="center" label="类型"></el-table-column>
  103. <el-table-column v-if="is_max" min-width="20%" align="center" label="参数值">
  104. <template slot-scope="scope">
  105. <div v-if="scope.row.target_type==-1 || scope.row.target_type==-2 || scope.row.target_type==-3">
  106. <p>
  107. <template v-if="scope.row.target_type==-1">淘宝</template>
  108. <template v-if="scope.row.target_type==-2">京东</template>
  109. <template v-if="scope.row.target_type==-3">拼多多</template>
  110. 关键词:[[scope.row.target.keyword]]
  111. </p>
  112. </div>
  113. <div v-if="scope.row.target_type==-4">
  114. <p>网页标题:[[scope.row.target.web_title]]</p>
  115. <p></p>
  116. <p>网页链接:[[scope.row.target.web_url]]</p>
  117. </div>
  118. <div v-if="scope.row.target_type==-5">
  119. <p>APP路径:[[scope.row.target.app_route]]</p>
  120. </div>
  121. <div v-if="scope.row.target_type==-6">
  122. <p>小程序路径:[[scope.row.target.mini_route]]</p>
  123. </div>
  124. <div v-if="scope.row.target_type==-7">
  125. <p>品牌券id:[[scope.row.target.brand_id]]</p>
  126. </div>
  127. <div v-if="scope.row.target_type==-8">
  128. <p>品牌券商品id:[[scope.row.target.brand_goods_id]]</p>
  129. </div>
  130. <div v-if="scope.row.target_type==-9">
  131. <p>
  132. <template v-if="scope.row.target.another_plat==1">淘宝</template>
  133. <template v-if="scope.row.target.another_plat==3">京东</template>
  134. 活动:[[scope.row.target.activity_info]]
  135. </p>
  136. </div>
  137. <div v-if="scope.row.target_type==-10">
  138. <p>
  139. <template v-if="scope.row.target.list_type==1">淘宝特色物料 -
  140. [[scope.row.target.list_id]]]
  141. </template>
  142. <template v-if="scope.row.target.list_type==2">京东特色列表 - [[
  143. jd_special_url_type[scope.row.target.list_id] ]]
  144. </template>
  145. <template v-if="scope.row.target.list_type==3">拼多多特色列表 - [[
  146. pdd_special_url_type[scope.row.target.list_id] ]]
  147. </template>
  148. <template v-if="scope.row.target.list_type==4">拼多多爆款排行</template>
  149. </p>
  150. </div>
  151. <div v-if="scope.row.target_type==-11">
  152. <p>
  153. <template v-if="scope.row.target.album_type==1">专辑列表</template>
  154. <template v-if="scope.row.target.album_type==2">专辑详情:[[scope.row.target.album_id]]
  155. </template>
  156. </p>
  157. </div>
  158. <div v-if="scope.row.target_type==-12">
  159. <p>
  160. APP路径 - [[scope.row.target.app_path]]
  161. APP参数:[[scope.row.target.pathParam]]
  162. </p>
  163. </div>
  164. </template>
  165. </el-table-column>
  166. <el-table-column min-width="15%" label="显示状态" align="center">
  167. <template slot-scope="scope">
  168. <el-switch
  169. :active-value="1"
  170. :inactive-value="0"
  171. v-model="scope.row.is_show"
  172. active-color="#13ce66"
  173. inactive-color="#545454"
  174. @change="changeShowState(scope.row)"
  175. >
  176. </el-switch>
  177. </template>
  178. </el-table-column>
  179. <el-table-column min-width="20%" label="操作" align="center">
  180. <template slot-scope="scope">
  181. <el-button v-if="!is_max" @click="childList(scope.row)" type="primary"
  182. icon="el-icon-s-promotion"
  183. circle></el-button>
  184. <el-button type="" @click="editCategory(scope.row)" icon="el-icon-edit-outline"
  185. circle></el-button>
  186. <el-button @click="deleteCategory(scope.row)" type="danger"
  187. icon="el-icon-delete-solid" circle></el-button>
  188. </template>
  189. </el-table-column>
  190. </el-table>
  191. </div>
  192. <div class="vue-page" v-if="total > 0">
  193. <el-row>
  194. <el-col align="right">
  195. <el-pagination layout="prev, pager, next,jumper" @current-change="getData" :total="total"
  196. :page-size="per_page" :current-page="current_page" background
  197. ></el-pagination>
  198. </el-col>
  199. </el-row>
  200. </div>
  201. </div>
  202. <!-- 分页 -->
  203. </div>
  204. </div>
  205. <script>
  206. var app = new Vue({
  207. el: "#app",
  208. delimiters: ['[[', ']]'],
  209. name: 'test',
  210. data() {
  211. let level = 1;
  212. let parent_id = 0;
  213. if (this.checkEmpty("{!! $_GET['level'] !!}")) {
  214. level = "{!! $_GET['level'] !!}";
  215. }
  216. if (this.checkEmpty("{!! $_GET['parent_id'] !!}")) {
  217. parent_id = "{!! $_GET['parent_id'] !!}";
  218. }
  219. return {
  220. list: [],
  221. total: 1,
  222. per_page: 1,
  223. current_page: 1,
  224. reset_state: 0,
  225. resetRemindLoading: false,
  226. max_level: '3',
  227. is_max: 0,
  228. parent_title: '',
  229. search_form: {
  230. 'title': '',
  231. 'parent_title': '',
  232. 'id': '',
  233. 'parent_id': parent_id,
  234. 'level': level,
  235. 'is_show': '-1',
  236. 'target_type': '-999'
  237. },
  238. show_arr: [
  239. {value: '-1', label: '显示状态'},
  240. {value: '0', label: '不显示'},
  241. {value: '1', label: '显示'}
  242. ],
  243. type_arr: [
  244. {value: '-999', label: '类型'},
  245. {value: '-1', label: '淘宝'},
  246. {value: '-2', label: '京东'},
  247. {value: '-3', label: '拼多多'},
  248. {value: '-4', label: '网页'},
  249. {value: '-5', label: '自定义'},
  250. {value: '-6', label: '小程序'},
  251. {value: '-7', label: '品牌券'},
  252. {value: '-8', label: '品牌券商品'},
  253. {value: '-9', label: '京东/淘宝官方活动'},
  254. {value: '-10', label: '特色商品资源'},
  255. {value: '-11', label: '专辑'},
  256. ],
  257. search_data: {},
  258. taobao_special_url_type: {!! $taobao_special_url_type !!},
  259. jd_special_url_type:{!! $jd_special_url_type !!},
  260. pdd_special_url_type:{!! $pdd_special_url_type !!},
  261. }
  262. },
  263. created() {
  264. },
  265. mounted() {
  266. this.changeForm();
  267. },
  268. methods: {
  269. resetCategory: function () {
  270. this.$confirm('确定要追加预设分类数据吗?', '提示', {
  271. confirmButtonText: '确认',
  272. cancelButtonText: '取消',
  273. type: 'warning',
  274. // dangerouslyUseHTMLString:true
  275. }).then(() => {
  276. this.resetRemindLoading = true;
  277. // this.$message({message: '开始追加数据,过程可能需要20-30分钟,请耐心等候,过程中请勿修改分类数据', type: 'success'});
  278. this.$http.post('{!! yzWebFullUrl('plugin.aggregation-cps.admin.link-category.resetCategory') !!}', {}
  279. ).then(function (response) {
  280. console.log(response);
  281. if (response.data.result) {
  282. this.$message({message: response.data.msg, type: 'success'});
  283. this.search();
  284. this.resetRemindLoading = false;
  285. } else {
  286. this.$message({message: response.data.msg, type: 'error'});
  287. this.search();
  288. this.resetRemindLoading = false;
  289. }
  290. }, function (response) {
  291. this.$message({message: response.data.msg, type: 'error'});
  292. this.search();
  293. });
  294. }).catch(() => {
  295. this.$message({message: '已取消操作'});
  296. });
  297. },
  298. deleteCategory: function (data) {
  299. var mes = '确定删除分类吗?';
  300. if (data.has_many_child_category.length != 0) {
  301. mes = '该分类存在下级分类,' + mes;
  302. }
  303. this.$confirm(mes, '提示', {
  304. confirmButtonText: '确认',
  305. cancelButtonText: '取消',
  306. type: 'warning',
  307. // dangerouslyUseHTMLString:true
  308. }).then(() => {
  309. this.$http.post('{!! yzWebFullUrl('plugin.aggregation-cps.admin.link-category.deleteCategory') !!}', {
  310. 'id': data.id,
  311. }).then(function (response) {
  312. console.log(response);
  313. if (response.data.result) {
  314. this.$message({message: response.data.msg, type: 'success'});
  315. this.search();
  316. } else {
  317. this.$message({message: response.data.msg, type: 'error'});
  318. this.search();
  319. }
  320. }, function (response) {
  321. this.$message({message: response.data.msg, type: 'error'});
  322. this.search();
  323. });
  324. }).catch(() => {
  325. this.$message({message: '已取消操作'});
  326. });
  327. },
  328. editCategory: function (data) {
  329. var url = "{!! yzWebUrl('plugin.aggregation-cps.admin.link-category.edit') !!}" + '&id=' + data.id;
  330. window.location.href = url;
  331. // window.open(url);
  332. },
  333. addCategory: function () {
  334. var url = "{!! yzWebUrl('plugin.aggregation-cps.admin.link-category.edit') !!}" + '&parent_id=' + this.search_data.parent_id;
  335. window.location.href = url;
  336. // window.open(url);
  337. },
  338. childList: function (data) {
  339. var level = data.level + 1;
  340. var url = "{!! yzWebUrl('plugin.aggregation-cps.admin.link-category.index') !!}" + '&level=' + level + '&parent_id=' + data.id;
  341. window.open(url);
  342. },
  343. checkEmpty: function (val) {
  344. if (val != 'undefined' && val != null && val != '0' && val != 0 && val != '') {
  345. return true;
  346. }
  347. return false;
  348. },
  349. copyUrl: function (url, msg) {
  350. let oInput = document.createElement('input');
  351. oInput.value = url;
  352. document.body.appendChild(oInput);
  353. oInput.select(); // 选择对象;
  354. console.log(oInput.value);
  355. document.execCommand("Copy"); // 执行浏览器复制命令
  356. this.$message({message: msg, type: 'success'});
  357. oInput.remove()
  358. },
  359. openUrl: function (url) {
  360. window.open(url);
  361. },
  362. showAppModal: function () {
  363. this.app_list = [];
  364. this.app_show = true;
  365. this.app_modal_text1 = true;
  366. this.app_modal_text2 = false;
  367. this.showUploaderEl = true;
  368. },
  369. changeShowState: function (data) {
  370. var is_show = data.is_show;
  371. this.$http.post('{!! yzWebFullUrl('plugin.aggregation-cps.admin.link-category.changeShowState') !!}', {
  372. 'id': data.id, 'is_show': is_show
  373. }).then(function (response) {
  374. console.log(response);
  375. if (response.data.result) {
  376. this.$message({message: response.data.msg, type: 'success'});
  377. this.search();
  378. } else {
  379. this.$message({message: response.data.msg, type: 'error'});
  380. this.search();
  381. }
  382. }, function (response) {
  383. this.$message({message: response.data.msg, type: 'error'});
  384. this.search();
  385. });
  386. },
  387. search: function () {
  388. this.$http.post('{!! yzWebFullUrl('plugin.aggregation-cps.admin.link-category.index') !!}', {
  389. 'page': this.current_page,
  390. 'is_json': 1,
  391. 'search_data': this.search_data,
  392. }).then(function (response) {
  393. console.log(response);
  394. if (response.data.result) {
  395. let this_data = response.data.data.list;
  396. let setting = response.data.data.setting;
  397. this.parent_title = setting.parent_title;
  398. // this.parent_name = setting.parent_name;
  399. this.is_max = setting.is_max;
  400. this.max_level = setting.max_level;
  401. this.reset_state = setting.reset_state;
  402. this.current_page = this_data.current_page;
  403. this.list = this_data.data;
  404. this.total = this_data.total;
  405. this.per_page = this_data.per_page;
  406. } else {
  407. this.$message({message: response.data.msg, type: 'error'});
  408. }
  409. }, function (response) {
  410. this.$message({message: response.data.msg, type: 'error'});
  411. })
  412. },
  413. getData: function (val) {
  414. this.current_page = val;
  415. this.search();
  416. },
  417. changeForm: function () {
  418. this.search_data = this.search_form;
  419. this.current_page = 1;
  420. this.search();
  421. }
  422. },
  423. })
  424. </script>
  425. @endsection