新增订单开票

This commit is contained in:
gyq 2024-07-23 18:30:16 +08:00
parent d2183eec37
commit 9e57753323
7 changed files with 174 additions and 26 deletions

View File

@ -14,8 +14,11 @@ VITE_API_WSS = 'wss://cashier.sxczgkj.cn/client'
# 正式 php
VITE_API_PHP_URL = 'http://czgdoumei.sxczgkj.com/index.php/api'
# 测试 php 开票
# VITE_API_KP_URL = 'http://192.168.1.13:8888/api'
# 正式 php 开票
VITE_API_KP_URL = 'http://192.168.1.13:8888/api'
VITE_API_KP_URL = 'https://invoice.sxczgkj.cn/api'
# 阿伟
# VITE_API_URL = 'http://192.168.2.96:10587/cashier-client'

View File

@ -8,7 +8,7 @@ VITE_API_WSS = 'wss://cashier.sxczgkj.cn/client'
VITE_API_PHP_URL = 'http://czgdoumei.sxczgkj.com/index.php/api'
# 正式 php 开票
VITE_API_KP_URL = 'http://192.168.1.13:8888/api'
VITE_API_KP_URL = 'https://invoice.sxczgkj.cn/api'
# 线上环境接口地址
VITE_API_URL = 'https://cashierclient.sxczgkj.cn/cashier-client/'

View File

@ -2,19 +2,22 @@
ENV = test
#测试ws
VITE_API_WSS = 'wss://wxcashiertest.sxczgkj.cn/client'
# VITE_API_WSS = 'wss://wxcashiertest.sxczgkj.cn/client'
# 正式ws
# VITE_API_WSS = 'wss://cashier.sxczgkj.cn/client'
VITE_API_WSS = 'wss://cashier.sxczgkj.cn/client'
# 正式 php
VITE_API_PHP_URL = 'http://czgdoumei.sxczgkj.com/index.php/api'
# 测试 php 开票
# VITE_API_KP_URL = 'http://192.168.1.13:8888/api'
# 正式 php 开票
VITE_API_KP_URL = 'http://192.168.1.13:8888/api'
VITE_API_KP_URL = 'https://invoice.sxczgkj.cn/api'
# 测试
VITE_API_URL = 'https://cashier-client.sxczgkj.cn/cashier-client'
# VITE_API_URL = 'https://cashier-client.sxczgkj.cn/cashier-client'
# 正式
# VITE_API_URL = 'https://cashierclient.sxczgkj.cn/cashier-client'
VITE_API_URL = 'https://cashierclient.sxczgkj.cn/cashier-client'

View File

@ -8,7 +8,33 @@ import request_kp from "@/utils/request_kp.js";
export function issuedby(data) {
return request_kp({
method: "post",
url: "szzpy/issuedby",
url: "szzpy/syjissuedby",
data,
});
}
/**
* 商家通过收银机提交开票信息
* @param {*} data
* @returns
*/
export function carsubinvoicing(data) {
return request_kp({
method: "post",
url: "store/carsubinvoicing",
data,
});
}
/**
* 打印二维码
* @param {*} data
* @returns
*/
export function syjprintqrcode(data) {
return request_kp({
method: "post",
url: "store/syjprintqrcode",
data,
});
}

View File

