From fa6202debd1e940f9f779c86d9d3084c7c7b5e83 Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期二, 10 二月 2026 12:00:00 +0800
Subject: [PATCH] 经销商管理

---
 mini-program/pages/login/login.vue |   84 +++++++++++++++++++++++++++++++++++++++---
 1 files changed, 78 insertions(+), 6 deletions(-)

diff --git a/mini-program/pages/login/login.vue b/mini-program/pages/login/login.vue
index da2f3d8..391c0ef 100644
--- a/mini-program/pages/login/login.vue
+++ b/mini-program/pages/login/login.vue
@@ -8,19 +8,19 @@
 				<view class="icon">
 					<image src="/static/icon/login_ic_phone@2x.png" mode="widthFix"></image>
 				</view>
-				<input type="number" maxlength="11" placeholder="璇疯緭鍏ユ墜鏈哄彿" />
-				<text>鑾峰彇楠岃瘉鐮�</text>
+				<input :focus='focus' @blur="focus=false" type="text" v-model="form.userName" placeholder="璇疯緭鍏ョ櫥褰曡处鍙�" />
 			</view>
 			<view class="login-list-item">
 				<view class="icon">
 					<image src="/static/icon/login_ic_password@2x.png" mode="widthFix"></image>
 				</view>
-				<input type="safe-password" placeholder="璇疯緭鍏ュ瘑鐮�" />
+				<input :focus='focus1' @blur="focus1=false"    type="safe-password" v-model="form.password" placeholder="璇疯緭鍏ュ瘑鐮�" />
 			</view>
 		</view>
-		<view class="login-btn">绔嬪嵆鐧诲綍</view>
+		<view class="login-btn" @click="submitDo">绔嬪嵆鐧诲綍</view>
 		<view class="login-info">
-			<image src="/static/icon/ic_agree@2x.png" mode="widthFix"></image>
+			<image src="/static/icon/ic_agree@2x.png" v-if="!radio" @click="changeRadio()" mode="widthFix"></image>
+			<image src="/static/icon/ic_agree_sel@2x.png" v-if="radio" @click="changeRadio()"  mode="widthFix"></image>
 			<view class="login-info-text">
 				鎴戝凡闃呰骞跺悓鎰�<text>銆婇紟鍏冪鎶�鐢ㄦ埛鏈嶅姟鍗忚銆�</text>鍙�<text>銆婇紟鍏冪鎶�鐢ㄦ埛闅愮鏀跨瓥銆�</text>
 			</view>
@@ -29,11 +29,83 @@
 </template>
 
 <script>
+import { mapState } from 'vuex'
 	export default {
+		computed: {
+			...mapState(['shopInfo', 'shopToken','openid'])
+		},
 		data() {
 			return {
-				
+				focus:false,
+				focus1:false,
+				loading:false,
+				form:{
+					userName:'',
+					password:'',
+					openid:'',
+					memberId:''
+				},
+				radio:false
 			};
+		},
+		onShow() {
+			this.focus=false
+			this.focus1=false
+			this.form.openid=this.openid
+			this.checkLogin()
+		},
+		methods:{
+			checkLogin(){
+				if( !this.shopInfo && !this.shopToken){
+					let res = await that.$u.api.getUserInfo()
+					if (res.code === 200) {
+						await that.$store.commit('setUserInfo', res.data)
+						await that.$store.commit('setOpenId', res.data.openId)
+						this.jumpShopIndex()
+					}
+				}
+			},
+			changeRadio(){
+				this.radio = !this.radio
+			},
+			submitDo(){
+				if(!this.form.userName){
+					uni.showToast({
+						'title': '璇疯緭鍏ョ櫥褰曡处鍙�',icon:'none'
+					})
+					this.focus=true
+					this.loading=false
+					return
+				}
+				if(!this.form.password){
+					uni.showToast({
+						'title': '璇疯緭鍏ョ櫥褰曞瘑鐮�',icon:'none'
+					})
+					this.focus1=true
+					this.loading=false
+					return
+				}
+				if(!this.radio){
+					uni.showToast({
+						'title': '璇峰厛浠旂粏闃呰骞跺悓鎰忕敤鎴峰崗璁拰闅愮鏀跨瓥',icon:'none'
+					})
+					this.loading=false
+					return
+				}
+				this.$u.api.shopPasswordLogin(this.form)
+					.then(res => {
+						if (res.code === 200) { 
+							await that.$store.commit('setShopInfo', res.data.member)
+							await that.$store.commit('setShopToken', res.data.token)
+							this.jumpShopIndex()
+						}
+					})
+			},
+			jumpShopIndex() {
+				uni.navigateTo({
+					url: '/pages/distributor/distributor'
+				})
+			}
 		}
 	}
 </script>

--
Gitblit v1.9.3