|
@@ -509,6 +509,7 @@ let vm = new Vue({
|
|
|
q: {
|
|
|
name: ''
|
|
|
},
|
|
|
+ firstPrint:false,
|
|
|
// 第二件半价
|
|
|
halfPrice:new Map(),
|
|
|
|
|
@@ -660,6 +661,8 @@ let vm = new Vue({
|
|
|
}
|
|
|
var goods = this.goodsList[i];
|
|
|
console.log(goods);
|
|
|
+ console.log(vm.totalPrice);
|
|
|
+
|
|
|
vm.totalPrice = vm.totalPrice - (goods.retailPrice * goods.sellVolume);
|
|
|
vm.discountedPrice = vm.discountedPrice - goods.discountedPrice;
|
|
|
vm.actualPrice = vm.actualPrice - goods.actualPaymentAmount;
|
|
@@ -959,7 +962,7 @@ let vm = new Vue({
|
|
|
// printArea(r.ticket);
|
|
|
var content = getPrintContentOrder(r.ticket);
|
|
|
printArea(content);
|
|
|
- alert('打印小票完成');
|
|
|
+
|
|
|
}else{
|
|
|
alert("打印小票失败");
|
|
|
}
|
|
@@ -1069,7 +1072,7 @@ var printAreaCount = 0;
|
|
|
function printArea(content) {
|
|
|
var idPrefix = "printArea_";
|
|
|
removePrintArea(idPrefix + printAreaCount);
|
|
|
- printAreaCount++;
|
|
|
+ ++printAreaCount;
|
|
|
var iframeId = idPrefix + printAreaCount;
|
|
|
var iframeStyle = 'width:0px;height:0px;left:0px;top:0px;';
|
|
|
iframe = document.createElement('IFRAME');
|
|
@@ -1080,21 +1083,27 @@ function printArea(content) {
|
|
|
document.body.appendChild(iframe);
|
|
|
var doc = iframe.contentWindow.document;
|
|
|
doc.open();
|
|
|
- //$(document).find("link").filter(function () {
|
|
|
- //return $(this).attr("rel").toLowerCase() == "stylesheet";
|
|
|
- //}).each(
|
|
|
- //function () {
|
|
|
- //doc.write('<link type="text/css" rel="stylesheet" href="'
|
|
|
- //+ $(this).attr("href") + '" >');
|
|
|
- //});
|
|
|
doc.write('<div class="">' + content
|
|
|
+ '</div>');
|
|
|
doc.close();
|
|
|
var frameWindow = iframe.contentWindow;
|
|
|
- frameWindow.close();
|
|
|
- frameWindow.focus();
|
|
|
- // frameWindow.print();
|
|
|
- frameWindow.print();
|
|
|
+ if(!vm.firstPrint){
|
|
|
+ setTimeout(function() {
|
|
|
+ frameWindow.close();
|
|
|
+ frameWindow.focus();
|
|
|
+ frameWindow.print();
|
|
|
+ frameWindow.print();
|
|
|
+ alert('打印小票完成');
|
|
|
+ },250);
|
|
|
+ vm.firstPrint = true;
|
|
|
+ }else{
|
|
|
+ frameWindow.close();
|
|
|
+ frameWindow.focus();
|
|
|
+ frameWindow.print();
|
|
|
+ frameWindow.print();
|
|
|
+ alert('打印小票完成');
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
function printArea2(content) {
|
|
@@ -1111,13 +1120,6 @@ function printArea2(content) {
|
|
|
document.body.appendChild(iframe);
|
|
|
var doc = iframe.contentWindow.document;
|
|
|
doc.open();
|
|
|
- //$(document).find("link").filter(function () {
|
|
|
- //return $(this).attr("rel").toLowerCase() == "stylesheet";
|
|
|
- //}).each(
|
|
|
- //function () {
|
|
|
- //doc.write('<link type="text/css" rel="stylesheet" href="'
|
|
|
- //+ $(this).attr("href") + '" >');
|
|
|
- //});
|
|
|
doc.write('<div class="">' + content
|
|
|
+ '</div>');
|
|
|
doc.close();
|
|
@@ -1231,7 +1233,7 @@ function parsedate(value){
|
|
|
function getPrintContentOrder(ticket) {
|
|
|
var content = "<div style=\"width: 250px;font-family: 微软雅黑;font-size: 8px;\">";
|
|
|
// 打印ogo
|
|
|
- content += "<div style=\"text-align: center;width: 100%;height: 100px;\">";
|
|
|
+ content += "<div style=\"text-align: center;width: 100%;height: 260px;\">";
|
|
|
content += "<img src='/statics/img/cw_logo2.png' style='width: 100%;height: 100%;' />";
|
|
|
content += "</div>";
|
|
|
//小票头
|
|
@@ -1342,13 +1344,6 @@ function getPrintContentOrder(ticket) {
|
|
|
content += "1、凡购买跨境商品均不提供发票;<br> 2、单笔限购5000元,年交易限额2.6万元; <br> 3、所有订单经海关放行后方可提货; <br> 4、凭小票领取您的订单商品。"
|
|
|
content += "</div>";
|
|
|
content += "<div style=\"width: 100%;overflow:hidden;white-space: nowrap;\">--------------------------------------------------</div>";
|
|
|
- content += "<div style=\"width: 100%;text-align: center;\">";
|
|
|
- content += "退换货须知:"
|
|
|
- content += "</div>";
|
|
|
- content += "<div style=\"width: 100%;\">";
|
|
|
- content += "请您当面核对小票,清点商品,在原包装完好,未拆封、无破损、原始小票等所有物件完全且不影响二次销售的情况下,支持七天无理由退货。食品(含保健品)为特殊商品,非质量原因不退换,希望您能谅解!"
|
|
|
- content += "</div>";
|
|
|
- content += "<div style=\"width: 100%;overflow:hidden;white-space: nowrap;\">--------------------------------------------------</div>";
|
|
|
content += "<div style=\"width: 100%;\">";
|
|
|
// content += ticket.ticketFoot.summary;
|
|
|
content += "</div>";
|
|
@@ -1362,17 +1357,17 @@ function getPrintContentOrder(ticket) {
|
|
|
content += ticket.ticketFoot.welcome;
|
|
|
content += "</div>";
|
|
|
content += "<div style=\"width: 100%;\">";
|
|
|
- content += "惠州市惠城区港惠新天地负一层";
|
|
|
+ content += "惠州市惠城区港惠购物中心负一层";
|
|
|
content += "</div>";
|
|
|
content += "<div style=\"width: 100%;\">";
|
|
|
- content += "请当面清点所购商品,并保管好收银小票以做退换货凭证。";
|
|
|
+ content += "请保管好收银小票。";
|
|
|
content += "</div>";
|
|
|
// 打印二维码
|
|
|
content += "<div style=\"text-align: center;width: 100%;height: 250px;\">";
|
|
|
content += "<img src='/statics/img/cw_qrcode.png' style='width: 100%;height: 100%;' />";
|
|
|
content += "</div>";
|
|
|
content += "<div style=\"width: 100%;text-align: center;\">";
|
|
|
- content += "全球精选,品质生活"
|
|
|
+ content += "关注CW大药房客服号,获取更多优惠信息"
|
|
|
content += "</div>";
|
|
|
return content;
|
|
|
}
|