|
@@ -5,12 +5,15 @@
|
|
|
<template slot="subTitle">
|
|
|
<a id="salesEdit-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
|
|
|
<span style="margin: 0 15px;color: #666;">客户名称:{{ detailData&&detailData.buyerName }}</span>
|
|
|
- <!-- <a-button id="salesEdit-edit-btn" size="small" @click="handleEdit" style="margin-left:10px" key="0">编辑</a-button> -->
|
|
|
</template>
|
|
|
<!-- 操作区,位于 title 行的行尾 -->
|
|
|
<template slot="extra">
|
|
|
- <a-button key="2" id="salesEdit-preview-btn">打印预览</a-button>
|
|
|
- <a-button key="1" type="primary" id="salesEdit-print-btn">快速打印</a-button>
|
|
|
+ <a-radio-group key="3" v-model="printerType">
|
|
|
+ <a-radio value="INK">针式</a-radio>
|
|
|
+ <a-radio value="NEEDLE">喷墨</a-radio>
|
|
|
+ </a-radio-group>
|
|
|
+ <a-button key="2" id="salesEdit-preview-btn" :disabled="dataSource.length==0" @click="handlePrint('preview')">打印预览</a-button>
|
|
|
+ <a-button key="1" type="primary" id="salesEdit-print-btn" :disabled="dataSource.length==0" @click="handlePrint('print')">快捷打印</a-button>
|
|
|
</template>
|
|
|
</a-page-header>
|
|
|
<a-card size="small" :bordered="false" class="salesEdit-cont">
|
|
@@ -58,7 +61,7 @@
|
|
|
</a-col>
|
|
|
<a-col :span="6">
|
|
|
<div style="float:right;overflow: hidden;">
|
|
|
- <a-button size="small" id="salesEdit-dru">导入明细</a-button>
|
|
|
+ <!-- <a-button size="small" id="salesEdit-dru">导入明细</a-button> -->
|
|
|
<a-button
|
|
|
size="small"
|
|
|
type="primary"
|
|
@@ -77,7 +80,7 @@
|
|
|
:rowKey="(record) => record.id"
|
|
|
:columns="columns"
|
|
|
:data="loadData"
|
|
|
- :scroll="{ x: 1560, y: 300 }"
|
|
|
+ :scroll="{ x: 1940, y: 300 }"
|
|
|
:rowClassName="(record, index) => record.cost > record.price ? 'redBg-row':''"
|
|
|
bordered>
|
|
|
<!-- 产品编码 -->
|
|
@@ -136,6 +139,8 @@
|
|
|
</a-affix>
|
|
|
<!-- 选择客户弹框 -->
|
|
|
<choose-custom-modal ref="custModal" :show="openModal" @updateData="updateData" @cancel="openModal=false" />
|
|
|
+ <!-- 打印 -->
|
|
|
+ <div id="print"></div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -143,7 +148,7 @@
|
|
|
import { STable, VSelect } from '@/components'
|
|
|
import queryPart from './queryPart.vue'
|
|
|
import chooseCustomModal from './chooseCustomModal.vue'
|
|
|
-import { salesDetail, salesWriteSubmit, salesWriteDiscount } from '@/api/sales'
|
|
|
+import { salesDetail, salesWriteSubmit, salesWriteDiscount, salesDetailPrint } from '@/api/sales'
|
|
|
import EditableCell from '@/views/common/editInput.js'
|
|
|
import { salesDetailList, salesDetailInsert, salesDetailUpdatePrice, salesDetailUpdateQty, salesDetailDel, salesDetailDelAll } from '@/api/salesDetail'
|
|
|
export default {
|
|
@@ -166,18 +171,18 @@ export default {
|
|
|
// 表头
|
|
|
columns: [
|
|
|
{ title: '序号', dataIndex: 'no', width: 80, align: 'center' },
|
|
|
- { title: '产品编码', dataIndex: 'dealerProductEntity.code', scopedSlots: { customRender: 'productCode' }, width: 140, align: 'center', sorter: true },
|
|
|
- { title: '产品名称', dataIndex: 'dealerProductEntity.name', align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '原厂编码', dataIndex: 'dealerProductEntity.origCode', width: 140, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
- { title: '品牌', dataIndex: 'dealerProductEntity.productBrandName', width: 100, align: 'center', sorter: true, customRender: function (text) { return text || '--' } },
|
|
|
- { title: '仓库', dataIndex: 'warehouseEntity.name', width: 100, align: 'center', sorter: true, customRender: function (text) { return text || '--' } },
|
|
|
- { title: '仓位', dataIndex: 'warehouseLocationEntity.name', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '产品编码', dataIndex: 'dealerProductEntity.code', scopedSlots: { customRender: 'productCode' }, width: 220, align: 'center', sorter: true },
|
|
|
+ { title: '产品名称', dataIndex: 'dealerProductEntity.name', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
|
|
|
+ { title: '原厂编码', dataIndex: 'dealerProductEntity.origCode', width: 220, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '品牌', dataIndex: 'dealerProductEntity.productBrandName', width: 200, align: 'center', sorter: true, customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '仓库', dataIndex: 'warehouseEntity.name', width: 150, align: 'center', sorter: true, customRender: function (text) { return text || '--' } },
|
|
|
+ { title: '仓位', dataIndex: 'warehouseLocationEntity.name', width: 150, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
{ title: '售价', dataIndex: 'price', scopedSlots: { customRender: 'price' }, width: 150, align: 'center' },
|
|
|
{ title: '销售数量', scopedSlots: { customRender: 'salesNums' }, width: 150, align: 'center' },
|
|
|
{ title: '单位', dataIndex: 'dealerProductEntity.unit', width: 100, align: 'center', customRender: function (text) { return text || '--' } },
|
|
|
{ title: '售价小计', dataIndex: 'totalAmount', width: 100, align: 'center', customRender: function (text) { return '¥' + (text || 0) } },
|
|
|
{ title: '折后小计', dataIndex: 'discountedAmount', width: 100, align: 'center', customRender: function (text) { return '¥' + (text || 0) } },
|
|
|
- { title: '操作', scopedSlots: { customRender: 'action' }, width: 170, align: 'center', fixed: 'right' }
|
|
|
+ { title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center', fixed: 'right' }
|
|
|
],
|
|
|
// 加载数据方法 必须为 Promise 对象
|
|
|
loadData: parameter => {
|
|
@@ -193,7 +198,8 @@ export default {
|
|
|
this.dataSource = data.list
|
|
|
return data
|
|
|
})
|
|
|
- }
|
|
|
+ },
|
|
|
+ printerType: 'INK' // 打印机类型
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
@@ -229,6 +235,38 @@ export default {
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
+ // 打印预览/快捷打印
|
|
|
+ handlePrint (type) {
|
|
|
+ const _this = this
|
|
|
+ salesDetailPrint({ sn: this.$route.params.sn, type: this.printerType }).then(res => {
|
|
|
+ if (res.type == 'application/json') {
|
|
|
+ var reader = new FileReader()
|
|
|
+ reader.addEventListener('loadend', function () {
|
|
|
+ const obj = JSON.parse(reader.result)
|
|
|
+ _this.$notification.error({
|
|
|
+ message: '提示',
|
|
|
+ description: obj.message
|
|
|
+ })
|
|
|
+ })
|
|
|
+ reader.readAsText(res)
|
|
|
+ } else {
|
|
|
+ this.print(res, type)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ print (data, type) {
|
|
|
+ if (!data) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const url = window.URL.createObjectURL(new Blob([data], { type: 'application/pdf' }))
|
|
|
+ document.getElementById('print').innerHTML = '<iframe id="printf" name="printf" src="' + url + '" hidden></iframe>'
|
|
|
+ if (type == 'preview') { // 预览
|
|
|
+ window.open(url)
|
|
|
+ } else if (type == 'print') { // 打印
|
|
|
+ window.frames['printf'].focus()
|
|
|
+ window.frames['printf'].print()
|
|
|
+ }
|
|
|
+ },
|
|
|
// 编辑客户信息
|
|
|
handleEdit () {
|
|
|
this.openModal = true
|