鸿宇研学生前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
2.0 KiB

  1. <template>
  2. <view class="card">
  3. <view class="title">绑定申请</view>
  4. <view class="row">
  5. <view class="row-label">绑定人</view>
  6. <view class="row-content">{{ data.name }}</view>
  7. </view>
  8. <view class="row">
  9. <view class="row-label">申请人ID</view>
  10. <view class="row-content">{{ data.bindId }}</view>
  11. </view>
  12. <view class="row">
  13. <view class="row-label">申请时间</view>
  14. <view class="row-content">{{ data.createTime }}</view>
  15. </view>
  16. <view class="flex btns">
  17. <button class="btn" @click="onReject">拒绝</button>
  18. <button class="btn" @click="onConfirm">同意</button>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. export default {
  24. props: {
  25. data: {
  26. type: Object,
  27. default() {
  28. return {}
  29. }
  30. },
  31. value: {
  32. type: String,
  33. default: null,
  34. },
  35. showRadio: {
  36. type: Boolean,
  37. default: false
  38. },
  39. },
  40. data() {
  41. return {
  42. }
  43. },
  44. methods: {
  45. async fetchUpdate(status) {
  46. try {
  47. await this.$fetch('updateBind', { id: this.data.id, status }) // 绑定状态(status):0-确认中 1-已绑定 2-已拒绝
  48. return true
  49. } catch (err) {
  50. return false
  51. }
  52. },
  53. async onReject() {
  54. const succ = await this.fetchUpdate(2)
  55. succ && this.$emit('submitted')
  56. },
  57. async onConfirm() {
  58. const succ = await this.fetchUpdate(1)
  59. succ && this.$emit('submitted')
  60. },
  61. },
  62. }
  63. </script>
  64. <style scoped lang="scss">
  65. @import './card.scss';
  66. .btns {
  67. margin-top: 16rpx;
  68. justify-content: flex-end;
  69. }
  70. .btn {
  71. display: inline-block;
  72. width: auto;
  73. padding: 10rpx 50rpx;
  74. font-family: PingFang SC;
  75. font-size: 28rpx;
  76. font-weight: 500;
  77. line-height: 1.4;
  78. color: #252545;
  79. border: 2rpx solid #252545;
  80. border-radius: 32rpx;
  81. & + & {
  82. margin-left: 24rpx;
  83. }
  84. }
  85. </style>