优化商品编辑
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
<template #default>
|
||||
<div class="prinr_wrap" v-loading="loading">
|
||||
<div class="header center">{{ userStore.shopInfo.shopName }}</div>
|
||||
<div class="row center">结算单:【{{ orderInfo.tableCode }}】</div>
|
||||
<div class="row center">结算单</div>
|
||||
<div class="row center">桌号:{{ orderInfo.tableName }}</div>
|
||||
<div class="row" style="margin-top: 20px">
|
||||
订单号:{{ orderInfo.orderNo }}
|
||||
@@ -99,6 +99,8 @@ import {
|
||||
getOrderByIdAjax,
|
||||
commOrderPrintData,
|
||||
} from "@/utils/index.js";
|
||||
import { orderPrint } from "@/api/order.js";
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
const userStore = useUser();
|
||||
const printStore = usePrint();
|
||||
@@ -109,23 +111,35 @@ const loading = ref(false);
|
||||
const printLoading = ref(false);
|
||||
|
||||
// 打印操作
|
||||
function printHandle(type) {
|
||||
printLoading.value = true;
|
||||
switch (type) {
|
||||
case "normal":
|
||||
// 打印订单小票
|
||||
printStore.pushReceiptData(commOrderPrintData(orderInfo.value));
|
||||
break;
|
||||
case "label":
|
||||
// 打印标签小票
|
||||
printStore.labelPrint(commOrderPrintData(orderInfo.value));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
async function printHandle(type) {
|
||||
try {
|
||||
printLoading.value = true;
|
||||
switch (type) {
|
||||
case "normal":
|
||||
// 打印订单小票
|
||||
if (printStore.deviceNoteList.length) {
|
||||
printStore.pushReceiptData(commOrderPrintData(orderInfo.value));
|
||||
} else {
|
||||
await orderPrint({
|
||||
id: orderInfo.value.id,
|
||||
type: 0 // 0结算单 1预结算单 2退款单
|
||||
})
|
||||
ElMessage.success('云打印小票成功')
|
||||
}
|
||||
break;
|
||||
case "label":
|
||||
// 打印标签小票
|
||||
printStore.labelPrint(commOrderPrintData(orderInfo.value));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
setTimeout(() => {
|
||||
printLoading.value = false;
|
||||
}, 1500);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
setTimeout(() => {
|
||||
printLoading.value = false;
|
||||
}, 1500);
|
||||
}
|
||||
|
||||
async function show(row) {
|
||||
|
||||
@@ -109,10 +109,11 @@
|
||||
<template #footer>
|
||||
<div class="drawer_footer">
|
||||
<div class="btn">
|
||||
<el-button style="width: 100%;" @click="handleRefund">手动退款</el-button>
|
||||
<el-button style="width: 100%;" :loading="loading" @click="handleRefund">手动退款</el-button>
|
||||
</div>
|
||||
<div class="btn">
|
||||
<el-button type="primary" style="width: 100%;" @click="refundHandle()">原路退回</el-button>
|
||||
<el-button type="primary" style="width: 100%;" :loading="loading"
|
||||
@click="refundHandle()">原路退回</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -120,14 +121,19 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { ref } from 'vue'
|
||||
import { useGlobal } from '@/store/global.js'
|
||||
import { formatDecimal, inputFilterFloat } from "@/utils/index.js";
|
||||
import { refundOrder } from '@/api/order.js'
|
||||
import { ElNotification, ElMessageBox } from 'element-plus'
|
||||
import { refundOrder, orderPrint } from '@/api/order.js'
|
||||
import { ElNotification, ElMessageBox, ElMessage } from 'element-plus'
|
||||
import { usePrint } from "@/store/print.js";
|
||||
import { useUser } from '@/store/user.js'
|
||||
import dayjs from 'dayjs'
|
||||
|
||||
const emits = defineEmits(['success'])
|
||||
|
||||
const store = useUser()
|
||||
const printStore = usePrint();
|
||||
const globalStore = useGlobal()
|
||||
const isShow = ref(false)
|
||||
const item = ref({})
|
||||
@@ -144,6 +150,7 @@ const remarkTagList = ref([
|
||||
'商品不满意',
|
||||
'服务态度不满意'
|
||||
])
|
||||
const loading = ref(false)
|
||||
|
||||
// 显示手动退款
|
||||
function handleRefund() {
|
||||
@@ -208,6 +215,15 @@ async function refundHandle(cash = false) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (refundAmount <= 0) {
|
||||
ElNotification({
|
||||
title: '错误',
|
||||
message: '无可退金额',
|
||||
type: 'error',
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
let data = {
|
||||
orderId: item.value.id,
|
||||
refundAmount: refundAmount,
|
||||
@@ -217,19 +233,64 @@ async function refundHandle(cash = false) {
|
||||
refundDetails: refundDetails
|
||||
};
|
||||
|
||||
// console.log(data);
|
||||
// return
|
||||
loading.value = true
|
||||
await refundOrder(data)
|
||||
ElNotification({
|
||||
title: '提示',
|
||||
message: '退款成功',
|
||||
type: 'success',
|
||||
})
|
||||
await printRefund(rows)
|
||||
isShow.value = false
|
||||
emits('success')
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
loading.value = false
|
||||
}
|
||||
|
||||
// 打印退款小票
|
||||
async function printRefund(rows) {
|
||||
try {
|
||||
if (printStore.deviceNoteList.length) {
|
||||
// 本地打印
|
||||
const data = {
|
||||
shop_name: store.shopInfo.shopName,
|
||||
loginAccount: store.userInfo.name,
|
||||
carts: [],
|
||||
amount: item.value.orderAmount,
|
||||
remark: item.value.remark,
|
||||
orderInfo: item.value,
|
||||
outNumber: item.value.id,
|
||||
createdAt: item.value.createTime,
|
||||
printTime: dayjs().format("YYYY-MM-DD HH:mm:ss"),
|
||||
}
|
||||
|
||||
rows.map(item => {
|
||||
data.carts.push(
|
||||
{
|
||||
name: item.productName,
|
||||
number: item.num,
|
||||
skuName: item.skuName,
|
||||
salePrice: formatDecimal(item.payAmount / item.num),
|
||||
totalAmount: formatDecimal(item.payAmount)
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
printStore.printRefund(data);
|
||||
} else {
|
||||
// 云打印
|
||||
await orderPrint({ id: item.value.id, type: 2 })
|
||||
ElNotification({
|
||||
title: '提示',
|
||||
message: '云打印退款单成功',
|
||||
type: 'success',
|
||||
})
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
|
||||
// 数量变化
|
||||
|
||||
@@ -23,6 +23,16 @@
|
||||
<span v-else>无</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品信息" width="150">
|
||||
<template v-slot="scope">
|
||||
{{ goodsNameFilter(scope.row.goods) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" width="100">
|
||||
<template v-slot="scope">
|
||||
{{ filterLable("orderStatus", scope.row.status) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="订单信息" width="340">
|
||||
<template v-slot="scope">
|
||||
<div class="column">
|
||||
@@ -49,7 +59,7 @@
|
||||
<div class="row">
|
||||
支付类型:{{ filterLable("payType", scope.row.payType) }}
|
||||
</div>
|
||||
<div class="row">支付单号:{{ scope.row.payOrderNo }}</div>
|
||||
<!-- <div class="row">支付单号:{{ scope.row.payOrderNo }}</div> -->
|
||||
<div class="row">支付金额:¥{{ scope.row.payAmount }}</div>
|
||||
<div class="row">支付时间:{{ scope.row.paidTime }}</div>
|
||||
<div class="row">
|
||||
@@ -61,16 +71,6 @@
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品信息" width="150">
|
||||
<template v-slot="scope">
|
||||
{{ goodsNameFilter(scope.row.goods) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" width="100">
|
||||
<template v-slot="scope">
|
||||
{{ filterLable("orderStatus", scope.row.status) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="150" align="center" fixed="right">
|
||||
<template v-slot="scope">
|
||||
<div class="column">
|
||||
|
||||
Reference in New Issue
Block a user