mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-10-02 02:06:38 +08:00
commit
dfc1c5fe89
@ -473,32 +473,27 @@ export const goodsmessage = (productCode) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//优惠券的查询
|
//优惠券的查询
|
||||||
export const getdiscount = (memberId,channelSecurity,mobile) => {
|
export const getdiscount = (memberId,channelSecurity,mobile) => {
|
||||||
var data = {
|
var data = {
|
||||||
memberId:memberId,
|
memberId:memberId,
|
||||||
mobile:mobile
|
mobile:mobile
|
||||||
}
|
}
|
||||||
return fetch('memberAddress?type=getAll', data, 'POST' )
|
return fetch('memberAddress?type=getAll', data, 'POST' )
|
||||||
}
|
}
|
||||||
|
|
||||||
//可用的优惠券
|
//可用的优惠券
|
||||||
export const alldiscount = (memberId,channelSecurity,mobile) => {
|
export const alldiscount = (paramsObj) => {
|
||||||
var data = {
|
var data = paramsObj;
|
||||||
memberId:memberId,
|
return fetch('couponConfig?type=getAll', data, 'POST' )
|
||||||
}
|
}
|
||||||
return fetch('couponConfig?type=getAll', data, 'POST' )
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//用户领取的优惠券
|
//用户领取的优惠券
|
||||||
export const getdraw = (mobile,states) => {
|
export const getdraw = (paramsObj) => {
|
||||||
var data = {
|
var data = paramsObj;
|
||||||
mobile:mobile,
|
return fetch('coupon?type=getAll', data, 'POST' )
|
||||||
status:states
|
}
|
||||||
}
|
|
||||||
return fetch('coupon?type=getAll', data, 'POST' )
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//微信支付
|
//微信支付
|
||||||
|
@ -141,8 +141,14 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
...mapMutations(["changemessage","checkIsLogin"]),
|
...mapMutations(["changemessage","checkIsLogin"]),
|
||||||
//获取用户领取的优惠券
|
//获取用户领取的优惠券
|
||||||
async userdraw(mobile,states) {
|
async userdraw(mobile) {
|
||||||
let data = await getdraw(mobile,states);
|
//let curDate = new Date();
|
||||||
|
let paramsToAPI = {
|
||||||
|
mobile : mobile,
|
||||||
|
//useStartDate : curDate.getYear()+'-'+curDate.getMonth()+'-'+curDate.getDate(),
|
||||||
|
//productCodes : ''
|
||||||
|
};
|
||||||
|
let data = await getdraw(paramsToAPI);
|
||||||
let _self = this;
|
let _self = this;
|
||||||
if(data){
|
if(data){
|
||||||
let list = [];
|
let list = [];
|
||||||
@ -211,10 +217,16 @@ export default {
|
|||||||
if(coupon.fValidTo) {
|
if(coupon.fValidTo) {
|
||||||
valDateToTime = new Date(coupon.fValidTo).getTime();
|
valDateToTime = new Date(coupon.fValidTo).getTime();
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
if(valDateFromTime && valDateToTime && curTime >= valDateFromTime && curTime <= valDateToTime && coupon.status == 0) {
|
if(valDateFromTime && valDateToTime && curTime >= valDateFromTime && curTime <= valDateToTime && coupon.status == 0) {
|
||||||
coupon.canUse=true;
|
coupon.canUse=true;
|
||||||
this.newlist.push(coupon);
|
this.newlist.push(coupon);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
if(valDateToTime && curTime <= valDateToTime && coupon.status == 0) {
|
||||||
|
coupon.canUse=true;
|
||||||
|
this.newlist.push(coupon);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case USED:
|
case USED:
|
||||||
if(coupon.status == 1) {
|
if(coupon.status == 1) {
|
||||||
|
@ -388,15 +388,29 @@ export default {
|
|||||||
},
|
},
|
||||||
//获取用户领取的优惠券
|
//获取用户领取的优惠券
|
||||||
async userdraw(mobile) {
|
async userdraw(mobile) {
|
||||||
let data = await getdraw(mobile);
|
let curDate = new Date();
|
||||||
let _self = this;
|
let productCodes = [];
|
||||||
let curTime = new Date().getTime();
|
for(let itemInCart of this.goldmedal) {
|
||||||
let valDateFromTime=0;
|
productCodes.push(itemInCart.productCode);
|
||||||
let valDateToTime=0;
|
}
|
||||||
let dateChecked=true;
|
let paramsToAPI = {
|
||||||
let avaliableCouponNum = 0;
|
mobile : mobile,
|
||||||
|
useStartDate : curDate.getFullYear()+'-'+(curDate.getMonth()+1)+'-'+curDate.getDate(),
|
||||||
|
};
|
||||||
|
if(productCodes)
|
||||||
|
paramsToAPI.productCodes = productCodes.join(',');
|
||||||
|
let data = await getdraw(paramsToAPI);
|
||||||
|
let _self = this;
|
||||||
|
let curTime = new Date().getTime();
|
||||||
|
let valDateFromTime=0;
|
||||||
|
let valDateToTime=0;
|
||||||
|
let dateChecked=true;
|
||||||
|
let avaliableCouponNum = 0;
|
||||||
if (data) {
|
if (data) {
|
||||||
this.drawlist=[];
|
this.drawlist=[];
|
||||||
|
avaliableCouponNum = data.length;
|
||||||
|
this.drawlist = data.data;
|
||||||
|
/*
|
||||||
for(let itemInCart of this.goldmedal) {
|
for(let itemInCart of this.goldmedal) {
|
||||||
let tmpIndex=0;
|
let tmpIndex=0;
|
||||||
for(let myCoupon of data.data) {
|
for(let myCoupon of data.data) {
|
||||||
@ -439,6 +453,7 @@ export default {
|
|||||||
tmpIndex++;
|
tmpIndex++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
if(avaliableCouponNum > 0) {
|
if(avaliableCouponNum > 0) {
|
||||||
this.curCoupon.couponName = '有 '+avaliableCouponNum+' 张优惠券可以使用';
|
this.curCoupon.couponName = '有 '+avaliableCouponNum+' 张优惠券可以使用';
|
||||||
}
|
}
|
||||||
|
@ -472,7 +472,7 @@ export default {
|
|||||||
this.curItem.curGoodUrl = this.curItem.goodUrl.pc;
|
this.curItem.curGoodUrl = this.curItem.goodUrl.pc;
|
||||||
}
|
}
|
||||||
this.usermessage = this.$store.state.userInfo;
|
this.usermessage = this.$store.state.userInfo;
|
||||||
if (this.usermessage !== "" || this.usermessage.data !== undefined) {
|
//if (this.usermessage !== "" || this.usermessage.data !== undefined) {
|
||||||
this.productCode = this.$route.query.productCode;
|
this.productCode = this.$route.query.productCode;
|
||||||
_hmt.push([
|
_hmt.push([
|
||||||
"_trackCustomEvent",
|
"_trackCustomEvent",
|
||||||
@ -483,7 +483,7 @@ export default {
|
|||||||
"product_name": this.curItem.productName,
|
"product_name": this.curItem.productName,
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
}
|
//}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapMutations(["changemessage","checkIsLogin"]),
|
...mapMutations(["changemessage","checkIsLogin"]),
|
||||||
@ -562,8 +562,19 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
//获取所有的优惠券
|
//获取所有的优惠券
|
||||||
async alldrawlist(memberId) {
|
async alldrawlist() {
|
||||||
let data = await alldiscount(memberId);
|
this.checkIsLogin();
|
||||||
|
this.usermessage = this.$store.state.userInfo;
|
||||||
|
let storeCode = '';
|
||||||
|
if(this.usermessage && this.usermessage.data && this.usermessage.data.storeCode) {
|
||||||
|
storeCode = this.usermessage.data.storeCode
|
||||||
|
}
|
||||||
|
let paramsToAPI={
|
||||||
|
productCode:this.curItem.productCode,
|
||||||
|
};
|
||||||
|
if(storeCode)
|
||||||
|
paramsToAPI.stroeCode = stroeCode;
|
||||||
|
let data = await alldiscount(paramsToAPI);
|
||||||
let userlist = [];
|
let userlist = [];
|
||||||
let menulsit = [];
|
let menulsit = [];
|
||||||
if (data) {
|
if (data) {
|
||||||
@ -574,9 +585,6 @@ export default {
|
|||||||
this.userlist.forEach((element, index) => {
|
this.userlist.forEach((element, index) => {
|
||||||
if (typeof element.productCodes == "string" || !element.productCodes) {
|
if (typeof element.productCodes == "string" || !element.productCodes) {
|
||||||
userlist.push(element);
|
userlist.push(element);
|
||||||
// let s=element.productCodes.split(',');
|
|
||||||
// console.log(s.indexOf(this.productCode) != -1 )
|
|
||||||
// console.log('这是字符串')
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
let menualist = [];
|
let menualist = [];
|
||||||
@ -585,7 +593,7 @@ export default {
|
|||||||
let valDateToTime=0;
|
let valDateToTime=0;
|
||||||
let curTime = new Date().getTime();
|
let curTime = new Date().getTime();
|
||||||
let dateChecked=true;
|
let dateChecked=true;
|
||||||
|
/*
|
||||||
if(item.publishFrom && curTime < item.publishFrom) {
|
if(item.publishFrom && curTime < item.publishFrom) {
|
||||||
dateChecked=false;
|
dateChecked=false;
|
||||||
}
|
}
|
||||||
@ -614,6 +622,8 @@ export default {
|
|||||||
if(item.packageTypeIds!='1') {
|
if(item.packageTypeIds!='1') {
|
||||||
dateChecked=false;
|
dateChecked=false;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if(this.mainProduct && this.mainProduct.petType && item.petCategoryIds) {
|
if(this.mainProduct && this.mainProduct.petType && item.petCategoryIds) {
|
||||||
if(this.mainProduct.petType===0 && item.petCategoryIds!='1')
|
if(this.mainProduct.petType===0 && item.petCategoryIds!='1')
|
||||||
dateChecked=false;
|
dateChecked=false;
|
||||||
@ -625,7 +635,7 @@ export default {
|
|||||||
if(item.petAgeTypeIds!=productToCouponAgeId)
|
if(item.petAgeTypeIds!=productToCouponAgeId)
|
||||||
dateChecked=false;
|
dateChecked=false;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
if(dateChecked && item.activityId!=10) {
|
if(dateChecked && item.activityId!=10) {
|
||||||
if(!item.productCodes) {
|
if(!item.productCodes) {
|
||||||
menualist.push(item);
|
menualist.push(item);
|
||||||
@ -640,6 +650,12 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
//Expired coupons
|
//Expired coupons
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
if(dateChecked) {
|
||||||
|
menualist.push(item);
|
||||||
|
} else {
|
||||||
|
//Expired coupons
|
||||||
|
}
|
||||||
});
|
});
|
||||||
this.usernewlist = menualist;
|
this.usernewlist = menualist;
|
||||||
}
|
}
|
||||||
@ -755,7 +771,7 @@ export default {
|
|||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
//this.userdraw(this.usermessage.data.mobile);
|
//this.userdraw(this.usermessage.data.mobile);
|
||||||
this.alldrawlist(this.usermessage.data.id);
|
this.alldrawlist();
|
||||||
this.dialogInfo1 = true;
|
this.dialogInfo1 = true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user