<template>
    <view class="signAcontractBox column">
        <view class="signAconStepBox row-sbas-n">
            <view class="signAconStep row items-center" 
            :class="[index?'col':'',index>msg.StepNum?'active':'Highlight',]"
            v-for="(item,index) in stepList"
            :key="index">
                <view v-if="index" class="signAconStepLine"></view>
                <view class="signAconStepTextBox row items-center justify-center">
                    <view class="signAconStepN" v-if="index>msg.StepNum">{{ index+1 }}</view>
                    <view class="signAconStepTisp"></view>
                    <view class="signAconStepText">
                        <text>{{ item.Name }}</text>
                    </view>
                </view>
            </view>
        </view>
        <scroll-view :scroll-y="true"
        style="width: 100%;height: 1px;flex: 1;border-radius: 18rpx;overflow: hidden;">
            <view class="signAconForm column" v-if="msg.StepNum==0">
                <view class="signAconBox col">
                    <view class="signAconTitle">营业执照</view>
                    <view class="signAconText">拥有营业资质才能参加大红包</view>
                    <view class="signAconImg row items-center"
                    :class="[msg.BusinessLicenseUrl==''?'signAconImgYYZZ':'']">
                        <view v-if="msg.BusinessLicenseUrl==''" class="signAconImgBut">上传营业执照</view>
                        <uploadImg class="signAconUp"
                        type="1" 
                        :img="msg.BusinessLicenseUrl"
                        @onSuccess="(data)=>{onSuccess(data,1)}"
                        ></uploadImg>
                    </view>
                    <view class="line-flex">
                        <text class="SaleNameTetxL">社会信用代码</text>
                        <view class="SaleNameTetx">
                            <input v-model="msg.BusinessLicenseNumber" placeholder="请输入社会信用代码"
                            :placeholder-style="placeholderStyle"/>
                        </view>
                    </view>
                    <view class="line-flex">
                        <text class="SaleNameTetxL">公司名称</text>
                        <view class="SaleNameTetx">
                            <input v-model="msg.Tourists_Name" placeholder="请输入公司名称"
                            :placeholder-style="placeholderStyle"/>
                        </view>
                    </view>
                    <view class="line-flex">
                        <text class="SaleNameTetxL">法人名称</text>
                        <view class="SaleNameTetx">
                            <input v-model="msg.LegalPersonName" placeholder="请输入法人名称"
                            :placeholder-style="placeholderStyle"/>
                        </view>
                    </view>
                    <view class="line-flex">
                        <text class="SaleNameTetxL">经营地址</text>
                        <view class="SaleNameTetx">
                            <input v-model="msg.Tourists_Addres" placeholder="请输入经营地址"
                            :placeholder-style="placeholderStyle"/>
                        </view>
                    </view>
                    <view class="line-flex">
                        <text class="SaleNameTetxL">经营许可号</text>
                        <view class="SaleNameTetx">
                            <input v-model="msg.Tourists_Email" placeholder="请输入经营许可号"
                            :placeholder-style="placeholderStyle"/>
                        </view>
                    </view>
                    <view class="line-flex" v-if="SaleList.length>1"
                        @click="SaleList.length>1?showSalePreviwe=true:''">
                        <text class="SaleNameTetxL">服务人员</text>
                        <view class="SaleNameTetx">
                            <view>
                                <text v-if="msg.SaleName">{{ msg.SaleName }}</text>
                                <text v-else class="SNTRcolor">
                                    请选择
                                </text>
                            </view>
                            <u-icon v-if="SaleList.length>1" name="arrow-down" size="24" style="margin-left: 20rpx;"></u-icon>
                        </view>
                    </view>
                </view>
                
                <view class="row">
                    <view class="signAconNext col"
                    :class="[validate(1)?'':'active']" @click="Next(1)">
                        下一步
                    </view>
                </view>
            </view>
            <view class="signAconForm column" v-if="msg.StepNum==1">
                <view class="signAconBox col">
                    <view class="signAconTitle">法人身份证</view>
                    <view class="signAconText">请上传法人身份信息</view>
                    <view class="signAconImg signAconImgZM row items-center">
                        <view v-if="msg.LegalIdCardFrontUrl==''" class="signAconImgBut">身份证正面照</view>
                        <uploadImg class="signAconUp"
                        type="2"
                        :img="msg.LegalIdCardFrontUrl" 
                        @onSuccess="(data)=>{onSuccess(data,2)}"
                        ></uploadImg>
                    </view>
                    <view class="signAconImg signAconImgFM row items-center">
                        <view v-if="msg.LegalIdCardBackUrl==''" class="signAconImgBut">身份证背面照</view>
                        <uploadImg class="signAconUp" 
                        type="3"
                        :img="msg.LegalIdCardBackUrl"
                        @onSuccess="(data)=>{onSuccess(data,3)}"
                        ></uploadImg>
                    </view>
                    <!--
                    <view class="line-flex">
                        <text class="SaleNameTetxL">姓名</text>
                        <view class="SaleNameTetx">
                            <input v-model="msg.name" placeholder="请输入姓名"
                            :placeholder-style="placeholderStyle"/>
                        </view>
                    </view>-->
                    <view class="line-flex">
                        <text class="SaleNameTetxL">身份证号</text>
                        <view class="SaleNameTetx">
                            <input v-model="msg.LegalIdCardNumber" placeholder="请输入身份证号"
                            :placeholder-style="placeholderStyle"/>
                        </view>
                    </view>
                    <view class="line-flex" @click="showOpenTime=true">
                        <text class="SaleNameTetxL">有效期限</text>
                        <view class="SaleNameTetx">
                            <view>
                                <text v-if="msg.LegalIdCardTime">{{ msg.LegalIdCardTime }}</text>
                                <text v-else class="SNTRcolor">
                                    请选择有效期限
                                </text>
                            </view>
                        </view>
                    </view>
                    <u-picker mode="time" v-model="showOpenTime" :params="params" @confirm="confirmOpenTime"></u-picker>
                </view>
                <view class="col"></view>
                <view class="row-sbs-n">
                    <view class="signAconNext signAconNextL col" @click="Prev(0)">
                        上一步
                    </view>
                    <view class="signAconNext col"
                    :class="[validate(2)?'':'active']" @click="Next(2)">
                        下一步
                    </view>
                </view>
               
            </view>
            <view class="signAconForm signAconFormYH column" v-if="msg.StepNum==2">
                <view class="signAconBox col">
                    <view class="signAconTitle">银行账户</view>
                    <view class="signAconText" style="margin-bottom: 23rpx;">请填写能正常使用的银行账户</view>
                    <view class="line-flex">
                        <text class="SaleNameTetxL">开户行</text>
                        <view class="SaleNameTetx">
                            <input v-model="msg.OpenBankName" placeholder="请输入开户行"
                            :placeholder-style="placeholderStyle"/>
                        </view>
                    </view>
                    <view class="line-flex">
                        <text class="SaleNameTetxL">开户人</text>
                        <view class="SaleNameTetx">
                            <input v-model="msg.AccountHolder" placeholder="请输入开户人"
                            :placeholder-style="placeholderStyle"/>
                        </view>
                    </view>
                    <view class="line-flex">
                        <text class="SaleNameTetxL">银行名称</text>
                        <view class="SaleNameTetx">
                            <input v-model="msg.BankName" placeholder="请输入银行名称"
                            :placeholder-style="placeholderStyle"/>
                        </view>
                    </view>
                    <view class="line-flex">
                        <text class="SaleNameTetxL">银行账号</text>
                        <view class="SaleNameTetx">
                            <input v-model="msg.CardNum" placeholder="请输入银行账号"
                            :placeholder-style="placeholderStyle"/>
                        </view>
                    </view>
                </view>
                <view class="row-sbs-n">
                    <view class="signAconNext signAconNextL col" @click="Prev(1)">
                        上一步
                    </view>
                    <view v-if="!msg.Tourists_Sign" class="signAconNext col"
                    :class="[validate(3)?'':'active']" @click="Next(3)">
                        下一步
                    </view>
                    <view v-else class="signAconNext col"
                    :class="[validate(4)?'':'active']" @click="Next(4)">
                        下一步
                    </view>
                </view>
            </view>
            <view class="signAconForm column" v-if="msg.StepNum==3">
                <view class="signAconBox col">
                    <view class="contractTitle">大红包专案活动合作协议</view>
                    <view class="contractBox">
                        <view class="contractBj"></view>
                        <view class="contractCenter">
                            <view>甲方：四川和平国际旅行社有限公司</view>
                            <view>地址：成都市锦江区青和里南段 55 号阳光新业 2310、2311 号</view>
                            <view>经营许证号：L-SC-CJ00015</view>
                            <view>法定负责人：谢麟</view>
                            <view>乙方：{{ msg.Tourists_Name }}</view>
                            <view>经营地址：{{ msg.Tourists_Addres }}</view>
                            <view>经营许可证号：{{ msg.Tourists_Email }}</view>
                            <view>法定负责人：{{ msg.LegalPersonName }}</view>
                            <view>为加强甲乙双方紧密合作，并进一步巩固甲乙双方的合作关系，达到双方
                            互惠互利的双赢模式，甲方特推出“大红包专案活动”，具体活动时间及内
                            容如下：</view>
                            <view>1、活动时间：{{ msg.C_NightNum}}年 01 月 01 日-{{ msg.C_NightNum}} 年 12 月 31 日（报名起算）</view>
                            <view>2、活动内容：为答谢各位同行对“印象”系列产品的支持和厚爱，在同行销
                            售反点外特推出“大红包专案活动”，在“合作协议”期间内同行只要达到
                            红包申请额度即按照红包系数申请该额度红包。</view>
                            <view>3、活动要求：</view>
                            <view>3.1 所有在 {{ msg.C_NightNum}} 年 12 月 31 日前签约此协议的同行均可参加此活动，签约“合
                            作协议”即视为有效参加，并在合作协议生效后报名第一单开始计算累计销
                            售额；</view>
                            <view>3.2 此活动“印象”产品均可参加参与；
                            此“大红包专案活动”累计销售及红包计算方式如下：</view>
                            <table>
                                <th>
                                    等级
                                </th>
                                <th>
                                    达标额
                                </th>
                                <th>
                                    返佣比列
                                </th>
                                <tr v-for="(item,index) in msg.CommissionRatioList" :key="index">
                                    <td>Lv{{ index+1 }}</td>
                                    <td>¥{{ item.Money }}~{{ item.MaxMoney }}</td>
                                    <td>{{ item.Ratio }}‰</td>
                                </tr>
                            </table>
                            <view> 5、乙方累计销售金额达标即可申请大红包，由甲方审批通过后转至乙方公帐</view>
                            <view>（备注：乙方需提前向甲方出具相同金额的发票）</view>
                            <view>5.1 乙方账户信息</view>
                            <view>开户行：</view>
                            <view>帐号：</view>
                            <view>同行系统帐号：</view>
                            <view>6、此活动与“印象”其它活动互不影响，同行均可同时参加享受。</view>
                            <view>7、签订协议内容：</view>
                            <view>7.1 本协议一式两份，甲乙双方各执一份，具有同等法律效力；</view>
                            <view>7.2 本协议有效期为 {{ msg.C_NightNum}} 年 01 月 01 日-{{ msg.C_NightNum}} 年 12 月 31 日。</view>
                            <view>8、本协议需填写完整 5.1 事项内容并由甲乙双方负责人签字并加盖公章方能
                            生效；</view>
                            <view>协议中未尽事宜，双方可协商解决或签订补充协议，其效力与本协议相等。</view>
                            <view>甲方：四川和平国际旅行社有限公司</view>
                            <view>法定代表人(或授权代表)：谢麟</view>
                            <view>乙方：{{ msg.Tourists_Name }}</view>
                            <view>法定代表人(或授权代表)：{{ msg.LegalPersonName }}</view>
                        </view>
                        <view class="contractTisp" @click="getUrl(1)">
                            <view>请仔细阅读条款</view>
                            <view>
                                <image style="width: 24rpx;height: 27rpx;margin-top: 20rpx;" src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Upload/Goods/638797066116118344.png"/>    
                            </view>
                        </view>
                    </view>
                    <view class="contractSign row justify-center" @click="getUrl(2)">
                            <view>签字确认</view>
                    </view>
                </view>
                <view class="row-sbs-n">
                    <view v-if="msg.StepNum<4&&!loading" class="signAconNext signAconNextL col" @click="Prev(2)">
                        上一步
                    </view>
                    <!--
                    <view class="signAconNext col active" @click="Next(4)">
                        下一步
                    </view>-->
                    <!--
                    <view class="signAconNext col"
                    :class="[msg.StepNum==4||loading?'':'active']" @click="Next(4)">
                        签字
                    </view>-->
                </view>
                
            </view>
            <view class="signAconForm column" v-if="msg.StepNum==4">
                <view class="signAconBox column col">
                    <view class="column justify-center col">
                        <image class="contractImg" src="https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Upload/Goods/638797058914190239.png"></image>
                        <view class="contractSText">已签字</view>
                    </view>
                    <view class="contractSign row justify-center">
                        <view @click="getUrl(2)">重新签字</view>
                        <view style="margin-left: 50rpx;"  @click="getUrl(3)">查看条款</view>
                    </view>
                </view>
                <view class="row-sbs-n">
                    <view v-if="msg.Tourists_Sign&&!loading" class="signAconNext signAconNextL col" @click="Prev(2)">
                        上一步
                    </view>
                    <view v-if="!msg.Tourists_Sign&&msg.StepNum<5&&!loading" class="signAconNext signAconNextL col" @click="Prev(3)">
                        上一步
                    </view>
                    <view class="signAconNext col"
                    :class="[msg.StepNum==5||loading?'':'active']" @click="Next(5)">
                        提交
                    </view>
                </view>
            </view>
        </scroll-view>
        <u-popup v-model="showSalePreviwe" mode="bottom" 
        border-radius="50" length="60%" 
        :safe-area-inset-bottom="true">
            <serviceStaff :msg="msg" :list="SaleList" @goReserce="goReserce"></serviceStaff>
        </u-popup>
        <auth v-if="showAuth&&is_show_auth==1" @changeuserinfo="reloadUserinfo" @gbAuth="gbAuth"></auth>
    </view>
