Files
jjx-wap/pages/work/publish.vue
T

1045 lines
40 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 class="wrap">
<!-- 吸顶 -->
<u-sticky offset-top="0" customNavHeight="0">
<uititle title="发布加工单"></uititle>
</u-sticky>
<view class="layout layout-header">
<view class="big">请填写加工单</view>
<view class="small">加工单信息越完整,加工商报价越精准</view>
</view>
<view class="layout layout-publish m-top-10">
<view class="goods-item flex align-center flex-wrap">
<view class="lb">金久信业务员编号</view>
<view class="vl flex-1 p-right-20">
<u--input
placeholder="请输入金久信业务员编号"
border="surround"
v-model="formData.salesCode"
fontSize="24rpx"
disabledColor="#fff"
></u--input>
</view>
</view>
<!-- 加工信息 -->
<view class="card-title">加工分类</view>
<!-- <view class="group flex align-center m-top-30">-->
<!-- <view class="lb need m-right-20">品名规格:</view>-->
<!-- <view class="vl flex-1">-->
<!-- <u&#45;&#45;input-->
<!-- disabled-->
<!-- placeholder="请输入内容"-->
<!-- border="surround"-->
<!-- v-model="formData.title"-->
<!-- ></u&#45;&#45;input>-->
<!-- </view>-->
<!-- </view>-->
<view class="tag-title m-top-30">
点击添加加工商品
<text class="limit">(至少选择1个现货,最多可选择5个现货)</text>
</view>
<view class="lbx m-top-10">
如无完全匹配的加工商品,请选择最接近的分类,并在“加工产品简述”中补充说明。
</view>
<view class="tag-box flex justify-start flex-wrap">
<view :class="['item', {active: formData.productList.includes(item._id)}]"
v-for="(item,index) in productList" :key="index"
@click="selectGoods(item)">{{ item.name }}
</view>
</view>
<view class="group flex align-center m-top-30">
<view class="lb m-right-20">加工产品简述:</view>
<view class="vl flex-1">
<u--input
placeholder="如产品名称、加工内容等"
border="surround"
v-model="formData.detail"
></u--input>
</view>
</view>
<view class="group flex align-center m-top-30">
<view class="lb need m-right-20">加工量:</view>
<view class="vl flex-1">
<u--input
placeholder="请输入内容"
border="surround"
v-model="formData.num"
></u--input>
</view>
</view>
<!-- 附件信息 -->
<view class="card-title m-top-30">附件信息</view>
<view class="group m-top-30">
<view class="lb need m-right-20">附件内容:</view>
<view class="flex justify-between align-center m-top-20">
<view class="lbx flex-1">仅支持PDF文件</view>
<!-- <view class="download">采购,报价单样板下载</view>-->
</view>
<view class="m-top-30">
<u-upload
accept="file"
:fileList="files"
@afterRead="afterRead($event)"
@delete="deletePic('files')"
:multiple="false"
:maxCount="1"
></u-upload>
</view>
</view>
<view class="card-title m-top-30">加工产品交货地址</view>
<view class="lb need m-right-20">区域:</view>
<view class="vl flex-1" @click="showAddress">
<u--input
readonly
placeholder="请选择"
border="surround"
v-model="address"
suffixIcon="arrow-down"
style="pointer-events:none"
>
</u--input>
</view>
<view class="lb need m-right-20">详细地址:</view>
<view class="vl flex-1">
<u--input border="surround" v-model="formData.addressDetail">
</u--input>
</view>
<!-- 加工商其他要求 -->
<view class="card-title m-top-30">加工商其他要求</view>
<view class="flex justify-start align-center m-top-30">
<u-radio-group v-model="hasRequire" placement="row">
<u-radio activeColor="red" name='1' label="有" :customStyle="{marginRight: '30px'}"></u-radio>
<u-radio activeColor="red" name='2' label="无"></u-radio>
</u-radio-group>
</view>
<view class="m-top-30">
<u--textarea v-model="formData.remark" :disabled="hasRequire === '2'"
placeholder="复杂加工提供图纸、简单加工详细说明加工内容,如:镀锌、刷漆、防腐、折弯、裁剪等"></u--textarea>
</view>
<view class="card-title m-top-30">加工商其他要求附件</view>
<view class="group m-top-30">
<view class="lb m-right-20">附件内容:</view>
<view class="flex justify-between align-center m-top-20">
<view class="lbx flex-1">仅限PDF格式附件或合同,非协议合同将读取为合同附件,请仔细核查</view>
<!-- <view class="download">采购,报价单样板下载</view>-->
</view>
<view class="m-top-30">
<u-upload
accept="file"
:fileList="multiFiles"
@afterRead="afterReadMultiFile"
@delete="deletePicMultiFile"
multiple
:maxCount="10"
></u-upload>
</view>
</view>
<!-- 发票要求 -->
<view class="card-title m-top-30">发票要求</view>
<view class="flex justify-start align-center m-top-30">
<u-radio-group v-model="formData.invoice" placement="row">
<u-radio activeColor="red" :name='true' label="含税" :customStyle="{marginRight: '30px'}"></u-radio>
<u-radio activeColor="red" :name='false' label="不含税"></u-radio>
</u-radio-group>
</view>
<!-- <template v-if="formData.invoice">-->
<!-- <view class="group flex m-top-30">-->
<!-- <view class="lb m-right-20">开票时间:</view>-->
<!-- <view class="vl flex-1">-->
<!-- <u-radio-group v-model="formData.writeInvoiceTime" placement="column">-->
<!-- <u-radio activeColor="red" :name='index' v-for="(item, index) in WRITE_INVOICE_TIME()"-->
<!-- :key="index" :label="item"-->
<!-- :customStyle="{marginBottom: '10px'}"></u-radio>-->
<!-- </u-radio-group>-->
<!-- </view>-->
<!-- </view>-->
<!-- <view class="group flex m-top-30">-->
<!-- <view class="lb m-right-20">发票种类:</view>-->
<!-- <view class="vl flex-1">-->
<!-- <u-radio-group v-model="formData.invoiceType" placement="column">-->
<!-- <u-radio activeColor="red" :name='index' :label="item"-->
<!-- v-for="(item, index) in INVOICE_TYPE()" :key="index"-->
<!-- :customStyle="{marginBottom: '10px'}"></u-radio>-->
<!-- </u-radio-group>-->
<!-- </view>-->
<!-- </view>-->
<!-- <view class="group flex align-center m-top-30">-->
<!-- <view class="lb m-right-20">其他要求:</view>-->
<!-- <view class="vl flex-1">-->
<!-- <u&#45;&#45;input-->
<!-- placeholder="请输入内容"-->
<!-- border="surround"-->
<!-- v-model="formData.invoiceOther"-->
<!-- ></u&#45;&#45;input>-->
<!-- </view>-->
<!-- </view>-->
<!-- </template>-->
<template v-if="formData.invoice">
<view class="group flex m-top-30">
<view class="lb m-right-20">开票时间:</view>
<view class="vl flex-1">
<u-radio-group v-model="formData.writeInvoiceTime" placement="column">
<u-radio activeColor="red" :name='0' label="付款当月(限20号之后付款次月开票)"
:customStyle="{marginBottom: '10px'}"></u-radio>
<u-radio activeColor="red" :name='1' label="付款后次月"
:customStyle="{marginBottom: '10px'}"></u-radio>
<u-radio activeColor="red" :name='2' label="付款前"></u-radio>
</u-radio-group>
</view>
</view>
<view class="group flex m-top-30">
<view class="lb m-right-20">纳税人身份:</view>
<view class="vl flex-1">
<u-radio-group v-model="formData.taxType" placement="column">
<u-radio activeColor="red" name='一般纳税人' label="一般纳税人"
:customStyle="{marginBottom: '10px'}"></u-radio>
<u-radio activeColor="red" name='小规模公司' label="小规模公司"
:customStyle="{marginBottom: '10px'}"></u-radio>
<u-radio activeColor="red" name='个体工商户' label="个体工商户"></u-radio>
</u-radio-group>
</view>
</view>
<view class="group flex m-top-30">
<view class="lb m-right-20">发票种类:</view>
<view class="vl flex-1">
<u-radio-group v-model="formData.invoiceType" placement="column">
<u-radio activeColor="red" name='专用发票' label="专用发票"
:customStyle="{marginBottom: '10px'}"></u-radio>
<u-radio activeColor="red" name='普通发票' label="普通发票"
:customStyle="{marginBottom: '10px'}"></u-radio>
</u-radio-group>
</view>
</view>
<view class="group flex m-top-30">
<view class="lb m-right-20">税率:</view>
<view class="vl flex-1">
<u-radio-group v-model="formData.taxRate" placement="column">
<u-radio activeColor="red" v-for="(item, index) in ['13%', '9%', '6%', '4%', '3%', '1%']"
:key="index" :name='item' :label="item"
:customStyle="{marginBottom: '10px'}"/>
</u-radio-group>
</view>
</view>
<view class="group flex align-center m-top-30">
<view class="lb m-right-20">手动填写税票要求:</view>
<view class="vl flex-1">
<u--input
placeholder="如有特殊要求,请填写:一般纳税人 专用发票 税率13%"
border="surround"
v-model="formData.invoiceOther"
></u--input>
</view>
</view>
<view class="lbx m-top-10">
如开票信息有补充要求,可在此处填写完整说明。
</view>
</template>
<!-- 运输要求 -->
<view class="card-title m-top-30">运输要求</view>
<view class="group flex m-top-30">
<view class="lb m-right-20">随货资料:</view>
<view class="vl flex-1">
<u-checkbox-group v-model="formData.transportDocuments" @change="onChangeSelectDocument">
<view class="flex flex-col justify-start items-start">
<view class="flex justify-start items-center">
<view style="width: 250rpx">
<u-checkbox activeColor="red" name='合格证' label="合格证"
:customStyle="{marginLeft: '10px'}"></u-checkbox>
</view>
<view style="width: 250rpx">
<u-checkbox activeColor="red" name='检测报告' label="检测报告"
:customStyle="{marginLeft: '10px'}"></u-checkbox>
</view>
</view>
<view class="flex justify-start items-center mt-20">
<view style="width: 250rpx">
<u-checkbox activeColor="red" name='销售清单' label="销售清单"
:customStyle="{marginLeft: '10px'}"></u-checkbox>
</view>
<view style="width: 250rpx">
<u-checkbox activeColor="red" name='磅重' label="磅重"
:customStyle="{marginLeft: '10px'}"></u-checkbox>
</view>
</view>
</view>
</u-checkbox-group>
<u-checkbox :checked="selectAll" activeColor="red" name='全选' label="全选"
:customStyle="{marginTop: '10px', marginLeft: '10px'}"
@change="changeSelectAll"></u-checkbox>
</view>
</view>
<view class="group flex align-center m-top-30">
<view class="lb m-right-20">其他要求:</view>
<view class="vl flex-1">
<u--input
placeholder="请输入内容"
border="surround"
v-model="formData.otherTransportDocuments"
></u--input>
</view>
</view>
<view class="flex justify-start align-center m-top-30">
<view class="lb m-right-20">运输限制:</view>
<view class="vl flex-1">
<u-radio-group v-model="formData.transportLimit" placement="row">
<u-radio activeColor="red" :name='false' label="无"
:customStyle="{marginRight: '30px'}"></u-radio>
<u-radio activeColor="red" :name='true' label="有"></u-radio>
</u-radio-group>
</view>
</view>
<view class="group flex align-center m-top-30" v-if="formData.transportLimit">
<view class="lb m-right-20">其他要求:</view>
<view class="vl flex-1">
<u--input
placeholder="请输入运输限制说明"
border="surround"
v-model="formData.otherTransportRequest"
></u--input>
</view>
</view>
<!-- 交易模式 -->
<view class="card-title m-top-30">交易模式</view>
<view class="flex justify-start align-center m-top-30">
<u-radio-group
v-model="formData.tradeMethod"
placement="row"
>
<view class="mr-25">
<u-radio activeColor="red" :name='1' label="金久信公证"></u-radio>
</view>
<u-radio activeColor="red" :name='0' label="自主交易"
:customStyle="{marginRight: '30px'}"></u-radio>
</u-radio-group>
</view>
<view style="font-size: 24rpx; line-height: 38rpx; color: #A92924;" class="m-top-20">
<view>重要提示:在自主交易模式下,本平台仅承担信息交互服务职能,仅确保入驻本平台的交易双方已完成实名认证;对于交易的真实性及交易过程中的任一环节,本平台均不承担责任,请用户完成风险评估与风险尽职调查后,审慎开展交易。</view>
</view>
<!-- 交易说明 -->
<view class="card-title m-top-30">交易说明</view>
<view v-if="isNotarizedTrade" style="font-size: 24rpx; line-height: 38rpx; color: #A92924;" class="m-top-30">
付款方式:预付订单金额100%货款至平台银联监管账户,验收合格后支付至供应商账户,交易未完成不能撤资。
</view>
<template v-else>
<view class="group flex m-top-30">
<view class="lb m-right-20">付款方式:</view>
<view class="vl flex-1">
<u-radio-group v-model="formData.payMethod" placement="column">
<view class="flex justify-start items-center">
<u-radio activeColor="red" :name='0'
:customStyle="{marginBottom: '10px'}"></u-radio>
<view class="text-25 flex justify-start items-center">
<text>预付</text>
<u-input v-model="formData.advancePayRate" :disabled="formData.payMethod !== 0"
:custom-style="{width: '100rpx'}"></u-input>
<text>%,货到付全款</text>
</view>
</view>
<u-radio activeColor="red" :name='1' label="货到验收后付款"
:customStyle="{marginBottom: '10px'}"></u-radio>
<u-radio activeColor="red" :name='2' label="提货付全款"
:customStyle="{marginBottom: '10px'}"></u-radio>
<u-radio activeColor="red" :name='3' label="信誉采购,货到签单后账期N天"
:customStyle="{marginBottom: '10px'}"></u-radio>
<u-radio activeColor="red" :name='4' label="其他付款方式描述"></u-radio>
</u-radio-group>
</view>
</view>
</template>
<view class="group flex align-center m-top-30" v-if="formData.payMethod === 3">
<view class="lb m-right-20">账期(天):</view>
<view class="vl flex-1">
<u--input
placeholder="请输入内容"
v-model="formData.reputationPayDay"
></u--input>
</view>
</view>
<view class="group flex align-center m-top-30" v-if="formData.payMethod === 4">
<view class="lb m-right-20">其他付款方式描述:</view>
<view class="vl flex-1">
<u--textarea v-model="formData.otherPayMethod" placeholder="请输入内容"></u--textarea>
</view>
</view>
<view class="flex justify-start align-center m-top-30">
<view class="lb m-right-20">报价形式:</view>
<view class="vl flex-1">
<u-radio-group v-model="formData.offerType" placement="row">
<u-radio activeColor="red" :name='0' label="整单报价"
:customStyle="{marginRight: '30px'}"></u-radio>
<u-radio activeColor="red" :name='1' label="可分项报价"></u-radio>
</u-radio-group>
</view>
</view>
<view class="group flex align-center m-top-30">
<view class="lb m-right-20">报价时限:</view>
<view class="vl flex-1" @click.native="show = true">
<u--input
style="pointer-events:none"
readonly
placeholder="点击选取时限"
suffixIcon="calendar"
v-model="answerRange"
></u--input>
</view>
</view>
<!-- 交易保证金要求 -->
<view class="card-title m-top-30">平台交易保证金要求</view>
<view class="group flex align-center m-top-30">
<view class="vl flex-1">
<u--input
placeholder="请输入平台交易保证金要求(如无要求则留空)"
border="surround"
v-model="formData.earnestMoney"
></u--input>
</view>
</view>
<!-- 合同条款 -->
<view class="card-title m-top-30">合同条款</view>
<view class="flex justify-start align-center m-top-30">
<u-radio-group v-model="formData.signMethod" placement="column">
<u-radio activeColor="red" :name='0' label="线上签约-标准合同"
:customStyle="{marginBottom: '30rpx'}"></u-radio>
<u-radio activeColor="red" :name='2' label="线上签约-双方协商合同"
:customStyle="{marginBottom: '30rpx'}"></u-radio>
<u-radio activeColor="red" :name='1' label="线下签约" :customStyle="{marginBottom: '30rpx'}"
v-if="formData.tradeMethod === 0"></u-radio>
</u-radio-group>
</view>
<view class="group m-top-30" v-if="formData.signMethod === 2">
<view class="lb need m-right-20">合同附件:</view>
<view class="flex justify-between align-center m-top-20">
<view class="lbx flex-1">仅支持PDF文件</view>
<!-- <view class="download">采购,报价单样板下载</view>-->
</view>
<view class="m-top-30">
<u-upload
accept="file"
:fileList="contractFiles"
@afterRead="afterReadContract"
@delete="deletePic('contractAttachment')"
:multiple="false"
:maxCount="1"
></u-upload>
</view>
</view>
<view v-if="formData.signMethod === 0" class="text-25" style="line-height: 32rpx">
<view @click="openDownload" class="pointer my-25 text-main" v-if="formData.signMethod === 0">
点击查看标准合同
</view>
<view v-if="formData.signMethod === 0" class="mb-15">补充条款</view>
<view class="flex justify-start items-start flex-col">
<view class="m-10">违约责任:</view>
<view class="pl-20 flex-1 py-20">
1.
乙方所交产品品种、型号、规格、质量不符合规定的,如果甲方同意利用,应当按质论价;如果甲方不能利用的,应根据产品的具体情况,由乙方负责包换或包修,并承担修理、调换或退货而支付的实际费用;
2.乙方不予供货违约责任为甲方的实际损失+违约金,如乙方材料符合订货标准,甲方不能退货和不收货,甲方无条件应按实际本合同订货数量支付100%货款,并支付乙方因此产生的实际费用。带有甲乙双方单位相关收货人和发货人签字的本合同的发货清单事项和内容均视为本合同的补充合同,与本合同有相同的法律效力,双方应共同遵照执行。
</view>
</view>
<view class="flex justify-start items-start flex-col">
<view class="m-10">解决纠纷的方法:</view>
<view class=" pl-20 flex-1 py-20">
1、凡因本合同引起的或与本合同有关的任何争议,均可友好协商或仲裁解决,协商或仲裁不成的,双方协商同意在合同签订地人民法院管辖地起诉,违约一方或对合同争议承担主要责任的一方,应承担对方因仲裁和起诉而产生的全部律师代理费、鉴定(检验)费、诉讼保全费、诉讼保险费、公告费、差旅费、执行费、误工费和获取证据产生费用等其他相关费用。
2、双方本合同相关权利放弃均应有双方书面作出并加盖公章或授权委托人签字后生效。
</view>
</view>
<view class="flex justify-start items-start flex-col">
<view class="m-10">不可抗力:</view>
<view class=" pl-20 flex-1 py-20">
甲乙双方的任何一方由于不可抗力或突发公共事件的原因不能履行合同时,应及时向对方通报不能履行或不能完全履行的理由,以减轻可能给对方造成的损失,在取得有关机构证明以后,允许延期履行、部分履行或者不履行合同,并根据情况可部分或全部免予承担违约责任。
</view>
</view>
<view class="flex justify-start items-start flex-col">
<view class="m-10">其他:</view>
<view class=" pl-20 flex-1 py-20">
本合同的全部内容由双方平等共同协商一致,共同起草制定,非一方事先拟定,不属于格式条款。本合同自双方签字盖章后生效(包括电子签字、盖章),按本合同内容地址、联系方式寄送的一切文书、函件送达与否,均为视为送达有法律效力,通知途径和本合同内联系方式或地址送达文件双方均予以验证。
</view>
</view>
<view class="flex justify-start items-start flex-col">
<view class="lb m-right-20">采购方补充条款:</view>
<view class="vl w-100p">
<u--textarea
placeholder="请输入内容"
v-model="formData.supplementary"
></u--textarea>
</view>
</view>
</view>
<view class="card-title m-top-30">采购商信息</view>
<view class="group flex align-center m-top-30">
<view class="lb m-right-20">{{ userInfo.accountType === 2 ? '公司信息' : '个人信息' }}</view>
<view class="vl flex-1">
<u--input
placeholder="请输入内容"
v-model="formData.companyName"
></u--input>
</view>
</view>
<view class="group flex align-center m-top-30">
<view class="lb m-right-20">{{ userInfo.accountType === 2 ? '公司联系方式' : '个人联系方式' }}</view>
<view class="vl flex-1">
<u--input
placeholder="请输入内容"
v-model="formData.companyMobile"
></u--input>
</view>
</view>
<view class="group flex align-center m-top-30">
<view class="lb m-right-20">联系人:</view>
<view class="vl flex-1" @click="showPicker = true">
<u--input
style="pointer-events:none"
readonly
placeholder="点击选择联系人"
v-model="formData.businessName"
suffixIcon="arrow-right"
></u--input>
</view>
</view>
<view class="group flex align-center m-top-30">
<view class="lb m-right-20">联系方式:</view>
<view class="vl flex-1">
<u--input
disabled
placeholder="请输入内容"
v-model="formData.businessMobile"
></u--input>
</view>
</view>
<!-- <view class="template-tab flex justify-start m-top-30 p-top-20">-->
<!-- <view :class="['ttb', {active: ttbIndex == 1}]" @click="handTtb(1)">标准合同模板</view>-->
<!-- <view :class="['ttb', {active: ttbIndex == 2}]" @click="handTtb(2)">自定义合同模板</view>-->
<!-- </view>-->
<!-- <view class="group flex align-center m-top-30">-->
<!-- <view class="lb m-right-20">供应方补充条款:</view>-->
<!-- <view class="vl flex-1">-->
<!-- <u&#45;&#45;input-->
<!-- placeholder="请输入内容"-->
<!-- v-model="value"-->
<!-- @change="change"-->
<!-- ></u&#45;&#45;input>-->
<!-- </view>-->
<!-- </view>-->
<!-- 提交按钮 -->
<p class="text-main my-20 text-25">如发布错误无法重新编辑,请仔细检查后再提交。</p>
<u-button class="public-btn" text="提交加工单" @click="submitAll"></u-button>
<u-calendar :show="show" mode="range" @confirm="confirmRange" color="#A92924" @close="show = false"></u-calendar>
<u-picker :show="showPicker" :columns="[contactList]" keyName="name"
@cancel="showPicker = false" @close="showPicker = false" closeOnClickOverlay
@confirm="confirmContact"></u-picker>
</view>
<AddressSelect ref="AddressSelect" @confirm="regionConfirm"/>
</view>
</template>
<script>
import uititle from '@/components/common/title'
import {INVOICE_TYPE, WRITE_INVOICE_TIME} from "@/util";
import dayjs from "dayjs";
import AddressSelect from "@/components/AddressSelect.vue";
import md5 from "js-md5";
export default {
components: {
AddressSelect,
uititle,
},
computed: {
isNotarizedTrade() {
return this.formData.tradeMethod === 1
}
},
watch: {
'formData.tradeMethod': {
handler() {
this.normalizeTradeMethodPayment()
},
immediate: true
},
'formData.payMethod'(val) {
if (this.isNotarizedTrade) return
if ([1, 2].includes(val)) {
this.formData.advancePayRate = null
}
if (val !== 3) {
this.formData.reputationPayDay = null
}
if (val !== 4) {
this.formData.otherPayMethod = ''
}
}
},
data() {
return {
hasRequire: '2',
show: false,
formData: {
// extraAttributes: {},
// attributes: {},
invoice: false,
salesCode: '',
title: [],
num: '',
detail: '',
remark: '',
transportDocuments: [],
writeInvoiceTime: 0,
taxType: '一般纳税人',
invoiceType: '专用发票',
taxRate: '13%',
invoiceOther: '',
otherTransportDocuments: '',
transportLimit: false,
otherTransportRequest: '',
tradeMethod: 1,
payMethod: 0,
advancePayRate: null,
reputationPayDay: null,
otherPayMethod: '',
offerType: 0,
answerStartTime: '',
answerEndTime: '',
earnestMoney: '',
signMethod: 0,
attachment: '',
productList: [],
multiFiles: [],
files: [],
contractAttachment: [],
supplementary: '',
companyName: '',
companyMobile: '',
businessName: '',
businessMobile: '',
addressDetail: '',
},
productList: [],
answerRange: '',
showPicker: false,
contactList: [],
address: '',
files: [],
multiFiles: [],
contractFiles: [],
userInfo: null,
selectAll: false,
};
},
methods: {
INVOICE_TYPE() {
return INVOICE_TYPE
},
WRITE_INVOICE_TIME() {
return WRITE_INVOICE_TIME
},
handTag(val) {
val.checked = !val.checked
},
handTtb(index) {
this.ttbIndex = index
},
showAddress() {
this.$refs.AddressSelect.open(this.formData.addressRegion);
},
regionConfirm({province, city, area}) {
this.formData.addressRegion = {province, city, area}
this.address = `${province.name} ${city.name} ${area.name}`
},
afterRead({file}) {
// console.log(e)
// return;
// for (let i = 0; i < file.length; i++) {
const item = file
if (item.type !== 'application/pdf') {
uni.showToast({
title: '请上传PDF文件',
icon: 'none'
})
return
}
const suffix = item.name.split('.').pop()
uniCloud.uploadFile({
filePath: item.url,
cloudPath: dayjs().format('YYYY/MM/DD') + '/' + md5(item.name + Date.now().toString()) + `.${suffix}`,
success: ({fileID}) => {
uniCloud.getTempFileURL({
fileList: [fileID]
}).then(res => {
this.formData.files.push(res.fileList[0].tempFileURL)
this.files.push({
url: res.fileList[0].tempFileURL,
name: item.name
})
})
}
})
// }
},
afterReadContract(file) {
const item = file.file
console.log(item)
if (item.type !== 'application/pdf') {
uni.showToast({
title: '请上传PDF文件',
icon: 'none'
})
return
}
const suffix = item.name.split('.').pop()
uniCloud.uploadFile({
filePath: item.url,
cloudPath: dayjs().format('YYYY/MM/DD') + '/' + md5(item.name + Date.now().toString()) + `.${suffix}`,
success: ({fileID}) => {
uniCloud.getTempFileURL({
fileList: [fileID]
}).then(res => {
this.formData.contractAttachment.push(res.fileList[0].tempFileURL)
this.contractFiles.push({
url: res.fileList[0].tempFileURL,
name: item.name
})
})
}
})
},
deletePic(field) {
this[field] = []
this.formData[field] = null
},
afterReadMultiFile({file}) {
for (let i = 0; i < file.length; i++) {
const item = file[i]
if (item.type !== 'application/pdf') {
uni.showToast({
title: '请上传PDF文件',
icon: 'none'
})
return
}
const suffix = item.name.split('.').pop()
uniCloud.uploadFile({
filePath: item.url,
cloudPath: dayjs().format('YYYY/MM/DD') + '/' + md5(item.name + Date.now().toString()) + `.${suffix}`,
success: ({fileID}) => {
uniCloud.getTempFileURL({
fileList: [fileID]
}).then(res => {
this.formData.multiFiles.push(res.fileList[0].tempFileURL)
this.multiFiles.push({
url: res.fileList[0].tempFileURL,
name: item.name
})
})
}
})
}
},
deletePicMultiFile({index}) {
this.multiFiles.splice(index, 1)
this.formData.multiFiles.splice(index, 1)
},
getProductList() {
this.productList = []
vk.callFunction({
url: 'client/process/category/pub/getList',
data: {
whereJson: {
level: 1
}
},
}).then(({data}) => {
data.forEach(item => {
this.productList.push(item)
})
})
},
async submitAll() {
this.normalizeTradeMethodPayment()
if (!this.formData.title) return this.$message({message: '请选择加工商品', type: 'error'})
if (!this.formData.num) return this.$message({message: '请输入加工量', type: 'error'})
if (!this.formData.addressRegion || !this.formData.addressDetail) return this.$message({
message: '请选择地址',
type: 'error'
})
if (!this.formData.answerEndTime || !this.formData.answerStartTime) return this.$message({
message: '请选择报价时限',
type: 'error'
})
if (dayjs(this.formData.answerEndTime).isBefore(this.formData.answerStartTime)) return this.$message({
message: '报价结束时限不能早于开始时间',
type: 'error'
})
if (this.formData.payMethod === 0 && !this.formData.advancePayRate) return this.$message({
message: '请填写预付比例',
type: 'error'
})
if (this.formData.payMethod === 3 && !this.formData.reputationPayDay) return this.$message({
message: '请填写回款日期',
type: 'error'
})
this.disabled = true
vk.callFunction({
url: 'client/process/sheet/kh/add',
data: {
...this.formData, ...{
orderNo: dayjs().format('YYYYMMDDHHmm') + Math.ceil((Math.random() * 1000)),
}
}
}).then(() => {
this.disabled = false
this.$message({
message: "您的信息已经提交,等待管理员审核,请您耐心等待!",
type: 'success'
})
setTimeout(() => {
uni.navigateBack()
}, 1500)
})
},
normalizeTradeMethodPayment() {
if (this.formData.tradeMethod === 1) {
this.formData.payMethod = 0
this.formData.advancePayRate = 100
this.formData.reputationPayDay = null
this.formData.otherPayMethod = ''
return
}
if (this.formData.payMethod === 0 && this.formData.advancePayRate === 100) {
this.formData.advancePayRate = null
}
},
selectGoods(item) {
const index = this.formData.productList.indexOf(item._id)
if (this.formData.productList.length === 5 && index === -1) return this.$message({
message: "最多选择5个商品",
type: 'error'
})
if (index === -1) this.formData.productList.push(item._id)
else this.formData.productList.splice(index, 1)
const list = []
this.productList.forEach(item => {
if (this.formData.productList.includes(item._id)) list.push(item.name)
})
this.formData.title = list.join()
},
async getCommonContractUrl() {
const res = await vk.callFunction({
url: 'client/dict/pub/getDetail',
data: {
id: '657d36befe975f63af1f24e7'
},
})
this.commonContractUrl = res.content
},
openDownload() {
// window.open(this.commonContractUrl)
window.location.href = this.commonContractUrl
},
async getContactList() {
const {rows} = await vk.callFunction({
url: 'client/businessContact/kh/getList',
})
this.contactList = rows
if (!this.contactList.length) {
return uni.showModal({
title: '提示',
content: '您还未添加联系人,请先添加联系人',
showCancel: false,
success: res => {
if (res.confirm) {
uni.setStorageSync('user_tab', 8)
uni.switchTab({url: '/pages/user/user'})
}
}
})
}
},
navTo() {
vk.navigateTo({url: '/pages/user/user?menu=business-contact'})
},
confirmRange(val) {
this.formData.answerStartTime = val[0]
this.formData.answerEndTime = val[val.length - 1]
this.answerRange = `${this.formData.answerStartTime}~${this.formData.answerEndTime}`
this.show = false
},
navToContact() {
uni.setStorageSync('user_tab', 8)
uni.switchTab({
url: '/pages/user/user?tab=8'
})
},
confirmContact({value}) {
this.formData.businessName = value[0].name
this.formData.businessMobile = value[0].phone
this.showPicker = false
},
changeSelectAll() {
this.selectAll = !this.selectAll
if (this.selectAll) this.formData.transportDocuments = ['合格证', '检测报告', '销售清单', '磅重']
else this.formData.transportDocuments = []
},
onChangeSelectDocument(e) {
this.selectAll = e.length === 4
}
},
onLoad() {
this.getProductList()
this.getCommonContractUrl()
this.getContactList()
},
onShow() {
this.userInfo = vk.getStorageSync('uni_id_user_info')
// this.formData.companyName = this.userInfo.accountType === 2 ? this.userInfo.company?.companyName : this.userInfo.person?.personName
// this.formData.companyMobile = this.userInfo.accountType === 2 ? this.userInfo.company?.mobile : this.userInfo.person?.mobile
if (this.userInfo.accountType === 2) {
this.formData.companyName = this.userInfo.company.companyName
} else {
this.formData.companyName = this.userInfo.person.personName
}
this.formData.companyMobile = this.userInfo.businessCard.companyMobile
},
}
</script>
<style lang="scss">
page {
background: #ffffff;
}
.layout-header {
margin: 0rpx 30rpx;
padding: 30rpx 0;
border-bottom: 1px solid rgba(169, 41, 36, 0.34);
.big {
font-size: 32rpx;
line-height: 48rpx;
color: #000000;
text-align: center;
}
.small {
font-size: 24rpx;
line-height: 40rpx;
color: #9a9a9a;
text-align: center;
}
}
.public-btn {
width: 95%;
margin-top: 60rpx;
color: #ffffff;
background: #A92924;
}
.layout-publish {
padding: 20rpx 30rpx;
}
.tag-title {
font-size: 26rpx;
line-height: 40rpx;
color: #000000;
.limit {
font-size: 24rpx;
color: #999999;
}
}
.tag-box {
padding: 20rpx 0;
.item {
padding: 6rpx 10rpx;
font-size: 24rpx;
line-height: 32rpx;
color: #555555;
}
.active {
color: #A92924;
}
}
.lb, .fix {
position: relative;
font-size: 26rpx;
line-height: 40rpx;
color: #666666;
}
.lbx {
font-size: 24rpx;
color: #999999;
}
.download {
padding: 8rpx 20rpx;
font-size: 24rpx;
line-height: 36rpx;
color: #A92924;
border: 1px solid #A92924;
}
.need::before {
position: absolute;
left: -16rpx;
top: 50%;
z-index: 9;
margin-top: -12rpx;
content: '*';
color: #A92924;
font-size: 32rpx;
line-height: 1;
}
.card-title {
position: relative;
padding-left: 20rpx;
font-size: 28rpx;
font-weight: 600;
line-height: 48rpx;
color: #A92924;
&:before {
position: absolute;
left: 0;
top: 50%;
z-index: 9;
margin-top: -14rpx;
content: '';
width: 6rpx;
height: 28rpx;
background: #A92924;
}
}
.template-tab {
.ttb {
margin-right: 30rpx;
padding: 6rpx 20rpx;
font-size: 28rpx;
line-height: 40rpx;
color: #333333;
border: 1px solid #f2f2f2;
}
.active {
color: #A92924;
border-color: #A92924;
}
}
.template-content {
padding: 30rpx 0;
}
</style>