洪海涛 8 anni fa
parent
commit
6531ef9665

+ 1 - 1
www/webapp/o2o/css/product.css

@@ -496,7 +496,7 @@
 	position: fixed;
 	position: fixed;
 	bottom: 0;
 	bottom: 0;
 	width: 100%;
 	width: 100%;
-	line-height: 30px;
+	line-height: 48px;
 	color: #ffffff;
 	color: #ffffff;
 	text-align: center;
 	text-align: center;
 }
 }

File diff suppressed because it is too large
+ 0 - 0
www/webapp/o2o/dist/css/main.css


File diff suppressed because it is too large
+ 0 - 0
www/webapp/o2o/dist/js/main.js


File diff suppressed because it is too large
+ 0 - 0
www/webapp/o2o/dist/js/page/placeOrder.js


+ 41 - 18
www/webapp/o2o/js/page/placeOrder.js

@@ -281,6 +281,9 @@ define(['$', 'template', 'order', 'native', 'helper', 'user', 'api', 'config', '
 				$('.coupon-selected-name', $view).html('选择优惠券');
 				$('.coupon-selected-name', $view).html('选择优惠券');
 				order.couponValue = 0;
 				order.couponValue = 0;
 				order.couponID = '';
 				order.couponID = '';
+				if ($('.booking-time').text() !== "选择服务时间") {
+					dPicker();
+				}
 				payCharge($('.order-cost', $view));
 				payCharge($('.order-cost', $view));
 			}, $view);
 			}, $view);
 
 
@@ -662,28 +665,48 @@ define(['$', 'template', 'order', 'native', 'helper', 'user', 'api', 'config', '
 							order.precedence = precedence;
 							order.precedence = precedence;
 							// 更新预定时间组件
 							// 更新预定时间组件
 							$('.booking-time', $view).html(order.bookingTimeStr);
 							$('.booking-time', $view).html(order.bookingTimeStr);
-							/*用户选择完时间之后,默认使用优惠券*/
-							extraJson = JSON.stringify([{type: order.appendID, price: order.price}]);
-							var productss = JSON.stringify([{product_id: order.productID, count: order.productCount}]);
-							api.getCouponList({
-								products: productss, //产品
-								booking_time: order.bookingTimeStr, //预订时间
-								user_id: user.id, //用户id
-								type: product.type, //资源
-								extra: extraJson//appendID==extra(一室一卫)    price =价格
-							}, function (res) {
-								if (res.success) {
-									if (typeof(res.data[0]) !== "undefined") {
-										$('.coupon-selected-name', $view).text(res.data[0].coupon.name);
-										order.couponValue = res.data[0].coupon.value;
-										payCharge($('.order-cost', $view));
-									}
-								}
-							});
+							dPicker();
 						}
 						}
 					}
 					}
 				}]);
 				}]);
 			}, $view);
 			}, $view);
+			/*用户选择完时间之后,默认使用优惠券*/
+			var dPicker = function () {
+				extraJson = JSON.stringify([{type: order.appendID, price: order.price}]);
+				var productss = JSON.stringify([{product_id: order.productID, count: order.productCount}]);
+				api.getCouponList({
+					products: productss, //产品
+					booking_time: order.bookingTimeStr, //预订时间
+					user_id: user.id, //用户id
+					type: product.type, //资源
+					extra: extraJson//appendID==extra(一室一卫)    price =价格
+				}, function (res) {
+					if (res.success) {
+						if (typeof(res.data[0]) !== "undefined") {
+							var index = 0;
+							var arrValue = [];
+							var arrCoupon = [];
+							var CouponName;
+							for (var i = 0; i < res.data.length; i++) {
+								arrValue[i] = res.data[i].coupon.value;
+								arrCoupon[i] = res.data[i].coupon;
+							}
+							var max = Math.max.apply(null, arrValue);//最大值
+							for (var j = 0; j < arrCoupon.length; j++) {
+								if (arrCoupon[j].value == max) {
+									CouponName = arrCoupon[j].name;
+								}
+							}
+							console.log(arrCoupon);
+							console.log(arrValue);
+							console.log(index);
+							$('.coupon-selected-name', $view).text(CouponName);
+							order.couponValue = max;
+							payCharge($('.order-cost', $view));
+						}
+					}
+				});
+			};
 
 
 			/* 点击选择优惠券 */
 			/* 点击选择优惠券 */
 			$.newTouch('.show-coupon-picker', function (event) {
 			$.newTouch('.show-coupon-picker', function (event) {

Some files were not shown because too many files changed in this diff