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.

237 lines
5.7 KiB

1 year ago
<template>
1 year ago
1 year ago
<view class="page-wraper">
1 year ago
1 year ago
<view class="page-header">
<view class="" style="margin: 10rpx;">
<uni-segmented-control :current="current" :values="items" @clickItem="onClickItem" styleType="button"
activeColor="#007AFF"></uni-segmented-control>
</view>
1 year ago
1 year ago
</view>
1 year ago
1 year ago
<view class="page-main">
<scroll-view scroll-y="true" class="page-main-scroll">
1 year ago
<view class="uni-flex uni-row" style="flex-wrap: wrap; margin: 10rpx;">
1 year ago
<view class="uni-flex" style=" width: 50%; justify-content: center; margin-top: 40rpx; "
1 year ago
v-for="(item, index) in showList" :key="index">
<uni-tag :inverted="!item.checked" :circle="false" :text="item.code+'\n'+item.desc1" type="primary"
@click="setContainerModel(item)" />
1 year ago
</view>
1 year ago
1 year ago
</view>
</scroll-view>
</view>
1 year ago
1 year ago
<view class="page-footer">
1 year ago
<div class="new_bot_box">
<win-collapse-location scanTitle='扫描目标库位' ref='comCollapseLocation'
@getLocationCode='getDefaultToLocation' @clear='clearDefaultLocation'>
</win-collapse-location>
<view class="new_btn_bot bot_pos uni-flex">
<button class="new_save_btn " style="width: 100%;" @click="submit()">提交</button>
1 year ago
</view>
1 year ago
</div>
1 year ago
</view>
1 year ago
1 year ago
<com-message ref="comMessage"></com-message>
</view>
</template>
<script>
import {
1 year ago
injectIssueRequest,
getItemCategoryList,
locations
1 year ago
} from '@/api/index.js';
1 year ago
1 year ago
import {
goHome,
dateFormat,
getContainerTypeName,
1 year ago
showConfirmMsg,
getISODateTime
1 year ago
} from '@/common/basic.js';
1 year ago
1 year ago
import winEmptyView from '@/mycomponents/wincom/winEmptyView.vue'
import comJobTopInfo from '@/mycomponents/comjob/comJobTopInfo.vue'
import comMessage from '@/mycomponents/common/comMessage.vue'
1 year ago
import winCollapseLocation from '@/mycomponents/wincom/winCollapseLocation.vue'
1 year ago
export default {
components: {
winEmptyView,
comJobTopInfo,
1 year ago
comMessage,
winCollapseLocation
1 year ago
},
data() {
return {
1 year ago
items: ['保险杠', '轮眉', '车门装饰板'],
1 year ago
current: 0,
pageSize: this.modelConfig,
pageIndex: 1,
loadingType: "nomore",
1 year ago
dataList: [],
showList: [],
toLocationInfo: null
1 year ago
};
},
filters: {
formatDate: function(val) {
return dateFormat(val)
},
},
1 year ago
onShow() {},
onLoad() {
getItemCategoryList().then(res => {
this.dataList = res;
this.dataList.forEach(res => {
res.checked = true;
})
this.onClickItem({
currentIndex: 0
})
}).catch(error => {
})
1 year ago
},
1 year ago
onReachBottom() {},
onPullDownRefresh() {},
1 year ago
//后退按钮
onBackPress(options) {
if (options.from === 'navigateBack') {
return false;
}
goHome();
return true;
},
//返回首页
onNavigationBarButtonTap(e) {
if (e.index === 0) {
goHome();
} else if (e.index === 1) {
window.location.reload();
}
},
methods: {
1 year ago
clearDefaultLocation() {
this.toLocationInfo = null
},
//扫描默认目标库位
getDefaultToLocation(locationCode) {
uni.showLoading({
title: "扫描中",
mask: true
});
locations(locationCode).then(res => {
uni.hideLoading();
if (res) {
this.toLocationInfo = res
} else {
this.showMessage('目标库位【' + locationCode + '】不存在');
}
}).catch(err => {
uni.hideLoading();
this.toLocationInfo = null
this.showMessage(err.message);
})
},
1 year ago
setContainerModel(item) {
1 year ago
this.showList.forEach(res => {
1 year ago
res.checked = false
})
item.checked = true;
1 year ago
this.$forceUpdate()
1 year ago
},
onClickItem(item) {
1 year ago
if (item.currentIndex == 0) {
this.showList = this.dataList.filter(res => res.category == "保险杠")
} else if (item.currentIndex == 1) {
this.showList = this.dataList.filter(res => res.category == "轮眉")
} else if (item.currentIndex == 2) {
this.showList = this.dataList.filter(res => res.category == "车门装饰板")
1 year ago
}
1 year ago
this.showList.forEach(res => {
res.checked = false;
})
1 year ago
},
//查询发货任务
showMessage(message) {
this.$refs.comMessage.showMessage(message);
},
showCommitSuccessMessage() {
this.$refs.comMessage.showCommitSuccess();
},
1 year ago
clearData() {
this.onClickItem({
currentIndex: 0
})
},
1 year ago
submit(item) {
1 year ago
var checked = this.showList.filter(r=>r.checked)
if (checked.length==0) {
this.showMessage("请选择零件")
return;
}
if (this.toLocationInfo == null) {
this.showMessage("请先扫描目标库位")
return;
}
1 year ago
uni.showLoading({
title: "提交中...",
1 year ago
mask: true
1 year ago
});
1 year ago
var params = {
worker: localStorage.userName_CN == "" ? localStorage.userName : localStorage.userName_CN,
activeDate: getISODateTime(),
useOnTheWayLocation: false,
type: "Qty",
details: [
]
}
var item = {
remark: "",
itemCode: checked[0].code,
itemName: checked[0].name,
itemDesc1: checked[0].desc1,
itemDesc2: checked[0].desc2,
uom: checked[0].basicUom,
qty: 1,
stdPackQty: checked[0].stdPackQty,
toLocationCode: this.toLocationInfo.code,
toLocationArea: this.toLocationInfo.areaCode,
toLocationGroup: this.toLocationInfo.locationGroupCode,
toLocationErpCode: this.toLocationInfo.erpLocationCode,
toWarehouseCode: localStorage.warehouseCode,
positionCode: "",
recommendType: "SEMI",
1 year ago
boxQty: 1
}
params.details.push(item)
console.log("测试", JSON.stringify(params));
injectIssueRequest( params)
1 year ago
.then(res => {
uni.hideLoading();
1 year ago
if (res) {
1 year ago
this.showCommitSuccessMessage();
1 year ago
this.clearData();
}else {
this.showMessage("提交失败");
1 year ago
}
})
.catch(err => {
this.showMessage(err.message);
uni.hideLoading();
});
},
}
};
</script>