Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
X
xzf_uniapp-wechat-web
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
李智书
xzf_uniapp-wechat-web
Commits
f43e7d92
Commit
f43e7d92
authored
Mar 09, 2022
by
李智书
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.收费项目;
parent
7cd5b6b1
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
548 additions
and
251 deletions
+548
-251
src/common/js/http.js
src/common/js/http.js
+10
-52
src/main.js
src/main.js
+46
-0
src/manifest.json
src/manifest.json
+116
-119
src/pages.json
src/pages.json
+2
-1
src/pages/StudentPayment/PayOrderDetails/PayOrderDetails.vue
src/pages/StudentPayment/PayOrderDetails/PayOrderDetails.vue
+305
-67
src/pages/StudentPayment/PayProject/PayProject.vue
src/pages/StudentPayment/PayProject/PayProject.vue
+69
-12
No files found.
src/common/js/http.js
View file @
f43e7d92
...
...
@@ -99,12 +99,12 @@ function postRequest(params, data = {}) {
}
//token
let
token
=
uni
.
getStorageSync
(
"
token
"
)
//用户id
// let userId = uni.getStorageSync("userId")
// data.userId = data.userId || userId;
let
personalInfo
=
uni
.
getStorageSync
(
"
personalInfo
"
);
params
.
header
=
{
"
token
"
:
token
||
""
seesionID
:
personalInfo
.
seesionID
||
''
,
sessionid
:
personalInfo
.
seesionID
||
''
,
token
:
personalInfo
.
seesionID
||
''
,
wechattype
:
1
};
params
.
method
=
"
POST
"
;
params
.
dataType
=
"
JSON
"
...
...
@@ -124,24 +124,6 @@ function postRequest(params, data = {}) {
reslt
.
data
=
reslt
.
data
//TODO handle the exception
}
if
(
reslt
.
data
.
code
!=
200
)
{
//token失效或者错误
if
(
reslt
.
data
.
code
==
401
)
{
uni
.
showToast
({
icon
:
"
none
"
,
title
:
reslt
.
data
.
message
,
duration
:
3000
})
setTimeout
(
function
()
{
//401跳转登录
uni
.
redirectTo
({
url
:
"
/pages/index/index
"
})
uni
.
clearStorage
()
},
1000
);
reject
(
reslt
.
data
.
message
)
}
}
uni
.
hideLoading
();
resolve
(
reslt
.
data
)
}).
catch
(
e
=>
{
...
...
@@ -171,12 +153,12 @@ function getRequest(params, data) {
});
try
{
//token
let
token
=
uni
.
getStorageSync
(
"
token
"
)
//用户id
let
userId
=
uni
.
getStorageSync
(
"
userId
"
)
data
.
userId
=
data
.
userId
||
userId
;
let
personalInfo
=
uni
.
getStorageSync
(
"
personalInfo
"
);
params
.
header
=
{
"
token
"
:
token
||
""
seesionID
:
personalInfo
.
seesionID
||
''
,
sessionid
:
personalInfo
.
seesionID
||
''
,
token
:
personalInfo
.
seesionID
||
''
,
wechattype
:
1
};
params
.
method
=
"
GET
"
;
params
.
dataType
=
"
JSON
"
...
...
@@ -196,30 +178,6 @@ function getRequest(params, data) {
reslt
.
data
=
reslt
.
data
//TODO handle the exception
}
if
(
reslt
.
data
.
code
!=
200
)
{
//token失效或者错误
if
(
reslt
.
data
.
code
==
401
)
{
uni
.
showToast
({
icon
:
"
none
"
,
title
:
reslt
.
data
.
message
,
duration
:
3000
})
uni
.
hideLoading
();
//401跳转登录
uni
.
redirectTo
({
url
:
"
/pages/index/index
"
})
reject
(
reslt
.
data
.
message
)
}
uni
.
showToast
({
icon
:
"
none
"
,
title
:
reslt
.
data
.
message
,
duration
:
3000
})
uni
.
hideLoading
();
reject
(
reslt
.
data
.
message
)
}
console
.
log
(
reslt
);
uni
.
hideLoading
();
resolve
(
reslt
.
data
)
}).
catch
(
e
=>
{
...
...
src/main.js
View file @
f43e7d92
...
...
@@ -24,6 +24,52 @@ Vue.prototype.$ImgUrl = 'https://xiaopay2020.oss-cn-shenzhen.aliyuncs.com/static
import
Vant
from
'
vant
'
;
Vue
.
use
(
Vant
);
let
ua
=
navigator
.
userAgent
.
toLocaleString
();
if
(
ua
.
match
(
"
/MicroMessenger/i
"
)
==
"
micromessenger
"
)
{
console
.
log
(
"
微信浏览器环境
"
);
Vue
.
prototype
.
env
=
"
wx
"
}
else
{
console
.
log
(
"
普通览器环境
"
);
Vue
.
prototype
.
env
=
"
h5
"
}
// JSSDK授权
async
function
JssdkAuth
()
{
try
{
let
[
err
,
res
]
=
await
uni
.
request
({
url
:
"
https://pay.xiaopay.net/mp_wechat/svmpwechat/GetWechatJSSDKConfig
"
,
method
:
"
POST
"
,
data
:
{
"
mp_session_id
"
:
uni
.
getStorageSync
(
"
personalInfo
"
).
seesionID
,
"
url
"
:
encodeURIComponent
(
window
.
location
.
href
.
split
(
"
#
"
)[
0
]),
}
})
console
.
log
(
err
,
res
);
}
catch
(
e
)
{
//TODO handle the exception
//TODO handle the exception
console
.
log
(
e
);
uni
.
showToast
({
icon
:
"
none
"
,
mask
:
true
,
title
:
e
.
message
})
}
}
// WeixinJSBridge内置对象在其他浏览器中无效。
setTimeout
(
function
()
{
if
(
typeof
WeixinJSBridge
==
"
undefined
"
)
{
if
(
document
.
addEventListener
)
{
Vue
.
prototype
.
JSBridge
=
false
}
else
if
(
document
.
attachEvent
)
{
Vue
.
prototype
.
JSBridge
=
false
}
}
else
{
Vue
.
prototype
.
JSBridge
=
true
}
},
1000
)
// echarts图标
var
echarts
=
require
(
'
echarts
'
)
...
...
src/manifest.json
View file @
f43e7d92
{
"name"
:
"xzf_uniapp-wechat-web"
,
"appid"
:
"__UNI__6500A3F"
,
"description"
:
""
,
"versionName"
:
"1.0.0"
,
"versionCode"
:
"100"
,
"transformPx"
:
false
,
/*
5
+App特有相关
*/
"app-plus"
:
{
"usingComponents"
:
true
,
"nvueStyleCompiler"
:
"uni-app"
,
"compilerVersion"
:
3
,
"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.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.ACCESS_NETWORK_STATE
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.CAMERA
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.GET_ACCOUNTS
\"
/>"
,
"<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.FLASHLIGHT
\"
/>"
,
"<uses-feature android:name=
\"
android.hardware.camera
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.WRITE_SETTINGS
\"
/>"
]
},
/*
ios打包配置
*/
"ios"
:
{},
/*
SDK配置
*/
"sdkConfigs"
:
{}
},
"uniStatistics"
:
{
"enable"
:
true
}
},
/*
快应用特有相关
*/
"quickapp"
:
{},
/*
小程序特有相关
*/
"mp-weixin"
:
{
"appid"
:
""
,
"setting"
:
{
"urlCheck"
:
false
},
"usingComponents"
:
true
,
"uniStatistics"
:
{
"enable"
:
true
}
},
"mp-alipay"
:
{
"usingComponents"
:
true
,
"uniStatistics"
:
{
"enable"
:
true
}
},
"mp-baidu"
:
{
"usingComponents"
:
true
,
"uniStatistics"
:
{
"enable"
:
true
}
},
"mp-toutiao"
:
{
"usingComponents"
:
true
,
"uniStatistics"
:
{
"enable"
:
true
}
},
"uniStatistics"
:
{
"enable"
:
true
},
"h5"
:
{
"devServer"
:
{
"port"
:
80
,
"disableHostCheck"
:
true
,
"proxy"
:
{
"/api"
:
{
"target"
:
"https://uat.xiaopay.net"
,
"changeOrigin"
:
true
,
"secure"
:
false
,
"pathRewrite"
:
{
"^/api"
:
"/"
}
}
}
},
"router"
:
{
"mode"
:
"hash"
,
"base"
:
"./"
},
"title"
:
"电子校园卡"
,
"optimization"
:
{
"treeShaking"
:
{
"enable"
:
false
}
},
"uniStatistics"
:
{
"enable"
:
true
},
"template"
:
"template.h5.html"
},
"mp-qq"
:
{
"uniStatistics"
:
{
"enable"
:
true
}
}
"name"
:
"xzf_uniapp-wechat-web"
,
"appid"
:
"__UNI__6500A3F"
,
"description"
:
""
,
"versionName"
:
"1.0.0"
,
"versionCode"
:
"100"
,
"transformPx"
:
false
,
/*
5
+App特有相关
*/
"app-plus"
:
{
"usingComponents"
:
true
,
"nvueStyleCompiler"
:
"uni-app"
,
"compilerVersion"
:
3
,
"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.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.ACCESS_NETWORK_STATE
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.CAMERA
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.GET_ACCOUNTS
\"
/>"
,
"<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.FLASHLIGHT
\"
/>"
,
"<uses-feature android:name=
\"
android.hardware.camera
\"
/>"
,
"<uses-permission android:name=
\"
android.permission.WRITE_SETTINGS
\"
/>"
]
},
/*
ios打包配置
*/
"ios"
:
{},
/*
SDK配置
*/
"sdkConfigs"
:
{}
},
"uniStatistics"
:
{
"enable"
:
true
}
},
/*
快应用特有相关
*/
"quickapp"
:
{},
/*
小程序特有相关
*/
"mp-weixin"
:
{
"appid"
:
""
,
"setting"
:
{
"urlCheck"
:
false
},
"usingComponents"
:
true
,
"uniStatistics"
:
{
"enable"
:
true
}
},
"mp-alipay"
:
{
"usingComponents"
:
true
,
"uniStatistics"
:
{
"enable"
:
true
}
},
"mp-baidu"
:
{
"usingComponents"
:
true
,
"uniStatistics"
:
{
"enable"
:
true
}
},
"mp-toutiao"
:
{
"usingComponents"
:
true
,
"uniStatistics"
:
{
"enable"
:
true
}
},
"uniStatistics"
:
{
"enable"
:
true
},
"h5"
:
{
"devServer"
:
{
"port"
:
80
,
"disableHostCheck"
:
true
,
"proxy"
:
{
"/"
:
{
"target"
:
"https://dev-az-order-api.xiaopay.net"
,
"changeOrigin"
:
true
,
"secure"
:
false
}
}
},
"router"
:
{
"mode"
:
"hash"
,
"base"
:
"./"
},
"title"
:
"电子校园卡"
,
"optimization"
:
{
"treeShaking"
:
{
"enable"
:
false
}
},
"uniStatistics"
:
{
"enable"
:
true
},
"template"
:
"template.h5.html"
},
"mp-qq"
:
{
"uniStatistics"
:
{
"enable"
:
true
}
}
}
src/pages.json
View file @
f43e7d92
...
...
@@ -335,8 +335,9 @@
},
{
"path"
:
"pages/StudentPayment/PayOrderDetails/PayOrderDetails"
,
"style"
:
{
"navigationStyle"
:
"custom"
,
"navigationBarTitleText"
:
"交费订单明细"
,
"navigationBarTextStyle"
:
"white"
,
"navigationBarBackgroundColor"
:
"#01CB88"
,
"enablePullDownRefresh"
:
false
}
...
...
src/pages/StudentPayment/PayOrderDetails/PayOrderDetails.vue
View file @
f43e7d92
...
...
@@ -20,25 +20,24 @@
<view
class=
"headerImg"
>
<view
class=
"cardInfo"
>
<view
class=
"title"
>
2022高一春季开学费用
{{
ChargeProDetail
.
chargeName
||
""
}}
</view>
<view
class=
"title2"
>
该收费项目主要收取学校的开学学费,根据需要自行选择
及备注。
{{
ChargeProDetail
.
descInfo
||
""
}}
</view>
<van-divider
style=
"margin-top: 50rpx;"
/>
<van-divider
/>
<view
class=
"botto"
>
<view
class=
"rowInfo"
>
<text
class=
"name"
>
学生姓名:
</text>
<text
class=
"value"
>
张三
</text>
<text
class=
"value"
>
{{
ChargeProDetail
.
userName
||
""
}}
</text>
</view>
<view
class=
"rowInfo"
>
<text
class=
"name"
>
年级班级:
</text>
<text
class=
"value"
>
三年级 101
班
</text>
<text
class=
"value"
>
{{
ChargeProDetail
.
userGrade
||
""
}}
{{
ChargeProDetail
.
userClass
||
""
}}
班
</text>
</view>
<view
class=
"rowInfo"
>
<text
class=
"name"
>
订单编号:
</text>
<text
class=
"value"
>
2022022800001
</text>
<text
class=
"value"
>
{{
ChargeProDetail
.
tradeId
||
""
}}
</text>
</view>
</view>
</view>
...
...
@@ -58,21 +57,21 @@
</view>
<!-- Project -->
<view
class=
"ProjectBox"
>
<view
class=
"ProjectItem"
v-for=
"(item,index) in
PayProjectList
"
:key=
"index"
:class=
"
selectPayProject == index
?'selectProjectItem':''"
>
<view
class=
"tabNames"
@
click=
"selectProject(index)"
>
<view
class=
"ProjectItem"
v-for=
"(item,index) in
ChargeProDetail.items
"
:key=
"index"
:class=
"
SPayProject(index)
?'selectProjectItem':''"
>
<view
class=
"tabNames"
@
click=
"selectProject(i
tem,i
ndex)"
>
<view
class=
"ProjectName"
>
<image
v-if=
"
selectPayProject==index
"
style=
"width: 32rpx;height: 32rpx;"
<image
v-if=
"
SPayProject(index)
"
style=
"width: 32rpx;height: 32rpx;"
:src=
"ImgUrl+'StudentPayment/gx.png'"
mode=
'widthFix'
></image>
<image
v-else
style=
"width: 32rpx;height: 32rpx;"
:src=
"ImgUrl+'StudentPayment/wgx.png'"
mode=
'widthFix'
></image>
<text>
{{
item
.
n
ame
}}
</text>
<text>
{{
item
.
itemN
ame
}}
</text>
</view>
<view
class=
"ProjectType"
>
{{
item
.
type
}}
{{
[
'
选缴项目
'
,
'
必缴项目
'
][
item
.
mustFlag
]
}}
</view>
<view
class=
"money"
>
{{
item
.
money
}}
{{
item
Amount
(
item
.
itemAmount
)
}}
</view>
</view>
</view>
...
...
@@ -82,10 +81,10 @@
<!-- 备注 -->
<view
class=
"remarks"
>
<text
class=
"remarksTxt"
>
备注
{{
remarksType
[
ChargeProDetail
.
notesType
-
1
]
}}
</text>
<textarea
value=
""
placeholder=
"请输入身份证号"
:cursor=
"10"
placeholder-class=
"remarksTextarea"
:maxlength=
"40
"
:
auto-height=
"true
"
/>
<textarea
:placeholder=
"ChargeProDetail.notesTips"
:cursor=
"10"
placeholder-class=
"remarksTextarea
"
:
maxlength=
"40"
:auto-height=
"true"
v-model=
"remarks
"
/>
</view>
<!-- 底部操作按钮 -->
<view
class=
"bottomOper"
>
...
...
@@ -111,42 +110,129 @@
</
template
>
<
script
>
/**
* 对象转拼接字符串
* @param {*} res Object 需要转换的数据对象
*/
function
OforS
(
res
)
{
var
resL
=
0
;
var
outS
=
""
;
for
(
var
i
in
res
)
{
if
(
resL
==
0
)
{
outS
+=
""
+
i
+
"
=
"
+
res
[
i
];
}
else
{
outS
+=
"
&
"
+
i
+
"
=
"
+
res
[
i
];
}
resL
++
;
}
return
outS
;
}
export
default
{
name
:
"
PayOrderDetails
"
,
data
()
{
return
{
ImgUrl
:
this
.
$ImgUrl
,
PayProjectList
:
[{
name
:
"
春季开学费用
"
,
type
:
"
必缴项目
"
,
money
:
"
10.00
"
},
{
name
:
"
高一春季开...
"
,
type
:
"
选缴项目
"
,
money
:
"
100.00
"
},
{
name
:
"
高一春季开...
"
,
type
:
"
选缴项目
"
,
money
:
"
1.00
"
}],
payMoney
:
"
100.00
"
,
selectPayProject
:
0
,
payMoney
:
"
0.00
"
,
// 选择收费子项目
selectPayProject
:
[],
// 选择收费子项目
selectPayProjectObj
:
{},
selectCount
:
0
,
dialogShow
:
false
,
PaymentRsults
:
1
PaymentRsults
:
1
,
allData
:
{},
// 交费项目详情信息
ChargeProDetail
:
{},
// 备注信息
remarks
:
""
,
remarksType
:
[
"
备注
"
,
"
邮箱
"
,
"
手机号码
"
,
"
身份证
"
],
// 费用id
chargeItemIds
:
[]
}
},
onLoad
:
function
(
options
)
{
let
this_
=
this
;
uni
.
showLoading
({
mask
:
true
,
title
:
"
查询支付结果
"
})
setTimeout
(
function
()
{
uni
.
hideLoading
()
this_
.
dialogShow
=
true
},
1000
)
let
personalInfo
=
uni
.
getStorageSync
(
"
personalInfo
"
)
this
.
allData
=
Object
.
assign
(
options
,
personalInfo
)
if
(
options
.
PayResult
)
{
uni
.
showLoading
({
mask
:
true
,
title
:
"
查询支付结果
"
})
setTimeout
(
function
()
{
uni
.
hideLoading
()
this_
.
getPayParams
(
uni
.
getStorageSync
(
"
prepayId
"
))
},
1000
)
}
else
{
this
.
queryChargeProDetail
()
}
},
onShow
:
function
()
{
// uni.showLoading({
// mask: true,
// title: "查询支付结果"
// })
// setTimeout(function() {
// uni.hideLoading()
// this_.dialogShow = true
// }, 1000)
},
computed
:
{
itemAmount
()
{
return
function
(
Amount
)
{
if
(
Amount
)
{
return
(
Amount
/
100
).
toFixed
(
2
)
}
else
{
return
""
}
}
},
SPayProject
()
{
return
function
(
index
)
{
if
(
index
==
0
||
index
>
0
)
{
return
this
.
selectPayProject
.
includes
(
index
)
}
else
{
return
false
}
}
}
},
methods
:
{
// 查询交费订单明细信息
async
queryChargeProDetail
()
{
try
{
let
data
=
await
this
.
$http
.
post
({
url
:
'
/order-charge/app/charge/project/queryChargeProDetail
'
},
{
"
chargeId
"
:
this
.
allData
.
chargeId
,
"
schoolId
"
:
this
.
allData
.
schoolId
,
"
userId
"
:
this
.
allData
.
userId
})
if
(
data
.
code
!=
200
||
!
data
.
data
)
{
uni
.
showToast
({
icon
:
"
none
"
,
mask
:
true
,
title
:
data
.
msg
})
return
}
this
.
ChargeProDetail
=
data
.
data
;
// 收费类型必缴项目默认选择
for
(
let
i
=
0
;
i
<
data
.
data
.
items
.
length
;
i
++
)
{
if
(
data
.
data
.
items
[
i
].
mustFlag
==
1
)
{
this
.
selectProject
(
data
.
data
.
items
[
i
],
i
)
}
}
}
catch
(
e
)
{
//TODO handle the exception
console
.
log
(
e
);
uni
.
showToast
({
icon
:
"
none
"
,
mask
:
true
,
title
:
e
.
message
})
}
},
// 支付结果页面关闭
async
dialogClosed
()
{
try
{
...
...
@@ -158,43 +244,192 @@
}
},
// 选择支付的项目
async
selectProject
(
index
)
{
async
selectProject
(
data
,
index
)
{
try
{
console
.
log
(
index
)
this
.
selectPayProject
=
index
return
if
(
!
this
.
selectPayProject
[
index
+
''
])
{
this
.
selectPayProject
[
index
+
''
]
=
index
if
(
!
this
.
selectPayProject
.
includes
(
index
))
{
this
.
selectPayProject
.
push
(
index
)
this
.
selectPayProjectObj
[
index
+
''
]
=
data
}
else
{
this
.
selectPayProject
[
index
+
''
]
=
''
let
indexOf
=
this
.
selectPayProject
.
indexOf
(
index
)
this
.
selectPayProject
.
splice
(
indexOf
,
1
)
delete
this
.
selectPayProjectObj
[
index
+
''
]
}
// 计算金额
let
payMoney
=
0
,
// 选择的项目数
selectCount
=
0
,
// 费用id
chargeItemIds
=
[];
for
(
let
key
in
this
.
selectPayProjectObj
)
{
selectCount
++
payMoney
+=
this
.
selectPayProjectObj
[
key
].
itemAmount
;
chargeItemIds
.
push
(
this
.
selectPayProjectObj
[
key
].
id
)
}
this
.
selectCount
=
selectCount
;
this
.
payMoney
=
(
payMoney
/
100
).
toFixed
(
2
);
this
.
chargeItemIds
=
chargeItemIds
;
}
catch
(
e
)
{
//TODO handle the exception
console
.
log
(
e
);
}
},
// 微信公众号H5支付
async
getBrandWCPayRequest
()
{
try
{
if
(
this
.
JSBridge
)
{
WeixinJSBridge
.
invoke
(
'
getBrandWCPayRequest
'
,
{
"
appId
"
:
"
wx2421b1c4370ec43b
"
,
//公众号ID,由商户传入
"
timeStamp
"
:
"
1395712654
"
,
//时间戳,自1970年以来的秒数
"
nonceStr
"
:
"
e61463f8efa94090b1f366cccfbbb444
"
,
//随机串
"
package
"
:
"
prepay_id=u802345jgfjsdfgsdg888
"
,
"
signType
"
:
"
MD5
"
,
//微信签名方式:
"
paySign
"
:
"
70EA570631E4BB79628FBCA90534C63FF7FADD89
"
//微信签名
},
function
(
res
)
{
if
(
res
.
err_msg
==
"
get_brand_wcpay_request:ok
"
)
{
// 使用以上方式判断前端返回,微信团队郑重提示:
//res.err_msg将在用户支付成功后返回ok,但并不保证它绝对可靠。
}
else
{
uni
.
showToast
({
icon
:
"
none
"
,
mask
:
true
,
title
:
"
支付异常
"
})
}
});
return
}
console
.
log
(
this
.
selectPayProject
);
uni
.
showToast
({
icon
:
"
none
"
,
mask
:
true
,
title
:
"
支付环境异常
"
})
}
catch
(
e
)
{
//TODO handle the exception
console
.
log
(
e
);
uni
.
showToast
({
icon
:
"
none
"
,
mask
:
true
,
title
:
e
.
message
})
}
},
// 点击缴费
// 点击缴费
下单接口
async
clickPay
()
{
try
{
console
.
log
(
"
clickPay
"
,
"
点击缴费
"
);
this
.
dialogClosed
()
uni
.
showLoading
({
console
.
log
(
this
.
JSBridge
);
if
(
this
.
selectCount
==
0
)
{
uni
.
showToast
({
icon
:
"
none
"
,
mask
:
true
,
title
:
"
请选择缴费项目
"
})
return
}
if
(
this
.
ChargeProDetail
.
notesFlag
==
1
)
{
if
(
!
this
.
remarks
)
{
uni
.
showToast
({
icon
:
"
none
"
,
mask
:
true
,
title
:
"
请填写备注信息
"
})
return
}
}
let
data
=
await
this
.
$http
.
post
({
url
:
'
/order-charge/app/charge/project/createOrder
'
},
{
amount
:
this
.
selectCount
*
100
,
// 金额 false
chargeItemIds
:
this
.
chargeItemIds
.
join
(
"
,
"
),
// 交费用项id集合多个交费项之间使用逗号分隔 false
mchId
:
this
.
ChargeProDetail
.
mchid
,
// 微信商户号 false
openId
:
this
.
allData
.
openId
,
// 用户标识 false
payPeopleType
:
1
,
// 交费人类型1家长、2教师、3运营人员 false
payway
:
1
,
// 交费方式1.小程序交费、2.现金交费 false
tradeId
:
this
.
ChargeProDetail
.
tradeId
,
// 订单号 false
userName
:
this
.
ChargeProDetail
.
userName
,
// 用户姓名 false
remark
:
this
.
remarks
||
''
,
// 备注 false
wechatChannel
:
1
,
//微信交费渠道1.小程序交费 2.微信公众号交费
chargeId
:
this
.
allData
.
chargeId
,
schoolId
:
this
.
allData
.
schoolId
,
userId
:
this
.
allData
.
userId
})
if
(
data
.
code
!=
200
)
{
uni
.
showToast
({
icon
:
"
none
"
,
mask
:
true
,
title
:
data
.
msg
||
"
缴费下单失败
"
})
return
}
// 获取支付参数
await
this
.
getPayParams
(
data
.
data
)
uni
.
setStorageSync
(
"
prepayId
"
,
data
.
data
)
}
catch
(
e
)
{
//TODO handle the exception
console
.
log
(
e
);
uni
.
showToast
({
icon
:
"
none
"
,
mask
:
true
,
title
:
"
缴费中...
"
title
:
e
.
message
})
await
new
Promise
((
res
,
rjt
)
=>
{
setTimeout
(
function
()
{
res
()
},
3000
)
}
},
// 获取支付参数
async
getPayParams
(
prepayId
)
{
try
{
let
data
=
await
this
.
$http
.
get
({
url
:
'
/order-charge/app/charge/project/getPayParams
'
},
{
prepayId
})
this
.
PaymentRsults
=
2
this
.
dialogShow
=
true
uni
.
hideLoading
()
if
(
data
.
data
.
code
!=
200
||
!
data
.
data
.
data
)
{
uni
.
showToast
({
icon
:
"
none
"
,
mask
:
true
,
title
:
data
.
data
.
msg
||
"
获取支付参数失败
"
})
return
}
console
.
warn
(
`/pages/WxPay/main?`
+
OforS
(
data
.
data
))
jWeixin
.
miniProgram
.
switchTab
({
url
:
`/pages/WxPay/main?`
+
OforS
(
data
.
data
),
});
}
catch
(
e
)
{
//TODO handle the exception
console
.
log
(
e
);
uni
.
showToast
({
icon
:
"
none
"
,
mask
:
true
,
title
:
e
.
message
})
}
},
// 返回支付结果
async
returnPaymentResult
(
tradeId
)
{
try
{
let
data
=
await
this
.
$http
.
get
({
url
:
'
/order-charge/app/charge/project/returnPaymentResult
'
},
{
tradeId
})
if
(
data
.
data
.
code
!=
200
||
!
data
.
data
.
data
)
{
uni
.
showToast
({
icon
:
"
none
"
,
mask
:
true
,
title
:
data
.
data
.
msg
||
"
返回支付结果失败
"
})
return
}
this_
.
dialogShow
=
true
}
catch
(
e
)
{
//TODO handle the exception
console
.
log
(
e
);
uni
.
showToast
({
icon
:
"
none
"
,
mask
:
true
,
title
:
e
.
message
})
}
}
}
...
...
@@ -241,7 +476,7 @@
.PayProject
{
height
:
460rpx
;
margin-top
:
192
rpx
;
margin-top
:
20
rpx
;
.ProjectBox
{
height
:
350rpx
;
...
...
@@ -296,6 +531,7 @@
}
.ProjectType
{
width
:
120rpx
;
margin-left
:
40rpx
;
}
...
...
@@ -339,6 +575,7 @@
textarea
{
width
:
100%
;
height
:
100%
;
padding-left
:
30rpx
;
}
.remarksTxt
{
...
...
@@ -383,7 +620,7 @@
font-family
:
PingFang
SC
;
font-weight
:
500
;
color
:
#CCCCCC
;
padding-left
:
30rpx
;
//
padding-left: 30rpx;
}
}
...
...
@@ -485,18 +722,19 @@
border-radius
:
16rpx
;
position
:
relative
;
margin
:
0
auto
;
top
:
206
rpx
;
top
:
37
rpx
;
overflow
:
hidden
;
font-family
:
PingFang
SC
;
.title
{
width
:
370rpx
;
height
:
34rpx
;
//
height: 34rpx;
font-size
:
36rpx
;
font-weight
:
800
;
color
:
#333333
;
margin
:
0
auto
;
margin-top
:
52rpx
;
margin-top
:
60rpx
;
text-align
:
center
;
}
.title2
{
...
...
src/pages/StudentPayment/PayProject/PayProject.vue
View file @
f43e7d92
...
...
@@ -11,20 +11,19 @@
@
tap=
"PayOrderDetails(item)"
>
<view
class=
"listitem top"
>
<view
class=
"title"
>
2022高一春季收费
{{
item
.
chargeName
}}
</view>
<view
class=
"money"
>
100.00
{{
item
.
amountMust
}}
</view>
</view>
<view
class=
"listitem center"
>
<text
class=
"describe"
>
本次收费需要收取高一春季开学相关费用,并根据
备注输入相关信息。
{{
item
.
descInfo
}}
</text>
</view>
<view
class=
"listitem botto"
style=
"align-items: baseline;"
>
<van-icon
name=
"clock-o"
/>
<text
class=
"Tips"
>
5
天后收费结束
</text>
<van-icon
name=
"clock-o"
/>
<text
class=
"Tips"
>
{{
item
.
diffTime
}}
天后收费结束
</text>
</view>
</view>
<view
class=
"bottomtxt"
>
已经到底啦~
</view>
...
...
@@ -77,6 +76,8 @@
</
template
>
<
script
>
// 时间处理模块
import
dayjs
from
'
dayjs
'
export
default
{
name
:
"
PayProject
"
,
data
()
{
...
...
@@ -84,12 +85,29 @@
ImgUrl
:
this
.
$ImgUrl
,
active
:
0
,
vanTab
:
[
'
收费项目
'
,
'
交费历史
'
],
PayProjectList
:
[
1
,
2
,
3
],
PayProjectHistory
:
[
1
,
2
,
3
]
PayProjectList
:
[
1
,
2
,
3
,
4
,
5
],
PayProjectHistory
:
[],
pageCurrent
:
1
,
pageSize
:
10
,
total
:
0
,
allData
:
{}
}
},
onLoad
:
function
(
options
)
{
console
.
log
(
"
PayProject
"
);
console
.
log
(
"
PayProject
"
,
options
);
if
(
options
.
seesionID
&&
options
.
userID
&&
options
.
schoolId
)
{
uni
.
setStorageSync
(
"
personalInfo
"
,
{
userId
:
options
.
userID
||
''
,
seesionID
:
options
.
seesionID
||
''
,
schoolId
:
options
.
schoolId
||
''
,
openId
:
options
.
openId
})
this
.
allData
=
options
}
else
{
let
personalInfo
=
uni
.
getStorageSync
(
"
personalInfo
"
)
this
.
allData
=
Object
.
assign
(
options
,
personalInfo
)
}
this
.
getPayProject
()
},
onPullDownRefresh
:
function
(
e
)
{
console
.
log
(
"
onPullDownRefresh
"
,
e
);
...
...
@@ -102,19 +120,57 @@
// 切换tab
async
PayProjectTab
(
index
)
{
try
{
console
.
log
(
index
);
if
(
index
>
0
)
{
return
}
this
.
getPayProject
(
index
)
}
catch
(
e
)
{
//TODO handle the exception
console
.
log
(
e
);
}
},
//
获取收费项目
//
交费项目信息分页查询
async
getPayProject
(
index
)
{
try
{
console
.
log
(
index
);
let
data
=
await
this
.
$http
.
post
({
url
:
'
/order-charge/app/charge/project/queryChargeProjectPage
'
},
{
"
pageCurrent
"
:
this
.
pageCurrent
,
"
pageSize
"
:
this
.
pageSize
,
"
schoolId
"
:
this
.
allData
.
schoolId
,
"
userId
"
:
this
.
allData
.
userId
||
this
.
allData
.
userID
})
if
(
data
.
code
!=
200
)
{
uni
.
showToast
({
icon
:
"
none
"
,
mask
:
true
,
title
:
data
.
msg
})
this
.
PayProjectList
=
[]
return
}
if
(
data
.
data
.
records
&&
Array
.
isArray
(
data
.
data
.
records
))
{
let
tmp
=
data
.
data
.
records
;
let
newArr
=
[]
for
(
let
s
of
tmp
)
{
let
diffTime
=
dayjs
().
diff
(
s
.
endTime
,
'
day
'
);
s
.
diffTime
=
Math
.
abs
(
diffTime
)
s
.
amountMust
=
s
.
amountMust
.
toFixed
(
2
)
newArr
.
push
(
s
)
}
this
.
PayProjectList
=
newArr
}
else
{
this
.
PayProjectList
=
[]
}
}
catch
(
e
)
{
//TODO handle the exception
console
.
log
(
e
);
uni
.
showToast
({
icon
:
"
none
"
,
mask
:
true
,
title
:
e
.
message
})
}
},
// 收费项目详情
...
...
@@ -123,7 +179,7 @@
console
.
log
(
data
);
uni
.
setStorageSync
(
"
PayOrderDetails
"
,
data
)
uni
.
navigateTo
({
url
:
"
../PayOrderDetails/PayOrderDetails
"
url
:
"
../PayOrderDetails/PayOrderDetails
?chargeId=
"
+
data
.
id
||
''
})
}
catch
(
e
)
{
//TODO handle the exception
...
...
@@ -172,6 +228,7 @@
.top
{
.title
{
width
:
266rpx
;
font-size
:
32rpx
;
font-weight
:
bold
;
color
:
#333333
;
...
...
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