uni-item-manage/pages/borrow/index.vue

74 lines
2.2 KiB
Vue
Raw Normal View History

2023-10-18 07:52:41 +00:00
<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%">
<tm-images style="margin-top: 90rpx" width="300" :src="info.goodsInfo.picUrl"></tm-images>
<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>
<div style="margin-top: 400rpx;display: flex;flex-direction: column;align-items: center">
<tm-button @click="borrowMe" v-if="info.goodsInfo.currentPosition!==info.userName" style="margin-bottom: 100rpx" theme="bg-gradient-red-accent" :round="24" size="g">
确认借用
</tm-button>
<tm-button v-if="info.goodsInfo.status===1" @click="returnMe" theme="bg-gradient-red-accent" :round="24" size="g">确认归还</tm-button>
</div>
</tm-sheet>
</div>
</template>
<script>
import {borrowApi, getInfo, returnApi} from "../../http/mine";
export default {
name: "index",
data() {
return {
userInfo:uni.getStorageSync('userInfo'),
info: {},
show: false,
}
},
mounted() {
console.log(this.userInfo,'this.userInfo')
this.getData()
},
methods: {
async borrowMe(){
const data = {
"borrowInfoUid": "8b09da87-e4c4-4ad2-9518-2db84a8fc954"
}
const res= await borrowApi(data)
if (res.code===200){
this.$refs.toast.show({model:'success',label:'借用成功'})
}
},
async returnMe(){
const data = {
"borrowInfoUid": "8b09da87-e4c4-4ad2-9518-2db84a8fc954"
}
const res= await returnApi(data)
if (res.code===200){
this.$refs.toast.show({model:'success',label:'归还成功'})
}
console.log(res,'returnMe')
},
async getData() {
const data = {
"borrowInfoUid": "8b09da87-e4c4-4ad2-9518-2db84a8fc954"
}
const res = await getInfo(data)
if (res.code === 200) {
this.info = res.data
}
console.log(res, 'getData')
},
send() {
}
}
}
</script>
<style scoped lang="scss">
</style>