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.
982 lines
28 KiB
982 lines
28 KiB
<!-- 新增库存页 -->
|
|
<template>
|
|
<view class="page1">
|
|
<view class="content">
|
|
<view class="content-box">
|
|
<view class="content-list">
|
|
<view class="list-name">供应商</view>
|
|
<view class="list-val">
|
|
<input type="text" placeholder="请选择供应商" disabled
|
|
style="border-bottom: 1px solid #fff;text-align: center;" :value="khName.consigneeName"
|
|
@tap="goPopleList('gysName')">
|
|
<uni-icons type="right" size="16" style="margin-left: 80rpx;line-height: 80rpx;"></uni-icons>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="content-box">
|
|
<view class="shop-box" style="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;" v-for="(value,key) in Array.from(carList)"
|
|
:key="key">
|
|
<view class="shop-name">
|
|
<img :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="shop-type">
|
|
<view class="shop-collapse" v-for="(values,keys) in Array.from(value[1].stockLogList)" :key="keys">
|
|
<view @tap.stop="delShopSpec(value[0],values[0])">
|
|
<uni-icons color="red" type="minus" size="26"></uni-icons>
|
|
</view>
|
|
<text>{{values[0] | sliceMsg}}</text>
|
|
<!-- <text style="color: red;">单价:¥{{item.price}}</text> -->
|
|
<view style="text-align: left;padding-left: 5px;width:50%;display: flex;">数量:<uni-number-box max="100000" style="margin-top:16rpx;" v-model="values[1]" @change="GoodsNumChange($event,value[0],values[0])" /></view>
|
|
</view>
|
|
<view
|
|
style="position: absolute;top: 130rpx;right: 40rpx;color: blue;text-decoration: underline;"
|
|
@tap="clickCollapse(value[0])" v-if='storageType==0'>
|
|
维护采购价
|
|
</view>
|
|
<view style="position: absolute;top: 30rpx;right: 30rpx;" @tap.stop="delShop(value[0])">
|
|
<uni-icons color="red" type="trash" size="26"></uni-icons>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="content-box" style="margin-bottom:110rpx;">
|
|
<!-- 账号权限是否可以维护成本价格(主账号和被授权的账号可以维护),参数名:shop_admin_cost,维护在用户表中,存在前后端缓存里,把备注栏挪出来,谁都可以备注 -->
|
|
<view class="price-box-list">
|
|
<view class="content-list" v-if='storageType==0'>
|
|
<view class="list-name">应付金额</view>
|
|
<view class="list-val">
|
|
<input type="text" placeholder="请输入应付金额" v-model="shouldPay">
|
|
</view>
|
|
</view>
|
|
<view class="content-list" v-if='storageType==0'>
|
|
<view class="list-name">已付金额</view>
|
|
<view class="list-val">
|
|
<input type="text" placeholder="请输入已付金额" v-model="alreadyPay" @blur="changePay">
|
|
</view>
|
|
</view>
|
|
<view class="content-list" v-if='storageType==0'>
|
|
<view class="list-name">欠款</view>
|
|
<view class="list-val">
|
|
<input type="text" v-model="noPay" disabled>
|
|
</view>
|
|
</view>
|
|
<view class="content-list" v-if='storageType==0'>
|
|
<view class="list-name">其他费用</view>
|
|
<view class="list-val">
|
|
<input type="text" v-model="otherPay">
|
|
</view>
|
|
</view>
|
|
<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 :src="goodsDetail.productPicture" alt="">
|
|
</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 class="popup-title-right-box" style="color: darkorange;"
|
|
@tap="inputDialogToggle('payDialog')">
|
|
<text style="margin-right:20rpx;">修改价格</text>
|
|
</view> -->
|
|
</view>
|
|
</view>
|
|
<view class="shop-popup-container">
|
|
<!-- <view class="shop-purchase-price" v-if="storageType == 0">
|
|
<view style="margin-right: 20rpx;">实际价格</view>
|
|
<uni-easyinput type="text" v-model="purchasePrice" placeholder="请输入实际价格" />
|
|
</view> -->
|
|
<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 class="shop-checkList" v-for="(item,index) in temporaryList" :key="index">
|
|
<view class="shop-checkList-box">
|
|
{{item.name}}
|
|
</view>
|
|
<uni-number-box max='1000000' v-model="item.productCount" @change="temporaryChange" />
|
|
</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>
|
|
</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:''
|
|
}
|
|
},
|
|
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) => {
|
|
this.toggle('bottom', res.result);
|
|
},
|
|
fail: (res) => {
|
|
uni.showToast({
|
|
title: '扫描失败',
|
|
icon: 'none'
|
|
})
|
|
}
|
|
})
|
|
},
|
|
goodsAdd() {
|
|
uni.navigateTo({
|
|
url: "/pages/inventory/changeGoods1"
|
|
})
|
|
},
|
|
attrNameChange(index, index1) {
|
|
this.goodsDetail.attributeList[index].value.forEach(item => {
|
|
item.isChecked = false;
|
|
})
|
|
this.goodsDetail.attributeList[index].isChecked = true;
|
|
this.goodsDetail.attributeList[index].value[index1].isChecked = true;
|
|
var name = '',
|
|
evalue = [],
|
|
obj = {}
|
|
for (var i = 0; i < this.goodsDetail.attributeList.length; i++) {
|
|
for (var m = 0, Ien = this.goodsDetail.attributeList[i].value; m < Ien.length; m++) {
|
|
if (Ien[m].isChecked == true) {
|
|
evalue.push(Ien[m].value)
|
|
name += Ien[m].value + '/'
|
|
}
|
|
}
|
|
}
|
|
this.keyList.map((item, index) => {
|
|
obj[item] = evalue[index]
|
|
})
|
|
let jishuqi = 0;
|
|
for (var i = 0; i < this.goodsDetail.attributeList.length; i++) {
|
|
if (this.goodsDetail.attributeList[i].isChecked == true) {
|
|
jishuqi++
|
|
}
|
|
}
|
|
if (this.goodsDetail.attributeList.length == jishuqi) {
|
|
this.attributeList = {
|
|
attributeList: JSON.stringify(obj),
|
|
productCount: this.temporaryNum,
|
|
name: name,
|
|
price: this.purchasePrice
|
|
}
|
|
|
|
for (let i = 0; i < this.goodsDetail.attributeList.length; i++) {
|
|
this.goodsDetail.attributeList[i].isChecked = false;
|
|
for (let m = 0; m < this.goodsDetail.attributeList[i].value.length; m++) {
|
|
this.goodsDetail.attributeList[i].value[m].isChecked = false
|
|
}
|
|
}
|
|
if (this.temporaryList.length == 0) {
|
|
this.temporaryList.push(this.attributeList);
|
|
} else {
|
|
for (var i = 0; i < this.temporaryList.length; i++) {
|
|
if (this.temporaryList[i].name.indexOf(this.attributeList.name) != -1) {
|
|
this.temporaryList[i] = this.attributeList
|
|
return
|
|
} else {
|
|
if (this.temporaryList.length == (i + 1)) {
|
|
this.temporaryList.push(this.attributeList);
|
|
return
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
//弹出商品规格选择
|
|
toggle(type, id) {
|
|
if (type == 'bottom') {
|
|
this.getById(id);
|
|
}
|
|
},
|
|
//通过商品id查询商品详细信息
|
|
getById(id) {
|
|
this.tui.request("/app/product/getById/" + id, "POST", {}, false, true).then((res) => {
|
|
if (res.code == 200) {
|
|
if(res.result.delFlag ==0){
|
|
this.tui.toast("请将商品上架后再操作!")
|
|
return
|
|
}
|
|
this.goodsDetail = res.result;
|
|
this.tui.request("/app/productAttribute/selectAttributeAndValueByCategoryId", "POST", {
|
|
categoryId: this.goodsDetail.categoryId
|
|
}, false, true).then((res1) => {
|
|
if (res1.code == 200) {
|
|
this.$refs.shopPopup.open('bottom')
|
|
if (typeof(res1.result) == 'string') {
|
|
let newObj = JSON.parse(res1.result)
|
|
let newArr = []
|
|
for (let val in newObj) {
|
|
let valueObj = [];
|
|
for (var i = 0; i < newObj[val].length; i++) {
|
|
valueObj.push({
|
|
value: newObj[val][i],
|
|
isChecked: false
|
|
})
|
|
}
|
|
newArr.push({
|
|
name: val,
|
|
value: valueObj
|
|
})
|
|
}
|
|
this.goodsDetail.attributeList = newArr;
|
|
this.goodsDetail.attributeList.forEach((item, index) => {
|
|
this.columns[index] = item.value;
|
|
this.keyList[index] = item.name;
|
|
})
|
|
}
|
|
|
|
} else {
|
|
this.tui.toast(res.message)
|
|
}
|
|
}).catch((res) => {})
|
|
} else {
|
|
this.tui.toast(res.message)
|
|
}
|
|
}).catch((res) => {})
|
|
},
|
|
temporaryChange(val) {
|
|
this.zNum = 0
|
|
for (var i = 0; i < this.temporaryList.length; i++) {
|
|
this.zNum += this.temporaryList[i].productCount
|
|
}
|
|
},
|
|
|
|
//弹窗选择规格后,点击弹窗中选好了按钮
|
|
temporaryCheck() {
|
|
let that = this,
|
|
carList1 = []
|
|
|
|
let data = {
|
|
id: this.goodsDetail.id,
|
|
price: 0,
|
|
num: this.zNum,
|
|
productName: this.goodsDetail.productName,
|
|
productSn: this.goodsDetail.productSn,
|
|
productPicture: this.goodsDetail.productPicture,
|
|
supplierName: this.goodsDetail.supplierName,
|
|
saleDetailQueryDTO: this.temporaryList
|
|
}
|
|
carList1.push(data)
|
|
this.temporaryList = []
|
|
this.purchasePrice = ''
|
|
this.zPrice = ''
|
|
this.zNum = ''
|
|
for (let i = 0; i < this.goodsDetail.attributeList.length; i++) {
|
|
this.goodsDetail.attributeList[i].isChecked = false;
|
|
for (let m = 0; m < this.goodsDetail.attributeList[i].value.length; m++) {
|
|
this.goodsDetail.attributeList[i].value[m].isChecked = false
|
|
}
|
|
}
|
|
if (this.carList.size == 0) { //当前页没有数据
|
|
for (let i = 0; i < carList1.length; i++) {
|
|
let obj = {
|
|
purchasePrice: "", //进货价
|
|
price: 0,
|
|
productCount: 0,
|
|
productId: carList1[i].id,
|
|
productName: carList1[i].productName,
|
|
productPicture: carList1[i].productPicture,
|
|
productSn: carList1[i].productSn,
|
|
stockLogList: new Map(),
|
|
stockLogList1: []
|
|
}
|
|
for (let m = 0; m < carList1[i].saleDetailQueryDTO.length; m++) {
|
|
obj.stockLogList.set(carList1[i].saleDetailQueryDTO[m].attributeList, carList1[i]
|
|
.saleDetailQueryDTO[m].productCount)
|
|
obj.productCount += carList1[i].saleDetailQueryDTO[m].productCount
|
|
}
|
|
this.carList.set(carList1[i].id, obj)
|
|
}
|
|
carList1 = []
|
|
} else { //当前页有数据
|
|
for (let i = 0; i < carList1.length; i++) {
|
|
if (this.carList.has(carList1[i].id) == true) { //商品相同
|
|
for (let m = 0; m < carList1[i].saleDetailQueryDTO.length; m++) {
|
|
if (this.carList.get(carList1[i].id).stockLogList.has(carList1[i]
|
|
.saleDetailQueryDTO[
|
|
m].attributeList) == true) { //规格相同
|
|
this.carList.get(carList1[i].id).stockLogList.set(carList1[i]
|
|
.saleDetailQueryDTO[
|
|
m].attributeList, this.carList.get(carList1[i].id).stockLogList.get(
|
|
carList1[i].saleDetailQueryDTO[m].attributeList) + carList1[i]
|
|
.saleDetailQueryDTO[m].productCount)
|
|
this.carList.get(carList1[i].id).productCount += carList1[i].saleDetailQueryDTO[
|
|
m].productCount
|
|
} else { //规格不同
|
|
this.carList.get(carList1[i].id).stockLogList.set(carList1[i]
|
|
.saleDetailQueryDTO[
|
|
m].attributeList, carList1[i].saleDetailQueryDTO[m].productCount)
|
|
this.carList.get(carList1[i].id).productCount += carList1[i].saleDetailQueryDTO[
|
|
m].productCount
|
|
}
|
|
}
|
|
} else { //商品不同
|
|
let obj = {
|
|
purchasePrice: "", //进货价
|
|
price: 0,
|
|
productCount: 0,
|
|
productId: carList1[i].id,
|
|
productName: carList1[i].productName,
|
|
productPicture: carList1[i].productPicture,
|
|
stockLogList: new Map(),
|
|
productSn: carList1[i].productSn,
|
|
stockLogList1: [],
|
|
name: ''
|
|
}
|
|
for (let m = 0; m < carList1[i].saleDetailQueryDTO.length; m++) {
|
|
obj.stockLogList.set(carList1[i].saleDetailQueryDTO[m].attributeList, carList1[i]
|
|
.saleDetailQueryDTO[m].productCount)
|
|
obj.name = carList1[i].saleDetailQueryDTO[m].name
|
|
obj.productCount += carList1[i].saleDetailQueryDTO[m].productCount
|
|
}
|
|
this.carList.set(carList1[i].id, obj)
|
|
}
|
|
}
|
|
carList1 = []
|
|
}
|
|
this.getAllPrice()
|
|
this.$refs.shopPopup.close()
|
|
|
|
},
|
|
//计算欠款
|
|
changePay() {
|
|
this.noPay = this.shouldPay - this.alreadyPay
|
|
},
|
|
//跳转选择供应商
|
|
goPopleList(popleType) {
|
|
uni.navigateTo({
|
|
url: '/pages/index/peopleList?popleType=' + popleType
|
|
})
|
|
},
|
|
//删除整条商品
|
|
delShop(id) {
|
|
var that = this;
|
|
uni.showModal({
|
|
title: "提示",
|
|
content: "确定删除此条商品吗?",
|
|
success: function(res) {
|
|
if(res.confirm){
|
|
if(that.carList.has(id) == true){
|
|
that.carList.delete(id)
|
|
}
|
|
that.getAllPrice()
|
|
that.$forceUpdate()
|
|
}
|
|
}
|
|
})
|
|
|
|
},
|
|
//删除商品下的某一个规格
|
|
delShopSpec(id,name) {
|
|
var that = this;
|
|
uni.showModal({
|
|
title: "提示",
|
|
content: "确定删除此条商品吗?",
|
|
success: function(res) {
|
|
if(res.confirm){
|
|
console.log(that.carList.get(id))
|
|
that.carList.get(id).productCount -= that.carList.get(id).stockLogList.get(name);
|
|
that.carList.get(id).stockLogList.delete(name)
|
|
that.carList.get(id).price = that.carList.get(id).productCount * that.carList.get(id).purchasePrice
|
|
if(that.carList.get(id).stockLogList.size == 0){
|
|
that.carList.delete(id)
|
|
}
|
|
|
|
that.getAllPrice()
|
|
}
|
|
that.$forceUpdate()
|
|
}
|
|
})
|
|
|
|
},
|
|
inventorySubmit() {
|
|
if (this.khName == '' || this.carList == '') {
|
|
uni.showToast({
|
|
title: "商品信息填写完成后入库!",
|
|
icon: 'none'
|
|
})
|
|
return
|
|
}else{
|
|
if(this.storageType==0 && this.shouldPay == 0){
|
|
uni.showToast({
|
|
title: "管理员必须维护价格!",
|
|
icon: 'none'
|
|
})
|
|
return
|
|
}
|
|
}
|
|
let that = this;
|
|
let purchase = {
|
|
alreadyPay: this.alreadyPay == ''?0:this.alreadyPay, //已付金额
|
|
noPay: this.noPay == ''?0:this.noPay, //欠款
|
|
shouldPay: this.shouldPay, //应付金额
|
|
totalAmount: this.totalAmount, //总数量
|
|
remark: this.remark,
|
|
otherPay:this.otherPay == ''?0:this.otherPay,
|
|
supplierId: this.khName.id, //供应商id和姓名
|
|
supplierName: this.khName.consigneeName
|
|
}
|
|
let purchaseDetails = [];
|
|
this.carList.forEach(function(value, key) {
|
|
value.stockLogList.forEach(function(values, keys) {
|
|
let obj = {
|
|
productCount: values,
|
|
attributeList: keys
|
|
}
|
|
value.stockLogList1.push(obj)
|
|
})
|
|
purchaseDetails.push(value)
|
|
})
|
|
this.tui.request("/app/stock/putInOfProduct", "post", {
|
|
purchase: purchase,
|
|
purchaseDetails: purchaseDetails
|
|
}, false, false).then((res) => {
|
|
if (res.code == 200) {
|
|
uni.showToast({
|
|
title: "入库成功",
|
|
icon: 'none'
|
|
})
|
|
uni.navigateBack({
|
|
delta: 2
|
|
})
|
|
} else {
|
|
uni.showToast({
|
|
title: "入库失败",
|
|
icon: 'none'
|
|
})
|
|
}
|
|
})
|
|
},
|
|
//编辑每一个的单价
|
|
clickCollapse(index) {
|
|
this.index = index
|
|
this.$refs.inputClose.val = ''
|
|
this.$refs.inputDialog.open()
|
|
},
|
|
//计算价格
|
|
changePrice(val) {
|
|
let that = this;
|
|
that.carList.get(that.index).purchasePrice = val
|
|
that.carList.get(that.index).price = val * that.carList.get(that.index).productCount;
|
|
this.getAllPrice()
|
|
|
|
},
|
|
//计算总金额和总数量
|
|
getAllPrice(){
|
|
let that = this;
|
|
this.shouldPay = 0
|
|
this.totalAmount = 0
|
|
this.carList.forEach(function(value, key) {
|
|
that.shouldPay = that.shouldPay + value.price
|
|
that.totalAmount = that.totalAmount + value.productCount
|
|
})
|
|
this.alreadyPay = this.shouldPay
|
|
that.noPay = this.shouldPay - this.alreadyPay
|
|
},
|
|
//修改已选规格的数量
|
|
GoodsNumChange(e,index,index1){
|
|
console.log(this.carList)
|
|
let that = this;
|
|
this.carList.get(index).stockLogList.set(index1,e)
|
|
this.carList.get(index).productCount = 0
|
|
this.carList.get(index).stockLogList.forEach(function(value, key) {
|
|
console.log(that.carList.get(index))
|
|
that.carList.get(index).productCount = that.carList.get(index).productCount + value
|
|
that.carList.get(index).price = that.carList.get(index).productCount * that.carList.get(index).purchasePrice
|
|
})
|
|
this.getAllPrice();
|
|
}
|
|
}
|
|
}
|
|
</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;
|
|
}
|
|
|
|
.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;
|
|
}
|
|
|
|
.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: 100%;
|
|
height: 100rpx;
|
|
position: fixed;
|
|
bottom: 0;
|
|
display: flex;
|
|
}
|
|
|
|
.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;
|
|
}
|
|
}
|
|
</style>
|