1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060 |
- <template>
- <div>
- <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="add-customer-btn">
- <el-button v-if="detailData.check" type="primary" size="small" class="el-button--small-yh"
- @click.stop="openCheckDialog">
- 审批
- </el-button>
- <!--<el-button type="primary" size="small" v-if="form.confirmStatus == 1" @click="newAddfun">新建销售单-->
- <!--</el-button>-->
- <el-button type="warning" size="small" v-if="form.confirmStatus == 1" @click.stop="clickPayment">付款
- </el-button>
- <el-button type="info" icon="el-icon-printer" size="small" @click.stop="openReport()">报表打印
- </el-button>
- <el-button type="primary" size="small" v-if="detailData.status == 1 && form.confirmStatus == 0"
- class="el-button--small-yh " @click.stop="openEdit">编辑
- </el-button>
- <el-button type="primary" size="small" v-if="!form.id && detailData.status != 1" @click="editCustomer">
- 保存数据
- </el-button>
- <!--<el-button type="primary" size="small" v-if="form.id && detailData.status != 1 && form.confirmStatus == 0"-->
- <!-- @click="fixSave">-->
- <!-- 保存数据-->
- <!--</el-button>-->
- <el-button type="primary" size="small" v-if="form.id && detailData.status != 1 && form.confirmStatus == 0"
- @click="submit">
- 提交
- </el-button>
- <el-button type="primary" size="small" v-if="form.confirmStatus == 1" @click="revokeOrder">
- 撤销
- </el-button>
- </div>
- </div>
- <!-- <containerTitle title="基础资料" style="margin-top: 60px"></containerTitle> -->
- <trade-card title="基础资料" style="margin-top: 60px" v-loading="loadingBtn">
- <avue-form ref="form" class="trading-form" v-model="form" :option="option">
- <template slot="corpId">
- <crop-select v-model="form.corpId" corpType="KH" :disabled="detailData.status == 1"
- @getCorpData="getCorpData"></crop-select>
- </template>
- <template slot="storageId">
- <el-select v-model="form.storageId" placeholder="请选择" size="small" filterable @change="storageChange"
- :disabled="detailData.status == 1 || data.length > 0">
- <el-option v-for="item in storageoptions" :key="item.id" :label="item.cname" :value="item.id">
- </el-option>
- </el-select>
- </template>
- </avue-form>
- </trade-card>
- <trade-card title="商品信息" v-loading="loadingBtn">
- <avue-form ref="option2form" class="trading-form" v-model="form" :option="option2">
- <template slot="thisUsedProfit">
- <el-input-number v-model="form.thisUsedProfit" :disabled="detailData.status == 1"
- placeholder="请输入" size="small" :controls="false" style="width:100%;"
- @change="thisUsedchange" ></el-input-number>
- <!--@change="amountChange"-->
- </template>
- <template slot="memberBalance">
- <el-input-number v-model="form.memberBalance" :disabled="detailData.status == 1"
- placeholder="请输入" size="small" :controls="false"
- @change="memberchange"></el-input-number>
- <span style="margin-left: 10px">余额:{{balanceAmounts}}</span>
- </template>
- </avue-form>
- <avue-crud ref="crud" :option="optionList" :data="data" :table-loading="loading" @saveColumn="saveColumn"
- @resetColumn="resetColumn" :cell-style="cellStyle">
- <template slot="headerSerial">
- <el-button type="primary" icon="el-icon-plus" size="mini" @click.stop="addRow"
- :disabled="detailData.status == 1" circle></el-button>
- </template>
- <template slot="cname" slot-scope="{ row, index }">
- <el-select v-if="row.$cellEdit" v-model="row.cname" placeholder="请选择" size="small" filterable
- @change="cnameChange(row, index)">
- <el-option v-for="item in goodsoptions" :key="item.itemId" :label="item.cname" :value="item.cname"
- :disabled="item.status == 1">
- </el-option>
- </el-select>
- <span v-else>{{ row.cname }}</span>
- </template>
- <template slot="unitHeader" slot-scope="{column}">
- <span style="color: #409EFF;cursor: pointer" @click.stop="$refs.dictbiz.open()">单位
- </span>
- </template>
- <template slot="storageInQuantity" slot-scope="{ row, index }">
- <el-input-number v-if="row.$cellEdit" v-model="row.storageInQuantity" @change="countChange(row)"
- placeholder="请输入" size="small" :controls="false" style="width:100%;"></el-input-number>
- <span v-else>{{ row.storageInQuantity }}</span>
- </template>
- <template slot="price" slot-scope="{ row, index }">
- <el-input-number v-if="row.$cellEdit" v-model="row.price" @change="countChange(row)" placeholder="请输入"
- size="small" :controls="false" style="width:100%;"></el-input-number>
- <span v-else>{{ row.price }}</span>
- </template>
- <template slot="purchaseAmount" slot-scope="{ row, index }">
- <el-input-number v-if="row.$cellEdit" v-model="row.purchaseAmount" @change="countChange(row)"
- placeholder="请输入" size="small" :controls="false" style="width:100%;"></el-input-number>
- <span v-else>{{ row.purchaseAmount }}</span>
- </template>
- <template slot="menu" slot-scope="{ row, index }">
- <el-button size="small" type="text" :disabled="detailData.status == 1" @click="rowCell(row, index)">{{
- row.$cellEdit ? "保存" : "修改"
- }}</el-button>
- <el-button size="small" type="text" :disabled="detailData.status == 1" @click="rowDel(row, index)">删除
- </el-button>
- </template>
- </avue-crud>
- </trade-card>
- <fee-info ref="feeInfo" :data="settlementList" :form="form" :detailData="detailData" @getPay="getPay"
- v-loading="loadingBtn">
- </fee-info>
- <containerTitle title="上传附件"></containerTitle>
- <c-upload v-loading="loadingBtn" typeUpload="CD"
- deleteUrl="/api/trade-purchase/woodHarvestingCloud/removeByFileId" :data="orderFilesList" display
- :enumerationValue="35.1" :disabled="detailData.status == 1"></c-upload>
- <el-dialog :title="addressTitle" v-dialogDrag :visible.sync="addressVisible" class="avue-dialog avue-dialog--top"
- width="50%" append-to-body>
- <span>
- <el-tabs v-model="activeName">
- <el-tab-pane label="客户地址" name="first">
- <avue-form class="trading-form" v-model="form2" :option="optiontabs1"></avue-form>
- </el-tab-pane>
- <el-tab-pane label="物流地址" name="second">
- <avue-form class="trading-form" v-model="form3" :option="optiontabs2"></avue-form>
- </el-tab-pane>
- </el-tabs>
- </span>
- <div class="avue-dialog__footer">
- <el-button @click="addressVisible = false">取 消</el-button>
- <el-button @click="addressVisible = false" type="primary">确 定</el-button>
- </div>
- </el-dialog>
- <dictbiz-dialog ref="dictbiz" title="添加单位" code="unit" parentId="1585962784498225154"
- @closed="getAllWorkDicts">
- </dictbiz-dialog>
- <report-dialog :switchDialog="switchDialog" :reportId="form.id" reportName="配件系统-销售单" @onClose="onClose()">
- </report-dialog>
- </div>
- <el-dialog append-to-body title="审批" class="el-dialogDeep" :visible.sync="checkDialog" width="50%"
- :close-on-click-modal="false" :destroy-on-close="true" :close-on-press-escape="false" v-dialog-drag>
- <check :checkData="checkData" :checkDetail="false" :idList="[]" @choceCheckFun="choceCheckFun">
- </check>
- </el-dialog>
- <!--付款的弹窗-->
- <!--<el-dialog-->
- <!-- title="付款"-->
- <!-- :visible.sync="paymentVisible"-->
- <!-- append-to-body-->
- <!-- :close-on-click-modal="false"-->
- <!-- :destroy-on-close="true"-->
- <!-- :close-on-press-escape="false"-->
- <!-- v-dialog-drag-->
- <!-- width="40%"-->
- <!-- :before-close="paymentClose">-->
- <!-- <div>-->
- <!-- <el-form ref="form" label-width="100px" size="mini">-->
- <!-- <el-form-item label="总支付金额">-->
- <!-- {{form.purchaseAmount}}-->
- <!-- </el-form-item>-->
- <!-- <el-form-item label="会员卡余额">-->
- <!-- {{balanceAmounts}}-->
- <!-- </el-form-item>-->
- <!-- <el-form-item label="会员卡支付金额">-->
- <!-- <el-input type="number" v-model="form.memberBalance" @change="memberBalancechange"></el-input>-->
- <!-- </el-form-item>-->
- <!-- <el-form-item label="现金支付金额">-->
- <!-- <el-input type="number" v-model="form.wechatpayAmount"></el-input>-->
- <!-- </el-form-item>-->
- <!-- </el-form>-->
- <!-- </div>-->
- <!-- <span slot="footer" class="dialog-footer">-->
- <!-- <el-button @click="paymentVisible = false">取 消</el-button>-->
- <!-- <el-button type="primary" @click="paymentVisible = false">确 定</el-button>-->
- <!-- </span>-->
- <!--</el-dialog>-->
- </div>
- </template>
- <script>
- import {optionList} from "./js/optionList";
- import {
- getDetails,
- submit,
- getCorpDetails,
- remove,
- getAllgoods,
- save,
- fixSave,
- revoke,
- collectPayment,
- getStoragelist,
- offset,
- obtainPrice
- } from "@/api/basicData/salesOrder";
- import feeInfo from "./components/feeInfo.vue";
- import reportDialog from "@/components/report-dialog/main";
- import { multiply, sum, subtract } from "@/util/calculate";
- import {fdatasync} from "fs";
- import check from "@/components/check/check";
- export default {
- name: "index",
- data() {
- return {
- // 付款的弹窗开启和关闭
- paymentVisible:false,
- checkDialog: false,
- checkData: {},
- switchDialog: false,
- activeName: 'first',
- loadingBtn: false,
- addressTitle: null,
- addressVisible: false,
- form: {},
- form2: {},
- form3: {},
- data: [],
- option: {
- menuBtn: false,
- labelWidth: 90,
- disabled: false,
- column: [
- {
- label: "客户名称",
- prop: "corpId",
- rules: [
- {
- required: true,
- message: "",
- trigger: "blur"
- }
- ],
- span: 8,
- },
- {
- label: "销售单号",
- prop: "sysNo",
- disabled: true,
- span: 8,
- },
- {
- label: "退款单号",
- prop: "srcOrderNo",
- disabled: true,
- span: 8,
- }, {
- label: "订单来源",
- prop: "orderSource",
- disabled: true,
- type: 'select',
- dataType: 'number',
- dicData: [
- {
- label: "APP/PC",
- value: 1
- },
- {
- label: "小程序",
- value: 2
- }],
- props: {
- label: 'label',
- value: 'value'
- },
- span: 8,
- }, {
- label: "联系人",
- prop: "corpAttn",
- disabled: true,
- span: 8,
- }, {
- label: "联系电话",
- prop: "corpTel",
- disabled: true,
- span: 8,
- }, {
- label: "送货地址",
- prop: "arrivalAddress",
- type: 'select',
- dicData: [],
- props: {
- label: 'detailedAddress',
- value: 'detailedAddress'
- },
- allowCreate: true,
- filterable: true,
- span: 16,
- }, {
- label: "销售日期",
- prop: "businesDate",
- type: "datetime",
- format: "yyyy-MM-dd HH:mm:ss",
- valueFormat: "yyyy-MM-dd HH:mm:ss",
- span: 8,
- }, {
- label: "计划收款日期",
- prop: "advanceCollectionDate",
- type: "date",
- format: "yyyy-MM-dd",
- valueFormat: "yyyy-MM-dd HH:mm:ss",
- span: 8,
- }, {
- label: "送货日期",
- prop: "requiredDeliveryDate",
- type: "date",
- format: "yyyy-MM-dd",
- valueFormat: "yyyy-MM-dd 00:00:00",
- span: 8,
- }, {
- label: "快递公司",
- prop: "courierCorporation",
- disabled: true,
- span: 8,
- },
- {
- label: "快递单号",
- prop: "courierNumber",
- disabled: true,
- span: 8,
- },
- {
- label: "仓库",
- prop: "storageId",
- rules: [
- {
- required: true,
- message: "",
- trigger: "blur"
- }
- ],
- span: 8,
- },
- {
- label: "备注",
- prop: "orderRemark",
- placeholder: "打印时显示",
- type: "textarea",
- minRows: 3,
- span: 24,
- }
- ]
- },
- option2: {
- menuBtn: false,
- labelWidth: 80,
- disabled: false,
- column: [
- {
- label: "订单金额",
- prop: "purchaseAmount",
- disabled: true,
- span: 4,
- },
- {
- label: "优惠金额",
- prop: "thisUsedProfit",
- span: 4,
- },
- {
- label: "会员卡金额",
- prop: "memberBalance",
- span: 8,
- },
- {
- label: "应收金额",
- prop: "balanceAmount",
- disabled: true,
- span: 8,
- },
- {
- label: "成本",
- prop: "costAmount",
- disabled: true,
- span: 4,
- },
- {
- label: "毛利",
- prop: "grossProfit",
- disabled: true,
- span: 4,
- },
- {
- label: "税率",
- prop: "exchangeRate",
- type: "select",
- props: {
- label: "dictValue",
- value: "dictKey"
- },
- dicUrl: "/api/blade-system/dict-biz/dictionary?code=tax_rate_xin",
- span: 4,
- },
- {
- label: "销售总数量",
- prop: "storageQuantity",
- disabled: true,
- span: 4,
- },
- {
- label: "已收金额",
- prop: "settlmentAmount",
- disabled: true,
- span: 8,
- }
- ]
- },
- optiontabs1: {
- menuBtn: false,
- labelWidth: 90,
- column: [
- {
- label: "简称",
- prop: "a",
- type: "select",
- span: 24,
- },
- {
- label: "地址",
- prop: "b",
- type: "select",
- span: 24,
- },
- {
- label: "详细地址",
- prop: "c",
- span: 24,
- },
- {
- label: "邮编",
- prop: "d",
- span: 24,
- },
- {
- label: "备注",
- prop: "e",
- type: 'textarea',
- minRows: 3,
- span: 24,
- },
- {
- label: "地址智能识别",
- prop: "ad",
- placeholder: "例:上海市徐汇区枫林街道斜土路100号",
- type: "textarea",
- minRows: 3,
- span: 24,
- }
- ]
- },
- optiontabs2: {
- menuBtn: false,
- labelWidth: 80,
- column: [
- {
- label: "目的地",
- prop: "a",
- type: "select",
- rules: [
- {
- required: true,
- message: "",
- trigger: "blur"
- }
- ],
- span: 24,
- },
- {
- label: "物流公司",
- prop: "b",
- span: 24,
- },
- {
- label: "电话",
- prop: "c",
- span: 24,
- },
- {
- label: "地址",
- prop: "d",
- span: 24,
- },
- {
- label: "详细地址",
- prop: "e",
- span: 24,
- },
- {
- label: "邮编",
- prop: "f",
- span: 24,
- },
- {
- label: "备注",
- prop: "remarks",
- type: "textarea",
- minRows: 3,
- span: 24,
- },
- {
- label: "地址智能识别",
- prop: "g",
- type: "textarea",
- minRows: 3,
- span: 24,
- }
- ]
- },
- optionList: {},
- goodsoptions: [],
- settlementList: [],
- orderFilesList: [],
- storageoptions: [],
- // 会员卡余额
- balanceAmounts:0,
- };
- },
- props: {
- detailData: {
- type: Object
- }
- },
- components: {
- feeInfo,
- check,
- reportDialog
- },
- async created() {
- // console.log(this.detailData)
- this.optionList = await this.getColumnData(
- this.getColumnName(212),
- optionList
- );
- if (this.detailData.id) {
- this.getDetail(this.detailData.id);
- }
- if (this.detailData.status == 1) {
- this.option.disabled = true;
- this.option2.disabled = true;
- }
- this.getAllWorkDicts()
- getAllgoods().then(res => {
- this.goodsoptions = []
- res.data.data.map(item=>{
- if(item.status != 1) {
- this.goodsoptions.push(item)
- }
- })
- // this.goodsoptions = res.data.data
- });
- },
- methods: {
- // // 会员卡支付金额的监听
- // memberBalancechange(){
- // if (Number(this.form.memberBalance) < 0) {
- // this.form.memberBalance = 0
- // }
- // this.form.wechatpayAmount = this.form.purchaseAmount - this.form.memberBalance
- // },
- // 优惠金额的监听
- thisUsedchange(){
- this.form.memberBalance = this.form.memberBalance?this.form.memberBalance:0
- if(Number(this.form.thisUsedProfit) < 0) {
- this.$nextTick(()=>{
- this.form.thisUsedProfit = 0
- })
- }
- if (Number(this.form.thisUsedProfit) > Number(this.form.purchaseAmount)) {
- this.$nextTick(()=>{
- this.form.thisUsedProfit = Number(this.form.purchaseAmount)
- this.form.memberBalance = 0
- this.form.currentAmount = 0
- })
- }
- let sum = Number(this.form.purchaseAmount) - Number(this.form.memberBalance)
- if (Number(this.form.thisUsedProfit) > sum){
- this.$nextTick(()=>{
- console.log(this.form.thisUsedProfit)
- this.form.thisUsedProfit = sum
- this.form.currentAmount = 0
- })
- }
- this.$nextTick(()=>{
- console.log(sum - this.form.thisUsedProfit)
- this.form.currentAmount = sum - this.form.thisUsedProfit
- })
- },
- // 会员卡金额的监听
- memberchange(){
- // change事件发生后触发了dom更新,
- // 而数据更改变化是在dom更新之后,
- // 这就导致了dom当中挂载的数据值还是更新之前的值,
- // 并且此后无刷新控制dom重新渲染的指令,使得chhange方法失效。
- // 用$nextTick函数对绑定值进行更改,
- // 即在dom初次完成渲染挂载后,修改其值再次触发dom渲染挂载。
- this.form.thisUsedProfit = this.form.thisUsedProfit?this.form.thisUsedProfit:0
- if (this.form.memberBalance < 0) {
- this.$nextTick(()=>{
- this.form.memberBalance = 0
- })
- }
- if (this.form.memberBalance > Number(this.balanceAmounts)) {
- this.$nextTick(()=>{
- this.form.memberBalance = Number(this.balanceAmounts)
- })
- }
- let sum = Number(this.form.purchaseAmount) - Number(this.form.thisUsedProfit)
- if (this.form.memberBalance > sum) {
- this.$nextTick(()=>{
- this.form.memberBalance = sum
- })
- }
- this.$nextTick(()=>{
- console.log(sum - this.form.memberBalance)
- this.form.currentAmount = sum - this.form.memberBalance
- })
- },
- // 付款点击事件
- clickPayment(){
- // 和删除一样的接口 显示要付款的现金
- this.$confirm(`本次付款需要支付金额为${this.form.currentAmount}`, '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(()=>{
- let form = {
- ...this.form,
- orderFilesList: this.orderFilesList
- }
- collectPayment(form).then(res=>{
- console.log(res,632)
- })
- })
- // this.paymentVisible = true
- },
- // // 付款弹窗的关闭
- // paymentClose(){
- // this.paymentVisible = false
- // },
- //打开审核
- openCheckDialog() {
- this.checkData = this.detailData.check;
- this.checkDialog = true;
- },
- //关闭审核
- choceCheckFun() {
- this.checkDialog = false;
- },
- openReport() {
- this.switchDialog = !this.switchDialog;
- },
- onClose(val) {
- this.switchDialog = val;
- },
- getAllWorkDicts() {
- this.getWorkDicts("unit").then(res => {
- this.findObject(this.optionList.column, "unit").dicData = res.data.data;
- });
- getStoragelist().then(res => {
- this.storageoptions = res.data;
- this.findObject(this.optionList.column, "storageId").dicData = res.data;
- })
- this.$refs.crud.init();
- },
- cellStyle() {
- return "padding:0;height:40px;";
- },
- cnameChange(row) {
- console.log(row,668)
- if (row.cname) {
- this.goodsoptions.forEach(e => {
- if (e.cname == row.cname) {
- row.itemId = e.id
- row.unit = e.unit
- // row.price = e.standardPrice
- row.storageInQuantity = 1
- row.amount = e.standardPrice
- row.purchasePrice = e.purchasePrice
- row.storageAmount = e.purchasePrice
- }
- })
- // 根据产品ID和客户id获取产品单价
- obtainPrice({
- corpId:this.form.corpId,
- goodsId:row.itemId
- }).then(res=>{
- row.price = res.data.data.salesPrice
- })
- } else {
- row.itemId = null
- row.unit = null
- row.price = null
- row.storageInQuantity = null
- row.amount = null
- row.purchasePrice = null
- row.storageAmount = null
- }
- this.countChange(row)
- },
- // 之前的优惠金额的监听
- amountChange() {
- let val = 0
- this.data.forEach(e => {
- val = sum(val, e.amount)
- this.form.purchaseAmount = val
- this.form.orderAmount = subtract(this.form.purchaseAmount, this.form.thisUsedProfit)
- })
- },
- countChange(row) {
- row.amount = multiply(row.price, row.storageInQuantity)
- row.storageAmount = multiply(row.purchaseAmount, row.storageInQuantity)
- let val = 0
- this.data.forEach(e => {
- val = sum(val, e.amount)
- this.form.purchaseAmount = val
- this.form.orderAmount = subtract(this.form.purchaseAmount, this.form.thisUsedProfit)
- })
- this.$refs.crud.refreshTable();
- },
- getDetail(id) {
- this.loadingBtn = true
- getDetails({ id: id })
- .then(res => {
- this.form = res.data.data;
- this.data = res.data.data.orderItemsList;
- this.settlementList = res.data.data.settlementList;
- this.orderFilesList = res.data.data.orderFilesList ? res.data.data.orderFilesList : [];
- this.getAddress(res.data.data)
- }).finally(() => {
- this.loadingBtn = false;
- });
- },
- getCorpData(row) {
- if (row) {
- this.form.corpsName = row.cname
- this.form.corpTel = row.tel
- getCorpDetails({ id: row.id }).then(res => {
- this.balanceAmounts = res.data.data.balanceAmounts
- this.findObject(this.option.column, "arrivalAddress").dicData = res.data.data.corpsAddrList;
- })
- } else {
- this.form.corpsName = null
- this.form.corpTel = null
- this.findObject(this.option.column, "arrivalAddress").dicData = []
- }
- },
- storageChange(row) {
- // console.log(row)
- },
- getAddress(row) {
- getCorpDetails({ id: row.corpId }).then(res => {
- this.balanceAmounts = res.data.data.balanceAmounts
- this.findObject(this.option.column, "arrivalAddress").dicData = res.data.data.corpsAddrList;
- })
- if (this.form.billType == "XS"){
- this.findObject(this.option.column, "sysNo").label = "销售单号";
- this.findObject(this.option.column, "srcOrderNo").label = "退款单号";
- }else if (this.form.billType == "XSTH"){
- this.findObject(this.option.column, "sysNo").label = "退款单号";
- this.findObject(this.option.column, "srcOrderNo").label = "销售单号";
- }
- },
- addRow() {
- this.$refs["form"].validate((valid, done) => {
- done();
- if (valid) {
- this.data.push({ $cellEdit: true, storageId: this.form.storageId })
- } else {
- return false;
- }
- });
- },
- rowCell(row, index) {
- if (row.$cellEdit == true) {
- this.$set(row, "$cellEdit", false);
- } else {
- this.$set(row, "$cellEdit", true);
- }
- },
- rowDel(row, index) {
- this.$confirm("确定删除数据?", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- if (row.id) {
- remove(row.id).then(res => {
- this.$message({
- type: "success",
- message: "删除成功!"
- });
- this.data.splice(index, 1);
- });
- } else {
- this.$message({
- type: "success",
- message: "删除成功!"
- });
- this.data.splice(index, 1);
- }
- });
- },
- getPay(row) {
- // this.form = row;
- // this.data = row.orderItemsList;
- // this.settlementList = row.settlementList
- this.getDetail(row.id);
- },
- // 新建销售单
- newAddfun(){
- // delete this.form.id
- this.$refs.form.resetFields()
- this.form = {}
- this.$nextTick(() => {
- this.$refs.option2form.resetFields()
- });
- this.data = [];
- this.form.confirmStatus = null
- this.detailData = []
- this.detailData.status = 2
- this.settlementList = [];
- this.orderFilesList = [];
- this.balanceAmount = 0
- this.option.disabled = false;
- this.option2.disabled = false;
- this.$refs.crud.refreshTable();
- this.$refs.feeInfo.refreshTable();
- // // this.$refs.option2form.resetFields()这个做法其实是重置表单到初始值,不是清空表单,
- // // 当表单第一次在页面中渲染时所用的数据就是初始数据,如果修改对象的表单赋值没有放在nextTick中,
- // // 就会在表单渲染时就会将这个修改对象作为初始值,
- // // 所以出现无效了。
- // // 使用nextTick保证表单在第一次渲染时是空值就可以了。
- // this.xinjianfasle = true
- this.$forceUpdate()
- },
- //修改提交触发
- editCustomer() {
- this.$refs["form"].validate((valid, done) => {
- done();
- if (valid) {
- if (this.data.length == 0) {
- return this.$message.error('请添加一条商品信息');
- }
- if (this.settlementList.length > 0) {
- for (let i = 0; i < this.settlementList.length; i++) {
- if (!this.settlementList[i].id) {
- return this.$message.error(`请保存第${i + 1}行的费用明细`);
- }
- }
- }
- this.loadingBtn = true;
- save({ ...this.form, billType: 'XS', tradeType: 'YPJ', orderItemsList: this.data, settlementList: this.settlementList, orderFilesList: this.orderFilesList })
- .then(res => {
- this.$message.success("保存成功");
- this.form = res.data.data;
- this.data = res.data.data.orderItemsList;
- this.settlementList = res.data.data.settlementList;
- this.orderFilesList = res.data.data.orderFilesList ? res.data.data.orderFilesList : [];
- this.detailData.status = 1
- this.option.disabled = true;
- this.option2.disabled = true;
- this.$refs.crud.refreshTable();
- this.$refs.feeInfo.refreshTable();
- })
- .finally(() => {
- this.loadingBtn = false;
- });
- } else {
- return false;
- }
- });
- },
- fixSave() {
- this.$refs["form"].validate((valid, done) => {
- done();
- if (valid) {
- if (this.data.length == 0) {
- return this.$message.error('请添加一条商品信息');
- }
- if (this.settlementList.length > 0) {
- for (let i = 0; i < this.settlementList.length; i++) {
- if (!this.settlementList[i].id) {
- return this.$message.error(`请保存第${i + 1}行的费用明细`);
- }
- }
- }
- this.loadingBtn = true;
- fixSave({ ...this.form, billType: 'XS', tradeType: 'YPJ', orderItemsList: this.data, settlementList: this.settlementList, orderFilesList: this.orderFilesList })
- .then(res => {
- this.$message.success("修改成功");
- this.form = res.data.data;
- this.data = res.data.data.orderItemsList;
- this.settlementList = res.data.data.settlementList
- this.orderFilesList = res.data.data.orderFilesList ? res.data.data.orderFilesList : [];
- })
- .finally(() => {
- this.loadingBtn = false;
- });
- } else {
- return false;
- }
- });
- },
- submit() {
- this.$refs["form"].validate((valid, done) => {
- done();
- if (valid) {
- if (this.data.length == 0) {
- return this.$message.error('请添加一条商品信息');
- }
- if (this.settlementList.length > 0) {
- for (let i = 0; i < this.settlementList.length; i++) {
- if (!this.settlementList[i].id) {
- return this.$message.error(`请保存第${i + 1}行的费用明细`);
- }
- }
- }
- this.loadingBtn = true;
- submit({ ...this.form, billType: 'XS', tradeType: 'YPJ', orderItemsList: this.data, settlementList: this.settlementList, orderFilesList: this.orderFilesList })
- .then(res => {
- this.$message.success("提交成功");
- this.form = res.data.data;
- this.data = res.data.data.orderItemsList;
- this.settlementList = res.data.data.settlementList;
- this.orderFilesList = res.data.data.orderFilesList ? res.data.data.orderFilesList : [];
- this.$emit("goBack");
- })
- .finally(() => {
- this.loadingBtn = false;
- });
- } else {
- return false;
- }
- });
- },
- revokeOrder() {
- this.$confirm('此操作将会撤销单子, 是否继续?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- this.loadingBtn = true;
- revoke({ ...this.form, billType: 'XS', tradeType: 'YPJ', orderItemsList: this.data, settlementList: this.settlementList })
- .then(res => {
- this.$message.success("撤销成功");
- this.form = res.data.data;
- this.data = res.data.data.orderItemsList;
- this.settlementList = res.data.data.settlementList
- this.openEdit()
- })
- .finally(() => {
- this.loadingBtn = false;
- });
- }).catch(() => {
- });
- },
- async saveColumn() {
- const inSave = await this.saveColumnData(
- this.getColumnName(212),
- this.optionList
- );
- if (inSave) {
- this.$nextTick(() => {
- this.$refs.crud.doLayout();
- });
- this.$message.success("保存成功");
- //关闭窗口
- this.$refs.crud.$refs.dialogColumn.columnBox = false;
- }
- },
- async resetColumn() {
- this.optionList = optionList;
- const inSave = await this.delColumnData(
- this.getColumnName(212),
- optionList
- );
- if (inSave) {
- this.$nextTick(() => {
- this.$refs.crud.doLayout();
- });
- this.getAllWorkDicts()
- this.$message.success("重置成功");
- this.$refs.crud.$refs.dialogColumn.columnBox = false;
- }
- },
- openEdit() {
- this.detailData.status = 2
- this.option = this.$options.data().option;
- this.option2 = this.$options.data().option2;
- this.$refs.crud.refreshTable();
- this.$refs.feeInfo.refreshTable();
- },
- //返回列表
- backToList() {
- this.$emit("goBack");
- }
- },
- };
- </script>
- <style lang="scss" scoped>
- .trading-form ::v-deep .el-form-item {
- margin-bottom: 8px !important;
- }
- ::v-deep .el-dialog__body {
- padding: 0px 20px 15px 20px;
- }
- ::v-deep .el-form-item__error {
- display: none !important;
- }
- .img-form ::v-deep .el-form-item {
- height: 150px;
- line-height: 150px;
- margin-bottom: 8px !important;
- }
- .img-form ::v-deep .avue-upload__icon {
- font-size: 20px;
- width: 150px;
- height: 150px;
- line-height: 150px;
- }
- ::v-deep .el-table .cell {
- padding: 0 2px !important;
- }
- ::v-deep .avue-crud .el-table .el-form-item__label {
- left: -1px;
- }
- .addressTabs {
- display: flex;
- justify-content: center;
- span {
- width: 100px;
- font-size: 18px;
- font-weight: 600;
- text-align: center;
- }
- }
- </style>
|