customerList.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <template>
  2. <view class="sales-list-component">
  3. <view v-if="listData && listData.length>0">
  4. <scroll-view class="sales-list-con" :style="{ height: scrollH + 'px' }" scroll-y @scrolltolower="onreachBottom">
  5. <view class="customer-list" v-for="(item,i) in listData" :key="i">
  6. <view class="u-line-1">{{item.customer.customerName}}</view>
  7. <view class="customer-b u-flex">
  8. <view class="customer-box">
  9. <text>欠款:</text>
  10. <text>¥{{item.settleAmount || 0}}</text>
  11. </view>
  12. <view class="customer-box">收款方式:{{item.customer.settleStyleSnDictValue}}</view>
  13. </view>
  14. </view>
  15. </scroll-view>
  16. </view>
  17. <view v-else>
  18. <u-empty :src="`/static/${$config('themePath')}/def_no_data@3x.png`" icon-size="150" :text="noDataText" mode="list" :margin-top="50"></u-empty>
  19. </view>
  20. <view style="padding-bottom: 20upx;" ><u-loadmore v-if="totalNum > listData.length || status == 'loading'" :status="status" /></view>
  21. </view>
  22. </template>
  23. <script>
  24. import { queryCustomerPage } from '@/api/verify.js';
  25. export default {
  26. props: {
  27. height: {
  28. // 滚动区域高度 upx
  29. type: [String, Number],
  30. default: 300
  31. },
  32. params: {
  33. // 列表查询条件
  34. type: Object,
  35. default: () => {
  36. return {};
  37. }
  38. }
  39. },
  40. data() {
  41. return {
  42. listData: [],
  43. pageNo: 1,
  44. pageSize: 10,
  45. totalNum: 0,
  46. status: 'loadmore',
  47. noDataText: '暂无数据',
  48. auditModal: false, // 审核弹框
  49. dataInfo: null,
  50. outModal: false, // 出库弹框
  51. delModal: false, // 删除/取消弹框
  52. delText: '确认要删除吗?',
  53. scrollH: 300
  54. };
  55. },
  56. watch: {
  57. height(a, b) {
  58. console.log(a, b);
  59. const sys = uni.getSystemInfoSync();
  60. console.log(sys);
  61. if (sys.platform == 'android') {
  62. this.scrollH = sys.windowHeight - a;
  63. } else {
  64. if (sys.safeArea.top) {
  65. this.scrollH = sys.windowHeight - a + sys.statusBarHeight - 34;
  66. } else {
  67. this.scrollH = sys.windowHeight - a - 14;
  68. }
  69. }
  70. }
  71. },
  72. methods: {
  73. refash() {
  74. this.listData = [];
  75. this.totalNum = 0;
  76. this.getList(1);
  77. },
  78. // 列表
  79. getList(pageNo) {
  80. const _this = this;
  81. if (pageNo) {
  82. this.pageNo = pageNo;
  83. }
  84. let params = Object.assign(this.params, { pageNo: this.pageNo, pageSize: this.pageSize });
  85. this.status = 'loading';
  86. queryCustomerPage(params).then(res => {
  87. if (res.status == 200) {
  88. if (this.pageNo > 1) {
  89. this.listData = this.listData.concat(res.data.list || []);
  90. } else {
  91. this.listData = res.data.list || [];
  92. }
  93. this.totalNum = res.data.count || 0;
  94. } else {
  95. this.listData = [];
  96. this.totalNum = 0;
  97. this.noDataText = res.message;
  98. }
  99. this.status = 'loadmore';
  100. });
  101. },
  102. // scroll-view到底部加载更多
  103. onreachBottom() {
  104. if (this.listData.length < this.totalNum) {
  105. this.pageNo += 1;
  106. this.getList();
  107. }
  108. },
  109. // 查看详情
  110. getDetail(data) {
  111. uni.navigateTo({ url: '/pages/sales/edit?pageType=detail&data=' + JSON.stringify(data) });
  112. },
  113. // 编辑
  114. handleEdit(data) {
  115. uni.navigateTo({ url: '/pages/sales/edit?pageType=edit&data=' + JSON.stringify(data) });
  116. },
  117. // 操作
  118. handleFun(type, data) {
  119. this.dataInfo = data;
  120. if (type == 'audit') {
  121. // 审核
  122. this.auditModal = true;
  123. } else if (type == 'out') {
  124. // 出库
  125. this.outModal = true;
  126. } else if (type == 'del') {
  127. // 删除
  128. this.delText = '确认要删除吗?';
  129. this.delModal = true;
  130. } else if (type == 'cancel') {
  131. // 取消
  132. this.delText = '确认要取消吗?';
  133. this.delModal = true;
  134. }
  135. },
  136. // 审核通过或不通过
  137. handleAudit(billStatus) {
  138. salesWriteAudit({
  139. id: this.dataInfo.id,
  140. billStatus: billStatus
  141. }).then(res => {
  142. if (res.status == 200) {
  143. this.toashMsg(res.message);
  144. this.getList(1);
  145. this.auditModal = false;
  146. } else {
  147. this.auditModal = false;
  148. }
  149. });
  150. },
  151. // 出库
  152. handleOut() {
  153. salesWriteStockOut({ salesBillSn: this.dataInfo.salesBillSn }).then(res => {
  154. if (res.status == 200) {
  155. this.toashMsg(res.message);
  156. this.getList(1);
  157. this.outModal = false;
  158. } else {
  159. this.outModal = false;
  160. }
  161. });
  162. },
  163. // 删除
  164. handleDel() {
  165. salesDel({ id: this.dataInfo.id }).then(res => {
  166. if (res.status == 200) {
  167. this.toashMsg(res.message);
  168. this.getList(1);
  169. this.delModal = false;
  170. } else {
  171. this.delModal = false;
  172. }
  173. });
  174. }
  175. }
  176. };
  177. </script>
  178. <style lang="scss" scoped>
  179. .sales-list-component {
  180. .sales-list-con {
  181. .customer-list {
  182. padding: 20rpx;
  183. border-bottom: 1rpx solid #f8f8f8;
  184. }
  185. .customer-b {
  186. margin-top: 10rpx;
  187. color: #666;
  188. font-size: 26rpx;
  189. .customer-box {
  190. width: 46%;
  191. text {
  192. &:last-child {
  193. color: $uni-color-warning;
  194. }
  195. }
  196. }
  197. }
  198. }
  199. }
  200. </style>