Browse Source

新增消息页面

lilei 2 years ago
parent
commit
e378cf00c5

+ 0 - 39
manifest.json

@@ -167,45 +167,6 @@
                     "pid" : "2683",
                     "parameters" : {}
                 }
-            },
-            "JG-JCore" : {
-                "JPUSH_APPKEY_IOS" : "a8ad1620a88ff2493a2f8fda",
-                "JPUSH_CHANNEL_IOS" : "developer-default",
-                "JPUSH_APPKEY_ANDROID" : "a8ad1620a88ff2493a2f8fda",
-                "JPUSH_CHANNEL_ANDROID" : "developer-default",
-                "__plugin_info__" : {
-                    "name" : "JG-JCore",
-                    "description" : "极光推送JCore插件",
-                    "platforms" : "Android,iOS",
-                    "url" : "",
-                    "android_package_name" : "",
-                    "ios_bundle_id" : "",
-                    "isCloud" : false,
-                    "bought" : -1,
-                    "pid" : "",
-                    "parameters" : {
-                        "JPUSH_APPKEY_IOS" : {
-                            "des" : "[iOS]极光portal配置应用信息时分配的AppKey",
-                            "key" : "JCore:APP_KEY",
-                            "value" : ""
-                        },
-                        "JPUSH_CHANNEL_IOS" : {
-                            "des" : "[iOS]用于统计分发渠道,不需要可填默认值developer-default",
-                            "key" : "JCore:CHANNEL",
-                            "value" : ""
-                        },
-                        "JPUSH_APPKEY_ANDROID" : {
-                            "des" : "[Android]极光portal配置应用信息时分配的AppKey",
-                            "key" : "JPUSH_APPKEY",
-                            "value" : ""
-                        },
-                        "JPUSH_CHANNEL_ANDROID" : {
-                            "des" : "[Android]用于统计分发渠道,不需要可填默认值developer-default",
-                            "key" : "JPUSH_CHANNEL",
-                            "value" : ""
-                        }
-                    }
-                }
             }
         }
     },

+ 14 - 2
pages.json

@@ -49,8 +49,20 @@
 			"style": {
 				"navigationBarTitleText": "修改密码"
 			}
-		}
-        ,{
+		},
+		{
+			"path": "pages/xtNotice/xtNotice",		//  我的>消息
+			"style": {
+				"navigationBarTitleText": "消息"
+			}
+		},
+		{
+			"path": "pages/xtNotice/xtNoticeDetail/xtNoticeDetail",		//  我的>消息详情
+			"style": {
+				"navigationBarTitleText": "消息详情"
+			}
+		},
+        {
             "path" : "pages/latePlay/chooseBulk",
             "style" :                                                                                    
             {

+ 1 - 1
pages/shelfOrder/listComponent.vue

@@ -92,7 +92,7 @@
 			},
 		},
 		mounted() {
-			this.getList()
+			// this.getList()
 		},
 		methods:{
 			refash(){

+ 19 - 9
pages/shelfOrder/shelfOrder.vue

@@ -13,7 +13,7 @@
 				<view>总结算金额:<text>¥{{countData&&countData.settleAmount||0}}</text>;</view>
 			</view>
 		</view>
-		<!-- 销售单列表 -->
+		<!-- 货架列表 -->
 		<view class="list-box">
 			<listComponent ref="salesList" :height="listHeight" :params="searchParams" />
 		</view>
@@ -61,17 +61,27 @@
 			  this.listHeight = Math.floor(data.height-25)
 			}).exec();
 		},
