Procházet zdrojové kódy

商户登录修改

hxl13994548489 před 1 rokem
rodič
revize
45617a321e
8 změnil soubory, kde provedl 382 přidání a 189 odebrání
  1. 9 0
      api/api.js
  2. 22 0
      common/util/event-bus.js
  3. 15 0
      common/util/throttle.js
  4. 3 2
      main.js
  5. 1 0
      pages/index/index.vue
  6. 155 84
      pages/login/login.vue
  7. 149 93
      pages/login/settled.vue
  8. 28 10
      store/index.js

+ 9 - 0
api/api.js

@@ -9,6 +9,15 @@ const apiService = {
 		// return http.get('/merchant/app/loginPassWord',params)	
 		return http.get('/merchant/app/loginPassWord?password='+passWord+'&username='+username +'&userType=2')	
 	},
+	/**
+	 *
+	 * 新的登录
+	 */
+	loginNew(phone,code) {
+		// return http.get('/merchant/app/loginPassWord',params)
+		return http.get('/merchant/app/checkCode/login?phone='+phone+'&code='+code +'&userType=2')
+	},
+
 	/**
 	  * 手机号码登录
 	  */

+ 22 - 0
common/util/event-bus.js

@@ -0,0 +1,22 @@
+// 创建时间总线
+const eventBus = {
+    events: {},
+    on(event, callback) {
+        if (!this.events[event]) {
+            this.events[event] = [];
+        }
+        this.events[event].push(callback);
+    },
+    emit(event, data) {
+        if (this.events[event]) {
+            this.events[event].forEach(callback => callback(data));
+        }
+    },
+    off(event, callback) {
+        if (this.events[event]) {
+            this.events[event] = this.events[event].filter(cb => cb !== callback);
+        }
+    }
+};
+
+export default eventBus;

+ 15 - 0
common/util/throttle.js

@@ -0,0 +1,15 @@
+export const throttle = {
+    inserted(el, binding) {
+        let timer = null;
+        const delay = binding.arg || 500; // 默认 500ms
+
+        el.addEventListener('click', () => {
+            if (timer) return;
+
+            timer = setTimeout(() => {
+                binding.value(); // 执行绑定的函数
+                timer = null;
+            }, delay);
+        });
+    }
+};

+ 3 - 2
main.js

@@ -10,8 +10,9 @@ import configService from'./common/service/config.service.js'
 import router from './common/router'
 import {RouterMount} from './plugin/uni-simple-router/index.js'
 
-
-
+import { throttle } from'./common/util/throttle.js'
+//节流组件
+Vue.directive('throttle', throttle);
 //引入mescroll插件
 import MescrollBody from "@/components/mescroll-uni/mescroll-body.vue"
 import MescrollUni from "@/components/mescroll-uni/mescroll-uni.vue"

+ 1 - 0
pages/index/index.vue

