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.
922 lines
31 KiB
922 lines
31 KiB
<template>
|
|
<view class="page1">
|
|
<view class="content-box">
|
|
<view class="right-box">
|
|
<view class="box-left">
|
|
<img class="img-radius" :src="dataList.productPicture" alt="" v-if="dataList.productPicture">
|
|
<view class="noPic" v-else>暂无图片</view>
|
|
</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>
|
|
<view v-if="!isPrint" @tap="printBtn" class="print-btn">
|
|
打印
|
|
</view>
|
|
<view v-if="isPrint" @tap="printBtn" class="print-btn">
|
|
取消
|
|
</view>
|
|
<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 style="background: #fff;border: 1px solid #eee;">
|
|
<uni-segmented-control :current="current" :values="items" @clickItem="onClickItem" styleType="text" activeColor="#007aff"></uni-segmented-control>
|
|
</view>
|
|
<view class="content" style="background: #fff;">
|
|
<view v-show="current === 0">
|
|
<view class="container-box" v-for="(item,index) in pecsList" :key='index'>
|
|
<view class="prec-list">
|
|
<view class="prec-list-box" :style="{width:isPrint?'40%':'64%'}">
|
|
{{item.attributeList | sliceMsg}}
|
|
</view>
|
|
<view class="prec-list-box" style="font-size: 26rpx;width: 26%;">
|
|
数量:{{item.stockCount}}
|
|
</view>
|
|
<view>
|
|
<uni-number-box v-if="isPrint" v-model="item.productCount" max="10000"
|
|
@change="changeNumBtn(item)" style="margin-top: 10rpx;display: block;" />
|
|
<uni-icons type="close" @tap="delSpec(item)" v-if="isPrint == false" size="30" color="#777"></uni-icons>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view v-show="current === 1">
|
|
<view v-for="(item,index) in detailList" :key="index">
|
|
<view style="width: 100%;height: 80rpx;line-height: 80rpx;">
|
|
<text style="display:inline-block;width: 55%;text-align: center;font-weight: bold;font-size: 30rpx;">
|
|
{{item.createTime}}
|
|
</text>
|
|
<text style="display:inline-block;width: 45%;text-align: center;border-left: 1px solid #eee;">
|
|
操作:{{item.createByName}}
|
|
</text>
|
|
</view>
|
|
<uni-table border stripe emptyText="暂无更多数据">
|
|
<uni-tr style="background: #eee;">
|
|
<uni-th align="center" width="85">客户</uni-th>
|
|
<uni-th align="center" width="50">数量</uni-th>
|
|
<uni-th align="center" width="70">拿货价</uni-th>
|
|
<uni-th align="center" width="70">采购价</uni-th>
|
|
<uni-th align="center" width="70">总利润</uni-th>
|
|
</uni-tr>
|
|
<uni-tr @tap="xiaoshouDetail(item)">
|
|
<uni-td align="center">{{item.userName}}</uni-td>
|
|
<uni-td align="center">{{item.productCount}}</uni-td>
|
|
<uni-td align="center">{{item.saleDetailDTOList[0].discountAmount}}</uni-td>
|
|
<uni-td align="center">{{type == 0?(item.saleDetailDTOList[0].purchasePrice != null ? item.saleDetailDTOList[0].purchasePrice:0):0}}</uni-td>
|
|
<uni-td align="center">{{type == 0?item.lirun:0}}</uni-td>
|
|
</uni-tr>
|
|
</uni-table>
|
|
</view>
|
|
</view>
|
|
<view v-show="current === 2">
|
|
<view v-for="(item,index) in detailList" :key="index" @tap="goDetail(item)">
|
|
<view style="width: 100%;height: 80rpx;line-height: 80rpx;">
|
|
<text style="display:inline-block;width: 55%;text-align: center;font-weight: bold;font-size: 30rpx;">
|
|
{{item.purchase.createTime}}
|
|
</text>
|
|
<text style="display:inline-block;width: 45%;text-align: center;border-left: 1px solid #eee;">
|
|
操作:{{item.purchase.createByName}}
|
|
</text>
|
|
</view>
|
|
<uni-table border stripe emptyText="暂无更多数据">
|
|
<uni-tr style="background: #eee;">
|
|
<uni-th align="center" width="85">供应商</uni-th>
|
|
<uni-th align="center" width="50">数量</uni-th>
|
|
<uni-th align="center" width="70">进货价</uni-th>
|
|
<uni-th align="center" width="70">总价</uni-th>
|
|
</uni-tr>
|
|
<uni-tr>
|
|
<uni-td align="center">{{item.purchase.supplierName}}</uni-td>
|
|
<uni-td align="center" @tap.stop="rukuDetail(item.purchaseDetails[0])"><text style="color:blue;text-decoration: underline;">{{item.purchase.totalAmount}}</text></uni-td>
|
|
<uni-td align="center">{{type == 0?(item.purchaseDetails[0].purchasePrice==null?0:item.purchaseDetails[0].purchasePrice):0}}</uni-td>
|
|
<uni-td align="center">{{type == 0?item.purchaseDetails[0].zPrice:0}}</uni-td>
|
|
</uni-tr>
|
|
</uni-table>
|
|
</view>
|
|
</view>
|
|
<view v-show="current === 3">
|
|
<view v-for="(item,index) in detailList" :key="index">
|
|
<view style="width: 100%;height: 80rpx;line-height: 80rpx;">
|
|
<text style="display:inline-block;width: 55%;text-align: center;font-weight: bold;font-size: 30rpx;">
|
|
{{item.createTime}}
|
|
</text>
|
|
<text style="display:inline-block;width: 45%;text-align: center;border-left: 1px solid #eee;">
|
|
操作:{{item.createByName?item.createByName:''}}
|
|
</text>
|
|
</view>
|
|
<uni-table border stripe emptyText="暂无更多数据">
|
|
<uni-tr style="background: #eee;">
|
|
<uni-th align="center" width="85">客户</uni-th>
|
|
<uni-th align="center" width="50">数量</uni-th>
|
|
<uni-th align="center" width="70">退货价</uni-th>
|
|
<uni-th align="center" width="70">采购价</uni-th>
|
|
</uni-tr>
|
|
<uni-tr @tap="tuihuoDetail(item)">
|
|
<uni-td align="center">{{item.userName?item.userName:''}}</uni-td>
|
|
<uni-td align="center">{{item.returnSaleDetailList[0].productCount?item.returnSaleDetailList[0].productCount:'0'}}</uni-td>
|
|
<uni-td align="center">{{item.returnSaleDetailList[0].discountAmount?item.returnSaleDetailList[0].discountAmount:'0'}}</uni-td>
|
|
<uni-td align="center">{{type == 0?(item.returnSaleDetailList[0].purchasePrice?item.returnSaleDetailList[0].purchasePrice:'0'):0}}</uni-td>
|
|
</uni-tr>
|
|
</uni-table>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<!-- 打印选择框 -->
|
|
<uni-popup ref="payDialog" background-color="#fff">
|
|
<view class="popup-pay-content">
|
|
<view class="popup-pay-title" style="margin-top: 50rpx;">
|
|
<text>请选择需要打印的字段</text>
|
|
</view>
|
|
<view class="content-fur">
|
|
<view class="content-low" v-for="(item1,index1) in list" :key="index1"
|
|
@tap.stop="addMultipleType(item1)" :class="item1.checked?'checked':''">{{item1.type}}</view>
|
|
</view>
|
|
<view v-if="list[0].checked" style="display: flex;height: 80rpx;width: 100%;line-height: 80rpx;margin-top: 20rpx;">
|
|
<text style="display:inline-block;width:100rpx;font-size:22rpx;">
|
|
供应商:
|
|
</text>
|
|
<input v-model="dataList.supplierName" @change="changeText" type="text" placeholder="请输入供应商名称" style="display: flex;height: 80rpx;width: 300rpx;line-height: 80rpx;padding-left: 20rpx;border: 1px solid #eee;">
|
|
</view>
|
|
<view v-if="list[1].checked" style="display: flex;height: 80rpx;width: 100%;line-height: 80rpx;margin-top: 20rpx;">
|
|
<text style="display:inline-block;width:100rpx;font-size:22rpx;">
|
|
货号:
|
|
</text>
|
|
<input v-model="dataList.productSn" @change="changeText" type="text" placeholder="请输入货号" style="display: flex;height: 80rpx;width: 300rpx;line-height: 80rpx;padding-left: 20rpx;border: 1px solid #eee;">
|
|
</view>
|
|
<view v-if="list[2].checked" style="display: flex;height: 80rpx;width: 100%;line-height: 80rpx;margin-top: 20rpx;">
|
|
<text style="display:inline-block;width:100rpx;font-size:22rpx;">
|
|
零售价:
|
|
</text>
|
|
<input v-model="dataList.price" @change="changeText" type="digit" placeholder="请输入零售价" style="display: flex;height: 80rpx;width: 300rpx;line-height: 80rpx;padding-left: 20rpx;border: 1px solid #eee;">
|
|
</view>
|
|
<view v-if="list[3].checked" style="display: flex;height: 80rpx;width: 100%;line-height: 80rpx;margin-top: 20rpx;">
|
|
<text style="display:inline-block;width:100rpx;font-size:22rpx;">
|
|
批发价:
|
|
</text>
|
|
<input v-model="dataList.wholesalePrice" @change="changeText" type="digit" placeholder="请输入批发价" style="display: flex;height: 80rpx;width: 300rpx;line-height: 80rpx;padding-left: 20rpx;border: 1px solid #eee;">
|
|
</view>
|
|
<view class="popup-pay-container" @tap="clickPrint">
|
|
确认
|
|
</view>
|
|
</view>
|
|
</uni-popup>
|
|
<!-- 自定义打印选择框 -->
|
|
<uni-popup ref="zidingyiDialog" background-color="#fff">
|
|
<view class="popup-pay-content">
|
|
<view class="popup-pay-title" style="margin-top: 50rpx;">
|
|
<text>请选择需要打印的字段</text>
|
|
</view>
|
|
<view style="display: flex;height: 80rpx;width: 100%;line-height: 80rpx;margin-top: 20rpx;">
|
|
<text style="display:inline-block;width:100rpx;font-size:22rpx;">
|
|
颜色:
|
|
</text>
|
|
<input v-model="color" @change="changeText" type="text" placeholder="请输入颜色名" style="display: flex;height: 80rpx;width: 300rpx;line-height: 80rpx;padding-left: 20rpx;border: 1px solid #eee;">
|
|
</view>
|
|
<view style="display: flex;height: 80rpx;width: 100%;line-height: 80rpx;margin-top: 20rpx;">
|
|
<text style="display:inline-block;width:100rpx;font-size:22rpx;">
|
|
尺码:
|
|
</text>
|
|
<input v-model="size" @change="changeText" type="text" placeholder="请输入尺码值" style="display: flex;height: 80rpx;width: 300rpx;line-height: 80rpx;padding-left: 20rpx;border: 1px solid #eee;">
|
|
</view>
|
|
<view style="display: flex;height: 80rpx;width: 100%;line-height: 80rpx;margin-top: 20rpx;">
|
|
<text style="display:inline-block;width:100rpx;font-size:22rpx;">
|
|
数量:
|
|
</text>
|
|
<input v-model="number" @change="changeText" type="digit" placeholder="请输入数量" style="display: flex;height: 80rpx;width: 300rpx;line-height: 80rpx;padding-left: 20rpx;border: 1px solid #eee;">
|
|
</view>
|
|
<view class="content-fur">
|
|
<view class="content-low" v-for="(item1,index1) in list" :key="index1"
|
|
@tap.stop="addMultipleType(item1)" :class="item1.checked?'checked':''">{{item1.type}}</view>
|
|
</view>
|
|
<view v-if="list[0].checked" style="display: flex;height: 80rpx;width: 100%;line-height: 80rpx;margin-top: 20rpx;">
|
|
<text style="display:inline-block;width:100rpx;font-size:22rpx;">
|
|
供应商:
|
|
</text>
|
|
<input v-model="dataList.supplierName" @change="changeText" type="text" placeholder="请输入供应商名称" style="display: flex;height: 80rpx;width: 300rpx;line-height: 80rpx;padding-left: 20rpx;border: 1px solid #eee;">
|
|
</view>
|
|
<view v-if="list[1].checked" style="display: flex;height: 80rpx;width: 100%;line-height: 80rpx;margin-top: 20rpx;">
|
|
<text style="display:inline-block;width:100rpx;font-size:22rpx;">
|
|
货号:
|
|
</text>
|
|
<input v-model="dataList.productSn" @change="changeText" type="text" placeholder="请输入货号" style="display: flex;height: 80rpx;width: 300rpx;line-height: 80rpx;padding-left: 20rpx;border: 1px solid #eee;">
|
|
</view>
|
|
<view v-if="list[2].checked" style="display: flex;height: 80rpx;width: 100%;line-height: 80rpx;margin-top: 20rpx;">
|
|
<text style="display:inline-block;width:100rpx;font-size:22rpx;">
|
|
零售价:
|
|
</text>
|
|
<input v-model="dataList.price" @change="changeText" type="digit" placeholder="请输入零售价" style="display: flex;height: 80rpx;width: 300rpx;line-height: 80rpx;padding-left: 20rpx;border: 1px solid #eee;">
|
|
</view>
|
|
<view v-if="list[3].checked" style="display: flex;height: 80rpx;width: 100%;line-height: 80rpx;margin-top: 20rpx;">
|
|
<text style="display:inline-block;width:100rpx;font-size:22rpx;">
|
|
批发价:
|
|
</text>
|
|
<input v-model="dataList.wholesalePrice" @change="changeText" type="digit" placeholder="请输入批发价" style="display: flex;height: 80rpx;width: 300rpx;line-height: 80rpx;padding-left: 20rpx;border: 1px solid #eee;">
|
|
</view>
|
|
<view class="popup-pay-container">
|
|
<kk-printer ref="kkprinter" :bufferData="bufferData" @onPrint="onPrint1" :printNum="printNum" :defaultText="'打印'"></kk-printer>
|
|
</view>
|
|
</view>
|
|
</uni-popup>
|
|
<!-- 弹出商品规格 -->
|
|
<uni-popup ref="detailPopup" background-color="#fff">
|
|
<view style="width: 500rpx;min-height: 500rpx;max-height: 1000rpx;overflow: scroll;">
|
|
<view @tap="$refs.detailPopup.close()" style='width: 50rpx;height: 50rpx;position: absolute;right: 20rpx;top: 25rpx;'>
|
|
<uni-icons type="closeempty" color="red" size="22"></uni-icons>
|
|
</view>
|
|
<view style="height: 100rpx;line-height: 100rpx;font-weight: bold;font-size: 36rpx;text-align: center;">
|
|
|
|
</view>
|
|
<uni-table border stripe emptyText="暂无更多数据" style="margin-bottom: 20rpx;border-radius: 10px;">
|
|
<!-- 表头行 -->
|
|
<uni-tr style="background: #eee;">
|
|
<uni-th align="center" width="80">规格</uni-th>
|
|
<uni-th align="center" width="55">数量</uni-th>
|
|
</uni-tr>
|
|
<!-- 表格数据行 -->
|
|
<uni-tr v-for="(item,index) in GDList.stockLogList" :key="index">
|
|
<uni-td align="center">{{item.attributeList | sliceMsg}}</uni-td>
|
|
<uni-td align="center">{{item.productCount}}</uni-td>
|
|
</uni-tr>
|
|
</uni-table>
|
|
</view>
|
|
</uni-popup>
|
|
<!-- 弹出输入框 -->
|
|
<uni-popup ref="inputDialog" type="dialog">
|
|
<uni-popup-dialog ref="inputClose" mode="input" inputType="digit" title="采购价" placeholder="请输入采购价"
|
|
@confirm="changePrice"></uni-popup-dialog>
|
|
</uni-popup>
|
|
<view v-if="isPrint" class="bottom-btn">
|
|
<kk-printer ref="kkprinter" :bufferData="bufferData" @onPrint="onPrint" :printNum="printNum" :defaultText="'打印'"></kk-printer>
|
|
</view>
|
|
<!-- 右下角悬浮按钮 -->
|
|
<uni-fab v-if="!isPrint" ref="fab" :content="content" :horizontal="horizontal"
|
|
@trigger="trigger"/>
|
|
</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';
|
|
import base from '@/utils/ossUploadFile/base64.js';
|
|
export default {
|
|
data() {
|
|
return {
|
|
pageNum: 1, //分页的页码
|
|
pages:1,
|
|
dataList: [],
|
|
detailList:[],
|
|
GDList:[],
|
|
isPrint:false,
|
|
bufferData: [],
|
|
items:['库存', '销售明细', '入库明细','退货'],
|
|
current: 0,
|
|
horizontal: 'right',
|
|
pecsList:[],
|
|
defaultText:'',
|
|
type:uni.getStorageSync('type'),
|
|
size:'',
|
|
color:'',
|
|
number:'',
|
|
printNum:1,
|
|
list:[{
|
|
type:'供应商',
|
|
checked:false,
|
|
text:''
|
|
},{
|
|
type:'货号',
|
|
checked:false,
|
|
text:''
|
|
},{
|
|
type:'零售价',
|
|
checked:false,
|
|
text:''
|
|
},{
|
|
type:'批发价',
|
|
checked:false,
|
|
text:''
|
|
}],
|
|
multipleList:[],
|
|
content: [{
|
|
iconPath: '/static/images/tabbar/home.png',
|
|
selectedIconPath: '/static/images/tabbar/home-sel.png',
|
|
text: '自定打印',
|
|
active: false
|
|
},{
|
|
iconPath: '/static/images/tabbar/home.png',
|
|
selectedIconPath: '/static/images/tabbar/home-sel.png',
|
|
text: '删除商品',
|
|
active: false
|
|
}],
|
|
printList:new Map(),
|
|
yNum: 10,
|
|
}
|
|
},
|
|
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
|
|
},
|
|
onHide(){
|
|
setTimeout(res=>{
|
|
uni.closeBLEConnection({
|
|
deviceId:uni.getStorageSync('deviceId'),
|
|
success(res) {
|
|
},fail(err){
|
|
}
|
|
})
|
|
},5000)
|
|
},
|
|
onLoad(option) {
|
|
// 初始化蓝牙模块
|
|
wx.openBluetoothAdapter({mode: 'central'})
|
|
this.dataList = JSON.parse(option.item);
|
|
},
|
|
onReachBottom() {
|
|
if (this.pageNum >= this.pages) return;
|
|
this.status = 'loading';
|
|
this.pageNum ++;
|
|
this.getWaitStorage();
|
|
},
|
|
onShow(){
|
|
this.getShareList();
|
|
},
|
|
methods: {
|
|
getWaitStorage() {
|
|
this.status = 'loading';
|
|
var url;
|
|
if(this.current==1){ //销售
|
|
url = "/app/sale/getSaleListByProductId"
|
|
}else if(this.current==2){ //入库
|
|
url = "/app/purchase/getPurchaseListByProductId"
|
|
}else if(this.current==3){ //退货
|
|
url = "/app/return/getReturnSaleListByProductId"
|
|
}
|
|
this.tui.request(url, "post", {
|
|
productId: this.dataList.id,
|
|
pageSize: 10,
|
|
pageNum: this.pageNum
|
|
}, false, false).then((res) => {
|
|
this.status = 'nomore';
|
|
if (res.code == 200) {
|
|
// this.list = res.result.records
|
|
if (this.pages == 1) {
|
|
this.detailList = res.result.records
|
|
} else {
|
|
this.detailList = [...this.detailList, ...res.result.records]
|
|
|
|
}
|
|
if(this.current==1){
|
|
for(let i=0;i<this.detailList.length;i++){
|
|
this.detailList[i].lirun = 0
|
|
this.detailList[i].productCount = 0
|
|
for(let m=0;m<this.detailList[i].saleDetailDTOList.length;m++){
|
|
this.detailList[i].lirun += (this.detailList[i].saleDetailDTOList[m].discountAmount - this.detailList[i].saleDetailDTOList[m].purchasePrice) * this.detailList[i].saleDetailDTOList[m].stockLogList1[0].productCount
|
|
this.detailList[i].productCount += this.detailList[i].saleDetailDTOList[m].stockLogList1[0].productCount
|
|
}
|
|
}
|
|
}else if(this.current==2){
|
|
for(let i=0;i<this.detailList.length;i++){
|
|
for(let m=0;m<this.detailList[i].purchaseDetails.length;m++){
|
|
this.detailList[i].purchaseDetails[m].zPrice = this.detailList[i].purchaseDetails[m].productCount * this.detailList[i].purchaseDetails[m].purchasePrice
|
|
}
|
|
}
|
|
}else if(this.current==3){
|
|
for(let i=0;i<this.detailList.length;i++){
|
|
this.detailList[i].returnSaleDetailList[0].productCount = 0
|
|
for(let m=0;m<this.detailList[i].returnSaleDetailList[0].stockLogList1.length;m++){
|
|
this.detailList[i].returnSaleDetailList[0].productCount += this.detailList[i].returnSaleDetailList[0].stockLogList1[m].productCount
|
|
}
|
|
}
|
|
}
|
|
|
|
this.pages = res.result.pages
|
|
} else {
|
|
this.tui.toast(res.message)
|
|
}
|
|
}).catch((res) => {})
|
|
},
|
|
//库存商品详情
|
|
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) => {})
|
|
|
|
},
|
|
changeText(){
|
|
|
|
},
|
|
changeNumBtn(item){
|
|
if(this.printList.has(item.attributeList) == true){ // map中已经有当前值
|
|
if(item.productCount == 0){
|
|
this.printList.delete(item.attributeList)
|
|
}else{
|
|
this.printList.get(item.attributeList).productCount = item.productCount
|
|
}
|
|
}else{
|
|
this.printList.set(item.attributeList,item)
|
|
}
|
|
|
|
},
|
|
printBtn(){
|
|
this.$refs.payDialog.open('center')
|
|
|
|
},
|
|
//点击打印按钮
|
|
clickPrint() {
|
|
this.$refs.payDialog.close()
|
|
this.isPrint = !this.isPrint
|
|
},
|
|
rukuDetail(item){
|
|
console.log('item',item)
|
|
if(item){
|
|
item.stockLogList = []
|
|
for(let i=0;i<item.stockLogList1.length;i++){
|
|
item.stockLogList.push(item.stockLogList1[i])
|
|
}
|
|
this.GDList = item
|
|
this.$refs.detailPopup.open()
|
|
}
|
|
console.log('GDList',this.GDList)
|
|
},
|
|
xiaoshouDetail(item){
|
|
console.log('item',item)
|
|
if(item){
|
|
item.saleDetailDTOList[0].stockLogList = []
|
|
for(let i=0;i<item.saleDetailDTOList.length;i++){
|
|
item.saleDetailDTOList[0].stockLogList.push(item.saleDetailDTOList[i].stockLogList1[0])
|
|
}
|
|
this.GDList = item.saleDetailDTOList[0]
|
|
this.$refs.detailPopup.open()
|
|
}
|
|
},
|
|
tuihuoDetail(item){
|
|
console.log('item',item)
|
|
if(item){
|
|
item.returnSaleDetailList[0].stockLogList = []
|
|
for(let i=0;i<item.returnSaleDetailList[0].stockLogList1.length;i++){
|
|
item.returnSaleDetailList[0].stockLogList.push(item.returnSaleDetailList[0].stockLogList1[i])
|
|
}
|
|
this.GDList = item.returnSaleDetailList[0]
|
|
this.$refs.detailPopup.open()
|
|
}
|
|
},
|
|
onClickItem(e) {
|
|
this.pageNum = 1
|
|
this.detailList = []
|
|
if (this.current !== e.currentIndex) {
|
|
this.current = e.currentIndex
|
|
}
|
|
if(e.currentIndex == 0){
|
|
this.getShareList();
|
|
}else if(e.currentIndex == 1){
|
|
this.getWaitStorage('1')
|
|
}else if(e.currentIndex == 2){
|
|
this.getWaitStorage('2')
|
|
}else if(e.currentIndex == 3){
|
|
this.getWaitStorage('3')
|
|
}
|
|
},
|
|
//点击打印按钮
|
|
clickzidingyiPrint() {
|
|
this.$refs.zidingyiDialog.close()
|
|
// this.isPrint = !this.isPrint
|
|
},
|
|
//选择多个规格保存
|
|
addMultipleType(item1){
|
|
if(item1.type== '供应商'){
|
|
item1.text = this.dataList.supplierName
|
|
}else if(item1.type== '货号'){
|
|
item1.text = this.dataList.productSn
|
|
}else if(item1.type== '零售价'){
|
|
item1.text = this.dataList.price
|
|
}else if(item1.type== '批发价'){
|
|
item1.text = this.dataList.wholesalePrice
|
|
}
|
|
item1.checked = !item1.checked
|
|
if(this.multipleList == ''){
|
|
this.multipleList.push(item1.type)
|
|
}else{
|
|
for(var i=0;i<this.multipleList.length;i++){
|
|
if(this.multipleList[i] == item1.type){ //相同
|
|
this.multipleList.splice(i,1)
|
|
return;
|
|
}else{ //不同
|
|
if(i+1 == this.multipleList.length){
|
|
this.multipleList.push(item1.type)
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
},
|
|
//去新增商品页编辑
|
|
goToAddGoods(){
|
|
uni.navigateTo({
|
|
url: "/package1/inventory/addGoods?dataList="+JSON.stringify(this.dataList)
|
|
})
|
|
},
|
|
delSpec(item){
|
|
let that = this;
|
|
uni.showModal({
|
|
title: "提示",
|
|
content: "确定删除此条库存吗?",
|
|
success: function(res) {
|
|
if(res.confirm){
|
|
that.tui.request('/app/stock/deleteStockById', "post", {
|
|
id:item.id
|
|
}, false, true).then((res1) => {
|
|
if (res1.code == 200) {
|
|
uni.showToast({
|
|
title: "删除成功",
|
|
icon: 'none'
|
|
})
|
|
that.getShareList()
|
|
if(item.stockCount > 0){
|
|
that.dataList.stockCount = that.dataList.stockCount - item.stockCount
|
|
uni.removeStorageSync('noReload')
|
|
}
|
|
} else {
|
|
uni.showToast({
|
|
title: "删除失败",
|
|
icon: 'none'
|
|
})
|
|
}
|
|
})
|
|
}
|
|
}
|
|
})
|
|
},
|
|
sliceMsg(val) {
|
|
var name = ''
|
|
if (typeof(val) == 'string') {
|
|
let newObj = JSON.parse(val)
|
|
for (let as in newObj) {
|
|
name += newObj[as] + ' '
|
|
}
|
|
}
|
|
return name;
|
|
},
|
|
//计算打印机当前行高度
|
|
countPrint(){
|
|
return this.yNum += 50
|
|
},
|
|
onPrint(opt) {
|
|
let that = this
|
|
this.printList.forEach((item, index) => {
|
|
|
|
for(let i=0;i<item.productCount;i++){
|
|
that.yNum = 10
|
|
let strCmd = blesdk.CreatCPCLPage(410, 320, 1, 0);
|
|
strCmd += blesdk.addCPCLText('30', '10', '24', '0', 0, '商品名:'+that.dataList.productName)
|
|
if(that.multipleList.indexOf('货号') != -1){
|
|
strCmd += blesdk.addCPCLText('30', that.countPrint(), '24', '0', 0, '货 号:'+that.dataList.productSn)
|
|
}
|
|
strCmd += blesdk.addCPCLText('30', that.countPrint(), '24', '0', 0, '规 格:'+ that.sliceMsg(item.attributeList))
|
|
if(that.multipleList.indexOf('供应商') != -1){
|
|
strCmd += blesdk.addCPCLText('30', that.countPrint(), '24', '0', 0, '供应商:'+that.dataList.supplierName)
|
|
}
|
|
if(that.multipleList.indexOf('批发价') != -1){
|
|
strCmd += blesdk.addCPCLText('30', that.countPrint(), '24', '0', 0, '批发价:'+that.dataList.wholesalePrice)
|
|
}
|
|
if(that.multipleList.indexOf('零售价') != -1){
|
|
strCmd += blesdk.addCPCLText('30', that.countPrint(), '24', '0', 0, '零售价:'+that.dataList.price)
|
|
}
|
|
strCmd += blesdk.addCPCLQRCode(240, 160, 'H', '1', 4, [base.encode(that.dataList.id),base.encode(uni.getStorageSync('shopId'))]) //二维码
|
|
strCmd += blesdk.addCPCLLocation(0); //对齐指令 0-左对齐 1-右对齐 2-居中
|
|
strCmd += blesdk.addCPCLPrint();
|
|
that.bufferData.push(strCmd);
|
|
}
|
|
})
|
|
that.$nextTick(()=>{
|
|
uni.navigateBack({
|
|
delta: 1
|
|
})
|
|
})
|
|
},
|
|
goDetail(item){
|
|
// uni.setStorageSync('noReload',true)
|
|
uni.navigateTo({
|
|
url: '/package1/index/waitStorageDetail?id=' + item.purchase.id
|
|
})
|
|
},
|
|
onPrint1(opt) {
|
|
let that = this
|
|
if(this.color == '' || this.size == '' || this.number == ''){
|
|
this.tui.toast('请输入'+ (this.color == ''?'颜色':this.size == ''?'尺码':this.number == ''?'数量':'')+'再打印')
|
|
return
|
|
}
|
|
for(let i=0;i<this.number;i++){
|
|
that.yNum = 10
|
|
let strCmd = blesdk.CreatCPCLPage(410, 320, 1, 0);
|
|
strCmd += blesdk.addCPCLText('30', '10', '24', '0', 0, '商品名:'+that.dataList.productName)
|
|
if(that.multipleList.indexOf('货号') != -1){
|
|
strCmd += blesdk.addCPCLText('30', that.countPrint(), '24', '0', 0, '货 号:'+that.dataList.productSn)
|
|
}
|
|
strCmd += blesdk.addCPCLText('30', that.countPrint(), '24', '0', 0, '规 格:'+ this.color+' '+this.size)
|
|
if(that.multipleList.indexOf('供应商') != -1){
|
|
strCmd += blesdk.addCPCLText('30', that.countPrint(), '24', '0', 0, '供应商:'+that.dataList.supplierName)
|
|
}
|
|
if(that.multipleList.indexOf('批发价') != -1){
|
|
strCmd += blesdk.addCPCLText('30', that.countPrint(), '24', '0', 0, '批发价:'+that.dataList.wholesalePrice)
|
|
}
|
|
if(that.multipleList.indexOf('零售价') != -1){
|
|
strCmd += blesdk.addCPCLText('30', that.countPrint(), '24', '0', 0, '零售价:'+that.dataList.price)
|
|
}
|
|
strCmd += blesdk.addCPCLQRCode(240, 160, 'H', '1', 4, [base.encode(that.dataList.id),base.encode(uni.getStorageSync('shopId'))]) //二维码
|
|
strCmd += blesdk.addCPCLLocation(0); //对齐指令 0-左对齐 1-右对齐 2-居中
|
|
strCmd += blesdk.addCPCLPrint();
|
|
that.bufferData.push(strCmd);
|
|
}
|
|
that.$nextTick(()=>{
|
|
uni.navigateBack({
|
|
delta: 1
|
|
})
|
|
})
|
|
},
|
|
//悬浮按钮
|
|
trigger(e) {
|
|
if(e.index==0){ //自定义打印
|
|
this.$refs.zidingyiDialog.open();
|
|
}else{
|
|
this.delGoods()
|
|
}
|
|
},
|
|
delGoods(){
|
|
let that = this;
|
|
uni.showModal({
|
|
title: "提示",
|
|
content: "确定删除此条商品吗?",
|
|
success: function(res) {
|
|
if(res.confirm){
|
|
that.tui.request('/app/product/delById', "post", {
|
|
id:that.dataList.id
|
|
}, false, true).then((res1) => {
|
|
if (res1.code == 200) {
|
|
let pages = getCurrentPages();
|
|
let prevPage = pages[pages.length - 2];
|
|
let shopList = prevPage.$vm.shopList
|
|
for(let i=0;i<shopList.length;i++){
|
|
if(shopList[i].id == that.dataList.id){
|
|
shopList.splice(i, 1);
|
|
}
|
|
}
|
|
uni.navigateBack({
|
|
delta: 1
|
|
})
|
|
} else {
|
|
uni.showToast({
|
|
title: "删除失败",
|
|
icon: 'none'
|
|
})
|
|
}
|
|
})
|
|
}
|
|
}
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</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;
|
|
}
|
|
.noPic{
|
|
border-radius: 10px;
|
|
width: 150rpx;
|
|
height: 150rpx;
|
|
// margin: 30rpx 0 0 30rpx;
|
|
text-align: center;
|
|
line-height: 140rpx;
|
|
color: #777;
|
|
background: #eee;
|
|
}
|
|
.popup-pay-content {
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 15px;
|
|
width: 500rpx;
|
|
height: auto;
|
|
max-height: 1000rpx;
|
|
overflow: scroll;
|
|
background-color: #fff;
|
|
}
|
|
.popup-pay-title {
|
|
font-size: 30rpx;
|
|
font-weight: bold;
|
|
text-align: center;
|
|
position: relative;
|
|
border-bottom: 1px solid #eee;
|
|
padding-bottom: 20rpx;
|
|
}
|
|
.popup-pay-container {
|
|
margin-top: 40rpx;
|
|
height: 100rpx;
|
|
border-radius: 10px;
|
|
background: #088FEB;
|
|
line-height: 100rpx;
|
|
text-align: center;
|
|
border-bottom: 1px solid #eee;
|
|
border-top: 1px solid #eee;
|
|
color: #fff;
|
|
}
|
|
.checked{
|
|
background: #60F3FF;
|
|
color: #fff !important;
|
|
}
|
|
.content-fur {
|
|
padding-bottom: 25rpx;
|
|
border-bottom: 1px solid #eee;
|
|
}
|
|
|
|
.content-low {
|
|
width: auto;
|
|
border: 1px solid #eee;
|
|
display: inline-block;
|
|
min-width: 90rpx;
|
|
padding: 5rpx;
|
|
font-size: 35rpx;
|
|
text-align: center;
|
|
color: #777;
|
|
margin: 20rpx 0 0 20rpx;
|
|
}
|
|
.print-btn{
|
|
width: 100rpx;
|
|
height: 60rpx;
|
|
line-height: 60rpx;
|
|
color: #fff !important;
|
|
background: #0072E3;
|
|
position: absolute;
|
|
top: 30rpx;
|
|
right: 40rpx;
|
|
border-radius: 10px;
|
|
text-align: center;
|
|
}
|
|
.bottom-btn{
|
|
width: 200rpx;
|
|
height: 80rpx;
|
|
line-height: 80rpx;
|
|
color: #fff;
|
|
background: #0072E3;
|
|
border-radius: 80rpx;
|
|
text-align: center;
|
|
position: fixed;
|
|
bottom: 75rpx;
|
|
right: 0;
|
|
left: 0;
|
|
margin: auto;
|
|
}
|
|
</style>
|