Browse Source

采购询价回复

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@437 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d
suntg 11 years ago
parent
commit
94de3cc98f

+ 3 - 11
src/main/webapp/resources/css/index_mobile.css

@@ -94,7 +94,7 @@ a {
 
 @media(min-width: 560px) {
 	.ellipsis{
-		width: 90%;
+		width: 160px;
 	}
 }
 
@@ -120,16 +120,8 @@ a {
 	color: #f40 !important;
 }
 
-/* table */
-table, tr, thead, tbody {
-	width: 100%;
-}
-
-tr {
-	border-bottom: solid 1px #999999;
-}
-td {
-	padding: 5px;
+.text-black {
+	color: #333;
 }
 
 .expand {

+ 63 - 0
src/main/webapp/resources/js/index/mobile.index.app.js

@@ -15,6 +15,9 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ui.
 		}).state('saleChange', {
 			url: '/sale/change/:code',
 			templateUrl: 'static/tpl/index_mobile/sale/saleChange.html'
+		}).state('saleInquiry', {
+			url: '/sale/inquiry/:itemId',
+			templateUrl: 'static/tpl/index_mobile/sale/saleInquiry.html'
 		});
 	});
 	
@@ -223,5 +226,65 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ui.
 			});
 		};
 	});
+	
+	app.controller('SaleInquiryCtrl', function($scope, $stateParams, toaster, PurcInquiry, Symbol){
+		$scope.loading = true;
+		$scope.vendFromDateOpen = false;
+		$scope.vendToDateOpen = false;
+		
+		$scope.symbol = Symbol.currency;//把币别转化为符号
+		
+		PurcInquiry.getItem({itemId: $stateParams.itemId}, function(data){
+			$scope.purcInquiry = data;
+			$scope.loading = false;
+		}, function(data){
+			toaster.pop('error', '加载失败', response.data);
+		});
+		
+		$scope.open = function($event, open) {
+    		$event.preventDefault();
+    		$event.stopPropagation();
+    		open = !open;
+  		};
+  		
+  		$scope.addNewReply = function(reply) {
+  			$scope.purcInquiry.replies.push({price: null, lapQty: null, id: null, editing: true});
+  			reply.editing = false;
+  		};
+  		
+  		$scope.save = function(item) {
+  			$scope.loading = true;
+  			PurcInquiry.saveItem({itemId: item.id}, item, function(data) {
+  				toaster.pop('info', '提示', '保存成功');
+  				PurcInquiry.getItem({itemId: $stateParams.itemId}, function(data){
+					$scope.purcInquiry = data;
+					$scope.loading = false;
+				}, function(data){
+					$scope.loading = false;
+					toaster.pop('error', '加载失败', response.data);
+				});
+  			}, function(response){
+  				$scope.loading = false;
+				toaster.pop('error', '回复失败', response.data);
+  			});
+  		};
+  		
+  		$scope.reply = function(item) {
+  			$scope.loading = true;
+  			PurcInquiry.reply({itemId: item.id}, item, function(data) {
+  				toaster.pop('info', '提示', '回复成功');
+  				PurcInquiry.getItem({itemId: $stateParams.itemId}, function(data){
+					$scope.purcInquiry = data;
+					$scope.loading = false;
+				}, function(data){
+					$scope.loading = false;
+					toaster.pop('error', '加载失败', response.data);
+				});
+  			}, function(response){
+  				$scope.loading = false;
+				toaster.pop('error', '回复失败', response.data);
+  			});
+  		};
+	});
 	return app;
 });

+ 14 - 2
src/main/webapp/resources/js/index/services/Purc.js

