# coding:utf-8
from selenium import webdriver
import random
from commonConfig.testDate import enterInfo as i
from commonConfig.testDate import orgInfo as e
from common.base import Base
from pykeyboard import PyKeyboard
from selenium.webdriver.support.select import Select
import pyperclip as p
k = PyKeyboard()
import time
import random
class bath(Base):

    # common path
    picturePath = ("1.jpg")
    picture_01 = (u"\"合同照片1\" \"合同照片2\" \"合同照片3\" \"合同照片4\" \"合同照片5\" \"合同照片6\" \"合同照片7\" \"合同照片8\" \"合同照片9\"")
    picture_02 = (u"\"水电单照片1\" \"水电单照片2\" \"水电单照片3\" \"水电单照片4\" \"水电单照片5\" \"水电单照片6\" \"水电单照片7\" \"水电单照片8\" \"水电单照片9\"")
    picture_03 = (u"\"门店照片1\" \"门店照片2\" \"门店照片3\" \"门店照片4\" \"门店照片5\" \"门店照片6\" \"门店照片7\" \"门店照片8\" \"门店照片9\"")
    picture_04 = (u"1561341162079_货物保险合同")
    picture_05 = (u"1561341182303_蜂之翼（北京）国际物流有限公司介绍")
    picture_06 = (u"1561341269779_蜂之翼30台车行驶证")
    picture_07 = (u"蜂之翼（北京）国际物流有限公司 流水")
    picture_08 = (u"蜂之翼（北京）国际物流有限公司 企业征信.pdf")
    rarPath = ("abc1234.zip")
    Date = ("xpath", "//*[@placeholder= '选择日期']")
    today = ("xpath","//*[@class='el-date-table']/tbody/tr/td[@class='available today']")
    checkAll = ("xpath","//*[@class = 'l-filter-bottom']/div[1]/label/span[1]")
    bottomButton_1 = ("xpath", "//*[@class = 'l-filter-bottom']/div[1]/button[1]")
    bottomButton_2 = ("xpath", "//*[@class = 'l-filter-bottom']/div[1]/button[2]")
    bottomButton_3 = ("xpath", "//*[@class = 'l-filter-bottom']/div[1]/button[3]")
    bottomButton_4 = ("xpath", "//*[@class = 'l-filter-bottom']/div[1]/button[4]")
    bottomButton_5 = ("xpath", "//*[@class = 'l-filter-bottom']/div[1]/button[5]")

    l_zoom_01 = ("xpath","//*[@class='_hd l-border-b']/following-sibling::div[1]/ul/li[10]")
    l_zoom_02 = ("xpath","//*[@class='_hd l-border-b']/following-sibling::div[1]/ul/li[11]")
    l_zoom_03 = ("xpath","//*[@class='_hd l-border-b']/following-sibling::div[1]/ul/li[12]")
    l_zoom_04 = ("xpath","//*[@class='_hd l-border-b']/following-sibling::div[1]/ul/li[13]")
    l_zoom_05 = ("xpath","//*[@class='_hd l-border-b']/following-sibling::div[1]/ul/li[14]")
    l_zoom_06 = ("xpath","//*[@class='_hd l-border-b']/following-sibling::div[1]/ul/li[15]")
    l_zoom_07 = ("xpath","//*[@class='_hd l-border-b']/following-sibling::div[1]/ul/li[16]")

    uploadAccessory = ("xpath","//span[@class='l-txt-link']")

    # drop locator path
    drop = ("xpath","//*[@class='el-icon-caret-bottom']")
    dropDownList = ("xpath","//*[@class='el-dropdown-menu el-popper']/li[2]")

    # detail locator path
    loanMenu = ("xpath","//*[contains(text(),'垫资代采管理')]")
    module = ("xpath","/html/body/div/section/section/aside/div[1]/div/ul/li[3]/ul/li[2]")
    moduleShop = ("xpath","/html/body/div/section/section/aside/div[1]/div/ul/li[2]/ul/li[2]")
    orderDetailButton = ("xpath","/html/body/div/section/section/main/section/main/div/div[4]/div[2]/table/tbody/tr[1]/td[10]/div/button/span")
    orderDetailButton2 = ("xpath","/html/body/div/section/section/main/section/main/div/div[4]/div[2]/table/tbody/tr[1]/td[9]/div/button/span")
    orgDetailButton = ("xpath","/html/body/div/section/section/main/section/main/div/div[4]/div[2]/table/tbody/tr[1]/td[16]/div/button")
    # verify locator path
    successButton = ("xpath","//*[@class='el-button el-button--success el-button--small']")
    rate = ("xpath","//*[@class='el-form el-form--label-top el-form--inline']/div[1]/div/div/input")
    day = ("xpath","//*[@class='el-form el-form--label-top el-form--inline']/div[2]/div/div/input")
    remark = ("xpath","//*[@placeholder='在此输入审核意见...']")
    remarkUpload = ("xpath","//*[@class='l-textarea']/div/div/div")
    reSuccessButton = ("xpath","//*[@aria-label='审核通过']/div[3]/span/button[2]")

    # h5 locator path
    h5List_B2 = ("xpath","//*[@class='l-margin-b']/div[6]/div[1]/i")
    h5List_Org = ("xpath","//*[@class='l-margin-b']/div[2]/div[1]/i")
    h5List_AllowCar = ("xpath","//*[@class='l-margin-b']/div[6]/div[3]/i")
    h5VerifyLoanList = ("xpath","//*[@class='l-margin-b']/div[6]/div[2]/i")
    h5Detail = ("xpath","//*[@class = 'l-page-scroll']/div[3]/div[1]/i")
    h5All = ("xpath","//*[@class = 'l-fixed-bottom']/div/div/div")
    h5VerifyButton = ("xpath","//*[@class = 'van-button van-button--primary van-button--small']")
    h5VerifyLoanButton = ("xpath","//*[@class = 'van-button van-button--primary van-button--large']")
    h5Sms = ("xpath","//*[@placeholder= '请输入授权验证码']")
    h5Remark = ("xpath","//*[@placeholder = '请输入审核意见']")
    h5Submit = ("xpath","//*[@id='app']/div[1]/div[3]/div[3]/button[2]")
    h5logout_0 = ("xpath","//*[@style='z-index: 1;']/div[3]")
    h5logout_1 = ("xpath","//*[@class='l-icon _exit']")
    h5logout_2 = ("xpath","//*[@class='van-button van-button--default van-button--large van-dialog__confirm van-hairline--left']")

    # sign locator path
    c1Sign = ("xpath","//*[@class='l-contract-list']/div[1]/p/a[3]")
    b1Sign = ("xpath","//*[@class='l-contract-list']/div[2]/p/a[3]")
    c2Sign = ("xpath","//*[@class='l-panel-item l-margin-t l-zoom']/div[2]/div[1]/p/a[3]")
    c3Sign = ("xpath","//*[@class='l-panel-item l-margin-t l-zoom']/div[2]/div[2]/p/a[3]")
    c3_1Sign = ("xpath","//*[@class='l-panel-item l-margin-t l-zoom']/div[2]/div[3]/p/a[3]")
    c1SignShop = ("xpath","//*[@class='l-contract-list']/div[1]/p/a[2]")
    b1SignShop = ("xpath","//*[@class='l-contract-list']/div[2]/p/a[2]")
    c2SignShop = ("xpath","//*[@class='l-panel-item l-margin-t l-zoom']/div[2]/div[1]/p/a[2]")
    c3SignShop = ("xpath","//*[@class='l-panel-item l-margin-t l-zoom']/div[2]/div[2]/p/a[2]")
    c3_1SignShop = ("xpath","//*[@class='l-panel-item l-margin-t l-zoom']/div[2]/div[3]/p/a[2]")
    firstDrag = ("xpath","//*[@id='signpanel']/div/img")
    lastDrag = ("xpath","//*[@id='container']/div[1]")
    signSubmit = ("xpath","//*[@id='confirmSubmit']")
    smsVal = ("xpath","//*[@id='smsval']")
    smsPanel = ("xpath","//*[@id=\"smspanel\"]/div/div/div/a[1]")

    # logistics&settlement locator path
    logisticsName = ("xpath","//*[@placeholder= '如中汽物流']")
    logisticsNumber = ("xpath","//*[@placeholder= '如粤B88888']")
    logisticsUserName = ("xpath","//*[@placeholder= '请输入提车人姓名']")
    logisticsPhone = ("xpath","//*[@aria-label='录入物流信息']/div[2]/div/form/div[6]/div/div[1]/input")
    logisticsIdCard = ("xpath","//*[@aria-label='录入物流信息']/div[2]/div/form/div[7]/div/div[1]/input")
    logisticsSubmit = ("xpath", "//*[@aria-label='录入物流信息']/div[3]/span/button[2]")
    settlementUserName = ("xpath", "//*[@placeholder= '请输入提车人姓名']")
    settlementPhone =("xpath","//*[@aria-label='申请结算']/div[2]/div/form/div[4]/div/div[1]/input")
    settlementIdCard =("xpath","//*[@aria-label='申请结算']/div[2]/div/form/div[3]/div/div[1]/input")
    settlementIdCardOn = ("xpath","//*[@for='picker.idCardOn']/following-sibling::div/div[1]/div/div/div/div/div[2]/a")
    settlementIdCardOff = ("xpath","//*[@for='picker.idCardOn']/following-sibling::div/div[2]/div/div/div/div/div[2]/a")
    settlementSubmit = ("xpath", "//*[@aria-label='申请结算']/div[3]/span/button[2]")
    settlementOtherFee = ("xpath","//*[@class='el-form el-form--label-top el-form--inline']/div[2]/div/div/input")
    settlementReduceFee = ("xpath","//*[@class='el-form el-form--label-top el-form--inline']/div[3]/div/div/input")
    settlementSubmit_1 = ("xpath", "//*[@aria-label='业务支持审核结算申请']/div[3]/div/button[2]")
    settlementSubmit_2 = ("xpath", "//*[@aria-label='运营总监审核减免申请']/div[3]/div/button[2]")
    settlementSubmit_3 = ("xpath", "//*[@aria-label='财务确认结算金额']/div[3]/div/button[2]")
    settlementSubmit_4 = ("xpath", "//*[@aria-label='财务确认收到回款']/div[3]/div/button[2]")
    settlement_VerifyButton = ("xpath","//*[@class='el-button el-button--success el-button--mini']")




    # validateCar path
    validateCar_1 = ("xpath","/html/body/div/section/section/main/section/main/div[2]/div[3]/div[1]/div[4]/div[2]/table/tbody/tr[1]/td[13]/div/span[2]/button")
    validateCar_2 = ("xpath","/html/body/div/section/section/main/section/main/div[2]/div[3]/div[1]/div[4]/div[2]/table/tbody/tr[2]/td[13]/div/span[2]/button")
    uploadPicture = ("xpath","//*[@class ='_btn-plus l-flex-vhc']")
    validateCarSubmit = ("xpath","//*[@aria-label='录入验车信息']/div[3]/span/button[2]")

    # checkCar path
    checkCarSubmit = ("xpath","/html/body/div[1]/section/section/main/section/main/div[6]/div/div[3]/span/button[2]")

    # verifyTicket path
    verifyTicketSubmit = ("xpath","//*[@aria-label='确认收齐票证']/div[3]/span/button[2]")

    #confirmLoan path
    confirmLoanSubmit = ("xpath","//*[@aria-label='确认已放款']/div[3]/span/button[2]")

    # org path
    orgMenubarAdmin = ("xpath","//*[contains(text(),'门店入网管理')]")
    orgMenubarShop= ("xpath","//*[@role= 'menubar']/li[3]")
    addOrgButton = ("xpath","//button[@class='el-button el-button--success el-button--small']")
    clerk = ("xpath","//*[@placeholder='请选择']")
    clerkName = ("xpath","//*[@class='el-scrollbar__view el-select-dropdown__list']/li[2]")
    account = ("xpath","//*[@placeholder='请输入常用的手机号码']")
    orgName = ("xpath","//*[@placeholder='请严格填写营业执照上的公司全称']")
    orgLicenseCode = ("xpath","//*[@placeholder='请输入公司工商号']")
    orgProvinces = ("xpath","//*[@class='el-cascader__label']")
    Province = ("xpath","//*[@x-placement='bottom-start']/ul[1]/li[1]")
    city = ("xpath", "//*[@x-placement='bottom-start']/ul[2]/li[1]")
    area = ("xpath", "//*[@x-placement='bottom-start']/ul[3]/li[1]")
    orgAddress = ("xpath","//*[@placeholder='请输入详细地址（街道、门牌号等）']")
    orgAccount = ("xpath","//*[@placeholder='请输入公司对公银行账号']")
    orgBankBranch = ("xpath","//*[@placeholder='如：中国工商银行深圳生态园支行']")
    orgLicense = ("xpath","/html/body/div/section/section/main/section/main/form/div[1]/div[2]/div[3]/div[1]/div[1]/div/div/div/div/div/div/div[2]/a")
    orgImage = ("xpath","//*[@for='image']/following-sibling::div/div/div/div/div/div/div[2]/a")
    orgImg = ("xpath","/html/body/div/section/section/main/section/main/form/div[1]/div[2]/div[3]/div[1]/div[3]/div/div/div/div/div/div/div[2]/a")
    securities = ("xpath","//*[@for='securities']/following-sibling::div/div/div/div/div/div/div[2]/a")
    payroll = ("xpath","//*[@for='payroll']/following-sibling::div/div/div/div/div/i")
    orgCorporation = ("xpath","//*[@for='corporation']/following-sibling::div/div[1]/input")
    orgPhone = ("xpath","//*[@for='phone']/following-sibling::div/div[1]/input")
    orgIdCard = ("xpath","//*[@for='idCard']/following-sibling::div/div[1]/input")
    orgEmail = ("xpath","//*[@for='email']/following-sibling::div/div[1]/input")
    orgIdCardOn = ("xpath","//*[@for='idCardOn']/following-sibling::div/div[1]/div/div/div/div/div[2]/a")
    orgIdCardOff = ("xpath","//*[@for='idCardOn']/following-sibling::div/div[2]/div/div/div/div/div[2]/a")
    verifyAccount = ("xpath","//*[@class='l-margin-lr']/div[1]/div/div/input")
    verifyPwd = ("xpath","//*[@class='l-margin-lr']/div[2]/div/div/input")
    verifyCode = ("xpath","//*[@class='l-margin-lr']/div[3]/div/div/input")
    verifyReport = ("xpath","//*[@class='l-margin-lr']/div[4]/div/div/div/div/div/i")
    signTory = ("xpath","/html/body/div/section/section/main/section/main/form/div[3]/div[1]/div/label[2]/span[1]")
    signName = ("xpath","//*[@for='signName']/following-sibling::div/div/input")
    signPhone = ("xpath","//*[@for='signPhone']/following-sibling::div/div/input")
    signIdCard = ("xpath","//*[@for='signIdCard']/following-sibling::div/div/input")
    signEmail = ("xpath","//*[@for='signEmail']/following-sibling::div/div/input")
    signCardOn = ("xpath","//*[@for='signIdCardOn']/following-sibling::div/div[1]/div/div/div/div/div/a")
    signCardOff = ("xpath","//*[@for='signIdCardOn']/following-sibling::div/div[2]/div/div/div/div/div/a")
    signCertificate = ("xpath","//*[@for='certificate']/following-sibling::div/div/div/div/div/div/div/a")
    otherDescription = ("xpath","//*[@placeholder='请输入资料的详细描述']")
    orgAmount_1 = ("xpath","//*[@class='el-button el-button--primary el-button--small']")
    orgAmount_2 = ("xpath","//*[@class='el-input el-input--small el-input--prefix el-input--suffix']")
    orgAmount_3 = ("xpath", "//*[@class='el-scrollbar__view el-autocomplete-suggestion__list']/li[7]")
    orgAmount_4 = ("xpath", "//*[@class='el-button l-margin-l el-button--success el-button--small']")
    caButton_0 = ("xpath","//*[@class='l-panel-item l-margin-t l-signer-error']/div[1]/button")
    caButton_1 =("xpath","//*[@class='el-button el-tooltip item el-button--success']")
    tickSubmit = ("xpath","//*[@aria-label='确认寄出票证']/div[3]/span/button[2]")
    other_01 = ("xpath","//*[@class='l-fs-xl l-txt-gray']")
    other_02 = ("xpath", "//*[@class='l-other-data l-margin']/div[1]/div[1]/input")
    other_03 = ("xpath", "//*[@class='l-other-data l-margin']/div[2]/div[1]/input")
    other_04 = ("xpath", "//*[@class='l-other-data l-margin']/div[3]/div[1]/input")
    other_05 = ("xpath", "//*[@class='l-other-data l-margin']/div[4]/div[1]/input")
    other_06 = ("xpath", "//*[@class='l-other-data l-margin']/div[5]/div[1]/input")
    other_07 = ("xpath", "//*[@class='l-other-data l-margin']/div[6]/div[1]/input")
    other_11 = ("xpath","//*[@class='l-other-data l-margin']/div[1]/p/div/div/div/span/i")
    other_12 = ("xpath","//*[@class='l-other-data l-margin']/div[2]/p/div/div/div/span/i")
    other_13 = ("xpath","//*[@class='l-other-data l-margin']/div[3]/p/div/div/div/span/i")
    other_14 = ("xpath","//*[@class='l-other-data l-margin']/div[4]/p/div/div/div/span/i")
    other_15 = ("xpath","//*[@class='l-other-data l-margin']/div[5]/p/div/div/div/span/i")
    other_16 = ("xpath","//*[@class='l-other-data l-margin']/div[6]/p/div/div/div/span/i")
    # common
    def Drop(self):
        self.click(self.drop)
        self.click(self.dropDownList)

    def h5Drop(self):
        self.click(self.h5logout_0)
        time.sleep(1)
        self.click(self.h5logout_1)
        time.sleep(1)
        self.click(self.h5logout_2)

    def uploadPic(self):
        time.sleep(1)
        k.type_string(self.picturePath)
        time.sleep(1)
        k.tap_key(k.enter_key)
        k.tap_key(k.enter_key)
        time.sleep(1)

    def uploadRar(self):
        time.sleep(1)
        k.type_string(self.rarPath)
        time.sleep(1)
        k.tap_key(k.enter_key)
        k.tap_key(k.enter_key)
        time.sleep(1)

    def signCommonMethod(self):
        self.dragAndDrag(self.firstDrag,self.lastDrag)
        self.click(self.signSubmit)
        self.sendKeys(self.smsVal,"999999")
        self.click(self.smsPanel)
        time.sleep(2)

    def signC1B1(self):
        self.click(self.c1Sign)
        time.sleep(2)
        self.switch_handle(1)
        self.signCommonMethod()
        self.switch_handle(0)
        self.click(self.b1Sign)
        time.sleep(2)
        self.switch_handle(1)
        self.signCommonMethod()
        self.switch_handle(0)

    def signC2(self):
        self.click(self.c2Sign)
        time.sleep(2)
        self.switch_handle(1)
        self.signCommonMethod()
        time.sleep(1)
        self.switch_handle(0)

    def signC2Shop(self):
        self.click(self.c2SignShop)
        time.sleep(2)
        self.switch_handle(1)
        self.signCommonMethod()
        time.sleep(1)
        self.switch_handle(0)

    def signC3_1(self):
        self.click(self.c3_1Sign)
        time.sleep(2)
        self.switch_handle(1)
        self.signCommonMethod()
        time.sleep(1)
        self.switch_handle(0)
        time.sleep(1)

    def signC3_1Shop(self):
        self.click(self.c3_1SignShop)
        time.sleep(2)
        self.switch_handle(1)
        self.signCommonMethod()
        time.sleep(1)
        self.switch_handle(0)
        time.sleep(1)

    def signC3(self):
        self.click(self.c3Sign)
        time.sleep(2)
        self.switch_handle(1)
        self.signCommonMethod()
        time.sleep(1)
        self.switch_handle(0)

    def signC3Shop(self):
        self.click(self.c3SignShop)
        time.sleep(2)
        self.switch_handle(1)
        self.signCommonMethod()
        time.sleep(1)
        self.switch_handle(0)

    # adminPage
    # admin common detail page
    def adminB2Detail(self):
        self.click(self.loanMenu)
        time.sleep(2)
        self.click(self.module)
        time.sleep(2)
        self.click(self.orderDetailButton)
        time.sleep(3)

    # admin common org page
    def adminOrgDetial(self):
        self.click(self.orgMenubarAdmin)
        time.sleep(4)
        self.click(self.orgDetailButton)
        time.sleep(1)

    # 业务支持审核B2
    def adminVerifyB2(self):
        self.adminB2Detail()
        self.click(self.successButton)
        self.clear(self.rate)
        self.sendKeys(self.rate,i["rate"])
        self.clear(self.day)
        self.sendKeys(self.day,i["day"])
        self.sendKeys(self.remark,i["remark"])
        self.click(self.remarkUpload)
        self.uploadPic()
        self.click(self.reSuccessButton)
        time.sleep(1)
        self.click(self.successButton)
        self.sendKeys(self.remark, i["remark"])
        self.click(self.reSuccessButton)
        time.sleep(1)

    # 物流下单&验车
    def adminLogistics(self):
        self.adminB2Detail()
        self.click(self.checkAll)
        self.click(self.bottomButton_1)
        time.sleep(1)
        self.sendKeys(self.logisticsName,i["logisticsName"])
        self.sendKeys(self.logisticsNumber,i["logisticsNumber"])
        self.click(self.Date)
        time.sleep(1)
        self.click(self.today)
        self.sendKeys(self.logisticsUserName,i["userName"])
        self.sendKeys(self.logisticsPhone,i["phone"])
        self.sendKeys(self.logisticsIdCard,i["idCard"])
        self.click(self.logisticsSubmit)
        time.sleep(1)
        self.click(self.checkAll)
        self.click(self.bottomButton_2)
        time.sleep(1)
        self.click(self.uploadPicture)
        self.uploadPic()
        self.click(self.validateCarSubmit)
        time.sleep(1)

    # 一键收到票证
    def adminReceiveTicket(self):
        self.adminB2Detail()
        self.click(self.checkAll)
        self.click(self.bottomButton_3)
        time.sleep(2)
        self.click(self.verifyTicketSubmit)
        time.sleep(1)

    # 确认放款
    def adminConfirmLoan(self):
        self.adminB2Detail()
        self.click(self.checkAll)
        self.click(self.bottomButton_4)
        time.sleep(1)
        self.click(self.confirmLoanSubmit)
        time.sleep(2)

    # 区域经理添加门店
    def adminAreaManagerAddOrg(self):
        self.click(self.orgMenubarAdmin)
        time.sleep(1)
        self.click(self.addOrgButton)
        time.sleep(2)
        self.click(self.clerk)
        time.sleep(1)
        self.click(self.clerkName)
        self.sendKeys(self.account,19967890000+random.randint(1001,9999))
        self.sendKeys(self.orgName,e["orgName"])
        self.sendKeys(self.orgLicenseCode,e["licenseCode"])
        self.click(self.orgProvinces)
        self.click(self.Province)
        self.click(self.city)
        self.click(self.area)
        self.sendKeys(self.orgAddress,e["orgAddress"])
        self.sendKeys(self.orgAccount,e["orgAccount"])
        self.sendKeys(self.orgBankBranch,e["orgBankBranch"])
        self.click(self.orgLicense)
        time.sleep(1)
        p.copy(u"1561341162079_公司营业执照.jpg")
        k.press_key(k.control_key)
        k.tap_key('v')
        k.release_key(k.control_key)
        time.sleep(1)
        k.tap_key(k.enter_key)
        k.tap_key(k.enter_key)
        time.sleep(1)
        self.click(self.orgImage)
        time.sleep(1)
        p.copy(self.picture_01)
        k.press_key(k.control_key)
        k.tap_key('v')
        k.release_key(k.control_key)
        time.sleep(1)
        k.tap_key(k.enter_key)
        k.tap_key(k.enter_key)
        time.sleep(1)
        self.click(self.orgImg)
        # self.uploadPic()
        time.sleep(1)
        p.copy(self.picture_02)
        k.press_key(k.control_key)
        k.tap_key('v')
        k.release_key(k.control_key)
        time.sleep(1)
        k.tap_key(k.enter_key)
        k.tap_key(k.enter_key)
        time.sleep(1)
        self.click(self.securities)
        # self.uploadPic()
        time.sleep(1)
        p.copy(self.picture_03)
        k.press_key(k.control_key)
        k.tap_key('v')
        k.release_key(k.control_key)
        time.sleep(1)
        k.tap_key(k.enter_key)
        k.tap_key(k.enter_key)
        time.sleep(1)
        self.js_focus_element(self.payroll)
        self.click(self.payroll)
        self.uploadRar()
        self.sendKeys(self.orgCorporation,e["orgCorporation"])
        self.sendKeys(self.orgPhone,e["account"])
        self.sendKeys(self.orgIdCard,e["orgIdCard"])
        self.sendKeys(self.orgEmail,e["orgEmail"])
        self.click(self.orgIdCardOn)
        time.sleep(1)
        p.copy(u"1561341162079_法人身份证正.jpg")
        k.press_key(k.control_key)
        k.tap_key('v')
        k.release_key(k.control_key)
        time.sleep(1)
        k.tap_key(k.enter_key)
        k.tap_key(k.enter_key)
        time.sleep(1)
        self.click(self.orgIdCardOff)
        time.sleep(1)
        p.copy(u"1561341162079_法人身份证反.jpg")
        k.press_key(k.control_key)
        k.tap_key('v')
        k.release_key(k.control_key)
        time.sleep(1)
        k.tap_key(k.enter_key)
        k.tap_key(k.enter_key)
        time.sleep(1)
        self.sendKeys(self.verifyAccount,e["verify"])
        self.sendKeys(self.verifyPwd,e["verify"])
        self.sendKeys(self.verifyCode,e["verify"])
        self.js_focus_element(self.otherDescription)
        self.click(self.signTory)
        self.sendKeys(self.signName,e["signName"])
        self.sendKeys(self.signPhone,e["signPhone"])
        self.sendKeys(self.signIdCard,e["orgIdCard"])
        self.sendKeys(self.signEmail,e["orgEmail"])
        self.click(self.signCardOn)
        time.sleep(1)
        p.copy(u"1561341162079_签署人身份证正.jpg")
        k.press_key(k.control_key)
        k.tap_key('v')
        k.release_key(k.control_key)
        time.sleep(1)
        k.tap_key(k.enter_key)
        k.tap_key(k.enter_key)
        time.sleep(1)
        self.click(self.signCardOff)
        time.sleep(1)
        p.copy(u"1561341162079_签署人身份证反.jpg")
        k.press_key(k.control_key)
        k.tap_key('v')
        k.release_key(k.control_key)
        time.sleep(1)
        k.tap_key(k.enter_key)
        k.tap_key(k.enter_key)
        time.sleep(1)
        self.click(self.signCertificate)
        p.copy(u"1561341162079_申请表.png")
        k.press_key(k.control_key)
        k.tap_key('v')
        k.release_key(k.control_key)
        time.sleep(1)
        k.tap_key(k.enter_key)
        k.tap_key(k.enter_key)
        time.sleep(1)
        self.click(self.other_01)
        self.click(self.other_01)
        self.click(self.other_01)
        self.click(self.other_01)
        time.sleep(1)
        self.sendKeys(self.other_02,"1")
        self.sendKeys(self.other_03,"2")
        self.sendKeys(self.other_04,"3")
        self.sendKeys(self.other_05,"4")
        self.sendKeys(self.other_06,"5")
        self.js_focus_element(self.other_11)
        self.click(self.other_11)
        time.sleep(1)
        p.copy(self.picture_04)
        k.press_key(k.control_key)
        k.tap_key('v')
        k.release_key(k.control_key)
        time.sleep(1)
        k.tap_key(k.enter_key)
        k.tap_key(k.enter_key)
        time.sleep(1)
        self.click(self.other_12)
        time.sleep(1)
        p.copy(self.picture_05)
        k.press_key(k.control_key)
        k.tap_key('v')
        k.release_key(k.control_key)
        time.sleep(1)
        k.tap_key(k.enter_key)
        k.tap_key(k.enter_key)
        time.sleep(1)
        self.click(self.other_13)
        time.sleep(1)
        p.copy(self.picture_06)
        k.press_key(k.control_key)
        k.tap_key('v')
        k.release_key(k.control_key)
        time.sleep(1)
        k.tap_key(k.enter_key)
        k.tap_key(k.enter_key)
        time.sleep(1)
        self.click(self.other_14)
        time.sleep(1)
        p.copy(self.picture_07)
        k.press_key(k.control_key)
        k.tap_key('v')
        k.release_key(k.control_key)
        time.sleep(1)
        k.tap_key(k.enter_key)
        k.tap_key(k.enter_key)
        time.sleep(1)
        self.click(self.other_15)
        time.sleep(1)
        p.copy(self.picture_08)
        k.press_key(k.control_key)
        k.tap_key('v')
        k.release_key(k.control_key)
        time.sleep(1)
        k.tap_key(k.enter_key)
        k.tap_key(k.enter_key)
        time.sleep(4)
        self.click(self.successButton)
        time.sleep(2)

    # 业务发送CA授权
    def adminCaAccredit(self):
        self.adminOrgDetial()
        self.js_focus_element(self.caButton_0)
        time.sleep(1)
        self.click(self.caButton_0)
        time.sleep(1)
        self.click(self.caButton_1)
        url = self.selcetSQL("SELECT ca_id FROM peanut_test.che_cainformation GROUP BY ca_id DESC;")
        self.driver.set_window_size(500,1100)
        self.getUrl("http://h5.hsbro.com.cn/ca/auth?_plat=shop&caId="+str(url[0]))

    def adminBussinessVerify(self):
        self.click(self.successButton)
        time.sleep(1)
        self.sendKeys(self.remark,i["remark"])
        self.click(self.uploadAccessory)
        self.uploadPic()
        self.click(self.reSuccessButton)
        time.sleep(1)
        self.click(self.successButton)
        time.sleep(1)
        self.click(self.reSuccessButton)
        time.sleep(1)
        self.click(self.orgAmount_1)
        self.click(self.orgAmount_2)
        self.click(self.orgAmount_3)
        self.click(self.orgAmount_4)
        time.sleep(1)
        self.click(self.successButton)
        time.sleep(1)
        self.click(self.reSuccessButton)
        time.sleep(1)
        self.click(self.successButton)
        time.sleep(1)
        self.click(self.reSuccessButton)

    # 审核结算
    def adminVerifySettlement(self):
        self.adminB2Detail()
        self.click(self.l_zoom_01)
        time.sleep(1)
        self.click(self.settlement_VerifyButton)
        self.js_focus_element(self.settlementOtherFee)
        self.sendKeys(self.settlementOtherFee,i["otherFee"])
        self.sendKeys(self.settlementReduceFee,i["reduceFee"])
        self.sendKeys(self.remark,i["remark"])
        self.click(self.remarkUpload)
        self.uploadPic()
        self.click(self.settlementSubmit_1)
        time.sleep(1)
        self.click(self.l_zoom_02)
        time.sleep(1)
        self.click(self.settlement_VerifyButton)
        time.sleep(1)
        self.click(self.settlementSubmit_2)
        time.sleep(1)
        self.click(self.l_zoom_03)
        time.sleep(1)
        self.click(self.settlement_VerifyButton)
        time.sleep(1)
        self.click(self.settlementSubmit_3)
        time.sleep(1)
        self.click(self.l_zoom_04)
        time.sleep(1)
        self.click(self.settlement_VerifyButton)
        time.sleep(1)
        self.click(self.settlementSubmit_4)
        time.sleep(2)

    # 寄出票证
    def adminSendTicket(self):
        self.adminB2Detail()
        self.click(self.checkAll)
        self.click(self.bottomButton_5)
        time.sleep(1)
        self.click(self.tickSubmit)
        time.sleep(2)

    # shop
    # shop common detail page
    def shopB2Detail(self):
        self.click(self.loanMenu)
        time.sleep(1)
        self.click(self.moduleShop)
        time.sleep(2)
        self.click(self.orderDetailButton2)
        time.sleep(3)

    # shop common org page
    def shopOrgDetial(self):
        self.click(self.orgMenubarShop)

    # 验车
    def shopCheckCar(self):
        self.shopB2Detail()
        self.click(self.checkAll)
        self.click(self.bottomButton_1)
        time.sleep(2)
        self.click(self.checkCarSubmit)
        time.sleep(12)

    # 结算申请
    def shopSettlement(self):
        self.shopB2Detail()
        self.click(self.checkAll)
        self.click(self.bottomButton_2)
        time.sleep(1)
        self.click(self.Date)
        time.sleep(1)
        self.click(self.today)
        time.sleep(1)
        self.sendKeys(self.settlementUserName,i["userName"])
        self.sendKeys(self.settlementPhone,i["phone"])
        self.sendKeys(self.settlementIdCard,i["idCard"])
        self.click(self.settlementIdCardOn)
        self.uploadPic()
        self.click(self.settlementIdCardOff)
        self.uploadPic()
        self.click(self.settlementSubmit)
        time.sleep(2)

    # h5

    def h5VerifyOrder_B2(self):
        self.click(self.h5List_B2)
        time.sleep(1)
        self.click(self.h5Detail)
        time.sleep(1)
        self.click(self.h5VerifyButton)
        time.sleep(1)
        self.sendKeys(self.h5Remark,i["remark"])
        self.click(self.h5Submit)
        time.sleep(5)

    def h5VerifyLoan(self):
        time.sleep(1)
        self.click(self.h5VerifyLoanList)
        time.sleep(2)
        self.click(self.h5Detail)
        time.sleep(1)
        self.click(self.h5All)
        time.sleep(1)
        self.click(self.h5VerifyLoanButton)
        time.sleep(1)
        self.sendKeys(self.h5Sms,"8432")
        self.click(self.h5Submit)
        time.sleep(5)

    def h5VerifyOrg(self):
        self.click(self.h5List_Org)
        time.sleep(1)
        self.click(self.h5Detail)
        time.sleep(1)
        self.click(self.h5VerifyButton)
        time.sleep(1)
        self.click(self.h5Submit)
        time.sleep(7)

    def h5AllowCar(self):
        self.click(self.h5List_AllowCar)
        time.sleep(2)
        self.click(self.h5Detail)
        time.sleep(1)
        self.click(self.h5All)
        time.sleep(1)
        self.click(self.h5VerifyLoanButton)
        time.sleep(1)
        self.sendKeys(self.h5Sms,"8432")
        self.click(self.h5Submit)
        time.sleep(7)

if __name__ == "__main__":
    from commonConfig.login import _loginShop
    from commonConfig.login import _loginAdmin
    from commonConfig.login import _loginH5
    driver = webdriver.Firefox()
    _loginAdmin(driver,"http://admin.hsbro.com.cn")
    o = bath(driver)
    o.adminAreaManagerAddOrg()
