|
|
@@ -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,33 @@
|
|
|
size="small"
|
|
|
class="el-button--small-yh"
|
|
|
@click.stop="openEdit"
|
|
|
+ v-if="form.id"
|
|
|
>编 辑</el-button>
|
|
|
<el-button
|
|
|
+ type="primary"
|
|
|
+ size="small"
|
|
|
+ style="margin-right: 8px;"
|
|
|
+ @click="dealerSubmit"
|
|
|
+ :disabled="disabled"
|
|
|
+ >
|
|
|
+ {{ 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"
|
|
|
+ :disabled="!form.id || disabled"
|
|
|
size="small"
|
|
|
@click="copyDoc"
|
|
|
+ :loading="btnLoading"
|
|
|
>
|
|
|
复制单据
|
|
|
</el-button>
|
|
|
@@ -28,6 +50,8 @@
|
|
|
type="primary"
|
|
|
@click="editCustomer"
|
|
|
size="small"
|
|
|
+ :loading="btnLoading"
|
|
|
+ :disabled="disabled"
|
|
|
>保存数据
|
|
|
</el-button>
|
|
|
</div>
|
|
|
@@ -46,6 +70,7 @@
|
|
|
v-model="form.corpId"
|
|
|
@getCorpData="getCorpData"
|
|
|
corpType="KH"
|
|
|
+ :disabled="disabled"
|
|
|
/>
|
|
|
</template>
|
|
|
<template slot="belongToCorpId">
|
|
|
@@ -53,12 +78,30 @@
|
|
|
v-model="form.belongToCorpId"
|
|
|
@getCorpData="getGSData"
|
|
|
corpType="GS"
|
|
|
+ :disabled="disabled"
|
|
|
/>
|
|
|
</template>
|
|
|
<template slot="storageId">
|
|
|
<warehouse-select
|
|
|
v-model="form.storageId"
|
|
|
- :configuration="configurationWarehouse"/>
|
|
|
+ :configuration="configurationWarehouse"
|
|
|
+ :disabled="disabled"/>
|
|
|
+ </template>
|
|
|
+ <template slot="chargeMember">
|
|
|
+ <el-select
|
|
|
+ v-model="form.chargeMember"
|
|
|
+ filterable
|
|
|
+ clearable
|
|
|
+ size="small"
|
|
|
+ :disabled="disabled"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="(item,index) in userList"
|
|
|
+ :key="index"
|
|
|
+ :label="item.realName"
|
|
|
+ :value="item.realName"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
</template>
|
|
|
</avue-form>
|
|
|
</basic-container>
|
|
|
@@ -78,12 +121,13 @@
|
|
|
icon="el-icon-plus"
|
|
|
size="small"
|
|
|
@click.stop="newDetails"
|
|
|
+ :disabled="disabled"
|
|
|
>录入明细</el-button>
|
|
|
<el-button
|
|
|
type="info"
|
|
|
icon="el-icon-printer"
|
|
|
size="small"
|
|
|
- @click.stop="openReport()"
|
|
|
+ @click.stop="openReport"
|
|
|
>报 表</el-button
|
|
|
>
|
|
|
</template>
|
|
|
@@ -93,6 +137,7 @@
|
|
|
icon="el-icon-edit"
|
|
|
type="text"
|
|
|
@click="rowCell(row, index)"
|
|
|
+ :disabled="disabled"
|
|
|
>{{ row.$cellEdit ? "保存" : "修改" }}</el-button
|
|
|
>
|
|
|
<el-button
|
|
|
@@ -100,6 +145,7 @@
|
|
|
icon="el-icon-delete"
|
|
|
type="text"
|
|
|
@click="rowDel(row, index)"
|
|
|
+ :disabled="disabled"
|
|
|
>删除</el-button
|
|
|
>
|
|
|
</template>
|
|
|
@@ -129,17 +175,17 @@
|
|
|
|
|
|
<span v-else> {{ row.cname }}</span>
|
|
|
</template>
|
|
|
- <template slot="actualQuantity" slot-scope="{ row, index }">
|
|
|
+ <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%"
|
|
|
/>
|
|
|
- <span v-else>{{ row.actualQuantity }}</span>
|
|
|
+ <span v-else>{{ row.orderQuantity | IntegerFormat }}</span>
|
|
|
</template>
|
|
|
<template slot="price" slot-scope="{ row, index }">
|
|
|
<el-input-number
|
|
|
@@ -154,29 +200,54 @@
|
|
|
<span v-else>{{ row.price }}</span>
|
|
|
</template>
|
|
|
<!-- 单位-->
|
|
|
- <template slot="a" slot-scope="{ row, index }">
|
|
|
+ <template slot="unit" slot-scope="{ row, index }">
|
|
|
<el-input
|
|
|
v-if="row.$cellEdit"
|
|
|
- v-model="row.a"
|
|
|
+ v-model="row.unit"
|
|
|
size="small"
|
|
|
></el-input>
|
|
|
- <span v-else>{{ row.a }}</span>
|
|
|
+ <span v-else>{{ row.unit }}</span>
|
|
|
+ </template>
|
|
|
+ <template slot="amount" slot-scope="{ row, index }">
|
|
|
+ <span>{{ row.amount | decimalFormat }}</span>
|
|
|
</template>
|
|
|
-<!-- 尺寸-->
|
|
|
- <template slot="size" slot-scope="{ row, index }">
|
|
|
+ <template slot="storageQuantity" slot-scope="{ row, index }">
|
|
|
+ <span>{{ row.storageQuantity | IntegerFormat }}</span>
|
|
|
+ </template>
|
|
|
+ <template slot="lotNo" slot-scope="{ row, index }">
|
|
|
+ <span v-if="row.batch == 1" style="color: #c90707;margin-right: 3px">*</span>
|
|
|
+ <el-select
|
|
|
+ v-if="row.$cellEdit"
|
|
|
+ v-model="row.lotNo"
|
|
|
+ size="small"
|
|
|
+ filterable
|
|
|
+ allow-create
|
|
|
+ clearable
|
|
|
+ @change="lotNoChange(row)"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="(item, index) in row.arr"
|
|
|
+ :key="index"
|
|
|
+ :label="item.lotNo"
|
|
|
+ :value="item.lotNo"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ <span v-else>{{ row.lotNo }}</span>
|
|
|
+ </template>
|
|
|
+ <template slot="remarks" slot-scope="{ row, index }">
|
|
|
<el-input
|
|
|
v-if="row.$cellEdit"
|
|
|
- v-model="row.size"
|
|
|
+ v-model="row.remarks"
|
|
|
size="small"
|
|
|
- ></el-input>
|
|
|
- <span v-else>{{ row.size }}</span>
|
|
|
+ />
|
|
|
+ <span v-else>{{ row.remarks }}</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"
|
|
|
@@ -187,8 +258,10 @@
|
|
|
:data="uploadData"
|
|
|
deleteUrl="/api/blade-client/corpsbank/update"
|
|
|
:enumerationValue="84"
|
|
|
+ :disabled="disabled"
|
|
|
/>
|
|
|
</div>
|
|
|
+<!-- 商品弹窗-->
|
|
|
<el-dialog
|
|
|
title="导入商品"
|
|
|
append-to-body
|
|
|
@@ -221,7 +294,7 @@
|
|
|
<avue-crud
|
|
|
:option="goodsOption"
|
|
|
:table-loading="loading"
|
|
|
- :data="goodsList"
|
|
|
+ :data="goodsListShow"
|
|
|
ref="goodsCrud"
|
|
|
:search.sync="search"
|
|
|
@search-change="searchChange"
|
|
|
@@ -232,7 +305,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>
|
|
|
@@ -242,11 +341,38 @@
|
|
|
<el-button
|
|
|
type="primary"
|
|
|
@click="importGoods"
|
|
|
- :disabled="selectionList.length == 0"
|
|
|
+ :disabled="selectionList.length == 0 && goodsListSave.length == 0"
|
|
|
>导入</el-button
|
|
|
>
|
|
|
</span>
|
|
|
</el-dialog>
|
|
|
+<!-- 报表-->
|
|
|
+ <report-dialog
|
|
|
+ :switchDialog="switchDialog"
|
|
|
+ :reportId="form.id"
|
|
|
+ reportName="代理商-报表"
|
|
|
+ @onClose="onClose()"
|
|
|
+ />
|
|
|
+<!-- 账单-->
|
|
|
+ <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>
|
|
|
|
|
|
@@ -256,8 +382,22 @@ import goodsOption from "./config/commodity.json";
|
|
|
import {getDeptLazyTree,
|
|
|
getGoods,} from "@/api/basicData/customerInquiry";
|
|
|
import {getUserInfo} from "@/api/system/user";
|
|
|
+import { gainUser } from "@/api/basicData/customerInquiry";
|
|
|
import {selectGoodsNum} from "@/api/basicData/inventoryAccount"; // 库存查询
|
|
|
import {detail as KHDetail} from "@/api/basicData/customerInformation";
|
|
|
+import {dataDetail, removeGoods, typeSave, getLotNo, dealerSubmit} from "@/api/dealer/sales";
|
|
|
+import reportDialog from "@/components/report-dialog/main";
|
|
|
+import {
|
|
|
+ isDiscount,
|
|
|
+ isPercentage,
|
|
|
+ micrometerFormat,
|
|
|
+ IntegerFormat
|
|
|
+} from "@/util/validate";
|
|
|
+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";
|
|
|
|
|
|
export default {
|
|
|
name: "detail",
|
|
|
@@ -266,9 +406,17 @@ export default {
|
|
|
type: Object
|
|
|
}
|
|
|
},
|
|
|
+ components: {
|
|
|
+ reportDialog,
|
|
|
+ billApplication,
|
|
|
+ financialAccount,
|
|
|
+ checkSchedule,
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
pageLoading: false,
|
|
|
+ btnLoading: false,
|
|
|
+ disabled: false, // 编辑
|
|
|
form: {},
|
|
|
option: {
|
|
|
menuBtn: false,
|
|
|
@@ -285,7 +433,7 @@ export default {
|
|
|
}
|
|
|
],
|
|
|
span: 16,
|
|
|
- slot: true
|
|
|
+ slot: true,
|
|
|
},
|
|
|
{
|
|
|
label: "业务时间",
|
|
|
@@ -313,21 +461,33 @@ export default {
|
|
|
}
|
|
|
],
|
|
|
span: 16,
|
|
|
- slot: true
|
|
|
+ slot: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: "发货仓库",
|
|
|
+ prop: "storageId",
|
|
|
+ span: 8,
|
|
|
+ rules: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: " ",
|
|
|
+ trigger: "change"
|
|
|
+ }
|
|
|
+ ],
|
|
|
},
|
|
|
{
|
|
|
label: "电话",
|
|
|
prop: "corpTel",
|
|
|
- span: 8
|
|
|
+ span: 8,
|
|
|
},
|
|
|
{
|
|
|
label: "地址",
|
|
|
prop: "arrivalAddress",
|
|
|
- span: 8
|
|
|
+ span: 8,
|
|
|
},
|
|
|
{
|
|
|
label: "经办人",
|
|
|
- prop: "e",
|
|
|
+ prop: "chargeMember",
|
|
|
span: 8,
|
|
|
},
|
|
|
{
|
|
|
@@ -339,16 +499,11 @@ export default {
|
|
|
props: {
|
|
|
label: "dictValue",
|
|
|
value: "dictValue"
|
|
|
- }
|
|
|
+ },
|
|
|
},
|
|
|
{
|
|
|
label: "配送方式",
|
|
|
- prop: "f",
|
|
|
- span: 8,
|
|
|
- },
|
|
|
- {
|
|
|
- label: "发货仓库",
|
|
|
- prop: "storageId",
|
|
|
+ prop: "distributionMode",
|
|
|
span: 8,
|
|
|
},
|
|
|
{
|
|
|
@@ -356,7 +511,7 @@ export default {
|
|
|
prop: "orderRemark",
|
|
|
type: "textarea",
|
|
|
minRows: 2,
|
|
|
- span: 24
|
|
|
+ span: 24,
|
|
|
},
|
|
|
],
|
|
|
},
|
|
|
@@ -372,43 +527,43 @@ 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,
|
|
|
},
|
|
|
@@ -465,6 +620,24 @@ export default {
|
|
|
dicData: [],
|
|
|
},
|
|
|
uploadData: [],
|
|
|
+ switchDialog: false, // 报表弹窗控制
|
|
|
+ userList: [],
|
|
|
+ activeName: 'searchList',
|
|
|
+ // 商品列表数据合计
|
|
|
+ goodsListShow: [],
|
|
|
+ // 商品列表暂存
|
|
|
+ goodsListSave: [],
|
|
|
+ pageList: {
|
|
|
+ pageSize: 10,
|
|
|
+ currentPage: 1,
|
|
|
+ total: 0
|
|
|
+ },
|
|
|
+ applyPaymentList: [],
|
|
|
+ billType:"收费", //账单类型
|
|
|
+ billData:{}, //账单需要数据
|
|
|
+ applySettlementDialog:false,//生成账单组件
|
|
|
+ financialAccountDialog:false,
|
|
|
+ feesOption: [],
|
|
|
}
|
|
|
},
|
|
|
async created() {
|
|
|
@@ -480,21 +653,22 @@ export default {
|
|
|
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', this.detailData.row.tel)
|
|
|
- this.$set(this.form, 'arrivalAddress', this.detailData.row.attn)
|
|
|
- this.$set(this.form, 'createUser', this.detailData.row.createUser)
|
|
|
- this.$set(this.form, 'storageId', this.detailData.row.storageId)
|
|
|
- this.$set(this.form, 'paymentType', this.detailData.row.paymentType)
|
|
|
- this.$set(this.form, 'belongToCorpId', this.detailData.row.belongToCorpId)
|
|
|
- this.$set(this.form, 'e', this.detailData.row.e)
|
|
|
- this.$set(this.form, 'f', this.detailData.row.f)
|
|
|
-
|
|
|
+ gainUser().then(res => {
|
|
|
+ this.userList = res.data.data;
|
|
|
+ });
|
|
|
+ feeList().then(res => {
|
|
|
+ this.feesOption = res.data.data.records
|
|
|
+ });
|
|
|
+ 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 = [
|
|
|
{
|
|
|
@@ -504,9 +678,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,
|
|
|
@@ -515,11 +689,48 @@ 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.dataList = this.form.orderItemsList? this.form.orderItemsList: [];
|
|
|
+ this.uploadData = this.form.orderFilesList? this.form.orderFilesList: [];
|
|
|
+ delete this.form.orderItemsList;
|
|
|
+ delete this.form.orderFilesList;
|
|
|
+ this.dataList.forEach(async item => {
|
|
|
+ if (item.batch == 1) {
|
|
|
+ item.arr = await this.getLotNo({
|
|
|
+ itemId: item.itemId,
|
|
|
+ storageId: this.form.storageId,
|
|
|
+ tradeType: 'JXS'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }).finally(() => {
|
|
|
+ this.pageLoading = false;
|
|
|
+ })
|
|
|
+ },
|
|
|
cellStyle() {
|
|
|
return "padding:0;height:40px;";
|
|
|
},
|
|
|
- openEdit() {},
|
|
|
+ openEdit() {
|
|
|
+ this.disabled = false;
|
|
|
+ this.option.column.map(e => {
|
|
|
+ // e.disabled = false;
|
|
|
+ this.$set(e, 'disabled', false)
|
|
|
+ })
|
|
|
+ },
|
|
|
copyDoc() {
|
|
|
this.$emit("copyOrder", this.form.id);
|
|
|
},
|
|
|
@@ -535,7 +746,37 @@ export default {
|
|
|
getGSData(row) {},
|
|
|
//修改提交触发
|
|
|
editCustomer(status) {
|
|
|
- this.$message.success('保存成功')
|
|
|
+ this.$refs["form"].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ for (let item in this.dataList) {
|
|
|
+ if (this.dataList[item].batch == 1 && !this.dataList[item].lotNo) {
|
|
|
+ return this.$message.error('第' +( Number(item) + 1) + '行明细批次号未填写')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 总金额计算
|
|
|
+ let amount = 0;
|
|
|
+ this.dataList.forEach((item, index) => {
|
|
|
+ if (item.batch == 1 && !item.lotNo) {
|
|
|
+
|
|
|
+ }
|
|
|
+ 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 = 'XS';
|
|
|
+ this.$set(this.form, 'orderItemsList', 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.id);
|
|
|
+ }).finally(() => {
|
|
|
+ this.btnLoading = false;
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
//返回列表
|
|
|
backToList() {
|
|
|
@@ -574,26 +815,64 @@ export default {
|
|
|
},
|
|
|
//商品明细导入
|
|
|
newDetails() {
|
|
|
- // if (!this.form.corpId) {
|
|
|
- // return this.$message.error("请选择客户名称");
|
|
|
- // }
|
|
|
- this.dialogVisible = !this.dialogVisible;
|
|
|
+ this.$refs["form"].validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ this.dialogVisible = !this.dialogVisible;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 获得库存价
|
|
|
+ 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;
|
|
|
+ },
|
|
|
+ // 获得批次号
|
|
|
+ async getLotNo(data) {
|
|
|
+ let arr = [];
|
|
|
+ await getLotNo(data).then(res => {
|
|
|
+ arr = res.data.data? res.data.data: []
|
|
|
+ })
|
|
|
+ return arr;
|
|
|
},
|
|
|
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({
|
|
|
- goodsId: e.id,
|
|
|
- itemType: e.typeno,
|
|
|
- tradeType: 'GN'
|
|
|
- }).then((res) => {
|
|
|
- item.storageQuantity = res.data.data
|
|
|
- })
|
|
|
+ if (e.batch == 0) {
|
|
|
+ form = await this.getStockInfo({
|
|
|
+ tradeType: 'JXS',
|
|
|
+ goodsId: e.id,
|
|
|
+ storageId: this.form.storageId,
|
|
|
+ })
|
|
|
+ item.storageQuantity = form.stock;
|
|
|
+ item.purchaseAmount = form.purchaseAmount;
|
|
|
+ } else {
|
|
|
+ item.storageQuantity = 0
|
|
|
+ item.purchaseAmount = 0;
|
|
|
+ item.arr = await this.getLotNo({
|
|
|
+ itemId: e.id,
|
|
|
+ storageId: this.form.storageId,
|
|
|
+ tradeType: 'JXS'
|
|
|
+ });
|
|
|
+ }
|
|
|
item.itemId = e.id;
|
|
|
item.code = e.code;
|
|
|
item.cname = e.cname;
|
|
|
@@ -603,20 +882,37 @@ export default {
|
|
|
item.specsOne = e.specsOne;
|
|
|
item.specsTwo = e.specsTwo;
|
|
|
item.typeno = e.typeno;
|
|
|
+ item.unit = e.unit;
|
|
|
+ item.size = e.size;
|
|
|
item.priceCategory = e.goodsTypeName;
|
|
|
+ item.purchaseAmount = e.purchaseAmount;
|
|
|
+ item.batch = e.batch;
|
|
|
item.$cellEdit = true;
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
} 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 => {
|
|
|
+ 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'
|
|
|
+ });
|
|
|
+ }
|
|
|
this.dataList.push({
|
|
|
itemId: e.id,
|
|
|
code: e.code,
|
|
|
@@ -627,14 +923,61 @@ 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,
|
|
|
+ batch: e.batch,
|
|
|
+ arr: e.arr,
|
|
|
$cellEdit: true
|
|
|
});
|
|
|
- })
|
|
|
- });
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.selectionList.forEach(async e => {
|
|
|
+ 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'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ 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,
|
|
|
+ batch: e.batch,
|
|
|
+ arr: e.arr,
|
|
|
+ $cellEdit: true
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
this.dialogVisible = false;
|
|
|
},
|
|
|
@@ -642,13 +985,15 @@ export default {
|
|
|
this.selectionList = [];
|
|
|
this.treeDeptId = "";
|
|
|
this.reData = null;
|
|
|
+ this.activeName = 'searchList';
|
|
|
+ this.goodsListSave = [];
|
|
|
},
|
|
|
nodeClick(data) {
|
|
|
this.treeDeptId = data.id;
|
|
|
this.page.currentPage = 1;
|
|
|
this.onLoad(this.page);
|
|
|
},
|
|
|
- //费用查询
|
|
|
+ //商品查询
|
|
|
onLoad(page, params = {}) {
|
|
|
let obj = this.deepClone(Object.assign(params, this.search));
|
|
|
this.loading = true;
|
|
|
@@ -657,6 +1002,8 @@ export default {
|
|
|
const data = res.data.data;
|
|
|
this.page.total = data.total;
|
|
|
this.goodsList = data.records;
|
|
|
+ this.pageList.total = data.total;
|
|
|
+ this.goodsListShow = data.records;
|
|
|
if (this.page.total) {
|
|
|
this.goodsOption.height = window.innerHeight - 350;
|
|
|
}
|
|
|
@@ -707,7 +1054,14 @@ export default {
|
|
|
}, 1000);
|
|
|
}
|
|
|
},
|
|
|
- openReport() {},
|
|
|
+ // 报表
|
|
|
+ openReport() {
|
|
|
+ this.switchDialog =! this.switchDialog;
|
|
|
+ },
|
|
|
+ // 报表关闭
|
|
|
+ onClose(val) {
|
|
|
+ this.switchDialog = val;
|
|
|
+ },
|
|
|
rowCell(row, index) {
|
|
|
if (row.$cellEdit == true) {
|
|
|
this.$set(row, "$cellEdit", false);
|
|
|
@@ -722,36 +1076,59 @@ 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);
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
cnameChange(row) {
|
|
|
- this.goodsoptions.forEach(e => {
|
|
|
+ let form = {};
|
|
|
+ this.goodsoptions.forEach(async e => {
|
|
|
if (e.id == row.itemId) {
|
|
|
- selectGoodsNum({
|
|
|
- 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;
|
|
|
- })
|
|
|
+ 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.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;
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
@@ -764,13 +1141,104 @@ 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.orgOrderNo,
|
|
|
+ itemType:"销售",
|
|
|
+ corpsName:this.form.corpName,
|
|
|
+ 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
|
|
|
+ }
|
|
|
+ this.applyPaymentList.push(form);
|
|
|
+ })
|
|
|
+ },
|
|
|
+ //关闭账单
|
|
|
+ choceFun(){
|
|
|
+ this.financialAccountDialog = false
|
|
|
+ },
|
|
|
+ // 批次号选择
|
|
|
+ async lotNoChange(row) {
|
|
|
+ if (row.lotNo) {
|
|
|
+ const form = await this.getStockInfo({
|
|
|
+ tradeType: 'JXS',
|
|
|
+ goodsId: row.itemId,
|
|
|
+ storageId: this.form.storageId,
|
|
|
+ lotNo: row.lotNo
|
|
|
+ })
|
|
|
+ row.storageQuantity = form.stock;
|
|
|
+ row.purchaseAmount = form.purchaseAmount;
|
|
|
+ } else {
|
|
|
+ row.storageQuantity = 0;
|
|
|
+ row.purchaseAmount = 0;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 确认或者取消订单
|
|
|
+ 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;
|
|
|
+ })
|
|
|
},
|
|
|
},
|
|
|
}
|