|
@@ -0,0 +1,76 @@
|
|
|
+var shoppingCart = new Vue({
|
|
|
+ el: "#shoppingCart",
|
|
|
+ data: {
|
|
|
+ userId: 0,
|
|
|
+ userIdentity: '',
|
|
|
+ userToken: '',
|
|
|
+ type: '',
|
|
|
+ listData: [],
|
|
|
+ kindCount: 0,
|
|
|
+ totalCount: 0,
|
|
|
+ totalPrice: 0
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getConfirmList: function (productIds, productCount) {
|
|
|
+ var _self = this;
|
|
|
+ if(this.userId ===0){return;}
|
|
|
+ tokenAjax("get", "/order/confirm", {
|
|
|
+ userId: _self.userId,
|
|
|
+ count: productCount,
|
|
|
+ productIds: productIds
|
|
|
+ } ,function (r) {
|
|
|
+ if (r.code === 0 && r.data) {
|
|
|
+ _self.listData = r.data.list;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ toggleThisLadder: function(event){
|
|
|
+ var el = event.currentTarget;
|
|
|
+ if($(el).hasClass("on")){
|
|
|
+ $(el).removeClass("on").siblings('.mFixed').hide();
|
|
|
+ if(!isPC){looseBody();}
|
|
|
+ }else{
|
|
|
+ $(el).addClass("on").siblings('.mFixed').show();
|
|
|
+ if(!isPC){fixedBody();}
|
|
|
+ }
|
|
|
+ },
|
|
|
+ hideThisLadder: function(event){
|
|
|
+ var el = event.currentTarget;
|
|
|
+ $(el).parents('.priceTag').find('.tag').removeClass("on").siblings('.mFixed').hide();
|
|
|
+ if(!isPC){looseBody();}
|
|
|
+ },
|
|
|
+ submitOrder: function(){
|
|
|
+
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created: function () {
|
|
|
+ this.type = getUrlParam("type") ? getUrlParam("type")*1 : "";
|
|
|
+ if(globalUserData){
|
|
|
+ this.userId = globalUserData.userId;
|
|
|
+ this.userIdentity = globalUserData.identity;
|
|
|
+ this.userToken = globalUserData.token;
|
|
|
+ // type:(1购物车提交[对应表cm_cart],2直接购买提交, 3协销下单)
|
|
|
+ if(this.type === 1) {
|
|
|
+ var productIds = window.localStorage.getItem("shoppingProductIds");
|
|
|
+ // 获取列表数据
|
|
|
+ this.getConfirmList(productIds, null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted: function () {
|
|
|
+ var _self = this;
|
|
|
+ var minAwayBtm = $("footer").height();
|
|
|
+ //处理滚动条控制底部提交fixed
|
|
|
+ $(window).scroll(function() {
|
|
|
+ var awayBtm = $(document).height() - $(window).scrollTop() - $(window).height();
|
|
|
+ if(minAwayBtm <= awayBtm){
|
|
|
+ $(".summaryWrap").addClass('fixed');
|
|
|
+ }else{
|
|
|
+ $(".summaryWrap").removeClass("fixed");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+});
|