jiaomengxiao пре 8 година
родитељ
комит
6cba7c60da

Разлика између датотеке није приказан због своје велике величине
+ 0 - 0
www/webapp/o2o/dist/js/build/template.js


Разлика између датотеке није приказан због своје велике величине
+ 0 - 0
www/webapp/o2o/dist/js/main.js


+ 1 - 1
www/webapp/o2o/dist/js/model/order.js

@@ -1 +1 @@
-define(["base","$","native","product","api"],function(e,t,n,r,i){var s=function(){if(typeof s.instance=="object")return s.instance;s.instance=this,this.storagePrefix="order_",this.balance=0,this.memo="",this.cost=0,this.price=0,this.bookingDate="",this.bookingTime="",this.bookingTimeStr="",this.address=this.getCache("address",null),this.productType="",this.productID="",this.productCount=1,this.couponID="",this.stationID=this.getCache("stationID",null,""),this.cacheReview=this.getCache("cacheReview",null,""),this.precedence="",this.extraService=[],this.extraServiceType=[],this.serviceName="",this.servicePrice="",this.appendID="",this.beautician={name:"请选择",id:""}};return s.prototype=new e,s.prototype.reset=function(){this.couponID="",this.bookingTime="",this.bookingTimeStr="",this.bookingDate="",this.productType="",this.productID="",this.extraService=[],this.serviceName="",this.servicePrice="",this.productCount=1,this.precedence="",this.extraServiceType=[],this.beautician={name:"",id:""}},s.prototype.addOrder=function(e,t,n){var r=this,s=[{product_id:this.productID,count:this.productCount}],o=[];this.couponID!=""&&o.push(this.couponID);var u="";this.appendID&&(u=JSON.stringify([{type:this.appendID,price:this.price}])),i.addOrder({products:JSON.stringify(s),memo:this.memo,precedence:"0",booking_time:this.bookingDate+" "+this.bookingTime+":00",address_id:this.address.address_id,coupons:JSON.stringify(o),station:this.stationID,type:this.productType,counts:this.productCount,extra:u,tech_id:this.beautician.id,user_id:e,order_channel:t},function(e){e.success&&(r.id=e.data.id),typeof n=="function"&&n(e)})},s.prototype.appendOrder=function(e,t,n,r){var s=this;i.appendOrder({order_id:e,products:n,user_id:t},function(e){e.success&&(s.appendID=e.data.id),typeof r=="function"&&r(e)})},new s});
+define(["base","$","native","product","api"],function(e,t,n,r,i){var s=function(){if(typeof s.instance=="object")return s.instance;s.instance=this,this.storagePrefix="order_",this.memo="",this.cost=0,this.price=0,this.couponValue=0,this.payValue=0,this.bookingDate="",this.bookingTime="",this.bookingTimeStr="",this.address=this.getCache("address",null),this.productType="",this.productID="",this.productCount=1,this.couponID="",this.stationID=this.getCache("stationID",null,""),this.cacheReview=this.getCache("cacheReview",null,""),this.precedence="",this.extraService=[],this.extraServiceType=[],this.serviceName="",this.servicePrice="",this.appendID="",this.beautician={name:"请选择",id:""}};return s.prototype=new e,s.prototype.reset=function(){this.couponID="",this.bookingTime="",this.bookingTimeStr="",this.bookingDate="",this.productType="",this.productID="",this.extraService=[],this.serviceName="",this.servicePrice="",this.productCount=1,this.precedence="",this.extraServiceType=[],this.beautician={name:"",id:""}},s.prototype.addOrder=function(e,t,n){var r=this,s=[{product_id:this.productID,count:this.productCount}],o=[];this.couponID!=""&&o.push(this.couponID);var u="";this.appendID&&(u=JSON.stringify([{type:this.appendID,price:this.price}])),i.addOrder({balance:this.payValue,products:JSON.stringify(s),memo:this.memo,precedence:"0",booking_time:this.bookingDate+" "+this.bookingTime+":00",address_id:this.address.address_id,coupons:JSON.stringify(o),station:this.stationID,type:this.productType,counts:this.productCount,extra:u,tech_id:this.beautician.id,user_id:e,order_channel:t},function(e){e.success&&(r.id=e.data.id),typeof n=="function"&&n(e)})},s.prototype.appendOrder=function(e,t,n,r){var s=this;i.appendOrder({order_id:e,products:n,user_id:t},function(e){e.success&&(s.appendID=e.data.id),typeof r=="function"&&r(e)})},new s});

