financeManager-taoqi.vue 41 KB

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