Commit 470036ca authored by dragondean@qq.com's avatar dragondean@qq.com

重新适配订单详情的查看提单

parent a16d9863
......@@ -231,7 +231,7 @@ export function downloadByOrderId(orderId) {
url: "/shipment/make-bill-of-lading/downloadByOrderId",
method: "get",
params: { orderId },
responseType: "arraybuffer",
/* responseType: "arraybuffer", */
});
}
......
......@@ -4,9 +4,10 @@
<i class="el-icon-loading" slot="icon" style="font-size: 40px" />
</el-result>
<pdf-viewer id="pdfViewer" ref="viewer" v-if="pdfData" :url="pdfData" style="display:block; margin: 0 auto; max-height: 80vh; overflow:auto;" />
<!-- <div v-if="detail" class="billcontent" v-html="detail.billContent"></div> -->
<p class="subs" style="text-align:center">
<el-button type="primary" @click="download" :disabled="!pdfData">{{$t('下载')}}</el-button>
<el-button type="primary" @click="print" :disabled="!pdfData">{{$t('打印')}}</el-button>
<el-button type="primary" @click="download" :disabled="!detail">{{$t('下载')}}</el-button>
<el-button type="primary" @click="print" :disabled="!detail">{{$t('打印')}}</el-button>
</p>
</el-dialog>
</template>
......@@ -17,7 +18,7 @@ import lodop from '@/utils/lodop'
import PdfViewer from '@/components/PdfViewer'
import FileSaver from 'file-saver'
import {downloadByOrderId} from '@/api/ecw/box'
import html2canvas from 'html2canvas'
export default {
components: {PdfViewer},
filters: {parseTime},
......@@ -34,9 +35,19 @@ export default {
billLadingNo: 'TD20220717',
type: 1, */
pdfData: null,
detail: null,
loading: false
}
},
watch:{
detail(){
/* this.pdfData = this.detail.imgUrl */
fetch(this.detail.imgUrl).then(async response => {
console.log(response)
this.pdfData = await response.arrayBuffer()
})
}
},
computed:{
title(){
let t = this.$t('提货单')
......@@ -59,9 +70,9 @@ export default {
loadData(){
this.loading = true
downloadByOrderId(this.orderId)
.then(arrayBuffer => {
console.log({arrayBuffer})
this.pdfData = arrayBuffer
.then(res => {
this.detail = res.data
/* this.pdfData = arrayBuffer */
})
.finally(() => {
this.loading = false
......@@ -71,9 +82,10 @@ export default {
this.show = false
this.$emit('close');
},
download(){
let blob = new Blob([this.pdfData], {type: "application/pdf"})
FileSaver.saveAs(blob, this.title + '.pdf');
FileSaver.saveAs(blob, this.title + '.pdf');
},
print(){
lodop().then(LODOP => {
......@@ -82,6 +94,7 @@ export default {
LODOP.SET_PRINT_STYLE("Bold",1);
LODOP.SET_PRINT_PAGESIZE(0);
LODOP.SET_PRINT_PAGESIZE(0,2100,2970,"A4");
// html2canvas(document.querySelector('.billcontent'))
let dataURLs = this.$refs.viewer.getDataURLs()
console.log(dataURLs)
for(let page in dataURLs){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment