解决商品分类不同步数据问题,解决pc端添加发票问题
parent
99ae898139
commit
336643419e
|
@ -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>
|
||||
|
|
|
@ -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}} 收货人:{{selectedAddress.name}} {{selectedAddress.mobile}}</div>
|
||||
<div class="pay-address" v-if="addressList.length">配送至:{{ selectedAddress.consigneeAddressPath | unitAddress }}
|
||||
{{selectedAddress.detail}} 收货人:{{selectedAddress.name}} {{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 {
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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]]);
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue