aboutContract.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. <template>
  2. <view class="section about-contract">
  3. <view class="section-title">
  4. <image :src="$static('images/crm_about/contract.png')" class="icon" />
  5. <text class="title">
  6. 合同
  7. </text>
  8. <view
  9. v-if="!config.isSeas"
  10. class="add-btn"
  11. @click="handleAdd">
  12. <text class="wk wk-plus icon-add" />
  13. <text>新建</text>
  14. </view>
  15. </view>
  16. <view class="section-body">
  17. <template v-if="list.length > 0">
  18. <view class="list">
  19. <view
  20. v-for="(item, index) in list"
  21. :key="index"
  22. class="list-item" @click="handleTo(item.contractId)">
  23. <view class="list-item-info">
  24. <view class="box">
  25. <text class="name">
  26. {{ item.contractName }}
  27. </text>
  28. </view>
  29. <view class="box">
  30. <text class="text">
  31. 已回款 {{ item.receivedMoney ? splitNumber(item.receivedMoney) : 0 }}
  32. </text>
  33. <text class="text">
  34. 待回款 {{ item.unreceivedMoney ? splitNumber(item.unreceivedMoney) : 0 }}
  35. </text>
  36. </view>
  37. <view class="box">
  38. <view class="progress-box">
  39. <text>回款进度</text>
  40. <view class="progress">
  41. <view :style="{width: (item.receivedProgress || 0) + '%'}" class="now" />
  42. </view>
  43. <text class="progress-text">
  44. {{ item.receivedProgress || 0 }}%
  45. </text>
  46. </view>
  47. <view class="money">
  48. ¥{{ item.unreceivedMoney ? splitNumber(item.unreceivedMoney) : splitNumber(item.money) }}
  49. </view>
  50. </view>
  51. <view class="box">
  52. <text
  53. :style="{
  54. color: statusObj(item).color,
  55. }"
  56. class="text">
  57. {{ statusObj(item).label }}
  58. </text>
  59. </view>
  60. </view>
  61. </view>
  62. </view>
  63. </template>
  64. <template v-else>
  65. <view class="no-data">
  66. 暂无数据
  67. </view>
  68. </template>
  69. </view>
  70. </view>
  71. </template>
  72. <script>
  73. import { splitNumber } from '@/utils/lib.js'
  74. import { mapGetters } from 'vuex'
  75. export default {
  76. name: 'AboutContract',
  77. props: {
  78. list: {
  79. type: Array,
  80. required: true
  81. },
  82. config: {
  83. type: Object,
  84. default: () => {}
  85. }
  86. },
  87. data() {
  88. return {}
  89. },
  90. computed: {
  91. ...mapGetters({
  92. calcStatus: 'base/calcStatus'
  93. })
  94. },
  95. methods: {
  96. splitNumber(num) {
  97. return splitNumber(num)
  98. },
  99. statusObj(item) {
  100. return this.calcStatus(item.checkStatus)
  101. },
  102. // calcRate(num1, num2) {
  103. // let res = Number(num1) / Number(num2) * 100
  104. // return (res.toFixed(2) + '%') || '0.00%'
  105. // },
  106. handleAdd() {
  107. const checkRes = this.$auth('crm.contract.save')
  108. if (!checkRes) {
  109. this.$toast('权限不足!')
  110. return
  111. }
  112. if (!this.config.detail) return
  113. const crmType = this.config.type
  114. if (crmType === 'business') {
  115. getApp().globalData.formBridge = {
  116. default: {
  117. businessId: [{
  118. businessId: this.config.detail.businessId,
  119. businessName: this.config.detail.businessName
  120. }],
  121. customerId: [{
  122. customerId: this.config.detail.customerId,
  123. customerName: this.config.detail.customerName
  124. }],
  125. money: this.config.detail.totalPrice
  126. },
  127. assignForm: {
  128. businessId: this.config.detail.businessId
  129. }
  130. }
  131. } if (crmType === 'customer') {
  132. getApp().globalData.formBridge = {
  133. default: {
  134. customerId: [{
  135. customerId: this.config.detail.customerId,
  136. customerName: this.config.detail.customerName
  137. }]
  138. }
  139. }
  140. }
  141. this.$Router.navigateTo({
  142. url: '/pages_crm/contract/create',
  143. query: {
  144. type: 'contract'
  145. }
  146. })
  147. },
  148. handleTo(id) {
  149. const checkRes = this.$auth('crm.contract.read')
  150. if (!checkRes) {
  151. this.$toast('权限不足!')
  152. return
  153. }
  154. this.$Router.navigateTo({
  155. url: '/pages_crm/contract/detail',
  156. query: {
  157. id: id
  158. }
  159. })
  160. },
  161. }
  162. }
  163. </script>
  164. <style scoped lang="scss">
  165. @import './style.scss';
  166. .list {
  167. padding: 0 32rpx;
  168. &-item {
  169. border-bottom: 1rpx solid $border-color;
  170. @include left;
  171. &:last-child {
  172. border-bottom: 0 none;
  173. }
  174. &-info {
  175. flex: 1;
  176. @include padding;
  177. .box {
  178. @include left;
  179. .name {
  180. font-size: $wk-font-medium;
  181. font-weight: 500;
  182. color: $dark;
  183. line-height: 1.5;
  184. }
  185. .text {
  186. font-size: $wk-font-sm;
  187. color: $gray;
  188. margin-right: 15rpx;
  189. }
  190. .status {
  191. font-size: $wk-font-mini;
  192. color: $gray;
  193. }
  194. .progress-box {
  195. flex: 1;
  196. font-size: $wk-font-sm;
  197. color: $gray;
  198. @include left;
  199. .progress-text {
  200. margin: 0 10rpx;
  201. }
  202. .progress {
  203. width: 160rpx;
  204. height: 12rpx;
  205. border-radius: 6rpx;
  206. background-color: #e1e1e1;
  207. margin-left: 10rpx;
  208. overflow: hidden;
  209. .now {
  210. height: 12rpx;
  211. background-color: $theme-color;
  212. }
  213. }
  214. }
  215. .money {
  216. font-size: $wk-font-base;
  217. font-weight: bold;
  218. color: $warning;
  219. }
  220. }
  221. }
  222. }
  223. .list-item:last-child {
  224. .list-item-info {
  225. border-bottom: 0 none;
  226. }
  227. }
  228. }
  229. </style>