users/pages/order/offlinepay/utils/getMerchFn.js

50 lines
1.5 KiB
JavaScript
Raw Normal View History

2024-11-08 14:43:06 +08:00
const core = getApp().globalData.requirejs("core")
module.exports={
// 处理页面传参,获取商户ID
getMerchID: function(that,queryData) {
// 固定通用收款码
if (queryData && typeof(queryData.device_sn) != 'undefined' && queryData.device_sn) {
getApp().globalData.request({
s: 'Merch_Index.SoundDevice4MerchOffline',
device_sn: queryData.device_sn
}).then(function(merchData) {
let merchRes = merchData.data.data
if (merchRes.result_code == "SUCCESS") {
// 如果是已经开通商户的二维码,直接进入付款
that.hasMerchData2Next(merchData)
// 商家金豆分润处理
queryData.mid = merchRes.mid
getApp().globalData.setCache("usermid", queryData, 7200)
} else {
// 如果是没开通商户的二维码直接进入到商户入驻
if (typeof(merchRes.imei) != undefined && merchRes.imei) {
uni.reLaunch({
url: '/pages/merch/apply/apply?imei=' + merchRes.imei
})
} else {
uni.showModal({
title: '提示',
content: merchRes.err_code_desc
})
}
}
})
} else {
// 老式二维码
if (!queryData || !queryData.merchid) {
uni.showModal({
title: '提示',
content: '网络开小差啦,重新扫码试试吧!1623124885'
})
return
} else {
that.merchid = queryData.merchid
that.getList(queryData.merchid)
}
}
if (queryData && typeof(queryData.mid) != 'undefined' && queryData.mid) {
getApp().globalData.setCache("usermid", queryData, 7200)
}
},
}