Commit d32c1704 by zhangmeng

修复状态不对的bug

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