From 112e2bd2764dd96e1b81439a01882769100b92c1 Mon Sep 17 00:00:00 2001
From: 陶杰 <1378534974@qq.com>
Date: 星期五, 13 十二月 2024 11:04:00 +0800
Subject: [PATCH] 1.子账号相关修改

---
 sub_pages/supplier/sub-account/sub-account-reg.vue |   35 ++++++++++++++++++++++++++++++++++-
 1 files changed, 34 insertions(+), 1 deletions(-)

diff --git a/sub_pages/supplier/sub-account/sub-account-reg.vue b/sub_pages/supplier/sub-account/sub-account-reg.vue
index 7b4d524..39d3bef 100644
--- a/sub_pages/supplier/sub-account/sub-account-reg.vue
+++ b/sub_pages/supplier/sub-account/sub-account-reg.vue
@@ -28,7 +28,7 @@
 						<u--input type="password" v-model="userInfo.password" border="none" placeholder="请输入密码" clearable></u--input>
 					</u-form-item>
 					<u-form-item required label="账号状态" prop="isEnabled" borderBottom>
-						<u-switch v-model="userInfo.isEnabled" size="50"></u-switch>
+						<u-switch v-model="userInfo.isEnabled" size="50" @change="handleSwitchchange"></u-switch>
 					</u-form-item>
 				</u--form>
 				<u-button type="primary" text="提交" customStyle="margin-top: 50px" @click="submit"></u-button>
@@ -269,6 +269,39 @@
 			
 		},
 
+		async handleSwitchchange(e){
+			if(this.userInfo.id){
+				// 账号的启用,禁用
+				const {
+					code,data
+				} = await this.$http.request('get', '/api/supplierSub/page/isEnable', {
+					params: {
+						id:this.userInfo.id
+					}
+				})
+				if (code == 0) {
+					uni.$u.toast('状态修改成功!');
+				} else {
+					this.userInfo.isEnabled=!e
+					uni.$u.toast('状态修改失败!');
+				}
+				// 还是需要将状态信息重新获取下
+				// const {code2,data2} =await this.getSubAccountById()
+				// if(code2==0){
+				// 	this.userInfo.isEnabled=data2.isEnabled
+				// }
+			}
+		},
+
+		async getSubAccountById(){
+			return await this.$http.request('get', '/api/supplierSub/getById', {
+				params: {
+					id:this.userInfo.id
+				}
+			})
+			
+		},
+
 	},
 }
 </script>

--
Gitblit v1.9.3