Commit 2e76f6ea by 严立

LL - 增加 banner 跳转

parent c6c58516
......@@ -296,6 +296,12 @@ App({
})
},
/**
* 全局函数 - 设置商店信息
* @function
* @param
* @returns
*/
setShopInfo: function (funcShopAppId, funcShopType) {
for (let i = 0, l = iEnvironmental.shopId.length; i < l; i++) {
if (funcShopAppId === iEnvironmental.shopId[i].appId) {
......@@ -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
let Environmental = 'dev'
let Development = {
host: 'https://sm-web.meiqicloud.com',
// host: 'https://sm-web.meiqicloud.com',
host: 'https://smbhyh-web.meiqicloud.com',
// 景点信息
pointInfo: [
......
......@@ -235,47 +235,107 @@ Page({
* @returns
*/
onBanner: function (event) {
let funcItme = event.currentTarget.dataset.item
console.log(funcItme)
if (funcItme.targetId && funcItme.targetType) {
// 0 - 首页,1 - 所有服务,2 - 儿童营地,3 - 海错图,4 - 元养水韵,5 - 儿童营地接待,6 - 拾光花坊, 7 - 商品
switch (funcItme.targetType) {
case 0:
return
break
case 1:
let funcItme = event.currentTarget.dataset.item
break
// 月卡商品
// funcItme.targetId = '94b7a6a7f82845d3a1875ee1e7a033fa'
case 2:
// 门票商品
// funcItme.targetId = '0ac170457a8546469976753ea21cd8e9'
break
// 普通商品
// funcItme.targetId = '67fc0c3967e94e9d98fe4c7b1949b084'
case 3:
// 文创商品
// funcItme.targetId = '006a1a3df15e43119103ec34e0bec393'
break
// 餐品
funcItme.targetId = '329f304aca104ff1887dde5877e15126'
case 4:
funcItme.targetType = 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
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
case 6:
case 3:
// 攻略详情
if (funcItme.targetId) {
funcUrl = '/pages/play/strategy-detail/strategy-detail?id=' + funcItme.targetId
wx.navigateTo({
url: funcUrl
})
}
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
}
}
},
/**
* 整合商品数据,输出固定格式
* 三期可将此函数抽出,作为全局函数使用
* @function
* @param {object} - event
* @returns
*/
setCommodityData: function (funcCommodityData) {
},
onBuy: function (event) {
let funcIndex = event.currentTarget.dataset.index
let funcItemIndex = event.currentTarget.dataset.itemindex
......
......@@ -18,7 +18,7 @@ Page({
onNoticeDetail: function (funcItem) {
console.log(funcItem)
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
})
},
......
......@@ -506,12 +506,15 @@ Page({
// 二期代码
onOrder: function () {
let funcUserInfo = wx.getStorageSync('userInfo')
if (!funcUserInfo.isSignIn) return
wx.navigateTo({
url: '/pages/mine/order/order'
})
},
onAppointment: function () {
let funcUserInfo = wx.getStorageSync('userInfo')
if (!funcUserInfo.isSignIn) return
wx.navigateTo({
url: '/pages/mine/appointment/appointment'
})
......
const App = getApp()
Page({
// 此处属性是页面全局属性,通常用于记录不进行渲染的逻辑数据,避免过多 setData 操作。
option: {},
data: {
imageBase: App.globalData.appImageBase,
resourcesBase: App.globalData.appResourcesBase,
......
......@@ -37,6 +37,8 @@
"hidedInDevtools": []
},
"scripts": {},
"simulatorType": "wechat",
"simulatorPluginLibVersion": {},
"condition": {
"search": {
"current": -1,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment