国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

Electron-vue開發的客戶端支付收款工具的實現

2019-11-19 11:28:36
字體:
來源:轉載
供稿:網友

目前實現了支付寶當面付的掃碼支付功能、二維碼支付功能,即主動掃和被動掃。測試請使用支付寶沙箱環境,支付寶是沙箱版。

最終效果如下:


前端頁面使用阿里的組件,ant-design-vue

通過node,使用nedb內存數據庫進行本地數據存儲


安裝文件支持自定義。生成的exe,安裝過程如下

程序代碼簡述


main.js

import devtools from '@vue/devtools'import Vue from 'vue'import axios from 'axios'import App from './App'import router from './router'import store from './store'import db from './nedb'//訂單表import Antd from 'ant-design-vue'import 'ant-design-vue/dist/antd.css'import alipayhelper from './alipayhelper'import moment from 'moment'//導入文件Vue.prototype.$moment = moment;//賦值使用Vue.prototype.$db = dbVue.prototype.alipayhelper = alipayhelper;Vue.use(Antd)if (!process.env.IS_WEB) Vue.use(require('vue-electron'))Vue.http = Vue.prototype.$http = axiosVue.config.productionTip = false/* eslint-disable no-new */new Vue({ components: { App }, router, store, template: '<App/>'}).$mount('#app')

alipayhelper.js 里存儲的支付寶收款方的APPID,pem路徑下應用私鑰。這些信息可以通過阿里官方申請,即可以在線收款

const path = require('path');const fs = require('fs');const moment = require('moment');const crypto = require('crypto');const electron = require('electron');const dataPath = (electron.app || electron.remote.app).getPath('userData');const home = (electron.app || electron.remote.app).getPath('home');const appData = (electron.app || electron.remote.app).getPath('appData');let ALI_PAY_SETTINGS = {  APP_ID: '2016100100638328',  APP_GATEWAY_URL: 'http://localhost',//用于接收支付寶異步通知  AUTH_REDIRECT_URL: 'xxxxxxx',//第三方授權或用戶信息授權后回調地址。授權鏈接中配置的redirect_uri的值必須與此值保持一致。  //__dirname 獲取當前目錄,無法在生產模式assr 獲取到路徑  /* APP_PRIVATE_KEY_PATH: path.join(__dirname, 'pem', 'rsa_private_key.pem'),//應用私鑰  APP_PUBLIC_KEY_PATH: path.join(__dirname, 'pem', 'rsa_public_key.pem'),//應用公鑰  ALI_PUBLIC_KEY_PATH: path.join(__dirname, 'pem','ali_rsa_public_key.pem'),//阿里公鑰*/  APP_PRIVATE_KEY_PATH: path.join(__static, '/pem/rsa_private_key.pem'),//應用私鑰  APP_PUBLIC_KEY_PATH: path.join(__static, '/pem/rsa_public_key.pem'),//應用公鑰  ALI_PUBLIC_KEY_PATH: path.join(__static, '/pem/ali_rsa_public_key.pem'),//阿里公鑰  AES_PATH: path.join(__dirname, 'pem', 'remind', 'sandbox', 'aes.txt'),//aes加密(暫未使用)  ALI_GATEWAY_URL: 'https://openapi.alipaydev.com/gateway.do?',//用于接收支付寶異步通知};

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持武林網。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 汝阳县| 垣曲县| 德钦县| 白水县| 格尔木市| 息烽县| 衡南县| 东宁县| 巫山县| 东山县| 明水县| 南阳市| 衡东县| 嘉定区| 天气| 库尔勒市| 合作市| 隆子县| 武冈市| 盐城市| 德惠市| 柞水县| 厦门市| 称多县| 白城市| 揭东县| 丹凤县| 当雄县| 宜昌市| 永福县| 哈巴河县| 云林县| 喜德县| 中牟县| 西丰县| 莱西市| 蕲春县| 扶风县| 博客| 河曲县| 金堂县|