parent
6a94e17cbb
commit
b09fe7ff15
@ -0,0 +1,4 @@
|
|||||||
|
VUE_APP_BASE_URL = https://k8s-horse-gateway.mashibing.cn
|
||||||
|
VUE_APP_STATIC_URL = https://k8s-shop-app.mashibing.cn
|
||||||
|
#VUE_APP_IM_URL = ws://192.168.10.94:8090
|
||||||
|
VUE_APP_IM_URL = wss://k8s-horse-gateway.mashibing.cn
|
@ -0,0 +1,3 @@
|
|||||||
|
VUE_APP_BASE_URL = https://you-gateway.mashibing.com
|
||||||
|
VUE_APP_STATIC_URL = https://you-gateway.mashibing.com
|
||||||
|
VUE_APP_IM_URL = wss://you-gateway.mashibing.com
|
@ -0,0 +1,3 @@
|
|||||||
|
VUE_APP_BASE_URL = https://you-gateway.mashibing.com
|
||||||
|
VUE_APP_STATIC_URL = https://you-gateway.mashibing.com
|
||||||
|
VUE_APP_IM_URL = wss://you-gateway.mashibing.com
|
@ -0,0 +1,3 @@
|
|||||||
|
VUE_APP_BASE_URL = https://k8s-horse-gateway.mashibing.com
|
||||||
|
VUE_APP_STATIC_URL = https://k8s-shop-app.mashibing.com
|
||||||
|
VUE_APP_IM_URL = wss://k8s-horse-gateway.mashibing.cn
|
@ -0,0 +1,25 @@
|
|||||||
|
.DS_Store
|
||||||
|
node_modules/
|
||||||
|
unpackage/
|
||||||
|
dist/
|
||||||
|
|
||||||
|
# local env files
|
||||||
|
.env.local
|
||||||
|
.env.*.local
|
||||||
|
|
||||||
|
# Log files
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
|
||||||
|
# Editor directories and files
|
||||||
|
.project
|
||||||
|
.idea
|
||||||
|
.vscode
|
||||||
|
*.suo
|
||||||
|
*.ntvs*
|
||||||
|
*.njsproj
|
||||||
|
*.sln
|
||||||
|
*.sw*
|
||||||
|
|
||||||
|
.history/
|
@ -0,0 +1,76 @@
|
|||||||
|
const plugins = []
|
||||||
|
|
||||||
|
if (process.env.UNI_OPT_TREESHAKINGNG) {
|
||||||
|
plugins.push(require('@dcloudio/vue-cli-plugin-uni-optimize/packages/babel-plugin-uni-api/index.js'))
|
||||||
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
(
|
||||||
|
process.env.UNI_PLATFORM === 'app-plus' &&
|
||||||
|
process.env.UNI_USING_V8
|
||||||
|
) ||
|
||||||
|
(
|
||||||
|
process.env.UNI_PLATFORM === 'h5' &&
|
||||||
|
process.env.UNI_H5_BROWSER === 'builtin'
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
const path = require('path')
|
||||||
|
|
||||||
|
const isWin = /^win/.test(process.platform)
|
||||||
|
|
||||||
|
const normalizePath = path => (isWin ? path.replace(/\\/g, '/') : path)
|
||||||
|
|
||||||
|
const input = normalizePath(process.env.UNI_INPUT_DIR)
|
||||||
|
try {
|
||||||
|
plugins.push([
|
||||||
|
require('@dcloudio/vue-cli-plugin-hbuilderx/packages/babel-plugin-console'),
|
||||||
|
{
|
||||||
|
file (file) {
|
||||||
|
file = normalizePath(file)
|
||||||
|
if (file.indexOf(input) === 0) {
|
||||||
|
return path.relative(input, file)
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
])
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
process.UNI_LIBRARIES = process.UNI_LIBRARIES || ['@dcloudio/uni-ui']
|
||||||
|
process.UNI_LIBRARIES.forEach(libraryName => {
|
||||||
|
plugins.push([
|
||||||
|
'import',
|
||||||
|
{
|
||||||
|
'libraryName': libraryName,
|
||||||
|
'customName': (name) => {
|
||||||
|
return `${libraryName}/lib/${name}/${name}`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
])
|
||||||
|
})
|
||||||
|
|
||||||
|
const config = {
|
||||||
|
presets: [
|
||||||
|
[
|
||||||
|
'@vue/app',
|
||||||
|
{
|
||||||
|
modules: 'commonjs',
|
||||||
|
useBuiltIns: process.env.UNI_PLATFORM === 'h5' ? 'usage' : 'entry'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
],
|
||||||
|
plugins
|
||||||
|
}
|
||||||
|
|
||||||
|
const UNI_H5_TEST = '**/@dcloudio/uni-h5/dist/index.umd.min.js'
|
||||||
|
if (process.env.NODE_ENV === 'production') {
|
||||||
|
config.overrides = [{
|
||||||
|
test: UNI_H5_TEST,
|
||||||
|
compact: true,
|
||||||
|
}]
|
||||||
|
} else {
|
||||||
|
config.ignore = [UNI_H5_TEST]
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = config
|
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"types": [
|
||||||
|
"@dcloudio/types",
|
||||||
|
"miniprogram-api-typings",
|
||||||
|
"mini-types"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,120 @@
|
|||||||
|
{
|
||||||
|
"name": "pay",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"serve": "npm run dev:h5",
|
||||||
|
"serve:test": "npm run dev:h5-test",
|
||||||
|
"serve:bate": "npm run dev:h5-bate",
|
||||||
|
"serve:prod": "npm run dev:h5-prod",
|
||||||
|
"build:test": "npm run build:h5-test",
|
||||||
|
"build:bate": "npm run build:h5-bate",
|
||||||
|
"build:prod": "npm run build:h5-prod",
|
||||||
|
"build:app-plus": "cross-env NODE_ENV=production UNI_PLATFORM=app-plus vue-cli-service uni-build",
|
||||||
|
"build:custom": "cross-env NODE_ENV=production uniapp-cli custom",
|
||||||
|
"build:h5-test": "cross-env NODE_ENV=production UNI_PLATFORM=h5 vue-cli-service uni-build --mode test",
|
||||||
|
"build:h5-bate": "cross-env NODE_ENV=production UNI_PLATFORM=h5 vue-cli-service uni-build --mode bate",
|
||||||
|
"build:h5-prod": "cross-env NODE_ENV=production UNI_PLATFORM=h5 vue-cli-service uni-build --mode prod",
|
||||||
|
"build:mp-360": "cross-env NODE_ENV=production UNI_PLATFORM=mp-360 vue-cli-service uni-build",
|
||||||
|
"build:mp-alipay": "cross-env NODE_ENV=production UNI_PLATFORM=mp-alipay vue-cli-service uni-build",
|
||||||
|
"build:mp-baidu": "cross-env NODE_ENV=production UNI_PLATFORM=mp-baidu vue-cli-service uni-build",
|
||||||
|
"build:mp-jd": "cross-env NODE_ENV=production UNI_PLATFORM=mp-jd vue-cli-service uni-build",
|
||||||
|
"build:mp-kuaishou": "cross-env NODE_ENV=production UNI_PLATFORM=mp-kuaishou vue-cli-service uni-build",
|
||||||
|
"build:mp-lark": "cross-env NODE_ENV=production UNI_PLATFORM=mp-lark vue-cli-service uni-build",
|
||||||
|
"build:mp-qq": "cross-env NODE_ENV=production UNI_PLATFORM=mp-qq vue-cli-service uni-build",
|
||||||
|
"build:mp-toutiao": "cross-env NODE_ENV=production UNI_PLATFORM=mp-toutiao vue-cli-service uni-build",
|
||||||
|
"build:mp-weixin": "cross-env NODE_ENV=production UNI_PLATFORM=mp-weixin vue-cli-service uni-build",
|
||||||
|
"build:mp-xhs": "cross-env NODE_ENV=production UNI_PLATFORM=mp-xhs vue-cli-service uni-build",
|
||||||
|
"build:quickapp-native": "cross-env NODE_ENV=production UNI_PLATFORM=quickapp-native vue-cli-service uni-build",
|
||||||
|
"build:quickapp-webview": "cross-env NODE_ENV=production UNI_PLATFORM=quickapp-webview vue-cli-service uni-build",
|
||||||
|
"build:quickapp-webview-huawei": "cross-env NODE_ENV=production UNI_PLATFORM=quickapp-webview-huawei vue-cli-service uni-build",
|
||||||
|
"build:quickapp-webview-union": "cross-env NODE_ENV=production UNI_PLATFORM=quickapp-webview-union vue-cli-service uni-build",
|
||||||
|
"dev:app-plus": "cross-env NODE_ENV=development UNI_PLATFORM=app-plus vue-cli-service uni-build --watch",
|
||||||
|
"dev:custom": "cross-env NODE_ENV=development uniapp-cli custom",
|
||||||
|
"dev:h5": "cross-env NODE_ENV=development UNI_PLATFORM=h5 vue-cli-service uni-serve",
|
||||||
|
"dev:h5-test": "cross-env NODE_ENV=development UNI_PLATFORM=h5 vue-cli-service uni-serve --mode test",
|
||||||
|
"dev:h5-bate": "cross-env NODE_ENV=development UNI_PLATFORM=h5 vue-cli-service uni-serve --mode bate",
|
||||||
|
"dev:h5-prod": "cross-env NODE_ENV=development UNI_PLATFORM=h5 vue-cli-service uni-serve --mode prod",
|
||||||
|
"dev:mp-360": "cross-env NODE_ENV=development UNI_PLATFORM=mp-360 vue-cli-service uni-build --watch",
|
||||||
|
"dev:mp-alipay": "cross-env NODE_ENV=development UNI_PLATFORM=mp-alipay vue-cli-service uni-build --watch",
|
||||||
|
"dev:mp-baidu": "cross-env NODE_ENV=development UNI_PLATFORM=mp-baidu vue-cli-service uni-build --watch",
|
||||||
|
"dev:mp-jd": "cross-env NODE_ENV=development UNI_PLATFORM=mp-jd vue-cli-service uni-build --watch",
|
||||||
|
"dev:mp-kuaishou": "cross-env NODE_ENV=development UNI_PLATFORM=mp-kuaishou vue-cli-service uni-build --watch",
|
||||||
|
"dev:mp-lark": "cross-env NODE_ENV=development UNI_PLATFORM=mp-lark vue-cli-service uni-build --watch",
|
||||||
|
"dev:mp-qq": "cross-env NODE_ENV=development UNI_PLATFORM=mp-qq vue-cli-service uni-build --watch",
|
||||||
|
"dev:mp-toutiao": "cross-env NODE_ENV=development UNI_PLATFORM=mp-toutiao vue-cli-service uni-build --watch",
|
||||||
|
"dev:mp-weixin": "cross-env NODE_ENV=development UNI_PLATFORM=mp-weixin vue-cli-service uni-build --watch",
|
||||||
|
"dev:mp-xhs": "cross-env NODE_ENV=development UNI_PLATFORM=mp-xhs vue-cli-service uni-build --watch",
|
||||||
|
"dev:quickapp-native": "cross-env NODE_ENV=development UNI_PLATFORM=quickapp-native vue-cli-service uni-build --watch",
|
||||||
|
"dev:quickapp-webview": "cross-env NODE_ENV=development UNI_PLATFORM=quickapp-webview vue-cli-service uni-build --watch",
|
||||||
|
"dev:quickapp-webview-huawei": "cross-env NODE_ENV=development UNI_PLATFORM=quickapp-webview-huawei vue-cli-service uni-build --watch",
|
||||||
|
"dev:quickapp-webview-union": "cross-env NODE_ENV=development UNI_PLATFORM=quickapp-webview-union vue-cli-service uni-build --watch",
|
||||||
|
"info": "node node_modules/@dcloudio/vue-cli-plugin-uni/commands/info.js",
|
||||||
|
"serve:quickapp-native": "node node_modules/@dcloudio/uni-quickapp-native/bin/serve.js",
|
||||||
|
"test:android": "cross-env UNI_PLATFORM=app-plus UNI_OS_NAME=android jest -i",
|
||||||
|
"test:h5": "cross-env UNI_PLATFORM=h5 jest -i",
|
||||||
|
"test:ios": "cross-env UNI_PLATFORM=app-plus UNI_OS_NAME=ios jest -i",
|
||||||
|
"test:mp-baidu": "cross-env UNI_PLATFORM=mp-baidu jest -i",
|
||||||
|
"test:mp-weixin": "cross-env UNI_PLATFORM=mp-weixin jest -i"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@dcloudio/uni-app-plus": "^2.0.1-34920220630001",
|
||||||
|
"@dcloudio/uni-h5": "^2.0.1-34920220630001",
|
||||||
|
"@dcloudio/uni-helper-json": "*",
|
||||||
|
"@dcloudio/uni-i18n": "^2.0.1-34920220630001",
|
||||||
|
"@dcloudio/uni-mp-360": "^2.0.1-34920220630001",
|
||||||
|
"@dcloudio/uni-mp-alipay": "^2.0.1-34920220630001",
|
||||||
|
"@dcloudio/uni-mp-baidu": "^2.0.1-34920220630001",
|
||||||
|
"@dcloudio/uni-mp-jd": "^2.0.1-34920220630001",
|
||||||
|
"@dcloudio/uni-mp-kuaishou": "^2.0.1-34920220630001",
|
||||||
|
"@dcloudio/uni-mp-lark": "^2.0.1-34920220630001",
|
||||||
|
"@dcloudio/uni-mp-qq": "^2.0.1-34920220630001",
|
||||||
|
"@dcloudio/uni-mp-toutiao": "^2.0.1-34920220630001",
|
||||||
|
"@dcloudio/uni-mp-vue": "^2.0.1-34920220630001",
|
||||||
|
"@dcloudio/uni-mp-weixin": "^2.0.1-34920220630001",
|
||||||
|
"@dcloudio/uni-mp-xhs": "^2.0.1-34920220630001",
|
||||||
|
"@dcloudio/uni-quickapp-native": "^2.0.1-34920220630001",
|
||||||
|
"@dcloudio/uni-quickapp-webview": "^2.0.1-34920220630001",
|
||||||
|
"@dcloudio/uni-stat": "^2.0.1-34920220630001",
|
||||||
|
"@vue/shared": "^3.0.0",
|
||||||
|
"core-js": "^3.6.5",
|
||||||
|
"flyio": "^0.6.2",
|
||||||
|
"regenerator-runtime": "^0.12.1",
|
||||||
|
"vue": "^2.6.11",
|
||||||
|
"vuex": "^3.2.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@babel/runtime": "~7.17.9",
|
||||||
|
"@dcloudio/types": "^3.0.4",
|
||||||
|
"@dcloudio/uni-automator": "^2.0.1-34920220630001",
|
||||||
|
"@dcloudio/uni-cli-i18n": "^2.0.1-34920220630001",
|
||||||
|
"@dcloudio/uni-cli-shared": "^2.0.1-34920220630001",
|
||||||
|
"@dcloudio/uni-migration": "^2.0.1-34920220630001",
|
||||||
|
"@dcloudio/uni-template-compiler": "^2.0.1-34920220630001",
|
||||||
|
"@dcloudio/vue-cli-plugin-hbuilderx": "^2.0.1-34920220630001",
|
||||||
|
"@dcloudio/vue-cli-plugin-uni": "^2.0.1-34920220630001",
|
||||||
|
"@dcloudio/vue-cli-plugin-uni-optimize": "^2.0.1-34920220630001",
|
||||||
|
"@dcloudio/webpack-uni-mp-loader": "^2.0.1-34920220630001",
|
||||||
|
"@dcloudio/webpack-uni-pages-loader": "^2.0.1-34920220630001",
|
||||||
|
"@vue/cli-plugin-babel": "~4.5.15",
|
||||||
|
"@vue/cli-service": "~4.5.15",
|
||||||
|
"babel-plugin-import": "^1.11.0",
|
||||||
|
"cross-env": "^7.0.3",
|
||||||
|
"jest": "^25.4.0",
|
||||||
|
"mini-types": "*",
|
||||||
|
"miniprogram-api-typings": "*",
|
||||||
|
"postcss-comment": "^2.0.0",
|
||||||
|
"sass": "^1.53.0",
|
||||||
|
"vue-template-compiler": "^2.6.11"
|
||||||
|
},
|
||||||
|
"browserslist": [
|
||||||
|
"Android >= 4.4",
|
||||||
|
"ios >= 9"
|
||||||
|
],
|
||||||
|
"resolutions": {
|
||||||
|
"@babel/runtime": "~7.17.9"
|
||||||
|
},
|
||||||
|
"uni-app": {
|
||||||
|
"scripts": {}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
const path = require('path')
|
||||||
|
module.exports = {
|
||||||
|
parser: require('postcss-comment'),
|
||||||
|
plugins: [
|
||||||
|
require('postcss-import')({
|
||||||
|
resolve (id, basedir, importOptions) {
|
||||||
|
if (id.startsWith('~@/')) {
|
||||||
|
return path.resolve(process.env.UNI_INPUT_DIR, id.substr(3))
|
||||||
|
} else if (id.startsWith('@/')) {
|
||||||
|
return path.resolve(process.env.UNI_INPUT_DIR, id.substr(2))
|
||||||
|
} else if (id.startsWith('/') && !id.startsWith('//')) {
|
||||||
|
return path.resolve(process.env.UNI_INPUT_DIR, id.substr(1))
|
||||||
|
}
|
||||||
|
return id
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
require('autoprefixer')({
|
||||||
|
remove: process.env.UNI_PLATFORM !== 'h5'
|
||||||
|
}),
|
||||||
|
require('@dcloudio/vue-cli-plugin-uni/packages/postcss')
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh-CN">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<title>
|
||||||
|
<%= htmlWebpackPlugin.options.title %>
|
||||||
|
</title>
|
||||||
|
<script>
|
||||||
|
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'))
|
||||||
|
document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')
|
||||||
|
</script>
|
||||||
|
<link rel="stylesheet" href="<%= BASE_URL %>static/index.<%= VUE_APP_INDEX_CSS_HASH %>.css" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<noscript>
|
||||||
|
<strong>Please enable JavaScript to continue.</strong>
|
||||||
|
</noscript>
|
||||||
|
<div id="app"></div>
|
||||||
|
<!-- built files will be auto injected -->
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
@ -0,0 +1,11 @@
|
|||||||
|
import Vue from 'vue'
|
||||||
|
|
||||||
|
declare module "vue/types/options" {
|
||||||
|
type Hooks = App.AppInstance & Page.PageInstance;
|
||||||
|
interface ComponentOptions<V extends Vue> extends Hooks {
|
||||||
|
/**
|
||||||
|
* 组件类型
|
||||||
|
*/
|
||||||
|
mpType?: string;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
onLaunch: function() {
|
||||||
|
console.log('App Launch')
|
||||||
|
},
|
||||||
|
onShow: function() {
|
||||||
|
console.log('App Show')
|
||||||
|
},
|
||||||
|
onHide: function() {
|
||||||
|
console.log('App Hide')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
/*每个页面公共css */
|
||||||
|
</style>
|
@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* @Author: ch
|
||||||
|
* @Date: 2022-04-29 14:26:10
|
||||||
|
* @LastEditors: ch
|
||||||
|
* @LastEditTime: 2022-06-30 16:03:35
|
||||||
|
* @Description: file content
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { ApiPostAliH5Pay, ApiPostAliAppPay } from '@/common/api/pay';
|
||||||
|
import ENV from '@/common/config/env';
|
||||||
|
export const Alipay = async ({orderId})=>{
|
||||||
|
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
const {error, result} = await ApiPostAliAppPay({orderId});
|
||||||
|
if(error){
|
||||||
|
uni.$u.toast(error.message);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const par = result.payDataInfo;
|
||||||
|
uni.requestPayment({
|
||||||
|
provider: 'alipay',
|
||||||
|
orderInfo :par.payData,
|
||||||
|
success(res) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url : `/payResult?orderId=${orderId}&payType=appWx`
|
||||||
|
});
|
||||||
|
},
|
||||||
|
fail(e) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url : `/payResult?orderId=${orderId}&payType=appWx`
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}).then(res => {
|
||||||
|
console.log('res',res);
|
||||||
|
})
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #ifdef H5
|
||||||
|
const { error, result } = await ApiPostAliH5Pay({
|
||||||
|
orderId,
|
||||||
|
returnUrl : decodeURIComponent(`${ENV.staticUrl}/payResult?orderId=${orderId}&payType=alih5`)
|
||||||
|
});
|
||||||
|
if(error){
|
||||||
|
uni.$u.toast(error.message);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
window.location.href = result.payDataInfo.payUrl;
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,78 @@
|
|||||||
|
/*
|
||||||
|
* @Author: ch
|
||||||
|
* @Date: 2022-04-29 14:26:10
|
||||||
|
* @LastEditors: ch
|
||||||
|
* @LastEditTime: 2022-07-08 17:38:48
|
||||||
|
* @Description: file content
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { ApiPostWxH5Pay, ApiPostWxJsApiPay, ApiPostWxAppPay } from '@/common/api/pay';
|
||||||
|
import ENV from '@/common/config/env';
|
||||||
|
export const Wxpay = async ({orderId,openId})=>{
|
||||||
|
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
const {error, result} = await ApiPostWxAppPay({orderId});
|
||||||
|
const par = result.payDataInfo;
|
||||||
|
uni.requestPayment({
|
||||||
|
provider: 'wxpay',
|
||||||
|
orderInfo :{
|
||||||
|
"appid": par.appId, // 微信开放平台 - 应用 - AppId
|
||||||
|
"noncestr": par.nonceStr, // 随机字符串
|
||||||
|
"package": par.packageValue, // 固定值
|
||||||
|
"partnerid": par.partnerId, // 微信支付商户号
|
||||||
|
"prepayid": par.prepayId, // 统一下单订单号
|
||||||
|
"timestamp": par.timeStamp ,// 时间戳(单位:秒)
|
||||||
|
"sign": par.sign // 签名,这里用的 MD5 签名
|
||||||
|
},
|
||||||
|
success(res) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url : `/payResult?orderId=${orderId}&payType=appWx`
|
||||||
|
});
|
||||||
|
},
|
||||||
|
fail(e) {
|
||||||
|
uni.navigateTo({
|
||||||
|
url : `/payResult?orderId=${orderId}&payType=appWx`
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}).then(res => {
|
||||||
|
console.log('res',res);
|
||||||
|
})
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #ifdef H5
|
||||||
|
// 有openId则判断在微信浏览器内
|
||||||
|
if(openId) {
|
||||||
|
// 微信JSAPI
|
||||||
|
const {error, result} = await ApiPostWxJsApiPay({orderId,openId});
|
||||||
|
if(error){
|
||||||
|
uni.$u.toast(error.message);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const par = result.payDataInfo;
|
||||||
|
WeixinJSBridge.invoke('getBrandWCPayRequest', {
|
||||||
|
appId : par.appId,
|
||||||
|
timeStamp : par.timeStamp,
|
||||||
|
nonceStr : par.nonceStr,
|
||||||
|
package: par.packageValue,
|
||||||
|
signType : par.signType,
|
||||||
|
paySign : par.paySign
|
||||||
|
}, res => {
|
||||||
|
if(res.err_msg !== 'get_brand_wcpay_request:cancel'){
|
||||||
|
uni.navigateTo({
|
||||||
|
url : `/payResult?orderId=${orderId}&payType=wxjsapi`
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
// h5支付
|
||||||
|
const {error, result} = await ApiPostWxH5Pay({orderId});
|
||||||
|
if(error){
|
||||||
|
uni.$u.toast(error.message);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const redirect_url = decodeURIComponent(`${ENV.staticUrl}/payResult?orderId=${orderId}&payType=wxh5`);
|
||||||
|
window.location.href = `${result.payDataInfo.h5Url}&redirect_url=${redirect_url}`;
|
||||||
|
}
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
import Vue from 'vue'
|
||||||
|
import App from './App'
|
||||||
|
|
||||||
|
Vue.config.productionTip = false
|
||||||
|
|
||||||
|
App.mpType = 'app'
|
||||||
|
|
||||||
|
const app = new Vue({
|
||||||
|
...App
|
||||||
|
})
|
||||||
|
app.$mount()
|
@ -0,0 +1,75 @@
|
|||||||
|
{
|
||||||
|
"name": "收银台",
|
||||||
|
"appid": "",
|
||||||
|
"description": "",
|
||||||
|
"versionName": "1.0.0",
|
||||||
|
"versionCode": "100",
|
||||||
|
"transformPx": false,
|
||||||
|
"app-plus": { /* 5+App特有相关 */
|
||||||
|
"usingComponents": true,
|
||||||
|
"splashscreen": {
|
||||||
|
"alwaysShowBeforeRender": true,
|
||||||
|
"waiting": true,
|
||||||
|
"autoclose": true,
|
||||||
|
"delay": 0
|
||||||
|
},
|
||||||
|
"modules": { /* 模块配置 */
|
||||||
|
|
||||||
|
},
|
||||||
|
"distribute": { /* 应用发布信息 */
|
||||||
|
"android": { /* android打包配置 */
|
||||||
|
"permissions": ["<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.READ_CONTACTS\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
|
||||||
|
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.WRITE_CONTACTS\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.RECORD_AUDIO\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.CALL_PHONE\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>",
|
||||||
|
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>",
|
||||||
|
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"ios": { /* ios打包配置 */
|
||||||
|
|
||||||
|
},
|
||||||
|
"sdkConfigs": { /* SDK配置 */
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"quickapp": { /* 快应用特有相关 */
|
||||||
|
|
||||||
|
},
|
||||||
|
"mp-weixin": { /* 微信小程序特有相关 */
|
||||||
|
"appid": "",
|
||||||
|
"setting": {
|
||||||
|
"urlCheck": false
|
||||||
|
},
|
||||||
|
"usingComponents": true
|
||||||
|
},
|
||||||
|
"mp-alipay" : {
|
||||||
|
"usingComponents" : true
|
||||||
|
},
|
||||||
|
"mp-baidu" : {
|
||||||
|
"usingComponents" : true
|
||||||
|
},
|
||||||
|
"mp-toutiao" : {
|
||||||
|
"usingComponents" : true
|
||||||
|
},
|
||||||
|
"mp-qq" : {
|
||||||
|
"usingComponents" : true
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,188 @@
|
|||||||
|
<!--
|
||||||
|
* @Author: ch
|
||||||
|
* @Date: 2022-07-08 11:46:30
|
||||||
|
* @LastEditors: ch
|
||||||
|
* @LastEditTime: 2022-07-08 18:21:00
|
||||||
|
* @Description: file content
|
||||||
|
-->
|
||||||
|
<template>
|
||||||
|
<view >
|
||||||
|
<view class="main">
|
||||||
|
<view>{{orderInfo.subject}}</view>
|
||||||
|
<view class="main--monery">¥{{orderInfo.amount}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="selector">
|
||||||
|
<view class="selector--title">选择支付方式</view>
|
||||||
|
<view class="selector--item" :class="{'selector--item__active' : payType === item.value}"
|
||||||
|
v-for="item in payTypeData" :key="item.value" @click="payType = item.value">
|
||||||
|
<view class="selector--item--label">
|
||||||
|
<image class="selector--item-img" :src="item.icon"/>
|
||||||
|
<text>{{item.label}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="selector--item-icon"></view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="btn" @click="pay">确认支付</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const ENV = process.env;
|
||||||
|
export default {
|
||||||
|
components:{},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
payType : 'wxpay',
|
||||||
|
payTypeData : [{
|
||||||
|
label : '微信支付',
|
||||||
|
icon : require('@/static/wx.png'),
|
||||||
|
value : 'wxpay'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label : '支付宝支付',
|
||||||
|
icon : require('@/static/ali.png'),
|
||||||
|
value : 'alipay'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
orderInfo : {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLoad() {
|
||||||
|
this.getOrderInfo();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getOrderInfo (){
|
||||||
|
uni.request({
|
||||||
|
url: `${process.env.VUE_APP_BASE_URL}/payCenter/payCenter/prepayOrder/prepay000010`,
|
||||||
|
success:(res)=> {
|
||||||
|
let data = res.data.data;
|
||||||
|
if(res.data.code === 'SUCCESS'){
|
||||||
|
this.orderInfo = data
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail(){
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
pay(){
|
||||||
|
if(this.payType === 'wxpay'){
|
||||||
|
this.wxPay();
|
||||||
|
}else{
|
||||||
|
this.aliPay();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
wxPay(){
|
||||||
|
// h5支付
|
||||||
|
uni.request({
|
||||||
|
url : `${ENV.VUE_APP_BASE_URL}/payCenter/payCenter/cashierPay`,
|
||||||
|
method : 'PUT',
|
||||||
|
data : {
|
||||||
|
payOrderNo : this.orderInfo.payOrderNo,
|
||||||
|
payCode : 'WX_H5',
|
||||||
|
appCode : this.orderInfo.prepayWxApp.prepayAppCode
|
||||||
|
},
|
||||||
|
success:(res)=>{
|
||||||
|
let data = res.data.data;
|
||||||
|
if(res.data.code === 'SUCCESS'){
|
||||||
|
window.location.href = data.payDataInfo.h5Url;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
aliPay(){
|
||||||
|
// 支付宝支付
|
||||||
|
uni.request({
|
||||||
|
url : `${ENV.VUE_APP_BASE_URL}/payCenter/payCenter/cashierPay`,
|
||||||
|
method : 'PUT',
|
||||||
|
data : {
|
||||||
|
payOrderNo : this.orderInfo.payOrderNo,
|
||||||
|
payCode : 'ALI_WAP',
|
||||||
|
appCode : this.orderInfo.prepayAliApp.prepayAppCode
|
||||||
|
},
|
||||||
|
success:(res)=>{
|
||||||
|
let data = res.data.data;
|
||||||
|
if(res.data.code === 'SUCCESS'){
|
||||||
|
window.location.href = data.payDataInfo.payUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.main{
|
||||||
|
height: 312rpx;
|
||||||
|
padding-top: 74rpx;
|
||||||
|
font-size: 30rpx;
|
||||||
|
text-align: center;
|
||||||
|
&--monery{
|
||||||
|
margin-top: 40rpx;
|
||||||
|
font-size: 76rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.selector{
|
||||||
|
border-top: 1rpx solid #f8f8f8;
|
||||||
|
&--title{
|
||||||
|
height: 112rpx;
|
||||||
|
line-height: 112rpx;
|
||||||
|
font-size: 32rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
padding: 0 40rpx;
|
||||||
|
}
|
||||||
|
&--item{
|
||||||
|
width: 670rpx;
|
||||||
|
height: 126rpx;
|
||||||
|
margin: 0 auto;
|
||||||
|
border-bottom: 1rpx solid #f8f8f8;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
font-size: 30rpx;
|
||||||
|
&:last-child{
|
||||||
|
border-bottom: 0;
|
||||||
|
}
|
||||||
|
&--label{
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
&-img{
|
||||||
|
width: 50rpx;
|
||||||
|
height: 50rpx;
|
||||||
|
margin-right: 20rpx;
|
||||||
|
}
|
||||||
|
&-icon{
|
||||||
|
width: 32rpx;
|
||||||
|
height: 32rpx;
|
||||||
|
border: 1rpx solid #ccc;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
&__active{
|
||||||
|
.selector--item-icon{
|
||||||
|
border: 12rpx solid #FB3A4E;
|
||||||
|
width: 10rpx;
|
||||||
|
height: 10rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.btn{
|
||||||
|
width: 670rpx;
|
||||||
|
height: 80rpx;
|
||||||
|
line-height: 80rpx;
|
||||||
|
border-radius: 100rpx;
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #fff;
|
||||||
|
background: #FB3A4E;
|
||||||
|
text-align: center;
|
||||||
|
position: fixed;
|
||||||
|
bottom: calc(var(--window-bottom) + 40rpx);
|
||||||
|
left: 40rpx;
|
||||||
|
}
|
||||||
|
</style>
|
@ -0,0 +1,62 @@
|
|||||||
|
<!--
|
||||||
|
* @Author: ch
|
||||||
|
* @Date: 2022-07-08 15:30:29
|
||||||
|
* @LastEditors: ch
|
||||||
|
* @LastEditTime: 2022-07-08 17:00:04
|
||||||
|
* @Description: file content
|
||||||
|
-->
|
||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<template v-if="status === 'await'">
|
||||||
|
<view class="icon icon__await"></view>
|
||||||
|
<view class="title">支付成功</view>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="status === 'fail'">
|
||||||
|
<view class="icon icon__fail"></view>
|
||||||
|
<view class="title">支付成功</view>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<view class="icon icon__success"></view>
|
||||||
|
<view class="title">支付成功</view>
|
||||||
|
</template>
|
||||||
|
<view class="btn">返回商家</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data(){
|
||||||
|
return {
|
||||||
|
status : 'success'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.icon{
|
||||||
|
width: 120rpx;
|
||||||
|
height: 120rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
margin: 166rpx auto 50rpx;
|
||||||
|
&__await{
|
||||||
|
background: #61ADFF;
|
||||||
|
}
|
||||||
|
&__fail{
|
||||||
|
background: #FF512B;
|
||||||
|
}
|
||||||
|
&__success{
|
||||||
|
background: #71CD87;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.title{
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.btn{
|
||||||
|
height: 80rpx;
|
||||||
|
width: 450rpx;
|
||||||
|
line-height: 80rpx;
|
||||||
|
margin: 150rpx auto;
|
||||||
|
border: 1rpx solid #ccc;
|
||||||
|
border-radius: 100rpx;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
</style>
|
After Width: | Height: | Size: 929 B |
After Width: | Height: | Size: 1.1 KiB |
Loading…
Reference in new issue