| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376 |
- <style>
- </style>
- <div id="app" v-cloak>
- <el-card shadow="never" style="border:0;min-width: 1000px;" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
- <div slot="header">
- <span>核销员列表</span>
- <div style="float: right">
- <el-button type="primary" size="small" style="padding: 9px 15px !important;" @click="editClick">添加核销员</el-button>
- </div>
- </div>
- <div class="table-body">
- <el-form ref="form" style="margin-bottom: 10px;" :model="searchInfo" label-width="96px" size="mini">
- <el-row :gutter="24">
- <el-col :span="5" style="padding-left: 0;" class="top_form">
- <el-form-item label="会员ID">
- <el-input v-model="searchInfo.user_id" placeholder="请输入会员ID" clearable></el-input>
- </el-form-item>
- </el-col>
- <el-button @click="toSearch" style="padding: 9px 15px !important;" size="small" type="primary">搜索</el-button>
- </el-row>
- </el-form>
- <el-tabs v-model="activeName" >
- <el-table :data="list" stripe v-loading="loading" size="small" style="margin-bottom: 15px;" >
- <el-table-column prop="user_id" min-width="30" 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.user.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.user.nickname">{{scope.row.user.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="total_money" ></el-table-column>
- <el-table-column label="累计核销订单" prop="nums" ></el-table-column>
- <el-table-column label="启用状态" width="120" align="center">
- <template slot-scope="scope">
- <el-switch
- :active-value="1"
- :inactive-value="0"
- @change="switchStatus(scope.row)"
- v-model="scope.row.status">
- </el-switch>
- </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="备注" prop="remark" align="center"></el-table-column>
- <el-table-column label="操作" align="center">
- <template slot-scope="scope">
- <el-button circle size="mini" type="text" @click="ClerkDelete(scope.row, scope.$index)">
- 删除
- </el-button>
- <el-button type="text" @click="clerkLog(scope.row.user_id)" class="all_text">核销明细</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="float: right;" background @current-change="pageChange"
- layout="prev, pager, next" :total="pagination.totalCount">
- </el-pagination>
- </div>
- </div>
- </div>
- </el-card>
- <el-dialog :visible.sync="edit_visible" width="20%" title="添加核销员">
- <div>
- <el-form @submit.native.prevent label-width="150px">
- <el-form-item label="用户昵称">
- <el-autocomplete v-model="editForm.nickname" value-key="nickname" @keyup.enter.native="keyUp"
- :fetch-suggestions="querySearchAsync" placeholder="请输入用户昵称/id/手机号"
- @select="shareClick"></el-autocomplete>
- </el-form-item>
- <el-form-item label="备注">
- <el-input v-model="editForm.remark" placeholder="" clearable style="width: 200px" ></el-input>
- </el-form-item>
- </el-form>
- </div>
- <span slot="footer" class="dialog-footer">
- <el-button @click="editCancel" type="default" size="small">取消</el-button>
- <el-button type="primary" style="margin-bottom: 10px;" size="small" @click="editSave">保存</el-button>
- </span>
- </el-dialog>
- </div>
- <script>
- const app = new Vue({
- el: '#app',
- data: {
- levels:[],
- searchInfo: {
- user_id: '',
- nickname_or_mobile: '', //会员昵称/手机号
- source: '',//用户来源
- register_start: '',//注册开始时间
- register_end: '',//注册结束时间
- level: '',//注册结束时间
- },
- list: [],
- editForm:{},
- channelArr: [],//渠道
- edit_visible: false,
- loading: false,
- activeName: '-1',
- pagination: null,
- level: {
- show: false,
- agent: null,
- },
- },
- computed: {
- },
- mounted() {
- this.loadData();
- },
- methods: {
- loadData() {
- this.loading = true;
- let params = {
- r: 'store/client/clerk/index'
- };
- params = Object.assign(params, this.searchInfo);
- 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;
- this.levels = e.data.data.levels;
- } else {
- this.$message.error(e.data.msg);
- }
- }).catch(e => {
- this.loading = false;
- });
- },
- toSearch() {
- this.page = 1;
- this.loadData();
- },
- pageChange(page) {
- this.search.page = page;
- this.loadData();
- },
- clerkLog(id){
- this.$navigate({
- r: 'store/client/clerk/clerk-log',
- id: id
- })
- },
- editClick() {
- console.log(222);
- this.edit_visible = true;
- },
- querySearchAsync(queryString, cb){
- request({
- params: {
- r: 'store/client/clerk/search-user',
- keyword: queryString
- }
- }).then(res => {
- if (res.data.code == 0) {
- cb(res.data.data.list)
- } else {
- this.$message.error(res.data.msg);
- }
- });
- },
- shareClick(row) {
- console.log(row);
- this.editForm.user_id = row.user_id
- },
- editCancel() {
- this.edit_visible = false;
- },
- editSave() {
- if (!this.editForm.user_id) {
- this.$message.error('请选择会员');
- return null;
- }
- request({
- params: {
- r: 'store/client/clerk/edit',
- },
- method: 'post',
- data: {
- user_id: this.editForm.user_id,
- remark: this.editForm.remark,
- }
- }).then(response => {
- if (response.data.code == 0) {
- this.edit_visible = false;
- this.$message.success('添加成功');
- this.loadData();
- } else {
- this.$message.error(response.data.msg);
- }
- }).catch(response => {
- this.edit.btnLoading = false;
- });
- },
- switchStatus(row) {
- let self = this;
- self.listLoading = true;
- let status = row ? parseInt(row.status) : '';
- request({
- params: {
- r: 'store/client/clerk/switch-status',
- },
- method: 'post',
- data: {
- id: row.id,
- status: status,
- }
- }).then(e => {
- self.listLoading = false;
- if (e.data.code === 0) {
- self.$message.success(e.data.msg);
- } else {
- self.$message.error(e.data.msg);
- }
- self.getList();
- }).catch(e => {
- console.log(e);
- });
- },
- ClerkDelete(row, index) {
- let self = this;
- self.$confirm('删除该核销员等级, 是否继续?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- self.listLoading = true;
- request({
- params: {
- r: 'store/client/clerk/delete',
- },
- method: 'post',
- data: {
- id: row.id,
- }
- }).then(e => {
- self.listLoading = false;
- if (e.data.code === 0) {
- self.$message.success(e.data.msg);
- self.list.splice(index, 1);
- } else {
- self.$message.error(e.data.msg);
- }
- }).catch(e => {
- console.log(e);
- });
- }).catch(() => {
- self.$message.info('已取消删除')
- });
- },
- }
- });
- </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>
|