</template>
<script>
import auth from "@/components/auth/index.vue";
import serviceStaff from "@/components/serviceStaff/index";
import uploadImg from "./components/upload";
export default {
    components: {
        auth,
        serviceStaff,
        uploadImg
    },
    data() {
        return {
            SaleList: [],
            msg: {
                SaleName: '',
                SaleId: 0,
                Id: 0,
                EnterId: 0,//	销售
                Tourists_Addres:'',//	经营地址
                StepNum: 0,//	当前步骤信息 一共4步1-营业执照，2-法人信息3-账户信息4-合同
                BusinessLicenseUrl:'',//	营业执照图片
                BusinessLicenseNumber:'',//	社会信用代码
                Tourists_Email:'',//	经营许可证号		
                Tourists_Name:'',//	公司名称
                LegalPersonName:'',//	法人姓名
                LegalIdCardFrontUrl:'',//	身份证正面		
                LegalIdCardBackUrl:'',//	身份证反面		
                LegalIdCardNumber:'',//	身份证号		
                LegalIdCardTime:'',//	身份证有效期		
                OpenBankName:'',//	开户支行
                BankName:'',//	所属银行
                CardNum:'',//	卡号
                AccountHolder:'',//	开户人
                ContractId:'',//	合同id		
                Tourists_Sign:'',//	签名		
                C_StartDate:'',//	合同开始时间		
                C_EndDate:'',//	合同结束时间
            },
            oldMsg: null,
            showSalePreviwe: false,
            showAuth: false,
            stepList:[
                {Name:'营业执照',Id:1},
                {Name:'法人身份证',Id:2},
                {Name:'银行账户',Id:3},
                {Name:'线上签约',Id:4},
            ],
            U:{},
            b2bUser:{},
            is_show_auth: 0,
            showOpenTime: false,
            params: {
                year: true,
                month: true,
                day: true,
                hour: false,
                minute: false,
                second: false
            },
            placeholderStyle: "color: #DBE0EC",
            loading: false,
            IsRenewalContract: 0,
            ContractId: 0,
            dataInfo: null,
            isSign: false,
        }
    },
    onLoad(options) {
        // 1是新增合同
        if(options.IsRenewalContract) {
            this.IsRenewalContract = options.IsRenewalContract
        }
        // 合同id
        if(options.ContractId) {
            this.ContractId = options.ContractId
        }
        // 已完成签名
        if(options.isSign) {
            this.isSign = options.isSign
        }
    },
    onShow() {
        this.U = uni.getStorageSync("mall_UserInfo");
        this.b2bUser = uni.getStorageSync("b2b_user");
        let basedata = uni.getStorageSync("basedata");
        //判断后台是否开启自动授权
        if (basedata && basedata.mall
        && basedata.mall.setting 
        && basedata.mall.setting.is_show_auth ==1) {
            this.is_show_auth = 1;
        }

        if (!this.U) {
            this.U = {
                nickName: "未登录",
                avatarUrl: "",
            };
            this.showAuth = true;
        } else if (!this.b2bUser && this.is_show_auth == 1) {
            this.U = {
                nickName: "未登录",
                avatarUrl: "",
            };
            this.showAuth = true;
        }
    },
    mounted() {
        this.getSale()
    },
    methods: {
        Prev(type){
            this.msg.StepNum = type
        },
        getUrl(type) {
            if(!this.msg.ContractId) this.setInfor(4)
            else this.goWebUrl(type)
        },
        goWebUrl(type){
            let url = ""
            let msg = JSON.stringify({ContractId:this.msg.ContractId})
            if(type==1) url = `https://activity.oytour.com/html/contract/index.html?msg=${encodeURIComponent(msg)}`
            if(type==2) url = `https://activity.oytour.com/html/contract/sign.html?msg=${encodeURIComponent(msg)}`
            if(type==3) url = `https://activity.oytour.com/html/contract/index.html?ContractId=${this.msg.ContractId}`
            if(process.env.NODE_ENV=="development") return console.log(url,"-----url")
            if (url && url.length > 0) {
                if(type==1||type==3){
                    uni.navigateTo({
                        url: "/pages/webbox/webbox?u=" + encodeURIComponent(url),
                    });
                }else if(type==2){
                    uni.navigateTo({
                        url: "/pages/webbox/webbox?u=" + encodeURIComponent(url),
                    }); 
                }
            }
        },
        confirmOpenTime(r){
            this.msg.LegalIdCardTime=r.year+"-"+r.month+"-"+r.day
        }, 
        newMsg(type){
            let msg = ''
            if(type==1){
                if(this.msg.BusinessLicenseUrl!=this.oldMsg.BusinessLicenseUrl){
                    msg = '营业执照变更'
                } else if(this.msg.BusinessLicenseNumber!=this.oldMsg.BusinessLicenseNumber){
                    msg = '社会信用代码变更'
                } else if(this.msg.LegalPersonName!=this.oldMsg.LegalPersonName){
                   msg = '法人姓名变更'
                } else if(this.msg.Tourists_Name!=this.oldMsg.Tourists_Name){
                   msg = '公司名称变更'
                } else if(this.msg.Tourists_Addres!=this.oldMsg.Tourists_Addres){
                   msg = '经营地址变更'
                } else if(this.msg.EnterId!=this.oldMsg.EnterId){
                    msg = '服务人员变更'
                } else if(this.msg.Tourists_Email!=this.oldMsg.Tourists_Email){
                    msg = '经营许可证号变更'
                }  
            }else if(type==2){
                if(this.msg.LegalIdCardFrontUrl!=this.oldMsg.LegalIdCardFrontUrl){
                    msg = '身份证正面变更'
                } else if(this.msg.LegalIdCardBackUrl!=this.oldMsg.LegalIdCardBackUrl){
                    msg = '身份证反面变更'
                } else if(this.msg.LegalIdCardNumber!=this.oldMsg.LegalIdCardNumber){
                    msg = '身份证号变更'
                } else if(this.msg.LegalIdCardTime!=this.oldMsg.LegalIdCardTime){
                    msg = '身份证有效期变更'
                }
            }else if(type==3){
                if(this.msg.BankName!=this.oldMsg.BankName){
                    msg = '银行名称变更'
                } else if(this.msg.OpenBankName!=this.oldMsg.OpenBankName){
                    msg = '开户行变更'
                } else if(this.msg.AccountHolder!=this.oldMsg.AccountHolder){
                    msg = '开户人变更'
                } else if(this.msg.CardNum!=this.oldMsg.CardNum){
                    msg = '银行账户变更'
                }
            }else if(type==5){
                if(this.isSign){
                    msg = '签字确认变更'
                }
            }
            return msg
        },
        validate(type){ 
            let msg = ''
            if(type==1){
                if(this.msg.BusinessLicenseUrl==''){
                    msg = '请上传营业执照'
                } else if(this.msg.BusinessLicenseNumber==''){
                    msg = '请输入社会信用代码'
                } else if(this.msg.LegalPersonName==''){
                   msg = '请输入法人姓名'
                } else if(this.msg.Tourists_Name==''){
                   msg = '请输入公司名称'
                } else if(this.msg.Tourists_Addres==''){
                   msg = '请输入经营地址'
                } else if(!this.msg.EnterId){
                    msg = '请选择服务人员'
                } 
            }else if(type==2){
                if(this.msg.LegalIdCardFrontUrl==''){
                    msg = '请上传身份证正面'
                } else if(this.msg.LegalIdCardBackUrl==''){
                    msg = '请上传身份证反面'
                } else if(this.msg.LegalIdCardNumber==''){
                    msg = '请输入身份证号'
                } else if(this.msg.LegalIdCardTime==''){
                    msg = '请选择身份证有效期'
                }
            }else if(type==3){
                if(this.msg.BankName==''){
                    msg = '请输入银行名称'
                } else if(this.msg.OpenBankName==''){
                    msg = '请输入开户行'
                } else if(this.msg.AccountHolder==''){
                    msg = '请输入开户人'
                } else if(this.msg.CardNum==''){
                    msg = '请输入银行账户'
                }
            }else if(type==5){
                if(!this.msg.Tourists_Sign||this.msg.Tourists_Sign==''){
                    msg = '请仔细阅读条款，并签字确认'
                }
            }
            return msg
        },
        Next(type){
            const error = this.validate(type)
            if(error!=''){
                uni.showToast({
                    icon:'none',
                    title:error
                })
                return
            }
            // if(this.msg.StepNum==4) return this.goWebUrl(1)
            const oldData = this.newMsg(type)
            console.log(oldData,'--------',type,!oldData)
            // return
            if(oldData) this.setInfor(type)
            else if(this.ContractId||type==5) this.setInfor(type)
            else if(type!=5) {
                this.msg.StepNum = type
            }
        },
        onSuccess(data,type) {
            if(type==1) {
                this.msg.BusinessLicenseUrl = data.BusinessLicense;
                this.msg.BusinessLicenseNumber = data.UnifiedCode;
                this.msg.LegalPersonName = data.LegalPerson
                this.msg.Tourists_Name = data.CompanyName
                this.msg.Tourists_Addres = data.Addres
            }else if(type==2){
                this.msg.LegalIdCardFrontUrl = data.BusinessLicense;
                if(data.LegalIdCardNumber) this.msg.LegalIdCardNumber = data.LegalIdCardNumber
            }else if(type==3){
                this.msg.LegalIdCardBackUrl = data.BusinessLicense;
                if(data.LegalIdCardTime) this.msg.LegalIdCardTime = data.LegalIdCardTime
            }
        },
        setInfor(type){
            if(this.loading) return
            uni.showLoading({
                title: '提交中...',
                mask: true 
            })
            this.loading = true;
            let msg = JSON.parse(JSON.stringify(this.msg))
            msg.StepNum = type
            this.apipost('app_customer_SetAuthentication',msg,res=>{
                if (res.resultCode == 1) {
                    console.log(res,'--------提交')
                    uni.hideLoading()
                    this.loading = false
                    if(type==4&&this.msg.Tourists_Sign) this.msg.StepNum = 4
                    else if(type<4)this.msg.StepNum = type
                    else if(type==4&&this.msg.Tourists_Sign==''){
                        this.msg.ContractId = res.data.ContractId
                        this.goWebUrl(2)
                    }else if(type==5){
                        uni.redirectTo({
                            url: `/pages/bigredrnvelope/list`
                        })
                    }
                }
            },err=>{
                uni.hideLoading()
                this.loading = false
                uni.showToast({
                    title:err.message,
                    icon:'none' 
                })
            })
        },
        goReserce(item){
            this.msg.SaleName = this.msg.EnterName = item.SaleName
            this.msg.SaleId = this.msg.EnterId = item.SaleId
            this.showSalePreviwe = false; 
        },
        getSale(){
            this.apipost(
                "b2b_get_GetCustomerCreateByList",
                {
                    CustomerId: this.b2bUser.customerId
                },
                (res) => {
                    if (res.resultCode == 1) {
                        if(res.data.length>0){
                            this.SaleList = res.data
                            if(res.data.length==1){
                                this.msg.SaleName = res.data[0].EmName
                                this.msg.SaleId = this.msg.EnterId = res.data[0].CreateBy
                            }
                        }else{
                            this.msg.SaleName = ''
                            this.msg.SaleId = this.msg.EnterId = 0
                        }
                        this.getInfor()
                        
                    }
                },
                (err) => {
                    
                }
            );
        }, 
        getInfor(){
            uni.showLoading({
                title: '加载中',
                mask: true
            })
            this.apipost('app_customer_GetAuthenticationDetails',{
                CustomerInfoChildrenId: this.b2bUser.customerInfoChildrenId
            },
            res=>{
                if (res.resultCode == 1) {
                    let data = res.data
                    this.dataInfo = res.data
                    this.msg = {
                        SaleName: data.EnterName,
                        SaleId: data.EnterId,

                        Id: data.Id,//	主键ID
                        EnterName: data.EnterName,//	服务人员姓名
                        EnterId: data.EnterId,//	销售
                        Tourists_Addres:data.Tourists_Addres,//	经营地址
                        StepNum: data.StepNum,//	当前步骤信息 一共4步1-营业执照，2-法人信息3-账户信息4-合同
                        BusinessLicenseUrl:data.BusinessLicenseUrl,//	营业执照图片
                        BusinessLicenseNumber:data.BusinessLicenseNumber,//	社会信用代码
                        LegalPersonName:data.LegalPersonName,//	法人姓名
                        LegalIdCardFrontUrl:data.LegalIdCardFrontUrl,//	身份证正面		
                        LegalIdCardBackUrl:data.LegalIdCardBackUrl,//	身份证反面		
                        LegalIdCardNumber:data.LegalIdCardNumber,//	身份证号		
                        LegalIdCardTime:data.LegalIdCardTime,//	身份证有效期		
                        Tourists_Email:data.Tourists_Email,//	经营许可证号		
                        Tourists_Name:data.Tourists_Name,//	公司名称
                        OpenBankName:data.OpenBankName,//	开户支行
                        BankName:data.BankName,//	所属银行
                        CardNum:data.CardNum,//	卡号
                        AccountHolder:data.AccountHolder,//	开户人
                        ContractId:data.ContractId,//	合同id		
                        Tourists_Sign:data.Tourists_Sign?data.Tourists_Sign:'',//	签名		
                        C_StartDate:data.RenewalContractStime,//	合同开始时间		
                        C_EndDate:data.RenewalContractEtime,//	合同结束时间
                    }
                    if(this.IsRenewalContract||this.ContractId){
                        if(this.isSign&&this.ContractId>0){
                            this.msg.StepNum = 4
                        }
                        // else this.msg.StepNum = 0
                        // if(this.IsRenewalContract==1) this.msg.ContractId = 0
                        
                        if(this.ContractId) {
                            this.msg.ContractId = this.ContractId
                            let ContractList = data.ContractList.filter(x=>{
                                return x.ContractId==this.ContractId
                            })
                            if(ContractList.length>0) {
                                this.msg.C_StartDate = ContractList[0].StartTime
                                this.msg.C_EndDate = ContractList[0].EndTime
                                this.msg.Tourists_Sign = ContractList[0].Tourists_Sign
                                if(this.msg.Tourists_Sign){
                                    this.msg.StepNum = 4
                                }else this.msg.StepNum = 3
                            }else{
                                this.msg.StepNum = 0
                            }
                            console.log(ContractList,'--------')
                        }
                    }
                   
                    this.oldMsg = JSON.parse(JSON.stringify(this.msg))
                    uni.hideLoading()
                }
            },err=>{
                uni.hideLoading()
            })
        },
       
        reloadUserinfo() {
            const pages = getCurrentPages()
            const curPage = pages[pages.length-1]
            curPage.onLoad(curPage.options)
            curPage.onShow()
            curPage.onReady()
        },
        //关闭登录窗口
        gbAuth() {
            this.showAuth = false;
        },
        
    }
}
</script>
<style lang="scss" scoped>
@import url("@/asset/css/flex.css");
.signAcontractBox{
    height: 100vh;
    background: -webkit-gradient(linear, 0 0, 0 100%, from(#E6F1FF), to(#F5F7FA));
}
.line-flex {
    display: flex;
    align-items: center;
    border-radius: 18rpx;
    padding: 34rpx 0; 
    background: #fff;
    font-size: 32rpx;
}
.SaleNameTetxL{
    width: 200rpx;
}
.signAconFormYH .SaleNameTetxL{
    width: 150rpx;
}
.SaleNameTetx{
    width: 1px;
    flex: 1;
    display: flex;
    text-align: right;
}
.SaleNameTetx input,.SaleNameTetx view{
    width: 100%;
}
.SNTRcolor{
    color: #DBE0EC
}
.signAconStepBox{
    padding: 50rpx 70rpx;
    margin-bottom: 50rpx;
}
.signAconStep{
    
}
.signAconStepLine{
    width: 1px;
    flex: 1;
    height: 10rpx;
    border-radius: 5rpx;
    background: #D0E3FA;
}
.signAconStepLine text{
    opacity: 0;
}
.signAconStepTextBox{
    width: 50rpx;
    height: 50rpx;
    border-radius: 50%;
    background: #C7E4FE;
    position: relative;
    margin: 0 19rpx;
}
.signAconStep:first-child .signAconStepTextBox{
    margin-left: 0;
}
.signAconStep:last-child .signAconStepTextBox{
    margin-right: 0;
}
.signAconStep.active .signAconStepTextBox{
    width: 42rpx;
    height: 42rpx;
    background: #7686A3;
}

.signAconStepN{
    text-align: center;
    font-size: 26rpx;
    line-height: 40rpx;
    color: #fff;
}
.signAconStepTisp{
    width: 24rpx;
    height: 24rpx;
    border-radius: 50%;
    background: #0198FF;
}
.signAconStep.active .signAconStepTisp{
    display: none;
}
.signAconStepText{
    position: absolute;
    // left: 0;
    // right: 0;
    width: 150rpx;
    left: -48rpx;
    top: 70rpx;
    text-align: center;
    color: #7686A3;
}
.signAconStep.Highlight .signAconStepText{
    color: #080A0A;
}
.signAconBox{
    background: #fff;
    border-radius: 20rpx;
    padding: 50rpx 43rpx 43rpx 43rpx;
    margin: 0 30rpx;
}
.signAconTitle{
    font-size: 38rpx;
    font-weight: 800;
}
.signAconText{
    font-size: 28rpx;
    color: #7686A3;
    font-weight: 500;
    margin-top: 10rpx;
    margin-bottom: 40rpx;
}
.signAconImg{
    width: 100%;
    height: 379rpx;
    border-radius:20rpx;
    position: relative;
    overflow: hidden;
    margin-bottom: 20rpx;
    background: #F3F5F9;
}
.signAconImg.signAconImgYYZZ{
    background: url('https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Upload/Goods/638796480136781668.png')no-repeat;
    background-size: 100% 100%;
}
.signAconImg.signAconImgZM{
    background: url('https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Upload/Goods/638796488684549758.png')no-repeat;
    background-size: 100% 100%;
}
.signAconImg.signAconImgFM{
    background: url('https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Upload/Goods/638796488731800731.png')no-repeat;
    background-size: 100% 100%;
    margin-top: 42rpx;
    margin-bottom: 22rpx;
}
.signAconImg image{
    width: 100%;
    height: 100%;
}
.signAconImgBut{
    border-radius: 50rpx;
    border: 1rpx solid #0399FF;
    color: #0399FF;
    background: #F3F5F9;
    font-size: 32rpx;
    font-weight: 800;
    margin: auto;
    line-height: 80rpx;
    padding: 0 31rpx;
}
.signAconUp{
    width: 100%;
    height: 100%;
    position: absolute;
}
.signAconNext{
    border-radius: 10rpx;
    background: #AAD7F7;
    margin: 0 30rpx;
    line-height: 85rpx;
    text-align: center;
    color: #fff;
    margin-top: 65rpx;
    margin-bottom: 100rpx;
}
.signAconNext.active{
    background: #0399FF;
    border: 2rpx solid #0399FF;
}
.signAconNext.signAconNextL{
    border: 2rpx solid #0399FF;
    background: #fff;
    color: #0198FF;
    margin-right: 40rpx;
}
/deep/.signAconUp .u-upload{
    height: 100%;
}
/deep/.signAconUp .u-preview-wrap{
    border: 0;
}
/deep/.signAconUp .u-list-item{
    margin: 0;
}
/deep/.signAconUp .u-preview-image{
    width: 100% !important;
    height: 100% !important;
}
/deep/.signAconUp .u-preview-wrap{
    width: 100% !important;
    height: 100% !important;
}
.signAconForm{
    height: 100%;
}
.contractTitle{
    font-weight: 500;
    font-size: 38rpx;
    color: #080A09;
    text-align: center;
    margin-bottom: 55rpx;
}
.contractBox{
    height: 712rpx;
    background: #F3F5F9;
    padding: 51rpx 38rpx 80rpx 38rpx;
    border-radius: 20rpx;
    position: relative;
    overflow: hidden;
}
.contractCenter{
    height: 100%;
    overflow: hidden;
    font-weight: 500;
    font-size: 28rpx;
    color: #647AA0;
    line-height: 46rpx;
}
.contractBj{
    height: 145rpx;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    background: #FFFFFF;
    border-radius: 0rpx 0rpx 20rpx 20rpx;
    opacity: 0.7;
}
.contractTisp{
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    text-align: center;
    padding-bottom: 19rpx;
}
.contractTisp view{
    font-weight: 800;
    font-size: 32rpx;
    color: #0198FF;
}
.contractTisp view:first-child{
    
}
.contractSign{
    padding-top: 44rpx;
    padding-bottom: 22rpx;
}
.contractSign view{
    padding: 18rpx 63rpx;
    background: #F3F5F9;
    border-radius: 40rpx;
    border: 2rpx solid #0198FF;
    font-weight: 800;
    font-size: 32rpx;
    color: #0198FF;
}
.contractImg{
    width: 228rpx;
    height: 242rpx;
    margin: 0 auto 52rpx;
}
.contractSText{
    font-weight: 800;
    font-size: 42rpx;
    color: #080A0A;
    text-align: center;
}
</style>
