index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573
  1. <template>
  2. <view class="user-details">
  3. <!-- #ifdef MP || APP-PLUS -->
  4. <view class="accountTitle">
  5. <view :style="{height:getHeight.barTop+'px'}"></view>
  6. <view class="sysTitle acea-row row-center-wrapper" :style="{height:getHeight.barHeight+'px'}">
  7. <view>用户详情</view>
  8. <text class="iconfont icon-ic_leftarrow" @click="goarrow"></text>
  9. </view>
  10. </view>
  11. <view :style="{height:(getHeight.barTop+getHeight.barHeight)+'px'}"></view>
  12. <!-- #endif -->
  13. <view class="header">
  14. <view class="picTxt acea-row row-middle">
  15. <view class="pictrue">
  16. <image :src="infoData.avatar"></image>
  17. </view>
  18. <view class="text">
  19. <view class="name acea-row row-middle">
  20. <view class="nameCon line1">{{infoData.nickname}}</view>
  21. <view class="svip acea-row row-center-wrapper" v-if="infoData.isMember == 1">SVIP</view>
  22. <view class="vip acea-row row-center-wrapper" v-if="infoData.level_status == 1 && infoData.level > 0">
  23. <text class="iconfont icon-huiyuandengji"></text>
  24. V{{infoData.level_grade}}
  25. </view>
  26. </view>
  27. <view v-if="infoData.phone">{{infoData.phone}}(ID:{{uid}})</view>
  28. <view v-else>ID:{{uid}}</view>
  29. </view>
  30. </view>
  31. <view class="bottom acea-row row-middle">
  32. <view class="item">消费金额<text class="num">{{infoData.order_total_price}}</text></view>
  33. <view class="item">消费笔数<text class="num">{{infoData.order_total_count}}</text></view>
  34. </view>
  35. </view>
  36. <view class="list">
  37. <view class="title acea-row row-between-wrapper">
  38. <view class="name">用户信息</view>
  39. <view class="tip" @click="openTap">{{isShow?'展开':'收起'}}<text class="iconfont" :class="isShow?'icon-ic_downarrow':'icon-ic_uparrow'"></text></view>
  40. </view>
  41. <view class="item acea-row row-between-wrapper">
  42. <view>分组</view>
  43. <view v-if="types">
  44. <picker @change="bindPickerChange" :value="groupIndex" :range="groupArray" range-key="group_name">
  45. <view class="acea-row row-middle">
  46. <view v-if="groupArray.length">
  47. <text class="not" v-if="groupIndex == -1">无</text>
  48. <text v-else>{{groupArray[groupIndex].group_name}}</text>
  49. </view>
  50. <text class="iconfont icon-ic_rightarrow"></text>
  51. </view>
  52. </picker>
  53. </view>
  54. <view class="not" v-else>{{infoData.group_name || '无'}}</view>
  55. </view>
  56. <view class="item acea-row row-between-wrapper">
  57. <view>等级</view>
  58. <view v-if="types">
  59. <picker @change="bindLevelChange" :value="levelIndex" :range="levelArray" range-key="name">
  60. <view class="acea-row row-middle">
  61. <view v-if="levelArray.length">
  62. <text class="not" v-if="levelIndex == -1">无</text>
  63. <text v-else>{{levelArray[levelIndex].name}}</text>
  64. </view>
  65. <text class="iconfont icon-ic_rightarrow"></text>
  66. </view>
  67. </picker>
  68. </view>
  69. <view class="not" v-else>{{infoData.level_name || '无'}}</view>
  70. </view>
  71. <view class="item">
  72. <view class="acea-row row-between-wrapper">
  73. <view>标签</view>
  74. <view class="add" @click="editLabels" v-if="types"><text class="iconfont icon-ic_increase"></text>添加标签</view>
  75. </view>
  76. <view class="labelList acea-row row-middle" v-if="infoData.label_id && infoData.label_id.length">
  77. <view class="label" v-for="(item,index) in infoData.label_id" :key="index">{{item.label_name}}</view>
  78. </view>
  79. </view>
  80. <view class="listn" v-if="!isShow">
  81. <view class="item acea-row row-between-wrapper" v-if="infoData.real_name">
  82. <view>姓名</view>
  83. <view class="info">{{infoData.real_name}}</view>
  84. </view>
  85. <view class="item acea-row row-between-wrapper" v-if="infoData.birthday">
  86. <view>出生年月</view>
  87. <view class="info">{{infoData.birthday}}</view>
  88. </view>
  89. <view class="item acea-row row-between-wrapper" v-if="infoData.card_id">
  90. <view>身份证号</view>
  91. <view class="info">{{infoData.card_id}}</view>
  92. </view>
  93. <view class="item acea-row row-between" v-if="infoData.addres">
  94. <view>地址</view>
  95. <view class="info">{{infoData.addres}}</view>
  96. </view>
  97. <view class="item acea-row row-between-wrapper" v-if="infoData._add_time">
  98. <view>注册时间</view>
  99. <view class="info">{{infoData._add_time}}</view>
  100. </view>
  101. </view>
  102. </view>
  103. <view class="property">
  104. <view class="title">资产信息</view>
  105. <view class="info acea-row">
  106. <view class="item" @click="integralTap">
  107. <view>积分</view>
  108. <view class="bottom acea-row row-between-wrapper">
  109. <view class="num">{{infoData.integral}}</view>
  110. <view class="iconfont icon-ic_edit" v-if="types"></view>
  111. </view>
  112. </view>
  113. <view class="item" @click="balanceTap">
  114. <view>余额</view>
  115. <view class="bottom acea-row row-between-wrapper">
  116. <view class="num">{{infoData.now_money}}</view>
  117. <view class="iconfont icon-ic_edit" v-if="types"></view>
  118. </view>
  119. </view>
  120. </view>
  121. <view class="info acea-row">
  122. <view class="item">
  123. <view class="acea-row row-between-wrapper">
  124. <view>优惠券</view>
  125. <view class="iconfont icon-ic_rightarrow" @click="couponSeeTap" v-if="types"></view>
  126. </view>
  127. <view class="bottom acea-row row-between-wrapper">
  128. <view class="num">{{infoData.coupon_num}}张</view>
  129. <view class="give" @click="couponTap" v-if="types">赠送</view>
  130. </view>
  131. </view>
  132. <view class="item" @click="memberTap">
  133. <view>会员</view>
  134. <view class="bottom acea-row row-between-wrapper">
  135. <view class="num" v-if="infoData.svip_over_day">{{ '剩余'+infoData.svip_over_day+'天' }}</view>
  136. <view class="num" v-else>已过期/暂未开通</view>
  137. <view class="iconfont icon-ic_edit" v-if="types"></view>
  138. </view>
  139. </view>
  140. </view>
  141. </view>
  142. <edit-lable ref="lable" :visible='visibleLable' @closeDrawer='lableCloseDrawer'></edit-lable>
  143. <edit-balance ref="balance" :visible='visibleBalance' :type = 'type' :uid='parseInt(uid)' @closeDrawer='balanceCloseDrawer' @successChange='successChange'></edit-balance>
  144. <member ref="member" :visible='visibleMember' :userInfo='infoData' @closeDrawer='memberCloseDrawer' @successChange='successChange'></member>
  145. <coupon ref="coupon" :visible='visibleCoupon' :uid='parseInt(uid)' @closeDrawer='couponCloseDrawer'></coupon>
  146. </view>
  147. </template>
  148. <script>
  149. import editLable from './components/userLable/index.vue';
  150. import editBalance from './components/editBalance/index.vue';
  151. import member from './components/member/index.vue';
  152. import coupon from './components/coupon/index.vue';
  153. import {
  154. getStoreUserInfo,
  155. getUserInfo,
  156. getGroupList,
  157. getLevelList,
  158. postUserUpdate
  159. } from "@/api/admin";
  160. export default {
  161. components: {
  162. editLable,
  163. editBalance,
  164. member,
  165. coupon
  166. },
  167. data() {
  168. return {
  169. getHeight: this.$util.getWXStatusHeight(),
  170. uid: 0,
  171. infoData: {},
  172. groupArray:[],
  173. levelArray:[],
  174. groupIndex:-1,
  175. levelIndex:-1,
  176. visibleLable:false,
  177. visibleBalance:false,
  178. type: 0,
  179. visibleMember:false,
  180. visibleCoupon:false,
  181. isShow:false,
  182. types:1 //判断是门店页面还是平台页面
  183. }
  184. },
  185. onLoad(options) {
  186. this.uid = options.uid
  187. this.types = parseInt(options.types);
  188. this.userInfo(this.types);
  189. },
  190. methods: {
  191. openTap(){
  192. this.isShow = !this.isShow
  193. },
  194. couponTap(){
  195. this.$refs.coupon.userCoupon(0);
  196. this.visibleCoupon = true;
  197. },
  198. couponSeeTap(){
  199. this.$refs.coupon.userCoupon(2);
  200. this.visibleCoupon = true;
  201. },
  202. couponCloseDrawer(e){
  203. this.visibleCoupon = false;
  204. if(e){
  205. this.userInfo();
  206. }
  207. },
  208. memberTap(){
  209. if(!this.types) return;
  210. this.visibleMember = true;
  211. },
  212. memberCloseDrawer(){
  213. this.visibleMember = false;
  214. },
  215. balanceTap(){
  216. if(!this.types) return
  217. this.type = 1;
  218. this.visibleBalance = true;
  219. },
  220. integralTap(){
  221. if(!this.types) return
  222. this.type = 0;
  223. this.visibleBalance = true;
  224. },
  225. successChange(){
  226. this.visibleBalance = false
  227. this.visibleMember = false;
  228. this.userInfo();
  229. },
  230. balanceCloseDrawer(){
  231. this.visibleBalance = false
  232. },
  233. lableCloseDrawer(e){
  234. this.visibleLable = false
  235. if(e){
  236. this.userInfo();
  237. }
  238. },
  239. editLabels(){
  240. this.visibleLable = true
  241. this.$refs.lable.productLabel(JSON.parse(JSON.stringify(this.infoData)),0,[]);
  242. },
  243. bindPickerChange(e){
  244. this.groupIndex = e.detail.value
  245. this.userUpdate(4)
  246. },
  247. bindLevelChange(e){
  248. this.levelIndex = e.detail.value
  249. this.userUpdate(1)
  250. },
  251. userUpdate(num){
  252. let data = {}
  253. if(num == 4){
  254. data = {
  255. type:4,
  256. uid:this.uid,
  257. group_id:this.groupArray[this.groupIndex].id
  258. }
  259. }else{
  260. data = {
  261. type:1,
  262. uid:this.uid,
  263. level:this.levelArray[this.levelIndex].id
  264. }
  265. }
  266. postUserUpdate(data).then(res=>{
  267. this.$util.Tips({
  268. title: res.msg
  269. });
  270. }).catch(err=>{
  271. this.$util.Tips({
  272. title: err
  273. });
  274. })
  275. },
  276. levelList(){
  277. getLevelList().then(res=>{
  278. let id = this.infoData.level
  279. res.data.list.forEach((item,index)=>{
  280. if(item.id == id){
  281. this.levelIndex = index
  282. }
  283. })
  284. this.levelArray = res.data.list;
  285. }).catch(err=>{
  286. this.$util.Tips({
  287. title: err
  288. });
  289. })
  290. },
  291. groupList(){
  292. getGroupList().then(res=>{
  293. let id = this.infoData.group_id
  294. res.data.forEach((item,index)=>{
  295. if(item.id == id){
  296. this.groupIndex = index
  297. }
  298. })
  299. this.groupArray = res.data;
  300. }).catch(err=>{
  301. this.$util.Tips({
  302. title: err
  303. });
  304. })
  305. },
  306. goarrow(){
  307. uni.navigateBack()
  308. },
  309. userInfo(num){
  310. let funApi = '';
  311. if(this.types){
  312. funApi = getUserInfo;
  313. }else{
  314. funApi = getStoreUserInfo;
  315. }
  316. funApi(this.uid).then(res=>{
  317. this.infoData = res.data;
  318. if(num){
  319. this.groupList();
  320. this.levelList();
  321. }
  322. }).catch(err=>{
  323. this.$util.Tips({
  324. title: err
  325. });
  326. })
  327. }
  328. }
  329. }
  330. </script>
  331. <style lang="scss" scoped>
  332. .accountTitle{
  333. background: linear-gradient(270deg, #01ABF8 0%, #2A7EFB 100%);
  334. position: fixed;
  335. left:0;
  336. top:0;
  337. width: 100%;
  338. z-index: 99;
  339. .sysTitle{
  340. width: 100%;
  341. position: relative;
  342. font-weight: 500;
  343. color: #fff;
  344. font-size: 30rpx;
  345. .iconfont{
  346. position: absolute;
  347. font-size: 39rpx;
  348. left:11rpx;
  349. width: 60rpx;
  350. font-weight: 600;
  351. }
  352. }
  353. }
  354. .user-details{
  355. padding-bottom: 1rpx;
  356. padding-bottom: calc(1rpx + constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
  357. padding-bottom: calc(1rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
  358. .header{
  359. background: linear-gradient(270deg, #01ABF8 0%, #2A7EFB 100%);
  360. height: 346rpx;
  361. padding: 20rpx 30rpx 0 30rpx;
  362. position: relative;
  363. .picTxt{
  364. .pictrue{
  365. width: 112rpx;
  366. height: 112rpx;
  367. image {
  368. width: 100%;
  369. height: 100%;
  370. border-radius: 50%;
  371. }
  372. }
  373. .text{
  374. margin-left: 32rpx;
  375. font-size: 24rpx;
  376. font-family: PingFang SC, PingFang SC;
  377. font-weight: 400;
  378. color: rgba(255, 255, 255, 0.5);
  379. .name{
  380. margin-bottom: 12rpx;
  381. .nameCon{
  382. font-size: 32rpx;
  383. color: #fff;
  384. max-width: 300rpx;
  385. }
  386. .svip{
  387. width: 56rpx;
  388. height: 26rpx;
  389. background: linear-gradient(270deg, #484643 0%, #1F1B17 100%);
  390. border-radius: 14rpx;
  391. font-size: 18rpx;
  392. font-weight: 600;
  393. color: #FDDAA4;
  394. margin-left: 12rpx;
  395. }
  396. .vip{
  397. width: 68rpx;
  398. height: 26rpx;
  399. background: #FEF0D9;
  400. margin-left: 12rpx;
  401. border-radius: 50rpx;
  402. font-size: 18rpx;
  403. font-weight: 500;
  404. color: #DFA541;
  405. .iconfont{
  406. font-size: 20rpx;
  407. margin-right: 4rpx;
  408. }
  409. }
  410. }
  411. }
  412. }
  413. .bottom{
  414. font-size: 26rpx;
  415. font-family: PingFang SC, PingFang SC;
  416. font-weight: 400;
  417. color: rgba(255, 255, 255, 0.8);
  418. margin-top: 40rpx;
  419. .item{
  420. margin-right: 44rpx;
  421. .num{
  422. margin-left: 8rpx;
  423. color: #FFFFFF;
  424. }
  425. }
  426. }
  427. &::after{
  428. position: absolute;
  429. content: '';
  430. width: 50%;
  431. height: 88rpx;
  432. background: linear-gradient(180deg, #2A7EFB 0%, #F5F5F5 100%);
  433. left:0;
  434. bottom: 0;
  435. }
  436. &::before{
  437. position: absolute;
  438. content: '';
  439. width: 50%;
  440. height: 88rpx;
  441. background: linear-gradient(180deg, #01ABF8 0%, #F5F5F5 100%);
  442. right:0;
  443. bottom: 0;
  444. }
  445. }
  446. .list{
  447. width: 710rpx;
  448. background-color: #fff;
  449. border-radius: 24rpx;
  450. margin: -96rpx auto 0 auto;
  451. position: relative;
  452. font-family: PingFang SC, PingFang SC;
  453. color: #333333;
  454. padding: 32rpx 24rpx 40rpx 24rpx;
  455. .title{
  456. margin-bottom: 40rpx;
  457. .name{
  458. font-size: 30rpx;
  459. font-weight: 600;
  460. }
  461. .tip{
  462. font-size: 26rpx;
  463. font-weight: 400;
  464. color: #999999;
  465. .iconfont {
  466. font-size: 22rpx;
  467. margin-left: 4rpx;
  468. }
  469. }
  470. }
  471. .listn{
  472. margin-top: 52rpx;
  473. }
  474. .item {
  475. font-weight: 400;
  476. &~.item{
  477. margin-top: 52rpx;
  478. }
  479. .not{
  480. color: #999;
  481. }
  482. .iconfont {
  483. font-size: 26rpx;
  484. color: #999;
  485. margin-left: 6rpx;
  486. }
  487. .info{
  488. color: #999999;
  489. width: 465rpx;
  490. text-align: right;
  491. }
  492. .add{
  493. font-size: 24rpx;
  494. color: #2A7EFB;
  495. .iconfont {
  496. margin-right: 8rpx;
  497. color: #2A7EFB;
  498. }
  499. }
  500. .labelList{
  501. margin-top: 12rpx;
  502. .label{
  503. border: 1px solid #2A7EFB;
  504. border-radius: 20rpx;
  505. font-size: 20rpx;
  506. color: #2A7EFB;
  507. padding: 4rpx 16rpx;
  508. margin-right: 16rpx;
  509. margin-top: 16rpx;
  510. }
  511. }
  512. }
  513. }
  514. .property{
  515. width: 710rpx;
  516. background-color: #fff;
  517. border-radius: 24rpx;
  518. margin: 20rpx auto;
  519. font-family: PingFang SC, PingFang SC;
  520. .title{
  521. font-size: 30rpx;
  522. font-family: PingFang SC, PingFang SC;
  523. font-weight: 600;
  524. color: #333333;
  525. padding: 32rpx 24rpx 2rpx 24rpx;
  526. margin-bottom: 32rpx;
  527. }
  528. .info{
  529. margin: 0 26rpx;
  530. .item{
  531. width: 50%;
  532. font-size: 28rpx;
  533. font-weight: 400;
  534. color: #999999;
  535. padding: 10rpx 40rpx 40rpx 18rpx;
  536. &~.item{
  537. border-left: 1px solid #EEEEEE;
  538. padding-left: 40rpx;
  539. padding-right: 14rpx;
  540. }
  541. .bottom{
  542. margin-top: 20rpx;
  543. .num{
  544. font-size: 30rpx;
  545. font-weight: 600;
  546. color: #333333;
  547. }
  548. .give{
  549. font-size: 24rpx;
  550. font-weight: 400;
  551. color: #2A7EFB;
  552. padding-left: 40rpx;
  553. }
  554. }
  555. .icon-ic_rightarrow{
  556. font-size: 26rpx;
  557. padding: 6rpx 0 6rpx 40rpx;
  558. }
  559. }
  560. &~.info{
  561. border-top: 1px solid #EEEEEE;
  562. .item{
  563. padding-top: 40rpx;
  564. }
  565. }
  566. }
  567. }
  568. }
  569. </style>