index.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  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. /* 卡片 */
  53. .plugin-list {
  54. margin: 0 0 0 -20px;
  55. /* padding-right: 100px; */
  56. display: flex;
  57. flex-wrap: wrap;
  58. }
  59. .plugin-list .plugin-item {
  60. width: 20%;
  61. min-width: 400px;
  62. }
  63. .plugin-item {
  64. border: 1px solid #ebebeb;
  65. background: #FFFFFF;
  66. box-shadow: 3px 5px 15px rgba(80, 80, 80, 0.16);
  67. opacity: 1;
  68. border-radius: 5px;
  69. padding: 20px;
  70. margin: 0 0 20px 20px;
  71. transition: 250ms;
  72. position: relative;
  73. /* min-width: 300px; */
  74. }
  75. .plugin-item .item-status {
  76. position: absolute;
  77. top: 0;
  78. right: 0;
  79. width: 94px;
  80. height: 30px;
  81. background: #E8EAEC;
  82. opacity: 1;
  83. border-radius: 0px 5px 0px 5px;
  84. font-size: 14px;
  85. font-family: Microsoft YaHei;
  86. font-weight: 400;
  87. line-height: 30px;
  88. color: #9398A4;
  89. text-align: center;
  90. }
  91. .item-status-permanent {
  92. width: 94px;
  93. }
  94. .item-status-effective {
  95. width: 164px;
  96. }
  97. .plugin-item .item-info {
  98. display: flex;
  99. align-items: center;
  100. }
  101. /* .plugin-item .item-info .item-right{
  102. min-width: 500px;
  103. } */
  104. .plugin-item .item-btns {
  105. display: flex;
  106. align-items: center;
  107. justify-content: flex-end;
  108. margin-top: 12px;
  109. }
  110. .plugin-item .mall-logo {
  111. width: 70px;
  112. height: 70px;
  113. margin-right: 12px;
  114. }
  115. .plugin-item .mall-logo img {
  116. width: 100%;
  117. height: 100%;
  118. display: block;
  119. border-radius: 50%;
  120. }
  121. .plugin-item .display-name {
  122. font-size: 18pt;
  123. margin-top: 10px;
  124. margin-bottom: 4px;
  125. font-family: Microsoft YaHei;
  126. font-weight: bold;
  127. line-height: 30px;
  128. color: #3F495D;
  129. opacity: 1;
  130. width: 200px;
  131. white-space: nowrap;
  132. overflow: hidden;
  133. text-overflow: ellipsis;
  134. }
  135. .plugin-item .name {
  136. color: #909399;
  137. }
  138. .plugin-item:hover {
  139. cursor: pointer;
  140. border-color: #bfddff;
  141. }
  142. /* .plugin-item:hover .display-name {
  143. color: #409EFF;
  144. } */
  145. .plugin-item .plugin-option-btn {
  146. height: 25px;
  147. width: 25px;
  148. font-size: 12px;
  149. padding: 0;
  150. }
  151. .plugin-item .detail-option.detail-option {
  152. color: #909399;
  153. background: #F2F6FC;
  154. }
  155. .plugin-item .detail-option:hover {
  156. color: #fff;
  157. background: #909399;
  158. }
  159. </style>
  160. <div id="app" v-cloak>
  161. <el-card shadow="never" style="border:0" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  162. <div slot="header">
  163. <div>
  164. <span>服务协议</span>
  165. <div style="float: right; margin: -5px 0">
  166. <el-button class="all_button" type="primary" size="small" @click="handleEdit('')">添加协议</el-button>
  167. </div>
  168. </div>
  169. </div>
  170. <div class="table-body">
  171. <el-form :inline="true" :model="search_data" size="small" class="demo-form-inline">
  172. <el-form-item label="">
  173. <el-input placeholder="请输入搜索内容" v-model="search_data.name" clearable>
  174. <el-button slot="append" icon="el-icon-search" @click="search"></el-button>
  175. </el-input>
  176. </el-form-item>
  177. </el-form>
  178. <el-table v-loading="loading" :data="list" style="width: 100%;margin-bottom: 15px">
  179. <!-- <el-table-column type="selection" width="55"></el-table-column>-->
  180. <el-table-column prop="id" label="ID" width="100"></el-table-column>
  181. <el-table-column prop="name" width="280" label="协议名称"></el-table-column>
  182. <el-table-column prop="remark" label="备注"></el-table-column>
  183. <el-table-column prop="sort" label="排序">
  184. <template slot-scope="scope">
  185. <div v-if="sort_id != scope.row.id">
  186. <el-tooltip class="item" effect="dark" content="排序" placement="top">
  187. <span>{{scope.row.sort}}</span>
  188. </el-tooltip>
  189. <el-button class="edit-sort" type="text" @click="editSort(scope.row,'sort')">
  190. <img src="resources/img/mall/order/edit.png" alt="">
  191. </el-button>
  192. </div>
  193. <div style="display: flex;align-items: center" v-else>
  194. <el-input style="min-width: 70px" type="number" size="mini" class="change" v-model="sort"
  195. autocomplete="off"></el-input>
  196. <el-button class="change-quit" type="text" style="color: #F56C6C;padding: 0 5px"
  197. icon="el-icon-error" circle @click="cancelEdit('sort')"></el-button>
  198. <el-button class="change-success" type="text"
  199. style="margin-left: 0;color: #67C23A;padding: 0 5px" icon="el-icon-success"
  200. circle @click="handle('sort',scope.row)">
  201. </el-button>
  202. </div>
  203. </template>
  204. </el-table-column>
  205. <el-table-column width='280' prop="created_at" label="添加日期">
  206. <template slot-scope="scope">
  207. {{scope.row.created_at|dateTimeFormat('Y-m-d H:i:s')}}
  208. </template>
  209. </el-table-column>
  210. <el-table-column label="操作" width="280">
  211. <template slot-scope="scope">
  212. <el-button type="text" size="mini" circle style="margin-left: 10px;margin-top: 10px"
  213. @click="handleEdit(scope.row.id)">
  214. 编辑
  215. </el-button>
  216. <el-button style="margin-left: 10px;margin-top: 10px" type="text" class="set-el-button"
  217. size="mini" circle @click="handleDelete(scope.row.id)">
  218. 删除
  219. </el-button>
  220. </template>
  221. </el-table-column>
  222. </el-table>
  223. <el-pagination v-if="pagination" :page-size="page_size" style="display: inline-block;float: right;"
  224. background @current-change="pageChange" layout="prev, pager, next"
  225. :total="pagination.totalCount">
  226. </el-pagination>
  227. </div>
  228. </el-card>
  229. </div>
  230. <script>
  231. const app = new Vue({
  232. el: '#app',
  233. data() {
  234. return {
  235. loading: false,
  236. list: [],
  237. type_list: Object,
  238. status_list: Object,
  239. name: '',
  240. pagination: null,
  241. page: 1,
  242. page_size: 10,
  243. page_count: 1,
  244. search_data: { // 筛选条件
  245. name: null,
  246. start: null,
  247. end: null,
  248. },
  249. datetime: [],
  250. multipleSelect: [],
  251. sort: 0,
  252. sort_id: 0,
  253. };
  254. },
  255. computed: {
  256. show_clear_search_btn: function () {
  257. return !isEmpty(this.search_data.start) || !isEmpty(this.search_data.end) || !isEmpty(this.search_data.name);
  258. }
  259. },
  260. methods: {
  261. //分页
  262. pageChange(page) {
  263. this.page = page;
  264. this.loadData({});
  265. },
  266. // 根据参数获取请求信息
  267. loadData(search_data) {
  268. this.loading = true;
  269. console.log(this.keyword)
  270. request({
  271. params: {
  272. r: 'mall/service-agreement/index',
  273. name: search_data.name,
  274. start: search_data.start,
  275. end: search_data.end,
  276. page: this.page,
  277. },
  278. }).then(e => {
  279. this.loading = false;
  280. if (e.data.code === 0) {
  281. this.list = e.data.data.list;
  282. this.type_list = e.data.data.type_list;
  283. this.status_list = e.data.data.status_list;
  284. this.pagination = e.data.data.pagination;
  285. this.page_size = e.data.data.page_size;
  286. this.page_count = e.data.data.page_count;
  287. } else {
  288. this.listLoading = false;
  289. this.$message({
  290. message: e.data.msg,
  291. type: 'error'
  292. });
  293. }
  294. }).catch(e => {
  295. this.listLoading = false;
  296. });
  297. },
  298. handleEdit(id) {
  299. navigateTo({
  300. r: 'mall/service-agreement/edit',
  301. id: id,
  302. });
  303. },
  304. handleDelete(id) {
  305. this.$confirm('删除该条数据后不可以恢复, 是否继续?', '警告', {type: 'warning'}).then(() => {
  306. this.$request({
  307. params: {
  308. r: 'mall/service-agreement/del',
  309. id: id,
  310. },
  311. }).then(e => {
  312. if (e.data.code == 0) {
  313. this.$message({
  314. message: e.data.msg,
  315. type: 'success'
  316. });
  317. location.reload();
  318. }
  319. }).catch(e => {
  320. });
  321. });
  322. },
  323. editSort(row, type) {
  324. switch (type) {
  325. case 'sort':
  326. this.sort = row.sort;
  327. this.sort_id = row.id;
  328. break;
  329. }
  330. },
  331. cancelEdit(type) {
  332. switch (type) {
  333. case 'sort':
  334. this.sort = 0;
  335. this.sort_id = 0;
  336. break;
  337. }
  338. },
  339. handle(type, data = null) {
  340. let id = data ? parseInt(data.id) : '';
  341. switch (type) {
  342. case 'sort':
  343. param = {
  344. id: id,
  345. sort: this.sort,
  346. type
  347. };
  348. this.do_sort(param);
  349. break;
  350. }
  351. this.cancelEdit(type);
  352. },
  353. do_sort(params) {
  354. let self = this;
  355. request({
  356. params: {
  357. r: 'mall/service-agreement/sort',
  358. },
  359. method: 'post',
  360. data: params
  361. }).then(e => {
  362. if (e.data.code == 0) {
  363. self.$message.success(e.data.msg);
  364. self.loadData({});
  365. } else {
  366. self.$message.error(e.data.msg);
  367. }
  368. }).catch(e => {
  369. console.log(e);
  370. });
  371. },
  372. search() {
  373. this.loadData(this.search_data);
  374. },
  375. clearSearch() {
  376. this.search_data.name = null;
  377. },
  378. },
  379. created() {
  380. this.loadData({});
  381. }
  382. })
  383. </script>