|
@@ -15,6 +15,7 @@ define(['$', 'template', 'order', 'native', 'helper', 'user', 'api', 'config', '
|
|
|
/* 从首页传来的产品数据 */
|
|
|
var product;
|
|
|
var backHash;
|
|
|
+ var extraJson = '';
|
|
|
/* 软键盘弹出与消失时布局变动。 */
|
|
|
function checkScroll(pageData, callback) {
|
|
|
if (pageData.scroll) {
|
|
@@ -660,6 +661,24 @@ define(['$', 'template', 'order', 'native', 'helper', 'user', 'api', 'config', '
|
|
|
order.precedence = precedence;
|
|
|
// 更新预定时间组件
|
|
|
$('.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));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
}]);
|
|
@@ -670,7 +689,7 @@ define(['$', 'template', 'order', 'native', 'helper', 'user', 'api', 'config', '
|
|
|
|
|
|
if ($(this).hasClass('disabled')) return;
|
|
|
event.preventDefault();
|
|
|
- var extraJson = '';
|
|
|
+
|
|
|
if (product.extra && !order.appendID) {
|
|
|
$doc.trigger('spa:openpanel', ['simpleAlert', {
|
|
|
message: '请选择服务'
|
|
@@ -702,6 +721,7 @@ define(['$', 'template', 'order', 'native', 'helper', 'user', 'api', 'config', '
|
|
|
},
|
|
|
callback: {
|
|
|
// 在picker页面挑选之后,回到这个页面时执行的回调。pickValue:选中的优惠券的ID;
|
|
|
+
|
|
|
onSelect: function (pickValue) {
|
|
|
if (pickValue == '') {
|
|
|
$('.coupon-selected-name', $view).text('不使用');
|