Browse Source

动态获取模板ID

master
朱耘稷 4 years ago
parent
commit
87864d6751
  1. 8
      api/order.js
  2. 11
      libs/order.js

8
api/order.js

@ -140,3 +140,11 @@ export function payOrder(uni, paytype, from) {
export function orderVerific(verifyCode, isConfirm) {
return request.post("order/order_verific", { verifyCode, isConfirm });
}
/**
* 获取订阅消息ID
* @param price
* @returns {*}
*/
export function getSubscribeTemplate() {
return request.get("/order/getSubscribeTemplate");
}

11
libs/order.js

@ -2,7 +2,8 @@ import {
cancelOrder,
takeOrder,
delOrder,
payOrder
payOrder,
getSubscribeTemplate
} from "@/api/order";
import dialog from "@/utils/dialog";
import {
@ -196,10 +197,10 @@ export function handleOrderPayResults(data, type, payType) {
export function subscribeMessage() {
// 调用订阅
console.log('调用订阅')
getSubscribeTemplate()
.then(res => {
uni.requestSubscribeMessage({
tmplIds: ['W5r2c2kzhbq8uxStkPAVx_sk-5aapMFCqe7b7KU5jXI', '2CB_1UyQrbnlyjJa5syraqJ3cfztPPDOAHe3DEXpMjg',
'vuztugw9VbKbKJDAAVePkjqPpT5mdoREpd4Aq7EGPRU'
],
tmplIds: res.data,
success(res) {
console.log(res)
},
@ -207,6 +208,8 @@ export function subscribeMessage() {
console.log(error)
}
})
})
.catch(err => {});
}

Loading…
Cancel
Save