| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450 |
- <?php
- use common\helpers\ComponentHelper;
- $diyPath = dirname(__DIR__) . '/components';
- ComponentHelper::loadComponentView('stock-edit', $diyPath);
- ?>
- <div id="app" v-cloak>
- <el-card shadow="never" style="border:0;min-width: 1500px;" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
- <div slot="header">
- <span>亲友卡列表</span>
- <div style="float: right;margin-top: -5px">
- <el-button type="primary" @click="editClick" size="small">添加亲友卡</el-button>
- </div>
- </div>
- <div class="table-body">
- <div class="input-item">
- <el-input @keyup.enter.native="loadData" size="small" placeholder="亲友卡名称" v-model="search.keyword"
- clearable @clear="toSearch">
- </el-input>
- </div>
- <div class="input-item">
- <el-input @keyup.enter.native="loadData" size="small" placeholder="会员信息" v-model="search.keyword2"
- clearable @clear="toSearch">
- </el-input>
- </div>
- <el-select size="small" v-model="search.type" @change='toSearch' class="select" placeholder="请选择">
- <el-option :key="item.value" :label="item.label" :value="item.value"
- v-for="(item, index) in incomeCapitalTypeList"></el-option>
- </el-select>
- <el-date-picker
- style="margin-right: 20px;"
- size="small"
- v-model="selectData"
- type="daterange"
- value-format="yyyy-MM-dd"
- range-separator="至"
- start-placeholder="开始日期"
- end-placeholder="结束日期">
- </el-date-picker>
- <el-button type="primary" size="small" style="padding: 9px 15px !important;" @click="toSearch">搜索</el-button>
- <el-tabs v-model="activeName" @tab-click="handleClick">
- <el-table :data="list" stripe v-loading="loading" size="small" style="margin-bottom: 15px;"
- @selection-change="handleSelectionChange">
- <el-table-column prop="id" label="编码" align="center"></el-table-column>
- <el-table-column prop="user_id" label="用户ID" align="center"></el-table-column>
- <el-table-column label="基本信息" >
- <template slot-scope="scope">
- <div class="user_img" flex="cross:center">
- <el-image class="default-avatar" :src="scope.row.avatar_url">
- <div slot="error" class="image-slot">
- <com-image src="resources/img/mall/default_avatar_url.png"></com-image>
- </div>
- </el-image>
- <div class="uer-nickname over1" v-if="scope.row.nickname">{{scope.row.nickname}}</div>
- <div class="uer-nickname over1" v-else >ID:{{scope.row.user_id}}</div>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="卡的编号" prop="mobile" align="center" >
- <template slot-scope="scope">
- <div>{{scope.row.card_no}}</div>
- </template>
- </el-table-column>
- <el-table-column label="名称" prop="mobile" align="center" >
- <template slot-scope="scope">
- <div>{{scope.row.name}}</div>
- </template>
- </el-table-column>
- <el-table-column label="样式" prop="background_url" align="center" style="width: 50px;height: 50px;">
- <template slot-scope="scope">
- <div>
- <el-image :src="scope.row.background_url" :preview-src-list="[scope.row.background_url]">
- </el-image>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="折扣" prop="discount" align="center" >
- <template slot-scope="scope">
- <div>{{scope.row.discount}}</div>
- </template>
- </el-table-column>
- <el-table-column label="子卡数量" prop="child_num" align="center" >
- <template slot-scope="scope">
- <div v-if="sort_id != scope.row.id">
- <el-tooltip class="item" effect="dark" content="子卡数量" placement="top">
- <span>{{scope.row.child_num}}</span>
- </el-tooltip>
- <el-button class="edit-sort" type="text" @click="editNum(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>
- <!-- <template slot-scope="scope">
- <div>{{scope.row.child_num}}</div>
- </template> -->
- </el-table-column>
- <el-table-column label="创建时间" align="center">
- <template slot-scope="scope">
- {{scope.row.created_at|dateTimeFormat('Y-m-d H:i:s')}}
- </template>
- </el-table-column>
- <el-table-column label="过期时间" align="center">
- <template slot-scope="scope">
- {{scope.row.expired_at|dateTimeFormat('Y-m-d H:i:s')}}
- </template>
- </el-table-column>
- <el-table-column label="操作" min-width="150" align="center">
- <template slot-scope="scope">
- <el-button type="text" @click="editDetail(scope.row.id)">查看亲友</el-button>
- <el-button type="text" @click="operate('destroy',scope.row)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- </el-tabs>
- <div flex="box:last cross:center">
- <div></div>
- <div>
- <el-pagination v-if="pagination" :page-size="pagination.defaultPageSize"
- style="display: inline-block;float: right;" background @current-change="pageChange"
- layout="prev, pager, next" :total="pagination.totalCount">
- </el-pagination>
- </div>
- </div>
- </div>
- </el-card>
- <stock-edit v-model="edit.show" @savesuccess="stockEditFun"></stock-edit>
- </div>
- <script>
- const app = new Vue({
- el: '#app',
- data: {
- avatar: '',
- nickname: '',
- search: {
- keyword: '',
- keyword2:'',
- page: 1,
- start:'',
- end:'',
- type:'',
- },
- loading: false,
- activeName: '-1',
- list: [],
- pagination: null,
- dialogChild: false,
- dialogLoading: false,
- dialogContent: false,
- remarksForm: {
- remarks: '',
- user_id: '',
- id: '',
- },
- remarksLoading: false,
- exportList: {},
- userEdit: {
- show: false,
- },
- level: {
- show: false,
- agent: null,
- },
- commission_arr: {},
- agentLevelList: [],
- levelList: {},
- choose_list: [],
- sort: 0,
- sort_id: 0,
- incomeCapitalTypeList:[
- {
- value:1,
- label:'母卡',
- },
- {
- value:2,
- label:'子卡',
- },
- ],
- selectData:'',
- edit: {
- show: false,
- },
- },
- mounted() {
- this.loadData();
- },
- methods: {
- loadData() {
- this.loading = true;
- let params = {
- r: 'members-card/default/list'
- };
- params = Object.assign(params, this.search);
- request({
- params: params,
- method: 'get',
- }).then(e => {
- this.loading = false;
- if (e.data.code == 0) {
- this.list = e.data.data.list;
- this.pagination = e.data.data.pagination;
- } else {
- this.$message.error(e.data.msg);
- }
- }).catch(e => {
- this.loading = false;
- });
- },
- pageChange(page) {
- this.search.page = page;
- this.loadData();
- },
- handleClick(tab, event) {
- this.search.page = 1;
- this.search.status = this.activeName;
- this.loadData()
- },
- toSearch() {
- if(this.selectData && this.selectData[0]){
- this.search.start = this.selectData[0];
- this.search.end = this.selectData[1];
- }else{
- this.search.start = '';
- this.search.end = '';
- }
- this.search.page = 1;
- this.loadData();
- },
- switchFun(event,id){
- console.log(event);
- this.listLoading = true;
- request({
- params: {
- r: 'members-card/default/update-status'
- },
- method: 'post',
- data:{
- id:id,
- is_enable:event,
- }
- }).then(e => {
- this.listLoading = false;
- if (e.data.code == 0) {
- this.$message.success('更改状态成功');
- } else {
- this.$message.error(e.data.msg);
- }
- this.loadData();
- }).catch(e => {
- this.$message.error(e.data.msg);
- this.listLoading = false;
- this.loadData();
- });
- },
- // 跳转编辑页
- editDetail(id) {
- id = parseInt(id);
- let params = {
- r: 'members-card/default/child-list',
- };
- if (id) params = Object.assign(params, {
- id: id
- });
- navigateTo(params);
- },
- operate(type, data = null) {
- let param = { id: data.id, type: type };
- switch (type) {
- case 'destroy':
- this.$confirm('删除该条数据后不可以恢复, 是否继续?', '警告', {
- type: 'warning'
- }).then(() => {
- this.send(param)
- })
- break;
- }
- },
- send(params) {
- let self = this;
- request({
- params: {
- r: 'members-card/default/list-label',
- },
- 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);
- });
- },
- editClick() {
- this.edit.show = true;
- },
- stockEditFun(){
- this.loadData();
- },
- editNum(row, type) {
- switch (type) {
- case 'sort':
- this.sort = row.child_num;
- 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,
- child_num: this.sort,
- type:type,
- };
- this.send(param);
- break;
- }
- this.cancelEdit(type);
- },
- }
- });
- </script>
- <style>
- .el-tabs__header {
- font-size: 16px;
- }
- .table-body {
- padding: 20px;
- background-color: #fff;
- }
- .table-body .el-button {
- padding: 0 !important;
- border: 0;
- margin: 0 5px;
- }
- .input-item {
- width: 250px;
- margin: 0 0 20px;
- display: inline-block;
- }
- /*.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;
- }
- .batch {
- margin: 0 0 20px;
- display: inline-block;
- }
- .batch .el-button {
- padding: 9px 15px !important;
- }
- .el-table th>.cell{
- color: #333;
- font-weight: bold;
- font-size: 14px;
- }
- .el-table__footer-wrapper, .el-table__header-wrapper{
- border-bottom: 1.4px solid #D6D6D6;
- }
- .el-table th>.cell {
- color: #333;
- font-weight: bold;
- font-size: 14px;
- }
- .table1 .el-table__footer-wrapper,
- .table1 .el-table__header-wrapper {
- border-bottom: 1.4px solid #D6D6D6;
- }
- .user_img{
- position: relative;
- margin-right: 8px;
- /* height: 50px;
- width: 50px; */
- }
- .default-avatar{
- width: 50px;
- height: 50px;
- border-radius: 50%;
- margin-right: 8px;
- }
- .uer-nickname {
- flex: 1;
- }
- </style>
|