增加销售订单与采购订单的关联,优化分批入出库的交互

This commit is contained in:
季圣华
2022-05-18 00:21:43 +08:00
parent 3438524a47
commit 951793d396
8 changed files with 376 additions and 169 deletions

View File

@@ -127,6 +127,11 @@
<a-tag v-if="status == '2'" color="cyan">完成销售</a-tag> <a-tag v-if="status == '2'" color="cyan">完成销售</a-tag>
<a-tag v-if="status == '3'" color="blue">部分销售</a-tag> <a-tag v-if="status == '3'" color="blue">部分销售</a-tag>
</template> </template>
<template slot="customRenderPurchaseStatus" slot-scope="purchaseStatus">
<a-tag v-if="purchaseStatus == '0'" color="red">未采购</a-tag>
<a-tag v-if="purchaseStatus == '2'" color="cyan">完成采购</a-tag>
<a-tag v-if="purchaseStatus == '3'" color="blue">部分采购</a-tag>
</template>
</a-table> </a-table>
</div> </div>
<!-- table区域-end --> <!-- table区域-end -->
@@ -208,6 +213,9 @@
{ title: '状态', dataIndex: 'status', width: 70, align: "center", { title: '状态', dataIndex: 'status', width: 70, align: "center",
scopedSlots: { customRender: 'customRenderStatus' } scopedSlots: { customRender: 'customRenderStatus' }
}, },
{ title: '采购状态', dataIndex: 'purchaseStatus', width: 70, align: "center",
scopedSlots: { customRender: 'customRenderPurchaseStatus' }
},
{ {
title: '操作', title: '操作',
dataIndex: 'action', dataIndex: 'action',

View File

@@ -197,7 +197,11 @@
{{model.number}} {{model.number}}
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :span="6"></a-col> <a-col :span="6">
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="关联订单">
<a @click="myHandleDetail(model.linkNumber)">{{model.linkNumber}}</a>
</a-form-item>
</a-col>
</a-row> </a-row>
<div :style="tableWidth"> <div :style="tableWidth">
<a-table <a-table

View File

@@ -8,8 +8,44 @@
cancelText="关闭" cancelText="关闭"
wrapClassName="ant-modal-cust-warp" wrapClassName="ant-modal-cust-warp"
style="top:5%;height: 100%;overflow-y: hidden"> style="top:5%;height: 100%;overflow-y: hidden">
<!-- 查询区域 -->
<div class="table-page-search-wrapper" v-if="selectType === 'list'">
<!-- 搜索区域 -->
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<a-col :md="6" :sm="8">
<a-form-item label="单据编号" :labelCol="{span: 5}" :wrapperCol="{span: 18, offset: 1}">
<a-input placeholder="请输入单据编号查询" v-model="queryParam.number"></a-input>
</a-form-item>
</a-col>
<a-col :md="6" :sm="8">
<a-form-item label="商品信息" :labelCol="{span: 5}" :wrapperCol="{span: 18, offset: 1}">
<a-input placeholder="条码|名称|规格|型号" v-model="queryParam.materialParam"></a-input>
</a-form-item>
</a-col>
<a-col :md="7" :sm="10">
<a-form-item label="单据日期" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-range-picker
style="width: 210px"
v-model="queryParam.createTimeRange"
format="YYYY-MM-DD"
:placeholder="['开始时间', '结束时间']"
@change="onDateChange"
@ok="onDateOk"
/>
</a-form-item>
</a-col>
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-col :md="6" :sm="24">
<a-button type="primary" @click="searchQuery">查询</a-button>
<a-button style="margin-left: 8px" @click="searchReset">重置</a-button>
</a-col>
</span>
</a-row>
</a-form>
</div>
<!-- table区域-begin --> <!-- table区域-begin -->
<a-table <a-table v-if="selectType === 'list'"
bordered bordered
ref="table" ref="table"
size="middle" size="middle"
@@ -21,52 +57,78 @@
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type: getType}" :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type: getType}"
:customRow="rowAction" :customRow="rowAction"
@change="handleTableChange"> @change="handleTableChange">
<template slot="customRenderStatus" slot-scope="status"> <template slot="customRenderStatus" slot-scope="text, record">
<a-tag v-if="status === '0'" color="red">未审核</a-tag> <template v-if="!queryParam.purchaseStatus">
<a-tag v-if="status === '1'" color="green">已审核</a-tag> <a-tag v-if="record.status === '0'" color="red">未审核</a-tag>
<a-tag v-if="status === '2' && queryParam.subType === '采购订单'" color="cyan">完成采购</a-tag> <a-tag v-if="record.status === '1'" color="green">已审核</a-tag>
<a-tag v-if="status === '2' && queryParam.subType === '销售订单'" color="cyan">完成销售</a-tag> <a-tag v-if="record.status === '2' && queryParam.subType === '采购订单'" color="cyan">完成采购</a-tag>
<a-tag v-if="status === '3' && queryParam.subType === '采购订单'" color="blue">部分采购</a-tag> <a-tag v-if="record.status === '2' && queryParam.subType === '销售订单'" color="cyan">完成销售</a-tag>
<a-tag v-if="status === '3' && queryParam.subType === '销售订单'" color="blue">部分销售</a-tag> <a-tag v-if="record.status === '3' && queryParam.subType === '采购订单'" color="blue">部分采购</a-tag>
<a-tag v-if="record.status === '3' && queryParam.subType === '销售订单'" color="blue">部分销售</a-tag>
</template>
<template v-if="queryParam.purchaseStatus">
<a-tag v-if="record.purchaseStatus === '0'" color="red">未采购</a-tag>
<a-tag v-if="record.purchaseStatus === '2' && queryParam.subType === '销售订单'" color="cyan">完成采购</a-tag>
<a-tag v-if="record.purchaseStatus === '3' && queryParam.subType === '销售订单'" color="blue">部分采购</a-tag>
</template>
</template> </template>
</a-table> </a-table>
<a-table v-if="selectType === 'detail'"
bordered
ref="table"
size="middle"
rowKey="id"
:columns="columnsDetail"
:dataSource="dataSourceDetail"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedDetailRowKeys, onChange: onSelectDetailChange, type: 'checkbox'}"
@change="handleTableChange">
</a-table>
<!-- table区域-end --> <!-- table区域-end -->
</a-modal> </a-modal>
</template> </template>
<script> <script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin' import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { getAction } from '@/api/manage'
import Vue from 'vue'
export default { export default {
name: 'LinkBillList', name: 'LinkBillList',
mixins:[JeecgListMixin], mixins:[JeecgListMixin],
components: {
},
data () { data () {
return { return {
title: "操作", title: "操作",
visible: false, visible: false,
disableMixinCreated: true, disableMixinCreated: true,
selectedRowKeys: [], selectedRowKeys: [],
selectionRows: [], selectedDetailRowKeys: [],
selectBillRows: [], selectBillRows: [],
selectBillIds: '', selectBillDetailRows: [],
showType: 'list',
selectType: 'list',
linkNumber: '',
organId: '',
discount: '',
remark: '',
queryParam: { queryParam: {
number: "", number: "",
searchMaterial: "", materialParam: "",
type: "", type: "",
subType: "", subType: "",
status: "" status: ""
}, },
labelCol: {
xs: { span: 24 },
sm: { span: 8 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
// 表头 // 表头
columns: [ columns: [
{
title: '#',
dataIndex: '',
key:'rowIndex',
width:40,
align:"center",
customRender:function (t,r,index) {
return parseInt(index)+1;
}
},
{ title: '', dataIndex: 'organName',width:120, ellipsis:true}, { title: '', dataIndex: 'organName',width:120, ellipsis:true},
{ title: '单据编号', dataIndex: 'number',width:150}, { title: '单据编号', dataIndex: 'number',width:150},
{ title: '商品信息', dataIndex: 'materialsList',width:280, ellipsis:true, { title: '商品信息', dataIndex: 'materialsList',width:280, ellipsis:true,
@@ -76,18 +138,38 @@
} }
} }
}, },
{ title: '单据日期', dataIndex: 'operTimeStr',width:135}, { title: '单据日期', dataIndex: 'operTimeStr',width:145},
{ title: '操作员', dataIndex: 'userName',width:70}, { title: '操作员', dataIndex: 'userName',width:70},
{ title: '金额合计', dataIndex: 'totalPrice',width:70}, { title: '金额合计', dataIndex: 'totalPrice',width:70},
{ title: '含税合计', dataIndex: 'totalTaxLastMoney',width:80, { title: '含税合计', dataIndex: 'totalTaxLastMoney',width:70,
customRender:function (text,record,index) { customRender:function (text,record,index) {
return (record.discountMoney + record.discountLastMoney).toFixed(2); if(record.discountLastMoney) {
return (record.discountMoney + record.discountLastMoney).toFixed(2);
} else {
return record.totalPrice;
}
} }
}, },
{ title: '状态', dataIndex: 'status', width: 70, align: "center", { title: '状态', dataIndex: 'status', width: 70, align: "center",
scopedSlots: { customRender: 'customRenderStatus' } scopedSlots: { customRender: 'customRenderStatus' }
} }
], ],
columnsDetail: [
{ title: '条码', dataIndex: 'barCode',width:120},
{ title: '名称', dataIndex: 'name',width:100, ellipsis:true},
{ title: '规格', dataIndex: 'standard',width:100, ellipsis:true},
{ title: '型号', dataIndex: 'model',width:150, ellipsis:true},
{ title: '单位', dataIndex: 'unit',width:50},
{ title: '数量', dataIndex: 'operNumber',width:80},
{ title: '单价', dataIndex: 'unitPrice',width:80},
{ title: '金额', dataIndex: 'allPrice',width:80},
{ title: '税率(%)', dataIndex: 'taxRate', width:80},
{ title: '税额', dataIndex: 'taxMoney', width:80},
{ title: '价税合计', dataIndex: 'taxLastMoney', width:80},
{ title: '备注', dataIndex: 'remark',width:100, ellipsis:true},
],
dataSource:[],
dataSourceDetail: [],
url: { url: {
list: "/depotHead/list" list: "/depotHead/list"
} }
@@ -102,10 +184,26 @@
}, },
methods: { methods: {
show(type, subType, organType, status) { show(type, subType, organType, status) {
this.selectType = 'list'
this.showType = 'basic'
this.queryParam.type = type this.queryParam.type = type
this.queryParam.subType = subType this.queryParam.subType = subType
this.queryParam.roleType = Vue.ls.get('roleType')
this.queryParam.status = status this.queryParam.status = status
this.columns[1].title = organType this.columns[0].title = organType
this.model = Object.assign({}, {});
this.visible = true;
this.loadData(1)
},
purchaseShow(type, subType, organType, status, purchaseStatus) {
this.selectType = 'list'
this.showType = 'purchase'
this.queryParam.type = type
this.queryParam.subType = subType
this.queryParam.roleType = '全部数据'
this.queryParam.status = status
this.queryParam.purchaseStatus = purchaseStatus
this.columns[0].title = organType
this.model = Object.assign({}, {}); this.model = Object.assign({}, {});
this.visible = true; this.visible = true;
this.loadData(1) this.loadData(1)
@@ -117,26 +215,97 @@
handleCancel () { handleCancel () {
this.close() this.close()
}, },
onSelectChange(selectedRowKeys, selectionRows) { onSelectChange(selectedRowKeys) {
this.selectedRowKeys = selectedRowKeys; this.selectedRowKeys = selectedRowKeys;
this.selectionRows = selectionRows; },
onSelectDetailChange(selectedRowKeys) {
this.selectedDetailRowKeys = selectedRowKeys;
}, },
handleOk () { handleOk () {
this.getSelectBillRows(); if(this.selectType === 'list') {
this.$emit('ok', this.selectBillRows); this.getSelectBillRows();
this.close(); this.selectType = 'detail'
this.title = "选择单据明细"
if(this.selectBillRows && this.selectBillRows.length>0) {
let record = this.selectBillRows[0]
this.linkNumber = record.number
this.organId = record.organId
this.discount = record.discount
this.remark = record.remark
this.loadDetailData(1)
}
} else {
this.getSelectBillDetailRows();
this.$emit('ok', this.selectBillDetailRows, this.linkNumber, this.organId, this.discount, this.remark)
this.close();
}
},
//查询明细列表
loadDetailData(arg) {
//加载数据 若传入参数1则加载第一页的内容
if (arg === 1) {
this.ipagination.current = 1;
}
if(this.selectBillRows && this.selectBillRows.length>0) {
let record = this.selectBillRows[0]
let param = {
headerId: record.id,
mpList : ''
}
this.loading = true;
getAction('/depotItem/getDetailList', param).then((res) => {
if (res.code===200) {
let list = res.data.rows;
let listEx = []
for(let j=0; j<list.length; j++){
let info = list[j];
//去掉已经全部转换的明细
if(info.preNumber !== info.finishNumber) {
listEx.push(info)
}
}
this.dataSourceDetail = listEx
this.ipagination.total = res.data.total;
}
if(res.code===510){
this.$message.warning(res.data)
}
this.loading = false;
})
}
},
onDateChange: function (value, dateString) {
this.queryParam.beginTime=dateString[0];
this.queryParam.endTime=dateString[1];
},
onDateOk(value) {
console.log(value);
},
searchReset() {
this.queryParam = {
type: this.queryParam.type,
subType: this.queryParam.subType,
status: "1,3"
}
this.loadData(1);
}, },
getSelectBillRows() { getSelectBillRows() {
let dataSource = this.dataSource; let dataSource = this.dataSource;
let billIds = "";
this.selectBillRows = []; this.selectBillRows = [];
for (let i = 0, len = dataSource.length; i < len; i++) { for (let i = 0, len = dataSource.length; i < len; i++) {
if (this.selectedRowKeys.includes(dataSource[i].id)) { if (this.selectedRowKeys.includes(dataSource[i].id)) {
this.selectBillRows.push(dataSource[i]); this.selectBillRows.push(dataSource[i]);
billIds = billIds + "," + dataSource[i].id
} }
} }
this.selectBillIds = billIds.substring(1); },
getSelectBillDetailRows() {
let dataSource = this.dataSourceDetail;
this.selectBillDetailRows = [];
for (let i = 0, len = dataSource.length; i < len; i++) {
if (this.selectedDetailRowKeys.includes(dataSource[i].id)) {
this.selectBillDetailRows.push(dataSource[i]);
}
}
}, },
rowAction(record, index) { rowAction(record, index) {
return { return {

View File

@@ -21,7 +21,7 @@
<a-col :lg="6" :md="12" :sm="24"> <a-col :lg="6" :md="12" :sm="24">
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="供应商" data-step="1" data-title="供应商" <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="供应商" data-step="1" data-title="供应商"
data-intro="供应商必须选择如果发现需要选择的供应商尚未录入可以在下拉框中点击新增供应商进行录入"> data-intro="供应商必须选择如果发现需要选择的供应商尚未录入可以在下拉框中点击新增供应商进行录入">
<a-select placeholder="选择供应商" v-decorator="[ 'organId', validatorRules.organId ]" <a-select placeholder="选择供应商" v-decorator="[ 'organId', validatorRules.organId ]" :disabled="!rowCanEdit"
:dropdownMatchSelectWidth="false" showSearch optionFilterProp="children"> :dropdownMatchSelectWidth="false" showSearch optionFilterProp="children">
<div slot="dropdownRender" slot-scope="menu"> <div slot="dropdownRender" slot-scope="menu">
<v-nodes :vnodes="menu" /> <v-nodes :vnodes="menu" />
@@ -61,14 +61,14 @@
:dataSource="materialTable.dataSource" :dataSource="materialTable.dataSource"
:maxHeight="300" :maxHeight="300"
:rowNumber="false" :rowNumber="false"
:rowSelection="true" :rowSelection="rowCanEdit"
:actionButton="true" :actionButton="rowCanEdit"
:dragSort="true" :dragSort="rowCanEdit"
@valueChange="onValueChange" @valueChange="onValueChange"
@added="onAdded" @added="onAdded"
@deleted="onDeleted"> @deleted="onDeleted">
<template #buttonAfter> <template #buttonAfter>
<a-row :gutter="24" style="float:left;" data-step="4" data-title="扫码录入" data-intro="此功能支持扫码枪扫描商品条码进行录入"> <a-row v-if="rowCanEdit" :gutter="24" style="float:left;padding-bottom: 5px;" data-step="4" data-title="扫码录入" data-intro="此功能支持扫码枪扫描商品条码进行录入">
<a-col v-if="scanStatus" :md="6" :sm="24"> <a-col v-if="scanStatus" :md="6" :sm="24">
<a-button @click="scanEnter">扫码录入</a-button> <a-button @click="scanEnter">扫码录入</a-button>
</a-col> </a-col>
@@ -79,7 +79,7 @@
<a-button @click="stopScan">收起扫码</a-button> <a-button @click="stopScan">收起扫码</a-button>
</a-col> </a-col>
</a-row> </a-row>
<a-row :gutter="24" style="float:left;"> <a-row :gutter="24" style="float:left;padding-bottom: 5px;">
<a-col :md="24" :sm="24"> <a-col :md="24" :sm="24">
<a-dropdown> <a-dropdown>
<a-menu slot="overlay"> <a-menu slot="overlay">
@@ -223,6 +223,7 @@
operTimeStr: '', operTimeStr: '',
prefixNo: 'CGRK', prefixNo: 'CGRK',
fileList:[], fileList:[],
rowCanEdit: true,
model: {}, model: {},
labelCol: { labelCol: {
xs: { span: 24 }, xs: { span: 24 },
@@ -300,6 +301,8 @@
methods: { methods: {
//调用完edit()方法之后会自动调用此方法 //调用完edit()方法之后会自动调用此方法
editAfter() { editAfter() {
this.rowCanEdit = true
this.materialTable.columns[1].type = FormTypes.popupJsh
this.changeColumnHide() this.changeColumnHide()
this.changeFormTypes(this.materialTable.columns, 'snList', 0) this.changeFormTypes(this.materialTable.columns, 'snList', 0)
this.changeFormTypes(this.materialTable.columns, 'batchNumber', 0) this.changeFormTypes(this.materialTable.columns, 'batchNumber', 0)
@@ -382,68 +385,46 @@
this.$refs.linkBillList.show('其它', '采购订单', '供应商', "1,3") this.$refs.linkBillList.show('其它', '采购订单', '供应商', "1,3")
this.$refs.linkBillList.title = "选择采购订单" this.$refs.linkBillList.title = "选择采购订单"
}, },
linkBillListOk(selectBillRows) { linkBillListOk(selectBillDetailRows, linkNumber, organId, discount, remark) {
this.rowCanEdit = false
this.materialTable.columns[1].type = FormTypes.normal
this.changeFormTypes(this.materialTable.columns, 'preNumber', 1) this.changeFormTypes(this.materialTable.columns, 'preNumber', 1)
this.changeFormTypes(this.materialTable.columns, 'finishNumber', 1) this.changeFormTypes(this.materialTable.columns, 'finishNumber', 1)
if(selectBillRows && selectBillRows.length>0) { if(selectBillDetailRows && selectBillDetailRows.length>0) {
let record = selectBillRows[0] let listEx = []
this.$nextTick(() => { let allTaxLastMoney = 0
this.form.setFieldsValue({ for(let j=0; j<selectBillDetailRows.length; j++) {
'organId': record.organId, let info = selectBillDetailRows[j];
'linkNumber': record.number, if(info.finishNumber>0) {
'remark': record.remark, info.operNumber = info.preNumber - info.finishNumber
'discount': record.discount info.allPrice = info.operNumber * info.unitPrice-0
}) let taxRate = info.taxRate-0
}); info.taxMoney = (info.allPrice*taxRate/100).toFixed(2)-0
// 加载子表数据 info.taxLastMoney = (info.allPrice + info.taxMoney).toFixed(2)-0
let params = { }
headerId: record.id, allTaxLastMoney += info.taxLastMoney
mpList: getMpListShort(Vue.ls.get('materialPropertyList')) //扩展属性 listEx.push(info)
this.changeColumnShow(info)
}
this.materialTable.dataSource = listEx
///给优惠后金额重新赋值
if(allTaxLastMoney) {
let discountMoney = (discount*allTaxLastMoney/100).toFixed(2)-0
let discountLastMoney = (allTaxLastMoney - discountMoney).toFixed(2)-0
this.$nextTick(() => {
this.form.setFieldsValue({
'organId': organId,
'linkNumber': linkNumber,
'discount': discount,
'discountMoney': discountMoney,
'discountLastMoney': discountLastMoney,
'changeAmount': discountLastMoney,
'remark': remark
})
})
} }
this.requestSubTableDataEx(this.url.detailList, params, this.materialTable);
} }
}, },
/** 查询某个tab的数据,给明细里面的价税合计赋值 */
requestSubTableDataEx(url, params, tab, success) {
tab.loading = true
getAction(url, params).then(res => {
if(res && res.code === 200){
let list = res.data.rows
let listEx = []
let allTaxLastMoney = 0
for(let j=0; j<list.length; j++){
let info = list[j]
if(info.finishNumber>0) {
info.operNumber = info.preNumber - info.finishNumber
info.allPrice = info.operNumber * info.unitPrice-0
let taxRate = info.taxRate-0
info.taxMoney = (info.allPrice*taxRate/100).toFixed(2)-0
info.taxLastMoney = info.allPrice + info.taxMoney
}
allTaxLastMoney += info.taxLastMoney
listEx.push(info)
this.changeColumnShow(info)
}
tab.dataSource = listEx
//给优惠后金额重新赋值
if(allTaxLastMoney) {
let discount = this.form.getFieldValue('discount')-0
let discountMoney = (discount*allTaxLastMoney/100).toFixed(2)-0
let discountLastMoney = allTaxLastMoney - discountMoney
this.$nextTick(() => {
this.form.setFieldsValue({
'discountMoney': discountMoney,
'discountLastMoney': discountLastMoney,
'changeAmount': discountLastMoney
})
});
}
typeof success === 'function' ? success(res) : ''
}
}).finally(() => {
tab.loading = false
})
}
} }
} }
</script> </script>

View File

@@ -46,7 +46,13 @@
<a-input placeholder="请输入单据编号" v-decorator.trim="[ 'number' ]" :readOnly="true"/> <a-input placeholder="请输入单据编号" v-decorator.trim="[ 'number' ]" :readOnly="true"/>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :lg="6" :md="12" :sm="24"></a-col> <a-col :lg="6" :md="12" :sm="24">
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="关联订单" data-step="3" data-title="关联订单"
data-intro="采购订单单据可以通过关联订单来选择已录入的销售订单选择之后会自动加载订单的内容
提交之后原来的销售订单会对应的改变单据状态另外本系统支持分批多次关联">
<a-input-search placeholder="请选择关联订单" v-decorator="[ 'linkNumber' ]" @search="onSearchLinkNumber" :readOnly="true"/>
</a-form-item>
</a-col>
</a-row> </a-row>
<j-editable-table id="billModal" <j-editable-table id="billModal"
:ref="refKeys[0]" :ref="refKeys[0]"
@@ -55,13 +61,13 @@
:dataSource="materialTable.dataSource" :dataSource="materialTable.dataSource"
:maxHeight="300" :maxHeight="300"
:rowNumber="false" :rowNumber="false"
:rowSelection="true" :rowSelection="rowCanEdit"
:actionButton="true" :actionButton="rowCanEdit"
:dragSort="true" :dragSort="rowCanEdit"
@valueChange="onValueChange" @valueChange="onValueChange"
@deleted="onDeleted"> @deleted="onDeleted">
<template #buttonAfter> <template #buttonAfter>
<a-row :gutter="24" style="float:left;" data-step="3" data-title="扫码录入" data-intro="此功能支持扫码枪扫描商品条码进行录入"> <a-row v-if="rowCanEdit" :gutter="24" style="float:left;padding-bottom: 5px;" data-step="4" data-title="扫码录入" data-intro="此功能支持扫码枪扫描商品条码进行录入">
<a-col v-if="scanStatus" :md="6" :sm="24"> <a-col v-if="scanStatus" :md="6" :sm="24">
<a-button @click="scanEnter">扫码录入</a-button> <a-button @click="scanEnter">扫码录入</a-button>
</a-col> </a-col>
@@ -105,7 +111,7 @@
</a-row> </a-row>
<a-row class="form-row" :gutter="24"> <a-row class="form-row" :gutter="24">
<a-col :lg="6" :md="12" :sm="24"> <a-col :lg="6" :md="12" :sm="24">
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="附件" data-step="4" data-title="附件" data-intro="可以上传与单据相关的图片文档支持多个文件"> <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="附件" data-step="8" data-title="附件" data-intro="可以上传与单据相关的图片文档支持多个文件">
<j-upload v-model="fileList" bizPath="bill"></j-upload> <j-upload v-model="fileList" bizPath="bill"></j-upload>
</a-form-item> </a-form-item>
</a-col> </a-col>
@@ -113,10 +119,12 @@
</a-form> </a-form>
</a-spin> </a-spin>
<vendor-modal ref="vendorModalForm" @ok="vendorModalFormOk"></vendor-modal> <vendor-modal ref="vendorModalForm" @ok="vendorModalFormOk"></vendor-modal>
<link-bill-list ref="linkBillList" @ok="linkBillListOk"></link-bill-list>
</j-modal> </j-modal>
</template> </template>
<script> <script>
import pick from 'lodash.pick' import pick from 'lodash.pick'
import LinkBillList from '../dialog/LinkBillList'
import VendorModal from '../../system/modules/VendorModal' import VendorModal from '../../system/modules/VendorModal'
import { FormTypes } from '@/utils/JEditableTableUtil' import { FormTypes } from '@/utils/JEditableTableUtil'
import { JEditableTableMixin } from '@/mixins/JEditableTableMixin' import { JEditableTableMixin } from '@/mixins/JEditableTableMixin'
@@ -129,6 +137,7 @@
name: "PurchaseOrderModal", name: "PurchaseOrderModal",
mixins: [JEditableTableMixin,BillModalMixin], mixins: [JEditableTableMixin,BillModalMixin],
components: { components: {
LinkBillList,
VendorModal, VendorModal,
JUpload, JUpload,
JDate, JDate,
@@ -150,6 +159,7 @@
operTimeStr: '', operTimeStr: '',
prefixNo: 'CGDD', prefixNo: 'CGDD',
fileList:[], fileList:[],
rowCanEdit: true,
model: {}, model: {},
labelCol: { labelCol: {
xs: { span: 24 }, xs: { span: 24 },
@@ -214,6 +224,8 @@
methods: { methods: {
//调用完edit()方法之后会自动调用此方法 //调用完edit()方法之后会自动调用此方法
editAfter() { editAfter() {
this.rowCanEdit = true
this.materialTable.columns[1].type = FormTypes.popupJsh
this.changeColumnHide() this.changeColumnHide()
if (this.action === 'add') { if (this.action === 'add') {
this.addInit(this.prefixNo) this.addInit(this.prefixNo)
@@ -269,7 +281,46 @@
info: JSON.stringify(billMain), info: JSON.stringify(billMain),
rows: JSON.stringify(detailArr), rows: JSON.stringify(detailArr),
} }
} },
onSearchLinkNumber() {
this.$refs.linkBillList.purchaseShow('其它', '销售订单', '客户', "1,3","0,3")
this.$refs.linkBillList.title = "选择销售订单"
},
linkBillListOk(selectBillDetailRows, linkNumber, organId) {
this.rowCanEdit = false
this.materialTable.columns[1].type = FormTypes.normal
this.changeFormTypes(this.materialTable.columns, 'preNumber', 1)
this.changeFormTypes(this.materialTable.columns, 'finishNumber', 1)
if(selectBillDetailRows && selectBillDetailRows.length>0) {
let discountLastMoney = 0
for(let j=0; j<selectBillDetailRows.length; j++) {
let info = selectBillDetailRows[j];
if (info.preNumber) {
info.operNumber = info.preNumber - info.finishNumber
info.allPrice = (info.operNumber * info.unitPrice).toFixed(2) - 0;
info.taxRate = 0
info.taxMoney = 0
info.taxLastMoney = info.allPrice
discountLastMoney += info.allPrice
}
}
this.$nextTick(() => {
this.form.setFieldsValue({
'linkNumber': linkNumber
})
})
//给优惠后金额重新赋值
if(discountLastMoney) {
this.$nextTick(() => {
this.form.setFieldsValue({
'discountLastMoney': discountLastMoney.toFixed(2),
'changeAmount': discountLastMoney
})
});
}
this.materialTable.dataSource = selectBillDetailRows
}
},
} }
} }
</script> </script>

View File

@@ -111,7 +111,7 @@
</a-row> </a-row>
<a-row class="form-row" :gutter="24"> <a-row class="form-row" :gutter="24">
<a-col :lg="6" :md="12" :sm="24"> <a-col :lg="6" :md="12" :sm="24">
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="附件" data-step="5" data-title="附件" data-intro="可以上传与单据相关的图片文档支持多个文件"> <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="附件" data-step="8" data-title="附件" data-intro="可以上传与单据相关的图片文档支持多个文件">
<j-upload v-model="fileList" bizPath="bill"></j-upload> <j-upload v-model="fileList" bizPath="bill"></j-upload>
</a-form-item> </a-form-item>
</a-col> </a-col>

View File

@@ -22,7 +22,7 @@
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="客户" data-step="1" data-title="客户" <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="客户" data-step="1" data-title="客户"
data-intro="客户必须选择如果发现需要选择的客户尚未录入可以在下拉框中点击新增客户进行录入 data-intro="客户必须选择如果发现需要选择的客户尚未录入可以在下拉框中点击新增客户进行录入
特别注意客户如果录入之后在下拉框中不显示请检查是否给当前用户分配对应的客户权限"> 特别注意客户如果录入之后在下拉框中不显示请检查是否给当前用户分配对应的客户权限">
<a-select placeholder="选择客户" v-decorator="[ 'organId', validatorRules.organId ]" <a-select placeholder="选择客户" v-decorator="[ 'organId', validatorRules.organId ]" :disabled="!rowCanEdit"
:dropdownMatchSelectWidth="false" showSearch optionFilterProp="children"> :dropdownMatchSelectWidth="false" showSearch optionFilterProp="children">
<div slot="dropdownRender" slot-scope="menu"> <div slot="dropdownRender" slot-scope="menu">
<v-nodes :vnodes="menu" /> <v-nodes :vnodes="menu" />
@@ -62,14 +62,14 @@
:dataSource="materialTable.dataSource" :dataSource="materialTable.dataSource"
:maxHeight="300" :maxHeight="300"
:rowNumber="false" :rowNumber="false"
:rowSelection="true" :rowSelection="rowCanEdit"
:actionButton="true" :actionButton="rowCanEdit"
:dragSort="true" :dragSort="rowCanEdit"
@valueChange="onValueChange" @valueChange="onValueChange"
@added="onAdded" @added="onAdded"
@deleted="onDeleted"> @deleted="onDeleted">
<template #buttonAfter> <template #buttonAfter>
<a-row :gutter="24" style="float:left;" data-step="4" data-title="扫码录入" data-intro="此功能支持扫码枪扫描商品条码进行录入"> <a-row v-if="rowCanEdit" :gutter="24" style="float:left;padding-bottom: 5px;" data-step="4" data-title="扫码录入" data-intro="此功能支持扫码枪扫描商品条码进行录入">
<a-col v-if="scanStatus" :md="6" :sm="24"> <a-col v-if="scanStatus" :md="6" :sm="24">
<a-button @click="scanEnter">扫码录入</a-button> <a-button @click="scanEnter">扫码录入</a-button>
</a-col> </a-col>
@@ -80,7 +80,7 @@
<a-button @click="stopScan">收起扫码</a-button> <a-button @click="stopScan">收起扫码</a-button>
</a-col> </a-col>
</a-row> </a-row>
<a-row :gutter="24" style="float:left;"> <a-row :gutter="24" style="float:left;padding-bottom: 5px;">
<a-col :md="24" :sm="24"> <a-col :md="24" :sm="24">
<a-dropdown> <a-dropdown>
<a-menu slot="overlay"> <a-menu slot="overlay">
@@ -229,6 +229,7 @@
operTimeStr: '', operTimeStr: '',
prefixNo: 'XSCK', prefixNo: 'XSCK',
fileList:[], fileList:[],
rowCanEdit: true,
model: {}, model: {},
labelCol: { labelCol: {
xs: { span: 24 }, xs: { span: 24 },
@@ -304,6 +305,8 @@
methods: { methods: {
//调用完edit()方法之后会自动调用此方法 //调用完edit()方法之后会自动调用此方法
editAfter() { editAfter() {
this.rowCanEdit = true
this.materialTable.columns[1].type = FormTypes.popupJsh
this.changeColumnHide() this.changeColumnHide()
this.changeFormTypes(this.materialTable.columns, 'snList', 0) this.changeFormTypes(this.materialTable.columns, 'snList', 0)
this.changeFormTypes(this.materialTable.columns, 'batchNumber', 0) this.changeFormTypes(this.materialTable.columns, 'batchNumber', 0)
@@ -388,68 +391,46 @@
this.$refs.linkBillList.show('其它', '销售订单', '客户', "1,3") this.$refs.linkBillList.show('其它', '销售订单', '客户', "1,3")
this.$refs.linkBillList.title = "选择销售订单" this.$refs.linkBillList.title = "选择销售订单"
}, },
linkBillListOk(selectBillRows) { linkBillListOk(selectBillDetailRows, linkNumber, organId, discount, remark) {
this.rowCanEdit = false
this.materialTable.columns[1].type = FormTypes.normal
this.changeFormTypes(this.materialTable.columns, 'preNumber', 1) this.changeFormTypes(this.materialTable.columns, 'preNumber', 1)
this.changeFormTypes(this.materialTable.columns, 'finishNumber', 1) this.changeFormTypes(this.materialTable.columns, 'finishNumber', 1)
if(selectBillRows && selectBillRows.length>0) { if(selectBillDetailRows && selectBillDetailRows.length>0) {
let record = selectBillRows[0] let listEx = []
this.$nextTick(() => { let allTaxLastMoney = 0
this.form.setFieldsValue({ for(let j=0; j<selectBillDetailRows.length; j++) {
'organId': record.organId, let info = selectBillDetailRows[j];
'linkNumber': record.number, if(info.finishNumber>0) {
'remark': record.remark, info.operNumber = info.preNumber - info.finishNumber
'discount': record.discount info.allPrice = info.operNumber * info.unitPrice-0
}) let taxRate = info.taxRate-0
}); info.taxMoney = (info.allPrice*taxRate/100).toFixed(2)-0
// 加载子表数据 info.taxLastMoney = (info.allPrice + info.taxMoney).toFixed(2)-0
let params = { }
headerId: record.id, allTaxLastMoney += info.taxLastMoney
mpList: getMpListShort(Vue.ls.get('materialPropertyList')) //扩展属性 listEx.push(info)
this.changeColumnShow(info)
}
this.materialTable.dataSource = listEx
///给优惠后金额重新赋值
if(allTaxLastMoney) {
let discountMoney = (discount*allTaxLastMoney/100).toFixed(2)-0
let discountLastMoney = (allTaxLastMoney - discountMoney).toFixed(2)-0
this.$nextTick(() => {
this.form.setFieldsValue({
'organId': organId,
'linkNumber': linkNumber,
'discount': discount,
'discountMoney': discountMoney,
'discountLastMoney': discountLastMoney,
'changeAmount': discountLastMoney,
'remark': remark
})
})
} }
this.requestSubTableDataEx(this.url.detailList, params, this.materialTable);
} }
}, },
/** 查询某个tab的数据,给明细里面的价税合计赋值 */
requestSubTableDataEx(url, params, tab, success) {
tab.loading = true
getAction(url, params).then(res => {
if(res && res.code === 200){
let list = res.data.rows
let listEx = []
let allTaxLastMoney = 0
for(let j=0; j<list.length; j++){
let info = list[j]
if(info.finishNumber>0) {
info.operNumber = info.preNumber - info.finishNumber
info.allPrice = info.operNumber * info.unitPrice-0
let taxRate = info.taxRate-0
info.taxMoney = (info.allPrice*taxRate/100).toFixed(2)-0
info.taxLastMoney = info.allPrice + info.taxMoney
}
allTaxLastMoney += info.taxLastMoney
listEx.push(info)
this.changeColumnShow(info)
}
tab.dataSource = listEx
//给优惠后金额重新赋值
if(allTaxLastMoney) {
let discount = this.form.getFieldValue('discount')-0
let discountMoney = (discount*allTaxLastMoney/100).toFixed(2)-0
let discountLastMoney = allTaxLastMoney - discountMoney
this.$nextTick(() => {
this.form.setFieldsValue({
'discountMoney': discountMoney,
'discountLastMoney': discountLastMoney,
'changeAmount': discountLastMoney
})
});
}
typeof success === 'function' ? success(res) : ''
}
}).finally(() => {
tab.loading = false
})
}
} }
} }
</script> </script>

View File

@@ -37,6 +37,10 @@
<a-switch checked-children="启用" un-checked-children="关闭" v-model="minusStockFlagSwitch" @change="onMinusStockChange"></a-switch> <a-switch checked-children="启用" un-checked-children="关闭" v-model="minusStockFlagSwitch" @change="onMinusStockChange"></a-switch>
如果启用则单据支持负库存批次商品除外 如果启用则单据支持负库存批次商品除外
</a-form-item> </a-form-item>
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="以销定购">
<a-switch checked-children="启用" un-checked-children="关闭" v-model="purchaseBySaleFlagSwitch" @change="onPurchaseBySaleChange"></a-switch>
如果启用则根据销售订单来定制采购订单进货后再发给客户
</a-form-item>
</a-form> </a-form>
</a-spin> </a-spin>
</a-col> </a-col>
@@ -68,6 +72,7 @@
depotFlagSwitch: false, //仓库权限状态 depotFlagSwitch: false, //仓库权限状态
customerFlagSwitch: false, //客户权限状态 customerFlagSwitch: false, //客户权限状态
minusStockFlagSwitch: false, //负库存状态 minusStockFlagSwitch: false, //负库存状态
purchaseBySaleFlagSwitch: false, //以销定购状态
isReadOnly: false, isReadOnly: false,
labelCol: { labelCol: {
xs: { span: 24 }, xs: { span: 24 },
@@ -110,6 +115,9 @@
onMinusStockChange(checked) { onMinusStockChange(checked) {
this.model.minusStockFlag = checked?'1':'0' this.model.minusStockFlag = checked?'1':'0'
}, },
onPurchaseBySaleChange(checked) {
this.model.purchaseBySaleFlag = checked?'1':'0'
},
init () { init () {
let param = { let param = {
search: {"companyName":""}, search: {"companyName":""},
@@ -124,7 +132,8 @@
this.visible = true; this.visible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model,'companyName', 'companyContacts', 'companyAddress', this.form.setFieldsValue(pick(this.model,'companyName', 'companyContacts', 'companyAddress',
'companyTel', 'companyFax', 'companyPostCode', 'saleAgreement', 'depotFlag', 'customerFlag', 'minusStockFlag')) 'companyTel', 'companyFax', 'companyPostCode', 'saleAgreement', 'depotFlag', 'customerFlag',
'minusStockFlag', 'purchaseBySaleFlag'))
autoJumpNextInput('systemConfigModal') autoJumpNextInput('systemConfigModal')
}); });
if(record.id) { if(record.id) {
@@ -137,6 +146,9 @@
if (record.minusStockFlag != null) { if (record.minusStockFlag != null) {
this.minusStockFlagSwitch = record.minusStockFlag == '1' ? true : false; this.minusStockFlagSwitch = record.minusStockFlag == '1' ? true : false;
} }
if (record.purchaseBySaleFlag != null) {
this.purchaseBySaleFlagSwitch = record.purchaseBySaleFlag == '1' ? true : false;
}
} }
} else { } else {
this.$message.info(res.data); this.$message.info(res.data);
@@ -174,6 +186,7 @@
this.depotFlagSwitch = false this.depotFlagSwitch = false
this.customerFlagSwitch = false this.customerFlagSwitch = false
this.minusStockFlagSwitch = false this.minusStockFlagSwitch = false
this.purchaseBySaleFlagSwitch = false
} }
} }
} }