@@ -35,10 +35,22 @@ define([ 'ngResource' ], function() {
 	}).factory('PurcInquiry', function($resource) {
 		return $resource('sale/inquiry/:id', {}, {
 			reply: {
-				url: 'sale/inquiry/:inquiryId/reply',
+				url: 'sale/inquiry/items/:itemId/reply',
 				method: 'POST',
 				params: {
-					inquiryId: 'inquiryId'
+					itemId: 'itemId'
+				}
+			}, getItem: {
+				url: 'sale/inquiry/items/:itemId',
+				method: 'GET',
+				params: {
+					itemId: 'itemId'
+				}
+			}, saveItem: {
+				url: 'sale/inquiry/items/:itemId/save',
+				method: 'POST',
+				params: {
+					itemId: 'itemId'
 				}
 			}
 		});

+ 0 - 4
src/main/webapp/resources/tpl/index_mobile/sale/saleChange.html

@@ -3,10 +3,6 @@
 	border-radius: 4px;
 }
 
-.text-black {
-	color: #333;
-}
-
 .order {
 	margin-top: 5px;
 	margin-bottom: 10px;

+ 202 - 0
src/main/webapp/resources/tpl/index_mobile/sale/saleInquiry.html

@@ -0,0 +1,202 @@
+<style>
+	label {
+		margin-bottom: 0px;
+	}
+	.va-top {
+		vertical-align: top;
+	}
+	.text-help {
+		color: #CCCCCC;
+	}
+	.formDate, .toDate, .interval {
+		display: inline-block;
+	}
+	.formDate, .toDate {
+		width: 34%;
+	}
+	.interval {
+		width: 28%;
+		position: relative;
+	}
+	.intervalLeftC, .intervalRightC, .intervalLeftU, .intervalRightU {
+		display: inline-block;
+		height: 2px;
+		width: 50%;
+		line-height: 0;
+	}
+	.intervalLeftC {
+		background: -webkit-linear-gradient(left, #FFFFFF, #009900);
+	}
+	.intervalRightC {
+		background: -webkit-linear-gradient(right, #FFFFFF, #009900);
+	}.intervalLeftU {
+		background: -webkit-linear-gradient(left, #FFFFFF, #FF3300);
+	}
+	.intervalRightU {
+		background: -webkit-linear-gradient(right, #FFFFFF, #FF3300);
+	}
+	
+	.replyItem {
+		border-left: solid 1px #999999;
+		width: 100%;
+		height: 40px;
+		margin-left: 20px;
+		position: relative;
+		margin-bottom: 10px;
+		vertical-align: middle;
+		padding-top: 10px;
+	}
+	
+	.replyTitle {
+		margin-left: 30px;
+		margin-right: 30px;
+		margin-bottom: 5px;
+		border-bottom: solid 1px #888888;
+	}
+	
+	.replyItem .replyCircle {
+		position: absolute;
+		width:10px;
+	    height:10px;
+	    border: solid 1px #999999;
+	    border-radius: 5px;
+	    background-color: #FFFFFF;
+		top: 0px;
+		left: -5px;
+	}
+	
+	.inpuiry tr {
+		margin-bottom: 10px;
+	}
+	
+	.input-group-sm>.input-group-addon {
+		padding: 5px 5px;
+	}
+</style>
+<div ng-controller="SaleInquiryCtrl">
+	<div class="top padding5 bold">
+		<a href="#" class="f16 topText">&nbsp;<i class="fa fa-angle-left"></i>&nbsp;单据详情</a>
+		<div class="right"><i class="fa fa-reorder"></i>&nbsp;&nbsp;</div>
+	</div>
+	<div class="orderInfo padding5">
+		<table>
+			<tr>
+				<td class="va-top text-right"><label class="text-black">客户:</label></td>
+				<td>
+					<span ng-bind="purcInquiry.inquiry.enterprise.enName"></span><br>
+					<span class="text-help">{{purcInquiry.inquiry.enterprise.enAddress}} <i class="fa fa-map-marker"></i></span><br>
+					<span class="text-help text-num">{{purcInquiry.inquiry.enterprise.enTel}} <i class="fa fa-phone"></i></span>
+				</td>
+			</tr>
+			<tr>
+				<td class="va-top text-right"><label class="text-black">单据:</label></td>
+				<td>
+					<span class="text-num" ng-bind="purcInquiry.inquiry.code"></span> {{purcInquiry.status | status}}<br>
+					<span class="text-help text-num">{{purcInquiry.inquiry.date | date:'yyyy-MM-dd'}} </span>
+				</td>
+			</tr>
+			<tr>
+				<td class="va-top text-right"><label class="text-black">物料:</label></td>
+				<td>
+					<span ng-bind="purcInquiry.product.title"></span><br>
+					<span class="text-help" ng-bind="purcInquiry.product.spec"></span><br>
+					<span class="text-help text-num" ng-bind="purcInquiry.product.code"></span>
+				</td>
+			</tr>
+		</table>
+	</div>
+	<div class="padding5" style="min-height: 400px; position: relative;">
+		<div class="loading"  ng-class="{'in': loading}">
+			<i></i>
+		</div>
+		<div style="border-bottom: solid 1px #398439;margin-bottom: 5px;"><label>报价有效期</label></div>
+		<div ng-hide="purcInquiry.fromDate || purcInquiry.toDate" class="text-center text-muted">客户没有指定有效期限!</div>
+		<div ng-show="purcInquiry.fromDate || purcInquiry.toDate"  style="color: #009900; padding-top: 10px;">
+			<div class="formDate text-right">{{purcInquiry.fromDate | date:'yyyy-MM-dd'}}</div>
+			<div class="interval text-center">
+				<div style="position: absolute; top: -7px; width: 100%;">客户指定</div>
+				<div><div class="intervalLeftC"></div><div class="intervalRightC"></div></div>
+			</div>
+			<div class="toDate text-left">{{purcInquiry.toDate | date:'yyyy-MM-dd'}}</div>
+		</div>
+		<div style="padding-top: 10px;">
+			<div class="formDate text-right">
+				<div class=" input-group input-group-sm input-trigger">
+				<input type="text" class="form-control" placeholder="起始日期"
+					datepicker-popup="yyyy-MM-dd" is-open="vendFromDateOpen" ng-model="purcInquiry.vendFromDate"
+					max-date="purcInquiry.vendToDate" ng-required="true" current-text="今天"
+					clear-text="清除" close-text="关闭"
+					datepicker-options="{formatDayTitle: 'yyyy年M月', formatMonth: 'M月', showWeeks: false}"
+					ng-focus="open($event, vendFromDateOpen)"> 
+				<span class="input-group-btn">
+                	<button type="button" class="btn btn-default" ng-click="open($event, vendFromDateOpen)"><i class="glyphicon glyphicon-calendar"></i></button>
+              	</span>
+              	</div>
+			</div>
+			<div class="interval text-center" style="color: #FF3300;">
+				<div style="position: absolute; top: -7px; width: 100%;">您指定</div>
+				<div><div class="intervalLeftU"></div><div class="intervalRightU"></div></div>
+			</div>
+			<div class="toDate text-left">
+				<div class=" input-group input-group-sm input-trigger">
+				<input type="text" class="form-control" placeholder="截止日期"
+					datepicker-popup="yyyy-MM-dd" is-open="vendToDateOpen" ng-model="purcInquiry.vendToDate"
+					min-date="purcInquiry.vendFromDate" ng-required="true" current-text="今天"
+					clear-text="清除" close-text="关闭"
+					datepicker-options="{formatDayTitle: 'yyyy年M月', formatMonth: 'M月', showWeeks: false}"
+					ng-focus="open($event, vendToDateOpen)"> 
+				<span class="input-group-btn">
+                	<button type="button" class="btn btn-default" ng-click="open($event, vendToDateOpen)"><i class="glyphicon glyphicon-calendar"></i></button>
+              	</span>
+              	</div>
+			</div>
+		</div>
+		<div style="border-bottom: solid 1px #398439;margin-bottom: 5px;"><label>分段报价</label></div>
+		<div class="inquiry">
+			<table class="table table-condensed table-bordered table-striped text-center ">
+				<tr>
+					<th style="width: 5%;"><th style="width: 35%;">分段数量({{purcInquiry.product.unit}})</th><th style="width: 30%;">分段单价</th><th></th>
+				</tr>
+				<tr ng-repeat="reply in purcInquiry.replies">
+					<td>{{$index + 1}}</td>
+					<td>
+						<span ng-if="!reply.editing" class="text-num">≥ {{reply.lapQty}}</span>
+						<div ng-if="reply.editing" class=" input-group input-group-sm">
+							<span class="input-group-addon">≥</span>
+							<input type="number" ng-disabled="$first || purchInqiry.custLap" class="form-control" ng-model="reply.lapQty">
+		              	</div>
+					</td>
+					<td>
+						<span ng-if="!reply.editing" class="text-num">{{reply.price | currency: symbol(purcInquiry.currency)}}</span>
+						<div ng-if="reply.editing" class=" input-group input-group-sm">
+							<span class="input-group-addon">{{symbol(purcInquiry.currency)}}</span>
+							<input type="number" class="form-control" ng-model="reply.price">
+		              	</div>
+					</td>
+					<td class="text-left">
+						<span ng-if="!reply.editing" class="btn btn-default btn-sm" ng-click="reply.editing = true" ng-disabled="purcInquiry.status != 200">
+							<i class="fa fa-pencil"></i>
+						</span>
+						<span ng-if="reply.editing" class="btn btn-default btn-sm" ng-click="reply.editing = false" ng-disabled="purcInquiry.status != 200">
+							<i class="fa fa-save"></i>
+						</span>
+						<span ng-if="!$first" class="btn btn-warning btn-sm" ng-click="purcInquiry.replies.splice($index,1)" ng-disabled="purcInquiry.status != 200">
+							<i class="fa fa-trash"></i>
+						</span>
+						<span ng-if="$last && $index<9" class="btn btn-success btn-sm" ng-click="addNewReply(reply)" ng-disabled="purcInquiry.status != 200">
+							<i class="fa fa-plus"></i>
+						</span>
+					</td>
+				</tr>
+			</table>
+		</div>
+		<div style="width: 100%;" class="btn-group" role="group">
+				<button style="width: 40%;" type="button" class="btn btn-default" ng-click="reply(purcInquiry)" ng-disabled="purcInquiry.status != 200">
+					<label><i class="fa fa-reply"></i> 回复</label>
+				</button>
+  				<button style="width: 60%;" type="button" class="btn btn-default" ng-click="save(purcInquiry)" ng-disabled="purcInquiry.status != 200">
+  					<label><i class="fa fa-save"></i> 保存</label>
+  				</button>
+		</div>
+	</div>
+</div>

+ 17 - 2
src/main/webapp/resources/tpl/index_mobile/sale/saleOrder.html

@@ -1,3 +1,16 @@
+<style>
+	table, tr, thead, tbody {
+		width: 100%;
+	}
+	
+	tr {
+		border-bottom: solid 1px #999999;
+	}
+	td {
+		padding: 5px;
+	}
+</style>
+
 <div ng-controller="SaleOrderCtrl">
 	<div class="top padding5 bold">
 		<a href="#" class="f16 topText">&nbsp;<i class="fa fa-angle-left"></i>&nbsp;订单详情</a>
@@ -68,8 +81,10 @@
 					<td  colspan="2">
 						<div class="input-group input-group-sm">
 						<input ng-model="orderItem.reply.delivery" class="form-control input-sm" placeholder="交货日期"
-						  datepicker-popup="yyyy-MM-dd" is-open="orderItem.opened" min-date="purcOrder.date" 
-						  ng-required="true" close-text="关闭" ng-focus="open($event, orderItem)" value="{{orderItem.delivery}}">
+						  	datepicker-popup="yyyy-MM-dd" is-open="orderItem.opened" min-date="purcOrder.date" 
+						  	ng-required="true"  current-text="今天" clear-text="清除" close-text="关闭"
+							datepicker-options="{formatDayTitle: 'yyyy年M月', formatMonth: 'M月', showWeeks: false}"
+							ng-focus="open($event, orderItem)">
 						<span class="input-group-btn">
                 			<button type="button" class="btn btn-default" ng-click="open($event, orderItem)"><i class="glyphicon glyphicon-calendar"></i></button>
               			</span>