You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
apply-assistant-v3/root/detail/user.vue

173 lines
3.9 KiB
Vue

<template>
<div class="g_bg_page g_text_c">
<div class="g_fs_20 g_pt_24 g_fw_600">
{{ agencyInfo.inviteAgencyFullName }}
</div>
<div class="">
<div class="g_mt_24 g_mb_24">
请输入尾号为<span class="g_c_f40">{{ agencyInfo.newTel }}</span
>的手机号以获取验证码
</div>
<g-panel-form-slot
:list="[
{
icon: '',
label: '手机号',
result: '',
path: '',
value: info.tel,
tip: 'slot-mobile',
placeholder: '请输入联系电话',
type: 'slot',
pColumn: 8,
require: false,
},
{
icon: '',
label: '验证码',
result: '',
path: '',
value: info.code,
tel: info.tel,
verifyTel: agencyInfo.contactsTel,
tip: 'slot-code',
placeholder: '请输入验证码',
type: 'slot',
pColumn: 8,
require: false,
},
]"
@changeMobile="(val) => (info.tel = val)"
@changeCode="(val) => (info.code = val)"
>
</g-panel-form-slot>
<div class="" style="margin-top: 48px">
<quickLogin @successLogin="successLogin" v-if="!isLogin">
<g-button btnText="绑定代理" type="primary" class></g-button>
</quickLogin>
<g-button v-else btnText="绑定代理" type="primary" @clickBtn="bindAgency" />
</div>
</div>
</div>
</template>
<script>
import quickLogin from "../../components/quickLogin.vue";
export default {
// 组件名称
name: "",
// 局部注册的组件
components: {
quickLogin,
},
// 组件参数 接收来自父组件的数据
props: {},
// 组件状态值
data() {
return {
info: {
tel: "",
code: "",
},
agencyInfo: {},
scene: {
agencyId: "",
providerId: "",
},
isLogin: false,
};
},
onLoad(options) {
console.log(options);
if (options.scene) {
var sceneStr = decodeURIComponent(options.scene);
var sceneJson = this.G.sceneToJson(sceneStr);
this.scene.providerId = sceneJson.id.split("_")[1]; //被关注团队的邀请人id
this.scene.agencyId = sceneJson.id.split("_")[0]; // 被关注团队的id
console.log(this.scene);
}
this.getDetail();
},
onShow() {
this.isLogin = uni.getStorageSync("apply-token") ? true : false; // uni.getStorageSync("apply-token");
},
// 计算属性
computed: {},
// 侦听器
watch: {},
created() {},
mounted() {},
// 组件方法
methods: {
successLogin(e) {
let that = this;
this.isLogin = uni.getStorageSync("apply-token") ? true : false;
if (!that.info.tel || !that.info.code) {
uni.showToast({
title: "请输入手机号和验证码",
icon: "none",
});
} else {
this.bindAgency();
}
},
bindAgency() {
let that = this;
if (!that.info.tel || !that.info.code) {
uni.showToast({
title: "请输入手机号和验证码",
icon: "none",
});
return;
}
that.G.handleConfirm({
content: "绑定后将关注该代理, 是否确认?",
success: (res) => {
if (res.confirm) {
that.G.Post(
"/yishoudan/store/provider/downAgencyBindUpAgency",
{
providerId: that.scene.providerId,
upAgencyId: that.scene.agencyId,
tel: that.info.tel,
code: that.info.code,
},
(res) => {
console.log(res);
that.G.handleConfirm({
content: "绑定成功, 请回到首页",
showCancel: false,
success: (res) => {
if (res.confirm) {
uni.switchTab({
url: '/pages/home/index',
});
}
},
});
}
);
}
},
});
},
getDetail() {
let that = this;
that.G.Get(
"/yishoudan/store/provider/getInviteRelationDetails",
{
providerId: that.scene.providerId,
},
(res) => {
console.log(res);
res.newTel = res.contactsTel.slice(-4);
that.agencyInfo = res;
}
);
},
},
};
</script>
<style scoped lang="less"></style>