index.php 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475
  1. <?php
  2. ?>
  3. <div id="app" v-cloak>
  4. <el-card shadow="never" style="border:0;min-width: 1000px;" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  5. <div slot="header">
  6. <span>自提点管理</span>
  7. <el-button type="primary" size="small" style="padding: 9px 15px !important; float: right; position: relative; bottom: 8px;" @click="add">+添加自提点</el-button>
  8. </div>
  9. <div class="table-body">
  10. <div style="padding-bottom: 20px;">
  11. <div class="flex" style="flex-wrap:wrap;">
  12. <div class="flex" style="margin-right: 20px;">
  13. <el-date-picker v-model="addTime" type="datetimerange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd HH:mm:ss" @change="addTimeChange" :default-time="['00:00:00', '23:59:59']">
  14. </el-date-picker>
  15. </div>
  16. <div class="flex" style="margin-right: 20px;">
  17. <el-input size="small" style="width: 140px;" placeholder="请输入团长会员ID" v-model="searchData.user_id">
  18. </el-input>
  19. </div>
  20. <div class="flex" style="margin-right: 20px;">
  21. <el-input size="small" style="width: 130px;" placeholder="团长昵称" v-model="searchData.nickname">
  22. </el-input>
  23. </div>
  24. <div class="flex" style="margin-right: 20px;">
  25. <el-input size="small" style="width: 130px;" placeholder="手机号" v-model="searchData.mobile">
  26. </el-input>
  27. </div>
  28. <div class="flex" style="margin-right: 20px;">
  29. <el-input size="small" style="width: 130px;" placeholder="自提点名称" v-model="searchData.name">
  30. </el-input>
  31. </div>
  32. <div class="flex" style="margin-right: 20px;">
  33. <el-input size="small" style="width: 130px;" placeholder="自提点地址" v-model="searchData.address">
  34. </el-input>
  35. </div>
  36. <div class="flex" style="margin-top:8px;">
  37. <el-button style="padding: 9px 15px !important;" size="small" type="primary" @click="searchs">搜索</el-button>
  38. <el-button type="warning" @click="clereSearch" v-if="searchData.user_id || searchData.name || searchData.nickname || searchData.address || searchData.start_at || searchData.address.end_at" style="font-size:12px;padding: 9px 15px !important;">清除搜索条件</el-button>
  39. </div>
  40. </div>
  41. </div>
  42. <el-table :data="list" stripe v-loading="loading" size="small" style="margin-bottom: 15px; width: 100%">
  43. <el-table-column prop="id" label="序号" width="100" align="center"></el-table-column>
  44. <el-table-column label="团长昵称" width="200" prop="user_id" align="center">
  45. <template slot-scope="scope">
  46. <com-image v-if="scope.row.user" style="float: left;" mode="aspectFill" :src="scope.row.user.avatar_url"></com-image>
  47. <div v-if="scope.row.user">{{scope.row.user.nickname}}</div>
  48. <div v-if="scope.row.user">{{scope.row.user.id}}</div>
  49. </template>
  50. </el-table-column>
  51. <el-table-column label="手机号" prop="mobile" align="center">
  52. <template slot-scope="scope">
  53. <div>{{scope.row.mobile}}</div>
  54. </template>
  55. </el-table-column>
  56. <el-table-column label="自提点名称" prop="name" align="center">
  57. <template slot-scope="scope">
  58. <div>{{scope.row.name}}</div>
  59. </template>
  60. </el-table-column>
  61. <el-table-column label="自提点地址" prop="address" align="center">
  62. <template slot-scope="scope">
  63. <div>{{scope.row.address}}</div>
  64. </template>
  65. </el-table-column>
  66. <el-table-column label="身份证" prop="idcard_img" align="center">
  67. <template slot-scope="scope">
  68. <el-image v-for="(img, index) in scope.row.idcard_img" :key="index" mode="aspectFill" :width="'auto'" style="width: 50px; height: 50px; margin-right: 5px" :src="img" :preview-src-list="scope.row.idcard_img">
  69. </el-image>
  70. </template>
  71. </el-table-column>
  72. <el-table-column label="营业执照" prop="license_img" align="center">
  73. <template slot-scope="scope">
  74. <el-image mode="aspectFill" :width="'auto'" style="width: 50px; height: 50px" :src="scope.row.license_img" :preview-src-list="[scope.row.license_img]">
  75. </el-image>
  76. </template>
  77. </el-table-column>
  78. <el-table-column label="开启" prop="status" width="80" align="center">
  79. <template slot-scope="scope">
  80. <el-switch v-model="scope.row.status" :active-value="1" :inactive-value="0" @change="handleStatusChange(scope.row.status, scope.row.id, scope.$index)"></el-switch>
  81. </template>
  82. </el-table-column>
  83. <el-table-column label="入驻时间" prop="created_at" align="center">
  84. <template slot-scope="scope">
  85. <div>
  86. {{scope.row.created_at | dateTimeFormat('Y-m-d H:i:s')}}
  87. </div>
  88. </template>
  89. </el-table-column>
  90. <el-table-column label="操作" style="width: 200px;" fixed="right" align="center">
  91. <template slot-scope="scope">
  92. <el-button type="text" size="small" @click="goToDetail(scope.row.id)">编辑</el-button>
  93. <el-button type="text" size="small" @click="deleteOne(scope.row, scope.$index)">删除</el-button>
  94. </template>
  95. </el-table-column>
  96. </el-table>
  97. <div style="text-align: right;margin: 20px 0;">
  98. <el-pagination @current-change="pagination" background layout="prev, pager, next" :page-count="pageCount"></el-pagination>
  99. </div>
  100. </div>
  101. </el-card>
  102. </div>
  103. <script>
  104. const app = new Vue({
  105. el: '#app',
  106. data: {
  107. searchData: {
  108. user_id: '',
  109. nickname: '',
  110. start_at: '',
  111. end_at: '',
  112. name: '',
  113. address: '',
  114. mobile: '',
  115. },
  116. currPage: 1,
  117. pageCount: 0,
  118. loading: false,
  119. dialogVisible: false,
  120. list: [],
  121. dialogLoading: false,
  122. addTime: '', //注册时间
  123. storeStatus: {
  124. 1: '正常',
  125. 2: '禁用'
  126. },
  127. },
  128. mounted() {
  129. this.loadData();
  130. },
  131. methods: {
  132. searchs() {
  133. this.currPage = 1;
  134. this.loadData();
  135. },
  136. addTimeChange(v) {
  137. this.searchData.start_at = v ? v[0] : '';
  138. this.searchData.end_at = v ? v[1] : '';
  139. },
  140. clereSearch() {
  141. this.searchData.nickname = '';
  142. this.searchData.user_id = '';
  143. this.searchData.start_at = '';
  144. this.searchData.end_at = '';
  145. this.searchData.name = '';
  146. this.searchData.address = '';
  147. this.currPage = 1;
  148. this.loadData();
  149. },
  150. handleStatusChange(status, id, index) {
  151. let self = this;
  152. let tip = status == 1 ? '开启' : '关闭';
  153. self.$confirm(tip + '该自提点, 是否继续?', '提示', {
  154. confirmButtonText: '确定',
  155. cancelButtonText: '取消',
  156. type: 'warning'
  157. }).then(() => {
  158. self.loading = true;
  159. request({
  160. params: {
  161. r: 'community/community-head/switch-status',
  162. },
  163. data: {
  164. id: id,
  165. status: status,
  166. },
  167. method: 'post'
  168. }).then(e => {
  169. self.loading = false;
  170. if (e.data.code == 0) {
  171. this.list[index].status = status;
  172. self.$message.success('操作成功');
  173. } else {
  174. self.$message.error('操作失败');
  175. }
  176. }).catch(e => {
  177. self.loading = false;
  178. console.log(e);
  179. self.$message.error('网络错误');
  180. });
  181. }).catch(() => {
  182. });
  183. },
  184. deleteOne(row, index) {
  185. let self = this;
  186. self.$confirm('删除该自提点, 是否继续?', '提示', {
  187. confirmButtonText: '确定',
  188. cancelButtonText: '取消',
  189. type: 'warning'
  190. }).then(() => {
  191. self.listLoading = true;
  192. request({
  193. params: {
  194. r: 'community/community-head/delete',
  195. },
  196. method: 'post',
  197. data: {
  198. id: row.id,
  199. }
  200. }).then(e => {
  201. self.listLoading = false;
  202. if (e.data.code === 0) {
  203. self.$message.success(e.data.msg);
  204. self.list.splice(index, 1);
  205. } else {
  206. self.$message.error(e.data.msg);
  207. }
  208. }).catch(e => {
  209. console.log(e);
  210. });
  211. }).catch(() => {
  212. self.$message.info('已取消删除')
  213. });
  214. },
  215. loadData() {
  216. this.loading = true;
  217. request({
  218. params: {
  219. r: 'community/community-head/index',
  220. page: this.currPage,
  221. ...this.searchData,
  222. },
  223. method: 'get',
  224. }).then(e => {
  225. this.loading = false;
  226. if (e.data.code == 0) {
  227. this.list = e.data.data.list;
  228. this.pageCount = e.data.data.page_count;
  229. } else {
  230. this.$message.error(e.data.msg);
  231. }
  232. }).catch(e => {
  233. this.loading = false;
  234. });
  235. },
  236. pagination(currentPage) {
  237. let self = this;
  238. self.currPage = currentPage;
  239. self.loadData();
  240. },
  241. add(id) {
  242. navigateTo({
  243. r: 'community/community-head/storage',
  244. });
  245. },
  246. // 跳转门店详情页
  247. goToDetail(id) {
  248. navigateTo({
  249. r: 'community/community-head/storage',
  250. id: id,
  251. });
  252. },
  253. }
  254. });
  255. </script>
  256. <style>
  257. .el-tabs__header {
  258. font-size: 16px;
  259. }
  260. .table-body {
  261. padding: 20px;
  262. background-color: #fff;
  263. }
  264. .input-item {
  265. width: 250px;
  266. margin-right: 40px;
  267. }
  268. .input-item .el-input__inner {
  269. border-right: 0;
  270. }
  271. .input-item .el-input__inner:hover {
  272. border: 1px solid #dcdfe6;
  273. border-right: 0;
  274. outline: 0;
  275. }
  276. .input-item .el-input__inner:focus {
  277. border: 1px solid #dcdfe6;
  278. border-right: 0;
  279. outline: 0;
  280. }
  281. .input-item .el-input-group__append {
  282. background-color: #fff;
  283. border-left: 0;
  284. width: 10%;
  285. padding: 0;
  286. }
  287. .input-item .el-input-group__append .el-button {
  288. padding: 0;
  289. }
  290. .input-item .el-input-group__append .el-button {
  291. margin: 0;
  292. }
  293. .table-body {
  294. padding: 20px;
  295. background-color: #fff;
  296. }
  297. .table-body .el-button {
  298. padding: 0 !important;
  299. border: 0;
  300. margin: 0 5px;
  301. }
  302. .input-item {
  303. width: 250px;
  304. margin: 0 0 20px;
  305. display: inline-block;
  306. }
  307. .input-item .el-input__inner {
  308. border-right: 0;
  309. }
  310. .input-item .el-input__inner:hover {
  311. border: 1px solid #dcdfe6;
  312. border-right: 0;
  313. outline: 0;
  314. }
  315. .input-item .el-input__inner:focus {
  316. border: 1px solid #dcdfe6;
  317. border-right: 0;
  318. outline: 0;
  319. }
  320. .input-item .el-input-group__append {
  321. background-color: #fff;
  322. border-left: 0;
  323. width: 10%;
  324. padding: 0;
  325. }
  326. .input-item .el-input-group__append .el-button {
  327. padding: 0;
  328. }
  329. .input-item .el-input-group__append .el-button {
  330. margin: 0;
  331. }
  332. .batch {
  333. margin: 0 0 20px;
  334. display: inline-block;
  335. }
  336. .batch .el-button {
  337. padding: 9px 15px !important;
  338. }
  339. .el-table th>.cell {
  340. color: #333;
  341. font-weight: bold;
  342. font-size: 14px;
  343. }
  344. .el-table__footer-wrapper,
  345. .el-table__header-wrapper {
  346. border-bottom: 1.4px solid #D6D6D6;
  347. }
  348. .el-table .el-button {
  349. padding: 0 !important;
  350. border: 0;
  351. margin: 0 5px;
  352. }
  353. #app .copy .el-input-group__append {
  354. background-color: #409EFF;
  355. border-color: #409EFF;
  356. padding: 0 10px;
  357. }
  358. #app .table-body .copybtn {
  359. color: #fff;
  360. padding: 0 30px;
  361. }
  362. .el-alert {
  363. padding: 0;
  364. padding-left: 5px;
  365. padding-bottom: 5px;
  366. }
  367. .el-alert--info .el-alert__description {
  368. color: #606266;
  369. }
  370. .el-alert .el-button {
  371. margin-left: 20px;
  372. }
  373. .el-alert__content {
  374. display: flex;
  375. align-items: center;
  376. }
  377. .table-body .el-alert__title {
  378. margin-top: 5px;
  379. font-weight: 400;
  380. }
  381. .el-table th>.cell {
  382. color: #333;
  383. font-weight: bold;
  384. font-size: 14px;
  385. }
  386. .el-table__footer-wrapper,
  387. .el-table__header-wrapper {
  388. border-bottom: 1.4px solid #D6D6D6;
  389. }
  390. .item-box {
  391. margin-right: 20px;
  392. }
  393. .flex {
  394. display: flex;
  395. align-items: center;
  396. }
  397. .input-title {
  398. margin-right: 15px;
  399. }
  400. .item-box .label {
  401. margin-right: 8px;
  402. }
  403. .com-share-pop {
  404. display: inline-block;
  405. }
  406. .grid-icon {
  407. color: #999;
  408. cursor: pointer;
  409. font-size: 18px;
  410. }
  411. .el-input__inner {
  412. height: 32px;
  413. line-height: 32px;
  414. }
  415. .el-range-editor.el-input__inner {
  416. padding: 0 15px;
  417. }
  418. .el-date-editor .el-range-input,
  419. .el-date-editor .el-range-separator {
  420. font-size: 13px;
  421. height: auto;
  422. }
  423. </style>