messageDetail.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <template>
  2. <view class="message-detail-index">
  3. <view class="message-detail-content">
  4. <text v-if="detail.id">{{detail.sendUserName}}{{detail.message}}</text>
  5. </view>
  6. <view class="message-btn-box" v-if="dataDetail.status === 1">
  7. <view class="message-btn red" @click="btnClick('拒绝',3)">拒绝</view>
  8. <view class="line"></view>
  9. <view class="message-btn primary" @click="btnClick('同意',2)">同意</view>
  10. </view>
  11. </view>
  12. </template>
  13. <script>
  14. import {
  15. getMessageDetailById,
  16. bindProject,
  17. getCustomerDetailById,
  18. updateCustomer
  19. } from '@/request/api/message.js'
  20. export default {
  21. data() {
  22. return {
  23. messageId: '',
  24. detail: {},
  25. dataDetail: {}
  26. }
  27. },
  28. onLoad(body) {
  29. this.messageId = body.id;
  30. this.init();
  31. },
  32. methods: {
  33. init() {
  34. getMessageDetailById(this.messageId).then(res => {
  35. if (res.code == 200) {
  36. this.detail = res.data;
  37. this.detail = Object.assign(this.detail, JSON.parse(this.detail.json));
  38. this.initDetail();
  39. }
  40. })
  41. },
  42. initDetail() {
  43. getCustomerDetailById(this.detail.dataId).then(res => {
  44. if (res.code == 200) {
  45. this.dataDetail = res.data;
  46. }
  47. })
  48. },
  49. btnClick(msg, type) {
  50. uni.showModal({
  51. title: '有极提示',
  52. content: '是否' + msg + '加入该项目',
  53. success: (res) => {
  54. if (res.confirm) {
  55. updateCustomer({
  56. id: this.dataDetail.id,
  57. status: type
  58. }).then(res => {
  59. if (res.code == 200) {
  60. if (type === 2) return this.operationProject();
  61. this.initDetail();
  62. this.$toast('操作成功');
  63. }
  64. })
  65. }
  66. }
  67. });
  68. },
  69. operationProject() {
  70. bindProject({
  71. organizationId: this.detail.organizationId,
  72. projectId: this.detail.projectId,
  73. clientId: this.detail.dataId,
  74. userId: this.$store.getters.user.userId,
  75. identityId: this.detail.identityId
  76. }).then(res => {
  77. if (res.code === 200) {
  78. this.$toast('操作成功');
  79. this.initDetail();
  80. }
  81. })
  82. }
  83. }
  84. }
  85. </script>
  86. <style lang="scss">
  87. .message-detail-index {
  88. background: $uni-white;
  89. padding: 20rpx;
  90. padding-bottom: 0;
  91. margin: 20rpx 30rpx;
  92. border-radius: 10rpx;
  93. .message-detail-content {
  94. min-height: 200rpx;
  95. padding-bottom: 40rpx;
  96. }
  97. .message-btn-box {
  98. width: 100%;
  99. display: flex;
  100. height: 80rpx;
  101. align-items: center;
  102. border-top: 1px solid $uni-border-3;
  103. .line {
  104. width: 1px;
  105. height: 40rpx;
  106. background: $uni-border-3;
  107. }
  108. .message-btn {
  109. text-align: center;
  110. flex: 1;
  111. }
  112. .red {
  113. color: $uni-error;
  114. }
  115. .primary {
  116. color: $uni-primary;
  117. }
  118. }
  119. }
  120. </style>