|
|
@@ -42,6 +42,17 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/PurcOrder',
|
|
|
}
|
|
|
});
|
|
|
|
|
|
+ app.factory('Symbol', function(){
|
|
|
+ return {
|
|
|
+ currency: function(cur) {
|
|
|
+ if(cur == 'RMB') return '¥';
|
|
|
+ else if(cur == 'USD') return '$';
|
|
|
+ else if(cur == 'EUR') return '€';
|
|
|
+ else return cur;
|
|
|
+ }
|
|
|
+ };
|
|
|
+ });
|
|
|
+
|
|
|
app.controller('MyCtrl', function($scope, $rootScope) {
|
|
|
$rootScope.$on('$locationChangeSuccess', function(evt, newUrl) {
|
|
|
var routeState = newUrl.substr(newUrl.indexOf('#/') + 2);
|
|
|
@@ -66,32 +77,9 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/PurcOrder',
|
|
|
});
|
|
|
};
|
|
|
});
|
|
|
- app.controller('SaleOrderCtrl', function($scope, $filter, $stateParams, toaster, PurcOrder, PurcOrderItem){
|
|
|
+ app.controller('SaleOrderCtrl', function($scope, $filter, $stateParams, toaster, PurcOrder, PurcOrderItem, Symbol){
|
|
|
$scope.loading = true;
|
|
|
-
|
|
|
- var isNumber = function(n) {
|
|
|
- return !isNaN(parseFloat(n)) && isFinite(n);
|
|
|
- };
|
|
|
- var parseParams = function(requestParams) {
|
|
|
- // parse url params
|
|
|
- for (var key in requestParams) {
|
|
|
- if (key.indexOf('[') >= 0) {
|
|
|
- var params = key.split(/\[(.*)\]/), value = requestParams[key], lastKey = '';
|
|
|
- angular.forEach(params.reverse(), function(name) {
|
|
|
- if (name != '') {
|
|
|
- var v = value;
|
|
|
- value = {};
|
|
|
- value[lastKey = name] = isNumber(v) ? parseFloat(v) : v;
|
|
|
- }
|
|
|
- });
|
|
|
- requestParams[lastKey] = angular.extend(requestParams[lastKey] || {}, value[lastKey]);
|
|
|
- delete requestParams[key];
|
|
|
- } else {
|
|
|
- requestParams[key] = isNumber(requestParams[key]) ? parseFloat(requestParams[key]) : requestParams[key];
|
|
|
- }
|
|
|
- }
|
|
|
- return requestParams;
|
|
|
- };
|
|
|
+ $scope.symbol = Symbol.currency;
|
|
|
|
|
|
$scope.getOrderTotal = function(items) {
|
|
|
var sum = 0;
|
|
|
@@ -110,6 +98,12 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/PurcOrder',
|
|
|
* 展开回复
|
|
|
*/
|
|
|
$scope.expandReply = function(orderItem) {
|
|
|
+ if(!orderItem.replys) {
|
|
|
+ PurcOrderItem.getReply({orderItemId: orderItem.id}, function(data){
|
|
|
+ orderItem.replys = data;
|
|
|
+ console.log(data);
|
|
|
+ }, function(){});
|
|
|
+ }
|
|
|
angular.forEach($scope.purcOrder.orderItems, function(item, index){
|
|
|
if(item.number != orderItem.number) item.expand = false;
|
|
|
});
|
|
|
@@ -159,6 +153,7 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/PurcOrder',
|
|
|
PurcOrder.get({id: $stateParams.code}, function(data) {
|
|
|
$scope.purcOrder = data;
|
|
|
$scope.loading = false;
|
|
|
+ toaster.pop('success', '提示', '回复成功');
|
|
|
});
|
|
|
}, function(response){
|
|
|
$scope.loading = false;
|
|
|
@@ -182,10 +177,11 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/PurcOrder',
|
|
|
PurcOrder.get({id: $stateParams.code}, function(data) {
|
|
|
$scope.purcOrder = data;
|
|
|
$scope.loading = false;
|
|
|
+ toaster.pop('success', '提示', '回复成功');
|
|
|
});
|
|
|
- }, function(response){
|
|
|
+ }, function(data){
|
|
|
$scope.loading = false;
|
|
|
- toaster.pop('error', '回复失败', response.data);
|
|
|
+ toaster.pop('error', '回复失败', data);
|
|
|
});
|
|
|
};
|
|
|
|