From 4700bc995a9dbe9cd50b1ba18b8352435e91884d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A6=E4=B9=A0=E5=BE=88=E5=B7=AE=E5=95=A6?= <17633066053@163.com> Date: Wed, 1 Mar 2023 14:59:54 +0800 Subject: [PATCH 1/6] =?UTF-8?q?feat:=20:sparkles:=20=E4=BC=98=E5=8C=96im?= =?UTF-8?q?=20=E6=8E=A5=E5=8F=A3403=E5=88=A4=E5=AE=9A=EF=BC=8C=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E4=BB=8E=E4=B9=B0=E5=AE=B6=E7=AB=AF=E4=BB=A5=E5=8F=8A?= =?UTF-8?q?=E5=8D=96=E5=AE=B6=E7=AB=AF=E8=BF=9B=E8=A1=8C=E8=B7=B3=E8=BD=AC?= =?UTF-8?q?im=E6=9D=83=E9=99=90=E5=88=A4=E5=AE=9A=EF=BC=8C=E6=96=B0?= =?UTF-8?q?=E5=A2=9Eim=E6=8E=89=E7=BA=BF=E9=87=8D=E8=BF=9E=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=E9=87=8D=E8=BF=9E=E6=88=90=E5=8A=9F=E6=8F=90=E9=86=92?= =?UTF-8?q?=EF=BC=8C=E6=96=B0=E5=A2=9E=E5=8F=91=E9=80=81=E7=9A=84=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E6=96=AD=E7=BA=BF=E5=B0=86=E4=BC=9A=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E9=87=8D=E6=96=B0=E5=8F=91=E9=80=81=E6=B6=88=E6=81=AF=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=EF=BC=8C=E4=BC=98=E5=8C=96=E6=9C=80=E8=BF=91=E6=B5=8F?= =?UTF-8?q?=E8=A7=88=20=E8=AE=A2=E5=8D=95=E5=88=97=E8=A1=A8=E7=A9=BA?= =?UTF-8?q?=E5=B1=95=E7=A4=BA=E3=80=82=E6=B3=A8=E9=87=8A=E9=83=A8=E5=88=86?= =?UTF-8?q?im=E6=89=93=E5=8D=B0=E7=9A=84=E6=97=A5=E5=BF=97=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buyer/src/components/mixes/talkIm.vue | 43 +++++++ buyer/src/pages/GoodsDetail.vue | 46 +------ buyer/src/pages/Merchant.vue | 32 +---- im/src/components/chat/panel/TalkPanel.vue | 74 ++++++++--- .../chat/panel/template/footPrint.vue | 62 +++++++-- im/src/components/editor/MeEditor.vue | 1 - im/src/components/face.vue | 8 +- im/src/core/lazy-use.js | 3 +- im/src/plugins/ws-socket.js | 121 +++++++++++++----- im/src/store/modules/dialogue.js | 8 +- im/src/store/modules/talk.js | 1 + im/src/store/modules/user.js | 1 - im/src/store/state.js | 2 - im/src/utils/request.js | 11 +- im/src/views/message/index.vue | 4 +- seller/src/views/home/home.vue | 24 +++- 16 files changed, 288 insertions(+), 153 deletions(-) create mode 100644 buyer/src/components/mixes/talkIm.vue diff --git a/buyer/src/components/mixes/talkIm.vue b/buyer/src/components/mixes/talkIm.vue new file mode 100644 index 00000000..a51c1ad4 --- /dev/null +++ b/buyer/src/components/mixes/talkIm.vue @@ -0,0 +1,43 @@ + + + + + diff --git a/buyer/src/pages/GoodsDetail.vue b/buyer/src/pages/GoodsDetail.vue index 929db852..949eb115 100644 --- a/buyer/src/pages/GoodsDetail.vue +++ b/buyer/src/pages/GoodsDetail.vue @@ -50,8 +50,7 @@ import { getGoodsDistribution, } from "@/api/member"; import { getDetailById } from "@/api/shopentry"; -import { getIMDetail } from "@/api/common"; -import Storage from "../plugins/storage"; +import imTalk from '@/components/mixes/talkIm' export default { name: "GoodsDetail", beforeRouteEnter (to, from, next) { @@ -61,6 +60,7 @@ export default { created () { this.getGoodsDetail(); }, + mixins: [imTalk], data () { return { goodsMsg: {}, // 商品信息 @@ -68,49 +68,11 @@ export default { categoryBar: [], // 分类 storeCollected: false, // 商品收藏 storeMsg: {}, // 店铺信息 - IMLink: "", + }; }, methods: { - // 跳转im客服 - async IMService () { - // 获取访问Token - let accessToken = Storage.getItem("accessToken"); - await this.getIMDetailMethods(); - if (!accessToken) { - this.$Message.error("请登录后再联系客服"); - return; - } - window.open( - this.IMLink + - "?token=" + - accessToken + - "&id=" + - this.goodsMsg.data.storeId + - "&goodsId=" + - this.goodsMsg.data.goodsId + - "&skuId=" + - this.goodsMsg.data.id - ); - // window.open( - // 'http://192.168.0.139:8000/' + - // "?token=" + - // accessToken + - // "&id=" + - // this.goodsMsg.data.storeId + - // "&goodsId=" + - // this.goodsMsg.data.goodsId + - // "&skuId=" + - // this.goodsMsg.data.id - // ); - }, - // 获取im信息 - async getIMDetailMethods () { - let res = await getIMDetail(); - if (res.success) { - this.IMLink = res.result; - } - }, + // 点击规格 targetClickSku (val) { this.getGoodsDetail(val); diff --git a/buyer/src/pages/Merchant.vue b/buyer/src/pages/Merchant.vue index e99caeef..b76609c0 100644 --- a/buyer/src/pages/Merchant.vue +++ b/buyer/src/pages/Merchant.vue @@ -106,8 +106,7 @@ \ No newline at end of file diff --git a/im/src/components/editor/MeEditor.vue b/im/src/components/editor/MeEditor.vue index 345297ba..0c301fed 100644 --- a/im/src/components/editor/MeEditor.vue +++ b/im/src/components/editor/MeEditor.vue @@ -173,7 +173,6 @@ export default { methods: { // 读取对话编辑草稿信息 并赋值给当前富文本 getDraftText (index_name) { - console.log("findTalk(index_name)", findTalk(index_name)); return findTalk(index_name)?.draft_text || ""; }, diff --git a/im/src/components/face.vue b/im/src/components/face.vue index 9f4d6709..2ef80ab3 100644 --- a/im/src/components/face.vue +++ b/im/src/components/face.vue @@ -1,5 +1,5 @@ diff --git a/im/src/core/lazy-use.js b/im/src/core/lazy-use.js index 43a07afd..38ea74d0 100644 --- a/im/src/core/lazy-use.js +++ b/im/src/core/lazy-use.js @@ -85,5 +85,4 @@ Vue.prototype.$alert = MessageBox.alert import Contextmenu from 'vue-contextmenujs' Vue.use(Contextmenu) -process.env.NODE_ENV !== 'production' && - console.warn('[Lumen-IM] NOTICE: element-ui use lazy-load.') + diff --git a/im/src/plugins/ws-socket.js b/im/src/plugins/ws-socket.js index 69a3ac8b..234b6329 100644 --- a/im/src/plugins/ws-socket.js +++ b/im/src/plugins/ws-socket.js @@ -1,3 +1,6 @@ +import { Notification, MessageBox } from "element-ui"; +let wsSignIn; // ws 是否是掉线状态 +import store from "@/store"; class WsSocket { /** * Websocket 连接 @@ -25,7 +28,7 @@ class WsSocket { reconnect: { lockReconnect: false, setTimeout: null, // 计时器对象 - time: 5000, // 重连间隔时间 + time: 1000, // 重连间隔时间 number: 1000, // 重连次数 }, }; @@ -49,9 +52,9 @@ class WsSocket { // 定义 WebSocket 原生方法 this.events = Object.assign( { - onError: (evt) => { }, - onOpen: (evt) => { }, - onClose: (evt) => { }, + onError: (evt) => {}, + onOpen: (evt) => {}, + onClose: (evt) => {}, }, events ); @@ -63,7 +66,7 @@ class WsSocket { * @param {String} event 事件名 * @param {Function} callBack 回调方法 */ - on (event, callBack) { + on(event, callBack) { // 对应 socket-instance.js this.onCallBacks[event] = callBack; return this; @@ -72,7 +75,23 @@ class WsSocket { /** * 加载 WebSocket */ - loadSocket () { + loadSocket() { + /** + * 判断当前如果是掉线提示 + * 重连成功后关闭掉线提示,新增重连提示 + */ + if (wsSignIn) { + store.commit('SET_WS_STATUS',true); + wsSignIn.close(); + + Notification({ + title: "成功", + message: "重连成功", + type: "success", + position: "top-right", + duration: 1000, + }); + } // 判断当前是否已经连接 if (this.connect != null) { this.connect.close(); @@ -85,41 +104,72 @@ class WsSocket { connect.onopen = this.onOpen.bind(this); connect.onmessage = this.onMessage.bind(this); connect.onclose = this.onClose.bind(this); - this.connect = connect; } /** * 连接 Websocket */ - connection () { + connection() { this.loadSocket(); } /** * 掉线重连 Websocket */ - reconnect () { - console.log("掉线重连接"); + reconnect() { + + /** + * 长时间挂载页面中并且重连次数为空的时候进行提示 + */ + if (this.config.reconnect.number == 0) { + MessageBox("当前对话链接已失效,请从关闭重新进入。", "提示", { + confirmButtonText: "确定", + cancelButtonText: "取消", + closeOnPressEscape: false, + closeOnClickModal: false, + type: "warning", + }) + .then(() => { + window.close(); + Notification({ + title: "对话链接已失效提示", + message: "请手动关闭当前页面", + type: "error", + position: "top-right", + }); + }) + .catch(() => { + Notification({ + title: "对话链接已失效提示", + message: "请手动关闭当前页面", + type: "error", + position: "top-right", + }); + }); + return false; + } + // 掉线重连提示 + wsSignIn = Notification({ + title: "掉线重连接提示", + message: `网络连接已断开,正在尝试重新连接......`, + type: "error", + position: "top-right", + duration: 0, + }); + // 掉线更改消息状态 + store.commit('SET_WS_STATUS',true); let reconnect = this.config.reconnect; if (reconnect.lockReconnect || reconnect.number == 0) { return; } - this.config.reconnect.lockReconnect = true; - // 没连接上会一直重连,设置延迟避免请求过多 reconnect.setTimeout && clearTimeout(reconnect.setTimeout); - this.config.reconnect.setTimeout = setTimeout(() => { this.connection(); - this.config.reconnect.lockReconnect = false; this.config.reconnect.number--; - - console.log( - `网络连接已断开,正在尝试重新连接(${this.config.reconnect.number})...` - ); }, reconnect.time); } @@ -128,8 +178,7 @@ class WsSocket { * * @param {Object} evt Websocket 消息 */ - onParse (evt) { - + onParse(evt) { const res = JSON.parse(evt.data).result; //如果创建时间是时间戳类型则转换为 日期类型,否则新压入栈的消息的创建时间和从数据库读取出来的创建时间格式对不上,处理的时候会出异常。 @@ -145,7 +194,7 @@ class WsSocket { * @param format 转换格式 * @returns {*|string} */ - unixToDate (unix, format) { + unixToDate(unix, format) { if (!unix) return unix; let _format = format || "yyyy-MM-dd hh:mm:ss"; const d = new Date(unix); @@ -179,7 +228,7 @@ class WsSocket { * * @param {Object} evt Websocket 消息 */ - onOpen (evt) { + onOpen(evt) { this.events.onOpen(evt); if (this.config.heartbeat.enabled) { @@ -192,7 +241,7 @@ class WsSocket { * * @param {Object} evt Websocket 消息 */ - onClose (evt) { + onClose(evt) { console.log("关闭连接", evt); if (this.config.heartbeat.enabled) { clearInterval(this.config.heartbeat.setInterval); @@ -211,7 +260,7 @@ class WsSocket { * * @param {Object} evt Websocket 消息 */ - onError (evt) { + onError(evt) { this.events.onError(evt); } @@ -220,28 +269,30 @@ class WsSocket { * * @param {Object} evt Websocket 消息 */ - onMessage (evt) { + onMessage(evt) { let result = this.onParse(evt); - if (this.onParse(evt).text.includes('goodsName') || this.onParse(evt).text.includes('groupName')) { + if ( + this.onParse(evt).text.includes("goodsName") || + this.onParse(evt).text.includes("groupName") + ) { let params = { ...this.onParse(evt), - text: JSON.parse(this.onParse(evt).text) - } + text: JSON.parse(this.onParse(evt).text), + }; this.onCallBacks["event_talk"](params); } else { let params = { ...this.onParse(evt), - text: this.onParse(evt).text - } + text: this.onParse(evt).text, + }; this.onCallBacks["event_talk"](params); } // 指定推送消息 - } /** * WebSocket心跳检测 */ - heartbeat () { + heartbeat() { console.log("WebSocket心跳检测"); this.config.heartbeat.setInterval = setInterval(() => { this.connect.send("PING"); @@ -253,14 +304,14 @@ class WsSocket { * * @param {Object} message */ - send (message) { + send(message) { this.connect.send(JSON.stringify(message)); } /** * 关闭连接 */ - close () { + close() { this.connect.close(); } @@ -270,7 +321,7 @@ class WsSocket { * @param {String} event 事件名 * @param {Object} data 数据 */ - emit (event, data) { + emit(event, data) { if (this.connect && this.connect.readyState === 1) { this.connect.send(JSON.stringify(data)); } else { diff --git a/im/src/store/modules/dialogue.js b/im/src/store/modules/dialogue.js index 8876b364..259612e3 100644 --- a/im/src/store/modules/dialogue.js +++ b/im/src/store/modules/dialogue.js @@ -21,11 +21,15 @@ export default { float: "", }, ], - + webSocketWithOut:false, // ws 是否是掉线 无输出状态 // 对话索引(聊天对话的唯一索引) index_name: null, }, mutations: { + // 设置ws状态 + SET_WS_STATUS: (state,resource) =>{ + state.webSocketWithOut = resource + }, // 更新对话 UPDATE_DIALOGUE_MESSAGE (state, resource) { state.records = []; @@ -56,6 +60,8 @@ export default { // 推送对话记录 PUSH_DIALOGUE (state, record) { + record = {...record,webSocketStatus:state.webSocketWithOut} + console.log("推送对话",) state.records.push(record); }, diff --git a/im/src/store/modules/talk.js b/im/src/store/modules/talk.js index d52847d4..e7770c6f 100644 --- a/im/src/store/modules/talk.js +++ b/im/src/store/modules/talk.js @@ -37,6 +37,7 @@ const Talk = { talkNum: (state) => state.items.length, }, mutations: { + // 设置对话列表 SET_TALK_ITEMS (state, resource) { Vue.set(state, 'items', resource.items) diff --git a/im/src/store/modules/user.js b/im/src/store/modules/user.js index 995c4566..507a2f96 100644 --- a/im/src/store/modules/user.js +++ b/im/src/store/modules/user.js @@ -19,7 +19,6 @@ let state = { // 判断用户是否登录 if (getToken()) { let userInfo = getUserInfo(); - console.error(userInfo) state.name = userInfo.name; state.id = userInfo.id; state.face = userInfo.face ? userInfo.face : state.avatar; diff --git a/im/src/store/state.js b/im/src/store/state.js index e571ecaf..64c8f811 100644 --- a/im/src/store/state.js +++ b/im/src/store/state.js @@ -4,8 +4,6 @@ const defaultAvatar = require('@/assets/image/detault-avatar.jpg') const state = { socketStatus: false, website_name: process.env.VUE_APP_WEBSITE_NAME, - copyright: `©2020 - 2021 ${process.env.VUE_APP_WEBSITE_NAME} 在线聊天 Github源码`, - // 头像加载失败后的默认头像 defaultAvatar: "this.src='" + defaultAvatar + "'", } diff --git a/im/src/utils/request.js b/im/src/utils/request.js index 517b9d59..eedb8d92 100644 --- a/im/src/utils/request.js +++ b/im/src/utils/request.js @@ -14,6 +14,7 @@ const request = axios.create({ timeout: 20000, }); +let isRefreshing = false /** * 异常拦截处理器 * @@ -27,10 +28,12 @@ const errorHandler = (error) => { removeAll(); location.reload(); } else if (error.response.status == 403) { + if(!isRefreshing){ + /** * 403提示将重新从商家移动端进入当前页面 */ - MessageBox("当前登录已失效,请从商家管理后台重新登录。", "提示", { + MessageBox("当前登录已失效,请从关闭重新进入。", "提示", { confirmButtonText: "确定", cancelButtonText: "取消", closeOnPressEscape: false, @@ -38,6 +41,7 @@ const errorHandler = (error) => { type: "warning", }) .then(() => { + isRefreshing = true window.close(); Notification({ title:"登录失效提示", @@ -45,9 +49,10 @@ const errorHandler = (error) => { type:"error", position: "top-right", }); + }) .catch(() => { - + isRefreshing = true Notification({ title:"登录失效提示", message: "请手动关闭当前页面", @@ -55,6 +60,8 @@ const errorHandler = (error) => { position: "top-right", }); }); + isRefreshing = false + } } else if(error.response.status == 400){ Notification({ message: error.response.data.message, diff --git a/im/src/views/message/index.vue b/im/src/views/message/index.vue index ba327c57..7b65757f 100644 --- a/im/src/views/message/index.vue +++ b/im/src/views/message/index.vue @@ -9,7 +9,7 @@
- +

@@ -263,7 +263,7 @@ export default { }, unreadNum (value) { clearInterval(this.interval); - console.log("%c 更新未读消息", "color:#32ccbc"); + // console.log("%c 更新未读消息", "color:#32ccbc"); this.$store.commit("SET_UNREAD_NUM", value); if (value > 0) { diff --git a/seller/src/views/home/home.vue b/seller/src/views/home/home.vue index 36f03b44..16e56e9a 100644 --- a/seller/src/views/home/home.vue +++ b/seller/src/views/home/home.vue @@ -21,7 +21,7 @@

店铺状态:{{ userData.storeDisable == 'OPEN' ? '开启中' : '关闭' }}
- +
@@ -207,7 +207,7 @@ import { getSellerHomeData, getHomeNotice } from "@/api/index"; import { getIMDetail } from "@/api/common" import { seeArticle } from "@/api/pages"; import Cookies from "js-cookie"; - +import { userMsg } from "@/api/index"; export default { name: "home", data () { @@ -221,8 +221,10 @@ export default { title: "", }, IMLink: "", + load:false, //加载Im }; }, + methods: { // 跳转页面 navigateTo (name) { @@ -249,16 +251,24 @@ export default { this.noticeFlage = true; } }, + + /** + * 点击登录im的时候需要去判断一下当前店铺信息是否失效 + * 失效的话重新请求刷新token保证最新的token去访问im + */ async im () { // 获取访问Token let accessToken = this.getStore("accessToken"); + this.load = true await this.getIMDetailMethods(); - let res = await getIMDetail(); - if (!accessToken) { - this.$Message.error("请登录后再联系客服"); - return; + const userInfo = await userMsg(); + this.load = false + if (userInfo.success && this.IMLink) { + window.open(`${this.IMLink}?token=` + accessToken); + } + else{ + this.$Message.error("请登录后再联系客服"); } - window.open(`${res.result}?token=` + accessToken); }, // 获取im信息 From 40ccbf3edb103230ec602ae254ed53be417c4969 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A6=E4=B9=A0=E5=BE=88=E5=B7=AE=E5=95=A6?= <17633066053@163.com> Date: Wed, 1 Mar 2023 15:25:00 +0800 Subject: [PATCH 2/6] =?UTF-8?q?fix:=20:bug:=20=E4=B9=B0=E5=AE=B6=E7=AB=AFb?= =?UTF-8?q?uyer=20im=E4=BC=A0=E5=80=BC=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buyer/src/components/mixes/talkIm.vue | 5 +++-- buyer/src/pages/GoodsDetail.vue | 4 +++- buyer/src/pages/Merchant.vue | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/buyer/src/components/mixes/talkIm.vue b/buyer/src/components/mixes/talkIm.vue index a51c1ad4..a50e3cab 100644 --- a/buyer/src/components/mixes/talkIm.vue +++ b/buyer/src/components/mixes/talkIm.vue @@ -15,14 +15,15 @@ export default { }, methods: { // 跳转im客服 - async IMService() { + async IMService(id) { + // 获取访问Token let accessToken = Storage.getItem("accessToken"); await this.getIMDetailMethods(); const userInfo = await getMemberMsg(); if (userInfo.success) { window.open( - this.IMLink + "?token=" + accessToken + "&id=" + this.storeMsg.storeId + this.IMLink + "?token=" + accessToken + "&id=" + id || this.storeMsg.storeId ); } else { this.$Message.error("请登录后再联系客服"); diff --git a/buyer/src/pages/GoodsDetail.vue b/buyer/src/pages/GoodsDetail.vue index 949eb115..14870db6 100644 --- a/buyer/src/pages/GoodsDetail.vue +++ b/buyer/src/pages/GoodsDetail.vue @@ -22,7 +22,7 @@ {{ storeCollected? "已收藏店铺": "收藏店铺" }} - 联系客服 + 联系客服 @@ -127,11 +127,13 @@ export default { } }); } + if (!this.storeMsg) { // 获取店铺信息 getDetailById(this.goodsMsg.data.storeId).then((res) => { if (res.success) { this.storeMsg = res.result; + } }); } diff --git a/buyer/src/pages/Merchant.vue b/buyer/src/pages/Merchant.vue index b76609c0..3cf82442 100644 --- a/buyer/src/pages/Merchant.vue +++ b/buyer/src/pages/Merchant.vue @@ -14,7 +14,7 @@ :color="storeCollected ? '#ed3f14' : '#fff'"/>{{ storeCollected ? '已收藏店铺' : '收藏店铺' }} - 联系客服 @@ -220,6 +220,7 @@ export default { if (res.success) { this.storeMsg = res.result; + console.log(this.storeMsg) //判定如果开启楼层展示,则获取页面信息 否则读取商品信息 if (this.storeMsg.pageShow && this.storeMsg.pageShow === '1') { From ac0404adaa00888affd778e4d4174aa511ad2b10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A6=E4=B9=A0=E5=BE=88=E5=B7=AE=E5=95=A6?= <17633066053@163.com> Date: Wed, 1 Mar 2023 17:51:43 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E8=A1=A5=E5=85=85=E6=8F=90=E4=BA=A4im=20ws?= =?UTF-8?q?-socket=E4=B8=AD=E5=8F=91=E7=8E=B0=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- im/src/plugins/ws-socket.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/im/src/plugins/ws-socket.js b/im/src/plugins/ws-socket.js index 234b6329..21ecd690 100644 --- a/im/src/plugins/ws-socket.js +++ b/im/src/plugins/ws-socket.js @@ -105,6 +105,8 @@ class WsSocket { connect.onmessage = this.onMessage.bind(this); connect.onclose = this.onClose.bind(this); this.connect = connect; + + store.commit('SET_WS_STATUS',false); } /** From f72c28d770ec3993ce61504b633836354a4957ff Mon Sep 17 00:00:00 2001 From: chc <1501738723@qq.com> Date: Thu, 2 Mar 2023 17:55:36 +0800 Subject: [PATCH 4/6] =?UTF-8?q?fix:=20:bug:=20=E5=85=B3=E9=97=AD=E7=89=A9?= =?UTF-8?q?=E6=B5=81=E5=85=AC=E5=8F=B8=E4=BC=A0=E9=80=92=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E9=94=99=E8=AF=AF,css=20/deep/=E6=8B=BC=E5=86=99=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buyer/src/pages/home/memberCenter/Distribution.vue | 2 +- seller/src/views/shop/ship/logistics.vue | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/buyer/src/pages/home/memberCenter/Distribution.vue b/buyer/src/pages/home/memberCenter/Distribution.vue index 60c6fa55..019b3b1c 100644 --- a/buyer/src/pages/home/memberCenter/Distribution.vue +++ b/buyer/src/pages/home/memberCenter/Distribution.vue @@ -527,7 +527,7 @@ export default { top: -200px; left: 200px; } -/depp/ .ivu-alert-message { +/deep/ .ivu-alert-message { p { margin: 4px 0; } diff --git a/seller/src/views/shop/ship/logistics.vue b/seller/src/views/shop/ship/logistics.vue index d11b99b6..3346edd6 100644 --- a/seller/src/views/shop/ship/logistics.vue +++ b/seller/src/views/shop/ship/logistics.vue @@ -329,7 +329,7 @@ export default { content: "您确认关闭此物流公司?", loading: true, onOk: () => { - API_Shop.logisticsUnChecked(v.selected).then((res) => { + API_Shop.logisticsUnChecked(v.logisticsId).then((res) => { this.$Modal.remove(); if (res.success) { this.$Message.success("物流公司关闭成功"); From f7a9bff2ba2b488adc89fd5f72fbd99b3508b2e1 Mon Sep 17 00:00:00 2001 From: chc <1501738723@qq.com> Date: Mon, 6 Mar 2023 18:00:11 +0800 Subject: [PATCH 5/6] =?UTF-8?q?feat:=20:sparkles:=20=E9=9B=86=E6=88=90?= =?UTF-8?q?=E9=A1=BA=E4=B8=B0=E5=B9=B3=E5=8F=B0=EF=BC=8C=E5=8F=91=E8=B4=A7?= =?UTF-8?q?=EF=BC=8C=E6=9F=A5=E8=AF=A2=E7=89=A9=E6=B5=81=EF=BC=8C=E6=89=93?= =?UTF-8?q?=E5=8D=B0=E9=9D=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../setting/LOGISTICS_SETTING.vue | 44 +- seller/src/api/logistics.js | 10 + seller/src/api/order.js | 5 + seller/src/libs/axios.js | 32 + seller/src/views/order/order/orderDetail.vue | 761 ++++++++---------- 5 files changed, 437 insertions(+), 415 deletions(-) diff --git a/manager/src/views/sys/setting-manage/setting/LOGISTICS_SETTING.vue b/manager/src/views/sys/setting-manage/setting/LOGISTICS_SETTING.vue index fda005fe..98a154a8 100644 --- a/manager/src/views/sys/setting-manage/setting/LOGISTICS_SETTING.vue +++ b/manager/src/views/sys/setting-manage/setting/LOGISTICS_SETTING.vue @@ -5,21 +5,40 @@ 快递鸟 快递100 + 顺丰 - + - + - + - + +
+ + + + + + + + + + + + + + + + +
@@ -36,12 +55,13 @@ export default { formValidate: { // 表单数据 type: "", kdniaoEbusinessID: "", - kdniaoAppKey: "" , - kuaidi100Customer: "" , - kuaidi100Key: "" ,}, + kdniaoAppKey: "", + kuaidi100Customer: "", + kuaidi100Key: "", + }, }; }, - props: ["res",'type'], + props: ["res", 'type'], created() { this.init(); }, @@ -49,7 +69,7 @@ export default { // 验证 submit(name) { let that = this; - if( handleSubmit(that, name )){ + if (handleSubmit(that, name)) { this.setupSetting() } }, @@ -83,15 +103,17 @@ export default { +} diff --git a/seller/src/api/logistics.js b/seller/src/api/logistics.js index a74a861a..c0d7da8b 100644 --- a/seller/src/api/logistics.js +++ b/seller/src/api/logistics.js @@ -4,6 +4,7 @@ import { postRequest, putRequest, deleteRequest, + getRequestHasHeader, importRequest, getRequestWithNoToken } from "@/libs/axios"; @@ -35,4 +36,13 @@ export const getCheckedOn = params =>{ return getRequest(`/other/logistics/getCheckedFaceSheet`,params); } +//获取物流设置 +export const getLogisticsSetting = () =>{ + return getRequest(`/other/logistics/setting`); +} + +export const getShunFengFaceSheet = (url,headers) =>{ + return getRequestHasHeader(`${url}`,null,headers); +} + diff --git a/seller/src/api/order.js b/seller/src/api/order.js index ff709b67..0b20ac0f 100644 --- a/seller/src/api/order.js +++ b/seller/src/api/order.js @@ -81,6 +81,11 @@ export const orderDelivery = (sn, params) => { return postRequest(`/order/order/${sn}/delivery`, params); }; +// 订单发货 +export const orderShunFengDelivery = (sn) => { + return postRequest(`/order/order/${sn}/shunfeng/delivery`); +}; + // 获取商家选中的物流公司 export const getLogisticsChecked = () => { return getRequest(`/other/logistics/getChecked`); diff --git a/seller/src/libs/axios.js b/seller/src/libs/axios.js index 7642288c..031a79db 100644 --- a/seller/src/libs/axios.js +++ b/seller/src/libs/axios.js @@ -188,6 +188,38 @@ export const getRequest = (url, params, resBlob) => { return service(data); }; +export const getRequestHasHeader = (url, params, headers) => { + let accessToken = getStore("accessToken"); + let data = { + method: "get", + url: `${url}`, + params: params, + transformRequest: headers + ? undefined + : [ + function(data) { + let ret = ""; + for (let it in data) { + ret += + encodeURIComponent(it) + + "=" + + encodeURIComponent(data[it]) + + "&"; + } + ret = ret.substring(0, ret.length - 1); + return ret; + } + ], + headers: { + "Content-Type": "application/x-www-form-urlencoded", + accessToken: accessToken, + ...headers + }, + responseType: "blob" + }; + return service(data); +}; + export const postRequest = (url, params, headers) => { let accessToken = getStore("accessToken"); return service({ diff --git a/seller/src/views/order/order/orderDetail.vue b/seller/src/views/order/order/orderDetail.vue index cef64414..ddc012bb 100644 --- a/seller/src/views/order/order/orderDetail.vue +++ b/seller/src/views/order/order/orderDetail.vue @@ -2,179 +2,154 @@