add
This commit is contained in:
@ -2135,7 +2135,7 @@ flex: 0 2.4*100rpx;
|
|||||||
.shoppingCart .footer .checkAll {
|
.shoppingCart .footer .checkAll {
|
||||||
font-size: 0.28*100rpx;
|
font-size: 0.28*100rpx;
|
||||||
color: #282828;
|
color: #282828;
|
||||||
margin-left: 0.6*100rpx;
|
margin-left: 0.1*100rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.shoppingCart .footer .money {
|
.shoppingCart .footer .money {
|
||||||
|
18
main.js
18
main.js
@ -76,28 +76,32 @@ Object.defineProperty(Vue.prototype, '$yroute', {
|
|||||||
Vue.prototype.$VUE_APP_RESOURCES_URL = VUE_APP_RESOURCES_URL
|
Vue.prototype.$VUE_APP_RESOURCES_URL = VUE_APP_RESOURCES_URL
|
||||||
Vue.prototype.$VUE_APP_API_URL = VUE_APP_API_URL
|
Vue.prototype.$VUE_APP_API_URL = VUE_APP_API_URL
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
// H5编译的代码
|
// H5编译的代码
|
||||||
Vue.prototype.$deviceType = 'h5'
|
Vue.prototype.$deviceType = 'h5'
|
||||||
|
store.commit('UPDATE_DEVICETYPE','h5')
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
// App平台编译的代码
|
// App平台编译的代码
|
||||||
|
console.log('App平台编译的代码')
|
||||||
Vue.prototype.$deviceType = 'app'
|
Vue.prototype.$deviceType = 'app'
|
||||||
|
store.commit('UPDATE_DEVICETYPE','app')
|
||||||
Vue.prototype.$platform = uni.getSystemInfoSync().platform
|
Vue.prototype.$platform = uni.getSystemInfoSync().platform
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
// 微信小程序编译的代码
|
// 微信小程序编译的代码
|
||||||
|
console.log('微信小程序编译的代码')
|
||||||
Vue.prototype.$deviceType = 'weixin'
|
Vue.prototype.$deviceType = 'weixin'
|
||||||
|
store.commit('UPDATE_DEVICETYPE','weixin')
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
console.log(wx,121212)
|
// !!! ps 不建议在 template 中使用 $deviceType 去判断当前环境,很有可能出现 $deviceType 为 undefined 导致判断出错的问题,可以在 script 模块中正常使用
|
||||||
console.log(Vue.prototype.$deviceType)
|
// 建议通过 store 去获取 $deviceType 可以保证 template 中取到的值有效
|
||||||
// if(wx){
|
// import { mapState, mapMutations, mapActions } from 'vuex';
|
||||||
// Vue.prototype.$deviceType = 'weixin'
|
// computed: {
|
||||||
// }
|
// ...mapState(['$deviceType'])
|
||||||
|
// },
|
||||||
|
|
||||||
app.$mount()
|
app.$mount()
|
||||||
|
@ -1,26 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="flash-sale" ref="container">
|
<view class="flash-sale" ref="container">
|
||||||
<view class="header" v-if="headerImg">
|
<view class="header" v-if="headerImg"><image :src="headerImg" /></view>
|
||||||
<image :src="headerImg" />
|
<view class="" v-for="(item, index) in timeList" :key="index">
|
||||||
</view>
|
<view class="timeItem">
|
||||||
<vant-tabs
|
|
||||||
:active="active"
|
|
||||||
@change="setTime"
|
|
||||||
:sticky="sticky"
|
|
||||||
animated
|
|
||||||
line-height="2"
|
|
||||||
:ellipsis="false"
|
|
||||||
>
|
|
||||||
<vant-tab
|
|
||||||
:ellipsis="false"
|
|
||||||
:title="[title[index]]"
|
|
||||||
v-for="(item, index) in timeList"
|
|
||||||
:key="index"
|
|
||||||
>
|
|
||||||
<view slot="title" class="timeItem">
|
|
||||||
<view class="time">{{ item.time }}</view>
|
<view class="time">{{ item.time }}</view>
|
||||||
<view class="state">{{ item.state }}</view>
|
<view class="state">{{ item.state }}</view>
|
||||||
</view>
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="" v-for="(item, index) in timeList" :key="index">
|
||||||
|
<view v-if="active == index">
|
||||||
<view class="countDown font-color-red acea-row row-center-wrapper">
|
<view class="countDown font-color-red acea-row row-center-wrapper">
|
||||||
<view v-if="item.status === 0" class="activity">活动已结束</view>
|
<view v-if="item.status === 0" class="activity">活动已结束</view>
|
||||||
<count-down
|
<count-down
|
||||||
@ -36,14 +24,8 @@
|
|||||||
<view v-if="item.status === 2" class="activity">活动即将开始</view>
|
<view v-if="item.status === 2" class="activity">活动即将开始</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="list">
|
<view class="list">
|
||||||
<view
|
<view class="item acea-row row-between-wrapper" v-for="(itemSeckill, indexSeckill) in seckillList" :key="indexSeckill">
|
||||||
class="item acea-row row-between-wrapper"
|
<view class="pictrue"><image :src="itemSeckill.image" /></view>
|
||||||
v-for="(itemSeckill, indexSeckill) in seckillList"
|
|
||||||
:key="indexSeckill"
|
|
||||||
>
|
|
||||||
<view class="pictrue">
|
|
||||||
<image :src="itemSeckill.image" />
|
|
||||||
</view>
|
|
||||||
<view class="text acea-row row-column-around">
|
<view class="text acea-row row-column-around">
|
||||||
<view class="line1" v-text="itemSeckill.title"></view>
|
<view class="line1" v-text="itemSeckill.title"></view>
|
||||||
<view class="money">
|
<view class="money">
|
||||||
@ -55,44 +37,40 @@
|
|||||||
<view class="piece font-color-red" v-text="'仅剩' + itemSeckill.stock + '件'"></view>
|
<view class="piece font-color-red" v-text="'仅剩' + itemSeckill.stock + '件'"></view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view
|
<view class="grab bg-color-red" v-if="item.status === 1 && itemSeckill.stock > 0" @click="goDetail(itemSeckill.id)">马上抢</view>
|
||||||
class="grab bg-color-red"
|
|
||||||
v-if="item.status === 1 && itemSeckill.stock > 0"
|
|
||||||
@click="goDetail(itemSeckill.id)"
|
|
||||||
>马上抢</view>
|
|
||||||
<view class="grab" v-if="item.status === 1 && itemSeckill.stock <= 0">已售磬</view>
|
<view class="grab" v-if="item.status === 1 && itemSeckill.stock <= 0">已售磬</view>
|
||||||
<view class="grab bg-color-red" v-if="item.status === 2">即将开始</view>
|
<view class="grab bg-color-red" v-if="item.status === 2">即将开始</view>
|
||||||
<view class="grab bg-color-red" v-if="item.status === 0">已结束</view>
|
<view class="grab bg-color-red" v-if="item.status === 0">已结束</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view
|
<view class="noCommodity" style="background-color: #fff;" v-if="seckillList.length === 0 && page > 1">
|
||||||
class="noCommodity"
|
<view class="noPictrue"><image :src="$VUE_APP_RESOURCES_URL + '/images/noGood.png'" class="image" /></view>
|
||||||
style="background-color: #fff;"
|
|
||||||
v-if="seckillList.length === 0 && page > 1"
|
|
||||||
>
|
|
||||||
<view class="noPictrue">
|
|
||||||
<image :src="$VUE_APP_RESOURCES_URL+'/images/noGood.png'" class="image" />
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
</view>
|
||||||
|
<!--
|
||||||
|
<vant-tabs :active="active" @change="setTime" :sticky="sticky" animated line-height="2" :ellipsis="false">
|
||||||
|
<vant-tab :ellipsis="false" :title="[title[index]]">
|
||||||
|
|
||||||
</vant-tab>
|
</vant-tab>
|
||||||
</vant-tabs>
|
</vant-tabs> -->
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { getSeckillConfig, getSeckillList } from "@/api/activity";
|
import { getSeckillConfig, getSeckillList } from '@/api/activity';
|
||||||
import CountDown from "@/components/CountDown";
|
import CountDown from '@/components/CountDown';
|
||||||
// import { Tab, Tabs } from "vant-weapp";
|
// import { Tab, Tabs } from "vant-weapp";
|
||||||
import Loading from "@/components/Loading";
|
import Loading from '@/components/Loading';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "GoodsSeckill",
|
name: 'GoodsSeckill',
|
||||||
components: {
|
components: {
|
||||||
CountDown
|
CountDown
|
||||||
},
|
},
|
||||||
props: {},
|
props: {},
|
||||||
data: function() {
|
data: function() {
|
||||||
return {
|
return {
|
||||||
headerImg: "",
|
headerImg: '',
|
||||||
timeList: [],
|
timeList: [],
|
||||||
sticky: false,
|
sticky: false,
|
||||||
loading: false,
|
loading: false,
|
||||||
@ -117,38 +95,38 @@ export default {
|
|||||||
var that = this;
|
var that = this;
|
||||||
uni.showLoading();
|
uni.showLoading();
|
||||||
getSeckillConfig().then(res => {
|
getSeckillConfig().then(res => {
|
||||||
that.$set(that, "headerImg", res.data.lovely);
|
that.$set(that, 'headerImg', res.data.lovely);
|
||||||
that.$set(that, "timeList", res.data.seckillTime);
|
that.$set(that, 'timeList', res.data.seckillTime);
|
||||||
that.$set(that, "active", res.data.seckillTimeIndex);
|
that.$set(that, 'active', res.data.seckillTimeIndex);
|
||||||
|
|
||||||
let title = [];
|
let title = [];
|
||||||
title = res.data.seckillTime.map((item, index) => {
|
title = res.data.seckillTime.map((item, index) => {
|
||||||
return {
|
return {
|
||||||
name: "div",
|
name: 'div',
|
||||||
attrs: {
|
attrs: {
|
||||||
class: "timeItem"
|
class: 'timeItem'
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
name: "div",
|
name: 'div',
|
||||||
attrs: {
|
attrs: {
|
||||||
class: "time"
|
class: 'time'
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
type: "text",
|
type: 'text',
|
||||||
text: item.time
|
text: item.time
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "div",
|
name: 'div',
|
||||||
attrs: {
|
attrs: {
|
||||||
class: "state"
|
class: 'state'
|
||||||
},
|
},
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
type: "text",
|
type: 'text',
|
||||||
text: item.state
|
text: item.state
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@ -156,7 +134,7 @@ export default {
|
|||||||
]
|
]
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
that.$set(that, "title", title);
|
that.$set(that, 'title', title);
|
||||||
that.datatime = that.timeList[that.active].stop;
|
that.datatime = that.timeList[that.active].stop;
|
||||||
that.getSeckillList();
|
that.getSeckillList();
|
||||||
that.$nextTick(function() {
|
that.$nextTick(function() {
|
||||||
@ -187,7 +165,7 @@ export default {
|
|||||||
var that = this;
|
var that = this;
|
||||||
var time = that.timeList[that.active].stop;
|
var time = that.timeList[that.active].stop;
|
||||||
this.$yrouter.push({
|
this.$yrouter.push({
|
||||||
path: "/pages/activity/SeckillDetails/index",
|
path: '/pages/activity/SeckillDetails/index',
|
||||||
query: { id, time }
|
query: { id, time }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="container">
|
<view class="container">
|
||||||
<view v-if="!$store.getters.token&&$deviceType=='weixin'">
|
<view v-if="!token">
|
||||||
|
<view v-if="$deviceType == 'weixin'">
|
||||||
<view class="getUserInfo">
|
<view class="getUserInfo">
|
||||||
<text>您还未允许微信登录授权,请点击下方按钮允许微信授权登录。</text>
|
<text>您还未允许微信登录授权,请点击下方按钮允许微信授权登录。</text>
|
||||||
<button type="primary" open-type="getUserInfo" @getuserinfo="getUserInfo">允许微信登录授权</button>
|
<button type="primary" open-type="getUserInfo" @getuserinfo="getUserInfo">允许微信登录授权</button>
|
||||||
@ -8,42 +9,34 @@
|
|||||||
<button @click="back">取消微信登录授权</button>
|
<button @click="back">取消微信登录授权</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view v-if="!$store.getters.token&&$deviceType!='weixin'&&$deviceType=='app'">
|
<view v-if="$deviceType == 'app'">
|
||||||
<view class="getUserInfo">
|
<view class="getUserInfo">
|
||||||
<text>请先登录</text>
|
<text>请先登录</text>
|
||||||
<button type="primary" @click="this.toLogin">去登录</button>
|
<button type="primary" @click="this.toLogin">去登录</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {
|
import { mapState, mapMutations, mapActions } from 'vuex';
|
||||||
mapState,
|
|
||||||
mapMutations,
|
|
||||||
mapActions
|
|
||||||
} from "vuex";
|
|
||||||
// 组件
|
// 组件
|
||||||
// import request from "@//api/request";
|
// import request from "@//api/request";
|
||||||
import {
|
import { wxappAuth, getUser } from '@/api/user';
|
||||||
wxappAuth,
|
import dayjs from 'dayjs';
|
||||||
getUser
|
import cookie from '@/utils/store/cookie';
|
||||||
} from "@/api/user";
|
import { login } from '@/utils';
|
||||||
import dayjs from "dayjs";
|
|
||||||
import cookie from "@/utils/store/cookie";
|
|
||||||
import {
|
|
||||||
login
|
|
||||||
} from "@/utils";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {};
|
return {
|
||||||
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(["isAuthorization"])
|
...mapState(['isAuthorization','$deviceType','token'])
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
|
|
||||||
this.UPDATE_AUTHORIZATIONPAGE(true);
|
this.UPDATE_AUTHORIZATIONPAGE(true);
|
||||||
},
|
},
|
||||||
onHide() {
|
onHide() {
|
||||||
@ -55,25 +48,25 @@
|
|||||||
this.changeAuthorization(false);
|
this.changeAuthorization(false);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(["changeAuthorization", "setUserInfo"]),
|
...mapActions(['changeAuthorization', 'setUserInfo']),
|
||||||
...mapMutations(["UPDATE_AUTHORIZATIONPAGE", "CHANGE_TABTAR"]),
|
...mapMutations(['UPDATE_AUTHORIZATIONPAGE', 'CHANGE_TABTAR']),
|
||||||
back() {
|
back() {
|
||||||
this.$yrouter.switchTab({
|
this.$yrouter.switchTab({
|
||||||
path: "/pages/home/index",
|
path: '/pages/home/index',
|
||||||
query: {}
|
query: {}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getUserInfo(data) {
|
getUserInfo(data) {
|
||||||
if (data.detail.errMsg == "getUserInfo:fail auth deny") {
|
if (data.detail.errMsg == 'getUserInfo:fail auth deny') {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "取消授权",
|
title: '取消授权',
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
duration: 2000
|
duration: 2000
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: "登录中"
|
title: '登录中'
|
||||||
});
|
});
|
||||||
login({
|
login({
|
||||||
success: () => {}
|
success: () => {}
|
||||||
@ -81,13 +74,14 @@
|
|||||||
},
|
},
|
||||||
toLogin() {
|
toLogin() {
|
||||||
this.$yrouter.push({
|
this.$yrouter.push({
|
||||||
path: "/pages/user/Login/index",
|
path: '/pages/user/Login/index',
|
||||||
query: {}
|
query: {}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onUnload() {},
|
onUnload() {},
|
||||||
mounted() {}
|
mounted() {
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -173,7 +167,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.tab-bar-pic-active {}
|
.tab-bar-pic-active {
|
||||||
|
}
|
||||||
|
|
||||||
text {
|
text {
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
|
@ -2,39 +2,26 @@
|
|||||||
<view class="index">
|
<view class="index">
|
||||||
<view class="header acea-row row-center-wrapper">
|
<view class="header acea-row row-center-wrapper">
|
||||||
<view @click="goGoodSearch()" class="search acea-row row-middle">
|
<view @click="goGoodSearch()" class="search acea-row row-middle">
|
||||||
<text class="iconfont icon-xiazai5"></text>搜索商品
|
<text class="iconfont icon-xiazai5"></text>
|
||||||
|
搜索商品
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="slider-banner banner">
|
<view class="slider-banner banner">
|
||||||
<swiper indicatorDots="true" v-if="banner.length > 0">
|
<swiper indicatorDots="true" v-if="banner.length > 0">
|
||||||
<block v-for="(item, bannerIndex) in banner" :key="bannerIndex">
|
<block v-for="(item, bannerIndex) in banner" :key="bannerIndex">
|
||||||
<swiper-item>
|
<swiper-item>
|
||||||
<view @click="item.url?$yrouter.push('/'+item.url) : ''" class="swiper-item">
|
<view @click="item.url ? $yrouter.push('/' + item.url) : ''" class="swiper-item"><image :src="item.pic" /></view>
|
||||||
<image :src="item.pic" />
|
|
||||||
</view>
|
|
||||||
</swiper-item>
|
</swiper-item>
|
||||||
</block>
|
</block>
|
||||||
</swiper>
|
</swiper>
|
||||||
</view>
|
</view>
|
||||||
<view class="news acea-row row-between-wrapper">
|
<view class="news acea-row row-between-wrapper">
|
||||||
<view class="pictrue" v-if="$VUE_APP_RESOURCES_URL">
|
<view class="pictrue" v-if="$VUE_APP_RESOURCES_URL"><image :src="$VUE_APP_RESOURCES_URL + '/images/news.png'" /></view>
|
||||||
<image :src="$VUE_APP_RESOURCES_URL+'/images/news.png'" />
|
|
||||||
</view>
|
|
||||||
<view class="swiper-no-swiping new-banner">
|
<view class="swiper-no-swiping new-banner">
|
||||||
<swiper
|
<swiper class="swiper-wrapper" v-if="roll.length > 0" :indicator-dots="false" autoplay circular vertical>
|
||||||
class="swiper-wrapper"
|
|
||||||
v-if="roll.length > 0"
|
|
||||||
:indicator-dots="false"
|
|
||||||
autoplay
|
|
||||||
circular
|
|
||||||
vertical
|
|
||||||
>
|
|
||||||
<block v-for="(item, rollIndex) in roll" :key="rollIndex">
|
<block v-for="(item, rollIndex) in roll" :key="rollIndex">
|
||||||
<swiper-item class="swiper-slide">
|
<swiper-item class="swiper-slide">
|
||||||
<view
|
<view @click="item.uniapp_url ? $yrouter.push(item.uniapp_url) : ''" class="swiper-item acea-row row-between-wrapper">
|
||||||
@click="item.uniapp_url?$yrouter.push(item.uniapp_url) : ''"
|
|
||||||
class="swiper-item acea-row row-between-wrapper"
|
|
||||||
>
|
|
||||||
<view class="text acea-row row-between-wrapper">
|
<view class="text acea-row row-between-wrapper">
|
||||||
<view class="label" v-if="item.show === '是'">最新</view>
|
<view class="label" v-if="item.show === '是'">最新</view>
|
||||||
<view class="newsTitle line1">{{ item.info }}</view>
|
<view class="newsTitle line1">{{ item.info }}</view>
|
||||||
@ -47,24 +34,15 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="nav acea-row">
|
<view class="nav acea-row">
|
||||||
<view
|
<view @click="goWxappUrl(item)" class="item" v-for="(item, menusIndex) in menus" :key="menusIndex">
|
||||||
@click="goWxappUrl(item)"
|
<view class="pictrue"><image :src="item.pic" /></view>
|
||||||
class="item"
|
|
||||||
v-for="(item, menusIndex) in menus"
|
|
||||||
:key="menusIndex"
|
|
||||||
>
|
|
||||||
<view class="pictrue">
|
|
||||||
<image :src="item.pic" />
|
|
||||||
</view>
|
|
||||||
<view>{{ item.name }}</view>
|
<view>{{ item.name }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="wrapper hot" v-if="bastList.length > 0">
|
<view class="wrapper hot" v-if="bastList.length > 0">
|
||||||
<image class="bg" src="../../static/images/index-bg.png" mode="widthFix"></image>
|
<image class="bg" src="../../static/images/index-bg.png" mode="widthFix"></image>
|
||||||
<view class="title acea-row row-between-wrapper">
|
<view class="title acea-row row-between-wrapper">
|
||||||
<view class="text">
|
<view class="text"><view class="name line1">热门榜单</view></view>
|
||||||
<view class="name line1">热门榜单</view>
|
|
||||||
</view>
|
|
||||||
<view @click="goHotNewGoods()" class="more">
|
<view @click="goHotNewGoods()" class="more">
|
||||||
更多
|
更多
|
||||||
<text class="iconfont icon-jiantou"></text>
|
<text class="iconfont icon-jiantou"></text>
|
||||||
@ -73,15 +51,8 @@
|
|||||||
<view class="newProducts">
|
<view class="newProducts">
|
||||||
<scroll-view scroll-y="false" scroll-x="true">
|
<scroll-view scroll-y="false" scroll-x="true">
|
||||||
<view class="newProductsScroll">
|
<view class="newProductsScroll">
|
||||||
<view
|
<view @click="goGoodsCon(item)" class="newProductsItem" v-for="(item, likeInfoIndex) in likeInfo" :key="likeInfoIndex">
|
||||||
@click="goGoodsCon(item)"
|
<view class="img-box"><image :src="item.image" /></view>
|
||||||
class="newProductsItem"
|
|
||||||
v-for="(item, likeInfoIndex) in likeInfo"
|
|
||||||
:key="likeInfoIndex"
|
|
||||||
>
|
|
||||||
<view class="img-box">
|
|
||||||
<image :src="item.image" />
|
|
||||||
</view>
|
|
||||||
<view class="pro-info line1">{{ item.storeName }}</view>
|
<view class="pro-info line1">{{ item.storeName }}</view>
|
||||||
<view class="money font-color-red">¥{{ item.price }}</view>
|
<view class="money font-color-red">¥{{ item.price }}</view>
|
||||||
</view>
|
</view>
|
||||||
@ -91,9 +62,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="wrapper" v-if="bastList.length > 0">
|
<view class="wrapper" v-if="bastList.length > 0">
|
||||||
<view class="title acea-row row-between-wrapper">
|
<view class="title acea-row row-between-wrapper">
|
||||||
<view class="text">
|
<view class="text"><view class="name line1">精品推荐</view></view>
|
||||||
<view class="name line1">精品推荐</view>
|
|
||||||
</view>
|
|
||||||
<view @click="goHotNewGoods(1)" class="more">
|
<view @click="goHotNewGoods(1)" class="more">
|
||||||
更多
|
更多
|
||||||
<text class="iconfont icon-jiantou"></text>
|
<text class="iconfont icon-jiantou"></text>
|
||||||
@ -118,15 +87,8 @@
|
|||||||
<view class="newProducts">
|
<view class="newProducts">
|
||||||
<scroll-view scroll-y="false" scroll-x="true">
|
<scroll-view scroll-y="false" scroll-x="true">
|
||||||
<view class="newProductsScroll">
|
<view class="newProductsScroll">
|
||||||
<view
|
<view @click="goGoodsCon(item)" class="newProductsItem" v-for="(item, firstListIndex) in firstList" :key="firstListIndex">
|
||||||
@click="goGoodsCon(item)"
|
<view class="img-box"><image :src="item.image" /></view>
|
||||||
class="newProductsItem"
|
|
||||||
v-for="(item, firstListIndex) in firstList"
|
|
||||||
:key="firstListIndex"
|
|
||||||
>
|
|
||||||
<view class="img-box">
|
|
||||||
<image :src="item.image" />
|
|
||||||
</view>
|
|
||||||
<view class="pro-info line1">{{ item.storeName }}</view>
|
<view class="pro-info line1">{{ item.storeName }}</view>
|
||||||
<view class="money font-color-red">¥{{ item.price }}</view>
|
<view class="money font-color-red">¥{{ item.price }}</view>
|
||||||
</view>
|
</view>
|
||||||
@ -136,9 +98,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="wrapper" v-if="benefit.length > 0">
|
<view class="wrapper" v-if="benefit.length > 0">
|
||||||
<view class="title acea-row row-between-wrapper">
|
<view class="title acea-row row-between-wrapper">
|
||||||
<view class="text">
|
<view class="text"><view class="name line1">促销单品</view></view>
|
||||||
<view class="name line1">促销单品</view>
|
|
||||||
</view>
|
|
||||||
<view @click="goGoodsPromotion()" class="more">
|
<view @click="goGoodsPromotion()" class="more">
|
||||||
更多
|
更多
|
||||||
<text class="iconfont icon-jiantou"></text>
|
<text class="iconfont icon-jiantou"></text>
|
||||||
@ -146,28 +106,23 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<PromotionGood :benefit="benefit"></PromotionGood>
|
<PromotionGood :benefit="benefit"></PromotionGood>
|
||||||
<Coupon-window
|
<Coupon-window :coupon-list="couponList" v-if="showCoupon" @checked="couponClose" @close="couponClose"></Coupon-window>
|
||||||
:coupon-list="couponList"
|
|
||||||
v-if="showCoupon"
|
|
||||||
@checked="couponClose"
|
|
||||||
@close="couponClose"
|
|
||||||
></Coupon-window>
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
// import { swiper, swiperSlide } from "vue-awesome-swiper";
|
// import { swiper, swiperSlide } from "vue-awesome-swiper";
|
||||||
|
|
||||||
import GoodList from "@/components/GoodList";
|
import GoodList from '@/components/GoodList';
|
||||||
import PromotionGood from "@/components/PromotionGood";
|
import PromotionGood from '@/components/PromotionGood';
|
||||||
import CouponWindow from "@/components/CouponWindow";
|
import CouponWindow from '@/components/CouponWindow';
|
||||||
import { getHomeData, getShare } from "@/api/public";
|
import { getHomeData, getShare } from '@/api/public';
|
||||||
import cookie from "@/utils/store/cookie";
|
import cookie from '@/utils/store/cookie';
|
||||||
import { isWeixin } from "@/utils/index";
|
import { isWeixin } from '@/utils/index';
|
||||||
|
|
||||||
const HAS_COUPON_WINDOW = "has_coupon_window";
|
const HAS_COUPON_WINDOW = 'has_coupon_window';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Index",
|
name: 'Index',
|
||||||
components: {
|
components: {
|
||||||
// swiper,
|
// swiper,
|
||||||
// swiperSlide,
|
// swiperSlide,
|
||||||
@ -179,7 +134,7 @@ export default {
|
|||||||
data: function() {
|
data: function() {
|
||||||
return {
|
return {
|
||||||
showCoupon: false,
|
showCoupon: false,
|
||||||
logoUrl: "",
|
logoUrl: '',
|
||||||
banner: [],
|
banner: [],
|
||||||
menus: [],
|
menus: [],
|
||||||
roll: [],
|
roll: [],
|
||||||
@ -199,7 +154,7 @@ export default {
|
|||||||
couponList: [],
|
couponList: [],
|
||||||
swiperOption: {
|
swiperOption: {
|
||||||
pagination: {
|
pagination: {
|
||||||
el: ".swiper-pagination",
|
el: '.swiper-pagination',
|
||||||
clickable: true
|
clickable: true
|
||||||
},
|
},
|
||||||
autoplay: {
|
autoplay: {
|
||||||
@ -212,7 +167,7 @@ export default {
|
|||||||
observeParents: true
|
observeParents: true
|
||||||
},
|
},
|
||||||
swiperRoll: {
|
swiperRoll: {
|
||||||
direction: "vertical",
|
direction: 'vertical',
|
||||||
autoplay: {
|
autoplay: {
|
||||||
disableOnInteraction: false,
|
disableOnInteraction: false,
|
||||||
delay: 2000
|
delay: 2000
|
||||||
@ -225,13 +180,13 @@ export default {
|
|||||||
swiperScroll: {
|
swiperScroll: {
|
||||||
freeMode: true,
|
freeMode: true,
|
||||||
freeModeMomentum: false,
|
freeModeMomentum: false,
|
||||||
slidesPerView: "auto",
|
slidesPerView: 'auto',
|
||||||
observer: true,
|
observer: true,
|
||||||
observeParents: true
|
observeParents: true
|
||||||
},
|
},
|
||||||
swiperBoutique: {
|
swiperBoutique: {
|
||||||
pagination: {
|
pagination: {
|
||||||
el: ".swiper-pagination",
|
el: '.swiper-pagination',
|
||||||
clickable: true
|
clickable: true
|
||||||
},
|
},
|
||||||
autoplay: {
|
autoplay: {
|
||||||
@ -246,7 +201,7 @@ export default {
|
|||||||
swiperProducts: {
|
swiperProducts: {
|
||||||
freeMode: true,
|
freeMode: true,
|
||||||
freeModeMomentum: false,
|
freeModeMomentum: false,
|
||||||
slidesPerView: "auto",
|
slidesPerView: 'auto',
|
||||||
observer: true,
|
observer: true,
|
||||||
observeParents: true
|
observeParents: true
|
||||||
}
|
}
|
||||||
@ -256,48 +211,49 @@ export default {
|
|||||||
let that = this;
|
let that = this;
|
||||||
uni.showLoading({
|
uni.showLoading({
|
||||||
title: '加载中'
|
title: '加载中'
|
||||||
})
|
});
|
||||||
getHomeData().then(res => {
|
getHomeData().then(res => {
|
||||||
|
console.log(res);
|
||||||
that.logoUrl = res.data.logoUrl;
|
that.logoUrl = res.data.logoUrl;
|
||||||
that.$set(that, "banner", res.data.banner);
|
that.$set(that, 'banner', res.data.banner);
|
||||||
that.$set(that, "menus", res.data.menus);
|
that.$set(that, 'menus', res.data.menus);
|
||||||
that.$set(that, "roll", res.data.roll);
|
that.$set(that, 'roll', res.data.roll);
|
||||||
that.$set(that, "activity", res.data.activity);
|
that.$set(that, 'activity', res.data.activity);
|
||||||
var activityOne = res.data.activity.shift();
|
var activityOne = res.data.activity.shift();
|
||||||
that.$set(that, "activityOne", activityOne);
|
that.$set(that, 'activityOne', activityOne);
|
||||||
that.$set(that, "info", res.data.info);
|
that.$set(that, 'info', res.data.info);
|
||||||
that.$set(that, "firstList", res.data.firstList);
|
that.$set(that, 'firstList', res.data.firstList);
|
||||||
that.$set(that, "bastList", res.data.bastList);
|
that.$set(that, 'bastList', res.data.bastList);
|
||||||
that.$set(that, "likeInfo", res.data.likeInfo);
|
that.$set(that, 'likeInfo', res.data.likeInfo);
|
||||||
that.$set(that, "lovely", res.data.lovely);
|
that.$set(that, 'lovely', res.data.lovely);
|
||||||
that.$set(that, "benefit", res.data.benefit);
|
that.$set(that, 'benefit', res.data.benefit);
|
||||||
that.$set(that, "couponList", res.data.couponList);
|
that.$set(that, 'couponList', res.data.couponList);
|
||||||
uni.hideLoading()
|
uni.hideLoading();
|
||||||
that.setOpenShare();
|
that.setOpenShare();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
goGoodSearch() {
|
goGoodSearch() {
|
||||||
this.$yrouter.push("/pages/shop/GoodSearch/index");
|
this.$yrouter.push('/pages/shop/GoodSearch/index');
|
||||||
},
|
},
|
||||||
goWxappUrl(item) {
|
goWxappUrl(item) {
|
||||||
this.$yrouter.push(item.uniapp_url);
|
this.$yrouter.push(item.uniapp_url);
|
||||||
},
|
},
|
||||||
goHotNewGoods(type) {
|
goHotNewGoods(type) {
|
||||||
this.$yrouter.push({
|
this.$yrouter.push({
|
||||||
path: "/pages/shop/HotNewGoods/index",
|
path: '/pages/shop/HotNewGoods/index',
|
||||||
query: { type }
|
query: { type }
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
goGoodsCon(item) {
|
goGoodsCon(item) {
|
||||||
console.log(item)
|
console.log(item);
|
||||||
this.$yrouter.push({
|
this.$yrouter.push({
|
||||||
path: "/pages/shop/GoodsCon/index",
|
path: '/pages/shop/GoodsCon/index',
|
||||||
query: { id: item.id }
|
query: { id: item.id }
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
goGoodsPromotion() {
|
goGoodsPromotion() {
|
||||||
this.$yrouter.push("/pages/shop/GoodsPromotion/index");
|
this.$yrouter.push('/pages/shop/GoodsPromotion/index');
|
||||||
},
|
},
|
||||||
setOpenShare: function() {}
|
setOpenShare: function() {}
|
||||||
}
|
}
|
||||||
|
@ -3,13 +3,16 @@
|
|||||||
<view class v-if="userInfo.uid">
|
<view class v-if="userInfo.uid">
|
||||||
<view class="labelNav acea-row row-around row-middle">
|
<view class="labelNav acea-row row-around row-middle">
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<text class="iconfont icon-xuanzhong"></text>100%正品保证
|
<text class="iconfont icon-xuanzhong"></text>
|
||||||
|
100%正品保证
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<text class="iconfont icon-xuanzhong"></text>所有商品精挑细选
|
<text class="iconfont icon-xuanzhong"></text>
|
||||||
|
所有商品精挑细选
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<text class="iconfont icon-xuanzhong"></text>售后无忧
|
<text class="iconfont icon-xuanzhong"></text>
|
||||||
|
售后无忧
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="nav acea-row row-between-wrapper">
|
<view class="nav acea-row row-between-wrapper">
|
||||||
@ -17,25 +20,15 @@
|
|||||||
购物数量
|
购物数量
|
||||||
<text class="num font-color-red">{{ count }}</text>
|
<text class="num font-color-red">{{ count }}</text>
|
||||||
</view>
|
</view>
|
||||||
<view
|
<view v-if="cartList.valid.length > 0" class="administrate acea-row row-center-wrapper" @click="manage">{{ footerswitch ? '取消' : '管理' }}</view>
|
||||||
v-if="cartList.valid.length > 0"
|
|
||||||
class="administrate acea-row row-center-wrapper"
|
|
||||||
@click="manage"
|
|
||||||
>{{ footerswitch ? "取消" : "管理" }}</view>
|
|
||||||
</view>
|
</view>
|
||||||
<view v-if="validList.length > 0 || cartList.invalid.length > 0">
|
<view v-if="validList.length > 0 || cartList.invalid.length > 0">
|
||||||
<view class="list">
|
<view class="list">
|
||||||
<view
|
<view class="item acea-row row-between-wrapper" v-for="(item, cartListValidIndex) in validList" :key="cartListValidIndex">
|
||||||
class="item acea-row row-between-wrapper"
|
|
||||||
v-for="(item, cartListValidIndex) in validList"
|
|
||||||
:key="cartListValidIndex"
|
|
||||||
>
|
|
||||||
<view class="select-btn">
|
<view class="select-btn">
|
||||||
<view class="checkbox-wrapper">
|
<view class="checkbox-wrapper">
|
||||||
<checkbox-group @change="switchSelect(cartListValidIndex)">
|
<checkbox-group @change="switchSelect(cartListValidIndex)">
|
||||||
<label class="well-check">
|
<label class="well-check"><checkbox value :checked="item.checked"></checkbox></label>
|
||||||
<checkbox value :checked="item.checked"></checkbox>
|
|
||||||
</label>
|
|
||||||
</checkbox-group>
|
</checkbox-group>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -46,31 +39,28 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="text">
|
<view class="text">
|
||||||
<view class="line1">{{ item.productInfo.storeName }}</view>
|
<view class="line1">{{ item.productInfo.storeName }}</view>
|
||||||
<view
|
<view class="infor line1" v-if="item.productInfo.attrInfo">属性:{{ item.productInfo.attrInfo.suk }}</view>
|
||||||
class="infor line1"
|
|
||||||
v-if="item.productInfo.attrInfo"
|
|
||||||
>属性:{{ item.productInfo.attrInfo.suk }}</view>
|
|
||||||
<view class="money">¥{{ item.truePrice }}</view>
|
<view class="money">¥{{ item.truePrice }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="carnum acea-row row-center-wrapper">
|
<view class="carnum acea-row row-center-wrapper">
|
||||||
<view
|
<view class="reduce" :class="validList[cartListValidIndex].cartNum <= 1 ? 'on' : ''" @click.prevent="reduce(cartListValidIndex)">-</view>
|
||||||
class="reduce"
|
|
||||||
:class="validList[cartListValidIndex].cartNum <= 1 ? 'on' : ''"
|
|
||||||
@click.prevent="reduce(cartListValidIndex)"
|
|
||||||
>-</view>
|
|
||||||
<view class="num">{{ item.cartNum }}</view>
|
<view class="num">{{ item.cartNum }}</view>
|
||||||
<view
|
<view
|
||||||
class="plus"
|
class="plus"
|
||||||
v-if="validList[cartListValidIndex].attrInfo"
|
v-if="validList[cartListValidIndex].attrInfo"
|
||||||
:class="validList[cartListValidIndex].cartNum >= validList[cartListValidIndex].attrInfo.stock ? 'on' : ''"
|
:class="validList[cartListValidIndex].cartNum >= validList[cartListValidIndex].attrInfo.stock ? 'on' : ''"
|
||||||
@click.prevent="plus(cartListValidIndex)"
|
@click.prevent="plus(cartListValidIndex)"
|
||||||
>+</view>
|
>
|
||||||
|
+
|
||||||
|
</view>
|
||||||
<view
|
<view
|
||||||
class="plus"
|
class="plus"
|
||||||
v-else
|
v-else
|
||||||
:class="validList[cartListValidIndex].cartNum >= validList[cartListValidIndex].stock ? 'on' : ''"
|
:class="validList[cartListValidIndex].cartNum >= validList[cartListValidIndex].stock ? 'on' : ''"
|
||||||
@click.prevent="plus(cartListValidIndex)"
|
@click.prevent="plus(cartListValidIndex)"
|
||||||
>+</view>
|
>
|
||||||
|
+
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -78,25 +68,17 @@
|
|||||||
<view class="invalidGoods" v-if="cartList.invalid.length > 0">
|
<view class="invalidGoods" v-if="cartList.invalid.length > 0">
|
||||||
<view class="goodsNav acea-row row-between-wrapper">
|
<view class="goodsNav acea-row row-between-wrapper">
|
||||||
<view @click="goodsOpen">
|
<view @click="goodsOpen">
|
||||||
<text
|
<text class="iconfont" :class="goodsHidden === true ? 'icon-xiangyou' : 'icon-xiangxia'"></text>
|
||||||
class="iconfont"
|
失效商品
|
||||||
:class="goodsHidden === true ? 'icon-xiangyou' : 'icon-xiangxia'"
|
|
||||||
></text>失效商品
|
|
||||||
</view>
|
</view>
|
||||||
<view class="del" @click="delInvalidGoods">
|
<view class="del" @click="delInvalidGoods">
|
||||||
<text class="iconfont icon-shanchu1"></text>清空
|
<text class="iconfont icon-shanchu1"></text>
|
||||||
|
清空
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="goodsList" :hidden="goodsHidden">
|
<view class="goodsList" :hidden="goodsHidden">
|
||||||
<view
|
<view v-for="(item, cartListinvalidIndex) in cartList.invalid" :key="cartListinvalidIndex">
|
||||||
v-for="(item, cartListinvalidIndex) in cartList.invalid"
|
<view @click="goGoodsCon(item)" class="item acea-row row-between-wrapper" v-if="item.productInfo">
|
||||||
:key="cartListinvalidIndex"
|
|
||||||
>
|
|
||||||
<view
|
|
||||||
@click="goGoodsCon(item)"
|
|
||||||
class="item acea-row row-between-wrapper"
|
|
||||||
v-if="item.productInfo"
|
|
||||||
>
|
|
||||||
<view class="invalid acea-row row-center-wrapper">失效</view>
|
<view class="invalid acea-row row-center-wrapper">失效</view>
|
||||||
<view class="pictrue">
|
<view class="pictrue">
|
||||||
<image :src="item.productInfo.attrInfo.image" v-if="item.productInfo.attrInfo" />
|
<image :src="item.productInfo.attrInfo.image" v-if="item.productInfo.attrInfo" />
|
||||||
@ -104,13 +86,8 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="text acea-row row-column-between">
|
<view class="text acea-row row-column-between">
|
||||||
<view class="line1">{{ item.productInfo.storeName }}</view>
|
<view class="line1">{{ item.productInfo.storeName }}</view>
|
||||||
<view
|
<view class="infor line1" v-if="item.productInfo.attrInfo">属性:{{ item.productInfo.attrInfo.suk }}</view>
|
||||||
class="infor line1"
|
<view class="acea-row row-between-wrapper"><view class="end">该商品已下架</view></view>
|
||||||
v-if="item.productInfo.attrInfo"
|
|
||||||
>属性:{{ item.productInfo.attrInfo.suk }}</view>
|
|
||||||
<view class="acea-row row-between-wrapper">
|
|
||||||
<view class="end">该商品已下架</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -119,9 +96,7 @@
|
|||||||
</view>
|
</view>
|
||||||
<!--购物车暂无商品-->
|
<!--购物车暂无商品-->
|
||||||
<view class="noCart" v-if="cartList.valid.length === 0 && cartList.invalid.length === 0">
|
<view class="noCart" v-if="cartList.valid.length === 0 && cartList.invalid.length === 0">
|
||||||
<view class="pictrue">
|
<view class="pictrue"><image :src="$VUE_APP_RESOURCES_URL + '/images/noCart.png'" /></view>
|
||||||
<image :src="$VUE_APP_RESOURCES_URL+'/images/noCart.png'" />
|
|
||||||
</view>
|
|
||||||
<Recommend></Recommend>
|
<Recommend></Recommend>
|
||||||
</view>
|
</view>
|
||||||
<view style="height:210rpx"></view>
|
<view style="height:210rpx"></view>
|
||||||
@ -164,24 +139,19 @@
|
|||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import Recommend from "@/components/Recommend";
|
import Recommend from '@/components/Recommend';
|
||||||
import Authorization from "@/pages/authorization/index";
|
import Authorization from '@/pages/authorization/index';
|
||||||
import { mapGetters } from "vuex";
|
import { mapGetters } from 'vuex';
|
||||||
|
|
||||||
import {
|
import { getCartList, postCartDel, changeCartNum, getCartCount } from '@/api/store';
|
||||||
getCartList,
|
import { postCollectAll } from '@/api/user';
|
||||||
postCartDel,
|
import { mul, add } from '@/utils/bc';
|
||||||
changeCartNum,
|
import cookie from '@/utils/store/cookie';
|
||||||
getCartCount
|
|
||||||
} from "@/api/store";
|
|
||||||
import { postCollectAll } from "@/api/user";
|
|
||||||
import { mul, add } from "@/utils/bc";
|
|
||||||
import cookie from "@/utils/store/cookie";
|
|
||||||
|
|
||||||
const CHECKED_IDS = "cart_checked";
|
const CHECKED_IDS = 'cart_checked';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "ShoppingCart",
|
name: 'ShoppingCart',
|
||||||
components: {
|
components: {
|
||||||
Recommend,
|
Recommend,
|
||||||
Authorization
|
Authorization
|
||||||
@ -204,7 +174,7 @@ export default {
|
|||||||
loaded: false
|
loaded: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: mapGetters(["userInfo"]),
|
computed: mapGetters(['userInfo', 'token']),
|
||||||
|
|
||||||
// watch: {
|
// watch: {
|
||||||
// $yroute(n) {
|
// $yroute(n) {
|
||||||
@ -223,7 +193,7 @@ export default {
|
|||||||
// },
|
// },
|
||||||
watch: {
|
watch: {
|
||||||
userInfo(user) {
|
userInfo(user) {
|
||||||
console.log(user);
|
console.log(user, '用户信息,8585');
|
||||||
if (user.uid) {
|
if (user.uid) {
|
||||||
this.carnum();
|
this.carnum();
|
||||||
this.countMoney();
|
this.countMoney();
|
||||||
@ -231,6 +201,15 @@ export default {
|
|||||||
this.gainCount();
|
this.gainCount();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
token(token) {
|
||||||
|
console.log(token, '用户token,8585');
|
||||||
|
if (this.userInfo.uid) {
|
||||||
|
this.carnum();
|
||||||
|
this.countMoney();
|
||||||
|
this.getCartList();
|
||||||
|
this.gainCount();
|
||||||
|
}
|
||||||
|
},
|
||||||
cartList(list) {
|
cartList(list) {
|
||||||
this.validList = list.valid;
|
this.validList = list.valid;
|
||||||
}
|
}
|
||||||
@ -246,7 +225,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
goGoodsCon(item) {
|
goGoodsCon(item) {
|
||||||
this.$yrouter.push({
|
this.$yrouter.push({
|
||||||
path: "/pages/shop/GoodsCon/index",
|
path: '/pages/shop/GoodsCon/index',
|
||||||
query: {
|
query: {
|
||||||
id: item.productId
|
id: item.productId
|
||||||
}
|
}
|
||||||
@ -283,18 +262,17 @@ export default {
|
|||||||
});
|
});
|
||||||
if (id.length === 0) {
|
if (id.length === 0) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "请选择产品",
|
title: '请选择产品',
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
duration: 2000
|
duration: 2000
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
postCartDel(id).then(function() {
|
postCartDel(id).then(function() {
|
||||||
list.forEach(function(val, i) {
|
list.forEach(function(val, i) {
|
||||||
if (val.checked === false || val.checked === undefined)
|
if (val.checked === false || val.checked === undefined) valid.push(list[i]);
|
||||||
valid.push(list[i]);
|
|
||||||
});
|
});
|
||||||
that.$set(that.cartList, "valid", valid);
|
that.$set(that.cartList, 'valid', valid);
|
||||||
that.carnum();
|
that.carnum();
|
||||||
that.countMoney();
|
that.countMoney();
|
||||||
that.gainCount();
|
that.gainCount();
|
||||||
@ -327,7 +305,7 @@ export default {
|
|||||||
let that = this,
|
let that = this,
|
||||||
data = {
|
data = {
|
||||||
id: [],
|
id: [],
|
||||||
category: ""
|
category: ''
|
||||||
},
|
},
|
||||||
list = that.cartList.valid;
|
list = that.cartList.valid;
|
||||||
list.forEach(function(val) {
|
list.forEach(function(val) {
|
||||||
@ -338,16 +316,16 @@ export default {
|
|||||||
});
|
});
|
||||||
if (data.id.length === 0) {
|
if (data.id.length === 0) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "请选择产品",
|
title: '请选择产品',
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
duration: 2000
|
duration: 2000
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
postCollectAll(data).then(function() {
|
postCollectAll(data).then(function() {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "收藏成功!",
|
title: '收藏成功!',
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
duration: 2000
|
duration: 2000
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -364,17 +342,17 @@ export default {
|
|||||||
});
|
});
|
||||||
if (id.length === 0) {
|
if (id.length === 0) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "请选择产品",
|
title: '请选择产品',
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
duration: 2000
|
duration: 2000
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log(id);
|
console.log(id);
|
||||||
this.$yrouter.push({
|
this.$yrouter.push({
|
||||||
path: "/pages/order/OrderSubmission/index",
|
path: '/pages/order/OrderSubmission/index',
|
||||||
query: {
|
query: {
|
||||||
id: id.join(",")
|
id: id.join(',')
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -393,11 +371,11 @@ export default {
|
|||||||
list.cartNum++;
|
list.cartNum++;
|
||||||
if (list.attrInfo) {
|
if (list.attrInfo) {
|
||||||
if (list.cartNum >= list.attrInfo.stock) {
|
if (list.cartNum >= list.attrInfo.stock) {
|
||||||
that.$set(list, "cart_num", list.attrInfo.stock);
|
that.$set(list, 'cart_num', list.attrInfo.stock);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (list.cartNum >= list.stock) {
|
if (list.cartNum >= list.stock) {
|
||||||
that.$set(list, "cart_num", list.stock);
|
that.$set(list, 'cart_num', list.stock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
that.carnum();
|
that.carnum();
|
||||||
@ -410,15 +388,15 @@ export default {
|
|||||||
let list = that.cartList.valid[index];
|
let list = that.cartList.valid[index];
|
||||||
if (list.cartNum <= 1) {
|
if (list.cartNum <= 1) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: "已经是底线啦!",
|
title: '已经是底线啦!',
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
duration: 2000
|
duration: 2000
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
list.cartNum--;
|
list.cartNum--;
|
||||||
if (list.cartNum < 1) {
|
if (list.cartNum < 1) {
|
||||||
that.$set(list, "cart_num", 1);
|
that.$set(list, 'cart_num', 1);
|
||||||
}
|
}
|
||||||
that.carnum();
|
that.carnum();
|
||||||
that.countMoney();
|
that.countMoney();
|
||||||
@ -433,7 +411,7 @@ export default {
|
|||||||
.catch(error => {
|
.catch(error => {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: error.response.data.msg,
|
title: error.response.data.msg,
|
||||||
icon: "none",
|
icon: 'none',
|
||||||
duration: 2000
|
duration: 2000
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -458,8 +436,8 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
that.isAllSelect = selectnum.length === len;
|
that.isAllSelect = selectnum.length === len;
|
||||||
that.$set(that, "cartList", that.cartList);
|
that.$set(that, 'cartList', that.cartList);
|
||||||
that.$set(that, "isAllSelect", that.isAllSelect);
|
that.$set(that, 'isAllSelect', that.isAllSelect);
|
||||||
cookie.set(CHECKED_IDS, that.checkedIds);
|
cookie.set(CHECKED_IDS, that.checkedIds);
|
||||||
that.carnum();
|
that.carnum();
|
||||||
that.countMoney();
|
that.countMoney();
|
||||||
@ -485,8 +463,8 @@ export default {
|
|||||||
};
|
};
|
||||||
that.cartList = [];
|
that.cartList = [];
|
||||||
that.cartList = cartList;
|
that.cartList = cartList;
|
||||||
this.$set(this, "cartList", this.cartList);
|
this.$set(this, 'cartList', this.cartList);
|
||||||
this.$set(this, "isAllSelect", selectAllStatus);
|
this.$set(this, 'isAllSelect', selectAllStatus);
|
||||||
this.checkedIds = checkedIds;
|
this.checkedIds = checkedIds;
|
||||||
cookie.set(CHECKED_IDS, checkedIds);
|
cookie.set(CHECKED_IDS, checkedIds);
|
||||||
that.carnum();
|
that.carnum();
|
||||||
@ -503,7 +481,7 @@ export default {
|
|||||||
carnum += parseInt(array[i].cartNum);
|
carnum += parseInt(array[i].cartNum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
that.$set(that, "cartCount", carnum);
|
that.$set(that, 'cartCount', carnum);
|
||||||
},
|
},
|
||||||
//总共价钱;
|
//总共价钱;
|
||||||
countMoney: function() {
|
countMoney: function() {
|
||||||
|
@ -5,7 +5,9 @@ Vue.use(Vuex);
|
|||||||
const debug = process.env.NODE_ENV !== "production";
|
const debug = process.env.NODE_ENV !== "production";
|
||||||
|
|
||||||
import store from "@/utils/store/cookie";
|
import store from "@/utils/store/cookie";
|
||||||
import { getUserInfo } from "@/api/user";
|
import {
|
||||||
|
getUserInfo
|
||||||
|
} from "@/api/user";
|
||||||
import dialog from "@/utils/dialog";
|
import dialog from "@/utils/dialog";
|
||||||
|
|
||||||
const LOGIN_KEY = "login_status";
|
const LOGIN_KEY = "login_status";
|
||||||
@ -17,7 +19,8 @@ const vuexStore = new Vuex.Store({
|
|||||||
// 是否授权
|
// 是否授权
|
||||||
isAuthorization: false,
|
isAuthorization: false,
|
||||||
token: store.get(LOGIN_KEY) || null,
|
token: store.get(LOGIN_KEY) || null,
|
||||||
userInfo: store.get('userInfo')
|
userInfo: store.get('userInfo'),
|
||||||
|
$deviceType: null,
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
SHOW_FOOTER(state) {
|
SHOW_FOOTER(state) {
|
||||||
@ -63,9 +66,15 @@ const vuexStore = new Vuex.Store({
|
|||||||
UPDATE_AUTHORIZATION(state, isAuthorization) {
|
UPDATE_AUTHORIZATION(state, isAuthorization) {
|
||||||
state.isAuthorization = isAuthorization;
|
state.isAuthorization = isAuthorization;
|
||||||
},
|
},
|
||||||
|
UPDATE_DEVICETYPE(state, $deviceType) {
|
||||||
|
state.$deviceType = $deviceType;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
USERINFO({ state, commit }, force) {
|
USERINFO({
|
||||||
|
state,
|
||||||
|
commit
|
||||||
|
}, force) {
|
||||||
if (state.userInfo !== null && !force)
|
if (state.userInfo !== null && !force)
|
||||||
return Promise.resolve(state.userInfo);
|
return Promise.resolve(state.userInfo);
|
||||||
else
|
else
|
||||||
@ -78,10 +87,16 @@ const vuexStore = new Vuex.Store({
|
|||||||
dialog.error("获取信息失败!");
|
dialog.error("获取信息失败!");
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
changeLogin({ state, commit }, data, date) {
|
changeLogin({
|
||||||
|
state,
|
||||||
|
commit
|
||||||
|
}, data, date) {
|
||||||
commit("LOGIN", data, date);
|
commit("LOGIN", data, date);
|
||||||
},
|
},
|
||||||
setUserInfo({ state, commit }, user) {
|
setUserInfo({
|
||||||
|
state,
|
||||||
|
commit
|
||||||
|
}, user) {
|
||||||
commit("UPDATE_USERINFO", user);
|
commit("UPDATE_USERINFO", user);
|
||||||
if (user) {
|
if (user) {
|
||||||
store.set('userInfo', user)
|
store.set('userInfo', user)
|
||||||
@ -89,10 +104,16 @@ const vuexStore = new Vuex.Store({
|
|||||||
store.set('userInfo', null)
|
store.set('userInfo', null)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
changeAuthorizationPage({ state, commit }, index) {
|
changeAuthorizationPage({
|
||||||
|
state,
|
||||||
|
commit
|
||||||
|
}, index) {
|
||||||
commit("UPDATE_AUTHORIZATIONPAGE", index);
|
commit("UPDATE_AUTHORIZATIONPAGE", index);
|
||||||
},
|
},
|
||||||
changeAuthorization({ state, commit }, index) {
|
changeAuthorization({
|
||||||
|
state,
|
||||||
|
commit
|
||||||
|
}, index) {
|
||||||
commit("UPDATE_AUTHORIZATION", index);
|
commit("UPDATE_AUTHORIZATION", index);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -117,7 +117,6 @@ export const replaceLogin = (msg) => {
|
|||||||
icon: 'none',
|
icon: 'none',
|
||||||
duration: 2000
|
duration: 2000
|
||||||
});
|
});
|
||||||
console.log(Vue.prototype.$deviceType)
|
|
||||||
// 这里代表已经失去登录状态以及401强制推出登录了
|
// 这里代表已经失去登录状态以及401强制推出登录了
|
||||||
store.commit('LOGOUT')
|
store.commit('LOGOUT')
|
||||||
console.log(uni, 989)
|
console.log(uni, 989)
|
||||||
|
@ -45,7 +45,7 @@ function baseRequest(options) {
|
|||||||
...option
|
...option
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
console.log(res)
|
console.log(res)
|
||||||
console.log(url,params,data, ...option)
|
// console.log(url,params,data, ...option)
|
||||||
const data = res.data || {};
|
const data = res.data || {};
|
||||||
if (res.status !== 200)
|
if (res.status !== 200)
|
||||||
return Promise.reject({ msg: "请求失败", res, data });
|
return Promise.reject({ msg: "请求失败", res, data });
|
||||||
|
Reference in New Issue
Block a user