cart.js 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630
  1. var shoppingCart = new Vue({
  2. el: "#shoppingCart",
  3. mixins: [cartMixins],
  4. data: {
  5. userId: 0,
  6. userIdentity: '',
  7. userToken: '',
  8. listLoading: true,
  9. listData: [],
  10. invalidData: [],
  11. promotionsList: [],
  12. totalCouponList:[], // 优惠券算列表
  13. eligibleCoupons:[], // 最终需要用到优惠券
  14. kindCount: 0,
  15. totalCount: 0,
  16. totalPrice: 0,
  17. reducedPrice: 0,
  18. originalPrice: 0,
  19. allChecked: true,
  20. submitIds: [],//去结算商品SkuIds
  21. checkenProsList:[],// 勾选中的商品
  22. isShowPopup:false,
  23. currentTab:1,
  24. couponParam:{// 获取弹窗优惠券领取参数
  25. userId:0,
  26. shopId:0,
  27. status:1,
  28. source:1
  29. },
  30. isCouponEmpty:false,
  31. productCoupon:[], // 优惠券
  32. productCouponList:[], // 优惠券弹窗列表
  33. couponPrice:0, // 优惠金额
  34. totalDiscountAmount:0, // 总共减去金额
  35. isDiscount:false, // 控制显示优惠明细
  36. isCheckedProductStatus:false
  37. },
  38. watch:{
  39. listData: {
  40. handler: function() {
  41. console.log('obj.a changed');
  42. },
  43. immediate: true,
  44. deep: true
  45. }
  46. },
  47. filters: {
  48. NumFormat: function (text) {//处理金额
  49. return Number(text).toFixed(2);
  50. },
  51. TypeFormat:function(value) {
  52. switch (value) {
  53. case 0:
  54. return '活动券';
  55. break;
  56. case 1:
  57. return '品类券';
  58. break;
  59. case 2:
  60. return '用户专享券';
  61. break;
  62. case 3:
  63. return '店铺券';
  64. break;
  65. case 4:
  66. return '新用户券';
  67. break;
  68. }
  69. }
  70. },
  71. methods: {
  72. getCartLists: function () {
  73. var _self = this;
  74. if(_self.userId ===0){return;}
  75. ShoppingApi.QueryShoppingCartList({userId: _self.userId,source:1},function(response){
  76. if(response.code === 0){
  77. var data = response.data;
  78. // _self.listData = data.list;
  79. _self.invalidData = data.invalid;
  80. _self.kindCount = data.kindCount;
  81. _self.totalCount = data.totalCount;
  82. _self.totalPrice = data.totalPrice;
  83. _self.promotionsList = data.promotions;
  84. _self.totalCouponList = data.couponList;
  85. _self.reducedPrice = data.reducedPrice;
  86. // 默认全选
  87. _self.listData = data.list.map(function(supplier){
  88. if(supplier.cartList.length>0){
  89. supplier.cartList.forEach(function(cart){
  90. if(cart.stock === 0 || cart.number > cart.stock ){
  91. cart.isChecked = false;
  92. supplier.isDisable = true
  93. cart.isDisable = true
  94. }else{
  95. cart.isDisable = false
  96. cart.isChecked = true;
  97. _self.submitIds.push(cart.skuId);
  98. _self.checkenProsList.push(cart);
  99. }
  100. cart.isSkuPopup = false;
  101. _self.isCheckedProductStatus = true;
  102. })
  103. }
  104. _self.updateProductCheckedAllBtn(supplier);
  105. return supplier;
  106. })
  107. _self.updateCheckAllBtn();
  108. _self.computedPrice();
  109. _self.listLoading = false;
  110. console.log('listData',_self.listData)
  111. }else{
  112. CAIMEI.Alert(response.msg,'确定',true, function(){});
  113. }
  114. })
  115. },
  116. toggleThisLadder: function(event){
  117. var el = event.currentTarget;
  118. if($(el).hasClass("on")){
  119. $(el).removeClass("on").siblings('.mFixed').hide();
  120. if(!isPC){looseBody();}
  121. }else{
  122. $(el).addClass("on").siblings('.mFixed').show();
  123. if(!isPC){fixedBody();}
  124. }
  125. },
  126. hideThisLadder: function(event){
  127. var el = event.currentTarget;
  128. $(el).parents('.priceTag').find('.tag').removeClass("on").siblings('.mFixed').hide();
  129. if(!isPC){looseBody();}
  130. },
  131. ckeckItem: function(supplier,pro){//为未选中的时候改变为true,反之为true
  132. var _self = this;
  133. if(pro.isDisable){ return }
  134. pro.isChecked = !pro.isChecked;
  135. if (pro.isChecked) {
  136. if (!_self.submitIds.includes(pro.skuId * 1)) {
  137. _self.submitIds.push(pro.skuId);
  138. _self.checkenProsList.push(pro);
  139. }
  140. _self.isCheckedProductStatus = true;
  141. } else {
  142. var lent = _self.submitIds.indexOf(pro.skuId * 1)
  143. if (lent >= 0) {
  144. _self.submitIds.splice(lent, 1);
  145. _self.checkenProsList.splice(lent, 1);
  146. }
  147. }
  148. _self.updateProductCheckedAllBtn(supplier)
  149. _self.updateCheckAllBtn()
  150. _self.computedPrice();
  151. },
  152. ckeckSupplier: function(supplier){
  153. var _self = this;
  154. if(supplier.isDisable){ return }
  155. supplier.isChecked = !supplier.isChecked;
  156. _self.setProductChecked(supplier);
  157. _self.updateCheckAllBtn();
  158. _self.computedPrice();
  159. },
  160. updateProductCheckedAllBtn: function(supplier) { // 单独每个供应商的勾选判断
  161. var productsList = supplier.cartList,
  162. productsCheckedLength = 0;
  163. productsList.forEach(pros => {
  164. if (pros.isChecked) {
  165. productsCheckedLength++;
  166. }
  167. })
  168. supplier.isChecked = productsCheckedLength === productsList.length
  169. },
  170. updateCheckAllBtn: function() { // 全选勾选判断
  171. var _self = this;
  172. var goodsCheckedLength = 0,
  173. goodsList = _self.listData;
  174. goodsList.forEach(function(supplier){
  175. if (supplier.isChecked) {
  176. goodsCheckedLength++;
  177. }
  178. })
  179. this.allChecked = goodsCheckedLength === goodsList.length;
  180. },
  181. updateBothCheckBtn: function(){// 更新商铺勾选状态
  182. var _self = this;
  183. this.listData = this.listData.map(supplier => {
  184. supplier.isChecked = _self.allChecked;
  185. _self.setProductChecked(supplier);
  186. return supplier
  187. })
  188. },
  189. setProductChecked: function(supplier) {//
  190. var _self = this;
  191. supplier.cartList.forEach(cart => {
  192. if (supplier.isChecked && (cart.stock !== 0 || cart.number < cart.stock)) {
  193. cart.isChecked = true;
  194. if (!_self.submitIds.includes(cart.skuId * 1)) {
  195. _self.submitIds.push(cart.skuId);
  196. _self.checkenProsList.push(cart);
  197. }
  198. _self.isCheckedProductStatus = true;
  199. } else {
  200. cart.isChecked = false;
  201. var lent = this.submitIds.indexOf(cart.skuId * 1);
  202. if (lent >= 0) {
  203. _self.submitIds.splice(lent, 1);
  204. _self.checkenProsList.splice(lent, 1);
  205. }
  206. }
  207. })
  208. this.computedPrice();
  209. },
  210. ckeckAll: function(){
  211. this.allChecked = !this.allChecked;
  212. this.updateBothCheckBtn()
  213. },
  214. setPromotions:function(){
  215. var _self = this;
  216. this.promotionsList.forEach(function(promotions){
  217. promotions.productList.forEach(function(product){
  218. _self.listData.map(function(supplier){
  219. supplier.cartList.map(function(cart){
  220. if(product.productId === cart.productId){
  221. product.number = cart.number
  222. }
  223. });
  224. });
  225. });
  226. });
  227. },
  228. computedPrice: function() {
  229. var _self = this;
  230. console.log('submitIds',this.submitIds)
  231. this.$nextTick(function () {
  232. var totalPrice = 0;
  233. var reducedPrice = 0;
  234. var originalPrice = 0;
  235. var kindCount = 0;
  236. var totalCount = 0;
  237. _self.listData.forEach(function (supplier) {
  238. var supplierPrice = 0;
  239. var supplierReducedPrice = 0;
  240. var svipSupplierPrice = 0;
  241. if (supplier.cartList.length > 0) {
  242. supplier.cartList.forEach(function (cart) {
  243. if (_self.submitIds.includes(cart.skuId * 1)) {
  244. supplierPrice += cart.price * cart.number;
  245. kindCount += 1;
  246. totalCount += cart.number;
  247. // 单品满减
  248. if (cart.promotions && cart.promotions.type * 1 === 1 && cart.promotions.mode * 1 === 2) {
  249. var price = cart.price * cart.number;
  250. if(cart.promotions.discount == 1){
  251. var discountNum = parseInt( price/cart.promotions.touchPrice);
  252. console.log('单品满减促销叠加通道叠加次数',discountNum)
  253. // 单品满减-重新计算供应商总价/满减金额
  254. if ( price >= cart.promotions.touchPrice) {
  255. supplierPrice -= cart.promotions.reducedPrice*discountNum
  256. supplierReducedPrice += cart.promotions.reducedPrice*discountNum
  257. }
  258. }else{
  259. console.log(' 单品满减非促销叠加通道')
  260. // 单品满减-重新计算供应商总价/满减金额
  261. if ( price >= cart.promotions.touchPrice) {
  262. supplierPrice -= cart.promotions.reducedPrice;
  263. supplierReducedPrice += cart.promotions.reducedPrice;
  264. }
  265. }
  266. }
  267. //sivp优惠价格
  268. if(cart.svipProductFlag && GLOBAL_VIP_FLAG === 1){
  269. svipSupplierPrice += ((cart.originalPrice - cart.price) * cart.number);
  270. }
  271. }
  272. });
  273. // 店铺满减
  274. if (supplier.promotions && supplier.promotions.mode * 1 === 2) {
  275. if(supplier.promotions.discount == 1){// 支持促销叠加条件的店铺满减 执行
  276. var prosDiscountNum = parseInt(supplierPrice/supplier.promotions.touchPrice) // 店铺满减促销叠加次数 = 店铺合计价格/满减促销价格
  277. console.log('店铺满减促销叠加通道叠加次数',prosDiscountNum)
  278. if (supplierPrice >= supplier.promotions.touchPrice) {
  279. supplierPrice -= supplier.promotions.reducedPrice*prosDiscountNum
  280. supplierReducedPrice += supplier.promotions.reducedPrice*prosDiscountNum
  281. }
  282. }else{
  283. console.log('店铺满减非促销叠加通道')
  284. // 店铺满减-计算供应商总价/满减金额
  285. if (supplierPrice >= supplier.promotions.touchPrice) {
  286. supplierPrice -= supplier.promotions.reducedPrice;
  287. supplierReducedPrice += supplier.promotions.reducedPrice;
  288. }
  289. }
  290. }
  291. }
  292. supplier.totalPrice = supplierPrice;
  293. supplier.reducedPrice = supplierReducedPrice + svipSupplierPrice; // 其他优惠价 + svip优惠价
  294. supplier.originalPrice = (supplierPrice + supplierReducedPrice);
  295. totalPrice += supplier.totalPrice;
  296. reducedPrice += supplier.reducedPrice;
  297. originalPrice += supplier.originalPrice;
  298. });
  299. if(_self.isCheckedProductStatus){
  300. // 总促销计算
  301. _self.promotionsList.forEach(function (promotions) {
  302. // 凑单满减
  303. if (promotions.mode * 1 === 2 && promotions.type * 1 === 2) {
  304. var collecTotal = 0;
  305. var collecDiscountNum = 0;
  306. promotions.productList.forEach(function (product) {
  307. collecTotal += _self.collecTotalPrice(product);
  308. });
  309. if(promotions.discount == 1){// 支持凑单满减促销叠加条件的执行
  310. collecDiscountNum += parseInt(collecTotal/promotions.touchPrice) // 凑单满减促销叠加次数 = 凑单商品合计价格/凑单满减促销价格
  311. console.log('凑单促销满减叠加通道叠加次数',`${collecDiscountNum}次`)
  312. if (collecTotal >= promotions.touchPrice) {
  313. totalPrice -= promotions.reducedPrice*collecDiscountNum
  314. reducedPrice += promotions.reducedPrice*collecDiscountNum
  315. }
  316. }else{
  317. console.log('凑单促销满减非叠加通道')
  318. if (collecTotal >= promotions.touchPrice) {
  319. totalPrice -= promotions.reducedPrice
  320. reducedPrice += promotions.reducedPrice
  321. }
  322. }
  323. }
  324. });
  325. _self.totalPrice = totalPrice;
  326. _self.reducedPrice = reducedPrice;
  327. _self.originalPrice = originalPrice;
  328. _self.kindCount = kindCount;
  329. _self.totalCount = totalCount;
  330. // 计算优惠券
  331. if (_self.totalCouponList.length > 0) {
  332. let eligibleCoupons = _self.calculationCoupon();
  333. if (eligibleCoupons.length > 0) {
  334. _self.eligibleCoupons.splice(0, _self.eligibleCoupons.length);
  335. _self.eligibleCoupons = eligibleCoupons.sort((a, b) => b.couponAmount - a.couponAmount)
  336. _self.couponPrice = this.eligibleCoupons[0].couponAmount
  337. } else {
  338. _self.couponPrice = 0
  339. }
  340. }
  341. // 最后满减金额 = 店铺减去金额 + 单品减去金额 + 凑单减去金额
  342. _self.totalDiscountAmount = _self.reducedPrice + _self.couponPrice;
  343. console.log('最终优惠金额', _self.totalDiscountAmount);
  344. // 控制显示优惠明细
  345. if (_self.totalDiscountAmount > 0) {
  346. _self.isDiscount = true;
  347. } else {
  348. _self.isDiscount = false;
  349. }
  350. }
  351. })
  352. },
  353. collecTotalPrice:function(pros){// 凑单满减计算勾选的凑单商品总价
  354. var _self = this;
  355. var price;
  356. _self.checkenProsList.forEach(el => {
  357. if(pros.productId == el.productId ){
  358. price = el.number * el.price
  359. }
  360. })
  361. return price
  362. },
  363. calculationCoupon:function(){// 优惠券计算
  364. var _self = this;
  365. var eligibleCoupons = [];
  366. _self.listData.forEach(function(shop,index){
  367. shop.cartList.forEach(function(pros){
  368. if(_self.submitIds.includes(pros.skuId*1)){
  369. _self.totalCouponList.forEach(function (coupon,index){//循环优惠券
  370. switch(coupon.couponType){
  371. case 0:// 活动券
  372. if(coupon.productType == 1){// 活动券-全商城商品
  373. if(_self.totalPrice >= coupon.touchPrice){
  374. eligibleCoupons.push(coupon)
  375. }
  376. }else if(coupon.productType == 2){// 活动券-指定商品
  377. if(coupon.productIds && coupon.productIds.includes(pros.productId)){
  378. if(_self.totalPrice >= coupon.touchPrice){
  379. eligibleCoupons.push(coupon)
  380. }
  381. }
  382. }
  383. break;
  384. case 1:// 品类券适用于产品或者仪器 categoryType(commodityType) : 1 产品 2 仪器
  385. if( coupon.categoryType && coupon.categoryType == pros.commodityType){
  386. if(_self.totalPrice >= coupon.touchPrice){
  387. eligibleCoupons.push(coupon)
  388. }
  389. }
  390. break;
  391. case 2:// 用户专享券 适用于商城全部商品
  392. if(_self.totalPrice >= coupon.touchPrice){
  393. eligibleCoupons.push(coupon)
  394. }
  395. break;
  396. case 3:// 店铺券适用于某个供应商的全部商品
  397. if(coupon.shopId && pros.shopId == coupon.shopId){
  398. if(_self.totalPrice >= coupon.touchPrice){
  399. eligibleCoupons.push(coupon)
  400. }
  401. }
  402. break;
  403. case 4://新用户券 适用于商城全部商品
  404. if(_self.totalPrice >= coupon.touchPrice){
  405. eligibleCoupons.push(coupon)
  406. }
  407. break;
  408. }
  409. })
  410. }else{
  411. return;
  412. }
  413. })
  414. });
  415. return eligibleCoupons;
  416. },
  417. cartNumberSub: function(cart){
  418. cart.number -= cart.step;
  419. if (cart.number<cart.min){
  420. cart.number = cart.min;
  421. }
  422. this.numberChange(cart);
  423. },
  424. cartNumberAdd: function(cart){
  425. cart.number += cart.step;
  426. if (cart.number>cart.stock){
  427. cart.number = cart.stock;
  428. }
  429. this.numberChange(cart);
  430. },
  431. cartNumberChange: function(cart){
  432. cart.number = Math.ceil(cart.number/cart.step)*cart.step;
  433. this.numberChange(cart);
  434. },
  435. numberChange: function(cart){
  436. if(cart.ladderFlag){
  437. cart.ladderPrices.forEach(function(ladder){
  438. if(cart.number>=ladder.buyNum){
  439. cart.price = ladder.buyPrice;
  440. cart.originalPrice = ladder.buyPrice;
  441. }
  442. });
  443. }
  444. // 设置优惠数量
  445. this.setPromotions();
  446. // 计算价格
  447. this.computedPrice();
  448. // 更新购物车
  449. var _self = this;
  450. this.$nextTick(function(){
  451. _self.updateCart(cart);
  452. });
  453. },
  454. updateCart: function(cart){
  455. var _self = this;
  456. ShoppingApi.ShoppingCartUpdate(
  457. {
  458. userId:_self.userId,
  459. skuId: cart.skuId,
  460. productCount: cart.number,
  461. source:1,
  462. },
  463. function(response){
  464. if(response.code === 0){
  465. console.log('更新购物车商品数量成功');
  466. }else{
  467. CAIMEI.Alert(response.msg,'确定',true, function(){});
  468. }
  469. }
  470. )
  471. },
  472. deleteCart: function(skuIds){
  473. var _self = this;
  474. ShoppingApi.DeleteCartProducts({userId:_self.userId,skuIds:skuIds},function(response){
  475. if(response.code === 0){
  476. CAIMEI.dialog('删除成功',true,function () {
  477. _self.getCartLists();
  478. })
  479. }else{
  480. CAIMEI.Alert(response.msg,'确定',true, function(){});
  481. }
  482. })
  483. },
  484. deletefailureList:function(){
  485. var _self = this;
  486. var delGoodsList='';
  487. _self.invalidData.forEach(function(item){
  488. delGoodsList+= item.skuId+','
  489. });
  490. CAIMEI.Modal('确定清空全部失效商品吗?','取消','确定',function(){
  491. _self.deleteCart(delGoodsList)
  492. });
  493. },
  494. deleteCartOne:function(skuId){
  495. var _self = this;
  496. CAIMEI.Modal('确定删除该商品吗?','取消','确定',function(){
  497. _self.deleteCart(skuId);
  498. });
  499. },
  500. deleteSelected: function(){
  501. var _self = this;
  502. var skuIds = _self.submitIds.join(",");
  503. if(skuIds === ''){
  504. CAIMEI.dialog('请选择要删除的商品~');
  505. return false;
  506. }
  507. CAIMEI.Modal('确定删除选中的商品吗?','取消','确定',function(){
  508. _self.deleteCart(skuIds);
  509. });
  510. },
  511. queryPopupCoupons:function(){// 获取弹窗优惠券列表
  512. var _self = this;
  513. ShoppingApi.ShoppingCartGetCoupon(_self.couponParam, function (response) {
  514. if(response.code === 0){
  515. var data = response.data;
  516. if(data.couponList && data.couponList.length >0){
  517. _self.productCouponList = data.couponList;
  518. _self.isCouponEmpty = false;
  519. }else{
  520. _self.isCouponEmpty = true;
  521. }
  522. }else{
  523. console.log('获取优惠券列表失败')
  524. }
  525. })
  526. },
  527. toDeductCoupon:function (coupon) {// 点击购买按钮事件处理
  528. var _self = this;
  529. console.log(coupon)
  530. if(_self.couponParam.userId == 0){
  531. window.location.href='/login.html';
  532. }else{
  533. ProductApi.CreatePayCouponBeans({userId:_self.couponParam.userId, couponId:coupon.couponId, source:2}, function (response) {
  534. if(response.code == 0){
  535. CAIMEI.dialog('抵扣成功',true,function () {
  536. setTimeout(function(){
  537. _self.currentTab = 2;
  538. _self.couponParam.status = 2;
  539. _self.queryPopupCoupons();
  540. },200)
  541. });
  542. }else{
  543. CAIMEI.Alert(response.msg, '确定', false);
  544. }
  545. })
  546. }
  547. },
  548. receiveCoupon:function(coupon){// 点击领取优惠券
  549. var _self = this;
  550. ProductApi.ReceiveCoupon({userId:_self.couponParam.userId, couponId:coupon.couponId, source:2}, function (response) {
  551. if(response.code == 0){
  552. CAIMEI.dialog('领取成功',true,function () {
  553. _self.currentTab = 2;
  554. _self.couponParam.status = 2;
  555. _self.queryPopupCoupons();
  556. });
  557. }else{
  558. CAIMEI.Alert(response.msg, '确定', false);
  559. }
  560. })
  561. },
  562. toBuyCoupon:function (coupon) {// 点击购买按钮事件处理
  563. var _self = this;
  564. ProductApi.createCouponRecord({userId:_self.userId, couponId:coupon.couponId}, function (response) {
  565. if(response.code == 0){
  566. let couponRecordId = response.data.couponRecordId
  567. window.location.href = '/pay/caimei-hlbpay.html?pageType=3&couponId='+coupon.couponId+'&couponRecordId='+couponRecordId;
  568. }else{
  569. if(response.code == -1){//个人机构不能购买
  570. CAIMEI.Alert('该优惠券仅限医美机构购买,请升级为医美机构后再次购买。', '去升级', true, function(){
  571. window.location.href = "/user/setting/upgrade.html";
  572. });
  573. }else if(response.code == -2){//会员机构不是医美机构不能购买
  574. CAIMEI.dialog('该优惠券仅限医美机构购买',false,function () {});
  575. }else{
  576. CAIMEI.Alert(response.msg, '确定', false);
  577. }
  578. }
  579. })
  580. },
  581. queryCouponTabs:function (value){
  582. var _self = this;
  583. _self.currentTab = _self.couponParam.status = value;
  584. _self.queryPopupCoupons();
  585. },
  586. showPopup:function(shop){// 显示优惠券弹窗
  587. var _self = this;
  588. _self.productCouponList = [];
  589. _self.currentTab = 1;
  590. _self.couponParam.status = 1;
  591. _self.couponParam.shopId = shop.shopId
  592. _self.queryPopupCoupons();
  593. _self.isShowPopup = true;
  594. },
  595. hidePopup:function(){// 隐藏优惠券弹窗
  596. var _self = this;
  597. _self.isShowPopup = false;
  598. },
  599. hanldHrefLink:function (shop) {
  600. if(shop.shopType == 2){
  601. return;
  602. }
  603. window.open('/supplier-'+shop.shopId+'.html');
  604. }
  605. },
  606. created: function () {
  607. if(globalUserData){
  608. this.userId = this.couponParam.userId = this.addParams.userId = globalUserData.userId;
  609. this.userIdentity = globalUserData.identity;
  610. this.userToken = globalUserData.token;
  611. }
  612. // 获取列表数据
  613. this.getCartLists();
  614. },
  615. mounted: function () {
  616. var _self = this;
  617. var minAwayBtm = $("footer").height();
  618. //处理滚动条控制底部提交fixed
  619. $(window).scroll(function() {
  620. var awayBtm = $(document).height() - $(window).scrollTop() - $(window).height();
  621. if(minAwayBtm <= awayBtm){
  622. $(".summaryWrap").addClass('fixed');
  623. }else{
  624. $(".summaryWrap").removeClass("fixed");
  625. }
  626. });
  627. }
  628. });