添加:我的邀请 - 支持修改门店绑定的资源股东

This commit is contained in:
wuhui_zzw 2024-04-26 14:49:21 +08:00
parent 4462549b22
commit efe30f87cc
2 changed files with 294 additions and 56 deletions

View File

@ -12,6 +12,10 @@ export function inviteSupplierJoinQrCode(data) {
export function getMyInvite(data) {
return request.get(`agent/my_invite`, data);
}
// 代理中心 - 修改资源股东
export function updateShareholders(data) {
return request.post(`agent/update_shareholders`, data);
}
// 代理加入 - 提交申请信息
export function submitAgentApplyInfo(data) {
return request.post('agent/agent_apply',data);

View File

@ -18,17 +18,25 @@
<view class="_list">
<template v-if="Object.values(list).length > 0">
<view class="item-box" v-for="(item,index) in list" :key="index">
<view class="left">
<view class="name">{{ item.mer_name || '' }}</view>
<view class="left-info">
<image mode="widthFix" class="mer-logo" :src="item.mer_avatar" />
<view class="contacts">
<view class="contacts-line">负责人{{ item.real_name || '' }}</view>
<view class="contacts-line">电话{{ item.mer_phone || '' }}</view>
<view class="item-content">
<view class="left">
<view class="name">{{ item.mer_name || '' }}</view>
<view class="left-info">
<image mode="widthFix" class="mer-logo" :src="item.mer_avatar" />
<view class="contacts">
<view class="contacts-line">负责人{{ item.real_name || '' }}</view>
<view class="contacts-line">电话{{ item.mer_phone || '' }}</view>
<view class="contacts-line" v-if="merchant_type != 2">
资源股东{{ item.shareholders ? item.shareholders.nickname + `(${item.shareholders.uid})` : '暂无' }}
</view>
</view>
</view>
</view>
<!--<text class="right-icon iconfont icon-xiangyou"></text>-->
</view>
<view class="group-btn" v-if="merchant_type != 2">
<view class="update-btn" @click="shareholdersShow(item)">修改股东</view>
</view>
<!--<text class="right-icon iconfont icon-xiangyou"></text>-->
</view>
</template>
<emptyPage v-else title="暂无邀请店铺~"></emptyPage>
@ -36,6 +44,45 @@
</view>
<!-- 授权登录 -->
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authClose"></authorize>
<!-- 资源股东 编辑弹框 -->
<uni-popup ref="shareholdersEditPopup" type="center">
<view class="shareholders-content">
<view class="title">编辑资源股东</view>
<view class='list'>
<view class="item">
<view class="item-title">当前绑定资源股东</view>
<view class="user-info" v-if="old_shareholders.uid > 0">
<view class="left">
<image class="left-image" :src="old_shareholders.avatar" />
</view>
<view class="right">
<view class="nickname">{{ old_shareholders.nickname || old_shareholders.real_name || old_shareholders.uid }}</view>
<view class="uid">UID{{ old_shareholders.uid }}</view>
</view>
</view>
<view class="empty" v-else>暂无资源股东</view>
</view>
<view class="item">
<view class="item-title">新资源股东</view>
<input class="shareholders_search" type="text" placeholder="请输入用户UID查询用户" v-model="shareholders_search" />
<view class="user-info" v-if="new_shareholders.uid > 0">
<view class="left">
<image class="left-image" :src="new_shareholders.avatar" />
</view>
<view class="right">
<view class="nickname">{{ new_shareholders.nickname || new_shareholders.real_name || new_shareholders.uid }}</view>
<view class="uid">UID{{ new_shareholders.uid }}</view>
</view>
</view>
</view>
</view>
<view class="group-btn">
<view class="popup-btn close-btn" @click="shareholdersHide">取消编辑</view>
<view class="popup-btn submit-btn" @click="shareholdersUpdate">提交修改</view>
</view>
</view>
</uni-popup>
</view>
</template>
@ -44,7 +91,8 @@ import {mapGetters} from "vuex";
import authorize from '@/components/Authorize';
import { HTTP_REQUEST_URL } from '@/config/app.js';
import emptyPage from '@/components/emptyPage.vue'
import {getMyInvite} from "@/api/agent";
import { getMyInvite, updateShareholders } from "@/api/agent";
import { searchUser } from "@/api/user";
export default {
name: 'business',
@ -67,8 +115,28 @@ export default {
agent_id: 0,
list: [],
page: 1,
//
mer_info: {},
old_shareholders: {},
new_shareholders: {},
shareholders_search: '',
}
},
watch: {
'shareholders_search':{
handler(val) {
let _this = this;
if(Number(val) > 0){
searchUser({ id_and_phone: _this.shareholders_search }).then(res => {
_this.new_shareholders = Object.assign({}, res.data);
}).catch(err => {});
}else{
_this.new_shareholders = {};
}
},
deep: false
},
},
onLoad(options) {
let _this = this;
_this.agent_id = options.agent_id || 0;
@ -127,8 +195,56 @@ export default {
this.page = 1;
this.list = [];
this.getList();
}
},
// -
shareholdersShow(item){
this.shareholders_search = '';
this.mer_info = Object.assign({}, item);
this.old_shareholders = Object.assign({}, item.shareholders || {});
this.new_shareholders = {};
this.$refs.shareholdersEditPopup.open('center');
},
// -
shareholdersHide(){
this.$refs.shareholdersEditPopup.close();
},
// -
shareholdersUpdate(){
let _this = this;
let oldShareholders = Object.assign({}, _this.old_shareholders);
let oldUid = oldShareholders.uid || 0;
let newShareholders = Object.assign({}, _this.new_shareholders);
let newUid = newShareholders.uid || 0;
// ---
let tips = '确认设置当前用户为资源股东?';
if(Number(oldUid) <= 0 && Number(newUid) <= 0) {
this.$util.Tips({title: '请查询选择一个用户!'});
return false;
}
else if(Number(oldUid) > 0 && Number(newUid) <= 0) {
tips = '确认清除当前门店的资源股东吗?';
}
else if(Number(oldUid) > 0 && Number(newUid) > 0) {
tips = '确认修改当前门店的资源股东吗?';
}
//
uni.showModal({
title: '提示',
content: tips,
confirmText: '提交',
cancelText: '取消',
success(res) {
if (res.confirm) {
updateShareholders({ resource_shareholders_uid: newUid, mer_id: _this.mer_info.mer_id }).then(res => {
_this.page = 1;
_this.list = [];
_this.getList();
_this.shareholdersHide();
}).catch(err => {});
}
}
});
},
},
@ -205,59 +321,177 @@ export default {
._list{
.item-box{
width: 100%;
padding: 20rpx;
background: #ffffff;
border-radius: 20rpx;
margin-bottom: 25rpx;
display: inline-flex;
flex-direction: row;
flex-wrap: nowrap;
align-items: center;
justify-content: space-between;
.left{
width: calc(100% - 60rpx);
.name{
font-weight: bold;
font-size: 30rpx;
width: 100%;
height: 50rpx;
line-height: 50rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.left-info{
display: inline-flex;
flex-direction: row;
flex-wrap: nowrap;
align-items: center;
justify-content: flex-start;
margin-top: 10rpx;
.mer-logo{
height: calc(45rpx * 2) !important;
width: calc(45rpx * 2) !important;
border-radius: 10rpx!important;
}
.contacts{
width: calc(100% - calc(45rpx * 2));
padding-left: 15rpx;
.contacts-line{
height: 45rpx;
line-height: 45rpx;
font-size: 28rpx;
color: #949494;
}
}
}
}
.right-icon{
width: 60rpx;
.item-content{
width: 100%;
padding: 20rpx;
display: inline-flex;
flex-direction: row;
flex-wrap: nowrap;
align-items: center;
justify-content: flex-end;
justify-content: space-between;
.left{
width: calc(100% - 60rpx);
.name{
font-weight: bold;
font-size: 30rpx;
width: 100%;
height: 50rpx;
line-height: 50rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.left-info{
display: inline-flex;
flex-direction: row;
flex-wrap: nowrap;
align-items: center;
justify-content: flex-start;
margin-top: 10rpx;
.mer-logo{
height: calc(45rpx * 2) !important;
width: calc(45rpx * 2) !important;
border-radius: 10rpx!important;
}
.contacts{
width: calc(100% - calc(45rpx * 2));
padding-left: 15rpx;
.contacts-line{
height: 45rpx;
line-height: 45rpx;
font-size: 28rpx;
color: #949494;
}
}
}
}
.right-icon{
width: 60rpx;
display: inline-flex;
flex-direction: row;
flex-wrap: nowrap;
align-items: center;
justify-content: flex-end;
}
}
.group-btn{
width: 100%;
padding: 20rpx;
display: inline-flex;
flex-wrap: nowrap;
justify-content: flex-end;
align-items: center;
flex-direction: row;
border-top: 2rpx solid #f6f6f6;
.update-btn{
height: 50rpx;
line-height: 50rpx;
width: 150rpx;
text-align: center;
font-size: 30rpx;
color: #fff;
background-color: #409eff;
border-color: #409eff;
border-radius: 50rpx;
}
}
}
}
}
//
.shareholders-content{
background-color: #ffffff;
border-radius: 20rpx;
width: 85vw;
padding: 30rpx;
.title{
width: 100%;
text-align: center;
font-size: 28rpx;
height: 50rpx;
line-height: 35rpx;
}
.list{
.item{
border-bottom: 2rpx solid #f6f6f6;
padding-bottom: 30rpx;
.item-title{
width: 100%;
height: 50rpx;
line-height: 50rpx;
font-size: 28rpx;
}
.shareholders_search{}
.user-info {
width: 100%;
margin-top: 20rpx;
display: inline-flex;
flex-direction: row;
flex-wrap: nowrap;
align-items: center;
justify-content: flex-start;
.left {
width: 100rpx;
text-align: left;
.left-image {
width: 90rpx;
height: 90rpx;
border-radius: 50%;
}
}
.right {
width: calc(100% - 100rpx);
.nickname {
width: 100%;
font-size: 30rpx;
font-weight: bold;
}
.uid {
width: 100%;
}
}
}
.empty{
height: 100rpx;
line-height: 100rpx;
text-align: center;
}
}
}
.group-btn{
width: 100%;
display: inline-flex;
flex-direction: row;
flex-wrap: nowrap;
align-items: center;
justify-content: space-around;
padding-top: 30rpx;
.popup-btn{
width: 180rpx;
height: 60rpx;
line-height: 55rpx;
text-align: center;
border-radius: 100rpx;
font-size: 28rpx;
}
.submit-btn{
color: #fff;
background-color: #409eff;
border: 2rpx solid #409eff;
}
.close-btn{
color: #606266;
background: #fff;
border: 2rpx solid #606266;
}
}
}