applyPaymentModal.js 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. import React,{Component} from 'react';
  2. import {Button, Form, Input, message, Modal} from "antd";
  3. import propType from 'prop-types';
  4. import $ from "jquery";
  5. const layout = {
  6. labelCol: {
  7. span: 8,
  8. },
  9. wrapperCol: {
  10. span: 16,
  11. },
  12. };
  13. const formItemLayout = {
  14. labelCol: { span: 8 },
  15. wrapperCol: { span: 14 },
  16. };
  17. class ApplyPaymentModal extends Component{
  18. // static propTypes = {
  19. // visible: PropTypes.bool.isRequired,
  20. // changeVisible: PropTypes.func.isRequired,
  21. // }
  22. //
  23. // static defaultProps = {
  24. // visible: false,
  25. // changeVisible: ()=>{},
  26. // }
  27. constructor(props) {
  28. super(props);
  29. }
  30. //申请付款
  31. handleSubmit(e){
  32. e.preventDefault();
  33. this.props.form.validateFieldsAndScroll((err, values) => {
  34. if (err) {
  35. return;
  36. }
  37. console.log('Success:',values);
  38. values.tid = this.props.tid;
  39. values.nodeId = this.props.nodeId;
  40. values.paymentType = 0; //支付类型 0第三方 1官费(用来做判断发起区别)
  41. values.chooseType = 1; //支付选择 0第三方 1催款
  42. $.ajax({
  43. method: 'POST',
  44. dataType: 'json',
  45. crossDomain: false,
  46. url: globalConfig.context + '/api/admin/company/addOrderPayment',
  47. data: values,
  48. }).done(
  49. function (data) {
  50. this.setState({
  51. loading: false,
  52. })
  53. if (!data.error.length) {
  54. message.success('申请成功!')
  55. } else {
  56. message.warning(data.error[0].message)
  57. }
  58. }.bind(this)
  59. )
  60. })
  61. }
  62. render() {
  63. const { getFieldDecorator } = this.props.form;
  64. const { previewPayInfor } = this.props;
  65. if(!previewPayInfor){
  66. return;
  67. }
  68. return(
  69. <Modal
  70. maskClosable={false}
  71. footer={null}
  72. visible={this.props.visible}
  73. onCancel={() => {
  74. this.props.changeVisible();
  75. }}
  76. >
  77. <div>
  78. <div>支付供应商费用</div>
  79. <Form
  80. {...layout}
  81. name="basic"
  82. initialValues={{
  83. remember: true,
  84. }}
  85. onSubmit={(e)=>{
  86. this.handleSubmit(e)
  87. }}
  88. >
  89. <Form.Item
  90. {...formItemLayout}
  91. style={{
  92. display:'flex'
  93. }}
  94. label="付款单位/个人:"
  95. >
  96. {getFieldDecorator('companyName', {
  97. initialValue: previewPayInfor.companyName,
  98. rules: [{
  99. required: false,
  100. message: '请输入付款单位/个人!',
  101. }],
  102. })(
  103. <Input
  104. style={{ width: '200px' }}
  105. placeholder="请输入付款单位/个人"
  106. />
  107. )}
  108. </Form.Item>
  109. {/*<Form.Item*/}
  110. {/* {...formItemLayout}*/}
  111. {/* style={{*/}
  112. {/* display:'flex'*/}
  113. {/* }}*/}
  114. {/* label="单价(万元):"*/}
  115. {/*>*/}
  116. {/* {getFieldDecorator('unitPrice', {*/}
  117. {/* rules: [{ required: true, message: '请输入单价!' }],*/}
  118. {/* })(*/}
  119. {/* <Input style={{ width: '200px' }} placeholder="请输入单价" type={'number'}/>*/}
  120. {/* )}*/}
  121. {/*</Form.Item>*/}
  122. <Form.Item
  123. {...formItemLayout}
  124. style={{
  125. display:'flex'
  126. }}
  127. label="数量:"
  128. >
  129. {getFieldDecorator('quantity', {
  130. initialValue: parseInt(previewPayInfor.quantity),
  131. rules: [{ required: false, message: '请输入數量!' }],
  132. })(
  133. <Input disabled={previewPayInfor.quantity <= 1} style={{ width: '200px' }} placeholder="请输入數量" type={'number'}/>
  134. )}
  135. </Form.Item>
  136. {/*<Form.Item*/}
  137. {/* {...formItemLayout}*/}
  138. {/* style={{*/}
  139. {/* display:'flex'*/}
  140. {/* }}*/}
  141. {/* label="总价(万元):"*/}
  142. {/*>*/}
  143. {/* {getFieldDecorator('totalPrice', {*/}
  144. {/* rules: [{ required: false, message: '请输入总价!' }],*/}
  145. {/* })(*/}
  146. {/* <Input style={{ width: '200px' }} placeholder="请输入总价" type={'number'}/>*/}
  147. {/* )}*/}
  148. {/*</Form.Item>*/}
  149. <Form.Item
  150. {...formItemLayout}
  151. style={{
  152. display:'flex'
  153. }}
  154. label="已付(万元):"
  155. >
  156. {getFieldDecorator('totalPrice', {
  157. initialValue: parseFloat(previewPayInfor.partyAmount),
  158. rules: [{ required: false, message: '请输入已付金额!' }],
  159. })(
  160. <Input disabled={true} style={{ width: '200px' }} placeholder="请输入已付金额" type={'number'}/>
  161. )}
  162. </Form.Item>
  163. <Form.Item
  164. {...formItemLayout}
  165. style={{
  166. display:'flex'
  167. }}
  168. label="本次申请支付金额(万元):"
  169. >
  170. {getFieldDecorator('applicationAmount', {
  171. initialValue: parseFloat(previewPayInfor.totalAmount) - parseFloat(previewPayInfor.partyAmount),
  172. rules: [{ required: true, message: '请输入本次申请支付金额!' }],
  173. })(
  174. <Input style={{ width: '200px' }} placeholder="请输入本次申请支付金额" type={'number'}/>
  175. )}
  176. </Form.Item>
  177. <Form.Item
  178. {...formItemLayout}
  179. style={{
  180. display:'flex'
  181. }}
  182. label="备注:"
  183. >
  184. {getFieldDecorator('remarks', {
  185. rules: [{ required: true, message: '请输入备注!' }],
  186. })(
  187. <Input style={{ width: '200px' }} placeholder="请输入备注" type={'textarea'}/>
  188. )}
  189. </Form.Item>
  190. <Form.Item>
  191. <Button type="primary" htmlType="submit">
  192. 确定申请支付
  193. </Button>
  194. </Form.Item>
  195. </Form>
  196. </div>
  197. </Modal>
  198. )
  199. }
  200. }
  201. const WrappedNormalLoginForm = Form.create()(ApplyPaymentModal);
  202. export default WrappedNormalLoginForm