Browse Source

动态获取模板ID

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

8
api/order.js

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

31
libs/order.js

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

Loading…
Cancel
Save