添加:代理中心基本操作功能

添加:代理中心  - 生成供应商邀请二维码
This commit is contained in:
wuhui_zzw 2024-01-29 18:03:04 +08:00
parent 9d2f4cd843
commit 1b252f13e7
7 changed files with 995 additions and 263 deletions

20
api/agent.js Normal file
View File

@ -0,0 +1,20 @@
import request from "@/utils/request.js";
// 代理中心 - 代理列表
export function myAgentList(data) {
return request.get('agent/agent_list',data);
}
// 商户中心 - 供应商入驻邀请二维码
export function inviteSupplierJoinQrCode(data) {
return request.get('agent/qr_code_invite_supplier',data);
}

View File

@ -1,22 +0,0 @@
import request from "@/utils/request.js";
// 商户中心 - 推广二维码
export function promoteQrCodes(data) {
return request.get('merchant/promote_qr_code',data);
}
// 商户中心 - 买单二维码
export function onlinePaymentQrCodes(data) {
return request.get('merchant/online_payment_qr_code',data);
}

View File

@ -22,7 +22,14 @@ export function delStaff(data) {
}
// 商户中心 - 推广二维码
export function promoteQrCodes(data) {
return request.get('merchant/promote_qr_code',data);
}
// 商户中心 - 买单二维码
export function onlinePaymentQrCodes(data) {
return request.get('merchant/online_payment_qr_code',data);
}

View File

