代客下单问题修复,积分上传问题修复

This commit is contained in:
2025-12-12 17:56:26 +08:00
parent 9a0164eff6
commit 6f1864771d
29 changed files with 12071 additions and 7571 deletions

View File

@@ -69,6 +69,8 @@
</view>
</view>
</view>
</view>
</template>
@@ -552,4 +554,9 @@ const showOldPrice = computed(() => {});
text-decoration: line-through;
text-align: right;
}
.total{
padding-top: 32rpx;
border-top: 1px solid #EDEDED;
text-align: right;
}
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,6 @@
<template>
<view>
<view class="card_box">
<view class="card_head_box">
<view class="card_head_item" v-for="(item,index) in 8" :key="index"></view>
</view>
<!-- 先付款 -->
<view class="tabBox" v-if="listinfo.status == 'unpaid'">
@@ -44,6 +41,21 @@
</view>
</view> -->
</view>
<view class="tabBox" v-else-if="listinfo.tableName">
<view class="table" >
<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>
</view>
<view class="value" v-if="listinfo.tableName"> {{ listinfo.tableName || '' }} </view>
</view>
</view>
<view class="card">
<!-- 订单头部 -->
<view class="card_item" v-for="(value, key) in listinfo.detailMap" :key="key">
@@ -162,31 +174,57 @@
</view>
</view>
</block>
<block v-else>
<!-- <block v-else>
<view class="cell-item column" v-if="listinfo.discountInfo">
<view class="label">优惠折扣</view>
<view class="val column">
<view class="productCoupon" v-for="(item,index) in listinfo.discountInfo" :key="index">
<view class="name">{{item.name}}</view>
<!-- <view class="num">{{item.amount}}</view> -->
<view class="amount" style="margin-left: 10rpx;">{{item.amount}}</view>
</view>
</view>
</view>
</block>
</block> -->
<view class="total-wrap" v-if="listinfo.status == 'unpaid'">
<view>总计</view>
<view class="price"> {{listinfo.totalCost}} </view>
<text>总计</text>
<text class="u-font-32"></text>
<text class="price"> {{listinfo.totalCost}} </text>
</view>
<view class="total-wrap" v-else>
<view>实付</view>
<view class="price"> {{listinfo.payAmount}} </view>
<view>实付</view>
<text class="u-font-32"></text>
<text class="price"> {{listinfo.payAmount}} </text>
</view>
</view>
</view>
<view class="disocunt " v-if="showDiscount">
<view class="row" v-if="listinfo.productCouponDiscountAmount">
<text class="t">商品券</text>
<text class="info price">-{{listinfo.productCouponDiscountAmount}}</text>
</view>
<view class="row" v-if="listinfo.otherCouponDiscountAmount">
<text class="t">优惠券</text>
<text class="price">-{{listinfo.otherCouponDiscountAmount}}</text>
</view>
<view class="row" v-if="listinfo.pointsDiscountAmount">
<text class="t">积分抵扣</text>
<text class="price">-{{listinfo.pointsDiscountAmount}}</text>
</view>
<view class="row" v-if="listinfo.discountActAmount">
<text class="t">满减活动</text>
<text class="price">-{{listinfo.discountActAmount}}</text>
</view>
<view class="row" v-if="listinfo.newCustomerDiscountAmount">
<text class="t">新客立减</text>
<text class="price">-{{listinfo.newCustomerDiscountAmount}}</text>
</view>
</view>
<view class="orderInfo">
<view class="row" @click="copyHandle(listinfo.orderNo)">
<text class="t">订单编号</text>
@@ -295,6 +333,7 @@
])
const props = defineProps({
freeCheck: {
type: Boolean
@@ -330,6 +369,47 @@
})
/**
* 判断一个对象里的某些属性是否存在且值不等于0满足其中一个就返回true否则false
* @param {Object} obj - 要检测的目标对象若为非对象类型直接返回false
* @param {Array<string>} keys - 要检测的属性名数组(若为非数组/空数组直接返回false
* @returns {boolean} 满足条件返回true否则返回false
*/
function isObjHasPropertyAndNotNull(obj, keys) {
console.log(obj)
// 1. 边界校验obj必须是有效对象keys必须是非空数组
if (
!obj || // 排除null/undefined
typeof obj !== 'object' || // 排除字符串/数字/布尔等非对象类型
!Array.isArray(keys) || // 确保keys是数组
keys.length === 0 // 空数组直接返回false
) {
return false;
}
// 2. 遍历所有要检测的属性
for (const key of keys) {
console.log(obj[key])
// 检查属性是否是对象自身的(排除原型链上的属性) + 属性值不等于0
if (obj.hasOwnProperty(key) && obj[key] !== 0) {
return true; // 只要有一个满足立即返回true
}
}
// 3. 所有属性都不满足条件
return false;
}
const showDiscount = computed(() => {
const keys = ['productCouponDiscountAmount', 'otherCouponDiscountAmount',
'pointsDiscountAmount', 'discountActAmount', 'newCustomerDiscountAmount'
]
if (isObjHasPropertyAndNotNull(props.listinfo, keys)) {
return true
}
return false
})
const is_type = ref(0)
// 监听送餐/打包切换
const tabClick = (item, index) => {
@@ -477,14 +557,12 @@
<style lang="scss" scoped>
.card_box {
background-color: #fff;
// box-shadow: 0rpx 8rpx 12rpx 2rpx rgba(87,86,86,0.35);
position: relative;
width: 100%;
height: 100%;
// box-shadow: 0rpx 4rpx 12rpx 2rpx rgba(87,86,86,0.35);
border-radius: 18rpx;
padding-bottom: 32rpx;
.tabBox {
width: 100%;
margin-top: 52rpx;
@@ -1050,7 +1128,31 @@
}
}
.disocunt{
background: #FFFFFF;
border-radius: 18rpx 18rpx 18rpx 18rpx;overflow: hidden;
margin-top: 32rpx;
.row{
padding: 16rpx 24rpx;
display: flex;
justify-content: space-between;
.t {
font-weight: bold;
font-size: 28rpx;
color: #333333;
flex-shrink: 0;
}
.info {
font-weight: 400;
font-size: 28rpx;
color: #666666;
}
}
.price {
color: #FF1C1C;
}
}
.orderInfo {
background: #FFFFFF;
border-radius: 18rpx 18rpx 18rpx 18rpx;
@@ -1129,4 +1231,6 @@
}
}
}
</style>

