增加基本项目配置

This commit is contained in:
Gao xiaosong
2020-03-15 13:59:43 +08:00
commit 397082cdaf
1117 changed files with 105700 additions and 0 deletions

View File

@ -0,0 +1,115 @@
<template>
<div class="evaluate-list" ref="container">
<div class="header">
<div class="generalComment acea-row row-between-wrapper">
<div class="acea-row row-middle font-color-red">
<div class="evaluate">评分</div>
<div class="start" :class="'star' + replyData.replyStar"></div>
</div>
<div>
<span class="font-color-red">{{ replyData.replyChance || 0 }}%</span
>好评率
</div>
</div>
<div class="nav acea-row row-middle">
<div
class="acea-row row-center-wrapper"
v-for="(item, navListIndex) in navList"
:key="navListIndex"
@click="changeType(navListIndex)"
>
<div
class="item"
:class="currentActive === navListIndex ? 'bg-color-red' : ''"
v-if="item.num"
>
{{ item.evaluate }}({{ item.num }})
</div>
</div>
</div>
</div>
<UserEvaluation :reply="reply"></UserEvaluation>
<Loading :loaded="loadend" :loading="loading"></Loading>
</div>
</template>
<script>
import UserEvaluation from "@/components/UserEvaluation";
import { getReplyConfig, getReplyList } from "@/api/store";
import Loading from "@/components/Loading";
export default {
name: "EvaluateList",
components: {
UserEvaluation,
Loading
},
props: {},
data: function() {
return {
product_id: 0,
replyData: {},
navList: [
{ evaluate: "全部", num: 0 },
{ evaluate: "好评", num: 0 },
{ evaluate: "中评", num: 0 },
{ evaluate: "差评", num: 0 }
],
currentActive: 0,
page: 1,
limit: 8,
reply: [],
loadTitle: "",
loading: false,
loadend: false
};
},
mounted: function() {
this.product_id = this.$yroute.query.id;
this.getProductReplyCount();
this.getProductReplyList();
},
onReachBottom() {
!this.loading && this.getProductReplyList();
},
methods: {
getProductReplyCount: function() {
let that = this;
getReplyConfig(that.product_id).then(res => {
that.$set(that, "replyData", res.data);
that.navList[0].num = res.data.sumCount;
that.navList[1].num = res.data.goodCount;
that.navList[2].num = res.data.inCount;
that.navList[3].num = res.data.poorCount;
});
},
getProductReplyList: function() {
let that = this;
if (that.loading) return; //阻止下次请求false可以进行请求
if (that.loadend) return; //阻止结束当前请求false可以进行请求
that.loading = true;
let q = { page: that.page, limit: that.limit, type: that.currentActive };
getReplyList(that.product_id, q).then(res => {
that.loading = false;
//apply();js将一个数组插入另一个数组;
that.reply.push.apply(that.reply, res.data);
that.loadend = res.data.length < that.limit; //判断所有数据是否加载完成;
that.page = that.page + 1;
});
},
changeType: function(index) {
let that = this;
that.currentActive = index;
that.page = 1;
that.loadend = false;
that.$set(that, "reply", []);
that.getProductReplyList();
}
}
};
</script>
<style scoped>
.noCommodity {
height: 8rem;
background-color: #fff;
}
</style>

View File

@ -0,0 +1,5 @@
import Vue from 'vue'
import App from './index'
const app = new Vue(App)
app.$mount()

View File

@ -0,0 +1,77 @@
<template>
<div>
<div class="searchGood">
<div class="search acea-row row-between-wrapper">
<div class="input acea-row row-between-wrapper">
<span class="iconfont icon-sousuo2"></span>
<!-- <form @submit.prevent="submit"></form> -->
<input type="text" placeholder="点击搜索商品" v-model="search" />
</div>
<div class="bnt" @click="submit">搜索</div>
</div>
<div v-if="keywords.length">
<div class="title">热门搜索</div>
<div class="list acea-row">
<div
class="item"
v-for="keywordsKey of keywords"
:key="keywordsKey"
@click="toSearch(keywordsKey)"
>{{ keywordsKey }}</div>
</div>
</div>
<div class="line"></div>
<!-- <GoodList></GoodList>-->
</div>
<!--<div class="noCommodity">-->
<!--<div class="noPictrue">-->
<!--<img :src="$VUE_APP_RESOURCES_URL+'/images/noSearch.png'" class="image" />-->
<!--</div>-->
<!--<recommend></recommend>-->
<!--</div>-->
</div>
</template>
<script>
// import GoodList from "@/components/GoodList";
import { getSearchKeyword } from "@/api/store";
import { trim } from "@/utils";
// import Recommend from "@/components/Recommend";
export default {
name: "GoodSearch",
components: {
// Recommend,
// GoodList
},
props: {},
data: function() {
return {
keywords: [],
search: ""
};
},
mounted: function() {
this.getData();
},
methods: {
submit() {
const search = trim(this.search) || "";
if (!search) return;
this.toSearch(search);
},
toSearch(s) {
this.$yrouter.push({ path: "/pages/shop/GoodsList/main", query: { s } });
},
getData() {
getSearchKeyword().then(res => {
this.keywords = res.data;
});
}
}
};
</script>
<style >
.noCommodity {
border-top: 0.05rem solid #f5f5f5;
}
</style>

View File

@ -0,0 +1,5 @@
import Vue from 'vue'
import App from './index'
const app = new Vue(App)
app.$mount()

View File

@ -0,0 +1,125 @@
<template>
<div class="productSort">
<form @submit.prevent="submitForm">
<div class="header acea-row row-center-wrapper" ref="header">
<div class="acea-row row-between-wrapper input">
<span class="iconfont icon-sousuo"></span>
<input type="text" placeholder="搜索商品信息" v-model="search" />
</div>
</div>
</form>
<div class="aside">
<div
class="item acea-row row-center-wrapper"
:class="categoryDivindex === navActive ? 'on' : ''"
v-for="(item, categoryDivindex) in category"
:key="categoryDivindex"
@click="asideTap(categoryDivindex)"
>
<span>{{ item.cateName }}</span>
</div>
</div>
<div class="conter">
<div class="listw" v-for="(item, eq) in category" :key="eq">
<div v-if="eq === navActive">
<div class="title acea-row row-center-wrapper" ref="title">
<div class="line"></div>
<div class="name">{{ item.cateName }}</div>
<div class="line"></div>
</div>
<div class="list acea-row">
<div
class="item acea-row row-column row-middle"
v-for="(child, categoryIndex) in item.children"
:key="categoryIndex"
@click="$yrouter.push({path: '/pages/shop/GoodsList/index',query: { id: child.id, title: child.cateName }})"
>
<div class="picture">
<img :src="child.pic" />
</div>
<div class="name line1">{{ child.cateName }}</div>
</div>
</div>
</div>
</div>
</div>
<div style="height:100rpx;"></div>
</div>
</template>
<script>
import debounce from "lodash.debounce";
import { getCategory } from "@/api/store";
import { trim } from "@/utils";
export default {
name: "GoodsClass",
components: {},
props: {},
data: function() {
return {
category: [],
navActive: 0,
search: "",
lock: false
};
},
watch: {
"$yroute.query.id": function(n) {
if (n) {
this.activeCateId(n);
}
}
},
mounted: function() {
// document.addEventListener("scroll", this.onScroll, false);
this.loadCategoryData();
},
methods: {
activeCateId(n) {
let index = 0;
n = parseInt(n);
if (!n) return;
this.category.forEach((cate, i) => {
if (cate.id === n) index = i;
});
if (index !== this.navActive) {
this.asideTap(index);
}
},
loadCategoryData() {
getCategory().then(res => {
this.category = res.data;
this.$nextTick(() => {
if (this.$yroute.query.id) {
this.activeCateId(this.$yroute.query.id);
}
});
});
},
submitForm: function() {
var val = trim(this.search);
if (val) {
this.$yrouter.push({
path: "/pages/shop/GoodsList/main",
query: { s: val }
});
setTimeout(() => (this.search = ""), 500);
}
},
asideTap(index) {
this.navActive = index;
}
},
beforeDestroy: function() {
// document.removeEventListener("scroll", this.onScroll, false);
}
};
</script>
<style >
.productSort{
height:100%
}
</style>

View File

@ -0,0 +1,5 @@
import Vue from 'vue'
import App from './index'
const app = new Vue(App)
app.$mount()

View File

