Commit d32c1704 by zhangmeng

修复状态不对的bug

parent 51b5bd15
......@@ -34,7 +34,7 @@ export const fillZero = (num) => {
* @param {*转换的格式} type
*/
export const formateDateTimeByType = (date, type = 'yyyy-MM-dd-HH-mm-ss') => {
if (!date){return ''}
if (!date) { return '' }
if (typeof date === 'number') {
date = new Date(date);
}
......@@ -43,7 +43,7 @@ export const formateDateTimeByType = (date, type = 'yyyy-MM-dd-HH-mm-ss') => {
} else {
var year = type.indexOf('yyyy') >= 0 ? (fillZero(date.getFullYear())) : '';
var month = type.indexOf('MM') >= 0 ? ('-' + fillZero(date.getMonth() + 1)) : '';
var day = type.indexOf('dd') >= 0 ? ('-' + fillZero(date.getDate())+'') : '';
var day = type.indexOf('dd') >= 0 ? ('-' + fillZero(date.getDate()) + '') : '';
var hours = type.indexOf('HH') >= 0 ? (' ' + fillZero(date.getHours())) : '';
var min = type.indexOf('mm') >= 0 ? (':' + fillZero(date.getMinutes())) : '';
var sec = type.indexOf('ss') >= 0 ? (':' + fillZero(date.getSeconds())) : '';
......@@ -55,20 +55,20 @@ export const formateDateTimeByType = (date, type = 'yyyy-MM-dd-HH-mm-ss') => {
export const numberToChinese = (num) => {
var chnNumChar = {
:0,
:1,
:2,
:3,
:4,
:5,
:6,
:7,
:8,
:9,
:10
: 0,
: 1,
: 2,
: 3,
: 4,
: 5,
: 6,
: 7,
: 8,
: 9,
: 10
};
let result = '';
for(let i in chnNumChar) {
for (let i in chnNumChar) {
if (num === chnNumChar[i]) {
result = i
}
......@@ -78,16 +78,16 @@ export const numberToChinese = (num) => {
export const numberToWeekChinese = (num) => {
var chnNumChar = {
:0,
:1,
:2,
:3,
:4,
:5,
:6
: 0,
: 1,
: 2,
: 3,
: 4,
: 5,
: 6
};
let result = '--';
for(let i in chnNumChar) {
for (let i in chnNumChar) {
if (num === chnNumChar[i]) {
result = i
}
......@@ -133,14 +133,14 @@ function swapItems(arr, index1, index2) {
};
// 上移
export const upRecord = function(arr, $index) {
if($index == 0) {
if ($index == 0) {
return;
}
swapItems(arr, $index, $index - 1);
};
// 下移
export const downRecord = function(arr, $index) {
if($index == arr.length -1) {
if ($index == arr.length - 1) {
return;
}
swapItems(arr, $index, $index + 1);
......@@ -148,9 +148,9 @@ export const downRecord = function(arr, $index) {
//字符串判断是否为空
export const voidStr = function(str,msg) {
export const voidStr = function(str, msg) {
if (!str) {
Vue.prototype.$tips({type:'warning',message:msg || '内容填写不全'})
Vue.prototype.$tips({ type: 'warning', message: msg || '内容填写不全' })
return true;
} else {
return false;
......@@ -159,17 +159,17 @@ export const voidStr = function(str,msg) {
/**
* 频率控制 返回函数连续调用时,action 执行频率限定为 次 / delay
* @param delay {number} 延迟时间,单位毫秒
* @param action {function} 请求关联函数,实际应用需要调用的函数
* @return {function} 返回客户调用函数
*/
* 频率控制 返回函数连续调用时,action 执行频率限定为 次 / delay
* @param delay {number} 延迟时间,单位毫秒
* @param action {function} 请求关联函数,实际应用需要调用的函数
* @return {function} 返回客户调用函数
*/
export const throttle = function(delay, action){
export const throttle = function(delay, action) {
var last = 0;
return function(){
return function() {
var curr = +new Date()
if (curr - last > delay){
if (curr - last > delay) {
action.apply(this, arguments)
last = curr
}
......@@ -180,15 +180,15 @@ export const throttle = function(delay, action){
* 验证是否为网址
*/
export const checkUrl = function (urlString) {
if(urlString!=""){
var reg=/(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/;
if(!reg.test(urlString)){
Vue.prototype.$tips({type:"warning",message:"网址不规范,示例:http://www.domain.com"});
export const checkUrl = function(urlString) {
if (urlString != "") {
var reg = /(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/;
if (!reg.test(urlString)) {
Vue.prototype.$tips({ type: "warning", message: "网址不规范,示例:http://www.domain.com" });
return true;
}
}else {
Vue.prototype.$tips({type:"warning",message:"网址不规范,示例:http://www.domain.com"});
} else {
Vue.prototype.$tips({ type: "warning", message: "网址不规范,示例:http://www.domain.com" });
return true;
}
return false;
......@@ -196,3 +196,24 @@ export const checkUrl = function (urlString) {
// 对Date的扩展,将 Date 转化为指定格式的String
// 月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符,
// 年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字)
// 例子:
// (new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423
// (new Date()).Format("yyyy-M-d h:m:s.S") ==> 2006-7-2 8:9:4.18
export const format = function(date, fmt) { //author: meizz
var o = {
"M+": date.getMonth() + 1, //月份
"d+": date.getDate(), //日
"h+": date.getHours(), //小时
"m+": date.getMinutes(), //分
"s+": date.getSeconds(), //秒
"q+": Math.floor((date.getMonth() + 3) / 3), //季度
"S": date.getMilliseconds() //毫秒
};
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o)
if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
return fmt;
}
\ No newline at end of file
......@@ -69,7 +69,7 @@ export default {
},
methods:{
filterAvatar(img) {
return img?img.replace(/^http/,'https'):this.defaultAvatar;
return img?img.replace(/^http(s)?/,'https'):this.defaultAvatar;
},
getSingleInfo() {
getMemberInfo({memberId:this.row.memberId}).then(res => {
......
......@@ -60,7 +60,7 @@
<script>
import { getPageCardsList, deleteProService } from '@/service/api/mallApi.js';
import updateCount from '../common/update-count';
import {formateDateTimeByType} from '@/utils/index.js';
import {formateDateTimeByType,format} from '@/utils/index.js';
export default {
name: 'coupon-list',
components: {
......@@ -144,7 +144,7 @@ export default {
var _o = item.exchangeTimeList[k] ;
var start = _o.exchangeTimeBeginNumber ;
var end = _o.exchangeTimeEndNumber ;
var _now = Date.now() ;
var _now = format(new Date(),'hhmm') ;
if(_now >= start && _now <= end) {
dhzt_show_html = '<span class="dm-status--primary">正常</span>';
dhzt_show = '正常';
......@@ -168,6 +168,7 @@ export default {
dhzt_show_html = '<span class="dm-status--info">已下架</span>';
dhzt_show = "已下架" ;
}
return {
text:dhzt_show,
html:dhzt_show_html
......
......@@ -234,6 +234,7 @@ export default {
})();
}
},
// 新增兑换时段-部分时段
addTimeRange() {
let length = this.timeRangeList.length;
......@@ -258,8 +259,6 @@ export default {
// 提交保存
submitService() {
console.log(this.form.cashCost, this.form.costValue)
if (this.form.costValue < this.form.cashCost) {
this.$tips({ type: 'warning', message: '现金费用不能大于礼品成本' });
return;
......@@ -268,6 +267,10 @@ export default {
this.$tips({ type: 'warning', message: '礼品主图不能为空' });
return;
}
if (this.form.changeType === 1 && !this.form.proReferId) {
this.$tips({ type: 'warning', message: '请选择优惠券' });
return;
}
let params = {
integralMallProId: this.form.integralMallProId || '',
proType: this.form.changeType === 1 ? 2 : 3, // 商品类型 1 优惠券,2礼品,3实物
......
......@@ -93,7 +93,7 @@
<script>
import { getPageGiftList, getCategoryList, deleteProService ,setHotStatusService} from '@/service/api/mallApi.js';
import updateCount from '../common/update-count';
import {formateDateTimeByType} from '@/utils/index.js';
import {formateDateTimeByType,format} from '@/utils/index.js';
export default {
name: 'gift-list',
components: {
......@@ -188,7 +188,7 @@ export default {
var _o = item.exchangeTimeList[k] ;
var start = _o.exchangeTimeBeginNumber ;
var end = _o.exchangeTimeEndNumber ;
var _now = Date.now() ;
var _now = format(new Date(),'hhmm') ;
if(_now >= start && _now <= end) {
dhzt_show_html = '<span class="dm-status--primary">正常</span>';
dhzt_show = '正常';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment