初始上传

This commit is contained in:
2026-04-04 17:27:12 +08:00
parent 4d80d28eb4
commit b7e11774ee
11191 changed files with 1588469 additions and 0 deletions

View File

@@ -0,0 +1,221 @@
<template>
<base-page>
<view class="goods-list">
<view class="screen-warp common-form">
<view class="common-form-item">
<view class="form-inline">
<label class="form-label">商品名称</label>
<view class="form-input-inline">
<input type="text" v-model="option.search_text" placeholder="请输入商品名称" class="form-input" />
</view>
</view>
<view class="form-inline">
<label class="form-label">商品编码</label>
<view class="form-input-inline">
<input type="text" v-model="option.sku_no" placeholder="请输入商品编码" class="form-input" />
</view>
</view>
<view class="form-inline">
<label class="form-label">商品类型</label>
<view class="form-input-inline">
<select-lay :zindex="10" :value="goods_class" name="goods_class" placeholder="请选择商品类型" :options="goodsClass" @selectitem="selectClass"/>
</view>
</view>
<view class="form-inline">
<label class="form-label">商品状态</label>
<view class="form-input-inline">
<select-lay :zindex="10" :value="status" name="status" placeholder="请选择商品状态" :options="statusList" @selectitem="selectStatus"/>
</view>
</view>
<view class="form-inline">
<label class="form-label">商品价格</label>
<view class="form-input-inline input-append">
<input type="text" v-model="option.start_price" placeholder="最低价格" class="form-input" />
<view class="unit"></view>
</view>
<view class="form-input-inline split-wrap">-</view>
<view class="form-input-inline input-append">
<input type="text" v-model="option.end_price" placeholder="最高价格" class="form-input" />
<view class="unit"></view>
</view>
</view>
<view class="form-inline common-btn-wrap">
<button type="default" class="screen-btn" @click="searchFn()">筛选</button>
<button type="default" @click="resetFn()">重置</button>
<button type="default" class="screen-btn" @click="printPriceTag()">打印价格标签</button>
<button type="default" class="screen-btn" @click="synchronous()" v-if="syncWeighGoods">同步称重商品</button>
</view>
</view>
</view>
<uniDataTable url="/cashier/storeapi/goods/page" :option="option" :cols="cols" ref="goodsListTable">
<template v-slot:action="dataTable">
<view class="action-btn-wrap">
<text class="action-item" @click="getDetail(dataTable.value.goods_id)">详情</text>
<text class="action-item" v-if="dataTable.value.store_status == 0 || dataTable.value.store_status == null" @click="goodsStatus(dataTable.value.goods_id, 1)">上架</text>
<text class="action-item" v-else @click="goodsStatus(dataTable.value.goods_id, 0)">下架</text>
<text class="action-item" @click="goodsSku(dataTable.value.goods_id)" v-if="(globalStoreInfo.stock_type == 'store') || dataTable.value.is_unify_price != 1">价格库存</text>
<text class="action-item" @click="isDeliveryRestrictions(dataTable.value.goods_id)" v-if="dataTable.value.goods_class == 1">
限制起送
</text>
<text class="action-item" @click="recordopen(dataTable.value.goods_id)" v-if="dataTable.value.is_virtual != 1 && globalStoreInfo.stock_type == 'store'">库存记录</text>
</view>
</template>
<template v-slot:batchaction="dataTable">
<text class="batch-item" @click="goodsStatus(dataTable, 1)">批量上架</text>
<text class="batch-item" @click="goodsStatus(dataTable, 0)">批量下架</text>
</template>
</uniDataTable>
<unipopup ref="goodsDetail" type="center" :pagesize="9">
<view class="goods-detail-wrap">
<view class="detail-head">
商品详情
<text class="iconfont iconguanbi1" @click="$refs.goodsDetail.close()"></text>
</view>
<view class="detail-body">
<block v-if="goodsDetail">
<view class="title">基本信息</view>
<view class="information-box">
<view class="box-left">
<view class="information">
<view>商品名称</view>
<view>{{ goodsDetail.goods_name }}</view>
</view>
<view class="information" v-if="goodsDetail.introduction">
<view>促销语</view>
<view>{{ goodsDetail.introduction }}</view>
</view>
<view class="information">
<view>商品类型</view>
<view>{{ goodsDetail.goods_class_name }}</view>
</view>
<view class="information" v-if="goodsDetail.brand_name">
<view>商品品牌</view>
<view>{{ goodsDetail.brand_name }}</view>
</view>
<view class="information" v-if="goodsDetail.unit">
<view>单位</view>
<view>{{ goodsDetail.unit }}</view>
</view>
<view class="information" v-if="goodsDetail.goods_class == 6">
<view>计价方式</view>
<view>{{ goodsDetail.pricing_type == 'num' ? '计数' : '计重' }}</view>
</view>
<view class="information">
<view>商品状态</view>
<view>
{{ goodsDetail.store_status == 0 || goodsDetail.store_status == null ? '仓库中' : '已上架' }}
</view>
</view>
</view>
</view>
<block v-if="goodsDetail.sku_list.length > 1">
<view class="title title2">价格库存</view>
<view class="table">
<view class="table-th table-all">
<view class="table-td" style="width:30%">商品规格</view>
<block v-if="goodsDetail.is_unify_price">
<view class="table-td" style="width:20%">销售价格</view>
</block>
<block v-else>
<view class="table-td" style="width:15%">统一价格</view>
<view class="table-td" style="width:15%">独立价格</view>
</block>
<view class="table-td" style="width:20%;">商品编码</view>
<view class="table-td table-group" style="width:15%;">
<text>商品库存</text>
<text title="商品库存指下单扣减后的剩余库存" class="iconfont iconwenhao"></text>
</view>
<view class="table-td table-group" style="width:15%;">
<text>实际库存</text>
<text title="实际库存指实际发货后的剩余库存" class="iconfont iconwenhao"></text>
</view>
</view>
<scroll-view class="table-tb" scroll-y="true">
<view class="table-tr table-all" v-for="(item, index) in goodsDetail.sku_list" :key="index">
<view class="table-td" style="width:30%">{{ item.spec_name }}</view>
<block v-if="goodsDetail.is_unify_price">
<view class="table-td" style="width:20%">{{ item.discount_price }}</view>
</block>
<block v-else>
<view class="table-td" style="width:15%">{{ item.discount_price }}</view>
<view class="table-td" style="width:15%">{{ item.store_price }}</view>
</block>
<view class="table-td" style="width:20%;">{{ item.sku_no }}</view>
<view class="table-td" style="width:15%;">{{ item.stock }}</view>
<view class="table-td" style="width:15%;">{{ item.real_stock }}</view>
</view>
</scroll-view>
</view>
</block>
<block v-else>
<view class="title title2">规格详情</view>
<view class="table">
<view class="single-specification">
<view class="item">
<view class="name">商品售价</view>
<view class="message" v-if="goodsDetail.is_unify_price == 1 || goodsDetail.sku_list[0].store_price == null">{{ goodsDetail.sku_list[0].discount_price }}</view>
<view class="message" v-else>{{ goodsDetail.sku_list[0].store_price }}</view>
</view>
<view class="item">
<view class="name">商品编码</view>
<view class="message">{{ goodsDetail.sku_list[0].sku_no ? goodsDetail.sku_list[0].sku_no : '无' }}</view>
</view>
<view class="item">
<view class="name">商品库存</view>
<view class="message">{{ goodsDetail.sku_list[0].stock || 0 }}</view>
</view>
<view class="item">
<view class="name">实际库存</view>
<view class="message">{{ goodsDetail.sku_list[0].real_stock || 0 }}</view>
</view>
</view>
</view>
</block>
</block>
<block v-else>
<image class="cart-empty" src="@/static/cashier/cart_empty.png" mode="widthFix"/>
</block>
</view>
</view>
</unipopup>
<unipopup ref="goodsSku" type="center">
<view class="record-body">
<ns-goods-sku :disabled="disabled" v-if="skuList.length&&goodsDetail" :isUnifyPrice="goodsDetail.is_unify_price" :skuList="skuList" @close="close('goodsSku')" />
</view>
</unipopup>
<unipopup ref="record" type="center">
<view class="record-body">
<ns-goods-sku-stock-record @close="close('record')" :goodsId="goodsId"/>
</view>
</unipopup>
</view>
<ns-scale-goods ref="scaleGoods"/>
</base-page>
</template>
<script>
import uniDataTable from '@/components/uni-data-table/uni-data-table.vue';
import unipopup from '@/components/uni-popup/uni-popup.vue';
import nsGoodsSkuStockRecord from '@/components/ns-goods-sku-stock-record/ns-goods-sku-stock-record.vue';
import nsGoodsSku from '@/components/ns-goods-sku/ns-goods-sku.vue';
import nsScaleGoods from '@/components/ns-scale-goods/ns-scale-goods.vue';
import goodsList from './public/js/goods_list.js';
export default {
components: {
unipopup,
nsGoodsSkuStockRecord,
nsGoodsSku,
uniDataTable,
nsScaleGoods,
},
mixins: [goodsList]
};
</script>
<style scoped lang="scss">
@import './public/css/goods_list.scss';
</style>

