| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513 |
- <?php
- use common\helpers\ComponentHelper;
- ComponentHelper::loadComponentView('com-share-pop');
- ?>
- <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>
- <el-button type="primary" size="small" style="padding: 9px 15px !important; float: right; position: relative; bottom: 8px;" @click="addStore">添加商户</el-button>
- </div>
- <div class="table-body">
- <el-alert style="margin-bottom:20px;" type="info" title="商户管理端登录入口链接:" :closable="false">
- <template>
- <span id="target">{{store_login_url}}</span>
- <el-button type="text" id="copy_btn" data-clipboard-action="copy" data-clipboard-target="#target" size="mini">复制链接 </el-button>
- </template>
- </el-alert>
- <div style="padding-bottom: 20px;">
- <div class="flex">
- <div class="flex" style="margin-right: 20px;">
- <div class="input-title" style="flex-shrink: 0;">商户名称</div>
- <el-input size="small" style="width: 130px;" placeholder="请输入商户名称" v-model="searchData.store_name"> </el-input>
- </div>
- <div class="flex" style="margin-right: 20px;">
- <div class="input-title" style="flex-shrink: 0;">姓名</div>
- <el-input size="small" style="width: 130px;" placeholder="请输入姓名" v-model="searchData.storeowner">
- </el-input>
- </div>
- <div class="flex" style="margin-right: 20px;">
- <div class="input-title" style="flex-shrink: 0;">绑定会员</div>
- <el-input size="small" style="width: 130px;" placeholder="请输入会员名称" v-model="searchData.nickname">
- </el-input>
- </div>
- <div class="item-box" flex="dir:left cross:center">
- <div class="label">商户状态</div>
- <el-select v-model="searchData.status" @change='searchs' class="select" size="small" style="width: 130px;">
- <el-option :key="0" label="全部" :value="0"></el-option>
- <el-option :key="1" label="正常" :value="1"></el-option>
- <el-option :key="2" label="过期" :value="2"></el-option>
- <el-option :key="3" label="禁用" :value="3"></el-option>
- </el-select>
- </div>
- <el-button style="padding: 9px 15px !important;" size="small" type="primary" @click="searchs">搜索</el-button>
- <el-button type="warning" @click="clereSearch" v-if="searchData.store_name || searchData.storeowner || searchData.nickname || searchData.cate_id || searchData.status" style="padding: 9px 15px !important;">清除搜索条件</el-button>
- </div>
- </div>
- <el-table :data="list" stripe v-loading="loading" size="small" style="margin-bottom: 15px; width: 100%">
- <!-- <el-table-column prop="id" label="商户ID" width="100"></el-table-column> -->
- <el-table-column label="商户名称" width="200" prop="store_name">
- <template slot-scope="scope">
- <com-image style="float: left;margin-right: 10px;" mode="aspectFill" :src="scope.row.logo_img"></com-image>
- <div>{{scope.row.store_name}}</div>
- <div>{{scope.row.shop_mobile}}</div>
- </template>
- </el-table-column>
- <el-table-column label="会员" width="150" align="center">
- <template slot-scope="scope">
- <com-image style="float: left;margin-right: 5px;" mode="aspectFill" :src="scope.row.avatar_url"></com-image>
- <div>{{scope.row.nickname}}</div>
- </template>
- </el-table-column>
- <el-table-column label="姓名" prop="shop_owner" width="120" align="center">
- <template slot-scope="scope">
- <div>{{scope.row.shop_owner}}</div>
- </template>
- </el-table-column>
- <el-table-column label="商户有效期" prop="expire_time" width="300" align="center">
- <template slot-scope="scope">
- <div>
- <samp v-if="scope.row.expire_time==0">无限期</samp>
- <samp v-else>{{scope.row.expire_time|dateTimeFormat('Y-m-d H:i:s')}} 到期</samp>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="" prop="" width="300" align="center">
- <template slot="header">
- 金额
- <el-tooltip placement="top">
- <div slot="content">总收入:商户累计收入<br />当前余额:商户当前余额</div>
- <i class="el-icon-question grid-icon"></i>
- </el-tooltip>
- </template>
- <template slot-scope="scope">
- <div>
- 累计收入:<span style="color: #409EFF;">{{scope.row.total_money || 0}}</span>
- 当前余额:<span style="color: #409EFF;">{{scope.row.balance || 0}}</span>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="会员总数" prop="user_nums" width="100" align="center">
- <template slot-scope="scope">
- <div>
- {{scope.row.user_nums}}
- </div>
- </template>
- </el-table-column>
- <el-table-column label="状态" prop="store_status" width="100" align="center">
- <template slot-scope="scope">
- <div>
- <span>{{storeStatus[scope.row.store_status]}}</span>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="创建时间" prop="user_count" width="300" align="center">
- <template slot-scope="scope">
- <div>
- {{scope.row.created_at | dateTimeFormat('Y-m-d H:i:s')}}
- </div>
- </template>
- </el-table-column>
- <el-table-column label="操作" style="width: 100px;" fixed="right" align="center">
- <template slot-scope="scope">
- <el-button type="text" size="small" @click="goToDetail(scope.row.id)">详情</el-button>
- <com-share-pop :url="scope.row.promotion_code">
- <template slot="share-button" slot-scope="data">
- <el-button circle size="mini" type="text" @click="showPromotionCode(scope.row.id, data.show)"> 推广码 </el-button>
- </template>
- </com-share-pop>
- <el-button v-if="scope.row.store_status==1" type="text" size="small" @click="switchStatus(scope.$index, 3)">禁用</el-button>
- <el-button v-else-if="scope.row.store_status==3" type="text" size="small" @click="switchStatus(scope.$index, 1)">启用</el-button>
- <el-button type="text" size="small" @click="storeDelete(scope.row)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- <div style="text-align: right;margin: 20px 0;">
- <el-pagination @current-change="pagination" background layout="prev, pager, next" :page-count="pageCount"></el-pagination>
- </div>
- </div>
- </el-card>
- </div>
- <script src="/resources/unpkg/clipboard@1.0.0/dist/clipboard.min.js"></script>
- <script>
- const app = new Vue({
- el: '#app',
- data: {
- searchData: {
- cate_id: 0,
- nickname: '',
- storeowner: '',
- store_name: '',
- status: 0,
- },
- currPage: 1,
- pageCount: 0,
- loading: false,
- list: [],
- dialogLoading: false,
- // exportList: [],
- categorys: [],
- storeStatus: {
- 1: '正常',
- 2: '过期',
- 3: '禁用'
- },
- store_login_url: '', // 商户登录 url
- shareData: {
- url: "", //链接
- img: "", //二维码
- qrcode_filename: '', // 二维码文件名
- },
- },
- mounted() {
- this.loadData();
- },
- methods: {
- searchs() {
- this.currPage = 1;
- this.loadData();
- },
- clereSearch() {
- this.searchData.cate_id = 0;
- this.searchData.nickname = '';
- this.searchData.storeowner = '';
- this.searchData.store_name = '';
- this.searchData.status = 0;
- this.currPage = 1;
- this.loadData();
- },
- // 打开推广码弹窗
- showPromotionCode(id, fun) {
- // this.store_login_url = this.store_login_url;
- setTimeout(() => {
- fun();
- }, 300)
- },
- // 禁用 / 启用商户
- switchStatus(index, status) {
- let self = this;
- let tip = status == 1 ? '启用' : '禁用';
- let mch_id = self.list[index].id;
- self.$confirm(tip + '该商户, 是否继续?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- self.loading = true;
- request({
- params: {
- r: 'mch/store/switch-status',
- },
- data: {
- mch_id: mch_id,
- status: status,
- },
- method: 'post'
- }).then(e => {
- self.loading = false;
- if (e.data.code == 0) {
- this.list[index].store_status = status;
- self.$message.success('操作成功');
- } else {
- self.$message.error('操作失败');
- }
- }).catch(e => {
- self.loading = false;
- console.log(e);
- self.$message.error('网络错误');
- });
- }).catch(() => {
- });
- },
- storeDelete(row) {
- let self = this;
- self.$confirm('删除该商户, 是否继续?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- self.listLoading = true;
- request({
- params: {
- r: 'mch/store/del',
- },
- method: 'post',
- data: {
- id: row.id,
- }
- }).then(e => {
- self.listLoading = false;
- console.log(111,e.data.code)
- if (e.data.code === 0) {
- self.$message.success(e.data.msg);
- this.loadData();
- } else {
- self.$message.error(e.data.msg);
- }
- }).catch(e => {
- console.log(e.message);
- });
- }).catch(() => {
- self.$message.info('已取消删除')
- });
- },
- loadData() {
- this.loading = true;
- request({
- params: {
- r: 'mch/store/index',
- page: this.currPage,
- ...this.searchData,
- },
- method: 'get',
- }).then(e => {
- this.loading = false;
- if (e.data.code == 0) {
- this.list = e.data.data.list;
- this.store_login_url = e.data.data.store_login_url;
- this.pageCount = e.data.data.page_count;
- // this.exportList = e.data.data.export_list;
- this.edit_status = e.data.data.edit_status;
- this.categorys = e.data.data.cate_list;
- } else {
- this.$message.error(e.data.msg);
- }
- }).catch(e => {
- this.loading = false;
- });
- },
- pagination(currentPage) {
- let self = this;
- self.currPage = currentPage;
- self.loadData();
- },
- addStore(id) {
- navigateTo({
- r: 'mch/store/storage',
- });
- },
- // 跳转商户详情页
- goToDetail(id) {
- navigateTo({
- r: 'mch/store/detail',
- mch_id: id,
- });
- },
- }
- });
- var clipboard = new ClipboardJS('#copy_btn');
- var self = this;
- clipboard.on('success', function(e) {
- self.ELEMENT.Message.success('复制成功');
- e.clearSelection();
- });
- clipboard.on('error', function(e) {
- self.ELEMENT.Message.success('复制失败,请手动复制');
- });
- </script>
- <style>
- .el-tabs__header {
- font-size: 16px;
- }
- .table-body {
- padding: 20px;
- background-color: #fff;
- }
- .input-item {
- width: 250px;
- margin-right: 40px;
- }
- .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;
- }
- .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 .el-button {
- padding: 0 !important;
- border: 0;
- margin: 0 5px;
- }
- #app .copy .el-input-group__append {
- background-color: #409EFF;
- border-color: #409EFF;
- padding: 0 10px;
- }
- #app .table-body .copybtn {
- color: #fff;
- padding: 0 30px;
- }
- .el-alert {
- padding: 0;
- padding-left: 5px;
- padding-bottom: 5px;
- }
- .el-alert--info .el-alert__description {
- color: #606266;
- }
- .el-alert .el-button {
- margin-left: 20px;
- }
- .el-alert__content {
- display: flex;
- align-items: center;
- }
- .table-body .el-alert__title {
- margin-top: 5px;
- font-weight: 400;
- }
- .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;
- }
- .item-box {
- margin-right: 20px;
- }
- .flex {
- display: flex;
- align-items: center;
- }
- .input-title {
- margin-right: 15px;
- }
- .item-box .label {
- margin-right: 8px;
- }
- .com-share-pop {
- display: inline-block;
- }
- .grid-icon {
- color: #999;
- cursor: pointer;
- font-size: 18px;
- }
- </style>
|