Gao xiaosong 4 years ago
parent
commit
82d1739127
  1. 8
      api/store.js
  2. 5
      config/index.js
  3. 302
      pages/shop/GoodsCon/index.vue
  4. 125
      pages/shop/GoodsList/index.vue
  5. 14
      pages/user/User/index.vue

8
api/store.js

@ -35,6 +35,14 @@ export function getProducts(q) {
login: false login: false
}); });
} }
/*
* 积分商品列表
* */
export function getProductsIntegral(q) {
return request.get("/products/integral", q, {
login: false
});
}
/* /*
* 购物车数量 * 购物车数量

5
config/index.js

@ -1,7 +1,8 @@
// export const VUE_APP_API_URL = 'http://natapp.xinxintuan.co/api'; // export const VUE_APP_API_URL = 'http://natapp.xinxintuan.co/api';
export const VUE_APP_API_URL = 'https://wxapi.yixiang.co/api'; // export const VUE_APP_API_URL = 'https://wxapi.yixiang.co/api';
// export const VUE_APP_API_URL = 'http://192.168.31.223:8008/api'; // export const VUE_APP_API_URL = 'http://192.168.31.223:8008/api';
// export const VUE_APP_API_URL = 'https://h5api.xinxintuan.co/api'; export const VUE_APP_API_URL = 'https://tapi.xinxintuan.co/api';
// export const VUE_APP_API_URL = 'https://h5api.xinxintuan.co/api';
// export const VUE_APP_API_URL = 'https://h5api.xinxintuan.co/api'; // export const VUE_APP_API_URL = 'https://h5api.xinxintuan.co/api';
export const VUE_APP_RESOURCES_URL = 'https://wx.yixiang.co/static'; export const VUE_APP_RESOURCES_URL = 'https://wx.yixiang.co/static';

302
pages/shop/GoodsCon/index.vue

@ -2,9 +2,7 @@
<view :class="productConClass"> <view :class="productConClass">
<view v-if="storeInfo.id"> <view v-if="storeInfo.id">
<!-- 轮播图 --> <!-- 轮播图 -->
<product-con-swiper <product-con-swiper :img-urls="storeInfo.sliderImageArr"></product-con-swiper>
:img-urls="storeInfo.sliderImageArr"
></product-con-swiper>
<!-- 商品信息描述 --> <!-- 商品信息描述 -->
<view class="wrapper"> <view class="wrapper">
@ -14,21 +12,11 @@
<text class="num">{{ <text class="num">{{
attr.productSelect.price || storeInfo.price attr.productSelect.price || storeInfo.price
}}</text> }}</text>
<text <text class="vip-money"
class="vip-money" v-if="storeInfo.vipPrice && storeInfo.vipPrice > 0">{{ attr.productSelect.vipPrice || storeInfo.vipPrice }}</text>
v-if="storeInfo.vipPrice && storeInfo.vipPrice > 0" <image src="@/static/images/vip.png" class="image" v-if="storeInfo.vipPrice && storeInfo.vipPrice > 0" />
>{{ attr.productSelect.vipPrice || storeInfo.vipPrice }}</text
>
<image
src="@/static/images/vip.png"
class="image"
v-if="storeInfo.vipPrice && storeInfo.vipPrice > 0"
/>
</view> </view>
<view <view class="iconfont icon-fenxiang" @click="listenerActionSheet"></view>
class="iconfont icon-fenxiang"
@click="listenerActionSheet"
></view>
</view> </view>
<view class="introduce">{{ storeInfo.storeName }}</view> <view class="introduce">{{ storeInfo.storeName }}</view>
<view class="label acea-row row-between-wrapper"> <view class="label acea-row row-between-wrapper">
@ -36,19 +24,11 @@
<text>库存:{{ storeInfo.stock }}{{ storeInfo.unitName }}</text> <text>库存:{{ storeInfo.stock }}{{ storeInfo.unitName }}</text>
<text>销量:{{ storeInfo.sales }}{{ storeInfo.unitName }}</text> <text>销量:{{ storeInfo.sales }}{{ storeInfo.unitName }}</text>
</view> </view>
<view <view class="coupon acea-row row-between-wrapper" @click="couponTap" v-if="couponList.length">
class="coupon acea-row row-between-wrapper"
@click="couponTap"
v-if="couponList.length"
>
<text class="hide line1"> <text class="hide line1">
<text>优惠券</text> <text>优惠券</text>
<text <text class="activity" v-for="(item, couponListEq) in couponList"
class="activity" :key="couponListEq">{{ item.useMinPrice }}{{ item.couponPrice }}</text>
v-for="(item, couponListEq) in couponList"
:key="couponListEq"
>{{ item.useMinPrice }}{{ item.couponPrice }}</text
>
</text> </text>
<view class="iconfont icon-jiantou"></view> <view class="iconfont icon-jiantou"></view>
</view> </view>
@ -63,10 +43,7 @@
</div> </div>
<!-- 规格 --> <!-- 规格 -->
<view <view class="attribute acea-row row-between-wrapper" @click="selecAttrTap">
class="attribute acea-row row-between-wrapper"
@click="selecAttrTap"
>
<view> <view>
<text>{{ attrTxt }}</text> <text>{{ attrTxt }}</text>
<text class="atterTxt">{{ attrValue }}</text> <text class="atterTxt">{{ attrValue }}</text>
@ -90,22 +67,14 @@
</view> </view>
<view class="text"> <view class="text">
<view class="name line1">{{ systemStore.name }}</view> <view class="name line1">{{ systemStore.name }}</view>
<view <view class="address acea-row row-middle" @click="showChang(systemStore)">
class="address acea-row row-middle"
@click="showChang(systemStore)"
>
<text class="addressTxt">{{ systemStore.address }}</text> <text class="addressTxt">{{ systemStore.address }}</text>
<text class="iconfont icon-youjian"></text> <text class="iconfont icon-youjian"></text>
</view> </view>
</view> </view>
<view class="addressBox"> <view class="addressBox">
<a <a class="iconfont icon-dadianhua01 font-color-red phone" @click="telPhone(systemStore.phone)"></a>
class="iconfont icon-dadianhua01 font-color-red phone" <view class="addressTxt corlor-yshop">距离{{ systemStore.distance }}千米</view>
@click="telPhone(systemStore.phone)"
></a>
<view class="addressTxt corlor-yshop"
>距离{{ systemStore.distance }}千米</view
>
</view> </view>
</view> </view>
</view> </view>
@ -181,11 +150,7 @@
<view class="iconfont icon-shoucang"></view> <view class="iconfont icon-shoucang"></view>
<text>收藏</text> <text>收藏</text>
</view> </view>
<view <view @click="goShoppingCart()" v-if="animated" class="item animated bounceIn">
@click="goShoppingCart()"
v-if="animated"
class="item animated bounceIn"
>
<view class="iconfont icon-gouwuche1"> <view class="iconfont icon-gouwuche1">
<text class="num bg-color-red" v-if="CartCount > 0">{{ <text class="num bg-color-red" v-if="CartCount > 0">{{
CartCount CartCount
@ -214,23 +179,12 @@
<!-- 优惠券 --> <!-- 优惠券 -->
<CouponPop v-on:changeFun="changeFun" :coupon="coupon"></CouponPop> <CouponPop v-on:changeFun="changeFun" :coupon="coupon"></CouponPop>
<!-- 商品规格弹窗 --> <!-- 商品规格弹窗 -->
<ProductWindow <ProductWindow v-on:changeFun="changeFun" :attr="attr" :cartNum="cart_num"></ProductWindow>
v-on:changeFun="changeFun"
:attr="attr"
:cartNum="cart_num"
></ProductWindow>
<!-- 分享海报 --> <!-- 分享海报 -->
<StorePoster <StorePoster v-on:setPosterImageStatus="setPosterImageStatus" :posterImageStatus="posterImageStatus"
v-on:setPosterImageStatus="setPosterImageStatus" :posterData="posterData" :goodId="id"></StorePoster>
:posterImageStatus="posterImageStatus"
:posterData="posterData"
:goodId="id"
></StorePoster>
<!-- 分享弹窗 --> <!-- 分享弹窗 -->
<ShareInfo <ShareInfo v-on:setShareInfoStatus="setShareInfoStatus" :shareInfoStatus="shareInfoStatus"></ShareInfo>
v-on:setShareInfoStatus="setShareInfoStatus"
:shareInfoStatus="shareInfoStatus"
></ShareInfo>
<view class="generate-posters acea-row row-middle on" v-if="posters"> <view class="generate-posters acea-row row-middle on" v-if="posters">
<view class="item" @click="setPosterImageStatus"> <view class="item" @click="setPosterImageStatus">
@ -244,12 +198,7 @@
<view>生成海报</view> <view>生成海报</view>
</view> </view>
</view> </view>
<view <view class="mask" @touchmove.prevent @click="listenerActionClose" v-show="posters"></view>
class="mask"
@touchmove.prevent
@click="listenerActionClose"
v-show="posters"
></view>
<view class="posterCanvasWarp"> <view class="posterCanvasWarp">
<canvas class="posterCanvas" canvas-id="myCanvas"></canvas> <canvas class="posterCanvas" canvas-id="myCanvas"></canvas>
</view> </view>
@ -258,39 +207,45 @@
</template> </template>
<script> <script>
// import { swiper, swiperSlide } from "vue-awesome-swiper"; // import { swiper, swiperSlide } from "vue-awesome-swiper";
import ProductConSwiper from "@/components/ProductConSwiper"; import ProductConSwiper from "@/components/ProductConSwiper";
import UserEvaluation from "@/components/UserEvaluation"; import UserEvaluation from "@/components/UserEvaluation";
import CouponPop from "@/components/CouponPop"; import CouponPop from "@/components/CouponPop";
import ProductWindow from "@/components/ProductWindow"; import ProductWindow from "@/components/ProductWindow";
import StorePoster from "@/components/StorePoster"; import StorePoster from "@/components/StorePoster";
import ShareInfo from "@/components/ShareInfo"; import ShareInfo from "@/components/ShareInfo";
import { import {
getProductDetail, getProductDetail,
postCartAdd, postCartAdd,
getCartCount, getCartCount,
getProductCode, getProductCode,
} from "@/api/store"; } from "@/api/store";
import { import {
getCoupon, getCoupon,
getCollectAdd, getCollectAdd,
getCollectDel, getCollectDel,
getUserInfo, getUserInfo,
} from "@/api/user"; } from "@/api/user";
import cookie from "@/utils/store/cookie"; import cookie from "@/utils/store/cookie";
import { import {
isWeixin, isWeixin,
PosterCanvas, PosterCanvas,
handleQrCode, handleQrCode,
handleUrlParam, handleUrlParam,
getCurrentPageUrlWithArgs, getCurrentPageUrlWithArgs,
} from "@/utils"; } from "@/utils";
import { wechatEvevt } from "@/libs/wechat"; import {
import { imageBase64 } from "@/api/public"; wechatEvevt
import { mapGetters } from "vuex"; } from "@/libs/wechat";
import {
imageBase64
} from "@/api/public";
import {
mapGetters
} from "vuex";
export default { export default {
name: "GoodsCon", name: "GoodsCon",
components: { components: {
// swiper, // swiper,
@ -356,6 +311,7 @@ export default {
qqmapsdk: null, qqmapsdk: null,
productConClass: "product-con", productConClass: "product-con",
tempName: "全国包邮", tempName: "全国包邮",
isIntegral: "false"
}; };
}, },
computed: mapGetters(["isLogin", "location"]), computed: mapGetters(["isLogin", "location"]),
@ -393,8 +349,7 @@ export default {
return { return {
title: this.storeInfo.storeName, title: this.storeInfo.storeName,
imageUrl: this.storeInfo.image, imageUrl: this.storeInfo.image,
path: path: "pages/shop/GoodsCon/index?id=" +
"pages/shop/GoodsCon/index?id=" +
this.storeInfo.id + this.storeInfo.id +
"&spread=" + "&spread=" +
uni.getStorageSync("uid") + uni.getStorageSync("uid") +
@ -523,8 +478,7 @@ export default {
}) })
.catch((err) => { .catch((err) => {
uni.showToast({ uni.showToast({
title: title: err.msg || err.response.data.msg || err.response.data.message,
err.msg || err.response.data.msg || err.response.data.message,
icon: "none", icon: "none",
duration: 2000, duration: 2000,
}); });
@ -743,10 +697,9 @@ export default {
productId: that.id, productId: that.id,
cartNum: that.attr.productSelect.cart_num, cartNum: that.attr.productSelect.cart_num,
new: news, new: news,
uniqueId: uniqueId: that.attr.productSelect !== undefined ?
that.attr.productSelect !== undefined that.attr.productSelect.unique :
? that.attr.productSelect.unique "",
: "",
}; };
postCartAdd(q) postCartAdd(q)
.then(function (res) { .then(function (res) {
@ -755,8 +708,7 @@ export default {
if (news) { if (news) {
if (!res.data) { if (!res.data) {
uni.showToast({ uni.showToast({
title: title: res.msg || res.data.msg || res.data.message,
res.msg || res.data.msg || res.data.message,
icon: "none", icon: "none",
duration: 2000, duration: 2000,
}); });
@ -828,9 +780,9 @@ export default {
if (this.isLogin) { if (this.isLogin) {
getUserInfo().then((res) => { getUserInfo().then((res) => {
href = href =
href.indexOf("?") === -1 href.indexOf("?") === -1 ?
? href + "?spread=" + res.data.uid href + "?spread=" + res.data.uid :
: href + "&spread=" + res.data.uid; href + "&spread=" + res.data.uid;
var configAppMessage = { var configAppMessage = {
desc: data.storeInfo, desc: data.storeInfo,
title: data.storeName, title: data.storeName,
@ -871,116 +823,116 @@ export default {
} }
}, },
}, },
}; };
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
.geoPage { .geoPage {
position: fixed; position: fixed;
width: 100%; width: 100%;
height: 100%; height: 100%;
top: 0; top: 0;
z-index: 10000; z-index: 10000;
} }
.product-con .store-info { .product-con .store-info {
margin-top: 0.2 * 100rpx; margin-top: 0.2 * 100rpx;
background-color: #fff; background-color: #fff;
} }
.product-con .store-info .title { .product-con .store-info .title {
padding: 0 0.3 * 100rpx; padding: 0 0.3 * 100rpx;
font-size: 0.28 * 100rpx; font-size: 0.28 * 100rpx;
color: #282828; color: #282828;
height: 0.8 * 100rpx; height: 0.8 * 100rpx;
line-height: 0.8 * 100rpx; line-height: 0.8 * 100rpx;
border-bottom: 0.01 * 100rpx solid #f5f5f5; border-bottom: 0.01 * 100rpx solid #f5f5f5;
} }
.product-con .store-info .info { .product-con .store-info .info {
padding: 0 0.3 * 100rpx; padding: 0 0.3 * 100rpx;
height: 1.26 * 100rpx; height: 1.26 * 100rpx;
} }
.product-con .store-info .info .picTxt { .product-con .store-info .info .picTxt {
width: 100%; width: 100%;
display: flex; display: flex;
align-items: center; align-items: center;
} }
.product-con .store-info .info .picTxt .pictrue { .product-con .store-info .info .picTxt .pictrue {
width: 0.76 * 100rpx; width: 0.76 * 100rpx;
height: 0.76 * 100rpx; height: 0.76 * 100rpx;
margin-right: 0.2 * 100rpx; margin-right: 0.2 * 100rpx;
} }
.product-con .store-info .info .picTxt .pictrue image { .product-con .store-info .info .picTxt .pictrue image {
width: 100%; width: 100%;
height: 100%; height: 100%;
border-radius: 0.06 * 100rpx; border-radius: 0.06 * 100rpx;
} }
.product-con .store-info .info .picTxt .text { .product-con .store-info .info .picTxt .text {
flex: 1; flex: 1;
} }
.product-con .store-info .info .picTxt .text .name { .product-con .store-info .info .picTxt .text .name {
font-size: 0.3 * 100rpx; font-size: 0.3 * 100rpx;
color: #282828; color: #282828;
} }
.product-con .store-info .info .picTxt .text .address { .product-con .store-info .info .picTxt .text .address {
font-size: 0.24 * 100rpx; font-size: 0.24 * 100rpx;
color: #666; color: #666;
margin-top: 0.03 * 100rpx; margin-top: 0.03 * 100rpx;
} }
.product-con .store-info .info .picTxt .text .address .iconfont { .product-con .store-info .info .picTxt .text .address .iconfont {
color: #707070; color: #707070;
font-size: 0.18 * 100rpx; font-size: 0.18 * 100rpx;
margin-left: 0.1 * 100rpx; margin-left: 0.1 * 100rpx;
} }
.product-con .store-info .info .picTxt .addressBox { .product-con .store-info .info .picTxt .addressBox {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: flex-end; align-items: flex-end;
} }
.product-con .store-info .info .picTxt .addressBox .iconfont { .product-con .store-info .info .picTxt .addressBox .iconfont {
font-size: 0.4 * 100rpx; font-size: 0.4 * 100rpx;
} }
.product-con .store-info .info .picTxt .addressBox .addressTxt { .product-con .store-info .info .picTxt .addressBox .addressTxt {
font-size: 0.24 * 100rpx; font-size: 0.24 * 100rpx;
color: #eb3729; color: #eb3729;
} }
.product-con .store-info .praise { .product-con .store-info .praise {
font-size: 0.28 * 100rpx; font-size: 0.28 * 100rpx;
color: #808080; color: #808080;
} }
.product-con .store-info .praise .iconfont { .product-con .store-info .praise .iconfont {
font-size: 0.28 * 100rpx; font-size: 0.28 * 100rpx;
} }
.product-con .superior { .product-con .superior {
background-color: #fff; background-color: #fff;
margin-top: 0.2 * 100rpx; margin-top: 0.2 * 100rpx;
} }
.product-con .superior .title { .product-con .superior .title {
height: 0.98 * 100rpx; height: 0.98 * 100rpx;
} }
.product-con .superior .title image { .product-con .superior .title image {
width: 0.3 * 100rpx; width: 0.3 * 100rpx;
height: 0.3 * 100rpx; height: 0.3 * 100rpx;
} }
.product-con .superior .title .titleTxt { .product-con .superior .title .titleTxt {
margin: 0 0.2 * 100rpx; margin: 0 0.2 * 100rpx;
font-size: 0.3 * 100rpx; font-size: 0.3 * 100rpx;
background-image: linear-gradient(to right, #f57a37 0%, #f21b07 100%); background-image: linear-gradient(to right, #f57a37 0%, #f21b07 100%);
@ -988,65 +940,65 @@ export default {
background-image: -moz-linear-gradient(to right, #f57a37 0%, #f21b07 100%); background-image: -moz-linear-gradient(to right, #f57a37 0%, #f21b07 100%);
-webkit-background-clip: text; -webkit-background-clip: text;
-webkit-text-fill-color: transparent; -webkit-text-fill-color: transparent;
} }
.product-con .superior .slider-banner { .product-con .superior .slider-banner {
width: 6.9 * 100rpx; width: 6.9 * 100rpx;
margin: 0 auto; margin: 0 auto;
padding-bottom: 0.2 * 100rpx; padding-bottom: 0.2 * 100rpx;
} }
.product-con .superior .slider-banner .list { .product-con .superior .slider-banner .list {
width: 100%; width: 100%;
padding-bottom: 0.2 * 100rpx; padding-bottom: 0.2 * 100rpx;
} }
.product-con .superior .slider-banner .list .item { .product-con .superior .slider-banner .list .item {
width: 2.15 * 100rpx; width: 2.15 * 100rpx;
margin: 0 0.22 * 100rpx 0.3 * 100rpx 0; margin: 0 0.22 * 100rpx 0.3 * 100rpx 0;
font-size: 0.26 * 100rpx; font-size: 0.26 * 100rpx;
} }
.product-con .superior .slider-banner .list .item:nth-of-type(3n) { .product-con .superior .slider-banner .list .item:nth-of-type(3n) {
margin-right: 0; margin-right: 0;
} }
.product-con .superior .slider-banner .list .item .pictrue { .product-con .superior .slider-banner .list .item .pictrue {
width: 100%; width: 100%;
height: 2.15 * 100rpx; height: 2.15 * 100rpx;
} }
.product-con .superior .slider-banner .list .item .pictrue image { .product-con .superior .slider-banner .list .item .pictrue image {
width: 100%; width: 100%;
height: 100%; height: 100%;
border-radius: 0.06 * 100rpx; border-radius: 0.06 * 100rpx;
} }
.product-con .superior .slider-banner .list .item .name { .product-con .superior .slider-banner .list .item .name {
color: #282828; color: #282828;
margin-top: 0.12 * 100rpx; margin-top: 0.12 * 100rpx;
} }
.product-con .superior .slider-banner .swiper-pagination-bullet { .product-con .superior .slider-banner .swiper-pagination-bullet {
background-color: #999; background-color: #999;
} }
.product-con .superior .slider-banner .swiper-pagination-bullet-active { .product-con .superior .slider-banner .swiper-pagination-bullet-active {
background-color: #e93323; background-color: #e93323;
} }
.mask { .mask {
-webkit-filter: blur(2px); -webkit-filter: blur(2px);
-moz-filter: blur(2px); -moz-filter: blur(2px);
-ms-filter: blur(2px); -ms-filter: blur(2px);
filter: blur(2px); filter: blur(2px);
} }
.product-con .product-intro .conter view { .product-con .product-intro .conter view {
width: 100% !important; width: 100% !important;
} }
.generate-posters { .generate-posters {
width: 100%; width: 100%;
height: 1.7 * 100rpx; height: 1.7 * 100rpx;
background-color: #fff; background-color: #fff;
@ -1063,35 +1015,35 @@ export default {
-webkit-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); -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); -o-transition: all 0.3s cubic-bezier(0.25, 0.5, 0.5, 0.9);
} }
.generate-posters.on { .generate-posters.on {
transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0);
-webkit-transform: translate3d(0, 0, 0); -webkit-transform: translate3d(0, 0, 0);
-ms-transform: translate3d(0, 0, 0); -ms-transform: translate3d(0, 0, 0);
-moz-transform: translate3d(0, 0, 0); -moz-transform: translate3d(0, 0, 0);
-o-transform: translate3d(0, 0, 0); -o-transform: translate3d(0, 0, 0);
} }
.generate-posters .item { .generate-posters .item {
flex: 50%; flex: 50%;
-webkit-flex: 50%; -webkit-flex: 50%;
-ms-flex: 50%; -ms-flex: 50%;
text-align: center; text-align: center;
} }
.generate-posters .item .iconfont { .generate-posters .item .iconfont {
font-size: 0.8 * 100rpx; font-size: 0.8 * 100rpx;
color: #5eae72; color: #5eae72;
} }
.generate-posters .item .iconfont.icon-haibao { .generate-posters .item .iconfont.icon-haibao {
color: #5391f1; color: #5391f1;
} }
.noscroll { .noscroll {
height: 100%; height: 100%;
overflow: hidden; overflow: hidden;
} }
</style> </style>

125
pages/shop/GoodsList/index.vue

@ -6,20 +6,11 @@
<input placeholder="搜索商品信息" v-model="where.keyword" /> <input placeholder="搜索商品信息" v-model="where.keyword" />
<text class="iconfont icon-sousuo" @click="submitForm"></text> <text class="iconfont icon-sousuo" @click="submitForm"></text>
</view> </view>
<view <view class="iconfont" :class="Switch === true ? 'icon-pailie' : 'icon-tupianpailie'" @click="switchTap"></view>
class="iconfont"
:class="Switch === true ? 'icon-pailie' : 'icon-tupianpailie'"
@click="switchTap"
></view>
</view> </view>
</form> </form>
<view class="nav acea-row row-middle"> <view class="nav acea-row row-middle">
<view <view class="item" :class="title ? 'font-color-red' : ''" @click="set_where(0)">{{ title ? title : "默认" }}</view>
class="item"
:class="title ? 'font-color-red' : ''"
@click="set_where(0)"
>{{ title ? title : "默认" }}</view
>
<view class="item" @click="set_where(1)"> <view class="item" @click="set_where(1)">
价格 价格
<image src="@/static/images/horn.png" v-if="price === 0" /> <image src="@/static/images/horn.png" v-if="price === 0" />
@ -33,71 +24,65 @@
<image src="@/static/images/down.png" v-if="stock === 2" /> <image src="@/static/images/down.png" v-if="stock === 2" />
</view> </view>
<!-- down --> <!-- down -->
<view <view class="item" :class="nows ? 'font-color-red' : ''" @click="set_where(3)">新品</view>
class="item"
:class="nows ? 'font-color-red' : ''"
@click="set_where(3)"
>新品</view
>
</view> </view>
<view <view class="list acea-row row-between-wrapper" :class="Switch === true ? '' : 'on'" ref="container"
class="list acea-row row-between-wrapper" v-if="isIntegral=='false'">
:class="Switch === true ? '' : 'on'" <view @click="goGoodsCon(item)" class="item" :class="Switch === true ? '' : 'on'"
ref="container" v-for="(item, productListIndex) in productList" :key="productListIndex" :title="item.storeName">
>
<view
@click="goGoodsCon(item)"
class="item"
:class="Switch === true ? '' : 'on'"
v-for="(item, productListIndex) in productList"
:key="productListIndex"
:title="item.storeName"
>
<view class="pictrue" :class="Switch === true ? '' : 'on'"> <view class="pictrue" :class="Switch === true ? '' : 'on'">
<image :src="item.image" :class="Switch === true ? '' : 'on'" /> <image :src="item.image" :class="Switch === true ? '' : 'on'" />
</view> </view>
<view class="text" :class="Switch === true ? '' : 'on'"> <view class="text" :class="Switch === true ? '' : 'on'">
<view class="name line1">{{ item.storeName }}</view> <view class="name line1">{{ item.storeName }}</view>
<view <view class="money font-color-red" :class="Switch === true ? '' : 'on'">
class="money font-color-red"
:class="Switch === true ? '' : 'on'"
>
<text class="num">{{ item.price }}</text> <text class="num">{{ item.price }}</text>
</view> </view>
<view <view class="vip acea-row row-between-wrapper" :class="Switch === true ? '' : 'on'">
class="vip acea-row row-between-wrapper"
:class="Switch === true ? '' : 'on'"
>
<view class="vip-money">{{ item.otPrice }}</view> <view class="vip-money">{{ item.otPrice }}</view>
<view>已售{{ item.sales }}</view> <view>已售{{ item.sales }}</view>
</view> </view>
</view> </view>
</view> </view>
</view> </view>
<view class="list acea-row row-between-wrapper" :class="Switch === true ? '' : 'on'" ref="container"
v-if="isIntegral=='true'">
<view @click="goGoodsCon(item)" class="item" :class="Switch === true ? '' : 'on'"
v-for="(item, productListIndex) in productList" :key="productListIndex" :title="item.storeName">
<view class="pictrue" :class="Switch === true ? '' : 'on'">
<image :src="item.image" :class="Switch === true ? '' : 'on'" />
</view>
<view class="text" :class="Switch === true ? '' : 'on'">
<view class="name line1">{{ item.storeName }}</view>
<view class="money font-color-red" :class="Switch === true ? '' : 'on'">
<text class="num">{{ item.price }}积分</text>
</view>
<view class="vip acea-row row-between-wrapper" :class="Switch === true ? '' : 'on'">
<!-- <view class="vip-money">{{ item.otPrice }}</view> -->
<view>已售{{ item.sales }}</view>
</view>
</view>
</view>
</view>
<Loading :loaded="loadend" :loading="loading"></Loading> <Loading :loaded="loadend" :loading="loading"></Loading>
<view <view class="noCommodity" style="background-color: #fff" v-if="productList.length === 0 && where.page > 1">
class="noCommodity"
style="background-color: #fff"
v-if="productList.length === 0 && where.page > 1"
>
<view class="noPictrue"> <view class="noPictrue">
<image src="@/static/images/noGood.png" class="image" /> <image src="@/static/images/noGood.png" class="image" />
</view> </view>
</view> </view>
<Recommend <Recommend v-if="productList.length === 0 && where.page > 1" :recommendLoading="recommendLoading"
v-if="productList.length === 0 && where.page > 1" @changeRecommendLoading="changeRecommendLoading"></Recommend>
:recommendLoading="recommendLoading"
@changeRecommendLoading="changeRecommendLoading"
></Recommend>
</view> </view>
</template> </template>
<script> <script>
import Recommend from "@/components/Recommend"; import Recommend from "@/components/Recommend";
import { getProducts } from "@/api/store"; import {
import Loading from "@/components/Loading"; getProducts,getProductsIntegral
} from "@/api/store";
import Loading from "@/components/Loading";
export default { export default {
name: "GoodsList", name: "GoodsList",
components: { components: {
Recommend, Recommend,
@ -132,6 +117,7 @@ export default {
nows: false, nows: false,
recommendLoading: false, recommendLoading: false,
target: false, target: false,
isIntegral: false
}; };
}, },
watch: { watch: {
@ -152,20 +138,23 @@ export default {
// this.$set(this, "productList", []); // this.$set(this, "productList", []);
// this.price = 0; // this.price = 0;
// this.stock = 0; // this.stock = 0;
// this.get_product_list(); // this.getProductList();
// } // }
}, },
}, },
mounted: function () { mounted: function () {
const { s = "", id = 0, title = "" } = this.$yroute.query; const {
s = "", id = 0, title = "", isIntegral = false
} = this.$yroute.query;
this.where.keyword = s; this.where.keyword = s;
this.where.isIntegral = isIntegral == 'true' ? 1 : 0;
this.isIntegral = isIntegral
this.updateTitle(); this.updateTitle();
this.get_product_list(); this.getProductList();
}, },
onReachBottom() { onReachBottom() {
this.recommendLoading = true; this.recommendLoading = true;
!this.loading && this.get_product_list(); !this.loading && this.getProductList();
}, },
onHide() { onHide() {
// this.hostProduct = []; // this.hostProduct = [];
@ -196,17 +185,20 @@ export default {
path: "/pages/shop/GoodsCon/index", path: "/pages/shop/GoodsCon/index",
query: { query: {
id: item.id, id: item.id,
isIntegral:this.isIntegral
}, },
}); });
}, },
updateTitle() { updateTitle() {
// document.title = this.title || this.$yroute.meta.title; // document.title = this.title || this.$yroute.meta.title;
}, },
get_product_list() { getProductList() {
var that = this; var that = this;
this.setWhere(); this.setWhere();
// if (to.name !== "GoodsList") return; // if (to.name !== "GoodsList") return;
const { s = "", id = 0, title = "" } = this.$yroute.query; const {
s = "", id = 0, title = ""
} = this.$yroute.query;
if (s !== this.where.keyword || id !== this.where.sid) { if (s !== this.where.keyword || id !== this.where.sid) {
this.loadend = false; this.loadend = false;
this.loading = false; this.loading = false;
@ -217,10 +209,11 @@ export default {
this.$set(this, "productList", []); this.$set(this, "productList", []);
this.price = 0; this.price = 0;
this.stock = 0; this.stock = 0;
// this.get_product_list(); // this.getProductList();
} }
let q = that.where; let q = that.where;
getProducts(q).then((res) => { let getData = this.isIntegral !== 'true' ? getProducts : getProductsIntegral
getData(q).then((res) => {
that.loading = false; that.loading = false;
if (that.target) { if (that.target) {
that.productList = res.data; that.productList = res.data;
@ -237,7 +230,7 @@ export default {
this.where.page = 1; this.where.page = 1;
this.loadend = false; this.loadend = false;
this.loading = false; this.loading = false;
this.get_product_list(); this.getProductList();
}, },
// //
set_where: function (index) { set_where: function (index) {
@ -270,7 +263,7 @@ export default {
that.where.page = 1; that.where.page = 1;
that.target = true; that.target = true;
that.loadend = false; that.loadend = false;
that.get_product_list(); that.getProductList();
}, },
//where //where
setWhere: function () { setWhere: function () {
@ -296,11 +289,11 @@ export default {
that.Switch = !that.Switch; that.Switch = !that.Switch;
}, },
}, },
}; };
</script> </script>
<style scoped lang="less"> <style scoped lang="less">
.noCommodity { .noCommodity {
border-top: 3px solid #f5f5f5; border-top: 3px solid #f5f5f5;
padding-bottom: 1px; padding-bottom: 1px;
} }
</style> </style>

14
pages/user/User/index.vue

@ -114,11 +114,11 @@
<text class="iconfont icon-jiantou"></text> <text class="iconfont icon-jiantou"></text>
</view> </view>
</template> </template>
<!-- <view class="item" @click="goPages2()"> <view class="item" @click="goPages2()">
<view class="pictrue"></view> <view class="pictrue"></view>
<view class="cell">hexiao</view> <view class="cell">积分商城</view>
<text class="iconfont icon-jiantou"></text> <text class="iconfont icon-jiantou"></text>
</view>--> </view>
</view> </view>
</view> </view>
</view> </view>
@ -353,7 +353,13 @@
}, },
goPages2: function () { goPages2: function () {
this.$yrouter.push({ this.$yrouter.push({
path: "/pages/orderAdmin/OrderCancellation/index" path: "/pages/shop/GoodsList/index",
query: {
// id: 0,
title: '积分商城',
isIntegral: true,
}
}); });
} }
}, },

Loading…
Cancel
Save