已支付订单列表:where.payStatus = 1;

This commit is contained in:
2024-07-10 22:44:18 +08:00
parent 9dd834adb5
commit 1311eb03b8
611 changed files with 92828 additions and 400 deletions
@@ -0,0 +1,839 @@
"use strict";
var calendar = {
/**
* 农历1900-2100的润大小信息表
* @Array Of Property
* @return Hex
*/
lunarInfo: [
19416,
19168,
42352,
21717,
53856,
55632,
91476,
22176,
39632,
21970,
// 1900-1909
19168,
42422,
42192,
53840,
119381,
46400,
54944,
44450,
38320,
84343,
// 1910-1919
18800,
42160,
46261,
27216,
27968,
109396,
11104,
38256,
21234,
18800,
// 1920-1929
25958,
54432,
59984,
28309,
23248,
11104,
100067,
37600,
116951,
51536,
// 1930-1939
54432,
120998,
46416,
22176,
107956,
9680,
37584,
53938,
43344,
46423,
// 1940-1949
27808,
46416,
86869,
19872,
42416,
83315,
21168,
43432,
59728,
27296,
// 1950-1959
44710,
43856,
19296,
43748,
42352,
21088,
62051,
55632,
23383,
22176,
// 1960-1969
38608,
19925,
19152,
42192,
54484,
53840,
54616,
46400,
46752,
103846,
// 1970-1979
38320,
18864,
43380,
42160,
45690,
27216,
27968,
44870,
43872,
38256,
// 1980-1989
19189,
18800,
25776,
29859,
59984,
27480,
23232,
43872,
38613,
37600,
// 1990-1999
51552,
55636,
54432,
55888,
30034,
22176,
43959,
9680,
37584,
51893,
// 2000-2009
43344,
46240,
47780,
44368,
21977,
19360,
42416,
86390,
21168,
43312,
// 2010-2019
31060,
27296,
44368,
23378,
19296,
42726,
42208,
53856,
60005,
54576,
// 2020-2029
23200,
30371,
38608,
19195,
19152,
42192,
118966,
53840,
54560,
56645,
// 2030-2039
46496,
22224,
21938,
18864,
42359,
42160,
43600,
111189,
27936,
44448,
// 2040-2049
/** Add By JJonline@JJonline.Cn**/
84835,
37744,
18936,
18800,
25776,
92326,
59984,
27424,
108228,
43744,
// 2050-2059
41696,
53987,
51552,
54615,
54432,
55888,
23893,
22176,
42704,
21972,
// 2060-2069
21200,
43448,
43344,
46240,
46758,
44368,
21920,
43940,
42416,
21168,
// 2070-2079
45683,
26928,
29495,
27296,
44368,
84821,
19296,
42352,
21732,
53600,
// 2080-2089
59752,
54560,
55968,
92838,
22224,
19168,
43476,
41680,
53584,
62034,
// 2090-2099
54560
],
// 2100
/**
* 公历每个月份的天数普通表
* @Array Of Property
* @return Number
*/
solarMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
/**
* 天干地支之天干速查表
* @Array Of Property trans["甲","乙","丙","丁","戊","己","庚","辛","壬","癸"]
* @return Cn string
*/
Gan: ["甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸"],
/**
* 天干地支之地支速查表
* @Array Of Property
* @trans["子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥"]
* @return Cn string
*/
Zhi: ["子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥"],
/**
* 天干地支之地支速查表<=>生肖
* @Array Of Property
* @trans["鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗","猪"]
* @return Cn string
*/
Animals: ["鼠", "牛", "虎", "兔", "龙", "蛇", "马", "羊", "猴", "鸡", "狗", "猪"],
/**
* 24节气速查表
* @Array Of Property
* @trans["小寒","大寒","立春","雨水","惊蛰","春分","清明","谷雨","立夏","小满","芒种","夏至","小暑","大暑","立秋","处暑","白露","秋分","寒露","霜降","立冬","小雪","大雪","冬至"]
* @return Cn string
*/
solarTerm: ["小寒", "大寒", "立春", "雨水", "惊蛰", "春分", "清明", "谷雨", "立夏", "小满", "芒种", "夏至", "小暑", "大暑", "立秋", "处暑", "白露", "秋分", "寒露", "霜降", "立冬", "小雪", "大雪", "冬至"],
/**
* 1900-2100各年的24节气日期速查表
* @Array Of Property
* @return 0x string For splice
*/
sTermInfo: [
"9778397bd097c36b0b6fc9274c91aa",
"97b6b97bd19801ec9210c965cc920e",
"97bcf97c3598082c95f8c965cc920f",
"97bd0b06bdb0722c965ce1cfcc920f",
"b027097bd097c36b0b6fc9274c91aa",
"97b6b97bd19801ec9210c965cc920e",
"97bcf97c359801ec95f8c965cc920f",
"97bd0b06bdb0722c965ce1cfcc920f",
"b027097bd097c36b0b6fc9274c91aa",
"97b6b97bd19801ec9210c965cc920e",
"97bcf97c359801ec95f8c965cc920f",
"97bd0b06bdb0722c965ce1cfcc920f",
"b027097bd097c36b0b6fc9274c91aa",
"9778397bd19801ec9210c965cc920e",
"97b6b97bd19801ec95f8c965cc920f",
"97bd09801d98082c95f8e1cfcc920f",
"97bd097bd097c36b0b6fc9210c8dc2",
"9778397bd197c36c9210c9274c91aa",
"97b6b97bd19801ec95f8c965cc920e",
"97bd09801d98082c95f8e1cfcc920f",
"97bd097bd097c36b0b6fc9210c8dc2",
"9778397bd097c36c9210c9274c91aa",
"97b6b97bd19801ec95f8c965cc920e",
"97bcf97c3598082c95f8e1cfcc920f",
"97bd097bd097c36b0b6fc9210c8dc2",
"9778397bd097c36c9210c9274c91aa",
"97b6b97bd19801ec9210c965cc920e",
"97bcf97c3598082c95f8c965cc920f",
"97bd097bd097c35b0b6fc920fb0722",
"9778397bd097c36b0b6fc9274c91aa",
"97b6b97bd19801ec9210c965cc920e",
"97bcf97c3598082c95f8c965cc920f",
"97bd097bd097c35b0b6fc920fb0722",
"9778397bd097c36b0b6fc9274c91aa",
"97b6b97bd19801ec9210c965cc920e",
"97bcf97c359801ec95f8c965cc920f",
"97bd097bd097c35b0b6fc920fb0722",
"9778397bd097c36b0b6fc9274c91aa",
"97b6b97bd19801ec9210c965cc920e",
"97bcf97c359801ec95f8c965cc920f",
"97bd097bd097c35b0b6fc920fb0722",
"9778397bd097c36b0b6fc9274c91aa",
"97b6b97bd19801ec9210c965cc920e",
"97bcf97c359801ec95f8c965cc920f",
"97bd097bd07f595b0b6fc920fb0722",
"9778397bd097c36b0b6fc9210c8dc2",
"9778397bd19801ec9210c9274c920e",
"97b6b97bd19801ec95f8c965cc920f",
"97bd07f5307f595b0b0bc920fb0722",
"7f0e397bd097c36b0b6fc9210c8dc2",
"9778397bd097c36c9210c9274c920e",
"97b6b97bd19801ec95f8c965cc920f",
"97bd07f5307f595b0b0bc920fb0722",
"7f0e397bd097c36b0b6fc9210c8dc2",
"9778397bd097c36c9210c9274c91aa",
"97b6b97bd19801ec9210c965cc920e",
"97bd07f1487f595b0b0bc920fb0722",
"7f0e397bd097c36b0b6fc9210c8dc2",
"9778397bd097c36b0b6fc9274c91aa",
"97b6b97bd19801ec9210c965cc920e",
"97bcf7f1487f595b0b0bb0b6fb0722",
"7f0e397bd097c35b0b6fc920fb0722",
"9778397bd097c36b0b6fc9274c91aa",
"97b6b97bd19801ec9210c965cc920e",
"97bcf7f1487f595b0b0bb0b6fb0722",
"7f0e397bd097c35b0b6fc920fb0722",
"9778397bd097c36b0b6fc9274c91aa",
"97b6b97bd19801ec9210c965cc920e",
"97bcf7f1487f531b0b0bb0b6fb0722",
"7f0e397bd097c35b0b6fc920fb0722",
"9778397bd097c36b0b6fc9274c91aa",
"97b6b97bd19801ec9210c965cc920e",
"97bcf7f1487f531b0b0bb0b6fb0722",
"7f0e397bd07f595b0b6fc920fb0722",
"9778397bd097c36b0b6fc9274c91aa",
"97b6b97bd19801ec9210c9274c920e",
"97bcf7f0e47f531b0b0bb0b6fb0722",
"7f0e397bd07f595b0b0bc920fb0722",
"9778397bd097c36b0b6fc9210c91aa",
"97b6b97bd197c36c9210c9274c920e",
"97bcf7f0e47f531b0b0bb0b6fb0722",
"7f0e397bd07f595b0b0bc920fb0722",
"9778397bd097c36b0b6fc9210c8dc2",
"9778397bd097c36c9210c9274c920e",
"97b6b7f0e47f531b0723b0b6fb0722",
"7f0e37f5307f595b0b0bc920fb0722",
"7f0e397bd097c36b0b6fc9210c8dc2",
"9778397bd097c36b0b70c9274c91aa",
"97b6b7f0e47f531b0723b0b6fb0721",
"7f0e37f1487f595b0b0bb0b6fb0722",
"7f0e397bd097c35b0b6fc9210c8dc2",
"9778397bd097c36b0b6fc9274c91aa",
"97b6b7f0e47f531b0723b0b6fb0721",
"7f0e27f1487f595b0b0bb0b6fb0722",
"7f0e397bd097c35b0b6fc920fb0722",
"9778397bd097c36b0b6fc9274c91aa",
"97b6b7f0e47f531b0723b0b6fb0721",
"7f0e27f1487f531b0b0bb0b6fb0722",
"7f0e397bd097c35b0b6fc920fb0722",
"9778397bd097c36b0b6fc9274c91aa",
"97b6b7f0e47f531b0723b0b6fb0721",
"7f0e27f1487f531b0b0bb0b6fb0722",
"7f0e397bd097c35b0b6fc920fb0722",
"9778397bd097c36b0b6fc9274c91aa",
"97b6b7f0e47f531b0723b0b6fb0721",
"7f0e27f1487f531b0b0bb0b6fb0722",
"7f0e397bd07f595b0b0bc920fb0722",
"9778397bd097c36b0b6fc9274c91aa",
"97b6b7f0e47f531b0723b0787b0721",
"7f0e27f0e47f531b0b0bb0b6fb0722",
"7f0e397bd07f595b0b0bc920fb0722",
"9778397bd097c36b0b6fc9210c91aa",
"97b6b7f0e47f149b0723b0787b0721",
"7f0e27f0e47f531b0723b0b6fb0722",
"7f0e397bd07f595b0b0bc920fb0722",
"9778397bd097c36b0b6fc9210c8dc2",
"977837f0e37f149b0723b0787b0721",
"7f07e7f0e47f531b0723b0b6fb0722",
"7f0e37f5307f595b0b0bc920fb0722",
"7f0e397bd097c35b0b6fc9210c8dc2",
"977837f0e37f14998082b0787b0721",
"7f07e7f0e47f531b0723b0b6fb0721",
"7f0e37f1487f595b0b0bb0b6fb0722",
"7f0e397bd097c35b0b6fc9210c8dc2",
"977837f0e37f14998082b0787b06bd",
"7f07e7f0e47f531b0723b0b6fb0721",
"7f0e27f1487f531b0b0bb0b6fb0722",
"7f0e397bd097c35b0b6fc920fb0722",
"977837f0e37f14998082b0787b06bd",
"7f07e7f0e47f531b0723b0b6fb0721",
"7f0e27f1487f531b0b0bb0b6fb0722",
"7f0e397bd097c35b0b6fc920fb0722",
"977837f0e37f14998082b0787b06bd",
"7f07e7f0e47f531b0723b0b6fb0721",
"7f0e27f1487f531b0b0bb0b6fb0722",
"7f0e397bd07f595b0b0bc920fb0722",
"977837f0e37f14998082b0787b06bd",
"7f07e7f0e47f531b0723b0b6fb0721",
"7f0e27f1487f531b0b0bb0b6fb0722",
"7f0e397bd07f595b0b0bc920fb0722",
"977837f0e37f14998082b0787b06bd",
"7f07e7f0e47f149b0723b0787b0721",
"7f0e27f0e47f531b0b0bb0b6fb0722",
"7f0e397bd07f595b0b0bc920fb0722",
"977837f0e37f14998082b0723b06bd",
"7f07e7f0e37f149b0723b0787b0721",
"7f0e27f0e47f531b0723b0b6fb0722",
"7f0e397bd07f595b0b0bc920fb0722",
"977837f0e37f14898082b0723b02d5",
"7ec967f0e37f14998082b0787b0721",
"7f07e7f0e47f531b0723b0b6fb0722",
"7f0e37f1487f595b0b0bb0b6fb0722",
"7f0e37f0e37f14898082b0723b02d5",
"7ec967f0e37f14998082b0787b0721",
"7f07e7f0e47f531b0723b0b6fb0722",
"7f0e37f1487f531b0b0bb0b6fb0722",
"7f0e37f0e37f14898082b0723b02d5",
"7ec967f0e37f14998082b0787b06bd",
"7f07e7f0e47f531b0723b0b6fb0721",
"7f0e37f1487f531b0b0bb0b6fb0722",
"7f0e37f0e37f14898082b072297c35",
"7ec967f0e37f14998082b0787b06bd",
"7f07e7f0e47f531b0723b0b6fb0721",
"7f0e27f1487f531b0b0bb0b6fb0722",
"7f0e37f0e37f14898082b072297c35",
"7ec967f0e37f14998082b0787b06bd",
"7f07e7f0e47f531b0723b0b6fb0721",
"7f0e27f1487f531b0b0bb0b6fb0722",
"7f0e37f0e366aa89801eb072297c35",
"7ec967f0e37f14998082b0787b06bd",
"7f07e7f0e47f149b0723b0787b0721",
"7f0e27f1487f531b0b0bb0b6fb0722",
"7f0e37f0e366aa89801eb072297c35",
"7ec967f0e37f14998082b0723b06bd",
"7f07e7f0e47f149b0723b0787b0721",
"7f0e27f0e47f531b0723b0b6fb0722",
"7f0e37f0e366aa89801eb072297c35",
"7ec967f0e37f14998082b0723b06bd",
"7f07e7f0e37f14998083b0787b0721",
"7f0e27f0e47f531b0723b0b6fb0722",
"7f0e37f0e366aa89801eb072297c35",
"7ec967f0e37f14898082b0723b02d5",
"7f07e7f0e37f14998082b0787b0721",
"7f07e7f0e47f531b0723b0b6fb0722",
"7f0e36665b66aa89801e9808297c35",
"665f67f0e37f14898082b0723b02d5",
"7ec967f0e37f14998082b0787b0721",
"7f07e7f0e47f531b0723b0b6fb0722",
"7f0e36665b66a449801e9808297c35",
"665f67f0e37f14898082b0723b02d5",
"7ec967f0e37f14998082b0787b06bd",
"7f07e7f0e47f531b0723b0b6fb0721",
"7f0e36665b66a449801e9808297c35",
"665f67f0e37f14898082b072297c35",
"7ec967f0e37f14998082b0787b06bd",
"7f07e7f0e47f531b0723b0b6fb0721",
"7f0e26665b66a449801e9808297c35",
"665f67f0e37f1489801eb072297c35",
"7ec967f0e37f14998082b0787b06bd",
"7f07e7f0e47f531b0723b0b6fb0721",
"7f0e27f1487f531b0b0bb0b6fb0722"
],
/**
* 数字转中文速查表
* @Array Of Property
* @trans ['日','一','二','三','四','五','六','七','八','九','十']
* @return Cn string
*/
nStr1: ["日", "一", "二", "三", "四", "五", "六", "七", "八", "九", "十"],
/**
* 日期转农历称呼速查表
* @Array Of Property
* @trans ['初','十','廿','卅']
* @return Cn string
*/
nStr2: ["初", "十", "廿", "卅"],
/**
* 月份转农历称呼速查表
* @Array Of Property
* @trans ['正','一','二','三','四','五','六','七','八','九','十','冬','腊']
* @return Cn string
*/
nStr3: ["正", "二", "三", "四", "五", "六", "七", "八", "九", "十", "冬", "腊"],
/**
* 返回农历y年一整年的总天数
* @param lunar Year
* @return Number
* @eg:var count = calendar.lYearDays(1987) ;//count=387
*/
lYearDays: function(y) {
var i;
var sum = 348;
for (i = 32768; i > 8; i >>= 1) {
sum += this.lunarInfo[y - 1900] & i ? 1 : 0;
}
return sum + this.leapDays(y);
},
/**
* 返回农历y年闰月是哪个月;若y年没有闰月 则返回0
* @param lunar Year
* @return Number (0-12)
* @eg:var leapMonth = calendar.leapMonth(1987) ;//leapMonth=6
*/
leapMonth: function(y) {
return this.lunarInfo[y - 1900] & 15;
},
/**
* 返回农历y年闰月的天数 若该年没有闰月则返回0
* @param lunar Year
* @return Number (0、29、30)
* @eg:var leapMonthDay = calendar.leapDays(1987) ;//leapMonthDay=29
*/
leapDays: function(y) {
if (this.leapMonth(y)) {
return this.lunarInfo[y - 1900] & 65536 ? 30 : 29;
}
return 0;
},
/**
* 返回农历y年m月(非闰月)的总天数,计算m为闰月时的天数请使用leapDays方法
* @param lunar Year
* @return Number (-1、29、30)
* @eg:var MonthDay = calendar.monthDays(1987,9) ;//MonthDay=29
*/
monthDays: function(y, m) {
if (m > 12 || m < 1) {
return -1;
}
return this.lunarInfo[y - 1900] & 65536 >> m ? 30 : 29;
},
/**
* 返回公历(!)y年m月的天数
* @param solar Year
* @return Number (-1、28、29、30、31)
* @eg:var solarMonthDay = calendar.leapDays(1987) ;//solarMonthDay=30
*/
solarDays: function(y, m) {
if (m > 12 || m < 1) {
return -1;
}
var ms = m - 1;
if (ms == 1) {
return y % 4 == 0 && y % 100 != 0 || y % 400 == 0 ? 29 : 28;
} else {
return this.solarMonth[ms];
}
},
/**
* 农历年份转换为干支纪年
* @param lYear 农历年的年份数
* @return Cn string
*/
toGanZhiYear: function(lYear) {
var ganKey = (lYear - 3) % 10;
var zhiKey = (lYear - 3) % 12;
if (ganKey == 0) ganKey = 10;
if (zhiKey == 0) zhiKey = 12;
return this.Gan[ganKey - 1] + this.Zhi[zhiKey - 1];
},
/**
* 公历月、日判断所属星座
* @param cMonth [description]
* @param cDay [description]
* @return Cn string
*/
toAstro: function(cMonth, cDay) {
var s = "魔羯水瓶双鱼白羊金牛双子巨蟹狮子处女天秤天蝎射手魔羯";
var arr = [20, 19, 21, 21, 21, 22, 23, 23, 23, 23, 22, 22];
return s.substr(cMonth * 2 - (cDay < arr[cMonth - 1] ? 2 : 0), 2) + "座";
},
/**
* 传入offset偏移量返回干支
* @param offset 相对甲子的偏移量
* @return Cn string
*/
toGanZhi: function(offset) {
return this.Gan[offset % 10] + this.Zhi[offset % 12];
},
/**
* 传入公历(!)y年获得该年第n个节气的公历日期
* @param y公历年(1900-2100);n二十四节气中的第几个节气(1~24);从n=1(小寒)算起
* @return day Number
* @eg:var _24 = calendar.getTerm(1987,3) ;//_24=4;意即1987年2月4日立春
*/
getTerm: function(y, n) {
if (y < 1900 || y > 2100) {
return -1;
}
if (n < 1 || n > 24) {
return -1;
}
var _table = this.sTermInfo[y - 1900];
var _info = [
parseInt("0x" + _table.substr(0, 5)).toString(),
parseInt("0x" + _table.substr(5, 5)).toString(),
parseInt("0x" + _table.substr(10, 5)).toString(),
parseInt("0x" + _table.substr(15, 5)).toString(),
parseInt("0x" + _table.substr(20, 5)).toString(),
parseInt("0x" + _table.substr(25, 5)).toString()
];
var _calday = [
_info[0].substr(0, 1),
_info[0].substr(1, 2),
_info[0].substr(3, 1),
_info[0].substr(4, 2),
_info[1].substr(0, 1),
_info[1].substr(1, 2),
_info[1].substr(3, 1),
_info[1].substr(4, 2),
_info[2].substr(0, 1),
_info[2].substr(1, 2),
_info[2].substr(3, 1),
_info[2].substr(4, 2),
_info[3].substr(0, 1),
_info[3].substr(1, 2),
_info[3].substr(3, 1),
_info[3].substr(4, 2),
_info[4].substr(0, 1),
_info[4].substr(1, 2),
_info[4].substr(3, 1),
_info[4].substr(4, 2),
_info[5].substr(0, 1),
_info[5].substr(1, 2),
_info[5].substr(3, 1),
_info[5].substr(4, 2)
];
return parseInt(_calday[n - 1]);
},
/**
* 传入农历数字月份返回汉语通俗表示法
* @param lunar month
* @return Cn string
* @eg:var cnMonth = calendar.toChinaMonth(12) ;//cnMonth='腊月'
*/
toChinaMonth: function(m) {
if (m > 12 || m < 1) {
return -1;
}
var s = this.nStr3[m - 1];
s += "月";
return s;
},
/**
* 传入农历日期数字返回汉字表示法
* @param lunar day
* @return Cn string
* @eg:var cnDay = calendar.toChinaDay(21) ;//cnMonth='廿一'
*/
toChinaDay: function(d) {
var s;
switch (d) {
case 10:
s = "初十";
break;
case 20:
s = "二十";
break;
case 30:
s = "三十";
break;
default:
s = this.nStr2[Math.floor(d / 10)];
s += this.nStr1[d % 10];
}
return s;
},
/**
* 年份转生肖[!仅能大致转换] => 精确划分生肖分界线是“立春”
* @param y year
* @return Cn string
* @eg:var animal = calendar.getAnimal(1987) ;//animal='兔'
*/
getAnimal: function(y) {
return this.Animals[(y - 4) % 12];
},
/**
* 传入阳历年月日获得详细的公历、农历object信息 <=>JSON
* @param y solar year
* @param m solar month
* @param d solar day
* @return JSON object
* @eg:console.log(calendar.solar2lunar(1987,11,01));
*/
solar2lunar: function(y, m, d) {
if (y < 1900 || y > 2100) {
return -1;
}
if (y == 1900 && m == 1 && d < 31) {
return -1;
}
if (!y) {
var objDate = /* @__PURE__ */ new Date();
} else {
var objDate = new Date(y, parseInt(m) - 1, d);
}
var i;
var leap = 0;
var temp = 0;
var y = objDate.getFullYear();
var m = objDate.getMonth() + 1;
var d = objDate.getDate();
var offset = (Date.UTC(objDate.getFullYear(), objDate.getMonth(), objDate.getDate()) - Date.UTC(1900, 0, 31)) / 864e5;
for (i = 1900; i < 2101 && offset > 0; i++) {
temp = this.lYearDays(i);
offset -= temp;
}
if (offset < 0) {
offset += temp;
i--;
}
var isTodayObj = /* @__PURE__ */ new Date();
var isToday = false;
if (isTodayObj.getFullYear() == y && isTodayObj.getMonth() + 1 == m && isTodayObj.getDate() == d) {
isToday = true;
}
var nWeek = objDate.getDay();
var cWeek = this.nStr1[nWeek];
if (nWeek == 0) {
nWeek = 7;
}
var year = i;
var leap = this.leapMonth(i);
var isLeap = false;
for (i = 1; i < 13 && offset > 0; i++) {
if (leap > 0 && i == leap + 1 && isLeap == false) {
--i;
isLeap = true;
temp = this.leapDays(year);
} else {
temp = this.monthDays(year, i);
}
if (isLeap == true && i == leap + 1) {
isLeap = false;
}
offset -= temp;
}
if (offset == 0 && leap > 0 && i == leap + 1) {
if (isLeap) {
isLeap = false;
} else {
isLeap = true;
--i;
}
}
if (offset < 0) {
offset += temp;
--i;
}
var month = i;
var day = offset + 1;
var sm = m - 1;
var gzY = this.toGanZhiYear(year);
var firstNode = this.getTerm(y, m * 2 - 1);
var secondNode = this.getTerm(y, m * 2);
var gzM = this.toGanZhi((y - 1900) * 12 + m + 11);
if (d >= firstNode) {
gzM = this.toGanZhi((y - 1900) * 12 + m + 12);
}
var isTerm = false;
var Term = null;
if (firstNode == d) {
isTerm = true;
Term = this.solarTerm[m * 2 - 2];
}
if (secondNode == d) {
isTerm = true;
Term = this.solarTerm[m * 2 - 1];
}
var dayCyclical = Date.UTC(y, sm, 1, 0, 0, 0, 0) / 864e5 + 25567 + 10;
var gzD = this.toGanZhi(dayCyclical + d - 1);
var astro = this.toAstro(m, d);
return { "lYear": year, "lMonth": month, "lDay": day, "Animal": this.getAnimal(year), "IMonthCn": (isLeap ? "闰" : "") + this.toChinaMonth(month), "IDayCn": this.toChinaDay(day), "cYear": y, "cMonth": m, "cDay": d, "gzYear": gzY, "gzMonth": gzM, "gzDay": gzD, "isToday": isToday, "isLeap": isLeap, "nWeek": nWeek, "ncWeek": "星期" + cWeek, "isTerm": isTerm, "Term": Term, "astro": astro };
},
/**
* 传入农历年月日以及传入的月份是否闰月获得详细的公历、农历object信息 <=>JSON
* @param y lunar year
* @param m lunar month
* @param d lunar day
* @param isLeapMonth lunar month is leap or not.[如果是农历闰月第四个参数赋值true即可]
* @return JSON object
* @eg:console.log(calendar.lunar2solar(1987,9,10));
*/
lunar2solar: function(y, m, d, isLeapMonth) {
var isLeapMonth = !!isLeapMonth;
var leapMonth = this.leapMonth(y);
this.leapDays(y);
if (isLeapMonth && leapMonth != m) {
return -1;
}
if (y == 2100 && m == 12 && d > 1 || y == 1900 && m == 1 && d < 31) {
return -1;
}
var day = this.monthDays(y, m);
var _day = day;
if (isLeapMonth) {
_day = this.leapDays(y, m);
}
if (y < 1900 || y > 2100 || d > _day) {
return -1;
}
var offset = 0;
for (var i = 1900; i < y; i++) {
offset += this.lYearDays(i);
}
var leap = 0;
var isAdd = false;
for (var i = 1; i < m; i++) {
leap = this.leapMonth(y);
if (!isAdd) {
if (leap <= i && leap > 0) {
offset += this.leapDays(y);
isAdd = true;
}
}
offset += this.monthDays(y, i);
}
if (isLeapMonth) {
offset += day;
}
var stmap = Date.UTC(1900, 1, 30, 0, 0, 0);
var calObj = new Date((offset + d - 31) * 864e5 + stmap);
var cY = calObj.getUTCFullYear();
var cM = calObj.getUTCMonth() + 1;
var cD = calObj.getUTCDate();
return this.solar2lunar(cY, cM, cD);
}
};
exports.calendar = calendar;
@@ -0,0 +1,43 @@
"use strict";
const en = {
"uni-calender.ok": "ok",
"uni-calender.cancel": "cancel",
"uni-calender.today": "today",
"uni-calender.MON": "MON",
"uni-calender.TUE": "TUE",
"uni-calender.WED": "WED",
"uni-calender.THU": "THU",
"uni-calender.FRI": "FRI",
"uni-calender.SAT": "SAT",
"uni-calender.SUN": "SUN"
};
const zhHans = {
"uni-calender.ok": "确定",
"uni-calender.cancel": "取消",
"uni-calender.today": "今日",
"uni-calender.SUN": "日",
"uni-calender.MON": "一",
"uni-calender.TUE": "二",
"uni-calender.WED": "三",
"uni-calender.THU": "四",
"uni-calender.FRI": "五",
"uni-calender.SAT": "六"
};
const zhHant = {
"uni-calender.ok": "確定",
"uni-calender.cancel": "取消",
"uni-calender.today": "今日",
"uni-calender.SUN": "日",
"uni-calender.MON": "一",
"uni-calender.TUE": "二",
"uni-calender.WED": "三",
"uni-calender.THU": "四",
"uni-calender.FRI": "五",
"uni-calender.SAT": "六"
};
const i18nMessages = {
en,
"zh-Hans": zhHans,
"zh-Hant": zhHant
};
exports.i18nMessages = i18nMessages;
@@ -0,0 +1,97 @@
"use strict";
const common_vendor = require("../../../../common/vendor.js");
const uni_modules_uniCalendar_components_uniCalendar_i18n_index = require("./i18n/index.js");
const { t } = common_vendor.initVueI18n(uni_modules_uniCalendar_components_uniCalendar_i18n_index.i18nMessages);
const _sfc_main = {
emits: ["change"],
props: {
weeks: {
type: Object,
default() {
return {};
}
},
calendar: {
type: Object,
default: () => {
return {};
}
},
selected: {
type: Array,
default: () => {
return [];
}
},
lunar: {
type: Boolean,
default: false
}
},
computed: {
todayText() {
return t("uni-calender.today");
}
},
methods: {
choiceDate(weeks) {
this.$emit("change", weeks);
}
}
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: $props.selected && $props.weeks.extraInfo
}, $props.selected && $props.weeks.extraInfo ? {} : {}, {
b: common_vendor.t($props.weeks.date),
c: $props.weeks.isDay ? 1 : "",
d: $props.calendar.fullDate === $props.weeks.fullDate && $props.weeks.isDay ? 1 : "",
e: $props.calendar.fullDate === $props.weeks.fullDate && !$props.weeks.isDay ? 1 : "",
f: $props.weeks.beforeMultiple ? 1 : "",
g: $props.weeks.multiple ? 1 : "",
h: $props.weeks.afterMultiple ? 1 : "",
i: $props.weeks.disable ? 1 : "",
j: !$props.lunar && !$props.weeks.extraInfo && $props.weeks.isDay
}, !$props.lunar && !$props.weeks.extraInfo && $props.weeks.isDay ? {
k: common_vendor.t($options.todayText),
l: $props.weeks.isDay ? 1 : "",
m: $props.calendar.fullDate === $props.weeks.fullDate && $props.weeks.isDay ? 1 : "",
n: $props.calendar.fullDate === $props.weeks.fullDate && !$props.weeks.isDay ? 1 : "",
o: $props.weeks.beforeMultiple ? 1 : "",
p: $props.weeks.multiple ? 1 : "",
q: $props.weeks.afterMultiple ? 1 : ""
} : {}, {
r: $props.lunar && !$props.weeks.extraInfo
}, $props.lunar && !$props.weeks.extraInfo ? {
s: common_vendor.t($props.weeks.isDay ? $options.todayText : $props.weeks.lunar.IDayCn === "初一" ? $props.weeks.lunar.IMonthCn : $props.weeks.lunar.IDayCn),
t: $props.weeks.isDay ? 1 : "",
v: $props.calendar.fullDate === $props.weeks.fullDate && $props.weeks.isDay ? 1 : "",
w: $props.calendar.fullDate === $props.weeks.fullDate && !$props.weeks.isDay ? 1 : "",
x: $props.weeks.beforeMultiple ? 1 : "",
y: $props.weeks.multiple ? 1 : "",
z: $props.weeks.afterMultiple ? 1 : "",
A: $props.weeks.disable ? 1 : ""
} : {}, {
B: $props.weeks.extraInfo && $props.weeks.extraInfo.info
}, $props.weeks.extraInfo && $props.weeks.extraInfo.info ? {
C: common_vendor.t($props.weeks.extraInfo.info),
D: $props.weeks.extraInfo.info ? 1 : "",
E: $props.weeks.isDay ? 1 : "",
F: $props.calendar.fullDate === $props.weeks.fullDate && $props.weeks.isDay ? 1 : "",
G: $props.calendar.fullDate === $props.weeks.fullDate && !$props.weeks.isDay ? 1 : "",
H: $props.weeks.beforeMultiple ? 1 : "",
I: $props.weeks.multiple ? 1 : "",
J: $props.weeks.afterMultiple ? 1 : "",
K: $props.weeks.disable ? 1 : ""
} : {}, {
L: $props.weeks.disable ? 1 : "",
M: $props.calendar.fullDate === $props.weeks.fullDate && $props.weeks.isDay ? 1 : "",
N: $props.calendar.fullDate === $props.weeks.fullDate && !$props.weeks.isDay ? 1 : "",
O: $props.weeks.beforeMultiple ? 1 : "",
P: $props.weeks.multiple ? 1 : "",
Q: $props.weeks.afterMultiple ? 1 : "",
R: common_vendor.o(($event) => $options.choiceDate($props.weeks))
});
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-aa793075"], ["__file", "/Users/gxwebsoft/APP/gxtyzx-uniapp-cli/src/uni_modules/uni-calendar/components/uni-calendar/uni-calendar-item.vue"]]);
wx.createComponent(Component);
@@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}
@@ -0,0 +1 @@
<view class="{{['uni-calendar-item__weeks-box', 'data-v-aa793075', L && 'uni-calendar-item--disable', M && 'uni-calendar-item--isDay', N && 'uni-calendar-item--checked', O && 'uni-calendar-item--before-checked', P && 'uni-calendar-item--multiple', Q && 'uni-calendar-item--after-checked']}}" bindtap="{{R}}"><view class="uni-calendar-item__weeks-box-item data-v-aa793075"><text wx:if="{{a}}" class="uni-calendar-item__weeks-box-circle data-v-aa793075"></text><text class="{{['uni-calendar-item__weeks-box-text', 'data-v-aa793075', c && 'uni-calendar-item--isDay-text', d && 'uni-calendar-item--isDay', e && 'uni-calendar-item--checked', f && 'uni-calendar-item--before-checked', g && 'uni-calendar-item--multiple', h && 'uni-calendar-item--after-checked', i && 'uni-calendar-item--disable']}}">{{b}}</text><text wx:if="{{j}}" class="{{['uni-calendar-item__weeks-lunar-text', 'data-v-aa793075', l && 'uni-calendar-item--isDay-text', m && 'uni-calendar-item--isDay', n && 'uni-calendar-item--checked', o && 'uni-calendar-item--before-checked', p && 'uni-calendar-item--multiple', q && 'uni-calendar-item--after-checked']}}">{{k}}</text><text wx:if="{{r}}" class="{{['uni-calendar-item__weeks-lunar-text', 'data-v-aa793075', t && 'uni-calendar-item--isDay-text', v && 'uni-calendar-item--isDay', w && 'uni-calendar-item--checked', x && 'uni-calendar-item--before-checked', y && 'uni-calendar-item--multiple', z && 'uni-calendar-item--after-checked', A && 'uni-calendar-item--disable']}}">{{s}}</text><text wx:if="{{B}}" class="{{['uni-calendar-item__weeks-lunar-text', 'data-v-aa793075', D && 'uni-calendar-item--extra', E && 'uni-calendar-item--isDay-text', F && 'uni-calendar-item--isDay', G && 'uni-calendar-item--checked', H && 'uni-calendar-item--before-checked', I && 'uni-calendar-item--multiple', J && 'uni-calendar-item--after-checked', K && 'uni-calendar-item--disable']}}">{{C}}</text></view></view>
@@ -0,0 +1,92 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
.uni-calendar-item__weeks-box.data-v-aa793075 {
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.uni-calendar-item__weeks-box-text.data-v-aa793075 {
font-size: 14px;
color: #333;
}
.uni-calendar-item__weeks-lunar-text.data-v-aa793075 {
font-size: 12px;
color: #333;
}
.uni-calendar-item__weeks-box-item.data-v-aa793075 {
position: relative;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
width: 100rpx;
height: 100rpx;
}
.uni-calendar-item__weeks-box-circle.data-v-aa793075 {
position: absolute;
top: 5px;
right: 5px;
width: 8px;
height: 8px;
border-radius: 8px;
background-color: #e43d33;
}
.uni-calendar-item--disable.data-v-aa793075 {
background-color: rgba(249, 249, 249, 0.3);
color: #c0c0c0;
}
.uni-calendar-item--isDay-text.data-v-aa793075 {
color: #2979ff;
}
.uni-calendar-item--isDay.data-v-aa793075 {
background-color: #2979ff;
opacity: 0.8;
color: #fff;
}
.uni-calendar-item--extra.data-v-aa793075 {
color: #e43d33;
opacity: 0.8;
}
.uni-calendar-item--checked.data-v-aa793075 {
background-color: #2979ff;
color: #fff;
opacity: 0.8;
}
.uni-calendar-item--multiple.data-v-aa793075 {
background-color: #2979ff;
color: #fff;
opacity: 0.8;
}
.uni-calendar-item--before-checked.data-v-aa793075 {
background-color: #ff5a5f;
color: #fff;
}
.uni-calendar-item--after-checked.data-v-aa793075 {
background-color: #ff5a5f;
color: #fff;
}
@@ -0,0 +1,335 @@
"use strict";
const uni_modules_uniCalendar_components_uniCalendar_util = require("./util.js");
const common_vendor = require("../../../../common/vendor.js");
const uni_modules_uniCalendar_components_uniCalendar_i18n_index = require("./i18n/index.js");
const CalendarItem = () => "./uni-calendar-item.js";
const { t } = common_vendor.initVueI18n(uni_modules_uniCalendar_components_uniCalendar_i18n_index.i18nMessages);
const _sfc_main = {
components: {
CalendarItem
},
emits: ["close", "confirm", "change", "monthSwitch"],
props: {
date: {
type: String,
default: ""
},
selected: {
type: Array,
default() {
return [];
}
},
lunar: {
type: Boolean,
default: false
},
startDate: {
type: String,
default: ""
},
endDate: {
type: String,
default: ""
},
range: {
type: Boolean,
default: false
},
insert: {
type: Boolean,
default: true
},
showMonth: {
type: Boolean,
default: true
},
clearDate: {
type: Boolean,
default: true
}
},
data() {
return {
show: false,
weeks: [],
calendar: {},
nowDate: "",
aniMaskShow: false
};
},
computed: {
/**
* for i18n
*/
okText() {
return t("uni-calender.ok");
},
cancelText() {
return t("uni-calender.cancel");
},
todayText() {
return t("uni-calender.today");
},
monText() {
return t("uni-calender.MON");
},
TUEText() {
return t("uni-calender.TUE");
},
WEDText() {
return t("uni-calender.WED");
},
THUText() {
return t("uni-calender.THU");
},
FRIText() {
return t("uni-calender.FRI");
},
SATText() {
return t("uni-calender.SAT");
},
SUNText() {
return t("uni-calender.SUN");
}
},
watch: {
date(newVal) {
this.init(newVal);
},
startDate(val) {
this.cale.resetSatrtDate(val);
this.cale.setDate(this.nowDate.fullDate);
this.weeks = this.cale.weeks;
},
endDate(val) {
this.cale.resetEndDate(val);
this.cale.setDate(this.nowDate.fullDate);
this.weeks = this.cale.weeks;
},
selected(newVal) {
this.cale.setSelectInfo(this.nowDate.fullDate, newVal);
this.weeks = this.cale.weeks;
}
},
created() {
this.cale = new uni_modules_uniCalendar_components_uniCalendar_util.Calendar({
selected: this.selected,
startDate: this.startDate,
endDate: this.endDate,
range: this.range
});
this.init(this.date);
},
methods: {
// 取消穿透
clean() {
},
bindDateChange(e) {
const value = e.detail.value + "-1";
this.setDate(value);
const { year, month } = this.cale.getDate(value);
this.$emit("monthSwitch", {
year,
month
});
},
/**
* 初始化日期显示
* @param {Object} date
*/
init(date) {
this.cale.setDate(date);
this.weeks = this.cale.weeks;
this.nowDate = this.calendar = this.cale.getInfo(date);
},
/**
* 打开日历弹窗
*/
open() {
if (this.clearDate && !this.insert) {
this.cale.cleanMultipleStatus();
this.init(this.date);
}
this.show = true;
this.$nextTick(() => {
setTimeout(() => {
this.aniMaskShow = true;
}, 50);
});
},
/**
* 关闭日历弹窗
*/
close() {
this.aniMaskShow = false;
this.$nextTick(() => {
setTimeout(() => {
this.show = false;
this.$emit("close");
}, 300);
});
},
/**
* 确认按钮
*/
confirm() {
this.setEmit("confirm");
this.close();
},
/**
* 变化触发
*/
change() {
if (!this.insert) return;
this.setEmit("change");
},
/**
* 选择月份触发
*/
monthSwitch() {
let {
year,
month
} = this.nowDate;
this.$emit("monthSwitch", {
year,
month: Number(month)
});
},
/**
* 派发事件
* @param {Object} name
*/
setEmit(name) {
let {
year,
month,
date,
fullDate,
lunar,
extraInfo
} = this.calendar;
this.$emit(name, {
range: this.cale.multipleStatus,
year,
month,
date,
fulldate: fullDate,
lunar,
extraInfo: extraInfo || {}
});
},
/**
* 选择天触发
* @param {Object} weeks
*/
choiceDate(weeks) {
if (weeks.disable) return;
this.calendar = weeks;
this.cale.setMultiple(this.calendar.fullDate);
this.weeks = this.cale.weeks;
this.change();
},
/**
* 回到今天
*/
backToday() {
const nowYearMonth = `${this.nowDate.year}-${this.nowDate.month}`;
const date = this.cale.getDate(/* @__PURE__ */ new Date());
const todayYearMonth = `${date.year}-${date.month}`;
if (nowYearMonth !== todayYearMonth) {
this.monthSwitch();
}
this.init(date.fullDate);
this.change();
},
/**
* 上个月
*/
pre() {
const preDate = this.cale.getDate(this.nowDate.fullDate, -1, "month").fullDate;
this.setDate(preDate);
this.monthSwitch();
},
/**
* 下个月
*/
next() {
const nextDate = this.cale.getDate(this.nowDate.fullDate, 1, "month").fullDate;
this.setDate(nextDate);
this.monthSwitch();
},
/**
* 设置日期
* @param {Object} date
*/
setDate(date) {
this.cale.setDate(date);
this.weeks = this.cale.weeks;
this.nowDate = this.cale.getInfo(date);
}
}
};
if (!Array) {
const _component_calendar_item = common_vendor.resolveComponent("calendar-item");
_component_calendar_item();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: !$props.insert && $data.show
}, !$props.insert && $data.show ? {
b: $data.aniMaskShow ? 1 : "",
c: common_vendor.o((...args) => $options.clean && $options.clean(...args))
} : {}, {
d: $props.insert || $data.show
}, $props.insert || $data.show ? common_vendor.e({
e: !$props.insert
}, !$props.insert ? {
f: common_vendor.t($options.cancelText),
g: common_vendor.o((...args) => $options.close && $options.close(...args)),
h: common_vendor.t($options.okText),
i: common_vendor.o((...args) => $options.confirm && $options.confirm(...args))
} : {}, {
j: common_vendor.o((...args) => $options.pre && $options.pre(...args)),
k: common_vendor.t(($data.nowDate.year || "") + " / " + ($data.nowDate.month || "")),
l: $props.date,
m: common_vendor.o((...args) => $options.bindDateChange && $options.bindDateChange(...args)),
n: common_vendor.o((...args) => $options.next && $options.next(...args)),
o: common_vendor.t($options.todayText),
p: common_vendor.o((...args) => $options.backToday && $options.backToday(...args)),
q: $props.showMonth
}, $props.showMonth ? {
r: common_vendor.t($data.nowDate.month)
} : {}, {
s: common_vendor.t($options.SUNText),
t: common_vendor.t($options.monText),
v: common_vendor.t($options.TUEText),
w: common_vendor.t($options.WEDText),
x: common_vendor.t($options.THUText),
y: common_vendor.t($options.FRIText),
z: common_vendor.t($options.SATText),
A: common_vendor.f($data.weeks, (item, weekIndex, i0) => {
return {
a: common_vendor.f(item, (weeks, weeksIndex, i1) => {
return {
a: common_vendor.o($options.choiceDate, weeksIndex),
b: "3d225f58-0-" + i0 + "-" + i1,
c: common_vendor.p({
weeks,
calendar: $data.calendar,
selected: $props.selected,
lunar: $props.lunar
}),
d: weeksIndex
};
}),
b: weekIndex
};
}),
B: !$props.insert ? 1 : "",
C: $data.aniMaskShow ? 1 : ""
}) : {});
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-3d225f58"], ["__file", "/Users/gxwebsoft/APP/gxtyzx-uniapp-cli/src/uni_modules/uni-calendar/components/uni-calendar/uni-calendar.vue"]]);
wx.createComponent(Component);
@@ -0,0 +1,6 @@
{
"component": true,
"usingComponents": {
"calendar-item": "./uni-calendar-item"
}
}
@@ -0,0 +1 @@
<view class="uni-calendar data-v-3d225f58"><view wx:if="{{a}}" class="{{['uni-calendar__mask', 'data-v-3d225f58', b && 'uni-calendar--mask-show']}}" bindtap="{{c}}"></view><view wx:if="{{d}}" class="{{['uni-calendar__content', 'data-v-3d225f58', B && 'uni-calendar--fixed', C && 'uni-calendar--ani-show']}}"><view wx:if="{{e}}" class="uni-calendar__header uni-calendar--fixed-top data-v-3d225f58"><view class="uni-calendar__header-btn-box data-v-3d225f58" bindtap="{{g}}"><text class="uni-calendar__header-text uni-calendar--fixed-width data-v-3d225f58">{{f}}</text></view><view class="uni-calendar__header-btn-box data-v-3d225f58" bindtap="{{i}}"><text class="uni-calendar__header-text uni-calendar--fixed-width data-v-3d225f58">{{h}}</text></view></view><view class="uni-calendar__header data-v-3d225f58"><view class="uni-calendar__header-btn-box data-v-3d225f58" catchtap="{{j}}"><view class="uni-calendar__header-btn uni-calendar--left data-v-3d225f58"></view></view><picker class="data-v-3d225f58" mode="date" value="{{l}}" fields="month" bindchange="{{m}}"><text class="uni-calendar__header-text data-v-3d225f58">{{k}}</text></picker><view class="uni-calendar__header-btn-box data-v-3d225f58" catchtap="{{n}}"><view class="uni-calendar__header-btn uni-calendar--right data-v-3d225f58"></view></view><text class="uni-calendar__backtoday data-v-3d225f58" bindtap="{{p}}">{{o}}</text></view><view class="uni-calendar__box data-v-3d225f58"><view wx:if="{{q}}" class="uni-calendar__box-bg data-v-3d225f58"><text class="uni-calendar__box-bg-text data-v-3d225f58">{{r}}</text></view><view class="uni-calendar__weeks data-v-3d225f58"><view class="uni-calendar__weeks-day data-v-3d225f58"><text class="uni-calendar__weeks-day-text data-v-3d225f58">{{s}}</text></view><view class="uni-calendar__weeks-day data-v-3d225f58"><text class="uni-calendar__weeks-day-text data-v-3d225f58">{{t}}</text></view><view class="uni-calendar__weeks-day data-v-3d225f58"><text class="uni-calendar__weeks-day-text data-v-3d225f58">{{v}}</text></view><view class="uni-calendar__weeks-day data-v-3d225f58"><text class="uni-calendar__weeks-day-text data-v-3d225f58">{{w}}</text></view><view class="uni-calendar__weeks-day data-v-3d225f58"><text class="uni-calendar__weeks-day-text data-v-3d225f58">{{x}}</text></view><view class="uni-calendar__weeks-day data-v-3d225f58"><text class="uni-calendar__weeks-day-text data-v-3d225f58">{{y}}</text></view><view class="uni-calendar__weeks-day data-v-3d225f58"><text class="uni-calendar__weeks-day-text data-v-3d225f58">{{z}}</text></view></view><view wx:for="{{A}}" wx:for-item="item" wx:key="b" class="uni-calendar__weeks data-v-3d225f58"><view wx:for="{{item.a}}" wx:for-item="weeks" wx:key="d" class="uni-calendar__weeks-item data-v-3d225f58"><calendar-item wx:if="{{weeks.c}}" class="uni-calendar-item--hook data-v-3d225f58" bindchange="{{weeks.a}}" u-i="{{weeks.b}}" bind:__l="__l" u-p="{{weeks.c}}"></calendar-item></view></view></view></view></view>
@@ -0,0 +1,169 @@
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* 颜色变量 */
/* 行为相关颜色 */
/* 文字基本颜色 */
/* 背景颜色 */
/* 边框颜色 */
/* 尺寸变量 */
/* 文字尺寸 */
/* 图片尺寸 */
/* Border Radius */
/* 水平间距 */
/* 垂直间距 */
/* 透明度 */
/* 文章场景相关 */
.uni-calendar.data-v-3d225f58 {
display: flex;
flex-direction: column;
}
.uni-calendar__mask.data-v-3d225f58 {
position: fixed;
bottom: 0;
top: 0;
left: 0;
right: 0;
background-color: rgba(0, 0, 0, 0.4);
transition-property: opacity;
transition-duration: 0.3s;
opacity: 0;
z-index: 99;
}
.uni-calendar--mask-show.data-v-3d225f58 {
opacity: 1;
}
.uni-calendar--fixed.data-v-3d225f58 {
position: fixed;
left: 0;
right: 0;
transition-property: transform;
transition-duration: 0.3s;
transform: translateY(460px);
bottom: calc(var(--window-bottom));
z-index: 99;
}
.uni-calendar--ani-show.data-v-3d225f58 {
transform: translateY(0);
}
.uni-calendar__content.data-v-3d225f58 {
background-color: #fff;
}
.uni-calendar__header.data-v-3d225f58 {
position: relative;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
height: 50px;
border-bottom-color: #EDEDED;
border-bottom-style: solid;
border-bottom-width: 1px;
}
.uni-calendar--fixed-top.data-v-3d225f58 {
display: flex;
flex-direction: row;
justify-content: space-between;
border-top-color: #EDEDED;
border-top-style: solid;
border-top-width: 1px;
}
.uni-calendar--fixed-width.data-v-3d225f58 {
width: 50px;
}
.uni-calendar__backtoday.data-v-3d225f58 {
position: absolute;
right: 0;
top: 25rpx;
padding: 0 5px;
padding-left: 10px;
height: 25px;
line-height: 25px;
font-size: 12px;
border-top-left-radius: 25px;
border-bottom-left-radius: 25px;
color: #333;
background-color: #f1f1f1;
}
.uni-calendar__header-text.data-v-3d225f58 {
text-align: center;
width: 100px;
font-size: 14px;
color: #333;
}
.uni-calendar__header-btn-box.data-v-3d225f58 {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
width: 50px;
height: 50px;
}
.uni-calendar__header-btn.data-v-3d225f58 {
width: 10px;
height: 10px;
border-left-color: #808080;
border-left-style: solid;
border-left-width: 2px;
border-top-color: #555555;
border-top-style: solid;
border-top-width: 2px;
}
.uni-calendar--left.data-v-3d225f58 {
transform: rotate(-45deg);
}
.uni-calendar--right.data-v-3d225f58 {
transform: rotate(135deg);
}
.uni-calendar__weeks.data-v-3d225f58 {
position: relative;
display: flex;
flex-direction: row;
}
.uni-calendar__weeks-item.data-v-3d225f58 {
flex: 1;
}
.uni-calendar__weeks-day.data-v-3d225f58 {
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 45px;
border-bottom-color: #F5F5F5;
border-bottom-style: solid;
border-bottom-width: 1px;
}
.uni-calendar__weeks-day-text.data-v-3d225f58 {
font-size: 14px;
}
.uni-calendar__box.data-v-3d225f58 {
position: relative;
}
.uni-calendar__box-bg.data-v-3d225f58 {
display: flex;
justify-content: center;
align-items: center;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
.uni-calendar__box-bg-text.data-v-3d225f58 {
font-size: 200px;
font-weight: bold;
color: #999;
opacity: 0.1;
text-align: center;
line-height: 1;
}
@@ -0,0 +1,317 @@
"use strict";
const uni_modules_uniCalendar_components_uniCalendar_calendar = require("./calendar.js");
class Calendar {
constructor({
date,
selected,
startDate,
endDate,
range
} = {}) {
this.date = this.getDate(/* @__PURE__ */ new Date());
this.selected = selected || [];
this.startDate = startDate;
this.endDate = endDate;
this.range = range;
this.cleanMultipleStatus();
this.weeks = {};
}
/**
* 设置日期
* @param {Object} date
*/
setDate(date) {
this.selectDate = this.getDate(date);
this._getWeek(this.selectDate.fullDate);
}
/**
* 清理多选状态
*/
cleanMultipleStatus() {
this.multipleStatus = {
before: "",
after: "",
data: []
};
}
/**
* 重置开始日期
*/
resetSatrtDate(startDate) {
this.startDate = startDate;
}
/**
* 重置结束日期
*/
resetEndDate(endDate) {
this.endDate = endDate;
}
/**
* 获取任意时间
*/
getDate(date, AddDayCount = 0, str = "day") {
if (!date) {
date = /* @__PURE__ */ new Date();
}
if (typeof date !== "object") {
date = date.replace(/-/g, "/");
}
const dd = new Date(date);
switch (str) {
case "day":
dd.setDate(dd.getDate() + AddDayCount);
break;
case "month":
if (dd.getDate() === 31 && AddDayCount > 0) {
dd.setDate(dd.getDate() + AddDayCount);
} else {
const preMonth = dd.getMonth();
dd.setMonth(preMonth + AddDayCount);
const nextMonth = dd.getMonth();
if (AddDayCount < 0 && preMonth !== 0 && nextMonth - preMonth > AddDayCount) {
dd.setMonth(nextMonth + (nextMonth - preMonth + AddDayCount));
}
if (AddDayCount > 0 && nextMonth - preMonth > AddDayCount) {
dd.setMonth(nextMonth - (nextMonth - preMonth - AddDayCount));
}
}
break;
case "year":
dd.setFullYear(dd.getFullYear() + AddDayCount);
break;
}
const y = dd.getFullYear();
const m = dd.getMonth() + 1 < 10 ? "0" + (dd.getMonth() + 1) : dd.getMonth() + 1;
const d = dd.getDate() < 10 ? "0" + dd.getDate() : dd.getDate();
return {
fullDate: y + "-" + m + "-" + d,
year: y,
month: m,
date: d,
day: dd.getDay()
};
}
/**
* 获取上月剩余天数
*/
_getLastMonthDays(firstDay, full) {
let dateArr = [];
for (let i = firstDay; i > 0; i--) {
const beforeDate = new Date(full.year, full.month - 1, -i + 1).getDate();
dateArr.push({
date: beforeDate,
month: full.month - 1,
lunar: this.getlunar(full.year, full.month - 1, beforeDate),
disable: true
});
}
return dateArr;
}
/**
* 获取本月天数
*/
_currentMonthDys(dateData, full) {
let dateArr = [];
let fullDate = this.date.fullDate;
for (let i = 1; i <= dateData; i++) {
let nowDate = full.year + "-" + (full.month < 10 ? full.month : full.month) + "-" + (i < 10 ? "0" + i : i);
let isDay = fullDate === nowDate;
let info = this.selected && this.selected.find((item) => {
if (this.dateEqual(nowDate, item.date)) {
return item;
}
});
let disableBefore = true;
let disableAfter = true;
if (this.startDate) {
disableBefore = this.dateCompare(this.startDate, nowDate);
}
if (this.endDate) {
disableAfter = this.dateCompare(nowDate, this.endDate);
}
let multiples = this.multipleStatus.data;
let checked = false;
let multiplesStatus = -1;
if (this.range) {
if (multiples) {
multiplesStatus = multiples.findIndex((item) => {
return this.dateEqual(item, nowDate);
});
}
if (multiplesStatus !== -1) {
checked = true;
}
}
let data = {
fullDate: nowDate,
year: full.year,
date: i,
multiple: this.range ? checked : false,
beforeMultiple: this.dateEqual(this.multipleStatus.before, nowDate),
afterMultiple: this.dateEqual(this.multipleStatus.after, nowDate),
month: full.month,
lunar: this.getlunar(full.year, full.month, i),
disable: !(disableBefore && disableAfter),
isDay
};
if (info) {
data.extraInfo = info;
}
dateArr.push(data);
}
return dateArr;
}
/**
* 获取下月天数
*/
_getNextMonthDays(surplus, full) {
let dateArr = [];
for (let i = 1; i < surplus + 1; i++) {
dateArr.push({
date: i,
month: Number(full.month) + 1,
lunar: this.getlunar(full.year, Number(full.month) + 1, i),
disable: true
});
}
return dateArr;
}
/**
* 获取当前日期详情
* @param {Object} date
*/
getInfo(date) {
if (!date) {
date = /* @__PURE__ */ new Date();
}
const dateInfo = this.canlender.find((item) => item.fullDate === this.getDate(date).fullDate);
return dateInfo;
}
/**
* 比较时间大小
*/
dateCompare(startDate, endDate) {
startDate = new Date(startDate.replace("-", "/").replace("-", "/"));
endDate = new Date(endDate.replace("-", "/").replace("-", "/"));
if (startDate <= endDate) {
return true;
} else {
return false;
}
}
/**
* 比较时间是否相等
*/
dateEqual(before, after) {
before = new Date(before.replace("-", "/").replace("-", "/"));
after = new Date(after.replace("-", "/").replace("-", "/"));
if (before.getTime() - after.getTime() === 0) {
return true;
} else {
return false;
}
}
/**
* 获取日期范围内所有日期
* @param {Object} begin
* @param {Object} end
*/
geDateAll(begin, end) {
var arr = [];
var ab = begin.split("-");
var ae = end.split("-");
var db = /* @__PURE__ */ new Date();
db.setFullYear(ab[0], ab[1] - 1, ab[2]);
var de = /* @__PURE__ */ new Date();
de.setFullYear(ae[0], ae[1] - 1, ae[2]);
var unixDb = db.getTime() - 24 * 60 * 60 * 1e3;
var unixDe = de.getTime() - 24 * 60 * 60 * 1e3;
for (var k = unixDb; k <= unixDe; ) {
k = k + 24 * 60 * 60 * 1e3;
arr.push(this.getDate(new Date(parseInt(k))).fullDate);
}
return arr;
}
/**
* 计算阴历日期显示
*/
getlunar(year, month, date) {
return uni_modules_uniCalendar_components_uniCalendar_calendar.calendar.solar2lunar(year, month, date);
}
/**
* 设置打点
*/
setSelectInfo(data, value) {
this.selected = value;
this._getWeek(data);
}
/**
* 获取多选状态
*/
setMultiple(fullDate) {
let {
before,
after
} = this.multipleStatus;
if (!this.range) return;
if (before && after) {
this.multipleStatus.before = "";
this.multipleStatus.after = "";
this.multipleStatus.data = [];
} else {
if (!before) {
this.multipleStatus.before = fullDate;
} else {
this.multipleStatus.after = fullDate;
if (this.dateCompare(this.multipleStatus.before, this.multipleStatus.after)) {
this.multipleStatus.data = this.geDateAll(this.multipleStatus.before, this.multipleStatus.after);
} else {
this.multipleStatus.data = this.geDateAll(this.multipleStatus.after, this.multipleStatus.before);
}
}
}
this._getWeek(fullDate);
}
/**
* 获取每周数据
* @param {Object} dateData
*/
_getWeek(dateData) {
const {
year,
month
} = this.getDate(dateData);
let firstDay = new Date(year, month - 1, 1).getDay();
let currentDay = new Date(year, month, 0).getDate();
let dates = {
lastMonthDays: this._getLastMonthDays(firstDay, this.getDate(dateData)),
// 上个月末尾几天
currentMonthDys: this._currentMonthDys(currentDay, this.getDate(dateData)),
// 本月天数
nextMonthDays: [],
// 下个月开始几天
weeks: []
};
let canlender = [];
const surplus = 42 - (dates.lastMonthDays.length + dates.currentMonthDys.length);
dates.nextMonthDays = this._getNextMonthDays(surplus, this.getDate(dateData));
canlender = canlender.concat(dates.lastMonthDays, dates.currentMonthDys, dates.nextMonthDays);
let weeks = {};
for (let i = 0; i < canlender.length; i++) {
if (i % 7 === 0) {
weeks[parseInt(i / 7)] = new Array(7);
}
weeks[parseInt(i / 7)][i % 7] = canlender[i];
}
this.canlender = canlender;
this.weeks = weeks;
}
//静态方法
// static init(date) {
// if (!this.instance) {
// this.instance = new Calendar(date);
// }
// return this.instance;
// }
}
exports.Calendar = Calendar;