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.

272 lines
7.7 KiB

2 months ago
<template>
<view class="viewport">
<CustomNavbar />
<u-tabs
:list="tabsList"
:is-scroll="false"
:current="tabsCurrent"
@change="fnTabsChg"
></u-tabs>
<u-card v-for="orderItem in orderList">
<view class="" slot="head">
<text>采购订单编号{{ orderItem.orderNumber }}</text>
</view>
<view class="" slot="body">
<u-row gutter="16">
<u-col span="12">
<text>订单日期</text><text>{{ orderItem.orderDate }}</text>
</u-col>
<u-col span="6">
<text>物料名称</text><text>{{ orderItem.materialName }}</text>
</u-col>
<u-col span="6">
<text>规格型号</text><text>{{ orderItem.specification }}</text>
</u-col>
<u-col span="6">
<text>物料编码</text><text>{{ orderItem.materialCode }}</text>
</u-col>
<u-col span="6">
<text>下单数量</text><text>{{ orderItem.orderQuantity }}</text>
</u-col>
<u-col span="6">
<text>要求到货日期</text><text>{{ orderItem.orderDate }}</text>
</u-col>
</u-row>
</view>
<view class="" slot="foot">
2 months ago
<template v-if="orderItem.orderStatus == 1">
<u-button
size="mini"
:custom-style="{
color: 'white',
margin: '5px',
backgroundImage:
'linear-gradient(to right, rgb(111, 137, 221), rgb(42, 75, 180))',
}"
:plain="true"
shape="circle"
@click="fnTakeOrder(orderItem)"
>
接单
</u-button>
</template>
<template v-else-if="orderItem.orderStatus == 2">
<u-button
size="mini"
:custom-style="{
color: 'white',
margin: '5px',
backgroundImage:
'linear-gradient(to right, rgb(255, 133, 133), rgb(249, 61, 61))',
}"
:plain="true"
shape="circle"
2 months ago
@click="fnDelay(orderItem)"
2 months ago
>
延期发货
</u-button>
<u-button
size="mini"
:custom-style="{
color: 'white',
margin: '5px',
backgroundImage:
'linear-gradient(to right, rgb(255, 199, 131), rgb(252, 136, 13))',
}"
:plain="true"
shape="circle"
2 months ago
@click="fnFinish(orderItem)"
2 months ago
>
缺货结单
</u-button>
<u-button
size="mini"
:custom-style="{
color: 'white',
margin: '5px',
backgroundImage:
'linear-gradient(to right, rgb(111, 137, 221), rgb(42, 75, 180))',
}"
:plain="true"
shape="circle"
@click="fnToProd(orderItem)"
>
投产
</u-button>
<u-button
size="mini"
:custom-style="{
color: 'white',
margin: '5px',
backgroundImage:
'linear-gradient(to right, rgb(126, 237, 140), rgb(74, 215, 92))',
}"
:plain="true"
shape="circle"
2 months ago
@click="fnShipments(orderItem)"
2 months ago
>
发货
</u-button>
</template>
2 months ago
</view>
</u-card>
2 months ago
<PopToProd ref="popToProd" @evtRefresh="fnRefreshA"></PopToProd>
2 months ago
<PopDelay ref="popDelay" @evtRefresh="fnRefreshB"></PopDelay>
2 months ago
<PopShipments ref="popShipments" @evtRefresh="fnRefreshC"></PopShipments>
2 months ago
<u-top-tips ref="uTips"></u-top-tips>
2 months ago
</view>
</template>
<script>
import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
import { mapGetters } from "vuex";
2 months ago
import {
getOrderList,
takeOrder,
finish,
} from "@/api/yys/materialProcurementOrder.js";
2 months ago
import CustomNavbar from "./components/CustomNavbar";
2 months ago
import PopToProd from "./components/PopToProd";
2 months ago
import PopDelay from "./components/PopDelay";
2 months ago
import PopShipments from "./components/PopShipments";
2 months ago
export default {
2 months ago
components: { CustomNavbar, PopToProd, PopDelay, PopShipments },
2 months ago
mixins: [],
data() {
return {
isLoading: false,
tabsList: [
{ name: "待接单", orderStatus: "1" },
{ name: "已接单", orderStatus: "2" },
{ name: "部分发货", orderStatus: "4" },
{ name: "发货完成", orderStatus: "5" },
],
tabsCurrent: 0,
orderList: [],
};
},
watch: {},
computed: {},
onLoad(params) {
this.fnGetList();
},
onUnload() {},
methods: {
fnTabsChg(index) {
this.tabsCurrent = index;
this.fnGetList();
},
fnGetList() {
let tabsNow = this.tabsList[this.tabsCurrent];
let params = {
orderStatus: tabsNow.orderStatus,
};
getOrderList(params)
.then((res) => {
if (res.code == 200) {
this.orderList = res.data;
}
console.log(res);
})
.catch((err) => {
console.log(err);
});
},
2 months ago
fnTakeOrder(orderItem) {
uni.showModal({
title: "确认接单",
content: "确认接单(编号:" + orderItem.orderNumber + ")",
success: (res) => {
if (res.confirm) {
// 用户确认接单
console.log("用户确认接单");
takeOrder(orderItem)
.then((res) => {
if (res.code == 200) {
2 months ago
this.$refs.uTips.show({
title: "确认接单提交成功",
type: "success",
duration: "2300",
});
2 months ago
this.fnGetList();
}
})
.catch((err) => {
console.log(err);
});
} else if (res.cancel) {
// 用户取消接单
console.log("用户取消接单");
}
},
});
console.log(orderItem);
},
fnToProd(orderItem) {
this.$refs.popToProd.init(orderItem);
},
2 months ago
fnFinish(orderItem) {
uni.showModal({
title: "缺货结单",
content: "缺货结单(编号:" + orderItem.orderNumber + ")",
success: (res) => {
if (res.confirm) {
// 用户确认缺货结单
console.log("用户确认缺货结单");
finish(orderItem)
.then((res) => {
if (res.code == 200) {
this.$refs.uTips.show({
title: "缺货结单提交成功",
type: "success",
duration: "2300",
});
this.fnGetList();
}
})
.catch((err) => {
console.log(err);
});
} else if (res.cancel) {
// 用户取消缺货结单
console.log("用户取消缺货结单");
}
},
});
},
2 months ago
fnDelay(orderItem) {
this.$refs.popDelay.init(orderItem);
},
2 months ago
fnShipments(orderItem) {
this.$refs.popShipments.init(orderItem);
},
2 months ago
fnRefreshA() {
this.$refs.uTips.show({
2 months ago
title: "投产提交成功",
type: "success",
duration: "2300",
});
this.fnGetList();
},
fnRefreshB() {
this.$refs.uTips.show({
title: "延期发货提交成功",
type: "success",
duration: "2300",
});
2 months ago
this.fnGetList();
},
2 months ago
fnRefreshC() {
this.$refs.uTips.show({
title: "发货提交成功",
type: "success",
duration: "2300",
});
this.fnGetList();
},
2 months ago
},
};
</script>
<style lang="scss"></style>