|
@@ -439,17 +439,14 @@ var _default =
|
|
|
}
|
|
|
},
|
|
|
// 去购买
|
|
|
- toBuy: function toBuy() {var _this4 = this;return _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee7() {var that, res, list, same, is_add, _iterator6, _step6, val, i, obj, update, _obj;return _regenerator.default.wrap(function _callee7$(_context7) {while (1) {switch (_context7.prev = _context7.next) {case 0:
|
|
|
+ toBuy: function toBuy() {var _this4 = this;return _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee7() {var that, res, list, is_add, _iterator6, _step6, val, i, obj, update, _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 = 29;break;}if (!
|
|
|
- that.order) {_context7.next = 20;break;}_context7.next = 6;return (
|
|
|
+ list.length > 0)) {_context7.next = 27;break;}if (!
|
|
|
+ that.order) {_context7.next = 18;break;}_context7.next = 6;return (
|
|
|
that.$api("order/".concat(that.order), 'GET', {}));case 6:res = _context7.sent;if (!(
|
|
|
- res.errcode == '0')) {_context7.next = 18;break;}
|
|
|
- same = res.data.list.length === list.length && res.data.list.filter(function (t) {return !list.
|
|
|
- includes(t);});if (!(
|
|
|
- same == false)) {_context7.next = 18;break;}
|
|
|
+ res.errcode == '0')) {_context7.next = 16;break;}
|
|
|
is_add = true;_iterator6 = _createForOfIteratorHelper(
|
|
|
res.data.list);try {for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {val = _step6.value;
|
|
|
for (i = 0; i < list.length; i++) {
|
|
@@ -464,33 +461,32 @@ var _default =
|
|
|
}} catch (err) {_iterator6.e(err);} finally {_iterator6.f();}
|
|
|
obj = {
|
|
|
list: list,
|
|
|
- total: that.$plus(that.cartNum.total, res.data.money) };_context7.next = 16;return (
|
|
|
+ total: that.$plus(that.cartNum.total, res.data.money) };_context7.next = 14;return (
|
|
|
|
|
|
- that.$api("cart/".concat(that.id), 'POST', obj));case 16:update = _context7.sent;
|
|
|
+ that.$api("cart/".concat(that.id), 'POST', obj));case 14:update = _context7.sent;
|
|
|
if (update.errcode == '0') {
|
|
|
uni.navigateTo({
|
|
|
url: "/pagesHome/order/add?id=".concat(that.id, "&order=").concat(that.order) });
|
|
|
|
|
|
- }case 18:_context7.next = 29;break;case 20:if (!
|
|
|
+ }case 16:_context7.next = 27;break;case 18:if (!
|
|
|
|
|
|
|
|
|
-
|
|
|
- that.shopInfo.table) {_context7.next = 28;break;}
|
|
|
+ that.shopInfo.table) {_context7.next = 26;break;}
|
|
|
_obj = {
|
|
|
list: list,
|
|
|
total: that.cartNum.total,
|
|
|
- table: that.shopInfo.table };_context7.next = 24;return (
|
|
|
+ table: that.shopInfo.table };_context7.next = 22;return (
|
|
|
|
|
|
- that.$api("cart", 'POST', _obj));case 24:res = _context7.sent;
|
|
|
+ that.$api("cart", 'POST', _obj));case 22:res = _context7.sent;
|
|
|
if (res.errcode == '0') {
|
|
|
uni.navigateTo({
|
|
|
url: "/pagesHome/order/index?id=".concat(res.data._id) });
|
|
|
|
|
|
- }_context7.next = 29;break;case 28:
|
|
|
+ }_context7.next = 27;break;case 26:
|
|
|
|
|
|
uni.showToast({
|
|
|
title: '请选择用餐桌号',
|
|
|
- icon: 'none' });case 29:case "end":return _context7.stop();}}}, _callee7);}))();
|
|
|
+ icon: 'none' });case 27:case "end":return _context7.stop();}}}, _callee7);}))();
|
|
|
|
|
|
|
|
|
|