pengyh hace 1 año
padre
commit
1d2f26363f

+ 18 - 0
src/api/readRecords.js

@@ -0,0 +1,18 @@
+import request, { postBlob, getBlob, handleImport } from '@/utils/request'
+
+// 获取师傅列表
+export function noticeListPageV2(data) {
+  return request({
+    url: `/notice/read/list?moduleId=${data.moduleId}`,
+    method: 'post',
+    data
+  })
+}
+
+export function noticePageExport(data, name) {
+  return postBlob({
+    url: '/notice/read/list/export',
+    data,
+    name
+  })
+}

+ 359 - 3
src/layout/components/Navbar.vue

@@ -34,6 +34,10 @@
             @select="handleSelect"
           ></el-autocomplete>
         </div> -->
+		<div style="margin-right: 20px;cursor: pointer;" @click="getList();isShow = true">
+			<i class="el-icon-message-solid"></i>
+			<el-badge is-dot></el-badge>
+		</div>
         <shortcut />
         <template v-if="device !== 'mobile'">
           <!-- 全屏控制 -->
@@ -58,6 +62,110 @@
       </div>
     </div>
     <notice-bar />
+	<el-drawer
+	  title="系统消息"
+	  :visible.sync="isShow"
+	  :append-to-body="true"
+	  :with-header="false"
+	  direction="rtl"
+	  size="25%">
+		<div class="message">
+			<div class="head">
+				<div class="flex_asb">
+					<el-radio-group size="small" v-model="messageType" @change="getList">
+					  <el-radio-button :label="['WBI','WBK','CRE_ORDER','SEND_MALL','RP_MALL','CR_SALES']">系统消息</el-radio-button>
+					  <el-radio-button :label="['NOTICE']">平台公告</el-radio-button>
+					</el-radio-group>
+					<el-switch
+					  v-model="isOpen"
+					  @change="updateIsNotice"
+					  inactive-text="消息弹窗"
+					  active-color="#13ce66"
+					  inactive-color="#ff4949">
+					</el-switch>
+				</div>
+				<el-radio-group size="mini" v-model="dateType" @change="getList" style="margin: 10px 0;">
+				  <el-radio-button label="">全部</el-radio-button>
+				  <el-radio-button :label="0">今天</el-radio-button>
+				  <el-radio-button :label="1">昨天</el-radio-button>
+				  <el-radio-button :label="6">近7天</el-radio-button>
+				  <el-radio-button :label="29">近30天</el-radio-button>
+				</el-radio-group>
+				<div class="flex_asb">
+					<el-radio-group size="mini" v-model="readFlag" @change="getList">
+					  <el-radio-button label="">全部</el-radio-button>
+					  <el-radio-button label="NO">未读</el-radio-button>
+					  <el-radio-button label="YES">已读</el-radio-button>
+					</el-radio-group>
+					<div style="color: #409EFF;cursor: pointer;" @click="confirmRead">
+						<i class="el-icon-message-solid"></i>
+						<span style="font-size: 14px;">全部已读</span>
+					</div>
+				</div>
+			</div>
+			<el-card class="box-card" v-for="(item,index) in messageData" style="margin-top: 10px;">
+				<div @click="isShow = false;toDetail(item.adminNoticeType,item.paidType,(item.adminNoticeType=='NOTICE'?item.noticeId:item.orderId))">
+					<div class="flex_asb item">
+						<div v-if="messageType == ['NOTICE']">
+							<span>公告类型:</span>
+							<span>{{statusFilter(item.adminNoticeType)}}</span>
+						</div>
+						<div v-else>
+							<span>消息类型:</span>
+							<span>{{statusFilter(item.adminNoticeType)}}</span>
+						</div>
+						<div class="read1" v-if="item.readFlag == 'NO'">未读</div>
+						<div class="read2" v-if="item.readFlag == 'YES'">已读</div>
+					</div>
+					<div class="item">
+						<div v-if="messageType == ['NOTICE']">
+							<span>文件标题:</span>
+							<span style="color: #409Eff">{{item.title}}</span>
+						</div>
+						<div v-else>
+							<span>订单编号:</span>
+							<span style="color: #409Eff">{{item.orderId}}</span>
+						</div>
+					</div>
+					<div class="item">
+						<div v-if="messageType == ['NOTICE']">
+							<span>发布人:</span>
+							<span>{{item.issueNickName | ''}}</span>
+						</div>
+						<div v-else>
+							<span>消息内容:</span>
+							<span>{{item.content}}</span>
+						</div>
+					</div>
+					<div class="item">
+						<div v-if="messageType == ['NOTICE']">
+							<span>发布时间:</span>
+							<span>{{item.issueTime}}</span>
+						</div>
+						<div v-else>
+							<span>创建时间:</span>
+							<span>{{item.createTime}}</span>
+						</div>
+					</div>
+					<div v-if="item.readFlag == 'YES'" class="item">
+						<span>阅读人:</span>
+						<span>{{item.adminNickName }} {{item.readTime}}</span>
+					</div>
+				</div>
+			</el-card>
+			<el-empty v-if="messageData.length == 0" description="暂无数据"></el-empty>
+			<div class="flex_ac bottom">
+				<el-pagination
+					@current-change="handleCurrentChange"
+					:current-page="currentPage"
+					:page-size="pageSize"
+					layout="prev, pager, next"
+					background
+					:total="listTotal"
+				></el-pagination>
+			</div>
+		</div>
+	</el-drawer>
   </div>
 </template>
 
