123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203 |
- <template>
- <view class="sales-list-component">
- <view v-if="listData && listData.length>0">
- <scroll-view class="sales-list-con" :style="{ height: scrollH + 'px' }" scroll-y @scrolltolower="onreachBottom">
- <view class="customer-list" v-for="(item,i) in listData" :key="i">
- <view class="u-line-1">{{item.customer.customerName}}</view>
- <view class="customer-b u-flex">
- <view class="customer-box">
- <text>欠款:</text>
- <text>¥{{item.settleAmount || 0}}</text>
- </view>
- <view class="customer-box">收款方式:{{item.customer.settleStyleSnDictValue}}</view>
- </view>
- </view>
- </scroll-view>
- </view>
- <view v-else>
- <u-empty :src="`/static/${$config('themePath')}/def_no_data@3x.png`" icon-size="150" :text="noDataText" mode="list" :margin-top="50"></u-empty>
- </view>
- <view style="padding-bottom: 20upx;" ><u-loadmore v-if="totalNum > listData.length || status == 'loading'" :status="status" /></view>
- </view>
- </template>
- <script>
- import { queryCustomerPage } from '@/api/verify.js';
- export default {
- props: {
- height: {
- // 滚动区域高度 upx
- type: [String, Number],
- default: 300
- },
- params: {
- // 列表查询条件
- type: Object,
- default: () => {
- return {};
- }
- }
- },
- data() {
- return {
- listData: [],
- pageNo: 1,
- pageSize: 10,
- totalNum: 0,
- status: 'loadmore',
- noDataText: '暂无数据',
-
- auditModal: false, // 审核弹框
- dataInfo: null,
- outModal: false, // 出库弹框
- delModal: false, // 删除/取消弹框
- delText: '确认要删除吗?',
- scrollH: 300
- };
- },
- watch: {
- height(a, b) {
- console.log(a, b);
- const sys = uni.getSystemInfoSync();
- console.log(sys);
- if (sys.platform == 'android') {
- this.scrollH = sys.windowHeight - a;
- } else {
- if (sys.safeArea.top) {
- this.scrollH = sys.windowHeight - a + sys.statusBarHeight - 34;
- } else {
- this.scrollH = sys.windowHeight - a - 14;
- }
- }
- }
- },
- methods: {
- refash() {
- this.listData = [];
- this.totalNum = 0;
- this.getList(1);
- },
- // 列表
- getList(pageNo) {
- const _this = this;
- if (pageNo) {
- this.pageNo = pageNo;
- }
- let params = Object.assign(this.params, { pageNo: this.pageNo, pageSize: this.pageSize });
- this.status = 'loading';
- queryCustomerPage(params).then(res => {
- if (res.status == 200) {
- if (this.pageNo > 1) {
- this.listData = this.listData.concat(res.data.list || []);
- } else {
- this.listData = res.data.list || [];
- }
- this.totalNum = res.data.count || 0;
- } else {
- this.listData = [];
- this.totalNum = 0;
- this.noDataText = res.message;
- }
- this.status = 'loadmore';
- });
- },
- // scroll-view到底部加载更多
- onreachBottom() {
- if (this.listData.length < this.totalNum) {
- this.pageNo += 1;
- this.getList();
- }
- },
- // 查看详情
- getDetail(data) {
- uni.navigateTo({ url: '/pages/sales/edit?pageType=detail&data=' + JSON.stringify(data) });
- },
- // 编辑
- handleEdit(data) {
- uni.navigateTo({ url: '/pages/sales/edit?pageType=edit&data=' + JSON.stringify(data) });
- },
- // 操作
- handleFun(type, data) {
- this.dataInfo = data;
- if (type == 'audit') {
- // 审核
- this.auditModal = true;
- } else if (type == 'out') {
- // 出库
- this.outModal = true;
- } else if (type == 'del') {
- // 删除
- this.delText = '确认要删除吗?';
- this.delModal = true;
- } else if (type == 'cancel') {
- // 取消
- this.delText = '确认要取消吗?';
- this.delModal = true;
- }
- },
- // 审核通过或不通过
- handleAudit(billStatus) {
- salesWriteAudit({
- id: this.dataInfo.id,
- billStatus: billStatus
- }).then(res => {
- if (res.status == 200) {
- this.toashMsg(res.message);
- this.getList(1);
- this.auditModal = false;
- } else {
- this.auditModal = false;
- }
- });
- },
- // 出库
- handleOut() {
- salesWriteStockOut({ salesBillSn: this.dataInfo.salesBillSn }).then(res => {
- if (res.status == 200) {
- this.toashMsg(res.message);
- this.getList(1);
- this.outModal = false;
- } else {
- this.outModal = false;
- }
- });
- },
- // 删除
- handleDel() {
- salesDel({ id: this.dataInfo.id }).then(res => {
- if (res.status == 200) {
- this.toashMsg(res.message);
- this.getList(1);
- this.delModal = false;
- } else {
- this.delModal = false;
- }
- });
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .sales-list-component {
- .sales-list-con {
- .customer-list {
- padding: 20rpx;
- border-bottom: 1rpx solid #f8f8f8;
- }
- .customer-b {
- margin-top: 10rpx;
- color: #666;
- font-size: 26rpx;
- .customer-box {
- width: 46%;
- text {
- &:last-child {
- color: $uni-color-warning;
- }
- }
- }
- }
- }
- }
- </style>
|