new-mshop-view/pages/agent/delivery/mer_list.vue

124 lines
2.5 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view>
<view class="main-content" v-if="Object.values(list).length > 0">
配送商关联商户列表
</view>
<emptyPage v-else title="暂无信息~"></emptyPage>
<!-- 授权登录 -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authClose"></authorize>
</view>
</template>
<script>
import {mapGetters} from "vuex";
import emptyPage from '@/components/emptyPage.vue';
import authorize from '@/components/Authorize';
export default {
components: {
authorize,
emptyPage
},
computed: {
...mapGetters(['isLogin', 'uid', 'userInfo', 'viewColor'])
},
data() {
return {
// 登录相关
isAuto: false, //没有授权的不会自动授权
isShowAuth: false,//是否隐藏授权
// 列表
total: 0,
list: [],
page: 1,
agent_id: 0,
}
},
onLoad(options) {
let _this = this;
_this.agent_id = options.agent_id || 0;
// 判断agent_id <= 0 抛出错误,返回代理中心
if(Number(_this.agent_id) <= 0){
_this.$util.Tips({
title: '非法访问,信息不存在!',
},{tab:5,url:`/pages/agent/centerV2?agent_id=${_this.agent_id}`});
return false;
}
// 判断:是否登录
if (!this.isLogin) {
// 未登录 授权登录
this.isAuto = true;
this.isShowAuth = true
}else{
// 已登录 获取信息
this.init();
}
},
// 滚动到底部
onReachBottom() {
this.getList();
},
methods: {
// 授权回调
onLoadFun() {
if(this.isLogin){
this.isShowAuth = false;
this.init();
}
},
// 授权关闭
authClose(e) {
this.isShowAuth = e
},
// 授权成功 初始化
init () {
this.getList();
},
// 记录
getList() {
let _this = this;
console.log("列表信息获取");
// let params = {
// page: _this.page,
// pid: _this.agent_id
// };
// myAgentList(params).then(res => {
// let list = res.data.list || {};
// _this.total = res.data.count || 0;
// if (Object.values(list).length > 0) {
// _this.list = _this.$util.SplitArray(list, _this.list);
// _this.$set(_this, 'list', _this.list);
// _this.page++;
// }
// }).catch(err => {
// this.$util.Tips({title: err});
// });
},
}
}
</script>
<style lang="scss" scoped>
.main-content {
width: 100vw;
min-height: 100vh!important;
background: #f6f6f6;
}
</style>