|
@@ -89,6 +89,8 @@ define(['app/app'], function(app) {
|
|
|
} else if (status == 0){ // 收起
|
|
} else if (status == 0){ // 收起
|
|
|
seek.$status = status;
|
|
seek.$status = status;
|
|
|
}
|
|
}
|
|
|
|
|
+ $scope.selectAmount = 0;
|
|
|
|
|
+ $scope.selectPrice = 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
var clearSeekStatus = function () {
|
|
var clearSeekStatus = function () {
|
|
@@ -228,6 +230,30 @@ define(['app/app'], function(app) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ if ($scope.goods[index].$checked) {
|
|
|
|
|
+ var amount = 0;
|
|
|
|
|
+ angular.forEach($scope.seekListData.content, function (item) {
|
|
|
|
|
+ if (item.$status == 1) {
|
|
|
|
|
+ amount = item.amount;
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ if (amount > 0) {
|
|
|
|
|
+ $scope.selectAmount = 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ $scope.selectPrice = 0;
|
|
|
|
|
+ angular.forEach($scope.goods, function (item, index) {
|
|
|
|
|
+ if (item.$checked) {
|
|
|
|
|
+ if (amount > 0) {
|
|
|
|
|
+ if (amount < $scope.selectAmount + $scope.fragments[index].num) {
|
|
|
|
|
+ $scope.fragments[index].num = amount - $scope.selectAmount;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $scope.selectAmount += $scope.fragments[index].num;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ $scope.selectPrice += $scope.fragments[index].num * $scope.fragments[index].price;
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
$scope.changeNum = function (newNum, index) {
|
|
$scope.changeNum = function (newNum, index) {
|
|
|
var pack = $scope.goods[index].perQty || $scope.goods[index].minPackQty;
|
|
var pack = $scope.goods[index].perQty || $scope.goods[index].minPackQty;
|
|
@@ -329,12 +355,32 @@ define(['app/app'], function(app) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$scope.showUseFlag = false;
|
|
$scope.showUseFlag = false;
|
|
|
- $scope.setShowUseFlag = function (flag, of) {
|
|
|
|
|
|
|
+ $scope.setShowUseFlag = function (flag, offer) {
|
|
|
if (flag) {
|
|
if (flag) {
|
|
|
- $scope.currentOffer = of;
|
|
|
|
|
|
|
+ $scope.currentOffer = offer;
|
|
|
}
|
|
}
|
|
|
$scope.showUseFlag = flag;
|
|
$scope.showUseFlag = flag;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ $scope.selectAmount = 0;
|
|
|
|
|
+ $scope.selectPrice = 0;
|
|
|
|
|
+ $scope.onSelectGoods = function (goods, seek, goodsIndex) {
|
|
|
|
|
+ if (goods.$checked) {
|
|
|
|
|
+ if (seek.amount) {
|
|
|
|
|
+ if (seek.amount < $scope.selectAmount + $scope.fragments[goodsIndex].num) {
|
|
|
|
|
+ goods.$checked = false;
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ $scope.selectAmount += $scope.fragments[goodsIndex].num;
|
|
|
|
|
+ }
|
|
|
|
|
+ $scope.selectPrice += $scope.fragments[goodsIndex].num * $scope.fragments[goodsIndex].price;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if (seek.amount) {
|
|
|
|
|
+ $scope.selectAmount -= $scope.fragments[goodsIndex].num;
|
|
|
|
|
+ }
|
|
|
|
|
+ $scope.selectPrice -= $scope.fragments[goodsIndex].num * $scope.fragments[goodsIndex].price;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}]);
|
|
}]);
|
|
|
});
|
|
});
|