@ -0,0 +1,93 @@
<template>
<div ref="container">
<div class="collectionGoods" v-if="collectProductList.length > 0">
<div
@click="$yrouter.push({ path: '/pages/shop/GoodsCon/index',query:{id:item.pid} })"
class="item acea-row row-between-wrapper"
v-for="(item, collectProductListIndex) in collectProductList"
:key="collectProductListIndex"
>
<div class="pictrue">
<img :src="item.image" />
</div>
<div class="text acea-row row-column-between">
<div class="infor line1">{{ item.storeName }}</div>
<div class="acea-row row-between-wrapper">
<div class="money font-color-red">¥{{ item.price }}</div>
<div class="delete" @click.prevent="delCollection(collectProductListIndex)">删除</div>
</div>
</div>
</div>
</div>
<Loading :loaded="loadend" :loading="loading"></Loading>
<div
class="noCommodity"
style="background-color:#fff;"
v-if="collectProductList.length < 1 && page > 1"
>
<div class="noPictrue">
<img :src="$VUE_APP_RESOURCES_URL+'/images/noCollection.png'" class="image" />
</div>
<Recommend></Recommend>
</div>
</div>
</template>
<script>
import Recommend from "@/components/Recommend";
import { getCollectUser, getCollectDel } from "@/api/user";
import Loading from "@/components/Loading";
export default {
name: "GoodsCollection",
components: {
Recommend,
Loading
},
props: {},
data: function() {
return {
page: 1,
limit: 20,
collectProductList: [],
loadTitle: "",
loading: false,
loadend: false
};
},
mounted: function() {
this.get_user_collect_product();
},
onReachBottom() {
!this.loading && this.get_user_collect_product();
},
methods: {
get_user_collect_product: function() {
let that = this;
if (that.loading) return; //阻止下次请求false可以进行请求
if (that.loadend) return; //阻止结束当前请求false可以进行请求
that.loading = true;
getCollectUser(that.page, that.limit).then(res => {
that.loading = false;
//apply();js将一个数组插入另一个数组;
that.collectProductList.push.apply(that.collectProductList, res.data);
that.loadend = res.data.length < that.limit; //判断所有数据是否加载完成;
that.page = that.page + 1;
});
},
//删除收藏;
delCollection: function(index) {
let that = this,
id = that.collectProductList[index].pid,
category = that.collectProductList[index].category;
getCollectDel(id, category).then(function() {
that.$dialog.toast({
mes: "删除收藏成功!",
callback: () => {
that.collectProductList.splice(index, 1);
that.$set(that, "collectProductList", that.collectProductList);
}
});
});
}
}
};
</script>

View File

@ -0,0 +1,5 @@
import Vue from 'vue'
import App from './index'
const app = new Vue(App)
app.$mount()

View File

