平板端快衣店
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.
 
 
 
 
 

1940 lines
60 KiB

<!-- 新增库存页 -->
<template>
<view class="page1">
<view class="content">
<view class="content-box" style="position: fixed;top:0;z-index: 99;width: 100%;">
<view class="content-list" @tap="goPopleList('gysName')">
<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">
<uni-icons type="right" size="16" style="margin-left: 80rpx;line-height: 80rpx;"></uni-icons>
</view>
</view>
<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>
<view class="content-box" style="margin-top: 212rpx;">
<view class="shop-box" style="border-top:5px solid #eee;" v-for="(value,key) in Array.from(carList)"
:key="key">
<view class="shop-name">
<view class="new-logo" v-if="value[1].isNew">新</view>
<view class="u-upload" v-if="value[1].isNew" @tap="uploadFilePromise(value)"></view>
<view class="" style="width: 140rpx;height: 140rpx;margin: 30rpx 0 0 30rpx;">
<img v-if="value[1].productPicture" class="img-radius" style="width: 140rpx;height: 140rpx;display: block;overflow: hidden;" :src="value[1].productPicture" alt="">
<view v-else style="width: 100%;height: 140rpx;border-radius: 10px;border: 1px solid #eee;line-height: 140rpx;text-align: center;">
<uni-icons type='plusempty' size='26'></uni-icons>
</view>
<view style="width: 140rpx;height:34rpx;line-height: 34rpx;display: flex;margin-top: 20rpx;">
<view @tap.stop="delShop(value[0])" style="background:#088FEB" class="left-btn">删除</view>
<view @tap="toggle('mergePopup',value[0])" class="left-btn" style="margin-left: 20rpx;">合并</view>
</view>
</view>
<view class="shop-productName">
<view style="position: absolute;top: 20rpx;right: 0;border: 1px solid #eee;width: 76rpx;height: 56rpx;line-height: 56rpx;border-radius: 5px;padding: 0 5rpx;color: #777;font-size: 26rpx;">
<uni-icons type="closeempty" size=""></uni-icons>
<text>{{value[1].productCount}}</text>
</view>
<view style="display: flex;height: 55rpx;line-height: 55rpx;">
品名:<input type="text" v-if="value[1].isNew" :value="value[1].productName" style="height: 55rpx;border-bottom: 1px solid #eee;color:#777;width: 318rpx;padding-left: 20rpx;">
<input type="text" v-else disabled :value="value[1].productName" style="height: 55rpx;border-bottom: 1px solid #eee;color:#777;width: 318rpx;padding-left: 20rpx;">
</view>
<view style="display: flex;height: 55rpx;line-height: 55rpx;">
货号:<input type="text" v-if="value[1].isNew" :value="value[1].productSn" style="height: 55rpx;border-bottom: 1px solid #eee;color:#777;width: 318rpx;padding-left: 20rpx;">
<input type="text" v-else disabled :value="value[1].productSn" style="height: 55rpx;border-bottom: 1px solid #eee;color:#777;width: 318rpx;padding-left: 20rpx;">
</view>
<view style="display: flex;height: 55rpx;line-height: 55rpx;" v-if="value[1].isNew">
分类: <text style="color: #777;padding-left: 20rpx;">{{value[1].categoryName}}</text>
<uni-icons type="compose" color="#777" size='25' @tap="toggle('typePopup',value[0])"></uni-icons>
</view>
<view style="display: flex;height: 55rpx;line-height: 55rpx;">
单价:<input type="number" v-model="value[1].purchasePrice" @blur="clickCollapse($event,value[0])" style="height: 55rpx;border-bottom: 1px solid #eee;color:#777;width: 300rpx;padding-left: 20rpx;">
</view>
<view style="display: flex;height: 55rpx;line-height: 55rpx;">
批发价: <input type="number" @blur="PriceAndWho($event,value[0],'pi')" v-model="value[1].wholesalePrice" style="height: 55rpx;border-bottom: 1px solid #eee;color:#777;width: 100rpx;padding-left: 20rpx;">
零售价:<input type="number" @blur="PriceAndWho($event,value[0])" v-model="value[1].lsprice" style="height: 55rpx;border-bottom: 1px solid #eee;color:#777;width: 100rpx;padding-left: 20rpx;">
</view>
<view @tap="AiAddSpec(value[1])" style="height: 27px;width: 70px;background: #088FEB;color: #fff;border-radius: 5px;text-align: center;position: absolute;top: 130rpx;right: 0px;line-height: 54rpx;">
添加规格
</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 @tap="checkSpec('颜色',value[0],values[0],numData(values[0])[0])">
{{numData(values[0])[0]}}
</text>
<text @tap="checkSpec('尺码',value[0],values[0],numData(values[0])[1])">
{{numData(values[0])[1]}}
</text>
<!-- <text style="color: red;">单价:¥{{item.price}}</text> -->
<view style="text-align: left;padding-left: 5px;width:40%;display: flex;"><uni-number-box
max="100000" style="margin-top:16rpx;" v-model="values[1].productCount"
@change="GoodsNumChange($event,value,values[0])" /></view>
</view>
</view>
</view>
</view>
<view class="content-box" style="margin-bottom:110rpx;">
<!-- 账号权限是否可以维护成本价格(主账号和被授权的账号可以维护),参数名:shop_admin_cost,维护在用户表中,存在前后端缓存里,把备注栏挪出来,谁都可以备注 -->
<view class="price-box-list">
<view class="content-list">
<view class="list-name">应付金额</view>
<view class="list-val">
<input type="text" placeholder="请输入应付金额" v-model="shouldPay" @blur="changessPrice($event)">
</view>
</view>
<view class="content-list">
<view class="list-name">已付金额</view>
<view class="list-val">
<input type="text" placeholder="请输入已付金额" v-model="alreadyPay" @blur="changePay($event)">
</view>
</view>
<view class="content-list">
<view class="list-name">欠款</view>
<view class="list-val">
<input type="text" v-model="noPay" disabled>
</view>
</view>
<view class="content-list">
<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 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" style="position: relative;">
<view @tap="saveCheck" style="position: absolute;top: 20rpx;right: 20rpx;color: #088FEB;text-decoration: underline;">
保存已选
</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,itemTag.value,index1)"
:class="itemTag.isChecked ? 'checkedText' : '' "> {{itemTag.value}}</text>
</view>
</li>
</ul>
<view style="padding-bottom: 100rpx;">
<view class="shop-checkList" v-if="temporaryList != ''">
<view class="shop-checkList-box" style="width:67%;">
<text style="width: 300rpx;display: inline-block;font-size: 30rpx;font-weight: bold;padding-left: 40rpx;">规格</text>
<text style="font-size: 30rpx;color: #000;font-weight: bold;width: 110rpx;display: inline-block;text-align: right;">库存</text>
</view>
<uni-number-box max='1000000' @minus='minusNum' @plus="plusNum" v-model="allChangeNum" @blur="allChange" />
</view>
<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">
<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="typePopup" background-color="#fff" :is-mask-click="true">
<view class="type-popup" style="margin-bottom: 0;">
<view style="height: 80rpx;font-size: 36rpx;font-weight: bold;line-height: 80rpx;text-align: center;">
选择分类
</view>
<view style="position: absolute;bottom: 0;height: 90rpx;width: 100%;background: #fff;z-index: 99;">
<view @tap="toggle('addGateDialog')" style="width: 95%;height: 70rpx;line-height: 70rpx;text-align: center;background: linear-gradient(90deg, #60F3FF, #088FEB);border-radius: 5px;color: #fff;margin: 10rpx auto 0;">
新增分类
</view>
</view>
<view style="overflow: scroll;height: 630rpx;padding-bottom: 90rpx;">
<view v-for="(item,index) in indexList" :key="index" @tap="clickGategroy(item)" style="height: 80rpx;font-size: 32rpx;width: 90%;line-height:80rpx;margin: 0 auto;border-top: 1px solid #eee;">
<view style="width: 89%;padding-left: 20rpx;float:left">{{item.categoryName}}</view>
<uni-icons type="right" size="18"></uni-icons>
</view>
</view>
</view>
</uni-popup>
<!-- 新增分类输入框 -->
<uni-popup ref="addGateDialog" type="dialog">
<uni-popup-dialog ref="inputClose" mode="input" title="新增分类" placeholder="请输入分类名称"
@confirm="addGategory"></uni-popup-dialog>
</uni-popup>
<!-- 弹出合并商品 -->
<uni-popup ref="mergePopup" background-color="#fff" :is-mask-click="true">
<view class="type-popup" style="max-height: 1000rpx;overflow: scroll;margin-bottom: 0;border-radius: 0;">
<view style="height: 80rpx;font-size: 36rpx;font-weight: bold;line-height: 80rpx;text-align: center;">
请选择要合并到的商品
</view>
<view class="shop-box" v-for="(value,key) in Array.from(carList)" :key="key" v-if="value[1].id != mergeId" @tap="clickMerge(value[0])">
<view class="shop-name" style="height: 150rpx;">
<view class="" style="width: 100rpx;height: 100rpx;margin: 20rpx 0 0 20rpx;font-size: 22rpx;">
<img v-if="value[1].productPicture" class="img-radius" style="width: 100rpx;height: 100rpx;display: block;overflow: hidden;" :src="value[1].productPicture" alt="">
<view v-else class="img-radius" style="width: 100rpx;height: 100rpx;display: block;overflow: hidden;text-align: center;line-height: 100rpx;border: 1px solid #eee;">暂无图片</view>
</view>
<view class="shop-productName" style="height: 130rpx;">
<view style="display: flex;height: 55rpx;line-height: 55rpx;">
{{value[1].productName}}
</view>
<view style="display: flex;height: 55rpx;line-height: 55rpx;">
货号:{{value[1].productSn}}
</view>
</view>
</view>
</view>
<view style="line-height: 80rpx;font-size: 22rpx;color: #777;text-align: center;">
没有要合并的商品?那就去库存里看看吧~ ↓↓
</view>
<view @tap="goChooseGoods" style="width: 100%;height: 70rpx;line-height: 70rpx;text-align: center;border-radius: 0;background: linear-gradient(90deg, #60F3FF, #088FEB);color: #fff;">
<view>同库存商品合并</view>
</view>
</view>
</uni-popup>
<!-- 弹出规格选择 -->
<uni-popup ref="getaPopup" background-color="#fff" :is-mask-click="true">
<view class="type-popup" style="margin-bottom: 0;border-radius: 0;">
<view style="height: 80rpx;font-size: 36rpx;font-weight: bold;line-height: 80rpx;text-align: center;">
修改当前规格
</view>
<view style="text-align:center;color:red;font-size: 22rpx;">*如果当前规格中没有您想要的,可以手动输入</view>
<view class="card-list">
<ul>
<li v-for="items in attrList" :key="items.id">
<view class="title-fur">
<view class="name">{{items.attributeName}}</view>
<view class="rightBox">
<u-icon size="20" name="plus" color="#5fd9ee"
@tap="inputDialogToggle(items.id) "></u-icon>
</view>
</view>
<view class="content-fur">
<view class="content-low" v-for="item in attributeValue" :key="item.id"
@tap="changeSpec(item.value)">{{item.value}}</view>
</view>
</li>
</ul>
</view>
<view style="color: #333;width: 90%;margin: 0 auto 20rpx;">
<uni-easyinput v-model="specifications" placeholder="请输入规格值"></uni-easyinput>
</view>
<view @tap="changeSpec(specifications)" style="width: 100%;height: 70rpx;line-height: 70rpx;text-align: center;border-radius: 0;background: linear-gradient(90deg, #60F3FF, #088FEB);color: #fff;">
<view>确认修改</view>
</view>
</view>
</uni-popup>
<uni-popup ref="inputDialog" type="dialog">
<uni-popup-dialog ref="inputClose" mode="input" :title="dialogTit" :value="inputVal" placeholder="请输入名称"
@confirm="dialogInputConfirm" @close="dialogClose">
</uni-popup-dialog>
</uni-popup>
</view>
</template>
<script>
import {
mapState
} from 'vuex';
export default {
computed: mapState(['shopName']),
data() {
return {
allChangeNum:0,
khName: [],
carList: new Map(),
remark: '',
otherPay: '',
noPay: 0,
alreadyPay: '',
realAmount: 0,
shouldPay: '',
totalAmount: 0,
index: '',
index1: '',
goodsDetail: [],
columns: [],
keyList: [],
temporaryList: [],
zNum: 0,
carList1: [],
productNum: 0,
productId: '',
pageOldTemList: [],
oldTemList: [],
attrList: [],
goodsList: [],
mergeId:'',
newTemList: [],
pecsList: [],
dataObj: new Map(),
isPlusAndMinus:false,
indexList:[],
attributeValue:[],
specifications:'',
temporary:[] //修改单个规格值临时存放要修改的对象
}
},
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() {
uni.showLoading({
title: '加载中...'
})
let that = this,
isTrue = false
if(this.merge ==1){
this.$refs.mergePopup.close();
if(this.carList.has(this.carList1.id) == true){ //跟当前页面有相同的商品
that.carList.get(that.mergeId).stockLogList.forEach(function(value1, key1) {
that.carList.get(that.carList1.id).stockLogList.forEach(function(value, key) {
if(key1 == key){
that.carList.get(that.carList1.id).stockLogList.get(key).productCount =
that.carList.get(that.carList1.id).stockLogList.get(key).productCount + value1.productCount
isTrue = true
that.carList.get(that.carList1.id).productCount += value1.productCount
}
})
if(isTrue == false){
that.carList.get(that.carList1.id).stockLogList.set(key1,value1)
that.carList.get(that.carList1.id).productCount += value1.productCount
}
})
}else{
this.carList.get(this.mergeId).productId = this.carList1.id
this.carList.get(this.mergeId).id = this.carList1.id
this.carList.get(this.mergeId).productName = this.carList1.productName
this.carList.get(this.mergeId).productPicture = this.carList1.productPicture
this.carList.get(this.mergeId).productSn = this.carList1.productSn
this.carList.get(this.mergeId).categoryId = this.carList1.categoryId
this.carList.get(this.mergeId).wholesalePrice=this.carList1.wholesalePrice || 0
this.carList.get(this.mergeId).lsprice= this.carList1.price || 0
this.carList.get(this.mergeId).isNew=false
this.carList.set(this.carList1.id,this.carList.get(this.mergeId))
}
this.carList.delete(this.mergeId)
this.getAllPrice()
setTimeout(res => {
uni.hideLoading();
}, 300)
this.$forceUpdate()
this.merge = 0
return;
}
if(uni.getStorageSync('carList1') != ''){
this.carList1 = uni.getStorageSync('carList1')
}else{
this.carList1 = this.carList1
}
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: this.carList1[i].purchasePrice || 0, //进货价
price1: 0,
price:this.carList1[i].price,
productCount: 0,
id:this.carList1[i].id,
isNew:this.carList1[i].isNew,
productId: this.carList1[i].productId == null ? '' : this.carList1[i].productId,
productName: this.carList1[i].productName,
wholesalePrice: this.carList1[i].wholesalePrice || 0,
categoryName:'',
categoryId:this.carList1[i].categoryId,
lsprice: this.carList1[i].price || 0,
productPicture: this.carList1[i].productPicture,
productSn: this.carList1[i].productSn,
stockLogList: new Map(),
stockLogList1: []
}
// let attrMap = new Map()
// let newSaleDetailDTOList = []
// for(let m = 0; m < item.saleDetailDTOList[i].stockLogList1.length; m++){
// if(attrMap.has(item.saleDetailDTOList[i].stockLogList1[m].attributeList) == true){
// let hasCount = attrMap.get(item.saleDetailDTOList[i].stockLogList1[m].attributeList)
// let trueCount = hasCount.split('-')[0]
// let lastConut = Number(trueCount) + Number(item.saleDetailDTOList[i].stockLogList1[m].productCount)
// newSaleDetailDTOList[hasCount.split('-')[1]].productCount = lastConut
// }else{
// newSaleDetailDTOList.push(item.saleDetailDTOList[i].stockLogList1[m])
// attrMap.set(item.saleDetailDTOList[i].stockLogList1[m].attributeList,item.saleDetailDTOList[i].stockLogList1[m].productCount+'-'+m)
// }
// }
// obj.saleDetailQueryDTO = newSaleDetailDTOList
for (let m = 0; m < this.carList1[i].saleDetailQueryDTO.length; m++) {
let productCount = this.carList1[i].saleDetailQueryDTO[m].productCount
if(obj.stockLogList.has(this.carList1[i].saleDetailQueryDTO[m].attributeList) ==true){
productCount += obj.stockLogList.get(this.carList1[i].saleDetailQueryDTO[m].attributeList).productCount
}
var data1 = {
productCount: productCount,
name: this.carList1[i].saleDetailQueryDTO[m].name
}
obj.stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, data1)
obj.productCount += this.carList1[i].saleDetailQueryDTO[m].productCount
obj.price1 = obj.productCount * this.carList1[i].purchasePrice
}
let id = this.carList1[i].isNew ==true ?this.carList1[i].id : this.carList1[i].productId
this.carList.set(id, obj)
that.carList.get(id).price = that.carList.get(id).purchasePrice *
that.carList.get(id).productCount;
}
this.carList1 = []
} else { //当前页有数据
console.log('111')
for (let i = 0; i < this.carList1.length; i++) {
let id = this.carList1[i].isNew == true ? this.carList1[i].id : this.carList1[i].productId
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) { //规格相同
var data1 = {
productCount: this.carList.get(this.carList1[i].id).stockLogList.get(this.carList1[i].saleDetailQueryDTO[m].attributeList).productCount + this.carList1[i].saleDetailQueryDTO[m].productCount,
name: this.carList1[i].saleDetailQueryDTO[m].name
}
this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, data1)
console.log('aaaaaa',this.carList)
} else { //规格不同
var data1 = {
productCount: this.carList1[i].saleDetailQueryDTO[m].productCount,
name: this.carList1[i].saleDetailQueryDTO[m].name
}
this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i].saleDetailQueryDTO[
m].attributeList, data1)
}
this.carList.get(this.carList1[i].id).productCount += this.carList1[i].saleDetailQueryDTO[
m].productCount
}
} else { //商品不同
let obj = {
purchasePrice: this.carList1[i].purchasePrice || 0, //进货价
price1: 0,
price:this.carList1[i].price,
productCount: 0,
id:this.carList1[i].id,
productId: this.carList1[i].productId == null ? '' : this.carList1[i].productId,
isNew:this.carList1[i].isNew,
productName: this.carList1[i].productName,
wholesalePrice: this.carList1[i].wholesalePrice || 0,
categoryName:'',
categoryId:this.carList1[i].categoryId,
lsprice: this.carList1[i].price || 0,
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++) {
var data1 = {
productCount: this.carList1[i].saleDetailQueryDTO[m].productCount,
name: this.carList1[i].saleDetailQueryDTO[m].name
}
obj.stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, data1)
obj.name = this.carList1[i].saleDetailQueryDTO[m].name
obj.productCount += this.carList1[i].saleDetailQueryDTO[m].productCount
obj.price1 = obj.productCount * this.carList1[i].purchasePrice
}
this.carList.set(id, obj)
}
that.carList.get(id).price = that.carList.get(id).purchasePrice *
that.carList.get(id).productCount;
}
}
this.$nextTick(()=>{
this.carList1 = []
uni.removeStorageSync('carList1')
this.getAllPrice()
if(this.carList1 != ''){
setTimeout(res => {
uni.hideLoading();
}, 2000)
}else{
setTimeout(res => {
uni.hideLoading();
}, 300)
}
this.$forceUpdate()
})
},
onLoad(options) {
},
methods: {
numData(val){
var name = []
if (typeof(val) == 'string') {
let newObj = JSON.parse(val)
for (let as in newObj) {
name.push(newObj[as])
}
}
return name;
},
checkSpec(type,id,attr,value){
if(this.carList.get(id).categoryId == '' || this.carList.get(id).categoryId == null){
this.tui.toast('请先选择商品分类')
return;
}
this.temporary = [id,attr,type,value]
let num = type == '颜色' ? 0 : 1
this.getGategoryLowList()
},
//初始化获取子分类列表
getGategoryLowList() {
this.attrList = []
let num = this.temporary[2] == '颜色' ? 0 : 1
this.tui.request("/app/productAttribute/selectByCategoryId", "POST", {
categoryId: this.carList.get(this.temporary[0]).categoryId
}, false, true).then((res1) => {
if (res1.code == 200) {
this.attrList.push(res1.result[num])
if (res1.result.length > 0) {
this.attributeValue = []
this.tui.request(
"/app/productAttributeValue/selectByAttributeId",
"get", {
id: this.attrList[0].id
}, false, true).then((res2) => {
if (res2.code == 200) {
this.attributeValue = res2.result;
this.$forceUpdate()
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
}
setTimeout(() => {
this.showList = this.attrList;
}, 1000)
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
this.$forceUpdate()
this.$refs.getaPopup.open()
},
//点击某一个规格,可修改
changeSpec(item){
let that = this;
if(item == ''){
this.tui.toast('请输入要修改的规格值')
return;
}
let data = this.temporary
let specMap = new Map() //新的临时存放值那个更改过的值的数组
this.carList.get(data[0]).stockLogList.forEach(function(value, key) {
if(key == data[1]){
let stringKey = key.replace(data[3],item) //拿到了更改过的key
specMap.set(stringKey,value) //name的值没有改,所有的数组都放在这个下面
that.carList.get(data[0]).stockLogList.delete(data[1])
}
})
if(this.carList.get(data[0]).stockLogList.size > 0){
this.carList.get(data[0]).stockLogList.forEach(function(value, key) {
specMap.set(key,value)
})
}
this.carList.get(data[0]).stockLogList = specMap
this.$forceUpdate()
this.$refs.getaPopup.close()
},
inputDialogToggle(item) {
this.inputVal = '';
this.isOpenId = item;
this.$refs.inputDialog.open()
},
//保存已选
saveCheck() {
this.pageOldTemList = this.temporaryList
for (var i = 0; i < this.goodsDetail.attributeList.length; i++) {
this.goodsList[i].specs = []
for (var m = 0; m < this.goodsDetail.attributeList[i].value.length; m++) {
this.goodsDetail.attributeList[i].value[m].isChecked = false
}
}
},
dialogInputConfirm(e) {
if (e == '') {
uni.showToast({
title: "不能为空!",
icon: 'none'
})
return
}
this.tui.request("/app/productAttributeValue/save", "post", {
value: e,
attributeId: this.isOpenId
}, false, true).then((res) => {
if (res.code == 200) {
this.getGategoryLowList()
this.$forceUpdate()
uni.showToast({
title: "添加成功",
icon: 'none'
})
} else {
uni.showToast({
title: res.message,
icon: 'none'
})
}
}).catch((res) => {})
this.$refs.inputClose.val = ''
},
dialogClose() {
this.inputVal = '';
this.$refs.inputClose.val = ''
},
combination(arr) {
let result = [
[]
]
arr.map(x => {
var res = []
result.map(y => {
x.specs.map(z => {
res.push([...y, z])
})
})
result = res
})
return result;
},
//获取分类列表
getGategoryList() {
this.tui.request("/app/productCategory/list", "get", {
}, false, true).then((res) => {
if (res.code == 200) {
this.indexList = res.result;
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
},
//扫一扫功能
scanCodeAdd() {
let that = this;
uni.scanCode({
success: (res) => {
if (res.scanType == "QR_CODE") { //二维码
let shopId = res.result.split(',')[1]
if (shopId == uni.getStorageSync('shopId')) {
that.productId = res.result.split(',')[0]
that.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 {
that.tui.toast('您的店铺中暂无该商品!')
}
} else {
that.tui.request("/app/product/getByBarcode", "POST", {
barcode: res.result
}, false, true).then((res1) => {
if (res1.code == 200) {
that.productId = res1.result[0].id
if (res1.result == '') {
that.tui.toast('您的店铺中暂无该商品!')
} else {
that.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 {
that.tui.toast(res.message)
}
}).catch((res) => {
that.tui.toast(res)
})
}
},
fail: (res) => {
uni.showToast({
title: '扫描失败',
icon: 'none'
})
}
})
},
uploadFilePromise(value) {
let that = this;
uni.chooseMedia({
count: 1,
mediaType: ['image'],
sourceType: ['album', 'camera'],
camera: 'back',
success(res) {
uni.uploadFile({
url: 'https://dev.xenjoyou.com/hiver/upload/file',
filePath: res.tempFiles[0].tempFilePath,
name: 'file',
header: {
"content-type": "multipart/form-data",
'accessToken': that.tui.getToken()
},
formData: {},
success: (uploadFileRes) => {
that.carList.get(value[0]).productPicture = ''
let path = JSON.parse(uploadFileRes.data)
//后端返回的地址,存入图片地址
that.carList.get(value[0]).productPicture = path.result
that.$forceUpdate()
}
});
}
})
},
goodsAdd() {
uni.navigateTo({
url: "/pages/inventory/changeGoods1"
})
},
mergeGoods(){
},
addGategory(e){
let multipleList = [{
attributeName:'颜色',
productAttributeValueVoList:[{
checked: true,
value: "均色"
}]
},{
attributeName:'尺码',
productAttributeValueVoList:[{
checked: true,
value: "均码"
}]
}]
this.tui.request("/app/productCategory/batchSaveCategoryAndAttribute", "post", {
categoryName: e,
productAttributeOfAddVos:multipleList
}, false, false).then((res) => {
if (res.code == 200) {
this.getGategoryList()
uni.showToast({
title:"添加成功",
icon: 'none'
})
} else {
uni.showToast({
title:"添加失败",
icon: 'none'
})
}
}).catch((res) => {})
},
allChange(e){
//监听到输入框改变,给所有的都赋值
if(this.isPlusAndMinus == false){
for(var i=0;i<this.temporaryList.length;i++){
this.temporaryList[i].productCount = Number(e.detail.value)
}
}
this.isPlusAndMinus == false
this.temporaryChange()
},
plusNum(){
this.isPlusAndMinus == true
//监听到点击+的操作,给所有的都+1
for(var i=0;i<this.temporaryList.length;i++){
if(this.temporaryList[i].productCount == undefined){
this.temporaryList[i].productCount = 1
}else{
this.temporaryList[i].productCount++
}
}
this.temporaryChange()
},
minusNum(){
this.isPlusAndMinus == true
//监听到点击-的操作,给所有的都-1
for(var i=0;i<this.temporaryList.length;i++){
this.temporaryList[i].productCount--
}
this.temporaryChange()
},
goChooseGoods(){
uni.navigateTo({
url: '/package1/AI/AiChangeGoods'
})
},
attrNameChange(index, data1, index1) {
let that= this;
uni.showLoading({
title: '加载中...'
})
this.goodsDetail.attributeList[index].isChecked = !this.goodsDetail.attributeList[index].isChecked;
this.goodsDetail.attributeList[index].value[index1].isChecked = !this.goodsDetail.attributeList[index]
.value[index1].isChecked;
if (this.goodsList[index].specs.indexOf(data1) != -1) {
this.goodsList[index].specs.splice(this.goodsList[index].specs.indexOf(data1), 1)
} else {
this.goodsList[index].specs.push(data1)
}
let jishuqi = 0
for (var i = 0; i < this.goodsList.length; i++) {
if (this.goodsList[i].specs.length > 0) {
jishuqi++
}
}
var resultList = []
if (jishuqi == this.goodsList.length) {
resultList = this.combination(this.goodsList);
}
var evalue = []
var value = []
for (var m = 0; m < resultList.length; m++) {
var name = ''
let value1 = "{"
for (var j = 0; j < resultList[m].length; j++) {
if (j != resultList[m].length - 1) {
name += resultList[m][j] + '/'
value1 += '"' + this.dataObj.get(resultList[m][j]) + '":"' + resultList[m][j] + '",'
} else {
name += resultList[m][j]
value1 += '"' + this.dataObj.get(resultList[m][j]) + '":"' + resultList[m][j] + '"'
}
}
value1 += "}"
value.push(value1)
evalue.push(name)
}
if (jishuqi == 0) {
this.oldTemList = []
}
if (this.temporaryList.length == 0) {
if (jishuqi == this.goodsList.length) {
for (var i = 0; i < value.length; i++) {
this.attributeList = {
attributeList: value[i],
productCount: this.temporaryNum,
productNum: this.productNum,
name: evalue[i],
price: this.purchasePrice
}
this.temporaryList.push(this.attributeList);
}
}
} else {
let newProductCount = 0;
for (var i = 0; i < value.length; i++) {
for (var m = 0; m < this.temporaryList.length; m++) {
if (this.temporaryList[m].attributeList == value[i]) {
newProductCount = this.temporaryList[m].productCount
}
}
this.attributeList = {
attributeList: value[i],
productCount: newProductCount,
productNum: this.productNum,
name: evalue[i],
price: this.purchasePrice
}
this.newTemList.push(this.attributeList);
newProductCount = 0;
}
for (var i = 0; i < this.oldTemList.length; i++) {
let oldAttributeList = '';
let oldProductCount = '';
let notChcek = true;
for (var m = 0; m < this.newTemList.length; m++) {
if (this.oldTemList[i].attributeList == this.newTemList[m].attributeList) {
this.newTemList[m].productCount = this.oldTemList[i].productCount
notChcek = false;
}
}
if (this.newTemList.length > 0 && notChcek) {
this.newTemList.push(this.oldTemList[i]);
}
}
for (var i = 0; i < this.pageOldTemList.length; i++) {
let oldAttributeList = '';
let oldProductCount = '';
let notChcek = true;
for (var m = 0; m < this.newTemList.length; m++) {
if (this.pageOldTemList[i].attributeList == this.newTemList[m].attributeList) {
this.newTemList[m].productCount = this.pageOldTemList[i].productCount
notChcek = false;
}
}
if (this.newTemList.length > 0 && notChcek) {
this.newTemList.push(this.pageOldTemList[i]);
}
}
}
this.$nextTick(() => {
for (var i = 0; i < that.temporaryList.length; i++) {
for (var m = 0; m < that.pecsList.length; m++) {
if (that.temporaryList[i].attributeList == that.pecsList[m].attributeList) {
that.temporaryList[i].productNum = that.pecsList[m].stockCount
}
}
}
})
if (jishuqi != this.goodsList.length) {
if (this.oldTemList.length == 0 && this.pageOldTemList.length == 0) {
this.newTemList = []
this.temporaryList = []
}
}
if (this.newTemList.length != 0 && jishuqi == this.goodsList.length) {
this.temporaryList = this.newTemList;
this.oldTemList = []
this.newTemList = []
}
setTimeout(res => {
uni.hideLoading();
}, 200)
},
clickGategroy(item){
this.carList.get(this.productId).categoryName = item.categoryName
this.carList.get(this.productId).categoryId = item.id
this.$forceUpdate()
this.$refs.typePopup.close()
},
//弹出商品规格选择
toggle(type, id) {
if (type == 'bottom') {
uni.showLoading({
title: '加载中...'
})
this.allChangeNum = 0
this.getById(id);
}else if(type== 'typePopup'){
this.productId = id
this.getGategoryList()
this.$refs.typePopup.open()
}else if(type== 'addGateDialog'){
this.$refs.addGateDialog.open()
}else if(type== "mergePopup"){
this.mergeId = id
this.$refs.mergePopup.open()
}
},
//合并已有
clickMerge(value,key){
let that = this;
this.carList.get(this.mergeId).stockLogList.forEach(function(values, keys) {
if(that.carList.get(value).stockLogList.has(keys)){
that.carList.get(value).stockLogList.get(keys).productCount += that.carList.get(that.mergeId).stockLogList.get(keys).productCount
}else{
that.carList.get(value).stockLogList.set(keys,that.carList.get(that.mergeId).stockLogList.get(keys))
}
that.carList.get(value).productCount += that.carList.get(that.mergeId).stockLogList.get(keys).productCount
that.carList.get(value).price1 = that.carList.get(value).productCount * that.carList.get(value).purchasePrice
})
this.carList.delete(this.mergeId)
this.$forceUpdate()
this.getAllPrice()
this.$refs.mergePopup.close()
},
AiAddSpec(value){
console.log(value)
if(value.categoryId == '' || value.categoryId == null){
this.tui.toast('请先选择商品分类')
return;
}
this.getById(value,1);
},
//通过商品id查询商品详细信息
getById(id,current) {
let that = this;
console.log(id)
if(current == 1){
that.goodsDetail = id;
}else{
this.tui.request("/app/product/getById/" + id, "POST", {}, false, true).then((res) => {
if (res.code == 200) {
if (res.result.delFlag == 0) {
that.tui.toast("请将商品上架后再操作!")
return
}
that.goodsDetail = res.result;
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
}
this.pageOldTemList = []
that.temporaryList = []
if (that.carList.size > 0) {
// let isTrue = false
that.carList.forEach(function(value, key) {
value.stockLogList.forEach(function(values, keys) {
if(value.stockLogList1.length == 0){
let obj = {
productCount: values.productCount,
name: values.name,
attributeList: keys,
productNum: that.productNum
}
value.stockLogList1.push(obj)
}else{
for(var i=0;i<value.stockLogList1.length;i++){
if(value.stockLogList1[i].attributeList != keys){
if(value.stockLogList1.length == (i+1)){
let obj = {
productCount: values.productCount,
name: values.name,
attributeList: keys,
productNum: that.productNum
}
value.stockLogList1.push(obj)
}
}
}
}
})
})
that.zNum = 0
that.$nextTick(() => {
that.carList.forEach(function(value, key) {
if (value.productId == id) {
that.zNum = value.productCount
that.temporaryList = value.stockLogList1
that.pageOldTemList = value.stockLogList1
that.oldTemList = value.stockLogList1
}
value.stockLogList1 = []
})
})
}
this.tui.request("/app/productAttribute/selectAttributeAndValueByCategoryId", "POST", {
categoryId: this.goodsDetail.categoryId
}, false, true).then((res1) => {
if (res1.code == 200) {
this.goodsList = []
this.$refs.shopPopup.open('bottom')
if (typeof(res1.result) == 'string') {
let newObj = JSON.parse(res1.result)
let newArr = []
let dataArr = []
for (let val in newObj) {
let valueObj = [];
for (var i = 0; i < newObj[val].length; i++) {
valueObj.push({
value: newObj[val][i],
isChecked: false
})
this.dataObj.set(newObj[val][i], val)
// isTrue = false
}
newArr.push({
name: val,
value: valueObj
})
}
this.goodsDetail.attributeList = newArr;
for (var i = 0; i < this.goodsDetail.attributeList.length; i++) {
let oldCheck = false
let oldValue = []
for (var m = 0; m < this.goodsDetail.attributeList[i].value
.length; m++) {
if (this.goodsDetail.attributeList[i].value[m].isChecked == true) {
oldCheck = true
oldValue.push(this.goodsDetail.attributeList[i].value[m].value)
}
}
let specs1 = {
specs: []
}
this.goodsList.push(specs1)
oldCheck = false
oldValue = []
}
} else {
this.tui.toast('失败了')
}
} else {
this.tui.toast(res1.message)
}
}).catch((res) => {})
this.getKCList(current == 1?id.id:id);
},
//库存商品详情
getKCList(id) {
this.tui.request("/app/stock/productCount", "GET", {
productId: id
}, false, true).then((res) => {
if (res.code == 200) {
this.pecsList = res.result
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
setTimeout(res => {
uni.hideLoading();
}, 200)
},
temporaryChange(val) {
this.zNum = 0
for (var i = 0; i < this.temporaryList.length; i++) {
this.zNum += this.temporaryList[i].productCount || 0
}
},
//弹窗选择规格后,点击弹窗中选好了按钮
temporaryCheck() {
uni.showLoading({
title: '加载中...'
})
let that = this,
carList1 = []
let data = {
id: this.goodsDetail.id,
price: 0,
num: this.zNum,
productId:this.goodsDetail.id,
productName: this.goodsDetail.productName,
wholesalePrice: this.goodsDetail.wholesalePrice,
purchasePrice:this.goodsDetail.purchasePrice,
categoryName:'',
categoryId:this.carList1.categoryId,
lsprice: this.goodsDetail.price,
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
}
}
console.log('carList1',carList1)
console.log('这里',this.carList)
if (this.carList.size == 0) { //当前页没有数据
for (let i = 0; i < carList1.length; i++) {
let obj = {
purchasePrice: this.goodsDetail.purchasePrice, //进货价
price:this.goodsDetail.price,
price1:0,
productCount: 0,
id: carList1[i].id,
productId: carList1[i].id,
wholesalePrice: this.goodsDetail.wholesalePrice,
categoryName:'',
categoryId:this.goodsDetail.categoryId,
lsprice: this.goodsDetail.price,
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++) {
var data1 = {
productCount: carList1[i].saleDetailQueryDTO[m].productCount,
name: carList1[i].saleDetailQueryDTO[m].name
}
obj.stockLogList.set(carList1[i].saleDetailQueryDTO[m].attributeList, data1)
obj.productCount += carList1[i].saleDetailQueryDTO[m].productCount
obj.price1 = obj.productCount * this.goodsDetail.purchasePrice
}
this.carList.set(carList1[i].id, obj)
}
carList1 = []
} else { //当前页有数据
for (let i = 0; i < carList1.length; i++) {
// if(this.carList.get(carList1[i].id)){
// this.carList.get(carList1[i].id).productCount = 0
// }
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.get(carList1[i]
.saleDetailQueryDTO[m].attributeList).productCount += carList1[i]
.saleDetailQueryDTO[m].productCount
} else { //规格不同
var data1 = {
productCount: carList1[i].saleDetailQueryDTO[m].productCount,
name: carList1[i].saleDetailQueryDTO[m].name
}
this.carList.get(carList1[i].id).stockLogList.set(carList1[i].saleDetailQueryDTO[
m].attributeList, data1)
}
console.log('数量变化',this.carList.get(carList1[i].id).productCount)
this.carList.get(carList1[i].id).productCount += carList1[i].saleDetailQueryDTO[
m].productCount
that.carList.get(carList1[i].id).price = that.carList.get(carList1[i].id).productCount *
that.carList.get(carList1[i].id).purchasePrice
}
} else { //商品不同
let obj = {
purchasePrice: this.goodsDetail.purchasePrice, //进货价
price:this.goodsDetail.price,
price1: 0,
productCount: 0,
productId: carList1[i].id,
productName: carList1[i].productName,
wholesalePrice: this.goodsDetail.wholesalePrice,
lsprice: this.goodsDetail.price,
productPicture: carList1[i].productPicture,
stockLogList: new Map(),
productSn: carList1[i].productSn,
stockLogList1: [],
name: ''
}
for (let m = 0; m < carList1[i].saleDetailQueryDTO.length; m++) {
var data1 = {
productCount: carList1[i].saleDetailQueryDTO[m].productCount,
name: carList1[i].saleDetailQueryDTO[m].name
}
obj.stockLogList.set(carList1[i].saleDetailQueryDTO[m].attributeList, data1)
obj.productCount += carList1[i].saleDetailQueryDTO[m].productCount
obj.price1 = obj.productCount * this.goodsDetail.purchasePrice
}
this.carList.set(carList1[i].id, obj)
}
}
carList1 = []
}
this.getAllPrice()
this.$refs.shopPopup.close()
this.allChangeNum = 0
setTimeout(res => {
uni.hideLoading();
}, 500)
},
changessPrice() {
this.noPay = this.shouldPay - this.alreadyPay;
},
//计算欠款
changePay(e) {
this.alreadyPay = e.target.value > this.shouldPay ? this.shouldPay : e.target.value
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()
}
}
})
},
//选商品的时候能删除规格
delCarData(index) {
this.temporaryList.splice(index, 1);
this.temporaryChange()
},
//删除商品下的某一个规格
delShopSpec(id, name) {
var that = this;
console.log(that.carList)
uni.showModal({
title: "提示",
content: "确定删除此条商品吗?",
success: function(res) {
if (res.confirm) {
if(that.carList.get(id).stockLogList.size == 1){
that.carList.get(id).productCount = that.carList.get(id).stockLogList.get(name).productCount;
}else{
that.carList.get(id).productCount -= that.carList.get(id).stockLogList.get(name).productCount;
}
let count = that.carList.get(id).stockLogList.get(name).productCount
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) {
let key = '{"颜色":"均色","尺码":"均码"}'
let value = {
name:'均色/均码/',
productCount: count
}
that.carList.get(id).stockLogList.set(key,value)
}
that.getAllPrice()
}
that.$forceUpdate()
}
})
},
async inventorySubmit() {
if (this.khName == '' || this.carList == '') {
uni.showToast({
title: "请选择供应商后入库!",
icon: 'none'
})
return
}
let that = this;
let purchase = {
id:uni.getStorageSync('AiInventoryId'),
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 = [];
let jishuqi = 0
this.carList.forEach(function(value, key) {
value.stockLogList1 = []
if (value.purchasePrice == '' || value.purchasePrice == 0) {
uni.showToast({
title: value.productName + "的价格必须维护!",
icon: 'none'
})
return
}
if((value.categoryId == '' && value.productId == '') || (value.categoryId == null && value.productId == '')){
that.tui.toast(value.productName + "分类未维护!")
return;
}
value.stockLogList.forEach(function(values, keys) {
if (values <= 0) {
that.tui.toast("入库数量不能为零!")
return;
}
let obj = {
productCount: values.productCount,
attributeList: keys
}
value.stockLogList1.push(obj)
})
delete value.id;
purchaseDetails.push(value)
jishuqi ++
})
if(jishuqi == this.carList.size){
await this.goInventory(purchase,purchaseDetails)
}
},
goInventory(purchase,purchaseDetails){
console.log('走之前',purchaseDetails)
uni.navigateTo({
url: '/package1/inventory/inventoryConfirm?aiinventory=1&purchase=' + JSON.stringify(purchase) + '&purchaseDetails=' + JSON.stringify(purchaseDetails)
})
},
//编辑每一个的单价
clickCollapse(e,id) {
this.carList.get(id).purchasePrice = Number(e.detail.value)
this.carList.get(id).price1 = this.carList.get(id).productCount * this.carList.get(id).purchasePrice
this.getAllPrice()
},
//编辑每一个的批和零售
PriceAndWho(e,id,type) {
if(type == 'pi'){
this.carList.get(id).wholesalePrice = Number(e.detail.value)
}else{
this.carList.get(id).price = Number(e.detail.value)
this.carList.get(id).lsprice = Number(e.detail.value)
}
},
//计算总金额和总数量
getAllPrice() {
let that = this;
this.shouldPay = 0
this.totalAmount = 0
this.carList.forEach(function(value, key) {
that.shouldPay = that.shouldPay + value.price1
that.totalAmount = that.totalAmount + value.productCount
})
this.alreadyPay = this.shouldPay
that.noPay = this.shouldPay - this.alreadyPay
this.$forceUpdate()
},
//修改已选规格的数量
GoodsNumChange(e, index, index1) {
let that = this;
this.carList.get(index[0]).stockLogList.get(index1).productCount = e
this.carList.get(index[0]).productCount = 0
this.carList.get(index[0]).stockLogList.forEach(function(value, key) {
that.carList.get(index[0]).productCount = that.carList.get(index[0]).productCount + value.productCount
that.carList.get(index[0]).price1 = that.carList.get(index[0]).productCount * that.carList.get(index[0]).purchasePrice
})
that.getAllPrice()
}
}
}
</script>
<style lang="scss">
page,
.page1 {
height: 100%;
}
.u-upload{
position: absolute;
top: 30rpx;
left: 30rpx;
opacity: 0;
width: 140rpx;
height: 140rpx;
}
.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: 277rpx;
line-height: 80rpx;
border-top: 1px solid #eee;
font-size: 28rpx;
font-weight: bold;
display: flex;
}
.shop-productName {
flex: 1;
display: flex;
flex-direction: column;
padding-left: 20rpx;
height: 180rpx;
margin-top:20rpx;
}
.shop-productName view {
height: 55rpx;
}
.shop-collapse {
display: flex;
height: 80rpx;
font-size: 26rpx;
line-height: 80rpx;
border-top: 1px solid #eee;
}
.shop-collapse text {
width: 50%;
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: 150rpx;
z-index: 99;
}
.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;
padding: 0 10px;
min-width: 100rpx;
line-height: 35px;
height: 70rpx;
text-align: center;
border-radius: 20rpx;
}
.checkedText {
background-color: #5fd9ee;
color: #fff;
border-radius: 20rpx;
}
}
.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;
}
.new-logo{
position: absolute;
top: 35rpx;
left: 131rpx;
background: red;
color: #fff;
width: 40rpx;
height: 40rpx;
line-height: 40rpx;
text-align: center;
border-top-right-radius: 10px;
}
.goods-btn{
color: #fff;
border-radius: 5px;
background: linear-gradient(90deg, #60F3FF, #088FEB);
height: 60rpx;
width: 150rpx;
padding: 5px;
margin: 0 auto;
text-align: center;
}
.shop-btn{
display: flex;
}
.shop-title{
display: flex;
height: 80rpx;
line-height: 80rpx;
padding-left: 70rpx;
text-align: center;
}
.shop-type{
margin-top: 40rpx;
border-top: 1px solid #eee;
}
.left-btn{
font-weight: 800;
font-size: 22rpx;
color: #fff;
background: #088FEB;
border-radius: 5px;
width: 60rpx;
height: 40rpx;
line-height: 40rpx;
text-align: center;
}
.type-popup{
width: 500rpx;
height: auto;
background: #fff;
border-radius: 10px;
position: relative;
margin-bottom: 40rpx;
}
.card-list {
width: 95%;
border-radius: 10upx;
background: #fff;
height: auto;
margin: 40rpx auto 0;
}
.title-fur {
width: 95%;
height: 70rpx;
margin: 0 auto;
border-bottom: 1px solid #eee;
}
.name {
font-size: 30rpx;
width: 50%;
float: left;
height: 70rpx;
line-height: 70rpx;
}
.rightBox {
display: flex;
float: right;
}
.content-fur {
padding-bottom: 25rpx;
}
.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;
}
</style>