special-list.blade.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426
  1. @extends('layouts.base')
  2. @section('title', "专题管理")
  3. @section('content')
  4. <link rel="stylesheet" href="{{resource_get('plugins/store-cashier/src/common/static/index.css')}}">
  5. <style>
  6. .edit-i{display:none;}
  7. .el-table_1_column_2:hover .edit-i{font-weight:900;padding:0;margin:0;display:inline-block;}
  8. .el-tabs__item,.is-top{font-size:16px}
  9. .el-tabs__active-bar { height: 3px;}
  10. </style>
  11. <div class="all">
  12. <div id="app" v-cloak>
  13. <div class="vue-crumbs">
  14. 案例库 > 专题管理
  15. </div>
  16. <div class="vue-head">
  17. <div class="vue-main-title" style="margin-bottom:20px">
  18. <div class="vue-main-title-left"></div>
  19. <div class="vue-main-title-content">专题管理</div>
  20. <div class="vue-main-title-button">
  21. <el-button type="primary" plain icon="el-icon-plus" size="small" @click="addModal">添加专题</el-button>
  22. </div>
  23. </div>
  24. <div class="vue-search">
  25. <el-form :inline="true" :model="search_form" class="demo-form-inline">
  26. <el-form-item label="">
  27. <el-input v-model="search_form.special_name" placeholder="专题名称"></el-input>
  28. </el-form-item>
  29. <el-form-item label="">
  30. <el-select v-model="search_form.is_open" clearable placeholder="状态">
  31. <el-option label="启用中" value="1"></el-option>
  32. <el-option label="未启用" value="0"></el-option>
  33. </el-select>
  34. </el-form-item>
  35. <el-form-item label="">
  36. <el-select v-model="search_form.is_hot" clearable placeholder="是否热门">
  37. <el-option label="是" value="1"></el-option>
  38. <el-option label="否" value="0"></el-option>
  39. </el-select>
  40. </el-form-item>
  41. <el-form-item label="创建时间">
  42. <el-date-picker
  43. v-model="times"
  44. type="datetimerange"
  45. value-format="yyyy-MM-dd HH:mm:ss"
  46. range-separator="至"
  47. start-placeholder="开始日期"
  48. end-placeholder="结束日期"
  49. style="margin-left:5px;"
  50. align="right">
  51. </el-date-picker>
  52. </el-form-item>
  53. <el-form-item label="">
  54. <el-button type="primary" @click="search(1)">搜索</el-button>
  55. </el-form-item>
  56. </el-form>
  57. </div>
  58. </div>
  59. <div class="vue-main">
  60. <div class="vue-main-form">
  61. <div class="vue-main-title" style="margin-bottom:20px">
  62. <div class="vue-main-title-left"></div>
  63. <div class="vue-main-title-content" style="flex:0 0 120px">专题列表</div>
  64. <div class="" style="text-align:left;font-size:14px;color:#999">
  65. <span>专题数量:[[count.total]]</span>&nbsp;&nbsp;&nbsp;
  66. <span>启用专题数量:[[count.success]]</span>&nbsp;&nbsp;&nbsp;
  67. </div>
  68. </div>
  69. <el-table :data="list" style="width: 100%">
  70. <el-table-column label="发布时间" align="center" prop="created_at" width="110">
  71. <template slot-scope="scope">
  72. <div>
  73. <div>[[scope.row.created_at]]</div>
  74. </div>
  75. </template>
  76. </el-table-column>
  77. <el-table-column label="名称" align="center" prop="special_name"></el-table-column>
  78. <el-table-column label="ID" align="center" prop="is_hot">
  79. <template slot="header" slot-scope="scope">
  80. <div>热门推荐</div>
  81. </template>
  82. <template slot-scope="scope">
  83. <el-switch v-model="scope.row.is_hot" :active-value="1" :inactive-value="0" @change="editStatus(scope.row.id,scope.$index,'is_hot')"></el-switch>
  84. </template>
  85. </el-table-column>
  86. <el-table-column label="案例数量" align="center" prop="case_count"></el-table-column>
  87. <el-table-column label="浏览量" align="center" prop="read_num"></el-table-column>
  88. <el-table-column label="ID" align="center" prop="id">
  89. <template slot="header" slot-scope="scope">
  90. <div>状态</div>
  91. </template>
  92. <template slot-scope="scope">
  93. <el-switch v-model="scope.row.is_open" :active-value="1" :inactive-value="0" @change="editStatus(scope.row.id,scope.$index,'is_open')"></el-switch><br />
  94. </template>
  95. </el-table-column>
  96. <el-table-column prop="refund_time" label="操作" align="center" width="250">
  97. <template slot-scope="scope">
  98. <el-link title="推广" :underline="false" @click="openShare(scope.row)" style="width:50px;">
  99. {{--<i class="iconfont icon-fontclass-fenxiang"></i>--}}推广
  100. </el-link>
  101. <el-link title="编辑" :underline="false" @click="gotoDetail(scope.row)" style="width:50px;">
  102. <i class="iconfont icon-ht_operation_edit"></i>
  103. </el-link>
  104. <el-link title="删除" :underline="false" @click="del(scope.row.id,scope.$index)" style="width:50px;">
  105. <i class="iconfont icon-ht_operation_delete"></i>
  106. </el-link>
  107. </template>
  108. </el-table-column>
  109. </el-table>
  110. </div>
  111. </div>
  112. <el-dialog title="推广" :visible.sync="share_show" width="800">
  113. <div style="display:flex">
  114. <div class="left" style="flex:2;text-align:left">
  115. <el-button type="text" @click="changeShare(1)" :style="{color:(share_index==1?'':'#333')}" style="font-size:18px">推广链接和二维码</el-button><br />
  116. <el-button type="text" @click="changeShare(2)" :style="{color:(share_index==2?'':'#333')}" style="font-size:18px" v-if="share_data.mini_show">微信小程序</el-button>
  117. </div>
  118. <div class="center" style="width:355px;height:550px;margin:0 20px" >
  119. <img :src="show_share_data.poster" alt="" style="width:100%;">
  120. </div>
  121. <div class="right" style="flex:3">
  122. <div>分享链接</div>
  123. <el-input v-model="show_share_data.url" style="width:70%" ref="url"></el-input>
  124. <el-button @click="copyLink('url')">复制</el-button>
  125. <div class="tip" style="margin:20px 0">可在微信好友、微信群、微博、QQ、知乎、短信群发等渠道推广,或者用户页面装修等!</div>
  126. <div>
  127. <el-button type="text" @click="download(show_share_data.poster,'poster')">下载海报</el-button>
  128. <el-button type="text" @click="download(show_share_data.qr_code,'qr_code')">下载二维码</el-button>
  129. </div>
  130. </div>
  131. </div>
  132. <span slot="footer" class="dialog-footer">
  133. <!-- <el-button @click="share_show = false">取 消</el-button> -->
  134. <!-- <el-button type="primary" @click="img_text_url = false">确 定</el-button> -->
  135. </span>
  136. </el-dialog>
  137. <!-- 分页 -->
  138. <div class="vue-page" v-if="total>0">
  139. <el-row>
  140. <el-col align="right">
  141. <el-pagination layout="prev, pager, next,jumper" @current-change="search" :total="total"
  142. :page-size="per_page" :current-page="current_page" background
  143. ></el-pagination>
  144. </el-col>
  145. </el-row>
  146. </div>
  147. </div>
  148. </div>
  149. <script>
  150. var app = new Vue({
  151. el: "#app",
  152. delimiters: ['[[', ']]'],
  153. name: 'test',
  154. data() {
  155. return {
  156. activeName:'2',
  157. street:0,
  158. list:[],
  159. change_sort:'',
  160. times:[],
  161. category_list:[
  162. ],
  163. province_list:[],
  164. city_list : [],
  165. search_form:{
  166. special_name:"",
  167. is_open:"",
  168. is_hot:"",
  169. },
  170. share_data : {
  171. mini:{},
  172. h5:{},
  173. mini_show:0
  174. },
  175. show_share_data : {
  176. url:"",
  177. qr_code:"",
  178. poster:""
  179. },
  180. // 统计
  181. count:{
  182. success: 0,
  183. total: 0,
  184. },
  185. share_show:false,
  186. share_index:1,
  187. rules: {},
  188. current_page:1,
  189. total:1,
  190. per_page:1,
  191. }
  192. },
  193. created() {
  194. },
  195. mounted() {
  196. this.getData(1);
  197. },
  198. methods: {
  199. getData(page) {
  200. console.log(this.times)
  201. let json = {
  202. page:page,
  203. search:{
  204. special_name:this.search_form.special_name,
  205. is_open:this.search_form.is_open,
  206. is_hot:this.search_form.is_hot,
  207. }
  208. };
  209. if(this.times && this.times.length>0) {
  210. // json.start_time = this.times[0]/1000;
  211. // json.end_time = this.times[0]/1000;
  212. json.search.timeStart = this.times[0];
  213. json.search.timeEnd = this.times[1];
  214. }
  215. console.log(json)
  216. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  217. this.$http.post('{!! yzWebFullUrl('plugin.case-library.admin.special.special-list') !!}',json).then(function(response) {
  218. if (response.data.result) {
  219. this.list = response.data.data.list.data;
  220. this.count.success = response.data.data.is_open;
  221. this.count.total = response.data.data.total;
  222. this.current_page=response.data.data.list.current_page;
  223. this.total=response.data.data.list.total;
  224. this.per_page=response.data.data.list.per_page;
  225. loading.close();
  226. } else {
  227. this.$message({
  228. message: response.data.msg,
  229. type: 'error'
  230. });
  231. }
  232. loading.close();
  233. }, function(response) {
  234. this.$message({
  235. message: response.data.msg,
  236. type: 'error'
  237. });
  238. loading.close();
  239. });
  240. },
  241. editStatus(id,index,type){
  242. let json = {
  243. id:id,
  244. type:type
  245. }
  246. if(type == 'is_hot'){
  247. json.status = this.list[index].is_hot;
  248. }else {
  249. json.status = this.list[index].is_open;
  250. }
  251. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  252. this.$http.post('{!! yzWebFullUrl('plugin.case-library.admin.special.edit-special-status') !!}',json).then(function (response) {
  253. if (response.data.result){
  254. this.$message.success("操作成功");
  255. this.search(this.current_page);
  256. }
  257. else {
  258. this.$message.error( response.data.msg );
  259. }
  260. loading.close();
  261. },function (response) {
  262. this.$message.error(response.data.msg);
  263. loading.close();
  264. }
  265. );
  266. },
  267. initProvince(val) {
  268. console.log(val);
  269. this.areaLoading = true;
  270. this.$http.get("{!! yzWebUrl('area.list.init', ['area_ids'=>'']) !!}"+val).then(response => {
  271. this.province_list = response.data.data;
  272. this.areaLoading = false;
  273. }, response => {
  274. this.areaLoading = false;
  275. });
  276. },
  277. changeProvince(val) {
  278. this.city_list = [];
  279. this.district_list = [];
  280. this.street_list = [];
  281. // this.search_form.province_id = "";
  282. this.search_form.city_id = "";
  283. this.search_form.district_id = "";
  284. this.search_form.street_id = "";
  285. this.areaLoading = true;
  286. let url = "<?php echo yzWebUrl('area.list', ['parent_id'=> '']); ?>" + val;
  287. this.$http.get(url).then(response => {
  288. if (response.data.data.length) {
  289. this.city_list = response.data.data;
  290. } else {
  291. this.city_list = null;
  292. }
  293. this.areaLoading = false;
  294. }, response => {
  295. this.areaLoading = false;
  296. });
  297. },
  298. gotoDetail(item) {
  299. let link = `{!! yzWebFullUrl('plugin.case-library.admin.special.special-edit') !!}`+`&id=`+item.id;
  300. window.location.href = link;
  301. },
  302. addModal() {
  303. let link = `{!! yzWebFullUrl('plugin.case-library.admin.special.special-add') !!}`;
  304. console.log(link);
  305. window.location.href = link;
  306. },
  307. gotoMember(id) {
  308. window.location.href = `{!! yzWebFullUrl('member.member.detail') !!}`+`&id=`+id;
  309. },
  310. openShare(id) {
  311. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  312. this.$http.post('{!! yzWebFullUrl('plugin.case-library.admin.special.special-extension') !!}',{id:id}).then(function (response) {
  313. if (response.data.result){
  314. this.share_index = 1;
  315. this.share_data.h5 = response.data.data.h5;
  316. this.share_data.mini = response.data.data.mini;
  317. this.share_data.mini_show = response.data.data.mini_show;
  318. this.show_share_data = this.share_data.h5;
  319. this.share_show = true;
  320. }
  321. else {
  322. this.$message.error( response.data.msg );
  323. }
  324. loading.close();
  325. },function (response) {
  326. this.$message.error(response.data.msg);
  327. this.share_show = false;
  328. loading.close();
  329. }
  330. );
  331. },
  332. changeShare(index) {
  333. this.share_index = index;
  334. if(index == 1){
  335. this.show_share_data = this.share_data.h5;
  336. }else if(index == 2 && this.share_data.mini_show) {
  337. this.show_share_data = this.share_data.mini;
  338. }
  339. },
  340. search(val) {
  341. this.getData(val);
  342. },
  343. pass(id) {
  344. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  345. this.$http.post('{!! yzWebFullUrl('plugin.store-cashier.admin.store-apply.accept') !!}',{id:id}).then(function (response) {
  346. if (response.data.result){
  347. this.$message.success("操作成功");
  348. this.search(this.current_page);
  349. }
  350. else {
  351. this.$message.error( response.data.msg );
  352. }
  353. loading.close();
  354. },function (response) {
  355. this.$message.error(response.data.msg);
  356. loading.close();
  357. }
  358. );
  359. },
  360. reject(id) {
  361. this.$confirm('确定驳回吗', '提示', {confirmButtonText: '确定',cancelButtonText: '取消',type: 'warning'}).then(() => {
  362. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  363. this.$http.post('{!! yzWebFullUrl('plugin.store-cashier.admin.store-apply.reject') !!}',{id:id}).then(function (response) {
  364. if (response.data.result){
  365. this.$message.success("操作成功");
  366. this.search(this.current_page);
  367. }
  368. else {
  369. this.$message.error( response.data.msg );
  370. }
  371. loading.close();
  372. },function (response) {
  373. this.$message.error(response.data.msg);
  374. loading.close();
  375. }
  376. );
  377. }).catch(() => {
  378. this.$message({type: 'info',message: '已取消驳回'});
  379. });
  380. },
  381. del(id) {
  382. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  383. this.$http.post('{!! yzWebFullUrl('plugin.case-library.admin.special.special-del') !!}',{id:id}).then(function (response) {
  384. if (response.data.result){
  385. this.$message.success("操作成功");
  386. this.search(this.current_page);
  387. }
  388. else {
  389. this.$message.error( response.data.msg );
  390. }
  391. loading.close();
  392. },function (response) {
  393. this.$message.error(response.data.msg);
  394. loading.close();
  395. }
  396. );
  397. },
  398. copyLink(type) {
  399. this.$refs[type].select();
  400. document.execCommand("Copy")
  401. this.$message.success("复制成功!");
  402. },
  403. download(href, name) {
  404. let eleLink = document.createElement("a");
  405. eleLink.download = name;
  406. eleLink.href = href;
  407. eleLink.click();
  408. eleLink.remove();
  409. },
  410. },
  411. })
  412. </script>
  413. @endsection