activity-list.blade.php 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. @extends('layouts.base')
  2. @section('title', "盲盒管理")
  3. @section('content')
  4. <link rel="stylesheet" href="{{resource_get('plugins/blind-box/views/admin/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. </div>
  22. </div>
  23. <div class="vue-search">
  24. <el-form :inline="true" :model="search_form" class="demo-form-inline">
  25. <el-form-item label="">
  26. <el-input v-model="search_form.id" placeholder="活动ID"></el-input>
  27. </el-form-item>
  28. <el-form-item label="">
  29. <el-input v-model="search_form.name" placeholder="活动名称"></el-input>
  30. </el-form-item>
  31. <el-form-item label="">
  32. <el-select v-model="search_form.activity_type" clearable placeholder="盲盒类型">
  33. <el-option label="付费" value="0"></el-option>
  34. <el-option label="免费" value="1"></el-option>
  35. </el-select>
  36. </el-form-item>
  37. <el-form-item label="">
  38. <el-button type="primary" @click="search(1)">搜索</el-button>
  39. </el-form-item>
  40. </el-form>
  41. </div>
  42. </div>
  43. <div class="vue-main">
  44. <div class="vue-main-form">
  45. <div class="vue-main-title" style="margin-bottom:20px">
  46. <div class="vue-main-title-left"></div>
  47. <div class="vue-main-title-content" style="flex:0 0 120px">盲盒列表</div>
  48. <div class="vue-main-title-button">
  49. <el-button type="primary" plain icon="el-icon-plus" size="small" @click="addModal">新增盲盒</el-button>
  50. </div>
  51. </div>
  52. <el-table :data="list" style="width: 100%">
  53. <el-table-column label="ID" align="center" prop="id"></el-table-column>
  54. <el-table-column label="活动名称" align="center" prop="activity_name"> </el-table-column>
  55. <el-table-column label="盲盒类型" align="center" prop="category">
  56. <template slot-scope="scope">
  57. <div >[[scope.row.activity_type?'免费':'付费']]</div>
  58. </template>
  59. </el-table-column>
  60. <el-table-column label="盲盒库存" align="center" prop="stock">
  61. <template slot-scope="scope">
  62. <div>
  63. <div>[[scope.row.goods.stock]]</div>
  64. </div>
  65. </template>
  66. </el-table-column>
  67. <el-table-column label="已发放盲盒数量" align="center" prop="sales">
  68. <template slot-scope="scope">
  69. <div>
  70. <div>[[scope.row.goods.show_sales]]</div>
  71. </div>
  72. </template>
  73. </el-table-column>
  74. <el-table-column label="活动时间" align="center" prop="created_at" width="110">
  75. <template slot-scope="scope">
  76. <div>
  77. <div>[[scope.row.activity_start]]至[[scope.row.activity_end]]</div>
  78. </div>
  79. </template>
  80. </el-table-column>
  81. <el-table-column label="状态" align="center" prop="is_open">
  82. <template slot="header" slot-scope="scope">
  83. <div>状态</div>
  84. </template>
  85. <template slot-scope="scope">
  86. <el-switch v-model="scope.row.is_open" :active-value="1" :inactive-value="0" @change="editStatus(scope.row.id,scope.$index)"></el-switch><br />
  87. </template>
  88. </el-table-column>
  89. <el-table-column prop="refund_time" label="操作" align="center" width="250">
  90. <template slot-scope="scope">
  91. <el-link title="推广" :underline="false" @click="openShare(scope.row.id)" style="width:50px;">
  92. 推广
  93. </el-link>
  94. <el-link title="数据" :underline="false" @click="openOrder(scope.row.id)" style="width:50px;">
  95. 数据
  96. </el-link>
  97. <el-link title="编辑" :underline="false" @click="gotoDetail(scope.row)" style="width:50px;">
  98. <i class="iconfont icon-ht_operation_edit"></i>
  99. </el-link>
  100. <el-link title="删除" :underline="false" @click="del(scope.row.id,scope.$index)" style="width:50px;">
  101. <i class="iconfont icon-ht_operation_delete"></i>
  102. </el-link>
  103. </template>
  104. </el-table-column>
  105. </el-table>
  106. </div>
  107. </div>
  108. <el-dialog title="推广" :visible.sync="share_show" width="800">
  109. <div style="display:flex">
  110. <div class="left" style="flex:2;text-align:left">
  111. <el-button type="text" @click="changeShare(1)" :style="{color:(share_index==1?'':'#333')}" style="font-size:18px">推广链接和二维码</el-button><br />
  112. <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>
  113. </div>
  114. <div class="center" style="width:355px;height:550px;margin:0 20px" >
  115. <img :src="show_share_data.poster" alt="" style="width:100%;">
  116. </div>
  117. <div class="right" style="flex:3">
  118. <div>分享链接</div>
  119. <el-input v-model="show_share_data.url" style="width:70%" ref="url"></el-input>
  120. <el-button @click="copyLink('url')">复制</el-button>
  121. <div class="tip" style="margin:20px 0">可在微信好友、微信群、微博、QQ、知乎、短信群发等渠道推广,或者用户页面装修等!</div>
  122. <div>
  123. <el-button type="text" @click="download(show_share_data.poster,'poster')">下载海报</el-button>
  124. <el-button type="text" @click="download(show_share_data.qr_code,'qr_code')">下载二维码</el-button>
  125. </div>
  126. </div>
  127. </div>
  128. <span slot="footer" class="dialog-footer">
  129. <!-- <el-button @click="share_show = false">取 消</el-button> -->
  130. <!-- <el-button type="primary" @click="img_text_url = false">确 定</el-button> -->
  131. </span>
  132. </el-dialog>
  133. <!-- 分页 -->
  134. <div class="vue-page" >
  135. <el-row>
  136. <el-col align="right">
  137. <el-pagination layout="prev, pager, next,jumper" @current-change="search" :total="total"
  138. :page-size="per_page" :current-page="current_page" background
  139. ></el-pagination>
  140. </el-col>
  141. </el-row>
  142. </div>
  143. </div>
  144. </div>
  145. <script>
  146. var app = new Vue({
  147. el: "#app",
  148. delimiters: ['[[', ']]'],
  149. name: 'test',
  150. data() {
  151. return {
  152. activeName:'2',
  153. street:0,
  154. list:[],
  155. change_sort:'',
  156. times:[],
  157. share_data : {
  158. mini:{},
  159. h5:{},
  160. mini_show:0
  161. },
  162. show_share_data : {
  163. url:"",
  164. qr_code:"",
  165. poster:""
  166. },
  167. search_form:{
  168. name:"",
  169. id:"",
  170. activity_type:"",
  171. },
  172. // 统计
  173. count:{
  174. success: 0,
  175. total: 0,
  176. },
  177. share_show:false,
  178. share_index:1,
  179. rules: {},
  180. current_page:1,
  181. total:1,
  182. per_page:1,
  183. }
  184. },
  185. created() {
  186. },
  187. mounted() {
  188. this.getData(1);
  189. },
  190. methods: {
  191. getData(page) {
  192. // console.log(this.times)
  193. let json = {
  194. page: page,
  195. search: {
  196. activity_type:this.search_form.activity_type,
  197. id:this.search_form.id,
  198. name:this.search_form.name,
  199. },
  200. };
  201. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  202. this.$http.post('{!! yzWebFullUrl('plugin.blind-box.admin.activity.activity-list') !!}',json).then(function(response) {
  203. if (response.data.result) {
  204. // console.log(response.data.data)
  205. this.list = response.data.data.data;
  206. this.current_page=response.data.data.current_page;
  207. this.total=response.data.data.total;
  208. this.per_page=response.data.data.per_page;
  209. this.count.total=response.data.data.total;
  210. loading.close();
  211. } else {
  212. this.$message({
  213. message: response.data.msg,
  214. type: 'error'
  215. });
  216. }
  217. loading.close();
  218. }, function(response) {
  219. this.$message({
  220. message: response.data.msg,
  221. type: 'error'
  222. });
  223. loading.close();
  224. });
  225. },
  226. editStatus(id,index){
  227. let json = {
  228. id:id,
  229. }
  230. json.status = this.list[index].is_open;
  231. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  232. this.$http.post('{!! yzWebFullUrl('plugin.blind-box.admin.activity.edit-activity-status') !!}',json).then(function (response) {
  233. if (response.data.result){
  234. this.$message.success("操作成功");
  235. this.search(this.current_page);
  236. }
  237. else {
  238. this.$message.error( response.data.msg );
  239. }
  240. loading.close();
  241. },function (response) {
  242. this.$message.error(response.data.msg);
  243. loading.close();
  244. }
  245. );
  246. },
  247. gotoDetail(item) {
  248. let link = `{!! yzWebFullUrl('plugin.blind-box.admin.activity.edit') !!}`+`&id=`+item.id;
  249. window.location.href = link;
  250. },
  251. addModal() {
  252. let link = `{!! yzWebFullUrl('plugin.blind-box.admin.activity.add') !!}`;
  253. // console.log(link);
  254. window.location.href = link;
  255. },
  256. openShare(id) {
  257. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  258. this.$http.post('{!! yzWebFullUrl('plugin.blind-box.admin.activity.extension') !!}',{id:id}).then(function (response) {
  259. if (response.data.result){
  260. this.share_index = 1;
  261. this.share_data.h5 = response.data.data.h5;
  262. this.share_data.mini = response.data.data.mini;
  263. this.share_data.mini_show = response.data.data.mini_show;
  264. this.show_share_data = this.share_data.h5;
  265. this.share_show = true;
  266. }
  267. else {
  268. this.$message.error( response.data.msg );
  269. }
  270. loading.close();
  271. },function (response) {
  272. this.$message.error(response.data.msg);
  273. this.share_show = false;
  274. loading.close();
  275. }
  276. );
  277. },
  278. openOrder(id){
  279. window.location = '{!! yzWebFullUrl('plugin.blind-box.admin.order-list.index') !!}&activity_id='+id;
  280. },
  281. changeShare(index) {
  282. this.share_index = index;
  283. if(index == 1){
  284. this.show_share_data = this.share_data.h5;
  285. }else if(index == 2 && this.share_data.mini_show) {
  286. this.show_share_data = this.share_data.mini;
  287. }
  288. },
  289. search(val) {
  290. this.getData(val);
  291. },
  292. del(id) {
  293. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  294. this.$http.post('{!! yzWebFullUrl('plugin.blind-box.admin.activity.del') !!}',{id:id}).then(function (response) {
  295. if (response.data.result){
  296. this.$message.success("操作成功");
  297. this.search(this.current_page);
  298. }
  299. else {
  300. this.$message.error( response.data.msg );
  301. }
  302. loading.close();
  303. },function (response) {
  304. this.$message.error(response.data.msg);
  305. loading.close();
  306. }
  307. );
  308. },
  309. copyLink(type) {
  310. this.$refs[type].select();
  311. document.execCommand("Copy")
  312. this.$message.success("复制成功!");
  313. },
  314. download(href, name) {
  315. let eleLink = document.createElement("a");
  316. eleLink.download = name;
  317. eleLink.href = href;
  318. eleLink.click();
  319. eleLink.remove();
  320. },
  321. },
  322. })
  323. </script>
  324. @endsection