Merge branch 'master' of https://git.dayouqiantu.cn/uniapp/yshop-uniapp into dev
This commit is contained in:
@ -45,12 +45,12 @@
|
||||
<view class="tui-list__goods">
|
||||
<view class="tui-goods__left">
|
||||
<block v-for="(item, index) in seckillList" :key="index">
|
||||
<t-goods-item v-if="index % 2 == 0" :item="item" :isList="false" @goDetail="goDetail"></t-goods-item>
|
||||
<t-goods-item v-if="index % 2 == 0" :item="item" :timeList="timeList" :active="active" :isList="false" @goDetail="goDetail"></t-goods-item>
|
||||
</block>
|
||||
</view>
|
||||
<view class="tui-goods__right">
|
||||
<block v-for="(item, index) in seckillList" :key="index">
|
||||
<t-goods-item v-if="index % 2 !== 0" :item="item" :isList="false" @goDetail="goDetail"></t-goods-item>
|
||||
<t-goods-item v-if="index % 2 !== 0" :item="item" :timeList="timeList" :active="active" :isList="false" @goDetail="goDetail"></t-goods-item>
|
||||
</block>
|
||||
</view>
|
||||
</view>
|
||||
@ -189,7 +189,7 @@ export default {
|
||||
query: {
|
||||
id: item.id,
|
||||
time,
|
||||
status: item.status,
|
||||
status: that.timeList[that.active].status,
|
||||
},
|
||||
})
|
||||
},
|
||||
|
@ -1,448 +1,438 @@
|
||||
<template>
|
||||
<view class="index">
|
||||
<view v-for="(item,index) in homeData" :key="index">
|
||||
<view class="head_box" v-if="item.type=='header'" :style="{ background: bgcolor }" :class="{ active: bgcolor }">
|
||||
<cu-custom :isBack="true" :bgColor="bgcolor">
|
||||
<block slot="backText">
|
||||
<text class="nav-title shopro-selector-rect">{{ item.componentContent.title }}</text>
|
||||
</block>
|
||||
</cu-custom>
|
||||
</view>
|
||||
<view class="header header-search acea-row row-center-wrapper" v-if="item.type=='search'" :style="{ background: bgcolor }">
|
||||
<view @click="goGoodSearch()" class="search acea-row row-middle">
|
||||
<text class="iconfont icon-xiazai5"></text>
|
||||
搜索商品
|
||||
</view>
|
||||
<view class="qr" @click="startQr()">
|
||||
<image :src="`${$VUE_APP_RESOURCES_URL}/images/qr.png`" />
|
||||
</view>
|
||||
</view>
|
||||
<Banner v-if="item.type=='banner'" :detail="item.componentContent.bannerData" @getbgcolor="getbgcolor"></Banner>
|
||||
<uni-notice-bar v-if="item.type=='noticeBar'" scrollable="true" @click="goRoll(item.componentContent.roll[0])"
|
||||
single="true" :speed="10" showIcon="true" :text="item.componentContent.roll[0].info"></uni-notice-bar>
|
||||
<view class="content_box home_content_box" v-if="item.type=='menu'&&item.componentContent.menus">
|
||||
<!-- 菜单 -->
|
||||
<Menu :list="item.componentContent.menus" ></Menu>
|
||||
</view>
|
||||
<!-- 滚动新闻 -->
|
||||
<!-- 广告 -->
|
||||
<Adv v-if="item.type=='adv'&&item.componentContent.detail" :detail="item.componentContent.detail" />
|
||||
<!-- 热门榜单 -->
|
||||
<HotCommodity v-if="item.type=='hotCommodity'" :detail="likeInfo"></HotCommodity>
|
||||
<!-- 超值拼团 -->
|
||||
<Groupon v-if="item.type=='groupon'" :detail="combinationList" />
|
||||
<!-- 首发新品->秒杀 -->
|
||||
<FirstNewProduct v-if="item.type=='firstNewProduct'" :detail="firstList"></FirstNewProduct>
|
||||
<!-- 精品推荐 -->
|
||||
<ProductsRecommended v-if="item.type=='productsRecommended'" :detail="bastList"></ProductsRecommended>
|
||||
<!-- 促销单品 -->
|
||||
<PromoteProduct v-if="item.type=='promoteProduct'" :detail="benefit"></PromoteProduct>
|
||||
<!-- 直播 -->
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<Live v-if="item.type=='live'" :detail="live"></Live>
|
||||
<!-- #endif -->
|
||||
<!-- 为您推荐 -->
|
||||
<PromotionGood v-if="item.type=='promotionGood'" :benefit="benefit"></PromotionGood>
|
||||
<Coupon-window :coupon-list="couponList" v-if="showCoupon" @checked="couponClose" @close="couponClose">
|
||||
</Coupon-window>
|
||||
</view>
|
||||
</view>
|
||||
<view class="index">
|
||||
<view v-for="(item, index) in homeData" :key="index">
|
||||
<view class="head_box" v-if="item.type == 'header'" :style="{ background: bgcolor }" :class="{ active: bgcolor }">
|
||||
<cu-custom :isBack="true" :bgColor="bgcolor">
|
||||
<block slot="backText">
|
||||
<text class="nav-title shopro-selector-rect">{{ item.componentContent.title }}</text>
|
||||
</block>
|
||||
</cu-custom>
|
||||
</view>
|
||||
<view class="header header-search acea-row row-center-wrapper" v-if="item.type == 'search'" :style="{ background: bgcolor }">
|
||||
<view @click="goGoodSearch()" class="search acea-row row-middle">
|
||||
<text class="iconfont icon-xiazai5"></text>
|
||||
搜索商品
|
||||
</view>
|
||||
<!-- #ifndef H5 -->
|
||||
<view class="qr" @click="startQr()" v-if="$deviceType !== 'weixin'">
|
||||
<image :src="`${$VUE_APP_RESOURCES_URL}/images/qr.png`" />
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
<Banner v-if="item.type == 'banner'" :detail="item.componentContent.bannerData" @getbgcolor="getbgcolor"></Banner>
|
||||
<uni-notice-bar v-if="item.type == 'noticeBar'" scrollable="true" @click="goRoll(item.componentContent.roll[0])" single="true" :speed="10" showIcon="true" :text="item.componentContent.roll[0].info"></uni-notice-bar>
|
||||
<view class="content_box home_content_box" v-if="item.type == 'menu' && item.componentContent.menus">
|
||||
<!-- 菜单 -->
|
||||
<Menu :list="item.componentContent.menus"></Menu>
|
||||
</view>
|
||||
<!-- 滚动新闻 -->
|
||||
<!-- 广告 -->
|
||||
<Adv v-if="item.type == 'adv' && item.componentContent.detail" :detail="item.componentContent.detail" />
|
||||
<!-- 热门榜单 -->
|
||||
<HotCommodity v-if="item.type == 'hotCommodity'" :detail="likeInfo"></HotCommodity>
|
||||
<!-- 超值拼团 -->
|
||||
<Groupon v-if="item.type == 'groupon'" :detail="combinationList" />
|
||||
<!-- 首发新品->秒杀 -->
|
||||
<FirstNewProduct v-if="item.type == 'firstNewProduct'" :detail="firstList"></FirstNewProduct>
|
||||
<!-- 精品推荐 -->
|
||||
<ProductsRecommended v-if="item.type == 'productsRecommended'" :detail="bastList"></ProductsRecommended>
|
||||
<!-- 促销单品 -->
|
||||
<PromoteProduct v-if="item.type == 'promoteProduct'" :detail="benefit"></PromoteProduct>
|
||||
<!-- 直播 -->
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<Live v-if="item.type == 'live'" :detail="live"></Live>
|
||||
<!-- #endif -->
|
||||
<!-- 为您推荐 -->
|
||||
<PromotionGood v-if="item.type == 'promotionGood'" :benefit="benefit"></PromotionGood>
|
||||
<Coupon-window :coupon-list="couponList" v-if="showCoupon" @checked="couponClose" @close="couponClose"> </Coupon-window>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import {
|
||||
mapState,
|
||||
mapMutations,
|
||||
mapActions
|
||||
} from "vuex";
|
||||
import GoodList from "@/components/GoodList";
|
||||
import PromotionGood from "@/components/PromotionGood";
|
||||
import CouponWindow from "@/components/CouponWindow";
|
||||
import Menu from "@/components/Menu";
|
||||
import UniNoticeBar from "@/components/uni-notice-bar/uni-notice-bar";
|
||||
import Adv from "@/components/sh-adv";
|
||||
import Groupon from "@/components/sh-groupon.vue";
|
||||
import { mapState, mapMutations, mapActions } from 'vuex'
|
||||
import GoodList from '@/components/GoodList'
|
||||
import PromotionGood from '@/components/PromotionGood'
|
||||
import CouponWindow from '@/components/CouponWindow'
|
||||
import Menu from '@/components/Menu'
|
||||
import UniNoticeBar from '@/components/uni-notice-bar/uni-notice-bar'
|
||||
import Adv from '@/components/sh-adv'
|
||||
import Groupon from '@/components/sh-groupon.vue'
|
||||
|
||||
import Banner from "./components/Banner";
|
||||
import HotCommodity from "./components/HotCommodity";
|
||||
import FirstNewProduct from "./components/FirstNewProduct";
|
||||
import ProductsRecommended from "./components/ProductsRecommended";
|
||||
import Live from "./components/Live";
|
||||
import Banner from './components/Banner'
|
||||
import HotCommodity from './components/HotCommodity'
|
||||
import FirstNewProduct from './components/FirstNewProduct'
|
||||
import ProductsRecommended from './components/ProductsRecommended'
|
||||
import Live from './components/Live'
|
||||
|
||||
import {
|
||||
getHomeData,
|
||||
getShare,
|
||||
getCanvas
|
||||
} from "@/api/public";
|
||||
import cookie from "@/utils/store/cookie";
|
||||
import {
|
||||
isWeixin,
|
||||
handleUrlParam
|
||||
} from "@/utils/index";
|
||||
import { getHomeData, getShare, getCanvas } from '@/api/public'
|
||||
import cookie from '@/utils/store/cookie'
|
||||
import { isWeixin, handleUrlParam } from '@/utils/index'
|
||||
|
||||
import {
|
||||
openShareAll,
|
||||
} from '@/libs/wechat'
|
||||
import { openShareAll } from '@/libs/wechat'
|
||||
|
||||
const HAS_COUPON_WINDOW = "has_coupon_window";
|
||||
const HAS_COUPON_WINDOW = 'has_coupon_window'
|
||||
|
||||
export default {
|
||||
name: "Index",
|
||||
components: {
|
||||
// swiper,
|
||||
// swiperSlide,
|
||||
UniNoticeBar,
|
||||
GoodList,
|
||||
PromotionGood,
|
||||
CouponWindow,
|
||||
Menu,
|
||||
Adv,
|
||||
Groupon,
|
||||
Banner,
|
||||
HotCommodity,
|
||||
FirstNewProduct,
|
||||
ProductsRecommended,
|
||||
Live,
|
||||
},
|
||||
props: {},
|
||||
data: function() {
|
||||
return {
|
||||
homeData: [],
|
||||
CustomBar: this.CustomBar,
|
||||
StatusBar: this.StatusBar,
|
||||
formatMenus: [],
|
||||
categoryCurrent: 0,
|
||||
menuNum: 4,
|
||||
bgcolor: "",
|
||||
bgColor: "",
|
||||
swiperCurrent: 0, //轮播下标
|
||||
webviewId: 0,
|
||||
showCoupon: false,
|
||||
logoUrl: "",
|
||||
banner: [],
|
||||
menus: [],
|
||||
combinationList: [],
|
||||
roll: [],
|
||||
activity: [],
|
||||
activityOne: {},
|
||||
bastList: [],
|
||||
firstList: [],
|
||||
info: {
|
||||
fastList: [],
|
||||
bastBanner: [],
|
||||
export default {
|
||||
name: 'Index',
|
||||
components: {
|
||||
// swiper,
|
||||
// swiperSlide,
|
||||
UniNoticeBar,
|
||||
GoodList,
|
||||
PromotionGood,
|
||||
CouponWindow,
|
||||
Menu,
|
||||
Adv,
|
||||
Groupon,
|
||||
Banner,
|
||||
HotCommodity,
|
||||
FirstNewProduct,
|
||||
ProductsRecommended,
|
||||
Live,
|
||||
},
|
||||
props: {},
|
||||
data: function() {
|
||||
return {
|
||||
homeData: [],
|
||||
CustomBar: this.CustomBar,
|
||||
StatusBar: this.StatusBar,
|
||||
formatMenus: [],
|
||||
categoryCurrent: 0,
|
||||
menuNum: 4,
|
||||
bgcolor: '',
|
||||
bgColor: '',
|
||||
swiperCurrent: 0, //轮播下标
|
||||
webviewId: 0,
|
||||
showCoupon: false,
|
||||
logoUrl: '',
|
||||
banner: [],
|
||||
menus: [],
|
||||
combinationList: [],
|
||||
roll: [],
|
||||
activity: [],
|
||||
activityOne: {},
|
||||
bastList: [],
|
||||
firstList: [],
|
||||
info: {
|
||||
fastList: [],
|
||||
bastBanner: [],
|
||||
|
||||
bastList: [],
|
||||
},
|
||||
likeInfo: [],
|
||||
live: [],
|
||||
lovely: [],
|
||||
benefit: [],
|
||||
couponList: [],
|
||||
swiperOption: {
|
||||
pagination: {
|
||||
el: ".swiper-pagination",
|
||||
clickable: true,
|
||||
},
|
||||
autoplay: {
|
||||
disableOnInteraction: false,
|
||||
delay: 2000,
|
||||
},
|
||||
loop: true,
|
||||
speed: 1000,
|
||||
observer: true,
|
||||
observeParents: true,
|
||||
},
|
||||
swiperRoll: {
|
||||
direction: "vertical",
|
||||
autoplay: {
|
||||
disableOnInteraction: false,
|
||||
delay: 2000,
|
||||
},
|
||||
loop: true,
|
||||
speed: 1000,
|
||||
observer: true,
|
||||
observeParents: true,
|
||||
},
|
||||
swiperScroll: {
|
||||
freeMode: true,
|
||||
freeModeMomentum: false,
|
||||
slidesPerView: "auto",
|
||||
observer: true,
|
||||
observeParents: true,
|
||||
},
|
||||
swiperBoutique: {
|
||||
pagination: {
|
||||
el: ".swiper-pagination",
|
||||
clickable: true,
|
||||
},
|
||||
autoplay: {
|
||||
disableOnInteraction: false,
|
||||
delay: 2000,
|
||||
},
|
||||
loop: true,
|
||||
speed: 1000,
|
||||
observer: true,
|
||||
observeParents: true,
|
||||
},
|
||||
swiperProducts: {
|
||||
freeMode: true,
|
||||
freeModeMomentum: false,
|
||||
slidesPerView: "auto",
|
||||
observer: true,
|
||||
observeParents: true,
|
||||
},
|
||||
bgImage: "",
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
singNew() {
|
||||
return this.roll.length > 0 ? this.roll[0] : "你还没添加通知哦!";
|
||||
},
|
||||
customStyle() {
|
||||
var bgImage = this.bgImage;
|
||||
// var style = `height:${this.CustomBar}px;padding-top:${0}px;background: ${this.bgcolor}`;
|
||||
var style = `height:${this.CustomBar}px;padding-top:${this.StatusBar}px;background: ${this.bgcolor}`;
|
||||
if (this.bgImage) {
|
||||
style = `${style}background-image:url(${bgImage});`;
|
||||
}
|
||||
return style;
|
||||
},
|
||||
},
|
||||
onLoad: function() {
|
||||
this.getLocation();
|
||||
let that = this;
|
||||
// uni.showLoading({
|
||||
// title: "加载中",
|
||||
// });
|
||||
getCanvas().then(res => {}).catch(error => {
|
||||
this.homeData = JSON.parse(error.data.json)
|
||||
console.log(this.homeData)
|
||||
console.log(222)
|
||||
})
|
||||
getHomeData().then((res) => {
|
||||
that.logoUrl = res.data.logoUrl;
|
||||
res.data.banner.map((item) => (item.bgcolor = item.color || ""));
|
||||
that.$set(that, "info", res.data.info);
|
||||
that.$set(that, "firstList", res.data.firstList);
|
||||
that.$set(that, "bastList", res.data.bastList);
|
||||
that.$set(that, "likeInfo", res.data.likeInfo);
|
||||
that.$set(that, "live", res.data.liveList);
|
||||
that.$set(that, "lovely", res.data.lovely);
|
||||
that.$set(that, "benefit", res.data.benefit);
|
||||
that.$set(that, "couponList", res.data.couponList);
|
||||
that.$set(that, "combinationList", res.data.combinationList);
|
||||
uni.hideLoading();
|
||||
that.setOpenShare();
|
||||
// that.doColorThief()
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
...mapActions(["getLocation"]),
|
||||
onShareTimeline: function() {
|
||||
return {
|
||||
title: this.miniHomeRemark,
|
||||
imageUrl: this.miniHomeImg,
|
||||
path: "pages/home/index?spread=" + uni.getStorageSync("uid"),
|
||||
};
|
||||
},
|
||||
onShareAppMessage: function() {
|
||||
return {
|
||||
title: this.miniHomeRemark,
|
||||
imageUrl: this.miniHomeImg,
|
||||
path: "pages/home/index?spread=" + uni.getStorageSync("uid"),
|
||||
};
|
||||
},
|
||||
goRoll(item) {
|
||||
if (item.uniapp_url) {
|
||||
this.$yrouter.push(item.uniapp_url);
|
||||
}
|
||||
},
|
||||
goGoodSearch() {
|
||||
// this.$yrouter.push('/pages/shop/GoodsEvaluate/index');
|
||||
this.$yrouter.push("/pages/shop/GoodSearch/index");
|
||||
},
|
||||
goWxappUrl(item) {
|
||||
this.$yrouter.push(item.uniapp_url);
|
||||
},
|
||||
goHotNewGoods(type) {
|
||||
this.$yrouter.push({
|
||||
path: "/pages/shop/HotNewGoods/index",
|
||||
query: {
|
||||
type,
|
||||
},
|
||||
});
|
||||
},
|
||||
goGoodsCon(item) {
|
||||
this.$yrouter.push({
|
||||
path: "/pages/shop/GoodsCon/index",
|
||||
query: {
|
||||
id: item.id,
|
||||
},
|
||||
});
|
||||
},
|
||||
goGoodsPromotion() {
|
||||
this.$yrouter.push("/pages/shop/GoodsPromotion/index");
|
||||
},
|
||||
setOpenShare: function() {
|
||||
if (this.$deviceType == "weixin") {
|
||||
getShare().then((res) => {
|
||||
var data = res.data.data;
|
||||
var configAppMessage = {
|
||||
desc: data.synopsis,
|
||||
title: data.title,
|
||||
link: location.href,
|
||||
imgUrl: data.img,
|
||||
};
|
||||
openShareAll(configAppMessage);
|
||||
});
|
||||
}
|
||||
},
|
||||
startQr: function() {
|
||||
uni.scanCode({
|
||||
success: (res) => {
|
||||
let option = handleUrlParam(res.result);
|
||||
switch (option.pageType) {
|
||||
case "good":
|
||||
// 跳转商品详情
|
||||
this.$yrouter.push({
|
||||
path: "/pages/shop/GoodsCon/index",
|
||||
query: {
|
||||
q: res.result,
|
||||
},
|
||||
});
|
||||
break;
|
||||
case "group":
|
||||
// 跳转团购
|
||||
this.$yrouter.push({
|
||||
path: "/pages/activity/GroupRule/index",
|
||||
query: {
|
||||
q: res.result,
|
||||
},
|
||||
});
|
||||
break;
|
||||
case "dargain":
|
||||
// 跳转砍价
|
||||
this.$yrouter.push({
|
||||
path: "/pages/activity/DargainDetails/index",
|
||||
query: {
|
||||
q: res.result,
|
||||
},
|
||||
});
|
||||
break;
|
||||
default:
|
||||
// 跳转分销
|
||||
this.$yrouter.push({
|
||||
path: "/pages/Loading/index",
|
||||
query: {},
|
||||
});
|
||||
break;
|
||||
}
|
||||
},
|
||||
});
|
||||
},
|
||||
getbgcolor(e) {
|
||||
this.bgcolor = e;
|
||||
},
|
||||
},
|
||||
created: async function() {
|
||||
// await this.doColorThief();
|
||||
},
|
||||
};
|
||||
bastList: [],
|
||||
},
|
||||
likeInfo: [],
|
||||
live: [],
|
||||
lovely: [],
|
||||
benefit: [],
|
||||
couponList: [],
|
||||
swiperOption: {
|
||||
pagination: {
|
||||
el: '.swiper-pagination',
|
||||
clickable: true,
|
||||
},
|
||||
autoplay: {
|
||||
disableOnInteraction: false,
|
||||
delay: 2000,
|
||||
},
|
||||
loop: true,
|
||||
speed: 1000,
|
||||
observer: true,
|
||||
observeParents: true,
|
||||
},
|
||||
swiperRoll: {
|
||||
direction: 'vertical',
|
||||
autoplay: {
|
||||
disableOnInteraction: false,
|
||||
delay: 2000,
|
||||
},
|
||||
loop: true,
|
||||
speed: 1000,
|
||||
observer: true,
|
||||
observeParents: true,
|
||||
},
|
||||
swiperScroll: {
|
||||
freeMode: true,
|
||||
freeModeMomentum: false,
|
||||
slidesPerView: 'auto',
|
||||
observer: true,
|
||||
observeParents: true,
|
||||
},
|
||||
swiperBoutique: {
|
||||
pagination: {
|
||||
el: '.swiper-pagination',
|
||||
clickable: true,
|
||||
},
|
||||
autoplay: {
|
||||
disableOnInteraction: false,
|
||||
delay: 2000,
|
||||
},
|
||||
loop: true,
|
||||
speed: 1000,
|
||||
observer: true,
|
||||
observeParents: true,
|
||||
},
|
||||
swiperProducts: {
|
||||
freeMode: true,
|
||||
freeModeMomentum: false,
|
||||
slidesPerView: 'auto',
|
||||
observer: true,
|
||||
observeParents: true,
|
||||
},
|
||||
bgImage: '',
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
singNew() {
|
||||
return this.roll.length > 0 ? this.roll[0] : '你还没添加通知哦!'
|
||||
},
|
||||
customStyle() {
|
||||
var bgImage = this.bgImage
|
||||
// var style = `height:${this.CustomBar}px;padding-top:${0}px;background: ${this.bgcolor}`;
|
||||
var style = `height:${this.CustomBar}px;padding-top:${this.StatusBar}px;background: ${this.bgcolor}`
|
||||
if (this.bgImage) {
|
||||
style = `${style}background-image:url(${bgImage});`
|
||||
}
|
||||
return style
|
||||
},
|
||||
},
|
||||
onLoad: function() {
|
||||
this.getLocation()
|
||||
let that = this
|
||||
// uni.showLoading({
|
||||
// title: "加载中",
|
||||
// });
|
||||
getCanvas()
|
||||
.then(res => {})
|
||||
.catch(error => {
|
||||
this.homeData = JSON.parse(error.data.json)
|
||||
console.log(this.homeData)
|
||||
console.log(222)
|
||||
})
|
||||
getHomeData().then(res => {
|
||||
that.logoUrl = res.data.logoUrl
|
||||
res.data.banner.map(item => (item.bgcolor = item.color || ''))
|
||||
that.$set(that, 'info', res.data.info)
|
||||
that.$set(that, 'firstList', res.data.firstList)
|
||||
that.$set(that, 'bastList', res.data.bastList)
|
||||
that.$set(that, 'likeInfo', res.data.likeInfo)
|
||||
that.$set(that, 'live', res.data.liveList)
|
||||
that.$set(that, 'lovely', res.data.lovely)
|
||||
that.$set(that, 'benefit', res.data.benefit)
|
||||
that.$set(that, 'couponList', res.data.couponList)
|
||||
that.$set(that, 'combinationList', res.data.combinationList)
|
||||
uni.hideLoading()
|
||||
that.setOpenShare()
|
||||
// that.doColorThief()
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
...mapActions(['getLocation']),
|
||||
onShareTimeline: function() {
|
||||
return {
|
||||
title: this.miniHomeRemark,
|
||||
imageUrl: this.miniHomeImg,
|
||||
path: 'pages/home/index?spread=' + uni.getStorageSync('uid'),
|
||||
}
|
||||
},
|
||||
onShareAppMessage: function() {
|
||||
return {
|
||||
title: this.miniHomeRemark,
|
||||
imageUrl: this.miniHomeImg,
|
||||
path: 'pages/home/index?spread=' + uni.getStorageSync('uid'),
|
||||
}
|
||||
},
|
||||
goRoll(item) {
|
||||
if (item.uniapp_url) {
|
||||
this.$yrouter.push(item.uniapp_url)
|
||||
}
|
||||
},
|
||||
goGoodSearch() {
|
||||
// this.$yrouter.push('/pages/shop/GoodsEvaluate/index');
|
||||
this.$yrouter.push('/pages/shop/GoodSearch/index')
|
||||
},
|
||||
goWxappUrl(item) {
|
||||
this.$yrouter.push(item.uniapp_url)
|
||||
},
|
||||
goHotNewGoods(type) {
|
||||
this.$yrouter.push({
|
||||
path: '/pages/shop/HotNewGoods/index',
|
||||
query: {
|
||||
type,
|
||||
},
|
||||
})
|
||||
},
|
||||
goGoodsCon(item) {
|
||||
this.$yrouter.push({
|
||||
path: '/pages/shop/GoodsCon/index',
|
||||
query: {
|
||||
id: item.id,
|
||||
},
|
||||
})
|
||||
},
|
||||
goGoodsPromotion() {
|
||||
this.$yrouter.push('/pages/shop/GoodsPromotion/index')
|
||||
},
|
||||
setOpenShare: function() {
|
||||
if (this.$deviceType == 'weixin') {
|
||||
getShare().then(res => {
|
||||
var data = res.data.data
|
||||
var configAppMessage = {
|
||||
desc: data.synopsis,
|
||||
title: data.title,
|
||||
link: location.href,
|
||||
imgUrl: data.img,
|
||||
}
|
||||
openShareAll(configAppMessage)
|
||||
})
|
||||
}
|
||||
},
|
||||
startQr: function() {
|
||||
uni.scanCode({
|
||||
success: res => {
|
||||
let option = handleUrlParam(res.result)
|
||||
switch (option.pageType) {
|
||||
case 'good':
|
||||
// 跳转商品详情
|
||||
this.$yrouter.push({
|
||||
path: '/pages/shop/GoodsCon/index',
|
||||
query: {
|
||||
q: res.result,
|
||||
},
|
||||
})
|
||||
break
|
||||
case 'group':
|
||||
// 跳转团购
|
||||
this.$yrouter.push({
|
||||
path: '/pages/activity/GroupRule/index',
|
||||
query: {
|
||||
q: res.result,
|
||||
},
|
||||
})
|
||||
break
|
||||
case 'dargain':
|
||||
// 跳转砍价
|
||||
this.$yrouter.push({
|
||||
path: '/pages/activity/DargainDetails/index',
|
||||
query: {
|
||||
q: res.result,
|
||||
},
|
||||
})
|
||||
break
|
||||
default:
|
||||
// 跳转分销
|
||||
this.$yrouter.push({
|
||||
path: '/pages/Loading/index',
|
||||
query: {},
|
||||
})
|
||||
break
|
||||
}
|
||||
},
|
||||
})
|
||||
},
|
||||
getbgcolor(e) {
|
||||
this.bgcolor = e
|
||||
},
|
||||
},
|
||||
created: async function() {
|
||||
// await this.doColorThief();
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style scoped lang="less">
|
||||
.content_box {
|
||||
background: #f6f6f6;
|
||||
}
|
||||
.content_box {
|
||||
background: #f6f6f6;
|
||||
}
|
||||
|
||||
.index {
|
||||
background-color: #f6f6f6;
|
||||
}
|
||||
.index {
|
||||
background-color: #f6f6f6;
|
||||
}
|
||||
|
||||
.swiper-item {
|
||||
height: 100%;
|
||||
}
|
||||
.swiper-item {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.fixed-header {
|
||||
position: fixed;
|
||||
z-index: 99;
|
||||
// #ifdef H5
|
||||
top: 88rpx;
|
||||
// #endif
|
||||
.fixed-header {
|
||||
position: fixed;
|
||||
z-index: 99;
|
||||
// #ifdef H5
|
||||
top: 88rpx;
|
||||
// #endif
|
||||
|
||||
// #ifndef H5
|
||||
top: 0;
|
||||
// #endif
|
||||
left: 0;
|
||||
right: 0;
|
||||
background: #fff;
|
||||
box-shadow: 0 0 20rpx -10rpx #aaa;
|
||||
// #ifndef H5
|
||||
top: 0;
|
||||
// #endif
|
||||
left: 0;
|
||||
right: 0;
|
||||
background: #fff;
|
||||
box-shadow: 0 0 20rpx -10rpx #aaa;
|
||||
|
||||
&+.fixed-header-box {
|
||||
height: 98rpx;
|
||||
}
|
||||
}
|
||||
& + .fixed-header-box {
|
||||
height: 98rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.head_box {
|
||||
width: 750rpx;
|
||||
// background: #fff;
|
||||
transition: all linear 0.3s;
|
||||
.head_box {
|
||||
width: 750rpx;
|
||||
// background: #fff;
|
||||
transition: all linear 0.3s;
|
||||
|
||||
/deep/.cuIcon-back {
|
||||
display: none;
|
||||
}
|
||||
/deep/.cuIcon-back {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.nav-title {
|
||||
font-size: 38rpx;
|
||||
font-family: PingFang SC;
|
||||
font-weight: 500;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
.nav-title {
|
||||
font-size: 38rpx;
|
||||
font-family: PingFang SC;
|
||||
font-weight: 500;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.cu-bar.fixed {
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
top: 0;
|
||||
z-index: 1024;
|
||||
// box-shadow: 0 1upx 6upx rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
.cu-bar.fixed {
|
||||
position: fixed;
|
||||
width: 100%;
|
||||
top: 0;
|
||||
z-index: 1024;
|
||||
// box-shadow: 0 1upx 6upx rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.cu-bar {
|
||||
box-sizing: border-box;
|
||||
.cu-bar {
|
||||
box-sizing: border-box;
|
||||
|
||||
.index .header {
|
||||
height: 64rpx;
|
||||
// width: 100%;
|
||||
// padding: 0 30rpx;
|
||||
// box-sizing: border-box;
|
||||
}
|
||||
}
|
||||
.index .header {
|
||||
height: 64rpx;
|
||||
// width: 100%;
|
||||
// padding: 0 30rpx;
|
||||
// box-sizing: border-box;
|
||||
}
|
||||
}
|
||||
|
||||
.header-search {
|
||||
transition: all linear 0.3s;
|
||||
}
|
||||
.header-search {
|
||||
transition: all linear 0.3s;
|
||||
}
|
||||
|
||||
.cu-bar .action {
|
||||
display: -webkit-box;
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
max-height: 100%;
|
||||
.cu-bar .action {
|
||||
display: -webkit-box;
|
||||
display: -webkit-flex;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 100%;
|
||||
max-height: 100%;
|
||||
|
||||
&:first-child {
|
||||
margin-left: 15px;
|
||||
font-size: 15px;
|
||||
}
|
||||
}
|
||||
&:first-child {
|
||||
margin-left: 15px;
|
||||
font-size: 15px;
|
||||
}
|
||||
}
|
||||
|
||||
.home_content_box {
|
||||
margin-top: -20rpx;
|
||||
}
|
||||
.home_content_box {
|
||||
margin-top: -20rpx;
|
||||
}
|
||||
|
||||
.head_box {}
|
||||
.head_box {
|
||||
}
|
||||
|
||||
.nav-title {
|
||||
margin-left: 20rpx;
|
||||
line-height: 40px;
|
||||
}
|
||||
.nav-title {
|
||||
margin-left: 20rpx;
|
||||
line-height: 40px;
|
||||
}
|
||||
</style>
|
||||
|
@ -4,7 +4,7 @@
|
||||
<view class="picTxt acea-row row-between-wrapper">
|
||||
<view class="text">
|
||||
<view class="name">订单信息</view>
|
||||
<view>累计订单:{{ orderData.orderCount || 0 }} 总消费:¥{{orderData.sumPrice || 0 }}</view>
|
||||
<view>累计订单:{{ orderData.orderCount || 0 }} 总消费:¥{{ orderData.sumPrice || 0 }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -31,13 +31,10 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="list">
|
||||
<view class="item" v-for="(order,orderListIndex) in orderList" :key="orderListIndex">
|
||||
<view class="item" v-for="(order, orderListIndex) in orderList" :key="orderListIndex">
|
||||
<view class="title acea-row row-between-wrapper">
|
||||
<view class="acea-row row-middle">
|
||||
<span
|
||||
class="sign cart-color acea-row row-center-wrapper"
|
||||
v-if="order.combinationId > 0"
|
||||
>拼团</span>
|
||||
<span class="sign cart-color acea-row row-center-wrapper" v-if="order.combinationId > 0">拼团</span>
|
||||
<span class="sign cart-color acea-row row-center-wrapper" v-if="order.seckillId > 0">秒杀</span>
|
||||
<span class="sign cart-color acea-row row-center-wrapper" v-if="order.bargainId > 0">砍价</span>
|
||||
<span class="sign cart-color acea-row row-center-wrapper" v-if="order.storeId > 0">门店</span>
|
||||
@ -46,24 +43,15 @@
|
||||
<view class="font-color-red">{{ getStatus(order) }}</view>
|
||||
</view>
|
||||
<view @click="goOrderDetails(order)">
|
||||
<view
|
||||
class="item-info acea-row row-between row-top"
|
||||
v-for="(cart,cartInfoIndex) in order.cartInfo"
|
||||
:key="cartInfoIndex"
|
||||
>
|
||||
<view class="item-info acea-row row-between row-top" v-for="(cart, cartInfoIndex) in order.cartInfo" :key="cartInfoIndex">
|
||||
<view class="pictrue">
|
||||
<image
|
||||
:src="cart.productInfo.image"
|
||||
@click.stop="
|
||||
$yrouter.push({ path: '/pages/shop/GoodsCon/index',query:{id:cart.productInfo.id} })
|
||||
"
|
||||
v-if="cart.combinationId === 0 && cart.bargainId === 0 &&cart.seckillId === 0"
|
||||
/>
|
||||
<image :src="cart.productInfo.image" @click.stop="$yrouter.push({ path: '/pages/shop/GoodsCon/index', query: { id: cart.productInfo.id } })" v-if="cart.combinationId === 0 && cart.bargainId === 0 && cart.seckillId === 0" />
|
||||
<image
|
||||
:src="cart.productInfo.image"
|
||||
@click.stop="
|
||||
$yrouter.push({
|
||||
path: '/pages/activity/GroupDetails/index',query:{id:cart.combinationId}
|
||||
path: '/pages/activity/GroupDetails/index',
|
||||
query: { id: cart.combinationId },
|
||||
})
|
||||
"
|
||||
v-else-if="cart.combinationId > 0"
|
||||
@ -72,7 +60,8 @@
|
||||
:src="cart.productInfo.image"
|
||||
@click.stop="
|
||||
$yrouter.push({
|
||||
path: '/pages/activity/DargainDetails/index',query:{id:cart.bargainId}
|
||||
path: '/pages/activity/DargainDetails/index',
|
||||
query: { id: cart.bargainId },
|
||||
})
|
||||
"
|
||||
v-else-if="cart.bargainId > 0"
|
||||
@ -81,7 +70,8 @@
|
||||
:src="cart.productInfo.image"
|
||||
@click.stop="
|
||||
$yrouter.push({
|
||||
path: '/pages/activity/SeckillDetails/index',query:{id:cart.seckillId}
|
||||
path: '/pages/activity/SeckillDetails/index',
|
||||
query: { id: cart.seckillId },
|
||||
})
|
||||
"
|
||||
v-else-if="cart.seckillId > 0"
|
||||
@ -90,16 +80,8 @@
|
||||
<view class="text acea-row row-between">
|
||||
<view class="name line2">{{ cart.productInfo.storeName }}</view>
|
||||
<view class="money">
|
||||
<view v-if="order.payType!='integral'">
|
||||
¥{{
|
||||
cart.productInfo.attrInfo
|
||||
? cart.productInfo.attrInfo.price
|
||||
: cart.productInfo.price
|
||||
}}
|
||||
</view>
|
||||
<view v-if="order.payType=='integral'">
|
||||
{{order.payIntegral}}积分
|
||||
</view>
|
||||
<view v-if="order.payType != 'integral'"> ¥{{ cart.productInfo.attrInfo ? cart.productInfo.attrInfo.price : cart.productInfo.price }} </view>
|
||||
<view v-if="order.payType == 'integral'"> {{ order.payIntegral }}积分 </view>
|
||||
<view>x{{ cart.cartNum }}</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -107,8 +89,8 @@
|
||||
</view>
|
||||
<view class="totalPrice">
|
||||
共{{ order.cartInfo.length || 0 }}件商品,总金额
|
||||
<text class="money font-color-red" v-if="order.payType!='integral'">¥{{ order.payPrice }}</text>
|
||||
<text class="money font-color-red" v-if="order.payType=='integral'">{{order.payIntegral}}积分</text>
|
||||
<text class="money font-color-red" v-if="order.payType != 'integral'">¥{{ order.payPrice }}</text>
|
||||
<text class="money font-color-red" v-if="order.payType == 'integral'">{{ order.payIntegral }}积分</text>
|
||||
</view>
|
||||
<view class="bottom acea-row row-right row-middle">
|
||||
<template v-if="order._status._type == 0">
|
||||
@ -150,32 +132,17 @@
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import { getOrderData, getOrderList } from "@/api/order";
|
||||
import {
|
||||
cancelOrderHandle,
|
||||
payOrderHandle,
|
||||
takeOrderHandle
|
||||
} from "@/libs/order";
|
||||
import Loading from "@/components/Loading";
|
||||
import Payment from "@/components/Payment";
|
||||
import DataFormat from "@/components/DataFormat";
|
||||
import { mapGetters } from "vuex";
|
||||
import { isWeixin, dataFormat } from "@/utils";
|
||||
import { getOrderData, getOrderList } from '@/api/order'
|
||||
import { cancelOrderHandle, payOrderHandle, takeOrderHandle } from '@/libs/order'
|
||||
import Loading from '@/components/Loading'
|
||||
import Payment from '@/components/Payment'
|
||||
import DataFormat from '@/components/DataFormat'
|
||||
import { mapGetters } from 'vuex'
|
||||
import { isWeixin, dataFormat } from '@/utils'
|
||||
|
||||
const STATUS = [
|
||||
"待付款",
|
||||
"待发货",
|
||||
"待收货",
|
||||
"待评价",
|
||||
"已完成",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"待付款"
|
||||
];
|
||||
const STATUS = ['待付款', '待发货', '待收货', '待评价', '已完成', '', '', '', '', '待付款']
|
||||
|
||||
const NAME = "MyOrder";
|
||||
const NAME = 'MyOrder'
|
||||
|
||||
export default {
|
||||
name: NAME,
|
||||
@ -183,139 +150,137 @@ export default {
|
||||
return {
|
||||
offlinePayStatus: 2,
|
||||
orderData: {},
|
||||
type: "",
|
||||
type: '',
|
||||
page: 1,
|
||||
limit: 20,
|
||||
loaded: false,
|
||||
loading: false,
|
||||
orderList: [],
|
||||
pay: false,
|
||||
payType: ["yue", "weixin"],
|
||||
from: this.$deviceType
|
||||
};
|
||||
payType: ['yue', 'weixin'],
|
||||
from: this.$deviceType,
|
||||
}
|
||||
},
|
||||
components: {
|
||||
Loading,
|
||||
Payment,
|
||||
DataFormat
|
||||
DataFormat,
|
||||
},
|
||||
computed: mapGetters(["userInfo"]),
|
||||
computed: mapGetters(['userInfo']),
|
||||
onShow: function() {
|
||||
console.log(this);
|
||||
this.type = parseInt(this.$yroute.query.type) || 0;
|
||||
this.changeType(this.type);
|
||||
this.getOrderData();
|
||||
this.getOrderList();
|
||||
console.log(this)
|
||||
this.type = parseInt(this.$yroute.query.type) || 0
|
||||
this.changeType(this.type)
|
||||
this.getOrderData()
|
||||
this.getOrderList()
|
||||
},
|
||||
onHide: function() {
|
||||
this.orderList = [];
|
||||
this.page = 1;
|
||||
this.limit = 20;
|
||||
this.loaded = false;
|
||||
this.loading = false;
|
||||
this.orderList = []
|
||||
this.page = 1
|
||||
this.limit = 20
|
||||
this.loaded = false
|
||||
this.loading = false
|
||||
},
|
||||
methods: {
|
||||
goLogistics(order) {
|
||||
this.$yrouter.push({
|
||||
path: "/pages/order/Logistics/index",
|
||||
query: { id: order.orderId }
|
||||
});
|
||||
path: '/pages/order/Logistics/index',
|
||||
query: { id: order.orderId },
|
||||
})
|
||||
},
|
||||
goOrderDetails(order) {
|
||||
this.$yrouter.push({
|
||||
path: "/pages/order/OrderDetails/index",
|
||||
query: { id: order.orderId }
|
||||
});
|
||||
path: '/pages/order/OrderDetails/index',
|
||||
query: { id: order.orderId },
|
||||
})
|
||||
},
|
||||
dataFormat,
|
||||
setOfflinePayStatus: function(status) {
|
||||
var that = this;
|
||||
that.offlinePayStatus = status;
|
||||
var that = this
|
||||
that.offlinePayStatus = status
|
||||
if (status === 1) {
|
||||
if (that.payType.indexOf("offline") < 0) {
|
||||
that.payType.push("offline");
|
||||
if (that.payType.indexOf('offline') < 0) {
|
||||
that.payType.push('offline')
|
||||
}
|
||||
}
|
||||
},
|
||||
getOrderData() {
|
||||
getOrderData().then(res => {
|
||||
this.orderData = res.data;
|
||||
});
|
||||
this.orderData = res.data
|
||||
})
|
||||
},
|
||||
takeOrder(order) {
|
||||
takeOrderHandle(order.orderId).finally(() => {
|
||||
this.reload();
|
||||
this.getOrderData();
|
||||
});
|
||||
this.reload()
|
||||
this.getOrderData()
|
||||
})
|
||||
},
|
||||
reload() {
|
||||
this.changeType(this.type);
|
||||
this.changeType(this.type)
|
||||
},
|
||||
changeType(type) {
|
||||
this.type = type;
|
||||
this.orderList = [];
|
||||
this.page = 1;
|
||||
this.loaded = false;
|
||||
this.loading = false;
|
||||
this.getOrderList();
|
||||
this.type = type
|
||||
this.orderList = []
|
||||
this.page = 1
|
||||
this.loaded = false
|
||||
this.loading = false
|
||||
this.getOrderList()
|
||||
},
|
||||
getOrderList() {
|
||||
if (this.loading || this.loaded) return;
|
||||
this.loading = true;
|
||||
const { page, limit, type } = this;
|
||||
if (this.loading || this.loaded) return
|
||||
this.loading = true
|
||||
const { page, limit, type } = this
|
||||
getOrderList({
|
||||
page,
|
||||
limit,
|
||||
type
|
||||
type,
|
||||
}).then(res => {
|
||||
this.orderList = this.orderList.concat(res.data);
|
||||
this.page++;
|
||||
this.loaded = res.data.length < this.limit;
|
||||
this.loading = false;
|
||||
});
|
||||
this.orderList = this.orderList.concat(res.data)
|
||||
this.page++
|
||||
this.loaded = res.data.length < this.limit
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
getStatus(order) {
|
||||
return STATUS[order._status._type];
|
||||
return STATUS[order._status._type]
|
||||
},
|
||||
cancelOrder(order) {
|
||||
cancelOrderHandle(order.orderId)
|
||||
.then(() => {
|
||||
this.getOrderData();
|
||||
this.orderList.splice(this.orderList.indexOf(order), 1);
|
||||
this.getOrderData()
|
||||
this.orderList.splice(this.orderList.indexOf(order), 1)
|
||||
})
|
||||
.catch(() => {
|
||||
this.reload();
|
||||
});
|
||||
this.reload()
|
||||
})
|
||||
},
|
||||
paymentTap: function(order) {
|
||||
var that = this;
|
||||
if (
|
||||
!(order.combinationId > 0 || order.bargainId > 0 || order.seckillId > 0)
|
||||
) {
|
||||
that.setOfflinePayStatus(order.offlinePayStatus);
|
||||
var that = this
|
||||
if (!(order.combinationId > 0 || order.bargainId > 0 || order.seckillId > 0)) {
|
||||
that.setOfflinePayStatus(order.offlinePayStatus)
|
||||
}
|
||||
this.pay = true;
|
||||
this.pay = true
|
||||
this.toPay = type => {
|
||||
payOrderHandle(order.orderId, type, that.from)
|
||||
.then(() => {
|
||||
const type = parseInt(this.$yroute.query.type) || 0;
|
||||
that.changeType(type);
|
||||
that.getOrderData();
|
||||
const type = parseInt(this.$yroute.query.type) || 0
|
||||
that.changeType(type)
|
||||
that.getOrderData()
|
||||
})
|
||||
.catch(() => {
|
||||
const type = parseInt(that.$yroute.query.type) || 0;
|
||||
that.changeType(type);
|
||||
that.getOrderData();
|
||||
});
|
||||
};
|
||||
const type = parseInt(that.$yroute.query.type) || 0
|
||||
that.changeType(type)
|
||||
that.getOrderData()
|
||||
})
|
||||
}
|
||||
},
|
||||
toPay() {}
|
||||
toPay() {},
|
||||
},
|
||||
mounted() {},
|
||||
onReachBottom() {
|
||||
!this.loading && this.getOrderList();
|
||||
}
|
||||
};
|
||||
!this.loading && this.getOrderList()
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
|
@ -268,7 +268,7 @@ export default {
|
||||
AddressWindow,
|
||||
},
|
||||
props: {},
|
||||
data: function () {
|
||||
data: function() {
|
||||
return {
|
||||
offlinePayStatus: 2,
|
||||
from: this.$deviceType,
|
||||
@ -313,7 +313,7 @@ export default {
|
||||
this.computedPrice()
|
||||
},
|
||||
},
|
||||
onShow: function () {
|
||||
onShow: function() {
|
||||
let that = this
|
||||
this.$store.dispatch('getUser', true)
|
||||
that.getCartInfo()
|
||||
@ -338,7 +338,7 @@ export default {
|
||||
path: '/pages/shop/StoreList/index',
|
||||
})
|
||||
},
|
||||
addressType: function (index) {
|
||||
addressType: function(index) {
|
||||
if (index && !this.systemStore.id) {
|
||||
uni.showToast({
|
||||
title: '暂无门店信息,您无法选择到店自提!',
|
||||
@ -350,7 +350,7 @@ export default {
|
||||
console.log(this)
|
||||
this.shipping_type = index
|
||||
},
|
||||
changeUseIntegral: function (e) {
|
||||
changeUseIntegral: function(e) {
|
||||
// this.computedPrice();
|
||||
if (this.isIntegral) {
|
||||
return
|
||||
@ -410,7 +410,7 @@ export default {
|
||||
})
|
||||
})
|
||||
},
|
||||
addressTap: function () {
|
||||
addressTap: function() {
|
||||
this.showAddress = true
|
||||
if (!this.addressLoaded) {
|
||||
this.addressLoaded = true
|
||||
@ -421,10 +421,10 @@ export default {
|
||||
this.addressLoaded = false
|
||||
this.showAddress = false
|
||||
},
|
||||
couponTap: function () {
|
||||
couponTap: function() {
|
||||
this.showCoupon = true
|
||||
},
|
||||
changeCoupon: function (coupon) {
|
||||
changeCoupon: function(coupon) {
|
||||
if (!coupon) {
|
||||
this.usableCoupon = {
|
||||
couponTitle: '不使用优惠券',
|
||||
@ -435,7 +435,7 @@ export default {
|
||||
}
|
||||
this.computedPrice()
|
||||
},
|
||||
payItem: function (index) {
|
||||
payItem: function(index) {
|
||||
this.active = index
|
||||
},
|
||||
changeAddress(addressInfo) {
|
||||
@ -508,6 +508,7 @@ export default {
|
||||
if (this.$deviceType == 'app') {
|
||||
from.from = 'app'
|
||||
}
|
||||
console.log(this.$deviceType)
|
||||
// #ifdef MP-WEIXIN
|
||||
subscribeMessage()
|
||||
// #endif
|
||||
|
@ -1,200 +1,193 @@
|
||||
<template>
|
||||
<view class="OrderCancellation">
|
||||
<view class="header">
|
||||
<image mode="aspectFit" :src="`${$VUE_APP_RESOURCES_URL}/images/writeOffBg.jpg`" @click="openQRCode" />
|
||||
</view>
|
||||
<view class="whiteBg">
|
||||
<view class="input">
|
||||
<input type="number" placeholder="0" v-model="verify_code" />
|
||||
</view>
|
||||
<view class="bnt" @click="storeCancellation">立即核销</view>
|
||||
<view class="bnt" @click="openQRCode">扫码核销</view>
|
||||
</view>
|
||||
<!-- #ifndef H5 -->
|
||||
<!-- <view class="scan" v-if="iswechat">
|
||||
<view class="OrderCancellation">
|
||||
<view class="header">
|
||||
<image mode="aspectFit" :src="`${$VUE_APP_RESOURCES_URL}/images/writeOffBg.jpg`" @click="openQRCode" />
|
||||
</view>
|
||||
<view class="whiteBg">
|
||||
<view class="input">
|
||||
<input type="number" placeholder="0" v-model="verify_code" />
|
||||
</view>
|
||||
<view class="bnt" @click="storeCancellation">立即核销</view>
|
||||
<view class="bnt" v-if="$deviceType !== 'weixin'" @click="openQRCode">扫码核销</view>
|
||||
</view>
|
||||
<!-- #ifndef H5 -->
|
||||
<!-- <view class="scan" v-if="iswechat">
|
||||
<image :src="`${$VUE_APP_RESOURCES_URL}/images/scan.gif`" @click="openQRCode" />
|
||||
</view> -->
|
||||
<!-- #endif -->
|
||||
<WriteOff :iShidden="iShidden" :orderInfo="orderInfo" @cancel="cancel" @confirm="confirm"></WriteOff>
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
<WriteOff :iShidden="iShidden" :orderInfo="orderInfo" @cancel="cancel" @confirm="confirm"></WriteOff>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import WriteOff from "@/components/WriteOff";
|
||||
import {
|
||||
isWeixin
|
||||
} from "@/utils";
|
||||
// import { wechatEvevt } from "@/libs/wechat";
|
||||
import {
|
||||
orderVerific
|
||||
} from "@/api/order";
|
||||
const NAME = "OrderCancellation";
|
||||
import WriteOff from '@/components/WriteOff'
|
||||
import { isWeixin } from '@/utils'
|
||||
// import { wechatEvevt } from "@/libs/wechat";
|
||||
import { orderVerific } from '@/api/order'
|
||||
const NAME = 'OrderCancellation'
|
||||
|
||||
export default {
|
||||
name: NAME,
|
||||
components: {
|
||||
WriteOff
|
||||
},
|
||||
props: {},
|
||||
data: function() {
|
||||
return {
|
||||
iShidden: true,
|
||||
orderInfo: {},
|
||||
verify_code: ""
|
||||
};
|
||||
},
|
||||
mounted: function() {},
|
||||
methods: {
|
||||
cancel: function(res) {
|
||||
this.iShidden = res;
|
||||
},
|
||||
confirm: function() {
|
||||
orderVerific(this.verify_code, 1)
|
||||
.then(res => {
|
||||
this.iShidden = true;
|
||||
this.verify_code = "";
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
uni.showToast({
|
||||
title: err.msg || err.response.data.msg || err.response.data.message,
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
});
|
||||
});
|
||||
},
|
||||
storeCancellation: function() {
|
||||
let ref = /[0-9]{12}/;
|
||||
if (!this.verify_code) {
|
||||
uni.showToast({
|
||||
title: "请输入核销码",
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (!ref.test(this.verify_code)) {
|
||||
uni.showToast({
|
||||
title: "请输入正确的核销码",
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
});
|
||||
return;
|
||||
}
|
||||
uni.showLoading({
|
||||
title: "查询中"
|
||||
});
|
||||
orderVerific(this.verify_code, 0)
|
||||
.then(res => {
|
||||
uni.hideLoading();
|
||||
this.orderInfo = res.data;
|
||||
this.iShidden = false;
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: "success",
|
||||
duration: 2000
|
||||
});
|
||||
})
|
||||
.catch(error => {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: error.msg ||
|
||||
error.response.data.msg ||
|
||||
error.response.data.message,
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
});
|
||||
});
|
||||
},
|
||||
openQRCode: function() {
|
||||
let that = this;
|
||||
// 这里需要调用扫码功能
|
||||
uni.scanCode({
|
||||
success: (res) => {
|
||||
var result = res.result;
|
||||
if (result) {
|
||||
that.verify_code = res.result;
|
||||
that.storeCancellation();
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '没有扫描到什么!',
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
export default {
|
||||
name: NAME,
|
||||
components: {
|
||||
WriteOff,
|
||||
},
|
||||
props: {},
|
||||
data: function() {
|
||||
return {
|
||||
iShidden: true,
|
||||
orderInfo: {},
|
||||
verify_code: '',
|
||||
}
|
||||
},
|
||||
mounted: function() {},
|
||||
methods: {
|
||||
cancel: function(res) {
|
||||
this.iShidden = res
|
||||
},
|
||||
confirm: function() {
|
||||
orderVerific(this.verify_code, 1)
|
||||
.then(res => {
|
||||
this.iShidden = true
|
||||
this.verify_code = ''
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none',
|
||||
duration: 2000,
|
||||
})
|
||||
})
|
||||
.catch(err => {
|
||||
uni.showToast({
|
||||
title: err.msg || err.response.data.msg || err.response.data.message,
|
||||
icon: 'none',
|
||||
duration: 2000,
|
||||
})
|
||||
})
|
||||
},
|
||||
storeCancellation: function() {
|
||||
let ref = /[0-9]{12}/
|
||||
if (!this.verify_code) {
|
||||
uni.showToast({
|
||||
title: '请输入核销码',
|
||||
icon: 'none',
|
||||
duration: 2000,
|
||||
})
|
||||
return
|
||||
}
|
||||
if (!ref.test(this.verify_code)) {
|
||||
uni.showToast({
|
||||
title: '请输入正确的核销码',
|
||||
icon: 'none',
|
||||
duration: 2000,
|
||||
})
|
||||
return
|
||||
}
|
||||
uni.showLoading({
|
||||
title: '查询中',
|
||||
})
|
||||
orderVerific(this.verify_code, 0)
|
||||
.then(res => {
|
||||
uni.hideLoading()
|
||||
this.orderInfo = res.data
|
||||
this.iShidden = false
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'success',
|
||||
duration: 2000,
|
||||
})
|
||||
})
|
||||
.catch(error => {
|
||||
uni.hideLoading()
|
||||
uni.showToast({
|
||||
title: error.msg || error.response.data.msg || error.response.data.message,
|
||||
icon: 'none',
|
||||
duration: 2000,
|
||||
})
|
||||
})
|
||||
},
|
||||
openQRCode: function() {
|
||||
let that = this
|
||||
// 这里需要调用扫码功能
|
||||
uni.scanCode({
|
||||
success: res => {
|
||||
var result = res.result
|
||||
if (result) {
|
||||
that.verify_code = res.result
|
||||
that.storeCancellation()
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '没有扫描到什么!',
|
||||
icon: 'none',
|
||||
duration: 2000,
|
||||
})
|
||||
}
|
||||
},
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
.OrderCancellation .header {
|
||||
width: 100%;
|
||||
height: 3 * 100rpx;
|
||||
background-size: 100% 100%;
|
||||
.OrderCancellation .header {
|
||||
width: 100%;
|
||||
height: 3 * 100rpx;
|
||||
background-size: 100% 100%;
|
||||
|
||||
image {
|
||||
width: 100%;
|
||||
height: 3 * 100rpx;
|
||||
}
|
||||
}
|
||||
image {
|
||||
width: 100%;
|
||||
height: 3 * 100rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.OrderCancellation .whiteBg {
|
||||
width: 6.9 * 100rpx;
|
||||
background-color: #fff;
|
||||
margin: -0.93 * 100rpx auto 0 auto;
|
||||
padding-top: 0.8 * 100rpx;
|
||||
padding-bottom: 30rpx;
|
||||
z-index: 20;
|
||||
position: relative;
|
||||
border-radius: 0.06 * 100rpx 0.06 * 100rpx 0 0;
|
||||
}
|
||||
.OrderCancellation .whiteBg {
|
||||
width: 6.9 * 100rpx;
|
||||
background-color: #fff;
|
||||
margin: -0.93 * 100rpx auto 0 auto;
|
||||
padding-top: 0.8 * 100rpx;
|
||||
padding-bottom: 30rpx;
|
||||
z-index: 20;
|
||||
position: relative;
|
||||
border-radius: 0.06 * 100rpx 0.06 * 100rpx 0 0;
|
||||
}
|
||||
|
||||
.OrderCancellation .whiteBg .input {
|
||||
width: 5.8 * 100rpx;
|
||||
margin: 0 auto;
|
||||
border-bottom: 0.01 * 100rpx solid #eee;
|
||||
}
|
||||
.OrderCancellation .whiteBg .input {
|
||||
width: 5.8 * 100rpx;
|
||||
margin: 0 auto;
|
||||
border-bottom: 0.01 * 100rpx solid #eee;
|
||||
}
|
||||
|
||||
.OrderCancellation .whiteBg .input input {
|
||||
padding-bottom: 0.25 * 100rpx;
|
||||
font-size: 0.6 * 100rpx;
|
||||
height: auto;
|
||||
color: #282828;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
.OrderCancellation .whiteBg .input input {
|
||||
padding-bottom: 0.25 * 100rpx;
|
||||
font-size: 0.6 * 100rpx;
|
||||
height: auto;
|
||||
color: #282828;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.OrderCancellation .whiteBg .bnt {
|
||||
font-size: 0.32 * 100rpx;
|
||||
color: #fff;
|
||||
width: 5.8 * 100rpx;
|
||||
height: 0.86 * 100rpx;
|
||||
border-radius: 0.43 * 100rpx;
|
||||
background-image: linear-gradient(to right, #eb3729 0%, #eb3729 100%);
|
||||
background-image: -webkit-linear-gradient(to right, #eb3729 0%, #eb3729 100%);
|
||||
background-image: -moz-linear-gradient(to right, #eb3729 0%, #eb3729 100%);
|
||||
text-align: center;
|
||||
line-height: 0.86 * 100rpx;
|
||||
margin: 0.55 * 100rpx auto 0 auto;
|
||||
}
|
||||
.OrderCancellation .whiteBg .bnt {
|
||||
font-size: 0.32 * 100rpx;
|
||||
color: #fff;
|
||||
width: 5.8 * 100rpx;
|
||||
height: 0.86 * 100rpx;
|
||||
border-radius: 0.43 * 100rpx;
|
||||
background-image: linear-gradient(to right, #eb3729 0%, #eb3729 100%);
|
||||
background-image: -webkit-linear-gradient(to right, #eb3729 0%, #eb3729 100%);
|
||||
background-image: -moz-linear-gradient(to right, #eb3729 0%, #eb3729 100%);
|
||||
text-align: center;
|
||||
line-height: 0.86 * 100rpx;
|
||||
margin: 0.55 * 100rpx auto 0 auto;
|
||||
}
|
||||
|
||||
.OrderCancellation .scan {
|
||||
width: 3 * 100rpx;
|
||||
height: 3 * 100rpx;
|
||||
margin: 1.1 * 100rpx auto 0 auto;
|
||||
}
|
||||
.OrderCancellation .scan {
|
||||
width: 3 * 100rpx;
|
||||
height: 3 * 100rpx;
|
||||
margin: 1.1 * 100rpx auto 0 auto;
|
||||
}
|
||||
|
||||
.OrderCancellation .scan image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
}
|
||||
.OrderCancellation .scan image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
|
@ -1,30 +1,22 @@
|
||||
<template>
|
||||
<view ref="container">
|
||||
<view class="collectionGoods" v-if="collectProductList.length > 0">
|
||||
<view
|
||||
class="item acea-row row-between-wrapper"
|
||||
v-for="(item, collectProductListIndex) in collectProductList"
|
||||
:key="collectProductListIndex"
|
||||
@click="goGoodsCon(item)"
|
||||
>
|
||||
<view class="item acea-row row-between-wrapper" v-for="(item, collectProductListIndex) in collectProductList" :key="collectProductListIndex" @click="goGoodsCon(item)">
|
||||
<view class="pictrue">
|
||||
<image :src="item.image" />
|
||||
</view>
|
||||
<view class="text acea-row row-column-between">
|
||||
<view class="infor line1">{{ item.storeName }}</view>
|
||||
<view class="acea-row row-between-wrapper">
|
||||
<view class="money font-color-red">¥{{ item.price }}</view>
|
||||
<view class="money font-color-red" v-if="isIntegral == 1">{{ item.costPrice }}积分</view>
|
||||
<view class="money font-color-red" v-else>¥{{ item.price }}</view>
|
||||
<view class="delete" @tap.stop="delCollection(collectProductListIndex)">删除</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<Loading :loaded="loadend" :loading="loading"></Loading>
|
||||
<view
|
||||
class="noCommodity"
|
||||
style="background-color:#fff;"
|
||||
v-if="collectProductList.length < 1 && page > 1"
|
||||
>
|
||||
<view class="noCommodity" style="background-color:#fff;" v-if="collectProductList.length < 1 && page > 1">
|
||||
<view class="noPictrue">
|
||||
<image :src="`${$VUE_APP_RESOURCES_URL}/images/noCollection.png`" class="image" />
|
||||
</view>
|
||||
@ -33,70 +25,77 @@
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import Recommend from "@/components/Recommend";
|
||||
import { getCollectUser, getCollectDel } from "@/api/user";
|
||||
import Loading from "@/components/Loading";
|
||||
import Recommend from '@/components/Recommend'
|
||||
import { getCollectUser, getCollectDel } from '@/api/user'
|
||||
import Loading from '@/components/Loading'
|
||||
export default {
|
||||
name: "GoodsCollection",
|
||||
name: 'GoodsCollection',
|
||||
components: {
|
||||
Recommend,
|
||||
Loading
|
||||
Loading,
|
||||
},
|
||||
props: {},
|
||||
data: function() {
|
||||
return {
|
||||
page: 1,
|
||||
limit: 20,
|
||||
type:'collect',
|
||||
type: 'collect',
|
||||
collectProductList: [],
|
||||
loadTitle: "",
|
||||
loadTitle: '',
|
||||
loading: false,
|
||||
loadend: false
|
||||
};
|
||||
loadend: false,
|
||||
}
|
||||
},
|
||||
mounted: function() {
|
||||
this.get_user_collect_product();
|
||||
this.get_user_collect_product()
|
||||
},
|
||||
onReachBottom() {
|
||||
!this.loading && this.get_user_collect_product();
|
||||
!this.loading && this.get_user_collect_product()
|
||||
},
|
||||
methods: {
|
||||
goGoodsCon(item) {
|
||||
this.$yrouter.push({
|
||||
path: "/pages/shop/GoodsCon/index",
|
||||
query: { id: item.pid }
|
||||
});
|
||||
if (item.isIntegral == 1) {
|
||||
this.$yrouter.push({
|
||||
path: '/pages/shop/GoodsCon/index',
|
||||
query: { id: item.pid },
|
||||
})
|
||||
} else {
|
||||
this.$yrouter.push({
|
||||
path: '/pages/shop/GoodsCon/index',
|
||||
query: { id: item.pid },
|
||||
})
|
||||
}
|
||||
},
|
||||
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,that.type).then(res => {
|
||||
that.loading = false;
|
||||
let that = this
|
||||
if (that.loading) return //阻止下次请求(false可以进行请求);
|
||||
if (that.loadend) return //阻止结束当前请求(false可以进行请求);
|
||||
that.loading = true
|
||||
getCollectUser(that.page, that.limit, that.type).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;
|
||||
});
|
||||
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;
|
||||
category = that.collectProductList[index].category
|
||||
getCollectDel(id, category).then(function() {
|
||||
uni.showToast({
|
||||
title: "删除成功",
|
||||
icon: "success",
|
||||
title: '删除成功',
|
||||
icon: 'success',
|
||||
duration: 2000,
|
||||
complete: () => {
|
||||
that.collectProductList.splice(index, 1);
|
||||
that.$set(that, "collectProductList", that.collectProductList);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
that.collectProductList.splice(index, 1)
|
||||
that.$set(that, 'collectProductList', that.collectProductList)
|
||||
},
|
||||
})
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
@ -229,7 +229,7 @@ export default {
|
||||
StorePoster,
|
||||
ShareInfo,
|
||||
},
|
||||
data: function () {
|
||||
data: function() {
|
||||
return {
|
||||
shareInfoStatus: false,
|
||||
weixinStatus: false,
|
||||
@ -287,13 +287,14 @@ export default {
|
||||
}
|
||||
},
|
||||
computed: mapGetters(['isLogin', 'location']),
|
||||
mounted: function () {
|
||||
mounted: function() {
|
||||
this.$store.commit('get_to', 'goodcon')
|
||||
let url = handleQrCode()
|
||||
if (!url) {
|
||||
url = handleUrlParam(getCurrentPageUrlWithArgs())
|
||||
}
|
||||
this.coupons()
|
||||
|
||||
const token = cookie.get('login_status')
|
||||
if (url && url.id) {
|
||||
this.id = url.id
|
||||
let urlSpread = parseInt(url.spread)
|
||||
@ -303,7 +304,15 @@ export default {
|
||||
} else {
|
||||
this.id = this._route.query.id
|
||||
}
|
||||
|
||||
this.isIntegral = url.isIntegral == 'true'
|
||||
|
||||
if (!token) {
|
||||
this.productCon()
|
||||
return
|
||||
}
|
||||
this.coupons()
|
||||
|
||||
this.productCon()
|
||||
this.setOpenShare()
|
||||
},
|
||||
@ -318,7 +327,7 @@ export default {
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
onShareAppMessage: function () {
|
||||
onShareAppMessage: function() {
|
||||
return {
|
||||
title: this.storeInfo.storeName,
|
||||
imageUrl: this.storeInfo.image,
|
||||
@ -368,7 +377,7 @@ export default {
|
||||
},
|
||||
})
|
||||
},
|
||||
showChang: function (data) {
|
||||
showChang: function(data) {
|
||||
this.$yrouter.push({
|
||||
path: '/pages/map/index',
|
||||
query: data,
|
||||
@ -377,23 +386,23 @@ export default {
|
||||
updateTitle() {
|
||||
// document.title = this.storeInfo.storeName || this.$yroute.meta.title;
|
||||
},
|
||||
setShareInfoStatus: function () {
|
||||
setShareInfoStatus: function() {
|
||||
this.shareInfoStatus = !this.shareInfoStatus
|
||||
this.posters = false
|
||||
},
|
||||
shareCode: function () {
|
||||
shareCode: function() {
|
||||
var that = this
|
||||
getProductCode(that.id).then(res => {
|
||||
that.posterData.code = res.data.code
|
||||
that.listenerActionSheet()
|
||||
})
|
||||
},
|
||||
setPosterImageStatus: function () {
|
||||
setPosterImageStatus: function() {
|
||||
this.posterImageStatus = !this.posterImageStatus
|
||||
this.posters = false
|
||||
},
|
||||
//产品详情接口;
|
||||
productCon: function () {
|
||||
productCon: function() {
|
||||
let that = this
|
||||
let from = this.location
|
||||
if (this.$deviceType == 'app') {
|
||||
@ -453,7 +462,7 @@ export default {
|
||||
})
|
||||
},
|
||||
//默认选中属性;
|
||||
DefaultSelect: function () {
|
||||
DefaultSelect: function() {
|
||||
let productAttr = this.attr.productAttr
|
||||
let value = []
|
||||
for (let i = 0; i < productAttr.length; i++) {
|
||||
@ -495,7 +504,7 @@ export default {
|
||||
}
|
||||
},
|
||||
//购物车;
|
||||
ChangeCartNum: function (changeValue) {
|
||||
ChangeCartNum: function(changeValue) {
|
||||
//changeValue:是否 加|减
|
||||
//获取当前变动属性
|
||||
let productSelect = this.productValue[this.attrValue]
|
||||
@ -528,29 +537,29 @@ export default {
|
||||
}
|
||||
},
|
||||
//将父级向子集多次传送的函数合二为一;
|
||||
changeFun: function (opt) {
|
||||
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 () {
|
||||
couponTap: function() {
|
||||
let that = this
|
||||
that.coupons()
|
||||
that.coupon.coupon = true
|
||||
},
|
||||
changecoupon: function (msg) {
|
||||
changecoupon: function(msg) {
|
||||
this.coupon.coupon = msg
|
||||
this.coupons()
|
||||
},
|
||||
currentcoupon: function (res) {
|
||||
currentcoupon: function(res) {
|
||||
let that = this
|
||||
that.coupon.coupon = false
|
||||
that.$set(that.coupon.list[res], 'is_use', true)
|
||||
},
|
||||
//可领取优惠券接口;
|
||||
coupons: function () {
|
||||
coupons: function() {
|
||||
let that = this,
|
||||
q = {
|
||||
page: 1,
|
||||
@ -562,18 +571,18 @@ export default {
|
||||
})
|
||||
},
|
||||
//打开属性插件;
|
||||
selecAttrTap: function () {
|
||||
selecAttrTap: function() {
|
||||
this.attr.cartAttr = true
|
||||
this.isOpen = true
|
||||
},
|
||||
changeattr: function (msg) {
|
||||
changeattr: function(msg) {
|
||||
// 修改了规格
|
||||
console.log(msg)
|
||||
this.attr.cartAttr = msg
|
||||
this.isOpen = false
|
||||
},
|
||||
//选择属性;
|
||||
ChangeAttr: function (res) {
|
||||
ChangeAttr: function(res) {
|
||||
// 修改了规格
|
||||
|
||||
let productSelect = this.productValue[res.value]
|
||||
@ -600,27 +609,27 @@ export default {
|
||||
}
|
||||
},
|
||||
//收藏商品
|
||||
setCollect: function () {
|
||||
setCollect: function() {
|
||||
let that = this,
|
||||
id = that.storeInfo.id,
|
||||
category = 'collect'
|
||||
if (that.storeInfo.userCollect) {
|
||||
getCollectDel(id, category).then(function () {
|
||||
getCollectDel(id, category).then(function() {
|
||||
that.storeInfo.userCollect = !that.storeInfo.userCollect
|
||||
})
|
||||
} else {
|
||||
getCollectAdd(id, category).then(function () {
|
||||
getCollectAdd(id, category).then(function() {
|
||||
that.storeInfo.userCollect = !that.storeInfo.userCollect
|
||||
})
|
||||
}
|
||||
},
|
||||
// 点击加入购物车按钮
|
||||
joinCart: function () {
|
||||
joinCart: function() {
|
||||
//0=加入购物车
|
||||
this.goCat(0)
|
||||
},
|
||||
// 加入购物车;
|
||||
goCat: function (news) {
|
||||
goCat: function(news) {
|
||||
let that = this,
|
||||
productSelect = that.productValue[this.attrValue]
|
||||
//打开属性
|
||||
@ -649,7 +658,7 @@ export default {
|
||||
uniqueId: that.attr.productSelect !== undefined ? that.attr.productSelect.unique : '',
|
||||
}
|
||||
postCartAdd(q)
|
||||
.then(function (res) {
|
||||
.then(function(res) {
|
||||
console.log(res)
|
||||
that.isOpen = false
|
||||
that.attr.cartAttr = false
|
||||
@ -691,7 +700,7 @@ export default {
|
||||
})
|
||||
},
|
||||
//获取购物车数量
|
||||
getCartCount: function (isAnima) {
|
||||
getCartCount: function(isAnima) {
|
||||
let that = this
|
||||
const isLogin = that.isLogin
|
||||
if (isLogin) {
|
||||
@ -702,7 +711,7 @@ export default {
|
||||
//加入购物车后重置属性
|
||||
if (isAnima) {
|
||||
that.animated = true
|
||||
setTimeout(function () {
|
||||
setTimeout(function() {
|
||||
that.animated = false
|
||||
}, 500)
|
||||
}
|
||||
@ -710,20 +719,20 @@ export default {
|
||||
}
|
||||
},
|
||||
//立即购买;
|
||||
tapBuy: function () {
|
||||
tapBuy: function() {
|
||||
// 1=直接购买
|
||||
this.goCat(1)
|
||||
},
|
||||
listenerActionSheet: function () {
|
||||
listenerActionSheet: function() {
|
||||
if (isWeixin() === true) {
|
||||
this.weixinStatus = true
|
||||
}
|
||||
this.posters = true
|
||||
},
|
||||
listenerActionClose: function () {
|
||||
listenerActionClose: function() {
|
||||
this.posters = false
|
||||
},
|
||||
setOpenShare: function () {
|
||||
setOpenShare: function() {
|
||||
var data = this.storeInfo
|
||||
var href = this.location.href
|
||||
if (this.$deviceType == 'weixin') {
|
||||
|
@ -1,30 +1,22 @@
|
||||
<template>
|
||||
<view ref="container">
|
||||
<view class="collectionGoods" v-if="collectProductList.length > 0">
|
||||
<view
|
||||
class="item acea-row row-between-wrapper"
|
||||
v-for="(item, collectProductListIndex) in collectProductList"
|
||||
:key="collectProductListIndex"
|
||||
@click="goGoodsCon(item)"
|
||||
>
|
||||
<view class="item acea-row row-between-wrapper" v-for="(item, collectProductListIndex) in collectProductList" :key="collectProductListIndex" @click="goGoodsCon(item)">
|
||||
<view class="pictrue">
|
||||
<image :src="item.image" />
|
||||
</view>
|
||||
<view class="text acea-row row-column-between">
|
||||
<view class="infor line1">{{ item.storeName }}</view>
|
||||
<view class="acea-row row-between-wrapper">
|
||||
<view class="money font-color-red">¥{{ item.price }}</view>
|
||||
<view class="money font-color-red" v-if="isIntegral == 1">{{ item.costPrice }}积分</view>
|
||||
<view class="money font-color-red" v-else>¥{{ item.price }}</view>
|
||||
<view class="delete" @tap.stop="delCollection(collectProductListIndex)">删除</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<Loading :loaded="loadend" :loading="loading"></Loading>
|
||||
<view
|
||||
class="noCommodity"
|
||||
style="background-color:#fff;"
|
||||
v-if="collectProductList.length < 1 && page > 1"
|
||||
>
|
||||
<view class="noCommodity" style="background-color:#fff;" v-if="collectProductList.length < 1 && page > 1">
|
||||
<view class="noPictrue">
|
||||
<image :src="`${$VUE_APP_RESOURCES_URL}/images/noCollection.png`" class="image" />
|
||||
</view>
|
||||
@ -33,70 +25,77 @@
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import Recommend from "@/components/Recommend";
|
||||
import { getCollectUser, getCollectDel } from "@/api/user";
|
||||
import Loading from "@/components/Loading";
|
||||
import Recommend from '@/components/Recommend'
|
||||
import { getCollectUser, getCollectDel } from '@/api/user'
|
||||
import Loading from '@/components/Loading'
|
||||
export default {
|
||||
name: "GoodsFoot",
|
||||
name: 'GoodsFoot',
|
||||
components: {
|
||||
Recommend,
|
||||
Loading
|
||||
Loading,
|
||||
},
|
||||
props: {},
|
||||
data: function() {
|
||||
return {
|
||||
page: 1,
|
||||
limit: 20,
|
||||
type:'foot',
|
||||
type: 'foot',
|
||||
collectProductList: [],
|
||||
loadTitle: "",
|
||||
loadTitle: '',
|
||||
loading: false,
|
||||
loadend: false
|
||||
};
|
||||
loadend: false,
|
||||
}
|
||||
},
|
||||
mounted: function() {
|
||||
this.get_user_collect_product();
|
||||
this.get_user_collect_product()
|
||||
},
|
||||
onReachBottom() {
|
||||
!this.loading && this.get_user_collect_product();
|
||||
!this.loading && this.get_user_collect_product()
|
||||
},
|
||||
methods: {
|
||||
goGoodsCon(item) {
|
||||
this.$yrouter.push({
|
||||
path: "/pages/shop/GoodsCon/index",
|
||||
query: { id: item.pid }
|
||||
});
|
||||
if (item.isIntegral == 1) {
|
||||
this.$yrouter.push({
|
||||
path: '/pages/shop/GoodsCon/index',
|
||||
query: { id: item.pid },
|
||||
})
|
||||
} else {
|
||||
this.$yrouter.push({
|
||||
path: '/pages/shop/GoodsCon/index',
|
||||
query: { id: item.pid },
|
||||
})
|
||||
}
|
||||
},
|
||||
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,that.type).then(res => {
|
||||
that.loading = false;
|
||||
let that = this
|
||||
if (that.loading) return //阻止下次请求(false可以进行请求);
|
||||
if (that.loadend) return //阻止结束当前请求(false可以进行请求);
|
||||
that.loading = true
|
||||
getCollectUser(that.page, that.limit, that.type).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;
|
||||
});
|
||||
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;
|
||||
category = that.collectProductList[index].category
|
||||
getCollectDel(id, category).then(function() {
|
||||
uni.showToast({
|
||||
title: "删除成功",
|
||||
icon: "success",
|
||||
title: '删除成功',
|
||||
icon: 'success',
|
||||
duration: 2000,
|
||||
complete: () => {
|
||||
that.collectProductList.splice(index, 1);
|
||||
that.$set(that, "collectProductList", that.collectProductList);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
that.collectProductList.splice(index, 1)
|
||||
that.$set(that, 'collectProductList', that.collectProductList)
|
||||
},
|
||||
})
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
@ -82,7 +82,7 @@ export default {
|
||||
Loading,
|
||||
},
|
||||
props: {},
|
||||
data: function () {
|
||||
data: function() {
|
||||
// const { s = "", id = 0, title = "" } = this.$yroute.query;
|
||||
const s = '',
|
||||
id = 0,
|
||||
@ -146,7 +146,7 @@ export default {
|
||||
// }
|
||||
},
|
||||
},
|
||||
mounted: function () {
|
||||
mounted: function() {
|
||||
const { s = '', id = 0, title = '', isIntegral = false } = this.$yroute.query
|
||||
|
||||
this.where.keyword = s
|
||||
@ -238,7 +238,7 @@ export default {
|
||||
that.where.page = that.where.page + 1
|
||||
})
|
||||
},
|
||||
submitForm: function () {
|
||||
submitForm: function() {
|
||||
this.$set(this, 'productList', [])
|
||||
this.where.page = 1
|
||||
this.loadend = false
|
||||
@ -246,7 +246,7 @@ export default {
|
||||
this.getProductList()
|
||||
},
|
||||
//点击事件处理
|
||||
set_where: function (index) {
|
||||
set_where: function(index) {
|
||||
let that = this
|
||||
switch (index) {
|
||||
case 0:
|
||||
@ -279,7 +279,7 @@ export default {
|
||||
that.getProductList()
|
||||
},
|
||||
//设置where条件
|
||||
setWhere: function () {
|
||||
setWhere: function() {
|
||||
let that = this
|
||||
if (that.price === 0) {
|
||||
that.where.priceOrder = ''
|
||||
@ -297,7 +297,7 @@ export default {
|
||||
}
|
||||
that.where.news = that.nows ? '1' : '0'
|
||||
},
|
||||
switchTap: function () {
|
||||
switchTap: function() {
|
||||
let that = this
|
||||
that.Switch = !that.Switch
|
||||
},
|
||||
|
@ -8,7 +8,7 @@
|
||||
<view>总资产(元)</view>
|
||||
<view class="money">{{ now_money }}</view>
|
||||
</view>
|
||||
<navigator url="/pages/user/Recharge/index" class="recharge font-color-red" v-if="is_hide=='0'">充值</navigator>
|
||||
<navigator url="/pages/user/Recharge/index" class="recharge font-color-red" v-if="is_hide == '0'">充值</navigator>
|
||||
</view>
|
||||
<view class="cumulative acea-row row-top">
|
||||
<view class="item">
|
||||
@ -31,7 +31,7 @@
|
||||
</view>
|
||||
<view>消费记录</view>
|
||||
</view>
|
||||
<view class="item" @click="goUserBill(2)" v-if="is_hide=='0'">
|
||||
<view class="item" @click="goUserBill(2)" v-if="is_hide == '0'">
|
||||
<view class="pictrue">
|
||||
<image :src="`${$VUE_APP_RESOURCES_URL}/images/record3.png`" />
|
||||
</view>
|
||||
@ -44,59 +44,58 @@
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import Recommend from "@/components/Recommend";
|
||||
import { getActivityStatus, getBalance } from "@/api/user";
|
||||
import Recommend from '@/components/Recommend'
|
||||
import { getActivityStatus, getBalance } from '@/api/user'
|
||||
export default {
|
||||
name: "UserAccount",
|
||||
name: 'UserAccount',
|
||||
components: {
|
||||
Recommend
|
||||
Recommend,
|
||||
},
|
||||
props: {},
|
||||
data: function() {
|
||||
return {
|
||||
is_hide: "1",
|
||||
is_hide: '1',
|
||||
now_money: 0,
|
||||
orderStatusSum: 0,
|
||||
recharge: 0,
|
||||
activity: {
|
||||
is_bargin: false,
|
||||
is_pink: false,
|
||||
is_seckill: false
|
||||
}
|
||||
};
|
||||
is_seckill: false,
|
||||
},
|
||||
}
|
||||
},
|
||||
onShow: function() {
|
||||
this.getIndex();
|
||||
this.getActivity();
|
||||
this.getIndex()
|
||||
this.getActivity()
|
||||
},
|
||||
methods: {
|
||||
goUserBill(types) {
|
||||
this.$yrouter.push({
|
||||
path: "/pages/user/UserBill/index",
|
||||
query: { types }
|
||||
});
|
||||
path: '/pages/user/UserBill/index',
|
||||
query: { types },
|
||||
})
|
||||
},
|
||||
getIndex: function() {
|
||||
let that = this;
|
||||
let that = this
|
||||
getBalance().then(
|
||||
res => {
|
||||
that.now_money = res.data.now_money;
|
||||
that.orderStatusSum = res.data.orderStatusSum;
|
||||
that.recharge = res.data.recharge;
|
||||
this.is_hide = res.data.is_hide;
|
||||
that.now_money = res.data.now_money
|
||||
that.orderStatusSum = res.data.orderStatusSum
|
||||
that.recharge = res.data.recharge
|
||||
this.is_hide = res.data.is_hide
|
||||
},
|
||||
err => {
|
||||
uni.showToast({
|
||||
title:
|
||||
err.msg || err.response.data.msg || err.response.data.message,
|
||||
icon: "none",
|
||||
duration: 2000
|
||||
});
|
||||
title: err.msg || err.response.data.msg || err.response.data.message,
|
||||
icon: 'none',
|
||||
duration: 2000,
|
||||
})
|
||||
}
|
||||
);
|
||||
)
|
||||
},
|
||||
getActivity: function() {
|
||||
let that = this;
|
||||
let that = this
|
||||
// getActivityStatus().then(
|
||||
// res => {
|
||||
// that.activity.is_bargin = res.data.is_bargin;
|
||||
@ -112,7 +111,7 @@ export default {
|
||||
// });
|
||||
// }
|
||||
// );
|
||||
}
|
||||
}
|
||||
};
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user