Browse Source

调整发票功能逻辑

hulh 8 years ago
parent
commit
2d29d7f443

+ 9 - 0
src/main/java/com/uas/platform/b2c/trade/order/controller/OrderController.java

@@ -891,4 +891,13 @@ public class OrderController {
 		String orderid = StringUtilB2C.decodeValue(enOrderid);
 		return orderService.getStatusByOrid(orderid);
 	}
+
+	/**
+	 * 根据店铺uuid验证是否包含寄售店铺
+	 * @return
+	 */
+	@RequestMapping(value = "/consignment", method = RequestMethod.POST)
+	public ResultMap checkConsignment(@RequestBody List<String> uuidArray){
+		return orderService.checkConsignment(uuidArray);
+	}
 }

+ 7 - 0
src/main/java/com/uas/platform/b2c/trade/order/service/OrderService.java

@@ -605,4 +605,11 @@ public interface OrderService {
 	 * @return
 	 */
 	Order updateByDetail(Order order);
+
+	/**
+	 * 根据uuid来判断是否包含寄售店铺
+	 * @param uuidArray
+	 * @return
+	 */
+	ResultMap checkConsignment(List<String> uuidArray);
 }

+ 12 - 0
src/main/java/com/uas/platform/b2c/trade/order/service/impl/OrderServiceImpl.java

@@ -3095,4 +3095,16 @@ public class OrderServiceImpl implements OrderService {
         order.setCmpQty(cmps.size());// 型号数量
         return order;
     }
+
+    @Override
+    public ResultMap checkConsignment(List<String> uuidArray) {
+        Boolean bool = false;
+        for (String uuid : uuidArray){
+            if (sysConf.getStoreid().equals(uuid)){
+                bool = true;
+                break;
+            }
+        }
+        return ResultMap.success(bool);
+    }
 }

+ 5 - 0
src/main/webapp/resources/js/common/query/order.js

@@ -76,6 +76,11 @@ define([ 'ngResource' ], function() {
                 method : 'PUT',
                 isArray : false
             },
+            //判断是否包含寄售类型产品
+            checkConsignment: {
+                url : 'trade/order/consignment',
+                method : 'POST'
+            },
             /**
              * 平台查看
              */

+ 41 - 0
src/main/webapp/resources/js/usercenter/controllers/forstore/order_pay_ctrl.js

@@ -446,6 +446,28 @@ define(['app/app'], function(app) {
 			});
 			return value;
 		};
+		//检查是否选择了寄售商品,选择了发票却没有完善专票信息
+		var checkBill = function () {
+			if($scope.order.invoicetype != '1207') {
+				if($scope.hideNormal){
+					var bill = getSpecial();
+					if(!bill.id) {
+						return false;
+					}
+				}
+			}
+			return true;
+		};
+
+		var getSpecial = function () {
+			var billSpecial = {};
+			angular.forEach($scope.bills, function (bill) {
+				if (bill.kind == '1205'){
+					billSpecial = bill;
+				}
+			});
+			return billSpecial;
+		};
 
 		//确认付款
 		$scope.confirmPay = function() {
@@ -475,6 +497,11 @@ define(['app/app'], function(app) {
 				toaster.pop("info", "请选择一个自提点");
 				return ;
 			}
+			var validBill = checkBill();
+			if (!validBill){
+				toaster.pop('info', '请完善专票信息');
+				return ;
+			}
 			var orderInfos = [], orderInfo;
 			orderInfo = generateOrderInfo();
 			if(orderInfo == null) {
@@ -661,10 +688,24 @@ define(['app/app'], function(app) {
 
 			//获取地址的信息
 			$scope.loadShippingAddress();
+			checkStoreType();
 			//发票的信息
 			getBillInfo();
 		};
 
+		var checkStoreType = function () {
+			var uuidArray = [];
+			angular.forEach($scope.storeArray, function (store) {
+				uuidArray.push(store.uuid);
+			});
+			Order.checkConsignment({}, uuidArray, function (data) {
+				if (data){
+					$scope.hideNormal = data.data;
+				}
+				// console.log(data);
+			})
+		};
+
 		/**********************************************************************
 		 * 地址信息管理
 		 **********************************************************************/

+ 1 - 1
src/main/webapp/resources/view/usercenter/forstore/order_pay.html

@@ -569,7 +569,7 @@
 					<input type="radio"  name="bill" ng-checked="order.invoicetype == '1207'"/>
 					<label></label><em>暂不开票</em>
 				</span>
-				<span  ng-click="selectBill('1206')">
+				<span  ng-click="selectBill('1206')" ng-hide="storeArray.length == 1 && hideNormal">
 					<input type="radio"  name="bill" ng-checked="order.invoicetype == '1206'"/>
 					<label></label><em>增值税普通发票</em>
 				</span>