| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310 |
- import React, { Component } from "react";
- import { message, Modal, Spin, Form, Select, Input, Button, Tabs } from "antd";
- import $ from "jquery/src/ajax";
- import PicturesWall from "../../order/orderNew/changeComponent/picturesWall";
- // 发起付款
- class Payment extends Component {
- constructor(props) {
- super(props);
- this.state = {
- loading: false,
- list: [],
- };
- this.onChange = this.onChange.bind(this);
- this.onBlur = this.onBlur.bind(this);
- }
- componentDidMount() {
- }
- // 获取下级列表信息
- getList() {
- $.ajax({
- method: "get",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + "/api/admin/amb/Invest/getInvestAmbList",
- data: {
- id: this.props.myAmbId
- },
- success: function (data) {
- if (data.error && data.error.length === 0) {
- if (data.data) {
- this.setState({
- list: data.data || []
- });
- }
- } else {
- message.warning(data.error[0].message);
- }
- }.bind(this),
- }).always(
- function () {
- }.bind(this)
- );
- }
- onChange(e) {
- const { value } = e.target;
- const reg = /^-?(0|[1-9][0-9]*)(\.[0-9]*)?$/;
- if ((!isNaN(value) && reg.test(value)) || value === '') {
- this.setState({
- amount: value
- })
- }
- }
- onBlur() {
- const { amount } = this.state
- if (!!amount && amount.charAt(amount.length - 1) === '.') {
- this.setState({
- amount: amount.slice(0, -1)
- })
- }
- }
- getOrgCodeUrl(e) {
- this.setState({ orgCodeUrl: e });
- }
- onSubmit() {
- return
- const { myAmbId, onCancel, details = false } = this.props
- const { otherAmbId, amount, comment } = this.state
- if (!otherAmbId) {
- message.warning("请选择您需投人的下级单位");
- return
- }
- if (!amount) {
- message.warning("请填写您的投资款");
- return
- }
- if (!comment) {
- message.warning("请填写备注说明");
- return
- }
- let theorgCodeUrl = [];
- if (this.state.orgCodeUrl.length) {
- let picArr = [];
- this.state.orgCodeUrl.map(function (item) {
- if (
- item.response &&
- item.response.data &&
- item.response.data.length
- ) {
- picArr.push(item.response.data);
- }
- });
- theorgCodeUrl = picArr.join(",");
- } else {
- message.info("请上传附件")
- return
- }
- this.setState({
- loading: true
- })
- // 发起
- let infor = {
- myAmbId, // 我的阿米巴
- otherAmbId, // 对方阿米巴
- amount, // 金额
- comment, // 备注
- status: 1, // 状态 0草稿 1发起
- }
- // 重新发起
- let infor1 = {
- myAmbId, // 我的阿米巴
- otherAmbId, // 对方阿米巴
- amount, // 金额
- comment, // 备注
- status: 1, // 状态 0草稿 1发起
- id: details.id,
- }
- $.ajax({
- method: "POST",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context +
- (
- !!details
- ? "/api/admin/amb/Invest/updateTransfer"
- : "/api/admin/amb/Invest/addTransfer"
- ),
- data: !!details ? infor1 : infor,
- }).done(
- function (data) {
- this.setState({
- loading: false,
- });
- if (!data.error.length) {
- message.success("发起成功!");
- onCancel(true)
- } else {
- message.warning(data.error[0].message);
- }
- }.bind(this)
- );
- }
- render() {
- const { list } = this.state
- const { visible, onCancel } = this.props
- const FormItem = Form.Item;
- const TabPane = Tabs.TabPane;
- const formItemLayout = {
- labelCol: { span: 4 },
- wrapperCol: { span: 16 },
- };
- const tabstyle = {
- marginBottom: 15,
- padding: "0 20px",
- color: "red",
- }
- return (
- <Modal
- maskClosable={false}
- visible={visible == "pay"}
- title="填写付款申请单"
- footer=""
- width="60%"
- onCancel={() => { onCancel(false) }}
- >
- <Spin spinning={this.state.loading}>
- <div>
- {/* <div style={{ textAlign: "center", fontSize: "20px", marginBottom: 40 }}>发起投资</div> */}
- <div style={{ width: "80%", margin: "0 auto" }}>
- <Tabs>
- <TabPane tab="内部结算" key={0}>
- <div style={tabstyle}>内部划拨:公共费用分摊或巴与巴之间的合作</div>
- </TabPane>
- <TabPane tab="费用报销(共对私报销)" key={1}>
- <div style={tabstyle}>费用报销:包括员工销款(如差旅费等等)</div>
- </TabPane>
- <TabPane tab="招待费" key={2}>
- <div style={tabstyle}></div>
- </TabPane>
- <TabPane tab="其他费用" key={3}>
- <div style={tabstyle}></div>
- </TabPane>
- <TabPane tab="借款" key={4}>
- <div style={tabstyle}></div>
- </TabPane>
- <TabPane tab="工资奖金" key={5}>
- <div style={tabstyle}></div>
- </TabPane>
- </Tabs>
- </div>
- <Form>
- <FormItem
- {...formItemLayout}
- label={<span><span style={{ color: "red" }}>*</span>付款巴</span>}
- >
- <Select
- showSearch
- style={{ width: 200 }}
- placeholder="请选择您需投人的下级单位"
- value={this.state.otherAmbId}
- optionFilterProp="children"
- onChange={e => { this.setState({ otherAmbId: e }) }}
- filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
- >
- {
- list.map((item) =>
- <Option value={item.id} key={item.id}>{item.name}</Option>
- )
- }
- </Select>
- </FormItem>
- <FormItem
- {...formItemLayout}
- label={<span><span style={{ color: "red" }}>*</span>金额(万元)</span>}
- >
- <Input
- placeholder="请填写您的金额"
- style={{ width: 200, marginRight: 20 }}
- value={this.state.amount}
- onChange={this.onChange}
- onBlur={this.onBlur}
- />
- <span style={{ color: "red" }}>注:请填写本次费用金额</span>
- </FormItem>
- <FormItem
- {...formItemLayout}
- label="内容及说明"
- >
- <Input
- type="textarea"
- style={{ width: "60%" }}
- placeholder="内容及说明"
- autosize={{ minRows: 3 }}
- value={this.state.comment}
- onChange={(e) => {
- this.setState({ comment: e.target.value });
- }}
- />
- </FormItem>
- <FormItem
- {...formItemLayout}
- label={<span><span style={{ color: "red" }}>*</span>备注</span>}
- >
- <Input
- type="textarea"
- style={{ width: "60%" }}
- placeholder="备注"
- autosize={{ minRows: 3 }}
- value={this.state.comment}
- onChange={(e) => {
- this.setState({ comment: e.target.value });
- }}
- />
- </FormItem>
- <FormItem
- {...formItemLayout}
- label={<span><span style={{ color: "red" }}>*</span>上传附件</span>}
- >
- <PicturesWall
- fileList={this.getOrgCodeUrl}
- pictureUrl={this.state.orgCodeUrl}
- url="/api/admin/uploadImg"
- bindId={""}
- sign="amb_payment"
- deleteApi="/api/admin/deleteImg"
- />
- <p>图片建议:要清晰。</p>
- </FormItem>
- <FormItem
- wrapperCol={{ span: 12, offset: 9 }}
- >
- <div style={{ marginTop: 30 }}>
- <Button
- type="primary"
- onClick={() => {
- this.onSubmit();
- }}
- >
- 提交申请
- </Button>
- <Button
- type="ghost"
- style={{ marginLeft: 20 }}
- onClick={() => { onCancel(false) }}
- >
- 取消
- </Button>
- </div>
- </FormItem>
- </Form>
- </div>
- </Spin>
- </Modal>
- );
- }
- }
- export default Payment;
|