diff --git a/yxt-as-ui/src/views/operation/salesticket/salesticket.vue b/yxt-as-ui/src/views/operation/salesticket/salesticket.vue index b1b5eaf370..a09cc62103 100644 --- a/yxt-as-ui/src/views/operation/salesticket/salesticket.vue +++ b/yxt-as-ui/src/views/operation/salesticket/salesticket.vue @@ -86,6 +86,8 @@ + + @@ -96,6 +98,9 @@ import ButtonBar from '@/components/ButtonBar' import req from '@/api/operation/salesticket' import salesticketAdd from './salesticketAdd' import salesticketInfo from './salesticketInfo' +import salesSettlementAdd from '@/views/operation/salesSettlement/salesSettlementAdd' +import {getStorage} from "@/utils/auth"; +import {getOrgSidByPath} from "@/api/Common/dictcommons"; export default { name: 'SalesTicket', @@ -104,7 +109,8 @@ export default { pageye, ButtonBar, salesticketAdd, - salesticketInfo + salesticketInfo, + salesSettlementAdd }, data() { return { @@ -124,6 +130,20 @@ export default { btnKey: 'doDel', btnLabel: '删除' }, + { + type: 'primary', + size: 'small', + icon: '', + btnKey: 'toSettle', + btnLabel: '结算' + }, + { + type: 'primary', + size: 'small', + icon: '', + btnKey: 'toPrint', + btnLabel: '打印结算单' + }, { type: 'info', size: 'small', @@ -189,6 +209,12 @@ export default { case 'doDel': this.doDel() break + case 'toSettle': + this.toSettle() + break + case 'toPrint': + this.toPrint() + break case 'doClose': this.doClose() break @@ -298,6 +324,56 @@ export default { }).catch(() => { }) }, + toSettle() { + if (this.sids.length === 1) { + req.settle(this.sids[0]).then((res) => { + if (res.success) { + this.viewState = 5 + this.$refs['divSettle'].showAdd({ sid: this.sids[0] }) + } else { + this.$message({ showClose: true, type: 'error', message: res.msg }) + } + }) + } else { + this.$message({ showClose: true, type: 'error', message: '请选择一条记录进行操作' }) + } + }, + toPrint() { + if (this.sids.length === 1) { + var createOrgSid = '' + getOrgSidByPath({ orgPath: window.sessionStorage.getItem('defaultOrgPath') }).then((res) => { + if (res.success) { + createOrgSid = res.data + } + }) + req.printSmsBill({ sid: this.sids[0], userSid: window.sessionStorage.getItem('userSid'), createOrgSid: createOrgSid, useOrgSid: window.sessionStorage.getItem('defaultOrgPath').substring(window.sessionStorage.getItem('defaultOrgPath').lastIndexOf('/') + 1) }).then((res) => { + if (res.success) { + var xhr = new XMLHttpRequest() + xhr.open('GET', process.env.VUE_APP_BASE_API + '/base/file/download?filePath=' + res.data + '&outFileName=' + '销售结算单', true) + xhr.setRequestHeader('token', getStorage()) + xhr.responseType = 'blob' + xhr.onload = function(e) { + // 如果请求执行成功 + var blob = this.response + var filename = '销售结算单.pdf' + var a = document.createElement('a') + // blob.type="application/octet-stream"; + // 创键临时url对象 + var url = URL.createObjectURL(blob) + a.href = url + a.download = filename + a.click() + // 释放之前创建的URL对象 + window.URL.revokeObjectURL(url) + } + // 发送请求 + xhr.send() + } + }) + } else { + this.$message({ showClose: true, type: 'error', message: '请选择一条记录进行操作' }) + } + }, // 修改、编辑、详情返回列表页面 resetState() { this.viewState = 1 diff --git a/yxt-as-ui/src/views/operation/salesticket/salesticketAdd.vue b/yxt-as-ui/src/views/operation/salesticket/salesticketAdd.vue index d9bd022ff3..8ca0808ba0 100644 --- a/yxt-as-ui/src/views/operation/salesticket/salesticketAdd.vue +++ b/yxt-as-ui/src/views/operation/salesticket/salesticketAdd.vue @@ -6,8 +6,6 @@
选择客户 保存 - 结算 - 打印 关闭
@@ -202,71 +200,6 @@ - - - - - -
*付款人姓名
- -
- -
付款人编号
- -
- -
应收金额
- {{ ysjeTotal }} -
-
- - -
订金抵扣
- -
- -
*结算方式
- - - - - -
- -
*结算金额
- -
-
- - -
其他结算方式
- - - - - -
- -
其他结算金额
- -
- -
欠款金额
- {{ qkjeTotal }} -
-
- - -
*结算时间
- -
-
-
-
- 确 定 - 取 消 -
-
@@ -289,11 +222,8 @@ export default { submitdisabled: false, user_list: [], // 销售人员 subject_list: [], // 科目 - settleVisible: false, // 结算弹框 invoiceType_list: [], // 发票类型 companyInvoicing_list: [], // 开票单位 - settle_list: [], // 结算方式 - otherSettle_list: [], // 其他结算方式 activeNames: '1', index: 0, // commodity商品 @@ -430,12 +360,6 @@ export default { let ysje = '0' ysje = Math.round((parseFloat(ysje) + parseFloat(this.jeTotal) - parseFloat(this.yhTotal)) * 100) / 100 return ysje - }, - // 结算页面中计算欠款金额 = 应付金额 - 订金抵扣 - 结算金额 - 其他结算金额 - qkjeTotal() { - let qkje = '0' - qkje = Math.round((parseFloat(this.ysjeTotal) - parseFloat(this.formobj.settlementVo.depositdeductAmount !== '' ? this.formobj.settlementVo.depositdeductAmount : '0') - parseFloat(this.formobj.settlementVo.settleAmount !== '' ? this.formobj.settlementVo.settleAmount : '0') - parseFloat(this.formobj.settlementVo.otherSettleAmount !== '' ? this.formobj.settlementVo.otherSettleAmount : '0')) * 100) / 100 - return qkje } }, methods: { @@ -450,16 +374,6 @@ export default { this.companyInvoicing_list = res.data } }) - typeValues({ type: 'settle' }).then((res) => { - if (res.success) { - this.settle_list = res.data - } - }) - typeValues({ type: 'otherSettle' }).then((res) => { - if (res.success) { - this.otherSettle_list = res.data - } - }) selSubjectInfo({ useOrgSid: window.sessionStorage.getItem('defaultOrgPath').substring(window.sessionStorage.getItem('defaultOrgPath').lastIndexOf('/') + 1) }).then((resp) => { if (resp.success) { this.subject_list = resp.data @@ -786,84 +700,6 @@ export default { } }) }, - settleAccounts() { - this.settleVisible = true - }, - settleChange(value) { - const choose = this.settle_list.filter((item) => item.dictValue === value) - if (choose.length > 0 && choose !== null) { - this.formobj.settlementVo.settleKey = choose[0].dictKey - } else { - this.formobj.settlementVo.settleKey = '' - } - }, - otherSettleChange(value) { - const choose = this.otherSettle_list.filter((item) => item.dictValue === value) - if (choose.length > 0 && choose !== null) { - this.formobj.settlementVo.otherSettleKey = choose[0].dictKey - } else { - this.formobj.settlementVo.otherSettleKey = '' - } - }, - confirm() { - this.$refs['form_obj'].validate((valid) => { - if (valid) { - if (this.formobj.customerName === '') { - this.$message({ showClose: true, type: 'error', message: '客户信息不能为空' }) - return - } - if (this.formobj.goodsVos.length === 0) { - this.$message({ showClose: true, type: 'error', message: '商品列表不能为空' }) - return - } - this.formobj.receivableAmount = this.ysjeTotal - this.formobj.discountAmount = this.yhTotal - this.formobj.goodsAmount = this.clfTotal // 材料费 - this.formobj.addAmount = this.fjfTotal // 附加费 - this.submitdisabled = true - req.settle(this.formobj).then((res) => { - if (res.success) { - this.$message({ showClose: true, type: 'success', message: '结算成功' }) - this.handleReturn('true') - } else { - this.submitdisabled = false - } - }).catch(() => { - this.submitdisabled = false - }) - } - }) - }, - print() { - if (this.formobj.sid !== '') { - req.printSmsBill({ sid: this.formobj.sid, userSid: this.formobj.createBySid, createOrgSid: this.formobj.createOrgSid, useOrgSid: this.formobj.deptSid }).then((res) => { - if (res.success) { - var xhr = new XMLHttpRequest() - xhr.open('GET', process.env.VUE_APP_BASE_API + '/base/file/download?filePath=' + res.data + '&outFileName=' + '销售单', true) - xhr.setRequestHeader('token', getStorage()) - xhr.responseType = 'blob' - xhr.onload = function(e) { - // 如果请求执行成功 - var blob = this.response - var filename = '销售单.pdf' - var a = document.createElement('a') - // blob.type="application/octet-stream"; - // 创键临时url对象 - var url = URL.createObjectURL(blob) - a.href = url - a.download = filename - a.click() - // 释放之前创建的URL对象 - window.URL.revokeObjectURL(url) - } - // 发送请求 - xhr.send() - } - }) - } else { - this.$message({ showClose: true, type: 'error', message: '请保存相关信息后在进行打印' }) - } - }, resetState() { this.viewState = 1 }, @@ -928,7 +764,6 @@ export default { } this.commodityData = [] this.subjoinData = [] - this.settleVisible = false this.submitdisabled = false this.$emit('doback') }