|
|
|
@ -130,34 +130,34 @@ |
|
|
|
<!-- 购物车弹出层 --> |
|
|
|
<uni-popup ref="carPopup" background-color="#fff" @change="change"> |
|
|
|
<view class="popup-content"> |
|
|
|
<view v-for="(item,index) in carList" :key="index" style="position: relative;"> |
|
|
|
<view v-for="(value,key) in Array.from(newList)" :key="key" style="position: relative;"> |
|
|
|
<view class="popup-title"> |
|
|
|
<view class="popup-title-left"> |
|
|
|
<img src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/c09dfa8c61c949f8b0dbb8f041d5a501.png" |
|
|
|
alt=""> |
|
|
|
</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" style="color: #088FEB;">{{value[1].productName}}</view> |
|
|
|
<view class="popup-title-right-box">{{value[1].productSn}}</view> |
|
|
|
<view class="popup-title-right-box" style="color: darkorange;" @tap="inputDialogToggle"> |
|
|
|
<text style="margin-right:20rpx;">¥{{item.price}}</text> |
|
|
|
<text style="margin-right:20rpx;">¥{{value[1].price}}</text> |
|
|
|
<!-- <uni-icons color="#088FEB" type="compose" size="16"></uni-icons> --> |
|
|
|
<view style="position: absolute;top: 30rpx;right: 30rpx;" @tap.stop="delShop(item.id)"> |
|
|
|
<view style="position: absolute;top: 30rpx;right: 30rpx;" @tap.stop="delShop(value[1].id)"> |
|
|
|
<uni-icons color="red" type="trash" size="26"></uni-icons> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="popup-container" v-for="(items,index1) in item.saleDetailQueryDTO" :key="index1"> |
|
|
|
<view class="popup-container" v-for="(values,keys) in Array.from(value[1].stockLogList)" :key="keys"> |
|
|
|
<view class="checkList"> |
|
|
|
<view style="margin-right:5%;" @tap="delShopSpec(items.name)"> |
|
|
|
<view style="margin-right:5%;" @tap="delShopSpec(value[0],values[0])"> |
|
|
|
<uni-icons color="red" type="minus" size="26"></uni-icons> |
|
|
|
</view> |
|
|
|
<view class="checkList-box"> |
|
|
|
{{items.name}} |
|
|
|
{{values[0] | sliceMsg}} |
|
|
|
</view> |
|
|
|
<uni-number-box max="100000" v-model="items.productCount" @change="change" /> |
|
|
|
<uni-number-box max="100000" v-model="values[1]" @change="change" /> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
@ -203,9 +203,30 @@ |
|
|
|
zNum: 0, |
|
|
|
storageType: '', |
|
|
|
carNum: 0, |
|
|
|
carType: 0, |
|
|
|
type:'', |
|
|
|
carType: 0, |
|
|
|
type: '', |
|
|
|
oldList: [], |
|
|
|
newList: new Map() |
|
|
|
} |
|
|
|
}, |
|
|
|
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() { |
|
|
|
this.getGategoryList() |
|
|
|
@ -225,7 +246,7 @@ |
|
|
|
} else { |
|
|
|
this.indexList[i].parentId = false |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
this.categoryId = this.indexList[0].id |
|
|
|
this.getShareList(this.indexList[0].id); |
|
|
|
} else { |
|
|
|
@ -337,9 +358,13 @@ |
|
|
|
toggle(type, item) { |
|
|
|
// open 方法传入参数 等同在 uni-popup 组件上绑定 type属性 |
|
|
|
if (type == 'carPopup') { |
|
|
|
console.log(this.carList) |
|
|
|
this.oldList = this.carList |
|
|
|
this.newFun() |
|
|
|
this.carNum = 0 |
|
|
|
for (let i = 0; i < this.carList.length; i++) { |
|
|
|
this.carNum += this.carList[i].num |
|
|
|
} |
|
|
|
} |
|
|
|
this.$refs.carPopup.open('bottom') |
|
|
|
this.carType = this.carList.length |
|
|
|
} else { |
|
|
|
@ -348,6 +373,73 @@ |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
newFun() { |
|
|
|
//newList 已经是map格式了 新数组 初始为空 |
|
|
|
//carList 旧数组 |
|
|
|
for (let i = 0; i < this.carList.length; i++) { |
|
|
|
if (this.newList.size == 0) { //首次放值,直接放就行 |
|
|
|
let obj = { |
|
|
|
purchasePrice: this.carList[i].price, //采购价 |
|
|
|
price: 0, //总价 |
|
|
|
discount: 10, //折扣 |
|
|
|
unitPrice: 0, //单价 |
|
|
|
discountAmount: 0, //折后价 |
|
|
|
wholesalePrice: this.carList[i].wholesalePrice, //批发价 |
|
|
|
lsprice: this.carList[i].lsprice, //零售价 |
|
|
|
productCount: 0, //总数量 |
|
|
|
productId: this.carList[i].id, |
|
|
|
productName: this.carList[i].productName, |
|
|
|
productPicture: this.carList[i].productPicture, |
|
|
|
productSn: this.carList[i].productSn, |
|
|
|
stockLogList: new Map(), |
|
|
|
stockLogList1: [], |
|
|
|
supplierName: this.carList[i].supplierName //供应商 |
|
|
|
} |
|
|
|
for (let m = 0; m < this.carList[i].saleDetailQueryDTO.length; m++) { |
|
|
|
obj.stockLogList.set(this.carList[i].saleDetailQueryDTO[m].attributeList, this.carList[i] |
|
|
|
.saleDetailQueryDTO[m].productCount) |
|
|
|
} |
|
|
|
this.newList.set(this.carList[i].id, obj) |
|
|
|
} else { //不是首次,里面有值 |
|
|
|
|
|
|
|
if (this.newList.has(this.carList[i].id) == true) { //商品相同 ,给循环,判断规格是不是相同 |
|
|
|
for (let m = 0; m < this.carList[i].saleDetailQueryDTO.length; m++) { |
|
|
|
if (this.newList.get(this.carList[i].id).stockLogList.has(this.carList[i] |
|
|
|
.saleDetailQueryDTO[m].attributeList) == true) { //规格相同 |
|
|
|
this.newList.get(this.carList[i].id).stockLogList.set(this.carList[i].saleDetailQueryDTO[m].attributeList, this.newList.get(this.carList[i].id).stockLogList.get(this.carList[i].saleDetailQueryDTO[m].attributeList) + this.carList[i].saleDetailQueryDTO[m].productCount) |
|
|
|
} else { //规格不同 |
|
|
|
this.newList.get(this.carList[i].id).stockLogList.set(this.carList[i] |
|
|
|
.saleDetailQueryDTO[m]) |
|
|
|
} |
|
|
|
} |
|
|
|
} else { //商品不同,可以直接给map.set |
|
|
|
let obj = { |
|
|
|
purchasePrice: this.carList[i].price, //采购价 |
|
|
|
price: 0, |
|
|
|
discount: 10, |
|
|
|
discountAmount: 0, |
|
|
|
unitPrice: 0, //单价 |
|
|
|
wholesalePrice: this.carList[i].wholesalePrice, //批发价 |
|
|
|
lsprice: this.carList[i].lsprice, //零售价 |
|
|
|
productCount: 0, |
|
|
|
productId: this.carList[i].id, |
|
|
|
productName: this.carList[i].productName, |
|
|
|
productPicture: this.carList[i].productPicture, |
|
|
|
stockLogList: new Map(), |
|
|
|
stockLogList1: [], |
|
|
|
productSn: this.carList[i].productSn, |
|
|
|
supplierName: this.carList[i].supplierName |
|
|
|
} |
|
|
|
for (let m = 0; m < this.carList[i].saleDetailQueryDTO.length; m++) { |
|
|
|
obj.stockLogList.set(this.carList[i].saleDetailQueryDTO[m].attributeList, this.carList[i] |
|
|
|
.saleDetailQueryDTO[m].productCount) |
|
|
|
obj.productCount += this.carList[i].saleDetailQueryDTO[m].productCount |
|
|
|
} |
|
|
|
this.newList.set(this.carList[i].id, obj) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
//选择商品查询商品规格 |
|
|
|
checkGoods(item) { |
|
|
|
this.tui.request("/app/product/getById/" + item.id, "POST", {}, false, true).then((res) => { |
|
|
|
@ -392,22 +484,22 @@ |
|
|
|
}, |
|
|
|
//顶部搜索框 |
|
|
|
search(res) { |
|
|
|
this.searchName = res.value |
|
|
|
this.searchName = res.value |
|
|
|
this.getShareList() |
|
|
|
}, |
|
|
|
//未入库遮罩 |
|
|
|
clickMask(item){ |
|
|
|
let title = '' |
|
|
|
if(item.delFlag == 0){ |
|
|
|
title = '请将商品上架后再操作!' |
|
|
|
} |
|
|
|
// else if(item.delFlag == 1){ |
|
|
|
// title = '请将商品入库后再操作!' |
|
|
|
// } |
|
|
|
uni.showToast({ |
|
|
|
title: title, |
|
|
|
icon: 'none' |
|
|
|
}) |
|
|
|
}, |
|
|
|
//未入库遮罩 |
|
|
|
clickMask(item) { |
|
|
|
let title = '' |
|
|
|
if (item.delFlag == 0) { |
|
|
|
title = '请将商品上架后再操作!' |
|
|
|
} |
|
|
|
// else if(item.delFlag == 1){ |
|
|
|
// title = '请将商品入库后再操作!' |
|
|
|
// } |
|
|
|
uni.showToast({ |
|
|
|
title: title, |
|
|
|
icon: 'none' |
|
|
|
}) |
|
|
|
}, |
|
|
|
//点击左侧菜单切换 |
|
|
|
clickLeftBtn(index) { |
|
|
|
@ -417,7 +509,7 @@ |
|
|
|
} else { |
|
|
|
this.indexList[i].parentId = false |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
this.categoryId = this.indexList[index].id |
|
|
|
this.getShareList(this.indexList[index].id) |
|
|
|
}, |
|
|
|
@ -430,12 +522,6 @@ |
|
|
|
}, |
|
|
|
//弹窗选择规格后,点击弹窗中选好了按钮 |
|
|
|
temporaryCheck() { |
|
|
|
// if(this.storageType == 0 && this.purchasePrice == 0){ |
|
|
|
// uni.showToast({ |
|
|
|
// title: "请输入采购价!", |
|
|
|
// icon: 'none' |
|
|
|
// }) |
|
|
|
// }else{ |
|
|
|
let data = { |
|
|
|
id: this.goodsDetail.id, |
|
|
|
price: this.zPrice, |
|
|
|
@ -445,11 +531,19 @@ |
|
|
|
productPicture: this.goodsDetail.productPicture, |
|
|
|
supplierName: this.goodsDetail.supplierName, |
|
|
|
saleDetailQueryDTO: this.temporaryList, |
|
|
|
saleDetailQueryDTO1: [], |
|
|
|
wholesalePrice: this.goodsDetail.wholesalePrice, |
|
|
|
lsprice: this.goodsDetail.price |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.carList.push(data) |
|
|
|
for (let i = 0; i < this.carList.length; i++) { |
|
|
|
this.carList[i].num = 0 |
|
|
|
for (let m = 0; m < this.carList[i].saleDetailQueryDTO.length; m++) { |
|
|
|
this.carList[i].num += this.carList[i].saleDetailQueryDTO[m].productCount |
|
|
|
} |
|
|
|
} |
|
|
|
console.log(this.carList) |
|
|
|
this.temporaryList = [] |
|
|
|
this.purchasePrice = '' |
|
|
|
this.zPrice = '' |
|
|
|
@ -461,45 +555,40 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
this.$refs.popup.close() |
|
|
|
// } |
|
|
|
|
|
|
|
}, |
|
|
|
//删除整条商品 |
|
|
|
delShop(id) { |
|
|
|
var that = this; |
|
|
|
console.log(this.carList) |
|
|
|
for (let i = 0; i < this.carList.length; i++) { |
|
|
|
if (this.carList[i].id == id) { |
|
|
|
uni.showModal({ |
|
|
|
title: "提示", |
|
|
|
content: "确定删除此条商品吗?", |
|
|
|
success: function(res) { |
|
|
|
that.carList.splice(i, 1) |
|
|
|
} |
|
|
|
}) |
|
|
|
uni.showModal({ |
|
|
|
title: "提示", |
|
|
|
content: "确定删除此条商品吗?", |
|
|
|
success: function(res) { |
|
|
|
if (res.confirm) { |
|
|
|
if (that.newList.has(id) == true) { |
|
|
|
that.newList.delete(id) |
|
|
|
} |
|
|
|
} |
|
|
|
that.$forceUpdate() |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
//删除商品下的某一个规格 |
|
|
|
delShopSpec(name) { |
|
|
|
var that = this; |
|
|
|
console.log(this.carList) |
|
|
|
for (let i = 0; i < this.carList.length; i++) { |
|
|
|
for (let m = 0; m < this.carList[i].saleDetailQueryDTO.length; m++) { |
|
|
|
if (this.carList[i].saleDetailQueryDTO[m].name == name) { |
|
|
|
uni.showModal({ |
|
|
|
title: "提示", |
|
|
|
content: "确定删除此条商品吗?", |
|
|
|
success: function(res) { |
|
|
|
that.carList[i].saleDetailQueryDTO.splice(m, 1) |
|
|
|
if (that.carList[i].saleDetailQueryDTO.length == 0) { |
|
|
|
that.carList.splice(i, 1) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
var that = this; |
|
|
|
uni.showModal({ |
|
|
|
title: "提示", |
|
|
|
content: "确定删除此条商品吗?", |
|
|
|
success: function(res) { |
|
|
|
if (res.confirm) { |
|
|
|
that.newList.get(id).stockLogList.delete(name) |
|
|
|
if (that.newList.get(id).stockLogList.size == 0) { |
|
|
|
that.newList.delete(id) |
|
|
|
} |
|
|
|
} |
|
|
|
that.$forceUpdate() |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
//选择是零售价还是批发价 |
|
|
|
checkPay(price) { |
|
|
|
@ -689,7 +778,7 @@ |
|
|
|
} |
|
|
|
|
|
|
|
.content-right { |
|
|
|
// width: 550rpx; |
|
|
|
// width: 550rpx; |
|
|
|
flex: 1; |
|
|
|
overflow-y: scroll; |
|
|
|
} |
|
|
|
@ -859,9 +948,9 @@ |
|
|
|
.shop-mask { |
|
|
|
width: 100%; |
|
|
|
height: 190rpx; |
|
|
|
position: absolute; |
|
|
|
top: 0; |
|
|
|
left: 0; |
|
|
|
position: absolute; |
|
|
|
top: 0; |
|
|
|
left: 0; |
|
|
|
background: rgba(0, 0, 0, 0.1); |
|
|
|
} |
|
|
|
</style> |