@ -125,10 +125,12 @@
}
}
],
"subPackages": [{
"subPackages": [
{
"root": "pages/users",
"name": "users",
"pages": [{
"pages": [
{
"path": "retrievePassword/index",
"style": {
"navigationBarTitleText": "忘记密码"
@ -140,7 +142,6 @@
"navigationBarTitleText": "设置"
}
},
//
{
"path": "user_about/index",
"style": {
@ -216,23 +217,23 @@
{
"path": "user_grade/index",
"style": {
// #ifdef MP || APP-PLUS
"navigationBarTextStyle": "#fff",
// #endif
"navigationBarTitleText": "我的等级",
"navigationBarBackgroundColor": "#282828"
// #ifdef MP || APP-PLUS
,
"navigationBarTextStyle": "#fff"
// #endif
}
},
{
"path": "user_grade_list/index",
"style": {
// #ifdef MP || APP-PLUS
"navigationBarTextStyle": "#fff",
// #endif
"navigationBarTitleText": "成长值记录",
"navigationBarBackgroundColor": "#282828"
// #ifdef MP || APP-PLUS
,
"navigationBarTextStyle": "#fff"
// #endif
}
},
{
@ -304,11 +305,11 @@
{
"path": "user_pwd_edit/index",
"style": {
"navigationBarTitleText": "修改密码"
// #ifdef MP || APP-PLUS
,
"navigationBarTextStyle": "#fff"
// #ifdef MP || APP-PLUS
"navigationBarTextStyle": "#fff",
// #endif
"navigationBarTitleText": "修改密码"
}
},
{
@ -338,7 +339,6 @@
{
"path": "promoter_rank/index",
"style": {
"navigationBarTitleText": "推广人排行"
}
},
@ -387,12 +387,11 @@
{
"path": "login/index",
"style": {
// #ifdef MP || APP-PLUS
"navigationBarTextStyle": "#fff",
// #endif
"navigationBarTitleText": "登录",
"navigationBarBackgroundColor": "#EB5447"
// #ifdef MP || APP-PLUS
,
"navigationBarTextStyle": "#fff"
// #endif
}
},
{
@ -582,26 +581,24 @@
"root": "pages/store",
"name": "store",
"pages": [
{
"path": "index",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": "店铺diy首页"
// #ifdef MP
,
"navigationBarTextStyle": "#FFFFFF"
// #endif
}
},{
{
"path": "index",
"style": {
// #ifdef MP
"navigationBarTextStyle": "#FFFFFF",
// #endif
"navigationStyle": "custom",
"navigationBarTitleText": "店铺diy首页"
}
},
{
"path": "home/index",
"style": {
// #ifdef MP
"navigationBarTextStyle": "#FFFFFF",
// #endif
"navigationStyle": "custom",
"navigationBarTitleText": "店铺首页"
// #ifdef MP
,
"navigationBarTextStyle": "#FFFFFF"
// #endif
}
},
{
@ -621,12 +618,14 @@
"style": {
"navigationBarTitleText": "商家入驻"
}
}, {
},
{
"path": "applicationRecord/index",
"style": {
"navigationBarTitleText": "申请记录"
}
}, {
},
{
"path": "merchantDetails/index",
"style": {
"navigationBarTitleText": "审核通过"
@ -649,7 +648,8 @@
{
"root": "pages/admin",
"name": "adminOrder",
"pages": [{
"pages": [
{
"path": "order/index",
"style": {
"navigationBarTitleText": "订单首页"
@ -671,7 +671,6 @@
"path": "refundList/index",
"style": {
"navigationBarTitleText": "申请退款"
}
},
{
@ -704,7 +703,7 @@
"navigationBarTitleText": "退款单详情"
}
},
{
{
"path": "delivery/index",
"style": {
"navigationBarTitleText": "订单发货"
@ -737,12 +736,12 @@
{
"path": "storeDiy/index",
"style": {
// #ifdef MP
"navigationBarTextStyle": "#FFFFFF",
// #endif
"navigationStyle": "custom",
"navigationBarTitleText": "店铺diy首页"
// #ifdef MP
,
"navigationBarTextStyle": "#FFFFFF"
// #endif
}
},
// #ifdef H5
@ -759,15 +758,13 @@
"navigationBarTitleText": "客户管理"
}
}
]
},
{
"root": "pages/product",
"name": "product",
"pages": [{
"pages": [
{
"path": "list/index",
"style": {
"navigationBarTitleText": "商品管理"
@ -798,13 +795,13 @@
}
},
{
"path":"storeClassification/index",
"path": "storeClassification/index",
"style": {
"navigationBarTitleText": "店铺分类"
}
},
{
"path":"storeClassification/addStoreClass",
"path": "storeClassification/addStoreClass",
"style": {
"navigationBarTitleText": "添加店铺分类"
}
@ -822,7 +819,7 @@
}
},
{
"path":"addGoods/addGoodDetils",
"path": "addGoods/addGoodDetils",
"style": {
"navigationBarTitleText": "商品详情"
}
@ -880,7 +877,7 @@
{
"path": "plant_release/index",
"style": {
"navigationBarTitleText": "内容发布"
"navigationBarTitleText": "内容发布"
}
},
{
@ -936,7 +933,8 @@
{
"root": "pages/columnGoods",
"name": "columnGoods",
"pages": [{
"pages": [
{
"path": "HotNewGoods/index",
"style": {
"navigationBarTitleText": "精品推荐"
@ -967,18 +965,19 @@
}
}
]
// ,
// "plugins": {
// "live-player-plugin": {
// "version": "1.3.2",
// "provider": "wx7aac64d4d4419260"
// }
// }
// ,
// "plugins": {
// "live-player-plugin": {
// "version": "1.3.2",
// "provider": "wx7aac64d4d4419260"
// }
// }
},
{
"root": "pages/chat",
"name": "chat",
"pages": [{
"pages": [
{
"path": "customer_list/index",
"style": {
"navigationBarTitleText": "消息中心"
@ -1007,7 +1006,8 @@
{
"root": "pages/activity",
"name": "activity",
"pages": [{
"pages": [
{
"path": "goods_seckill/index",
"style": {
"enablePullDownRefresh": true,
@ -1032,12 +1032,12 @@
{
"path": "presell/index",
"style": {
// #ifdef MP || APP-PLUS
"navigationBarBackgroundColor": "#F2F2F2",
// #endif
"enablePullDownRefresh": true,
"navigationBarTitleText": "预售列表"
// #ifdef MP || APP-PLUS
,
"navigationBarBackgroundColor": "#F2F2F2"
// #endif
}
},
{
@ -1050,12 +1050,11 @@
{
"path": "combination/index",
"style": {
// #ifdef MP || APP-PLUS
"navigationBarBackgroundColor": "#F2F2F2",
// #endif
"enablePullDownRefresh": true,
"navigationBarTitleText": "拼团"
// #ifdef MP || APP-PLUS
,
"navigationBarBackgroundColor": "#F2F2F2"
// #endif
}
},
{
@ -1126,189 +1125,230 @@
]
},
{
"root": "pages/short_video",
"name": "shortVideo",
"pages": [{
"navigationBarTitleText": "短视频",
"enablePullDownRefresh": false,
//#ifdef APP
"path": "appSwiper/index",
//#endif
//#ifndef APP
"path": "nvueSwiper/index",
//#endif
"style": {
"navigationBarTitleText": "社区短视频",
"app-plus": {
"titleNView": false,
"bounce": "none"
}
}
}]
"root": "pages/short_video",
"name": "shortVideo",
"pages": [
{
"navigationBarTitleText": "短视频",
"enablePullDownRefresh": false,
//#ifdef APP
"path": "appSwiper/index",
//#endif
//#ifndef APP
"path": "nvueSwiper/index",
//#endif
"style": {
"navigationBarTitleText": "社区短视频",
"app-plus": {
"titleNView": false,
"bounce": "none"
}
}
}
]
},
{
"root": "pages/points_mall",
"pages": [{
"path": "index",
"style": {
"navigationBarTextStyle": "white",
"navigationBarBackgroundColor": "#333333",
"navigationBarTitleText": "积分商城",
"app-plus": {
// #ifdef APP-PLUS
"titleNView": {
"type": "default"
}
// #endif
}
}
},
{
"path": "integral_goods_list",
"style": {
"navigationBarTitleText": "商品列表",
"app-plus": {
// #ifdef APP-PLUS
"titleNView": {
"type": "default"
}
// #endif
}
}
},
"root": "pages/points_mall",
"pages": [
{
"path": "goods_selection",
"style": {
"navigationBarTitleText": "好物精选",
"app-plus": {
// #ifdef APP-PLUS
"titleNView": {
"type": "default"
}
// #endif
}
}
"path": "index",
"style": {
"app-plus": {
// #ifdef APP-PLUS
"titleNView": {
"type": "default"
}
// #endif
},
"navigationBarTextStyle": "white",
"navigationBarBackgroundColor": "#333333",
"navigationBarTitleText": "积分商城"
}
},
{
"path": "integral_goods_details",
"style": {
"navigationBarTitleText": "商品详情",
"app-plus": {
// #ifdef APP-PLUS
"titleNView": {
"type": "default"
}
// #endif
}
// #ifdef MP
,
"disableScroll": true
// #endif
}
},
{
"path": "integral_order",
"style": {
"navigationBarTitleText": "积分订单",
"app-plus": {
// #ifdef APP-PLUS
"titleNView": {
"type": "default"
}
// #endif
}
}
},
{
"path": "exchange_record",
"style": {
"navigationBarTitleText": "兑换记录",
"path": "integral_goods_list",
"style": {
"navigationBarTitleText": "商品列表",
"app-plus": {
// #ifdef APP-PLUS
"titleNView": {
"type": "default"
}
// #endif
// #ifdef APP-PLUS
"titleNView": {
"type": "default"
}
// #endif
}
}
},{
"path": "integral_order_details",
"style": {
"navigationBarTitleText": "兑换订单详情"
}
}
]
}
},
{
"path": "goods_selection",
"style": {
"navigationBarTitleText": "好物精选",
"app-plus": {
// #ifdef APP-PLUS
"titleNView": {
"type": "default"
}
// #endif
}
}
},
{
"path": "integral_goods_details",
"style": {
// #ifdef MP
"disableScroll": true,
// #endif
"navigationBarTitleText": "商品详情",
"app-plus": {
// #ifdef APP-PLUS
"titleNView": {
"type": "default"
}
// #endif
}
}
},
{
"path": "integral_order",
"style": {
"navigationBarTitleText": "积分订单",
"app-plus": {
// #ifdef APP-PLUS
"titleNView": {
"type": "default"
}
// #endif
}
}
},
{
"path": "exchange_record",
"style": {
"navigationBarTitleText": "兑换记录",
"app-plus": {
// #ifdef APP-PLUS
"titleNView": {
"type": "default"
}
// #endif
}
}
},
{
"path": "integral_order_details",
"style": {
"navigationBarTitleText": "兑换订单详情"
}
}
]
},
{
"root": "pages/annex",
"root": "pages/annex",
"name": "annx",
"pages": [{
"path": "web_view/index",
"style": {
"navigationBarTitleText": "",
"app-plus": {
// #ifdef APP-PLUS
"titleNView": {
"type": "default"
}
// #endif
}
}
}, {
"path": "vip_paid/index",
"style": {
"navigationBarTitleText": "开通会员",
"app-plus": {
// #ifdef APP-PLUS
"titleNView": {
"type": "default"
}
// #endif
}
}
}, {
"path": "vip_center/index",
"style": {
"navigationBarTitleText": "会员中心",
"app-plus": {
// #ifdef APP-PLUS
"titleNView": {
"type": "default"
}
// #endif
}
}
},
"pages": [
{
"path": "vip_grade/index",
"style": {
"navigationBarTitleText": "会员卡",
"path": "web_view/index",
"style": {
"navigationBarTitleText": "",
"app-plus": {
// #ifdef APP-PLUS
"titleNView": {
"type": "default"
}
// #endif
}
}
},
{
"path": "vip_paid/index",
"style": {
"navigationBarTitleText": "开通会员",
"app-plus": {
// #ifdef APP-PLUS
"titleNView": {
"type": "default"
}
// #endif
}
}
},
{
"path": "vip_center/index",
"style": {
"navigationBarTitleText": "会员中心",
"app-plus": {
// #ifdef APP-PLUS
"titleNView": {
"type": "default"
}
// #endif
}
}
},
{
"path": "vip_grade/index",
"style": {
"navigationBarTitleText": "会员卡",
"navigationBarTextStyle": "white",
"navigationBarBackgroundColor": "#302F35",
"app-plus": {
// #ifdef APP-PLUS
"titleNView": {
"type": "default"
}
// #endif
}
}
"app-plus": {
// #ifdef APP-PLUS
"titleNView": {
"type": "default"
}
// #endif
}
}
},
{
"path": "vip_clause/index",
"style": {
"navigationBarTitleText": "会员协议",
"app-plus": {
// #ifdef APP-PLUS
"titleNView": {
"type": "default"
}
// #endif
}
}
}
]
{
"path": "vip_clause/index",
"style": {
"navigationBarTitleText": "会员协议",
"app-plus": {
// #ifdef APP-PLUS
"titleNView": {
"type": "default"
}
// #endif
}
}
}
]
},
{
"root": "pages/agent",
"name": "agent",
"pages": [
{
"path": "center",
"style": {
"navigationBarTitleText": "代理中心"
}
}
]
},
{
"root": "pages/supplier",
"name": "supplier",
"pages": [
{
"path": "apply_join",
"style": {
"navigationBarTitleText": "申请入驻"
}
}
]
}
],
"globalStyle": {
"navigationBarTextStyle": "black",

View File

@ -33,7 +33,7 @@
<script>
import emptyPage from '@/components/emptyPage.vue'
import shopList from '@/components/shopList';
import {promoteQrCodes,onlinePaymentQrCodes} from "@/api/merchant";
import {promoteQrCodes,onlinePaymentQrCodes} from "@/api/service";
export default {
name: 'business',

342
pages/agent/center.vue Normal file
View File

@ -0,0 +1,342 @@
<template>
<view class="main-content">
<!-- 顶部信息 -->
<view class="header">
<view class="header-box" @click="changeAgentPopupShow">
<span class='font line1'>{{ getAgentTypeText(agent_info, '暂无代理身份') }}</span>
<template v-if="Object.values(agent_list).length > 1">
<text class="iconfont icon-xiala1 spin"></text>
</template>
</view>
</view>
<!--操作内容-->
<view v-if="Object.values(menu_list).length > 0" class="menu-list">
<view @click="clickMenu(item)" class="listBox" v-for="(item,index) in menu_list">
<text :class="item.icon" class="businessIcon"></text>
<view>{{item.title}}</view>
</view>
</view>
<emptyPage v-else title="暂无任何操作权限~"></emptyPage>
<!--授权登录-->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authClose"></authorize>
<!--切换代理身份-->
<uni-popup ref="changeAgent" type="bottom">
<view class="change-agent-content">
<scroll-view scroll-y="true">
<radio-group name="store_name" @change="changeAgent">
<template v-for="(item,index) in agent_list">
<div class="store-list">
<label :key="item.id" class="store-list-item">
<view class="text">{{ getAgentTypeText(item) }}</view>
<radio class="radio" :value="index" :checked="agent_info.id == item.id ? true : false" />
</label>
</div>
</template>
</radio-group>
</scroll-view>
</view>
</uni-popup>
<!--二维码-->
<uni-popup ref="qrCodePopup" type="center">
<view class="qr-code-content">
<image class="image" :src="qrCode"></image>
<view class="close-qr-code" @click="closeQrCode()">关闭</view>
</view>
</uni-popup>
</view>
</template>
<script>
import emptyPage from '@/components/emptyPage.vue'
import {mapGetters} from "vuex";
import authorize from '@/components/Authorize';
import { myAgentList,inviteSupplierJoinQrCode } from "@/api/agent";
export default {
name: 'business',
components: {
authorize,
emptyPage,
},
computed: {
menu_list() {
let menuList = [];
let agentType = this.agent_info.agent_type || 0;
if(Number(agentType) <= 5){
menuList.push({
title: '供应商邀请二维码',
type: 'supplier_qr_code',
url: '',
icon: 'iconfont icon-erweima1',
});
}
return menuList;
},
...mapGetters(['isLogin', 'uid', 'userInfo', 'viewColor'])
},
data() {
return {
//
isAuto: false, //
isShowAuth: false,//
//
agent_list: {},
agent_info: {},
//
qrCode: '',
}
},
onLoad(options) {
//
if (!this.isLogin) {
//
this.isAuto = true;
this.isShowAuth = true
}else{
//
this.init();
}
},
methods: {
//
onLoadFun() {
if(this.isLogin){
this.isShowAuth = false;
this.init();
}
},
//
authClose(e) {
this.isShowAuth = e
},
//
init () {
this.getMyAgentList();
},
// -
getMyAgentList(){
let _this = this;
let params = {
is_get_self: 1,
not_page: 1
};
myAgentList(params).then(res => {
if (res.status == 200) {
let data = res.data || {};
if(Object.values(data).length <= 0){
this.$util.Tips({
title: '无有效的代理身份!',
},{tab:1,url:'/pages/user/index'});
return false;
}else{
_this.agent_list = res.data;
_this.agent_info = res.data[0] || {};
}
}
}).catch(err => {
this.$util.Tips({title: err});
});
},
// -
changeAgentPopupShow(){
if(Object.values(this.agent_list).length <= 1) return false;
this.$refs.changeAgent.open('bottom')
},
// -
changeAgentPopupClose(){
this.$refs.changeAgent.close();
},
// -
changeAgent(e){
let index = e.detail.value || e.target.value;
this.agent_info = this.agent_list[index] || {};
this.changeAgentPopupClose();
},
//
getAgentTypeText(info, title = '') {
switch (Number(info.agent_type)) {
case 1:
title = '发起人';
break;
case 2:
title = '省公司';
if(info.province_name) title += `(${info.province_name})`;
break;
case 3:
title = '外勤';
if(info.province_name) title += `(${info.province_name})`;
break;
case 4:
title = '内勤';
if(info.province_name) title += `(${info.province_name})`;
break;
case 5:
title = '运营商';
if(info.province_name || info.area_name || info.area_name) title += `(${info.province_name}${info.city_name}${info.area_name})`;
break;
case 6:
title = '合伙人';
if(info.province_name || info.area_name || info.area_name) title += `(${info.province_name}${info.city_name}${info.area_name})`;
break;
case 7:
title = '餐厅';
if(info.mer && info.mer.mer_name) title += `(${info.mer.mer_name})`;
break;
case 8:
title = '配送商';
break;
}
return title;
},
//
clickMenu(menu){
let _this = this;
switch (menu.type) {
//
case 'supplier_qr_code':
inviteSupplierJoinQrCode({agent_id: _this.agent_info.id}).then(res => {
if (res.status == 200) {
_this.qrCode = res.data.qr_code || '';
_this.$refs.qrCodePopup.open('center');
}
}).catch(err => {
this.$util.Tips({title: err});
});
break;
}
},
//
closeQrCode() {
this.$refs.qrCodePopup.close();
},
}
}
</script>
<style scoped lang="scss">
.main-content{
//
.header {
height: 305rpx;
background: linear-gradient(180deg, #2291F8 0%, rgba(34,145,248,0) 100%);
position: fixed;
width: 100%;
text-align: center;
top: 0;
left: 0;
.header-box {
min-width: 360rpx;
width: max-content;
margin: 33rpx auto 0 auto;
position: relative;
padding: 10rpx;
background-color: rgba(0, 0, 0, .25);
border-radius: 30rpx;
color: #FFFFFF;
.font {
display: inline-block;
margin-left: 10rpx;
line-height: 28rpx;
}
.spin {
display: inline-block;
transform: rotate(180deg);
font-size: 36rpx;
}
}
}
//
.menu-list {
width: 100%;
padding: 0 calc((100% - (345rpx * 2)) / 3);
margin-top: 151rpx;
display: inline-flex;
flex-wrap: wrap;
flex-direction: row;
justify-content: space-between;
.listBox {
width: 345rpx;
height: 270rpx;
background: #FFFFFF;
box-shadow: 0rpx 5rpx 15rpx rgba(142, 82, 77, 0.1);
border-radius: 20rpx;
z-index: 1;
margin-bottom: 20rpx;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
image {
width: 66rpx;
height: 66rpx;
background: #F34C20;
}
}
.businessIcon {
color: #2291F8;
font-size: 80rpx;
display: inline-block;
margin-bottom: 29rpx;
}
}
//
.change-agent-content{
width: 100vw!important;
min-height: 65vh!important;
background-color: #fff;
border-top-left-radius: 30rpx!important;
border-top-right-radius: 30rpx!important;
padding: 30rpx!important;
.store-list{
width: 100% !important;
height: 120rpx;
line-height: 120rpx;
.store-list-item{
width: 100%;
display: inline-flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: space-between;
align-items: center;
}
.store-list-item:not(:last-child){
border-bottom: 2rpx solid #f6f6f6;
}
.title{
width: calc(100% - 80rpx) !important;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
/deep/ radio .wx-radio-input.wx-radio-input-checked, /deep/radio .uni-radio-input.uni-radio-input-checked {
border: 1px solid #2291F8 !important;
background-color: #2291F8 !important
}
}
//
.qr-code-content{
width: 80vw;
.image{
width: 80vw;
height: 80vw;
}
.close-qr-code{
position: fixed;
top: 35rpx;
right: 70rpx;
color: #FFFFFF;
border: 2rpx solid #FFFFFF;
height: 40rpx;
line-height: 36rpx;
padding: 0 20rpx;
border-radius: 50rpx;
}
}
}
</style>

View File

@ -0,0 +1,345 @@
<template>
<view class="main-content">
<!-- 顶部信息 -->
<view class="header">
<view class="header-box" @click="changeAgentPopupShow">
<span class='font line1'>{{ getAgentTypeText(agent_info, '暂无代理身份') }}</span>
<template v-if="Object.values(agent_list).length > 1">
<text class="iconfont icon-xiala1 spin"></text>
</template>
</view>
</view>
<!--操作内容-->
<view v-if="Object.values(menu_list).length > 0" class="menu-list">
<view @click="clickMenu(item)" class="listBox" v-for="(item,index) in menu_list">
<text :class="item.icon" class="businessIcon"></text>
<view>{{item.title}}</view>
</view>
</view>
<emptyPage v-else title="暂无任何操作权限~"></emptyPage>
<!--授权登录-->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authClose"></authorize>
<!--切换代理身份-->
<uni-popup ref="changeAgent" type="bottom">
<view class="change-agent-content">
<scroll-view scroll-y="true">
<radio-group name="store_name" @change="changeAgent">
<template v-for="(item,index) in agent_list">
<div class="store-list">
<label :key="item.id" class="store-list-item">
<view class="text">{{ getAgentTypeText(item) }}</view>
<radio class="radio" :value="index" :checked="agent_info.id == item.id ? true : false" />
</label>
</div>
</template>
</radio-group>
</scroll-view>
</view>
</uni-popup>
<!--二维码-->
<uni-popup ref="qrCodePopup" type="center">
<view class="qr-code-content">
<image class="image" :src="qrCode"></image>
<view class="close-qr-code" @click="closeQrCode()">关闭</view>
</view>
</uni-popup>
</view>
</template>
<script>
import emptyPage from '@/components/emptyPage.vue'
import {mapGetters} from "vuex";
import authorize from '@/components/Authorize';
import { myAgentList,inviteSupplierJoinQrCode } from "@/api/agent";
export default {
name: 'business',
components: {
authorize,
emptyPage,
},
computed: {
...mapGetters(['isLogin', 'uid', 'userInfo', 'viewColor'])
},
data() {
return {
//
isAuto: false, //
isShowAuth: false,//
//
agent_list: {},
agent_info: {},
//
menu_list: [
{
title: '推广二维码',
type: 'supplier_qr_code',
url: '',
icon: 'iconfont icon-erweima1'
},
{
title: '客服记录',
type: 'customer',
url: '/pages/chat/customer_list/index?type=1&mer_id=',
icon: 'iconfont icon-kefujilu'
},
],
//
qrCode: '',
}
},
onLoad(options) {
//
if (!this.isLogin) {
//
this.isAuto = true;
this.isShowAuth = true
}else{
//
this.init();
}
},
methods: {
//
onLoadFun() {
if(this.isLogin){
this.isShowAuth = false;
this.init();
}
},
//
authClose(e) {
this.isShowAuth = e
},
//
init () {
this.getMyAgentList();
},
// -
getMyAgentList(){
let _this = this;
let params = {
is_get_self: 1,
not_page: 1
};
myAgentList(params).then(res => {
if (res.status == 200) {
let data = res.data || {};
if(Object.values(data).length <= 0){
this.$util.Tips({
title: '无有效的代理身份!',
},{tab:1,url:'/pages/user/index'});
return false;
}else{
_this.agent_list = res.data;
_this.agent_info = res.data[0] || {};
}
}
}).catch(err => {
this.$util.Tips({title: err});
});
},
// -
changeAgentPopupShow(){
if(Object.values(this.agent_list).length <= 1) return false;
this.$refs.changeAgent.open('bottom')
},
// -
changeAgentPopupClose(){
this.$refs.changeAgent.close();
},
// -
changeAgent(e){
let index = e.detail.value || e.target.value;
this.agent_info = this.agent_list[index] || {};
this.changeAgentPopupClose();
},
//
getAgentTypeText(info, title = '') {
switch (Number(info.agent_type)) {
case 1:
title = '发起人';
break;
case 2:
title = '省公司';
if(info.province_name) title += `(${info.province_name})`;
break;
case 3:
title = '外勤';
if(info.province_name) title += `(${info.province_name})`;
break;
case 4:
title = '内勤';
if(info.province_name) title += `(${info.province_name})`;
break;
case 5:
title = '运营商';
if(info.province_name || info.area_name || info.area_name) title += `(${info.province_name}${info.city_name}${info.area_name})`;
break;
case 6:
title = '合伙人';
if(info.province_name || info.area_name || info.area_name) title += `(${info.province_name}${info.city_name}${info.area_name})`;
break;
case 7:
title = '餐厅';
if(info.mer && info.mer.mer_name) title += `(${info.mer.mer_name})`;
break;
case 8:
title = '配送商';
break;
}
return title;
},
//
clickMenu(menu){
let _this = this;
switch (menu.type) {
//
case 'supplier_qr_code':
inviteSupplierJoinQrCode({agent_id: _this.agent_info.id}).then(res => {
if (res.status == 200) {
_this.qrCode = res.data.qr_code || '';
_this.$refs.qrCodePopup.open('center');
}
}).catch(err => {
this.$util.Tips({title: err});
});
break;
}
},
//
closeQrCode() {
this.$refs.qrCodePopup.close();
},
}
}
</script>
<style scoped lang="scss">
.main-content{
//
.header {
height: 305rpx;
background: linear-gradient(180deg, #2291F8 0%, rgba(34,145,248,0) 100%);
position: fixed;
width: 100%;
text-align: center;
top: 0;
left: 0;
.header-box {
width: max-content;
margin: 33rpx auto 0 auto;
position: relative;
padding: 10rpx;
background-color: rgba(0, 0, 0, .25);
border-radius: 30rpx;
color: #FFFFFF;
.font {
display: inline-block;
margin-left: 10rpx;
line-height: 28rpx;
}
.spin {
display: inline-block;
transform: rotate(180deg);
font-size: 36rpx;
}
}
}
//
.menu-list {
width: 100%;
padding: 0 calc((100% - (345rpx * 2)) / 3);
margin-top: 151rpx;
display: inline-flex;
flex-wrap: wrap;
flex-direction: row;
justify-content: space-between;
.listBox {
width: 345rpx;
height: 270rpx;
background: #FFFFFF;
box-shadow: 0rpx 5rpx 15rpx rgba(142, 82, 77, 0.1);
border-radius: 20rpx;
z-index: 1;
margin-bottom: 20rpx;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
image {
width: 66rpx;
height: 66rpx;
background: #F34C20;
}
}
.businessIcon {
color: #2291F8;
font-size: 80rpx;
display: inline-block;
margin-bottom: 29rpx;
}
}
//
.change-agent-content{
width: 100vw!important;
min-height: 65vh!important;
background-color: #fff;
border-top-left-radius: 30rpx!important;
border-top-right-radius: 30rpx!important;
padding: 30rpx!important;
.store-list{
width: 100% !important;
height: 120rpx;
line-height: 120rpx;
.store-list-item{
width: 100%;
display: inline-flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: space-between;
align-items: center;
}
.store-list-item:not(:last-child){
border-bottom: 2rpx solid #f6f6f6;
}
.title{
width: calc(100% - 80rpx) !important;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
/deep/ radio .wx-radio-input.wx-radio-input-checked, /deep/radio .uni-radio-input.uni-radio-input-checked {
border: 1px solid #2291F8 !important;
background-color: #2291F8 !important
}
}
//
.qr-code-content{
width: 80vw;
.image{
width: 80vw;
height: 80vw;
}
.close-qr-code{
position: fixed;
top: 35rpx;
right: 70rpx;
color: #FFFFFF;
border: 2rpx solid #FFFFFF;
height: 40rpx;
line-height: 36rpx;
padding: 0 20rpx;
border-radius: 50rpx;
}
}
}
</style>