管理端上架问题,批量设置物流模板

master
mabo 2021-06-29 09:28:21 +08:00
parent 25176c36fb
commit ebaa75ed15
3 changed files with 33 additions and 55 deletions

View File

@ -112,7 +112,7 @@
</Form> </Form>
<div slot="footer"> <div slot="footer">
<Button type="text" @click="modalVisible = false">取消</Button> <Button type="text" @click="modalVisible = false">取消</Button>
<Button type="primary" :loading="submitLoading" @click="lower(form.id)" <Button type="primary" :loading="submitLoading" @click="lower"
>提交</Button >提交</Button
> >
</div> </div>
@ -363,7 +363,7 @@ export default {
this.modalTitle = "下架操作"; this.modalTitle = "下架操作";
this.modalVisible = true; this.modalVisible = true;
}, },
lower(id) { lower() {
lowGoods(this.id, this.underForm).then((res) => { lowGoods(this.id, this.underForm).then((res) => {
this.$Modal.remove(); this.$Modal.remove();
if (res.success) { if (res.success) {

View File

@ -36,7 +36,7 @@
<DropdownItem name="uppers">批量上架</DropdownItem> <DropdownItem name="uppers">批量上架</DropdownItem>
<DropdownItem name="lowers">批量下架</DropdownItem> <DropdownItem name="lowers">批量下架</DropdownItem>
<DropdownItem name="deleteAll">批量删除</DropdownItem> <DropdownItem name="deleteAll">批量删除</DropdownItem>
<DropdownItem name="batchShipTemplate">批量设置运费模板</DropdownItem> <DropdownItem name="batchShipTemplate">批量设置物流模板</DropdownItem>
</DropdownMenu> </DropdownMenu>
</Dropdown> </Dropdown>
</Row> </Row>
@ -87,21 +87,10 @@
</div> </div>
</Modal> </Modal>
<!-- 批量设置运费模板 --> <!-- 批量设置物流模板 -->
<Modal title="批量设置运费模板" v-model="shipTemplateModal" :mask-closable="false" :width="500"> <Modal title="批量设置物流模板" v-model="shipTemplateModal" :mask-closable="false" :width="500">
<Form ref="shipTemplateForm" :model="shipTemplateForm" :label-width="120"> <Form ref="shipTemplateForm" :model="shipTemplateForm" :label-width="120">
<FormItem class="form-item-view-el" label="运费" prop="freightPayer"> <FormItem class="form-item-view-el" label="物流模板" prop="templateId">
<RadioGroup type="button" button-style="solid" @on-change="logisticsTemplateUndertakerChange" v-model="shipTemplateForm.freightPayer">
<Radio label="STORE">
<span>卖家承担运费</span>
</Radio>
<Radio label="BUYER">
<span>使用物流规则</span>
</Radio>
</RadioGroup>
</FormItem>
<FormItem class="form-item-view-el" label="物流模板" prop="templateId" v-if="shipTemplateShow">
<Select v-model="shipTemplateForm.templateId" style="width: 200px"> <Select v-model="shipTemplateForm.templateId" style="width: 200px">
<Option v-for="item in logisticsTemplate" :value="item.id" :key="item.id">{{ item.name }} <Option v-for="item in logisticsTemplate" :value="item.id" :key="item.id">{{ item.name }}
</Option> </Option>
@ -124,10 +113,9 @@ import {
upGoods, upGoods,
lowGoods, lowGoods,
deleteGoods, deleteGoods,
batchShipTemplate, batchShipTemplate
} from "@/api/goods"; } from "@/api/goods";
import * as API_Shop from "@/api/shops";
import * as API_Store from "@/api/shops";
export default { export default {
name: "goods", name: "goods",
@ -135,10 +123,7 @@ export default {
return { return {
id: "", //id id: "", //id
loading: true, // loading: true, //
shipTemplateForm: { shipTemplateForm: {},
freightPayer: "STORE",
},
shipTemplateShow: false, //
shipTemplateModal: false, // shipTemplateModal: false, //
logisticsTemplate: [], // logisticsTemplate: [], //
updateStockModalVisible: false, // updateStockModalVisible: false, //
@ -421,11 +406,12 @@ export default {
if (v == "deleteAll") { if (v == "deleteAll") {
this.deleteAll(); this.deleteAll();
} }
// //
if (v == "batchShipTemplate") { if (v == "batchShipTemplate") {
this.batchShipTemplate(); this.batchShipTemplate();
} }
}, },
//
getStockDetail(id) { getStockDetail(id) {
getGoodsSkuListDataSeller({ goodsId: id, pageSize: 1000 }).then((res) => { getGoodsSkuListDataSeller({ goodsId: id, pageSize: 1000 }).then((res) => {
if (res.success) { if (res.success) {
@ -435,6 +421,7 @@ export default {
} }
}); });
}, },
//
updateStock() { updateStock() {
let updateStockList = this.stockList.map((i) => { let updateStockList = this.stockList.map((i) => {
let j = { skuId: i.id, quantity: i.quantity }; let j = { skuId: i.id, quantity: i.quantity };
@ -486,28 +473,24 @@ export default {
this.selectList = e; this.selectList = e;
this.selectCount = e.length; this.selectCount = e.length;
}, },
// //
saveShipTemplate() { saveShipTemplate() {
if (this.shipTemplateForm.freightPayer == "STORE") {
{
this.shipTemplateForm.templateId = 0;
}
}
this.$Modal.confirm({ this.$Modal.confirm({
title: "确认设置运费模板", title: "确认设置物流模板",
content: content:
"您确认要设置所选的 " + this.selectCount + " 个商品的运费模板?", "您确认要设置所选的 " + this.selectCount + " 个商品的物流模板?",
loading: true, loading: true,
onOk: () => { onOk: () => {
let ids = []; let ids = [];
this.selectList.forEach(function (e) { this.selectList.forEach(function (e) {
ids.push(e.id); ids.push(e.id);
}); });
// //
batchShipTemplate(this.shipTemplateForm).then((res) => { batchShipTemplate(this.shipTemplateForm).then((res) => {
this.$Modal.remove(); this.$Modal.remove();
if (res.success) { if (res.success) {
this.$Message.success("运费模板设置成功"); this.$Message.success("物流模板设置成功");
this.clearSelectAll(); this.clearSelectAll();
this.getDataList(); this.getDataList();
} }
@ -516,12 +499,13 @@ export default {
}, },
}); });
}, },
// //
batchShipTemplate() { batchShipTemplate() {
if (this.selectCount <= 0) { if (this.selectCount <= 0) {
this.$Message.warning("您还未选择要设置运费模板的商品"); this.$Message.warning("您还未选择要设置物流模板的商品");
return; return;
} }
this.getShipTempList()
let data = []; let data = [];
this.selectList.forEach(function (e) { this.selectList.forEach(function (e) {
data.push(e.id); data.push(e.id);
@ -529,21 +513,7 @@ export default {
this.shipTemplateForm.goodsId = data; this.shipTemplateForm.goodsId = data;
this.shipTemplateModal = true; this.shipTemplateModal = true;
}, },
// //
logisticsTemplateUndertakerChange(v) {
//
if (v == "BUYER") {
API_Store.getShipTemplate().then((res) => {
if (res.success) {
this.logisticsTemplate = res.result;
}
});
this.shipTemplateShow = true;
}
if (v == "STORE") {
this.shipTemplateShow = false;
}
},
getDataList() { getDataList() {
this.loading = true; this.loading = true;
// //
@ -555,6 +525,14 @@ export default {
} }
}); });
}, },
//
getShipTempList () {
API_Shop.getShipTemplate().then((res) => {
if (res.success) {
this.logisticsTemplate = res.result;
}
})
},
// //
lower(v) { lower(v) {
this.$Modal.confirm({ this.$Modal.confirm({

View File

@ -626,7 +626,7 @@ export default {
updateSku: true, updateSku: true,
/** 是否重新生成sku */ /** 是否重新生成sku */
regeneratorSkuFlag: false, regeneratorSkuFlag: false,
/** 运费模板id **/ /** 物流模板id **/
templateId: '', templateId: '',
/** 参数组*/ /** 参数组*/
goodsParamsDTOList: [], goodsParamsDTOList: [],
@ -653,7 +653,7 @@ export default {
/** 规格图片 */ /** 规格图片 */
images: [], images: [],
/** 运费模板 **/ /** 物流模板 **/
logisticsTemplate: [], logisticsTemplate: [],
/** 固定列校验提示内容 */ /** 固定列校验提示内容 */
@ -722,7 +722,7 @@ export default {
this.accessToken = { this.accessToken = {
accessToken: this.getStore("accessToken"), accessToken: this.getStore("accessToken"),
}; };
// //
API_Shop.getShipTemplate().then((res) => { API_Shop.getShipTemplate().then((res) => {
if (res.success) { if (res.success) {
this.logisticsTemplate = res.result; this.logisticsTemplate = res.result;