Разлика између датотеке није приказан због своје велике величине
+ 0 - 0
www/webapp/o2o/dist/js/page/placeOrder.js


Разлика између датотеке није приказан због своје велике величине
+ 0 - 383
www/webapp/o2o/js/build/template.js


+ 7 - 3
www/webapp/o2o/js/model/order.js

@@ -8,10 +8,13 @@ define(['base', '$', 'native', 'product', 'api'], function (base, $, native, pro
         }
         Order.instance = this;
         this.storagePrefix = 'order_';
-        this.balance = 0;
         this.memo = '';
-        this.cost = 0;
-        this.price = 0;
+
+        this.cost = 0; // 总价
+        this.price = 0; // 单价
+        this.couponValue = 0; // 代金券
+        this.payValue = 0; // 实际支付
+
         this.bookingDate = '';
         this.bookingTime = '';
         this.bookingTimeStr = '';
@@ -76,6 +79,7 @@ define(['base', '$', 'native', 'product', 'api'], function (base, $, native, pro
         }
 
         api.addOrder({
+            balance: this.payValue,
             products: JSON.stringify(productParam),
             memo: this.memo,
             precedence: '0',

+ 244 - 261
www/webapp/o2o/js/page/placeOrder.js

@@ -61,14 +61,8 @@ define(['$', 'template', 'order', 'native', 'helper', 'user', 'api', 'config', '
 
     /* 算账。 */
     function payCharge($orderCost) {
-        // 原价
-        var cost = $orderCost.data('cost');
-        // 优惠
-        var coupon = $orderCost.data('coupon');
-        // 结算
-        var pay = parseFloat(cost) - parseFloat(coupon);
-        $orderCost.data('pay', pay);
-        $orderCost.text('¥' + pay);
+        order.payValue = order.cost - order.couponValue;
+        $orderCost.text('¥' + order.payValue);
     }
 
     /* 也是自动选取最大优惠券的操作,只是与setCoupon策略不同
@@ -149,62 +143,62 @@ define(['$', 'template', 'order', 'native', 'helper', 'user', 'api', 'config', '
      */
 
     /* 优惠券取决于主服务、宠物、数量、时间,所以在这几个值改变后要调用这个方法,更新最大优惠
-    function setCoupon(me, pageData, extraServicePrice) {
-        $(document).trigger('spa:openloader');
-        var products = JSON.stringify([{
-            product_id: order['productID'],
-            count: order.productCount
-        }]);
-        var time = order.bookingDate + ' ' + order.bookingTime + ':00';
-        user.getProductCoupon(products, time, cachePageData.productType, function (res) {
-            $(document).trigger('spa:closeloader');
-            if (res.success) {
-                var coupons = user.orderCoupons;
-                var price = 0;
-                if (coupons.length) {
-                    var selectCoupon = user.getMaxAvailableCoupon();
-                    cart['products'][cachePageData.productType]['couponName'] = coupons[selectCoupon.couponIndex].coupon.name;
-                    cart['products'][cachePageData.productType]['couponVal'] = selectCoupon.couponSelectVal;
-                    cart['products'][cachePageData.productType]['couponId'] = coupons[selectCoupon.couponIndex].id;
-                    cart['products'][cachePageData.productType]['couponList'] = coupons;
-
-                    $('.coupon-selected-name', me).html(user.getCouponName(coupons[selectCoupon.couponIndex].id));
-                    $('.coupon-cost', me).html('-' + selectCoupon.couponSelectVal);
-                    $('.select-coupon', me).removeClass('hide');
-                    $('.order-cost', me).attr('data-coupon', selectCoupon.couponSelectVal);
-                    $('.order-list', me).removeClass('hide');
-                    price = parseFloat(order.petPrice) * order.productCount - parseFloat(selectCoupon.couponSelectVal) + parseFloat(extraServicePrice);
+     function setCoupon(me, pageData, extraServicePrice) {
+     $(document).trigger('spa:openloader');
+     var products = JSON.stringify([{
+     product_id: order['productID'],
+     count: order.productCount
+     }]);
+     var time = order.bookingDate + ' ' + order.bookingTime + ':00';
+     user.getProductCoupon(products, time, cachePageData.productType, function (res) {
+     $(document).trigger('spa:closeloader');
+     if (res.success) {
+     var coupons = user.orderCoupons;
+     var price = 0;
+     if (coupons.length) {
+     var selectCoupon = user.getMaxAvailableCoupon();
+     cart['products'][cachePageData.productType]['couponName'] = coupons[selectCoupon.couponIndex].coupon.name;
+     cart['products'][cachePageData.productType]['couponVal'] = selectCoupon.couponSelectVal;
+     cart['products'][cachePageData.productType]['couponId'] = coupons[selectCoupon.couponIndex].id;
+     cart['products'][cachePageData.productType]['couponList'] = coupons;
 
-                } else {
-                    price = parseFloat(order.petPrice) * order.productCount + parseFloat(extraServicePrice);
-
-                    $('.coupon-selected-name', me).html('');
-                    $('.select-coupon', me).addClass('hide');
-                    $('.order-cost', me).attr('data-coupon', '0');
-                    $('.order-cost', me).attr('data-pay', parseFloat(order.petPrice));
-                    cart['products'][cachePageData.productType]['couponName'] = '';
-                    cart['products'][cachePageData.productType]['couponVal'] = '';
-                    cart['products'][cachePageData.productType]['couponId'] = '';
-                    cart['products'][cachePageData.productType]['couponList'] = [];
-                }
-                // 加急
-                if (order.precedence) {
-                    price = price + parseFloat(product.precedence);
-                }
-                $('.order-cost', me).attr('data-pay', price);
-                $('.order-cost', me).attr('data-costs', order.petPrice);
-                $('.order-cost', me).html('¥' + price);
+     $('.coupon-selected-name', me).html(user.getCouponName(coupons[selectCoupon.couponIndex].id));
+     $('.coupon-cost', me).html('-' + selectCoupon.couponSelectVal);
+     $('.select-coupon', me).removeClass('hide');
+     $('.order-cost', me).attr('data-coupon', selectCoupon.couponSelectVal);
+     $('.order-list', me).removeClass('hide');
+     price = parseFloat(order.petPrice) * order.productCount - parseFloat(selectCoupon.couponSelectVal) + parseFloat(extraServicePrice);
 
-                cart.setCache('products');
+     } else {
+     price = parseFloat(order.petPrice) * order.productCount + parseFloat(extraServicePrice);
 
-                pageData.scroll.refresh();
-            } else {
-                $(document).trigger('spa:openpanel', ['simpleAlert', {
-                    message: res.message
-                }]);
-            }
-        });
-    }  */
+     $('.coupon-selected-name', me).html('');
+     $('.select-coupon', me).addClass('hide');
+     $('.order-cost', me).attr('data-coupon', '0');
+     $('.order-cost', me).attr('data-pay', parseFloat(order.petPrice));
+     cart['products'][cachePageData.productType]['couponName'] = '';
+     cart['products'][cachePageData.productType]['couponVal'] = '';
+     cart['products'][cachePageData.productType]['couponId'] = '';
+     cart['products'][cachePageData.productType]['couponList'] = [];
+     }
+     // 加急
+     if (order.precedence) {
+     price = price + parseFloat(product.precedence);
+     }
+     $('.order-cost', me).attr('data-pay', price);
+     $('.order-cost', me).attr('data-costs', order.petPrice);
+     $('.order-cost', me).html('¥' + price);
+
+     cart.setCache('products');
+
+     pageData.scroll.refresh();
+     } else {
+     $(document).trigger('spa:openpanel', ['simpleAlert', {
+     message: res.message
+     }]);
+     }
+     });
+     }  */
 
     /* 在选择主服务或宠物后,筛选附加服务
      function suitExtraService(me, checkedName) {
@@ -270,9 +264,7 @@ define(['$', 'template', 'order', 'native', 'helper', 'user', 'api', 'config', '
                 order.price = $(this).attr('data-extra-price');
                 order.cost = order.price * order.productCount;
                 /* 算账 */
-                var $orderCost = $('.order-cost', $view);
-                $orderCost.data('cost', order.cost);
-                payCharge($orderCost);
+                payCharge($('.order-cost', $view));
             }, $view);
 
             /* 点击选择地址 */
