shizhongqi 3 месяцев назад
Родитель
Сommit
4aee55936b
2 измененных файлов с 96 добавлено и 2 удалено
  1. 92 2
      hdApp/src/admin/member/detail.vue
  2. 4 0
      hdApp/src/api/custom/index.js

+ 92 - 2
hdApp/src/admin/member/detail.vue

@@ -10,12 +10,18 @@
             <view class="user-name-row" @click="changeNameFn()">
               <text class="user-name">{{ data.name }}</text> 
               <i class="iconfont iconbianji edit-icon"></i>
+              <view
+                class="vip-tag"
+                :class="Number(data.vip) == 1 ? 'vip-active' : 'vip-inactive'"
+                @click.stop="openVipPopup"
+              >{{ Number(data.vip) == 1 ? 'VIP' : '非VIP' }}</view>
             </view>
             <view class="user-detail-info">
               <text class="user-real-name">{{ data.originName }}</text>
               <text class="user-id">ID {{ data.id }}</text>
             </view>
           </view>
+
           <view class="member-level-badge" v-if="Number(data.member)>0">
             <view class="member-badge-row">
               <image v-if="data.member == 1" class="member-badge-icon" style="width:76upx;height:76upx;" src="@/static/member-icons/member-1.svg" mode="aspectFit"></image>
@@ -420,6 +426,21 @@
       </template>
     </modal-module>
 
+    <modal-module :show="vipModal" @click="vipModalClick" :maskClosable="false" title="VIP设置" padding="28rpx 28rpx" >
+      <template v-slot:content>
+        <view class="app-modal-input-wrap">
+          <view class="vip-switch-row">
+            <text class="vip-switch-label">{{ vipForm.vip == 1 ? 'VIP' : '非VIP' }}</text>
+            <switch
+              style="transform:scale(0.7,0.7)"
+              :checked="vipForm.vip == 1"
+              @change="vipSwitchChange"
+            />
+          </view>
+        </view>
+      </template>
+    </modal-module>
+
 		<modal-module :show="changeShow" @click="confirmChange" :maskClosable="true" title="修改名称" padding="30rpx 30rpx" >
 		<template v-slot:content>
 			<view class="app-modal-input-wrap">
@@ -505,7 +526,7 @@ import ModalModule from "@/components/plugin/modal";
 import { getLevel } from "@/utils/config";
 import TuiListCell from "@/components/plugin/list-cell";
 import { getUserDet, remarkAdd, remarkDel, upgrade, resetPassword } from "@/api/member";
-import { changeName,changeMemberLevel,modifyBirthday,updateBuyAmount } from "@/api/custom"
+import { changeName,changeMemberLevel,modifyBirthday,updateBuyAmount,changeVip } from "@/api/custom"
 import { getLevelInitData } from "@/api/member"
 import {toManRecharge} from "@/api/recharge"
 import {deductBalance} from "@/api/deduct"
@@ -565,7 +586,11 @@ export default {
       rechargeInputFocus: false,
       showBalanceDetail: false,
       memberLevelSet:0,
-      memberLevelData:[]
+      memberLevelData:[],
+      vipModal: false,
+      vipForm: {
+        vip: 0
+      }
     };
   },
   computed: {
@@ -855,6 +880,30 @@ export default {
         }
       }
     },
+    openVipPopup() {
+      this.vipForm.vip = Number(this.data.vip) || 0
+      this.vipModal = true
+    },
+    vipSwitchChange(e) {
+      this.vipForm.vip = e.detail.value ? 1 : 0
+    },
+    vipModalClick(e) {
+      if (e.index === 0) {
+        this.vipModal = false
+        return
+      }
+      this._changeVip()
+    },
+    _changeVip() {
+      changeVip({ customId: this.data.id, vip: this.vipForm.vip }).then(res => {
+        if (res.code == 1) {
+          this.$msg(res.msg)
+          this.vipModal = false
+          this.getCustomInfo()
+        }
+      })
+      this.vipModal = false
+    },
     changeBirthday() {
       // 初始化生日数据
       this.lunar = this.data.lunar || 0;
@@ -956,6 +1005,33 @@ export default {
             margin-left: 16upx;
             color: #999;
           }
+
+          .vip-tag {
+            position: relative;
+            right: 0;
+            top: 12upx;
+            flex-shrink: 0;
+            display: inline-flex;
+            align-items: center;
+            justify-content: center;
+            height: 40upx;
+            padding: 0 18upx;
+            color: #fff;
+            font-size: 24upx;
+            font-weight: bold;
+            border-radius: 20upx;
+            line-height: 1;
+            white-space: nowrap;
+            margin-left: auto;
+
+            &.vip-active {
+              background-color: rgba(58, 218, 9, 0.76);
+            }
+
+            &.vip-inactive {
+              background-color: #bbb;
+            }
+          }
         }
         
         .user-detail-info {
@@ -1257,6 +1333,20 @@ export default {
     }
   }
 }
+  .vip-switch-row {
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    padding: 30upx 20upx;
+
+    .vip-switch-label {
+      font-size: 32upx;
+      color: #333;
+      font-weight: 500;
+      margin-right: 80upx;
+    }
+  }
+
    .user_tag{
     border:1px solid #CCCCCC;
     padding:5upx 12upx 5upx 12upx;

+ 4 - 0
hdApp/src/api/custom/index.js

@@ -51,4 +51,8 @@ export const getVisit = data => {
 
 export const updateBuyAmount = data => {
 	return https.post('/custom/update-buy-amount', data)
+}
+
+export const changeVip = data => {
+	return https.post('/custom/change-vip', data)
 }