From c29a4c8f6022e6cd5ff92d499c8db829c8c471aa Mon Sep 17 00:00:00 2001
From: doum <doum>
Date: 星期三, 11 二月 2026 09:51:50 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

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

diff --git a/mini-program/pages/login/login.vue b/mini-program/pages/login/login.vue
index da2f3d8..8c69f69 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,97 @@
 </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.checkShopLogin()
+		},
+		methods:{
+		    async checkShopLogin(){
+				var that =this
+				console.log("shopInfo",this.shopInfo)
+				console.log("shopToken",this.shopToken)
+				
+				console.log("openid",this.openid)
+				if( this.shopInfo !=null && this.shopInfo.id!=null && (this.shopToken!=null &&this.shopToken!='')){
+					//楠岃瘉token鏄惁鏈夋晥
+					let res = await that.$u.api.getShopInfo({tokenType:1  })
+					if (res.code === 200) {
+						await that.$store.commit('setShopInfo', res.data) 
+						that.jumpShopIndex()
+					}
+				}else if( this.openid !=null && this.openid !=''){
+					//浼樺厛闈欓粯鐧婚檰
+					let res = await that.$u.api.shopOpenidLogin(this.form)
+					if (res.code === 200 && res.shop!=null && res.token!=null) {
+						await that.$store.commit('setShopInfo', res.data.shop)
+						await that.$store.commit('setShopToken', res.data.token)
+						that.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
+				}
+				var that =this
+				this.$u.api.shopPasswordLogin(this.form)
+					.then(res => {
+						if (res.code === 200) { 
+							that.$store.commit('setShopInfo', res.data.shop)
+							that.$store.commit('setShopToken', res.data.token)
+							that.jumpShopIndex()
+						}
+					})
+			},
+			jumpShopIndex() {
+				uni.navigateTo({
+					url: '/pages/distributor/distributor'
+				})
+			}
 		}
 	}
 </script>

--
Gitblit v1.9.3