Merge pull request !202 from Admin/sit-Carl
This commit is contained in:
Admin 2022-03-03 04:15:42 +00:00 committed by Gitee
commit 095157702e
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
11 changed files with 241 additions and 115 deletions

View File

@ -423,6 +423,17 @@ export const dogquery = (productCode,type) => {
return fetch('h5/product/query', data, 'POST' ) return fetch('h5/product/query', data, 'POST' )
} }
//查询商品信息
export const productQuery = (productCode) => {
let url = 'product/query';
if(productCode) {
url += '?productCode='+encodeURI(productCode);
}
var data = {
}
return fetch(url, data, 'POST' )
}

View File

@ -74,6 +74,44 @@ let util = {
if(mapping.hasOwnProperty(paytype)) if(mapping.hasOwnProperty(paytype))
return mapping[paytype]; return mapping[paytype];
return ''; return '';
},
getAgeMapping(tagAgeStr){
let mapping = {
"1":'<4月龄,离乳期', //奶糕
"2":'4-12月龄,幼年',//幼年
"3":'1-7岁,成年',//成年
"4":'>7岁,老年',//老年
};
for(let id in mapping) {
let item = mapping[id];
if(item.indexOf(tagAgeStr)>-1) {
return id;
} }
}
return false;
},
/*
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; export default util;

View File

@ -36,7 +36,7 @@ export default async(url = '', data = {}, type = 'GET', method = 'fetch') => {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
'x-access-token': token 'x-access-token': token
}, },
// mode: 'cors', mode: 'cors',
// channelId:'H5@2021', // channelId:'H5@2021',
cache: 'force-cache' cache: 'force-cache'
} }

View File

@ -5,22 +5,6 @@
<!-- Suppose in header end --> <!-- Suppose in header end -->
<div class="ts-banner-swiper-container"> <div class="ts-banner-swiper-container">
<swiper :options="headerSwiperOption"> <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> <swiper-slide>
<a @click="toMiniShop" target="_blank"> <a @click="toMiniShop" target="_blank">
<picture> <picture>
@ -52,15 +36,15 @@
</a> </a>
</swiper-slide> </swiper-slide>
<!-- <swiper-slide> <swiper-slide>
<a href="/" target="_blank"> <a href="#">
<picture> <picture>
<source media="(max-width: 768px)" srcset="/images/banner/four.jpg"> <source media="(max-width: 768px)" srcset="/images/banner/38.jpg">
<source media="(min-width: 769px)" srcset="/images/banner/pc-banner4.png"> <source media="(min-width: 769px)" srcset="/images/banner/pc-38.png">
<img src="/images/banner/four.jpg"> <img src="/images/banner/four.jpg">
</picture> </picture>
</a> </a>
</swiper-slide> --> </swiper-slide>
</swiper> </swiper>
<div <div
id="homeBannerSwiperPagnation" id="homeBannerSwiperPagnation"
@ -1415,7 +1399,16 @@ export default {
toMiniShop(){ toMiniShop(){
let isMobile = this.util.isMobile(); let isMobile = this.util.isMobile();
if(isMobile) { if(isMobile) {
_hmt.push([
"_trackCustomEvent",
"jump_to_crmMiniApp",
{
"type": "home_banner"
}
])
setTimeout(function(){
window.location.href="https://miniapp-product.royalcanin.com.cn/rcmini2020/admin/Voucher/urlRedirect.html"; window.location.href="https://miniapp-product.royalcanin.com.cn/rcmini2020/admin/Voucher/urlRedirect.html";
},800);
} else { } else {
this.showMiniShopQr=true; this.showMiniShopQr=true;
// /images/qrcode-minishop.png // /images/qrcode-minishop.png

View File

@ -48,10 +48,11 @@
</i> </i>
<div class="rc-userfont" :style="(item.validTo?'visibility:visible':'visibility:hidden')"> <div class="rc-userfont" :style="(item.validTo?'visibility:visible':'visibility:hidden')">
<strong>有效期</strong> <strong>有效期</strong>
<span>{{item.validFrom}}</span> <span>{{item.validFrom}}</span>
<span></span>
<em>{{item.validTo}}</em> <em>{{item.validTo}}</em>
</div> </div>
<nuxt-link :to="`/productdetails/productlist`" v-if="activeIndex==0"> <nuxt-link :to="`/productdetails/productlist`" v-if="item.canUse">
<div class="ts-standard-btn"> <div class="ts-standard-btn">
立即使用 立即使用
</div> </div>
@ -70,10 +71,15 @@
<script> <script>
import {allConfig,getdraw} from "../../ajax/getData"; import {allConfig,getdraw} from "../../ajax/getData";
import tabs from "@/components/tabs.vue"; import tabs from "@/components/tabs.vue";
import { mapMutations } from "vuex";
const EXPIRED = 2;
const UNUSE = 0;
const USED = 1;
export default { export default {
// middleware: 'metaTitle', async asyncData (context) {
// // middleware: 'metaTitle',
// meta: {title: ''}, },
data() { data() {
return { return {
crumbs:[ crumbs:[
@ -91,9 +97,8 @@ export default {
usermessage:[], usermessage:[],
userstates:0, userstates:0,
userimage: require("../../assets/image/unused.png"), userimage: require("../../assets/image/unused.png"),
newlist: [ fullCouponList:[],
newlist: [],
],
discountlist: [ discountlist: [
{ {
title: "未使用", title: "未使用",
@ -134,7 +139,7 @@ export default {
}; };
}, },
methods: { methods: {
...mapMutations(["changemessage","checkIsLogin"]),
// //
async userdraw(mobile,states) { async userdraw(mobile,states) {
let data = await getdraw(mobile,states); let data = await getdraw(mobile,states);
@ -148,56 +153,81 @@ export default {
list.push(element); list.push(element);
} }
}); });
this.newlist = list; this.fullCouponList = list;
this.selectGoods('',UNUSE);
} }
}, },
selectGoods(item, index) { selectGoods(item, index) {
this.activeIndex = index; this.activeIndex = index;
if (this.activeIndex == 1) { if (this.activeIndex == USED) {
this.userload = false; this.userload = false;
this.pastdue = true; this.pastdue = true;
this.userimage = require("../../assets/image/hasused.png"); this.userimage = require("../../assets/image/hasused.png");
this.userstates=1 this.userstates=1
console.log(this.$refs.userleft);
this.usercolor={color:'white'} this.usercolor={color:'white'}
//this.userdraw(this.usermessage.data.mobile,1)
this.userdraw(this.usermessage.data.mobile,1)
} }
if (this.activeIndex == 0) { if (this.activeIndex == UNUSE) {
this.userload = true; this.userload = true;
this.pastdue = false; this.pastdue = false;
this.userdraw(this.usermessage.data.mobile,0) //this.userdraw(this.usermessage.data.mobile,0)
this.usercolor={color:'#e1001a'} this.usercolor={color:'#e1001a'}
this.userstates=0 this.userstates=0
this.userimage = require("../../assets/image/unused.png"); this.userimage = require("../../assets/image/unused.png");
} }
if (this.activeIndex == 2) { if (this.activeIndex == EXPIRED) {
this.userload = false; this.userload = false;
this.pastdue = true; this.pastdue = true;
this.userdraw(this.usermessage.data.mobile,2) //this.userdraw(this.usermessage.data.mobile,2)
this.userstates=2 this.userstates=2
this.usercolor={color:'white'} this.usercolor={color:'white'}
this.userimage = require("../../assets/image/expired.png"); this.userimage = require("../../assets/image/expired.png");
} }
console.log(index); 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) {
coupon.canUse=false;
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) {
coupon.canUse=true;
this.newlist.push(coupon);
}
break;
case USED:
if(coupon.status == 1) {
coupon.canUse=false;
this.newlist.push(coupon);
}
break;
}
}
}, },
usertiao(){ 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: { directives: {
@ -212,12 +242,12 @@ export default {
}, },
mounted() { mounted() {
if(this.usermessage!=='' ||this.usermessage.data!==undefined){ this.checkIsLogin();
this.usermessage= JSON.parse(localStorage.getItem("userInfo")); this.usermessage = this.$store.state.userInfo;
if(!this.usermessage){
this.$router.push({ path: "/userlogin/login"})
} }
this.userdraw(this.usermessage.data.mobile);
this.userdraw(this.usermessage.data.mobile,);
}, },
components: { components: {
Myheader, Myheader,

View File

@ -424,7 +424,7 @@ export default {
if(myCoupon.udf2!='H5') { if(myCoupon.udf2!='H5') {
dateChecked=false; dateChecked=false;
} }
//TODO add more checking
if(dateChecked && myCoupon.activityId != 10 && myCoupon.status == 0 && (!myCoupon.productCodes || myCoupon.productCodes.indexOf(itemInCart.productCode)>-1)) { if(dateChecked && myCoupon.activityId != 10 && myCoupon.status == 0 && (!myCoupon.productCodes || myCoupon.productCodes.indexOf(itemInCart.productCode)>-1)) {
data.data.splice(tmpIndex,1); data.data.splice(tmpIndex,1);
_self.drawlist.push(myCoupon); _self.drawlist.push(myCoupon);
@ -635,21 +635,25 @@ export default {
this.goldmedal = JSON.parse(this.$route.query.list); this.goldmedal = JSON.parse(this.$route.query.list);
this.getAddressList(); this.getAddressList();
this.checkIsLogin(); this.checkIsLogin();
let user = this.$store.state.userInfo;
let memberId = '';
if(user)
memberId = user.data.id;
this.finalAmount = this.sumPrice; this.finalAmount = this.sumPrice;
this.goldmedal.forEach((item) => { this.goldmedal.forEach((item) => {
_hmt.push([ _hmt.push([
"_trackCustomEvent", "_trackCustomEvent",
"placing_order", "placing_order",
{ {
//TODO order id add here "member_id": memberId,
"product_id":item.productCode, "product_id": item.productCode,
"product_name": item.productName, "product_name": item.productName,
"product_quantity" : item.buyCount, "product_quantity" : item.buyCount,
"product_amount" : item.buyCount*item.productPrice, "product_amount" : item.buyCount*item.productPrice,
} }
]) ])
}); });
let user = this.$store.state.userInfo;
if(user) { if(user) {
this.userdraw(user.data.mobile); this.userdraw(user.data.mobile);
} }

View File

@ -73,16 +73,21 @@
</div> </div>
<h3 class="title">支付成功</h3> <h3 class="title">支付成功</h3>
<p>您的商品我们正在抓紧打包请耐心等候</p> <p>您的商品我们正在抓紧打包请耐心等候</p>
<div class="rc-md-up">
<div class="line_dashed"></div> <div class="line_dashed"></div>
<div class="userer"> <div class="userer">
<div class="qrcode"> <div class="qrcode">
<img src="/images/qrcode-wxgroup.jpg"> <img src="/images/qrcode-wxgroup.jpg">
</div> </div>
<p>微信扫一扫识别二维码</p> <p>微信扫一扫识别二维码</p>
<p class="tips">加入社群0元试用商品随单发放</p> <p class="tips">加入社群0元试用商品随单发放</p>
</div> </div>
</div> </div>
<div class="rc-md-down">
<p class="tips">加入社群0元试用商品随单发放</p>
<div class="ts-standard-btn center rc-margin-y--lg" @click="toMiniShop">点击加入社群</div>
</div>
</div>
</el-dialog> </el-dialog>
<el-dialog :visible.sync="dialogFail" @close="closeDialogFail"> <el-dialog :visible.sync="dialogFail" @close="closeDialogFail">
<div class="tc dl_cont"> <div class="tc dl_cont">
@ -102,7 +107,7 @@
import Myheader from "~/components/header.vue"; import Myheader from "~/components/header.vue";
import tabs from "@/components/tabs.vue"; import tabs from "@/components/tabs.vue";
import vueQr from 'vue-qr' import vueQr from 'vue-qr'
import { mapMutations } from "vuex";
import { generateOrderAlipay, updateOrderWX, monitorOrderNotify,repayOrde } from "../../ajax/getData"; import { generateOrderAlipay, updateOrderWX, monitorOrderNotify,repayOrde } from "../../ajax/getData";
import util from "@/ajax/util"; import util from "@/ajax/util";
@ -153,6 +158,7 @@ export default {
this.defaultHandlePayment(); this.defaultHandlePayment();
}, },
methods: { methods: {
...mapMutations(["checkIsLogin"]),
detectQrcodeDisplay(){ detectQrcodeDisplay(){
let payType = this.util.pickPaytype(); let payType = this.util.pickPaytype();
switch(payType) { switch(payType) {
@ -187,10 +193,16 @@ export default {
//TODO raise WX jsapi pay //TODO raise WX jsapi pay
break; break;
} }
this.checkIsLogin();
let user = this.$store.state.userInfo;
let memberId = '';
if(user)
memberId = user.data.id;
_hmt.push([ _hmt.push([
"_trackCustomEvent", "_trackCustomEvent",
"payment", "payment",
{ {
"member_id": memberId,
"payType" : payType, "payType" : payType,
"product_amount" : this.userPayData.userprice, "product_amount" : this.userPayData.userprice,
} }
@ -223,6 +235,18 @@ export default {
// path: "/personal/useraddress", // path: "/personal/useraddress",
// }); // });
}, },
toMiniShop() {
_hmt.push([
"_trackCustomEvent",
"jump_to_crmMiniApp",
{
"type": "finish_payment"
}
])
setTimeout(function(){
window.location.href="https://miniapp-product.royalcanin.com.cn/rcmini2020/admin/Voucher/urlRedirect.html";
},800);
},
async selectGoods(item, index) { async selectGoods(item, index) {
this.activeIndex = index; this.activeIndex = index;
this.paytype = item.paytype; this.paytype = item.paytype;
@ -251,10 +275,15 @@ export default {
if (res.success) { if (res.success) {
this.qrtext = '成功加入群的二维码'; this.qrtext = '成功加入群的二维码';
this.dialogSuccess = true; this.dialogSuccess = true;
let user = this.$store.state.userInfo;
let memberId = '';
if(user)
memberId = user.data.id;
_hmt.push([ _hmt.push([
"_trackCustomEvent", "_trackCustomEvent",
"payment_finished", "payment_finished",
{ {
"member_id" : memberId,
"payType" : 'native', "payType" : 'native',
"product_amount" : this.userPayData.userprice, "product_amount" : this.userPayData.userprice,
} }

View File

@ -119,7 +119,7 @@
<s class="ts-ecprice" v-if="curItem.ecPrice<curItem.rsp" <s class="ts-ecprice" v-if="curItem.ecPrice<curItem.rsp"
>{{ curItem.rsp }} >{{ curItem.rsp }}
</s> </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 class="rc-zeta">{{curItem.basePoint}}积分</span>
</span> </span>
@ -302,7 +302,8 @@ import {
getdraw, getdraw,
alldiscount, alldiscount,
oncequery, oncequery,
biaomessage biaomessage,
productQuery
} from "../../ajax/getData"; } from "../../ajax/getData";
export default { export default {
@ -315,6 +316,7 @@ export default {
let productAttachmentList = []; let productAttachmentList = [];
let userlistmenu = []; let userlistmenu = [];
isRxGoods = (isRxGoods == '1'?true:false); isRxGoods = (isRxGoods == '1'?true:false);
let mainProduct = undefined;
let mainProductCode = context.route.query.mainProductCode; let mainProductCode = context.route.query.mainProductCode;
let productCode = context.route.query.productCode; let productCode = context.route.query.productCode;
let activeIndexa = 0; let activeIndexa = 0;
@ -334,6 +336,10 @@ export default {
productAttachmentList = [insertTmpObj]; productAttachmentList = [insertTmpObj];
userbuy = false; userbuy = false;
} else { } else {
if(mainProductCode && mainProductCode.length>2) {
mainProduct = await productQuery(mainProductCode);
mainProduct = mainProduct.pop();
}
let stopLeftAllotmentChecking = false; let stopLeftAllotmentChecking = false;
let stopIndex = 0; let stopIndex = 0;
for(let singleCode of productCode) { for(let singleCode of productCode) {
@ -374,7 +380,8 @@ export default {
videolist, videolist,
productAttachmentList, productAttachmentList,
userbuy, userbuy,
isRxGoods isRxGoods,
mainProduct
} }
}, },
data() { data() {
@ -590,6 +597,21 @@ export default {
if(valDateToTime && curTime > valDateToTime) { if(valDateToTime && curTime > valDateToTime) {
dateChecked=false; dateChecked=false;
} }
if(item.packageTypeIds!='1') {
dateChecked=false;
}
if(this.mainProduct && this.mainProduct.petType && item.petCategoryIds) {
if(this.mainProduct.petType===0 && item.petCategoryIds!='1')
dateChecked=false;
if(this.mainProduct.petType===1 && item.petCategoryIds!='2')
dateChecked=false;
}
if(this.mainProduct && this.mainProduct.tagUsedAge && item.petAgeTypeIds) {
let productToCouponAgeId = this.util.getAgeMapping(this.mainProduct.tagUsedAge);
if(item.petAgeTypeIds!=productToCouponAgeId)
dateChecked=false;
}
if(dateChecked && item.activityId!=10) { if(dateChecked && item.activityId!=10) {
if(!item.productCodes) { if(!item.productCodes) {
menualist.push(item); menualist.push(item);

View File

@ -129,7 +129,6 @@ if(item.price=='登录/注册' ||index==0){
stype: 1, stype: 1,
}, },
}); });
}if(item.price=='登出'){ }if(item.price=='登出'){
localStorage.clear(); localStorage.clear();
this.usernewlist[0].price='登录/注册' this.usernewlist[0].price='登录/注册'

Binary file not shown.

After

Width:  |  Height:  |  Size: 373 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 546 KiB