From 3b922839a1583e01dc038b9f61bf22db285dfea2 Mon Sep 17 00:00:00 2001 From: Chopper Date: Tue, 22 Jun 2021 14:59:20 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=95=86=E5=93=81=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E5=B1=95=E7=A4=BA=E6=90=9C=E7=B4=A2=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=EF=BC=8C=E5=B1=95=E7=A4=BA=E5=95=86=E5=93=81=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- manager/src/views/goods/goods-info/goods.vue | 21 ++++++ seller/src/views/goods/goods-seller/goods.vue | 69 ++++++++++++------- 2 files changed, 67 insertions(+), 23 deletions(-) diff --git a/manager/src/views/goods/goods-info/goods.vue b/manager/src/views/goods/goods-info/goods.vue index d46ce5e8..21271b7e 100644 --- a/manager/src/views/goods/goods-info/goods.vue +++ b/manager/src/views/goods/goods-info/goods.vue @@ -38,6 +38,12 @@ + + + @@ -132,6 +138,7 @@ export default { pageSize: 10, // 页面大小 sort: "create_time", // 默认排序字段 order: "desc", // 默认排序方式 + goodsType: "", // 商品类型 }, underForm: { // 下架原因 reason: "", @@ -174,6 +181,20 @@ export default { ); }, }, + { + title: "商品类型", + key: "goodsType", + width: 130, + render: (h, params) => { + if (params.row.goodsType === 'PHYSICAL_GOODS') { + return h("div", "实物商品"); + } else if (params.row.goodsType === 'VIRTUAL_GOODS') { + return h("div", "虚拟商品"); + } else { + return h("div", "电子卡券"); + } + }, + }, { title: "状态", key: "marketEnable", diff --git a/seller/src/views/goods/goods-seller/goods.vue b/seller/src/views/goods/goods-seller/goods.vue index c20f5c3e..df95601d 100644 --- a/seller/src/views/goods/goods-seller/goods.vue +++ b/seller/src/views/goods/goods-seller/goods.vue @@ -4,7 +4,7 @@
- + + + + - + @@ -45,11 +51,12 @@
- +
@@ -60,13 +67,14 @@ - + - +
@@ -78,7 +86,8 @@ - + 卖家承担运费 @@ -245,6 +254,20 @@ export default { ); }, }, + { + title: "商品类型", + key: "goodsType", + width: 130, + render: (h, params) => { + if (params.row.goodsType === 'PHYSICAL_GOODS') { + return h("div", "实物商品"); + } else if (params.row.goodsType === 'VIRTUAL_GOODS') { + return h("div", "虚拟商品"); + } else { + return h("div", "电子卡券"); + } + }, + }, { title: "商品价格", key: "price", @@ -432,10 +455,10 @@ export default { this.getDataList(); }, addGoods() { - this.$router.push({ name: "goods-operation" }); + this.$router.push({name: "goods-operation"}); }, editGoods(v) { - this.$router.push({ name: "goods-operation-edit", query: { id: v.id } }); + this.$router.push({name: "goods-operation-edit", query: {id: v.id}}); }, //批量操作 @@ -458,7 +481,7 @@ export default { } }, getStockDetail(id) { - getGoodsSkuListDataSeller({ goodsId: id, pageSize: 1000 }).then((res) => { + getGoodsSkuListDataSeller({goodsId: id, pageSize: 1000}).then((res) => { if (res.success) { this.updateStockModalVisible = true; this.stockAllUpdate = undefined; @@ -468,7 +491,7 @@ export default { }, updateStock() { let updateStockList = this.stockList.map((i) => { - let j = { skuId: i.id, quantity: i.quantity }; + let j = {skuId: i.id, quantity: i.quantity}; if (this.stockAllUpdate) { j.quantity = this.stockAllUpdate; } @@ -481,28 +504,28 @@ export default { } }); }, - changePage (v) { + changePage(v) { this.searchForm.pageNumber = v; this.getDataList(); this.clearSelectAll(); }, - changePageSize (v) { + changePageSize(v) { this.searchForm.pageSize = v; this.getDataList(); }, - handleSearch () { + handleSearch() { this.searchForm.pageNumber = 1; this.searchForm.pageSize = 10; this.getDataList(); }, - handleReset () { + handleReset() { this.searchForm = {}; this.searchForm.pageNumber = 1; this.searchForm.pageSize = 10; // 重新加载数据 this.getDataList(); }, - changeSort (e) { + changeSort(e) { this.searchForm.sort = e.key; this.searchForm.order = e.order; if (e.order === "normal") { @@ -510,15 +533,15 @@ export default { } this.getDataList(); }, - clearSelectAll () { + clearSelectAll() { this.$refs.table.selectAll(false); }, - changeSelect (e) { + changeSelect(e) { this.selectList = e; this.selectCount = e.length; }, //保存运费模板信息 - saveShipTemplate () { + saveShipTemplate() { if (this.shipTemplateForm.freightPayer == "STORE") { { this.shipTemplateForm.templateId = 0; @@ -716,10 +739,10 @@ export default { }); }, }, - mounted () { - this.init(); + mounted() { + this.init(); }, - activated () { + activated() { this.init(); }, }; From d3576b691cc388ce1c8335096a970b3c5035633b Mon Sep 17 00:00:00 2001 From: Chopper Date: Tue, 22 Jun 2021 15:16:02 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=95=86=E5=93=81=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E5=88=9D=E5=A7=8B=E5=8C=96=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- manager/src/views/goods/goods-info/goods.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/manager/src/views/goods/goods-info/goods.vue b/manager/src/views/goods/goods-info/goods.vue index 21271b7e..a63543e9 100644 --- a/manager/src/views/goods/goods-info/goods.vue +++ b/manager/src/views/goods/goods-info/goods.vue @@ -138,7 +138,6 @@ export default { pageSize: 10, // 页面大小 sort: "create_time", // 默认排序字段 order: "desc", // 默认排序方式 - goodsType: "", // 商品类型 }, underForm: { // 下架原因 reason: "", From 8e239a5bbfab4d4b63d2784488f53a16e37e027f Mon Sep 17 00:00:00 2001 From: Chopper Date: Tue, 22 Jun 2021 17:36:07 +0800 Subject: [PATCH 3/3] =?UTF-8?q?token=20=E8=A7=A3=E6=9E=90=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buyer/src/plugins/request.js | 104 +++++++++++++++++------------------ 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/buyer/src/plugins/request.js b/buyer/src/plugins/request.js index b937df34..7d3233d5 100644 --- a/buyer/src/plugins/request.js +++ b/buyer/src/plugins/request.js @@ -1,27 +1,27 @@ // import Vue from 'vue'; -import axios from "axios"; -import https from "https"; -import { Message, Spin, Modal } from "view-design"; -import Storage from "./storage"; -import config from "@/config"; -import router from "../router/index.js"; -import store from "../vuex/store"; -import { handleRefreshToken } from "@/api/index"; -const qs = require("qs"); +import axios from 'axios'; +import https from 'https'; +import { Message, Spin, Modal } from 'view-design'; +import Storage from './storage'; +import config from '@/config'; +import router from '../router/index.js'; +import store from '../vuex/store'; +import { handleRefreshToken } from '@/api/index'; +const qs = require('qs'); export const buyerUrl = - process.env.NODE_ENV === "development" + process.env.NODE_ENV === 'development' ? config.api_dev.buyer : config.api_prod.buyer; export const commonUrl = - process.env.NODE_ENV === "development" + process.env.NODE_ENV === 'development' ? config.api_dev.common : config.api_prod.common; export const managerUrl = - process.env.NODE_ENV === "development" + process.env.NODE_ENV === 'development' ? config.api_dev.manager : config.api_prod.manager; export const sellerUrl = - process.env.NODE_ENV === "development" + process.env.NODE_ENV === 'development' ? config.api_dev.seller : config.api_prod.seller; // 创建axios实例 @@ -35,7 +35,7 @@ const service = axios.create({ }), paramsSerializer: params => qs.stringify(params, { - arrayFormat: "repeat" + arrayFormat: 'repeat' }) }); @@ -44,15 +44,15 @@ service.interceptors.request.use( config => { const { loading } = config; // 如果是put/post请求,用qs.stringify序列化参数 - const isPutPost = config.method === "put" || config.method === "post"; - const isJson = config.headers["Content-Type"] === "application/json"; - const isFile = config.headers["Content-Type"] === "multipart/form-data"; + const isPutPost = config.method === 'put' || config.method === 'post'; + const isJson = config.headers['Content-Type'] === 'application/json'; + const isFile = config.headers['Content-Type'] === 'multipart/form-data'; if (isPutPost && isJson) { config.data = JSON.stringify(config.data); } if (isPutPost && !isFile && !isJson) { config.data = qs.stringify(config.data, { - arrayFormat: "repeat" + arrayFormat: 'repeat' }); } /** 配置全屏加载 */ @@ -60,16 +60,16 @@ service.interceptors.request.use( config.loading = Spin.show(); } - const uuid = Storage.getItem("uuid"); - config.headers["uuid"] = uuid; + const uuid = Storage.getItem('uuid'); + config.headers['uuid'] = uuid; // 获取访问Token - let accessToken = Storage.getItem("accessToken"); + let accessToken = Storage.getItem('accessToken'); if (accessToken && config.needToken) { - config.headers["accessToken"] = accessToken; + 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() @@ -83,33 +83,33 @@ service.interceptors.request.use( } ); -async function refresh() { +async function refresh () { const getTokenRes = await refreshToken(); - if (getTokenRes === "success") { + if (getTokenRes === 'success') { // 刷新token if (isRefreshToken === 1) { error.response.config.headers.accessToken = Storage.getItem( - "accessToken" + 'accessToken' ); return service(error.response.config); } else { router.go(0); } } else { - Storage.removeItem("accessToken"); - Storage.removeItem("refreshToken"); - Storage.removeItem("userInfo"); - Storage.setItem("cartNum", 0); - store.commit("SET_CARTNUM", 0); - console.log("1111"); + Storage.removeItem('accessToken'); + Storage.removeItem('refreshToken'); + Storage.removeItem('userInfo'); + Storage.setItem('cartNum', 0); + store.commit('SET_CARTNUM', 0); + console.log('1111'); Modal.confirm({ - title: "请登录", - content: "

请登录后执行此操作

", - okText: "立即登录", - cancelText: "继续浏览", + title: '请登录', + content: '

请登录后执行此操作

', + okText: '立即登录', + cancelText: '继续浏览', onOk: () => { router.push({ - path: "/login", + path: '/login', query: { rePath: router.history.current.path, query: JSON.stringify(router.history.current.query) @@ -146,9 +146,9 @@ service.interceptors.response.use( } else { if (error.message) { let _message = - error.code === "ECONNABORTED" - ? "连接超时,请稍候再试!" - : "网络错误,请稍后再试!"; + error.code === 'ECONNABORTED' + ? '连接超时,请稍候再试!' + : '网络错误,请稍后再试!'; Message.error(errorData.message || _message); } } @@ -171,13 +171,13 @@ const closeLoading = target => { }; export const Method = { - GET: "get", - POST: "post", - PUT: "put", - DELETE: "delete" + GET: 'get', + POST: 'post', + PUT: 'put', + DELETE: 'delete' }; -export default function request(options) { +export default function request (options) { // 如果是服务端或者是请求的刷新token,不需要检查token直接请求。 // if (process.server || options.url.indexOf('passport/token') !== -1) { return service(options); @@ -186,19 +186,19 @@ export default function request(options) { } // 防抖闭包来一波 -function getTokenDebounce() { +function getTokenDebounce () { let lock = false; let success = false; - return function() { + return function () { if (!lock) { lock = true; - let oldRefreshToken = Storage.getItem("refreshToken"); + let oldRefreshToken = Storage.getItem('refreshToken'); handleRefreshToken(oldRefreshToken) .then(res => { if (res.success) { let { accessToken, refreshToken } = res.result; - Storage.setItem("accessToken", accessToken); - Storage.setItem("refreshToken", refreshToken); + Storage.setItem('accessToken', accessToken); + Storage.setItem('refreshToken', refreshToken); success = true; lock = false; @@ -220,9 +220,9 @@ function getTokenDebounce() { if (!lock) { clearInterval(timer); if (success) { - resolve("success"); + resolve('success'); } else { - resolve("fail"); + resolve('fail'); } } }, 500); // 轮询时间间隔