123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275 |
- <template>
- <div class="borderless">
- <div class="customer-head">
- <div class="customer-back">
- <!-- <i class="back-icon el-icon-arrow-left"></i><i style="font-style:normal">返回管理列表</i>-->
- <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
- @click="backToList">返回列表
- </el-button>
- </div>
- <el-button
- class="el-button--small-yh add-customer-btn"
- style="right: 245px;"
- type="primary"
- @click="revokeOutGoods"
- v-if="form.deliveryStatus !== '录入'"
- >撤销发货</el-button>
- <el-button
- class="el-button--small-yh add-customer-btn"
- style="right: 245px;"
- type="primary"
- @click="sendOutGoods"
- v-if="form.deliveryStatus == '录入'"
- >确认发货</el-button>
- <el-button
- class="el-button--small-yh add-customer-btn"
- type="success" style="right: 140px;" @click="copyOrder">
- 复制新单
- </el-button>
- <el-button
- class="el-button--small-yh add-customer-btn"
- type="primary"
- :disabled="disabled"
- @click="editCustomer(false)"
- >{{ form.id ? '确认修改' : '确认新增' }}
- </el-button>
- </div>
- <div style="margin-top: 60px">
- <el-form :model="form" ref="form" label-width="130px" class="demo-ruleForm">
- <containerTitle title="基础资料"></containerTitle>
- <basic-container style="margin-bottom: 10px">
- <el-row>
- <el-col v-for="(item,index) in basicData.column" :key="index" :span="item.span?item.span:8">
- <el-form-item :label="item.label" :prop="item.prop" :rules="item.rules">
- <!-- <avue-input-tree v-if="item.prop === 'corpsTypeId'" leaf-only multiple :props="{label:'title'}" v-model="form[item.prop]" placeholder="请选择内容" type="tree" :dic="dic"-->
- <!-- ></avue-input-tree>-->
- <el-date-picker v-if="item.type === 'datetime'" style="width: 100%;" v-model="form[item.prop]"
- size="small" type="datetime" placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss" :disabled="item.disabled"/>
- <selectComponent v-else-if="item.prop === 'corpId' || item.prop === 'salesCompany'" v-model="form[item.prop]"
- :configuration="configuration" style="width: 100%"/>
- <el-select v-else-if="item.prop === 'deliveryStatus'" v-model="form[item.prop]" placeholder="请选择" clearable filterable style="width: 100%" size="small" :disabled="item.disabled">
- <el-option v-for="(item,index) in statusOption" :key="index" :label="item.dictValue" :value="item.dictValue" size="small"></el-option>
- </el-select>
- <!-- <avue-input-tree-->
- <!-- v-else-if="item.prop === 'warehouseType'"-->
- <!-- leaf-only-->
- <!-- placeholder="请选择内容"-->
- <!-- :dic="warehouseType"-->
- <!-- type="tree"-->
- <!-- v-model="form[item.prop]"-->
- <!-- style="width: 100%"-->
- <!-- size="small"-->
- <!-- @change="warehouseTreeChange"-->
- <!-- >-->
- <!-- </avue-input-tree>-->
- <el-select v-else-if="item.prop === 'storageId'" v-model="form[item.prop]" placeholder="请选择" clearable filterable style="width: 100%" size="small">
- <el-option v-for="(item,index) in warehouseName" :key="index" :label="item.cname" :value="item.id" size="small"></el-option>
- </el-select>
- <el-input type="textarea" v-else-if="item.type === 'textarea'" v-model="form[item.prop]" size="small" autocomplete="off" :disabled="item.disabled"></el-input>
- <el-input type="age" v-else v-model="form[item.prop]" size="small" autocomplete="off" :disabled="item.disabled"></el-input>
- </el-form-item>
- </el-col>
- </el-row>
- </basic-container>
- <containerTitle title="商品信息"></containerTitle>
- <basic-container style="margin-bottom: 10px">
- <avue-crud
- :option="customerContact"
- v-model="contactsForm"
- :data="contactsData"
- ref="crudContact"
- @row-save="rowSave"
- @row-click="handleRowClick"
- @row-update="rowUpdate"
- @row-del="rowDel"
- @saveColumn="saveColumn('goods')"
- >
- <template slot="code" slot-scope="{row,index}">
- <span style="float: left;padding-top: 2px">{{ row.code }}</span>
- <el-button type="text" size="mini" style="float: right" @click="commodityChoice(row)">选择</el-button>
- </template>
- <template slot-scope="{row,index}" slot="menu">
- <el-button
- type="text"
- size="small"
- @click="rowCell(row,index)"
- >{{ row.$cellEdit ? '保存' : '修改' }}
- </el-button>
- </template>
- <template slot="menuLeft" slot-scope="{size}">
- <el-button type="primary"
- icon="el-icon-plus"
- size="small"
- @click="commoditySelection"
- >录入明细
- </el-button>
- <el-button type="info" :size="size" icon="el-icon-printer">报 表</el-button>
- </template>
- <template slot="actualQuantity" slot-scope="{ row }">
- <el-input
- v-if="row.$cellEdit"
- v-model="row.actualQuantity"
- v-input-limit="0"
- @change="actualQuantityChange(row)"
- ></el-input>
- <span v-else>{{ row.actualQuantity }}</span>
- </template>
- </avue-crud>
- </basic-container>
- <containerTitle title="费用明细"></containerTitle>
- <basic-container style="margin-bottom: 10px">
- <avue-crud
- :option="advantageProject"
- v-model="advantageProjectForm"
- :data="advantageProjectData"
- ref="crudProject"
- @row-save="rowSaveProject"
- @row-update="rowUpdateProject"
- @row-del="rowDelProject"
- @saveColumn="saveColumn('fees')"
- >
- <template slot="code" slot-scope="{row,index}">
- <span style="float: left;padding-top: 2px">{{ row.code }}</span>
- <el-button type="text" size="mini" style="float: right" @click="choice(row)">选择</el-button>
- </template>
- <template slot="corpId" slot-scope="{ row }">
- <selectComponent v-if="row.$cellEdit" v-model="row.corpId"
- :configuration="configuration" @receiveList="receiveList"/>
- <span v-else>
- <span v-for="item in configuration.dicData" v-if="item.id == row.corpId">{{ item.cname }}</span>
- </span>
- </template>
- <template slot-scope="{row,index}" slot="menu">
- <el-button
- type="text"
- size="small"
- @click="rowCellTwo(row,index)"
- >{{ row.$cellEdit ? '保存' : '修改' }}
- </el-button>
- </template>
- <template slot="menuLeft" slot-scope="{size}">
- <el-button type="primary"
- icon="el-icon-plus"
- size="small"
- @click="costIncrease"
- >录入明细
- </el-button>
- </template>
- </avue-crud>
- </basic-container>
- <containerTitle title="附件上传"></containerTitle>
- <basic-container style="margin-bottom: 40px">
- <avue-crud
- :option="bankOfDeposit"
- v-model="bankOfDepositForm"
- :data="bankOfDepositData"
- @row-save="rowSaveBankOfDeposit"
- @row-update="rowUpdateBankOfDeposit"
- @row-del="rowDelBankOfDeposit"
- :upload-after="uploadAfter"
- ></avue-crud>
- </basic-container>
- </el-form>
- </div>
- <el-dialog
- title="导入商品"
- append-to-body
- class="el-dialogDeep"
- :visible.sync="dialogVisible"
- width="80%"
- :close-on-click-modal="false"
- :destroy-on-close="true"
- :close-on-press-escape="false"
- @close="closeGoods">
- <el-row style="height: 0;">
- <el-col :span="5">
- <div>
- <el-scrollbar>
- <basic-container>
- <avue-tree :option="treeOption" :data="treeDataGoods" @node-click="nodeClick"/>
- </basic-container>
- </el-scrollbar>
- </div>
- </el-col>
- <el-col :span="19">
- <basic-container>
- <avue-crud :option="optionTwo"
- :table-loading="loading"
- :data="data"
- ref="crud"
- @refresh-change="refreshChange"
- @selection-change="selectionChange"
- :page.sync="page"
- @on-load="onLoad"></avue-crud>
- </basic-container>
- </el-col>
- </el-row>
- <span slot="footer" class="dialog-footer">
- <el-button @click="dialogVisible = false">取 消</el-button>
- <el-button type="primary" @click="importGoods" v-if="commodityData !== true">导入</el-button>
- <el-button type="primary" @click="importChoice" v-if="commodityData === true"
- :disabled="tableData.length !== 1">导入</el-button>
- </span>
- </el-dialog>
- <el-dialog
- title="导入费用"
- append-to-body
- class="el-dialogDeep"
- :visible.sync="dialogCost"
- width="80%"
- :close-on-click-modal="false"
- :destroy-on-close="true"
- :close-on-press-escape="false"
- @close="closeFees">
- <el-row style="height: 0;">
- <el-col :span="5">
- <div>
- <el-scrollbar>
- <basic-container>
- <avue-tree :option="treeOptionCost" :data="treeData" @node-click="nodeClickCost"/>
- </basic-container>
- </el-scrollbar>
- </div>
- </el-col>
- <el-col :span="19">
- <basic-container>
- <avue-crud :option="optionTwoCost"
- :table-loading="loadingCost"
- :data="dataCost"
- ref="crud"
- @refresh-change="refreshChangeCost"
- @selection-change="selectionChangeCost"
- :page.sync="pageCost"
- @on-load="onLoadCost">
- </avue-crud>
- </basic-container>
- </el-col>
- </el-row>
- <span slot="footer" class="dialog-footer">
- <el-button @click="dialogCost = false">取 消</el-button>
- <el-button type="primary" @click="importCost" v-if="choiceData !== true">导入</el-button>
- <el-button type="primary" @click="choiceCost" v-if="choiceData === true"
- :disabled="tableDataCost.length !== 1">导入</el-button>
- </span>
- </el-dialog>
- </div>
- </template>
- <script>
- import {
- typeSave, detail,
- corpstypeTree,
- corpsattn,
- corpsbank,
- corpsitem,
- getList,
- sendOutGoods,
- revokeOutGoods
- } from "@/api/basicData/deliveryNotice"
- import customerContact from "./configuration/customerContact.json"
- import advantageProject from "./configuration/advantageProject.json"
- import bankOfDeposit from "./configuration/bankOfDeposit.json"
- import commodity from "./configuration/commodity.json"
- import optionTwoCost from "./configuration/mainListCost.json"
- import {getDeptLazyTree,getDeptLazyTreeTwo, customerList} from "@/api/basicData/basicFeesDesc";
- import {customerList as wareHouseType} from "@/api/basicData/basicStorageType"
- import {customerList as selectWareHouse} from "@/api/basicData/basicStorageDesc"
- import {selectGoodsNum} from "@/api/basicData/inventoryAccount"
- import { contrastObj, contrastList } from "@/util/contrastData";
- export default {
- name: "detailsPage",
- props: {
- detailData: {
- type: Object
- }
- },
- data() {
- return {
- configuration: {
- multipleChoices: false,
- multiple: false,
- collapseTags: false,
- placeholder: '请点击右边按钮选择',
- dicData: []
- },
- form: {},
- data: [],
- loadingCost: false,
- choiceData: false,
- commodityData: false,
- dataCost: [],
- treeDataGoods: [],
- treeData: [],
- choiceIndex: '',
- dialogCost: false,
- treeDeptId: '',
- treeDeptIdCost: '',
- pageCost: {
- pageSize: 10,
- currentPage: 1,
- total: 0
- },
- page: {
- pageSize: 10,
- currentPage: 1,
- total: 0
- },
- loading: false,
- contactsForm: {},
- optionTwo: commodity,
- optionTwoCost: optionTwoCost,
- treeOptionCost: {
- nodeKey: 'id',
- lazy: true,
- treeLoad: function (node, resolve) {
- const parentId = (node.level === 0) ? 0 : node.data.id;
- getDeptLazyTree(parentId).then(res => {
- resolve(res.data.data.map(item => {
- return {
- ...item,
- leaf: !item.hasChildren
- }
- }))
- });
- },
- addBtn: false,
- menu: false,
- size: 'small',
- props: {
- labelText: '标题',
- label: 'title',
- value: 'value',
- children: 'children'
- }
- },
- treeOption: {
- nodeKey: 'id',
- lazy: true,
- treeLoad: function (node, resolve) {
- const parentId = (node.level === 0) ? 0 : node.data.id;
- getDeptLazyTreeTwo(parentId).then(res => {
- resolve(res.data.data.map(item => {
- return {
- ...item,
- leaf: !item.hasChildren
- }
- }))
- });
- },
- addBtn: false,
- menu: false,
- size: 'small',
- props: {
- labelText: '标题',
- label: 'title',
- value: 'value',
- children: 'children'
- }
- },
- dialogVisible: false,
- advantageProjectForm: {},
- bankOfDepositForm: {},
- contactsData: [],
- advantageProjectData: [],
- disabled: false,
- bankOfDepositData: [],
- tableDataCost: [],
- dic: [],
- tableData: [],
- customerContact: {},
- advantageProject: {},
- bankOfDeposit: bankOfDeposit,
- basicData: {
- column: [
- {
- label: '系统编号',//发货通知(点击)
- prop: 'sysNo',
- disabled: true,
- rules: [
- {
- required: false,
- message: ' ',
- trigger: 'blur'
- }
- ]
- }, {
- label: '客户名称',
- prop: 'corpId',
- rules: [
- {
- required: true,
- message: ' ',
- trigger: 'blur'
- }
- ]
- }, {
- label: '单据状态',
- prop: 'deliveryStatus',
- disabled: true,
- rules: [
- {
- required: true,
- message: ' ',
- trigger: 'blur'
- }
- ]
- }, {
- label: '所属公司',
- prop: 'salesCompany', //salesCompany
- rules: [
- {
- required: true,
- message: ' ',
- trigger: 'blur'
- }
- ]
- }, {
- label: '仓库类型',
- prop: 'warehouseType',//字典表
- rules: [
- {
- required: true,
- message: ' ',
- trigger: 'blur'
- }
- ]
- }, {
- label: '仓库名称',
- prop: 'storageId',
- rules: [
- {
- required: true,
- message: ' ',
- trigger: 'blur'
- }
- ]
- },{
- label: '匹配订单号',
- prop: 'srcOrderNo',
- rules: [
- {
- required: true,
- message: ' ',
- trigger: 'blur'
- }
- ]
- }, {
- label: '出库金额',
- prop: 'deliveryAmount',
- disabled: true,
- rules: [
- {
- required: true,
- message: ' ',
- trigger: 'blur'
- }
- ]
- }, {
- label: '出库数量',
- prop: 'totalQuantity',
- disabled: true,
- rules: [
- {
- required: true,
- message: ' ',
- trigger: 'blur'
- }
- ]
- }, {
- label: '出库日期',
- prop: 'businessDate',
- type: 'datetime',
- rules: [
- {
- required: true,
- message: ' ',
- trigger: 'blur'
- }
- ]
- }, {
- label: '制单时间',
- type: 'datetime',
- prop: 'createTime',
- disabled: true,
- rules: [
- {
- required: false,
- message: ' ',
- trigger: 'blur'
- }
- ]
- }, {
- label: '费用合计',
- prop: 'totalCost',
- rules: [
- {
- required: true,
- message: ' ',
- trigger: 'blur'
- }
- ]
- }, {
- label: "备注",
- span: 24,
- type: 'textarea',
- prop: "otherRemarks",
- mock: {
- type: 'county'
- }
- }
- ]
- },
- statusOption: [],
- // 仓库类型
- warehouseType: [],
- // 仓库名称
- warehouseName: [],
- maxFeeNum: 0,
- maxGoodsNum: 0,
- oldForm: {
- orderStatus: "录入"
- },
- oldGoodsList: [],
- oldFeesList: [],
- oldUploadList: [],
- }
- },
- //初始化查询
- async created() {
- this.customerContact = await this.getColumnData(this.getColumnName(21), customerContact);
- this.advantageProject = await this.getColumnData(this.getColumnName(22), advantageProject);
- this.getWorkDicts("order_status").then(res => {
- this.statusOption = res.data.data
- })
- this.$set(this.form,'deliveryStatus','录入')
- wareHouseType().then(res => {
- this.warehouseType = res.data.data.records
- this.warehouseType.forEach(item => {
- this.$set(item, 'label', item.cname)
- this.$set(item, 'value', item.id)
- if (item.hasChildren) {
- this.$set(item, 'children', [])
- }
- })
- let result = [], temp = {}
- for(let i = 0; i < this.warehouseType.length;i++) {
- temp[this.warehouseType[i].id] = this.warehouseType[i]
- }
- for (let j = 0;j < this.warehouseType.length;j++) {
- let current = this.warehouseType[j]
- let tempCurrentParent = temp[current.parentId]
- if (tempCurrentParent) {
- if (!tempCurrentParent["children"]) {
- tempCurrentParent["children"] = []
- }
- tempCurrentParent["children"].push(current)
- } else {
- result.push(current)
- }
- }
- this.warehouseType = result
- });
- selectWareHouse().then(res => {
- console.log(res)
- this.warehouseName = res.data.data.records
- })
- if (this.detailData.id) {
- let id = this.detailData.id
- this.queryData(id)
- }else if (this.detailData.form){
- this.form = JSON.parse(this.detailData.form);
- delete this.form.createTime
- delete this.form.id
- delete this.form.sysNo
- this.contactsData = this.form.orderItemsList
- delete this.form.orderItemsList
- this.configuration.dicData = this.form.corpName
- delete this.form.corpName
- this.$set(this.form, 'deliveryStatus', '录入')
- if (this.form.belongToCorpList) {
- this.$set(this.form, 'salesCompany', this.form.belongToCorpId)
- delete this.form.belongToCorpId
- this.configuration.dicData = this.configuration.dicData.concat(this.form.belongToCorpList)
- }
- delete this.form.belongToCorpList
- this.$set(this.form, 'deliveryAmount', 0)
- this.$set(this.form, 'totalQuantity', 0)
- this.$set(this.form, 'totalCost', 0)
- this.contactsData.forEach(item => {
- this.$set(item, 'orgOrderNo', this.form.orgOrderNo)
- this.$set(item, "srcId", item.id)
- this.$set(item, "actualQuantity", (Number(item.orderQuantity) - Number(item.actualQuantity)))
- this.$set(item, "deliveryAmount", item.amount)
- this.$set(item, "inventoryNumber", item.storageQuantity)
- this.$set(item, "inventoryAmount", 0)
- this.form.deliveryAmount += Number(item.deliveryAmount)
- this.form.totalQuantity += Number(item.actualQuantity)
- this.form.totalCost += Number(item.deliveryAmount)
- // 出库数量和出库金额的比例
- this.$set(item, 'scale', (item.deliveryAmount / item.actualQuantity))
- delete item.id
- delete item.pid
- })
- } else if (this.detailData.copyId) {
- let id = this.detailData.copyId
- this.queryData(id, true)
- }
- },
- watch: {
- },
- methods: {
- queryData(id, isCopy = false) {
- detail(id).then(res => {
- console.log(res.data.data)
- this.form = res.data.data;
- this.contactsData = this.form.deliveryItemsList
- this.advantageProjectData = this.form.deliveryFeesList
- this.bankOfDepositData = this.form.deliveryFilesList
- this.configuration.dicData = this.form.corpName
- this.form.deliveryAmount = 0
- this.form.totalQuantity = 0
- this.contactsData.forEach(item => {
- this.form.deliveryAmount += Number(item.deliveryAmount)
- this.form.totalQuantity += Number(item.actualQuantity)
- // 出库金额和出库数量的比例
- this.$set(item, 'scale', (item.deliveryAmount / item.actualQuantity))
- })
- console.log(this.contactsData)
- if (this.form.companyName) {
- this.configuration.dicData = this.configuration.dicData.concat(this.form.companyName)
- }
- let feesData = []
- this.form.deliveryFeesList.forEach(item => {
- let a = {
- cname: item.corpName,
- id: item.corpId
- }
- feesData.push(a)
- })
- this.configuration.dicData = this.configuration.dicData.concat(feesData)
- // 去重
- this.removeRepeat()
- delete this.form.deliveryItemsList
- delete this.form.deliveryFeesList
- delete this.form.deliveryFilesList
- delete this.form.corpName
- delete this.form.companyName
- // 获取最大值
- let num = []
- this.advantageProjectData.forEach(item => {
- num.push(item.sort)
- })
- if (num.length == 0) {
- this.maxFeeNum = 0;
- } else {
- this.maxFeeNum = num.reduce((a, b) => {
- return b > a? b: a;
- })
- }
- let goodsNum = []
- this.contactsData.forEach(item => {
- goodsNum.push(item.sort)
- })
- if (goodsNum.length == 0) {
- this.maxGoodsNum = 0;
- } else {
- this.maxGoodsNum = goodsNum.reduce((a, b) => {
- return b > a? b: a;
- })
- }
- this.oldGoodsList = []
- this.oldFeesList = []
- this.oldUploadList = []
- this.oldForm = Object.assign({}, this.form)
- this.oldGoodsList = this.oldGoodsList.concat(this.contactsData)
- this.oldFeesList = this.oldFeesList.concat(this.advantageProjectData)
- this.oldUploadList = this.oldUploadList.concat(this.bankOfDepositData)
- if (isCopy) {
- delete this.form.sysNo
- delete this.form.id
- this.contactsData.forEach(item => {
- delete item.id
- delete item.pid
- })
- this.advantageProjectData.forEach(item => {
- delete item.id
- delete item.pid
- })
- this.bankOfDepositData.forEach(item => {
- delete item.id
- delete item.pid
- })
- this.form.deliveryStatus == '录入'
- }
- });
- },
- // 出库数量变化时调用
- actualQuantityChange(row) {
- if (row.scale) {
- row.deliveryAmount = Number(row.actualQuantity) * Number(row.scale)
- this.contactsData.forEach(item => {
- this.form.deliveryAmount += Number(item.deliveryAmount)
- this.form.totalQuantity += Number(item.actualQuantity)
- })
- }
- },
- // 类别变换时触发
- warehouseTreeChange(id) {
- this.warehouseName = []
- if (this.firstComing) {
- if (!this.form.storageId) {
- this.$set(this.form, 'storageId', null)
- } else {
- this.form.storageId = null
- }
- }
- let data = {
- storageTypeId: id
- }
- selectWareHouse(data).then(res => {
- this.warehouseName = res.data.data.records
- })
- this.firstComing = true
- },
- //点击行可编辑
- handleRowClick(row, event, column) {
- console.log(row.$index)
- },
- //商品编辑
- rowCell(row, index) {
- console.log(row)
- this.$refs.crudContact.rowCell(row, index)
- },
- //费用编辑
- rowCellTwo(row, index) {
- console.log(row)
- this.$refs.crudProject.rowCell(row, index)
- },
- //费用新增触发
- costIncrease() {
- this.dialogCost = !this.dialogCost
- this.choiceData = false
- },
- //商品新增触发
- commoditySelection() {
- this.dialogVisible = !this.dialogVisible
- this.tableData = []
- this.commodityData = false
- },
- //点击费用明细选择触发
- choice(row) {
- this.dialogCost = !this.dialogCost
- this.choiceData = true
- console.log(row)
- this.choiceIndex = row.$index
- },
- //点击商品明细选择触发
- commodityChoice(row) {
- this.dialogVisible = !this.dialogVisible
- this.commodityData = true
- console.log(row)
- this.choiceIndexT = row.$index
- },
- //导入商品触发
- importChoice() {
- if (this.tableData.length === 1) {
- this.contactsData[this.choiceIndexT].cname = this.tableData[0].cname
- this.contactsData[this.choiceIndexT].code = this.tableData[0].code
- this.contactsData[this.choiceIndexT].typeno = this.tableData[0].typeno
- this.contactsData[this.choiceIndexT].specificationAndModel = this.tableData[0].specificationAndModel
- this.contactsData[this.choiceIndexT].itemId = this.tableData[0].id
- selectGoodsNum({
- goodsId: this.tableData[0].id,
- typeno: this.tableData[0].typeno
- }).then(res => {
- this.contactsData[this.choiceIndexT].storageQuantity = res.data.data
- })
- }
- this.dialogVisible = !this.dialogVisible
- this.commodityData = false
- },
- //费用编辑导入触发
- choiceCost() {
- console.log('1111')
- if (this.tableDataCost.length === 1) {
- this.advantageProjectData[this.choiceIndex].feeName = this.tableDataCost[0].cname
- this.advantageProjectData[this.choiceIndex].itemId = this.tableDataCost[0].id
- this.advantageProjectData[this.choiceIndex].code = this.tableDataCost[0].code
- }
- this.dialogCost = !this.dialogCost
- this.choiceData = false
- },
- //费用导入触发
- importCost() {
- // this.advantageProjectForm = this.advantageProjectForm.concat(this.tableDataCost)
- if (this.tableDataCost.length > 0) {
- for (let item in this.tableDataCost) {
- console.log(this.tableDataCost[item])
- this.tableDataCost[item].itemId = this.tableDataCost[item].id
- this.tableDataCost[item].feeName = this.tableDataCost[item].cname
- this.tableDataCost[item].sort = this.maxFeeNum + 1
- this.maxFeeNum++
- delete this.tableDataCost[item].id
- this.$refs.crudProject.rowCellAdd(this.tableDataCost[item]);
- this.$refs.crudProject.rowCell(this.tableDataCost[item], this.advantageProjectForm.length - 1)
- }
- }
- this.tableDataCost = []
- this.dialogCost = false
- },
- //确认导入触发
- importGoods() {
- // this.contactsData = this.contactsData.concat(this.tableData)
- if (this.tableData.length > 0) {
- for (let item in this.tableData) {
- console.log(this.tableData[item])
- selectGoodsNum({
- goodsId: this.tableData[item].id,
- typeno: this.tableData[item].typeno
- }).then(res =>{
- this.tableData[item].storageQuantity = res.data.data
- this.$set(this.tableData[item], 'specificationAndModel', this.tableData[item].specificationAndModel)
- this.tableData[item].itemId = this.tableData[item].id
- this.tableData[item].priceCategory = this.tableData[item].goodsTypeName
- delete this.tableData[item].goodsTypeName
- delete this.tableData[item].id
- delete this.tableData[item].status
- delete this.tableData[item].isDeleted
- this.$set(this.tableData[item], 'inventoryNumber', 0)
- this.$set(this.tableData[item], 'actualQuantity', 0)
- this.$set(this.tableData[item], 'inventoryAmount', 0)
- this.$set(this.tableData[item], 'deliveryAmount', 0)
- this.tableData[item].price = 0
- this.tableData[item].amount = 0
- this.tableData[item].sort = this.maxGoodsNum + 1
- this.maxGoodsNum++
- this.$refs.crudContact.rowCellAdd(this.tableData[item]);
- console.log(this.contactsData)
- this.$refs.crudContact.rowCell(this.tableData[item], this.contactsData.length - 1)
- })
- }
- }
- this.dialogVisible = false
- },
- closeGoods() {
- this.treeDataGoods = [];
- this.treeDeptId = "";
- },
- closeFees() {
- this.treeDeptIdCost = "";
- this.treeData = [];
- },
- //选中触发
- selectionChange(list) {
- console.log(list);
- this.tableData = list
- },
- //费用选中触发
- selectionChangeCost(list) {
- console.log(list);
- this.tableDataCost = list
- },
- //导入页左商品类型查询
- nodeClick(data) {
- this.treeDeptId = data.id;
- this.page.currentPage = 1;
- this.onLoad(this.page);
- },
- //导入页左费用类型查询
- nodeClickCost(data) {
- this.treeDeptIdCost = data.id;
- this.pageCost.currentPage = 1;
- this.onLoadCost(this.pageCost);
- },
- //刷新触发
- refreshChange() {
- this.treeDeptId = '';
- this.page.currentPage = 1;
- this.onLoad(this.page);
- },
- //费用刷新触发
- refreshChangeCost() {
- this.treeDeptIdCost = '';
- this.pageCost.currentPage = 1;
- this.onLoadCost(this.pageCost);
- },
- //新增商品信息保存触发
- rowSave(row, done, loading) {
- console.log(row)
- console.log(this.contactsData)
- // this.contactsData.push(row)
- done()
- },
- //修改商品信息触发
- rowUpdate(row, index, done, loading) {
- done(row);
- },
- //删除商品信息触发
- rowDel(row, index, donerowDel) {
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- //商品判断是否需要调用删除接口
- if (row.id) {
- corpsattn(row.id).then(res => {
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.contactsData.splice(index, 1);
- })
- } else {
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.contactsData.splice(index, 1);
- }
- })
- },
- //新增费用明细保存触发
- rowSaveProject(row, done, loading) {
- // this.advantageProjectData.push(row)
- done()
- },
- //修改费用明细触发
- rowUpdateProject(row, index, done, loading) {
- done(row);
- },
- //商品列表查询
- onLoad(page, params = {}) {
- this.loading = true;
- getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.treeDeptId).then(res => {
- console.log(res)
- const data = res.data.data;
- this.page.total = data.total;
- this.data = data.records;
- this.loading = false;
- });
- },
- //费用查询
- onLoadCost(page, params = {}) {
- this.loadingCost = true;
- let queryParams = Object.assign({}, params, {
- pageSize: page.pageSize,
- pageNum: page.currentPage,
- parentId: 0,
- feesTypeId: this.treeDeptIdCost
- })
- customerList(queryParams).then(res => {
- console.log(res)
- const data = res.data.data;
- this.pageCost.total = data.total;
- this.dataCost = data.records;
- this.loadingCost = false;
- });
- },
- //删除费用明细触发
- rowDelProject(row, index, donerowDel) {
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- //费用判断是否需要调用删除接口
- if (row.id) {
- corpsitem(row.id).then(res => {
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.advantageProjectData.splice(index, 1);
- })
- } else {
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.advantageProjectData.splice(index, 1);
- }
- })
- },
- //新增附件上传保存触发
- rowSaveBankOfDeposit(row, done, loading) {
- this.bankOfDepositData.push(row)
- done()
- },
- //修改附件上传触发
- rowUpdateBankOfDeposit(row, index, done, loading) {
- done(row);
- },
- //删除附件上传触发
- rowDelBankOfDeposit(row, index, donerowDel) {
- this.$confirm("确定将选择数据删除?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- //附件判断是否需要调用删除接口
- if (row.id) {
- corpsbank(row.id).then(res => {
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.bankOfDepositData.splice(index, 1);
- })
- } else {
- this.$message({
- type: "success",
- message: "操作成功!"
- });
- this.bankOfDepositData.splice(index, 1);
- }
- })
- },
- uploadAfter(res, done) {
- if (res.originalName) {
- this.bankOfDepositForm.fileName = this.bankOfDepositForm.fileName
- ? this.bankOfDepositForm.fileName
- : res.originalName;
- }
- done();
- },
- // 去重
- removeRepeat() {
- let obj = []
- this.configuration.dicData = this.configuration.dicData.reduce((current,next) => {
- obj[next.id] ? '': obj[next.id] = true && current.push(next)
- return current
- }, [])
- },
- //
- receiveList(data){
- this.configuration.dicData = this.configuration.dicData.concat(data)
- this.removeRepeat()
- },
- //修改提交触发
- editCustomer(isBack = false) {
- console.log(this.form)
- this.$refs["form"].validate((valid) => {
- if (valid) {
- //商品信息
- this.form.deliveryItemsList = this.contactsData
- this.form.deliveryFeesList = this.advantageProjectData
- this.form.deliveryFilesList = this.bankOfDepositData
- if (typeof this.form.corpsTypeId == 'object') {
- this.form.corpsTypeId = this.form.corpsTypeId.join(",")
- }
- this.disabled = true
- this.form.billType = 'FH'
- typeSave(this.form).then(res => {
- this.$message({type: "success", message: this.form.id ? "修改成功!" : "新增成功!"});
- this.disabled = false
- if (isBack) {
- //成功关闭此页面回到列表页
- this.$emit("goBack");
- } else {
- this.queryData(res.data.data.id)
- }
- })
- } else {
- return false;
- }
- });
- },
- //复制新单
- copyOrder() {
- this.queryData(this.form.id, true)
- },
- //返回列表
- backToList() {
- if (contrastObj(this.form, this.oldForm) ||
- contrastList(this.contactsData, this.oldGoodsList) ||
- contrastList(this.advantageProjectData, this.oldFeesList) ||
- contrastList(this.bankOfDepositData, this.oldUploadList)
- ) {
- this.$confirm("数据发生变化未有提交记录, 是否提交?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- this.editCustomer(true)
- }).catch(() => {
- this.$emit("goBack");
- })
- } else {
- this.$emit("goBack");
- }
- },
- // 确认发货
- sendOutGoods() {
- this.$refs["form"].validate((valid) => {
- if (valid) {
- if (this.contactsData.length == 0) {
- return this.$message.error('商品信息为空')
- }
- for (let item in this.contactsData) {
- if (!this.contactsData[item].id) {
- return this.$message.error('有商品未保存,请先保存')
- }
- }
- //商品信息
- this.form.deliveryItemsList = this.contactsData
- this.form.deliveryFeesList = this.advantageProjectData
- this.form.deliveryFilesList = this.bankOfDepositData
- if (typeof this.form.corpsTypeId == 'object') {
- this.form.corpsTypeId = this.form.corpsTypeId.join(",")
- }
- sendOutGoods(this.form).then(res => {
- console.log(res)
- this.$message.success('发货成功')
- this.queryData(res.data.data.id)
- })
- } else {
- return false;
- }
- });
- },
- // 撤销发货
- revokeOutGoods() {
- this.$refs["form"].validate((valid) => {
- if (valid) {
- //商品信息
- this.form.deliveryItemsList = this.contactsData
- this.form.deliveryFeesList = this.advantageProjectData
- this.form.deliveryFilesList = this.bankOfDepositData
- if (typeof this.form.corpsTypeId == 'object') {
- this.form.corpsTypeId = this.form.corpsTypeId.join(",")
- }
- revokeOutGoods(this.form).then(res => {
- console.log(res)
- this.$message.success('撤销成功')
- this.queryData(res.data.data.id)
- })
- } else {
- return false;
- }
- });
- },
- // 保存列设置
- async saveColumn(name) {
- /**
- * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
- * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
- * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
- */
- if (name == 'goods') {
- const inSave = await this.saveColumnData(
- this.getColumnName(21),
- this.customerContact
- );
- if (inSave) {
- this.$message.success("保存成功");
- //关闭窗口
- this.$refs.crudContact.$refs.dialogColumn.columnBox = false;
- }
- } else if (name === 'fees') {
- const inSave = await this.saveColumnData(
- this.getColumnName(22),
- this.advantageProject
- );
- if (inSave) {
- this.$message.success("保存成功");
- //关闭窗口
- this.$refs.crudProject.$refs.dialogColumn.columnBox = false;
- }
- }
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .customer-head {
- position: fixed;
- top: 105px;
- width: 100%;
- margin-left: -10px;
- height: 62px;
- background: #ffffff;
- box-shadow: 0 4px 12px 0px rgba(232, 232, 235, 1);
- z-index: 999;
- /* display: flex;
- justify-content: left; */
- }
- .customer-back {
- cursor: pointer;
- line-height: 62px;
- font-size: 16px;
- color: #323233;
- font-weight: 400;
- }
- .back-icon {
- line-height: 64px;
- font-size: 20px;
- margin-right: 8px;
- }
- .add-customer-btn {
- position: fixed;
- right: 36px;
- top: 115px;
- }
- ::v-deep .el-form-item {
- margin-bottom: 0;
- }
- .el-dialogDeep {
- ::v-deep .el-dialog {
- margin: 1vh auto 0 !important;
- padding-bottom: 10px !important;
- .el-dialog__body, .el-dialog__footer {
- padding-bottom: 0 !important;
- padding-top: 0 !important;
- }
- }
- }
- .print-div {
- color: #000;
- }
- .print_table {
- table {
- border-right: 1px solid #000;
- border-bottom: 1px solid #000;
- font-size: 12px;
- margin-bottom: 5px;
- }
- table td {
- border-left: 1px solid #000;
- border-top: 1px solid #000;
- vertical-align: middle;
- padding: 2px;
- text-align: center;
- }
- }
- .table {
- border-collapse: collapse;
- border-spacing: 0;
- background-color: transparent;
- display: table;
- width: 99%;
- max-width: 100%;
- margin: 0 auto;
- }
- .table td {
- text-align: left;
- vertical-align: middle;
- font-size: 14px;
- color: #000000;
- padding: 10.5px 0 10.5px 30px;
- //border: 1px solid #000;
- }
- </style>
|