This commit is contained in:
parent
eb1a881d92
commit
92dc991f5d
|
@ -1,4 +1,4 @@
|
||||||
VITE_NOW_TYPE = 'build'
|
VITE_NOW_TYPE = 'build'
|
||||||
|
|
||||||
VITE_PUSH_URL = 'ws://192.168.1.22:3133'
|
VITE_PUSH_URL ='wss://erp.lihaink.cn/pull'
|
||||||
VITE_BASE_URL = 'https://shop.lihaink.cn'
|
VITE_BASE_URL = 'https://erp.lihaink.cn'
|
|
@ -118,7 +118,7 @@ export function saleOrderListApi(data) {
|
||||||
* @description 采购订单提交
|
* @description 采购订单提交
|
||||||
*/
|
*/
|
||||||
export function createOrderApi(data) {
|
export function createOrderApi(data) {
|
||||||
return request.get(`/order/OpurchaseOrder/createOrder`, { params: data })
|
return request.post(`/order/OpurchaseOrder/createOrder`, { params: data })
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -34,6 +34,7 @@ const connect = () => {
|
||||||
if (res.h5) ElMessage.error("请使用APP连接打印机");
|
if (res.h5) ElMessage.error("请使用APP连接打印机");
|
||||||
else {
|
else {
|
||||||
printStore.setConnect(false);
|
printStore.setConnect(false);
|
||||||
|
printStore.setPrintAddress('');
|
||||||
dialogVisible.value = false;
|
dialogVisible.value = false;
|
||||||
uni.postMessage({
|
uni.postMessage({
|
||||||
data: {
|
data: {
|
||||||
|
@ -87,8 +88,10 @@ onMounted(() => {
|
||||||
function (event) {
|
function (event) {
|
||||||
// alert(JSON.stringify(event.data));
|
// alert(JSON.stringify(event.data));
|
||||||
if (event.data.type === "connect") {
|
if (event.data.type === "connect") {
|
||||||
|
let str = event.data.data.address;
|
||||||
printStore.setConnect(true);
|
printStore.setConnect(true);
|
||||||
ElMessage.success("已连接打印机T58");
|
printStore.setPrintAddress(str);
|
||||||
|
ElMessage.success("已连接打印机T58("+str+")");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
false
|
false
|
||||||
|
@ -128,13 +131,14 @@ onUnmounted(() => {
|
||||||
<span>打印自检</span>
|
<span>打印自检</span>
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</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">
|
<el-button @click="connect" type="warning">
|
||||||
<span>点击自动连接打印机</span>
|
<span>点击自动连接打印机</span>
|
||||||
</el-button>
|
</el-button>
|
||||||
</div>
|
</div>
|
||||||
<div style="margin-right: 1rem" v-else @click="dialogVisible = true">
|
<div style="margin-right: 1rem;font-size: 0.9rem;" v-else @click="dialogVisible = true">
|
||||||
已连接打印机T58
|
<div>已连接打印机T58</div>
|
||||||
|
<div style="font-size: 0.7rem;color: #ccc;">({{ printStore.printAddress }})</div>
|
||||||
</div>
|
</div>
|
||||||
<el-dialog v-model="dialogVisible" title="提示" width="500">
|
<el-dialog v-model="dialogVisible" title="提示" width="500">
|
||||||
<span>打印机已连接,是否重新连接</span>
|
<span>打印机已连接,是否重新连接</span>
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { ref } from "vue"
|
||||||
export const usePrintStore = defineStore('print', () => {
|
export const usePrintStore = defineStore('print', () => {
|
||||||
|
|
||||||
const is_connect = ref(localStorage.getItem('is_connect'));
|
const is_connect = ref(localStorage.getItem('is_connect'));
|
||||||
|
const printAddress = ref(localStorage.getItem('print_address'));
|
||||||
|
|
||||||
|
|
||||||
const setConnect = (e)=>{
|
const setConnect = (e)=>{
|
||||||
|
@ -11,8 +12,15 @@ export const usePrintStore = defineStore('print', () => {
|
||||||
localStorage.setItem('is_connect',e);
|
localStorage.setItem('is_connect',e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const setPrintAddress = (e)=>{
|
||||||
|
printAddress.value = e;
|
||||||
|
localStorage.setItem('print_address',e);
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
is_connect,
|
is_connect,
|
||||||
setConnect
|
setConnect,
|
||||||
|
printAddress,
|
||||||
|
setPrintAddress
|
||||||
}
|
}
|
||||||
})
|
})
|
|
@ -146,7 +146,7 @@ const onPrint = (data)=>{
|
||||||
pay_number: data.transaction_id, //支付单号
|
pay_number: data.transaction_id, //支付单号
|
||||||
goods: goods, //商品列表
|
goods: goods, //商品列表
|
||||||
};
|
};
|
||||||
if (goods.length > 0) {
|
if (goods.length > 0 && data.out_trade_no) {
|
||||||
let str = printTicket(obj);
|
let str = printTicket(obj);
|
||||||
console.log(str);
|
console.log(str);
|
||||||
uni.getEnv((res) => {
|
uni.getEnv((res) => {
|
||||||
|
|
Loading…
Reference in New Issue