bill.vue 6.4 KB

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