team.blade.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  1. @extends('layouts.base')
  2. @section('title', "开团列表")
  3. @section('content')
  4. <style>
  5. .rightlist #app .rightlist-head{line-height:50px;padding:15px 0;}
  6. .rightlist #app{margin-left:30px;}
  7. .rightlist #app .el-breadcrumb{padding:30px 0;font-size:16px;}
  8. /* .el-form-item__label{padding-right:30px;} */
  9. .tip{font-size:12px;color:#999;font-weight:500}
  10. .rightlist-head-con{padding-right:20px;font-size:16px;color:#888;}
  11. /* .rightlist-head-con{float:left;padding-right:20px;font-size:16px;color:#888;} */
  12. .el-tag{font-weight:700;font-size:15px;margin-bottom:30px;}
  13. .el-icon-edit{font-size:16px;padding:0 15px;color:#409EFF;cursor: pointer;}
  14. /* 滑块选择小白点 */
  15. .el-switch.is-checked .el-switch__core::after {left: 100%;margin-left: -17px;}
  16. .el-switch__core::after {content: "";position: absolute;top: 1px;left: 1px;border-radius: 100%;transition: all .3s;width: 16px;height: 16px;background-color: #fff;}
  17. .tip1{font-size:12px;color:red;font-weight:500}
  18. [v-cloak]{
  19. display:none;
  20. }
  21. </style>
  22. <div id="qrcode" ref="qrcode" style="display:none;"></div>
  23. <div class="rightlist">
  24. <div id="app" v-cloak v-loading="all_loading">
  25. <el-breadcrumb separator-class="el-icon-arrow-right">
  26. <el-breadcrumb-item><a href="{{ yzWebFullUrl('plugin.fight-groups.admin.controllers.fight-groups.index') }}">活动列表</a></el-breadcrumb-item>
  27. <el-breadcrumb-item>开团列表</el-breadcrumb-item>
  28. </el-breadcrumb>
  29. <template>
  30. <el-form :inline="true" :model="search_form" ref="search_form" style="padding:20px 0 0 0;">
  31. <el-row>
  32. <el-form-item label="团长昵称" prop="leader_name">
  33. <el-input v-model="search_form.leader_name" placeholder="请输入团长昵称"></el-input>
  34. </el-form-item>
  35. <el-form-item label="时间范围" prop="pay_way">
  36. <el-date-picker v-model="search_form.times" type="datetimerange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
  37. </el-form-item>
  38. <el-form-item label="几人团" prop="number">
  39. <el-select v-model="search_form.member_num" placeholder="请选择" clearable>
  40. <el-option v-for="item in level_list" :key="item.id" :label="item.member_num1" :value="item.member_num"></el-option>
  41. </el-select>
  42. </el-form-item>
  43. <el-form-item label="拼团状态" prop="">
  44. <el-select v-model="search_form.status" placeholder="请选择拼团状态" clearable>
  45. <el-option v-for="item in pay_list" :key="item.id" :label="item.name" :value="item.id"></el-option>
  46. </el-select>
  47. </el-form-item>
  48. <!-- <el-form-item label="订单编号" prop="order_sn">
  49. <el-input v-model="search_form.order_sn" placeholder="请输入订单编号"></el-input>
  50. </el-form-item> -->
  51. <a href="#">
  52. <el-button type="success" icon="el-icon-search" @click="search()">搜索</el-button>
  53. </a>
  54. </el-col>
  55. </el-row>
  56. </el-form>
  57. <template>
  58. <!-- 表格start -->
  59. <el-table :data="list" style="width: 100%" v-loading="table_loading">
  60. <el-table-column prop="id" label="编号" align="center"></el-table-column>
  61. <el-table-column prop="member_name" label="团长" align="center">
  62. <template slot-scope="scope">
  63. <img :src="scope.row.avatar" style="width:50px;height:50px">
  64. <div>[[scope.row.nickname]]</div>
  65. </template>
  66. </el-table-column>
  67. <el-table-column prop="total" label="起止时间" min-width="150" align="center">
  68. <template slot-scope="scope">
  69. [[scope.row.start_time]]至[[scope.row.end_time1]]
  70. </template>
  71. </el-table-column>
  72. <el-table-column prop="down_time" label="剩余时间" align="center">
  73. <template slot-scope="scope">
  74. [[scope.row.down_time ?scope.row.down_time: '-']]
  75. </template>
  76. </el-table-column>
  77. <el-table-column prop="member_num" label="几人团" align="center"></el-table-column>
  78. <el-table-column label="还差几人" align="center">
  79. <template slot-scope="scope">
  80. [[scope.row.member_num - scope.row.has_many_success_member_count >=0 ? scope.row.member_num - scope.row.has_many_success_member_count : '0']]
  81. </template>
  82. </el-table-column>
  83. <el-table-column label="拼团状态" prop="status_message" align="center"></el-table-column>
  84. <el-table-column label="管理" min-width="80" align="center">
  85. <template slot-scope="scope">
  86. <!-- <a :href="'{{ yzWebFullUrl('plugin.fight-groups.admin.controllers.fight-groups.create', array('id' => '')) }}'+[[scope.row.id]]">
  87. 拼团链接
  88. </a><br> -->
  89. <el-popover class="item" placement="left" effect="light">
  90. <div style="text-align:center;">
  91. <div style="padding:5px 0;text-align:left;">活动推广二维码:</div>
  92. <img :src="img" alt="" style="width:100px;height:100px;">
  93. <div style="padding-top:5px;">
  94. <el-button @click="copyList(scope.row.id)" type="mini">复制活动链接</el-button>
  95. <input v-model="scope.row.url" :ref="'list'+scope.row.id" style="position:absolute;opacity:0;height:1px;" />
  96. </div>
  97. </div>
  98. <a slot="reference" @click="listCode(scope.$index)">拼团链接</a>
  99. </el-popover><br>
  100. <el-popover class="item" placement="left" effect="light">
  101. <div style="text-align:center;">
  102. <div style="padding:5px 0;text-align:left;">修改时间:</div>
  103. <el-date-picker v-model="change_time" type="datetime" format="yyyy-MM-dd HH:mm:ss"
  104. value-format="timestamp" placeholder="选择修改时间" :clearable="false" style="width:90%" @change="changed(scope.row)">
  105. </el-date-picker>
  106. </div>
  107. <a slot="reference" v-if="scope.row.status==1" @click="changeTime(scope.row)">修改时间</a>
  108. </el-popover><br v-if="scope.row.status==1">
  109. <a v-if="scope.row.status==1" @click="virtual(scope.row.id)">
  110. 虚拟成团<br>
  111. </a>
  112. <a :href="'{{ yzWebFullUrl('plugin.fight-groups.admin.controllers.team.details', array('id' => '')) }}'+[[scope.row.id]]">
  113. 查看详情
  114. </a><br>
  115. <!-- <a :href="'{{ yzWebFullUrl('plugin.fight-groups.admin.controllers.fight-groups.create', array('id' => '')) }}'+[[scope.row.id]]">
  116. 退款详情
  117. </a> -->
  118. </template>
  119. </el-table-column>
  120. </el-table>
  121. <!-- 表格end -->
  122. </template>
  123. <!-- 分页 -->
  124. <el-row>
  125. <el-col :span="24" align="right" style="padding:15px 5% 15px 0">
  126. <el-pagination layout="prev, pager, next" @current-change="currentChange" :total="total" :page-size="per_size" :current-page="current_page" background v-loading="loading"></el-pagination>
  127. </el-col>
  128. </el-row>
  129. </template>
  130. </div>
  131. <script src="{{resource_get('plugins/fight-groups/views/admin/qrcode.min.js')}}"></script>
  132. <script>
  133. var app = new Vue({
  134. el:"#app",
  135. delimiters: ['[[', ']]'],
  136. data() {
  137. return{
  138. id:"",
  139. img:"",//二维码
  140. search_form:{},
  141. form:{},
  142. level_list:[],
  143. pay_list:[
  144. {id:0,name:"提交"},
  145. {id:1,name:"拼团中"},
  146. {id:2,name:"成功"},
  147. {id:3,name:"失败"}
  148. ],
  149. change_time:1544444444444,
  150. list:[],
  151. loading:false,
  152. dialog_loading:false,
  153. table_loading:false,
  154. rules:{},
  155. //分页
  156. total:0,
  157. per_size:0,
  158. current_page:0,
  159. rules:{},
  160. }
  161. },
  162. created() {
  163. this.id = "{{ request()-> id }}";
  164. var that = this;
  165. // //获得url传过来的id
  166. // var url = window.location.href;
  167. // var url_arr = url.split("=");
  168. // this.id = url_arr[url_arr.length-1];
  169. // let new_url = "";
  170. // for(let i=0;i<url_arr.length;i++) {
  171. // if(this.id.charAt(i)!="#") {
  172. // new_url = new_url+this.id.charAt(i);
  173. // }
  174. // }
  175. // this.id = new_url;
  176. let json = {id:this.id}
  177. //获取层级信息
  178. this.getLevel();
  179. this.getData(json);
  180. },
  181. methods: {
  182. getLevel() {
  183. var that = this;
  184. that.all_loading = true;
  185. that.$http.post("{!! yzWebFullUrl('plugin.fight-groups.admin.controllers.team.get-levels') !!}",{id:that.id}).then(response => {
  186. if(response.data.result==1){
  187. console.log(response)
  188. that.level_list = response.data.data;
  189. that.level_list.forEach((item,index) => {
  190. item.member_num = item.member_num;
  191. item.member_num1 = item.member_num+'人团'
  192. });
  193. console.log(that.level_list)
  194. }
  195. else{
  196. that.$message.error(response.data);
  197. }
  198. that.all_loading = false;
  199. }),function(res){
  200. that.all_loading = false;
  201. };
  202. },
  203. getData(json) {
  204. var that = this;
  205. that.all_loading = true;
  206. that.$http.post("{!! yzWebFullUrl('plugin.fight-groups.admin.controllers.team.search') !!}",json).then(response => {
  207. if(response.data.result==1){
  208. console.log(response)
  209. that.list = response.data.data.data;
  210. that.list.forEach((item,index) => {
  211. item.start_time = that.timeStyle(item.start_time)
  212. item.end_time1 = that.timeStyle(item.end_time)
  213. item.end_time = item.end_time*1000;
  214. that.timing(item.end_time - new Date().getTime(),index);//倒计时
  215. });
  216. that.total = response.data.data.total;
  217. that.per_size = response.data.data.per_page;
  218. that.current_page = response.data.data.current_page;
  219. that.url = response.data.data.url;
  220. }
  221. else{
  222. that.$message.error(response.data);
  223. }
  224. console.log(this.list)
  225. that.all_loading = false;
  226. }),function(res){
  227. console.log(res);
  228. that.all_loading = false;
  229. };
  230. },
  231. // 分页
  232. currentChange(page) {
  233. var that = this;
  234. let time1="";
  235. let time2="";
  236. if(that.search_form.times){
  237. time1 = that.search_form.times[0]/1000;
  238. time2 = that.search_form.times[1]/1000;
  239. }
  240. let json = {page:page,id:that.id,leader_name:that.search_form.leader_name,start_time:time1,end_time:time2,
  241. member_num:that.search_form.member_num,status:that.search_form.status};
  242. that.getData(json);
  243. },
  244. // 搜索
  245. search() {
  246. var that = this;
  247. console.log(that.search_form)
  248. let time1="";
  249. let time2="";
  250. if(that.search_form.times){
  251. time1 = that.search_form.times[0]/1000;
  252. time2 = that.search_form.times[1]/1000;
  253. }
  254. let json = {page:1,id:that.id,leader_name:that.search_form.leader_name,start_time:time1,end_time:time2,
  255. member_num:that.search_form.member_num,status:that.search_form.status};
  256. that.getData(json);
  257. },
  258. // 虚拟成团
  259. virtual(id) {
  260. var that = this;
  261. that.all_loading = true;
  262. that.$http.post("{!! yzWebFullUrl('plugin.fight-groups.admin.controllers.team.virtual-team') !!}",{team_id:id}).then(response => {
  263. console.log(response);
  264. if(response.data.result==1){
  265. that.$message.success(response.data.msg);
  266. window.location.reload();
  267. // window.location.href='{!! yzWebFullUrl('plugin.wechat.admin.reply.controller.default-reply.index') !!}';
  268. }
  269. else{
  270. that.$message.error(response.data);
  271. }
  272. that.all_loading = false;
  273. }),function(res){
  274. console.log(res);
  275. that.all_loading = false;
  276. };
  277. },
  278. qrcodeScan (url) {//生成二维码
  279. let qrcode = new QRCode('qrcode', {
  280. width: 100, // 二维码宽度
  281. height: 100, // 二维码高度
  282. render: 'image',
  283. text: url
  284. });
  285. var data = $("canvas")[0].toDataURL().replace("image/png", "image/octet-stream;");
  286. console.log(url)
  287. this.img = data;
  288. },
  289. // 活动二维码
  290. listCode(index) {
  291. this.qrcodeScan(this.list[index].url);
  292. },
  293. // 复制活动链接
  294. copyList(index) {
  295. that = this;
  296. let Url = that.$refs['list'+index];
  297. console.log(Url)
  298. Url.select(); // 选择对象
  299. document.execCommand("Copy",false);
  300. that.$message({message:"复制成功!",type:"success"});
  301. },
  302. // 修改时间
  303. changeTime(row) {
  304. console.log(row);
  305. this.change_time = "";
  306. this.change_time = row.end_time;
  307. console.log(this.change_time)
  308. },
  309. changed(row) {
  310. var that = this;
  311. this.$confirm('确定修改吗', '提示', {confirmButtonText: '确定',cancelButtonText: '取消',type: 'warning'}).then(() => {
  312. that.$http.post("{!! yzWebFullUrl('plugin.fight-groups.admin.controllers.team.change-end-time') !!}",{team_id:row.id,end_time:that.change_time/1000}).then(response => {
  313. console.log(response);
  314. if(response.data.result==1){
  315. that.$message.success("修改成功!");
  316. let json = {id:this.id}
  317. that.getData(json);
  318. }
  319. else{
  320. that.$message.error(response.data.msg);
  321. let json = {id:this.id}
  322. that.getData(json);
  323. }
  324. that.all_loading = false;
  325. }),function(res){
  326. console.log(res);
  327. that.all_loading = false;
  328. };
  329. }).catch(() => {
  330. this.cart_list[index].num++;
  331. this.$message({type: 'info',message: '已取消修改'});
  332. });
  333. },
  334. submitForm() {
  335. var that = this;
  336. that.all_loading = true;
  337. that.$http.post("{!! yzWebFullUrl('plugin.wechat.admin.reply.controller.default-reply.add') !!}",{keywords_id:that.data.id}).then(response => {
  338. console.log(response);
  339. if(response.data.result==1){
  340. that.keyword_list = response.data.data;
  341. that.$message.success("保存成功!");
  342. window.location.href='{!! yzWebFullUrl('plugin.wechat.admin.reply.controller.default-reply.index') !!}';
  343. }
  344. else{
  345. that.$message.error(response.data);
  346. }
  347. that.all_loading = false;
  348. }),function(res){
  349. console.log(res);
  350. that.all_loading = false;
  351. };
  352. },
  353. // 定时器
  354. timing(down_time,index) {
  355. var that = this;
  356. if(down_time < 0) {
  357. that.list[index].down_time = '-'
  358. return false;
  359. }
  360. setTimeout(() => {
  361. down_time = down_time - 1000;
  362. var d=Math.floor(down_time/1000/60/60/24);
  363. var hour=Math.floor(down_time/1000/60/60%24);
  364. var min=Math.floor(down_time/1000/60%60);
  365. var sec=Math.floor(down_time/1000%60);
  366. let tt = d+'天'+hour+'时'+min+'分'+sec+'秒';
  367. this.$set(that.list[index],'down_time',tt)
  368. this.timing(down_time,index)
  369. }, 1000);
  370. },
  371. add0(m) {
  372. return m<10?'0'+m:m
  373. },
  374. timeStyle(time) {
  375. let time1 = new Date(time*1000);
  376. let y = time1.getFullYear();
  377. let m = time1.getMonth()+1;
  378. let d = time1.getDate();
  379. let h = time1.getHours();
  380. let mm = time1.getMinutes();
  381. let s = time1.getSeconds();
  382. return y+'-'+this.add0(m)+'-'+this.add0(d)+' '+this.add0(h)+':'+this.add0(mm)+':'+this.add0(s);
  383. },
  384. },
  385. })
  386. </script>
  387. @endsection