123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297 |
- <script>
- import test from "@/components/form-test/index.vue";
- import query from "@/components/query/index.vue";
- import purchaseInbound from "./purchaseInbound.vue";
- import JDbackInbound from "./JDbackInbound.vue";
- import * as API from "@/api/inbound-outbound/treatIn.js";
- import {
- logisticsDetails,
- purchaseAdd,
- } from "@/api/inbound-outbound/inbound/purchaseInbound.js";
- import { JDreGoodsDetails } from "@/api/order-management/JDReturnGoods/index.js";
- export default {
- components: {
- test,
- query,
- purchaseInbound,
- JDbackInbound,
- },
- data() {
- return {
- inBoundTypeList: [
- { dictValue: "采购入库", dictKey: "1" },
- { dictValue: "京东退货", dictKey: "4" },
- ],
- inStockStatusList: [],
- queryParams: {
- pageNum: 1,
- pageSize: 10,
- keyword: "",
- type: "",
- },
- selectConfig: [
- {
- label: "类型",
- prop: "type",
- data: [
- { label: "采购入库", value: "1" },
- { label: "京东退货", value: "4" },
- ],
- },
- ],
- tableList: [],
- total: 0,
- loading: false,
- titleText: "",
- open: false,
- form: {},
- rowData: {},
- };
- },
- created() {
- const businessDictData = JSON.parse(
- window.localStorage.getItem("businessDict")
- );
- this.inStockStatusList = businessDictData.find(
- (item) => item.code === "inStockStatus"
- ).children;
- this.selectConfig[0].data = this.inBoundTypeList.map((x) => ({
- value: x.dictKey,
- label: x.dictValue,
- }));
- this.getList();
- },
- methods: {
- getList() {
- this.loading = true;
- API.inList(this.queryParams).then(
- (res) => {
- this.tableList = res.data.data.records;
- this.total = res.data.data.total;
- this.loading = false;
- },
- (err) => {
- console.log("inList: " + err);
- this.loading = false;
- }
- );
- },
- handleQuery() {
- this.getList();
- },
- handleInbound(row) {
- this.rowData = { ...row };
- this.open = true;
- if (row.businessType === 1) {
- this.titleText = "采购入库";
- this.$nextTick(() => {
- this.$refs.purchaseInbound.loading = true;
- logisticsDetails({ logisticsInfoId: row.id }).then(
- (res) => {
- let list = res.data.data;
- list = list.map((x) => ({
- ...x,
- changeQuantity:
- Number(x.shipmentQuantity) - Number(x.receiptQuantity),
- }));
- this.form = {
- id: row.id,
- purchaseCode: row.purchaseCode,
- supplierName: row.supplierName,
- logisticsCompanyName: row.logisticsCompanyName,
- code: row.code,
- changeDetailsList: list,
- };
- this.$refs.purchaseInbound.loading = false;
- },
- (err) => {
- console.log("logisticsDetails: " + err);
- this.$refs.purchaseInbound.loading = false;
- }
- );
- });
- } else if (row.businessType === 4) {
- this.titleText = "京东退货入库";
- this.$nextTick(() => {
- this.$refs.JDbackInbound.loading = true;
- JDreGoodsDetails({ id: row.businessId }).then((res) => {
- this.form = {
- logisticsId: row.id,
- warehouseId: "",
- logisticsCompanyName: row.logisticsCompanyName,
- code: row.code,
- logisticsDetailsList: res.data.data,
- };
- this.$refs.JDbackInbound.loading = false;
- });
- });
- }
- },
- handleCancel() {
- this.open = false;
- },
- handleSubmit() {
- if (this.rowData.businessType === 1) {
- purchaseAdd({
- logisticsInfoId: this.form.id,
- list: this.form.changeDetailsList,
- }).then(
- () => {
- this.msgSuccess("入库成功");
- this.$refs.purchaseInbound.loading = false;
- this.open = false;
- this.getList();
- },
- (err) => {
- console.log("purchaseAdd: " + err);
- this.$refs.purchaseInbound.loading = false;
- }
- );
- } else {
- const data = {
- logisticsId: this.form.logisticsId,
- warehouseId: this.form.warehouseId,
- };
- API.JDInBound(data).then(
- () => {
- this.msgSuccess("入库成功");
- this.$refs.JDbackInbound.loading = false;
- this.open = false;
- this.getList();
- },
- (err) => {
- console.log("outboundAdd: " + err);
- this.$refs.JDbackInbound.loading = false;
- }
- );
- }
- },
- },
- };
- </script>
- <template>
- <div class="box-card">
- <el-card>
- <query
- :selectConfig="selectConfig"
- :req="queryParams"
- :isShowMore="true"
- @handleQuery="handleQuery"
- @handleMore="
- () => {
- queryDialog = true;
- }
- "
- ></query>
- <el-table :data="tableList" v-loading="loading">
- <el-table-column
- label="类型"
- align="left"
- prop="businessType"
- width="120"
- :formatter="(row) => dictDataEcho(row.businessType, inBoundTypeList)"
- />
- <el-table-column
- label="仓库名称"
- align="left"
- prop="warehouseName"
- width="150"
- />
- <el-table-column
- label="单号"
- align="left"
- prop="purchaseCode"
- width="180"
- />
- <el-table-column
- label="物流/快递公司"
- align="left"
- prop="logisticsCompanyName"
- width="150"
- />
- <el-table-column label="物流/快递单号" align="left" prop="code" />
- <el-table-column
- label="操作人"
- align="left"
- prop="purchaseName"
- width="120"
- />
- <el-table-column
- label="操作时间"
- align="left"
- prop="updateTime"
- width="150"
- />
- <el-table-column
- label="状态"
- align="left"
- prop="inStockStatus"
- width="100"
- :formatter="
- (row) => dictDataEcho(row.inStockStatus, inStockStatusList)
- "
- />
- <el-table-column label="操作" align="center" width="120">
- <template slot-scope="scope">
- <el-button
- type="text"
- @click="handleInbound(scope.row)"
- v-if="scope.row.status < 30"
- >入库
- </el-button>
- </template>
- </el-table-column>
- </el-table>
- <pagination
- v-show="total > 0"
- :total="total"
- :page.sync="queryParams.pageNum"
- :limit.sync="queryParams.pageSize"
- @pagination="getList"
- />
- </el-card>
- <el-dialog
- :title="titleText"
- :visible.sync="open"
- v-if="open"
- width="80%"
- top="60px"
- >
- <purchase-inbound
- v-if="rowData.businessType === 1"
- :form="form"
- @submit="handleSubmit"
- @cancel="handleCancel"
- ref="purchaseInbound"
- ></purchase-inbound>
- <JDbackInbound
- v-else
- :form="form"
- @submit="handleSubmit"
- @cancel="handleCancel"
- ref="JDbackInbound"
- >
- </JDbackInbound>
- </el-dialog>
- </div>
- </template>
- <style lang="scss" scoped>
- .box-card {
- height: calc(100vh - 110px);
- overflow-y: auto;
- }
- </style>
|