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
372ab1e2
Commit
372ab1e2
authored
Aug 31, 2022
by
宋冰琦
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复部分bug
parent
4557923c
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
154 additions
and
27 deletions
+154
-27
App.vue
+1
-1
components/menuAssembly/index.vue
+4
-2
menuSubPackage/pages/goodsDetail/goodsDetail.vue
+9
-4
mineSubPackage/pages/userInfo/index.vue
+12
-6
orderSubPackage/pages/settlement/index.vue
+21
-7
pages/menu/menu.vue
+23
-1
pages/mine/mine.vue
+3
-1
request/index.js
+1
-1
request/menu/index.js
+17
-1
request/user/index.js
+42
-1
store/modules/user.js
+6
-2
utils/utils.js
+15
-0
No files found.
App.vue
View file @
372ab1e2
...
@@ -24,7 +24,7 @@ export default {
...
@@ -24,7 +24,7 @@ export default {
// }
// }
// })
// })
Store
.
commit
(
'setAuthorization'
,
uni
.
getStorageSync
(
'Authorization'
))
Store
.
commit
(
'setAuthorization'
,
uni
.
getStorageSync
(
'Authorization'
))
Store
.
commit
(
'setUserInfo'
,
uni
.
getStorageSync
(
'
u
serInfo'
))
Store
.
commit
(
'setUserInfo'
,
uni
.
getStorageSync
(
'
U
serInfo'
))
// uni.showLoading({
// uni.showLoading({
// title: '加载中...',
// title: '加载中...',
// mask:true
// mask:true
...
...
components/menuAssembly/index.vue
View file @
372ab1e2
...
@@ -371,7 +371,7 @@ export default {
...
@@ -371,7 +371,7 @@ export default {
height
:
calc
(
100vh
-
var
(
--scroll-height
));
height
:
calc
(
100vh
-
var
(
--scroll-height
));
overflow
:
auto
;
overflow
:
auto
;
width
:
585.21
rpx
;
width
:
585.21
rpx
;
padding-top
:
42
rpx
;
//
padding-top
:
42
rpx
;
}
}
.buiedcss
{
.buiedcss
{
height
:
calc
(
100vh
-
376
rpx
-
183
rpx
);
height
:
calc
(
100vh
-
376
rpx
-
183
rpx
);
...
@@ -533,7 +533,9 @@ export default {
...
@@ -533,7 +533,9 @@ export default {
}
}
}
}
.box
:first-child
{
margin-top
:
40
rpx
;
}
.box
:last-child
{
.box
:last-child
{
//
padding-bottom
:
var
(
--good-bottom
);
//
padding-bottom
:
var
(
--good-bottom
);
padding-bottom
:
200
rpx
;
padding-bottom
:
200
rpx
;
...
...
menuSubPackage/pages/goodsDetail/goodsDetail.vue
View file @
372ab1e2
...
@@ -346,14 +346,12 @@ export default {
...
@@ -346,14 +346,12 @@ export default {
uni
.
navigateTo
({
url
:
`/orderSubPackage/pages/settlement/index?buyType=1&goodsList=1`
})
uni
.
navigateTo
({
url
:
`/orderSubPackage/pages/settlement/index?buyType=1&goodsList=1`
})
}
}
}
}
let
Authorization
=
uni
.
getStorageSync
(
'Authorization'
);
const
checkLocak
=
()
=>
{
if
(
!
Authorization
)
{
this
.
loginByPhoneNumber
(
e
);
uni
.
authorize
({
uni
.
authorize
({
scope
:
'scope.userLocation'
,
scope
:
'scope.userLocation'
,
success
:
()
=>
{
//1.1 允许授权
success
:
()
=>
{
//1.1 允许授权
console
.
log
(
"允许授权位置"
);
console
.
log
(
"允许授权位置"
);
settleMentFunc
()
gosettleFun
()
},
},
fail
:
(
err
)
=>
{
//1.2 拒绝授权
fail
:
(
err
)
=>
{
//1.2 拒绝授权
wx
.
exitMiniProgram
({
success
:
(
res
)
=>
{
}
})
wx
.
exitMiniProgram
({
success
:
(
res
)
=>
{
}
})
...
@@ -382,7 +380,14 @@ export default {
...
@@ -382,7 +380,14 @@ export default {
})
})
}
}
})
})
}
let
Authorization
=
uni
.
getStorageSync
(
'Authorization'
);
if
(
!
Authorization
)
{
this
.
loginByPhoneNumber
(
e
);
checkLocak
()
return
return
}
else
{
checkLocak
()
}
}
if
(
!
this
.
shopState
||!
this
.
isInRange
){
if
(
!
this
.
shopState
||!
this
.
isInRange
){
return
return
...
...
mineSubPackage/pages/userInfo/index.vue
View file @
372ab1e2
...
@@ -86,7 +86,7 @@ export default {
...
@@ -86,7 +86,7 @@ export default {
return
years
+
'.'
+
month
+
'.'
+
days
return
years
+
'.'
+
month
+
'.'
+
days
},
},
userInfoStorage
()
{
userInfoStorage
()
{
return
this
.
$store
.
state
.
user
.
userInfo
;
return
uni
.
getStorageSync
(
'UserInfo'
)
;
},
},
systemBarHeight
(){
systemBarHeight
(){
return
this
.
$store
.
state
.
user
.
systemBarHeight
return
this
.
$store
.
state
.
user
.
systemBarHeight
...
@@ -170,10 +170,11 @@ export default {
...
@@ -170,10 +170,11 @@ export default {
const
{...
result
}
=
this
.
userInfoStorage
const
{...
result
}
=
this
.
userInfoStorage
const
sendData
=
{
const
sendData
=
{
...
result
,
...
result
,
avatarUrl
:
''
,
avatarUrl
,
canEditBirthday
:
this
.
canEditBirthday
canEditBirthday
:
this
.
canEditBirthday
}
}
Store
.
commit
(
'setUserInfo'
,
sendData
);
Store
.
commit
(
'setUserInfo'
,
sendData
);
this
.
save
(
false
)
}
else
{
}
else
{
const
{
avatarUrl
,
birthday
,
id
,
phone
,
sex
,
customerName
,
canEditBirthday
}
=
this
.
userInfoStorage
const
{
avatarUrl
,
birthday
,
id
,
phone
,
sex
,
customerName
,
canEditBirthday
}
=
this
.
userInfoStorage
this
.
canEditBirthday
=
canEditBirthday
this
.
canEditBirthday
=
canEditBirthday
...
@@ -208,10 +209,11 @@ export default {
...
@@ -208,10 +209,11 @@ export default {
const
{
userInfo
}
=
res
const
{
userInfo
}
=
res
const
Info
=
{
const
Info
=
{
avatarUrl
:
userInfo
.
avatarUrl
,
avatarUrl
:
userInfo
.
avatarUrl
,
nickName
:
userInfo
.
nickName
//
nickName:userInfo.nickName
}
}
this
.
userInfo
.
avatarUrl
=
Info
.
avatarUrl
this
.
userInfo
.
avatarUrl
=
Info
.
avatarUrl
this
.
userInfo
.
name
=
Info
.
nickName
// this.userInfo.name = Info.nickName
this
.
save
(
false
)
}
}
})
})
},
},
...
@@ -233,7 +235,7 @@ export default {
...
@@ -233,7 +235,7 @@ export default {
}
}
})
})
},
},
async
save
()
{
async
save
(
isReturn
=
true
)
{
const
{
customerName
,...
result
}
=
this
.
userInfoStorage
const
{
customerName
,...
result
}
=
this
.
userInfoStorage
if
(
!
this
.
valate
){
if
(
!
this
.
valate
){
const
{
sex
,
name
,
id
,
avatarUrl
}
=
this
.
userInfo
const
{
sex
,
name
,
id
,
avatarUrl
}
=
this
.
userInfo
...
@@ -245,8 +247,10 @@ export default {
...
@@ -245,8 +247,10 @@ export default {
console
.
log
(
sendData
)
console
.
log
(
sendData
)
await
Mine
.
editUserAvatar
({
avatarUrl
:
avatarUrl
,
id
})
await
Mine
.
editUserAvatar
({
avatarUrl
:
avatarUrl
,
id
})
const
{
data
}
=
await
Mine
.
editUserInfo
(
sendData
)
const
{
data
}
=
await
Mine
.
editUserInfo
(
sendData
)
console
.
log
(
data
)
const
{
code
=
0
}
=
data
const
{
code
=
0
}
=
data
if
(
code
===
200
){
if
(
code
===
200
){
this
.
showToast
({
title
:
'保存成功'
})
const
data
=
{
const
data
=
{
...
result
,
...
result
,
customerName
:
name
,
customerName
:
name
,
...
@@ -256,7 +260,8 @@ export default {
...
@@ -256,7 +260,8 @@ export default {
}
}
Store
.
commit
(
'setUserInfo'
,
data
);
Store
.
commit
(
'setUserInfo'
,
data
);
uni
.
setStorage
({
key
:
'userInfo'
,
data
:
data
});
uni
.
setStorage
({
key
:
'userInfo'
,
data
:
data
});
this
.
showToast
({
title
:
'保存成功'
})
uni
.
setStorageSync
(
'UserInfo'
,
data
)
if
(
isReturn
){
wx
.
navigateBack
({
wx
.
navigateBack
({
delta
:
1
delta
:
1
});
});
...
@@ -264,6 +269,7 @@ export default {
...
@@ -264,6 +269,7 @@ export default {
}
}
}
}
}
}
}
}
}
</
script
>
</
script
>
...
...
orderSubPackage/pages/settlement/index.vue
View file @
372ab1e2
...
@@ -159,7 +159,7 @@ export default {
...
@@ -159,7 +159,7 @@ export default {
// 商品详情页点击立即支付进入
// 商品详情页点击立即支付进入
if
(
option
.
goodsList
)
{
if
(
option
.
goodsList
)
{
console
.
log
(
'详情进入'
)
console
.
log
(
'详情进入'
)
this
.
getMessageFlag
()
//
this.getMessageFlag()
const
shopData
=
uni
.
getStorageSync
(
'shopData'
);
const
shopData
=
uni
.
getStorageSync
(
'shopData'
);
this
.
shopData
=
shopData
this
.
shopData
=
shopData
this
.
buyType
=
3
;
this
.
buyType
=
3
;
...
@@ -177,14 +177,23 @@ export default {
...
@@ -177,14 +177,23 @@ export default {
if
(
q
)
{
if
(
q
)
{
console
.
log
(
'扫码进入'
,
q
)
console
.
log
(
'扫码进入'
,
q
)
uni
.
setStorageSync
(
"selectFlag"
,
false
)
uni
.
setStorageSync
(
"selectFlag"
,
false
)
this
.
getMessageFlag
()
//
this.getMessageFlag()
this
.
saveGetTicket
()
this
.
saveGetTicket
()
User
.
getLocation
((
state
,
params
)
=>
{
User
.
getLocation
((
state
,
params
)
=>
{
uni
.
removeStorageSync
(
'shopCarInfo'
);
uni
.
removeStorageSync
(
'shopCarInfo'
);
$EventBus
.
$emit
(
'updateCar'
);
$EventBus
.
$emit
(
'updateCar'
);
let
id
=
decodeURIComponent
(
q
).
split
(
'?'
)[
1
].
split
(
'='
)[
1
];
// let id = decodeURIComponent(q).split('?')[1].split('=')[1];
// let id = q;
const
optionDecode
=
Utils
.
getUrlParams2
(
decodeURIComponent
(
q
))
Menu
.
getScreenShopCar
(
id
,
params
).
then
(
res
=>
{
this
.
optionDecode
=
optionDecode
const
loginInfo
=
uni
.
getStorageSync
(
"loginInfo"
)
const
{
id
,
recognizePerson
}
=
optionDecode
const
openid
=
loginInfo
?
JSON
.
parse
(
loginInfo
).
openid
:
""
const
sendData
=
{}
if
(
recognizePerson
){
sendData
.
faceInfoId
=
recognizePerson
,
sendData
.
openid
=
openid
}
Menu
.
getScreenShopCar
(
id
,
params
,
sendData
).
then
(
res
=>
{
const
data
=
JSON
.
parse
(
res
.
data
.
data
);
const
data
=
JSON
.
parse
(
res
.
data
.
data
);
console
.
log
(
data
);
console
.
log
(
data
);
this
.
shopData
=
data
.
shop
;
this
.
shopData
=
data
.
shop
;
...
@@ -202,7 +211,7 @@ export default {
...
@@ -202,7 +211,7 @@ export default {
// 购物车点击进入
// 购物车点击进入
if
(
uni
.
getStorageSync
(
'shopCarInfo'
).
length
!=
0
)
{
if
(
uni
.
getStorageSync
(
'shopCarInfo'
).
length
!=
0
)
{
console
.
log
(
'购物车进入'
)
console
.
log
(
'购物车进入'
)
this
.
getMessageFlag
()
//
this.getMessageFlag()
console
.
log
(
uni
.
getStorageSync
(
'shopCarInfo'
))
console
.
log
(
uni
.
getStorageSync
(
'shopCarInfo'
))
const
shopData
=
uni
.
getStorageSync
(
'shopData'
);
const
shopData
=
uni
.
getStorageSync
(
'shopData'
);
this
.
shopData
=
shopData
this
.
shopData
=
shopData
...
@@ -256,7 +265,8 @@ export default {
...
@@ -256,7 +265,8 @@ export default {
sendMsgFlag1
:
false
,
sendMsgFlag1
:
false
,
sendMsgFlag2
:
false
,
sendMsgFlag2
:
false
,
sendMsgFlag3
:
false
sendMsgFlag3
:
false
}
},
optionDecode
:{}
}
}
},
},
computed
:
{
computed
:
{
...
@@ -379,6 +389,10 @@ export default {
...
@@ -379,6 +389,10 @@ export default {
getPhoneNumber
(
e
)
{
getPhoneNumber
(
e
)
{
if
(
e
.
detail
.
errMsg
==
'getPhoneNumber:ok'
)
{
if
(
e
.
detail
.
errMsg
==
'getPhoneNumber:ok'
)
{
e
.
loginInfo
=
this
.
loginInfo
e
.
loginInfo
=
this
.
loginInfo
const
{
recognizePerson
}
=
this
.
optionDecode
if
(
recognizePerson
)
{
e
.
faceInfoId
=
recognizePerson
}
User
.
getPhoneNumber
(
e
);
User
.
getPhoneNumber
(
e
);
}
else
if
(
e
.
detail
.
errMsg
==
"getPhoneNumber:fail user deny"
)
{
}
else
if
(
e
.
detail
.
errMsg
==
"getPhoneNumber:fail user deny"
)
{
this
.
showToast
({
title
:
'已拒绝手机号授权'
,
icon
:
'error'
})
this
.
showToast
({
title
:
'已拒绝手机号授权'
,
icon
:
'error'
})
...
...
pages/menu/menu.vue
View file @
372ab1e2
...
@@ -70,6 +70,7 @@ import ShopCar from '../../components/shopCar/shopCar.vue'
...
@@ -70,6 +70,7 @@ import ShopCar from '../../components/shopCar/shopCar.vue'
import
Utils
from
'@/utils/utils'
import
Utils
from
'@/utils/utils'
import
Menu
from
'@/request/menu'
import
Menu
from
'@/request/menu'
import
{
$EventBus
}
from
'@/utils/EventBus'
;
import
{
$EventBus
}
from
'@/utils/EventBus'
;
import
Store
from
'@/store'
;
import
Order
from
'@/request/order'
import
Order
from
'@/request/order'
import
OrderQrCode
from
'@/components/OrderQrCode'
import
OrderQrCode
from
'@/components/OrderQrCode'
...
@@ -140,7 +141,28 @@ export default {
...
@@ -140,7 +141,28 @@ export default {
// this.img = 'https://s3.bmp.ovh/imgs/2022/07/02/2cfab823b35322e3.gif'
// this.img = 'https://s3.bmp.ovh/imgs/2022/07/02/2cfab823b35322e3.gif'
// }
// }
},
},
onLoad
:
async
function
()
{
onLoad
:
async
function
(
option
)
{
// 通过扫码进入
const
{
q
}
=
option
if
(
q
){
const
optionDecode
=
Utils
.
getUrlParams2
(
decodeURIComponent
(
q
))
console
.
log
(
Utils
.
getUrlParams2
(
decodeURIComponent
(
q
)),
this
.
userInfo
)
const
{
num
,
serial_no
,
source
}
=
optionDecode
if
(
source
&&
this
.
userms
)
{
const
sendData
=
{
phone
:
this
.
userInfo
.
phoneNumber
,
user_id
:
this
.
userInfo
.
id
,
source
:
source
,
param
:
JSON
.
stringify
({
serial_no
,
num
})
}
Menu
.
sendUserCoupon
(
sendData
)
}
else
{
Store
.
commit
(
'setMenuOption'
,
optionDecode
);
}
}
uni
.
getSetting
({
uni
.
getSetting
({
success
:
(
res
)
=>
{
success
:
(
res
)
=>
{
// 已经授权位置不获取默认店铺
// 已经授权位置不获取默认店铺
...
...
pages/mine/mine.vue
View file @
372ab1e2
...
@@ -135,10 +135,12 @@ export default {
...
@@ -135,10 +135,12 @@ export default {
if
(
e
.
detail
.
errMsg
==
'getPhoneNumber:ok'
)
{
if
(
e
.
detail
.
errMsg
==
'getPhoneNumber:ok'
)
{
e
.
loginInfo
=
this
.
loginInfo
e
.
loginInfo
=
this
.
loginInfo
User
.
getPhoneNumber
(
e
,
async
()
=>
{
User
.
getPhoneNumber
(
e
,
async
()
=>
{
setTimeout
(
async
()
=>
{
const
{
data
:
couponData
}
=
await
User
.
getCouponNum
()
const
{
data
:
couponData
}
=
await
User
.
getCouponNum
()
this
.
tickNum
=
couponData
?.
data
||
0
this
.
tickNum
=
couponData
?.
data
||
0
}
);
},
1000
);
});
}
else
if
(
e
.
detail
.
errMsg
==
"getPhoneNumber:fail user deny"
)
{
}
else
if
(
e
.
detail
.
errMsg
==
"getPhoneNumber:fail user deny"
)
{
this
.
showToast
({
title
:
'已拒绝手机号授权'
,
icon
:
'error'
})
this
.
showToast
({
title
:
'已拒绝手机号授权'
,
icon
:
'error'
})
}
}
...
...
request/index.js
View file @
372ab1e2
...
@@ -65,7 +65,7 @@ module.exports = (vm) => {
...
@@ -65,7 +65,7 @@ module.exports = (vm) => {
uni
.
hideLoading
();
uni
.
hideLoading
();
/* 对响应成功做点什么 可使用async await 做异步操作*/
/* 对响应成功做点什么 可使用async await 做异步操作*/
if
(
response
.
data
.
code
!==
200
)
{
if
(
response
.
data
.
code
!==
200
&&
response
.
data
.
code
!==
0
)
{
const
phoneNumber
=
uni
.
getStorageSync
(
'phoneNumber'
);
const
phoneNumber
=
uni
.
getStorageSync
(
'phoneNumber'
);
if
(
response
.
data
.
code
==
401
&&
phoneNumber
)
{
if
(
response
.
data
.
code
==
401
&&
phoneNumber
)
{
User
.
getAuthorization
(
phoneNumber
);
User
.
getAuthorization
(
phoneNumber
);
...
...
request/menu/index.js
View file @
372ab1e2
...
@@ -18,11 +18,12 @@ export default {
...
@@ -18,11 +18,12 @@ export default {
});
});
},
},
// 获取点单屏幕的订单信息
// 获取点单屏幕的订单信息
getScreenShopCar
(
key
,
location
)
{
getScreenShopCar
(
key
,
location
,
sendData
)
{
return
uni
.
$u
.
http
return
uni
.
$u
.
http
.
post
(
'/application/getData'
,
{
.
post
(
'/application/getData'
,
{
key
,
key
,
location
,
location
,
...
sendData
})
})
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
return
res
;
return
res
;
...
@@ -125,5 +126,20 @@ export default {
...
@@ -125,5 +126,20 @@ export default {
});
});
return
err
;
return
err
;
});
});
},
// 首页调用发送优惠券接口
sendUserCoupon
(
data
)
{
return
uni
.
$u
.
http
.
post
(
'/v1/issue/user/coupon'
,
data
)
.
then
((
res
)
=>
{
return
res
;
})
.
catch
((
err
)
=>
{
context
.
showToast
({
title
:
'服务器错误'
,
icon
:
'none'
,
});
return
err
;
});
}
}
};
};
request/user/index.js
View file @
372ab1e2
...
@@ -59,6 +59,7 @@ export default {
...
@@ -59,6 +59,7 @@ export default {
encryptedData
:
res
.
encryptedData
,
encryptedData
:
res
.
encryptedData
,
})
})
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
console
.
log
(
res
,
'resssssssss'
)
const
{
statusCode
,
data
}
=
res
;
const
{
statusCode
,
data
}
=
res
;
const
{
code
,
token
,
phoneNumber
}
=
data
;
const
{
code
,
token
,
phoneNumber
}
=
data
;
if
(
statusCode
==
200
&&
data
&&
code
==
200
)
{
if
(
statusCode
==
200
&&
data
&&
code
==
200
)
{
...
@@ -99,6 +100,7 @@ export default {
...
@@ -99,6 +100,7 @@ export default {
if
(
code
){
if
(
code
){
this
.
getOpenId
(
code
).
then
((
res
)
=>
{
this
.
getOpenId
(
code
).
then
((
res
)
=>
{
const
loginInfo
=
res
.
data
.
msg
const
loginInfo
=
res
.
data
.
msg
uni
.
setStorageSync
(
'loginInfo'
,
loginInfo
)
resolve
(
loginInfo
)
resolve
(
loginInfo
)
})
})
}
}
...
@@ -107,22 +109,28 @@ export default {
...
@@ -107,22 +109,28 @@ export default {
})
})
},
},
loginDecrypt
(
res
){
loginDecrypt
(
res
){
const
{
faceInfoId
}
=
res
.
data
return
uni
.
$u
.
http
.
post
(
'/weixin/decrypt '
,
{
return
uni
.
$u
.
http
.
post
(
'/weixin/decrypt '
,
{
session_key
:
res
.
loginInfo
.
session_key
,
session_key
:
res
.
loginInfo
.
session_key
,
openId
:
res
.
loginInfo
.
openid
,
openId
:
res
.
loginInfo
.
openid
,
encryptedData
:
res
.
data
,
encryptedData
:
res
.
data
,
iv
:
res
.
iv
,
iv
:
res
.
iv
,
faceInfoId
,
source
:
3
source
:
3
})
})
},
},
// 手机号授权登录
// 手机号授权登录
getPhoneNumber
(
res
,
callback
)
{
getPhoneNumber
(
res
,
callback
)
{
console
.
log
(
res
)
uni
.
setStorage
({
key
:
'userPhoneInfo'
,
data
:
res
});
uni
.
setStorage
({
key
:
'userPhoneInfo'
,
data
:
res
});
Store
.
commit
(
'setUserPhoneInfo'
,
res
);
Store
.
commit
(
'setUserPhoneInfo'
,
res
);
uni
.
setStorage
({
key
:
'phoneInfo'
,
data
:
res
});
uni
.
setStorage
({
key
:
'phoneInfo'
,
data
:
res
});
const
loginInfo
=
res
.
loginInfo
const
loginInfo
=
res
.
loginInfo
const
iv
=
res
.
detail
.
iv
const
iv
=
res
.
detail
.
iv
const
data
=
res
.
detail
.
encryptedData
const
data
=
res
.
detail
.
encryptedData
if
(
res
.
faceInfoId
){
data
.
faceInfoId
=
res
.
faceInfoId
}
wx
.
checkSession
({
wx
.
checkSession
({
success
:
(
res
)
=>
{
success
:
(
res
)
=>
{
console
.
log
(
'seeion未过期'
)
console
.
log
(
'seeion未过期'
)
...
@@ -136,6 +144,23 @@ export default {
...
@@ -136,6 +144,23 @@ export default {
}
}
})
})
},
},
// 首页调用发送优惠券接口
sendUserCoupon
(
data
)
{
return
uni
.
$u
.
http
.
post
(
'/v1/issue/user/coupon'
,
data
)
.
then
((
res
)
=>
{
Store
.
commit
(
'setMenuOption'
,
{});
return
res
;
})
.
catch
((
err
)
=>
{
context
.
showToast
({
title
:
'服务器错误'
,
icon
:
'none'
,
});
Store
.
commit
(
'setMenuOption'
,
{});
return
err
;
});
},
// 获取用户信息
// 获取用户信息
getUserInfo
(
data
)
{
getUserInfo
(
data
)
{
return
uni
.
$u
.
http
return
uni
.
$u
.
http
...
@@ -143,9 +168,10 @@ export default {
...
@@ -143,9 +168,10 @@ export default {
.
then
((
res
)
=>
{
.
then
((
res
)
=>
{
console
.
log
(
res
,
data
)
console
.
log
(
res
,
data
)
const
{
birthday
,
createTime
,
id
,
phone
,
sex
,
userName
,
avatarUrl
}
=
res
.
data
.
data
const
{
birthday
,
createTime
,
id
,
phone
,
sex
,
userName
,
avatarUrl
}
=
res
.
data
.
data
const
{
avatarUrl
:
localAvatarUrl
}
=
uni
.
getStorageSync
(
'UserInfo'
)
const
sendData
=
{
const
sendData
=
{
...
data
,
...
data
,
avatarUrl
:
avatarUrl
,
avatarUrl
:
avatarUrl
||
localAvatarUrl
,
sex
:
sex
?
1
:
0
,
sex
:
sex
?
1
:
0
,
customerName
:
userName
,
customerName
:
userName
,
phone
:
phone
.
substr
(
0
,
3
)
+
"****"
+
phone
.
substr
(
7
),
phone
:
phone
.
substr
(
0
,
3
)
+
"****"
+
phone
.
substr
(
7
),
...
@@ -159,6 +185,21 @@ export default {
...
@@ -159,6 +185,21 @@ export default {
sendData
.
birthday
=
Date
.
parse
(
birthday
)
sendData
.
birthday
=
Date
.
parse
(
birthday
)
}
}
Store
.
commit
(
'setUserInfo'
,
sendData
);
Store
.
commit
(
'setUserInfo'
,
sendData
);
uni
.
setStorageSync
(
'UserInfo'
,
sendData
)
const
MenuOption
=
Store
.
state
.
user
.
menuOption
if
(
JSON
.
stringify
(
MenuOption
)
!==
'{}'
)
{
const
{
num
,
serial_no
,
source
}
=
MenuOption
const
sendDataOption
=
{
phone
:
sendData
.
phoneNumber
,
user_id
:
sendData
.
id
,
source
:
source
,
param
:
JSON
.
stringify
({
serial_no
,
num
})
}
this
.
sendUserCoupon
(
sendDataOption
)
}
})
})
.
catch
((
err
)
=>
{
.
catch
((
err
)
=>
{
context
.
showToast
({
title
:
'服务器错误'
,
icon
:
'none'
});
context
.
showToast
({
title
:
'服务器错误'
,
icon
:
'none'
});
...
...
store/modules/user.js
View file @
372ab1e2
...
@@ -6,7 +6,8 @@ const user = {
...
@@ -6,7 +6,8 @@ const user = {
userPhoneInfo
:
null
,
userPhoneInfo
:
null
,
shopInfo
:
null
,
//店铺信息
shopInfo
:
null
,
//店铺信息
orderId
:
null
,
//扫码进入时携带的订单id
orderId
:
null
,
//扫码进入时携带的订单id
systemBarHeight
:
{}
//设备头部高度信息
systemBarHeight
:
{},
//设备头部高度信息
menuOption
:
{}
},
},
mutations
:
{
mutations
:
{
// 保存扫码进入时携带的订单id
// 保存扫码进入时携带的订单id
...
@@ -23,9 +24,12 @@ const user = {
...
@@ -23,9 +24,12 @@ const user = {
},
},
// 设置用户允许昵称头像授权时的信息
// 设置用户允许昵称头像授权时的信息
setUserInfo
(
state
,
userInfo
)
{
setUserInfo
(
state
,
userInfo
)
{
console
.
log
(
userInfo
)
state
.
userInfo
=
userInfo
;
state
.
userInfo
=
userInfo
;
},
},
// 设置扫码进入的优惠券信息
setMenuOption
(
state
,
data
)
{
state
.
menuOption
=
data
},
// 授权手机号时允许后的信息
// 授权手机号时允许后的信息
setUserPhoneInfo
(
state
,
userPhoneInfo
)
{
setUserPhoneInfo
(
state
,
userPhoneInfo
)
{
state
.
userPhoneInfo
=
userPhoneInfo
;
state
.
userPhoneInfo
=
userPhoneInfo
;
...
...
utils/utils.js
View file @
372ab1e2
...
@@ -215,4 +215,19 @@ export default {
...
@@ -215,4 +215,19 @@ export default {
delta
:
1
delta
:
1
});
});
},
},
// 解析url参数
getUrlParams2
(
url
)
{
// 通过 ? 分割获取后面的参数字符串
let
urlStr
=
url
.
split
(
'?'
)[
1
]
// 创建空对象存储参数
let
obj
=
{};
// 再通过 & 将每一个参数单独分割出来
let
paramsArr
=
urlStr
.
split
(
'&'
)
for
(
let
i
=
0
,
len
=
paramsArr
.
length
;
i
<
len
;
i
++
){
// 再通过 = 将每一个参数分割为 key:value 的形式
let
arr
=
paramsArr
[
i
].
split
(
'='
)
obj
[
arr
[
0
]]
=
arr
[
1
];
}
return
obj
}
};
};
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