manage.blade.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  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;"><div style="display:flex;align-items:center;"><span style="width: 4px;height: 18px;background-color: #29ba9c;margin-right:15px;display:inline-block;"></span><b>社区团购</b><span></div><a href="{!! yzWebFullUrl('plugin.package-deliver.admin.communityGroups.add') !!} "><el-button size="mini" type="primary">添加活动</el-button></a></div>
  13. <el-input v-model="search_form.title" style="width:15%;margin-right:16px;" placeholder="活动名称"></el-input>
  14. <el-select v-model="search_form.status" placeholder="请选择状态" style="margin-right:16px;width:12%;" clearable>
  15. <el-option
  16. v-for="item in options"
  17. :key="item.id"
  18. :label="item.label"
  19. :value="item.id">
  20. </el-option>
  21. </el-select>
  22. <a >
  23. <el-button type="primary" icon="el-icon-search" @click="search()">搜索</el-button>
  24. </a>
  25. <el-form>
  26. </div>
  27. <div style="background: #eff3f6;width:100%;height:15px;"></div>
  28. <div class="block">
  29. <div class="title"><div style="display:flex;align-items:center;"><span style="width: 4px;height: 18px;background-color: #29ba9c;margin-right:15px;display:inline-block;"></span><b>活动列表</b></div></div>
  30. </div>
  31. <template style="margin-top:-10px;">
  32. <el-table
  33. :data="tableData"
  34. style="padding:0 10px"
  35. >
  36. <el-table-column
  37. prop="title"
  38. align="center"
  39. label="活动名称"
  40. >
  41. </el-table-column>
  42. <el-table-column
  43. prop="status_name"
  44. align="center"
  45. label="状态"
  46. >
  47. </el-table-column>
  48. <el-table-column
  49. prop="start_time"
  50. align="center"
  51. label="活动时间"
  52. >
  53. <template slot-scope="scope" >
  54. [[scope.row.start_time]]至[[scope.row.end_time]]
  55. </template>
  56. </el-table-column>
  57. <el-table-column
  58. prop="paid_count"
  59. align="center"
  60. label="支付订单数"
  61. >
  62. <template slot-scope="scope" >
  63. [[scope.row.statistic.totalCount]]
  64. </template>
  65. </el-table-column>
  66. <el-table-column
  67. prop="paid_amount"
  68. align="center"
  69. label="实付金额(元) "
  70. >
  71. <template slot-scope="scope" >
  72. [[scope.row.statistic.totalPrice]]
  73. </template>
  74. </el-table-column>
  75. <el-table-column
  76. align="center"
  77. label="操作"
  78. >
  79. <template slot-scope="scope" >
  80. {{-- <el-button size="mini" style="margin-right: 10px;" v-if="scope.row.status==1" @click="openDia(scope.row)">推广</el-button>--}}
  81. <el-button size="mini" style="margin-right: 10px;" @click="goEdit(scope.row)">编辑</el-button>
  82. <el-button size="mini" style="margin-right: 10px;" v-if="scope.row.status==0" @click="close(scope, tableData)">解禁</el-button>
  83. <el-button size="mini" style="margin-right: 10px;" v-if="scope.row.status==1" @click="close(scope, tableData)">禁用</el-button>
  84. <el-button size="mini" style="margin-right: 10px;" v-if="scope.row.status==0" @click="del(scope, tableData)">删除</el-button>
  85. </template>
  86. </el-table-column>
  87. </el-table>
  88. <el-row style="background-color:#fff;">
  89. <el-col :span="24" align="center" migra style="padding:15px 5% 15px 0" v-loading="loading">
  90. <el-pagination background @current-change="currentChange"
  91. :current-page="current_page"
  92. layout="prev, pager, next"
  93. :page-size="Number(page_size)" :current-page="current_page" :total="page_total"></el-pagination>
  94. </el-col>
  95. </el-row>
  96. </template>
  97. </div>
  98. <el-dialog
  99. center
  100. title="推广"
  101. :visible.sync="dialogVisible"
  102. width="60%">
  103. <template>
  104. <el-radio-group v-model="activeName" >
  105. <el-radio-button label="one" >推广链接和二维码</el-radio-button>
  106. <el-radio-button label="second">微信小程序</el-radio-button>
  107. </el-radio-group>
  108. </template>
  109. <div v-if="activeName=='one'" style="display:flex;margin-top:20px;">
  110. <div><img :src="`${obj.extension_poster}?${Date.now()}`" style="width: 298px;height: 418px;"></div>
  111. <div class="right" style="margin-left:20px;">
  112. <div style="margin-bottom:20px;">分享链接</div>
  113. <div style="display:flex;"><el-input type="text" v-model="obj.extension_url" ref="extension_url"> </el-input><el-button @click="copy_two" type="primary" size="small">复制链接</el-button></div>
  114. <div class="tips" style="margin-top:20px;margin-bottom:20px;">可在微信好友、微信群、微博、QQ、知乎、短信群发等渠道推广,或者用户页面装修等!</div>
  115. <div style="display:flex;"><el-button type="primary" size="small" style="margin-right:20px;" @click="download(1)">下载海报</el-button> <el-button type="primary" size="small" @click="download(2)">下载二维码</el-button></div>
  116. </div>
  117. </div>
  118. <div v-if="activeName=='second'" style="display:flex;margin-top:20px;">
  119. <div><img :src="`${obj.applets_poster}?${Date.now()}`" style="width: 298px;height: 418px;"></div>
  120. <div class="right" style="margin-left:20px;">
  121. <div style="margin-bottom:20px;">小程序路径</div>
  122. <div style="display:flex;"><el-input type="text" v-model="obj.applets_url" ref="applets_url"> </el-input><el-button @click="copy" type="primary" size="small">复制链接</el-button></div>
  123. <div class="tips" style="margin-top:20px;margin-bottom:20px;">可在微信好友、微信群、微博、QQ、知乎、短信群发等渠道推广,或者用户页面装修等!</div>
  124. <div style="display:flex;"><el-button type="primary" size="small" style="margin-right:20px;" @click="download(3)">下载海报</el-button> <el-button type="primary" size="small" @click="download(4)">下载二维码</el-button></div>
  125. </div>
  126. </div>
  127. </el-dialog>
  128. </div>
  129. </div>
  130. <script>
  131. var vm = new Vue({
  132. el: "#re_content",
  133. delimiters: ['[[', ']]'],
  134. data() {
  135. return {
  136. obj:{},
  137. activeName:'one',
  138. loading:false,
  139. page_total:0,
  140. page_size:0,
  141. current_page:0,
  142. dialogVisible:false,
  143. options: [
  144. {
  145. id: 1,
  146. label: '未开始'
  147. },
  148. {
  149. id: 2,
  150. label: '进行中'
  151. },
  152. {
  153. id: 3,
  154. label: '已结束'
  155. },
  156. ],
  157. report_id:'',
  158. times:[],
  159. loading:false,
  160. search_loading:false,
  161. all_loading:false,
  162. info:{},
  163. search_form:{
  164. title:'',
  165. status:''
  166. },
  167. real_search_form:{},
  168. tableData: []
  169. }
  170. },
  171. mounted () {
  172. this.search();
  173. },
  174. methods: {
  175. copy_two() {
  176. that = this;
  177. let Url =that.$refs['extension_url'];
  178. Url.select(); // 选择对象
  179. document.execCommand("Copy",false);
  180. that.$message({message:"复制成功!",type:"success"});
  181. },
  182. copy() {
  183. that = this;
  184. let Url =that.$refs['applets_url'];
  185. Url.select(); // 选择对象
  186. document.execCommand("Copy",false);
  187. that.$message({message:"复制成功!",type:"success"});
  188. },
  189. download(type){
  190. var url = '{!! yzWebFullUrl('plugin.package-deliver.admin.download.download') !!}'+ '&id=' + this.obj.id + '&type=' + type;
  191. var a = document.createElement('a');
  192. a.target = "_blank";
  193. a.href = url;
  194. a.click();
  195. },
  196. openDia(item){
  197. this.activeName="one"
  198. this.obj=item;
  199. this.dialogVisible=true
  200. },
  201. del(scope,rows){
  202. this.$confirm('是否删除?', '提示', {
  203. confirmButtonText: '确定',
  204. cancelButtonText: '取消',
  205. type: 'warning'
  206. }).then(() => {
  207. rows.splice(scope.$index, 1);
  208. let json={
  209. id:scope.row.id
  210. }
  211. this.$http.post('{!! yzWebFullUrl('plugin.package-deliver.admin.communityGroups.delete') !!}',json).then(function (response){
  212. if (response.data.result) {
  213. this.$message({message:"删除成功",type:"success"});
  214. this.loading = false;
  215. }else {
  216. this.$message({message: response.data.msg,type: 'error'});
  217. }
  218. },function (response) {
  219. console.log(response);
  220. this.loading = false;
  221. }
  222. );
  223. }).catch(() => {
  224. this.$message({
  225. type: 'info',
  226. message: '已取消操作'
  227. });
  228. });
  229. },
  230. close(scope,rows){
  231. this.$confirm('是否禁用/解禁?', '提示', {
  232. confirmButtonText: '确定',
  233. cancelButtonText: '取消',
  234. type: 'warning'
  235. }).then(() => {
  236. let json={
  237. id:scope.row.id
  238. }
  239. this.$http.post('{!! yzWebFullUrl('plugin.package-deliver.admin.communityGroups.ban') !!}',json).then(function (response){
  240. if (response.data.result) {
  241. this.$message({message:"操作成功!",type:"success"});
  242. this.loading = false;
  243. this.search();
  244. }else {
  245. this.$message({message: response.data.msg,type: 'error'});
  246. }
  247. },function (response) {
  248. console.log(response);
  249. this.loading = false;
  250. }
  251. );
  252. }).catch(() => {
  253. this.$message({
  254. type: 'info',
  255. message: '已取消操作'
  256. });
  257. });
  258. },
  259. goEdit(item){
  260. let link = `{!! yzWebFullUrl('plugin.package-deliver.admin.communityGroups.edit') !!}`+`&groupId=`+item.id;
  261. window.location.href = link;
  262. },
  263. search() {
  264. this.search_loading = true;
  265. let json={
  266. search:this.search_form,
  267. }
  268. this.$http.post('{!! yzWebFullUrl('plugin.package-deliver.admin.communityGroups.getList') !!}',json
  269. ).then(function (response) {
  270. if (response.data.result){
  271. let datas = response.data.data;
  272. this.tableData=datas.data
  273. this.page_total = datas.total;
  274. this.page_size = datas.per_page;
  275. this.current_page = datas.current_page;
  276. this.loading = false;
  277. this.real_search_form=Object.assign({},this.search_form);
  278. }
  279. else {
  280. this.$message({message: response.data.msg,type: 'error'});
  281. }
  282. this.search_loading = false;
  283. },function (response) {
  284. this.search_loading = false;
  285. this.$message({message: response.data.msg,type: 'error'});
  286. }
  287. );
  288. },
  289. currentChange(val) {
  290. this.loading = true;
  291. this.$http.post('{!! yzWebFullUrl('plugin.package-deliver.admin.communityGroups.getList') !!}',{page:val,search:this.real_search_form}).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. } else {
  300. this.$message({message: response.data.msg,type: 'error'});
  301. }
  302. },function (response) {
  303. console.log(response);
  304. this.loading = false;
  305. }
  306. );
  307. },
  308. },
  309. });
  310. </script>
  311. @endsection