detailModal.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. <template>
  2. <a-modal
  3. centered
  4. class="collection-detail-modal"
  5. :footer="null"
  6. :maskClosable="false"
  7. v-model="isShow"
  8. :title="modalTit"
  9. :bodyStyle="{padding: modalTit?'25px 32px 20px':'50px 32px 15px'}"
  10. @cancel="isShow=false"
  11. width="80%">
  12. <a-spin :spinning="spinning" tip="Loading...">
  13. <div class="common-main">
  14. <div class="toolsBar">
  15. <div v-if="handlePlData.length">{{ handlePlData[0].settleClientName }},共 {{ handlePlData && handlePlData.length }} 个备货单,合计 {{ toThousands(totalAmount) }},已选择 {{ chooseData.length }} 个收款单</div>
  16. <a-button type="primary" class="button-primary" @click="handleCommonOk">{{ okText }}</a-button>
  17. </div>
  18. <div>
  19. <a-table :columns="columns" :scroll="{ y: 400 }" :pagination="false" :data-source="chooseData" bordered>
  20. <!-- 收款单号 -->
  21. <template slot="bookNo" slot-scope="text, record">
  22. <span v-if="$hasPermissions('B_fc_detail')" class="link-bule" @click="viewDetail(record)">{{ record.bookNo }}</span>
  23. <span v-else>{{ record.bookNo }}</span>
  24. </template>
  25. <!-- 操作 -->
  26. <template slot="action" slot-scope="text, record">
  27. <a-button
  28. size="small"
  29. type="link"
  30. class="button-error"
  31. @click="handleDel(record)"
  32. >
  33. 删除
  34. </a-button>
  35. </template>
  36. </a-table>
  37. </div>
  38. </div>
  39. <a-divider>请选择收款单</a-divider>
  40. <div class="common-main">
  41. <!-- 搜索条件 -->
  42. <div ref="tableSearch" class="table-page-search-wrapper">
  43. <a-form layout="inline">
  44. <a-row :gutter="15">
  45. <a-col :md="5" :sm="24">
  46. <a-form-item label="收款单号">
  47. <a-input v-model.trim="queryParam.bookNo" allowClear placeholder="请输入收款单号"/>
  48. </a-form-item>
  49. </a-col>
  50. <a-col :md="5" :sm="24">
  51. <a-form-item label="财务收款事由">
  52. <a-input v-model.trim="queryParam.bookReason" allowClear placeholder="请输入财务收款事由"/>
  53. </a-form-item>
  54. </a-col>
  55. <a-col :md="5" :sm="24">
  56. <a-form-item label="申请人">
  57. <employee style="width: 100%;" placeholder="请选择申请人" v-model="queryParam.applyPersonSn"></employee>
  58. </a-form-item>
  59. </a-col>
  60. <a-col :md="5" :sm="24">
  61. <a-form-item label="申请时间">
  62. <rangeDate ref="rangeApply" :value="applyDate" @change="dateApplyChange" />
  63. </a-form-item>
  64. </a-col>
  65. <a-col :md="4" :sm="24">
  66. <span class="table-page-search-submitButtons">
  67. <a-button type="primary" :disabled="disabled" @click="$refs.table.refresh(true)">查询</a-button>
  68. <a-button style="margin-left: 8px" :disabled="disabled" @click="resetSearchForm()">重置</a-button>
  69. </span>
  70. </a-col>
  71. </a-row>
  72. </a-form>
  73. </div>
  74. <!-- 表格数据 -->
  75. <s-table
  76. class="sTable"
  77. ref="table"
  78. size="small"
  79. :rowKey="(record) => record.id"
  80. :columns="columns"
  81. :data="loadData"
  82. :scroll="{ y: 400 }"
  83. :pageSize="10"
  84. bordered>
  85. <!-- 收款单号 -->
  86. <template slot="bookNo" slot-scope="text, record">
  87. <span v-if="$hasPermissions('B_fc_detail')" class="link-bule" @click="viewDetail(record)">{{ record.bookNo }}</span>
  88. <span v-else>{{ record.bookNo }}</span>
  89. </template>
  90. <!-- 操作 -->
  91. <template slot="action" slot-scope="text, record">
  92. <a-button
  93. size="small"
  94. type="link"
  95. class="button-warning"
  96. v-if="!record.checked"
  97. @click="handleChoose(record)"
  98. >选择</a-button>
  99. <span style="color:green;" v-else>已选</span>
  100. </template>
  101. </s-table>
  102. </div>
  103. </a-spin>
  104. <!-- 查看财务收款详情 -->
  105. <commonModal
  106. modalTit="财务收款详情"
  107. bodyPadding="10px"
  108. width="70%"
  109. :showFooter="false"
  110. :openModal="showDetailModal"
  111. @cancel="showDetailModal=false">
  112. <detailModal ref="detailModal"></detailModal>
  113. </commonModal>
  114. </a-modal>
  115. </template>
  116. <script>
  117. import { commonMixin } from '@/utils/mixin'
  118. import { STable, VSelect } from '@/components'
  119. import { financeBookQueryPage } from '@/api/financeBook.js'
  120. import rangeDate from '@/views/common/rangeDate.vue'
  121. import commonModal from '@/views/common/commonModal.vue'
  122. import detailModal from '@/views/financialManagement/financialCollection/detail.vue'
  123. import employee from '../../expenseManagement/expenseReimbursement/employee.js'
  124. import { settleReceiptBookBatch } from '@/api/settleReceipt'
  125. export default {
  126. name: 'GlDetailModal',
  127. mixins: [commonMixin],
  128. components: { STable, VSelect, employee, commonModal, detailModal, rangeDate },
  129. props: {
  130. openModal: { // 弹框显示状态
  131. type: Boolean,
  132. default: false
  133. },
  134. modalTit: { // 弹框标题
  135. type: String,
  136. default: null
  137. },
  138. okText: { // 确定 按钮文字
  139. type: String,
  140. default: '确定收款'
  141. },
  142. cancelText: { // 取消 按钮文字
  143. type: String,
  144. default: '取消'
  145. },
  146. isCancel: { // 是否显示 取消 按钮
  147. type: Boolean,
  148. default: true
  149. }
  150. },
  151. data () {
  152. return {
  153. isShow: this.openModal, // 是否打开弹框
  154. disabled: false,
  155. spinning: false,
  156. showDetailModal: false,
  157. handlePlData: [],
  158. applyDate: [],
  159. queryParam: {
  160. bookNo: '',
  161. bookReason: '',
  162. applyPersonSn: undefined,
  163. status: 'AUDIT_PASS',
  164. auditBeginDate: undefined,
  165. auditEndDate: undefined
  166. },
  167. chooseData: [],
  168. columns: [
  169. { title: '序号', dataIndex: 'no', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
  170. { title: '收款单号', scopedSlots: { customRender: 'bookNo' }, width: '8%', align: 'center' },
  171. { title: '申请人', dataIndex: 'applyPersonName', width: '8%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
  172. { title: '财务收款事由', dataIndex: 'bookReason', width: '12%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  173. { title: '付款方', dataIndex: 'payerName', width: '12%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  174. { title: '订单总金额', dataIndex: 'orderTotalAmount', width: '8%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
  175. { title: '收款总金额', dataIndex: 'receiptTotalAmount', width: '8%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
  176. { title: '使用授信总金额', dataIndex: 'useTotalAmount', width: '8%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
  177. { title: '授信还款总金额', dataIndex: 'payTotalAmount', width: '8%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
  178. { title: '余款抵扣总金额', dataIndex: 'balanceTotalAmount', width: '8%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
  179. { title: '审核时间', dataIndex: 'auditDate', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  180. { title: '状态', dataIndex: 'statusDictValue', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
  181. { title: '操作', scopedSlots: { customRender: 'action' }, width: '8%', align: 'center' }
  182. ],
  183. orginData: [],
  184. // 加载数据方法 必须为 Promise 对象
  185. loadData: parameter => {
  186. this.disabled = true
  187. this.spinning = true
  188. return financeBookQueryPage(Object.assign(parameter, this.queryParam)).then(res => {
  189. let data
  190. if (res.status == 200) {
  191. data = res.data
  192. const no = (data.pageNo - 1) * data.pageSize
  193. for (var i = 0; i < data.list.length; i++) {
  194. data.list[i].no = no + i + 1
  195. const index = this.chooseData.findIndex(item => data.list[i].bookSn == item.bookSn)
  196. data.list[i].checked = index >= 0
  197. }
  198. this.disabled = false
  199. }
  200. this.spinning = false
  201. this.orginData = data.list
  202. return data
  203. })
  204. },
  205. snList: []
  206. }
  207. },
  208. computed: {
  209. totalAmount () {
  210. let ret = 0
  211. this.handlePlData.map(item => {
  212. ret = ret + item.totalAmount
  213. })
  214. return ret.toFixed(2)
  215. }
  216. },
  217. methods: {
  218. // 财务收款详情
  219. viewDetail (row) {
  220. this.showDetailModal = true
  221. this.$nextTick(() => {
  222. this.$refs.detailModal.pageInit(row.bookSn)
  223. })
  224. },
  225. setData (data, snList) {
  226. this.handlePlData = data
  227. this.snList = snList
  228. },
  229. dateApplyChange (date) {
  230. this.queryParam.auditBeginDate = date[0]
  231. this.queryParam.auditEndDate = date[1]
  232. },
  233. // 删除
  234. handleDel (row) {
  235. const i = this.chooseData.findIndex(item => row.bookSn == item.bookSn)
  236. const oi = this.orginData.findIndex(item => row.bookSn == item.bookSn)
  237. this.chooseData.splice(i, 1)
  238. if (oi >= 0) {
  239. this.orginData[oi].checked = false
  240. }
  241. },
  242. // 选择
  243. handleChoose (row) {
  244. row.checked = true
  245. this.chooseData.push(row)
  246. },
  247. // 获取sn
  248. // 确定收款
  249. handleCommonOk () {
  250. const snList = this.snList
  251. const bookSnList = []
  252. this.chooseData.map(item => {
  253. bookSnList.push(item.bookSn)
  254. })
  255. if (bookSnList.length) {
  256. this.spinning = true
  257. settleReceiptBookBatch({
  258. bookSnList: bookSnList,
  259. snList: snList
  260. }).then(res => {
  261. this.spinning = false
  262. if (res.status == 200) {
  263. this.$emit('ok')
  264. this.$message.info(res.message)
  265. }
  266. })
  267. } else {
  268. this.$message.info('请选择关联的财务收款单')
  269. }
  270. },
  271. // 取消
  272. handleCommonCancel () {
  273. this.$emit('cancel')
  274. this.chooseData = []
  275. },
  276. // 重置
  277. resetSearchForm () {
  278. this.queryParam = {
  279. bookNo: '',
  280. bookReason: '',
  281. applyPersonSn: undefined,
  282. status: 'AUDIT_PASS'
  283. }
  284. this.orginData = []
  285. this.$nextTick(() => {
  286. this.$refs.rangeApply.resetDate()
  287. this.$refs.table.refresh(true)
  288. })
  289. }
  290. },
  291. watch: {
  292. // 父页面传过来的弹框状态
  293. openModal (newValue, oldValue) {
  294. this.isShow = newValue
  295. },
  296. // 重定义的弹框状态
  297. isShow (newValue, oldValue) {
  298. if (!newValue) {
  299. this.handleCommonCancel()
  300. } else {
  301. this.resetSearchForm()
  302. }
  303. }
  304. }
  305. }
  306. </script>
  307. <style lang="less">
  308. .collection-detail-modal{
  309. .common-main{
  310. .toolsBar{
  311. display: flex;
  312. align-items: center;
  313. margin-bottom: 10px;
  314. .ant-btn{
  315. margin-left: 30px;
  316. }
  317. }
  318. }
  319. }
  320. </style>