rank.blade.php 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. @extends('layouts.base')
  2. @section('title', '榜单管理')
  3. @section('content')
  4. <link rel="stylesheet" type="text/css" href="{{static_url('yunshop/goods/vue-ohter.css')}}"/>
  5. <style>
  6. </style>
  7. <div id='re_content'>
  8. <div class="con">
  9. <div class="setting">
  10. <div class="block">
  11. <el-form label-width="10%">
  12. <div class="title" style="justify-content: space-between;">
  13. <div style="display:flex;align-items:center;"><span
  14. style="width: 4px;height: 18px;background-color: #29ba9c;margin-right:15px;display:inline-block;"></span><b>榜单管理</b>
  15. </div>
  16. <a href="{!! yzWebFullUrl('plugin.goods-ranking.admin.rank.add-page') !!} ">
  17. <el-button size="mini" type="primary">添加榜单</el-button>
  18. </a></div>
  19. <el-input v-model="search_form.name" style="width:15%;margin-right:16px;"
  20. placeholder="榜单名称"></el-input>
  21. <el-select v-model="search_form.rank_type" placeholder="排行周期"
  22. style="margin-right:16px;width:12%;" clearable>
  23. <el-option
  24. v-for="item in options"
  25. :key="item.id"
  26. :label="item.label"
  27. :value="item.id">
  28. </el-option>
  29. </el-select>
  30. <a>
  31. <el-button type="primary" icon="el-icon-search" @click="search()">搜索</el-button>
  32. </a>
  33. <div style="margin: 10px;">
  34. <a>
  35. <el-button size="mini" type="primary" @click="statistics(1)">统计天榜单数据</el-button>
  36. </a>
  37. <a>
  38. <el-button size="mini" type="primary" @click="statistics(2)">统计周榜单数据</el-button>
  39. </a>
  40. <a>
  41. <el-button size="mini" type="primary" @click="statistics(3)">统计月榜单数据</el-button>
  42. </a>
  43. <a>
  44. <el-button size="mini" type="primary" @click="statistics(4)">统计季度榜单数据</el-button>
  45. </a>
  46. </div>
  47. </el-form>
  48. </div>
  49. <div style="background: #eff3f6;width:100%;height:15px;"></div>
  50. <div class="block">
  51. <div class="title">
  52. <div style="display:flex;align-items:center;"><span
  53. style="width: 4px;height: 18px;background-color: #29ba9c;margin-right:15px;display:inline-block;"></span><b>榜单列表</b>
  54. </div>
  55. </div>
  56. </div>
  57. <template style="margin-top:-10px;">
  58. <el-table
  59. :data="tableData"
  60. style="padding:0 10px"
  61. >
  62. <el-table-column
  63. prop="id"
  64. align="center"
  65. label="榜单ID"
  66. >
  67. </el-table-column>
  68. <el-table-column
  69. prop="name"
  70. align="center"
  71. label="榜单名称"
  72. >
  73. </el-table-column>
  74. <el-table-column
  75. prop="created_at"
  76. align="center"
  77. label="添加时间"
  78. >
  79. <template slot-scope="scope">
  80. [[scope.row.created_at]]
  81. </template>
  82. </el-table-column>
  83. <el-table-column
  84. prop="show_count"
  85. align="center"
  86. label="榜单商品数量"
  87. >
  88. </el-table-column>
  89. <el-table-column
  90. prop="rank_type"
  91. align="center"
  92. label="排行方式"
  93. >
  94. <template slot-scope="scope">
  95. <div v-if="scope.row.rank_type==1">天</div>
  96. <div v-if="scope.row.rank_type==2">周</div>
  97. <div v-if="scope.row.rank_type==3">月</div>
  98. <div v-if="scope.row.rank_type==4">季度</div>
  99. </template>
  100. </el-table-column>
  101. <el-table-column
  102. align="center"
  103. label="操作"
  104. >
  105. <template slot-scope="scope">
  106. <el-button size="mini" style="margin-right: 10px;" @click="openDia(scope.row)">推广
  107. </el-button>
  108. <el-button size="mini" style="margin-right: 10px;" @click="goEdit(scope.row)">编辑
  109. </el-button>
  110. <el-button size="mini" style="margin-right: 10px;" @click="del(scope, tableData)">删除
  111. </el-button>
  112. </template>
  113. </el-table-column>
  114. </el-table>
  115. <el-row style="background-color:#fff;">
  116. <el-col :span="24" align="center" migra style="padding:15px 5% 15px 0" v-loading="loading">
  117. <el-pagination background @current-change="currentChange"
  118. :current-page="current_page"
  119. layout="prev, pager, next"
  120. :page-size="Number(page_size)" :current-page="current_page"
  121. :total="page_total"></el-pagination>
  122. </el-col>
  123. </el-row>
  124. </template>
  125. </div>
  126. <el-dialog
  127. center
  128. title="推广"
  129. :visible.sync="dialogVisible"
  130. width="60%">
  131. <template>
  132. <el-radio-group v-model="activeName">
  133. <el-radio-button label="one">推广链接</el-radio-button>
  134. <el-radio-button label="second">微信小程序</el-radio-button>
  135. </el-radio-group>
  136. </template>
  137. <div v-if="activeName=='one'" style="display:flex;margin-top:20px;">
  138. {{-- <div><img :src="`${obj.extension_poster}?${Date.now()}`" style="width: 298px;height: 418px;"></div>--}}
  139. <div class="right" style="margin-left:20px;">
  140. <div style="margin-bottom:20px;">分享链接</div>
  141. <div style="display:flex;">
  142. <el-input type="text" v-model="obj.extension_url" ref="extension_url"></el-input>
  143. <el-button @click="copy_two" type="primary" size="small">复制链接</el-button>
  144. </div>
  145. <div class="tips" style="margin-top:20px;margin-bottom:20px;">
  146. 可在微信好友、微信群、微博、QQ、知乎、短信群发等渠道推广,或者用户页面装修等!
  147. </div>
  148. {{-- <div style="display:flex;">--}}
  149. {{-- <el-button type="primary" size="small" style="margin-right:20px;" @click="download(1)">--}}
  150. {{-- 下载海报--}}
  151. {{-- </el-button>--}}
  152. {{-- <el-button type="primary" size="small" @click="download(2)">下载二维码</el-button>--}}
  153. {{-- </div>--}}
  154. </div>
  155. </div>
  156. <div v-if="activeName=='second'" style="display:flex;margin-top:20px;">
  157. {{-- <div><img :src="`${obj.applets_poster}?${Date.now()}`" style="width: 298px;height: 418px;"></div>--}}
  158. <div class="right" style="margin-left:20px;">
  159. <div style="margin-bottom:20px;">小程序路径</div>
  160. <div style="display:flex;">
  161. <el-input type="text" v-model="obj.applets_url" ref="applets_url"></el-input>
  162. <el-button @click="copy" type="primary" size="small">复制链接</el-button>
  163. </div>
  164. <div class="tips" style="margin-top:20px;margin-bottom:20px;">
  165. 可在微信好友、微信群、微博、QQ、知乎、短信群发等渠道推广,或者用户页面装修等!
  166. </div>
  167. {{-- <div style="display:flex;">--}}
  168. {{-- <el-button type="primary" size="small" style="margin-right:20px;" @click="download(3)">--}}
  169. {{-- 下载海报--}}
  170. {{-- </el-button>--}}
  171. {{-- <el-button type="primary" size="small" @click="download(4)">下载二维码</el-button>--}}
  172. {{-- </div>--}}
  173. </div>
  174. </div>
  175. </el-dialog>
  176. </div>
  177. </div>
  178. <script>
  179. var vm = new Vue({
  180. el: "#re_content",
  181. delimiters: ['[[', ']]'],
  182. data() {
  183. return {
  184. obj: {},
  185. activeName: 'one',
  186. loading: false,
  187. page_total: 0,
  188. page_size: 0,
  189. current_page: 0,
  190. dialogVisible: false,
  191. options: [
  192. {
  193. id: 1,
  194. label: '天'
  195. },
  196. {
  197. id: 2,
  198. label: '周'
  199. },
  200. {
  201. id: 3,
  202. label: '月'
  203. },
  204. {
  205. id: 4,
  206. label: '季度'
  207. },
  208. ],
  209. report_id: '',
  210. times: [],
  211. search_loading: false,
  212. all_loading: false,
  213. info: {},
  214. search_form: {
  215. name: '',
  216. rank_type: ''
  217. },
  218. real_search_form: {},
  219. tableData: []
  220. }
  221. },
  222. mounted() {
  223. this.search();
  224. },
  225. methods: {
  226. copy_two() {
  227. that = this;
  228. let Url = that.$refs['extension_url'];
  229. Url.select(); // 选择对象
  230. document.execCommand("Copy", false);
  231. that.$message({message: "复制成功!", type: "success"});
  232. },
  233. copy() {
  234. that = this;
  235. let Url = that.$refs['applets_url'];
  236. Url.select(); // 选择对象
  237. document.execCommand("Copy", false);
  238. that.$message({message: "复制成功!", type: "success"});
  239. },
  240. {{--download(type) {--}}
  241. {{-- var url = '{!! yzWebFullUrl('plugin.pack-fixed-price.admin.download.download') !!}' + '&id=' + this.obj.id + '&type=' + type;--}}
  242. {{-- var a = document.createElement('a');--}}
  243. {{-- a.target = "_blank";--}}
  244. {{-- a.href = url;--}}
  245. {{-- a.click();--}}
  246. {{--},--}}
  247. openDia(item) {
  248. this.activeName = "one"
  249. this.obj = item;
  250. this.dialogVisible = true
  251. },
  252. del(scope, rows) {
  253. this.$confirm('是否删除?', '提示', {
  254. confirmButtonText: '确定',
  255. cancelButtonText: '取消',
  256. type: 'warning'
  257. }).then(() => {
  258. rows.splice(scope.$index, 1);
  259. let json = {
  260. id: scope.row.id
  261. }
  262. this.$http.post('{!! yzWebFullUrl('plugin.goods-ranking.admin.rank.delete') !!}', json).then(function (response) {
  263. if (response.data.result) {
  264. this.$message({message: "删除成功", type: "success"});
  265. this.loading = false;
  266. } else {
  267. this.$message({message: response.data.msg, type: 'error'});
  268. }
  269. }, function (response) {
  270. console.log(response);
  271. this.loading = false;
  272. }
  273. );
  274. }).catch(() => {
  275. this.$message({
  276. type: 'info',
  277. message: '已取消操作'
  278. });
  279. });
  280. },
  281. goEdit(item) {
  282. let link = `{!! yzWebFullUrl('plugin.goods-ranking.admin.rank.add-page') !!}` + `&id=` + item.id;
  283. window.location.href = link;
  284. },
  285. search() {
  286. this.search_loading = true;
  287. let json = {
  288. search: this.search_form,
  289. }
  290. this.$http.post('{!! yzWebFullUrl('plugin.goods-ranking.admin.rank.get-list') !!}', json
  291. ).then(function (response) {
  292. if (response.data.result) {
  293. let datas = response.data.data;
  294. this.tableData = datas.data
  295. this.page_total = datas.total;
  296. this.page_size = datas.per_page;
  297. this.current_page = datas.current_page;
  298. this.loading = false;
  299. this.real_search_form = Object.assign({}, this.search_form);
  300. } else {
  301. this.$message({message: response.data.msg, type: 'error'});
  302. }
  303. this.search_loading = false;
  304. }, function (response) {
  305. this.search_loading = false;
  306. this.$message({message: response.data.msg, type: 'error'});
  307. }
  308. );
  309. },
  310. statistics(val) {
  311. var url = '';
  312. if (val == 1) {
  313. url = '{!! yzWebFullUrl('plugin.goods-ranking.admin.rank.day') !!}';
  314. } else if (val == 2) {
  315. url = '{!! yzWebFullUrl('plugin.goods-ranking.admin.rank.week') !!}';
  316. } else if (val == 3) {
  317. url = '{!! yzWebFullUrl('plugin.goods-ranking.admin.rank.month') !!}';
  318. } else if (val == 4) {
  319. url = '{!! yzWebFullUrl('plugin.goods-ranking.admin.rank.quarter') !!}';
  320. } else {
  321. return;
  322. }
  323. this.$http.post(url).then(function (response) {
  324. if (response.data.result) {
  325. this.$message({message: "成功", type: "success"});
  326. } else {
  327. this.$message({message: response.data.msg, type: 'error'});
  328. }
  329. }, function (response) {
  330. this.$message({message: response.data.msg, type: 'error'});
  331. }
  332. );
  333. },
  334. currentChange(val) {
  335. this.loading = true;
  336. this.$http.post('{!! yzWebFullUrl('plugin.goods-ranking.admin.rank.get-list') !!}', {
  337. page: val,
  338. search: this.real_search_form
  339. }).then(function (response) {
  340. if (response.data.result) {
  341. let datas = response.data.data;
  342. this.tableData = datas.data
  343. this.page_total = datas.total;
  344. this.page_size = datas.per_page;
  345. this.current_page = datas.current_page;
  346. this.loading = false;
  347. } else {
  348. this.$message({message: response.data.msg, type: 'error'});
  349. }
  350. }, function (response) {
  351. console.log(response);
  352. this.loading = false;
  353. }
  354. );
  355. },
  356. },
  357. });
  358. </script>
  359. @endsection