You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
2.3 KiB
Vue

11 months ago
<template>
<div style="background-image: url(../../static/image/login/ju554@3x.png);width: 100vw;height: 100vh;overflow: hidden">
<tm-message ref="toast"></tm-message>
<tm-sheet style="height: 92%">
11 months ago
<tm-images style="margin-top: 90rpx" :width="300" :src="info.goodsInfo.picUrl"></tm-images>
11 months ago
<div style="display: flex;justify-content: center;align-items: center;margin-top: 90rpx">{{info.goodsInfo.goodsName}}</div>
<div style="display: flex;justify-content: center;align-items: center;margin-top: 90rpx">借用人 {{userInfo.nickName}}</div>
11 months ago
<div style="margin-top: 200rpx;display: flex;flex-direction: column;align-items: center">
<tm-button @click="borrowMe" v-if="info.goodsInfo.currentPosition!==info.userName" style="margin-bottom: 100rpx" :round="24" size="g">
11 months ago
确认借用
</tm-button>
11 months ago
<tm-button v-if="info.goodsInfo.status===1" @click="returnMe" :round="24" size="g"></tm-button>
11 months ago
</div>
</tm-sheet>
</div>
</template>
<script>
import {borrowApi, getInfo, returnApi} from "../../http/mine";
export default {
name: "index",
data() {
return {
userInfo:uni.getStorageSync('userInfo'),
11 months ago
info: {goodsInfo:{picUrl:'',goodsName:'',nickName:''}},
11 months ago
show: false,
}
},
mounted() {
console.log(this.userInfo,'this.userInfo')
this.getData()
},
methods: {
async borrowMe(){
const data = {
11 months ago
"borrowInfoUid": uni.getStorageSync('uid')
11 months ago
}
const res= await borrowApi(data)
if (res.code===200){
11 months ago
this.getData()
11 months ago
this.$refs.toast.show({model:'success',label:'借用成功'})
}
},
async returnMe(){
const data = {
11 months ago
"borrowInfoUid": uni.getStorageSync('uid')
11 months ago
}
const res= await returnApi(data)
if (res.code===200){
11 months ago
this.getData()
11 months ago
this.$refs.toast.show({model:'success',label:'归还成功'})
}
},
async getData() {
const data = {
11 months ago
"borrowInfoUid": uni.getStorageSync('uid')
11 months ago
}
const res = await getInfo(data)
if (res.code === 200) {
this.info = res.data
11 months ago
}else {
this.$refs.toast.show({model:'warn',label:res.msg,wait:99999})
11 months ago
}
console.log(res, 'getData')
},
send() {
}
}
}
</script>
<style scoped lang="scss">
</style>