userInfo.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <template>
  2. <view class="container">
  3. <u-navbar leftIconColor="#fff" titleStyle="color:#fff;fontSize:36rpx;" :autoBack="true" bgColor="#2C6FF3"
  4. :placeholder="true" title="会员信息"></u-navbar>
  5. <view class="content">
  6. <view class="xy-card info-box">
  7. <view class="flex justify-start">
  8. <view class="flex justify-start">
  9. <view class="name">会员id:</view>
  10. <view>{{info.memberId}}</view>
  11. </view>
  12. <view style="margin-left: 24rpx;">
  13. <xbutton size="mini" @tap="copy(info.memberId)">复制</xbutton>
  14. </view>
  15. </view>
  16. <view class="flex justify-start">
  17. <view class="name">昵称:</view>
  18. <view>{{info.member.wechatNickname||info.member.alipayNickname||'/'}}</view>
  19. </view>
  20. <view class="flex justify-start phone">
  21. <view class="flex justify-start">
  22. <view class="name">手机:</view>
  23. <view>{{info.member.tel}}</view>
  24. </view>
  25. <view style="margin-left: 24rpx;">
  26. <xbutton size="mini" @click="block" v-if="info.isBlacklist">解除黑名单</xbutton>
  27. <xbutton size="mini" @click="block" v-else>拉黑</xbutton>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. <xpopup :show="show" @close="close" @confirm="submit" :showBtn="true" title="黑名单">
  33. <!-- 拉黑 -->
  34. <view class="pop-content restart">
  35. 是否确定拉黑该用户?
  36. </view>
  37. </xpopup>
  38. </view>
  39. </template>
  40. <script>
  41. import {
  42. userInfo,
  43. setBlacklist,
  44. removeBlackList
  45. } from '@/api/order/order.js'
  46. export default {
  47. data() {
  48. return {
  49. id: null,
  50. info: {},
  51. show: false,
  52. }
  53. },
  54. onLoad(o) {
  55. this.id = o.id;
  56. this.getInfo()
  57. },
  58. methods: {
  59. getInfo() {
  60. userInfo({
  61. memberId: this.id
  62. }).then(res => {
  63. this.info = res.data
  64. })
  65. },
  66. copy(text) {
  67. uni.setClipboardData({
  68. data: text,
  69. success: (data) => {
  70. uni.showToast({
  71. title: '复制成功'
  72. })
  73. },
  74. fail: function(err) {
  75. },
  76. complete: function(res) {
  77. }
  78. })
  79. },
  80. block() {
  81. // this.show = true
  82. if(this.info.isBlacklist){ //已拉黑,解除
  83. removeBlackList({
  84. memberId: this.id
  85. }).then(res => {
  86. this.getInfo()
  87. this.close()
  88. this.$modal.showToast('解除成功~')
  89. }).catch(err => {
  90. this.close()
  91. })
  92. }else{ //拉黑
  93. setBlacklist({
  94. memberId: this.id
  95. }).then(res => {
  96. this.getInfo()
  97. this.close()
  98. this.$modal.showToast('拉黑成功~')
  99. }).catch(err => {
  100. this.close()
  101. })
  102. }
  103. },
  104. // 关闭弹框
  105. close(e) {
  106. this.show = false
  107. },
  108. // 弹框确定
  109. submit() {
  110. if(this.info.isBlacklist){ //已拉黑,解除
  111. removeBlackList({
  112. memberId: this.id
  113. }).then(res => {
  114. this.$modal.msg('解除成功~')
  115. this.getInfo()
  116. this.close()
  117. }).catch(err => {
  118. this.close()
  119. })
  120. }else{ //拉黑
  121. setBlacklist({
  122. memberId: this.id
  123. }).then(res => {
  124. this.$modal.msg('拉黑成功~')
  125. this.getInfo()
  126. this.close()
  127. }).catch(err => {
  128. this.close()
  129. })
  130. }
  131. },
  132. }
  133. }
  134. </script>
  135. <style lang="scss">
  136. .container {
  137. .content {
  138. padding: 0 24rpx;
  139. overflow: hidden;
  140. .info-box {
  141. margin-top: 24rpx;
  142. >view {
  143. line-height: 60rpx;
  144. }
  145. .name {
  146. width: 120rpx;
  147. font-size: 28rpx;
  148. font-weight: bold;
  149. color: #333;
  150. }
  151. }
  152. .phone {
  153. text {
  154. display: inline-block;
  155. background-color: #5b5b5b;
  156. color: #fff;
  157. font-size: 22rpx;
  158. padding: 0 12rpx;
  159. border-radius: 6rpx;
  160. margin-left: 12rpx;
  161. line-height: 36rpx;
  162. }
  163. }
  164. }
  165. .pop-content {
  166. padding: 24rpx;
  167. }
  168. }
  169. </style>