Commit ae8a299c by LJM

Merge branch 'feature/ljm/寄售召回'

parents 0a7dbe84 09b568b8
...@@ -37,6 +37,7 @@ const ConsignmentApplicationDetail = resolve => require(['@/views/consignmentMan ...@@ -37,6 +37,7 @@ const ConsignmentApplicationDetail = resolve => require(['@/views/consignmentMan
const ConsignmentReplenishment = resolve => require(['@/views/consignmentManagement/consignmentReplenishment.vue'], resolve); const ConsignmentReplenishment = resolve => require(['@/views/consignmentManagement/consignmentReplenishment.vue'], resolve);
const ConsignmentRecall = resolve => require(['@/views/consignmentManagement/consignmentRecall.vue'], resolve); const ConsignmentRecall = resolve => require(['@/views/consignmentManagement/consignmentRecall.vue'], resolve);
const ConsignmentRecallDetail = resolve => require(['@/views/consignmentManagement/consignmentRecallDetail.vue'], resolve); const ConsignmentRecallDetail = resolve => require(['@/views/consignmentManagement/consignmentRecallDetail.vue'], resolve);
const CreateConsignmentRecallOrder = resolve => require(['@/views/consignmentManagement/createConsignmentRecallOrder.vue'], resolve);
const BatchRecall = resolve => require(['@/views/consignmentManagement/batchRecall.vue'], resolve); const BatchRecall = resolve => require(['@/views/consignmentManagement/batchRecall.vue'], resolve);
const ConsignmentContract = resolve => require(['@/views/consignmentManagement/consignmentContract.vue'], resolve); const ConsignmentContract = resolve => require(['@/views/consignmentManagement/consignmentContract.vue'], resolve);
const InOutStockLog = resolve => require(['@/views/consignmentManagement/inOutStockLog.vue'], resolve); const InOutStockLog = resolve => require(['@/views/consignmentManagement/inOutStockLog.vue'], resolve);
...@@ -79,6 +80,7 @@ const routes = [ ...@@ -79,6 +80,7 @@ const routes = [
{path: '/consignmentReplenishment', name: 'consignmentReplenishment', meta: {title: '寄售补货'}, component: ConsignmentReplenishment}, {path: '/consignmentReplenishment', name: 'consignmentReplenishment', meta: {title: '寄售补货'}, component: ConsignmentReplenishment},
{path: '/consignmentRecall', name: 'consignmentRecall', meta: {title: '寄售召回'}, component: ConsignmentRecall}, {path: '/consignmentRecall', name: 'consignmentRecall', meta: {title: '寄售召回'}, component: ConsignmentRecall},
{path: '/consignmentRecallDetail', name: 'consignmentRecallDetail', meta: {title: '寄售召回单详情'}, component: ConsignmentRecallDetail}, {path: '/consignmentRecallDetail', name: 'consignmentRecallDetail', meta: {title: '寄售召回单详情'}, component: ConsignmentRecallDetail},
{path: '/createConsignmentRecallOrder', name: 'createConsignmentRecallOrder', meta: {title: '生成寄售召回单'}, component: CreateConsignmentRecallOrder},
{path: '/batchRecall', name: 'batchRecall', meta: {title: '批量召回'}, component: BatchRecall}, {path: '/batchRecall', name: 'batchRecall', meta: {title: '批量召回'}, component: BatchRecall},
{path: '/consignmentContract', name: 'consignmentContract', meta: {title: '寄售合同'}, component: ConsignmentContract}, {path: '/consignmentContract', name: 'consignmentContract', meta: {title: '寄售合同'}, component: ConsignmentContract},
{path: '/inOutStockLog', name: 'inOutStockLog', meta: {title: '进出库日志'}, component: InOutStockLog}, {path: '/inOutStockLog', name: 'inOutStockLog', meta: {title: '进出库日志'}, component: InOutStockLog},
......
...@@ -12,11 +12,8 @@ ...@@ -12,11 +12,8 @@
<el-form-item label="状态" prop="status"> <el-form-item label="状态" prop="status">
<el-select v-model="formParam.recall_status" placeholder="全部" clearable> <el-select v-model="formParam.recall_status" placeholder="全部" clearable>
<el-option label="全部" value=""></el-option> <el-option label="全部" value=""></el-option>
<el-option label="待提审" value="0"></el-option> <el-option label="进行中" value="1"></el-option>
<el-option label="待审核" value="1"></el-option> <el-option label="出库完成" value="2"></el-option>
<el-option label="待退货出库" value="2"></el-option>
<el-option label="完成" value="3"></el-option>
<el-option label="作废" value="4"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
...@@ -27,28 +24,29 @@ ...@@ -27,28 +24,29 @@
<!--操作区--> <!--操作区-->
<div class="operation-area row verCenter bothSide"> <div class="operation-area row verCenter bothSide">
<div class="operation-button row verCenter"> <div class="operation-button row verCenter">
<el-button type="primary" @click="$router.push('/batchRecall')">批量召回</el-button> <el-button type="primary" @click="$router.push('/createConsignmentRecallOrder')">生成寄售找回单</el-button>
<!--
<el-button type="primary" @click="popupEvent(1)">提交审核</el-button> <el-button type="primary" @click="popupEvent(1)">提交审核</el-button>
<el-button type="primary" @click="popupEvent(2)">作废</el-button> <el-button type="primary" @click="popupEvent(2)">作废</el-button>
<el-button type="danger" @click="popupEvent(3)"> 收货信息</el-button> <el-button type="danger" @click="popupEvent(3)"> 收货信息</el-button>
-->
</div> </div>
</div> </div>
<!--列表区--> <!--列表区-->
<div class="data-box"> <div class="data-box">
<el-table :data="list" border max-height="600" @selection-change="handleSelectionChange"> <el-table :data="list" border max-height="600" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="40" align="center" fixed></el-table-column> <el-table-column type="index" label="序号" width="50" align="center" fixed></el-table-column>
<el-table-column prop="msg_sn" label="寄售召回单号" :show-overflow-tooltip="true" align="center"> <el-table-column prop="msg_sn" label="寄售召回单号" min-width="150" :show-overflow-tooltip="true" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-link type="primary" :underline="false" @click="$router.push({path: '/consignmentRecallDetail', query: {recall_id: scope.row.recall_id}})" style="font-size: 12px;">{{ scope.row.recall_sn }}</el-link> <el-link type="primary" :underline="false" @click="$router.push({path: '/consignmentRecallDetail', query: {recall_id: scope.row.recall_id}})" style="font-size: 12px;">{{ scope.row.recall_sn }}</el-link>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="recall_status_val" label="订单状态" :show-overflow-tooltip="true" align="center"></el-table-column> <el-table-column prop="recall_status_val" label="状态" min-width="200" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="order_uname" label="订单人员" width="160" :show-overflow-tooltip="true" align="center"></el-table-column> <el-table-column prop="order_uname" label="对接人" width="160" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="verify_name" label="审核人" width="160" :show-overflow-tooltip="true" align="center"></el-table-column> <el-table-column prop="stock_out_sn" label="出库单号" width="200" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="verify_time" label="审核时间" width="160" :show-overflow-tooltip="true" align="center"></el-table-column> <el-table-column prop="stock_out_express_sn" label="出库物流" width="200" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="verify_remark" label="审核说明" width="160" :show-overflow-tooltip="true" align="center"></el-table-column> <el-table-column prop="create_uname" label="创建人" width="200" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="create_uname" label="创建人" width="160" :show-overflow-tooltip="true" align="center"></el-table-column> <el-table-column prop="create_time" label="创建时间" width="200" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="create_time" label="创建时间" width="160" :show-overflow-tooltip="true" align="center"></el-table-column>
</el-table> </el-table>
<el-pagination layout="total, sizes, prev, pager, next, jumper" :page-sizes="[10, 20, 50, 100, 200]" :total="total" @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="page"></el-pagination> <el-pagination layout="total, sizes, prev, pager, next, jumper" :page-sizes="[10, 20, 50, 100, 200]" :total="total" @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="page"></el-pagination>
</div> </div>
......
...@@ -2,27 +2,31 @@ ...@@ -2,27 +2,31 @@
<div class="pagex"> <div class="pagex">
<div class="section-page"> <div class="section-page">
<!-- 详情信息区 --> <!-- 详情信息区 -->
<el-descriptions :column="4" border style="margin-bottom: 15px; width: 1200px;"> <el-descriptions :column="3" border style="margin-bottom: 15px; width: 100%;">
<el-descriptions-item label="寄售召回单号"> <el-descriptions-item label="寄售召回单号">
<span style="font-weight: bold">{{ detailData.recall_sn }}{{ detailData.recall_status_val }}</span> <span style="font-weight: bold">
{{ detailData.recall_sn }}{{ detailData.recall_status_val ? `(${detailData.recall_status_val})` : '' }}
</span>
</el-descriptions-item> </el-descriptions-item>
<el-descriptions-item label="订单人员:">{{ detailData.order_uname }}</el-descriptions-item> <el-descriptions-item label="供应商名称:">
<span style="white-space: nowrap;">{{ detailData.supplier_name }}</span>
</el-descriptions-item>
<el-descriptions-item label="创建时间:">{{ detailData.create_time }}</el-descriptions-item>
<el-descriptions-item label="收货人:">{{ (detailData.supplier_address && detailData.supplier_address.contact) || '-' }}</el-descriptions-item> <el-descriptions-item label="收货人:">{{ (detailData.supplier_address && detailData.supplier_address.contact) || '-' }}</el-descriptions-item>
<el-descriptions-item label="收货人电话:">{{ (detailData.supplier_address && detailData.supplier_address.mobile) || '-' }}</el-descriptions-item> <el-descriptions-item label="收货人电话:">{{ (detailData.supplier_address && detailData.supplier_address.mobile) || '-' }}</el-descriptions-item>
<el-descriptions-item label="备注:">
<div class="remark-content">{{ detailData.delivery_remark || '-' }}</div>
</el-descriptions-item>
<el-descriptions-item label="收货地址:" :span="2">{{ (detailData.supplier_address && detailData.supplier_address.info) || '-' }}</el-descriptions-item> <el-descriptions-item label="收货地址:" :span="2">{{ (detailData.supplier_address && detailData.supplier_address.info) || '-' }}</el-descriptions-item>
</el-descriptions> </el-descriptions>
<!--列表区--> <!--列表区-->
<div class="data-box"> <div class="data-box">
<el-table :data="list" border max-height="600" @selection-change="handleSelectionChange"> <el-table :data="list" border max-height="600" @selection-change="handleSelectionChange">
<el-table-column type="index" label="序号" width="50" align="center" fixed></el-table-column> <el-table-column type="index" label="序号" width="50" align="center" fixed></el-table-column>
<el-table-column prop="recall_item_id" label="明细ID" width="100" :show-overflow-tooltip="true" align="center"></el-table-column> <el-table-column prop="sku_id" label="SKUID" width="250" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="sku_id" label="SKUID" width="200" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="goods_name" label="型号" :show-overflow-tooltip="true" align="center"></el-table-column> <el-table-column prop="goods_name" label="型号" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="brand_name" label="品牌" :show-overflow-tooltip="true" align="center"></el-table-column> <el-table-column prop="brand_name" label="品牌" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="recall_num" label="申请召回数量" width="160" :show-overflow-tooltip="true" align="center"></el-table-column> <el-table-column prop="recall_num" label="召回数量" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="stock_out_num" label="退货出库总数" width="160" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="date_code" label="批次" width="160" :show-overflow-tooltip="true" align="center"></el-table-column>
</el-table> </el-table>
<el-pagination layout="total, sizes, prev, pager, next, jumper" :page-sizes="[10, 20, 50, 100, 200]" :total="total" @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="page"></el-pagination> <el-pagination layout="total, sizes, prev, pager, next, jumper" :page-sizes="[10, 20, 50, 100, 200]" :total="total" @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="page"></el-pagination>
</div> </div>
...@@ -132,6 +136,27 @@ export default { ...@@ -132,6 +136,27 @@ export default {
*/ */
handleSelectionChange(val) { handleSelectionChange(val) {
this.multipleSelection = val; this.multipleSelection = val;
},
/**
* 添加库存
* @param {number} type - 0:添加选中 1:一键添加全部
*/
addInventory(type) {
if (!this.multipleSelection.length) {
this.$message.warning('请选择数据');
return;
}
if (type) {
// 一键添加全部库存
this.recall_json = this.list;
} else {
// 添加选中的库存
this.recall_json = this.multipleSelection;
}
this.dialogVisible_1 = false; // 关闭弹窗
this.$message.success('添加成功');
} }
}, },
components: { components: {
...@@ -140,5 +165,8 @@ export default { ...@@ -140,5 +165,8 @@ export default {
}; };
</script> </script>
<style scoped> <style scoped>
.remark-content {
min-width: 200px;
word-break: break-all; /* 防止文字溢出 */
}
</style> </style>
\ No newline at end of file
<template>
<div class="pagex">
<div class="section-page">
<div style="margin-bottom: 25px;">
<el-button type="primary" @click="generateConsignmentRecall">提交</el-button>
<el-button @click="$router.push('/consignmentRecall')">取消</el-button>
</div>
<div class="row bothSide" style="margin-bottom: 10px;">
<div style="width: 48%">
<div class="xktitle" style="margin-bottom: 10px">收货信息<i class="el-icon-edit-outline" style="margin-left: 10px;" @click="dialogVisible_3=true"></i></div>
<div class="row" v-if="updateConsignmentRecallReceiptInfoParams.province">
<i class="el-icon-map-location" style="margin-top: 16px;"></i>
<el-descriptions :column="1" :colon="false">
<el-descriptions-item>
{{ updateConsignmentRecallReceiptInfoParams.country }}
{{ updateConsignmentRecallReceiptInfoParams.province }}
{{ updateConsignmentRecallReceiptInfoParams.city }}
{{ updateConsignmentRecallReceiptInfoParams.district }}
{{ updateConsignmentRecallReceiptInfoParams.detail }}
</el-descriptions-item>
<el-descriptions-item label="">
{{ updateConsignmentRecallReceiptInfoParams.contact }}
{{ updateConsignmentRecallReceiptInfoParams.mobile }}
</el-descriptions-item>
</el-descriptions>
</div>
</div>
<div style="width: 48%">
<div class="xktitle" style="margin-bottom: 10px">配送信息</div>
<el-descriptions :column="2" :colon="false">
<el-descriptions-item label="配送方式:">快递</el-descriptions-item>
<el-descriptions-item label="物流承运商:">顺丰速运</el-descriptions-item>
<el-descriptions-item label="备注:" :span="2">
<el-input v-model="delivery_remark" placeholder="请输入配送备注" clearable></el-input>
</el-descriptions-item>
</el-descriptions>
</div>
</div>
<div class="xktitle" style="margin-bottom: 10px;">召回库存明细</div>
<el-button type="primary" @click="add">添加</el-button>
<div style="margin-top: 10px;">
<el-table :data="recall_json" border max-height="500">
<el-table-column type="index" label="序号" width="50" align="center" fixed></el-table-column>
<el-table-column prop="sku_id" label="SKUID" width="200" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="goods_name" label="型号" min-width="180" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="brand_name" label="标准品牌" min-width="180" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="useable_qty" label="可用库存数量" width="150" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="useable_qty" label="召回数量" width="100" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="date_code" label="D/C" width="100" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="coo" label="产地" width="80" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="create_time" label="入库时间" width="160" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column fixed="right" label="操作" width="80" align="center">
<template slot-scope="scope">
<el-button type="danger" size="mini" @click="handleDelete(scope.$index, scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
<Menu></Menu>
<!--添加-->
<el-dialog title="添加" :close-on-click-modal="false" :visible.sync="dialogVisible_1" width="1100px">
<el-form :inline="true" :model="wmsStockListParams" ref="wmsStockListParams" label-width="80px" size="mini">
<el-form-item label="型号" prop="goods_name">
<el-autocomplete v-model="wmsStockListParams.goods_name" :trigger-on-focus="false" @keyup.enter.native="onSubmit" :fetch-suggestions="querySearchAsync" placeholder="请输入型号" clearable></el-autocomplete>
</el-form-item>
<el-form-item label="标准品牌" prop="brand_name">
<el-input v-model="wmsStockListParams.brand_name" placeholder="请输入标准品牌"></el-input>
</el-form-item>
<el-form-item size="mini" style="text-align: right">
<el-button type="primary" @click="onSubmit">搜索</el-button>
<el-button @click="resetForm('wmsStockListParams')">重置</el-button>
</el-form-item>
</el-form>
<!--操作区-->
<div class="operation-area row verCenter bothSide">
<div class="operation-button row verCenter">
<el-button type="primary" @click="addInventory(0)">添加</el-button>
<el-button type="primary" @click="addInventory(1)">一键添加全部库存</el-button>
</div>
<div class="text-tip row verCenter">
<i class="el-icon-warning"></i>
<span>选择要召回的商品,将召回该商品的全部可用库存数量</span>
</div>
</div>
<el-table :data="wmsStockList" border max-height="600" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="40" align="center" fixed></el-table-column>
<el-table-column prop="sku_id" label="SKUID" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="goods_name" label="型号" width="180" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="brand_name" label="标准品牌" width="180" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="useable_qty" label="可用库存数量" width="150" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="date_code" label="D/C" width="100" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="coo" label="产地" width="80" :show-overflow-tooltip="true" align="center"></el-table-column>
<el-table-column prop="create_time" label="入库时间" width="160" :show-overflow-tooltip="true" align="center"></el-table-column>
</el-table>
<el-pagination layout="total, sizes, prev, pager, next, jumper" :page-sizes="[10, 20, 50, 100, 200]" :total="total" @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="page"></el-pagination>
</el-dialog>
<!--收货信息-->
<el-dialog title="收货信息" :close-on-click-modal="false" :visible.sync="dialogVisible_3" width="500px">
<el-form :model="updateConsignmentRecallReceiptInfoParams" label-width="80px" size="mini" :rules="rules" ref="updateConsignmentRecallReceiptInfoParams">
<el-form-item label="收货人" prop="contact">
<el-input v-model="updateConsignmentRecallReceiptInfoParams.contact" placeholder="请输入收货人"></el-input>
</el-form-item>
<el-form-item label="收货电话" prop="mobile">
<el-input v-model="updateConsignmentRecallReceiptInfoParams.mobile" placeholder="请输入收货电话"></el-input>
</el-form-item>
<el-form-item label="收货地址" prop="province">
<el-cascader size="mini" placeholder="请选择收货地址省市区" :options="options" v-model="selectedOptions" @change="handleChange" style="width: 100%" :props="{ checkStrictly: false }"></el-cascader>
</el-form-item>
<el-form-item prop="detail">
<el-input type="textarea" v-model="updateConsignmentRecallReceiptInfoParams.detail" placeholder="请输入详细地址"></el-input>
</el-form-item>
<el-form-item size="mini" style="text-align: right">
<el-button @click="dialogVisible_3 = false">取消</el-button>
<el-button type="primary" @click="updateConsignmentRecallReceiptInfo('updateConsignmentRecallReceiptInfoParams')">确定</el-button>
</el-form-item>
</el-form>
</el-dialog>
</div>
</template>
<script>
import Vue from 'vue';
import Menu from "@/components/menu.vue";
import {Autocomplete, Button, Cascader, DatePicker, Descriptions, DescriptionsItem, Dialog, Divider, Dropdown, DropdownItem, DropdownMenu, Form, FormItem, Input, Link, Message, MessageBox, Option, Pagination, Popover, Select, Table, TableColumn, Tag, Tooltip} from 'element-ui'
import {pcaTextArr} from 'element-china-area-data'
Vue.prototype.$message = Message
Vue.prototype.$confirm = MessageBox.confirm;
Vue.use(Button).use(Link).use(Cascader).use(Form).use(Select).use(Option).use(Input).use(FormItem).use(Dialog).use(Tooltip).use(Autocomplete).use(Popover).use(Tag).use(Divider);
Vue.use(DatePicker).use(Dropdown).use(DropdownMenu).use(DropdownItem).use(TableColumn).use(Table).use(Pagination).use(Descriptions).use(DescriptionsItem);
export default {
name: "createConsignmentRecallOrder",
data() {
return {
options: pcaTextArr,
selectedOptions: [],
total: 0,
page: 1,
limit: 10,
multipleSelection: [],
recall_json: [],//召回库存明细列表
dialogVisible_1: false,
dialogVisible_3: false,
wmsStockList: [],
delivery_remark: '',//配送备注
updateConsignmentRecallReceiptInfoParams: {
contact: '',//收货人
mobile: '',//收货电话
country: '中国',//国家
province: '',//省
city: '',//市
district: '',//区
detail: ''//详细地址
},
rules: {
contact: [
{required: true, message: '请输入收货人', trigger: 'blur'},
],
mobile: [
{required: true, message: '请输入收货电话', trigger: 'blur'},
],
province: [
{required: true, message: '请选择收货地址', trigger: 'change'},
],
detail: [
{required: true, message: '请输入详细地址', trigger: 'blur'},
]
},
wmsStockListParams: {
goods_name: '',
brand_name: ''
},
};
},
created() {
this.getData();
this.getConsignmentRecallReceiptInfo();
},
methods: {
getData() {
var params = Object.assign({}, this.formParam, {page: this.page, limit: this.limit});
this.$http('GET', "/api/consignmentRecall/getConsignmentRecallList", params).then(res => {
if (res.code === 0) {
this.list = res.data.list || [];
this.total = Number(res.data.total) || 0;
} else {
this.$message.error(res.msg);
}
})
},
/**
* 省市区级联选择监听
* @param value
*/
handleChange(value) {
if (value && value.length) {
this.updateConsignmentRecallReceiptInfoParams.province = value[0];//省
this.updateConsignmentRecallReceiptInfoParams.city = value[1];//市
this.updateConsignmentRecallReceiptInfoParams.district = value[2];//区
} else {
this.updateConsignmentRecallReceiptInfoParams.province = '';
this.updateConsignmentRecallReceiptInfoParams.city = '';
this.updateConsignmentRecallReceiptInfoParams.district = '';
}
},
/**
* 生成寄售召回单-提交
*/
generateConsignmentRecall() {
if (!this.recall_json.length) {
this.$message.warning('请添加召回库存明细');
return;
}
// 处理 recall_json,添加 recall_num 字段
const processedRecallJson = this.recall_json.map(item => ({
...item,
recall_num: item.useable_qty
}));
this.$confirm(`<p style="font-size: 13px;">确定将选择的库存提交寄售召回?</p><p style="color: #FF7E11;font-size: 13px;">提交后,猎芯将进行出库作业,寄回到指定收货地址</p>`, '提交', {
confirmButtonText: '确定',
cancelButtonText: '取消',
dangerouslyUseHTMLString: true,
type: 'normal'
}).then(() => {
this.$http('POST', "/api/consignmentRecall/generateConsignmentRecall", {
delivery_remark: this.delivery_remark,
recall_json: JSON.stringify(processedRecallJson)
}).then(res => {
if (res.code === 0) {
this.$message.success('提交成功');
this.closetab('/createConsignmentRecallOrder')
this.$router.push('/consignmentRecall');
} else {
this.$message.error(res.msg);
}
})
}).catch(() => {
// 取消操作
});
},
/**
* 寄售召回-获取收货地址
*/
getConsignmentRecallReceiptInfo() {
this.$http('GET', "/api/consignmentRecall/getConsignmentRecallReceiptInfo", {}).then(res => {
if (res.code === 0) {
this.updateConsignmentRecallReceiptInfoParams = res.data;
// 如果省份为空,弹出收货信息弹窗
if (!res.data.province) {
this.dialogVisible_3 = true
} else {
this.selectedOptions = [res.data.province, res.data.city, res.data.district];
}
}
})
},
/**
* 寄售召回-修改收货地址
*/
updateConsignmentRecallReceiptInfo(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
this.$http('POST', "/api/consignmentRecall/updateConsignmentRecallReceiptInfo", this.updateConsignmentRecallReceiptInfoParams).then(res => {
if (res.code === 0) {
this.$message({
message: '收货信息更新成功',
type: 'success',
onClose: () => {
this.dialogVisible_3 = false;
this.getConsignmentRecallReceiptInfo();
}
});
} else {
this.$message.error(res.msg || '操作失败');
}
})
} else {
console.log('error submit!!');
return false;
}
});
},
/**
* 添加
*/
add() {
this.dialogVisible_1 = true;
this.getWmsStockList();
},
/**
* 关闭当前页面
* @param path
*/
closetab(path) {
let tab_arr = JSON.parse(sessionStorage.getItem('tabs'))
for (var i = 0; i < tab_arr.length; i++) {
if (tab_arr[i].path == path) {
tab_arr.splice(i, 1);
sessionStorage.setItem('tabs', JSON.stringify(tab_arr));
if (path == this.$route.path) {
if (i == 0) {
this.$router.push({
path: "/"
})
} else {
if (tab_arr[i - 1].query) {
this.$router.push({
path: tab_arr[i - 1].path,
query: tab_arr[i - 1].query
})
} else {
this.$router.push({
path: tab_arr[i - 1].path,
})
}
}
}
break;
}
}
},
/**
* 获取wms库存列表
*/
getWmsStockList() {
var params = Object.assign({}, this.wmsStockListParams, {page: this.page, limit: this.limit});
this.$http('GET', "/api/consignmentRecall/getWmsStockList", params).then(res => {
if (res.code === 0) {
this.wmsStockList = res.data.list || [];
this.total = Number(res.data.total) || 0;
} else {
this.$message.error(res.msg);
}
})
},
/**
* 添加库存
* @param {number} type - 0:添加选中 1:一键添加全部
*/
async addInventory(type) {
if (!this.multipleSelection.length && type === 0) {
this.$message.warning('请选择数据');
return;
}
// 检查重复数据
const checkDuplicate = (newItems) => {
return newItems.filter(newItem =>
!this.recall_json.some(existingItem => existingItem.stock_id === newItem.stock_id)
);
};
if (type == 1) {
try {
// 一键添加全部库存时,先获取完整列表
const originalLimit = this.limit;
this.limit = 1000000; // 临时设置较大的limit
const params = Object.assign({}, this.wmsStockListParams, {page: this.page, limit: this.limit});
const res = await this.$http('GET', "/api/consignmentRecall/getWmsStockList", params);
if (res.code === 0) {
this.recall_json = res.data.list || [];
this.$message.success('成功添加全部商品');
} else {
this.$message.error(res.msg);
}
this.limit = originalLimit; // 恢复原来的limit值
} catch (error) {
this.$message.error('获取数据失败');
}
} else {
// 添加选中的库存
const uniqueItems = checkDuplicate(this.multipleSelection);
this.recall_json = [...this.recall_json, ...uniqueItems];
this.$message.success('成功添加选中商品');
}
this.dialogVisible_1 = false; // 关闭弹窗
},
/**
* 列表分页条数筛选监听
* @param val
*/
handleSizeChange(val) {
this.limit = val;
this.getWmsStockList();
},
/**
* 列表分页输入页码监听
* @param val
*/
handleCurrentChange(val) {
this.page = val;
this.getWmsStockList();
},
/**
* chebox 选择监听
* @param val
*/
handleSelectionChange(val) {
this.multipleSelection = val;
},
/**
* 型号监听
* @param queryString
* @param cb
*/
querySearchAsync(queryString, cb) {
if (!queryString) {
cb([]);
return;
}
this.$http('GET', "/api/search/getspu", {spu_name: queryString}).then(res => {
if (res.code == 0 && res.data.list?.length) {
const arr = res.data.list.map(item => ({
value: item.spu_name
}));
cb(arr);
} else {
cb([]);
}
}).catch(() => {
cb([]);
});
},
/**
* 搜索
*/
onSubmit() {
this.page = 1;
this.getWmsStockList();
},
/**
* 重置表单
* @param formName
*/
resetForm(formName) {
this.$refs[formName].resetFields();
},
/**
* 删除召回库存明细
* @param {number} index - 当前行的索引
* @param {object} row - 当前行数据
*/
handleDelete(index, row) {
this.$confirm('确认删除该库存商品?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.recall_json.splice(index, 1);
this.$message.success('删除成功');
}).catch(() => {
// 取消删除操作
});
}
},
components: {
Menu
}
};
</script>
<style scoped>
.xktitle {
border-left: 5px solid #1969F9;
height: 38px;
line-height: 38px;
background: #f3f3f3;
padding-left: 20px;
font-weight: bold;
color: #333;
}
.el-icon-edit-outline {
cursor: pointer;
&:hover {
color: #409eff;
}
}
</style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment