feat: 增加会员换绑推广员功能

pull/2/head
TianYu 2023-05-29 15:37:57 +08:00
parent bcfc0dba18
commit 950a9c2b62
3 changed files with 43 additions and 16 deletions

View File

@ -5,7 +5,8 @@
import {
refreshToken,
getWeChatOpenId,
fetchTenantInfo
fetchTenantInfo,
fetchMemberChangeSpreadId
} from "@/api/api";
import {
HTTP_REQUEST_URL
@ -163,12 +164,27 @@
}
// #endif
},
computed: mapGetters(['tenantId']),
computed: {
...mapGetters(['tenantId', 'uid', 'spreadId']),
spreadDataChange() {
return {
uid: this.uid,
spreadId: this.spreadId
}
}
},
mounted() {
this.initLoad()
},
watch: {
spreadDataChange: function() {
if (this.uid && this.spreadId) {
fetchMemberChangeSpreadId(this.spreadId)
}
}
},
methods: {
async initLoad(){
async initLoad() {
this.isQRCode()
this.setSpreadId()
if (this.$store.getters.isLogin && !this.$Cache.get('USER_INFO')) {
@ -195,7 +211,8 @@
const tenantId = this.$route.query.tenantId || ''
const spreadId = this.$route.query.spreadId || ''
const wechatUrl = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx7e503d9cded34c07'
location.href =`${wechatUrl}&redirect_uri=${redirectUrl}/pages/member_application/index?tenantId=${tenantId}&spreadId=${spreadId}&response_type=code&scope=snsapi_base#wechat_redirect`
location.href =
`${wechatUrl}&redirect_uri=${redirectUrl}/pages/member_application/index?tenantId=${tenantId}&spreadId=${spreadId}&response_type=code&scope=snsapi_base#wechat_redirect`
}
},
//
@ -248,17 +265,17 @@
});
}
},
onShow:async function() {
// const res = await memberGradeInfo()
// if(res.data.some((item) => !!parseInt(item.isExist))){
// uni.setTabBarItem({
// index: 0,
// pagePath: '/pages/member_equity/index'
// })
// uni.switchTab({
// url:'/pages/member_equity/index'
// })
// }
onShow: async function() {
// const res = await memberGradeInfo()
// if(res.data.some((item) => !!parseInt(item.isExist))){
// uni.setTabBarItem({
// index: 0,
// pagePath: '/pages/member_equity/index'
// })
// uni.switchTab({
// url:'/pages/member_equity/index'
// })
// }
// #ifdef H5
uni.getSystemInfo({
success(e) {
@ -319,4 +336,4 @@
height: 0;
color: transparent;
}
</style>
</style>

View File

@ -42,6 +42,15 @@ export function fetchTenantInfo(id) {
return request.get('tenant/get?id=' + id, {});
}
/**
* 会员换绑推广员ID
*/
export function fetchMemberChangeSpreadId(id) {
return request.post("api/order/member/memberChangeTie", {
promoterId: id
});
}
/**
* 保存form_id
* @param string formId

View File

@ -7,6 +7,7 @@ export default {
uid: state => state.app.uid,
tenantId: state => state.app.tenantId,
openId: state => state.app.openId,
spreadId: state => state.app.spreadId,
homeActive: state => state.app.homeActive,
home: state => state.app.home,
chatUrl: state => state.app.chatUrl,