wangfukang 3 years ago
parent
commit
5504f58fb5
  1. BIN
      package1/.DS_Store
  2. BIN
      package1/stock/.DS_Store
  3. 656
      package1/stock/addStock.vue
  4. 707
      package1/stock/addStockList.vue
  5. 239
      package1/stock/goodsStock.vue
  6. 279
      package1/stock/stockDetail.vue

BIN
package1/.DS_Store

Binary file not shown.

BIN
package1/stock/.DS_Store

Binary file not shown.

656
package1/stock/addStock.vue

@ -0,0 +1,656 @@
<template>
<view class="page1">
<view class="title-box">
<uni-search-bar class="uni-mt-10" radius="5" placeholder="商品名称/货号/供应商" cancelButton="none"
@confirm="search" />
</view>
<view class="content-box">
<view class="content-left">
<view class="left-box" v-for="(item, index) in indexList" :key="index"
:class="item.parentId ? 'left-box-hover':''" @tap="clickLeftBtn(index)">
<text style="width: 100%;height: 90rpx;line-height: 90rpx;display: inline-block;overflow: hidden;"
:class="item.parentId ? 'red' :''">{{item.categoryName}}</text>
</view>
</view>
<view class="content-right">
<view class="right-box" v-for="(item,index) in shopList" :key="index" @tap="toggle('bottom',item)">
<!-- 当商品的delFlag=0和未入库状态时,显示此遮罩,点击弹出弹窗提示不能操作 -->
<view class="shop-mask" v-if="item.delFlag == 0 || item.purchasePrice==null || item.inStorageStatus == 0" @tap.stop="clickMask"></view>
<view class="box-left">
<img class="img-radius" :src="item.productPicture" alt="" v-if="item.productPicture">
<view class="noPic" v-else>暂无图片</view>
</view>
<view class="box-right">
<view class="box-right-name">{{item.productName}}</view>
<view class="box-right-num">{{item.productSn}}</view>
<view class="box-right-price">
<view class="price-box" v-if="storageType== 0">
<text>{{item.inStorageStatus==0?'待入库':item.purchasePrice == null ?'新商品':item.purchasePrice}}</text>
<text>采购价</text>
</view>
<view class="price-box">
<text>{{item.wholesalePrice}}</text>
<text>批发价</text>
</view>
<view class="price-box">
<text>{{item.price}}</text>
<text>零售价</text>
</view>
<view class="price-box">
<text>{{item.stockCount}}</text>
<text>库存</text>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="bottom-box">
<view class="bottom-left" @tap="toggle('carPopup')">
<view class="bottom-left-box">
<uni-icons type="cart" size="20" color="#646566"></uni-icons>
<text class="uni-tab__text">已选择</text>
</view>
<text style="background-color:#ff0000;color:#fff;position: absolute;top: 0;right: 10rpx;"
class="uni-tab__dot">{{carList.size}}</text>
</view>
<view class="bottom-right">
<view class="bottom-btn" @tap="backPrevPage">选好了</view>
</view>
</view>
<!-- 购物车弹出层 -->
<uni-popup ref="carPopup" background-color="#fff">
<view class="popup-content">
<view v-for="(item,index) in stockList" :key="index" style="position: relative;">
<view class="popup-title">
<view class="popup-title-left">
<img class="img-radius" :src="item.productPicture" alt="" v-if="item.productPicture">
<view class="noPic" v-else>暂无图片</view>
</view>
<view class="popup-title-right">
<view class="popup-title-right-box" style="color: #088FEB;">{{item.productName}}</view>
<view class="popup-title-right-box">{{item.productSn}}</view>
<view class="popup-title-right-box">
<view style="position: absolute;top: 30rpx;right: 30rpx;" @tap.stop="delShop(item)">
<uni-icons color="red" type="trash" size="26"></uni-icons>
</view>
</view>
</view>
</view>
<view class="popup-container" v-for="(item1,index1) in item.checkStockAttributeVos" :key="index1">
<view class="checkList" style="padding-bottom:160rpx;">
<!-- <view style="margin-right:5%;" @tap="delShopSpec(item.id,item1.attributeList)">
<uni-icons color="red" type="minus" size="26"></uni-icons>
</view> -->
<view class="checkList-box">
{{item1.attributeList | sliceMsg}}
</view>
<view class="checkList-box">
{{item1.stockCount}}
</view>
<uni-number-box max="100000" v-model="item1.pdNum" />
</view>
</view>
</view>
<view class="popup-bottom">
<view class="popup-bottom-left">
<text>{{carType}} 款</text>
</view>
<view class="popup-bottom-right">
<view class="bottom-btn" @tap="this.$refs.carPopup.close()">关闭</view>
</view>
</view>
<u-loadmore :status="status" />
</view>
</uni-popup>
</view>
</template>
<script>
export default {
components: {},
data() {
return {
indexList: [],
status: 'loadmore',
pageNum: 1, //分页的页码
shopList: [],
pages: 1,
totalPages: 0,
info: 0,
categoryId: '', //分类id
searchName: '', //搜索框输入值
shopId: '', //店铺id,
carList: new Map(),
attributeList: [],
purchasePrice: 0,
storageType: '',
carType: 0,
type: '',
productId:'',
pdList:[],
stockList:[]
}
},
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
}
}
},
onReachBottom() {
if (this.pages >= this.totalPages) return;
this.status = 'loading';
this.pages = ++this.pages;
this.stockSelect();
},
onShow(){
let that = this;
this.pdList = this.pdList
if(this.pdList.saleDetailQueryDTO){
if (this.carList.size == 0) { //当前页没有数据
let obj = {
id: this.pdList.id,
productName: this.pdList.productName,
productPicture: this.pdList.productPicture,
productSn: this.pdList.productSn,
supplierName:this.pdList.supplierName,
stockLogList: new Map(),
}
for (let m = 0; m < this.pdList.saleDetailQueryDTO.length; m++) {
obj.stockLogList.set(this.pdList.saleDetailQueryDTO[m].attributeList, this.pdList.saleDetailQueryDTO[m])
}
this.carList.set(this.pdList.id, obj)
} else { //当前页有数据
if (this.carList.has(this.pdList.id) == true) { //商品相同
for (let m = 0; m < this.pdList.saleDetailQueryDTO.length; m++) {
this.carList.get(this.pdList.id).stockLogList.set(this.pdList.saleDetailQueryDTO[m].attributeList,this.pdList.saleDetailQueryDTO[m])
}
} else { //商品不同
let obj = {
id: this.pdList.id,
productName: this.pdList.productName,
productPicture: this.pdList.productPicture,
productSn: this.pdList.productSn,
supplierName:this.pdList.supplierName,
stockLogList: new Map(),
}
for (let m = 0; m < this.pdList.saleDetailQueryDTO.length; m++) {
obj.stockLogList.set(this.pdList.saleDetailQueryDTO[m].attributeList, this.pdList.saleDetailQueryDTO[m])
}
this.carList.set(this.pdList.id, obj)
}
}
}
console.log(this.carList)
},
onLoad() {
this.getGategoryList()
this.storageType = uni.getStorageSync('type')
},
methods: {
//初始化获取分类列表
getGategoryList() {
this.tui.request("/app/productCategory/list", "get", {}, false, true).then((res) => {
if (res.code == 200) {
this.indexList = res.result;
for (var i = 0; i < this.indexList.length; i++) {
if (i == 0) {
this.indexList[i].parentId = true
} else {
this.indexList[i].parentId = false
}
}
this.categoryId = this.indexList[0].id
this.getShareList(this.indexList[0].id);
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
},
//点击底部选好了,返回上一页
backPrevPage() {
var data = []
this.carList.forEach(item => {
console.log(item)
data.push(item)
item.stockLogList1 = []
item.stockLogList.forEach(item1 => {
item.stockLogList1.push(item1)
})
})
uni.navigateBack({
delta: 1
})
},
//点击分类获取商品列表
getShareList(id) {
this.tui.request("/app/product/getShareList", "POST", {
categoryId: this.categoryId,
searchStr: this.searchName,
pageNum: this.pageNum,
pageSize: '10'
}, false, false).then((res) => {
if (res.code == 200) {
this.shopList = res.result.records
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
},
//弹出购物车或者商品规格选择弹窗
toggle(type, item) {
if (type == 'carPopup') {
this.stockSelect()
this.$refs.carPopup.open('bottom')
} else {
this.productId = item.id
// this.checkGoods(item);
uni.navigateTo({
url: '/package1/stock/stockDetail?item=' + JSON.stringify(item)
})
}
},
stockSelect(){
this.stockList = []
this.tui.request("/app/checkStock/getCheckStock", "POST", {
checkStockId:uni.getStorageSync('stockId'),
pageNum:this.pages,
pageSize:10
}, false, false).then((res) => {
if (res.code == 200) {
if (this.pages == 1) {
this.stockList = res.result.checkStockDetailVoList.records
} else {
this.stockList = [...this.stockList, ...res.result.checkStockDetailVoList.records]
}
this.totalPages = res.result.pages
this.carType = this.stockList.length
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
},
//扫一扫功能
scanCode() {
uni.scanCode({
success: (res) => {
this.tui.request("/app/product/getById/" + res.result.split(',')[0], "POST", {}, false, true).then((res1) => {
if (res1.code == 200) {
let shopId = res.result.split(',')[1]
if(shopId == uni.getStorageSync('shopId')){
uni.navigateTo({
url: '/package1/stock/stockDetail?item=' + JSON.stringify(res1.result)
})
}else{
this.tui.toast('您的店铺中暂无该商品!')
}
} else {
this.tui.toast(res1.message)
}
}).catch((res) => {})
},
fail: (res) => {
uni.showToast({
title: '扫描失败',
icon: 'none'
})
}
})
},
//顶部搜索框
search(res) {
this.searchName = res.value
this.getShareList()
},
//点击左侧菜单切换
clickLeftBtn(index) {
for (var i = 0; i < this.indexList.length; i++) {
if (i == index) {
this.indexList[i].parentId = true
} else {
this.indexList[i].parentId = false
}
}
this.categoryId = this.indexList[index].id
this.getShareList(this.indexList[index].id)
},
//删除整条商品
delShop(item) {
var that = this;
uni.showModal({
title: "提示",
content: "确定删除此条商品吗?",
success: function(res) {
if (res.confirm) {
for (let i = 0; i < that.carList.length; i++) {
if (that.carList[i].id == item.id) {
that.carList.splice(i, 1)
}
}
that.carType = that.stockList.length
}
that.$forceUpdate()
}
})
}
}
}
</script>
<style lang="scss">
page {
height: 100%;
}
.page1 {
display: flex;
flex-direction: column;
height: 92%;
}
.uni-tab__dot {
padding: 0 4px;
line-height: 15px;
color: #ffffff;
text-align: center;
font-size: 12px;
background-color: #ff0000;
border-radius: 15px;
}
.popup-content {
align-items: center;
justify-content: center;
padding: 15px;
height: 1200rpx;
background-color: #fff;
margin-bottom: 30rpx;
overflow: scroll;
}
.popup-title-right-box {
height: 50rpx;
line-height: 50rpx;
}
.popup-title-right {
width: 400rpx;
margin-left: 30rpx;
}
.popup-title-left {
width: 150rpx;
height: 150rpx;
}
.popup-title-left image {
width: 150rpx;
height: 150rpx;
}
.popup-title {
display: flex;
height: 180rpx;
border-bottom: 1px solid #eee;
margin-top: 20rpx;
}
.popup-container {
width: 100%;
background: #fff;
height: 50rpx;
}
.uni-tab__text {
font-size: 12px;
color: #646566;
}
.title-box {
background: #fff;
}
.bottom-box {
width: 100%;
height: 120rpx;
position: fixed;
bottom: 0;
display: flex;
background: #fff;
z-index: 98;
}
.bottom-left {
width: 15%;
position: relative;
padding-top: 20rpx;
}
.bottom-right {
width: 85%;
padding-top: 20rpx;
.bottom-btn {
width: 85%;
line-height: 35px;
height: 70rpx;
text-align: center;
margin-top: 10rpx;
color: #fff;
font-size: 28rpx;
margin: 0 auto;
background: linear-gradient(90deg, #60F3FF, #088FEB);
border-radius: 70rpx;
}
}
.bottom-left-box {
display: flex;
flex-direction: column;
text-align: center;
}
.content-box {
background: #fff;
flex: 1;
display: flex;
}
.content-left {
width: 170rpx;
background: #eee;
height: 100%;
}
.left-box {
width: 100%;
height: 90rpx;
font-size: 30rpx;
text-align: center;
line-height: 90rpx;
border-bottom: 1px solid #fff;
}
.left-box-hover {
width: 100%;
height: 90rpx;
font-size: 30rpx;
text-align: center;
line-height: 90rpx;
border-bottom: 1px solid #fff;
background-color: #fff;
}
.red {
border-right: 3px solid red;
}
.content-right {
flex: 1;
overflow-y: scroll;
margin-bottom: 120rpx;
}
.right-box {
width: 100%;
height: 190rpx;
display: flex;
border-bottom: 1px solid #eee;
position: relative;
}
.box-left {
width: 130rpx;
height: 131rpx;
background-size: 100%;
margin: 25rpx 30rpx 35rpx 10rpx;
border-radius: 20rpx;
}
.box-left img {
width: 100%;
height: 100%;
}
.box-right {
margin-top: 17rpx;
}
.box-right-name {
font-size: 30rpx;
font-weight: bold;
}
.box-right-num {
padding: 5rpx 0;
color: #777;
}
.box-right-price {
display: flex;
font-size: 25rpx;
}
.price-box {
display: flex;
flex-direction: column;
margin-right: 20rpx;
}
.price-box text:first-child {
color: #ffa200
}
.uni-tab__cart-button-right,
.uni-tab__cart-sub-right {
display: none;
flex: none;
}
.name {
font-size: 30rpx;
width: 50%;
float: left;
height: 70rpx;
line-height: 70rpx;
}
.checkList {
display: flex;
height: 50rpx;
font-size: 28rpx;
line-height: 50rpx;
margin: 20rpx 0;
}
.checkList-box {
height: 50rpx;
width: 60%;
}
.popup-bottom {
width: 95%;
height: 100rpx;
position: fixed;
bottom: 0;
left: 2.5%;
display: flex;
z-index: 99;
background: #fff;
}
.popup-bottom-left {
width: 50%;
line-height: 80rpx;
}
.popup-bottom-right {
width: 50%;
line-height: 100rpx;
.bottom-btn {
width: 70%;
line-height: 35px;
height: 70rpx;
text-align: center;
/* margin-top: 10rpx; */
color: #fff;
font-size: 28rpx;
margin: 0 auto;
background: linear-gradient(90deg, #60F3FF, #088FEB);
border-radius: 70rpx;
}
}
.shop-mask {
width: 100%;
height: 190rpx;
position: absolute;
top: 0;
left: 0;
background: rgba(0, 0, 0, 0.1);
}
.noPic{
width: 150rpx;
height: 150rpx;
border-radius: 10px;
text-align: center;
line-height: 140rpx;
color: #777;
background: #eee;
}
button {
color: #ffffff !important;
background: #5fd9ee !important;
width: 90%;
// margin-top: 20upx;
}
</style>

707
package1/stock/addStockList.vue

@ -0,0 +1,707 @@
<!-- 新增库存页 -->
<template>
<view class="page1">
<view class="content">
<view class="content-box">
<view class="shop-box" style="position: fixed;top:0;z-index: 99;width:100%;border-bottom: 1px solid #eee;margin-bottom: 20rpx;">
<u-grid :col="2" border>
<u-grid-item index="add" @tap.stop="scanCodeAdd">
<u-icon name="scan" size="36"></u-icon>
<text>扫一扫</text>
</u-grid-item>
<u-grid-item @tap.stop="goodsAdd">
<u-icon name="plus" size="28"></u-icon>
<text>添加商品</text>
</u-grid-item>
</u-grid>
</view>
<view class="shop-box" style="border-top:5px solid #eee;margin-top: 132rpx;" v-for="(value,key) in Array.from(carList)"
:key="key">
<view class="shop-name">
<img class="img-radius" :src="value[1].productPicture" alt=""
style="width: 140rpx;height: 140rpx;margin: 30rpx 0 0 30rpx;">
<view class="shop-productName">
<view style="color:#FF5809;">品名:{{value[1].productName}} ({{value[1].productSn}})</view>
<view>单价:{{value[1].purchasePrice || 0}} 数量:{{value[1].productCount}}</view>
<view>总价:{{value[1].price}}</view>
</view>
</view>
<view class="tui-order-content">
<u-collapse>
<u-collapse-item v-for="(item,index) in returnList" :key="index" :title="item.returnSale.createTime"
:name="item.returnSale.saleId">
<view style="display: flex;border-bottom: 1px solid #eee;height: 50rpx;line-height: 50rpx;">
<view style="width: 49%;text-align: center;border-right: 1px solid #eee;">商品规格</view>
<view style="width: 50%;text-align: center;">总数量</view>
</view>
<view v-for="(items,index1) in item.purchaseDetails">
<view v-for="(data,index2) in items.stockLogList1" style='height: 50rpx;line-height: 50rpx;'>
<view style="width: 49%;text-align: center;border-right: 1px solid #eee;float: left;">
{{data.attributeList | sliceMsg}}
</view>
<view style="width: 50%;text-align: center;float: left;">
{{data.productCount}}
</view>
</view>
</view>
</u-collapse-item>
</u-collapse>
</view>
</view>
</view>
<view class="content-box" style="margin-bottom:110rpx;" :style="{'margin-top':(carList.size>0?0:132) + 'rpx' }">
<!-- 账号权限是否可以维护成本价格(主账号和被授权的账号可以维护),参数名:shop_admin_cost,维护在用户表中,存在前后端缓存里,把备注栏挪出来,谁都可以备注 -->
<view class="price-box-list">
<view class="content-list">
<view class="list-name">备注</view>
<view class="">
<textarea v-model="remark" />
</view>
</view>
</view>
</view>
</view>
<view class="bottom-box">
<view class="bottom-left">
<text>合计:{{totalAmount}}</text>
<text style="color: #ffa200;">¥{{shouldPay}}</text>
</view>
<view class="bottom-right">
<button class="bottom-btn" @tap='inventorySubmit'>入库</button>
</view>
</view>
<!-- 弹出层 -->
<view>
<uni-popup ref="shopPopup" background-color="#fff">
<view class="shop-popup-content">
<view class="shop-popup-title">
<view class="shop-popup-title-left">
<img class="img-radius" :src="goodsDetail.productPicture" alt="" v-if="goodsDetail.productPicture">
<view class="noPic" v-else>暂无图片</view>
</view>
<view class="shop-popup-title-right">
<view class="shop-popup-title-right-box" style="color: #088FEB;">{{goodsDetail.productName}}
</view>
<view class="shop-popup-title-right-box">{{goodsDetail.productSn}}</view>
</view>
</view>
<view class="shop-popup-container">
<ul style="border-top:20rpx;">
<li v-for="(items,index) in goodsDetail.attributeList" :key="index">
<view class="shop-title-fur">
<view class="shop-title-name">{{items.name}}</view>
</view>
<view class="shop-attrs">
<uni-data-checkbox v-model="value" :localdata="range"></uni-data-checkbox>
<text v-for="(itemTag, index1) in items.value" :key="index1"
@tap.stop="attrNameChange(index,index1) "
:class="itemTag.isChecked ? 'checkedText' : '' "> {{itemTag.value}}</text>
</view>
</li>
</ul>
<view style="padding-bottom: 100rpx;">
<view class="shop-checkList" v-for="(item,index) in temporaryList" :key="index">
<view @tap.stop="delCarData(index)" style="margin-right: 20rpx">
<uni-icons color="red" type="minus" size="26"></uni-icons>
</view>
<view class="shop-checkList-box">
<text style="width: 300rpx;display: inline-block;">{{item.name}}</text> <text style="color:#777;font-size: 12px;">库存:{{item.productNum}}</text>
</view>
<uni-number-box max='1000000' v-model="item.productCount" @change="temporaryChange" />
</view>
</view>
</view>
</view>
<view class="shop-popup-bottom" v-for="(item,index) in temporaryList" :key="index">
<view class="shop-popup-bottom-left">
<text>数量:{{zNum}} 件</text>
</view>
<view class="shop-popup-bottom-right">
<view class="bottom-btn" @tap="temporaryCheck">选好了</view>
</view>
</view>
</uni-popup>
</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 {
mapState
} from 'vuex';
export default {
computed: mapState(['shopName']),
data() {
return {
// 表单数据
formData: {
name: '',
manufacturer: '',
price: '',
single: ''
},
khName: [],
carList: new Map(),
remark: '',
otherPay: '',
noPay: 0,
alreadyPay: '',
realAmount: 0,
shouldPay: '',
totalAmount: 0,
index: '',
index1: '',
goodsDetail: [],
columns: [],
keyList: [],
temporaryList: [],
zNum: 0,
storageType:'',
productNum:0,
productId:''
}
},
filters: {
sliceMsg(val) {
var name = ''
if (typeof(val) == 'string') {
let newObj = JSON.parse(val)
for (let as in newObj) {
name += newObj[as] + '/'
}
}
return name;
}
},
onShow() {
let that = this;
this.khName = JSON.parse(JSON.stringify(this.khName)) || ''
if (this.carList.size == 0) { //当前页没有数据
for (let i = 0; i < this.carList1.length; i++) {
let obj = {
purchasePrice: "", //进货价
price: 0,
productCount: 0,
productId: this.carList1[i].id,
productName: this.carList1[i].productName,
productPicture: this.carList1[i].productPicture,
productSn: this.carList1[i].productSn,
stockLogList: new Map(),
stockLogList1: []
}
for (let m = 0; m < this.carList1[i].saleDetailQueryDTO.length; m++) {
obj.stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, this.carList1[i]
.saleDetailQueryDTO[m].productCount)
obj.productCount += this.carList1[i].saleDetailQueryDTO[m].productCount
}
this.carList.set(this.carList1[i].id, obj)
}
this.carList1 = []
} else { //当前页有数据
for (let i = 0; i < this.carList1.length; i++) {
if (this.carList.has(this.carList1[i].id) == true) { //商品相同
for (let m = 0; m < this.carList1[i].saleDetailQueryDTO.length; m++) {
if (this.carList.get(this.carList1[i].id).stockLogList.has(this.carList1[i].saleDetailQueryDTO[
m].attributeList) == true) { //规格相同
this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i].saleDetailQueryDTO[
m].attributeList, this.carList.get(this.carList1[i].id).stockLogList.get(this
.carList1[i].saleDetailQueryDTO[m].attributeList) + this.carList1[i]
.saleDetailQueryDTO[m].productCount)
} else { //规格不同
this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i].saleDetailQueryDTO[
m].attributeList, this.carList1[i].saleDetailQueryDTO[m].productCount)
}
this.carList.get(this.carList1[i].id).productCount += this.carList1[i].saleDetailQueryDTO[
m].productCount
}
} else { //商品不同
let obj = {
purchasePrice: "", //进货价
price: 0,
productCount: 0,
productId: this.carList1[i].id,
productName: this.carList1[i].productName,
productPicture: this.carList1[i].productPicture,
productSn: this.carList1[i].productSn,
stockLogList: new Map(),
stockLogList1: [],
name: ''
}
for (let m = 0; m < this.carList1[i].saleDetailQueryDTO.length; m++) {
obj.stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, this.carList1[i]
.saleDetailQueryDTO[m].productCount)
obj.name = this.carList1[i].saleDetailQueryDTO[m].name
obj.productCount += this.carList1[i].saleDetailQueryDTO[m].productCount
}
this.carList.set(this.carList1[i].id, obj)
}
this.carList.get(this.carList1[i].id).price = this.carList.get(this.carList1[i].id).purchasePrice * this.carList.get(this.carList1[i].id).productCount;
}
this.carList1 = []
}
this.getAllPrice()
},
onLoad() {
this.storageType = uni.getStorageSync('type')
},
methods: {
//扫一扫功能
scanCodeAdd() {
uni.scanCode({
success: (res) => {
if(res.scanType == "QR_CODE"){ //二维码
let shopId = res.result.split(',')[1]
if(shopId == uni.getStorageSync('shopId')){
this.productId = res.result.split(',')[0]
this.toggle('bottom', res.result.split(',')[0]);
if (item.saleDetailDTOList) {
for (let i = 0; i < item.saleDetailDTOList.length; i++) {
this.carList.push(item.saleDetailDTOList[i])
}
}
}else{
this.tui.toast('您的店铺中暂无该商品!')
}
}else{
this.productId = res.result
this.tui.request("/app/product/getByBarcode", "POST", {
barcode:res.result
}, false, true).then((res1) => {
if (res1.code == 200) {
if(res1.result == ''){
this.tui.toast('您的店铺中暂无该商品!')
}else{
this.toggle('bottom', res1.result[0].id);
if (item.saleDetailDTOList) {
for (let i = 0; i < item.saleDetailDTOList.length; i++) {
this.carList.push(item.saleDetailDTOList[i])
}
}
}
} else {
this.tui.toast(res.message)
}
}).catch((res) => {
this.tui.toast(res)
})
}
},
fail: (res) => {
uni.showToast({
title: '扫描失败',
icon: 'none'
})
}
})
},
goodsAdd() {
uni.navigateTo({
url: "/package1/stock/addStock"
})
},
//删除整条商品
delShop(id) {
var that = this;
uni.showModal({
title: "提示",
content: "确定删除此条商品吗?",
success: function(res) {
if(res.confirm){
that.tui.request("/app/checkStockDetail/deleteCheckStockDetail", "POST", {
categoryId: id
}, false, true).then((res1) => {
if (res1.code == 200) {
that.tui.toast("删除成功")
} else {
that.tui.toast(res.message)
}
}).catch((res) => {})
}
}
})
},
//确认盘点
inventorySubmit() {
uni.showModal({
title: "提示",
content: "请再次确认盘点信息是否正确。确认完成盘点吗?",
success: function(res) {
if(res.confirm){
that.tui.request("/app/checkStock/submitToStock", "post", {}, false, false).then((res) => {
if (res.code == 200) {
uni.showToast({
title: "盘点成功",
icon: 'none'
})
setTimeout(res=> {
uni.navigateBack({
delta: 1
})
},2000)
} else {
uni.showToast({
title: "盘点失败",
icon: 'none'
})
}
})
}
}
})
}
}
}
</script>
<style lang="scss" scoped>
page,
.page1 {
height: 100%;
}
.content {
border-top: 1px solid #eee;
overflow-y: scroll;
max-height: 100vh;
margin-bottom: 100rpx;
}
.content-box {
width: 100%;
height: auto;
background: #fff;
margin-bottom: 20rpx;
}
.content-list {
width: 95%;
margin: 0 auto;
display: flex;
height: 80rpx;
border-bottom: 1px solid #eee;
}
.content-list:last-child {
border-bottom: none;
height: auto;
}
.list-name {
width: 200rpx;
text-align: left;
line-height: 40px;
height: 80rpx;
padding-left: 20rpx;
}
.list-val {
width: 560rpx;
height: 80rpx;
line-height: 80rpx;
}
.list-val input {
width: 400rpx;
height: 60rpx;
display: inline-block;
line-height: 60rpx;
float: left;
margin-top: 10rpx;
padding-left: 20rpx;
border-bottom: 1px solid #088FEB;
}
.uni-data-select {
width: 80%;
text-align: center;
}
.uni-select {
border: none !important;
border-radius: 0 !important;
}
.uni-select__input-placeholder {
color: #6a6a6a;
font-size: 28rpx !important;
width: 400rpx;
}
.uni-select__input-box {
.uni-icons {
margin-left: 100rpx;
}
}
.shop-box {
width: 95%;
margin: 0 auto;
position: relative;
background: #fff;
}
.shop-name {
width: 100%;
height: 200rpx;
line-height: 80rpx;
border-top: 1px solid #eee;
border-bottom: 1px solid #eee;
font-size: 28rpx;
font-weight: bold;
display: flex;
.uni-icons {
color: #088FEB !important;
}
}
.shop-productName {
flex: 1;
display: flex;
flex-direction: column;
padding-left: 20rpx;
}
.shop-productName view {
height: 55rpx;
}
.shop-collapse {
display: flex;
height: 80rpx;
font-size: 26rpx;
line-height: 80rpx;
}
.shop-collapse text {
width: 40%;
text-align: center;
padding-right: 40rpx;
border-right: 1px solid #eee;
}
.price-box-title {
width: 95%;
height: 80rpx;
line-height: 80rpx;
margin: 0 auto;
display: flex;
text-align: center;
border-bottom: 1px solid #eee;
}
.price-box-title text {
flex: 1;
}
.uni-list-cell {
display: flex;
margin-right: 20rpx;
}
.bottom-box {
width: 100%;
position: absolute;
bottom: 0rpx;
display: flex;
background: #fff;
border-top: 1px solid #eee;
height: 110rpx;
}
.bottom-left {
flex: 1;
height: 110rpx;
line-height: 110rpx;
}
.bottom-right {
flex: 1;
height: 110rpx;
line-height: 110rpx;
}
.bottom-left text {
line-height: 84rpx;
display: inline-block;
padding-left: 20rpx;
}
.bottom-btn {
width: 320rpx;
background: linear-gradient(90deg, #60F3FF, #088FEB);
color: #fff;
border-radius: 50rpx;
height: 85rpx;
margin-top: 15rpx;
}
textarea {
margin: 20rpx;
border: 1px solid #eee;
height: 150rpx;
width: 500rpx;
}
.shop-popup-content {
align-items: center;
justify-content: center;
padding: 15px;
height: 1200rpx;
background-color: #fff;
margin-bottom: 30rpx;
overflow: scroll;
}
.shop-popup-title {
display: flex;
height: 180rpx;
border-bottom: 1px solid #eee;
margin-top: 20rpx;
}
.shop-popup-title-left {
width: 150rpx;
height: 150rpx;
}
.shop-popup-title-left img {
width: 150rpx;
height: 150rpx;
}
.shop-popup-title-right {
width: 400rpx;
margin-left: 30rpx;
}
.shop-popup-title-right-box {
height: 50rpx;
line-height: 50rpx;
}
.shop-popup-container {
width: 100%;
background: #fff;
height: 50rpx;
}
.shop-title-fur {
width: 95%;
height: 70rpx;
margin: 0 auto;
}
.shop-title-name {
font-size: 30rpx;
width: 50%;
float: left;
height: 70rpx;
line-height: 70rpx;
}
.shop-attrs {
text {
display: inline-block;
border: 1px solid #5fd9ee;
margin: 20rpx;
background-color: #fff;
color: #5fd9ee;
width: 100rpx;
line-height: 70rpx;
height: 70rpx;
text-align: center;
}
.checkedText {
background-color: $u-primary;
color: #fff;
}
}
.shop-checkList {
display: flex;
height: 50rpx;
font-size: 28rpx;
line-height: 50rpx;
margin: 20rpx 0;
}
.shop-checkList-box {
height: 50rpx;
width: 60%;
}
.shop-popup-bottom {
width: 95%;
height: 100rpx;
position: fixed;
bottom: 0;
left: 2.5%;
display: flex;
z-index: 99;
background: #fff;
}
.shop-popup-bottom-left {
width: 50%;
line-height: 80rpx;
}
.shop-popup-bottom-right {
width: 50%;
line-height: 100rpx;
.bottom-btn {
width: 70%;
line-height: 35px;
height: 70rpx;
text-align: center;
color: #fff;
font-size: 28rpx;
margin: 0 auto;
background: linear-gradient(90deg, #60F3FF, #088FEB);
border-radius: 70rpx;
}
}
.noPic{
border-radius: 10px;
width: 150rpx;
height: 150rpx;
// margin: 30rpx 0 0 30rpx;
text-align: center;
line-height: 140rpx;
color: #777;
background: #eee;
}
.tui-order-content {
width: 100%;
padding: 24rpx 30rpx;
box-sizing: border-box;
background: #fff;
font-size: 24rpx;
line-height: 30rpx;
}
.u-collapse-content {
display: flex;
justify-content: space-between;
line-height: 30px;
}
</style>

239
package1/stock/goodsStock.vue

@ -0,0 +1,239 @@
<template>
<view>
<view class="search" style="position: fixed;top: 0;z-index: 99;">
<button size="default" type="default" @tap="addStock" hover-class="is-hover">新增盘点</button>
<uni-datetime-picker style="margin-bottom:10px;" v-model="range" @change="searchList" type="daterange" />
</view>
<view class="formBox">
<u-alert description="点击可查看对应每笔盘点单" type="primary"></u-alert>
<view class="swipe-action">
<view class="swipe-action__content" @tap="onItemClick(item)" v-for="(item,index) in stockList" :key="index">
<view class="swipe-action__content__left">
<view class="swipe-action__content__text">{{ item.nickname == null ?'暂无':item.nickname}}</view>
</view>
<view class="swipe-action__content__right">
<view class="swipe-action__content__right__text">欠款总金额:</view>
<view class="swipe-action__content__right__money">{{ item.no_earn == null ?'暂无':item.no_earn }}
</view>
</view>
</view>
</view>
</view>
<u-loadmore :status="status" />
</view>
</template>
<script>
import {
mapState
} from 'vuex';
export default {
name: 'upstream',
computed: mapState(['userId', 'shopIndex']),
data() {
return {
choose: '1',
options1: [{
text: '编辑金额',
style: {
backgroundColor: '#3c9cff'
}
}],
popupShow: false,
status: 'loadmore',
shopName: '',
list: [],
pages: 1,
totalPages: 0,
range:[],
}
},
onShow() {
this.getList()
},
onReachBottom() {
if (this.pages >= this.totalPages) return;
this.status = 'loading';
this.pages = ++this.pages;
this.getOrderInfoList();
},
methods: {
getList() {
this.status = 'loading';
this.tui.request("/app/checkStock/getCheckStockList", "POST", {
startDate:this.range[0],
endDate:this.range[1],
pageNum:this.pages,
pageSize:10
}, false, false).then((res) => {
this.status = 'nomore';
if (res.code == 200) {
if (this.pages == 1) {
this.stockList = res.result.records
} else {
this.stockList = [...this.stockList, ...res.result.records]
}
this.totalPages = res.result.pages
} else {
this.tui.toast(res.message)
}
})
},
searchList(res) {
this.pages = 1;
this.stockList = [];
this.getList()
},
addStock(){
this.tui.request("/app/checkStock/addCheckStock", "POST", {}, false, false).then((res) => {
if (res.code == 200) {
uni.setStorageSync('stockId',res.result.id);
uni.navigateTo({
url: '/package1/stock/addStockList'
})
} else {
this.tui.toast(res.message)
}
})
},
onItemClick(target) {
uni.navigateTo({
url: `/pages/index/downarrears?userId=${target.userId}&nickname=${target.nickname}`
})
}
}
}
</script>
<style lang="scss" scoped>
.formBox {
.uni-data-select {
width: 100%;
}
.tui-order-title {
position: relative;
font-size: 28upx;
line-height: 28upx;
padding-left: 16upx;
box-sizing: border-box;
}
.tui-order-title::before {
content: '';
position: absolute;
left: 0;
top: 0;
border-left: 8upx solid $u-primary;
height: 120%;
border-radius: 4upx;
}
}
.tui-tabbar {
width: 100%;
height: 98rpx;
background: #fff;
position: fixed;
left: 0;
bottom: 0;
display: flex;
align-items: center;
justify-content: flex-end;
font-size: 26rpx;
box-shadow: 0 0 1px rgba(0, 0, 0, .3);
padding-bottom: env(safe-area-inset-bottom);
z-index: 996;
}
.u-page {
padding: 0;
}
.u-demo-block__title {
padding: 10px 0 2px 15px;
}
.swipe-action {
&__content {
background-color: #fff;
margin-bottom: 25rpx;
padding: 25rpx;
display: flex;
align-items: center;
justify-content: space-between;
&__left {
display: flex;
flex-direction: column;
align-items: center;
}
&__right {
display: flex;
align-items: center;
flex-basis: 300rpx;
justify-content: space-between;
&__text {
color: firebrick;
}
&__money {
flex-basis: 100rpx;
color: red;
text-align: right;
}
}
&__text {
padding: 12rpx 0;
width: 100%;
}
&__time {
font-size: 22rpx;
color: #3a3a3a;
}
&__icon {
flex-basis: 20rpx;
}
}
}
.edit-info {
height: 450 rpx;
padding: 25rpx;
.title {
text-align: center;
font-size: 32rpx;
}
.info-name {
display: flex;
align-items: center;
margin: 35rpx 0;
}
}
button {
color: #ffffff;
background: #5fd9ee;
width: 100%;
margin-bottom: 20rpx;
// margin-top: 20upx;
}
</style>
<style>
.u-radio {
margin: 15 upx 0;
}
.search {
padding: 20upx;
background-color: #fff;
width: 100%;
background-color: #fff;
}
</style>

279
package1/stock/stockDetail.vue

@ -0,0 +1,279 @@
<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="box-right-num" style="color:#ffa200;">
<text style="padding-right: 20rpx;">{{dataList.delFlag==1?'已上架':'已下架'}}</text>
</view>
</view>
</view>
</view>
<view style="display: flex;background: #fff;height: 70rpx;line-height: 70rpx;">
<view style="width: 53%;text-align: center;">规格</view>
<view style="width: 15%;text-align: center;">库存数</view>
<view style="width: 27%;text-align: center;">盘点数</view>
</view>
<view style="padding-bottom: 200rpx;">
<view class="container-box" v-for="(item,index) in pecsList" :key='index'>
<view class="prec-list">
<view class="prec-list-box" style="width: 53%;text-align: center;">
{{item.attributeList | sliceMsg}}
</view>
<view class="prec-list-box" style="width: 15%;font-size: 26rpx;">
{{item.stockCount}}
</view>
<view style="width: 27%;font-size: 26rpx;padding-top: 5px;">
<uni-number-box max='1000000' v-model="item.pdNum" />
</view>
</view>
</view>
</view>
<view class="bottom-box">
<button @tap="clickList">确认无误</button>
</view>
</view>
</template>
<script>
import util from '@/components/kk-printer/utils/util.js';
export default {
data() {
return {
pageNum: 1, //分页的页码
dataList: [],
pecsList:[],
}
},
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
}
}
},
onLoad(option) {
this.dataList = JSON.parse(option.item);
},
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
for(let i= 0;i<res.result.length;i++){
res.result[i].pdNum = res.result[i].stockCount
}
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
},
//点击选择列表,带参数 返回上一页
clickList() {
var data = []
for(let i=0;i<this.pecsList.length;i++){
if(this.pecsList[i].stockCount != this.pecsList[i].pdNum){
var item = {
attributeList:this.pecsList[i].attributeList,
stockCount:this.pecsList[i].stockCount,
pdNum:this.pecsList[i].pdNum
}
data.push(item)
}
}
console.log('第一个',data)
this.dataList.checkStockAttributeVos = data
console.log('二个',this.dataList)
let dataList = []
var itemData;
itemData = {
checkStockId:uni.getStorageSync('stockId'),
productId: this.dataList.id,
productName:this.dataList.productName,
productPicture:this.dataList.productPicture,
productSn:this.dataList.productSn,
checkStockAttributeVos:this.dataList.checkStockAttributeVos
}
dataList.push(itemData)
this.tui.request("/app/checkStockDetail/addCheckStockDetail", "POST", dataList, false, false).then((res) => {
if (res.code == 200) {
let pages = getCurrentPages();
let prevPage = pages[pages.length - 2];
prevPage.$vm.pdList = this.dataList
uni.navigateBack({
delta: 1
})
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
},
}
}
</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-left: 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;
}
.uni-numbox--text {
font-size: 40rpx !important;
}
.uni-numbox__value{
font-size: 35rpx !important;
}
.bottom-box{
width: 100%;
height: 150rpx;
background: #fff;
position: fixed;
bottom: 0;
z-index: 99;
}
button{
width: 95%;
background: #5fd9ee;
height: 80rpx;
color: #fff;
margin: 20rpx auto 0;
}
</style>
Loading…
Cancel
Save