You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
246 lines
6.3 KiB
246 lines
6.3 KiB
<template>
|
|
<view class="page1">
|
|
<view class="content-box">
|
|
<view class="right-box">
|
|
<view class="box-left">
|
|
<img :src="dataList.productPicture" alt="">
|
|
</view>
|
|
<view class="box-right">
|
|
<view class="box-right-name">{{dataList.productName == null ? '暂无':dataList.productName}} ({{dataList.productSn == null ? '暂无':dataList.productSn}})</view>
|
|
<view class="box-right-num">供应商:{{dataList.supplierName == null ? '暂无':dataList.supplierName}}</view>
|
|
<view class="edit-btn" @tap="goToAddGoods">编辑</view>
|
|
<kk-printer ref="kkprinter" :bufferData="bufferData" @onPrint="onPrint" style="width: 100rpx;height: 60rpx;line-height: 60rpx;color: #fff !important;background: #0072E3;position: absolute;top: 30rpx;right: 40rpx;border-radius: 10px;text-align: center;"></kk-printer>
|
|
<view class="box-right-num" style="color:#ffa200;">
|
|
<text style="padding-right: 20rpx;">{{dataList.delFlag==1?'已上架':'已下架'}}</text>
|
|
<!-- <text>{{dataList.delFlag==0?'已上架':'已下架'}}</text> -->
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="box-right-price">
|
|
<view class="price-box" v-if="type == 0">
|
|
<text>{{dataList.purchasePrice == null ? '暂无':dataList.purchasePrice}}</text>
|
|
<text>平均采购价</text>
|
|
</view>
|
|
<view class="price-box">
|
|
<text>{{dataList.wholesalePrice == null ? '暂无':dataList.wholesalePrice}}</text>
|
|
<text>批发价</text>
|
|
</view>
|
|
<view class="price-box">
|
|
<text>{{dataList.price == null ? '暂无':dataList.price}}</text>
|
|
<text>零售价</text>
|
|
</view>
|
|
<view class="price-box">
|
|
<text>{{dataList.stockCount == null ? '暂无':dataList.stockCount}}</text>
|
|
<text>库存</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="container-box" v-for="(item,index) in pecsList" :key='index'>
|
|
<view class="prec-list">
|
|
<view class="prec-list-box" style="width: 70%;">
|
|
{{item.attributeList | sliceMsg}}
|
|
</view>
|
|
<view class="prec-list-box" style="font-size: 26rpx;">
|
|
数量:{{item.stockCount}}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<!-- 弹出输入框 -->
|
|
<uni-popup ref="inputDialog" type="dialog">
|
|
<uni-popup-dialog ref="inputClose" mode="input" title="采购价" placeholder="请输入采购价"
|
|
@confirm="changePrice"></uni-popup-dialog>
|
|
</uni-popup>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import util from '@/components/kk-printer/utils/util.js';
|
|
import * as blesdk from '@/components/kk-printer/utils/bluetoolth.js';
|
|
import kkPrinter from '@/components/kk-printer/index.vue';
|
|
export default {
|
|
data() {
|
|
return {
|
|
pageNum: 1, //分页的页码
|
|
dataList: [],
|
|
bufferData: '',
|
|
pecsList:[],
|
|
type:''
|
|
}
|
|
},
|
|
filters: {
|
|
sliceMsg(val) {
|
|
var name = ''
|
|
if (typeof(val) == 'string') {
|
|
let newObj = JSON.parse(val)
|
|
for (let as in newObj) {
|
|
name += newObj[as] + '/'
|
|
}
|
|
}
|
|
return name;
|
|
},
|
|
maxNum(val){
|
|
if(val >= 10){
|
|
return 10
|
|
}else if(val < 0){
|
|
return 0
|
|
}
|
|
}
|
|
},
|
|
components: {
|
|
kkPrinter
|
|
},
|
|
onLoad(option) {
|
|
this.dataList = JSON.parse(option.item);
|
|
this.type = uni.getStorageSync('type')
|
|
},
|
|
onShow(){
|
|
this.getShareList();
|
|
},
|
|
methods: {
|
|
//库存商品详情
|
|
getShareList() {
|
|
this.tui.request("/app/stock/productCount", "GET", {
|
|
productId: this.dataList.id
|
|
}, false, true).then((res) => {
|
|
if (res.code == 200) {
|
|
this.pecsList = res.result
|
|
} else {
|
|
this.tui.toast(res.message)
|
|
}
|
|
}).catch((res) => {})
|
|
|
|
},
|
|
//去新增商品页编辑
|
|
goToAddGoods(){
|
|
//去编辑页的时候,分类不能更改了
|
|
uni.navigateTo({
|
|
url: "/pages/inventory/addGoods?dataList="+JSON.stringify(this.dataList)
|
|
})
|
|
},
|
|
onPrint(opt) {
|
|
//快递单600*1040 入库单440*320
|
|
let strCmd = blesdk.CreatCPCLPage(440, 320, 1, 0);
|
|
strCmd += blesdk.addCPCLText('0', '30', '24', '0', 0, '商品名:'+this.dataList.productName)
|
|
strCmd += blesdk.addCPCLText('0', '80', '24', '0', 0, '货 号:'+this.dataList.productSn)
|
|
strCmd += blesdk.addCPCLText('0', '130', '24', '0', 0, '供应商:'+this.dataList.supplierName)
|
|
strCmd += blesdk.addCPCLText('0', '180', '24', '0', 0, '批发价:'+this.dataList.wholesalePrice)
|
|
strCmd += blesdk.addCPCLText('0', '230', '24', '0', 0, '零售价:'+this.dataList.price)
|
|
strCmd += blesdk.addCPCLQRCode(260, 170, 'H', '1', 6, this.dataList.id) //二维码
|
|
strCmd += blesdk.addCPCLLocation(0); //对齐指令 0-左对齐 1-右对齐 2-居中
|
|
strCmd += blesdk.addCPCLPrint();
|
|
this.bufferData = strCmd;
|
|
},
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
page {
|
|
height: 100%;
|
|
}
|
|
|
|
.page1 {
|
|
display: flex;
|
|
flex-direction: column;
|
|
height: 100%;
|
|
}
|
|
|
|
.content-box {
|
|
background: #fff;
|
|
}
|
|
|
|
.right-box {
|
|
width: 100%;
|
|
height: 220rpx;
|
|
display: flex;
|
|
border-bottom: 1px solid #eee;
|
|
position: relative;
|
|
}
|
|
|
|
.box-left {
|
|
width: 170rpx;
|
|
height: 170rpx;
|
|
background-size: 100%;
|
|
margin: 25rpx;
|
|
border-radius: 20rpx;
|
|
}
|
|
|
|
.box-left img {
|
|
width: 100%;
|
|
height: 100%;
|
|
|
|
}
|
|
|
|
.box-right {
|
|
margin-top: 20rpx;
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
position: relative;
|
|
}
|
|
|
|
.box-right-name {
|
|
font-size: 30rpx;
|
|
font-weight: bold;
|
|
padding-left: 20rpx;
|
|
height: 30%;
|
|
}
|
|
|
|
.box-right-num {
|
|
padding: 5rpx 0;
|
|
color: #777;
|
|
padding-left: 20rpx;
|
|
height: 30%;
|
|
}
|
|
|
|
.box-right-price {
|
|
display: flex;
|
|
font-size: 25rpx;
|
|
height: 100rpx;
|
|
}
|
|
|
|
.price-box {
|
|
flex: 1;
|
|
text-align: center;
|
|
display: flex;
|
|
flex-direction: column;
|
|
margin-top: 20rpx;
|
|
}
|
|
|
|
.container-box {
|
|
border-top: 10px solid #eee;
|
|
}
|
|
|
|
.price-box text:first-child {
|
|
color: #ffa200
|
|
}
|
|
|
|
.edit-btn {
|
|
width: 100rpx;
|
|
height: 60rpx;
|
|
line-height: 60rpx;
|
|
color: #fff;
|
|
background: #0072E3;
|
|
position: absolute;
|
|
top: 105rpx;
|
|
right: 40rpx;
|
|
border-radius: 10px;
|
|
text-align: center;
|
|
}
|
|
|
|
.prec-list {
|
|
height: 80rpx;
|
|
line-height: 80rpx;
|
|
background: #fff;
|
|
display: flex;
|
|
font-size: 32rpx;
|
|
border-bottom: 1px solid #eee;
|
|
}
|
|
|
|
.prec-list-box {
|
|
height: 70rpx;
|
|
line-height: 70rpx;
|
|
padding: 0 30rpx;
|
|
overflow: hidden;
|
|
}
|
|
</style>
|