View File

@@ -5,9 +5,7 @@
<view class="left">
<view class="icon">优惠</view>
<view class="text">
充值消费{{ freeDineConfig.rechargeTimes }}订单满{{
freeDineConfig.rechargeThreshold
}}元可用本单立享免单</view
充值消费{{ freeDineConfig.rechargeTimes }}本单立享免单</view
>
</view>
<view @click.stop="()=>{}">
@@ -92,12 +90,11 @@ const changeFree = (e) => {
font-weight: 500;
font-size: 20rpx;
color: #ffffff;
margin-right: 12rpx;
margin-right: 18rpx;
}
.text {
width: 80%;
font-weight: 500;
font-weight: 700;
font-size: 28rpx;
color: #333333;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -217,7 +217,6 @@
listinfo.discountInfo = tempArray;
}
// 回填先质控
listinfo.pointsDiscountAmount = 0
// console.log(listinfo)
console.log("orderorderInfo list info: ", listinfo);
@@ -686,7 +685,6 @@
position: relative;
width: 100%;
height: 100%;
box-shadow: 0rpx 4rpx 12rpx 2rpx rgba(87, 86, 86, 0.35);
border-radius: 18rpx;
.card_head_box {

View File

@@ -73,16 +73,23 @@
<view class="shop-amount">
<text
class="orderAmount">{{item.status == 'unpaid'?item.originAmount:item.orderAmount}}</text>
<text class="totalNumber">{{item.goods.length}}</text>
<text class="totalNumber">{{totalGoodsNum(item.goods) }}</text>
</view>
</view>
</view>
<!-- <view class="footer-wrap">
<view class="take_food_number u-m-b-16" v-if="item.takeCode">
<text class="u-font-24 color-333"> 取餐号</text>
<text class="u-font-32 font-700 color-333">{{item.takeCode}}</text>
</view>
<view class="footer-wrap">
<view class="btn" @click.stop="$u.debounce(isRemoveOrder(item,index),1000)"
v-if="item.status != 'unpaid' && item.status != 'paying'"> 删除订单 </view>
v-if="item.status == 'done' || item.status == 'cancelled'"> 删除订单 </view>
<view class="btn s" @click.stop="$u.debounce(showpopupclick(item),1000)"
v-if="item.status == 'unpaid' || item.status == 'paying'"> 去付款 </view>
</view> -->
<view class="btn s" @click.stop="agignOrder(item)" v-if="item.status == 'done'"> 再来一单 </view>
</view>
</view>
</view>
<view class="flex-colum" v-if="orderForm.list.length <= 0">
@@ -116,13 +123,59 @@
} from '@dcloudio/uni-app'
import Nav from '@/components/CustomNavbar.vue'; //导航栏
import {
APIuserorder
APIuserorder,
APIputuserorder
} from '@/common/api/order/index.js'
// pinia管理
import {
useNavbarStore
} from '@/stores/navbarStore';
import {APIshopUserInfo} from '@/common/api/member.js'
const store = useNavbarStore();
async function agignOrder(item){
await APIshopUserInfo({
shopId:item.shopId
}).then(shopUserInfo=>{
if(shopUserInfo){
uni.cache.set("dinersNum", 1);
uni.cache.set("tableCode", shopUserInfo.id);
uni.cache.set("shopId", item.shopId);
uni.navigateTo({
url: "/pages/product/index?type=beforehand&order_id="+item.id+'&one_more_order=1',
});
}
})
}
function totalGoodsNum(arr){
if(!arr){
return 0
}
return arr.reduce((prve,cur)=>{
return prve+cur.num
},0)
}
function isRemoveOrder(item) {
uni.showModal({
title: '提示',
content: '订单一旦删除不可恢复,确认删除该订单吗?',
showCancel: true,
success(res) {
if (res.confirm) {
APIputuserorder(item.id).then(res => {
uni.showToast({
title: '删除成功',
icon: 'none'
})
setTimeout(() => {
init_fn()
}, 1000)
})
}
}
})
}
// 导航栏
const tabs = [{
@@ -218,15 +271,15 @@
}
const orderinfo = (e) => {
if(e.status=='unpaid'){
uni.cache.set('shopId',e.shopId)
if (e.status == 'unpaid') {
uni.cache.set('shopId', e.shopId)
uni.pro.navigateTo('order/confirm-order', {
orderId: e.id,
shopId: e.shopId,
})
return
return
}
uni.pro.navigateTo('order/detail', {
orderId: e.id,
shopId: e.shopId
@@ -340,7 +393,7 @@
}
.header-wrap {
padding: 16rpx 18rpx;
padding: 32rpx 24rpx;
display: flex;
justify-content: space-between;
align-items: center;
@@ -378,7 +431,7 @@
}
.content {
padding: 0 18rpx 18rpx 18rpx;
padding: 0 24rpx 16rpx 30rpx;
.shop-info {
display: flex;
@@ -450,11 +503,9 @@
padding: 0 18rpx 32rpx 18rpx;
.btn {
width: 128rpx;
height: 48rpx;
line-height: 43rpx;
text-align: center;
background: #FFFFFF;
padding: 6rpx 14rpx;
border-radius: 10rpx 10rpx 10rpx 10rpx;
border: 2rpx solid #EDEDED;
font-weight: 400;
@@ -527,4 +578,10 @@
.ml-20 {
margin-left: 20rpx;
}
.take_food_number{
padding: 20rpx;
background-color: #F8F8F8;
margin-left: 36rpx;
margin-right: 24rpx;
}
</style>