@@ -70,6 +178,7 @@ import NavMenu from '@/components/NavMenu'
 import vScrollView from 'v-scroll-view'
 import NoticeBar from '@/components/NoticeBar'
 import { pages } from '@/settings'
+import request from '@/utils/request'
 function getc(obj) {
   if (!obj.children || !obj.children.length) {
     return obj
@@ -91,7 +200,18 @@ export default {
       pathurl: '',
       visible: false,
       noticeCount: 0,
-      path: `/${this.$route.path.split('/')[1] || ''}`
+      path: `/${this.$route.path.split('/')[1] || ''}`,
+	  isShow: false,
+	  isOpen: true,
+	  checked: false,
+	  messageType: ['WBI','WBK','CRE_ORDER','SEND_MALL','RP_MALL','CR_SALES'],
+	  messageData: [],
+	  dateType: '',
+	  readFlag: '',
+	  timer: null,
+	  listTotal: 0,
+	  currentPage: 1, // 当前页码
+	  pageSize: 10, // 每页数量
     }
   },
   computed: {
@@ -101,7 +221,61 @@ export default {
     noticeVisible() {
       return this.noticeCount > 0
     },
-    ...mapGetters(['sidebar', 'avatar', 'device', 'name', 'isNotice'])
+	...mapGetters([
+	  'userid'
+	]),
+    ...mapGetters(['sidebar', 'avatar', 'device', 'name', 'isNotice']),
+	filterTime(){
+		if(this.dateType === ''){
+			return ['','']
+		}else{
+			var date = new Date();
+			var base = Date.parse(date); // 转换为时间戳
+			var year = date.getFullYear(); //获取当前年份
+			var mon = date.getMonth() + 1; //获取当前月份
+			var day = date.getDate(); //获取当前日
+			var oneDay = 24 * 3600 *1000
+			
+			var daytimeArr = []
+			var now = new Date((base - oneDay*this.dateType));
+			var myear = now.getFullYear();
+			var month = now.getMonth() + 1;
+			var mday = now.getDate()
+			if(this.dateType == 1){
+				return [`${myear}-${month>9?month:'0'+month}-${mday>9?mday:'0'+mday} 00:00:00`,`${myear}-${month>9?month:'0'+month}-${mday>9?mday:'0'+mday} 23:59:59`]
+			}else{
+				return [`${myear}-${month>9?month:'0'+month}-${mday>9?mday:'0'+mday} 00:00:00`,`${year}-${mon>9?mon:'0'+mon}-${day>9?day:'0'+day} 23:59:59`]
+			}
+		}
+	},
+	statusFilter() {
+		return function(val){
+			const MAP = {
+				NOTICE: '平台公告',
+				WBI: '维保消息费用申请',
+				WBK: '维保费用申请审批',
+				CRE_ORDER: '创建工单',
+				SEND_MALL: '商城订单发货',
+				RP_MALL: '商城订单维权',
+				CR_SALES: '支付订单'
+			}
+			return MAP[val]
+		}
+	},
+	typeFilter() {
+		return function(val,paidType){
+			const MAP = {
+				NOTICE: 'announcement',
+				WBI: 'applicationWithoutFee',
+				WBK: 'applicationWithoutFee',
+				CRE_ORDER: 'workOrderPool',
+				SEND_MALL: 'order_list',
+				RP_MALL: 'order_refund',
+				CR_SALES: (paidType=='M'?'auxiliarySalesOrder':paidType=='P'?'attachmentSalesOrder':paidType=='YB'?'orderSettleManag':paidType=='MALL'?'order_list':'')
+			}
+			return MAP[val]
+		}
+	}
   },
   watch: {
     $route() {
@@ -122,6 +296,9 @@ export default {
       }
     }
   },
+  created(){
+	  this.getUserInfo()
+  },
   mounted() {
     this.$store.commit('app/SET_L1_PATH', this.path)
   },
@@ -160,7 +337,148 @@ export default {
     },
     toggleSideBar() {
       this.$store.dispatch('app/toggleSideBar')
-    }
+    },
+	//获取最新消息并弹窗
+	getMessageTips(){
+		const that = this
+		request({
+		  url: `/notice/list/out`,
+		  method: 'get',
+		  params: {
+			  num: 20,
+		  }
+		}).then(res=>{
+			res.data.forEach(item=>{
+				this.$notify({
+					title: '新消息',
+					position: 'bottom-right',
+					duration: 3000,
+					message: that.$createElement(
+						"div",
+						{
+							style: 'cursor: pointer;',
+							on: {
+								click: that.toDetail.bind(that,item.adminNoticeType,item.paidType,item.orderId)
+							},
+						},[
+							that.$createElement(
+								"span",
+								null,
+								that.statusFilter(item.adminNoticeType)
+							),
+							that.$createElement(
+								"span",
+								{
+									style: 'color: #409EFF;',
+								},
+								item.orderId
+							),
+							that.$createElement(
+								"span",
+								null,
+								item.content
+							),
+						// that.$createElement(
+						// 	"el-checkbox",
+						// 	{
+						// 		on: {
+						// 			change: that.updateIsNotice.bind(that)
+						// 		},
+						// 	}, '不再弹窗新消息'
+						// )
+					])
+				});
+			})
+		})
+	},
+	getUserInfo(){
+		request({
+		  url: `/admin/user/detail`,
+		  method: 'get',
+		  params: {
+			  adminUserId: this.userid
+		  }
+		}).then(res=>{
+			this.isOpen = res.data.isNotice=='YES'?true:false
+			if(res.data.isNotice=='YES'){
+				this.timer = setInterval(()=>{
+					this.getMessageTips()
+				},20000)
+			}else{
+				clearInterval(this.timer)
+			}
+		})
+	},
+	//全部已读
+	confirmRead(){
+		this.$confirm('是否全部设为已读, 是否继续?', '提示', {
+			confirmButtonText: '确定',
+			cancelButtonText: '取消',
+			type: 'warning'
+		}).then(() => {
+			request({
+			  url: `/notice/mark/read/all`,
+			  method: 'post',
+			  data: {}
+			}).then(res=>{
+				if(res.code == 200){
+					this.getList()
+					this.$message.success('全部已读成功!');
+				}
+			})
+		}).catch(() => {
+			this.$message({
+				type: 'info',
+				message: '已取消'
+			});
+		});
+	},
+	//点击不再弹窗新消息
+	updateIsNotice(e){
+		request({
+		  url: `/notice/updateIsNotice`,
+		  method: 'post',
+		  params: {
+			  isNotice: e?'YES':'NO',
+		  }
+		}).then(res=>{
+			if(res.code == 200){
+				this.getUserInfo()
+				this.$message.success(e?'已开启弹窗消息提醒':'已关闭弹窗消息提醒');
+				if(!e){
+					clearInterval(this.timer)
+				}
+			}
+		})
+	},
+	getList(){
+		request({
+		  url: `/notice/list`,
+		  method: 'post',
+		  data: {
+			  pageNum: this.currentPage,
+			  pageSize: this.pageSize,
+			  params: [{param: "nr.read_flag", compare: "=", value: this.readFlag},{param: 'nr.admin_notice_type', compare: "=", value: this.messageType},{param: 'nr.issue_time', compare: ">=", value: this.filterTime[0]},{param: 'nr.issue_time', compare: "<=", value: this.filterTime[1]}]
+		  }
+		}).then(res=>{
+			this.messageData = res.data.records
+		})
+	},
+	// 更改当前页
+	handleCurrentChange(val) {
+		this.currentPage = val;
+		this.getList();
+	},
+	toDetail(type,paidType,id){
+		console.log(type,id)
+		this.$router.push({
+			name: this.typeFilter(type,paidType),
+			query: {
+				id,
+				activeName: "workOrderInfo",
+			}
+		})
+	}
   }
 }
 </script>
