This commit is contained in:
曹辉 2023-02-24 17:19:57 +08:00
parent 74f7935c16
commit 5778b6e68b
8 changed files with 65 additions and 63 deletions

View File

@ -12,7 +12,7 @@
{{goodsPrice}} {{goodsPrice}}
</view> </view>
</view> </view>
<view class="choice common" @tap="buyshow=true"> <view class="choice common" @tap="buyshowtrue">
<view class="selected"> <view class="selected">
已选 已选
</view> </view>
@ -51,7 +51,7 @@
<!-- <image v-for="(item,index) in info" :src="item.image" mode=""></image> --> <!-- <image v-for="(item,index) in info" :src="item.image" mode=""></image> -->
</view> </view>
<view class="Purchasecolumn"> <view class="Purchasecolumn">
<view class="buy" @tap="buyshow=true"> <view class="buy" @tap="buyshowtrue">
立即购买 立即购买
</view> </view>
</view> </view>
@ -237,6 +237,27 @@
url: '/pages/information/information' url: '/pages/information/information'
}) })
}, },
buyshowtrue() {
var that = this
const value = uni.getStorageSync('openid');
const value2 = uni.getStorageSync('patientId');
if (value && value2) {
that.buyshow = true
} else {
that.$refs.uToast.show({
title: '未登录,请先登录',
type: 'error'
})
if (that.timer) {
clearTimeout(that.timer)
}
that.timer = setTimeout(e => {
uni.navigateTo({
url: '/pages/login/login'
})
}, 1000)
}
},
// //
tapbuy() { tapbuy() {
var that = this var that = this
@ -529,27 +550,32 @@
this.baseurl = baseurl this.baseurl = baseurl
this.usershow = false this.usershow = false
this.goodsDetailsinfo(this.goodsInfoId) this.goodsDetailsinfo(this.goodsInfoId)
goodPatientInfo(this.updata.patientId).then(res => { const value = uni.getStorageSync('patientId');
var user = res.data.filter(e => e.id == this.userid) if (value) {
if (user.length >= 1) { goodPatientInfo(value).then(res => {
// user[0].address = user[0].provinceName + user[0].cityName + user[0].regionName + user[0] if (res.code == 200) {
// .streetName + user[0].receiveAddress var user = res.data.filter(e => e.id == this.userid)
this.updata.receiver = user[0].receiveName if (user.length >= 1) {
this.updata.receiveAddress = user[0].areaName + user[0].receiveAddress // user[0].address = user[0].provinceName + user[0].cityName + user[0].regionName + user[0]
this.updata.phone = user[0].receivePhone // .streetName + user[0].receiveAddress
this.userid = user[0].id this.updata.receiver = user[0].receiveName
} else { this.updata.receiveAddress = user[0].areaName + user[0].receiveAddress
// res.data.forEach(e => { this.updata.phone = user[0].receivePhone
// e.address = e.provinceName + e.cityName + e.regionName + e.streetName + e this.userid = user[0].id
// .receiveAddress } else {
// }) // res.data.forEach(e => {
this.updata.receiver = res.data[0].receiveName // e.address = e.provinceName + e.cityName + e.regionName + e.streetName + e
// this.updata.receiveAddress = res.data[0].address // .receiveAddress
this.updata.receiveAddress = res.data[0].areaName + res.data[0].receiveAddress // })
this.updata.phone = res.data[0].receivePhone this.updata.receiver = res.data[0].receiveName
this.userid = res.data[0].id // this.updata.receiveAddress = res.data[0].address
} this.updata.receiveAddress = res.data[0].areaName + res.data[0].receiveAddress
}) this.updata.phone = res.data[0].receivePhone
this.userid = res.data[0].id
}
}
})
} else {}
let useritem = null let useritem = null
uni.$on('updata', function(data) { uni.$on('updata', function(data) {
that.updata = JSON.parse(data.updata) that.updata = JSON.parse(data.updata)

View File

@ -22,29 +22,7 @@
data() { data() {
return {}; return {};
}, },
onLoad() { onLoad() {},
var that = this
try {
const value = uni.getStorageSync('openid');
const value3 = uni.getStorageSync('token');
if (value && value3) {
const value2 = uni.getStorageSync('patientId');
if (value2) {} else {
uni.navigateTo({
url: '/pages/login/login'
})
}
} else {
uni.navigateTo({
url: '/pages/login/login'
})
}
} catch (e) {
uni.navigateTo({
url: '/pages/login/login'
})
}
},
methods: { methods: {
goorder() { goorder() {
var that = this var that = this
@ -106,7 +84,6 @@
uni.removeStorageSync('patientId'); uni.removeStorageSync('patientId');
uni.removeStorageSync('openid'); uni.removeStorageSync('openid');
uni.removeStorageSync('phone'); uni.removeStorageSync('phone');
uni.removeStorageSync('token');
uni.navigateTo({ uni.navigateTo({
url: '/pages/login/login' url: '/pages/login/login'
}) })
@ -136,6 +113,7 @@
<style lang="scss"> <style lang="scss">
.app { .app {
padding: 0; padding: 0;
.item { .item {
width: 94%; width: 94%;
margin: 20rpx auto 0; margin: 20rpx auto 0;
@ -143,6 +121,7 @@
position: relative; position: relative;
height: 100rpx; height: 100rpx;
border-radius: 5rpx; border-radius: 5rpx;
.title { .title {
position: absolute; position: absolute;
left: 150rpx; left: 150rpx;

View File

@ -74,18 +74,10 @@
}, },
onShow() { onShow() {
var that = this var that = this
try { const value3 = uni.getStorageSync('Refresh');
const value = uni.getStorageSync('openid'); if (value3) {
const value3 = uni.getStorageSync('Refresh'); that.goodsListinfo();
if (value) {} else { }
uni.navigateTo({
url: '/pages/login/login'
})
}
if (value3) {
that.goodsListinfo();
}
} catch (e) {}
}, },
onLoad(options) { // onLoad(options) { //
if (options.title) { if (options.title) {

View File

@ -253,6 +253,7 @@
title: '请阅读用户协议并同意', title: '请阅读用户协议并同意',
type: 'error', type: 'error',
}) })
this.maskshow = true
} else { } else {
this.orderlist.orderCount = 1; this.orderlist.orderCount = 1;
this.orderlist.orderConsumableList = [] this.orderlist.orderConsumableList = []

View File

@ -29,7 +29,6 @@
onShow() { onShow() {
uni.removeStorageSync('openid'); uni.removeStorageSync('openid');
uni.removeStorageSync('patientId'); uni.removeStorageSync('patientId');
uni.removeStorageSync('token');
uni.removeStorageSync('phone'); uni.removeStorageSync('phone');
}, },
//1. //1.
@ -95,6 +94,7 @@
}) })
}, },
pwdlogin() { pwdlogin() {
uni.removeStorageSync('token');
var that = this var that = this
createMobileToken().then(res => { createMobileToken().then(res => {
uni.setStorageSync("token", res.data.token) uni.setStorageSync("token", res.data.token)

View File

@ -326,7 +326,7 @@
uni.navigateTo({ uni.navigateTo({
url: '/pages/login/login' url: '/pages/login/login'
}) })
}, 1500) }, 1000)
} }
} catch (e) { } catch (e) {
uni.navigateTo({ uni.navigateTo({

View File

@ -8,6 +8,9 @@
</template> </template>
<script> <script>
import {
createMobileToken
} from '@/api/login/index.js'
export default { export default {
data() { data() {
return {}; return {};
@ -31,6 +34,9 @@
} }
}, },
onShow() { onShow() {
createMobileToken().then(res => {
uni.setStorageSync("token", res.data.token)
})
setTimeout(() => { setTimeout(() => {
uni.reLaunch({ uni.reLaunch({
url: '/pages/homepage/homepage' url: '/pages/homepage/homepage'

View File

@ -138,7 +138,6 @@
uni.removeStorageSync('patientId'); uni.removeStorageSync('patientId');
uni.removeStorageSync('openid'); uni.removeStorageSync('openid');
uni.removeStorageSync('phone'); uni.removeStorageSync('phone');
uni.removeStorageSync('token');
that.$refs.uToast.show({ that.$refs.uToast.show({
title: '退出账号成功', title: '退出账号成功',
type: 'success', type: 'success',
@ -167,7 +166,6 @@
uni.removeStorageSync('openid'); uni.removeStorageSync('openid');
uni.removeStorageSync('phone'); uni.removeStorageSync('phone');
uni.removeStorageSync('Refresh'); uni.removeStorageSync('Refresh');
uni.removeStorageSync('token');
uni.navigateBack({ uni.navigateBack({
delta: 1 delta: 1
}) })