index.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <template>
  2. <view :style="viewColor">
  3. <form report-submit='true'>
  4. <view v-if="userInfo">
  5. <view class="user-info">
  6. <image class="image" :src="userInfo.user.avatar || '/static/images/f.png'"></image>
  7. <text>{{userInfo.user.nickname}}</text>
  8. </view>
  9. <view class="customerInfo">
  10. <view class="list">
  11. <view class="item">
  12. <view class="text">备注昵称</view>
  13. <view class="input">
  14. <input type='text' v-model="userInfo.mark" placeholder="请输入"></input>
  15. </view>
  16. </view>
  17. <view class="item" v-if="userInfo.user.phone">
  18. <view class="text">手机号</view>
  19. <view class="input">
  20. {{userInfo.user.phone}}
  21. </view>
  22. </view>
  23. <view class="item">
  24. <view class="text">推广员</view>
  25. <view class="input">
  26. {{userInfo.user.is_promoter ? '是' : '否'}}
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. <button form-type="submit" @click="saveMark" class="confirmBnt">确认</button>
  32. </view>
  33. </form>
  34. </view>
  35. </template>
  36. <script>
  37. // +----------------------------------------------------------------------
  38. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  39. // +----------------------------------------------------------------------
  40. // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
  41. // +----------------------------------------------------------------------
  42. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  43. // +----------------------------------------------------------------------
  44. // | Author: CRMEB Team <admin@crmeb.com>
  45. // +----------------------------------------------------------------------
  46. import { serviceUser, serviceSaveMark } from '@/api/user.js';
  47. import {
  48. mapGetters
  49. } from "vuex";
  50. export default {
  51. data() {
  52. return {
  53. userInfo: null,
  54. merId: '',
  55. uid: '',
  56. loading: false,
  57. };
  58. },
  59. computed: mapGetters(['isLogin', 'viewColor']),
  60. onLoad(options) {
  61. this.mer_id = options.mer_id;
  62. this.uid = options.uid;
  63. this.serviceUser()
  64. },
  65. methods: {
  66. saveMark() {
  67. if(this.loading) return ;
  68. this.loading = true;
  69. serviceSaveMark(this.mer_id, this.uid, this.userInfo.mark).then(res=>{
  70. uni.showToast({
  71. icon: 'success',
  72. title: '保存成功'
  73. })
  74. setTimeout(v=>{
  75. uni.navigateBack()
  76. }, 1000)
  77. }).catch(err=>{
  78. uni.showToast({
  79. title: err,
  80. icon: 'none'
  81. })
  82. }).finally(e=>{
  83. setTimeout(e=>{
  84. this.loading = false
  85. }, 2000)
  86. })
  87. },
  88. serviceUser() {
  89. uni.showLoading({
  90. title: '加载中',
  91. mask: true
  92. })
  93. serviceUser(this.mer_id, this.uid).then(res => {
  94. this.userInfo = res.data
  95. }).catch(err=>{
  96. uni.showToast({
  97. title: err,
  98. icon: 'none'
  99. })
  100. setTimeout(v=>{
  101. uni.navigateBack()
  102. }, 1000)
  103. }).finally(e=>{
  104. uni.hideLoading()
  105. })
  106. },
  107. }
  108. }
  109. </script>
  110. <style lang="scss">
  111. .customerInfo{
  112. background: #ffffff;
  113. margin-top: 20rpx;
  114. }
  115. .customerInfo .phone {
  116. font-size: 32rpx;
  117. }
  118. .customerInfo .list {
  119. width: 650rpx;
  120. margin: 0 auto;
  121. }
  122. .customerInfo .list .item {
  123. width: 100%;
  124. height: 110rpx;
  125. display: flex;
  126. align-items: center;
  127. border-bottom: 2rpx solid #f0f0f0;
  128. }
  129. .customerInfo .list .item .title {
  130. color: #333333;
  131. font-size: 30rpx;
  132. }
  133. .customerInfo .list .item .text{
  134. width: 160rpx;
  135. }
  136. .customerInfo .list .item .input {
  137. width: 100%;
  138. margin-left: 60rpx;
  139. color: #666666;
  140. font-size: 30rpx;
  141. }
  142. .customerInfo .list .item input {
  143. width: 100%;
  144. height: 100%;
  145. font-size: 30rpx;
  146. color: #666666;
  147. }
  148. .confirmBnt {
  149. font-size: 32rpx;
  150. width: 650rpx;
  151. height: 90rpx;
  152. border-radius: 45rpx;
  153. color: #fff;
  154. margin: 70rpx auto 0 auto;
  155. text-align: center;
  156. line-height: 90rpx;
  157. background-color: var(--view-theme);
  158. }
  159. .user-info{
  160. padding: 50rpx 30rpx 30rpx;
  161. display: flex;
  162. align-items: center;
  163. background-color: #fff;
  164. .image{
  165. width: 111rpx;
  166. height: 111rpx;
  167. border-radius: 100%;
  168. }
  169. text{
  170. margin-left: 24rpx;
  171. color: #333333;
  172. font-size: 32rpx;
  173. font-weight: bold;
  174. }
  175. }
  176. </style>