wangfukang 3 years ago
parent
commit
4686aa6760
  1. 604
      pages/index/addStock.vue
  2. 196
      pages/index/goodsStock.vue
  3. 262
      pages/index/stockDetail.vue

604
pages/index/addStock.vue

@ -0,0 +1,604 @@
<template>
<view class="page1">
<view style="height: 150rpx;background: #fff;padding-top: 20rpx;">
<button size="default" type="default" @tap="scanCode" hover-class="is-hover">扫码盘点</button>
</view>
<!-- <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.length}}</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 carList" :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">
<text style="margin-right:20rpx;">供应商:{{item.supplierName}}</text>
<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.saleDetailQueryDTO" :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>
<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>
</view>
</uni-popup>
</view>
</template>
<script>
export default {
components: {},
data() {
return {
indexList: [],
pageNum: 1, //分页的页码
shopList: [],
info: 0,
categoryId: '', //分类id
searchName: '', //搜索框输入值
shopId: '', //店铺id,
carList: [],
attributeList: [],
purchasePrice: 0,
storageType: '',
carType: 0,
type: '',
productId:'',
pdList:[]
}
},
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
}
}
},
onShow(){
let that = this;
this.pdList = this.pdList
console.log('你好',this.pdList)
if(this.carList.length == 0){ //carList没有数据
this.carList.push(this.pdList)
}else{ //carList有数据
for(let i=0;i<this.carList.length;i++){
if(this.pdList.id == this.carList[i].id){ //相拼相同
for(let z=0;z<this.carList[i].saleDetailQueryDTO.length;z++){
for(let j=0;j<this.pdList.saleDetailQueryDTO.length;j++){
if(this.carList[i].saleDetailQueryDTO[z].attributeList == this.pdList.saleDetailQueryDTO[j].attributeList){ //规格相同
this.carList[i].saleDetailQueryDTO[z] = this.pdList.saleDetailQueryDTO[j]
}else{ //规格不同
this.carList[i].saleDetailQueryDTO.push(this.pdList.saleDetailQueryDTO[j])
}
}
}
}else{ //商品不同
this.carList.push(this.pdList)
}
}
}
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() {
let pages = getCurrentPages();
let prevPage = pages[pages.length - 2];
prevPage.$vm.carList1 = this.carList
prevPage.$vm.clearMsg = '1'
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.$refs.carPopup.open('bottom')
this.carType = this.carList.length
} else {
this.productId = item.id
// this.checkGoods(item);
uni.navigateTo({
url: '/pages/index/stockDetail?item=' + JSON.stringify(item)
})
}
},
//扫一扫功能
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: '/pages/index/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.carList.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>

196
pages/index/goodsStock.vue

@ -0,0 +1,196 @@
<template>
<view>
<view style="height: 150rpx;background: #fff;padding-top: 20rpx;">
<button size="default" type="default" @tap="addStock" hover-class="is-hover">新增盘点</button>
</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 list" :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>
</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,
shopName: '',
list: []
}
},
onShow() {
this.getList()
},
methods: {
getList() {
this.tui.request("/app/customer/debt", "POST", {}, false, true).then((res) => {
if (res.code == 200) {
this.list = res.result.records
} else {
this.tui.toast(res.message)
}
})
},
addStock(){
uni.navigateTo({
url: '/pages/index/addStock'
})
},
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: 90%;
// margin-top: 20upx;
}
</style>
<style>
.u-radio {
margin: 15 upx 0;
}
</style>

262
pages/index/stockDetail.vue

@ -0,0 +1,262 @@
<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.saleDetailQueryDTO = data
console.log('二个',this.dataList)
let pages = getCurrentPages();
let prevPage = pages[pages.length - 2];
prevPage.$vm.pdList = this.dataList
uni.navigateBack({
delta: 1
})
},
}
}
</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