zs 2 éve
szülő
commit
c8eab50c3a

+ 11 - 20
pagesHome/home/index.vue

@@ -47,7 +47,7 @@
 					</scroll-view>
 				</view>
 				<view class="two_2">
-					<scroll-view scroll-y="true" class="scroll-view" @scrolltolower="toPage" @scroll="toScroll">
+					<scroll-view scroll-y="true" class="scroll-view">
 						<view class="list-scroll-view">
 							<view class="theme">{{tags.name}}</view>
 							<view class="list" v-for="(tag,index) in marketList" :key="index">
@@ -215,15 +215,15 @@
 					let list = that.buyList.find(i => i._id == e._id)
 					if (list) {
 						if (list.num == 0) {
-							let cart = that.buyList.filter(i => i._id !== list._id)
+							let cart = that.buyList.filter(i => i._id !== e._id)
 							if (cart) that.$set(that, `buyList`, cart)
 						} else {
 							for (let val of that.buyList) {
-								if (val._id == list._id) val.num = e.num
+								if (val._id == e._id) val.num = e.num
 							}
 						}
 					} else {
-						if (e.num != 0) that.buyList.push(e)
+						if (e.num !== 0) that.buyList.push(e)
 					}
 					for (let s of that.typeList) {
 						let num = that.buyList.filter(i => i.code == s.code)
@@ -251,6 +251,8 @@
 			// 查看选择商品详情
 			toView() {
 				const that = this;
+				let list = that.buyList.filter(i => i.num !== 0)
+				that.$set(that, `buyList`, list)
 				that.$set(that, `popupShow`, '1')
 				that.$refs.specShow.open();
 			},
@@ -258,12 +260,13 @@
 			async toBuy() {
 				const that = this;
 				let res;
-				if (that.buyList.length > 0) {
+				let list = that.buyList.filter(i => i.num !== 0)
+				if (list.length > 0) {
 					if (that.id) {
 						res = await that.$api(`cart/${that.id}`, 'GET', {});
 						if (res.errcode == '0') {
 							let obj = {
-								list: [...that.buyList, ...res.data.list],
+								list: [...list, ...res.data.list],
 								total: that.$plus(that.cartNum.total, res.data.total),
 							}
 							let cart = await that.$api(`cart/${res.data._id}`, 'POST', obj);
@@ -275,7 +278,7 @@
 						}
 					} else {
 						let obj = {
-							list: that.buyList,
+							list: list,
 							total: that.cartNum.total,
 							table: '63dc6a6b6a22ff30c8a11470'
 						}
@@ -289,7 +292,7 @@
 
 				}
 			},
-			// 关闭弹框
+			//清空购物车
 			toDelete() {
 				const that = this;
 				for (let val of that.typeList) val.num = 0
@@ -299,18 +302,6 @@
 				that.searchMarket()
 				that.$refs.specShow.close();
 			},
-			// 分页
-			toPage() {
-				const that = this;
-			},
-			// 触底
-			toScroll(e) {
-				const that = this;
-				let up = that.scrollTop;
-				that.$set(that, `scrollTop`, e.detail.scrollTop);
-				let num = Math.sign(up - e.detail.scrollTop);
-				if (num == 1) that.$set(that, `is_bottom`, false);
-			},
 			// 左侧一级选择
 			toChange(index, e) {
 				const that = this;

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pagesHome/home/index.js.map


+ 22 - 31
unpackage/dist/dev/mp-weixin/pagesHome/home/index.js

@@ -381,15 +381,15 @@ var _default =
                           list = that.buyList.find(function (i) {return i._id == e._id;});
                           if (list) {
                             if (list.num == 0) {
-                              cart = that.buyList.filter(function (i) {return i._id !== list._id;});
+                              cart = that.buyList.filter(function (i) {return i._id !== e._id;});
                               if (cart) that.$set(that, "buyList", cart);
                             } else {_iterator3 = _createForOfIteratorHelper(
                               that.buyList);try {for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {val = _step3.value;
-                                  if (val._id == list._id) val.num = e.num;
+                                  if (val._id == e._id) val.num = e.num;
                                 }} catch (err) {_iterator3.e(err);} finally {_iterator3.f();}
                             }
                           } else {
-                            if (e.num != 0) that.buyList.push(e);
+                            if (e.num !== 0) that.buyList.push(e);
                           }_iterator4 = _createForOfIteratorHelper(
                           that.typeList);try {_loop = function _loop() {var s = _step4.value;
                               var num = that.buyList.filter(function (i) {return i.code == s.code;});
@@ -417,45 +417,48 @@ var _default =
     // 查看选择商品详情
     toView: function toView() {
       var that = this;
+      var list = that.buyList.filter(function (i) {return i.num !== 0;});
+      that.$set(that, "buyList", list);
       that.$set(that, "popupShow", '1');
       that.$refs.specShow.open();
     },
     // 去购买
-    toBuy: function toBuy() {var _this4 = this;return _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee7() {var that, res, obj, cart, _obj;return _regenerator.default.wrap(function _callee7$(_context7) {while (1) {switch (_context7.prev = _context7.next) {case 0:
-                that = _this4;if (!(
-
-                that.buyList.length > 0)) {_context7.next = 19;break;}if (!
-                that.id) {_context7.next = 14;break;}_context7.next = 5;return (
-                  that.$api("cart/".concat(that.id), 'GET', {}));case 5:res = _context7.sent;if (!(
-                res.errcode == '0')) {_context7.next = 12;break;}
+    toBuy: function toBuy() {var _this4 = this;return _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee7() {var that, res, list, obj, cart, _obj;return _regenerator.default.wrap(function _callee7$(_context7) {while (1) {switch (_context7.prev = _context7.next) {case 0:
+                that = _this4;
+
+                list = that.buyList.filter(function (i) {return i.num !== 0;});if (!(
+                list.length > 0)) {_context7.next = 20;break;}if (!
+                that.id) {_context7.next = 15;break;}_context7.next = 6;return (
+                  that.$api("cart/".concat(that.id), 'GET', {}));case 6:res = _context7.sent;if (!(
+                res.errcode == '0')) {_context7.next = 13;break;}
                 obj = {
-                  list: [].concat(_toConsumableArray(that.buyList), _toConsumableArray(res.data.list)),
-                  total: that.$plus(that.cartNum.total, res.data.total) };_context7.next = 10;return (
+                  list: [].concat(_toConsumableArray(list), _toConsumableArray(res.data.list)),
+                  total: that.$plus(that.cartNum.total, res.data.total) };_context7.next = 11;return (
 
-                  that.$api("cart/".concat(res.data._id), 'POST', obj));case 10:cart = _context7.sent;
+                  that.$api("cart/".concat(res.data._id), 'POST', obj));case 11:cart = _context7.sent;
                 if (cart.errcode == '0') {
                   uni.navigateTo({
                     url: "/pagesHome/order/add?id=".concat(cart.data._id, "&order=").concat(that.order) });
 
-                }case 12:_context7.next = 19;break;case 14:
+                }case 13:_context7.next = 20;break;case 15:
 
 
                 _obj = {
-                  list: that.buyList,
+                  list: list,
                   total: that.cartNum.total,
-                  table: '63dc6a6b6a22ff30c8a11470' };_context7.next = 17;return (
+                  table: '63dc6a6b6a22ff30c8a11470' };_context7.next = 18;return (
 
-                  that.$api("cart", 'POST', _obj));case 17:res = _context7.sent;
+                  that.$api("cart", 'POST', _obj));case 18:res = _context7.sent;
                 if (res.errcode == '0') {
                   uni.navigateTo({
                     url: "/pagesHome/order/index?id=".concat(res.data._id) });
 
-                }case 19:case "end":return _context7.stop();}}}, _callee7);}))();
+                }case 20:case "end":return _context7.stop();}}}, _callee7);}))();
 
 
 
     },
-    // 关闭弹框
+    //清空购物车
     toDelete: function toDelete() {
       var that = this;var _iterator6 = _createForOfIteratorHelper(
       that.typeList),_step6;try {for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {var val = _step6.value;val.num = 0;}} catch (err) {_iterator6.e(err);} finally {_iterator6.f();}
@@ -465,18 +468,6 @@ var _default =
       that.searchMarket();
       that.$refs.specShow.close();
     },
-    // 分页
-    toPage: function toPage() {
-      var that = this;
-    },
-    // 触底
-    toScroll: function toScroll(e) {
-      var that = this;
-      var up = that.scrollTop;
-      that.$set(that, "scrollTop", e.detail.scrollTop);
-      var num = Math.sign(up - e.detail.scrollTop);
-      if (num == 1) that.$set(that, "is_bottom", false);
-    },
     // 左侧一级选择
     toChange: function toChange(index, e) {
       var that = this;

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 1 - 1
unpackage/dist/dev/mp-weixin/pagesHome/home/index.wxml