list.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <template>
  2. <view class="sales-list-wrap">
  3. <u-dropdown class="search-top-box">
  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="100" :params="searchParams" />
  10. </view>
  11. <!-- 查询右侧弹框 -->
  12. <salesSearch :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. searchParams: {},
  36. openModal: false
  37. }
  38. },
  39. onNavigationBarButtonTap(e){ // 标题栏 按钮操作
  40. this.openModal = true
  41. },
  42. onLoad() {
  43. const _this = this
  44. this.getLookUpItem('SALES_BILL_STATUS')
  45. this.getLookUpItem('FINANCIAL_RECEIVE_STATUS')
  46. this.$nextTick(function(){
  47. // 监听整改完成后刷新事件
  48. uni.$on('refreshBL', function(data){
  49. _this.$refs.salesList.getList(1)
  50. })
  51. })
  52. },
  53. onUnload() {
  54. uni.$off('refreshBL')
  55. },
  56. methods: {
  57. // 获取查询参数 刷新列表
  58. refresh(params){
  59. const _this = this
  60. const data = {}
  61. if(this.searchForm.billStatus){
  62. data.billStatus = this.searchForm.billStatus
  63. }
  64. if(this.searchForm.financialStatus){
  65. data.financialStatus = this.searchForm.financialStatus
  66. }
  67. if(params.beginDate){
  68. data.beginDate = params.beginDate
  69. }
  70. if(params.endDate){
  71. data.endDate = params.endDate
  72. }
  73. if(params.buyerName){
  74. data.buyerName = params.buyerName
  75. }
  76. if(params.salesBillNo){
  77. data.salesBillNo = params.salesBillNo
  78. }
  79. if(params.purchaseBillNo){
  80. data.purchaseBillNo = params.purchaseBillNo
  81. }
  82. if(params.settleStyleSn){
  83. data.settleStyleSn = params.settleStyleSn
  84. }
  85. this.searchParams = data
  86. console.log(this.searchParams,'this.searchParams')
  87. this.$nextTick(function(){
  88. _this.$refs.salesList.getList(1)
  89. })
  90. },
  91. // 状态 change
  92. handleChange(type){
  93. if(type == 'bill'){
  94. this.searchParams.billStatus = this.searchForm.billStatus
  95. }else if(type == 'financial'){
  96. this.searchParams.financialStatus = this.searchForm.financialStatus
  97. }
  98. this.$refs.salesList.getList(1)
  99. },
  100. // 配送方式
  101. getLookUpItem (type) {
  102. getLookUpItem({ lookupCode: type, pageNo: 1, pageSize: 1000 }).then(res => {
  103. if (res.status == 200 && res.data && res.data.list) {
  104. res.data.list.map(item => {
  105. item.label = item.dispName
  106. item.value = item.code
  107. })
  108. res.data.list.splice(0, 0, { label: '全部', value: null })
  109. if(type == 'SALES_BILL_STATUS'){
  110. this.billStatusOpt = res.data.list
  111. }else if(type == 'FINANCIAL_RECEIVE_STATUS'){
  112. this.financialStatusOpt = res.data.list
  113. }
  114. } else {
  115. if(type == 'SALES_BILL_STATUS'){
  116. this.billStatusOpt = []
  117. }else if(type == 'FINANCIAL_RECEIVE_STATUS'){
  118. this.financialStatusOpt = []
  119. }
  120. }
  121. })
  122. }
  123. }
  124. }
  125. </script>
  126. <style lang="scss">
  127. .sales-list-wrap{
  128. width: 100%;
  129. .search-top-box{
  130. background-color: #fff;
  131. }
  132. .list-box{
  133. padding: 20upx 20upx 0;
  134. }
  135. }
  136. </style>