430 lines
14 KiB
Vue
430 lines
14 KiB
Vue
<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"/>
|
||
<template v-if="sheet.type === 1">
|
||
<view class="item-wrap">
|
||
<view class="form-title-wrap">
|
||
<view class="goods-sheet-title">
|
||
<view class="form-title">
|
||
采购商信息
|
||
</view>
|
||
<text class="tip-text ml-10">(注册可查看信息)</text>
|
||
</view>
|
||
</view>
|
||
<template v-if="isLoggedIn && (sheet.isMine || sheet.hasQuote || userInfo.userLevel > 0)">
|
||
<view class="mt-15" v-if="sheet.buyer.companyName">公司信息:{{
|
||
sheet.buyer.companyName ? sheet.buyer.companyName : ''
|
||
}}
|
||
</view>
|
||
<view class="mt-15" v-if="sheet.buyer.contract">公司联系方式:{{
|
||
sheet.buyer.contract ? sheet.buyer.contract : ''
|
||
}}
|
||
</view>
|
||
<view class="mt-15" v-if="sheet.buyer.personalName">个人信息:{{
|
||
sheet.buyer.personalName ? sheet.buyer.personalName : ''
|
||
}}
|
||
</view>
|
||
<view class="mt-15" v-if="sheet.buyer.personalContract">个人联系方式:{{
|
||
sheet.buyer.personalContract ? sheet.buyer.personalContract : ''
|
||
}}
|
||
</view>
|
||
<view class="mt-15" v-if="sheet.buyer.managerName">授权人姓名:{{
|
||
sheet.buyer.managerName ? sheet.buyer.managerName : ''
|
||
}}
|
||
</view>
|
||
<view class="mt-15" v-if="sheet.buyer.managerContract">授权联系方式:{{
|
||
sheet.buyer.managerContract ? sheet.buyer.managerContract : ''
|
||
}}
|
||
</view>
|
||
</template>
|
||
<template v-else>
|
||
<view class="mt-15" v-if="sheet.buyer.companyName">公司信息:{{
|
||
sheet.buyer.companyName ? sheet.buyer.companyName.replace(/^(.)(.).*(.)(.)(.)(.)$/, "$1$2***$3$4$5$6") : ''
|
||
}}
|
||
</view>
|
||
<view class="mt-15" v-if="sheet.buyer.contract">公司联系方式:{{
|
||
sheet.buyer.contract ? (sheet.buyer.contract.slice(0, 3) + '*'.repeat(sheet.buyer.contract.length - 7) + sheet.buyer.contract.slice(-4)) : ''
|
||
}}
|
||
</view>
|
||
<view class="mt-15" v-if="sheet.buyer.personalName">个人信息:{{
|
||
sheet.buyer.personalName ? sheet.buyer.personalName.replace(/^(.).*(.)$/, "$1***$2") : ''
|
||
}}
|
||
</view>
|
||
<view class="mt-15" v-if="sheet.buyer.personalContract">个人联系方式:{{
|
||
sheet.buyer.personalContract ? sheet.buyer.personalContract.replace(/(\d{3})\d{4}(\d{4})/, "$1****$2") : ''
|
||
}}
|
||
</view>
|
||
<view class="mt-15" v-if="sheet.buyer.managerName">授权人姓名:{{
|
||
sheet.buyer.managerName ? sheet.buyer.managerName.replace(/^(.).*(.)$/, "$1***$2") : ''
|
||
}}
|
||
</view>
|
||
<view class="mt-15" v-if="sheet.buyer.managerContract">授权联系方式:{{
|
||
sheet.buyer.managerContract ? sheet.buyer.managerContract.replace(/(\d{3})\d{4}(\d{4})/, "$1****$2") : ''
|
||
}}
|
||
</view>
|
||
</template>
|
||
</view>
|
||
</template>
|
||
<template v-else>
|
||
<view class="item-wrap">
|
||
<view class="form-title-wrap">
|
||
<view class="goods-sheet-title">
|
||
<view class="form-title">
|
||
{{ sheet.type === 3 ? '回收单位信息' : '供货商信息' }}
|
||
</view>
|
||
<text class="tip-text ml-10">(注册可查看信息)</text>
|
||
</view>
|
||
</view>
|
||
<template v-if="isLoggedIn && (sheet.isMine || sheet.hasQuote || userInfo.userLevel > 0)">
|
||
<view class="mt-15" v-if="sheet.supplier.companyName">公司信息:{{
|
||
sheet.supplier.companyName ? sheet.supplier.companyName : ''
|
||
}}
|
||
</view>
|
||
<view class="mt-15" v-if="sheet.supplier.contract">公司联系方式:{{
|
||
sheet.supplier.contract ? sheet.supplier.contract : ''
|
||
}}
|
||
</view>
|
||
<view class="mt-15" v-if="sheet.supplier.personalName">个人信息:{{
|
||
sheet.supplier.personalName ? sheet.supplier.personalName : ''
|
||
}}
|
||
</view>
|
||
<view class="mt-15" v-if="sheet.supplier.personalContract">
|
||
个人联系方式:{{
|
||
sheet.supplier.personalContract ? sheet.supplier.personalContract : ''
|
||
}}
|
||
</view>
|
||
<view class="mt-15" v-if="sheet.supplier.managerName">授权人姓名:{{
|
||
sheet.supplier.managerName ? sheet.supplier.managerName : ''
|
||
}}
|
||
</view>
|
||
<view class="mt-15" v-if="sheet.supplier.managerContract">授权联系方式:{{
|
||
sheet.supplier.managerContract ? sheet.supplier.managerContract : ''
|
||
}}
|
||
</view>
|
||
</template>
|
||
<template v-else>
|
||
<view class="mt-15" v-if="sheet.supplier.companyName">公司信息:{{
|
||
sheet.supplier.companyName ? sheet.supplier.companyName.replace(/^(.)(.).*(.)(.)(.)(.)$/, "$1$2***$3$4$5$6") : ''
|
||
}}
|
||
</view>
|
||
<view class="mt-15" v-if="sheet.supplier.contract">公司联系方式:{{
|
||
sheet.supplier.contract ? (sheet.supplier.contract.slice(0, 3) + '*'.repeat(sheet.supplier.contract.length - 7) + sheet.supplier.contract.slice(-4)) : ''
|
||
}}
|
||
</view>
|
||
<view class="mt-15" v-if="sheet.supplier.personalName">个人信息:{{
|
||
sheet.supplier.personalName ? sheet.supplier.personalName.replace(/^(.).*(.)$/, "$1***$2") : ''
|
||
}}
|
||
</view>
|
||
<view class="mt-15" v-if="sheet.supplier.personalContract">
|
||
个人联系方式:{{
|
||
sheet.supplier.personalContract ? sheet.supplier.personalContract.replace(/(\d{3})\d{4}(\d{4})/, "$1****$2") : ''
|
||
}}
|
||
</view>
|
||
<view class="mt-15" v-if="sheet.supplier.managerName">授权人姓名:{{
|
||
sheet.supplier.managerName ? sheet.supplier.managerName.replace(/^(.).*(.)$/, "$1***$2") : ''
|
||
}}
|
||
</view>
|
||
<view class="mt-15" v-if="sheet.supplier.managerContract">授权联系方式:{{
|
||
sheet.supplier.managerContract ? sheet.supplier.managerContract.replace(/(\d{3})\d{4}(\d{4})/, "$1****$2") : ''
|
||
}}
|
||
</view>
|
||
</template>
|
||
</view>
|
||
</template>
|
||
<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,
|
||
userInfo: {
|
||
userLevel: -1
|
||
},
|
||
sheet: {
|
||
buyer: {},
|
||
supplier: {}
|
||
},
|
||
reloaded: false,
|
||
// 表单相关开始-----------------------------------------------------------
|
||
form1: {
|
||
// 表单请求数据,此处可以设置默认值
|
||
data: {
|
||
// radio: 1,
|
||
// checkbox : [1,2]
|
||
sheetId: null,
|
||
files: []
|
||
},
|
||
// 表单属性
|
||
props: {
|
||
// 表单请求地址
|
||
action: "client/old/kh/addQuote",
|
||
// 表单字段显示规则
|
||
columns: [
|
||
{
|
||
key: "totalPrice", title: "总价(人民币:元)", type: "number", showRule: () => {
|
||
return this.sheet.type !== 0 && (this.sheet.type !== 2 || (this.sheet.type === 2 && this.sheet.rentType === 0))
|
||
}
|
||
},
|
||
{
|
||
key: "unit", title: "计价单位", type: "text", showRule: () => {
|
||
return this.sheet.type === 0
|
||
}
|
||
},
|
||
{
|
||
key: "totalPrice", title: "单价(人民币:元)", type: "number", showRule: () => {
|
||
return this.sheet.type === 0
|
||
}
|
||
},
|
||
{
|
||
key: "totalPrice", title: '简述询价内容', type: "number", showRule: () => {
|
||
return this.sheet.type === 2 && this.sheet.rentType === 1
|
||
}
|
||
},
|
||
{key: "files", title: "附件", type: "file", accept: '.pdf', tips: '仅支持纵向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"},
|
||
],
|
||
unit: [
|
||
{required: true, message: "计价单位不能为空", trigger: "change,blur"},
|
||
],
|
||
files: [
|
||
{required: true, message: "附件不能为空", trigger: "change,blur"},
|
||
],
|
||
},
|
||
// add 代表添加 update 代表修改
|
||
formType: "",
|
||
// 表单是否在请求中
|
||
loading: false,
|
||
// 是否显示表单1 的弹窗
|
||
show: false
|
||
}
|
||
},
|
||
// 表单相关结束-----------------------------------------------------------
|
||
};
|
||
},
|
||
async onLoad(options = {}) {
|
||
const {
|
||
id
|
||
} = options
|
||
if (!id) {
|
||
vk.navigateTo('/pages/index/old/old');
|
||
return
|
||
}
|
||
|
||
this.id = id
|
||
this.form1.data.sheetId = id
|
||
if (this.isLoggedIn) {
|
||
const {userInfo} = await vk.callFunction({
|
||
url: 'user/kh/getMyUserInfo'
|
||
})
|
||
this.userInfo = userInfo
|
||
}
|
||
this.getDetail()
|
||
},
|
||
computed: {
|
||
isLoggedIn() {
|
||
return !!vk.getVuex('$user.userInfo._id')
|
||
},
|
||
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;
|
||
border-radius: 5px;
|
||
}
|
||
|
||
.description {
|
||
margin-bottom: 40px;
|
||
width: 800px;
|
||
}
|
||
|
||
.item-wrap {
|
||
margin: 24px 0;
|
||
|
||
.form-title-wrap {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
|
||
.goods-info-title {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: flex-start;
|
||
}
|
||
|
||
.form-title {
|
||
padding-left: 10px;
|
||
color: #A92924;
|
||
font-size: 18px;
|
||
line-height: 18px;
|
||
border-left: 4px solid #A92924;
|
||
}
|
||
}
|
||
}
|
||
|
||
.tip-text {
|
||
color: #f56c6c;
|
||
}
|
||
|
||
.item-wrap + .el-form {
|
||
margin-top: 24px;
|
||
}
|
||
|
||
.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>
|