import React from 'react'; import { Card, Button, Modal, Input, message, Spin } from 'antd'; import { $Axios, $AxiosGet } from '../../common/publish'; import '../Account-overview/Account-overview.scss' import axios from "axios"; import sz1 from '../../images/sz1.jpg'; import sz2 from '../../images/sz2.jpg'; import sz4 from '../../images/sz4.jpg'; export default class AccountOverview extends React.Component { constructor(props) { super(props) this.state = { headTxt: '财务管理 > 账户概览', data: '', yestdayTrade: '', preMonthTrade: '', btnsType: 1, isModalVisible: false, Password: '', colors: '', contactPhone: '', num: 60, t: '', lodings: false } } componentDidMount() { this.initData() } initData() { let that_ = this; that_.setState({ lodings: false }) let url = '/payment/merchant.query.groovy' let params = { action: 'queryGeneral',//查询商户概览信息 merchantNo : JSON.parse(localStorage.getItem('userData')).merchantNo,//入网的appname、社群name、商户号等(香香或者嘉旺提供) merchantType : JSON.parse(localStorage.getItem('userData')).merchantType, //入网来源,2:app或社群 3:商户或店铺(香香或者嘉旺提供) } $Axios('get', url, params, (res) => { let status = res.data.head.status; if (status == 200) { let data = res.data.body; let yestdayTrade = res.data.body.yestdayTrade; //昨日收支 let preMonthTrade = res.data.body.preMonthTrade;//上月收支 that_.setState({ data: data, yestdayTrade: yestdayTrade, preMonthTrade: preMonthTrade, contactPhone: data.contactPhone, lodings : true }) } }) } onBtnClick_1() { this.setState({ btnsType: 1 }) } onBtnClick_2(e) { this.setState({ btnsType: 2 }) } initData_tk() { let that_ = this; let url = '/payment/merchant.pwd.update.groovy' let params = { action: 'queryGeneral',//查询商户概览信息 merchantNo : JSON.parse(localStorage.getItem('userData')).merchantNo,//入网的appname、社群name、商户号等(香香或者嘉旺提供) merchantType : JSON.parse(localStorage.getItem('userData')).merchantType, //入网来源,2:app或社群 3:商户或店铺(香香或者嘉旺提供) } $Axios('get', url, params, (res) => { let status = res.data.head.status; if (status == 200) { let data = res.data.body; let yestdayTrade = res.data.body.yestdayTrade; //昨日收支 let preMonthTrade = res.data.body.preMonthTrade;//上月收支 let parentAppName = res.data.body.parentAppName that_.setState({ data: data, yestdayTrade: yestdayTrade, preMonthTrade: preMonthTrade, parentAppName : parentAppName }) } }) } onBtnClick_0() { this.setState({ isModalVisible: true }) } handleOk_c() { this.setState({ isModalVisible: false }) } handleOk() { this.submits(); } submits() { if (document.getElementById("pwd").value !== '') { if (document.getElementById("cfPassword").value !== '') { if (document.getElementById("num1").value !== '') { if (document.getElementById("pwd").value == document.getElementById("cfPassword").value) { let that_ = this; let url = '/payment/merchant.pwd.update.groovy' let params = { id: this.state.data.id,//商户id pfAppName : this.state.parentAppName,// 新增参数 pwd: document.getElementById("pwd").value,//密码 mobile: this.state.data.contactPhone,//手机号 code: document.getElementById("num1").value,//验证码 } $Axios('get', url, params, (res) => { let status = res.data.head.status; if (status == 200) { message.info('提交成功!'); that_.setState({ isModalVisible: false }); } else { message.info('提交失败!'); } }) } else { message.info('支付密码内容不一致!'); } } else { message.info('请输入验证码!'); } } else { message.info('请输入确认支付密码!'); } } else { message.info('请输入支付密码!'); } } handleOk_yzm() { let url = '/d3api2/user/sendMobileVerify.groovy' let that_ = this; let Params = { mobile: this.state.data.contactPhone,//手机号 // mobile : 17600982892,//手机号 pfAppName: JSON.parse(localStorage.getItem('userData')).pfAppName,//包名 pfAppName : this.state.parentAppName,// 新增参数 eventType: 51 } $AxiosGet('get', url, Params, (res) => { let status = res.data.head.status; if (status == 200) { message.info('验证码发送成功,请注意查收!'); let t = setInterval(function () { let nums = that_.djsNum(); that_.setState({ num: nums }); if (nums == 0) { clearInterval(that_.state.t); that_.setState({ t: '', num: 60 }); } }, 1000); that_.setState({ t: t }); } }); } djsNum() { let that_ = this; let num = this.state.num num-- return num } inputChange1(e) { } colorChange(e) { let s = this.colorTxt(e.target.value); this.setState({ Password: e.target.value, colors: s }); } colorTxt(value) { // 0: 表示第一个级别 1:表示第二个级别 2:表示第三个级别 // 3: 表示第四个级别 4:表示第五个级别 let modes = 0; if (value.length < 6) {//最初级别 return modes; } if (/\d/.test(value)) {//如果用户输入的密码 包含了数字 modes++; } if (/[a-z]/.test(value)) {//如果用户输入的密码 包含了小写的a到z modes++; } if (/[A-Z]/.test(value)) {//如果用户输入的密码 包含了大写的A到Z modes++; } if (/\W/.test(value)) {//如果是非数字 字母 下划线 modes++; } switch (modes) { case 1: return 1; break; case 2: return 2; break; case 3: return 3; break; case 4: return 4; break; } } render() { const { headTxt, preMonthTrade, yestdayTrade, data, btnsType, isModalVisible, colors, num, t, lodings } = this.state; return (