12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- import { getDepositDetails, getsubscribeID } from "./service";
- import { reportApi } from "../../utils/cloudMonitorHelper";
- import { getAuthUser } from "../../../../core/utils/jsapi";
- Component({
- data: {
- showSubscrible: false,
- // 是否显示订阅部分
- detail: null,
- // 缴纳详情
- isReady: false,
- },
- didMount() {
- const { depositId, inpatientId, hisPatientId, name } =
- this.$page.data.query || {};
- this.getDepositDetailsFn(depositId, inpatientId, hisPatientId, name);
- // this.subscribeMsg();
- /* 服务办结,押金缴纳完成 */
- reportApi("押金缴纳完成");
- },
- methods: {
- subscribeMsg() {
- const pluginId = 2021001155639035;
- my.loadPlugin({
- plugin: `${pluginId}@*`,
- success: () => {
- this.setData({
- isReady: true,
- }); // 储存插件实列
- // eslint-disable-next-line no-undef
- const pluginInstance = requirePlugin(`dynamic-plugin://${pluginId}`);
- this.requestSubscribeMessage = pluginInstance.requestSubscribeMessage;
- },
- });
- },
- showSubscrible() {
- this.setData({
- showSubscrible: false,
- });
- },
- // 订阅插件要用时,请放开注释
- requestSubscribeMessageFn(subscribeID) {
- return new Promise((resolve) => {
- my.requestSubscribeMessage({
- // 模板id列表,最多3个
- entityIds: [subscribeID],
- callback() {
- resolve(true);
- },
- complete(result) {
- console.log("result ==>", result);
- },
- });
- });
- },
- async gotoSubscrible() {
- try {
- // my.getAuthCode({
- // scopes: ["auth_user", "hospital_order"],
- // success: (res) => {
- // console.log("authCode ===>", res.authCode);
- // },
- // });
- const [err, authResult] = await getAuthUser(["hospital_order"]);
- console.log("authResult ===>", authResult.authCode);
- const subscribeID = await getsubscribeID();
- await this.requestSubscribeMessageFn(subscribeID.depositTemplateId);
- } catch (error) {
- console.log(error, "error");
- }
- },
- // 获取支付详情
- async getDepositDetailsFn(depositId, inpatientId, hisPatientId, name) {
- try {
- const detail = await getDepositDetails({
- depositId,
- hisPatientId: hisPatientId,
- receiptNo: depositId,
- name,
- });
- this.setData({
- detail,
- });
- } catch (error) {
- console.log(error, "error");
- }
- },
- },
- });
|