|
@@ -5,7 +5,34 @@
|
|
|
<a href="javascript:;" @click="handleBack"><a-icon type="left"></a-icon> 返回列表</a>
|
|
|
</template>
|
|
|
<template slot="extra">
|
|
|
- <a-button key="4" type="primary" id="salesDetail-print-btn">快速打印</a-button>
|
|
|
+ <a-button
|
|
|
+ key="4"
|
|
|
+ type="primary"
|
|
|
+ class="button-error"
|
|
|
+ id="salesDetail-xs-print-btn"
|
|
|
+ :disabled="localDataSource.length==0"
|
|
|
+ @click="handlePrint('SALES_BILL')">销售打印</a-button>
|
|
|
+ <a-button
|
|
|
+ key="3"
|
|
|
+ type="primary"
|
|
|
+ class="button-info"
|
|
|
+ id="salesDetail-xsfl-print-btn"
|
|
|
+ :disabled="localDataSource.length==0"
|
|
|
+ @click="handlePrint('SALES_BILL_TYPE')">销售分类打印</a-button>
|
|
|
+ <a-button
|
|
|
+ key="2"
|
|
|
+ type="primary"
|
|
|
+ class="button-success"
|
|
|
+ id="salesDetail-fhdy-print-btn"
|
|
|
+ :disabled="localDataSource.length==0"
|
|
|
+ @click="handlePrint('DISPATCH_BILL')">发货打印</a-button>
|
|
|
+ <a-button
|
|
|
+ key="1"
|
|
|
+ type="primary"
|
|
|
+ class="button-warning"
|
|
|
+ id="salesDetail-fhfl-print-btn"
|
|
|
+ :disabled="localDataSource.length==0"
|
|
|
+ @click="handlePrint('DISPATCH_BILL_TYPE')">发货分类打印</a-button>
|
|
|
</template>
|
|
|
</a-page-header>
|
|
|
<!-- 基础信息 -->
|
|
@@ -51,15 +78,20 @@
|
|
|
</template>
|
|
|
</s-table>
|
|
|
</a-card>
|
|
|
+ <!-- 分类打印 -->
|
|
|
+ <choose-type-modal :openModal="openModal" @ok="handleOk" @close="openModal=false" />
|
|
|
+ <!-- 打印 -->
|
|
|
+ <div id="print"></div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import { STable, VSelect } from '@/components'
|
|
|
-import { dispatchDetaillList, dispatchFindBySn } from '@/api/dispatch'
|
|
|
+import chooseTypeModal from './chooseTypeModal.vue'
|
|
|
+import { dispatchDetaillList, dispatchFindBySn, dispatchDetailPrint } from '@/api/dispatch'
|
|
|
export default {
|
|
|
name: 'SalesDetail',
|
|
|
- components: { STable, VSelect },
|
|
|
+ components: { STable, VSelect, chooseTypeModal },
|
|
|
data () {
|
|
|
return {
|
|
|
disabled: false,
|
|
@@ -98,28 +130,76 @@ export default {
|
|
|
data.list[i].productOrigCode = productOrigCode == ' ' ? '--' : productOrigCode
|
|
|
data.list[i].productOrigUnit = productOrigUnit || '--'
|
|
|
}
|
|
|
+ this.localDataSource = data.list
|
|
|
this.disabled = false
|
|
|
return data
|
|
|
})
|
|
|
},
|
|
|
- detailData: null // 详情数据
|
|
|
+ detailData: null, // 详情数据
|
|
|
+ openModal: false,
|
|
|
+ localDataSource: [],
|
|
|
+ nowPrintType: '' // 当前打印类型
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
// 返回
|
|
|
handleBack () {
|
|
|
- this.$router.back()
|
|
|
+ this.$router.push({ path: '/salesManagement/pushOrderManagement/list' })
|
|
|
},
|
|
|
// 详情
|
|
|
getDetail () {
|
|
|
dispatchFindBySn({ dispatchBillSn: this.$route.params.sn }).then(res => {
|
|
|
- console.log(res.data)
|
|
|
if (res.status == 200) {
|
|
|
this.detailData = res.data
|
|
|
} else {
|
|
|
this.detailData = null
|
|
|
}
|
|
|
})
|
|
|
+ },
|
|
|
+ // 分类选择
|
|
|
+ handleOk (type) {
|
|
|
+ this.requestFun({ productTypeSn2: type })
|
|
|
+ },
|
|
|
+ // 打印预览/快捷打印
|
|
|
+ handlePrint (type) {
|
|
|
+ this.nowPrintType = type
|
|
|
+ if (type == 'SALES_BILL' || type == 'DISPATCH_BILL') { // 销售打印/发货打印
|
|
|
+ this.requestFun()
|
|
|
+ } else if (type == 'SALES_BILL_TYPE' || type == 'DISPATCH_BILL_TYPE') { // 销售分类打印/发货分类打印
|
|
|
+ this.openModal = true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ requestFun (productType) {
|
|
|
+ const _this = this
|
|
|
+ const params = {
|
|
|
+ type: this.nowPrintType,
|
|
|
+ dispatchBillSn: this.$route.params.sn
|
|
|
+ }
|
|
|
+ dispatchDetailPrint(Object.assign(params, productType || {})).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)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ print (data) {
|
|
|
+ this.spinLoading = false
|
|
|
+ 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>'
|
|
|
+ window.frames['printf'].focus()
|
|
|
+ window.frames['printf'].print()
|
|
|
}
|
|
|
},
|
|
|
mounted () {
|