list.vue 3.3 KB

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