称重增加

This commit is contained in:
魏啾
2024-12-06 10:05:06 +08:00
parent 3a5460894b
commit 51f3953459
3 changed files with 362 additions and 35 deletions

View File

@@ -1,17 +1,20 @@
<template>
<view class="u-relative u-flex item">
<up-image :src="data.coverImg" mode="aspectFill" :width="img.width" :height="img.height"></up-image>
<up-image :src="data.coverImg" mode="aspectFill" :width="img.width" :height="img.height"></up-image>
<!-- <image lazy-load class="img" :src="data.coverImg" mode="aspectFill" :style="computedImgStyle()"></image> -->
<view class="info u-flex u-row-between u-col-top u-flex-col" >
<view class="info u-flex u-row-between u-col-top u-flex-col">
<view>
<view>
<text class="u-line-2">{{data.name}}
</text>
<text class="u-line-2">{{data.name}}
</text>
</view>
<view class="u-font-32 font-bold u-m-t-16">
{{data.price}}
</view>
<template v-if="data.type=='weigh'">
<view class="btnweigh">称重</view>
</template>
</view>
<view class="u-flex">
<template v-if="!isSellout">
@@ -20,7 +23,7 @@
</template>
<template v-else>
<view class="u-flex icon-btn">
<view class="u-flex" @tap.stop="emitEvent('add')">
<view class="u-flex" @tap.stop="emitEvent(data.type=='weigh'?'tapweigh':'add')">
<image src="/pagesCreateOrder/static/images/icon-add.svg" class="icon" mode=""></image>
</view>
<template v-if="data.chooseNumber">
@@ -56,20 +59,20 @@
} from 'vue';
import util from '../util.js';
const props = defineProps({
img:{
type:Object,
default:{
width:'250rpx',
height:'272rpx'
img: {
type: Object,
default: {
width: '250rpx',
height: '272rpx'
}
},
index: {
type: [Number,String],
type: [Number, String],
},
isSeatFee:{
isSeatFee: {
//是否为餐位费
type:Boolean,
default:false
type: Boolean,
default: false
},
data: {
type: Object,
@@ -80,36 +83,36 @@
}
}
})
function computedImgStyle(){
function computedImgStyle() {
return {
width:props.img.width,
height:props.img.height
width: props.img.width,
height: props.img.height
}
}
//判断是否是菜品
function isGoods(){
function isGoods() {
return props.data.hasOwnProperty('id')
}
//判断商品是否售尽
const isSellout = computed(() => {
const item = props.data
if(!isGoods()){
if (!isGoods()) {
return false
}
return (
item.isPauseSale ||
(item.typeEnum !== "sku" && item.isStock==1&& item.stockNumber <= 0)
(item.typeEnum !== "sku" && item.isStock == 1 && item.stockNumber <= 0)
);
})
const emits = defineEmits(['add', 'reduce', 'chooseGuige'])
function emitEvent(emitName){
if(isGoods()){
const emits = defineEmits(['add', 'reduce', 'chooseGuige','tapweigh'])
function emitEvent(emitName) {
if (isGoods()) {
emits(emitName, props.index)
}
}
@@ -134,10 +137,24 @@
color: #fff;
}
.btnweigh {
margin: 5rpx 0;
width: 100rpx;
background: linear-gradient(124deg, #73c969 6%, #27921b 93%);
border-radius: 10rpx;
font-size: 24rpx;
padding: 6rpx 0;
text-align: center;
}
.btn-hover-class {
opacity: .6;
}
image{will-change: transform}
image {
will-change: transform
}
.item {
// width: 250rpx;
// height: 272rpx;