This commit is contained in:
weipengfei 2024-05-18 19:52:50 +08:00
parent eb1a881d92
commit 92dc991f5d
5 changed files with 21 additions and 9 deletions

View File

@ -1,4 +1,4 @@
VITE_NOW_TYPE = 'build'
VITE_PUSH_URL = 'ws://192.168.1.22:3133'
VITE_BASE_URL = 'https://shop.lihaink.cn'
VITE_PUSH_URL ='wss://erp.lihaink.cn/pull'
VITE_BASE_URL = 'https://erp.lihaink.cn'

View File

@ -118,7 +118,7 @@ export function saleOrderListApi(data) {
* @description 采购订单提交
*/
export function createOrderApi(data) {
return request.get(`/order/OpurchaseOrder/createOrder`, { params: data })
return request.post(`/order/OpurchaseOrder/createOrder`, { params: data })
}
/**

View File

@ -34,6 +34,7 @@ const connect = () => {
if (res.h5) ElMessage.error("请使用APP连接打印机");
else {
printStore.setConnect(false);
printStore.setPrintAddress('');
dialogVisible.value = false;
uni.postMessage({
data: {
@ -87,8 +88,10 @@ onMounted(() => {
function (event) {
// alert(JSON.stringify(event.data));
if (event.data.type === "connect") {
let str = event.data.data.address;
printStore.setConnect(true);
ElMessage.success("已连接打印机T58");
printStore.setPrintAddress(str);
ElMessage.success("已连接打印机T58("+str+")");
}
},
false
@ -128,13 +131,14 @@ onUnmounted(() => {
<span>打印自检</span>
</el-button>
</div>
<div style="margin-right: 1rem" v-if="!printStore.is_connect">
<div style="margin-right: 1rem" v-if="!printStore.is_connect||!printStore.printAddress">
<el-button @click="connect" type="warning">
<span>点击自动连接打印机</span>
</el-button>
</div>
<div style="margin-right: 1rem" v-else @click="dialogVisible = true">
已连接打印机T58
<div style="margin-right: 1rem;font-size: 0.9rem;" v-else @click="dialogVisible = true">
<div>已连接打印机T58</div>
<div style="font-size: 0.7rem;color: #ccc;">({{ printStore.printAddress }})</div>
</div>
<el-dialog v-model="dialogVisible" title="提示" width="500">
<span>打印机已连接是否重新连接</span>

View File

@ -4,6 +4,7 @@ import { ref } from "vue"
export const usePrintStore = defineStore('print', () => {
const is_connect = ref(localStorage.getItem('is_connect'));
const printAddress = ref(localStorage.getItem('print_address'));
const setConnect = (e)=>{
@ -11,8 +12,15 @@ export const usePrintStore = defineStore('print', () => {
localStorage.setItem('is_connect',e);
}
const setPrintAddress = (e)=>{
printAddress.value = e;
localStorage.setItem('print_address',e);
}
return {
is_connect,
setConnect
setConnect,
printAddress,
setPrintAddress
}
})

View File

@ -146,7 +146,7 @@ const onPrint = (data)=>{
pay_number: data.transaction_id, //
goods: goods, //
};
if (goods.length > 0) {
if (goods.length > 0 && data.out_trade_no) {
let str = printTicket(obj);
console.log(str);
uni.getEnv((res) => {