bill.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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 warning" v-if="item.status === 1">付款中</div>
  30. <div class="status-tag success" v-else-if="item.status === 2">已付款</div>
  31. <div class="status-tag info" v-else-if="item.status === 3">待付款</div>
  32. </view>
  33. </view>
  34. <view class="icon">
  35. <uni-icons custom-prefix="iconfont" :type="menu.iconClass" color="#08979c" size="30">
  36. </uni-icons>
  37. </view>
  38. </view>
  39. </view>
  40. </mescroll-body>
  41. </view>
  42. </template>
  43. <script>
  44. import {
  45. getPaymentListByPage,
  46. getCommonPaymentListByPage
  47. } from '@/request/api/bill.js'
  48. import {
  49. bindProjectDetail
  50. } from '@/request/api/organization.js'
  51. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  52. export default {
  53. mixins: [MescrollMixin], // 使用mixin
  54. data() {
  55. return {
  56. list: [],
  57. type: '',
  58. menu: {},
  59. payClientId: '',
  60. payMerchantId: ''
  61. }
  62. },
  63. onLoad(body) {
  64. this.type = parseInt(body.type);
  65. this.menu = this.title();
  66. uni.setNavigationBarTitle({
  67. title: this.menu.title
  68. });
  69. uni.$on('reloadBill', () => {
  70. this.mescroll.resetUpScroll(false);
  71. })
  72. },
  73. methods: {
  74. title() {
  75. let str = {
  76. title: '',
  77. iconClass: 'icon-jiesuanguanli'
  78. };
  79. switch (this.type) {
  80. case 1:
  81. str = {
  82. title: '合同账单',
  83. iconClass: 'icon-jiesuanguanli'
  84. };
  85. break;
  86. case 2:
  87. str = {
  88. title: '常规账单',
  89. iconClass: 'icon-yuemingxi'
  90. };
  91. break;
  92. default:
  93. break;
  94. }
  95. return str;
  96. },
  97. /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
  98. upCallback(page) {
  99. let postData = {
  100. currPage: page.num,
  101. pageSize: 10,
  102. projectId: this.$store.getters.project.id
  103. }
  104. console.log(this.$store.getters.identity);
  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. getCommonPaymentListByPage(postData).then(res => {
  173. if (res.code === 200) {
  174. this.mescroll.endBySize(res.data.dataList.length, res.data.totalCount);
  175. if (postData.currPage == 1) this.list = []; //如果是第一页需手动制空列表
  176. let data = res.data.dataList;
  177. this.list = this.list.concat(data); //追加新数据
  178. } else {
  179. this.mescroll.endErr();
  180. }
  181. }).catch(() => {
  182. //联网失败, 结束加载
  183. this.mescroll.endErr();
  184. })
  185. }
  186. }
  187. }
  188. }
  189. </script>
  190. <style>
  191. </style>