diff --git a/buyer/src/config/index.js b/buyer/src/config/index.js index 7569684e..a939cf11 100644 --- a/buyer/src/config/index.js +++ b/buyer/src/config/index.js @@ -8,5 +8,5 @@ module.exports = { icpMessage: "京ICP备20009696号-1", //icp备案 aMapKey: "b440952723253aa9fe483e698057bf7d", //高德web端申请的api key enableCDN: true, //生产环境 是否启用cdn加载 vue等js - port:10000, //端口 + port: 10000, //端口 }; diff --git a/buyer/src/pages/article/detail.vue b/buyer/src/pages/article/detail.vue new file mode 100644 index 00000000..0f221c52 --- /dev/null +++ b/buyer/src/pages/article/detail.vue @@ -0,0 +1,88 @@ + + + + + + {{ detail.title }} + + + + + + + + + diff --git a/buyer/src/router/index.js b/buyer/src/router/index.js index 9a68e027..80251a22 100644 --- a/buyer/src/router/index.js +++ b/buyer/src/router/index.js @@ -1,344 +1,383 @@ -import Vue from 'vue'; -import Router from 'vue-router'; -import Index from '@/pages/Index'; -const Login = resolve => require(['@/pages/Login'], resolve); -const SignUp = resolve => require(['@/pages/SignUp'], resolve); -const ForgetPassword = resolve => require(['@/pages/ForgetPassword'], resolve); -const GoodsList = resolve => require(['@/pages/GoodsList'], resolve); -const GoodsDetail = resolve => require(['@/pages/GoodsDetail'], resolve); -const PointGoodsDetail = resolve => require(['@/pages/promotion/PointGoodsDetail'], resolve); -const ShoppingCart = resolve => require(['@/pages/ShoppingCart'], resolve); -const Cart = resolve => require(['@/pages/Cart'], resolve); -const Pay = resolve => require(['@/pages/payment/Pay'], resolve); -const PayDone = resolve => require(['@/pages/payment/PayDone'], resolve); -const PayMent = resolve => require(['@/pages/payment/PayMent'], resolve); -const ThirdPay = resolve => require(['@/pages/payment/ThirdPay'], resolve); -const Coupon = resolve => require(['@/pages/CouponCenter'], resolve); -const seckill = resolve => require(['@/pages/promotion/seckill'], resolve); -const article = resolve => require(['@/pages/article/index'], resolve); -const PointMall = resolve => require(['@/pages/promotion/PointMall'], resolve); +import Vue from "vue"; +import Router from "vue-router"; +import Index from "@/pages/Index"; +const Login = (resolve) => require(["@/pages/Login"], resolve); +const SignUp = (resolve) => require(["@/pages/SignUp"], resolve); +const ForgetPassword = (resolve) => + require(["@/pages/ForgetPassword"], resolve); +const GoodsList = (resolve) => require(["@/pages/GoodsList"], resolve); +const GoodsDetail = (resolve) => require(["@/pages/GoodsDetail"], resolve); +const PointGoodsDetail = (resolve) => + require(["@/pages/promotion/PointGoodsDetail"], resolve); +const ShoppingCart = (resolve) => require(["@/pages/ShoppingCart"], resolve); +const Cart = (resolve) => require(["@/pages/Cart"], resolve); +const Pay = (resolve) => require(["@/pages/payment/Pay"], resolve); +const PayDone = (resolve) => require(["@/pages/payment/PayDone"], resolve); +const PayMent = (resolve) => require(["@/pages/payment/PayMent"], resolve); +const ThirdPay = (resolve) => require(["@/pages/payment/ThirdPay"], resolve); +const Coupon = (resolve) => require(["@/pages/CouponCenter"], resolve); +const seckill = (resolve) => require(["@/pages/promotion/seckill"], resolve); +const article = (resolve) => require(["@/pages/article/index"], resolve); +const articleDetail = (resolve) => require(["@/pages/article/detail"], resolve); +const PointMall = (resolve) => + require(["@/pages/promotion/PointMall"], resolve); /* * 会员中心 * 订单列表 */ -const MyOrder = resolve => require([`@/pages/home/orderCenter/MyOrder`], resolve); -const OrderDetail = resolve => require([`@/pages/home/orderCenter/OrderDetail`], resolve); -const MyAddress = resolve => require(['@/pages/home/orderCenter/MyAddress'], resolve); -const AddAddress = resolve => require(['@/pages/home/orderCenter/AddAddress'], resolve); -const Complain = resolve => require(['@/pages/home/orderCenter/Complain'], resolve); -const AfterSale = resolve => require(['@/pages/home/orderCenter/AfterSale'], resolve); -const AfterSaleDetail = resolve => require(['@/pages/home/orderCenter/AfterSaleDetail'], resolve); -const ApplyAfterSale = resolve => require(['@/pages/home/orderCenter/ApplyAfterSale'], resolve); +const MyOrder = (resolve) => + require([`@/pages/home/orderCenter/MyOrder`], resolve); +const OrderDetail = (resolve) => + require([`@/pages/home/orderCenter/OrderDetail`], resolve); +const MyAddress = (resolve) => + require(["@/pages/home/orderCenter/MyAddress"], resolve); +const AddAddress = (resolve) => + require(["@/pages/home/orderCenter/AddAddress"], resolve); +const Complain = (resolve) => + require(["@/pages/home/orderCenter/Complain"], resolve); +const AfterSale = (resolve) => + require(["@/pages/home/orderCenter/AfterSale"], resolve); +const AfterSaleDetail = (resolve) => + require(["@/pages/home/orderCenter/AfterSaleDetail"], resolve); +const ApplyAfterSale = (resolve) => + require(["@/pages/home/orderCenter/ApplyAfterSale"], resolve); /* * 会员中心 */ -const Profile = resolve => require(['@/pages/home/memberCenter/Profile'], resolve); -const AccountSafe = resolve => require(['@/pages/home/memberCenter/AccountSafe'], resolve); -const ModifyPwd = resolve => require(['@/pages/home/memberCenter/ModifyPwd'], resolve); -const Favorites = resolve => require(['@/pages/home/memberCenter/Favorites'], resolve); -const Distribution = resolve => require(['@/pages/home/memberCenter/Distribution'], resolve); -const CommentList = resolve => require(['@/pages/home/memberCenter/CommentList'], resolve); // 评价列表 -const AddEval = resolve => require(['@/pages/home/memberCenter/evaluation/AddEval'], resolve); // 添加评价 -const EvalDetail = resolve => require(['@/pages/home/memberCenter/evaluation/EvalDetail'], resolve); -const ComplainList = resolve => require(['@/pages/home/memberCenter/ComplainList'], resolve); -const ComplainDetail = resolve => require(['@/pages/home/memberCenter/ComplainDetail'], resolve); -const Point = resolve => require(['@/pages/home/memberCenter/Point'], resolve); -const MsgList = resolve => require(['@/pages/home/memberCenter/memberMsg/MsgList'], resolve); -const MsgDetail = resolve => require(['@/pages/home/memberCenter/memberMsg/MsgDetail'], resolve); +const Profile = (resolve) => + require(["@/pages/home/memberCenter/Profile"], resolve); +const AccountSafe = (resolve) => + require(["@/pages/home/memberCenter/AccountSafe"], resolve); +const ModifyPwd = (resolve) => + require(["@/pages/home/memberCenter/ModifyPwd"], resolve); +const Favorites = (resolve) => + require(["@/pages/home/memberCenter/Favorites"], resolve); +const Distribution = (resolve) => + require(["@/pages/home/memberCenter/Distribution"], resolve); +const CommentList = (resolve) => + require(["@/pages/home/memberCenter/CommentList"], resolve); // 评价列表 +const AddEval = (resolve) => + require(["@/pages/home/memberCenter/evaluation/AddEval"], resolve); // 添加评价 +const EvalDetail = (resolve) => + require(["@/pages/home/memberCenter/evaluation/EvalDetail"], resolve); +const ComplainList = (resolve) => + require(["@/pages/home/memberCenter/ComplainList"], resolve); +const ComplainDetail = (resolve) => + require(["@/pages/home/memberCenter/ComplainDetail"], resolve); +const Point = (resolve) => + require(["@/pages/home/memberCenter/Point"], resolve); +const MsgList = (resolve) => + require(["@/pages/home/memberCenter/memberMsg/MsgList"], resolve); +const MsgDetail = (resolve) => + require(["@/pages/home/memberCenter/memberMsg/MsgDetail"], resolve); /* * 会员中心 * 账户中心 * */ -const Coupons = resolve => require(['@/pages/home/userCenter/Coupons'], resolve); -const MyTracks = resolve => require(['@/pages/home/userCenter/MyTracks'], resolve); -const MoneyManagement = resolve => require(['@/pages/home/userCenter/MoneyManagement'], resolve); +const Coupons = (resolve) => + require(["@/pages/home/userCenter/Coupons"], resolve); +const MyTracks = (resolve) => + require(["@/pages/home/userCenter/MyTracks"], resolve); +const MoneyManagement = (resolve) => + require(["@/pages/home/userCenter/MoneyManagement"], resolve); -const Home = resolve => require(['@/pages/user/Home'], resolve); +const Home = (resolve) => require(["@/pages/user/Home"], resolve); -const Merchant = resolve => require(['@/pages/Merchant'], resolve); -const UserMain = resolve => require(['@/pages/home/Main'], resolve); +const Merchant = (resolve) => require(["@/pages/Merchant"], resolve); +const UserMain = (resolve) => require(["@/pages/home/Main"], resolve); /** * 店铺入驻 */ -const ShopEntry = resolve => require(['@/pages/shopEntry/ShopEntry'], resolve); +const ShopEntry = (resolve) => + require(["@/pages/shopEntry/ShopEntry"], resolve); Vue.use(Router); export default new Router({ - mode: 'history', - routes: [{ - path: '/', // 首页 - name: 'Index', - component: Index - }, - { - path: '/login', // 登陆 - name: 'login', - component: Login, - meta: { - title: '登录' - } - }, - { - path: '/SignUp', // 注册 - name: 'SignUp', - component: SignUp, - meta: { - title: '注册' - } - }, - { - path: '/forgetPassword', // 忘记密码 - name: 'forgetPassword', - component: ForgetPassword, - meta: { - title: '忘记密码' - } - }, - { - path: '/goodsList', // 商品列表 - name: 'GoodsList', - component: GoodsList - }, - { - path: '/goodsDetail', // 商品详情 - name: 'GoodsDetail', - component: GoodsDetail, - meta: {title: '商品详情'} - }, - { - path: '/pointGoodsDetail', // 商品详情 - name: 'PointGoodsDetail', - component: PointGoodsDetail, - meta: {title: '积分商品'} - }, - { - path: '/shoppingCart', // 头部购物车 - name: 'ShoppingCart', - component: ShoppingCart - }, - { - path: '/cart', // 购物车 - name: 'Cart', - component: Cart, - meta: {title: '购物车'} - }, - { - path: '/pay', // 支付页面 - name: 'Pay', - component: Pay, - meta: {title: '订单结算'} - }, - { - path: '/payMent', - name: 'PayMent', - component: PayMent - }, - { - path: '/PointMall', - name: 'PointMall', - component: PointMall, - meta: {title: '积分商城'} - }, - { - path: '/qrpay', // 三方支付 - name: 'qrpay', - component: ThirdPay - }, - { - path: '/payDone', // 支付成功页面 - name: 'PayDone', - component: PayDone - }, - { - path: '/article', // 文章页面 - name: 'article', - component: article, - meta: { - title: '帮助中心' - } - }, - { - path: '/shopEntry', - name: 'shopEntry', - component: ShopEntry, - meta: { - title: '店铺入驻' - } - }, - { - path: '/coupon', - name: 'coupon', - component: Coupon, - meta: { - title: '领券中心' - } - }, - { - path: '/seckill', - name: 'seckill', - component: seckill, - meta: { - title: '限时秒杀' - } - }, - { - path: '/home', // 主页 - component: Home, - children: [{ - path: '/', - name: 'Home', - component: UserMain, + mode: "history", + routes: [ + { + path: "/", // 首页 + name: "Index", + component: Index, + }, + { + path: "/login", // 登陆 + name: "login", + component: Login, meta: { - title: '会员中心' - } + title: "登录", + }, }, { - path: 'MyTracks', - name: 'MyTracks', - component: MyTracks, - meta: {title: '我的足迹'} + path: "/SignUp", // 注册 + name: "SignUp", + component: SignUp, + meta: { + title: "注册", + }, }, { - path: 'MoneyManagement', - name: 'MoneyManagement', - component: MoneyManagement + path: "/forgetPassword", // 忘记密码 + name: "forgetPassword", + component: ForgetPassword, + meta: { + title: "忘记密码", + }, }, { - path: 'Complain', - name: 'Complain', - component: Complain + path: "/goodsList", // 商品列表 + name: "GoodsList", + component: GoodsList, }, { - path: 'Coupons', - name: 'Coupons', - component: Coupons + path: "/goodsDetail", // 商品详情 + name: "GoodsDetail", + component: GoodsDetail, + meta: { title: "商品详情" }, }, { - path: 'CommentList', - name: 'CommentList', - component: CommentList, - mate: {title: '评价列表'} + path: "/pointGoodsDetail", // 商品详情 + name: "PointGoodsDetail", + component: PointGoodsDetail, + meta: { title: "积分商品" }, }, { - path: 'AddEval', - name: 'AddEval', - component: AddEval, - mate: {title: '添加评价'} + path: "/shoppingCart", // 头部购物车 + name: "ShoppingCart", + component: ShoppingCart, }, { - path: 'EvalDetail', - name: 'EvalDetail', - component: EvalDetail, - mate: {title: '评价详情'} + path: "/cart", // 购物车 + name: "Cart", + component: Cart, + meta: { title: "购物车" }, }, { - path: 'ComplainList', - name: 'ComplainList', - component: ComplainList + path: "/pay", // 支付页面 + name: "Pay", + component: Pay, + meta: { title: "订单结算" }, }, { - path: 'ComplainDetail', - name: 'ComplainDetail', - component: ComplainDetail + path: "/payMent", + name: "PayMent", + component: PayMent, }, { - path: 'AccountSafe', - name: 'AccountSafe', - component: AccountSafe + path: "/PointMall", + name: "PointMall", + component: PointMall, + meta: { title: "积分商城" }, }, { - path: 'ModifyPwd', - name: 'ModifyPwd', - component: ModifyPwd + path: "/qrpay", // 三方支付 + name: "qrpay", + component: ThirdPay, }, { - path: 'Favorites', - name: 'Favorites', - component: Favorites, - meta: {title: '我的收藏'} + path: "/payDone", // 支付成功页面 + name: "PayDone", + component: PayDone, }, { - path: 'Distribution', - name: 'Distribution', - component: Distribution, - meta: {title: '分销推荐'} + path: "/article", // 文章页面 + name: "article", + component: article, + meta: { + title: "帮助中心", + }, }, { - path: 'Point', - name: 'Point', - component: Point, - meta: {title: '我的积分'} + path: "/article/detail", // 文章页面 + name: "articleDetail", + component: articleDetail, + meta: { + title: "帮助中心", + }, }, { - path: 'Profile', - name: 'Profile', - component: Profile + path: "/shopEntry", + name: "shopEntry", + component: ShopEntry, + meta: { + title: "店铺入驻", + }, }, { - path: 'AfterSale', - name: 'AfterSale', - component: AfterSale, - meta: {title: '售后'} + path: "/coupon", + name: "coupon", + component: Coupon, + meta: { + title: "领券中心", + }, }, { - path: 'ApplyAfterSale', - name: 'ApplyAfterSale', - component: ApplyAfterSale, - meta: {title: '申请售后'} + path: "/seckill", + name: "seckill", + component: seckill, + meta: { + title: "限时秒杀", + }, }, { - path: '/home/MyAddress', - name: 'MyAddress', - component: MyAddress, - meta: {title: '收货地址'} + path: "/home", // 主页 + component: Home, + children: [ + { + path: "/", + name: "Home", + component: UserMain, + meta: { + title: "会员中心", + }, + }, + { + path: "MyTracks", + name: "MyTracks", + component: MyTracks, + meta: { title: "我的足迹" }, + }, + { + path: "MoneyManagement", + name: "MoneyManagement", + component: MoneyManagement, + }, + { + path: "Complain", + name: "Complain", + component: Complain, + }, + { + path: "Coupons", + name: "Coupons", + component: Coupons, + }, + { + path: "CommentList", + name: "CommentList", + component: CommentList, + mate: { title: "评价列表" }, + }, + { + path: "AddEval", + name: "AddEval", + component: AddEval, + mate: { title: "添加评价" }, + }, + { + path: "EvalDetail", + name: "EvalDetail", + component: EvalDetail, + mate: { title: "评价详情" }, + }, + { + path: "ComplainList", + name: "ComplainList", + component: ComplainList, + }, + { + path: "ComplainDetail", + name: "ComplainDetail", + component: ComplainDetail, + }, + { + path: "AccountSafe", + name: "AccountSafe", + component: AccountSafe, + }, + { + path: "ModifyPwd", + name: "ModifyPwd", + component: ModifyPwd, + }, + { + path: "Favorites", + name: "Favorites", + component: Favorites, + meta: { title: "我的收藏" }, + }, + { + path: "Distribution", + name: "Distribution", + component: Distribution, + meta: { title: "分销推荐" }, + }, + { + path: "Point", + name: "Point", + component: Point, + meta: { title: "我的积分" }, + }, + { + path: "Profile", + name: "Profile", + component: Profile, + }, + { + path: "AfterSale", + name: "AfterSale", + component: AfterSale, + meta: { title: "售后" }, + }, + { + path: "ApplyAfterSale", + name: "ApplyAfterSale", + component: ApplyAfterSale, + meta: { title: "申请售后" }, + }, + { + path: "/home/MyAddress", + name: "MyAddress", + component: MyAddress, + meta: { title: "收货地址" }, + }, + { + path: "AddAddress", + name: "AddAddress", + component: AddAddress, + }, + { + path: "MsgList", + name: "MsgList", + component: MsgList, + meta: { title: "我的消息" }, + }, + { + path: "MsgDetail", + name: "MsgDetail", + component: MsgDetail, + meta: { title: "我的消息" }, + }, + { + path: "MyOrder", + name: "MyOrder", + component: MyOrder, + meta: { title: "我的订单" }, + }, + { + path: "OrderDetail", + name: "OrderDetail", + component: OrderDetail, + meta: { title: "订单详情" }, + }, + { + path: "AfterSaleDetail", + name: "AfterSaleDetail", + component: AfterSaleDetail, + meta: { title: "售后详情" }, + }, + ], }, { - path: 'AddAddress', - name: 'AddAddress', - component: AddAddress + path: "/merchant", + name: "Merchant", + component: Merchant, + meta: { title: "店铺" }, }, - { - path: 'MsgList', - name: 'MsgList', - component: MsgList, - meta: {title: '我的消息'} - }, - { - path: 'MsgDetail', - name: 'MsgDetail', - component: MsgDetail, - meta: {title: '我的消息'} - }, - { - path: 'MyOrder', - name: 'MyOrder', - component: MyOrder, - meta: {title: '我的订单'} - }, - { - path: 'OrderDetail', - name: 'OrderDetail', - component: OrderDetail, - meta: {title: '订单详情'} - }, - { - path: 'AfterSaleDetail', - name: 'AfterSaleDetail', - component: AfterSaleDetail, - meta: {title: '售后详情'} - } - ] - }, - { - path: '/merchant', - name: 'Merchant', - component: Merchant, - meta: {title: '店铺'} - } - ] + ], }); diff --git a/manager/src/config/index.js b/manager/src/config/index.js index 67f42f81..68b9d83e 100644 --- a/manager/src/config/index.js +++ b/manager/src/config/index.js @@ -3,5 +3,5 @@ module.exports = { aMapKey: "b440952723253aa9fe483e698057bf7d", //高德web端申请的api key website: "https://www.pickmall.cn", //官网地址 enableCDN: true, //生产环境 是否启用cdn加载 vue等js - port:10003, //端口 + port: 10003, //端口 }; diff --git a/seller/src/config/index.js b/seller/src/config/index.js index d15bb2d5..7fad393a 100644 --- a/seller/src/config/index.js +++ b/seller/src/config/index.js @@ -3,5 +3,5 @@ module.exports = { aMapKey: "b440952723253aa9fe483e698057bf7d", //高德web端申请的api key website: "https://www.pickmall.cn", //官网地址 enableCDN: true, //生产环境 是否启用cdn加载 vue等js - port:10002, //端口 + port: 10002, //端口 }; diff --git a/seller/src/views/goods/goods-seller/goodsOperationSec.vue b/seller/src/views/goods/goods-seller/goodsOperationSec.vue index a3e6df33..eec96023 100644 --- a/seller/src/views/goods/goods-seller/goodsOperationSec.vue +++ b/seller/src/views/goods/goods-seller/goodsOperationSec.vue @@ -45,7 +45,11 @@ /> - + 商品交易信息 - + - {{ unit }} - + - + 删除规格 - - + + - + @@ -200,7 +221,14 @@ :filter-method="filterMethod" :data="skuVal" @on-focus="changeSkuVals(item.name)" - @on-change="skuValueChange(val.value, $index, item)" + @on-change=" + handleSkuValue( + val.value, + $index, + val, + index + ) + " > - 添加规格值 + 添加规格值 @@ -233,9 +263,97 @@ 规格详细 + + + {{ item.title }} + + + + + + {{ + skuTableData[index][ + spec.title || spec.key || spec.___key + ] + }} + + + + + + + + + + + + + + + + + + + 编辑图片 + + + - 编辑图片 - - - - - - - - - - - - - - - - - - - - - - + - + --> + + + + + + + + + + + + + + + + + + + + + + + 商品详情描述 - + - - + + 商品物流信息 - + 其他信息 - + - + 0) { + console.log(row); + if (row.images && row.images.length) { this.previewPicture = row.images[0].url; } this.selectedSku = row; @@ -724,7 +870,9 @@ export default { }, // 移除已选图片 handleRemove(item, index) { - this.selectedSku.images = this.selectedSku.images.filter((i) => i.url !== item.url); + this.selectedSku.images = this.selectedSku.images.filter( + (i) => i.url !== item.url + ); if (this.selectedSku.images.length > 0 && index === 0) { this.previewPicture = this.selectedSku.images[0].url; } else if (this.selectedSku.images.length < 0) { @@ -738,9 +886,8 @@ export default { }, // 移除商品图片 handleRemoveGoodsPicture(file) { - this.baseInfoForm.goodsGalleryFiles = this.baseInfoForm.goodsGalleryFiles.filter( - (i) => i.url !== file.url - ); + this.baseInfoForm.goodsGalleryFiles = + this.baseInfoForm.goodsGalleryFiles.filter((i) => i.url !== file.url); }, // 更新sku图片 updateSkuPicture() { @@ -762,7 +909,6 @@ export default { }, // 商品图片上传成功 handleSuccessGoodsPicture(res, file) { - console.log(res); if (file.response) { file.url = file.response.result; this.baseInfoForm.goodsGalleryFiles.push(file); @@ -795,7 +941,8 @@ export default { // sku图片上传前钩子 handleBeforeUpload(file) { const check = - this.selectedSku.images !== undefined && this.selectedSku.images.length > 5; + this.selectedSku.images !== undefined && + this.selectedSku.images.length > 5; if (check) { this.$Notice.warning({ title: "图片数量不能大于五张" }); return false; @@ -804,9 +951,11 @@ export default { /** 查询商品品牌列表 */ getGoodsBrandList() { - API_GOODS.getCategoryBrandListDataSeller(this.categoryId).then((response) => { - this.brandList = response; - }); + API_GOODS.getCategoryBrandListDataSeller(this.categoryId).then( + (response) => { + this.brandList = response; + } + ); }, // 获取商品单位 GET_GoodsUnit() { @@ -860,12 +1009,11 @@ export default { response.result.goodsGalleryList && response.result.goodsGalleryList.length > 0 ) { - this.baseInfoForm.goodsGalleryFiles = response.result.goodsGalleryList.map( - (i) => { + this.baseInfoForm.goodsGalleryFiles = + response.result.goodsGalleryList.map((i) => { let files = { url: i }; return files; - } - ); + }); } this.Get_SkuInfoByCategory(this.categoryId); @@ -892,12 +1040,18 @@ export default { cost: e.cost, quantity: e.quantity, weight: e.weight, + // ___keys: [], }; e.specList.forEach((u) => { if (u.specName === "images") { sku.images = u.specImage; } else { sku[u.specName] = u.specValue; + // 赋值keys标识符 + // sku.___keys.push({ + // key: u.specName, + // value: u.specValue, + // }); if ( !skusInfo.some((s) => s.name === u.specName) && !this.ignoreColumn.includes(u.specName) @@ -910,6 +1064,7 @@ export default { id: u.specValueId, name: u.specName, value: u.specValue || "", + ___key: u.specValue || "", }, ], }); @@ -923,6 +1078,7 @@ export default { id: u.specValueId, name: u.specName, value: u.specValue || "", + ___key: u.specValue || "", }); } if (!sk.spec_id && u.specName === "specId") { @@ -937,44 +1093,47 @@ export default { }); this.skuInfo = skusInfo; this.renderTableData(); + this.skuTableData = skus; }, /** 根据当前分类id查询商品应包含的参数 */ GET_GoodsParams() { - API_GOODS.getCategoryParamsListDataSeller(this.categoryId).then((response) => { - if (!response || response.length <= 0) { - return; - } - this.goodsParams = response; + API_GOODS.getCategoryParamsListDataSeller(this.categoryId).then( + (response) => { + if (!response || response.length <= 0) { + return; + } + this.goodsParams = response; - //展开选项卡 - this.goodsParams.forEach((item) => { - this.params_panel.push(item.groupName); - }); - if (this.baseInfoForm.goodsParamsDTOList) { - // 已选值集合 - const paramsArr = []; - this.baseInfoForm.goodsParamsDTOList.forEach((group) => { - group.goodsParamsItemDTOList.forEach((param) => { - param.groupId = group.groupId; - paramsArr.push(param); - }); + //展开选项卡 + this.goodsParams.forEach((item) => { + this.params_panel.push(item.groupName); }); - // 循环参数分组 - this.goodsParams.forEach((parmsGroup) => { - parmsGroup.params.forEach((param) => { - paramsArr.forEach((arr) => { - if (param.paramName == arr.paramName) { - param.paramValue = arr.paramValue; - } + if (this.baseInfoForm.goodsParamsDTOList) { + // 已选值集合 + const paramsArr = []; + this.baseInfoForm.goodsParamsDTOList.forEach((group) => { + group.goodsParamsItemDTOList.forEach((param) => { + param.groupId = group.groupId; + paramsArr.push(param); }); }); - }); - } else { - this.baseInfoForm.goodsParamsDTOList = []; + // 循环参数分组 + this.goodsParams.forEach((parmsGroup) => { + parmsGroup.params.forEach((param) => { + paramsArr.forEach((arr) => { + if (param.paramName == arr.paramName) { + param.paramValue = arr.paramValue; + } + }); + }); + }); + } else { + this.baseInfoForm.goodsParamsDTOList = []; + } } - }); + ); }, /** 添加规格项 */ addSkuItem() { @@ -985,18 +1144,11 @@ export default { // 写入对象,下标,具体对象 this.$set(this.skuInfo, this.skuInfo.length, { spec_values: [], - name: "规格名", + name: "规格名" + (this.skuInfo.length + 1), }); - this.renderTableData(); - }, - // 编辑规格名 - editSkuItem() { - this.renderTableData(); - }, - // 编辑规格值 - async skuValueChange(val, index, item) { - this.renderTableData(); + // this.renderTableData(); }, + // 获取焦点时,取得规格名对应的规格值 changeSkuVals(name) { if (name) { @@ -1009,14 +1161,7 @@ export default { }); } }, - /** 移除当前规格项 进行数据变化*/ - handleCloseSkuItem($index) { - this.skuInfo.splice($index, 1); - /** - * 渲染规格详细表格 - */ - this.renderTableData(); - }, + // 添加规格值的验证 validateEmpty(params) { let flag = true; @@ -1042,6 +1187,7 @@ export default { this.$set(item.spec_values, item.spec_values.length, { name: item.name, value: "", + ___key: "", }); this.baseInfoForm.regeneratorSkuFlag = true; /** @@ -1051,27 +1197,99 @@ export default { } }, - /** 移除当前规格值 */ - handleCloseSkuValue(item, index) { - item.spec_values.splice(index, 1); + /** 移除当前规格项 进行数据变化*/ + handleCloseSkuItem(item, $index) { + console.log(item); + let oldsSkuTableData = cloneObj(this.skuTableData); + oldsSkuTableData.forEach((sku, i) => { + if (sku[item.name]) { + delete sku[item.name]; + } + }); + this.skuTableData = oldsSkuTableData; + this.skuTableColumn.forEach((column, i) => { + if (column.key == item.name) { + this.skuTableColumn.splice(i, 1); + } + }); + this.skuInfo.splice($index, 1); + }, + + /** + * 移除当前规格值 + * 找到一样规格的值进行移出 + */ + handleCloseSkuValue(item, index) { + let oldsSkuTableData = cloneObj(this.skuTableData); + console.log("oldsSkuTableData", oldsSkuTableData); + this.skuTableData = oldsSkuTableData.filter((sku, i) => { + if ( + sku[item.spec_values[index].name] != item.spec_values[index].value + ) { + return sku; + } + }); + item.spec_values.splice(index, 1); this.baseInfoForm.regeneratorSkuFlag = true; - /** - * 渲染规格详细表格 - */ - this.renderTableData(); + }, + + /** + * 编辑规格值 + * 根据当前___keys的索引指定需修改的值 + * @param {*} change 返回input更改的值 + * @param {*} index 修改规格名的索引 + * @param {*} item 当前规格值 + */ + async handleSkuValue(change, index, item) { + this.skuTableData.map((sku, i) => { + // 指定key + if (sku[item.name] == item.___key) { + sku[item.name] = change; + console.log(1); + } else if (!item.___key && !sku[item.name]) { + // 如果为第一次没有值则进行赋值操作 + + sku[item.name] = change; + console.log("赋值", sku); + } + }); + item.___key = change; + }, + + /** + * 编辑规格名 + * 根据修改的规格名,将skuTableData的key(规格名)进行修改 + * @param {*} change 返回input更改的值 + * @param {*} index 修改规格名的索引 + */ + handleSkuTitle(change, index) { + let oldSkuTableColumn = cloneObj(this.skuTableColumn); + this.skuTableData.forEach((sku, i) => { + Object.keys(sku).forEach((key) => { + if (oldSkuTableColumn[index].key == key) { + // 修改当前sku的规格名 + sku = { + [change]: sku[key], + ...sku, + }; + delete sku[key]; + + this.skuTableData[i] = sku; + } + }); + }); + this.skuTableColumn[index].key = change; + this.skuTableColumn[index].title = change; }, /** * 渲染table所需要的column 和 data */ renderTableData() { - this.skuTableColumn = []; - this.skuTableData = []; let pushData = []; //渲染头部 this.skuInfo.forEach((sku) => { - // !sku.name ? (sku.name = "规格名") : ""; //列名称 let columnName = sku.name; pushData.push({ @@ -1112,14 +1330,20 @@ export default { this.skuTableColumn = pushData; //克隆所有渲染的数据 let cloneTemp = cloneObj(this.skuInfo); + if (cloneTemp.length) { + cloneTemp.map((temp) => { + return { + [temp.name]: temp.value, + images: this.baseInfoForm.goodsGalleryFiles || [], + }; + }); + } - //数据清空一次 - this.$set(this, "skuTableData", []); //判定 是否存在规格分组 if (cloneTemp[0]) { //存放最终结果 let result = []; - //循环选中的 sku 数据 + // 循环出第一个规格名中的数据 cloneTemp[0].spec_values.forEach((specItem) => { result.push({ [cloneTemp[0].name]: specItem.value, @@ -1128,8 +1352,14 @@ export default { }); cloneTemp.splice(0, 1); result = this.specIterator(result, cloneTemp); + // 保存以前skuTable值 + let oldData = cloneObj(this.skuTableData); + this.skuTableData = result; - console.log(this.skuTableData); + // 赋值给最新的skuTable + this.skuTableData = Object.assign(this.skuTableData, oldData); + + console.log(result, this.skuTableData); } }, /** @@ -1141,16 +1371,25 @@ export default { //是否还可以循环 if (cloneTemp.length > 0) { let table = []; - result.forEach((resItem) => { + let newVal = []; // 用于存储新对象 并重置到最后一位 + result.forEach((resItem, i) => { cloneTemp[0].spec_values.forEach((valItem) => { let obj = cloneObj(resItem); obj[cloneTemp[0].name] = valItem.value; - table.push(obj); + if (valItem.value) { + table.push(obj); + } else { + newVal.push(obj); + } }); }); result = []; + table.push(...newVal); + table.forEach((t) => { + console.log("t", t); + result.push(t); }); //清除当前循环的分组 @@ -1160,6 +1399,7 @@ export default { } return this.specIterator(result, cloneTemp); }, + /** 根据分类id获取系统设置规格信息*/ Get_SkuInfoByCategory(categoryId) { if (categoryId) { @@ -1179,8 +1419,7 @@ export default { return option.toUpperCase().indexOf(value.toUpperCase()) !== -1; }, /** 数据改变之后 抛出数据 */ - updateSkuTable(row, item, type = "deafult") { - let index = row._index; + updateSkuTable(row, item, index) { this.baseInfoForm.regeneratorSkuFlag = true; /** 进行自定义校验 判断是否是数字(小数也能通过)重量 */ if (item === "weight") { @@ -1218,6 +1457,7 @@ export default { } } this.$nextTick(() => { + console.log(index, item); this.skuTableData[index][item] = row[item]; }); // this.$set(this.skuTableData,[index][item],row[item]) @@ -1257,7 +1497,10 @@ export default { this.$refs["baseInfoForm"].validate((valid) => { if (valid) { let submit = JSON.parse(JSON.stringify(this.baseInfoForm)); - if (submit.goodsGalleryFiles && submit.goodsGalleryFiles.length <= 0) { + if ( + submit.goodsGalleryFiles && + submit.goodsGalleryFiles.length <= 0 + ) { this.submitLoading = false; this.$Message.error("请上传商品图片"); return; @@ -1284,13 +1527,17 @@ export default { } if (submit.goodsGalleryFiles.length > 0) { - submit.goodsGalleryList = submit.goodsGalleryFiles.map((i) => i.url); + submit.goodsGalleryList = submit.goodsGalleryFiles.map( + (i) => i.url + ); } /** 参数校验 **/ /* Object.keys(submit.goodsParamsList).forEach((item) => { });*/ submit.release ? (submit.release = true) : (submit.release = false); - submit.recommend ? (submit.recommend = true) : (submit.recommend = false); + submit.recommend + ? (submit.recommend = true) + : (submit.recommend = false); if (this.goodsId) { API_GOODS.editGoods(this.goodsId, submit).then((res) => { @@ -1323,9 +1570,8 @@ export default { saveToDraft() { this.baseInfoForm.skuList = this.skuTableData; if (this.baseInfoForm.goodsGalleryFiles.length > 0) { - this.baseInfoForm.goodsGalleryList = this.baseInfoForm.goodsGalleryFiles.map( - (i) => i.url - ); + this.baseInfoForm.goodsGalleryList = + this.baseInfoForm.goodsGalleryFiles.map((i) => i.url); } this.baseInfoForm.categoryName = []; this.baseInfoForm.saveType = "TEMPLATE"; @@ -1415,4 +1661,30 @@ export default { diff --git a/seller/src/views/shop/shopSetting.vue b/seller/src/views/shop/shopSetting.vue index 4533ff31..2243601d 100644 --- a/seller/src/views/shop/shopSetting.vue +++ b/seller/src/views/shop/shopSetting.vue @@ -1,78 +1,177 @@ - - + - + - + - + - + - + - 修改 + 修改 - + - + - + - - 修改 + + 修改 - + - + - 修改 + 修改 - - + - + - 修改 + 修改 - - + - + - 修改 + 修改 @@ -86,7 +185,7 @@