| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504 |
- // 网站基本信息
- companyInfo = {
- url: 'http://det.shandongewall.com/',
- main: 'alloutlong',
- year: new Date().getFullYear(),
- };
- headapi = process.env.NODE_ENV === 'development' ? '/api/' : '../';
- headbpi = process.env.NODE_ENV === 'development' ? '/bpi/' : 'http://cal.beswell.com:85/';
- headcpi = process.env.NODE_ENV === 'development' ? 'http://192.168.0.62:9010/' : 'http://cal.beswell.com:85/DataTransfer/';
- // 常用选项
- globalQuipState = function () {
- let option = [
- {
- value: '',
- label: '全部'
- }, {
- value: '0',
- label: '新入库'
- }, {
- value: '1',
- label: '未售'
- },
- ];
- return option
- };
- // 开始时间
- globalBt = function () {
- const et = new Date();
- const bt = new Date("2019-01-01 00:00:01");
- return [bt, et];
- };
- globalBt2 = function (days) {
- const et = new Date();
- const bt = new Date();
- days = days ? days : 0;
- bt.setTime(bt.getTime() - 3600 * 1000 * 24 * days);
- return [bt, et];
- };
- // 格式化时间
- globalfmtDate = function (datetime, length) {
- if ((datetime == '') || (datetime == undefined))
- return '';
- if ((datetime == '1900-01-01') || (datetime == '1900-01-01 00:00:00.000'))
- return '';
- length = !length ? 10 : length;//缺省参数
- return (datetime != null) ? datetime.substr(0, length) : '';
- };
- getHoursAndMin = function (datetime) {
- let date = new Date(datetime);
- h = date.getHours() < 10 ? '0' + date.getHours() + ':' : date.getHours() + ':';
- m = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes();
- return h + m;
- }
- // 格式化时间去掉T
- nonTfmtDate = function (datetime) {
- if ((datetime == '') || (datetime == undefined))
- return '';
- if ((datetime == '1900-01-01') || (datetime == '1900-01-01 00:00:00.000'))
- return '';
- datetime = new Date(+new Date(datetime) + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '');
- return datetime
- };
- // 格式化时间去掉T
- nonTfmtDatetoLength = function (datetime, length) {
- if ((datetime == '') || (datetime == undefined))
- return '';
- if ((datetime == '1900-01-01') || (datetime == '1900-01-01 00:00:00.000'))
- return '';
- length = !length ? 10 : length;//缺省参数
- datetime = new Date(+new Date(datetime) + 8 * 3600 * 1000).toISOString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '').substr(0, length);
- return datetime
- };
- /**
- * 获取当前时间字符串
- * @param mYear 几年后
- * @param mMonth 几个月后
- * @returns {string}
- */
- getDate = function (mYear, mMonth) {
- let date = new Date();
- let split = "-";
- let year = date.getFullYear() + mYear;
- let month = date.getMonth() + 1 + mMonth;
- let strDate = date.getDate();
- if (month >= 1 && month <= 9) {
- month = "0" + month;
- }
- if (strDate >= 0 && strDate <= 9) {
- strDate = "0" + strDate;
- }
- let thisData = year + split + month + split + strDate;
- return thisData;
- };
- /**
- * 获取当前时间字符串
- * @param mDate 时间基准
- * @param mYear 几年后
- * @param mMonth 几个月后
- * @param mDay 几天后
- * @returns {string}
- */
- getDate = function (mDate, mYear, mMonth, mDay) {
- let date = new Date(mDate);
- let split = "-";
- let year = date.getFullYear() + mYear;
- let month = date.getMonth() + 1 + mMonth;
- let day = date.getDate() + mDay;
- let hh = new Date().getHours();
- let mf = new Date().getMinutes() < 10 ? '0' + new Date().getMinutes() : new Date().getMinutes();
- let ss = new Date().getSeconds() < 10 ? '0' + new Date().getSeconds() : new Date().getSeconds();
- //处理'日'越界
- if (day < 1) {
- month--;
- day = new Date(year, month, 0).getDate() + day;
- }
- let monthDays = new Date(year, month, 0).getDate();//这个月本应该多少天
- if (day > monthDays) {
- day = day - monthDays;
- month++;
- }
- //处理'月'越界
- if (month < 1) {
- year--;
- month += 12;
- }
- if (month > 12) {
- year++;
- month -= 12;
- }
- //10以下的月数和天数拼接0
- if (month >= 1 && month <= 9) {
- month = "0" + month;
- }
- if (day >= 0 && day <= 9) {
- day = "0" + day;
- }
- let thisData = year + split + month + split + day;
- return thisData;
- };
- // 校验内容长度
- globalValid = function (data, mins, maxs, text, that) {
- let thisVal = data;
- let thisLeng = thisVal.length;
- let min = parseInt(mins);
- let max = parseInt(maxs);
- let dispalyMin = min + 1;
- let title = '警告';
- if (thisVal == '') {
- that.$message({
- message: text + '不能为空!',
- type: 'warning'
- });
- return false
- } else if (thisLeng <= min) {
- that.$message({
- message: text + '最少' + dispalyMin + '字符!',
- type: 'warning'
- });
- return false
- } else if (thisLeng > max) {
- that.$message({
- message: text + '超出限制数量!',
- type: 'warning'
- });
- return false
- } else {
- return true
- }
- };
- // 手机号码格式
- globalCheckPhone = function (val) {
- let re = /^1[3|4|5|6|7|8|9][0-9]\d{8}$/;
- val = val.toString();
- if (val.search(re) == -1) {
- return false;
- } else {
- return true;
- }
- };
- getNowDate = function () {
- let date = new Date();
- let y = date.getFullYear();
- let m = date.getMonth() + 1;
- let d = date.getDate();
- let H = date.getHours();
- let mm = date.getMinutes();
- let s = date.getSeconds()
- m = m < 10 ? "0" + m : m;
- d = d < 10 ? "0" + d : d;
- // H = H < 10 ? "0" + H : H;
- return y + "年" + m + "月" + d + "日";
- }
- globalcurrentWeek = function () {
- let weeks = new Date().getDay();
- return getNowDate() + ' ' + numberToWeekdays(weeks) + ' 第' + getWeekOfYear() + '周';
- }
- getWeekOfYear = function (date) {
- let today = new Date(date);
- let firstDay = new Date(today.getFullYear(), 0, 1);
- let dayOfWeek = firstDay.getDay();
- let spendDay = 1;
- if (dayOfWeek != 0) {
- spendDay = 7 - dayOfWeek + 1;
- }
- firstDay = new Date(today.getFullYear(), 0, 1 + spendDay);
- let d = Math.ceil((today.valueOf() - firstDay.valueOf()) / 86400000);
- let result = Math.ceil(d / 7);
- return result + 1;
- };
- // table配置项目
- // 每页选项
- pageOptions = function () {
- let option = [
- {
- value: 10,
- label: '10'
- }, {
- value: 25,
- label: '25'
- }, {
- value: 50,
- label: '50'
- }, {
- value: 100,
- label: '100'
- }, {
- value: 2000,
- label: '2000'
- },
- ];
- return option
- };
- // 到期日
- endTypeOptions = function () {
- let option = [
- {
- value: -99999,
- label: '全部'
- }, {
- value: 0,
- label: '已过期'
- }, {
- value: 30,
- label: '一个月'
- }, {
- value: 180,
- label: '半年'
- }, {
- value: 360,
- label: '一年'
- },
- ];
- return option
- }
- //会员类型
- vipOptions = function (i) {
- let option = [];
- if (i == 0) {
- option = [
- {
- value: -99,
- label: '全部'
- }, {
- value: 1,
- label: '年费会员'
- }, {
- value: 2,
- label: '充值会员'
- },
- ];
- } else {
- option = [
- {
- value: 1,
- label: '年费会员'
- }, {
- value: 2,
- label: '充值会员'
- },
- ];
- }
- return option
- }
- turnResToOption = function (data) {
- if (!data) return false
- let ids = data.map(item => {
- return {
- label: item.user_name + ' ' + item.usercode,
- key: item.uu_user_id,
- value: item.uu_user_id,
- }
- });
- return ids
- };
- turnResToOptionByViper = function (data) {
- if (!data) return false;
- let ids = data.map(item => {
- return {
- label: item.Name + ' ' + item.Phone,
- key: parseInt(item.Id),
- value: parseInt(item.Id),
- }
- });
- return ids
- };
- turnResToOptionBySimViper = function (data) {
- if (!data) return false;
- let ids = data.map(item => {
- return {
- label: item.user_name + ' ' + item.usercode,
- key: item.uu_user_id,
- value: item.uu_user_id,
- RemainHour: item.remain_hour,
- }
- });
- return ids
- };
- turnResToOptionByTempUser = function (data) {
- if (!data) return false;
- let ids = data.map(item => {
- return {
- label: item.UserName + ' ' + item.Phone,
- key: parseInt(item.TuId),
- value: parseInt(item.TuId),
- RemainHour: parseInt(item.RemainHour),
- }
- });
- return ids
- };
- turnResToOptionByCoach = function (data) {
- if (!data) return false;
- let ids = data.map(item => {
- return {
- label: item.Name + ' ' + item.Phone,
- key: parseInt(item.TeacherId),
- value: parseInt(item.TeacherId),
- }
- });
- return ids
- };
- turnResToOptionByUsers = function (data) {
- if (!data) return false
- let ids = data.map(item => {
- return {
- label: item.Name + ' ' + item.Phone,
- key: parseInt(item.Id),
- value: parseInt(item.Id),
- }
- })
- return ids
- }
- turnClassResToOption = function (data) {
- if (data == null) return false
- if (!data) return false
- let ids = data.map(item => {
- return {
- label: item.class_name,
- key: parseInt(item.class_id),
- value: parseInt(item.class_id),
- ClassColor: item.class_color,
- }
- })
- return ids
- }
- turnShopResToOption = function (data) {
- if (!data) return false;
- let ids = data.map(item => {
- return {
- label: item.ShopName,
- key: parseInt(item.ShopID),
- value: parseInt(item.ShopID)
- }
- })
- return ids
- };
- turnStdToOption = function (data) {
- if (!data) return false
- let ids = data.map(item => {
- return {
- label: item.class_name + '(' + item.begin_str + '-' + item.end_str + ')',
- key: parseInt(item.std_id),
- value: item.uu_std_id,
- classId: parseInt(item.class_id),
- ConsumeHour: item.consume_hour
- }
- })
- return ids
- };
- turnResToOptionByGroup = function (data) {
- if (!data) return false;
- let ids = data.map(item => {
- return {
- label: item.GroupName,
- key: parseInt(item.GroupId),
- value: parseInt(item.GroupId),
- }
- });
- return ids
- };
- numberToWeekdays = function (val) {
- switch (parseInt(val)) {
- case 1:
- return '星期一';
- break;
- case 2:
- return '星期二';
- break;
- case 3:
- return '星期三';
- break;
- case 4:
- return '星期四';
- break;
- case 5:
- return '星期五';
- break;
- case 6:
- return '星期六';
- break;
- case 0:
- return '星期天';
- break;
- }
- };
- // 获取年份列表
- getyearOptions = function (val) {
- let num = parseInt(val);
- let res = [];
- let item = {};
- let curYear = new Date().getFullYear();
- for (let i = 0; i < num; i++) {
- item[i] = {
- value: curYear - i, label: curYear - i + '年'
- }
- }
- return item
- };
- // 深拷贝
- deepClone = function (obj) {
- let _obj = JSON.stringify(obj),
- objClone = JSON.parse(_obj);
- return objClone
- };
- getSignStr = function (jsonStr) {
- return "123123123";
- }
- //课程类型
- courseOptions = function () {
- let option = [];
- option = [
- {
- value: 1,
- label: '室内课'
- }, {
- value: 2,
- label: '户外课'
- }, {
- value: 3,
- label: '线上课'
- }, {
- value: 4,
- label: '混合课'
- },
- ];
- return option
- }
|