zs 2 年之前
父节点
当前提交
252b6862fa

+ 2 - 2
pagesHome/home/index.vue

@@ -199,8 +199,8 @@
 								if (s._id == val._id) s.num = val.num
 							}
 						}
+						that.$set(that, `marketList`, res.data)
 					})
-					that.$set(that, `marketList`, res.data)
 				} else {
 					uni.showToast({
 						title: res.errmsg,
@@ -219,7 +219,7 @@
 							if (cart) that.$set(that, `buyList`, cart)
 						} else {
 							for (let val of that.buyList) {
-								if (val._id == list._id) val.num = list.num
+								if (val._id == list._id) val.num = e.num
 							}
 						}
 					} else {

+ 25 - 18
pagesHome/order/index.vue

@@ -146,24 +146,31 @@
 			// 下单
 			async toBuy() {
 				const that = this;
-				let type = '0';
-				if (that.is_show == true) type = '0'
-				else type = '1'
-				let obj = {
-					time: moment().format('YYYY-MM-DD HH:mm:ss'),
-					remark: that.shopInfo.remark,
-					table: that.shopInfo.table_id,
-					money: that.shopInfo.detail_total,
-					money_num: that.shopInfo.perMoney,
-					num: that.shopInfo.person,
-					cart:that.id,
-					type: type,
-					list: that.list
-				}
-				let res = await that.$api(`order`, 'POST', obj);
-				if (res.errcode == '0') {
-					uni.navigateTo({
-						url: `/pagesHome/order/info?id=${res.data._id}`
+				if(that.shopInfo.person&&that.shopInfo.perMoney){
+					let type = '0';
+					if (that.is_show == true) type = '0'
+					else type = '1'
+					let obj = {
+						time: moment().format('YYYY-MM-DD HH:mm:ss'),
+						remark: that.shopInfo.remark,
+						table: that.shopInfo.table_id,
+						money: that.shopInfo.detail_total,
+						money_num: that.shopInfo.perMoney,
+						num: that.shopInfo.person,
+						cart:that.id,
+						type: type,
+						list: that.list
+					}
+					let res = await that.$api(`order`, 'POST', obj);
+					if (res.errcode == '0') {
+						uni.navigateTo({
+							url: `/pagesHome/order/info?id=${res.data._id}`
+						})
+					}
+				}else{
+					uni.showToast({
+						title: '请选择用餐人数',
+						icon: 'none'
 					})
 				}
 			},

文件差异内容过多而无法显示
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/common/main.js.map


文件差异内容过多而无法显示
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pagesHome/home/index.js.map


文件差异内容过多而无法显示
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pagesHome/order/add.js.map


文件差异内容过多而无法显示
+ 1 - 1
unpackage/dist/dev/.sourcemap/mp-weixin/pagesHome/order/index.js.map


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

@@ -364,9 +364,9 @@ var _default =
                                 res.data);try {for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {s = _step2.value;
                                     if (s._id == val._id) s.num = val.num;
                                   }} catch (err) {_iterator2.e(err);} finally {_iterator2.f();}
-                              }} catch (err) {_iterator.e(err);} finally {_iterator.f();}case 2:case "end":return _context3.stop();}}}, _callee3);})));
+                              }} catch (err) {_iterator.e(err);} finally {_iterator.f();}
+                            that.$set(that, "marketList", res.data);case 3:case "end":return _context3.stop();}}}, _callee3);})));
 
-                  that.$set(that, "marketList", res.data);
                 } else {
                   uni.showToast({
                     title: res.errmsg,
@@ -385,7 +385,7 @@ var _default =
                               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 = list.num;
+                                  if (val._id == list._id) val.num = e.num;
                                 }} catch (err) {_iterator3.e(err);} finally {_iterator3.f();}
                             }
                           } else {

+ 11 - 4
unpackage/dist/dev/mp-weixin/pagesHome/order/index.js

@@ -331,7 +331,8 @@ var _moment = _interopRequireDefault(__webpack_require__(/*! moment */ 42));func
     },
     // 下单
     toBuy: function toBuy() {var _this2 = this;return _asyncToGenerator( /*#__PURE__*/_regenerator.default.mark(function _callee3() {var that, type, obj, res;return _regenerator.default.wrap(function _callee3$(_context3) {while (1) {switch (_context3.prev = _context3.next) {case 0:
-                that = _this2;
+                that = _this2;if (!(
+                that.shopInfo.person && that.shopInfo.perMoney)) {_context3.next = 11;break;}
                 type = '0';
                 if (that.is_show == true) type = '0';else
                 type = '1';
@@ -344,14 +345,20 @@ var _moment = _interopRequireDefault(__webpack_require__(/*! moment */ 42));func
                   num: that.shopInfo.person,
                   cart: that.id,
                   type: type,
-                  list: that.list };_context3.next = 6;return (
+                  list: that.list };_context3.next = 7;return (
 
-                  that.$api("order", 'POST', obj));case 6:res = _context3.sent;
+                  that.$api("order", 'POST', obj));case 7:res = _context3.sent;
                 if (res.errcode == '0') {
                   uni.navigateTo({
                     url: "/pagesHome/order/info?id=".concat(res.data._id) });
 
-                }case 8:case "end":return _context3.stop();}}}, _callee3);}))();
+                }_context3.next = 12;break;case 11:
+
+                uni.showToast({
+                  title: '请选择用餐人数',
+                  icon: 'none' });case 12:case "end":return _context3.stop();}}}, _callee3);}))();
+
+
     } } };exports.default = _default;
 /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 1)["default"]))