list.blade.php 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. @extends('layouts.base')
  2. @section('title', "名片管理")
  3. @section('content')
  4. <style xmlns:v-bind="http://www.w3.org/1999/xhtml">
  5. .rightlist #app .rightlist-head{padding:15px 0;line-height:50px;}
  6. .rightlist #app{margin-left:30px;}
  7. .rightlist-head-con{float:left;padding-right:20px;font-size:16px;color:#888;}
  8. .el-form-item__label{padding-right:30px;}
  9. .mouse-active{cursor:pointer;border:1px dotted #409EFF;border-radius: 4px;}
  10. /* 滑块选择小白点 */
  11. .el-switch.is-checked .el-switch__core::after {left: 100%;margin-left: -17px;}
  12. .el-switch__core::after {content: "";position: absolute;top: 1px;left: 1px;border-radius: 100%;transition: all .3s;width: 16px;height: 16px;background-color: #fff;}
  13. </style>
  14. <div class="rightlist">
  15. <div id="app" v-loading="submit_loading">
  16. <link rel="stylesheet" href="//at.alicdn.com/t/font_913727_zrmdutznqpd.css">
  17. <div class="rightlist-head">
  18. <div class="rightlist-head-con">名片管理</div>
  19. </div>
  20. <el-form :inline="true" :model="search_form" ref="search_form">
  21. <el-row>
  22. <el-col :span="24">
  23. <el-form-item>
  24. <el-input v-model="search_form.uid" placeholder="请输入会员ID"></el-input>
  25. </el-form-item>
  26. <el-form-item>
  27. <el-input v-model="search_form.member" placeholder="请输入会员昵称/姓名/手机号关键词" style="width:300px"></el-input>
  28. </el-form-item>
  29. <el-form-item>
  30. <el-select v-model="search_form.role_id" placeholder="请选择角色">
  31. <el-option v-for="(item,index) in role_list" :key="item" :label="item" :value="index"></el-option>
  32. </el-select>
  33. </el-form-item>
  34. <el-form-item>
  35. <el-select v-model="search_form.type_id" placeholder="选择排序类型(降序)">
  36. <el-option v-for="item in type_list" :key="item.id" :label="item.name" :value="item.id"></el-option>
  37. </el-select>
  38. </el-form-item>
  39. <el-form-item>
  40. <el-select v-model="search_form.status_id" placeholder="名片状态">
  41. <el-option v-for="item in status_list" :key="item.id" :label="item.name" :value="item.id"></el-option>
  42. </el-select>
  43. </el-form-item>
  44. <el-form-item>
  45. <a href="#">
  46. <el-button type="success" icon="el-icon-search" @click="search()">搜索</el-button>
  47. </a>
  48. </el-form-item>
  49. </el-col>
  50. </el-row>
  51. </el-form>
  52. <template>
  53. <el-table :data="list" style="width: 100%" v-loading="table_loading">
  54. <el-table-column prop="id" label="ID" width="80" align="center"></el-table-column>
  55. <el-table-column label="会员" align="center">
  56. <template slot-scope="scope">
  57. <img style='width:40px;height:40px':src=scope.row.card_avatar style="max-width:100px">
  58. <div>[[scope.row.member?scope.row.member.nickname:'未更新']]</div>
  59. </template>
  60. </el-table-column>
  61. <el-table-column prop="name" label="姓名手机号" align="center" :render-header='memberMsg'>
  62. <template slot-scope="scope">
  63. <span>[[scope.row.member?scope.row.member.realname:'未更新']]</span><br>
  64. <span>[[scope.row.member?scope.row.member.mobile:'未更新']]</span>
  65. </template>
  66. </el-table-column>
  67. <el-table-column label="等级角色" align="center" :render-header='levelRole'>
  68. <template slot-scope="scope">
  69. <div v-if="scope.row.role_id==2">
  70. <div v-if="scope.row.agent&&scope.row.agent.agent_level">
  71. <span>[[scope.row.agent.agent_level.name]]</span><br>
  72. <span>[[scope.row.role_name]]</span>
  73. </div>
  74. <div v-else>
  75. <span>默认等级</span><br>
  76. <span>[[scope.row.role_name]]</span>
  77. </div>
  78. </div>
  79. <div v-else>
  80. <span>[[scope.row.level_name]]</span><br>
  81. <span>[[scope.row.role_name]]</span>
  82. </div>
  83. </template>
  84. </el-table-column>
  85. <el-table-column label="访问次数访问人数" align="center" :render-header='visitNumber'>
  86. <template slot-scope="scope">
  87. <span>[[scope.row.card_statistics.visit]]</span><br>
  88. <span>[[scope.row.card_statistics.visitor_num]]</span>
  89. </template>
  90. </el-table-column>
  91. <el-table-column label="分享次数保存次数" align="center" :render-header='shareNumber'>
  92. <template slot-scope="scope">
  93. <span>[[scope.row.card_statistics.share]]</span><br>
  94. <span>[[scope.row.card_statistics.save]]</span>
  95. </template>
  96. </el-table-column>
  97. <el-table-column label="收藏次数靠谱次数" align="center" :render-header='collectNumber'>
  98. <template slot-scope="scope">
  99. <span>[[scope.row.card_statistics.collection]]</span><br>
  100. <span>[[scope.row.card_statistics.reliable]]</span>
  101. </template>
  102. </el-table-column>
  103. <el-table-column prop="card_statistics.fans" label="新增会员" align="center"></el-table-column>
  104. <el-table-column label="操作" align="center" min-width="120">
  105. <template slot-scope="scope">
  106. <a v-bind:href="'{{ yzWebUrl('plugin.business-card.admin.controllers.card.index', array('id' => '')) }}'+[[scope.row.id]]" title="编辑">
  107. <i class="iconfont icon-bianjiqianbixieshuru2" style="font-size:28px;color:#606266"></i>
  108. </a>
  109. <a href="#">
  110. <el-tooltip placement="top">
  111. <div slot="content">
  112. <img :src="scope.row.qr_code" alt="" style="max-width:100px;">
  113. </div>
  114. <i class="iconfont icon-erweima1" style="font-size:28px;color:#606266"></i>
  115. </el-tooltip>
  116. </a>
  117. <a href="#">
  118. <i class="iconfont icon-lianjie" style="font-size:28px;color:#606266" title="点击复制链接" @click="copy(scope.row,scope.$index)"></i>
  119. </a>
  120. <el-input v-model="scope.row.card_url" :ref="'copy'+scope.$index" style="position: absolute;opacity:0;"></el-input>
  121. </template>
  122. </el-table-column>
  123. <el-table-column label="启用" min-width="80" align="center">
  124. <template slot-scope="scope">
  125. <el-tooltip :content="scope.row.status?'已开启':'已禁用'" placement="top">
  126. <el-switch v-model="scope.row.status" :active-value="1" :inactive-value="0" @change="statusChange(scope.$index,scope.row,scope.row.id)"></el-switch>
  127. </el-tooltip>
  128. </template>
  129. </el-table-column>
  130. </el-table>
  131. <el-row>
  132. <el-col :span="24" align="right" style="padding:15px 5% 15px 0">
  133. <el-pagination layout="prev, pager, next" @current-change="currentChange" :total="page_total" :page-size="page_size" background v-loading="loading"></el-pagination>
  134. </el-col>
  135. </el-row>
  136. </template>
  137. </div>
  138. </div>
  139. <script>
  140. var vm = new Vue({
  141. el:"#app",
  142. delimiters: ['[[', ']]'],
  143. data() {
  144. let data = {!! $page_list ?: "{}" !!};
  145. for(let i=0;i<data.data.length;i++){
  146. if(!data.data[i].card_statistics){
  147. data.data[i].card_statistics = {
  148. visit:"",
  149. visitor_num:"",
  150. share:"",
  151. save:"",
  152. collection:"",
  153. reliable:"",
  154. fans:""
  155. };
  156. }
  157. }
  158. let role_list = {!! $role_list ?: '{}' !!};
  159. role_list['0']="全部角色";
  160. return{
  161. list:data.data,
  162. loading:false,
  163. table_loading:false,
  164. submit_loading:false,
  165. page_total:data.total,
  166. page_size:data.per_page,
  167. current_page:data.current_page,
  168. search_form:{},
  169. type_list:[
  170. {id:0,name:"全部类型"},
  171. {id:1,name:"访问次数"},
  172. {id:2,name:"访问人数"},
  173. {id:3,name:"分享次数"},
  174. {id:4,name:"保存次数"},
  175. {id:5,name:"收藏次数"},
  176. {id:6,name:"靠谱次数"},
  177. {id:7,name:"新增会员"},
  178. ],
  179. role_list :role_list ,
  180. level_list:[
  181. ],
  182. status_list:[
  183. {id:2,name:"全部状态"},
  184. {id:0,name:"关闭"},
  185. {id:1,name:"开启"},
  186. ],
  187. }
  188. },
  189. methods: {
  190. levelRole(h){
  191. return [h('p', {}, ['等级']), h('p', {}, ['角色'])]
  192. },
  193. visitNumber(h){
  194. return [h('p', {}, ['访问次数']), h('p', {}, ['访问人数'])]
  195. },
  196. shareNumber(h){
  197. return [h('p', {}, ['分享次数']), h('p', {}, ['保存次数'])]
  198. },
  199. collectNumber(h){
  200. return [h('p', {}, ['收藏次数']), h('p', {}, ['靠谱次数'])]
  201. },
  202. memberMsg(h){
  203. return [h('p', {}, ['姓名']), h('p', {}, ['手机号'])]
  204. },
  205. copy(row,index) {
  206. that = this;
  207. let Url = that.$refs['copy'+index];
  208. Url.select(); // 选择对象
  209. document.execCommand("Copy",false);
  210. that.$message({message:"复制成功!",type:"success"});
  211. },
  212. statusChange(index,row,id) {
  213. console.log(id);
  214. this.submit_loading = true;
  215. this.$http.post('{!! yzWebFullUrl('plugin.business-card.admin.controllers.card.change-status') !!}',{card_id:id,status:row.status}).then(function (response) {
  216. if (response.data.result){
  217. if(row.status){
  218. this.$message({message: '开启成功',type: 'success'});
  219. }
  220. else {
  221. this.$message({message: '关闭成功',type: 'success'});
  222. }
  223. }
  224. else {
  225. this.$message({message: response.data.msg,type: 'error'});
  226. if (this.list[index].status==1){
  227. this.list[index].status = 0;
  228. }
  229. else{
  230. this.list[index].status = 1;
  231. }
  232. }
  233. this.submit_loading = false;
  234. },function (response) {
  235. this.$message({message: response.data.msg,type: 'error'});
  236. if (this.list[index].status==1){
  237. this.list[index].status = 0;
  238. }
  239. else{
  240. this.list[index].status = 1;
  241. }
  242. this.submit_loading = false;
  243. });
  244. },
  245. search(){
  246. this.search_loading=true;
  247. this.$http.post('{!! yzWebFullUrl('plugin.business-card.admin.controllers.card.search') !!}',{search_form:this.search_form}
  248. ).then(function (response) {
  249. if (response.data.result){
  250. this.list = response.data.data.data;
  251. this.search_loading = false;
  252. }
  253. else {
  254. this.$message({message: response.data.msg,type: 'error'});
  255. }
  256. this.search_loading = false;
  257. },function (response) {
  258. this.search_loading = false;
  259. this.$message({message: response.data.msg,type: 'error'});
  260. }
  261. );
  262. },
  263. currentChange(val) {
  264. this.loading = true;
  265. this.$http.post('{!! yzWebFullUrl('plugin.business-card.admin.controllers.card.search') !!}',{page:val}).then(function (response){
  266. let datas = response.data.data;
  267. this.page_total = datas.total;
  268. this.list = datas.data;
  269. this.page_size = datas.per_page;
  270. this.current_page = datas.current_page;
  271. this.loading = false;
  272. },function (response) {
  273. this.loading = false;
  274. }
  275. );
  276. }
  277. },
  278. });
  279. </script>
  280. @endsection