Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
user
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
hooloo
mp
user
Commits
e8d508a0
Commit
e8d508a0
authored
Aug 06, 2022
by
songbingqi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成我的信息修改接口联调
parent
793441f5
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
214 additions
and
37 deletions
+214
-37
components/menuAssembly/index.vue
+58
-20
mineSubPackage/pages/userInfo/index.vue
+90
-11
orderSubPackage/pages/settlement/index.vue
+32
-6
request/mine/index.js
+34
-0
No files found.
components/menuAssembly/index.vue
View file @
e8d508a0
...
@@ -3,8 +3,10 @@
...
@@ -3,8 +3,10 @@
<scroll-view
class=
"nav-left"
:style=
"[heightStyle]"
:class=
"[shopCarFlag||shopState===0?'shopCarcss':'' ]"
scroll-y
:scroll-top=
"scrollLeftTop"
scroll-with-animation
>
<scroll-view
class=
"nav-left"
:style=
"[heightStyle]"
:class=
"[shopCarFlag||shopState===0?'shopCarcss':'' ]"
scroll-y
:scroll-top=
"scrollLeftTop"
scroll-with-animation
>
<view
class=
"nav-left-item"
v-for=
"(item,index) in classifyData"
@
click=
"categoryClickMain(item.id)"
:key=
"item.id"
<view
class=
"nav-left-item"
v-for=
"(item,index) in classifyData"
@
click=
"categoryClickMain(item.id)"
:key=
"item.id"
:class=
"item.id == categoryId ? 'active' : ''"
>
:class=
"item.id == categoryId ? 'active' : ''"
>
<view
class=
"imgbox"
v-if=
"item.src&&sizeList[index].width"
><image
:style=
"
{'height':sizeList[index].height+'rpx','width':sizeList[index].width+'rpx'}" :src="item.src"/>
</view>
<view
class=
"imgbox"
v-if=
"item.icon&&sizeList[index].width"
>
<view
:style=
"
{'margin-top':'10rpx'}">
<span>
{{
item
.
name
}}
</span></view>
<image
:style=
"
{'height':sizeList[index].height+'rpx','width':sizeList[index].width+'rpx'}" :src="item.icon"/>
</view>
<view
:style=
"
{'margin-top':'4rpx'}">
<span>
{{
item
.
name
}}
</span></view>
<!--
<view
:class=
"item.id == categoryId ? 'active-line' : ''"
></view>
-->
<!--
<view
:class=
"item.id == categoryId ? 'active-line' : ''"
></view>
-->
</view>
</view>
</scroll-view>
</scroll-view>
...
@@ -115,12 +117,14 @@ export default {
...
@@ -115,12 +117,14 @@ export default {
this
.
categoryPostion
=
data
this
.
categoryPostion
=
data
}).
exec
();
}).
exec
();
})
})
// categorys[0]?categorys[0].src = 'http://fakeimg.pl/43x42/':''
// console.log(categorys)
// categorys[1]?categorys[1].src = 'http://fakeimg.pl/54x34/':''
// categorys[0]?categorys[0].icon = 'https://s1.ax1x.com/2022/08/05/vnHQw6.jpg':''
// categorys[2]?categorys[2].src = 'http://fakeimg.pl/32x30/':''
// categorys[1]?categorys[1].icon = 'https://s1.ax1x.com/2022/08/05/vnHQw6.jpg':''
categorys
.
map
(
item
=>
{
// categorys[2]?categorys[2].icon = 'https://s1.ax1x.com/2022/08/05/vnHQw6.jpg':''
this
.
imagesHeight
(
item
.
src
)
// categorys.map((item,index)=>{
})
// this.imagesHeight(item.src,index)
// })
if
(
categorys
.
length
!=
0
)
this
.
imagesHeight
(
categorys
)
return
categorys
return
categorys
}
}
},
},
...
@@ -138,17 +142,46 @@ export default {
...
@@ -138,17 +142,46 @@ export default {
});
});
},
},
methods
:
{
methods
:
{
async
imagesHeight
(
src
)
{
async
imagesHeight
(
list
,
index
)
{
const
val
=
await
uni
.
getImageInfo
({
// return
src
let
i
=
0
const
newList
=
list
.
map
(
item
=>
{
return
''
})
})
console
.
log
(
val
)
const
func
=
async
()
=>
{
if
(
val
.
length
==
2
){
if
(
list
[
i
].
icon
){
this
.
sizeList
.
push
({
const
val
=
await
uni
.
getImageInfo
({
width
:
val
[
1
].
width
,
src
:
list
[
i
].
icon
height
:
val
[
1
].
height
})
})
let
w
=
val
[
1
].
width
let
h
=
val
[
1
].
height
if
(
w
>
80
){
w
=
60
}
if
(
h
>
60
){
h
=
60
}
newList
[
i
]
=
{
width
:
w
,
height
:
h
}
}
i
++
if
(
i
<
newList
.
length
){
func
()
}
else
{
this
.
sizeList
=
newList
}
}
}
func
()
// console.log(val)
// if(val.length==2){
// this.sizeList[index] = {
// width:val[1].width,
// height:val[1].height
// }
// }
},
},
getSku
(
data
)
{
getSku
(
data
)
{
const
{
skus
}
=
data
;
const
{
skus
}
=
data
;
...
@@ -263,14 +296,19 @@ export default {
...
@@ -263,14 +296,19 @@ export default {
color
:
#666666
;
color
:
#666666
;
display
:
flex
;
display
:
flex
;
align-items
:
center
;
align-items
:
center
;
justify-content
:
center
;
flex-direction
:
column
;
flex-direction
:
column
;
justify-content
:
center
;
font-family
:
PingFangSC-Regular
,
PingFang
SC
;
font-family
:
PingFangSC-Regular
,
PingFang
SC
;
.imgbox
{
.imgbox
{
height
:
auto
;
//
margin-top
:
21.8
rpx
;
width
:
100%
;
//
border
:
1px
solid
red
;
text-align
:
center
;
width
:
80
rpx
;
height
:
60
rpx
;
line-height
:
60
rpx
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
}
}
}
}
...
...
mineSubPackage/pages/userInfo/index.vue
View file @
e8d508a0
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
<view
class=
"infoItem name"
>
<view
class=
"infoItem name"
>
<view
class=
"label"
>
昵称
</view>
<view
class=
"label"
>
昵称
</view>
<view
class=
"input"
><input
type=
"text"
v-model=
"userInfo.name"
></view>
<view
class=
"input"
><input
type=
"text"
v-model=
"userInfo.name"
></view>
<view
class=
"tip"
v-if=
"valate"
>
{{
valateText
}}
</view>
</view>
</view>
<view
class=
"infoItem phone"
>
<view
class=
"infoItem phone"
>
<view
class=
"label"
>
手机
</view>
<view
class=
"label"
>
手机
</view>
...
@@ -22,7 +23,6 @@
...
@@ -22,7 +23,6 @@
<view
class=
"checkLabel"
>
{{
item
.
label
}}
</view>
<view
class=
"checkLabel"
>
{{
item
.
label
}}
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<view
class=
"infoItem birthday"
>
<view
class=
"infoItem birthday"
>
...
@@ -30,15 +30,17 @@
...
@@ -30,15 +30,17 @@
<view
class=
"input"
>
<view
class=
"input"
>
<view
class=
"birthdayBox"
>
<view
class=
"birthdayBox"
>
<view
class=
"text"
>
{{
birthdayComuted
}}
</view>
<view
class=
"text"
>
{{
birthdayComuted
}}
</view>
<view
class=
"btn"
@
click=
"changeBirthday"
>
修改
</view>
<view
class=
"btn"
v-if=
"canEditBirthday"
@
click=
"changeBirthday"
>
修改
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<view
class=
"saveBtn"
>
<view
class=
"saveBtn"
>
<button
class=
"btn"
>
保存
</button>
<button
class=
"btn"
@
click=
"save"
>
保存
</button>
</view>
</view>
</view>
</view>
<show-toast
ref=
"toast"
/>
<!--
<button
@
click=
"exit"
>
退出
</button>
-->
<!--
<button
@
click=
"exit"
>
退出
</button>
-->
<u-datetime-picker
<u-datetime-picker
...
@@ -64,6 +66,7 @@
...
@@ -64,6 +66,7 @@
<
script
>
<
script
>
import
Modal
from
'@/components/Modal/index.vue'
import
Modal
from
'@/components/Modal/index.vue'
import
Mine
from
'@/request/mine'
export
default
{
export
default
{
components
:
{
Modal
},
components
:
{
Modal
},
computed
:{
computed
:{
...
@@ -76,8 +79,38 @@ export default {
...
@@ -76,8 +79,38 @@ export default {
return
years
+
'.'
+
month
+
'.'
+
days
return
years
+
'.'
+
month
+
'.'
+
days
}
}
},
},
watch
:{
'userInfo.name'
:{
handler
(
val
){
console
.
log
(
val
)
if
(
!
/^
[
0-9a-zA-z
\u
4e00-
\u
9fa5
]{0,7}
$/
.
test
(
val
)){
this
.
valateText
=
'最多7个字符,不可输入标点符号及特殊字符'
this
.
valate
=
true
}
else
{
if
(
!
val
){
this
.
valateText
=
'请输入昵称'
this
.
valate
=
true
}
else
{
this
.
valateText
=
''
this
.
valate
=
false
}
}
}
}
},
data
()
{
data
()
{
return
{
return
{
valateText
:
''
,
canEditBirthday
:
true
,
valate
:
false
,
rules
:{
name
:[
{
required
:
true
,
errorMessage
:
'请输入姓名'
}
]
},
timerShow
:
false
,
timerShow
:
false
,
birthdayModalShow
:
false
,
birthdayModalShow
:
false
,
value1
:
Number
(
new
Date
()),
value1
:
Number
(
new
Date
()),
...
@@ -86,7 +119,8 @@ export default {
...
@@ -86,7 +119,8 @@ export default {
name
:
'脸脸'
,
name
:
'脸脸'
,
phone
:
'152****8932'
,
phone
:
'152****8932'
,
sex
:
0
,
sex
:
0
,
birthday
:
1658679810130
birthday
:
1658679810130
,
id
:
''
},
},
sexList
:[
sexList
:[
{
{
...
@@ -100,18 +134,35 @@ export default {
...
@@ -100,18 +134,35 @@ export default {
]
]
}
}
},
},
onLoad
(
option
)
{
async
onLoad
(
option
)
{
const
{
info
}
=
option
const
{
info
}
=
option
const
{
avatarUrl
,
gender
,
nickName
}
=
JSON
.
parse
(
decodeURIComponent
(
info
))
const
{
avatarUrl
,
gender
=
0
,
nickName
=
'点点'
}
=
info
?
JSON
.
parse
(
decodeURIComponent
(
info
)):{}
const
{
data
}
=
await
Mine
.
getUserInfo
()
const
{
birthday
,
createTime
,
id
,
phone
,
sex
,
userName
}
=
data
.
data
this
.
userInfo
.
id
=
id
this
.
canEditBirthday
=
!
birthday
if
(
!
birthday
){
this
.
userInfo
.
birthday
=
Date
.
parse
(
createTime
)
}
else
{
this
.
userInfo
.
birthday
=
Date
.
parse
(
birthday
)
}
this
.
userInfo
.
avatarUrl
=
avatarUrl
this
.
userInfo
.
avatarUrl
=
avatarUrl
this
.
userInfo
.
sex
=
gender
this
.
userInfo
.
sex
=
sex
?
sex
?
1
:
0
:
gender
this
.
userInfo
.
name
=
nickName
this
.
userInfo
.
name
=
userName
?
userName
:
nickName
const
phoneNumber
=
uni
.
getStorageSync
(
'phoneNumber'
)
this
.
userInfo
.
phone
=
phone
.
substr
(
0
,
3
)
+
"****"
+
phone
.
substr
(
7
)
this
.
userInfo
.
phone
=
phoneNumber
.
substr
(
0
,
3
)
+
"****"
+
phoneNumber
.
substr
(
7
)
},
},
methods
:{
methods
:{
choseTime
(
e
)
{
async
choseTime
(
e
)
{
const
sendDate
=
{
birthday
:
this
.
userInfo
.
birthday
,
id
:
this
.
userInfo
.
id
}
const
{
data
}
=
await
Mine
.
editBirthdat
(
sendDate
)
const
{
code
}
=
data
if
(
code
===
200
){
this
.
showToast
({
title
:
'修改成功'
})
this
.
userInfo
.
birthday
=
e
.
value
this
.
userInfo
.
birthday
=
e
.
value
}
this
.
timerShow
=
false
this
.
timerShow
=
false
},
},
openTimer
()
{
openTimer
()
{
...
@@ -131,6 +182,22 @@ export default {
...
@@ -131,6 +182,22 @@ export default {
console
.
log
(
123
)
console
.
log
(
123
)
}
}
})
})
},
async
save
()
{
if
(
!
this
.
valate
){
const
{
sex
,
name
,
id
}
=
this
.
userInfo
const
sendData
=
{
sex
:
Number
(
sex
)
===
0
?
false
:
true
,
userName
:
name
,
id
}
console
.
log
(
sendData
)
const
{
data
}
=
await
Mine
.
editUserInfo
(
sendData
)
const
{
code
=
0
}
=
data
if
(
code
===
200
){
this
.
showToast
({
title
:
'保存成功'
})
}
}
}
}
}
}
}
}
...
@@ -164,6 +231,18 @@ export default {
...
@@ -164,6 +231,18 @@ export default {
padding
:
0
rpx
38
rpx
0
rpx
40
rpx
;
padding
:
0
rpx
38
rpx
0
rpx
40
rpx
;
margin-top
:
24
rpx
;
margin-top
:
24
rpx
;
.name
{
position
:
relative
;
.tip
{
position
:
absolute
;
font-size
:
18
rpx
;
color
:
red
;
bottom
:
9
rpx
;
left
:
190
rpx
;
}
}
.infoItem
{
.infoItem
{
height
:
96
rpx
;
height
:
96
rpx
;
border-bottom
:
1
rpx
solid
#ECECEC
;
border-bottom
:
1
rpx
solid
#ECECEC
;
...
...
orderSubPackage/pages/settlement/index.vue
View file @
e8d508a0
...
@@ -259,24 +259,32 @@ export default {
...
@@ -259,24 +259,32 @@ export default {
}
else
{
}
else
{
if
(
this
.
agreeTerms
)
uni
.
setStorageSync
(
'TermsStatus'
,
true
)
if
(
this
.
agreeTerms
)
uni
.
setStorageSync
(
'TermsStatus'
,
true
)
}
}
const
tmpid
=
[
'1uErx-15S-3vuopXSvvsxCeM_Jd-1iZC-nXzd2yW3QU'
,
'Q4HDwBEvpTXpwtZktqWm4SZOTEuQK1x48xjqjD2GqyM'
,
'Fu_CPIXa0cnJ4EDdVKqFQ3qqKJccMqt2oorI5mfNq74'
]
const
val
=
{}
wx
.
requestSubscribeMessage
({
wx
.
requestSubscribeMessage
({
// 'Oq_zfRWRXijvXenRmfD2PARgpvdYlbkjR4laxKmBqb0'
// 'Oq_zfRWRXijvXenRmfD2PARgpvdYlbkjR4laxKmBqb0'
tmplIds
:
[
'1uErx-15S-3vuopXSvvsxCeM_Jd-1iZC-nXzd2yW3QU'
,
'Q4HDwBEvpTXpwtZktqWm4SZOTEuQK1x48xjqjD2GqyM'
,
'Fu_CPIXa0cnJ4EDdVKqFQ3qqKJccMqt2oorI5mfNq74'
]
,
tmplIds
:
tmpid
,
success
:
(
res
)
=>
{
success
:
(
res
)
=>
{
const
finalValue
=
Object
.
values
(
res
).
indexOf
(
'reject'
)
const
finalValue
=
Object
.
values
(
res
).
indexOf
(
'reject'
)
tmpid
.
forEach
(
item
=>
{
val
[
item
]
=
res
[
item
]
===
'accept'
?
true
:
false
})
if
(
finalValue
===-
1
){
if
(
finalValue
===-
1
){
uni
.
setStorageSync
(
'isMessage'
,
'true'
)
uni
.
setStorageSync
(
'isMessage'
,
'true'
)
User
.
setAllow
(
1
)
User
.
setAllow
(
1
)
this
.
saveReserve
()
this
.
saveReserve
(
val
)
}
else
{
}
else
{
User
.
setAllow
(
2
)
User
.
setAllow
(
2
)
this
.
saveReserve
()
this
.
saveReserve
(
val
)
}
}
},
},
fail
:
(
err
)
=>
{
fail
:
(
err
)
=>
{
tmpid
.
forEach
(
item
=>
{
val
[
item
]
=
false
})
console
.
log
(
err
);
console
.
log
(
err
);
User
.
setAllow
(
2
)
User
.
setAllow
(
2
)
this
.
saveReserve
()
this
.
saveReserve
(
val
)
}
}
})
})
},
},
...
@@ -309,7 +317,7 @@ export default {
...
@@ -309,7 +317,7 @@ export default {
}
}
},
},
//结算组装数据发起订单
//结算组装数据发起订单
async
saveReserve
()
{
async
saveReserve
(
val
=
{}
)
{
// 组装购物车数据或者立即支付数据
// 组装购物车数据或者立即支付数据
let
list
=
[];
let
list
=
[];
if
(
this
.
payType
==
'1'
)
{
if
(
this
.
payType
==
'1'
)
{
...
@@ -317,9 +325,27 @@ export default {
...
@@ -317,9 +325,27 @@ export default {
}
else
{
}
else
{
list
=
uni
.
getStorageSync
(
'goodsList'
).
filter
((
v
)
=>
v
.
flag
==
true
);
list
=
uni
.
getStorageSync
(
'goodsList'
).
filter
((
v
)
=>
v
.
flag
==
true
);
}
}
const
shopInfo
=
uni
.
getStorageSync
(
'shopData'
)
const
{
lat
,
lng
}
=
shopInfo
// sendMsgFlag1:下单成功通知
// sendMsgFlag2:订单状态变更通知
// sendMsgFlag3:取餐提醒
const
sendMsgFlag1
=
val
[
'1uErx-15S-3vuopXSvvsxCeM_Jd-1iZC-nXzd2yW3QU'
]?
1
:
0
const
sendMsgFlag2
=
val
[
'Q4HDwBEvpTXpwtZktqWm4SZOTEuQK1x48xjqjD2GqyM'
]?
1
:
0
const
sendMsgFlag3
=
val
[
'Fu_CPIXa0cnJ4EDdVKqFQ3qqKJccMqt2oorI5mfNq74'
]?
1
:
0
let
res
=
await
Utils
.
AssemblyOrder
(
this
.
shopData
,
this
.
totalPrice
,
this
.
totalNum
,
this
.
buyType
,
list
);
let
res
=
await
Utils
.
AssemblyOrder
(
this
.
shopData
,
this
.
totalPrice
,
this
.
totalNum
,
this
.
buyType
,
list
);
if
(
res
)
{
if
(
res
)
{
let
orderInfo
=
await
Menu
.
saveReserve
({...
res
,
couponId
:
this
.
selectCouponId
||
''
});
const
sendData
=
{
...
res
,
couponId
:
this
.
selectCouponId
||
''
,
lat
,
lng
,
sendMsgFlag1
,
sendMsgFlag2
,
sendMsgFlag3
}
let
orderInfo
=
await
Menu
.
saveReserve
(
sendData
);
if
(
orderInfo
&&
orderInfo
.
data
.
code
==
200
)
{
if
(
orderInfo
&&
orderInfo
.
data
.
code
==
200
)
{
await
Menu
.
requestPayment
(
orderInfo
.
data
.
data
,
res
,
this
.
buyType
);
await
Menu
.
requestPayment
(
orderInfo
.
data
.
data
,
res
,
this
.
buyType
);
}
}
...
...
request/mine/index.js
View file @
e8d508a0
...
@@ -41,5 +41,39 @@ export default {
...
@@ -41,5 +41,39 @@ export default {
.
catch
((
err
)
=>
{
.
catch
((
err
)
=>
{
context
.
showToast
({
title
:
'服务器错误'
,
icon
:
'none'
});
context
.
showToast
({
title
:
'服务器错误'
,
icon
:
'none'
});
});
});
},
// 获取用户信息
getUserInfo
()
{
return
uni
.
$u
.
http
.
get
(
`/system/customer/detail`
,
{})
.
then
((
res
)
=>
{
return
res
;
})
.
catch
((
err
)
=>
{
context
.
showToast
({
title
:
'服务器错误'
,
icon
:
'none'
});
});
},
// 更改用户生日
editBirthdat
(
data
)
{
return
uni
.
$u
.
http
.
post
(
`/system/customer/update/birth`
,
data
)
.
then
((
res
)
=>
{
return
res
;
})
.
catch
((
err
)
=>
{
context
.
showToast
({
title
:
err
.
data
.
msg
,
icon
:
'none'
});
return
err
});
},
// 更改用户昵称、性别
editUserInfo
(
data
)
{
return
uni
.
$u
.
http
.
post
(
`/system/customer/update/base`
,
data
)
.
then
((
res
)
=>
{
return
res
;
})
.
catch
((
err
)
=>
{
context
.
showToast
({
title
:
'服务器错误'
,
icon
:
'none'
});
});
}
}
};
};
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