Browse Source

bug fixes

plf 3 years ago
parent
commit
30704ab0ac

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

@@ -308,8 +308,6 @@ public class PurchaseProductController extends BaseController {
 
     @RequestMapping(value = "formOrderProduct")
     public String formOrderProduct(PurchaseProduct purchaseProduct, Model model) {
-//		JSONObject object = JSONObject.parseObject(product);
-//		PurchaseProduct purchaseProduct = JSONObject.toJavaObject(object, PurchaseProduct.class);
         if (purchaseProduct != null) {
             purchaseProduct.setLadderPriceFlag(0);
             Product product = productDao.get(purchaseProduct.getProductId().toString());

+ 1 - 1
src/main/java/com/caimei/modules/coupon/web/CmCouponController.java

@@ -195,7 +195,7 @@ public class CmCouponController extends BaseController {
     @RequestMapping("codeCouponForm")
     public String redemptionCodeCouponForm(CmCoupon cmCoupon, Model model) {
         model.addAttribute("cmCoupon", cmCoupon);
-        if (cmCoupon != null) {
+        if (cmCoupon != null && cmCoupon.getCouponType() != null) {
             if (0 == cmCoupon.getCouponType()) {
                 List<CmCouponAssociate> associateList = new ArrayList<>();
                 if (StringUtils.isNotBlank(cmCoupon.getId()) && "2".equals(cmCoupon.getProductType())) {

+ 1 - 0
src/main/java/com/caimei/modules/order/service/NewOrderService.java

@@ -233,6 +233,7 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
             }
             newOrder.setPayStatus("1");
             newOrder.setZeroCostFlag(0);
+            newOrder.setCouponAmount(newOrder.getCouponAmount() == null ? 0d : newOrder.getCouponAmount());
             if (flag) {
                 // 新增
                 newOrderDao.insert(newOrder);

+ 1 - 1
src/main/resources/mappings/modules/coupon/CmCouponMapper.xml

@@ -441,7 +441,7 @@
 		WHERE
 		  couponId = #{couponId}
 		  AND (
-			pcStatus = 2
+			pcStatus = 1
 			OR appletsStatus = 1
 		  )
 	</select>

+ 24 - 9
src/main/webapp/WEB-INF/views/modules/bulkpurchase/orderPurchaseProductForm.jsp

@@ -104,6 +104,7 @@
             <th>总价</th>
             <th>能否复购</th>
             <th>促销活动</th>
+            <th>优惠券</th>
             <%--以下三个应付不显示,但是内容值参与计算并保存---关闭控制入口移动到财务管理中控制20181201--%>
             <%--<th>应付供应商</th>--%>
             <%--<th>应付第三方</th>--%>
@@ -188,7 +189,6 @@
                 <input type="hidden" name="addedValueTax" id="addedValueTax0"
                        value="${empty purchaseProduct.addedValueTax ?0:(purchaseProduct.addedValueTax)}" readonly
                        style="width: 80px">
-                <%--<input hidden id="addedValueTax0" value="${orderProduct.addedValueTax}">--%>
             </td>
             <td>
                 <input name="totalAddedValueTaxLabel" id="totalAddedValueTaxLabel"
@@ -197,7 +197,6 @@
                 <input type="hidden" name="totalAddedValueTax" id="totalAddedValueTax0"
                        value="${empty purchaseProduct.totalAddedValueTax ?0:(purchaseProduct.totalAddedValueTax)}"
                        readonly style="width: 80px">
-                <%--<input hidden id="totalAddedValueTax0" value="">--%>
             </td>
             <td>
                 <input name="totalFee" id="totalFee0"
@@ -205,7 +204,6 @@
                        readonly style="width: 80px">
                 <%--            <input name="totalFee" id="totalFee0" value="${empty purchaseProduct.totalFee ?0:(purchaseProduct.totalFee)}" readonly  style="width: 80px">--%>
                 <input hidden id="totalFee0" value="">
-                <%--<span id="totalFee0">0.00</span>--%>
             </td>
             <td>
 
@@ -249,6 +247,14 @@
                         <label>满${purchaseProduct.cmPromotion.touchPrice},赠送商品</label></a></label>
                 </c:if>
             </td>
+            <td>
+                <c:if test="${purchaseProduct.couponsLogo eq 1}">
+                    ----
+                </c:if>
+                <c:if test="${purchaseProduct.couponsLogo eq 2}">
+                    <a href="javascript:;" onclick="showSelect(${purchaseProduct.userId},${purchaseProduct.productId})">查看</a>
+                </c:if>
+            </td>
 
         <%--以下三个应付不显示,但是内容值参与计算并保存---关闭控制入口移动到财务管理中控制20181201--%>
         <td style="display: none"><input type="text" name="shopFee1" id="shopFee10" value= "${purchaseProduct.shopFee}" class="required1 " onchange="shopFee(0)"  style="width: 50px">
@@ -309,12 +315,6 @@
         });
         //初始化数据
         initData();
-//            $('.tr-item').each(function(index,element){
-//                var $discount = $("#discount" + index).val();
-//                if(null != $discount && "" != $discount){
-//                    discountPriceVal(index);
-//                }
-//            });
         changenum(0);
     });
 
@@ -388,6 +388,21 @@
         $num.val(1);
         alertx("二手仪器购买数量只能为1");
     }
+
+    // 展示优惠券列表
+    function showSelect(userId, productId) {
+        var url = "${ctx}/coupon/cmCoupon/productDetails?userId=" + userId + "&productId=" + productId;
+        var title = '';
+        title = "查看优惠券";
+        top.$.jBox("iframe:" + url, {
+            iframeScrolling: 'yes',
+            width: $(top.document).width() - 600,
+            height: $(top.document).height() - 250,
+            persistent: true,
+            title: title,
+            buttons: {"确定": '1'}
+        });
+    }
 </script>
 </body>
 </html>

+ 1 - 1
src/main/webapp/WEB-INF/views/modules/coupon/cmCouponClubList.jsp

@@ -87,7 +87,7 @@
 					${cmCouponClub.clubName}
 				</td>
 				<td>
-					${cmCouponClub.source eq "1" ? "小程序": cmCouponClub.source eq "2" ? "网站" : "订单退回"}
+					${cmCouponClub.source eq "1" ? "网站": cmCouponClub.source eq "2" ? "小程序" : "订单退回"}
 				</td>
 				<td>
 					<c:if test="${cmCouponClub.status eq '1'}">

+ 8 - 5
src/main/webapp/WEB-INF/views/modules/coupon/cmCouponForm.jsp

@@ -14,11 +14,14 @@
 						var productInfo = JSON.stringify(imageList);
 						$('#productInfo').val(productInfo);
 					}
-					var pcBanner = $('#pcBanner').val();
-					var appletsBanner = $('#appletsBanner').val();
-					if (pcBanner == '' || appletsBanner == '') {
-						alertx("请上传Banner图");
-						return false;
+					var  productType = $("input[name='productType']:checked").val();
+					if (productType == 2){
+						var pcBanner = $('#pcBanner').val();
+						var appletsBanner = $('#appletsBanner').val();
+						if (pcBanner == '' || appletsBanner == '') {
+							alertx("请上传Banner图");
+							return false;
+						}
 					}
 					var couponAmount = $("#couponAmount").val()*1;
 					var touchPrice = $("#touchPrice").val()*1;

+ 1 - 1
src/main/webapp/WEB-INF/views/modules/coupon/cmCouponList.jsp

@@ -112,7 +112,7 @@
     				<a href="${ctx}/coupon/cmCoupon/form?id=${cmCoupon.id}">编辑</a>
 					<a href="${ctx}/coupon/cmCoupon/close?id=${cmCoupon.id}" onclick="return confirmx('确定关闭该优惠券吗?', this.href)">关闭</a>
 					<a href="${ctx}/coupon/cmCoupon/delete?id=${cmCoupon.id}" onclick="return confirmx('确定删除该优惠券吗?', this.href)">删除</a>
-					<a href="${ctx}/coupon/cmCouponClub/list?couponId=${cmCoupon.id}&couponType=0">领取户</a>
+					<a href="${ctx}/coupon/cmCouponClub/list?couponId=${cmCoupon.id}&couponType=0">领取户</a>
 				</td>
 			</tr>
 		</c:forEach>

+ 1 - 1
src/main/webapp/WEB-INF/views/modules/coupon/couponCategoryList.jsp

@@ -114,7 +114,7 @@
                 <a href="${ctx}/coupon/cmCoupon/form?id=${cmCoupon.id}">编辑</a>
                 <a href="${ctx}/coupon/cmCoupon/close?id=${cmCoupon.id}" onclick="return confirmx('确定关闭该优惠券吗?', this.href)">关闭</a>
                 <a href="${ctx}/coupon/cmCoupon/delete?id=${cmCoupon.id}" onclick="return confirmx('确定删除该优惠券吗?', this.href)">删除</a>
-                <a href="${ctx}/coupon/cmCouponClub/list?couponId=${cmCoupon.id}&couponType=1">领取户</a>
+                <a href="${ctx}/coupon/cmCouponClub/list?couponId=${cmCoupon.id}&couponType=1">领取户</a>
             </td>
         </tr>
     </c:forEach>

+ 1 - 1
src/main/webapp/WEB-INF/views/modules/coupon/couponNewUserList.jsp

@@ -106,7 +106,7 @@
                 <a href="${ctx}/coupon/cmCoupon/form?id=${cmCoupon.id}">编辑</a>
                 <a href="${ctx}/coupon/cmCoupon/close?id=${cmCoupon.id}" onclick="return confirmx('确定关闭该优惠券吗?', this.href)">关闭</a>
                 <a href="${ctx}/coupon/cmCoupon/delete?id=${cmCoupon.id}" onclick="return confirmx('确定删除该优惠券吗?', this.href)">删除</a>
-                <a href="${ctx}/coupon/cmCouponClub/list?couponId=${cmCoupon.id}&couponType=4">领取户</a>
+                <a href="${ctx}/coupon/cmCouponClub/list?couponId=${cmCoupon.id}&couponType=4">领取户</a>
             </td>
         </tr>
     </c:forEach>

+ 1 - 1
src/main/webapp/WEB-INF/views/modules/coupon/couponShopList.jsp

@@ -118,7 +118,7 @@
                 <a href="${ctx}/coupon/cmCoupon/form?id=${cmCoupon.id}">编辑</a>
                 <a href="${ctx}/coupon/cmCoupon/close?id=${cmCoupon.id}" onclick="return confirmx('确定关闭该优惠券吗?', this.href)">关闭</a>
                 <a href="${ctx}/coupon/cmCoupon/delete?id=${cmCoupon.id}" onclick="return confirmx('确定删除该优惠券吗?', this.href)">删除</a>
-                <a href="${ctx}/coupon/cmCouponClub/list?couponId=${cmCoupon.id}&couponType=3">领取户</a>
+                <a href="${ctx}/coupon/cmCouponClub/list?couponId=${cmCoupon.id}&couponType=3">领取户</a>
             </td>
         </tr>
     </c:forEach>

+ 2 - 1
src/main/webapp/WEB-INF/views/modules/coupon/redemptionCodeCouponForm.jsp

@@ -14,7 +14,8 @@
                         $('#productInfo').val(productInfo);
                     }
                     var couponType = $("input[name='couponType']:checked").val();
-                    if (couponType == 0) {
+                    var productType = $("input[name='productType']:checked").val();
+                    if (couponType == 0 && productType == 2) {
                         var pcBanner = $('#pcBanner').val();
                         var appletsBanner = $('#appletsBanner').val();
                         if (pcBanner == '' || appletsBanner == '') {

+ 8 - 4
src/main/webapp/static/modules/bulkpurchase/orderForm.js

@@ -419,14 +419,14 @@ function getShownCouponList(){
         var couponType = coupon.couponType*1;
         couponProductList.forEach(function(item){
             var number = item.num ? item.num*1 : item.number*1;
-            var productPrice = item.price * number;
+            var productPrice = item.price * number + item.totalAddedValueTax*1;
             if (couponType === 0) {
                 if (coupon.productType*1 === 1) {
                     //活动券-全商城商品
                     totalAmount += productPrice;
                 } else if (coupon.productType*1 === 2) {
                     //活动券-指定商品
-                    if (coupon.productIdList.length > 0 && coupon.productIdList.indexOf(item.productId*1)) {
+                    if (coupon.productIdList.length > 0 && coupon.productIdList.indexOf(item.productId*1) >= 0) {
                         totalAmount += productPrice;
                     }
                 }
@@ -645,6 +645,8 @@ function deleteShopProduct(obj) {
     resetProductList();
     if ($('.productTable tbody tr').length === 0) {
         setOrderFee();
+        // 展示可选优惠券列表
+        getShownCouponList();
     }
     $(".addSecondHandProduct").show();
 }
@@ -653,6 +655,7 @@ function editShopProduct(obj) {
     var $tr = obj.parents('tr');
     var data = $tr.attr("data-value");
     data = JSON.parse(data);
+    var userId = $("#inputForm").find("[name*='bpOrderUserinfo.userId']").val();
     var productID = (data.productId == undefined) ? data.productID : data.productId;
     var secondHandType = (data.secondHandType == undefined) ? 0 : data.secondHandType;
     var discount = (data.discount == undefined) ? 100 : data.discount;
@@ -663,12 +666,13 @@ function editShopProduct(obj) {
     var taxRate = (data.taxRate == undefined) ? 0 : data.taxRate;
     var addedValueTax = (data.addedValueTax == undefined) ? 0 : data.addedValueTax;
     var totalAddedValueTax = (data.totalAddedValueTax == undefined) ? 0 : data.totalAddedValueTax;
+    var couponsLogo = (data.couponsLogo == undefined) ? 1 : data.couponsLogo;
     $.jBox.open("iframe:" + ctx + "/bulkpurchase/purchaseProduct/formOrderProduct?productId=" + productID +
         "&secondHandType=" + secondHandType +
         "&discount=" + discount + "&productCategory=" + productCategory + "&price=" + price + "&includedTax=" +
-        includedTax +
+        includedTax + "&userId=" + userId +
         "&invoiceType=" + invoiceType + "&taxRate=" + taxRate + "&addedValueTax=" + addedValueTax +
-        "&totalAddedValueTax=" + totalAddedValueTax,
+        "&totalAddedValueTax=" + totalAddedValueTax + "&couponsLogo=" + couponsLogo,
         "设置商品", $(top.document).width() - 240, $(top.document).height() - 200, {
             top: 36,
             persistent: true,