contractItem.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <template>
  2. <button class="contract-item" @click="handleDetail">
  3. <view class="cell">
  4. <text class="cell-left name">
  5. {{ itemData.name || '' }}
  6. </text>
  7. <view
  8. :style="{
  9. color: statusObj.color,
  10. backgroundColor: statusObj.bg,
  11. }"
  12. class="cell-right status">
  13. {{ statusObj.label }}
  14. </view>
  15. </view>
  16. <template v-if="hasMoney">
  17. <view class="cell">
  18. <text class="cell-left text-info">
  19. {{ itemData.customerName || '' }}
  20. </text>
  21. </view>
  22. <view class="cell">
  23. <view class="cell-left">
  24. <view
  25. class="text-info progress-box">
  26. <text>回款进度{{ itemData.statusName || '' }}</text>
  27. <text class="progress-text">
  28. ({{ itemData.receivedProgress }}%)
  29. </text>
  30. <view class="progress">
  31. <view :style="{width: dataRate}" class="now" />
  32. </view>
  33. </view>
  34. </view>
  35. <view class="cell-right money">
  36. ¥{{ splitNumber(itemData.money) }}
  37. </view>
  38. </view>
  39. <view class="cell">
  40. <view class="cell-left text-info">
  41. <text>已回款:¥{{ splitNumber(itemData.receivedMoney) }}</text>
  42. <text class="duration">
  43. /
  44. </text>
  45. <text>待回款:¥{{ splitNumber(itemData.unreceivedMoney) }}</text>
  46. <text class="duration">
  47. /
  48. </text>
  49. <text>签约时间:{{ itemData.orderDate | formatTime }}</text>
  50. </view>
  51. </view>
  52. </template>
  53. <template v-else>
  54. <view class="cell">
  55. <view class="cell-left text-info">
  56. <text>创建时间:{{ itemData.createTime | formatTime }}</text>
  57. </view>
  58. </view>
  59. </template>
  60. </button>
  61. </template>
  62. <script>
  63. import { splitNumber } from '@/utils/lib.js'
  64. import { mapGetters } from 'vuex'
  65. import moment from 'moment'
  66. export default {
  67. name: 'ContractItem',
  68. filters: {
  69. formatTime(val) {
  70. if (!val) return '--'
  71. return moment(val).format('YYYY-MM-DD')
  72. }
  73. },
  74. props: {
  75. itemData: {
  76. type: Object,
  77. required: true
  78. }
  79. },
  80. data() {
  81. return {
  82. auth: 'crm.contract.read'
  83. }
  84. },
  85. computed: {
  86. ...mapGetters({
  87. calcStatus: 'base/calcStatus'
  88. }),
  89. statusObj() {
  90. return this.calcStatus(this.itemData.checkStatus) || {}
  91. },
  92. dataRate() {
  93. return this.itemData.receivedProgress + '%'
  94. },
  95. hasMoney() {
  96. return this.itemData.hasOwnProperty('money')
  97. }
  98. },
  99. methods: {
  100. splitNumber(num) {
  101. return splitNumber(num)
  102. },
  103. /**
  104. * 合同详情跳转
  105. */
  106. handleDetail() {
  107. if (!this.$auth(this.auth)) {
  108. this.$toast('权限不足')
  109. return
  110. }
  111. this.$Router.navigateTo({
  112. url: '/pages_crm/contract/detail',
  113. query: {
  114. id: this.itemData.contractId
  115. }
  116. })
  117. }
  118. }
  119. }
  120. </script>
  121. <style scoped lang="scss">
  122. @import "../../style/listItem";
  123. .contract-item {
  124. border-bottom: 1rpx solid $border-color;
  125. background-color: white;
  126. padding: 20rpx 32rpx;
  127. .cell {
  128. .name {
  129. font-size: 32rpx;
  130. color: #212121;
  131. @include ellipsis;
  132. }
  133. .status {
  134. width: 116rpx;
  135. height: 46rpx;
  136. font-size: 24rpx;
  137. border-radius: 4rpx;
  138. @include center;
  139. }
  140. .text-info {
  141. font-size: 26rpx;
  142. color: $gray;
  143. }
  144. .money {
  145. color: #FF7300;
  146. font-size: 28rpx;
  147. font-weight: bold;
  148. }
  149. .progress-box {
  150. @include left;
  151. .progress-text {
  152. margin-left: 10rpx;
  153. }
  154. .progress {
  155. width: 160rpx;
  156. height: 12rpx;
  157. border-radius: 6rpx;
  158. background-color: #e1e1e1;
  159. margin-left: 10rpx;
  160. overflow: hidden;
  161. .now {
  162. height: 12rpx;
  163. background-color: $theme-color;
  164. }
  165. }
  166. }
  167. .duration {
  168. margin: 0 10rpx;
  169. }
  170. }
  171. }
  172. </style>