index.blade.php 14 KB

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