解决商品分类不同步数据问题,解决pc端添加发票问题

master
lemon橪 2021-06-18 14:52:40 +08:00
parent 99ae898139
commit 336643419e
6 changed files with 1130 additions and 1131 deletions

View File

@ -11,42 +11,37 @@
</div> -->
<!-- 普通发票 -->
<div class="nav-content">
<Form
:model="invoiceForm"
ref="form"
label-position="left"
:rules="ruleInline"
:label-width="110"
>
<Form :model="invoiceForm" ref="form" label-position="left" :rules="ruleInline" :label-width="110">
<FormItem label="发票类型">
<RadioGroup v-model="invoiceForm.type" type="button" button-style="solid">
<RadioGroup v-model="invoice" type="button" button-style="solid">
<Radio @on-change="changeInvoice" :label="1">电子普通发票</Radio>
<Radio :label="2" :disabled="true">增值税专用发票</Radio>
</RadioGroup>
</FormItem>
<FormItem label="发票抬头">
<RadioGroup v-model="type" @on-change="changeInvoice" type="button" button-style="solid">
<Radio :label="1">个人</Radio>
<Radio :label="2">单位</Radio>
</RadioGroup>
</FormItem>
<FormItem
label="发票抬头"
v-if="invoiceForm.type == 2"
prop="receiptTitle"
>
<FormItem label="个人名称" v-if="type === 1" prop="receiptTitle">
<i-input v-model="invoiceForm.receiptTitle"></i-input>
</FormItem>
<FormItem
label="纳税人识别号"
v-if="invoiceForm.type == 2"
prop="taxpayerId"
>
<FormItem label="单位名称" v-if="type === 2" prop="receiptTitle">
<i-input v-model="invoiceForm.receiptTitle"></i-input>
</FormItem>
<FormItem label="纳税人识别号" v-if="type === 2" prop="taxpayerId">
<i-input v-model="invoiceForm.taxpayerId"></i-input>
</FormItem>
<FormItem label="发票内容">
<RadioGroup v-model="invoiceForm.receiptContent" type="button" button-style="solid">
<Radio label="不开发票">不开发票</Radio>
<Radio label="商品明细">商品明细</Radio>
<Radio label="商品类别">商品类别</Radio>
</RadioGroup>
</FormItem>
</Form>
<div style="text-align: center">
<Button type="primary" :loading="loading" @click="save"></Button>
<Button type="primary" :loading="loading" @click="submit"></Button>
<Button type="default" @click="invoiceAvailable = false">取消</Button>
</div>
</div>
@ -54,100 +49,104 @@
</div>
</template>
<script>
import { saveReceipt } from '@/api/member.js';
import { TINumber } from '@/plugins/RegExp.js';
import { receiptSelect } from "@/api/cart.js";
import { TINumber } from "@/plugins/RegExp.js";
export default {
name: 'invoiceModal',
name: "invoiceModal",
data() {
return {
invoice: 1,
invoiceAvailable: false, //
loading: false, //
invoiceForm: { //
invoiceForm: {
//
//
receiptTitle: '', //
taxpayerId: '', //
receiptContent: '不开发票', //
type: 1 // 1 2
receiptTitle: "", //
taxpayerId: "", //
receiptContent: "商品明细", //
},
type: 1, // 1 2
ruleInline: {
receiptTitle: [{ required: true, message: '请填写公司名称' }],
taxpayerId: [
{ required: true, message: '请填写纳税人识别号' },
{ pattern: TINumber, message: '请填写正确的纳税人识别号' }
]
}
{ required: true, message: "请填写纳税人识别号" },
{ pattern: TINumber, message: "请填写正确的纳税人识别号" },
],
},
};
},
props: ["invoiceData"],
watch: {
invoiceData: {
handler(val) {
this.invoiceForm = { ...val };
if (val.taxpayerId) {
this.type = 2;
} else {
this.type = 1;
}
},
deep: true,
immeadite: true,
},
},
methods: {
save () {
if (this.invoiceForm.type === 1) {
//
let flag = true;
this.receiptItems.forEach((e) => {
if (
e.receiptTitle === '个人' &&
e.receiptContent === this.invoiceForm.receiptContent
) {
this.$emit('change', e);
flag = false;
this.invoiceAvailable = false;
}
/**
* 选择发票抬头
*/
changeInvoice(val) {
this.$nextTick(() => {
this.type = val;
});
},
if (flag) {
let params = {
receiptTitle: '个人',
receiptContent: this.invoiceForm.receiptContent
};
this.loading = true;
saveReceipt(params)
.then((res) => {
this.loading = false;
if (res.success) {
this.$emit('change', res.result);
this.invoiceAvailable = false;
/**
* 保存判断
*/
save() {
let flage = true;
//
const { type, receiptTitle, receiptContent } = JSON.parse(
JSON.stringify(this.invoiceForm)
);
//
if (!receiptTitle) {
this.$Message.error("请填写发票抬头!");
flage = false;
return false;
}
})
.catch(() => {
this.loading = false;
});
}
} else {
//
if (type == 2) {
this.$refs.form.validate((valid) => {
if (valid) {
this.loading = true;
let params = {
receiptTitle: this.invoiceForm.receiptTitle,
taxpayerId: this.invoiceForm.taxpayerId,
receiptContent: this.invoiceForm.receiptContent
};
let flag = true;
this.receiptItems.forEach((e) => {
if (e.taxpayerId === params.taxpayerId) {
flag = false;
if (!valid) {
flage = false;
}
});
if (!flag) {
this.$Message.error('已有当前税号的发票信息,请直接选择已有发票');
} else {
saveReceipt(params)
.then((res) => {
delete this.invoiceForm.taxpayerId;
}
return flage;
},
async submit() {
if (this.save()) {
this.loading = true;
let submit = {
way: this.$route.query.way,
...this.invoiceForm,
};
let receipt = await receiptSelect(submit);
if (receipt.success) {
this.$emit("change", true);
}
this.loading = false;
if (res.success) {
this.$emit('change', res.result);
this.invoiceAvailable = false;
}
})
.catch(() => {
this.loading = false;
});
}
}
});
}
}
}
},
},
};
</script>
<style lang="scss" scoped>

View File

@ -24,7 +24,8 @@
<span @click="goAddressManage"></span>
</div>
<div class="address-manage">
<div class="address-item" v-show="moreAddr ? true : index < 3" :class="selectedAddress.id === item.id?'border-red':''" @mouseenter="showEditBtn = index" @mouseleave="showEditBtn = ''" @click="selectAddress(item)" v-for="(item,index) in addressList" :key="index">
<div class="address-item" v-show="moreAddr ? true : index < 3" :class="selectedAddress.id === item.id?'border-red':''" @mouseenter="showEditBtn = index" @mouseleave="showEditBtn = ''"
@click="selectAddress(item)" v-for="(item,index) in addressList" :key="index">
<div>
<span>{{item.name}}</span>
<Tag class="ml_10" v-if="item.isDefault" color="red"></Tag>
@ -92,7 +93,9 @@
<!-- 发票信息 -->
<div class="invoice">
<div class="card-head mt_20 mb_20">
<span class="relative">发票信息<span class="inv-tips"><Icon type="ios-alert-outline" />开企业抬头发票须填写纳税人识别号以免影响报销</span></span>
<span class="relative">发票信息<span class="inv-tips">
<Icon type="ios-alert-outline" />开企业抬头发票须填写纳税人识别号以免影响报销
</span></span>
</div>
<div class="inovice-content">
<span>{{invoiceData.receiptTitle}}</span>
@ -135,7 +138,8 @@
</div>
<div>
<div>
<span>使用积分</span><Input type="text" style="width:100px;" v-model.number="otherMsgForm.point" placeholder="请输入使用积分" /> <span style="color:#999;">您当前的可用积分为 {{otherMsgForm.totalPoint}} 本订单最多可以使用{{otherMsgForm.availablePoint}}</span>
<span>使用积分</span><Input type="text" style="width:100px;" v-model.number="otherMsgForm.point" placeholder="请输入使用积分" /> <span style="color:#999;">您当前的可用积分为 {{otherMsgForm.totalPoint}}
本订单最多可以使用{{otherMsgForm.availablePoint}}</span>
</div>
</div>
</div>
@ -159,45 +163,56 @@
<!-- 底部支付栏 -->
<div class="order-footer width_1200">
<div class="pay ml_20" @click="pay"></div>
<div class="pay-address" v-if="addressList.length">{{ selectedAddress.consigneeAddressPath | unitAddress }} {{selectedAddress.detail}}&nbsp;&nbsp;{{selectedAddress.name}}&nbsp;&nbsp;{{selectedAddress.mobile}}</div>
<div class="pay-address" v-if="addressList.length">{{ selectedAddress.consigneeAddressPath | unitAddress }}
{{selectedAddress.detail}}&nbsp;&nbsp;收货人{{selectedAddress.name}}&nbsp;&nbsp;{{selectedAddress.mobile}}</div>
</div>
<BaseFooter></BaseFooter>
<!-- 添加发票模态框 -->
<invoice-modal ref="invModal" @change="getInvMsg" />
<invoice-modal ref="invModal" :invoiceData="invoiceData" @change="getInvMsg" />
<!-- 选择地址模态框 -->
<address-manage ref="address" :id="addrId" @change="addrChange"></address-manage>
</div>
</template>
<script>
import invoiceModal from '@/components/invoiceModal';
import addressManage from '@/components/addressManage';
import {memberAddress, delMemberAddress} from '@/api/address';
import {cartGoodsPay, createTrade, selectAddr, shippingMethod, receiptSelect, selectCoupon, couponNum} from '@/api/cart';
import { canUseCouponList } from '@/api/member.js';
import {getLogo} from '@/api/common.js'
import invoiceModal from "@/components/invoiceModal";
import addressManage from "@/components/addressManage";
import { memberAddress, delMemberAddress } from "@/api/address";
import {
cartGoodsPay,
createTrade,
selectAddr,
shippingMethod,
selectCoupon,
couponNum,
} from "@/api/cart";
import { canUseCouponList } from "@/api/member.js";
import { getLogo } from "@/api/common.js";
export default {
name: 'Pay',
name: "Pay",
components: { invoiceModal, addressManage },
data() {
return {
stepIndex: 1, //
invoiceAvailable: false, //
showEditBtn: '', //
orderMark: '', //
invoiceData: { //
receiptTitle: '个人',
receiptContent: '不开发票'
showEditBtn: "", //
orderMark: "", //
invoiceData: {
//
receiptTitle: "个人",
receiptContent: "不开发票",
},
otherMsgForm: { //
otherMsgForm: {
//
point: 0,
availablePoint: 10,
totalPoint: 100,
noGoods: 0
noGoods: 0,
},
deliveryList: [ //
deliveryList: [
//
// {value: 'SELF_PICK_UP', label: ''},
{value: 'LOGISTICS', label: '物流'}
{ value: "LOGISTICS", label: "物流" },
// {value: 'LOCAL_TOWN_DELIVERY', label: ''}
],
addressList: [], //
@ -205,257 +220,277 @@ export default {
goodsList: [], //
priceDetailDTO: {}, //
totalNum: 0, //
addrId: '', // id
addrId: "", // id
moreAddr: false, //
canUseCouponNum: 0, //
couponList: [], //
logoImg: '', // logo
logoImg: "", // logo
usedCouponId: [], // 使id
selectedCoupon: {} //
selectedCoupon: {}, //
};
},
mounted() {
this.init();
if (!this.Cookies.getItem('logo')) {
getLogo().then(res => {
if (!this.Cookies.getItem("logo")) {
getLogo().then((res) => {
if (res.success) {
let logoObj = JSON.parse(res.result.settingValue)
this.Cookies.setItem('logo', logoObj.buyerSideLogo)
let logoObj = JSON.parse(res.result.settingValue);
this.Cookies.setItem("logo", logoObj.buyerSideLogo);
}
})
});
} else {
this.logoImg = this.Cookies.getItem('logo')
this.logoImg = this.Cookies.getItem("logo");
}
},
methods: {
init() {
this.getGoodsDetail();
},
goAddressManage () { //
this.$router.push('/home/MyAddress');
goAddressManage() {
//
this.$router.push("/home/MyAddress");
},
getAddress () { //
memberAddress().then(res => {
getAddress() {
//
memberAddress().then((res) => {
if (res.success) {
this.addressList = res.result.records;
this.addressList.forEach((e, index) => {
if (e.id === this.selectedAddress.id && index > 2) {
this.moreAddr = true
this.moreAddr = true;
}
});
}
});
},
getGoodsDetail () { //
getGoodsDetail() {
//
this.$Spin.show();
cartGoodsPay({way: this.$route.query.way}).then(res => {
cartGoodsPay({ way: this.$route.query.way })
.then((res) => {
this.$Spin.hide();
if (res.success) {
this.goodsList = res.result.cartList;
this.priceDetailDTO = res.result.priceDetailDTO;
this.skuList = res.result.skuList;
res.result.receiptVO
? (this.invoiceData = res.result.receiptVO)
: "";
let notSupArea = res.result.notSupportFreight;
this.selectedCoupon = {}
if (res.result.platformCoupon) this.selectedCoupon.platformCoupon = res.result.platformCoupon
Object.assign(this.selectedCoupon, res.result.storeCoupons)
this.selectedCoupon = {};
if (res.result.platformCoupon)
this.selectedCoupon.platformCoupon = res.result.platformCoupon;
Object.assign(this.selectedCoupon, res.result.storeCoupons);
if (notSupArea) {
let content = [];
let title = ''
notSupArea.forEach(e => {
title = e.errorMessage
content.push(e.goodsSku.goodsName)
})
let title = "";
notSupArea.forEach((e) => {
title = e.errorMessage;
content.push(e.goodsSku.goodsName);
});
this.$Modal.warning({
title: '以下商品超出配送区域' || title,
content: content.toString()
})
title: "以下商品超出配送区域" || title,
content: content.toString(),
});
}
if (res.result.memberAddress) {
this.selectedAddress = res.result.memberAddress
this.selectedAddress = res.result.memberAddress;
}
this.getAddress()
this.getAddress();
this.totalNum = 0;
for (let i = 0; i < this.skuList.length; i++) {
this.totalNum += this.skuList[i].num;
}
this.getCouponNum()
this.getCouponNum();
}
}).catch(() => { this.$Spin.hide() });
})
.catch(() => {
this.$Spin.hide();
});
},
getCouponNum () { //
couponNum({way: this.$route.query.way}).then(res => {
this.canUseCouponNum = res.result
getCouponNum() {
//
couponNum({ way: this.$route.query.way }).then((res) => {
this.canUseCouponNum = res.result;
if (res.result) {
let storeArr = []
let skuArr = []
this.goodsList.forEach(e => {
storeArr.push(e.storeId)
e.skuList.forEach(i => {
skuArr.push(i.goodsSku.id)
})
})
let storeArr = [];
let skuArr = [];
this.goodsList.forEach((e) => {
storeArr.push(e.storeId);
e.skuList.forEach((i) => {
skuArr.push(i.goodsSku.id);
});
});
let params = {
pageNumber: 1,
pageSize: 100,
memberCouponStatus: 'NEW',
memberCouponStatus: "NEW",
scopeId: skuArr.toString(),
storeId: storeArr.toString(),
totalPrice: this.priceDetailDTO.goodsPrice
}
canUseCouponList(params).then(res => { //
if (res.success) this.couponList = res.result.records
const couponKeys = Object.keys(this.selectedCoupon)
this.usedCouponId = []
totalPrice: this.priceDetailDTO.goodsPrice,
};
canUseCouponList(params).then((res) => {
//
if (res.success) this.couponList = res.result.records;
const couponKeys = Object.keys(this.selectedCoupon);
this.usedCouponId = [];
if (couponKeys.length) {
this.couponList.forEach(e => {
this.couponList.forEach((e) => {
if (e.id === this.selectedCoupon[couponKeys].memberCoupon.id) {
this.usedCouponId.push(e.id)
this.usedCouponId.push(e.id);
}
})
});
this.$nextTick(() => {
this.$forceUpdate()
})
this.$forceUpdate();
});
}
})
});
}
})
});
},
selectAddress (item) { //
selectAddress(item) {
//
let params = {
way: this.$route.query.way,
shippingAddressId: item.id
shippingAddressId: item.id,
};
selectAddr(params).then(res => {
selectAddr(params).then((res) => {
if (res.success) {
this.$Message.success('选择收货地址成功');
this.$Message.success("选择收货地址成功");
this.selectedAddress = item;
this.getGoodsDetail();
}
});
},
editAddress (id) { //
editAddress(id) {
//
this.addrId = id;
this.$refs.address.show();
},
addrChange (item) { //
addrChange(item) {
//
this.getAddress();
},
delAddress(item) {
//
this.$Modal.confirm({
title: '提示',
content: '你确定删除这个收货地址',
title: "提示",
content: "你确定删除这个收货地址",
onOk: () => {
delMemberAddress(item.id).then((res) => {
if (res.success) {
this.$Message.success('删除成功');
this.$Message.success("删除成功");
this.getAddress();
}
});
},
onCancel: () => {}
onCancel: () => {},
});
},
goGoodsDetail (skuId, goodsId) { //
goGoodsDetail(skuId, goodsId) {
//
let routeUrl = this.$router.resolve({
path: '/goodsDetail',
query: { skuId, goodsId }
path: "/goodsDetail",
query: { skuId, goodsId },
});
window.open(routeUrl.href, '_blank');
window.open(routeUrl.href, "_blank");
},
//
goShopPage(id) {
let routeUrl = this.$router.resolve({
path: '/Merchant',
query: {id: id}
path: "/Merchant",
query: { id: id },
});
window.open(routeUrl.href, '_blank');
window.open(routeUrl.href, "_blank");
},
selectDelivery (delivery) { //
selectDelivery(delivery) {
//
let params = {
way: this.$route.query.way,
shippingMethod: delivery.value
shippingMethod: delivery.value,
};
shippingMethod(params).then(res => {
});
shippingMethod(params).then((res) => {});
},
useCoupon (id, used) { // 使
useCoupon(id, used) {
// 使
let params = {
way: this.$route.query.way,
memberCouponId: id,
used: used // true 使 false
}
selectCoupon(params).then(res => {
if (res.success) this.init()
})
used: used, // true 使 false
};
selectCoupon(params).then((res) => {
if (res.success) this.init();
});
},
editInvoice () { //
editInvoice() {
//
this.$refs.invModal.invoiceAvailable = true;
},
getInvMsg (item) { //
console.log(item);
this.invoiceData = item;
this.selectReceipt(item.id)
},
selectReceipt (id) { //
let params = {
way: this.$route.query.way,
receiptId: id
getInvMsg(item) {
//
if (item) {
this.init();
this.$refs.invModal.invoiceAvailable = false;
}
receiptSelect(params).then(res => {
})
},
pay () { //
pay() {
//
const params = {
client: 'PC',
client: "PC",
remark: [],
way: this.$route.query.way
way: this.$route.query.way,
};
this.goodsList.forEach(e => {
this.goodsList.forEach((e) => {
if (e.remark) {
params.remark.push({
remark: e.remark,
storeId: e.storeId
})
storeId: e.storeId,
});
}
})
});
if (!params.remark.length) delete params.remark;
this.$Spin.show();
createTrade(params).then(res => {
createTrade(params)
.then((res) => {
this.$Spin.hide();
if (res.success) {
this.$router.push({path: '/payment', query: {orderType: 'TRADE', sn: res.result.sn}});
this.$router.push({
path: "/payment",
query: { orderType: "TRADE", sn: res.result.sn },
});
}
}).catch(() => {
this.$Spin.hide()
})
.catch(() => {
this.$Spin.hide();
});
},
useScope(type) {
let goods = '全部商品'
let goods = "全部商品";
switch (type) {
case 'ALL':
goods = '全部商品'
case "ALL":
goods = "全部商品";
break;
case 'PORTION_GOODS':
goods = '部分商品'
case "PORTION_GOODS":
goods = "部分商品";
break;
case 'PORTION_GOODS_CATEGORY':
goods = '部分分类商品'
case "PORTION_GOODS_CATEGORY":
goods = "部分分类商品";
break;
}
return `${goods}可用`
}
}
return `${goods}可用`;
},
},
};
</script>
<style scoped lang="scss">
@import '../../assets/styles/coupon.scss';
@import "../../assets/styles/coupon.scss";
/** logo start */
.logo {
height: 40px;
@ -596,7 +631,9 @@ export default {
font-weight: bold;
.ivu-icon {
color: #ff8f23;
&:hover {color: $theme_color;}
&:hover {
color: $theme_color;
}
}
}
> span:nth-child(2) {
@ -636,7 +673,9 @@ export default {
padding: 20px 0;
margin: 0 20px;
border-bottom: 1px dotted #999;
&:last-child{border:none;}
&:last-child {
border: none;
}
img {
width: 48px;
height: 48px;
@ -672,9 +711,9 @@ export default {
padding: 3px;
margin: 0 0 0 10px;
font-size: 12px !important;
box-shadow: 0 0 3px rgba(0,0,0,.15);
box-shadow: 0 0 3px rgba(0, 0, 0, 0.15);
&::before {
content: '';
content: "";
display: inline-block;
width: 12px;
height: 17px;
@ -697,7 +736,9 @@ export default {
> span:last-child {
color: $theme_color;
cursor: pointer;
&:hover{border-bottom: 1px solid $theme_color;}
&:hover {
border-bottom: 1px solid $theme_color;
}
}
}
}
@ -771,7 +812,9 @@ export default {
background: $theme_color;
height: 2px;
}
.pay-address{font-size: 12px;}
.pay-address {
font-size: 12px;
}
.more-addr {
cursor: pointer;
margin-top: 10px;
@ -787,10 +830,11 @@ export default {
padding: 10px 7px;
}
b {
background: url('../../assets/images/small-circle.png') top left repeat-y;
background: url("../../assets/images/small-circle.png") top left repeat-y;
right: 28px;
}
.circle-top,.circle-bottom{
.circle-top,
.circle-bottom {
right: 22px;
}
.used {

View File

@ -5,6 +5,13 @@ import { getRequest, postRequest, putRequest, deleteRequest} from '@/libs/axios'
export const getManagerBrandPage = (params) => {
return getRequest('/goods/brand/getByPage', params)
}
// 批量删除
export const delBrand = (ids) =>{
return deleteRequest(`/goods/brand/delByIds/${ids}`)
}
// 添加
export const addBrand = (params) => {
return postRequest('/goods/brand', params)

View File

@ -17,10 +17,15 @@ export default {
* @description api请求基础路径
*/
api_dev: {
common: "https://common-api.pickmall.cn",
buyer: "https://buyer-api.pickmall.cn",
seller: "https://store-api.pickmall.cn",
manager: "https://admin-api.pickmall.cn"
// common: "https://common-api.pickmall.cn",
// buyer: "https://buyer-api.pickmall.cn",
// seller: "https://store-api.pickmall.cn",
// manager: "https://admin-api.pickmall.cn"
common: "http://192.168.0.100:8890",
buyer: "http://192.168.0.100:8888",
seller: "http://192.168.0.100:8889",
manager: "http://192.168.0.100:8887"
},
api_prod: {
common: "https://common-api.pickmall.cn",

View File

@ -5,21 +5,9 @@
<div class="search">
<Card>
<Row @keydown.enter.native="handleSearch">
<Form
ref="searchForm"
:model="searchForm"
inline
:label-width="70"
class="search-form"
>
<Form ref="searchForm" :model="searchForm" inline :label-width="70" class="search-form">
<Form-item label="品牌名称" prop="name">
<Input
type="text"
v-model="searchForm.name"
placeholder="请输入品牌名称"
clearable
style="width: 200px"
/>
<Input type="text" v-model="searchForm.name" placeholder="请输入品牌名称" clearable style="width: 200px" />
</Form-item>
<Button @click="handleSearch" type="primary" icon="ios-search" class="search-btn">搜索</Button>
@ -28,61 +16,38 @@
<Row class="operation padding-row">
<Button @click="add" type="primary">添加</Button>
</Row>
<Table
:loading="loading"
border
:columns="columns"
:data="data"
ref="table"
sortable="custom"
@on-sort-change="changeSort"
@on-selection-change="changeSelect"
></Table>
<Table :loading="loading" border :columns="columns" :data="data" ref="table" sortable="custom" @on-sort-change="changeSort" @on-selection-change="changeSelect"></Table>
<Row type="flex" justify="end" class="page">
<Page
:current="searchForm.pageNumber"
:total="total"
:page-size="searchForm.pageSize"
@on-change="changePage"
@on-page-size-change="changePageSize"
:page-size-opts="[10, 20, 50]"
size="small"
show-total
show-elevator
show-sizer
></Page>
<Page :current="searchForm.pageNumber" :total="total" :page-size="searchForm.pageSize" @on-change="changePage" @on-page-size-change="changePageSize" :page-size-opts="[10, 20, 50]" size="small"
show-total show-elevator show-sizer></Page>
</Row>
</Card>
<Modal
:title="modalTitle"
v-model="modalVisible"
:mask-closable="false"
:width="500"
>
<Modal :title="modalTitle" v-model="modalVisible" :mask-closable="false" :width="500">
<Form ref="form" :model="form" :label-width="100" :rules="formValidate">
<FormItem label="品牌名称" prop="name">
<Input v-model="form.name" clearable style="width: 100%" />
</FormItem>
<FormItem label="品牌图标" prop="logo">
<upload-pic-input
v-model="form.logo"
style="width: 100%"
></upload-pic-input>
<upload-pic-input v-model="form.logo" style="width: 100%"></upload-pic-input>
</FormItem>
</Form>
<div slot="footer">
<Button type="text" @click="modalVisible = false">取消</Button>
<Button type="primary" :loading="submitLoading" @click="handleSubmit"
>提交
</Button
>
<Button type="primary" :loading="submitLoading" @click="handleSubmit">
</Button>
</div>
</Modal>
</div>
</template>
<script>
import {getManagerBrandPage, addBrand,updateBrand, disableBrand} from "@/api/goods";
import {
getManagerBrandPage,
addBrand,
updateBrand,
disableBrand,
delBrand,
} from "@/api/goods";
import uploadPicInput from "@/views/my-components/lili/upload-pic-input";
export default {
@ -253,6 +218,24 @@
"编辑"
),
enableOrDisable,
h(
"Button",
{
props: {
size: "small",
},
style: {
marginRight: "5px",
},
on: {
click: () => {
this.delBrand(params.row.id);
},
},
},
"删除"
),
]);
},
},
@ -262,6 +245,16 @@
};
},
methods: {
//
async delBrand(id) {
let res = await delBrand(id);
if (res.success) {
this.$Message.success("品牌删除成功!");
this.getDataList();
}
},
init() {
this.getDataList();
},
@ -300,7 +293,7 @@
getManagerBrandPage(this.searchForm).then((res) => {
this.loading = false;
if (res.success) {
console.warn(12)
console.warn(12);
this.data = res.result.records;
this.total = res.result.total;
}

View File

@ -212,13 +212,17 @@ export default {
},
],
tableData: [],
categoryIndex: 0,
};
},
methods: {
changeSortCate(val) {
let way = this.categoryList.find((item) => {
let way = this.categoryList.find((item, index) => {
if (item.name == val) {
this.categoryIndex = index;
console.log((this.categoryIndex = index));
return item.name == val;
}
});
this.tableData = [way];
},
@ -244,7 +248,7 @@ export default {
//
brandOperation(v) {
getCategoryBrandListData(v.id).then((res) => {
console.warn(res)
console.warn(res);
this.categoryId = v.id;
this.modalBrandTitle = "品牌关联";
this.brandForm.categoryBrands = res.result.map((item) => item.id);
@ -337,7 +341,7 @@ export default {
this.submitLoading = false;
if (res.success) {
this.$Message.success("添加成功");
this.getAllList(0);
this.getAllList(this.categoryIndex);
this.modalVisible = false;
this.$refs.form.resetFields();
}
@ -348,7 +352,7 @@ export default {
this.submitLoading = false;
if (res.success) {
this.$Message.success("修改成功");
this.getAllList(0);
this.getAllList(this.categoryIndex);
this.modalVisible = false;
this.$refs.form.resetFields();
}
@ -376,13 +380,11 @@ export default {
});
},
getAllList(parent_id) {
this.sortCateList = []
this.sortCateList = [];
this.loading = true;
getCategoryTree(parent_id).then((res) => {
this.loading = false;
if (res.success) {
//
let expandLevel = this.expandLevel;
localStorage.setItem("category", JSON.stringify(res.result));
res.result.forEach((e, index, arr) => {
this.sortCateList.push({
@ -390,65 +392,14 @@ export default {
value: e.name,
});
this.sortCate = arr[0].name;
if (expandLevel == 1) {
if (e.level == 0) {
e.expand = false;
}
if (e.children && e.children.length > 0) {
e.children.forEach(function (c) {
if (c.level == 1) {
c.expand = false;
}
if (c.children && c.children.length > 0) {
c.children.forEach(function (b) {
if (b.level == 2) {
b.expand = false;
}
});
}
});
}
} else if (expandLevel == 2) {
if (e.level == 0) {
e.expand = true;
}
if (e.children && e.children.length > 0) {
e.children.forEach(function (c) {
if (c.level == 1) {
c.expand = false;
}
if (c.children && c.children.length > 0) {
c.children.forEach(function (b) {
if (b.level == 2) {
b.expand = false;
}
});
}
});
}
} else if (expandLevel == 3) {
if (e.level == 0) {
e.expand = true;
}
if (e.children && e.children.length > 0) {
e.children.forEach(function (c) {
if (c.level == 1) {
c.expand = true;
}
if (c.children && c.children.length > 0) {
c.children.forEach(function (b) {
if (b.level == 2) {
b.expand = false;
}
});
}
});
}
}
});
this.categoryList = res.result;
this.tableData = [res.result[0]];
this.$nextTick(() => {
this.$set(this, "tableData", [res.result[this.categoryIndex]]);
});
}
});
},