| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480 |
- <?php
- use common\helpers\ComponentHelper;
- ComponentHelper::loadComponentView('com-export-dialog');
- ?>
- <style>
- .link_url {
- text-align: left;
- font-size: 14px;
- }
- .showqr .el-dialog__body {
- text-align: center;
- padding-bottom: 10px;
- }
- .el-dialog {
- min-width: 400px;
- }
- </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">
- <span>{{store_name}}列表</span>
- <com-export-dialog :field_list='export_list' :action_url="export_url" :params="searchForm" style="display: block;float: right;margin-top: -6px">
- </com-export-dialog>
- </div>
- <div class="search-box">
- <!-- 搜索 -->
- <el-form :inline="true" :model="searchForm" size="small" class="demo-form-inline">
- <el-form-item :label="store_name">
- <el-input :placeholder="store_name + `名称`" v-model="searchForm.store_name"></el-input>
- </el-form-item>
- <el-form-item label="店主ID">
- <el-input placeholder="会员ID" v-model="searchForm.user_id"></el-input>
- </el-form-item>
- <el-form-item label="店主昵称">
- <el-input placeholder="昵称/手机号" v-model="searchForm.nickname"></el-input>
- </el-form-item>
- <el-form-item label="招商员ID">
- <el-input placeholder="会员ID" v-model="searchForm.business_user_id"></el-input>
- </el-form-item>
- <el-form-item label="招商员昵称">
- <el-input placeholder="昵称/手机号" v-model="searchForm.business_nickname"></el-input>
- </el-form-item>
- <el-form-item label="地址">
- <div class="block">
- <el-cascader
- :options="optionList"
- v-model="searchForm.region_option"
- @change="handleChangeRegion">
- </el-cascader>
- </div>
- </el-form-item>
- <el-form-item label="创建时间">
- <el-date-picker
- size="small"
- v-model="searchForm.created_at"
- type="datetimerange"
- value-format="yyyy-MM-dd HH:mm:ss"
- range-separator="至"
- start-placeholder="开始日期"
- end-placeholder="结束日期">
- </el-date-picker>
- </el-form-item>
- <el-form-item>
- <el-button type="primary" @click="search">搜索</el-button>
- <el-button type="danger" @click="resetSearch" v-if="show_clear_search_btn">清除条件</el-button>
- </el-form-item>
- </el-form>
- </div>
- <div class="table-body">
- <el-tabs v-model="activeName" @tab-click="handleClick">
- <el-tab-pane label="门店列表" name="1"></el-tab-pane>
- <el-tab-pane label="商户列表" name="2"></el-tab-pane>
- </el-tabs>
- <el-tabs>
- <el-table :data="list" stripe v-loading="loading" size="small" style="margin-bottom: 15px;">
- <el-table-column prop="id" label="序号" align="center"></el-table-column>
- <el-table-column :label="store_name" align="left" min-width="125">
- <template slot-scope="scope" v-if="scope.row.store_info">
- {{scope.row.store_info.store_name}}
- </template>
- </el-table-column>
- <el-table-column
- label="店长"
- min-width="130">
- <template slot-scope="scope" v-if="scope.row.storeUser">
- <div style="display: flex;align-items: center;">
- <el-image fit="cover" :src="scope.row.storeUser.avatar_url ? scope.row.storeUser.avatar_url : 'resources/img/common/default-avatar.png'" style="width: 40px;height: 40px;display: block;margin-right: 5px;flex-shrink: 0;"></el-image>
- <div>
- <div>{{scope.row.storeUser.nickname}}</div>
- <div>ID {{scope.row.storeUser.id}}</div>
- </div>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="店长手机号" min-width="135" align="center">
- <template slot-scope="scope" v-if="scope.row.storeUser">
- {{ scope.row.storeUser.mobile }}
- </template>
- </el-table-column>
- <el-table-column :label="store_name + `地址`" min-width="135" align="center">
- <template slot-scope="scope" v-if="scope.row.store_info">
- {{ getWholeAddress(scope.row.store_info.province_id, scope.row.store_info.city_id, scope.row.store_info.district_id, scope.row.store_info.address) }}
- </template>
- </el-table-column>
- <el-table-column
- label="招商员"
- min-width="130">
- <template slot-scope="scope" v-if="scope.row.businessUser">
- <div style="display: flex;align-items: center;">
- <el-image fit="cover" :src="scope.row.businessUser.avatar_url ? scope.row.businessUser.avatar_url : 'resources/img/common/default-avatar.png'" style="width: 40px;height: 40px;display: block;margin-right: 5px;flex-shrink: 0;"></el-image>
- <div>
- <div>{{scope.row.businessUser.nickname}}</div>
- <div>ID {{scope.row.businessUser.id}}</div>
- </div>
- </div>
- </template>
- </el-table-column>
- <el-table-column label="招商员手机号" min-width="135" align="center">
- <template slot-scope="scope" v-if="scope.row.businessUser">
- {{ scope.row.businessUser.mobile }}
- </template>
- </el-table-column>
- <el-table-column prop="history_income" label="累计收入" align="center"></el-table-column>
- <el-table-column prop="history_earn" label="累计利润" align="center"></el-table-column>
- <el-table-column :label="store_name + `会员总数`" align="center">
- <template slot-scope="scope" v-if="scope.row.store_info">
- {{ scope.row.store_info.user_nums }}
- </template>
- </el-table-column>
- <el-table-column label="有效期" min-width="135" align="center">
- <template slot-scope="scope" v-if="scope.row.store_info">
- {{ scope.row.store_info.expire_time | dateTimeFormat('Y-m-d H:i') }}
- </template>
- </el-table-column>
- <el-table-column label="创建时间" min-width="135" align="center">
- <template slot-scope="scope">
- {{ scope.row.store_created_at | dateTimeFormat('Y-m-d H:i') }}
- </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>
- </el-tabs>
- </div>
- </el-card>
- </div>
- <script>
- const app = new Vue({
- el: '#app',
- data: {
- loading: false,
- page: 1,
- pageCount: 0,
- list: [],
- searchForm:{
- store_name: null,
- user_id: null,
- nickname: null,
- created_at: null,
- business_user_id: null,
- business_nickname: null,
- store_type: 1,
- region_option: []
- },
- level_list: [], // 等级列表
- status_option: [
- {index: 0, name: '待结算'},
- {index: 1, name: '已结算'},
- ],
- activeName: '1',
- export_list: {},
- export_url: '/business-bonus/store/index',
- regionList: [],
- optionList: [],
- },
- mounted() {
- this.getList(this.searchForm);
- this.getRegionList();
- },
- computed: {
- show_clear_search_btn: function() {
- return this.searchForm.user_id != null ||
- this.searchForm.created_at != null ||
- this.searchForm.store_name != null ||
- this.searchForm.business_nickname != null ||
- this.searchForm.business_user_id != null ||
- this.searchForm.region_option.length > 0 ||
- this.searchForm.nickname != null;
- },
- store_name() {
- return this.activeName == 1 ? '门店' : '商户';
- },
- },
- methods: {
- handleChangeRegion() {
- this.getList(this.searchForm);
- },
- handleClick() {
- this.searchForm.store_type = this.activeName;
- this.getList(this.searchForm);
- },
- pagination(currentPage) {
- let self = this;
- self.page = currentPage;
- self.getList(this.searchForm);
- },
- search() {// 清空查询条件
- this.page = 1;
- this.getList(this.searchForm);
- },
- resetSearch() {// 清空查询条件
- this.searchForm = {
- user_id: null,
- nickname: null,
- created_at: null,
- store_name: null,
- business_user_id: null,
- business_nickname: null,
- region_option: [],
- store_type: this.activeName
- };
- this.page = 1;
- this.getList(this.searchForm);
- },
- switchFun(val, id, field) {
- if (field == 'status') {
- let param = {id: id, status: val};
- this.send('business-bonus/default/handle',param)
- }
- },
- handle(type, data = null) {
- let id = data ? parseInt(data.id) : '';
- switch (type) {
- case 'edit':
- let params = {
- r: 'business-bonus/default/edit'
- };
- if (id) params = Object.assign(params, {
- id: id
- });
- navigateTo(params);
- break;
- case 'detail':
- let param = {
- r: 'business-bonus/default/detail'
- };
- if (id) param = Object.assign(param, {
- id: id
- });
- navigateTo(param);
- break;
- case 'destroy':
- param = {id: data.id,status: -1};
- this.$confirm('删除该条数据后不可以恢复, 是否继续?', '警告', {type: 'warning'}).then(() => {this.send('business-bonus/default/handle',param)})
- break;
- }
- },
- send(url, params, callback = null) {
- let self = this;
- request({
- params: {
- r: url,
- },
- method: 'post',
- data: params
- }).then(e => {
- if (e.data.code == 0) {
- self.$message.success(e.data.msg);
- self.getList(this.searchForm);
- } else {
- self.$message.error(e.data.msg);
- }
- }).catch(e => {
- console.log(e);
- });
- if(callback) return e.data;
- },
- getList(search = {}) {
- let self = this;
- self.loading = true;
- let basic_params = {
- page: self.page,
- };
- let params = Object.assign(basic_params, search);
- request({
- params: {
- r: 'business-bonus/store/index'
- },
- method: 'post',
- data: params
- }).then(e => {
- self.loading = false;
- if (e.data.code == 0) {
- self.list = e.data.data.page_data.list;
- self.pageCount = e.data.data.page_data.page_count;
- self.export_list = e.data.data.page_data.export_list;
- } else {
- self.$message.error(e.data.msg);
- }
- }).catch(e => {
- self.loading = false;
- });
- },
- getBusinessBonusLevel()
- {
- let self = this;
- request({
- params: {
- r: 'business-bonus/default/business-bonus-level'
- },
- method: 'post',
- data: {}
- }).then(e => {
- if (e.data.code == 0) {
- self.level_list = e.data.data.level_list;
- } else {
- self.$message.error(e.data.msg);
- }
- }).catch(e => {
- });
- },
- getRegionList()
- {
- let that = this;
- request({
- params: {
- r: 'common/region/list',
- level: 3
- },
- }).then(res => {
- that.regionList = res.data.data.list;
- that.optionList = that.getOptionList(that.regionList);
- })
- },
- getOptionList(regionList)
- {
- let that = this;
- let list = [];
- regionList.map(function (item) {
- let temp = {
- value: item.id,
- label: item.name
- }
- if (item.children != undefined) {
- temp.children = that.getOptionList(item.children);
- }
- list.push(temp);
- });
- return list;
- },
- getWholeAddress(province_id, city_id, district_id, address)
- {
- let wholeAddress = '';
- this.regionList.map(function (province) {
- if (province.id == province_id) {
- wholeAddress += province.name;
- province.children.map(function (city) {
- if (city.id == city_id) {
- wholeAddress += city.name;
- city.children.map(function (district) {
- if (district.id == district_id) {
- wholeAddress += district.name;
- }
- });
- }
- });
- }
- });
- return wholeAddress + address;
- }
- }
- });
- </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;
- }
- .search-box {
- padding: 10px 0 0 10px;
- background-color: #fff;
- margin-bottom: 10px;
- }
- </style>
|