13 changed files with 417 additions and 1904 deletions
Binary file not shown.
Binary file not shown.
@ -1,811 +0,0 @@ |
|||
<template> |
|||
<view class="u-wrap"> |
|||
<view style="width: 100%;position: fixed;background: #fff;z-index: 99;"> |
|||
<button size="default" type="default" @tap="inputDialogToggle('add')" hover-class="is-hover">添加分类</button> |
|||
</view> |
|||
<view class="card-list"> |
|||
<ul> |
|||
<li v-for="(item, index) in indexList" :key="index" @tap="clickList(item)"> |
|||
<view class="name"> |
|||
<text>{{item.categoryName}}</text> |
|||
<u-icon name="edit-pen-fill" size="22" @tap.stop="inputDialogToggle('edit', item)"></u-icon> |
|||
</view> |
|||
<button class="bj-btn" @tap.stop="goGategoryLow(item.id)">编辑规格</button> |
|||
</li> |
|||
</ul> |
|||
</view> |
|||
<u-modal :show="show" :title="'删除'" :content="'是否确认删除此分类?'" showCancelButton="true" @cancel="show = false" |
|||
@confirm="delItemModal"></u-modal> |
|||
<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> |
|||
<uni-popup ref="delDialog" type="dialog"> |
|||
<uni-popup-dialog ref="inputClose" mode="input" :title="dialogTit" :value="inputVal" placeholder="请输入名称" |
|||
cancelText="删除" @confirm="dialogInputConfirm" @close="dialogDel"> |
|||
</uni-popup-dialog> |
|||
</uni-popup> |
|||
<!-- 添加分类弹出层 --> |
|||
<uni-popup ref="addTypeDialog" background-color="#fff"> |
|||
<view class="add-popup-content"> |
|||
<view class="add-popup-title"> |
|||
<text>新增分类</text> |
|||
<uni-icons @tap='close' type="closeempty" color='red' size="16" |
|||
style="height:40rpx;line-height: 40rpx;position: absolute !important;bottom:0;right: 30rpx;"></uni-icons> |
|||
</view> |
|||
<view class="add-popup-container"> |
|||
<view> |
|||
<text style="color:red;font-size:22rpx;">*您可以点击默认项快捷添加分类,如没有想要的快捷项,可以手动输入</text> |
|||
</view> |
|||
<textarea name="" id="" style="width: 100%;border: 1px solid #eee;height: 80rpx;padding: 12px;margin:20rpx 0;" v-model="typeText" |
|||
placeholder="请输入分类名称"></textarea> |
|||
|
|||
<ul> |
|||
<li v-for="(item,index) in defaultList" :key="index"> |
|||
<view class="title-fur"> |
|||
<view class="name">{{item.name}}</view> |
|||
<u-icon size="20" name="plus" color="#5fd9ee" |
|||
@tap="toggle(index) "></u-icon> |
|||
</view> |
|||
<view class="content-fur"> |
|||
<view class="content-low" :class="item1.checked?'checked':''" v-for="(item1,index1) in item.list" :key="index1" |
|||
@tap.stop="addMultipleType(item,item1.value,index1)">{{item1.value}}</view> |
|||
</view> |
|||
</li> |
|||
</ul> |
|||
<view class="add-popup-bottom"> |
|||
<view class="add-popup-btn" @tap="dialogInputConfirm(typeText)">确认</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</uni-popup> |
|||
<!-- 查看商品库存弹出层 --> |
|||
<uni-popup ref="carPopup" background-color="#fff"> |
|||
<view class="popup-content" style="height:auto !important;"> |
|||
<view style="font-size: 36rpx;font-weight: bold;text-align: center;">提示</view> |
|||
<view v-if="goodsList !=''" |
|||
style="width:100%;font-weight:bold;text-align: center;font-size: 28rpx;margin: 20rpx 0;"> |
|||
{{goodsList[0].productName}}商品有以下库存,确认继续删除吗? |
|||
</view> |
|||
<view class="tui-order-item boxbg"> |
|||
<view style="display: flex;border-bottom: 1px solid #eee;height: 50rpx;line-height: 50rpx;"> |
|||
<view style="width: 70%;text-align: center;border-right: 1px solid #eee;">商品规格</view> |
|||
<view style="width: 29%;text-align: center;">数量</view> |
|||
</view> |
|||
<view class="shop-box" v-for="(item,index) in goodsList" :key="index" style="position: relative;"> |
|||
<view style='height: 50rpx;line-height: 50rpx;'> |
|||
<view style="width: 70%;text-align: center;border-right: 1px solid #eee;float: left;height: 50rpx;overflow: hidden;"> |
|||
{{item.attributeList | sliceMsg}} |
|||
</view> |
|||
<view style="width: 29%;text-align: center;float: left;"> |
|||
{{item.stockCount}} |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<!-- <u-loadmore :status="status" /> --> |
|||
<view class="popup-bottom"> |
|||
<view class="popup-bottom-left"> |
|||
<view class="bottom-btn" @tap="this.$refs.carPopup.close()" |
|||
style="background: linear-gradient(90deg, #FF9797, #FFC1E0);">再想想</view> |
|||
</view> |
|||
<view class="popup-bottom-right"> |
|||
<view class="bottom-btn" @tap="this.show = true">确认删除</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</uni-popup> |
|||
<uni-popup ref="addDialog" type="dialog"> |
|||
<uni-popup-dialog ref="addClose" mode="input" :title="'请输入规格名'" :value="specVal" placeholder="请输入规格名称" |
|||
@confirm="addSpec" @close="dialogClose"> |
|||
</uni-popup-dialog> |
|||
</uni-popup> |
|||
</view> |
|||
|
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
data() { |
|||
return { |
|||
indexList: [], |
|||
show: false, |
|||
inputVal: '', |
|||
specVal:'', |
|||
addIndex:0, |
|||
typeModel: '', |
|||
editItem: {}, |
|||
delItems: {}, |
|||
isOpenId: '', |
|||
delType: '', |
|||
goodsList: [], |
|||
dialogTit: '输入分类名', |
|||
typeText:'', |
|||
defaultList:[{ |
|||
name:'颜色', |
|||
list:[{ |
|||
value:'均色', |
|||
checked:false, |
|||
},{ |
|||
value:'白色', |
|||
checked:false, |
|||
},{ |
|||
value:'黑色', |
|||
checked:false, |
|||
},{ |
|||
value:'浅蓝', |
|||
checked:false, |
|||
},{ |
|||
value:'蓝色', |
|||
checked:false, |
|||
},{ |
|||
value:'灰色', |
|||
checked:false, |
|||
},{ |
|||
value:'咖色', |
|||
checked:false, |
|||
},{ |
|||
value:'紫色', |
|||
checked:false, |
|||
},{ |
|||
value:'红色', |
|||
checked:false, |
|||
},{ |
|||
value:'米色', |
|||
checked:false, |
|||
}] |
|||
},{ |
|||
name:'尺码', |
|||
list:[{ |
|||
value:'均码', |
|||
checked:false, |
|||
},{ |
|||
value:'XS码', |
|||
checked:false |
|||
},{ |
|||
value:'S码', |
|||
checked:false, |
|||
},{ |
|||
value:'M码', |
|||
checked:false, |
|||
},{ |
|||
value:'L码', |
|||
checked:false, |
|||
},{ |
|||
value:'XL码', |
|||
checked:false, |
|||
},{ |
|||
value:'XXL码', |
|||
checked:false, |
|||
},{ |
|||
value:'XXXL码', |
|||
checked:false, |
|||
},{ |
|||
value:'XXXXL码', |
|||
checked:false, |
|||
},{ |
|||
value:'25码', |
|||
checked:false |
|||
},{ |
|||
value:'26码', |
|||
checked:false |
|||
},{ |
|||
value:'27码', |
|||
checked:false |
|||
},{ |
|||
value:'28码', |
|||
checked:false |
|||
},{ |
|||
value:'29码', |
|||
checked:false |
|||
},{ |
|||
value:'30码', |
|||
checked:false |
|||
},{ |
|||
value:'31码', |
|||
checked:false |
|||
},{ |
|||
value:'32码', |
|||
checked:false |
|||
},{ |
|||
value:'33码', |
|||
checked:false |
|||
},{ |
|||
value:'34码', |
|||
checked:false |
|||
},{ |
|||
value:'35码', |
|||
checked:false |
|||
},{ |
|||
value:'36码', |
|||
checked:false |
|||
},{ |
|||
value:'37码', |
|||
checked:false |
|||
},{ |
|||
value:'38码', |
|||
checked:false |
|||
},{ |
|||
value:'39码', |
|||
checked:false |
|||
},{ |
|||
value:'40码', |
|||
checked:false |
|||
},{ |
|||
value:'41码', |
|||
checked:false |
|||
},{ |
|||
value:'42码', |
|||
checked:false |
|||
},{ |
|||
value:'43码', |
|||
checked:false |
|||
},{ |
|||
value:'44码', |
|||
checked:false |
|||
},{ |
|||
value:'45码', |
|||
checked:false |
|||
}] |
|||
}], |
|||
multipleList:[] |
|||
} |
|||
}, |
|||
computed: { |
|||
|
|||
}, |
|||
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() { |
|||
this.getGategoryList() |
|||
}, |
|||
methods: { |
|||
//初始化获取分类列表 |
|||
getGategoryList() { |
|||
this.tui.request("/app/productCategory/list", "get", { |
|||
// shopId: 1, |
|||
}, false, true).then((res) => { |
|||
if (res.code == 200) { |
|||
this.indexList = res.result; |
|||
} else { |
|||
this.tui.toast(res.message) |
|||
} |
|||
}).catch((res) => {}) |
|||
}, |
|||
//判断需要打开哪个弹窗(删除弹窗、取消弹窗) |
|||
inputDialogToggle(type, item, parent) { |
|||
this.typeModel = type; |
|||
if (type == 'edit') { |
|||
this.inputVal = item.categoryName; |
|||
this.editItem = item; |
|||
this.$refs.delDialog.open() |
|||
} else if (type == 'add') { |
|||
this.inputVal = ''; |
|||
this.isOpenId = item; |
|||
this.dialogTit = '输入分类名' |
|||
this.$refs.addTypeDialog.open('bottom') |
|||
} |
|||
|
|||
}, |
|||
close(){ |
|||
this.$refs.addTypeDialog.close() |
|||
}, |
|||
//查询分类下有没有库存 |
|||
getTypeToNum(id) { |
|||
let that = this; |
|||
this.tui.request("/app/stock/getlistByAttributeList", "post", { |
|||
categoryId: id, |
|||
}, false, true).then((res) => { |
|||
if (res.code == 200) { |
|||
if (res.result != '') { |
|||
this.goodsList = res.result |
|||
this.$refs.carPopup.open('bottom') |
|||
} else { |
|||
this.tui.request("/app/productAttribute/selectByCategoryId", "POST", { |
|||
categoryId: this.delItems.id |
|||
}, false, true).then((res1) => { |
|||
if (res1.code == 200) { |
|||
if (res1.result.length > 0) { |
|||
uni.showModal({ |
|||
title: "提示", |
|||
content: "此分类已经维护了子分类,确定继续删除吗?", |
|||
success: function(res2) { |
|||
if (res2.confirm) { |
|||
that.delItemModal() |
|||
} |
|||
} |
|||
}) |
|||
} else { |
|||
that.show = true |
|||
} |
|||
} |
|||
}).catch((res) => {}) |
|||
} |
|||
} |
|||
}).catch((res) => {}) |
|||
}, |
|||
//点击选择列表,带参数 返回上一页 |
|||
clickList(item) { |
|||
let pages = getCurrentPages(); |
|||
let prevPage = pages[pages.length - 2]; |
|||
prevPage.$vm.typeItem = item |
|||
uni.navigateBack({ |
|||
delta: 1 |
|||
}) |
|||
}, |
|||
toggle(index){ |
|||
this.addIndex = index |
|||
this.$refs.addDialog.open() |
|||
}, |
|||
addSpec(e){ |
|||
console.log(e) |
|||
let data = { |
|||
value:e, |
|||
checked:false |
|||
} |
|||
this.defaultList[this.addIndex].list.push(data) |
|||
this.$refs.addClose.val = '' |
|||
}, |
|||
//分类编辑(新增,修改) |
|||
dialogInputConfirm(e) { |
|||
let that = this; |
|||
switch (that.typeModel) { |
|||
case 'add': |
|||
for (let i = 0; i < that.indexList.length; i++) { |
|||
if (that.indexList[i].categoryName == e) { |
|||
uni.showToast({ |
|||
title: "请勿重复添加!", |
|||
icon: 'error' |
|||
}) |
|||
return |
|||
} |
|||
} |
|||
if(e == ''){ |
|||
that.tui.toast("请输入分类名") |
|||
return |
|||
} |
|||
if(e != '' && that.multipleList == ''){ |
|||
that.multipleList = [{ |
|||
attributeName:'颜色', |
|||
productAttributeValueVoList:[{ |
|||
checked: true, |
|||
value: "均色" |
|||
}] |
|||
},{ |
|||
attributeName:'尺码', |
|||
productAttributeValueVoList:[{ |
|||
checked: true, |
|||
value: "均码" |
|||
}] |
|||
}] |
|||
}else if(e != '' && that.multipleList != ''){ |
|||
for(let i=0;i<that.multipleList.length;i++){ |
|||
if(that.multipleList[i].productAttributeValueVoList == ''){ |
|||
if(that.multipleList[i].attributeName == '颜色'){ |
|||
that.multipleList[i].productAttributeValueVoList = [{ |
|||
checked: true, |
|||
value: "均色" |
|||
}] |
|||
}else{ |
|||
that.multipleList[i].productAttributeValueVoList = [{ |
|||
checked: true, |
|||
value: "均码" |
|||
}] |
|||
} |
|||
}else{ |
|||
if(that.multipleList.length != 2){ |
|||
if(that.multipleList[i].attributeName == '颜色'){ |
|||
let data = { |
|||
attributeName:'尺码', |
|||
productAttributeValueVoList:[{ |
|||
checked: true, |
|||
value: "均码" |
|||
}] |
|||
} |
|||
that.multipleList.push(data) |
|||
}else{ |
|||
let data = { |
|||
attributeName:'颜色', |
|||
productAttributeValueVoList:[{ |
|||
checked: true, |
|||
value: "均码" |
|||
}] |
|||
} |
|||
that.multipleList.push(data) |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
that.tui.request("/app/productCategory/batchSaveCategoryAndAttribute", "post", { |
|||
categoryName: e, |
|||
productAttributeOfAddVos:that.multipleList |
|||
}, false, false).then((res) => { |
|||
if (res.code == 200) { |
|||
that.tui.toast("添加成功") |
|||
that.$refs.addTypeDialog.close() |
|||
that.getGategoryList() |
|||
} else { |
|||
that.tui.toast("添加失败") |
|||
} |
|||
|
|||
}).catch((res) => {}) |
|||
// that.$refs.addTypeDialog.val = '' |
|||
for(var i=0;i<that.defaultList.length;i++){ |
|||
for(var m=0;m<that.defaultList[i].list.length;m++){ |
|||
that.defaultList[i].list[m].checked = false |
|||
} |
|||
} |
|||
that.typeText = '' |
|||
that.multipleList = [] |
|||
break; |
|||
case 'edit': |
|||
that.tui.request("/app/productCategory/edit", "post", { |
|||
categoryName: e, |
|||
id: that.editItem.id |
|||
}, false, true).then((res) => { |
|||
if (res.code == 200) { |
|||
that.getGategoryList() |
|||
uni.showToast({ |
|||
title: "修改成功", |
|||
icon: 'none' |
|||
}) |
|||
} else { |
|||
uni.showToast({ |
|||
title: "修改失败", |
|||
icon: 'none' |
|||
}) |
|||
} |
|||
}).catch((res) => {}) |
|||
break; |
|||
default: |
|||
} |
|||
that.$refs.inputClose.val = '' |
|||
}, |
|||
//点击取消按钮 |
|||
dialogClose() { |
|||
this.inputVal = ''; |
|||
this.specVal = ''; |
|||
this.$refs.inputClose.val = '' |
|||
this.$refs.addClose.val = '' |
|||
|
|||
}, |
|||
//带删除按钮的弹窗 |
|||
dialogDel() { |
|||
this.delItem(this.editItem, 'del') |
|||
}, |
|||
delItemModal() { |
|||
this.show = false; |
|||
if (this.delType == 'del') { |
|||
this.tui.request("/app/productCategory/delById", "post", { |
|||
id: this.delItems.id, |
|||
}, false, true).then((res) => { |
|||
if (res.code == 200) { |
|||
this.getGategoryList() |
|||
uni.showToast({ |
|||
title: "删除成功", |
|||
icon: 'none' |
|||
}) |
|||
this.$refs.carPopup.close() |
|||
} else { |
|||
uni.showToast({ |
|||
title: "删除失败", |
|||
icon: 'none' |
|||
}) |
|||
} |
|||
}).catch((res) => {}) |
|||
} |
|||
}, |
|||
delItem(item, type) { |
|||
this.delType = type; |
|||
this.delItems = item; |
|||
this.getTypeToNum(this.delItems.id) |
|||
}, |
|||
//跳转子分类页 |
|||
goGategoryLow(id) { |
|||
uni.navigateTo({ |
|||
url: '/pages/inventory/gategoryLow?id=' + id |
|||
}) |
|||
}, |
|||
//选择多个规格保存 |
|||
addMultipleType(item,item1,index){ |
|||
console.log(item); |
|||
console.log(item1); |
|||
item.list[index].checked = !item.list[index].checked |
|||
var list = [] |
|||
if(this.multipleList == ''){ |
|||
console.log("首次"); |
|||
list.push(item.list[index]) |
|||
var data = { |
|||
attributeName:item.name, |
|||
productAttributeValueVoList: list |
|||
} |
|||
this.multipleList.push(data) |
|||
}else{ |
|||
for(var i=0;i<this.multipleList.length;i++){ |
|||
if(this.multipleList[i].attributeName == item.name){ //同种分类 |
|||
|
|||
console.log("同分类"); |
|||
for(var m=0;m<this.multipleList[i].productAttributeValueVoList.length;m++){ |
|||
if(this.multipleList[i].productAttributeValueVoList[m].value == item.list[index].value){ //规格相同 |
|||
console.log("同规格"); |
|||
this.multipleList[i].productAttributeValueVoList.splice(m,1) |
|||
console.log(this.multipleList); |
|||
return; |
|||
}else{ //规格不同 |
|||
if(m+1 == this.multipleList[i].productAttributeValueVoList.length){ |
|||
console.log("不同规格"); |
|||
this.multipleList[i].productAttributeValueVoList.push(item.list[index]) |
|||
console.log(this.multipleList); |
|||
return; |
|||
} |
|||
} |
|||
} |
|||
}else{ //不同分类 |
|||
if(this.multipleList.length == i+1){ |
|||
console.log("不同分类"); |
|||
|
|||
list.push(item.list[index]) |
|||
var data = { |
|||
attributeName:item.name, |
|||
productAttributeValueVoList: list |
|||
} |
|||
this.multipleList.push(data) |
|||
console.log(this.multipleList); |
|||
return; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
console.log(this.multipleList); |
|||
}, |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
.u-wrap { |
|||
height: calc(100vh); |
|||
/* #ifdef H5 */ |
|||
height: calc(100vh - var(--window-top)); |
|||
/* #endif */ |
|||
display: flex; |
|||
flex-direction: column; |
|||
|
|||
.top { |
|||
line-height: 70rpx; |
|||
margin: 20rpx 0; |
|||
padding: 0 20rpx; |
|||
background-color: #fff; |
|||
|
|||
.u-collapse-content { |
|||
.icon { |
|||
display: flex; |
|||
float: right; |
|||
|
|||
.u-icon { |
|||
flex: 1; |
|||
} |
|||
} |
|||
|
|||
} |
|||
|
|||
.name { |
|||
font-size: 14px; |
|||
|
|||
.rightBox { |
|||
display: flex; |
|||
float: right; |
|||
} |
|||
} |
|||
|
|||
.attr { |
|||
line-height: 28px; |
|||
margin-left: 20rpx; |
|||
|
|||
.attrName { |
|||
color: #767a82; |
|||
font-size: 12px; |
|||
display: flex; |
|||
box-sizing: border-box; |
|||
width: 100%; |
|||
margin-top: 20rpx; |
|||
} |
|||
|
|||
.attrs { |
|||
margin-left: 20rpx; |
|||
|
|||
.u-tag-wrapper { |
|||
width: 20%; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
button { |
|||
color: #ffffff; |
|||
background: #5fd9ee; |
|||
width: 90%; |
|||
margin: 20rpx auto 20rpx; |
|||
} |
|||
|
|||
.card-list { |
|||
width: 95%; |
|||
border-radius: 10upx; |
|||
background: #fff; |
|||
height: auto; |
|||
margin: 150rpx auto 0; |
|||
|
|||
} |
|||
.checked{ |
|||
background: #60F3FF; |
|||
color: #fff; |
|||
} |
|||
.card-list ul {} |
|||
|
|||
.card-list li { |
|||
width: 95%; |
|||
height: 100rpx; |
|||
line-height: 100rpx; |
|||
padding-left: 20rpx; |
|||
font-size: 37rpx; |
|||
border-bottom: 0.5px solid #eee; |
|||
margin: 0 auto; |
|||
} |
|||
|
|||
.bj-btn { |
|||
width: 120rpx; |
|||
height: 60rpx; |
|||
font-size: 26rpx; |
|||
background: red; |
|||
margin: 20rpx 0; |
|||
float: left; |
|||
padding: 0; |
|||
line-height: 60rpx; |
|||
} |
|||
|
|||
.name { |
|||
width: 75%; |
|||
float: left; |
|||
display: flex; |
|||
} |
|||
|
|||
.data-v-5ff5d986 {} |
|||
|
|||
.popup-content { |
|||
align-items: center; |
|||
justify-content: center; |
|||
padding: 15px; |
|||
height: 1200rpx; |
|||
background-color: #fff; |
|||
margin-bottom: 30rpx; |
|||
overflow: scroll; |
|||
} |
|||
|
|||
.popup-container { |
|||
width: 100%; |
|||
background: #fff; |
|||
height: 50rpx; |
|||
} |
|||
|
|||
.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; |
|||
} |
|||
.add-popup-content { |
|||
align-items: center; |
|||
justify-content: center; |
|||
padding: 15px; |
|||
width: 100%; |
|||
height: 1300rpx; |
|||
background-color: #fff; |
|||
} |
|||
|
|||
.add-popup-title { |
|||
font-size: 36rpx; |
|||
font-weight: bold; |
|||
text-align: center; |
|||
position: relative; |
|||
} |
|||
|
|||
.add-popup-container { |
|||
margin-top: 20rpx; |
|||
} |
|||
|
|||
.add-popup-bottom { |
|||
display: flex; |
|||
height: 80rpx; |
|||
color: #fff; |
|||
line-height: 80rpx; |
|||
margin-top: 50rpx; |
|||
} |
|||
|
|||
.add-popup-btn { |
|||
flex: 1; |
|||
text-align: center; |
|||
background: linear-gradient(90deg, #60F3FF, #088FEB); |
|||
} |
|||
.title-fur { |
|||
width: 95%; |
|||
height: 70rpx; |
|||
margin: 0 auto; |
|||
border-bottom: 1px solid #eee; |
|||
.name { |
|||
font-size: 30rpx; |
|||
width: 90%; |
|||
float: left; |
|||
height: 70rpx; |
|||
line-height: 70rpx; |
|||
} |
|||
} |
|||
.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> |
|||
@ -1,552 +0,0 @@ |
|||
<template> |
|||
<view class="u-wrap"> |
|||
<!-- <view style="width: 100%;position: fixed;z-index: 99;"> |
|||
<button size="default" type="default" @tap="inputDialogToggle('attrAdd',categoryId)" |
|||
hover-class="is-hover">添加分类</button> |
|||
</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('attrValAdd', items.id) "></u-icon> |
|||
<!-- <u-icon size="24" name="edit-pen" color="#5fd9ee" @tap="inputDialogToggle('attrEdit', items, item) "></u-icon> --> |
|||
<!-- <u-icon size="24" name="trash" color="#f56c6c" @tap="delItem(items, 'attrDel')"></u-icon> --> |
|||
</view> |
|||
</view> |
|||
<view class="content-fur"> |
|||
<view class="content-low" v-for="item in items.attributeValue" :key="item.id" |
|||
@tap="delItem(item, 'attrNameDel')">{{item.value}}</view> |
|||
</view> |
|||
</li> |
|||
</ul> |
|||
</view> |
|||
<u-modal :show="show" :title="'删除'" :content="'是否确认删除此分类?'" showCancelButton="true" @cancel="show = false" |
|||
@confirm="delItemModal"></u-modal> |
|||
<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> |
|||
<!-- 查看商品库存弹出层 --> |
|||
<uni-popup ref="carPopup" background-color="#fff"> |
|||
<view class="popup-content" style="height:auto !important;"> |
|||
<view style="font-size: 36rpx;font-weight: bold;text-align: center;">提示</view> |
|||
<view v-if="goodsList !=''" |
|||
style="width:100%;font-weight:bold;text-align: center;font-size: 28rpx;margin: 20rpx 0;"> |
|||
{{goodsList[0].productName}}商品有以下库存,确认继续删除吗? |
|||
</view> |
|||
<view class="tui-order-item boxbg"> |
|||
<view style="display: flex;border-bottom: 1px solid #eee;height: 50rpx;line-height: 50rpx;"> |
|||
<view style="width: 70%;text-align: center;border-right: 1px solid #eee;">商品规格</view> |
|||
<view style="width: 29%;text-align: center;">数量</view> |
|||
</view> |
|||
<view class="shop-box" v-for="(item,index) in goodsList" :key="index" style="position: relative;"> |
|||
<view style='height: 50rpx;line-height: 50rpx;'> |
|||
<view |
|||
style="width: 70%;text-align: center;border-right: 1px solid #eee;float: left;height: 50rpx;overflow: hidden;"> |
|||
{{item.attributeList | sliceMsg}} |
|||
</view> |
|||
<view style="width: 29%;text-align: center;float: left;"> |
|||
{{item.stockCount}} |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<!-- <u-loadmore :status="status" /> --> |
|||
<view class="popup-bottom"> |
|||
<view class="popup-bottom-left"> |
|||
<view class="bottom-btn" @tap="this.$refs.carPopup.close()" |
|||
style="background: linear-gradient(90deg, #FF9797, #FFC1E0);">再想想</view> |
|||
</view> |
|||
<view class="popup-bottom-right"> |
|||
<view class="bottom-btn" @tap="this.show = true">确认删除</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</uni-popup> |
|||
</view> |
|||
|
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
data() { |
|||
return { |
|||
// indexList: [], |
|||
show: false, |
|||
inputVal: '', |
|||
typeModel: '', |
|||
editItem: {}, |
|||
delItems: {}, |
|||
isOpenId: '', |
|||
attrList: [], |
|||
openIndex: '', |
|||
delType: '', |
|||
dialogTit: '输入分类名', |
|||
categoryId: '', |
|||
goodsList: [] |
|||
} |
|||
}, |
|||
computed: { |
|||
|
|||
}, |
|||
filters: { |
|||
sliceMsg(val) { |
|||
var name = '' |
|||
if (typeof(val) == 'string') { |
|||
let newObj = JSON.parse(val) |
|||
for (let as in newObj) { |
|||
name += newObj[as] + '/' |
|||
} |
|||
} |
|||
return name; |
|||
} |
|||
}, |
|||
onLoad(options) { |
|||
this.categoryId = options.id |
|||
this.getGategoryList(options.id) |
|||
}, |
|||
methods: { |
|||
//初始化获取子分类列表 |
|||
getGategoryList() { |
|||
let data = [] |
|||
this.tui.request("/app/productAttribute/selectByCategoryId", "POST", { |
|||
categoryId: this.categoryId |
|||
}, false, true).then((res1) => { |
|||
if (res1.code == 200) { |
|||
data = res1.result; |
|||
if (res1.result.length > 0) { |
|||
data.forEach((items) => { |
|||
this.tui.request( |
|||
"/app/productAttributeValue/selectByAttributeId", |
|||
"get", { |
|||
id: items.id |
|||
}, false, true).then((res2) => { |
|||
if (res2.code == 200) { |
|||
items.attributeValue = res2.result; |
|||
} else { |
|||
this.tui.toast(res.message) |
|||
} |
|||
|
|||
}).catch((res) => {}) |
|||
}) |
|||
} |
|||
|
|||
} else { |
|||
this.tui.toast(res.message) |
|||
} |
|||
}).catch((res) => {}) |
|||
this.$forceUpdate() |
|||
setTimeout(() => { |
|||
this.attrList = data |
|||
}, 1000) |
|||
}, |
|||
//查询分类下有没有库存 |
|||
getTypeToNum() { |
|||
let that = this; |
|||
this.tui.request("/app/stock/getlistByAttributeList", "post", { |
|||
categoryId: this.categoryId, |
|||
attributeList: this.delItems.attributeName || this.delItems.value, |
|||
}, false, true).then((res) => { |
|||
if (res.code == 200) { |
|||
if (res.result != '') { |
|||
this.goodsList = res.result |
|||
this.$refs.carPopup.open('bottom') |
|||
} else { |
|||
that.show = true |
|||
} |
|||
} |
|||
}).catch((res) => {}) |
|||
}, |
|||
inputDialogToggle(type, item, parent) { |
|||
this.typeModel = type; |
|||
if (type == 'edit') { |
|||
this.inputVal = item.categoryName; |
|||
this.editItem = item; |
|||
} else if (type == 'add' || type == 'attrAdd' || type == 'attrValAdd') { |
|||
this.inputVal = ''; |
|||
this.isOpenId = item; |
|||
if (type == 'add') { |
|||
this.dialogTit = '输入分类名' |
|||
} else if (type == 'attrAdd') { |
|||
this.dialogTit = '输入分类名' |
|||
// this.$refs.addTypeDialog.open('bottom') |
|||
} else if (type == 'attrValAdd') { |
|||
this.dialogTit = '输入属性值' |
|||
} |
|||
} else if (type == 'attrEdit') { |
|||
this.inputVal = item.attributeName; |
|||
this.editItem = item; |
|||
} |
|||
this.$refs.inputDialog.open() |
|||
}, |
|||
dialogInputConfirm(e) { |
|||
switch (this.typeModel) { |
|||
case 'add': |
|||
|
|||
this.tui.request("/app/productCategory/save", "post", { |
|||
categoryName: e |
|||
}, false, true).then((res) => { |
|||
|
|||
if (res.code == 200) { |
|||
this.getGategoryList() |
|||
uni.showToast({ |
|||
title: "添加成功", |
|||
icon: 'none' |
|||
}) |
|||
} else { |
|||
uni.showToast({ |
|||
title: "添加失败", |
|||
icon: 'none' |
|||
}) |
|||
} |
|||
|
|||
}).catch((res) => {}) |
|||
break; |
|||
case 'edit': |
|||
this.tui.request("/app/productCategory/edit", "post", { |
|||
categoryName: e, |
|||
id: this.editItem.id |
|||
}, false, true).then((res) => { |
|||
if (res.code == 200) { |
|||
this.getGategoryList() |
|||
uni.showToast({ |
|||
title: "修改成功", |
|||
icon: 'none' |
|||
}) |
|||
} else { |
|||
uni.showToast({ |
|||
title: "修改失败", |
|||
icon: 'none' |
|||
}) |
|||
} |
|||
}).catch((res) => {}) |
|||
break; |
|||
case 'attrAdd': |
|||
for (let i = 0; i < this.attrList.length; i++) { |
|||
if (this.attrList[i].attributeName == e) { |
|||
uni.showToast({ |
|||
title: "请勿重复添加", |
|||
icon: 'none' |
|||
}) |
|||
return |
|||
} |
|||
} |
|||
this.tui.request("/app/productAttribute/save", "post", { |
|||
attributeName: e, |
|||
categoryId: this.isOpenId |
|||
}, false, true).then((res) => { |
|||
if (res.code == 200) { |
|||
this.getGategoryList() |
|||
uni.showToast({ |
|||
title: "添加成功", |
|||
icon: 'none' |
|||
}) |
|||
} else { |
|||
uni.showToast({ |
|||
title: "添加失败", |
|||
icon: 'none' |
|||
}) |
|||
} |
|||
}).catch((res) => {}) |
|||
break; |
|||
case 'attrValAdd': |
|||
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.getGategoryList() |
|||
uni.showToast({ |
|||
title: "添加成功", |
|||
icon: 'none' |
|||
}) |
|||
} else { |
|||
uni.showToast({ |
|||
title: res.message, |
|||
icon: 'none' |
|||
}) |
|||
} |
|||
}).catch((res) => {}) |
|||
break; |
|||
case 'attrEdit': |
|||
this.tui.request("/app/productAttribute/edit", "post", { |
|||
attributeName: e, |
|||
categoryId: this.editItem.categoryId, |
|||
id: this.editItem.id |
|||
}, false, true).then((res) => { |
|||
|
|||
if (res.code == 200) { |
|||
this.getGategoryList() |
|||
uni.showToast({ |
|||
title: "修改成功", |
|||
icon: 'none' |
|||
}) |
|||
} else { |
|||
uni.showToast({ |
|||
title: "修改失败", |
|||
icon: 'none' |
|||
}) |
|||
} |
|||
}).catch((res) => {}) |
|||
break; |
|||
default: |
|||
} |
|||
this.$refs.inputClose.val = '' |
|||
}, |
|||
dialogClose() { |
|||
this.inputVal = ''; |
|||
this.$refs.inputClose.val = '' |
|||
}, |
|||
dialogDel() { |
|||
this.delItem(this.editItem, 'del') |
|||
}, |
|||
delItemModal() { |
|||
this.show = false; |
|||
if (this.delType == 'del') { |
|||
this.tui.request("/app/productCategory/delById", "post", { |
|||
id: this.delItems.id, |
|||
}, false, true).then((res) => { |
|||
|
|||
if (res.code == 200) { |
|||
this.getGategoryList() |
|||
uni.showToast({ |
|||
title: "删除成功", |
|||
icon: 'none' |
|||
}) |
|||
this.$refs.carPopup.close() |
|||
} else { |
|||
uni.showToast({ |
|||
title: "删除失败", |
|||
icon: 'none' |
|||
}) |
|||
} |
|||
}).catch((res) => {}) |
|||
} else if (this.delType == 'attrDel') { |
|||
this.tui.request("/app/productAttribute/delById", "post", { |
|||
categoryId: this.delItems.categoryId, |
|||
attributeName: this.delItems.attributeName, |
|||
id: this.delItems.id, |
|||
}, false, true).then((res) => { |
|||
|
|||
if (res.code == 200) { |
|||
this.getGategoryList() |
|||
uni.showToast({ |
|||
title: "删除成功", |
|||
icon: 'none' |
|||
}) |
|||
this.$refs.carPopup.close() |
|||
} else { |
|||
uni.showToast({ |
|||
title: "删除失败", |
|||
icon: 'none' |
|||
}) |
|||
} |
|||
}).catch((res) => {}) |
|||
} else if (this.delType == 'attrNameDel') { |
|||
this.tui.request("/app/productAttributeValue/delById", "post", { |
|||
attributeId: this.delItems.attributeId, |
|||
value: this.delItems.value, |
|||
id: this.delItems.id, |
|||
}, false, true).then((res) => { |
|||
|
|||
if (res.code == 200) { |
|||
this.getGategoryList() |
|||
uni.showToast({ |
|||
title: "删除成功", |
|||
icon: 'none' |
|||
}) |
|||
this.$refs.carPopup.close() |
|||
} else { |
|||
uni.showToast({ |
|||
title: "删除失败", |
|||
icon: 'none' |
|||
}) |
|||
} |
|||
}).catch((res) => {}) |
|||
} |
|||
}, |
|||
delItem(item, type) { |
|||
this.delType = type; |
|||
this.delItems = item; |
|||
this.getTypeToNum() |
|||
// this.show = true; |
|||
}, |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
.u-wrap { |
|||
height: calc(100vh); |
|||
/* #ifdef H5 */ |
|||
height: calc(100vh - var(--window-top)); |
|||
/* #endif */ |
|||
display: flex; |
|||
flex-direction: column; |
|||
} |
|||
|
|||
button { |
|||
color: #ffffff; |
|||
background: #5fd9ee; |
|||
width: 90%; |
|||
margin-top: 20upx; |
|||
} |
|||
|
|||
.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; |
|||
} |
|||
|
|||
.popup-content { |
|||
align-items: center; |
|||
justify-content: center; |
|||
padding: 15px; |
|||
height: 1200rpx; |
|||
background-color: #fff; |
|||
margin-bottom: 30rpx; |
|||
overflow: scroll; |
|||
} |
|||
|
|||
.popup-container { |
|||
width: 100%; |
|||
background: #fff; |
|||
height: 50rpx; |
|||
} |
|||
|
|||
.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; |
|||
} |
|||
.checked{ |
|||
background: #60F3FF; |
|||
color: #fff; |
|||
} |
|||
|
|||
|
|||
.add-popup-content { |
|||
align-items: center; |
|||
justify-content: center; |
|||
padding: 15px; |
|||
width: 100%; |
|||
height: 1300rpx; |
|||
background-color: #fff; |
|||
} |
|||
|
|||
.add-popup-title { |
|||
font-size: 36rpx; |
|||
font-weight: bold; |
|||
text-align: center; |
|||
position: relative; |
|||
} |
|||
|
|||
.add-popup-container { |
|||
margin-top: 20rpx; |
|||
} |
|||
|
|||
.add-popup-bottom { |
|||
display: flex; |
|||
height: 80rpx; |
|||
color: #fff; |
|||
line-height: 80rpx; |
|||
margin-top: 50rpx; |
|||
} |
|||
|
|||
.add-popup-btn { |
|||
flex: 1; |
|||
text-align: center; |
|||
background: linear-gradient(90deg, #60F3FF, #088FEB); |
|||
} |
|||
</style> |
|||
@ -1,285 +0,0 @@ |
|||
<template> |
|||
<view class="container"> |
|||
<uni-card :title="(purchase.supplierName == null ?'暂无':purchase.supplierName)" thumbnail="/static/images/dingdan/dd0.png"> |
|||
<!-- <view class="uni-body" v-if="supplier.province">{{supplier.province + supplier.area + supplier.city + supplier.address}} </view> --> |
|||
</uni-card> |
|||
<view class="tui-order-item boxbg"> |
|||
<view class="shop-box" style="border-top:5px solid #eee;" v-for="(item,index) in purchaseDetails" :key="index"> |
|||
<view class="shop-name"> |
|||
<img class="img-radius" :src="item.productPicture" alt="" style="width: 140rpx;height: 140rpx;margin: 30rpx 0 0 30rpx;" v-if="item.productPicture"> |
|||
<view class="noPic" v-else>暂无图片</view> |
|||
<view class="shop-productName"> |
|||
<view style="color:#FF5809;">{{item.productName == null ?'暂无':item.productName}}</view> |
|||
<view>货号:{{item.productSn == null ?'暂无':item.productSn}}</view> |
|||
<view><text v-if="type==0">单价:{{item.purchasePrice == null ?'暂无':item.purchasePrice}} </text><text style="padding: 0 5rpx;">数量:{{item.productCount == null ?'暂无':item.productCount}} </text><text v-if="type==0">总价:{{item.price == null ?'暂无':item.price}}</text></view> |
|||
</view> |
|||
</view> |
|||
<view class="shop-type"> |
|||
<view class="shop-collapse" v-for="(items,index) in item.stockLogList1" :key='index'> |
|||
<text>{{items.attributeList | sliceMsg}}</text> |
|||
<!-- <text style="color: red;">单价:¥{{item.price}}</text> --> |
|||
<text>数量:{{items.productCount == null ?'暂无':items.productCount}}</text> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<view class="tui-goods-info" style="width: 95%;margin: 0 auto;"> |
|||
<view class="tui-price-flex tui-size32" style="height: 80rpx;line-height: 80rpx;"> |
|||
<view class="tui-flex-shrink">应付金额</view> |
|||
<view class="tui-goods-price"> |
|||
<view class="tui-size-24">¥</view> |
|||
<view class="tui-price-large">{{ purchase.shouldPay == null ?'暂无':purchase.shouldPay }}</view> |
|||
</view> |
|||
</view> |
|||
<view class="tui-price-flex tui-size32" style="height: 80rpx;line-height: 80rpx;"> |
|||
<view class="tui-flex-shrink">已付金额</view> |
|||
<view class="tui-goods-price"> |
|||
<view class="tui-size-24">¥</view> |
|||
<view class="tui-price-large">{{ purchase.alreadyPay == null ?'暂无':purchase.alreadyPay }}</view> |
|||
</view> |
|||
</view> |
|||
<view class="tui-price-flex tui-size32" style="height: 80rpx;line-height: 80rpx;"> |
|||
<view class="tui-flex-shrink">欠款</view> |
|||
<view class="tui-goods-price tui-primary-color"> |
|||
<view class="tui-size-24">¥</view> |
|||
<view class="tui-price-large">{{ purchase.noPay == null ?'暂无':purchase.noPay}}</view> |
|||
</view> |
|||
</view> |
|||
<view class="tui-price-flex tui-size32" style="height: 80rpx;line-height: 80rpx;"> |
|||
<view class="tui-flex-shrink">其他费用</view> |
|||
<view class="tui-goods-price tui-primary-color"> |
|||
<view class="tui-size-24">¥</view> |
|||
<view class="tui-price-large">{{ purchase.otherPay == null ?'暂无':purchase.otherPay}}</view> |
|||
</view> |
|||
</view> |
|||
<view class="tui-price-flex tui-size32"> |
|||
<view class="tui-flex-shrink">备注</view> |
|||
<view class="tui-goods-price"> |
|||
<uni-tooltip :content="purchase.remark == null ?'暂无':purchase.remark"> |
|||
<view style="font-size: 13px;width: 200px;height: 40rpx;overflow: hidden;text-align: right;">{{ sales.remark == null ?'':sales.remark}}</view> |
|||
<text style="color: blue;">查看更多</text> |
|||
</uni-tooltip> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<view class="tui-tabbar"> |
|||
<view class="tui-btn-mr" @click="batchPrint">批量打印</view> |
|||
<view class="tui-btn-mr" @click="inventorySubmit">确认提交</view> |
|||
</view> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
data() { |
|||
return { |
|||
purchase:'', |
|||
purchaseDetails:'', |
|||
aiinventory:0 |
|||
} |
|||
}, |
|||
filters: { |
|||
sliceMsg(val) { |
|||
var name = '' |
|||
if (typeof(val) == 'string') { |
|||
let newObj = JSON.parse(val) |
|||
for (let as in newObj) { |
|||
name += newObj[as] + '/' |
|||
} |
|||
} |
|||
return name; |
|||
} |
|||
}, |
|||
onLoad(option) { |
|||
this.purchaseDetails = JSON.parse(option.purchaseDetails) |
|||
this.purchase = JSON.parse(option.purchase) |
|||
this.aiinventory = option.aiinventory |
|||
console.log(this.purchaseDetails) |
|||
console.log(this.purchase) |
|||
}, |
|||
methods: { |
|||
inventorySubmit() { |
|||
let url; |
|||
if(this.aiinventory == 1){ |
|||
url = '/app/stock/putInPriceOfAi' |
|||
}else{ |
|||
url = '/app/stock/putInOfProduct' |
|||
} |
|||
this.tui.request(url, "post", { |
|||
purchase: this.purchase, |
|||
purchaseDetails: this.purchaseDetails |
|||
}, false, false).then((res) => { |
|||
if (res.code == 200) { |
|||
uni.showToast({ |
|||
title: "入库成功", |
|||
icon: 'none' |
|||
}) |
|||
setTimeout(res => { |
|||
uni.switchTab({ |
|||
url: '/pages/index/index' |
|||
}); |
|||
}, 1000) |
|||
} else { |
|||
uni.showToast({ |
|||
title: "入库失败", |
|||
icon: 'none' |
|||
}) |
|||
} |
|||
}) |
|||
}, |
|||
batchPrint(){ |
|||
uni.navigateTo({ |
|||
url: "/package1/inventory/batchPrint?purchase=" + JSON.stringify(this.purchase) + '&purchaseDetails=' + JSON.stringify(this.purchaseDetails) |
|||
}) |
|||
} |
|||
}, |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss"> |
|||
.container { |
|||
padding-bottom: 118rpx; |
|||
.boxbg { |
|||
background-color: #fff; |
|||
margin: 30upx; |
|||
padding: 20upx; |
|||
border-radius: 10upx; |
|||
box-shadow: 0px 1px 10px 2px #e2e2e2; |
|||
} |
|||
|
|||
.tui-order-item { |
|||
.u-collapse-content { |
|||
display: flex; |
|||
justify-content: space-between; |
|||
line-height: 30px; |
|||
} |
|||
|
|||
|
|||
.tui-goods-info { |
|||
width: 100%; |
|||
box-sizing: border-box; |
|||
background: #fff; |
|||
line-height: 26px; |
|||
border-top: 10px solid #eee; |
|||
|
|||
.tui-price-flex { |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: space-between; |
|||
} |
|||
|
|||
.tui-size32 { |
|||
font-size: 32rpx; |
|||
font-weight: 500; |
|||
} |
|||
|
|||
.tui-size-24 { |
|||
font-size: 24rpx; |
|||
} |
|||
|
|||
.tui-price-large { |
|||
font-size: 32rpx; |
|||
} |
|||
|
|||
.tui-flex-shrink { |
|||
flex-shrink: 0; |
|||
} |
|||
|
|||
.tui-goods-price { |
|||
width: 100%; |
|||
display: flex; |
|||
align-items: flex-end; |
|||
justify-content: flex-end; |
|||
font-size: 24rpx; |
|||
} |
|||
|
|||
.tui-primary-color { |
|||
color: #EB0909; |
|||
} |
|||
|
|||
} |
|||
} |
|||
} |
|||
|
|||
.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; |
|||
} |
|||
|
|||
.tui-btn-mr { |
|||
width:130rpx; |
|||
height: 60rpx; |
|||
background: #088FEB; |
|||
color: #fff; |
|||
border-radius: 10px; |
|||
line-height: 60rpx; |
|||
text-align: center; |
|||
margin-right: 30rpx; |
|||
} |
|||
.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 { |
|||
flex: 1; |
|||
text-align: center; |
|||
padding-right: 40rpx; |
|||
border-right: 1px solid #eee; |
|||
} |
|||
.noPic{ |
|||
border-radius: 10px; |
|||
width: 140rpx; |
|||
height: 140rpx; |
|||
text-align: center; |
|||
line-height: 140rpx; |
|||
color: #777; |
|||
background: #eee; |
|||
} |
|||
.uni-tooltip { |
|||
display: flex !important; |
|||
} |
|||
</style> |
|||
Loading…
Reference in new issue