20261008
This commit is contained in:
@@ -0,0 +1,235 @@
|
||||
<template>
|
||||
<view>
|
||||
<top-bar></top-bar>
|
||||
<common-header></common-header>
|
||||
<category-bar></category-bar>
|
||||
|
||||
<view class="page-nav">
|
||||
<el-breadcrumb separator="/">
|
||||
<el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
|
||||
<el-breadcrumb-item>
|
||||
<navigator style="display: inline-block;" url="/pages/index/old/old">旧货交易</navigator>
|
||||
</el-breadcrumb-item>
|
||||
<el-breadcrumb-item>填写报价信息</el-breadcrumb-item>
|
||||
</el-breadcrumb>
|
||||
</view>
|
||||
|
||||
<view class="page-main">
|
||||
<quote-remain-num v-if="reloaded" :amount="sheet.quoteAmount" type="old" :id="id"/>
|
||||
<vk-data-form
|
||||
ref="form1"
|
||||
v-model="form1.data"
|
||||
:action="form1.props.action"
|
||||
:columns="form1.props.columns"
|
||||
:rules="form1.props.rules"
|
||||
:form-type="form1.props.formType"
|
||||
:loading.sync="form1.props.loading"
|
||||
:auto-close="false"
|
||||
label-width="140px"
|
||||
:show-cancel="false"
|
||||
@success="onFormSuccess"
|
||||
>
|
||||
<template v-slot:totalPrice>
|
||||
<el-input v-if="sheet.type === 2 && sheet.rentType === 1" v-model="form1.data.totalPrice"
|
||||
placeholder="请输入询价内容"/>
|
||||
<el-input v-else v-model="form1.data.totalPrice" placeholder="请输入总价"
|
||||
@change="formatNumber"></el-input>
|
||||
</template>
|
||||
</vk-data-form>
|
||||
</view>
|
||||
|
||||
<common-footer></common-footer>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import dayjs from "dayjs";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
id: null,
|
||||
sheet: null,
|
||||
reloaded: false,
|
||||
// 表单相关开始-----------------------------------------------------------
|
||||
form1: {
|
||||
// 表单请求数据,此处可以设置默认值
|
||||
data: {
|
||||
// radio: 1,
|
||||
// checkbox : [1,2]
|
||||
sheetId: null
|
||||
},
|
||||
// 表单属性
|
||||
props: {
|
||||
// 表单请求地址
|
||||
action: "client/old/kh/addQuote",
|
||||
// 表单字段显示规则
|
||||
columns: [
|
||||
{
|
||||
key: "totalPrice", title: "总价(人民币:元)", type: "number", showRule: () => {
|
||||
return this.sheet.type !== 2 || (this.sheet.type === 2 && this.sheet.rentType === 0)
|
||||
}
|
||||
},
|
||||
{
|
||||
key: "totalPrice", title: '简述询价内容', type: "number", showRule: () => {
|
||||
return this.sheet.type === 2 && this.sheet.rentType === 1
|
||||
}
|
||||
},
|
||||
{key: "files", title: "附件", type: "file", accept: '.pdf'},
|
||||
{
|
||||
key: "remark", title: "报价单详情", type: "textarea", showRule: () => {
|
||||
return this.sheet.type !== 2 || (this.sheet.type === 2 && this.sheet.rentType === 0)
|
||||
}
|
||||
},
|
||||
{
|
||||
key: "remark", title: "询价详情", type: "textarea", showRule: () => {
|
||||
return this.sheet.type === 2 && this.sheet.rentType === 1
|
||||
}
|
||||
},
|
||||
{
|
||||
key: "supplierExt", title: "报价补充条款", type: "textarea", showRule: () => {
|
||||
return this.sheet.type !== 2 || (this.sheet.type === 2 && this.sheet.rentType === 0)
|
||||
}
|
||||
},
|
||||
],
|
||||
// 表单验证规则
|
||||
rules: {
|
||||
totalPrice: [
|
||||
{required: true, message: "总价不能为空", trigger: "change,blur"},
|
||||
]
|
||||
},
|
||||
// add 代表添加 update 代表修改
|
||||
formType: "",
|
||||
// 表单是否在请求中
|
||||
loading: false,
|
||||
// 是否显示表单1 的弹窗
|
||||
show: false
|
||||
}
|
||||
},
|
||||
// 表单相关结束-----------------------------------------------------------
|
||||
};
|
||||
},
|
||||
onLoad(options = {}) {
|
||||
console.log(options)
|
||||
const {
|
||||
id
|
||||
} = options
|
||||
if (!id) {
|
||||
vk.navigateTo('/pages/index/old/old');
|
||||
return
|
||||
}
|
||||
|
||||
this.id = id
|
||||
this.form1.data.sheetId = id
|
||||
this.getDetail()
|
||||
},
|
||||
computed: {
|
||||
totalPriceStr() {
|
||||
if (this.totalPrice === 0) {
|
||||
return "零元"
|
||||
}
|
||||
return vk.myfn.convertCurrency(this.totalPrice / 100)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getDetail() {
|
||||
this.reloaded = false
|
||||
vk.callFunction({
|
||||
url: 'client/old/pub/getDetail',
|
||||
title: '请求中...',
|
||||
data: {
|
||||
id: this.id
|
||||
},
|
||||
success: (res) => {
|
||||
this.sheet = res
|
||||
this.reloaded = true
|
||||
|
||||
}
|
||||
}).catch(err => {
|
||||
if (err.code === -1) {
|
||||
setTimeout(() => {
|
||||
vk.navigateBack()
|
||||
}, 1500)
|
||||
}
|
||||
})
|
||||
},
|
||||
formatNumber(e) {
|
||||
this.form1.data.totalPrice = parseFloat(this.form1.data.totalPrice).toFixed(2)
|
||||
},
|
||||
onFormSuccess() {
|
||||
vk.redirectTo({url: `/pages/index/old/detail?id=${this.id}`})
|
||||
},
|
||||
// 提交报价单
|
||||
async submit() {
|
||||
|
||||
const data = await vk.userCenter.getCurrentUserInfo();
|
||||
const {userInfo} = data
|
||||
if (userInfo.quoteTimes > 3) {
|
||||
|
||||
}
|
||||
|
||||
// this.$confirm(`今日报价次数${userInfo.quoteTimes || 0}, 是否继续?`, '提示', {
|
||||
// confirmButtonText: '确定',
|
||||
// cancelButtonText: '取消',
|
||||
// type: 'warning',
|
||||
// center: true
|
||||
// }).then(res => {
|
||||
vk.callFunction({
|
||||
url: 'client/enquiry/quote/kh/addQuote',
|
||||
title: '请求中...',
|
||||
// data: {
|
||||
// sheet: this.sheet,
|
||||
// totalPrice: this.totalPrice
|
||||
// },
|
||||
success: (data) => {
|
||||
this.$message({
|
||||
message: "报价成功",
|
||||
type: 'success'
|
||||
})
|
||||
|
||||
}
|
||||
});
|
||||
// })
|
||||
},
|
||||
},
|
||||
onShow() {
|
||||
this.reloaded = false
|
||||
setTimeout(() => {
|
||||
this.reloaded = true
|
||||
}, 500)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.page-main {
|
||||
width: 1200px;
|
||||
margin: 20px auto;
|
||||
background-color: #FFFFFF;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.description {
|
||||
margin-bottom: 40px;
|
||||
width: 800px;
|
||||
}
|
||||
|
||||
.quote {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.quote-form {
|
||||
width: 260px;
|
||||
}
|
||||
|
||||
.form-footer {
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
background: #fff;
|
||||
padding-top: 0;
|
||||
text-align: center;
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user