对接订单打印小票

This commit is contained in:
gyq
2025-03-05 09:35:34 +08:00
parent 573dd88b24
commit db3fc1f6dc
22 changed files with 838 additions and 206 deletions

View File

@@ -31,7 +31,7 @@
<el-text class="t">规格</el-text>
</div>
<div class="item"
:class="{ disabled: goodsStore.cartList.length && goodsStore.cartList[goodsStore.cartActiveIndex].is_temporary }"
:class="{ disabled: goodsStore.cartList.length && goodsStore.cartList[goodsStore.cartActiveIndex].is_temporary || goodsStore.cartList.length && goodsStore.cartList[goodsStore.cartActiveIndex].is_gift }"
@click="showDiscountModalHandle">
<el-icon class="icon">
<PriceTag />
@@ -96,13 +96,12 @@
<el-form ref="discountFormRef" :model="discountForm" :rules="discountFormRules" label-width="100px"
label-position="left">
<el-form-item label="价格更改" prop="discount_sale_amount">
<el-input v-model="discountForm.discount_sale_amount" placeholder="减8.88元请输入8.88"
@input="priceInput">
<el-input v-model="discountForm.discount_sale_amount" placeholder="请输入改价金额" @input="priceInput">
<template #append></template>
</el-input>
</el-form-item>
<el-form-item label="更改原因">
<el-input v-model="discountForm.note" type="textarea" placeholder="请输入自定义备注" />
<el-input v-model="discountForm.note" type="textarea" placeholder="请输入更改原因" />
<div class="remark_list">
<div class="item" v-for="item in noteList" :key="item" @click="addNote(item)">
{{ item }}
@@ -267,7 +266,7 @@ function skuConfirm(e) {
}
}
/**单品打折 start */
/**单品改价 start */
const showDiscountModal = ref(false)
const resetDiscountForm = ref({})
const discountFormRef = ref(null)
@@ -278,10 +277,17 @@ const discountForm = ref({
})
function validateAmount(rule, value, callback) {
let item = goodsStore.cartList[goodsStore.cartActiveIndex]
let lowPrice = 0
if (goodsStore.showVipPrice) {
lowPrice = +item.memberPrice
} else {
lowPrice = +item.discount_sale_amount || +item.lowPrice
}
if (value == '') {
callback(new Error('请输入折扣价格'))
} else if (value <= 0) {
callback(new Error('输入价格有误'))
} else if (value <= 0 || value >= lowPrice) {
callback(new Error(`输入大于0小于${lowPrice}的数字`))
} else {
callback()
}
@@ -304,10 +310,10 @@ const noteList = ref([
// 显示
function showDiscountModalHandle() {
if (goodsStore.cartList[goodsStore.cartActiveIndex].id && !goodsStore.cartList[goodsStore.cartActiveIndex].is_temporary) {
// 存在商品并且不能为临时菜
showDiscountModal.value = true
}
let item = goodsStore.cartList[goodsStore.cartActiveIndex]
if ((item && !item.id) || item.is_temporary || item.is_gift) return
// 存在商品并且不能为临时菜
showDiscountModal.value = true
}
// 过滤价格输入
@@ -341,7 +347,7 @@ function discountFormSubmit() {
goodsStore.operateCart({
...goodsStore.cartList[goodsStore.cartActiveIndex],
discount_sale_amount: goodsStore.cartList[goodsStore.cartActiveIndex].lowPrice - discountForm.value.discount_sale_amount,
discount_sale_amount: discountForm.value.discount_sale_amount,
discount_sale_note: discountForm.value.note
}, 'edit')