This commit is contained in:
zmj 2024-06-13 14:11:37 +08:00
commit a1ab6200e5
5 changed files with 189 additions and 105 deletions

View File

@ -3,8 +3,8 @@ VITE_NOW_TYPE = 'dist'
# VITE_PUSH_URL = 'ws://192.168.1.22:8787'
# VITE_BASE_URL = 'http://192.168.1.22:8545'
# VITE_PUSH_URL ='wss://erp.lihaink.cn/pull'
# VITE_BASE_URL = 'https://test-multi-store.lihaink.cn'
VITE_PUSH_URL ='wss://test-multi-store.lihaink.cn/pull'
VITE_BASE_URL = 'https://test-multi-store.lihaink.cn'
VITE_PUSH_URL ='wss://multi-store.lihaink.cn/pull'
VITE_BASE_URL = 'https://multi-store.lihaink.cn'
# VITE_PUSH_URL ='wss://multi-store.lihaink.cn/pull'
# VITE_BASE_URL = 'https://multi-store.lihaink.cn'

View File

@ -136,6 +136,13 @@ export function cashierinfoDetailsApi(data) {
return request.get(`/store_order/storeOrder/detail`, { params: data })
}
/**
* @description 核销记录
*/
export function cashierinfoWriteoffListApi(data) {
return request.get(`/store_order/storeOrder/writeoff_list`, { params: data })
}
/**
* @description 订单核销
*/

View File

