代码更新

This commit is contained in:
GaoHao
2025-03-04 18:30:16 +08:00
parent fd0c452a76
commit 4f65b08c06
32 changed files with 622 additions and 1616 deletions

View File

@@ -17,7 +17,7 @@
<view class="line"></view>
<view class=" color-main">
<text>
{{sendTypeFilter(data.sendType)}}
{{sendTypeFilter(data.dineMode)}}
</text>
</view>
</view>
@@ -35,30 +35,23 @@
<view>
<view class=""> {{item.productName}}</view>
<view class="color-999 u-font-24 u-m-t-8">
{{item.productSkuName}}
{{item.skuName}}
</view>
</view>
<view class="u-flex u-flex-1 u-row-right">
<view>×{{item.num}}</view>
<template v-if="item.gift||item.userCouponId">
<template v-if="item.userCouponId">
<view class="u-text-right u-relative" :style="computedPriceStyle()">
<text class="line-th">{{goodsPriceAmount(item)}}</text>
<text class="line-th">{{item.payAmount}}</text>
<view class="u-absolute" style="bottom: 100%;right: 0;">
0
</view>
</view>
</template>
<template v-else-if="item.isMember&&data.userId&&item.memberPrice&&item.memberPrice!=item.price">
<view class="u-text-right u-relative" :style="computedPriceStyle()">
<text class="line-th">{{goodsPriceAmount(item)}}</text>
<view class="u-absolute" style="bottom: 100%;right: 0;">
{{goodsVipPriceAmount(item)}}
</view>
</view>
</template>
<template v-else>
<view class="u-text-right u-relative" :style="computedPriceStyle()">
<text>{{goodsPriceAmount(item)}}</text>
<text>{{item.payAmount}}</text>
</view>
</template>
</view>
@@ -119,17 +112,7 @@
import dayjs from 'dayjs';
import orderEnum from '@/commons/orderEnum.js'
import go from '@/commons/utils/go.js'
import {
isTui,
canTuiKuan,
canTuicai
} from '@/commons/utils/goodsUtil.js'
import {
computed,
reactive,
ref,
watch
} from 'vue';
import { computed, reactive, ref, watch } from 'vue';
const emits = defineEmits(['printOrder'])
const props = defineProps({
data: {
@@ -156,31 +139,24 @@
const priceSize = 9
let minWidth=ref(36)
/**
* 计算菜品价格
* @param {Object} item
*/
function goodsPriceAmount(item) {
const total=(item.price * item.num).toFixed(2)
const total=(item.payAmount * item.num).toFixed(2)
const minW=total.length * priceSize + 15
minWidth.value=minW<minWidth.value?minWidth.value:minW
return total
}
function goodsVipPriceAmount(item) {
const price = item.memberPrice ? item.memberPrice : item.price
return (price * item.num).toFixed(2)
}
// const packeFee=computed(()=>{
// return props.data.goods.reduce((prve,cur)=>{
// return prve+cur.packAmount
// },0).toFixed(2)
// })
function computedPriceStyle() {
return {
'min-width':minWidth.value + 'px'
}
}
// const computedPriceStyle = computed(() => {
// })
function goodsMapInit() {
for (let i in props.data.goods) {
const goods = props.data.goods[i]
@@ -211,9 +187,8 @@
}
function sendTypeFilter(t) {
console.log(t);
if (t) {
const item = orderEnum.sendType.find(item => item.key == t)
const item = orderEnum.dineMode.find(item => item.key == t)
return item ? item.label : '';
} else {
return t;