|
@@ -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'
|
|
|
})
|
|
|
}
|
|
|
},
|