pay.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <template>
  2. <el-card>
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" @submit.native.prevent>
  4. <el-form-item label="采购单号" prop="contractCode">
  5. <el-input v-model="queryParams.contractCode" placeholder="请输入采购单号" size="small" @keyup.enter.native="handleQuery" />
  6. </el-form-item>
  7. <el-form-item label="付款状态" prop="settlementStatus">
  8. <el-select v-model="queryParams.settlementStatus" placeholder="请选择付款状态" size="small" style="width: 100%" @change="handleQuery">
  9. <el-option v-for="item in status" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" />
  10. </el-select>
  11. </el-form-item>
  12. <el-form-item label="供应商" prop="supplyName">
  13. <el-input v-model="queryParams.supplyName" placeholder="请输入供应商" size="small" @keyup.enter.native="handleQuery" />
  14. </el-form-item>
  15. <el-form-item>
  16. <el-button size="mini" @click="handleQuery" class="searchBtn">搜索</el-button>
  17. <el-button size="mini" @click="resetQuery">重置</el-button>
  18. </el-form-item>
  19. </el-form>
  20. <el-table :data="tableList" :cell-style="{ padding: '0' }" :row-style="{ height: '35px' }" v-loading="loading" header-row-class-name="tableHeader">
  21. <el-table-column label="采购单号" prop="code" width="160" />
  22. <el-table-column label="供应商" prop="supplyName" min-width="140" />
  23. <el-table-column label="结算方式" prop="payType" width="140" :formatter="payTypeFormat" />
  24. <el-table-column label="发票" prop="invoiceType" min-width="140" :formatter="invoiceTypeFormat" />
  25. <el-table-column label="付款状态" align="center" width="100" :formatter="statusFormat" />
  26. <el-table-column label="采购总金额(含税)" align="right" width="130">
  27. <template slot-scope="scope">
  28. <span v-if="scope.row.purchasePrice">{{ moneyFormat(scope.row.purchasePrice, 3) }}</span>
  29. </template>
  30. </el-table-column>
  31. <el-table-column label="退货总金额" align="right" width="110">
  32. <template slot-scope="scope">
  33. <span v-if="scope.row.returnAmount">{{ moneyFormat(scope.row.returnAmount, 3) }}</span>
  34. </template>
  35. </el-table-column>
  36. <el-table-column label="应付总金额" align="right" width="110">
  37. <template slot-scope="scope">
  38. <span v-if="scope.row.meetAmount">{{ moneyFormat(scope.row.meetAmount, 3) }}</span>
  39. </template>
  40. </el-table-column>
  41. <el-table-column label="已结清金额" align="right" width="110">
  42. <template slot-scope="scope">
  43. <span v-if="scope.row.settledAmount">{{ moneyFormat(scope.row.settledAmount, 3) }}</span>
  44. </template>
  45. </el-table-column>
  46. <el-table-column label="已抵扣金额" align="right" width="110">
  47. <template slot-scope="scope">
  48. <span v-if="scope.row.deductionAmount">{{ moneyFormat(scope.row.deductionAmount, 3) }}</span>
  49. </template>
  50. </el-table-column>
  51. <el-table-column label="未结清金额" align="right" width="110">
  52. <template slot-scope="scope">
  53. <span v-if="scope.row.unclearedAmount && scope.row.unclearedAmount > 0" style="color: #d70606">{{ moneyFormat(scope.row.unclearedAmount, 3) }}</span>
  54. <span v-else>{{ scope.row.unclearedAmount }}</span>
  55. </template>
  56. </el-table-column>
  57. <el-table-column label="操作" align="center" width="80" fixed="right">
  58. <template slot-scope="scope">
  59. <el-button type="text" v-if="scope.row.unclearedAmount && scope.row.unclearedAmount > 0" @click="clickPay(scope.row)" v-db-click>付款</el-button>
  60. </template>
  61. </el-table-column>
  62. </el-table>
  63. <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
  64. </el-card>
  65. </template>
  66. <script>
  67. import * as API from '@/api/shengde/productionSystem/purchase/payment'
  68. import Utils from '@/util/transit'
  69. import { mapGetters } from 'vuex'
  70. export default {
  71. data() {
  72. return {
  73. queryParams: {
  74. pageNum: 1,
  75. pageSize: 10,
  76. contractCode: '',
  77. supplyName: '',
  78. settlementStatus: '',
  79. },
  80. loading: false,
  81. tableList: [],
  82. total: 0,
  83. status: [
  84. { dictKey: '0', dictValue: '未结清' },
  85. { dictKey: '1', dictValue: '已结清' },
  86. ],
  87. payType: [],
  88. invoiceType: [],
  89. }
  90. },
  91. created() {
  92. this.payType = this.dictData.filter((item) => item.code === 'purchase_payment_pay_type')[0].children
  93. this.invoiceType = this.dictData.filter((item) => item.code === 'invoice_type')[0].children
  94. },
  95. mounted() {
  96. this.getList()
  97. Utils.$on('refreshPay', () => {
  98. this.getList()
  99. })
  100. },
  101. computed: mapGetters(['dictData']),
  102. methods: {
  103. getList() {
  104. this.loading = true
  105. API.getPurchasePaymentList(this.queryParams).then(
  106. (res) => {
  107. this.tableList = res.data.data.records
  108. this.total = res.data.data.total
  109. this.loading = false
  110. },
  111. (err) => {
  112. console.log('getPurchasePaymentList: ' + err)
  113. this.loading = false
  114. }
  115. )
  116. },
  117. /** 搜索按钮操作 */
  118. handleQuery() {
  119. this.queryParams.pageNum = 1
  120. this.getList()
  121. },
  122. /** 重置按钮操作 */
  123. resetQuery() {
  124. this.resetForm('queryForm')
  125. this.handleQuery()
  126. },
  127. statusFormat(row) {
  128. return this.selectConstantsLabel(this.status, row.settlementStatus)
  129. },
  130. payTypeFormat(row) {
  131. return this.selectConstantsLabel(this.payType, row.payType)
  132. },
  133. invoiceTypeFormat(row) {
  134. return this.selectConstantsLabel(this.invoiceType, row.invoiceType)
  135. },
  136. clickPay(row) {
  137. let $chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678'
  138. let maxPos = $chars.length
  139. let random = ''
  140. for (let i = 0; i < 32; i++) {
  141. random += $chars.charAt(Math.floor(Math.random() * maxPos))
  142. }
  143. this.$router.push({
  144. path: '/purchase/payment',
  145. query: {
  146. id: row.id,
  147. random: random,
  148. },
  149. })
  150. },
  151. },
  152. }
  153. </script>
  154. <style lang="scss" scoped>
  155. * {
  156. font-size: 12px;
  157. }
  158. .searchBtn {
  159. background: #20b2aa;
  160. color: #fff;
  161. border: 1px solid #20b2aa;
  162. }
  163. ::v-deep {
  164. .el-input__inner {
  165. border-radius: 1px;
  166. }
  167. .el-button--mini {
  168. border-radius: 1px;
  169. }
  170. .tableHeader th {
  171. background-color: #edf0f5;
  172. height: 35px;
  173. padding: 0;
  174. }
  175. }
  176. </style>