Files
jjx-web/pages/enquiry/quote.vue
T
b2894lxlx c6fea1cc0d fix: 调整支付申请与报价查看权限
去掉货到付款和发货凭证,尾款或全款时提示交易已完结;已购单据报价次数也可查看买家信息。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-19 14:20:42 +08:00

410 lines
12 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<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/enquiry/list">询价单</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="enquiry" :id="enquiryId"/>
<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>
<view class="mt-15">项目名称:{{ sheet.projectName ? sheet.projectName : '' }}</view>
<view class="mt-15">项目地址:{{ sheet.fullAddress ? sheet.fullAddress : '' }}</view>
<template v-if="canViewBuyerInfo">
<view class="mt-15" v-if="sheet.companyName">公司信息:{{
sheet.companyName ? sheet.companyName : ''
}}
</view>
<view class="mt-15" v-if="sheet.companyMobile">公司联系方式:{{
sheet.companyMobile ? sheet.companyMobile : ''
}}
</view>
<view class="mt-15">授权业务咨询人:{{
sheet.businessName ? sheet.businessName : ''
}}
</view>
<view class="mt-15">业务咨询联系方式:{{
sheet.businessMobile ? sheet.businessMobile : ''
}}
</view>
</template>
<template v-else>
<view class="mt-15" v-if="sheet.companyName">公司信息:{{
sheet.companyName ? sheet.companyName.replace(/^(.)(.).*(.)(.)(.)(.)$/, "$1$2***$3$4$5$6") : ''
}}
</view>
<view class="mt-15" v-if="sheet.companyMobile">公司联系方式:{{
sheet.companyMobile ? sheet.companyMobile.replace(/^(.)(.)(.).*$/, "$1$2$3****") : ''
}}
</view>
<view class="mt-15">授权业务咨询人:{{
sheet.businessName ? sheet.businessName.replace(/^(.).*(.)$/, "$1***$2") : ''
}}
</view>
<view class="mt-15">业务咨询联系方式:{{
sheet.businessMobile ? sheet.businessMobile.replace(/^(.)(.)(.).*$/, "$1$2$3****") : ''
}}
</view>
</template>
</view>
<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"
:need-alert="false"
:show-cancel="false"
label-width="160px"
@success="onFormSuccess"
@fail="onFormFail"
>
<template v-slot:totalPrice>
<el-input 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 {
userInfo: {
userLevel: 0
},
sheet: {
files: [],
multiFiles: [],
quoteList: [],
transportDocuments: [],
productList: [],
user: {},
fullAddress: ''
},
enquiryId: null,
reloaded: false,
sheetQuoteNum: 0,
// 表单相关开始-----------------------------------------------------------
form1: {
// 表单请求数据,此处可以设置默认值
data: {
// radio: 1,
// checkbox : [1,2]
sheetId: null,
totalPrice: null,
files: [],
},
// 表单属性
props: {
// 表单请求地址
action: "client/enquiry/quote/kh/addQuote",
// 表单字段显示规则
columns: [
{
key: "totalPrice",
title: "货款总价(人民币:元)",
type: "html"
},
// {key: "totalPrice", title: "货款总价(人民币:元)", type: "number", precision: 2},
{
key: "files",
title: "附件",
type: "file",
accept: '.pdf',
tips: '仅支持纵向PDF文档,报价附件将生成标准合同附件,请认真审阅。'
},
{key: "remark", title: "报价单详情", type: "textarea"},
{key: "supplierExt", title: "供应商合同补充条款", type: "textarea", autosize: {minRows: 4, maxRows: 10},},
],
// 表单验证规则
rules: {
totalPrice: [
{required: true, message: "货款总价不能为空", trigger: "change,blur"},
],
files: [
{required: true, message: "附件不能为空", trigger: "change,blur"},
]
},
// add 代表添加 update 代表修改
formType: "",
// 表单是否在请求中
loading: false,
// 是否显示表单1 的弹窗
show: false
}
},
// 表单相关结束-----------------------------------------------------------
};
},
onLoad(options = {}) {
const {
enquiryId
} = options
if (!enquiryId) {
vk.navigateTo('/pages/process/sheet/list');
return
}
this.enquiryId = enquiryId
this.form1.data.sheetId = enquiryId
this.userInfo = vk.getVuex('$user.userInfo') || {userLevel: 0}
this.refreshUserQuotePrivilege()
this.getEnquiryDetail()
},
computed: {
isLoggedIn() {
return !!vk.getVuex('$user.userInfo._id')
},
canViewBuyerInfo() {
const remainQuoteNum = Number(this.userInfo && this.userInfo.remainQuoteNum) || 0
const sheetQuoteNum = Number(this.sheetQuoteNum) || 0
const quoteExpiredAt = this.userInfo && this.userInfo.quoteExpiredAt
const monthlyQuoteActive = !!(quoteExpiredAt && dayjs(quoteExpiredAt).isAfter(dayjs()))
return this.isLoggedIn && (
this.sheet.isMine ||
this.sheet.hasQuote ||
Number(this.userInfo.userLevel) > 0 ||
remainQuoteNum > 0 ||
sheetQuoteNum > 0 ||
monthlyQuoteActive
)
},
totalPriceStr() {
if (this.totalPrice == 0) {
return "零元"
}
return vk.myfn.convertCurrency(this.totalPrice / 100)
}
},
methods: {
dayjs,
normalizeSheet(data = {}) {
return {
files: [],
multiFiles: [],
quoteList: [],
transportDocuments: [],
productList: [],
user: {},
fullAddress: '',
...data,
files: Array.isArray(data.files) ? data.files : [],
multiFiles: Array.isArray(data.multiFiles) ? data.multiFiles : [],
quoteList: Array.isArray(data.quoteList) ? data.quoteList : [],
transportDocuments: Array.isArray(data.transportDocuments) ? data.transportDocuments : [],
productList: Array.isArray(data.productList) ? data.productList : [],
user: data.user || {},
}
},
onFormSuccess() {
vk.redirectTo({url: `/pages/enquiry/detail?id=${this.enquiryId}`})
},
onFormFail(data) {
if (data.data.code === 12) {
this.$confirm(data.data.msg, '提示', {
confirmButtonText: '确定',
showCancelButton: false,
type: 'warning'
}).then(() => {
vk.redirectTo({url: `/pages/user/user?menu=grade`})
})
} else {
this.$confirm(data.data.msg, '提示', {
confirmButtonText: '确定',
showCancelButton: false,
type: 'warning'
}).then(() => {
vk.navigateBack()
})
}
},
async refreshUserQuotePrivilege() {
if (!this.isLoggedIn) return
try {
const {userInfo} = await vk.userCenter.getCurrentUserInfo()
this.userInfo = userInfo || {userLevel: 0}
let sheetQuoteNum = 0
if (this.enquiryId) {
const res = await vk.callFunction({
url: 'client/user/kh/getUserQuoteNumList',
data: {
type: 'enquiry',
sheetId: this.enquiryId,
},
})
if (res && res.data && res.data.num) sheetQuoteNum = Number(res.data.num) || 0
}
this.sheetQuoteNum = sheetQuoteNum
} catch (e) {
// ignore
}
},
// 提交报价单
async submit() {
const data = await vk.userCenter.getCurrentUserInfo();
const {userInfo} = data
if (userInfo.remainQuoteNum === 0 || !userInfo.remainQuoteNum) {
}
// 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'
})
},
fail: err => {
console.log(err)
}
})
},
/**
* 获取询价单详情
*/
getEnquiryDetail() {
vk.callFunction({
url: 'client/enquiry/sheet/pub/getDetail',
title: '请求中...',
data: {
_id: this.enquiryId
},
success: (res) => {
this.sheet = this.normalizeSheet(res.data)
this.sheet.fullAddress = (this.sheet.addressRegion && this.sheet.addressRegion.province) ? `${this.sheet.addressRegion.province.name}${this.sheet.addressRegion.city.name}${this.sheet.addressRegion.area.name}` : ''
if (this.sheet.addressRegion && this.sheet.addressRegion.addressDetail) {
this.sheet.fullAddress += this.sheet.addressRegion.addressDetail
}
}
});
},
formatNumber(e) {
this.form1.data.totalPrice = parseFloat(this.form1.data.totalPrice).toFixed(2)
}
},
onShow() {
this.refreshUserQuotePrivilege()
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>