增加创建订单接口,堂食自取切换接口
This commit is contained in:
@@ -35,25 +35,23 @@ export default {
|
||||
cleanCart(data) { //清空购物车
|
||||
return uni.api.post("/product/cleanCart", data);
|
||||
},
|
||||
|
||||
// 下单
|
||||
creatGroupOrder(data) {
|
||||
return uni.api.post("/groupOrderInfo/creatGroupOrder", data);
|
||||
},
|
||||
// 支付
|
||||
payOrderPay(data) {
|
||||
return uni.api.post("/pay/groupOrderPay", data);
|
||||
// 下单详情
|
||||
getproductorderConfirm(data) {
|
||||
return uni.api.get("/product/orderConfirm", data);
|
||||
},
|
||||
// 下单详情
|
||||
getproductorderConfirm(data) {
|
||||
return uni.api.get("/product/orderConfirm", data);
|
||||
},
|
||||
|
||||
logincreateCardNo(data) { //获取会员码
|
||||
return uni.api.get("/login/createCardNo", data);
|
||||
choseEatModel(data) { //就餐模式选择
|
||||
return uni.api.post("/product/choseEatModel", data, false);
|
||||
},
|
||||
|
||||
|
||||
// 支付
|
||||
payOrderPay(data) {
|
||||
return uni.api.post("/pay/groupOrderPay", data);
|
||||
},
|
||||
// 会员支付
|
||||
accountPay(data) {
|
||||
return uni.api.get("/pay/accountPay", data);
|
||||
@@ -64,6 +62,10 @@ export default {
|
||||
paymodfiyOrderInfo(data) { //查询订单支付状态
|
||||
return uni.api.post("/pay/modfiyOrderInfo", data);
|
||||
},
|
||||
paymemeberIn(data) { //充值
|
||||
return uni.api.post("/pay/memeberIn", data);
|
||||
},
|
||||
|
||||
|
||||
orderorderList(data) { //订单列表
|
||||
return uni.api.get("/order/orderList", data);
|
||||
@@ -74,6 +76,10 @@ export default {
|
||||
removeOrder(data) { //删除订单
|
||||
return uni.api.post("/order/rmOrder", data);
|
||||
},
|
||||
creatOrder(data) { //创建订单
|
||||
return uni.api.post("/order/creatOrder", data);
|
||||
},
|
||||
|
||||
|
||||
// 团购订单列表
|
||||
groupOrderInfo(data) { //订单列表
|
||||
@@ -83,10 +89,11 @@ export default {
|
||||
groupOrderInfoDetail(data) { //订单回显
|
||||
return uni.api.get("/groupOrderInfo/get", data);
|
||||
},
|
||||
|
||||
paymemeberIn(data) { //充值
|
||||
return uni.api.post("/pay/memeberIn", data);
|
||||
// 下单
|
||||
creatGroupOrder(data) {
|
||||
return uni.api.post("/groupOrderInfo/creatGroupOrder", data);
|
||||
},
|
||||
|
||||
|
||||
|
||||
// 获取店铺会员信息
|
||||
|
||||
@@ -16,14 +16,14 @@
|
||||
|
||||
<view class="tabBox" v-if="storeInfo.registerType == 'munchies'">
|
||||
<view class="tab">
|
||||
<view v-if="item.show" :class="is_type==(index+1)?'tab_item'+is_type+' tab_item active ':'tab_item'" v-for="(item,index) in is_typeList" :key="index" @click="tabClick(index+1,item)">
|
||||
<view v-if="item.show" :class="is_type==index?'tab_item'+(is_type+1)+' tab_item active ':'tab_item'" v-for="(item,index) in is_typeList" :key="index" @click="tabClick(index,item)">
|
||||
<view></view>
|
||||
<image class="icon" :src="is_type==(index+1)?item.url_active:item.url" mode="aspectFill"/>
|
||||
<text class="title" :class="{active:is_type==(index+1)}">{{item.title}}</text>
|
||||
<image class="icon" :src="is_type==index?item.url_active:item.url" mode="aspectFill"/>
|
||||
<text class="title" :class="{active:is_type==index}">{{item.title}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 送餐到桌 -->
|
||||
<view class="table" v-if="is_type==1">
|
||||
<view class="table" v-if="is_type==0">
|
||||
<view class="table_left">
|
||||
<image class="icon" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/table.png" mode="aspectFill"/>
|
||||
<text class="title">桌台</text>
|
||||
@@ -144,10 +144,10 @@
|
||||
</block>
|
||||
</view>
|
||||
|
||||
<u-popup :show="ispws" :round="20" mode="bottom" @close="ispws = false" height="500" :safeAreaInsetBottom="false">
|
||||
<u-popup :show="ispws" :round="20" mode="bottom" @close="close" height="500" :safeAreaInsetBottom="false">
|
||||
<view class="pay-info-wrap">
|
||||
<view class="info-wrap flex-between">
|
||||
<view class="close" @click="ispws = false">
|
||||
<view class="close" @click="close">
|
||||
<u-icon name="close" color="#999999" size="40"></u-icon>
|
||||
</view>
|
||||
<text class="title">请输入支付密码</text>
|
||||
@@ -185,7 +185,7 @@
|
||||
toplist: {
|
||||
name: '确认订单'
|
||||
},
|
||||
is_type: 1,
|
||||
is_type: 0,
|
||||
is_typeList: [
|
||||
{ title: "送餐到桌", show: false, type: "table", val: "dine-in", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/tab1.png" , url_active: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/tab1_active.png"},
|
||||
{ title: "打包外带", show: false, type: "takeself", val: "take-out", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/tab2.png" , url_active: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/tab2_active.png"},
|
||||
@@ -253,13 +253,14 @@
|
||||
if ( e.dinersNum ) { this.dinersNum = e.dinersNum;}
|
||||
|
||||
if ( this.storeInfo.eatModel.indexOf("dine-in") != -1 ) {
|
||||
this.eatModel = ["dine-in"]
|
||||
this.eatModel = "dine-in";
|
||||
this.is_type = 0;
|
||||
} else {
|
||||
this.eatModel = ["take-out"]
|
||||
}
|
||||
if ( e.tableCode ) {
|
||||
this.getProductqueryShop()
|
||||
this.eatModel = "take-out";
|
||||
this.is_type = 1;
|
||||
}
|
||||
this.getProductqueryShop();
|
||||
this.getchoseEatModel();
|
||||
},
|
||||
onShow() {
|
||||
if (this.listinfoid) {
|
||||
@@ -355,28 +356,33 @@
|
||||
} else {
|
||||
switch (msg.type) {
|
||||
case 'createOrder':
|
||||
if ( this.storeInfo.registerType == 'restaurant') {
|
||||
uni.switchTab({
|
||||
url: '/pages/order/order'
|
||||
});
|
||||
return;
|
||||
if ( this.eatModel == "dine-in" && this.tableCode ) {
|
||||
if ( this.storeInfo.registerType == 'restaurant') {
|
||||
uni.switchTab({
|
||||
url: '/pages/order/order'
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.isSocket = true;
|
||||
this.listinfoid = msg.data.id
|
||||
this.listinfo.details = msg.data.detailList;
|
||||
this.listinfo.payAmount = msg.data.amount;
|
||||
|
||||
uni.$off('getMessage')
|
||||
this.orderorderInfo(1)
|
||||
}
|
||||
this.isSocket = true;
|
||||
this.listinfoid = msg.data.id
|
||||
this.listinfo.details = msg.data.detailList;
|
||||
this.listinfo.payAmount = msg.data.amount;
|
||||
|
||||
uni.$off('getMessage')
|
||||
this.orderorderInfo(1)
|
||||
break;
|
||||
case 'addCart':
|
||||
this.isSocket = true;
|
||||
if (this.listinfoid) {
|
||||
this.orderorderInfo()
|
||||
} else {
|
||||
this.listinfo.details = msg.data;
|
||||
this.listinfo.payAmount = msg.amount;
|
||||
if ( this.eatModel == "dine-in" && this.tableCode ) {
|
||||
if (this.listinfoid) {
|
||||
this.orderorderInfo()
|
||||
} else {
|
||||
this.listinfo.details = msg.data;
|
||||
this.listinfo.payAmount = msg.amount;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case 'order':
|
||||
uni.navigateBack()
|
||||
@@ -410,6 +416,22 @@
|
||||
this.sendType = item.type
|
||||
this.eatModel = [];
|
||||
this.eatModel.push(item.val);
|
||||
this.getchoseEatModel();
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取堂食/外带菜品数据
|
||||
*/
|
||||
async getchoseEatModel () {
|
||||
let params = {
|
||||
shopId: uni.cache.get('shopId'),
|
||||
type: this.is_type,
|
||||
}
|
||||
if ( this.eatModel == "dine-in" && this.tableCode ) { params.tableId = this.tableCode; }
|
||||
if ( this.dinersNum ) { params.num = this.dinersNum; }
|
||||
let res = await this.api.choseEatModel(params)
|
||||
this.listinfo.details = res.data.info;
|
||||
this.listinfo.payAmount = res.data.amount;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -421,6 +443,16 @@
|
||||
this.paymentBtnText = e.name;
|
||||
},
|
||||
|
||||
/**
|
||||
* 输入密码关闭
|
||||
*/
|
||||
close () {
|
||||
this.ispws = false;
|
||||
uni.pro.navigateTo('/pagesOrder/order_detail/index', {
|
||||
orderId: this.listinfoid
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 初始化socket
|
||||
*/
|
||||
@@ -489,15 +521,9 @@
|
||||
/**
|
||||
* 生成订单
|
||||
*/
|
||||
orderdetail() {
|
||||
if (!this.isSocket) {
|
||||
uni.showToast({
|
||||
title: "当前网络异常,请稍后再试",
|
||||
icon: "none",
|
||||
})
|
||||
return;
|
||||
}
|
||||
if ( this.sendType == 'table' && !this.tableCode) {
|
||||
async orderdetail() {
|
||||
|
||||
if ( this.eatModel == "dine-in" && !this.tableCode) {
|
||||
uni.showToast({
|
||||
title: "请选择桌台",
|
||||
icon: "none",
|
||||
@@ -512,30 +538,23 @@
|
||||
return;
|
||||
}
|
||||
|
||||
let data = {
|
||||
"skuId": '',
|
||||
"num": '', //数量
|
||||
"type": "createOrder", //“addcart:添加购物车,create0rder:生成订单,clearCart:庆康购物车”,
|
||||
"remark": this.remark,
|
||||
"couponsId": '', //优惠券ID,
|
||||
"isYhq": 0, // 是否使用优惠券( 1: 使用, 0: 不使用),
|
||||
"isBuyYhq": 0, // 是否购买优惠券( 1: 购买, 0: 不够买)
|
||||
"productId": '', //商品id
|
||||
"sendType": this.sendType,
|
||||
"tableId": this.tableCode , //商品id
|
||||
"dinersNum": this.dinersNum, //就餐人数
|
||||
"eatModel": this.eatModel, //就餐模式
|
||||
let res = await this.api.creatOrder({
|
||||
"tableId": this.tableCode , //桌台码
|
||||
"shopId": uni.cache.get('shopId'),
|
||||
"userId": uni.cache.get('userInfo').id,
|
||||
}
|
||||
uni.$u.debounce(this.socketSendMsg(data), 500)
|
||||
"sendType": this.sendType,
|
||||
"remark": this.remark,
|
||||
})
|
||||
console.log(res)
|
||||
this.listinfoid = res.data.id
|
||||
this.showpopupclickdd();
|
||||
},
|
||||
|
||||
/**
|
||||
* 去支付
|
||||
*/
|
||||
showpopupclickdd() {
|
||||
if ( this.radiovalue == 2 || this.radiovalue == 3 && this.listinfo.payAmount <= 0 ) {
|
||||
if ( (this.radiovalue == 2 || this.radiovalue == 3) && this.listinfo.payAmount <= 0 ) {
|
||||
uni.showToast({
|
||||
title: "支付金额必须大于0",
|
||||
icon: 'none'
|
||||
@@ -547,7 +566,7 @@
|
||||
mask: true
|
||||
})
|
||||
// radiovalue为2是微信支付
|
||||
if (this.radiovalue == 2||this.radiovalue == 3) {
|
||||
if (this.radiovalue == 2 || this.radiovalue == 3) {
|
||||
this.showpopupclickdds() //微信支付
|
||||
} else {
|
||||
// 先判断是否设置支付密码。0是没设置。没设置的情况下跳转到设置页面。有的话输入支付密码
|
||||
@@ -619,6 +638,9 @@
|
||||
})
|
||||
},
|
||||
fail: () => {
|
||||
uni.pro.navigateTo('/pagesOrder/order_detail/index', {
|
||||
orderId: this.listinfoid
|
||||
})
|
||||
uni.hideLoading()
|
||||
}
|
||||
});
|
||||
@@ -645,6 +667,9 @@
|
||||
});
|
||||
},
|
||||
fail: () => {
|
||||
uni.pro.navigateTo('/pagesOrder/order_detail/index', {
|
||||
orderId: this.listinfoid
|
||||
})
|
||||
uni.hideLoading()
|
||||
}
|
||||
});
|
||||
|
||||
@@ -132,7 +132,7 @@
|
||||
* 去支付
|
||||
*/
|
||||
goToPay(){
|
||||
if ( this.radiovalue == 2 || this.radiovalue == 3 && this.listinfo.payAmount <= 0 ) {
|
||||
if ( (this.radiovalue == 2 || this.radiovalue == 3) && this.listinfo.payAmount <= 0 ) {
|
||||
uni.showToast({
|
||||
title: "支付金额必须大于0",
|
||||
icon: 'none'
|
||||
|
||||
Reference in New Issue
Block a user