import React from 'react'; import {Form,Button,Spin,message,Input,Select,Radio} from 'antd'; import ajax from 'jquery/src/ajax/xhr.js'; import $ from 'jquery/src/ajax'; const FormItem =Form.Item; import {statuslist,lvl,currentMember} from '@/dataDic.js'; import {getcustomerTyp,getCustomerSource,getStatuslist} from '@/tools.js'; const Account =React.createClass({ httpAccount(record) { this.RowClick; $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + '/api/admin/customer/findUserAccountDetail', data: { uid: record }, success: function(data) { let thisData = data.data; if(!thisData) { if(data.error && data.error.length) { message.warning(data.error[0].message); }; thisData = {}; }; this.setState({ Accountuid: thisData.id, mobile: thisData.mobile, nickname: thisData.nickname, email: thisData.email, type: getcustomerTyp(String(thisData.type)), source: thisData.source, isMember: thisData.isMember, currentMemberStatus: String(thisData.currentMemberStatus), lvl: String(thisData.lvl), status: String(thisData.status), createTimes: thisData.createTimes, }); }.bind(this), }).always(function() { this.setState({ loading: false }); }.bind(this)); }, getInitialState(){ return{ loading:false } }, //账户信息保存 accountSave(e) { e.preventDefault(); if(!this.state.mobile) { message.warning('手机号码不能为空!') return false; } this.setState({ loading: true }); $.ajax({ method: "post", dataType: "json", url: globalConfig.context + '/api/admin/customer/updateUserAccount', data: { id: this.state.Accountuid, mobile: this.state.mobile, nickname: this.state.nickname, email: this.state.email, isMember: this.state.isMember, currentMemberStatus: this.state.currentMemberStatus, lvl: this.state.lvl, status: this.state.status, } }).done(function(data) { this.setState({ loading: false }); if(!data.error.length) { message.success('保存成功!'); this.props.closeDetail(false,true) } else { message.warning(data.error[0].message); } }.bind(this)); }, componentWillMount(){ this.httpAccount(this.props.data.id); }, detailsModal(){ this.props.closeDetail(false, false) }, componentWillReceiveProps(nextProps) { if(nextProps.data.id&&nextProps.accountState){ this.httpAccount(nextProps.data.id) } }, render(){ const formItemLayout = { labelCol: { span: 8 }, wrapperCol: { span: 14 }, }; return(