Files
frontend-app/pages/contract/index.vue
T
2025-08-13 11:32:04 +08:00

92 lines
1.8 KiB
Vue

<template>
<view class="content">
<TopSafe></TopSafe>
<Header title="我的合同" />
<view class="contract-view">
<ContractItem :type="obj && obj.state"
:text="obj && obj.signatureName"
:time="obj && obj.time"
class="mt-24" @click="onBtn"></ContractItem>
</view>
<DownPopup></DownPopup>
</view>
</template>
<script>
import { getUserInfo } from '@/api/auth.js';
import Header from '@/components/common/header.vue';
import TopSafe from '@/components/common/top-safe.nvue'
import ContractItem from './components/contract-item.vue'
import DownPopup from '@/components/common/down-popup.vue';
import { getContractList,signContract } from '@/api/contract.js'
import func from '@/utils/func.js';
export default {
components: { Header,TopSafe,ContractItem,DownPopup },
data() {
return {
type:false,
obj:null
};
},
onShow() {
this.init();
},
methods: {
init(){
// this.isSignContract()
this.getSignContract()
},
isSignContract(){
signContract().then(res=>{
if(res.bizcode == 100){
this.type = res.data;
}else{
this.$refs.uToastRef.show({
type: 'error',
message: res.msg,
});
}
})
},
getSignContract(){
getContractList().then(res=>{
if(res.bizcode == 100){
this.obj = res.data[0];
this.obj.time = func.formatDate(new Date(res.data[0].signatureTime),3)
}else{
this.$refs.uToastRef.show({
type: 'error',
message: res.msg,
});
}
})
},
onBtn(){
if(this.type){
//查看
uni.navigateTo({
url:`/pages/contract/check`
})
}else{
//去签署
}
}
}
}
</script>
<style lang="scss" scoped>
.contract-view{
width:100%;
height:calc(100% - 88rpx - var(--status-bar-height));
display: flex;
flex-direction: column;
align-items: center;
overflow-y: auto;
padding: 0 32rpx;
box-sizing: border-box;
}
</style>