@@ -180,6 +498,44 @@ export default {
 ::v-deep .slidingBlockClassName {
   background: rgba(0, 0, 0, 0.05) !important;
 }
+.flex_asb{
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+}
+.flex_ac{
+	display: flex;
+	justify-content: center;
+}
+.message{
+	padding: 20px;position: relative;min-height: 100%;padding-bottom:60px;padding-top: 150px;box-sizing: border-box;
+	.head{
+		width:25%;position: fixed;top: 0;right:0;background: #ffffff;padding: 20px;
+	}
+	.bottom{
+		width:25%;position: fixed;bottom: 0;right:0;background: #ffffff;padding: 10px 0;
+	}
+}
+.box-card{
+	.item{
+		cursor: pointer;
+		margin-bottom: 6px;
+	}
+	.read1{
+		color: #f5680e;
+		background: #fff2da;
+		padding: 2px 4px;
+		border-radius: 4px;
+		font-size: 14px;
+	}
+	.read2{
+		color: #42b983;
+		background: #d7fdde;
+		padding: 2px 4px;
+		border-radius: 4px;
+		font-size: 14px;
+	}
+}
 .navbar {
   width: 100%;
   height: 50px;

+ 7 - 0
src/views/auxiliaryFittings/salesManagement/attachmentSalesOrder/index.vue

@@ -93,6 +93,13 @@ export default {
 			}
 		}
 	},
