billDetail.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <template>
  2. <view class="bill-detail" v-if="detail.id">
  3. <view class="detail">
  4. <view class="detail-box">
  5. <view class="title-box">
  6. <view class="title" v-if="type == 1">{{'第' + detail.phase + '期'}}</view>
  7. <view class="title" v-else>{{ detail.name}}</view>
  8. <view class="date" v-if="type == 1">{{detail.startDate}}至{{detail.endDate}}</view>
  9. <view class="date" v-else>{{detail.reminderDate}}</view>
  10. <view class="title-icon">
  11. <uni-icons type="icon-hetongwendang" custom-prefix="iconfont" color="#fff" size="18">
  12. </uni-icons>
  13. </view>
  14. </view>
  15. <view class="other">
  16. <view class="item">
  17. <view class="label">金额</view>
  18. <view class="value">{{detail.amount + '元'}}</view>
  19. </view>
  20. <view class="item">
  21. <view class="label">收款方</view>
  22. <view class="value"> {{detail.organizationName}}</view>
  23. </view>
  24. <view class="item">
  25. <view class="label">付款方</view>
  26. <view class="value">{{detail.payMerchantName || detail.payClientName}}</view>
  27. </view>
  28. </view>
  29. <view class="state">
  30. <view></view>
  31. <view class="tag" v-if="type == 1">
  32. <div class="status-tag info" v-if="!detail.status">待付款</div>
  33. <div class="status-tag warning" v-else-if="detail.status === 1">付款中</div>
  34. <div class="status-tag success" v-else-if="detail.status === 2">已付款</div>
  35. </view>
  36. <view class="tag" v-else>
  37. <div class="status-tag info" v-if="!detail.status">待发送</div>
  38. <div class="status-tag warning" v-else-if="detail.status === 1">付款中</div>
  39. <div class="status-tag success" v-else-if="detail.status === 2">已付款</div>
  40. <div class="status-tag info" v-else-if="detail.status === 3">待付款</div>
  41. </view>
  42. </view>
  43. </view>
  44. <view class="detail-box" v-for="(item,index) in detail.paymentRecordList" :key="item">
  45. <view class="sub-title file-box">
  46. <uni-icons type="map-filled" class="inherit-icons" size="24" color="#08979c"></uni-icons>
  47. <text class="sub-label">付款记录</text>
  48. </view>
  49. <view class="other">
  50. <view class="item">
  51. <view class="label">付款名称</view>
  52. <view class="value">{{item.name}}</view>
  53. </view>
  54. <view class="item">
  55. <view class="label" style="margin-bottom: 10rpx;">回执单</view>
  56. <upload accept="all" :list="item.attachment ? JSON.parse(item.attachment) : []"></upload>
  57. </view>
  58. </view>
  59. </view>
  60. <view class="detail-box" v-for="(item,index) in detail.paymentInvoiceList" :key="item">
  61. <view class="sub-title file-box">
  62. <uni-icons type="map-filled" class="inherit-icons" size="24" color="#08979c"></uni-icons>
  63. <text class="sub-label">发票记录</text>
  64. </view>
  65. <view class="other">
  66. <view class="item">
  67. <view class="label">发票名称</view>
  68. <view class="value">{{item.name}}</view>
  69. </view>
  70. <view class="item">
  71. <view class="label">发票类型</view>
  72. <view class="value">{{$field.findTypeName('invoiceType',item.type)}}</view>
  73. </view>
  74. <view class="item">
  75. <view class="label">发票代码</view>
  76. <view class="value">{{item.code || '-'}}</view>
  77. </view>
  78. <view class="item">
  79. <view class="label">发票号码</view>
  80. <view class="value">{{item.number || '-'}}</view>
  81. </view>
  82. <view class="item">
  83. <view class="label">货物名称</view>
  84. <view class="value">{{item.cargoName || '-'}}</view>
  85. </view>
  86. <view class="item">
  87. <view class="label" style="margin-bottom: 10rpx;">发票附件</view>
  88. <upload accept="all" :list="item.attachment ? JSON.parse(item.attachment) : []"></upload>
  89. </view>
  90. </view>
  91. </view>
  92. </view>
  93. <view class="hui-button-box" v-if="operationBtn.length>0">
  94. <view class="hui-button" v-for="(item,index) in operationBtn" :key="index" @click="operation(item)">
  95. {{item.name}}
  96. </view>
  97. </view>
  98. </view>
  99. </template>
  100. <script>
  101. import {
  102. getPaymentDetailById,
  103. getCommonPaymentDetailById,
  104. updatePayment
  105. } from '@/request/api/bill.js'
  106. import upload from '@/components/common/upload.vue'
  107. export default {
  108. data() {
  109. return {
  110. billId: '',
  111. type: '',
  112. detail: {},
  113. operationBtn: []
  114. }
  115. },
  116. onLoad(body) {
  117. this.billId = body.billId;
  118. this.type = body.type;
  119. this.init();
  120. uni.$on('reloadBill', () => {
  121. this.init();
  122. })
  123. },
  124. methods: {
  125. init() {
  126. if (!this.billId) return;
  127. this.operationBtn = [];
  128. if (this.type == 1) {
  129. getPaymentDetailById(this.billId).then(this.billSuccess);
  130. } else {
  131. getCommonPaymentDetailById(this.billId).then(this.billSuccess);
  132. }
  133. },
  134. operation(item) {
  135. if (item.id == 3) {
  136. uni.showModal({
  137. title: '有极提示',
  138. content: '是否将账单发送给客户?',
  139. success: res => {
  140. if (res.confirm) {
  141. updatePayment({
  142. id: this.billId,
  143. status: 3
  144. }).then(res => {
  145. if (res.code === 200) {
  146. this.init();
  147. this.$toast('操作成功');
  148. }
  149. })
  150. }
  151. }
  152. });
  153. } else {
  154. this.$navigateTo(item.type + '?billId=' + this.billId + '&type=' + this.type);
  155. }
  156. },
  157. billSuccess(res) {
  158. if (res.code === 200) {
  159. this.detail = res.data;
  160. if ((!this.detail.status || this.detail.status == 3) && (this.$store.getters.identity.id === 1 || this
  161. .$store.getters.identity.id === 4)) {
  162. this.operationBtn.push({
  163. id: 1,
  164. name: '账单付款',
  165. type: '/pages/billRecord/billRecord'
  166. })
  167. }
  168. if (this.detail.status === 1 && this.detail.organizationId === this.$store.getters.organization.id) {
  169. this.operationBtn.push({
  170. id: 2,
  171. name: '账单发票',
  172. type: '/pages/billInvoice/billInvoice'
  173. })
  174. }
  175. if (this.type == 2 && !this.detail.status && this.detail.organizationId === this.$store.getters
  176. .organization.id) {
  177. this.operationBtn.push({
  178. id: 3,
  179. name: '发送账单给客户',
  180. type: '/pages/billInvoice/billInvoice'
  181. })
  182. }
  183. }
  184. }
  185. },
  186. components: {
  187. upload
  188. }
  189. }
  190. </script>
  191. <style>
  192. </style>