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}}
</view>
</view>
<view class="choice common" @tap="buyshow=true">
<view class="choice common" @tap="buyshowtrue">
<view class="selected">
已选
</view>
@ -51,7 +51,7 @@
<!-- <image v-for="(item,index) in info" :src="item.image" mode=""></image> -->
</view>
<view class="Purchasecolumn">
<view class="buy" @tap="buyshow=true">
<view class="buy" @tap="buyshowtrue">
立即购买
</view>
</view>
@ -237,6 +237,27 @@
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() {
var that = this
@ -529,27 +550,32 @@
this.baseurl = baseurl
this.usershow = false
this.goodsDetailsinfo(this.goodsInfoId)
goodPatientInfo(this.updata.patientId).then(res => {
var user = res.data.filter(e => e.id == this.userid)
if (user.length >= 1) {
// user[0].address = user[0].provinceName + user[0].cityName + user[0].regionName + user[0]
// .streetName + user[0].receiveAddress
this.updata.receiver = user[0].receiveName
this.updata.receiveAddress = user[0].areaName + user[0].receiveAddress
this.updata.phone = user[0].receivePhone
this.userid = user[0].id
} else {
// res.data.forEach(e => {
// e.address = e.provinceName + e.cityName + e.regionName + e.streetName + e
// .receiveAddress
// })
this.updata.receiver = res.data[0].receiveName
// 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
}
})
const value = uni.getStorageSync('patientId');
if (value) {
goodPatientInfo(value).then(res => {
if (res.code == 200) {
var user = res.data.filter(e => e.id == this.userid)
if (user.length >= 1) {
// user[0].address = user[0].provinceName + user[0].cityName + user[0].regionName + user[0]
// .streetName + user[0].receiveAddress
this.updata.receiver = user[0].receiveName
this.updata.receiveAddress = user[0].areaName + user[0].receiveAddress
this.updata.phone = user[0].receivePhone
this.userid = user[0].id
} else {
// res.data.forEach(e => {
// e.address = e.provinceName + e.cityName + e.regionName + e.streetName + e
// .receiveAddress
// })
this.updata.receiver = res.data[0].receiveName
// 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
uni.$on('updata', function(data) {
that.updata = JSON.parse(data.updata)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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