Commit 8cc2e3b2 by wjw

ww--电影报名

parent bac06374
......@@ -121,10 +121,25 @@ Page({
}
})
// console.log(showList)
movieInfo.priceSpecialText = movieInfo.ownerPrice.toFixed(2)
movieInfo.priceText = movieInfo.visitorPrice.toFixed(2)
movieInfo.tags = movieInfo.tags.replace(/( )?热映影片( )?/, ' ').split(' ')
movieInfo.free = movieInfo.ownerPrice == '0' && movieInfo.visitorPrice == '0' ? '免费' : `¥${movieInfo.ownerPrice.toFixed(2)}`
let funcUserType = wx.getStorageSync('userInfo').userType
// 根据后台判断价格显示类型
// 活动价优先级最高,如果存在活动价,则只显示活动价和普通价
if (movieInfo.priceDiscount) {
movieInfo.priceType = 1
} else {
// 活动价不存在,进一步判断普通价与业主价是否一致,如果不一致,则显示两者
if (movieInfo.price !== movieInfo.ownerPrice && funcUserType) {
movieInfo.priceType = 2
} else {
movieInfo.priceType = 3
}
}
this.setData({
movieInfo,
showList,
......@@ -135,9 +150,24 @@ Page({
},
// 跳转到报名页面
onReportMovie: function (event) {
let id = event.currentTarget.dataset.movieid
let film = event.currentTarget.dataset.film
let movie = this.data.movieInfo
console.log(film)
let funcItem = {
id: movie.activityId,
filmId: film.filmId,
name: movie.filmName,
price: movie.visitorPrice,
priceSpecial: movie.ownerPrice,
date: film.beginTime + '-' + film.endTime,
cover: movie.cover,
priceType: movie.priceType,
quantity: 1
}
wx.setStorageSync('shoppingCartBuffer', [funcItem])
wx.navigateTo({
url: '/pages/pay/order-input/order-input?type=' + '7' + '&id=' + id,
url: '/pages/pay/order-input/order-input?type=7',
})
}
})
\ No newline at end of file
......@@ -84,7 +84,7 @@
<view class="show-free">
<text>{{movieInfo.free}}</text>
</view>
<view class="show-btn" bindtap="onReportMovie" data-movieId="{{item.filmId}}">
<view class="show-btn" bindtap="onReportMovie" data-film="{{item}}">
<text>报名观影</text>
</view>
</view>
......
......@@ -90,8 +90,24 @@ Page({
v.filmType = v.filmType.replace(/\//g, ' / ')
v.filmDirector = v.filmDirector.replace(/\//g, ' ')
v.filmLead = v.filmLead.replace(/\//g, ' ')
v.priceSpecialText = v.ownerPrice.toFixed(2)
v.priceText = v.visitorPrice.toFixed(2)
v.free = v.ownerPrice == '0' ? '免费' : `¥${v.ownerPrice.toFixed(2)}`
v.tags = v.tags.replace(/( )?热映影片( )?/, ' ').split(' ')
let funcUserType = wx.getStorageSync('userInfo').userType
// 根据后台判断价格显示类型
// 活动价优先级最高,如果存在活动价,则只显示活动价和普通价
if (v.priceDiscount) {
v.priceType = 1
} else {
// 活动价不存在,进一步判断普通价与业主价是否一致,如果不一致,则显示两者
if (v.price !== v.ownerPrice && funcUserType) {
v.priceType = 2
} else {
v.priceType = 3
}
}
})
this.setData({
movieToday
......@@ -124,6 +140,8 @@ Page({
v.filmType = v.filmType.replace(/\//g, ' / ')
v.filmDirector = v.filmDirector.replace(/\//g, ' ')
v.filmLead = v.filmLead.replace(/\//g, ' ')
v.priceSpecialText = v.ownerPrice.toFixed(2)
v.priceText = v.visitorPrice.toFixed(2)
v.free = v.ownerPrice == '0' ? '免费' : `¥${v.ownerPrice.toFixed(2)}`
v.tags = v.tags.replace(/( )?热映影片( )?/, ' ').replace(/( )+$/, '').split(' ')
})
......@@ -149,6 +167,8 @@ Page({
v.filmType = v.filmType.replace(/\//g, ' / ')
v.filmDirector = v.filmDirector.replace(/\//g, ' ')
v.filmLead = v.filmLead.replace(/\//g, ' ')
v.priceSpecialText = v.ownerPrice.toFixed(2)
v.priceText = v.visitorPrice.toFixed(2)
v.free = v.ownerPrice == '0'? '免费' : `¥${v.ownerPrice.toFixed(2)}`
v.tags = v.tags.replace(/( )?热映影片( )?/, ' ').split(' ')
})
......@@ -183,11 +203,22 @@ Page({
},
// 跳转到报名页面
onReportMovie: function (event) {
console.log(event)
let movie = event.currentTarget.dataset.movie
let funcItem = {
id: movie.activityId,
filmId: movie.filmId,
name: movie.filmName,
price: movie.visitorPrice,
priceSpecial: movie.ownerPrice,
date: movie.beginTime + '-' + movie.endTime,
cover: movie.cover,
priceType: movie.priceType,
quantity: 1
}
wx.setStorageSync('shoppingCartBuffer', [funcItem])
let id = event.currentTarget.dataset.movieid
wx.navigateTo({
url: '/pages/pay/order-input/order-input?type=' + '7' + '&id=' + id,
url: '/pages/pay/order-input/order-input?type=7',
})
}
})
\ No newline at end of file
......@@ -68,7 +68,7 @@
<view class="movie-free">
<text>{{item.free}}</text>
</view>
<view class="movie-btn" catchtap="onReportMovie" data-movieId="{{item.activityId}}">
<view class="movie-btn" catchtap="onReportMovie" data-movie="{{item}}">
<text>报名观影</text>
</view>
</view>
......
......@@ -471,56 +471,33 @@ Page({
},
success: (response) => {
let funcResponse = response.data.list
let funcCommodityList = []
let funcList = []
for (let i = 0, l = funcResponse.length; i < l; i++) {
let funcItem = {
'id': funcResponse[i].activityId, // 商品标识
'typeId': 7, // 商品类别标识
'sidebarId': '',
'name': funcResponse[i].filmName,
'cover': funcResponse[i].cover, // 商品封面
'price': funcResponse[i].visitorPrice, // 普通价
'priceText': App.modular.utils.formatAmount(funcResponse[i].visitorPrice), // 普通价文本格式
'priceSpecial': funcResponse[i].ownerPrice, // 业主价
'priceSpecialText': App.modular.utils.formatAmount(funcResponse[i].ownerPrice), // 业主价文本格式
'priceDiscount': funcResponse[i].price, // 活动价
'priceDiscountText': App.modular.utils.formatAmount(funcResponse[i].price), // 活动价文本格式
'priceType': 1,
'describe': funcResponse[i].synopsis,
'describeDetail': '', // 商品描述详情,在点击详情时获得数据
'name': funcResponse[i].activityId,
'dateBegin': funcResponse[i].beginDate,
'dateEnd': funcResponse[i].endDate,
'cover': funcResponse[i].cover,
'movieDirector': funcResponse[i].filmDirector,
'movieLeader': funcResponse[i].filmLead,
'movieName': funcResponse[i].filmName,
'movieType': funcResponse[i].filmType,
'movieKeyWord': funcResponse[i].keyword,
'movieLeader': funcResponse[i].filmLead,
'price': funcResponse[i].visitorPrice, // 普通价
'priceText': App.modular.utils.formatAmount(funcResponse[i].visitorPrice), // 普通价文本格式
'priceSpecial': funcResponse[i].ownerPrice, // 业主价
'priceSpecialText': App.modular.utils.formatAmount(funcResponse[i].ownerPrice), // 业主价文本格式
'priceType': 1,
'tagsId': funcResponse[i].tagIds,
'tags': funcResponse[i].tags.split(' '),
}
let funcUserType = wx.getStorageSync('userInfo').userType
// 根据后台判断价格显示类型
// 活动价优先级最高,如果存在活动价,则只显示活动价和普通价
if (funcItem.priceDiscount) {
funcItem.priceType = 1
} else {
// 活动价不存在,进一步判断普通价与业主价是否一致,如果不一致,则显示两者
if (funcItem.price !== funcItem.priceSpecial && funcUserType) {
funcItem.priceType = 2
} else {
funcItem.priceType = 3
}
}
if (funcItem.tagsId.includes('102')) {
funcCommodityList.push(funcItem)
funcList.push(funcItem)
}
funcCommodityList.push(funcItem)
}
this.setData({
detailCommodity: funcCommodityList
detailCommodity: funcList
})
}
})
......@@ -550,18 +527,20 @@ Page({
},
onBuy: function (event) {
let funcCommodityInfo = event.currentTarget.dataset.item
// 补充必要参数
funcCommodityInfo.quantity = 1
funcCommodityInfo.quantityMin = 1
funcCommodityInfo.quantityMax = 1
funcCommodityInfo.isActive = true
wx.setStorageSync('shoppingCartBuffer', [funcCommodityInfo])
let id = event.currentTarget.dataset.id
wx.navigateTo({
url: '/pages/pay/order-input/order-input?type=' + funcCommodityInfo.typeId
})
url: '/pages/play/movie-detail/movie-detail?id=' + id,
})
// // 补充必要参数
// funcCommodityInfo.quantity = 1
// funcCommodityInfo.quantityMin = 1
// funcCommodityInfo.quantityMax = 1
// funcCommodityInfo.isActive = true
// wx.setStorageSync('shoppingCartBuffer', [funcCommodityInfo])
// wx.navigateTo({
// url: '/pages/pay/order-input/order-input?type=' + funcCommodityInfo.typeId
// })
},
onLocation: function () {
......
......@@ -298,7 +298,7 @@
</view>
<view class="commodity-card-list row">
<block wx:for="{{detailCommodity}}" wx:for-index="index" wx:for-item="item" wx:key="index">
<view class="movie-card-item col">
<view class="movie-card-item col" data-id="{{item.name}}" bindtap="onBuy">
<image src="{{item.cover}}"></image>
<view class="movie-card-item-title row align-c">
<text>{{item.movieName}}</text>
......@@ -324,7 +324,7 @@
<text>免费</text>
</view>
<view>
<button class="row con-c align-c" data-item="{{item}}" bindtap="onBuy">报名观影</button>
<button class="row con-c align-c">报名观影</button>
</view>
</view>
</view>
......
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