Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mongo-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ui
mongo-ui
Commits
3be0e743
Commit
3be0e743
authored
Jul 29, 2020
by
郭志伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 接口对接
parent
4008410b
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
272 additions
and
7 deletions
+272
-7
App.vue
src/App.vue
+2
-2
index.js
src/api/index.js
+0
-0
order.js
src/api/order.js
+17
-0
user.js
src/api/user.js
+26
-0
dev.config.js
src/config/dev.config.js
+2
-1
prod.config.js
src/config/prod.config.js
+2
-1
index.js
src/router/index.js
+5
-0
http.js
src/service/http.js
+45
-2
index.js
src/store/index.js
+1
-1
paytest.vue
src/views/paytest.vue
+172
-0
No files found.
src/App.vue
View file @
3be0e743
<
template
>
<
template
>
<div
id=
"app"
>
<div
id=
"app"
>
<router-view
/>
<router-view
/>
<div
class=
"loading-container"
>
<div
class=
"loading-container"
v-show=
"isLoading"
>
<cr-loading
v-show=
"isLoading"
class=
"loading"
size=
"24px"
>
加载中...
</cr-loading>
<cr-loading
class=
"loading"
size=
"24px"
>
加载中...
</cr-loading>
</div>
</div>
</div>
</div>
</
template
>
</
template
>
...
...
src/api/index.js
deleted
100644 → 0
View file @
4008410b
src/api/order.js
0 → 100644
View file @
3be0e743
import
req
from
"
@/service/http
"
;
// 下单流程
export
const
placeOrder
=
{
// 创建保单订单
create
:
params
=>
{
return
req
.
post
(
"
policy_order
"
,
params
);
},
// 获取订单支付信息
pay
:
params
=>
{
return
req
.
post
(
"
pay/go
"
,
params
);
},
// 轮询支付结果
polling
:
params
=>
{
return
req
.
get
(
"
pay/result
"
,
params
);
}
};
src/api/user.js
0 → 100644
View file @
3be0e743
import
req
from
"
@/service/http
"
;
// 手机号登录
export
const
loginByPhone
=
param
=>
{
return
req
.
post
(
"
user/login
"
,
param
);
};
// 信用钱包用户自动登录
export
const
loginByxyqb
=
param
=>
{
return
req
.
get
(
"
xyqb_user_info
"
,
param
);
};
// 微信用户获取openid
export
const
getwxOpenId
=
param
=>
{
return
req
.
post
(
"
wechat/code
"
,
param
);
};
// 获取短信验证码
export
const
getCaptchaSms
=
param
=>
{
return
req
.
post
(
"
captcha/sms
"
,
param
);
};
// 获取图形验证码
export
const
getCaptchaImg
=
param
=>
{
return
req
.
post
(
"
captcha/image
"
,
param
);
};
src/config/dev.config.js
View file @
3be0e743
export
default
{
export
default
{
basicHost
:
"
https://talos-vcc.liangkebang.net
"
basicHost
:
"
http://yapi.quantgroups.com/mock/329/
"
,
wxAppId
:
"
wx514de17b23d53a20
"
};
};
src/config/prod.config.js
View file @
3be0e743
export
default
{
export
default
{
basicHost
:
"
https://talos-vcc.liangkebang.net
"
basicHost
:
"
https://talos-vcc.liangkebang.net
"
,
wxAppId
:
"
wx514de17b23d53a20
"
};
};
src/router/index.js
View file @
3be0e743
...
@@ -79,6 +79,11 @@ const routes = [
...
@@ -79,6 +79,11 @@ const routes = [
name
:
"
Introduction
"
,
name
:
"
Introduction
"
,
component
:
()
=>
import
(
"
../views/Introduction/index.vue
"
)
component
:
()
=>
import
(
"
../views/Introduction/index.vue
"
)
},
},
{
path
:
"
/paytest
"
,
name
:
"
Introduction
"
,
component
:
()
=>
import
(
"
../views/paytest
"
)
},
{
{
path
:
"
*
"
,
path
:
"
*
"
,
redirect
:
"
/goods
"
redirect
:
"
/goods
"
...
...
src/service/http.js
View file @
3be0e743
...
@@ -3,6 +3,7 @@ import store from "@/store";
...
@@ -3,6 +3,7 @@ import store from "@/store";
import
axios
from
"
axios
"
;
import
axios
from
"
axios
"
;
import
cherry
from
"
@qg/cherry-ui
"
;
import
cherry
from
"
@qg/cherry-ui
"
;
import
config
from
"
../config
"
;
import
config
from
"
../config
"
;
// import qs from "qs";
const
CancelToken
=
axios
.
CancelToken
;
const
CancelToken
=
axios
.
CancelToken
;
const
{
Notify
}
=
cherry
;
const
{
Notify
}
=
cherry
;
...
@@ -53,7 +54,8 @@ axios.interceptors.response.use(
...
@@ -53,7 +54,8 @@ axios.interceptors.response.use(
afterRequest
();
afterRequest
();
delete
pending
[
response
.
config
.
url
];
delete
pending
[
response
.
config
.
url
];
if
(
response
.
data
.
code
===
0
)
{
if
(
response
.
data
.
code
===
0
)
{
return
response
.
data
.
data
;
return
response
.
data
;
// return response.data.data;
}
}
Notify
({
type
:
"
danger
"
,
message
:
response
.
data
.
msg
||
"
后端服务异常
"
});
Notify
({
type
:
"
danger
"
,
message
:
response
.
data
.
msg
||
"
后端服务异常
"
});
},
},
...
@@ -116,4 +118,45 @@ axios.interceptors.response.use(
...
@@ -116,4 +118,45 @@ axios.interceptors.response.use(
}
}
);
);
export
default
axios
;
export
default
{
axios
,
//get请求
get
(
url
,
params
=
{})
{
return
new
Promise
((
resolve
,
reject
)
=>
{
axios
({
method
:
"
get
"
,
// url: url + "?" + qs.stringify(params),
url
:
url
,
params
,
headers
:
{
"
Content-Type
"
:
"
application/json
"
}
})
.
then
(
res
=>
{
resolve
(
res
);
})
.
catch
(
e
=>
{
reject
(
e
);
});
});
},
//post请求
post
(
url
,
params
=
{})
{
return
new
Promise
((
resolve
,
reject
)
=>
{
axios
({
method
:
"
post
"
,
url
,
data
:
params
,
headers
:
{
"
Content-Type
"
:
"
application/json
"
}
})
.
then
(
res
=>
{
resolve
(
res
);
})
.
catch
(
e
=>
{
reject
(
e
);
});
});
}
};
src/store/index.js
View file @
3be0e743
...
@@ -6,7 +6,7 @@ Vue.use(Vuex);
...
@@ -6,7 +6,7 @@ Vue.use(Vuex);
export
default
new
Vuex
.
Store
({
export
default
new
Vuex
.
Store
({
state
:
{
state
:
{
activeIdx
:
0
,
activeIdx
:
0
,
isLoading
:
tru
e
isLoading
:
fals
e
},
},
mutations
:
{
mutations
:
{
setActiveIdx
(
state
,
value
)
{
setActiveIdx
(
state
,
value
)
{
...
...
src/views/paytest.vue
0 → 100644
View file @
3be0e743
<
template
>
<div
class=
"container"
>
<cr-button
block
type=
"danger"
@
click=
"login"
>
登录
</cr-button>
<cr-divider
/>
<cr-button
block
>
生成订单(微信JSAPI支付)
</cr-button>
<cr-button
block
>
生成订单(微信H5支付)
</cr-button>
<cr-button
block
>
生成订单(第三方收银台支付)
</cr-button>
<cr-divider
/>
<cr-button
type=
"warning"
block
>
调起支付
</cr-button>
<cr-divider
/>
<div
class=
"state"
>
<h5>
基本信息:
</h5>
<p>
当前环境:
{{
browerEnv
}}
</p>
<p>
登录状态:
{{
!!
mongoToken
}}
</p>
<p
v-if=
"browerEnv === 'weixin'"
>
微信code获取状态:
</p>
<cr-divider
/>
<h5>
登录信息:
</h5>
<p
v-for=
"(item, key) in loginInfo"
:key=
"key"
>
{{
key
}}
:
{{
item
}}
</p>
<cr-divider
/>
<h5>
支付信息:
</h5>
<p
v-for=
"(item, key) in payInfo"
:key=
"key"
>
{{
key
}}
:
{{
item
}}
</p>
<cr-divider
/>
<h5>
订单信息:
</h5>
<p
v-for=
"(item, key) in orderInfo"
:key=
"key"
>
{{
key
}}
:
{{
item
}}
</p>
<cr-divider
/>
<h5>
保险订单信息:
</h5>
<p
v-for=
"(item, key) in insuredOrderInfo"
:key=
"key"
v-html=
"`$
{key}: ${brFilter(item)}`"
>
</p>
</div>
</div>
</
template
>
<
script
>
/**
* @description: 支付测试页面
* @param {type}
* @return:
*/
import
{
loginByPhone
,
getwxOpenId
}
from
"
@/api/user
"
;
import
cfg
from
"
@/config
"
;
export
default
{
name
:
"
paytest
"
,
data
()
{
return
{
browerEnv
:
""
,
xyqbToken
:
""
,
mongoToken
:
""
,
loginInfo
:
{
phoneNo
:
"
18611428880
"
,
verifyCode
:
"
123456
"
,
loginChannel
:
"
1
"
},
insuredOrderInfo
:
{
insuredUserInfo
:
{
phoneNo
:
"
13209654413
"
,
userInfoSecId
:
"
commodo
"
,
userName
:
"
罗刚
"
,
idNo
:
"
566254180010306614
"
,
longTerm
:
false
,
validEnd
:
"
1978-11-18
"
,
relation
:
"
1
"
,
socialSecurity
:
false
,
email
:
"
s.yfyviye@mxxv.ki
"
,
annualIncome
:
"
17159
"
,
addressCode
:
"
110100
"
,
addressDetail
:
"
海外
"
,
occupation
:
"
5
"
,
height
:
169
,
weight
:
58
,
bankCardCode
:
"
ICBC
"
,
bankCardNo
:
"
6220549771082240618
"
},
productNo
:
"
1
"
,
holderUserInfo
:
{
phoneNo
:
"
13499177270
"
,
userInfoSecId
:
"
eu in
"
,
userName
:
"
崔静
"
,
idNo
:
"
16479119920330003X
"
,
longTerm
:
false
,
validEnd
:
"
1985-09-23
"
,
socialSecurity
:
false
,
email
:
"
n.ata@ueccvun.bz
"
,
annualIncome
:
"
35555
"
,
addressCode
:
"
110100
"
,
addressDetail
:
"
白城市
"
,
occupation
:
"
1
"
,
height
:
186
,
weight
:
54
,
bankCardCode
:
"
ICBC
"
,
bankCardNo
:
"
667782802278796
"
},
insuredAmount
:
"
57
"
,
policyPeriod
:
"
26
"
,
paymentType
:
4
,
paymentPeriod
:
"
et in
"
,
effectiveDate
:
"
2003-07-06 23:11:44
"
,
autoRenewPolicy
:
true
},
orderInfo
:
{},
openId
:
localStorage
.
getItem
(
"
openId
"
),
payInfo
:
{}
};
},
mounted
()
{
this
.
getCurrentBrowerEnv
();
},
methods
:
{
async
login
()
{
const
res
=
await
loginByPhone
(
this
.
loginInfo
);
if
(
res
.
code
===
0
)
{
this
.
mongoToken
=
res
.
data
.
token
;
localStorage
.
setItem
(
"
mongoToken
"
,
res
.
data
.
token
);
}
},
getCurrentBrowerEnv
()
{
const
ua
=
window
.
navigator
.
userAgent
.
toLowerCase
();
if
(
ua
.
match
(
/MicroMessenger/i
)
==
"
micromessenger
"
)
{
this
.
browerEnv
=
"
weixin
"
;
this
.
getWxOpenId
();
}
else
if
(
ua
.
match
(
/xyqb/i
)
==
"
xyqb
"
)
{
this
.
browerEnv
=
"
xyqb
"
;
}
else
{
this
.
browerEnv
=
"
h5
"
;
}
},
async
getWxOpenId
()
{
if
(
this
.
openId
)
return
;
const
code
=
this
.
$route
.
query
.
code
;
const
res
=
await
getwxOpenId
({
code
,
appId
:
cfg
.
wxAppId
});
if
(
res
.
code
===
0
)
{
this
.
openId
=
res
.
data
.
openId
;
localStorage
.
setItem
(
"
openId
"
,
res
.
data
.
openId
);
}
},
getUserState
()
{
this
.
mongoToken
=
localStorage
.
getItem
(
"
mongoToken
"
);
},
brFilter
(
txt
)
{
let
val
=
JSON
.
stringify
(
txt
);
val
=
val
.
replace
(
/
[
{},
]
/g
,
"
<br />
"
).
replace
(
/"/g
,
""
);
return
val
;
}
}
};
</
script
>
<
style
lang=
"less"
scoped
>
.container {
padding: 5px 15px;
font-size: 14px;
background-color: #fff;
}
.state {
line-height: 24px;
margin-bottom: 15px;
height: 44vh;
overflow: scroll;
background-color: #fcfcfc;
box-shadow: inset 0 0 9px 0px rgba(0, 0, 0, 0.1);
padding: 0 10px;
border-radius: 8px;
h5 {
font-weight: bold;
margin: 15px 0;
}
}
.cr-button {
margin-bottom: 15px;
}
</
style
>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment