|
@@ -29,22 +29,21 @@ define(['$', 'template', 'order', 'native', 'helper', 'user', 'api', 'config', '
|
|
|
callback();
|
|
|
}
|
|
|
}, 50);
|
|
|
+
|
|
|
pageData.scrollCheckAutoCancel = setTimeout(function () {
|
|
|
clearInterval(pageData.scrollCheck);
|
|
|
-
|
|
|
}, 500);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/* 返回上一级 */
|
|
|
- function back(backHash) {
|
|
|
- //event.preventDefault();
|
|
|
-
|
|
|
+ function back(event) {
|
|
|
+ event.preventDefault();
|
|
|
$(document).trigger('spa:navigate', {
|
|
|
- hash: backHash,
|
|
|
- //pushData: {
|
|
|
- // dontNeedReload: true
|
|
|
- //}
|
|
|
+ hash: '',
|
|
|
+ pushData: {
|
|
|
+ dontNeedReload: true
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -232,30 +231,15 @@ define(['$', 'template', 'order', 'native', 'helper', 'user', 'api', 'config', '
|
|
|
|
|
|
/* 三个返回操作 */
|
|
|
$.newTouch('.back-button', function (event) {
|
|
|
- event.preventDefault();
|
|
|
-
|
|
|
- var pushData = pageData.pushData;
|
|
|
- back.call(this, pushData['backHash']);
|
|
|
+ back.call(this, event);
|
|
|
}, $view);
|
|
|
$view.on('tapBackButton', function (event) {
|
|
|
- event.preventDefault();
|
|
|
-
|
|
|
- var pushData = pageData.pushData;
|
|
|
- back.call(this, pushData['backHash']);
|
|
|
+ back.call(this, event);
|
|
|
});
|
|
|
$view.on('swipeRight', function (event) {
|
|
|
- event.preventDefault();
|
|
|
-
|
|
|
- var pushData = pageData.pushData;
|
|
|
- back.call(this, pushData['backHash']);
|
|
|
+ back.call(this, event);
|
|
|
});
|
|
|
- /*setTimeOut*/
|
|
|
- setInterval(function () {
|
|
|
- if (product.name == "活动产品") {
|
|
|
- $('.show-time-picker').css('display', 'none');
|
|
|
- $('.o2o-singles-day').css('display', 'inline');
|
|
|
- }
|
|
|
- }, 50);
|
|
|
+
|
|
|
/* 点击查看详情。跳转到product页面 */
|
|
|
$.newTouch('.product-pic-o2o', function (event) {
|
|
|
$doc.trigger('spa:navigate', {
|
|
@@ -266,11 +250,11 @@ define(['$', 'template', 'order', 'native', 'helper', 'user', 'api', 'config', '
|
|
|
}
|
|
|
});
|
|
|
}, $view);
|
|
|
+
|
|
|
/*特效*/
|
|
|
setInterval(function run() {
|
|
|
$('.product-img').fadeToggle();
|
|
|
- }, 500);
|
|
|
-
|
|
|
+ },500);
|
|
|
/* 点击选择extra。 */
|
|
|
$.newTouch('.btn-main-service', function (event) {
|
|
|
/* on代表这一条的选中状态。如果已经选中了,就return。this的作用域是这一条extra。 */
|
|
@@ -673,67 +657,6 @@ define(['$', 'template', 'order', 'native', 'helper', 'user', 'api', 'config', '
|
|
|
}, $view);
|
|
|
|
|
|
/* 点击选择优惠券 */
|
|
|
- /* $.newTouch('.show-coupon-picker', function (event) {
|
|
|
- if ($(this).hasClass('disabled')) return;
|
|
|
- event.preventDefault();
|
|
|
-
|
|
|
- var extraJson = '';
|
|
|
- if (product.extra && !order.appendID) {
|
|
|
- $doc.trigger('spa:openpanel', ['simpleAlert', {
|
|
|
- message: '请选择服务'
|
|
|
- }]);
|
|
|
- return;
|
|
|
- } else {
|
|
|
- extraJson = JSON.stringify([{type: order.appendID, price: order.price}]);
|
|
|
- }
|
|
|
-
|
|
|
- // 必须先选择时间
|
|
|
- if (!order.bookingDate && product.name !== "活动产品") {
|
|
|
- $doc.trigger('spa:openpanel', ['simpleAlert', {
|
|
|
- message: '请选择服务时间'
|
|
|
- }]);
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- // 跳转到picker页面,展示优惠券
|
|
|
- $doc.trigger('spa:navigate', {
|
|
|
- hash: 'picker',
|
|
|
- pushData: {
|
|
|
- title: '选择优惠券',
|
|
|
- backHash: 'placeOrder',
|
|
|
- products: JSON.stringify([{
|
|
|
- product_id: order.productID,
|
|
|
- count: order.productCount
|
|
|
- }]),
|
|
|
- time: order.bookingDate + ' ' + order.bookingTime + ':00',
|
|
|
- type: order.productType,
|
|
|
- extraJson: extraJson
|
|
|
- },
|
|
|
- callback: {
|
|
|
- // 在picker页面挑选之后,回到这个页面时执行的回调。pickValue:选中的优惠券的ID;
|
|
|
- onSelect: function (pickValue) {
|
|
|
- if (pickValue == '') {
|
|
|
- $('.coupon-selected-name', $view).text('不使用');
|
|
|
- order.couponValue = 0;
|
|
|
- } else {
|
|
|
- for (var i in user.orderCoupons) {
|
|
|
- var couponInfo = user.orderCoupons[i];
|
|
|
- if (couponInfo.id == pickValue) {
|
|
|
- $('.coupon-selected-name', $view).text(couponInfo['coupon']['name']);
|
|
|
- order.couponValue = couponInfo['coupon']['value'];
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- // 填写order
|
|
|
- order.couponID = pickValue;
|
|
|
- // 计算总费用
|
|
|
- payCharge($('.order-cost', $view));
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- }, $view);*/
|
|
|
- /* 点击选择优惠券 */
|
|
|
$.newTouch('.show-coupon-picker', function (event) {
|
|
|
if ($(this).hasClass('disabled')) return;
|
|
|
event.preventDefault();
|
|
@@ -795,7 +718,6 @@ define(['$', 'template', 'order', 'native', 'helper', 'user', 'api', 'config', '
|
|
|
});
|
|
|
}, $view);
|
|
|
|
|
|
-
|
|
|
/* 是否选中同意用户协议,关系到下订单按钮是否激活 */
|
|
|
$.newTouch('.agreement-touch-area', function (event) {
|
|
|
var agreementObj = $('.agreement-checkbox', $view);
|
|
@@ -848,7 +770,7 @@ define(['$', 'template', 'order', 'native', 'helper', 'user', 'api', 'config', '
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- if (!order.bookingTimeStr && product.name !== "活动产品") {
|
|
|
+ if (!order.bookingTimeStr) {
|
|
|
$doc.trigger('spa:openpanel', ['simpleAlert', {
|
|
|
message: '请选择上门时间'
|
|
|
}]);
|
|
@@ -917,7 +839,6 @@ define(['$', 'template', 'order', 'native', 'helper', 'user', 'api', 'config', '
|
|
|
beforeopen: function (pageData, dtd) {
|
|
|
var $view = this;
|
|
|
var pushData = pageData.pushData;
|
|
|
-
|
|
|
/* 只有首页跳转来,才会带有needReset = true */
|
|
|
if (pushData.hasOwnProperty('needReset') && pushData.needReset) {
|
|
|
/* 接收首页传来的product,填写order的productType(产品类型)、productID(产品ID)两个字段 */
|
|
@@ -1007,4 +928,4 @@ define(['$', 'template', 'order', 'native', 'helper', 'user', 'api', 'config', '
|
|
|
native.registerEvent(false);
|
|
|
}
|
|
|
}
|
|
|
-})
|
|
|
+})
|