list.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. <template>
  2. <a-card size="small" :bordered="false" class="onlinePayInvoiceList-wrap jg-page-wrap">
  3. <a-spin :spinning="spinning" tip="Loading...">
  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="5" :sm="24">
  9. <a-form-item label="货架名称">
  10. <shelfList id="onlinePayInvoice-shelfsn" style="max-width:300px;" v-model="queryParam.shelfSn"></shelfList>
  11. </a-form-item>
  12. </a-col>
  13. <a-col :md="5" :sm="24">
  14. <a-form-item label="关联客户">
  15. <custList id="onlinePayInvoice-customerName" ref="custList" @change="custChange" v-model="queryParam.customerName"></custList>
  16. </a-form-item>
  17. </a-col>
  18. <a-col :md="4" :sm="24">
  19. <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="onlinePayInvoice-refresh" >查询</a-button>
  20. <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="onlinePayInvoice-reset">重置</a-button>
  21. </a-col>
  22. </a-row>
  23. </a-form>
  24. </div>
  25. <div class="table-operator">
  26. <div class="alert-message">
  27. 账单总金额:<strong>{{ detailData&&(detailData.totalAmount || detailData.totalAmount==0) ? toThousands(detailData.totalAmount) : '--' }}</strong>;
  28. 其中收款金额:<strong>{{ detailData&&(detailData.skAmount || detailData.skAmount==0) ? toThousands(detailData.skAmount) : '--' }}</strong>;
  29. 退款中金额:<strong>{{ detailData&&(detailData.tkzAmount || detailData.tkzAmount==0) ? toThousands(detailData.tkzAmount) : '--' }}</strong>;
  30. 已退款金额:<strong>{{ detailData&&(detailData.tkAmount || detailData.tkAmount==0) ? toThousands(detailData.tkAmount) : '--' }}</strong>;
  31. </div>
  32. </div>
  33. <s-table
  34. class="sTable fixPagination"
  35. ref="table"
  36. :style="{ height: tableHeight+77+'px' }"
  37. size="small"
  38. :rowKey="(record) => record.no"
  39. rowKeyName="no"
  40. :columns="columns"
  41. :data="loadData"
  42. :scroll="{ y:tableHeight }"
  43. :defaultLoadData="false"
  44. bordered>
  45. <template slot="action" slot-scope="text,record">
  46. <a-button
  47. size="small"
  48. type="link"
  49. class="button-primary"
  50. v-if="$hasPermissions('M_onlinePayInvoiceDetail')"
  51. @click="handleUndetail(record)"
  52. :id="'onlinePayInvoice-detail-btn-'+record.id">明细</a-button>
  53. <div v-else>--</div>
  54. </template>
  55. </s-table>
  56. </a-spin>
  57. </a-card>
  58. </template>
  59. <script>
  60. import { commonMixin } from '@/utils/mixin'
  61. import { STable } from '@/components'
  62. import shelfList from '@/views/common/shelfList'
  63. import custList from '@/views/common/custList.vue'
  64. import { queryShelfSettleRulePage, queryShelfSettleRuleCount } from '@/api/merchantNew'
  65. export default {
  66. components: { STable, shelfList, custList },
  67. mixins: [commonMixin],
  68. data () {
  69. const _this = this
  70. return {
  71. advanced: true, // 高级搜索 展开/关闭
  72. spinning: false,
  73. disabled: false,
  74. tableHeight: 0, // 表格高度
  75. time: [], // 时间
  76. queryParam: {
  77. shelfSn: undefined, // 货架sn
  78. customerSn: undefined,
  79. customerName: undefined, // 客户名称
  80. dealerSn: undefined// 登录用户的sn
  81. },
  82. detailData: null,
  83. // 列
  84. columns: [
  85. { title: '序号', dataIndex: 'no', width: '10%', align: 'center' },
  86. { title: '货架名称', dataIndex: 'shelfName', width: '25%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  87. { title: '关联客户', dataIndex: 'customerName', width: '25%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
  88. { title: '账单总金额', dataIndex: 'totalAmount', width: '15%', align: 'right', customRender: function (text) { return _this.toThousands(text, 2) || '--' } },
  89. { title: '收款金额', dataIndex: 'skAmount', width: '15%', align: 'right', customRender: function (text) { return _this.toThousands(text, 2) || '--' } },
  90. { title: '退款中金额', dataIndex: 'tkzAmount', width: '15%', align: 'right', customRender: function (text) { return _this.toThousands(text, 2) || '--' } },
  91. { title: '已退款金额', dataIndex: 'tkAmount', width: '15%', align: 'right', customRender: function (text) { return _this.toThousands(text, 2) || '--' } },
  92. { title: '操作', width: '15%', align: 'center', scopedSlots: { customRender: 'action' } }
  93. ],
  94. // 加载数据方法 必须为 Promise 对象
  95. loadData: parameter => {
  96. const _this = this
  97. _this.disabled = true
  98. _this.spinning = true
  99. _this.queryParam.dealerSn = _this.$store.state.user.authOrgs[0].orgSn
  100. const paramsPage = Object.assign(parameter, this.queryParam) // 有分页
  101. return queryShelfSettleRulePage(paramsPage).then(res => {
  102. let data
  103. if (res.status == 200) {
  104. data = res.data
  105. this.getCount(paramsPage)
  106. const no = (data.pageNo - 1) * data.pageSize
  107. for (var i = 0; i < data.list.length; i++) {
  108. data.list[i].no = no + i + 1
  109. }
  110. this.disabled = false
  111. }
  112. this.spinning = false
  113. return data
  114. })
  115. }
  116. }
  117. },
  118. methods: {
  119. // 选择客户
  120. custChange (obj, row) {
  121. console.log(obj, row)
  122. if (row) {
  123. this.queryParam.customerSn = row && row.customerSn || undefined
  124. this.queryParam.customerName = undefined
  125. } else {
  126. this.queryParam.customerName = obj || undefined
  127. this.queryParam.customerSn = undefined
  128. }
  129. },
  130. // 重置
  131. resetSearchForm () {
  132. this.queryParam = {
  133. shelfSn: undefined, // 货架sn
  134. customerSn: undefined,
  135. customerName: undefined // 客户名称
  136. }
  137. this.$refs.custList.resetForm()
  138. this.$refs.table.refresh(true)
  139. },
  140. // 合计
  141. getCount (val) {
  142. queryShelfSettleRuleCount(val).then(res => {
  143. if (res.status == 200) {
  144. this.detailData = res.data
  145. }
  146. })
  147. },
  148. // 明细
  149. handleUndetail (row) {
  150. this.$router.push({ name: 'onlinePayInvoiceDetail', params: { sn: row.customerSn, shelfSn: row.shelfSn, shelfName: row.shelfName } })
  151. },
  152. // 计算表格高度
  153. setTableH () {
  154. const tableSearchH = this.$refs.tableSearch.offsetHeight
  155. this.tableHeight = window.innerHeight - tableSearchH - 225
  156. },
  157. // 初始化页面
  158. pageInit () {
  159. const _this = this
  160. this.$nextTick(() => { // 页面渲染完成后的回调
  161. _this.setTableH()
  162. })
  163. }
  164. },
  165. mounted () {
  166. if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
  167. this.pageInit()
  168. this.resetSearchForm()
  169. }
  170. },
  171. watch: {
  172. advanced (newValue, oldValue) {
  173. const _this = this
  174. setTimeout(() => {
  175. _this.setTableH()
  176. }, 400)
  177. },
  178. '$store.state.app.winHeight' (newValue, oldValue) { // 窗口变更时,需同时更改表格高度
  179. this.setTableH()
  180. }
  181. },
  182. activated () {
  183. // 如果是新页签打开,则重置当前页面
  184. if (this.$store.state.app.isNewTab) {
  185. this.pageInit()
  186. this.resetSearchForm()
  187. }
  188. // 仅刷新列表,不重置页面
  189. if (this.$store.state.app.updateList) {
  190. this.pageInit()
  191. this.$refs.table.refresh()
  192. }
  193. },
  194. beforeRouteEnter (to, from, next) {
  195. next(vm => {})
  196. }
  197. }
  198. </script>