|
@@ -8,10 +8,30 @@
|
|
返回列表
|
|
返回列表
|
|
</a>
|
|
</a>
|
|
</template>
|
|
</template>
|
|
- <!-- <template slot="extra">
|
|
|
|
- <a-button key="3" id="salesReturnDetail-preview-btn">打印预览</a-button>
|
|
|
|
- <a-button key="4" type="primary" id="salesReturnDetail-print-btn">快速打印</a-button>
|
|
|
|
- </template> -->
|
|
|
|
|
|
+ <!-- 操作区,位于 title 行的行尾 -->
|
|
|
|
+ <template slot="extra">
|
|
|
|
+ <a-button
|
|
|
|
+ key="3"
|
|
|
|
+ type="primary"
|
|
|
|
+ class="button-error"
|
|
|
|
+ id="salesReturnEdit-preview-btn"
|
|
|
|
+ :disabled="chooseLoadData.length==0"
|
|
|
|
+ @click="handlePrint('preview')">打印预览</a-button>
|
|
|
|
+ <a-button
|
|
|
|
+ key="2"
|
|
|
|
+ type="primary"
|
|
|
|
+ class="button-info"
|
|
|
|
+ id="salesReturnEdit-print-btn"
|
|
|
|
+ :disabled="chooseLoadData.length==0"
|
|
|
|
+ @click="handlePrint('print')">快捷打印</a-button>
|
|
|
|
+ <a-button
|
|
|
|
+ key="1"
|
|
|
|
+ type="primary"
|
|
|
|
+ class="button-warning"
|
|
|
|
+ id="salesReturnEdit-export-btn"
|
|
|
|
+ :disabled="chooseLoadData.length==0"
|
|
|
|
+ @click="handlePrint('export')">导出Excel</a-button>
|
|
|
|
+ </template>
|
|
</a-page-header>
|
|
</a-page-header>
|
|
<!-- 基础信息 -->
|
|
<!-- 基础信息 -->
|
|
<a-card size="small" :bordered="false" class="salesReturnDetail-cont">
|
|
<a-card size="small" :bordered="false" class="salesReturnDetail-cont">
|
|
@@ -73,14 +93,17 @@
|
|
</a-spin>
|
|
</a-spin>
|
|
<!-- 审核 -->
|
|
<!-- 审核 -->
|
|
<auditModal :openModal="visibleAudit" :spinning="spinningAudit" @close="visibleAudit=false" @ok="auditOrder('WAIT_CHECK')" @fail="auditOrder('AUDIT_REJECT')" />
|
|
<auditModal :openModal="visibleAudit" :spinning="spinningAudit" @close="visibleAudit=false" @ok="auditOrder('WAIT_CHECK')" @fail="auditOrder('AUDIT_REJECT')" />
|
|
|
|
+ <!-- 打印 -->
|
|
|
|
+ <div id="print"></div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
|
+import moment from 'moment'
|
|
import { getOperationalPrecision } from '@/libs/tools.js'
|
|
import { getOperationalPrecision } from '@/libs/tools.js'
|
|
import { STable, VSelect } from '@/components'
|
|
import { STable, VSelect } from '@/components'
|
|
import auditModal from '@/views/common/auditModal.vue'
|
|
import auditModal from '@/views/common/auditModal.vue'
|
|
-import { salesReturnDetail, salesReturnAudit } from '@/api/salesReturn'
|
|
|
|
|
|
+import { salesReturnDetail, salesReturnAudit, salesReturnPrint, salesReturnExport } from '@/api/salesReturn'
|
|
import { salesReturnDetailList } from '@/api/salesReturnDetail'
|
|
import { salesReturnDetailList } from '@/api/salesReturnDetail'
|
|
export default {
|
|
export default {
|
|
name: 'SalesReturnDetail',
|
|
name: 'SalesReturnDetail',
|
|
@@ -181,10 +204,12 @@ export default {
|
|
// 折后退货金额小计 由于数据库内小数位数为4位,页面则需显示2位。因此会做小数运算精度处理
|
|
// 折后退货金额小计 由于数据库内小数位数为4位,页面则需显示2位。因此会做小数运算精度处理
|
|
data.list[i].saleReturnSubtotal = getOperationalPrecision(data.list[i].price, data.list[i].qty)
|
|
data.list[i].saleReturnSubtotal = getOperationalPrecision(data.list[i].price, data.list[i].qty)
|
|
}
|
|
}
|
|
|
|
+ this.chooseLoadData = data.list
|
|
this.disabled = false
|
|
this.disabled = false
|
|
return data
|
|
return data
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
+ chooseLoadData: [],
|
|
detailData: null, // 详情数据
|
|
detailData: null, // 详情数据
|
|
visibleAudit: false,
|
|
visibleAudit: false,
|
|
spinningAudit: false
|
|
spinningAudit: false
|
|
@@ -226,6 +251,60 @@ export default {
|
|
this.detailData = null
|
|
this.detailData = null
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
+ },
|
|
|
|
+ // 打印预览/快捷打印
|
|
|
|
+ handlePrint (type) {
|
|
|
|
+ const _this = this
|
|
|
|
+ _this.spinning = true
|
|
|
|
+ let url = salesReturnPrint
|
|
|
|
+ if (type == 'export') {
|
|
|
|
+ url = salesReturnExport
|
|
|
|
+ }
|
|
|
|
+ url({ sn: this.$route.params.sn }).then(res => {
|
|
|
|
+ _this.spinning = false
|
|
|
|
+ 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 {
|
|
|
|
+ if (type == 'export') {
|
|
|
|
+ this.download(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()
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ download (data) {
|
|
|
|
+ if (!data) { return }
|
|
|
|
+ const url = window.URL.createObjectURL(new Blob([data]))
|
|
|
|
+ const link = document.createElement('a')
|
|
|
|
+ link.style.display = 'none'
|
|
|
|
+ link.href = url
|
|
|
|
+ const a = moment().format('YYYYMMDDHHmmss')
|
|
|
|
+ const fname = '销售退货' + a
|
|
|
|
+ link.setAttribute('download', fname + '.xlsx')
|
|
|
|
+ document.body.appendChild(link)
|
|
|
|
+ link.click()
|
|
}
|
|
}
|
|
},
|
|
},
|
|
mounted () {
|
|
mounted () {
|