Browse Source

Merge branch 'dev1' into dev

# Conflicts:
#	src/main/webapp/resources/view/usercenter/forstore/order_pay.html
hulh 8 years ago
parent
commit
f265820b30

+ 9 - 0
src/main/java/com/uas/platform/b2c/fa/settlement/dao/BillDao.java

@@ -36,6 +36,15 @@ public interface BillDao extends JpaSpecificationExecutor<Bill>, JpaRepository<B
      */
 	public List<Bill> getBillByUseruuAndDissociative(Long useruu, Integer dissociative);
 
+	/**
+	 * 根据个人UU号和是否个人用户获取指定类型发票
+	 * @param useruu
+	 * @param dissociative
+	 * @param kind
+	 * @return
+	 */
+	public List<Bill> getBillByUseruuAndDissociativeAndKind(Long useruu, Integer dissociative, Integer kind);
+
     /**
      * 根据个人UU号和企业UU号和发票类型(增值税专用 和 增值税普通)获取发票列表
      *

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

@@ -892,4 +892,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);
 }

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

@@ -813,6 +813,7 @@ public class OrderServiceImpl implements OrderService {
             or.setSellCompanyArea(enterprise.getEnArea());
             or.setSellCompanyAddress(enterprise.getEnAddress());
             or.setOrderDetails(newOrderDetails);
+            updateOrderBill(or);
             or.setOrderid(createNumberService.generateOrderNumber(EncodingRulesConstant.ORDER, "trade$order", 8));
             orders.add(or);
         }
@@ -826,6 +827,45 @@ public class OrderServiceImpl implements OrderService {
         return ResultMap.success(orderList);
     }
 
+    /**
+     * 调整订单的发票类型
+     * 寄售类型,若选择普票(没有专票信息,修改为不开票。有则修改成专票)
+     * @param order
+     */
+    public void updateOrderBill(Order order){
+        if (sysConf.getStoreid().equals(order.getStoreid())){ //如果是寄售类型的订单
+            if (order.getInvoiceid() != null && order.getInvoicetype() == Type.Bill_NoDeduct.value()){ //发票为普票
+                //将普票类型修改为专票
+                List<Bill> billOne;
+                if (SystemSession.getUser().getEnterprise() != null){
+                    billOne = billDao.getBillByUseruuAndEnuuAndKind(SystemSession.getUser().getUserUU(),
+                            SystemSession.getUser().getEnterprise().getUu(), Type.Bill_Deduct.value());
+                }else {
+                    billOne = billDao.getBillByUseruuAndDissociativeAndKind(SystemSession.getUser().getUserUU(),
+                            Type.PERSONAL.value(), Type.Bill_Deduct.value());
+                }
+                if (CollectionUtils.isEmpty(billOne)){
+                    //没有专票信息,则修改成暂不开票
+                    order.setInvoicetype(Type.Bill_No.value());
+                    order.setInvoiceid(null);
+                    order.setInvoicetitle(null);
+                    order.setInvoiceAddress(null);
+                    order.setVatBillStatus(Status.NEEDNO_BILL.value()); // 不需要开票
+                    Set<OrderDetail> orderDetails = order.getOrderDetails();
+                    for (OrderDetail orderDetail : orderDetails) {
+                        orderDetail.setBillStatus(Status.NEEDNO_BILL.value());
+                    }
+                }else {
+                    Bill bill = billOne.get(0);
+                    order.setInvoicetype(Type.Bill_Deduct.value());
+                    order.setInvoiceid(bill.getId());
+                    order.setInvoicetitle(bill.getHead());
+                    order.setInvoiceAddress(FastjsonUtils.toJson(bill));
+                }
+            }
+        }
+    }
+
     /**
      * <h1>将orderInfos的信息封装进Order的List集合中,便于操作。</h1>
      *
@@ -3100,4 +3140,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'
+            },
             /**
              * 平台查看
              */

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

@@ -446,8 +446,45 @@ 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.cancelFrame = function () {
+			$scope.showBillFrame = false;
+		};
+
+		$scope.perfectLater = function () {
+			$scope.showBillFrame = false;
+			$scope.imperfect = true;
+		};
+
+		$scope.goToBillPage = function () {
+			$scope.showBillFrame = false;
+			window.open("user#/invoice", '_self');
+		};
 
 		//确认付款
