From 3cb3fd81e79e58fdb4a89dd8a61f7d4bd44d772a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?lemon=E6=A9=AA?= <17633066053@163.com> Date: Fri, 25 Jun 2021 19:15:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=80=E4=BA=9B=E7=9C=8B?= =?UTF-8?q?=E5=88=B0=E7=9A=84bug=E4=BB=A5=E5=8F=8A=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E4=B8=8A=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buyer/src/plugins/request.js | 2 +- manager/src/config/index.js | 16 +- .../views/promotion/coupon/couponPublish.vue | 6 + .../views/promotion/couponActivity/coupon.vue | 2 +- seller/src/config/index.js | 16 +- seller/src/store/modules/app.js | 1 + .../views/lili-components/multiple-region.vue | 13 +- .../views/promotion/coupon/couponPublish.vue | 182 +++++------------- seller/src/views/promotion/live/addLive.vue | 46 ++--- seller/src/views/promotion/live/liveGoods.vue | 26 +-- seller/src/views/shop/ship/shipTemplate.vue | 64 ++++-- 11 files changed, 161 insertions(+), 213 deletions(-) diff --git a/buyer/src/plugins/request.js b/buyer/src/plugins/request.js index c5457098..3e5e1e9e 100644 --- a/buyer/src/plugins/request.js +++ b/buyer/src/plugins/request.js @@ -69,7 +69,7 @@ service.interceptors.request.use( config.headers['accessToken'] = accessToken; // 解析当前token时间 let jwtData = JSON.parse( - decodeURIComponent(escape(window.atob(accessToken.split('.')[1]))) + decodeURIComponent(escape(window.atob(accessToken.split('.')[1].replace(/-/g, '+').replace(/_/g, '/')))) ); if (jwtData.exp < Math.round(new Date() / 1000)) { refresh(config) diff --git a/manager/src/config/index.js b/manager/src/config/index.js index 680fb1b1..8b6b162f 100644 --- a/manager/src/config/index.js +++ b/manager/src/config/index.js @@ -17,14 +17,14 @@ 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: 'http://192.168.0.109:8890', - // buyer: 'http://192.168.0.109:8888', - // seller: 'http://192.168.0.109:8889', - // manager: 'http://192.168.0.109:8887' + // 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.109:8890', + buyer: 'http://192.168.0.109:8888', + seller: 'http://192.168.0.109:8889', + manager: 'http://192.168.0.109:8887' }, api_prod: { common: "https://common-api.pickmall.cn", diff --git a/manager/src/views/promotion/coupon/couponPublish.vue b/manager/src/views/promotion/coupon/couponPublish.vue index 7b06efec..2247a931 100644 --- a/manager/src/views/promotion/coupon/couponPublish.vue +++ b/manager/src/views/promotion/coupon/couponPublish.vue @@ -39,9 +39,11 @@ +
如果发放数量为0时,则代表不限制发放数量
+
如果领取数量为0时,则代表不限制领取数量
diff --git a/manager/src/views/promotion/couponActivity/coupon.vue b/manager/src/views/promotion/couponActivity/coupon.vue index aac1d820..afb89d0a 100644 --- a/manager/src/views/promotion/couponActivity/coupon.vue +++ b/manager/src/views/promotion/couponActivity/coupon.vue @@ -44,7 +44,7 @@ export default { // 搜索框初始化对象 pageNumber: 0, // 当前页数 pageSize: 10, // 页面大小 - sort: "startTime", // 默认排序字段 + sort: "createTime", // 默认排序字段 order: "desc", // 默认排序方式 }, form: { diff --git a/seller/src/config/index.js b/seller/src/config/index.js index a7163666..27da5927 100644 --- a/seller/src/config/index.js +++ b/seller/src/config/index.js @@ -18,14 +18,14 @@ 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: 'http://192.168.0.109:8890', - // buyer: 'http://192.168.0.109:8888', - // seller: 'http://192.168.0.109:8889', - // manager: 'http://192.168.0.109:8887' + // 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.109:8890', + buyer: 'http://192.168.0.109:8888', + seller: 'http://192.168.0.109:8889', + manager: 'http://192.168.0.109:8887' }, api_prod: { common: 'https://common-api.pickmall.cn', diff --git a/seller/src/store/modules/app.js b/seller/src/store/modules/app.js index 8e896575..6d1d4525 100644 --- a/seller/src/store/modules/app.js +++ b/seller/src/store/modules/app.js @@ -7,6 +7,7 @@ import Vue from 'vue'; const app = { state: { shipTemplates:"", + regions:[], //此处是在地区选择器时赋值一次 styleStore:"", //移动端楼层装修中选择风格存储 loading: false, // 全局加载动画 added: false, // 加载路由标识 diff --git a/seller/src/views/lili-components/multiple-region.vue b/seller/src/views/lili-components/multiple-region.vue index 34b78ed7..fe01cabf 100644 --- a/seller/src/views/lili-components/multiple-region.vue +++ b/seller/src/views/lili-components/multiple-region.vue @@ -44,23 +44,27 @@ export default { */ open(val, index) { if (val) { + // console.warn(val); //已选中的地址 let checkedData = this.$store.state.shipTemplate; + // console.warn(this.$store.state.shipTemplate); // 禁止选中的地址 let disabledData = checkedData.filter((item, i) => { return i != index; }); - disabledData.forEach((dis) => { + console.log(dis) // 循环出已经选中的地址id dis.areaId.split(",").forEach((ids) => { // 循环出省份 this.data.forEach((item) => { // 如果当前省份下市区全部选中则选中该省份 + if (dis.selectedAll) { dis.area.split(",").forEach((area) => { if (area == item.name) { + console.log(item.name +"选中") this.$set(item, "disabled", true); } }); @@ -99,7 +103,11 @@ export default { // 筛选出当前选中的市 sort.forEach((sortItem, sortIndex) => { - if (item.level != "province" && sortItem.id == item.parentId && !item.disabled) { + if ( + item.level != "province" && + sortItem.id == item.parentId && + !item.disabled + ) { sortItem.selectedList.push({ ...item, }); @@ -147,6 +155,7 @@ export default { this.selectedWay.push({ name: data.title, id: data.id }); }); console.log(this.data); + this.$store.state.regions = this.data; } }); }, diff --git a/seller/src/views/promotion/coupon/couponPublish.vue b/seller/src/views/promotion/coupon/couponPublish.vue index e9daf0da..76d1c966 100644 --- a/seller/src/views/promotion/coupon/couponPublish.vue +++ b/seller/src/views/promotion/coupon/couponPublish.vue @@ -6,22 +6,10 @@

基本信息

- + - + - - + + 请输入0-10之间数字,可以输入一位小数 - - + + - - + + +
如果发放数量为0时,则代表不限制发放数量

使用限制

- + - - + + +
如果领取限制为0时,则代表不限制领取数量
- + @@ -109,34 +57,14 @@ - +
- - + +
- +
@@ -147,35 +75,17 @@
- +
- - + +
- + @@ -212,7 +122,7 @@ export default { callback(); } }; - + return { modalType: 0, // 判断是新增还是编辑优惠券 0 新增 1 编辑 categoryId: 0, // 分类id @@ -232,6 +142,7 @@ export default { getType: "FREE", promotionGoodsList: [], scopeIdGoods: [], + rangeDayType: "FIXEDTIME", }, id: this.$route.query.id, submitLoading: false, // 添加或编辑提交状态 @@ -392,7 +303,11 @@ export default { params.endTime = this.$options.filters.unixToDate( this.form.rangeTime[1] / 1000 ); - delete params.rangeTime + if (params.getType == "ACTIVITY") { + params.couponLimitNum = 0; + params.publishNum = 0; + } + delete params.rangeTime; let scopeId = []; if ( params.scopeType == "PORTION_GOODS" && @@ -465,12 +380,13 @@ export default { name: "coupon", }); }, - openSkuList() { // 显示商品选择器 + openSkuList() { + // 显示商品选择器 this.$refs.skuSelect.open("goods"); - let data = JSON.parse(JSON.stringify(this.form.promotionGoodsList)) - data.forEach(e => { - e.id = e.skuId - }) + let data = JSON.parse(JSON.stringify(this.form.promotionGoodsList)); + data.forEach((e) => { + e.id = e.skuId; + }); this.$refs.skuSelect.goodsData = data; }, changeSelect(e) { @@ -507,15 +423,15 @@ export default { // 回显已选商品 let list = []; item.forEach((e) => { - list.push({ - goodsName: e.goodsName, - price: e.price, - originalPrice: e.price, - quantity: e.quantity, - storeId: e.storeId, - sellerName: e.sellerName, - skuId: e.id, - }); + list.push({ + goodsName: e.goodsName, + price: e.price, + originalPrice: e.price, + quantity: e.quantity, + storeId: e.storeId, + sellerName: e.sellerName, + skuId: e.id, + }); }); this.form.promotionGoodsList = list; }, @@ -598,11 +514,15 @@ h4 { margin-left: 10px; color: #999; } -.ivu-form-item{ +.ivu-form-item { margin-bottom: 24px !important; } -.wrapper{ +.wrapper { min-height: 1000px; } +.tips { + font-size: 12px; + color: #999; +} diff --git a/seller/src/views/promotion/live/addLive.vue b/seller/src/views/promotion/live/addLive.vue index 5f4b3295..7c2e9993 100644 --- a/seller/src/views/promotion/live/addLive.vue +++ b/seller/src/views/promotion/live/addLive.vue @@ -97,7 +97,7 @@
- + @@ -259,10 +259,14 @@ export default { * 删除直播间商品 */ async deleteGoods(val, index) { + this.$Spin.show(); let res = await delRoomLiveGoods(this.liveForm.roomId, val.liveGoodsId); if (res.success) { this.$Message.success("删除成功!"); this.liveData.splice(index, 1); + this.$Spin.hide(); + } else { + this.$Spin.hide(); } }, /** @@ -325,35 +329,19 @@ export default { * 回调的商品选择数据 */ callBackData(way) { - this.$set(this, "liveData", way); - }, - - /** - * 提交直播间商品 - */ - addGoods() { + console.log(way); + this.liveGoodsVisible = false; + this.$Spin.show(); addLiveGoods({ roomId: this.$route.query.roomId, - liveGoodsId: item.liveGoodsId, - }); - }, - - /** - * dialog点击确定时判断 - */ - addGoods() { - this.liveData.forEach((item) => { - if (this.commodityList.length == 1 && this.liveData.length == 1) { - addLiveGoods({ - roomId: this.$route.query.roomId, - liveGoodsId: item.liveGoodsId, - }); + liveGoodsId: way.liveGoodsId, + }).then((res) => { + if (res.success) { + this.liveData.push(way); + this.$Spin.hide(); + console.log(this.liveData); } else { - this.commodityList.forEach((oldVal, i) => { - // 如果商品里面没有商品,以及添加商品为第一次的话 - if (oldVal.liveGoodsId != item.liveGoodsId) { - } - }); + this.$Spin.hide(); } }); }, diff --git a/seller/src/views/promotion/live/liveGoods.vue b/seller/src/views/promotion/live/liveGoods.vue index eb2def25..230712c0 100644 --- a/seller/src/views/promotion/live/liveGoods.vue +++ b/seller/src/views/promotion/live/liveGoods.vue @@ -208,20 +208,20 @@ export default { * 回调参数补充 */ selectedLiveGoods(val, index) { - if (!val.___selected) { - val.___selected = true; - this.$set(this.liveGoodsData[index], "___selected", true); - this.selectedGoods.push(this.liveGoodsData[index]); - } else { - this.$nextTick(() => { - val.___selected = false; + // if (!val.___selected) { + // val.___selected = true; + // this.$set(this.liveGoodsData[index], "___selected", true); + // this.selectedGoods.push(this.liveGoodsData[index]); + // } else { + // this.$nextTick(() => { + // val.___selected = false; - this.$set(this.liveGoodsData[index], "___selected", true); - this.selectedGoods.splice(index, 1); - }); - } + // this.$set(this.liveGoodsData[index], "___selected", true); + // this.selectedGoods.splice(index, 1); + // }); + // } - this.$emit("selectedGoods", this.selectedGoods); + this.$emit("selectedGoods", val); }, /** * 解决radio数据不回显问题 @@ -279,7 +279,7 @@ export default { console.log(element); return { goodsId: element.goodsId, //商品id - goodsImage: element.small, //商品图片 必须为 300 * 300 + goodsImage: element.small, //商品图片 最大为 300 * 300 name: element.goodsName, //商品昵称 price: parseInt(element.price), //商品价格 quantity: element.quantity, //库存 diff --git a/seller/src/views/shop/ship/shipTemplate.vue b/seller/src/views/shop/ship/shipTemplate.vue index 813c4664..fc7f227b 100644 --- a/seller/src/views/shop/ship/shipTemplate.vue +++ b/seller/src/views/shop/ship/shipTemplate.vue @@ -95,8 +95,8 @@
- - + + @@ -104,7 +104,7 @@ - + @@ -135,7 +135,7 @@ - @@ -163,7 +163,7 @@ export default { data() { return { - selectedIndex:0, //选中的地址模板下标 + selectedIndex: 0, //选中的地址模板下标 item: "", //运费模板子模板 shipInfo: {}, // 运费模板数据 title: "添加运费模板", // 模态框标题 @@ -195,6 +195,11 @@ export default { }, }; }, + computed: { + regions() { + return this.$store.state.regions; + }, + }, methods: { init() { this.getData(); @@ -224,7 +229,7 @@ export default { firstPrice: "", continuedCompany: "1", continuedPrice: "", - selectedAll:false + selectedAll: false, }, ], }; @@ -240,12 +245,24 @@ export default { this.form = item; }, //选择地区 - editRegion(item,index) { - this.selectedIndex = index + editRegion(item, index) { + this.selectedIndex = index; this.item = item; - this.$store.state.shipTemplate = this.form.freightTemplateChildList - this.$refs.region.open(item,index); + this.regions.forEach((addr) => { + this.form.freightTemplateChildList.forEach((child) => { + child.area.split(",").forEach((area) => { + if (addr.name == area) { + addr.selectedAll = true; + this.$set(child, "selectedAll", true); + } + }); + }); + }); + + this.$store.state.shipTemplate = this.form.freightTemplateChildList; + + this.$refs.region.open(item, index); }, //刷细数据 refresh() { @@ -273,9 +290,11 @@ export default { if (child.selectedList != "") { // 只显示省份 - if(child.selectedAll ){ - area += child.name + "," - this.form.freightTemplateChildList[this.selectedIndex].selectedAll = true + if (child.selectedAll) { + area += child.name + ","; + this.form.freightTemplateChildList[ + this.selectedIndex + ].selectedAll = true; } child.selectedList.forEach((son) => { @@ -302,11 +321,16 @@ export default { this.$refs.form.validate((valid) => { const regNumber = /^\+?[1-9][0-9]*$/; - const regMoney = /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/; + const regMoney = + /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/; if (valid) { - if (this.form.pricingMethod != 'FREE') { + if (this.form.pricingMethod != "FREE") { //校验运费模板详细信息 - for (let i = 0; i < this.form.freightTemplateChildList.length; i++) { + for ( + let i = 0; + i < this.form.freightTemplateChildList.length; + i++ + ) { if ( this.form.freightTemplateChildList[i].area == "" || this.form.freightTemplateChildList[i].firstCompany == "" || @@ -324,8 +348,9 @@ export default { regNumber.test( this.form.freightTemplateChildList[i].continuedCompany ) == false || - regMoney.test(this.form.freightTemplateChildList[i].firstPrice) == - false || + regMoney.test( + this.form.freightTemplateChildList[i].firstPrice + ) == false || regMoney.test( this.form.freightTemplateChildList[i].continuedPrice ) == false @@ -335,7 +360,6 @@ export default { } } } - if (this.operation == "ADD") { API_Shop.addShipTemplate(this.form, headers).then((res) => { @@ -372,7 +396,7 @@ export default { firstPrice: "", continuedCompany: "1", continuedPrice: "", - selectedAll:false + selectedAll: false, }; this.form.freightTemplateChildList.push(params); },