list.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  1. <template>
  2. <div>
  3. <a-card size="small" :bordered="false" class="searchBoxNormal">
  4. <!-- 搜索条件 -->
  5. <div ref="tableSearch" class="table-page-search-wrapper">
  6. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  7. <a-row :gutter="15">
  8. <a-col :md="6" :sm="24">
  9. <a-form-item label="创建时间">
  10. <rangeDate id="accountStatement-rangeDate" ref="rangeDate" :value="creatDate" @change="dateChange" />
  11. </a-form-item>
  12. </a-col>
  13. <a-col :md="6" :sm="24">
  14. <a-form-item label="客户名称">
  15. <dealerSubareaScopeList id="accountStatement-dealerName" ref="dealer" @change="custChange" @dealerDetail="getDealerDetail" />
  16. </a-form-item>
  17. </a-col>
  18. <a-col :md="6" :sm="24">
  19. <a-form-item label="对账单号">
  20. <a-input id="accountStatement-verifyAccountBillNo" v-model.trim="queryParam.verifyAccountBillNo" allowClear placeholder="请输入对账单号"/>
  21. </a-form-item>
  22. </a-col>
  23. <a-col :md="6" :sm="24">
  24. <a-form-item label="业务状态">
  25. <v-select
  26. v-model="queryParam.billStatus"
  27. ref="status"
  28. id="accountStatement-status"
  29. code="VERIFY_ACCOUNT_STATUS"
  30. placeholder="请选择业务状态"
  31. allowClear></v-select>
  32. </a-form-item>
  33. </a-col>
  34. <a-col :md="24" :sm="24" style="margin-bottom: 10px;text-align: center;">
  35. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="accountStatement-refresh">查询</a-button>
  36. <a-button style="margin-left: 5px" @click="resetSearchForm" :disabled="disabled" id="accountStatement-reset">重置</a-button>
  37. </a-col>
  38. </a-row>
  39. </a-form>
  40. </div>
  41. </a-card>
  42. <a-card size="small" :bordered="false" class="accountStatement-wrap">
  43. <a-spin :spinning="spinning" tip="Loading...">
  44. <!-- 操作按钮 -->
  45. <div class="table-operator">
  46. <div class="flex-center">
  47. <a-button type="primary" @click="handleAdd">新增</a-button>
  48. <div class="tongji-bar"></div>
  49. </div>
  50. <div></div>
  51. </div>
  52. <!-- 列表 -->
  53. <s-table
  54. class="sTable fixPagination"
  55. ref="table"
  56. :style="{ height: tableHeight+80+'px' }"
  57. size="small"
  58. :rowKey="(record) => record.id"
  59. :columns="columns"
  60. :data="loadData"
  61. :scroll="{ y: tableHeight }"
  62. :pageSize="30"
  63. :defaultLoadData="false"
  64. bordered>
  65. <!-- 单号 -->
  66. <template slot="verifyAccountBillNo" slot-scope="text, record">
  67. <span v-if="$hasPermissions('B_fc_detail')" class="link-bule" @click="handleDetail(record,0)">{{ record.verifyAccountBillNo }}</span>
  68. <span v-else>{{ record.verifyAccountBillNo }}</span>
  69. </template>
  70. <!-- 操作 -->
  71. <template slot="action" slot-scope="text, record">
  72. <div>
  73. <a-button
  74. v-if="record.billStatus=='WAIT_CONFIRM'"
  75. size="small"
  76. type="link"
  77. class="button-info"
  78. @click="handleDetail(record,1)"
  79. >
  80. 对单
  81. </a-button>
  82. <a-button
  83. v-if="record.billStatus=='WAIT_VERIFY'"
  84. size="small"
  85. type="link"
  86. class="button-info"
  87. @click="checkAcount(record)"
  88. >
  89. 对账
  90. </a-button>
  91. <a-button
  92. size="small"
  93. type="link"
  94. v-if="record.billStatus=='WAIT_SUBMIT'||record.billStatus=='WAIT_CONFIRM'"
  95. class="button-info"
  96. @click="handleEdit(record)"
  97. >
  98. 编辑
  99. </a-button>
  100. <a-button
  101. v-if="record.billStatus=='WAIT_SUBMIT'||record.billStatus=='WAIT_CONFIRM'"
  102. size="small"
  103. type="link"
  104. class="button-error"
  105. @click="handleDel(record)"
  106. >
  107. 删除
  108. </a-button>
  109. </div>
  110. </template>
  111. </s-table>
  112. </a-spin>
  113. <!-- 基础信息 -->
  114. <baseModal v-drag :show="baseModal" @cancel="baseModal=false"></baseModal>
  115. <!-- 对单 -->
  116. <confrontModal v-drag :show="openModal" ref="detailModal" @cancel="openModal=false" @confirm="confirmOk"></confrontModal>
  117. </a-card>
  118. </div>
  119. </template>
  120. <script>
  121. import { commonMixin } from '@/utils/mixin'
  122. import { STable, VSelect } from '@/components'
  123. import rangeDate from '@/views/common/rangeDate.vue'
  124. import dealerSubareaScopeList from '@/views/common/dealerSubareaScopeList.vue'
  125. import baseModal from './baseModal.vue'
  126. import confrontModal from './confrontModal.vue'
  127. import { verifyAcountBillList, verifyAcountBillDel, verifyAcountBillVerify } from '@/api/verifyAccount.js'
  128. export default {
  129. name: 'AccountStatementList',
  130. mixins: [commonMixin],
  131. components: { STable, VSelect, rangeDate, baseModal, confrontModal, dealerSubareaScopeList },
  132. data () {
  133. return {
  134. spinning: false,
  135. openModal: false,
  136. baseModal: false,
  137. tableHeight: 0,
  138. queryParam: { // 查询条件
  139. beginDate: '',
  140. endDate: '',
  141. verifyAccountBillNo: '',
  142. dealerName: undefined,
  143. dealerSn: undefined,
  144. billStatus: undefined
  145. },
  146. disabled: false, // 查询、重置按钮是否可操作
  147. creatDate: [], // 创建时间
  148. // 加载数据方法 必须为 Promise 对象
  149. loadData: parameter => {
  150. this.disabled = true
  151. this.spinning = true
  152. const params = Object.assign(parameter, this.queryParam)
  153. return verifyAcountBillList(params).then(res => {
  154. let data
  155. if (res.status == 200) {
  156. data = res.data
  157. const no = (data.pageNo - 1) * data.pageSize
  158. for (var i = 0; i < data.list.length; i++) {
  159. data.list[i].no = no + i + 1
  160. }
  161. this.total = data.count || 0
  162. this.disabled = false
  163. }
  164. this.spinning = false
  165. return data
  166. })
  167. },
  168. total: 0, // 合计
  169. countData: null,
  170. detailType: null,
  171. editRow: null
  172. }
  173. },
  174. // 根据权限显示列表字段
  175. computed: {
  176. columns () {
  177. const arr = [
  178. { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
  179. { title: '创建时间', dataIndex: 'createDate', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  180. { title: '对账单号', scopedSlots: { customRender: 'verifyAccountBillNo' }, width: '10%', align: 'center' },
  181. { title: '客户名称', dataIndex: 'dealerName', width: '26%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  182. { title: '余额', dataIndex: 'totalAmount', width: '10%', align: 'right', customRender: text => ((text || text == 0) ? this.toThousands(text) : '--') },
  183. { title: '对单时间', dataIndex: 'confirmDate', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  184. { title: '对账时间', dataIndex: 'verifyDate', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  185. { title: '业务状态', dataIndex: 'billStatusDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
  186. { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
  187. ]
  188. return arr
  189. }
  190. },
  191. methods: {
  192. // 创建时间 change
  193. dateChange (date) {
  194. this.queryParam.beginDate = date[0] ? date[0] : ''
  195. this.queryParam.endDate = date[1] ? date[1] : ''
  196. },
  197. // 客户
  198. custChange (v) {
  199. if (v && v.key) {
  200. this.queryParam.dealerSn = v.key
  201. this.queryParam.dealerName = v.row ? v.row.dealerName : ''
  202. } else {
  203. this.queryParam.dealerSn = ''
  204. this.queryParam.dealerName = ''
  205. }
  206. },
  207. // 重置
  208. resetSearchForm () {
  209. this.creatDate = []
  210. this.$refs.rangeDate.resetDate(this.creatDate)
  211. this.queryParam.beginDate = ''
  212. this.queryParam.endDate = ''
  213. this.queryParam.dealerName = undefined
  214. this.queryParam.dealerSn = undefined
  215. this.queryParam.verifyAccountBillNo = ''
  216. this.queryParam.billStatus = undefined
  217. if (this.$refs.dealer) {
  218. this.$refs.dealer.resetForm()
  219. }
  220. this.$refs.table.refresh(true)
  221. },
  222. // 新增
  223. handleAdd () {
  224. this.baseModal = true
  225. },
  226. // 编辑
  227. handleEdit (row) {
  228. this.$router.push({ name: 'accountStatementEdit', params: { sn: row.verifyAccountBillSn, type: 0 } })
  229. },
  230. // 删除
  231. handleDel (row) {
  232. const _this = this
  233. this.$confirm({
  234. title: '提示(' + row.dealerName + ')',
  235. content: <div style="font-size:14px;"><div>对账单号:{row.verifyAccountBillNo}</div><div>余额:{Number(row.totalAmount).toFixed(2)}元,确定删除吗?</div></div>,
  236. centered: true,
  237. closable: true,
  238. onOk () {
  239. _this.spinning = true
  240. verifyAcountBillDel({ sn: row.verifyAccountBillSn }).then(res => {
  241. if (res.status == 200) {
  242. _this.$message.success(res.message)
  243. _this.$refs.table.refresh()
  244. _this.spinning = false
  245. } else {
  246. _this.spinning = false
  247. }
  248. })
  249. }
  250. })
  251. },
  252. // 0详情,1对单
  253. handleDetail (row, type) {
  254. this.spinning = true
  255. this.$refs.dealer.getDetail(row.dealerSn, true)
  256. this.detailType = type
  257. this.editRow = row
  258. },
  259. getDealerDetail (data) {
  260. this.spinning = false
  261. this.$refs.detailModal.pageInit(this.editRow, data, this.detailType)
  262. this.openModal = true
  263. },
  264. // 对单成功
  265. confirmOk () {
  266. this.openModal = false
  267. this.$refs.table.refresh()
  268. },
  269. // 对账
  270. checkAcount (row) {
  271. const _this = this
  272. this.$confirm({
  273. title: '提示(' + row.dealerName + ')',
  274. content: <div style="font-size:14px;"><div>对账单号:{row.verifyAccountBillNo}</div><div>余额:{row.totalAmount},确定对账吗?</div></div>,
  275. centered: true,
  276. closable: true,
  277. onOk () {
  278. _this.spinning = true
  279. verifyAcountBillVerify({ sn: row.verifyAccountBillSn }).then(res => {
  280. if (res.status == 200) {
  281. _this.$message.success(res.message)
  282. _this.$refs.table.refresh()
  283. _this.spinning = false
  284. } else {
  285. _this.spinning = false
  286. }
  287. })
  288. }
  289. })
  290. },
  291. pageInit () {
  292. const _this = this
  293. this.$nextTick(() => { // 页面渲染完成后的回调
  294. _this.setTableH()
  295. })
  296. },
  297. setTableH () {
  298. const tableSearchH = this.$refs.tableSearch.offsetHeight
  299. this.tableHeight = window.innerHeight - tableSearchH - 250
  300. }
  301. },
  302. watch: {
  303. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  304. this.setTableH()
  305. }
  306. },
  307. mounted () {
  308. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  309. this.pageInit()
  310. this.resetSearchForm()
  311. }
  312. },
  313. activated () {
  314. // 如果是新页签打开,则重置当前页面
  315. if (this.$store.state.app.isNewTab) {
  316. this.pageInit()
  317. this.resetSearchForm()
  318. }
  319. // 仅刷新列表,不重置页面
  320. if (this.$store.state.app.updateList) {
  321. this.pageInit()
  322. this.$refs.table.refresh()
  323. }
  324. },
  325. beforeRouteEnter (to, from, next) {
  326. next(vm => {})
  327. }
  328. }
  329. </script>
  330. <style lang="less">
  331. .accountStatement-wrap{
  332. .active{
  333. color: #ed1c24;
  334. cursor: pointer;
  335. }
  336. .common{
  337. color: rgba(0, 0, 0);
  338. }
  339. }
  340. </style>