userInfo.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  1. <template>
  2. <view class="content">
  3. <!-- 个人信息 -->
  4. <view class="user-info">
  5. <view class="info-box">
  6. <view class="left">
  7. <view class="head-box">
  8. <image class="img" :src="avatar" mode="aspectFill"></image>
  9. </view>
  10. <view class="info">
  11. <!-- <text class="name">{{nickName}}</text> -->
  12. <!-- <text class="title">{{postNames}}</text> -->
  13. <view>
  14. <text class="fs28">{{nickName}}</text>
  15. <text class="fs24 ml40 base-color-3">{{sex}}</text>
  16. </view>
  17. <view class="base-color-9 fs24 mt12">注册时间:{{!userinfo.createTime||userinfo.createTime.slice(0, 10)}}</view>
  18. </view>
  19. </view>
  20. <image v-if="!isShow" class="right" src="https://fbylive.obs.cn-southwest-2.myhuaweicloud.com/app/images/icon_edit.png" mode="aspectFill" @click="editInfo"></image>
  21. </view>
  22. <!-- 公司 -->
  23. <view class="justify-between">
  24. <view class="comp-info">
  25. <image class="img" src="https://fbylive.obs.cn-southwest-2.myhuaweicloud.com/app/images/icon_comp.png" mode="aspectFill"></image>
  26. <text class="fs24 base-color-6">{{userinfo.deptName}}</text>
  27. </view>
  28. <view class="comp-info">
  29. <image class="img" src="https://fbylive.obs.cn-southwest-2.myhuaweicloud.com/app/images/phone.png" mode="aspectFill"></image>
  30. <text class="fs24 base-color-6">{{userinfo.phonenumber}}</text>
  31. </view>
  32. </view>
  33. </view>
  34. <!-- 详细信息 -->
  35. <view class="p20 justify-between wrap">
  36. <view class="base-bg-sure radius12 pl20 ptb12 item">
  37. <view class="bold">会员总数</view>
  38. <view class="mt12 base-color">
  39. <text class="fs40 bold">{{userinfo.vipCount}}</text>
  40. <text class="fs28">人</text>
  41. </view>
  42. </view>
  43. <view class="base-bg-sure radius12 pl20 ptb12 item">
  44. <view class="bold">今日新增会员</view>
  45. <view class="mt12 base-color">
  46. <text class="fs40 bold">{{userinfo.newVipCount}}</text>
  47. <text class="fs28">人</text>
  48. </view>
  49. </view>
  50. <view class="base-bg-sure radius12 pl20 ptb12 item">
  51. <view class="bold">会员红包数</view>
  52. <view class="mt12 base-color">
  53. <text class="fs40 bold">{{userinfo.redPacketCount}}</text>
  54. <text class="fs28">个</text>
  55. </view>
  56. </view>
  57. <view class="base-bg-sure radius12 pl20 ptb12 item">
  58. <view class="bold">新会员红包金额</view>
  59. <view class="mt12 base-color">
  60. <text class="fs40 bold">{{userinfo.newVipRedPackAmount}}</text>
  61. <text class="fs28">元</text>
  62. </view>
  63. </view>
  64. </view>
  65. <view class="footer-btn ">
  66. <view :class="userinfo.isAudit==1?'shenhed':'notshenhe'" @click="submitshen">{{userinfo.isAudit==1?'已审核':'待审核'}}</view>
  67. <view :class="userinfo.status==1?'notshenhe':'shenhed'" @click="submitjin">{{userinfo.status==1?'禁用':'未禁用'}}</view>
  68. </view>
  69. </view>
  70. </template>
  71. <script>
  72. import {getUserInfoByUserId,getUserInfo} from '@/api/user.js';
  73. import {subsalesaudit,changesalesState} from '@/api/courseManage.js';
  74. export default {
  75. data() {
  76. return {
  77. avatar:"https://fbylive.obs.cn-southwest-2.myhuaweicloud.com/app/images/default.png",
  78. nickName:"",
  79. deptName:"",
  80. postNames:"",
  81. phonenumber:"",
  82. email:"",
  83. sex:"",
  84. isShow:false,
  85. userId:'',
  86. userinfo:[],
  87. shenhe:false,
  88. jinyong:false,
  89. }
  90. },
  91. onLoad(option) {
  92. // 修改顶部导航背景色
  93. // uni.setNavigationBarColor({
  94. // frontColor: '#ffffff',
  95. // backgroundColor: '#4BC9B1',
  96. // animation: {
  97. // duration: 400,
  98. // timingFunc: 'easeIn'
  99. // }
  100. // })
  101. if(!this.utils.isEmpty(option.userId)){
  102. this.userId = option.userId;
  103. this.isShow=true;
  104. }
  105. },
  106. onShow() {
  107. if(this.isShow){
  108. this.getUserInfoByUserId(this.userId);
  109. }
  110. else{
  111. this.getUserInfo();
  112. }
  113. },
  114. methods: {
  115. submitshen(){
  116. if(this.userinfo.isAudit==1){
  117. uni.showToast({
  118. title: "用户已经通过审核,无需多次审核",
  119. icon: 'none',
  120. });
  121. return
  122. }
  123. this.subsalesaudits()
  124. },
  125. submitjin(){
  126. if(this.userinfo.status==0){
  127. uni.showToast({
  128. title: "用户已经解除禁用,无需多次解除",
  129. icon: 'none',
  130. });
  131. return
  132. }
  133. this.changesalesStates()
  134. },
  135. subsalesaudits(){
  136. const data={
  137. userIds:this.userId
  138. }
  139. subsalesaudit(this.userId).then(res=>{
  140. console.log(res)
  141. if(res.code==200){
  142. uni.showToast({
  143. title: "用户通过审核,成为销售!",
  144. icon: 'none',
  145. });
  146. uni.navigateBack({
  147. delta: 1
  148. })
  149. }else{
  150. uni.showToast({
  151. title: res.msg,
  152. icon: 'none',
  153. });
  154. }
  155. })
  156. },
  157. changesalesStates(){
  158. const data={
  159. userIds:this.userId
  160. }
  161. changesalesState(this.userId).then(res=>{
  162. console.log(res)
  163. if(res.code==200){
  164. uni.showToast({
  165. title: "用户解除禁用!",
  166. icon: 'none',
  167. });
  168. uni.navigateBack({
  169. delta: 1
  170. })
  171. }else{
  172. uni.showToast({
  173. title: res.msg,
  174. icon: 'none',
  175. });
  176. }
  177. })
  178. },
  179. bindUser(data){
  180. var that=this;
  181. that.userinfo=data.user
  182. console.log(that.userinfo)
  183. that.nickName=data.user.nickName;
  184. that.deptName=data.user.dept.deptName;
  185. that.posts=data.post;
  186. that.phonenumber=data.user.phonenumber;
  187. that.email=data.user.email;
  188. if(data.user.sex==0){
  189. that.sex="男";
  190. }
  191. else if(data.user.sex==1){
  192. that.sex="女";
  193. }
  194. else if(data.user.sex==2){
  195. that.sex="未知";
  196. }
  197. if(data.post!=null&&data.post.length>0){
  198. var posts=[];
  199. data.post.forEach( (v,i) => {
  200. posts.push(v);
  201. },this);
  202. that.postNames=posts.toString()
  203. }
  204. if(!that.utils.isEmpty(data.user.avatar)){
  205. that.avatar=uni.getStorageSync('requestPath')+data.user.avatar;
  206. }
  207. },
  208. getUserInfoByUserId(userId){
  209. var data = {userId:userId};
  210. var that=this;
  211. getUserInfoByUserId(data).then(
  212. res => {
  213. // console.log(res)
  214. that.bindUser(res);
  215. },
  216. rej => {}
  217. );
  218. },
  219. getUserInfo(){
  220. var data = {};
  221. var that=this;
  222. getUserInfo(data).then(
  223. res => {
  224. that.bindUser(res);
  225. },
  226. rej => {}
  227. );
  228. },
  229. // 拨打电话
  230. callPhone(tel){
  231. uni.makePhoneCall({
  232. phoneNumber: tel
  233. })
  234. },
  235. // 个人信息编辑
  236. editInfo() {
  237. uni.navigateTo({
  238. url: '../editUser'
  239. })
  240. }
  241. }
  242. }
  243. </script>
  244. <style lang="scss">
  245. page{
  246. background: #fff;
  247. }
  248. </style>
  249. <style scoped lang="scss">
  250. .footer-btn{
  251. display: flex;
  252. justify-content: space-around;
  253. position: fixed;
  254. bottom: 0;
  255. width: 100%;
  256. padding: 40rpx 0;
  257. view{
  258. width: 40%;
  259. text-align: center;
  260. padding: 20rpx 0;
  261. border-radius: 50rpx;
  262. }
  263. }
  264. .shenhed{
  265. background-color: rgba(64, 149,229,0.1);
  266. border: 2rpx solid #4095E5;
  267. color:#4095E5 ;
  268. }
  269. .notshenhe{
  270. background-color:rgba(255, 108,71,0.1) ;
  271. border: 2rpx solid #FF6C47;
  272. color: #FF6C47;
  273. }
  274. .item{
  275. width: calc(50% - 20rpx);
  276. margin-top: 20rpx;
  277. }
  278. .content{
  279. // 个人信息
  280. .user-info{
  281. background: linear-gradient(to right, #dae9ff, #e1e1fd);
  282. padding: 0 30upx;
  283. .info-box{
  284. display: flex;
  285. align-items: center;
  286. justify-content: space-between;
  287. .left{
  288. display: flex;
  289. align-items: center;
  290. justify-content: center;
  291. padding: 20upx 0;
  292. .head-box{
  293. width: 120upx;
  294. height: 120upx;
  295. line-height: 100upx;
  296. font-size: 30upx;
  297. color: #fff;
  298. text-align: center;
  299. margin-right: 20upx;
  300. .img{
  301. border-radius: 50%;
  302. width: 100%;
  303. height: 100%;
  304. }
  305. }
  306. }
  307. .right{
  308. width: 40upx;
  309. height: 40upx;
  310. }
  311. }
  312. .comp-info{
  313. padding: 20upx 0 40upx;
  314. display: flex;
  315. align-items: center;
  316. .img{
  317. width: 30upx;
  318. height: 30upx;
  319. margin-right: 20upx;
  320. }
  321. .text{
  322. font-size: 30upx;
  323. color: #fff;
  324. }
  325. }
  326. }
  327. }
  328. </style>