| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259 |
- @extends('layouts.base')
- @section('title', '代理商管理')
- @section('content')
- <link rel="stylesheet" type="text/css" href="{{static_url('yunshop/goods/vue-ohter.css')}}"/>
- <div id='re_content'>
- <div class="con">
- <div class="setting">
- <div class="block">
- <el-form label-width="10%">
- <div class="title" style="justify-content: space-between;">
- <div style="display:flex;align-items:center;">
- <span style="width: 4px;height: 18px;background-color: #29ba9c;margin-right:15px;display:inline-block;"></span><b>代理商管理</b>
- </div>
- <a href="{!! yzWebFullUrl('plugin.agency.admin.agency.add-page') !!} ">
- <el-button size="mini" type="primary">添加代理商</el-button>
- </a>
- </div>
- <el-input v-model="search_form.member_info" style="width:15%;margin-right:16px;"
- placeholder="可搜索昵称/姓名/手机号"></el-input>
- <el-select v-model="search_form.level_id" placeholder="代理商等级"
- style="margin-right:16px;width:12%;" clearable>
- <el-option
- v-for="item in levels"
- :key="item.id"
- :label="item.title"
- :value="item.id">
- </el-option>
- </el-select>
- <el-select v-model="search_form.search_time" clearable placeholder="时间不限">
- <el-option label="时间不限" value="0"></el-option>
- <el-option label="搜索时间" value="1"></el-option>
- </el-select>
- <el-date-picker
- v-model="times"
- type="datetimerange"
- value-format="yyyy-MM-dd HH:mm:ss"
- range-separator="至"
- start-placeholder="开始日期"
- end-placeholder="结束日期"
- style="margin-left:5px;"
- align="right">
- </el-date-picker>
- <a>
- <el-button type="primary" icon="el-icon-search" @click="search()">搜索</el-button>
- </a>
- </el-form>
- </div>
- <div style="background: #eff3f6;width:100%;height:15px;"></div>
- <div class="block">
- <div class="title">
- <div style="display:flex;align-items:center;"><span
- style="width: 4px;height: 18px;background-color: #29ba9c;margin-right:15px;display:inline-block;"></span><b>代理商列表</b>
- </div>
- </div>
- </div>
- <template style="margin-top:-10px;">
- <el-table
- :data="tableData"
- style="padding:0 10px"
- >
- <el-table-column
- prop="created_at"
- align="center"
- label="成为代理商时间"
- >
- <template slot-scope="scope">
- [[scope.row.created_at]]
- </template>
- </el-table-column>
- <el-table-column
- prop="uid"
- align="center"
- label="会员ID"
- >
- </el-table-column>
- <el-table-column
- align="center"
- label="代理商"
- >
- <template slot-scope="scope">
- <div>
- <div class="vue-ellipsis">
- <el-image :src="scope.row.avatar"
- style='width:30px;height:30px;padding:1px;border:1px solid #ccc'></el-image>
- </div>
- <div class="vue-ellipsis">[[scope.row.nickname]]</div>
- </div>
- </template>
- </el-table-column>
- <el-table-column
- align="center"
- label="手机号"
- >
- <template slot-scope="scope">
- <div>
- <div class="vue-ellipsis">[[scope.row.mobile]]</div>
- </div>
- </template>
- </el-table-column>
- <el-table-column
- prop="level_name"
- align="center"
- label="代理商等级"
- >
- </el-table-column>
- <el-table-column
- align="center"
- label="操作"
- >
- <template slot-scope="scope">
- <el-button size="mini" style="margin-right: 10px;" @click="goEdit(scope.row)">编辑
- </el-button>
- <el-button size="mini" style="margin-right: 10px;" @click="del(scope, tableData)">删除
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- <el-row style="background-color:#fff;">
- <el-col :span="24" align="center" migra style="padding:15px 5% 15px 0" v-loading="loading">
- <el-pagination background @current-change="currentChange"
- :current-page="current_page"
- layout="prev, pager, next"
- :page-size="Number(page_size)" :current-page="current_page"
- :total="page_total"></el-pagination>
- </el-col>
- </el-row>
- </template>
- </div>
- </div>
- </div>
- <script>
- var vm = new Vue({
- el: "#re_content",
- delimiters: ['[[', ']]'],
- data() {
- return {
- loading: false,
- page_total: 0,
- page_size: 0,
- current_page: 0,
- search_loading: false,
- all_loading: false,
- info: {},
- search_form: {
- name: '',
- rank_type: '',
- search_time: '0',
- start_time: "",
- end_time: "",
- },
- levels: [],
- real_search_form: {},
- tableData: [],
- times: [],
- }
- },
- mounted() {
- this.$http.post('{!! yzWebFullUrl('plugin.agency.admin.level.get-all') !!}')
- .then(function (response) {
- this.levels = response.data.data;
- }
- );
- this.search();
- },
- methods: {
- del(scope, rows) {
- this.$confirm('是否删除?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- rows.splice(scope.$index, 1);
- let json = {
- id: scope.row.id
- }
- this.$http.post('{!! yzWebFullUrl('plugin.agency.admin.agency.delete') !!}', json).then(function (response) {
- if (response.data.result) {
- this.$message({message: "删除成功", type: "success"});
- this.loading = false;
- } else {
- this.$message({message: response.data.msg, type: 'error'});
- }
- }, function (response) {
- console.log(response);
- this.loading = false;
- }
- );
- }).catch(() => {
- this.$message({
- type: 'info',
- message: '已取消操作'
- });
- });
- },
- goEdit(item) {
- let link = `{!! yzWebFullUrl('plugin.agency.admin.agency.add-page') !!}` + `&id=` + item.id;
- window.location.href = link;
- },
- search() {
- console.log(this.times);
- if (this.times && this.times.length > 0) {
- this.search_form.start_time = this.times[0];
- this.search_form.end_time = this.times[1];
- }
- this.search_loading = true;
- let json = {
- search: this.search_form,
- }
- this.$http.post('{!! yzWebFullUrl('plugin.agency.admin.agency.get-list') !!}', json
- ).then(function (response) {
- if (response.data.result) {
- let datas = response.data.data;
- this.tableData = datas.data
- this.page_total = datas.total;
- this.page_size = datas.per_page;
- this.current_page = datas.current_page;
- this.loading = false;
- this.real_search_form = Object.assign({}, this.search_form);
- } else {
- this.$message({message: response.data.msg, type: 'error'});
- }
- this.search_loading = false;
- }, function (response) {
- this.search_loading = false;
- this.$message({message: response.data.msg, type: 'error'});
- }
- );
- },
- currentChange(val) {
- this.loading = true;
- this.$http.post('{!! yzWebFullUrl('plugin.agency.admin.agency.get-list') !!}', {
- page: val,
- search: this.real_search_form
- }).then(function (response) {
- if (response.data.result) {
- let datas = response.data.data;
- this.tableData = datas.data
- this.page_total = datas.total;
- this.page_size = datas.per_page;
- this.current_page = datas.current_page;
- this.loading = false;
- } else {
- this.$message({message: response.data.msg, type: 'error'});
- }
- }, function (response) {
- console.log(response);
- this.loading = false;
- }
- );
- },
- },
- });
- </script>
- @endsection
|