Browse Source

卖家订单中心订单详情开启分期付款功能

ouxq 8 years ago
parent
commit
aaa204ed79

+ 2 - 2
src/main/java/com/uas/platform/b2c/fa/payment/controller/InstallmentController.java

@@ -33,7 +33,7 @@ public class InstallmentController {
     @RequestMapping(method = RequestMethod.POST)
     @RequestMapping(method = RequestMethod.POST)
     public Installment createInstallment(@RequestBody String json) {
     public Installment createInstallment(@RequestBody String json) {
         JSONObject jsonObject = FastjsonUtils.fromJson(json, JSONObject.class);
         JSONObject jsonObject = FastjsonUtils.fromJson(json, JSONObject.class);
-        Installment installment = (Installment) jsonObject.get("installment");
+        Installment installment = FastjsonUtils.fromJson(jsonObject.get("installment").toString(), Installment.class);
         Long purchaseId = jsonObject.getLong("purchaseId");
         Long purchaseId = jsonObject.getLong("purchaseId");
         return installmentService.createInstallment(installment, purchaseId);
         return installmentService.createInstallment(installment, purchaseId);
     }
     }
@@ -46,7 +46,7 @@ public class InstallmentController {
     @RequestMapping(method = RequestMethod.PUT)
     @RequestMapping(method = RequestMethod.PUT)
     public Installment updateInstallment(@RequestBody String json) {
     public Installment updateInstallment(@RequestBody String json) {
         JSONObject jsonObject = FastjsonUtils.fromJson(json, JSONObject.class);
         JSONObject jsonObject = FastjsonUtils.fromJson(json, JSONObject.class);
-        Installment installment = (Installment) jsonObject.get("installment");
+        Installment installment = FastjsonUtils.fromJson(jsonObject.get("installment").toString(), Installment.class);
         Long purchaseId = jsonObject.getLong("purchaseId");
         Long purchaseId = jsonObject.getLong("purchaseId");
         return installmentService.updateInstallment(installment, purchaseId);
         return installmentService.updateInstallment(installment, purchaseId);
     }
     }

+ 4 - 4
src/main/java/com/uas/platform/b2c/fa/payment/service/impl/InstallmentServiceImpl.java

@@ -64,8 +64,8 @@ public class InstallmentServiceImpl implements InstallmentService{
             throw new IllegalOperatorException("此订单状态不为待付款,不可设置分期");
             throw new IllegalOperatorException("此订单状态不为待付款,不可设置分期");
 
 
         InstallmentStore installmentStore = installmentStoreDao.findByEnuuAndEnable(SystemSession.getUser().getEnterprise().getUu(), (short) 1);
         InstallmentStore installmentStore = installmentStoreDao.findByEnuuAndEnable(SystemSession.getUser().getEnterprise().getUu(), (short) 1);
-        if (installmentStore == null)
-            throw new IllegalOperatorException("当前企业没有设置分期功能权限,如有需要请联系客服");
+//        if (installmentStore == null)
+//            throw new IllegalOperatorException("当前企业没有设置分期功能权限,如有需要请联系客服");
 
 
         List<BankInfo> bankInfos = bankInfoService.getEnterpriseBankInfoContainsStatus(Type.SUP.value(), Status.ALLOW.value());
         List<BankInfo> bankInfos = bankInfoService.getEnterpriseBankInfoContainsStatus(Type.SUP.value(), Status.ALLOW.value());
         if (CollectionUtils.isEmpty(bankInfos))
         if (CollectionUtils.isEmpty(bankInfos))
@@ -120,8 +120,8 @@ public class InstallmentServiceImpl implements InstallmentService{
             throw new IllegalOperatorException("此订单状态不为待付款,不可修改分期信息");
             throw new IllegalOperatorException("此订单状态不为待付款,不可修改分期信息");
 
 
         InstallmentStore installmentStore = installmentStoreDao.findByEnuuAndEnable(SystemSession.getUser().getEnterprise().getUu(), (short) 1);
         InstallmentStore installmentStore = installmentStoreDao.findByEnuuAndEnable(SystemSession.getUser().getEnterprise().getUu(), (short) 1);
-        if (installmentStore == null)
-            throw new IllegalOperatorException("当前企业没有设置分期功能权限,如有需要请联系客服");
+//        if (installmentStore == null)
+//            throw new IllegalOperatorException("当前企业没有设置分期功能权限,如有需要请联系客服");
 
 
         List<BankInfo> bankInfos = bankInfoService.getEnterpriseBankInfoContainsStatus(Type.SUP.value(), Status.ALLOW.value());
         List<BankInfo> bankInfos = bankInfoService.getEnterpriseBankInfoContainsStatus(Type.SUP.value(), Status.ALLOW.value());
         if (CollectionUtils.isEmpty(bankInfos))
         if (CollectionUtils.isEmpty(bankInfos))

+ 3 - 1
src/main/webapp/resources/css/pay.css

@@ -69,6 +69,8 @@
     color: #fff;
     color: #fff;
     line-height: 15px;
     line-height: 15px;
     margin: 0 10px 0 28px;
     margin: 0 10px 0 28px;
+    position: relative;
+    top: -1px;
 }
 }
 .check-act input{
 .check-act input{
     display: none;
     display: none;
@@ -348,7 +350,7 @@
 }
 }
 .deal-btn a.off{
 .deal-btn a.off{
     background: #cdcccc;
     background: #cdcccc;
-    color: #666;
+    color: #fff;
     margin-right: 8px;
     margin-right: 8px;
 }
 }
 .deal-btn a.ok{
 .deal-btn a.ok{

+ 22 - 0
src/main/webapp/resources/js/common/query/installments.js

@@ -0,0 +1,22 @@
+define([ 'ngResource' ], function() {
+    angular.module('installmentServices', [ 'ngResource' ]).factory('Installment', ['$resource', 'BaseService', function($resource, BaseService) {
+        var rootPath = BaseService.getRootPath();
+        return $resource('/trade/installments', {}, {
+            // 新增分期信息
+            addInstallment: {
+                url: rootPath + '/trade/installments',
+                method: 'POST'
+            },
+            // 更新分期信息
+            updateInstallment: {
+                url: rootPath + '/trade/installments',
+                method: 'PUT'
+            },
+            // 删除分期信息
+            deleteInstallment: {
+                url: rootPath + '/trade/installments/:purchaseId',
+                method: 'DELETE'
+            }
+        });
+    }])
+});

+ 2 - 2
src/main/webapp/resources/js/vendor/app.js

@@ -1,4 +1,4 @@
-define([ 'angularAMD', 'ngLocal', 'common/services', 'common/directives', 'common/query/brand', 'common/query/kind', 'common/query/component', 'common/query/goods', 'common/query/cart', 'common/query/order', 'common/query/address', 'common/query/invoice', 'common/query/property', 'common/query/kindAdvice', 'common/query/propertyAdvice', 'common/query/return' , 'common/query/change', 'common/query/logistics', 'ui.router', 'ui-bootstrap', 'ui-form', 'ui-jquery', 'angular-toaster', 'ngDraggable', 'angular-sanitize', 'ngTable', 'dynamicInput', 'jquery-imagezoom', 'file-upload', 'file-upload-shim', 'common/query/urlencryption' , 'common/query/purchase', 'common/query/vendor', 'common/query/goods', 'common/query/bankTransfer', 'common/query/enterprise', 'common/query/bill', 'common/query/receipt', 'common/query/collection', 'common/query/express', 'common/query/bankInfo','common/query/charge', 'common/query/statistics', 'common/query/currency', 'jquery-chart', 'common/query/responseLogistics', 'common/query/goodsPrice', 'common/query/address' , 'common/query/search', 'common/query/urlencryption', 'common/query/releaseProInfo', 'common/query/makerDemand', 'common/query/afterSale', 'common/query/messageBoard', 'common/query/logistics', 'common/query/storeInfo', 'common/query/recommendation', 'common/query/user', 'common/query/logisticsPort', 'common/query/cms', 'common/query/material', 'common/query/storeCms', 'common/query/productImport', 'common/query/stockInOut', 'common/module/store_recommend_product', 'common/module/chat_web_module', 'common/query/standardPutOnAdmin', 'common/query/storeViolations', 'common/query/internalMessage'], function(angularAMD) {
+define([ 'angularAMD', 'ngLocal', 'common/services', 'common/directives', 'common/query/brand', 'common/query/kind', 'common/query/component', 'common/query/goods', 'common/query/cart', 'common/query/order', 'common/query/address', 'common/query/invoice', 'common/query/property', 'common/query/kindAdvice', 'common/query/propertyAdvice', 'common/query/return' , 'common/query/change', 'common/query/logistics', 'ui.router', 'ui-bootstrap', 'ui-form', 'ui-jquery', 'angular-toaster', 'ngDraggable', 'angular-sanitize', 'ngTable', 'dynamicInput', 'jquery-imagezoom', 'file-upload', 'file-upload-shim', 'common/query/urlencryption' , 'common/query/purchase', 'common/query/vendor', 'common/query/goods', 'common/query/bankTransfer', 'common/query/enterprise', 'common/query/bill', 'common/query/receipt', 'common/query/collection', 'common/query/express', 'common/query/bankInfo','common/query/charge', 'common/query/statistics', 'common/query/currency', 'jquery-chart', 'common/query/responseLogistics', 'common/query/goodsPrice', 'common/query/address' , 'common/query/search', 'common/query/urlencryption', 'common/query/releaseProInfo', 'common/query/makerDemand', 'common/query/afterSale', 'common/query/messageBoard', 'common/query/logistics', 'common/query/storeInfo', 'common/query/recommendation', 'common/query/user', 'common/query/logisticsPort', 'common/query/cms', 'common/query/material', 'common/query/storeCms', 'common/query/productImport', 'common/query/stockInOut', 'common/module/store_recommend_product', 'common/module/chat_web_module', 'common/query/standardPutOnAdmin', 'common/query/storeViolations', 'common/query/internalMessage', 'common/query/installments'], function(angularAMD) {
 	'use strict';
 	'use strict';
 	/**
 	/**
 	 * 自定义Array对象的属性last 方法
 	 * 自定义Array对象的属性last 方法
@@ -8,7 +8,7 @@ define([ 'angularAMD', 'ngLocal', 'common/services', 'common/directives', 'commo
 		return this.length > 0 ? this[this.length - 1] : null;
 		return this.length > 0 ? this[this.length - 1] : null;
 	};
 	};
 
 
-	var app = angular.module('myApp', [ 'ui.router', 'ui.bootstrap', 'ng.local', 'ui.form', 'ui.jquery', 'toaster', 'ngDraggable', 'tool.directives', 'ngSanitize', 'common.query.kind', 'common.services', 'brandServices', 'componentServices', 'goodsServices', 'cartServices', 'orderServices', 'addressServices', 'invoiceServices', 'common.query.propertyAdvice', 'propertyServices', 'returnServices' , 'changeServices',  'logisticsServices', 'common.query.kindAdvice', 'ngTable', 'ngDynamicInput', 'common.directives', 'angularFileUpload', 'urlencryptionServices', 'purchaseServices', 'vendorServices', 'goodsServices', 'bankTransfer', 'common.query.enterprise', 'billServices', 'receiptServices', 'collection', 'expressServices', 'bankInfo','Charge', 'statisticsServices', 'currencyService', 'responseLogisticsService', 'PriceServices', 'addressServices', 'searchService', 'urlencryptionServices', 'ReleaseProductByBatchService', 'makerDemand', 'afterSaleService', 'messageBoardServices', 'logisticsServices', 'table.directives', 'storeInfoServices', 'recommendation', 'common.query.user', 'logisticsPortService', 'cmsService', 'materialServices', 'StoreCmsServices', 'productImportModule', 'stockInOutModule', 'StoreCmsModule', 'WebChatModule', 'StandardPutOnAdminModule', 'StoreViolationsServices', 'internalMessageServices']);
+	var app = angular.module('myApp', [ 'ui.router', 'ui.bootstrap', 'ng.local', 'ui.form', 'ui.jquery', 'toaster', 'ngDraggable', 'tool.directives', 'ngSanitize', 'common.query.kind', 'common.services', 'brandServices', 'componentServices', 'goodsServices', 'cartServices', 'orderServices', 'addressServices', 'invoiceServices', 'common.query.propertyAdvice', 'propertyServices', 'returnServices' , 'changeServices',  'logisticsServices', 'common.query.kindAdvice', 'ngTable', 'ngDynamicInput', 'common.directives', 'angularFileUpload', 'urlencryptionServices', 'purchaseServices', 'vendorServices', 'goodsServices', 'bankTransfer', 'common.query.enterprise', 'billServices', 'receiptServices', 'collection', 'expressServices', 'bankInfo','Charge', 'statisticsServices', 'currencyService', 'responseLogisticsService', 'PriceServices', 'addressServices', 'searchService', 'urlencryptionServices', 'ReleaseProductByBatchService', 'makerDemand', 'afterSaleService', 'messageBoardServices', 'logisticsServices', 'table.directives', 'storeInfoServices', 'recommendation', 'common.query.user', 'logisticsPortService', 'cmsService', 'materialServices', 'StoreCmsServices', 'productImportModule', 'stockInOutModule', 'StoreCmsModule', 'WebChatModule', 'StandardPutOnAdminModule', 'StoreViolationsServices', 'internalMessageServices', 'installmentServices']);
 	//初始化,启动时载入app
 	//初始化,启动时载入app
 	app.init = function() {
 	app.init = function() {
 		angularAMD.bootstrap(app);
 		angularAMD.bootstrap(app);

+ 144 - 10
src/main/webapp/resources/js/vendor/controllers/forstore/purchase_detail.js

@@ -1,7 +1,7 @@
 
 
 define(['app/app'], function(app) {
 define(['app/app'], function(app) {
 	"use strict";
 	"use strict";
-	app.register.controller('purchaseDetailCtrl', ['$scope', 'Order', 'Logistics', 'ComponentActive', 'toaster', '$stateParams', '$state', 'Purchase', 'KdnLogistics', '$rootScope', 'NumberService', function($scope, Order, Logistics, ComponentActive, toaster, $stateParams, $state, Purchase, KdnLogistics, $rootScope, NumberService) {
+	app.register.controller('purchaseDetailCtrl', ['$scope', 'Order', 'Logistics', 'ComponentActive', 'toaster', '$stateParams', '$state', 'Purchase', 'KdnLogistics', '$rootScope', 'NumberService', 'Installment', function($scope, Order, Logistics, ComponentActive, toaster, $stateParams, $state, Purchase, KdnLogistics, $rootScope, NumberService, Installment) {
 
 
 		// 保存采购单编号信息
 		// 保存采购单编号信息
 		$scope.purchaseId = $stateParams.purchaseId;
 		$scope.purchaseId = $stateParams.purchaseId;
@@ -45,7 +45,134 @@ define(['app/app'], function(app) {
 			});
 			});
 			return time;
 			return time;
 		};
 		};
+		// 分期付款
+		$scope.isShow = false;
+		$scope.switchToggle = function () {
+			$scope.isShow = !$scope.isShow;
+		};
+		// 新增一条分期付款
+		$scope.installmentDetails  = [{price: '',deadline: '','detno': 1, 'deadlineShow': false}];
+		$scope.addInstallment = function () {
+			$scope.installmentDetails .push({price: '',deadline: '','detno': $scope.installmentDetails.length + 1, 'deadlineShow': false});
+		};
+		// 删除一条分期付款
+		$scope.deleteInstallment = function (index) {
+			$scope.installmentDetails.splice(index, 1);
+			for (var i = index; i < $scope.installmentDetails.length; i++){
+				$scope.installmentDetails[i].detno -= 1;
+			}
+			console.log($scope.installmentDetails)
+		};
 
 
+		// 打开日期选择框
+		$scope.openDatePicker = function ($event, item, openParam) {
+			$event.preventDefault();
+			$event.stopPropagation();
+			item[openParam] = !item[openParam];
+		};
+		// 监控价格
+		$scope.changeInstallmentPrice = function (price) {
+			if (price == '') {
+				toaster.pop('warning', '提示', '支付金额不能为空');
+			}
+			if (price > $scope.purchase.currentTotal) {
+				toaster.pop('warning', '提示', '输入金额不得大于或等于总支付金额');
+			}
+			if (isNaN(price)) {
+				toaster.pop('warning', '提示', '金额应该为数字');
+			}
+		};
+		// 时期
+		// $scope.changeBlurDeadline = function (item, index) {
+		// 	if (item.deadline.getTime() < item[index-1].deadline.getTime()) {
+		// 		toaster.pop('warning', '提示', '付款时间后一期须大于前一期');
+		// 	}
+		// };
+		$scope.totalPrice = 0;
+		$scope.totalNum = function () {
+			$scope.totalPrice = 0;
+			angular.forEach($scope.installmentDetails, function (item) {
+				$scope.totalPrice += Number(item.price);
+			})
+		};
+		// 保存分期付款
+		$scope.saveInstallment = function () {
+			$scope.totalNum();
+			angular.forEach($scope.installmentDetails,function (item, index) {
+				if (!item.price) {
+					toaster.pop('warning', '提示', '支付金额不能为空');
+				}
+				if (!item.deadline) {
+					toaster.pop('warning', '提示', '付款时间不能为空');
+					return ;
+				}
+			});
+			if ($scope.totalPrice != $scope.purchase.currentTotal) {
+				toaster.pop('warning', '提示', '输入金额须等于总支付金额');
+				return ;
+			}
+			$scope.installment = {};
+
+			$scope.installment.installmentDetails = $scope.installmentDetails;
+			var obj = {
+				installment: $scope.installment,
+				purchaseId: $scope.purchase.id
+			}
+			Installment.addInstallment(null, obj, function(data){
+				$scope.installments = data;
+				toaster.pop('success', '提示', '新增分期成功');
+				$scope.installmentBox = true
+				$scope.updatePurchase()
+			}, function (response) {
+				toaster.pop('error', response.data);
+			});
+		};
+		// 取消保存
+		$scope.cancelSwitch = function () {
+			$scope.isShow = false;
+			$scope.installmentDetails = [{price: '',deadline: '','detno': 1, 'deadlineShow': false}];
+		};
+		$scope.installmentBox = false;
+		// 更新分期
+		$scope.editBox = false;
+		$scope.editInstallment = function () {
+			$scope.editBox = true;
+		}
+		// 取消编辑
+		$scope.cancelEdit = function () {
+			$scope.editBox = false;
+		}
+		//更新分期信息
+		$scope.updateInstallment = function (item) {
+			// 计算金额
+			$scope.totalPrice = 0;
+			angular.forEach(item.installmentDetails, function (item) {
+				$scope.totalPrice += Number(item.price);
+			})
+			angular.forEach(item.installmentDetails,function (item) {
+				if (!item.price) {
+					toaster.pop('warning', '提示', '支付金额不能为空');
+				}
+				if (!item.deadline) {
+					toaster.pop('warning', '提示', '付款时间不能为空');
+					return ;
+				}
+			});
+			if ($scope.totalPrice != $scope.purchase.currentTotal) {
+				toaster.pop('warning', '提示', '输入金额须等于总支付金额');
+				return ;
+			}
+			var obj = {
+				installment: item,
+				purchaseId: $scope.purchase.id
+			}
+			Installment.updateInstallment(null, obj, function(){
+				toaster.pop('success', '提示', '修改分期成功');
+				$scope.editBox = false;
+			}, function (response) {
+				toaster.pop('error', response.data);
+			});
+		}
 		/**
 		/**
 		 * 确认当前采购单所属状态
 		 * 确认当前采购单所属状态
 		 */
 		 */
@@ -152,19 +279,19 @@ define(['app/app'], function(app) {
 
 
 
 
 		// 检测采购单编号ID是否存在,如果不存在跳转卖家中心首页
 		// 检测采购单编号ID是否存在,如果不存在跳转卖家中心首页
-		if (!$scope.purchaseId || $scope.purchaseId == '') {
-			$scope.error('订单编号ID不能为空');
-		} else {
-
-			/**
-			 * 根据采购单编号ID获取采购单信息
-			 */
+		$scope.updatePurchase = function () {
 			Purchase.findPurchaseByPurchaseId({ purchaseId : $scope.purchaseId }, null, function (result) {
 			Purchase.findPurchaseByPurchaseId({ purchaseId : $scope.purchaseId }, null, function (result) {
 				if (!result.success) {
 				if (!result.success) {
 					$scope.error(result.message);
 					$scope.error(result.message);
 					return ;
 					return ;
 				}
 				}
 				$scope.purchase = result.data;
 				$scope.purchase = result.data;
+				$scope.purchase.installment = result.data.installment
+				if ($scope.purchase.installment) {
+					$scope.installmentBox = true
+				}else {
+					$scope.installmentBox = false
+				}
 				$scope.purchase.purchaseHistory = angular.fromJson($scope.purchase.statushistory);
 				$scope.purchase.purchaseHistory = angular.fromJson($scope.purchase.statushistory);
 				$scope.purchase.currentTotal = $scope.purchase.price;
 				$scope.purchase.currentTotal = $scope.purchase.price;
 				// 设置状态样式
 				// 设置状态样式
@@ -176,7 +303,7 @@ define(['app/app'], function(app) {
 
 
 				// 计算
 				// 计算
 				$scope.purchase.price += $scope.freight;
 				$scope.purchase.price += $scope.freight;
-                $scope.purchase.price = Number(NumberService.toCeil($scope.purchase.price, 2));
+				$scope.purchase.price = Number(NumberService.toCeil($scope.purchase.price, 2));
 
 
 				$scope.purchase.invoiceInfo = angular.fromJson($scope.purchase.invoiceAddress)
 				$scope.purchase.invoiceInfo = angular.fromJson($scope.purchase.invoiceAddress)
 
 
@@ -184,7 +311,14 @@ define(['app/app'], function(app) {
 				$scope.error('获取订单信息请求失败');
 				$scope.error('获取订单信息请求失败');
 			});
 			});
 		}
 		}
-
+		if (!$scope.purchaseId || $scope.purchaseId == '') {
+			$scope.error('订单编号ID不能为空');
+		} else {
+			$scope.updatePurchase()
+			/**
+			 * 根据采购单编号ID获取采购单信息
+			 */
+		}
 		$scope.updateTotal = function (data) {
 		$scope.updateTotal = function (data) {
 			if (isNaN(data.currentTaxUnitPrice)){
 			if (isNaN(data.currentTaxUnitPrice)){
 				data.currentTaxUnitPrice = 0.000001;
 				data.currentTaxUnitPrice = 0.000001;

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

@@ -27,7 +27,7 @@
 							<label for="2"></label>
 							<label for="2"></label>
 							<em>平台代收</em>
 							<em>平台代收</em>
 						</label>
 						</label>
-						<div class="tip-content">
+						<div class="tip-content" style="margin-right: 45px;">
 							<img src="static/img/common/notice-tip.png" />
 							<img src="static/img/common/notice-tip.png" />
 							<div class="tip-content-01" style="top: 33px;">
 							<div class="tip-content-01" style="top: 33px;">
 								选择【平台代收】,货款将由优软商城<br/>
 								选择【平台代收】,货款将由优软商城<br/>
@@ -35,6 +35,8 @@
 								您确认收货后,优软商城再和卖家结清。
 								您确认收货后,优软商城再和卖家结清。
 							</div>
 							</div>
 						</div>
 						</div>
+						<div>125963528469526354</div>
+						<div>开户人名称</div>
 					</li>
 					</li>
 					<li>
 					<li>
 						<label class="check-act">
 						<label class="check-act">
@@ -51,6 +53,7 @@
 								间接导致的损失,由用户自己承担。
 								间接导致的损失,由用户自己承担。
 							</div>
 							</div>
 						</div>
 						</div>
+						<div>中国银行</div>
 						<div>125963528469526354</div>
 						<div>125963528469526354</div>
 						<div>开户人名称</div>
 						<div>开户人名称</div>
 					</li>
 					</li>

+ 198 - 66
src/main/webapp/resources/view/vendor/forstore/purchase_detail.html

@@ -488,15 +488,16 @@
 				}
 				}
 				.direct-collection .content-box{
 				.direct-collection .content-box{
 					width: 100%;
 					width: 100%;
-					height: 140px;
+					height: auto;
 					background-color: #fffbf6;
 					background-color: #fffbf6;
 					margin:10px 0 0 10px;
 					margin:10px 0 0 10px;
+					display: inline-block;
 				}
 				}
 				.direct-collection .content-box ul{
 				.direct-collection .content-box ul{
 					width: 100%;
 					width: 100%;
 					margin: 0 auto;
 					margin: 0 auto;
 				}
 				}
-				.direct-collection .content-box ul li{
+				.direct-collection .content-box ul li.line{
 					width: 100%;
 					width: 100%;
 					float: left;
 					float: left;
 					height: 26px;
 					height: 26px;
@@ -504,17 +505,20 @@
 					font-size: 14px;
 					font-size: 14px;
 					margin-top: 14px;
 					margin-top: 14px;
 				}
 				}
-				.direct-collection .content-box ul li span{
+				.direct-collection .content-box ul li.line:last-child{
+					margin-bottom: 10px;
+				}
+				.direct-collection .content-box ul li.line span{
 					float: left;
 					float: left;
 					display: inline-block;
 					display: inline-block;
 					height: 26px;
 					height: 26px;
 				}
 				}
-				.direct-collection .content-box ul li span.price{
+				.direct-collection .content-box ul li.line span.price{
 					position: relative;
 					position: relative;
 					width: 125px;
 					width: 125px;
 					margin: 0 36px 0 14px;
 					margin: 0 36px 0 14px;
 				}
 				}
-				.direct-collection .content-box ul li span.price em{
+				.direct-collection .content-box ul li.line span.price em{
 					display: inline-block;
 					display: inline-block;
 					width: 21px;
 					width: 21px;
 					height: 26px;
 					height: 26px;
@@ -525,7 +529,16 @@
 					color: #fff;
 					color: #fff;
 					text-align: center;
 					text-align: center;
 				}
 				}
-				.direct-collection .content-box ul li span.price input {
+				.direct-collection .content-box ul li.line span.price p{
+					width: 125px;
+					border: solid 1px #ffe8d6;
+					height: 26px;
+					display: inline-block;
+					background: #fff;
+					text-align: center;
+					font-size: 14px;
+				}
+				.direct-collection .content-box ul li.line span.price input {
 					width: 104px;
 					width: 104px;
 					height: 26px;
 					height: 26px;
 					padding: 0;
 					padding: 0;
@@ -533,55 +546,66 @@
 					float: right;
 					float: right;
 					border-radius: 0;
 					border-radius: 0;
 					text-align: center;
 					text-align: center;
-					font-size: 12px;
+					font-size: 14px;
 				}
 				}
-				.direct-collection .content-box ul li span.time{
-					width: 125px;
+				.direct-collection .content-box ul li.line span.time{
+					width: 140px;
 					position: relative;
 					position: relative;
 					margin: 0 0 0 14px;
 					margin: 0 0 0 14px;
 				}
 				}
-				.direct-collection .content-box ul li span:first-child{
+				.direct-collection .content-box ul li.line span.time p{
+					width: 125px;
+					border: solid 1px #ffe8d6;
+					height: 26px;
+					display: inline-block;
+					background: #fff;
+					text-align: center;
+					font-size: 14px;
+				}
+				.direct-collection .content-box ul li.line span:first-child{
 					margin-left: 14px;
 					margin-left: 14px;
 				}
 				}
-				.direct-collection .content-box ul li span.time input{
+				.direct-collection .content-box ul li.line span.time input{
 					height: 26px;
 					height: 26px;
 					padding: 0;
 					padding: 0;
 					line-height: 26px;
 					line-height: 26px;
-					text-align: center;
+					/*text-align: center;*/
 					font-size: 12px;
 					font-size: 12px;
 					border-radius: 0;
 					border-radius: 0;
+					padding-left: 5px;
 				}
 				}
-				.direct-collection .content-box ul li span.time button.open {
+				.direct-collection .content-box ul li.line span.time button.open {
 					position: absolute;
 					position: absolute;
 					right: 4px;
 					right: 4px;
 					top: 1px;
 					top: 1px;
-					width: 20px;
+					width: 18px;
 					height: 24px;
 					height: 24px;
-					background: url(static/img/icon/icon-xiala.png) right no-repeat #fff !important;
+					background: url(static/img/icon/icon-xiala.png) right no-repeat transparent !important;
 					background-position-x: 100% !important;
 					background-position-x: 100% !important;
 					border: none;
 					border: none;
 				}
 				}
-				.direct-collection .content-box ul li span.add-span{
+				.direct-collection .content-box ul li.line span.add-span{
 					margin-left: 10px;
 					margin-left: 10px;
 				}
 				}
-				.direct-collection .content-box ul li span.add-span button{
+				.direct-collection .content-box ul li.line span.add-span button{
 					border: none;
 					border: none;
 					font-size: 18px;
 					font-size: 18px;
 					background: none;
 					background: none;
 				}
 				}
-				.direct-collection .content-box ul li span.add-span button.reduce{
+				.direct-collection .content-box ul li.line span.add-span button.reduce{
 					color: #ff8522;
 					color: #ff8522;
 					margin-right: 3px;
 					margin-right: 3px;
 				}
 				}
-				.direct-collection .content-box ul li span.add-span button.add{
+				.direct-collection .content-box ul li.line span.add-span button.add{
 					color: #32b500;
 					color: #32b500;
+					margin-right: 3px;
 				}
 				}
-				.direct-collection .content-box .deal-btn{
+				.direct-collection .content-box ul li.line .deal-btn{
 					width: 140px;
 					width: 140px;
 					float: right;
 					float: right;
 					margin-right: 24px;
 					margin-right: 24px;
 				}
 				}
-				.direct-collection .content-box .deal-btn a{
+				.direct-collection .content-box .deal-btn button{
 					width: 60px;
 					width: 60px;
 					height: 26px;
 					height: 26px;
 					display: inline-block;
 					display: inline-block;
@@ -589,84 +613,103 @@
 					line-height: 26px;
 					line-height: 26px;
 					font-size: 14px;
 					font-size: 14px;
 					float: left;
 					float: left;
+					border: none;
 				}
 				}
-				.direct-collection .content-box .deal-btn a.off{
+				.direct-collection .content-box .deal-btn button.off{
 					background: #cdcccc;
 					background: #cdcccc;
-					color: #666;
+					color: #fff;
 					margin-right: 20px;
 					margin-right: 20px;
 				}
 				}
-				.direct-collection .content-box .deal-btn a.ok{
+				.direct-collection .content-box .deal-btn button.ok{
 					background: #5078cb;
 					background: #5078cb;
 					color: #fff;
 					color: #fff;
 				}
 				}
-				.direct-collection .content-box .deal-btn a:hover{
+				.direct-collection .content-box .deal-btn button:hover{
 					background: #337ab7;
 					background: #337ab7;
 					color: #fff;
 					color: #fff;
 				}
 				}
-				.direct-collection .content-box ul li em.show-img{
+				.direct-collection .content-box ul li.line em.show-img{
 					margin-left: 6px;
 					margin-left: 6px;
 				}
 				}
-				.direct-collection .content-box ul li em img{
+				.direct-collection .content-box ul li.line em img{
 					position: relative;
 					position: relative;
 					top: -2px;
 					top: -2px;
 				}
 				}
+				.direct-collection .content-box ul li.line .dropdown-menu{
+					width: 256px;
+				}
+				.direct-collection .content-box ul li.line .dropdown-menu span{
+					margin: 0;
+					height: auto;
+				}
+				.direct-collection .content-box ul li.line .dropdown-menu button{
+					border: none;
+				}
 			</style>
 			</style>
 			<div class="direct-collection">
 			<div class="direct-collection">
 				<div class="head">开通  <em>【直接收款】</em> 功能,无需等待商城结算
 				<div class="head">开通  <em>【直接收款】</em> 功能,无需等待商城结算
-					<span ng-click="open = !open"><button ng-class="{'active': !open}"></button></span>
+					<span ng-click="switchToggle(isShow)"><button ng-class="{'active': !isShow}"></button></span>
 				</div>
 				</div>
-				<div class="content-box" ng-if="open">
+				<div class="content-box" ng-if="isShow">
 					<ul>
 					<ul>
-						<li>
-							<span>第一期</span>
-							<span class="price">
-								<em>$</em>
-								<input type="text" class="form-control"  placeholder="请输入金额"/>
+						<li ng-repeat="item in purchase.installment.installmentDetails" class="line" ng-if="installmentBox">
+							<span>第{{$index+1}}期</span>
+							<span class="price" ng-if="!editBox">
+								<p ng-bind="item.price | currencySysmbol : purchase.currency"></p>
 							</span>
 							</span>
-							<span>要求付款日期</span>
-							<span class="time">
-								<input  type="text" class="form-control" placeholder="要求付款日期"/>
-								<button class="open" ng-click=""></button>
-							</span>
-							<!--<span class="add-span">-->
-								<!--<button class="reduce"><i class="fa fa-minus-circle"></i></button>-->
-							<!--</span>-->
-							<em class="show-img"><img src="static/img/icon/pay-ok-icon.png"/></em>
-						</li>
-						<li>
-							<span>第二期</span>
-							<span class="price">
-								<em>$</em>
-								<input type="text" class="form-control"  placeholder="请输入金额"/>
+							<span class="price" ng-if="editBox">
+								<em ng-bind="purchase.currency == RMB ? '$' : '¥'"></em>
+								<input type="text" class="form-control"  placeholder="请输入金额" ng-model="item.price" ng-blur="changeInstallmentPrice(item.price)"/>
 							</span>
 							</span>
 							<span>要求付款日期</span>
 							<span>要求付款日期</span>
-							<span class="time">
-								<input  type="text" class="form-control" placeholder="要求付款日期"/>
-								<button class="open" ng-click=""></button>
+							<span class="time" style="width: 125px;" ng-if="!editBox">
+								<p ng-bind="item.deadline | date : 'yyyy-MM-dd'"></p>
 							</span>
 							</span>
-							<span class="add-span">
-								<button class="reduce"><i class="fa fa-minus-circle"></i></button>
+							<span class="time" ng-if="editBox">
+								<input type="text" ng-model="item.deadline"
+									   class="form-control" placeholder="要求付款日期"
+									   datepicker-popup="yyyy-MM-dd HH:mm:ss"
+									   is-open="item.deadlineShow"
+									   min-date="startDate" current-text="今天" clear-text="清除" close-text="关闭"
+									   ng-click="openDatePicker($event, item, 'deadlineShow')"
+									   datepicker-options="{formatDayTitle: 'yyyy年M月', formatMonth: 'M月', showWeeks: false}"
+									   ng-change="changeEndDate()" ng-blur="changeBlurDeadline(item, $index+1)"
+								/>
+								<button class="open" ng-click="openDatePicker($event, item, 'deadlineShow')"></button>
+							</span>
+							<em class="show-img" ng-if="item.status == 504 || item.status == 505"><img src="static/img/icon/pay-ok-icon.png"/></em>
+							<span class="deal-btn" ng-if="purchase.installment.status == 503">
+								<button ng-click="editInstallment()" ng-if="purchase.installment.installmentDetails.length == $index+1 && !editBox" class="ok" style="float: right;">编辑</button>
+								<button ng-click="cancelEdit()" class="off" ng-if="purchase.installment.installmentDetails.length == $index+1 && editBox">取消</button>
+								<button ng-click="updateInstallment(purchase.installment)" class="ok" ng-if="purchase.installment.installmentDetails.length == $index+1 && editBox">保存</button>
 							</span>
 							</span>
 						</li>
 						</li>
-						<li>
-							<span>第三期</span>
+						<li ng-repeat="item in installmentDetails" class="line" ng-if="!installmentBox">
+							<span>第{{$index+1}}期</span>
 							<span class="price">
 							<span class="price">
-								<em>$</em>
-								<input type="text" class="form-control"  placeholder="请输入金额"/>
+								<em ng-bind="purchase.currency == RMB ? '$' : '¥'"></em>
+								<input type="text" class="form-control"  placeholder="请输入金额" ng-model="item.price" ng-blur="changeInstallmentPrice(item.price)"/>
 							</span>
 							</span>
 							<span>要求付款日期</span>
 							<span>要求付款日期</span>
 							<span class="time">
 							<span class="time">
-								<input  type="text" class="form-control" placeholder="要求付款日期"/>
-								<button class="open" ng-click=""></button>
+								<input type="text" ng-model="item.deadline"
+									   class="form-control" placeholder="要求付款日期"
+									   datepicker-popup="yyyy-MM-dd HH:mm:ss"
+									   is-open="item.deadlineShow"
+									   min-date="startDate" current-text="今天" clear-text="清除" close-text="关闭"
+									   ng-click="openDatePicker($event, item, 'deadlineShow')"
+									   datepicker-options="{formatDayTitle: 'yyyy年M月', formatMonth: 'M月', showWeeks: false}"
+									   ng-change="changeEndDate()" ng-blur="changeBlurDeadline(item, $index+1)"
+								/>
+								<button class="open" ng-click="openDatePicker($event, item, 'deadlineShow')"></button>
 							</span>
 							</span>
 							<span class="add-span">
 							<span class="add-span">
-								<button class="add"><i class="fa fa-plus-circle"></i></button>
-								<button class="reduce"><i class="fa fa-minus-circle"></i></button>
+								<button class="add" ng-click="addInstallment()" ng-if="installmentDetails.length-1 ==$index && $index+1 < 5"><i class="fa fa-plus-circle"></i></button>
+								<button class="reduce" ng-click="deleteInstallment($index)" ng-if="installmentDetails.length-1 !=$index"><i class="fa fa-minus-circle"></i></button>
 							</span>
 							</span>
-							<span class="deal-btn">
-								<a ng-click="" class="off">取消</a>
-								<a ng-click="" class="ok">保存</a>
-								<!--<a ng-click="" class="ok">编辑</a>-->
+							<span class="deal-btn" ng-if="installmentDetails.length == $index+1">
+								<button ng-click="cancelSwitch()" class="off">取消</button>
+								<button ng-click="saveInstallment()" class="ok">保存</button>
 							</span>
 							</span>
 						</li>
 						</li>
 					</ul>
 					</ul>
@@ -737,3 +780,92 @@
 		</div>
 		</div>
 	</div>
 	</div>
 </div>
 </div>
+<!--同意取消订单-->
+<div class="com-out-box" style="display: none;">
+	<div class="title">
+		<a ng-click="">&times;</a>
+	</div>
+	<div class="content">
+		<p><i class="fa fa-exclamation-circle"></i>您还未设置收款账户,不可<br/>
+			开通【直接收款】功能。
+		</p>
+		<div class="deal-btn">
+			<a ng-click="">确定</a>
+			<a ng-click="">设置收款账户<i class="fa fa-long-arrow-right"></i></a>
+		</div>
+	</div>
+</div>
+<style>
+	.com-out-box{
+		position: fixed;
+		z-index: 2;
+		height: 150px;
+		opacity: 1;
+		background-color: white;
+		width: 300px;
+		-webkit-box-shadow: 0 5px 15px rgba(0,0,0,.5);
+		box-shadow: 0 5px 15px rgba(0,0,0,.5);
+		margin: -150px 0 0 -90px;
+		top: 55%;
+		left: 50%;
+	}
+	.com-out-box .title{
+		height: 30px;
+		background-color: #5078cb;
+		text-align: right;
+		line-height: 30px;
+	}
+	.com-out-box .title a{
+		color: white;
+		font-size: 28px;
+		position: relative;
+		top: -2px;
+		right: 8px;
+	}
+	.com-out-box .content p{
+		font-size: 14px;
+		text-align: center;
+		line-height:20px;
+	}
+	.com-out-box .content p:first-child{
+		margin-top: 10px;
+		line-height: 24px;
+	}
+	.com-out-box .content p:nth-child(2){
+		font-size: 12px;
+		color: #f00;
+	}
+	.com-out-box .content p i{
+		color: #5078cb;
+		font-size: 18px;
+		margin-right: 8px;
+	}
+	.com-out-box .content div{
+		width: 100%;
+		margin: 0 auto;
+		text-align: center;
+		margin-top: 10px;
+	}
+	.com-out-box .content div a{
+		width: 64px;
+		display: inline-block;
+		height: 25px;
+		line-height: 25px;
+		text-align: center;
+		font-size: 14px;
+		color: #fff;
+		background: #5078cb;
+	}
+	.com-out-box .content div a:first-child{
+		margin-right: 5px;
+	}
+	.com-out-box .content div a:hover{
+		background: #337ab7;
+	}
+	.com-out-box .content div a:last-child{
+		background: none;
+		color: #5078cb;
+		width: auto;
+		font-size: 12px;
+	}
+</style>