下单逻辑修改
This commit is contained in:
@@ -20,6 +20,9 @@ export default {
|
|||||||
productqueryShop(data) { //通过桌码获取店铺信息
|
productqueryShop(data) { //通过桌码获取店铺信息
|
||||||
return uni.api.get("/product/queryShop", data);
|
return uni.api.get("/product/queryShop", data);
|
||||||
},
|
},
|
||||||
|
productChoseCount(data) { //就餐人数选择
|
||||||
|
return uni.api.post("/product/choseCount", data,false);
|
||||||
|
},
|
||||||
productqueryProduct(data) { //获取商品信息
|
productqueryProduct(data) { //获取商品信息
|
||||||
return uni.api.post("/product/queryProduct", data, false);
|
return uni.api.post("/product/queryProduct", data, false);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
export default {
|
|
||||||
userwxlogin(data) { //登录
|
|
||||||
return uni.api.post("/login/wx/custom/login", data, type = 2);
|
|
||||||
},
|
|
||||||
}
|
|
||||||
2
main.js
2
main.js
@@ -3,7 +3,6 @@ import uView from '@/uni_modules/uview-ui'
|
|||||||
import useStorage from '@/utils/useStroage.js'
|
import useStorage from '@/utils/useStroage.js'
|
||||||
import './framework/bootstrap'
|
import './framework/bootstrap'
|
||||||
import Api from "./common/js/api.js"
|
import Api from "./common/js/api.js"
|
||||||
import Shop from "./common/js/shop.js"
|
|
||||||
import store from './store'
|
import store from './store'
|
||||||
// #ifndef VUE3
|
// #ifndef VUE3
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
@@ -22,7 +21,6 @@ Vue.use(uView)
|
|||||||
uni.$u.config.unit = 'rpx'
|
uni.$u.config.unit = 'rpx'
|
||||||
Vue.prototype.useStorage = useStorage
|
Vue.prototype.useStorage = useStorage
|
||||||
Vue.prototype.api = Api;
|
Vue.prototype.api = Api;
|
||||||
Vue.prototype.shop = Shop;
|
|
||||||
Vue.prototype.$onLaunched = new Promise(resolve => {
|
Vue.prototype.$onLaunched = new Promise(resolve => {
|
||||||
Vue.prototype.$isResolve = resolve
|
Vue.prototype.$isResolve = resolve
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -64,6 +64,7 @@
|
|||||||
if ( !data.data.shopTableInfo.choseCount ) {
|
if ( !data.data.shopTableInfo.choseCount ) {
|
||||||
uni.pro.navigateTo('/pagesOrder/orderAMeal/index', {
|
uni.pro.navigateTo('/pagesOrder/orderAMeal/index', {
|
||||||
tableCode: tableCode,
|
tableCode: tableCode,
|
||||||
|
shopId: data.data.storeInfo.id,
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
uni.pro.navigateTo('order_food/order_food', {
|
uni.pro.navigateTo('order_food/order_food', {
|
||||||
|
|||||||
@@ -75,6 +75,7 @@
|
|||||||
if ( !data.data.shopTableInfo.choseCount ) {
|
if ( !data.data.shopTableInfo.choseCount ) {
|
||||||
uni.pro.navigateTo('/pagesOrder/orderAMeal/index', {
|
uni.pro.navigateTo('/pagesOrder/orderAMeal/index', {
|
||||||
tableCode: tableCode,
|
tableCode: tableCode,
|
||||||
|
shopId: data.data.storeInfo.id,
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
uni.pro.navigateTo('order_food/order_food', {
|
uni.pro.navigateTo('order_food/order_food', {
|
||||||
|
|||||||
@@ -315,6 +315,12 @@
|
|||||||
async showpopupclick(item) {
|
async showpopupclick(item) {
|
||||||
let res = await this.api.payorderPay({
|
let res = await this.api.payorderPay({
|
||||||
orderId: item.id,
|
orderId: item.id,
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
|
payType: 'wechatPay',
|
||||||
|
// #endif
|
||||||
|
// #ifdef MP-ALIPAY
|
||||||
|
payType: 'aliPay',
|
||||||
|
// #endif
|
||||||
}) //判断是否支付成功
|
}) //判断是否支付成功
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
|
|||||||
@@ -603,6 +603,13 @@
|
|||||||
if (this.shopId) {params.shopId = this.shopId}
|
if (this.shopId) {params.shopId = this.shopId}
|
||||||
let res = await this.api.productqueryShop(params)
|
let res = await this.api.productqueryShop(params)
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
|
if ( !res.data.shopTableInfo.choseCount && !this.dinersNum ) {
|
||||||
|
uni.pro.navigateTo('/pagesOrder/orderAMeal/index', {
|
||||||
|
tableCode: this.tableCode,
|
||||||
|
shopId: res.data.storeInfo.id,
|
||||||
|
})
|
||||||
|
return;
|
||||||
|
}
|
||||||
let expireTime = uni.utils.timestamp() + 30 * 60; // 有效期
|
let expireTime = uni.utils.timestamp() + 30 * 60; // 有效期
|
||||||
uni.cache.set('shopId', res.data.storeInfo.id, expireTime)
|
uni.cache.set('shopId', res.data.storeInfo.id, expireTime)
|
||||||
this.shopId = res.data.storeInfo.id;
|
this.shopId = res.data.storeInfo.id;
|
||||||
|
|||||||
@@ -73,15 +73,18 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="row">
|
<view class="row">
|
||||||
<text class="t">订单类型:</text>
|
<text class="t">订单类型:</text>
|
||||||
<text class="info">{{$u.timeFormat(listinfo.time, 'yyyy-mm-dd hh:MM:ss')}}</text>
|
<text class="info" v-if="listinfo.sendType == 'post'">快递</text>
|
||||||
|
<text class="info" v-if="listinfo.sendType == 'takeaway'">外卖</text>
|
||||||
|
<text class="info" v-if="listinfo.sendType == 'takeself'">自提</text>
|
||||||
|
<text class="info" v-if="listinfo.sendType == 'table'">堂食</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="row">
|
<view class="row">
|
||||||
<text class="t">备注:</text>
|
<text class="t">备注:</text>
|
||||||
<text class="info"></text>
|
<text class="info">{{ listinfo.orderInfo.remark}}</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="row">
|
<view class="row">
|
||||||
<text class="t">就餐人数:</text>
|
<text class="t">就餐人数:</text>
|
||||||
<text class="info">{{$u.timeFormat(listinfo.time, 'yyyy-mm-dd hh:MM:ss')}}</text>
|
<text class="info">{{ listinfo.orderInfo.seatCount}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</viwe>
|
</viwe>
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
<view class="tabBox" v-if="storeInfo.registerType == 'munchies'">
|
<view class="tabBox" v-if="storeInfo.registerType == 'munchies'">
|
||||||
<view class="tab">
|
<view class="tab">
|
||||||
<view :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.val)">
|
<view :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></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+1)?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+1)}">{{item.title}}</text>
|
||||||
@@ -76,7 +76,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="cell_item" v-if="dinersNum">
|
<view class="cell_item" v-if="dinersNum">
|
||||||
<view class="label">餐位费</view>
|
<view class="label">餐位费</view>
|
||||||
<view class="value"><view>X{{dinersNum}}</view><view>X{{dinersNum*storeInfo.tableFee}}</view></view>
|
<view class="value"><view>X{{dinersNum}}</view><view>¥{{dinersNum*storeInfo.tableFee}}</view></view>
|
||||||
</view>
|
</view>
|
||||||
<!-- <view class="favorable" v-for="(item,index) in favorable" :key="index">
|
<!-- <view class="favorable" v-for="(item,index) in favorable" :key="index">
|
||||||
<view class="favorable_left">
|
<view class="favorable_left">
|
||||||
@@ -189,9 +189,10 @@
|
|||||||
},
|
},
|
||||||
is_type: 1,
|
is_type: 1,
|
||||||
is_typeList: [
|
is_typeList: [
|
||||||
{ title: "送餐到桌", 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: "送餐到桌", 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: "打包外带", 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: "打包外带", 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"},
|
||||||
],
|
],
|
||||||
|
sendType: "table",
|
||||||
eatModel: [],
|
eatModel: [],
|
||||||
favorable: [
|
favorable: [
|
||||||
{ name: "优惠券", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/coupon.png"},
|
{ name: "优惠券", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/coupon.png"},
|
||||||
@@ -412,10 +413,11 @@
|
|||||||
* 监听送餐/打包切换
|
* 监听送餐/打包切换
|
||||||
* @param {Object} val
|
* @param {Object} val
|
||||||
*/
|
*/
|
||||||
tabClick ( index,val ) {
|
tabClick ( index, item ) {
|
||||||
this.is_type = index;
|
this.is_type = index;
|
||||||
|
this.sendType = item.type
|
||||||
this.eatModel = [];
|
this.eatModel = [];
|
||||||
this.eatModel.push(val);
|
this.eatModel.push(item.val);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -528,6 +530,7 @@
|
|||||||
"isYhq": 0, // 是否使用优惠券( 1: 使用, 0: 不使用),
|
"isYhq": 0, // 是否使用优惠券( 1: 使用, 0: 不使用),
|
||||||
"isBuyYhq": 0, // 是否购买优惠券( 1: 购买, 0: 不够买)
|
"isBuyYhq": 0, // 是否购买优惠券( 1: 购买, 0: 不够买)
|
||||||
"productId": '', //商品id
|
"productId": '', //商品id
|
||||||
|
"sendType": this.sendType,
|
||||||
"tableId": this.tableCode , //商品id
|
"tableId": this.tableCode , //商品id
|
||||||
"dinersNum": this.dinersNum, //就餐人数
|
"dinersNum": this.dinersNum, //就餐人数
|
||||||
"eatModel": this.eatModel, //就餐模式
|
"eatModel": this.eatModel, //就餐模式
|
||||||
|
|||||||
@@ -42,7 +42,9 @@
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
this.tableCode = uni.cache.get('tableCode');
|
console.log(options)
|
||||||
|
this.tableCode = options.tableCode;
|
||||||
|
this.shopId = options.shopId;
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
},
|
},
|
||||||
@@ -69,7 +71,7 @@
|
|||||||
/**
|
/**
|
||||||
* 开始点餐
|
* 开始点餐
|
||||||
*/
|
*/
|
||||||
start () {
|
async start () {
|
||||||
if ( this.numIndex == -1 && (this.otherNum == "其他"||this.otherNum <= 0)) {
|
if ( this.numIndex == -1 && (this.otherNum == "其他"||this.otherNum <= 0)) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '请选择就餐人数',
|
title: '请选择就餐人数',
|
||||||
@@ -80,6 +82,12 @@
|
|||||||
if ( this.numIndex == -1 && this.otherNum != "其他") {
|
if ( this.numIndex == -1 && this.otherNum != "其他") {
|
||||||
this.dinersNum = this.otherNum
|
this.dinersNum = this.otherNum
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let res = await this.api.productChoseCount({
|
||||||
|
orderId: this.orderId,
|
||||||
|
dinersNum: this.dinersNum,
|
||||||
|
shopId: this.shopId,
|
||||||
|
}) //判断是否支付成功
|
||||||
uni.pro.navigateTo('order_food/order_food', {
|
uni.pro.navigateTo('order_food/order_food', {
|
||||||
tableCode: this.tableCode,
|
tableCode: this.tableCode,
|
||||||
dinersNum: this.dinersNum,
|
dinersNum: this.dinersNum,
|
||||||
|
|||||||
@@ -225,6 +225,12 @@
|
|||||||
async wechatPay() {
|
async wechatPay() {
|
||||||
let res = await this.api.payorderPay({
|
let res = await this.api.payorderPay({
|
||||||
orderId: this.orderId,
|
orderId: this.orderId,
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
|
payType: 'wechatPay',
|
||||||
|
// #endif
|
||||||
|
// #ifdef MP-ALIPAY
|
||||||
|
payType: 'aliPay',
|
||||||
|
// #endif
|
||||||
}) //判断是否支付成功
|
}) //判断是否支付成功
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
|
|||||||
Reference in New Issue
Block a user