detail.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <template>
  2. <div class="companyCollectionPaymentDetail-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  4. <a-page-header :ghost="false" :backIcon="false" class="companyCollectionPaymentDetail-cont" >
  5. <!-- 自定义的二级文字标题 -->
  6. <template slot="subTitle">
  7. <a id="companyCollectionPaymentDetail-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
  8. <p style=" display: inline-block;margin: 0 0 0 20px;color: #000;font-size: 14px;font-weight: 600;">单号:{{ (basicInfoData&&basicInfoData.unitSettleNo) || '--' }}</p>
  9. </template>
  10. <!-- 操作区,位于 title 行的行尾 -->
  11. <template slot="extra">
  12. <div style="margin-top: 5px;">
  13. <PrintPanel ref="printBox" position="bottomRight" @handlePrint="handlePrint">
  14. <div style="padding:10px;line-height: 30px;" slot="extendCons">
  15. <div>打印内容(多选)</div>
  16. <a-checkbox v-model="printNo" :checked="printNo" id="companyCollectionPaymentDetail-printNo">结算单号</a-checkbox>
  17. <a-checkbox v-model="printDate" :checked="printDate" id="companyCollectionPaymentDetail-printDate">打印时间</a-checkbox>
  18. </div>
  19. </PrintPanel>
  20. </div>
  21. </template>
  22. </a-page-header>
  23. <!-- 基础信息 -->
  24. <a-card size="small" :bordered="false" class="companyCollectionPaymentDetail-cont" v-if="basicInfoData">
  25. <a-collapse :activeKey="['1']">
  26. <a-collapse-panel key="1" header="基础信息">
  27. <a-descriptions :column="3">
  28. <a-descriptions-item label="客户名称" v-if="basicInfoData.settleClientType&&basicInfoData.settleClientType=='CUSTOMER'">{{ basicInfoData.settleClientNameCurrent || '--' }}{{ basicInfoData.settleClientName?basicInfoData.settleClientName==basicInfoData.settleClientNameCurrent?'':'('+basicInfoData.settleClientName+')':'' }}</a-descriptions-item>
  29. <a-descriptions-item label="客户名称" v-else>{{ basicInfoData.settleClientName ||'--' }}</a-descriptions-item>
  30. <a-descriptions-item label="单位类型">{{ basicInfoData.settleClientTypeDictValue || '--' }}</a-descriptions-item>
  31. <a-descriptions-item label="结算类型">{{ basicInfoData.settleTypeDictValue || '--' }}</a-descriptions-item>
  32. <a-descriptions-item label="应结算金额">{{ (basicInfoData.settleAmount || basicInfoData.settleAmount==0) ? toThousands(basicInfoData.settleAmount) : '--' }}</a-descriptions-item>
  33. <a-descriptions-item label="折让金额">{{ (discountAmount || discountAmount==0) ? toThousands(discountAmount) : '--' }}</a-descriptions-item>
  34. <a-descriptions-item label="实结算金额">{{ (basicInfoData.realSettleAmount || basicInfoData.realSettleAmount==0) ? toThousands(basicInfoData.realSettleAmount) : '--' }}</a-descriptions-item>
  35. <a-descriptions-item label="结算时间">{{ basicInfoData.createDate || '--' }}</a-descriptions-item>
  36. <a-descriptions-item label="操作人">{{ basicInfoData.operateName || '--' }}</a-descriptions-item>
  37. <a-descriptions-item label="结算方式">{{ basicInfoData.settleStyleSnDictValue || '--' }}</a-descriptions-item>
  38. <a-descriptions-item label="备注">{{ basicInfoData.remark || '--' }}</a-descriptions-item>
  39. </a-descriptions>
  40. </a-collapse-panel>
  41. </a-collapse>
  42. </a-card>
  43. <!-- 收款明细 -->
  44. <a-card size="small" :bordered="false" class="companyCollectionPaymentDetail-cont">
  45. <!-- alert -->
  46. <a-alert type="info" style="margin-bottom:10px">
  47. <div slot="message">
  48. 共 <strong>{{ total }}</strong> 条明细,
  49. 金额合计 <strong>{{ (basicInfoData&&(basicInfoData.totalSettleAmount || basicInfoData.totalSettleAmount==0)) ? toThousands(basicInfoData.totalSettleAmount) : '--' }}</strong> ,
  50. 结算金额合计 <strong>{{ (basicInfoData&&(basicInfoData.realSettleAmount || basicInfoData.realSettleAmount==0)) ? toThousands(basicInfoData.realSettleAmount) : '--' }}</strong>
  51. </div>
  52. </a-alert>
  53. <!-- 列表 -->
  54. <s-table
  55. class="sTable"
  56. ref="table"
  57. size="small"
  58. :rowKey="(record) => record.id"
  59. :columns="columns"
  60. :data="loadData"
  61. :defaultLoadData="false"
  62. bordered>
  63. </s-table>
  64. </a-card>
  65. </a-spin>
  66. </div>
  67. </template>
  68. <script>
  69. import { commonMixin } from '@/utils/mixin'
  70. import { STable, VSelect } from '@/components'
  71. import PrintPanel from '@/views/common/printPanel.vue'
  72. import { hdPrint } from '@/libs/JGPrint'
  73. import { settleUnitDetailList, settleUnitDetail, settleUnitDetailPrint, settleUnitDetailExport } from '@/api/settle'
  74. export default {
  75. name: 'CompanyCollectionPaymentDetail',
  76. components: { STable, VSelect, PrintPanel },
  77. mixins: [commonMixin],
  78. data () {
  79. const _this = this
  80. return {
  81. spinning: false,
  82. // 表头
  83. columns: [
  84. { title: '序号', dataIndex: 'no', align: 'center', width: '5%' },
  85. { title: '单据号', dataIndex: 'bizNo', align: 'center', width: '20%', customRender: function (text) { return text || '--' } },
  86. { title: '单据类型', dataIndex: 'bizTypeDictValue', align: 'center', width: '15%', customRender: function (text) { return text || '--' } },
  87. { title: '审核时间', dataIndex: 'auditTime', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
  88. { title: '总款数', dataIndex: 'bizTotalCategory', align: 'center', width: '10%', customRender: function (text) { return (text || text == 0) ? text : '--' } },
  89. { title: '总数量', dataIndex: 'bizTotalQty', align: 'center', width: '10%', customRender: function (text) { return (text || text == 0) ? text : '--' } },
  90. { title: '金额', dataIndex: 'totalAmount', align: 'right', width: '10%', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } },
  91. { title: '结算金额', dataIndex: 'settleAmount', align: 'right', width: '10%', customRender: function (text) { return ((text || text == 0) ? _this.toThousands(text) : '--') } }
  92. ],
  93. // 加载数据方法 必须为 Promise 对象
  94. loadData: parameter => {
  95. this.disabled = true
  96. this.spinning = true
  97. return settleUnitDetailList(Object.assign(parameter, { unitSettleSn: this.$route.params.sn })).then(res => {
  98. let data
  99. if (res.status == 200) {
  100. data = res.data
  101. const no = (data.pageNo - 1) * data.pageSize
  102. for (var i = 0; i < data.list.length; i++) {
  103. data.list[i].no = no + i + 1
  104. }
  105. this.disabled = false
  106. this.total = data.count || 0
  107. }
  108. this.spinning = false
  109. return data
  110. })
  111. },
  112. total: 0, // 总条数
  113. basicInfoData: null, // 基本信息
  114. printNo: false, // 是否打印销售单号
  115. printDate: false // 是否打印日期
  116. }
  117. },
  118. computed: {
  119. // 折让金额
  120. discountAmount () {
  121. let val = 0
  122. if (this.basicInfoData && this.basicInfoData.discountAmount) {
  123. val = Math.abs(this.basicInfoData.discountAmount)
  124. }
  125. return val
  126. }
  127. },
  128. methods: {
  129. // 返回列表
  130. handleBack () {
  131. this.$router.push({ name: 'companyCollectionPaymentList' })
  132. },
  133. // 打印预览/快捷打印
  134. handlePrint (type, printerType) {
  135. const _this = this
  136. _this.spinning = true
  137. let url = settleUnitDetailPrint
  138. const params = {
  139. id: this.$route.params.id,
  140. printNo: this.printNo ? 1 : 0,
  141. printDate: this.printDate ? 1 : 0
  142. }
  143. if (type == 'export') { // 导出
  144. url = settleUnitDetailExport
  145. }
  146. // 打印或导出
  147. hdPrint(printerType, type, url, params, '单位收付款记录详情', function () {
  148. _this.spinning = false
  149. })
  150. },
  151. // 详情
  152. getDetail () {
  153. settleUnitDetail({ id: this.$route.params.id }).then(res => {
  154. if (res.status == 200) {
  155. this.basicInfoData = res.data
  156. this.$nextTick(() => {
  157. this.$refs.table.refresh(true)
  158. })
  159. } else {
  160. this.basicInfoData = null
  161. }
  162. })
  163. }
  164. },
  165. watch: {
  166. printDate (newValue, oldValue) {
  167. localStorage.setItem('printDate-ccp-' + this.$store.state.user.info.orgId, newValue)
  168. },
  169. printNo (newValue, oldValue) {
  170. localStorage.setItem('printNo-ccp-' + this.$store.state.user.info.orgId, newValue)
  171. }
  172. },
  173. activated () {
  174. // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
  175. if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
  176. this.printDate = localStorage.getItem('printDate-ccp-' + this.$store.state.user.info.orgId) == 'true'
  177. this.printNo = localStorage.getItem('printNo-ccp-' + this.$store.state.user.info.orgId) == 'true'
  178. this.getDetail()
  179. }
  180. },
  181. beforeRouteEnter (to, from, next) {
  182. next(vm => {})
  183. }
  184. }
  185. </script>
  186. <style lang="less">
  187. .companyCollectionPaymentDetail-cont{
  188. margin-bottom: 6px;
  189. }
  190. </style>