index.php 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616
  1. <div id="app" v-cloak>
  2. <el-card shadow="never" style="border:0;" body-style="background-color: #f3f3f3;padding: 10px 0 0;">
  3. <div slot="header">
  4. <div>
  5. <span>记帐本列表</span>
  6. </div>
  7. </div>
  8. <div class="table-body">
  9. <el-form :inline="true" :model="searchData" class="demo-form-inline">
  10. <el-col :span="24" v-if="type == 2">
  11. <el-button type="success" :loading="addLoading" @click="add(1)">新增(税务方)</el-button>
  12. <el-button type="primary" :loading="addLoading" @click="add(2)">新增(用工方)</el-button>
  13. <el-button v-if="payment_flow_status" type="warning" :loading="addLoading" @click="add(3)">新增(过流水)</el-button>
  14. </el-col>
  15. <el-col :span="24" v-else>
  16. <el-button type="success" :loading="addLoading" @click="add(1)">新增</el-button>
  17. </el-col>
  18. </el-form>
  19. <el-col :span="24" v-if="type == 2">
  20. <div class="notice">
  21. <ul>
  22. <li>
  23. <i class="el-icon-info" style="color: #E6A23C"></i>
  24. 当您使用「服务商版」的情况下, 打款前请务必给
  25. <el-tag type="primary" size="mini">用工方</el-tag>
  26. 的记账本进行充值, 充值时请使用和
  27. <el-tag type="primary" size="mini">用工方</el-tag>
  28. 签约一致的支付宝账号进行充值。
  29. </li>
  30. <li>
  31. <i class="el-icon-info" style="color: #E6A23C"></i>
  32. 当您的金额滞留在
  33. <el-tag type="success" size="mini">税务方</el-tag>
  34. 记账本情况下, 可
  35. <el-tag type="success" size="mini">税务方</el-tag>
  36. 记账本使用「逆流」功能进行资金转回到
  37. <el-tag type="primary" size="mini">用工方</el-tag>
  38. 默认记账本。
  39. </li>
  40. </ul>
  41. </div>
  42. </el-col>
  43. <!-- 订单信息 -->
  44. <template>
  45. <el-table ref="multipleTable" :data="list" @selection-change="handleSelectionChange" v-loading="listLoading">
  46. <!-- 空数据 -->
  47. <template slot="empty">
  48. <el-empty description="暂无记帐本"></el-empty>
  49. </template>
  50. <el-table-column type="selection"></el-table-column>
  51. <el-table-column prop="id" align="center" label="ID"></el-table-column>
  52. <el-table-column prop="book_type" align="center" label="记账本类型" v-if="type == 2">
  53. <template slot-scope="scope">
  54. <el-tag type="success" size="mini" v-if="scope.row.book_type == 1">税务方</el-tag>
  55. <el-tag type="primary" size="mini" v-if="scope.row.book_type == 2">用工方</el-tag>
  56. <el-tag type="warning" size="mini" v-if="scope.row.book_type == 3">过流水</el-tag>
  57. </template>
  58. </el-table-column>
  59. <el-table-column prop="external_agreement_no" align="center" label="签约号"></el-table-column>
  60. <el-table-column prop="book_id" align="center" label="记帐本ID">
  61. <template slot-scope="scope">
  62. {{
  63. (scope.row.status == 'NORMAL' && scope.row.book)
  64. ? scope.row.book.account_book_id
  65. : '--'
  66. }}
  67. </template>
  68. </el-table-column>
  69. <el-table-column prop="alipay_logon_id" align="center" label="签约方账户">
  70. <template slot-scope="scope">
  71. {{
  72. scope.row.status == 'NORMAL'
  73. ? scope.row.alipay_logon_id
  74. : '--'
  75. }}
  76. </template>
  77. </el-table-column>
  78. <el-table-column prop="sign_time" label="签约时间" align="center">
  79. <template slot-scope="scope">
  80. {{
  81. scope.row.status != 'NORMAL'
  82. ? '--'
  83. : scope.row.sign_time|dateTimeFormat('Y-m-d H:i:s')
  84. }}
  85. </template>
  86. </el-table-column>
  87. <el-table-column prop="default" label="是否默认" align="center">
  88. <template slot-scope="scope">
  89. <el-icon class="el-icon-success" v-if="scope.row.is_default == 1"></el-icon>
  90. <el-icon class="el-icon-circle-check" v-if="scope.row.is_default == 0"></el-icon>
  91. </template>
  92. </el-table-column>
  93. <el-table-column prop="right_btn" label="操作" align="center">
  94. <template slot-scope="scope">
  95. <el-button
  96. type="text"
  97. :loading="queryAccountLoad"
  98. @click="queryAccount(scope.row.id)"
  99. v-if="scope.row.status != 'NORMAL'"
  100. >查询签约</el-button>
  101. <el-button
  102. type="text"
  103. :loading="queryBookLoad"
  104. @click="queryBook(scope.row.id)"
  105. v-if="scope.row.status == 'NORMAL'"
  106. >查询账户</el-button>
  107. <el-button
  108. type="text"
  109. @click="setDefault(scope.row.id, scope.row.book_type)"
  110. v-if="scope.row.is_default == 0 && scope.row.status == 'NORMAL'"
  111. >默认</el-button>
  112. <el-button
  113. type="text"
  114. @click="rechargeBook(scope.row.book)"
  115. v-if="scope.row.status == 'NORMAL' && scope.row.book.book_type == 2"
  116. >充值</el-button>
  117. <el-button
  118. type="text"
  119. @click="returnBook(scope.row.id)"
  120. v-if="scope.row.status == 'NORMAL' && scope.row.book.book_type == 2"
  121. >退回</el-button>
  122. <el-button
  123. type="text"
  124. :loading="queryBookLoad"
  125. @click="anarrheaBook(scope.row.id)"
  126. v-if="scope.row.status == 'NORMAL' && type == 2 && (scope.row.book.book_type == 1 || scope.row.book.book_type == 3)"
  127. >逆流</el-button>
  128. <el-button
  129. type="text"
  130. :loading="queryBookLoad"
  131. @click="refundBook(scope.row.id)"
  132. v-if="scope.row.status == 'NORMAL' && type == 1 && scope.row.book.book_type == 1"
  133. >退回</el-button>
  134. <el-button
  135. type="text"
  136. :loading="queryBookLoad"
  137. @click="delBook(scope.row.id)"
  138. v-if="scope.row.status != 'NORMAL'"
  139. >删除</el-button>
  140. </template>
  141. </el-table-column>
  142. </el-table>
  143. </template>
  144. <!-- 记帐本信息 -->
  145. <el-dialog :visible.sync="bookVisible" width="30%">
  146. <template slot="title">
  147. <h3 style="text-align: center;">记帐本信息</h3>
  148. </template>
  149. <el-form label-width="150px">
  150. <el-form-item label="记帐本ID:">
  151. {{ book.account_book_id }}
  152. </el-form-item>
  153. <el-form-item label="可用余额:">
  154. {{ book.available_amount }}
  155. </el-form-item>
  156. </el-form>
  157. <span slot="footer" class="dialog-footer">
  158. <el-button type="primary" @click="bookVisible = false">确 定</el-button>
  159. </span>
  160. </el-dialog>
  161. <!-- 充值 -->
  162. <el-dialog :visible.sync="rechargeVisible" width="30%">
  163. <template slot="title">
  164. <h3 style="text-align: center;">充值</h3>
  165. </template>
  166. <el-form label-width="150px" :model="rechargeheForm" :rules="rechargeheRules" ref="rechargeheForm">
  167. <el-form-item label="记帐本ID:">
  168. {{ book.account_book_id }}
  169. </el-form-item>
  170. <el-form-item label="充值金额:" prop="amount">
  171. <el-input
  172. v-model="rechargeheForm.amount"
  173. style="width: 350px"
  174. maxlength="10"
  175. placeholder="请输入充值金额"
  176. >
  177. <template slot="append">元</template>
  178. </el-input>
  179. </el-form-item>
  180. </el-form>
  181. <span slot="footer" class="dialog-footer">
  182. <el-button type="primary" @click="toRecharge">确 定</el-button>
  183. </span>
  184. </el-dialog>
  185. <!-- 退回 -->
  186. <el-dialog :visible.sync="returnVisible" width="30%">
  187. <template slot="title">
  188. <h3 style="text-align: center;">退回</h3>
  189. </template>
  190. <el-form label-width="150px" :model="returnForm" :rules="returnRules" ref="returnForm">
  191. <el-form-item label="当前记账本余额:">
  192. {{ amount }}
  193. </el-form-item>
  194. <el-form-item label="退回账户金额:" prop="amount">
  195. <el-input
  196. v-model="returnForm.amount"
  197. style="width: 350px"
  198. placeholder="请输入充值金额"
  199. >
  200. <template slot="append">元</template>
  201. </el-input>
  202. </el-form-item>
  203. <el-form-item label="退回账户名称:" prop="account_name">
  204. <el-input
  205. v-model="returnForm.account_name"
  206. style="width: 350px"
  207. placeholder="请输入账户名称"
  208. >
  209. </el-input>
  210. </el-form-item>
  211. <el-form-item label="退回账户账号:" prop="account_number">
  212. <el-input
  213. v-model="returnForm.account_number"
  214. style="width: 350px"
  215. placeholder="请输入账户账号"
  216. >
  217. </el-input>
  218. </el-form-item>
  219. </el-form>
  220. <span slot="footer" class="dialog-footer">
  221. <el-button type="primary" @click="toReturn">确 定</el-button>
  222. </span>
  223. </el-dialog>
  224. <!-- 分页 -->
  225. <el-row type="flex" class="page" justify="end" style="margin-top: 20px;">
  226. <el-pagination @current-change="pagination" background layout="prev, pager, next" :page-count="pageCount" v-if="list"></el-pagination>
  227. </el-row>
  228. </div>
  229. </el-card>
  230. </div>
  231. <script>
  232. const app = new Vue({
  233. el: '#app',
  234. data() {
  235. return {
  236. searchData: {
  237. name: '',
  238. },
  239. list: [],
  240. pageCount: 0,
  241. page: 1,
  242. currentPage: null,
  243. listLoading: false,
  244. addLoading: false,
  245. btnLoading: false,
  246. checked: false,
  247. bookVisible: false,
  248. book: {},
  249. type: 1,
  250. queryAccountLoad: false,
  251. queryBookLoad: false,
  252. rechargeVisible: false,
  253. rechargeheForm: {
  254. amount: undefined,
  255. },
  256. rechargeheRules: {
  257. amount: [
  258. { required: true, message: '请输入金额', trigger: 'blur' },
  259. ]
  260. },
  261. book: {},
  262. returnVisible: false,
  263. amount: 0,
  264. returnId: '',
  265. returnForm: {
  266. amount: '',
  267. account_name: '',
  268. account_number: '',
  269. },
  270. returnRules: {
  271. amount: [
  272. { required: true, message: '请输入金额', trigger: 'blur' },
  273. ],
  274. account_name: [
  275. { required: true, message: '请输入名称', trigger: 'blur' },
  276. ],
  277. account_number: [
  278. { required: true, message: '请输入账号', trigger: 'blur' },
  279. ],
  280. },
  281. payment_flow_status: 0,
  282. };
  283. },
  284. methods: {
  285. handleSelectionChange(val) {
  286. this.select_order = val
  287. },
  288. // 全选
  289. allSelect() {
  290. if (this.checked) {
  291. this.goods_list.forEach(function(item, index) {
  292. if (!item.storage) {
  293. item.is_select = true
  294. }
  295. })
  296. } else {
  297. this.goods_list.forEach(function(item, index) {
  298. item.is_select = false
  299. })
  300. }
  301. },
  302. //搜索
  303. onSubmit() {
  304. this.page = 1
  305. this.getOrderList()
  306. },
  307. pagination(currentPage) {
  308. this.page = currentPage
  309. this.getOrderList()
  310. },
  311. getOrderList() {
  312. this.listLoading = true;
  313. var param = {
  314. r: 'avoid-tax/account/index',
  315. page: this.page,
  316. limit: 20
  317. }
  318. Object.assign(param, param, this.searchData)
  319. request({
  320. params: param,
  321. }).then(e => {
  322. if (e.data.code === 0) {
  323. this.list = e.data.data.list
  324. this.pageCount = e.data.data.page_count
  325. this.currentPage = e.data.data.pagination.current_page
  326. } else {
  327. this.$message.error(e.data.msg)
  328. }
  329. this.listLoading = false
  330. }).catch(e => {
  331. this.listLoading = false
  332. })
  333. },
  334. // 添加
  335. add(type) {
  336. let self = this
  337. this.addLoading = true
  338. request({
  339. params: {
  340. r: 'avoid-tax/account/is-sign',
  341. type: type
  342. }
  343. }).then(e => {
  344. if (e.data.code == 0) {
  345. const {is_new_sign} = e.data.data
  346. self.toSign(is_new_sign, type)
  347. }
  348. })
  349. },
  350. // 去添加
  351. toSign(bool, type) {
  352. if (bool) {
  353. this.addLoading = false
  354. navigateTo({
  355. r: 'avoid-tax/account/sign',
  356. type: type,
  357. }, true)
  358. } else {
  359. request({
  360. params: {
  361. r: 'avoid-tax/account/add-sign',
  362. type: type
  363. }
  364. }).then(e => {
  365. if (e.data.code == 0) {
  366. this.$message.success('添加成功')
  367. this.addLoading = false
  368. setTimeout(() => {
  369. this.getOrderList()
  370. }, 1500)
  371. }
  372. })
  373. }
  374. },
  375. // 签约查询
  376. queryAccount(id) {
  377. this.queryAccountLoad = true
  378. var param = {
  379. r: 'avoid-tax/account/query',
  380. id: id,
  381. }
  382. request({
  383. params: param,
  384. }).then(e => {
  385. if (e.data.code === 0) {
  386. this.$message.success('查询成功')
  387. setTimeout(() => {
  388. self.getOrderList()
  389. this.queryAccountLoad = false
  390. }, 1000);
  391. } else {
  392. this.$message.error(e.data.msg)
  393. this.queryAccountLoad = false
  394. }
  395. }).catch(e => {})
  396. },
  397. // 记帐本查询
  398. queryBook(id) {
  399. this.queryBookLoad = true
  400. var param = {
  401. r: 'avoid-tax/account/query-book',
  402. id: id,
  403. }
  404. request({
  405. params: param,
  406. }).then(e => {
  407. if (e.data.code === 0) {
  408. this.bookVisible = true
  409. this.queryBookLoad = false
  410. this.book = e.data.data
  411. } else {
  412. this.queryBookLoad = false
  413. this.$message.error(e.data.msg)
  414. }
  415. }).catch(e => {})
  416. },
  417. // 默认设置
  418. setDefault (id, type) {
  419. var param = {
  420. r: 'avoid-tax/account/set-default',
  421. id: id,
  422. type: type,
  423. }
  424. var self = this
  425. request({
  426. params: param,
  427. }).then(e => {
  428. if (e.data.code === 0) {
  429. this.$message.success('设置成功')
  430. setTimeout(() => {
  431. self.getOrderList()
  432. }, 1000);
  433. } else {
  434. this.$message.error(e.data.msg)
  435. }
  436. }).catch(e => {})
  437. },
  438. // 获取配置
  439. getConfig () {
  440. request({
  441. params: {
  442. r: 'avoid-tax/default/read',
  443. },
  444. method: 'get',
  445. }).then(e => {
  446. if (e.data.code === 0) {
  447. this.type = e.data.data.type
  448. this.payment_flow_status = e.data.data.payment_flow_status ?? 0
  449. }
  450. }).catch(e => {})
  451. },
  452. // 记账本充值
  453. rechargeBook (book) {
  454. this.book = book
  455. this.rechargeVisible = true
  456. },
  457. // 去充值
  458. toRecharge () {
  459. this.$refs['rechargeheForm'].validate((valid) => {
  460. if (valid) {
  461. navigateTo({
  462. r: 'avoid-tax/account/recharge',
  463. amount: this.rechargeheForm.amount,
  464. id: this.book.account_id,
  465. }, true)
  466. } else {
  467. this.$message.error('参数有误')
  468. return false
  469. }
  470. })
  471. },
  472. // 逆流
  473. anarrheaBook (id) {
  474. this.$confirm('是否确定逆流?', '提示', {
  475. confirmButtonText: '确定',
  476. cancelButtonText: '取消',
  477. type: 'warning'
  478. }).then(() => {
  479. this.queryBookLoad = true
  480. request({
  481. params: {
  482. r: 'avoid-tax/account/anarrhea',
  483. id: id,
  484. }
  485. }).then(e => {
  486. if (e.data.code == 0) {
  487. this.$message.success('操作成功')
  488. } else {
  489. this.$message.error(e.data.msg)
  490. }
  491. this.queryBookLoad = false
  492. }).catch(e => {})
  493. }).catch()
  494. },
  495. // 退回
  496. refundBook(id) {
  497. this.$confirm('是否确定退回?', '提示', {
  498. confirmButtonText: '确定',
  499. cancelButtonText: '取消',
  500. type: 'warning'
  501. }).then(() => {
  502. this.queryBookLoad = true
  503. request({
  504. params: {
  505. r: 'avoid-tax/account/refund',
  506. id: id,
  507. }
  508. }).then(e => {
  509. if (e.data.code == 0) {
  510. this.$message.success('操作成功')
  511. } else {
  512. this.$message.error(e.data.msg)
  513. }
  514. this.queryBookLoad = false
  515. }).catch(e => {})
  516. }).catch()
  517. },
  518. returnBook(id) {
  519. this.returnId = id
  520. this.returnVisible = true
  521. // 查询账户余额
  522. this.queryBookAmount(id)
  523. },
  524. toReturn() {
  525. this.$refs['returnForm'].validate((valid) => {
  526. if (valid) {
  527. if (this.queryBookLoad) return
  528. this.queryBookLoad = true
  529. request({
  530. params: {
  531. r: 'avoid-tax/account/return',
  532. id: this.returnId
  533. },
  534. data: this.returnForm,
  535. method: 'post'
  536. }).then(e => {
  537. if (e.data.code == 0) {
  538. this.$message.success('操作成功')
  539. } else {
  540. this.$message.error(e.data.msg)
  541. }
  542. this.queryBookLoad = false
  543. })
  544. }
  545. })
  546. },
  547. // 查询账户余额
  548. queryBookAmount(id) {
  549. request({
  550. params: {
  551. r: 'avoid-tax/account/query-book',
  552. id: id,
  553. },
  554. }).then(e => {
  555. if (e.data.code === 0) {
  556. this.amount = e.data.data.available_amount
  557. }
  558. })
  559. },
  560. // 删除
  561. delBook(id) {
  562. this.$confirm('是否确定删除?', '提示', {
  563. confirmButtonText: '确定',
  564. cancelButtonText: '取消',
  565. type: 'warning'
  566. }).then(() => {
  567. this.queryBookLoad = true
  568. request({
  569. params: {
  570. r: 'avoid-tax/account/del',
  571. id: id,
  572. }
  573. }).then(e => {
  574. if (e.data.code == 0) {
  575. this.$message.success('操作成功')
  576. setTimeout(() => {
  577. this.getOrderList()
  578. }, 1500)
  579. } else {
  580. this.$message.error(e.data.msg)
  581. }
  582. this.queryBookLoad = false
  583. }).catch(e => {})
  584. }).catch()
  585. },
  586. },
  587. mounted: function() {
  588. this.page = getQuery('page') ? getQuery('page') : 1
  589. this.getConfig()
  590. this.getOrderList()
  591. }
  592. });
  593. </script>
  594. <style>
  595. .el-form-item__label {
  596. font-weight: 900;
  597. }
  598. .notice {
  599. border: 1px solid rgb(250, 236, 216);
  600. background: rgb(253, 246, 236);
  601. margin-top: 10px;
  602. padding: 10px;
  603. border-radius: 5px;
  604. }
  605. .notice li + li {
  606. margin-top: 5px;
  607. }
  608. </style>