|
@@ -137,37 +137,35 @@
|
|
|
},
|
|
|
methods: {
|
|
|
checkboxGroupChange(e) {
|
|
|
- console.log(e);
|
|
|
this.stockStateList = e
|
|
|
},
|
|
|
- // 全选
|
|
|
+ // 单击全选
|
|
|
allCheckeChange(e){
|
|
|
this.$refs.productList.allSelect(e.value)
|
|
|
- this.chooseList = this.$refs.productList.getAllChecked()
|
|
|
- },
|
|
|
- allCheckedCallback(val){
|
|
|
- this.allChecked = val
|
|
|
- this.chooseList = this.$refs.productList.getAllChecked()
|
|
|
- },
|
|
|
- // 创建补货单
|
|
|
- creatOrder(data){
|
|
|
- uni.showLoading({
|
|
|
- title:"正在保存.."
|
|
|
- })
|
|
|
- stockCheckSave({
|
|
|
- shelfSn: this.nowData.shelfSn,
|
|
|
- totalCategory: this.nowData.totalCategory,
|
|
|
- totalStockQty: this.nowData.totalStockQty,
|
|
|
- totalFreezeQty: this.nowData.totalFreezeQty
|
|
|
- }).then(res => {
|
|
|
- if(res.status == 200){
|
|
|
- this.detail = res.data || null
|
|
|
- this.stockCheckSn = res.data.stockCheckSn
|
|
|
- }else{
|
|
|
- uni.hideLoading()
|
|
|
- }
|
|
|
+ const list = this.$refs.productList.getAllData()
|
|
|
+ list.map(item => {
|
|
|
+ this.allCheckedCallback(true,item)
|
|
|
})
|
|
|
},
|
|
|
+ // 选中事件
|
|
|
+ allCheckedCallback(isAllChecked,row){
|
|
|
+ console.log(isAllChecked,row)
|
|
|
+ const has = this.chooseList.findIndex(k => k.id == row.id)
|
|
|
+ // 在已选列表中
|
|
|
+ if(has>=0){
|
|
|
+ // 取消选中
|
|
|
+ if(!row.checked){
|
|
|
+ this.chooseList.splice(has,1)
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ // 不在已选列表中,添加
|
|
|
+ if(row.checked){
|
|
|
+ this.chooseList.push(row)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 是否全选
|
|
|
+ this.allChecked = isAllChecked
|
|
|
+ },
|
|
|
// 清空已选数据
|
|
|
clearChoose(){
|
|
|
this.chooseList = []
|
|
@@ -201,10 +199,6 @@
|
|
|
queryWord: this.queryWord,
|
|
|
stockStateList: this.stockStateList
|
|
|
}
|
|
|
- _this.clearChoose()
|
|
|
- _this.partList = []
|
|
|
- _this.$refs.productList && _this.$refs.productList.setData(_this.partList)
|
|
|
- _this.status = 'loading'
|
|
|
uni.showLoading({
|
|
|
mask:true,
|
|
|
title:"正在加载..."
|
|
@@ -228,6 +222,11 @@
|
|
|
return !(row>=0)
|
|
|
})
|
|
|
}
|
|
|
+ // 已选
|
|
|
+ _this.partList.map(item => {
|
|
|
+ const row = _this.chooseList.find(k => k.id == item.id)
|
|
|
+ item.checked = !!row
|
|
|
+ })
|
|
|
this.$refs.productList.setData(_this.partList)
|
|
|
setTimeout(()=>{
|
|
|
uni.hideLoading()
|
|
@@ -237,8 +236,15 @@
|
|
|
// 提交
|
|
|
submitOrder(){
|
|
|
if(this.totalCategory){
|
|
|
- uni.$emit("chooseDbhProduct",this.chooseList)
|
|
|
- uni.navigateBack()
|
|
|
+ if(this.nowData.chooseKey.length){
|
|
|
+ uni.$emit("chooseDbhProduct",this.chooseList)
|
|
|
+ uni.navigateBack()
|
|
|
+ }else{
|
|
|
+ this.$store.state.vuex_tempData = this.chooseList
|
|
|
+ uni.redirectTo({
|
|
|
+ url: "/pages/soldOut/creatOrder?data="+encodeURIComponent(JSON.stringify(this.nowData))
|
|
|
+ })
|
|
|
+ }
|
|
|
}else{
|
|
|
uni.showToast({
|
|
|
icon: 'none',
|