Commit 14dc8140 by liangjianmin

Merge branch 'feature/ljm/20250710-优化'

parents 4db1300c beecb027
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
<el-dropdown-item command="1">修改安全库存</el-dropdown-item> <el-dropdown-item command="1">修改安全库存</el-dropdown-item>
<el-dropdown-item command="2">修改交期</el-dropdown-item> <el-dropdown-item command="2">修改交期</el-dropdown-item>
<el-dropdown-item command="3">上架有效期</el-dropdown-item> <el-dropdown-item command="3">上架有效期</el-dropdown-item>
<el-dropdown-item command="4">修改销售价格</el-dropdown-item> <el-dropdown-item command="4">修改成本价格</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
</div> </div>
...@@ -94,8 +94,8 @@ ...@@ -94,8 +94,8 @@
<el-table-column prop="stock" label="可用库存数量" width="100" align="center" :show-overflow-tooltip="true"></el-table-column> <el-table-column prop="stock" label="可用库存数量" width="100" align="center" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="in_transit_stock" label="在途库存" width="100" align="center" :show-overflow-tooltip="true"></el-table-column> <el-table-column prop="in_transit_stock" label="在途库存" width="100" align="center" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="consignment_safe_stock" label="安全库存" width="100" align="center" :show-overflow-tooltip="true"></el-table-column> <el-table-column prop="consignment_safe_stock" label="安全库存" width="100" align="center" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="cn_ladder_price" label="含税销售价(¥)" width="120" align="center" :show-overflow-tooltip="true"> <el-table-column prop="cn_ladder_price" label="含税成本价(¥)" width="120" align="center" :show-overflow-tooltip="true">
<template slot-scope="scope" v-if="scope.row.cn_ladder_price && scope.row.cn_ladder_price.length>0"> <template slot-scope="scope" v-if="scope.row.cn_ladder_price && scope.row.cn_ladder_price.length > 0">
<el-popover effect="light" trigger="hover" placement="bottom"> <el-popover effect="light" trigger="hover" placement="bottom">
<p class="row" v-for="item in scope.row.cn_ladder_price"> <p class="row" v-for="item in scope.row.cn_ladder_price">
<span>{{ item.purchases }}+</span> <span>{{ item.purchases }}+</span>
...@@ -105,8 +105,8 @@ ...@@ -105,8 +105,8 @@
</el-popover> </el-popover>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="hk_ladder_price" label="美金销售价($)" width="120" align="center" :show-overflow-tooltip="true"> <el-table-column prop="hk_ladder_price" label="美金成本价($)" width="120" align="center" :show-overflow-tooltip="true">
<template slot-scope="scope" v-if="scope.row.cn_ladder_price && scope.row.cn_ladder_price.length>0"> <template slot-scope="scope" v-if="scope.row.cn_ladder_price && scope.row.cn_ladder_price.length > 0">
<el-popover effect="light" trigger="hover" placement="bottom"> <el-popover effect="light" trigger="hover" placement="bottom">
<p class="row" v-for="item in scope.row.hk_ladder_price"> <p class="row" v-for="item in scope.row.hk_ladder_price">
<span>{{ item.purchases }}+</span> <span>{{ item.purchases }}+</span>
...@@ -162,8 +162,8 @@ ...@@ -162,8 +162,8 @@
<el-table-column prop="source_val" label="来源" width="150" align="center" :show-overflow-tooltip="true"></el-table-column> <el-table-column prop="source_val" label="来源" width="150" align="center" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="goods_status" label="状态" width="100" align="center" :show-overflow-tooltip="true"> <el-table-column prop="goods_status" label="状态" width="100" align="center" :show-overflow-tooltip="true">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.goods_status==1" class="f-green">上架</span> <span v-if="scope.row.goods_status == 1" class="f-green">上架</span>
<span v-else-if="scope.row.goods_status==3">下架</span> <span v-else-if="scope.row.goods_status == 3">下架</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="cp_time" label="上架有效期" width="150" align="center" :show-overflow-tooltip="true"></el-table-column> <el-table-column prop="cp_time" label="上架有效期" width="150" align="center" :show-overflow-tooltip="true"></el-table-column>
...@@ -192,9 +192,9 @@ ...@@ -192,9 +192,9 @@
</el-table> </el-table>
</div> </div>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">取 消</el-button> <el-button @click="dialogVisible = false">取 消</el-button>
<el-button type="primary" @click="submitKc">确 定</el-button> <el-button type="primary" @click="submitKc">确 定</el-button>
</span> </span>
</el-dialog> </el-dialog>
<!--修改交期弹窗--> <!--修改交期弹窗-->
<el-dialog title="修改交期" :close-on-click-modal="false" :visible.sync="dialogVisible2" width="900px"> <el-dialog title="修改交期" :close-on-click-modal="false" :visible.sync="dialogVisible2" width="900px">
...@@ -221,9 +221,9 @@ ...@@ -221,9 +221,9 @@
</el-table> </el-table>
</div> </div>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible2 = false">取 消</el-button> <el-button @click="dialogVisible2 = false">取 消</el-button>
<el-button type="primary" @click="submitHq">确 定</el-button> <el-button type="primary" @click="submitHq">确 定</el-button>
</span> </span>
</el-dialog> </el-dialog>
<!--修改上架有效期弹窗--> <!--修改上架有效期弹窗-->
<el-dialog title="修改上架有效期" :close-on-click-modal="false" :visible.sync="dialogVisible3" width="900px"> <el-dialog title="修改上架有效期" :close-on-click-modal="false" :visible.sync="dialogVisible3" width="900px">
...@@ -233,8 +233,8 @@ ...@@ -233,8 +233,8 @@
<el-table-column prop="brand_name" label="品牌" min-width="20%" :show-overflow-tooltip="true"></el-table-column> <el-table-column prop="brand_name" label="品牌" min-width="20%" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="goods_status" label="状态" width="80" :show-overflow-tooltip="true"> <el-table-column prop="goods_status" label="状态" width="80" :show-overflow-tooltip="true">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.goods_status==1" class="f-green">上架</span> <span v-if="scope.row.goods_status == 1" class="f-green">上架</span>
<span v-else-if="scope.row.goods_status==3">下架</span> <span v-else-if="scope.row.goods_status == 3">下架</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="cp_time_temp" label="上架有效期" width="160" :show-overflow-tooltip="true"></el-table-column> <el-table-column prop="cp_time_temp" label="上架有效期" width="160" :show-overflow-tooltip="true"></el-table-column>
...@@ -246,12 +246,12 @@ ...@@ -246,12 +246,12 @@
</el-table> </el-table>
</div> </div>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible3 = false">取 消</el-button> <el-button @click="dialogVisible3 = false">取 消</el-button>
<el-button type="primary" @click="submitCp">确 定</el-button> <el-button type="primary" @click="submitCp">确 定</el-button>
</span> </span>
</el-dialog> </el-dialog>
<!--修改销售价格--> <!--修改成本价格-->
<el-dialog title="修改销售价格" :close-on-click-modal="false" :visible.sync="dialogVisible4" width="900px"> <el-dialog title="修改成本价格" :close-on-click-modal="false" :visible.sync="dialogVisible4" width="900px">
<div class="kc-mask"> <div class="kc-mask">
<el-table :data="priceData" border max-height="600" style="margin-bottom: 10px"> <el-table :data="priceData" border max-height="600" style="margin-bottom: 10px">
<el-table-column label="商品信息" width="100%"> <el-table-column label="商品信息" width="100%">
...@@ -269,12 +269,12 @@ ...@@ -269,12 +269,12 @@
<el-input v-model="skuOriginalStepPriceData[scope.$index].purchases" @input="handleInput(scope.$index)" placeholder="起订量" onkeyup="if(event.keyCode !=37 &amp;&amp; event.keyCode != 39){if (!/^[\d]+$/ig.test(this.value)){this.value='';}}"></el-input> <el-input v-model="skuOriginalStepPriceData[scope.$index].purchases" @input="handleInput(scope.$index)" placeholder="起订量" onkeyup="if(event.keyCode !=37 &amp;&amp; event.keyCode != 39){if (!/^[\d]+$/ig.test(this.value)){this.value='';}}"></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="price_cn" label="含税销售价(RMB)" min-width="20%" :show-overflow-tooltip="true"> <el-table-column prop="price_cn" label="含税成本价(RMB)" min-width="20%" :show-overflow-tooltip="true">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="skuOriginalStepPriceData[scope.$index].price_cn" placeholder="¥"></el-input> <el-input v-model="skuOriginalStepPriceData[scope.$index].price_cn" placeholder="¥"></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="price_us" label="美金销售价(USD)" min-width="20%" :show-overflow-tooltip="true"> <el-table-column prop="price_us" label="美金成本价(USD)" min-width="20%" :show-overflow-tooltip="true">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="skuOriginalStepPriceData[scope.$index].price_us" placeholder="$"></el-input> <el-input v-model="skuOriginalStepPriceData[scope.$index].price_us" placeholder="$"></el-input>
</template> </template>
...@@ -291,9 +291,9 @@ ...@@ -291,9 +291,9 @@
<i class="el-icon-plus add" @click="addRow" style="color: #409EFF;cursor: pointer;margin-top: 20px;">增加阶梯价</i> <i class="el-icon-plus add" @click="addRow" style="color: #409EFF;cursor: pointer;margin-top: 20px;">增加阶梯价</i>
</div> </div>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible4 = false">取 消</el-button> <el-button @click="dialogVisible4 = false">取 消</el-button>
<el-button type="primary" @click="updateSkuOriginalStepPrice">确 定</el-button> <el-button type="primary" @click="updateSkuOriginalStepPrice">确 定</el-button>
</span> </span>
</el-dialog> </el-dialog>
<!--弹窗日志--> <!--弹窗日志-->
<el-dialog title="现货库存管理日志" :close-on-click-modal="false" :visible.sync="dialogVisibleLog" width="1000px"> <el-dialog title="现货库存管理日志" :close-on-click-modal="false" :visible.sync="dialogVisibleLog" width="1000px">
...@@ -301,7 +301,7 @@ ...@@ -301,7 +301,7 @@
<el-table-column prop="create_time" label="时间" min-width="150" align="center"></el-table-column> <el-table-column prop="create_time" label="时间" min-width="150" align="center"></el-table-column>
<el-table-column prop="message" label="操作说明" min-width="150" align="center"> <el-table-column prop="message" label="操作说明" min-width="150" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span>修改了价格,点击查看 <a style="color: #409EFF" href="javascript:;" @click="handleDetailClick(scope.row.message.pre_data,scope.row.message.current_data)">修改详情</a></span> <span>修改了价格,点击查看 <a style="color: #409EFF" href="javascript:;" @click="handleDetailClick(scope.row.message.pre_data, scope.row.message.current_data)">修改详情</a></span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="operator" label="操作人" min-width="150" align="center"></el-table-column> <el-table-column prop="operator" label="操作人" min-width="150" align="center"></el-table-column>
...@@ -338,13 +338,13 @@ ...@@ -338,13 +338,13 @@
<i class="el-icon-upload"></i> <i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div> <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
<div class="el-upload__tip" slot="tip"> <div class="el-upload__tip" slot="tip">
<el-link type="primary" href="/批量修改.csv" :underline="false">下载模板</el-link> <el-link type="primary" :href="jsHref" :underline="false">下载模板</el-link>
</div> </div>
</el-upload> </el-upload>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="dialogVisibleBatchModify = false">取 消</el-button> <el-button @click="dialogVisibleBatchModify = false">取 消</el-button>
<el-button type="primary" @click="">确 定</el-button> <el-button type="primary" @click="">确 定</el-button>
</span> </span>
</el-dialog> </el-dialog>
<!--寄售召回--> <!--寄售召回-->
<el-dialog title="寄售召回" :close-on-click-modal="false" :visible.sync="dialogVisibleConsignmentRecall" width="900px"> <el-dialog title="寄售召回" :close-on-click-modal="false" :visible.sync="dialogVisibleConsignmentRecall" width="900px">
...@@ -362,471 +362,370 @@ ...@@ -362,471 +362,370 @@
</el-table> </el-table>
</div> </div>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button @click="dialogVisibleConsignmentRecall = false">取 消</el-button> <el-button @click="dialogVisibleConsignmentRecall = false">取 消</el-button>
<el-button type="primary" @click="addConsignmentRecallFromStock">确 定</el-button> <el-button type="primary" @click="addConsignmentRecallFromStock">确 定</el-button>
</span> </span>
</el-dialog> </el-dialog>
<Menu/> <Menu />
</div> </div>
</template> </template>
<script> <script>
import Vue from 'vue'; import Vue from 'vue';
import Menu from "@/components/menu.vue"; import Menu from "@/components/menu.vue";
import {Autocomplete, Button, DatePicker, Dialog, Dropdown, DropdownItem, DropdownMenu, Form, FormItem, Input, Link, Message, Option, Pagination, Popover, Select, Table, TableColumn, Tag, Tooltip, Upload} from 'element-ui' import { Autocomplete, Button, DatePicker, Dialog, Dropdown, DropdownItem, DropdownMenu, Form, FormItem, Input, Link, Message, Option, Pagination, Popover, Select, Table, TableColumn, Tag, Tooltip, Upload } from 'element-ui'
import Util from "@/tool"; import Util from "@/tool";
import {NODE_ENVS} from "@/ajax"; import { NODE_ENVS } from "@/ajax";
Vue.prototype.$message = Message Vue.prototype.$message = Message
Vue.use(Button).use(Form).use(Select).use(Option).use(Input).use(FormItem).use(Dialog).use(Tooltip).use(Autocomplete).use(Tag).use(Link) Vue.use(Button).use(Form).use(Select).use(Option).use(Input).use(FormItem).use(Dialog).use(Tooltip).use(Autocomplete).use(Tag).use(Link)
Vue.use(DatePicker).use(Upload).use(Dropdown).use(DropdownMenu).use(DropdownItem).use(TableColumn).use(Table).use(Pagination).use(Popover) Vue.use(DatePicker).use(Upload).use(Dropdown).use(DropdownMenu).use(DropdownItem).use(TableColumn).use(Table).use(Pagination).use(Popover)
export default { export default {
name: "consignmentInventory", name: "consignmentInventory",
data() { data() {
return { return {
total: 0, jsHref: location.hostname === 'xinlian.ichunt.com' ? 'https://cloud.ichunt.com/template/批量修改寄售商品模板.csv' : 'http://cloud.liexindev.net/template/批量修改寄售商品模板.csv',
limit: 10, total: 0,
page: 1, limit: 10,
dialogVisible: false,//库存弹窗 page: 1,
dialogVisible2: false,//交期弹窗 dialogVisible: false,//库存弹窗
dialogVisible3: false,//上架有效期 dialogVisible2: false,//交期弹窗
dialogVisible4: false,//修改价格 dialogVisible3: false,//上架有效期
dialogVisibleLog: false,//日志 dialogVisible4: false,//修改价格
dialogVisibleLogDetail: false,//日志详情 dialogVisibleLog: false,//日志
dialogVisibleBatchModify: false,//批量修改 dialogVisibleLogDetail: false,//日志详情
dialogVisibleConsignmentRecall: false,//寄售召回 dialogVisibleBatchModify: false,//批量修改
consignmentRecallData: [],//寄售召回数据 dialogVisibleConsignmentRecall: false,//寄售召回
logs: [], consignmentRecallData: [],//寄售召回数据
downHref: "", logs: [],
cp_time_val: '', downHref: "",
formParam: { cp_time_val: '',
goods_name: '', formParam: {
status: '', goods_name: '',
brand_name: '', status: '',
date: '', brand_name: '',
cp_time: '', date: '',
source: '' cp_time: '',
}, source: ''
multipleSelection: [], },
selectData: [], multipleSelection: [],
huoqidata: [],//修改交期数据 selectData: [],
kucundata: [],//修改库存数据 huoqidata: [],//修改交期数据
cpdata: [],//上架有效期数据 kucundata: [],//修改库存数据
priceData: [],//修改价格数据 cpdata: [],//上架有效期数据
message: {}, priceData: [],//修改价格数据
skuOriginalStepPriceData: [], message: {},
goods_id: '', skuOriginalStepPriceData: [],
stock: 0, goods_id: '',
tableData: [], stock: 0,
brandList: [], tableData: [],
disabled: false, brandList: [],
timer: null, disabled: false,
skuStatistics: {},//统计数据 timer: null,
skuRankList: {},//sku的型号统计排名列表 skuStatistics: {},//统计数据
pickerOptions: { skuRankList: {},//sku的型号统计排名列表
disabledDate: this.disabledDate pickerOptions: {
}, disabledDate: this.disabledDate
uploadUrl: NODE_ENVS + '/api/sku/batchUpdateSku', },
uploadHeaders: { uploadUrl: NODE_ENVS + '/api/sku/batchUpdateSku',
'Authorization': 'Bearer ' + Util.getCookie('token') uploadHeaders: {
} 'Authorization': 'Bearer ' + Util.getCookie('token')
};
},
created() {
this.getData();
this.getSkuRankList();
},
methods: {
/**
* 查看日志
* @param row
*/
handleClick(row) {
this.getLogs(507, row.goods_id);
},
/**
* 查看日志详情
* @param row
*/
handleDetailClick(pre_data, current_data) {
var data = Object.assign({}, {
pre_data: pre_data,
current_data: current_data
});
this.dialogVisibleLogDetail = true;
this.message = data;
},
/**
* 获取日志
* @param obj_type
* @param obj_id
*/
getLogs(obj_type, obj_id) {
this.$http('GET', "/api/log/getLogs", {
obj_type: obj_type,
obj_id: obj_id
}).then(res => {
if (res.code === 0) {
this.dialogVisibleLog = true;
this.logs = res.data.list;
} else {
this.$message({
message: res.msg,
type: 'warning'
});
} }
}); };
},
/**
* 关闭弹窗
*/
closeBothDialogs() {
this.dialogVisibleLog = false;
this.dialogVisibleLogDetail = false;
},
/**
* 修改价格删除
* @param index
* @param row
*/
handleDelete(index, row) {
this.skuOriginalStepPriceData.splice(index, 1);
}, },
/** created() {
* 监听起订量 this.getData();
*/ this.getSkuRankList();
handleInput(index) {
var val = Number(this.skuOriginalStepPriceData[index].purchases) || 0;
var max = Number(this.stock) || 0;
if (val > max) {
this.$set(this.skuOriginalStepPriceData[index], 'purchases', max);
}
}, },
/** methods: {
* 获取数据 /**
*/ * 查看日志
getData() { * @param row
//格式化时间 */
if (this.cp_time_val) { handleClick(row) {
this.formParam.cp_time = this.cp_time_val[0] + '~' + this.cp_time_val[1]; this.getLogs(507, row.goods_id);
} else { },
this.formParam.cp_time = ''; /**
} * 查看日志详情
var params = Object.assign({}, this.formParam, { page: this.page, limit: this.limit, source: 12 }, { action_time: this.formParam.date ? this.formParam.date[0] : '' }, { end_time: this.formParam.date ? this.formParam.date[1] : '' }) * @param row
this.$http('GET', "/api/sku/list", params).then(res => { */
if (res.code === 0) { handleDetailClick(pre_data, current_data) {
this.tableData = res.data.list || []; var data = Object.assign({}, {
this.total = Number(res.data.count) || 0; pre_data: pre_data,
} else { current_data: current_data
this.$message({ });
message: res.msg, this.dialogVisibleLogDetail = true;
type: 'warning' this.message = data;
}); },
/**
* 获取日志
* @param obj_type
* @param obj_id
*/
getLogs(obj_type, obj_id) {
this.$http('GET', "/api/log/getLogs", {
obj_type: obj_type,
obj_id: obj_id
}).then(res => {
if (res.code === 0) {
this.dialogVisibleLog = true;
this.logs = res.data.list;
} else {
this.$message({
message: res.msg,
type: 'warning'
});
}
});
},
/**
* 关闭弹窗
*/
closeBothDialogs() {
this.dialogVisibleLog = false;
this.dialogVisibleLogDetail = false;
},
/**
* 修改价格删除
* @param index
* @param row
*/
handleDelete(index, row) {
this.skuOriginalStepPriceData.splice(index, 1);
},
/**
* 监听起订量
*/
handleInput(index) {
var val = Number(this.skuOriginalStepPriceData[index].purchases) || 0;
var max = Number(this.stock) || 0;
if (val > max) {
this.$set(this.skuOriginalStepPriceData[index], 'purchases', max);
} }
}) },
}, /**
/** * 获取数据
* 获取sku的型号统计排名列表 */
*/ getData() {
getSkuRankList() { //格式化时间
this.$http('GET', "/api/sku/getSkuRankList", {}).then(res => { if (this.cp_time_val) {
if (res.code === 0) { this.formParam.cp_time = this.cp_time_val[0] + '~' + this.cp_time_val[1];
this.skuRankList = res.data.rankList;
} else { } else {
this.$message({ this.formParam.cp_time = '';
message: res.msg,
type: 'warning'
});
} }
}) var params = Object.assign({}, this.formParam, { page: this.page, limit: this.limit, source: 12 }, { action_time: this.formParam.date ? this.formParam.date[0] : '' }, { end_time: this.formParam.date ? this.formParam.date[1] : '' })
}, this.$http('GET', "/api/sku/list", params).then(res => {
/** if (res.code === 0) {
* 型号 this.tableData = res.data.list || [];
* @param queryString this.total = Number(res.data.count) || 0;
* @param cb } else {
*/ this.$message({
querySearchAsync(queryString, cb) { message: res.msg,
if (!queryString) { type: 'warning'
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 => ({ * 获取sku的型号统计排名列表
value: item.spu_name */
})); getSkuRankList() {
cb(arr); this.$http('GET', "/api/sku/getSkuRankList", {}).then(res => {
} else { if (res.code === 0) {
this.skuRankList = res.data.rankList;
} else {
this.$message({
message: res.msg,
type: 'warning'
});
}
})
},
/**
* 型号
* @param queryString
* @param cb
*/
querySearchAsync(queryString, cb) {
if (!queryString) {
cb([]); cb([]);
return;
} }
}).catch(() => { this.$http('GET', "/api/search/getspu", { spu_name: queryString }).then(res => {
cb([]); if (res.code == 0 && res.data.list?.length) {
}); const arr = res.data.list.map(item => ({
}, value: item.spu_name
/** }));
* 品牌 cb(arr);
* @param queryString
* @param cb
*/
querySearchAsyncBrand(queryString, cb) {
this.$http('get', "/api/brand/get_stand_brand", {
brand: queryString
}).then(res => {
if (res.code == 0) {
if (res.data.list.length > 0) {
var arrlist_ = res.data.list || [];
var arr_ = []
for (var i = 0; i < arrlist_.length; i++) {
arr_.push({
value: arrlist_[i]
})
}
cb(arr_);
} else { } else {
cb([]); cb([]);
} }
} }).catch(() => {
}) cb([]);
},
downOut() {
if (this.disabled) {
this.$message({
message: '正在导出中,请不要重复点击',
type: 'warning'
}); });
return },
} /**
this.$http('get', "/api/sku/exportSku", { * 品牌
page: this.page, * @param queryString
limit: this.limit, * @param cb
goods_name: this.formParam.goods_name, */
status: this.formParam.status, querySearchAsyncBrand(queryString, cb) {
brand_id: this.formParam.brand_id, this.$http('get', "/api/brand/get_stand_brand", {
brand_name: this.formParam.brand_name, brand: queryString
action_time: this.formParam.date[0], }).then(res => {
end_time: this.formParam.date[1], if (res.code == 0) {
source: 12 if (res.data.list.length > 0) {
}).then(res => { var arrlist_ = res.data.list || [];
if (res.code == 0) { var arr_ = []
this.disabled = true for (var i = 0; i < arrlist_.length; i++) {
this.$message({ arr_.push({
message: '正在导出中,请耐心等待', value: arrlist_[i]
type: 'success' })
}); }
this.timer = setInterval(() => { cb(arr_);
if (!this.disabled) { } else {
clearInterval(this.timer) cb([]);
return
} }
this.resultDown(res.data) }
}, 3000) })
} },
}) downOut() {
}, if (this.disabled) {
resultDown(id_) {
this.$http('get', "/api/export/get_export_data", {
id: id_
}).then(res => {
if (res.code == 0) {
this.disabled = false;
this.$message({
message: '导出成功',
type: 'success'
});
this.downHref = res.data;
const newsUrl = this.$router.resolve(res.data);
window.open(res.data);
} else if (res.code == -1) {
//导出失败
this.$message({ this.$message({
message: '导出失败', message: '正在导出中,请不要重复点击',
type: 'warning' type: 'warning'
}); });
this.disabled = false; return
} }
}, error => { this.$http('get', "/api/sku/exportSku", {
this.$message('网络出现问题,请检查网络'); page: this.page,
this.disabled = false limit: this.limit,
}) goods_name: this.formParam.goods_name,
}, status: this.formParam.status,
resetForm(formName) { brand_id: this.formParam.brand_id,
this.formParam.date = ''; brand_name: this.formParam.brand_name,
this.cp_time_val = ''; action_time: this.formParam.date[0],
this.$refs[formName].resetFields(); end_time: this.formParam.date[1],
this.formParam.status = ''; source: 12
}, }).then(res => {
onSubmit() { if (res.code == 0) {
this.page = 1; this.disabled = true
this.getData(); this.$message({
}, message: '正在导出中,请耐心等待',
handleSizeChange(val) { type: 'success'
this.limit = val; });
this.getData(); this.timer = setInterval(() => {
}, if (!this.disabled) {
handleCurrentChange(val) { clearInterval(this.timer)
this.page = val; return
this.getData(); }
}, this.resultDown(res.data)
handleSelectionChange(val) { }, 3000)
this.multipleSelection = val; }
}, })
disabledDate(date) { },
var maxDate = new Date(); // 设置最大日期 resultDown(id_) {
var minDate = new Date(); // 设置最小日期 this.$http('get', "/api/export/get_export_data", {
id: id_
var cp_time_day = localStorage.getItem('cp_time_day'); }).then(res => {
if (res.code == 0) {
if (cp_time_day == -1) { this.disabled = false;
// “无限制”,则修改上架有效期默认为:2035-01-01 this.$message({
var maxDate = new Date('2035-01-01'); message: '导出成功',
} else { type: 'success'
var maxDate = new Date(new Date().getTime() + cp_time_day * 24 * 60 * 60 * 1000); });
} this.downHref = res.data;
const newsUrl = this.$router.resolve(res.data);
window.open(res.data);
} else if (res.code == -1) {
//导出失败
this.$message({
message: '导出失败',
type: 'warning'
});
this.disabled = false;
}
}, error => {
this.$message('网络出现问题,请检查网络');
this.disabled = false
})
},
resetForm(formName) {
this.formParam.date = '';
this.cp_time_val = '';
this.$refs[formName].resetFields();
this.formParam.status = '';
},
onSubmit() {
this.page = 1;
this.getData();
},
handleSizeChange(val) {
this.limit = val;
this.getData();
},
handleCurrentChange(val) {
this.page = val;
this.getData();
},
handleSelectionChange(val) {
this.multipleSelection = val;
},
disabledDate(date) {
var maxDate = new Date(); // 设置最大日期
var minDate = new Date(); // 设置最小日期
return date > maxDate || date < minDate; // 返回 true 禁用日期,返回 false 启用日期
},
/**
*
* @param date 时间类型
* @param type 是否加30天
* @returns {string}
*/
getTimes(date, type) {
if (type) {
var cp_time_day = localStorage.getItem('cp_time_day'); var cp_time_day = localStorage.getItem('cp_time_day');
if (cp_time_day == -1) { if (cp_time_day == -1) {
// “无限制”,则修改上架有效期默认为:2035-01-01 // “无限制”,则修改上架有效期默认为:2035-01-01
var date = new Date('2035-01-01'); var maxDate = new Date('2035-01-01');
} else { } else {
var date = new Date(new Date().getTime() + cp_time_day * 24 * 60 * 60 * 1000); var maxDate = new Date(new Date().getTime() + cp_time_day * 24 * 60 * 60 * 1000);
} }
} else {
var date = new Date(date);
}
var year = date.getFullYear();
var month = date.getMonth() + 1;
var day = date.getDate();
var hour = date.getHours() < 10 ? '0' + date.getHours() : date.getHours();
var minute = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes();
var second = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
month >= 1 && month <= 9 ? (month = '0' + month) : '';
day >= 0 && day <= 9 ? (day = '0' + day) : '';
var timer = year + '-' + month + '-' + day + ' ' + 0 + ':' + 0 + ':' + 0;
return timer;
},
/**
* 统计查看
* @param val
*/
showChange(row) {
this.$http('GET', "/api/sku/getSkuStatistics", {
goods_name: row.goods_name,
brand_name: row.brand_name
}).then(res => {
if (res.code == 0) {
this.skuStatistics = res.data.statisticsData;
} else {
this.$message({
message: res.msg,
type: 'warning'
});
}
})
},
/**
* 修改按钮
* @param command
*/
handleCommand(command) {
if (this.multipleSelection.length == 0) {
this.$message({
message: '请至少选择一条数据',
type: 'warning'
});
return;
}
// 修改价格时检查是否只选择了一条数据
if (command == 4 && this.multipleSelection.length > 1) {
this.$message({
message: '只能选择一条数据',
type: 'warning'
});
return;
}
this.selectData = JSON.parse(JSON.stringify(this.multipleSelection)); return date > maxDate || date < minDate; // 返回 true 禁用日期,返回 false 启用日期
if (command == 1) { },
//修改库存弹窗 /**
this.dialogVisible = true; *
this.kucundata = this.selectData; * @param date 时间类型
} else if (command == 2) { * @param type 是否加30天
//修改货期弹窗 * @returns {string}
this.dialogVisible2 = true; */
this.huoqidata = this.selectData; getTimes(date, type) {
} else if (command == 3) { if (type) {
//修改上架有效期 var cp_time_day = localStorage.getItem('cp_time_day');
this.dialogVisible3 = true; if (cp_time_day == -1) {
let currentTime = new Date().getTime();//当前日期毫秒 // “无限制”,则修改上架有效期默认为:2035-01-01
for (let i = 0; i < this.selectData.length; i++) { var date = new Date('2035-01-01');
this.selectData[i].cp_time_temp = this.selectData[i].cp_time;
var time = Date.parse(this.selectData[i].cp_time);//上架有效期
if (time > currentTime) {
//上架有效期大于当前日期
this.selectData[i].cp_time = this.getTimes(this.selectData[i].cp_time, true);
} else { } else {
//上架有效期小于等于当前日期 var date = new Date(new Date().getTime() + cp_time_day * 24 * 60 * 60 * 1000);
this.selectData[i].cp_time = this.getTimes(new Date(), true);
} }
} else {
var date = new Date(date);
} }
this.cpdata = this.selectData; var year = date.getFullYear();
} else if (command == 4) { var month = date.getMonth() + 1;
//修改价格 var day = date.getDate();
this.dialogVisible4 = true;
this.priceData = this.selectData; var hour = date.getHours() < 10 ? '0' + date.getHours() : date.getHours();
this.getSkuOriginalStepPrice(this.selectData[0].goods_id); var minute = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes();
this.stock = this.selectData[0].stock; var second = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
} month >= 1 && month <= 9 ? (month = '0' + month) : '';
}, day >= 0 && day <= 9 ? (day = '0' + day) : '';
/** var timer = year + '-' + month + '-' + day + ' ' + 0 + ':' + 0 + ':' + 0;
* 增加阶梯价 return timer;
*/ },
addRow() { /**
if (this.skuOriginalStepPriceData.length >= 9) { * 统计查看
this.$message({ * @param val
message: '已超过阶梯限制', */
type: 'warning' showChange(row) {
}); this.$http('GET', "/api/sku/getSkuStatistics", {
return false; goods_name: row.goods_name,
} brand_name: row.brand_name
this.skuOriginalStepPriceData.push({ }).then(res => {
cost_price: '',
price_cn: '',
price_us: '',
purchases: ''
})
},
/**
* 修改阶梯价格
*/
updateSkuOriginalStepPrice() {
var isPurchasesValid = Util.isPurchasesValid(this.skuOriginalStepPriceData);
if (!isPurchasesValid) {
this.$message({
message: '修改价格时格式填写错误,起订量不能低于最小起订量,不能高于库存;并且需要填写对应价格;',
type: 'warning'
});
} else {
this.$http('GET', "/api/sku/updateSkuOriginalStepPrice", { goods_id: this.goods_id, original_price: JSON.stringify(this.skuOriginalStepPriceData) }).then(res => {
if (res.code == 0) { if (res.code == 0) {
this.$message({ this.skuStatistics = res.data.statisticsData;
message: '操作成功',
type: 'success'
});
setTimeout(() => {
this.dialogVisible4 = false;
this.getData();
}, 2000)
} else { } else {
this.$message({ this.$message({
message: res.msg, message: res.msg,
...@@ -834,86 +733,188 @@ export default { ...@@ -834,86 +733,188 @@ export default {
}); });
} }
}) })
} },
}, /**
/** * 修改按钮
* 获取sku阶梯价格 * @param command
*/ */
getSkuOriginalStepPrice(goods_id) { handleCommand(command) {
this.$http('GET', "/api/sku/getSkuOriginalStepPrice", { goods_id: goods_id }).then(res => { if (this.multipleSelection.length == 0) {
if (res.code == 0) {
this.skuOriginalStepPriceData = res.data.data;
this.goods_id = goods_id;
} else {
this.$message({ this.$message({
message: res.msg, message: '请至少选择一条数据',
type: 'warning' type: 'warning'
}); });
return;
} }
})
}, // 修改价格时检查是否只选择了一条数据
/** if (command == 4 && this.multipleSelection.length > 1) {
* 修改上架有效期
*/
submitCp() {
var arr_ = {}
for (var i = 0; i < this.cpdata.length; i++) {
arr_[this.cpdata[i]['goods_id']] = {}
if (this.cpdata[i]['cp_time'] && this.cpdata[i]['cp_time'] != 'undefined') {
arr_[this.cpdata[i]['goods_id']].cp_time = this.cpdata[i]['cp_time']
}
}
this.$http('post', "/api/sku/updateSku", arr_).then(res => {
if (res.code == 0) {
this.$message({ this.$message({
message: '修改成功', message: '只能选择一条数据',
type: 'success' type: 'warning'
}); });
this.getData(); return;
this.dialogVisible3 = false; }
} else {
this.selectData = JSON.parse(JSON.stringify(this.multipleSelection));
if (command == 1) {
//修改库存弹窗
this.dialogVisible = true;
this.kucundata = this.selectData;
} else if (command == 2) {
//修改货期弹窗
this.dialogVisible2 = true;
this.huoqidata = this.selectData;
} else if (command == 3) {
//修改上架有效期
this.dialogVisible3 = true;
let currentTime = new Date().getTime();//当前日期毫秒
for (let i = 0; i < this.selectData.length; i++) {
this.selectData[i].cp_time_temp = this.selectData[i].cp_time;
var time = Date.parse(this.selectData[i].cp_time);//上架有效期
if (time > currentTime) {
//上架有效期大于当前日期
this.selectData[i].cp_time = this.getTimes(this.selectData[i].cp_time, true);
} else {
//上架有效期小于等于当前日期
this.selectData[i].cp_time = this.getTimes(new Date(), true);
}
}
this.cpdata = this.selectData;
} else if (command == 4) {
//修改价格
this.dialogVisible4 = true;
this.priceData = this.selectData;
this.getSkuOriginalStepPrice(this.selectData[0].goods_id);
this.stock = this.selectData[0].stock;
}
},
/**
* 增加阶梯价
*/
addRow() {
if (this.skuOriginalStepPriceData.length >= 9) {
this.$message({ this.$message({
message: res.msg, message: '已超过阶梯限制',
type: 'warning' type: 'warning'
}); });
return false;
} }
}) this.skuOriginalStepPriceData.push({
}, cost_price: '',
/** price_cn: '',
* 修改交期提交 price_us: '',
*/ purchases: ''
submitHq() { })
var arr_ = {} },
for (var i = 0; i < this.huoqidata.length; i++) { /**
arr_[this.huoqidata[i]['goods_id']] = {} * 修改阶梯价格
if (this.huoqidata[i]['dlhq'] && this.huoqidata[i]['dlhq'] != 'undefined') { */
arr_[this.huoqidata[i]['goods_id']].cn_delivery_time = this.huoqidata[i]['dlhq'] updateSkuOriginalStepPrice() {
var isPurchasesValid = Util.isPurchasesValid(this.skuOriginalStepPriceData);
if (!isPurchasesValid) {
this.$message({
message: '修改价格时格式填写错误,起订量不能低于最小起订量,不能高于库存;并且需要填写对应价格;',
type: 'warning'
});
} else {
this.$http('GET', "/api/sku/updateSkuOriginalStepPrice", { goods_id: this.goods_id, original_price: JSON.stringify(this.skuOriginalStepPriceData) }).then(res => {
if (res.code == 0) {
this.$message({
message: '操作成功',
type: 'success'
});
setTimeout(() => {
this.dialogVisible4 = false;
this.getData();
}, 2000)
} else {
this.$message({
message: res.msg,
type: 'warning'
});
}
})
} }
if (this.huoqidata[i]['hkhq'] && this.huoqidata[i]['hkhq'] != 'undefined') { },
arr_[this.huoqidata[i]['goods_id']].hk_delivery_time = this.huoqidata[i]['hkhq'] /**
* 获取sku阶梯价格
*/
getSkuOriginalStepPrice(goods_id) {
this.$http('GET', "/api/sku/getSkuOriginalStepPrice", { goods_id: goods_id }).then(res => {
if (res.code == 0) {
this.skuOriginalStepPriceData = res.data.data;
this.goods_id = goods_id;
} else {
this.$message({
message: res.msg,
type: 'warning'
});
}
})
},
/**
* 修改上架有效期
*/
submitCp() {
var arr_ = {}
for (var i = 0; i < this.cpdata.length; i++) {
arr_[this.cpdata[i]['goods_id']] = {}
if (this.cpdata[i]['cp_time'] && this.cpdata[i]['cp_time'] != 'undefined') {
arr_[this.cpdata[i]['goods_id']].cp_time = this.cpdata[i]['cp_time']
}
} }
} this.$http('post', "/api/sku/updateSku", arr_).then(res => {
this.$http('post', "/api/sku/updateSku", arr_).then(res => { if (res.code == 0) {
if (res.code == 0) { this.$message({
this.$message("修改成功"); message: '修改成功',
this.getData() type: 'success'
this.dialogVisible2 = false });
} else { this.getData();
this.$message(res.msg); this.dialogVisible3 = false;
} else {
this.$message({
message: res.msg,
type: 'warning'
});
}
})
},
/**
* 修改交期提交
*/
submitHq() {
var arr_ = {}
for (var i = 0; i < this.huoqidata.length; i++) {
arr_[this.huoqidata[i]['goods_id']] = {}
if (this.huoqidata[i]['dlhq'] && this.huoqidata[i]['dlhq'] != 'undefined') {
arr_[this.huoqidata[i]['goods_id']].cn_delivery_time = this.huoqidata[i]['dlhq']
}
if (this.huoqidata[i]['hkhq'] && this.huoqidata[i]['hkhq'] != 'undefined') {
arr_[this.huoqidata[i]['goods_id']].hk_delivery_time = this.huoqidata[i]['hkhq']
}
} }
}) this.$http('post', "/api/sku/updateSku", arr_).then(res => {
}, if (res.code == 0) {
/** this.$message("修改成功");
* 修改库存提交 this.getData()
*/ this.dialogVisible2 = false
submitKc() { } else {
// 使用reduce将库存数据转换为对象 this.$message(res.msg);
const stockUpdates = this.kucundata.reduce((acc, item) => ({ }
...acc, })
[item.goods_id]: { stock: item.updateStock } },
}), {}); /**
* 修改库存提交
*/
submitKc() {
// 使用reduce将库存数据转换为对象
const stockUpdates = this.kucundata.reduce((acc, item) => ({
...acc,
[item.goods_id]: { stock: item.updateStock }
}), {});
this.$http('post', "/api/sku/updateSku", stockUpdates) this.$http('post', "/api/sku/updateSku", stockUpdates)
.then(res => { .then(res => {
if (res.code === 0) { if (res.code === 0) {
this.$message({ this.$message({
...@@ -929,200 +930,200 @@ export default { ...@@ -929,200 +930,200 @@ export default {
}); });
} }
}); });
}, },
/** /**
* 上下架 * 上下架
* @param status * @param status
*/ */
changeStatus(status) { changeStatus(status) {
var time_arr = [];//过滤出上架有效期时间数组 var time_arr = [];//过滤出上架有效期时间数组
var sku_ids = [];//过滤出sku_ids数组 var sku_ids = [];//过滤出sku_ids数组
if (this.multipleSelection.length == 0) { if (this.multipleSelection.length == 0) {
this.$message({
message: '请至少选择一条数据',
type: 'warning'
});
return;
}
if (status == 1) {
var time = new Date();//当前时间
time_arr = this.multipleSelection.map(obj => {
return obj.cp_time;
});
var times = time_arr.filter((item) => {
if (new Date(item) < time) {
return item;
}
});
if (times.length > 0) {
this.$message({ this.$message({
message: '您勾选的数据中,有型号的“上架有效期”低于当前的日期,请先维护上架有效期;', message: '请至少选择一条数据',
type: 'warning' type: 'warning'
}); });
return; return;
} }
} if (status == 1) {
sku_ids = this.multipleSelection.map(obj => { var time = new Date();//当前时间
return obj.goods_id; time_arr = this.multipleSelection.map(obj => {
}); return obj.cp_time;
this.$http('post', "/api/sku/updateSkuStatus", { sku_ids: sku_ids.join(","), status: status == 1 ? 'passed' : 'offshelf' }).then(res => {
if (res.code === 0) {
this.$message({
message: '操作成功',
type: 'success'
}); });
this.getData() var times = time_arr.filter((item) => {
} else { if (new Date(item) < time) {
this.$message({ return item;
message: res.msg, }
type: 'warning'
}); });
} if (times.length > 0) {
}) this.$message({
}, message: '您勾选的数据中,有型号的“上架有效期”低于当前的日期,请先维护上架有效期;',
/** type: 'warning'
* 弹窗事件 });
*/
popupEvent(type) {
switch (type) {
case 1:
this.dialogVisibleBatchModify = true;
break;
case 2:
if (!this.multipleSelection.length) {
this.$message.warning('请选择数据');
return; return;
} }
var html = ` }
sku_ids = this.multipleSelection.map(obj => {
return obj.goods_id;
});
this.$http('post', "/api/sku/updateSkuStatus", { sku_ids: sku_ids.join(","), status: status == 1 ? 'passed' : 'offshelf' }).then(res => {
if (res.code === 0) {
this.$message({
message: '操作成功',
type: 'success'
});
this.getData()
} else {
this.$message({
message: res.msg,
type: 'warning'
});
}
})
},
/**
* 弹窗事件
*/
popupEvent(type) {
switch (type) {
case 1:
this.dialogVisibleBatchModify = true;
break;
case 2:
if (!this.multipleSelection.length) {
this.$message.warning('请选择数据');
return;
}
var html = `
<p style="font-size: 14px;">确定将选择的商品提交寄售申请?</p> <p style="font-size: 14px;">确定将选择的商品提交寄售申请?</p>
<p style="font-size: 14px;color: #FF7E11">确认后请到【寄售申请】菜单编辑申请寄售数量,并提交审核</p> <p style="font-size: 14px;color: #FF7E11">确认后请到【寄售申请】菜单编辑申请寄售数量,并提交审核</p>
` `
this.$confirm(html, '寄售申请', { this.$confirm(html, '寄售申请', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
dangerouslyUseHTMLString: true dangerouslyUseHTMLString: true
}).then(() => { }).then(() => {
let sku_ids = this.multipleSelection.map(item => item.goods_id).join(','); let sku_ids = this.multipleSelection.map(item => item.goods_id).join(',');
this.$http('POST', "/api/consignmentReplenishment/addConsignmentReplenishment", { sku_ids: sku_ids }).then(res => { this.$http('POST', "/api/consignmentReplenishment/addConsignmentReplenishment", { sku_ids: sku_ids }).then(res => {
if (res.code === 0) { if (res.code === 0) {
this.$message({ this.$message({
message: res.msg, message: res.msg,
type: 'success', type: 'success',
onClose: () => { onClose: () => {
this.getData(); this.getData();
} }
}); });
} else { } else {
this.$message.error(res.msg || '操作失败'); this.$message.error(res.msg || '操作失败');
} }
}) })
}).catch(() => { }).catch(() => {
// 取消时不需要提示 // 取消时不需要提示
}); });
break; break;
case 3: case 3:
if (!this.multipleSelection.length) { if (!this.multipleSelection.length) {
this.$message.warning('请选择数据'); this.$message.warning('请选择数据');
return; return;
}
this.consignmentRecallData = this.multipleSelection.map(item => {
return {
sku_id: item.goods_id,
goods_name: item.goods_name,
brand_name: item.brand_name,
stock: item.stock,
date_code: item.batch_sn,//批次
recall_num: item.stock
} }
}); this.consignmentRecallData = this.multipleSelection.map(item => {
this.dialogVisibleConsignmentRecall = true; return {
break; sku_id: item.goods_id,
} goods_name: item.goods_name,
}, brand_name: item.brand_name,
/** stock: item.stock,
* 上传成功 date_code: item.batch_sn,//批次
* @param res recall_num: item.stock
* @param file }
* @param fileList });
*/ this.dialogVisibleConsignmentRecall = true;
handleUploadSuccess(res, file, fileList) { break;
if (res.code === 0) { }
this.$message({ },
message: res.msg, /**
type: 'success', * 上传成功
onClose: () => { * @param res
this.dialogVisibleBatchModify = false; * @param file
} * @param fileList
}); */
} else { handleUploadSuccess(res, file, fileList) {
this.$message.error(res.msg || '上传失败');
}
},
/**
* 上传失败
* @param err
* @param file
* @param fileList
*/
handleUploadError(err, file, fileList) {
this.$message.error('上传失败,请重试');
},
/**
* 输入验证
* @param row
*/
validateInput(row) {
// 转换为数字进行比较
let inputValue = Number(row.recall_num) || 0;
let stockValue = Number(row.stock) || 0;
// 如果输入值大于库存,则设置为库存值
if (inputValue > stockValue) {
row.recall_num = stockValue;
this.$message({
message: '申请召回数量不能大于可用库存数量',
type: 'warning'
});
}
},
/**
* 寄售库存-新增寄售召回单
*/
addConsignmentRecallFromStock() {
// 检查是否有空的召回数量
const hasEmptyRecallNum = this.consignmentRecallData.some(item => !item.recall_num);
if (hasEmptyRecallNum) {
this.$message({
message: '请填写申请召回数量',
type: 'warning'
});
return;
}
this.$http('POST', "/api/consignmentRecall/addConsignmentRecallFromStock", {
recall_json: JSON.stringify(this.consignmentRecallData)
}).then(res => {
if (res.code === 0) { if (res.code === 0) {
this.$message({ this.$message({
message: '操作成功', message: res.msg,
type: 'success', type: 'success',
onClose: () => { onClose: () => {
this.dialogVisibleConsignmentRecall = false; this.dialogVisibleBatchModify = false;
this.getData();
} }
}); });
} else { } else {
this.$message.error(res.msg || '操作失败'); this.$message.error(res.msg || '上传失败');
}
},
/**
* 上传失败
* @param err
* @param file
* @param fileList
*/
handleUploadError(err, file, fileList) {
this.$message.error('上传失败,请重试');
},
/**
* 输入验证
* @param row
*/
validateInput(row) {
// 转换为数字进行比较
let inputValue = Number(row.recall_num) || 0;
let stockValue = Number(row.stock) || 0;
// 如果输入值大于库存,则设置为库存值
if (inputValue > stockValue) {
row.recall_num = stockValue;
this.$message({
message: '申请召回数量不能大于可用库存数量',
type: 'warning'
});
}
},
/**
* 寄售库存-新增寄售召回单
*/
addConsignmentRecallFromStock() {
// 检查是否有空的召回数量
const hasEmptyRecallNum = this.consignmentRecallData.some(item => !item.recall_num);
if (hasEmptyRecallNum) {
this.$message({
message: '请填写申请召回数量',
type: 'warning'
});
return;
} }
})
this.$http('POST', "/api/consignmentRecall/addConsignmentRecallFromStock", {
recall_json: JSON.stringify(this.consignmentRecallData)
}).then(res => {
if (res.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
onClose: () => {
this.dialogVisibleConsignmentRecall = false;
this.getData();
}
});
} else {
this.$message.error(res.msg || '操作失败');
}
})
}
},
components: {
Menu
} }
}, };
components: {
Menu
}
};
</script> </script>
<style scoped> <style scoped>
@import "../../assets/css/store/list.min.css"; @import "../../assets/css/store/list.min.css";
</style> </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