Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas
/
mini-program
/
points-mall
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 86b06ea6
authored
Aug 22, 2025
by
zhangxw
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
登录修改
1 parent
7c14f61a
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
54 additions
and
50 deletions
components/EnableWallet/EnableWallet.js
components/EnableWallet/EnableWallet.json
components/EnableWallet/EnableWallet.wxml
pages/tab/index/index.js
pages/tab/index/index.json
pages/tab/index/index.wxml
components/EnableWallet/EnableWallet.js
View file @
86b06ea
// pages/Login/components/EnableWallet/EnableWallet.js
// pages/Login/components/EnableWallet/EnableWallet.js
import
commonApi
from
'~/api/module/common.js'
Component
({
Component
({
/**
/**
...
@@ -10,7 +11,12 @@ Component({
...
@@ -10,7 +11,12 @@ Component({
},
},
walletObj
:
{
walletObj
:
{
type
:
Object
,
type
:
Object
,
value
:
{}
value
:
{},
observer
:
function
(
n
)
{
this
.
setData
({
copyWalletObj
:
JSON
.
parse
(
JSON
.
stringify
(
n
))
})
}
}
}
},
},
...
@@ -40,7 +46,26 @@ Component({
...
@@ -40,7 +46,26 @@ Component({
methods
:
{
methods
:
{
// 关闭弹窗
// 关闭弹窗
closeWallet
()
{
closeWallet
()
{
this
.
triggerEvent
(
'close'
)
let
{
copyWalletObj
}
=
this
.
data
this
.
setData
({
show
:
false
})
// 仅替换积分数据返回的内容,使用copyWalletObj 防止修改弹窗内容也做了替换
this
.
replaceNickName
(
copyWalletObj
)
},
// 替换积分钱包名称
replaceNickName
(
data
)
{
let
userInfo
=
wx
.
p
.
cache
.
userInfo
.
getUserInfo
()
commonApi
.
replaceWalletName
({
nickName
:
data
?.
name
,
phone
:
data
?.
phone
,
scoreSource
:
data
?.
scoreSource
}).
then
(
res
=>
{
let
{
code
,
message
}
=
res
if
(
code
==
0
)
{
wx
.
p
.
storage
.
set
(
'userInfo'
,
{...
userInfo
,
nickName
:
data
?.
name
})
// 更新storage中的nickName
}
else
{
wx
.
p
.
wxApi
.
showToast
(
message
)
}
})
},
},
input
(
e
)
{
input
(
e
)
{
let
{
target
}
=
e
.
currentTarget
.
dataset
let
{
target
}
=
e
.
currentTarget
.
dataset
...
@@ -50,12 +75,28 @@ Component({
...
@@ -50,12 +75,28 @@ Component({
[
`walletObj.
${
target
}
`
]:
value
[
`walletObj.
${
target
}
`
]:
value
})
})
},
},
// 一键开通积分钱包
enableWalletConfirm
()
{
let
{
walletObj
}
=
this
.
data
commonApi
.
openPointsWallet
(
walletObj
).
then
(
res
=>
{
let
{
code
,
message
}
=
res
if
(
code
==
0
)
{
this
.
setData
({
showEnableSuccess
:
true
,
show
:
false
})
this
.
replaceNickName
(
walletObj
)
}
else
{
wx
.
p
.
wxApi
.
showToast
(
message
)
}
})
},
// 开通
// 开通
confirm
()
{
confirm
()
{
let
{
walletObj
}
=
this
.
data
let
{
walletObj
}
=
this
.
data
if
(
!
walletObj
?.
name
)
return
wx
.
p
.
wxApi
.
showToast
(
'姓名不能为空'
)
if
(
!
walletObj
?.
name
)
return
wx
.
p
.
wxApi
.
showToast
(
'姓名不能为空'
)
if
(
!
walletObj
?.
phone
||
!
/^
[
1
]([
3-9
])[
0-9
]{9}
$/
.
test
(
walletObj
?.
phone
))
return
wx
.
p
.
wxApi
.
showToast
(
'请输入正确手机号'
)
if
(
!
walletObj
?.
phone
||
!
/^
[
1
]([
3-9
])[
0-9
]{9}
$/
.
test
(
walletObj
?.
phone
))
return
wx
.
p
.
wxApi
.
showToast
(
'请输入正确手机号'
)
this
.
triggerEvent
(
'confirm'
,
{
walletObj
}
)
this
.
enableWalletConfirm
(
)
}
}
}
}
})
})
\ No newline at end of file
\ No newline at end of file
components/EnableWallet/EnableWallet.json
View file @
86b06ea
{
{
"component"
:
true
,
"component"
:
true
,
"usingComponents"
:
{}
"usingComponents"
:
{
"enable-success"
:
"/components/EnableSuccess/EnableSuccess"
}
}
}
\ No newline at end of file
\ No newline at end of file
components/EnableWallet/EnableWallet.wxml
View file @
86b06ea
...
@@ -34,3 +34,5 @@
...
@@ -34,3 +34,5 @@
</view>
</view>
</view>
</view>
</view>
</view>
<!-- 钱包开通成功 -->
<enable-success show="{{showEnableSuccess}}" bindconfirm="successConfirm"></enable-success>
\ No newline at end of file
\ No newline at end of file
pages/tab/index/index.js
View file @
86b06ea
...
@@ -134,11 +134,12 @@ Page({
...
@@ -134,11 +134,12 @@ Page({
const
userInfo
=
wx
.
p
.
cache
.
userInfo
.
getUserInfo
()
const
userInfo
=
wx
.
p
.
cache
.
userInfo
.
getUserInfo
()
this
.
setData
({
userInfo
})
this
.
setData
({
userInfo
})
wx
.
p
.
router
.
getRouterParams
(
options
).
then
(
params
=>
{
wx
.
p
.
router
.
getRouterParams
(
options
).
then
(
params
=>
{
this
.
setData
({
loginPageFlag
:
params
?.
loginPageFlag
})
this
.
setData
({
loginPageFlag
:
params
?.
loginPageFlag
},
()
=>
{
this
.
getPointsWallet
()
})
}).
catch
(
err
=>
{
}).
catch
(
err
=>
{
console
.
error
(
'参数获取失败:'
,
err
)
console
.
error
(
'参数获取失败:'
,
err
)
})
})
this
.
getPointsWallet
()
},
},
// 获取积分钱包数据
// 获取积分钱包数据
...
@@ -179,45 +180,6 @@ Page({
...
@@ -179,45 +180,6 @@ Page({
})
})
},
},
closeWallet
()
{
let
{
copyWalletObj
}
=
this
.
data
this
.
setData
({
showEnableWallet
:
false
})
// 仅替换积分数据返回的内容,使用copyWalletObj 防止修改弹窗内容也做了替换
this
.
replaceNickName
(
copyWalletObj
)
},
// 替换积分钱包名称
replaceNickName
(
data
)
{
let
userInfo
=
wx
.
p
.
cache
.
userInfo
.
getUserInfo
()
commonApi
.
replaceWalletName
({
nickName
:
data
?.
name
,
phone
:
data
?.
phone
,
scoreSource
:
data
?.
scoreSource
}).
then
(
res
=>
{
let
{
code
,
message
}
=
res
if
(
code
==
0
)
{
wx
.
p
.
storage
.
set
(
'userInfo'
,
{...
userInfo
,
nickName
:
data
?.
name
})
// 更新storage中的nickName
}
else
{
wx
.
p
.
wxApi
.
showToast
(
message
)
}
})
},
// 一键开通积分钱包
enableWalletConfirm
(
e
)
{
let
{
walletObj
}
=
e
.
detail
commonApi
.
openPointsWallet
(
walletObj
).
then
(
res
=>
{
let
{
code
,
message
}
=
res
if
(
code
==
0
)
{
this
.
setData
({
showEnableSuccess
:
true
,
showEnableWallet
:
false
})
this
.
replaceNickName
(
walletObj
)
}
else
{
wx
.
p
.
wxApi
.
showToast
(
message
)
}
})
},
// 跳转积分中心
// 跳转积分中心
handleToPointCenter
()
{
handleToPointCenter
()
{
wx
.
p
.
router
.
go
(
'/packageIndex/pages/integral/index/index'
)
wx
.
p
.
router
.
go
(
'/packageIndex/pages/integral/index/index'
)
...
...
pages/tab/index/index.json
View file @
86b06ea
...
@@ -3,8 +3,7 @@
...
@@ -3,8 +3,7 @@
"good-tab"
:
"./components/good-tab/good-tab"
,
"good-tab"
:
"./components/good-tab/good-tab"
,
"goods"
:
"/components/goods/goods"
,
"goods"
:
"/components/goods/goods"
,
"search-box"
:
"./components/SearchBox/SearchBox"
,
"search-box"
:
"./components/SearchBox/SearchBox"
,
"enable-wallet"
:
"/components/EnableWallet/EnableWallet"
,
"enable-wallet"
:
"/components/EnableWallet/EnableWallet"
"enable-success"
:
"/components/EnableSuccess/EnableSuccess"
},
},
"navigationStyle"
:
"custom"
,
"navigationStyle"
:
"custom"
,
"backgroundColor"
:
"#F9F7F7"
"backgroundColor"
:
"#F9F7F7"
...
...
pages/tab/index/index.wxml
View file @
86b06ea
...
@@ -56,7 +56,5 @@
...
@@ -56,7 +56,5 @@
</view>
</view>
</block>
</block>
<!-- 开通钱包 -->
<!-- 开通钱包 -->
<enable-wallet show="{{showEnableWallet}}" walletObj="{{walletObj}}" bindclose="closeWallet" bindconfirm="enableWalletConfirm"></enable-wallet>
<enable-wallet show="{{showEnableWallet}}" walletObj="{{walletObj}}"></enable-wallet>
<!-- 钱包开通成功 -->
<enable-success show="{{showEnableSuccess}}" bindconfirm="successConfirm"></enable-success>
<glsx-privacy appletName="积分商城"></glsx-privacy>
<glsx-privacy appletName="积分商城"></glsx-privacy>
\ No newline at end of file
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
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 post a comment