View File

@@ -0,0 +1,89 @@
<template>
<base-page>
<view class="stock-body">
<view class="content-wrap" @click="goodsShow = false">
<view class="title-back flex items-center cursor-pointer" @click="backFn">
<text class="iconfont iconqianhou1"></text>
<text class="left">返回</text>
<text class="content">|</text>
<text>打印价格标签</text>
</view>
<view class="batch-action" v-if="editPrintNum.show == false">
<text class="batch-item" @click="openSelectGoodsDialog()">选择商品</text>
<text class="batch-item" @click="batchDeleteGoods()">批量删除</text>
<!-- <text class="batch-item" @click="editPrintNumShow()">批量设置打印份数</text> -->
</view>
<view class="screen-warp common-form" v-if="editPrintNum.show == true">
<view class="common-form-item">
<view class="form-inline">
<view class="form-input-inline">
<input type="digit" placeholder="请输入打印份数" class="form-input" v-model="editPrintNum.value"/>
</view>
</view>
<view class="form-inline common-btn-wrap">
<button type="default" class="screen-btn" @click="editPrintNumConfirm">确定</button>
<button type="default" @click="editPrintNum.show = false">取消</button>
</view>
</view>
</view>
<view class="table-wrap">
<view class="table-head">
<view class="table-tr">
<view class="table-th" >
<text class="iconfont" :class="allSelected === true ? selectedIcon : (allSelected == 'harf' ? harfselectedIcon : unselectedIcon)" @click="changeGoodsAllSelected()"></text>
</view>
<!-- <view class="table-th" style="flex: 0.5;">打印份数</view> -->
<view class="table-th" style="flex: 3;">商品名称</view>
<view class="table-th" style="flex: 1;">条码</view>
<view class="table-th" style="flex: 1;">划线价</view>
<view class="table-th" style="flex: 1;">售价</view>
<view class="table-th" style="flex: 1;">单位</view>
<view class="table-th" style="flex: 1;">重量</view>
</view>
</view>
<view class="table-body">
<block v-for="(item, index) in goodsList" :key="index">
<view class="table-tr">
<view class="table-td" >
<text class="iconfont" :class="item.selected? selectedIcon : unselectedIcon" @click="changeGoodsSelected(index)"></text>
</view>
<!-- <view class="table-td" style="flex: 0.5;">{{ item.print_num }}</view> -->
<view class="table-td goods-name" style="flex: 3;">{{ item.sku_name }}</view>
<view class="table-td" style="flex: 1;">{{ item.sku_no }}</view>
<view class="table-td" style="flex: 1;">{{ item.market_price }}</view>
<view class="table-td" style="flex: 1;">{{ item.price }}</view>
<view class="table-td" style="flex: 1;">{{ item.unit }}</view>
<view class="table-td" style="flex: 1;">{{ item.weight }}</view>
</view>
</block>
<view class="table-tr table-empty" v-if="!goodsList.length">暂无数据请选择商品数据</view>
</view>
</view>
</view>
<view class="action-wrap">
<view class="table-total">合计 {{ goodsList.length }} 种商品</view>
<view class="btn-wrap">
<button type="default" class="stockout-btn" @click="designFn" :loading="isSubmit">设计模板</button>
<button type="default" class="stockout-btn" @click="printFn" :loading="isSubmit">打印</button>
<button type="default" class="stockout-btn" @click="exportFn" :loading="isSubmit">导出</button>
</view>
</view>
</view>
<goods-sku-select v-model="dialogVisible" :params="dialogParams" apiType="sku" :goodsClass="[1,6]" @selectGoods="selectGoodsComplete" />
</base-page>
</template>
<script>
import printPriceTag from "./public/js/print_price_tag.js"
import goodsSkuSelect from '@/components/ns-goods-sku-select/ns-goods-sku-select.vue';
export default {
components: {
goodsSkuSelect
},
mixins: [printPriceTag]
};
</script>
<style lang="scss" scoped>
@import './public/css/print_price_tag.scss';
</style>

View 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;
}
}

View 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;
}
}
}
}
}

View 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');
},
}
}

View 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);
},
}
};