@@ -149,6 +149,7 @@
 			uni.getStorage({
 				key: 'login_user_info',
 				success: function (res) {
+          console.log(res)
 					that.name = res.data.merchantName
 					that.merchantId = res.data.merchantId
           that.gettodayData()

+ 155 - 84
pages/login/login.vue

@@ -14,11 +14,17 @@
 				<view class="box-user flex align-center " :class="[shape == 'round' ? 'round' : '']">
 					<!-- <view class="title"><text class="cuIcon-people margin-right-xs"></text>手机号:</view> -->
 					<image src="../../static/login/Frame (27).png" mode='aspectFit' class="zai-logo "></image>
-					<input placeholder="请输入手机号" name="input" v-model="userName"></input>
+					<input placeholder="请输入手机号" name="input" v-model="phoneNo"></input>
 				</view>
-				<view class="box-user flex align-center" :class="[shape == 'round' ? 'round' : '']">
-					<!-- <view class="title"><text class="cuIcon-lock margin-right-xs"></text>密码:</view>
-						<input class="uni-input" placeholder="请输入密码" :password="!showPassword" v-model="password" /> -->
+        <view class="box-user flex align-center"  :class="[shape=='round'?'round':'']">
+          <image src="../../static/login/Frame (28).png" mode='aspectFit' class="zai-logo"></image>
+          <input class="uni-input" placeholder="请输入验证码" v-model="smsCode"/>
+          <view class="action">
+            <text class="text-color" :disabled="!isSendSMSEnable" @click="onSMSSend"> {{ getSendBtnText }}</text>
+          </view>
+        </view>
+       <!--   注释掉密码登录   add by hxl  2025-07-16  -->
+				<!--<view class="box-user flex align-center" :class="[shape == 'round' ? 'round' : '']">
 					<image src="../../static/login/Frame (26).png" mode='aspectFit' class="zai-logo "></image>
 					<input placeholder="请输入密码" :password="!showPassword" v-model="password"></input>
 					<view class="action text-lg">
@@ -26,16 +32,19 @@
 							@click="changePassword"></text>
 					</view>
 				</view>
+				-->
 				<view style="margin-top: 216upx;">
 					<button class="cu-btn round lg  bg-blue " style="display: flex;" :loading="loading"
 						:class="[shape == 'round' ? 'round' : '']" @tap="onLogin"><text
-							space="emsp">{{ loading ? "登录中..." : " 登录"}}</text>
+							space="emsp">{{ loading ? "登录中..." : " 登录/注册"}}</text>
 					</button>
 				</view>
-				<view class="foote" style="display: flex;align-items: center;margin-top: 40rpx;justify-content: center;">
+       <!--  去掉注册和忘记密码  add by hxl  2025-07-16       -->
+				<!--<view class="foote" style="display: flex;align-items: center;margin-top: 40rpx;justify-content: center;">
 					<view class="text-color" @tap="nav('register')" style="margin-right: 53rpx;">去注册</view>
 					<text style="" @tap="nav('resetpassword')">忘记密码</text>
 				</view>
+				-->
 				<view class="flex align-center"
 					style="margin-top:154rpx;color: #858585;font-size:26rpx;justify-content: center;">
 					<uni-data-checkbox multiple :localdata="sex" v-model="checked" active-color="#FF852D "
@@ -66,8 +75,24 @@
 			</image>
 			<view class="gray-text">登录中...</view>
 		</view>
+    <u-popup  v-model="addShow" mode="center" :round="20" >
+      <view class="popup-contents-add">
+        <view class="tit-center">
+          <text>{{msg}}</text>
+        </view>
+        <view class="tit tit-bottom">
+          <u-line></u-line>
+          <view>
+            <u-button  size="small" shape="square" class="cancel-btn"
+                       @click="closePage()">取消</u-button>
+            <u-button  size="small" shape="square" class="btn"
+                      @click="makePhoneCall()" v-if="type==='2'" >联系客服</u-button>
+            <u-button  size="small" shape="square"  class="btn" @click="toLoginDown()" v-if="type==='1'">去注册</u-button>
+          </view>
+        </view>
+      </view>
+    </u-popup>
 	</view>
-
 </template>
 
 <script>
@@ -81,12 +106,17 @@
 	} from "vuex"
 	import configService from '@/common/service/config.service.js';
 	import appUpdate from "@/components/yzhua006-update/app-update.vue"; //app更新组件
+  import eventBus from '@/common/util/event-bus.js';
 	export default {
 		components: {
 			appUpdate
 		},
 		data() {
 			return {
+        msg:'',
+        type:'',
+        addShow:false,
+        phoneMsg:'',//手机信息
 				sex: [{
 					text: '',
 					value: 1
@@ -122,7 +152,11 @@
 				that.version = wgtinfo.version
 			});
 			// #endif
+      eventBus.on('openPage', this.openPage);
 		},
+    onUnload() {
+      eventBus.off('openPage', this.openPage);
+    },
 		beforeCreate() {
 			setTimeout(() => {
 				this.$refs.app_update.update(); //调用子组件检查更新方法
@@ -144,10 +178,10 @@
 				}
 			},
 			canSMSLogin() {
-				return this.userName.length > 4 && this.smsCode.length > 4;
+				return this.phoneNo.length > 4 && this.smsCode.length > 4;
 			},
 			canPwdLogin() {
-				return this.userName.length > 4 && this.password.length > 4;
+				return this.phoneNo.length > 4 && this.password.length > 4;
 			},
 		},
 		methods: {
@@ -167,19 +201,19 @@
 					this.$tip.toast('请阅读后勾选并同意《平台协议》及《隐私协议》政策');
 					return;
 				}
-				if (!this.userName || this.userName.length == 0) {
+				if (!this.phoneNo || this.phoneNo.length == 0) {
 					this.$tip.toast('请填写手机号');
 					return;
 				}
-				if (!this.password || this.password.length == 0) {
-					this.$tip.toast('请填写码');
+				if (!this.smsCode || this.smsCode.length == 0) {
+					this.$tip.toast('请填写验证码');
 					return;
 				}
 				let loginParams = {
-					username: this.userName,
-					passWord: this.password,
+          phone: this.phoneNo,
+					code: this.smsCode,
 				}
-				this.loading = true;
+				//this.loading = true;
 
 				this.mLogin(loginParams).then((res) => {
 					this.loading = false;
@@ -208,8 +242,6 @@
 				})
 			},
 			saveClientId() {
-				// 	var info = plus.push.getClientInfo();
-				// 	var cid = info.clientid;
 				var randomNum = new Date().getTime();
 				this.$http.get("/sys/user/saveClientId", {
 					params: {
@@ -227,9 +259,6 @@
 				this.showPassword = !this.showPassword;
 			},
 			onSMSSend() {
-				// let smsParams = {};
-				// smsParams.phone=this.phoneNo;
-				// smsParams.smsmode="0";
 				let checkPhone = new RegExp(/^[1]([3-9])[0-9]{9}$/);
 				if (!this.phoneNo || this.phoneNo.length == 0) {
 					this.$tip.toast('请输入手机号');
@@ -239,9 +268,9 @@
 					this.$tip.toast('请输入正确的手机号');
 					return false
 				}
-				this.$http.get("/merchant/app/sendMsg", {
+				this.$http.get("/merchant/app/merLogin/send/code", {
 					params: {
-						phone: this.phoneNo
+            phone: this.phoneNo
 					}
 				}).then(res => {
 					if (res.data.success) {
@@ -261,68 +290,40 @@
 					}
 				}, 1000);
 			},
-			onSMSLogin() {
-				let checkPhone = new RegExp(/^[1]([3-9])[0-9]{9}$/);
-
-				if (!this.phoneNo || this.phoneNo.length == 0) {
-					this.$tip.toast('请填写手机号');
-					return;
-				}
-				if (!checkPhone.test(this.phoneNo)) {
-					this.$tip.toast('请输入正确的手机号');
-					return false
-				}
-				if (!this.smsCode || this.smsCode.length == 0) {
-					this.$tip.toast('请填短信验证码');
-					return;
-				}
-				if (!this.checked || this.checked.length == 0) {
-					this.$tip.toast('请阅读后勾选并同意《平台协议》及《隐私协议》政策');
-					return;
-				}
-				let loginParams = {
-					mobile: this.phoneNo,
-					captcha: this.smsCode
-				};
-				this.$http.get("/merchant/app/checkCode", {
-					params: {
-						phone: this.phoneNo,
-						code: this.smsCode
-					}
-				}).then(res => {
-					if (res.data.success) {
-						this.nav('settled')
-						// this.$tip.success('登录成功!')
-						// this.$Router.replaceAll({name:'index'})
-					} else {
-						this.$tip.error(res.data.message);
-					}
-				}).catch((err) => {
-					let msg = ((err.response || {}).data || {}).message || err.data.message || "请求出现错误,请稍后再试"
-					this.$tip.error(msg);
-				});
-				// this.PhoneLogin(loginParams).then((res) => {
-				//   console.log("res====》",res)
-				//   if(res.data.success){
-				// 	// this.$tip.success('登录成功!')
-				// 	// this.$Router.replaceAll({name:'index'})
-				//   }else{
-				// 	this.$tip.error(res.data.message);
-				//   }
-				// }).catch((err) => {
-				//   let msg = ((err.response || {}).data || {}).message || err.data.message || "请求出现错误,请稍后再试"
-				//   this.$tip.error(msg);
-				// });
-			},
-			loginSuccess() {
-				// 登陆成功,重定向到主页
-				this.$Router.replace({
-					name: 'index'
-				})
-			},
-			requestFailed(err) {
-				this.$message.warning("登录失败")
-			},
+      //关闭页面
+      closePage(){
+        this.loading = false;
+        this.addShow = false;
+        this.msg = "";
+        this.type = "";
+      },
+      //打开页面
+      openPage(data){
+        this.loading = false;
+        this.addShow = true;
+        this.msg = data.msg;
+        this.type = data.type;
+      },
+      //打电话
+      makePhoneCall() {
+        uni.makePhoneCall({
+          phoneNumber: '40088888888',
+          success: () => {
+            console.log('拨打电话成功')
+          },
+          fail: (err) => {
+            console.log('拨打电话失败', err)
+            uni.showToast({
+              title: '拨打电话失败',
+              icon: 'none'
+            })
+          }
+        })
+      },
+      //跳转到下载页面
+      toLoginDown(){
+        window.location.href = configService.apiUrl + '/downloadApp/download.html';
+      },
 		},
 		beforeDestroy() {
 			if (this.smsCountInterval) {
@@ -437,4 +438,74 @@
 	.zai-btn.button-hover {
 		transform: translate(1upx, 1upx);
 	}
+  .popup-contents-add {
+    width: 600rpx;
+    height: 350rpx;
+    display: flex;
+    align-items: center;
+    flex-direction: column;
+    >view {
+      width: 100%;
+    }
+
+    >view.tit {
+      height: 100rpx;
+      display: flex;
+      align-items: center;
+      flex-direction: column;
+      justify-content: space-around;
+      padding: 0 20rpx;
+      box-sizing: border-box;
+
+      text {
+        padding-top: 20rpx;
+        box-sizing: border-box;
+        font-size: 40rpx;
+        font-weight: 600;
+      }
+    }
+
+    .tit-center {
+      flex: 1;
+      display: flex;
+      flex-direction: column;
+      align-items: center;
+      justify-content: center;
+      text {
+        padding: 10rpx;
+        box-sizing: border-box;
+        font-size: 28rpx;
+        font-weight: 400;
+      }
+    }
+
+    .tit-bottom {
+      >view {
+        display: flex;
+        align-items: center;
+        justify-content: space-between;
+        gap: 16rpx;
+      }
+    }
+
+    >view.tit-bottom {
+      padding: 0;
+    }
+  }
+  .btn {
+    border-radius: 50rpx;
+    width: 200rpx;
+    background-color: #0081ff;
+    color: #ffffff;
+    padding: 10rpx 20rpx;
+    text-align: center;
+    box-sizing: border-box;
+  }
+  .cancel-btn {
+    border-radius: 50rpx;
+    width: 200rpx;
+    padding: 10rpx 20rpx;  // 上下左右内边距
+    text-align: center;  // 文字居中
+    box-sizing: border-box;  // 确保内边距不会增加按钮总尺寸
+  }
 </style>

+ 149 - 93
pages/login/settled.vue

@@ -272,7 +272,7 @@
 		<view v-if="tab == 3" class="padding flex sub-bottom">
 			<button class="cu-btn round line-blue  shadow" @click="tab = 2">{{ title == '申请入驻' ? '上一步' : '上一页'
                 }}</button>
-			<button style="margin-left: 12upx;width:77%" class="cu-btn bg-blue round " @click="sumbit">提交审核</button>
+			<button style="margin-left: 12upx;width:77%" class="cu-btn bg-blue round "  v-throttle="sumbit">提交审核</button>
 		</view>
 		<view class="cu-load load-modal" v-if="lodingshow">
 			<image src="/static/logo.png" mode="aspectFit"></image>
@@ -291,6 +291,8 @@
 	import regionPicker from "../../components/w-picker/region-picker.vue"
 	// import aMap from "./map.vue"
 	import status from "../store/components/status.vue"
+  import {ACCESS_TOKEN, USER_INFO} from "@/common/util/constants";
+  import * as $p from "@/uni_modules/uni-easyinput/components/uni-easyinput/common";
 
 	export default {
 		components: {
@@ -327,6 +329,7 @@
 					headPhoto: '',
 					passWord: uni.getStorageSync('password'),
 					phone: uni.getStorageSync('phone'),
+          ordinaryUserId:null,
 				},
 				formName: {
 					name: '姓名',
@@ -356,6 +359,7 @@
 				// }]
 				markers: [],
 				headPhotoImg: [],
+        loginType:'',
 			}
 		},
 		watch: {
@@ -370,67 +374,79 @@
 		},
 		onShow() {
 			this.getCurrentLocation();
-			// this.setDefaultLocation()
-			// uni.getStorage({
-			// 	key: 'currentAddress',
-			// 	success: function(res) {
-			// 		console.log(res);
-			// 		let temp = res.data.location.split(',')
-			// 		this.latitude = temp[1];
-			// 		this.longitude = temp[0];
-
-
-			// 		this.marker = [{
-			// 			id: 0,
-			// 			latitude: temp[1],
-			// 			longitude: temp[0],
-			// 			title: res.data.name,
-			// 			iconPath: '../../static/boiaoji.png',
-			// 			width: 30,
-			// 			height: 30
-			// 		}];
-			// 		console.log(this.marker)
-			// 	}
-			// });
-			// let currentaddress = uni.getStorageSync('currentAddress')
-			// console.log(currentaddress)
-
-
-
-
-
 			this.markers = uni.getStorageSync('address') ? [Object.assign(uni.getStorageSync('address'), {
 				iconPath: '../../static/boiaoji.png'
 			})] : []
 
 		},
 		async onLoad(data) {
-
+      if (data.loginType){
+        // data.loginType =2  需要根据merchantId查询商户临时数据
+        // data.loginType =3  不需要回显
+        console.log(data.loginType)
+        this.loginType = data.loginType;
+        if(data.loginType === '2') {
+          this.$http.post('/merchant/examine/new/info/temporary', {
+            "merchantId": data.merchantId
+          }).then(res => {
+            if (res.data.code == 200) {
+              this.form = {
+                id: data.merchantId,
+                ordinaryUserId: data.ordinaryUserId,
+                name: data.name,
+                type: res.data.result.type == null ? null : res.data.result.type + '',
+                corporateName: !res.data.result.corporateName ? null : res.data.result.corporateName,
+                creditCode: !res.data.result.creditCode ? null : res.data.result.creditCode,
+                lifespanType: !res.data.result.lifespanType ? null : res.data.result.lifespanType,
+                lifespanBegin: !res.data.result.lifespanBegin ? null : res.data.result.lifespanBegin,
+                lifespanEnd: !res.data.result.lifespanEnd ? null : res.data.result.lifespanEnd,
+                businessLicense: !res.data.result.businessLicense ? null : res.data.result.businessLicense,
+                legalPerson: !res.data.result.legalPerson ? null : res.data.result.legalPerson,
+                legalPersonCode: !res.data.result.legalPersonCode ? null : res.data.result.legalPersonCode,
+                storeName: !res.data.result.storeName ? null : res.data.result.storeName,
+                country: !res.data.result.country ? null : res.data.result.country,
+                locality: !res.data.result.locality ? null : res.data.result.locality,
+                address: !res.data.result.address ? null : res.data.result.address,
+                headPhoto: !res.data.result.headPhotoList ? [] : res.data.result.headPhotoList,
+                passWord: data.passWord,
+                phone: data.phone,
+              }
+              this.markers = res.data.result.longitude && res.data.result.latitude ? [{
+                longitude: res.data.result.longitude,
+                latitude: res.data.result.latitude,
+                iconPath: '../../static/boiaoji.png'
+              }] : []
+              this.businessLicenseImg = !res.data.result.businessLicense ? null : configService.apiUrl + '/' + res.data.result.businessLicense;
+              this.identityOneImg = !res.data.result.identityOne ? null : configService.apiUrl + '/' + res.data.result.identityOne;
+              this.identityTwoImg = !res.data.result.identityTwo ? null : configService.apiUrl + '/' + res.data.result.identityTwo;
+              this.headPhotoImg = res.data.result.headPhotoList ? res.data.result.headPhotoList.split(',').filter(id => id !== '') : []
+            }
+          });
+        }else if(data.loginType === '3') {
+          this.form.ordinaryUserId =data.ordinaryUserId;
+          this.form.name = data.name;
+          this.form.passWord =data.passWord;
+          this.form.phone  =data.phone;
+        }
+      }
 			if (data.params) {
 				let obj = JSON.parse(decodeURIComponent(data.params));
-				this.title = '店铺信息'
-				this.tab = 2
-				obj.lifespanType = obj.lifespanType ? obj.lifespanType : '1'
-				this.markers = this.form.longitude && this.form.latitude ? [{
-					longitude: this.form.longitude,
-					latitude: this.form.latitude,
-					iconPath: '../../static/boiaoji.png'
-				}] : []
-				this.businessLicenseImg = configService.apiUrl + '/' + obj.businessLicense
-				this.identityOneImg = configService.apiUrl + '/' + obj.identityOne
-				this.headPhotoImg = obj.headPhoto ? obj.headPhoto.split(',').filter(id => id !== '') : []
-				obj.headPhoto = obj.headPhoto ? obj.headPhoto.split(',').filter(id => id !== '') : []
-				this.identityTwoImg = configService.apiUrl + '/' + obj.identityTwo
-				obj.locality = obj.locality ? obj.locality : ''
-				this.form = obj
+          this.title = '店铺信息'
+          this.tab = 2
+          obj.lifespanType = obj.lifespanType ? obj.lifespanType : '1'
+          this.markers = this.form.longitude && this.form.latitude ? [{
+            longitude: this.form.longitude,
+            latitude: this.form.latitude,
+            iconPath: '../../static/boiaoji.png'
+          }] : []
+          this.businessLicenseImg = configService.apiUrl + '/' + obj.businessLicense
+          this.identityOneImg = configService.apiUrl + '/' + obj.identityOne
+          this.headPhotoImg = obj.headPhoto ? obj.headPhoto.split(',').filter(id => id !== '') : []
+          obj.headPhoto = obj.headPhoto ? obj.headPhoto.split(',').filter(id => id !== '') : []
+          this.identityTwoImg = configService.apiUrl + '/' + obj.identityTwo
+          obj.locality = obj.locality ? obj.locality : ''
+          this.form = obj
 			}
-			// let res = await this.$http.get("/merchant/app/allList")
-			// if (res.data.success) {
-			//     this.supplierOption = res.data.result
-			// } else {
-			//     this.$tip.toast(res.data.message);
-			// }
-
 		},
 		methods: {
 			getCurrentLocation() {
@@ -716,45 +732,86 @@ this.$forceUpdate();
 			},
 			sumbit() {
 				if (this.title == '申请入驻') {
-					for (let j in this.form) {
-						console.log(j)
-						console.log(this.form[j])
-						console.log(this.formName[j])
-						if (!this.form[j]) {
-							if (this.form['lifespanType'] == 2 && (this.form['lifespanBegin'] == null || this.form['lifespanEnd'] ==
-									null)) {
-								this.$tip.alert('请选择日期!')
-								return
-							}
-							if (this.form['businessLicense'] == null) {
-								this.$tip.alert('请上传营业执照!')
-								return
-							}
-							if (this.formName[j]) {
-								this.$tip.alert(`请填写${this.formName[j]}!`)
-								return
-							}
-
-
-						}
-					}
-					let data = {
-						...this.form,
-						source: 2,
-						headPhoto: Array.isArray(this.form.headPhoto) ? this.form.headPhoto.join(',') : this.form.headPhoto,
-						longitude: this.markers.length > 0 ? this.markers[0].longitude : '',
-						latitude: this.markers.length > 0 ? this.markers[0].latitude : ''
-					}
-					this.$http.post('/merchant/app/add', data).then(res => {
-						if (res.data.success) {
-							this.$tip.success(res.data.result || '成功')
-							this.$Router.push({
-								name: "login"
-							})
-						} else {
-							this.$tip.error(res.data.message);
-						}
-					})
+          if(this.loginType){
+            if(this.loginType === '2'){
+              //商户临时用户回显 ,修改
+              let data = {
+                ...this.form,
+                source: 2,
+                headPhoto: Array.isArray(this.form.headPhoto) ? this.form.headPhoto.join(',') : this.form.headPhoto,
+                longitude: this.markers.length > 0 ? this.markers[0].longitude : '',
+                latitude: this.markers.length > 0 ? this.markers[0].latitude : ''
+              }
+              console.log(this.form.headPhoto, 88);
+              this.$http.post('/merchant/localMerchantInfo/edit/new', data).then(res => {
+                if (res.data.success) {
+                  //放入session
+                  const result = res.data.result
+                  const userInfo = result.userInfo
+                  uni.setStorageSync(ACCESS_TOKEN,result.token);
+                  uni.setStorageSync(USER_INFO,userInfo);
+                  this.$store.commit('SET_TOKEN', result.token)
+                  this.$store.commit('SET_NAME', { username: userInfo.username,realname: userInfo.realname})
+                  this.$store.commit('SET_AVATAR', userInfo.avatar)
+                  this.$tip.success('登录成功!')
+                  this.$Router.replaceAll({
+                    name: 'index'
+                  })
+                } else {
+                  this.$tip.error(res.data.message);
+                }
+              })
+            }else if(this.loginType === '3'){
+              //普通用户没有商户新增
+              for (let j in this.form) {
+                console.log(j)
+                console.log(this.form[j])
+                console.log(this.formName[j])
+                if (!this.form[j]) {
+                  if (this.form['lifespanType'] == 2 && (this.form['lifespanBegin'] == null || this.form['lifespanEnd'] ==
+                      null)) {
+                    this.$tip.alert('请选择日期!')
+                    return
+                  }
+                  if (this.form['businessLicense'] == null) {
+                    this.$tip.alert('请上传营业执照!')
+                    return
+                  }
+                  if (this.formName[j]) {
+                    this.$tip.alert(`请填写${this.formName[j]}!`)
+                    return
+                  }
+
+
+                }
+              }
+              let data = {
+                ...this.form,
+                source: 2,
+                headPhoto: Array.isArray(this.form.headPhoto) ? this.form.headPhoto.join(',') : this.form.headPhoto,
+                longitude: this.markers.length > 0 ? this.markers[0].longitude : '',
+                latitude: this.markers.length > 0 ? this.markers[0].latitude : ''
+              }
+              this.$http.post('/merchant/app/add', data).then(res => {
+                if (res.data.code==200) {
+                  //放入session
+                  const result = res.data.result
+                  const userInfo = result.userInfo
+                  uni.setStorageSync(ACCESS_TOKEN,result.token);
+                  uni.setStorageSync(USER_INFO,userInfo);
+                  this.$store.commit('SET_TOKEN', result.token)
+                  this.$store.commit('SET_NAME', { username: userInfo.username,realname: userInfo.realname})
+                  this.$store.commit('SET_AVATAR', userInfo.avatar)
+                  this.$tip.success('登录成功!')
+                  this.$Router.replaceAll({
+                    name: 'index'
+                  })
+                } else {
+                  this.$tip.error(res.data.message);
+                }
+              })
+            }
+          }
 				} else {
 					let data = {
 						...this.form,
@@ -764,7 +821,6 @@ this.$forceUpdate();
 						latitude: this.markers.length > 0 ? this.markers[0].latitude : ''
 					}
 					console.log(this.form.headPhoto, 88);
-
 					this.$http.post('/merchant/localMerchantInfo/edit', data).then(res => {
 						if (res.data.success) {
 							this.$tip.success(res.data.result || '成功')

+ 28 - 10
store/index.js

@@ -3,7 +3,7 @@ import Vuex from 'vuex'
 import api from "@/api/api"
 import MinCache from'@/common/util/MinCache.js'
 import { ACCESS_TOKEN,USER_NAME,USER_INFO,X_TENANT_ID } from "@/common/util/constants"
-
+import eventBus from '@/common/util/event-bus.js';
 Vue.use(Vuex)
 
 export default new Vuex.Store({
@@ -34,18 +34,36 @@ export default new Vuex.Store({
     // 登录
     mLogin({ commit }, param) {
       return new Promise((resolve, reject) => {
-       api.login(param.passWord,param.username).then(response => {
+       api.loginNew(param.phone,param.code).then(response => {
           if(response.data.code ==200){ 
             const result = response.data.result
             const userInfo = result.userInfo
-            uni.setStorageSync(ACCESS_TOKEN,result.token);
-            uni.setStorageSync(USER_INFO,userInfo);
-            commit('SET_TOKEN', result.token)
-            commit('SET_AVATAR', userInfo.avatar)
-            commit('SET_NAME', { username: userInfo.username,realname: userInfo.realname})
-            resolve(response)
-          }else{
-            resolve(response)
+            if (userInfo.userState === '1'){
+              uni.setStorageSync(ACCESS_TOKEN,result.token);
+              uni.setStorageSync(USER_INFO,userInfo);
+              commit('SET_TOKEN', result.token)
+              commit('SET_AVATAR', userInfo.avatar)
+              commit('SET_NAME', { username: userInfo.username,realname: userInfo.realname})
+              resolve(response)
+            }else{
+              console.log(8888888888888888)
+              uni.navigateTo({
+                url: `/pages/login/settled?loginType=`+userInfo.userState+'&merchantId='+userInfo.merchantId+'&passWord='+userInfo.passWord
+                   +'&name='+userInfo.name +'&ordinaryUserId='+userInfo.ordinaryUserId+'&phone='+userInfo.phone
+              });
+            }
+          }else if(response.data.code == 501) {
+            const msgParams ={
+              msg: '当前手机号用户不存在,请先下载掌柜生活APP注册。',
+              type: "1"
+            }
+            eventBus.emit('openPage',msgParams);
+          }else if (response.data.code == 502){
+            const msgParams ={
+              msg: '账号异常,请联系客服解除异常。',
+              type: "2",
+            }
+            eventBus.emit('openPage',msgParams);
           }
         }).catch(error => {
 			console.log("catch===>response",response)