From 8f248ec3baee6e59f438f77f908a003d2c19b24a Mon Sep 17 00:00:00 2001 From: "tianyi@bogon" Date: Sat, 28 Oct 2023 23:45:47 +0800 Subject: [PATCH] denglu --- pages/index/addHangOrder.vue | 159 ++++++++++++++++++---------- pages/login/login.vue | 197 +++++++++++++++++++---------------- 2 files changed, 210 insertions(+), 146 deletions(-) diff --git a/pages/index/addHangOrder.vue b/pages/index/addHangOrder.vue index 9c0b099..a04d2f7 100644 --- a/pages/index/addHangOrder.vue +++ b/pages/index/addHangOrder.vue @@ -2,19 +2,17 @@ @@ -105,6 +102,7 @@ choose: false, isChoose: false, clock: 60, // 倒计时 + shopList: [] } }, computed: mapState(['type']), @@ -127,8 +125,8 @@ this.captchaId = res.result this.captchaImg = this.tui.interfaceUrl() + '/common/captcha/draw/' + this .captchaId - }else{ - this.tui.toast(res.message) + } else { + this.tui.toast(res.message) } }).catch((res) => {}) }, @@ -137,9 +135,8 @@ }, //登录 goLogin() { - let data = {} - console.log(this.loginWay) - console.log(this.wayValue) + let data = {}, + loginUrl='' if (this.loginWay) { //true data = { username: this.username, @@ -148,45 +145,62 @@ captchaId: this.captchaId, saveLogin: true, type: this.wayValue - } + } + loginUrl='/auth/login' } else { data = { - phone:this.phone, + phone: this.phone, code: this.code, saveLogin: true, type: this.wayValue - } + } + loginUrl='/auth/smsLogin' } - this.tui.request("/auth/login", "POST", data, true, true).then((res) => { + this.tui.request(loginUrl, "POST", data, true, true).then((res) => { if (res.code == 200) { uni.setStorageSync("hiver_token", res.result.accessToken) let state = { token: res.result.accessToken } this.login(state) - this.getUserInfo().then((type) => { - console.log('this.type', type) - if (type == 2) { - setTimeout(() => { - uni.reLaunch({ - // url: '/pages/index/logistics' - url: '/pages/other/custom' - }) - }, 200) - } else { - setTimeout(() => { - uni.reLaunch({ - url: '/pages/index/index' - // url: '/pages/index/logistics' - }) - }, 200) - } - }) - //多店铺的时候,在这里加上打开店铺选择弹窗 - this.toggle("center"); - //end - this.tui.toast('登录成功', 2000, true) + //多店铺的时候,在这里加上打开店铺选择弹窗 + if (res.result.shopList.length > 1 && this.wayValue == 0) { + this.shopList = res.result.shopList; + this.toggle("center"); + } else if (this.wayValue == 1) { //物流公司登录 + setTimeout(() => { + uni.reLaunch({ + url: '/pages/index/logistics' + }) + }, 200) + this.tui.toast('登录成功', 2000, true) + } else { //下游客户登录 + setTimeout(() => { + uni.reLaunch({ + url: '/pages/other/custom' + }) + }, 200) + this.tui.toast('登录成功', 2000, true) + } + } else { + this.tui.toast(res.message) + } + }).catch((res) => {}) + }, + //多店铺的时候点击选择需要登录的店铺 + checkShop(id) { + this.tui.request("/app/sale/delById", "POST", { + id: id + }, false, false).then((res) => { + if (res.code == 200) { + setTimeout(() => { + uni.reLaunch({ + url: '/pages/index/index' + // url: '/pages/index/logistics' + }) + }, 200) + this.tui.toast('登录成功', 2000, true) } else { this.tui.toast(res.message) return @@ -199,16 +213,16 @@ this.choose = true this.setTime() this.tui.request("/common/captcha/sendLoginSms/" + this.phone, "GET", { - type:this.wayValue + type: this.wayValue }).then((res) => { if (res.code == 200) { uni.showToast({ title: "发送成功", icon: 'success' }) - }else{ - this.tui.toast(res.message) - } + } else { + this.tui.toast(res.message) + } }).catch((res) => {}) } else if (reg(this.phone, this.clock) && this.isChoose == true) { console.log('通过了') @@ -248,11 +262,11 @@ uni.navigateTo({ url: '/pages/common/protocol/protocol' }) - }, - //打开弹出层 - toggle(type) { - this.type = type - this.$refs.popup.open(type) + }, + //打开弹出层 + toggle(type) { + this.type = type + this.$refs.popup.open(type) }, } } @@ -337,40 +351,41 @@ .code-box { display: flex; - } - .popup-content { - align-items: center; - justify-content: center; - padding: 15px; - width: 500rpx; - height: auto; - background-color: #fff; - } - - .popup-title { - font-size: 36rpx; - font-weight: bold; - text-align: center; - position: relative; - } - - .popup-container { - margin-top: 20rpx; - height: 100rpx; - border-radius: 10px; - background: #088FEB; - line-height: 100rpx; - text-align: center; - border-bottom: 1px solid #eee; - border-top: 1px solid #eee; - color: #fff; - } - - .phone-btn { - width: 150rpx; - height: 75rpx; - color: #088FEB; - line-height: 75rpx; - font-size: 26rpx; + } + + .popup-content { + align-items: center; + justify-content: center; + padding: 15px; + width: 500rpx; + height: auto; + background-color: #fff; + } + + .popup-title { + font-size: 36rpx; + font-weight: bold; + text-align: center; + position: relative; + } + + .popup-container { + margin-top: 20rpx; + height: 100rpx; + border-radius: 10px; + background: #088FEB; + line-height: 100rpx; + text-align: center; + border-bottom: 1px solid #eee; + border-top: 1px solid #eee; + color: #fff; + } + + .phone-btn { + width: 150rpx; + height: 75rpx; + color: #088FEB; + line-height: 75rpx; + font-size: 26rpx; } \ No newline at end of file