|
|
@@ -21,38 +21,38 @@ define(['app/app'], function(app) {
|
|
|
$scope.bills = [];
|
|
|
|
|
|
//获取个人的发票信息
|
|
|
- var getBillInfo = function() {
|
|
|
- Bill.getListPersonal(null, function(data) {
|
|
|
- $scope.bill = {};
|
|
|
- $scope.bills = data;
|
|
|
+ var getBillInfo = function() {
|
|
|
+ Bill.getListPersonal(null, function(data) {
|
|
|
+ $scope.bill = {};
|
|
|
+ $scope.bills = data;
|
|
|
$scope.bill.kind = '1207';
|
|
|
$scope.order.invoicetype = '1207';
|
|
|
- // angular.forEach($scope.bills, function(item) {
|
|
|
- // if(item.kind == '1205') {
|
|
|
- // $scope.bill = item;
|
|
|
- // }
|
|
|
- // });
|
|
|
- }, function(response) {
|
|
|
+ // angular.forEach($scope.bills, function(item) {
|
|
|
+ // if(item.kind == '1205') {
|
|
|
+ // $scope.bill = item;
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ }, function(response) {
|
|
|
if(angular.equals('系统错误', response.data)) {
|
|
|
toaster.pop('error', '获取信息失败');
|
|
|
}else {
|
|
|
toaster.pop('error', '获取订单的信息失败,' + response.data);
|
|
|
}
|
|
|
- });
|
|
|
- };
|
|
|
+ });
|
|
|
+ };
|
|
|
|
|
|
- $scope.deliveryMethod = {
|
|
|
+ $scope.deliveryMethod = {
|
|
|
1301 : '第三方配送',
|
|
|
1302 : '卖家配送',
|
|
|
1303 : '上门自提'
|
|
|
};
|
|
|
|
|
|
- //选择相应的发票信息
|
|
|
+ //选择相应的发票信息
|
|
|
$scope.selectBill = function(kind) {
|
|
|
if(!kind || (kind != '1205' && kind != '1206' && kind != '1207')) {
|
|
|
return ;
|
|
|
}
|
|
|
- getTheKindBill(kind);
|
|
|
+ getTheKindBill(kind);
|
|
|
$scope.order.invoicetype = kind;
|
|
|
$scope.bill.kind = kind;
|
|
|
};
|
|
|
@@ -70,10 +70,10 @@ define(['app/app'], function(app) {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
- //查看价格分段。
|
|
|
- $scope.togglePrice = function (detail) {
|
|
|
- detail.display = detail.display == 'block' ? 'none' : 'block';
|
|
|
- };
|
|
|
+ //查看价格分段。
|
|
|
+ $scope.togglePrice = function (detail) {
|
|
|
+ detail.display = detail.display == 'block' ? 'none' : 'block';
|
|
|
+ };
|
|
|
|
|
|
//获取订单的信息
|
|
|
var getOrderData = function() {
|
|
|
@@ -239,11 +239,11 @@ define(['app/app'], function(app) {
|
|
|
$scope.calculatePrice(detail.number, detail, detail.currencyName);
|
|
|
//计算总价格
|
|
|
$scope.calculateTotal();
|
|
|
- };
|
|
|
- //选择收货的地址。
|
|
|
+ };
|
|
|
+ //选择收货的地址。
|
|
|
$scope.selectAdd = function(address) {
|
|
|
$scope.payment.address = address;
|
|
|
- $scope.formatArea = $scope.payment.address.area.replace(/,/g,' ');
|
|
|
+ $scope.formatArea = $scope.payment.address.area.replace(/,/g,' ');
|
|
|
if ($scope.order.status == 501){
|
|
|
DistributionRule.findUsableRule({area:$scope.payment.address.area}, $scope.storeArray, function (data) {
|
|
|
if (data){
|
|
|
@@ -273,9 +273,13 @@ define(['app/app'], function(app) {
|
|
|
|
|
|
// 添加按钮,每次加1
|
|
|
$scope.add = function(detail){
|
|
|
- var num = NumberService.add(detail.number, detail.goodsHistory.minPackQty);
|
|
|
+ var num = NumberService.add(detail.number, detail.goodsHistory.perQty);
|
|
|
if(Number(num) > detail.goodsHistory.reserve) {
|
|
|
- detail.number = Number(NumberService.sub(detail.goodsHistory.reserve, detail.goodsHistory.reserve %detail.goodsHistory.minPackQty));
|
|
|
+ if(detail.goodsHistory.breakUp) {
|
|
|
+ detail.number = detail.goodsHistory.reserve;
|
|
|
+ }else {
|
|
|
+ detail.number = Number(NumberService.sub(detail.goodsHistory.reserve, detail.goodsHistory.reserve %detail.goodsHistory.minPackQty));
|
|
|
+ }
|
|
|
toaster.pop('info','提示','库存不足');
|
|
|
}else {
|
|
|
detail.number = num;
|
|
|
@@ -303,7 +307,7 @@ define(['app/app'], function(app) {
|
|
|
|
|
|
// 减少按钮,每次减minPackQty
|
|
|
$scope.reduce = function(detail){
|
|
|
- var num = NumberService.sub(detail.number, detail.goodsHistory.minPackQty);
|
|
|
+ var num = NumberService.sub(detail.number, detail.goodsHistory.perQty);
|
|
|
if(Number(num) < detail.goodsHistory.minBuyQty) {
|
|
|
toaster.pop('info', '提示','该商品最少购买' + detail.goodsHistory.minBuyQty + "件");
|
|
|
detail.number = detail.goodsHistory.minBuyQty;
|
|
|
@@ -366,13 +370,21 @@ define(['app/app'], function(app) {
|
|
|
toaster.pop("info", "提示", "该商品最少购买" + detail.goodsHistory.minBuyQty + "件");
|
|
|
detail.number = detail.goodsHistory.minBuyQty;
|
|
|
}else if(detail.number > detail.goodsHistory.reserve){
|
|
|
- detail.number = Number(NumberService.sub(detail.goodsHistory.reserve, detail.goodsHistory.reserve %detail.goodsHistory.minPackQty));
|
|
|
+ if(detail.goodsHistory.breakUp) {
|
|
|
+ detail.number = detail.goodsHistory.reserve;
|
|
|
+ }else{
|
|
|
+ detail.number = Number(NumberService.sub(detail.goodsHistory.reserve, detail.goodsHistory.reserve %detail.goodsHistory.minPackQty));
|
|
|
+ }
|
|
|
toaster.pop('info', '提示','库存不足');
|
|
|
}else {
|
|
|
- var remainder = detail.number % detail.goodsHistory.minPackQty;
|
|
|
- if(remainder != 0) {
|
|
|
- detail.number = Number(NumberService.sub(detail.number, detail.number % detail.goodsHistory.minPackQty));
|
|
|
- detail.number = Number(NumberService.add(detail.number, detail.goodsHistory.minPackQty));
|
|
|
+ if(!detail.goodsHistory.breakUp) {
|
|
|
+ var remandar = detail.number % detail.goodsHistory.minPackQty;
|
|
|
+ if(remandar != 0) {
|
|
|
+ detail.number = Number(NumberService.add(NumberService.sub(detail.number, detail.number % detail.goodsHistory.minPackQty), detail.goodsHistory.minPackQty));
|
|
|
+ if(detail.number > detail.goodsHistory.reserve) {
|
|
|
+ detail.number = NumberService.sub(detail.goodsHistory.reserve, detail.goodsHistory.reserve % detail.goodsHistory.minPackQty);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
$scope.disabledAddAndSub(detail);
|
|
|
@@ -396,28 +408,45 @@ define(['app/app'], function(app) {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
- $scope.deliveryMethod = {
|
|
|
- 1301 : '第三方配送',
|
|
|
- 1302 : '卖家配送',
|
|
|
- 1303 : '上门自提'
|
|
|
- };
|
|
|
-
|
|
|
/**
|
|
|
* 是否失效- +
|
|
|
*/
|
|
|
$scope.disabledAddAndSub = function(detail) {
|
|
|
- if((Number(detail.number) - Number(detail.goodsHistory.minPackQty)) < Number(detail.goodsHistory.minBuyQty)) {
|
|
|
+ if((Number(detail.number) - Number(detail.goodsHistory.perQty)) < Number(detail.goodsHistory.minBuyQty)) {
|
|
|
detail.minusDisabled = true;
|
|
|
}else {
|
|
|
detail.minusDisabled = false;
|
|
|
}
|
|
|
- if(Number(detail.number) + Number(detail.goodsHistory.minPackQty) > Number(detail.goodsHistory.reserve)) {
|
|
|
+ if(Number(detail.number) + Number(detail.goodsHistory.perQty) > Number(detail.goodsHistory.reserve)) {
|
|
|
detail.addDisabled = true;
|
|
|
}else {
|
|
|
detail.addDisabled = false;
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+ //验证配送规则
|
|
|
+ var checkRule = function () {
|
|
|
+ var value = true;
|
|
|
+ angular.forEach($scope.ruleMap, function (v) {
|
|
|
+ if (v.length == 0){
|
|
|
+ value = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return value;
|
|
|
+ };
|
|
|
+ //验证是否选择上门自提,却没有选择自提点
|
|
|
+ var checkTakeSelf = function () {
|
|
|
+ var value = true;
|
|
|
+ angular.forEach($scope.deliveryList, function (v, k) {
|
|
|
+ if (v.method == 1303){
|
|
|
+ if ($scope.takeSelfList[k] == null){
|
|
|
+ value = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return value;
|
|
|
+ };
|
|
|
+
|
|
|
//确认付款
|
|
|
$scope.confirmPay = function() {
|
|
|
if($scope.order.status == 502 || $scope.order.status == 503) {
|
|
|
@@ -621,10 +650,10 @@ define(['app/app'], function(app) {
|
|
|
}
|
|
|
// 人民币为专用增值税发票,美元不开发票 --1205专用增值税发票 --1206普通发票 --1207不开发票
|
|
|
if($scope.order.currency == 'USD') {
|
|
|
- $scope.order.invoicetype = 1207;
|
|
|
+ $scope.order.invoicetype = 1207;
|
|
|
$scope.order.paytype = '1103';
|
|
|
}else {
|
|
|
- $scope.order.invoicetype = 1205;
|
|
|
+ $scope.order.invoicetype = 1205;
|
|
|
$scope.order.paytype = '1102';
|
|
|
}
|
|
|
// 默认选择第三方配送 --1301第三方配送 --卖家配送 --1303上门自提
|
|
|
@@ -707,13 +736,13 @@ define(['app/app'], function(app) {
|
|
|
|
|
|
|
|
|
// 获取当前数量的对应价格区间的单据信息
|
|
|
- if(properPrice.length > 0) {
|
|
|
- detail.usdUnitPrice = properPrice[0].uSDPrice;
|
|
|
- detail.rmbUnitPrice = properPrice[0].rMBPrice;
|
|
|
- }else {
|
|
|
- detail.usdUnitPrice = detail.goodsHistory.prices[detail.goodsHistory.prices.length - 1].uSDPrice;
|
|
|
- detail.rmbUnitPrice = detail.goodsHistory.prices[detail.goodsHistory.prices.length - 1].rMBPrice;
|
|
|
- }
|
|
|
+ if(properPrice.length > 0) {
|
|
|
+ detail.usdUnitPrice = properPrice[0].uSDPrice;
|
|
|
+ detail.rmbUnitPrice = properPrice[0].rMBPrice;
|
|
|
+ }else {
|
|
|
+ detail.usdUnitPrice = detail.goodsHistory.prices[detail.goodsHistory.prices.length - 1].uSDPrice;
|
|
|
+ detail.rmbUnitPrice = detail.goodsHistory.prices[detail.goodsHistory.prices.length - 1].rMBPrice;
|
|
|
+ }
|
|
|
|
|
|
if (currency == 'RMB') {
|
|
|
detail.taxUnitprice = detail.rmbUnitPrice;
|
|
|
@@ -782,7 +811,7 @@ define(['app/app'], function(app) {
|
|
|
$scope.isModify = isModify;
|
|
|
$scope.validEmail = function (email) {
|
|
|
return /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/.test(email)
|
|
|
- };
|
|
|
+ };
|
|
|
|
|
|
$http.get('static/js/prod/data/city.json').success(function(data) {
|
|
|
$scope.division = data;
|
|
|
@@ -800,7 +829,7 @@ define(['app/app'], function(app) {
|
|
|
toaster.pop('error', '系统错误 ' + '加载城市信息失败');
|
|
|
});
|
|
|
|
|
|
- //验证数据
|
|
|
+ //验证数据
|
|
|
$scope.checkForm = function(num) {
|
|
|
var size;
|
|
|
if(num == 1) {
|