公司小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

536 lines
13 KiB

<template>
<view class="main">
3 years ago
<view class="back" />
<u-navbar
title="合作申请"
:safeAreaInsetTop="true"
:fixed="true"
bgColor="#FFFFFF00"
@leftClick="onTouchBack"
>
</u-navbar>
3 years ago
<image class="top_banner_global" :src="pageData.toppic.picurl" mode="widthFix"></image>
3 years ago
<view class="body">
3 years ago
<view style="width:100%;height:auto;position: relative;top: 30rpx;left: 0;right: 0;display: flex;flex-direction: row;align-items: center;justify-content: flex-start;">
3 years ago
<view style="width: 8rpx;height: 22rpx;background: #D49B4B;opacity: 1;border-radius: 1px 5px 5px 1px;margin-left: 20rpx;"/>
<text class="title_text">{{getTitleText()}}</text>
</view>
<view class="u-form-body">
<u-form
labelPosition="left"
ref="form1"
:model="person"
:rules="rules"
>
<u-form-item
prop="person.name"
borderBottom
ref="name"
>
3 years ago
<view class="form_box">
<text class="form_tile_title">姓名*</text>
<input
:placeholder="rules['person.name'].message"
class="form_input"
:value="person.name"
placeholder-class="form_holder"
@blur="rules['person.name'].validator"
/>
3 years ago
</view>
</u-form-item>
<u-form-item
prop="person.phone"
borderBottom
ref="phone"
>
<view class="form_box">
<text class="form_tile_title">电话*</text>
<view v-if="person.phone == ''" style="width: 500rpx;height: 110rpx;
flex-direction: row;
display: flex;
align-items: center;
justify-content: flex-end;">
<button class="phone_get_button" open-type="getPhoneNumber" @getphonenumber="onTouchToGetPhone">
<text style="color: #999999;font-size: 28rpx;">点击获取手机号码</text>
</button>
<u-icon
slot="right"
name="arrow-right"
></u-icon>
</view>
<text v-else class="form_value">{{person.phone}}</text>
</view>
</u-form-item>
<u-form-item
prop="person.address"
borderBottom
ref="city"
@click="onClickToSelectCity"
>
<view class="form_box">
<text class="form_tile_title">所在区域</text>
<view style="width: 500rpx;height: 110rpx;
flex-direction: row;
display: flex;
align-items: center;
justify-content: flex-end;
">
<pick-regions :defaultRegion="defaultRegion" @getRegion="handleGetRegion">
<input
:placeholder="rules['person.address'].message"
class="form_input"
:disabled="true"
:value="person.address"
placeholder-class="form_holder"
/>
</pick-regions>
<u-icon
slot="right"
name="arrow-right"
></u-icon>
</view>
</view>
</u-form-item>
<u-form-item
prop="person.referrer"
borderBottom
ref="referrer"
>
<view class="form_box">
<text class="form_tile_title">推荐人电话</text>
<input
:placeholder="rules['person.referrer'].message"
class="form_input"
placeholder-class="form_holder"
:value="person.referrer"
@blur="rules['person.referrer'].validator"
/>
</view>
3 years ago
</u-form-item>
</u-form>
<view class="checkboxgroup" :key="isAgree.toString()">
<checkbox :checked="isAgree" value="1" @click="onChechBoxChange"/>
<text class="label" @click="onClickAreement">
我已阅读并同意 [协议条款]
</text>
</view>
<view style="width: 702rpx;height: auto;position: relative;top: 24rpx;">
<text class="attentionText">注意事项</text>
3 years ago
<u-gap height="12rpx" />
3 years ago
<view class="attentionInfo">
3 years ago
<u-parse :content="pageData.toppic.textmsg" class="attentionInfo"></u-parse>
</view>
</view>
</view>
</view>
3 years ago
<button class="button" @click="onTouchConfirm">提交</button>
<u-popup
:show="isShowUpload"
:closeOnClickOverlay="false"
mode="center"
bgColor="transparent"
>
<UploadSuccess @confirm="onTouchBack" />
</u-popup>
</view>
</template>
<script>
import {post} from '@/common/api.js'
import UploadSuccess from "@/components/UploadSuccess/UploadSuccess.vue";
var Player = getApp().globalData.Player;
var Define = getApp().globalData.Define;
var pageData = {
note : '',
partnerinfo : {},
//0->未申请,1->已申请,未审核。2->通过。3->已拒绝
partnerstatus : 0,
toppic : {},
};
export default {
components:{
UploadSuccess,
},
onLoad() {
uni.showLoading({
});
var agreementData = getApp().globalData.agreementData;
3 years ago
this.$utils.getAgreementData();
let self = this;
post('pages/getbecpartner',{}).then(
res=>{
uni.hideLoading();
var info = Define.onNetMessage(res);
if(!info){
//没有取到数据
return;
}
3 years ago
self.pageData = info;
var partnerstatus = info.partnerstatus;
var mainPageData = getApp().globalData.mainPageData;
mainPageData.partnerstatus = partnerstatus;
console.log("合作申请页面信息:",info);
//这是用户数据
var partnerinfo = info.partnerinfo;
var person = self.person;
person.name = partnerinfo.name ?? '';
person.phone = partnerinfo.phone ?? '';
person.referrer = partnerinfo.recommender ?? '';
var province = partnerinfo.province;
var city = partnerinfo.city;
var area = partnerinfo.area;
if(province && province!=''){
self.defaultRegion = [province,city,area];
person.address = province + " " + city + " " + area;
}
if(info.partnerstatus > 0){
self.isAgree = true;
console.log("强制改变当前选中状态");
}
}
);
},
data() {
return {
pageData,
///是否同意协议条款
isAgree : false,
///是否显示提交成功的界面
isShowUpload : false,
person : {
///名字
name : '',
///电话号码
phone : Player.phone,
///所在地址
address : '',
///推荐人电话
referrer : '',
},
rules : {
"person.name" : {
type: 'string',
required: true,
message : '请输入您的姓名',
validator : (object)=>{
this.person.name = object.detail.value;
}
},
'person.phone' : {
type: 'string',
required: true,
message : '请输入您的联系电话',
///校验用户是否输入了正确的手机号码
validator : (object)=>{
var suc = uni.$u.test.mobile(object.detail.value);
if(!suc){
uni.$u.toast("请输入正确的电话号码!");
3 years ago
this.person.phone = '';
}else{
this.person.phone = object.detail.value;
}
return suc;
}
},
'person.address' : {
type : 'string',
required : false,
message: '请选择您的地址',
},
'person.referrer' : {
type : 'string',
required : false,
message : '请输入推荐人电话号码',
///校验用户是否输入了正确的手机号码
validator : (object)=>{
var suc = uni.$u.test.mobile(object.detail.value);
if(!suc){
uni.$u.toast("请输入正确的电话号码!");
3 years ago
this.person.referrer = '';
}else{
this.person.referrer = object.detail.value;
}
return suc;
},
},
},
3 years ago
defaultRegion:['四川省','成都市','武侯区'],
region:[],
};
},
methods:{
onTouchBack(){
uni.navigateBack({
});
},
///点击并选择城市
onClickToSelectCity(){
uni.hideKeyboard();
},
// 获取选择的地区
handleGetRegion(region){
this.region = region;
this.person.address = this.regionName();
this.$refs.form1.validateField('person.address');
},
regionName(){
return this.region.map(item=>item.name).join(' ');
},
onChechBoxChange(e){
console.log(e);
3 years ago
this.isAgree = !this.isAgree;
},
/**
* 点击了协议字体要去看看协议内容
*/
onClickAreement(){
3 years ago
/*uni.navigateTo({
url:'/pages/Agreement/Agreement',
3 years ago
})*/
var data = getApp().globalData.agreementData;
getApp().globalData.showingSkipData = data;
uni.navigateTo({
url:'/pages/SkipView/SkipView'
})
},
showToast(content){
3 years ago
uni.$u.toast(content);
},
/**
* 点击了提交按钮
*/
async onTouchConfirm(){
if(!this.isAgree){
this.showToast('请阅读并同意协议条款');
return;
}
var name = this.person.name;
if(name == ''){
this.showToast('请输入您的名字');
return;
}
var phone = this.person.phone;
if(phone == ''){
this.showToast('请输入您的电话号码');
return;
}
var data = {
name : name,
phone : phone,
status : 0,
provincecode : 0,
citycode : 0,
areacode : 0,
province : '',
city : '',
area : '',
recommender : this.person.referrer,
};
if(this.region.length > 0){
//如果当前有地址
var p = this.region[0].name ?? '';
var c = this.region[1].name ?? '';
var a = this.region[2].name ?? '';
data['province'] = p;
data['city'] = c;
data['area'] = a;
}
console.log(data);
uni.showLoading();
var res = await post("pages/becpartner",data);
uni.hideLoading();
var out = getApp().globalData.Define.onNetMessage(res);
if(!out){
return;
}
console.log("申请结果:",out);
getApp().globalData.mainPageData.partnerstatus = 1;
this.isShowUpload = true;
},
/**
* 获取显示最上面的文字
*/
getTitleText(){
var partnerstatus = this.pageData.partnerstatus;
var str = '';
if(partnerstatus == 0){
str = '尚未申请';
}else if(partnerstatus == 1){
str = '请等待审核';
}else if(partnerstatus == 2){
str = '您已是官方合作人员';
}else{
str = '您的申请已被拒绝,请重新申请';
}
str = "个人信息 (" + str + ")";
return str;
3 years ago
},
///点击按钮,开始获取用户的手机号码
async onTouchToGetPhone(e){
var phonenumber = await this.$utils.wechatGetPlayerPhoneNumberBack(e);
if(!phonenumber){
return;
}
this.person.phone = phonenumber;
},
}
}
</script>
<style lang="scss" scoped>
3 years ago
button::after{border: none;padding: 0;}
3 years ago
.top_banner_global{
position: relative;
width: 750rpx;
height: auto;
}
.body{
width: 702rpx;
3 years ago
height: 1015rpx;
position: relative;
left: 24rpx;
right: 24rpx;
3 years ago
top: -75rpx;
background: #FFFFFF;
opacity: 1;
border-radius: 20rpx;
}
.title_text{
//width: 192rpx;
font-size: 32rpx;
font-weight: bold;
color: #333333;
opacity: 1;
margin-left: 10rpx;
}
.u-form-body{
position: relative;
width: 662rpx;
left: 20rpx;
right: 20rpx;
3 years ago
height: 910rpx;
//background-color: #1CBBB4;
border-radius: 20rpx;
3 years ago
top: 30rpx;
}
.form_input{
//background-color: #0081FF;
width: 100%;
height: 90rpx;
text-align: right;
font-size: 28rpx;
font-weight: 400;
color: #333333;
}
.form_holder{
width: 100%;
height: 90rpx;
text-align: right;
font-size: 24rpx;
font-weight: 400;
color: #999999;
margin-right: 10rpx;
}
.form_label_style{
height: 37rpx;
font-size: 26rpx;
font-weight: 400;
color: #666666;
opacity: 1;
}r
///注意事项
.attentionText{
width: 104rpx;
height: 37rpx;
font-size: 26rpx;
font-weight: 400;
color: #666666;
opacity: 1;
}
.attentionInfo{
3 years ago
//width: 648rpx;
font-size: 24rpx;
font-weight: 400;
color: #999999;
opacity: 1;
3 years ago
height: auto;
//background-color: #39B54A;
}
.label{
text-decoration: underline;
color: #39B54A;
font-size: 26rpx;
font-weight: 400;
}
.checkboxgroup{
width: 662rpx;
height: 100rpx;
//background-color: #9000FF;
position: relative;
top: 10rpx;
display: flex;
align-items: center;
flex-direction: row;
justify-content: flex-start
}
.button{
width: 702rpx;
height: 90rpx;
background: #D49B4B;
opacity: 1;
border-radius: 93rpx;
3 years ago
position: relative;
font-size: 36rpx;
font-weight: 400;
3 years ago
top: -40rpx;
color: #FFFFFF;
3 years ago
}
.phone_get_button{
width: 600rpx;
height: 110rpx;
background-color: #FFFFFF;
font-size: 28rpx;
color: #999999;
display: flex;
justify-content: flex-end;
align-items: center;
border: none;
}
.form_value{
width: 550rpx;
//height: 110rpx;
text-align: right;
//background-color: #39B54A;
font-size: 28rpx;
font-weight: 400;
color: #333333;
opacity: 1;
}
.form_box{
width: 662rpx;
height: 110rpx;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
//background-color: #0081FF;
}
.form_tile_title{
width: 170rpx;
height: 37rpx;
font-size: 26rpx;
font-weight: 500;
color: #333333;
}
</style>