123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357 |
- <!DOCTYPE html>
- <html>
- <head>
- <title>二级市场订单表-电子交易协议</title>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
- <!-- 所有的 css js 资源 -->
- <link rel="stylesheet" href="https://unpkg.com/element-ui@2.13.0/lib/theme-chalk/index.css">
- <link rel="stylesheet" href="../../static/sa.css">
- <script src="../../static/kj/vue.min.js"></script>
- <script src="../../static/kj/element-ui/index.js"></script>
- <script src="../../static/kj/httpVueLoader.js"></script>
- <script src="../../static/kj/jquery.min.js"></script>
- <script src="../../static/kj/layer/layer.js"></script>
- <script src="../../static/sa.js"></script>
- <script src="../../static/kj/upload-util.js"></script>
- <!-- 引入 html2canvas 和 jsPDF -->
- <script src="../../static/kj/html2canvas.min.js"></script>
- <script src="../../static/kj/jspdf.umd.min.js"></script>
- <style type="text/css">
- .c-panel .c-label{width: 8em;}
- table {
- font-family: arial, sans-serif;
- border-collapse: collapse;
- width: 90%;
- margin-top: 20px ;
- margin-left: auto;
- margin-right: auto;
- }
- th {
- border: 1px solid darkgray;
- text-align: left;
- height: 24px;
- padding: 8px;
- background-color: #dddddd;
- }
- td {
- border: 1px solid darkgray;
- text-align: left;
- padding: 8px;
- }
- </style>
- </head>
- <body>
- <div class="vue-box sbot" style="display: none;" :style="'display: block;'">
- <!-- ------- 内容部分 ------- -->
- <div class="s-body">
- <div class="c-panel" id="content-to-convert" ref="contentToConvert">
- <el-form v-if="m">
- <table>
- <tr>
- <td colspan='6' style="text-align:center;font-weight: bold; border: 0 0 1px 0; " >电子交易协议</td>
- </tr>
- <tr>
- <td colspan='6' style="font-weight: bold;" >一、交易信息</td>
- </tr>
- <tr>
- <th>订单编号</th>
- <td colspan='2'>{{m.orderNo}}</td>
- <th>结算单号</th>
- <td colspan='2'>{{m.settleBillNo}}</td>
- </tr>
- <tr>
- <th>交易日期</th>
- <td colspan='2'>{{m.payTime}}</td>
- <th>交货日期</th>
- <td colspan='2'></td>
- </tr>
- <tr>
- <th>银行流水号</th>
- <td colspan='5'>{{m.result}}</td>
- </tr>
- <tr>
- <th>商品名称</th>
- <th>数量</th>
- <th>重量(KG)</th>
- <th>单价(元)</th>
- <th>合计(元)</th>
- <th>备注</th>
- </tr>
- <tr>
- <td>{{m.goodsName}}</td>
- <td>{{m.buyQty}}</td>
- <td>{{m.netWet}}</td>
- <td>{{m.singlePrice}}</td>
- <td>{{m.resalePrice}}</td>
- <td>含税价</td>
- </tr>
- <tr>
- <td>合计</td>
- <td>{{m.buyQty}}</td>
- <td>{{m.netWet}}</td>
- <td>{{m.singlePrice}}</td>
- <td>{{m.resalePrice}}</td>
- <td>含税价</td>
- </tr>
- <tr>
- <td colspan='6'>合计金额人民币(大写):{{convertToChineseNumeral(m.resalePrice)}}</td>
- </tr>
- <tr>
- <td colspan='6' style="font-weight: bold;" >二、卖方信息</td>
- </tr>
- <tr>
- <th>卖方</th>
- <td colspan='2'>{{m.businessName}}</td>
- <th>联系人</th>
- <td colspan='2'>{{m.contacts}}</td>
- </tr>
- <tr>
- <th>开户行</th>
- <td colspan='2'>{{m.peopleBankName}}</td>
- <th>联系方式</th>
- <td colspan='2'>{{m.phone}}</td>
- </tr>
- <tr>
- <th>银行账号</th>
- <td colspan='2'>{{m.peopleBankCode}}</td>
- <th>统一信用代码</th>
- <td colspan='2'>{{m.peopleDutyParagraph}}</td>
- </tr>
- <tr>
- <td colspan='6' style="font-weight: bold;" >三、买方信息</td>
- </tr>
- <tr>
- <th>买方</th>
- <td colspan='2' v-if="m.purchaserBusinessName">{{m.purchaserBusinessName}}</td>
- <td colspan='2' v-else>{{m.purchaserName}}</td>
- <th>联系人</th>
- <td colspan='2' v-if="m.legalPerson">{{m.legalPerson}}</td>
- <td colspan='2' v-else>{{m.purchaserName}}</td>
- </tr>
- <tr>
- <th>开户行</th>
- <td colspan='2'>{{m.purchaserBankName}}</td>
- <th>联系方式</th>
- <td colspan='2'>{{m.purchaserContact}}</td>
- </tr>
- <tr>
- <th>银行账号</th>
- <td colspan='2'>{{m.purchaserBankAccount}}</td>
- <th>统一信用代码</th>
- <td colspan='2'>{{m.purchaserDutyParagraph}}</td>
- </tr>
- <tr>
- <td colspan='6' style="font-weight: bold;" >四、其它信息</td>
- </tr>
- <tr>
- <th>交货地点</th>
- <td colspan='5'>{{m.unloadingAddress}}</td>
- </tr>
- <tr>
- <th>提货方式</th>
- <td colspan='5'></td>
- </tr>
- <tr>
- <th>付款方式</th>
- <td colspan='5'></td>
- </tr>
- <tr>
- <th>发票类型</th>
- <td colspan='5'></td>
- </tr>
- <tr>
- <th>其它约定</th>
- <td colspan='5'></td>
- </tr>
- <tr>
- <th>补充说明</th>
- <td colspan='5'></td>
- </tr>
- <tr>
- <td colspan='3'>
- 卖方:{{m.businessName}} <br>
- 法定代表人或授权委托人:{{m.contacts}}
- </td>
- <td colspan='3'>
- <span>
- <span v-if="m.purchaserBusinessName">买方:{{m.purchaserBusinessName}}<br></span>
- <span v-else>买方:{{m.purchaserName}}<br></span>
- </span>
- <span>
- <span v-if="m.legalPerson">法定代表人或授权委托人:{{m.legalPerson}}</span>
- <span v-else>法定代表人或授权委托人:{{m.purchaserName}}</span>
- </span>
- </td>
- </tr>
- </table>
- </el-form>
- </div>
- </div>
- <!-- ------- 底部按钮 ------- -->
- <div class="s-foot">
- <el-button type="success" icon="el-icon-printer" @click="htmlToPdf()">打印协议</el-button>
- <el-button type="primary" icon="el-icon-download" @click="downloadToPdf()">下载协议</el-button>
- <el-button @click="sa.closeCurrIframe()">关闭</el-button>
- </div>
- </div>
- <script>
- var app = new Vue({
- components: {
- "sa-info": httpVueLoader('../../sa-frame/com/sa-info.vue')
- },
- el: '.vue-box',
- data: {
- id: sa.p('id', 0), // 获取数据ID
- m: null
- },
- methods: {
- downloadToPdf() {
- const element = document.getElementById('content-to-convert');
- html2canvas(element).then(canvas => {
- // 使用 jsPDF 将 canvas 转换成 PDF
- const imgData = canvas.toDataURL('image/png');
- const pdf = new jspdf.jsPDF({
- orientation: 'portrait',
- unit: 'px',
- format: 'a4'
- });
- const imgProps = pdf.getImageProperties(imgData);
- const pdfWidth = pdf.internal.pageSize.getWidth();
- const pdfHeight = (imgProps.height * pdfWidth) / imgProps.width;
- // 添加图片,适应页面大小
- pdf.addImage(imgData, 'PNG', 0, 0, pdfWidth, pdfHeight);
- pdf.save(Date.now()+'.pdf');
- });
- },
- htmlToPdf() {
- const element = document.getElementById('content-to-convert');
- html2canvas(element).then(canvas => {
- // 使用 jsPDF 将 canvas 转换成 PDF
- const imgData = canvas.toDataURL('image/png');
- const pdf = new jspdf.jsPDF({
- orientation: 'portrait',
- unit: 'px',
- format: 'a4'
- });
- const imgProps = pdf.getImageProperties(imgData);
- const pdfWidth = pdf.internal.pageSize.getWidth();
- const pdfHeight = (imgProps.height * pdfWidth) / imgProps.width;
- // 添加图片,适应页面大小
- pdf.addImage(imgData, 'PNG', 0, 0, pdfWidth, pdfHeight);
- // 将 PDF 保存为 Blob 并处理它 这里需要处理跨域问题
- const pdfBlob = pdf.output('blob');
- var blobURL = window.URL.createObjectURL(pdfBlob);
- var newWindow = window.open(blobURL, '_blank');
- if (newWindow) {
- newWindow.focus();
- } else {
- alert('请允许弹出窗口或在新标签页中手动查看 PDF。');
- }
- });
- },
- convertToChineseNumeral(money) {
- // 汉字的数字
- const cnNums = ['零','壹','贰','叁','肆','伍','陆','柒','捌','玖']
- // 基本单位
- const cnIntRadice = ['', '拾', '佰', '仟']
- // 对应整数部分扩展单位
- const cnIntUnits = ['', '万', '亿', '兆']
- // 对应小数部分单位
- const cnDecUnits = ['角', '分', '毫', '厘']
- // 整数金额时后面跟的字符
- const cnInteger = '整'
- // 整型完以后的单位
- const cnIntLast = '圆'
- // 最大处理的数字
- const maxNum = 999999999999999.9999
- // 金额整数部分
- let integerNum
- // 金额小数部分
- let decimalNum
- // 输出的中文金额字符串
- let chineseStr = ''
- // 分离金额后用的数组,预定义
- let parts
- if (money == '') {
- return ''
- }
- money = parseFloat(money)
- if (money >= maxNum) {
- // 超出最大处理数字
- return ''
- }
- if (money == 0) {
- chineseStr = cnNums[0] + cnIntLast + cnInteger
- return chineseStr
- }
- // 转换为字符串
- money = money.toString()
- if (money.indexOf('.') == -1) {
- integerNum = money
- decimalNum = ''
- } else {
- parts = money.split('.')
- integerNum = parts[0]
- decimalNum = parts[1].substr(0, 4)
- }
- // 获取整型部分转换
- if (parseInt(integerNum, 10) > 0) {
- let zeroCount = 0
- const IntLen = integerNum.length
- for (let i = 0; i < IntLen; i++) {
- const n = integerNum.substr(i, 1)
- const p = IntLen - i - 1
- const q = p / 4
- const m = p % 4
- if (n == '0') {
- zeroCount++
- } else {
- if (zeroCount > 0) {
- chineseStr += cnNums[0]
- }
- // 归零
- zeroCount = 0
- chineseStr += cnNums[parseInt(n)] + cnIntRadice[m]
- }
- if (m == 0 && zeroCount < 4) {
- chineseStr += cnIntUnits[q]
- }
- }
- chineseStr += cnIntLast
- }
- // 小数部分
- if (decimalNum != '') {
- const decLen = decimalNum.length
- for (let i = 0; i < decLen; i++) {
- const n = decimalNum.substr(i, 1)
- if (n != '0') {
- chineseStr += cnNums[Number(n)] + cnDecUnits[i]
- }
- }
- }
- if (chineseStr == '') {
- chineseStr += cnNums[0] + cnIntLast + cnInteger
- } else if (decimalNum == '') {
- chineseStr += cnInteger
- }
- return chineseStr
- }
- },
- mounted: function() {
- sa.ajax('/level-two-server/TbOrders/getSubEmail?id=' + this.id, function(res) {
- this.m = res.data;
- if(res.data == null) {
- sa.alert('未能查找到 id=' + this.id + " 详细数据");
- }
- }.bind(this))
- }
- })
- </script>
- </body>
- </html>
|