list.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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. onBackPress() {
  44. if(this.openModal){
  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 + 10)
  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 = {}
  74. if(this.searchForm.billStatus){
  75. data.billStatus = this.searchForm.billStatus
  76. }
  77. if(this.searchForm.financialStatus){
  78. data.financialStatus = this.searchForm.financialStatus
  79. }
  80. if(params){
  81. if(params.beginDate){
  82. data.beginDate = params.beginDate
  83. }
  84. if(params.endDate){
  85. data.endDate = params.endDate
  86. }
  87. if(params.buyerName){
  88. data.buyerName = params.buyerName
  89. }
  90. if(params.salesBillNo){
  91. data.salesBillNo = params.salesBillNo
  92. }
  93. if(params.purchaseBillNo){
  94. data.purchaseBillNo = params.purchaseBillNo
  95. }
  96. if(params.settleStyleSn){
  97. data.settleStyleSn = params.settleStyleSn
  98. }
  99. }
  100. this.searchParams = data
  101. this.searchParams.beginDate = data.beginDate ? (data.beginDate + ' 00:00:00') : ''
  102. this.searchParams.endDate = data.endDate ? (data.endDate + ' 23:59:59') : ''
  103. console.log(this.searchParams,'this.searchParams')
  104. this.$nextTick(function(){
  105. _this.$refs.salesList.refash()
  106. })
  107. },
  108. // 状态 change
  109. handleChange(type){
  110. if(type == 'bill'){
  111. this.searchParams.billStatus = this.searchForm.billStatus
  112. }else if(type == 'financial'){
  113. this.searchParams.financialStatus = this.searchForm.financialStatus
  114. }
  115. this.$refs.salesList.refash()
  116. },
  117. // 配送方式
  118. getLookUpItem (type) {
  119. getLookUpItem({ lookupCode: type, pageNo: 1, pageSize: 1000 }).then(res => {
  120. if (res.status == 200 && res.data && res.data.list) {
  121. res.data.list.map(item => {
  122. item.label = item.dispName
  123. item.value = item.code
  124. })
  125. res.data.list.splice(0, 0, { label: '全部', value: null })
  126. if(type == 'SALES_BILL_STATUS'){
  127. this.billStatusOpt = res.data.list
  128. }else if(type == 'FINANCIAL_RECEIVE_STATUS'){
  129. this.financialStatusOpt = res.data.list
  130. }
  131. } else {
  132. if(type == 'SALES_BILL_STATUS'){
  133. this.billStatusOpt = []
  134. }else if(type == 'FINANCIAL_RECEIVE_STATUS'){
  135. this.financialStatusOpt = []
  136. }
  137. }
  138. })
  139. }
  140. }
  141. }
  142. </script>
  143. <style lang="scss">
  144. .sales-list-wrap{
  145. width: 100%;
  146. .search-top-box{
  147. background-color: #fff;
  148. }
  149. .list-box{
  150. padding: 0 25upx;
  151. }
  152. }
  153. </style>