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