list.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <template>
  2. <view class="sales-list-wrap">
  3. <u-dropdown class="search-top-box" id="tjCons">
  4. <u-dropdown-item v-model="searchForm.billStatus" @change="handleChange('bill')" title="业务状态" :options="billStatusOpt"></u-dropdown-item>
  5. <u-dropdown-item v-model="searchForm.financialStatus" @change="handleChange('financial')" title="财务状态" :options="financialStatusOpt"></u-dropdown-item>
  6. </u-dropdown>
  7. <!-- 销售单列表 -->
  8. <view class="list-box">
  9. <listComponent ref="salesList" :height="listHeight" :params="searchForm" />
  10. </view>
  11. <!-- 查询右侧弹框 -->
  12. <salesSearch ref="searchBox" :openModal="openModal" :defaultParams="searchForm" @refresh="refresh" @close="openModal=false" />
  13. </view>
  14. </template>
  15. <script>
  16. import ListComponent from './listComponent.vue'
  17. import SalesSearch from './salesSearch.vue'
  18. import { getLookUpItem } from '@/api/data'
  19. import { salesList } from '@/api/sales'
  20. export default{
  21. components: { ListComponent, SalesSearch },
  22. data(){
  23. return{
  24. listData: [],
  25. pageNo: 1,
  26. pageSize: 6,
  27. totalNum: 0,
  28. noDataText: '暂无数据',
  29. billStatusOpt: [],
  30. financialStatusOpt: [],
  31. searchForm: {
  32. billStatus: null,
  33. financialStatus: null
  34. },
  35. listHeight: 200,
  36. openModal: false
  37. }
  38. },
  39. onNavigationBarButtonTap(e){ // 标题栏 按钮操作
  40. this.openModal = true
  41. },
  42. onBackPress() {
  43. if(this.openModal){
  44. this.$refs.searchBox.closeBox()
  45. this.openModal = false
  46. return true
  47. }
  48. },
  49. onReady() {
  50. const query = uni.createSelectorQuery().in(this);
  51. query.select('#tjCons').boundingClientRect(data => {
  52. this.listHeight = Math.floor(data.height + 5)
  53. }).exec();
  54. },
  55. onLoad() {
  56. const _this = this
  57. this.getLookUpItem('SALES_BILL_STATUS')
  58. this.getLookUpItem('FINANCIAL_RECEIVE_STATUS')
  59. this.$nextTick(function(){
  60. // 监听整改完成后刷新事件
  61. uni.$on('refreshSalesBL', function(data){
  62. _this.$refs.salesList.getList(1)
  63. })
  64. })
  65. },
  66. onUnload() {
  67. uni.$off('refreshSalesBL')
  68. },
  69. methods: {
  70. // 获取查询参数 刷新列表
  71. refresh(params){
  72. const _this = this
  73. const data = params ? Object.assign(this.searchForm,params) : {
  74. billStatus: null,
  75. financialStatus: null
  76. }
  77. data.beginDate = data.beginDate ? (data.beginDate + ' 00:00:00') : ''
  78. data.endDate = data.endDate ? (data.endDate + ' 23:59:59') : ''
  79. this.searchForm = data
  80. this.$nextTick(function(){
  81. _this.$refs.salesList.refash()
  82. })
  83. },
  84. // 状态 change
  85. handleChange(type){
  86. this.$refs.salesList.refash()
  87. },
  88. // 配送方式
  89. getLookUpItem (type) {
  90. getLookUpItem({ lookupCode: type, pageNo: 1, pageSize: 1000 }).then(res => {
  91. if (res.status == 200 && res.data && res.data.list) {
  92. res.data.list.map(item => {
  93. item.label = item.dispName
  94. item.value = item.code
  95. })
  96. res.data.list.splice(0, 0, { label: '全部', value: null })
  97. if(type == 'SALES_BILL_STATUS'){
  98. this.billStatusOpt = res.data.list
  99. }else if(type == 'FINANCIAL_RECEIVE_STATUS'){
  100. this.financialStatusOpt = res.data.list
  101. }
  102. } else {
  103. if(type == 'SALES_BILL_STATUS'){
  104. this.billStatusOpt = []
  105. }else if(type == 'FINANCIAL_RECEIVE_STATUS'){
  106. this.financialStatusOpt = []
  107. }
  108. }
  109. })
  110. }
  111. }
  112. }
  113. </script>
  114. <style lang="scss">
  115. .sales-list-wrap{
  116. width: 100%;
  117. .search-top-box{
  118. background-color: #fff;
  119. }
  120. .list-box{
  121. padding: 0 25upx;
  122. }
  123. }
  124. </style>