userInfo.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  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="imgPath+'/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="imgPath+'/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="imgPath+'/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:this.$store.state.imgpath+"/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. computed: {
  115. imgPath() {
  116. return this.$store.state.imgpath
  117. }
  118. },
  119. methods: {
  120. submitshen(){
  121. if(this.userinfo.isAudit==1){
  122. uni.showToast({
  123. title: "用户已经通过审核,无需多次审核",
  124. icon: 'none',
  125. });
  126. return
  127. }
  128. this.subsalesaudits()
  129. },
  130. submitjin(){
  131. if(this.userinfo.status==0){
  132. uni.showToast({
  133. title: "用户已经解除禁用,无需多次解除",
  134. icon: 'none',
  135. });
  136. return
  137. }
  138. this.changesalesStates()
  139. },
  140. subsalesaudits(){
  141. const data={
  142. userIds:this.userId
  143. }
  144. subsalesaudit(this.userId).then(res=>{
  145. console.log(res)
  146. if(res.code==200){
  147. uni.showToast({
  148. title: "用户通过审核,成为销售!",
  149. icon: 'none',
  150. });
  151. uni.navigateBack({
  152. delta: 1
  153. })
  154. }else{
  155. uni.showToast({
  156. title: res.msg,
  157. icon: 'none',
  158. });
  159. }
  160. })
  161. },
  162. changesalesStates(){
  163. const data={
  164. userIds:this.userId
  165. }
  166. changesalesState(this.userId).then(res=>{
  167. console.log(res)
  168. if(res.code==200){
  169. uni.showToast({
  170. title: "用户解除禁用!",
  171. icon: 'none',
  172. });
  173. uni.navigateBack({
  174. delta: 1
  175. })
  176. }else{
  177. uni.showToast({
  178. title: res.msg,
  179. icon: 'none',
  180. });
  181. }
  182. })
  183. },
  184. bindUser(data){
  185. var that=this;
  186. that.userinfo=data.user
  187. console.log(that.userinfo)
  188. that.nickName=data.user.nickName;
  189. that.deptName=data.user.dept.deptName;
  190. that.posts=data.post;
  191. that.phonenumber=data.user.phonenumber;
  192. that.email=data.user.email;
  193. if(data.user.sex==0){
  194. that.sex="男";
  195. }
  196. else if(data.user.sex==1){
  197. that.sex="女";
  198. }
  199. else if(data.user.sex==2){
  200. that.sex="未知";
  201. }
  202. if(data.post!=null&&data.post.length>0){
  203. var posts=[];
  204. data.post.forEach( (v,i) => {
  205. posts.push(v);
  206. },this);
  207. that.postNames=posts.toString()
  208. }
  209. if(!that.utils.isEmpty(data.user.avatar)){
  210. that.avatar=uni.getStorageSync('requestPath')+data.user.avatar;
  211. }
  212. },
  213. getUserInfoByUserId(userId){
  214. var data = {userId:userId};
  215. var that=this;
  216. getUserInfoByUserId(data).then(
  217. res => {
  218. // console.log(res)
  219. that.bindUser(res);
  220. },
  221. rej => {}
  222. );
  223. },
  224. getUserInfo(){
  225. var data = {};
  226. var that=this;
  227. getUserInfo(data).then(
  228. res => {
  229. that.bindUser(res);
  230. },
  231. rej => {}
  232. );
  233. },
  234. // 拨打电话
  235. callPhone(tel){
  236. uni.makePhoneCall({
  237. phoneNumber: tel
  238. })
  239. },
  240. // 个人信息编辑
  241. editInfo() {
  242. uni.navigateTo({
  243. url: '../editUser'
  244. })
  245. }
  246. }
  247. }
  248. </script>
  249. <style lang="scss">
  250. page{
  251. background: #fff;
  252. }
  253. </style>
  254. <style scoped lang="scss">
  255. .footer-btn{
  256. display: flex;
  257. justify-content: space-around;
  258. position: fixed;
  259. bottom: 0;
  260. width: 100%;
  261. padding: 40rpx 0;
  262. view{
  263. width: 40%;
  264. text-align: center;
  265. padding: 20rpx 0;
  266. border-radius: 50rpx;
  267. }
  268. }
  269. .shenhed{
  270. background-color: rgba(64, 149,229,0.1);
  271. border: 2rpx solid #4095E5;
  272. color:#4095E5 ;
  273. }
  274. .notshenhe{
  275. background-color:rgba(255, 108,71,0.1) ;
  276. border: 2rpx solid #FF6C47;
  277. color: #FF6C47;
  278. }
  279. .item{
  280. width: calc(50% - 20rpx);
  281. margin-top: 20rpx;
  282. }
  283. .content{
  284. // 个人信息
  285. .user-info{
  286. background: linear-gradient(to right, #dae9ff, #e1e1fd);
  287. padding: 0 30upx;
  288. .info-box{
  289. display: flex;
  290. align-items: center;
  291. justify-content: space-between;
  292. .left{
  293. display: flex;
  294. align-items: center;
  295. justify-content: center;
  296. padding: 20upx 0;
  297. .head-box{
  298. width: 120upx;
  299. height: 120upx;
  300. line-height: 100upx;
  301. font-size: 30upx;
  302. color: #fff;
  303. text-align: center;
  304. margin-right: 20upx;
  305. .img{
  306. border-radius: 50%;
  307. width: 100%;
  308. height: 100%;
  309. }
  310. }
  311. }
  312. .right{
  313. width: 40upx;
  314. height: 40upx;
  315. }
  316. }
  317. .comp-info{
  318. padding: 20upx 0 40upx;
  319. display: flex;
  320. align-items: center;
  321. .img{
  322. width: 30upx;
  323. height: 30upx;
  324. margin-right: 20upx;
  325. }
  326. .text{
  327. font-size: 30upx;
  328. color: #fff;
  329. }
  330. }
  331. }
  332. }
  333. </style>