更新功能
This commit is contained in:
parent
bae4a29888
commit
ba05a6a438
|
@ -29,3 +29,8 @@ export function apiCashierclassDetail(params: any) {
|
|||
export function apiCashierclassAuditing(params: any) {
|
||||
return request.post({ url: '/retail/cashierclass/auditing', params })
|
||||
}
|
||||
|
||||
// 手动打印小票
|
||||
export function apiCashierclassprints(params: any) {
|
||||
return request.get({ url: '/retail/Cashierclass/prints', params })
|
||||
}
|
|
@ -55,3 +55,24 @@ export function apioperationOpurchaseclassAdd() {
|
|||
return request.post({ url: '/operation/opurchaseclass/add' })
|
||||
}
|
||||
|
||||
// 回调打印成功设置
|
||||
export function cashierclassSetPrintAdd(params: any) {
|
||||
return request.get({ url: '/retail/cashierclass/set_print', params })
|
||||
}
|
||||
|
||||
// 入库列表
|
||||
export function opurchaseclassStorageListApi(params: any) {
|
||||
return request.get({ url: '/operation/opurchaseclass/storage_list', params })
|
||||
}
|
||||
|
||||
// 出库列表
|
||||
export function opurchaseclassStreamListApi(params: any) {
|
||||
return request.get({ url: '/operation/opurchaseclass/stream_list', params })
|
||||
}
|
||||
|
||||
// 出库
|
||||
export function opurchaseclassStreamUpdateApi(params: any) {
|
||||
return request.post({ url: '/operation/opurchaseclass/stream_update', params })
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,144 @@
|
|||
<template>
|
||||
<div class="edit-popup">
|
||||
<popup ref="popupRef" :async="true" width="60vw" @close="handleClose" :title="popupTitle" :bottom-btn="false" class="pt-0">
|
||||
<div>
|
||||
<el-button type="primary" class="w-40" @click="output">出库</el-button>
|
||||
<el-button type="warning" @click="onPrint">打印</el-button>
|
||||
</div>
|
||||
<el-descriptions class="mt-4" :column="3" border>
|
||||
<el-descriptions-item label="所属商户">
|
||||
<!-- <material-picker v-model="formData.merchant_info" disabled /> -->
|
||||
{{ formData.merchant_info?.mer_name }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="收货人">
|
||||
{{ formData.real_name }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="单据时间">
|
||||
{{ formData.create_time }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="单据编号">
|
||||
{{ formData.number }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="单据金额">
|
||||
{{ formData.total }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="实际金额">
|
||||
{{ formData.actual }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="实收金额">
|
||||
{{ formData.money }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<div class="mt-4">
|
||||
<el-table :data="pager.lists">
|
||||
<!-- <el-table-column type="selection" width="55" /> -->
|
||||
<el-table-column label="ID" prop="id" show-overflow-tooltip />
|
||||
<!-- <el-table-column label="所属ID" prop="pid" show-overflow-tooltip /> -->
|
||||
<!-- <el-table-column label="仓储" prop="room" show-overflow-tooltip /> -->
|
||||
<el-table-column label="商品" prop="goods_name" show-overflow-tooltip />
|
||||
<!-- <el-table-column label="仓库" prop="warehouse" show-overflow-tooltip /> -->
|
||||
<el-table-column label="串号" prop="cashier_number" show-overflow-tooltip />
|
||||
<el-table-column label="数量" prop="nums" show-overflow-tooltip />
|
||||
<el-table-column label="单价" prop="price" show-overflow-tooltip />
|
||||
<el-table-column label="单位" prop="unit_name" show-overflow-tooltip />
|
||||
<!-- <el-table-column label="折扣" prop="discount" show-overflow-tooltip /> -->
|
||||
<el-table-column label="总价" prop="total" show-overflow-tooltip />
|
||||
<el-table-column label="备注" prop="data" show-overflow-tooltip />
|
||||
<el-table-column label="扩展信息" prop="more" show-overflow-tooltip />
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="flex mt-4 justify-end">
|
||||
<pagination v-model="pager" @change="getLists" />
|
||||
</div>
|
||||
|
||||
</popup>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="brandEdit">
|
||||
import Popup from '@/components/popup/index.vue'
|
||||
import { usePaging } from '@/hooks/usePaging'
|
||||
import { apiCashierinfoLists } from '@/api/cashierinfo'
|
||||
import { apiCashierclassDetail, apiCashierclassprints } from '@/api/cashierclass'
|
||||
import { opurchaseclassStreamUpdateApi } from "@/api/opurchaseclass"
|
||||
const emit = defineEmits(['success', 'close'])
|
||||
const popupRef = shallowRef<InstanceType<typeof Popup>>()
|
||||
const mode = ref('add')
|
||||
const queryParams = reactive({
|
||||
pid: ''
|
||||
})
|
||||
|
||||
// 分页相关
|
||||
const { pager, getLists, resetParams, resetPage } = usePaging({
|
||||
fetchFun: apiCashierinfoLists,
|
||||
params: queryParams
|
||||
})
|
||||
|
||||
// 弹窗标题
|
||||
const popupTitle = computed(() => {
|
||||
return '订单详情'
|
||||
})
|
||||
|
||||
// 表单数据
|
||||
const formData = ref({})
|
||||
|
||||
// 表单验证
|
||||
const formRules = reactive<any>({
|
||||
name: [{
|
||||
required: true,
|
||||
message: '请输入品牌名称',
|
||||
trigger: ['blur']
|
||||
}]
|
||||
})
|
||||
|
||||
|
||||
// 获取详情
|
||||
const setFormData = async (data: Record<any, any>) => {
|
||||
formData.value = data
|
||||
|
||||
}
|
||||
|
||||
const getDetail = (data:any)=>{
|
||||
apiCashierclassDetail({
|
||||
id: data.id
|
||||
}).then(res=>{
|
||||
setFormData(res);
|
||||
})
|
||||
queryParams.pid = data.id
|
||||
getLists()
|
||||
}
|
||||
|
||||
|
||||
|
||||
//打开弹窗
|
||||
const open = (type = 'add') => {
|
||||
mode.value = type
|
||||
popupRef.value?.open()
|
||||
}
|
||||
|
||||
// 关闭回调
|
||||
const handleClose = () => {
|
||||
emit('close')
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
open,
|
||||
setFormData,
|
||||
getDetail
|
||||
})
|
||||
|
||||
// 出库
|
||||
const output = ()=>{
|
||||
opurchaseclassStreamUpdateApi({
|
||||
order_code: formData.value.number
|
||||
}).then(()=>{
|
||||
popupRef.value?.close();
|
||||
})
|
||||
}
|
||||
const onPrint = ()=>{
|
||||
apiCashierclassprints({
|
||||
id: formData.value.id
|
||||
});
|
||||
}
|
||||
</script>
|
|
@ -16,15 +16,15 @@
|
|||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import LayoutMain from './components/main.vue'
|
||||
import LayoutSidebar from './components/sidebar/index.vue'
|
||||
import LayoutHeader from './components/header/index.vue'
|
||||
import LayoutMain from "./components/main.vue";
|
||||
import LayoutSidebar from "./components/sidebar/index.vue";
|
||||
import LayoutHeader from "./components/header/index.vue";
|
||||
import { Push } from "@/common/push.js";
|
||||
import { print } from "@/utils/print";
|
||||
|
||||
const connection = new Push({
|
||||
url: import.meta.env.VITE_PUSH_URL, // websocket地址
|
||||
app_key: '2ce3ce22329517213caa7dad261f5695',
|
||||
app_key: "2ce3ce22329517213caa7dad261f5695",
|
||||
});
|
||||
|
||||
// 浏览器监听user-1
|
||||
|
@ -32,66 +32,65 @@ const user_channel = connection.subscribe(`platform_1`);
|
|||
// const user_channel = connection.subscribe(`store_merchant_${1}`);
|
||||
|
||||
// setTimeout(() => {
|
||||
|
||||
// print(
|
||||
// {
|
||||
// print({
|
||||
// id: 405,
|
||||
// merchant: 501,
|
||||
// real_name: '阿哈',
|
||||
// user_phone: '19330904744',
|
||||
// user_address: '里海三楼',
|
||||
// uid: '9',
|
||||
// number: 'PF171617436315965155',
|
||||
// total: '0.02',
|
||||
// actual: '0.02',
|
||||
// create_time: '2024-05-20 11:06:03',
|
||||
// mer_name: '莲花农贸市场',
|
||||
// mer_phone: '15566669999',
|
||||
// mer_nickname: '小明',
|
||||
// mer_user_mobile: '',
|
||||
// nickname: '用户1532345',
|
||||
// user_moblie: '19330904747',
|
||||
// real_name: "阿哈",
|
||||
// user_phone: "19330904744",
|
||||
// user_address: "里海三楼",
|
||||
// uid: "9",
|
||||
// number: "PF171617436315965155",
|
||||
// total: "0.02",
|
||||
// actual: "0.02",
|
||||
// create_time: "2024-05-20 11:06:03",
|
||||
// mer_name: "莲花农贸市场",
|
||||
// mer_phone: "15566669999",
|
||||
// mer_nickname: "小明",
|
||||
// mer_user_mobile: "",
|
||||
// nickname: "用户1532345",
|
||||
// user_moblie: "19330904747",
|
||||
// info: [
|
||||
// {
|
||||
// goods: 317,
|
||||
// nums: '1.00',
|
||||
// price: '0.02',
|
||||
// total: '0.02',
|
||||
// unit_name: '斤',
|
||||
// goods_name: '西瓜'
|
||||
// nums: "1.00",
|
||||
// price: "0.02",
|
||||
// total: "0.02",
|
||||
// unit_name: "斤",
|
||||
// goods_name: "西瓜",
|
||||
// },
|
||||
// {
|
||||
// goods: 317,
|
||||
// nums: '1.56',
|
||||
// price: '1.98',
|
||||
// total: '3.09',
|
||||
// unit_name: '斤',
|
||||
// goods_name: '苹果'
|
||||
// nums: "1.56",
|
||||
// price: "1.98",
|
||||
// total: "3.09",
|
||||
// unit_name: "斤",
|
||||
// goods_name: "苹果",
|
||||
// },
|
||||
// {
|
||||
// goods: 317,
|
||||
// nums: '2.58',
|
||||
// price: '3.68',
|
||||
// total: '9.49',
|
||||
// unit_name: '斤',
|
||||
// goods_name: '香蕉'
|
||||
// }
|
||||
// ]
|
||||
// }
|
||||
// )
|
||||
// }, 1000)
|
||||
// nums: "2.58",
|
||||
// price: "3.68",
|
||||
// total: "9.49",
|
||||
// unit_name: "斤",
|
||||
// goods_name: "香蕉",
|
||||
// },
|
||||
// ],
|
||||
// });
|
||||
// }, 5000);
|
||||
|
||||
// 当user-2频道有message事件的消息时
|
||||
user_channel.on('message', function (data: any) {
|
||||
user_channel.on("message", function (data: any) {
|
||||
console.log("收到消息--", data);
|
||||
if(data.content?.type=='platform_print'){
|
||||
console.log('收到打印消息');
|
||||
if(typeof data?.content?.data != 'object' || !data?.content?.data?.info?.length) return ElMessage.error('收到订单,但打印数据不合法,请联系管理员');
|
||||
if (data.content?.type == "platform_print") {
|
||||
console.log("收到打印消息");
|
||||
if (
|
||||
typeof data?.content?.data != "object" ||
|
||||
!data?.content?.data?.info?.length
|
||||
)
|
||||
return ElMessage.error("收到订单,但打印数据不合法,请联系管理员");
|
||||
else print(data?.content?.data);
|
||||
}
|
||||
});
|
||||
// 断线事件
|
||||
user_channel.on('close', function () {
|
||||
|
||||
});
|
||||
user_channel.on("close", function () {});
|
||||
</script>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { hiprint, defaultElementTypeProvider } from "vue-plugin-hiprint";
|
||||
import { cashierclassSetPrintAdd } from "@/api/opurchaseclass";
|
||||
|
||||
// 引入后使用示例
|
||||
hiprint.init();
|
||||
|
@ -8,8 +9,10 @@ hiprint.hiwebSocket.setHost("http://localhost:17521");
|
|||
|
||||
// 配置
|
||||
const WIDTH = 58; //纸张宽度 mm
|
||||
const HEIGHT = 155; //纸张高度 mm 使用时需另外计算商品高度
|
||||
const T_WIDTH = 150; //文本宽度 pt
|
||||
const T_LEFT = 4; //文本左边距 pt
|
||||
const textHeight = 10; //文本高度
|
||||
|
||||
export const print = (data: any) => {
|
||||
// hiprint对象获取
|
||||
|
@ -17,18 +20,17 @@ export const print = (data: any) => {
|
|||
console.log(list);
|
||||
|
||||
let nowHeight = 0;
|
||||
let textHeight = 10;
|
||||
|
||||
// 下列方法都是没有拖拽设计页面的, 相当于代码模式, 使用代码设计页面
|
||||
// 想要实现拖拽设计页面,请往下看 '自定义设计'
|
||||
var hiprintTemplate = new hiprint.PrintTemplate();
|
||||
|
||||
// 纸张高度 固定为 130 pt + 商品数量高度
|
||||
let oneHeight = 120 + Math.ceil((data.info.length * 2 * 10) / 2.84);
|
||||
let oneHeight = HEIGHT + Math.ceil((data.info.length * 2 * 10) / 2.84);
|
||||
|
||||
// 模板宽度单位是mm ( 1mm ~= 2.84pt ) 其他的宽高单位是pt
|
||||
var panel = hiprintTemplate.addPrintPanel({
|
||||
width: 58, // 58mm = 164pt
|
||||
width: WIDTH, // 58mm = 164pt
|
||||
height: oneHeight,
|
||||
paperNumberDisabled: true,
|
||||
});
|
||||
|
@ -119,7 +121,9 @@ export const print = (data: any) => {
|
|||
});
|
||||
};
|
||||
|
||||
//文本 *1
|
||||
//文本 *3
|
||||
panel.addPrintText(options("======================"));
|
||||
panel.addPrintText(options(""));
|
||||
panel.addPrintText(
|
||||
options({
|
||||
title: "泸优采-采购单",
|
||||
|
@ -139,7 +143,8 @@ export const print = (data: any) => {
|
|||
lineTitle();
|
||||
data.info.forEach((item: any) => {
|
||||
panel.addPrintText(options(item.goods_name));
|
||||
if(item.nums==Math.floor(+item.nums)) item.nums = Number(item.nums).toFixed(0);
|
||||
if (item.nums == Math.floor(+item.nums))
|
||||
item.nums = Number(item.nums).toFixed(0);
|
||||
lineOptions(
|
||||
`${item.price}元`,
|
||||
`${item.nums}${item.unit_name}`,
|
||||
|
@ -170,6 +175,7 @@ export const print = (data: any) => {
|
|||
},
|
||||
});
|
||||
nowHeight += 60;
|
||||
|
||||
// 文本 *4
|
||||
panel.addPrintText(options("收货人: " + data.real_name));
|
||||
panel.addPrintText(options("收货地址: " + data.user_address));
|
||||
|
@ -190,6 +196,15 @@ export const print = (data: any) => {
|
|||
});
|
||||
nowHeight += 60;
|
||||
|
||||
// 文本 *3
|
||||
panel.addPrintText(options("出库码: "));
|
||||
panel.addPrintText(options(""));
|
||||
panel.addPrintText(options(""));
|
||||
|
||||
// 文本 *4
|
||||
panel.addPrintText({ options: { width: T_WIDTH, height: 35, top: nowHeight, left: T_LEFT, title: data.number, textType: 'barcode',textAlign: "center" } });
|
||||
nowHeight += 40
|
||||
|
||||
// 文本 *4
|
||||
panel.addPrintText(options(""));
|
||||
panel.addPrintText(options(""));
|
||||
|
@ -199,19 +214,22 @@ export const print = (data: any) => {
|
|||
// 合计高度 23 + length * 2
|
||||
|
||||
//打印
|
||||
// hiprintTemplate.print({});
|
||||
hiprintTemplate.print({});
|
||||
//直接打印,需要安装客户端
|
||||
hiprintTemplate.print2({});
|
||||
// hiprintTemplate.print2({});
|
||||
// 直接打印回调
|
||||
// 发送任务到打印机成功
|
||||
hiprintTemplate.on("printSuccess", (e: any) => {
|
||||
console.log("printSuccess", e);
|
||||
ElMessage.success('订单已加入打印队列');
|
||||
ElMessage.success("订单已加入打印队列");
|
||||
cashierclassSetPrintAdd({
|
||||
id: data.id,
|
||||
});
|
||||
});
|
||||
// 发送任务到打印机失败
|
||||
hiprintTemplate.on("printError", (e: any) => {
|
||||
console.log("printError", e);
|
||||
ElMessage.error('打印失败,请检查是否正确连接打印机!');
|
||||
ElMessage.error("打印失败,请检查是否正确连接打印机!");
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -221,16 +239,18 @@ export const testPrint = () => {
|
|||
console.log(list);
|
||||
|
||||
let nowHeight = 0;
|
||||
let textHeight = 10;
|
||||
|
||||
// 下列方法都是没有拖拽设计页面的, 相当于代码模式, 使用代码设计页面
|
||||
// 想要实现拖拽设计页面,请往下看 '自定义设计'
|
||||
var hiprintTemplate = new hiprint.PrintTemplate();
|
||||
|
||||
// 纸张高度 固定为 130 pt + 商品数量高度
|
||||
let oneHeight = HEIGHT + Math.ceil((9 * 2 * 10) / 2.84);
|
||||
|
||||
// 模板宽度单位是mm ( 1mm ~= 2.84pt ) 其他的宽高单位是pt
|
||||
var panel = hiprintTemplate.addPrintPanel({
|
||||
width: 58, // 58mm = 164pt
|
||||
height: 145,
|
||||
width: WIDTH, // 58mm = 164pt
|
||||
height: oneHeight,
|
||||
paperNumberDisabled: true,
|
||||
});
|
||||
|
||||
|
@ -320,14 +340,19 @@ export const testPrint = () => {
|
|||
});
|
||||
};
|
||||
|
||||
//文本 *1
|
||||
|
||||
//文本 *3
|
||||
panel.addPrintText(options("======================"));
|
||||
panel.addPrintText(options(""));
|
||||
panel.addPrintText(
|
||||
options({
|
||||
title: "泸优采-小票0",
|
||||
title: "泸优采-小票测试",
|
||||
textAlign: "center",
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
|
||||
//文本 *6
|
||||
panel.addPrintText(options("单号: PF171617436315965155"));
|
||||
panel.addPrintText(options("配送时间: 2024-05-20 11:06:03"));
|
||||
|
@ -344,8 +369,20 @@ export const testPrint = () => {
|
|||
lineOptions("0.01元", "25个", "0.25元");
|
||||
panel.addPrintText(options("朝天椒, 辣椒"));
|
||||
lineOptions("0.01元", "25个", "0.25元");
|
||||
panel.addPrintText(options("朝天椒, 辣椒"));
|
||||
lineOptions("0.01元", "25个", "0.25元");
|
||||
panel.addPrintText(options("朝天椒, 辣椒"));
|
||||
lineOptions("0.01元", "25个", "0.25元");
|
||||
panel.addPrintText(options("朝天椒, 辣椒"));
|
||||
lineOptions("0.01元", "25个", "0.25元");
|
||||
panel.addPrintText(options("朝天椒, 辣椒"));
|
||||
lineOptions("0.01元", "25个", "0.25元");
|
||||
panel.addPrintText(options("朝天椒, 辣椒"));
|
||||
lineOptions("0.01元", "25个", "0.25元");
|
||||
panel.addPrintText(options("朝天椒, 辣椒"));
|
||||
lineOptions("0.01元", "25个", "0.25元");
|
||||
|
||||
//文本 *13
|
||||
//文本 *5
|
||||
panel.addPrintText(options("======================"));
|
||||
panel.addPrintText(options("合计: 0.75元"));
|
||||
|
||||
|
@ -356,22 +393,8 @@ export const testPrint = () => {
|
|||
// https://lihai001.oss-cn-chengdu.aliyuncs.com/def/54705202405221504133485.png //有字
|
||||
// panel.addPrintRect({ options: { width: T_WIDTH, height:30,top: nowHeight + 15, left: T_LEFT,borderColor:'',borderWidth:0.75 } });
|
||||
// nowHeight+=40;
|
||||
panel.addPrintImage({
|
||||
options: {
|
||||
width: T_WIDTH,
|
||||
height: 50,
|
||||
top: nowHeight + 15,
|
||||
left: T_LEFT,
|
||||
title: "",
|
||||
src: "https://lihai001.oss-cn-chengdu.aliyuncs.com/def/db264202405221455038529.png",
|
||||
},
|
||||
});
|
||||
nowHeight += 60;
|
||||
panel.addPrintText(options("收货人: 阿哈"));
|
||||
panel.addPrintText(options("收货地址: 里海科技"));
|
||||
panel.addPrintText(options("联系电话: 17685151643"));
|
||||
panel.addPrintText(options("收货人签字:"));
|
||||
// panel.addPrintRect({ options: { width: T_WIDTH, height:30,top: nowHeight+15, left: T_LEFT,borderColor:'',borderWidth:0.75 } });
|
||||
|
||||
// 文本 *6
|
||||
panel.addPrintImage({
|
||||
options: {
|
||||
width: T_WIDTH,
|
||||
|
@ -384,7 +407,37 @@ export const testPrint = () => {
|
|||
});
|
||||
nowHeight += 60;
|
||||
|
||||
// 文本 *4
|
||||
panel.addPrintText(options("收货人: 阿哈"));
|
||||
panel.addPrintText(options("收货地址: 里海科技"));
|
||||
panel.addPrintText(options("联系电话: 17685151643"));
|
||||
panel.addPrintText(options("收货人签字:"));
|
||||
// panel.addPrintRect({ options: { width: T_WIDTH, height:30,top: nowHeight+15, left: T_LEFT,borderColor:'',borderWidth:0.75 } });
|
||||
|
||||
// 文本 *6
|
||||
panel.addPrintImage({
|
||||
options: {
|
||||
width: T_WIDTH,
|
||||
height: 50,
|
||||
top: nowHeight + 15,
|
||||
left: T_LEFT,
|
||||
title: "",
|
||||
src: "https://lihai001.oss-cn-chengdu.aliyuncs.com/def/db264202405221455038529.png",
|
||||
},
|
||||
});
|
||||
nowHeight += 60;
|
||||
|
||||
panel.addPrintText(options("出库码: "));
|
||||
|
||||
// 文本 *4
|
||||
panel.addPrintText({ options: { width: T_WIDTH, height: 35, top: nowHeight, left: T_LEFT, title: '65155', textType: 'barcode',textAlign: "center" } });
|
||||
nowHeight += 40
|
||||
|
||||
// 文本 *1
|
||||
panel.addPrintText(options(""));
|
||||
|
||||
|
||||
// 文本 *3
|
||||
panel.addPrintText(options(""));
|
||||
panel.addPrintText(options(""));
|
||||
panel.addPrintText(options("======================"));
|
||||
|
@ -392,19 +445,19 @@ export const testPrint = () => {
|
|||
// 合计高度 23 + length * 2
|
||||
|
||||
//打印
|
||||
// hiprintTemplate.print({});
|
||||
hiprintTemplate.print({});
|
||||
//直接打印,需要安装客户端
|
||||
hiprintTemplate.print2({});
|
||||
// hiprintTemplate.print2({});
|
||||
// 直接打印回调
|
||||
// 发送任务到打印机成功
|
||||
hiprintTemplate.on("printSuccess", (e: any) => {
|
||||
console.log("printSuccess", e);
|
||||
ElMessage.success('订单已加入打印队列');
|
||||
ElMessage.success("订单已加入打印队列");
|
||||
});
|
||||
// 发送任务到打印机失败
|
||||
hiprintTemplate.on("printError", (e: any) => {
|
||||
console.log("printError", e);
|
||||
ElMessage.error('打印失败,请检查是否正确连接打印机!');
|
||||
ElMessage.error("打印失败,请检查是否正确连接打印机!");
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -33,13 +33,13 @@
|
|||
<el-table-column prop="unit_name" label="单位" />
|
||||
<el-table-column prop="nums" label="数量" />
|
||||
<el-table-column prop="total" label="合计(元)" />
|
||||
<el-table-column prop="nums_count" label="已采纳数量" />
|
||||
<!-- <el-table-column prop="nums_count" label="已采纳数量" />
|
||||
<el-table-column prop="is_push" label="推送状态">
|
||||
<template #default="{ row }">
|
||||
<span v-if="row.is_push == 0" style="color: #e6a23c;">未推送</span>
|
||||
<span v-else>已推送</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table-column> -->
|
||||
</el-table>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="摊贩订单" name="order">
|
||||
|
|
|
@ -50,11 +50,12 @@
|
|||
v-perms="['operation.opurchaseclass/add']"
|
||||
type="success"
|
||||
@click="onPrintOrder()"
|
||||
v-if="isShowPrint"
|
||||
>
|
||||
<template #icon>
|
||||
<icon name="el-icon-Printer" />
|
||||
</template>
|
||||
打印
|
||||
打印测试
|
||||
</el-button>
|
||||
<div class="mt-4">
|
||||
<el-table :data="pager.lists" @selection-change="handleSelectionChange">
|
||||
|
@ -101,7 +102,11 @@
|
|||
prop="money"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column label="是否已采购" prop="is_opurchase" show-overflow-tooltip>
|
||||
<el-table-column
|
||||
label="是否已采购"
|
||||
prop="is_opurchase"
|
||||
show-overflow-tooltip
|
||||
>
|
||||
<template #default="{ row }">
|
||||
<span v-if="row.is_opurchase" style="color: #67c23a">已采购</span>
|
||||
<span v-else style="color: #f56c6c">未采购</span>
|
||||
|
@ -165,17 +170,65 @@ import {
|
|||
import { timeFormat } from "@/utils/util";
|
||||
import feedback from "@/utils/feedback";
|
||||
import EditPopup from "./edit.vue";
|
||||
import { useRouter } from "vue-router";
|
||||
import { useRouter, useRoute } from "vue-router";
|
||||
import { print, testPrint } from "@/utils/print";
|
||||
|
||||
// 下列方法都是没有拖拽设计页面的, 相当于代码模式, 使用代码设计页面
|
||||
const onPrintOrder = (row: any) => {
|
||||
if(!row) testPrint({
|
||||
name: 'test'
|
||||
})
|
||||
if (!row) {
|
||||
// return testPrint();
|
||||
print({
|
||||
id: 405,
|
||||
merchant: 501,
|
||||
real_name: "阿哈",
|
||||
user_phone: "19330904744",
|
||||
user_address: "里海三楼",
|
||||
uid: "9",
|
||||
number: "PF171617436315965155",
|
||||
total: "0.02",
|
||||
actual: "0.02",
|
||||
create_time: "2024-05-20 11:06:03",
|
||||
mer_name: "莲花农贸市场",
|
||||
mer_phone: "15566669999",
|
||||
mer_nickname: "小明",
|
||||
mer_user_mobile: "",
|
||||
nickname: "用户1532345",
|
||||
user_moblie: "19330904747",
|
||||
info: [
|
||||
{
|
||||
goods: 317,
|
||||
nums: "1.00",
|
||||
price: "0.02",
|
||||
total: "0.02",
|
||||
unit_name: "斤",
|
||||
goods_name: "西瓜",
|
||||
},
|
||||
{
|
||||
goods: 317,
|
||||
nums: "1.56",
|
||||
price: "1.98",
|
||||
total: "3.09",
|
||||
unit_name: "斤",
|
||||
goods_name: "苹果",
|
||||
},
|
||||
{
|
||||
goods: 317,
|
||||
nums: "2.58",
|
||||
price: "3.68",
|
||||
total: "9.49",
|
||||
unit_name: "斤",
|
||||
goods_name: "香蕉",
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
|
||||
const isShowPrint = ref(route.query?.print || false);
|
||||
console.log(isShowPrint.value);
|
||||
|
||||
const editRef = shallowRef<InstanceType<typeof EditPopup>>();
|
||||
// 是否显示编辑框
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<template>
|
||||
<div>
|
||||
<el-card>
|
||||
<div class="flex">
|
||||
<el-button size="large" type="primary" class="mr-4 w-40">出库</el-button>
|
||||
<el-input size="large" placeholder="请输入单号或扫描采购单条形码, 回车出库"></el-input>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="outStorage">
|
||||
import { usePaging } from "@/hooks/usePaging";
|
||||
import { opurchaseclassStreamListApi } from "@/api/opurchaseclass"
|
||||
|
||||
</script>
|
|
@ -45,14 +45,15 @@
|
|||
<el-table :data="pager.lists">
|
||||
<!-- <el-table-column type="selection" width="55" /> -->
|
||||
<el-table-column label="ID" prop="id" show-overflow-tooltip />
|
||||
<el-table-column label="所属ID" prop="pid" show-overflow-tooltip />
|
||||
<el-table-column label="仓储" prop="room" show-overflow-tooltip />
|
||||
<!-- <el-table-column label="所属ID" prop="pid" show-overflow-tooltip /> -->
|
||||
<!-- <el-table-column label="仓储" prop="room" show-overflow-tooltip /> -->
|
||||
<el-table-column label="商品" prop="goods_name" show-overflow-tooltip />
|
||||
<el-table-column label="仓库" prop="warehouse" show-overflow-tooltip />
|
||||
<!-- <el-table-column label="仓库" prop="warehouse" show-overflow-tooltip /> -->
|
||||
<el-table-column label="串号" prop="cashier_number" show-overflow-tooltip />
|
||||
<el-table-column label="数量" prop="nums" show-overflow-tooltip />
|
||||
<el-table-column label="单价" prop="price" show-overflow-tooltip />
|
||||
<el-table-column label="折扣" prop="discount" show-overflow-tooltip />
|
||||
<el-table-column label="单位" prop="unit_name" show-overflow-tooltip />
|
||||
<!-- <el-table-column label="折扣" prop="discount" show-overflow-tooltip /> -->
|
||||
<el-table-column label="总价" prop="total" show-overflow-tooltip />
|
||||
<el-table-column label="备注" prop="data" show-overflow-tooltip />
|
||||
<el-table-column label="扩展信息" prop="more" show-overflow-tooltip />
|
||||
|
|
|
@ -2,13 +2,15 @@
|
|||
<div>
|
||||
<div>
|
||||
<el-radio-group
|
||||
v-model="queryParams.is_adopt"
|
||||
v-model="isAdopt"
|
||||
size="small"
|
||||
@change="changeType"
|
||||
>
|
||||
<el-radio-button label="全部" value="" />
|
||||
<el-radio-button label="未采纳" value="0" />
|
||||
<el-radio-button label="已采纳" value="1" />
|
||||
<el-radio-button label="未报价" value="0" />
|
||||
<el-radio-button label="已报价" value="1" />
|
||||
<el-radio-button label="未采纳" value="3" />
|
||||
<el-radio-button label="已采纳" value="2" />
|
||||
</el-radio-group>
|
||||
</div>
|
||||
<el-table :data="pager.lists" border style="width: 100%; margin-top: 10px">
|
||||
|
@ -102,7 +104,7 @@
|
|||
{{ updateInfo.q_nums }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="实际入库数量">
|
||||
<el-input-number v-model="updateInfo.nums" :step="1" :min="1" />
|
||||
<el-input-number v-model="updateInfo.nums" :step="1" :min="1" :max="updateInfo.q_nums"/>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="备注">
|
||||
<el-input v-model="updateInfo.notes" type="textarea" placeholder="请输入备注"></el-input>
|
||||
|
@ -130,6 +132,7 @@ import { useRoute } from "vue-router";
|
|||
|
||||
const route = useRoute();
|
||||
|
||||
const isAdopt = ref("全部");
|
||||
const queryParams = reactive({
|
||||
id: route.query.id,
|
||||
is_adopt: "",
|
||||
|
@ -146,7 +149,12 @@ defineExpose({
|
|||
});
|
||||
|
||||
const changeType = (e: any) => {
|
||||
queryParams.is_adopt = e;
|
||||
queryParams.is_adopt = isAdopt.value;
|
||||
if(isAdopt.value == '全部') queryParams.is_adopt = '';
|
||||
if(isAdopt.value == '待报价') queryParams.is_adopt = '0';
|
||||
if(isAdopt.value == '已报价') queryParams.is_adopt = '1';
|
||||
if(isAdopt.value == '已采纳') queryParams.is_adopt = '2';
|
||||
if(isAdopt.value == '未采纳') queryParams.is_adopt = '3';
|
||||
getLists();
|
||||
};
|
||||
|
||||
|
@ -170,7 +178,7 @@ const offerGood = (row: any, type: number) => {
|
|||
row
|
||||
);
|
||||
if(type==0) return goodsOfferUpdate(); // 采纳时直接成功, 入库弹窗显示数量
|
||||
updateInfo.value.q_nums = row.nums;
|
||||
updateInfo.value.q_nums = row.need_num;
|
||||
dialogVisible.value = true;
|
||||
};
|
||||
|
||||
|
|
|
@ -0,0 +1,87 @@
|
|||
<template>
|
||||
<div>
|
||||
<el-table :data="pager.lists" border style="width: 100%; margin-top: 10px">
|
||||
<el-table-column prop="id" label="ID" width="120" />
|
||||
<el-table-column label="单据编号" prop="number" show-overflow-tooltip />
|
||||
<el-table-column label="单据金额" prop="total" show-overflow-tooltip />
|
||||
<el-table-column
|
||||
label="单据时间"
|
||||
prop="create_time"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column label="是否出库" prop="is_stream">
|
||||
<template #default="{ row }">
|
||||
<el-tag
|
||||
:type="row.is_stream == 1 ? 'success' : 'info'"
|
||||
disable-transitions
|
||||
>
|
||||
{{ row.is_stream == 1 ? "已出库" : "待出库" }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="操作人员"
|
||||
prop="stream_admin_name"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
label="出库时间"
|
||||
prop="stream_time"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column label="操作" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
type="primary"
|
||||
v-if="row.is_stream"
|
||||
link
|
||||
@click="handleDetail(row)"
|
||||
>详情</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="flex mt-4 justify-end">
|
||||
<pagination v-if="pager.lists" v-model="pager" @change="getLists" />
|
||||
</div>
|
||||
<subOrderDetail ref="subOrderRef" @close="subOrderClose()"></subOrderDetail>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="subOrder">
|
||||
import { usePaging } from "@/hooks/usePaging";
|
||||
import { opurchaseclassStreamListApi } from "@/api/opurchaseclass";
|
||||
import { useRoute } from "vue-router";
|
||||
|
||||
const route = useRoute();
|
||||
|
||||
const queryParams = reactive({
|
||||
id: route.query.id,
|
||||
});
|
||||
// 分页相关
|
||||
const { pager, getLists, resetParams, resetPage } = usePaging({
|
||||
fetchFun: opurchaseclassStreamListApi,
|
||||
params: queryParams,
|
||||
});
|
||||
defineExpose({
|
||||
getLists,
|
||||
});
|
||||
|
||||
const subOrderRef = ref(null);
|
||||
const showDetail = ref(false);
|
||||
|
||||
const handleDetail = async (data: any) => {
|
||||
showDetail.value = true;
|
||||
await nextTick();
|
||||
subOrderRef.value?.open("edit");
|
||||
subOrderRef.value?.getDetail(data);
|
||||
};
|
||||
|
||||
const subOrderClose = ()=>{
|
||||
showDetail.value = false;
|
||||
nextTick(()=>{
|
||||
getLists();
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
|
@ -0,0 +1,171 @@
|
|||
<template>
|
||||
<div>
|
||||
<el-table :data="pager.lists" border style="width: 100%; margin-top: 10px">
|
||||
<el-table-column prop="id" label="ID" width="120" />
|
||||
<!-- <el-table-column prop="order_id" label="采购订单id" width="120" /> -->
|
||||
<el-table-column
|
||||
label="商品名称"
|
||||
prop="goods_name"
|
||||
show-overflow-tooltip
|
||||
width="220"
|
||||
/>
|
||||
<el-table-column
|
||||
label="单位"
|
||||
prop="unit_name"
|
||||
width="80"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
label="供应商"
|
||||
prop="supplier_name"
|
||||
show-overflow-tooltip
|
||||
width="160"
|
||||
/>
|
||||
<el-table-column
|
||||
label="入库数量"
|
||||
prop="nums"
|
||||
show-overflow-tooltip
|
||||
width="100"
|
||||
/>
|
||||
<el-table-column label="报价" prop="price" show-overflow-tooltip />
|
||||
<el-table-column label="状态" prop="is_storage" show-overflow-tooltip >
|
||||
<template #default="{ row }" >
|
||||
<el-tag v-if="row.is_storage" type="success">已入库</el-tag>
|
||||
<el-tag v-else type="info">未入库</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" prop="notes" show-overflow-tooltip />
|
||||
<el-table-column
|
||||
label="入库时间"
|
||||
prop="update_time"
|
||||
show-overflow-tooltip
|
||||
width="160"
|
||||
/>
|
||||
<el-table-column v-if="false" label="操作" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button
|
||||
type="primary"
|
||||
v-if="row.is_adopt === 1 && row.price > 0"
|
||||
size="small"
|
||||
@click="offerGood(row, 0)"
|
||||
>采纳</el-button
|
||||
>
|
||||
<span v-if="row.is_storage">已入库</span>
|
||||
<el-button
|
||||
type="success"
|
||||
v-else-if="row.is_adopt === 2 && row.price > 0"
|
||||
size="small"
|
||||
@click="offerGood(row, 1)"
|
||||
>入库</el-button
|
||||
>
|
||||
<span
|
||||
v-if="row.is_adopt === 0 && row.price == 0"
|
||||
style="color: #e6a23c"
|
||||
>等待供应商报价</span
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="flex mt-4 justify-end">
|
||||
<pagination v-if="pager.lists" v-model="pager" @change="getLists" />
|
||||
</div>
|
||||
<el-dialog v-model="dialogVisible" title="入库" width="600">
|
||||
<el-descriptions class="margin-top" :column="1" border>
|
||||
<el-descriptions-item label="供应商名称">
|
||||
{{ updateInfo.supplier_name }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="商品名称">
|
||||
{{ updateInfo.goods_name }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="商品报价">
|
||||
¥ {{ updateInfo.price }} / {{ updateInfo.unit_name }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="应入库数量">
|
||||
{{ updateInfo.q_nums }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="实际入库数量">
|
||||
<el-input-number v-model="updateInfo.nums" :step="1" :min="1" />
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="备注">
|
||||
<el-input
|
||||
v-model="updateInfo.notes"
|
||||
type="textarea"
|
||||
placeholder="请输入备注"
|
||||
></el-input>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="goodsOfferUpdate"> 确认 </el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="subOrder">
|
||||
import { usePaging } from "@/hooks/usePaging";
|
||||
import {
|
||||
opurchaseclassStorageListApi,
|
||||
apiOpurchaseclassGoodsOfferUpdate,
|
||||
} from "@/api/opurchaseclass";
|
||||
import { useRoute } from "vue-router";
|
||||
|
||||
const route = useRoute();
|
||||
|
||||
const isAdopt = ref("");
|
||||
const queryParams = reactive({
|
||||
order_id: route.query.id,
|
||||
is_storage: 1
|
||||
});
|
||||
// 分页相关
|
||||
const { pager, getLists, resetParams, resetPage } = usePaging({
|
||||
fetchFun: opurchaseclassStorageListApi,
|
||||
params: queryParams,
|
||||
});
|
||||
defineExpose({
|
||||
getLists,
|
||||
});
|
||||
|
||||
const changeType = (e: any) => {
|
||||
queryParams.is_adopt = isAdopt.value;
|
||||
getLists();
|
||||
};
|
||||
|
||||
const dialogVisible = ref(false);
|
||||
const updateInfo = ref({
|
||||
id: "",
|
||||
type: 0,
|
||||
notes: "", //备注
|
||||
nums: 0, //实际数量
|
||||
q_nums: 0, //应到数量
|
||||
});
|
||||
const offerGood = (row: any, type: number) => {
|
||||
//type:0 采纳,1 入库
|
||||
updateInfo.value = Object.assign(
|
||||
{
|
||||
id: "",
|
||||
type: type,
|
||||
notes: "", //备注
|
||||
nums: 0,
|
||||
},
|
||||
row
|
||||
);
|
||||
if (type == 0) return goodsOfferUpdate(); // 采纳时直接成功, 入库弹窗显示数量
|
||||
updateInfo.value.q_nums = row.nums;
|
||||
dialogVisible.value = true;
|
||||
};
|
||||
|
||||
const goodsOfferUpdate = () => {
|
||||
apiOpurchaseclassGoodsOfferUpdate({
|
||||
id: updateInfo.value.id,
|
||||
type: updateInfo.value.type,
|
||||
notes: updateInfo.value.notes, //备注
|
||||
nums: updateInfo.value.nums,
|
||||
}).then((res) => {
|
||||
getLists();
|
||||
dialogVisible.value = false;
|
||||
});
|
||||
};
|
||||
</script>
|
|
@ -37,7 +37,15 @@
|
|||
<el-table-column prop="nums_count" label="已采纳数量" />
|
||||
<el-table-column prop="is_push" label="推送状态">
|
||||
<template #default="{ row }">
|
||||
<span v-if="row.is_push == 0" style="color: #e6a23c;cursor: pointer;" @click="activeName='notPushedGoods';tabChange('notPushedGoods')">未推送</span>
|
||||
<span
|
||||
v-if="row.is_push == 0"
|
||||
style="color: #e6a23c; cursor: pointer"
|
||||
@click="
|
||||
activeName = 'notPushedGoods';
|
||||
tabChange('notPushedGoods');
|
||||
"
|
||||
>未推送</span
|
||||
>
|
||||
<span v-else>已推送</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
@ -52,6 +60,12 @@
|
|||
<el-tab-pane label="未推送商品" name="notPushedGoods">
|
||||
<noPush ref="noPushRef" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="入库记录" name="putStorage">
|
||||
<putStorage ref="putStorageRef" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="出库记录" name="outStorage">
|
||||
<outStorage ref="outStorageRef" />
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-card>
|
||||
</div>
|
||||
|
@ -64,25 +78,20 @@ import {
|
|||
apiOpurchaseclassLists,
|
||||
apiOpurchaseclassDelete,
|
||||
apiOpurchaseclassDetail,
|
||||
apiOpurchaseinfoListList
|
||||
apiOpurchaseinfoListList,
|
||||
} from "@/api/opurchaseclass";
|
||||
import { useRoute } from "vue-router";
|
||||
import subOrder from "./component/subOrder.vue";
|
||||
import goodsOffer from "./component/goodsOffer.vue";
|
||||
import noPush from "./component/noPush.vue";
|
||||
import putStorage from "./component/putStorage.vue";
|
||||
import outStorage from "./component/outStorage.vue";
|
||||
|
||||
const route = useRoute();
|
||||
const form = ref({});
|
||||
|
||||
const activeName = ref("detail");
|
||||
const activeMap = ref(
|
||||
new Map([
|
||||
["detail", true],
|
||||
["order", false],
|
||||
["offer", false],
|
||||
["notPushedGoods", false],
|
||||
])
|
||||
);
|
||||
|
||||
const getDetail = async () => {
|
||||
const data = await apiOpurchaseclassDetail({
|
||||
id: route.query.id,
|
||||
|
@ -94,24 +103,25 @@ getDetail();
|
|||
const subOrderRef = ref(null);
|
||||
const goodsOfferRef = ref(null);
|
||||
const noPushRef = ref(null);
|
||||
const putStorageRef = ref(null);
|
||||
const outStorageRef = ref(null);
|
||||
const tabChange = (type: any) => {
|
||||
if (!activeMap.value.get(type)) {
|
||||
activeMap.value.set(type, true);
|
||||
if (type == "order") subOrderRef.value?.getLists();
|
||||
if (type == "offer") goodsOfferRef.value?.getLists();
|
||||
if (type == "notPushedGoods") noPushRef.value?.getLists();
|
||||
}
|
||||
if (type == "putStorage") putStorageRef.value?.getLists();
|
||||
if (type == "outStorage") outStorageRef.value?.getLists();
|
||||
};
|
||||
|
||||
// 查询条件
|
||||
const queryParams = reactive({
|
||||
id: route.query.id,
|
||||
})
|
||||
});
|
||||
|
||||
// 分页相关
|
||||
const { pager, getLists, resetParams, resetPage } = usePaging({
|
||||
fetchFun: apiOpurchaseinfoListList,
|
||||
params: queryParams
|
||||
})
|
||||
getLists()
|
||||
params: queryParams,
|
||||
});
|
||||
getLists();
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue