Commit 0606b09b by 施宇

Merge branch 'XK_sample20190923'

# Conflicts:
#	src/api/index.js
#	src/router.js
#	src/store/store.js
#	view/index.html
parents c969b94b 48687601
......@@ -13,7 +13,8 @@
"vant": "^2.0.1",
"vue": "^2.5.21",
"vue-router": "^3.0.1",
"vuex": "^3.0.1"
"vuex": "^3.0.1",
"weixin-js-sdk": "^1.4.0-test"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^3.3.0",
......@@ -36,4 +37,4 @@
"last 2 versions",
"not ie <= 8"
]
}
\ No newline at end of file
}
<template>
<div id="app">
<keep-alive exclude="newsDetail,pointchange,wallet,walletRetrieve,walletDetail,walletRecord,walletStatus,walletWithdraw,walletRecharge,xianhuo,lxshop,brand,brandList">
<keep-alive exclude="newsDetail,pointchange,wallet,walletRetrieve,walletDetail,walletRecord,walletStatus,walletWithdraw,walletRecharge,xianhuo,lxshop,brand,brandList,sampleapply">
<router-view class="router-view"></router-view>
</keep-alive>
</div>
......
......@@ -51,6 +51,9 @@ export const productionUrl = url;
export const productionUrlApi = urlApi;
export const apis = {
/**wx分享签名接口**/
wxShare: url + 'shareparams',
/**
/**
* 首页
*/
......@@ -357,6 +360,18 @@ export const apis = {
defaultClass: productionUrl + 'api/defaultClass',
/******添加到购物车或者下单 */
addGood: productionUrlApi + '/cart/add',
/******自营样片订单提交接口 */
selfSampleCreate: productionUrlApi + '/order/selfsamplecreate',
/** 获取用户领取机会、邀约人数*/
getusersampleinfo: productionUrlApi + '/user/getusersampleinfo',
/** 自营样片邀约登录接口*/
loginsampleaction: productionUrlApi + '/login/sampleaction',
/** 获取样片列表*/
samplelist: productionUrlApi + '/sample/list',
/** 获取样片分类列表*/
sampleclasslist: productionUrlApi + '/sample/class/list',
/** 获取单个样片信息*/
getsampleinfo: url + 'getsampleinfo',
/**
*
* 会员中心接口
......@@ -660,5 +675,35 @@ export const services = {
},
downloadFile(params) {
return axios.post(apis.downloadFile, params)
},
wxShare(params) {
return axios.post(apis.wxShare, params)
},
selfSampleCreate(params) {
return axios.post(apis.selfSampleCreate, params)
},
sampleClassList(params) {
return axios.get(apis.sampleclasslist, {
params: {
...params
}
})
},
sampleList(params) {
return axios.get(apis.samplelist, {
params: {
...params
}
})
},
getUserSampleInfo(params) {
return axios.get(apis.getusersampleinfo, {
params: {
...params
}
})
},
getSampleInfo(params){
return axios.post(apis.getsampleinfo, params)
}
};
\ No newline at end of file
......@@ -329,7 +329,11 @@ font[class^="asfgd"] {
width: 7px;
height: 10px;
}
/**分享样式**/
.share-mask{
position: fixed;bottom:0;top:0;left:0;right:0;background: rgba(0,0,0,0.3);z-index: 9999999;
img{width:90%;float:right;}
}
/**兼容旧版本栅格布局**/
.mui-row:before, .mui-row:after
{
......
.sample {
padding-bottom: 50px;
}
.sample .ele {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
.sample .banner {
height: 173px;
width: 100%;
background: url("../../images/sample/samplebanner.png") no-repeat;
background-size: 100% 100%;
}
.sample .zititle {
padding: 15px;
}
.sample .zititle span {
color: #333;
font-size: 16px;
}
.sample .zititle font {
font-size: 12px;
color: #999;
margin-left: 10px;
height: 20px;
line-height: 20px;
}
.sample .fx_text {
color: #999;
text-align: right;
}
.sample .fx_text div {
padding: 0 15px 10px;
}
.sample .fx_text span {
color: #ffa200;
}
.sample .nav {
padding: 0 15px ;
}
.sample .nav .van-hairline--top-bottom::after {
border-width: 0 0 1px 0;
}
.sample .con .con-group {
padding: 15px;
padding-bottom: 0px;
}
.sample .con .con-group .img-box {
width: 2.933rem;
height: 2.933rem;
}
.sample .con .con-group .img-box img {
width: 100%;
height: 100%;
}
.sample .con .con-group .cb-box {
width: 6rem;
height: 2.933rem;
padding-bottom: 15px;
}
.sample .con .con-group .cb-box .title {
color: #333;
font-size: 16px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
margin-bottom: 0.15rem;
}
.sample .con .con-group .cb-box p {
color: #333;
font-size: 12px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
height: 0.45rem;
line-height: 0.45rem;
}
.sample .con .con-group .cb-box p span {
color: #666;
}
.sample .con .con-group .cb-box .btnx {
width: 3.5rem;
height: 0.7rem;
line-height: 0.7rem;
border-radius: 4px;
background: #1080d0;
color: #fff;
text-align: center;
cursor: pointer;
margin-top: 0.2rem;
}
@media screen and (max-width: 320px) {
.sample .con .con-group .cb-box {
width: 5.8rem;
height: 2.933rem;
}
.sample .con .con-group .cb-box .title {
margin-bottom: 0.05rem;
}
}
.sample .fix-btns {
position: fixed;
left: 0;
bottom: 0;
right: 0;
height: 50px;
line-height: 50px;
color: #fff;
font-size: 16px;
text-align: center;
background: #1080d0;
box-shadow: 0 0 10px #000;
cursor: pointer;
}
.sample .get-user-pop .get-user-con {
background: #fff;
width: 8.667rem;
height: 5.52rem;
border-radius: 3px;
position: fixed;
top: 50%;
left: 50%;
margin-left: -4.3335rem;
margin-top: -2.76rem;
box-shadow: 0 0 20px #e5e5e5;
z-index: 99999;
}
.sample .get-user-pop .get-user-con h3 {
color: #ffa200;
font-size: 16px;
height: 2.027rem;
line-height: 2.027rem;
text-align: center;
}
.sample .get-user-pop .get-user-con h3 i {
position: relative;
float: right;
top: -1.4rem;
color: #fff;
font-size: 20px;
}
.sample .get-user-pop .get-user-con h2 {
color: #000;
font-size: 14px;
text-align: center;
width: 60%;
margin: 0 auto;
}
.sample .get-user-pop .get-user-con span {
display: block;
cursor: pointer;
height: 30px;
line-height: 30px;
width: 150px;
text-align: center;
background: #1080d0;
color: #fff;
font-size: 14px;
border-radius: 30px;
margin: 0 auto;
margin-top: 50px;
}
.sample .get-user-pop .mask {
position: fixed;
bottom: 0;
top: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.3);
z-index: 999;
}
.sample{
padding-bottom:50px;
.ele{text-overflow: ellipsis;overflow: hidden;white-space: nowrap;}
.banner{
height:173px;width:100%;
background: url("../../images/sample/samplebanner.png") no-repeat;
background-size: 100% 100%;
}
.zititle{
padding:15px;
span{color:#333;font-size: 16px;}
font{font-size: 12px;color:#999;margin-left: 10px;height:20px;line-height: 20px;}
}
.fx_text{
color:#999;
text-align: right;
div{
padding:0 15px 10px;
}
span{
color:#ffa200
}
}
.nav{
padding:0 15px ;
.van-hairline--top-bottom::after {
border-width: 0 0 1px 0;
}
}
.con{
.con-group{
padding:15px;
padding-bottom: 0px;
.img-box{
width:2.933rem;height:2.933rem;
img{width:100%;height:100%;}
}
.cb-box{
width:6rem;height:2.933rem;padding-bottom: 15px;
.title{color:#333;font-size: 16px;.ele;margin-bottom: 0.15rem;}
p{color:#333;font-size: 12px;span{color:#666;}.ele;height:0.45rem;line-height: 0.45rem;}
.btnx{width:3.5rem;height:0.7rem;line-height: 0.7rem;border-radius: 4px;background: #1080d0;color:#fff;text-align: center;cursor: pointer;margin-top: 0.2rem;}
}
@media screen and (max-width: 320px) {
.cb-box{
width:5.8rem;height:2.933rem;
.title{margin-bottom: 0.05rem;}
}
}
}
}
.fix-btns{
position: fixed;left:0;bottom:0;right:0;height:50px;line-height: 50px;color:#fff;font-size: 16px;
text-align: center;background: #1080d0;box-shadow: 0 0 10px #000;cursor: pointer;
}
.get-user-pop{
.get-user-con{
background: #fff;width:8.667rem;
height:5.52rem;border-radius: 3px;
position: fixed;
top:50%;
left:50%;
margin-left: -4.3335rem;
margin-top: -2.76rem;
box-shadow: 0 0 20px #e5e5e5;
z-index: 99999;
h3{
color:#ffa200;font-size: 16px;height:2.027rem;
line-height:2.027rem;text-align: center;
i{position: relative;float: right;top:-1.4rem;color:#fff;font-size: 20px;}
}
h2{color:#000;font-size: 14px;text-align: center;width:60%;margin:0 auto;}
span{display: block;cursor: pointer;height:30px;line-height: 30px;width:150px;text-align: center;background: #1080d0;color:#fff;font-size: 14px;border-radius: 30px;margin:0 auto;margin-top: 50px;}
}
.mask{position: fixed;bottom:0;top:0;left:0;right:0;background: rgba(0,0,0,0.3);z-index: 999;}
}
}
.sample {padding-bottom: 50px;}.sample .ele{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.sample .banner{height:173px;width:100%;background:url("../../images/sample/samplebanner.png") no-repeat;background-size:100% 100%}.sample .zititle{padding:15px}.sample .zititle span{color:#333;font-size:16px}.sample .zititle font{font-size:12px;color:#999;margin-left:10px;height:20px;line-height:20px}.sample .nav{padding:0 15px }.sample .nav .van-hairline--top-bottom::after{border-width:0 0 1px 0}.sample .con .con-group{padding:15px;padding-bottom:0px}.sample .con .con-group .img-box{width:2.933rem;height:2.933rem}.sample .con .con-group .img-box img{width:100%;height:100%}.sample .con .con-group .cb-box{width:6rem;height:2.933rem;padding-bottom:15px}.sample .con .con-group .cb-box .title{color:#333;font-size:16px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;margin-bottom:.15rem}.sample .con .con-group .cb-box p{color:#333;font-size:12px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;height:.45rem;line-height:.45rem}.sample .con .con-group .cb-box p span{color:#666}.sample .con .con-group .cb-box .btnx{width:3.5rem;height:.7rem;line-height:.7rem;border-radius:4px;background:#1080d0;color:#fff;text-align:center;cursor:pointer;margin-top:.2rem}@media screen and (max-width:320px){.sample .con .con-group .cb-box{width:5.8rem;height:2.933rem}.sample .con .con-group .cb-box .title{margin-bottom:.05rem}}.sample .fix-btns{position:fixed;left:0;bottom:0;right:0;height:50px;line-height:50px;color:#fff;font-size:16px;text-align:center;background:#1080d0;box-shadow:0 0 10px #000;cursor:pointer}.sample .get-user-pop .get-user-con{background:#fff;width:8.667rem;height:5.52rem;border-radius:3px;position:fixed;top:50%;left:50%;margin-left:-4.3335rem;margin-top:-2.76rem;box-shadow:0 0 20px #e5e5e5;z-index:99999}.sample .get-user-pop .get-user-con h3{color:#ffa200;font-size:16px;height:2.027rem;line-height:2.027rem;text-align:center}.sample .get-user-pop .get-user-con h3 i{position:relative;float:right;top:-1.4rem;color:#fff;font-size:20px}.sample .get-user-pop .get-user-con h2{color:#000;font-size:14px;text-align:center;width:60%;margin:0 auto}.sample .get-user-pop .get-user-con span{display:block;cursor:pointer;height:30px;line-height:30px;width:150px;text-align:center;background:#1080d0;color:#fff;font-size:14px;border-radius:30px;margin:0 auto;margin-top:50px}.sample .get-user-pop .mask{position:fixed;bottom:0;top:0;left:0;right:0;background:rgba(0,0,0,0.3);z-index:999}
\ No newline at end of file
.sample-apply{
padding-bottom: 55px;
.ele{text-overflow: ellipsis;overflow: hidden;white-space: nowrap;}
.line{height:5px;background: #f3f3f3;}
.van-collapse-item__content{padding-top:0px;padding-bottom: 0px;}
.van-cell__title{font-size: 16px;}
.info-con{
.img-box{
border:1px solid #e5e5e5;box-sizing: border-box;
width:2rem;height:2rem;
img{width:100%;height:100%;}
}
.cb-box{
width:6.9rem;height:2rem;
.title{color:#333;font-size: 16px;.ele;margin-bottom: 0.08rem;}
p{color:#333;font-size: 12px;span{color:#666;}.ele;height:0.45rem;line-height: 0.45rem;}
}
@media screen and (max-width: 320px) {
.cb-box{
width:6.8rem;
position: relative;top:-0.1rem;
.title{margin-bottom: 0rem;}
}
}
}
.info-detail{
margin-top: 18px;
padding-bottom: 25px;
p{
color:#333;font-size: 12px;.ele;
span{color:#666;}
height:0.5rem;line-height: 0.5rem;
&.canshudetail{
overflow : hidden;
text-overflow: ellipsis;
white-space: normal;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
height:auto;
}
}
}
.form-info{
.form-group{
background: #fff;
padding:15px;
border-top:5px solid #f3f3f3;
h3{color:#666;font-size: 16px;span.fr{color:#333;}}
input{border:0px;display: block; padding:15px 16px;color:#333;font-size: 14px;width:100%;box-sizing: border-box;padding-bottom: 0px;}
textarea{border:0px;display: block;padding:15px 16px;color:#333;font-size: 14px;width:100%;box-sizing: border-box;padding-bottom: 0px;}
input::-webkit-input-placeholder,textarea::-webkit-input-placeholder{
color:#999;
}
&.by{padding-top:25px;padding-bottom: 25px;}
&.adderss-sample{
padding-top:12px;padding-bottom: 12px;
p{color:#333;font-size: 12px;height:0.55rem;line-height: 0.55rem;width:90%;.ele}
span{position: relative;top:-0.8rem;}
}
}
}
.fix-btns{
position: fixed;left:0;bottom:0;right:0;height:50px;line-height: 50px;color:#fff;font-size: 16px;
text-align: center;background: #1080d0;box-shadow: 0 0 10px #000;cursor: pointer;
}
.submit-success-pop{
.get-user-con{
background: #fff;width:8.667rem;
height:6.4rem;border-radius: 3px;
position: fixed;
top:50%;
left:50%;
margin-left: -4.3335rem;
margin-top: -3.2rem;
box-shadow: 0 0 20px #e5e5e5;
z-index: 99999;
h3{
color:#ffa200;font-size: 16px;height:1.8rem;
line-height:1.8rem;text-align: center;
i{position: relative;float: right;top:-1.4rem;color:#fff;font-size: 20px;}
}
p{text-align: center;font-size: 12px;color:#666;margin-bottom: 0.5rem;}
h2{color:#000;font-size: 14px;text-align: center;width:60%;margin:0 auto;}
span{display: block;cursor: pointer;height:30px;line-height: 30px;width:150px;text-align: center;background: #1080d0;color:#fff;font-size: 14px;border-radius: 30px;margin:0 auto;margin-top: 30px;}
.tips{color:#999;font-size: 12px;text-align: center;margin-top: 15px;}
}
.mask{position: fixed;bottom:0;top:0;left:0;right:0;background: rgba(0,0,0,0.3);z-index: 999;}
}
}
\ No newline at end of file
.sample-apply{padding-bottom:55px}.sample-apply .ele{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.sample-apply .line{height:5px;background:#f3f3f3}.sample-apply .van-collapse-item__content{padding-top:0px;padding-bottom:0px}.sample-apply .van-cell__title{font-size:16px}.sample-apply .info-con .img-box{border:1px solid #e5e5e5;box-sizing:border-box;width:2rem;height:2rem}.sample-apply .info-con .img-box img{width:100%;height:100%}.sample-apply .info-con .cb-box{width:6.9rem;height:2rem}.sample-apply .info-con .cb-box .title{color:#333;font-size:16px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;margin-bottom:.08rem}.sample-apply .info-con .cb-box p{color:#333;font-size:12px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;height:.45rem;line-height:.45rem}.sample-apply .info-con .cb-box p span{color:#666}@media screen and (max-width:320px){.sample-apply .info-con .cb-box{width:6.8rem;position:relative;top:-0.1rem}.sample-apply .info-con .cb-box .title{margin-bottom:0rem}}.sample-apply .info-detail{margin-top:18px;padding-bottom:25px}.sample-apply .info-detail p{color:#333;font-size:12px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;height:.5rem;line-height:.5rem}.sample-apply .info-detail p span{color:#666}.sample-apply .info-detail p.canshudetail{overflow:hidden;text-overflow:ellipsis;white-space:normal;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;height:auto}.sample-apply .form-info .form-group{background:#fff;padding:15px;border-top:5px solid #f3f3f3}.sample-apply .form-info .form-group h3{color:#666;font-size:16px}.sample-apply .form-info .form-group h3 span.fr{color:#333}.sample-apply .form-info .form-group input{border:0px;display:block;padding:15px 16px;color:#333;font-size:14px;width:100%;box-sizing:border-box;padding-bottom:0px}.sample-apply .form-info .form-group textarea{border:0px;display:block;padding:15px 16px;color:#333;font-size:14px;width:100%;box-sizing:border-box;padding-bottom:0px}.sample-apply .form-info .form-group input::-webkit-input-placeholder,.sample-apply .form-info .form-group textarea::-webkit-input-placeholder{color:#999}.sample-apply .form-info .form-group.by{padding-top:25px;padding-bottom:25px}.sample-apply .form-info .form-group.adderss-sample{padding-top:12px;padding-bottom:12px}.sample-apply .form-info .form-group.adderss-sample p{color:#333;font-size:12px;height:.55rem;line-height:.55rem;width:90%;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.sample-apply .form-info .form-group.adderss-sample span{position:relative;top:-0.8rem}.sample-apply .fix-btns{position:fixed;left:0;bottom:0;right:0;height:50px;line-height:50px;color:#fff;font-size:16px;text-align:center;background:#1080d0;box-shadow:0 0 10px #000;cursor:pointer}.sample-apply .submit-success-pop .get-user-con{background:#fff;width:8.667rem;height:6.4rem;border-radius:3px;position:fixed;top:50%;left:50%;margin-left:-4.3335rem;margin-top:-3.2rem;box-shadow:0 0 20px #e5e5e5;z-index:99999}.sample-apply .submit-success-pop .get-user-con h3{color:#ffa200;font-size:16px;height:1.8rem;line-height:1.8rem;text-align:center}.sample-apply .submit-success-pop .get-user-con h3 i{position:relative;float:right;top:-1.4rem;color:#fff;font-size:20px}.sample-apply .submit-success-pop .get-user-con p{text-align:center;font-size:12px;color:#666;margin-bottom:.5rem}.sample-apply .submit-success-pop .get-user-con h2{color:#000;font-size:14px;text-align:center;width:60%;margin:0 auto}.sample-apply .submit-success-pop .get-user-con span{display:block;cursor:pointer;height:30px;line-height:30px;width:150px;text-align:center;background:#1080d0;color:#fff;font-size:14px;border-radius:30px;margin:0 auto;margin-top:30px}.sample-apply .submit-success-pop .get-user-con .tips{color:#999;font-size:12px;text-align:center;margin-top:15px}.sample-apply .submit-success-pop .mask{position:fixed;bottom:0;top:0;left:0;right:0;background:rgba(0,0,0,0.3);z-index:999}
\ No newline at end of file
......@@ -10,11 +10,13 @@
top:44px;
left:0px;
right:0px;
background:#fff;
z-index:99
}
}
/*优惠劵*/
.coupon-box{ padding: 0 5px; }
.coupon-box{ padding: 44px 5px 0 ; }
.coupon-box .block{overflow: hidden; margin-top: 15px; /*border-top: .1rem solid #fff;*/ border-radius: 5px; background: #fff;-webkit-box-shadow: 0 2px 5px #ddd;box-shadow: 0 2px 5px #ddd; }
.coupon-box .block dt{ width:125px; padding:10px 8px; float: left; }
.coupon-box .block dt h4{ font-size: 36px; font-family: Impact; height: 40px; line-height: 40px; text-align: center; }
......
......@@ -2,9 +2,11 @@ import Vue from 'vue'
import BackTopDirective from './backTop';
import backTopWindowDirective from './backTopWindow';
import imgCodeDirective from './imgCode';
import shareMaskDirective from './shareMask';
export default {
install (Vue) {
Vue.directive('shareMask', shareMaskDirective);
Vue.directive('backTop', BackTopDirective);
Vue.directive('backTopWindow', backTopWindowDirective);
Vue.directive('imgCode', imgCodeDirective);
......
import Util from "../util";
export default {
bind(el, binding) {
el.addEventListener('click', function () {
var loginpta = Util.isLogin() ? true : false;
if (!loginpta) {
window.location.href = '/v3/login?referer=' + encodeURIComponent(window.location.href);
return;
}
var rootElement = document.body;
var newElement = document.createElement("div");
newElement.setAttribute("class", "share-mask");
var img=document.createElement("img");
img.src="http://img.ichunt.com/test/images/ichunt/201904/10/b6dac89d8e471cc6cb499e1023373e0a.png";
rootElement.appendChild(newElement);
newElement.appendChild(img);
newElement.addEventListener('click',function(){
newElement.remove();
},false);
}, false);
}
}
\ No newline at end of file
......@@ -8,7 +8,9 @@ Vue.use(Toast);
const state = {
cartCount: 0,
loginCheck: false,
phpParams: {}
phpParams: {},
wxShareInfo:"",
wxShareState:false
}
const mutations = {
......@@ -87,6 +89,19 @@ const actions = {
}).catch(function (err) {
console.log('网络出现问题,请重试');
});
},
wxShare({commit}, payload) {
let Params_={
current_url:payload.current_url
}
var params = Util.getParams(Params_);
Services.wxShare(params).then((res) => {
let data = res.data;
state.wxShareInfo=data.data;
state.wxShareState=true;
}).catch(function (err) {
console.log('网络出现问题,请重试');
});
}
}
......
import Vue from 'vue'
import {
Toast
} from 'vant';
import {
services as Services
} from '../../../api/index'
Vue.use(Toast);
const state = {
classList: [],
goodList: [],
loading: false,
finished: false,
goodCount: 0
}
const mutations = {
classListM(state, payload) {
state.classList = payload.data
},
goodList(state, payload) {
let arr = [];
for (let k in payload.data) {
arr.push(payload.data[k])
}
state.goodList = state.goodList.concat(arr)
}
}
const actions = {
getClasslist({
commit,
}) {
Services.sampleClassList().then((res) => {
let data = res.data;
if (data.err_code == 0) {
commit("classListM", {
data: data.data || [],
});
} else {
commit("classListM", {
data: [],
})
}
}).catch(function (err) {
commit("classListM", {
data: [],
})
});
},
getGoodList({
commit
}, payload) {
state.loading = true;
state.finished = false;
let p = payload.data.p;
if (p == 1) {
state.goodList = [];
}
let params = {
...payload.data,
limit: 10,
}
Services.sampleList(params).then((res) => {
state.loading = false;
let data = res.data;
if (data.err_code == 0) {
let totalPage = 0;
if (data.data.total) {
totalPage = Math.ceil(data.data.total / 10);
}
if (p == totalPage || !totalPage) {
state.finished = true;
}
if (data.data.total) {
commit('goodList', {
data: data.data.data
})
}
} else {
state.loading = false;
state.finished = true;
}
}).catch(function (err) {
state.loading = false;
state.finished = true;
});
}
}
export default {
state,
actions,
mutations
}
\ No newline at end of file
import Vue from 'vue'
import {Toast} from 'vant';
import {services as Services} from '../../../api/index'
import Util from "../../../util";
var qs = require('qs');
Vue.use(Toast);
const state = {
loading: false,
addressInfo:"",
submitState:false,
ypGoodDetail:{},
ordernum:''
}
const mutations = {
recvlistSample(state, payload) {
state.addressInfo=payload.data.filter(function(item){return item['is_default'] == 1;});
state.addressInfo=state.addressInfo[0];
},
}
const actions = {
recvlistSample({commit}, payload) {
Services.recvlist().then((res) => {
let data = res.data;
// state.loading = false;
if (data.err_code == 0) {
commit({
type: 'recvlistSample',
data: data.data
});
}
}).catch(function (err) {
});
},
selfSampleCreate({commit}, payload) {
state.loading = true;
var params = {
goods_id: payload.goods_id,
apply_num: payload.apply_num,
com_name: payload.com_name,
sample_demand_desc: payload.sample_demand_desc,
address_id: payload.address_id
}
Services.selfSampleCreate(qs.stringify(params)).then((res) => {
let data = res.data;
state.loading = false;
if (data.err_code == 0) {
state.submitState=true;
state.ordernum = data.data||''
}else if(data.err_code == '40014'){
Toast('样品库存不足');
}else{
Toast(data.err_msg);
}
}).catch(function (err) {
state.loading = false;
});
},
getDetailYp({commit}, payload) {
state.loading = true;
let Params_ = {
id: payload.data.id,
}
let params = Util.getParams(Params_);
Services.getSampleInfo(params).then((res) => {
let data = res.data;
state.loading = false;
if (data.err_code == 0) {
state.ypGoodDetail = data.data
}else{
Toast(data.err_msg);
}
}).catch(function (err) {
state.loading = false;
});
},
}
const getters = {}
export default {
state,
mutations,
actions,
getters
}
......@@ -55,10 +55,7 @@ const actions = {
data: data.data
});
}else {
Toast({
message: data.err_msg,
duration: 3000
});
}
}).catch(function (err) {
state.loading = false;
......@@ -134,11 +131,6 @@ const actions = {
if (data.err_code == 0) {
state.addressInfoState=true;
state.addressInfo=data.data;
}else {
Toast({
message: data.err_msg,
duration: 3000
});
}
}).catch(function (err) {
state.loading = false;
......@@ -244,7 +236,7 @@ const actions = {
state.loading = false;
if (data.errcode == 0) {
Toast({
message: data.errmsg,
message: "保存成功",
duration: 3000
});
setTimeout(function(){
......
<template>
</template>
<script>
import Vue from 'vue'
import {mapState} from 'vuex'
import util from "../../util/index"
let wxjs = require('weixin-js-sdk');
export default {
name: 'wxShare',
props: {
url: {
type: String,
default: window.location.href
}
},
data() {
return {
shareObj:{
title: "好物分享给你,帮我助力,我们一起免费拿样品", // 分享标题
desc: "在吗?拜托帮我点一下,你也能免费申请元器件样品~帮我助力 你拿样品", // 分享描述
// link:this.url,
link: window.location.origin+"/v3/samplereg?uid="+util.getCookie("Yo4teW_uid"), // 分享链接
imgUrl: "http://img.ichunt.com/images/ichunt/self_sample/apply.png", // 分享图标
success: function (resp) {
},
error:function(){
}
}
}
},
computed:{
...mapState({
wxShareInfo:state => state.common.wxShareInfo,
wxShareState:state => state.common.wxShareState,
}),
},
watch:{
wxShareState(val){
if(val&&util.getCookie("Yo4teW_uid")){
this.share();
}
}
},
created() {
if(util.getCookie("Yo4teW_uid")){
this.$store.dispatch({
type: "wxShare",
current_url:window.location.href
});
}
},
methods: {
share(){
var self=this;
// 微信配置
wx.config({
debug: false,
appId: self.wxShareInfo.appId,
timestamp: self.wxShareInfo.timestamp,
nonceStr: self.wxShareInfo.nonceStr,
signature:self.wxShareInfo.signature,
jsApiList: ['onMenuShareTimeline','onMenuShareAppMessage','onMenuShareQQ','onMenuShareWeibo','onMenuShareQZone'] // 功能列表,我们要使用JS-SDK的什么功能
});
// config信息验证后会执行ready方法,所有接口调用都必须在config接口获得结果之后,config是一个客户端的异步操作,所以如果需要在 页面加载时就调用相关接口,则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口,则可以直接调用,不需要放在ready 函数中。
wx.ready(function(){
wx.checkJsApi({
jsApiList: ['onMenuShareTimeline','onMenuShareAppMessage','onMenuShareQQ','onMenuShareWeibo','onMenuShareQZone'], // 需要检测的JS接口列表,所有JS接口列表见附录2,
success: function(res) {
// console.log(res);
// 以键值对的形式返回,可用的api值true,不可用为false
// 如:{"checkResult":{"chooseImage":true},"errMsg":"checkJsApi:ok"}
}
});
// 获取“分享到朋友圈”按钮点击状态及自定义分享内容接口
wx.onMenuShareTimeline(self.shareObj);
// 获取“分享给朋友”按钮点击状态及自定义分享内容接口
wx.onMenuShareAppMessage(self.shareObj);
//获取“分享到QQ”按钮点击状态及自定义分享内容接口
wx.onMenuShareQQ(self.shareObj);
//获取“分享到腾讯微博”按钮点击状态及自定义分享内容接口
wx.onMenuShareWeibo(self.shareObj);
//获取“分享到QQ空间”按钮点击状态及自定义分享内容接口
wx.onMenuShareQZone(self.shareObj);
});
}
},
}
</script>
......@@ -33,7 +33,7 @@
</template>
</div>
<a :href="'/v3/user/reciveaddress.html?points='+point_exchange_id+'&address_id='+prize_info.address_id" class="address-link" >更换地址</a>
<a :href="'/h5/view/#/userAddress?points='+point_exchange_id+'&address_id='+prize_info.address_id" class="address-link" >更换地址</a>
<a class="go-change" href="/h5/view/#/exchange">去查看</a>
</div>
<van-loading type="spinner" color="#000" class="loading-background" v-if="loading"/>
......
<template>
<section class="sample">
<Header :title="title" :meaushow="meaushow" :bgcolor="bgcolor"></Header>
<wxShare :url="shareUrl"></wxShare>
<div class="banner"></div>
<div class="zititle">
<span>猎芯自营</span>
<font>正品现货 1片起订 3小时发货</font>
</div>
<div class="fx_text" v-if="fxType">
<!-- 邀请记录不为0 -->
<div class="fx_text_one" v-if="fxType == 1">
我已邀请好友
<span>{{inviteCount}}</span> 人,剩余领取次数
<span>{{applyCount}}</span>
</div>
<!-- 邀请记录为0 -->
<div class="fx_text_two" v-else-if="fxType == 2">
当前可领取次数为:
<span>{{applyCount}}</span> 次,分享可额外获得领取机会
</div>
<!-- 未登入 -->
<div class="fx_text_three" v-else>分享可额外获得领取机会</div>
</div>
<div class="nav" v-if="classList.length">
<van-tabs
v-model="active"
:color="color"
:swipe-threshold="swipeThreshold"
:title-active-color="color"
:title-inactive-color="defaultcolor"
@change="changeTab"
>
<van-tab v-for="(v,k) in classList" :title="v.class_name" :name="v.id"></van-tab>
</van-tabs>
</div>
<div class="con">
<van-list
v-model="loadingYp"
:finished="finished"
finished-text="我是有底线的噢"
@load="onLoad"
:immediate-check="false"
>
<div class="con-group clr" v-for="(v,k) in goodList">
<div class="fl img-box" v-lazy-container="{selector:'img'}">
<img
class="lazy img-lazy"
:alt="v.goods_info.goods_name"
:data-src="v.goods_info.goods_images"
data-error="https://www.ichunt.com/v3/dist/res/m/images/materiel_img_3.png"
/>
</div>
<div class="fr cb-box van-hairline--bottom">
<div class="title">{{v.goods_info.goods_name}}</div>
<p>
<span>类别:</span>
{{v.goods_info.class_id1_name}}
</p>
<p>
<span>品牌:</span>
{{v.goods_info.brand_name}}
</p>
<p>
<span>最大可申请数量:</span>
{{v.max_number}}
</p>
<div class="btnx" @click="yaoqing(v)">领取样品</div>
</div>
</div>
</van-list>
</div>
<div class="fix-btns" v-shareMask>立即分享</div>
<!--获得机会弹窗-->
<div class="get-user-pop" v-show="getPop">
<div class="mask"></div>
<div class="get-user-con">
<h3>
您已将所有样片机会用完
<i class="icon iconfont icon-guanbi" @click="getuserf"></i>
</h3>
<h2>邀请好友注册可额外获得一次样品申请机会,多邀多得</h2>
<span v-shareMask>点击邀请</span>
</div>
</div>
</section>
</template>
<script>
import Vue from "vue";
import { mapState } from "vuex";
import Header from "@/views/common/Header.vue";
import wxShare from "@/views/common/wxShare.vue";
import { services as Services } from "../../api/index";
import util from "../../util/index";
import { Tab, Tabs, Lazyload, List, Toast } from "vant";
Vue.use(Tab)
.use(Tabs)
.use(Lazyload)
.use(Toast);
export default {
name: "sample",
data() {
return {
title: "猎芯网-自营样片",
meaushow: true,
bgcolor: "#fafafa",
color: "#1080d0",
defaultcolor: "#333",
swipeThreshold: 4,
active: 0,
getPop: false, //获得机会弹窗,没机会时展示
loadingYp: false,
applyCount: 0,
inviteCount: 0,
p: 1,
classId: "",
fxType: 0,
shareUrl:
window.location.origin +
"/v3/samplereg?uid=" +
util.getCookie("Yo4teW_uid")
};
},
computed: {
...mapState({
classList: state => state.sample.classList,
goodList: state => state.sample.goodList,
finished: state => state.sample.finished,
loading: state => state.sample.loading
})
},
watch: {
loading(now) {
this.loadingYp = now;
},
classList(now) {
if (now.length) {
this.p = 1;
this.classId = now[0].id;
this.getGoodList();
}
}
},
created() {
this.$store.dispatch({
type: "getClasslist"
});
this.judgeLogin();
},
methods: {
judgeLogin() {
if (getCookie("Yo4teW_uid")) {
this.getCount();
} else {
this.fxType = 3;
}
},
getGoodList() {
this.$store.dispatch({
type: "getGoodList",
data: {
p: this.p,
class_id: this.classId
}
});
},
changeTab(data) {
this.p = 1;
this.classId = data;
this.getGoodList();
},
onLoad() {
this.p++;
this.getGoodList();
},
getuserf() {
this.getPop = false;
},
getCount() {
let me = this;
Services.getUserSampleInfo()
.then(res => {
let data = res.data;
if (data.err_code == 0) {
me.applyCount = data.data.apply_count || 0;
me.inviteCount = data.data.invite_count || 0;
if (me.inviteCount == 0) {
me.fxType = 2;
} else {
me.fxType = 1;
}
} else if (data.err_code == "11012") {
window.location.href =
"/v3/login?referer=" + encodeURIComponent(window.location.href);
}
})
.catch(function(err) {});
},
yaoqing(item) {
let loginpta = util.isLogin() //1强登入态
if (loginpta!=1) {
window.location.href =
"/v3/login?referer=" + encodeURIComponent(window.location.href);
return;
} else {
if (this.applyCount!=0) {
if(item.goods_info&&item.goods_info.stock){
this.$router.push({
path: "/sampleapply",
query: {
id: item.goods_id
}
});
}else{
Toast("样品库存不足");
}
}else{
this.getPop = true;
}
}
}
},
components: {
Header,
wxShare,
"van-list": List
}
};
</script>
<style scoped>
@import "../../assets/css/sample/sample.css";
</style>
\ No newline at end of file
<template>
<section class="sample-apply" >
<Header :title="title" :meaushow='meaushow' :bgcolor="bgcolor"></Header>
<wxShare :url="shareUrl"></wxShare>
<van-collapse v-model="activeName" accordion :border="noborder">
<van-collapse-item title="商品信息" name="1" :border="noborder">
<div class="info-con clr">
<div class="fl img-box">
<img :src="ypGoodDetail.goods_images||'https://www.ichunt.com/v3/dist/res/m/images/materiel_img_3.png'" alt="">
</div>
<div class="fr cb-box" v-if="ypGoodDetail.goods_info">
<div class="title">{{ypGoodDetail.goods_info.goods_name}}</div>
<p><span>类别:</span> {{ypGoodDetail.goods_info.class_id1_name}}</p>
<p><span>品牌:</span>{{ypGoodDetail.goods_info.brand_name}}</p>
<p><span>最大可申请数量:</span>{{ypGoodDetail.max_number||1}}</p>
</div>
</div>
<div class="info-detail" v-if="ypGoodDetail.goods_info">
<p><span>型号: </span>{{ypGoodDetail.goods_info.sku_name}}</p>
<p class="canshudetail">
<span>参数描述: </span>
{{ypGoodDetail.goods_info.sku_name}}{{ypGoodDetail.goods_info.brand_name}}设计生产制造,在猎芯网自营现货销售。{{ypGoodDetail.goods_info.goods_name}}的封装/规格参数为:{{ypGoodDetail.goods_info.encap}};您可以选择下载{{ypGoodDetail.goods_info.sku_name}}中文资料等数据手册功能说明书,资料中有{{ypGoodDetail.goods_info.class_id1_name}}{{ypGoodDetail.goods_info.class_id2_name}}详细使用方法及教程。
</p>
</div>
</van-collapse-item>
</van-collapse>
<div class="form-info">
<div class="form-group">
<h3><span class="f-red">*</span>&nbsp;&nbsp;申请数量</h3>
<input type="text" v-model="apply_num" :placeholder="'请输入申请数量,最多可申请'+(ypGoodDetail.max_number||1)+'个'" onkeyup="if(event.keyCode !=37 &amp;&amp; event.keyCode != 39){if (!/^[\d]+$/ig.test(this.value)){this.value='';}}"/>
</div>
<div class="form-group">
<h3><span class="f-red">*</span>&nbsp;&nbsp;单位名称</h3>
<input type="text" v-model="com_name" placeholder="请输入单位名称" />
</div>
<div class="form-group">
<h3>&nbsp;&nbsp;项目需求描述</h3>
<textarea name="" v-model="sample_demand_desc" placeholder="请输项目需求描述,如申请样品用于什么项目"></textarea>
</div>
<div class="form-group by">
<h3>运费信息 <span class="fr">包邮</span></h3>
</div>
<div v-if="addressInfo" class="form-group adderss-sample" @click="addressSample(addressInfo.address_id)">
<h3>
<p>{{addressInfo.consignee}}&nbsp;&nbsp;&nbsp;{{addressInfo.mobile}}</p>
<p>{{addressInfo.province_val+" " +addressInfo.district_val+" " +addressInfo.city_val+" "+addressInfo.detail_address}}</p>
<span class="fr icon iconfont icon-xiangyoujiankuohao"></span>
</h3>
</div>
<div v-else class="form-group by" @click="adderssAdd">
<h3>新增收货地址 <span class="fr icon iconfont icon-xiangyoujiankuohao"></span></h3>
</div>
<div class="line"></div>
</div>
<div class="fix-btns" @click="submitS">确认提交</div>
<!--获得机会弹窗-->
<div class="submit-success-pop" v-show="successPop">
<div class="mask"></div>
<div class="get-user-con">
<h3>恭喜获得1次免费申请样品机会<i class="icon iconfont icon-guanbi" @click="getuserf"></i></h3>
<p>样品订单编号:{{ordernum}}</p>
<h2>邀请好友注册可额外获得一次样品申请机会,多邀多得</h2>
<span v-shareMask>点击邀请</span>
<div class="tips">重要提醒:审核结果​​将以短信通知给您</div>
</div>
</div>
<van-loading type="spinner" color="#000" class="loading-background" v-if="loading"/>
</section>
</template>
<script>
import Vue from 'vue'
import {mapState} from 'vuex'
import Header from "@/views/common/Header.vue";
import wxShare from "@/views/common/wxShare.vue";
import { Collapse, CollapseItem ,Toast,Loading} from 'vant';
import util from "../../util/index"
Vue.use(Collapse).use(CollapseItem).use(Toast).use(Loading);
export default {
name: 'sampleapply',
data() {
return {
title:"样片申请",
meaushow:true,
bgcolor:'#fafafa',
color:'#1080d0',
activeName:'1',
noborder:false,
successPop:false,//申请成功弹窗显示
goods_id:this.$route.query.id,
apply_num:"",
com_name:"",
sample_demand_desc:"",
shareUrl:window.location.origin+"/v3/samplereg?uid="+util.getCookie("Yo4teW_uid"),
}
},
computed: {
...mapState({
loading: state => state.sampleapply.loading,
addressInfo: state => state.sampleapply.addressInfo,
ypGoodDetail: state => state.sampleapply.ypGoodDetail,
submitState: state => state.sampleapply.submitState,
ordernum:state => state.sampleapply.ordernum,
})
},
watch:{
submitState(val){
if(val){
this.successPop=true;
}
},
apply_num(val){
let num = this.ypGoodDetail.max_number;
if(!num){
this.apply_num = 1
}else if(val>num){
this.apply_num = num
}
}
},
created() {
this.$store.dispatch({
type: "getDetailYp",
data: { id: this.goods_id }
});
this.$store.dispatch({
type: 'recvlistSample'
})
},
methods: {
getuserf(){
this.successPop=false;
window.location.href='/v3/user/order';
},
submitS(){
var self=this;
if(!this.apply_num){
Toast("请输入申请数量");
return;
}
if(!this.com_name){
Toast("请输入单位名称");
return;
}
this.$store.dispatch({
type: 'selfSampleCreate',
goods_id: self.goods_id,
apply_num: self.apply_num,
com_name: self.com_name,
sample_demand_desc: self.sample_demand_desc,
address_id: self.addressInfo.address_id
})
},
addressSample(adderssId){
window.location.href='/h5/view/#/userAddress?points='+adderssId;
},
adderssAdd(){
window.location.href='/h5/view/#/userAddress?fp=5';
}
},
components: {
Header,
wxShare
}
}
</script>
<style scoped>
@import "../../assets/css/sample/sampleapply.min.css";
</style>
\ No newline at end of file
......@@ -122,7 +122,7 @@
isEdit:false,
historyb:true,//开启自定义回跳
pointS:this.$route.query.points,//是否从积分过来
iso:this.$route.query.fp,
iso:this.$route.query.fp,//是否开启新增
address_id_p:this.$route.query.address_id,
zytp:this.$route.query.zyType,
......
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
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 sign in to comment