|
@@ -491,8 +491,14 @@ define(['$', 'template', 'order', 'native', 'helper', 'user', 'api', 'config', '
|
|
|
/* 点击数量-1 */
|
|
|
$.newTouch('.btn-sub', function (event) {
|
|
|
if (order.productCount <= 1) return;
|
|
|
+ if (order.price == 0) {
|
|
|
+ $doc.trigger('spa:openpanel', ['simpleAlert', {
|
|
|
+ message: '请选择extra'
|
|
|
+ }]);
|
|
|
+ return;
|
|
|
+ }
|
|
|
order.productCount--;
|
|
|
- order.cost = order.productCount * product.price;
|
|
|
+ order.cost = order.productCount * order.price;
|
|
|
$('.service-count', $view).find('.num').html(order.productCount);
|
|
|
/* 算账 */
|
|
|
var $orderCost = $('.order-cost', $view);
|
|
@@ -503,8 +509,14 @@ define(['$', 'template', 'order', 'native', 'helper', 'user', 'api', 'config', '
|
|
|
/* 点击数量+1 */
|
|
|
$.newTouch('.btn-add', function (event) {
|
|
|
if (order.productCount >= 99) return;
|
|
|
+ if (order.price == 0) {
|
|
|
+ $doc.trigger('spa:openpanel', ['simpleAlert', {
|
|
|
+ message: '请选择extra'
|
|
|
+ }]);
|
|
|
+ return;
|
|
|
+ }
|
|
|
order.productCount++;
|
|
|
- order.cost = order.productCount * product.price;
|
|
|
+ order.cost = order.productCount * order.price;
|
|
|
$('.service-count', $view).find('.num').html(order.productCount);
|
|
|
/* 算账 */
|
|
|
var $orderCost = $('.order-cost', $view);
|
|
@@ -708,7 +720,7 @@ define(['$', 'template', 'order', 'native', 'helper', 'user', 'api', 'config', '
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
- if (product.extra.length && !order.appendID) {
|
|
|
+ if (product.extra && !order.appendID) {
|
|
|
$doc.trigger('spa:openpanel', ['simpleAlert', {
|
|
|
message: '请选择extra'
|
|
|
}]);
|
|
@@ -794,10 +806,6 @@ define(['$', 'template', 'order', 'native', 'helper', 'user', 'api', 'config', '
|
|
|
order.productType = product.type;
|
|
|
order.productID = product.id;
|
|
|
order.productCount = 1;
|
|
|
- if (!product.extra.length){
|
|
|
- order.price = product.price;
|
|
|
- order.cost = product.price * order.productCount;
|
|
|
- }
|
|
|
/* 根据product建立渲染页面的数据 */
|
|
|
var tmpData = {
|
|
|
/* 环境,目前只决定是否显示保洁师 */
|
|
@@ -806,8 +814,6 @@ define(['$', 'template', 'order', 'native', 'helper', 'user', 'api', 'config', '
|
|
|
showNavBar: !config.isWX && !config.isChubao,
|
|
|
/* 标题栏的标题 */
|
|
|
title: product.type_str,
|
|
|
- /* 是否显示extra选择项 */
|
|
|
- showExtra: product.extra.length,
|
|
|
/* extra选择项 */
|
|
|
extra: product.extra,
|
|
|
/* 如果用户有优惠券,则显示优惠券的选择栏 */
|
|
@@ -820,11 +826,13 @@ define(['$', 'template', 'order', 'native', 'helper', 'user', 'api', 'config', '
|
|
|
$view.find('.spa-page-body').html(tpl);
|
|
|
/* 绑定费用数据 */
|
|
|
var $orderCost = $('.order-cost', $view);
|
|
|
- if (product.extra.length){
|
|
|
- $orderCost.data('cost', '0');
|
|
|
+ if (product.extra){
|
|
|
+ order.cost = 0;
|
|
|
}else {
|
|
|
- $orderCost.data('cost', product.price);
|
|
|
+ order.price = product.price;
|
|
|
+ order.cost = product.price * order.productCount;
|
|
|
}
|
|
|
+ $orderCost.data('cost', order.cost);
|
|
|
$orderCost.data('coupon', '0');
|
|
|
payCharge($orderCost);
|
|
|
|