dk-dropdown-date.wxml 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <!--界面日期下拉组件-->
  2. <wxs module="mDate">
  3. var format = function (time) {
  4. var date = getDate(time);
  5. var year = date.getFullYear()
  6. var month = date.getMonth() + 1
  7. var day = date.getDate()
  8. return year + '-' + month + '-' + day
  9. }
  10. module.exports.format = format;
  11. </wxs>
  12. <van-cell catchtap="choose" data-item="{{item}}" wx:for="{{dateTypeList}}"
  13. title-class="{{item.value == dateDefault.value?'blue-blue':''}}" wx:key="index" title="{{item.text}}">
  14. <van-icon wx:if="{{item.value == dateDefault.value && item.value != -2}}" slot="right-icon" name="success"
  15. class="blue-blue" />
  16. <view wx:if="{{item.value == dateDefault.value && item.value == -2}}" slot="right-icon" class="blue-blue">
  17. {{mDate.format(dateSearch[0])}} - {{mDate.format(dateSearch[1]) }}
  18. </view>
  19. </van-cell>
  20. <!-- 日期 -->
  21. <view class="drop-open" wx:if="{{show}}">
  22. <van-popup show="{{ show }}" custom-style="border-radius:30rpx 30rpx 0 0;" position="bottom" bind:close="onCloseChooseDate" bind:click-overlay="onCloseChooseDate">
  23. <view style="display:flex;justify-content: space-around;height:80rpx;">
  24. <view style="line-height:36rpx;width:45%;text-align: left;color:#2E3853;font-size:28rpx;font-weight:400;line-height:80rpx;" catchtap="onCloseChooseDate">取消</view>
  25. <view style="line-height:36rpx;width:45%;text-align: right;color:#00A7B5;font-size:28rpx;font-weight:400;line-height:80rpx;" catchtap="onConfirmChooseDate">确定</view>
  26. </view>
  27. <van-tabs active="{{ active }}" nav-class="nav-class" color="#00A7B5;">
  28. <van-tab title="从{{mDate.format(dateSearch[0])}}">
  29. <van-datetime-picker bindonlyinput="changeDate" show-toolbar="{{false}}" data-index="0" type="date" loading="{true}"
  30. value="{{ dateSearch[0] }}" />
  31. </van-tab>
  32. <van-tab title="到{{mDate.format(dateSearch[1])}}">
  33. <van-datetime-picker type="date" bindonlyinput="changeDate" show-toolbar="{{false}}" data-index="1" loading="{true}"
  34. value="{{ dateSearch[1] }}" />
  35. </van-tab>
  36. </van-tabs>
  37. </van-popup>
  38. </view>