优化打印机配置

This commit is contained in:
gyq
2026-04-22 10:09:50 +08:00
parent e2338b3888
commit 6d09813aa4
16 changed files with 612 additions and 67 deletions

View File

@@ -10,6 +10,8 @@
<el-form-item>
<el-button type="primary" icon="Search" :loading="loading" @click="handleQuery">查询</el-button>
<el-button @click="handleReset" icon="Refresh" :loading="loading">重置</el-button>
<el-button icon="Printer" @click="printBusinessDialogRef.show()">经营日报</el-button>
<el-button icon="Printer" @click="printBusinessDialogRef2.show()">日结单</el-button>
</el-form-item>
</el-form>
<el-form inline>
@@ -359,6 +361,8 @@
</div>
</div>
</div>
<printBusinessDialog ref="printBusinessDialogRef" @success="printHandle" />
<printBusinessDialog ref="printBusinessDialogRef2" @success="printHandle2" />
</template>
<script setup>
@@ -366,6 +370,46 @@ import dayjs from "dayjs";
import { ref, onMounted } from "vue";
import OrderApi from "@/api/order/order";
import { downloadFile, multiplyAndFormat } from '@/utils'
import printBusinessDialog from "@/components/printBusinessDialog.vue";
const printBusinessDialogRef = ref(null)
// 打印经营日报回调
async function printHandle(res) {
try {
const shopStaff = JSON.parse(localStorage.getItem('shopStaff')) || { name: '' }
const shopName = localStorage.getItem('shopName')
await OrderApi.printDayReport({
beginDate: res.date[0],
endDate: res.date[1],
rangeType: 'CUSTOM',
shopId: localStorage.getItem('shopId') || '',
operator: shopStaff.name || shopName
})
ElMessage.success('打印成功')
} catch (error) {
console.log(error);
}
}
const printBusinessDialogRef2 = ref(null)
// 打印日结单回调
async function printHandle2(res) {
try {
const shopStaff = JSON.parse(localStorage.getItem('shopStaff')) || { name: '' }
const shopName = localStorage.getItem('shopName')
await OrderApi.printDaySettle({
beginDate: res.date[0],
endDate: res.date[1],
rangeType: 'CUSTOM',
shopId: localStorage.getItem('shopId') || '',
operator: shopStaff.name || shopName
})
ElMessage.success('打印成功')
} catch (error) {
console.log(error);
}
}
const queryForm = ref({
queryDate: dayjs().format('YYYY-MM-DD'), // 查询日期 yyyy-MM-dd