index.php 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515
  1. <style>
  2. .table-body {
  3. padding: 20px 20px;
  4. background-color: #fff;
  5. }
  6. .table-body .top-input {
  7. margin-top: 34px;
  8. }
  9. .input-item {
  10. width: 200px;
  11. margin-right: 20px;
  12. }
  13. .input-item .el-input__inner {
  14. border-right: 0;
  15. }
  16. .input-item .el-input__inner:hover {
  17. border: 1px solid #dcdfe6;
  18. border-right: 0;
  19. outline: 0;
  20. }
  21. .input-item .el-input__inner:focus {
  22. border: 1px solid #dcdfe6;
  23. border-right: 0;
  24. outline: 0;
  25. }
  26. .input-item .el-input-group__append {
  27. background-color: #fff;
  28. border-left: 0;
  29. width: 10%;
  30. padding: 0;
  31. }
  32. .input-item .el-input-group__append .el-button {
  33. padding: 0;
  34. }
  35. .input-item .el-input-group__append .el-button {
  36. margin: 0;
  37. }
  38. /* #app .table-body .el-table .el-button {
  39. border-radius: 16px;
  40. } */
  41. .create {
  42. height: 36px;
  43. line-height: 36px;
  44. float: right;
  45. color: #BCBCBC;
  46. margin-left: 20px;
  47. }
  48. .name {
  49. cursor: pointer;
  50. color: #49A9FF;
  51. }
  52. .el-input-group__append {
  53. /* background-color: #fff; */
  54. }
  55. /* 卡片 */
  56. .plugin-list {
  57. margin: 0 0 0 -20px;
  58. /* padding-right: 100px; */
  59. display: flex;
  60. flex-wrap: wrap;
  61. }
  62. .plugin-list .plugin-item {
  63. width: 20%;
  64. min-width: 400px;
  65. }
  66. .plugin-item {
  67. border: 1px solid #ebebeb;
  68. background: #FFFFFF;
  69. box-shadow: 3px 5px 15px rgba(80, 80, 80, 0.16);
  70. opacity: 1;
  71. border-radius: 5px;
  72. padding: 20px;
  73. margin: 0 0 20px 20px;
  74. transition: 250ms;
  75. position: relative;
  76. /* min-width: 300px; */
  77. }
  78. .plugin-item .item-status {
  79. position: absolute;
  80. top: 0;
  81. right: 0;
  82. width: 94px;
  83. height: 30px;
  84. background: #E8EAEC;
  85. opacity: 1;
  86. border-radius: 0px 5px 0px 5px;
  87. font-size: 14px;
  88. font-family: Microsoft YaHei;
  89. font-weight: 400;
  90. line-height: 30px;
  91. color: #9398A4;
  92. text-align: center;
  93. }
  94. .item-status-permanent {
  95. width: 94px;
  96. }
  97. .item-status-effective {
  98. width: 164px;
  99. }
  100. .plugin-item .item-info {
  101. display: flex;
  102. align-items: center;
  103. }
  104. /* .plugin-item .item-info .item-right{
  105. min-width: 500px;
  106. } */
  107. .plugin-item .item-btns {
  108. display: flex;
  109. align-items: center;
  110. justify-content: flex-end;
  111. margin-top: 12px;
  112. }
  113. .plugin-item .mall-logo {
  114. width: 70px;
  115. height: 70px;
  116. margin-right: 12px;
  117. }
  118. .plugin-item .mall-logo img {
  119. width: 100%;
  120. height: 100%;
  121. display: block;
  122. border-radius: 50%;
  123. }
  124. .plugin-item .display-name {
  125. font-size: 18pt;
  126. margin-top: 10px;
  127. margin-bottom: 4px;
  128. font-family: Microsoft YaHei;
  129. font-weight: bold;
  130. line-height: 30px;
  131. color: #3F495D;
  132. opacity: 1;
  133. width: 200px;
  134. white-space: nowrap;
  135. overflow: hidden;
  136. text-overflow: ellipsis;
  137. }
  138. .plugin-item .name {
  139. color: #909399;
  140. }
  141. .plugin-item:hover {
  142. cursor: pointer;
  143. border-color: #bfddff;
  144. }
  145. /* .plugin-item:hover .display-name {
  146. color: #409EFF;
  147. } */
  148. .plugin-item .plugin-option-btn {
  149. height: 25px;
  150. width: 25px;
  151. font-size: 12px;
  152. padding: 0;
  153. }
  154. .plugin-item .detail-option.detail-option {
  155. color: #909399;
  156. background: #F2F6FC;
  157. }
  158. .plugin-item .detail-option:hover {
  159. color: #fff;
  160. background: #909399;
  161. }
  162. </style>
  163. <div id="app" v-cloak>
  164. <el-card shadow="never" style="border:0;min-width: 1200px;" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  165. <div slot="header">
  166. <div>
  167. <span>推荐人列表</span>
  168. <div style="float: right; margin: -5px 0">
  169. <el-button type="primary" size="small" @click="handleAdds">新增</el-button>
  170. </div>
  171. </div>
  172. </div>
  173. <div class="table-body">
  174. <el-form :inline="true" :model="search_data" size="small" class="demo-form-inline">
  175. <el-form-item label="">
  176. <el-input size="small" placeholder="请输入名称" @keyup.enter.native="search" v-model="search_data.name"></el-input>
  177. </el-form-item>
  178. <el-form-item label="">
  179. <el-input size="small" placeholder="请输入手机号" @keyup.enter.native="search" v-model="search_data.mobile"></el-input>
  180. </el-form-item>
  181. <el-form-item>
  182. <el-button type="primary" @click="search">搜索</el-button>
  183. <el-button type="danger" @click="clearSearch" v-if="show_clear_search_btn">清除条件</el-button>
  184. </el-form-item>
  185. </el-form>
  186. <template>
  187. <div>
  188. <el-table :data="tableData" style="width: 100%;margin-bottom: 20px;" row-key="id" lazy :load="loadList">
  189. <el-table-column prop="id" label="id" align="center"></el-table-column>
  190. <el-table-column prop="name" label="名称" align="center" >
  191. <template slot-scope="scope">
  192. <span style="margin-left: 10px">{{ scope.row.name }}
  193. </span>
  194. </template>
  195. </el-table-column>
  196. <el-table-column prop="mobile" label="手机号" align="center">
  197. <template slot-scope="scope">
  198. <span style="margin-left: 10px">{{ scope.row.mobile }}</span>
  199. </template>
  200. </el-table-column>
  201. <!-- <el-table-column prop="status" label="状态">-->
  202. <!-- <template slot-scope="scope">-->
  203. <!-- <el-switch v-model="scope.row.status" :inactive-value="0" :active-value="1" active-color="#409EFF" inactive-color="#C0CCDA" @change="handleUpdate(scope.row)">-->
  204. <!-- </el-switch>-->
  205. <!-- </template>-->
  206. <!-- </el-table-column>-->
  207. <el-table-column label="操作" align="center">
  208. <template slot-scope="scope">
  209. <el-button type="text" @click="handleEdit(scope.$index, scope.row)">
  210. 编辑
  211. </el-button>
  212. <el-button type="text" @click="handleDelete(scope.$index, scope.row)">
  213. 删除
  214. </el-button>
  215. <el-button type="text" @click="copyLink(scope.row.url)">复制链接</el-button>
  216. </template>
  217. </el-table-column>
  218. </el-table>
  219. <div style="text-align: right;margin: 20px 0;">
  220. <el-pagination @current-change="pagination" background layout="prev, pager, next" :page-count="pageCount"></el-pagination>
  221. </div>
  222. </div>
  223. </template>
  224. </div>
  225. <el-dialog title="新增" :visible.sync="dialogFormVisible_add_0">
  226. <el-form :model="form0" :rules="rules" ref="form0" @close="handleClose('form0')">
  227. <el-form-item label="名称" :label-width="formLabelWidth" prop="name">
  228. <el-input v-model="form0.name" autocomplete="off"></el-input>
  229. </el-form-item>
  230. <el-form-item label="手机号" :label-width="formLabelWidth" prop="mobile">
  231. <el-input v-model="form0.mobile" autocomplete="off"></el-input>
  232. </el-form-item>
  233. </el-form>
  234. <div slot="footer" class="dialog-footer">
  235. <el-button @click="dialogFormVisible_add_0 = false">取 消</el-button>
  236. <el-button type="primary" @click="postAdd0('form0')">确 定</el-button>
  237. </div>
  238. </el-dialog>
  239. <el-dialog title="编辑" :visible.sync="dialogFormVisible_edit">
  240. <el-form :model="form" :rules="rules" ref="form">
  241. <el-form-item label="名称" :label-width="formLabelWidth" prop="name">
  242. <el-input v-model="form.name" autocomplete="off"></el-input>
  243. </el-form-item>
  244. <el-form-item label="手机号" :label-width="formLabelWidth" prop="mobile">
  245. <el-input v-model="form.mobile" autocomplete="off"></el-input>
  246. </el-form-item>
  247. </el-form>
  248. <div slot="footer" class="dialog-footer">
  249. <el-button @click="dialogFormVisible_edit=false">取 消</el-button>
  250. <el-button type="primary" @click="postEdit('form')">确 定</el-button>
  251. </div>
  252. </el-dialog>
  253. </el-card>
  254. <textarea style="opacity: 0;width: 0;height: 0;" id="copy-container"></textarea>
  255. </div>
  256. <script>
  257. new Vue({
  258. el: '#app',
  259. data() {
  260. return {
  261. search_data: { // 筛选条件
  262. name: '',
  263. mobile: ''
  264. },
  265. tableData: [],
  266. dialogFormVisible_edit: false,
  267. dialogFormVisible_add: false,
  268. dialogFormVisible_add_0: false,
  269. form0: {
  270. name: '',
  271. mobile: ''
  272. },
  273. rules: {
  274. name: [{
  275. required: true,
  276. message: '请输入名称',
  277. trigger: 'blur'
  278. },
  279. ],
  280. mobile: [{
  281. required: true,
  282. message: '请输入手机号',
  283. trigger: 'blur'
  284. }, ],
  285. },
  286. form: {
  287. id: '',
  288. name: '',
  289. mobile: ''
  290. },
  291. formLabelWidth: '120px',
  292. dialogPage: 1,
  293. dialogPageCount: 0,
  294. pageCount: 0,
  295. page: 1,
  296. }
  297. },
  298. created() {
  299. this.loadList({});
  300. },
  301. computed: {
  302. show_clear_search_btn: function () {
  303. return !isEmpty(this.search_data.name) || !isEmpty(this.search_data.mobile)
  304. }
  305. },
  306. methods: {
  307. search() {
  308. this.page = 1;
  309. this.loadList({});
  310. },
  311. clearSearch() {
  312. this.page = 1;
  313. this.search_data.name = '';
  314. this.search_data.mobile = '';
  315. this.loadList({});
  316. },
  317. dialogPagination(currentPage) {
  318. let self = this;
  319. self.dialogPage = currentPage;
  320. self.dialogList();
  321. },
  322. pagination(currentPage) {
  323. let self = this;
  324. self.page = currentPage;
  325. self.loadList({});
  326. },
  327. loadList(params) {
  328. params['r'] = 'admin/reference/index';
  329. params['page'] = this.page;
  330. params['mobile'] = this.search_data.mobile;
  331. params['name'] = this.search_data.name;
  332. this.$request({
  333. params: params,
  334. }).then(e => {
  335. if (e.data.code == 0) {
  336. this.tableData = e.data.data.list
  337. this.loading = false;
  338. this.pageCount = e.data.data.page_count;
  339. }
  340. }).catch(e => {});
  341. },
  342. handleEdit(index, row) {
  343. this.dialogFormVisible_edit = true;
  344. this.form.id = row.id
  345. this.$request({
  346. params: {
  347. r: 'admin/reference/edit',
  348. id: row.id
  349. },
  350. }).then(e => {
  351. if(e.data.code==0){
  352. this.form = e.data.data;
  353. }else{
  354. this.$message.error(e.data.msg);
  355. }
  356. }).catch(e => {});
  357. },
  358. handleAdds() {
  359. this.dialogFormVisible_add_0 = true;
  360. },
  361. postEdit(formName){
  362. this.$refs[formName].validate((valid) => {
  363. if(valid){
  364. this.$request({
  365. method:"post",
  366. params: {
  367. r:'admin/reference/edit',
  368. },
  369. data:this.form
  370. }).then(e => {
  371. if(e.data.code==0){
  372. if(this.form.id){
  373. this.dialogFormVisible_edit = false;
  374. }else{
  375. this.dialogFormVisible_add = false;
  376. }
  377. this.$message({
  378. message: e.data.msg,
  379. type: 'success'
  380. });
  381. this.loadList({});
  382. }else{
  383. this.$message.error(e.data.msg);
  384. }
  385. }).catch(e => {
  386. });
  387. }
  388. });
  389. },
  390. postAdd0(formName) {
  391. this.$refs[formName].validate((valid) => {
  392. if (valid) {
  393. this.$request({
  394. method: "post",
  395. params: {
  396. r: 'admin/reference/edit',
  397. },
  398. data: this.form0
  399. }).then(e => {
  400. if (e.data.code == 0) {
  401. this.dialogFormVisible_add_0 = false;
  402. this.handleClose(formName);
  403. this.$message({
  404. message: e.data.msg,
  405. type: 'success'
  406. });
  407. this.loadList({});
  408. }else{
  409. this.$message.error(e.data.msg);
  410. }
  411. }).catch(e => {});
  412. }
  413. });
  414. },
  415. handleDelete(index, row) {
  416. this.$confirm('删除该条数据后不可以恢复, 是否继续?', '警告', {type: 'warning'}).then(() => {
  417. this.form.id = row.id
  418. this.$request({
  419. params: {
  420. r: 'admin/reference/del',
  421. id: row.id
  422. },
  423. }).then(e => {
  424. if (e.data.code == 0) {
  425. this.$message({
  426. message: e.data.msg,
  427. type: 'success'
  428. });
  429. location.reload();
  430. }else{
  431. this.$message({
  432. message: e.data.msg,
  433. type: 'error'
  434. });
  435. }
  436. }).catch(e => {});
  437. });
  438. },
  439. handleUpdate(row) {
  440. this.form.id = row.id
  441. this.$request({
  442. method: "post",
  443. params: {
  444. r:'admin/reference/update-status',
  445. },
  446. data: {
  447. id:row.id,
  448. status:row.status
  449. }
  450. }).then(e => {
  451. if (e.data.code == 0) {
  452. this.$message({
  453. message: e.data.msg,
  454. type: 'success'
  455. });
  456. }
  457. }).catch(e => {});
  458. },
  459. handleClose(formName){
  460. this.$refs[formName].resetFields();
  461. }, // 复制首页链接
  462. copyLink(link) {
  463. var input = document.getElementById("copy-container");
  464. input.value = link; // 修改文本框的内容
  465. input.select(); // 选中文本
  466. document.execCommand("copy"); // 执行浏览器复制命令
  467. this.$message.success('复制成功');
  468. },
  469. },
  470. });
  471. </script>