对接购物车

This commit is contained in:
gyq
2025-02-26 18:06:37 +08:00
parent 44144c5ac7
commit d3ed4ec8e6
27 changed files with 2589 additions and 1629 deletions

View File

@@ -26,26 +26,72 @@
</div>
</div>
<div class="list_wrap card" style="margin-top: var(--el-font-size-base)">
<div class="item" v-for="item in cartList" :key="item.id">
<div class="item" v-for="item in goodsStore.cartList" :key="item.id">
<div class="top">
<span class="name">{{ item.name }}</span>
<span class="n">x{{ item.number }}</span>
<span class="p">{{ item.salePrice }}</span>
<div class="name">
<span v-if="item.is_temporary" style="color: #999;"> [临时菜]</span>
{{ item.product_name }}
</div>
<div class="n">x{{ formatDecimal(+item.number, 2, true) }}</div>
<div class="p">
<template v-if="item.is_temporary">
<template v-if="item.is_gift">
<span class="t_line">{{ formatDecimal(+item.discount_sale_amount) }}</span>
0.00
</template>
<template v-else>
<span>{{ formatDecimal(item.discount_sale_amount * item.number) }}</span>
</template>
</template>
<template v-else>
<template v-if="item.is_gift">
<span class="t_line">{{ formatDecimal(+item.lowPrice) }}</span>
0.00
</template>
<template v-else>
<template v-if="+item.discount_sale_amount">
<span class="t_line">
{{ formatDecimal(+item.lowPrice) }}
</span>
<span>
{{ formatDecimal(+item.discount_sale_amount) }}
</span>
</template>
<template v-else>
{{ formatDecimal(+item.lowPrice) }}
</template>
</template>
</template>
</div>
</div>
<div class="gift_wrap" v-if="item.isGift == 'true'">
<span>[赠送]</span>
<span>-{{ item.salePrice }}</span>
</div>
<div class="tag_wrap" v-if="item.skuName">
<div class="tag" v-for="item in item.skuName.split(',')">
<div class="tag_wrap" v-if="item.sku_name">
<div class="tag" v-for="item in item.sku_name.split(',')">
{{ item }}
</div>
</div>
<div class="packge_Wrap" v-if="item.isPack == 'true'">
<div class="icon_item" v-if="item.isPack == 'true'" @click="giftPackHandle('isPack', item)">
<el-icon class="icon" style="color: var(--primary-color)">
<Box />
</el-icon>
<div class="gift_wrap" v-if="item.is_gift">
<div class="name">
<span v-if="item.is_gift">[赠送]</span>
</div>
<div class="n"></div>
<div class="p">
<span>
-<template v-if="item.is_temporary || +item.discount_sale_amount">
{{ formatDecimal(+item.discount_sale_amount) }}
</template>
<template v-else>{{ formatDecimal(+item.lowPrice) }}</template>
</span>
</div>
</div>
<div class="gift_wrap" v-if="!item.is_temporary && !item.is_gift && item.discount_sale_amount">
<div class="name">
<span>[改价优惠]</span>
</div>
<div class="n"></div>
<div class="p">
<span>
-{{ formatDecimal(item.lowPrice - item.discount_sale_amount) }}
</span>
</div>
</div>
</div>
@@ -64,8 +110,8 @@
</div>
</div>
<div class="pay_wrap">
<payCard :amount="props.amount" :discount="propsDiscount" :orderId="props.orderInfo.id" @paySuccess="paySuccess"
@cancelDiscount="propsDiscount = 0" />
<payCard :amount="goodsStore.orderInfo.originAmount" :discount="propsDiscount" :orderId="props.orderInfo.id"
@paySuccess="paySuccess" @cancelDiscount="propsDiscount = 0" />
</div>
</div>
<el-dialog v-model="showStaffDiscount" title="员工折扣" @close="global.updateData(true)">
@@ -105,9 +151,12 @@ import { formatDecimal } from '@/utils/index.js'
import receiptPrint from "@/components/lodop/receiptPrint.js";
import { useGlobal } from '@/store/global.js'
import { usePrint } from '@/store/print.js'
import { useGoods } from '@/store/goods.js'
import { staffPermission } from '@/api/user.js'
const goodsStore = useGoods()
const global = useGlobal()
const printStore = usePrint()
@@ -424,30 +473,42 @@ defineExpose({
padding: var(--el-font-size-base) 0;
border-bottom: 1px solid #ececec;
.name {
flex: 1.5;
}
.n {
width: 30px;
color: #555;
}
.p {
flex: 1;
color: #555;
display: flex;
justify-content: flex-end;
}
.t_line {
text-decoration: line-through;
color: #999;
margin-right: 4px;
}
.top {
display: flex;
padding-bottom: 6px;
.name {
flex: 1;
}
.n {
width: 50px;
color: #555;
}
.p {
width: 50px;
color: #555;
}
}
.gift_wrap {
display: flex;
justify-content: space-between;
color: #999;
font-size: 16px;
.p {
color: var(--el-color-danger);
}
}
.tag_wrap {