bill.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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. }
  63. },
  64. onLoad(body) {
  65. this.type = parseInt(body.type);
  66. this.menu = this.title();
  67. uni.setNavigationBarTitle({
  68. title: this.menu.title
  69. });
  70. uni.$on('reloadBill', () => {
  71. this.mescroll.resetUpScroll(false);
  72. })
  73. },
  74. methods: {
  75. title() {
  76. let str = {
  77. title: '',
  78. iconClass: 'icon-jiesuanguanli'
  79. };
  80. switch (this.type) {
  81. case 1:
  82. str = {
  83. title: '合同账单',
  84. iconClass: 'icon-jiesuanguanli'
  85. };
  86. break;
  87. case 2:
  88. str = {
  89. title: '常规账单',
  90. iconClass: 'icon-yuemingxi'
  91. };
  92. break;
  93. default:
  94. break;
  95. }
  96. return str;
  97. },
  98. /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
  99. upCallback(page) {
  100. let postData = {
  101. currPage: page.num,
  102. pageSize: 10,
  103. projectId: this.$store.getters.project.id
  104. }
  105. if (this.$store.getters.identity.id === 3 || this.$store.getters.identity.id === 6) {
  106. postData['organizationId'] = this.$store.getters.organization.id;
  107. this.getBillList(postData);
  108. } else if (this.$store.getters.identity.id === 4) {
  109. if (this.payMerchantId) {
  110. postData['payMerchantId'] = this.payMerchantId;
  111. this.getBillList(postData);
  112. return;
  113. }
  114. bindProjectDetail({
  115. bindOrganizationId: this.$store.getters.organization.id,
  116. projectId: this.$store.getters.project.id,
  117. identityId: 4
  118. }).then(res => {
  119. if (res.code === 200) {
  120. if (res.data.length == 0) return this.mescroll.endBySize(0, 0);
  121. this.payMerchantId = res.data[0].merchantId;
  122. postData['payMerchantId'] = this.payMerchantId;
  123. this.getBillList(postData);
  124. } else {
  125. this.mescroll.endErr();
  126. }
  127. }).catch(() => {
  128. //联网失败, 结束加载
  129. this.mescroll.endErr();
  130. })
  131. } else if (this.$store.getters.identity.id === 1) {
  132. if (this.payClientId) {
  133. postData['payClientId'] = this.payClientId;
  134. this.getBillList(postData);
  135. return;
  136. }
  137. bindProjectDetail({
  138. userId: this.$store.getters.user.userId,
  139. projectId: this.$store.getters.project.id,
  140. identityId: 1
  141. }).then(res => {
  142. if (res.code === 200) {
  143. if (res.data.length == 0) return this.mescroll.endBySize(0, 0);
  144. this.payClientId = res.data[0].clientId;
  145. postData['payClientId'] = this.payClientId;
  146. this.getBillList(postData);
  147. } else {
  148. this.mescroll.endErr();
  149. }
  150. }).catch(() => {
  151. //联网失败, 结束加载
  152. this.mescroll.endErr();
  153. })
  154. }
  155. },
  156. getBillList(postData) {
  157. if (this.type === 1) {
  158. getPaymentListByPage(postData).then(res => {
  159. if (res.code === 200) {
  160. this.mescroll.endBySize(res.data.dataList.length, res.data.totalCount);
  161. if (postData.currPage == 1) this.list = []; //如果是第一页需手动制空列表
  162. let data = res.data.dataList;
  163. this.list = this.list.concat(data); //追加新数据
  164. } else {
  165. this.mescroll.endErr();
  166. }
  167. }).catch(() => {
  168. //联网失败, 结束加载
  169. this.mescroll.endErr();
  170. })
  171. } else {
  172. if (this.$store.getters.identity.id === 1 || this.$store.getters.identity.id === 4) {
  173. postData['statusList'] = [1, 2, 3];
  174. }
  175. getCommonPaymentListByPage(postData).then(res => {
  176. if (res.code === 200) {
  177. this.mescroll.endBySize(res.data.dataList.length, res.data.totalCount);
  178. if (postData.currPage == 1) this.list = []; //如果是第一页需手动制空列表
  179. let data = res.data.dataList;
  180. this.list = this.list.concat(data); //追加新数据
  181. } else {
  182. this.mescroll.endErr();
  183. }
  184. }).catch(() => {
  185. //联网失败, 结束加载
  186. this.mescroll.endErr();
  187. })
  188. }
  189. }
  190. }
  191. }
  192. </script>
  193. <style>
  194. </style>