index.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403
  1. import React,{Component} from 'react';
  2. import {message, Modal, Tabs} from "antd";
  3. import { cuiJieDian } from '@/dataDic.js'
  4. import ProjectOverview from './projectOverview'
  5. import {splitUrl} from '@/tools'
  6. import CheckProject from "../../../../components/checkProject";
  7. import $ from "jquery";
  8. import OrderItemStatus from "../../../../../common/orderItemStatus";
  9. const { TabPane } = Tabs
  10. class DetailsModal extends Component{
  11. constructor(props) {
  12. super(props);
  13. this.state={
  14. loading: false,
  15. activeKey:'1',
  16. paySubject: [],
  17. orderDtails: {},
  18. containOfficialFees:0,//官费缴费情况
  19. }
  20. this.visitCancel = this.visitCancel.bind(this);
  21. this.getCsortData = this.getCsortData.bind(this);
  22. }
  23. async componentDidMount() {
  24. if(this.props.tid){
  25. this.waiDetail();
  26. this.thirdTable(this.props.tid);
  27. this.getOrderNewDetail();
  28. await this.xiangqing(this.props.tid);
  29. await this.getCsortData(this.state.sort)
  30. await this.payNodeTable(this.props.tid);
  31. }
  32. }
  33. // 获取csort下的数据
  34. getCsortData(cSort) {
  35. return cuiJieDian.map((item) => {
  36. if (item.value == cSort) {
  37. this.setState({
  38. paySubject: item.children,
  39. })
  40. }
  41. })
  42. }
  43. visitOk(){
  44. this.setState({
  45. oldInfor: {}
  46. });
  47. }
  48. visitCancel(){
  49. this.setState({
  50. oldInfor: {}
  51. });
  52. this.props.visitCancel();
  53. }
  54. waiDetail() {
  55. let url = window.location.href.substring(7)
  56. this.setState({
  57. loading: true,
  58. })
  59. $.ajax({
  60. method: 'get',
  61. dataType: 'json',
  62. crossDomain: false,
  63. url:
  64. globalConfig.context + '/api/admin/outsourceOrg/orderOutsourceDtails',
  65. data: {
  66. tid: this.props.tid,
  67. orderNo: this.props.orderNo,
  68. },
  69. }).done(
  70. function (data) {
  71. this.setState({
  72. loading: false,
  73. })
  74. if (!data.error.length && data.data) {
  75. if(data.data.unitNumber){
  76. this.setState({
  77. oldInfor: {
  78. companyName:data.data.companyName,
  79. unitPrice:data.data.unitPrice,
  80. unitNumber:data.data.unitNumber,
  81. amount:data.data.amount,
  82. outsourceRemarks:data.data.outsourceRemarks,
  83. refundStatus: data.data.refundStatus,
  84. pictureUrl: data.data.pictureUrl
  85. ? splitUrl(
  86. data.data.pictureUrl,
  87. ',',
  88. globalConfig.avatarHost + '/upload',
  89. url
  90. )
  91. : [], //图片地址
  92. }
  93. })
  94. }else{
  95. this.setState({
  96. oldInfor: {}
  97. })
  98. }
  99. this.setState({
  100. containOfficialFees: data.data.actualOfficial,//官费类型 0实际已缴费 1实际未缴费
  101. orderDtails: data.data,
  102. startType: data.data.startType, //类型
  103. mid: data.data.id,
  104. outsourceRemarks: data.data.outsourceRemarks,
  105. refundStatus: data.data.refundStatus,
  106. pictureUrl: data.data.pictureUrl
  107. ? splitUrl(
  108. data.data.pictureUrl,
  109. ',',
  110. globalConfig.avatarHost + '/upload',
  111. url
  112. )
  113. : [], //图片地址
  114. })
  115. } else if (data.error && data.error.length) {
  116. message.warning(data.error[0].message)
  117. } else if (!data.data) {
  118. this.setState({
  119. refundStatus: undefined,
  120. })
  121. }
  122. }.bind(this)
  123. )
  124. }
  125. //查看第三方信息表格
  126. thirdTable(id) {
  127. this.setState({
  128. loadData: true,
  129. })
  130. $.ajax({
  131. method: 'get',
  132. dataType: 'json',
  133. crossDomain: false,
  134. url: globalConfig.context + '/api/admin/company/selectCompany',
  135. data: {
  136. tid: id,
  137. },
  138. success: function (data) {
  139. if (data.error && data.error.length) {
  140. message.warning(data.error[0].message)
  141. } else {
  142. let companyNameArr = []
  143. let theArr = []
  144. let thisData = []
  145. let arr = data.data || []
  146. let allTotalAmount = 0
  147. for (let i = 0; i < arr.length; i++) {
  148. thisData = arr[i]
  149. allTotalAmount =
  150. (allTotalAmount * 10000 + thisData.totalAmount * 10000) / 10000
  151. companyNameArr.push(thisData.companyName);
  152. thisData.key = i;
  153. theArr.push(thisData)
  154. }
  155. for(let d=0;d<theArr.length;d++){
  156. theArr[d].companyName = theArr[d].companyName+ '-' + theArr[d].id;
  157. // companyNameArr[d] = {
  158. // companyName: theArr[d].companyName,
  159. // id: theArr[d].id,
  160. // }
  161. }
  162. if (!allTotalAmount) {
  163. allTotalAmount = 0
  164. }
  165. this.setState({
  166. thirdInfoList: theArr,
  167. allTotalAmount: allTotalAmount,
  168. })
  169. }
  170. }.bind(this),
  171. }).always(
  172. function () {
  173. this.setState({
  174. loading: false,
  175. })
  176. }.bind(this)
  177. )
  178. }
  179. payNodeTable(id) {
  180. this.setState({
  181. loadData: true,
  182. })
  183. return $.ajax({
  184. method: 'get',
  185. dataType: 'json',
  186. crossDomain: false,
  187. url: globalConfig.context + '/api/admin/company/selectPaymentNode',
  188. data: {
  189. tid: id,
  190. },
  191. success: function (data) {
  192. if (data.error && data.error.length) {
  193. message.warning(data.error[0].message)
  194. } else {
  195. let payNodeArr = []
  196. let thisData = []
  197. let arr = data.data || []
  198. //对#5283自定义的补充展示
  199. this.state.paySubject.push({ key: '自定义', value: '0' })
  200. for (let i = 0; i < arr.length; i++) {
  201. thisData = arr[i]
  202. //遍历paySubject,获取当前dunType对应的key
  203. this.state.paySubject.map((item) => {
  204. if (item.value == thisData.dunType) {
  205. thisData.dunType = item.key
  206. }
  207. })
  208. payNodeArr.push({
  209. key: i,
  210. id: thisData.id, //付款节点Id
  211. tid: thisData.tid,
  212. companyName: thisData.companyName, //供应商名称
  213. projectType: thisData.projectType, //项目分类
  214. dunType: thisData.dunType, //催款分类
  215. unitPrice: thisData.unitPrice, //单价
  216. quantity: thisData.quantity, //数量
  217. totalAmount: thisData.totalAmount, //总价
  218. partyAmount: thisData.partyAmount, //付款
  219. partyTimes: thisData.partyTimes, //付款时间
  220. cid: thisData.cid, //机构id
  221. })
  222. }
  223. for(let d=0;d<payNodeArr.length;d++){
  224. payNodeArr[d].companyName = payNodeArr[d].companyName+ '-' + payNodeArr[d].cid;
  225. }
  226. this.setState({
  227. payNodeList: payNodeArr,
  228. })
  229. }
  230. }.bind(this),
  231. }).always(
  232. function () {
  233. this.setState({
  234. loading: false,
  235. })
  236. }.bind(this)
  237. )
  238. }
  239. //订单详情
  240. xiangqing(id) {
  241. return $.ajax({
  242. method: 'get',
  243. dataType: 'json',
  244. crossDomain: false,
  245. url: globalConfig.context + '/api/admin/orderProject/orderTaskDetail',
  246. data: {
  247. id: id,
  248. },
  249. success: function (data) {
  250. let thisdata = data.data
  251. if (data.error.length || data.data.list == '') {
  252. if (data.error && data.error.length) {
  253. message.warning(data.error[0].message)
  254. }
  255. } else {
  256. localStorage.setItem('cSort', thisdata.sort);
  257. this.setState({
  258. orderTaskOfficialCost: thisdata.officialCost, //官费 0无 1有
  259. orderTaskCostReduction: thisdata.costReduction,//费减
  260. checkStatus:thisdata.checkStatus,//核对状态
  261. commodityQuantity:thisdata.commodityQuantity,//项目数量
  262. patentTypeName:thisdata.patentTypeName,//官费类型名称
  263. patentTypeId: thisdata.patentType,//官费专利类型
  264. sort: thisdata.sort,
  265. })
  266. }
  267. }.bind(this),
  268. }).always(
  269. function () {
  270. this.setState({
  271. loading: false,
  272. })
  273. }.bind(this)
  274. )
  275. }
  276. getOrderNewDetail() {
  277. $.ajax({
  278. method: "get",
  279. dataType: "json",
  280. crossDomain: false,
  281. url: globalConfig.context + "/api/admin/newOrder/getOrderNewDetail",
  282. data: {
  283. orderNo: this.props.orderNo
  284. },
  285. success: function (data) {
  286. if (data.error.length || data.data.list == "") {
  287. if (data.error && data.error.length) {
  288. message.warning(data.error[0].message);
  289. }
  290. } else {
  291. let thisdata = data.data;
  292. this.setState({
  293. deleteSign:thisdata.deleteSign,
  294. });
  295. }
  296. }.bind(this)
  297. });
  298. }
  299. render() {
  300. return(
  301. <Modal
  302. maskClosable={false}
  303. className="customeDetails"
  304. footer=""
  305. title=""
  306. width="900px"
  307. visible={this.props.visible}
  308. onOk={this.visitOk}
  309. onCancel={this.visitCancel}
  310. >
  311. <Tabs
  312. defaultActiveKey='1'
  313. activeKey={this.state.activeKey}
  314. onChange={(e) => {
  315. this.setState({
  316. activeKey: e
  317. })
  318. if(e === '1'){
  319. this.waiDetail();
  320. this.thirdTable(this.props.tid);
  321. this.payNodeTable(this.props.tid);
  322. this.xiangqing(this.props.tid);
  323. }
  324. }}
  325. tabBarExtraContent={
  326. <div style={{fontWeight:'bold',paddingRight:'15px'}}>
  327. <span>
  328. 项目名称:
  329. <span style={{color:'#F00',paddingRight:'5px'}}>{this.props.taskName}</span>
  330. </span>
  331. <span style={{marginLeft:'15px'}}>
  332. 项目编号:
  333. <span style={{color:'#F00',paddingRight:'5px'}}>
  334. {this.props.taskID}
  335. </span>
  336. </span>
  337. <OrderItemStatus deleteSign={this.state.deleteSign}/>
  338. </div>
  339. }
  340. >
  341. <TabPane tab="外包/供应商信息" key="1">
  342. {this.state.activeKey === '1' ? <CheckProject
  343. {...this.props}
  344. tid={this.props.tid}
  345. sort={this.state.sort}
  346. patentTypeName={this.state.patentTypeName} //官费类型
  347. patentTypeId={this.state.patentTypeId}
  348. commodityQuantity={this.state.commodityQuantity} //项目数量
  349. checkStatus={this.state.checkStatus} //核对状态
  350. orderTaskCostReduction={this.state.orderTaskCostReduction} //是否含费减 0无1有
  351. oldInfor={this.state.oldInfor}
  352. orderTaskOfficialCost={this.state.orderTaskOfficialCost} //是否含官费 0无1有
  353. containOfficialFees={this.state.containOfficialFees} //0:实际已缴费 1:实际未缴费
  354. status={this.state.refundStatus}
  355. mid={this.state.mid}
  356. patentNameType={this.state.orderDtails.patentNameType}
  357. patentName={this.state.orderDtails.patentName}
  358. patentType={this.state.orderDtails.patentType}
  359. projectType={this.props.projectType}
  360. projectStatus={this.props.projectStatus}
  361. thirdInfoList={this.state.thirdInfoList}
  362. dataSource={this.state.payNodeList}
  363. outsourceRemarks={this.state.outsourceRemarks}
  364. fileList={this.state.pictureUrl}
  365. startType={this.state.startType}
  366. onRefresh={()=>{
  367. this.waiDetail();
  368. this.thirdTable(this.props.tid);
  369. this.payNodeTable(this.props.tid);
  370. this.xiangqing(this.props.tid);
  371. this.props.refreshList && this.props.refreshList();
  372. }}
  373. /> : <div/>}
  374. </TabPane>
  375. <TabPane tab="项目概况" key="2">
  376. <ProjectOverview projectStatus={this.props.projectStatus} tid={this.props.tid} taskName={this.props.taskName}/>
  377. </TabPane>
  378. </Tabs>
  379. </Modal>
  380. )
  381. }
  382. }
  383. export default DetailsModal;