mirror of
https://gitee.com/elegant_wings/dbd-meeting-wx-small.git
synced 2025-06-21 03:49:37 +08:00
描述:优惠券选择
This commit is contained in:
parent
a036458531
commit
6034fb6e76
@ -18,7 +18,8 @@ Page({
|
||||
couponId: null,
|
||||
meetingRoomId: null,
|
||||
dataList: [],
|
||||
userDetail: {}
|
||||
userDetail: {},
|
||||
parkName : wx.getStorageSync('parkName')
|
||||
},
|
||||
|
||||
/**
|
||||
@ -54,8 +55,10 @@ Page({
|
||||
let jieshuTime = new Date(item.endDate + " 23:59:59")
|
||||
if (nowTime >= kaishiTime && nowTime <= jieshuTime) {
|
||||
item.isDisable = false
|
||||
item.bgUrl = '/profile/static/meeting/coupon/couponBg.png'
|
||||
} else {
|
||||
item.isDisable = true
|
||||
item.bgUrl = '/profile/static/meeting/coupon/couponBgDisabled.png'
|
||||
}
|
||||
return item;
|
||||
})
|
||||
|
@ -5,7 +5,7 @@
|
||||
<van-radio-group value="{{ couponId }}">
|
||||
<view class="item" wx:for="{{dataList}}" wx:key="*this" data-id="{{item.ticketId}}" data-isDisable="{{item.isDisable}}" bind:tap="couponSelect">
|
||||
<view class="imgView">
|
||||
<image class="img" src="{{IMG_NAME + '/profile/static/meeting/coupon/couponBg.png'}}" mode="aspectFill"></image>
|
||||
<image class="img" src="{{IMG_NAME + item.bgUrl}}" mode="aspectFill"></image>
|
||||
<view class="timeView">
|
||||
<view class="title" wx:if="{{item.type == 1}}">{{item.duration}}小时</view>
|
||||
<view class="type" wx:if="{{item.type == 1}}">抵用券</view>
|
||||
@ -14,9 +14,10 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="contentView">
|
||||
<view class="title">{{item.ticketName}}</view>
|
||||
<view class="platform">适用平台: {{item.content}}</view>
|
||||
<view class="title">{{item.ticketName}} x {{item.num}}张</view>
|
||||
<view class="platform">{{parkName}}</view>
|
||||
<view class="validityTime">{{item.startTime}}~{{item.endDate}}</view>
|
||||
<view class="validityTime">单次可用一张</view>
|
||||
</view>
|
||||
<van-radio name="{{item.ticketId}}" disabled="{{item.isDisable}}"></van-radio>
|
||||
</view>
|
||||
|
@ -13,7 +13,8 @@ import {
|
||||
import {
|
||||
selfFormatTimeYMD,
|
||||
selfFormatTimeHM,
|
||||
twoTimeInterval
|
||||
twoTimeInterval,
|
||||
selfArrSum
|
||||
} from "../../../../utils/util.js"
|
||||
|
||||
|
||||
@ -37,8 +38,11 @@ Page({
|
||||
couponId: '',
|
||||
couponData: {},
|
||||
couponList: [],
|
||||
couponCount: 0,
|
||||
couponUseList: [],
|
||||
couponUseCount: 0,
|
||||
couponNotUseList: [],
|
||||
couponNotUseCount: 0,
|
||||
countAmount: '',
|
||||
totalAmount: '',
|
||||
priceDialogShow: false,
|
||||
@ -70,7 +74,7 @@ Page({
|
||||
let bannerList = []
|
||||
if (detail.indoorPicUrl) {
|
||||
try {
|
||||
bannerList = JSON.parse(detail.indoorPicUrl).map(item=>item.url)
|
||||
bannerList = JSON.parse(detail.indoorPicUrl).map(item => item.url)
|
||||
} catch (error) {
|
||||
console.log(`JSON error : ${error}`);
|
||||
}
|
||||
@ -108,14 +112,19 @@ Page({
|
||||
let useList = res.data.filter(item => !item.isDisable)
|
||||
// 不可用
|
||||
let notUseList = res.data.filter(item => item.isDisable)
|
||||
|
||||
_this.setData({
|
||||
couponList: dataList,
|
||||
couponCount: selfArrSum(dataList.map(item => item.num)),
|
||||
couponUseList: useList,
|
||||
couponUseCount: selfArrSum(useList.map(item => item.num)),
|
||||
couponNotUseList: notUseList,
|
||||
couponNotUseCount: selfArrSum(notUseList.map(item => item.num)),
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
// 主题修改监听
|
||||
titleChange(event) {
|
||||
this.setData({
|
||||
|
@ -56,7 +56,7 @@
|
||||
<view class="itemView" bind:tap="jumpMeetingCoupon">
|
||||
<view class="label">优惠券</view>
|
||||
<view class="content">
|
||||
<view class="coupon {{couponId ? 'select' : ''}}">{{couponId? couponData.ticketName : couponUseList.length + '张可用' + '(共计'+ couponList.length +'张)'}}</view>
|
||||
<view class="coupon {{couponId ? 'select' : ''}}">{{couponId? couponData.ticketName : couponUseCount + '张可用'}}</view>
|
||||
<van-icon name="arrow" size="44rpx" />
|
||||
</view>
|
||||
</view>
|
||||
|
@ -206,6 +206,15 @@ const formatNumber = n => {
|
||||
return n[1] ? n : '0' + n
|
||||
}
|
||||
|
||||
// 数组sum合计
|
||||
function selfArrSum(list) {
|
||||
let count = 0;
|
||||
list.map(item => {
|
||||
count = count + item
|
||||
})
|
||||
return count
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
formatTime: formatTime,
|
||||
formatDate: formatDate,
|
||||
@ -220,5 +229,6 @@ module.exports = {
|
||||
selfFormatTimeHM,
|
||||
selfFormatTimeYMDH,
|
||||
twoTimeInterval,
|
||||
twoTimeIntervalReturnHours
|
||||
twoTimeIntervalReturnHours,
|
||||
selfArrSum
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user