下单逻辑修改提测

This commit is contained in:
GaoHao
2024-09-27 18:28:49 +08:00
parent a3e1d951e6
commit e2881ebd7b
11 changed files with 99 additions and 108 deletions

View File

@@ -72,6 +72,7 @@
code: uni.cache.get('tableCode'),
})
console.log()
if ( !data.data.shopTableInfo.choseCount ) {
uni.pro.navigateTo('/pagesOrder/orderAMeal/index', {
tableCode: tableCode,
@@ -94,6 +95,7 @@
shopId: uni.cache.get('shopId'),
type: 'index',
})
},
getQueryString(url, name) { //解码
var reg = new RegExp('(^|&|/?)' + name + '=([^&|/?]*)(&|/?|$)', 'i')

View File

@@ -61,7 +61,8 @@
<view class="shop-info">
<view class="shop-item">
<view class="cover" v-for="(item1,index1) in item.detailList" :key="index1">
<u-image width="112" height="112" radius="20" :src="item1.productImg"></u-image>
<u-image width="112" height="112" radius="20" :src='item1.productImg' v-if="item1.productId!=-999"></u-image>
<u-image width="112" height="112" radius="20" :src="'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/table.png'" mode="heightFix" v-else></u-image>
<text class="productName"> {{ item1.productName }} </text>
</view>
</view>
@@ -366,24 +367,24 @@
// #ifdef MP-ALIPAY
uni.requestPayment({
provider: 'alipay', //支付类型-固定值
orderInfo: item.id, // 微信支付商户号
orderInfo: res.data.tradeNo, // 微信支付商户号
success: (res) => {
let _this = this
uni.requestSubscribeMessage({
tmplIds: ['z0fUG7-jhSfYCrw6poOvSRzh4_hgnPkm_5C7E5s5bCQ'],
complete() {
uni.showToast({
title: "支付成功"
})
// uni.cache.set('shopUser', '') //删除shopUser
_this.paymodfiyOrderInfo()
uni.redirectTo({
url: '/pagesOrder/order_detail/index?orderId=' + _this
.listinfoid
});
},
})
// uni.requestSubscribeMessage({
// tmplIds: ['z0fUG7-jhSfYCrw6poOvSRzh4_hgnPkm_5C7E5s5bCQ'],
// complete() {
// uni.showToast({
// title: "支付成功"
// })
// // uni.cache.set('shopUser', '') //删除shopUser
// },
// })
_this.paymodfiyOrderInfo()
uni.redirectTo({
url: '/pagesOrder/order_detail/index?orderId=' + _this
.listinfoid
});
},
fail: () => {
uni.hideLoading()

View File

@@ -1,5 +1,5 @@
<template>
<viwe>
<view>
<u-popup :show="showCart" :round="20" :safeAreaInsetBottom="false" :zIndex="98" :overlayStyle="{ zIndex: 98 }"
@close="close">
<view class="cart-list-wrap">
@@ -15,24 +15,24 @@
<view class="shop-item" v-for="(item,index) in cartLists.data" :key="item.id">
<view class="shop-item-content">
<view class="cover" v-if="item.productId!=-999">
<u-image :src="item.coverImg" width="120" height="120"></u-image>
<u-image :src="item.coverImg" width="120" radius="10" height="120"></u-image>
</view>
<view class="info">
<view class="name"> {{ item.name }} </view>
<view class="select-sku-wrap"> {{ item.skuName }} </view>
<view class="price-wrap" style="padding-top: 0;">
<view class="price-wrap" style="padding-top: 0;" >
<view class="price">
<text class="i"></text>
<text class="num">{{ item.salePrice }}</text>
</view>
<view class="operation-wrap">
<view class="btn" v-if="item.number&&item.productId!=-999" >
<view class="btn" v-if="item.number" >
<u-icon name="minus-circle-fill" size="50"></u-icon>
<view class="btnClick" @click="cartListadd(item,index,'-')"></view>
</view>
<text class="num" v-if="item.number">{{ item.number }}</text>
<view class="btn" v-if="item.productId!=-999">
<view class="btn">
<u-icon name="plus-circle-fill" :color="item.isVip == 1 ? '#CECECE' : '#E9AB7A'" size="50"></u-icon>
<view class="btnClick" @click="cartListadd(item,index,'+')"></view>
</view>
@@ -40,7 +40,7 @@
</view>
</view>
</view>
<view class="shop-item-remark">
<view class="shop-item-remark" v-if="item.productId!=-999">
<view class="label">备注</view>
<u--input
placeholder="商品备注(选填)"
@@ -54,7 +54,7 @@
</scroll-view>
</view>
</u-popup>
</viwe>
</view>
</template>
@@ -116,7 +116,7 @@
"userId": uni.cache.get('userInfo').id,
"tableId": this.tableCode,
}
this.addCart(params);
this.$emit("addCart",params)
} catch (e) {
//TODO handle the exception
}
@@ -137,20 +137,9 @@
"userId": uni.cache.get('userInfo').id,
"tableId": this.tableCode,
}
this.addCart(params);
this.$emit("addCart",params)
},
/**
* 添加到购物车
*/
async addCart(data) {
let res = await this.api.cartAdd(data)
if (res.code == 0) {
this.showShopsku = false;
this.pagemetashow = false;
// this.$set(this, 'amountcartNumber', 0)
}
},
/**
* 清空购物车
*/