@ -15,12 +15,12 @@ const service = axios.create({
// 请求拦截器
service.interceptors.request.use(
(config) => {
// // 在发送请求之前做些什么 token
// if (useStorage.get("douyin") && useStorage.get("douyin").token) {
// config.headers["bausertoken"] = useStorage.get("douyin").token;
// // config.headers['Content-Type'] = 'application/json'
// }
// 在发送请求之前做些什么 token
config.headers["pctoken"] = useStorage.get("token");
config.headers["ispc"] = 1;
config.headers["loginName"] = useStorage.get("userInfo").loginName;
config.headers["clientType"] = "pc";
config.headers["shopId"] = useStorage.get("userInfo").shopId;
return config;
},
(error) => {

View File

@ -0,0 +1,119 @@
<template>
<el-dialog title="选择开票人" width="60%" v-model="dialogVisible">
<el-table :data="tableData.list" border>
<el-table-column label="开票人" prop="name"></el-table-column>
<el-table-column label="操作" width="140">
<template v-slot="scope">
<el-button type="primary" icon="" :loading="scope.row.loading"
@click="selectHandle(scope.row)">选择</el-button>
</template>
</el-table-column>
</el-table>
</el-dialog>
<el-dialog title="扫描二维码开票" width="330px" v-model="showEwmDialog">
<canvas class="ewm" ref="canvasRef"></canvas>
<div class="footer">
<el-button type="primary" style="width: 100%" :loading="printEwmLoading"
@click="printEwmHandle">打印二维码</el-button>
</div>
</el-dialog>
</template>
<script setup>
import QRCode from 'qrcode'
import { ElMessage } from 'element-plus'
import { reactive, ref } from 'vue'
import { issuedby, carsubinvoicing, syjprintqrcode } from '@/api/invoice.js'
import { useUser } from "@/store/user.js";
const store = useUser();
const emits = defineEmits(['loadComplete', 'success'])
const dialogVisible = ref(false)
const showEwmDialog = ref(false)
const canvasRef = ref(null)
const ewmInfo = ref({})
const printEwmLoading = ref(false)
const tableData = reactive({
list: []
})
const orderInfo = ref({})
//
async function printEwmHandle() {
try {
printEwmLoading.value = true
const res = await syjprintqrcode({
id: ewmInfo.value.id
})
ElMessage.success('打印成功')
showEwmDialog.value = false
printEwmLoading.value = false
} catch (error) {
console.log(error);
printEwmLoading.value = false
}
}
//
async function selectHandle(row) {
try {
row.loading = true
const res = await carsubinvoicing({
store_id: store.userInfo.loginName,
orderNo: orderInfo.value.id,
dlzh: row.id
})
console.log(res);
row.loading = false
ewmInfo.value = res
dialogVisible.value = false
showEwmDialog.value = true
setTimeout(() => {
QRCode.toCanvas(canvasRef.value, ewmInfo.value.wechat_url, function (error) {
if (error) console.error(error)
// console.log('success!');
})
}, 10)
} catch (error) {
row.loading = false
console.log(error);
}
}
//
async function getTableData() {
try {
const res = await issuedby({
store_id: store.userInfo.loginName
})
emits('loadComplete', false)
dialogVisible.value = true
tableData.list = res.map(item => {
item.loading = false
return item
})
} catch (error) {
console.log(error);
emits('loadComplete', false)
}
}
function show(order) {
console.log(order);
orderInfo.value = order
getTableData()
}
defineExpose({
show
})
</script>
<style scoped lang="scss">
.ewm {
width: 300px !important;
height: 300px !important;
}
</style>

View File

@ -133,7 +133,7 @@
" type="primary" @click="recharge = true">退单</el-button>
</div>
<div class="orderbox_right_buttonbutton">
<!-- <el-button style="flex: 1" @click="invoiveHandle">开发票</el-button> -->
<el-button style="flex: 1" :loading="invoiceLoading" @click="invoiveHandle">开发票</el-button>
<el-button @click="print('normal')" style="flex: 1">重打小票</el-button>
<el-button @click="print('label')" style="flex: 1">重打标签</el-button>
</div>
@ -274,6 +274,7 @@
</el-dialog>
</div>
<takeFoodCode ref="takeFoodCodeRef" title="支付密码" type="password" placeholder="请输入支付密码" @success="passwordSuccess" />
<invoice ref="invoiceRef" @load-complete="invoiceLoading = false" />
</template>
<script setup>
@ -294,10 +295,12 @@ import cashTable from "@/views/order/components/cashTable.vue";
import { clearNoNum } from "@/utils";
import md5 from "js-md5";
import dateRange from './components/dateRange.vue'
import { useGlobal } from "@/store/global.js";
import takeFoodCode from "@/components/takeFoodCode.vue";
import invoice from './components/invoice.vue'
const invoiceLoading = ref(false)
const invoiceRef = ref(null)
const takeFoodCodeRef = ref(null);
const global = useGlobal();
@ -330,16 +333,10 @@ const handlerecharge = () => {
const buttonloading = ref(); //loading
//
async function invoiveHandle() {
try {
const res = await issuedby({
store_id: store.userInfo.loginName,
is_pc: 1
})
} catch (error) {
console.log(error);
}
//
function invoiveHandle() {
invoiceLoading.value = true
invoiceRef.value.show(printLabelOrder.value)
}
//