saleInfo.vue 7.7 KB

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