userDetail.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <template>
  2. <view class="user-detail">
  3. <view class="user-detail-message">
  4. <view class=""><text>姓名:{{user.username}}</text></view>
  5. <view class=""><text>手机号:{{user.mobile}}</text></view>
  6. <view class=""><text>校区:{{user.area}}</text></view>
  7. </view>
  8. <view class="user-account">
  9. <view class="account-left">余额:</view>
  10. <view class="account-right">{{user.wallet_money}}</view>
  11. </view>
  12. <view class="user-account">
  13. <view class="account-left">押金金额:</view>
  14. <view class="account-right">{{user.deposit}}</view>
  15. </view>
  16. <view class="user-account" @click="tap">
  17. <view class="account-left">历史订单:</view>
  18. <view class="account-right">
  19. <image src="../../static/img/right-arrow.png" mode=""></image></text>
  20. </view>
  21. </view>
  22. <view class="user-account">
  23. <view class="account-left">备注:</view>
  24. <input type="text" value="" class="user-detai-beizhu" :value="user.remark" @input="getText" />
  25. <view class="user-detail-bt" @click="operate">
  26. 完成
  27. </view>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. var app = getApp()
  33. export default {
  34. data() {
  35. return {
  36. userId: '', //用户id
  37. user: [],
  38. isDisabled: false, //备注是否修改
  39. textVal: '', //输入框内容
  40. }
  41. },
  42. onLoad(options) {
  43. uni.showLoading({
  44. title: '加载中...',
  45. })
  46. this.userId = options.id
  47. app.request('user/detail?user_id=' + options.id, '', 'GET').then(res => {
  48. uni.hideLoading();
  49. console.log(res.data)
  50. this.user = res.data
  51. if (res.data.remark) {
  52. this.isDisabled = true
  53. }
  54. })
  55. console.log(options, '这是上个页面传过来的数据')
  56. },
  57. methods: {
  58. //跳转订单历史页面
  59. tap: function() {
  60. uni.navigateTo({
  61. url: '/pages/manage/historyOrder?id=' + this.userId,
  62. })
  63. },
  64. operate: function() {
  65. // let that = this;
  66. if (this.textVal=='') {
  67. uni.showToast({
  68. title: '请填写备注~',
  69. icon: 'none'
  70. })
  71. return;
  72. } else {
  73. uni.showLoading({
  74. title: '加载中...',
  75. })
  76. let data = {
  77. remark: this.textVal
  78. }
  79. console.log(123445)
  80. app.request('user/updateRemark/' + this.userId, data, 'PUT').then(res => {
  81. uni.hideLoading();
  82. if (res.statusCode == 200) {
  83. uni.showToast({
  84. title: '提交成功~',
  85. icon: 'none'
  86. })
  87. this.isDisabled = true
  88. }
  89. })
  90. }
  91. },
  92. getText(e) {
  93. this.textVal = e.detail.value
  94. },
  95. }
  96. }
  97. </script>
  98. <style>
  99. page {
  100. background-color: #f1f1f1;
  101. }
  102. .user-detail {
  103. padding: 20rpx 30rpx;
  104. }
  105. .user-detail-message {
  106. font-size: 24rpx;
  107. line-height: 50rpx;
  108. background-color: #FFFFFF;
  109. border-radius: 15rpx;
  110. padding: 20rpx;
  111. }
  112. .user-account {
  113. margin-top: 20rpx;
  114. padding: 0 20rpx;
  115. height: 88rpx;
  116. font-size: 28rpx;
  117. line-height: 88rpx;
  118. background-color: #FFFFFF;
  119. border-radius: 15rpx;
  120. display: flex;
  121. }
  122. .account-left {
  123. flex: 1;
  124. }
  125. .account-right {
  126. text-align: right;
  127. flex: 1;
  128. }
  129. .account-right image {
  130. margin-top: 30rpx;
  131. height: 30rpx;
  132. width: 40rpx;
  133. }
  134. .user-detai-beizhu {
  135. display: inline-block;
  136. flex: 0 0 50%;
  137. margin-right:60upx;
  138. vertical-align: top;
  139. border-radius: 30rpx;
  140. margin-top: 20upx;
  141. padding-left: 20upx;
  142. border: solid 1px #d1d1d1;
  143. }
  144. .user-detail-bt {
  145. display: inline-block;
  146. margin-top: 30rpx;
  147. float: right;
  148. /* flex: 1; */
  149. height: 38rpx;
  150. line-height: 38rpx;
  151. width: 80rpx;
  152. text-align: center;
  153. font-size: 22rpx;
  154. border-radius: 30rpx;
  155. background-color: #18D5B9;
  156. color: #FFFFFF;
  157. }
  158. </style>