mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-10-02 02:06:38 +08:00
Coupon restriction updated
This commit is contained in:
parent
9244fbec3d
commit
6c6b712d17
@ -423,6 +423,14 @@ export const dogquery = (productCode,type) => {
|
||||
return fetch('h5/product/query', data, 'POST' )
|
||||
}
|
||||
|
||||
//查询商品信息
|
||||
export const productQuery = (productCode) => {
|
||||
var data = {
|
||||
productCode:productCode
|
||||
}
|
||||
return fetch('product/query', data, 'POST' )
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -74,6 +74,29 @@ let util = {
|
||||
if(mapping.hasOwnProperty(paytype))
|
||||
return mapping[paytype];
|
||||
return '';
|
||||
},
|
||||
/*
|
||||
couponDisplayFilter(couponList,filterObj,returnRequirement){
|
||||
//Dictionary : filterObj {}
|
||||
|
||||
const EXPIRED = 4;
|
||||
const UNUSED = 3;
|
||||
const USED = 2;
|
||||
const ALL = 1;
|
||||
let returnList = [];
|
||||
|
||||
if(!returnRequirement || returnRequirement>EXPIRED || returnRequirement<ALL) {
|
||||
returnRequirement = ALL;
|
||||
}
|
||||
|
||||
for (let coupon of couponList) {
|
||||
switch(returnRequirement) {
|
||||
case EXPIRED:
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
export default util;
|
@ -36,7 +36,7 @@ export default async(url = '', data = {}, type = 'GET', method = 'fetch') => {
|
||||
'Content-Type': 'application/json',
|
||||
'x-access-token': token
|
||||
},
|
||||
// mode: 'cors',
|
||||
mode: 'cors',
|
||||
// channelId:'H5@2021',
|
||||
cache: 'force-cache'
|
||||
}
|
||||
|
@ -5,22 +5,6 @@
|
||||
<!-- Suppose in header end -->
|
||||
<div class="ts-banner-swiper-container">
|
||||
<swiper :options="headerSwiperOption">
|
||||
<swiper-slide>
|
||||
<a href="#" target="_blank">
|
||||
<picture>
|
||||
<source
|
||||
media="(max-width: 768px)"
|
||||
srcset="/images/banner/pc-weixin.png"
|
||||
/>
|
||||
<source
|
||||
media="(min-width: 769px)"
|
||||
srcset="/images/banner/weixin.png"
|
||||
/>
|
||||
<img src="/images/banner/pc-weixin.png" />
|
||||
</picture>
|
||||
</a>
|
||||
</swiper-slide>
|
||||
|
||||
<swiper-slide>
|
||||
<a @click="toMiniShop" target="_blank">
|
||||
<picture>
|
||||
|
@ -70,10 +70,15 @@
|
||||
<script>
|
||||
import {allConfig,getdraw} from "../../ajax/getData";
|
||||
import tabs from "@/components/tabs.vue";
|
||||
import { mapMutations } from "vuex";
|
||||
const EXPIRED = 2;
|
||||
const UNUSE = 0;
|
||||
const USED = 1;
|
||||
|
||||
export default {
|
||||
// middleware: 'metaTitle',
|
||||
// // middleware: 'metaTitle',
|
||||
// meta: {title: '优惠券'},
|
||||
async asyncData (context) {
|
||||
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
crumbs:[
|
||||
@ -91,9 +96,8 @@ export default {
|
||||
usermessage:[],
|
||||
userstates:0,
|
||||
userimage: require("../../assets/image/unused.png"),
|
||||
newlist: [
|
||||
|
||||
],
|
||||
fullCouponList:[],
|
||||
newlist: [],
|
||||
discountlist: [
|
||||
{
|
||||
title: "未使用",
|
||||
@ -134,7 +138,7 @@ export default {
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
|
||||
...mapMutations(["changemessage","checkIsLogin"]),
|
||||
//获取用户领取的优惠券
|
||||
async userdraw(mobile,states) {
|
||||
let data = await getdraw(mobile,states);
|
||||
@ -148,56 +152,77 @@ export default {
|
||||
list.push(element);
|
||||
}
|
||||
});
|
||||
this.newlist = list;
|
||||
this.fullCouponList = list;
|
||||
}
|
||||
},
|
||||
selectGoods(item, index) {
|
||||
this.activeIndex = index;
|
||||
if (this.activeIndex == 1) {
|
||||
this.userload = false;
|
||||
this.pastdue = true;
|
||||
this.userimage = require("../../assets/image/hasused.png");
|
||||
this.userstates=1
|
||||
console.log(this.$refs.userleft);
|
||||
this.usercolor={color:'white'}
|
||||
|
||||
|
||||
this.userdraw(this.usermessage.data.mobile,1)
|
||||
}
|
||||
if (this.activeIndex == 0) {
|
||||
this.userload = true;
|
||||
this.pastdue = false;
|
||||
this.userdraw(this.usermessage.data.mobile,0)
|
||||
this.usercolor={color:'#e1001a'}
|
||||
this.userstates=0
|
||||
this.userimage = require("../../assets/image/unused.png");
|
||||
}
|
||||
if (this.activeIndex == 2) {
|
||||
this.userload = false;
|
||||
this.pastdue = true;
|
||||
this.userdraw(this.usermessage.data.mobile,2)
|
||||
this.userstates=2
|
||||
this.usercolor={color:'white'}
|
||||
this.userimage = require("../../assets/image/expired.png");
|
||||
}
|
||||
console.log(index);
|
||||
},
|
||||
|
||||
selectGoods(item, index) {
|
||||
this.activeIndex = index;
|
||||
if (this.activeIndex == USED) {
|
||||
this.userload = false;
|
||||
this.pastdue = true;
|
||||
this.userimage = require("../../assets/image/hasused.png");
|
||||
this.userstates=1
|
||||
this.usercolor={color:'white'}
|
||||
//this.userdraw(this.usermessage.data.mobile,1)
|
||||
}
|
||||
if (this.activeIndex == UNUSE) {
|
||||
this.userload = true;
|
||||
this.pastdue = false;
|
||||
//this.userdraw(this.usermessage.data.mobile,0)
|
||||
this.usercolor={color:'#e1001a'}
|
||||
this.userstates=0
|
||||
this.userimage = require("../../assets/image/unused.png");
|
||||
}
|
||||
if (this.activeIndex == EXPIRED) {
|
||||
this.userload = false;
|
||||
this.pastdue = true;
|
||||
//this.userdraw(this.usermessage.data.mobile,2)
|
||||
this.userstates=2
|
||||
this.usercolor={color:'white'}
|
||||
this.userimage = require("../../assets/image/expired.png");
|
||||
}
|
||||
this.couponStatusFilter(this.activeIndex);
|
||||
},
|
||||
couponStatusFilter(status){
|
||||
let curTime = new Date().getTime();
|
||||
let valDateFromTime;
|
||||
let valDateToTime;
|
||||
this.newlist = [];
|
||||
status = (!status || status>EXPIRED || status<UNUSE)?UNUSE:status;
|
||||
for(let coupon of this.fullCouponList) {
|
||||
switch(status) {
|
||||
case EXPIRED:
|
||||
if(coupon) {
|
||||
if(coupon.fValidTo) {
|
||||
valDateToTime = new Date(coupon.fValidTo).getTime();
|
||||
}
|
||||
if(curTime > valDateToTime && coupon.status==0) {
|
||||
this.newlist.push(coupon);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case UNUSE:
|
||||
if(coupon.fValidFrom) {
|
||||
valDateFromTime = new Date(coupon.fValidFrom).getTime();
|
||||
}
|
||||
if(coupon.fValidTo) {
|
||||
valDateToTime = new Date(coupon.fValidTo).getTime();
|
||||
}
|
||||
if(valDateFromTime && valDateToTime && curTime >= valDateFromTime && curTime <= valDateToTime && coupon.status == 0) {
|
||||
this.newlist.push(coupon);
|
||||
}
|
||||
break;
|
||||
case USED:
|
||||
if(coupon.status == 1) {
|
||||
this.newlist.push(coupon);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
usertiao(){
|
||||
this.$router.push({ name: "productdetails-productlist",
|
||||
|
||||
})
|
||||
this.$router.push({ name: "productdetails-productlist",})
|
||||
},
|
||||
|
||||
|
||||
|
||||
// tanchu() {
|
||||
// console.log('---')
|
||||
// var option = {
|
||||
// customer: {id: '', name: '', email: '', mobile: '', memberId: '999999'}
|
||||
// }
|
||||
// dis_livchat(option);
|
||||
// }
|
||||
},
|
||||
|
||||
directives: {
|
||||
@ -212,12 +237,13 @@ export default {
|
||||
|
||||
},
|
||||
mounted() {
|
||||
if(this.usermessage!=='' ||this.usermessage.data!==undefined){
|
||||
this.usermessage= JSON.parse(localStorage.getItem("userInfo"));
|
||||
|
||||
}
|
||||
|
||||
this.userdraw(this.usermessage.data.mobile,);
|
||||
this.checkIsLogin();
|
||||
this.usermessage = this.$store.state.userInfo;
|
||||
if(!this.usermessage){
|
||||
this.$router.push({ path: "/userlogin/login"})
|
||||
}
|
||||
this.userdraw(this.usermessage.data.mobile);
|
||||
this.selectGoods('',0);
|
||||
},
|
||||
components: {
|
||||
Myheader,
|
||||
|
@ -119,7 +119,7 @@
|
||||
<s class="ts-ecprice" v-if="curItem.ecPrice<curItem.rsp"
|
||||
>¥{{ curItem.rsp }}
|
||||
</s>
|
||||
<span class="ts-record" v-if="curItem.basePoint!==0">
|
||||
<span class="ts-record" v-if="(curItem.basePoint && curItem.basePoint!==0)">
|
||||
购买该商品你将获得<span class="rc-zeta">{{curItem.basePoint}}积分</span>
|
||||
</span>
|
||||
|
||||
@ -302,7 +302,8 @@ import {
|
||||
getdraw,
|
||||
alldiscount,
|
||||
oncequery,
|
||||
biaomessage
|
||||
biaomessage,
|
||||
productQuery
|
||||
} from "../../ajax/getData";
|
||||
|
||||
export default {
|
||||
@ -315,6 +316,7 @@ export default {
|
||||
let productAttachmentList = [];
|
||||
let userlistmenu = [];
|
||||
isRxGoods = (isRxGoods == '1'?true:false);
|
||||
let mainProduct = undefined;
|
||||
let mainProductCode = context.route.query.mainProductCode;
|
||||
let productCode = context.route.query.productCode;
|
||||
let activeIndexa = 0;
|
||||
@ -334,6 +336,7 @@ export default {
|
||||
productAttachmentList = [insertTmpObj];
|
||||
userbuy = false;
|
||||
} else {
|
||||
mainProduct = await productQuery(mainProductCode);
|
||||
let stopLeftAllotmentChecking = false;
|
||||
let stopIndex = 0;
|
||||
for(let singleCode of productCode) {
|
||||
@ -374,7 +377,8 @@ export default {
|
||||
videolist,
|
||||
productAttachmentList,
|
||||
userbuy,
|
||||
isRxGoods
|
||||
isRxGoods,
|
||||
mainProduct
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@ -590,6 +594,15 @@ export default {
|
||||
if(valDateToTime && curTime > valDateToTime) {
|
||||
dateChecked=false;
|
||||
}
|
||||
if(item.packageTypeIds!='1') {
|
||||
dateChecked=false;
|
||||
}
|
||||
if(this.mainProduct && this.mainProduct.petType) {
|
||||
if(this.mainProduct.petType===0 && item.petCategoryIds!='1')
|
||||
dateChecked=false;
|
||||
if(this.mainProduct.petType===1 && item.petCategoryIds!='2')
|
||||
dateChecked=false;
|
||||
}
|
||||
if(dateChecked && item.activityId!=10) {
|
||||
if(!item.productCodes) {
|
||||
menualist.push(item);
|
||||
|
@ -123,13 +123,12 @@ methods:{
|
||||
// },
|
||||
usertiao(item,index){
|
||||
if(item.price=='登录/注册' ||index==0){
|
||||
this.$router.push({
|
||||
path: "/userlogin/login",
|
||||
query: {
|
||||
stype: 1,
|
||||
},
|
||||
});
|
||||
|
||||
this.$router.push({
|
||||
path: "/userlogin/login",
|
||||
query: {
|
||||
stype: 1,
|
||||
},
|
||||
});
|
||||
}if(item.price=='登出'){
|
||||
localStorage.clear();
|
||||
this.usernewlist[0].price='登录/注册'
|
||||
|
Loading…
Reference in New Issue
Block a user