5 changed files with 140 additions and 17 deletions
Split View
Diff Options
-
4pages/mine/index.vue
-
8pages/trade/index.vue
-
142utils/handlePushMsg.js
-
1utils/hook.js
-
2utils/is.js
@ -1,20 +1,140 @@ |
|||
import { isObject } from './is.js' |
|||
import { loginGo2 } from './hook.js' |
|||
/** |
|||
* 消息类型 4:提交询价,1:客户下单,88:订单取消,87:订单超时,86:客户订单融资提醒,85:客户融资逾期提醒,84:客户合同签署提醒,83:客户订单融资完成 |
|||
*/ |
|||
const messageTypes = { |
|||
4: { |
|||
title: '提交询价', |
|||
fn: handleEnquiry |
|||
}, |
|||
1: { |
|||
title: '客户下单', |
|||
fn: handleOrderMake |
|||
}, |
|||
88: { |
|||
title: '订单取消', |
|||
fn: handleOrderCancel |
|||
}, |
|||
87: { |
|||
title: '订单超时', |
|||
fn: handleOrderTimingEnd |
|||
}, |
|||
86: { |
|||
title: '客户订单融资提醒', |
|||
fn: handleOrderRepaying |
|||
}, |
|||
85: { |
|||
title: '客户融资逾期提醒', |
|||
fn: handleOrderOverdue |
|||
}, |
|||
84: { |
|||
title: '客户合同签署提醒', |
|||
fn: handleOrderContract |
|||
}, |
|||
83: { |
|||
title: '客户订单融资完成', |
|||
fn: handleOrderCompleted |
|||
} |
|||
} |
|||
/** |
|||
* 统一处理push消息 |
|||
* @param {Object} msg 消息对象 |
|||
* @value {string} msg.title 消息标题 |
|||
* @value {string} msg.content 消息内容 |
|||
* @value {object} msg.payload 消息参数 |
|||
* @value {string} msg.payload.messageType |
|||
*/ |
|||
export default function handlePushMsg(msg) { |
|||
uni.showModal({ |
|||
title: '测试', |
|||
content: JSON.stringify(msg), |
|||
success: function (res) { |
|||
if (res.confirm) { |
|||
console.log('用户点击确定') |
|||
} else if (res.cancel) { |
|||
console.log('用户点击取消') |
|||
} |
|||
} |
|||
}) |
|||
if (!isObject(msg.payload)) { |
|||
msg.payload = JSON.parse(msg.payload) |
|||
} |
|||
const data = msg.payload |
|||
const target = messageTypes[data.messageType] |
|||
if (target) { |
|||
target.fn(data) |
|||
} |
|||
// uni.showModal({
|
|||
// title: '测试',
|
|||
// content: JSON.stringify(msg),
|
|||
// success: function (res) {
|
|||
// if (res.confirm) {
|
|||
// console.log('用户点击确定')
|
|||
// } else if (res.cancel) {
|
|||
// console.log('用户点击取消')
|
|||
// }
|
|||
// }
|
|||
// })
|
|||
} |
|||
|
|||
/** |
|||
* 提交询价 |
|||
* @param {object} params replyId |
|||
*/ |
|||
function handleEnquiry(params) { |
|||
let replyId = params.replyId || '' |
|||
loginGo2('submit-quotation', { id: replyId }) |
|||
} |
|||
|
|||
/** |
|||
* 提交订单 |
|||
* @param {object} params replyId |
|||
*/ |
|||
function handleOrderMake(params) { |
|||
let replyId = params.replyId || '' |
|||
loginGo2('order-detail', { orderId: replyId }) |
|||
} |
|||
|
|||
/** |
|||
* 取消订单 |
|||
* @param {object} params replyId |
|||
*/ |
|||
function handleOrderCancel(params) { |
|||
let replyId = params.replyId || '' |
|||
loginGo2('order-detail', { orderId: replyId }) |
|||
} |
|||
|
|||
/** |
|||
* 订单超时 |
|||
* @param {object} params replyId |
|||
*/ |
|||
function handleOrderTimingEnd(params) { |
|||
let replyId = params.replyId || '' |
|||
loginGo2('order-detail', { orderId: replyId }) |
|||
} |
|||
|
|||
/** |
|||
* 客户订单融资提醒 |
|||
* @param {object} params replyId |
|||
*/ |
|||
function handleOrderRepaying(params) { |
|||
let replyId = params.replyId || '' |
|||
loginGo2('order-detail', { orderId: replyId }) |
|||
} |
|||
|
|||
/** |
|||
* 客户融资逾期提醒 |
|||
* @param {object} params replyId |
|||
*/ |
|||
function handleOrderOverdue(params) { |
|||
let replyId = params.replyId || '' |
|||
loginGo2('order-detail', { orderId: replyId }) |
|||
} |
|||
|
|||
/** |
|||
* 客户合同签署提醒 |
|||
* @param {object} params replyId |
|||
*/ |
|||
function handleOrderContract(params) { |
|||
let replyId = params.replyId || '' |
|||
loginGo2('order-detail', { orderId: replyId }) |
|||
} |
|||
|
|||
/** |
|||
* 客户订单融资完成 |
|||
* @param {object} params replyId |
|||
*/ |
|||
function handleOrderCompleted(params) { |
|||
let replyId = params.replyId || '' |
|||
loginGo2('order-detail', { orderId: replyId }) |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save