team.blade.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  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-store.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-store.details', array('id' => '')) }}'+[[scope.row.id]]">
  113. 查看详情
  114. </a><br>
  115. </template>
  116. </el-table-column>
  117. </el-table>
  118. <!-- 表格end -->
  119. </template>
  120. <!-- 分页 -->
  121. <el-row>
  122. <el-col :span="24" align="right" style="padding:15px 5% 15px 0">
  123. <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>
  124. </el-col>
  125. </el-row>
  126. </template>
  127. </div>
  128. <script src="{{resource_get('plugins/fight-groups/views/admin/qrcode.min.js')}}"></script>
  129. <script>
  130. var app = new Vue({
  131. el:"#app",
  132. delimiters: ['[[', ']]'],
  133. data() {
  134. return{
  135. id:"",
  136. img:"",//二维码
  137. search_form:{},
  138. form:{},
  139. level_list:[],
  140. pay_list:[
  141. {id:0,name:"提交"},
  142. {id:1,name:"拼团中"},
  143. {id:2,name:"成功"},
  144. {id:3,name:"失败"}
  145. ],
  146. change_time:1544444444444,
  147. list:[],
  148. loading:false,
  149. dialog_loading:false,
  150. table_loading:false,
  151. rules:{},
  152. //分页
  153. total:0,
  154. per_size:0,
  155. current_page:0,
  156. rules:{},
  157. }
  158. },
  159. created() {
  160. var that = this;
  161. //获得url传过来的id
  162. var url = window.location.href;
  163. var url_arr = url.split("=");
  164. this.id = url_arr[url_arr.length-1];
  165. let new_url = "";
  166. for(let i=0;i<url_arr.length;i++) {
  167. if(this.id.charAt(i)!="#") {
  168. new_url = new_url+this.id.charAt(i);
  169. }
  170. }
  171. this.id = new_url;
  172. let json = {id:this.id}
  173. //获取层级信息
  174. this.getLevel();
  175. this.getData(json);
  176. },
  177. methods: {
  178. getLevel() {
  179. var that = this;
  180. that.all_loading = true;
  181. that.$http.post("{!! yzWebFullUrl('plugin.fight-groups.admin.controllers.team-store.get-levels') !!}",{id:that.id}).then(response => {
  182. if(response.data.result==1){
  183. console.log(response)
  184. that.level_list = response.data.data;
  185. that.level_list.forEach((item,index) => {
  186. item.member_num = item.member_num;
  187. item.member_num1 = item.member_num+'人团'
  188. });
  189. console.log(that.level_list)
  190. }
  191. else{
  192. that.$message.error(response.data);
  193. }
  194. that.all_loading = false;
  195. }),function(res){
  196. that.all_loading = false;
  197. };
  198. },
  199. getData(json) {
  200. var that = this;
  201. that.all_loading = true;
  202. that.$http.post("{!! yzWebFullUrl('plugin.fight-groups.admin.controllers.team-store.search') !!}",json).then(response => {
  203. if(response.data.result==1){
  204. console.log(response)
  205. that.list = response.data.data.data;
  206. that.list.forEach((item,index) => {
  207. item.start_time = that.timeStyle(item.start_time)
  208. item.end_time1 = that.timeStyle(item.end_time)
  209. item.end_time = item.end_time*1000;
  210. that.timing(item.end_time - new Date().getTime(),index);//倒计时
  211. });
  212. that.total = response.data.data.total;
  213. that.per_size = response.data.data.per_page;
  214. that.current_page = response.data.data.current_page;
  215. that.url = response.data.data.url;
  216. }
  217. else{
  218. that.$message.error(response.data);
  219. }
  220. console.log(this.list)
  221. that.all_loading = false;
  222. }),function(res){
  223. console.log(res);
  224. that.all_loading = false;
  225. };
  226. },
  227. // 分页
  228. currentChange(page) {
  229. var that = this;
  230. let time1="";
  231. let time2="";
  232. if(that.search_form.times){
  233. time1 = that.search_form.times[0]/1000;
  234. time2 = that.search_form.times[1]/1000;
  235. }
  236. let json = {page:page,id:that.id,leader_name:that.search_form.leader_name,start_time:time1,end_time:time2,
  237. member_num:that.search_form.member_num,status:that.search_form.status};
  238. that.getData(json);
  239. },
  240. // 搜索
  241. search() {
  242. var that = this;
  243. console.log(that.search_form)
  244. let time1="";
  245. let time2="";
  246. if(that.search_form.times){
  247. time1 = that.search_form.times[0]/1000;
  248. time2 = that.search_form.times[1]/1000;
  249. }
  250. let json = {page:1,id:that.id,leader_name:that.search_form.leader_name,start_time:time1,end_time:time2,
  251. member_num:that.search_form.member_num,status:that.search_form.status};
  252. that.getData(json);
  253. },
  254. // 虚拟成团
  255. virtual(id) {
  256. var that = this;
  257. that.all_loading = true;
  258. that.$http.post("{!! yzWebFullUrl('plugin.fight-groups.admin.controllers.team-store.virtual-team') !!}",{team_id:id}).then(response => {
  259. console.log(response);
  260. if(response.data.result==1){
  261. that.$message.success(response.data.msg);
  262. window.location.reload();
  263. // window.location.href='{!! yzWebFullUrl('plugin.wechat.admin.reply.controller.default-reply.index') !!}';
  264. }
  265. else{
  266. that.$message.error(response.data);
  267. }
  268. that.all_loading = false;
  269. }),function(res){
  270. console.log(res);
  271. that.all_loading = false;
  272. };
  273. },
  274. qrcodeScan (url) {//生成二维码
  275. let qrcode = new QRCode('qrcode', {
  276. width: 100, // 二维码宽度
  277. height: 100, // 二维码高度
  278. render: 'image',
  279. text: url
  280. });
  281. var data = $("canvas")[0].toDataURL().replace("image/png", "image/octet-stream;");
  282. console.log(url)
  283. this.img = data;
  284. },
  285. // 活动二维码
  286. listCode(index) {
  287. this.qrcodeScan(this.list[index].url);
  288. },
  289. // 复制活动链接
  290. copyList(index) {
  291. that = this;
  292. let Url = that.$refs['list'+index];
  293. console.log(Url)
  294. Url.select(); // 选择对象
  295. document.execCommand("Copy",false);
  296. that.$message({message:"复制成功!",type:"success"});
  297. },
  298. // 修改时间
  299. changeTime(row) {
  300. console.log(row);
  301. this.change_time = "";
  302. this.change_time = row.end_time;
  303. console.log(this.change_time)
  304. },
  305. changed(row) {
  306. var that = this;
  307. this.$confirm('确定修改吗', '提示', {confirmButtonText: '确定',cancelButtonText: '取消',type: 'warning'}).then(() => {
  308. that.$http.post("{!! yzWebFullUrl('plugin.fight-groups.admin.controllers.team-store.change-end-time') !!}",{team_id:row.id,end_time:that.change_time/1000}).then(response => {
  309. console.log(response);
  310. if(response.data.result==1){
  311. that.$message.success("修改成功!");
  312. let json = {id:this.id}
  313. that.getData(json);
  314. }
  315. else{
  316. that.$message.error(response.data.msg);
  317. let json = {id:this.id}
  318. that.getData(json);
  319. }
  320. that.all_loading = false;
  321. }),function(res){
  322. console.log(res);
  323. that.all_loading = false;
  324. };
  325. }).catch(() => {
  326. this.cart_list[index].num++;
  327. this.$message({type: 'info',message: '已取消修改'});
  328. });
  329. },
  330. submitForm() {
  331. var that = this;
  332. that.all_loading = true;
  333. that.$http.post("{!! yzWebFullUrl('plugin.wechat.admin.reply.controller.default-reply.add') !!}",{keywords_id:that.data.id}).then(response => {
  334. console.log(response);
  335. if(response.data.result==1){
  336. that.keyword_list = response.data.data;
  337. that.$message.success("保存成功!");
  338. window.location.href='{!! yzWebFullUrl('plugin.wechat.admin.reply.controller.default-reply.index') !!}';
  339. }
  340. else{
  341. that.$message.error(response.data);
  342. }
  343. that.all_loading = false;
  344. }),function(res){
  345. console.log(res);
  346. that.all_loading = false;
  347. };
  348. },
  349. // 定时器
  350. timing(down_time,index) {
  351. var that = this;
  352. setTimeout(() => {
  353. if(down_time<0) {
  354. that.list[index].down_time = '-'
  355. return false;
  356. }
  357. down_time = down_time - 1000;
  358. var d=Math.floor(down_time/1000/60/60/24);
  359. var hour=Math.floor(down_time/1000/60/60%24);
  360. var min=Math.floor(down_time/1000/60%60);
  361. var sec=Math.floor(down_time/1000%60);
  362. let tt = d+'天'+hour+'时'+min+'分'+sec+'秒';
  363. this.$set(that.list[index],'down_time',tt)
  364. this.timing(down_time,index)
  365. }, 1000);
  366. },
  367. add0(m) {
  368. return m<10?'0'+m:m
  369. },
  370. timeStyle(time) {
  371. let time1 = new Date(time*1000);
  372. let y = time1.getFullYear();
  373. let m = time1.getMonth()+1;
  374. let d = time1.getDate();
  375. let h = time1.getHours();
  376. let mm = time1.getMinutes();
  377. let s = time1.getSeconds();
  378. return y+'-'+this.add0(m)+'-'+this.add0(d)+' '+this.add0(h)+':'+this.add0(mm)+':'+this.add0(s);
  379. },
  380. },
  381. })
  382. </script>
  383. @endsection