+		$scope.imperfect = false;//暂不完善
 		$scope.confirmPay = function() {
 			if($scope.order.status == 502 || $scope.order.status == 503) {
 				var arr = [];
@@ -481,6 +518,14 @@ define(['app/app'], function(app) {
 				return ;
 			}
 			orderInfos.push(orderInfo);
+			if(!$scope.imperfect){
+				var validBill = checkBill();
+				if (!validBill){
+					// toaster.pop('info', '请完善专票信息');
+					$scope.showBillFrame = true;
+					return ;
+				}
+			}
 
 			Order.ensure({orderid: enIdFilter($scope.order.orderid)}, orderInfos, function(data){
 				if(data.code == 1) {
@@ -661,10 +706,23 @@ 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;
+				}
+			})
+		};
+
 		/**********************************************************************
 		 * 地址信息管理
 		 **********************************************************************/

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

@@ -1,4 +1,49 @@
 <style type="text/css">
+	.buyer-contact {
+		position:fixed;
+		top:50%;
+		left:50%;
+		transform:translate(-50%,-50%);
+		z-index: 2;
+		min-height: 155px;
+		opacity: 1;
+		background-color: white;
+		width: 350px;
+		border: 1px solid #E7E5E2;
+		-webkit-box-shadow: 0 5px 15px rgba(0,0,0,.5);
+		box-shadow: 0 5px 15px rgba(0,0,0,.5);
+	}
+
+	.buyer-contact .contact-title {
+		height: 26px;
+		background-color: #5078cb;
+		text-align: right;
+		padding-right: 15px;
+		line-height: 26px;
+		color: white;
+	}
+
+	.buyer-contact .company-name{
+		margin:30px;
+	}
+	.buyer-contact .company-name p{
+		font-size:14px;
+		line-height: 25px;
+		padding-bottom:10px;
+	}
+	.buyer-contact .company-name p:last-child{
+		text-align: center;
+	}
+	.buyer-contact .company-name a{
+		color:#5078cb;
+	}
+	.buyer-contact .company-name i{
+		font-size:20px;
+	}
+	.buyer-contact .contact-title a,.buyer-contact .contact-title a:hover {
+		color: white !important;
+	}
+
 	.payment a {
 		text-decoration:none;
 	}
@@ -45,10 +90,16 @@
 	.payment .bill-radio span{
 		margin-right: 10px;
 	}
+	.payment .bill-radio b{
+		margin-left: 100px;
+		font-size:14px;
+		color: #ef2324;
+	}
 	.payment .bill-radio span:hover{
 		cursor: pointer;
 		color: #5078cb;
 	}
+
 	.payment .bill-radio input {
 		display: none;
 	}
@@ -569,7 +620,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>
@@ -577,6 +628,7 @@
 					<input type="radio"  name="bill" ng-checked="order.invoicetype == '1205'"/>
 					<label></label><em>增值税专用发票</em>
 				</span>
+				<b ng-if="order.invoicetype == '1206' && hideNormal">因存在部分寄售产品,寄售产品默认仅提供增值税专票</b>
 			</p>
 			<div class="pay_oder_xq_list no-need-bill f14" ng-if="order.invoicetype=='1207'">
 			</div>
@@ -836,4 +888,13 @@
 			</div>
 		</div>
 	</div>
+	<div class="buyer-contact" ng-if="showBillFrame">
+		<div class="contact-title">
+			<a ng-click="cancelFrame()"><i style="font-size: 20px" class="fa fa-close fa-lg" aria-hidden="true"></i></a>
+		</div>
+		<div class="company-name">
+			<p>您还未填写&nbsp;<a ng-click="goToBillPage()">增值税专票信息</a>&nbsp;,请进行完善,否则无法开具寄售产品发票</p>
+			<P><button class="btn" ng-click="perfectLater()" style="background: #5078cb;border-radius:0px;color:#fff;">暂不完善</button>&nbsp;<a ng-click="goToBillPage()" class="send">立刻完善&nbsp;<i class="fa fa-arrow-right"></i></a></P>
+		</div>
+	</div>
 </div>