1.新增套餐商品
This commit is contained in:
@@ -51,7 +51,11 @@
|
||||
@click="selectCartItemHandle(item, index, i)">
|
||||
<div class="name_wrap">
|
||||
<span>{{ item.name }}</span>
|
||||
<span>¥{{ item.salePrice }}</span>
|
||||
<div class="price">
|
||||
<span :class="{ dis: item.discountSaleAmount }">¥{{ item.salePrice }}</span>
|
||||
<span v-if="item.discountSaleAmount">
|
||||
¥{{ formatDecimal(item.salePrice - item.discountSaleAmount, 2, true) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sku_list" v-if="item.skuName">
|
||||
<div class="tag" v-for="item in item.skuName.split(',')">
|
||||
@@ -60,21 +64,26 @@
|
||||
</div>
|
||||
<div class="num">
|
||||
<div class="left">
|
||||
<div class="icon_item" v-if="item.isGift == 'true'" @click="giftPackHandle('isGift', item)">
|
||||
<el-icon class="icon">
|
||||
<ShoppingBag />
|
||||
</el-icon>
|
||||
<div class="icon_item zen" v-if="item.isGift == 'true'" @click="giftPackHandle('isGift', item)">
|
||||
<span class="t">赠</span>
|
||||
</div>
|
||||
<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="icon_item bao" v-if="item.isPack == 'true'" @click="giftPackHandle('isPack', item)">
|
||||
<span class="t">包</span>
|
||||
</div>
|
||||
<div class="icon_item" v-if="item.status == 'return'">
|
||||
<span class="t">已退</span>
|
||||
<div class="icon_item tui" v-if="item.status == 'return'">
|
||||
<span class="t">退</span>
|
||||
</div>
|
||||
<div class="icon_item lin" v-if="item.isTemporary == 1">
|
||||
<span class="t">临</span>
|
||||
</div>
|
||||
<div class="icon_item zhe" v-if="item.discountSaleAmount">
|
||||
<span class="t">折</span>
|
||||
</div>
|
||||
<div class="icon_item chu" v-if="item.isPrint == 0">
|
||||
<span class="t">免厨打印</span>
|
||||
</div>
|
||||
</div>
|
||||
<el-text class="t">X{{ item.number }}</el-text>
|
||||
<el-text class="t">X{{ formatDecimal(item.number, 2, true) }}</el-text>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -402,27 +411,43 @@ function selectCartItemHandle(row, index, i) {
|
||||
}
|
||||
|
||||
// 选择完规格开始添加购物车
|
||||
async function addCart(params, type = "add") {
|
||||
async function addCart(params = {}, type = "add") {
|
||||
console.log(params);
|
||||
|
||||
try {
|
||||
cartLoading.value = true;
|
||||
const res = await createCart({
|
||||
productId: params.productId,
|
||||
masterId: masterId.value,
|
||||
tableId: global.tableInfo.qrcode || '',
|
||||
vipUserId: global.orderMemberInfo.id || '',
|
||||
shopId: store.userInfo.shopId,
|
||||
skuId: type == "add" ? params.id : params.skuId,
|
||||
number: params.number || 1,
|
||||
isPack: params.isPack || "false",
|
||||
isGift: params.isGift || "false",
|
||||
cartId: type == "add" ? "" : params.id,
|
||||
uuid: params.uuid || store.userInfo.uuid,
|
||||
type: type,
|
||||
});
|
||||
cartLoading.value = false;
|
||||
masterId.value = res;
|
||||
goodsRef.value.updateData();
|
||||
queryCartAjax();
|
||||
if (params.isTemporary) {
|
||||
await createCodeAjax()
|
||||
cartLoading.value = false;
|
||||
} else {
|
||||
let skuId = ''
|
||||
if (params.skuList && params.skuList.length) {
|
||||
skuId = params.skuList[0].id
|
||||
} else {
|
||||
skuId = type == "add" ? params.id : params.skuId
|
||||
}
|
||||
|
||||
const res = await createCart({
|
||||
productId: params.productId,
|
||||
masterId: masterId.value,
|
||||
tableId: global.tableInfo.qrcode || '',
|
||||
vipUserId: global.orderMemberInfo.id || '',
|
||||
shopId: store.userInfo.shopId,
|
||||
// skuId: type == "add" ? params.id : params.skuId,
|
||||
skuId: skuId,
|
||||
number: params.number || 1,
|
||||
isPack: params.isPack || "false",
|
||||
isGift: params.isGift || "false",
|
||||
cartId: type == "add" ? "" : params.id,
|
||||
uuid: params.uuid || store.userInfo.uuid,
|
||||
type: type,
|
||||
groupProductIdList: params.groupProductIdList || []
|
||||
});
|
||||
cartLoading.value = false;
|
||||
masterId.value = res;
|
||||
goodsRef.value.updateData();
|
||||
queryCartAjax();
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
cartLoading.value = false;
|
||||
@@ -498,7 +523,6 @@ async function addTableNum() {
|
||||
|
||||
// 获取取餐码
|
||||
async function createCodeAjax(type = "0") {
|
||||
console.log(1111)
|
||||
try {
|
||||
// if (!process.env.VITE_DEV_SERVER_URL) {
|
||||
// masterId.value = '#20'
|
||||
@@ -661,6 +685,13 @@ onMounted(() => {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: var(--el-font-size-base);
|
||||
|
||||
.dis {
|
||||
color: #999;
|
||||
font-size: 12px;
|
||||
text-decoration: line-through;
|
||||
margin-right: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.sku_list {
|
||||
@@ -686,21 +717,51 @@ onMounted(() => {
|
||||
.left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
padding-right: 10px;
|
||||
|
||||
.icon_item {
|
||||
$size: 30px;
|
||||
width: $size;
|
||||
$size: 20px;
|
||||
height: $size;
|
||||
border-radius: 4px;
|
||||
padding: 0 6px;
|
||||
border-radius: 2px;
|
||||
background-color: #e2e2e2;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-right: 10px;
|
||||
color: #fff;
|
||||
font-size: 10px;
|
||||
|
||||
.t {
|
||||
font-size: 10px;
|
||||
color: #888;
|
||||
&.zen {
|
||||
background-color: #FFB0B1;
|
||||
color: #FF4D4F;
|
||||
}
|
||||
|
||||
&.bao {
|
||||
background-color: #52C41A;
|
||||
}
|
||||
|
||||
&.tui {
|
||||
background-color: var(--el-color-danger);
|
||||
}
|
||||
|
||||
&.lin {
|
||||
background-color: var(--el-color-warning);
|
||||
}
|
||||
|
||||
&.zhe {
|
||||
background-color: var(--primary-color);
|
||||
}
|
||||
|
||||
&.chu {
|
||||
background-color: #ffe7ba;
|
||||
color: #e69f1c;
|
||||
}
|
||||
|
||||
span {
|
||||
font-size: inherit;
|
||||
color: inherit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user