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

414 lines
0 B

<template>
<view class="body-background"></view>
<u-navbar
:title="title"
:auto-back="true"
left-icon-size="40rpx"
:safe-area-inset-top="true"
:placeholder="true"
bgColor="#ffffff"
></u-navbar>
<u-row :custom-style="{padding:'16rpx 26rpx 180rpx'}">
<u-col :span="12" :custom-style="{
backgroundColor:'#FFFFFF',
borderRadius:'20rpx',
padding:'40rpx 32rpx',
minHeight:'1000rpx',
position:'relative'
}">
<u-form
1 year ago
errorType="toast"
labelWidth="auto"
labelPosition="left"
1 year ago
:model="model"
:rules="rules"
1 year ago
ref="orderForm"
>
<view class="form-title">
租房详情
</view>
<u-form-item
label="承租人"
1 year ago
prop="order.name"
borderBottom
:custom-style="{padding:'34rpx 0',fontSize:'32rpx',color:'#020b18',fontWeight:'400',lineHeight:'50rpx'}"
>
<u-input
inputAlign="right"
disabledColor="#ffffff"
1 year ago
placeholder="请输入"
border="none"
:custom-style="{paddingRight:'28rpx'}"
1 year ago
v-model="model.order.name"
></u-input>
</u-form-item>
<u-form-item
label="身份证号"
1 year ago
prop="order.id_card"
borderBottom
:custom-style="{padding:'34rpx 0',fontSize:'32rpx',color:'#020b18',fontWeight:'400',lineHeight:'50rpx'}"
>
<u-input
inputAlign="right"
disabledColor="#ffffff"
1 year ago
placeholder="请输入"
border="none"
:custom-style="{paddingRight:'28rpx'}"
1 year ago
v-model="model.order.id_card"
></u-input>
</u-form-item>
<u-form-item
label="联系方式"
1 year ago
prop="order.phone"
borderBottom
:custom-style="{padding:'34rpx 0',fontSize:'32rpx',color:'#020b18',fontWeight:'400',lineHeight:'50rpx'}"
>
<u-input
inputAlign="right"
disabledColor="#ffffff"
1 year ago
placeholder="请输入"
border="none"
:custom-style="{paddingRight:'28rpx'}"
1 year ago
v-model="model.order.phone"
></u-input>
</u-form-item>
<u-form-item
label="租期"
1 year ago
prop="order.month"
borderBottom
:custom-style="{padding:'34rpx 0',fontSize:'32rpx',color:'#020b18',fontWeight:'400',lineHeight:'50rpx'}"
>
<u-input
inputAlign="right"
disabledColor="#ffffff"
1 year ago
placeholder="请输入"
border="none"
1 year ago
type="number"
:custom-style="{paddingRight:'28rpx'}"
1 year ago
v-model="model.order.month"
>
<template #suffix>
<u-text text="个/月" color="#020B18" size="32"></u-text>
</template>
</u-input>
</u-form-item>
<u-form-item
label="租金"
1 year ago
prop="order.rent"
borderBottom
:custom-style="{padding:'34rpx 0',fontSize:'32rpx',color:'#020b18',fontWeight:'400',lineHeight:'50rpx'}"
>
<u-input
inputAlign="right"
disabledColor="#ffffff"
1 year ago
placeholder="请输入"
border="none"
:custom-style="{paddingRight:'28rpx'}"
1 year ago
v-model="model.order.rent"
>
<template #suffix>
<u-text text="元/月" color="#020B18" size="32"></u-text>
</template>
</u-input>
</u-form-item>
<u-form-item
1 year ago
prop="order.payment_voucher"
:custom-style="{padding:'0 0',fontSize:'32rpx',color:'#020b18',fontWeight:'400',lineHeight:'50rpx'}"
>
<view class="form-label">
打款凭证
</view>
<u-upload
width="160"
height="160"
:fileList="fileList1"
name="1"
multiple
:maxCount="10"
uploadIcon="plus"
1 year ago
@afterRead="afterFileRead1"
@delete="deleteFile1"
></u-upload>
</u-form-item>
<u-form-item
1 year ago
prop="order.lease_agreement"
:custom-style="{padding:'0 0',fontSize:'32rpx',color:'#020b18',fontWeight:'400',lineHeight:'50rpx'}"
>
<view class="form-label no-top-pad">
租赁协议
</view>
<view class="row">
<view class="">
<u-upload
width="160"
height="160"
1 year ago
:fileList="fileList2"
name="1"
multiple
:maxCount="10"
uploadIcon="plus"
1 year ago
@afterRead="afterFileRead2"
@delete="deleteFile2"
></u-upload>
</view>
</view>
</u-form-item>
</u-form>
1 year ago
<view v-if="type !== 'create'" class="form-title m-t-46">
兑换详情
</view>
1 year ago
<view v-if="type !== 'create'" class="detail-container">
<view class="detail-item">
<u-cell-group
:border="false"
>
<u-cell
custom-style="padding:0;" v-for="i of 4">
<template #title>
<view class="item-title">
{{i}}月房租
</view>
</template>
<template #label>
<view class="item-label">
2023-06-26
</view>
</template>
<template #value>
<view class="item-value">
兑换 <text class="item-value-price">168</text> 暖新币
</view>
</template>
</u-cell>
</u-cell-group>
</view>
</view>
</u-col>
</u-row>
<view class="foot-button border-box">
<u-button
type="primary"
text="我要兑换"
shape="circle"
:custom-style="{
color:'#020B18',
backgroundColor:'#FF9545',
border:'none',
fontSize:'36',
fontWeight:'400',
height:'80rpx'
}"
1 year ago
@click="submit"
></u-button>
</view>
</template>
<script>
import {
imghost
} from '@/config/host.js'
import MzSubsection from '@/components/MzSubsection/Index.vue';
import api from '@/utils/functions.js';
1 year ago
import {submitHouseOrder} from "@/api/user";
import {feedback} from "@/api/feed";
export default {
components: {
MzSubsection
},
data() {
return {
1 year ago
fileList1:[],
fileList2:[],
type:'create',
model: {
order: {
house_id: '',
name: '',
1 year ago
id_card: '',
phone: '',
month: '',
rent: '',
payment_voucher: '',
lease_agreement: '',
},
},
rules: {
1 year ago
'order.name': {
type: 'string',
required: true,
1 year ago
message: '请填写承租人',
trigger: ['blur', 'change']
},
1 year ago
'order.id_card': {
type: 'string',
required: true,
1 year ago
message: '请填写身份证号',
trigger: ['blur', 'change']
},
1 year ago
'order.phone': {
type: 'string',
required: true,
message: '请填写联系方式',
trigger: ['blur', 'change']
},
'order.month': {
type: 'string',
required: true,
message: '请填写租期',
trigger: ['blur', 'change']
},
'order.rent': {
type: 'string',
required: true,
message: '请填写租金',
trigger: ['blur', 'change']
},
'order.payment_voucher': {
type: 'array',
required: true,
message: '请上传打印凭证',
trigger: ['blur', 'change']
},
1 year ago
'order.lease_agreement': {
type: 'string',
required: true,
message: '请上传租赁协议',
trigger: ['blur', 'change']
},
1 year ago
},
title: '租房详情',
loading: true,
size: {
height: 500,
}
}
},
1 year ago
onLoad(option) {
this.model.order.house_id = option.id?option.id:'';
this.model.order.rent = option.rent?option.rent:'';
this.type = option.type?option.type:'create';
console.log(option)
},
onReady() {
let that = this;
let height = api.wxSystemInfo().system.windowHeight
let headerHeight = uni.$u.getPx(44) + uni.$u.sys().statusBarHeight
let info = uni.createSelectorQuery().in(this).select('.foot-button');
info.boundingClientRect(function (data) {
that.size.height = that.size.height = height - headerHeight - data.height - uni.$u.getPx('32rpx');
1 year ago
}).exec(function (res) {});
},
1 year ago
computed: {},
methods: {
submit(){
let file1 = [];
this.fileList1.forEach(item => {
file1.push(item.url)
});
this.model.order.payment_voucher = file1;
let file2 = [];
this.fileList2.forEach(item => {
file2.push(item.url)
});
this.model.order.lease_agreement = file2.join();
console.log(this.model.order)
this.$refs.orderForm.validate().then(res => {
submitHouseOrder(this.model.order).then(res => {
if(res === '200'){
uni.$u.toast('反馈成功')
}else{
uni.$u.toast(res.msg)
}
})
}).catch(errors => {
uni.$u.toast(errors[0].message)
})
},
1 year ago
//上传文件
async afterFileRead1 (event){
let lists = [].concat(event.file);
1 year ago
let fileListLen = this.fileList1.length;
lists.map((item) => {
this.fileList1.push({
...item,
status: 'uploading',
message: '上传中',
});
});
1 year ago
for (let i = 0; i < lists.length; i++) {
api.upfile(lists[i].url).then(res => {
let item = this.fileList1[fileListLen];
this.fileList1.splice(fileListLen, 1, {
...item,
status: 'success',
message: '',
url: res.show_path,
thumb: res.show_path,
});
fileListLen++;
})
}
},
//上传文件
async afterFileRead2 (event){
let lists = [].concat(event.file);
let fileListLen = this.fileList2.length;
lists.map((item) => {
this.fileList2.push({
...item,
status: 'uploading',
message: '上传中',
});
});
1 year ago
for (let i = 0; i < lists.length; i++) {
api.upfile(lists[i].url).then(res => {
let item = this.fileList2[fileListLen];
this.fileList2.splice(fileListLen, 1, {
...item,
status: 'success',
message: '',
url: res.show_path,
thumb: res.show_path,
});
fileListLen++;
})
}
},
1 year ago
//删除上传图片
deleteFile1(event){
this.fileList1.splice(event.index, 1);
},
1 year ago
//删除上传图片
deleteFile2(event){
this.fileList2.splice(event.index, 1);
},
},
onPageScroll(res) {
1 year ago
},
created() {
// this.pagePadding = (api.navHeight().navPaddingTop +
// api.navHeight().navHeight + (api.navHeight().headerPadding * 2))
1 year ago
},
mounted() {
this.userInfo = uni.getStorageSync('user');
// this.userInfo = this.$store.userInfo
if(this.userInfo && this.type!=='create'){
this.model.order.name = this.userInfo.name;
this.model.order.id_card = this.userInfo.id_card;
this.model.order.phone = this.userInfo.phone;
}
}
}
</script>
<style lang="scss">
@import './components/detail.scss';
</style>