优惠券管理模块
This commit is contained in:
66
apis/interfaces/coupons.js
Normal file
66
apis/interfaces/coupons.js
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
|
||||||
|
/**
|
||||||
|
* Web唐明明
|
||||||
|
* 匆匆数载恍如梦,岁月迢迢华发增。
|
||||||
|
* 碌碌无为枉半生,一朝惊醒万事空。
|
||||||
|
* moduleName: 优惠券
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { request } from '../index'
|
||||||
|
|
||||||
|
// 优惠券管理
|
||||||
|
const toolsCoupons = (data) => {
|
||||||
|
return request({
|
||||||
|
url: 'coupons/tools/coupons',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 发布优惠券
|
||||||
|
const pushCoupons = (data) => {
|
||||||
|
return request({
|
||||||
|
url: 'coupons/tools/coupons',
|
||||||
|
method: 'POST',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 关联券产品
|
||||||
|
const couponsGoods = id => {
|
||||||
|
return request({
|
||||||
|
url: 'coupons/tools/coupons/' + id + '/goods'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置关联商品
|
||||||
|
const couponsAddgoods = (id, data) => {
|
||||||
|
return request({
|
||||||
|
url: 'coupons/tools/coupons/' + id + '/addgoods',
|
||||||
|
method: 'POST',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 管理优惠券详情
|
||||||
|
const magCouponsInfo = (id) => {
|
||||||
|
return request({
|
||||||
|
url: 'coupons/tools/coupons/' + id
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 上下架
|
||||||
|
const magCouponsStatus = (id) => {
|
||||||
|
return request({
|
||||||
|
url: 'coupons/tools/coupons/' + id + '/status',
|
||||||
|
method: 'POST'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export {
|
||||||
|
toolsCoupons,
|
||||||
|
pushCoupons,
|
||||||
|
couponsGoods,
|
||||||
|
couponsAddgoods,
|
||||||
|
magCouponsInfo,
|
||||||
|
magCouponsStatus
|
||||||
|
}
|
||||||
904
components/tn-datepicker/tn-datepicker.vue
Normal file
904
components/tn-datepicker/tn-datepicker.vue
Normal file
@@ -0,0 +1,904 @@
|
|||||||
|
<template>
|
||||||
|
<view v-if="isShow" class="picker">
|
||||||
|
<view @click="onCancel" style="position: fixed;width: 100%;height: 100%;left: 0;top: 0;background: rgba(60,60,60,0.5)"></view>
|
||||||
|
<!-- 日期选择器 -->
|
||||||
|
<view v-if="type!='time'" :class="isShow?'myfirst':''" class="picker-modal">
|
||||||
|
<view class="picker-header">
|
||||||
|
<view class="close" @click="onCancel" style="font-size: 22px;width: 50upx;"></view>
|
||||||
|
<view style="flex: 1;font-size: 16px; text-align: center;color: rgb(102,101,91);">选择日期</view>
|
||||||
|
<view style="width: 50upx;"></view>
|
||||||
|
</view>
|
||||||
|
<view class="picker-week-header">
|
||||||
|
<view v-for="item in weekArr">{{item}}</view>
|
||||||
|
</view>
|
||||||
|
<scroll-view class="picker-modal-body" @scroll="scrollPage" scroll-y="true" id="target">
|
||||||
|
<view class="picker-modal-header-title" style="position: fixed;height: 93upx;line-height: 93upx;margin-top:-1px;right: 1px;background: #fff;z-index: 999;">{{dateTitleArr[scrollIndex]}}</view>
|
||||||
|
|
||||||
|
<view class="picker-calendar-box" :id="'calendar_module'+calendar_Index" v-for="(calendar,calendar_Index) in calendars"
|
||||||
|
:key="calendar_Index">
|
||||||
|
<view class="picker-modal-header-title" :class="" style="color:rgb(77,77,77); font-size: 16px; width: 100%;height: 90upx;line-height: 90upx;text-align: center;">{{dateTitleArr[calendar_Index]}}</view>
|
||||||
|
<view class="picker-calendar">
|
||||||
|
<view class="picker-calendar-view" v-for="(date,dateIndex) in calendar" :key="dateIndex">
|
||||||
|
<view v-show="!date.isOtherMonth || calendar_Index == 0" @click="onSelectDate(date)">
|
||||||
|
<!-- 背景样式 -->
|
||||||
|
<view v-show="date.bgStyle.type" :class="'picker-calendar-view-'+date.bgStyle.type" :style="{background: date.bgStyle.background}"></view>
|
||||||
|
<!-- 正常和选中样式 -->
|
||||||
|
<view class="picker-calendar-view-item" :style="{opacity: date.statusStyle.opacity, color: date.statusStyle.color, background: date.statusStyle.background}">
|
||||||
|
<text>{{date.title}}</text>
|
||||||
|
</view>
|
||||||
|
<!-- 小圆点样式 -->
|
||||||
|
<view class="picker-calendar-view-dot" :style="{opacity: date.dotStyle.opacity, background: date.dotStyle.background}"></view>
|
||||||
|
<!-- 信息样式 -->
|
||||||
|
<view v-show="date.tips" class="picker-calendar-view-tips">{{date.tips}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="picker-modal-footer" v-show="checkeds.length==2" style="position: fixed;bottom: 0;z-index: 1002;">
|
||||||
|
<view style="position: absolute;width: 100%;height: 100%;background: #fff;z-index: -1;left:0;top:1px;"></view>
|
||||||
|
<view class="picker-modal-footer-btnOK" :style="{'background':color}" @click="onConfirm">完成</view>
|
||||||
|
</view>
|
||||||
|
<view class="picker-modal-footer" v-show="checkeds.length==2"></view>
|
||||||
|
</scroll-view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
/**
|
||||||
|
* 工具函数库
|
||||||
|
*/
|
||||||
|
const DateTools = {
|
||||||
|
/**
|
||||||
|
* 获取公历节日
|
||||||
|
* @param date Date对象
|
||||||
|
*/
|
||||||
|
getHoliday(date) {
|
||||||
|
let holidays = {
|
||||||
|
'0101': '元旦',
|
||||||
|
'0214': '情人',
|
||||||
|
'0308': '妇女',
|
||||||
|
'0312': '植树',
|
||||||
|
'0401': '愚人',
|
||||||
|
'0501': '劳动',
|
||||||
|
'0504': '青年',
|
||||||
|
'0601': '儿童',
|
||||||
|
'0701': '建党',
|
||||||
|
'0801': '建军',
|
||||||
|
'0903': '抗日',
|
||||||
|
'0910': '教师',
|
||||||
|
'1001': '国庆',
|
||||||
|
'1031': '万圣',
|
||||||
|
'1224': '平安',
|
||||||
|
'1225': '圣诞'
|
||||||
|
};
|
||||||
|
let value = this.format(date, 'mmdd');
|
||||||
|
if (holidays[value]) return holidays[value];
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 解析标准日期格式
|
||||||
|
* @param s 日期字符串
|
||||||
|
* @return 返回Date对象
|
||||||
|
*/
|
||||||
|
parse: s => new Date(s.replace(/(年|月|-)/g, '/').replace(/(日)/g, '')),
|
||||||
|
/**
|
||||||
|
* 比较日期是否为同一天
|
||||||
|
* @param a Date对象
|
||||||
|
* @param b Date对象
|
||||||
|
* @return Boolean
|
||||||
|
*/
|
||||||
|
isSameDay: (a, b) => a.getMonth() == b.getMonth() && a.getFullYear() == b.getFullYear() && a.getDate() == b.getDate(),
|
||||||
|
/**
|
||||||
|
* 格式化Date对象
|
||||||
|
* @param d 日期对象
|
||||||
|
* @param f 格式字符串
|
||||||
|
* @return 返回格式化后的字符串
|
||||||
|
*/
|
||||||
|
format(d, f) {
|
||||||
|
var o = {
|
||||||
|
"m+": d.getMonth() + 1,
|
||||||
|
"d+": d.getDate(),
|
||||||
|
"h+": d.getHours(),
|
||||||
|
"i+": d.getMinutes(),
|
||||||
|
"s+": d.getSeconds(),
|
||||||
|
"q+": Math.floor((d.getMonth() + 3) / 3),
|
||||||
|
};
|
||||||
|
if (/(y+)/.test(f))
|
||||||
|
f = f.replace(RegExp.$1, (d.getFullYear() + "").substr(4 - RegExp.$1.length));
|
||||||
|
for (var k in o)
|
||||||
|
if (new RegExp("(" + k + ")").test(f))
|
||||||
|
f = f.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
|
||||||
|
return f;
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 用于format格式化后的反解析
|
||||||
|
* @param s 日期字符串
|
||||||
|
* @param f 格式字符串
|
||||||
|
* @return 返回Date对象
|
||||||
|
*/
|
||||||
|
inverse(s, f) {
|
||||||
|
var o = {
|
||||||
|
"y": '',
|
||||||
|
"m": '',
|
||||||
|
"d": '',
|
||||||
|
"h": '',
|
||||||
|
"i": '',
|
||||||
|
"s": '',
|
||||||
|
};
|
||||||
|
let d = new Date();
|
||||||
|
if (s.length != f.length) return d;
|
||||||
|
for (let i in f)
|
||||||
|
if (o[f[i]] != undefined) o[f[i]] += s[i];
|
||||||
|
if (o.y) d.setFullYear(o.y.length < 4 ? (d.getFullYear() + '').substr(0, 4 - o.y.length) + o.y : o.y);
|
||||||
|
o.m && d.setMonth(o.m - 1, 1);
|
||||||
|
o.d && d.setDate(o.d - 0);
|
||||||
|
o.h && d.setHours(o.h - 0);
|
||||||
|
o.i && d.setMinutes(o.i - 0);
|
||||||
|
o.s && d.setSeconds(o.s - 0);
|
||||||
|
return d;
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 获取日历数组(42天)
|
||||||
|
* @param date 日期对象或日期字符串
|
||||||
|
* @param proc 处理日历(和forEach类似),传递一个数组中的item
|
||||||
|
* @return Array
|
||||||
|
*/
|
||||||
|
getCalendar(date, proc,beforeDateDisable) {
|
||||||
|
let it = new Date(date),
|
||||||
|
calendars = [];
|
||||||
|
let nowDate = new Date(new Date(new Date().toLocaleDateString()).getTime());
|
||||||
|
it.setDate(1);
|
||||||
|
if(it.getDay()>0){
|
||||||
|
it.setDate(it.getDate() - (it.getDay() == 0 ? 7 : it.getDay())); //偏移量
|
||||||
|
}
|
||||||
|
for (let i = 0; i < 42; i++) {
|
||||||
|
let tmp = {
|
||||||
|
dateObj: new Date(it),
|
||||||
|
title: it.getDate(),
|
||||||
|
isOtherMonth: it.getMonth() < date.getMonth() || it.getMonth() > date.getMonth()
|
||||||
|
};
|
||||||
|
if(beforeDateDisable){
|
||||||
|
tmp.isBeforeNowDay = it<nowDate;
|
||||||
|
}
|
||||||
|
if (tmp.title == 1 && calendars.length > 7) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
calendars.push(Object.assign(tmp, proc ? proc(tmp) : {}));
|
||||||
|
|
||||||
|
it.setDate(it.getDate() + 1);
|
||||||
|
}
|
||||||
|
return calendars;
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 获取日期到指定的月份1号(不改变原来的date对象)
|
||||||
|
* @param d Date对象
|
||||||
|
* @param v 指定的月份
|
||||||
|
* @return Date对象
|
||||||
|
*/
|
||||||
|
getDateToMonth(d, v) {
|
||||||
|
let n = new Date(d);
|
||||||
|
n.setMonth(v, 1);
|
||||||
|
return n;
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 把时间数组转为时间字符串
|
||||||
|
* @param t Array[时,分,秒]
|
||||||
|
* @param showSecinds 是否显示秒
|
||||||
|
* @return 字符串 时:分[:秒]
|
||||||
|
*/
|
||||||
|
formatTimeArray(t, s) {
|
||||||
|
let r = [...t];
|
||||||
|
if (!s) r.length = 2;
|
||||||
|
r.forEach((v, k) => r[k] = ('0' + v).slice(-2));
|
||||||
|
return r.join(':');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
//颜色
|
||||||
|
color: {
|
||||||
|
type: String,
|
||||||
|
default: 'rgb(230,86,86)'
|
||||||
|
},
|
||||||
|
//显示未来几个月
|
||||||
|
beforeDateDisable: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
//显示未来几个月
|
||||||
|
monthNum: {
|
||||||
|
type: Number,
|
||||||
|
default: 6
|
||||||
|
},
|
||||||
|
//是否显示秒 针对type为datetime或time时生效
|
||||||
|
showSeconds: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
//初始的值
|
||||||
|
value: [String, Array],
|
||||||
|
//类型date time datetime range rangetime
|
||||||
|
type: {
|
||||||
|
type: String,
|
||||||
|
default: 'range'
|
||||||
|
},
|
||||||
|
//是否显示
|
||||||
|
show: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
//初始格式
|
||||||
|
format: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
//显示公历节日
|
||||||
|
showHoliday: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
//显示提示
|
||||||
|
showTips: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
//开始文案 针对type为范围选择时生效
|
||||||
|
beginText: {
|
||||||
|
type: String,
|
||||||
|
default: '开始'
|
||||||
|
},
|
||||||
|
//结束文案 针对type为范围选择时生效
|
||||||
|
endText: {
|
||||||
|
type: String,
|
||||||
|
default: '结束'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
isShow: false, //是否显示
|
||||||
|
isMultiSelect: false, //是否为多选
|
||||||
|
isContainTime: false, //是否包含时间
|
||||||
|
date: {}, //当前日期对象
|
||||||
|
weekArr: ["日", "一", "二", "三", "四", "五", "六"],
|
||||||
|
scrollTopArr: [],
|
||||||
|
scrollIndex: 0,
|
||||||
|
dateTitleArr: [],
|
||||||
|
title: '初始化', //标题
|
||||||
|
calendars: [], //日历数组
|
||||||
|
calendarIndex: 1, //当前日历索引
|
||||||
|
checkeds: [], //选中的日期对象集合
|
||||||
|
showTimePicker: false, //是否显示时间选择器
|
||||||
|
timeValue: [0, 0, 0], //时间选择器的值
|
||||||
|
timeType: 'begin', //当前时间选择的类型
|
||||||
|
beginTime: [0, 0, 0], //当前所选的开始时间值
|
||||||
|
endTime: [0, 0, 0], //当前所选的结束时间值
|
||||||
|
};
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
//监听滚动条
|
||||||
|
scrollPage(e) {
|
||||||
|
let scrollIndex = 0;
|
||||||
|
if (this.scrollTopArr.length >= 6) {
|
||||||
|
this.scrollTopArr.some(function(item, index) {
|
||||||
|
if (e.detail.scrollTop >= item) {
|
||||||
|
scrollIndex = index;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
this.scrollIndex = scrollIndex;
|
||||||
|
},
|
||||||
|
//设置值
|
||||||
|
setValue(value) {
|
||||||
|
this.date = new Date();
|
||||||
|
this.checkeds = [];
|
||||||
|
this.isMultiSelect = this.type.indexOf('range') >= 0;
|
||||||
|
this.isContainTime = this.type.indexOf('time') >= 0;
|
||||||
|
//将字符串解析为Date对象
|
||||||
|
let parseDateStr = (str) => (this.format ? DateTools.inverse(str, this.format) : DateTools.parse(str));
|
||||||
|
if (value) {
|
||||||
|
if (this.isMultiSelect) {
|
||||||
|
Array.isArray(value) && value.forEach((dateStr, index) => {
|
||||||
|
let date = parseDateStr(dateStr);
|
||||||
|
let time = [date.getHours(), date.getMinutes(), date.getSeconds()];
|
||||||
|
if (index == 0) this.beginTime = time;
|
||||||
|
else this.endTime = time;
|
||||||
|
this.checkeds.push(date);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
if (this.type == 'time') {
|
||||||
|
let date = parseDateStr('2019/1/1 ' + value);
|
||||||
|
this.beginTime = [date.getHours(), date.getMinutes(), date.getSeconds()];
|
||||||
|
this.onShowTimePicker('begin');
|
||||||
|
} else {
|
||||||
|
this.checkeds.push(parseDateStr(value));
|
||||||
|
if (this.isContainTime) this.beginTime = [
|
||||||
|
this.checkeds[0].getHours(),
|
||||||
|
this.checkeds[0].getMinutes(),
|
||||||
|
this.checkeds[0].getSeconds()
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (this.checkeds.length) this.date = new Date(this.checkeds[0]);
|
||||||
|
} else {
|
||||||
|
if (this.isContainTime) {
|
||||||
|
this.beginTime = [this.date.getHours(), this.date.getMinutes(), this.date.getSeconds()];
|
||||||
|
if (this.isMultiSelect) this.endTime = [...this.beginTime];
|
||||||
|
}
|
||||||
|
this.checkeds.push(new Date(this.date));
|
||||||
|
}
|
||||||
|
if (this.type != 'time') this.refreshCalendars(true);
|
||||||
|
else this.onShowTimePicker('begin');
|
||||||
|
},
|
||||||
|
//设置时间选择器的显示状态
|
||||||
|
onShowTimePicker(type) {
|
||||||
|
this.showTimePicker = true;
|
||||||
|
this.timeType = type;
|
||||||
|
this.timeValue = type == 'begin' ? [...this.beginTime] : [...this.endTime];
|
||||||
|
},
|
||||||
|
//处理日历
|
||||||
|
procCalendar(item) {
|
||||||
|
//定义初始样式
|
||||||
|
item.statusStyle = {
|
||||||
|
opacity: 1,
|
||||||
|
color: item.isOtherMonth ? '#ddd' : 'rgb(108,108,108)',
|
||||||
|
background: 'transparent'
|
||||||
|
};
|
||||||
|
if(item.isBeforeNowDay || item.isOtherMonth){
|
||||||
|
item.statusStyle.color = '#ddd';
|
||||||
|
item.isGray = true;
|
||||||
|
}
|
||||||
|
item.bgStyle = {
|
||||||
|
type: '',
|
||||||
|
background: 'transparent'
|
||||||
|
};
|
||||||
|
item.dotStyle = {
|
||||||
|
opacity: 1,
|
||||||
|
background: 'transparent'
|
||||||
|
};
|
||||||
|
item.tips = "";
|
||||||
|
//标记今天的日期
|
||||||
|
if (DateTools.isSameDay(new Date(), item.dateObj)) {
|
||||||
|
item.statusStyle.color = this.color;
|
||||||
|
if (item.isOtherMonth) item.statusStyle.opacity = 0.3;
|
||||||
|
}
|
||||||
|
//标记选中项
|
||||||
|
this.checkeds.forEach(date => {
|
||||||
|
if (DateTools.isSameDay(date, item.dateObj)) {
|
||||||
|
item.statusStyle.background = this.color;
|
||||||
|
item.statusStyle.color = '#fff';
|
||||||
|
item.statusStyle.opacity = 1;
|
||||||
|
if (this.isMultiSelect && this.showTips) item.tips = this.beginText;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//节假日或今日的日期标点
|
||||||
|
if (item.statusStyle.background != this.color) {
|
||||||
|
let holiday = this.showHoliday ? DateTools.getHoliday(item.dateObj) : false;
|
||||||
|
if (holiday || DateTools.isSameDay(new Date(), item.dateObj)) {
|
||||||
|
item.title = holiday || item.title;
|
||||||
|
item.dotStyle.background = this.color;
|
||||||
|
if (item.isOtherMonth) item.dotStyle.opacity = 0.2;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
item.title = item.dateObj.getDate();
|
||||||
|
}
|
||||||
|
//有两个日期
|
||||||
|
if (this.checkeds.length == 2) {
|
||||||
|
if (DateTools.isSameDay(this.checkeds[0], item.dateObj)) { //开始日期
|
||||||
|
item.bgStyle.type = 'bgbegin';
|
||||||
|
}
|
||||||
|
if (DateTools.isSameDay(this.checkeds[1], item.dateObj)) { //结束日期
|
||||||
|
if (this.isMultiSelect && this.showTips) item.tips = item.bgStyle.type ? this.beginText + ' / ' + this.endText :
|
||||||
|
this.endText;
|
||||||
|
if (!item.bgStyle.type) { //开始日期不等于结束日期
|
||||||
|
item.bgStyle.type = 'bgend';
|
||||||
|
} else {
|
||||||
|
item.bgStyle.type = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!item.bgStyle.type && (+item.dateObj > +this.checkeds[0] && +item.dateObj < +this.checkeds[1])) { //中间的日期
|
||||||
|
item.bgStyle.type = 'bg';
|
||||||
|
item.statusStyle.color = this.color;
|
||||||
|
}
|
||||||
|
if (item.bgStyle.type) {
|
||||||
|
item.bgStyle.background = this.color;
|
||||||
|
item.dotStyle.opacity = 1;
|
||||||
|
item.statusStyle.opacity = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
//刷新日历
|
||||||
|
refreshCalendars(refresh = false) {
|
||||||
|
let date = new Date(this.date);
|
||||||
|
let before = DateTools.getDateToMonth(date, date.getMonth() - 1);
|
||||||
|
let after = DateTools.getDateToMonth(date, date.getMonth() + 1);
|
||||||
|
|
||||||
|
let _this = this;
|
||||||
|
let mArr = [];
|
||||||
|
for (let m_num = 0; m_num < this.monthNum; m_num++) {
|
||||||
|
let new_date = DateTools.getDateToMonth(date, date.getMonth() + m_num);
|
||||||
|
_this.dateTitleArr.push(DateTools.format(new_date, 'yyyy年mm月'))
|
||||||
|
mArr.push(new_date)
|
||||||
|
}
|
||||||
|
mArr.some(function(item, index) {
|
||||||
|
_this.calendars.splice(index, 1, DateTools.getCalendar(item, _this.procCalendar,_this.beforeDateDisable));
|
||||||
|
})
|
||||||
|
this.title = DateTools.format(this.date, 'yyyy年mm月');
|
||||||
|
|
||||||
|
setTimeout(function(){
|
||||||
|
let domArr = [];
|
||||||
|
let h = 0;
|
||||||
|
const query = uni.createSelectorQuery().in(_this);
|
||||||
|
for (let m_domNum = 0; m_domNum < _this.monthNum; m_domNum++) {
|
||||||
|
let className = '#calendar_module' + m_domNum;
|
||||||
|
let view = uni.createSelectorQuery().select(className);
|
||||||
|
//console.log(view);
|
||||||
|
view.fields({
|
||||||
|
size: true, // 是否返回节点尺寸
|
||||||
|
}, data => { // data是方法的回调函数,参数是指定的相关节点信息。
|
||||||
|
// console.log(data);
|
||||||
|
let model = {};
|
||||||
|
model.top = h; // 顶部高度
|
||||||
|
h += data.height;
|
||||||
|
model.bottom = h; // 底部高度
|
||||||
|
domArr.push(model.top);
|
||||||
|
}).exec();
|
||||||
|
}
|
||||||
|
_this.scrollTopArr = domArr;
|
||||||
|
},100)
|
||||||
|
},
|
||||||
|
//选中日期
|
||||||
|
onSelectDate(date) {
|
||||||
|
if(date.isGray){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (~this.type.indexOf('range') && this.checkeds.length == 2) this.checkeds = [];
|
||||||
|
else if (!(~this.type.indexOf('range')) && this.checkeds.length) this.checkeds = [];
|
||||||
|
this.checkeds.push(new Date(date.dateObj));
|
||||||
|
this.checkeds.sort((a, b) => a - b); //从小到大排序
|
||||||
|
this.calendars.forEach(calendar => {
|
||||||
|
calendar.forEach(this.procCalendar); //重新处理
|
||||||
|
});
|
||||||
|
},
|
||||||
|
//时间选择取消
|
||||||
|
onCancelTime() {
|
||||||
|
this.showTimePicker = false;
|
||||||
|
this.type == 'time' && this.onCancel();
|
||||||
|
},
|
||||||
|
//时间选择确定
|
||||||
|
onConfirmTime() {
|
||||||
|
if (this.timeType == 'begin') this.beginTime = this.timeValue;
|
||||||
|
else this.endTime = this.timeValue;
|
||||||
|
this.showTimePicker = false;
|
||||||
|
this.type == 'time' && this.onConfirm();
|
||||||
|
},
|
||||||
|
//取消
|
||||||
|
onCancel() {
|
||||||
|
this.$emit('cancel', false);
|
||||||
|
},
|
||||||
|
//确定
|
||||||
|
onConfirm() {
|
||||||
|
let result = {
|
||||||
|
value: null,
|
||||||
|
date: null
|
||||||
|
};
|
||||||
|
//定义默认格式
|
||||||
|
let defaultFormat = {
|
||||||
|
'date': 'yyyy/mm/dd',
|
||||||
|
'time': 'hh:ii' + (this.showSeconds ? ':ss' : ''),
|
||||||
|
'datetime': ''
|
||||||
|
};
|
||||||
|
defaultFormat['datetime'] = defaultFormat.date + ' ' + defaultFormat.time;
|
||||||
|
let fillTime = (date, timeArr) => {
|
||||||
|
date.setHours(timeArr[0], timeArr[1]);
|
||||||
|
if (this.showSeconds) date.setSeconds(timeArr[2]);
|
||||||
|
};
|
||||||
|
if (this.type == 'time') {
|
||||||
|
let date = new Date();
|
||||||
|
fillTime(date, this.beginTime);
|
||||||
|
result.value = DateTools.format(date, this.format ? this.format : defaultFormat.time);
|
||||||
|
result.date = date;
|
||||||
|
} else {
|
||||||
|
if (this.isMultiSelect) {
|
||||||
|
let values = [],
|
||||||
|
dates = [];
|
||||||
|
if (this.checkeds.length < 2) return uni.showToast({
|
||||||
|
icon: 'none',
|
||||||
|
title: '请选择两个日期'
|
||||||
|
});
|
||||||
|
this.checkeds.forEach((date, index) => {
|
||||||
|
let newDate = new Date(date);
|
||||||
|
if (this.isContainTime) {
|
||||||
|
let time = [this.beginTime, this.endTime];
|
||||||
|
fillTime(newDate, time[index]);
|
||||||
|
}
|
||||||
|
values.push(DateTools.format(newDate, this.format ? this.format : defaultFormat[this.isContainTime ?
|
||||||
|
'datetime' : 'date']));
|
||||||
|
dates.push(newDate);
|
||||||
|
});
|
||||||
|
result.value = values;
|
||||||
|
result.date = dates;
|
||||||
|
} else {
|
||||||
|
let newDate = new Date(this.checkeds[0]);
|
||||||
|
if (this.isContainTime) {
|
||||||
|
newDate.setHours(this.beginTime[0], this.beginTime[1]);
|
||||||
|
if (this.showSeconds) newDate.setSeconds(this.beginTime[2]);
|
||||||
|
}
|
||||||
|
result.value = DateTools.format(newDate, this.format ? this.format : defaultFormat[this.isContainTime ?
|
||||||
|
'datetime' : 'date']);
|
||||||
|
result.date = newDate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.$emit('confirm', result);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
BeginTitle() {
|
||||||
|
let value = '未选择';
|
||||||
|
if (this.checkeds.length) value = DateTools.format(this.checkeds[0], 'yy/mm/dd');
|
||||||
|
return value;
|
||||||
|
},
|
||||||
|
EndTitle() {
|
||||||
|
let value = '未选择';
|
||||||
|
if (this.checkeds.length == 2) value = DateTools.format(this.checkeds[1], 'yy/mm/dd');
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
show(newValue, oldValue) {
|
||||||
|
newValue && this.setValue(this.value);
|
||||||
|
this.isShow = newValue;
|
||||||
|
},
|
||||||
|
value(newValue, oldValue) {
|
||||||
|
setTimeout(() => {
|
||||||
|
this.setValue(newValue);
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.close {
|
||||||
|
position: relative;
|
||||||
|
width: 35upx;
|
||||||
|
height: 35upx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.close::before,
|
||||||
|
.close::after {
|
||||||
|
position: absolute;
|
||||||
|
content: ' ';
|
||||||
|
background-color: rgb(101, 100, 91);
|
||||||
|
left: 20upx;
|
||||||
|
width: 1px;
|
||||||
|
height: 35upx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.close::before {
|
||||||
|
transform: rotate(45deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.close::after {
|
||||||
|
transform: rotate(-45deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@keyframes myfirst
|
||||||
|
{
|
||||||
|
0% {top: 100vh;}
|
||||||
|
100% {top: 30vh;}
|
||||||
|
}
|
||||||
|
|
||||||
|
@-moz-keyframes myfirst /* Firefox */
|
||||||
|
{
|
||||||
|
0% {top: 100vh;}
|
||||||
|
100% {top: 30vh;}
|
||||||
|
}
|
||||||
|
|
||||||
|
@-webkit-keyframes myfirst /* Safari 和 Chrome */
|
||||||
|
{
|
||||||
|
0% {top: 100vh;}
|
||||||
|
100% {top: 30vh;}
|
||||||
|
}
|
||||||
|
|
||||||
|
@-o-keyframes myfirst /* Opera */
|
||||||
|
{
|
||||||
|
0% {top: 100vh;}
|
||||||
|
100% {top: 30vh;}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$z-index: 100;
|
||||||
|
$cell-spacing: 20upx;
|
||||||
|
$calendar-size: 630upx;
|
||||||
|
$calendar-item-size: 100upx;
|
||||||
|
|
||||||
|
.picker {
|
||||||
|
position: fixed;
|
||||||
|
z-index: $z-index;
|
||||||
|
background: rgba(60, 60, 60, 0);
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
font-size: 28upx;
|
||||||
|
|
||||||
|
&-header {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
width: 100%;
|
||||||
|
padding: 20upx 30upx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-week-header {
|
||||||
|
font-size: 16px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
border-bottom: 2px solid rgb(244, 244, 244);
|
||||||
|
padding: 10px 20px;
|
||||||
|
color: rgb(136, 136, 136);
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-week-header>view:first-child {
|
||||||
|
color: rgb(214, 142, 135);
|
||||||
|
}
|
||||||
|
|
||||||
|
&-week-header>view:last-child {
|
||||||
|
color: rgb(214, 142, 135);
|
||||||
|
}
|
||||||
|
|
||||||
|
&-btn {
|
||||||
|
padding: $cell-spacing*0.5 $cell-spacing;
|
||||||
|
border-radius: 12upx;
|
||||||
|
color: #666;
|
||||||
|
|
||||||
|
&-active {
|
||||||
|
background: rgba(0, 0, 0, .1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&-display {
|
||||||
|
color: #666;
|
||||||
|
|
||||||
|
&-text {
|
||||||
|
color: #000;
|
||||||
|
margin: 0 $cell-spacing*0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-link {
|
||||||
|
display: inline-block;
|
||||||
|
|
||||||
|
&-active {
|
||||||
|
background: rgba(0, 0, 0, .1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&-time {
|
||||||
|
width: 100%; //$calendar-size - 80upx !important;
|
||||||
|
left: ((750upx - $calendar-size) / 2 + 40upx) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-modal {
|
||||||
|
background: #fff;
|
||||||
|
box-sizing: border-box;
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0; //(750upx - $calendar-size) / 2;
|
||||||
|
width: 100%; //$calendar-size;
|
||||||
|
box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.1);
|
||||||
|
border-radius: 12upx;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: flex-start;
|
||||||
|
height: 70vh;
|
||||||
|
|
||||||
|
|
||||||
|
animation: myfirst 0.5s;
|
||||||
|
-moz-animation: myfirst 0.5s; /* Firefox */
|
||||||
|
-webkit-animation: myfirst 0.5s; /* Safari 和 Chrome */
|
||||||
|
-o-animation: myfirst 0.5s; /* Opera */
|
||||||
|
|
||||||
|
|
||||||
|
&-header {
|
||||||
|
text-align: center;
|
||||||
|
line-height: 80upx;
|
||||||
|
font-size: 32upx;
|
||||||
|
|
||||||
|
&-title {
|
||||||
|
display: inline-block;
|
||||||
|
width: 40%;
|
||||||
|
color: rgb(77, 77, 77);
|
||||||
|
font-size: 16px;
|
||||||
|
width: 100%;
|
||||||
|
height: 90upx;
|
||||||
|
line-height: 90upx;
|
||||||
|
text-align: center;
|
||||||
|
border-bottom: 1px solid rgb(244, 244, 244);
|
||||||
|
}
|
||||||
|
|
||||||
|
.picker-icon {
|
||||||
|
display: inline-block;
|
||||||
|
line-height: 50upx;
|
||||||
|
width: 50upx;
|
||||||
|
height: 50upx;
|
||||||
|
border-radius: 50upx;
|
||||||
|
text-align: center;
|
||||||
|
margin: 10upx;
|
||||||
|
background: #fff;
|
||||||
|
font-size: 36upx;
|
||||||
|
|
||||||
|
&-active {
|
||||||
|
background: rgba(0, 0, 0, .1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&-body {
|
||||||
|
width: 100%; //$calendar-size !important;
|
||||||
|
position: relative;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-time {
|
||||||
|
width: 100%;
|
||||||
|
height: 180upx;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 60upx;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-footer {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
padding: $cell-spacing;
|
||||||
|
height: 130upx;
|
||||||
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
border-top: 1px solid rgb(244, 244, 244);
|
||||||
|
|
||||||
|
&-btnOK {
|
||||||
|
width: calc(100% - 100upx);
|
||||||
|
height: 100%;
|
||||||
|
margin: 0 auto;
|
||||||
|
border-radius: 6upx;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 16px;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-info {
|
||||||
|
flex-grow: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-btn {
|
||||||
|
flex-shrink: 0;
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&-calendar {
|
||||||
|
width: 100%;
|
||||||
|
height: calc(100% - 90upx);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-start;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
flex-direction: row;
|
||||||
|
|
||||||
|
&-box {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
&-view:nth-child(7n){
|
||||||
|
width: 14.2%;
|
||||||
|
}
|
||||||
|
&-view {
|
||||||
|
position: relative;
|
||||||
|
width: 14.3%; //$calendar-item-size;
|
||||||
|
height: $calendar-item-size;
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
&-bgbegin,
|
||||||
|
&-bg,
|
||||||
|
&-bgend,
|
||||||
|
&-item,
|
||||||
|
&-dot,
|
||||||
|
&-tips {
|
||||||
|
position: absolute;
|
||||||
|
transition: .2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-bgbegin,
|
||||||
|
&-bg,
|
||||||
|
&-bgend {
|
||||||
|
opacity: .15;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-bg {
|
||||||
|
left: 0;
|
||||||
|
top: 0%;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-bgbegin {
|
||||||
|
border-radius: $calendar-item-size 0 0 $calendar-item-size;
|
||||||
|
top: 0%;
|
||||||
|
left: 0%;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-bgend {
|
||||||
|
border-radius: 0 $calendar-item-size $calendar-item-size 0;
|
||||||
|
top: 0%;
|
||||||
|
left: 0%;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-item {
|
||||||
|
left: 0%;
|
||||||
|
top: 0%;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
border-radius: 5px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-dot {
|
||||||
|
right: 10%;
|
||||||
|
top: 10%;
|
||||||
|
width: 12upx;
|
||||||
|
height: 12upx;
|
||||||
|
border-radius: 12upx;
|
||||||
|
}
|
||||||
|
|
||||||
|
&-tips {
|
||||||
|
bottom: 100%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
background: #4E4B46;
|
||||||
|
color: #fff;
|
||||||
|
border-radius: 12upx;
|
||||||
|
padding: 10upx 20upx;
|
||||||
|
font-size: 24upx;
|
||||||
|
width: max-content;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
pointer-events: none;
|
||||||
|
z-index: 1000;
|
||||||
|
|
||||||
|
&:after {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
top: 100%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
width: 0;
|
||||||
|
height: 0;
|
||||||
|
border-style: solid;
|
||||||
|
border-width: 5px 5px 0 5px;
|
||||||
|
border-color: #4E4B46 transparent transparent transparent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
35
pages.json
35
pages.json
@@ -194,7 +194,7 @@
|
|||||||
"buttons": [
|
"buttons": [
|
||||||
{
|
{
|
||||||
"text": "添加",
|
"text": "添加",
|
||||||
"fontSize": "16",
|
"fontSize": "14",
|
||||||
"width": "80",
|
"width": "80",
|
||||||
"color": "#c82626"
|
"color": "#c82626"
|
||||||
}
|
}
|
||||||
@@ -230,8 +230,39 @@
|
|||||||
},{
|
},{
|
||||||
"path" : "pages/coupons/management",
|
"path" : "pages/coupons/management",
|
||||||
"name" : "CouponsMag",
|
"name" : "CouponsMag",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText":"优惠券管理",
|
||||||
|
"titleNView": {
|
||||||
|
"backgroundColor": "#FFFFFF",
|
||||||
|
"buttons": [
|
||||||
|
{
|
||||||
|
"text": "发布",
|
||||||
|
"fontSize": "14",
|
||||||
|
"width": "80",
|
||||||
|
"color": "#c82626"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},{
|
||||||
|
"path" : "pages/coupons/add",
|
||||||
|
"name" : "couponsAdd",
|
||||||
"style":{
|
"style":{
|
||||||
"navigationBarTitleText": "优惠券管理"
|
"navigationBarTitleText": "添加优惠券",
|
||||||
|
"navigationBarBackgroundColor":"#FFFFFF"
|
||||||
|
}
|
||||||
|
},{
|
||||||
|
"path" : "pages/coupons/selectGoods",
|
||||||
|
"name" : "selectGoods",
|
||||||
|
"style":{
|
||||||
|
"navigationBarTitleText": "选择产品",
|
||||||
|
"navigationBarBackgroundColor":"#FFFFFF"
|
||||||
|
}
|
||||||
|
},{
|
||||||
|
"path" : "pages/coupons/magDetails",
|
||||||
|
"name" : "magDetails",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "优惠券详情"
|
||||||
}
|
}
|
||||||
},{
|
},{
|
||||||
"path" : "pages/verification/index",
|
"path" : "pages/verification/index",
|
||||||
|
|||||||
356
pages/coupons/add.vue
Normal file
356
pages/coupons/add.vue
Normal file
@@ -0,0 +1,356 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<view class="coupons-preview">
|
||||||
|
<view class="item cover" @click="updCover">
|
||||||
|
<image class="cover-img" v-if="cover != ''" :src="cover" mode="aspectFill" />
|
||||||
|
<image class="cover-img" v-else src="@/static/icons/add-icon.png" mode="aspectFill" />
|
||||||
|
</view>
|
||||||
|
<view class="item mian">
|
||||||
|
<view class="title nowrap">{{couponsTitle || '优惠券标题'}}</view>
|
||||||
|
<view class="time nowrap">{{datePickerValue.length == 0 ? '优惠券有效期': datePickerValue[0] + ' 至 ' + datePickerValue[1]}}</view>
|
||||||
|
<view class="goods nowrap">全店通用</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="add-info">
|
||||||
|
<view class="inputs">
|
||||||
|
<label class="input-label">券类型</label>
|
||||||
|
<picker :range="types" range-key="text" :value="typeIndex" data-type="typeIndex" @change="changePicker">
|
||||||
|
<view class="input-text">{{types[typeIndex].text}}<uni-icons class="picker-icon" type="arrowdown" size="14" /></view>
|
||||||
|
</picker>
|
||||||
|
</view>
|
||||||
|
<view class="inputs">
|
||||||
|
<label class="input-label">券名称</label>
|
||||||
|
<input type="text" v-model="couponsTitle" placeholder="输入优惠券名称" />
|
||||||
|
</view>
|
||||||
|
<view class="inputs">
|
||||||
|
<label class="input-label">发券数量</label>
|
||||||
|
<input type="number" v-model="quantity" placeholder="输入优惠券发放量" />
|
||||||
|
</view>
|
||||||
|
<view class="inputs">
|
||||||
|
<label class="input-label">每人限领</label>
|
||||||
|
<input type="number" v-model="personQuantity" placeholder="输入每人限领数, 0为不限制" />
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<block v-if="types[typeIndex].id == 2">
|
||||||
|
<view class="inputs">
|
||||||
|
<label class="input-label">满</label>
|
||||||
|
<input type="digit" v-model="full" placeholder="输入券最低消费金额" />
|
||||||
|
</view>
|
||||||
|
<view class="inputs">
|
||||||
|
<label class="input-label">减</label>
|
||||||
|
<input type="digit" v-model="price" placeholder="输入券优惠金额" />
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
<view class="inputs">
|
||||||
|
<label class="input-label">使用渠道</label>
|
||||||
|
<view class="input-checkbox">
|
||||||
|
<radio-group @change="radioChange">
|
||||||
|
<label class="input-checkbox-item">
|
||||||
|
<radio color="#c82626" value="1" checked/>
|
||||||
|
<text>线上</text>
|
||||||
|
</label>
|
||||||
|
<label class="input-checkbox-item">
|
||||||
|
<radio color="#c82626" value="2"/>
|
||||||
|
<text>线下</text>
|
||||||
|
</label>
|
||||||
|
</radio-group>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="inputs">
|
||||||
|
<label class="input-label">券有效期</label>
|
||||||
|
<view class="input-text" @click="showDatePicker = true">{{datePickerValue.length == 0 ? '选择优惠券有效期': datePickerValue[0] + ' 至 ' + datePickerValue[1]}}</view>
|
||||||
|
<tn-date-picker :show="showDatePicker" :monthNum="12" color="#c82626" :showTips="true" beginText="开始日期" endText="结束日期" @confirm="confirmDatePicker" @cancel="showDatePicker = false"/>
|
||||||
|
</view>
|
||||||
|
<view class="inputs">
|
||||||
|
<label class="input-label">设为推荐</label>
|
||||||
|
<picker :range="recommend" range-key="text" :value="recommendIndex" data-type="recommendIndex" @change="changePicker">
|
||||||
|
<view class="input-text">{{recommend[recommendIndex].text}}<uni-icons class="picker-icon" type="arrowdown" size="14" /></view>
|
||||||
|
</picker>
|
||||||
|
</view>
|
||||||
|
<view class="inputs">
|
||||||
|
<label class="input-label">产品限制</label>
|
||||||
|
<picker :range="product" range-key="text" :value="productIndex" data-type="productIndex" @change="changePicker">
|
||||||
|
<view class="input-text">{{product[productIndex].text}}<uni-icons class="picker-icon" type="arrowdown" size="14" /></view>
|
||||||
|
</picker>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="add-textarea">
|
||||||
|
<label>使用规则</label>
|
||||||
|
<textarea :maxlength="-1" v-model="description" placeholder="输入使用规则说明" />
|
||||||
|
</view>
|
||||||
|
<view class="add-btn ios-bottom">
|
||||||
|
<button type="default" @click="updComponent">{{product[productIndex].type === 'all' ? '发布优惠券': '选择关联商品'}}</button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import TnDatePicker from "@/components/tn-datepicker/tn-datepicker";
|
||||||
|
import { uploads } from '@/apis/interfaces/uploading'
|
||||||
|
import { pushCoupons } from '@/apis/interfaces/coupons'
|
||||||
|
export default {
|
||||||
|
components:{
|
||||||
|
TnDatePicker
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
typeIndex : 0,
|
||||||
|
types : [
|
||||||
|
{ id: 1, text: '服务券' },
|
||||||
|
{ id: 2, text: '代金券' },
|
||||||
|
{ id: 3, text: '提货券' },
|
||||||
|
],
|
||||||
|
recommendIndex : 0,
|
||||||
|
recommend : [
|
||||||
|
{ type: '0', text: '不推荐' },
|
||||||
|
{ type: '1', text: '推荐' }
|
||||||
|
],
|
||||||
|
productIndex : 0,
|
||||||
|
product : [
|
||||||
|
{ type: 'all', text: '全部商品通用' },
|
||||||
|
{ type: 'part', text: '部分商品可用' }
|
||||||
|
],
|
||||||
|
showDatePicker : false,
|
||||||
|
datePickerValue : [],
|
||||||
|
cover : '',
|
||||||
|
useWay : 1,
|
||||||
|
couponsTitle : '',
|
||||||
|
quantity : '',
|
||||||
|
personQuantity : '',
|
||||||
|
full : '',
|
||||||
|
price : '',
|
||||||
|
description : ''
|
||||||
|
};
|
||||||
|
},
|
||||||
|
methods:{
|
||||||
|
// 使用渠道
|
||||||
|
radioChange(e){
|
||||||
|
this.useWay = e.detail.value
|
||||||
|
},
|
||||||
|
// 选择
|
||||||
|
changePicker(e){
|
||||||
|
this[e.target.dataset.type] = e.detail.value
|
||||||
|
},
|
||||||
|
// 日期
|
||||||
|
confirmDatePicker(e){
|
||||||
|
this.datePickerValue = e.value
|
||||||
|
this.showDatePicker = false
|
||||||
|
},
|
||||||
|
// 上传优惠券封面
|
||||||
|
updCover(){
|
||||||
|
uni.chooseImage({
|
||||||
|
crop: {width: 300, height: 300},
|
||||||
|
success: path=> {
|
||||||
|
uploads([{
|
||||||
|
uri : path.tempFilePaths[0]
|
||||||
|
}]).then(res => {
|
||||||
|
this.cover = res.url[0]
|
||||||
|
}).catch(err => {
|
||||||
|
uni.showToast({
|
||||||
|
title: err.message,
|
||||||
|
icon : 'none'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 发布优惠券
|
||||||
|
updComponent(){
|
||||||
|
let recommendVlue = this.recommend[this.recommendIndex].type === 1 ? 2 : ''
|
||||||
|
let valuss = {
|
||||||
|
title : this.couponsTitle,
|
||||||
|
cover : this.cover,
|
||||||
|
type : this.types[this.typeIndex].id,
|
||||||
|
full : this.full || 0,
|
||||||
|
price : this.price || 0,
|
||||||
|
quantity : this.quantity,
|
||||||
|
use_way : this.useWay,
|
||||||
|
person_quantity : this.personQuantity,
|
||||||
|
start_at : this.datePickerValue[0],
|
||||||
|
end_at : this.datePickerValue[1],
|
||||||
|
channel : this.product[this.productIndex].type,
|
||||||
|
description : this.description,
|
||||||
|
position : [1, recommendVlue]
|
||||||
|
}
|
||||||
|
pushCoupons(valuss).then(res => {
|
||||||
|
uni.showModal({
|
||||||
|
title : '提示',
|
||||||
|
content : res.message,
|
||||||
|
confirmText : res.linkGoods ? '关联商品' : '确定',
|
||||||
|
confirmColor: '#c82626',
|
||||||
|
cancelText : '稍后',
|
||||||
|
cancelColor : '#555555',
|
||||||
|
showCancel : res.linkGoods,
|
||||||
|
success : modalRes => {
|
||||||
|
if(modalRes.confirm && res.linkGoods){
|
||||||
|
this.$Router.replace({name: 'selectGoods', params:{couponId: res.coupon_id}})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.$Router.back()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}).catch(err => {
|
||||||
|
uni.showToast({
|
||||||
|
title: err.message,
|
||||||
|
icon : 'none'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.add-btn{
|
||||||
|
padding: $padding;
|
||||||
|
button{
|
||||||
|
height: 90rpx;
|
||||||
|
line-height: 90rpx;
|
||||||
|
background: $text-price;
|
||||||
|
color: white;
|
||||||
|
font-size: $title-size;
|
||||||
|
font-weight: bold;
|
||||||
|
border-radius: 0;
|
||||||
|
&::after{
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 优惠券详情
|
||||||
|
.add-textarea{
|
||||||
|
background: white;
|
||||||
|
margin-top: $margin;
|
||||||
|
padding: $padding $padding $padding ($padding + 180rpx);
|
||||||
|
label{
|
||||||
|
position: absolute;
|
||||||
|
left: $padding;
|
||||||
|
line-height: 40rpx;
|
||||||
|
height: 40rpx;
|
||||||
|
}
|
||||||
|
textarea{
|
||||||
|
width: 100%;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
line-height: 40rpx;
|
||||||
|
height: 200rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 优惠券配置
|
||||||
|
.add-info{
|
||||||
|
background-color: white;
|
||||||
|
padding: 0 $padding;
|
||||||
|
.inputs{
|
||||||
|
position: relative;
|
||||||
|
padding-left: 180rpx;
|
||||||
|
&::after{
|
||||||
|
position: absolute;
|
||||||
|
height: 1rpx;
|
||||||
|
content: " ";
|
||||||
|
background: $border-color;
|
||||||
|
left: 0;
|
||||||
|
right: -$padding;
|
||||||
|
bottom: 0;
|
||||||
|
}
|
||||||
|
&:last-child::after{
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.input-label{
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
line-height: 90rpx;
|
||||||
|
height: 90rpx;
|
||||||
|
}
|
||||||
|
.input-text,
|
||||||
|
input{
|
||||||
|
height: 90rpx;
|
||||||
|
line-height: 90rpx;
|
||||||
|
font-size: $title-size-lg;
|
||||||
|
}
|
||||||
|
.input-text{
|
||||||
|
position: relative;
|
||||||
|
padding-right: 90rpx;
|
||||||
|
.picker-icon{
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.input-checkbox{
|
||||||
|
min-height: 90rpx;
|
||||||
|
display: flex;
|
||||||
|
.input-checkbox-item{
|
||||||
|
line-height: 90rpx;
|
||||||
|
margin-right: $margin;
|
||||||
|
radio{
|
||||||
|
transform:scale(0.8);
|
||||||
|
margin-right: -15rpx;
|
||||||
|
}
|
||||||
|
text{
|
||||||
|
padding: 0 ($padding/2);
|
||||||
|
line-height: 50rpx;
|
||||||
|
display: inline-block;
|
||||||
|
font-size: $title-size-lg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 发布预览
|
||||||
|
.coupons-preview{
|
||||||
|
background: white;
|
||||||
|
margin: $margin;
|
||||||
|
border-radius: $radius/2;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
padding: $padding 0;
|
||||||
|
.item{
|
||||||
|
position: relative;
|
||||||
|
padding: 0 $padding;
|
||||||
|
}
|
||||||
|
.cover{
|
||||||
|
position: relative;
|
||||||
|
border-right: dashed 3rpx $border-color;
|
||||||
|
width: 148rpx;
|
||||||
|
text-align: center;
|
||||||
|
.cover-img{
|
||||||
|
width: 148rpx;
|
||||||
|
height: 148rpx;
|
||||||
|
border-radius: $radius/2;
|
||||||
|
vertical-align: top;
|
||||||
|
background: $border-color-lg;
|
||||||
|
border:solid 1rpx $border-color;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
&::after,&::before{
|
||||||
|
position: absolute;
|
||||||
|
width: 30rpx;
|
||||||
|
height: 30rpx;
|
||||||
|
background: #f8f8f8;
|
||||||
|
content: " ";
|
||||||
|
right: -16rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
&::after{
|
||||||
|
top: -($padding + 15);
|
||||||
|
}
|
||||||
|
&::before{
|
||||||
|
bottom: -($padding + 15);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.mian{
|
||||||
|
justify-content: center;
|
||||||
|
width: calc(100% - 148rpx - #{$padding*2});
|
||||||
|
box-sizing: border-box;
|
||||||
|
@extend .vertical;
|
||||||
|
.title{
|
||||||
|
font-size: $title-size-lg;
|
||||||
|
line-height: 50rpx;
|
||||||
|
}
|
||||||
|
.time, .goods{
|
||||||
|
color: $text-gray-m;
|
||||||
|
font-size: $title-size-m;
|
||||||
|
line-height: 40rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
242
pages/coupons/magDetails.vue
Normal file
242
pages/coupons/magDetails.vue
Normal file
@@ -0,0 +1,242 @@
|
|||||||
|
<template>
|
||||||
|
<view class="content" v-if="!isLoding">
|
||||||
|
<view class="details">
|
||||||
|
<view class="header">
|
||||||
|
<view class="info">
|
||||||
|
<image class="info-cover" :src="details.cover" mode="aspectFill"></image>
|
||||||
|
<view class="info-title">{{details.title}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="info-item">
|
||||||
|
<view class="info-item-title">优惠券类型</view>
|
||||||
|
<view class="info-item-text">{{details.type.text}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="info-item">
|
||||||
|
<view class="info-item-title">上架状态</view>
|
||||||
|
<view class="info-item-text">{{details.status.text}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="info-item">
|
||||||
|
<view class="info-item-title">使用渠道</view>
|
||||||
|
<view class="info-item-text">{{details.use_way}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="info-item" v-if="details.type.value === 2">
|
||||||
|
<view class="info-item-title">满减</view>
|
||||||
|
<view class="info-item-text">满{{details.price}}减{{details.full}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="info-item">
|
||||||
|
<view class="info-item-title">券发放量</view>
|
||||||
|
<view class="info-item-text">{{details.quantity}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="info-item">
|
||||||
|
<view class="info-item-title">已发放量</view>
|
||||||
|
<view class="info-item-text">{{details.grant_quantity}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="info-item">
|
||||||
|
<view class="info-item-title">每人限领</view>
|
||||||
|
<view class="info-item-text">{{details.person_quantity == 0 ? '不限制': details.person_quantity}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="info-item">
|
||||||
|
<view class="info-item-title">券有效期(起)</view>
|
||||||
|
<view class="info-item-text">{{details.start_at}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="info-item">
|
||||||
|
<view class="info-item-title">券有效期(止)</view>
|
||||||
|
<view class="info-item-text">{{details.end_at}}</view>
|
||||||
|
</view>
|
||||||
|
<view class="info-item">
|
||||||
|
<view class="info-item-title">创建时间</view>
|
||||||
|
<view class="info-item-text">{{details.created_at}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="mian">
|
||||||
|
<view class="mian-title">适用权证</view>
|
||||||
|
<view class="mian-goods">
|
||||||
|
<view class="item" v-for="(item, index) in details.goods" :key="index">
|
||||||
|
<view class="item-title nowrap">{{item.name}}</view>
|
||||||
|
<view class="item-price nowrap">¥{{item.price}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="mian-title">使用说明</view>
|
||||||
|
<view class="mian-text">
|
||||||
|
<text>{{details.description || '-'}}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="ios-bottom"></view>
|
||||||
|
<!-- footer -->
|
||||||
|
<view class="footer">
|
||||||
|
<view class="footer-flex">
|
||||||
|
<view class="item" @click="putStatus">{{details.status.value == 4 ? '上架': '下架'}}</view>
|
||||||
|
<view class="item" @click="$Router.push({name: 'selectGoods', params: {couponId: details.coupon_id}})">关联商品</view>
|
||||||
|
</view>
|
||||||
|
<view class="ios-bottom"></view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { magCouponsInfo, magCouponsStatus } from '@/apis/interfaces/coupons'
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
isLoding: true,
|
||||||
|
details : {}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
magCouponsInfo(16).then(res => {
|
||||||
|
this.isLoding = false
|
||||||
|
this.details = res
|
||||||
|
})
|
||||||
|
},
|
||||||
|
methods:{
|
||||||
|
// 上下架
|
||||||
|
putStatus(){
|
||||||
|
magCouponsStatus(this.details.coupon_id).then(res => {
|
||||||
|
uni.showToast({
|
||||||
|
title: res,
|
||||||
|
icon : 'none'
|
||||||
|
})
|
||||||
|
this.$set(this.details, 'status', this.details.status.value == 4 ? {'value': 2,'text': "上架"} : {'value': 4,'text': "下架"})
|
||||||
|
}).catch(err => {
|
||||||
|
uni.showToast({
|
||||||
|
title: err.message,
|
||||||
|
icon : 'none'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
// content
|
||||||
|
.content{
|
||||||
|
padding-bottom: $padding + 90;
|
||||||
|
}
|
||||||
|
// footer
|
||||||
|
.footer{
|
||||||
|
box-shadow: 0 0 4rpx 4rpx rgba($color: #000000, $alpha: .02);
|
||||||
|
background: white;
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
padding: ($padding/2) $padding;
|
||||||
|
.footer-flex{
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
.item{
|
||||||
|
line-height: 70rpx;
|
||||||
|
width: 50%;
|
||||||
|
text-align: center;
|
||||||
|
color: $text-price;
|
||||||
|
font-size: $title-size-lg;
|
||||||
|
font-weight: bold;
|
||||||
|
border-right: solid 1rpx $border-color;
|
||||||
|
&:last-child{
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.details{
|
||||||
|
margin: $margin;
|
||||||
|
background: white;
|
||||||
|
border-radius: $radius;
|
||||||
|
// 优惠券信息
|
||||||
|
.header{
|
||||||
|
position: relative;
|
||||||
|
border-bottom: dashed 2rpx $border-color;
|
||||||
|
padding: $padding;
|
||||||
|
&::after,&::before{
|
||||||
|
position: absolute;
|
||||||
|
width: 30rpx;
|
||||||
|
height: 30rpx;
|
||||||
|
background: #f8f8f8;
|
||||||
|
content: " ";
|
||||||
|
bottom: -16rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
&::after{
|
||||||
|
left: -16rpx;
|
||||||
|
}
|
||||||
|
&::before{
|
||||||
|
right: -16rpx;
|
||||||
|
}
|
||||||
|
.info{
|
||||||
|
padding: $padding 0;
|
||||||
|
text-align: center;
|
||||||
|
.info-cover{
|
||||||
|
width: 128rpx;
|
||||||
|
height: 128rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
.info-title{
|
||||||
|
padding-top: $padding;
|
||||||
|
text-align: center;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: $title-size;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.info-item{
|
||||||
|
position: relative;
|
||||||
|
padding-left: 200rpx;
|
||||||
|
min-height: 60rpx;
|
||||||
|
font-size: $title-size-lg;
|
||||||
|
padding-bottom: $padding/3;
|
||||||
|
&:last-child{
|
||||||
|
padding-bottom: 0;
|
||||||
|
}
|
||||||
|
.info-item-title{
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
line-height: 50rpx;
|
||||||
|
color: $text-color;
|
||||||
|
}
|
||||||
|
.info-item-text{
|
||||||
|
line-height: 50rpx;
|
||||||
|
color: $text-gray;
|
||||||
|
text-align: right;
|
||||||
|
@extend .nowrap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 优惠券介绍
|
||||||
|
.mian{
|
||||||
|
padding: $padding;
|
||||||
|
.mian-title{
|
||||||
|
font-size: $title-size-lg;
|
||||||
|
font-weight: bold;
|
||||||
|
line-height: 50rpx;
|
||||||
|
color: $text-color;
|
||||||
|
}
|
||||||
|
.mian-text{
|
||||||
|
font-size: $title-size-m;
|
||||||
|
color: $text-gray;
|
||||||
|
padding-top: $padding/3;
|
||||||
|
}
|
||||||
|
.mian-goods{
|
||||||
|
padding-bottom: $padding;
|
||||||
|
.item{
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
line-height: 60rpx;
|
||||||
|
font-size: $title-size-m;
|
||||||
|
padding-top: $padding/3;
|
||||||
|
.item-title{
|
||||||
|
width: 75%;
|
||||||
|
color: $text-gray;
|
||||||
|
}
|
||||||
|
.item-price{
|
||||||
|
width: 25%;
|
||||||
|
color: $text-price;
|
||||||
|
font-weight: bold;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,19 +1,178 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
优惠券管理
|
<view class="tabs">
|
||||||
|
<view class="item" :class="{'show': listType == ''}" @click="onTabs('')">全部</view>
|
||||||
|
<view class="item" :class="{'show': listType == '1'}" @click="onTabs('1')">服务券</view>
|
||||||
|
<view class="item" :class="{'show': listType == '2'}" @click="onTabs('2')">代金券</view>
|
||||||
|
<view class="item" :class="{'show': listType == '3'}" @click="onTabs('3')">提货券</view>
|
||||||
|
</view>
|
||||||
|
<view class="coupons">
|
||||||
|
<view class="coupons-flex" v-for="(item, index) in coupons" :key="index">
|
||||||
|
<view class="item cover">
|
||||||
|
<image class="cover-img" :src="item.cover" mode="aspectFill" />
|
||||||
|
</view>
|
||||||
|
<view class="item mian">
|
||||||
|
<view class="title nowrap">{{item.title}}</view>
|
||||||
|
<view class="time nowrap">{{item.start_at}}至{{item.end_at}}</view>
|
||||||
|
<view class="tags nowrap">
|
||||||
|
<text>{{item.status.text}}</text>
|
||||||
|
<text>{{item.type.text}}</text>
|
||||||
|
<text>{{item.channel.text}}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="arrowright">
|
||||||
|
<uni-icons type="arrowright" size="16" color="#999"></uni-icons>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { toolsCoupons } from '@/apis/interfaces/coupons'
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
listType: '',
|
||||||
|
coupons : [],
|
||||||
|
pages : {}
|
||||||
};
|
};
|
||||||
|
},
|
||||||
|
onShow() {
|
||||||
|
this.getCoupons()
|
||||||
|
},
|
||||||
|
methods:{
|
||||||
|
// 选择类型
|
||||||
|
onTabs(value){
|
||||||
|
this.listType = value
|
||||||
|
this.getCoupons()
|
||||||
|
},
|
||||||
|
// 数据列表
|
||||||
|
getCoupons(){
|
||||||
|
toolsCoupons({
|
||||||
|
type: this.listType
|
||||||
|
}).then(res => {
|
||||||
|
this.coupons = res.lists.data
|
||||||
|
this.pages = res.lists.page
|
||||||
|
}).catch(err => {
|
||||||
|
uni.showToast({
|
||||||
|
title: err.message,
|
||||||
|
icon : 'none'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onNavigationBarButtonTap() {
|
||||||
|
this.$Router.push({name: 'couponsAdd'})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss" scoped>
|
||||||
|
// tabs
|
||||||
|
.tabs{
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
z-index: 99;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-around;
|
||||||
|
background: white;
|
||||||
|
padding: 15rpx 0;
|
||||||
|
font-size: $title-size-lg;
|
||||||
|
color: $text-gray;
|
||||||
|
.item{
|
||||||
|
height: 60rpx;
|
||||||
|
line-height: 60rpx;
|
||||||
|
&.show{
|
||||||
|
color: $text-price;
|
||||||
|
border-bottom: solid 4rpx $text-price;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 订单管理
|
||||||
|
.coupons{
|
||||||
|
padding-top: 90rpx;
|
||||||
|
@extend .ios-bottom;
|
||||||
|
.coupons-flex{
|
||||||
|
position: relative;
|
||||||
|
background: white;
|
||||||
|
margin: $margin;
|
||||||
|
border-radius: $radius/2;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
padding: $padding 70rpx $padding 0;
|
||||||
|
.item{
|
||||||
|
position: relative;
|
||||||
|
padding: 0 $padding;
|
||||||
|
}
|
||||||
|
.arrowright{
|
||||||
|
position: absolute;
|
||||||
|
right: $margin;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
@extend .vertical
|
||||||
|
}
|
||||||
|
.cover{
|
||||||
|
position: relative;
|
||||||
|
border-right: dashed 3rpx $border-color;
|
||||||
|
width: 148rpx;
|
||||||
|
text-align: center;
|
||||||
|
.cover-img{
|
||||||
|
width: 148rpx;
|
||||||
|
height: 148rpx;
|
||||||
|
border-radius: $radius/2;
|
||||||
|
vertical-align: top;
|
||||||
|
background: $border-color-lg;
|
||||||
|
border:solid 1rpx $border-color;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
&::after,&::before{
|
||||||
|
position: absolute;
|
||||||
|
width: 30rpx;
|
||||||
|
height: 30rpx;
|
||||||
|
background: #f8f8f8;
|
||||||
|
content: " ";
|
||||||
|
right: -16rpx;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
&::after{
|
||||||
|
top: -($padding + 15);
|
||||||
|
}
|
||||||
|
&::before{
|
||||||
|
bottom: -($padding + 15);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.mian{
|
||||||
|
justify-content: center;
|
||||||
|
width: calc(100% - 148rpx - #{$padding*2});
|
||||||
|
box-sizing: border-box;
|
||||||
|
@extend .vertical;
|
||||||
|
.title{
|
||||||
|
font-size: $title-size-lg;
|
||||||
|
line-height: 50rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.time, .tags{
|
||||||
|
color: $text-gray-m;
|
||||||
|
font-size: $title-size-m;
|
||||||
|
line-height: 40rpx;
|
||||||
|
}
|
||||||
|
.tags{
|
||||||
|
margin-top: 10rpx;
|
||||||
|
text{
|
||||||
|
background: $border-color-lg;
|
||||||
|
color: $text-gray;
|
||||||
|
padding: 0 ($padding/2);
|
||||||
|
margin-right: ($margin/2);
|
||||||
|
&:last-child{
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
250
pages/coupons/selectGoods.vue
Normal file
250
pages/coupons/selectGoods.vue
Normal file
@@ -0,0 +1,250 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<!-- 商品列表 -->
|
||||||
|
<view class="lists">
|
||||||
|
<view class="goods-item" v-for="(item, index) in goods" :key="index">
|
||||||
|
<checkbox class="checkbox" :checked="item.isSelect" @click="onSelect(index)"/>
|
||||||
|
<view class="mian">
|
||||||
|
<image class="cover" :src="item.cover" mode="aspectFill" />
|
||||||
|
<view class="title">{{item.title}}</view>
|
||||||
|
<view class="subtitle">{{item.description}}</view>
|
||||||
|
<view class="mian-flex">
|
||||||
|
<view class="price"><text>¥</text>{{item.price}}</view>
|
||||||
|
<view class="inventory">权证剩余{{item.stock}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="ios-bottom"></view>
|
||||||
|
</view>
|
||||||
|
<!-- footer -->
|
||||||
|
<view class="footer">
|
||||||
|
<view class="footer-flex">
|
||||||
|
<view class="flex-checkbox">
|
||||||
|
<checkbox class="checkbox" :checked="allSelect" @click="onAllSelect"/>
|
||||||
|
<label for="all">
|
||||||
|
<view class="text">全选</view>
|
||||||
|
<view class="sub-text">已选{{selectGoods.length}}件</view>
|
||||||
|
</label>
|
||||||
|
</view>
|
||||||
|
<view class="flex-button" @click="setGoods">确定</view>
|
||||||
|
</view>
|
||||||
|
<view class="ios-bottom"></view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { couponsGoods, couponsAddgoods } from '@/apis/interfaces/coupons'
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
goods : [],
|
||||||
|
selectGoods : [],
|
||||||
|
allSelect : false
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
couponsGoods(this.$Route.query.couponId).then(res => {
|
||||||
|
this.goods = res
|
||||||
|
this.selectNumber()
|
||||||
|
}).catch(err => {
|
||||||
|
uni.showToast({
|
||||||
|
title: err.message,
|
||||||
|
icon : 'none'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
methods:{
|
||||||
|
// 全选产品
|
||||||
|
onAllSelect(){
|
||||||
|
for(let val of this.goods){
|
||||||
|
val.isSelect = !this.allSelect
|
||||||
|
}
|
||||||
|
this.selectNumber()
|
||||||
|
},
|
||||||
|
// 选择产品
|
||||||
|
onSelect(index){
|
||||||
|
const goodsItem = this.goods[index]
|
||||||
|
goodsItem.isSelect = !goodsItem.isSelect
|
||||||
|
this.$set(this.goods, index, goodsItem)
|
||||||
|
this.selectNumber()
|
||||||
|
},
|
||||||
|
// 计算产品数量
|
||||||
|
selectNumber(){
|
||||||
|
let selectArr = [];
|
||||||
|
for(let val of this.goods){
|
||||||
|
if(val.isSelect) selectArr.push(val.goods_sku_id)
|
||||||
|
}
|
||||||
|
this.selectGoods = selectArr
|
||||||
|
if(selectArr.length == this.goods.length) this.allSelect = true
|
||||||
|
else this.allSelect = false
|
||||||
|
},
|
||||||
|
// 添加设置产品
|
||||||
|
setGoods(){
|
||||||
|
if(this.selectGoods.length <= 0){
|
||||||
|
uni.showToast({
|
||||||
|
title: '请选择优惠券关联商品',
|
||||||
|
icon : 'none'
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
couponsAddgoods(this.$Route.query.couponId, {
|
||||||
|
goodsable_ids: this.selectGoods
|
||||||
|
}).then(res => {
|
||||||
|
uni.showModal({
|
||||||
|
title : '提示',
|
||||||
|
content : res,
|
||||||
|
showCancel : false,
|
||||||
|
success : modalRes => {
|
||||||
|
if(modalRes.confirm) this.$Router.back()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}).catch(err => {
|
||||||
|
uni.showToast({
|
||||||
|
title: err.message,
|
||||||
|
icon : 'none'
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
// 列表
|
||||||
|
.lists{
|
||||||
|
padding-bottom: ($padding + 10) + 70;
|
||||||
|
.goods-item{
|
||||||
|
background: white;
|
||||||
|
padding: $padding $padding $padding ($padding + 70);
|
||||||
|
position: relative;
|
||||||
|
border-bottom: solid 1rpx $border-color;
|
||||||
|
.checkbox{
|
||||||
|
left: $padding;
|
||||||
|
}
|
||||||
|
.mian{
|
||||||
|
position: relative;
|
||||||
|
padding-left: $padding + 168;
|
||||||
|
min-height: 168rpx;
|
||||||
|
.cover{
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
width: 168rpx;
|
||||||
|
height: 168rpx;
|
||||||
|
}
|
||||||
|
.title{
|
||||||
|
font-size: $title-size-lg;
|
||||||
|
line-height: 40rpx;
|
||||||
|
height: 48rpx;
|
||||||
|
@extend .nowrap;
|
||||||
|
}
|
||||||
|
.subtitle{
|
||||||
|
color: $text-gray;
|
||||||
|
font-size: $title-size-m;
|
||||||
|
height: 80rpx;
|
||||||
|
line-height: 40rpx;
|
||||||
|
margin-bottom: 8rpx;
|
||||||
|
@extend .nowrap;
|
||||||
|
}
|
||||||
|
.mian-flex{
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
.price{
|
||||||
|
width: 50%;
|
||||||
|
font-weight: bold;
|
||||||
|
color: $text-price;
|
||||||
|
font-size: $title-size;
|
||||||
|
height: 40rpx;
|
||||||
|
line-height: 40rpx;
|
||||||
|
@extend .nowrap;
|
||||||
|
}
|
||||||
|
.inventory{
|
||||||
|
width: 50%;
|
||||||
|
text-align: right;
|
||||||
|
font-size: $title-size-sm;
|
||||||
|
color: $text-gray;
|
||||||
|
height: 40rpx;
|
||||||
|
line-height: 40rpx;
|
||||||
|
@extend .nowrap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// footer
|
||||||
|
.footer{
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
background: white;
|
||||||
|
padding: ($padding - 10) $padding;
|
||||||
|
z-index: 99;
|
||||||
|
box-shadow: 0 0 4rpx 4rpx rgba($color: #000000, $alpha: .02);
|
||||||
|
.footer-flex{
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
.flex-checkbox{
|
||||||
|
position: relative;
|
||||||
|
width: 50%;
|
||||||
|
padding-right: $padding;
|
||||||
|
padding-left: 70rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
.text{
|
||||||
|
font-size: $title-size-lg;
|
||||||
|
font-weight: bold;
|
||||||
|
line-height: 40rpx;
|
||||||
|
color: $text-color;
|
||||||
|
}
|
||||||
|
.sub-text{
|
||||||
|
font-size: $title-size-sm;
|
||||||
|
color: $text-gray;
|
||||||
|
line-height: 40rpx;
|
||||||
|
@extend .nowrap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.flex-button{
|
||||||
|
background: $text-price;
|
||||||
|
color: white;
|
||||||
|
width: 50%;
|
||||||
|
text-align: center;
|
||||||
|
line-height: 80rpx;
|
||||||
|
border-radius: $radius/2;
|
||||||
|
font-size: $title-size;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// checkbox
|
||||||
|
.checkbox{
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 50%;
|
||||||
|
margin-top: -28rpx;
|
||||||
|
.uni-checkbox-input{
|
||||||
|
border: 1px solid $border-color;
|
||||||
|
border-radius: 50%;
|
||||||
|
width: 46rpx;
|
||||||
|
height: 46rpx;
|
||||||
|
box-sizing:border-box;
|
||||||
|
}
|
||||||
|
.uni-checkbox-input.uni-checkbox-input-checked{
|
||||||
|
border: none;
|
||||||
|
background: $text-price;
|
||||||
|
}
|
||||||
|
.uni-checkbox-input.uni-checkbox-input-checked::before{
|
||||||
|
border-radius: 50%;
|
||||||
|
width: 40rpx;
|
||||||
|
height: 40rpx;
|
||||||
|
line-height: 40rpx;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color:#fff;
|
||||||
|
background: transparent;
|
||||||
|
transform:translate(-50%, -50%) scale(1);
|
||||||
|
-webkit-transform:translate(-50%, -50%) scale(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -10,6 +10,9 @@
|
|||||||
return {
|
return {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -93,7 +93,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { basicsInfo, basicsConfig } from '@/apis/interfaces/store'
|
import { basicsInfo, basicsConfig } from '@/apis/interfaces/store'
|
||||||
import { uploading, uploads } from '@/apis/interfaces/uploading'
|
import { uploads } from '@/apis/interfaces/uploading'
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|||||||
10
uni_modules/uni-calendar/changelog.md
Normal file
10
uni_modules/uni-calendar/changelog.md
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
## 1.4.2(2021-08-24)
|
||||||
|
- 新增 支持国际化
|
||||||
|
## 1.4.1(2021-08-05)
|
||||||
|
- 修复 弹出层被 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)
|
||||||
|
- 新增 组件示例地址
|
||||||
|
## 1.3.15(2021-02-04)
|
||||||
|
- 调整为uni_modules目录规范
|
||||||
546
uni_modules/uni-calendar/components/uni-calendar/calendar.js
Normal file
546
uni_modules/uni-calendar/components/uni-calendar/calendar.js
Normal file
@@ -0,0 +1,546 @@
|
|||||||
|
/**
|
||||||
|
* @1900-2100区间内的公历、农历互转
|
||||||
|
* @charset UTF-8
|
||||||
|
* @github https://github.com/jjonline/calendar.js
|
||||||
|
* @Author Jea杨(JJonline@JJonline.Cn)
|
||||||
|
* @Time 2014-7-21
|
||||||
|
* @Time 2016-8-13 Fixed 2033hex、Attribution Annals
|
||||||
|
* @Time 2016-9-25 Fixed lunar LeapMonth Param Bug
|
||||||
|
* @Time 2017-7-24 Fixed use getTerm Func Param Error.use solar year,NOT lunar year
|
||||||
|
* @Version 1.0.3
|
||||||
|
* @公历转农历:calendar.solar2lunar(1987,11,01); //[you can ignore params of prefix 0]
|
||||||
|
* @农历转公历:calendar.lunar2solar(1987,09,10); //[you can ignore params of prefix 0]
|
||||||
|
*/
|
||||||
|
/* eslint-disable */
|
||||||
|
var calendar = {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 农历1900-2100的润大小信息表
|
||||||
|
* @Array Of Property
|
||||||
|
* @return Hex
|
||||||
|
*/
|
||||||
|
lunarInfo: [0x04bd8, 0x04ae0, 0x0a570, 0x054d5, 0x0d260, 0x0d950, 0x16554, 0x056a0, 0x09ad0, 0x055d2, // 1900-1909
|
||||||
|
0x04ae0, 0x0a5b6, 0x0a4d0, 0x0d250, 0x1d255, 0x0b540, 0x0d6a0, 0x0ada2, 0x095b0, 0x14977, // 1910-1919
|
||||||
|
0x04970, 0x0a4b0, 0x0b4b5, 0x06a50, 0x06d40, 0x1ab54, 0x02b60, 0x09570, 0x052f2, 0x04970, // 1920-1929
|
||||||
|
0x06566, 0x0d4a0, 0x0ea50, 0x06e95, 0x05ad0, 0x02b60, 0x186e3, 0x092e0, 0x1c8d7, 0x0c950, // 1930-1939
|
||||||
|
0x0d4a0, 0x1d8a6, 0x0b550, 0x056a0, 0x1a5b4, 0x025d0, 0x092d0, 0x0d2b2, 0x0a950, 0x0b557, // 1940-1949
|
||||||
|
0x06ca0, 0x0b550, 0x15355, 0x04da0, 0x0a5b0, 0x14573, 0x052b0, 0x0a9a8, 0x0e950, 0x06aa0, // 1950-1959
|
||||||
|
0x0aea6, 0x0ab50, 0x04b60, 0x0aae4, 0x0a570, 0x05260, 0x0f263, 0x0d950, 0x05b57, 0x056a0, // 1960-1969
|
||||||
|
0x096d0, 0x04dd5, 0x04ad0, 0x0a4d0, 0x0d4d4, 0x0d250, 0x0d558, 0x0b540, 0x0b6a0, 0x195a6, // 1970-1979
|
||||||
|
0x095b0, 0x049b0, 0x0a974, 0x0a4b0, 0x0b27a, 0x06a50, 0x06d40, 0x0af46, 0x0ab60, 0x09570, // 1980-1989
|
||||||
|
0x04af5, 0x04970, 0x064b0, 0x074a3, 0x0ea50, 0x06b58, 0x05ac0, 0x0ab60, 0x096d5, 0x092e0, // 1990-1999
|
||||||
|
0x0c960, 0x0d954, 0x0d4a0, 0x0da50, 0x07552, 0x056a0, 0x0abb7, 0x025d0, 0x092d0, 0x0cab5, // 2000-2009
|
||||||
|
0x0a950, 0x0b4a0, 0x0baa4, 0x0ad50, 0x055d9, 0x04ba0, 0x0a5b0, 0x15176, 0x052b0, 0x0a930, // 2010-2019
|
||||||
|
0x07954, 0x06aa0, 0x0ad50, 0x05b52, 0x04b60, 0x0a6e6, 0x0a4e0, 0x0d260, 0x0ea65, 0x0d530, // 2020-2029
|
||||||
|
0x05aa0, 0x076a3, 0x096d0, 0x04afb, 0x04ad0, 0x0a4d0, 0x1d0b6, 0x0d250, 0x0d520, 0x0dd45, // 2030-2039
|
||||||
|
0x0b5a0, 0x056d0, 0x055b2, 0x049b0, 0x0a577, 0x0a4b0, 0x0aa50, 0x1b255, 0x06d20, 0x0ada0, // 2040-2049
|
||||||
|
/** Add By JJonline@JJonline.Cn**/
|
||||||
|
0x14b63, 0x09370, 0x049f8, 0x04970, 0x064b0, 0x168a6, 0x0ea50, 0x06b20, 0x1a6c4, 0x0aae0, // 2050-2059
|
||||||
|
0x0a2e0, 0x0d2e3, 0x0c960, 0x0d557, 0x0d4a0, 0x0da50, 0x05d55, 0x056a0, 0x0a6d0, 0x055d4, // 2060-2069
|
||||||
|
0x052d0, 0x0a9b8, 0x0a950, 0x0b4a0, 0x0b6a6, 0x0ad50, 0x055a0, 0x0aba4, 0x0a5b0, 0x052b0, // 2070-2079
|
||||||
|
0x0b273, 0x06930, 0x07337, 0x06aa0, 0x0ad50, 0x14b55, 0x04b60, 0x0a570, 0x054e4, 0x0d160, // 2080-2089
|
||||||
|
0x0e968, 0x0d520, 0x0daa0, 0x16aa6, 0x056d0, 0x04ae0, 0x0a9d4, 0x0a2d0, 0x0d150, 0x0f252, // 2090-2099
|
||||||
|
0x0d520], // 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: ['\u7532', '\u4e59', '\u4e19', '\u4e01', '\u620a', '\u5df1', '\u5e9a', '\u8f9b', '\u58ec', '\u7678'],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 天干地支之地支速查表
|
||||||
|
* @Array Of Property
|
||||||
|
* @trans["子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥"]
|
||||||
|
* @return Cn string
|
||||||
|
*/
|
||||||
|
Zhi: ['\u5b50', '\u4e11', '\u5bc5', '\u536f', '\u8fb0', '\u5df3', '\u5348', '\u672a', '\u7533', '\u9149', '\u620c', '\u4ea5'],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 天干地支之地支速查表<=>生肖
|
||||||
|
* @Array Of Property
|
||||||
|
* @trans["鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗","猪"]
|
||||||
|
* @return Cn string
|
||||||
|
*/
|
||||||
|
Animals: ['\u9f20', '\u725b', '\u864e', '\u5154', '\u9f99', '\u86c7', '\u9a6c', '\u7f8a', '\u7334', '\u9e21', '\u72d7', '\u732a'],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 24节气速查表
|
||||||
|
* @Array Of Property
|
||||||
|
* @trans["小寒","大寒","立春","雨水","惊蛰","春分","清明","谷雨","立夏","小满","芒种","夏至","小暑","大暑","立秋","处暑","白露","秋分","寒露","霜降","立冬","小雪","大雪","冬至"]
|
||||||
|
* @return Cn string
|
||||||
|
*/
|
||||||
|
solarTerm: ['\u5c0f\u5bd2', '\u5927\u5bd2', '\u7acb\u6625', '\u96e8\u6c34', '\u60ca\u86f0', '\u6625\u5206', '\u6e05\u660e', '\u8c37\u96e8', '\u7acb\u590f', '\u5c0f\u6ee1', '\u8292\u79cd', '\u590f\u81f3', '\u5c0f\u6691', '\u5927\u6691', '\u7acb\u79cb', '\u5904\u6691', '\u767d\u9732', '\u79cb\u5206', '\u5bd2\u9732', '\u971c\u964d', '\u7acb\u51ac', '\u5c0f\u96ea', '\u5927\u96ea', '\u51ac\u81f3'],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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: ['\u65e5', '\u4e00', '\u4e8c', '\u4e09', '\u56db', '\u4e94', '\u516d', '\u4e03', '\u516b', '\u4e5d', '\u5341'],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期转农历称呼速查表
|
||||||
|
* @Array Of Property
|
||||||
|
* @trans ['初','十','廿','卅']
|
||||||
|
* @return Cn string
|
||||||
|
*/
|
||||||
|
nStr2: ['\u521d', '\u5341', '\u5eff', '\u5345'],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 月份转农历称呼速查表
|
||||||
|
* @Array Of Property
|
||||||
|
* @trans ['正','一','二','三','四','五','六','七','八','九','十','冬','腊']
|
||||||
|
* @return Cn string
|
||||||
|
*/
|
||||||
|
nStr3: ['\u6b63', '\u4e8c', '\u4e09', '\u56db', '\u4e94', '\u516d', '\u4e03', '\u516b', '\u4e5d', '\u5341', '\u51ac', '\u814a'],
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回农历y年一整年的总天数
|
||||||
|
* @param lunar Year
|
||||||
|
* @return Number
|
||||||
|
* @eg:var count = calendar.lYearDays(1987) ;//count=387
|
||||||
|
*/
|
||||||
|
lYearDays: function (y) {
|
||||||
|
var i; var sum = 348
|
||||||
|
for (i = 0x8000; i > 0x8; 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) { // 闰字编码 \u95f0
|
||||||
|
return (this.lunarInfo[y - 1900] & 0xf)
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回农历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] & 0x10000) ? 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 }// 月份参数从1至12,参数错误返回-1
|
||||||
|
return ((this.lunarInfo[y - 1900] & (0x10000 >> 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 } // 若参数错误 返回-1
|
||||||
|
var ms = m - 1
|
||||||
|
if (ms == 1) { // 2月份的闰平规律测算后确认返回28或29
|
||||||
|
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// 如果余数为0则为最后一个天干
|
||||||
|
if (zhiKey == 0) zhiKey = 12// 如果余数为0则为最后一个地支
|
||||||
|
return this.Gan[ganKey - 1] + this.Zhi[zhiKey - 1]
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 公历月、日判断所属星座
|
||||||
|
* @param cMonth [description]
|
||||||
|
* @param cDay [description]
|
||||||
|
* @return Cn string
|
||||||
|
*/
|
||||||
|
toAstro: function (cMonth, cDay) {
|
||||||
|
var s = '\u9b54\u7faf\u6c34\u74f6\u53cc\u9c7c\u767d\u7f8a\u91d1\u725b\u53cc\u5b50\u5de8\u87f9\u72ee\u5b50\u5904\u5973\u5929\u79e4\u5929\u874e\u5c04\u624b\u9b54\u7faf'
|
||||||
|
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) + '\u5ea7'// 座
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 传入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) { // 月 => \u6708
|
||||||
|
if (m > 12 || m < 1) { return -1 } // 若参数错误 返回-1
|
||||||
|
var s = this.nStr3[m - 1]
|
||||||
|
s += '\u6708'// 加上月字
|
||||||
|
return s
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 传入农历日期数字返回汉字表示法
|
||||||
|
* @param lunar day
|
||||||
|
* @return Cn string
|
||||||
|
* @eg:var cnDay = calendar.toChinaDay(21) ;//cnMonth='廿一'
|
||||||
|
*/
|
||||||
|
toChinaDay: function (d) { // 日 => \u65e5
|
||||||
|
var s
|
||||||
|
switch (d) {
|
||||||
|
case 10:
|
||||||
|
s = '\u521d\u5341'; break
|
||||||
|
case 20:
|
||||||
|
s = '\u4e8c\u5341'; break
|
||||||
|
break
|
||||||
|
case 30:
|
||||||
|
s = '\u4e09\u5341'; break
|
||||||
|
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) { // 参数区间1900.1.31~2100.12.31
|
||||||
|
// 年份限定、上限
|
||||||
|
if (y < 1900 || y > 2100) {
|
||||||
|
return -1// undefined转换为数字变为NaN
|
||||||
|
}
|
||||||
|
// 公历传参最下限
|
||||||
|
if (y == 1900 && m == 1 && d < 31) {
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
// 未传参 获得当天
|
||||||
|
if (!y) {
|
||||||
|
var objDate = new Date()
|
||||||
|
} else {
|
||||||
|
var objDate = new Date(y, parseInt(m) - 1, d)
|
||||||
|
}
|
||||||
|
var i; var leap = 0; var temp = 0
|
||||||
|
// 修正ymd参数
|
||||||
|
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)) / 86400000
|
||||||
|
for (i = 1900; i < 2101 && offset > 0; i++) {
|
||||||
|
temp = this.lYearDays(i)
|
||||||
|
offset -= temp
|
||||||
|
}
|
||||||
|
if (offset < 0) {
|
||||||
|
offset += temp; i--
|
||||||
|
}
|
||||||
|
|
||||||
|
// 是否今天
|
||||||
|
var isTodayObj = 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)
|
||||||
|
|
||||||
|
// 当月的两个节气
|
||||||
|
// bugfix-2017-7-24 11:03:38 use lunar Year Param `y` Not `year`
|
||||||
|
var firstNode = this.getTerm(y, (m * 2 - 1))// 返回当月「节」为几日开始
|
||||||
|
var secondNode = this.getTerm(y, (m * 2))// 返回当月「节」为几日开始
|
||||||
|
|
||||||
|
// 依据12节气修正干支月
|
||||||
|
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]
|
||||||
|
}
|
||||||
|
// 日柱 当月一日与 1900/1/1 相差天数
|
||||||
|
var dayCyclical = Date.UTC(y, sm, 1, 0, 0, 0, 0) / 86400000 + 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 ? '\u95f0' : '') + 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': '\u661f\u671f' + 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) { // 参数区间1900.1.31~2100.12.1
|
||||||
|
var isLeapMonth = !!isLeapMonth
|
||||||
|
var leapOffset = 0
|
||||||
|
var leapMonth = this.leapMonth(y)
|
||||||
|
var leapDay = 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
|
||||||
|
// bugFix 2016-9-25
|
||||||
|
// if month is leap, _day use leapDays method
|
||||||
|
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 }
|
||||||
|
// 1900年农历正月一日的公历时间为1900年1月30日0时0分0秒(该时间也是本农历的最开始起始点)
|
||||||
|
var stmap = Date.UTC(1900, 1, 30, 0, 0, 0)
|
||||||
|
var calObj = new Date((offset + d - 31) * 86400000 + stmap)
|
||||||
|
var cY = calObj.getUTCFullYear()
|
||||||
|
var cM = calObj.getUTCMonth() + 1
|
||||||
|
var cD = calObj.getUTCDate()
|
||||||
|
|
||||||
|
return this.solar2lunar(cY, cM, cD)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default calendar
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"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"
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import en from './en.json'
|
||||||
|
import zhHans from './zh-Hans.json'
|
||||||
|
import zhHant from './zh-Hant.json'
|
||||||
|
export default {
|
||||||
|
en,
|
||||||
|
'zh-Hans': zhHans,
|
||||||
|
'zh-Hant': zhHant
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"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": "六"
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"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": "六"
|
||||||
|
}
|
||||||
@@ -0,0 +1,181 @@
|
|||||||
|
<template>
|
||||||
|
<view class="uni-calendar-item__weeks-box" :class="{
|
||||||
|
'uni-calendar-item--disable':weeks.disable,
|
||||||
|
'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay,
|
||||||
|
'uni-calendar-item--checked':(calendar.fullDate === weeks.fullDate && !weeks.isDay) ,
|
||||||
|
'uni-calendar-item--before-checked':weeks.beforeMultiple,
|
||||||
|
'uni-calendar-item--multiple': weeks.multiple,
|
||||||
|
'uni-calendar-item--after-checked':weeks.afterMultiple,
|
||||||
|
}"
|
||||||
|
@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 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,
|
||||||
|
'uni-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay,
|
||||||
|
'uni-calendar-item--before-checked':weeks.beforeMultiple,
|
||||||
|
'uni-calendar-item--multiple': weeks.multiple,
|
||||||
|
'uni-calendar-item--after-checked':weeks.afterMultiple,
|
||||||
|
'uni-calendar-item--disable':weeks.disable,
|
||||||
|
}">{{weeks.date}}</text>
|
||||||
|
<text v-if="!lunar&&!weeks.extraInfo && weeks.isDay" class="uni-calendar-item__weeks-lunar-text" :class="{
|
||||||
|
'uni-calendar-item--isDay-text':weeks.isDay,
|
||||||
|
'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay,
|
||||||
|
'uni-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay,
|
||||||
|
'uni-calendar-item--before-checked':weeks.beforeMultiple,
|
||||||
|
'uni-calendar-item--multiple': weeks.multiple,
|
||||||
|
'uni-calendar-item--after-checked':weeks.afterMultiple,
|
||||||
|
}">{{todayText}}</text>
|
||||||
|
<text v-if="lunar&&!weeks.extraInfo" class="uni-calendar-item__weeks-lunar-text" :class="{
|
||||||
|
'uni-calendar-item--isDay-text':weeks.isDay,
|
||||||
|
'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay,
|
||||||
|
'uni-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay,
|
||||||
|
'uni-calendar-item--before-checked':weeks.beforeMultiple,
|
||||||
|
'uni-calendar-item--multiple': weeks.multiple,
|
||||||
|
'uni-calendar-item--after-checked':weeks.afterMultiple,
|
||||||
|
'uni-calendar-item--disable':weeks.disable,
|
||||||
|
}">{{weeks.isDay ? todayText : (weeks.lunar.IDayCn === '初一'?weeks.lunar.IMonthCn:weeks.lunar.IDayCn)}}</text>
|
||||||
|
<text v-if="weeks.extraInfo&&weeks.extraInfo.info" class="uni-calendar-item__weeks-lunar-text" :class="{
|
||||||
|
'uni-calendar-item--extra':weeks.extraInfo.info,
|
||||||
|
'uni-calendar-item--isDay-text':weeks.isDay,
|
||||||
|
'uni-calendar-item--isDay':calendar.fullDate === weeks.fullDate && weeks.isDay,
|
||||||
|
'uni-calendar-item--checked':calendar.fullDate === weeks.fullDate && !weeks.isDay,
|
||||||
|
'uni-calendar-item--before-checked':weeks.beforeMultiple,
|
||||||
|
'uni-calendar-item--multiple': weeks.multiple,
|
||||||
|
'uni-calendar-item--after-checked':weeks.afterMultiple,
|
||||||
|
'uni-calendar-item--disable':weeks.disable,
|
||||||
|
}">{{weeks.extraInfo.info}}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
initVueI18n
|
||||||
|
} from '@dcloudio/uni-i18n'
|
||||||
|
import messages from './i18n/index.js'
|
||||||
|
const { t } = initVueI18n(messages)
|
||||||
|
export default {
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.uni-calendar-item__weeks-box {
|
||||||
|
flex: 1;
|
||||||
|
/* #ifndef APP-NVUE */
|
||||||
|
display: flex;
|
||||||
|
/* #endif */
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-calendar-item__weeks-box-text {
|
||||||
|
font-size: $uni-font-size-base;
|
||||||
|
color: $uni-text-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-calendar-item__weeks-lunar-text {
|
||||||
|
font-size: $uni-font-size-sm;
|
||||||
|
color: $uni-text-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-calendar-item__weeks-box-item {
|
||||||
|
position: relative;
|
||||||
|
/* #ifndef APP-NVUE */
|
||||||
|
display: flex;
|
||||||
|
/* #endif */
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
width: 100rpx;
|
||||||
|
height: 100rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-calendar-item__weeks-box-circle {
|
||||||
|
position: absolute;
|
||||||
|
top: 5px;
|
||||||
|
right: 5px;
|
||||||
|
width: 8px;
|
||||||
|
height: 8px;
|
||||||
|
border-radius: 8px;
|
||||||
|
background-color: $uni-color-error;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-calendar-item--disable {
|
||||||
|
background-color: rgba(249, 249, 249, $uni-opacity-disabled);
|
||||||
|
color: $uni-text-color-disable;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-calendar-item--isDay-text {
|
||||||
|
color: $uni-color-primary;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-calendar-item--isDay {
|
||||||
|
background-color: $uni-color-primary;
|
||||||
|
opacity: 0.8;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-calendar-item--extra {
|
||||||
|
color: $uni-color-error;
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-calendar-item--checked {
|
||||||
|
background-color: #c82626;
|
||||||
|
color: #fff;
|
||||||
|
opacity: 0.8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-calendar-item--multiple {
|
||||||
|
background-color: rgba($color: #c82626, $alpha: .2);
|
||||||
|
color: #fff;
|
||||||
|
// opacity: 0.8;
|
||||||
|
}
|
||||||
|
.uni-calendar-item--before-checked {
|
||||||
|
background-color: #c82626;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
.uni-calendar-item--after-checked {
|
||||||
|
background-color: #c82626;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,547 @@
|
|||||||
|
<template>
|
||||||
|
<view class="uni-calendar">
|
||||||
|
<view v-if="!insert&&show" class="uni-calendar__mask" :class="{'uni-calendar--mask-show':aniMaskShow}" @click="clean"></view>
|
||||||
|
<view v-if="insert || show" class="uni-calendar__content" :class="{'uni-calendar--fixed':!insert,'uni-calendar--ani-show':aniMaskShow}">
|
||||||
|
<view v-if="!insert" class="uni-calendar__header uni-calendar--fixed-top">
|
||||||
|
<view class="uni-calendar__header-btn-box" @click="close">
|
||||||
|
<text class="uni-calendar__header-text uni-calendar--fixed-width">{{cancelText}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="uni-calendar__header-btn-box" @click="confirm">
|
||||||
|
<text class="uni-calendar__header-text uni-calendar--fixed-width">{{okText}}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="uni-calendar__header">
|
||||||
|
<view class="uni-calendar__header-btn-box" @click.stop="pre">
|
||||||
|
<view class="uni-calendar__header-btn uni-calendar--left"></view>
|
||||||
|
</view>
|
||||||
|
<picker mode="date" :value="date" fields="month" @change="bindDateChange">
|
||||||
|
<text class="uni-calendar__header-text">{{ (nowDate.year||'') +' / '+( nowDate.month||'')}}</text>
|
||||||
|
</picker>
|
||||||
|
<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>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
<view class="uni-calendar__box">
|
||||||
|
<view v-if="showMonth" class="uni-calendar__box-bg">
|
||||||
|
<text class="uni-calendar__box-bg-text">{{nowDate.month}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="uni-calendar__weeks">
|
||||||
|
<view class="uni-calendar__weeks-day">
|
||||||
|
<text class="uni-calendar__weeks-day-text">{{SUNText}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="uni-calendar__weeks-day">
|
||||||
|
<text class="uni-calendar__weeks-day-text">{{monText}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="uni-calendar__weeks-day">
|
||||||
|
<text class="uni-calendar__weeks-day-text">{{TUEText}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="uni-calendar__weeks-day">
|
||||||
|
<text class="uni-calendar__weeks-day-text">{{WEDText}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="uni-calendar__weeks-day">
|
||||||
|
<text class="uni-calendar__weeks-day-text">{{THUText}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="uni-calendar__weeks-day">
|
||||||
|
<text class="uni-calendar__weeks-day-text">{{FRIText}}</text>
|
||||||
|
</view>
|
||||||
|
<view class="uni-calendar__weeks-day">
|
||||||
|
<text class="uni-calendar__weeks-day-text">{{SATText}}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="uni-calendar__weeks" v-for="(item,weekIndex) in weeks" :key="weekIndex">
|
||||||
|
<view class="uni-calendar__weeks-item" v-for="(weeks,weeksIndex) in item" :key="weeksIndex">
|
||||||
|
<calendar-item class="uni-calendar-item--hook" :weeks="weeks" :calendar="calendar" :selected="selected" :lunar="lunar" @change="choiceDate"></calendar-item>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<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)
|
||||||
|
/**
|
||||||
|
* Calendar 日历
|
||||||
|
* @description 日历组件可以查看日期,选择任意范围内的日期,打点操作。常用场景如:酒店日期预订、火车机票选择购买日期、上下班打卡等
|
||||||
|
* @tutorial https://ext.dcloud.net.cn/plugin?id=56
|
||||||
|
* @property {String} date 自定义当前时间,默认为今天
|
||||||
|
* @property {Boolean} lunar 显示农历
|
||||||
|
* @property {String} startDate 日期选择范围-开始日期
|
||||||
|
* @property {String} endDate 日期选择范围-结束日期
|
||||||
|
* @property {Boolean} range 范围选择
|
||||||
|
* @property {Boolean} insert = [true|false] 插入模式,默认为false
|
||||||
|
* @value true 弹窗模式
|
||||||
|
* @value false 插入模式
|
||||||
|
* @property {Boolean} clearDate = [true|false] 弹窗模式是否清空上次选择内容
|
||||||
|
* @property {Array} selected 打点,期待格式[{date: '2019-06-27', info: '签到', data: { custom: '自定义信息', name: '自定义消息头',xxx:xxx... }}]
|
||||||
|
* @property {Boolean} showMonth 是否选择月份为背景
|
||||||
|
* @event {Function} change 日期改变,`insert :ture` 时生效
|
||||||
|
* @event {Function} confirm 确认选择`insert :false` 时生效
|
||||||
|
* @event {Function} monthSwitch 切换月份时触发
|
||||||
|
* @example <uni-calendar :insert="true":lunar="true" :start-date="'2019-3-2'":end-date="'2019-5-20'"@change="change" />
|
||||||
|
*/
|
||||||
|
export default {
|
||||||
|
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.cale.setDate(newVal)
|
||||||
|
this.init(newVal)
|
||||||
|
},
|
||||||
|
startDate(val){
|
||||||
|
this.cale.resetSatrtDate(val)
|
||||||
|
},
|
||||||
|
endDate(val){
|
||||||
|
this.cale.resetEndDate(val)
|
||||||
|
},
|
||||||
|
selected(newVal) {
|
||||||
|
this.cale.setSelectInfo(this.nowDate.fullDate, newVal)
|
||||||
|
this.weeks = this.cale.weeks
|
||||||
|
}
|
||||||
|
},
|
||||||
|
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.init(value)
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 初始化日期显示
|
||||||
|
* @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.cale.setDate(this.date)
|
||||||
|
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() {
|
||||||
|
console.log(this.cale.getDate(new Date()).fullDate);
|
||||||
|
let date = this.cale.getDate(new Date()).fullDate
|
||||||
|
// this.cale.setDate(date)
|
||||||
|
this.init(date)
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.uni-calendar {
|
||||||
|
/* #ifndef APP-NVUE */
|
||||||
|
display: flex;
|
||||||
|
/* #endif */
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-calendar__mask {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
background-color: $uni-bg-color-mask;
|
||||||
|
transition-property: opacity;
|
||||||
|
transition-duration: 0.3s;
|
||||||
|
opacity: 0;
|
||||||
|
/* #ifndef APP-NVUE */
|
||||||
|
z-index: 99;
|
||||||
|
/* #endif */
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-calendar--mask-show {
|
||||||
|
opacity: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-calendar--fixed {
|
||||||
|
position: fixed;
|
||||||
|
bottom: calc(var(--window-bottom));
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
transition-property: transform;
|
||||||
|
transition-duration: 0.3s;
|
||||||
|
transform: translateY(460px);
|
||||||
|
/* #ifndef APP-NVUE */
|
||||||
|
z-index: 99;
|
||||||
|
/* #endif */
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-calendar--ani-show {
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-calendar__content {
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-calendar__header {
|
||||||
|
position: relative;
|
||||||
|
/* #ifndef APP-NVUE */
|
||||||
|
display: flex;
|
||||||
|
/* #endif */
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
height: 50px;
|
||||||
|
border-bottom-color: $uni-border-color;
|
||||||
|
border-bottom-style: solid;
|
||||||
|
border-bottom-width: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-calendar--fixed-top {
|
||||||
|
/* #ifndef APP-NVUE */
|
||||||
|
display: flex;
|
||||||
|
/* #endif */
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: space-between;
|
||||||
|
border-top-color: $uni-border-color;
|
||||||
|
border-top-style: solid;
|
||||||
|
border-top-width: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-calendar--fixed-width {
|
||||||
|
width: 50px;
|
||||||
|
// padding: 0 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-calendar__backtoday {
|
||||||
|
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: $uni-text-color;
|
||||||
|
background-color: $uni-bg-color-hover;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-calendar__header-text {
|
||||||
|
text-align: center;
|
||||||
|
width: 100px;
|
||||||
|
font-size: $uni-font-size-base;
|
||||||
|
color: $uni-text-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-calendar__header-btn-box {
|
||||||
|
/* #ifndef APP-NVUE */
|
||||||
|
display: flex;
|
||||||
|
/* #endif */
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 50px;
|
||||||
|
height: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-calendar__header-btn {
|
||||||
|
width: 10px;
|
||||||
|
height: 10px;
|
||||||
|
border-left-color: $uni-text-color-placeholder;
|
||||||
|
border-left-style: solid;
|
||||||
|
border-left-width: 2px;
|
||||||
|
border-top-color: $uni-color-subtitle;
|
||||||
|
border-top-style: solid;
|
||||||
|
border-top-width: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-calendar--left {
|
||||||
|
transform: rotate(-45deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-calendar--right {
|
||||||
|
transform: rotate(135deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.uni-calendar__weeks {
|
||||||
|
position: relative;
|
||||||
|
/* #ifndef APP-NVUE */
|
||||||
|
display: flex;
|
||||||
|
/* #endif */
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-calendar__weeks-item {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-calendar__weeks-day {
|
||||||
|
flex: 1;
|
||||||
|
/* #ifndef APP-NVUE */
|
||||||
|
display: flex;
|
||||||
|
/* #endif */
|
||||||
|
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 {
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-calendar__box {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-calendar__box-bg {
|
||||||
|
/* #ifndef APP-NVUE */
|
||||||
|
display: flex;
|
||||||
|
/* #endif */
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-calendar__box-bg-text {
|
||||||
|
font-size: 200px;
|
||||||
|
font-weight: bold;
|
||||||
|
color: $uni-text-color-grey;
|
||||||
|
opacity: 0.1;
|
||||||
|
text-align: center;
|
||||||
|
/* #ifndef APP-NVUE */
|
||||||
|
line-height: 1;
|
||||||
|
/* #endif */
|
||||||
|
}
|
||||||
|
</style>
|
||||||
352
uni_modules/uni-calendar/components/uni-calendar/util.js
Normal file
352
uni_modules/uni-calendar/components/uni-calendar/util.js
Normal file
@@ -0,0 +1,352 @@
|
|||||||
|
import CALENDAR from './calendar.js'
|
||||||
|
|
||||||
|
class Calendar {
|
||||||
|
constructor({
|
||||||
|
date,
|
||||||
|
selected,
|
||||||
|
startDate,
|
||||||
|
endDate,
|
||||||
|
range
|
||||||
|
} = {}) {
|
||||||
|
// 当前日期
|
||||||
|
this.date = this.getDate(new Date()) // 当前初入日期
|
||||||
|
// 打点信息
|
||||||
|
this.selected = selected || [];
|
||||||
|
// 范围开始
|
||||||
|
this.startDate = startDate
|
||||||
|
// 范围结束
|
||||||
|
this.endDate = endDate
|
||||||
|
this.range = range
|
||||||
|
// 多选状态
|
||||||
|
this.cleanMultipleStatus()
|
||||||
|
// 每周日期
|
||||||
|
this.weeks = {}
|
||||||
|
// this._getWeek(this.date.fullDate)
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 设置日期
|
||||||
|
* @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 = new Date()
|
||||||
|
}
|
||||||
|
if (typeof date !== 'object') {
|
||||||
|
date = date.replace(/-/g, '/')
|
||||||
|
}
|
||||||
|
const dd = new Date(date)
|
||||||
|
switch (str) {
|
||||||
|
case 'day':
|
||||||
|
dd.setDate(dd.getDate() + AddDayCount) // 获取AddDayCount天后的日期
|
||||||
|
break
|
||||||
|
case 'month':
|
||||||
|
if (dd.getDate() === 31) {
|
||||||
|
dd.setDate(dd.getDate() + AddDayCount)
|
||||||
|
} else {
|
||||||
|
dd.setMonth(dd.getMonth() + AddDayCount) // 获取AddDayCount天后的日期
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case 'year':
|
||||||
|
dd.setFullYear(dd.getFullYear() + AddDayCount) // 获取AddDayCount天后的日期
|
||||||
|
break
|
||||||
|
}
|
||||||
|
const y = dd.getFullYear()
|
||||||
|
const m = dd.getMonth() + 1 < 10 ? '0' + (dd.getMonth() + 1) : dd.getMonth() + 1 // 获取当前月份的日期,不足10补0
|
||||||
|
const d = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate() // 获取当前几号,不足10补0
|
||||||
|
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 isinfo = false
|
||||||
|
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) {
|
||||||
|
let dateCompBefore = this.dateCompare(this.startDate, fullDate)
|
||||||
|
disableBefore = this.dateCompare(dateCompBefore ? this.startDate : fullDate, nowDate)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.endDate) {
|
||||||
|
let dateCompAfter = this.dateCompare(fullDate, this.endDate)
|
||||||
|
disableAfter = this.dateCompare(nowDate, dateCompAfter ? this.endDate : fullDate)
|
||||||
|
}
|
||||||
|
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 = 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 = new Date()
|
||||||
|
db.setFullYear(ab[0], ab[1] - 1, ab[2])
|
||||||
|
var de = new Date()
|
||||||
|
de.setFullYear(ae[0], ae[1] - 1, ae[2])
|
||||||
|
var unixDb = db.getTime() - 24 * 60 * 60 * 1000
|
||||||
|
var unixDe = de.getTime() - 24 * 60 * 60 * 1000
|
||||||
|
for (var k = unixDb; k <= unixDe;) {
|
||||||
|
k = k + 24 * 60 * 60 * 1000
|
||||||
|
arr.push(this.getDate(new Date(parseInt(k))).fullDate)
|
||||||
|
}
|
||||||
|
return arr
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 计算阴历日期显示
|
||||||
|
*/
|
||||||
|
getlunar(year, month, date) {
|
||||||
|
return 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 {
|
||||||
|
fullDate,
|
||||||
|
year,
|
||||||
|
month,
|
||||||
|
date,
|
||||||
|
day
|
||||||
|
} = 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;
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export default Calendar
|
||||||
88
uni_modules/uni-calendar/package.json
Normal file
88
uni_modules/uni-calendar/package.json
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
{
|
||||||
|
"id": "uni-calendar",
|
||||||
|
"displayName": "uni-calendar 日历",
|
||||||
|
"version": "1.4.2",
|
||||||
|
"description": "日历组件",
|
||||||
|
"keywords": [
|
||||||
|
"uni-ui",
|
||||||
|
"uniui",
|
||||||
|
"日历",
|
||||||
|
"",
|
||||||
|
"打卡",
|
||||||
|
"日历选择"
|
||||||
|
],
|
||||||
|
"repository": "https://github.com/dcloudio/uni-ui",
|
||||||
|
"engines": {
|
||||||
|
"HBuilderX": ""
|
||||||
|
},
|
||||||
|
"directories": {
|
||||||
|
"example": "../../temps/example_temps"
|
||||||
|
},
|
||||||
|
"dcloudext": {
|
||||||
|
"category": [
|
||||||
|
"前端组件",
|
||||||
|
"通用组件"
|
||||||
|
],
|
||||||
|
"sale": {
|
||||||
|
"regular": {
|
||||||
|
"price": "0.00"
|
||||||
|
},
|
||||||
|
"sourcecode": {
|
||||||
|
"price": "0.00"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"contact": {
|
||||||
|
"qq": ""
|
||||||
|
},
|
||||||
|
"declaration": {
|
||||||
|
"ads": "无",
|
||||||
|
"data": "无",
|
||||||
|
"permissions": "无"
|
||||||
|
},
|
||||||
|
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
|
||||||
|
},
|
||||||
|
"uni_modules": {
|
||||||
|
"dependencies": [],
|
||||||
|
"encrypt": [],
|
||||||
|
"platforms": {
|
||||||
|
"cloud": {
|
||||||
|
"tcb": "y",
|
||||||
|
"aliyun": "y"
|
||||||
|
},
|
||||||
|
"client": {
|
||||||
|
"App": {
|
||||||
|
"app-vue": "y",
|
||||||
|
"app-nvue": "y"
|
||||||
|
},
|
||||||
|
"H5-mobile": {
|
||||||
|
"Safari": "y",
|
||||||
|
"Android Browser": "y",
|
||||||
|
"微信浏览器(Android)": "y",
|
||||||
|
"QQ浏览器(Android)": "y"
|
||||||
|
},
|
||||||
|
"H5-pc": {
|
||||||
|
"Chrome": "y",
|
||||||
|
"IE": "y",
|
||||||
|
"Edge": "y",
|
||||||
|
"Firefox": "y",
|
||||||
|
"Safari": "y"
|
||||||
|
},
|
||||||
|
"小程序": {
|
||||||
|
"微信": "y",
|
||||||
|
"阿里": "y",
|
||||||
|
"百度": "y",
|
||||||
|
"字节跳动": "y",
|
||||||
|
"QQ": "y"
|
||||||
|
},
|
||||||
|
"快应用": {
|
||||||
|
"华为": "u",
|
||||||
|
"联盟": "u"
|
||||||
|
},
|
||||||
|
"Vue": {
|
||||||
|
"vue2": "y",
|
||||||
|
"vue3": "u"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
103
uni_modules/uni-calendar/readme.md
Normal file
103
uni_modules/uni-calendar/readme.md
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
|
||||||
|
|
||||||
|
## Calendar 日历
|
||||||
|
> **组件名:uni-calendar**
|
||||||
|
> 代码块: `uCalendar`
|
||||||
|
|
||||||
|
|
||||||
|
日历组件
|
||||||
|
|
||||||
|
> **注意事项**
|
||||||
|
> 为了避免错误使用,给大家带来不好的开发体验,请在使用组件前仔细阅读下面的注意事项,可以帮你避免一些错误。
|
||||||
|
> - 本组件农历转换使用的js是 [@1900-2100区间内的公历、农历互转](https://github.com/jjonline/calendar.js)
|
||||||
|
> - 仅支持自定义组件模式
|
||||||
|
> - `date`属性传入的应该是一个 String ,如: 2019-06-27 ,而不是 new Date()
|
||||||
|
> - 通过 `insert` 属性来确定当前的事件是 @change 还是 @confirm 。理应合并为一个事件,但是为了区分模式,现使用两个事件,这里需要注意
|
||||||
|
> - 弹窗模式下无法阻止后面的元素滚动,如有需要阻止,请在弹窗弹出后,手动设置滚动元素为不可滚动
|
||||||
|
|
||||||
|
|
||||||
|
### 安装方式
|
||||||
|
|
||||||
|
本组件符合[easycom](https://uniapp.dcloud.io/collocation/pages?id=easycom)规范,`HBuilderX 2.5.5`起,只需将本组件导入项目,在页面`template`中即可直接使用,无需在页面中`import`和注册`components`。
|
||||||
|
|
||||||
|
如需通过`npm`方式使用`uni-ui`组件,另见文档:[https://ext.dcloud.net.cn/plugin?id=55](https://ext.dcloud.net.cn/plugin?id=55)
|
||||||
|
|
||||||
|
### 基本用法
|
||||||
|
|
||||||
|
在 ``template`` 中使用组件
|
||||||
|
|
||||||
|
```html
|
||||||
|
<view>
|
||||||
|
<uni-calendar
|
||||||
|
:insert="true"
|
||||||
|
:lunar="true"
|
||||||
|
:start-date="'2019-3-2'"
|
||||||
|
:end-date="'2019-5-20'"
|
||||||
|
@change="change"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
```
|
||||||
|
|
||||||
|
### 通过方法打开日历
|
||||||
|
|
||||||
|
需要设置 `insert` 为 `false`
|
||||||
|
|
||||||
|
```html
|
||||||
|
<view>
|
||||||
|
<uni-calendar
|
||||||
|
ref="calendar"
|
||||||
|
:insert="false"
|
||||||
|
@confirm="confirm"
|
||||||
|
/>
|
||||||
|
<button @click="open">打开日历</button>
|
||||||
|
</view>
|
||||||
|
```
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {};
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
open(){
|
||||||
|
this.$refs.calendar.open();
|
||||||
|
},
|
||||||
|
confirm(e) {
|
||||||
|
console.log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
### Calendar Props
|
||||||
|
|
||||||
|
| 属性名 | 类型 | 默认值| 说明 |
|
||||||
|
| | |
|
||||||
|
| date | String |- | 自定义当前时间,默认为今天 |
|
||||||
|
| lunar | Boolean | false | 显示农历 |
|
||||||
|
| startDate | String |- | 日期选择范围-开始日期 |
|
||||||
|
| endDate | String |- | 日期选择范围-结束日期 |
|
||||||
|
| range | Boolean | false | 范围选择 |
|
||||||
|
| insert | Boolean | false | 插入模式,可选值,ture:插入模式;false:弹窗模式;默认为插入模式 |
|
||||||
|
|clearDate |Boolean |true |弹窗模式是否清空上次选择内容 |
|
||||||
|
| selected | Array |- | 打点,期待格式[{date: '2019-06-27', info: '签到', data: { custom: '自定义信息', name: '自定义消息头',xxx:xxx... }}] |
|
||||||
|
|showMonth | Boolean | true | 是否显示月份为背景 |
|
||||||
|
|
||||||
|
### Calendar Events
|
||||||
|
|
||||||
|
| 事件名 | 说明 |返回值|
|
||||||
|
| | | |
|
||||||
|
| open | 弹出日历组件,`insert :false` 时生效|- |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## 组件示例
|
||||||
|
|
||||||
|
点击查看:[https://hellouniapp.dcloud.net.cn/pages/extUI/calendar/calendar](https://hellouniapp.dcloud.net.cn/pages/extUI/calendar/calendar)
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
var isReady=false;var onReadyCallbacks=[];
|
var isReady=false;var onReadyCallbacks=[];
|
||||||
var isServiceReady=false;var onServiceReadyCallbacks=[];
|
var isServiceReady=false;var onServiceReadyCallbacks=[];
|
||||||
var __uniConfig = {"pages":["pages/equity/index","pages/market/index","pages/store/index","pages/property/index","pages/goods/details","pages/login/login","pages/company/registered","pages/company/prompt","pages/vip/index","pages/equity/search","pages/market/logs","pages/order/buy","pages/order/index","pages/order/details","pages/order/sales","pages/goods/lists","pages/company/approve","pages/store/visitors","pages/store/customer","pages/store/basics","pages/employees/list","pages/employees/add","pages/goods/management","pages/goods/add","pages/coupons/index","pages/coupons/management","pages/verification/index","pages/verification/details"],"window":{"navigationBarTextStyle":"black","navigationBarTitleText":"易货","navigationBarBackgroundColor":"#F8F8F8","backgroundColor":"#F8F8F8"},"tabBar":{"color":"#bababa","selectedColor":"#c82626","backgroundColor":"#FFFFFF","borderStyle":"white","list":[{"pagePath":"pages/equity/index","text":"通证权易","iconPath":"static/tabBar/tabBar_icon_00.png","selectedIconPath":"static/tabBar/tabBar_show_00.png"},{"pagePath":"pages/market/index","text":"转让市场","iconPath":"static/tabBar/tabBar_icon_01.png","selectedIconPath":"static/tabBar/tabBar_show_01.png"},{"pagePath":"pages/store/index","text":"企业工具","iconPath":"static/tabBar/tabBar_icon_02.png","selectedIconPath":"static/tabBar/tabBar_show_02.png"},{"pagePath":"pages/property/index","text":"我的资产","iconPath":"static/tabBar/tabBar_icon_03.png","selectedIconPath":"static/tabBar/tabBar_show_03.png"}]},"nvueCompiler":"uni-app","nvueStyleCompiler":"uni-app","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":false,"autoclose":true},"appname":"易品新境","compilerVersion":"3.2.3","entryPagePath":"pages/store/index","entryPageQuery":"","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}};
|
var __uniConfig = {"pages":["pages/equity/index","pages/market/index","pages/store/index","pages/property/index","pages/goods/details","pages/login/login","pages/company/registered","pages/company/prompt","pages/vip/index","pages/equity/search","pages/market/logs","pages/order/buy","pages/order/index","pages/order/details","pages/order/sales","pages/goods/lists","pages/company/approve","pages/store/visitors","pages/store/customer","pages/store/basics","pages/employees/list","pages/employees/add","pages/goods/management","pages/goods/add","pages/coupons/index","pages/coupons/management","pages/coupons/add","pages/coupons/selectGoods","pages/coupons/magDetails","pages/verification/index","pages/verification/details"],"window":{"navigationBarTextStyle":"black","navigationBarTitleText":"易货","navigationBarBackgroundColor":"#F8F8F8","backgroundColor":"#F8F8F8"},"tabBar":{"color":"#bababa","selectedColor":"#c82626","backgroundColor":"#FFFFFF","borderStyle":"white","list":[{"pagePath":"pages/equity/index","text":"通证权易","iconPath":"static/tabBar/tabBar_icon_00.png","selectedIconPath":"static/tabBar/tabBar_show_00.png"},{"pagePath":"pages/market/index","text":"转让市场","iconPath":"static/tabBar/tabBar_icon_01.png","selectedIconPath":"static/tabBar/tabBar_show_01.png"},{"pagePath":"pages/store/index","text":"企业工具","iconPath":"static/tabBar/tabBar_icon_02.png","selectedIconPath":"static/tabBar/tabBar_show_02.png"},{"pagePath":"pages/property/index","text":"我的资产","iconPath":"static/tabBar/tabBar_icon_03.png","selectedIconPath":"static/tabBar/tabBar_show_03.png"}]},"nvueCompiler":"uni-app","nvueStyleCompiler":"uni-app","renderer":"auto","splashscreen":{"alwaysShowBeforeRender":false,"autoclose":true},"appname":"易品新境","compilerVersion":"3.2.3","entryPagePath":"pages/coupons/magDetails","entryPageQuery":"","realEntryPagePath":"pages/equity/index","networkTimeout":{"request":60000,"connectSocket":60000,"uploadFile":60000,"downloadFile":60000}};
|
||||||
var __uniRoutes = [{"path":"/pages/equity/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationStyle":"custom","navigationBarTextStyle":"white"}},{"path":"/pages/market/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"转让市场","titleNView":{"backgroundColor":"#FFFFFF","buttons":[{"text":"成交历史","fontSize":"14","width":"80","color":"#555555"}]}}},{"path":"/pages/store/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationStyle":"custom","navigationBarTitleText":"企业工具","navigationBarTextStyle":"white","navigationBarBackgroundColor":"#c82626"}},{"path":"/pages/property/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"","navigationStyle":"custom"}},{"path":"/pages/goods/details","meta":{},"window":{"navigationBarTitleText":"","titleNView":{"backgroundColor":"#FFFFFF","type":"transparent","buttons":[{"text":"分享","fontSize":"12","color":"#555555"}]}}},{"path":"/pages/login/login","meta":{},"window":{"navigationBarTitleText":"","navigationBarBackgroundColor":"#FFFFFF","disableScroll":true}},{"path":"/pages/company/registered","meta":{},"window":{"navigationBarTitleText":""}},{"path":"/pages/company/prompt","meta":{},"window":{"navigationBarTitleText":"","navigationBarBackgroundColor":"#FFFFFF","disableScroll":true,"titleNView":{"backgroundColor":"#FFFFFF","buttons":[{"text":"先逛一逛","fontSize":"14","width":"80","color":"#555555"}]}}},{"path":"/pages/vip/index","meta":{},"window":{"navigationBarTitleText":"会员","navigationBarBackgroundColor":"#1f1b1c","navigationBarTextStyle":"white","backgroundColor":"#fefaef"}},{"path":"/pages/equity/search","meta":{},"window":{"navigationBarTitleText":"搜索"}},{"path":"/pages/market/logs","meta":{},"window":{"navigationBarTitleText":"成交历史"}},{"path":"/pages/order/buy","meta":{},"window":{"navigationBarTitleText":"确认订单","navigationBarBackgroundColor":"#FFFFFF"}},{"path":"/pages/order/index","meta":{},"window":{"navigationBarTitleText":"订单管理"}},{"path":"/pages/order/details","meta":{},"window":{"navigationBarTitleText":"订单详情"}},{"path":"/pages/order/sales","meta":{},"window":{"navigationBarTitleText":"售后"}},{"path":"/pages/goods/lists","meta":{},"window":{"navigationBarTitleText":"商品列表","navigationBarBackgroundColor":"#FFFFFF"}},{"path":"/pages/company/approve","meta":{},"window":{"navigationBarTitleText":""}},{"path":"/pages/store/visitors","meta":{},"window":{"navigationBarTitleText":"访客统计","navigationBarBackgroundColor":"#FFFFFF"}},{"path":"/pages/store/customer","meta":{},"window":{"navigationBarTitleText":"成交客户","navigationBarBackgroundColor":"#FFFFFF"}},{"path":"/pages/store/basics","meta":{},"window":{"navigationBarTitleText":"基础信息","titleNView":{"backgroundColor":"#FFFFFF","buttons":[{"text":"保存","fontSize":"16","width":"80","color":"#c82626"}]}}},{"path":"/pages/employees/list","meta":{},"window":{"navigationBarTitleText":"员工","titleNView":{"backgroundColor":"#FFFFFF","buttons":[{"text":"添加","fontSize":"16","width":"80","color":"#c82626"}]}}},{"path":"/pages/employees/add","meta":{},"window":{"navigationBarTitleText":"添加员工","navigationBarBackgroundColor":"#FFFFFF"}},{"path":"/pages/goods/management","meta":{},"window":{"navigationBarTitleText":"商品权证"}},{"path":"/pages/goods/add","meta":{},"window":{"navigationBarTitleText":"添加权证"}},{"path":"/pages/coupons/index","meta":{},"window":{"navigationBarTitleText":"优惠券"}},{"path":"/pages/coupons/management","meta":{},"window":{"navigationBarTitleText":"优惠券管理"}},{"path":"/pages/verification/index","meta":{},"window":{"navigationBarTitleText":"扫码验证"}},{"path":"/pages/verification/details","meta":{},"window":{"navigationBarTitleText":"核销券详情"}}];
|
var __uniRoutes = [{"path":"/pages/equity/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationStyle":"custom","navigationBarTextStyle":"white"}},{"path":"/pages/market/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"转让市场","titleNView":{"backgroundColor":"#FFFFFF","buttons":[{"text":"成交历史","fontSize":"14","width":"80","color":"#555555"}]}}},{"path":"/pages/store/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationStyle":"custom","navigationBarTitleText":"企业工具","navigationBarTextStyle":"white","navigationBarBackgroundColor":"#c82626"}},{"path":"/pages/property/index","meta":{"isQuit":true,"isTabBar":true},"window":{"navigationBarTitleText":"","navigationStyle":"custom"}},{"path":"/pages/goods/details","meta":{},"window":{"navigationBarTitleText":"","titleNView":{"backgroundColor":"#FFFFFF","type":"transparent","buttons":[{"text":"分享","fontSize":"12","color":"#555555"}]}}},{"path":"/pages/login/login","meta":{},"window":{"navigationBarTitleText":"","navigationBarBackgroundColor":"#FFFFFF","disableScroll":true}},{"path":"/pages/company/registered","meta":{},"window":{"navigationBarTitleText":""}},{"path":"/pages/company/prompt","meta":{},"window":{"navigationBarTitleText":"","navigationBarBackgroundColor":"#FFFFFF","disableScroll":true,"titleNView":{"backgroundColor":"#FFFFFF","buttons":[{"text":"先逛一逛","fontSize":"14","width":"80","color":"#555555"}]}}},{"path":"/pages/vip/index","meta":{},"window":{"navigationBarTitleText":"会员","navigationBarBackgroundColor":"#1f1b1c","navigationBarTextStyle":"white","backgroundColor":"#fefaef"}},{"path":"/pages/equity/search","meta":{},"window":{"navigationBarTitleText":"搜索"}},{"path":"/pages/market/logs","meta":{},"window":{"navigationBarTitleText":"成交历史"}},{"path":"/pages/order/buy","meta":{},"window":{"navigationBarTitleText":"确认订单","navigationBarBackgroundColor":"#FFFFFF"}},{"path":"/pages/order/index","meta":{},"window":{"navigationBarTitleText":"订单管理"}},{"path":"/pages/order/details","meta":{},"window":{"navigationBarTitleText":"订单详情"}},{"path":"/pages/order/sales","meta":{},"window":{"navigationBarTitleText":"售后"}},{"path":"/pages/goods/lists","meta":{},"window":{"navigationBarTitleText":"商品列表","navigationBarBackgroundColor":"#FFFFFF"}},{"path":"/pages/company/approve","meta":{},"window":{"navigationBarTitleText":""}},{"path":"/pages/store/visitors","meta":{},"window":{"navigationBarTitleText":"访客统计","navigationBarBackgroundColor":"#FFFFFF"}},{"path":"/pages/store/customer","meta":{},"window":{"navigationBarTitleText":"成交客户","navigationBarBackgroundColor":"#FFFFFF"}},{"path":"/pages/store/basics","meta":{},"window":{"navigationBarTitleText":"基础信息","titleNView":{"backgroundColor":"#FFFFFF","buttons":[{"text":"保存","fontSize":"16","width":"80","color":"#c82626"}]}}},{"path":"/pages/employees/list","meta":{},"window":{"navigationBarTitleText":"员工","titleNView":{"backgroundColor":"#FFFFFF","buttons":[{"text":"添加","fontSize":"14","width":"80","color":"#c82626"}]}}},{"path":"/pages/employees/add","meta":{},"window":{"navigationBarTitleText":"添加员工","navigationBarBackgroundColor":"#FFFFFF"}},{"path":"/pages/goods/management","meta":{},"window":{"navigationBarTitleText":"商品权证"}},{"path":"/pages/goods/add","meta":{},"window":{"navigationBarTitleText":"添加权证"}},{"path":"/pages/coupons/index","meta":{},"window":{"navigationBarTitleText":"优惠券"}},{"path":"/pages/coupons/management","meta":{},"window":{"navigationBarTitleText":"优惠券管理","titleNView":{"backgroundColor":"#FFFFFF","buttons":[{"text":"发布","fontSize":"14","width":"80","color":"#c82626"}]}}},{"path":"/pages/coupons/add","meta":{},"window":{"navigationBarTitleText":"添加优惠券","navigationBarBackgroundColor":"#FFFFFF"}},{"path":"/pages/coupons/selectGoods","meta":{},"window":{"navigationBarTitleText":"选择产品","navigationBarBackgroundColor":"#FFFFFF"}},{"path":"/pages/coupons/magDetails","meta":{},"window":{"navigationBarTitleText":"优惠券详情"}},{"path":"/pages/verification/index","meta":{},"window":{"navigationBarTitleText":"扫码验证"}},{"path":"/pages/verification/details","meta":{},"window":{"navigationBarTitleText":"核销券详情"}}];
|
||||||
__uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
|
__uniConfig.onReady=function(callback){if(__uniConfig.ready){callback()}else{onReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"ready",{get:function(){return isReady},set:function(val){isReady=val;if(!isReady){return}const callbacks=onReadyCallbacks.slice(0);onReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
|
||||||
__uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
|
__uniConfig.onServiceReady=function(callback){if(__uniConfig.serviceReady){callback()}else{onServiceReadyCallbacks.push(callback)}};Object.defineProperty(__uniConfig,"serviceReady",{get:function(){return isServiceReady},set:function(val){isServiceReady=val;if(!isServiceReady){return}const callbacks=onServiceReadyCallbacks.slice(0);onServiceReadyCallbacks.length=0;callbacks.forEach(function(callback){callback()})}});
|
||||||
service.register("uni-app-config",{create(a,b,c){if(!__uniConfig.viewport){var d=b.weex.config.env.scale,e=b.weex.config.env.deviceWidth,f=Math.ceil(e/d);Object.assign(__uniConfig,{viewport:f,defaultFontSize:Math.round(f/20)})}return{instance:{__uniConfig:__uniConfig,__uniRoutes:__uniRoutes,global:void 0,window:void 0,document:void 0,frames:void 0,self:void 0,location:void 0,navigator:void 0,localStorage:void 0,history:void 0,Caches:void 0,screen:void 0,alert:void 0,confirm:void 0,prompt:void 0,fetch:void 0,XMLHttpRequest:void 0,WebSocket:void 0,webkit:void 0,print:void 0}}}});
|
service.register("uni-app-config",{create(a,b,c){if(!__uniConfig.viewport){var d=b.weex.config.env.scale,e=b.weex.config.env.deviceWidth,f=Math.ceil(e/d);Object.assign(__uniConfig,{viewport:f,defaultFontSize:Math.round(f/20)})}return{instance:{__uniConfig:__uniConfig,__uniRoutes:__uniRoutes,global:void 0,window:void 0,document:void 0,frames:void 0,self:void 0,location:void 0,navigator:void 0,localStorage:void 0,history:void 0,Caches:void 0,screen:void 0,alert:void 0,confirm:void 0,prompt:void 0,fetch:void 0,XMLHttpRequest:void 0,WebSocket:void 0,webkit:void 0,print:void 0}}}});
|
||||||
|
|||||||
2985
unpackage/dist/dev/app-plus/app-service.js
vendored
2985
unpackage/dist/dev/app-plus/app-service.js
vendored
File diff suppressed because one or more lines are too long
3703
unpackage/dist/dev/app-plus/app-view.js
vendored
3703
unpackage/dist/dev/app-plus/app-view.js
vendored
File diff suppressed because one or more lines are too long
2
unpackage/dist/dev/app-plus/manifest.json
vendored
2
unpackage/dist/dev/app-plus/manifest.json
vendored
@@ -1 +1 @@
|
|||||||
{"@platforms":["android","iPhone","iPad"],"id":"__UNI__CD19AAD","name":"易品新境","version":{"name":"1.0.0","code":"100"},"description":"易品新境为商家提供营销引流工具","launch_path":"__uniappview.html","developer":{"name":"","email":"","url":""},"permissions":{"OAuth":{},"Payment":{},"Share":{},"UniNView":{"description":"UniNView原生渲染"}},"plus":{"useragent":{"value":"uni-app","concatenate":true},"splashscreen":{"autoclose":false,"waiting":true,"delay":0},"popGesture":"close","launchwebview":{"id":"1","kernel":"WKWebview"},"statusbar":{"immersed":"supportedDevice","style":"dark","background":"#F8F8F8"},"usingComponents":true,"nvueStyleCompiler":"uni-app","compilerVersion":3,"safearea":{"bottom":{"offset":"none"}},"distribute":{"icons":{"android":{"hdpi":"unpackage/res/icons/72x72.png","xhdpi":"unpackage/res/icons/96x96.png","xxhdpi":"unpackage/res/icons/144x144.png","xxxhdpi":"unpackage/res/icons/192x192.png"},"ios":{"appstore":"unpackage/res/icons/1024x1024.png","ipad":{"app":"unpackage/res/icons/76x76.png","app@2x":"unpackage/res/icons/152x152.png","notification":"unpackage/res/icons/20x20.png","notification@2x":"unpackage/res/icons/40x40.png","proapp@2x":"unpackage/res/icons/167x167.png","settings":"unpackage/res/icons/29x29.png","settings@2x":"unpackage/res/icons/58x58.png","spotlight":"unpackage/res/icons/40x40.png","spotlight@2x":"unpackage/res/icons/80x80.png"},"iphone":{"app@2x":"unpackage/res/icons/120x120.png","app@3x":"unpackage/res/icons/180x180.png","notification@2x":"unpackage/res/icons/40x40.png","notification@3x":"unpackage/res/icons/60x60.png","settings@2x":"unpackage/res/icons/58x58.png","settings@3x":"unpackage/res/icons/87x87.png","spotlight@2x":"unpackage/res/icons/80x80.png","spotlight@3x":"unpackage/res/icons/120x120.png"}}},"splashscreen":{"androidStyle":"common"},"google":{"permissions":["<uses-feature android:name=\"android.hardware.camera\"/>","<uses-feature android:name=\"android.hardware.camera.autofocus\"/>","<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>","<uses-permission android:name=\"android.permission.CAMERA\"/>","<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>","<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>","<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>","<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>","<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>","<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>","<uses-permission android:name=\"android.permission.READ_LOGS\"/>","<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>","<uses-permission android:name=\"android.permission.VIBRATE\"/>","<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>","<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"]},"apple":{},"plugins":{"oauth":{"univerify":{},"weixin":{"appid":"wx222fbe58feee7819","appsecret":"3d24525a636d7573a8fae885097d5cf7","UniversalLinks":""}},"payment":{"weixin":{"__platform__":["android"],"appid":"wx222fbe58feee7819","UniversalLinks":""}},"share":{"weixin":{"appid":"wx222fbe58feee7819","UniversalLinks":""}},"maps":{},"ad":{},"audio":{"mp3":{"description":"Android平台录音支持MP3格式文件"}}}},"arguments":"{\"id\":1,\"name\":\"pages/store/index\",\"pathName\":\"pages/store/index\",\"query\":\"\"}","allowsInlineMediaPlayback":true,"uni-app":{"compilerVersion":"3.2.3","control":"uni-v3","nvueCompiler":"uni-app","renderer":"auto","nvue":{"flex-direction":"column"},"nvueLaunchMode":"normal"},"tabBar":{"color":"#bababa","selectedColor":"#c82626","backgroundColor":"#FFFFFF","borderStyle":"rgba(255,255,255,0.4)","list":[{"pagePath":"pages/equity/index","text":"通证权易","iconPath":"static/tabBar/tabBar_icon_00.png","selectedIconPath":"static/tabBar/tabBar_show_00.png"},{"pagePath":"pages/market/index","text":"转让市场","iconPath":"static/tabBar/tabBar_icon_01.png","selectedIconPath":"static/tabBar/tabBar_show_01.png"},{"pagePath":"pages/store/index","text":"企业工具","iconPath":"static/tabBar/tabBar_icon_02.png","selectedIconPath":"static/tabBar/tabBar_show_02.png"},{"pagePath":"pages/property/index","text":"我的资产","iconPath":"static/tabBar/tabBar_icon_03.png","selectedIconPath":"static/tabBar/tabBar_show_03.png"}],"height":"50px","child":["lauchwebview"],"selected":2},"launch_path":"__uniappview.html"}}
|
{"@platforms":["android","iPhone","iPad"],"id":"__UNI__CD19AAD","name":"易品新境","version":{"name":"1.0.0","code":"100"},"description":"易品新境为商家提供营销引流工具","launch_path":"__uniappview.html","developer":{"name":"","email":"","url":""},"permissions":{"OAuth":{},"Payment":{},"Share":{},"UniNView":{"description":"UniNView原生渲染"}},"plus":{"useragent":{"value":"uni-app","concatenate":true},"splashscreen":{"autoclose":false,"waiting":true,"delay":0},"popGesture":"close","launchwebview":{"id":"1","kernel":"WKWebview"},"statusbar":{"immersed":"supportedDevice","style":"dark","background":"#F8F8F8"},"usingComponents":true,"nvueStyleCompiler":"uni-app","compilerVersion":3,"safearea":{"bottom":{"offset":"none"}},"distribute":{"icons":{"android":{"hdpi":"unpackage/res/icons/72x72.png","xhdpi":"unpackage/res/icons/96x96.png","xxhdpi":"unpackage/res/icons/144x144.png","xxxhdpi":"unpackage/res/icons/192x192.png"},"ios":{"appstore":"unpackage/res/icons/1024x1024.png","ipad":{"app":"unpackage/res/icons/76x76.png","app@2x":"unpackage/res/icons/152x152.png","notification":"unpackage/res/icons/20x20.png","notification@2x":"unpackage/res/icons/40x40.png","proapp@2x":"unpackage/res/icons/167x167.png","settings":"unpackage/res/icons/29x29.png","settings@2x":"unpackage/res/icons/58x58.png","spotlight":"unpackage/res/icons/40x40.png","spotlight@2x":"unpackage/res/icons/80x80.png"},"iphone":{"app@2x":"unpackage/res/icons/120x120.png","app@3x":"unpackage/res/icons/180x180.png","notification@2x":"unpackage/res/icons/40x40.png","notification@3x":"unpackage/res/icons/60x60.png","settings@2x":"unpackage/res/icons/58x58.png","settings@3x":"unpackage/res/icons/87x87.png","spotlight@2x":"unpackage/res/icons/80x80.png","spotlight@3x":"unpackage/res/icons/120x120.png"}}},"splashscreen":{"androidStyle":"common"},"google":{"permissions":["\u003cuses-feature android:name\u003d\"android.hardware.camera\"/\u003e","\u003cuses-feature android:name\u003d\"android.hardware.camera.autofocus\"/\u003e","\u003cuses-permission android:name\u003d\"android.permission.ACCESS_NETWORK_STATE\"/\u003e","\u003cuses-permission android:name\u003d\"android.permission.ACCESS_WIFI_STATE\"/\u003e","\u003cuses-permission android:name\u003d\"android.permission.CAMERA\"/\u003e","\u003cuses-permission android:name\u003d\"android.permission.CHANGE_NETWORK_STATE\"/\u003e","\u003cuses-permission android:name\u003d\"android.permission.CHANGE_WIFI_STATE\"/\u003e","\u003cuses-permission android:name\u003d\"android.permission.FLASHLIGHT\"/\u003e","\u003cuses-permission android:name\u003d\"android.permission.GET_ACCOUNTS\"/\u003e","\u003cuses-permission android:name\u003d\"android.permission.MODIFY_AUDIO_SETTINGS\"/\u003e","\u003cuses-permission android:name\u003d\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/\u003e","\u003cuses-permission android:name\u003d\"android.permission.READ_LOGS\"/\u003e","\u003cuses-permission android:name\u003d\"android.permission.READ_PHONE_STATE\"/\u003e","\u003cuses-permission android:name\u003d\"android.permission.VIBRATE\"/\u003e","\u003cuses-permission android:name\u003d\"android.permission.WAKE_LOCK\"/\u003e","\u003cuses-permission android:name\u003d\"android.permission.WRITE_SETTINGS\"/\u003e"]},"apple":{},"plugins":{"oauth":{"univerify":{},"weixin":{"appid":"wx222fbe58feee7819","appsecret":"3d24525a636d7573a8fae885097d5cf7","UniversalLinks":""}},"payment":{"weixin":{"__platform__":["android"],"appid":"wx222fbe58feee7819","UniversalLinks":""}},"share":{"weixin":{"appid":"wx222fbe58feee7819","UniversalLinks":""}},"maps":{},"ad":{},"audio":{"mp3":{"description":"Android平台录音支持MP3格式文件"}}}},"allowsInlineMediaPlayback":true,"uni-app":{"compilerVersion":"3.2.3","control":"uni-v3","nvueCompiler":"uni-app","renderer":"auto","nvue":{"flex-direction":"column"},"nvueLaunchMode":"normal"},"tabBar":{"color":"#bababa","selectedColor":"#c82626","backgroundColor":"#FFFFFF","borderStyle":"rgba(255,255,255,0.4)","list":[{"pagePath":"pages/equity/index","text":"通证权易","iconPath":"static/tabBar/tabBar_icon_00.png","selectedIconPath":"static/tabBar/tabBar_show_00.png"},{"pagePath":"pages/market/index","text":"转让市场","iconPath":"static/tabBar/tabBar_icon_01.png","selectedIconPath":"static/tabBar/tabBar_show_01.png"},{"pagePath":"pages/store/index","text":"企业工具","iconPath":"static/tabBar/tabBar_icon_02.png","selectedIconPath":"static/tabBar/tabBar_show_02.png"},{"pagePath":"pages/property/index","text":"我的资产","iconPath":"static/tabBar/tabBar_icon_03.png","selectedIconPath":"static/tabBar/tabBar_show_03.png"}],"height":"50px"},"launch_path":"__uniappview.html","arguments":"{\"pathName\":\"pages/coupons/magDetails\",\"query\":\"\"}"}}
|
||||||
Reference in New Issue
Block a user