Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
严立
/
mini-shimao
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
2e76f6ea
authored
Sep 25, 2020
by
严立
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
LL - 增加 banner 跳转
parent
c6c58516
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
158 additions
and
24 deletions
app.js
environmental.js
pages/commodity/project/project.js
pages/home/dynamic/dynamic.js
pages/mine/home/home.js
pages/play/home/home.js
project.config.json
app.js
View file @
2e76f6ea
...
@@ -296,6 +296,12 @@ App({
...
@@ -296,6 +296,12 @@ App({
})
})
},
},
/**
* 全局函数 - 设置商店信息
* @function
* @param
* @returns
*/
setShopInfo
:
function
(
funcShopAppId
,
funcShopType
)
{
setShopInfo
:
function
(
funcShopAppId
,
funcShopType
)
{
for
(
let
i
=
0
,
l
=
iEnvironmental
.
shopId
.
length
;
i
<
l
;
i
++
)
{
for
(
let
i
=
0
,
l
=
iEnvironmental
.
shopId
.
length
;
i
<
l
;
i
++
)
{
if
(
funcShopAppId
===
iEnvironmental
.
shopId
[
i
].
appId
)
{
if
(
funcShopAppId
===
iEnvironmental
.
shopId
[
i
].
appId
)
{
...
@@ -307,4 +313,62 @@ App({
...
@@ -307,4 +313,62 @@ App({
}
}
}
}
},
},
/**
* 全局函数 - 设置商品信息
* @function
* @param {object} - { commodity: '商品数据对象', complete: '回调函数' }
* @returns
*/
setCommodityInfo
:
function
(
funcParam
)
{
let
funcInfoRaw
=
funcParam
.
commodity
let
funcComplete
=
funcParam
.
complete
// 特殊数据格式化
switch
(
Number
(
funcInfoRaw
.
genre
))
{
case
1
:
funcInfoRaw
.
number
=
funcInfoRaw
.
inventorie
[
0
].
number
funcInfoRaw
.
cardName
=
funcInfoRaw
.
inventorie
[
0
].
cardName
funcInfoRaw
.
ownerPrice
=
funcInfoRaw
.
inventorie
[
0
].
ownerPrice
funcInfoRaw
.
cardId
=
funcInfoRaw
.
inventorie
[
0
].
cardId
funcInfoRaw
.
sightseerPrice
=
funcInfoRaw
.
inventorie
[
0
].
sightseerPrice
funcInfoRaw
.
cardNam
=
funcInfoRaw
.
inventorie
[
0
].
cardNam
funcInfoRaw
.
inventoriesId
=
funcInfoRaw
.
inventorie
[
0
].
inventoriesId
break
}
// 商品通用属性设置
let
funcInfo
=
{
'id'
:
funcInfoRaw
.
id
,
'typeId'
:
funcInfoRaw
.
genre
,
// 分类
'name'
:
funcInfoRaw
.
name
,
// 名称
'cover'
:
funcInfoRaw
.
ticketsImg
,
// 封面
'notificationId'
:
funcInfoRaw
.
notificationId
,
// 购买须知
'priceType'
:
1
,
// 当前用户身份享受价格类型
'price'
:
funcInfoRaw
.
sightseerPrice
,
// 普通价
'priceText'
:
App
.
modular
.
utils
.
formatAmount
(
funcInfoRaw
.
sightseerPrice
),
// 普通价文本格式
'priceSpecial'
:
funcInfoRaw
.
ownerPrice
,
// 业主价
'priceSpecialText'
:
App
.
modular
.
utils
.
formatAmount
(
funcInfoRaw
.
ownerPrice
),
// 业主价文本格式
'priceDiscount'
:
funcInfoRaw
.
price
,
// 活动价
'priceDiscountText'
:
App
.
modular
.
utils
.
formatAmount
(
funcInfoRaw
.
price
),
// 活动价文本格式
'inventoriesId'
:
funcInfoRaw
.
inventoriesId
,
'dateValid'
:
this
.
modular
.
miment
().
format
(
'YYYY.MM.DD'
),
// 有效时间
'dateInvalid'
:
funcInfoRaw
.
funcInfoRaw
.
cardNam
,
// 失效时间
}
let
funcUserType
=
wx
.
getStorageSync
(
'userInfo'
).
userType
// 根据后台判断价格显示类型
// 活动价优先级最高,如果存在活动价,则只显示活动价和普通价
if
(
funcInfo
.
priceDiscount
||
funcInfo
.
priceDiscount
===
0
)
{
funcInfo
.
priceType
=
1
}
else
{
// 活动价不存在,进一步判断普通价与业主价是否一致,如果不一致,则显示两者
if
(
funcInfo
.
price
!==
funcInfo
.
priceSpecial
&&
funcUserType
)
{
funcInfo
.
priceType
=
2
}
else
{
funcInfo
.
priceType
=
3
}
}
},
})
})
\ No newline at end of file
environmental.js
View file @
2e76f6ea
let
Environmental
=
'dev'
let
Environmental
=
'dev'
let
Development
=
{
let
Development
=
{
host
:
'https://sm-web.meiqicloud.com'
,
// host: 'https://sm-web.meiqicloud.com',
host
:
'https://smbhyh-web.meiqicloud.com'
,
// 景点信息
// 景点信息
pointInfo
:
[
pointInfo
:
[
...
...
pages/commodity/project/project.js
View file @
2e76f6ea
...
@@ -235,47 +235,107 @@ Page({
...
@@ -235,47 +235,107 @@ Page({
* @returns
* @returns
*/
*/
onBanner
:
function
(
event
)
{
onBanner
:
function
(
event
)
{
return
let
funcItme
=
event
.
currentTarget
.
dataset
.
item
let
funcItme
=
event
.
currentTarget
.
dataset
.
item
console
.
log
(
funcItme
)
if
(
funcItme
.
targetId
&&
funcItme
.
targetType
)
{
// 月卡商品
// 0 - 首页,1 - 所有服务,2 - 儿童营地,3 - 海错图,4 - 元养水韵,5 - 儿童营地接待,6 - 拾光花坊, 7 - 商品
// funcItme.targetId = '94b7a6a7f82845d3a1875ee1e7a033fa'
switch
(
funcItme
.
targetType
)
{
case
0
:
break
// 门票商品
// funcItme.targetId = '0ac170457a8546469976753ea21cd8e9'
case
1
:
// 普通商品
// funcItme.targetId = '67fc0c3967e94e9d98fe4c7b1949b084'
break
// 文创商品
// funcItme.targetId = '006a1a3df15e43119103ec34e0bec393'
case
2
:
// 餐品
funcItme
.
targetId
=
'329f304aca104ff1887dde5877e15126'
break
funcItme
.
targetType
=
4
case
3
:
break
case
4
:
let
funcUrl
=
''
if
(
funcItme
.
targetType
)
{
switch
(
funcItme
.
targetType
)
{
case
1
:
// 活动
if
(
funcItme
.
targetId
)
{
funcUrl
=
'/pages/play/activity-detail/activity-detail?id='
+
funcItme
.
targetId
}
else
{
funcUrl
=
'/pages/play/activity/activity'
}
wx
.
navigateTo
({
url
:
funcUrl
})
break
break
case
5
:
case
2
:
// 动态
if
(
funcItme
.
targetId
)
{
funcUrl
=
'/pages/home/dynamic-detail/dynamic-detail?id='
+
funcItme
.
targetId
}
else
{
funcUrl
=
'/pages/home/dynamic/dynamic'
}
wx
.
navigateTo
({
url
:
funcUrl
})
break
break
case
6
:
case
3
:
// 攻略详情
if
(
funcItme
.
targetId
)
{
funcUrl
=
'/pages/play/strategy-detail/strategy-detail?id='
+
funcItme
.
targetId
wx
.
navigateTo
({
url
:
funcUrl
})
}
break
break
case
7
:
case
4
:
// 商品
// 跳转商品下单,需要查询商品参数
App
.
wxRequest
({
url
:
'/api/v1/commodity/getCommodityParticulars'
,
data
:
{
'commodityId'
:
funcItme
.
targetId
},
success
:
(
response
)
=>
{
console
.
log
(
response
)
let
funcParam
=
{
'commodity'
:
response
.
data
,
'complete'
:
function
()
{
console
.
log
(
'complete'
)
}
}
App
.
setCommodityInfo
(
funcParam
)
}
})
// if (funcItme.targetId) {
// funcUrl = '/pages/pay/order-input/order-input?type=' + funcItme.targetId
// wx.navigateTo({
// url: funcUrl
// })
// }
break
break
}
}
}
}
},
},
/**
* 整合商品数据,输出固定格式
* 三期可将此函数抽出,作为全局函数使用
* @function
* @param {object} - event
* @returns
*/
setCommodityData
:
function
(
funcCommodityData
)
{
},
onBuy
:
function
(
event
)
{
onBuy
:
function
(
event
)
{
let
funcIndex
=
event
.
currentTarget
.
dataset
.
index
let
funcIndex
=
event
.
currentTarget
.
dataset
.
index
let
funcItemIndex
=
event
.
currentTarget
.
dataset
.
itemindex
let
funcItemIndex
=
event
.
currentTarget
.
dataset
.
itemindex
...
...
pages/home/dynamic/dynamic.js
View file @
2e76f6ea
...
@@ -18,7 +18,7 @@ Page({
...
@@ -18,7 +18,7 @@ Page({
onNoticeDetail
:
function
(
funcItem
)
{
onNoticeDetail
:
function
(
funcItem
)
{
console
.
log
(
funcItem
)
console
.
log
(
funcItem
)
wx
.
navigateTo
({
wx
.
navigateTo
({
url
:
'/pages/
notice-detail/notice
-detail?id='
+
funcItem
.
currentTarget
.
dataset
.
id
url
:
'/pages/
home/dynamic-detail/dynamic
-detail?id='
+
funcItem
.
currentTarget
.
dataset
.
id
})
})
},
},
...
...
pages/mine/home/home.js
View file @
2e76f6ea
...
@@ -506,12 +506,15 @@ Page({
...
@@ -506,12 +506,15 @@ Page({
// 二期代码
// 二期代码
onOrder
:
function
()
{
onOrder
:
function
()
{
let
funcUserInfo
=
wx
.
getStorageSync
(
'userInfo'
)
if
(
!
funcUserInfo
.
isSignIn
)
return
wx
.
navigateTo
({
wx
.
navigateTo
({
url
:
'/pages/mine/order/order'
url
:
'/pages/mine/order/order'
})
})
},
},
onAppointment
:
function
()
{
onAppointment
:
function
()
{
let
funcUserInfo
=
wx
.
getStorageSync
(
'userInfo'
)
if
(
!
funcUserInfo
.
isSignIn
)
return
wx
.
navigateTo
({
wx
.
navigateTo
({
url
:
'/pages/mine/appointment/appointment'
url
:
'/pages/mine/appointment/appointment'
})
})
...
...
pages/play/home/home.js
View file @
2e76f6ea
const
App
=
getApp
()
const
App
=
getApp
()
Page
({
Page
({
// 此处属性是页面全局属性,通常用于记录不进行渲染的逻辑数据,避免过多 setData 操作。
option
:
{},
data
:
{
data
:
{
imageBase
:
App
.
globalData
.
appImageBase
,
imageBase
:
App
.
globalData
.
appImageBase
,
resourcesBase
:
App
.
globalData
.
appResourcesBase
,
resourcesBase
:
App
.
globalData
.
appResourcesBase
,
...
...
project.config.json
View file @
2e76f6ea
...
@@ -37,6 +37,8 @@
...
@@ -37,6 +37,8 @@
"hidedInDevtools"
:
[]
"hidedInDevtools"
:
[]
},
},
"scripts"
:
{},
"scripts"
:
{},
"simulatorType"
:
"wechat"
,
"simulatorPluginLibVersion"
:
{},
"condition"
:
{
"condition"
:
{
"search"
:
{
"search"
:
{
"current"
:
-1
,
"current"
:
-1
,
...
...
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