+	created(){
+		if(this.$route.query.id){
+			this.id = this.$route.query.id
+			this.formDialogType = 2
+			this.openForm()
+		}
+	},
 	methods: {
 		// 切换状态
 		changeType(val) {

+ 7 - 0
src/views/auxiliaryFittings/salesManagement/auxiliarySalesOrder/index.vue

@@ -93,6 +93,13 @@ export default {
 			}
 		}
 	},
+	created(){
+		if(this.$route.query.id){
+			this.id = this.$route.query.id
+			this.formDialogType = 2
+			this.openForm()
+		}
+	},
 	methods: {
 		// 切换状态
 		changeType(val) {

+ 20 - 10
src/views/engineeringMaintenance/applicationWithoutFee/index.vue

@@ -88,6 +88,12 @@ export default {
       }]
     }
   },
+	created(){
+		if(this.$route.query.id){
+			this.formType = 0
+			this.getDetail(this.$route.query.id)
+		}
+	},
   methods: {
     // 列表请求函数
     getList(p, cb) {
@@ -119,20 +125,24 @@ export default {
     selectionChange(data) {
       this.recordSelected = data
     },
-
+		
+	getDetail(id){
+		enginMaterialDetail({
+		  id
+		}).then(res => {
+		  this.openType = 0
+		  this.formData = res.data
+		  this.$nextTick(() => {
+		    this.formBool = true
+		  })
+		})
+	},
+		
     operation() {
       return this.operationBtn({
         detail: {
           click: ({ row, index, column }) => {
-            enginMaterialDetail({
-              id: row.orderId
-            }).then(res => {
-              this.openType = 0
-              this.formData = res.data
-              this.$nextTick(() => {
-                this.formBool = true
-              })
-            })
+            this.getDetail(row.orderId)
           }
         },
         examine: {

+ 3 - 0
src/views/mallManagement/order/order_list/index.vue

@@ -514,6 +514,9 @@ export default {
     this.getStorageList();
     this.getCompanyList();
     this.getWebsiteList();
+	if(this.$route.query.id){
+		this.queryDetail(this.$route.query.id)
+	}
   },
   methods: {
     queryWorkOrder(id) {

+ 6 - 3
src/views/mallManagement/order/order_refund/index.vue

@@ -116,7 +116,7 @@
             </el-col>
             <el-col :xs="24" :sm="24" :lg="4" style="text-align: right;">
               <el-link type="primary" v-if="$restrict('orderNote')" :underline="false" @click="showRemark(order.orderRefundId, order.remark)">订单备注</el-link>
-              <el-link type="primary" v-if="$restrict('detail')" :underline="false" @click="showDetail(index)">查看详情</el-link>
+              <el-link type="primary" v-if="$restrict('detail')" :underline="false" @click="showDetail(order.orderRefundId)">查看详情</el-link>
               <!-- <el-link type="primary" :underline="false" @click="queryWorkOrder(order.orderId)">订单工单</el-link> -->
             </el-col>
           </el-row>
@@ -310,6 +310,9 @@ export default {
   created() {
     this.getList();
     this.getWebsiteList();
+	if(this.$route.query.id){
+		this.showDetail(this.$route.query.id)
+	}
   },
   methods: {
     queryWorkOrder(id) {
@@ -436,8 +439,8 @@ export default {
       })
     },
     // 查看详情
-    showDetail(index) {
-      const orderRefundId = this.dataList[index].orderRefundId
+    showDetail(orderRefundId) {
+      // const orderRefundId = this.dataList[index].orderRefundId
       // let {href} = this.$router.resolve({path: `/order/order_refund_detail?orderRefundId=${orderRefundId}`});
       // window.open(href, '_blank');
       this.$router.push({

+ 32 - 28
src/views/setting/notification/announcement/index.vue

@@ -1,6 +1,6 @@
 <template>
 	<template-page ref="pageRef" :get-list="getList" :table-attributes="tableAttributes" :table-events="tableEvents"
-		:operationColumnWidth="200" :options-evens-group="optionsEvensGroup" :moreParameters="moreParameters"
+		:operationColumnWidth="120" :options-evens-group="optionsEvensGroup" :moreParameters="moreParameters"
 		:column-parsing="columnParsing" :operation="operation" :exportList="exportList">
 		<div slot="moreSearch">
 			<el-radio-group v-model="status" size="mini" @change="changeType">
@@ -288,6 +288,11 @@ export default {
 			}]
 		}
 	},
+	created(){
+		if(this.$route.query.id){
+			this.getNoticeDetail(this.$route.query.id,2,'formDialog2')
+		}
+	},
 	methods: {
 		// 切换状态
 		changeType(val) {
@@ -315,38 +320,29 @@ export default {
 		selectionChange(data) {
 			this.recordSelected = data
 		},
+		getNoticeDetail(noticeId,type,name){
+			getNoticeDetail({
+				noticeId
+			}).then(res => {
+				Object.assign(this.formData, res.data, {
+					files: res.data.files ? res.data.files.map(item => ({
+						...item,
+						size: item.fileSize,
+						type: item.fileType,
+					})) : []
+				})
+				this.formDialogType = type
+				this.openForm(name)
+			})
+		},
 		// 表格操作列
 		operation(h, { row, index, column }) {
 			return (<div class='operation-btns'>
 				{row.status == "NO" ? <el-button type="text" onClick={() => {
-					getNoticeDetail({
-						noticeId: row.noticeId
-					}).then(res => {
-						Object.assign(this.formData, res.data, {
-							files: res.data.files ? res.data.files.map(item => ({
-								...item,
-								size: item.fileSize,
-								type: item.fileType,
-							})) : []
-						})
-						this.formDialogType = 1
-						this.openForm()
-					})
+					this.getNoticeDetail(row.noticeId,1,'')
 				}}>编辑</el-button> : null}
 				<el-button type="text" onClick={() => {
-					getNoticeDetail({
-						noticeId: row.noticeId
-					}).then(res => {
-						Object.assign(this.formData, res.data, {
-							files: res.data.files ? res.data.files.map(item => ({
-								...item,
-								size: item.fileSize,
-								type: item.fileType,
-							})) : []
-						})
-						this.formDialogType = 2
-						this.openForm('formDialog2')
-					})
+					this.getNoticeDetail(row.noticeId,2,'formDialog2')
 				}}>查看</el-button>
 				{row.status == "NO" ? <el-popconfirm
 					title={`是否确定删除?`}
@@ -362,8 +358,16 @@ export default {
 						})
 					}}
 				>
-					<el-button type="text" slot="reference">删除</el-button>
+					<el-button type="text" style="color: #ff0000" slot="reference">删除</el-button>
 				</el-popconfirm> : null}
+				{row.status == "YES" ? <el-button style="color: #f5680e" type="text" onClick={() => {
+					this.$router.push({
+						name: 'readRecords',
+						query: {
+							id: row.noticeId
+						}
+					})
+				}}>已读记录</el-button> : null}
 			</div>)
 		},
 		addData() {

+ 76 - 0
src/views/setting/notification/readRecords/index.vue

@@ -0,0 +1,76 @@
+<template>
+	<template-page ref="pageRef" :get-list="getList" :table-attributes="tableAttributes" :table-events="tableEvents"
+		:operationColumnWidth="120" :options-evens-group="optionsEvensGroup" :moreParameters="moreParameters"
+		:column-parsing="columnParsing" :operation="operation" :exportList="exportList">
+	</template-page>
+</template>
+
+<script>
+import TemplatePage from '@/components/template/template-page-1.vue'
+import import_mixin from '@/components/template/import_mixin.js'
+import ImageUpload from '@/components/file-upload'
+import { required, mobileRequired, mobile } from '@/components/template/rules_verify.js'
+import { noticeListPageV2, noticePageExport } from "@/api/readRecords";
+import { getList as getListaa } from "@/api/merchant";
+export default {
+	components: { TemplatePage, ImageUpload },
+	mixins: [import_mixin],
+	data() {
+		return {
+			// 事件组合
+			optionsEvensGroup: [],
+			// 表格属性
+			tableAttributes: {
+				// 启用勾选列
+				selectColumn: false
+			},
+			tableEvents: {},
+			noticeId: ''
+		}
+	},
+	computed: {
+		// 更多参数
+		moreParameters() {
+			return []
+		},
+		formItems() {
+			
+		}
+	},
+	created(){
+		if(this.$route.query.id){
+			this.noticeId = this.$route.query.id
+		}
+	},
+	methods: {
+		// 切换状态
+		changeType(val) {
+			this.$refs.pageRef.refreshList()
+		},
+		// 列表请求函数
+		getList(p) {
+			try {
+				var pam = JSON.parse(JSON.stringify(p))
+				if (this.noticeId) {
+					pam.params.push({ "param": "nr.notice_id", "compare": "=", "value": this.noticeId })
+				}
+				return noticeListPageV2(pam)
+			} catch (error) {
+				console.log(error)
+			}
+		},
+		// 列表导出函数
+		exportList: noticePageExport,
+		// 表格列解析渲染数据更改
+		columnParsing(item, defaultData) {
+			return defaultData
+		},
+		// 表格操作列
+		operation(h, { row, index, column }) {
+			return ''
+		}
+	}
+}
+</script>
+
+<style lang="scss" scoped></style>

+ 6 - 0
src/views/valueAddedService/orderSettleManag/index.vue

@@ -331,6 +331,12 @@ export default {
       }]
     },
   },
+	created(){
+		if(this.$route.query.id){
+			this.formType = 0
+			this.getDetail(this.$route.query.id)
+		}
+	},
   methods: {
     selectable(row, index) {
       return ["PAID"].includes(Object.entries(row.selectMapData.payStatus).find(([key, val]) => val == row.payStatus)?.[0]) &&