@ -84,7 +84,7 @@ const testObj = {
"remark": "",
"mer_id": 0,
"verify_code": "6-******",
"shipping_type": 2,
"shipping_type": 2, // 1快递, 2自提
"reservation": 0,
"reservation_time": null,
"is_writeoff": 1,
@ -116,7 +116,7 @@ export const printTicket = (obj = {}, test = false) => {
if(!obj || !obj.order_id) obj = testObj;
str += Esc.Size2(2) + Esc.Center() + Esc.boldFontOn() + obj.system_store_name + Esc.Size1() + "\n";
str += Esc.fillLine(" ") + Esc.boldFontOff() + "\n";
str += Esc.Left() + "核销码: " + Esc.boldFontOn() + obj.verify_code + Esc.boldFontOff() + "\n";
if(obj.shipping_type == 2) str += Esc.Left() + "核销码: " + Esc.boldFontOn() + obj.verify_code + Esc.boldFontOff() + "\n";
str += Esc.Left() + "单号: " + obj.order_id + "\n";
str += Esc.Left() + "下单时间: " + obj.create_time + "\n";
@ -128,7 +128,7 @@ export const printTicket = (obj = {}, test = false) => {
str += Esc.Left() + item.store_name + "\n";
let total = +item.price || 0;
total *= +item.cart_num;
str += Esc.inline3(`${item.price || '0.00'}`, `${item.cart_num}${item.unit_name}`, `${total}`, " ", 1) + "\n";
str += Esc.inline3(`${item.price || '0.00'}`, `${item.cart_num}${item.unit_name||''}`, `${total}`, " ", 1) + "\n";
})
str += Esc.fillLine("=") + "\n";
@ -137,7 +137,15 @@ export const printTicket = (obj = {}, test = false) => {
str += Esc.Left() + "实付款: " + obj.pay_price + "元" + "\n";
str += Esc.Left() + "支付方式: " + obj.pay_type_name + "\n";
// str += Esc.Left() + "支付单号: " + obj.order_id + "\n";
str += Esc.Left() + "联系电话: " + obj.system_store_phone + "\n";
str += Esc.Left() + "店铺电话: " + obj.system_store_phone + "\n";
if(obj.shipping_type == 1){ // 快递
str += Esc.fillLine("=") + "\n";
str += Esc.Left() + "收货人: " + obj.real_name + "\n";
str += Esc.Left() + "收货电话: " + obj.user_phone + "\n";
str += Esc.Left() + "收货地址: " + obj.user_address + "\n";
}
str += Esc.fillLine("=") + "\n";
// 票尾

View File

@ -3,6 +3,7 @@ import { ref, watch } from "vue";
import {
saleOrderListApi,
cashierinfoDetailsApi,
cashierinfoWriteoffListApi,
orderStatusApi,
orderLadingApi,
cartListApi,
@ -18,11 +19,21 @@ const list = ref([]);
const payRef = ref(null);
const props = defineProps({
type: {
type: Number,
default: 2
}
})
const where = ref({
verify_code: ''
verify_code: '',
page_no: 1,
page_size: 15
});
const loading = ref(false);
const total = ref(0);
const activeStore = ref(0);
@ -30,36 +41,62 @@ const activeStore = ref(0);
const loadEnd = ref(false);
const orderList = ref([]);
const getOrderList = (reload = false) => {
where.value.verify_code = where.value.verify_code.replace('—','-')
where.value.verify_code = where.value.verify_code.replace(/\uFF0D/,'-')
where.value.verify_code = where.value.verify_code.replace(' ','')
cashierinfoDetailsApi(where.value)
// return console.log('');
if(loading.value) return;
loading.value = true;
if (where.value.verify_code) {
where.value.verify_code = where.value.verify_code.replace('—', '-');
where.value.verify_code = where.value.verify_code.replace(/\uFF0D/, '-');
where.value.verify_code = where.value.verify_code.replace(' ', '');
cashierinfoDetailsApi({
verify_code: where.value.verify_code
})
.then((res) => {
orderList.value = [res.data];
activeStore.value = 0;
mitt.emit("set-sale-order-detail", orderList.value[0]);
total.value = res.data.count;
if(orderList.value[0].is_writeoff) {
loading.value = false;
if (orderList.value[0].is_writeoff) {
ElMessage.warning('订单已核销过')
}
})
.catch((err) => {
loading.value = false;
});
} else {
cashierinfoWriteoffListApi(where.value)
.then((res) => {
orderList.value = res.data.lists;
mitt.emit("set-sale-order-detail", orderList.value[0]);
total.value = res.data.count;
loading.value = false;
})
.catch((err) => {
loading.value = false;
});
}
};
const setForm = (item, index) => {
activeStore.value = index;
mitt.emit("set-order-detail", item);
mitt.emit("set-sale-order-detail", item);
}
const setCode = (code) => {
where.value.verify_code = code;
activeStore.value = 0;
getOrderList(true);
}
const emit = defineEmits(["backOne"]);
const backOne = () => {
mitt.emit("set-sale-order-detail", {});
orderList.value = [];
emit("backOne");
}
@ -71,7 +108,7 @@ defineExpose({
<template>
<div class="my-order">
<div class="header-nav">
<div class="nav-item">核销订单</div>
<div class="nav-item">{{ type == 2 ? '核销订单' : '核销记录' }}</div>
<div class="nav-item-clear">
<el-button type="primary" size="small" @click="backOne">返回上一页</el-button>
</div>
@ -87,8 +124,8 @@ defineExpose({
</template>
</el-input>
</div>
<div class="order-lists" v-loading="loading" :infinite-scroll-distance="300" :infinite-scroll-delay="500"
style="overflow: auto">
<div class="order-lists" v-loading="loading" v-infinite-scroll="getOrderList" :infinite-scroll-distance="300"
:infinite-scroll-delay="500" :infinite-scroll-immediate="false" style="overflow: auto">
<div class="item" :class="{ 'item-active': activeStore == index }" v-for="(item, index) in orderList"
:key="index" @click="setForm(item, index)">
<div class="top">
@ -97,8 +134,8 @@ defineExpose({
</div>
<div class="shop">
<div class="left" v-if="item.product">
<el-image v-for="(shop, imgkey) in item.product.slice(0, 5)" :key="imgkey" :src="shop.cart_info.image"
class="shop-img"></el-image>
<el-image v-for="(shop, imgkey) in item.product.slice(0, 5)" :key="imgkey"
:src="shop.cart_info.image" class="shop-img"></el-image>
<div v-if="item.product.length == 1" class="shop-name">
{{ item.product[0].store_name }}
</div>
@ -112,18 +149,19 @@ defineExpose({
<div class="pay">
<div v-if="item.paid">
{{ item.paid_name }}
<span v-if="item.pay_type == 9">(微信收款)</span>
<span v-if="item.pay_type == 17">(现金支付)</span>
<span v-if="item.pay_type == 13">(支付宝收款)</span>
<span v-if="item.pay_type == 3">(余额支付)</span>
<span v-if="item.pay_type == 1">(微信支付)</span>
<spna v-if="item.pay_type_name">({{ item.pay_type_name }})</spna>
<span v-else-if="item.pay_type == 9">(微信收款)</span>
<span v-else-if="item.pay_type == 17">(现金支付)</span>
<span v-else-if="item.pay_type == 13">(支付宝收款)</span>
<span v-else-if="item.pay_type == 3">(余额支付)</span>
<span v-else-if="item.pay_type == 1">(微信支付)</span>
</div>
<div v-else style="color: #ff4a00">{{ item.paid_name }}</div>
</div>
<!-- <div class="cashier" v-if="item.service_info">
收银员: {{ item.service_info.nickname }}
</div> -->
<div class="cashier" v-if="item.is_writeoff==0">核销码{{ item.verify_code }}</div>
<div class="cashier" v-if="item.is_writeoff == 0">核销码{{ item.verify_code }}</div>
<div class="cashier" v-else style="color: #ff4a00">已核销{{ item.verify_code }}</div>
</div>
</div>
@ -141,6 +179,8 @@ defineExpose({
width: 30rem;
position: relative;
overflow: hidden;
display: flex;
flex-direction: column;
.header-nav {
display: flex;
@ -148,6 +188,10 @@ defineExpose({
padding: 1rem;
height: 1.5rem;
.nav-item {
font-weight: bold;
}
span {
color: #ff4a00;
}
@ -168,7 +212,7 @@ defineExpose({
}
.order-lists {
height: calc(100vh - 100px - 10.2rem);
flex: 1;
overflow-y: auto;
.item {

View File

@ -11,14 +11,21 @@ const inputRef = ref(null);
const orderRef = ref(null);
const handleEnterKey = () => {
if(code.value == "") return ElMessage.error("请输入订单编号");
if (code.value == "") return ElMessage.error("请输入订单编号");
type.value = 2;
nextTick(() => {
orderRef.value.setCode(code.value);
});
};
const reInit = ()=>{
const handleListed = () => {
type.value = 3;
nextTick(() => {
orderRef.value.setCode('');
});
};
const reInit = () => {
handleEnterKey();
}
@ -34,25 +41,23 @@ onMounted(() => {
<div class="my-code" v-show="type == 1">
<h2>订单核销</h2>
<div class="box">
<input
ref="inputRef"
v-model="code"
placeholder=""
class="input"
@keyup.enter="handleEnterKey"
/>
<input ref="inputRef" v-model="code" placeholder="" class="input" @keyup.enter="handleEnterKey" />
<div class="btn" @click="handleEnterKey">查询</div>
</div>
<div class="to-list" @click="handleListed">
<span>查看核销记录</span><el-icon><ArrowRightBold /></el-icon>
</div>
<order v-show="type == 2" style="flex-shrink: 0" ref="orderRef" @backOne="type=1"/>
<padding v-show="type == 2" />
<detail v-show="type == 2" ref="detailRef" @reInit="reInit"/>
</div>
<order v-show="type != 1" :type="type" style="flex-shrink: 0" ref="orderRef" @backOne="type = 1" />
<padding v-show="type != 1" />
<detail v-show="type != 1" ref="detailRef" @reInit="reInit" />
</div>
</template>
<style lang="scss">
.my-card {
display: flex;
.my-code {
height: 70%;
width: 100%;
@ -60,6 +65,7 @@ onMounted(() => {
flex-direction: column;
justify-content: center;
align-items: center;
.box {
width: 38rem;
position: relative;
@ -75,10 +81,12 @@ onMounted(() => {
&:focus {
outline: none;
box-shadow: 0 0 0.31rem #1890ff; /* 可选:添加阴影效果以突出显示聚焦状态 */
box-shadow: 0 0 0.31rem #1890ff;
/* 可选:添加阴影效果以突出显示聚焦状态 */
transition: all 0.2s ease-in-out;
}
}
.btn {
position: absolute;
right: 0;
@ -94,27 +102,44 @@ onMounted(() => {
cursor: pointer;
}
}
.to-list {
width: auto;
color: #1890ff;
font-size: 1.1rem;
margin-top: 3rem;
text-align: center;
display: flex;
align-items: center;
cursor: pointer;
}
}
}
/* 修改滚动条的样式 */
::-webkit-scrollbar {
width: 0.31rem; /* 设置滚动条的宽度 */
width: 0.31rem;
/* 设置滚动条的宽度 */
}
/* 设置滚动条的轨道样式 */
::-webkit-scrollbar-track {
background-color: #f1f1f1; /* 设置轨道的背景色 */
background-color: #f1f1f1;
/* 设置轨道的背景色 */
/* margin: 1.25rem 0; */
}
/* 设置滚动条的滑块样式 */
::-webkit-scrollbar-thumb {
background-color: #ccc; /* 设置滑块的背景色 */
border-radius: 0.31rem; /* 设置滑块的圆角 */
background-color: #ccc;
/* 设置滑块的背景色 */
border-radius: 0.31rem;
/* 设置滑块的圆角 */
}
/* 设置滚动条鼠标悬停时的滑块样式 */
::-webkit-scrollbar-thumb:hover {
background-color: #999; /* 设置鼠标悬停时滑块的背景色 */
background-color: #999;
/* 设置鼠标悬停时滑块的背景色 */
}
</style>