index.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736
  1. <template>
  2. <zj-page-container>
  3. <zj-page-fill class="neibuview">
  4. <template v-if="payData.length">
  5. <zj-form-container>
  6. <template v-for="(item, index) in payData">
  7. <zj-form-module
  8. :title="'支付费用' + (index + 1)"
  9. :form-data="payData[index]"
  10. :form-items="
  11. [formItemsL1, formItems(item)][!!~[1, 2, 3].indexOf(workOrderType) ? 0 : workOrderType == 4 ? 1 : 0]
  12. "
  13. >
  14. <div v-if="item.examineStatus === 'FAIL'" style="text-align: right">
  15. <el-button size="mini" type="danger" plain @click="enginMaterialCancelFun(item)">取消申请</el-button>
  16. </div>
  17. </zj-form-module>
  18. </template>
  19. </zj-form-container>
  20. </template>
  21. <el-empty v-else description="暂时没有支付信息"></el-empty>
  22. </zj-page-fill>
  23. </zj-page-container>
  24. </template>
  25. <script>
  26. import { listPageV2 } from '@/api/workOrder/appraise'
  27. import { tableDataParsing } from '@/utils/common.js'
  28. import { changeOrderGetOrderList, enginMaterialDetailWorker, enginMaterialCancel } from '@/api/workOrderPool.js'
  29. import { orderBaseDetail } from '@/api/workOrderPool.js'
  30. export default {
  31. props: {
  32. id: {
  33. type: [String, Number],
  34. default: null
  35. },
  36. workOrderType: {
  37. type: Number,
  38. default: 1 // 1普通工单, 4维保工单
  39. }
  40. },
  41. data() {
  42. return {
  43. payData: [],
  44. orderBaseDetail: {}
  45. }
  46. },
  47. watch: {
  48. id: {
  49. handler(newVal, oldVal) {
  50. this.getxiangqing()
  51. },
  52. deep: true,
  53. immediate: true
  54. }
  55. },
  56. computed: {
  57. formItemsL1() {
  58. return [
  59. {
  60. md: 24,
  61. name: 'slot-component',
  62. formItemAttributes: {
  63. label: '费用信息'
  64. },
  65. render: (h, { props, onInput }) => {
  66. var { formData } = props
  67. return (
  68. <el-descriptions
  69. border
  70. title=""
  71. column={3}
  72. colon={false}
  73. labelStyle={{ width: '11%' }}
  74. contentStyle={{ width: '22.3%' }}
  75. >
  76. <el-descriptions-item label="网点名称">{formData.websitName}</el-descriptions-item>
  77. <el-descriptions-item label="工单号">{formData.workerOrderId}</el-descriptions-item>
  78. <el-descriptions-item label="工程师名称">{formData.workerName}</el-descriptions-item>
  79. <el-descriptions-item label="工程师联系电话">{formData.workerMobile}</el-descriptions-item>
  80. <el-descriptions-item label="支付方式">
  81. {{ WECHAT: '微信支付', LINE: '线下支付', EXAMINE: '审批' }[formData.payType] || '微信支付'}
  82. </el-descriptions-item>
  83. <el-descriptions-item label="客户名称">{formData.pgOrderBase.userName}</el-descriptions-item>
  84. <el-descriptions-item label="电话号码">{formData.userMobile}</el-descriptions-item>
  85. <el-descriptions-item label="支付状态">
  86. {{ CANCEL: '取消', WAIT: '待支付', PAID: '已支付' }[formData.payStatus]}
  87. </el-descriptions-item>
  88. <el-descriptions-item label="支付总金额">{formData.totalAmount}</el-descriptions-item>
  89. {!!~[1, 2, 3].indexOf(this?.workOrderType) ? (
  90. <el-descriptions-item label="总手续费">{formData.commissionAmount}</el-descriptions-item>
  91. ) : null}
  92. <el-descriptions-item label="支付时间">{formData.payTime}</el-descriptions-item>
  93. <el-descriptions-item label=""></el-descriptions-item>
  94. {this?.workOrderType == 4
  95. ? [
  96. <el-descriptions-item label=""></el-descriptions-item>,
  97. <el-descriptions-item label="审批状态">
  98. {{ WAIT: '待审', OK: '审批', FAIL: '驳回', NO: '取消' }[formData.examineStatus] || ''}
  99. </el-descriptions-item>,
  100. <el-descriptions-item label="审批人">{formData.examineName}</el-descriptions-item>,
  101. <el-descriptions-item label="审批时间">{formData.examineTime}</el-descriptions-item>
  102. ]
  103. : null}
  104. </el-descriptions>
  105. )
  106. }
  107. },
  108. {
  109. md: 24,
  110. name: 'slot-component',
  111. formItemAttributes: {
  112. label: '支付明细'
  113. },
  114. render: (h, { props, onInput }) => {
  115. var { formData } = props
  116. return (
  117. <zj-table
  118. columns={[
  119. {
  120. columnAttributes: {
  121. label: '费用名称',
  122. prop: 'goodsName'
  123. }
  124. },
  125. {
  126. columnAttributes: {
  127. label: '单价',
  128. prop: 'goodsAmount'
  129. }
  130. },
  131. {
  132. columnAttributes: {
  133. label: '数量',
  134. prop: 'num'
  135. }
  136. },
  137. {
  138. columnAttributes: {
  139. label: '费用金额',
  140. prop: 'totalAmount'
  141. }
  142. },
  143. ...(() => {
  144. if (!!~[1, 2, 3].indexOf(this?.workOrderType)) {
  145. return [
  146. {
  147. columnAttributes: {
  148. label: '师傅分账金额',
  149. prop: 'workerAmount'
  150. }
  151. },
  152. {
  153. columnAttributes: {
  154. label: '师傅手续费',
  155. prop: 'workerProceAmount'
  156. }
  157. },
  158. {
  159. columnAttributes: {
  160. label: '网点分账金额',
  161. prop: 'websitAmount'
  162. }
  163. },
  164. {
  165. columnAttributes: {
  166. label: '网点手续费',
  167. prop: 'websitProceAmount'
  168. }
  169. }
  170. ]
  171. }
  172. return []
  173. })()
  174. ]}
  175. table-data={
  176. [formData.workerOrderItems, formData.rpMaterialOrderItems][
  177. !!~[1, 2, 3].indexOf(this?.workOrderType) ? 0 : this?.workOrderType == 4 ? 1 : 0
  178. ]
  179. }
  180. />
  181. )
  182. }
  183. },
  184. {
  185. name: 'el-input',
  186. md: 24,
  187. attributes: { disabled: true, type: 'textarea', placeholder: '' },
  188. formItemAttributes: { label: '备注', prop: 'remark' }
  189. },
  190. {
  191. md: 24,
  192. name: 'slot-component',
  193. formItemAttributes: {
  194. label: '交易记录'
  195. },
  196. render: (h, { props, onInput }) => {
  197. var { formData } = props
  198. return (
  199. <zj-table
  200. columns={[
  201. {
  202. columnAttributes: {
  203. label: 'id',
  204. prop: 'orderId'
  205. }
  206. },
  207. {
  208. columnAttributes: {
  209. label: '交易类型',
  210. prop: 'goodsType'
  211. },
  212. render: (h, { row }) => {
  213. return <div>{{ M: '辅材', P: '配件' }[row.goodsType]}</div>
  214. }
  215. },
  216. {
  217. columnAttributes: {
  218. label: '交易金额',
  219. prop: 'totalAmount'
  220. }
  221. },
  222. {
  223. columnAttributes: {
  224. label: '交易状态',
  225. prop: 'payStatus'
  226. },
  227. render: (h, { row }) => {
  228. return <div>{{ CANCEL: '取消', WAIT: '待支付', PAID: '已支付' }[row.payStatus]}</div>
  229. }
  230. },
  231. {
  232. columnAttributes: {
  233. label: '交易时间',
  234. prop: 'payTime'
  235. }
  236. },
  237. {
  238. columnAttributes: {
  239. label: '创建时间',
  240. prop: 'createTime'
  241. }
  242. }
  243. ]}
  244. table-data={[formData]}
  245. />
  246. )
  247. }
  248. },
  249. {
  250. isShow: this.orderBaseDetail.orderType == 'REPAIR',
  251. md: 24,
  252. name: 'slot-component',
  253. formItemAttributes: {
  254. label: '配件信息'
  255. },
  256. render: (h, { props, onInput }) => {
  257. var { formData } = props
  258. return (
  259. <zj-table
  260. columns={[
  261. {
  262. columnAttributes: {
  263. label: '维修标识',
  264. prop: 'repairFlag'
  265. },
  266. render: (h, { row }) => {
  267. return <div>{{ INNER: '保内', OUTSIDE: '保外' }[row.repairFlag]}</div>
  268. }
  269. },
  270. {
  271. columnAttributes: {
  272. label: '旧配件编号',
  273. prop: 'oldPartsNumber'
  274. }
  275. },
  276. {
  277. columnAttributes: {
  278. label: '旧配件名称',
  279. prop: 'oldPartsName'
  280. }
  281. },
  282. {
  283. columnAttributes: {
  284. label: '新配件编号',
  285. prop: 'goodsCode'
  286. }
  287. },
  288. {
  289. columnAttributes: {
  290. label: '新配件名称',
  291. prop: 'goodsName'
  292. }
  293. }
  294. ]}
  295. table-data={formData.workerOrderItems || []}
  296. />
  297. )
  298. }
  299. },
  300. {
  301. md: 24,
  302. name: 'slot-component',
  303. formItemAttributes: {
  304. label: '其它费用表'
  305. },
  306. render: (h, { props, onInput }) => {
  307. var { formData } = props
  308. return (
  309. <zj-table
  310. columns={[
  311. {
  312. columnAttributes: {
  313. label: '费用名称',
  314. prop: 'amountName'
  315. }
  316. },
  317. {
  318. columnAttributes: {
  319. label: '费用金额',
  320. prop: 'normAmount'
  321. }
  322. },
  323. {
  324. columnAttributes: {
  325. label: '师傅分账金额',
  326. prop: 'sffzje'
  327. }
  328. },
  329. {
  330. columnAttributes: {
  331. label: '师傅手续费',
  332. prop: 'sfsxf'
  333. }
  334. }
  335. ]}
  336. table-data={formData.gengduofeiyong || []}
  337. />
  338. )
  339. }
  340. }
  341. ]
  342. }
  343. },
  344. methods: {
  345. formItems(itemData) {
  346. return [
  347. {
  348. md: 24,
  349. name: 'slot-component',
  350. formItemAttributes: {
  351. label: '基本信息'
  352. },
  353. render: (h, { props, onInput }) => {
  354. var { formData } = props
  355. return (
  356. <el-descriptions
  357. border
  358. title=""
  359. column={2}
  360. colon={false}
  361. labelStyle={{ width: '13%' }}
  362. contentStyle={{ width: '37%' }}
  363. >
  364. <el-descriptions-item label="申请单号">{formData.orderId}</el-descriptions-item>
  365. <el-descriptions-item label="项目名称">{formData.rpProjectRepairName}</el-descriptions-item>
  366. <el-descriptions-item label="工单单号">{formData.workerOrderId}</el-descriptions-item>
  367. <el-descriptions-item label="负责人">{formData.userName}</el-descriptions-item>
  368. <el-descriptions-item label="联系电话">{formData.userMobile}</el-descriptions-item>
  369. <el-descriptions-item label="项目地址">{formData.pgOrderBase.address}</el-descriptions-item>
  370. <el-descriptions-item label="创单人">{formData.pgOrderBase.createBy}</el-descriptions-item>
  371. <el-descriptions-item label="创单人电话">{formData.pgOrderBase.createMobile}</el-descriptions-item>
  372. <el-descriptions-item label="创单时间">{formData.pgOrderBase.createTime}</el-descriptions-item>
  373. <el-descriptions-item label="工单类型">{formData.orderSmallTypeText}</el-descriptions-item>
  374. <el-descriptions-item label="网点名称">{formData.websitName}</el-descriptions-item>
  375. <el-descriptions-item label="申请人">{formData.workerName}</el-descriptions-item>
  376. <el-descriptions-item label="联系电话">{formData.workerMobile}</el-descriptions-item>
  377. <el-descriptions-item label="申请时间">{formData.createTime}</el-descriptions-item>
  378. <el-descriptions-item label="包含全部费用">
  379. {{ YES: '是', NO: '否' }[formData.isAllFee]}
  380. </el-descriptions-item>
  381. {formData.isAllFee == 'NO' || formData.payType == 'WECHAT' || formData.payType == 'LINE' ? (
  382. <el-descriptions-item label="费用支付方式">
  383. {{ EXAMINE: '审批后结算', SITE: '现场支付' }[formData.feePayMethod]}
  384. </el-descriptions-item>
  385. ) : null}
  386. {(formData.isAllFee == 'NO' || formData.payType == 'WECHAT') && formData.feePayMethod == 'EXAMINE'
  387. ? [
  388. <el-descriptions-item label="费用单状态">
  389. {
  390. { WAIT: '待审', OK: '通过', FAIL: '驳回', PAID: '现场支付', NO: '取消', NO_PAID: '未支付' }[
  391. formData.examineStatus
  392. ]
  393. }
  394. </el-descriptions-item>,
  395. <el-descriptions-item label="审批人">{formData.examineName}</el-descriptions-item>,
  396. <el-descriptions-item label="审批时间">{formData.examineTime}</el-descriptions-item>,
  397. <el-descriptions-item label="取消人">{formData.cancelName}</el-descriptions-item>,
  398. <el-descriptions-item label="取消时间">{formData.cancelTime}</el-descriptions-item>
  399. ]
  400. : null}
  401. {formData.payType == 'LINE' && formData.feePayMethod == 'EXAMINE'
  402. ? [
  403. <el-descriptions-item label="结算状态">
  404. {{ WAIT: '待结算', OVER: '已结算' }[formData.status]}
  405. </el-descriptions-item>,
  406. <el-descriptions-item label="结算人">{formData.settleName}</el-descriptions-item>,
  407. <el-descriptions-item label="结算时间">{formData.settleTime}</el-descriptions-item>
  408. ]
  409. : null}
  410. </el-descriptions>
  411. )
  412. }
  413. },
  414. {
  415. md: 24,
  416. name: 'slot-component',
  417. formItemAttributes: {
  418. label: '费用明细'
  419. },
  420. render: (h, { props, onInput }) => {
  421. var { formData } = props
  422. return (
  423. <zj-table
  424. columns={[
  425. {
  426. columnAttributes: {
  427. label: '费用名称',
  428. prop: 'goodsName'
  429. }
  430. },
  431. {
  432. columnAttributes: {
  433. label: '费用类型',
  434. prop: 'chargeType'
  435. },
  436. render: (h, { row, column, index }) => {
  437. return (
  438. <div style="padding-left:10px">
  439. {{ MCC: '辅材物料', ACC: '配件物料', SERV: '服务收费' }[row.chargeType]}
  440. </div>
  441. )
  442. }
  443. },
  444. {
  445. columnAttributes: {
  446. label: '单价',
  447. prop: 'goodsAmount'
  448. }
  449. },
  450. {
  451. columnAttributes: {
  452. label: '数量',
  453. prop: 'num'
  454. }
  455. },
  456. {
  457. columnAttributes: {
  458. label: '费用金额',
  459. prop: 'totalAmount'
  460. }
  461. }
  462. ]}
  463. table-data={formData.rpMaterialOrderItems}
  464. />
  465. )
  466. }
  467. },
  468. {
  469. md: 8,
  470. isShow: itemData.goodsType == 'M',
  471. name: 'slot-component',
  472. formItemAttributes: {
  473. label: '辅材费用合计'
  474. },
  475. render: (h, { props, onInput }) => {
  476. var { formData } = props
  477. return (
  478. <span>
  479. {[
  480. 0,
  481. 0,
  482. 0,
  483. ...formData.rpMaterialOrderItems
  484. .filter(item => item.chargeType == 'MCC')
  485. .map(item => item.totalAmount)
  486. ]
  487. .reduce(function (prev, curr, idx, arr) {
  488. return prev + curr
  489. })
  490. .toFixed(2)}
  491. </span>
  492. )
  493. }
  494. },
  495. {
  496. md: 8,
  497. isShow: itemData.goodsType == 'P',
  498. name: 'slot-component',
  499. formItemAttributes: {
  500. label: '配件费用合计'
  501. },
  502. render: (h, { props, onInput }) => {
  503. var { formData } = props
  504. return (
  505. <span>
  506. {[
  507. 0,
  508. 0,
  509. 0,
  510. ...formData.rpMaterialOrderItems
  511. .filter(item => item.chargeType == 'ACC')
  512. .map(item => item.totalAmount)
  513. ]
  514. .reduce(function (prev, curr, idx, arr) {
  515. return prev + curr
  516. })
  517. .toFixed(2)}
  518. </span>
  519. )
  520. }
  521. },
  522. {
  523. md: 8,
  524. name: 'slot-component',
  525. formItemAttributes: {
  526. label: '服务收费费用合计'
  527. },
  528. render: (h, { props, onInput }) => {
  529. var { formData } = props
  530. return (
  531. <span>
  532. {[
  533. 0,
  534. 0,
  535. 0,
  536. ...formData.rpMaterialOrderItems
  537. .filter(item => item.chargeType == 'SERV')
  538. .map(item => item.totalAmount)
  539. ]
  540. .reduce(function (prev, curr, idx, arr) {
  541. return prev + curr
  542. })
  543. .toFixed(2)}
  544. </span>
  545. )
  546. }
  547. },
  548. {
  549. md: 8,
  550. name: 'slot-component',
  551. formItemAttributes: {
  552. label: '总金额'
  553. },
  554. render: (h, { props, onInput }) => {
  555. var { formData } = props
  556. return (
  557. <span>
  558. {[0, 0, 0, ...formData.rpMaterialOrderItems.map(item => item.totalAmount)]
  559. .reduce(function (prev, curr, idx, arr) {
  560. return prev + curr
  561. })
  562. .toFixed(2)}
  563. </span>
  564. )
  565. }
  566. },
  567. {
  568. name: 'el-input',
  569. md: 24,
  570. attributes: { disabled: true, type: 'textarea', placeholder: '' },
  571. formItemAttributes: { label: '申请备注', prop: 'remark' }
  572. },
  573. {
  574. md: 24,
  575. isShow: itemData.payType == 'WECHAT',
  576. name: 'slot-component',
  577. formItemAttributes: {
  578. label: '交易记录'
  579. },
  580. render: (h, { props, onInput }) => {
  581. var { formData } = props
  582. return (
  583. <zj-table
  584. columns={[
  585. {
  586. columnAttributes: {
  587. label: 'id',
  588. prop: 'orderId'
  589. }
  590. },
  591. {
  592. columnAttributes: {
  593. label: '交易类型',
  594. prop: 'goodsType'
  595. },
  596. render: (h, { row }) => {
  597. return <div>{{ M: '辅材', P: '配件' }[row.goodsType]}</div>
  598. }
  599. },
  600. {
  601. columnAttributes: {
  602. label: '交易金额',
  603. prop: 'totalAmount'
  604. }
  605. },
  606. {
  607. columnAttributes: {
  608. label: '交易状态',
  609. prop: 'payStatus'
  610. },
  611. render: (h, { row }) => {
  612. return <div>{{ CANCEL: '取消', WAIT: '待支付', PAID: '已支付' }[row.payStatus]}</div>
  613. }
  614. },
  615. {
  616. columnAttributes: {
  617. label: '交易时间',
  618. prop: 'payTime'
  619. }
  620. },
  621. {
  622. columnAttributes: {
  623. label: '创建时间',
  624. prop: 'createTime'
  625. }
  626. }
  627. ]}
  628. table-data={[formData]}
  629. />
  630. )
  631. }
  632. }
  633. ]
  634. },
  635. getxiangqing() {
  636. if (this.id) {
  637. orderBaseDetail({
  638. orderBaseId: this.id
  639. }).then(resData => {
  640. this.orderBaseDetail = resData.data
  641. if (!!~[1, 2, 3].indexOf(this?.workOrderType)) {
  642. changeOrderGetOrderList({
  643. id: this.id
  644. }).then(res => {
  645. this.payData = res.data.map(item => {
  646. return {
  647. ...item,
  648. gengduofeiyong: [
  649. {
  650. chargeType: 'SERV',
  651. amountName: '服务费用',
  652. normAmount: item.servicePrice || 0,
  653. sfsxf: Math.ceil((item.servicePrice || 0) * 0.6) / 100,
  654. sffzje: item.servicePrice - Math.ceil((item.servicePrice || 0) * 0.6) / 100
  655. },
  656. {
  657. chargeType: 'SERV',
  658. amountName: '其他费用',
  659. normAmount: item.otherPrice || 0,
  660. sfsxf: Math.ceil((item.otherPrice || 0) * 0.6) / 100,
  661. sffzje: item.otherPrice - Math.ceil((item.otherPrice || 0) * 0.6) / 100
  662. }
  663. ]
  664. }
  665. })
  666. console.log(this.payData)
  667. })
  668. } else if (this?.workOrderType == 4) {
  669. enginMaterialDetailWorker({
  670. workerOrderId: this.id
  671. }).then(res => {
  672. this.payData = res.data.map(item => {
  673. return {
  674. ...item,
  675. gengduofeiyong: [
  676. {
  677. chargeType: 'SERV',
  678. amountName: '服务费用',
  679. normAmount: item.servicePrice || 0,
  680. sfsxf: Math.ceil((item.servicePrice || 0) * 0.6) / 100,
  681. sffzje: item.servicePrice - Math.ceil((item.servicePrice || 0) * 0.6) / 100
  682. },
  683. {
  684. chargeType: 'SERV',
  685. amountName: '其他费用',
  686. normAmount: item.otherPrice || 0,
  687. sfsxf: Math.ceil((item.otherPrice || 0) * 0.6) / 100,
  688. sffzje: item.otherPrice - Math.ceil((item.otherPrice || 0) * 0.6) / 100
  689. }
  690. ]
  691. }
  692. })
  693. console.log(this.payData)
  694. })
  695. }
  696. })
  697. }
  698. },
  699. enginMaterialCancelFun(item) {
  700. this.$confirm('是否确认取消申请?', '提示', {
  701. confirmButtonText: '确定',
  702. cancelButtonText: '取消',
  703. type: 'warning'
  704. })
  705. .then(() => {
  706. enginMaterialCancel({
  707. id: item.orderId
  708. }).then(res => {
  709. this.getxiangqing()
  710. })
  711. })
  712. .catch(() => {})
  713. }
  714. }
  715. }
  716. </script>
  717. <style lang="scss" scoped>
  718. .neibuview {
  719. box-sizing: border-box;
  720. padding-left: 16px;
  721. ::v-deep & > .zj-page-fill-scroll {
  722. box-sizing: border-box;
  723. padding-right: 16px;
  724. & > div:nth-child(1) {
  725. margin-top: 20px;
  726. }
  727. }
  728. }
  729. </style>