This commit is contained in:
parent
7d82a14b0f
commit
968e194688
|
@ -1,7 +1,7 @@
|
|||
VITE_NOW_TYPE = 'dist'
|
||||
|
||||
VITE_PUSH_URL = 'ws://192.168.1.22:8787'
|
||||
VITE_BASE_URL = 'http://192.168.1.22:8546'
|
||||
|
||||
|
||||
# VITE_BASE_URL = 'http://192.168.1.22:8546'
|
||||
VITE_BASE_URL = 'https://erp.lihaink.cn'
|
||||
# VITE_PUSH_URL ='wss://erp.lihaink.cn/pull'
|
||||
# VITE_BASE_URL = 'https://erp.lihaink.cn'
|
|
@ -148,3 +148,10 @@ export function opurchaseOrderApi(data) {
|
|||
export function subOrdersListApi(data) {
|
||||
return request.get(`/order/OpurchaseOrder/sub_orders`, { params: data })
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 摊贩订单数量统计
|
||||
*/
|
||||
export function merchantOrderCountApi(data) {
|
||||
return request.get(`/order/retailOrder/merchant_order_count`, { params: data })
|
||||
}
|
Binary file not shown.
|
@ -110,22 +110,36 @@ const handleEnter = () => {
|
|||
message: res.data.trade_state_desc || '支付成功',
|
||||
type: "success",
|
||||
});
|
||||
if(res.data.message) audioplay(res.data.message);
|
||||
beforeClose();
|
||||
// if(res.data.message) audioplay(res.data.message);
|
||||
beforeClose(res.data);
|
||||
} else {
|
||||
if (!res.data.group_order_sn) {
|
||||
order_id.value = res.data.result.order_id;
|
||||
loading.value = false;
|
||||
return ElMessage({
|
||||
message: res.message,
|
||||
type: "error",
|
||||
if(res.msg=='用户支付中'&&res.code==1){
|
||||
ElMessage.warning(res.msg);
|
||||
mitt.on('pay_success', (e)=>{
|
||||
ElMessage({
|
||||
message: '支付成功',
|
||||
type: "success",
|
||||
});
|
||||
} else {
|
||||
order_id.value = res.data.group_order_id;
|
||||
count.value = 0;
|
||||
timecount = 0;
|
||||
getOrderStatus(res.data.group_order_sn);
|
||||
setTimeout(()=>{
|
||||
mitt.off('pay_success');
|
||||
}, 200);
|
||||
drawer.value = false;
|
||||
beforeClose(e);
|
||||
})
|
||||
}
|
||||
// if (!res.data.group_order_sn) {
|
||||
// order_id.value = res.data.result.order_id;
|
||||
// loading.value = false;
|
||||
// return ElMessage({
|
||||
// message: res.message,
|
||||
// type: "error",
|
||||
// });
|
||||
// } else {
|
||||
// order_id.value = res.data.group_order_id;
|
||||
// count.value = 0;
|
||||
// timecount = 0;
|
||||
// getOrderStatus(res.data.group_order_sn);
|
||||
// }
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
|
@ -165,8 +179,8 @@ const orderPay = (id) => {
|
|||
message: res.message=='success'?'支付成功':res.message,
|
||||
type: "success",
|
||||
});
|
||||
if(res.data.message) audioplay(res.data.message);
|
||||
beforeClose();
|
||||
// if(res.data.message) audioplay(res.data.message);
|
||||
beforeClose(res.data);
|
||||
} else {
|
||||
order_id.value = res.data.group_order_id;
|
||||
count.value = 0;
|
||||
|
@ -197,7 +211,7 @@ const getOrderStatus = (id) => {
|
|||
message: res.message,
|
||||
type: "success",
|
||||
});
|
||||
if(res.data.message) audioplay(res.data.message);
|
||||
// if(res.data.message) audioplay(res.data.message);
|
||||
beforeClose();
|
||||
} else {
|
||||
ElMessage({
|
||||
|
@ -229,7 +243,7 @@ const getOrderStatus = (id) => {
|
|||
});
|
||||
};
|
||||
|
||||
const beforeClose = () => {
|
||||
const beforeClose = (data) => {
|
||||
window.removeEventListener("keydown", keyboard);
|
||||
reLoad.value = false;
|
||||
loading.value = false;
|
||||
|
@ -237,7 +251,7 @@ const beforeClose = () => {
|
|||
collection.value = "";
|
||||
collectionArray.value = [];
|
||||
codeRef.value?.blur();
|
||||
emit("paySuccess");
|
||||
emit("paySuccess", data);
|
||||
drawer.value = false;
|
||||
};
|
||||
|
||||
|
@ -314,7 +328,7 @@ const cashBnt = () => {
|
|||
type: "success",
|
||||
});
|
||||
changeActive(1);
|
||||
if(res.data.message) audioplay(res.data.message);
|
||||
// if(res.data.message) audioplay(res.data.message);
|
||||
beforeClose();
|
||||
} else {
|
||||
if (!res.data.group_order_sn) {
|
||||
|
|
|
@ -12,14 +12,23 @@ const connection = new Push({
|
|||
app_key: '2ce3ce22329517213caa7dad261f5695',
|
||||
});
|
||||
|
||||
|
||||
// 浏览器监听user-1
|
||||
const user_channel = connection.subscribe(`store_merchant_${userStore.userInfo.merchant.mer_id}`);
|
||||
// const user_channel = connection.subscribe(`store_merchant_${1}`);
|
||||
|
||||
// 当user-2频道有message事件的消息时
|
||||
user_channel.on('message', function (data) {
|
||||
console.log("收到消息--",data, JSON.parse(data.content));
|
||||
console.log("收到消息--",data);
|
||||
try {
|
||||
if(data?.content?.type=='cash_register'&&data?.content?.msg=="您有一笔订单已支付"){
|
||||
mitt.emit('pay_success', data?.content?.data);
|
||||
}
|
||||
if(data?.content?.type=='store_merchant'&&data?.content?.msg=="您有一笔新的订单"){
|
||||
mitt.emit('new_order', data?.content);
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
}
|
||||
});
|
||||
// 断线事件
|
||||
user_channel.on('close', function () {
|
||||
|
|
|
@ -2,18 +2,56 @@
|
|||
import { useRoute, useRouter } from "vue-router";
|
||||
import { ref, onMounted, onUnmounted } from "vue";
|
||||
import mitt from "@/utils/mitt.js";
|
||||
import { useOrderStore } from "@/store/order.js";
|
||||
import { merchantOrderCountApi } from "@/api/store.js";
|
||||
import { ElMessage } from "element-plus";
|
||||
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
|
||||
const orderStore = useOrderStore();
|
||||
// setInterval(()=>{
|
||||
// setOrderCount(+orderStore.orderCount + 1)
|
||||
// }, 2000)
|
||||
|
||||
const setOrderCount = (e = 1) => {
|
||||
orderStore.setOrderCount(e)
|
||||
list.value.forEach(item=>{
|
||||
if(item.name == "order") item.count = e;
|
||||
})
|
||||
};
|
||||
|
||||
const newOrder = (e) => {
|
||||
merchantOrderCountApi().then((res) => {
|
||||
setOrderCount(res?.data?.order_count || 0);
|
||||
});
|
||||
ElMessage.success('您有新的订单')
|
||||
// 创建音频对象
|
||||
var audio = new Audio("/src/assets/order.mp3");
|
||||
// 播放音频
|
||||
audio.play();
|
||||
};
|
||||
|
||||
// setTimeout(() => {
|
||||
// newOrder({
|
||||
// msg: "您有一笔新的订单",
|
||||
// });
|
||||
// }, 3000);
|
||||
|
||||
const navTo = (name) => {
|
||||
router.push({ name });
|
||||
};
|
||||
const list = ref([
|
||||
{ name: "saleHome", title: "收银", ico: "Sell", count: 0 },
|
||||
{ name: "saleOrder", title: "收银订单", ico: "DataLine", count: 0 },
|
||||
{ name: "order", title: "摊贩订单", ico: "DataAnalysis", count: 2 },
|
||||
{ name: "purchaseOrder", title: "采购订单", ico: "Tickets", count: 0 },
|
||||
{
|
||||
name: "order",
|
||||
title: "摊贩订单",
|
||||
ico: "DataAnalysis",
|
||||
count: +orderStore.orderCount,
|
||||
},
|
||||
{ name: "purchaseOrder", title: "采购订单", ico: "Van", count: 0 },
|
||||
{ name: "orderCount", title: "订单统计", ico: "DocumentRemove", count: 0 },
|
||||
// { name: "test", title: "打印", ico: "Tickets", count: 0 },
|
||||
]);
|
||||
const aup = () => {
|
||||
|
@ -29,11 +67,16 @@ const adown = () => {
|
|||
onMounted(() => {
|
||||
mitt.on("up", aup);
|
||||
mitt.on("down", adown);
|
||||
mitt.on("new_order", newOrder);
|
||||
merchantOrderCountApi().then((res) => {
|
||||
setOrderCount(res?.data?.order_count || 0);
|
||||
});
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
mitt.off("aup", aup);
|
||||
mitt.off("adown", adown);
|
||||
mitt.off("new_order", newOrder);
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import { ElMessage } from "element-plus";
|
|||
import { useRouter } from "vue-router";
|
||||
import mitt from "@/utils/mitt.js";
|
||||
import { usePrintStore } from "@/store/print.js";
|
||||
import * as Esc from "@/utils/EscPostUtils.js";
|
||||
import { printTicket } from "@/utils/EscPos.js";
|
||||
|
||||
const userStore = useUserStore();
|
||||
const printStore = usePrintStore();
|
||||
|
@ -48,9 +48,7 @@ let isPrint = false; //是否正在打印小票
|
|||
// 预打印
|
||||
const printReceipt = (content = "") => {
|
||||
console.log("预打印");
|
||||
// console.log(Esc.inline3("单价 ", "数量", "小计", " ", 1) + "\n");
|
||||
// console.log(Esc.inline3("2.36元 ", "10包", "30.00元", " ", 1) + "\n");
|
||||
// return ;
|
||||
console.log(printTicket(content, true));
|
||||
if (isPrint) return;
|
||||
isPrint = true;
|
||||
uni.getEnv((res) => {
|
||||
|
@ -70,46 +68,7 @@ const printReceipt = (content = "") => {
|
|||
const APPprint = (content = "") => {
|
||||
let str = "";
|
||||
if (content === "") {
|
||||
// str += "********************************\n";
|
||||
// str += "莲花农贸市场\n";
|
||||
// str += "单号: PF171568087790938356\n";
|
||||
// str += "测试商品 0.01元/kg\n";
|
||||
// str += "x 3 \t\t 0.10 \n";
|
||||
// str += "测试商品白菜 1.33元/kg\n";
|
||||
// str += "x 10 \t\t 13.30元\n";
|
||||
// str += "测试商品小黄鸭 36.59元/只\n";
|
||||
// str += "x 3 \t\t 106.97元\n";
|
||||
// str += " \t 合计: ¥235.36\n";
|
||||
// str += "\n";
|
||||
// str += "--------------------------------\n";
|
||||
// str += "\n";
|
||||
str += Esc.Size2(0) + Esc.Center() + Esc.boldFontOn() + "莲花农贸市场" + "\n";
|
||||
str += Esc.fillLine(" ") + Esc.boldFontOff() + "\n";
|
||||
str += Esc.Left() + "单号: PF171568087790938356" + "\n";
|
||||
str += Esc.Left() + "下单时间: 2024-5-15 18:00:32" + "\n";
|
||||
// 商品信息
|
||||
str += Esc.fillLine("=") + "\n";
|
||||
str += Esc.inline3("单价 ", "数量", "小计", " ", 1) + "\n";
|
||||
str += Esc.Left() + "白菜 大白菜" + "\n";
|
||||
str += Esc.inline3("206.36元 ", "10包", "3600.00元", " ", 1) + "\n";
|
||||
str += Esc.Left() + "白菜 大白菜" + "\n";
|
||||
str += Esc.inline3("206.36元 ", "10包", "3600.00元", " ", 1) + "\n";
|
||||
str += Esc.Left() + "白菜 大白菜" + "\n";
|
||||
str += Esc.inline3("206.36元 ", "10包", "3600.00元", " ", 1) + "\n";
|
||||
str += Esc.fillLine("=") + "\n";
|
||||
|
||||
str += Esc.Left() + "应付款: " + "29.96元" + "\n";
|
||||
str += Esc.Left() + "实付款: " + "29.96元" + "\n";
|
||||
str += Esc.Left() + "支付方式: " + "微信支付" + "\n";
|
||||
str += Esc.Left() + "支付单号: " + "4200002159202405159003084211" + "\n";
|
||||
str += Esc.fillLine("=") + "\n";
|
||||
|
||||
// 票尾
|
||||
str += Esc.fillLine(" ") + "\n";
|
||||
str += Esc.Center() + "欢迎下次光临!" + "\n";
|
||||
str += Esc.feedLines(" ") + "\n";
|
||||
// 切纸
|
||||
str += Esc.cutPaper();
|
||||
str = printTicket({}, true); //打印自检
|
||||
console.log(str);
|
||||
} else str = content;
|
||||
uni.postMessage({
|
||||
|
@ -150,7 +109,7 @@ onUnmounted(() => {
|
|||
src="https://lihai001.oss-cn-chengdu.aliyuncs.com/def/12c93202404101530591311.png"
|
||||
></el-image>
|
||||
</div>
|
||||
<div class="card-title">里海收银系统</div>
|
||||
<div class="card-title">泸优采收银系统</div>
|
||||
<div
|
||||
style="
|
||||
margin-left: 1rem;
|
||||
|
|
|
@ -35,6 +35,12 @@ const routes = [
|
|||
meta: { title: '采购订单' },
|
||||
component: () => import('@/views/purchaseOrder/index.vue'),
|
||||
},
|
||||
{
|
||||
path: '/orderCount',
|
||||
name: 'orderCount',
|
||||
meta: { title: '订单统计' },
|
||||
component: () => import('@/views/saleOrder/indexCount.vue'),
|
||||
},
|
||||
{
|
||||
path: '/test',
|
||||
name: 'test',
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
import { defineStore } from "pinia"
|
||||
import { ref } from "vue"
|
||||
|
||||
export const useOrderStore = defineStore('order', () => {
|
||||
|
||||
const orderCount = ref(localStorage.getItem('orderCount')||0);
|
||||
|
||||
|
||||
const setOrderCount = (e)=>{
|
||||
orderCount.value = e;
|
||||
localStorage.setItem('orderCount',e);
|
||||
}
|
||||
|
||||
return {
|
||||
orderCount,
|
||||
setOrderCount
|
||||
}
|
||||
})
|
|
@ -0,0 +1,70 @@
|
|||
import * as Esc from "@/utils/EscPostUtils.js";
|
||||
|
||||
const testObj = {
|
||||
mer_name: "莲花农贸市场", //商户名称
|
||||
service_phone: "0830-2669767", //客服电话
|
||||
number: "PF171568087790938356", //单号
|
||||
create_time: "2024-5-15 18:00:32", //下单时间
|
||||
total_price: "29.96", //总价
|
||||
pay_price: "29.96", //实付
|
||||
pay_type: "微信支付", //支付方式
|
||||
pay_number: "4200002159202405159003084211", //支付单号
|
||||
goods: [
|
||||
{
|
||||
name: "白菜 大白菜", //商品名称
|
||||
sell: "236.60", //单价
|
||||
nums: "13", //数量
|
||||
unit_name: "kg", //单位
|
||||
total: "2896.34" //小计
|
||||
},
|
||||
{
|
||||
name: "小黄鸭", //商品名称
|
||||
sell: "9.56", //单价
|
||||
nums: "2", //数量
|
||||
unit_name: "只", //单位
|
||||
total: "19.38" //小计
|
||||
},
|
||||
{
|
||||
name: "卷心菜", //商品名称
|
||||
sell: "15.37", //单价
|
||||
nums: "8", //数量
|
||||
unit_name: "斤", //单位
|
||||
total: "134.38" //小计
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
export const printTicket = (obj = {}, test = false) => {
|
||||
let str = "";
|
||||
if(!obj || !obj.number) obj = testObj;
|
||||
str += Esc.Size2(0) + Esc.Center() + Esc.boldFontOn() + obj.mer_name + "\n";
|
||||
str += Esc.fillLine(" ") + Esc.boldFontOff() + "\n";
|
||||
str += Esc.Left() + "单号: " + obj.number + "\n";
|
||||
str += Esc.Left() + "下单时间: " + obj.create_time + "\n";
|
||||
|
||||
// 商品信息
|
||||
str += Esc.fillLine("=") + "\n";
|
||||
|
||||
str += Esc.inline3("单价", "数量", "小计", " ", 1) + "\n";
|
||||
obj.goods.forEach(item => {
|
||||
str += Esc.Left() + item.name + "\n";
|
||||
str += Esc.inline3(`${item.sell}元`, `${item.nums}${item.unit_name}`, `${item.total}元`, " ", 1) + "\n";
|
||||
})
|
||||
|
||||
str += Esc.fillLine("=") + "\n";
|
||||
|
||||
str += Esc.Left() + "应付款: " + obj.total_price + "元" + "\n";
|
||||
str += Esc.Left() + "实付款: " + obj.pay_price + "元" + "\n";
|
||||
str += Esc.Left() + "支付方式: " + obj.pay_type + "\n";
|
||||
str += Esc.Left() + "支付单号: " + obj.pay_number + "\n";
|
||||
str += Esc.Left() + "联系电话: " + obj.service_phone + "\n";
|
||||
str += Esc.fillLine("=") + "\n";
|
||||
|
||||
// 票尾
|
||||
str += Esc.fillLine(" ") + "\n";
|
||||
str += Esc.Center() + "欢迎下次光临!" + "\n";
|
||||
str += Esc.feedLines(" ") + "\n";
|
||||
// 切纸
|
||||
str += Esc.cutPaper();
|
||||
return str;
|
||||
}
|
|
@ -1,3 +1,5 @@
|
|||
// 此为指令集, 如非必要请不要进行修改操作, 以免打印效果异常
|
||||
|
||||
// 打印机纸宽58mm,页的宽度384,字符宽度为1,每行最多盛放32个字符
|
||||
// 打印机纸宽80mm,页的宽度576,字符宽度为1,每行最多盛放48个字符
|
||||
const PAGE_WIDTH = 384;
|
||||
|
@ -238,39 +240,19 @@ export function inline(str1, str2, fillWith = ' ', fontWidth = 1) {
|
|||
* @param {string} fillWith 列之间的填充字符
|
||||
* @param {number} fontWidth 字符宽度(默认为1)
|
||||
*/
|
||||
export function inlineThreeColumns(str1, str2, str3, fillWith = ' ', fontWidth = 1) {
|
||||
const lineWidth = MAX_CHAR_COUNT_EACH_LINE / fontWidth;
|
||||
|
||||
// 计算每列的宽度(假设三列等宽)
|
||||
const columnWidth = Math.floor(lineWidth / 3);
|
||||
|
||||
// 计算每列的实际宽度
|
||||
const width1 = getStringWidth(str1);
|
||||
const width2 = getStringWidth(str2);
|
||||
const width3 = getStringWidth(str3);
|
||||
|
||||
// 计算每列需要的填充数量
|
||||
let fillCount1 = columnWidth - width1;
|
||||
let fillCount2 = columnWidth - width2;
|
||||
let fillCount3 = lineWidth - columnWidth - (width1 + fillCount1 * fontWidth + width2 + fillCount2 * fontWidth + width3);
|
||||
|
||||
// 创建填充字符串
|
||||
let fillStr1 = new Array(fillCount1).fill(fillWith.charAt(0)).join('');
|
||||
let fillStr2 = new Array(fillCount2).fill(fillWith.charAt(0)).join('');
|
||||
let fillStr3 = new Array(fillCount3).fill(fillWith.charAt(0)).join('');
|
||||
|
||||
// 拼接字符串
|
||||
return str1 + fillStr1 + str2 + fillStr2 + str3 + fillStr3;
|
||||
}
|
||||
|
||||
export function inline3(str1, str2, str3, fillWith = ' ', fontWidth = 1) {
|
||||
const lineWidth = MAX_CHAR_COUNT_EACH_LINE / fontWidth;
|
||||
// 需要填充的字符数量
|
||||
let fillCount = lineWidth - (getStringWidth(str1) + getStringWidth(str2) + getStringWidth(str3)) % lineWidth;
|
||||
console.log("=",lineWidth, getStringWidth(str1) + getStringWidth(str2) + getStringWidth(str3), fillCount);
|
||||
fillCount = Math.floor(fillCount / 2);
|
||||
let fillStr = new Array(fillCount).fill(fillWith.charAt(0)).join('');
|
||||
return str1 + fillStr + str2 + fillStr + str3;
|
||||
let count2 = Math.floor(fillCount / 2); //分别计算出两边各自需要填充的数量
|
||||
let count1 = fillCount - count2;
|
||||
if(fillCount>2){ //往左偏移两位, 防止打印时,小计与数量重叠
|
||||
count1 -= 2;
|
||||
count2 += 2;
|
||||
}
|
||||
let fillStr1 = new Array(count1).fill(fillWith.charAt(0)).join('');
|
||||
let fillStr2 = new Array(count2).fill(fillWith.charAt(0)).join('');
|
||||
return str1 + fillStr1 + str2 + fillStr2 + str3;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -175,8 +175,8 @@ onUnmounted(() => {
|
|||
<div class="info-item-title">支付方式:</div>
|
||||
<div class="info-item-info">
|
||||
<span v-if="formData.pay_type == 9">微信收款</span>
|
||||
<span v-if="formData.pay_type == 1">余额支付</span>
|
||||
<span v-if="formData.pay_type == 3">微信支付</span>
|
||||
<span v-if="formData.pay_type == 3">余额支付</span>
|
||||
<span v-if="formData.pay_type == 1">微信支付</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -51,7 +51,7 @@ const where = ref({
|
|||
page_size: 20,
|
||||
number: "",
|
||||
date: moment(new Date()).format("YYYY-MM-DD"),
|
||||
source: props.source,
|
||||
// source: props.source,
|
||||
});
|
||||
|
||||
const loading = ref(false);
|
||||
|
@ -86,6 +86,7 @@ const getOrderList = (reload = false) => {
|
|||
const submitOrder = ()=>{
|
||||
createOrderApi().then(res=>{
|
||||
ElMessage.success("提交成功");
|
||||
getOrderList(true);
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -203,8 +204,8 @@ onUnmounted(()=>{
|
|||
<div v-if="item.paid">
|
||||
已支付
|
||||
<span v-if="item.pay_type == 9">(微信收款)</span>
|
||||
<span v-if="item.pay_type == 1">(余额支付)</span>
|
||||
<span v-if="item.pay_type == 3">(微信支付)</span>
|
||||
<span v-if="item.pay_type == 3">(余额支付)</span>
|
||||
<span v-if="item.pay_type == 1">(微信支付)</span>
|
||||
</div>
|
||||
<div v-else style="color: #ff4a00">未支付</div>
|
||||
</div>
|
||||
|
|
|
@ -31,13 +31,18 @@ const rules = ref({
|
|||
detail: [{ required: true, message: "请输入地址", trigger: "blur" }],
|
||||
});
|
||||
|
||||
const formRef = ref(null);
|
||||
|
||||
const submit = () => {
|
||||
formRef.value?.validate((valid) => {
|
||||
if (valid) {
|
||||
merchantCreateApi(form.value).then((res) => {
|
||||
dialogFormVisible.value = false;
|
||||
orderRef.value?.getOrderList(true);
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -47,7 +52,7 @@ const submit = () => {
|
|||
<detail ref="detailRef" @addAddress="addAddress" />
|
||||
|
||||
<el-dialog v-model="dialogFormVisible" title="添加地址" width="500">
|
||||
<el-form :model="form" label-width="100" :rules="rules">
|
||||
<el-form ref="formRef" :model="form" label-width="100" :rules="rules">
|
||||
<el-form-item
|
||||
label="收货人"
|
||||
:label-width="formLabelWidth"
|
||||
|
|
|
@ -117,8 +117,8 @@ defineExpose({
|
|||
<div class="info-item-title">支付方式:</div>
|
||||
<div class="info-item-info">
|
||||
<span v-if="formData.pay_type == 9">微信收款</span>
|
||||
<span v-if="formData.pay_type == 1">余额支付</span>
|
||||
<span v-if="formData.pay_type == 3">微信支付</span>
|
||||
<span v-if="formData.pay_type == 3">余额支付</span>
|
||||
<span v-if="formData.pay_type == 1">微信支付</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -15,11 +15,11 @@ const codeRef = ref(null);
|
|||
|
||||
const emit = defineEmits(["getStoreList", "changeItem", "loadMore"]);
|
||||
|
||||
const bar_code = ref("");
|
||||
const name = ref("");
|
||||
|
||||
const loadMore = () => {
|
||||
emit("loadMore", {
|
||||
bar_code: bar_code.value,
|
||||
name: name.value,
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -31,12 +31,12 @@ const changeItem = (item) => {
|
|||
|
||||
const handleEnter = _.throttle(() => {
|
||||
emit("getStoreList", {
|
||||
bar_code: bar_code.value,
|
||||
name: name.value,
|
||||
}, true);
|
||||
}, 300)
|
||||
|
||||
defineExpose({
|
||||
bar_code,
|
||||
name,
|
||||
});
|
||||
|
||||
const isfocus = ref(false);
|
||||
|
@ -70,7 +70,7 @@ onUnmounted(() => {
|
|||
<div class="nav-item-label">搜索 (Shift)</div>
|
||||
<div class="nav-item-input">
|
||||
<el-input
|
||||
v-model="bar_code"
|
||||
v-model="name"
|
||||
placeholder=" 搜索商品名称/条形码或点击聚焦扫码, 按回车(Enter)搜索"
|
||||
clearable
|
||||
ref="codeRef"
|
||||
|
@ -105,7 +105,7 @@ onUnmounted(() => {
|
|||
<div class="shop-name">{{ item.name }}</div>
|
||||
<div class="shop-price">
|
||||
¥<span>{{ item.sell }}</span>
|
||||
<span style="color: #777;font-size: 0.9rem;">/{{item.unit_name}}</span>
|
||||
<span class="unit-name">/{{item.unit_name}}</span>
|
||||
</div>
|
||||
<div class="no-stock" v-if="item.stock == 0">
|
||||
<div>
|
||||
|
@ -222,6 +222,9 @@ onUnmounted(() => {
|
|||
font-size: 1.2rem;
|
||||
margin-left: 0.187rem;
|
||||
}
|
||||
.unit-name{
|
||||
color: #777;font-size: 0.9rem;
|
||||
}
|
||||
}
|
||||
|
||||
&:hover {
|
||||
|
@ -230,6 +233,9 @@ onUnmounted(() => {
|
|||
.shop-price {
|
||||
color: #fff;
|
||||
}
|
||||
.unit-name{
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.no-stock {
|
||||
|
|
|
@ -11,6 +11,8 @@ import { saleStoreListApi } from "@/api/shop.js";
|
|||
import { useUserStore } from "@/store/user.js";
|
||||
import { useRoute } from "vue-router";
|
||||
import mitt from "@/utils/mitt.js";
|
||||
import moment from "moment";
|
||||
import { printTicket } from "@/utils/EscPos.js";
|
||||
|
||||
const pupopRef = ref(null);
|
||||
const orderRef = ref(null);
|
||||
|
@ -66,7 +68,7 @@ const cartAddInfo = (item, change = "") => {
|
|||
let q = {
|
||||
goods_id: item.id,
|
||||
is_new: 0,
|
||||
cart_num: item.cart_num
|
||||
cart_num: item.cart_num,
|
||||
};
|
||||
cartCreateApi(q).then((res) => {
|
||||
orderRef.value.getList();
|
||||
|
@ -78,12 +80,12 @@ const changeItem = (item, change) => {
|
|||
pupopRef.value.show(true);
|
||||
};
|
||||
|
||||
|
||||
const editPupop = (item) => {
|
||||
pupopRef.value.setForm(item, "edit");
|
||||
pupopRef.value.show(true);
|
||||
};
|
||||
|
||||
const orderForm = ref({});
|
||||
// 结算
|
||||
const checkOut = () => {
|
||||
let cart_id = orderRef.value.list.map((item) => item.cart_id);
|
||||
|
@ -95,6 +97,7 @@ const checkOut = () => {
|
|||
query.pay_type = "micropay";
|
||||
}
|
||||
orderCheckApi(query).then((res) => {
|
||||
orderForm.value = res.data.order;
|
||||
payRef.value.setForm({
|
||||
data: res.data.order,
|
||||
cart_id: cart_id,
|
||||
|
@ -107,10 +110,62 @@ const goPay = () => {
|
|||
payRef.value.drawer = true;
|
||||
};
|
||||
|
||||
const paySuccess = () => {
|
||||
const paySuccess = (data = null) => {
|
||||
// data = {
|
||||
// out_trade_no: "PF171568087790938356", //单号
|
||||
// create_time: "2024-05-14 17:59:05", //下单时间
|
||||
// trade_type: "MICROPAY", //支付方式
|
||||
// transaction_id: "4200002159202405159003084211", //支付单号
|
||||
// }
|
||||
if(data) onPrint(data);
|
||||
setTimeout(()=>{
|
||||
orderRef.value.getList();
|
||||
})
|
||||
};
|
||||
|
||||
// 打印小票
|
||||
const onPrint = (data)=>{
|
||||
let goods = [];
|
||||
orderRef.value.list.forEach((item) => {
|
||||
goods.push({
|
||||
name: item.goods_name, //商品名称
|
||||
sell: item.sell, //单价
|
||||
nums: item.cart_num, //数量
|
||||
unit_name: item.unit_name, //单位
|
||||
total: item.goods_total_price, //小计
|
||||
});
|
||||
});
|
||||
let obj = {
|
||||
mer_name: userStore.userInfo.merchant.mer_name, //商户名称
|
||||
service_phone: userStore.userInfo.merchant.service_phone, //客服电话
|
||||
number: data.out_trade_no, //单号
|
||||
create_time: data.create_time, //下单时间
|
||||
total_price: orderForm.value.total, //总价
|
||||
pay_price: orderForm.value.total, //实付
|
||||
pay_type: data.trade_type=='MICROPAY' ? '微信支付':'余额支付', //支付方式
|
||||
pay_number: data.transaction_id, //支付单号
|
||||
goods: goods, //商品列表
|
||||
};
|
||||
if (goods.length > 0) {
|
||||
let str = printTicket(obj);
|
||||
console.log(str);
|
||||
uni.getEnv((res) => {
|
||||
if (res.app) {
|
||||
APPprint(content);
|
||||
setTimeout(() => {
|
||||
isPrint = false;
|
||||
}, 4000);
|
||||
}
|
||||
});
|
||||
uni.postMessage({
|
||||
data: {
|
||||
type: "print",
|
||||
content: str,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 键盘事件
|
||||
const aF9 = () => {
|
||||
if (route.name != "saleHome") return;
|
||||
|
|
|
@ -169,8 +169,8 @@ onUnmounted(() => {
|
|||
<div class="info-item-title">支付方式:</div>
|
||||
<div class="info-item-info">
|
||||
<span v-if="formData.pay_type == 9">微信收款</span>
|
||||
<span v-if="formData.pay_type == 1">余额支付</span>
|
||||
<span v-if="formData.pay_type == 3">微信支付</span>
|
||||
<span v-if="formData.pay_type == 3">余额支付</span>
|
||||
<span v-if="formData.pay_type == 1">微信支付</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -43,6 +43,11 @@ const changeDate = () => {
|
|||
getOrderList(true);
|
||||
};
|
||||
|
||||
const disabledDate = (time)=>{
|
||||
return time.getTime() > Date.now();
|
||||
}
|
||||
|
||||
|
||||
const where = ref({
|
||||
page_no: 1,
|
||||
page_size: 20,
|
||||
|
@ -187,8 +192,8 @@ onUnmounted(()=>{
|
|||
<div v-if="item.paid">
|
||||
已支付
|
||||
<span v-if="item.pay_type == 9">(微信收款)</span>
|
||||
<span v-if="item.pay_type == 1">(余额支付)</span>
|
||||
<span v-if="item.pay_type == 3">(微信支付)</span>
|
||||
<span v-if="item.pay_type == 3">(余额支付)</span>
|
||||
<span v-if="item.pay_type == 1">(微信支付)</span>
|
||||
<!-- <span class="manage-btn">待处理</span> -->
|
||||
</div>
|
||||
<div v-else style="color: #ff4a00">未支付</div>
|
||||
|
|
|
@ -23,20 +23,19 @@ const payRef = ref(null);
|
|||
const where = ref({
|
||||
page_no: 1,
|
||||
page_size: 15,
|
||||
staff_id: userStore.userInfo.service.service_id,
|
||||
});
|
||||
|
||||
const loading = ref(false);
|
||||
const total = ref(0);
|
||||
|
||||
const getOrderList = () => {
|
||||
orderPriceApi(userStore.userInfo.service.mer_id, where.value).then((res) => {
|
||||
orderPriceApi(where.value).then((res) => {
|
||||
orderList.value = res.data;
|
||||
// total.value = res.data.count;
|
||||
});
|
||||
};
|
||||
|
||||
getOrderList();
|
||||
// getOrderList();
|
||||
|
||||
const formData = ref({});
|
||||
const getStatistics = () => {
|
||||
|
@ -48,7 +47,7 @@ const getStatistics = () => {
|
|||
loading.value = false;
|
||||
});
|
||||
};
|
||||
getStatistics();
|
||||
// getStatistics();
|
||||
|
||||
const prevClick = (e) => {
|
||||
where.value.page_no = e;
|
||||
|
|
Loading…
Reference in New Issue