Forráskód Böngészése

修复打印小票码信息

zhh 3 éve
szülő
commit
1e8b57f133

+ 10 - 0
kmall-admin/src/main/java/com/kmall/admin/dao/vip/Mall2MemberConsumptionRecordsDao.java

@@ -2,6 +2,7 @@ package com.kmall.admin.dao.vip;
 
 import com.kmall.admin.entity.vip.Mall2MemberConsumptionRecordsEntity;
 import com.kmall.manager.dao.BaseDao;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * 会员消费记录表Dao
@@ -12,4 +13,13 @@ import com.kmall.manager.dao.BaseDao;
  */
 public interface Mall2MemberConsumptionRecordsDao extends BaseDao<Mall2MemberConsumptionRecordsEntity> {
 
+    /**
+     * 根据订单编号orderSn查询对象
+     *
+     * @author zhuhh
+     * @param orderSn 订单编号
+     * @return
+     */
+    Mall2MemberConsumptionRecordsEntity queryObjectByOrderSn(@Param("orderSn") String orderSn);
+
 }

+ 7 - 1
kmall-admin/src/main/java/com/kmall/admin/service/impl/OrderServiceImpl.java

@@ -552,10 +552,14 @@ public class OrderServiceImpl implements OrderService {
                     goodsTax.toString(),
                     orderGoods.getNumber().toString(),
                     new BigDecimal(orderGoods.getNumber()).multiply(orderGoods.getRetailPrice()).setScale(2, RoundingMode.HALF_UP).toString(),
-                    orderGoods.getDiscountedPrice().toString());
+                    orderGoods.getDiscountedPrice().toString(),
+                    orderGoods.getRetailPrice().subtract(orderGoods.getDiscountedPrice()).setScale(2, RoundingMode.HALF_UP).toString()
+                    );
             goodsList.add(goods);
         }
 
+        // 订单积分详情
+        Mall2MemberConsumptionRecordsEntity memberConsumptionRecordsEntity = memberConsumptionRecordsDao.queryObjectByOrderSn(orderEntity.getOrderSn());
         // 收银信息
         CashInfo cashInfo = new CashInfo();
         cashInfo.setGoodsTotal(goodsTotal.toString());
