优化页面,优化请求脚本

This commit is contained in:
weipengfei 2023-07-25 10:02:10 +08:00
parent 3b7dddb86b
commit 7c068f5378
2 changed files with 285 additions and 280 deletions

View File

@ -15,44 +15,45 @@
</view> </view>
</view> </view>
</view> </view>
<view class="bottom"><uni-icons type="location"></uni-icons><text class="location">区域:{{company.address}}</text></view> <view class="bottom"><uni-icons type="location"></uni-icons><text
class="location">区域:{{company.address}}</text></view>
</view>
</block>
</view>
<view class="item" v-show="skeleton||contract.contract_no">
<u-skeleton :loading="skeleton" :animate="true" title rows="2" rows-width="100%" rowsHeight="56"></u-skeleton>
<block v-if="!skeleton">
<view class="title">电子合同</view>
<view class="card">
<view class="one">
<view class="info">
<view class="info_item">甲方{{contract.party_a_name}}</view>
<view class="info_item">乙方{{contract.party_b_name}}</view>
<view class="info_item">合同类型{{contract.contract_type_name}}</view>
<view class="info_item">合同编号{{contract.contract_no}}</view>
</view>
</view>
<u-line v-if="contract.contract_no" color="#999999FF" style="margin: 31rpx 0;"></u-line>
<view class="contract" v-if="contract.contract_no">
<view class="left">
<image class="contract_img" src="../../static/img/contract/pdf.png"></image>
<view class="text">
<view class="name">合同</view>
<view>
<!-- <text class="nickname">张郭郭</text> -->
<text>{{contract.create_time}}</text>
</view>
</view>
</view>
<view class="right" @click="naviTo(contract.contract_no)">
<!-- <image class="icon"></image> -->
<uni-icons type="paperclip" color="#3274F9"></uni-icons>
<view>查看</view>
</view>
</view>
</view> </view>
</block> </block>
</view> </view>
<view class="item" v-show="skeleton||contract.contract_no">
<u-skeleton :loading="skeleton" :animate="true" title rows="2" rows-width="100%" rowsHeight="56"></u-skeleton>
<block v-if="!skeleton">
<view class="title">电子合同</view>
<view class="card">
<view class="one">
<view class="info">
<view class="info_item">甲方{{contract.party_a_name}}</view>
<view class="info_item">乙方{{contract.party_b_name}}</view>
<view class="info_item">合同类型{{contract.contract_type_name}}</view>
<view class="info_item">合同编号{{contract.contract_no}}</view>
</view>
</view>
<u-line v-if="contract.contract_no" color="#999999FF" style="margin: 31rpx 0;"></u-line>
<view class="contract" v-if="contract.contract_no">
<view class="left">
<image class="contract_img" src="../../static/img/contract/pdf.png"></image>
<view class="text">
<view class="name">合同</view>
<view>
<!-- <text class="nickname">张郭郭</text> -->
<text>{{contract.create_time}}</text>
</view>
</view>
</view>
<view class="right" @click="naviTo(contract.contract_no)">
<!-- <image class="icon"></image> -->
<uni-icons type="paperclip" color="#3274F9"></uni-icons>
<view>查看</view>
</view>
</view>
</view>
</block>
</view>
<view class="item"> <view class="item">
<u-skeleton :loading="skeleton" :animate="true" title rows="2" rows-width="100%" rowsHeight="56"></u-skeleton> <u-skeleton :loading="skeleton" :animate="true" title rows="2" rows-width="100%" rowsHeight="56"></u-skeleton>
<block v-if="!skeleton"> <block v-if="!skeleton">
@ -72,31 +73,35 @@
</view> </view>
<view style="height: 32rpx;"></view> <view style="height: 32rpx;"></view>
<view class="one" v-for="(other, index) in company.other_contacts" :key="index"> <view class="one" v-for="(other, index) in company.other_contacts" :key="index">
<view v-if="other.name!=''"> <block v-if="other.name!=''">
<view class="linkman">其他联系人</view> <view class="linkman">其他联系人</view>
<view class="info"> <view class="info">
<view class="info_item">姓名{{other.name}}</view> <view class="info_item">姓名{{other.name}}</view>
<view class="info_item">职位{{other.position}}</view> <view class="info_item">职位{{other.position}}</view>
<view class="info_item">联系电话{{other.phone}}</view> <view class="info_item">联系电话{{other.phone}}</view>
<view class="info_item">邮箱{{other.email}}</view> <view class="info_item">邮箱{{other.email}}</view>
</view> </view>
</view> </block>
</view> </view>
</view> </view>
</block> </block>
</view> </view>
<view class="item" > <view class="item">
<u-skeleton :loading="skeleton" :animate="true" title rows="2" rows-width="100%" rowsHeight="56"></u-skeleton> <u-skeleton :loading="skeleton" :animate="true" title rows="2" rows-width="100%" rowsHeight="56"></u-skeleton>
<block v-if="!skeleton" > <block v-if="!skeleton">
<view class="title">资质信息</view> <view class="title">资质信息</view>
<view class="image_box" style="background-color: #fff;border-radius: 7px 7px 7px 7px;"> <view class="image_box" style="background-color: #fff;border-radius: 7px 7px 7px 7px;">
<image class="bottom" @click="priview(company.qualification.business_license)" :src="company.qualification.business_license" v-if="company.qualification.business_license"></image> <image class="bottom" @click="priview(company.qualification.business_license)"
<image class="bottom" @click="priview(company.qualification.business_licenseB)" :src="company.qualification.business_licenseB" v-if="company.qualification.business_licenseB"></image> :src="company.qualification.business_license" v-if="company.qualification.business_license"></image>
<image class="top" @click="priview(company.qualification.bank_account)" :src="company.qualification.bank_account" v-if="company.qualification.bank_account"></image> <image class="bottom" @click="priview(company.qualification.business_licenseB)"
<image class="top" @click="priview(company.qualification.bank_accountB)" :src="company.qualification.bank_accountB" v-if="company.qualification.bank_accountB"></image> :src="company.qualification.business_licenseB" v-if="company.qualification.business_licenseB"></image>
<image class="top" @click="priview(company.qualification.bank_account)"
</view> :src="company.qualification.bank_account" v-if="company.qualification.bank_account"></image>
<image class="top" @click="priview(company.qualification.bank_accountB)"
:src="company.qualification.bank_accountB" v-if="company.qualification.bank_accountB"></image>
</view>
</block> </block>
</view> </view>
</view> </view>
@ -106,18 +111,18 @@
import { contractView } from "@/api/contract.js" import { contractView } from "@/api/contract.js"
import { companyView } from "@/api/company.js" import { companyView } from "@/api/company.js"
import { download_file } from "@/api/junziqian.js" import { download_file } from "@/api/junziqian.js"
export default { export default {
name:"company", name: "company",
data() { data() {
return { return {
skeleton: true, skeleton: true,
company: { company: {
qualification: { qualification: {
bank_account:"", bank_account: "",
bank_accountB:"", bank_accountB: "",
business_license:"", business_license: "",
business_licenseB:"", business_licenseB: "",
}, },
}, },
contract: {}, contract: {},
@ -125,38 +130,38 @@
current: 1 current: 1
} }
}, },
props: ['id','type'], props: ['id', 'type'],
mounted() { mounted() {
this.initContract(this.$props.id, this.$props.type||null); this.initContract(this.$props.id, this.$props.type || null);
}, },
methods: { methods: {
naviTo(contract_no) { naviTo(contract_no) {
download_file({applyNo:contract_no}).then(res=>{ download_file({ applyNo: contract_no }).then(res => {
if(res.code!=1){ if (res.code != 1) {
Toast(res.msg) Toast(res.msg)
} }
uni.navigateTo({ uni.navigateTo({
url: `/subpkg/pdfView/pdfView?url=${res.data.url}` url: `/subpkg/pdfView/pdfView?url=${res.data.url}`
}) })
}) })
}, },
naviBack(){ naviBack() {
uni.navigateBack() uni.navigateBack()
}, },
async initContract(id, type="contract") { async initContract(id, type = "contract") {
let res; let res;
// //
if(id&&(type=="contract"||type==null)){ if (id && (type == "contract" || type == null)) {
res = await contractView({ id }); res = await contractView({ id });
} else{ } else {
if(id>0){ if (id > 0) {
res = await companyView({id}); res = await companyView({ id });
}else{ } else {
res = await companyView(); res = await companyView();
} }
} }
this.company = res.data.company; this.company = res.data.company;
this.user = res.data.user; this.user = res.data.user;
this.contract = res.data.contract; this.contract = res.data.contract;
@ -164,31 +169,31 @@
// console.log(res.data); // console.log(res.data);
}, },
// //
priview(url){ priview(url) {
uni.previewImage({ uni.previewImage({
urls:[url], urls: [url],
longPressActions: { longPressActions: {
itemList: ['保存图片'], itemList: ['保存图片'],
success: function(data) { success: function(data) {
if (data.tapIndex === 0) { if (data.tapIndex === 0) {
uni.saveImageToPhotosAlbum({ uni.saveImageToPhotosAlbum({
filePath: url, filePath: url,
success: function() { success: function() {
uni.showToast({ uni.showToast({
title: '保存成功', title: '保存成功',
icon: 'success' icon: 'success'
})
},
fail: function() {
uni.showToast({
title: '保存失败',
icon: 'none'
})
}
}) })
} },
fail: function() {
uni.showToast({
title: '保存失败',
icon: 'none'
})
}
})
} }
} }
}
}) })
} }
}, },
@ -196,197 +201,197 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.item { .item {
padding: 31.5rpx 28rpx; padding: 31.5rpx 28rpx;
.title { .title {
margin-bottom: 21rpx; margin-bottom: 21rpx;
font-size: 35rpx; font-size: 35rpx;
font-weight: 500; font-weight: 500;
color: #333333; color: #333333;
display: flex;
justify-content: space-between;
}
.card {
width: 694rpx;
// height: 231rpx;
padding: 28rpx;
background: #FFFFFF;
border-radius: 14rpx 14rpx 14rpx 14rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
.top {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
}
.left {
.card {
width: 694rpx;
// height: 231rpx;
padding: 28rpx;
background: #FFFFFF;
border-radius: 14rpx 14rpx 14rpx 14rpx;
display: flex;
flex-direction: column;
justify-content: space-between;
.top {
display: flex; display: flex;
justify-content: space-between;
image {
.left { width: 142rpx;
display: flex; height: 142rpx;
margin-right: 28rpx;
image { background: #CCCCCC;
width: 142rpx; border-radius: 14rpx 14rpx 14rpx 14rpx;
height: 142rpx; opacity: 1;
margin-right: 28rpx;
background: #CCCCCC;
border-radius: 14rpx 14rpx 14rpx 14rpx;
opacity: 1;
}
.text {
display: flex;
flex-direction: column;
justify-content: space-between;
.name {
font-size: 32rpx;
font-weight: 500;
color: rgba(0, 0, 0, 0.8);
}
.code {
font-size: 28rpx;
font-weight: 400;
color: #666666;
}
}
} }
.right { .text {
font-size: 28rpx; display: flex;
font-weight: 500; flex-direction: column;
color: #3274F9; justify-content: space-between;
.name {
font-size: 32rpx;
font-weight: 500;
color: rgba(0, 0, 0, 0.8);
}
.code {
font-size: 28rpx;
font-weight: 400;
color: #666666;
}
} }
} }
.bottom { .right {
display: flex; font-size: 28rpx;
align-items: center; font-weight: 500;
color: #666666FF; color: #3274F9;
margin-top: 32rpx;
.location {
margin-left: 8rpx;
}
}
.one {
.linkman {
height: 44rpx;
font-size: 32rpx;
font-weight: 500;
color: #333333;
margin-bottom: 28rpx;
}
.info {
font-size: 28rpx;
font-weight: 400;
color: #666666;
line-height: 45rpx;
}
}
.contract {
display: flex;
justify-content: space-between;
.left {
display: flex;
.contract_img {
width: 102rpx;
height: 102rpx;
background: #F5F5F5;
border-radius: 14rpx 14rpx 14rpx 14rpx;
margin-right: 21rpx;
}
.text {
display: flex;
flex-direction: column;
justify-content: space-between;
.name {
font-size: 32rpx;
;
font-weight: 500;
color: rgba(0, 0, 0, 0.8);
line-height: 35rpx;
}
.nickname {
margin-right: 35rpx;
}
text {
height: 39rpx;
font-size: 28rpx;
font-weight: 400;
color: #666666;
line-height: 35rpx;
}
}
}
.right {
font-size: 28rpx;
font-weight: 500;
color: #3274F9;
line-height: 35rpx;
display: flex;
justify-content: center;
align-items: center;
.icon {
width: 35rpx;
height: 39rpx;
background-color: #3274F9;
opacity: 1;
margin-right: 10rpx
}
}
} }
} }
.image_box { .bottom {
display: flex; display: flex;
justify-content: space-between;
flex-direction: column;
align-items: center; align-items: center;
color: #666666FF;
image{ margin-top: 32rpx;
padding-bottom: 20rpx;
border-radius: 20rpx; .location {
overflow: hidden; margin-left: 8rpx;
width: 650rpx; }
height: 455rpx; }
.one {
.linkman {
height: 44rpx;
font-size: 32rpx;
font-weight: 500;
color: #333333;
margin-bottom: 28rpx;
}
.info {
font-size: 28rpx;
font-weight: 400;
color: #666666;
line-height: 45rpx;
}
}
.contract {
display: flex;
justify-content: space-between;
.left {
display: flex;
.contract_img {
width: 102rpx;
height: 102rpx;
background: #F5F5F5;
border-radius: 14rpx 14rpx 14rpx 14rpx;
margin-right: 21rpx;
}
.text {
display: flex;
flex-direction: column;
justify-content: space-between;
.name {
font-size: 32rpx;
;
font-weight: 500;
color: rgba(0, 0, 0, 0.8);
line-height: 35rpx;
}
.nickname {
margin-right: 35rpx;
}
text {
height: 39rpx;
font-size: 28rpx;
font-weight: 400;
color: #666666;
line-height: 35rpx;
}
}
}
.right {
font-size: 28rpx;
font-weight: 500;
color: #3274F9;
line-height: 35rpx;
display: flex;
justify-content: center;
align-items: center;
.icon {
width: 35rpx;
height: 39rpx;
background-color: #3274F9;
opacity: 1;
margin-right: 10rpx
}
} }
} }
} }
.back_btn { .image_box {
width: 694rpx;
height: 84rpx;
background: #3274F9;
border-radius: 42rpx 42rpx 42rpx 42rpx;
display: flex; display: flex;
justify-content: center; justify-content: space-between;
flex-direction: column;
align-items: center; align-items: center;
color: #fff;
margin: 30rpx auto; image {
} padding-bottom: 20rpx;
border-radius: 20rpx;
.stop_btn { overflow: hidden;
width: 694rpx; width: 650rpx;
height: 84rpx; height: 455rpx;
border-radius: 42rpx 42rpx 42rpx 42rpx; }
display: flex;
justify-content: center;
align-items: center;
color: #3274F9;
background-color: transparent;
margin: 30rpx auto;
} }
}
.back_btn {
width: 694rpx;
height: 84rpx;
background: #3274F9;
border-radius: 42rpx 42rpx 42rpx 42rpx;
display: flex;
justify-content: center;
align-items: center;
color: #fff;
margin: 30rpx auto;
}
.stop_btn {
width: 694rpx;
height: 84rpx;
border-radius: 42rpx 42rpx 42rpx 42rpx;
display: flex;
justify-content: center;
align-items: center;
color: #3274F9;
background-color: transparent;
margin: 30rpx auto;
}
</style> </style>

View File

@ -44,7 +44,7 @@ function baseRequestTwo(url, method, data, {
url: Url + '/api' + url, url: Url + '/api' + url,
method: method || 'GET', method: method || 'GET',
header: header, header: header,
data: data || {}, data: method != 'GET' ? data || {} : {},
params: method == 'GET' ? data : {}, params: method == 'GET' ? data : {},
success: (res) => { success: (res) => {
// uni.hideLoading() // uni.hideLoading()