-		onLoad() {
+		onLoad(opts) {
 			const _this = this
 			this.getLookUpItem('ORDER_BILL_STATE')
+			console.log(opts)
+			// 从消息页面过来
+			if(opts.bizType == 'SHELF_WARN'&&opts.shelfSn){
+				this.searchForm.shelfSnList = [opts.shelfSn]
+				this.searchParams.shelfSnList = [opts.shelfSn]
+				this.curShelfName = opts.shelfName
+			}
+			
 			this.$nextTick(function(){
-				// 监听整改完成后刷新事件
-				uni.$on('refreshSalesBL', function(data){
-					_this.$refs.salesList.getList(1)
-					_this.getCount()
-				})
+				this.$refs.salesList.getList(1)
+				this.getCount()
+			})
+			
+			// 监听整改完成后刷新事件
+			uni.$on('refreshSalesBL', function(data){
+				_this.$refs.salesList.getList(1)
+				_this.getCount()
 			})
-			this.getCount()
 		},
 		onUnload() {
 			uni.$off('refreshSalesBL')
@@ -85,7 +95,7 @@
 			// 获取查询参数 刷新列表
 			refresh(params){
 				const _this = this
-				this.searchParams = {shelfSnList:this.searchParams.shelfSnList,...params}
+				this.searchParams = {shelfSnList:this.searchForm.shelfSnList,...params}
 				this.searchParams.orderStartDate = params&&params.orderStartDate ? (params.orderStartDate + ' 00:00:00') : ''
 				this.searchParams.orderEndDate = params&&params.orderEndDate ? (params.orderEndDate + ' 23:59:59') : ''
 				console.log(this.searchParams)

+ 1 - 1
pages/shelfSetting/editShelfHw.vue

@@ -26,7 +26,7 @@
 									{{productEntity.name}}
 								</view>
 								<view>
-									当前库存:{{productEntity.currQty||0}} {{productEntity.unit}}
+									当前库存:{{productEntity.qty||0}} {{productEntity.unit}}
 								</view>
 							</view>
 						</view>

+ 18 - 7
pages/userCenter/index.vue

@@ -19,10 +19,13 @@
 		<!-- 列表 -->
 		<view class="user-list">
 			<u-cell-group>
-				<u-cell-item icon="file-text" icon-size="40" :icon-style="{color:'#ffaa00'}" index="0" @click="toPage(0)" title="服务协议及隐私政策"></u-cell-item>
-				<!-- <u-cell-item icon="info-circle" icon-size="38" :icon-style="{color:'#55aa00'}" index="1" @click="toPage" title="关于我们"></u-cell-item> -->
 				<u-cell-item icon="lock" icon-size="38" :icon-style="{color:'#00aaff'}" index="2" @click="toPage(1)" title="修改密码"></u-cell-item>
-				<u-cell-item icon="info-circle" icon-size="38" :icon-style="{color:'#55aa00'}" index="1" @click="toPage(2)" :value="curVer.version" title="版本检查"></u-cell-item>
+				<u-cell-item icon="file-text" icon-size="38" :icon-style="{color:'#00aaff'}" index="0" @click="toPage(0)" title="服务协议及隐私政策"></u-cell-item>
+				<u-cell-item icon="volume-up" icon-size="38" :icon-style="{color:'#00aaff'}" index="1" @click="toPage(3)" title="消息">
+					<u-badge :count="noReadNums" :absolute="false" slot="right-icon"></u-badge>
+				</u-cell-item>
+				<!-- <u-cell-item icon="info-circle" icon-size="38" :icon-style="{color:'#55aa00'}" index="1" @click="toPage" title="关于我们"></u-cell-item> -->
+				<u-cell-item icon="info-circle" icon-size="38" :icon-style="{color:'#00aaff'}" index="1" @click="toPage(2)" :value="curVer.version" title="版本检查"></u-cell-item>
 			</u-cell-group>
 		</view>
 		<!-- 退出 -->
@@ -34,7 +37,7 @@
 </template>
 
 <script>
-	import { getUserInfo, logout, login } from '@/api/user.js'
+	import { getUserInfo, logout, login, getUnreadCount } from '@/api/user.js'
 	import { getSysVersion } from '@/api/data.js'
 	import { checkVersionToLoadUpdate, clzConfirm } from '@/libs/tools';
 	import market from "@/js_sdk/dc-market/market.js"
@@ -50,11 +53,12 @@
 				},
 				userInfoData: null,  //  用户信息
 				userAvatarUrl: ''  ,//  用户头像
-				curVer: null
+				curVer: null,
+				noReadNums: 0
 			};
 		},
 		onShow() {
-			// this.getUserInfo()
+			this.getUnread()
 			console.log(this.userData)
 		},
 		computed: {
@@ -82,6 +86,12 @@
 			this.curVer = getApp().globalData.version;
 		},
 		methods:{
+			// 未读消息
+			getUnread(){
+				getUnreadCount().then(res => {
+					this.noReadNums = res.data.no_read_count || 0
+				})
+			},
 			// 过滤权限code
 			fiterAuthCode(data) {
 				data.permCodes = data.permCodes.filter(item => item.indexOf('_mobile') > 0);
@@ -125,7 +135,8 @@
 				let pageUrl=[
 					'/pages/login/userAuthYs?fromPage=usercenter',
 					'/pages/userCenter/changePwd',
-					'getVersion'
+					'getVersion',
+					'/pages/xtNotice/xtNotice'
 					]
 				if(index != 2){
 					uni.navigateTo({

+ 199 - 0
pages/xtNotice/xtNotice.vue

@@ -0,0 +1,199 @@
+<template>
+	<view class="container">
+		<view class="message" v-for="(item,index) in messageList" :key="item.id" @click="goToMessageDetail(item)">
+			<view class="message-cons">
+				<view class="flex align_center justify_between">
+					<view class="messageTitle">{{item.notice.title}}</view>
+					<view class="message-right">
+						<view>
+							<span v-if="item.readFlag==0" class="message-unread">未读</span>
+							<span v-if="item.readFlag==1" class="message-readed">已读</span>
+						</view>
+						<uni-icon color="rgba(157, 168, 181, 1)" name="arrow-right"></uni-icon>
+					</view>
+				</view>
+				<view class="ellipsis-one message-info">
+					{{item.notice.content|filterHtml}}
+				</view>
+				<view class="flex align_center justify_between">
+					<view class="messageTime flex_1">{{item.notice.releaseDate}}</view>
+					<view v-if="item.notice.type == 'tx'">
+						<u-button @click.stop="toAction(item)" shape="circle" plain size="mini" type="primary">
+						  {{ item.notice.extInfo.bizType == 'SHELF_REPLENISH' ? '立即处理':'点击查看' }}
+						</u-button>
+					</view>
+				</view>
+			</view>
+		</view>
+		<view class="nodata">
+			<u-empty :src="`/static/${$config('themePath')}/def_no_data@3x.png`" icon-size="150" text="暂无数据" img-width="120" v-if="messageList.length==0 && status!='loading'" mode="list"></u-empty>
+			<u-loadmore :load-text="$config('loadText')" class="loadmore" v-if="total>pageSize || status=='loading'" :status="status" />
+		</view>
+	</view>
+</template>
+
+<script> 
+	import {getMessage,hasRead} from "@/api/user.js"
+	export default{
+		data(){
+			return{
+				messageList:[],
+				pageNo: 1,
+				pageSize: 10,
+				total: 0,
+				status: 'loadmore'
+			}
+		},
+		computed: {
+			wsMessage() {
+				return this.$store.state.vuex_messagUnReadCount
+			},
+		},
+		watch: {
+			// 有新消息时刷新列表
+			wsMessage(newValue, oldValue) {
+				this.pageNo = 1
+				this.getMessageList()
+			}
+		},
+		filters: {
+			filterHtml: function(str) {
+				return str?str.replace(/<.*?>/g,""):""
+			}
+		},
+		methods:{
+			// 获取数据列表
+			getMessageList(){
+				this.status = "loading"
+				getMessage({
+					pageNo: this.pageNo,
+					pageSize: this.pageSize
+				}).then(res => {
+					if (res.status == 200) {
+						if(this.pageNo>1){
+							this.messageList = this.messageList.concat(res.data.list || [])
+						}else{
+							this.messageList = res.data.list || []
+						}
+						this.total = res.data.count || 0
+					} else {
+						this.messageList = []
+						this.total = 0
+						uni.showToast({
+							title: res.message ? res.message : '网络似乎出错了,请稍后再试',
+							icon: "none"
+						})
+					}
+					this.status = "loadmore"
+					
+					this.messageList.map(item => {
+						if(item.notice.type == 'tx'){
+							item.notice.extInfo = JSON.parse(item.notice.extInfo)
+						}
+					})
+				})
+			},
+			setRead(item){
+				//设置为已读
+				if (item.readFlag==0){
+				  hasRead({msg_id: item.id}).then(res => {
+					// 刷新列表
+					if (res.status == 200){
+					  this.pageNo = 1
+					  this.getMessageList()
+					}
+				  })
+				}
+			},
+			// 查看详细
+			goToMessageDetail(item){
+				this.setRead(item)
+				// 跳转到详细页
+				uni.navigateTo({
+				 	url:'./xtNoticeDetail/xtNoticeDetail?item='+ encodeURIComponent(JSON.stringify(item))
+				})
+			},
+			toAction (data) {
+			  this.setRead(data)
+			  // 急送订单
+			  if (data.notice.extInfo.bizType == 'TEMP_ORDER') {
+				uni.navigateTo({ url: '/pages/sales/edit?pageType=detail&data='+JSON.stringify({ salesBillSn: data.notice.extInfo.bizSn }) })
+			  }
+			  // 补货订单
+			  if (data.notice.extInfo.bizType == 'SHELF_REPLENISH') {
+				uni.navigateTo({ url: '/pages/replenishmentManage/replenishmentList?billState=WAIT_CONFIRM' })
+			  }
+			  // 货架订单
+			  if (data.notice.extInfo.bizType == 'SHELF_ORDER') {
+				uni.navigateTo({ url: '/pages/shelfOrder/orderDetail?pageType=detail&orderBillSn='+data.notice.extInfo.bizSn })
+			  }
+			  // 货架异常
+			  if (data.notice.extInfo.bizType == 'SHELF_WARN') {
+				const shelfName = data.notice.plainContent.split('已经超过')[0]
+				uni.navigateTo({ url: '/pages/shelfOrder/shelfOrder?bizType=SHELF_WARN&shelfSn='+data.notice.extInfo.bizSn+'&shelfName='+shelfName })
+			  }
+			},
+		},
+		onLoad() {
+			this.getMessageList()
+		},
+		// scroll-view到底部加载更多
+		onReachBottom(){
+			console.log('到底部加载更多')
+			if(this.messageList.length < this.total){
+				this.pageNo += 1
+				this.getMessageList()
+			}else{
+				this.status = "nomore"
+			}
+		},
+	}
+</script>
+
+<style lang="less">
+	.container{
+		width:100%;
+		font-size: 28rpx;
+		.message{
+			background-color: #FFFFFF;
+			padding: 25upx 30upx;
+			margin: 25upx;
+			border-radius: 30upx;
+			box-shadow: 1px 1px 3px #EEEEEE;
+			display: flex;
+			align-items: center;
+			.message-cons{
+				flex-grow: 1;
+				width: 50%;
+				.messageTitle{
+					font-size: 30rpx;
+					padding-right: 30upx;
+				}
+				.message-info{
+					font-size: 26rpx;
+					color: #666;
+					margin-top: 10rpx;
+					margin-bottom: 10rpx;
+				}
+				.messageTime{
+					font-size: 26rpx;
+					color:#989898;
+				}
+			}
+			.message-right{
+				display: flex;
+				align-items: center;
+				font-size: 24upx;
+				text-align: right;
+				padding-left: 50upx;
+				.message-unread{
+					color: #FA3534;
+				}
+				.message-readed{
+					color: #999;
+				}
+			}
+		}
+	}
+	
+</style>

+ 99 - 0
pages/xtNotice/xtNoticeDetail/xtNoticeDetail.vue

@@ -0,0 +1,99 @@
+<template>
+	<view class="container">
+		<view class="message">
+			<view class="messageDetail">
+				<view class="messageTitle">{{item.notice.title}}</view>
+				<view class="messageTime">{{item.notice.releaseDate}} 发布</view>
+			</view>
+			<view class="messageContent" v-if="item.notice.type!='tx'">
+			  <jyf-parser :html="item.notice.content" ref="article"></jyf-parser>
+			</view>
+			<view class="messageContent" v-else>
+				<text style="margin-right: 20rpx;">{{item.notice.plainContent}}</text>
+				<u-button @click="toAction(item)" shape="circle" plain size="mini" type="primary">
+				  {{ item.notice.extInfo.bizType == 'SHELF_REPLENISH' ? '立即处理':'点击查看' }}
+				</u-button>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	import jyfParser from "@/components/jyf-parser/jyf-parser"
+	export default{
+		components: {
+		    jyfParser
+		},
+		data(){
+			return{
+				item: {
+					createDate: '',
+					notice:{
+						title: '',
+						content: ''
+					}
+				}
+			}
+		},
+		onLoad(options) {
+			let  item = JSON.parse(options.item)
+			this.item = Object.assign(this.item,item)
+			this.item.notice.extInfo = JSON.parse(this.item.notice.extInfo)
+			console.log(item)
+		},
+		methods:{
+			toAction (data) {
+			  // 急送订单
+			  if (data.notice.extInfo.bizType == 'TEMP_ORDER') {
+				uni.redirectTo({ url: '/pages/sales/edit?pageType=detail&data='+JSON.stringify({ salesBillSn: data.notice.extInfo.bizSn }) })
+			  }
+			  // 补货订单
+			  if (data.notice.extInfo.bizType == 'SHELF_REPLENISH') {
+				uni.redirectTo({ url: '/pages/replenishmentManage/replenishmentList?billState=WAIT_CONFIRM' })
+			  }
+			  // 货架订单
+			  if (data.notice.extInfo.bizType == 'SHELF_ORDER') {
+				uni.redirectTo({ url: '/pages/shelfOrder/orderDetail?pageType=detail&orderBillSn='+data.notice.extInfo.bizSn })
+			  }
+			  // 货架异常
+			  if (data.notice.extInfo.bizType == 'SHELF_WARN') {
+				const shelfName = data.notice.plainContent.split('已经超过')[0]
+				uni.redirectTo({ url: '/pages/shelfOrder/shelfOrder?bizType=SHELF_WARN&shelfSn='+data.notice.extInfo.bizSn+'&shelfName='+shelfName })
+			  }
+			},
+		}
+	}
+</script>
+
+<style lang="less">
+	.container{
+		width:100%;
+		.message{
+			margin: 20rpx;
+			padding: 30rpx;
+			font-size: 28rpx;
+			background-color: #fff;
+			border-radius: 30rpx;
+			box-shadow: 2upx 2upx 6upx #eee;
+			.messageDetail{
+				margin: 0 0 30rpx 0;
+				font-size: 32rpx;
+				.messageTitle{
+					flex-grow: 1;
+					text-align: center;
+					margin: 0 0 20rpx 0;
+				}
+				.messageTime{
+					color:#989898;
+					font-size: 24rpx;
+					text-align: right;
+				}
+			}
+			.messageContent{
+				line-height: 46upx;
+				word-break: break-all;
+			}
+		}
+	}
+	
+</style>