You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

613 lines
23 KiB

<template>
<div class="app-container">
<div v-show="viewState == 1">
<div class="tab-header webtop">
<div>{{ viewTitle }}</div>
<div>
<el-button type="primary" size="small" @click="openCountersign('加签')">加 签</el-button>
<el-button type="primary" size="small" @click="openAgree('同意')">同 意</el-button>
<el-button type="danger" size="small" @click="openReject('驳回')">驳 回</el-button>
<el-button type="danger" size="small" @click="openStop('终止')">终 止</el-button>
</div>
</div>
<div class="">
<el-form ref="form_obj" :model="formobj" :rules="rules" class="formaddcopy02">
<el-row style="border-top: 1px solid #e0e3eb">
<el-col :span="8">
<div class="span-sty">申请部门</div>
<el-form-item><span class="addinputInfo">{{ formobj.deptName }}</span></el-form-item>
</el-col>
<el-col :span="8">
<div class="span-sty">申请人</div>
<el-form-item><span class="addinputInfo">{{ formobj.createByName }}</span></el-form-item>
</el-col>
<el-col :span="8">
<div class="span-sty">申请日期</div>
<el-form-item><span class="addinputInfo">{{ formobj.createTime }}</span></el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<div class="span-sty">采购方式</div>
<el-form-item><span class="addinputInfo">{{ formobj.purchaseTypeValue }}<span style="margin-left: 20px">{{ formobj.operateBrandValue }}</span></span></el-form-item>
</el-col>
<el-col :span="8">
<div class="span-sty">采购原因</div>
<el-form-item><span class="addinputInfo">{{ formobj.purchaseReasonValue }}</span></el-form-item>
</el-col>
<el-col :span="8">
<div class="span-sty">付款方式</div>
<el-form-item><span class="addinputInfo">{{ formobj.payTypeValue }}</span></el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<div class="span-sty">供应商</div>
<el-form-item><span class="addinputInfo">{{ formobj.supplierName }}<span style="margin-left: 20px">{{ formobj.warehouseTypeValue }}</span></span></el-form-item>
</el-col>
<el-col :span="8">
<div class="span-sty">是否开发票</div>
<el-form-item><span class="addinputInfo">{{ formobj.purchaseBillInvoice.isInvoicing == '1' ? '是' : '否' }}</span></el-form-item>
</el-col>
<el-col :span="8">
<div v-show="formobj.purchaseBillInvoice.isInvoicing == '1'">
<div class="span-sty">发票类型(税率)</div>
<el-form-item><span class="addinputInfo">{{ formobj.purchaseBillInvoice.billType }}{{ formobj.purchaseBillInvoice.taxRate == '' ? '' : '(' + formobj.purchaseBillInvoice.taxRate + '%)' }}</span></el-form-item>
</div>
</el-col>
</el-row>
<el-row v-show="formobj.payTypeValue == '预付款'">
<el-col :span="24">
<div class="span-sty">预付款情况</div>
<el-form-item><span class="addinputInfo">当前预付款项金额(元):{{ formobj.prepaymentAmount }}</span></el-form-item>
</el-col>
</el-row>
<el-row v-show="formobj.payTypeValue == '月结'">
<el-col :span="24">
<div class="span-sty">月结欠款情况</div>
<el-form-item><span class="addinputInfo">累计欠款金额(元):{{ formobj.owedAmount }}</span></el-form-item>
</el-col>
</el-row>
<el-row v-show="formobj.purchaseTypeValue == '代理库'">
<el-col :span="16">
<div class="span-sty">厂家订单类型</div>
<el-form-item><span class="addinputInfo">{{ formobj.manufacturersOrderTypeValue }}</span></el-form-item>
</el-col>
<el-col :span="8">
<div class="span-sty">厂家订单号</div>
<el-form-item><span class="addinputInfo">{{ formobj.manufacturersOrderNumber }}</span></el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<div class="span-sty">备注</div>
<el-form-item><span class="addinputInfo">{{ formobj.remarks }}</span></el-form-item>
</el-col>
<el-col :span="8">
<div class="span-sty">采购人</div>
<el-form-item><span class="addinputInfo">{{ formobj.purchasingAgent }}</span></el-form-item>
</el-col>
<el-col :span="8">
<div class="span-sty">预计到货日期</div>
<el-form-item><span class="addinputInfo">{{ formobj.deliveryDate }}</span></el-form-item>
</el-col>
</el-row>
<div v-if="formobj.payTypeValue == '单笔付款'">
<div class="title">订金及付款申请</div>
<el-row>
<el-col :span="8">
<div class="span-sty">是否先付货款</div>
<el-form-item><span class="addinputInfo">{{ formobj.purchasePay.isFirstPay == '1' ? '是' : '否' }}</span></el-form-item>
</el-col>
<el-col :span="8" v-if="formobj.purchasePay.isFirstPay == '0'">
<div class="span-sty">审批通过后付订金</div>
<el-form-item><span class="addinputInfo">{{ formobj.purchasePay.deposit }}</span></el-form-item>
</el-col>
<el-col :span="8" v-if="formobj.purchasePay.isFirstPay == '0'">
<div class="span-sty">验货后付货款</div>
<el-form-item><span class="addinputInfo">{{ formobj.purchasePay.goodsMoney }}</span></el-form-item>
</el-col>
<el-col :span="16" v-else>
<div class="span-sty">审批通过后付货款</div>
<el-form-item><span class="addinputInfo">{{ formobj.purchasePay.goodsMoney }}</span></el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<div class="span-sty">收款账户名称</div>
<el-form-item><span class="addinputInfo">{{ formobj.purchasePay.accountName }}</span></el-form-item>
</el-col>
<el-col :span="8">
<div class="span-sty">开户行</div>
<el-form-item><span class="addinputInfo">{{ formobj.purchasePay.bankName }}</span></el-form-item>
</el-col>
<el-col :span="8">
<div class="span-sty">银行账号</div>
<el-form-item><span class="addinputInfo">{{ formobj.purchasePay.bankAccount }}</span></el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="16">
<div class="span-sty">其他费用名称</div>
<el-form-item><span class="addinputInfo">{{ formobj.purchasePay.otherAmountName }}</span></el-form-item>
</el-col>
<el-col :span="8">
<div class="span-sty">其他费用合计</div>
<el-form-item><span class="addinputInfo">{{ formobj.purchasePay.otherAmount }}</span></el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<div class="span-sty">付款备注</div>
<el-form-item><span class="addinputInfo">{{ formobj.purchasePay.payRemark }}</span></el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<div class="span-sty">附件</div>
<el-form-item><el-image class="addinputInfo" style="width: 150px;height: 150px" v-for="(item, index) in formobj.purchasePay.filePaths" :key="index" :src="item" :preview-src-list="formobj.purchasePay.filePaths" /></el-form-item>
</el-col>
</el-row>
</div>
<div class="title ">商品列表</div>
<el-table :key="tableKey" :data="formobj.pmsPurchaseBillDetailList" :index="index" border style="width: 100%">
<el-table-column fixed width="60" label="序号" type="index" :index="index + 1" align="center"/>
<el-table-column prop="goodsSpuName" label="商品名称" align="center" width="300" />
<el-table-column prop="goodsSkuCode" label="图号" align="center" width="200" />
<el-table-column prop="goodsSkuOwnSpec" label="规格" align="center" width="200" />
<el-table-column prop="unit" label="单位" align="center" width="100" />
<el-table-column prop="manufacturerName" label="厂家" align="center" width="100" />
<el-table-column prop="count" label="采购数量" align="center" width="150" />
<el-table-column prop="taxPrice" v-if="formobj.purchaseBillInvoice.isInvoicing == '1'" label="含税单价(元)" align="center" min-width="150" />
<el-table-column prop="taxPrice" v-else label="不含税单价(元)" align="center" min-width="150" />
<el-table-column prop="amount" label="采购金额(元)" align="center" width="200" />
</el-table>
<el-row>
<el-col :span="24">
<div class="span-sty" style="border-right: 0px">数量:</div>
<el-form-item><span class="addinputInfo">{{ slTotal }}</span></el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<div class="span-sty" style="border-right: 0px">应付金额:</div>
<el-form-item><span class="addinputInfo">{{ yfTotal }} = 采购金额:{{ cgTotal }} + 运费:{{ formobj.freight }} - 优惠:{{ formobj.discountAmount }} + 误差调整:{{ formobj.errorAmount }}</span></el-form-item>
</el-col>
</el-row>
</el-form>
</div>
</div>
<!-- 选择待办人 的弹出框-->
<el-dialog title="填写审批意见" :visible.sync="nodeDialogVisible" width="80%">
<el-form class="formadd" >
<el-row v-show="countersignLink" style="border-top: 1px solid #e0e3eb">
<el-col :span="4" class="tleftb">
<span class="icon">*</span>加签人员:
</el-col>
<el-col :span="20">
<el-form-item>
<el-select v-model="countersign.assignee" placeholder="请选择" filterable>
<el-option v-for="item in options" :key="item.userSid" :label="item.staffName" :value="item.userSid">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row v-show="currentLink" style="border-top: 1px solid #e0e3eb">
<el-col :span="4" class="tleftb">
<span>当前环节:</span>
</el-col>
<el-col :span="20">
<el-form-item><span>{{ current.taskName }}->{{ nextNode.name }}</span></el-form-item>
</el-col>
</el-row>
<el-row :class="{rowClass:!currentLink}">
<el-col :span="4" class="tleftb">
<span>意见:</span>
</el-col>
<el-col :span="20">
<el-form-item><el-input size="small" v-model="dialogList.comment" placeholder="审批意见" class="addinputw" type="textarea" :autosize="{ minRows: 1, maxRows: 10}" clearable ></el-input></el-form-item>
</el-col>
</el-row>
<div style="text-align:center;margin-top: 20px;">
<el-button type="primary" size="mini" @click="reject">确 定</el-button>
<el-button type="info " size="mini" @click="nodeDialogVisible = false"> </el-button>
</div>
</el-form>
</el-dialog>
</div>
</template>
<script>
import req from '@/api/purchase/procurement'
import { selectStaffListss } from '@/api/Common/dictcommons'
export default {
name: 'ProcurementDaiBan',
data() {
return {
viewTitle: '',
viewState: 1,
tableKey: 1,
index: 0,
formobj: {
sid: '',
remarks: '',
createBySid: '',
createByName: '',
createTime: '',
sourceBillSid: '',
sourceBillNo: '',
billNo: '',
purchaseTypeKey: '',
purchaseTypeValue: '',
purchaseReasonKey: '',
purchaseReasonValue: '',
purchasingAgent: '',
purchasingAgentSid: '',
payTypeKey: '',
payTypeValue: '',
errorAmount: '',
supplierSid: '',
supplierName: '',
supplierPhone: '',
purchaserSid: '',
purchaserName: '',
deliveryDate: '',
freight: '',
discountAmount: '',
payableAmount: '',
prepaymentAmount: '',
owedAmount: '',
deptSid: '',
deptName: '',
procDefId: '',
nodeId: '',
procInstId: '',
nodeState: '',
taskId: '',
finishTime: '',
orgPath: '',
useOrgSid: '',
useOrgName: '',
createOrgSid: '',
createOrgName: '',
operateBrandKey: '',
operateBrandValue: '',
warehouseTypeKey: '',
warehouseTypeValue: '',
manufacturersOrderTypeValue: '',
manufacturersOrderTypeKey: '',
manufacturersOrderNumber: '',
purchasePay: {
sid: '',
billSid: '',
isFirstPay: '',
deposit: '',
goodsMoney: '',
accountName: '',
bankName: '',
bankAccount: '',
otherAmountName: '',
otherAmount: '',
payRemark: '',
filePaths: []
},
purchaseBillInvoice: {
billSid: '',
isInvoicing: '',
billTypeKey: '',
billType: '',
taxRate: ''
},
pmsPurchaseBillDetailList: []
},
rules: {},
options: [],
operation: '', // 点击操作按钮
dialogList: {
comment: ''
},
startTask: true,
current: {
taskDefKey: '',
taskName: '' // 当前环节名称
},
nextNode: {}, // 下一环节
nodeDialogVisible: false,
currentLink: true,
countersignLink: false,
// 环节所需参数
linkByParameter: {
businessSid: '',
comment: '',
instanceId: '',
taskId: '',
orgSidPath: '',
taskDefKey: '',
userSid: ''
},
// 加签按钮所需参数
countersign: {
taskId: '',
assignee: '',
userSid: '',
instanceId: '',
views: ''
}
}
},
created() {
console.log('url:' + window.location.href)
var one = window.location.href.indexOf('&data') + 6
const data = window.location.href.substr(one) // url解码unescape()已从web中移除,尽量不使用
const obj = JSON.parse(decodeURIComponent(data))
console.log('iframe页面获取的obj:', obj)
// 点击(同意、终止、驳回、驳回)操作时所需的参数
this.linkByParameter.businessSid = obj.businessSid
this.linkByParameter.instanceId = obj.instanceId
this.linkByParameter.taskId = obj.taskId
this.linkByParameter.taskDefKey = obj.taskDefKey
// this.linkByParameter.orgSidPath = window.sessionStorage.getItem('orgSidPath')
this.linkByParameter.userSid = window.sessionStorage.getItem('userSid')
this.current.taskDefKey = obj.taskDefKey
this.current.taskName = obj.taskName
// 加签参数
this.countersign.taskId = obj.taskId
this.countersign.userSid = window.sessionStorage.getItem('userSid')
this.countersign.instanceId = obj.instanceId
// 加载表单数据
this.showInfo(obj.businessSid)
},
mounted() {
window.parent.postMessage({
cmd: 'returnHeight',
params: {
// 告诉父级页面,子页面的弹框高度。
code: 2,
data: 500 + 'px'
}
}, '*')
},
computed: {
// 数量
slTotal() {
let sl = '0'
if (this.formobj.pmsPurchaseBillDetailList.length > 0) {
this.formobj.pmsPurchaseBillDetailList.forEach((e) => {
if (e.goodsSpuName !== '') {
sl = Math.round((parseFloat(sl) + parseFloat(e.count === null ? '0' : e.count !== '' ? e.count : '0')) * 100) / 100
}
})
}
return sl
},
// 采购金额
cgTotal() {
let cg = '0'
if (this.formobj.pmsPurchaseBillDetailList.length > 0) {
this.formobj.pmsPurchaseBillDetailList.forEach((e) => {
if (e.goodsSpuName !== '') {
cg = Math.round((parseFloat(cg) + parseFloat(e.amount === null ? '0' : e.amount !== '' ? e.amount : '0')) * 100) / 100
}
})
}
return cg
},
yfTotal() {
let yf = '0'
yf = Math.round((parseFloat(yf) + parseFloat(this.cgTotal) + parseFloat(this.formobj.freight !== '' ? this.formobj.freight : '0') - parseFloat(this.formobj.discountAmount !== '' ? this.formobj.discountAmount : '0') + parseFloat(this.formobj.errorAmount !== '' ? this.formobj.errorAmount : '0')) * 100) / 100
return yf
}
},
methods: {
showInfo(sid) {
this.viewTitle = '采购单详情'
this.$nextTick(() => {
this.$refs['form_obj'].clearValidate()
})
req.fetchDetailsBySid(sid).then((res) => {
if (res.success) {
this.formobj = res.data
if (this.formobj.purchasePay.filePaths.length > 0) {
const aa = []
this.formobj.purchasePay.filePaths.forEach((e) => {
aa.push(e.url)
})
this.formobj.purchasePay.filePaths = aa
}
}
})
selectStaffListss().then((res) => {
if (res.success) {
this.options = res.data
}
})
},
// 加签
openCountersign(val) {
this.operation = val
this.currentLink = true
this.countersignLink = true
this.dialogList.comment = ''
req.getNextNodesForSubmit({ taskDefKey: this.current.taskDefKey, businessSid: this.linkByParameter.businessSid }).then((resp) => {
if (resp.success) {
var arr = resp.data
this.nextNode = arr[0]
this.nodeDialogVisible = true
}
this.submitdisabled = false
})
},
// 同意
openAgree(val) {
this.operation = val
this.currentLink = true
this.countersignLink = false
this.dialogList.comment = '同意'
req.getNextNodesForSubmit({ taskDefKey: this.current.taskDefKey, businessSid: this.linkByParameter.businessSid }).then((resp) => {
if (resp.success) {
var arr = resp.data
this.nextNode = arr[0]
this.nodeDialogVisible = true
}
this.submitdisabled = false
})
},
// 驳回
openReject(val) {
this.operation = val
this.currentLink = true
this.countersignLink = false
this.dialogList.comment = ''
req.getPreviousNodesForReject({ taskDefKey: this.current.taskDefKey, businessSid: this.linkByParameter.businessSid }).then((resp) => {
if (resp.success) {
var arr = resp.data
this.nextNode = arr[0]
this.nodeDialogVisible = true
}
this.submitdisabled = false
})
},
// 终止
openStop(val) {
this.operation = val
this.currentLink = false
this.countersignLink = false
this.dialogList.comment = ''
this.nodeDialogVisible = true
},
reject() {
if (this.operation === '同意') {
this.handleAgree()
} else if (this.operation === '驳回') {
if (this.dialogList.comment === '') {
this.$message({ showClose: true, type: 'error', message: '请填写审批意见' })
} else {
this.handleReject()
}
} else if (this.operation === '终止') {
if (this.dialogList.comment === '') {
this.$message({ showClose: true, type: 'error', message: '请填写审批意见' })
} else {
this.handleStop()
}
} else if (this.operation === '加签') {
this.handleCountersign()
}
},
/** 加签 */
handleCountersign() {
if (this.countersign.assignee === '') {
this.$message({ showClose: true, type: 'error', message: '请选择加签人员' })
return
}
if (this.dialogList.comment === '') {
this.$message({ showClose: true, type: 'error', message: '请填写审批意见' })
return
}
this.countersign.views = this.dialogList.comment
req.delegate(this.countersign).then((response) => {
if (response.success) {
this.$notify({
title: '提示',
message: '执行成功',
type: 'success',
duration: 2000
})
this.nodeDialogVisible = false
// 子页面向父级页面传递值
window.parent.postMessage({
cmd: 'returnHeight',
params: {
// 操作成功,告诉父级页面关闭弹框
code: 1
}
}, '*')
}
})
},
/** 同意任务 */
handleAgree() {
this.linkByParameter.comment = this.dialogList.comment
req.complete(this.linkByParameter).then((response) => {
if (response.success) {
this.$notify({
title: '提示',
message: '执行成功',
type: 'success',
duration: 2000
})
this.nodeDialogVisible = false
// 子页面向父级页面传递值
window.parent.postMessage({
cmd: 'returnHeight',
params: {
// 操作成功,告诉父级页面关闭弹框
code: 1
}
}, '*')
}
})
},
/** 驳回任务 */
handleReject() {
this.linkByParameter.comment = this.dialogList.comment
req.reject(this.linkByParameter).then((response) => {
if (response.success) {
this.$notify({
title: '提示',
message: '执行成功',
type: 'success',
duration: 2000
})
this.nodeDialogVisible = false
// 子页面向父级页面传递值
window.parent.postMessage({
cmd: 'returnHeight',
params: {
// 操作成功,告诉父级页面关闭弹框
code: 1
}
}, '*')
}
})
},
/** 终止任务 */
handleStop() {
this.linkByParameter.comment = this.dialogList.comment
req.breakProcess(this.linkByParameter).then((response) => {
if (response.success) {
this.$notify({
title: '提示',
message: '执行成功',
type: 'success',
duration: 2000
})
this.nodeDialogVisible = false
// 子页面向父级页面传递值
window.parent.postMessage({
cmd: 'returnHeight',
params: {
// 操作成功,告诉父级页面关闭弹框
code: 1
}
}, '*')
}
})
}
}
}
</script>
<style scoped>
.span-sty {
width: 130px !important;
}
.addinputInfo {
margin-left: 120px !important;
}
.rowClass{
border-top: 1px solid #E0E3EB;
}
</style>