|
@@ -295,6 +295,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
//
|
|
|
//
|
|
|
//
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
+//
|
|
|
var _default =
|
|
|
{
|
|
|
data: function data() {
|
|
@@ -340,7 +344,7 @@ var _default =
|
|
|
that.$api("shop", 'GET', {}));case 7:res = _context2.sent;
|
|
|
if (res.errcode == '0') {
|
|
|
data = res.data[0];
|
|
|
- data.table_name = that.tableList[0].name;
|
|
|
+ // data.table_name = that.tableList[0].name
|
|
|
that.$set(that, "shopInfo", data);
|
|
|
}_context2.next = 11;return (
|
|
|
that.$api("goodsTags", 'GET', {}));case 11:res = _context2.sent;
|
|
@@ -426,14 +430,22 @@ var _default =
|
|
|
that.$set(that, "popupShow", '1');
|
|
|
that.$refs.specShow.open();
|
|
|
},
|
|
|
+ tableChange: function tableChange(e) {
|
|
|
+ var that = this;
|
|
|
+ var data = that.tableList[e.detail.value];
|
|
|
+ if (data) {
|
|
|
+ that.$set(that.shopInfo, "table_name", data.name);
|
|
|
+ that.$set(that.shopInfo, "table", data._id);
|
|
|
+ }
|
|
|
+ },
|
|
|
// 去购买
|
|
|
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:
|
|
|
that = _this4;
|
|
|
|
|
|
list = that.buyList.filter(function (i) {return i.num !== 0;});if (!(
|
|
|
- list.length > 0)) {_context7.next = 25;break;}if (!
|
|
|
- that.id) {_context7.next = 20;break;}_context7.next = 6;return (
|
|
|
- that.$api("cart/".concat(that.id), 'GET', {}));case 6:res = _context7.sent;if (!(
|
|
|
+ list.length > 0)) {_context7.next = 29;break;}if (!
|
|
|
+ that.order) {_context7.next = 20;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 (!(
|
|
@@ -451,29 +463,35 @@ var _default =
|
|
|
}
|
|
|
}} catch (err) {_iterator6.e(err);} finally {_iterator6.f();}
|
|
|
obj = {
|
|
|
- list: that.buyList,
|
|
|
- money: that.$plus(that.cartNum.total, res.data.total) };_context7.next = 16;return (
|
|
|
+ list: list,
|
|
|
+ total: that.$plus(that.cartNum.total, res.data.money) };_context7.next = 16;return (
|
|
|
|
|
|
- that.$api("order/".concat(that.order), 'POST', obj));case 16:update = _context7.sent;
|
|
|
+ that.$api("cart/".concat(that.id), 'POST', obj));case 16: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 = 25;break;case 20:
|
|
|
+ }case 18:_context7.next = 29;break;case 20:if (!
|
|
|
|
|
|
|
|
|
|
|
|
+ that.shopInfo.table) {_context7.next = 28;break;}
|
|
|
_obj = {
|
|
|
list: list,
|
|
|
total: that.cartNum.total,
|
|
|
- table: that.tableList[0]._id };_context7.next = 23;return (
|
|
|
+ table: that.shopInfo.table };_context7.next = 24;return (
|
|
|
|
|
|
- that.$api("cart", 'POST', _obj));case 23:res = _context7.sent;
|
|
|
+ that.$api("cart", 'POST', _obj));case 24:res = _context7.sent;
|
|
|
if (res.errcode == '0') {
|
|
|
uni.navigateTo({
|
|
|
url: "/pagesHome/order/index?id=".concat(res.data._id) });
|
|
|
|
|
|
- }case 25:case "end":return _context7.stop();}}}, _callee7);}))();
|
|
|
+ }_context7.next = 29;break;case 28:
|
|
|
+
|
|
|
+ uni.showToast({
|
|
|
+ title: '请选择用餐桌号',
|
|
|
+ icon: 'none' });case 29:case "end":return _context7.stop();}}}, _callee7);}))();
|
|
|
+
|
|
|
|
|
|
|
|
|
|