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

View File

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

View File

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