list.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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. this.searchParams = Object.assign(params, this.searchForm)
  61. this.$nextTick(function(){
  62. _this.$refs.salesList.getList(1)
  63. })
  64. },
  65. // 状态 change
  66. handleChange(type){
  67. if(type == 'bill'){
  68. this.searchParams.billStatus = this.searchForm.billStatus
  69. }else if(type == 'financial'){
  70. this.searchParams.financialStatus = this.searchForm.financialStatus
  71. }
  72. this.$refs.salesList.getList(1)
  73. },
  74. // 配送方式
  75. getLookUpItem (type) {
  76. getLookUpItem({ lookupCode: type, pageNo: 1, pageSize: 1000 }).then(res => {
  77. if (res.status == 200 && res.data && res.data.list) {
  78. res.data.list.map(item => {
  79. item.label = item.dispName
  80. item.value = item.code
  81. })
  82. res.data.list.splice(0, 0, { label: '全部', value: null })
  83. if(type == 'SALES_BILL_STATUS'){
  84. this.billStatusOpt = res.data.list
  85. }else if(type == 'FINANCIAL_RECEIVE_STATUS'){
  86. this.financialStatusOpt = res.data.list
  87. }
  88. } else {
  89. if(type == 'SALES_BILL_STATUS'){
  90. this.billStatusOpt = []
  91. }else if(type == 'FINANCIAL_RECEIVE_STATUS'){
  92. this.financialStatusOpt = []
  93. }
  94. }
  95. })
  96. }
  97. }
  98. }
  99. </script>
  100. <style lang="scss">
  101. .sales-list-wrap{
  102. width: 100%;
  103. .search-top-box{
  104. background-color: #fff;
  105. }
  106. .list-box{
  107. padding: 20upx 20upx;
  108. }
  109. }
  110. </style>