shish 3 лет назад
Родитель
Сommit
3940bf5f6a
2 измененных файлов с 58 добавлено и 9 удалено
  1. 54 9
      hdApp/src/admin/member/detail.vue
  2. 4 0
      hdApp/src/api/custom/index.js

+ 54 - 9
hdApp/src/admin/member/detail.vue

@@ -5,9 +5,8 @@
         <app-avatar-module :src="data.avatarUrl" />
         <div class="user-top-right">
           <div>
-            <div class="flex-center">
-                <span class="app-size-32">{{ data.name }}</span>
-            </div>
+            <div class="flex-center"> <span class="app-size-32">{{ data.name }}</span> <text @click="changeNameFn()" style="color:#3385ff;margin-left:32upx;font-size:30upx;">修改</text></div>
+            <div class="app-color-3">{{ data.originName }}</div>
             <div class="app-color-3">ID:{{ data.id }}</div>
           </div>
           <div class="source-wrap">
@@ -169,6 +168,18 @@
 
     <modal-module :show="promptRemarkModal" @cancel="modalCancel" @click="promptModalClick" :content="promptModalText" color="#333" :size="32" padding="30upx 30upx" ></modal-module>
 
+		<modal-module :show="changeShow" @click="confirmChange" :maskClosable="true" title="修改名称" padding="30rpx 30rpx" >
+		<template v-slot:content>
+			<div class="app-modal-input-wrap">
+			<div class="inp-list-line">
+				<div class="line-input">
+				<input type="text" style="width:61%;text-align:center;" :focus="changeFocus" v-model="customName" class="inp-input" />
+				</div>
+			</div>
+			</div>
+		</template>
+		</modal-module>
+
   </div>
 </template>
 
@@ -180,6 +191,7 @@ import ModalModule from "@/components/plugin/modal";
 import { getLevel } from "@/utils/config";
 import TuiListCell from "@/components/plugin/list-cell";
 import { getUserDet, remarkAdd, remarkDel, upgrade, rechargeB, resetPassword } from "@/api/member";
+import { changeName } from "@/api/custom"
 export default {
   name: "detail",
   components: {
@@ -266,7 +278,10 @@ export default {
       orderMoreStatus: false,
       // 确认操作提示
       promptRemarkModal: false,
-      promptModalText: "是否要删除该备注?"
+      promptModalText: "是否要删除该备注?",
+      customName:'',
+      changeShow:false,
+      changeFocus:false
     };
   },
   computed: {
@@ -274,6 +289,36 @@ export default {
   },
   onLoad() {},
   methods: {
+		changeNameFn(){
+			this.customName = this.data.name
+			this.changeShow = true
+			setTimeout(x => {
+				this.$nextTick(() => this.setFocus());
+			}, 200);
+		},
+		setFocus() {
+			this.changeFocus = true
+		},
+		confirmChange(val) {
+			let that=this;
+			if (val.index == 0) {
+				that.changeShow = false
+				that.changeFocus = false
+				return
+			}
+      if(this.$util.isEmpty(this.customName)){
+        this.$msg('请填写名称')
+        return false
+      }
+      changeName({name:this.customName,id:this.data.id}).then(res=>{
+        that.changeShow = false
+				that.changeFocus = false
+        if(res.code == 1){
+          that.$msg(res.msg)
+          that.getCustomInfo()
+        }
+      })
+    },
     callUp(phone) {
       uni.makePhoneCall({
         phoneNumber: phone
@@ -283,10 +328,10 @@ export default {
       this.userTagModal = true;
     },
     init() {
-      this._getCustomDet();
+      this.getCustomInfo();
       getLevel();
     },
-    _getCustomDet() {
+    getCustomInfo() {
       getUserDet({ userId: this.option.id }).then(res => {
         if (this.$util.isEmpty(res.data)) {
           return false;
@@ -302,7 +347,7 @@ export default {
         userId: this.data.id,
         ...this.rechargeForm
       }).then(res => {
-        this._getCustomDet();
+        this.getCustomInfo();
         this.$msg("充值成功!");
         this.modalCancel();
       });
@@ -332,14 +377,14 @@ export default {
       }).then(res => {
         this.$msg("添加成功!");
         this.modalCancel();
-        this._getCustomDet();
+        this.getCustomInfo();
       });
     },
     _delRemark() {
       remarkDel({ id: this.remarkOperateData.id }).then(res => {
         this.$msg("删除成功!");
         this.modalCancel();
-        this._getCustomDet();
+        this.getCustomInfo();
       });
     },
     orderMoreFn() {

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

@@ -2,4 +2,8 @@ import https from '@/plugins/luch-request_0.0.7/request'
 
 export const batchAddCumtom = data => {
 	return https.post('/custom/batch-add-custom', data)
+}
+
+export const changeName = data => {
+	return https.get('/custom/change-name', data)
 }