| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421 |
- <style>
- .table-body {
- padding: 20px 20px;
- background-color: #fff;
- }
- .table-body .top-input {
- margin-top: 34px;
- }
- .input-item {
- width: 200px;
- margin-right: 20px;
- }
- .input-item .el-input__inner {
- border-right: 0;
- }
- .input-item .el-input__inner:hover {
- border: 1px solid #dcdfe6;
- border-right: 0;
- outline: 0;
- }
- .input-item .el-input__inner:focus {
- border: 1px solid #dcdfe6;
- border-right: 0;
- outline: 0;
- }
- .input-item .el-input-group__append {
- background-color: #fff;
- border-left: 0;
- width: 10%;
- padding: 0;
- }
- .input-item .el-input-group__append .el-button {
- padding: 0;
- }
- .input-item .el-input-group__append .el-button {
- margin: 0;
- }
- /* #app .table-body .el-table .el-button {
- border-radius: 16px;
- } */
- .create {
- height: 36px;
- line-height: 36px;
- float: right;
- color: #BCBCBC;
- margin-left: 20px;
- }
- .name {
- cursor: pointer;
- color: #49A9FF;
- }
- /* 卡片 */
- .plugin-list {
- margin: 0 0 0 -20px;
- /* padding-right: 100px; */
- display: flex;
- flex-wrap: wrap;
- }
- .plugin-list .plugin-item {
- width: 20%;
- min-width: 400px;
- }
- .plugin-item {
- border: 1px solid #ebebeb;
- background: #FFFFFF;
- box-shadow: 3px 5px 15px rgba(80, 80, 80, 0.16);
- opacity: 1;
- border-radius: 5px;
- padding: 20px;
- margin: 0 0 20px 20px;
- transition: 250ms;
- position: relative;
- /* min-width: 300px; */
- }
- .plugin-item .item-status {
- position: absolute;
- top: 0;
- right: 0;
- width: 94px;
- height: 30px;
- background: #E8EAEC;
- opacity: 1;
- border-radius: 0px 5px 0px 5px;
- font-size: 14px;
- font-family: Microsoft YaHei;
- font-weight: 400;
- line-height: 30px;
- color: #9398A4;
- text-align: center;
- }
- .item-status-permanent {
- width: 94px;
- }
- .item-status-effective {
- width: 164px;
- }
- .plugin-item .item-info {
- display: flex;
- align-items: center;
- }
- /* .plugin-item .item-info .item-right{
- min-width: 500px;
- } */
- .plugin-item .item-btns {
- display: flex;
- align-items: center;
- justify-content: flex-end;
- margin-top: 12px;
- }
- .plugin-item .mall-logo {
- width: 70px;
- height: 70px;
- margin-right: 12px;
- }
- .plugin-item .mall-logo img {
- width: 100%;
- height: 100%;
- display: block;
- border-radius: 50%;
- }
- .plugin-item .display-name {
- font-size: 18pt;
- margin-top: 10px;
- margin-bottom: 4px;
- font-family: Microsoft YaHei;
- font-weight: bold;
- line-height: 30px;
- color: #3F495D;
- opacity: 1;
- width: 200px;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- .plugin-item .name {
- color: #909399;
- }
- .plugin-item:hover {
- cursor: pointer;
- border-color: #bfddff;
- }
- /* .plugin-item:hover .display-name {
- color: #409EFF;
- } */
- .plugin-item .plugin-option-btn {
- height: 25px;
- width: 25px;
- font-size: 12px;
- padding: 0;
- }
- .plugin-item .detail-option.detail-option {
- color: #909399;
- background: #F2F6FC;
- }
- .plugin-item .detail-option:hover {
- color: #fff;
- background: #909399;
- }
- </style>
- <div id="app" v-cloak>
- <el-card shadow="never" style="border:0" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
- <div slot="header">
- <div>
- <span>服务协议</span>
- <div style="float: right; margin: -5px 0">
- <el-button class="all_button" type="primary" size="small" @click="handleEdit('')">添加协议</el-button>
- </div>
- </div>
- </div>
- <div class="table-body">
- <el-form :inline="true" :model="search_data" size="small" class="demo-form-inline">
- <el-form-item label="">
- <el-input placeholder="请输入搜索内容" v-model="search_data.name" clearable>
- <el-button slot="append" icon="el-icon-search" @click="search"></el-button>
- </el-input>
- </el-form-item>
- </el-form>
- <el-table v-loading="loading" :data="list" style="width: 100%;margin-bottom: 15px">
- <!-- <el-table-column type="selection" width="55"></el-table-column>-->
- <el-table-column prop="id" label="ID" width="100"></el-table-column>
- <el-table-column prop="name" width="280" label="协议名称"></el-table-column>
- <el-table-column prop="remark" label="备注"></el-table-column>
- <el-table-column prop="sort" label="排序">
- <template slot-scope="scope">
- <div v-if="sort_id != scope.row.id">
- <el-tooltip class="item" effect="dark" content="排序" placement="top">
- <span>{{scope.row.sort}}</span>
- </el-tooltip>
- <el-button class="edit-sort" type="text" @click="editSort(scope.row,'sort')">
- <img src="resources/img/mall/order/edit.png" alt="">
- </el-button>
- </div>
- <div style="display: flex;align-items: center" v-else>
- <el-input style="min-width: 70px" type="number" size="mini" class="change" v-model="sort"
- autocomplete="off"></el-input>
- <el-button class="change-quit" type="text" style="color: #F56C6C;padding: 0 5px"
- icon="el-icon-error" circle @click="cancelEdit('sort')"></el-button>
- <el-button class="change-success" type="text"
- style="margin-left: 0;color: #67C23A;padding: 0 5px" icon="el-icon-success"
- circle @click="handle('sort',scope.row)">
- </el-button>
- </div>
- </template>
- </el-table-column>
- <el-table-column width='280' prop="created_at" label="添加日期">
- <template slot-scope="scope">
- {{scope.row.created_at|dateTimeFormat('Y-m-d H:i:s')}}
- </template>
- </el-table-column>
- <el-table-column label="操作" width="280">
- <template slot-scope="scope">
- <el-button type="text" size="mini" circle style="margin-left: 10px;margin-top: 10px"
- @click="handleEdit(scope.row.id)">
- 编辑
- </el-button>
- <el-button style="margin-left: 10px;margin-top: 10px" type="text" class="set-el-button"
- size="mini" circle @click="handleDelete(scope.row.id)">
- 删除
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- <el-pagination v-if="pagination" :page-size="page_size" style="display: inline-block;float: right;"
- background @current-change="pageChange" layout="prev, pager, next"
- :total="pagination.totalCount">
- </el-pagination>
- </div>
- </el-card>
- </div>
- <script>
- const app = new Vue({
- el: '#app',
- data() {
- return {
- loading: false,
- list: [],
- type_list: Object,
- status_list: Object,
- name: '',
- pagination: null,
- page: 1,
- page_size: 10,
- page_count: 1,
- search_data: { // 筛选条件
- name: null,
- start: null,
- end: null,
- },
- datetime: [],
- multipleSelect: [],
- sort: 0,
- sort_id: 0,
- };
- },
- computed: {
- show_clear_search_btn: function () {
- return !isEmpty(this.search_data.start) || !isEmpty(this.search_data.end) || !isEmpty(this.search_data.name);
- }
- },
- methods: {
- //分页
- pageChange(page) {
- this.page = page;
- this.loadData({});
- },
- // 根据参数获取请求信息
- loadData(search_data) {
- this.loading = true;
- console.log(this.keyword)
- request({
- params: {
- r: 'mall/service-agreement/index',
- name: search_data.name,
- start: search_data.start,
- end: search_data.end,
- page: this.page,
- },
- }).then(e => {
- this.loading = false;
- if (e.data.code === 0) {
- this.list = e.data.data.list;
- this.type_list = e.data.data.type_list;
- this.status_list = e.data.data.status_list;
- this.pagination = e.data.data.pagination;
- this.page_size = e.data.data.page_size;
- this.page_count = e.data.data.page_count;
- } else {
- this.listLoading = false;
- this.$message({
- message: e.data.msg,
- type: 'error'
- });
- }
- }).catch(e => {
- this.listLoading = false;
- });
- },
- handleEdit(id) {
- navigateTo({
- r: 'mall/service-agreement/edit',
- id: id,
- });
- },
- handleDelete(id) {
- this.$confirm('删除该条数据后不可以恢复, 是否继续?', '警告', {type: 'warning'}).then(() => {
- this.$request({
- params: {
- r: 'mall/service-agreement/del',
- id: id,
- },
- }).then(e => {
- if (e.data.code == 0) {
- this.$message({
- message: e.data.msg,
- type: 'success'
- });
- location.reload();
- }
- }).catch(e => {
- });
- });
- },
- editSort(row, type) {
- switch (type) {
- case 'sort':
- this.sort = row.sort;
- this.sort_id = row.id;
- break;
- }
- },
- cancelEdit(type) {
- switch (type) {
- case 'sort':
- this.sort = 0;
- this.sort_id = 0;
- break;
- }
- },
- handle(type, data = null) {
- let id = data ? parseInt(data.id) : '';
- switch (type) {
- case 'sort':
- param = {
- id: id,
- sort: this.sort,
- type
- };
- this.do_sort(param);
- break;
- }
- this.cancelEdit(type);
- },
- do_sort(params) {
- let self = this;
- request({
- params: {
- r: 'mall/service-agreement/sort',
- },
- method: 'post',
- data: params
- }).then(e => {
- if (e.data.code == 0) {
- self.$message.success(e.data.msg);
- self.loadData({});
- } else {
- self.$message.error(e.data.msg);
- }
- }).catch(e => {
- console.log(e);
- });
- },
- search() {
- this.loadData(this.search_data);
- },
- clearSearch() {
- this.search_data.name = null;
- },
- },
- created() {
- this.loadData({});
- }
- })
- </script>
|