@@ -307,187 +299,187 @@ define(['$', 'template', 'order', 'native', 'helper', 'user', 'api', 'config', '
             }, $view);
 
             /* 点击选择附加服务
-            $.newTouch('.item-checkbox', function (event) {
-                event.preventDefault();
-                // 如果'.main-service'元素的子元素数目为正(也就是说出现了选择主服务那一栏,也就是说在前一页选择的是附加服务),且不处于on状态(也就是还没有选择主服务)
-                if ($('.main-service', $view).length && !$('.main-service', $view).find('.btn-main-service').hasClass('on')) {
-                    // 弹出一个对话框
-                    $doc.trigger('spa:openpanel', ['simpleAlert', {
-                        message: '请选择服务类型'
-                    }]);
-                    return;
-                }
-                // $(this).data('xxx'):获取this中data-xxx的数据。
-                // 获取这一条附加服务的相关的数据。select没用,估计是原来想用这个记录选中状态的。
-                var select = $(this).data('select'),
-                    id = $(this).data('id'),
-                    index = $(this).parent().index(),
-                    price = $(this).data('price');
-                extraType = $(this).data('servicetype');
-                // 获取附加服务的总费用。
-                var extraCost = $('.order-cost', $view).attr('data-extra');
-                // 如果原来没有选中这一项,下面就是选中的操作
-                if (!$(this).hasClass('checked')) {
-                    // 附加服务数量+1
-                    cachePageData.extraServiceCount++;
-                    // 保存附加服务的总价格
-                    cachePageData.extraServicePrice += parseFloat(price);
-                    // 添加checked状态
-                    $(this).addClass('checked');
-                    var serviceParam = {
-                        product_id: id,
-                        count: 1
-                    }
-                    // /为什么是个数组?
-                    order.extraService[index] = serviceParam;
-                    // 把订单详情中对应的项目添加on属性
-                    $('.calc-items', $view).find('.select-extra-service').eq(index).addClass('on');
-                    // 计算附加服务的总费用。
-                    extraCost = parseFloat(extraCost) + parseFloat(price);
-                    $('.order-cost', $view).attr('data-extra', extraCost);
-                }
-                // 如果原来选中了这一项,下面就是取消选中的操作
-                else {
-                    // 附加服务数量-1
-                    cachePageData.extraServiceCount--;
-                    // 保存附加服务的总价格
-                    cachePageData.extraServicePrice -= parseFloat(price);
-                    // 删除checked属性
-                    $(this).removeClass('checked');
-
-                    order.extraService[index] = {};
-                    // 把订单详情中对应的项目删掉on属性
-                    $('.calc-items', $view).find('.select-extra-service').eq(index).removeClass('on');
-                    // 计算附加服务的总费用。
-                    extraCost = parseFloat(extraCost) - parseFloat(price);
-                    $('.order-cost', $view).attr('data-extra', extraCost);
-                }
-                // 根据附加服务的数量,更新订单详情中附加服务模块的显示与隐藏
-                if (cachePageData.extraServiceCount > 0) {
-                    $('.calc-items', $view).removeClass('hide');
-                } else {
-                    $('.calc-items', $view).addClass('hide');
-                }
-                // 更新订单详情中每一条附加服务的显示与隐藏
-                if ($('.calc-items', $view).find('.select-extra-service').hasClass('on')) {
-                    $('.calc-items', $view).removeClass('hide');
-                } else {
-                    $('.calc-items', $view).addClass('hide');
-                }
-                // 计算总价钱
-                payCharge();
-                // 刷新界面
-                pageData.scroll.refresh();
-            }, $view); */
+             $.newTouch('.item-checkbox', function (event) {
+             event.preventDefault();
+             // 如果'.main-service'元素的子元素数目为正(也就是说出现了选择主服务那一栏,也就是说在前一页选择的是附加服务),且不处于on状态(也就是还没有选择主服务)
+             if ($('.main-service', $view).length && !$('.main-service', $view).find('.btn-main-service').hasClass('on')) {
+             // 弹出一个对话框
+             $doc.trigger('spa:openpanel', ['simpleAlert', {
+             message: '请选择服务类型'
+             }]);
+             return;
+             }
+             // $(this).data('xxx'):获取this中data-xxx的数据。
+             // 获取这一条附加服务的相关的数据。select没用,估计是原来想用这个记录选中状态的。
+             var select = $(this).data('select'),
+             id = $(this).data('id'),
+             index = $(this).parent().index(),
+             price = $(this).data('price');
+             extraType = $(this).data('servicetype');
+             // 获取附加服务的总费用。
+             var extraCost = $('.order-cost', $view).attr('data-extra');
+             // 如果原来没有选中这一项,下面就是选中的操作
+             if (!$(this).hasClass('checked')) {
+             // 附加服务数量+1
+             cachePageData.extraServiceCount++;
+             // 保存附加服务的总价格
+             cachePageData.extraServicePrice += parseFloat(price);
+             // 添加checked状态
+             $(this).addClass('checked');
+             var serviceParam = {
+             product_id: id,
+             count: 1
+             }
+             // /为什么是个数组?
+             order.extraService[index] = serviceParam;
+             // 把订单详情中对应的项目添加on属性
+             $('.calc-items', $view).find('.select-extra-service').eq(index).addClass('on');
+             // 计算附加服务的总费用。
+             extraCost = parseFloat(extraCost) + parseFloat(price);
+             $('.order-cost', $view).attr('data-extra', extraCost);
+             }
+             // 如果原来选中了这一项,下面就是取消选中的操作
+             else {
+             // 附加服务数量-1
+             cachePageData.extraServiceCount--;
+             // 保存附加服务的总价格
+             cachePageData.extraServicePrice -= parseFloat(price);
+             // 删除checked属性
+             $(this).removeClass('checked');
+
+             order.extraService[index] = {};
+             // 把订单详情中对应的项目删掉on属性
+             $('.calc-items', $view).find('.select-extra-service').eq(index).removeClass('on');
+             // 计算附加服务的总费用。
+             extraCost = parseFloat(extraCost) - parseFloat(price);
+             $('.order-cost', $view).attr('data-extra', extraCost);
+             }
+             // 根据附加服务的数量,更新订单详情中附加服务模块的显示与隐藏
+             if (cachePageData.extraServiceCount > 0) {
+             $('.calc-items', $view).removeClass('hide');
+             } else {
+             $('.calc-items', $view).addClass('hide');
+             }
+             // 更新订单详情中每一条附加服务的显示与隐藏
+             if ($('.calc-items', $view).find('.select-extra-service').hasClass('on')) {
+             $('.calc-items', $view).removeClass('hide');
+             } else {
+             $('.calc-items', $view).addClass('hide');
+             }
+             // 计算总价钱
+             payCharge();
+             // 刷新界面
+             pageData.scroll.refresh();
+             }, $view); */
 
             /* 点击选择保洁师
-            $.newTouch('.show-beautician-picker', function (event) {
-                // 如果订单的地址数据为空
-                if (!order.address || !order.address.address_id) {
-                    // 弹出提示框
-                    $doc.trigger('spa:openpanel', ['simpleAlert', {
-                        message: '请选择地址'
-                    }]);
-                    return;
-                }
-                // 点击订单的预定时间为空
-                if (order.bookingDate == '' || order.bookingTime == '') {
-                    // 弹出提示框
-                    $doc.trigger('spa:openpanel', ['simpleAlert', {
-                        message: '请选择上门时间'
-                    }]);
-                    return;
-                }
-                // 点击订单的主服务类型为空
-                if (!order.productType) {
-                    // /弹出提示框
-                    $doc.trigger('spa:openpanel', ['simpleAlert', {
-                        message: '请选择服务类型'
-                    }]);
-                    return;
-                }
-                // 生成预定时间的字符串
-                var bookingTime = order.bookingDate + ' ' + order.bookingTime + ':00';
-                // 生成所有服务的字符串
-                var service_type_array = [order.productType];
-                var service_type = '[' + service_type_array.join(',') + ']';
-                // 根据服务、时间、地址,向服务器请求保洁师列表
-                user.getTechList(
-                    service_type,
-                    bookingTime,
-                    order.address.address_id,
-                    // 请求成功后跳转到beautician页面,在beautician页面展示保洁师列表
-                    function (res) {
-                        $doc.trigger('spa:navigate', {
-                            hash: 'beautician',
-                            pushData: {
-
-                            }
-                        });
-                    }
-                );
-            }, $view);  */
+             $.newTouch('.show-beautician-picker', function (event) {
+             // 如果订单的地址数据为空
+             if (!order.address || !order.address.address_id) {
+             // 弹出提示框
+             $doc.trigger('spa:openpanel', ['simpleAlert', {
+             message: '请选择地址'
+             }]);
+             return;
+             }
+             // 点击订单的预定时间为空
+             if (order.bookingDate == '' || order.bookingTime == '') {
+             // 弹出提示框
+             $doc.trigger('spa:openpanel', ['simpleAlert', {
+             message: '请选择上门时间'
+             }]);
+             return;
+             }
+             // 点击订单的主服务类型为空
+             if (!order.productType) {
+             // /弹出提示框
+             $doc.trigger('spa:openpanel', ['simpleAlert', {
+             message: '请选择服务类型'
+             }]);
+             return;
+             }
+             // 生成预定时间的字符串
+             var bookingTime = order.bookingDate + ' ' + order.bookingTime + ':00';
+             // 生成所有服务的字符串
+             var service_type_array = [order.productType];
+             var service_type = '[' + service_type_array.join(',') + ']';
+             // 根据服务、时间、地址,向服务器请求保洁师列表
+             user.getTechList(
+             service_type,
+             bookingTime,
+             order.address.address_id,
+             // 请求成功后跳转到beautician页面,在beautician页面展示保洁师列表
+             function (res) {
+             $doc.trigger('spa:navigate', {
+             hash: 'beautician',
+             pushData: {
+
+             }
+             });
+             }
+             );
+             }, $view);  */
 
             /* 点击选择宠物相关
-            $.newTouch('.show-product-picker', function () {
-                // 如果有了selected属性,就return
-                if ($(this).hasClass('selected')) return;
-                event.preventDefault();
-                // 主服务>10是什么意思???
-                if (cachePageData.productType > 10) {
-                    $doc.trigger('spa:openpanel', ['simpleAlert', {
-                        message: '请选择服务类型'
-                    }]);
-                    return;
-                }
-                // 弹出一个列表选择框。
-                $doc.trigger('spa:openpanel', ['productOption', {
-                    pets: product.productGroup[cachePageData.productType],
-                    productType: cachePageData.productType,
-                    callback: {
-                        onSelect: function (petName, petWeight, petPrice) {
-                            // set order info
-                            order.petName = petName;
-                            order.petWeight = petWeight;
-                            order.petPrice = petPrice;
-                            order.productType = cachePageData.productType;
-                            order.petID = cart['products'][cachePageData.productType]['petID'];
-                            order.productID = cart['products'][cachePageData.productType]['productID'];
-                            // user.orderCoupons = res.data;
-                            // 筛选附加服务
-                            if (cachePageData.extraServiceType > 10) {
-                                var selectExtraServiceName = cachePageData.defaultExtraService[cachePageData.extraServiceType].serviceName;
-                                var selectExtraServicePrice = cachePageData.defaultExtraService[cachePageData.extraServiceType].servicePrice;
-
-                                $('.order-cost', $view).attr('data-extra', selectExtraServicePrice);
-                            }
-
-                            suitExtraService($view, selectExtraServiceName);
-
-                            $('.pet-info', $view).html(petName + ' (' + petWeight + ')');
-                            $('.pet-type', $view).html(petName + ' (' + petWeight + ')');
-                            $('.total-cost', $view).html('¥' + petPrice);
-
-                            if ($('.calc-items', $view).find('.select-extra-service').hasClass('on')) {
-                                $('.calc-items', $view).removeClass('hide');
-                                petPrice = parseFloat(petPrice) + parseFloat(selectExtraServicePrice);
-                            }
-
-                            $('.order-cost', $view).attr('data-costs', order.petPrice);
-                            $('.order-cost', $view).attr('data-extra', cachePageData.extraServicePrice);
-                            $('.order-cost', $view).html('¥' + petPrice);
-
-                            $('.select-pet', $view).removeClass('hide');
-
-                            if (order['productID'] && order.bookingDate) {
-                                setCoupon($view, pageData, cachePageData.extraServicePrice);
-                            }
-
-                            pageData.scroll.refresh();
-                        }
-                    }
-                }]);
-            }, $view); */
+             $.newTouch('.show-product-picker', function () {
+             // 如果有了selected属性,就return
+             if ($(this).hasClass('selected')) return;
+             event.preventDefault();
+             // 主服务>10是什么意思???
+             if (cachePageData.productType > 10) {
+             $doc.trigger('spa:openpanel', ['simpleAlert', {
+             message: '请选择服务类型'
+             }]);
+             return;
+             }
+             // 弹出一个列表选择框。
+             $doc.trigger('spa:openpanel', ['productOption', {
+             pets: product.productGroup[cachePageData.productType],
+             productType: cachePageData.productType,
+             callback: {
+             onSelect: function (petName, petWeight, petPrice) {
+             // set order info
+             order.petName = petName;
+             order.petWeight = petWeight;
+             order.petPrice = petPrice;
+             order.productType = cachePageData.productType;
+             order.petID = cart['products'][cachePageData.productType]['petID'];
+             order.productID = cart['products'][cachePageData.productType]['productID'];
+             // user.orderCoupons = res.data;
+             // 筛选附加服务
+             if (cachePageData.extraServiceType > 10) {
+             var selectExtraServiceName = cachePageData.defaultExtraService[cachePageData.extraServiceType].serviceName;
+             var selectExtraServicePrice = cachePageData.defaultExtraService[cachePageData.extraServiceType].servicePrice;
+
+             $('.order-cost', $view).attr('data-extra', selectExtraServicePrice);
+             }
+
+             suitExtraService($view, selectExtraServiceName);
+
+             $('.pet-info', $view).html(petName + ' (' + petWeight + ')');
+             $('.pet-type', $view).html(petName + ' (' + petWeight + ')');
+             $('.total-cost', $view).html('¥' + petPrice);
+
+             if ($('.calc-items', $view).find('.select-extra-service').hasClass('on')) {
+             $('.calc-items', $view).removeClass('hide');
+             petPrice = parseFloat(petPrice) + parseFloat(selectExtraServicePrice);
+             }
+
+             $('.order-cost', $view).attr('data-costs', order.petPrice);
+             $('.order-cost', $view).attr('data-extra', cachePageData.extraServicePrice);
+             $('.order-cost', $view).html('¥' + petPrice);
+
+             $('.select-pet', $view).removeClass('hide');
+
+             if (order['productID'] && order.bookingDate) {
+             setCoupon($view, pageData, cachePageData.extraServicePrice);
+             }
+
+             pageData.scroll.refresh();
+             }
+             }
+             }]);
+             }, $view); */
 
             /* 点击数量-1 */
             $.newTouch('.btn-sub', function (event) {
@@ -502,9 +494,7 @@ define(['$', 'template', 'order', 'native', 'helper', 'user', 'api', 'config', '
                 order.cost = order.productCount * order.price;
                 $('.service-count', $view).find('.num').html(order.productCount);
                 /* 算账 */
-                var $orderCost = $('.order-cost', $view);
-                $orderCost.data('cost', order.cost);
-                payCharge($orderCost);
+                payCharge($('.order-cost', $view));
             }, $view);
 
             /* 点击数量+1 */
@@ -520,9 +510,7 @@ define(['$', 'template', 'order', 'native', 'helper', 'user', 'api', 'config', '
                 order.cost = order.productCount * order.price;
                 $('.service-count', $view).find('.num').html(order.productCount);
                 /* 算账 */
-                var $orderCost = $('.order-cost', $view);
-                $orderCost.data('cost', order.cost);
-                payCharge($orderCost);
+                payCharge($('.order-cost', $view));
             }, $view);
 
             /* 点击选择时间 */
@@ -676,20 +664,18 @@ define(['$', 'template', 'order', 'native', 'helper', 'user', 'api', 'config', '
                     callback: {
                         // 在picker页面挑选之后,回到这个页面时执行的回调。pickValue:选中的优惠券的ID;
                         onSelect: function (pickValue) {
-                            var $orderCost = $('.order-cost', $view);
                             if (pickValue == '') {
                                 $('.coupon-selected-name', $view).html('不使用');
-                                // $('.select-coupon', $view).addClass('hide');
-                                $orderCost.data('coupon', '0');
+                                order.couponValue = 0;
                             } else {
+                                var couponValue = user.getCouponValue(pickValue);
                                 $('.coupon-selected-name', $view).html(user.getCouponName(pickValue));
-                                // $('.select-coupon', $view).removeClass('hide').find('.coupon-cost').html('- ' + couponValue);
-                                $orderCost.data('coupon', user.getCouponValue(pickValue));
+                                order.couponValue = couponValue;
                             }
                             // 填写order
                             order.couponID = pickValue;
                             // 计算总费用
-                            payCharge($orderCost);
+                            payCharge($('.order-cost', $view));
                         }
                     }
                 });
@@ -750,7 +736,6 @@ define(['$', 'template', 'order', 'native', 'helper', 'user', 'api', 'config', '
 
                 /* 向服务器下订单 */
                 $doc.trigger('spa:openloader');
-                order.balance = user.balance;
                 order.addOrder(user.id, payChannel, function (res) {
                     $doc.trigger('spa:closeloader');
                     if (res.success) {
@@ -764,7 +749,6 @@ define(['$', 'template', 'order', 'native', 'helper', 'user', 'api', 'config', '
                             if (val.id !== oldCouponId) {
                                 newCouponList.push(oldCouponList[index])
                             }
-                            ;
                         });
                         user.orderCoupons = newCouponList;
 
@@ -807,6 +791,7 @@ define(['$', 'template', 'order', 'native', 'helper', 'user', 'api', 'config', '
                 order.productType = product.type;
                 order.productID = product.id;
                 order.productCount = 1;
+                order.couponValue = 0;
                 /* 根据product建立渲染页面的数据 */
                 var tmpData = {
                     /* 环境,目前只决定是否显示保洁师 */
@@ -827,16 +812,14 @@ define(['$', 'template', 'order', 'native', 'helper', 'user', 'api', 'config', '
                 var tpl = template('placeOrder/index', tmpData);
                 $view.find('.spa-page-body').html(tpl);
                 /* 绑定费用数据 */
-                var $orderCost = $('.order-cost', $view);
-                if (product.extra){
+                if (product.extra) {
+                    order.price = 0;
                     order.cost = 0;
-                }else {
+                } else {
                     order.price = product.price;
                     order.cost = product.price * order.productCount;
                 }
-                $orderCost.data('cost', order.cost);
-                $orderCost.data('coupon', '0');
-                payCharge($orderCost);
+                payCharge($('.order-cost', $view));
 
                 /* 软键盘相关操作时对IScroll的补偿 */
                 fixScroll(pageData);

Неке датотеке нису приказане због велике количине промена