解决商品分类不同步数据问题,解决pc端添加发票问题
parent
99ae898139
commit
336643419e
|
@ -11,42 +11,37 @@
|
||||||
</div> -->
|
</div> -->
|
||||||
<!-- 普通发票 -->
|
<!-- 普通发票 -->
|
||||||
<div class="nav-content">
|
<div class="nav-content">
|
||||||
<Form
|
<Form :model="invoiceForm" ref="form" label-position="left" :rules="ruleInline" :label-width="110">
|
||||||
:model="invoiceForm"
|
|
||||||
ref="form"
|
|
||||||
label-position="left"
|
|
||||||
:rules="ruleInline"
|
|
||||||
:label-width="110"
|
|
||||||
>
|
|
||||||
<FormItem label="发票类型">
|
<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="1">个人</Radio>
|
||||||
<Radio :label="2">单位</Radio>
|
<Radio :label="2">单位</Radio>
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem
|
<FormItem label="个人名称" v-if="type === 1" prop="receiptTitle">
|
||||||
label="发票抬头"
|
|
||||||
v-if="invoiceForm.type == 2"
|
|
||||||
prop="receiptTitle"
|
|
||||||
>
|
|
||||||
<i-input v-model="invoiceForm.receiptTitle"></i-input>
|
<i-input v-model="invoiceForm.receiptTitle"></i-input>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem
|
<FormItem label="单位名称" v-if="type === 2" prop="receiptTitle">
|
||||||
label="纳税人识别号"
|
<i-input v-model="invoiceForm.receiptTitle"></i-input>
|
||||||
v-if="invoiceForm.type == 2"
|
</FormItem>
|
||||||
prop="taxpayerId"
|
<FormItem label="纳税人识别号" v-if="type === 2" prop="taxpayerId">
|
||||||
>
|
|
||||||
<i-input v-model="invoiceForm.taxpayerId"></i-input>
|
<i-input v-model="invoiceForm.taxpayerId"></i-input>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem label="发票内容">
|
<FormItem label="发票内容">
|
||||||
<RadioGroup v-model="invoiceForm.receiptContent" type="button" button-style="solid">
|
<RadioGroup v-model="invoiceForm.receiptContent" type="button" button-style="solid">
|
||||||
<Radio label="不开发票">不开发票</Radio>
|
|
||||||
<Radio label="商品明细">商品明细</Radio>
|
<Radio label="商品明细">商品明细</Radio>
|
||||||
|
<Radio label="商品类别">商品类别</Radio>
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</Form>
|
</Form>
|
||||||
<div style="text-align: center">
|
<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>
|
<Button type="default" @click="invoiceAvailable = false">取消</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -54,100 +49,104 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { saveReceipt } from '@/api/member.js';
|
import { receiptSelect } from "@/api/cart.js";
|
||||||
import { TINumber } from '@/plugins/RegExp.js';
|
import { TINumber } from "@/plugins/RegExp.js";
|
||||||
export default {
|
export default {
|
||||||
name: 'invoiceModal',
|
name: "invoiceModal",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
invoice: 1,
|
||||||
invoiceAvailable: false, // 模态框显隐
|
invoiceAvailable: false, // 模态框显隐
|
||||||
loading: false, // 提交状态
|
loading: false, // 提交状态
|
||||||
invoiceForm: { // 发票表单
|
invoiceForm: {
|
||||||
|
// 发票表单
|
||||||
// 普票表单
|
// 普票表单
|
||||||
receiptTitle: '', // 发票抬头
|
receiptTitle: "", // 发票抬头
|
||||||
taxpayerId: '', // 纳税人识别号
|
taxpayerId: "", // 纳税人识别号
|
||||||
receiptContent: '不开发票', // 发票内容
|
receiptContent: "商品明细", // 发票内容
|
||||||
type: 1 // 1 个人 2 单位
|
|
||||||
},
|
},
|
||||||
|
type: 1, // 1 个人 2 单位
|
||||||
ruleInline: {
|
ruleInline: {
|
||||||
receiptTitle: [{ required: true, message: '请填写公司名称' }],
|
|
||||||
taxpayerId: [
|
taxpayerId: [
|
||||||
{ required: true, message: '请填写纳税人识别号' },
|
{ required: true, message: "请填写纳税人识别号" },
|
||||||
{ pattern: TINumber, 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: {
|
methods: {
|
||||||
save () {
|
/**
|
||||||
if (this.invoiceForm.type === 1) {
|
* 选择发票抬头
|
||||||
// 个人
|
*/
|
||||||
let flag = true;
|
changeInvoice(val) {
|
||||||
this.receiptItems.forEach((e) => {
|
this.$nextTick(() => {
|
||||||
if (
|
this.type = val;
|
||||||
e.receiptTitle === '个人' &&
|
|
||||||
e.receiptContent === this.invoiceForm.receiptContent
|
|
||||||
) {
|
|
||||||
this.$emit('change', e);
|
|
||||||
flag = false;
|
|
||||||
this.invoiceAvailable = false;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
|
||||||
if (flag) {
|
/**
|
||||||
let params = {
|
* 保存判断
|
||||||
receiptTitle: '个人',
|
*/
|
||||||
receiptContent: this.invoiceForm.receiptContent
|
save() {
|
||||||
};
|
let flage = true;
|
||||||
this.loading = true;
|
|
||||||
saveReceipt(params)
|
// 保存分为两种类型,个人以及企业
|
||||||
.then((res) => {
|
const { type, receiptTitle, receiptContent } = JSON.parse(
|
||||||
this.loading = false;
|
JSON.stringify(this.invoiceForm)
|
||||||
if (res.success) {
|
);
|
||||||
this.$emit('change', res.result);
|
|
||||||
this.invoiceAvailable = false;
|
// 判断是否填写发票抬头
|
||||||
|
if (!receiptTitle) {
|
||||||
|
this.$Message.error("请填写发票抬头!");
|
||||||
|
flage = false;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
})
|
|
||||||
.catch(() => {
|
if (type == 2) {
|
||||||
this.loading = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// 单位
|
|
||||||
this.$refs.form.validate((valid) => {
|
this.$refs.form.validate((valid) => {
|
||||||
if (valid) {
|
if (!valid) {
|
||||||
this.loading = true;
|
flage = false;
|
||||||
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 (!flag) {
|
|
||||||
this.$Message.error('已有当前税号的发票信息,请直接选择已有发票');
|
|
||||||
} else {
|
} else {
|
||||||
saveReceipt(params)
|
delete this.invoiceForm.taxpayerId;
|
||||||
.then((res) => {
|
}
|
||||||
|
|
||||||
|
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;
|
this.loading = false;
|
||||||
if (res.success) {
|
|
||||||
this.$emit('change', res.result);
|
|
||||||
this.invoiceAvailable = false;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch(() => {
|
|
||||||
this.loading = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
|
@ -24,7 +24,8 @@
|
||||||
<span @click="goAddressManage">管理收货人地址</span>
|
<span @click="goAddressManage">管理收货人地址</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="address-manage">
|
<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>
|
<div>
|
||||||
<span>{{item.name}}</span>
|
<span>{{item.name}}</span>
|
||||||
<Tag class="ml_10" v-if="item.isDefault" color="red">默认</Tag>
|
<Tag class="ml_10" v-if="item.isDefault" color="red">默认</Tag>
|
||||||
|
@ -92,7 +93,9 @@
|
||||||
<!-- 发票信息 -->
|
<!-- 发票信息 -->
|
||||||
<div class="invoice">
|
<div class="invoice">
|
||||||
<div class="card-head mt_20 mb_20">
|
<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>
|
||||||
<div class="inovice-content">
|
<div class="inovice-content">
|
||||||
<span>{{invoiceData.receiptTitle}}</span>
|
<span>{{invoiceData.receiptTitle}}</span>
|
||||||
|
@ -135,7 +138,8 @@
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -159,45 +163,56 @@
|
||||||
<!-- 底部支付栏 -->
|
<!-- 底部支付栏 -->
|
||||||
<div class="order-footer width_1200">
|
<div class="order-footer width_1200">
|
||||||
<div class="pay ml_20" @click="pay">提交订单</div>
|
<div class="pay ml_20" @click="pay">提交订单</div>
|
||||||
<div class="pay-address" v-if="addressList.length">配送至:{{ selectedAddress.consigneeAddressPath | unitAddress }} {{selectedAddress.detail}} 收货人:{{selectedAddress.name}} {{selectedAddress.mobile}}</div>
|
<div class="pay-address" v-if="addressList.length">配送至:{{ selectedAddress.consigneeAddressPath | unitAddress }}
|
||||||
|
{{selectedAddress.detail}} 收货人:{{selectedAddress.name}} {{selectedAddress.mobile}}</div>
|
||||||
</div>
|
</div>
|
||||||
<BaseFooter></BaseFooter>
|
<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>
|
<address-manage ref="address" :id="addrId" @change="addrChange"></address-manage>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import invoiceModal from '@/components/invoiceModal';
|
import invoiceModal from "@/components/invoiceModal";
|
||||||
import addressManage from '@/components/addressManage';
|
import addressManage from "@/components/addressManage";
|
||||||
import {memberAddress, delMemberAddress} from '@/api/address';
|
import { memberAddress, delMemberAddress } from "@/api/address";
|
||||||
import {cartGoodsPay, createTrade, selectAddr, shippingMethod, receiptSelect, selectCoupon, couponNum} from '@/api/cart';
|
import {
|
||||||
import { canUseCouponList } from '@/api/member.js';
|
cartGoodsPay,
|
||||||
import {getLogo} from '@/api/common.js'
|
createTrade,
|
||||||
|
selectAddr,
|
||||||
|
shippingMethod,
|
||||||
|
selectCoupon,
|
||||||
|
couponNum,
|
||||||
|
} from "@/api/cart";
|
||||||
|
import { canUseCouponList } from "@/api/member.js";
|
||||||
|
import { getLogo } from "@/api/common.js";
|
||||||
export default {
|
export default {
|
||||||
name: 'Pay',
|
name: "Pay",
|
||||||
components: { invoiceModal, addressManage },
|
components: { invoiceModal, addressManage },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
stepIndex: 1, // 顶部步骤条状态
|
stepIndex: 1, // 顶部步骤条状态
|
||||||
invoiceAvailable: false, // 发票编辑按钮
|
invoiceAvailable: false, // 发票编辑按钮
|
||||||
showEditBtn: '', // 鼠标移入显示编辑按钮
|
showEditBtn: "", // 鼠标移入显示编辑按钮
|
||||||
orderMark: '', // 订单备注
|
orderMark: "", // 订单备注
|
||||||
invoiceData: { // 发票数据
|
invoiceData: {
|
||||||
receiptTitle: '个人',
|
// 发票数据
|
||||||
receiptContent: '不开发票'
|
receiptTitle: "个人",
|
||||||
|
receiptContent: "不开发票",
|
||||||
},
|
},
|
||||||
otherMsgForm: { // 其他信息模块数据
|
otherMsgForm: {
|
||||||
|
// 其他信息模块数据
|
||||||
point: 0,
|
point: 0,
|
||||||
availablePoint: 10,
|
availablePoint: 10,
|
||||||
totalPoint: 100,
|
totalPoint: 100,
|
||||||
noGoods: 0
|
noGoods: 0,
|
||||||
},
|
},
|
||||||
deliveryList: [ // 物流
|
deliveryList: [
|
||||||
|
// 物流
|
||||||
// {value: 'SELF_PICK_UP', label: '自提'},
|
// {value: 'SELF_PICK_UP', label: '自提'},
|
||||||
{value: 'LOGISTICS', label: '物流'}
|
{ value: "LOGISTICS", label: "物流" },
|
||||||
// {value: 'LOCAL_TOWN_DELIVERY', label: '同城配送'}
|
// {value: 'LOCAL_TOWN_DELIVERY', label: '同城配送'}
|
||||||
],
|
],
|
||||||
addressList: [], // 地址列表
|
addressList: [], // 地址列表
|
||||||
|
@ -205,257 +220,277 @@ export default {
|
||||||
goodsList: [], // 商品列表
|
goodsList: [], // 商品列表
|
||||||
priceDetailDTO: {}, // 商品价格
|
priceDetailDTO: {}, // 商品价格
|
||||||
totalNum: 0, // 购买数量
|
totalNum: 0, // 购买数量
|
||||||
addrId: '', // 编辑地址传入的id
|
addrId: "", // 编辑地址传入的id
|
||||||
moreAddr: false, // 更多地址
|
moreAddr: false, // 更多地址
|
||||||
canUseCouponNum: 0, // 可用优惠券数量
|
canUseCouponNum: 0, // 可用优惠券数量
|
||||||
couponList: [], // 可用优惠券列表
|
couponList: [], // 可用优惠券列表
|
||||||
logoImg: '', // 平台logo
|
logoImg: "", // 平台logo
|
||||||
usedCouponId: [], // 已使用优惠券id
|
usedCouponId: [], // 已使用优惠券id
|
||||||
selectedCoupon: {} // 已选优惠券对象
|
selectedCoupon: {}, // 已选优惠券对象
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.init();
|
this.init();
|
||||||
if (!this.Cookies.getItem('logo')) {
|
if (!this.Cookies.getItem("logo")) {
|
||||||
getLogo().then(res => {
|
getLogo().then((res) => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
let logoObj = JSON.parse(res.result.settingValue)
|
let logoObj = JSON.parse(res.result.settingValue);
|
||||||
this.Cookies.setItem('logo', logoObj.buyerSideLogo)
|
this.Cookies.setItem("logo", logoObj.buyerSideLogo);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
this.logoImg = this.Cookies.getItem('logo')
|
this.logoImg = this.Cookies.getItem("logo");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
init() {
|
init() {
|
||||||
this.getGoodsDetail();
|
this.getGoodsDetail();
|
||||||
},
|
},
|
||||||
goAddressManage () { // 跳转地址管理页面
|
goAddressManage() {
|
||||||
this.$router.push('/home/MyAddress');
|
// 跳转地址管理页面
|
||||||
|
this.$router.push("/home/MyAddress");
|
||||||
},
|
},
|
||||||
getAddress () { // 获取收货地址列表
|
getAddress() {
|
||||||
memberAddress().then(res => {
|
// 获取收货地址列表
|
||||||
|
memberAddress().then((res) => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
this.addressList = res.result.records;
|
this.addressList = res.result.records;
|
||||||
this.addressList.forEach((e, index) => {
|
this.addressList.forEach((e, index) => {
|
||||||
if (e.id === this.selectedAddress.id && index > 2) {
|
if (e.id === this.selectedAddress.id && index > 2) {
|
||||||
this.moreAddr = true
|
this.moreAddr = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getGoodsDetail () { // 订单商品详情
|
getGoodsDetail() {
|
||||||
|
// 订单商品详情
|
||||||
this.$Spin.show();
|
this.$Spin.show();
|
||||||
cartGoodsPay({way: this.$route.query.way}).then(res => {
|
cartGoodsPay({ way: this.$route.query.way })
|
||||||
|
.then((res) => {
|
||||||
this.$Spin.hide();
|
this.$Spin.hide();
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
this.goodsList = res.result.cartList;
|
this.goodsList = res.result.cartList;
|
||||||
this.priceDetailDTO = res.result.priceDetailDTO;
|
this.priceDetailDTO = res.result.priceDetailDTO;
|
||||||
this.skuList = res.result.skuList;
|
this.skuList = res.result.skuList;
|
||||||
|
|
||||||
|
res.result.receiptVO
|
||||||
|
? (this.invoiceData = res.result.receiptVO)
|
||||||
|
: "";
|
||||||
|
|
||||||
let notSupArea = res.result.notSupportFreight;
|
let notSupArea = res.result.notSupportFreight;
|
||||||
this.selectedCoupon = {}
|
this.selectedCoupon = {};
|
||||||
if (res.result.platformCoupon) this.selectedCoupon.platformCoupon = res.result.platformCoupon
|
if (res.result.platformCoupon)
|
||||||
Object.assign(this.selectedCoupon, res.result.storeCoupons)
|
this.selectedCoupon.platformCoupon = res.result.platformCoupon;
|
||||||
|
Object.assign(this.selectedCoupon, res.result.storeCoupons);
|
||||||
if (notSupArea) {
|
if (notSupArea) {
|
||||||
let content = [];
|
let content = [];
|
||||||
let title = ''
|
let title = "";
|
||||||
notSupArea.forEach(e => {
|
notSupArea.forEach((e) => {
|
||||||
title = e.errorMessage
|
title = e.errorMessage;
|
||||||
content.push(e.goodsSku.goodsName)
|
content.push(e.goodsSku.goodsName);
|
||||||
})
|
});
|
||||||
this.$Modal.warning({
|
this.$Modal.warning({
|
||||||
title: '以下商品超出配送区域' || title,
|
title: "以下商品超出配送区域" || title,
|
||||||
content: content.toString()
|
content: content.toString(),
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
if (res.result.memberAddress) {
|
if (res.result.memberAddress) {
|
||||||
this.selectedAddress = res.result.memberAddress
|
this.selectedAddress = res.result.memberAddress;
|
||||||
}
|
}
|
||||||
this.getAddress()
|
this.getAddress();
|
||||||
this.totalNum = 0;
|
this.totalNum = 0;
|
||||||
for (let i = 0; i < this.skuList.length; i++) {
|
for (let i = 0; i < this.skuList.length; i++) {
|
||||||
this.totalNum += this.skuList[i].num;
|
this.totalNum += this.skuList[i].num;
|
||||||
}
|
}
|
||||||
this.getCouponNum()
|
this.getCouponNum();
|
||||||
}
|
}
|
||||||
}).catch(() => { this.$Spin.hide() });
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.$Spin.hide();
|
||||||
|
});
|
||||||
},
|
},
|
||||||
getCouponNum () { // 获取可用优惠券数量
|
getCouponNum() {
|
||||||
couponNum({way: this.$route.query.way}).then(res => {
|
// 获取可用优惠券数量
|
||||||
this.canUseCouponNum = res.result
|
couponNum({ way: this.$route.query.way }).then((res) => {
|
||||||
|
this.canUseCouponNum = res.result;
|
||||||
if (res.result) {
|
if (res.result) {
|
||||||
let storeArr = []
|
let storeArr = [];
|
||||||
let skuArr = []
|
let skuArr = [];
|
||||||
this.goodsList.forEach(e => {
|
this.goodsList.forEach((e) => {
|
||||||
storeArr.push(e.storeId)
|
storeArr.push(e.storeId);
|
||||||
e.skuList.forEach(i => {
|
e.skuList.forEach((i) => {
|
||||||
skuArr.push(i.goodsSku.id)
|
skuArr.push(i.goodsSku.id);
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
let params = {
|
let params = {
|
||||||
pageNumber: 1,
|
pageNumber: 1,
|
||||||
pageSize: 100,
|
pageSize: 100,
|
||||||
memberCouponStatus: 'NEW',
|
memberCouponStatus: "NEW",
|
||||||
scopeId: skuArr.toString(),
|
scopeId: skuArr.toString(),
|
||||||
storeId: storeArr.toString(),
|
storeId: storeArr.toString(),
|
||||||
totalPrice: this.priceDetailDTO.goodsPrice
|
totalPrice: this.priceDetailDTO.goodsPrice,
|
||||||
}
|
};
|
||||||
canUseCouponList(params).then(res => { // 可用优惠券列表
|
canUseCouponList(params).then((res) => {
|
||||||
if (res.success) this.couponList = res.result.records
|
// 可用优惠券列表
|
||||||
const couponKeys = Object.keys(this.selectedCoupon)
|
if (res.success) this.couponList = res.result.records;
|
||||||
this.usedCouponId = []
|
const couponKeys = Object.keys(this.selectedCoupon);
|
||||||
|
this.usedCouponId = [];
|
||||||
if (couponKeys.length) {
|
if (couponKeys.length) {
|
||||||
this.couponList.forEach(e => {
|
this.couponList.forEach((e) => {
|
||||||
if (e.id === this.selectedCoupon[couponKeys].memberCoupon.id) {
|
if (e.id === this.selectedCoupon[couponKeys].memberCoupon.id) {
|
||||||
this.usedCouponId.push(e.id)
|
this.usedCouponId.push(e.id);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.$forceUpdate()
|
this.$forceUpdate();
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
selectAddress (item) { // 选择地址
|
selectAddress(item) {
|
||||||
|
// 选择地址
|
||||||
let params = {
|
let params = {
|
||||||
way: this.$route.query.way,
|
way: this.$route.query.way,
|
||||||
shippingAddressId: item.id
|
shippingAddressId: item.id,
|
||||||
};
|
};
|
||||||
selectAddr(params).then(res => {
|
selectAddr(params).then((res) => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
this.$Message.success('选择收货地址成功');
|
this.$Message.success("选择收货地址成功");
|
||||||
this.selectedAddress = item;
|
this.selectedAddress = item;
|
||||||
this.getGoodsDetail();
|
this.getGoodsDetail();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
editAddress (id) { // 编辑地址
|
editAddress(id) {
|
||||||
|
// 编辑地址
|
||||||
this.addrId = id;
|
this.addrId = id;
|
||||||
this.$refs.address.show();
|
this.$refs.address.show();
|
||||||
},
|
},
|
||||||
addrChange (item) { // 添加,编辑地址回显
|
addrChange(item) {
|
||||||
|
// 添加,编辑地址回显
|
||||||
this.getAddress();
|
this.getAddress();
|
||||||
},
|
},
|
||||||
delAddress(item) {
|
delAddress(item) {
|
||||||
// 删除地址
|
// 删除地址
|
||||||
this.$Modal.confirm({
|
this.$Modal.confirm({
|
||||||
title: '提示',
|
title: "提示",
|
||||||
content: '你确定删除这个收货地址',
|
content: "你确定删除这个收货地址",
|
||||||
onOk: () => {
|
onOk: () => {
|
||||||
delMemberAddress(item.id).then((res) => {
|
delMemberAddress(item.id).then((res) => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
this.$Message.success('删除成功');
|
this.$Message.success("删除成功");
|
||||||
this.getAddress();
|
this.getAddress();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onCancel: () => {}
|
onCancel: () => {},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
goGoodsDetail (skuId, goodsId) { // 跳转商品详情
|
goGoodsDetail(skuId, goodsId) {
|
||||||
|
// 跳转商品详情
|
||||||
let routeUrl = this.$router.resolve({
|
let routeUrl = this.$router.resolve({
|
||||||
path: '/goodsDetail',
|
path: "/goodsDetail",
|
||||||
query: { skuId, goodsId }
|
query: { skuId, goodsId },
|
||||||
});
|
});
|
||||||
window.open(routeUrl.href, '_blank');
|
window.open(routeUrl.href, "_blank");
|
||||||
},
|
},
|
||||||
// 跳转店铺首页
|
// 跳转店铺首页
|
||||||
goShopPage(id) {
|
goShopPage(id) {
|
||||||
let routeUrl = this.$router.resolve({
|
let routeUrl = this.$router.resolve({
|
||||||
path: '/Merchant',
|
path: "/Merchant",
|
||||||
query: {id: id}
|
query: { id: id },
|
||||||
});
|
});
|
||||||
window.open(routeUrl.href, '_blank');
|
window.open(routeUrl.href, "_blank");
|
||||||
},
|
},
|
||||||
selectDelivery (delivery) { // 选择配送方式
|
selectDelivery(delivery) {
|
||||||
|
// 选择配送方式
|
||||||
let params = {
|
let params = {
|
||||||
way: this.$route.query.way,
|
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 = {
|
let params = {
|
||||||
way: this.$route.query.way,
|
way: this.$route.query.way,
|
||||||
memberCouponId: id,
|
memberCouponId: id,
|
||||||
used: used // true 为使用, false为弃用
|
used: used, // true 为使用, false为弃用
|
||||||
}
|
};
|
||||||
selectCoupon(params).then(res => {
|
selectCoupon(params).then((res) => {
|
||||||
if (res.success) this.init()
|
if (res.success) this.init();
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
editInvoice () { // 编辑发票信息
|
editInvoice() {
|
||||||
|
|
||||||
|
// 编辑发票信息
|
||||||
this.$refs.invModal.invoiceAvailable = true;
|
this.$refs.invModal.invoiceAvailable = true;
|
||||||
},
|
},
|
||||||
getInvMsg (item) { // 获取发票信息
|
getInvMsg(item) {
|
||||||
console.log(item);
|
// 获取发票信息
|
||||||
this.invoiceData = item;
|
if (item) {
|
||||||
this.selectReceipt(item.id)
|
this.init();
|
||||||
},
|
this.$refs.invModal.invoiceAvailable = false;
|
||||||
selectReceipt (id) { // 选择发票
|
|
||||||
let params = {
|
|
||||||
way: this.$route.query.way,
|
|
||||||
receiptId: id
|
|
||||||
}
|
}
|
||||||
receiptSelect(params).then(res => {
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
pay () { // 结算
|
|
||||||
|
pay() {
|
||||||
|
// 结算
|
||||||
const params = {
|
const params = {
|
||||||
client: 'PC',
|
client: "PC",
|
||||||
remark: [],
|
remark: [],
|
||||||
way: this.$route.query.way
|
way: this.$route.query.way,
|
||||||
};
|
};
|
||||||
this.goodsList.forEach(e => {
|
this.goodsList.forEach((e) => {
|
||||||
if (e.remark) {
|
if (e.remark) {
|
||||||
params.remark.push({
|
params.remark.push({
|
||||||
remark: e.remark,
|
remark: e.remark,
|
||||||
storeId: e.storeId
|
storeId: e.storeId,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
if (!params.remark.length) delete params.remark;
|
if (!params.remark.length) delete params.remark;
|
||||||
|
|
||||||
this.$Spin.show();
|
this.$Spin.show();
|
||||||
createTrade(params).then(res => {
|
createTrade(params)
|
||||||
|
.then((res) => {
|
||||||
this.$Spin.hide();
|
this.$Spin.hide();
|
||||||
if (res.success) {
|
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) {
|
useScope(type) {
|
||||||
let goods = '全部商品'
|
let goods = "全部商品";
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 'ALL':
|
case "ALL":
|
||||||
goods = '全部商品'
|
goods = "全部商品";
|
||||||
break;
|
break;
|
||||||
case 'PORTION_GOODS':
|
case "PORTION_GOODS":
|
||||||
goods = '部分商品'
|
goods = "部分商品";
|
||||||
break;
|
break;
|
||||||
case 'PORTION_GOODS_CATEGORY':
|
case "PORTION_GOODS_CATEGORY":
|
||||||
goods = '部分分类商品'
|
goods = "部分分类商品";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return `${goods}可用`
|
return `${goods}可用`;
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
@import '../../assets/styles/coupon.scss';
|
@import "../../assets/styles/coupon.scss";
|
||||||
/** logo start */
|
/** logo start */
|
||||||
.logo {
|
.logo {
|
||||||
height: 40px;
|
height: 40px;
|
||||||
|
@ -596,7 +631,9 @@ export default {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
.ivu-icon {
|
.ivu-icon {
|
||||||
color: #ff8f23;
|
color: #ff8f23;
|
||||||
&:hover {color: $theme_color;}
|
&:hover {
|
||||||
|
color: $theme_color;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
> span:nth-child(2) {
|
> span:nth-child(2) {
|
||||||
|
@ -636,7 +673,9 @@ export default {
|
||||||
padding: 20px 0;
|
padding: 20px 0;
|
||||||
margin: 0 20px;
|
margin: 0 20px;
|
||||||
border-bottom: 1px dotted #999;
|
border-bottom: 1px dotted #999;
|
||||||
&:last-child{border:none;}
|
&:last-child {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
img {
|
img {
|
||||||
width: 48px;
|
width: 48px;
|
||||||
height: 48px;
|
height: 48px;
|
||||||
|
@ -672,9 +711,9 @@ export default {
|
||||||
padding: 3px;
|
padding: 3px;
|
||||||
margin: 0 0 0 10px;
|
margin: 0 0 0 10px;
|
||||||
font-size: 12px !important;
|
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 {
|
&::before {
|
||||||
content: '';
|
content: "";
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 12px;
|
width: 12px;
|
||||||
height: 17px;
|
height: 17px;
|
||||||
|
@ -697,7 +736,9 @@ export default {
|
||||||
> span:last-child {
|
> span:last-child {
|
||||||
color: $theme_color;
|
color: $theme_color;
|
||||||
cursor: pointer;
|
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;
|
background: $theme_color;
|
||||||
height: 2px;
|
height: 2px;
|
||||||
}
|
}
|
||||||
.pay-address{font-size: 12px;}
|
.pay-address {
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
.more-addr {
|
.more-addr {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
|
@ -787,10 +830,11 @@ export default {
|
||||||
padding: 10px 7px;
|
padding: 10px 7px;
|
||||||
}
|
}
|
||||||
b {
|
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;
|
right: 28px;
|
||||||
}
|
}
|
||||||
.circle-top,.circle-bottom{
|
.circle-top,
|
||||||
|
.circle-bottom {
|
||||||
right: 22px;
|
right: 22px;
|
||||||
}
|
}
|
||||||
.used {
|
.used {
|
||||||
|
|
|
@ -5,6 +5,13 @@ import { getRequest, postRequest, putRequest, deleteRequest} from '@/libs/axios'
|
||||||
export const getManagerBrandPage = (params) => {
|
export const getManagerBrandPage = (params) => {
|
||||||
return getRequest('/goods/brand/getByPage', params)
|
return getRequest('/goods/brand/getByPage', params)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 批量删除
|
||||||
|
export const delBrand = (ids) =>{
|
||||||
|
return deleteRequest(`/goods/brand/delByIds/${ids}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 添加
|
// 添加
|
||||||
export const addBrand = (params) => {
|
export const addBrand = (params) => {
|
||||||
return postRequest('/goods/brand', params)
|
return postRequest('/goods/brand', params)
|
||||||
|
|
|
@ -17,10 +17,15 @@ export default {
|
||||||
* @description api请求基础路径
|
* @description api请求基础路径
|
||||||
*/
|
*/
|
||||||
api_dev: {
|
api_dev: {
|
||||||
common: "https://common-api.pickmall.cn",
|
// common: "https://common-api.pickmall.cn",
|
||||||
buyer: "https://buyer-api.pickmall.cn",
|
// buyer: "https://buyer-api.pickmall.cn",
|
||||||
seller: "https://store-api.pickmall.cn",
|
// seller: "https://store-api.pickmall.cn",
|
||||||
manager: "https://admin-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: {
|
api_prod: {
|
||||||
common: "https://common-api.pickmall.cn",
|
common: "https://common-api.pickmall.cn",
|
||||||
|
|
|
@ -5,21 +5,9 @@
|
||||||
<div class="search">
|
<div class="search">
|
||||||
<Card>
|
<Card>
|
||||||
<Row @keydown.enter.native="handleSearch">
|
<Row @keydown.enter.native="handleSearch">
|
||||||
<Form
|
<Form ref="searchForm" :model="searchForm" inline :label-width="70" class="search-form">
|
||||||
ref="searchForm"
|
|
||||||
:model="searchForm"
|
|
||||||
inline
|
|
||||||
:label-width="70"
|
|
||||||
class="search-form"
|
|
||||||
>
|
|
||||||
<Form-item label="品牌名称" prop="name">
|
<Form-item label="品牌名称" prop="name">
|
||||||
<Input
|
<Input type="text" v-model="searchForm.name" placeholder="请输入品牌名称" clearable style="width: 200px" />
|
||||||
type="text"
|
|
||||||
v-model="searchForm.name"
|
|
||||||
placeholder="请输入品牌名称"
|
|
||||||
clearable
|
|
||||||
style="width: 200px"
|
|
||||||
/>
|
|
||||||
</Form-item>
|
</Form-item>
|
||||||
|
|
||||||
<Button @click="handleSearch" type="primary" icon="ios-search" class="search-btn">搜索</Button>
|
<Button @click="handleSearch" type="primary" icon="ios-search" class="search-btn">搜索</Button>
|
||||||
|
@ -28,61 +16,38 @@
|
||||||
<Row class="operation padding-row">
|
<Row class="operation padding-row">
|
||||||
<Button @click="add" type="primary">添加</Button>
|
<Button @click="add" type="primary">添加</Button>
|
||||||
</Row>
|
</Row>
|
||||||
<Table
|
<Table :loading="loading" border :columns="columns" :data="data" ref="table" sortable="custom" @on-sort-change="changeSort" @on-selection-change="changeSelect"></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">
|
<Row type="flex" justify="end" class="page">
|
||||||
<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"
|
||||||
:current="searchForm.pageNumber"
|
show-total show-elevator show-sizer></Page>
|
||||||
: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>
|
</Row>
|
||||||
</Card>
|
</Card>
|
||||||
<Modal
|
<Modal :title="modalTitle" v-model="modalVisible" :mask-closable="false" :width="500">
|
||||||
:title="modalTitle"
|
|
||||||
v-model="modalVisible"
|
|
||||||
:mask-closable="false"
|
|
||||||
:width="500"
|
|
||||||
>
|
|
||||||
<Form ref="form" :model="form" :label-width="100" :rules="formValidate">
|
<Form ref="form" :model="form" :label-width="100" :rules="formValidate">
|
||||||
<FormItem label="品牌名称" prop="name">
|
<FormItem label="品牌名称" prop="name">
|
||||||
<Input v-model="form.name" clearable style="width: 100%" />
|
<Input v-model="form.name" clearable style="width: 100%" />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<FormItem label="品牌图标" prop="logo">
|
<FormItem label="品牌图标" prop="logo">
|
||||||
<upload-pic-input
|
<upload-pic-input v-model="form.logo" style="width: 100%"></upload-pic-input>
|
||||||
v-model="form.logo"
|
|
||||||
style="width: 100%"
|
|
||||||
></upload-pic-input>
|
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</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="handleSubmit"
|
<Button type="primary" :loading="submitLoading" @click="handleSubmit">提交
|
||||||
>提交
|
</Button>
|
||||||
</Button
|
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<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";
|
import uploadPicInput from "@/views/my-components/lili/upload-pic-input";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -253,6 +218,24 @@
|
||||||
"编辑"
|
"编辑"
|
||||||
),
|
),
|
||||||
enableOrDisable,
|
enableOrDisable,
|
||||||
|
|
||||||
|
h(
|
||||||
|
"Button",
|
||||||
|
{
|
||||||
|
props: {
|
||||||
|
size: "small",
|
||||||
|
},
|
||||||
|
style: {
|
||||||
|
marginRight: "5px",
|
||||||
|
},
|
||||||
|
on: {
|
||||||
|
click: () => {
|
||||||
|
this.delBrand(params.row.id);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"删除"
|
||||||
|
),
|
||||||
]);
|
]);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -262,6 +245,16 @@
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
// 删除品牌
|
||||||
|
async delBrand(id) {
|
||||||
|
let res = await delBrand(id);
|
||||||
|
|
||||||
|
if (res.success) {
|
||||||
|
this.$Message.success("品牌删除成功!");
|
||||||
|
this.getDataList();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
this.getDataList();
|
this.getDataList();
|
||||||
},
|
},
|
||||||
|
@ -300,7 +293,7 @@
|
||||||
getManagerBrandPage(this.searchForm).then((res) => {
|
getManagerBrandPage(this.searchForm).then((res) => {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
console.warn(12)
|
console.warn(12);
|
||||||
this.data = res.result.records;
|
this.data = res.result.records;
|
||||||
this.total = res.result.total;
|
this.total = res.result.total;
|
||||||
}
|
}
|
||||||
|
|
|
@ -212,13 +212,17 @@ export default {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
tableData: [],
|
tableData: [],
|
||||||
|
categoryIndex: 0,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
changeSortCate(val) {
|
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;
|
return item.name == val;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
this.tableData = [way];
|
this.tableData = [way];
|
||||||
},
|
},
|
||||||
|
@ -244,7 +248,7 @@ export default {
|
||||||
//弹出品牌关联框
|
//弹出品牌关联框
|
||||||
brandOperation(v) {
|
brandOperation(v) {
|
||||||
getCategoryBrandListData(v.id).then((res) => {
|
getCategoryBrandListData(v.id).then((res) => {
|
||||||
console.warn(res)
|
console.warn(res);
|
||||||
this.categoryId = v.id;
|
this.categoryId = v.id;
|
||||||
this.modalBrandTitle = "品牌关联";
|
this.modalBrandTitle = "品牌关联";
|
||||||
this.brandForm.categoryBrands = res.result.map((item) => item.id);
|
this.brandForm.categoryBrands = res.result.map((item) => item.id);
|
||||||
|
@ -337,7 +341,7 @@ export default {
|
||||||
this.submitLoading = false;
|
this.submitLoading = false;
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
this.$Message.success("添加成功");
|
this.$Message.success("添加成功");
|
||||||
this.getAllList(0);
|
this.getAllList(this.categoryIndex);
|
||||||
this.modalVisible = false;
|
this.modalVisible = false;
|
||||||
this.$refs.form.resetFields();
|
this.$refs.form.resetFields();
|
||||||
}
|
}
|
||||||
|
@ -348,7 +352,7 @@ export default {
|
||||||
this.submitLoading = false;
|
this.submitLoading = false;
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
this.$Message.success("修改成功");
|
this.$Message.success("修改成功");
|
||||||
this.getAllList(0);
|
this.getAllList(this.categoryIndex);
|
||||||
this.modalVisible = false;
|
this.modalVisible = false;
|
||||||
this.$refs.form.resetFields();
|
this.$refs.form.resetFields();
|
||||||
}
|
}
|
||||||
|
@ -376,13 +380,11 @@ export default {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getAllList(parent_id) {
|
getAllList(parent_id) {
|
||||||
this.sortCateList = []
|
this.sortCateList = [];
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
getCategoryTree(parent_id).then((res) => {
|
getCategoryTree(parent_id).then((res) => {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
// 仅展开指定级数 默认后台已展开所有
|
|
||||||
let expandLevel = this.expandLevel;
|
|
||||||
localStorage.setItem("category", JSON.stringify(res.result));
|
localStorage.setItem("category", JSON.stringify(res.result));
|
||||||
res.result.forEach((e, index, arr) => {
|
res.result.forEach((e, index, arr) => {
|
||||||
this.sortCateList.push({
|
this.sortCateList.push({
|
||||||
|
@ -390,65 +392,14 @@ export default {
|
||||||
value: e.name,
|
value: e.name,
|
||||||
});
|
});
|
||||||
this.sortCate = arr[0].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.categoryList = res.result;
|
||||||
this.tableData = [res.result[0]];
|
|
||||||
|
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$set(this, "tableData", [res.result[this.categoryIndex]]);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue