|
@@ -13,31 +13,26 @@
|
|
|
v-model="queryParams.orderType"
|
|
|
placeholder="订单类型"
|
|
|
@keyup.enter.native.prevent
|
|
|
- @change="handleQuery">
|
|
|
- <el-option
|
|
|
- key="contractOrder"
|
|
|
- label="合同单"
|
|
|
- value="false">
|
|
|
+ @change="handleQuery"
|
|
|
+ >
|
|
|
+ <el-option key="contractOrder" label="合同单" value="contractOrder">
|
|
|
</el-option>
|
|
|
- <el-option
|
|
|
- key="retailOrder"
|
|
|
- label="零售单"
|
|
|
- value="true">
|
|
|
+ <el-option key="retailOrder" label="零售单" value="retailOrder">
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="通知单号" prop="noticeNumber">
|
|
|
+ <el-form-item label="合同号" prop="saleNo">
|
|
|
<el-input
|
|
|
- v-model="queryParams.noticeNumber"
|
|
|
+ v-model="queryParams.saleNo"
|
|
|
placeholder="请输入通知单号"
|
|
|
clearable
|
|
|
@keyup.enter.native="handleQuery"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="日期" prop="noticeDate">
|
|
|
+ <el-form-item label="日期" prop="saleDate">
|
|
|
<el-date-picker
|
|
|
clearable
|
|
|
- v-model="queryParams.noticeDate"
|
|
|
+ v-model="queryParams.saleDate"
|
|
|
type="date"
|
|
|
value-format="yyyy-MM-dd"
|
|
|
placeholder="请选择通知日期"
|
|
@@ -87,13 +82,11 @@
|
|
|
icon="el-icon-search"
|
|
|
size="mini"
|
|
|
@click="handleQuery"
|
|
|
- >搜索
|
|
|
- </el-button
|
|
|
- >
|
|
|
+ >搜索
|
|
|
+ </el-button>
|
|
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
|
|
|
- >重置
|
|
|
- </el-button
|
|
|
- >
|
|
|
+ >重置
|
|
|
+ </el-button>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
|
|
@@ -142,9 +135,8 @@
|
|
|
size="mini"
|
|
|
@click="handleExport"
|
|
|
v-hasPermi="['system:ProductInvoice:export']"
|
|
|
- >导出
|
|
|
- </el-button
|
|
|
- >
|
|
|
+ >导出
|
|
|
+ </el-button>
|
|
|
</el-col>
|
|
|
<right-toolbar
|
|
|
:showSearch.sync="showSearch"
|
|
@@ -159,17 +151,13 @@
|
|
|
>
|
|
|
<!-- <el-table-column label="编号" align="center" prop="id" />
|
|
|
-->
|
|
|
- <el-table-column
|
|
|
- label="日期"
|
|
|
- align="center"
|
|
|
- prop="noticeDate"
|
|
|
- width="180"
|
|
|
- >
|
|
|
+ <el-table-column type="selection" width="55" align="center" />
|
|
|
+ <el-table-column label="日期" align="center" prop="saleDate" width="180">
|
|
|
<template slot-scope="scope">
|
|
|
- <span>{{ parseTime(scope.row.noticeDate, "{y}-{m}-{d}") }}</span>
|
|
|
+ <span>{{ parseTime(scope.row.saleDate, "{y}-{m}-{d}") }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="通知单号" align="center" prop="noticeNumber"/>
|
|
|
+ <el-table-column label="合同号" align="center" prop="saleNo" />
|
|
|
|
|
|
<!-- <el-table-column label="销售员" align="center" prop="salesman" />
|
|
|
<el-table-column label="客户编号" align="center" prop="customerId" />
|
|
@@ -189,7 +177,13 @@
|
|
|
<el-table-column label="售货单位" align="center" prop="sellingUnit" />
|
|
|
<el-table-column label="计算类型" align="center" prop="calculationType" />
|
|
|
<el-table-column label="审核意见" align="center" prop="auditOpinion" /> -->
|
|
|
- <el-table-column label="客户名称" align="center" prop="customerName"/>
|
|
|
+ <el-table-column label="客户名称" align="center" prop="customName" />
|
|
|
+ <el-table-column
|
|
|
+ label="金额(大写)"
|
|
|
+ align="center"
|
|
|
+ prop="saleAmountInWords"
|
|
|
+ />
|
|
|
+ <el-table-column label="销售" align="center" prop="salesman" />
|
|
|
<!-- <el-table-column label="状态" align="center" prop="status">
|
|
|
<template slot-scope="scope">{{ scope.row.status }}</template>
|
|
|
</el-table-column> -->
|
|
@@ -216,10 +210,23 @@
|
|
|
>
|
|
|
</el-dropdown-item> -->
|
|
|
<el-dropdown-item>
|
|
|
- <el-button type="text" size="mini" @click="handleSendOrder(scope.$index, scope.row)">
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ size="mini"
|
|
|
+ @click="handleSendOrder(scope.$index, scope.row)"
|
|
|
+ >
|
|
|
打印对账单
|
|
|
</el-button>
|
|
|
</el-dropdown-item>
|
|
|
+ <el-dropdown-item>
|
|
|
+ <el-button
|
|
|
+ type="text"
|
|
|
+ size="mini"
|
|
|
+ @click="handleDetail(scope.$index, scope.row)"
|
|
|
+ >
|
|
|
+ 详情
|
|
|
+ </el-button>
|
|
|
+ </el-dropdown-item>
|
|
|
</el-dropdown-menu>
|
|
|
</el-dropdown>
|
|
|
</template>
|
|
@@ -233,6 +240,16 @@
|
|
|
:limit.sync="queryParams.pageSize"
|
|
|
@pagination="getList"
|
|
|
/>
|
|
|
+ <!-- 详情弹窗 -->
|
|
|
+ <el-dialog title="详情" :visible.sync="detailShow" width="1250px">
|
|
|
+ <div ref="detailTable" id="detail"></div>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="detailShow = false">关 闭</el-button>
|
|
|
+ <!-- <el-button type="primary" @click="detailPrintHandler"
|
|
|
+ >打 印</el-button
|
|
|
+ > -->
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
<div id="printDom"></div>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -251,13 +268,36 @@ import {
|
|
|
productInvoiceInfo,
|
|
|
queryDropDownBoxData,
|
|
|
printDocuments,
|
|
|
+ getProductSpecificationsByProductName,
|
|
|
} from "@/api/tablelist/commonTable";
|
|
|
-import {mapState} from "vuex";
|
|
|
+import { getSaleOrderProductionList } from "@/api/dragform/form";
|
|
|
+import { mapState } from "vuex";
|
|
|
+import {
|
|
|
+ saleOrderList,
|
|
|
+ getRoleUser,
|
|
|
+ addRetailOrder,
|
|
|
+ getRetailOrderInfo,
|
|
|
+ editRetailOrder,
|
|
|
+ retailProductInvoiceInfo,
|
|
|
+ submitRetailOrder,
|
|
|
+ cancelRetailOrder,
|
|
|
+ deleRetailOrder,
|
|
|
+ submitProductInvoice,
|
|
|
+ getProductInventory,
|
|
|
+ updateOrder,
|
|
|
+} from "@/api/system/retailMange.js";
|
|
|
|
|
|
export default {
|
|
|
name: "ProductInvoice",
|
|
|
+ dicts: ["sales_order_type", "payment_method", "direction_of_twist"],
|
|
|
data() {
|
|
|
return {
|
|
|
+ formData: {},
|
|
|
+ salesmanList: [],
|
|
|
+ colourNumberOptions: [],
|
|
|
+ sliceTypeOptions: [],
|
|
|
+ allProductionOptions: [],
|
|
|
+ detailShow: false,
|
|
|
customerOptions: [],
|
|
|
// 遮罩层
|
|
|
loading: true,
|
|
@@ -279,6 +319,8 @@ export default {
|
|
|
open: false,
|
|
|
// 查询参数
|
|
|
queryParams: {
|
|
|
+ saleDate: "",
|
|
|
+ saleNo: "",
|
|
|
pageNum: 1,
|
|
|
pageSize: 10,
|
|
|
noticeNumber: null,
|
|
@@ -294,7 +336,7 @@ export default {
|
|
|
calculationType: null,
|
|
|
auditOpinion: null,
|
|
|
status: 2,
|
|
|
- orderType: "contractOrder" // 零售单/合同单
|
|
|
+ orderType: "contractOrder", // 零售单/合同单
|
|
|
},
|
|
|
// 表单参数
|
|
|
form: {},
|
|
@@ -307,13 +349,612 @@ export default {
|
|
|
},
|
|
|
computed: {
|
|
|
...mapState({
|
|
|
+ nickName: (state) => state.user.nickName,
|
|
|
+ userInfo: (state) => state.user,
|
|
|
username: (state) => state.user.name,
|
|
|
}),
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 客户名称改变回调
|
|
|
+ customChangeHandler(val) {
|
|
|
+ // if (!val) return;
|
|
|
+ let customData = this.customerOptions.find(
|
|
|
+ (item) => item.customNo == val
|
|
|
+ );
|
|
|
+ this.formData.customAddress = customData?.customAddress || "无";
|
|
|
+ this.formData.customCountryType = customData?.customCountryType || "无";
|
|
|
+ this.formData.contactPerson = customData?.contactPerson || "无";
|
|
|
+ },
|
|
|
+ // 根据字典value获取字典label
|
|
|
+ getDictLabel(value, dict) {
|
|
|
+ return (
|
|
|
+ this.dict.type[dict].find((item) => {
|
|
|
+ return item.value === value;
|
|
|
+ })?.label || ""
|
|
|
+ );
|
|
|
+ },
|
|
|
+ // 获取详情数据
|
|
|
+ async handleDetail(index, row) {
|
|
|
+ if (this.queryParams.orderType == "contractOrder") {
|
|
|
+ //销售订单
|
|
|
+ this.printDomData = await this.getDetailTableString(row);
|
|
|
+ this.detailShow = true;
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.detailTable.innerHTML = this.printDomData;
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ // 零售订单
|
|
|
+ this.handlePrint(row);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 获取销售员角色列表
|
|
|
+ async getRoleUser() {
|
|
|
+ try {
|
|
|
+ let res = await getRoleUser("salesman");
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.salesmanList = res.data.map((item) => {
|
|
|
+ return {
|
|
|
+ label: item.nickName,
|
|
|
+ value: item.nickName,
|
|
|
+ id: item.userId,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$message.error("获取销售员角色列表失败");
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 零售订单详情
|
|
|
+ async handlePrint(row) {
|
|
|
+ // await this.getDropDownData();
|
|
|
+ this.isLeader = !this.userInfo.roles.includes("salesman");
|
|
|
+ if (!this.isLeader) {
|
|
|
+ this.createById = this.userInfo.userId;
|
|
|
+ }
|
|
|
+ await this.getRoleUser();
|
|
|
+ try {
|
|
|
+ let res = await getRetailOrderInfo(row.id);
|
|
|
+ console.log(res);
|
|
|
+ if (res.code == 200) {
|
|
|
+ await this.initData(res.data);
|
|
|
+ this.printDomData = this.getPrintDom(res.data);
|
|
|
+ this.detailShow = true;
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.detailTable.innerHTML = this.printDomData;
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.msg);
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async initData(data) {
|
|
|
+ let {
|
|
|
+ id,
|
|
|
+ //订单表数据
|
|
|
+ saleNo,
|
|
|
+ saleCustomNo,
|
|
|
+ saleDate,
|
|
|
+ saleOrderEstimatedTime,
|
|
|
+ saleLeadTime,
|
|
|
+ deliveryDate,
|
|
|
+ saleAmounts,
|
|
|
+ saleAmountInWords,
|
|
|
+ salePayType,
|
|
|
+ salesman,
|
|
|
+ customAddress,
|
|
|
+ customCountryType, //国家类型
|
|
|
+ contactPerson, //联系人
|
|
|
+ truckRegistration, //货车登记
|
|
|
+
|
|
|
+ // 工艺表数据
|
|
|
+ remark,
|
|
|
+
|
|
|
+ // 产品列表
|
|
|
+ saleProductsList,
|
|
|
+ } = data;
|
|
|
+ this.form.truckRegistration = truckRegistration;
|
|
|
+ Object.assign(this.formData, {
|
|
|
+ id,
|
|
|
+ //订单表数据
|
|
|
+ saleNo,
|
|
|
+ saleCustomNo,
|
|
|
+ saleDate,
|
|
|
+ saleOrderEstimatedTime,
|
|
|
+ saleLeadTime,
|
|
|
+ deliveryDate,
|
|
|
+ saleAmounts,
|
|
|
+ saleAmountInWords,
|
|
|
+ salePayType,
|
|
|
+ salesman,
|
|
|
+ customAddress,
|
|
|
+ customCountryType, //国家类型
|
|
|
+ contactPerson, //联系人
|
|
|
+
|
|
|
+ // 工艺表数据
|
|
|
+ orderRemark: remark,
|
|
|
+ });
|
|
|
+ this.customChangeHandler(saleCustomNo);
|
|
|
+ let promiseArr = [],
|
|
|
+ promiseArr2 = [];
|
|
|
+ this.productionTableData = saleProductsList.map((item, index) => {
|
|
|
+ let {
|
|
|
+ id,
|
|
|
+ saleProductNo,
|
|
|
+ productNo, //货品编号
|
|
|
+ productName, //货品名称
|
|
|
+ productNumber, //销售数量
|
|
|
+ productWeight, //销售重量kg
|
|
|
+ productUnitPrice, //单价
|
|
|
+ productAmounts, //金额
|
|
|
+ sliceType, //切片类型 初始为 切片
|
|
|
+ sliceTypeLabel,
|
|
|
+ colourNumberLabel,
|
|
|
+ colourNumber, //色号
|
|
|
+ remark, //备注
|
|
|
+ lotNumber, //批号
|
|
|
+ } = item;
|
|
|
+ let targetItem = this.allProductionOptions.find(
|
|
|
+ (i) => item.productNo == i.productNo
|
|
|
+ );
|
|
|
+ // item.productType = targetItem?.productType;
|
|
|
+ let productType = targetItem?.productType;
|
|
|
+ let productSpecifications = targetItem?.productSpecifications;
|
|
|
+ promiseArr[index] = getProductSpecificationsByProductName({
|
|
|
+ productName: item.productName,
|
|
|
+ });
|
|
|
+ promiseArr2[index] = getProductInventory({
|
|
|
+ productNo,
|
|
|
+ productType,
|
|
|
+ lotNumber,
|
|
|
+ productName,
|
|
|
+ productSpecifications,
|
|
|
+ });
|
|
|
+ return {
|
|
|
+ id,
|
|
|
+ saleProductNo,
|
|
|
+ productSpecifications, //规格
|
|
|
+ productNo, //货品编号
|
|
|
+ productType, //类型
|
|
|
+ productName, //货品名称
|
|
|
+ productNumber, //销售数量
|
|
|
+ productWeight, //销售重量kg
|
|
|
+ productUnitPrice, //单价
|
|
|
+ productAmounts, //金额
|
|
|
+ sliceType, //切片类型 初始为 切片
|
|
|
+ sliceTypeLabel,
|
|
|
+ colourNumberLabel,
|
|
|
+ colourNumber, //色号
|
|
|
+ remark,
|
|
|
+ lotNumber,
|
|
|
+ inventoryBoxNum: 0,
|
|
|
+ inventoryWeight: 0,
|
|
|
+ specificationsList: [],
|
|
|
+ };
|
|
|
+ });
|
|
|
+ let promiseRes = await Promise.all(promiseArr);
|
|
|
+ promiseRes.forEach((item, index) => {
|
|
|
+ this.productionTableData[index].specificationsList = item.data;
|
|
|
+ });
|
|
|
+ let promiseRes2 = await Promise.all(promiseArr2);
|
|
|
+ promiseRes2.forEach((item, index) => {
|
|
|
+ this.productionTableData[index].inventoryWeight =
|
|
|
+ item.data.inventoryWeight || 0;
|
|
|
+ this.productionTableData[index].inventoryBoxNum =
|
|
|
+ item.data.inventoryBoxNum || 0;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 获取打印dom
|
|
|
+ getPrintDom(data) {
|
|
|
+ let {
|
|
|
+ id,
|
|
|
+ //订单表数据
|
|
|
+ saleNo,
|
|
|
+ saleCustomNo,
|
|
|
+ saleDate,
|
|
|
+ saleOrderEstimatedTime,
|
|
|
+ saleLeadTime,
|
|
|
+ deliveryDate,
|
|
|
+ saleAmounts,
|
|
|
+ saleAmountInWords,
|
|
|
+ salePayType,
|
|
|
+ salesman,
|
|
|
+ customAddress,
|
|
|
+ customCountryType, //国家类型
|
|
|
+ contactPerson, //联系人
|
|
|
+
|
|
|
+ // 工艺表数据
|
|
|
+ orderRemark,
|
|
|
+ } = this.formData;
|
|
|
+ console.log(this.form, this.productionTableData);
|
|
|
+ let { truckRegistration } = this.form;
|
|
|
+ let customData = this.customerOptions.find(
|
|
|
+ (item) => item.customNo == saleCustomNo
|
|
|
+ );
|
|
|
+ let customerName = customData ? customData.customName : "";
|
|
|
+ let printStr = `
|
|
|
+ <table style="width:1200px; border-collapse:collapse;" border="1" cellpadding="10" align="center">
|
|
|
+ <div style="text-align:center;font-size: 20px;">诸暨市新丝维纤维有限公司</div>
|
|
|
+ <div style="text-align:center;">销售合同审计单</div>
|
|
|
+ <tbody>
|
|
|
+ <tr>
|
|
|
+ <td width="600px" colspan="4">合同号:${saleNo}</td>
|
|
|
+ <td width="600px" colspan="5">日期:${saleDate.replace(
|
|
|
+ "T",
|
|
|
+ " "
|
|
|
+ )}</td>
|
|
|
+ </tr>
|
|
|
+ <tr align="center">
|
|
|
+ <td width="300px" colspan="2">客户名称:</td>
|
|
|
+ <td width="300px" colspan="3">${customerName}</td>
|
|
|
+ <td colspan="2">业务员:</td>
|
|
|
+ <td colspan="2">${salesman}</td>
|
|
|
+
|
|
|
+ </tr>
|
|
|
+ <tr align="center">
|
|
|
+ <td width="300px" colspan="2">客户地址:</td>
|
|
|
+ <td width="300px" colspan="3">${customAddress}</td>
|
|
|
+ <td width="300px" colspan="2">客户国别:</td>
|
|
|
+ <td width="300px" colspan="2">${customCountryType}</td>
|
|
|
+ </tr>
|
|
|
+ <tr align="center">
|
|
|
+ <td width="300px" colspan="2">联系人:</td>
|
|
|
+ <td width="150px" colspan="2">${contactPerson}</td>
|
|
|
+ <td colspan="2">合计金额(大写):</td>
|
|
|
+ <td colspan="3">${saleAmountInWords}</td>
|
|
|
+ </tr>
|
|
|
+ <tr align="center">
|
|
|
+ <td colspan="9">货品明细</td>
|
|
|
+ </tr>
|
|
|
+ <tr align="center">
|
|
|
+ <td width="150px">品名</td>
|
|
|
+ <td width="100px">规格</td>
|
|
|
+ <td width="100px">色号</td>
|
|
|
+ <td width="100px">类型</td>
|
|
|
+ <td width="100px">批号</td>
|
|
|
+ <td width="100px">箱数</td>
|
|
|
+ <td width="100px">单价</td>
|
|
|
+ <td width="100px">金额</td>
|
|
|
+ <td width="100px">备注</td>
|
|
|
+ </tr>`;
|
|
|
+ let amountTotal = 0,
|
|
|
+ singlTotal = 0,
|
|
|
+ moneyTotal = 0;
|
|
|
+ for (let i = 0; i < this.productionTableData.length; i++) {
|
|
|
+ let item = this.productionTableData[i];
|
|
|
+ amountTotal += Number(item.productNumber);
|
|
|
+ singlTotal += Number(item.productUnitPrice);
|
|
|
+ moneyTotal += Number(item.productAmounts);
|
|
|
+ let productData = this.allProductionOptions.find(
|
|
|
+ (pro) => pro.productNo == item.productNo
|
|
|
+ );
|
|
|
+ item.sliceTypeLabel =
|
|
|
+ this.sliceTypeOptions.find((k) => k.materielCode == item.sliceType)
|
|
|
+ ?.materielName || "";
|
|
|
+ item.colourNumberLabel = this.colourNumberOptions.find(
|
|
|
+ (k) => k.materielCode == item.colourNumber
|
|
|
+ )?.materieColorNumber;
|
|
|
+ let productName = productData ? productData.productName : "";
|
|
|
+ let productType = productData ? productData.productType : "";
|
|
|
+ printStr += `<tr align="center">
|
|
|
+ <td>${item.productName}</td>
|
|
|
+ <td>${item.productSpecifications}</td>
|
|
|
+ <td>${item.colourNumberLabel}</td>
|
|
|
+ <td>${item.productType}</td>
|
|
|
+ <td>${item.lotNumber}</td>
|
|
|
+ <td>${item.productNumber}</td>
|
|
|
+ <td>${item.productUnitPrice}</td>
|
|
|
+ <td>${item.productAmounts}</td>
|
|
|
+ <td>${item.remark}</td>
|
|
|
+ </tr>`;
|
|
|
+ }
|
|
|
+ // 计算小计
|
|
|
+ amountTotal = amountTotal;
|
|
|
+ singlTotal = singlTotal.toFixed(2);
|
|
|
+ moneyTotal = moneyTotal.toFixed(2);
|
|
|
+ printStr += `
|
|
|
+ <tr align="center">
|
|
|
+ <td>小计:</td>
|
|
|
+ <td></td>
|
|
|
+ <td></td>
|
|
|
+ <td></td>
|
|
|
+ <td></td>
|
|
|
+ <td>${amountTotal}</td>
|
|
|
+ <td>${singlTotal}</td>
|
|
|
+ <td>${moneyTotal}</td>
|
|
|
+ <td></td>
|
|
|
+ </tr>`;
|
|
|
+ printStr += `<tr align="left">
|
|
|
+ <td colspan="9">订单备注:${orderRemark}</td>
|
|
|
+ </tr>
|
|
|
+ </tbody>
|
|
|
+ </table>`;
|
|
|
+ return printStr;
|
|
|
+ },
|
|
|
+ // 获取详情html字符串
|
|
|
+ async getDetailTableString(row) {
|
|
|
+ let { saleNo } = row;
|
|
|
+ let payLoad = [
|
|
|
+ {
|
|
|
+ basicMap: {
|
|
|
+ tableName: "sale_order",
|
|
|
+ },
|
|
|
+ conditionMap: {
|
|
|
+ sale_no: [saleNo],
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ basicMap: {
|
|
|
+ tableName: "sale_products",
|
|
|
+ },
|
|
|
+ conditionMap: {
|
|
|
+ sale_order_no: [saleNo],
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ basicMap: {
|
|
|
+ tableName: "sale_craft",
|
|
|
+ },
|
|
|
+ conditionMap: {
|
|
|
+ sale_order_no: [saleNo],
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ let res = await queryDropDownBoxData(payLoad);
|
|
|
+ if (res.code == 200) {
|
|
|
+ console.log(res);
|
|
|
+ let { sale_craft, sale_order, sale_products } = res.data.resultMap;
|
|
|
+ let {
|
|
|
+ //订单表数据
|
|
|
+ saleNo, //合同号
|
|
|
+ lotNumber, //批号
|
|
|
+ saleCustomNo, //客户编号
|
|
|
+ saleDate, //销售单日期
|
|
|
+ saleOrderEstimatedTime, //预计下单时间
|
|
|
+ saleLeadTime, //交货周期
|
|
|
+ deliveryDate,
|
|
|
+ saleAmounts, //合计金额 小写
|
|
|
+ saleAmountInWords, //合计金额 大写
|
|
|
+ salePayType, //支付方式
|
|
|
+ earnestMoney,
|
|
|
+ salesman, //业务员
|
|
|
+ saleLeader, //业务主管
|
|
|
+ finance, //财务部
|
|
|
+ production, //生产部
|
|
|
+ saleApprover, //批准人
|
|
|
+ // customAddress, //客户地址
|
|
|
+ // customCountryType, //国家类型
|
|
|
+ // contactPerson, //联系人
|
|
|
+ // 货品明细表数据
|
|
|
+ // productNo, //货品号
|
|
|
+ // productName, //货品名称
|
|
|
+ // productNumber: "", //销售数量
|
|
|
+ // productWeight: "", //销售重量kg
|
|
|
+ // productUnitPrice: "", //单价
|
|
|
+ // productAmounts: "", //金额
|
|
|
+ // remark: "", //备注
|
|
|
+ // 工艺表
|
|
|
+ craftGrid, //网络
|
|
|
+ craftOil, //油剂
|
|
|
+ craftPackage, //卷装
|
|
|
+ craftColorFastness, //色牢度
|
|
|
+ directionOfTwist,
|
|
|
+ craftOther, //其它工艺要求
|
|
|
+ craftMark, //包装/贴唛
|
|
|
+ shippingMethod, //运输方式
|
|
|
+ } = { ...sale_craft[0], ...sale_order[0] };
|
|
|
+ let customData = this.customerOptions.find(
|
|
|
+ (item) => item.customNo == saleCustomNo
|
|
|
+ );
|
|
|
+ let payType = this.getDictLabel(salePayType, "payment_method"); //付款方式
|
|
|
+ let customerName = customData ? customData.customName : "";
|
|
|
+ let customAddress = customData?.customAddress || "无";
|
|
|
+ let customCountryType = customData?.customCountryType || "";
|
|
|
+ let contactPerson = customData?.contactPerson || "无";
|
|
|
+ let directionOfTwistDescription = directionOfTwist
|
|
|
+ ? this.getDictLabel(directionOfTwist, "direction_of_twist")
|
|
|
+ : "";
|
|
|
+ let printStr = `
|
|
|
+ <table style="width:1200px; border-collapse:collapse;" border="1" cellpadding="10" align="center">
|
|
|
+ <div style="text-align:center;font-size: 20px;">诸暨市新丝维纤维有限公司</div>
|
|
|
+ <div style="text-align:center;">销售合同审计单</div>
|
|
|
+ <tbody>
|
|
|
+ <tr>
|
|
|
+ <td width="600px" colspan="4">合同号:${saleNo}</td>
|
|
|
+ <td width="600px" colspan="5">日期:${saleDate.replace(
|
|
|
+ "T",
|
|
|
+ " "
|
|
|
+ )}</td>
|
|
|
+ </tr>
|
|
|
+ <tr align="center">
|
|
|
+ <td width="300px" colspan="2">客户名称:</td>
|
|
|
+ <td width="300px" colspan="2">${customerName}</td>
|
|
|
+ <td width="300px" colspan="2">联系人:</td>
|
|
|
+ <td width="150px" colspan="3">${contactPerson}</td>
|
|
|
+ </tr>
|
|
|
+ <tr align="center">
|
|
|
+ <td width="300px" colspan="2">客户地址:</td>
|
|
|
+ <td width="300px" colspan="3">${customAddress}</td>
|
|
|
+ <td width="300px" colspan="2">客户国别:</td>
|
|
|
+ <td width="300px" colspan="2">${customCountryType}</td>
|
|
|
+ </tr>
|
|
|
+ <tr align="center">
|
|
|
+ <td width="300px" colspan="2">预计下单时间:</td>
|
|
|
+ <td colspan="1">${saleOrderEstimatedTime.replace(
|
|
|
+ "T",
|
|
|
+ " "
|
|
|
+ )}</td>
|
|
|
+ <td colspan="2">交货周期:</td>
|
|
|
+ <td >${saleLeadTime}</td>
|
|
|
+ <td colspan="2">交货日期:</td>
|
|
|
+ <td >${deliveryDate.replace("T", " ")}</td>
|
|
|
+ </tr>
|
|
|
+ <tr align="center">
|
|
|
+ <td colspan="9">货品明细</td>
|
|
|
+ </tr>
|
|
|
+ <tr align="center">
|
|
|
+ <td width="150px">品名</td>
|
|
|
+ <td width="100px">规格</td>
|
|
|
+ <td width="100px">类型</td>
|
|
|
+ <td width="100px">色号</td>
|
|
|
+ <td width="150px">数量/kg</td>
|
|
|
+ <td width="150px">单价</td>
|
|
|
+ <td width="150px">金额</td>
|
|
|
+ <td width="150px">切片型号</td>
|
|
|
+ <td width="150px">备注</td>
|
|
|
+ </tr>`;
|
|
|
+ let amountTotal = 0,
|
|
|
+ singlTotal = 0,
|
|
|
+ moneyTotal = 0;
|
|
|
+ for (let i = 0; i < sale_products.length; i++) {
|
|
|
+ let item = sale_products[i];
|
|
|
+ amountTotal += Number(item.productNumber);
|
|
|
+ singlTotal += Number(item.productUnitPrice);
|
|
|
+ moneyTotal += Number(item.productAmounts);
|
|
|
+ let productData = this.allProductionOptions.find(
|
|
|
+ (pro) => pro.productNo == item.productNo
|
|
|
+ );
|
|
|
+ console.log(item.productNo, productData, this.allProductionOptions);
|
|
|
+ item.sliceTypeLabel =
|
|
|
+ this.sliceTypeOptions.find((k) => k.materielCode == item.sliceType)
|
|
|
+ ?.materielName || "";
|
|
|
+ item.colourNumberLabel = this.colourNumberOptions.find(
|
|
|
+ (k) => k.materielCode == item.colourNumber
|
|
|
+ )?.materieColorNumber;
|
|
|
+ // item.materieEncoding + item.materieColorNumber
|
|
|
+ let materieEncoding = this.colourNumberOptions.find(
|
|
|
+ (k) => k.materielCode == item.colourNumber
|
|
|
+ )?.materieEncoding;
|
|
|
+ let productName = productData ? productData.productName : "";
|
|
|
+ let productType = productData ? productData.productType : "";
|
|
|
+ let productSpecifications = productData
|
|
|
+ ? productData.productSpecifications
|
|
|
+ : ""; //规格
|
|
|
+ printStr += `<tr align="center">
|
|
|
+ <td>${productName}</td>
|
|
|
+ <td>${productSpecifications}</td>
|
|
|
+ <td>${productType}</td>
|
|
|
+ <td>${materieEncoding + item.colourNumberLabel}</td>
|
|
|
+ <td>${item.productNumber}</td>
|
|
|
+ <td>${item.productUnitPrice}</td>
|
|
|
+ <td>${item.productAmounts}</td>
|
|
|
+ <td>${item.sliceTypeLabel}</td>
|
|
|
+ <td>${item.remark}</td>
|
|
|
+ </tr>`;
|
|
|
+ }
|
|
|
+ // 计算小计
|
|
|
+ printStr += `
|
|
|
+ <tr align="center">
|
|
|
+ <td>小计:</td>
|
|
|
+ <td></td>
|
|
|
+ <td></td>
|
|
|
+ <td></td>
|
|
|
+ <td>${amountTotal.toFixed(2)}</td>
|
|
|
+ <td>${singlTotal.toFixed(2)}</td>
|
|
|
+ <td>${moneyTotal.toFixed(2)}</td>
|
|
|
+ <td></td>
|
|
|
+ <td></td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <td colspan="9">合计金额(大写):${saleAmountInWords}</td>
|
|
|
+ </tr>
|
|
|
+ `;
|
|
|
+
|
|
|
+ if (salePayType == "1") {
|
|
|
+ //定金
|
|
|
+ printStr += `
|
|
|
+ <tr>
|
|
|
+ <td colspan="4">付款方式:${payType}</td>
|
|
|
+ <td colspan="5">定金:${earnestMoney}</td>
|
|
|
+ </tr>`;
|
|
|
+ } else {
|
|
|
+ printStr += `
|
|
|
+ <tr>
|
|
|
+ <td colspan="9">付款方式:${payType}</td>
|
|
|
+ </tr>`;
|
|
|
+ }
|
|
|
+ printStr += `<tr align="center">
|
|
|
+ <td colspan="9">工艺要求</td>
|
|
|
+ </tr>
|
|
|
+ <tr align="center">
|
|
|
+ <td width="150px">网络</td>
|
|
|
+ <td width="150px">油剂</td>
|
|
|
+ <td width="150px">卷装</td>
|
|
|
+ <td width="150px">色牢度</td>
|
|
|
+ <td width="150px">捻向</td>
|
|
|
+ <td width="150px">其他</td>
|
|
|
+ <td width="150px"></td>
|
|
|
+ <td width="150px"></td>
|
|
|
+ <td width="150px"></td>
|
|
|
+ </tr>
|
|
|
+ <tr align="center">
|
|
|
+ <td >${craftGrid}</td>
|
|
|
+ <td>${craftOil}</td>
|
|
|
+ <td>${craftPackage}</td>
|
|
|
+ <td>${craftColorFastness}</td>
|
|
|
+ <td>${directionOfTwistDescription}</td>
|
|
|
+ <td>${craftOther}</td>
|
|
|
+ <td width="150px"></td>
|
|
|
+ <td width="150px"></td>
|
|
|
+ <td width="150px"></td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <td colspan="9">包装/贴唛:${craftMark}</td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <td colspan="9">装运方式:${shippingMethod}</td>
|
|
|
+ </tr>
|
|
|
+ <tr align="center">
|
|
|
+ <td colspan="2">业务员:</td>
|
|
|
+ <td colspan="2">${salesman}</td>
|
|
|
+ <td colspan="2">财务部:</td>
|
|
|
+ <td colspan="3">${finance}</td>
|
|
|
+
|
|
|
+ </tr>
|
|
|
+
|
|
|
+ <tr align="center">
|
|
|
+ <td colspan="2">业务主管:</td>
|
|
|
+ <td colspan="2">${saleApprover}</td>
|
|
|
+ <td></td>
|
|
|
+ <td></td>
|
|
|
+ <td></td>
|
|
|
+ <td></td>
|
|
|
+ <td></td>
|
|
|
+ </tr>
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ `;
|
|
|
+ return printStr;
|
|
|
+ // <td colspan="2">业务主管:</td>
|
|
|
+ // <td colspan="2">${saleLeader}</td>
|
|
|
+ // <tr align="center">
|
|
|
+
|
|
|
+ // // <td colspan="2">生产部:</td>
|
|
|
+ // // <td colspan="2">${production}</td>
|
|
|
+ // </tr>
|
|
|
+ // <tr align="center">
|
|
|
+ // <td colspan="2"> 2</td>
|
|
|
+ // <td> </td>
|
|
|
+ // <td> </td>
|
|
|
+ // <td> </td>
|
|
|
+ // <td> </td>
|
|
|
+ // </tr>
|
|
|
+ // <tr>
|
|
|
+ // <td colspan="2">小计:</td>
|
|
|
+ // <td></td>
|
|
|
+ // <td></td>
|
|
|
+ // <td></td>
|
|
|
+ // <td></td>
|
|
|
+ // </tr>
|
|
|
+ }
|
|
|
+ },
|
|
|
// 初始化下拉框数据
|
|
|
async initDropDownBoxData() {
|
|
|
try {
|
|
|
+ // 用户数据
|
|
|
let res = await queryDropDownBoxData([
|
|
|
{
|
|
|
basicMap: {
|
|
@@ -327,13 +968,58 @@ export default {
|
|
|
} else {
|
|
|
throw new Error(res);
|
|
|
}
|
|
|
+ // 产品数据
|
|
|
+ let proRes = await getSaleOrderProductionList();
|
|
|
+ if (proRes.code == 200) {
|
|
|
+ this.allProductionOptions = proRes.data || [];
|
|
|
+ } else {
|
|
|
+ throw Error("获取下拉框数据失败");
|
|
|
+ }
|
|
|
+ // 切片数据
|
|
|
+ let payLoad = [
|
|
|
+ {
|
|
|
+ basicMap: {
|
|
|
+ tableName: "materiel",
|
|
|
+ },
|
|
|
+ conditionMap: {
|
|
|
+ materiel_species: ["6"],
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ let res2 = await queryDropDownBoxData(payLoad);
|
|
|
+ if (res2.code == 200) {
|
|
|
+ console.log(res2.data.resultMap);
|
|
|
+ let { materiel } = res2.data.resultMap;
|
|
|
+ this.sliceTypeOptions = materiel || [];
|
|
|
+ } else {
|
|
|
+ throw Error("获取下拉框数据失败");
|
|
|
+ }
|
|
|
+ // 颜色数据
|
|
|
+ let payLoad3 = [
|
|
|
+ {
|
|
|
+ basicMap: {
|
|
|
+ tableName: "materiel",
|
|
|
+ },
|
|
|
+ conditionMap: {
|
|
|
+ materiel_species: ["1"],
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ let res3 = await queryDropDownBoxData(payLoad3);
|
|
|
+ if (res3.code == 200) {
|
|
|
+ console.log(res3.data.resultMap);
|
|
|
+ let { materiel } = res3.data.resultMap;
|
|
|
+ this.colourNumberOptions = materiel || [];
|
|
|
+ } else {
|
|
|
+ throw Error("获取下拉框数据失败");
|
|
|
+ }
|
|
|
} catch (error) {
|
|
|
console.log(error);
|
|
|
}
|
|
|
},
|
|
|
// 打印发货单回调
|
|
|
async handleDeliverOrder(index, row) {
|
|
|
- let {saleOrderNo} = row;
|
|
|
+ let { saleOrderNo } = row;
|
|
|
if (!saleOrderNo) {
|
|
|
this.$message.error("数据异常,暂无saleOrderNo");
|
|
|
}
|
|
@@ -350,7 +1036,7 @@ export default {
|
|
|
printUser: this.username,
|
|
|
});
|
|
|
deliverOrderPrint(
|
|
|
- {...row, ...printData, printUser: this.username},
|
|
|
+ { ...row, ...printData, printUser: this.username },
|
|
|
"printDom"
|
|
|
);
|
|
|
} else {
|
|
@@ -361,15 +1047,18 @@ export default {
|
|
|
},
|
|
|
// 打印送货单回调
|
|
|
async handleSendOrder(index, row) {
|
|
|
- let {saleOrderNo} = row;
|
|
|
- if (!saleOrderNo) {
|
|
|
- this.$message.error("数据异常,暂无saleOrderNo");
|
|
|
+ let { saleNo } = row;
|
|
|
+ if (!saleNo) {
|
|
|
+ this.$message.error("数据异常,saleNo");
|
|
|
+ return;
|
|
|
}
|
|
|
let payload = {
|
|
|
- saleOrderNo: saleOrderNo,
|
|
|
+ saleOrderNo: saleNo,
|
|
|
};
|
|
|
// let res = await productInvoiceInfo(payload);
|
|
|
- let res = await printDocuments({id: row.id});
|
|
|
+ let res = await printDocuments({ id: row.id });
|
|
|
+ // console.log(res);
|
|
|
+ // return;
|
|
|
if (res.code == 200) {
|
|
|
let printData = res.data;
|
|
|
console.log("printData", {
|
|
@@ -378,7 +1067,7 @@ export default {
|
|
|
printUser: this.username,
|
|
|
});
|
|
|
sendOrderPrint(
|
|
|
- {...row, ...printData, printUser: this.username},
|
|
|
+ { ...row, ...printData, printUser: this.username },
|
|
|
"printDom"
|
|
|
);
|
|
|
} else {
|
|
@@ -497,8 +1186,7 @@ export default {
|
|
|
this.getList();
|
|
|
this.$modal.msgSuccess("删除成功");
|
|
|
})
|
|
|
- .catch(() => {
|
|
|
- });
|
|
|
+ .catch(() => {});
|
|
|
},
|
|
|
/** 导出按钮操作 */
|
|
|
handleExport() {
|
|
@@ -506,6 +1194,7 @@ export default {
|
|
|
"/system/ProductInvoice/importFinancialStatement",
|
|
|
{
|
|
|
...this.queryParams,
|
|
|
+ ids: this.ids,
|
|
|
},
|
|
|
`客户销售汇总_${new Date().getTime()}.xlsx`
|
|
|
);
|