合并冲突

master
lemon橪 2021-06-21 14:30:06 +08:00
commit 35094a7ac2
10 changed files with 1335 additions and 1395 deletions

View File

@ -61,7 +61,7 @@ export function getCateById (id) {
// 店铺入驻协议 // 店铺入驻协议
export function agreement () { export function agreement () {
return request({ return request({
url: `/buyer/article/get/1349291301250293760`, url: `/buyer/article/type/STORE_REGISTER`,
needToken: true, needToken: true,
method: Method.GET method: Method.GET
}) })

View File

@ -2,26 +2,10 @@
<div class="box"> <div class="box">
<div class="nav"> <div class="nav">
<ul class="location"> <ul class="location">
<li><router-link to="/" v-if="$route.path !== '/'" class="home-page" ><Icon type="md-home" />首页</router-link></li>
<li> <li>
<Dropdown placement="bottom-start"> <router-link to="/" v-if="$route.path !== '/'" class="home-page">
<a href="javascript:void(0)"> <Icon type="md-home" />首页
<Icon type="ios-pin" class="icon"></Icon> </router-link>
{{ city }}
</a>
<DropdownMenu slot="list">
<div class="city">
<p v-for="(items, index) in cityArr" :key="index">
<span
v-for="(item, index) in items"
class="city-item"
:key="index"
@click="changeCity(item)"
>{{ item }}</span>
</p>
</div>
</DropdownMenu>
</Dropdown>
</li> </li>
</ul> </ul>
<ul class="detail"> <ul class="detail">
@ -50,21 +34,17 @@
</DropdownMenu> </DropdownMenu>
</Dropdown> </Dropdown>
</li> </li>
<li @click="goUserCenter('/home/MyOrder')"><span class="nav-item hover-color">我的订单</span></li> <li class="hover-color" @click="goUserCenter('/home/MyOrder')"><span class="nav-item">我的订单</span></li>
<li @click="goUserCenter('/home/MyTracks')"><span class="nav-item hover-color">我的足迹</span></li> <li class="hover-color" @click="goUserCenter('/home/MyTracks')"><span class="nav-item">我的足迹</span></li>
<li @click="goUserCenter('/home/MsgList')"><span class="nav-item hover-color">我的消息</span></li>
<li v-if="$route.name !== 'Cart'" style="position:relative;"> <li v-if="$route.name !== 'Cart'" style="position:relative;">
<i class="cart-badge" v-show="Number(cartNum)">{{cartNum < 100 ? cartNum : '99'}}</i> <i class="cart-badge" v-show="Number(cartNum)">{{cartNum < 100 ? cartNum : '99'}}</i>
<Dropdown placement="bottom-start"> <Dropdown placement="bottom-start">
<router-link to="cart" target="_blank" > <router-link to="/cart" target="_blank">
<span @mouseenter="getCartList"> <span @mouseenter="getCartList">
<Icon <Icon size="18" class="cart-icon" type="ios-cart-outline"></Icon>
size="18"
type="ios-cart-outline"
></Icon>
购物车 购物车
</span> </span>
</router-link> </router-link>
<DropdownMenu slot="list"> <DropdownMenu slot="list">
@ -74,12 +54,7 @@
<span>赶快去添加商品吧~</span> <span>赶快去添加商品吧~</span>
</div> </div>
<div class="shopping-cart-list" v-show="shoppingCart.length > 0"> <div class="shopping-cart-list" v-show="shoppingCart.length > 0">
<div <div class="shopping-cart-box" v-for="(item, index) in shoppingCart" @click="goToPay" :key="index">
class="shopping-cart-box"
v-for="(item, index) in shoppingCart"
@click="goToPay"
:key="index"
>
<div class="shopping-cart-img"> <div class="shopping-cart-img">
<img :src="item.goodsSku.thumbnail" class="hover-pointer" /> <img :src="item.goodsSku.thumbnail" class="hover-pointer" />
</div> </div>
@ -116,35 +91,28 @@
</template> </template>
<script> <script>
import storage from '@/plugins/storage.js'; import storage from "@/plugins/storage.js";
import {cartGoodsAll} from '@/api/cart.js' import { cartGoodsAll } from "@/api/cart.js";
export default { export default {
name: 'M-Header', name: "M-Header",
created () { created() {
if (storage.getItem('userInfo')) { if (storage.getItem("userInfo")) {
this.userInfo = JSON.parse(storage.getItem('userInfo')); this.userInfo = JSON.parse(storage.getItem("userInfo"));
} }
}, },
data () { data() {
return { return {
// //
themeType: 'light', themeType: "light",
city: '珠海', //
cityArr: [
['北京', '上海', '天津', '重庆', '广州'],
['深圳', '河南', '辽宁', '吉林', '江苏'],
['江西', '四川', '海南', '贵州', '云南'],
['西藏', '陕西', '甘肃', '青海', '珠海']
],
userInfo: {}, // userInfo: {}, //
shoppingCart: [] // shoppingCart: [], //
}; };
}, },
computed: { computed: {
cartNum () { cartNum() {
return this.$store.state.cartNum return this.$store.state.cartNum;
} },
}, },
methods: { methods: {
changeCity (city) { // changeCity (city) { //
@ -152,67 +120,69 @@ export default {
}, },
goToPay () { // goToPay () { //
let url = this.$router.resolve({ let url = this.$router.resolve({
path: '/cart' path: "/cart",
}) });
window.open(url.href, '_blank') window.open(url.href, "_blank");
}, },
myInfo () { // myInfo() {
let url = this.$router.resolve({ let url = this.$router.resolve({
path: '/home' path: "/home",
}) });
window.open(url.href, '_blank') window.open(url.href, "_blank");
}, },
signOutFun () { // 退 signOutFun() {
storage.removeItem('accessToken'); storage.removeItem("accessToken");
storage.removeItem('refreshToken'); storage.removeItem("refreshToken");
storage.removeItem('userInfo'); storage.removeItem("userInfo");
storage.removeItem('cartNum'); storage.removeItem("cartNum");
this.$store.commit('SET_CARTNUM', 0) this.$store.commit("SET_CARTNUM", 0);
this.$router.push('/login'); this.$router.push("/login");
}, },
goUserCenter (path) { // goUserCenter(path) {
//
if (this.userInfo.username) { if (this.userInfo.username) {
this.$router.push({path: path}) this.$router.push({ path: path });
} else { } else {
this.$Modal.confirm({ this.$Modal.confirm({
title: '请登录', title: "请登录",
content: '<p>请登录后执行此操作</p>', content: "<p>请登录后执行此操作</p>",
okText: '立即登录', okText: "立即登录",
cancelText: '继续浏览', cancelText: "继续浏览",
onOk: () => { onOk: () => {
this.$router.push({ this.$router.push({
path: '/login', path: "/login",
query: { query: {
rePath: this.$router.history.current.path, rePath: this.$router.history.current.path,
query: JSON.stringify(this.$router.history.current.query) query: JSON.stringify(this.$router.history.current.query),
} },
}); });
} },
}); });
} }
}, },
shopEntry () { // shopEntry() {
if (storage.getItem('accessToken')) { //
if (storage.getItem("accessToken")) {
let routeUrl = this.$router.resolve({ let routeUrl = this.$router.resolve({
path: '/shopEntry', path: "/shopEntry",
query: {id: 1} query: { id: 1 },
}); });
window.open(routeUrl.href, '_blank'); window.open(routeUrl.href, "_blank");
} else { } else {
this.$router.push('login'); this.$router.push("login");
} }
}, },
getCartList () { // getCartList() {
//
if (this.userInfo.username) { if (this.userInfo.username) {
cartGoodsAll().then((res) => {
cartGoodsAll().then(res => { this.shoppingCart = res.result.skuList;
this.shoppingCart = res.result.skuList this.$store.commit("SET_CARTNUM", this.shoppingCart.length);
this.$store.commit('SET_CARTNUM', this.shoppingCart.length) this.Cookies.setItem("cartNum", this.shoppingCart.length);
this.Cookies.setItem('cartNum', this.shoppingCart.length) });
})
} }
} },
} },
}; };
</script> </script>
@ -253,7 +223,8 @@ export default {
margin-right: 10px; margin-right: 10px;
font-weight: bold; font-weight: bold;
} }
.nav a,.nav-item { .nav a,
.nav-item {
text-decoration: none; text-decoration: none;
padding-left: 10px; padding-left: 10px;
border-left: 1px solid #ccc; border-left: 1px solid #ccc;
@ -396,7 +367,6 @@ export default {
.sign-out p { .sign-out p {
font-size: 12px; font-size: 12px;
} }
.goods-title:hover { .goods-title:hover {
color: $theme_color; color: $theme_color;
} }

View File

@ -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
}, },
ruleInline: { // type: 1, // 1 2
receiptTitle: [{ required: true, message: '请填写公司名称' }], ruleInline: {
taxpayerId: [ taxpayerId: [
{ required: true, message: '请填写纳税人识别号' }, { required: true, message: "请填写纳税人识别号" },
{ pattern: TINumber, message: '请填写正确的纳税人识别号' } { pattern: TINumber, message: "请填写正确的纳税人识别号" },
] ],
} },
}; };
}, },
methods: { props: ["invoiceData"],
save () { // watch: {
if (this.invoiceForm.type === 1) { invoiceData: {
// handler(val) {
let flag = true; this.invoiceForm = { ...val };
this.receiptItems.forEach((e) => {
if (
e.receiptTitle === '个人' &&
e.receiptContent === this.invoiceForm.receiptContent
) {
this.$emit('change', e);
flag = false;
this.invoiceAvailable = false;
}
});
if (flag) { if (val.taxpayerId) {
let params = { this.type = 2;
receiptTitle: '个人', } else {
receiptContent: this.invoiceForm.receiptContent this.type = 1;
};
this.loading = true;
saveReceipt(params)
.then((res) => {
this.loading = false;
if (res.success) {
this.$emit('change', res.result);
this.invoiceAvailable = false;
}
})
.catch(() => {
this.loading = false;
});
} }
} else { },
// deep: true,
immeadite: true,
},
},
methods: {
/**
* 选择发票抬头
*/
changeInvoice(val) {
this.$nextTick(() => {
this.type = val;
});
},
/**
* 保存判断
*/
save() {
let flage = true;
//
const { type, receiptTitle, receiptContent } = JSON.parse(
JSON.stringify(this.invoiceForm)
);
//
if (!receiptTitle) {
this.$Message.error("请填写发票抬头!");
flage = false;
return false;
}
if (type == 2) {
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 {
saveReceipt(params)
.then((res) => {
this.loading = false;
if (res.success) {
this.$emit('change', res.result);
this.invoiceAvailable = false;
}
})
.catch(() => {
this.loading = false;
});
}
} }
}); });
} else {
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;
}
},
},
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -59,7 +59,7 @@
<div class="promotion-notice">{{shop.promotionNotice}}</div> <div class="promotion-notice">{{shop.promotionNotice}}</div>
</div> </div>
<template v-for="(goods, goodsIndex) in shop.skuList"> <template v-for="(goods, goodsIndex) in shop.skuList">
<div class="goods-item" :key="goodsIndex"> <div class="goods-item" :key="goodsIndex">
<div class="width_60"> <div class="width_60">
<Checkbox v-model="goods.checked" @on-change="changeChecked(goods.checked, 'goods', goods.goodsSku.id)"></Checkbox> <Checkbox v-model="goods.checked" @on-change="changeChecked(goods.checked, 'goods', goods.goodsSku.id)"></Checkbox>
</div> </div>
@ -93,7 +93,7 @@
</div> </div>
<div class="error-goods" v-if="goods.errorMessage"> <div class="error-goods" v-if="goods.errorMessage">
<div>{{goods.errorMessage}}</div> <div>{{goods.errorMessage}}</div>
<Button type="primary" @click="delGoods(goods.goodsSku.id)"></Button> <Button type="primary" @click="delGoods(goods.goodsSku.id)"></Button>
</div> </div>
</div> </div>
@ -117,7 +117,7 @@
已节省<span>{{ priceDetailDTO.discountPrice | unitPrice("¥") }}</span> 已节省<span>{{ priceDetailDTO.discountPrice | unitPrice("¥") }}</span>
</div> </div>
<div class="ml_20 total-price"> <div class="ml_20 total-price">
总价不含运费:<span>{{ priceDetailDTO.billPrice | unitPrice("¥") }}</span> 总价不含运费:<div>{{ priceDetailDTO.billPrice | unitPrice("¥") }}</div>
</div> </div>
<div class="pay ml_20" @click="pay"></div> <div class="pay ml_20" @click="pay"></div>
</div> </div>
@ -136,26 +136,26 @@
</template> </template>
<script> <script>
import Promotion from '@/components/goodsDetail/Promotion' import Promotion from "@/components/goodsDetail/Promotion";
import Search from '@/components/Search'; import Search from "@/components/Search";
import ShowLikeGoods from '@/components/like'; import ShowLikeGoods from "@/components/like";
import * as APICart from '@/api/cart'; import * as APICart from "@/api/cart";
import * as APIMember from '@/api/member'; import * as APIMember from "@/api/member";
import {getLogo} from '@/api/common.js' import { getLogo } from "@/api/common.js";
export default { export default {
name: 'Cart', name: "Cart",
beforeRouteEnter (to, from, next) { beforeRouteEnter(to, from, next) {
window.scrollTo(0, 0); window.scrollTo(0, 0);
next(); next();
}, },
components: { components: {
Search, Search,
ShowLikeGoods, ShowLikeGoods,
Promotion Promotion,
}, },
data () { data() {
return { return {
logoImg: '', // logo logoImg: "", // logo
couponAvailable: false, // couponAvailable: false, //
stepIndex: 0, // ==0==1==2 stepIndex: 0, // ==0==1==2
goodsTotal: 1, // goodsTotal: 1, //
@ -165,45 +165,45 @@ export default {
cartList: [], // cartList: [], //
couponList: [], // couponList: [], //
priceDetailDTO: {}, // priceDetailDTO: {}, //
skuList: [] // sku skuList: [], // sku
}; };
}, },
computed: {}, computed: {},
methods: { methods: {
// //
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 } query: { id },
}); });
window.open(routeUrl.href, '_blank'); window.open(routeUrl.href, "_blank");
}, },
// //
collectGoods (id) { collectGoods(id) {
this.$Modal.confirm({ this.$Modal.confirm({
title: '收藏', title: "收藏",
content: '<p>商品收藏后可在个人中心我的收藏查看</p>', content: "<p>商品收藏后可在个人中心我的收藏查看</p>",
onOk: () => { onOk: () => {
APIMember.collectGoods('GOODS', id).then((res) => { APIMember.collectGoods("GOODS", id).then((res) => {
if (res.success) { if (res.success) {
this.$Message.success('收藏商品成功'); this.$Message.success("收藏商品成功");
this.getCartList(); this.getCartList();
} }
}); });
}, },
onCancel: () => { } onCancel: () => {},
}); });
}, },
// //
delGoods (id) { delGoods(id) {
const idArr = []; const idArr = [];
if (!id) { if (!id) {
const list = this.cartList; const list = this.cartList;
@ -216,49 +216,50 @@ export default {
idArr.push(id); idArr.push(id);
} }
this.$Modal.confirm({ this.$Modal.confirm({
title: '删除', title: "删除",
content: '<p>确定要删除该商品吗?</p>', content: "<p>确定要删除该商品吗?</p>",
onOk: () => { onOk: () => {
APICart.delCartGoods({ skuIds: idArr.toString() }).then((res) => { APICart.delCartGoods({ skuIds: idArr.toString() }).then((res) => {
if (res.success) { if (res.success) {
this.$Message.success('删除成功'); this.$Message.success("删除成功");
this.getCartList(); this.getCartList();
} else { } else {
this.$Message.error(res.message); this.$Message.error(res.message);
} }
}); });
} },
}); });
}, },
clearCart () { // clearCart() {
//
this.$Modal.confirm({ this.$Modal.confirm({
title: '提示', title: "提示",
content: '<p>确定要清空购物车吗?清空后不可恢复</p>', content: "<p>确定要清空购物车吗?清空后不可恢复</p>",
onOk: () => { onOk: () => {
APICart.clearCart().then((res) => { APICart.clearCart().then((res) => {
if (res.success) { if (res.success) {
this.$Message.success('清空购物车成功'); this.$Message.success("清空购物车成功");
this.getCartList(); this.getCartList();
} else { } else {
this.$Message.error(res.message); this.$Message.error(res.message);
} }
}); });
} },
}); });
}, },
// //
pay () { pay() {
if (this.checkedNum) { if (this.checkedNum) {
this.$router.push({ path: '/pay', query: { way: 'CART' } }); this.$router.push({ path: "/pay", query: { way: "CART" } });
} else { } else {
this.$Message.warning('请至少选择一件商品'); this.$Message.warning("请至少选择一件商品");
} }
}, },
// //
showCoupon (storeId, index) { showCoupon(storeId, index) {
this.couponAvailable = index; this.couponAvailable = index;
}, },
changeNum (val, id) { changeNum(val, id) {
// //
console.log(val, id); console.log(val, id);
APICart.setCartGoodsNum({ skuId: id, num: val }).then((res) => { APICart.setCartGoodsNum({ skuId: id, num: val }).then((res) => {
@ -268,13 +269,13 @@ export default {
} }
}); });
}, },
async changeChecked (status, type, id) { async changeChecked(status, type, id) {
// //
const check = status ? 1 : 0; const check = status ? 1 : 0;
if (type === 'all') { if (type === "all") {
// //
await APICart.setCheckedAll({ checked: check }); await APICart.setCheckedAll({ checked: check });
} else if (type === 'shop') { } else if (type === "shop") {
// //
await APICart.setCheckedSeller({ checked: check, storeId: id }); await APICart.setCheckedSeller({ checked: check, storeId: id });
} else { } else {
@ -285,16 +286,17 @@ export default {
this.getCartList(); this.getCartList();
}, },
async receiveShopCoupon (item) { // async receiveShopCoupon(item) {
let res = await APIMember.receiveCoupon(item.id) //
let res = await APIMember.receiveCoupon(item.id);
if (res.success) { if (res.success) {
this.$set(item, 'disabled', true) this.$set(item, "disabled", true);
this.$Message.success('领取成功') this.$Message.success("领取成功");
} else { } else {
this.$Message.error(res.message) this.$Message.error(res.message);
} }
}, },
async getCartList () { async getCartList() {
// //
this.loading = true; this.loading = true;
try { try {
@ -307,9 +309,9 @@ export default {
this.checkedNum = 0; this.checkedNum = 0;
let allChecked = true; let allChecked = true;
for (let k = 0; k < this.cartList.length; k++) { for (let k = 0; k < this.cartList.length; k++) {
let shop = this.cartList[k] let shop = this.cartList[k];
let list = await APIMember.couponList({storeId: shop.storeId}) let list = await APIMember.couponList({ storeId: shop.storeId });
shop.couponList.push(...list.result.records) shop.couponList.push(...list.result.records);
} }
for (let i = 0; i < this.skuList.length; i++) { for (let i = 0; i < this.skuList.length; i++) {
if (this.skuList[i].checked) { if (this.skuList[i].checked) {
@ -318,30 +320,31 @@ export default {
allChecked = false; allChecked = false;
} }
} }
this.$forceUpdate() this.$forceUpdate();
this.allChecked = allChecked; this.allChecked = allChecked;
} }
} catch (error) { } catch (error) {
this.loading = false; this.loading = false;
} }
} },
}, },
mounted () { mounted() {
this.getCartList(); this.getCartList();
APICart.cartCount().then(res => { // APICart.cartCount().then((res) => {
//
if (res.success) this.goodsTotal = res.result; if (res.success) this.goodsTotal = res.result;
}); });
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");
} }
} },
}; };
</script> </script>
@ -544,7 +547,7 @@ export default {
width: 70px; width: 70px;
height: 70px; height: 70px;
} }
>div>p { > div > p {
@include content_color($light_content_color); @include content_color($light_content_color);
font-size: 13px; font-size: 13px;
text-align: left; text-align: left;
@ -567,12 +570,12 @@ export default {
} }
} }
} }
.error-goods{ .error-goods {
position: absolute; position: absolute;
width: 100%; width: 100%;
height: 100%; height: 100%;
margin-left: -20px; margin-left: -20px;
background-color: rgba($color: #999, $alpha: .5); background-color: rgba($color: #999, $alpha: 0.5);
z-index: 10; z-index: 10;
display: flex; display: flex;
align-items: center; align-items: center;
@ -603,7 +606,7 @@ export default {
.save-price span { .save-price span {
color: #000; color: #000;
} }
.total-price span { .total-price div {
color: $theme_color; color: $theme_color;
font-size: 20px; font-size: 20px;
} }
@ -651,23 +654,31 @@ export default {
display: flex; display: flex;
margin-top: 5px; margin-top: 5px;
margin-left: 5px; margin-left: 5px;
>span{ > span {
border: 1px solid $theme_color; border: 1px solid $theme_color;
color: $theme_color; color: $theme_color;
font-size: 12px; font-size: 12px;
border-radius: 2px; border-radius: 2px;
padding: 0 2px; padding: 0 2px;
} }
>p{ > p {
font-size: 12px; font-size: 12px;
margin-left: 10px; margin-left: 10px;
color: #999; color: #999;
} }
} }
.cart-goods-footer > div{
display: flex;
align-items: center;
overflow: hidden;
}
.total-price{
display: flex;
align-items: center;
}
</style> </style>
<style> <style>
.ivu-input-number-input { .ivu-input-number-input {
text-align: center; text-align: center;
} }
</style> </style>

File diff suppressed because it is too large Load Diff

View File

@ -9,23 +9,11 @@
<Step title="其他信息"></Step> <Step title="其他信息"></Step>
<Step title="提交审核"></Step> <Step title="提交审核"></Step>
</Steps> </Steps>
<first-apply <first-apply v-if="currentIndex == 0 && dataReview" :content="firstData" @change="nextPage"></first-apply>
v-if="currentIndex == 0 && dataReview"
:content="firstData"
@change="nextPage"
></first-apply>
<second-apply <second-apply v-if="currentIndex == 1 && dataReview" :content="secondData" @change="nextPage"></second-apply>
v-if="currentIndex == 1 && dataReview"
:content="secondData"
@change="nextPage"
></second-apply>
<third-apply <third-apply v-if="currentIndex == 2 && dataReview" :content="thirdData" @change="nextPage"></third-apply>
v-if="currentIndex == 2 && dataReview"
:content="thirdData"
@change="nextPage"
></third-apply>
<div class="success-page" v-if="currentIndex == 3"> <div class="success-page" v-if="currentIndex == 3">
<span v-if="storeDisable == '' || storeDisable == 'APPLYING'"></span> <span v-if="storeDisable == '' || storeDisable == 'APPLYING'"></span>
@ -37,62 +25,51 @@
<Button type="primary" @click='currentIndex = 0' v-if="storeDisable === 'REFUSED' && currentIndex === 3"></Button> <Button type="primary" @click='currentIndex = 0' v-if="storeDisable === 'REFUSED' && currentIndex === 3"></Button>
</div> </div>
<Modal <Modal title="店铺入驻协议" v-model="showAgreement" width="1200" :closable="false" :mask-closable="false">
title="店铺入驻协议"
v-model="showAgreement"
width="1200"
:closable="false"
:mask-closable="false"
>
<div class="agreeent-con" v-html="agreementCon"></div> <div class="agreeent-con" v-html="agreementCon"></div>
<div slot="footer" style="text-align: center"> <div slot="footer" style="text-align: center">
<p><Checkbox v-model="checked"></Checkbox></p> <p>
<Button <Checkbox v-model="checked"></Checkbox>
type="primary" </p>
:disabled="!checked" <Button type="primary" :disabled="!checked" class="margin" @click="showAgreement = false">同意协议填写资质信息</Button>
class="margin"
@click="showAgreement = false"
>同意协议填写资质信息</Button
>
</div> </div>
</Modal> </Modal>
</div> </div>
</template> </template>
<script> <script>
import { agreement, applyStatus } from '@/api/shopentry'; import { agreement, applyStatus } from "@/api/shopentry";
import firstApply from './first-apply'; import firstApply from "./first-apply";
import secondApply from './second-apply'; import secondApply from "./second-apply";
import thirdApply from './third-apply'; import thirdApply from "./third-apply";
export default { export default {
components: { components: {
firstApply, firstApply,
secondApply, secondApply,
thirdApply thirdApply,
}, },
data () { data() {
return { return {
currentIndex: 0, // currentIndex: 0, //
showAgreement: false, // showAgreement: false, //
agreementCon: '', // agreementCon: "", //
checked: false, // checked: false, //
applyData: {}, // applyData: {}, //
firstData: {}, // firstData: {}, //
secondData: {}, // secondData: {}, //
thirdData: {}, // thirdData: {}, //
storeDisable: '', // APPLY OPEN CLOSED REFUSED APPLYING storeDisable: "", // APPLY OPEN CLOSED REFUSED APPLYING
dataReview: true // dataReview: true, //
}; };
}, },
methods: { methods: {
getArticle () { getArticle() {
// //
agreement().then((res) => { agreement().then((res) => {
console.log(res); this.agreementCon = res.result.content;
this.agreementCon = res.result;
}); });
}, },
getData () { getData() {
applyStatus().then((res) => { applyStatus().then((res) => {
if (res.success) { if (res.success) {
if (!res.result) { if (!res.result) {
@ -101,34 +78,34 @@ export default {
this.dataReview = false; this.dataReview = false;
let data = res.result; let data = res.result;
let first = [ let first = [
'addressIdPath', "addressIdPath",
'addressPath', "addressPath",
'companyAddress', "companyAddress",
'companyEmail', "companyEmail",
'companyName', "companyName",
'employeeNum', "employeeNum",
'legalId', "legalId",
'legalName', "legalName",
'licencePhoto', "licencePhoto",
'legalPhoto', "legalPhoto",
'licenseNum', "licenseNum",
'linkName', "linkName",
'linkPhone', "linkPhone",
'registeredCapital', "registeredCapital",
'scope' "scope",
]; ];
let second = [ let second = [
'settlementBankAccountName', "settlementBankAccountName",
'settlementBankAccountNum', "settlementBankAccountNum",
'settlementBankBranchName', "settlementBankBranchName",
'settlementBankJointName' "settlementBankJointName",
]; ];
let third = [ let third = [
'goodsManagementCategory', "goodsManagementCategory",
'storeCenter', "storeCenter",
'storeDesc', "storeDesc",
'storeLogo', "storeLogo",
'storeName' "storeName",
]; ];
this.storeDisable = data.storeDisable; this.storeDisable = data.storeDisable;
@ -143,7 +120,7 @@ export default {
this.thirdData[e] = data[e]; this.thirdData[e] = data[e];
}); });
if (this.storeDisable === 'APPLY') { if (this.storeDisable === "APPLY") {
this.currentIndex = 0; this.currentIndex = 0;
} else { } else {
this.currentIndex = 3; this.currentIndex = 3;
@ -154,13 +131,14 @@ export default {
} }
}); });
}, },
nextPage (step) { nextPage(step) {
this.currentIndex = step; this.currentIndex = step;
} },
}, },
mounted () { mounted() {
this.getData(); this.getData();
} this.getArticle();
},
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -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)

View File

@ -21,10 +21,11 @@ export default {
// 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.109:8890', common: "http://192.168.0.109:8890",
buyer: 'http://192.168.0.109:8888', buyer: "http://192.168.0.109:8888",
seller: 'http://192.168.0.109:8889', seller: "http://192.168.0.109:8889",
manager: 'http://192.168.0.109:8887' manager: "http://192.168.0.109:8887"
}, },
api_prod: { api_prod: {
common: "https://common-api.pickmall.cn", common: "https://common-api.pickmall.cn",

View File

@ -1,25 +1,13 @@
<style lang="scss"> <style lang="scss">
@import "@/styles/table-common.scss"; @import "@/styles/table-common.scss";
</style> </style>
<template> <template>
<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,370 +16,375 @@
<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 {
import uploadPicInput from "@/views/my-components/lili/upload-pic-input"; getManagerBrandPage,
addBrand,
updateBrand,
disableBrand,
delBrand,
} from "@/api/goods";
import uploadPicInput from "@/views/my-components/lili/upload-pic-input";
export default { export default {
name: "brand", name: "brand",
components: { components: {
uploadPicInput, uploadPicInput,
}, },
data() { data() {
return { return {
loading: true, // loading: true, //
modalType: 0, // modalType: 0, //
modalVisible: false, // modalVisible: false, //
modalTitle: "", // modalTitle: "", //
searchForm: { searchForm: {
// //
pageNumber: 1, // pageNumber: 1, //
pageSize: 10, // pageSize: 10, //
sort: "create_time", // sort: "create_time", //
order: "desc", // order: "desc", //
},
form: {
//
name: "",
logo: "",
deleteFlag: "",
},
//
formValidate: {},
submitLoading: false, //
selectList: [], //
selectCount: 0, //
columns: [
{
title: "品牌名称",
key: "name",
width: 200,
resizable: true,
sortable: false,
}, },
form: { {
// title: "品牌图标",
name: "", key: "logo",
logo: "", align: "left",
deleteFlag: "", render: (h, params) => {
return h("img", {
attrs: {
src: params.row.logo,
alt: "加载图片失败",
},
style: {
cursor: "pointer",
width: "80px",
height: "60px",
margin: "10px 0",
"object-fit": "contain",
},
});
},
}, },
// {
formValidate: {}, title: "状态",
submitLoading: false, // key: "deleteFlag",
selectList: [], // align: "left",
selectCount: 0, // render: (h, params) => {
columns: [ if (params.row.deleteFlag == 0) {
{
title: "品牌名称",
key: "name",
width: 200,
resizable: true,
sortable: false,
},
{
title: "品牌图标",
key: "logo",
align: "left",
render: (h, params) => {
return h("img", {
attrs: {
src: params.row.logo,
alt: "加载图片失败",
},
style: {
cursor: "pointer",
width: "80px",
height: "60px",
margin: "10px 0",
"object-fit": "contain",
},
});
},
},
{
title: "状态",
key: "deleteFlag",
align: "left",
render: (h, params) => {
if (params.row.deleteFlag == 0) {
return h("div", [
h("Badge", {
props: {
status: "success",
text: "启用",
},
}),
]);
} else if (params.row.deleteFlag == 1) {
return h("div", [
h("Badge", {
props: {
status: "error",
text: "禁用",
},
}),
]);
}
},
filters: [
{
label: "启用",
value: 0,
},
{
label: "禁用",
value: 1,
},
],
filterMultiple: false,
filterMethod(value, row) {
if (value == 0) {
return row.deleteFlag == 0;
} else if (value == 1) {
return row.deleteFlag == 1;
}
},
},
{
title: "操作",
key: "action",
width: 180,
align: "center",
fixed: "right",
render: (h, params) => {
let enableOrDisable = "";
if (params.row.deleteFlag == 0) {
enableOrDisable = h(
"Button",
{
props: {
size: "small",
type: "error",
},
style: {
marginRight: "5px",
},
on: {
click: () => {
this.disable(params.row);
},
},
},
"禁用"
);
} else {
enableOrDisable = h(
"Button",
{
props: {
type: "success",
size: "small",
},
style: {
marginRight: "5px",
},
on: {
click: () => {
this.enable(params.row);
},
},
},
"启用"
);
}
return h("div", [ return h("div", [
h( h("Badge", {
"Button", props: {
{ status: "success",
props: { text: "启用",
type: "info", },
size: "small", }),
}, ]);
style: { } else if (params.row.deleteFlag == 1) {
marginRight: "5px", return h("div", [
}, h("Badge", {
on: { props: {
click: () => { status: "error",
this.edit(params.row); text: "禁用",
}, },
}),
]);
}
},
filters: [
{
label: "启用",
value: 0,
},
{
label: "禁用",
value: 1,
},
],
filterMultiple: false,
filterMethod(value, row) {
if (value == 0) {
return row.deleteFlag == 0;
} else if (value == 1) {
return row.deleteFlag == 1;
}
},
},
{
title: "操作",
key: "action",
width: 180,
align: "center",
fixed: "right",
render: (h, params) => {
let enableOrDisable = "";
if (params.row.deleteFlag == 0) {
enableOrDisable = h(
"Button",
{
props: {
size: "small",
type: "error",
},
style: {
marginRight: "5px",
},
on: {
click: () => {
this.disable(params.row);
}, },
}, },
"编辑" },
), "禁用"
enableOrDisable, );
]);
},
},
],
data: [], //
total: 0, //
};
},
methods: {
init() {
this.getDataList();
},
changePage(v) {
this.searchForm.pageNumber = v;
this.getDataList();
this.clearSelectAll();
},
changePageSize(v) {
this.searchForm.pageSize = v;
this.getDataList();
},
handleSearch() {
this.searchForm.pageNumber = 1;
this.searchForm.pageSize = 10;
this.getDataList();
},
changeSort(e) {
this.searchForm.sort = e.key;
this.searchForm.order = e.order;
if (e.order === "normal") {
this.searchForm.order = "";
}
this.getDataList();
},
clearSelectAll() {
this.$refs.table.selectAll(false);
},
changeSelect(e) {
this.selectList = e;
this.selectCount = e.length;
},
getDataList() {
this.loading = true;
//
getManagerBrandPage(this.searchForm).then((res) => {
this.loading = false;
if (res.success) {
console.warn(12)
this.data = res.result.records;
this.total = res.result.total;
}
});
},
handleSubmit() {
this.$refs.form.validate((valid) => {
if (valid) {
this.submitLoading = true;
if (this.modalType === 0) {
// id
delete this.form.id;
addBrand(this.form).then((res) => {
this.submitLoading = false;
if (res.success) {
this.$Message.success("操作成功");
this.getDataList();
this.modalVisible = false;
}
});
} else { } else {
// enableOrDisable = h(
updateBrand(this.form).then((res) => { "Button",
this.submitLoading = false; {
if (res.success) { props: {
this.$Message.success("操作成功"); type: "success",
this.getDataList(); size: "small",
this.modalVisible = false; },
} style: {
}); marginRight: "5px",
},
on: {
click: () => {
this.enable(params.row);
},
},
},
"启用"
);
} }
} return h("div", [
}); h(
}, "Button",
add() { {
this.modalType = 0; props: {
this.modalTitle = "添加"; type: "info",
this.$refs.form.resetFields(); size: "small",
delete this.form.id; },
this.modalVisible = true; style: {
}, marginRight: "5px",
edit(v) { },
this.modalType = 1; on: {
this.modalTitle = "编辑"; click: () => {
this.$refs.form.resetFields(); this.edit(params.row);
// null"" },
for (let attr in v) { },
if (v[attr] === null) { },
v[attr] = ""; "编辑"
),
enableOrDisable,
h(
"Button",
{
props: {
size: "small",
},
style: {
marginRight: "5px",
},
on: {
click: () => {
this.delBrand(params.row.id);
},
},
},
"删除"
),
]);
},
},
],
data: [], //
total: 0, //
};
},
methods: {
//
async delBrand(id) {
let res = await delBrand(id);
if (res.success) {
this.$Message.success("品牌删除成功!");
this.getDataList();
}
},
init() {
this.getDataList();
},
changePage(v) {
this.searchForm.pageNumber = v;
this.getDataList();
this.clearSelectAll();
},
changePageSize(v) {
this.searchForm.pageSize = v;
this.getDataList();
},
handleSearch() {
this.searchForm.pageNumber = 1;
this.searchForm.pageSize = 10;
this.getDataList();
},
changeSort(e) {
this.searchForm.sort = e.key;
this.searchForm.order = e.order;
if (e.order === "normal") {
this.searchForm.order = "";
}
this.getDataList();
},
clearSelectAll() {
this.$refs.table.selectAll(false);
},
changeSelect(e) {
this.selectList = e;
this.selectCount = e.length;
},
getDataList() {
this.loading = true;
//
getManagerBrandPage(this.searchForm).then((res) => {
this.loading = false;
if (res.success) {
console.warn(12);
this.data = res.result.records;
this.total = res.result.total;
}
});
},
handleSubmit() {
this.$refs.form.validate((valid) => {
if (valid) {
this.submitLoading = true;
if (this.modalType === 0) {
// id
delete this.form.id;
addBrand(this.form).then((res) => {
this.submitLoading = false;
if (res.success) {
this.$Message.success("操作成功");
this.getDataList();
this.modalVisible = false;
}
});
} else {
//
updateBrand(this.form).then((res) => {
this.submitLoading = false;
if (res.success) {
this.$Message.success("操作成功");
this.getDataList();
this.modalVisible = false;
}
});
} }
} }
let str = JSON.stringify(v); });
let data = JSON.parse(str);
this.form = data;
this.modalVisible = true;
},
enable(v) {
this.$Modal.confirm({
title: "确认启用",
content: "您确认要启用品牌 " + v.name + " ?",
loading: true,
onOk: () => {
disableBrand(v.id, {disable: false}).then((res) => {
this.$Modal.remove();
if (res.success) {
this.$Message.success("操作成功");
this.getDataList();
}
});
},
});
},
disable(v) {
this.$Modal.confirm({
title: "确认禁用",
content: "您确认要禁用品牌 " + v.name + " ?",
loading: true,
onOk: () => {
disableBrand(v.id, {disable: true}).then((res) => {
this.$Modal.remove();
if (res.success) {
this.$Message.success("操作成功");
this.getDataList();
}
});
},
});
},
}, },
mounted() { add() {
this.init(); this.modalType = 0;
this.modalTitle = "添加";
this.$refs.form.resetFields();
delete this.form.id;
this.modalVisible = true;
}, },
}; edit(v) {
this.modalType = 1;
this.modalTitle = "编辑";
this.$refs.form.resetFields();
// null""
for (let attr in v) {
if (v[attr] === null) {
v[attr] = "";
}
}
let str = JSON.stringify(v);
let data = JSON.parse(str);
this.form = data;
this.modalVisible = true;
},
enable(v) {
this.$Modal.confirm({
title: "确认启用",
content: "您确认要启用品牌 " + v.name + " ?",
loading: true,
onOk: () => {
disableBrand(v.id, { disable: false }).then((res) => {
this.$Modal.remove();
if (res.success) {
this.$Message.success("操作成功");
this.getDataList();
}
});
},
});
},
disable(v) {
this.$Modal.confirm({
title: "确认禁用",
content: "您确认要禁用品牌 " + v.name + " ?",
loading: true,
onOk: () => {
disableBrand(v.id, { disable: true }).then((res) => {
this.$Modal.remove();
if (res.success) {
this.$Message.success("操作成功");
this.getDataList();
}
});
},
});
},
},
mounted() {
this.init();
},
};
</script> </script>

View File

@ -11,7 +11,7 @@
<tree-table ref="treeTable" size="default" :loading="loading" :data="tableData" :columns="columns" :border="true" :show-index="false" :is-fold="true" :expand-type="false" primary-key="id"> <tree-table ref="treeTable" size="default" :loading="loading" :data="tableData" :columns="columns" :border="true" :show-index="false" :is-fold="true" :expand-type="false" primary-key="id">
<template slot="action" slot-scope="scope"> <template slot="action" slot-scope="scope">
<Dropdown v-show="scope.row.level == 2" transfer="true" trigger="click"> <Dropdown v-show="scope.row.level == 2" transfer="true" trigger="click">
<Button size="small"> <Button size="small">
绑定 绑定
<Icon type="ios-arrow-down"></Icon> <Icon type="ios-arrow-down"></Icon>
@ -106,7 +106,7 @@
<Modal :title="modalSpecTitle" v-model="modalSpecVisible" :mask-closable="false" :width="500"> <Modal :title="modalSpecTitle" v-model="modalSpecVisible" :mask-closable="false" :width="500">
<Form ref="specForm" :model="specForm" :label-width="100"> <Form ref="specForm" :model="specForm" :label-width="100">
<Select v-model="specForm.category_specs" multiple> <Select v-model="specForm.categorySpecs" multiple>
<Option v-for="item in specifications" :value="item.id" :key="item.id" :label="item.specName"> <Option v-for="item in specifications" :value="item.id" :key="item.id" :label="item.specName">
</Option> </Option>
</Select> </Select>
@ -134,7 +134,6 @@ import {
} from "@/api/goods"; } from "@/api/goods";
import TreeTable from "@/views/my-components/tree-table/Table/Table"; import TreeTable from "@/views/my-components/tree-table/Table/Table";
import uploadPicInput from "@/views/my-components/lili/upload-pic-input"; import uploadPicInput from "@/views/my-components/lili/upload-pic-input";
import * as filters from "@/utils/filters";
export default { export default {
name: "lili-components", name: "lili-components",
@ -153,7 +152,7 @@ export default {
specifications: [], // specifications: [], //
categoryId: "", // id categoryId: "", // id
category_brands: [], // category_brands: [], //
category_specs: [], // categorySpecs: [], //
expandLevel: 1, // expandLevel: 1, //
modalType: 0, // modalType: 0, //
modalVisible: false, // modalVisible: false, //
@ -212,13 +211,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) => {
return item.name == val; if (item.name == val) {
this.categoryIndex = index;
console.log((this.categoryIndex = index));
return item.name == val;
}
}); });
this.tableData = [way]; this.tableData = [way];
}, },
@ -236,7 +239,8 @@ export default {
// //
getSpecList() { getSpecList() {
getSpecificationList().then((res) => { getSpecificationList().then((res) => {
if (res.success) { if (res.length != 0) {
this.specifications = res; this.specifications = res;
} }
}); });
@ -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);
@ -257,7 +261,8 @@ export default {
getCategorySpecListData(v.id).then((res) => { getCategorySpecListData(v.id).then((res) => {
this.categoryId = v.id; this.categoryId = v.id;
this.modalSpecTitle = "规格关联"; this.modalSpecTitle = "规格关联";
this.specForm.category_specs = res.map((item) => item.id); console.log(res);
this.specForm.categorySpecs = res.map((item) => item.id);
this.modalSpecVisible = true; this.modalSpecVisible = true;
}); });
}, },
@ -337,7 +342,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 +353,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 +381,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 +393,13 @@ 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]]);
});
} }
}); });
}, },
@ -508,22 +459,8 @@ export default {
background: #fff; background: #fff;
padding: 20px; padding: 20px;
} }
.article {
font-size: 16px;
font-weight: 400;
margin: 12px 0;
}
.href-text {
font-size: 12px;
}
.operation { .operation {
margin-bottom: 2vh; margin-bottom: 2vh;
} }
.select-count {
font-weight: 600;
color: #40a9ff;
}
</style> </style>