初始上传
This commit is contained in:
312
addon/cashier/source/os/pages/goods/public/css/goods_list.scss
Executable file
312
addon/cashier/source/os/pages/goods/public/css/goods_list.scss
Executable file
@@ -0,0 +1,312 @@
|
||||
view {
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
/deep/ .uni-scroll-view::-webkit-scrollbar {
|
||||
width: 0.05rem;
|
||||
height: 0.3rem;
|
||||
}
|
||||
|
||||
/deep/ .uni-scroll-view::-webkit-scrollbar-thumb {
|
||||
border-radius: 0.1rem;
|
||||
box-shadow: inset 0 0 0.05rem rgba(0, 0, 0, 0.2);
|
||||
background: rgba(193, 193, 193, 1);
|
||||
}
|
||||
|
||||
.cart-empty {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
width: 2.1rem;
|
||||
}
|
||||
|
||||
.record-body {
|
||||
width: 10rem;
|
||||
min-height: 7rem;
|
||||
}
|
||||
|
||||
// 筛选面板
|
||||
.screen-warp {
|
||||
padding: 0.15rem 0.15rem 0;
|
||||
background-color: #f2f3f5;
|
||||
margin-bottom: 0.15rem;
|
||||
|
||||
.common-form-item .form-label {
|
||||
width: 1.2rem;
|
||||
}
|
||||
|
||||
.common-btn-wrap {
|
||||
margin-left: 1.2rem;
|
||||
button{
|
||||
margin-right: .1rem;
|
||||
}
|
||||
}
|
||||
|
||||
.goods-category .form-input-inline {
|
||||
width: 2.8rem;
|
||||
}
|
||||
|
||||
.form-inline {
|
||||
margin-bottom: 0.15rem;
|
||||
}
|
||||
|
||||
.common-form-item {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.input-append {
|
||||
position: relative;
|
||||
|
||||
.form-input {
|
||||
padding-right: 0.3rem;
|
||||
}
|
||||
|
||||
.unit {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0.1rem;
|
||||
height: 0.35rem;
|
||||
line-height: 0.35rem;
|
||||
}
|
||||
}
|
||||
|
||||
.form-input-inline.split-wrap {
|
||||
width: initial;
|
||||
background: none;
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
|
||||
.goods-list {
|
||||
display: block;
|
||||
width: 100%;
|
||||
@extend %body-overhide;
|
||||
padding: 0.15rem 0.15rem 0;
|
||||
background-color: #fff;
|
||||
|
||||
/deep/ .goods-content {
|
||||
display: flex;
|
||||
|
||||
.goods-img {
|
||||
margin-right: 0.1rem;
|
||||
width: 0.5rem;
|
||||
height: 0.5rem;
|
||||
min-width: 0.5rem;
|
||||
}
|
||||
|
||||
.goods-name {
|
||||
white-space: pre-wrap;
|
||||
align-self: baseline;
|
||||
}
|
||||
.infos{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.spec-name{
|
||||
margin-top: 0.03rem;
|
||||
color: #909399;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.action-btn-wrap {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
.action-item {
|
||||
margin-right: 0.1rem;
|
||||
margin-top: 0.03rem;
|
||||
margin-bottom: 0.03rem;
|
||||
color: $primary-color;
|
||||
|
||||
&:first-of-type {
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/deep/ .batch-action {
|
||||
.batch-item {
|
||||
margin-right: 0.15rem;
|
||||
border: 0.01rem solid rgba(0, 0, 0, 0.2);
|
||||
padding: 0.05rem;
|
||||
border-radius: 0.03rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 商品详情
|
||||
.goods-detail-wrap {
|
||||
background-color: #fff;
|
||||
border-radius: 0.05rem;
|
||||
padding-bottom: 0.15rem;
|
||||
|
||||
.detail-head {
|
||||
padding: 0 0.15rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
font-size: 0.15rem;
|
||||
height: 0.45rem;
|
||||
border-bottom: 0.01rem solid #e8eaec;
|
||||
|
||||
.iconguanbi1 {
|
||||
font-size: $uni-font-size-lg;
|
||||
}
|
||||
}
|
||||
|
||||
.detail-body {
|
||||
width: 9rem;
|
||||
height: 4.9rem;
|
||||
padding: 0.2rem 0.2rem 0 0.2rem;
|
||||
box-sizing: border-box;
|
||||
overflow-y: auto;
|
||||
position: relative;
|
||||
|
||||
.title {
|
||||
font-size: 0.15rem;
|
||||
margin-bottom: 0.2rem;
|
||||
}
|
||||
|
||||
.information-box {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
|
||||
.box-left {
|
||||
width: 5rem;
|
||||
|
||||
.information {
|
||||
width: 100%;
|
||||
padding-left: 0.1rem;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 0.15rem;
|
||||
|
||||
view {
|
||||
color: #303133;
|
||||
font-size: 0.14rem;
|
||||
}
|
||||
|
||||
view:nth-child(1) {
|
||||
width: 0.7rem;
|
||||
margin-right: 0.16rem;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
view:nth-child(2) {
|
||||
flex: 1;
|
||||
margin-right: 0.23rem;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
|
||||
.information:last-child {
|
||||
margin-bottom: 0.35rem;
|
||||
}
|
||||
}
|
||||
|
||||
.goods-img {
|
||||
width: 2rem;
|
||||
height: 2rem;
|
||||
}
|
||||
}
|
||||
|
||||
.table {
|
||||
width: 100%;
|
||||
max-height: 2.7rem;
|
||||
box-sizing: border-box;
|
||||
|
||||
.single-specification {
|
||||
width: 100%;
|
||||
max-height: 100%;
|
||||
padding-left: 0.1rem;
|
||||
box-sizing: border-box;
|
||||
|
||||
.item {
|
||||
width: 100%;
|
||||
margin-bottom: 0.15rem;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
image {
|
||||
width: 0.5rem;
|
||||
}
|
||||
|
||||
.name {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-right: 0.16rem;
|
||||
width: 0.7rem;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.message {
|
||||
width: 74%;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.table-all {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 0 0.38rem;
|
||||
box-sizing: border-box;
|
||||
|
||||
.table-td {
|
||||
font-size: 0.14rem;
|
||||
text-align: left;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
|
||||
.table-th {
|
||||
height: 0.56rem;
|
||||
background: #f7f8fa;
|
||||
}
|
||||
|
||||
.table-tb {
|
||||
width: 100%;
|
||||
height: calc(100% - 0.56rem);
|
||||
|
||||
.table-tr {
|
||||
height: 0.7rem;
|
||||
border-bottom: 0.01rem solid #e6e6e6;
|
||||
box-sizing: border-box;
|
||||
|
||||
.table-td {
|
||||
image {
|
||||
width: 0.5rem;
|
||||
height: 0.5rem;
|
||||
}
|
||||
|
||||
text-overflow: -o-ellipsis-lastline;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.table-group{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
text:last-of-type{
|
||||
cursor: pointer;
|
||||
margin-left: 0.05rem;
|
||||
}
|
||||
}
|
||||
215
addon/cashier/source/os/pages/goods/public/css/print_price_tag.scss
Executable file
215
addon/cashier/source/os/pages/goods/public/css/print_price_tag.scss
Executable file
@@ -0,0 +1,215 @@
|
||||
.form-content {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
margin-top: 0.2rem;
|
||||
|
||||
.store-info {
|
||||
.form-inline {
|
||||
padding-left: 0.05rem;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.form-item {
|
||||
margin-bottom: 0.1rem;
|
||||
display: flex;
|
||||
|
||||
.form-label {
|
||||
width: 1.3rem;
|
||||
text-align: right;
|
||||
padding-right: 0.1rem;
|
||||
box-sizing: border-box;
|
||||
height: 0.32rem;
|
||||
line-height: 0.32rem;
|
||||
|
||||
.required {
|
||||
color: red;
|
||||
margin-right: 0.03rem;
|
||||
}
|
||||
}
|
||||
|
||||
.form-inline {
|
||||
width: 2.4rem;
|
||||
line-height: 0.32rem;
|
||||
margin-right: 0.1rem;
|
||||
box-sizing: border-box;
|
||||
|
||||
&.input {
|
||||
input {
|
||||
padding: 0 0.1rem;
|
||||
}
|
||||
}
|
||||
|
||||
.form-input {
|
||||
border-width: 0.01rem;
|
||||
border-style: solid;
|
||||
background-color: #fff;
|
||||
color: rgba(0, 0, 0, 0.85);
|
||||
border-radius: 0.02rem;
|
||||
padding-left: 0.1rem;
|
||||
height: 0.32rem;
|
||||
line-height: 0.32rem;
|
||||
font-size: 0.14rem;
|
||||
border-color: #e6e6e6;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.stock-body{
|
||||
position: relative;
|
||||
height: 100%;
|
||||
.common-form .common-btn-wrap {
|
||||
margin-left: 0;
|
||||
}
|
||||
.content-wrap {
|
||||
|
||||
padding: 0.15rem;
|
||||
background-color: #fff;
|
||||
@extend %body-overhide;
|
||||
box-sizing: border-box;
|
||||
|
||||
.title {
|
||||
font-size: 0.18rem;
|
||||
margin-bottom: 0.2rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.batch-action {
|
||||
.batch-item {
|
||||
margin-right: 0.15rem;
|
||||
border: 0.01rem solid rgba(0, 0, 0, 0.2);
|
||||
padding: 0.05rem;
|
||||
border-radius: 0.03rem;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
.table-wrap {
|
||||
position: relative;
|
||||
margin-top: 40rpx;
|
||||
border: 1rpx solid #dcdfe6;
|
||||
|
||||
.iconcheckbox_weiquanxuan,
|
||||
.iconfuxuankuang1,
|
||||
.iconfuxuankuang2 {
|
||||
color: $primary-color;
|
||||
cursor: pointer;
|
||||
font-size: 0.16rem;
|
||||
transition: all 0.3s;
|
||||
}
|
||||
.iconfuxuankuang2{
|
||||
color: #e6e6e6;
|
||||
}
|
||||
|
||||
.table-head {
|
||||
background-color: #f7f7f7;
|
||||
}
|
||||
|
||||
.table-body {
|
||||
@extend %body-overhide;
|
||||
max-height: 6rem;
|
||||
|
||||
.table-tr {
|
||||
&:last-of-type .table-td {
|
||||
border-bottom: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.table-tr {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.table-th,
|
||||
.table-td {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 0.07rem 0.3rem;
|
||||
border-bottom: 0.01rem solid #dcdfe6;
|
||||
border-right: 0.01rem solid #dcdfe6;
|
||||
text-align: center;
|
||||
|
||||
&:last-of-type {
|
||||
border-right: 0;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
&.goods-name {
|
||||
justify-content: flex-start;
|
||||
text-align: left;
|
||||
|
||||
image {
|
||||
width: 0.45rem;
|
||||
height: 0.45rem;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.name {
|
||||
margin-left: 0.1rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.delete {
|
||||
margin: 0;
|
||||
font-size: $uni-font-size-base;
|
||||
background-color: $primary-color;
|
||||
color: #fff;
|
||||
line-height: 0.32rem;
|
||||
height: 0.32rem;
|
||||
&::after{
|
||||
border-width: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.table-empty {
|
||||
justify-content: center;
|
||||
padding: 0.1rem;
|
||||
color: #999;
|
||||
/* border: 0.01rem solid #dcdfe6;
|
||||
border-top: 0; */
|
||||
}
|
||||
}
|
||||
}
|
||||
.action-wrap {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 0.24rem 0.2rem;
|
||||
align-items: center;
|
||||
background-color: #fff;
|
||||
z-index: 10;
|
||||
.btn-wrap {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
button {
|
||||
margin: 0;
|
||||
min-width: 1.2rem;
|
||||
height: 0.4rem;
|
||||
line-height: 0.4rem;
|
||||
font-size: $uni-font-size-base;
|
||||
|
||||
&.stockout-btn {
|
||||
margin-right: 0.15rem;
|
||||
background-color: $primary-color;
|
||||
color: #fff;
|
||||
&::after{
|
||||
border-width: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&.remark {
|
||||
margin-right: 0.15rem;
|
||||
min-width: 1.2rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
231
addon/cashier/source/os/pages/goods/public/js/goods_list.js
Executable file
231
addon/cashier/source/os/pages/goods/public/js/goods_list.js
Executable file
@@ -0,0 +1,231 @@
|
||||
import {
|
||||
setGoodsStatus,
|
||||
getGoodsDetail,
|
||||
} from '@/api/goods.js';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
page: 1, // 初始是请求第几页
|
||||
page_size: 20, // 每次返回数据数
|
||||
goodsDetail: null, // 商品详情数据
|
||||
skuList: [], // 弹窗中所需要获取到的sku列表数据
|
||||
status: '',
|
||||
disabled:false,
|
||||
goods_class: '',
|
||||
goodsId: '',
|
||||
option: {
|
||||
page_size: 9,
|
||||
search_text: '',
|
||||
sku_no: '',
|
||||
goods_class: 'all',
|
||||
status: 'all',
|
||||
start_price: '',
|
||||
end_price: ''
|
||||
},
|
||||
goodsClass: [{
|
||||
value: 1,
|
||||
label: '实物商品'
|
||||
}, {
|
||||
value: 4,
|
||||
label: '服务项目'
|
||||
}, {
|
||||
value: 5,
|
||||
label: '卡项套餐'
|
||||
}, {
|
||||
value: 6,
|
||||
label: '称重商品'
|
||||
}],
|
||||
statusList: [{
|
||||
value: 1,
|
||||
label: '仓库中'
|
||||
}, {
|
||||
value: 2,
|
||||
label: '销售中'
|
||||
}],
|
||||
cols: [{
|
||||
width: 6,
|
||||
align: 'center',
|
||||
checkbox: true
|
||||
}, {
|
||||
field: 'account_data',
|
||||
width: 20,
|
||||
title: '商品信息',
|
||||
align: 'left',
|
||||
templet: data => {
|
||||
let img = this.$util.img(data.goods_image,{size: 'small'});
|
||||
let html = `
|
||||
<view class="goods-content">
|
||||
<image class="goods-img" src="${img}" mode="aspectFit"/>
|
||||
<text class="goods-name multi-hidden">${data.goods_name}</text>
|
||||
</view>
|
||||
`;
|
||||
return html;
|
||||
}
|
||||
}, {
|
||||
width: 14,
|
||||
title: '商品类型',
|
||||
align: 'center',
|
||||
field: 'goods_class_name'
|
||||
}, {
|
||||
width: 10,
|
||||
title: '价格',
|
||||
align: 'center',
|
||||
templet: function(data) {
|
||||
return '¥' + data.discount_price;
|
||||
}
|
||||
}, {
|
||||
field: 'stock',
|
||||
width: 15,
|
||||
title: '库存',
|
||||
align: 'center'
|
||||
}, {
|
||||
width: 15,
|
||||
title: '售卖模式',
|
||||
templet: data => {
|
||||
return (this.globalStoreInfo.stock_type == 'store' ? '独立库存' : '统一库存') + ' | ' + (data
|
||||
.is_unify_price ? '统一设价' : '独立设价');
|
||||
}
|
||||
}, {
|
||||
width: 15,
|
||||
title: '状态',
|
||||
align: 'center',
|
||||
templet: function(data) {
|
||||
var str = '';
|
||||
if (data.store_status == 1) {
|
||||
str = '销售中';
|
||||
} else if (data.store_status == 0) {
|
||||
str = '仓库中';
|
||||
}
|
||||
return str;
|
||||
}
|
||||
}, {
|
||||
width: 20,
|
||||
title: '操作',
|
||||
align: 'right',
|
||||
action: true
|
||||
}],
|
||||
};
|
||||
},
|
||||
onLoad() {},
|
||||
computed: {
|
||||
syncWeighGoods() {
|
||||
try {
|
||||
return this.addon.includes('weighgoods') && this.addon.includes('scale') && (window.POS_ || window
|
||||
.ipcRenderer);
|
||||
} catch (e) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
selectClass(index) {
|
||||
this.goods_class = index == -1 ? '' : this.goodsClass[index].value.toString();
|
||||
},
|
||||
selectStatus(index) {
|
||||
this.status = index == -1 ? '' : this.statusList[index].value.toString();
|
||||
},
|
||||
// 搜索商品
|
||||
searchFn() {
|
||||
if (this.status == 1) {
|
||||
this.option.status = 0
|
||||
} else if (this.status == 2) {
|
||||
this.option.status = 1
|
||||
} else {
|
||||
this.option.status = 'all'
|
||||
}
|
||||
this.option.goods_class = this.goods_class ? this.goods_class : 'all';
|
||||
this.$refs.goodsListTable.load({
|
||||
page: 1
|
||||
});
|
||||
},
|
||||
resetFn() {
|
||||
this.status = '';
|
||||
this.goods_class = '';
|
||||
this.option.status = 'all';
|
||||
this.option.goods_class = 'all';
|
||||
this.option.search_text = '';
|
||||
this.option.sku_no = '';
|
||||
this.option.start_price = '';
|
||||
this.option.end_price = '';
|
||||
this.$refs.goodsListTable.load({
|
||||
page: 1
|
||||
});
|
||||
},
|
||||
// 查询商品详情
|
||||
getDetail(id, type = '') {
|
||||
uni.showLoading({
|
||||
title: '加载中'
|
||||
});
|
||||
this.goodsDetail = null;
|
||||
|
||||
getGoodsDetail(id).then(res => {
|
||||
if (res.code >= 0) {
|
||||
this.goodsDetail = res.data;
|
||||
this.goodsDetail.sku_list[0].goods_name = this.goodsDetail.goods_name;
|
||||
this.skuList = this.goodsDetail.sku_list;
|
||||
if (!type) {
|
||||
this.$refs.goodsDetail.open();
|
||||
} else {
|
||||
this.$refs.goodsSku.open();
|
||||
}
|
||||
}
|
||||
uni.hideLoading();
|
||||
})
|
||||
},
|
||||
goodsStatus(id, status) {
|
||||
let arr;
|
||||
if (typeof id == 'object') {
|
||||
arr = [];
|
||||
id.value.length &&
|
||||
id.value.forEach((item, index) => {
|
||||
arr.push(item.goods_id);
|
||||
});
|
||||
|
||||
if (!arr.length) {
|
||||
this.$util.showToast({
|
||||
title: '请选择要操作的数据'
|
||||
});
|
||||
return false;
|
||||
}
|
||||
} else arr = id;
|
||||
let data = {
|
||||
goods_id: arr.toString(),
|
||||
status: status
|
||||
};
|
||||
setGoodsStatus(data).then(res => {
|
||||
this.$util.showToast({
|
||||
title: res.message
|
||||
});
|
||||
if (res.code >= 0) {
|
||||
this.$refs.goodsListTable.load();
|
||||
}
|
||||
})
|
||||
},
|
||||
goodsSku(id) {
|
||||
this.disabled = false
|
||||
this.goodsId = id;
|
||||
this.getDetail(id, 'goodsSku');
|
||||
},
|
||||
isDeliveryRestrictions(id){
|
||||
this.disabled = true
|
||||
this.goodsId = id;
|
||||
this.getDetail(id, 'goodsSku');
|
||||
},
|
||||
// 日志记录弹窗
|
||||
recordopen(id) {
|
||||
this.goodsId = id;
|
||||
this.$refs.record.open();
|
||||
},
|
||||
// 弹窗关闭
|
||||
close(type) {
|
||||
this.$refs[type].close();
|
||||
},
|
||||
synchronous() {
|
||||
this.$refs.scaleGoods.open();
|
||||
},
|
||||
printPriceTag(){
|
||||
this.$util.redirectTo('/pages/goods/print_price_tag');
|
||||
},
|
||||
}
|
||||
}
|
||||
206
addon/cashier/source/os/pages/goods/public/js/print_price_tag.js
Executable file
206
addon/cashier/source/os/pages/goods/public/js/print_price_tag.js
Executable file
@@ -0,0 +1,206 @@
|
||||
import {exportPrintPriceTagData} from '@/api/goods.js';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
goodsList: [], //已选择数据
|
||||
allSelected:false,
|
||||
isSubmit: false, //提交防抖
|
||||
dialogParams:{},
|
||||
dialogVisible: false, //弹框
|
||||
editPrintNum:{
|
||||
show:false,
|
||||
value:1,
|
||||
},
|
||||
//选择图标
|
||||
selectedIcon:'iconfuxuankuang1',
|
||||
unselectedIcon:'iconfuxuankuang2',
|
||||
harfselectedIcon:'iconcheckbox_weiquanxuan',
|
||||
};
|
||||
},
|
||||
onLoad(option) {
|
||||
|
||||
},
|
||||
methods: {
|
||||
openSelectGoodsDialog() {
|
||||
this.dialogVisible = true
|
||||
},
|
||||
selectGoodsComplete(data) { //选择数据
|
||||
data.forEach((item, index) => {
|
||||
let is_in = false;
|
||||
this.goodsList.forEach((old_item, old_index)=>{
|
||||
if(old_item.sku_id == item.sku_id){
|
||||
is_in = true;
|
||||
return;
|
||||
}
|
||||
})
|
||||
if(!is_in){
|
||||
item.selected = false;
|
||||
item.print_num = 1;
|
||||
this.goodsList.push(item);
|
||||
}
|
||||
})
|
||||
},
|
||||
changeGoodsAllSelected(){
|
||||
if(this.goodsList.length == 0) return;
|
||||
this.allSelected = this.allSelected === true ? false : true;
|
||||
this.goodsList.forEach((item) => {
|
||||
item.selected = this.allSelected;
|
||||
})
|
||||
this.$forceUpdate();
|
||||
},
|
||||
changeGoodsSelected(index){
|
||||
this.goodsList[index].selected = !this.goodsList[index].selected;
|
||||
let selected_num = 0;
|
||||
this.goodsList.forEach((item) => {
|
||||
if(item.selected) selected_num++;
|
||||
})
|
||||
if(selected_num == this.goodsList.length){
|
||||
this.allSelected = true;
|
||||
}else if(selected_num == 0){
|
||||
this.allSelected = false;
|
||||
}else{
|
||||
this.allSelected = 'harf';
|
||||
}
|
||||
this.$forceUpdate();
|
||||
},
|
||||
getSelectedNum(){
|
||||
let selected_num = 0;
|
||||
this.goodsList.forEach((item) => {
|
||||
if(item.selected) selected_num++;
|
||||
})
|
||||
return selected_num;
|
||||
},
|
||||
batchDeleteGoods(){
|
||||
if(this.getSelectedNum() == 0){
|
||||
this.$util.showToast({
|
||||
title: '请选择要操作的数据',
|
||||
});
|
||||
return;
|
||||
}
|
||||
let goods_list = [];
|
||||
this.goodsList.forEach((item) => {
|
||||
if(!item.selected) goods_list.push(item);
|
||||
})
|
||||
this.goodsList = goods_list;
|
||||
if(this.goodsList.length == 0) this.allSelected = false;
|
||||
this.$forceUpdate();
|
||||
},
|
||||
editPrintNumShow(){
|
||||
if(this.getSelectedNum() == 0){
|
||||
this.$util.showToast({
|
||||
title: '请选择要操作的数据',
|
||||
});
|
||||
return;
|
||||
}
|
||||
this.editPrintNum.show = true;
|
||||
this.$forceUpdate();
|
||||
},
|
||||
editPrintNumConfirm(){
|
||||
this.goodsList.forEach((item) => {
|
||||
if(item.selected){
|
||||
item.print_num = this.editPrintNum.value;
|
||||
item.selected = false;
|
||||
}
|
||||
})
|
||||
this.allSelected = false;
|
||||
this.editPrintNum.value = 1;
|
||||
this.editPrintNum.show = false;
|
||||
this.$forceUpdate();
|
||||
},
|
||||
designFn(){
|
||||
if(!this.isPos()){
|
||||
this.$util.showToast({
|
||||
title: '请在客户端程序中执行此操作',
|
||||
});
|
||||
return;
|
||||
}
|
||||
if(this.goodsList.length == 0){
|
||||
this.$util.showToast({
|
||||
title: '请先选择商品',
|
||||
});
|
||||
return;
|
||||
}
|
||||
let printFieldConfig = [
|
||||
{field:'goods_name', name:'商品名称'},
|
||||
{field:'spec_name', name:'规格'},
|
||||
{field:'sku_no', name:'商品条码'},
|
||||
{field:'market_price', name:'划线价'},
|
||||
{field:'price', name:'零售价'},
|
||||
{field:'unit', name:'单位'},
|
||||
{field:'weight', name:'重量'},
|
||||
{field:'category_names', name:'商品分类'},
|
||||
{field:'brand_name', name:'品牌'},
|
||||
{field:'supplier_name', name:'供应商'},
|
||||
{field:'label_name', name:'标签'},
|
||||
];
|
||||
try{
|
||||
this.$pos.send('DesignPriceTag', JSON.stringify(this.goodsList));
|
||||
}catch(e){
|
||||
this.$util.showToast({
|
||||
title: '设计错误:'+JSON.stringify(e),
|
||||
});
|
||||
}
|
||||
},
|
||||
printFn() {
|
||||
if(!this.isPos()){
|
||||
this.$util.showToast({
|
||||
title: '请在客户端程序中执行此操作',
|
||||
});
|
||||
return;
|
||||
}
|
||||
if(this.goodsList.length == 0){
|
||||
this.$util.showToast({
|
||||
title: '请先选择商品',
|
||||
});
|
||||
return;
|
||||
}
|
||||
try{
|
||||
this.$pos.send('PrintPriceTag', JSON.stringify(this.goodsList));
|
||||
}catch(e){
|
||||
this.$util.showToast({
|
||||
title: '打印错误:'+JSON.stringify(e),
|
||||
});
|
||||
}
|
||||
},
|
||||
exportFn(){
|
||||
if(this.goodsList.length == 0){
|
||||
this.$util.showToast({
|
||||
title: '请先选择商品数据'
|
||||
});
|
||||
return;
|
||||
}
|
||||
if(this.isPos()){
|
||||
try{
|
||||
this.$pos.send('ExportPriceTag', JSON.stringify(this.goodsList));
|
||||
}catch(e){
|
||||
this.$util.showToast({
|
||||
title: '导出错误:'+JSON.stringify(e),
|
||||
});
|
||||
}
|
||||
}else{
|
||||
uni.showLoading({
|
||||
title: '导出中'
|
||||
});
|
||||
exportPrintPriceTagData({
|
||||
data:JSON.stringify(this.goodsList),
|
||||
}).then(res => {
|
||||
uni.hideLoading();
|
||||
if (res.code == 0) {
|
||||
window.open(this.$util.img(res.data.path));
|
||||
}else{
|
||||
this.$util.showToast({
|
||||
title: res.message
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
backFn() {
|
||||
this.$util.redirectTo('/pages/goods/goodslist');
|
||||
},
|
||||
isPos(){
|
||||
return (window.POS_ || window.ipcRenderer);
|
||||
},
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user