list.vue 4.2 KB

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