This commit is contained in:
2023-11-23 22:29:13 +08:00
parent 715859c63f
commit 882419768f
39 changed files with 2190 additions and 199 deletions
+204 -14
View File
@@ -19,22 +19,49 @@
<view class="m-20">
<view class="title-main">请填写询价单</view>
<view class="title-sub">询价信息越完整,供应商报价越精准</view>
<view class="form-type-box">
<view @click="form1.data.fillType = 0" :class="{active: form1.data.fillType == 0}" class="form-type-item">手动填写</view>
<view @click="form1.data.fillType = 1" :class="{active: form1.data.fillType == 1}" class="form-type-item">批量上传</view>
</view>
</view>
<view v-for="(item, index) in productList" :key="index">
<enquiry-template :ref="'product' + index" v-model="productList[index]" :base-attributes="baseAttributes" :productIndex="index"></enquiry-template>
</view>
<view class="btn-add-outer">
<!-- 手动填写 -->
<template v-if="form1.data.fillType == 0">
<view v-for="(item, index) in productList" :key="index">
<enquiry-template :ref="'product' + index" v-model="productList[index]" :base-attributes="baseAttributes" :productIndex="index"></enquiry-template>
</view>
</template>
<!-- 批量上传 -->
<view v-if="form1.data.fillType == 0" class="btn-add-outer">
<el-button @click="addProduct" type="primary" size="small">添加商品</el-button>
<el-button @click="removeProduct" type="warning" size="small">删除商品</el-button>
<el-button v-show="productList.length > 1" @click="removeProduct" type="warning" size="small">删除商品</el-button>
</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"
:before-action="form1.props.beforeAction" label-width="140px" cancel-text="保存草稿" submit-text="提交询价单"
@success="onFormSuccess" :footer-show="false">
<template v-slot:productCategoryIds="{ form, keyName }">
<el-form-item label="主要商品分类">
<el-tabs>
<el-tab-pane v-for="(item, index) in categoryTreeData" :label="item.name" :key="item._id">
<el-checkbox-group v-model="checkCategoryList[index]">
<el-checkbox v-for="(citem, cindex) in item.children" :label="citem"
:key="cindex">{{citem.name}}</el-checkbox>
</el-checkbox-group>
</el-tab-pane>
</el-tabs>
</el-form-item>
<el-form-item label="已选分类">
<view class="tags">
<el-tag v-for="(item, index) in checkCategoryArr" :key="index">{{item.name}}</el-tag>
</view>
</el-form-item>
</template>
</vk-data-form>
<view class="form-footer">
<el-button type="" >保存草稿</el-button>
<el-button type="" @click="draft">保存草稿</el-button>
<el-button type="primary" @click="submit">提交询价单</el-button>
</view>
<!-- <el-divider content-position="left">其他设置</el-divider> -->
@@ -42,13 +69,14 @@
<common-footer></common-footer>
</view>
</template>
<script>
import EnquiryTemplate from './components/template.vue'
import { reject } from 'lodash';
import EnquiryTemplate from './components/template.vue'
export default {
components: {EnquiryTemplate},
data() {
@@ -56,12 +84,23 @@
// 表单相关开始-----------------------------------------------------------
productList: [{}],
baseAttributes: [],
categoryTreeData: [],
checkCategoryList: [],
form1: {
// 表单请求数据,此处可以设置默认值
data: {
fillType: 0,
// extraAttributes: {},
// attributes: {},
invoice: false
invoice: false,
breachLiability: `1. 乙方所交产品品种、型号、规格、质量不符合规定的,如果甲方同意利用,应当按质论价;如果甲方不能利用的,应根据产品的具体情况,由乙方负责包换或包修,并承担修理、调换或退货而支付的实际费用;
2.乙方不予供货违约责任为甲方的实际损失+违约金,如乙方材料符合订货标准,甲方不能退货和不收货,甲方无条件应按实际本合同订货数量支付100%货款,并支付乙方因此产生的实际费用。带有甲乙双方单位相关收货人和发货人签字的本合同的发货清单事项和内容均视为本合同的补充合同,与本合同有相同的法律效力,双方应共同遵照执行。`,
solveDispute: `1、凡因本合同引起的或与本合同有关的任何争议,均可友好协商或仲裁解决,协商或仲裁不成的,双方协商同意在合同签订地人民法院管辖地起诉,违约一方或对合同争议承担主要责任的一方,应承担对方因仲裁和起诉而产生的全部律师代理费、鉴定(检验)费、诉讼保全费、诉讼保险费、公告费、差旅费、执行费、误工费和获取证据产生费用等其他相关费用。
2、双方本合同相关权利放弃均应有双方书面作出并加盖公章或授权委托人签字后生效。`,
forceMajeure: `甲乙双方的任何一方由于不可抗力或突发公共事件的原因不能履行合同时,应及时向对方通报不能履行或不能完全履行的理由,以减轻可能给对方造成的损失,在取得有关机构证明以后,允许延期履行、部分履行或者不履行合同,并根据情况可部分或全部免予承担违约责任。`,
contracOther: `本合同的全部内容由双方平等共同协商一致,共同起草制定,非一方事先拟定,不属于格式条款。本合同自双方签字盖章后生效(包括电子签字、盖章),按本合同内容地址、联系方式寄送的一切文书、函件送达与否,均为视为送达有法律效力,通知途径和本合同内联系方式或地址送达文件双方均予以验证。`,
buyerSupplement: '供货方逾期供货承担采购方一切损失',
signMethod: 0,
},
// 表单属性
props: {
@@ -69,7 +108,11 @@
action: "client/enquiry/sheet/kh/add",
// 表单字段显示规则
columns: [
{key: "", title: "采购单", type: "bar-title", showRule: 'fillType==1'},
{key: "productFiles", title: "附件文档", type: "file", showRule: 'fillType==1'},
{key: "productCategoryIds", title: "商品分类", type: "bar-title", showRule: 'fillType==1'},
{key: "", title: "采购商其他要求", type: "bar-title"},
{key: "remark", title: "其他要求", type: "textarea",},
{key: "", title: "发票要求", type: "bar-title"},
{key: "invoice", title: "发票要求", type: "radio",
@@ -86,7 +129,7 @@
{ value: '付款后次月', label: "付款后次月" },
{ value: '付款前', label: "付款前" },
],
showRule: 'invoice == true'
showRule: 'invoice==true'
},
{key: "nvoiceType",
title: "发票种类",
@@ -147,6 +190,21 @@
},
{key: "answerTime", title: "报价时限", type: "date",dateType: "datetime"},
{key: "earnestMoney", title: "保证金要求", type: "text"},
{key: "", title: "合同要求", type: "bar-title"},
{key: 'signMethod', title: '签约方式', type: 'radio', data: [
{ value: 0, label: "法大大" },
{ value: 1, label: "线下签约" },
]},
{key: 'contractType', title: '合同选择', type: 'radio',showRule: 'signMethod==0', data: [
{ value: 0, label: "标准合同模板" },
{ value: 1, label: "自定义合同" },
]},
{key: "breachLiability", title: "违约责任", type: "textarea", readonly: true, showRule: 'signMethod==0&&contractType==0'},
{key: "solveDispute", title: "解决纠纷的方法", type: "textarea", readonly: true, showRule: 'signMethod==0&&contractType==0'},
{key: "forceMajeure", title: "不可抗力", type: "textarea", readonly: true, showRule: 'signMethod==0&&contractType==0'},
{key: "contracOther", title: "其他", type: "textarea", readonly: true, showRule: 'signMethod==0&&contractType==0'},
{key: "buyerSupplement", title: "采购方补充条款", type: "textarea", readonly: true, showRule: 'signMethod==0&&contractType==0'},
{key: "sellerSupplement", title: "供应方补充条款", type: "textarea", showRule: 'signMethod==0&&contractType==0'},
// {key: "", title: "采购商信息", type: "bar-title"},
{
key: "files",
@@ -162,9 +220,45 @@
],
// 表单验证规则
rules: {
// name:[
// { required:true, message:'商品不能为空', trigger: ["change","blur"] }
// ],
answerTime:[
{ required:true, message:'报价时限不能为空', trigger: ["change","blur"] }
],
productCategoryIds:[
{ required:true, message:'商品分类不能为空', trigger: ["change","blur"] }
],
productFiles:[
{ required:true, message:'采购单不能为空', trigger: ["change","blur"] }
],
tradeMethod:[
{ required:true, message:'交易模式不能为空', trigger: ["change","blur"] }
],
invoice:[
{ required:true, message:'发票要求不能为空', trigger: ["change","blur"] }
],
writeInvoiceTime:[
{ required:true, message:'开票时间不能为空', trigger: ["change","blur"] }
],
nvoiceType:[
{ required:true, message:'发票类型不能为空', trigger: ["change","blur"] }
],
payMethod:[
{ required:true, message:'预付百分比不能为空', trigger: ["change","blur"] }
],
advancePayRate:[
{ required:true, message:'预付百分比不能为空', trigger: ["change","blur"] }
],
otherPayMethod:[
{ required:true, message:'付款方式不能为空', trigger: ["change","blur"] }
],
reputationPayDay:[
{ required:true, message:'账期天数不能为空', trigger: ["change","blur"] }
],
signMethod:[
{ required:true, message:'签约方式不能为空', trigger: ["change","blur"] }
],
contractType:[
{ required:true, message:'合同模板不能为空', trigger: ["change","blur"] }
],
},
// add 代表添加 update 代表修改
@@ -178,6 +272,7 @@
// console.log('formData: ',JSON.parse(JSON.stringify(formData)));
// console.log('product: ',JSON.parse(JSON.stringify(this.productList)));
formData.productList = JSON.parse(JSON.stringify(this.productList))
formData.productCategoryList = this.checkCategoryArr
return formData
}
}
@@ -185,8 +280,32 @@
// 表单相关结束-----------------------------------------------------------
};
},
computed: {
checkCategoryArr() {
let arr = []
this.checkCategoryList.forEach(item => {
arr.push(...item)
})
return arr
}
},
onLoad() {
this.getAttributes()
vk.callFunction({
url: 'client/spot/category/pub/getTree',
title: '请求中...',
data: {
},
success: (data) => {
this.categoryTreeData = data.rows
for (var i = 0; i < data.rows.length; i++) {
this.checkCategoryList.push([])
}
}
});
},
methods: {
getAttributes() {
@@ -204,10 +323,45 @@
addProduct() {
this.productList.push({})
},
removeProduct() {
if(this.productList.length > 1) {
this.productList.splice(this.productList.length - 1, 1)
}
},
onFormSuccess() {
vk.navigateTo('/pages/enquiry/list');
},
// 提交并发布
submit() {
this.form1.data.isShow = 1
this.submitAll()
},
// 提交并保存草稿
draft() {
this.form1.data.isShow = 0
this.submitAll()
},
async submitAll() {
// 手动填写表单校验
if(this.form1.data.fillType == 0) {
const verifyTasks = []
for (var i = 0; i < this.productList.length; i++) {
const valid = new Promise((resolve, reject) => {
console.log(this.$refs['product' + i]);
console.log(this.$refs['product' + i][0].$refs);
this.$refs['product' + i][0].$refs.form1.validate((valid) => {
if(valid) {
resolve(valid)
}else {
reject()
}
})
})
verifyTasks.push(valid)
}
await Promise.all(verifyTasks)
}
this.$refs.form1.submitForm()
}
@@ -217,6 +371,32 @@
</script>
<style lang="scss">
.form-type-box{
position: absolute;
display: flex;
justify-content: space-between;
width: 270px;
left: 0;
top: 0;
bottom: 0;
margin: auto;
}
.form-type-item {
width: 120px;
height: 35px;
text-align: center;
line-height: 35px;
font-size: 14px;
background-color: rgba(206, 206, 206, 0.75);
color: rgba(0, 0, 0, 1);
cursor: pointer;
}
.form-type-item.active {
background-color: #A92924;
color: #FFFFFF;
}
.form-view {
width: 1200px;
margin: 0 auto;
@@ -226,6 +406,7 @@
.m-20 {
margin: 20px;
position: relative;
}
.title-main{
font-size: 18px;
@@ -250,4 +431,13 @@
text-align: center;
display: block;
}
.tags {
display: flex;
flex-wrap: wrap;
.el-tag {
margin-right: 10px;
}
}
</style>