@ -0,0 +1,801 @@
<template>
<div :class="[posterImageStatus ? 'noscroll product-con' : 'product-con']">
<product-con-swiper :img-urls="storeInfo.sliderImageArr"></product-con-swiper>
<div class="wrapper">
<div class="share acea-row row-between row-bottom">
<div class="money font-color-red">
<span class="num">{{ storeInfo.price }}</span>
<span
class="vip-money"
v-if="storeInfo.vipPrice && storeInfo.vipPrice > 0"
>¥{{ storeInfo.vipPrice }}</span>
<img
:src="$VUE_APP_RESOURCES_URL+'/images/vip.png'"
class="image"
v-if="storeInfo.vipPrice && storeInfo.vipPrice > 0"
/>
</div>
<div class="iconfont icon-fenxiang" @click="listenerActionSheet"></div>
</div>
<div class="introduce">{{ storeInfo.storeName }}</div>
<div class="label acea-row row-between-wrapper">
<div>原价:¥{{ storeInfo.otPrice }}</div>
<div>库存:{{ storeInfo.stock }}{{ storeInfo.unitName }}</div>
<div>销量:{{ storeInfo.sales }}{{ storeInfo.unitName }}</div>
</div>
<div class="coupon acea-row row-between-wrapper" @click="couponTap" v-if="couponList.length">
<div class="hide line1 acea-row">
优惠券:
<div
class="activity"
v-for="(item, couponListEq) in couponList"
:key="couponListEq"
>满{{ item.use_min_price }}减{{ item.coupon_price }}</div>
</div>
<div class="iconfont icon-jiantou"></div>
</div>
</div>
<div class="attribute acea-row row-between-wrapper" @click="selecAttrTap">
<div>
{{ attrTxt }}
<span class="atterTxt">{{ attrValue }}</span>
</div>
<div class="iconfont icon-jiantou"></div>
</div>
<div class="store-info" v-if="system_store.id !== undefined">
<div class="title">门店信息</div>
<div class="info acea-row row-between-wrapper">
<div class="picTxt acea-row row-between-wrapper">
<div class="pictrue">
<img :src="system_store.image" />
</div>
<div class="text">
<div class="name line1">{{ system_store.name }}</div>
<div class="address acea-row row-middle" @click="showChang">
<span class="addressTxt line1">
{{
system_store._detailed_address
}}
</span>
<span class="iconfont icon-youjian"></span>
</div>
</div>
</div>
<!-- <a class="iconfont icon-dadianhua01 font-color-red" :href="'tel:' + system_store.phone"></a> -->
</div>
</div>
<div class="userEvaluation" v-if="replyCount">
<div class="title acea-row row-between-wrapper">
<div>用户评价({{ replyCount }})</div>
<div
@click="$yrouter.push({ path: '/pages/shop/EvaluateList/index',query:{id}})"
class="praise"
>
<span class="font-color-red">{{ replyChance }}%</span>好评率
<span class="iconfont icon-jiantou"></span>
</div>
</div>
<user-evaluation :reply="reply"></user-evaluation>
</div>
<div class="superior">
<div class="title acea-row row-center-wrapper">
<img :src="$VUE_APP_RESOURCES_URL+'/images/ling.png'" />
<div class="titleTxt">优品推荐</div>
<img :src="$VUE_APP_RESOURCES_URL+'/images/ling.png'" />
</div>
<template>
<div class="slider-banner banner">
<swiper :options="swiperRecommend" v-if="goodList.length > 0">
<swiper-slide v-for="(item, eq2) in goodList" :key="eq2">
<div class="list acea-row row-middle">
<div class="item" v-for="val in item.list" :key="val.image">
<div class="pictrue">
<img :src="val.image" />
</div>
<div class="name line1">{{ val.store_name }}}</div>
<div class="money font-color-red">¥{{ val.price }}</div>
</div>
</div>
</swiper-slide>
<div class="swiper-pagination" slot="pagination"></div>
</swiper>
</div>
</template>
</div>
<div class="product-intro">
<div class="title">产品介绍</div>
<div class="conter" v-html="storeInfo.description"></div>
</div>
<div style="height:100rpx;"></div>
<div class="footer acea-row row-between-wrapper">
<!--<div class="item" @click="$yrouter.push({ path: '/pages/user/CustomerList/index' })">-->
<!--<div class="iconfont icon-kefu"></div>-->
<!--<div>客服</div>-->
<!--</div>-->
<div class="item" @click="setCollect">
<div class="iconfont" :class="storeInfo.userCollect ? 'icon-shoucang1' : 'icon-shoucang'"></div>
<div>收藏</div>
</div>
<div
@click="$yrouter.push('/pages/shop/ShoppingCart/index')"
class="item animated"
:class="animated === true ? 'bounceIn' : ''"
>
<div class="iconfont icon-gouwuche1">
<span class="num bg-color-red" v-if="CartCount > 0">
{{
CartCount
}}
</span>
</div>
<div>购物车</div>
</div>
<div class="bnt acea-row">
<div class="joinCart" @click="joinCart">加入购物车</div>
<div class="buy" @click="tapBuy">立即购买</div>
</div>
</div>
<CouponPop v-on:changeFun="changeFun" :coupon="coupon"></CouponPop>
<ProductWindow v-on:changeFun="changeFun" :attr="attr" :cartNum="cart_num"></ProductWindow>
<StorePoster
v-on:setPosterImageStatus="setPosterImageStatus"
:posterImageStatus="posterImageStatus"
:posterData="posterData"
></StorePoster>
<ShareInfo v-on:setShareInfoStatus="setShareInfoStatus" :shareInfoStatus="shareInfoStatus"></ShareInfo>
<div class="generate-posters acea-row row-middle" :class="posters ? 'on' : ''">
<div class="item" v-if="weixinStatus === true" @click="setShareInfoStatus">
<div class="iconfont icon-weixin3"></div>
<div class>发送给朋友</div>
</div>
<div class="item" @click="setPosterImageStatus">
<div class="iconfont icon-haibao"></div>
<div class>生成海报</div>
</div>
</div>
<div class="mask" @touchmove.prevent @click="listenerActionClose" v-show="posters"></div>
<div class="geoPage" v-if="mapShow">
<iframe
width="100%"
height="100%"
frameborder="0"
scrolling="no"
:src="'https://apis.map.qq.com/uri/v1/geocoder?coord=' +system_store.latitude +',' +system_store.longitude +'&referer=' +mapKey"
></iframe>
</div>
</div>
</template>
<style scoped>
.geoPage {
position: fixed;
width: 100%;
height: 100%;
top: 0;
z-index: 10000;
}
.product-con .store-info {
margin-top: 0.2rem;
background-color: #fff;
}
.product-con .store-info .title {
padding: 0 0.3rem;
font-size: 0.28rem;
color: #282828;
height: 0.8rem;
line-height: 0.8rem;
border-bottom: 0.01rem solid #f5f5f5;
}
.product-con .store-info .info {
padding: 0 0.3rem;
height: 1.26rem;
}
.product-con .store-info .info .picTxt {
width: 6.15rem;
}
.product-con .store-info .info .picTxt .pictrue {
width: 0.76rem;
height: 0.76rem;
}
.product-con .store-info .info .picTxt .pictrue img {
width: 100%;
height: 100%;
border-radius: 0.06rem;
}
.product-con .store-info .info .picTxt .text {
width: 5.22rem;
}
.product-con .store-info .info .picTxt .text .name {
font-size: 0.3rem;
color: #282828;
}
.product-con .store-info .info .picTxt .text .address {
font-size: 0.24rem;
color: #666;
margin-top: 0.03rem;
}
.product-con .store-info .info .picTxt .text .address .iconfont {
color: #707070;
font-size: 0.18rem;
margin-left: 0.1rem;
}
.product-con .store-info .info .picTxt .text .address .addressTxt {
width: 4.8rem;
}
.product-con .store-info .info .iconfont {
font-size: 0.4rem;
}
.product-con .superior {
background-color: #fff;
margin-top: 0.2rem;
}
.product-con .superior .title {
height: 0.98rem;
}
.product-con .superior .title img {
width: 0.3rem;
height: 0.3rem;
}
.product-con .superior .title .titleTxt {
margin: 0 0.2rem;
font-size: 0.3rem;
background-image: linear-gradient(to right, #f57a37 0%, #f21b07 100%);
background-image: -webkit-linear-gradient(to right, #f57a37 0%, #f21b07 100%);
background-image: -moz-linear-gradient(to right, #f57a37 0%, #f21b07 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
.product-con .superior .slider-banner {
width: 6.9rem;
margin: 0 auto;
padding-bottom: 0.2rem;
}
.product-con .superior .slider-banner .list {
width: 100%;
padding-bottom: 0.2rem;
}
.product-con .superior .slider-banner .list .item {
width: 2.15rem;
margin: 0 0.22rem 0.3rem 0;
font-size: 0.26rem;
}
.product-con .superior .slider-banner .list .item:nth-of-type(3n) {
margin-right: 0;
}
.product-con .superior .slider-banner .list .item .pictrue {
width: 100%;
height: 2.15rem;
}
.product-con .superior .slider-banner .list .item .pictrue img {
width: 100%;
height: 100%;
border-radius: 0.06rem;
}
.product-con .superior .slider-banner .list .item .name {
color: #282828;
margin-top: 0.12rem;
}
.product-con .superior .slider-banner .swiper-pagination-bullet {
background-color: #999;
}
.product-con .superior .slider-banner .swiper-pagination-bullet-active {
background-color: #e93323;
}
.mask {
-webkit-filter: blur(2px);
-moz-filter: blur(2px);
-ms-filter: blur(2px);
filter: blur(2px);
}
.footer .icon-shoucang1 {
color: #73cbb6;
}
.product-con .product-intro .conter div {
width: 100% !important;
}
.generate-posters {
width: 100%;
height: 1.7rem;
background-color: #fff;
position: fixed;
left: 0;
bottom: 0;
z-index: 99;
transform: translate3d(0, 100%, 0);
-webkit-transform: translate3d(0, 100%, 0);
-ms-transform: translate3d(0, 100%, 0);
-moz-transform: translate3d(0, 100%, 0);
-o-transform: translate3d(0, 100%, 0);
transition: all 0.3s cubic-bezier(0.25, 0.5, 0.5, 0.9);
-webkit-transition: all 0.3s cubic-bezier(0.25, 0.5, 0.5, 0.9);
-moz-transition: all 0.3s cubic-bezier(0.25, 0.5, 0.5, 0.9);
-o-transition: all 0.3s cubic-bezier(0.25, 0.5, 0.5, 0.9);
}
.generate-posters.on {
transform: translate3d(0, 0, 0);
-webkit-transform: translate3d(0, 0, 0);
-ms-transform: translate3d(0, 0, 0);
-moz-transform: translate3d(0, 0, 0);
-o-transform: translate3d(0, 0, 0);
}
.generate-posters .item {
flex: 50%;
-webkit-flex: 50%;
-ms-flex: 50%;
text-align: center;
}
.generate-posters .item .iconfont {
font-size: 0.8rem;
color: #5eae72;
}
.generate-posters .item .iconfont.icon-haibao {
color: #5391f1;
}
.noscroll {
height: 100%;
overflow: hidden;
}
</style>
<script>
// import { swiper, swiperSlide } from "vue-awesome-swiper";
import ProductConSwiper from "@/components/ProductConSwiper";
import UserEvaluation from "@/components/UserEvaluation";
import CouponPop from "@/components/CouponPop";
import ProductWindow from "@/components/ProductWindow";
import StorePoster from "@/components/StorePoster";
import ShareInfo from "@/components/ShareInfo";
import {
getProductDetail,
postCartAdd,
getCartCount,
getProductCode
} from "@/api/store";
import {
getCoupon,
getCollectAdd,
getCollectDel,
getUserInfo
} from "@/api/user";
import { isWeixin, PosterCanvas, handleQrCode } from "@/utils";
// import { wechatEvevt } from "@/libs/wechat";
import { imageBase64 } from "@/api/public";
import { mapGetters } from "vuex";
export default {
name: "GoodsCon",
components: {
// swiper,
// swiperSlide,
ProductConSwiper,
UserEvaluation,
CouponPop,
ProductWindow,
StorePoster,
ShareInfo
},
data: function() {
return {
shareInfoStatus: false,
weixinStatus: false,
mapShow: false,
mapKey: "",
posterData: {
image: "",
title: "",
price: "",
code: ""
},
posterImageStatus: false,
animated: false,
coupon: {
coupon: false,
list: []
},
attr: {
cartAttr: false,
productAttr: [],
productSelect: {}
},
isOpen: false, //是否打开属性组件
productValue: [],
id: 0,
storeInfo: {},
couponList: [],
attrTxt: "请选择",
attrValue: "",
cart_num: 1, //购买数量
replyCount: "",
replyChance: "",
reply: [],
priceName: 0,
CartCount: 0,
posters: false,
banner: [{}, {}],
swiperRecommend: {
pagination: {
el: ".swiper-pagination",
clickable: true
},
autoplay: false,
loop: false,
speed: 1000,
observer: true,
observeParents: true
},
goodList: [],
system_store: {},
qqmapsdk: null
};
},
computed: mapGetters(["isLogin"]),
mounted: function() {
let url = handleQrCode();
console.log(url);
if (url && url.productId) {
this.id = url.productId;
} else {
this.id = this.$yroute.query.id;
}
this.productCon();
},
methods: {
showChang: function() {
if (isWeixin()) {
let config = {
latitude: this.system_store.latitude,
longitude: this.system_store.longitude,
name: this.system_store.name,
address: this.system_store._detailed_address
};
// wechatEvevt("openLocation", config)
// .then(res => {
// })
// .catch(res => {
// if (res.is_ready) {
// res.wx.openLocation(config);
// }
// });
} else {
if (!this.mapKey)
return this.$dialog.error(
"暂无法使用查看地图请配置您的腾讯地图key"
);
this.mapShow = true;
}
},
updateTitle() {
// document.title = this.storeInfo.storeName || this.$yroute.meta.title;
},
setShareInfoStatus: function() {
this.shareInfoStatus = !this.shareInfoStatus;
this.posters = false;
},
shareCode: function() {
var that = this;
getProductCode(that.id).then(res => {
that.posterData.code = res.data.code;
that.listenerActionSheet();
});
},
setPosterImageStatus: function() {
this.posterImageStatus = !this.posterImageStatus;
this.posters = false;
},
//产品详情接口;
productCon: function() {
let that = this;
getProductDetail(that.id)
.then(res => {
that.$set(that, "storeInfo", res.data.storeInfo);
that.$set(that.attr, "productAttr", res.data.productAttr);
that.$set(that, "productValue", res.data.productValue);
that.$set(that, "replyCount", res.data.replyCount);
that.$set(that, "replyChance", res.data.replyChance);
that.reply = res.data.reply ? [res.data.reply] : [];
that.$set(that, "reply", that.reply);
that.$set(that, "priceName", res.data.priceName);
that.posterData.image = that.storeInfo.image;
if (that.storeInfo.storeName.length > 30) {
that.posterData.title =
that.storeInfo.storeName.substring(0, 30) + "...";
} else {
that.posterData.title = that.storeInfo.storeName;
}
that.posterData.price = that.storeInfo.price;
that.posterData.code = that.storeInfo.codeBase;
// that.system_store = res.data.system_store;
let good_list = res.data.goodList || [];
let goodArray = [];
let count = Math.ceil(good_list.length / 6);
for (let i = 0; i < count; i++) {
var list = good_list.slice(i * 6, 6);
if (list.length) goodArray.push({ list: list });
}
that.mapKay = res.data.mapKay;
that.$set(that, "goodList", goodArray);
that.updateTitle();
that.DefaultSelect();
that.getCartCount();
})
.catch(res => {
wx.showToast({
title: res.msg,
icon: "none",
duration: 2000
});
});
},
//默认选中属性;
DefaultSelect: function() {
let productAttr = this.attr.productAttr;
let value = [];
for (let i = 0; i < productAttr.length; i++) {
this.$set(productAttr[i], "index", 0);
value.push(productAttr[i].attrValueArr[0]);
}
//sort();排序函数:数字-英文-汉字;
let productSelect = this.productValue[value.sort().join(",")];
if (productSelect && productAttr.length) {
this.$set(
this.attr.productSelect,
"store_name",
this.storeInfo.storeName
);
this.$set(this.attr.productSelect, "image", productSelect.image);
this.$set(this.attr.productSelect, "price", productSelect.price);
this.$set(this.attr.productSelect, "stock", productSelect.stock);
this.$set(this.attr.productSelect, "unique", productSelect.unique);
this.$set(this.attr.productSelect, "cart_num", 1);
this.$set(this, "attrValue", value.sort().join(","));
this.$set(this, "attrTxt", "已选择");
} else if (!productSelect && productAttr.length) {
this.$set(
this.attr.productSelect,
"store_name",
this.storeInfo.storeName
);
this.$set(this.attr.productSelect, "image", this.storeInfo.image);
this.$set(this.attr.productSelect, "price", this.storeInfo.price);
this.$set(this.attr.productSelect, "stock", 0);
this.$set(this.attr.productSelect, "unique", "");
this.$set(this.attr.productSelect, "cart_num", 0);
this.$set(this, "attrValue", "");
this.$set(this, "attrTxt", "请选择");
} else if (!productSelect && !productAttr.length) {
this.$set(
this.attr.productSelect,
"store_name",
this.storeInfo.storeName
);
this.$set(this.attr.productSelect, "image", this.storeInfo.image);
this.$set(this.attr.productSelect, "price", this.storeInfo.price);
this.$set(this.attr.productSelect, "stock", this.storeInfo.stock);
this.$set(
this.attr.productSelect,
"unique",
this.storeInfo.unique || ""
);
this.$set(this.attr.productSelect, "cart_num", 1);
this.$set(this, "attrValue", "");
this.$set(this, "attrTxt", "请选择");
}
},
//购物车;
ChangeCartNum: function(changeValue) {
//changeValue:是否 加|减
//获取当前变动属性
let productSelect = this.productValue[this.attrValue];
//如果没有属性,赋值给商品默认库存
if (productSelect === undefined && !this.attr.productAttr.length) {
productSelect = this.attr.productSelect;
}
//无属性值即库存为0不存在加减
if (productSelect === undefined) return;
let stock = productSelect.stock || 0;
let num = this.attr.productSelect;
if (changeValue) {
num.cart_num++;
if (num.cart_num > stock) {
this.$set(this.attr.productSelect, "cart_num", stock);
this.$set(this, "cart_num", stock);
} else {
this.$set(this.attr.productSelect, "cart_num", num.cart_num);
this.$set(this, "cart_num", num.cart_num);
}
} else {
num.cart_num--;
if (num.cart_num < 1) {
this.$set(this.attr.productSelect, "cart_num", 1);
this.$set(this, "cart_num", 1);
}
}
},
//将父级向子集多次传送的函数合二为一;
changeFun: function(opt) {
if (typeof opt !== "object") opt = {};
let action = opt.action || "";
let value = opt.value === undefined ? "" : opt.value;
this[action] && this[action](value);
},
//打开优惠券插件;
couponTap: function() {
let that = this;
that.coupons();
that.coupon.coupon = true;
},
changecoupon: function(msg) {
this.coupon.coupon = msg;
this.coupons();
},
currentcoupon: function(res) {
let that = this;
that.coupon.coupon = false;
that.$set(that.coupon.list[res], "is_use", true);
},
//可领取优惠券接口;
coupons: function() {
let that = this,
q = { page: 1, limit: 20 };
getCoupon(q).then(res => {
that.$set(that, "couponList", res.data || []);
that.$set(that.coupon, "list", res.data);
});
},
//打开属性插件;
selecAttrTap: function() {
this.attr.cartAttr = true;
this.isOpen = true;
},
changeattr: function(msg) {
this.attr.cartAttr = msg;
console.log(this.attr, msg);
this.isOpen = false;
},
//选择属性;
ChangeAttr: function(res) {
let productSelectValue = this.productValue[res];
if (productSelectValue) {
let productSelect = {
...this.attr.productSelect,
image: productSelectValue.image,
price: productSelectValue.price,
stock: productSelectValue.stock,
unique: productSelectValue.unique,
cart_num: 1
};
let attr = {
...this.attr,
productSelect
};
this.attr = attr;
// this.$set(this.attr.productSelect, "image", productSelect.image);
// this.$set(this.attr.productSelect, "price", productSelect.price);
// this.$set(this.attr.productSelect, "stock", productSelect.stock);
// this.$set(this.attr.productSelect, "unique", productSelect.unique);
// this.$set(this.attr.productSelect, "cart_num", 1);
this.$set(this, "attrValue", res);
this.$set(this, "attrTxt", "已选择");
} else {
this.$set(this.attr.productSelect, "image", this.storeInfo.image);
this.$set(this.attr.productSelect, "price", this.storeInfo.price);
this.$set(this.attr.productSelect, "stock", 0);
this.$set(this.attr.productSelect, "unique", "");
this.$set(this.attr.productSelect, "cart_num", 0);
this.$set(this, "attrValue", "");
this.$set(this, "attrTxt", "请选择");
}
},
//收藏商品
setCollect: function() {
let that = this,
id = that.storeInfo.id,
category = "product";
if (that.storeInfo.userCollect) {
getCollectDel(id, category).then(function() {
that.storeInfo.userCollect = !that.storeInfo.userCollect;
});
} else {
getCollectAdd(id, category).then(function() {
that.storeInfo.userCollect = !that.storeInfo.userCollect;
});
}
},
// 点击加入购物车按钮
joinCart: function() {
//0=加入购物车
this.goCat(0);
},
// 加入购物车;
goCat: function(news) {
let that = this,
productSelect = that.productValue[this.attrValue];
//打开属性
if (that.attrValue) {
//默认选中了属性,但是没有打开过属性弹窗还是自动打开让用户查看默认选中的属性
that.attr.cartAttr = !that.isOpen ? true : false;
} else {
if (that.isOpen) that.attr.cartAttr = true;
else that.attr.cartAttr = !that.attr.cartAttr;
}
//只有关闭属性弹窗时进行加入购物车
if (that.attr.cartAttr === true && that.isOpen === false)
return (that.isOpen = true);
//如果有属性,没有选择,提示用户选择
if (
that.attr.productAttr.length &&
productSelect === undefined &&
that.isOpen === true
)
return that.$dialog.toast({ mes: "产品库存不足,请选择其它" });
let q = {
productId: that.id,
cartNum: that.attr.productSelect.cart_num,
new: news,
uniqueId:
that.attr.productSelect !== undefined
? that.attr.productSelect.unique
: ""
};
postCartAdd(q)
.then(function(res) {
that.isOpen = false;
that.attr.cartAttr = false;
if (news) {
that.$yrouter.push({
path: "/pages/order/OrderSubmission/main",
query: { id: res.data.cartId }
});
} else {
that.$dialog.toast({
mes: "添加购物车成功",
callback: () => {
that.getCartCount(true);
}
});
}
})
.catch(error => {
that.isOpen = false;
wx.showToast({
title: error.response.data.msg,
icon: "none",
duration: 2000
});
});
},
//获取购物车数量
getCartCount: function(isAnima) {
let that = this;
const isLogin = that.isLogin;
if (isLogin) {
getCartCount({ numType: 0 }).then(res => {
that.CartCount = res.data.count;
//加入购物车后重置属性
if (isAnima) {
that.animated = true;
setTimeout(function() {
that.animated = false;
}, 500);
}
});
}
},
//立即购买;
tapBuy: function() {
// 1=直接购买
this.goCat(1);
},
listenerActionSheet: function() {
if (isWeixin() === true) {
this.weixinStatus = true;
}
this.posters = true;
},
listenerActionClose: function() {
this.posters = false;
}
}
};
</script>

View File

@ -0,0 +1,5 @@
import Vue from 'vue'
import App from './index'
const app = new Vue(App)
app.$mount()

View File

@ -0,0 +1,206 @@
<template>
<div class="evaluate-con">
<div class="goodsStyle acea-row row-between" v-if="orderCon.productInfo">
<div class="pictrue">
<img :src="orderCon.productInfo.image" class="image" />
</div>
<div class="text acea-row row-between">
<div class="name line2">{{ orderCon.productInfo.storeName }}</div>
<div class="money">
<div>{{ orderCon.productInfo.price }}</div>
<div class="num">x{{ orderCon.cartNum }}</div>
</div>
</div>
</div>
<div class="score">
<div
class="item acea-row row-middle"
v-for="(item, scoreListIndexw) in scoreList"
:key="scoreListIndexw"
>
<div>{{ item.name }}</div>
<div class="starsList">
<span
@click="stars(starsIndexn, scoreListIndexw)"
v-for="(itemn, starsIndexn) in item.stars"
:key="starsIndexn"
class="iconfont"
:class="
item.index >= starsIndexn
? 'icon-shitixing font-color-red'
: 'icon-kongxinxing'
"
></span>
</div>
<span class="evaluate">
{{
item.index === -1 ? "" : item.index + 1 + "分"
}}
</span>
</div>
<div class="textarea">
<textarea placeholder="商品满足你的期待么?说说你的想法,分享给想买的他们吧~" v-model="expect"></textarea>
<div class="list acea-row row-middle">
<div
class="pictrue"
v-for="(item, uploadPicturesIndex) in uploadPictures"
:key="uploadPicturesIndex"
>
<img :src="item" />
<span
class="iconfont icon-guanbi1 font-color-red"
@click="uploadPictures.splice(uploadPicturesIndex, 1)"
></span>
</div>
<!-- <VueCoreImageUpload
class="btn btn-primary"
:crop="false"
compress="80"
@imageuploaded="imageuploaded"
:headers="headers"
:max-file-size="5242880"
:credentials="false"
inputAccept="image/*"
inputOfFile="file"
:url="url"
v-if="uploadPictures.length < 8"
>
<div
class="pictrue uploadBnt acea-row row-center-wrapper row-column"
>
<span class="iconfont icon-icon25201"></span>
<div>上传图片</div>
</div>
</VueCoreImageUpload>-->
</div>
</div>
<div class="evaluateBnt bg-color-red" @click="submit">立即评价</div>
</div>
</div>
</template>
<style scoped>
.evaluate-con .score .textarea .list .pictrue.uploadBnt {
border: 1px solid #ddd;
}
</style>
<script>
import { postOrderProduct, postOrderComment } from "@/api/store";
import { trim } from "@/utils";
import { VUE_APP_API_URL } from "@/config";
import { required } from "@/utils/validate";
import { validatorDefaultCatch } from "@/utils/dialog";
const NAME = "GoodsEvaluate";
export default {
name: NAME,
components: {
// VueCoreImageUpload
},
props: {},
data: function() {
return {
orderCon: {
cartProduct: {
productInfo: {}
}
},
scoreList: [
{
name: "商品质量",
stars: ["", "", "", "", ""],
index: -1
},
{
name: "服务态度",
stars: ["", "", "", "", ""],
index: -1
}
],
url: `${VUE_APP_API_URL}/api/qiNiuContent`,
headers: {
Authorization: "Bearer " + this.$store.state.token
},
uploadPictures: [],
expect: "",
unique: ""
};
},
mounted: function() {
this.unique = this.$yroute.query.id;
this.getOrderProduct();
},
watch: {
$yroute(n) {
if (n.name === NAME && this.unique !== n.params.id) {
this.unique = n.params.id;
this.$set(this.scoreList[0], "index", -1);
this.$set(this.scoreList[1], "index", -1);
this.expect = "";
this.uploadPictures = [];
this.getOrderProduct();
}
}
},
methods: {
getOrderProduct: function() {
let that = this,
unique = that.unique;
postOrderProduct(unique).then(res => {
that.orderCon = res.data;
});
},
stars: function(indexn, indexw) {
this.scoreList[indexw].index = indexn;
},
imageuploaded(res) {
if (res.errno !== 0) return this.$dialog.error(res.msg || "上传图片失败");
this.uploadPictures.push(res.data[0]);
},
async submit() {
const expect = trim(this.expect),
product_score =
this.scoreList[0].index + 1 === 0 ? "" : this.scoreList[0].index + 1,
service_score =
this.scoreList[1].index + 1 === 0 ? "" : this.scoreList[1].index + 1;
try {
await this.$validator({
product_score: [
required("请选择商品质量分数", {
type: "number"
})
],
service_score: [
required("请选择服务态度分数", {
type: "number"
})
]
}).validate({ product_score, service_score });
} catch (e) {
return validatorDefaultCatch(e);
}
postOrderComment({
productScore: product_score,
serviceScore: service_score,
unique: this.unique,
pics: this.uploadPictures.join(","),
comment: expect
})
.then(() => {
wx.showToast({
title: "评价成功",
icon: "success",
duration: 2000
});
this.$yrouter.push({
path: "/pages/order/OrderDetails/main",
query: { id: this.orderCon.orderId }
});
})
.catch(res => {
this.$dialog.error(res.msg);
});
}
}
};
</script>

View File

@ -0,0 +1,5 @@
import Vue from 'vue'
import App from './index'
const app = new Vue(App)
app.$mount()

View File

@ -0,0 +1,268 @@
<template>
<div class="productList" ref="container">
<form @submit.prevent="submitForm">
<div class="search bg-color-red acea-row row-between-wrapper">
<div class="input acea-row row-between-wrapper">
<span class="iconfont icon-sousuo"></span>
<input placeholder="搜索商品信息" v-model="where.keyword" />
</div>
<div
class="iconfont"
:class="Switch === true ? 'icon-pailie' : 'icon-tupianpailie'"
@click="switchTap"
></div>
</div>
</form>
<div class="nav acea-row row-middle">
<div
class="item"
:class="title ? 'font-color-red' : ''"
@click="set_where(0)"
>{{ title ? title : "默认" }}</div>
<div class="item" @click="set_where(1)">
价格
<img :src="$VUE_APP_RESOURCES_URL+'/images/horn.png'" v-if="price === 0" />
<img :src="$VUE_APP_RESOURCES_URL+'/images/up.png'" v-if="price === 1" />
<img :src="$VUE_APP_RESOURCES_URL+'/images/down.png'" v-if="price === 2" />
</div>
<div class="item" @click="set_where(2)">
销量
<img :src="$VUE_APP_RESOURCES_URL+'/images/horn.png'" v-if="stock === 0" />
<img :src="$VUE_APP_RESOURCES_URL+'/images/up.png'" v-if="stock === 1" />
<img :src="$VUE_APP_RESOURCES_URL+'/images/down.png'" v-if="stock === 2" />
</div>
<!-- down -->
<div class="item" :class="nows ? 'font-color-red' : ''" @click="set_where(3)">新品</div>
</div>
<div
class="list acea-row row-between-wrapper"
:class="Switch === true ? '' : 'on'"
ref="container"
>
<div
@click="$yrouter.push({path: '/pages/shop/GoodsCon/index',query:{id:item.id}})"
class="item"
:class="Switch === true ? '' : 'on'"
v-for="(item, productListIndex) in productList"
:key="productListIndex"
:title="item.storeName"
>
<div class="pictrue" :class="Switch === true ? '' : 'on'">
<img :src="item.image" :class="Switch === true ? '' : 'on'" />
</div>
<div class="text" :class="Switch === true ? '' : 'on'">
<div class="name line1">{{ item.storeName }}</div>
<div class="money font-color-red" :class="Switch === true ? '' : 'on'">
<span class="num">{{ item.price }}</span>
</div>
<div class="vip acea-row row-between-wrapper" :class="Switch === true ? '' : 'on'">
<div class="vip-money">¥{{ item.otPrice }}</div>
<div>已售{{ item.sales }}件</div>
</div>
</div>
</div>
</div>
<Loading :loaded="loadend" :loading="loading"></Loading>
<div
class="noCommodity"
style="background-color: #fff;"
v-if="productList.length === 0 && where.page > 1"
>
<div class="noPictrue">
<img :src="$VUE_APP_RESOURCES_URL+'/images/noGood.png'" class="image" />
</div>
</div>
<Recommend v-if="productList.length === 0 && where.page > 1"></Recommend>
</div>
</template>
<script>
import Recommend from "@/components/Recommend";
import { getProducts } from "@/api/store";
import debounce from "lodash.debounce";
import Loading from "@/components/Loading";
export default {
name: "GoodsList",
components: {
Recommend,
Loading
},
props: {},
data: function() {
// const { s = "", id = 0, title = "" } = this.$yroute.query;
const s = "",
id = 0,
title = "";
return {
hostProduct: [],
productList: [],
Switch: true,
where: {
page: 1,
limit: 8,
keyword: s,
sid: id, //二级分类id
news: 0,
priceOrder: "",
salesOrder: ""
},
title: title && id ? title : "",
loadTitle: "",
loading: false,
loadend: false,
price: 0,
stock: 0,
nows: false
};
},
watch: {
title() {
this.updateTitle();
},
$yroute(to) {
// if (to.name !== "GoodsList") return;
// const { s = "", id = 0, title = "" } = to.query;
// if (s !== this.where.keyword || id !== this.where.sid) {
// this.where.keyword = s;
// this.loadend = false;
// this.loading = false;
// this.where.page = 1;
// this.where.sid = id;
// this.title = title && id ? title : "";
// this.nows = false;
// this.$set(this, "productList", []);
// this.price = 0;
// this.stock = 0;
// this.get_product_list();
// }
}
},
mounted: function() {
const { s = "", id = 0, title = "" } = this.$yroute.query;
this.updateTitle();
this.get_product_list();
},
onReachBottom() {
!this.loading && this.get_product_list();
},
onHide() {
this.hostProduct = [];
this.productList = [];
this.Switch = true;
this.where = {
page: 1,
limit: 8,
keyword: s,
sid: id, //二级分类id
news: 0,
priceOrder: "",
salesOrder: ""
};
this.loadTitle = "";
this.loading = false;
this.loadend = false;
this.price = 0;
this.stock = 0;
this.nows = fals;
},
methods: {
updateTitle() {
// document.title = this.title || this.$yroute.meta.title;
},
get_product_list() {
console.log("请求李贝奥");
var that = this;
this.setWhere();
// if (to.name !== "GoodsList") return;
const { s = "", id = 0, title = "" } = this.$yroute.query;
if (s !== this.where.keyword || id !== this.where.sid) {
this.where.keyword = s;
this.loadend = false;
this.loading = false;
this.where.page = 1;
this.where.sid = id;
this.title = title && id ? title : "";
this.nows = false;
this.$set(this, "productList", []);
this.price = 0;
this.stock = 0;
// this.get_product_list();
}
let q = that.where;
getProducts(q).then(res => {
that.loading = false;
that.productList.push.apply(that.productList, res.data);
that.loadend = res.data.length < that.where.limit; //判断所有数据是否加载完成;
that.where.page = that.where.page + 1;
});
},
submitForm: function() {
this.$set(this, "productList", []);
this.where.page = 1;
this.loadend = false;
this.loading = false;
this.get_product_list();
},
//点击事件处理
set_where: function(index) {
let that = this;
switch (index) {
case 0:
return that.$yrouter.push({ path: "/pages/shop/GoodsClass/main" });
case 1:
if (that.price === 0) that.price = 1;
else if (that.price === 1) that.price = 2;
else if (that.price === 2) that.price = 0;
that.stock = 0;
break;
case 2:
if (that.stock === 0) that.stock = 1;
else if (that.stock === 1) that.stock = 2;
else if (that.stock === 2) that.stock = 0;
that.price = 0;
break;
case 3:
that.nows = !that.nows;
break;
default:
break;
}
that.$set(that, "productList", []);
that.where.page = 1;
that.loadend = false;
that.get_product_list();
},
//设置where条件
setWhere: function() {
let that = this;
if (that.price === 0) {
that.where.priceOrder = "";
} else if (that.price === 1) {
that.where.priceOrder = "asc";
} else if (that.price === 2) {
that.where.priceOrder = "desc";
}
if (that.stock === 0) {
that.where.salesOrder = "";
} else if (that.stock === 1) {
that.where.salesOrder = "asc";
} else if (that.stock === 2) {
that.where.salesOrder = "desc";
}
that.where.news = that.nows ? "1" : "0";
},
switchTap: function() {
let that = this;
that.Switch = !that.Switch;
}
}
};
</script>
<style scoped>
.noCommodity {
border-top: 3px solid #f5f5f5;
padding-bottom: 1px;
}
</style>

View File

@ -0,0 +1,5 @@
import Vue from 'vue'
import App from './index'
const app = new Vue(App)
app.$mount()

View File

@ -0,0 +1,72 @@
<template>
<div class="quality-recommend">
<div class="slider-banner swiper">
<swiper indicatorDots="true" v-if="banner.length > 0">
<block v-for="(item, imgUrlsIndex) in imgUrls" :key="imgUrlsIndex">
<swiper-item>
<img :src="item.img" class="slide-image" />
</swiper-item>
</block>
</swiper>
</div>
<div class="title acea-row row-center-wrapper">
<div class="line"></div>
<div class="name">
<span class="iconfont icon-cuxiaoguanli"></span>促销单品
</div>
<div class="line"></div>
</div>
<Promotion-good :benefit="goodsList"></Promotion-good>
</div>
</template>
<script>
// import { swiper, swiperSlide } from "vue-awesome-swiper";
import PromotionGood from "@/components/PromotionGood";
import { getGroomList } from "@/api/store";
export default {
name: "GoodsPromotion",
components: {
// swiper,
// swiperSlide,
PromotionGood
},
props: {},
data: function() {
return {
imgUrls: [],
goodsList: [],
RecommendSwiper: {
pagination: {
el: ".swiper-pagination",
clickable: true
},
autoplay: {
disableOnInteraction: false,
delay: 2000
},
loop: true,
speed: 1000,
observer: true,
observeParents: true
}
};
},
mounted: function() {
this.getIndexGroomList();
},
methods: {
getIndexGroomList: function() {
let that = this;
getGroomList(4)
.then(res => {
that.imgUrls = res.data.banner;
that.goodsList = res.data.list;
})
.catch(function(res) {
this.$dialog.toast({ mes: res.msg });
});
}
}
};
</script>

View File

@ -0,0 +1,5 @@
import Vue from 'vue'
import App from './index'
const app = new Vue(App)
app.$mount()

View File

@ -0,0 +1,80 @@
<template>
<div class="quality-recommend">
<div class="title acea-row row-center-wrapper">
<div class="line"></div>
<div class="name">
<span class="iconfont" :class="icon"></span>{{ name }}
</div>
<div class="line"></div>
</div>
<GoodList :good-list="goodsList" :is-sort="false"></GoodList>
</div>
</template>
<script>
import GoodList from "@/components/GoodList";
import { getGroomList } from "@/api/store";
export default {
name: "HotNewGoods",
components: {
GoodList
},
props: {},
data: function() {
return {
imgUrls: [],
goodsList: [],
name: "",
icon: "",
RecommendSwiper: {
pagination: {
el: ".swiper-pagination",
clickable: true
},
autoplay: {
disableOnInteraction: false,
delay: 2000
},
loop: true,
speed: 1000,
observer: true,
observeParents: true
}
};
},
mounted: function() {
this.titleInfo();
this.getIndexGroomList();
},
methods: {
titleInfo: function() {
let type = this.$yroute.query.type;
if (type === "1") {
this.name = "精品推荐";
this.icon = "icon-jingpintuijian";
// document.title = "精品推荐";
} else if (type === "2") {
this.name = "热门榜单";
this.icon = "icon-remen";
document.title = "热门榜单";
} else if (type === "3") {
this.name = "首发新品";
this.icon = "icon-xinpin";
// document.title = "首发新品";
}
},
getIndexGroomList: function() {
let that = this;
let type = this.$yroute.query.type;
getGroomList(type)
.then(res => {
that.imgUrls = res.data.banner;
that.goodsList = res.data.list;
})
.catch(function(res) {
this.$dialog.toast({ mes: res.msg });
});
}
}
};
</script>

View File

@ -0,0 +1,5 @@
import Vue from 'vue'
import App from './index'
const app = new Vue(App)
app.$mount()

View File

@ -0,0 +1,485 @@
<template>
<div class="shoppingCart">
<div class="labelNav acea-row row-around row-middle">
<div class="item">
<span class="iconfont icon-xuanzhong"></span>100%正品保证
</div>
<div class="item">
<span class="iconfont icon-xuanzhong"></span>所有商品精挑细选
</div>
<div class="item">
<span class="iconfont icon-xuanzhong"></span>售后无忧
</div>
</div>
<div class="nav acea-row row-between-wrapper">
<div>
购物数量
<span class="num font-color-red">{{ count }}</span>
</div>
<div
v-if="cartList.valid.length > 0"
class="administrate acea-row row-center-wrapper"
@click="manage"
>{{ footerswitch ? "取消" : "管理" }}</div>
</div>
<div v-if="validList.length > 0 || cartList.invalid.length > 0">
<div class="list">
<div
class="item acea-row row-between-wrapper"
v-for="(item, cartListValidIndex) in validList"
:key="cartListValidIndex"
>
<div class="select-btn">
<div class="checkbox-wrapper">
<checkbox-group @change="switchSelect(cartListValidIndex)">
<label class="well-check">
<checkbox value :checked="item.checked"></checkbox>
</label>
</checkbox-group>
</div>
</div>
<div class="picTxt acea-row row-between-wrapper">
<div
class="pictrue"
@click="$yrouter.push({ path: '/pages/shop/GoodsCon/index',query:{id:item.productId }})"
>
<img :src="item.productInfo.attrInfo.image" v-if="item.productInfo.attrInfo" />
<img :src="item.productInfo.image" v-else />
</div>
<div class="text">
<div class="line1">{{ item.productInfo.storeName }}</div>
<div
class="infor line1"
v-if="item.productInfo.attrInfo"
>属性:{{ item.productInfo.attrInfo.suk }}</div>
<div class="money">¥{{ item.truePrice }}</div>
</div>
<div class="carnum acea-row row-center-wrapper">
<div
class="reduce"
:class="validList[cartListValidIndex].cartNum <= 1 ? 'on' : ''"
@click.prevent="reduce(cartListValidIndex)"
>-</div>
<div class="num">{{ item.cartNum }}</div>
<div
class="plus"
v-if="validList[cartListValidIndex].attrInfo"
:class="
validList[cartListValidIndex].cartNum >=
validList[cartListValidIndex].attrInfo.stock
? 'on'
: ''
"
@click.prevent="plus(cartListValidIndex)"
>+</div>
<div
class="plus"
v-else
:class="
validList[cartListValidIndex].cartNum >= validList[cartListValidIndex].stock
? 'on'
: ''
"
@click.prevent="plus(cartListValidIndex)"
>+</div>
</div>
</div>
</div>
</div>
<div class="invalidGoods" v-if="cartList.invalid.length > 0">
<div class="goodsNav acea-row row-between-wrapper">
<div @click="goodsOpen">
<span
class="iconfont"
:class="goodsHidden === true ? 'icon-xiangyou' : 'icon-xiangxia'"
></span>失效商品
</div>
<div class="del" @click="delInvalidGoods">
<span class="iconfont icon-shanchu1"></span>清空
</div>
</div>
<div class="goodsList" :hidden="goodsHidden">
<div v-for="(item, cartListinvalidIndex) in cartList.invalid" :key="cartListinvalidIndex">
<div
@click="$yrouter.push({ path: '/pages/shop/GoodsCon/index',query:{id:item.productId }})"
class="item acea-row row-between-wrapper"
v-if="item.productInfo"
>
<div class="invalid acea-row row-center-wrapper">失效</div>
<div class="pictrue">
<img :src="item.productInfo.attrInfo.image" v-if="item.productInfo.attrInfo" />
<img :src="item.productInfo.image" v-else />
</div>
<div class="text acea-row row-column-between">
<div class="line1">{{ item.productInfo.storeName }}</div>
<div
class="infor line1"
v-if="item.productInfo.attrInfo"
>属性{{ item.productInfo.attrInfo.suk }}</div>
<div class="acea-row row-between-wrapper">
<div class="end">该商品已下架</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!--购物车暂无商品-->
<div class="noCart" v-if="cartList.valid.length === 0 && cartList.invalid.length === 0">
<div class="pictrue">
<img :src="$VUE_APP_RESOURCES_URL+'/images/noCart.png'" />
</div>
<Recommend></Recommend>
</div>
<div style="height:2.1rem"></div>
<div
:class="['footer acea-row row-between-wrapper',isIpx?'iphonex-footer':'']"
v-if="cartList.valid.length > 0"
>
<div>
<div class="select-btn">
<div class="checkbox-wrapper">
<!-- <label class="well-check">
<input
type="checkbox"
name
value
:checked="isAllSelect && cartCount > 0"
@click="allChecked"
/>
<i class="icon"></i>
<span class="checkAll">全选 ({{ cartCount }})</span>
</label>-->
<checkbox-group @change="allChecked">
<label class="well-check">
<checkbox value :checked="isAllSelect && cartCount > 0"></checkbox>
<span class="checkAll">全选 ({{ cartCount }})</span>
</label>
</checkbox-group>
</div>
</div>
</div>
<div class="money acea-row row-middle" v-if="footerswitch === false">
<span class="font-color-red">{{ countmoney }}</span>
<div class="placeOrder bg-color-red" @click="placeOrder">立即下单</div>
</div>
<div class="button acea-row row-middle" v-else>
<div class="bnt cart-color" @click="collectAll">收藏</div>
<div class="bnt" @click="delgoods">删除</div>
</div>
</div>
</div>
</template>
<script>
import Recommend from "@/components/Recommend";
import {
getCartList,
postCartDel,
changeCartNum,
getCartCount
} from "@/api/store";
import { postCollectAll } from "@/api/user";
import { mul, add } from "@/utils/bc";
import cookie from "@/utils/store/cookie";
import debounce from "lodash.debounce";
const CHECKED_IDS = "cart_checked";
export default {
name: "ShoppingCart",
components: {
Recommend
},
props: {},
data: function() {
return {
isIpx: false,
cartList: { invalid: [], valid: [] },
validList: [],
isAllSelect: false,
cartCount: 0,
countmoney: 0,
goodsHidden: true,
footerswitch: false,
count: 0,
checkedIds: [],
loaded: false
};
},
watch: {
$yroute(n) {
if (n.name === "ShoppingCart") {
this.carnum();
this.countMoney();
this.getCartList();
this.gainCount();
this.goodsHidden = true;
this.footerswitch = false;
}
},
cartList(list) {
this.validList = list.valid;
}
},
mounted: function() {
let that = this;
that.carnum();
that.countMoney();
that.getCartList();
that.gainCount();
wx.getSystemInfo({
success: function(res) {
console.log(res);
var name = "iPhone X";
if (res.model.indexOf(name) > -1) {
that.isIpx = true;
}
}
});
},
methods: {
getCartList: function() {
let that = this;
getCartList().then(res => {
that.cartList = res.data;
let checkedIds = cookie.get(CHECKED_IDS) || [];
if (!Array.isArray(checkedIds)) checkedIds = [];
this.cartList.valid.forEach(cart => {
if (checkedIds.indexOf(cart.id) !== -1) cart.checked = true;
});
if (checkedIds.length) {
that.checkedIds = checkedIds;
that.isAllSelect = checkedIds.length === this.cartList.valid.length;
that.carnum();
that.countMoney();
}
this.loaded = true;
});
},
//删除商品;
delgoods: function() {
let that = this,
id = [],
valid = [],
list = that.cartList.valid;
list.forEach(function(val) {
if (val.checked === true) {
id.push(val.id);
}
});
if (id.length === 0) {
that.$dialog.toast({ mes: "请选择产品" });
return;
}
postCartDel(id).then(function() {
list.forEach(function(val, i) {
if (val.checked === false || val.checked === undefined)
valid.push(list[i]);
});
that.$set(that.cartList, "valid", valid);
that.carnum();
that.countMoney();
that.gainCount();
that.getCartList();
});
},
// //获取数量
gainCount: function() {
let that = this;
getCartCount().then(res => {
that.count = res.data.count;
});
},
//清除失效产品;
delInvalidGoods: function() {
let that = this,
id = [],
list = that.cartList.invalid;
list.forEach(function(val) {
id.push(val.id);
});
postCartDel(id).then(function() {
list.splice(0, list.length);
that.gainCount();
that.getCartList();
});
},
//批量收藏;
collectAll: function() {
let that = this,
data = { id: [], category: "" },
list = that.cartList.valid;
list.forEach(function(val) {
if (val.checked === true) {
data.id.push(val.product_id);
data.category = val.type;
}
});
if (data.id.length === 0) {
that.$dialog.toast({ mes: "请选择产品" });
return;
}
postCollectAll(data).then(function() {
that.$dialog.toast({ mes: "收藏成功!" });
});
},
//立即下单;
placeOrder: function() {
let that = this,
list = that.cartList.valid,
id = [];
list.forEach(function(val) {
if (val.checked === true) {
id.push(val.id);
}
});
if (id.length === 0) {
that.$dialog.toast({ mes: "请选择产品" });
return;
}
console.log(id);
this.$yrouter.push({
path: "/pages/order/OrderSubmission/main",
query: { id: id.join(",") }
});
},
manage: function() {
let that = this;
that.footerswitch = !that.footerswitch;
},
goodsOpen: function() {
let that = this;
that.goodsHidden = !that.goodsHidden;
},
//加
plus: function(index) {
let that = this;
let list = that.cartList.valid[index];
list.cartNum++;
if (list.attrInfo) {
if (list.cartNum >= list.attrInfo.stock) {
that.$set(list, "cart_num", list.attrInfo.stock);
}
} else {
if (list.cartNum >= list.stock) {
that.$set(list, "cart_num", list.stock);
}
}
that.carnum();
that.countMoney();
that.syncCartNum(list);
},
//减
reduce: function(index) {
let that = this;
let list = that.cartList.valid[index];
if (list.cartNum <= 1) {
that.$dialog.toast({ mes: "已经是底线啦!" });
return;
}
list.cartNum--;
if (list.cartNum < 1) {
that.$set(list, "cart_num", 1);
}
that.carnum();
that.countMoney();
that.syncCartNum(list);
},
syncCartNum(cart) {
if (!cart.sync) {
changeCartNum(cart.id, Math.max(cart.cartNum, 1) || 1)
.then(res => {
this.getCartList();
})
.catch(error => {
wx.showToast({
title: error.response.data.msg,
icon: "none",
duration: 2000
});
});
}
},
//单选
switchSelect: function(index) {
let that = this,
cart = that.cartList.valid[index],
i = this.checkedIds.indexOf(cart.id);
cart.checked = !cart.checked;
if (i !== -1) this.checkedIds.splice(i, 1);
if (cart.checked) {
this.checkedIds.push(cart.id);
}
let len = that.cartList.valid.length;
let selectnum = [];
for (let i = 0; i < len; i++) {
if (that.cartList.valid[i].checked === true) {
selectnum.push(true);
}
}
that.isAllSelect = selectnum.length === len;
that.$set(that, "cartList", that.cartList);
that.$set(that, "isAllSelect", that.isAllSelect);
cookie.set(CHECKED_IDS, that.checkedIds);
that.carnum();
that.countMoney();
},
//全选
allChecked: function(e) {
let that = this;
let selectAllStatus = e.mp.detail.value[0] ? true : false;
// let selectAllStatus = that.isAllSelect;
let checkedIds = [];
// for (let i = 0; i < array.length; i++) {
// array[i].checked = selectAllStatus;
// checked.push()
// }
that.cartList.valid.forEach(cart => {
cart.checked = selectAllStatus;
if (selectAllStatus) {
checkedIds.push(cart.id);
}
});
let cartList = {
...that.cartList
};
that.cartList = [];
that.cartList = cartList;
this.$set(this, "cartList", this.cartList);
this.$set(this, "isAllSelect", selectAllStatus);
this.checkedIds = checkedIds;
cookie.set(CHECKED_IDS, checkedIds);
that.carnum();
that.countMoney();
this.$forceUpdate();
},
//数量
carnum: function() {
let that = this;
var carnum = 0;
var array = that.cartList.valid;
for (let i = 0; i < array.length; i++) {
if (array[i].checked === true) {
carnum += parseInt(array[i].cartNum);
}
}
that.$set(that, "cartCount", carnum);
},
//总共价钱;
countMoney: function() {
let that = this;
let carmoney = 0;
let array = that.cartList.valid;
for (let i = 0; i < array.length; i++) {
if (array[i].checked === true) {
carmoney = add(carmoney, mul(array[i].cartNum, array[i].truePrice));
}
}
that.countmoney = carmoney;
}
}
};
</script>

View File

@ -0,0 +1,5 @@
import Vue from 'vue'
import App from './index'
const app = new Vue(App)
app.$mount()

View File

@ -0,0 +1,127 @@
<template>
<div class="newsDetail">
<div class="title">{{ articleInfo.title }}</div>
<div class="list acea-row row-middle">
<div class="label cart-color line1">新闻专区</div>
<div class="item">
<span class="iconfont icon-shenhezhong"></span>{{ articleInfo.addTime }}
</div>
<div class="item">
<span class="iconfont icon-liulan"></span>{{ articleInfo.visit }}
</div>
</div>
<div class="conter" v-html="articleInfo.content"></div>
</div>
</template>
<style scoped>
.newsDetail .picTxt {
width: 6.9rem;
height: 2rem;
border-radius: 0.2rem;
border: 1px solid #e1e1e1;
position: relative;
margin: 0.3rem auto 0 auto;
}
.newsDetail .picTxt .pictrue {
width: 2rem;
height: 2rem;
}
.newsDetail .picTxt .pictrue img {
width: 100%;
height: 100%;
border-radius: 0.2rem 0 0 0.2rem;
display: block;
}
.newsDetail .picTxt .text {
width: 4.6rem;
}
.newsDetail .picTxt .text .name {
font-size: 0.3rem;
color: #282828;
}
.newsDetail .picTxt .text .money {
font-size: 0.24rem;
margin-top: 0.4rem;
font-weight: bold;
}
.newsDetail .picTxt .text .money .num {
font-size: 0.36rem;
}
.newsDetail .picTxt .text .y_money {
font-size: 0.26rem;
color: #999;
text-decoration: line-through;
}
.newsDetail .picTxt .label {
position: absolute;
background-color: #303131;
width: 1.6rem;
height: 0.5rem;
right: -0.07rem;
border-radius: 0.25rem 0 0.06rem 0.25rem;
text-align: center;
line-height: 0.5rem;
bottom: 0.24rem;
}
.newsDetail .picTxt .label .span {
background-image: linear-gradient(to right, #fff71e 0%, #f9b513 100%);
background-image: -webkit-linear-gradient(to right, #fff71e 0%, #f9b513 100%);
background-image: -moz-linear-gradient(to right, #fff71e 0%, #f9b513 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
.newsDetail .picTxt .label:after {
content: " ";
position: absolute;
width: 0;
height: 0;
border-bottom: 0.08rem solid #303131;
border-right: 0.08rem solid transparent;
top: -0.08rem;
right: 0;
}
.newsDetail .bnt {
color: #fff;
font-size: 0.3rem;
width: 6.9rem;
height: 0.9rem;
border-radius: 0.45rem;
margin: 0.48rem auto 0 auto;
text-align: center;
line-height: 0.9rem;
}
</style>
<script>
import { getArticleDetails } from "@/api/public";
export default {
name: "NewsDetail",
components: {},
props: {},
data: function() {
return {
articleInfo: {}
};
},
watch: {
$yroute(to) {
if (to.name === "NewsDetail") this.articleDetails();
}
},
mounted: function() {
this.articleDetails();
},
methods: {
updateTitle() {
// document.title = this.articleInfo.title || this.$yroute.meta.title;
},
articleDetails: function() {
let that = this,
id = this.$yroute.query.id;
getArticleDetails(id).then(res => {
that.articleInfo = res.data;
that.updateTitle();
});
}
}
};
</script>

View File

@ -0,0 +1,5 @@
import Vue from 'vue'
import App from './index'
const app = new Vue(App)
app.$mount()

View File

@ -0,0 +1,106 @@
<template>
<div class="newsList" ref="container">
<div class="list" v-for="(item, articleListIndex) in articleList" :key="articleListIndex">
<div
@click="$yrouter.push({ path: '/pages/shop/news/NewsDetail/index',query:{id:item.id }})"
class="item acea-row row-between-wrapper"
>
<div class="text acea-row row-column-between">
<div class="name line2">{{ item.title }}</div>
<div>{{ item.addTime }}</div>
</div>
<div class="pictrue">
<img :src="item.imageInput" />
</div>
</div>
</div>
<!--暂无新闻-->
<div class="noCommodity" v-if="articleList.length === 0 && page > 1">
<div class="noPictrue">
<img :src="$VUE_APP_RESOURCES_URL+'/images/noNews.png'" class="image" />
</div>
</div>
<!--</Tab>-->
<!--</Tabs>-->
</div>
</template>
<script>
import { getArticleList } from "@/api/public";
export default {
name: "NewsList",
components: {},
props: {},
data: function() {
return {
page: 1,
limit: 20,
loadTitle: "",
loading: false,
loadend: false,
imgUrls: [],
navLsit: [],
articleList: [],
active: 0,
cid: 0,
swiperNew: {
pagination: {
el: ".swiper-pagination",
clickable: true
},
autoplay: {
disableOnInteraction: false,
delay: 2000
},
loop: true,
speed: 1000,
observer: true,
observeParents: true
}
};
},
mounted: function() {
// this.articleBanner();
//this.articleCategory();
this.getArticleLists();
// this.$scroll(this.$refs.container, () => {
// !this.loading && this.getArticleLists();
// });
},
onReachBottom() {
!this.loading && this.getArticleLists();
},
methods: {
getArticleLists: function() {
let that = this;
if (that.loading) return; //阻止下次请求false可以进行请求
if (that.loadend) return; //阻止结束当前请求false可以进行请求
that.loading = true;
let q = {
page: that.page,
limit: that.limit
};
getArticleList(q).then(res => {
that.loading = false;
//apply();js将一个数组插入另一个数组;
that.articleList.push.apply(that.articleList, res.data);
that.loadend = res.data.length < that.limit; //判断所有数据是否加载完成;
that.page = that.page + 1;
});
},
onClick: function(name) {
if (name === 0) this.articleHotList();
else {
this.cid = this.navLsit[name].id;
this.articleList = [];
this.page = 1;
this.loadend = false;
this.loading = false;
this.getArticleLists(name);
}
}
}
};
</script>

View File

@ -0,0 +1,5 @@
import Vue from 'vue'
import App from './index'
const app = new Vue(App)
app.$mount()