打印细码成功 1.0.9版本

This commit is contained in:
2025-04-15 12:29:44 +08:00
parent e4114251fb
commit 9116015e19
6 changed files with 323 additions and 154 deletions

View File

@@ -0,0 +1,88 @@
.list-header {
font-size: 18px;
font-weight: bold;
padding: 10px;
background-color: #f0f0f0;
}
.order-item {
/* 卡片边框颜色 */
border: 1px solid #161515;
padding: 10px;
margin: 10px;
cursor: pointer;
border-radius: 5px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
background-color: #ffffff;
}
.order-title {
font-size: 16px;
font-weight: bold;
color: #dbe45a;
}
.order-brief {
font-size: 14px;
color: #666;
}
.order-extra {
font-size: 14px;
color: #666;
float: right;
}
.order-details {
font-size: 14px;
margin-top: 5px;
color: #444444;
}
.order-line-item {
border: 1px solid #eee;
padding: 5px;
margin-top: 5px;
border-radius: 3px;
/* 销售订单行背景色 */
background-color: #f9f9f9;
}
.pagination {
display: flex;
justify-content: center;
align-items: center;
margin-top: 20px;
}
.pagination-button {
padding: 8px 16px;
margin: 0 10px;
border: none;
border-radius: 5px;
background-color: #007aff;
color: #ffffff;
cursor: pointer;
transition: background-color 0.3s ease;
}
.pagination-button:hover {
background-color: #0056b3;
}
.disabled-button {
background-color: #cccccc;
cursor: not-allowed;
}
.pagination-text {
font-size: 14px;
color: #333333;
margin: 0 10px;
}
.image {
width: 50px;
height: 50px;
}

View File

@@ -1,3 +1,9 @@
<view>
<bluetooth-component printdata="{{printdata}}"/>
<bluetooth-component printdata="{{printdata}}" />
<view a:for="{{fineCode3Names}}" a:key="*this" class="order-item" data-info="{{item.fineCode}}">
<image class="image" src="../../../../../../../static/images/胜佳纺织.png" />
<view class="order-details">
name:{{item.name || '无货号'}}. color: {{item.color_id_2 || '无色号'}} . code: {{item.fineCode || '无细码'}}
</view>
</view>
</view>

View File

@@ -1,22 +1,35 @@
Page({
data: {
printdata: {},
// printFormat: 'TSPL',
// maxAllowedLength: 1024,
// delayTime: 5000, // 默认延迟 5 秒,单位:毫秒
// paperSize: {
// width: 80, // 默认宽度 80mm
// height: 60 // 默认高度 60mm
// },
// index: 0 //指令集默认选择
printdata: {},
selectedItems: [],
fineCode3Names: []
},
onLoad() {
const selectedSaleOrderLines = dd.getStorageSync({
key: 'selectedSaleOrderLines'
}).data;
const printdata = selectedSaleOrderLines || {};
this.setData({
printdata
});
},
});
const selectedSaleOrderLines = dd.getStorageSync({
key: 'selectedSaleOrderLines'
}).data;
const printdata = selectedSaleOrderLines || {};
const selectedItems = printdata.selectedItems || [];
const fineCode3Names = [];
selectedItems.forEach(item => {
if (item.fineCode3Names) {
item.fineCode3Names.forEach(fineCode => {
fineCode3Names.push({
name: item.name || '无货号',
color_id_2: item.color_id_2[1] || '无色号',
fineCode
});
});
}
});
this.setData({
printdata,
selectedItems,
fineCode3Names
});
console.log('selectedItems', selectedItems);
console.log('fineCode3Names', fineCode3Names);
}
});