Explorar el Código

会员提交订单part1

Aslee hace 3 años
padre
commit
8a30a571f1

+ 3 - 0
src/main/java/com/caimei/modules/bulkpurchase/dao/PurchaseProductDao.java

@@ -5,6 +5,7 @@ import com.thinkgem.jeesite.common.persistence.CrudDao;
 import com.thinkgem.jeesite.common.persistence.Page;
 import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
 import com.caimei.modules.bulkpurchase.entity.PurchaseProduct;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -29,4 +30,6 @@ public interface PurchaseProductDao extends CrudDao<PurchaseProduct> {
     Integer findCount(String contractId );
 
     List<ProductLadderPrice> findLadderPriceList(Long productId);
+
+    Integer checkSvipProduct(@Param("productId") Long productId, @Param("userId") Integer userId);
 }

+ 60 - 0
src/main/java/com/caimei/modules/bulkpurchase/entity/PurchaseProduct.java

@@ -64,6 +64,26 @@ public class PurchaseProduct extends DataEntity<PurchaseProduct> {
     private String oldProductFlag;//是否是旧商品 0否 1是
     private String commodityType; //商品属性:1产品,2仪器
     private Integer couponsLogo;    //显示优惠券查看: 1不显示 2显示
+    /**
+     * 超级会员优惠价格标识:0不是,1是
+     */
+    private Integer svipPriceFlag;
+    /**
+     * 超级会员优惠价类型:1折扣价,2直接优惠价
+     */
+    private Integer svipPriceType;
+    /**
+     * 超级会员折扣
+     */
+    private Double svipDiscount;
+    /**
+     * 超级会员优惠价
+     */
+    private Double svipDiscountPrice;
+    /**
+     * 超级会员优惠
+     */
+    private Double svipReduction;
 
     public Integer getLadderPriceFlag() {
         return ladderPriceFlag;
@@ -458,4 +478,44 @@ public class PurchaseProduct extends DataEntity<PurchaseProduct> {
     public void setCouponsLogo(Integer couponsLogo) {
         this.couponsLogo = couponsLogo;
     }
+
+    public Integer getSvipPriceFlag() {
+        return svipPriceFlag;
+    }
+
+    public void setSvipPriceFlag(Integer svipPriceFlag) {
+        this.svipPriceFlag = svipPriceFlag;
+    }
+
+    public Integer getSvipPriceType() {
+        return svipPriceType;
+    }
+
+    public void setSvipPriceType(Integer svipPriceType) {
+        this.svipPriceType = svipPriceType;
+    }
+
+    public Double getSvipDiscount() {
+        return svipDiscount;
+    }
+
+    public void setSvipDiscount(Double svipDiscount) {
+        this.svipDiscount = svipDiscount;
+    }
+
+    public Double getSvipDiscountPrice() {
+        return svipDiscountPrice;
+    }
+
+    public void setSvipDiscountPrice(Double svipDiscountPrice) {
+        this.svipDiscountPrice = svipDiscountPrice;
+    }
+
+    public Double getSvipReduction() {
+        return svipReduction;
+    }
+
+    public void setSvipReduction(Double svipReduction) {
+        this.svipReduction = svipReduction;
+    }
 }

+ 4 - 0
src/main/java/com/caimei/modules/bulkpurchase/service/PurchaseProductService.java

@@ -80,4 +80,8 @@ public class PurchaseProductService extends CrudService<PurchaseProductDao, Purc
 	public List<ProductLadderPrice> findLadderPriceList(Long productId){
 	    return purchaseProductDao.findLadderPriceList(productId);
 	}
+
+    public Integer checkSvipProduct(Long productId, Integer userId) {
+        return purchaseProductDao.checkSvipProduct(productId, userId);
+    }
 }

+ 18 - 2
src/main/java/com/caimei/modules/bulkpurchase/web/PurchaseProductController.java

@@ -129,7 +129,20 @@ public class PurchaseProductController extends BaseController {
                     p.setSupplierTaxRate(p.getTaxRate());
                     p.setOldProductFlag("1");
                 }
-                if (null != cmPromotion) {
+                // 初始化超级会员优惠
+                p.setSvipReduction(0d);
+                if (1 == p.getSvipPriceFlag()) {
+                    if (1 == p.getSvipPriceType()) {
+                        p.setSvipDiscountPrice(MathUtil.div(MathUtil.mul(new Double(p.getPrice()), p.getSvipDiscount()), 100, 2).doubleValue());
+                    }
+                    // 商品的超级会员优惠=原价-超级会员优惠价
+                    p.setSvipReduction(MathUtil.sub(p.getPrice(), new Double(p.getPrice())).doubleValue());
+                    if ("0".equals(p.getIncludedTax()) && ("1".equals(p.getInvoiceType()) || "2".equals(p.getInvoiceType()))) {
+                        // 计算优惠的税费
+                        BigDecimal taxReduction = MathUtil.div(MathUtil.mul(p.getSvipReduction(), p.getTaxRate()), 100);
+                        p.setSvipReduction(MathUtil.add(p.getSvipReduction(), taxReduction).doubleValue());
+                    }
+                } else if (null != cmPromotion) {
                     p.setCmPromotion(cmPromotion);
                     p.setLadderPriceFlag(0);
                 } else {
@@ -312,8 +325,11 @@ public class PurchaseProductController extends BaseController {
             purchaseProduct.setLadderPriceFlag(0);
             Product product = productDao.get(purchaseProduct.getProductId().toString());
             if (product != null) {
+                Integer svipPriceFlag = purchaseProductService.checkSvipProduct(purchaseProduct.getProductId(), purchaseProduct.getUserId());
                 CmPromotion productPromotion = cmPromotionService.findProductPromotion(product.getShopID().toString(), Long.parseLong(product.getProductID().toString()));
-                if (productPromotion != null) {
+                if (null != svipPriceFlag && 1 == svipPriceFlag) {
+                    purchaseProduct.setSvipPriceFlag(1);
+                } else if (productPromotion != null) {
                     purchaseProduct.setCmPromotion(productPromotion);
                 } else {
                     if ("1".equals(product.getLadderPriceFlag())) {

+ 9 - 0
src/main/java/com/caimei/modules/order/entity/NewOrder.java

@@ -139,6 +139,7 @@ public class NewOrder extends DataEntity<NewOrder> {
     private Integer clubCouponId;
     private Double couponAmount;    //优惠券抵扣金额
     private CmCouponOrderRecord couponOrderRecord;    //优惠券信息
+    private Double svipFullReduction;   //超级会员优惠
 
     public Integer getClubCouponId() {
         return clubCouponId;
@@ -1050,5 +1051,13 @@ public class NewOrder extends DataEntity<NewOrder> {
     public void setCouponOrderRecord(CmCouponOrderRecord couponOrderRecord) {
         this.couponOrderRecord = couponOrderRecord;
     }
+
+    public Double getSvipFullReduction() {
+        return svipFullReduction;
+    }
+
+    public void setSvipFullReduction(Double svipFullReduction) {
+        this.svipFullReduction = svipFullReduction;
+    }
 }
 

+ 27 - 0
src/main/java/com/caimei/modules/order/entity/NewOrderProduct.java

@@ -113,6 +113,9 @@ public class NewOrderProduct extends DataEntity<NewOrderProduct> {
     private Integer ladderPriceFlag;        // 启用阶梯价格标识 0否 1是
     private Integer couponsLogo;        //显示优惠券查看: 1不显示 2显示
     private String commodityType;//商品属性:1产品,2仪器
+    private Integer svipPriceFlag;//超级会员优惠价格标识:0不是,1是
+    private Integer svipPriceType;//超级会员优惠价类型:1折扣价,2直接优惠价
+    private Double svipDiscount;//超级会员折扣
 
     public Integer getLadderPriceFlag() {
         return ladderPriceFlag;
@@ -962,4 +965,28 @@ public class NewOrderProduct extends DataEntity<NewOrderProduct> {
     public void setCommodityType(String commodityType) {
         this.commodityType = commodityType;
     }
+
+    public Integer getSvipPriceFlag() {
+        return svipPriceFlag;
+    }
+
+    public void setSvipPriceFlag(Integer svipPriceFlag) {
+        this.svipPriceFlag = svipPriceFlag;
+    }
+
+    public Integer getSvipPriceType() {
+        return svipPriceType;
+    }
+
+    public void setSvipPriceType(Integer svipPriceType) {
+        this.svipPriceType = svipPriceType;
+    }
+
+    public Double getSvipDiscount() {
+        return svipDiscount;
+    }
+
+    public void setSvipDiscount(Double svipDiscount) {
+        this.svipDiscount = svipDiscount;
+    }
 }

+ 9 - 0
src/main/java/com/caimei/modules/order/entity/NewShopOrder.java

@@ -86,6 +86,7 @@ public class NewShopOrder extends DataEntity<NewShopOrder> {
     private Integer differenceType; //差价类型:1 少付;2 多付
     private BigDecimal differencePrice;  //补差价金额
     private Integer userBeans; //订单采美豆数量
+    private Double svipShopReduction;   //超级会员优惠
     //-------------        虚拟字段   ----------------------------
     private String shopName;            //供应商
     private String commercialCode;      //分账方,子商户商编
@@ -1111,4 +1112,12 @@ public class NewShopOrder extends DataEntity<NewShopOrder> {
     public void setOrderArchiveId(Integer orderArchiveId) {
         this.orderArchiveId = orderArchiveId;
     }
+
+    public Double getSvipShopReduction() {
+        return svipShopReduction;
+    }
+
+    public void setSvipShopReduction(Double svipShopReduction) {
+        this.svipShopReduction = svipShopReduction;
+    }
 }

+ 5 - 2
src/main/java/com/caimei/modules/order/service/NewOrderService.java

@@ -192,6 +192,7 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
                     }
                 }
             }
+            // 获取
 
             //采购中选中保存的订单商品
             List<NewOrderProduct> orderProducts = newOrder.getOrderProduct();
@@ -290,7 +291,7 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
                             //凑单金额
                             AtomicReference<BigDecimal> poolAmount = new AtomicReference<>(BigDecimal.ZERO);
                             orderProducts.forEach(o -> {
-                                if (o.getDiscount() >= 100d) {
+                                if (o.getDiscount() >= 100d && 0 == o.getSvipPriceFlag()) {
                                     CmPromotion cmPromotion = cmPromotionDao.findProductPromotion(o.getShopID().toString(), o.getProductID().longValue());
                                     if (cmPromotion != null && cmPromotion.getId().equals(promotion.getId())) {
                                         poolAmount.set(MathUtil.add(poolAmount, o.getTotalFee()));
@@ -314,7 +315,7 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
                         CmPromotion cmPromotion = cmPromotionDao.findProductPromotion(o.getShopID().toString(), o.getProductID().longValue());
                         if (null != cmPromotion) {
                             CmPromotion orderPromotions = newOrderDao.getDbPromotionsByOrderId(newOrder.getOrderID(), Integer.valueOf(cmPromotion.getId()));
-                            if (null != orderPromotions) {
+                            if (null != orderPromotions && 0 == o.getSvipPriceFlag()) {
                                 o.setOrderPromotionsId(Integer.valueOf(orderPromotions.getId()));
                             }
                         }
@@ -447,6 +448,8 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
                                 }
                             }
                         }
+                        // 保存超级会员优惠信息
+
                         orderProduct.setOrderID(newOrder.getOrderID());
                         orderProduct.setOrderNo(newOrder.getOrderNo());
                         orderProduct.setShopOrderID(shopOrder.getShopOrderID());

+ 6 - 0
src/main/java/com/caimei/modules/order/utils/OrderUtil.java

@@ -91,6 +91,12 @@ public class OrderUtil {
                 shopOrder.setTotalAmount(o.getTotalFee());
                 shopOrder.setNeedPayAmount(o.getShouldPayFee());
                 shopOrder.setOutStoreNum(0);
+                // 计算超级会员优惠
+                if (1 == o.getSvipPriceFlag()) {
+
+                } else {
+                    shopOrder.setSvipShopReduction(0d);
+                }
                 map.put(o.getShopID(), shopOrder);
                 newShopOrders.add(shopOrder); //在主订单中保存子订单的引用
             }

+ 13 - 1
src/main/resources/mappings/modules/bulkpurchase/PurchaseProductMapper.xml

@@ -47,8 +47,13 @@
 		,a.costCheckFlag costCheckFlag,a.costPrice costPrice,a.costProportional costProportional, a.price0 AS normalPrice
 		,a.ladderPriceFlag as ladderPriceFlag
 		,a.includedTax AS includedTax, a.invoiceType AS invoiceType, a.taxPoint AS taxRate, a.supplierTaxPoint AS supplierTaxRate,
-		a.minBuyNumber AS num, a.commodityType
+		a.minBuyNumber AS num, a.commodityType,
+	    if(csp.id is not null and csu.id is not null,1,0) as svipPriceFlag,
+	    csp.priceType as svipPriceType,csp.discount as svipDiscount,
+	    csp.discountPrice as svipDiscountPrice
 		FROM product a LEFT JOIN shop b ON b.shopID=a.shopID
+	    left join cm_svip_product csp on a.productID = csp.productId
+	    left join cm_svip_user csu on csu.userId = #{userId} and csu.delFlag = '0' and now() <![CDATA[ < ]]> csu.endTime
 		<where>
 			<if test="purchaseProductName != null and purchaseProductName != ''">
 				AND a.name LIKE concat('%',#{purchaseProductName},'%')
@@ -190,4 +195,11 @@
 		AND delFlag = 0
 		ORDER BY ladderNum ASC
 	</select>
+	<select id="checkSvipProduct" resultType="java.lang.Integer">
+		select if(csp.id is not null and csu.id is not null, 1, 0) as svipPriceFlag
+		from cm_svip_product csp
+				 left join cm_svip_user csu
+						   on csu.userId = #{userId} and csu.delFlag = '0' and now() <![CDATA[ < ]]> csu.endTime
+		where csp.productId = #{productId};
+	</select>
 </mapper>

+ 1 - 0
src/main/resources/mappings/modules/product/ProductMapper.xml

@@ -150,6 +150,7 @@
 
 	<sql id="productJoins">
 		LEFT JOIN shop s on s.shopID = a.shopID
+		left join product p on a.productID = p.productId
 	</sql>
 	<sql id="ActivityJoins">
 		LEFT JOIN shop s on s.shopID = a.shopID

+ 28 - 7
src/main/webapp/WEB-INF/views/modules/bulkpurchase/orderPurchaseProductForm.jsp

@@ -124,22 +124,37 @@
             <td id="shopName" title="${purchaseProduct.shopName}">${fns:abbr(purchaseProduct.shopName,10)}</td>
             <td><label id="priceLabel0"
                        style="text-decoration: ${purchaseProduct.cmPromotion.mode eq 1?'line-through':''}">${purchaseProduct.price}</label>
-                <c:if test="${purchaseProduct.includedTax != null and purchaseProduct.includedTax != '' and purchaseProduct.includedTax ne 2}">
-                    <label style="color: red">
-                        (${purchaseProduct.includedTax eq 1?'含税':(purchaseProduct.invoiceType eq 1 or purchaseProduct.invoiceType eq 2)?'不含税-能开票':'不含税-不能开票'})
-                    </label>
-                </c:if>
+                <label style="color: red">
+                    <c:if test="${(purchaseProduct.includedTax != null and purchaseProduct.includedTax != '' and purchaseProduct.includedTax ne 2)
+                         or purchaseProduct.svipPriceFlag eq 1}">
+                        (
+                        <c:if test="${purchaseProduct.svipPriceFlag eq 1}">
+                            超级会员价
+                            <c:if test="${(purchaseProduct.includedTax != null and purchaseProduct.includedTax != '' and purchaseProduct.includedTax ne 2)}">
+                                ,
+                            </c:if>
+                        </c:if>
+                        <c:if test="${(purchaseProduct.includedTax != null and purchaseProduct.includedTax != '' and purchaseProduct.includedTax ne 2)}">
+                            ${purchaseProduct.includedTax eq 1?'含税':(purchaseProduct.invoiceType eq 1 or purchaseProduct.invoiceType eq 2)?'不含税-能开票':'不含税-不能开票'}
+                        </c:if>
+                        )
+                    </c:if>
+                </label>
                 <input type="hidden" id="price0" value="${purchaseProduct.price}"></td>
             <td><input type="text" name="discount" id="discount0"
                        value="${empty purchaseProduct.discount ?100:(purchaseProduct.discount)}"
                        onchange="discountPriceVal(0)"
-            ${(purchaseProduct.productId ge 6060 and purchaseProduct.productId le 6069) or purchaseProduct.ladderPriceFlag eq 1?'readonly="readonly"':''}
+                        ${(purchaseProduct.productId ge 6060 and purchaseProduct.productId le 6069)
+                        or purchaseProduct.ladderPriceFlag eq 1
+                        or purchaseProduct.svipPriceFlag eq 1?'readonly="readonly"':''}
                        style="width: 50px">%
             </td>
             <td><input name="discountPrice" id="discountPrice0"
                        value="${empty purchaseProduct.discount ?(purchaseProduct.price):(purchaseProduct.discount)}"
                        onchange="countDiscount(0)"
-            ${(purchaseProduct.productId ge 6060 and purchaseProduct.productId le 6069) or purchaseProduct.ladderPriceFlag eq 1?'readonly="readonly"':''}
+                        ${(purchaseProduct.productId ge 6060 and purchaseProduct.productId le 6069)
+                        or purchaseProduct.ladderPriceFlag eq 1
+                        or purchaseProduct.svipPriceFlag eq 1?'readonly="readonly"':''}
                        style="width: 80px;text-decoration: ${purchaseProduct.cmPromotion.mode eq 1?'line-through':''}">
                 <c:if test="${purchaseProduct.ladderPriceFlag eq 1}"><br>
                     <a href="javascript:;" class="ladderPrice"><span>阶梯价格</span>
@@ -289,6 +304,12 @@
         <td style="display: none">
             <input name="ctx"  id="ctx0" value="${ctx}" readonly  style="width: 80px">
         </td>
+        <td style="display: none">
+            <input name="originalPrice" id="originalPrice0" value="${purchaseProduct.originalPrice ne null?purchaseProduct.originalPrice:'0'}">
+        </td>
+        <td style="display: none">
+            <input name="svipReduction" id="svipReduction0" value="${purchaseProduct.svipReduction ne null?purchaseProduct.svipReduction:'0'}">
+        </td>
         <%--成本价--%>
         <td style="display: none">
             <input name="costPrice"  id="costPrice${state.index}" value="${purchaseProduct.costPrice}" readonly  style="width: 80px">

+ 32 - 9
src/main/webapp/WEB-INF/views/modules/bulkpurchase/orderPurchaseProductList.jsp

@@ -297,23 +297,40 @@
                 <td title="${purchaseProduct.purchaseProductName}">${fns:abbr(purchaseProduct.purchaseProductName,16)}</td>
                 <td>${purchaseProduct.productNo}</td>
                 <td title="${purchaseProduct.shopName}">${fns:abbr(purchaseProduct.shopName,10)}</td>
-                <td><label id="priceLabel${state.index}" style="text-decoration: ${purchaseProduct.cmPromotion.mode eq 1?'line-through':''}">${purchaseProduct.price}</label>
-                    <c:if test="${purchaseProduct.includedTax != null and purchaseProduct.includedTax != '' and purchaseProduct.includedTax ne 2}">
-                        <label style="color: red">
-                            (${purchaseProduct.includedTax eq 1?'含税':(purchaseProduct.invoiceType eq 1 or purchaseProduct.invoiceType eq 2)?'不含税-能开票':'不含税-不能开票'})
-                        </label>
-                    </c:if>
+                <td>
+                    <label id="priceLabel${state.index}" style="text-decoration: ${purchaseProduct.svipPriceFlag eq 1 or purchaseProduct.cmPromotion.mode eq 1?'line-through':'' }">${purchaseProduct.price}</label>
+                    <label id="svipDiscountPrice${state.index}"  style="display:${purchaseProduct.svipPriceFlag eq 1?'':none}">${purchaseProduct.svipDiscountPrice}</label>
+                    <label style="color: red">
+                        <c:if test="${(purchaseProduct.includedTax != null and purchaseProduct.includedTax != '' and purchaseProduct.includedTax ne 2)
+                         or purchaseProduct.svipPriceFlag eq 1}">
+                            (
+                            <c:if test="${purchaseProduct.svipPriceFlag eq 1}">
+                                超级会员价
+                                <c:if test="${(purchaseProduct.includedTax != null and purchaseProduct.includedTax != '' and purchaseProduct.includedTax ne 2)}">
+                                    ,
+                                </c:if>
+                            </c:if>
+                            <c:if test="${(purchaseProduct.includedTax != null and purchaseProduct.includedTax != '' and purchaseProduct.includedTax ne 2)}">
+                                ${purchaseProduct.includedTax eq 1?'含税':(purchaseProduct.invoiceType eq 1 or purchaseProduct.invoiceType eq 2)?'不含税-能开票':'不含税-不能开票'}
+                            </c:if>
+                            )
+                        </c:if>
+                    </label>
                     <input type="hidden" id="price${state.index}" value="${purchaseProduct.price}"></td>
                 <td><input type="text" name="discount" id="discount${state.index}"
                            value="${empty purchaseProduct.discount ?100:(purchaseProduct.discount)}"
                            onchange="discountPriceVal(${state.index})"
-                           ${(purchaseProduct.productId ge 6060 and purchaseProduct.productId le 6069) or purchaseProduct.ladderPriceFlag eq 1?'readonly="readonly"':''}
+                           ${(purchaseProduct.productId ge 6060 and purchaseProduct.productId le 6069)
+                           or purchaseProduct.ladderPriceFlag eq 1
+                           or purchaseProduct.svipPriceFlag eq 1?'readonly="readonly"':''}
                            style="width: 50px">%
                 </td>
                 <td><input name="discountPrice" id="discountPrice${state.index}"
-                           value="${empty purchaseProduct.discount ?(purchaseProduct.price):(purchaseProduct.discount)}"
+                           value="${empty purchaseProduct.discount ?(purchaseProduct.svipPriceFlag eq 1?purchaseProduct.svipDiscountPrice: purchaseProduct.price):(purchaseProduct.discount)}"
                            onchange="countDiscount(${state.index})"
-                            ${(purchaseProduct.productId ge 6060 and purchaseProduct.productId le 6069) or purchaseProduct.ladderPriceFlag eq 1?'readonly="readonly"':''}
+                            ${(purchaseProduct.productId ge 6060 and purchaseProduct.productId le 6069)
+                            or purchaseProduct.ladderPriceFlag eq 1
+                            or purchaseProduct.svipPriceFlag eq 1?'readonly="readonly"':''}
                            style="width: 80px;text-decoration: ${purchaseProduct.cmPromotion.mode eq 1?'line-through':''}">
                     <c:if test="${purchaseProduct.ladderPriceFlag eq 1}"><br>
                         <a href="javascript:;" class="ladderPrice"><span>阶梯价格</span>
@@ -472,6 +489,12 @@
                 <td style="display: none">
                     <input name="oldProductFlag"  id="oldProductFlag${state.index}" value="${purchaseProduct.oldProductFlag}" readonly  style="width: 80px">
                 </td>
+                <td style="display: none">
+                    <input name="svipReduction" id="svipReduction${state.index}" value="${purchaseProduct.svipReduction}">
+                </td>
+                <td style="display: none">
+                    <input name="svipPriceFlag" id="svipPriceFlag${state.index}" value="${purchaseProduct.svipPriceFlag}">
+                </td>
                 <td>
                     <c:if test="${purchaseProduct.couponsLogo eq 1}">
                         ----

+ 1 - 1
src/main/webapp/WEB-INF/views/modules/newhome/newPageHomeimageList.jsp

@@ -76,7 +76,7 @@
 			<label>标题:</label>
 			<form:input path="title" htmlEscape="false" maxlength="40" class="input-small"/>
 
-			<label>小程序d端状态:</label>
+			<label>小程序端状态:</label>
 			<form:select path="crmEnabledStatus" class="input-small">
 				<form:option value="" label=" "/>
 				<form:options items="${fns:getDictList('enabled_status')}" itemLabel="label" itemValue="value" htmlEscape="false"/>

+ 5 - 2
src/main/webapp/WEB-INF/views/modules/order/orderForm.jsp

@@ -368,6 +368,9 @@
         <td style="text-align:right;">优惠券抵扣:</td>
         <td><span class="couponPrice"><fmt:formatNumber value="${empty order.couponAmount?'0.00':(order.couponAmount)}" pattern="#0.00"/></span>元
             <from:hidden path="couponAmount"/></td>
+        <td style="text-align:right;">超级会员优惠:</td>
+        <td><span class="svipFullReduction"><fmt:formatNumber value="${empty order.svipFullReduction?'0.00':(order.svipFullReduction)}" pattern="#0.00"/></span>元
+          <from:hidden path="svipFullReduction"/></td>
         <td>商品总数</td>
         <td><span class="productCount">${empty order.productCount?'0':(order.productCount)}</span>
             <from:hidden path="productCount" />
@@ -388,7 +391,7 @@
           <input type="button" onclick="setProductTotalFee()" value="确认折扣">
         </td>
         <td>运费</td>
-        <td class="freeDesc" id="freeDesc" colspan="3">
+        <td class="freeDesc" id="freeDesc" colspan="5">
           <form:select id="freePostFlag" path="freePostFlag" class="required" onchange="setFreight()" disabled="${empty order.orderID || order.status eq 0? false:true}">
             <form:option value="0" label="包邮" />
             <form:option value="1" label="不包邮" />
@@ -411,7 +414,7 @@
           <from:hidden path="payTotalFee" />
         </td>
         <td>余额</td>
-        <td colspan="3">
+        <td colspan="5">
           <input id="useBalancePayFee" type="checkbox" ${empty order.orderID || order.status eq 0? '': "disabled='disabled'"} ${empty order.orderID || (order.status eq 0 && order.balancePayFee eq 0)? '': 'checked'} onchange="setProductTotalFee()" />使用账户余额
           <br>(可用余额¥<span id="availableBalance">0.00</span>,当前使用¥<span class="balancePayFee">0.00</span>,剩余¥<span id="surplusBalance">0.00</span>)
           <from:hidden path="balancePayFee" value="${empty order.balancePayFee ?'0.00':(order.balancePayFee)}" cssClass="input-small number" />

+ 25 - 7
src/main/webapp/static/modules/bulkpurchase/orderForm.js

@@ -669,12 +669,13 @@ function editShopProduct(obj) {
     var addedValueTax = (data.addedValueTax == undefined) ? 0 : data.addedValueTax;
     var totalAddedValueTax = (data.totalAddedValueTax == undefined) ? 0 : data.totalAddedValueTax;
     var couponsLogo = (data.couponsLogo == undefined) ? 1 : data.couponsLogo;
+    var svipReduction = (data.svipReduction == undefined) ? 0 : data.svipReduction;
     $.jBox.open("iframe:" + ctx + "/bulkpurchase/purchaseProduct/formOrderProduct?productId=" + productID +
         "&secondHandType=" + secondHandType +
         "&discount=" + discount + "&productCategory=" + productCategory + "&price=" + price + "&includedTax=" +
         includedTax + "&userId=" + userId +
         "&invoiceType=" + invoiceType + "&taxRate=" + taxRate + "&addedValueTax=" + addedValueTax +
-        "&totalAddedValueTax=" + totalAddedValueTax + "&couponsLogo=" + couponsLogo,
+        "&totalAddedValueTax=" + totalAddedValueTax + "&couponsLogo=" + couponsLogo + "&svipReduction=" + svipReduction,
         "设置商品", $(top.document).width() - 240, $(top.document).height() - 200, {
             top: 36,
             persistent: true,
@@ -887,10 +888,14 @@ function setProductList(data) {
         "<td>" + data.num + (data.presentNum > 0 ? "(" + data.presentNum + ")" : "") + "</td>" +
         (data.discount * 1 === 100 && data.cmPromotion && data.cmPromotion.mode == 1 ? ("<td><del>" + data.price +
             "</del>") : ("<td>" + data.price)) +
-        (data.includedTax == 1 ? "<label style='color: red'>(含税)</label>" : data.includedTax == 0 && (data
-            .invoiceType == 1 || data.invoiceType == 2) ? "<label style='color: red'>(不含税-能开票)</label>" : data
+        ((data.svipPriceFlag == 1 || (data.includedTax != null && data.includedTax != '' && data.includedTax != 2))?"<label style='color: red'>(":"")+
+        (data.svipPriceFlag == 1?"超级会员价":"")+
+        ((data.svipPriceFlag == 1 && (data.includedTax != null && data.includedTax != '' && data.includedTax != 2))?",":"")+
+        (data.includedTax == 1 ? "含税" : data.includedTax == 0 && (data
+            .invoiceType == 1 || data.invoiceType == 2) ? "不含税-能开票" : data
             .includedTax != '' && data.includedTax == 0 && data.invoiceType == 3 ?
-            "<label style='color: red'>(不含税-不能开票)</label>" : "") +
+            "不含税-不能开票" : "") +
+        ((data.svipPriceFlag == 1 || (data.includedTax != null && data.includedTax != '' && data.includedTax != 2))?")</label>":"")+
         "</td>" +
         "<td>" + data.discount + "</td>" +
         (data.discount * 1 === 100 && data.cmPromotion && data.cmPromotion.mode == 1 ? ("<td><del>" + data
@@ -1220,7 +1225,8 @@ function setOrderFee() { //不考虑经理折扣、运费,此时 商品总金
         giftCount = 0, //促销赠品数
         orderTotalFee = 0, //订单总额
         reducedPrice = 0, //促销满减
-        payTotalFee = 0; //应付总额
+        payTotalFee = 0, //应付总额
+        svipFullReduction=0;   //超级会员优惠
     var couponPrice = $("#couponAmount").val() ? $("#couponAmount").val()*1 : 0;
     $('.productTable tbody tr:not(.gift)').each(function(index, element) {
         var obj = JSON.parse($(this).attr("data-value"));
@@ -1230,6 +1236,7 @@ function setOrderFee() { //不考虑经理折扣、运费,此时 商品总金
         presentCount = Number(presentCount) + Number(obj.presentNum);
         orderTotalFee = ((Number(orderTotalFee) * 100 + Number(obj.totalFee) * 100) / 100).toFixed(2);
         payTotalFee = ((Number(payTotalFee) * 100 + Number(obj.totalFee) * 100) / 100).toFixed(2);
+        svipFullReduction = ((Number(svipFullReduction) * 100 + Number(obj.svipReduction) * 100) / 100).toFixed(2);
     });
     $('.productTable tbody tr.promotions').each(function(index, element) {
         var obj = JSON.parse($(this).attr("data-value"));
@@ -1263,6 +1270,8 @@ function setOrderFee() { //不考虑经理折扣、运费,此时 商品总金
     $("#promotionalGiftsCount").val(giftCount);
     $(".orderTotalFee").text(orderTotalFee);
     $(".payTotalFee").text(payTotalFee);
+    $(".svipFullReduction").text(svipFullReduction);
+    $("#svipFullReduction").val(svipFullReduction);
     $("#discount").val('0.00');
 
     setProductTotalFee(); //重新设置经理折扣
@@ -1389,7 +1398,13 @@ function discountPriceVal(index) {
 
 //输入折扣单价重新计算折扣
 function countDiscount(index) {
-    var price = Number($("#price" + index).val()); //拿到单价
+    var svipPriceFlag = $("#svipPriceFlag" + index).val(); //是否使用超级会员价
+    var price;
+    if (1 == svipPriceFlag) {
+        price = Number($("#svipDiscountPrice" + index).val());// 拿到超级会员价
+    } else {
+        price = Number($("#price" + index).val()); //拿到单价
+    }
     var discountPrice = Number($("#discountPrice" + index).val()); //拿到折后单价
     //判断必须小于等于商品单价
     if (discountPrice > price) {
@@ -1460,6 +1475,7 @@ function taxRateVal(index) {
     var obj1 = document.getElementById("priceLabel" + index); //选择商品页面商品单价
     var obj2 = document.getElementById("price"); //设置商品页面商品单价
     var price = obj1 != null ? obj1 : obj2 != null ? obj2 : null;
+    var svipReduction = $("#svipReduction" + index).val() * numVal;
 
     if (includedTax != '' && includedTax == 0 && invoiceType == 3) {
         //不含税不能开票商品,税率置为0
@@ -1541,6 +1557,7 @@ function taxRateVal(index) {
         $checkItem["totalFee"] = totalFee + ""; //重新设置总价
         $checkItem["payTotalFee"] = totalFee + ""; //重新设置应付
         $checkItem["costPrice"] = costPrice + ""; //重新设置成本
+        $checkItem["svipReduction"] = svipReduction + ""; //重新设置超级会员优惠
         // console.log("data" + index + ":" + JSON.stringify($checkItem));
         $("#check-item" + index).val(JSON.stringify($checkItem));
     } else {
@@ -1633,6 +1650,7 @@ function taxRateVal(index) {
             $checkItem["totalFee"] = totalFee + ""; //重新设置总价
             $checkItem["payTotalFee"] = totalFee + ""; //重新设置应付
             $checkItem["costPrice"] = costPrice + ""; //重新设置成本
+            $checkItem["svipReduction"] = svipReduction + ""; //重新设置超级会员优惠
             $("#taxRateLabel").val(taxRate);
             $("#addedValueTaxLabel").val(0)
             $("#totalAddedValueTaxLabel").val(0)
@@ -1752,6 +1770,7 @@ function taxRateVal(index) {
                 $checkItem["totalFee"] = totalFee + ""; //重新设置总价
                 $checkItem["payTotalFee"] = totalFee + ""; //重新设置应付
                 $checkItem["costPrice"] = costPrice + ""; //重新设置成本
+                $checkItem["svipReduction"] = svipReduction + ""; //重新设置超级会员优惠
                 $("#taxRateLabel").val(taxRate);
                 $("#addedValueTaxLabel").val(addedValueTax)
                 $("#totalAddedValueTaxLabel").val(totalAddedValueTax)
@@ -1920,7 +1939,6 @@ function cmFee(i) {
 
 //经理折扣后计算
 function setProductTotalFee() {
-    debugger
     var discount = Number($("#discount").val()); //经理折扣金额
     if (isNaN(discount)) {
         discount = Number($("#discountFee").val());