|
@@ -7,6 +7,7 @@
|
|
|
style="border: none;background: none;color: red"
|
|
|
icon="el-icon-arrow-left"
|
|
|
@click="backToList"
|
|
|
+ :loading="btnLoading"
|
|
|
>返回列表</el-button>
|
|
|
</div>
|
|
|
<div class="add-customer-btn">
|
|
@@ -15,12 +16,34 @@
|
|
|
size="small"
|
|
|
class="el-button--small-yh"
|
|
|
@click.stop="openEdit"
|
|
|
+ v-if="form.id && disabled"
|
|
|
>编 辑</el-button>
|
|
|
<el-button
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ class="el-button--small-yh"
|
|
|
+ style="margin-right: 8px;"
|
|
|
+ @click="dealerSubmit"
|
|
|
+ :disabled="disabled"
|
|
|
+ v-if="form.id"
|
|
|
+ >
|
|
|
+ {{ form.status == 0? '确认订单': form.status == 3? '撤销订单': '' }}
|
|
|
+ </el-button>
|
|
|
+ <el-dropdown style="margin-right: 8px;">
|
|
|
+ <el-button type="warning" size="small">账单处理<i class="el-icon-arrow-down el-icon--right"></i></el-button>
|
|
|
+ <el-dropdown-menu slot="dropdown">
|
|
|
+ <el-dropdown-item
|
|
|
+ @click.native="applySettlement('申请')"
|
|
|
+ :disabled="disabled">申请货款
|
|
|
+ </el-dropdown-item>
|
|
|
+ </el-dropdown-menu>
|
|
|
+ </el-dropdown>
|
|
|
+ <el-button
|
|
|
type="success"
|
|
|
:disabled="!form.id"
|
|
|
size="small"
|
|
|
@click="copyDoc"
|
|
|
+ :loading="btnLoading"
|
|
|
>
|
|
|
复制单据
|
|
|
</el-button>
|
|
@@ -28,6 +51,8 @@
|
|
|
type="primary"
|
|
|
@click="editCustomer"
|
|
|
size="small"
|
|
|
+ :loading="btnLoading"
|
|
|
+ :disabled="disabled || confirmDisabled"
|
|
|
>保存数据
|
|
|
</el-button>
|
|
|
</div>
|
|
@@ -46,8 +71,15 @@
|
|
|
v-model="form.corpId"
|
|
|
@getCorpData="getCorpData"
|
|
|
corpType="GYS"
|
|
|
+ :disabled="disabled || confirmDisabled"
|
|
|
></crop-select>
|
|
|
</template>
|
|
|
+ <template slot="storageId">
|
|
|
+ <warehouse-select
|
|
|
+ v-model="form.storageId"
|
|
|
+ :configuration="configurationWarehouse"
|
|
|
+ :disabled="disabled || confirmDisabled"/>
|
|
|
+ </template>
|
|
|
</avue-form>
|
|
|
</basic-container>
|
|
|
<containerTitle title="商品信息"/>
|
|
@@ -66,14 +98,38 @@
|
|
|
icon="el-icon-plus"
|
|
|
size="small"
|
|
|
@click.stop="newDetails"
|
|
|
+ :disabled="disabled || confirmDisabled"
|
|
|
>录入明细</el-button>
|
|
|
<el-button
|
|
|
type="info"
|
|
|
icon="el-icon-printer"
|
|
|
size="small"
|
|
|
@click.stop="openReport()"
|
|
|
- >报 表</el-button
|
|
|
+ >报 表</el-button>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ icon="el-icon-download"
|
|
|
+ @click="downloadHandle"
|
|
|
+ >下载模板</el-button>
|
|
|
+ <el-upload
|
|
|
+ :action="baseURL"
|
|
|
+ :headers="headers"
|
|
|
+ :disabled="disabled || confirmDisabled"
|
|
|
+ :on-progress="uploading"
|
|
|
+ :show-file-list=false
|
|
|
+ accept=".xls,.xlsx"
|
|
|
+ multiple
|
|
|
+ :on-success="importTemplate"
|
|
|
+ :on-error="uploadError"
|
|
|
+ style="float: right"
|
|
|
>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ icon="el-icon-upload"
|
|
|
+ >导 入</el-button>
|
|
|
+ </el-upload>
|
|
|
</template>
|
|
|
<template slot="menu" slot-scope="{ row, index }">
|
|
|
<el-button
|
|
@@ -81,6 +137,7 @@
|
|
|
icon="el-icon-edit"
|
|
|
type="text"
|
|
|
@click="rowCell(row, index)"
|
|
|
+ :disabled="disabled || confirmDisabled"
|
|
|
>{{ row.$cellEdit ? "保存" : "修改" }}</el-button
|
|
|
>
|
|
|
<el-button
|
|
@@ -88,9 +145,37 @@
|
|
|
icon="el-icon-delete"
|
|
|
type="text"
|
|
|
@click="rowDel(row, index)"
|
|
|
+ :disabled="disabled || confirmDisabled"
|
|
|
>删除</el-button
|
|
|
>
|
|
|
</template>
|
|
|
+ <template slot="code" slot-scope="{ row, index }">
|
|
|
+ <span v-if="row.$cellEdit" style="display:flex">
|
|
|
+ <el-select
|
|
|
+ v-model="row.code"
|
|
|
+ placeholder="请选择"
|
|
|
+ filterable
|
|
|
+ size="small"
|
|
|
+ style="width:60%"
|
|
|
+ @change="codeChange(row, index)"
|
|
|
+ :disabled="!form.storageId"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in goodsoptions"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.code"
|
|
|
+ :value="item.code"
|
|
|
+ >
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ <el-button
|
|
|
+ icon="el-icon-search"
|
|
|
+ size="small"
|
|
|
+ @click="rePick(row, index)"
|
|
|
+ ></el-button>
|
|
|
+ </span>
|
|
|
+ <span v-else> {{ row.code }}</span>
|
|
|
+ </template>
|
|
|
<template slot="cname" slot-scope="{ row, index }">
|
|
|
<span v-if="row.$cellEdit" style="display:flex">
|
|
|
<el-select
|
|
@@ -98,7 +183,9 @@
|
|
|
placeholder="请选择"
|
|
|
size="small"
|
|
|
style="width:60%"
|
|
|
+ filterable
|
|
|
@change="cnameChange(row, index)"
|
|
|
+ :disabled="!form.lotNo"
|
|
|
>
|
|
|
<el-option
|
|
|
v-for="item in goodsoptions"
|
|
@@ -114,20 +201,23 @@
|
|
|
@click="rePick(row, index)"
|
|
|
></el-button>
|
|
|
</span>
|
|
|
-
|
|
|
<span v-else> {{ row.cname }}</span>
|
|
|
</template>
|
|
|
- <template slot="actualQuantity" slot-scope="{ row, index }">
|
|
|
+ <template slot="batch" slot-scope="{row, index}">
|
|
|
+ <span>{{ row.batch == 0? '否': '是' }}</span>
|
|
|
+ </template>
|
|
|
+ <template slot="orderQuantity" slot-scope="{ row, index }">
|
|
|
<el-input-number
|
|
|
v-if="row.$cellEdit"
|
|
|
- v-model="row.actualQuantity"
|
|
|
+ v-model="row.orderQuantity"
|
|
|
size="small"
|
|
|
:controls="false"
|
|
|
:precision="0"
|
|
|
@input="amountChange(row)"
|
|
|
style="width: 100%"
|
|
|
+ :disabled="!form.lotNo"
|
|
|
/>
|
|
|
- <span v-else>{{ row.actualQuantity }}</span>
|
|
|
+ <span v-else>{{ row.orderQuantity | IntegerFormat }}</span>
|
|
|
</template>
|
|
|
<template slot="price" slot-scope="{ row, index }">
|
|
|
<el-input-number
|
|
@@ -138,33 +228,41 @@
|
|
|
:precision="2"
|
|
|
@input="amountChange(row)"
|
|
|
style="width: 100%"
|
|
|
+ :disabled="!form.lotNo"
|
|
|
></el-input-number>
|
|
|
<span v-else>{{ row.price }}</span>
|
|
|
</template>
|
|
|
<!-- 单位-->
|
|
|
- <template slot="a" slot-scope="{ row, index }">
|
|
|
- <el-input
|
|
|
+ <template slot="unit" slot-scope="{ row, index }">
|
|
|
+ <el-select
|
|
|
v-if="row.$cellEdit"
|
|
|
- v-model="row.a"
|
|
|
+ v-model="row.unit"
|
|
|
size="small"
|
|
|
- ></el-input>
|
|
|
- <span v-else>{{ row.a }}</span>
|
|
|
+ :disabled="!form.lotNo"
|
|
|
+ clearable
|
|
|
+ filterable
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="(item, index) in unitOption"
|
|
|
+ :key="index"
|
|
|
+ :label="item.dictValue"
|
|
|
+ :value="item.dictValue"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ <span v-else>{{ row.unit }}</span>
|
|
|
</template>
|
|
|
- <!-- 尺寸-->
|
|
|
- <template slot="size" slot-scope="{ row, index }">
|
|
|
- <el-input
|
|
|
- v-if="row.$cellEdit"
|
|
|
- v-model="row.size"
|
|
|
- size="small"
|
|
|
- ></el-input>
|
|
|
- <span v-else>{{ row.size }}</span>
|
|
|
+ <template slot="amount" slot-scope="{ row, index }">
|
|
|
+ <span>{{ row.amount | decimalFormat }}</span>
|
|
|
+ </template>
|
|
|
+ <template slot="storageQuantity" slot-scope="{ row, index }">
|
|
|
+ <span>{{ row.storageQuantity | IntegerFormat }}</span>
|
|
|
</template>
|
|
|
</avue-crud>
|
|
|
</basic-container>
|
|
|
<containerTitle title="详细信息"/>
|
|
|
<basic-container :showBtn="true">
|
|
|
<avue-form
|
|
|
- ref="form"
|
|
|
+ ref="form1"
|
|
|
class="trading-form"
|
|
|
v-model="form"
|
|
|
:option="detailOption"
|
|
@@ -175,6 +273,7 @@
|
|
|
:data="uploadData"
|
|
|
deleteUrl="/api/blade-client/corpsbank/update"
|
|
|
:enumerationValue="84"
|
|
|
+ :disabled="disabled || confirmDisabled"
|
|
|
/>
|
|
|
</div>
|
|
|
<el-dialog
|
|
@@ -220,7 +319,33 @@
|
|
|
@saveColumn="saveGoodsColumn"
|
|
|
@resetColumn="resetGoodsColumn"
|
|
|
:cell-style="cellStyle"
|
|
|
- ></avue-crud>
|
|
|
+ >
|
|
|
+ <template slot="menuLeft">
|
|
|
+ <el-tabs v-model="activeName" @tab-click="tabHandle">
|
|
|
+ <el-tab-pane label="查询结果" name="searchList"></el-tab-pane>
|
|
|
+ <el-tab-pane label="已选定数据" name="importStaging"></el-tab-pane>
|
|
|
+ </el-tabs>
|
|
|
+ </template>
|
|
|
+ <template slot-scope="scope" slot="menu">
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ icon="el-icon-edit"
|
|
|
+ size="small"
|
|
|
+ @click.stop="importStagList(scope.row,scope.index)"
|
|
|
+ v-if="activeName=='searchList'"
|
|
|
+ :disabled="goodsListSave.findIndex(item => item.id == scope.row.id) !== -1"
|
|
|
+ >选择
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ icon="el-icon-delete"
|
|
|
+ size="small"
|
|
|
+ @click.stop="removeStagList(scope.row,scope.index)"
|
|
|
+ v-else
|
|
|
+ >移除
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </avue-crud>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</span>
|
|
@@ -230,11 +355,31 @@
|
|
|
<el-button
|
|
|
type="primary"
|
|
|
@click="importGoods"
|
|
|
- :disabled="selectionList.length == 0"
|
|
|
+ :disabled="selectionList.length == 0 && goodsListSave.length == 0"
|
|
|
>导入</el-button
|
|
|
>
|
|
|
</span>
|
|
|
</el-dialog>
|
|
|
+ <!-- 账单-->
|
|
|
+ <el-dialog
|
|
|
+ append-to-body
|
|
|
+ title="账单"
|
|
|
+ class="el-dialogDeep"
|
|
|
+ :visible.sync="financialAccountDialog"
|
|
|
+ width="70%"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ :destroy-on-close="true"
|
|
|
+ :close-on-press-escape="false"
|
|
|
+ v-dialog-drag
|
|
|
+ >
|
|
|
+ <financial-account
|
|
|
+ :billType="billType"
|
|
|
+ :billData="{}"
|
|
|
+ :arrList="applyPaymentList"
|
|
|
+ :belongCompany="form.belongToCorpId"
|
|
|
+ @choceFun="choceFun"
|
|
|
+ />
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -245,6 +390,21 @@ import {getDeptLazyTree,
|
|
|
getGoods,} from "@/api/basicData/customerInquiry";
|
|
|
import {selectGoodsNum} from "@/api/basicData/inventoryAccount"; // 库存查询
|
|
|
import {getUserInfo} from "@/api/system/user"; //登录用户信息
|
|
|
+import {dataDetail, removeGoods, typeSave, dealerSubmit} from "@/api/dealer/purchase";
|
|
|
+import {
|
|
|
+ isDiscount,
|
|
|
+ isPercentage,
|
|
|
+ micrometerFormat,
|
|
|
+ IntegerFormat
|
|
|
+} from "@/util/validate";
|
|
|
+import reportDialog from "@/components/report-dialog/main";
|
|
|
+import financialAccount from "../../../components/finance/financialAccount";
|
|
|
+import checkSchedule from "@/components/check/checkSchedule";
|
|
|
+import billApplication from "@/components/bill/billApplication";
|
|
|
+import { customerList as feeList } from "@/api/basicData/basicFeesDesc";
|
|
|
+import {getDetail} from "@/api/basicData/inventoryAccount";
|
|
|
+import { getToken } from "@/util/auth";
|
|
|
+import { getCurrentDate } from "@/util/date";
|
|
|
|
|
|
export default {
|
|
|
name: "detail",
|
|
@@ -253,9 +413,18 @@ export default {
|
|
|
type: Object
|
|
|
}
|
|
|
},
|
|
|
+ components: {
|
|
|
+ reportDialog,
|
|
|
+ billApplication,
|
|
|
+ financialAccount,
|
|
|
+ checkSchedule,
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
pageLoading: false,
|
|
|
+ btnLoading: false,
|
|
|
+ disabled: false,
|
|
|
+ confirmDisabled: false, // 确认禁用
|
|
|
form: {},
|
|
|
option: {
|
|
|
menuBtn: false,
|
|
@@ -272,7 +441,7 @@ export default {
|
|
|
}
|
|
|
],
|
|
|
span: 16,
|
|
|
- slot: true
|
|
|
+ slot: true,
|
|
|
},
|
|
|
{
|
|
|
label: "业务时间",
|
|
@@ -290,6 +459,31 @@ export default {
|
|
|
]
|
|
|
},
|
|
|
{
|
|
|
+ label: "批次号",
|
|
|
+ prop: "lotNo",
|
|
|
+ rules: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: " ",
|
|
|
+ trigger: "blur"
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ span: 8,
|
|
|
+ slot: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "收货仓库",
|
|
|
+ prop: "storageId",
|
|
|
+ span: 8,
|
|
|
+ rules: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: " ",
|
|
|
+ trigger: "change"
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ },
|
|
|
+ {
|
|
|
label: "电话",
|
|
|
prop: "corpTel",
|
|
|
span: 8
|
|
@@ -320,48 +514,56 @@ export default {
|
|
|
},
|
|
|
{
|
|
|
label: "打印时间",
|
|
|
- prop: "a",
|
|
|
+ prop: "printTime",
|
|
|
span: 8,
|
|
|
disabled: true
|
|
|
},
|
|
|
{
|
|
|
label: "打印次数",
|
|
|
- prop: "a",
|
|
|
+ prop: "printNumber",
|
|
|
span: 8,
|
|
|
disabled: true
|
|
|
},
|
|
|
{
|
|
|
label: "客户欠款",
|
|
|
- prop: "a",
|
|
|
+ prop: "corpDebt",
|
|
|
span: 8,
|
|
|
disabled: true
|
|
|
},
|
|
|
{
|
|
|
label: "总数量",
|
|
|
- prop: "b",
|
|
|
+ prop: "orderQuantity",
|
|
|
span: 8,
|
|
|
disabled: true
|
|
|
},
|
|
|
{
|
|
|
label: "应付金额",
|
|
|
- prop: "c",
|
|
|
+ prop: "debitAmount",
|
|
|
span: 8,
|
|
|
disabled: true
|
|
|
},
|
|
|
{
|
|
|
label: "总金额",
|
|
|
- prop: "d",
|
|
|
+ prop: "amount",
|
|
|
span: 8,
|
|
|
disabled: true
|
|
|
},
|
|
|
{
|
|
|
label: "制单人",
|
|
|
- prop: "createUser",
|
|
|
+ prop: "createUserName",
|
|
|
span: 8,
|
|
|
disabled: true,
|
|
|
},
|
|
|
]
|
|
|
},
|
|
|
+ // 仓库配置
|
|
|
+ configurationWarehouse: {
|
|
|
+ multipleChoices: false,
|
|
|
+ multiple: false,
|
|
|
+ collapseTags: false,
|
|
|
+ placeholder: "请点击右边按钮选择",
|
|
|
+ dicData: [],
|
|
|
+ },
|
|
|
dataList: [],
|
|
|
tableOption: {},
|
|
|
dialogVisible: false,
|
|
@@ -405,6 +607,25 @@ export default {
|
|
|
treeStyle: "height:" + (window.innerHeight - 315) + "px",
|
|
|
goodsoptions: [],
|
|
|
uploadData: [],
|
|
|
+ activeName: 'searchList',
|
|
|
+ // 商品列表数据合计
|
|
|
+ goodsListShow: [],
|
|
|
+ // 商品列表暂存
|
|
|
+ goodsListSave: [],
|
|
|
+ pageList: {
|
|
|
+ pageSize: 10,
|
|
|
+ currentPage: 1,
|
|
|
+ total: 0
|
|
|
+ },
|
|
|
+ applyPaymentList: [],
|
|
|
+ billType:"收费", //账单类型
|
|
|
+ billData:{}, //账单需要数据
|
|
|
+ applySettlementDialog:false,//生成账单组件
|
|
|
+ financialAccountDialog:false,
|
|
|
+ feesOption: [],
|
|
|
+ unitOption: [],
|
|
|
+ baseURL: '/api/blade-purchase-sales/orderitems/importDealerOrder',
|
|
|
+ headers: { "Blade-Auth": 'Bearer ' + getToken()},
|
|
|
}
|
|
|
},
|
|
|
async created() {
|
|
@@ -416,19 +637,27 @@ export default {
|
|
|
this.getColumnName(83),
|
|
|
goodsOption
|
|
|
);
|
|
|
+ this.getWorkDicts('unit').then(res => {
|
|
|
+ this.unitOption = res.data.data;
|
|
|
+ })
|
|
|
getGoods(1, 500).then(res => {
|
|
|
this.goodsoptions = res.data.data.records;
|
|
|
});
|
|
|
getUserInfo().then(res => {
|
|
|
- this.$set(this.form, 'createUser', res.data.data.realName)
|
|
|
+ this.$set(this.form, 'createUserName', res.data.data.realName)
|
|
|
+ this.$set(this.form, 'createUser', res.data.data.id)
|
|
|
})
|
|
|
-
|
|
|
- if (this.detailData.id) {
|
|
|
- this.$set(this.form, 'id', this.detailData.id)
|
|
|
- this.$set(this.form, 'businesDate', this.detailData.row.businesDate)
|
|
|
- this.$set(this.form, 'corpId', this.detailData.row.corpsName)
|
|
|
- this.$set(this.form, 'corpTel', '1918766221')
|
|
|
- this.$set(this.form, 'arrivalAddress', '山东省青岛市')
|
|
|
+ feeList().then(res => {
|
|
|
+ this.feesOption = res.data.data.records
|
|
|
+ });
|
|
|
+ this.$set(this.form, 'businesDate', getCurrentDate());
|
|
|
+ this.$set(this.form, 'status', 0);
|
|
|
+ if (this.detailData.query) {
|
|
|
+ this.disabled = true;
|
|
|
+ this.option.column.map(e => {
|
|
|
+ this.$set(e, 'disabled', true)
|
|
|
+ })
|
|
|
+ this.queryData(this.detailData.id);
|
|
|
} else {
|
|
|
this.dataList = [
|
|
|
{
|
|
@@ -438,9 +667,9 @@ export default {
|
|
|
brandItem: null,
|
|
|
specsOne: null,
|
|
|
specsTwo: null,
|
|
|
- a: null,
|
|
|
+ unit: null,
|
|
|
storageQuantity: 0,
|
|
|
- actualQuantity: 0,
|
|
|
+ orderQuantity: 0,
|
|
|
size: null,
|
|
|
price: 0,
|
|
|
amount: 0,
|
|
@@ -449,18 +678,74 @@ export default {
|
|
|
]
|
|
|
}
|
|
|
},
|
|
|
+ filters: {
|
|
|
+ IntegerFormat(num) {
|
|
|
+ return IntegerFormat(num);
|
|
|
+ },
|
|
|
+ decimalFormat(num) {
|
|
|
+ return num ? Number(num).toFixed(2) : "0.00";
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
+ // 查询
|
|
|
+ queryData(id) {
|
|
|
+ this.pageLoading = true;
|
|
|
+ dataDetail(id).then(res => {
|
|
|
+ this.form = res.data.data;
|
|
|
+ this.form.amount = Number(this.form.amount).toFixed(2);
|
|
|
+ this.confirmDisabled = this.form.status == 3? true: false;
|
|
|
+ if (this.confirmDisabled) {
|
|
|
+ this.option.column.map(e => {
|
|
|
+ this.$set(e, 'disabled', true)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ this.dataList = this.form.orderItemsList? this.form.orderItemsList: [];
|
|
|
+ this.uploadData = this.form.orderFilesList? this.form.orderFilesList: [];
|
|
|
+ delete this.form.orderItemsList;
|
|
|
+ delete this.form.orderFilesList;
|
|
|
+ }).finally(() => {
|
|
|
+ this.pageLoading = false;
|
|
|
+ })
|
|
|
+ },
|
|
|
cellStyle() {
|
|
|
return "padding:0;height:40px;";
|
|
|
},
|
|
|
- openEdit() {},
|
|
|
+ openEdit() {
|
|
|
+ this.disabled = false;
|
|
|
+ if (this.form.status != 3) {
|
|
|
+ this.option.column.map(e => {
|
|
|
+ this.$set(e, 'disabled', false)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
copyDoc() {
|
|
|
this.$emit("copyOrder", this.form.id);
|
|
|
},
|
|
|
getCorpData(row) {},
|
|
|
//修改提交触发
|
|
|
editCustomer(status) {
|
|
|
- this.$message.success('保存成功')
|
|
|
+ this.$refs["form"].validate((valid, done) => {
|
|
|
+ done();
|
|
|
+ if (valid) {
|
|
|
+ // 总金额计算
|
|
|
+ let amount = 0;
|
|
|
+ this.dataList.forEach(item => {
|
|
|
+ amount = Number(amount) + Number(item.amount)
|
|
|
+ })
|
|
|
+ this.$set(this.form, 'debitAmount', amount.toFixed(2));
|
|
|
+ this.$set(this.form, 'amount', amount.toFixed(2));
|
|
|
+ this.form.billType = 'CG';
|
|
|
+ this.$set(this.form, 'itemsVOList', this.dataList);
|
|
|
+ this.$set(this.form, 'orderFilesList', this.uploadData);
|
|
|
+ this.btnLoading = true;
|
|
|
+ typeSave(this.form).then(res => {
|
|
|
+ this.$message({type: "success", message: this.form.id ? "修改成功!" : "新增成功!"});
|
|
|
+ this.queryData(res.data.data);
|
|
|
+ }).finally(() => {
|
|
|
+ this.btnLoading = false;
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
//返回列表
|
|
|
backToList() {
|
|
@@ -499,26 +784,32 @@ export default {
|
|
|
},
|
|
|
//商品明细导入
|
|
|
newDetails() {
|
|
|
+ this.$refs["form"].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ this.dialogVisible = !this.dialogVisible;
|
|
|
+ }
|
|
|
+ })
|
|
|
// if (!this.form.corpId) {
|
|
|
// return this.$message.error("请选择客户名称");
|
|
|
// }
|
|
|
- this.dialogVisible = !this.dialogVisible;
|
|
|
},
|
|
|
importGoods() {
|
|
|
+ let form = {};
|
|
|
if (this.reData) {
|
|
|
if (this.selectionList.length != 1) {
|
|
|
return this.$message.error("重新选择的时候只能选择一条数据");
|
|
|
} else {
|
|
|
this.selectionList.forEach(e => {
|
|
|
- this.dataList.forEach((item, index) => {
|
|
|
+ this.dataList.forEach(async (item, index) => {
|
|
|
if (index == this.reData.index) {
|
|
|
- selectGoodsNum({
|
|
|
+ form = await this.getStockInfo({
|
|
|
+ tradeType: 'JXS',
|
|
|
goodsId: e.id,
|
|
|
- itemType: e.typeno,
|
|
|
- tradeType: 'GN'
|
|
|
- }).then((res) => {
|
|
|
- item.storageQuantity = res.data.data
|
|
|
+ storageId: this.form.storageId,
|
|
|
+ lotNo: e.batch == 1? this.form.lotNo: null
|
|
|
})
|
|
|
+ item.storageQuantity = form.stock;
|
|
|
+ item.purchaseAmount = form.purchaseAmount;
|
|
|
item.itemId = e.id;
|
|
|
item.code = e.code;
|
|
|
item.cname = e.cname;
|
|
@@ -528,6 +819,9 @@ export default {
|
|
|
item.specsOne = e.specsOne;
|
|
|
item.specsTwo = e.specsTwo;
|
|
|
item.typeno = e.typeno;
|
|
|
+ item.unit = e.unit;
|
|
|
+ item.size = e.size;
|
|
|
+ item.lotNo = e.batch == 1? this.form.lotNo: null;
|
|
|
item.priceCategory = e.goodsTypeName;
|
|
|
item.$cellEdit = true;
|
|
|
}
|
|
@@ -535,13 +829,16 @@ export default {
|
|
|
});
|
|
|
}
|
|
|
} else {
|
|
|
- this.selectionList.forEach(e => {
|
|
|
- selectGoodsNum({
|
|
|
- goodsId: e.id,
|
|
|
- itemType: e.typeno,
|
|
|
- tradeType: 'GN'
|
|
|
- }).then(res => {
|
|
|
- e.storageQuantity = res.data.data
|
|
|
+ if (this.goodsListSave.length > 0) { // 暂存的有数据
|
|
|
+ this.goodsListSave.forEach(async e => {
|
|
|
+ form = await this.getStockInfo({
|
|
|
+ tradeType: 'JXS',
|
|
|
+ goodsId: e.id,
|
|
|
+ storageId: this.form.storageId,
|
|
|
+ lotNo: e.batch == 1? this.form.lotNo: null
|
|
|
+ })
|
|
|
+ e.storageQuantity = form.stock;
|
|
|
+ e.purchaseAmount = form.purchaseAmount;
|
|
|
this.dataList.push({
|
|
|
itemId: e.id,
|
|
|
code: e.code,
|
|
@@ -552,14 +849,49 @@ export default {
|
|
|
typeno: e.typeno,
|
|
|
corpId: e.corpId,
|
|
|
corpName: e.corpName,
|
|
|
+ unit: e.unit,
|
|
|
+ size: e.size,
|
|
|
price: 0,
|
|
|
amount: 0,
|
|
|
- actualQuantity: 0,
|
|
|
+ orderQuantity: 0,
|
|
|
storageQuantity: e.storageQuantity,
|
|
|
+ purchaseAmount: e.purchaseAmount,
|
|
|
+ lotNo: e.batch == 1? this.form.lotNo: null,
|
|
|
$cellEdit: true
|
|
|
});
|
|
|
- })
|
|
|
- });
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.selectionList.forEach(async e => {
|
|
|
+ form = await this.getStockInfo({
|
|
|
+ tradeType: 'JXS',
|
|
|
+ goodsId: e.id,
|
|
|
+ storageId: this.form.storageId,
|
|
|
+ lotNo: e.batch == 1? this.form.lotNo: null
|
|
|
+ })
|
|
|
+ e.storageQuantity = form.stock;
|
|
|
+ e.purchaseAmount = form.purchaseAmount;
|
|
|
+ this.dataList.push({
|
|
|
+ itemId: e.id,
|
|
|
+ code: e.code,
|
|
|
+ cname: e.cname,
|
|
|
+ brandItem: e.brandItem,
|
|
|
+ specsOne: e.specsOne,
|
|
|
+ specsTwo: e.specsTwo,
|
|
|
+ typeno: e.typeno,
|
|
|
+ corpId: e.corpId,
|
|
|
+ corpName: e.corpName,
|
|
|
+ unit: e.unit,
|
|
|
+ size: e.size,
|
|
|
+ price: 0,
|
|
|
+ amount: 0,
|
|
|
+ orderQuantity: 0,
|
|
|
+ storageQuantity: e.storageQuantity,
|
|
|
+ purchaseAmount: e.purchaseAmount,
|
|
|
+ lotNo: e.batch == 1? this.form.lotNo: null,
|
|
|
+ $cellEdit: true
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
this.dialogVisible = false;
|
|
|
},
|
|
@@ -567,6 +899,8 @@ export default {
|
|
|
this.selectionList = [];
|
|
|
this.treeDeptId = "";
|
|
|
this.reData = null;
|
|
|
+ this.activeName = 'searchList';
|
|
|
+ this.goodsListSave = [];
|
|
|
},
|
|
|
nodeClick(data) {
|
|
|
this.treeDeptId = data.id;
|
|
@@ -647,36 +981,90 @@ export default {
|
|
|
type: "warning"
|
|
|
}).then(() => {
|
|
|
if (row.id) {
|
|
|
+ removeGoods(row.id).then(res => {
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '删除成功!'
|
|
|
+ })
|
|
|
+ this.dataList.splice(row.$index, 1);
|
|
|
+ })
|
|
|
} else {
|
|
|
this.$message({
|
|
|
type: "success",
|
|
|
message: "删除成功!"
|
|
|
});
|
|
|
- this.data.splice(row.$index, 1);
|
|
|
+ this.dataList.splice(row.$index, 1);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ codeChange(row) {
|
|
|
+ let form = {};
|
|
|
+ this.goodsoptions.forEach(async e => {
|
|
|
+ if (e.code == row.code) {
|
|
|
+ if (e.batch == 0) {
|
|
|
+ form = await this.getStockInfo({
|
|
|
+ tradeType: 'JXS',
|
|
|
+ goodsId: e.id,
|
|
|
+ storageId: this.form.storageId,
|
|
|
+ })
|
|
|
+ e.storageQuantity = form.stock;
|
|
|
+ e.purchaseAmount = form.purchaseAmount;
|
|
|
+ e.arr = [];
|
|
|
+ } else {
|
|
|
+ e.storageQuantity = 0
|
|
|
+ e.purchaseAmount = 0;
|
|
|
+ e.arr = await this.getLotNo({
|
|
|
+ itemId: e.id,
|
|
|
+ storageId: this.form.storageId,
|
|
|
+ tradeType: 'JXS'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ row.itemId = e.id;
|
|
|
+ row.storageQuantity = e.storageQuantity;
|
|
|
+ row.cname = e.cname;
|
|
|
+ row.code = e.code;
|
|
|
+ row.corpId = e.corpId;
|
|
|
+ row.corpName = e.corpName;
|
|
|
+ row.brandItem = e.brandItem;
|
|
|
+ row.specsOne = e.specsOne;
|
|
|
+ row.specsTwo = e.specsTwo;
|
|
|
+ row.typeno = e.typeno;
|
|
|
+ row.unit = e.unit;
|
|
|
+ row.size = e.size;
|
|
|
+ row.arr = e.arr;
|
|
|
+ row.priceCategory = e.goodsTypeName;
|
|
|
+ row.purchaseAmount = e.purchaseAmount;
|
|
|
+ row.batch = e.batch;
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
cnameChange(row) {
|
|
|
- this.goodsoptions.forEach(e => {
|
|
|
+ let form = {};
|
|
|
+ this.goodsoptions.forEach(async e => {
|
|
|
if (e.id == row.itemId) {
|
|
|
- selectGoodsNum({
|
|
|
+ form = await this.getStockInfo({
|
|
|
+ tradeType: 'JXS',
|
|
|
goodsId: e.id,
|
|
|
- itemType: e.typeno,
|
|
|
- tradeType: 'GN'
|
|
|
- }).then(res => {
|
|
|
- row.storageQuantity = res.data.data
|
|
|
- row.cname = e.cname;
|
|
|
- row.code = e.code;
|
|
|
- row.corpId = e.corpId;
|
|
|
- row.corpName = e.corpName;
|
|
|
- row.brandItem = e.brandItem;
|
|
|
- row.specsOne = e.specsOne;
|
|
|
- row.specsTwo = e.specsTwo;
|
|
|
- row.typeno = e.typeno;
|
|
|
- row.priceCategory = e.goodsTypeName;
|
|
|
- row.purchaseAmount = 0;
|
|
|
- row.amount = 0;
|
|
|
+ storageId: this.form.storageId,
|
|
|
+ lotNo: e.batch == 1? this.form.lotNo: null
|
|
|
})
|
|
|
+ e.storageQuantity = form.stock;
|
|
|
+ e.purchaseAmount = form.purchaseAmount;
|
|
|
+ row.cname = e.cname;
|
|
|
+ row.code = e.code;
|
|
|
+ row.corpId = e.corpId;
|
|
|
+ row.corpName = e.corpName;
|
|
|
+ row.brandItem = e.brandItem;
|
|
|
+ row.specsOne = e.specsOne;
|
|
|
+ row.specsTwo = e.specsTwo;
|
|
|
+ row.typeno = e.typeno;
|
|
|
+ row.unit = e.unit;
|
|
|
+ row.size = e.size;
|
|
|
+ row.priceCategory = e.goodsTypeName;
|
|
|
+ row.storageQuantity = e.storageQuantity;
|
|
|
+ row.purchaseAmount = e.purchaseAmount;
|
|
|
+ row.lotNo = e.batch == 1? this.form.lotNo: null;
|
|
|
+ // row.amount = 0;
|
|
|
}
|
|
|
});
|
|
|
},
|
|
@@ -689,13 +1077,152 @@ export default {
|
|
|
},
|
|
|
// 商品信息价格计算
|
|
|
amountChange(row) {
|
|
|
- if (!row.actualQuantity) {
|
|
|
- row.actualQuantity = 0;
|
|
|
+ if (!row.orderQuantity) {
|
|
|
+ row.orderQuantity = 0;
|
|
|
}
|
|
|
if (!row.price) {
|
|
|
row.price = 0;
|
|
|
}
|
|
|
- row.amount = Number(row.price) * Number(row.actualQuantity)
|
|
|
+ row.amount = Number(row.price) * Number(row.orderQuantity)
|
|
|
+ },
|
|
|
+ // 标签页切换
|
|
|
+ tabHandle(data) {
|
|
|
+ if (data.name == 'searchList') {
|
|
|
+ this.goodsListShow = this.goodsList;
|
|
|
+ this.page.total = this.pageList.total
|
|
|
+ } else if (data.name == 'importStaging') {
|
|
|
+ this.goodsListShow = this.goodsListSave;
|
|
|
+ this.page.total = 0
|
|
|
+ }
|
|
|
+ },
|
|
|
+ removeStagList(row, index) {
|
|
|
+ this.goodsListSave.splice(row.$index, 1)
|
|
|
+ },
|
|
|
+ importStagList(row, index) {
|
|
|
+ this.goodsListSave.push(row);
|
|
|
+ },
|
|
|
+ // 生成结算
|
|
|
+ applySettlement(type) {
|
|
|
+ this.beforeBillData(true,type)
|
|
|
+ this.financialAccountDialog = true;
|
|
|
+ },
|
|
|
+ //生成账单 拿到主表信息
|
|
|
+ beforeBillData(bool,type) {
|
|
|
+ this.billType = type;
|
|
|
+ this.applyPaymentList = [];
|
|
|
+ this.dataList.map(e => {
|
|
|
+ const form = {
|
|
|
+ srcOrderno:this.form.orderNo,
|
|
|
+ srcParentId: this.form.id,
|
|
|
+ itemType:"采购",
|
|
|
+ corpsName:this.form.corpsName,
|
|
|
+ corpId:this.form.corpId,
|
|
|
+ currency: 'CNY',
|
|
|
+ exchangeRate: '1',
|
|
|
+ taxRate: '0',
|
|
|
+ accDate: this.form.businesDate,
|
|
|
+ srcType: 1,
|
|
|
+ // chargeMember: this.form.chargeMember,
|
|
|
+ parentId: this.form.id,
|
|
|
+ tradeType: 'JXS',
|
|
|
+ optionType: 'JXS',
|
|
|
+ amount: e.amount,
|
|
|
+ costType: this.feesOption.find(item => item.cname == '货款')? this.feesOption.find(item => item.cname == '货款').id: null,
|
|
|
+ srcFeesId: e.id,
|
|
|
+ cname: e.cname,
|
|
|
+ price: e.price,
|
|
|
+ quantity: e.orderQuantity,
|
|
|
+ }
|
|
|
+ this.applyPaymentList.push(form);
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //关闭账单
|
|
|
+ choceFun(){
|
|
|
+ this.financialAccountDialog = false
|
|
|
+ },
|
|
|
+ // 获得库存信息
|
|
|
+ async getStockInfo(data) {
|
|
|
+ //tradeType JXS
|
|
|
+ //goodsId
|
|
|
+ //storageId
|
|
|
+ //lotNo 批次号
|
|
|
+ let form = {};
|
|
|
+ await getDetail(data).then(res => {
|
|
|
+ const a = res.data.data? res.data.data: {
|
|
|
+ stock: 0,
|
|
|
+ balanceAmount: 0,
|
|
|
+ balanceQuantity: 0,
|
|
|
+ };
|
|
|
+ this.$set(form, 'purchaseAmount', a.balanceQuantity == 0? 0: (Number(a.balanceAmount) / Number(a.balanceQuantity)).toFixed(2));
|
|
|
+ this.$set(form, 'stock', a.balanceQuantity);
|
|
|
+ })
|
|
|
+ return form;
|
|
|
+ },
|
|
|
+ // 确认或者取消订单
|
|
|
+ dealerSubmit() {
|
|
|
+ let dealer;
|
|
|
+ if (this.form.status == 0) {
|
|
|
+ dealer = 1;
|
|
|
+ } else if (this.form.status == 3) {
|
|
|
+ dealer = 2;
|
|
|
+ }
|
|
|
+ this.btnLoading = true;
|
|
|
+ dealerSubmit({
|
|
|
+ id: this.form.id,
|
|
|
+ dealer
|
|
|
+ }).then(res => {
|
|
|
+ if (res.data.code == 200) {
|
|
|
+ this.$message.success('操作成功')
|
|
|
+ this.queryData(this.form.id)
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.data.msg)
|
|
|
+ }
|
|
|
+ }).finally(() => {
|
|
|
+ this.btnLoading = false;
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 下载模板
|
|
|
+ downloadHandle() {
|
|
|
+ this.$confirm('是否下载模板文件?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ window.open(
|
|
|
+ `/api/blade-purchase-sales/orderitems/exportDealerOrder?${
|
|
|
+ this.website.tokenHeader
|
|
|
+ }=${getToken()}`
|
|
|
+ );
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: '已取消'
|
|
|
+ });
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //文件上传时
|
|
|
+ uploading(event, file, fileList) {
|
|
|
+ this.openFullScreen(false, '文件正在解析中');
|
|
|
+ },
|
|
|
+ importTemplate(res, file) {
|
|
|
+ this.openFullScreen(true)
|
|
|
+ res.data.forEach(item => {
|
|
|
+ })
|
|
|
+ this.dataList = this.dataList.concat(res.data)
|
|
|
+ },
|
|
|
+ uploadError(err, file, fileList) {
|
|
|
+ this.openFullScreen(true)
|
|
|
+ this.$message.error(JSON.parse(err.message).msg)
|
|
|
+ },
|
|
|
+ //遮罩层
|
|
|
+ openFullScreen(res, text) {
|
|
|
+ const loading = this.$loading({
|
|
|
+ lock: true,
|
|
|
+ text: text,
|
|
|
+ spinner: 'el-icon-loading',
|
|
|
+ background: 'rgba(0, 0, 0, 0.7)'
|
|
|
+ });
|
|
|
+ if (res === true) loading.close();
|
|
|
},
|
|
|
},
|
|
|
}
|