jiazhipeng 4 months ago
parent
commit
89677e02ee
  1. 8
      pages.json
  2. 3
      static/js/CommonFunction.js
  3. 443
      subPackages/ticket/detail.vue
  4. 64
      subPackages/ticket/index.vue
  5. 1177
      subPackages/ticket/order.vue
  6. 20
      uni_modules/uni-calendar/changelog.md
  7. 14
      uni_modules/uni-calendar/components/uni-calendar/uni-calendar-item.vue
  8. 45
      uni_modules/uni-calendar/components/uni-calendar/uni-calendar.vue
  9. 14
      uni_modules/uni-calendar/components/uni-calendar/util.js
  10. 2
      uni_modules/uni-calendar/package.json
  11. 4
      uni_modules/uni-calendar/readme.md

8
pages.json

@ -50,7 +50,7 @@
{
"path": "ticket/index",
"style": {
"navigationBarTitleText": "采摘"
"navigationBarTitleText": "田园采摘"
}
},
{
@ -59,6 +59,12 @@
"navigationBarTitleText": "详情"
}
},
{
"path": "ticket/order",
"style": {
"navigationBarTitleText": "提交订单"
}
},
{

3
static/js/CommonFunction.js

@ -90,7 +90,8 @@ Vue.prototype.showImg = img => {
if (img.indexOf('https://') != -1 || img.indexOf('http://') != -1) {
return img;
} else {
return Vue.prototype.NEWAPIURL + img;
// return Vue.prototype.NEWAPIURL + img;
return 'https://swsz.api.js-dyyj.com'+img;
}
}

443
subPackages/ticket/detail.vue

@ -16,6 +16,7 @@
</view>
<view class="detail-container">
<!-- 景点信息 -->
<view class="common-container info-container">
<view class="flex-between">
<view class="info-title text-overflowRows">{{info.title}}</view>
@ -43,9 +44,8 @@
</view>
</view>
</view>
<view class="w-full flex" v-if="sku.length>0">
<!-- sku -->
<view class="w-full flex" style="margin-bottom: 20rpx;" v-if="sku.length>0">
<scroll-view class="left-container no-scrollbar" scroll-y scroll-with-animation>
<view :class="['type-item',current ==i?'active':'']"
v-for="(item,i) in sku" :key="i" @click="changeType(item,i)">
@ -53,9 +53,10 @@
</view>
</scroll-view>
<scroll-view class="right-container no-scrollbar" scroll-y scroll-with-animation>
<view style="height: 20rpx;"></view>
<view class="scenic-list" v-for="(item, index) in sku" :key="index">
<scroll-view :scroll-top="scrollHeight" @scroll="skuScroll" @scrolltoupper="scrollSpecial('up')" @scrolltolower="scrollSpecial('low')"
class="right-container no-scrollbar" scroll-y scroll-with-animation>
<view style="height: 20rpx;" ></view>
<view class="scenic-list scenic-query-item" v-for="(item, index) in sku" :key="index">
<view class="scenic-title">{{item.title}}</view>
<view class="scenic-item " v-for="(itemSku, indexSku) in item.sku" :key="indexSku">
<view class="title text-overflow">{{ itemSku.sku_name }}</view>
@ -83,52 +84,72 @@
</scroll-view>
</view>
<!-- 优待政策 | 景点介绍 -->
<view class="common-container" style="padding: 30rpx 20rpx;background: white;">
<view class="box-title">景点简介</view>
<view class="" id="cpts" v-html="formateRichText(info.feature_content)"></view>
<view class="box-title">优待政策<text class="box-title-line"></text>景点介绍</view>
<view class="box-content">
<view class="sm-box-title" style="padding-top: 0;">优待政策</view>
<view class="" v-html="formateRichText(info.extra_info)"></view>
<view class="sm-box-title">景点介绍</view>
<view class="" v-html="formateRichText(info.content)"></view>
</view>
</view>
</view>
<!-- 底部按钮 -->
<view class="btn-box flex-center">
<view class="icon-container">
<view class="icon-item">
<image src="https://static.ticket.sz-trip.com/uploads/20250611/627d67e48ac41903c40c31f1613f2444.png"></image>
<text>客服</text>
</view>
</view>
<view class="btn" @click="order">加入购物车</view>
</view>
<!-- 购物车图标 -->
<view class="add-cart-icon">
<uni-badge class="uni-badge-left-margin" :text="1" absolute="rightTop" :offset="[-3, -3]" size="small"
:custom-style="{background:'#DC2525',color:'#ffffff'}">
<image src="https://static.ticket.sz-trip.com/uploads/20250611/f8c2078ad76754a0b0251f9b65784dc2.png"></image>
</uni-badge>
</view>
<!-- 预订须知的弹窗 -->
<uni-popup ref="popupRule" type="bottom" :safe-area="false">
<view class="popup-content-date flex-column flex" >
<view class="popup-content-date flex-column flex" v-if="skuInfo">
<view class="popup-content-title flex">
<view class="flex-1 w-1rpx text-overflow">
{{skuInfo.title}}
{{skuInfo.sku_name}}
</view>
<img src="https://static.ticket.sz-trip.com/taizhou/images/cha.png" @click="closePopupRule"
<img src="https://static.ticket.sz-trip.com/taizhou/images/cha.png"
@click="closePopupRule"
style="width: 20rpx;height: 20rpx;" class="flex-shrink-0">
</view>
<view class="content flex-1 h-1rpx no-scrollbar">
<view class="detail-content" v-html="formateRichText(skuInfo.reserve_content)"></view>
<view class="content flex-1 h-1rpx no-scrollbar" >
<view v-if="skuInfo.sku_model" class="detail-content" v-html="formateRichText(skuInfo.sku_model.bookinfo)"></view>
</view>
</view>
</uni-popup>
<!-- 预定弹窗 -->
<uni-popup ref="popup" type="bottom" :safe-area="false">
<view class="popup-content-date" >
<view class="popup-content-date" v-if="skuInfo">
<view class="popup-content-title flex">
<view class="flex-1 w-1rpx text-overflow">
{{skuInfo.title}}
{{skuInfo.sku_name}}
</view>
<img src="https://static.ticket.sz-trip.com/taizhou/images/cha.png" @click="closePopup"
style="width: 31rpx;height: 31rpx;" class="flex-shrink-0">
</view>
<view class="order-popup-detail">
<view class="relative">
<view style="position: relative;">
<view class="sku-title">使用日期</view>
<view class="date-content">
<view :class="['item', item.store>0?'':'disabled',seldDateIndex===index?'active':'']"
<view :class="['item', item.stock>0?'':'disabled',seldDateIndex===index?'active':'']"
v-for="(item,index) in allSeldDate" :key="index"
@click="clickTab(item,index)">
<view>{{ShowDateDay(new Date(item.date).getDay())}}</view>
<view>{{item.date.slice(-5)}}</view>
<view class="price" v-if="item.store > 0">{{showNoPriceNew(item.money)}}</view>
<view class="price" v-if="item.stock > 0">{{showNoPriceNew(item.price)}}</view>
<view v-else>不可定</view>
</view>
</view>
@ -138,7 +159,7 @@
</view>
</view>
<view v-if="timesArr.length > 0 && skuInfo.is_time_stock">
<view v-if="timesArr.length > 0 && skuInfo.sku_model&& skuInfo.sku_model.is_time_stock">
<view class="sku-title">选择场次</view>
<view class="time-box">
<view v-for="(item,index) in timesArr" :key="index"
@ -152,7 +173,7 @@
</view>
<view class="sku-bottom">
<view class="flex" style="align-items: baseline;">
合计<view class="bottom-price">{{allSeldDate[seldDateIndex].money / 100 || 0}}</view>
合计<view class="bottom-price">{{allSeldDate[seldDateIndex].price / 100 || 0}}</view>
</view>
<view class="bottom-btn" @click="addBuyCard">
下一步
@ -177,14 +198,15 @@
id: null,
info: null,
current: 0,
sku: [],
current: 0, // sku index
scrollHeight: 0, // sku
skuDoms: [], // Dom
skuInfo: {}, //
selectGoods: {}, //
minSeldDate: new Date().Format('yyyy-MM-dd'),
maxSeldDate: new Date((new Date()).getFullYear(), (new Date()).getMonth() + 3, 0).Format('yyyy-MM-dd'),
maxSeldDate: new Date((new Date()).getFullYear(), (new Date()).getMonth() + 1, 0).Format('yyyy-MM-dd'),
allSeldDate: [],
seldDateIndex: 0,
timesArr: [],
@ -199,6 +221,7 @@
},
onLoad(options) {
this.skuDoms = []
this.id = options.id;
this.getInfo();
// this.getGoodsList()
@ -212,6 +235,11 @@
this.Post({id: this.id},'/api/scene/detail').then(res => {
this.info = res.data
this.sku = this.info.product || []
if (this.info.title) {
uni.setNavigationBarTitle({
title: this.info.title
})
}
});
},
@ -235,10 +263,113 @@
});
},
changeType (item,i) {
// -----------------------------
changeType (item,index) {
let that = this
if (Array.isArray(this.skuDoms) && this.skuDoms.length>0) {
console.log('进入暂存数据')
try {
let res = this.skuDoms
let target0 = res[0][0]
let targetDom = res[0][index]
let scrollTop = that.scrollHeight
console.log(targetDom)
if (target0&&targetDom) {
scrollTop = targetDom.top - target0.top // title87
}
console.log(scrollTop)
that.current = index
that.scrollHeight = scrollTop
} catch(e) {
console.log(e)
}
} else {
const query = uni.createSelectorQuery(); //
query.selectAll(".scenic-query-item").boundingClientRect(); //toViewid
query.exec(function (res) {
try {
let target0 = res[0][0]
let targetDom = res[0][index]
let scrollTop = that.scrollHeight
console.log(targetDom)
if (target0&&targetDom) {
scrollTop = targetDom.top - target0.top // title87
}
that.current = index
that.scrollHeight = scrollTop
that.skuDoms = res
} catch(e) {
console.log(e)
}
});
}
},
skuScroll (e) {
let that = this
let domSctollTop = e.detail.scrollTop
if (Array.isArray(this.skuDoms) && this.skuDoms.length>0) {
console.log('进入暂存数据')
try {
let res = this.skuDoms
let target0 = res[0][0]
let topHeightArr = []
res[0].forEach(v=>{
topHeightArr.push(v.top - target0.top)
})
// domSctollTop-1 -1
// 50px
let findIndex = topHeightArr.findIndex(v=>v-50>=domSctollTop)
if (findIndex<0) {
findIndex = topHeightArr.length-1
} else if(findIndex>=1) {
findIndex--
}
that.current = findIndex
} catch(e) {
console.log(e)
}
} else {
const query = wx.createSelectorQuery(); //
query.selectAll(".scenic-query-item").boundingClientRect() //toViewid
query.exec(function (res) {
try {
let target0 = res[0][0]
let topHeightArr = []
res[0].forEach(v=>{
topHeightArr.push(v.top - target0.top)
})
// domSctollTop-1 -1
// 50px
let findIndex = topHeightArr.findIndex(v=>v-50>=domSctollTop)
if (findIndex<0) {
findIndex = topHeightArr.length-1
} else if(findIndex>=1) {
findIndex--
}
that.current = findIndex
that.skuDoms = res
} catch(e) {
console.log(e)
}
})
}
},
scrollSpecial (type) {
if (type == 'up') {
this.current = 0
} else {
let length = this.sku.length-1
length = length>0?length:0
this.current = length
}
},
//-----------------------------------------
//
showSkuInfo (itemSku,goods) {
this.skuInfo = itemSku
this.selectGoods = goods
@ -246,26 +377,33 @@
this.openPopRule()
},
//
//
changeSku(itemSku,goods) {
this.skuInfo = itemSku
this.selectGoods = goods
//
// if(this.skuInfo.ticket_type == 2) {
// this.addBuyCard()
// }else {
// this.getDays(itemSku,goods)
// }
this.getPriceCal(itemSku,goods)
},
//
getPriceCal(itemSku,goods) {
this.Post({
start_date: this.minSeldDate,
end_date: this.maxSeldDate,
sku_id: itemSku.id
}, '/api/product/product_date_price').then(res => {
this.allSeldDate = res.data || []
this.seldDateIndex = this.allSeldDate.findIndex(item => item.stock > 0)
this.getTimeStock(this.allSeldDate[this.seldDateIndex].date)
this.openPop()
})
},
openCalendar () {
this.calendarParam = {
startDate: (this.allSeldDate.find(v=>v.store>0) || {}).date,
endDate: (this.allSeldDate[this.allSeldDate.findLastIndex(v=>v.store>0)]||{}).date,
selected: this.allSeldDate.filter(v=>v.store>0).map(v=>{
startDate: (this.allSeldDate.find(v=>v.stock>0) || {}).date,
endDate: (this.allSeldDate[this.allSeldDate.findLastIndex(v=>v.stock>0)]||{}).date,
selected: this.allSeldDate.filter(v=>v.stock>0).map(v=>{
return {
date: v.date,
info: '¥'+this.showNoPriceNew(v.money),
info: '¥'+this.showNoPriceNew(v.price),
notNeedDot:true,
}
})
@ -273,25 +411,16 @@
this.$refs.calendar.open();
},
//
getPriceCal(itemSku,goods) {
this.Post({
specifications_id: itemSku.id,
goods_id: goods.id,
limit: 60
}, '/api/goods/getPriceCalendarListBySpecifications').then(res => {
this.allSeldDate = res.data || []
this.seldDateIndex = this.allSeldDate.findIndex(item => item.store != 0)
this.getTimeStock(this.allSeldDate[this.seldDateIndex].date)
this.openPop()
})
},
//
getTimeStock(date) {
if (!this.skuInfo.sku_model.is_time_stock || this.seldDateIndex<0) {
return
}
this.Post({
specifications_id: this.skuInfo.id,
sku_id: this.skuInfo.id,
date: date,
}, '/api/goods/getTimeStock').then(res => {
}, '/api/product/product_timestock_price').then(res => {
if (Array.isArray(res.data)) {
this.timesArr = res.data || []
this.seldTimeIndex = -1
@ -305,7 +434,7 @@
//
clickTab(item, index) {
if (item.store>0) {
if (item.stock>0) {
this.seldDateIndex = index
this.getTimeStock(item.date)
}
@ -334,66 +463,23 @@
return;
}
let param = {
sInfo: this.skuInfo,
pInfo: this.selectGoods,
minSeldDate: this.minSeldDate,
maxSeldDate: this.maxSeldDate,
calendarParam: this.calendarParam,
let param = [{
sInfo: {...this.skuInfo, buyNum: 1},
pInfo: {id:this.selectGoods.id, type:this.selectGoods.type,title:this.selectGoods.title},
allSeldDate: this.allSeldDate,
seldDateIndex: this.seldDateIndex,
timesArr: this.timesArr,
seldTimeIndex: this.seldTimeIndex,
};
}];
console.log(param)
uni.setStorageSync('ticketOrder', JSON.stringify(param));
// that.gotoBuy(pInfo, sInfo);
uni.navigateTo({
url:'/subPackages/ticketBooking/order',
url:'/subPackages/ticket/order',
})
},
gotoBuy(pInfo, sInfo) {
console.log(pInfo, sInfo);
let that = this;
if (
(pInfo.flag != 1 || sInfo.flag !== "on" || sInfo.stock <= 0) &&
sInfo.is_third_stock == 0
)
return;
let params = {
pInfo: pInfo,
sInfo: sInfo,
minSeldDate: this.minSeldDate,
maxSeldDate: this.maxSeldDate,
calendarParam: this.calendarParam,
allSeldDate: this.allSeldDate,
seldDateIndex: this.seldDateIndex,
timesArr: this.timesArr,
seldTimeIndex: this.seldTimeIndex,
};
if (that.detail.allowance) {
sInfo.allowance_data = that.detail.allowance;
let spread_price = Number(
sInfo.allowance_data.discount_limit_price -
sInfo.allowance_data.user_used_price
);
if (spread_price > 0) {
if (
spread_price <
(sInfo.allowance_data.discount_rate / 100) *
sInfo.price
)
sInfo.allowance_price = spread_price;
else
sInfo.allowance_price =
(sInfo.allowance_data.discount_rate / 100) *
sInfo.price;
}
}
},
closePopup() {
this.$refs.popup.close()
},
@ -497,7 +583,7 @@
.common-container{
background: white;
border-radius: 20rpx;
margin-bottom: 30rpx;
margin-bottom: 20rpx;
padding: 22rpx 26rpx;
}
@ -568,18 +654,29 @@
.box-title {
font-weight: normal;
font-weight: bold;
font-size: 35rpx;
color: #6A8A27;
padding-bottom: 20rpx;
border-bottom: 1px solid #D9D9D9;
display: flex;
align-items: center;
.box-title-line{
width: 2rpx;
height: 23rpx;
background: #000;
margin: 0 20rpx;
}
}
.address-icon{
margin-right: 9rpx;
width: 26rpx;
height: 26rpx;
.box-content{
padding-top: 22rpx;
.sm-box-title{
font-weight: bold;
font-size: 29rpx;
color: #000000;
padding: 58rpx 0 25rpx;
}
}
.scenic-list{
padding: 10rpx 10rpx 0;
.scenic-title{
@ -653,10 +750,67 @@
}
}
.bottom {
.notice {
.btn-box {
width: 750rpx;
height: 133rpx;
background: #FFFFFF;
box-shadow: 0rpx 0rpx 16rpx 0rpx rgba(6,0,1,0.1);
position: fixed;
left: 0;
bottom: 0;
display: flex;
align-items: center;
justify-content: space-between;
z-index: 10;
padding: 0 46rpx;
.icon-container{
font-weight: 400;
color: #0B898E;
font-size: 23rpx;
color: #666666;
text-align: center;
.icon-item{
display: flex;
align-items: center;
flex-direction: column;
width: 44rpx;
image{
width: 44rpx;
height: 42rpx;
margin-bottom: 8rpx;
}
}
}
.btn{
width: 200rpx;
height: 60rpx;
background: #6A8A27;
border-radius: 11rpx;
font-weight: 500;
font-size: 31rpx;
color: #FFFFFF;
line-height: 60rpx;
text-align: center;
}
}
.add-cart-icon{
width: 80rpx;
height: 80rpx;
background: #FFFFFF;
box-shadow: 0rpx 0rpx 20rpx 0rpx rgba(0,0,0,0.2);
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
position: fixed;
bottom: 140rpx;
right: 20rpx;
z-index: 10;
image{
width: 43.33rpx;
height: 42rpx;
}
}
@ -696,11 +850,11 @@
height: 133rpx;
background: white;
border-radius: 10rpx;
border: 1px solid #000000;
background: #FFFFFF;
font-family: PingFang SC;
font-weight: 500;
font-size: 27rpx;
color: #111;
color: #6A8A27;
display: flex;
flex-direction: row;
align-items: center;
@ -723,7 +877,6 @@
width: 120rpx;
height: 133rpx;
border-radius: 10rpx;
border: 1px solid #000000;
margin-right: 24rpx;
font-family: PingFang SC;
font-weight: 500;
@ -735,20 +888,20 @@
justify-content: space-around;
flex-shrink: 0;
padding: 6rpx 0;
background: #F5F5F5;
}
.item.active{
background: #515150;
background: #6A8A27;
color: white;
border: 1px solid #12293C;
.price{color: white;}
}
.item.disabled{
color: #666;
border-color: #CCC;
background: #F5F5F5;
color: #999999;
}
.price{
color: #C3282E;
color: #EE3E3B;
}
}
@ -774,20 +927,20 @@
font-family: PingFangSC;
font-weight: 400;
font-size: 25rpx;
border: 1px solid #333333;
line-height: 58rpx;
color: #000;
background: #F5F5F5;
}
.time-active {
background: #515150;
background: #6A8A27;
color: white;
border: 1px solid #12293C;
}
.time-disable {
color: #666666;
border-color: #CCC;
background: #F5F5F5;
color: #999999;
}
}
.sku-bottom {
width: 100%;
height: 166rpx;
@ -810,7 +963,7 @@
.bottom-price {
font-size: 48rpx;
font-weight: bold;
color: #C3282E;
color: #D62828;
}
.bottom-price::before {
font-size: 24rpx;
@ -820,31 +973,21 @@
.bottom-btn {
width: 250rpx;
height: 80rpx;
background: #C3282E;
border-radius: 40rpx;
background: #6A8A27;
border-radius: 11rpx;
font-weight: bold;
font-size: 32rpx;
text-align: center;
font-weight: bold;
color: #FFFFFF;
line-height: 78rpx;
}
}
.address-title{
display: flex;
align-items: flex-start;
.address-detail{
font-size: 27rpx;
color: #666666;
padding-right: 40rpx;
line-height: 80rpx;
}
}
/deep/ .uni-calendar-item--extra{
color: #333 !important;
color: #EE3E3B !important;
}
/deep/ .uni-calendar-item--isDay{
background: #525251 !important;
background: #6A8A27 !important;
border-radius: 50%;
.uni-calendar-item--extra{
@ -853,7 +996,7 @@
}
/deep/ .uni-calendar-item--checked{
background: #525251 !important;
background: #6A8A27 !important;
border-radius: 50%;
.uni-calendar-item--extra{

64
subPackages/ticket/index.vue

@ -10,14 +10,15 @@
<image class="left-image" :src="showImg(item.headimg||'')" mode="aspectFill"></image>
<view class="contentBox flex-column flex-1 w-1rpx">
<view class="title text-overflowRows">{{item.title}}</view>
<view class="subtitle flex">
<view class="text-overflow">{{item.address}}</view>
<view class="subtitle text-overflow" v-if="item.display_tags" style="font-size: 24rpx;color: #6A8A27;">
{{item.display_tags.split(',').join(" | ")}}
</view>
<view class="priceBox">
<view class="price price-money">
{{item.price/100}}
</view>
<view class="subtitle text-overflowRows">{{item.address}}</view>
<view class="price price-money">
{{item.price/100}}
</view>
</view>
</view>
</view>
@ -102,22 +103,11 @@
}
.bg{
min-height: 100vh;
background: #FFFFFF;
background: #F9FCF3;
}
.topImg{
width: 100%;
height: 440rpx;
.icon-back{
position: fixed;
display: flex;
align-items: center;
z-index: 50;
background: rgba(0,0,0,0.5);
border-radius: 50%;
width: 60rpx;
height: 60rpx;
padding-left: 5rpx;
}
}
@ -128,54 +118,44 @@
.goodItem{
width: 100%;
height: 226rpx;
background: #FFFFFF;
box-shadow: 0rpx 0rpx 9rpx 0rpx rgba(153,153,153,0.38);
margin-bottom: 26rpx;
height: 240rpx;
margin-bottom: 30rpx;
display: flex;
border-radius: 13rpx;
.left-image{
width: 280rpx;
height: 226rpx;
border-radius: 13rpx;
width: 240rpx;
height: 100%;
border-radius: 20rpx;
flex-shrink: 0;
}
.contentBox{
padding: 20rpx;
padding: 10rpx 20rpx 0;
height: 100%;
justify-content: space-between;
.title{
width: 100%;
font-weight: bold;
font-size: 31rpx;
color: #000000;
color: #333333;
}
.subtitle{
font-weight: 500;
font-size: 27rpx;
color: #666666;
align-items: center;
.address-icon{
width: 21rpx;
height: 25rpx;
margin-right: 9rpx;
}
font-weight: 400;
font-size: 23rpx;
color: #999999;
}
.priceBox{
.price{
font-family: PingFang SC;
font-weight: bold;
font-size: 33rpx;
color: #C3282E;
color: #DC2525;
text-align: right;
}
.price-money::before{
content: '¥';
color: #C3282E;
font-size: 24rpx;
}
.price-money::after{
@ -184,7 +164,7 @@
font-size: 24rpx;
font-weight: normal;
}
}
}
}
}

1177
subPackages/ticket/order.vue

File diff suppressed because it is too large

20
uni_modules/uni-calendar/changelog.md

@ -1,17 +1,25 @@
## 1.4.11(2024-01-10)
- 修复 回到今天时,月份显示不一致问题
## 1.4.10(2023-04-10)
- 修复 某些情况 monthSwitch 未触发的Bug
## 1.4.9(2023-02-02)
- 修复 某些情况切换月份错误的Bug
## 1.4.8(2023-01-30)
- 修复 某些情况切换月份错误的Bug [详情](https://ask.dcloud.net.cn/question/161964)
## 1.4.7(2022-09-16)
- 可以使用 uni-scss 控制主题色
- 优化 支持使用 uni-scss 控制主题色
## 1.4.6(2022-09-08)
- fix: 表头年月切换,导致改变当前日期为选择月1号,且未触发change事件
- 修复 表头年月切换,导致改变当前日期为选择月1号,且未触发change事件的Bug
## 1.4.5(2022-02-25)
- 修复 条件编译 nvue 不支持的 css 样式
- 修复 条件编译 nvue 不支持的 css 样式的Bug
## 1.4.4(2022-02-25)
- 修复 条件编译 nvue 不支持的 css 样式
- 修复 条件编译 nvue 不支持的 css 样式的Bug
## 1.4.3(2021-09-22)
- 修复 startDate、 endDate 属性失效的 bug
- 修复 startDate、 endDate 属性失效的Bug
## 1.4.2(2021-08-24)
- 新增 支持国际化
## 1.4.1(2021-08-05)
- 修复 弹出层被 tabbar 遮盖 bug
- 修复 弹出层被 tabbar 遮盖的Bug
## 1.4.0(2021-07-30)
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 1.3.16(2021-05-12)

14
uni_modules/uni-calendar/components/uni-calendar/uni-calendar-item.vue

@ -9,7 +9,7 @@
}"
@click="choiceDate(weeks)">
<view class="uni-calendar-item__weeks-box-item">
<text v-if="selected&&weeks.extraInfo" class="uni-calendar-item__weeks-box-circle"></text>
<text v-if="selected&&weeks.extraInfo&&!weeks.extraInfo.notNeedDot" class="uni-calendar-item__weeks-box-circle"></text>
<text class="uni-calendar-item__weeks-box-text" :class="{
'uni-calendar-item--isDay-text': weeks.isDay,
'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay,
@ -51,11 +51,10 @@
</template>
<script>
import {
initVueI18n
} from '@dcloudio/uni-i18n'
import messages from './i18n/index.js'
const { t } = initVueI18n(messages)
import { initVueI18n } from '@dcloudio/uni-i18n'
import i18nMessages from './i18n/index.js'
const { t } = initVueI18n(i18nMessages)
export default {
emits:['change'],
props: {
@ -152,7 +151,8 @@
}
.uni-calendar-item--isDay-text {
color: $uni-primary;
// color: $uni-primary;
color: #C3282E;
}
.uni-calendar-item--isDay {

45
uni_modules/uni-calendar/components/uni-calendar/uni-calendar.vue

@ -20,7 +20,7 @@
<view class="uni-calendar__header-btn-box" @click.stop="next">
<view class="uni-calendar__header-btn uni-calendar--right"></view>
</view>
<text class="uni-calendar__backtoday" @click="backtoday">{{todayText}}</text>
<text class="uni-calendar__backtoday" @click="backToday">{{todayText}}</text>
</view>
<view class="uni-calendar__box">
@ -62,12 +62,12 @@
<script>
import Calendar from './util.js';
import calendarItem from './uni-calendar-item.vue'
import {
initVueI18n
} from '@dcloudio/uni-i18n'
import messages from './i18n/index.js'
const { t } = initVueI18n(messages)
import CalendarItem from './uni-calendar-item.vue'
import { initVueI18n } from '@dcloudio/uni-i18n'
import i18nMessages from './i18n/index.js'
const { t } = initVueI18n(i18nMessages)
/**
* Calendar 日历
* @description 日历组件可以查看日期选择任意范围内的日期打点操作常用场景如酒店日期预订火车机票选择购买日期上下班打卡等
@ -90,7 +90,7 @@
*/
export default {
components: {
calendarItem
CalendarItem
},
emits:['close','confirm','change','monthSwitch'],
props: {
@ -199,26 +199,26 @@
}
},
created() {
//
this.cale = new Calendar({
// date: new Date(),
selected: this.selected,
startDate: this.startDate,
endDate: this.endDate,
range: this.range,
})
//
// this.cale.setDate(this.date)
this.init(this.date)
// this.setDay
},
methods: {
// 穿
clean() {},
bindDateChange(e) {
const value = e.detail.value + '-1'
console.log(this.cale.getDate(value));
this.setDate(value)
const { year,month } = this.cale.getDate(value)
this.$emit('monthSwitch', {
year,
month
})
},
/**
* 初始化日期显示
@ -323,11 +323,17 @@
/**
* 回到今天
*/
backtoday() {
console.log(this.cale.getDate(new Date()).fullDate);
let date = this.cale.getDate(new Date()).fullDate
// this.cale.setDate(date)
this.init(date)
backToday() {
const nowYearMonth = `${this.nowDate.year}-${this.nowDate.month}`
const date = this.cale.getDate(new Date())
const todayYearMonth = `${date.year}-${date.month}`
this.init(date.fullDate)
if(nowYearMonth !== todayYearMonth) {
this.monthSwitch()
}
this.change()
},
/**
@ -446,7 +452,6 @@
.uni-calendar--fixed-width {
width: 50px;
// padding: 0 15px;
}
.uni-calendar__backtoday {

14
uni_modules/uni-calendar/components/uni-calendar/util.js

@ -76,10 +76,20 @@ class Calendar {
dd.setDate(dd.getDate() + AddDayCount) // 获取AddDayCount天后的日期
break
case 'month':
if (dd.getDate() === 31) {
if (dd.getDate() === 31 && AddDayCount>0) {
dd.setDate(dd.getDate() + AddDayCount)
} else {
dd.setMonth(dd.getMonth() + AddDayCount) // 获取AddDayCount天后的日期
const preMonth = dd.getMonth()
dd.setMonth(preMonth + AddDayCount) // 获取AddDayCount天后的日期
const nextMonth = dd.getMonth()
// 处理 pre 切换月份目标月份为2月没有当前日(30 31) 切换错误问题
if(AddDayCount<0 && preMonth!==0 && nextMonth-preMonth>AddDayCount){
dd.setMonth(nextMonth+(nextMonth-preMonth+AddDayCount))
}
// 处理 next 切换月份目标月份为2月没有当前日(30 31) 切换错误问题
if(AddDayCount>0 && nextMonth-preMonth>AddDayCount){
dd.setMonth(nextMonth-(nextMonth-preMonth-AddDayCount))
}
}
break
case 'year':

2
uni_modules/uni-calendar/package.json

@ -1,7 +1,7 @@
{
"id": "uni-calendar",
"displayName": "uni-calendar 日历",
"version": "1.4.7",
"version": "1.4.11",
"description": "日历组件",
"keywords": [
"uni-ui",

4
uni_modules/uni-calendar/readme.md

@ -77,7 +77,7 @@ export default {
### Calendar Props
| 属性名 | 类型 | 默认值| 说明 |
| | |
| - | - | - | - |
| date | String |- | 自定义当前时间,默认为今天 |
| lunar | Boolean | false | 显示农历 |
| startDate | String |- | 日期选择范围-开始日期 |
@ -91,7 +91,7 @@ export default {
### Calendar Events
| 事件名 | 说明 |返回值|
| | | |
| - | - | - |
| open | 弹出日历组件,`insert :false` 时生效|- |

Loading…
Cancel
Save