优化收款单

This commit is contained in:
季圣华
2021-06-30 00:54:07 +08:00
parent 4e66aeb98b
commit 344f35b60e
6 changed files with 587 additions and 457 deletions

View File

@@ -1,434 +1,435 @@
<template> <template>
<div :id="containerId" style="position: relative"> <div :id="containerId" style="position: relative">
<!-- ---------------------------- begin 图片左右换位置 ------------------------------------- --> <!-- ---------------------------- begin 图片左右换位置 ------------------------------------- -->
<div class="movety-container" :style="{top:top+'px',left:left+'px',display:moveDisplay}" style="padding:0 8px;position: absolute;z-index: 91;height: 32px;width: 104px;text-align: center;"> <div class="movety-container" :style="{top:top+'px',left:left+'px',display:moveDisplay}" style="padding:0 8px;position: absolute;z-index: 91;height: 32px;width: 104px;text-align: center;">
<div :id="containerId+'-mover'" :class="showMoverTask?'uploadty-mover-mask':'movety-opt'" style="margin-top: 12px"> <div :id="containerId+'-mover'" :class="showMoverTask?'uploadty-mover-mask':'movety-opt'" style="margin-top: 12px">
<a @click="moveLast" style="margin: 0 5px;"><a-icon type="arrow-left" style="color: #fff;font-size: 16px"/></a> <a @click="moveLast" style="margin: 0 5px;"><a-icon type="arrow-left" style="color: #fff;font-size: 16px"/></a>
<a @click="moveNext" style="margin: 0 5px;"><a-icon type="arrow-right" style="color: #fff;font-size: 16px"/></a> <a @click="moveNext" style="margin: 0 5px;"><a-icon type="arrow-right" style="color: #fff;font-size: 16px"/></a>
</div> </div>
</div> </div>
<!-- ---------------------------- end 图片左右换位置 ------------------------------------- --> <!-- ---------------------------- end 图片左右换位置 ------------------------------------- -->
<a-upload <a-upload
name="file" name="file"
:multiple="true" :multiple="true"
:action="uploadAction" :action="uploadAction"
:headers="headers" :headers="headers"
:data="{'biz':bizPath}" :data="{'biz':bizPath}"
:fileList="fileList" :fileList="fileList"
:beforeUpload="beforeUpload" :beforeUpload="beforeUpload"
@change="handleChange" @change="handleChange"
:disabled="disabled" :disabled="disabled"
:returnUrl="returnUrl" :returnUrl="returnUrl"
:listType="complistType" :listType="complistType"
@preview="handlePreview" @preview="handlePreview"
:class="{'uploadty-disabled':disabled}"> :class="{'uploadty-disabled':disabled}">
<template> <template>
<div v-if="isImageComp"> <div v-if="isImageComp">
<a-icon type="plus" /> <a-icon type="plus" />
<div class="ant-upload-text">{{ text }}</div> <div class="ant-upload-text">{{ text }}</div>
</div> </div>
<a-button v-else-if="buttonVisible"> <a-button v-else-if="buttonVisible">
<a-icon type="upload" />{{ text }} <a-icon type="upload" />{{ text }}
</a-button> </a-button>
</template> </template>
</a-upload> </a-upload>
<a-modal :visible="previewVisible" :footer="null" @cancel="handleCancel"> <a-modal :visible="previewVisible" :footer="null" @cancel="handleCancel">
<img alt="example" style="width: 100%" :src="previewImage" /> <img alt="example" style="width: 100%" :src="previewImage" />
</a-modal> </a-modal>
</div> </div>
</template> </template>
<script> <script>
import Vue from 'vue' import Vue from 'vue'
import { ACCESS_TOKEN } from "@/store/mutation-types" import { ACCESS_TOKEN } from "@/store/mutation-types"
import { getFileAccessHttpUrl } from '@/api/manage'; import { getFileAccessHttpUrl } from '@/api/manage';
const FILE_TYPE_ALL = "all" const FILE_TYPE_ALL = "all"
const FILE_TYPE_IMG = "image" const FILE_TYPE_IMG = "image"
const FILE_TYPE_TXT = "file" const FILE_TYPE_TXT = "file"
const uidGenerator=()=>{ const uidGenerator=()=>{
return '-'+parseInt(Math.random()*10000+1,10); return '-'+parseInt(Math.random()*10000+1,10);
} }
const getFileName=(path)=>{ const getFileName=(path)=>{
if(path.lastIndexOf("\\")>=0){ if(path.lastIndexOf("\\")>=0){
let reg=new RegExp("\\\\","g"); let reg=new RegExp("\\\\","g");
path = path.replace(reg,"/"); path = path.replace(reg,"/");
} }
return path.substring(path.lastIndexOf("/")+1); return path.substring(path.lastIndexOf("/")+1);
} }
export default { export default {
name: 'JUpload', name: 'JUpload',
data(){ data(){
return { return {
uploadAction:window._CONFIG['domianURL']+"/sys/common/upload", uploadAction:window._CONFIG['domianURL']+"/systemConfig/upload",
headers:{}, headers:{},
fileList: [], fileList: [],
newFileList: [], newFileList: [],
uploadGoOn:true, uploadGoOn:true,
previewVisible: false, previewVisible: false,
//---------------------------- begin 图片左右换位置 ------------------------------------- //---------------------------- begin 图片左右换位置 -------------------------------------
previewImage: '', previewImage: '',
containerId:'', containerId:'',
top:'', top:'',
left:'', left:'',
moveDisplay:'none', moveDisplay:'none',
showMoverTask:false, showMoverTask:false,
moverHold:false, moverHold:false,
currentImg:'' currentImg:''
//---------------------------- end 图片左右换位置 ------------------------------------- //---------------------------- end 图片左右换位置 -------------------------------------
} }
}, },
props:{ props:{
text:{ text:{
type:String, type:String,
required:false, required:false,
default:"点击上传" default:"点击上传"
}, },
fileType:{ fileType:{
type:String, type:String,
required:false, required:false,
default:FILE_TYPE_ALL default:FILE_TYPE_ALL
}, },
/*这个属性用于控制文件上传的业务路径*/ /*这个属性用于控制文件上传的业务路径*/
bizPath:{ bizPath:{
type:String, type:String,
required:false, required:false,
default:"temp" default:"temp"
}, },
value:{ value:{
type:[String,Array], type:[String,Array],
required:false required:false
}, },
// update-begin- --- author:wangshuai ------ date:20190929 ---- for:Jupload组件增加是否能够点击 // update-begin- --- author:wangshuai ------ date:20190929 ---- for:Jupload组件增加是否能够点击
disabled:{ disabled:{
type:Boolean, type:Boolean,
required:false, required:false,
default: false default: false
}, },
// update-end- --- author:wangshuai ------ date:20190929 ---- for:Jupload组件增加是否能够点击 // update-end- --- author:wangshuai ------ date:20190929 ---- for:Jupload组件增加是否能够点击
//此属性被废弃了 //此属性被废弃了
triggerChange:{ triggerChange:{
type: Boolean, type: Boolean,
required: false, required: false,
default: false default: false
}, },
/** /**
* update -- author:lvdandan -- date:20190219 -- for:Jupload组件增加是否返回url * update -- author:lvdandan -- date:20190219 -- for:Jupload组件增加是否返回url
* true仅返回url * true仅返回url
* false返回fileName filePath fileSize * false返回fileName filePath fileSize
*/ */
returnUrl:{ returnUrl:{
type:Boolean, type:Boolean,
required:false, required:false,
default: true default: true
}, },
number:{ number:{
type:Number, type:Number,
required:false, required:false,
default: 0 default: 0
}, },
buttonVisible:{ buttonVisible:{
type:Boolean, type:Boolean,
required:false, required:false,
default: true default: true
}, },
}, },
watch:{ watch:{
value:{ value:{
immediate: true, immediate: true,
handler() { handler() {
let val = this.value let val = this.value
if (val instanceof Array) { if (val instanceof Array) {
if(this.returnUrl){ if(this.returnUrl){
this.initFileList(val.join(',')) this.initFileList(val.join(','))
}else{ }else{
this.initFileListArr(val); this.initFileListArr(val);
} }
} else { } else {
this.initFileList(val) this.initFileList(val)
} }
} }
} }
}, },
computed:{ computed:{
isImageComp(){ isImageComp(){
return this.fileType === FILE_TYPE_IMG return this.fileType === FILE_TYPE_IMG
}, },
complistType(){ complistType(){
return this.fileType === FILE_TYPE_IMG?'picture-card':'text' return this.fileType === FILE_TYPE_IMG?'picture-card':'text'
} }
}, },
created(){ created(){
const token = Vue.ls.get(ACCESS_TOKEN); const token = Vue.ls.get(ACCESS_TOKEN);
//---------------------------- begin 图片左右换位置 ------------------------------------- //---------------------------- begin 图片左右换位置 -------------------------------------
this.headers = {"X-Access-Token":token}; this.headers = {"X-Access-Token":token};
this.containerId = 'container-ty-'+new Date().getTime(); this.containerId = 'container-ty-'+new Date().getTime();
//---------------------------- end 图片左右换位置 ------------------------------------- //---------------------------- end 图片左右换位置 -------------------------------------
}, },
methods:{ methods:{
initFileListArr(val){ initFileListArr(val){
if(!val || val.length==0){ if(!val || val.length==0){
this.fileList = []; this.fileList = [];
return; return;
} }
let fileList = []; let fileList = [];
for(var a=0;a<val.length;a++){ for(var a=0;a<val.length;a++){
let url = getFileAccessHttpUrl(val[a].filePath); let url = getFileAccessHttpUrl(val[a].filePath);
fileList.push({ fileList.push({
uid:uidGenerator(), uid:uidGenerator(),
name:val[a].fileName, name:val[a].fileName,
status: 'done', status: 'done',
url: url, url: url,
response:{ response:{
status:"history", code:"history",
message:val[a].filePath data:val[a].filePath
} }
}) })
} }
this.fileList = fileList this.fileList = fileList
}, },
initFileList(paths){ initFileList(paths){
if(!paths || paths.length==0){ if(!paths || paths.length==0){
//return []; //return [];
// update-begin- --- author:os_chengtgen ------ date:20190729 ---- for:issues:326,Jupload组件初始化bug // update-begin- --- author:os_chengtgen ------ date:20190729 ---- for:issues:326,Jupload组件初始化bug
this.fileList = []; this.fileList = [];
return; return;
// update-end- --- author:os_chengtgen ------ date:20190729 ---- for:issues:326,Jupload组件初始化bug // update-end- --- author:os_chengtgen ------ date:20190729 ---- for:issues:326,Jupload组件初始化bug
} }
let fileList = []; let fileList = [];
let arr = paths.split(",") let arr = paths.split(",")
for(var a=0;a<arr.length;a++){ for(var a=0;a<arr.length;a++){
let url = getFileAccessHttpUrl(arr[a]); let url = getFileAccessHttpUrl(arr[a]);
fileList.push({ fileList.push({
uid:uidGenerator(), uid:uidGenerator(),
name:getFileName(arr[a]), name:getFileName(arr[a]),
status: 'done', status: 'done',
url: url, url: url,
response:{ response:{
status:"history", code:"history",
message:arr[a] data:arr[a]
} }
}) })
} }
this.fileList = fileList this.fileList = fileList
}, },
handlePathChange(){ handlePathChange(){
let uploadFiles = this.fileList let uploadFiles = this.fileList
let path = '' let path = ''
if(!uploadFiles || uploadFiles.length==0){ if(!uploadFiles || uploadFiles.length==0){
path = '' path = ''
} }
let arr = []; let arr = [];
for(var a=0;a<uploadFiles.length;a++){ for(var a=0;a<uploadFiles.length;a++){
arr.push(uploadFiles[a].response.message) arr.push(uploadFiles[a].response.data)
} }
if(arr.length>0){ if(arr.length>0){
path = arr.join(",") path = arr.join(",")
} }
this.$emit('change', path); this.$emit('change', path);
}, },
beforeUpload(file){ beforeUpload(file){
this.uploadGoOn=true this.uploadGoOn=true
var fileType = file.type; var fileType = file.type;
if(this.fileType===FILE_TYPE_IMG){ if(this.fileType===FILE_TYPE_IMG){
if(fileType.indexOf('image')<0){ if(fileType.indexOf('image')<0){
this.$message.warning('请上传图片'); this.$message.warning('请上传图片');
this.uploadGoOn=false this.uploadGoOn=false
return false; return false;
} }
} }
//TODO 扩展功能验证文件大小 //TODO 扩展功能验证文件大小
return true return true
}, },
handleChange(info) { handleChange(info) {
console.log("--文件列表改变--") console.log("--文件列表改变--")
if(!info.file.status && this.uploadGoOn === false){ debugger
info.fileList.pop(); if(!info.file.status && this.uploadGoOn === false){
} info.fileList.pop();
let fileList = info.fileList }
if(info.file.status==='done'){ let fileList = info.fileList
if(this.number>0){ if(info.file.status==='done'){
fileList = fileList.slice(-this.number); if(this.number>0){
} fileList = fileList.slice(-this.number);
if(info.file.response.success){ }
fileList = fileList.map((file) => { if(info.file.response.code === 200){
if (file.response) { fileList = fileList.map((file) => {
let reUrl = file.response.message; if (file.response) {
file.url = getFileAccessHttpUrl(reUrl); let reUrl = file.response.data;
} file.url = getFileAccessHttpUrl(reUrl);
return file; }
}); return file;
} });
//this.$message.success(`${info.file.name} 上传成功!`); }
}else if (info.file.status === 'error') { //this.$message.success(`${info.file.name} 上传成功!`);
this.$message.error(`${info.file.name} 上传失败.`); }else if (info.file.status === 'error') {
}else if(info.file.status === 'removed'){ this.$message.error(`${info.file.name} 上传失败.`);
this.handleDelete(info.file) }else if(info.file.status === 'removed'){
} this.handleDelete(info.file)
this.fileList = fileList }
if(info.file.status==='done' || info.file.status === 'removed'){ this.fileList = fileList
//returnUrl为true时仅返回文件路径 if(info.file.status==='done' || info.file.status === 'removed'){
if(this.returnUrl){ //returnUrl为true时仅返回文件路径
this.handlePathChange() if(this.returnUrl){
}else{ this.handlePathChange()
//returnUrl为false时返回文件名称、文件路径及文件大小 }else{
this.newFileList = []; //returnUrl为false时返回文件名称、文件路径及文件大小
for(var a=0;a<fileList.length;a++){ this.newFileList = [];
var fileJson = { for(var a=0;a<fileList.length;a++){
fileName:fileList[a].name, var fileJson = {
filePath:fileList[a].response.message, fileName:fileList[a].name,
fileSize:fileList[a].size filePath:fileList[a].response.data,
}; fileSize:fileList[a].size
this.newFileList.push(fileJson); };
} this.newFileList.push(fileJson);
this.$emit('change', this.newFileList); }
} this.$emit('change', this.newFileList);
} }
}, }
handleDelete(file){ },
//如有需要新增 删除逻辑 handleDelete(file){
console.log(file) //如有需要新增 删除逻辑
}, console.log(file)
handlePreview(file){ },
if(this.fileType === FILE_TYPE_IMG){ handlePreview(file){
this.previewImage = file.url || file.thumbUrl; if(this.fileType === FILE_TYPE_IMG){
this.previewVisible = true; this.previewImage = file.url || file.thumbUrl;
}else{ this.previewVisible = true;
location.href=file.url }else{
} location.href=file.url
}, }
handleCancel(){ },
this.previewVisible = false; handleCancel(){
}, this.previewVisible = false;
//---------------------------- begin 图片左右换位置 ------------------------------------- },
moveLast(){ //---------------------------- begin 图片左右换位置 -------------------------------------
//console.log(ev) moveLast(){
//console.log(this.fileList) //console.log(ev)
//console.log(this.currentImg) //console.log(this.fileList)
let index = this.getIndexByUrl(); //console.log(this.currentImg)
if(index==0){ let index = this.getIndexByUrl();
this.$message.warn('未知的操作') if(index==0){
}else{ this.$message.warn('未知的操作')
let curr = this.fileList[index].url; }else{
let last = this.fileList[index-1].url; let curr = this.fileList[index].url;
let arr =[] let last = this.fileList[index-1].url;
for(let i=0;i<this.fileList.length;i++){ let arr =[]
if(i==index-1){ for(let i=0;i<this.fileList.length;i++){
arr.push(curr) if(i==index-1){
}else if(i==index){ arr.push(curr)
arr.push(last) }else if(i==index){
}else{ arr.push(last)
arr.push(this.fileList[i].url) }else{
} arr.push(this.fileList[i].url)
} }
this.currentImg = last }
this.$emit('change',arr.join(',')) this.currentImg = last
} this.$emit('change',arr.join(','))
}, }
moveNext(){ },
let index = this.getIndexByUrl(); moveNext(){
if(index==this.fileList.length-1){ let index = this.getIndexByUrl();
this.$message.warn('已到最后~') if(index==this.fileList.length-1){
}else{ this.$message.warn('已到最后~')
let curr = this.fileList[index].url; }else{
let next = this.fileList[index+1].url; let curr = this.fileList[index].url;
let arr =[] let next = this.fileList[index+1].url;
for(let i=0;i<this.fileList.length;i++){ let arr =[]
if(i==index+1){ for(let i=0;i<this.fileList.length;i++){
arr.push(curr) if(i==index+1){
}else if(i==index){ arr.push(curr)
arr.push(next) }else if(i==index){
}else{ arr.push(next)
arr.push(this.fileList[i].url) }else{
} arr.push(this.fileList[i].url)
} }
this.currentImg = next }
this.$emit('change',arr.join(',')) this.currentImg = next
} this.$emit('change',arr.join(','))
}, }
getIndexByUrl(){ },
for(let i=0;i<this.fileList.length;i++){ getIndexByUrl(){
if(this.fileList[i].url === this.currentImg || encodeURI(this.fileList[i].url) === this.currentImg){ for(let i=0;i<this.fileList.length;i++){
return i; if(this.fileList[i].url === this.currentImg || encodeURI(this.fileList[i].url) === this.currentImg){
} return i;
} }
return -1; }
} return -1;
}, }
mounted(){ },
const moverObj = document.getElementById(this.containerId+'-mover'); mounted(){
moverObj.addEventListener('mouseover',()=>{ const moverObj = document.getElementById(this.containerId+'-mover');
this.moverHold = true moverObj.addEventListener('mouseover',()=>{
this.moveDisplay = 'block'; this.moverHold = true
}); this.moveDisplay = 'block';
moverObj.addEventListener('mouseout',()=>{ });
this.moverHold = false moverObj.addEventListener('mouseout',()=>{
this.moveDisplay = 'none'; this.moverHold = false
}); this.moveDisplay = 'none';
let picList = document.getElementById(this.containerId)?document.getElementById(this.containerId).getElementsByClassName('ant-upload-list-picture-card'):[]; });
if(picList && picList.length>0){ let picList = document.getElementById(this.containerId)?document.getElementById(this.containerId).getElementsByClassName('ant-upload-list-picture-card'):[];
picList[0].addEventListener('mouseover',(ev)=>{ if(picList && picList.length>0){
ev = ev || window.event; picList[0].addEventListener('mouseover',(ev)=>{
let target = ev.target || ev.srcElement; ev = ev || window.event;
if('ant-upload-list-item-info' == target.className){ let target = ev.target || ev.srcElement;
this.showMoverTask=false if('ant-upload-list-item-info' == target.className){
let item = target.parentElement this.showMoverTask=false
this.left = item.offsetLeft let item = target.parentElement
this.top=item.offsetTop+item.offsetHeight-50; this.left = item.offsetLeft
this.moveDisplay = 'block'; this.top=item.offsetTop+item.offsetHeight-50;
this.currentImg = target.getElementsByTagName('img')[0].src this.moveDisplay = 'block';
} this.currentImg = target.getElementsByTagName('img')[0].src
}
});
});
picList[0].addEventListener('mouseout',(ev)=>{
ev = ev || window.event; picList[0].addEventListener('mouseout',(ev)=>{
let target = ev.target || ev.srcElement; ev = ev || window.event;
//console.log('移除',target) let target = ev.target || ev.srcElement;
if('ant-upload-list-item-info' == target.className){ //console.log('移除',target)
this.showMoverTask=true if('ant-upload-list-item-info' == target.className){
setTimeout(()=>{ this.showMoverTask=true
if(this.moverHold === false) setTimeout(()=>{
this.moveDisplay = 'none'; if(this.moverHold === false)
},100) this.moveDisplay = 'none';
} },100)
if('ant-upload-list-item ant-upload-list-item-done' == target.className || 'ant-upload-list ant-upload-list-picture-card'== target.className){ }
this.moveDisplay = 'none'; if('ant-upload-list-item ant-upload-list-item-done' == target.className || 'ant-upload-list ant-upload-list-picture-card'== target.className){
} this.moveDisplay = 'none';
}) }
//---------------------------- end 图片左右换位置 ------------------------------------- })
} //---------------------------- end 图片左右换位置 -------------------------------------
}, }
model: { },
prop: 'value', model: {
event: 'change' prop: 'value',
} event: 'change'
} }
</script> }
</script>
<style lang="less">
.uploadty-disabled{ <style lang="less">
.ant-upload-list-item { .uploadty-disabled{
.anticon-close{ .ant-upload-list-item {
display: none; .anticon-close{
} display: none;
.anticon-delete{ }
display: none; .anticon-delete{
} display: none;
} }
} }
//---------------------------- begin 图片左右换位置 ------------------------------------- }
.uploadty-mover-mask{ //---------------------------- begin 图片左右换位置 -------------------------------------
background-color: rgba(0, 0, 0, 0.5); .uploadty-mover-mask{
opacity: .8; background-color: rgba(0, 0, 0, 0.5);
color: #fff; opacity: .8;
height: 28px; color: #fff;
line-height: 28px; height: 28px;
} line-height: 28px;
//---------------------------- end 图片左右换位置 ------------------------------------- }
//---------------------------- end 图片左右换位置 -------------------------------------
</style> </style>

View File

@@ -152,8 +152,14 @@
return (record.discountMoney + record.discountLastMoney).toFixed(2); return (record.discountMoney + record.discountLastMoney).toFixed(2);
} }
}, },
{ title: '优惠后金额', dataIndex: 'discountLastMoney',width:100}, { title: '优惠后金额', dataIndex: 'discountLastMoney',width:80},
{ title: '付款', dataIndex: 'changeAmount',width:50}, { title: '付款', dataIndex: 'changeAmount',width:60},
{ title: '欠款', dataIndex: 'debt',width:60,
customRender:function (text,record,index) {
let debt = record.discountLastMoney - record.changeAmount
return debt? debt.toFixed(2):''
}
},
{ {
title: '操作', title: '操作',
dataIndex: 'action', dataIndex: 'action',

View File

@@ -152,8 +152,14 @@
return (record.discountMoney + record.discountLastMoney).toFixed(2); return (record.discountMoney + record.discountLastMoney).toFixed(2);
} }
}, },
{ title: '优惠后金额', dataIndex: 'discountLastMoney',width:100}, { title: '优惠后金额', dataIndex: 'discountLastMoney',width:80},
{ title: '收款', dataIndex: 'changeAmount',width:50}, { title: '收款', dataIndex: 'changeAmount',width:60},
{ title: '欠款', dataIndex: 'debt',width:60,
customRender:function (text,record,index) {
let debt = record.discountLastMoney - record.changeAmount
return debt? debt.toFixed(2):''
}
},
{ {
title: '操作', title: '操作',
dataIndex: 'action', dataIndex: 'action',

View File

@@ -1,13 +1,49 @@
<template> <template>
<a-modal <a-modal
:title="title" :title="title"
:width="1000" :width="1150"
:visible="visible" :visible="visible"
@ok="handleOk" @ok="handleOk"
@cancel="handleCancel" @cancel="handleCancel"
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">
<!-- 搜索区域 -->
<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
bordered bordered
@@ -27,6 +63,7 @@
<script> <script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin' import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import Vue from 'vue'
export default { export default {
name: 'DebtBillList', name: 'DebtBillList',
mixins:[JeecgListMixin], mixins:[JeecgListMixin],
@@ -40,12 +77,22 @@
selectBillRows: [], selectBillRows: [],
selectBillIds: '', selectBillIds: '',
queryParam: { queryParam: {
organId: "",
materialParam: "",
number: "", number: "",
searchMaterial: "",
type: "", type: "",
subType: "", subType: "",
roleType: Vue.ls.get('roleType'),
status: "" status: ""
}, },
labelCol: {
xs: { span: 24 },
sm: { span: 8 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
// 表头 // 表头
columns: [ columns: [
{ {
@@ -59,20 +106,30 @@
} }
}, },
{ title: '', dataIndex: 'organName',width:120}, { title: '', dataIndex: 'organName',width:120},
{ title: '单据编号', dataIndex: 'number',width:150}, { title: '单据编号', dataIndex: 'number',width:120},
{ title: '商品信息', dataIndex: 'materialsList',width:220, ellipsis:true, { title: '商品信息', dataIndex: 'materialsList',width:200, ellipsis:true,
customRender:function (text,record,index) { customRender:function (text,record,index) {
if(text) { if(text) {
return text.replace(",",""); return text.replace(",","");
} }
} }
}, },
{ title: '单据日期', dataIndex: 'operTimeStr',width:145}, { title: '单据日期', dataIndex: 'operTimeStr',width:130},
{ title: '操作员', dataIndex: 'userName',width:60}, { title: '操作员', dataIndex: 'userName',width:60},
{ title: '金额合计', dataIndex: 'totalPrice',width:70} { title: '应收欠款', dataIndex: 'needDebt',width:70,
customRender:function (text,record,index) {
return (record.discountLastMoney - record.changeAmount).toFixed(2);
}
},
{ title: '已收欠款', dataIndex: 'finishDebt',width:70 },
{ title: '待收欠款', dataIndex: 'debt',width:70,
customRender:function (text,record,index) {
return (record.discountLastMoney - record.changeAmount - record.finishDebt).toFixed(2);
}
}
], ],
url: { url: {
list: "/depotHead/list" list: "/depotHead/debtList"
} }
} }
}, },
@@ -84,7 +141,8 @@
created() { created() {
}, },
methods: { methods: {
show(type, subType, organType, status) { show(organId, type, subType, organType, status) {
this.queryParam.organId = organId
this.queryParam.type = type this.queryParam.type = type
this.queryParam.subType = subType this.queryParam.subType = subType
this.queryParam.status = status this.queryParam.status = status
@@ -109,6 +167,20 @@
this.$emit('ok', this.selectBillRows); this.$emit('ok', this.selectBillRows);
this.close(); this.close();
}, },
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
}
this.loadData(1);
},
getSelectBillRows() { getSelectBillRows() {
let dataSource = this.dataSource; let dataSource = this.dataSource;
let billIds = ""; let billIds = "";

View File

@@ -288,6 +288,11 @@
</a-col> </a-col>
</a-row> </a-row>
<a-row class="form-row" :gutter="24"> <a-row class="form-row" :gutter="24">
<a-col :span="6">
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="收款账户">
{{model.accountName}}
</a-form-item>
</a-col>
<a-col :span="6"> <a-col :span="6">
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="优惠金额"> <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="优惠金额">
{{model.changeAmount}} {{model.changeAmount}}
@@ -295,7 +300,6 @@
</a-col> </a-col>
<a-col :span="6"></a-col> <a-col :span="6"></a-col>
<a-col :span="6"></a-col> <a-col :span="6"></a-col>
<a-col :span="6"></a-col>
</a-row> </a-row>
</section> </section>
</template> </template>
@@ -405,8 +409,10 @@
], ],
moneyInColumns: [ moneyInColumns: [
{ title: '销售单据编号',dataIndex: 'billNumber',width: '20%'}, { title: '销售单据编号',dataIndex: 'billNumber',width: '20%'},
{ title: '金额',dataIndex: 'eachAmount', width: '10%'}, { title: '应收欠款',dataIndex: 'needDebt', width: '10%'},
{ title: '备注',dataIndex: 'remark', width: '30%'} { title: '已收欠款',dataIndex: 'finishDebt', width: '10%'},
{ title: '本次收款',dataIndex: 'eachAmount', width: '10%'},
{ title: '备注',dataIndex: 'remark', width: '20%'}
], ],
moneyOutColumns: [ moneyOutColumns: [
{ title: '账户名称',dataIndex: 'accountName',width: '20%'}, { title: '账户名称',dataIndex: 'accountName',width: '20%'},

View File

@@ -49,7 +49,7 @@
<a-col :lg="6" :md="12" :sm="24"> <a-col :lg="6" :md="12" :sm="24">
<!-- 操作按钮 --> <!-- 操作按钮 -->
<div class="action-button"> <div class="action-button">
<a-button type="primary" icon="plus" @click="handleClickAdd">批量新增</a-button> <a-button type="primary" icon="plus" @click="handleClickAdd">新增</a-button>
<span class="gap"></span> <span class="gap"></span>
<a-button type="primary" icon="minus" @click="handleClear">清空</a-button> <a-button type="primary" icon="minus" @click="handleClear">清空</a-button>
</div> </div>
@@ -76,6 +76,15 @@
</a-col> </a-col>
</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-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="收款账户">
<a-select placeholder="选择收款账户" v-decorator="[ 'accountId', validatorRules.accountId ]" :dropdownMatchSelectWidth="false">
<a-select-option v-for="(item,index) in accountList" :key="index" :value="item.id">
{{ item.name }}
</a-select-option>
</a-select>
</a-form-item>
</a-col>
<a-col :lg="6" :md="12" :sm="24"> <a-col :lg="6" :md="12" :sm="24">
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="优惠金额"> <a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" label="优惠金额">
<a-input placeholder="请输入优惠金额" v-decorator.trim="[ 'changeAmount' ]" /> <a-input placeholder="请输入优惠金额" v-decorator.trim="[ 'changeAmount' ]" />
@@ -85,7 +94,12 @@
</a-col> </a-col>
<a-col :lg="6" :md="12" :sm="24"> <a-col :lg="6" :md="12" :sm="24">
</a-col> </a-col>
</a-row>
<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="文件上传">
<j-upload v-model="fileList" bizPath="financial"></j-upload>
</a-form-item>
</a-col> </a-col>
</a-row> </a-row>
</a-form> </a-form>
@@ -100,6 +114,8 @@
import { FormTypes } from '@/utils/JEditableTableUtil' import { FormTypes } from '@/utils/JEditableTableUtil'
import { JEditableTableMixin } from '@/mixins/JEditableTableMixin' import { JEditableTableMixin } from '@/mixins/JEditableTableMixin'
import { FinancialModalMixin } from '../mixins/FinancialModalMixin' import { FinancialModalMixin } from '../mixins/FinancialModalMixin'
import JUpload from '@/components/jeecg/JUpload'
import JEllipsis from '@/components/jeecg/JEllipsis'
import JDate from '@/components/jeecg/JDate' import JDate from '@/components/jeecg/JDate'
import Vue from 'vue' import Vue from 'vue'
export default { export default {
@@ -107,6 +123,8 @@
mixins: [JEditableTableMixin, FinancialModalMixin], mixins: [JEditableTableMixin, FinancialModalMixin],
components: { components: {
DebtBillList, DebtBillList,
JUpload,
JEllipsis,
JDate JDate
}, },
data () { data () {
@@ -118,6 +136,7 @@
addDefaultRowNum: 0, addDefaultRowNum: 0,
visible: false, visible: false,
model: {}, model: {},
fileList:[],
labelCol: { labelCol: {
xs: { span: 24 }, xs: { span: 24 },
sm: { span: 8 }, sm: { span: 8 },
@@ -133,10 +152,12 @@
dataSource: [], dataSource: [],
columns: [ columns: [
{ title: '销售单据编号',key: 'billNumber',width: '20%', type: FormTypes.input, readonly: true }, { title: '销售单据编号',key: 'billNumber',width: '20%', type: FormTypes.input, readonly: true },
{ title: '金额',key: 'eachAmount', width: '10%', type: FormTypes.inputNumber, statistics: true, placeholder: '请选择${title}', { title: '应收欠款',key: 'needDebt', width: '10%', type: FormTypes.inputNumber, statistics: true, readonly: true },
{ title: '已收欠款', key: 'finishDebt', width: '10%', type: FormTypes.inputNumber, statistics: true, readonly: true },
{ title: '本次收款',key: 'eachAmount', width: '10%', type: FormTypes.inputNumber, statistics: true, placeholder: '请选择${title}',
validateRules: [{ required: true, message: '${title}不能为空' }] validateRules: [{ required: true, message: '${title}不能为空' }]
}, },
{ title: '备注',key: 'remark', width: '30%', type: FormTypes.input, placeholder: '请选择${title}'} { title: '备注',key: 'remark', width: '20%', type: FormTypes.input, placeholder: '请选择${title}'}
] ]
}, },
confirmLoading: false, confirmLoading: false,
@@ -150,6 +171,11 @@
rules: [ rules: [
{ required: true, message: '请选择经手人!' } { required: true, message: '请选择经手人!' }
] ]
},
accountId:{
rules: [
{ required: true, message: '请选择收款账户!' }
]
} }
}, },
url: { url: {
@@ -160,7 +186,7 @@
} }
}, },
created () { created () {
this.initDetailAccount() this.initAccount()
}, },
methods: { methods: {
//调用完edit()方法之后会自动调用此方法 //调用完edit()方法之后会自动调用此方法
@@ -170,8 +196,10 @@
} else { } else {
this.model.billTime = this.model.billTimeStr this.model.billTime = this.model.billTimeStr
this.$nextTick(() => { this.$nextTick(() => {
this.form.setFieldsValue(pick(this.model,'organId', 'handsPersonId', 'billTime', 'billNo', 'remark', 'changeAmount')) this.form.setFieldsValue(pick(this.model,'organId', 'handsPersonId', 'billTime', 'billNo', 'remark',
'accountId','changeAmount'))
}); });
this.fileList = this.model.fileName
// 加载子表数据 // 加载子表数据
let params = { let params = {
headerId: this.model.id headerId: this.model.id
@@ -190,6 +218,9 @@
totalPrice += item.eachAmount-0 totalPrice += item.eachAmount-0
} }
billMain.totalPrice = totalPrice billMain.totalPrice = totalPrice
if(this.fileList && this.fileList.length > 0) {
billMain.fileName = this.fileList
}
if(this.model.id){ if(this.model.id){
billMain.id = this.model.id billMain.id = this.model.id
} }
@@ -199,8 +230,13 @@
} }
}, },
handleClickAdd() { handleClickAdd() {
this.$refs.debtBillList.show('出库', '销售', '客户', "0") let organId = this.form.getFieldValue('organId')
this.$refs.debtBillList.title = "选择销售出库" if(organId){
this.$refs.debtBillList.show(organId, '出库', '销售', '客户', "0")
this.$refs.debtBillList.title = "选择销售出库欠款单据"
} else {
this.$message.warning('请选择客户!');
}
}, },
handleClear() { handleClear() {
this.accountTable.dataSource = [] this.accountTable.dataSource = []
@@ -217,8 +253,11 @@
for(let i=0; i<selectBillRows.length; i++){ for(let i=0; i<selectBillRows.length; i++){
let info = selectBillRows[i] let info = selectBillRows[i]
info.billNumber = info.number info.billNumber = info.number
info.eachAmount = info.totalPrice info.needDebt = (info.discountLastMoney - info.changeAmount).toFixed(2)
listEx.push(info) info.eachAmount = (info.discountLastMoney - info.changeAmount - info.finishDebt).toFixed(2);
if(info.eachAmount != 0) {
listEx.push(info)
}
} }
tab.dataSource = listEx tab.dataSource = listEx
typeof success === 'function' ? success(res) : '' typeof success === 'function' ? success(res) : ''