@hbisty/qj-common 5.0.5 → 5.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hbisty/qj-common",
3
- "version": "5.0.5",
3
+ "version": "5.0.7",
4
4
  "description": "common files && template for qj-paas",
5
5
  "scripts": {
6
6
  "gulp": "gulp css"
@@ -6,7 +6,7 @@
6
6
  size="820px"
7
7
  :with-header="false"
8
8
  :before-close="handleClose"
9
- custom-class="site-msg-drawer"
9
+ class="site-msg-drawer"
10
10
  append-to-body
11
11
  >
12
12
  <div class="site-msg-container">
@@ -164,6 +164,7 @@ import {
164
164
  updateStateExtRead,
165
165
  updateAllRead
166
166
  } from '#/api/siteMsg';
167
+ import { parseTime } from '#/utils/index'
167
168
 
168
169
  export default {
169
170
  name: 'SiteMsg',
@@ -205,6 +206,73 @@ export default {
205
206
  },
206
207
  filteredMessages() {
207
208
  return this.messages
209
+ },
210
+ // 内容处理
211
+ renderContent() {
212
+ return (msg) => {
213
+ if (msg.content) {
214
+ let content = msg.content;
215
+ if (msg.mnslistExp && msg.mnslistExp.bizLinkData) {
216
+ const expData = msg.mnslistExp.bizLinkData
217
+ // 平台类型消息跳转处理
218
+ // 订单号:contractBillcode
219
+ // 订单批次号:contractBbillcode
220
+ // 商品Code:goodsCode
221
+ // 售后:refundCode
222
+ if (msg.platform === 'mer') { //商家端
223
+ if (expData.goodsCode) { //商品列表
224
+ const merGoodsPage = "/paas/merchant-pc/index.html#/goodsList?goodsNo=" + expData.goodsCode;
225
+ content = content.replace(expData.goodsCode, `<a href="${merGoodsPage}">${expData.goodsCode}</a>`)
226
+ }
227
+ if (expData.contractBillcode) { //订单号
228
+ if (msg.mnslistBustypeExt === 'mer_service_after_sale_audit') { //退单列表
229
+ const merReturnPage = "/paas/merchant-pc/index.html#/returnsList?orderNo=" + expData.contractBillcode;
230
+ content = content.replace(expData.contractBillcode, `<a href="${merReturnPage}">${expData.contractBillcode}</a>`)
231
+ } else { //订单列表
232
+ const merOrderPage = "/paas/welfare-bus-pc/index.html#/orderListAll?contractBillcode=" + expData.contractBillcode;
233
+ content = content.replace(expData.contractBillcode, `<a href="${merOrderPage}">${expData.contractBillcode}</a>`)
234
+ }
235
+ }
236
+ if (expData.businessDes1) { //应收账单列表
237
+ const merReceivablePage = "/paas/bbc-bus-pc/index.html#/merchantReceivable?balancelistCode=" + expData.businessDes1;
238
+ content = content.replace(expData.businessDes1, `<a href="${merReceivablePage}">${expData.businessDes1}</a>`)
239
+ }
240
+ } else if (msg.platform === 'op') { //运营端
241
+ if (expData.goodsCode) { //商品列表
242
+ const opGoodsPage = "/paas/bbc-bus-pc/index.html#/auCommoditylist?goodsNo=" + expData.goodsCode;
243
+ content = content.replace(expData.goodsCode, `<a href="${opGoodsPage}">${expData.goodsCode}</a>`)
244
+ }
245
+ } else if (msg.platform === 'buy') { //商城端
246
+ if (expData.businessDes1) { //应付账单列表
247
+ const buyPayablePage = "/paas/bbc-cli-pc/index.html#/user?toPath=payable&balancelistCode=" + expData.businessDes1;
248
+ content = content.replace(expData.businessDes1, `<a href="${buyPayablePage}">${expData.businessDes1}</a>`)
249
+ }
250
+ if (expData.contractBillcode) { //订单号
251
+ if (msg.mnslistBustypeExt.includes('buy_service_after_sale')) { //售后列表
252
+ const buyRefundPage = "/paas/bbc-cli-pc/index.html#/user?toPath=afterSales&contractBillcode=" + expData.contractBillcode;
253
+ content = content.replace(expData.contractBillcode, `<a href="${buyRefundPage}">${expData.contractBillcode}</a>`)
254
+ } else { //订单列表
255
+ const buyOrderPage = "/paas/bbc-cli-pc/index.html#/user?toPath=order&contractBillcode=" + expData.contractBillcode;
256
+ content = content.replace(expData.contractBillcode, `<a href="${buyOrderPage}">${expData.contractBillcode}</a>`)
257
+ }
258
+ }
259
+ if (expData.contractBbillcode) { //订单批次号查询
260
+ if (msg.mnslistBustypeExt === 'buy_order_purchase_audit') { //请购审批
261
+ const buyBbillPage = "/paas/bbc-cli-pc/index.html#/user?toPath=apprOrderList&contractBbillcode=" + expData.contractBbillcode;
262
+ content = content.replace(expData.contractBbillcode, `<a href="${buyBbillPage}">${expData.contractBbillcode}</a>`)
263
+ } else { //订单列表
264
+ const buyOrderPage = "/paas/bbc-cli-pc/index.html#/user?toPath=order&contractBbillcode=" + expData.contractBbillcode;
265
+ content = content.replace(expData.contractBbillcode, `<a href="${buyOrderPage}">${expData.contractBbillcode}</a>`)
266
+ }
267
+ }
268
+
269
+ }
270
+ }
271
+ return content
272
+ } else {
273
+ return ''
274
+ }
275
+ }
208
276
  }
209
277
  },
210
278
  watch: {
@@ -306,25 +374,29 @@ export default {
306
374
  },
307
375
  // 行数据映射为组件所需结构
308
376
  mapMessage(row) {
377
+ let mnslistBustypeExt = row.mnslistBustypeExt
378
+ let platform = ''
379
+ if (mnslistBustypeExt) {
380
+ platform = mnslistBustypeExt.split('_')[0]
381
+ }
382
+ let mnslistExp = row.mnslistExp || ''
383
+ if (mnslistExp) {
384
+ mnslistExp = JSON.parse(mnslistExp)
385
+ }
309
386
  return {
310
387
  id: row.mnsblistId || row.id || '',
311
388
  typeId: this.activeType,
312
389
  subId: this.activeSub,
313
- title: row.mnschannelName || row.mnslistName || '',
314
- time: this.pickTime(row),
390
+ title: row.mnslistSubject || '',
391
+ time: parseTime(row.gmtCreate, '{y}-{m}-{d} {h}:{i}:{s}'),
315
392
  content: row.mnslistContent || '',
316
393
  isRead: String(row.stateExt) === '1',
317
- raw: row
394
+ raw: row,
395
+ mnslistExp: row.mnslistExp,
396
+ platform: platform || '',
397
+ mnslistBustypeExt: row.mnslistBustypeExt || ''
318
398
  }
319
399
  },
320
- // 兼容取消息时间字段
321
- pickTime(row) {
322
- const fields = ['gmtModified', 'gmtCreate', 'sendTime', 'createTime', 'mnsblistDate', 'mnsblistTime']
323
- for (const f of fields) {
324
- if (row[f]) return row[f]
325
- }
326
- return ''
327
- },
328
400
  emitUnreadCount() {
329
401
  this.$emit('unread-count-change', this.totalUnread)
330
402
  },
@@ -396,6 +468,7 @@ export default {
396
468
  if (!val) return
397
469
  const unread = this.filteredMessages.filter(m => !m.isRead)
398
470
  if (unread.length === 0) {
471
+ this.$message.warning('当前没有未读消息')
399
472
  this.markAllChecked = false
400
473
  return
401
474
  }
@@ -425,9 +498,6 @@ export default {
425
498
  this.markAllChecked = false
426
499
  }
427
500
  },
428
- renderContent(msg) {
429
- return msg.content
430
- },
431
501
  jumpToProduct(code) {
432
502
  this.$emit('jump-to-product', code)
433
503
  this.$message.info(`跳转至商品中心 - 商品管理 - 待审核商品列表,商品编号:${code}`)
@@ -141,11 +141,11 @@ export default {
141
141
  if (!current && this.current) {
142
142
  current = this.current;
143
143
  }
144
- if (this.$route.path && this.$route.meta) {
145
- if ('title' in this.$route.meta && 'icon' in this.$route.meta && 'menuCode' in this.$route.meta && 'params' in this.$route.meta) {
146
- sessionStorage.setItem('commonShowMenuAction', this.$route.path)
147
- }
148
- }
144
+ // if (this.$route.path && this.$route.meta) {
145
+ // if ('title' in this.$route.meta && 'icon' in this.$route.meta && 'menuCode' in this.$route.meta && 'params' in this.$route.meta) {
146
+ // sessionStorage.setItem('commonShowMenuAction', this.$route.path)
147
+ // }
148
+ // }
149
149
 
150
150
 
151
151
  console.log(current, 'current');
@@ -161,18 +161,18 @@ export default {
161
161
  console.log(current, 'path');
162
162
  console.log(path, 'path');
163
163
  console.log(sessionStorage.getItem('commonShowMenuAction'), this.$route, '当前路由信息');
164
- if (this.$route.name !== '首页' && this.$route.path !== '/404') {
165
- if (Object.keys(this.$route.meta) > 0) {
166
- if ('title' in this.$route.meta && 'icon' in this.$route.meta && 'menuCode' in this.$route.meta && 'params' in this.$route.meta) {
167
- path = path
168
- } else {
169
- path = sessionStorage.getItem('commonShowMenuAction') ? sessionStorage.getItem('commonShowMenuAction') : path
170
- }
171
- } else {
172
- path = sessionStorage.getItem('commonShowMenuAction') ? sessionStorage.getItem('commonShowMenuAction') : path
173
- }
164
+ // if (this.$route.name !== '首页' && this.$route.path !== '/404') {
165
+ // if (Object.keys(this.$route.meta) > 0) {
166
+ // if ('title' in this.$route.meta && 'icon' in this.$route.meta && 'menuCode' in this.$route.meta && 'params' in this.$route.meta) {
167
+ // path = path
168
+ // } else {
169
+ // path = sessionStorage.getItem('commonShowMenuAction') ? sessionStorage.getItem('commonShowMenuAction') : path
170
+ // }
171
+ // } else {
172
+ // path = sessionStorage.getItem('commonShowMenuAction') ? sessionStorage.getItem('commonShowMenuAction') : path
173
+ // }
174
174
 
175
- }
175
+ // }
176
176
 
177
177
  return path;
178
178
  },