View File

@@ -13,7 +13,7 @@
<text class="i"></text>
<text class="num">{{cartLists.amount||'0.00'}}</text>
</view>
<view class="btn" @tap="orderdetail">
<view class="btn" @tap="$u.debounce(orderdetail, 500)" >
<text class="t">去结算</text>
</view>
</view>
@@ -26,11 +26,11 @@
data() {
return {
orderdetailFlag: true,
}
},
props:{
cartListsdatashow: {
type: Boolean
},
@@ -72,10 +72,7 @@
* 结算直接生成订单
*/
orderdetail() {
if (!this.orderdetailFlag) {
return;
}
this.orderdetailFlag = false;
if (this.cartLists.data.length == 0) {
uni.showToast({
title: '请先添加商品',

View File

@@ -211,7 +211,7 @@
<shoppingCart ref="shoppingCart" :shopId="shopId" :tableCode="tableCode" :cartLists_count="cartLists_count" :cartLists="cartLists" :showCart="showCart" @addCart="addCart" @close="close"></shoppingCart>
<!-- 购物车结算 -->
<shoppingCartBilling ref="shoppingCartBilling" :cartListsdatashow="cartListsdatashow" :shopId="shopId" :tableCode="tableCode" :dinersNum="dinersNum" :storeInfo="shopInfo.storeInfo" :cartLists_count="cartLists_count" :cartLists="cartLists" :showCart="showCart" @isOpen="isOpen"></shoppingCartBilling>
<shoppingCartBilling ref="shoppingCartBilling" :orderdetailFlag="orderdetailFlag" :cartListsdatashow="cartListsdatashow" :shopId="shopId" :tableCode="tableCode" :dinersNum="dinersNum" :storeInfo="shopInfo.storeInfo" :cartLists_count="cartLists_count" :cartLists="cartLists" :showCart="showCart" @isOpen="isOpen"></shoppingCartBilling>
<view class="placedOrderTip" @click="placedOrder" v-if="tableCode&&shopInfo.shopTableInfo&&shopInfo.shopTableInfo.orderId&&shopInfo.storeInfo.registerType == 'restaurant'"><u-avatar :src="src" shape="circle"></u-avatar><view style="margin-left: 8rpx;">已下单菜品</view></view>
@@ -434,7 +434,7 @@
},
async onShow() {
let _this = this;
this.orderdetailFlag = true;
uni.pageScrollTo({
scrollTop: 0,
duration: 0
@@ -534,7 +534,7 @@
if (this.shopId) {params.shopId = this.shopId}
let res = await this.api.productqueryShop(params)
if (res.code == 0) {
if ( !res.data.shopTableInfo.choseCount && !this.dinersNum ) {
if ( !res.data.shopTableInfo.choseCount && this.tableCode && !this.dinersNum ) {
uni.pro.navigateTo('/pagesOrder/orderAMeal/index', {
tableCode: this.tableCode,
shopId: res.data.storeInfo.id,
@@ -586,7 +586,7 @@
searchStatus (e) {
if ( e == "searchClick" ) {
uni.navigateTo({
url: `/pages/order_food/order_food_search?tableCode=${this.tableCode}&shopId=${this.shopId}`
url: `/pages/order_food/order_food_search?tableCode=${this.tableCode}&dinersNum=${this.dinersNum}&shopId=${this.shopId}`
});
}
},

View File

@@ -94,8 +94,7 @@
<shoppingCart ref="shoppingCart" :shopId="shopId" :tableCode="tableCode" :cartLists_count="cartLists_count" :cartLists="cartLists" :showCart="showCart" @addCart="addCart" @close="close"></shoppingCart>
<!-- 购物车结算 -->
<shoppingCartBilling ref="shoppingCartBilling" :cartListsdatashow="cartListsdatashow" :shopId="shopId" :tableCode="tableCode" :storeInfo="shopInfo.storeInfo" :cartLists_count="cartLists_count" :cartLists="cartLists" :showCart="showCart" @isOpen="isOpen"></shoppingCartBilling>
<shoppingCartBilling ref="shoppingCartBilling" :cartListsdatashow="cartListsdatashow" :shopId="shopId" :tableCode="tableCode" :dinersNum="dinersNum" :storeInfo="shopInfo.storeInfo" :cartLists_count="cartLists_count" :cartLists="cartLists" :showCart="showCart" @isOpen="isOpen"></shoppingCartBilling>
<!-- 规格 -->
<u-popup :show="showShopsku" :round="20" mode="bottom" @close="showShopsku = false;pagemetashow=false"
@@ -213,6 +212,8 @@
systemInfo: getApp().globalData.systemInfo,
shopId: null,
tableCode: null,
dinersNum: null,
}
},
onPageScroll(e) {
@@ -226,9 +227,9 @@
},
onLoad(e) {
if ( e.shopId ) {
this.shopId = e.shopId
}
if ( e.shopId ) { this.shopId = e.shopId }
if ( e.tableCode ) { this.tableCode = e.tableCode }
if ( e.dinersNum ) { this.dinersNum = e.dinersNum }
},
onUnload() {
if (this.socketTicket) {