优化组件和页面
This commit is contained in:
parent
a68503d25f
commit
b5ec6d2014
40
App.vue
40
App.vue
@ -15,9 +15,13 @@
|
||||
import {
|
||||
bindSuperior
|
||||
} from '@/api/user'
|
||||
import {INVITE_CODE} from '@/config/cachekey'
|
||||
import {
|
||||
INVITE_CODE
|
||||
} from '@/config/cachekey'
|
||||
import Cache from '@/utils/cache'
|
||||
import { getWxCode } from "@/utils/login";
|
||||
import {
|
||||
getWxCode
|
||||
} from "@/utils/login";
|
||||
export default {
|
||||
onLaunch: function(options) {
|
||||
//#ifdef MP-WEIXIN
|
||||
@ -40,14 +44,14 @@
|
||||
} = await getConfig()
|
||||
if (code == 1) {
|
||||
this.setConfig(data)
|
||||
if(data.is_open_nearby) {
|
||||
if (data.is_open_nearby) {
|
||||
this.initLocationFunc()
|
||||
}
|
||||
this.wxShare()
|
||||
}
|
||||
},
|
||||
async bindCode(options, code) {
|
||||
if(!options.query) return
|
||||
if (!options.query) return
|
||||
if (options.query.path == 'goods_details') return
|
||||
let invite_code = options.query.invite_code || strToParams(decodeURIComponent(options.query.scene))
|
||||
.invite_code
|
||||
@ -60,7 +64,7 @@
|
||||
code: code || await getWxCode(),
|
||||
invite_code
|
||||
})
|
||||
|
||||
|
||||
if (code == -1) {
|
||||
Cache.set(INVITE_CODE, invite_code)
|
||||
}
|
||||
@ -69,17 +73,19 @@
|
||||
//#ifdef MP-WEIXIN
|
||||
checkMpUpdate() {
|
||||
const updateManager = wx.getUpdateManager()
|
||||
updateManager.onUpdateReady(function () {
|
||||
wx.showModal({
|
||||
title: '更新提示',
|
||||
content: '新版本已准备好,是否重启?',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
updateManager.applyUpdate()
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
if (updateManager) {
|
||||
updateManager.onUpdateReady(function() {
|
||||
wx.showModal({
|
||||
title: '更新提示',
|
||||
content: '新版本已准备好,是否重启?',
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
updateManager.applyUpdate()
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
//#endif
|
||||
}
|
||||
@ -89,4 +95,4 @@
|
||||
@import 'styles/common.scss';
|
||||
@import "components/uview-ui/index.scss";
|
||||
@import url('@/plugin/emoji-awesome/css/apple.css');
|
||||
</style>
|
||||
</style>
|
||||
@ -254,28 +254,28 @@
|
||||
url="/bundle/pages/user_withdraw/user_withdraw">立即提现</navigator>
|
||||
</view>
|
||||
<view class="user-assets-content flex flex-wrap">
|
||||
<view class="user-item flex-col col-center">
|
||||
<!-- <view class="user-item flex-col col-center">
|
||||
<tool-tip v-if="false" class="m-t-20" id="today-profit" content="今日预估收益金额"
|
||||
style="position: absolute;right: -66rpx;"></tool-tip>
|
||||
<view class="nr user-assets-name flex" style="color: #8F430E">
|
||||
今日预估收益
|
||||
今日预估收益 -->
|
||||
<!-- <u-icon class="ml10" name="question-circle" size="30rpx" color="#D88D5A" /> -->
|
||||
</view>
|
||||
<!-- </view>
|
||||
<view class="assets m-l-20">
|
||||
<price-format weight="bold" :first-size="36" :subscript-size="26" :second-size="36"
|
||||
:price="distributionInfo.today_earnings" :color="colorConfig.primary" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="user-item flex-col col-center">
|
||||
</view> -->
|
||||
<!-- <view class="user-item flex-col col-center">
|
||||
<view class="nr user-assets-name flex" style="color: #8F430E">
|
||||
本月预估收益
|
||||
本月预估收益 -->
|
||||
<!-- <u-icon class="ml10" name="question-circle" size="30rpx" color="#D88D5A" /> -->
|
||||
</view>
|
||||
<!-- </view>
|
||||
<view class="assets m-l-20">
|
||||
<price-format weight="bold" :first-size="36" :subscript-size="26" :second-size="36"
|
||||
:price="distributionInfo.month_earnings" :color="colorConfig.primary" />
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="user-item flex-col col-center">
|
||||
<view class="nr user-assets-name flex" style="color: #8F430E">
|
||||
累计获得收益
|
||||
|
||||
@ -204,14 +204,6 @@
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
onShareAppMessage() {
|
||||
return {
|
||||
title: this.data.title,
|
||||
path: `/bundle_b/pages/local_shop/local_shop_buy?id=${this.id}&lstore_id=${this.lstore_id}`,
|
||||
imageUrl: this.data.pic[0].url
|
||||
}
|
||||
},
|
||||
|
||||
preview(i) {
|
||||
let f = this.file.map((item) => {
|
||||
@ -222,8 +214,30 @@
|
||||
current: i,
|
||||
urls: f
|
||||
});
|
||||
},
|
||||
|
||||
share() {
|
||||
const {
|
||||
data,
|
||||
id,
|
||||
lstore_id
|
||||
} = this
|
||||
|
||||
return {
|
||||
title: data.title,
|
||||
path: `/bundle_b/pages/local_shop/local_shop_buy?id=${id}&lstore_id=${lstore_id}`,
|
||||
imageUrl: data.pic[0].url
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
async onShareAppMessage() {
|
||||
return this.share()
|
||||
},
|
||||
|
||||
onShareTimeline() {
|
||||
return this.share()
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
<view class="subsidy-item" v-for="(item, index) in list" :key="item.billions_id">
|
||||
<view class="subsidy-item-header">
|
||||
<view class="subsidy-item-info">
|
||||
<view class="subsidy-item-info-name" v-if="item.name">补贴商家:{{item.name}}</view>
|
||||
<!-- <view class="subsidy-item-info-name" v-if="item.name">补贴商家:{{item.name}}</view> -->
|
||||
<view class="subsidy-item-info-text info-color">消费日期:{{item.dtime}}</view>
|
||||
<view class="subsidy-item-info-text info-color" v-if="item.order_sn">订单号:{{item.order_sn}}</view>
|
||||
</view>
|
||||
|
||||
@ -108,14 +108,12 @@
|
||||
<view>
|
||||
<u-field v-model="withdrawl.inputMoney"
|
||||
type="digit"
|
||||
:focus="true"
|
||||
label="提现金额"
|
||||
label-width="160"
|
||||
placeholder="请输入要提现的金额"
|
||||
:border-bottom="false"
|
||||
right-icon="rmb"
|
||||
:field-style="{height: '120rpx', fontSize: '56rpx', fontWeight: 'bold', color: '#EE9254'}"
|
||||
>
|
||||
:field-style="{height: '120rpx', fontSize: '56rpx', fontWeight: 'bold', color: '#EE9254'}">
|
||||
</u-field>
|
||||
</view>
|
||||
</u-modal>
|
||||
|
||||
@ -9,7 +9,6 @@
|
||||
</view>
|
||||
|
||||
<view class="active-con">
|
||||
<goods-list v-if="type == 'hot'" :show-bg="false" type="double" :show-order="true" :list="list" :price-type="priceType" :width="'320rpx'"></goods-list>
|
||||
<goods-list v-if="type == 'new'" type="double" :width="'320rpx'" :list="list" :show-bg="false" :price-type="priceType"></goods-list>
|
||||
</view>
|
||||
<router-link :to="url" v-if="url">
|
||||
@ -50,10 +49,6 @@
|
||||
background-image: url(#{$aliOSS-path}uniapp/index_new_bg.png);
|
||||
}
|
||||
|
||||
&.hot {
|
||||
background-image: url(#{$aliOSS-path}uniapp/index_hot_bg.png);
|
||||
}
|
||||
|
||||
.active-hd {
|
||||
padding: 24rpx 20rpx;
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
<template v-if="isSwiper">
|
||||
<swiper class="swiper" :autoplay="autoplay" :circular="circular" @change="swiperChange"
|
||||
:previous-margin="previousMargin" display-multiple-items="1">
|
||||
<swiper-item v-for="(item, index) in lists" :key="index">
|
||||
<swiper-item v-for="(item, i) in lists" :key="i">
|
||||
<view :data-item="item" style="width:100%;height:100%;" @click="goPage(item)">
|
||||
<u-image mode="aspectFill" :width="'calc(100% - ' + previousMargin + ')'" height="100%"
|
||||
:border-radius="radius" :src="item.image"></u-image>
|
||||
@ -12,13 +12,13 @@
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
<view class="dots" v-if="lists.length > 1">
|
||||
<view v-for="(item, index) in lists" :key="index"
|
||||
:class="'dot ' + (index == currentSwiper ? 'active' : '')"></view>
|
||||
<view v-for="(item, i) in lists" :key="i"
|
||||
:class="'dot ' + (i == currentSwiper ? 'active' : '')"></view>
|
||||
</view>
|
||||
</template>
|
||||
<template v-lese v-for="(item, index) in lists">
|
||||
<view :key="index" :data-item="item" style="width:100%;height:100%;" @click="goPage(item)"
|
||||
v-if="index < 1">
|
||||
<template v-lese v-for="(item, i) in lists">
|
||||
<view :key="i" :data-item="item" style="width:100%;height:100%;" @click="goPage(item)"
|
||||
v-if="i < 1">
|
||||
<u-image mode="aspectFill" :width="'calc(100% - ' + previousMargin + ')'" height="100%"
|
||||
:border-radius="radius" :src="item.image"></u-image>
|
||||
</view>
|
||||
@ -39,7 +39,7 @@
|
||||
data() {
|
||||
return {
|
||||
lists: [],
|
||||
currentSwiper: 0
|
||||
currentSwiper: 0,
|
||||
};
|
||||
},
|
||||
props: {
|
||||
|
||||
@ -2,11 +2,11 @@
|
||||
<mescroll-uni ref="mescrollRef" top="80rpx" @init="mescrollInit" @down="downCallback" @up="upCallback"
|
||||
:down="downOption" :up="upOption">
|
||||
<view class="sale-list" v-if="type == 'normal'">
|
||||
<view v-for="(items, index) in lists" :key="index" class="sale-item bg-white m-t-20">
|
||||
<view v-for="(items, i) in lists" :key="i" class="sale-item bg-white m-t-20">
|
||||
<view class="sale-header">
|
||||
<shop-title :shop="{name: items.shop_name, id: items.sid}"></shop-title>
|
||||
</view>
|
||||
<view v-for="(item, index2) in items.order_goods" :key="index2" class="goods-item">
|
||||
<view v-for="(item, i2) in items.order_goods" :key="i2" class="goods-item">
|
||||
<view class="sale-content flex row">
|
||||
<view class="goods-img">
|
||||
<u-image width="160rpx" height="160rpx" border-radius="6rpx" :src="item.image" />
|
||||
@ -42,12 +42,12 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="sale-list" v-else-if="type == 'apply'">
|
||||
<view v-for="(items, index) in lists" :key="index" class="sale-item bg-white m-t-20">
|
||||
<view v-for="(items, i) in lists" :key="i" class="sale-item bg-white m-t-20">
|
||||
<view class="sale-header flex row-between">
|
||||
<shop-title :shop="{name: items.shop_name, id: items.sid}"></shop-title>
|
||||
<view class="primary flex-none m-l-20">{{items.after_sale.type_text}}</view>
|
||||
</view>
|
||||
<view v-for="(item, index2) in items.order_goods" :key="index2">
|
||||
<view v-for="(item, i2) in items.order_goods" :key="i2">
|
||||
<router-link :to="{path: bundle_path + 'after_sales_detail/after_sales_detail',
|
||||
query: { id: items.after_sale.after_sale_id,}}">
|
||||
<view class="sale-content">
|
||||
@ -95,12 +95,12 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="sale-list" v-else>
|
||||
<view v-for="(items, index) in lists" :key="index" class="sale-item bg-white m-t-20">
|
||||
<view v-for="(items, i) in lists" :key="i" class="sale-item bg-white m-t-20">
|
||||
<view class="sale-header flex row-between">
|
||||
<shop-title :shop="{name: items.shop_name, id: items.sid}"></shop-title>
|
||||
<view class="primary flex-none m-l-20">{{items.after_sale.type_text}}</view>
|
||||
</view>
|
||||
<view v-for="(item, index2) in items.order_goods" :key="index2">
|
||||
<view v-for="(item, i2) in items.order_goods" :key="i2">
|
||||
<router-link :to="{path: bundle_path + 'after_sales_detail/after_sales_detail',
|
||||
query: { id: items.after_sale.after_sale_id}}">
|
||||
<view class="sale-content">
|
||||
@ -138,17 +138,17 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
|
||||
import MescrollMoreItemMixin from "@/components/mescroll-uni/mixins/mescroll-more-item.js";
|
||||
import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js"
|
||||
import MescrollMoreItemMixin from "@/components/mescroll-uni/mixins/mescroll-more-item.js"
|
||||
import {
|
||||
afterSaleType
|
||||
} from "@/utils/type";
|
||||
} from "@/utils/type"
|
||||
import {
|
||||
getAfterSaleList,
|
||||
cancelApply,
|
||||
afterSaleDetail,
|
||||
applyAgain
|
||||
} from "@/api/user";
|
||||
} from "@/api/user"
|
||||
import {
|
||||
copy
|
||||
} from '@/utils/tools'
|
||||
@ -228,7 +228,7 @@
|
||||
async upCallback(page) {
|
||||
const {
|
||||
type,
|
||||
} = this;
|
||||
} = this
|
||||
const params = {
|
||||
page_size: page.size,
|
||||
page_no: page.num,
|
||||
@ -239,17 +239,17 @@
|
||||
code
|
||||
} = await getAfterSaleList(params)
|
||||
if (code == 1) {
|
||||
const curPageData = data.list;
|
||||
const curPageLen = curPageData.length;
|
||||
const hasNext = !!data.more;
|
||||
if (page.num == 1) this.lists = [];
|
||||
this.lists = this.lists.concat(curPageData);
|
||||
const curPageData = data.list
|
||||
const curPageLen = curPageData.length
|
||||
const hasNext = !!data.more
|
||||
if (page.num == 1) this.lists = []
|
||||
this.lists = this.lists.concat(curPageData)
|
||||
this.mescroll.endSuccess(curPageLen, hasNext);
|
||||
}
|
||||
},
|
||||
|
||||
onShowDialog(id) {
|
||||
this.id = id;
|
||||
this.id = id
|
||||
this.showDialog = true
|
||||
},
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<mescroll-uni ref="mescrollRef" top="80rpx" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
|
||||
<view class="bargain-list-container">
|
||||
<view class="bargain-list mt20" v-for="(item, index) in lists" :key="item.id">
|
||||
<view class="bargain-list mt20" v-for="(item, i) in lists" :key="item.id">
|
||||
<view class="header row-between">
|
||||
<view class="count-down-container row">
|
||||
<text class="muted xs" style="margin-left: 8rpx;">{{item.shop_name}}</text>
|
||||
@ -49,8 +49,8 @@
|
||||
|
||||
<script>
|
||||
import {getBargainActivityList} from "@/api/activity"
|
||||
import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
|
||||
import MescrollMoreItemMixin from "@/components/mescroll-uni/mixins/mescroll-more-item.js";
|
||||
import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js"
|
||||
import MescrollMoreItemMixin from "@/components/mescroll-uni/mixins/mescroll-more-item.js"
|
||||
export default {
|
||||
mixins: [MescrollMixin, MescrollMoreItemMixin],
|
||||
data() {
|
||||
@ -92,12 +92,12 @@
|
||||
'page_size': pageSize
|
||||
}).then(res => {
|
||||
if (res) {
|
||||
let curPageData = res.data.list;
|
||||
let curPageLen = curPageData.length;
|
||||
let hasNext = !!res.data.more;
|
||||
if (pageNum == 1) this.lists = [];
|
||||
this.lists = this.lists.concat(curPageData);
|
||||
this.mescroll.endSuccess(curPageLen, hasNext);
|
||||
let curPageData = res.data.list
|
||||
let curPageLen = curPageData.length
|
||||
let hasNext = !!res.data.more
|
||||
if (pageNum == 1) this.lists = []
|
||||
this.lists = this.lists.concat(curPageData)
|
||||
this.mescroll.endSuccess(curPageLen, hasNext)
|
||||
}
|
||||
}).catch(() => {
|
||||
this.mescroll.endErr()
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getBubbleLists} from "@/api/app";
|
||||
import {getBubbleLists} from "@/api/app"
|
||||
import Cache from "@/utils/cache"
|
||||
export default {
|
||||
name: "BubbleTips",
|
||||
@ -44,14 +44,14 @@
|
||||
watch: {
|
||||
index(newValue, oldValue) {
|
||||
if (this.index - this.list.length >= 0) {
|
||||
this.showBubble = false;
|
||||
this.showBubble = false
|
||||
let timer = setTimeout(() => {
|
||||
Cache.set("currentIndex", 0)
|
||||
if (this.timer) {
|
||||
clearInterval(this.timer)
|
||||
this.timer = null
|
||||
}
|
||||
this.fadeUpBubble();
|
||||
this.fadeUpBubble()
|
||||
clearTimeout(timer)
|
||||
}, 2000)
|
||||
} else {
|
||||
@ -59,22 +59,22 @@
|
||||
clearInterval(this.timer)
|
||||
this.timer = null
|
||||
}
|
||||
this.fadeUpBubble();
|
||||
this.fadeUpBubble()
|
||||
return;
|
||||
}
|
||||
},
|
||||
discharge() {
|
||||
if (this.discharge) {
|
||||
Cache.set("currentIndex", this.index);
|
||||
clearInterval(this.timer);
|
||||
this.timer = null;
|
||||
return false;
|
||||
Cache.set("currentIndex", this.index)
|
||||
clearInterval(this.timer)
|
||||
this.timer = null
|
||||
return false
|
||||
} else {
|
||||
let currentInex = Cache.get("currentInex") || this.list.length;
|
||||
let currentInex = Cache.get("currentInex") || this.list.length
|
||||
if (currentInex - this.list.length < 0) {
|
||||
if (this.timer) {
|
||||
setInterval(this.timer)
|
||||
this.timer = null;
|
||||
this.timer = null
|
||||
}
|
||||
this.fadeUpBubble()
|
||||
}
|
||||
@ -85,65 +85,65 @@
|
||||
getBubbleListsFunc() {
|
||||
getBubbleLists().then(res => {
|
||||
if (res) {
|
||||
this.list = res.data.lists;
|
||||
var requestTime = res.data.time * 1000;
|
||||
Cache.set("bubbleList", JSON.stringify(this.list), 300);
|
||||
Cache.set("requestTime", requestTime);
|
||||
this.list = res.data.lists
|
||||
var requestTime = res.data.time * 1000
|
||||
Cache.set("bubbleList", JSON.stringify(this.list), 300)
|
||||
Cache.set("requestTime", requestTime)
|
||||
if (this.timer) {
|
||||
clearInterval(this.timer);
|
||||
this.timer = null;
|
||||
clearInterval(this.timer)
|
||||
this.timer = null
|
||||
}
|
||||
this.fadeUpBubble()
|
||||
}
|
||||
})
|
||||
},
|
||||
fadeUpBubble() {
|
||||
let requestTime = Cache.get("requestTime");
|
||||
let currentTime = new Date();
|
||||
this.showBubble = true;
|
||||
this.index = Cache.get("currentIndex") || 0;
|
||||
this.list = Cache.get("bubbleList") ? JSON.parse(Cache.get("bubbleList")) : [];
|
||||
let requestTime = Cache.get("requestTime")
|
||||
let currentTime = new Date()
|
||||
this.showBubble = true
|
||||
this.index = Cache.get("currentIndex") || 0
|
||||
this.list = Cache.get("bubbleList") ? JSON.parse(Cache.get("bubbleList")) : []
|
||||
|
||||
if (currentTime.getTime() - requestTime >= this.updateTime) {
|
||||
this.getBubbleListsFunc();
|
||||
this.getBubbleListsFunc()
|
||||
Cache.set("currentIndex", 0, 300)
|
||||
return;
|
||||
return
|
||||
}
|
||||
this.timer = setInterval(() => {
|
||||
this.currentList = this.list.slice(this.index, this.index + 1);
|
||||
this.currentList = this.list.slice(this.index, this.index + 1)
|
||||
Cache.set("currentIndex", ++this.index);
|
||||
}, 4000);
|
||||
}, 4000)
|
||||
}
|
||||
},
|
||||
created() {
|
||||
var index = Cache.get("currentIndex") || 0;
|
||||
var requestTime = Cache.get("requestTime");
|
||||
var currentTime = new Date();
|
||||
var currentList = Cache.get("bubbleList") ? JSON.parse(Cache.get("bubbleList")) : [];
|
||||
var index = Cache.get("currentIndex") || 0
|
||||
var requestTime = Cache.get("requestTime")
|
||||
var currentTime = new Date()
|
||||
var currentList = Cache.get("bubbleList") ? JSON.parse(Cache.get("bubbleList")) : []
|
||||
if (currentList.length <= 0) {
|
||||
this.getBubbleListsFunc();
|
||||
this.getBubbleListsFunc()
|
||||
Cache.set("currentIndex", 0)
|
||||
} else if (index - currentList.length >= 0) {
|
||||
Cache.set("currentIndex", 0);
|
||||
Cache.set("currentIndex", 0)
|
||||
if (this.timer) {
|
||||
clearInterval(this.timer)
|
||||
this.timer = null
|
||||
}
|
||||
this.fadeUpBubble();
|
||||
this.fadeUpBubble()
|
||||
} else if (currentTime.getTime() - requestTime >= this.updateTime) {
|
||||
this.getBubbleListsFunc();
|
||||
this.getBubbleListsFunc()
|
||||
Cache.set("currentIndex", 0)
|
||||
} else {
|
||||
if (this.timer) {
|
||||
clearInterval(this.timer);
|
||||
this.timer = null;
|
||||
clearInterval(this.timer)
|
||||
this.timer = null
|
||||
}
|
||||
this.fadeUpBubble()
|
||||
}
|
||||
},
|
||||
destroyed() {
|
||||
if (this.timer) {
|
||||
clearInterval(this.timer);
|
||||
clearInterval(this.timer)
|
||||
this.timer = null
|
||||
}
|
||||
}
|
||||
|
||||
@ -86,13 +86,13 @@
|
||||
}).then(({
|
||||
data
|
||||
}) => {
|
||||
this.price_type = data.set_price_type;
|
||||
let curPageData = data.lists;
|
||||
let curPageLen = curPageData.length;
|
||||
let hasNext = !!data.more;
|
||||
if (page.num == 1) this.goodsList = [];
|
||||
this.goodsList = this.goodsList.concat(curPageData);
|
||||
this.mescroll.endSuccess(curPageLen, hasNext);
|
||||
this.price_type = data.set_price_type
|
||||
let curPageData = data.lists
|
||||
let curPageLen = curPageData.length
|
||||
let hasNext = !!data.more
|
||||
if (page.num == 1) this.goodsList = []
|
||||
this.goodsList = this.goodsList.concat(curPageData)
|
||||
this.mescroll.endSuccess(curPageLen, hasNext)
|
||||
})
|
||||
},
|
||||
async getIndexCategory() {
|
||||
@ -109,7 +109,7 @@
|
||||
})
|
||||
if (code == 1) {
|
||||
const {level_two, category_hots, category_recommend} = data
|
||||
this.category_price_type = data.set_price_type;
|
||||
this.category_price_type = data.set_price_type
|
||||
this.navList = level_two
|
||||
this.hotGoods = category_hots
|
||||
this.newGoods = category_recommend
|
||||
|
||||
@ -24,8 +24,8 @@
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
|
||||
import MescrollMoreItemMixin from "@/components/mescroll-uni/mixins/mescroll-more-item.js";
|
||||
import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js"
|
||||
import MescrollMoreItemMixin from "@/components/mescroll-uni/mixins/mescroll-more-item.js"
|
||||
|
||||
import {
|
||||
getGoodsList,
|
||||
@ -81,10 +81,9 @@
|
||||
},
|
||||
async downCallback() {
|
||||
await this.getListByLevelOneFun()
|
||||
this.mescroll.resetUpScroll();
|
||||
this.mescroll.resetUpScroll()
|
||||
},
|
||||
upCallback(page) {
|
||||
console.log('set =', this.$store.getters.hasSetId)
|
||||
const {sortConfig: {
|
||||
priceSort,
|
||||
saleSort,
|
||||
@ -100,13 +99,13 @@
|
||||
}).then(({
|
||||
data
|
||||
}) => {
|
||||
this.price_type = data.set_price_type;
|
||||
const curPageData = data.lists;
|
||||
const curPageLen = curPageData.length;
|
||||
const hasNext = !!data.more;
|
||||
if (page.num == 1) this.goodsList = [];
|
||||
this.goodsList = this.goodsList.concat(curPageData);
|
||||
this.mescroll.endSuccess(curPageLen, hasNext);
|
||||
this.price_type = data.set_price_type
|
||||
const curPageData = data.lists
|
||||
const curPageLen = curPageData.length
|
||||
const hasNext = !!data.more
|
||||
if (page.num == 1) this.goodsList = []
|
||||
this.goodsList = this.goodsList.concat(curPageData)
|
||||
this.mescroll.endSuccess(curPageLen, hasNext)
|
||||
})
|
||||
},
|
||||
async getListByLevelOneFun() {
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
<view class="p-t-20" v-if="navList.length">
|
||||
<view class="cate-nav bg-white">
|
||||
<swiper :style="'height:' + navSwiperH + 'rpx;'" @change="swiperChange">
|
||||
<swiper-item v-for="(items, index) in navList" :key="index">
|
||||
<swiper-item v-for="(items, i) in navList" :key="i">
|
||||
<view class="nav-list flex flex-wrap">
|
||||
<router-link v-for="(item, index2) in items" :key="index2" :to="{path: '/pages/goods_search/goods_search', query: {
|
||||
<router-link v-for="(item, i2) in items" :key="i2" :to="{path: '/pages/goods_search/goods_search', query: {
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
type: 1,
|
||||
@ -20,8 +20,8 @@
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
<view class="dots" v-if="navList.length > 1">
|
||||
<view v-for="(item, index) in navList" :key="index"
|
||||
:class="'dot ' + (index == currentSwiper ? 'active' : '')"></view>
|
||||
<view v-for="(item, i) in navList" :key="i"
|
||||
:class="'dot ' + (i == currentSwiper ? 'active' : '')"></view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -65,7 +65,7 @@
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.p_id = this.$store.getters.hasPid;
|
||||
this.p_id = this.$store.getters.hasPid
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<template>
|
||||
<view class="cate-one">
|
||||
<tabs @change="changeActive" v-if="cateList.length">
|
||||
<tab :name="item.name" v-for="(item, index) in cateList" :key="index">
|
||||
<cate-list v-if="showCate[index]" :top="174" ref="mescrollItem" :i="index" :index="selectIndex" :cate="item">
|
||||
<tab :name="item.name" v-for="(item, i) in cateList" :key="i">
|
||||
<cate-list v-if="showCate[i]" :top="174" ref="mescrollItem" :i="i" :index="selectIndex" :cate="item">
|
||||
</cate-list>
|
||||
</tab>
|
||||
</tabs>
|
||||
|
||||
@ -2,10 +2,10 @@
|
||||
<view class="cate-two flex" style="height: 100%;padding-bottom: 100rpx;">
|
||||
<view class="aside bg-white">
|
||||
<scroll-view style="height: 100%" scroll-y="true" scroll-with-animation="true">
|
||||
<block v-for="(item, index) in cateList" :key="index">
|
||||
<view :class="'one-item sm ' + (index == selectIndex ? 'active' : '')" @click="changeActive(index)">
|
||||
<block v-for="(item, i) in cateList" :key="i">
|
||||
<view :class="'one-item sm ' + (i == selectIndex ? 'active' : '')" @click="changeActive(i)">
|
||||
<text class="name">{{ item.name }}</text>
|
||||
<view v-if="index == selectIndex" class="active-line bg-primary"></view>
|
||||
<view v-if="i == selectIndex" class="active-line bg-primary"></view>
|
||||
</view>
|
||||
</block>
|
||||
</scroll-view>
|
||||
@ -17,7 +17,7 @@
|
||||
<ad-swipers :pid="11" height="200rpx" previous-margin="0" padding="0 0 20rpx" radius="10rpx">
|
||||
</ad-swipers>
|
||||
<view class="cate-two" v-if="appConfig.cate_style == 4">
|
||||
<view v-for="(sitem, sindex) in cateTwoList" :key="sindex" class="two-item bg-white m-b-20">
|
||||
<view v-for="(sitem, si) in cateTwoList" :key="si" class="two-item bg-white m-b-20">
|
||||
<router-link :to="{path: '/pages/goods_search/goods_search', query: {
|
||||
id: sitem.id,
|
||||
name: sitem.name,
|
||||
@ -30,7 +30,7 @@
|
||||
</view>
|
||||
</router-link>
|
||||
<view class="three-list flex flex-wrap">
|
||||
<router-link class="three-item" v-for="(titem, tindex) in sitem.children" :key="tindex"
|
||||
<router-link class="three-item" v-for="(titem, ti) in sitem.children" :key="ti"
|
||||
:to="{path: '/pages/goods_search/goods_search', query: {
|
||||
id: titem.id,
|
||||
name: titem.name,
|
||||
@ -51,7 +51,7 @@
|
||||
</view>
|
||||
<view class="goods">
|
||||
<view class="goods-list">
|
||||
<router-link v-for="(item, index) in goodsList" :key="index"
|
||||
<router-link v-for="(item, i) in goodsList" :key="i"
|
||||
:to="`/pages/goods_details/goods_details?id=${item.id}`">
|
||||
<view class="flex item bg-white m-t-20">
|
||||
<view style="position: relative;">
|
||||
|
||||
@ -12,8 +12,6 @@
|
||||
<view class="column-wrap">
|
||||
<view class="item flex-col m-r-50 muted" v-for="(item, index) in columnList" :key="index" @tap="changeActive(index)">
|
||||
<view class="sm normal title" :class="{bold: active == index}">{{item.name}}</view>
|
||||
<!-- <view class="m-t-8 xs text-center" :class="{normal : active == index}">{{item.remark}}</view>
|
||||
<view v-if="active == index" class="line br60"></view> -->
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
@ -67,17 +65,17 @@
|
||||
methods: {
|
||||
async getData() {
|
||||
await this.getGoodsColumnFun()
|
||||
this.mescroll.resetUpScroll();
|
||||
this.mescroll.resetUpScroll()
|
||||
},
|
||||
changeActive(index) {
|
||||
this.active = index
|
||||
this.$refs.uWaterfall.clear();
|
||||
this.mescroll.resetUpScroll();
|
||||
this.$refs.uWaterfall.clear()
|
||||
this.mescroll.resetUpScroll()
|
||||
},
|
||||
upCallback(page) {
|
||||
const {columnList, active} = this
|
||||
const pageNum = page.num;
|
||||
const pageSize = page.size;
|
||||
const pageNum = page.num
|
||||
const pageSize = page.size
|
||||
if(!columnList.length) return
|
||||
const columnId = columnList[active].id
|
||||
getGoodsListColumn({
|
||||
@ -89,13 +87,13 @@
|
||||
}).then(({
|
||||
data
|
||||
}) => {
|
||||
this.price_type = data.set_price_type;
|
||||
let curPageData = data.lists;
|
||||
let curPageLen = curPageData.length;
|
||||
let hasNext = !!data.more;
|
||||
if (page.num == 1) this.goodsList = [];
|
||||
this.goodsList = this.goodsList.concat(curPageData);
|
||||
this.mescroll.endSuccess(curPageLen, hasNext);
|
||||
this.price_type = data.set_price_type
|
||||
let curPageData = data.lists
|
||||
let curPageLen = curPageData.length
|
||||
let hasNext = !!data.more
|
||||
if (page.num == 1) this.goodsList = []
|
||||
this.goodsList = this.goodsList.concat(curPageData)
|
||||
this.mescroll.endSuccess(curPageLen, hasNext)
|
||||
})
|
||||
},
|
||||
async getGoodsColumnFun() {
|
||||
@ -113,16 +111,20 @@
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.zx {
|
||||
background-color: #fff;
|
||||
background: #fff;
|
||||
margin: 0 30rpx;
|
||||
border-radius: 40rpx;
|
||||
}
|
||||
|
||||
.goods {
|
||||
margin-top: -6rpx;
|
||||
}
|
||||
|
||||
.goods-column {
|
||||
.column-wrap {
|
||||
display: inline-block;
|
||||
white-space: nowrap;
|
||||
padding: 30rpx;
|
||||
padding: 20rpx 20rpx 0;
|
||||
|
||||
.item {
|
||||
display: inline-block;
|
||||
@ -131,18 +133,10 @@
|
||||
.title {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
background-color: #fff;
|
||||
background: #fff;
|
||||
border-radius: 20rpx;
|
||||
padding: 10rpx 20rpx;
|
||||
}
|
||||
// .line {
|
||||
// position: absolute;
|
||||
// top: 32rpx;
|
||||
// left: 0;
|
||||
// width: 144rpx;
|
||||
// height: 12rpx;
|
||||
// background: linear-gradient(90deg, #FF2C3C 0%, rgba(255, 44, 60, 0) 100%);
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,9 +35,11 @@
|
||||
|
||||
<view class="container flex m-t-20">
|
||||
<view class="section hot-sale">
|
||||
<view class="header row-center">
|
||||
<u-image :src="aliOSS + 'uniapp/rxbd.png'" width="160" height="80" mode="aspectFit"></u-image>
|
||||
</view>
|
||||
<router-link to="/pages/active_list/active_list?type=hot">
|
||||
<view class="header row-center">
|
||||
<u-image :src="aliOSS + 'uniapp/rxbd.png'" width="160" height="80" mode="aspectFit"></u-image>
|
||||
</view>
|
||||
</router-link>
|
||||
<view class="content">
|
||||
<swiper class="swiper" :autoplay="true" :interval="3000" style="height: 500rpx;">
|
||||
<swiper-item v-for="(item, index) in hotListGoods" :key="index">
|
||||
@ -64,7 +66,7 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view style="width: 54%;margin-left: 20rpx;">
|
||||
<view class="m-l-20" style="width: 54%;">
|
||||
<view class="section special-price">
|
||||
<router-link to="/bundle_b/pages/panic_buying/index">
|
||||
<view class="header row-between">
|
||||
|
||||
44
pages.json
44
pages.json
@ -1,5 +1,5 @@
|
||||
{
|
||||
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
|
||||
"pages": [
|
||||
{
|
||||
"path": "pages/index/index",
|
||||
"name": "index",
|
||||
@ -28,17 +28,6 @@
|
||||
"disableScroll": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/shop_street/shop_street",
|
||||
"name": "shop_street",
|
||||
"meta": {
|
||||
"auth": false,
|
||||
"keepScroll": true
|
||||
},
|
||||
"style": {
|
||||
"navigationBarTitleText": "店铺街"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/new_goods/index",
|
||||
"name": "new_goods",
|
||||
@ -250,16 +239,27 @@
|
||||
"subPackages": [{
|
||||
"root": "bundle",
|
||||
"pages": [
|
||||
// {
|
||||
// "path": "pages/community/community",
|
||||
// "meta": {
|
||||
// "auth": false,
|
||||
// "keepScroll": true
|
||||
// },
|
||||
// "style": {
|
||||
// "navigationBarTitleText": "种草"
|
||||
// }
|
||||
// },
|
||||
{
|
||||
"path": "pages/community/community",
|
||||
"meta": {
|
||||
"auth": false,
|
||||
"keepScroll": true
|
||||
},
|
||||
"style": {
|
||||
"navigationBarTitleText": "种草"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/shop_street/shop_street",
|
||||
"name": "shop_street",
|
||||
"meta": {
|
||||
"auth": false,
|
||||
"keepScroll": true
|
||||
},
|
||||
"style": {
|
||||
"navigationBarTitleText": "店铺街"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/news_list/news_list",
|
||||
"meta": {
|
||||
|
||||
@ -77,7 +77,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<view class="goods-info bg-white">
|
||||
<view class="info-header flex" v-if="goodsType != 1 && goodsType != 4">
|
||||
<view class="price flex flex-1">
|
||||
@ -85,11 +85,12 @@
|
||||
<view class="xs lighter m-r-10" v-if="p_id > 0">零售价: </view>
|
||||
<price-format :first-size="46" :second-size="32" :subscript-size="32"
|
||||
:price="goodsDetail.min_price" :weight="500"></price-format>
|
||||
<price-format v-if="p_id == 0" class="line-through muted md m-l-10" :price="goodsDetail.market_price"></price-format>
|
||||
|
||||
<price-format v-if="p_id == 0" class="line-through muted md m-l-10"
|
||||
:price="goodsDetail.market_price"></price-format>
|
||||
|
||||
<subsidy-txt class="m-l-20" :txt="goodsDetail.subsidy_txt"></subsidy-txt>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
<!-- <view class="vip-price flex" v-if="goodsType == 0 && goodsDetail.member_price && p_id == 0">
|
||||
<view class="price-name xxs">会员价</view>
|
||||
@ -229,12 +230,14 @@
|
||||
<view class="line-1 m-r-20 flex-1">{{ checkedGoods.spec_value_str || '默认' }}</view>
|
||||
<u-icon name="arrow-right"></u-icon>
|
||||
</view>
|
||||
<view class="spec flex bg-white m-t-20" v-if="goodsDetail.remark">
|
||||
<view class="m-r-20">{{goodsDetail.remark}}</view>
|
||||
|
||||
<view class="spec flex bg-white m-t-20" v-if="goodsDetail.platform_shop_note">
|
||||
<view class="m-r-20">{{goodsDetail.platform_shop_note}}</view>
|
||||
</view>
|
||||
<view class="spec flex bg-white m-t-20" v-if="goodsDetail.goods_remark">
|
||||
|
||||
<!-- <view class="spec flex bg-white m-t-20" v-if="goodsDetail.goods_remark">
|
||||
<view class="m-r-20">{{goodsDetail.goods_remark}}</view>
|
||||
</view>
|
||||
</view> -->
|
||||
<view class="evaluation bg-white m-t-20" id="evaluation">
|
||||
<router-link :to="{path: '/bundle/pages/all_comments/all_comments', query: {id: goodsDetail.id}}">
|
||||
<view class="title flex row-between">
|
||||
@ -436,7 +439,7 @@
|
||||
act_id: 0
|
||||
};
|
||||
},
|
||||
|
||||
|
||||
onUnload() {
|
||||
if (this.invite_code != '') {
|
||||
this.p_id = 0;
|
||||
@ -446,14 +449,14 @@
|
||||
this.see_wholesale = false;
|
||||
}
|
||||
},
|
||||
|
||||
async onLoad() {
|
||||
|
||||
async onLoad() {
|
||||
this.p_id = this.$store.getters.hasPid;
|
||||
this.set = this.$store.getters.hasSetId;
|
||||
const options = this.$Route.query;
|
||||
if (options) {
|
||||
this.activity_sn = options.activity_sn || 0
|
||||
|
||||
|
||||
this.act_id = options?.act_id
|
||||
if (options.scene) {
|
||||
// 生成海报 区分普通商品和集采、代发、批发
|
||||
@ -509,7 +512,7 @@
|
||||
await this.getGoodsDetailFun();
|
||||
await this.getCartNum();
|
||||
},
|
||||
|
||||
|
||||
onPageScroll(e) {
|
||||
const top = uni.upx2px(500)
|
||||
const {
|
||||
@ -534,10 +537,10 @@
|
||||
this.active = index
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
methods: {
|
||||
...mapActions(['getCartNum', 'wxShare']),
|
||||
|
||||
|
||||
changeActive(index) {
|
||||
this.isTouchStart = false
|
||||
|
||||
@ -600,7 +603,7 @@
|
||||
in_groupbuy_activity,
|
||||
msg
|
||||
} = activity; //秒杀时间
|
||||
|
||||
|
||||
//拼团的结束时间-现在的时间 = 剩余的时间
|
||||
let time = end_time ? end_time - Date.now() / 1000 : info ? info.activity_end_time -
|
||||
Date.now() / 1000 : 0;
|
||||
@ -635,7 +638,7 @@
|
||||
};
|
||||
this.wxShare(options);
|
||||
// #endif
|
||||
|
||||
|
||||
// 抢购
|
||||
if (this.goodsType == 4 && in_groupbuy_activity && msg) {
|
||||
this.$toast({
|
||||
@ -691,7 +694,7 @@
|
||||
},
|
||||
onBuy(e) {
|
||||
if (!this.isLogin) return this.$Router.push('/pages/login/login')
|
||||
|
||||
|
||||
const {
|
||||
id,
|
||||
goodsNum,
|
||||
@ -736,7 +739,7 @@
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
onConfirm(e) {
|
||||
const {
|
||||
team: {
|
||||
@ -815,35 +818,52 @@
|
||||
uni.makePhoneCall({
|
||||
phoneNumber: this.shop.mobile.toString() //仅为示例
|
||||
});
|
||||
}
|
||||
},
|
||||
async onShareAppMessage() {
|
||||
const {
|
||||
goodsDetail,
|
||||
inviteCode,
|
||||
team,
|
||||
activity_sn
|
||||
} = this;
|
||||
|
||||
let url = '/pages/goods_details/goods_details?id=' + this.id + "&invite_code=" + inviteCode +
|
||||
'&path=goods_details&activity_sn=' + activity_sn;
|
||||
if (this.p_id) {
|
||||
url += '&p_id=' + this.p_id;
|
||||
if (this.goodsDetail.set_price_type == 0 || this.goodsDetail.set_price_type == 3) {
|
||||
url += '&see_wholesale=see'
|
||||
},
|
||||
|
||||
share() {
|
||||
const {
|
||||
goodsDetail,
|
||||
inviteCode,
|
||||
team,
|
||||
activity_sn,
|
||||
id,
|
||||
p_id,
|
||||
set
|
||||
} = this;
|
||||
|
||||
let url =
|
||||
`/pages/goods_details/goods_details?id=${id}&invite_code=${inviteCode}&path=goods_details&activity_sn=${activity_sn}`
|
||||
|
||||
if (p_id) {
|
||||
url += `&p_id=${p_id}`
|
||||
const {
|
||||
set_price_type
|
||||
} = goodsDetail;
|
||||
if (set_price_type == 0 || set_price_type == 3) {
|
||||
url += '&see_wholesale=see'
|
||||
}
|
||||
}
|
||||
|
||||
if (set) {
|
||||
url += `&set=${set}`
|
||||
}
|
||||
|
||||
return {
|
||||
title: team.share_title || goodsDetail.name,
|
||||
imageUrl: goodsDetail.image,
|
||||
path: url
|
||||
};
|
||||
}
|
||||
|
||||
if (this.set) {
|
||||
url += '&set=' + this.set;
|
||||
}
|
||||
|
||||
return {
|
||||
title: team.share_title || goodsDetail.name,
|
||||
imageUrl: goodsDetail.image,
|
||||
path: url
|
||||
};
|
||||
},
|
||||
|
||||
async onShareAppMessage() {
|
||||
return this.share()
|
||||
},
|
||||
|
||||
onShareTimeline() {
|
||||
return this.share()
|
||||
},
|
||||
|
||||
computed: {
|
||||
...mapGetters(['cartNum', 'inviteCode', 'sysInfo', 'appConfig', 'userInfo']),
|
||||
btnText() {
|
||||
|
||||
@ -1,189 +0,0 @@
|
||||
<template>
|
||||
<view class="shop-street">
|
||||
<mescroll-body v-if="appConfig.shop_street_hide" ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :up="upOption">
|
||||
<view class="shop-street-content">
|
||||
<view class="search">
|
||||
<u-search v-model="keyword" @search="onReflesh" bg-color="#F4F4F4" placeholder="搜索关键词"></u-search>
|
||||
</view>
|
||||
<scroll-view class="bg-white" :scroll-x="true" :scroll-with-animation="true">
|
||||
<view class="store-category p-t-20">
|
||||
<view class="category-item flex-col col-center" @tap="changeActive(-1)">
|
||||
<view class="icon-wrap" :style="{borderColor: active == -1 ? colorConfig.primary : ''}">
|
||||
<u-image width="68rpx" height="68rpx" border-radius="60rpx" :src="aliOSS + 'uniapp/icon_shop_cate.png'" />
|
||||
</view>
|
||||
<view class="xs m-t-10" :class="{primary: active == -1}">全部</view>
|
||||
</view>
|
||||
<view class="category-item flex-col col-center" v-for="(item,index) in shopCategory" :key="index"
|
||||
@tap="changeActive(index)">
|
||||
<view class="icon-wrap" :style="{borderColor: active == index ? colorConfig.primary : ''}">
|
||||
<u-image width="68rpx" height="68rpx" border-radius="60rpx" :src="item.image" />
|
||||
</view>
|
||||
<view class="xs m-t-10" :class="{primary: active == index}">{{item.name}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="store-container">
|
||||
<view class="m-t-20" v-for="(item, index) in shopList" :key="index">
|
||||
<shop-item :item="item" :price-type="price_type"></shop-item>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</mescroll-body>
|
||||
<view v-else>
|
||||
<view class="p-b-20" v-if="hotGoods.length">
|
||||
<goods-list type="one" :list="hotGoods" :price-type="home_price_type"></goods-list>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapGetters,
|
||||
mapActions
|
||||
} from 'vuex'
|
||||
import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins";
|
||||
import {
|
||||
getShopList,
|
||||
getShopCategory
|
||||
} from "@/api/shop"
|
||||
import {
|
||||
getHome,
|
||||
} from "@/api/store"
|
||||
export default {
|
||||
mixins: [MescrollMixin],
|
||||
data() {
|
||||
return {
|
||||
shopList: [],
|
||||
shopCategory: [],
|
||||
keyword: '',
|
||||
active: -1,
|
||||
upOption: {
|
||||
auto: false,
|
||||
empty: {
|
||||
icon: `${this.$aliOSS}uniapp/goods_null.png`,
|
||||
tip: "暂无数据~",
|
||||
},
|
||||
},
|
||||
hotGoods: [],
|
||||
p_id:0,
|
||||
set: 0,
|
||||
price_type: 0,
|
||||
home_price_type: 0
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.p_id = this.$store.getters.hasPid;
|
||||
this.set = this.$store.getters.hasSetId;
|
||||
|
||||
if(!this.appConfig.shop_street_hide) {
|
||||
uni.setNavigationBarTitle({
|
||||
title: "商品"
|
||||
})
|
||||
this.getHomeFun()
|
||||
}
|
||||
this.getCartNum()
|
||||
},
|
||||
onShareAppMessage() {
|
||||
const shareInfo = this.appConfig.share
|
||||
return {
|
||||
title: shareInfo.mnp_share_title,
|
||||
path: "pages/shop_street/shop_street?invite_code=" + this.inviteCode
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
...mapActions(['getCartNum']),
|
||||
async downCallback() {
|
||||
|
||||
await this.getShopCategoryFun()
|
||||
this.mescroll.resetUpScroll();
|
||||
},
|
||||
// 获取首页数据
|
||||
async getHomeFun() {
|
||||
const {
|
||||
code,
|
||||
data
|
||||
} = await getHome({p_id: this.p_id, set: this.set});
|
||||
if (code == 1) {
|
||||
this.home_price_type = data.set_price_type;
|
||||
this.hotGoods = data.hots
|
||||
}
|
||||
},
|
||||
onReflesh() {
|
||||
this.shopList = []
|
||||
this.mescroll.resetUpScroll();
|
||||
},
|
||||
changeActive(index) {
|
||||
this.active = index
|
||||
this.onReflesh()
|
||||
},
|
||||
upCallback(page) {
|
||||
|
||||
let pageNum = page.num;
|
||||
let pageSize = page.size;
|
||||
const {
|
||||
keyword,
|
||||
active,
|
||||
shopCategory
|
||||
} = this
|
||||
const cateId = active == -1 ? '' : shopCategory[active].id
|
||||
getShopList({
|
||||
page_no: pageNum,
|
||||
page_size: pageSize,
|
||||
name: keyword,
|
||||
shop_cate_id: cateId,
|
||||
p_id: this.p_id,
|
||||
set: this.set
|
||||
}).then(res => {
|
||||
if (res.code == 1) {
|
||||
this.price_type = res.data.set_price_type;
|
||||
let curPageData = res.data.list;
|
||||
let curPageLen = curPageData.length;
|
||||
let hasNext = !!res.data.more;
|
||||
if (page.num == 1) {
|
||||
this.shopList = [];
|
||||
}
|
||||
this.shopList = this.shopList.concat(curPageData);
|
||||
this.mescroll.endSuccess(curPageLen, hasNext);
|
||||
}
|
||||
}).catch(err => {
|
||||
this.mescroll.endErr()
|
||||
})
|
||||
},
|
||||
async getShopCategoryFun() {
|
||||
const {
|
||||
code,
|
||||
data
|
||||
} = await getShopCategory()
|
||||
if (code == 1) {
|
||||
this.shopCategory = data
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.shop-street {
|
||||
.search {}
|
||||
|
||||
.store-category {
|
||||
white-space: nowrap;
|
||||
padding-bottom: 10rpx;
|
||||
|
||||
.category-item {
|
||||
display: inline-flex;
|
||||
padding: 0 30rpx;
|
||||
.icon-wrap {
|
||||
border: 1px solid transparent;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.store-container {
|
||||
padding: 0 30rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in New Issue
Block a user