bill.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <template>
  2. <view>
  3. <mescroll-body top="30" bottom="40" @init="mescrollInit" @down="downCallback" @up="upCallback" :option="{}">
  4. <view class="common-list">
  5. <view class="common-item" v-for="(item,index) in list" :key="item.id"
  6. @click="$navigateTo('/pages/billDetail/billDetail?billId='+item.id+'&type='+type)">
  7. <view class="title" v-if="type === 1">{{'第' + item.phase + '期'}}</view>
  8. <view class="title" v-else>{{ item.name}}</view>
  9. <view class="date" v-if="type === 1">{{item.startDate}}至{{item.endDate}}</view>
  10. <view class="date" v-else>{{item.reminderDate}}</view>
  11. <view class="other">
  12. <view class="item">
  13. <view class="label">收款方</view>
  14. <view class="value">{{item.organizationName}}</view>
  15. </view>
  16. <view class="item">
  17. <view class="label">付款方</view>
  18. <view class="value">{{item.payMerchantName || item.payClientName}}</view>
  19. </view>
  20. </view>
  21. <view class="state">
  22. <view></view>
  23. <view class="tag">
  24. <div class="status-tag info" v-if="!item.status">待付款</div>
  25. <div class="status-tag warning" v-else-if="item.status === 1">付款中</div>
  26. <div class="status-tag success" v-else-if="item.status === 2">已付款</div>
  27. </view>
  28. </view>
  29. <view class="icon">
  30. <uni-icons custom-prefix="iconfont" :type="menu.iconClass" color="#08979c" size="30">
  31. </uni-icons>
  32. </view>
  33. </view>
  34. </view>
  35. </mescroll-body>
  36. </view>
  37. </template>
  38. <script>
  39. import {
  40. getPaymentListByPage,
  41. getCommonPaymentListByPage
  42. } from '@/request/api/bill.js'
  43. import {
  44. bindProjectDetail
  45. } from '@/request/api/organization.js'
  46. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  47. export default {
  48. mixins: [MescrollMixin], // 使用mixin
  49. data() {
  50. return {
  51. list: [],
  52. type: '',
  53. menu: {},
  54. payClientId: '',
  55. payMerchantId: ''
  56. }
  57. },
  58. onLoad(body) {
  59. this.type = parseInt(body.type);
  60. this.menu = this.title();
  61. uni.setNavigationBarTitle({
  62. title: this.menu.title
  63. });
  64. uni.$on('reloadContract', () => {
  65. this.mescroll.resetUpScroll(false);
  66. })
  67. },
  68. methods: {
  69. title() {
  70. let str = {
  71. title: '',
  72. iconClass: 'icon-jiesuanguanli'
  73. };
  74. switch (this.type) {
  75. case 1:
  76. str = {
  77. title: '合同账单',
  78. iconClass: 'icon-jiesuanguanli'
  79. };
  80. break;
  81. case 2:
  82. str = {
  83. title: '常规账单',
  84. iconClass: 'icon-yuemingxi'
  85. };
  86. break;
  87. default:
  88. break;
  89. }
  90. return str;
  91. },
  92. /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
  93. upCallback(page) {
  94. let postData = {
  95. currPage: page.num,
  96. pageSize: 10,
  97. projectId: this.$store.getters.project.id
  98. }
  99. if (this.$store.getters.identity.id === 3 || this.$store.getters.identity.id === 6) {
  100. postData['organizationId'] = this.$store.getters.organization.id;
  101. this.getBillList(postData);
  102. } else if (this.$store.getters.identity.id === 4) {
  103. if (this.payMerchantId) {
  104. postData['payMerchantId'] = this.payMerchantId;
  105. this.getBillList(postData);
  106. return;
  107. }
  108. bindProjectDetail({
  109. bindOrganizationId: this.$store.getters.organization.id,
  110. projectId: this.$store.getters.project.id,
  111. identityId: 4
  112. }).then(res => {
  113. if (res.code === 200) {
  114. if (res.data.length == 0) return this.mescroll.endBySize(0, 0);
  115. this.payMerchantId = res.data[0].merchantId;
  116. postData['payMerchantId'] = this.payMerchantId;
  117. this.getBillList(postData);
  118. } else {
  119. this.mescroll.endErr();
  120. }
  121. }).catch(() => {
  122. //联网失败, 结束加载
  123. this.mescroll.endErr();
  124. })
  125. } else if (this.$store.getters.identity.id === 1) {
  126. if (this.payClientId) {
  127. postData['payClientId'] = this.payClientId;
  128. this.getBillList(postData);
  129. return;
  130. }
  131. bindProjectDetail({
  132. userId: this.$store.getters.user.userId,
  133. projectId: this.$store.getters.project.id,
  134. identityId: 1
  135. }).then(res => {
  136. if (res.code === 200) {
  137. if (res.data.length == 0) return this.mescroll.endBySize(0, 0);
  138. this.payClientId = res.data[0].clientId;
  139. postData['payClientId'] = this.payClientId;
  140. this.getBillList(postData);
  141. } else {
  142. this.mescroll.endErr();
  143. }
  144. }).catch(() => {
  145. //联网失败, 结束加载
  146. this.mescroll.endErr();
  147. })
  148. }
  149. },
  150. getBillList(postData) {
  151. if (this.type === 1) {
  152. getPaymentListByPage(postData).then(res => {
  153. if (res.code === 200) {
  154. this.mescroll.endBySize(res.data.dataList.length, res.data.totalCount);
  155. if (postData.currPage == 1) this.list = []; //如果是第一页需手动制空列表
  156. let data = res.data.dataList;
  157. this.list = this.list.concat(data); //追加新数据
  158. } else {
  159. this.mescroll.endErr();
  160. }
  161. }).catch(() => {
  162. //联网失败, 结束加载
  163. this.mescroll.endErr();
  164. })
  165. } else {
  166. getCommonPaymentListByPage(postData).then(res => {
  167. if (res.code === 200) {
  168. this.mescroll.endBySize(res.data.dataList.length, res.data.totalCount);
  169. if (postData.currPage == 1) this.list = []; //如果是第一页需手动制空列表
  170. let data = res.data.dataList;
  171. this.list = this.list.concat(data); //追加新数据
  172. } else {
  173. this.mescroll.endErr();
  174. }
  175. }).catch(() => {
  176. //联网失败, 结束加载
  177. this.mescroll.endErr();
  178. })
  179. }
  180. }
  181. }
  182. }
  183. </script>
  184. <style>
  185. </style>