12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172 |
- <template>
- <div class="borderless">
- <div class="customer-head">
- <div class="customer-back">
- <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
- @click="backToList">返回列表
- </el-button>
- </div>
- <div class="upper_right_button">
- <el-button type="primary"
- size="small"
- v-if="viewDisabled"
- class="el-button--small-yh "
- :loading="buttonLoading"
- @click.stop="openDisabled()">编辑
- </el-button>
- <el-dropdown style="padding: 0 8px;line-height: 0">
- <el-button
- type="warning"
- :loading="buttonLoading"
- :disabled="!form.id || viewDisabled"
- size="small"
- >
- 账单处理<i class="el-icon-arrow-down el-icon--right"></i>
- </el-button>
- <el-dropdown-menu slot="dropdown">
- <el-dropdown-item
- :disabled="!form.id || viewDisabled"
- :loading="buttonLoading"
- @click.native="applySettlement('收费')">生成账单
- </el-dropdown-item>
- <el-dropdown-item
- :disabled="!form.id || viewDisabled"
- :loading="buttonLoading"
- @click.native="applySettlement('申请')">申请退款
- </el-dropdown-item>
- <el-dropdown-item
- :loading="buttonLoading"
- @click.native="openApplicationDialog">查看账单
- </el-dropdown-item>
- </el-dropdown-menu>
- </el-dropdown>
- <el-dropdown style="line-height: 0">
- <el-button
- type="success"
- :loading="buttonLoading"
- :disabled="!form.id || viewDisabled"
- size="small"
- >
- 业务处理<i class="el-icon-arrow-down el-icon--right"></i>
- </el-button>
- <el-dropdown-menu slot="dropdown">
- <el-dropdown-item
- :loading="buttonLoading"
- :disabled="!form.id || viewDisabled"
- @click.native="createData()">创建单据
- </el-dropdown-item>
- <el-dropdown-item
- :loading="buttonLoading"
- :disabled="!form.id || viewDisabled"
- @click.native="copyData()">复制单据
- </el-dropdown-item>
- </el-dropdown-menu>
- </el-dropdown>
- <el-button
- class="el-button--small-yh"
- type="primary"
- size="small"
- :disabled="disabled || viewDisabled"
- :loading="buttonLoading"
- @click="editCustomer"
- >保存数据
- </el-button>
- </div>
- </div>
- <div class="customer-main">
- <el-form :model="form" ref="form" label-width="130px">
- <containerTitle title="基础信息"></containerTitle>
- <basic-container style="margin-bottom: 10px" :showBtn="true">
- <el-row>
- <el-col v-for="(item, index) in basicData.column" :span="item.span?item.span:8" :key="index">
- <el-form-item :label="item.label" :prop="item.prop" :rules="item.rules">
- <el-date-picker v-if="item.type === 'datetime'" style="width: 100%;" v-model="form[item.prop]" :disabled="viewDisabled || takeDisabled" size="small" type="date" placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss"/>
- <el-select v-else-if="item.type === 'select'" style="width: 100%" v-model="form[item.prop]" :disabled="viewDisabled || takeDisabled" size="small" placeholder="请选择" clearable filterable>
- <el-option
- v-for="(data, index) in item.dicData"
- :key="index"
- :label="data.label"
- :value="data.value"
- ></el-option>
- </el-select>
- <el-select v-else-if="item.prop === 'currency'" style="width: 100%" v-model="form[item.prop]" :disabled="viewDisabled || takeDisabled" size="small" placeholder="请选择" @change="currencyChange" clearable filterable>
- <el-option v-for="(item,index) in currencyDic" :key="index" :label="item.dictValue" :disabled="viewDisabled || takeDisabled" :value="item.dictValue"></el-option>
- </el-select>
- <crop-select
- v-else-if="item.prop === 'corpId'"
- v-model="form[item.prop]"
- corpType="KH"
- :disabled="viewDisabled || takeDisabled"
- style="width: 100%"
- ></crop-select>
- <crop-select
- v-else-if="item.prop === 'belongToCorpId'"
- v-model="form[item.prop]"
- :disabled="viewDisabled || takeDisabled"
- corpType="GS"
- ></crop-select>
- <el-input type="age" v-else-if="item.type === 'unit'" v-model="form[item.prop]" @change="downPaymentChange" :disabled="viewDisabled|| takeDisabled " size="small" autocomplete="off" placeholder="请输入">
- <template slot="append">%</template>
- </el-input>
- <el-input type="textarea" v-else-if="(item.prop === 'orderRemark')" v-model="form[item.prop]" :disabled="viewDisabled" size="small" autocomplete="off" placeholder="请输入"></el-input>
- <el-input type="age" v-else v-model="form[item.prop]" size="small" :disabled="item.disabled?true:false || viewDisabled" autocomplete="off" placeholder="请输入"></el-input>
- </el-form-item>
- </el-col>
- </el-row>
- </basic-container>
- <!-- 销售明细-->
- <containerTitle title="销售明细"></containerTitle>
- <basic-container >
- <avue-crud
- :option="importInventory"
- v-model="importInventoryForm"
- :data="importInventoryData"
- ref="importInventory"
- @row-save="rowSaveList"
- @row-update="rowUpdateList"
- @row-del="rowDelList"
- @selection-change="productSelection"
- @saveColumn="saveColumn"
- @resetColumn="resetColumn"
- >
- <template slot-scope="{row}" slot="billNo">
- <span v-if="row.$cellEdit" class="required_fields">*</span>
- <el-input
- v-if="row.$cellEdit"
- v-model="row.billNo"
- style="width: 90%"
- placeholder=" "
- size="small"
- @change="bingOut(row)"
- ></el-input>
- <span v-else>{{ row.billNo }}</span>
- </template>
- <template slot-scope="{row}" slot="orgOrderNo">
- <span v-if="row.$cellEdit" class="required_fields">*</span>
- <el-select
- v-if="row.$cellEdit"
- style="width:90% !important;"
- v-model="row.orgOrderNo"
- placeholder=" "
- size="small"
- clearable
- filterable
- >
- <el-option
- v-for="(item,index) in contractDic"
- :key="index"
- :label="item.orderNo"
- :value="item.orderNo"
- ></el-option>
- </el-select>
- <span v-else>{{ row.orgOrderNo }}</span>
- </template>
- <template slot="price" slot-scope="{ row }">
- <el-input
- v-if="row.$cellEdit"
- v-model="row.price"
- placeholder="请输入"
- size="small"
- oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
- ></el-input>
- <!-- @input="priceChange(row)"-->
- <span v-else>{{ row.price }}</span>
- </template>
- <template slot="orderQuantity" slot-scope="{ row }">
- <span v-if="row.$cellEdit" class="required_fields">*</span>
- <el-input
- v-if="row.$cellEdit"
- v-model="row.orderQuantity"
- style="width: 90%"
- placeholder="请输入"
- size="small"
- oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
- ></el-input>
- <span v-else>{{ row.orderQuantity | roundNumbers}}</span>
- </template>
- <template slot="priceCategory" slot-scope="{row,index}">
- <span v-if="row.$cellEdit" class="required_fields">*</span>
- <goods-select
- style="width:90% !important;"
- v-if="row.$cellEdit"
- v-model="row.priceCategoryNames"
- @valueName="(value) => valueName(value,row)"
- :configuration="itemConfiguration"
- >
- </goods-select>
- <span v-else>{{ row.priceCategoryNames }}</span>
- </template>
- <template slot="invoiceWeight" slot-scope="{ row }">
- <span v-if="row.$cellEdit" class="required_fields">*</span>
- <el-input
- v-if="row.$cellEdit"
- v-model="row.invoiceWeight"
- style="width: 90%"
- placeholder="请输入"
- size="small"
- oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d\d\d\d\d).*$/, "$1.$2")'
- @change="totalChange(row.invoiceWeight)"
- ></el-input>
- <span v-else>{{ row.invoiceWeight }}</span>
- </template>
- <template slot="billWeight" slot-scope="{ row }">
- <el-input
- v-if="row.$cellEdit"
- v-model="row.billWeight"
- placeholder="请输入"
- style="width: 90%"
- size="small"
- oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d\d\d\d\d).*$/, "$1.$2")'
- @change="totalChange(row.billWeight)"
- ></el-input>
- <!-- @input="billWeightChange(row)"-->
- <span v-else>{{ row.billWeight }}</span>
- </template>
- <template slot="amount" slot-scope="{ row }">
- <el-input
- v-if="row.$cellEdit"
- v-model="row.amount"
- placeholder="请输入"
- size="small"
- oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d).*$/, "$1.$2")'
- ></el-input>
- <span v-else>{{ row.amount }}</span>
- </template>
- <template slot="taxRate" slot-scope="{ row }">
- <el-input
- v-if="row.$cellEdit"
- v-model="row.taxRate"
- size="small"
- oninput='this.value=this.value.replace(/[^(\d.)]/g,"").replace(/^(\d+)\.(\d\d\d\d\d\d).*$/, "$1.$2")'
- autocomplete="off"
- >
- <i slot="suffix" style="margin-top:3px;margin-right: 10px;display:inline-block">%</i>
- </el-input>
- <span v-else>{{ row.taxRate | isPercentage}}</span>
- </template>
- <template slot="actualQuantity" slot-scope="{ row }">
- <span>{{ row.actualQuantity | roundNumbers}}</span>
- </template>
- <template slot="menuLeft" slot-scope="{ row }">
- <el-button type="primary"
- icon="el-icon-plus"
- size="small"
- :disabled=" viewDisabled"
- :loading="buttonLoading"
- @click="newDetails"
- >录入明细</el-button>
- <el-button type="warning"
- size="small"
- :loading="buttonLoading"
- :disabled="selection.length < 1 || viewDisabled"
- @click="generateShipmentD"
- >生成发货单
- </el-button>
- <!-- <el-button type="info"
- size="small"
- :disabled="importInventoryData.length < 1"
- @click="payeeDialog = true"
- >收款记录
- </el-button>-->
- </template>
- <template slot-scope="{row,index}" slot="menu">
- <el-button
- type="text"
- size="small"
- icon="el-icon-edit"
- :disabled=" viewDisabled"
- @click="rowCell(row,index)"
- >{{ row.$cellEdit ? '修改完成' : '修改' }}
- </el-button>
- <el-button
- type="text"
- size="small"
- icon="el-icon-delete"
- :disabled=" viewDisabled"
- @click="rowDelList(row,index)"
- >删除
- </el-button>
- </template>
- </avue-crud>
- </basic-container>
- <fee-info
- ref="feeInfo"
- @beforeFinance="beforeFinance"
- @afterFinance="afterFinance"
- :disabled=" viewDisabled"
- :orderFeesList="orderFeesList"
- :itemType="'采购'"
- :optionType="'JK'"
- feeUrl=""
- />
- <upload-file
- ref="uploadFile"
- title="合同附件"
- :disabled=" viewDisabled"
- :orderFilesList="orderFilesList || viewDisabled"
- delUrl=""
- />
- </el-form>
- </div>
- <el-dialog
- title="收款记录"
- append-to-body
- class="el-dialogDeep"
- :visible.sync="payeeDialog"
- width="60%"
- :close-on-click-modal="false"
- :destroy-on-close="true"
- :close-on-press-escape="false"
- v-dialog-drag>
- <basic-container>
- <avue-crud :option="importInventory"
- :table-loading="payeeLoading"
- :data="payeeData"
- ref="applicationCrud"
- @refresh-change="payeeRefreshChange"
- :page.sync="payeePage"
- @on-load="payeeOnLoad"></avue-crud>
- </basic-container>
- <span slot="footer" class="dialog-footer">
- <el-button @click="payeeDialog = false ">关 闭</el-button>
- </span>
- </el-dialog>
- <el-dialog
- append-to-body
- class="el-dialogDeep"
- :visible.sync="applySettlementDialog"
- width="60%"
- :close-on-click-modal="false"
- :destroy-on-close="true"
- :close-on-press-escape="false"
- v-dialog-drag
- >
- <apply-payment
- :billUrl="billUrl"
- :billType="billType"
- :billData="billData"
- @choceFun="choceFun"
- >
- </apply-payment>
- </el-dialog>
- <el-dialog
- title="收款记录"
- append-to-body
- class="el-dialogDeep"
- :visible.sync="applicationDialog"
- width="60%"
- :close-on-click-modal="false"
- :destroy-on-close="true"
- :close-on-press-escape="false"
- v-dialog-drag
- >
- <bill-application
- :billId="form.id"
- @choceApplication="choceApplication"
- >
- </bill-application>
- </el-dialog>
- </div>
- </template>
- <script>
- import importInventory from './config/importInventory.json';
- import {detailSaleList,
- submitData,
- goodsListRemove,
- getOrgOrderNo
- } from "@/api/importTrade/salesContract"
- import feeInfo from "@/components/fee-info/main";
- import uploadFile from "@/components/upload-file/main";
- import { contrastObj,contrastList } from "@/util/contrastData";
- import _ from "lodash";
- import { isPercentage,roundNumbers } from "@/util/validate";
- //账单组件
- import ApplyPayment from "../../../components/finance/applyPayment";
- import billApplication from "@/components/bill/billApplication";
- export default {
- name: "detailsPage",
- props: {
- detailData: {
- type: Object
- }
- },
- filters: {
- isPercentage(val) {
- return isPercentage(val);
- },
- roundNumbers(val){
- return roundNumbers(val);
- }
- },
- components: {
- ApplyPayment,
- feeInfo,
- uploadFile,
- billApplication
- },
- data() {
- return {
- disabled: false,
- buttonLoading:false,
- dialogCommodity: false,
- applySettlementDialog:false,
- applicationDialog:false,
- viewDisabled:false,
- takeDisabled:false,
- form: {},
- orderFeesList:[],
- orderFilesList:[],
- currencyDic:[],
- contractDic:[],
- selectKind:-1,
- billUrl:"",
- billType:"",
- billData:{},
- itemConfiguration:{
- multipleChoices:false,
- multiple:false,
- disabled:false,
- searchShow:true,
- collapseTags:false,
- placeholder:'请点击右边按钮选择',
- dicData:[]
- },
- // 基础信息
- basicData: {
- column: [
- {
- label: '系统号',
- prop: 'sysNo',
- disabled:true,
- rules: [
- {
- required: false,
- message: ' ',
- trigger: 'blur'
- }
- ]
- },
- {
- label: '客户名称',
- span:16,
- prop: 'corpId',
- rules: [
- {
- required: true,
- message: ' ',
- trigger: 'blur'
- }
- ]
- },
- {
- label: '合同号',
- prop: 'orderNo',
- rules: [
- {
- required: true,
- message: ' ',
- trigger: 'blur'
- }
- ]
- },
- {
- label: '所属公司',
- prop: 'belongToCorpId',
- span: 16,
- dicData: [],
- rules: [
- {
- required: true,
- message: ' ',
- trigger: 'blur'
- }
- ]
- },
- {
- label: '合同日期',
- prop: 'businesDate',
- type:'datetime',
- data: [],
- rules: [
- {
- required: false,
- message: ' ',
- trigger: 'blur'
- }
- ]
- },
- {
- label: '合同金额',
- prop: 'orderAmount',
- rules: [
- {
- pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
- message: ' ',
- trigger: 'blur'
- }
- ]
- },
- {
- label: '合同重量(吨)',
- prop: 'contractWeight',
- rules: [
- {
- required: false,
- message: ' ',
- trigger: 'blur'
- }
- ]
- },
- {
- label: '销售单价',
- prop: 'salesPrice',
- rules: [
- {
- required: false,
- message: ' ',
- trigger: 'blur'
- }
- ]
- },
- {
- label: '币别',
- prop: 'currency',
- }, {
- label: '汇率',
- prop: 'exchangeRate',
- rules: [
- {
- required: false,
- message: ' ',
- trigger: 'blur'
- }
- ]
- },
- {
- label: '客户首付日期',
- prop: 'advanceCollectionDate',
- type: 'datetime',
- rules: [
- {
- required: false,
- message: ' ',
- trigger: 'blur'
- }
- ]
- },
- {
- label: '首付比例',
- type:"unit",
- prop: 'downPayment',
- rules: [
- {
- required: false,
- message: ' ',
- trigger: 'blur'
- }
- ]
- },
- {
- label: '首付金额',
- prop: 'advancePayment',
- rules: [
- {
- pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
- message: ' ',
- trigger: 'blur'
- }
- ]
- },
- {
- label: '已收人民币金额',
- prop: 'settlmentAmount',
- disabled: true,
- },
- {
- label: '已收外币金额',
- prop: 'foreignSettlmentAmount',
- disabled: true,
- },
- {
- label: '计划交期',
- prop: 'plannedDeliveryDate',
- type: 'datetime',
- },
- {
- label: '已退人民币金额',
- prop: 'refundSettlmentAmount',
- disabled: true,
- },
- {
- label: '已退外币金额',
- prop: 'refundForeignSettlmentAmount',
- disabled: true,
- },
- {
- label: '业务员',
- prop: 'salesName',
- dicData: [],
- },
- {
- label: '发票重量',
- prop: 'invoiceWeight',
- disabled: true,
- },
- {
- label: '码单重量',
- prop: 'billWeight',
- disabled: true,
- },
- {
- label: '开票单位',
- prop: 'vbrk',
- },
- {
- label: '包装要求',
- prop: 'packageRemarks',
- rules: [
- {
- required: false,
- message: ' ',
- trigger: 'blur'
- }
- ]
- },
- {
- label: '提成标准',
- prop: 'commissionRate',
- rules: [
- {
- required: false,
- message: ' ',
- trigger: 'blur'
- }
- ]
- },{
- label: "备注",
- span: 24,
- prop: "orderRemark",
- mock: {
- type: 'county'
- }
- }
- ],
- },
- //收款记录
- payeeDialog:false,
- payeeLoading:false,
- payeeData:[],
- payeePage:{
- pageSize: 10,
- currentPage: 1,
- total: 0
- },
- // 导入库存配置
- importInventory: {},
- importInventoryForm: {},
- importInventoryData: [],
- selection: [],
- //新旧数据对比
- oldForm:{},
- oldInventoryData:[],
- oldFeesList:[],
- oldFilesList:[],
- }
- },
- async created() {
- this.importInventory = await this.getColumnData(this.getColumnName(39), importInventory);
- //币别
- this.getWorkDicts("currency").then(res =>{
- this.currencyDic = res.data.data
- if(!this.detailData.id){
- this.$set(this.form,"currency","USD")
- this.currencyChange("USD")
- }
- })
- if(this.detailData.view){
- this.viewDisabled = true
- }
- if (this.detailData.id) {
- this.buttonLoading = true;
- let id = this.detailData.id.replace(/\"/g, "")
- detailSaleList(id).then(res => {
- this.afterEcho(res.data.data)
- }).finally(()=>{
- this.buttonLoading = false
- })
- }else{
- //采购日期默认当天
- let date = new Date();
- let strDate = date.getFullYear() + "-" + (date.getMonth() + 1) + "-" + date.getDate() + " " + date.getHours() + ":" + date.getMinutes() + ":" + date.getSeconds();
- this.$set(this.form,"businesDate",strDate)
- }
- },
- methods: {
- //编辑按钮
- openDisabled(){
- this.viewDisabled = false
- },
- valueName(value,row){
- this.$set(row,"priceCategory",value.id)
- },
- //首付比例 带出金额
- downPaymentChange(){
- if(this.form.orderAmount){
- this.$set(this.form,"advancePayment",_.multiply(this.form.orderAmount,(this.form.downPayment*0.01)).toFixed(2))
- }
- },
- //合计
- totalChange(){
- let invoiceList = this.importInventoryData.map(item => {
- if(item.invoiceWeight){
- return parseFloat(item.invoiceWeight);
- }else return 0
- });
- let billList = this.importInventoryData.map(item => {
- if(item.billWeight){
- return parseFloat(item.billWeight);
- }else return 0
- });
- this.$set(this.form,"invoiceWeight", invoiceList.reduce((n,m) => n + m))
- this.$set(this.form,"billWeight", billList.reduce((n,m) => n + m))
- },
- //带出汇率
- currencyChange(value){
- this.currencyDic.forEach(item =>{
- if(item.dictValue === value){
- this.$set(this.form,"exchangeRate",item.remark)
- }
- })
- },
- //单价
- priceChange(row) {
- if (row.price && row.billWeight) {
- row.amount = _.multiply(row.billWeight, row.price).toFixed(2);
- }
- },
- //数量
- billWeightChange(row) {
- if (row.price && row.billWeight) {
- row.amount = _.multiply(row.billWeight, row.price).toFixed(2);
- }
- },
- //提单号带出合同号
- bingOut(row){
- getOrgOrderNo(row.billNo).then(res =>{
- if(res.data.length != 0){
- this.contractDic = res.data;
- row.orgOrderNo = res.data[0].orderNo
- row.itemId = res.data[0].itemId;
- row.priceCategoryNames = res.data[0].itemName[0].cname
- row.priceCategory = res.data[0].itemName[0].id
- row.cntrNo = res.data[0].cntrNo
- }else{
- this.$message.warning("无此提单号记录!");
- this.contractDic = [];
- row.orgOrderNo = ''
- row.itemId = ''
- row.priceCategoryNames = ''
- row.priceCategory = ''
- }
- }).catch(()=>{
- row.orgOrderNo = ''
- })
- },
- //打开申请记录
- openApplicationDialog(){
- this.applicationDialog = true
- },
- //关闭申记录
- choceApplication(){
- this.applicationDialog = false
- },
- //生成账单数据
- beforeBillData(bool,type){
- this.billType = type
- this.billData = {
- srcOrderno:this.form.orderNo,
- itemType:"销售",
- optionType:'JK',
- billNoList: this.importInventoryData.map(item =>{return item.billNo}),
- corpsName:this.form.corpName,
- corpId:this.form.corpId,
- price:this.form.salesPrice,
- accDate:this.form.businesDate,
- currency:this.form.currency,
- exchangeRate:this.form.exchangeRate,
- srcParentId:this.form.id,
- }
- if(type){ //申请货款
- this.billData.srcId = -1
- }
- },
- //费用明细回调验证
- beforeFinance(feesData,callback){
- let params = {}
- if(contrastObj(this.form,this.oldForm) || contrastList(this.importInventoryData,this.oldInventoryData)
- || contrastList(feesData,this.oldFeesList) || contrastList(this.orderFilesList,this.oldFilesList)
- ){
- this.$confirm("数据发生变化,请先提交保存?", {
- confirmButtonText: "保存",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- this.editCustomer();
- }).finally(()=>{
- params.valid = false
- callback(params)
- })
- }else{
- params.valid = true
- params.parentId = this.form.id
- params.srcOrderno = this.form.orderNo
- callback(params)
- }
- },
- //生成账单之后需要更新明细列表的属性
- afterFinance(){
- detailSaleList(this.form.id).then(res => {
- this.afterEcho(res.data.data)
- })
- },
- //财务操作
- applySettlement(type){
- if(this.verificationData()){
- this.beforeBillData(true,type)
- this.applySettlementDialog = true;
- }
- },
- choceFun(){
- this.applySettlementDialog = false
- },
- //刷新
- payeeRefreshChange(){
- console.log(1)
- },
- //申请记录
- payeeOnLoad(){
- console.log(1)
- },
- //商品选中触发
- productSelection(selection){
- this.selection = selection
- },
- //生成发货单
- generateShipmentD(){
- if(this.verificationData()) {
- if (this.$store.getters.goStatus) {
- this.$alert("发货单已存在,请保存发货单再进行操作", "温馨提示", {
- confirmButtonText: "确定",
- type: 'warning',
- callback: action => {
- }
- });
- } else {
- const params = {
- id:this.form.id,
- orderItemIds:this.selection.map(i=>{return i.id})
- }
- this.$router.$avueRouter.closeTag('/importTrade/invoice/index');
- this.$router.push({
- path: "/importTrade/invoice/index",
- query: {form: params},
- });
- }
- }
- },
- //录入明细
- newDetails(){
- const params = {
- price:this.form.salesPrice,
- exRate:this.form.exchangeRate
- }
- this.$refs.importInventory.rowCellAdd(params);
- },
- //商品编辑
- rowCell(row, index) {
- this.$refs.importInventory.rowCell(row, index)
- },
- //新增明细保存触发
- rowSaveList(row, done, loading){
- done()
- },
- //修改明细触发
- rowUpdateList(row, index, done, loading) {
- done(row);
- },
- //删除商品明细触发
- rowDelList(row, index, donerowDel) {
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- if (row.id){
- goodsListRemove(row.id).then(res=>{
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.importInventoryData.splice(index, 1);
- })
- }else {
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.importInventoryData.splice(index, 1);
- }
- }).finally(()=>{
- this.totalChange()
- })
- },
- //修改
- editCustomer(status) {
- this.$refs["form"].validate((valid) => {
- if (valid) {
- let orderFeesList = this.$refs.feeInfo.submitData();
- for (let i = 0; i < orderFeesList.length; i++) {
- if (orderFeesList[i].corpId == null) {
- return this.$message.error(`请输入第${i + 1}行的结算中心`);
- }
- if (orderFeesList[i].price == 0) {
- return this.$message.error(`请正确输入第${i + 1}行的价格`);
- }
- if (orderFeesList[i].orderQuantity == 0) {
- return this.$message.error(`请正确输入第${i + 1}行的件数`);
- }
- }
- let orderUpLoadList = this.$refs.uploadFile.submitData();
- for (let j = 0; j < this.importInventoryData.length; j++) {
- if (this.importInventoryData[j].billNo === (null || "")) {
- return this.$message.error(`请输入销售明细第${j + 1}行的提单号`);
- }
- if (this.importInventoryData[j].orgOrderNo === (null || "")) {
- return this.$message.error(`请输入销售明细第${j + 1}行的合同号`);
- }
- if (this.importInventoryData[j].priceCategory === (null || "")) {
- return this.$message.error(`请输入销售明细第${j + 1}行的货品物种`);
- }
- if (this.importInventoryData[j].orderQuantity === (null || "")) {
- return this.$message.error(`请输入销售明细第${j + 1}行的件数`);
- }
- if (this.importInventoryData[j].invoiceWeight === (null || "")) {
- return this.$message.error(`请输入销售明细第${j + 1}行的发票重量`);
- }
- }
- this.buttonLoading = true;
- if(this.importInventoryData.length !== 0){
- //提单号
- this.form.billNo =Array.from(new Set(this.importInventoryData.map(item =>{return item.billNo}))).join(",")
- //发票金额合计 存入主表
- let invoiceList = this.importInventoryData.map(item => {
- if(item.amount){
- return parseFloat(item.amount);
- }else return 0
- });
- this.form.invoiceAmount = invoiceList.reduce((n,m) => n + m)
- }
- let submitDto = {
- ...this.form,
- orderItemsList: this.importInventoryData,
- orderFeesList: orderFeesList,
- orderUpLoadList:orderUpLoadList,
- };
- submitData(submitDto).then(res => {
- if(res.data.success){
- this.$message.success("操作成功!")
- detailSaleList(res.data.data.id).then(res => {
- this.afterEcho(res.data.data)
- }).finally(()=>{
- this.buttonLoading = false
- })
- }
- })
- if(status === true){
- this.$emit("goBack");
- }
- } else {
- return false;
- }
- });
- },
- afterEcho(data){
- this.form = data;
- this.oldForm = Object.assign({},data);
- this.importInventoryData = data.orderItemsList
- //销售明细列表如果存在已发数量或重量不为0 则此订单已发货 禁止编辑主要参数
- this.takeDisabled = this.importInventoryData.map(item =>{if(item.actualQuantity != 0 || item.actualWeight != 0) return true}).some(item => {return item == true})
- this.basicData.column.forEach(item =>{
- if(item.prop == "advanceCollectionDate" || item.prop == "orderAmount" || item.prop == "salesPrice" || item.prop == "exchangeRate" || item.prop == "advancePayment" || item.prop == "orderNo" || item.prop == "contractWeight"){
- item.disabled = this.takeDisabled
- }
- })
- if(data.orderItemsList){
- this.importInventoryData = data.orderItemsList
- this.oldInventoryData = this.deepClone(data.orderItemsList)
- }
- if(data.orderFeesList){
- this.orderFeesList = data.orderFeesList
- this.oldFeesList = this.deepClone(data.orderFeesList)
- }
- if(data.orderFilesList){
- this.orderFilesList = data.orderFilesList
- this.oldFilesList = this.deepClone(data.orderFilesList)
- }
- if(this.detailData.status === 'copy'){
- this.copyData()
- }
- },
- //验证数据
- verificationData(){
- this.orderFeesList = this.$refs.feeInfo.submitData();
- if(contrastObj(this.form,this.oldForm) || contrastList(this.importInventoryData,this.oldInventoryData)
- || contrastList(this.orderFeesList,this.oldFeesList) || contrastList(this.orderFilesList,this.oldFilesList)
- ){
- this.$confirm("数据发生变化,请先提交保存!", "提示", {
- confirmButtonText: "保存",
- cancelButtonText: "取消",
- type: "warning",
- }).then(() => {
- this.editCustomer()
- }).catch(()=>{
- return false
- })
- }else{
- return true
- }
- },
- createData(){
- if(this.verificationData()){
- this.$confirm("确定创建新的单据吗?", "提示", {
- confirmButtonText: "保存",
- cancelButtonText: "取消",
- type: "warning",
- }).then(() => {
- this.form = {}
- this.oldForm = {}
- this.importInventoryData = []
- this.oldInventoryData = []
- this.orderFeesList = []
- this.oldFeesList = []
- this.orderFilesList = []
- this.oldFilesList = []
- })
- }
- },
- //复制单据
- copyData(){
- if(this.verificationData()){
- this.takeDisabled = false
- this.basicData.column.forEach(item =>{
- if(item.prop == "advanceCollectionDate" || item.prop == "orderAmount" || item.prop == "salesPrice" || item.prop == "exchangeRate" || item.prop == "advancePayment" || item.prop == "orderNo" || item.prop == "contractWeight"){
- item.disabled = this.takeDisabled
- }
- })
- delete this.form.id //删除id
- this.$set(this.form,"sysNo","")//系统编号
- this.$set(this.form,"orderNo","")//合同号
- this.$set(this.form,"settlmentAmount","")//已付人民币
- this.$set(this.form,"foreignSettlmentAmount","")//已付外币
- this.$set(this.form,"refundSettlmentAmount","")//已退人民币
- this.$set(this.form,"refundForeignSettlmentAmount","")//已退外币
- this.importInventoryData.forEach(item =>{
- delete item.id //删除id
- item.actualQuantity = "" //已收件数
- item.actualWeight = "" //已收发票
- })
- this.orderFeesList.forEach(item =>{
- delete item.id //删除id
- })
- this.oldForm = {}
- this.oldInventoryData = []
- this.oldFeesList = []
- this.oldFilesList = []
- this.$message.success("复制成功!")
- }
- },
- backToList() {
- this.orderFeesList = this.$refs.feeInfo.submitData();
- if(contrastObj(this.form,this.oldForm) || contrastList(this.importInventoryData,this.oldInventoryData)
- || contrastList(this.orderFeesList,this.oldFeesList) || contrastList(this.orderFilesList,this.oldFilesList)
- ){
- this.$confirm("是否保存当前页面?", "提示", {
- confirmButtonText: "保存",
- cancelButtonText: "取消",
- type: "warning",
- }).then(() => {
- this.editCustomer(true)
- }).catch(()=>{
- this.$emit("goBack");
- })
- }else{
- this.$emit("goBack");
- }
- },
- //列保存触发
- async saveColumn() {
- const inSave = await this.saveColumnData(
- this.getColumnName(39),
- this.importInventory
- );
- if (inSave) {
- this.$message.success("保存成功");
- //关闭窗口
- this.$refs.importInventory.$refs.dialogColumn.columnBox = false;
- }
- },
- async resetColumn() {
- const inSave = await this.delColumnData(
- this.getColumnName(39),
- importInventory
- );
- if (inSave) {
- this.$message.success("重置成功");
- this.importInventory = importInventory;
- //关闭窗口
- this.$refs.importInventory.$refs.dialogColumn.columnBox = false;
- }
- },
- },
- }
- </script>
- <style scoped lang="scss">
- .required_fields{
- color: #F56C6C;
- display:inline-block;
- width: 7%
- }
- .upper_right_button{
- display: flex;
- position: fixed;
- right: 12px;
- top: 47px;
- }
- ::v-deep .el-form-item {
- margin-bottom: 0;
- }
- ::v-deep .el-form-item__content{
- line-height: 32px;
- }
- </style>
|