financeManager.vue 38 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243
  1. <template>
  2. <div class="m-container">
  3. <h2>
  4. <div class="squrt"></div>
  5. 财务管理
  6. </h2>
  7. <div class="m-core">
  8. <div
  9. class="newBand"
  10. v-permission="{ child: 'routeOrder/add', parent: '/financeManager' }"
  11. @click="
  12. () => {
  13. routeOrderStatus = true;
  14. (isAdd = true), (form.applyType = null);
  15. }
  16. "
  17. >
  18. 添加订单
  19. </div>
  20. <div
  21. class="newBand"
  22. @click="onOrderExport"
  23. v-permission="{
  24. child: 'export/routeOrderList',
  25. parent: '/financeManager',
  26. }"
  27. >
  28. 报表导出
  29. </div>
  30. <div
  31. class="newBand"
  32. v-permission="{ child: 'adapay/exportBill', parent: '/financeManager' }"
  33. @click="onAdaPayExport"
  34. >
  35. 汇付订单导出
  36. </div>
  37. <div
  38. class="newBand"
  39. @click="onDownload"
  40. v-permission="'import/downloadTemplate?financeManager'"
  41. >
  42. 下载模板
  43. </div>
  44. <el-upload
  45. v-permission="'import/routeOrder'"
  46. style="display: inline-block; margin: 0 10px"
  47. action="/api-web/import/routeOrder"
  48. :show-file-list="false"
  49. :before-upload="beforeUpload"
  50. accept=".xlsx,.xls"
  51. :headers="headers"
  52. :on-error="handleError"
  53. :on-success="handleSuccess"
  54. >
  55. <div class="newBand">导入</div>
  56. </el-upload>
  57. <!-- 搜索类型 -->
  58. <save-form
  59. :inline="true"
  60. class="searchForm"
  61. ref="searchForm"
  62. :model.sync="searchForm"
  63. >
  64. <el-form-item>
  65. <el-input
  66. placeholder="学生编号/姓名/手机号"
  67. clearable
  68. type="text"
  69. v-model.trim="searchForm.search"
  70. ></el-input>
  71. </el-form-item>
  72. <el-form-item>
  73. <el-input
  74. placeholder="交易流水号"
  75. type="text"
  76. v-model.trim="searchForm.transNo"
  77. ></el-input>
  78. </el-form-item>
  79. <el-form-item>
  80. <el-input
  81. placeholder="订单号"
  82. type="text"
  83. v-model.trim="searchForm.orderNo"
  84. ></el-input>
  85. </el-form-item>
  86. <el-form-item>
  87. <el-input
  88. placeholder="收款账户"
  89. type="text"
  90. v-model.trim="searchForm.merNos"
  91. ></el-input>
  92. </el-form-item>
  93. <el-form-item>
  94. <el-input
  95. placeholder="余额支付大于等于"
  96. type="number"
  97. @mousewheel.native.prevent
  98. v-model.trim="searchForm.balancePaymentAmount"
  99. ></el-input>
  100. </el-form-item>
  101. <el-form-item>
  102. <el-input
  103. placeholder="现金支付大于等于"
  104. type="number"
  105. @mousewheel.native.prevent
  106. v-model.trim="searchForm.actualAmount"
  107. ></el-input>
  108. </el-form-item>
  109. <el-form-item>
  110. <el-input
  111. placeholder="余额支付小于等于"
  112. type="number"
  113. @mousewheel.native.prevent
  114. v-model.trim="searchForm.lessBalancePaymentAmount"
  115. ></el-input>
  116. </el-form-item>
  117. <el-form-item>
  118. <el-input
  119. placeholder="现金支付小于等于"
  120. type="number"
  121. @mousewheel.native.prevent
  122. v-model.trim="searchForm.lessActualAmount"
  123. ></el-input>
  124. </el-form-item>
  125. <el-form-item prop="routingOrganId">
  126. <el-select
  127. class="multiple"
  128. v-model.trim="searchForm.routingOrganId"
  129. filterable
  130. clearable
  131. @clear="onClear('routingOrganId')"
  132. placeholder="请选择分部"
  133. >
  134. <el-option
  135. v-for="(item, index) in selects.branchs"
  136. :key="index"
  137. :label="item.name"
  138. :value="item.id"
  139. ></el-option>
  140. </el-select>
  141. </el-form-item>
  142. <el-form-item>
  143. <el-date-picker
  144. v-model.trim="searchForm.orderDate"
  145. style="width: 410px"
  146. type="daterange"
  147. value-format="yyyy-MM-dd"
  148. @change="searchOrderDate"
  149. :picker-options="{
  150. firstDayOfWeek: 1,
  151. }"
  152. range-separator="至"
  153. start-placeholder="订单开始日期"
  154. end-placeholder="订单结束日期"
  155. ></el-date-picker>
  156. </el-form-item>
  157. <el-form-item>
  158. <el-select
  159. v-model.trim="searchForm.paymentType"
  160. clearable
  161. filterable
  162. @clear="onClear('paymentType')"
  163. placeholder="交易类型"
  164. >
  165. <el-option
  166. v-for="(item, index) in orderStatus"
  167. :key="index"
  168. :label="item.label"
  169. :value="item.value"
  170. ></el-option>
  171. </el-select>
  172. </el-form-item>
  173. <el-form-item>
  174. <el-select
  175. v-model.trim="searchForm.paymentStatus"
  176. clearable
  177. filterable
  178. @clear="onClear('paymentStatus')"
  179. placeholder="交易状态"
  180. >
  181. <el-option
  182. v-for="(item, index) in dealStatus"
  183. :key="index"
  184. :label="item.label"
  185. :value="item.value"
  186. ></el-option>
  187. </el-select>
  188. </el-form-item>
  189. <el-form-item>
  190. <el-button @click="search" type="danger">搜索</el-button>
  191. <el-button @click="onReSet" type="primary">重置</el-button>
  192. </el-form-item>
  193. </save-form>
  194. <!-- 列表 -->
  195. <div style="font-size: 14px; color: #f85043; padding-bottom: 10px">
  196. 营收金额:{{ totalRevenueAmount | moneyFormat }}元
  197. <i style="width: 10px; display: inline-block"></i>
  198. 实收金额:{{ totalActualAmount | moneyFormat }}元
  199. <i style="width: 10px; display: inline-block"></i>
  200. 预收金额:{{ totalAdvanceAmount | moneyFormat }}元
  201. <i style="width: 10px; display: inline-block"></i>
  202. 预收余额:{{ totalUserBalance | moneyFormat }}元
  203. </div>
  204. <div class="tableWrap">
  205. <el-table
  206. :data="tableList"
  207. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  208. >
  209. <el-table-column align="center" prop="transNo" label="交易流水号">
  210. <template slot-scope="scope">
  211. <div>
  212. <copy-text>{{ scope.row.transNo }}</copy-text>
  213. </div>
  214. </template>
  215. </el-table-column>
  216. <el-table-column align="center" prop="orderNo" label="订单号">
  217. <template slot-scope="scope">
  218. <div>
  219. <copy-text>{{ scope.row.orderNo }}</copy-text>
  220. </div>
  221. </template>
  222. </el-table-column>
  223. <el-table-column
  224. align="center"
  225. width="150"
  226. prop="createTime"
  227. label="订单日期"
  228. >
  229. <template slot-scope="scope">{{
  230. scope.row.createTime | dateForMinFormat
  231. }}</template>
  232. </el-table-column>
  233. <el-table-column align="center" width="100px" label="交易类型">
  234. <template slot-scope="scope">{{
  235. scope.row.type | orderType
  236. }}</template>
  237. </el-table-column>
  238. <el-table-column align="center" prop="expectAmount" label="应付金额">
  239. <template slot-scope="scope">
  240. <div>
  241. {{ scope.row.expectAmount | moneyFormat }}
  242. </div>
  243. </template>
  244. </el-table-column>
  245. <el-table-column
  246. align="center"
  247. prop="balancePaymentAmount"
  248. label="余额支付"
  249. >
  250. <template slot-scope="scope">
  251. <div>
  252. {{ scope.row.balancePaymentAmount | moneyFormat }}
  253. </div>
  254. </template>
  255. </el-table-column>
  256. <el-table-column align="center" prop="actualAmount" label="现金支付">
  257. <template slot-scope="scope">
  258. <div>
  259. {{ scope.row.actualAmount | moneyFormat }}
  260. </div>
  261. </template>
  262. </el-table-column>
  263. <el-table-column align="center" prop="routeAmount" label="分润金额">
  264. <template slot-scope="scope">
  265. <div>
  266. {{ scope.row.routeAmount | moneyFormat }}
  267. </div>
  268. </template>
  269. </el-table-column>
  270. <el-table-column
  271. align="center"
  272. prop="routeBalanceAmount"
  273. label="分润余额"
  274. >
  275. <template slot-scope="scope">
  276. <div>
  277. {{ scope.row.routeBalanceAmount | moneyFormat }}
  278. </div>
  279. </template>
  280. </el-table-column>
  281. <el-table-column align="center" label="学员姓名" width="130px">
  282. <template slot-scope="scope">
  283. <div>
  284. <!-- v-if="scope.row.type !== 'OUTORDER'" -->
  285. <div>
  286. <p><copy-text> {{ scope.row.user.username }}</copy-text></p>
  287. <copy-text>{{ scope.row.user.phone }}</copy-text>
  288. </div>
  289. </div>
  290. </template>
  291. </el-table-column>
  292. <el-table-column
  293. align="center"
  294. prop="paymentChannel"
  295. label="交易方式"
  296. >
  297. <template slot-scope="scope">{{
  298. scope.row.paymentChannel | paymentChannelStatus
  299. }}</template>
  300. </el-table-column>
  301. <!-- <el-table-column align="center"
  302. label="收款账户">
  303. <template slot-scope="scope">{{ scope.row.merNo }}</template>
  304. </el-table-column> -->
  305. <el-table-column align="center" label="交易状态">
  306. <template slot-scope="scope">{{
  307. scope.row.status | dealStatus
  308. }}</template>
  309. </el-table-column>
  310. <el-table-column align="center" label="备注">
  311. <template slot-scope="scope">{{
  312. scope.row.memo ? scope.row.memo : "-"
  313. }}</template>
  314. </el-table-column>
  315. <el-table-column
  316. align="center"
  317. fixed="right"
  318. width="150px"
  319. label="操作"
  320. >
  321. <template slot-scope="scope">
  322. <div v-if="scope.row.groupType == 'OUTORDER'">
  323. <el-button type="text" @click="lookOrderInfo(scope.row)"
  324. >查看</el-button
  325. >
  326. <!-- <el-button type="text" @click="removeOrderInfo(scope.row)"
  327. >删除</el-button
  328. > -->
  329. </div>
  330. </template>
  331. </el-table-column>
  332. </el-table>
  333. <pagination
  334. :total.sync="pageInfo.total"
  335. sync
  336. :page.sync="pageInfo.page"
  337. :limit.sync="pageInfo.limit"
  338. :page-sizes="pageInfo.page_size"
  339. @pagination="getList"
  340. />
  341. </div>
  342. <el-dialog
  343. :title="isAdd ? '添加订单' : '查看'"
  344. destroy-on-close
  345. :visible.sync="routeOrderStatus"
  346. @close="onFormClose('ruleForm')"
  347. width="600px"
  348. >
  349. <el-form :model="form" :rules="rules" ref="ruleForm">
  350. <div class="lookTitle">基本信息</div>
  351. <el-form-item
  352. label="所属分部"
  353. prop="routeOrganId"
  354. :rules="[
  355. { required: true, message: '请选择分部', trigger: 'change' },
  356. ]"
  357. :label-width="formLabelWidth"
  358. >
  359. <el-select
  360. v-model.trim="form.routeOrganId"
  361. :disabled="!isAdd"
  362. @change="changeOrgin"
  363. style="width: 100% !important"
  364. >
  365. <el-option
  366. v-for="(item, index) in selects.branchs"
  367. :key="index"
  368. :label="item.name"
  369. :value="item.id"
  370. ></el-option>
  371. </el-select>
  372. </el-form-item>
  373. <el-form-item
  374. label="所属学校"
  375. prop="schoolId"
  376. :label-width="formLabelWidth"
  377. >
  378. <el-select
  379. v-model="form.schoolId"
  380. :disabled="!isAdd"
  381. @change="checkSchool"
  382. style="width: 100% !important"
  383. >
  384. <el-option
  385. v-for="(item, index) in cooperationList"
  386. :key="index"
  387. :label="item.name"
  388. :value="item.id"
  389. ></el-option>
  390. </el-select>
  391. </el-form-item>
  392. <el-form-item
  393. label="缴费单号"
  394. prop="calenderId"
  395. :label-width="formLabelWidth"
  396. >
  397. <el-input
  398. v-model.trim="form.calenderId"
  399. :disabled="!isAdd"
  400. placeholder="请输入缴费单号"
  401. ></el-input>
  402. </el-form-item>
  403. <el-form-item
  404. label="学员编号"
  405. prop="userId"
  406. :label-width="formLabelWidth"
  407. >
  408. <el-input
  409. v-model.trim="form.userId"
  410. :disabled="!isAdd"
  411. placeholder="请输入学员编号"
  412. ></el-input>
  413. </el-form-item>
  414. <div class="lookTitle">交易信息</div>
  415. <el-form-item
  416. label="交易流水号"
  417. prop="transNo"
  418. :label-width="formLabelWidth"
  419. >
  420. <el-input
  421. placeholder="请输入交易流水号"
  422. type="text"
  423. :disabled="!isAdd"
  424. v-model.trim="form.transNo"
  425. ></el-input>
  426. </el-form-item>
  427. <el-form-item
  428. label="收款账户"
  429. prop="merNo"
  430. :label-width="formLabelWidth"
  431. >
  432. <el-input
  433. placeholder="请输入收款账户"
  434. type="text"
  435. :disabled="!isAdd"
  436. v-model.trim="form.merNo"
  437. ></el-input>
  438. </el-form-item>
  439. <el-form-item
  440. label="交易日期"
  441. prop="payTime"
  442. :label-width="formLabelWidth"
  443. >
  444. <el-date-picker
  445. style="width: 100%"
  446. :disabled="!isAdd"
  447. v-model="form.payTime"
  448. type="datetime"
  449. format="yyyy-MM-dd HH:mm:ss"
  450. value-format="yyyy-MM-dd HH:mm:ss"
  451. placeholder="选择交易日期"
  452. >
  453. </el-date-picker>
  454. </el-form-item>
  455. <el-form-item
  456. label="收入类型"
  457. v-if="isAdd"
  458. :label-width="formLabelWidth"
  459. prop="applyType"
  460. >
  461. <el-select
  462. class="multiple"
  463. style="width: 100% !important"
  464. v-model.trim="form.applyType"
  465. @change="changeApplyType"
  466. filterable
  467. clearable
  468. :disabled="!isAdd"
  469. placeholder="请选择收入类型"
  470. >
  471. <el-option
  472. v-for="(item, index) in orderServerList"
  473. :key="index"
  474. :label="item.label"
  475. :value="item.value"
  476. ></el-option>
  477. </el-select>
  478. </el-form-item>
  479. <div v-if="form.applyType == 'SELL'">
  480. <div v-for="(goodsList, index) in form.goodsList" :key="index" class="shopListWrap">
  481. <el-form-item
  482. :label="'商品名称' + (index + 1)"
  483. :label-width="formLabelWidth"
  484. class="setWidth"
  485. :prop="'goodsList.' + index + '.id'"
  486. :rules="[
  487. { required: true, message: '请选择商品', trigger: 'change' },
  488. ]"
  489. >
  490. <el-select
  491. v-if="isAdd"
  492. v-model.trim="goodsList.id"
  493. filterable
  494. :disabled="!isAdd"
  495. @change="checkgoods"
  496. placeholder="请选择商品"
  497. >
  498. <el-option
  499. v-for="(item, index) in shopList"
  500. :key="index"
  501. :label="item.name"
  502. :value="item.id"
  503. ></el-option>
  504. </el-select>
  505. <p class="showShop" v-else>
  506. <Tooltip :content="goodsList.id | filterShopId" />
  507. </p>
  508. </el-form-item>
  509. <el-form-item
  510. class="setWidth"
  511. style="margin:0 10px"
  512. :prop="'goodsList.' + index + '.number'"
  513. :rules="validAmount"
  514. >
  515. <!-- <el-input-number style="width: 160px;" v-model="goodsList.number" placeholder="商品数量"></el-input-number> -->
  516. <el-input
  517. type="age"
  518. style="width: 160px"
  519. :disabled="!isAdd"
  520. clearable
  521. placeholder="请输入商品数量"
  522. @mousewheel.native.prevent
  523. v-model.number="goodsList.number"
  524. ></el-input>
  525. </el-form-item>
  526. <el-button
  527. icon="el-icon-minus"
  528. :disabled="!isAdd"
  529. v-if="form.goodsList.length > 1"
  530. circle
  531. style="height:40px;"
  532. @click.prevent="removeGoodsList(goodsList)"
  533. ></el-button>
  534. <el-button
  535. icon="el-icon-plus"
  536. :disabled="!isAdd"
  537. @click.prevent="addGoodsList"
  538. circle
  539. style="margin-left: 5px; height:40px;"
  540. ></el-button>
  541. </div>
  542. </div>
  543. <el-form-item
  544. label="销售金额"
  545. v-if="form.applyType == 'SELL' || !isAdd"
  546. prop="saleAmount"
  547. :label-width="formLabelWidth"
  548. >
  549. <el-input
  550. v-model="form.saleAmount"
  551. @mousewheel.native.prevent
  552. type="number"
  553. :disabled="!isAdd"
  554. placeholder="请输入销售金额"
  555. />
  556. </el-form-item>
  557. <el-form-item
  558. label="服务金额"
  559. v-if="form.applyType == 'SERVICE' || !isAdd"
  560. prop="serviceAmount"
  561. :label-width="formLabelWidth"
  562. >
  563. <el-input
  564. type="number"
  565. @mousewheel.native.prevent
  566. :disabled="!isAdd"
  567. v-model="form.serviceAmount"
  568. placeholder="请输入收入金额"
  569. />
  570. </el-form-item>
  571. <div class="lookTitle">其它</div>
  572. <el-form-item label="备注" prop="memo" :label-width="formLabelWidth">
  573. <el-input
  574. placeholder="请输入备注"
  575. :disabled="!isAdd"
  576. v-model.trim="form.memo"
  577. type="textarea"
  578. :rows="3"
  579. ></el-input>
  580. </el-form-item>
  581. </el-form>
  582. <span slot="footer" class="dialog-footer">
  583. <el-button @click="routeOrderStatus = false">取 消</el-button>
  584. <el-button
  585. v-if="!isAdd"
  586. @click="routeOrderStatus = false"
  587. type="primary"
  588. >确 定</el-button
  589. >
  590. <el-button v-else @click="onOrderSubmit('ruleForm')" type="primary"
  591. >确 定</el-button
  592. >
  593. </span>
  594. </el-dialog>
  595. </div>
  596. </div>
  597. </template>
  598. <script>
  599. import pagination from "@/components/Pagination/index";
  600. import {
  601. routeOrderFinance,
  602. routeOrderAdd,
  603. getOrderInfo,
  604. orderDelete,
  605. } from "@/api/orderManager";
  606. import { goodsQuery } from "@/api/businessManager";
  607. import { getEmployeeOrgan, getAddress, getCooperation } from "@/api/buildTeam";
  608. // import store from '@/store'
  609. import { orderStatus, dealStatus } from "@/utils/searchArray";
  610. import cleanDeep from "clean-deep";
  611. import axios from "axios";
  612. import qs from "qs";
  613. import { getToken } from "@/utils/auth";
  614. import load from "@/utils/loading";
  615. import { orderServerList } from "@/utils/searchArray";
  616. import { Export } from "@/utils/downLoadFile";
  617. import Tooltip from "@/components/Tooltip/index";
  618. let validAmount = (rule, value, callback) => {
  619. if (!value) {
  620. callback(new Error("请输入商品数量"));
  621. } else if (value < 0) {
  622. callback(new Error("输入商品数量必须大于0"));
  623. } else if (value > 999) {
  624. callback(new Error("输入商品数量必须小于999"));
  625. } else {
  626. callback();
  627. }
  628. };
  629. let that;
  630. export default {
  631. components: { pagination,Tooltip },
  632. name: "incomeTwo",
  633. data() {
  634. return {
  635. orderStatus: orderStatus,
  636. dealStatus: dealStatus,
  637. searchForm: {
  638. search: null,
  639. orderStartDate: null,
  640. orderEndDate: null,
  641. paymentStatus: "SUCCESS",
  642. paymentType: null,
  643. routingOrganId: null,
  644. actualAmount: null,
  645. balancePaymentAmount: null,
  646. orderNo: null,
  647. transNo: null,
  648. merNos: null,
  649. lessBalancePaymentAmount: null,
  650. lessActualAmount: null,
  651. orderDate: [],
  652. },
  653. tableList: [],
  654. organList: [],
  655. shopList: [],
  656. cooperationList: [],
  657. orderServerList: orderServerList,
  658. pageInfo: {
  659. // 分页规则
  660. limit: 10, // 限制显示条数
  661. page: 1, // 当前页
  662. total: 0, // 总条数
  663. page_size: [10, 20, 40, 50], // 选择限制显示条数
  664. },
  665. totalUserBalance: 0,
  666. totalActualAmount: 0,
  667. totalAdvanceAmount: 0,
  668. totalRevenueAmount: 0,
  669. formLabelWidth: "100px",
  670. routeOrderStatus: false,
  671. isAdd: true,
  672. form: {
  673. routeOrganId: null,
  674. transNo: null,
  675. type: "OTHER",
  676. merNo: null,
  677. actualAmount: null,
  678. memo: null,
  679. payTime: null,
  680. serviceAmount: null,
  681. saleAmount: null,
  682. schoolId: null,
  683. goodsList: [
  684. {
  685. id: null,
  686. number: null,
  687. },
  688. ],
  689. applyType: null,
  690. userId: "",
  691. calenderId: "",
  692. },
  693. validAmount: [
  694. { required: true, validator: validAmount, trigger: "blur" },
  695. { type: "number", message: "商品数量必须为数字" },
  696. ],
  697. rules: {
  698. organId: [
  699. { required: true, message: "请选择所属分部", trigger: "change" },
  700. ],
  701. // schoolId: [
  702. // { required: true, message: "请选择学校", trigger: "change" }
  703. // ],
  704. actualAmount: [
  705. { required: true, message: "请输入金额", trigger: "blur" },
  706. ],
  707. transNo: [
  708. { required: true, message: "请输入交易流水号", trigger: "blur" },
  709. ],
  710. merNo: [{ required: true, message: "请输入收款账户", trigger: "blur" }],
  711. payTime: [
  712. { required: true, message: "选择交易日期", trigger: "change" },
  713. ],
  714. applyType: [
  715. { required: true, message: "请选择收入类型", trigger: "change" },
  716. ],
  717. },
  718. headers: {
  719. Authorization: getToken(),
  720. },
  721. };
  722. },
  723. created(){
  724. that = this
  725. },
  726. mounted() {
  727. // getEmployeeOrgan().then((res) => {
  728. // if (res.code == 200) {
  729. // this.organList = res.data;
  730. // }
  731. // });
  732. this.$store.dispatch("setBranchs");
  733. goodsQuery({ status: 1, rows: 99999 }).then((res) => {
  734. if (res.code === 200) {
  735. this.shopList = res.data.rows;
  736. }
  737. });
  738. if (!(this.searchForm.orderDate?.length > 0)) {
  739. var now = new Date();
  740. var startDate = new Date(
  741. Date.UTC(now.getFullYear(), now.getMonth(), now.getDate())
  742. )
  743. .toISOString()
  744. .slice(0, 10);
  745. var endDate = new Date(
  746. Date.UTC(now.getFullYear(), now.getMonth(), now.getDate())
  747. )
  748. .toISOString()
  749. .slice(0, 10);
  750. this.searchForm.orderDate = [];
  751. this.searchForm.orderDate.push(startDate);
  752. this.searchForm.orderDate.push(endDate);
  753. }
  754. this.getList();
  755. },
  756. methods: {
  757. onClear(type) {
  758. if (type == "paymentType") {
  759. this.searchForm.paymentType = null;
  760. } else if (type == "paymentStatus") {
  761. this.searchForm.paymentStatus = null;
  762. } else if (type == "routingOrganId") {
  763. this.searchForm.routingOrganId = null;
  764. }
  765. },
  766. onOrderSubmit(formName) {
  767. // 添加订单
  768. this.$refs[formName].validate((valid) => {
  769. if (valid) {
  770. let form = this.form;
  771. if (!form.saleAmount && !form.serviceAmount) {
  772. this.$message.error("请输入销售收入或服务收入");
  773. return;
  774. }
  775. if (!form.saleAmount) {
  776. form.goodsList = null;
  777. }
  778. let goodsJson = {};
  779. for (let i in form.goodsList) {
  780. goodsJson[form.goodsList[i]["id"]] = form.goodsList[i]["number"];
  781. }
  782. form.goodsJson =
  783. form.applyType == "SERVICE" ? null : JSON.stringify(goodsJson);
  784. routeOrderAdd(form).then((res) => {
  785. if (res.code == 200) {
  786. this.$message.success("添加成功");
  787. this.routeOrderStatus = false;
  788. this.getList();
  789. } else {
  790. this.$message.error(res.msg);
  791. console.log("来了");
  792. }
  793. });
  794. } else {
  795. return;
  796. }
  797. });
  798. },
  799. onFormClose(formName) {
  800. // this.form = {
  801. // organId: null,
  802. // transNo: null,
  803. // type: "OTHER",
  804. // merNo: null,
  805. // actualAmount: null,
  806. // memo: null,
  807. // payTime: null,
  808. // goodsList: [{
  809. // id: null,
  810. // number: null
  811. // }]
  812. // }
  813. // 关闭弹窗重置验证
  814. this.$refs[formName].resetFields();
  815. },
  816. onOrderExport() {
  817. // 报表导出
  818. let url = "/api-web/export/routeOrderList";
  819. let searchForm = this.searchForm;
  820. let data = {
  821. orderType: 3,
  822. search: searchForm.search,
  823. orderNo: searchForm.orderNo,
  824. transNo: searchForm.transNo,
  825. merNos: searchForm.merNos,
  826. actualAmount: searchForm.actualAmount,
  827. balancePaymentAmount: searchForm.balancePaymentAmount,
  828. paymentStatus: searchForm.paymentStatus,
  829. paymentType: searchForm.paymentType,
  830. organId: searchForm.organId,
  831. lessBalancePaymentAmount: searchForm.lessBalancePaymentAmount,
  832. lessActualAmount: searchForm.lessActualAmount,
  833. };
  834. if (this.searchForm.orderDate && this.searchForm.orderDate.length > 0) {
  835. data.orderStartDate = this.searchForm.orderDate[0];
  836. data.orderEndDate = this.searchForm.orderDate[1];
  837. } else {
  838. data.orderStartDate = null;
  839. data.orderEndDate = null;
  840. }
  841. const options = {
  842. method: "POST",
  843. headers: {
  844. Authorization: getToken(),
  845. },
  846. data: qs.stringify(cleanDeep(data)),
  847. url,
  848. responseType: "blob",
  849. };
  850. this.$confirm("您确定导出报表", "提示", {
  851. confirmButtonText: "确定",
  852. cancelButtonText: "取消",
  853. type: "warning",
  854. })
  855. .then(() => {
  856. load.startLoading();
  857. axios(options).then((res) => {
  858. let blob = new Blob([res.data], {
  859. // type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
  860. type: "application/vnd.ms-excel;charset=utf-8",
  861. //word文档为application/msword,pdf文档为application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
  862. });
  863. let objectUrl = URL.createObjectURL(blob);
  864. let link = document.createElement("a");
  865. let nowTime = new Date();
  866. let ymd =
  867. nowTime.getFullYear() +
  868. "" +
  869. (nowTime.getMonth() + 1) +
  870. "" +
  871. nowTime.getDate() +
  872. "" +
  873. nowTime.getHours() +
  874. "" +
  875. nowTime.getMinutes();
  876. let fname = "报表导出" + new Date().getTime(); //下载文件的名字
  877. link.href = objectUrl;
  878. link.setAttribute("download", fname);
  879. document.body.appendChild(link);
  880. link.click();
  881. load.endLoading();
  882. });
  883. })
  884. .catch(() => {});
  885. },
  886. onAdaPayExport() {
  887. // 报表导出
  888. let url = "/api-web/adapay/exportBill";
  889. let data = {};
  890. if (this.searchForm.orderDate && this.searchForm.orderDate.length > 0) {
  891. data.startTime = this.searchForm.orderDate[0];
  892. data.endTime = this.searchForm.orderDate[1];
  893. } else {
  894. this.$message.error("请选择开始日期和结束日期");
  895. return;
  896. }
  897. const options = {
  898. method: "get",
  899. headers: {
  900. Authorization: getToken(),
  901. },
  902. params: data,
  903. url,
  904. responseType: "blob",
  905. };
  906. this.$confirm("您确定导出汇付订单", "提示", {
  907. confirmButtonText: "确定",
  908. cancelButtonText: "取消",
  909. type: "warning",
  910. })
  911. .then(() => {
  912. load.startLoading();
  913. axios(options).then((res) => {
  914. let blob = new Blob([res.data], {
  915. // type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
  916. type: "application/vnd.ms-excel;charset=utf-8",
  917. //word文档为application/msword,pdf文档为application/pdf,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8
  918. });
  919. let objectUrl = URL.createObjectURL(blob);
  920. let link = document.createElement("a");
  921. let fname = "汇付订单" + new Date().getTime(); //下载文件的名字
  922. link.href = objectUrl;
  923. link.setAttribute("download", fname);
  924. document.body.appendChild(link);
  925. link.click();
  926. load.endLoading();
  927. });
  928. })
  929. .catch(() => {});
  930. },
  931. search() {
  932. this.pageInfo.page = 1;
  933. this.$refs.searchForm.save(this.searchForm);
  934. this.$refs.searchForm.save(this.pageInfo, "page");
  935. this.getList();
  936. },
  937. getList() {
  938. // let params = JSON.parse(JSON.stringify(this.searchForm));
  939. let params = Object.assign({}, this.searchForm);
  940. // let params = {...this.searchForm}
  941. params.rows = this.pageInfo.limit;
  942. params.page = this.pageInfo.page;
  943. params.orderNo = params.orderNo ? params.orderNo : null;
  944. params.transNo = params.transNo ? params.transNo : null;
  945. params.merNos = params.merNos ? params.merNos : null;
  946. params.actualAmount = params.actualAmount ? params.actualAmount : null;
  947. params.balancePaymentAmount = params.balancePaymentAmount
  948. ? params.balancePaymentAmount
  949. : null;
  950. if (this.searchForm.orderDate && this.searchForm.orderDate.length > 0) {
  951. params.orderStartDate = this.searchForm.orderDate[0];
  952. params.orderEndDate = this.searchForm.orderDate[1];
  953. } else {
  954. params.orderStartDate = null;
  955. params.orderEndDate = null;
  956. }
  957. params.orderDate = null;
  958. routeOrderFinance(cleanDeep(params)).then((res) => {
  959. let result = res.data;
  960. if (res.code == 200) {
  961. this.tableList = result.rows;
  962. this.pageInfo.total = result.total;
  963. this.totalUserBalance = result.totalUserBalance
  964. ? result.totalUserBalance
  965. : 0;
  966. this.totalActualAmount = result.totalActualAmount
  967. ? result.totalActualAmount
  968. : 0;
  969. this.totalAdvanceAmount = result.totalAdvanceAmount
  970. ? result.totalAdvanceAmount
  971. : 0;
  972. this.totalRevenueAmount = result.totalRevenueAmount
  973. ? result.totalRevenueAmount
  974. : 0;
  975. }
  976. });
  977. },
  978. searchOrderDate(value) {
  979. if (value) {
  980. this.searchForm.orderStartDate = value[0];
  981. this.searchForm.orderEndDate = value[1];
  982. } else {
  983. this.searchForm.orderStartDate = null;
  984. this.searchForm.orderEndDate = null;
  985. }
  986. },
  987. onReSet() {
  988. // 重置搜索
  989. this.orderDate = null;
  990. this.searchForm = {
  991. search: null,
  992. orderStartDate: null,
  993. orderEndDate: null,
  994. paymentStatus: null,
  995. paymentType: null,
  996. routingOrganId: null,
  997. actualAmount: null,
  998. balancePaymentAmount: null,
  999. orderNo: null,
  1000. transNo: null,
  1001. merNos: null,
  1002. lessBalancePaymentAmount: null,
  1003. lessActualAmount: null,
  1004. orderDate: [],
  1005. };
  1006. this.getList();
  1007. },
  1008. removeGoodsList(item) {
  1009. const index = this.form.goodsList.indexOf(item);
  1010. if (index !== -1) {
  1011. this.form.goodsList.splice(index, 1);
  1012. }
  1013. },
  1014. addGoodsList() {
  1015. this.form.goodsList.push({
  1016. id: null,
  1017. number: null,
  1018. });
  1019. },
  1020. changeOrgin(val) {
  1021. this.$set(this.form, "schoolId", null);
  1022. if (val) {
  1023. getCooperation({ rows: 9999, organId: val }).then((res) => {
  1024. if (res.code === 200) {
  1025. this.cooperationList = res.data.rows;
  1026. }
  1027. });
  1028. }
  1029. },
  1030. checkSchool(val) {},
  1031. checkgoods(val) {
  1032. for (let i = 0; i <= this.form.goodsList.length - 1; i++) {
  1033. if (
  1034. i != this.form.goodsList.length - 1 &&
  1035. this.form.goodsList[i].id === val
  1036. ) {
  1037. this.form.goodsList[this.form.goodsList.length - 1].id = "";
  1038. }
  1039. }
  1040. },
  1041. lookOrderInfo(row) {
  1042. //orderNo
  1043. this.isAdd = false;
  1044. getOrderInfo({ orderId: row.id }).then((res) => {
  1045. if (res.code === 200) {
  1046. this.$nextTick((some) => {
  1047. let orderInfo = res.data.studentPaymentOrder;
  1048. this.changeOrgin(parseInt(orderInfo.organId));
  1049. (this.form = {
  1050. routeOrganId: orderInfo.organId,
  1051. transNo: orderInfo.transNo,
  1052. userId: orderInfo.userId ? orderInfo.userId : "",
  1053. type: "OTHER",
  1054. merNo: orderInfo.merNos,
  1055. actualAmount: orderInfo.actualAmount,
  1056. memo: orderInfo.memo,
  1057. payTime: orderInfo.payTime,
  1058. serviceAmount: res.data.serviceAmount,
  1059. saleAmount: res.data.goodsAmount,
  1060. schoolId: parseInt(orderInfo.musicGroupId) || " ",
  1061. applyType: "SELL",
  1062. calenderId: res.data.calenderId ? res.data.calenderId : "",
  1063. }),
  1064. this.$set(
  1065. this.form,
  1066. "goodsList",
  1067. res.data.sellOrders.map((item) => {
  1068. return { id: item.goodsId, number: item.num };
  1069. })
  1070. );
  1071. this.routeOrderStatus = true;
  1072. });
  1073. }
  1074. });
  1075. },
  1076. removeOrderInfo(row) {
  1077. this.$confirm("确定删除?", "提示", {
  1078. confirmButtonText: "确定",
  1079. cancelButtonText: "取消",
  1080. type: "warning",
  1081. })
  1082. .then(() => {
  1083. orderDelete({ orderId: row.id }).then((res) => {
  1084. if (res.code === 200) {
  1085. this.$message.success("删除成功");
  1086. this.getList();
  1087. // this.routeOrderStatus = false;
  1088. }
  1089. });
  1090. })
  1091. .catch();
  1092. // orderDelete
  1093. },
  1094. onDownload() {
  1095. // 下载模板
  1096. // // 报表导出
  1097. Export(this, {
  1098. url: "/api-web/import/downloadTemplate",
  1099. params: {
  1100. templateType: "ROUTE_ORDER",
  1101. },
  1102. fileName: "财务管理导入模板.xlsx",
  1103. });
  1104. },
  1105. beforeUpload(file) {
  1106. // console.log(file.type)
  1107. // const isJPG = file.type === '.xlsx' || file.type === '.xls';
  1108. // // const isLt2M = file.size / 1024 / 1024 < 2;
  1109. // if (!isJPG) {
  1110. // this.$message.error('上传头像图片只能是 JPG 格式!');
  1111. // }
  1112. // return isJPG;
  1113. // this.goodsLoading = true
  1114. load.startLoading();
  1115. },
  1116. handleSuccess(response, file, fileList) {
  1117. // 导入商品
  1118. // 报表导出
  1119. load.endLoading();
  1120. if (response.code == 200) {
  1121. this.$message.success("导入成功");
  1122. // this.getList()
  1123. } else if (response.code == 0) {
  1124. let str = this.fomatStr(response.msg);
  1125. this.$alert(str, "导入结果", {
  1126. confirmButtonText: "确定",
  1127. dangerouslyUseHTMLString: true,
  1128. callback: (action) => {
  1129. // this.getList()
  1130. },
  1131. });
  1132. } else {
  1133. this.$message.error(response.msg);
  1134. }
  1135. },
  1136. handleError(err, file, fileList) {
  1137. load.endLoading();
  1138. console.log(err, file, fileList);
  1139. },
  1140. fomatStr(str) {
  1141. let arr = str.split(";");
  1142. let newStr = "";
  1143. arr.forEach((item) => {
  1144. newStr += `<p>${item}</p>`;
  1145. });
  1146. return newStr;
  1147. },
  1148. changeApplyType(val) {
  1149. if (val == "SELL" && !this.form.goodsList) {
  1150. this.form.goodsList = [
  1151. {
  1152. id: null,
  1153. number: null,
  1154. },
  1155. ];
  1156. }
  1157. this.form.serviceAmount = null;
  1158. this.form.saleAmount = null;
  1159. },
  1160. },
  1161. watch: {
  1162. routeOrderStatus(val) {
  1163. if (!val) {
  1164. this.form = {
  1165. routeOrganId: null,
  1166. transNo: null,
  1167. type: "OTHER",
  1168. merNo: null,
  1169. actualAmount: null,
  1170. memo: null,
  1171. payTime: null,
  1172. serviceAmount: null,
  1173. saleAmount: null,
  1174. schoolId: null,
  1175. goodsList: [
  1176. {
  1177. id: null,
  1178. number: null,
  1179. },
  1180. ],
  1181. applyType: null,
  1182. userId: "",
  1183. };
  1184. }
  1185. },
  1186. },
  1187. filters: {
  1188. filterShopId(val) {
  1189. let str = "";
  1190. that.shopList.forEach((shop) => {
  1191. if (shop.id == val) {
  1192. str = shop.name;
  1193. }
  1194. });
  1195. return str;
  1196. },
  1197. },
  1198. };
  1199. </script>
  1200. <style lang="scss" scoped>
  1201. .newBand {
  1202. display: inline-block;
  1203. }
  1204. /deep/.el-input-number.is-controls-right .el-input__inner {
  1205. text-align: left;
  1206. }
  1207. .setWidth {
  1208. display: inline-block;
  1209. }
  1210. .lookTitle {
  1211. height: 40px;
  1212. line-height: 40px;
  1213. font-weight: bold;
  1214. background-color: rgb(237, 238, 240);
  1215. padding: 0 20px;
  1216. margin-bottom: 20px;
  1217. }
  1218. .showShop {
  1219. height: 40px;
  1220. line-height: 40px;
  1221. width: 150px;
  1222. background-color: #f5f7fa;
  1223. border-color: #e4e7ed;
  1224. color: #c0c4cc;
  1225. cursor: not-allowed;
  1226. color: #333;
  1227. opacity: 1;
  1228. border-radius: 4px;
  1229. border: 1px solid #dcdfe6;
  1230. padding: 0 15px;
  1231. margin-right: 10px;
  1232. }
  1233. .shopListWrap { display: flex; flex-direction: row; justify-content: flex-start;}
  1234. </style>