|
|
@@ -4,7 +4,7 @@
|
|
|
*/
|
|
|
define(['app/app'], function(app) {
|
|
|
app.register.controller('orderPayCtrl', ['$scope', '$rootScope', '$stateParams', '$modal', '$state', 'Bill', 'toaster', 'Order', '$filter', 'ShippingAddress', 'Ysepay', '$q', 'NumberService', 'Cart', '$timeout', 'DistributionRule', 'TakeSelf', 'StoreInfo', function($scope, $rootScope, $stateParams, $modal, $state, Bill, toaster, Order, $filter, ShippingAddress, Ysepay, $q, NumberService, Cart, $timeout, DistributionRule, TakeSelf, StoreInfo) {
|
|
|
-
|
|
|
+ $scope.userInfo = $rootScope.userInfo;
|
|
|
document.title = '结算页-优软商城';
|
|
|
$rootScope.active = 'buyer_cart';
|
|
|
|
|
|
@@ -571,97 +571,128 @@ define(['app/app'], function(app) {
|
|
|
window.open("user#/invoice", '_self');
|
|
|
};
|
|
|
|
|
|
+ // 安全设置提醒框
|
|
|
+ $scope.openHomeCenterModel = function() {
|
|
|
+ var modalInstance = $modal.open({
|
|
|
+ animation: true,
|
|
|
+ templateUrl: $rootScope.rootPath + '/static/view/usercenter/modal/homeCenter_modal.html',
|
|
|
+ controller:'homeModalCtrl'
|
|
|
+ });
|
|
|
+ modalInstance.result.then(function(){
|
|
|
+ }, function(){
|
|
|
+ });
|
|
|
+ };
|
|
|
+ // 安全级别模态框
|
|
|
+ app.register.controller('homeModalCtrl', ['$rootScope', '$scope', '$modalInstance', 'toaster', '$http', 'ShippingAddress','$state', function($rootScope, $scope, $modalInstance, toaster, $http, ShippingAddress,$state){
|
|
|
+ $rootScope.$on('$stateChangeStart',
|
|
|
+ function(event, toState, toParams, fromState, fromParams){
|
|
|
+ $modalInstance.dismiss();
|
|
|
+ })
|
|
|
+ $scope.goLink = function(op){
|
|
|
+ $state.go('account_manager',{op:op});
|
|
|
+ $modalInstance.dismiss('cancel');
|
|
|
+ }
|
|
|
+ $scope.cancel = function () {
|
|
|
+ $modalInstance.dismiss('cancel');
|
|
|
+ }
|
|
|
+ }]);
|
|
|
+
|
|
|
//确认付款
|
|
|
$scope.imperfect = false;//暂不完善
|
|
|
$scope.confirmPay = function() {
|
|
|
- if($scope.order.status == 502 || $scope.order.status == 503) {
|
|
|
- var arr = [];
|
|
|
- if($scope.order.orderids) {
|
|
|
- arr = $scope.order.orderids.split(",");
|
|
|
- }else {
|
|
|
- arr.push($scope.order.orderid);
|
|
|
- }
|
|
|
- if ($scope.order.currency == 'RMB' && $scope.order.paytype == '1102') {
|
|
|
- paymentEnsure(arr);
|
|
|
- } else if($scope.order.paytype == '1103') {
|
|
|
- $state.go('order_transfer', {orderid : enIdFilter(arr.join("-"))});
|
|
|
- }else {
|
|
|
- toaster.pop('info', '美元请线下付款');
|
|
|
- }
|
|
|
- return ;
|
|
|
- }
|
|
|
- var validRule = checkRule();
|
|
|
- if (!validRule){
|
|
|
- toaster.pop("info", "当前地址部分卖家无法配送,请重新选择地址或与卖家协商处理");
|
|
|
- return ;
|
|
|
- }
|
|
|
- var validTakeSelf = checkTakeSelf();
|
|
|
- if (!validTakeSelf){
|
|
|
- toaster.pop("info", "请选择一个自提点");
|
|
|
- return ;
|
|
|
- }
|
|
|
- var orderInfos = [], orderInfo;
|
|
|
- orderInfo = generateOrderInfo();
|
|
|
- if(orderInfo == null) {
|
|
|
- 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) {
|
|
|
- if (data.data && data.data[0]) {
|
|
|
- var arr = [];
|
|
|
- var batchCodes = [];
|
|
|
- for(var i = 0; i < data.data.length; i++) {
|
|
|
- arr.push(data.data[i].orderid);
|
|
|
- for(var j = 0; j < data.data[i].orderDetails.length; j++) {
|
|
|
- batchCodes.push(data.data[i].orderDetails[j].batchCode);
|
|
|
- }
|
|
|
- }
|
|
|
- if(!$scope.order.buyNow) {
|
|
|
- Cart.deleteByBatchCode({}, batchCodes, function(data) {
|
|
|
- }, function(response) {
|
|
|
- });
|
|
|
- }
|
|
|
- if ($scope.order.currency == 'RMB' && $scope.order.paytype == '1102') {
|
|
|
- paymentEnsure(arr);
|
|
|
- } else if($scope.order.paytype == '1103') {
|
|
|
- console.log(arr.length)
|
|
|
- if(arr.length != 1){
|
|
|
- $state.go('downPayment', {orderid : enIdFilter(arr.join('-'))});
|
|
|
- }else {
|
|
|
- $state.go('order_transfer', {orderid : enIdFilter(arr.join('-'))});
|
|
|
- }
|
|
|
- }else {
|
|
|
- toaster.pop('info', '美元请线下付款');
|
|
|
- $state.go('buyer_order');
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }else {
|
|
|
- if(data.code == 6) { //产品信息有更新
|
|
|
- toaster.pop('warning', data.message + ",请刷新界面之后重新操作");
|
|
|
- }else if(data.code == 7){
|
|
|
- toaster.pop('warning', data.message + ",将为您跳转到购物车界面");
|
|
|
- $timeout(function () {
|
|
|
- $state.go('buyer_cart');
|
|
|
- }, 1000);
|
|
|
- }else {
|
|
|
- toaster.pop('warning', data.message);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }, function(response) {
|
|
|
- toaster.pop('error', '确认订单失败,' + response.data);
|
|
|
- });
|
|
|
+ // 安全级别
|
|
|
+ if (!$scope.userInfo.pwdEnable || !$scope.userInfo.haveUserQuestion||!$scope.userInfo.emailValidCode || $scope.userInfo.emailValidCode != 2) {
|
|
|
+ $scope.openHomeCenterModel();
|
|
|
+ } else {
|
|
|
+ if($scope.order.status == 502 || $scope.order.status == 503) {
|
|
|
+ var arr = [];
|
|
|
+ if($scope.order.orderids) {
|
|
|
+ arr = $scope.order.orderids.split(",");
|
|
|
+ }else {
|
|
|
+ arr.push($scope.order.orderid);
|
|
|
+ }
|
|
|
+ if ($scope.order.currency == 'RMB' && $scope.order.paytype == '1102') {
|
|
|
+ paymentEnsure(arr);
|
|
|
+ } else if($scope.order.paytype == '1103') {
|
|
|
+ $state.go('order_transfer', {orderid : enIdFilter(arr.join("-"))});
|
|
|
+ }else {
|
|
|
+ toaster.pop('info', '美元请线下付款');
|
|
|
+ }
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ var validRule = checkRule();
|
|
|
+ if (!validRule){
|
|
|
+ toaster.pop("info", "当前地址部分卖家无法配送,请重新选择地址或与卖家协商处理");
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ var validTakeSelf = checkTakeSelf();
|
|
|
+ if (!validTakeSelf){
|
|
|
+ toaster.pop("info", "请选择一个自提点");
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ var orderInfos = [], orderInfo;
|
|
|
+ orderInfo = generateOrderInfo();
|
|
|
+ if(orderInfo == null) {
|
|
|
+ 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) {
|
|
|
+ if (data.data && data.data[0]) {
|
|
|
+ var arr = [];
|
|
|
+ var batchCodes = [];
|
|
|
+ for(var i = 0; i < data.data.length; i++) {
|
|
|
+ arr.push(data.data[i].orderid);
|
|
|
+ for(var j = 0; j < data.data[i].orderDetails.length; j++) {
|
|
|
+ batchCodes.push(data.data[i].orderDetails[j].batchCode);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!$scope.order.buyNow) {
|
|
|
+ Cart.deleteByBatchCode({}, batchCodes, function(data) {
|
|
|
+ }, function(response) {
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if ($scope.order.currency == 'RMB' && $scope.order.paytype == '1102') {
|
|
|
+ paymentEnsure(arr);
|
|
|
+ } else if($scope.order.paytype == '1103') {
|
|
|
+ console.log(arr.length)
|
|
|
+ if(arr.length != 1){
|
|
|
+ $state.go('downPayment', {orderid : enIdFilter(arr.join('-'))});
|
|
|
+ }else {
|
|
|
+ $state.go('order_transfer', {orderid : enIdFilter(arr.join('-'))});
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ toaster.pop('info', '美元请线下付款');
|
|
|
+ $state.go('buyer_order');
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ if(data.code == 6) { //产品信息有更新
|
|
|
+ toaster.pop('warning', data.message + ",请刷新界面之后重新操作");
|
|
|
+ }else if(data.code == 7){
|
|
|
+ toaster.pop('warning', data.message + ",将为您跳转到购物车界面");
|
|
|
+ $timeout(function () {
|
|
|
+ $state.go('buyer_cart');
|
|
|
+ }, 1000);
|
|
|
+ }else {
|
|
|
+ toaster.pop('warning', data.message);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }, function(response) {
|
|
|
+ toaster.pop('error', '确认订单失败,' + response.data);
|
|
|
+ });
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
// 跳银盛支付页面
|