diff --git a/.env.development b/.env.development index f55ba2b..e67f7bf 100644 --- a/.env.development +++ b/.env.development @@ -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' \ No newline at end of file +# VITE_PUSH_URL ='wss://multi-store.lihaink.cn/pull' +# VITE_BASE_URL = 'https://multi-store.lihaink.cn' \ No newline at end of file diff --git a/src/api/store.js b/src/api/store.js index 65bb130..10cefc6 100644 --- a/src/api/store.js +++ b/src/api/store.js @@ -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 订单核销 */ diff --git a/src/utils/EscPos.js b/src/utils/EscPos.js index 35e0772..d461a0f 100644 --- a/src/utils/EscPos.js +++ b/src/utils/EscPos.js @@ -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"; // 票尾 diff --git a/src/views/convert/component/order.vue b/src/views/convert/component/order.vue index b554c7f..d693c60 100644 --- a/src/views/convert/component/order.vue +++ b/src/views/convert/component/order.vue @@ -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) - .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) { - ElMessage.warning('订单已核销过') - } + // 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 }) - .catch((err) => { - }); + .then((res) => { + orderList.value = [res.data]; + activeStore.value = 0; + mitt.emit("set-sale-order-detail", orderList.value[0]); + total.value = res.data.count; + 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({ -
+
@@ -97,8 +134,8 @@ defineExpose({
- +
{{ item.product[0].store_name }}
@@ -112,18 +149,19 @@ defineExpose({
{{ item.paid_name }} - (微信收款) - (现金支付) - (支付宝收款) - (余额支付) - (微信支付) + ({{ item.pay_type_name }}) + (微信收款) + (现金支付) + (支付宝收款) + (余额支付) + (微信支付)
{{ item.paid_name }}
-
核销码:{{ item.verify_code }}
+
核销码:{{ item.verify_code }}
已核销:{{ item.verify_code }}
@@ -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 { diff --git a/src/views/convert/index.vue b/src/views/convert/index.vue index 58cd7ce..9a3b8ed 100644 --- a/src/views/convert/index.vue +++ b/src/views/convert/index.vue @@ -11,110 +11,135 @@ const inputRef = ref(null); const orderRef = ref(null); const handleEnterKey = () => { - if(code.value == "") return ElMessage.error("请输入订单编号"); - type.value = 2; - nextTick(() => { - orderRef.value.setCode(code.value); - }); + if (code.value == "") return ElMessage.error("请输入订单编号"); + type.value = 2; + nextTick(() => { + orderRef.value.setCode(code.value); + }); }; -const reInit = ()=>{ - handleEnterKey(); +const handleListed = () => { + type.value = 3; + nextTick(() => { + orderRef.value.setCode(''); + }); +}; + +const reInit = () => { + handleEnterKey(); } onMounted(() => { - nextTick(() => { - inputRef.value.focus(); - }); + nextTick(() => { + inputRef.value.focus(); + }); });