代客下单问题修复,积分上传问题修复
This commit is contained in:
@@ -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
@@ -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>
|
||||
@@ -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
@@ -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 {
|
||||
|
||||
@@ -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>
|
||||
43
pages/product/components/utils.js
Normal file
43
pages/product/components/utils.js
Normal file
@@ -0,0 +1,43 @@
|
||||
// 套餐比较两个对象是否相等
|
||||
export function isObjectEqual(obj1, obj2) {
|
||||
if (typeof obj1 !== 'object' || obj1 === null || typeof obj2 !== 'object' || obj2 === null) {
|
||||
return obj1 === obj2;
|
||||
}
|
||||
const keys1 = Object.keys(obj1);
|
||||
const keys2 = Object.keys(obj2);
|
||||
if (keys1.length !== keys2.length) {
|
||||
return false;
|
||||
}
|
||||
for (const key of keys1) {
|
||||
if (Array.isArray(obj1[key]) && Array.isArray(obj2[key])) {
|
||||
if (!isArrayEqual(obj1[key], obj2[key])) {
|
||||
return false;
|
||||
}
|
||||
} else if (!isObjectEqual(obj1[key], obj2[key])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// 比较两个数组是否相等(忽略顺序)
|
||||
export function isArrayEqual(arr1, arr2) {
|
||||
if (arr1.length !== arr2.length) {
|
||||
return false;
|
||||
}
|
||||
const usedIndices = new Array(arr2.length).fill(false);
|
||||
for (const item1 of arr1) {
|
||||
let found = false;
|
||||
for (let i = 0; i < arr2.length; i++) {
|
||||
if (!usedIndices[i] && isObjectEqual(item1, arr2[i])) {
|
||||
usedIndices[i] = true;
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,7 @@
|
||||
<!-- 账单明细 -->
|
||||
<view style="padding-bottom: 40rpx;">
|
||||
<up-navbar bgColor="transparent" title="明细" @leftClick="back"></up-navbar>
|
||||
<view class="bild" >
|
||||
<view class="bild">
|
||||
<view class="bg">
|
||||
<image class="image" src="/static/czzx_header_bg.png" mode=""></image>
|
||||
</view>
|
||||
@@ -12,7 +12,7 @@
|
||||
</view>
|
||||
<view class="bildRight">
|
||||
<text>我的积分</text>
|
||||
<view>{{shopUserInfo.accountPoints||0}}</view>
|
||||
<view>{{shopUserInfo.pointsUser?shopUserInfo.pointsUser.pointBalance:0}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bottom">
|
||||
@@ -70,7 +70,7 @@
|
||||
<view v-else>
|
||||
{{item.content}}
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
<view class="listStyle_left">
|
||||
<view class="listrigth color-333 font-14">
|
||||
@@ -107,9 +107,10 @@
|
||||
reactive,
|
||||
onMounted
|
||||
} from 'vue'
|
||||
|
||||
|
||||
import {
|
||||
onReachBottom,onLoad
|
||||
onReachBottom,
|
||||
onLoad
|
||||
} from '@dcloudio/uni-app'
|
||||
|
||||
import {
|
||||
@@ -120,8 +121,8 @@
|
||||
APIusershopInfodetail,
|
||||
APIshopUserInfo
|
||||
} from '@/common/api/member.js'
|
||||
|
||||
function back(){
|
||||
|
||||
function back() {
|
||||
uni.navigateBack()
|
||||
}
|
||||
const formData = reactive({
|
||||
@@ -154,7 +155,7 @@
|
||||
size: formData.form.size,
|
||||
// status: formData.form.status,
|
||||
shopId: formData.shopId,
|
||||
id:formData.id
|
||||
id: formData.id
|
||||
})
|
||||
}
|
||||
if (res.totalPage == 0 || res.totalPage == 1 && res.totalRow <= 10) {
|
||||
@@ -200,28 +201,29 @@
|
||||
onReachBottom(() => {
|
||||
getlist()
|
||||
})
|
||||
|
||||
const shopUserInfo=reactive({})
|
||||
async function getShopUserInfo(){
|
||||
const res=await APIshopUserInfo({
|
||||
|
||||
const shopUserInfo = reactive({})
|
||||
async function getShopUserInfo() {
|
||||
const res = await APIshopUserInfo({
|
||||
shopId: options.shopId
|
||||
})
|
||||
if(res){
|
||||
Object.assign(shopUserInfo,res)
|
||||
if (res) {
|
||||
Object.assign(shopUserInfo, res)
|
||||
formData.id =res.pointsUser?res.pointsUser.id:''
|
||||
formData.shopId =res.pointsUser?res.pointsUser.shopId:''
|
||||
}
|
||||
}
|
||||
const options=reactive({})
|
||||
onLoad((opt)=>{
|
||||
Object.assign(options,opt)
|
||||
console.log('options',options);
|
||||
const options = reactive({})
|
||||
onLoad(async (opt) => {
|
||||
Object.assign(options, opt)
|
||||
console.log('options', options);
|
||||
formData.shopId = options.shopId
|
||||
formData.active = options.type
|
||||
formData.id=options.id||''
|
||||
formData.id = options.id || ''
|
||||
console.log(formData.info)
|
||||
await getShopUserInfo()
|
||||
getlist()
|
||||
getShopUserInfo()
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
@@ -231,19 +233,22 @@
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
position:relative;
|
||||
.bg{
|
||||
position:absolute;
|
||||
left:0;
|
||||
right:0;
|
||||
top:0;
|
||||
bottom:0;
|
||||
z-index:-1;
|
||||
.image{
|
||||
width:100%;
|
||||
height:100%;
|
||||
position: relative;
|
||||
|
||||
.bg {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
z-index: -1;
|
||||
|
||||
.image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.bildLeft,
|
||||
.bildRight {
|
||||
font-weight: 400;
|
||||
@@ -261,18 +266,20 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
.bottom{
|
||||
|
||||
.bottom {
|
||||
background-color: rgba(255, 255, 255, .3);
|
||||
padding: 40rpx 28rpx 0 28rpx;
|
||||
transform: translateY(-140rpx);
|
||||
border-radius: 74rpx 74rpx 0 0;
|
||||
}
|
||||
|
||||
.navTop {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
color: #333;
|
||||
|
||||
|
||||
font-size: 28rpx;
|
||||
|
||||
.fonts {
|
||||
|
||||
Reference in New Issue
Block a user