@@ -566,6 +570,8 @@ public class OrderServiceImpl implements OrderService {
         cashInfo.setCoupon(orderEntity.getCouponPrice().setScale(2, BigDecimal.ROUND_HALF_UP).toString());
         cashInfo.setFreight(
                 new BigDecimal(orderEntity.getFreightPrice()).setScale(2, BigDecimal.ROUND_HALF_UP).toString());
+        cashInfo.setDeductionScore(memberConsumptionRecordsEntity.getDeductionScore());
+        cashInfo.setScoreDeductionPrice(memberConsumptionRecordsEntity.getScoreDeductionPrice().toString());
         if ("alipay".equals(orderEntity.getPayFlag())) {
             cashInfo.setPaymentMode("支付宝支付");
         } else {

+ 27 - 0
kmall-admin/src/main/resources/mybatis/mapper/vip/Mall2MemberConsumptionRecordsDao.xml

@@ -110,6 +110,33 @@
 		</if>
 	</select>
 
+	<select id="queryObjectByOrderSn"
+			resultType="com.kmall.admin.entity.vip.Mall2MemberConsumptionRecordsEntity">
+		select
+			`mmcr_id`,
+			`user_id`,
+			`order_sn`,
+			`consumption_time`,
+			`shop_sn`,
+			`is_use_birthday_offer`,
+			`creater_sn`,
+			`create_time`,
+			`moder_sn`,
+			`mod_time`,
+			`tstm`,
+			`deduction_score`,
+			`member_code`,
+			`member_phone`,
+			`order_total_price`,
+			`score_deduction_price`,
+			`score_limit`,
+			`before_score`,
+			`after_score`,
+			`order_gift_score`
+		from mall2_member_consumption_records
+		where `order_sn` = #{orderSn}
+	</select>
+
 	<insert id="save" parameterType="com.kmall.admin.entity.vip.Mall2MemberConsumptionRecordsEntity" useGeneratedKeys="true" keyProperty="id">
 		insert into mall2_member_consumption_records(
 			`mmcr_id`,

+ 13 - 3
kmall-admin/src/main/webapp/js/sale/sale.js

@@ -1564,6 +1564,7 @@ function getPrintContentOrder(ticket, callback) {
     content += "<td style=\"width: 40%;text-align: left;font-size: 10px;font-weight: bold;\">商品名称</td>";
     content += "<td style=\"width: 17%;text-align: right;font-size: 10px;font-weight: bold;\">单价</td>";
     content += "<td style=\"width: 17%;text-align: right;font-size: 10px;font-weight: bold;\">优惠</td>";
+    content += "<td style=\"width: 17%;text-align: right;font-size: 10px;font-weight: bold;\">优惠后单价</td>";
     // content += "<td style=\"width: 16%;text-align: right;font-size: 10px;font-weight: bold;\">税费</td>";
     content += "<td style=\"width: 15%;text-align: right;font-size: 10px;font-weight: bold;\">数量</td>";
     content += "<td style=\"width: 18%;text-align: right;font-size: 10px;font-weight: bold;\">小计</td>";
@@ -1583,6 +1584,7 @@ function getPrintContentOrder(ticket, callback) {
         content += "</td>";
         content += "<td style=\"width: 17%;text-align: right;font-size: 8px;vertical-align:bottom;padding-top: 8px;\">" + ticket.goods[i].uprice + "</td>";
         content += "<td style=\"width: 17%;text-align: right;font-size: 8px;vertical-align:bottom;padding-top: 8px;\">" + ticket.goods[i].discountPrice + "</td>";
+        content += "<td style=\"width: 17%;text-align: right;font-size: 8px;vertical-align:bottom;padding-top: 8px;\">" + ticket.goods[i].afterDiscountPrice + "</td>";
         // content += "<td style=\"width: 17%;text-align: right;font-size: 8px;vertical-align:bottom;padding-top: 8px;\">" + ticket.goods[i].taxation + "</td>";
         content += "<td style=\"width: 15%;text-align: center;font-size: 8px;vertical-align:bottom;padding-top: 8px;\">" + ticket.goods[i].num + "</td>";
         content += "<td style=\"width: 18%;text-align: right;font-size: 8px;vertical-align:bottom;padding-top: 8px;\">" + ticket.goods[i].subtotal + "</td>";
@@ -1597,10 +1599,18 @@ function getPrintContentOrder(ticket, callback) {
     content += "<span style=\"float: left;width: 17%;text-align: left;\">" + ticket.cashInfo.goodsTotal + "件</span>";
     content += "<span style=\"float: right;width: 33%;text-align: right;\">" + ticket.cashInfo.total + "元</span>";
     content += "</div>";
+    // content += "<div style=\"width: 100%;\">";
+    // content += "<span style=\"float: left;width: 50%;text-align: left;\">税费合计:</span>";
+    // content += "<span style=\"float: left;width: 17%;text-align: left;\">" + ticket.cashInfo.goodsTotal + "件</span>";
+    // content += "<span style=\"float: right;width: 33%;text-align: right;\">" + ticket.cashInfo.taxTotal + "元</span>";
+    // content += "</div>";
     content += "<div style=\"width: 100%;\">";
-    content += "<span style=\"float: left;width: 50%;text-align: left;\">税费合计:</span>";
-    content += "<span style=\"float: left;width: 17%;text-align: left;\">" + ticket.cashInfo.goodsTotal + "件</span>";
-    content += "<span style=\"float: right;width: 33%;text-align: right;\">" + ticket.cashInfo.taxTotal + "元</span>";
+    content += "<span style=\"float: left;width: 50%;text-align: left;\">积分抵扣合计:</span>";
+    content += "<span style=\"float: right;width: 50%;text-align: right;\">" + ticket.cashInfo.deductionScore + "分</span>";
+    content += "</div>";
+    content += "<div style=\"width: 100%;\">";
+    content += "<span style=\"float: left;width: 50%;text-align: left;\">积分抵扣金额:</span>";
+    content += "<span style=\"float: right;width: 50%;text-align: right;\">" + ticket.cashInfo.scoreDeductionPrice + "元</span>";
     content += "</div>";
     content += "<div style=\"width: 100%;\">";
     content += "<span style=\"float: left;width: 50%;text-align: left;\">优惠合计:</span>";

+ 26 - 0
kmall-common/src/main/java/com/kmall/common/utils/print/ticket/item/CashInfo.java

@@ -36,6 +36,16 @@ public class CashInfo implements Serializable {
     // 支付方式名称
     private String paymentMode;
 
+    /**
+     * 积分抵扣合计
+     */
+    private Integer deductionScore;
+
+    /**
+     * 积分抵扣金额
+     */
+    private String scoreDeductionPrice;
+
 
     public String getTotal() {
         return total;
@@ -116,4 +126,20 @@ public class CashInfo implements Serializable {
     public void setPaymentMode(String paymentMode) {
         this.paymentMode = paymentMode;
     }
+
+    public Integer getDeductionScore() {
+        return deductionScore;
+    }
+
+    public void setDeductionScore(Integer deductionScore) {
+        this.deductionScore = deductionScore;
+    }
+
+    public String getScoreDeductionPrice() {
+        return scoreDeductionPrice;
+    }
+
+    public void setScoreDeductionPrice(String scoreDeductionPrice) {
+        this.scoreDeductionPrice = scoreDeductionPrice;
+    }
 }

+ 21 - 0
kmall-common/src/main/java/com/kmall/common/utils/print/ticket/item/Goods.java

@@ -25,6 +25,8 @@ public class Goods implements Serializable {
     private String subtotal;
     // 优惠金额
     private String discountPrice;
+    // 优惠后金额
+    private String afterDiscountPrice;
 
 
     public Goods(String gname, String uprice, String taxation, String num, String subtotal) {
@@ -44,6 +46,16 @@ public class Goods implements Serializable {
         this.discountPrice = discountPrice;
     }
 
+    public Goods(String gname, String uprice, String taxation, String num, String subtotal,String discountPrice, String afterDiscountPrice) {
+        this.gname = gname;
+        this.uprice = uprice;
+        this.taxation = taxation;
+        this.num = num;
+        this.subtotal = subtotal;
+        this.discountPrice = discountPrice;
+        this.afterDiscountPrice = afterDiscountPrice;
+    }
+
 
     public String getGname() {
         return gname;
@@ -93,6 +105,14 @@ public class Goods implements Serializable {
         this.discountPrice = discountPrice;
     }
 
+    public String getAfterDiscountPrice() {
+        return afterDiscountPrice;
+    }
+
+    public void setAfterDiscountPrice(String afterDiscountPrice) {
+        this.afterDiscountPrice = afterDiscountPrice;
+    }
+
     @Override
     public String toString() {
         return "Goods{" +
@@ -101,6 +121,7 @@ public class Goods implements Serializable {
                 ", taxation='" + taxation + '\'' +
                 ", num='" + num + '\'' +
                 ", subtotal='" + subtotal + '\'' +
+                ", afterDiscountPrice='" + afterDiscountPrice + '\'' +
                 '}';
     }
 }