Forráskód Böngészése

消息对接 订单 点赞 消息已读接口对接

743180155@qq.com 1 éve
szülő
commit
f21f62912d

+ 13 - 21
package-lock.json

@@ -4169,27 +4169,6 @@
         "whatwg-fetch": "^3.6.2"
       },
       "dependencies": {
-        "@vue/vue-loader-v15": {
-          "version": "npm:vue-loader@15.11.1",
-          "resolved": "https://registry.npmmirror.com/vue-loader/-/vue-loader-15.11.1.tgz",
-          "integrity": "sha512-0iw4VchYLePqJfJu9s62ACWUXeSqM30SQqlIftbYWM3C+jpPcEHKSPUZBLjSF9au4HTHQ/naF6OGnO3Q/qGR3Q==",
-          "dev": true,
-          "requires": {
-            "@vue/component-compiler-utils": "^3.1.0",
-            "hash-sum": "^1.0.2",
-            "loader-utils": "^1.1.0",
-            "vue-hot-reload-api": "^2.3.0",
-            "vue-style-loader": "^4.1.0"
-          },
-          "dependencies": {
-            "hash-sum": {
-              "version": "1.0.2",
-              "resolved": "https://registry.npmmirror.com/hash-sum/-/hash-sum-1.0.2.tgz",
-              "integrity": "sha512-fUs4B4L+mlt8/XAtSOGMUO1TXmAelItBPtJG7CyHJfYTdDjwisntGO2JQz7oUsatOY9o68+57eziUVNw/mRHmA==",
-              "dev": true
-            }
-          }
-        },
         "acorn": {
           "version": "8.8.2",
           "resolved": "https://registry.npmmirror.com/acorn/-/acorn-8.8.2.tgz",
@@ -4325,6 +4304,19 @@
       "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.4.4.tgz",
       "integrity": "sha512-abSgiVRhfjfl3JALR/cSuBl74hGJ3SePgf1mKzodf1eMWLwHZbfEGxT2cNJSsNiw44jEgrO7bNkhchaWA7RwNw=="
     },
+    "@vue/vue-loader-v15": {
+      "version": "npm:vue-loader@15.11.1",
+      "resolved": "https://registry.npmmirror.com/vue-loader/-/vue-loader-15.11.1.tgz",
+      "integrity": "sha512-0iw4VchYLePqJfJu9s62ACWUXeSqM30SQqlIftbYWM3C+jpPcEHKSPUZBLjSF9au4HTHQ/naF6OGnO3Q/qGR3Q==",
+      "dev": true,
+      "requires": {
+        "@vue/component-compiler-utils": "^3.1.0",
+        "hash-sum": "^1.0.2",
+        "loader-utils": "^1.1.0",
+        "vue-hot-reload-api": "^2.3.0",
+        "vue-style-loader": "^4.1.0"
+      }
+    },
     "@vue/web-component-wrapper": {
       "version": "1.3.0",
       "resolved": false,

+ 20 - 6
src/api/client/message.js

@@ -6,7 +6,7 @@ import request from '@/utils/request';
 export function clientCommentList(data) {
   return request({
     url: '/maintain/client/comment/page',
-    methods: 'get',
+    method: 'get',
     data: data,
     headers: {
       'content-type': 'application/x-www-form-urlencoded',
@@ -32,7 +32,7 @@ export function addClientComment(data) {
 export function getIsHaveNewInform(data) {
   return request({
     url: '/maintain/new/inform',
-    methods: 'get',
+    method: 'get',
     data: data,
     headers: {
       'content-type': 'application/x-www-form-urlencoded',
@@ -46,7 +46,7 @@ export function getIsHaveNewInform(data) {
 export function getOrderInform(data) {
   return request({
     url: '/maintain/order/inform',
-    methods: 'get',
+    method: 'get',
     data: data,
     headers: {
       'content-type': 'application/x-www-form-urlencoded',
@@ -60,7 +60,7 @@ export function getOrderInform(data) {
 export function getOrderCommentInform(data) {
   return request({
     url: '/maintain/comment/inform',
-    methods: 'get',
+    method: 'get',
     data: data,
     headers: {
       'content-type': 'application/x-www-form-urlencoded',
@@ -74,7 +74,7 @@ export function getOrderCommentInform(data) {
 export function getEvaluateInform(data) {
   return request({
     url: '/maintain/evaluate/inform',
-    methods: 'get',
+    method: 'get',
     data: data,
     headers: {
       'content-type': 'application/x-www-form-urlencoded',
@@ -88,7 +88,21 @@ export function getEvaluateInform(data) {
 export function getCouponInform(data) {
   return request({
     url: '/maintain/coupon/inform',
-    methods: 'get',
+    method: 'get',
+    data: data,
+    headers: {
+      'content-type': 'application/x-www-form-urlencoded',
+    },
+  });
+}
+
+/**
+ *@description 订单通知接口 - 将新系统通知标识未读改为已读
+ */
+export function clearInformFlag(data) {
+  return request({
+    url: '/maintain/system/inform/flag',
+    method: 'PUT',
     data: data,
     headers: {
       'content-type': 'application/x-www-form-urlencoded',

+ 7 - 1
src/pages/client/clientPackage/message/LikeReply/index.vue

@@ -22,7 +22,7 @@
 </template>
 
 <script>
-import { getEvaluateInform } from '@/api/client/message.js';
+import { getEvaluateInform , clearInformFlag } from '@/api/client/message.js';
 export default {
   data() {
     return {
@@ -37,6 +37,12 @@ export default {
   mounted(){
     this.handlerInitList()
   },
+  
+  onShow(){
+  	clearInformFlag({type:'EVALUATE'}).then(res=>{
+  		console.log("@@@res",res)
+  	})
+  },
   methods: {
     handlerInitList(){
       getEvaluateInform(this.queryParams).then(res=>{

+ 7 - 1
src/pages/client/clientPackage/message/evaluateNotice/index.vue

@@ -40,7 +40,7 @@
 </template>
 
 <script>
-  import { getOrderCommentInform } from '@/api/client/message.js';
+  import { getOrderCommentInform , clearInformFlag } from '@/api/client/message.js';
 export default {
   data(){
     return{
@@ -53,6 +53,12 @@ export default {
   mounted(){
     this.handlerInitList()
   },
+  
+  onShow(){
+  	clearInformFlag({type:'COMMENT'}).then(res=>{
+  		console.log("@@@res",res)
+  	})
+  },
   methods: {
     handlerInitList(){
       getOrderCommentInform(this.queryParams).then(res=>{

+ 25 - 4
src/pages/client/clientPackage/message/orderNotice/index.vue

@@ -10,7 +10,7 @@
       </view>
       <view>
         <view class="fl-flex-item title">
-          <view class="text-bold text-black">订单支付成功</view>
+          <view class="text-bold text-black">订单{{ item.orderType }}</view>
           <view class="f-s-20 text-gray">{{ item.createTimeText }}</view>
         </view>
         <view class="fl-flex content">
@@ -25,9 +25,9 @@
     </view>
   </view>
 </template>
-
+			<!-- 0->待付款;1-已付款;2->待发货;3->已发货;4->已完成;5->已关闭;6->无效订单 -->
 <script>
-  import { getOrderInform } from '@/api/client/message.js';
+  import { getOrderInform , clearInformFlag } from '@/api/client/message.js';
 export default {
   data() {
     return {
@@ -37,16 +37,37 @@ export default {
       },
 	  current:1,
 	  size:10,
-	  init_list:[]
+	  init_list:[],
+	  typeEnum:[
+		  { type:0 , name:'待付款' },
+		  { type:1 , name:'已付款' },
+		  { type:2 , name:'待发货' },
+		  { type:3 , name:'已发货' },
+		  { type:4 , name:'已完成' },
+		  { type:5 , name:'已关闭' },
+		  { type:6 , name:'无效订单' },
+	  ]
     };
   },
   mounted(){
     this.handlerInitList()
   },
+  onShow(){
+	  // 已读消息
+	clearInformFlag({type:'ORDER'}).then(res=>{
+	})
+  },
   methods: {
     handlerInitList(){
       getOrderInform(this.queryParams).then(res=>{
 		this.init_list = res.data.records
+		this.init_list.map(rs=>{
+			 this.typeEnum.map(rc=>{
+				 if(rs.orderStatus == rc.type){
+					 rs.orderType = rc.name
+				 }
+			 })
+		})
 		this.init_list.map(rs=>{
 			rs.createTimeText = uni.$u.timeFormat(rs.createTime, 'yyyy-mm-dd');
 		})

+ 1 - 1
src/pages/client/clientPackage/orderAll.vue

@@ -36,7 +36,7 @@
                 </view>
               </view>
               <view class="r-r">
-                <view class="r-item" @click.stop="handlerSkipComment(item, itm)" v-if="type == 3">
+                <view class="r-item" @click.stop="handlerSkipComment(item, itm)" v-if="type == 4">
                   <u-icon name="chat" color="#000" size="28"></u-icon>
                   <span>评价</span>
                 </view>

+ 11 - 11
src/pages/client/tabBar/home/index.vue

@@ -229,17 +229,17 @@
             this.handlerGetRegion(longitude.toFixed(5), latitude.toFixed(5))
           },
           fail: err => {
-            uni.showModal({
-              title: '提示',
-              content: '这是一个模态弹窗',
-              success: function(res) {
-                if (res.confirm) {
-                  console.log('用户点击确定');
-                } else if (res.cancel) {
-                  console.log('用户点击取消');
-                }
-              }
-            });
+            // uni.showModal({
+            //   title: '提示',
+            //   content: '这是一个模态弹窗',
+            //   success: function(res) {
+            //     if (res.confirm) {
+            //       console.log('用户点击确定');
+            //     } else if (res.cancel) {
+            //       console.log('用户点击取消');
+            //     }
+            //   }
+            // });
           }
         });
       },

+ 19 - 20
src/pages/client/tabBar/message/index.vue

@@ -73,14 +73,14 @@
             url: '/pages/client/clientPackage/message/orderNotice/index',
             numb:0
           },
-          {
-            id: '3',
-            img: '/static/icon/tools.png',
-            name: '支付通知',
-            text: '暂无支付通知。',
-            url: '/pages/client/clientPackage/message/orderNotice/index',
-            numb:0
-          },
+          // {
+          //   id: '3',
+          //   img: '/static/icon/tools.png',
+          //   name: '支付通知',
+          //   text: '暂无支付通知。',
+          //   url: '/pages/client/clientPackage/message/orderNotice/index',
+          //   numb:0
+          // },
           {
             id: '2',
             img: '/static/icon/tools.png',
@@ -113,9 +113,9 @@
     },
     onShow() {
       /* 隐藏原生的tabbar */
-      uni.hideTabBar({
-        animation: false,
-      });
+      // uni.hideTabBar({
+      //   animation: false,
+      // });
       this.handlerGetSystemNewInform()
     },
     computed: {
@@ -127,22 +127,21 @@
       // 获取订单详细通知 是否有系统新消息
       handlerGetSystemNewInform() {
         getIsHaveNewInform().then(res => {
-          console.log("@@@@res", res)
 		  let { order , pay , comment , evaluate , coupon} = res.data
           this.orderList[0].numb = order
           order ? this.orderList[0].text = `您有${order}条订单信息` : this.orderList[0].text = '暂无订单通知'
 		  
-          this.orderList[1].numb = pay
-		  pay ? this.orderList[1].text = `您有${pay}条订单信息` : this.orderList[1].text = '暂无支付通知'
+    //       this.orderList[1].numb = pay
+		  // pay ? this.orderList[1].text = `您有${pay}条订单信息` : this.orderList[1].text = '暂无支付通知'
 		  
-          this.orderList[2].numb = comment
-		  comment ? this.orderList[2].text = `您有${comment}条订单信息` : this.orderList[2].text = '暂无评价通知'
+          this.orderList[1].numb = comment
+		  comment ? this.orderList[1].text = `您有${comment}条订单信息` : this.orderList[2].text = '暂无评价通知'
 		  
-          this.orderList[3].numb = evaluate
-		  evaluate ? this.orderList[3].text = `您有${evaluate}条订单信息` : this.orderList[3].text = '暂无点赞回复'
+          this.orderList[2].numb = evaluate
+		  evaluate ? this.orderList[2].text = `您有${evaluate}条订单信息` : this.orderList[3].text = '暂无点赞回复'
 		  
-          this.orderList[4].numb = coupon
-		  coupon ? this.orderList[4].text = `您有${coupon}条订单信息` : this.orderList[4].text = '暂无优惠福利通知'
+          this.orderList[3].numb = coupon
+		  coupon ? this.orderList[3].text = `您有${coupon}条订单信息` : this.orderList[4].text = '暂无优惠福利通知'
         })
       },
       changeInfo(index) {

+ 145 - 143
src/utils/request.js

@@ -1,163 +1,165 @@
 import axios from "axios";
 import {
-  UniAdapter
+	UniAdapter
 } from 'uniapp-axios-adapter'
 import store from '@/store'
 import {
-  getAccessToken,
-  setAccessToken,
-  setRefreshToken,
-  refreshToken,
-  isRefreshRequest
+	getAccessToken,
+	setAccessToken,
+	setRefreshToken,
+	refreshToken,
+	isRefreshRequest
 } from "./auth"
 
 // 每次请求都创建一个新的实例
 const instance = axios.create({
-  // baseURL: "https://test.api.chelvc.com",
-  baseURL: "http://192.168.68.77:11000",
-  timeout: 10000,
-  adapter: UniAdapter
+	// baseURL: "https://test.api.chelvc.com",
+	// baseURL: "http://192.168.68.77:11000",
+	baseURL: "https://358175z5l5.yicp.fun",
+	timeout: 10000,
+	adapter: UniAdapter
 });
 
 instance.interceptors.request.use((config) => {
-  uni.showLoading({
-    title: '加载中'
-  })
-  // 带上token 和其他请求头信息
-  if (store.getters.accessToken) {
-    config.headers['Authorization'] = `Bearer ${getAccessToken()}`
-  }
-  config.headers = {
-    ...config.headers,
-    platform: store.getters.app.system.osName.toUpperCase(),
-    terminal: 'APPLET', // TODO:
-    version: store.getters.app.system.appVersion.toUpperCase(),
-    // scope: store.getters.scope,
-    device: store.getters.app.system.deviceId,
-    timestamp: new Date().getTime()
-  }
-  return config
+	uni.showLoading({
+		title: '加载中'
+	})
+	// 带上token 和其他请求头信息
+	if (store.getters.accessToken) {
+		config.headers['Authorization'] = `Bearer ${getAccessToken()}`
+	}
+	console.log("@@@@config",config)
+	config.headers = {
+		...config.headers,
+		platform: store.getters.app.system.osName.toUpperCase(),
+		terminal: 'APPLET', // TODO:
+		version: store.getters.app.system.appVersion.toUpperCase(),
+		// scope: store.getters.scope,
+		device: store.getters.app.system.deviceId,
+		timestamp: new Date().getTime()
+	}
+	return config
 })
 
 instance.interceptors.response.use(async (res) => {
-  uni.hideLoading()
-  const {
-    code,
-    data,
-    message
-  } = res.data
-  if (data && data.accessToken) {
-    setAccessToken(data.accessToken)
-  }
-  if (data && data.refreshToken) {
-    setRefreshToken(data.refreshToken)
-  }
-  // 未知错误
-  if (code === 'ERROR') {
-    uni.showToast({
-      title: `${message ? message :'未知错误'}`,
-      icon: 'none'
-    })
-    return res.data
-  }
-  // 请求错误
-  if (code === 'BAD_REQUEST') {
-    uni.showToast({
-      title: `${message ? message :'请求异常'}`,
-      icon: 'none'
-    })
-    return res.data
-  }
-  // 拒绝访问
-  if (code === 'FORBIDDEN') {
-    uni.showToast({
-      title: `${message ? message :'拒绝访问'}`,
-      icon: 'none'
-    })
-    return
-  }
-  // 请求参数异常
-  if (code === 'PARAMETER_INVALID') {
-    const errorTextList = Object.keys(res.data.data).map(key => {
-      return res.data.data[key]
-    })
-    uni.showToast({
-      title: errorTextList.join(','),
-      icon: 'none'
-    })
-    return res.data
-  }
-  // 访问资源异常
-  if (code === 'UNAVAILABLE') {
-    uni.showToast({
-      title: `${message ? message :'访问资源不可用'}`,
-      icon: 'none'
-    })
-    return
-  }
-  // 未登录
-  if (code === 'UNAUTHORIZED') {
-    uni.navigateTo({
-      url: '/pages/login/index'
-    })
-    return res.data
-  }
-  // 身份切换
-  if (code === 'SCOPE_CHANGED') {
-    uni.reLaunch({
-      url: '/pages/login/index'
-    })
-    uni.showToast({
-      title: '您的身份信息已切换',
-      icon: 'none',
-    })
-    return res.data
-  }
-  if (code === 'TOKEN_CHANGED') {
-    uni.showModal({
-      title: '提示',
-      content: res.data.messsage,
-      showCancel: false,
-      success: (res) => {
-        if (res.confirm) {
-          // 小程序用户跳转到我的页面 , 登录状态为未登录
+	uni.hideLoading()
+	const {
+		code,
+		data,
+		message
+	} = res.data
+	if (data && data.accessToken) {
+		setAccessToken(data.accessToken)
+	}
+	if (data && data.refreshToken) {
+		setRefreshToken(data.refreshToken)
+	}
+	// 未知错误
+	if (code === 'ERROR') {
+		uni.showToast({
+			title: `${message ? message :'未知错误'}`,
+			icon: 'none'
+		})
+		return res.data
+	}
+	// 请求错误
+	if (code === 'BAD_REQUEST') {
+		uni.showToast({
+			title: `${message ? message :'请求异常'}`,
+			icon: 'none'
+		})
+		return res.data
+	}
+	// 拒绝访问
+	if (code === 'FORBIDDEN') {
+		uni.showToast({
+			title: `${message ? message :'拒绝访问'}`,
+			icon: 'none'
+		})
+		return
+	}
+	// 请求参数异常
+	if (code === 'PARAMETER_INVALID') {
+		const errorTextList = Object.keys(res.data.data).map(key => {
+			return res.data.data[key]
+		})
+		uni.showToast({
+			title: errorTextList.join(','),
+			icon: 'none'
+		})
+		return res.data
+	}
+	// 访问资源异常
+	if (code === 'UNAVAILABLE') {
+		uni.showToast({
+			title: `${message ? message :'访问资源不可用'}`,
+			icon: 'none'
+		})
+		return
+	}
+	// 未登录
+	if (code === 'UNAUTHORIZED') {
+		uni.navigateTo({
+			url: '/pages/login/index'
+		})
+		return res.data
+	}
+	// 身份切换
+	if (code === 'SCOPE_CHANGED') {
+		uni.reLaunch({
+			url: '/pages/login/index'
+		})
+		uni.showToast({
+			title: '您的身份信息已切换',
+			icon: 'none',
+		})
+		return res.data
+	}
+	if (code === 'TOKEN_CHANGED') {
+		uni.showModal({
+			title: '提示',
+			content: res.data.messsage,
+			showCancel: false,
+			success: (res) => {
+				if (res.confirm) {
+					// 小程序用户跳转到我的页面 , 登录状态为未登录
 
-        }
-      }
-    })
-    return res.data
-  }
-  // token过期处理
-  if (code === 'TOKEN_EXPIRED' && !isRefreshRequest(res.config)) {
-    // 刷新token
-    const isSuccess = await refreshToken()
-    if (isSuccess) {
-      // 重新请求
-      instance.config.headers.authorization = `Bearer ${getAccessToken()}`
-      const resp = await instance.request(res.config)
-      return resp
-    } else {
-      // 无权限
-      store.commit('SET_ACCESS_TOKEN', '')
-      store.commit('SET_REFRESH_TOKEN', '')
-      uni.showModal({
-        title: '提示',
-        content: "您的登录信息已过期,请重新登录",
-        showCancel: false,
-        success: (res) => {
-          uni.navigateTo({
-            url: '/pages/login/index'
-          })
-        }
-      })
-      return res.data
-    }
+				}
+			}
+		})
+		return res.data
+	}
+	// token过期处理
+	if (code === 'TOKEN_EXPIRED' && !isRefreshRequest(res.config)) {
+		// 刷新token
+		const isSuccess = await refreshToken()
+		if (isSuccess) {
+			// 重新请求
+			instance.config.headers.authorization = `Bearer ${getAccessToken()}`
+			const resp = await instance.request(res.config)
+			return resp
+		} else {
+			// 无权限
+			store.commit('SET_ACCESS_TOKEN', '')
+			store.commit('SET_REFRESH_TOKEN', '')
+			uni.showModal({
+				title: '提示',
+				content: "您的登录信息已过期,请重新登录",
+				showCancel: false,
+				success: (res) => {
+					uni.navigateTo({
+						url: '/pages/login/index'
+					})
+				}
+			})
+			return res.data
+		}
 
-  }
-  return res.data
+	}
+	return res.data
 }, (err) => {
-  console.log("->", err)
-  uni.hideLoading()
+	console.log("->", err)
+	uni.hideLoading()
 });
 
-export default instance;
+export default instance;