支持活动配置插件+细节优化
parent
ffd1d12cbc
commit
86f833dd0b
2
App.vue
2
App.vue
|
|
@ -34,7 +34,7 @@
|
|||
"/pages/user/user"
|
||||
],
|
||||
// 请求地址
|
||||
request_url: 'https://dev.shopxo.vip/',
|
||||
request_url: 'http://shopxo.com/',
|
||||
// 静态资源地址
|
||||
static_url: 'https://d1.shopxo.vip/',
|
||||
// 基础信息
|
||||
|
|
|
|||
16
pages.json
16
pages.json
|
|
@ -632,7 +632,21 @@
|
|||
"enablePullDownRefresh": true,
|
||||
"navigationBarTitleText": "店铺收藏"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/plugins/activity/index/index",
|
||||
"style": {
|
||||
"enablePullDownRefresh": true,
|
||||
"navigationBarTitleText": "所有活动"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/plugins/activity/detail/detail",
|
||||
"style": {
|
||||
"enablePullDownRefresh": true,
|
||||
"navigationBarTitleText": "活动详情"
|
||||
}
|
||||
}
|
||||
],
|
||||
"subPackages": [],
|
||||
"globalStyle": {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
<block v-for="(v, index) in data_list" :key="index">
|
||||
<view class="content-item padding-sm tc" :data-value="v.id" @tap="category_event">
|
||||
<view class="content bg-white wh-auto border-radius-main">
|
||||
<image v-if="(v.icon || null) != null" :src="v.icon" mode="aspectFit" class="icon"></image>
|
||||
<image v-if="(v.icon || null) != null" :src="v.icon" mode="aspectFit" class="icon radius"></image>
|
||||
<view class="text single-text">{{v.name}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -45,8 +45,7 @@
|
|||
<block v-for="(v, index) in data_content.items" :key="index">
|
||||
<view class="content-item padding-sm tc" :data-value="v.id" @tap="category_event">
|
||||
<view class="content wh-auto">
|
||||
<image v-if="(v.icon || null) != null" :src="v.icon" mode="aspectFit"
|
||||
class="icon"></image>
|
||||
<image v-if="(v.icon || null) != null" :src="v.icon" mode="aspectFit" class="icon radius"></image>
|
||||
<view class="text single-text">{{v.name}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -61,12 +60,11 @@
|
|||
<text v-if="floor.describe.length > 0" class="vice-name margin-left-lg cr-gray">{{floor.describe}}</text>
|
||||
<view :data-value="v.id" @tap="category_event" class="arrow-right padding-right-xxxl cr-gray fr">更多</view>
|
||||
</view>
|
||||
<!-- <view class="tc two-name" :data-value="v.id" @tap="category_event">{{v.name}}</view> -->
|
||||
<view v-if="v.items.length > 0" class="bg-white oh padding-main border-radius-main spacing-mb">
|
||||
<block v-for="(vs, index2) in v.items" :key="index2">
|
||||
<view class="content-item padding-sm tc" :data-value="vs.id" @tap="category_event">
|
||||
<view class="content wh-auto">
|
||||
<image v-if="(vs.icon || null) != null" :src="vs.icon" mode="aspectFit" class="icon"></image>
|
||||
<image v-if="(vs.icon || null) != null" :src="vs.icon" mode="aspectFit" class="icon radius"></image>
|
||||
<view class="text single-text">{{vs.name}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
<!-- 商城公告 -->
|
||||
<view class="notice-content spacing-mb" v-if="load_status == 1 && (common_shop_notice || null) != null">{{common_shop_notice}}</view>
|
||||
|
||||
<!-- 限时秒杀 -->
|
||||
<!-- 限时秒杀 - 插件 -->
|
||||
<view v-if="plugins_seckill_is_valid == 1 && plugins_seckill_data.goods.length > 0" class="seckill spacing-mb">
|
||||
<view class="spacing-nav-title">
|
||||
<text class="text-wrapper va-m">限时秒杀</text>
|
||||
|
|
@ -60,7 +60,40 @@
|
|||
</swiper>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- 活动信息-楼层顶部 - 插件 -->
|
||||
<view v-if="(plugins_activity_data || null) != null && plugins_activity_data.length > 0" class="activity">
|
||||
<block v-for="(floor, index) in plugins_activity_data" :key="index">
|
||||
<view v-if="floor.goods_list.length > 0 && (floor.home_data_location || 0) == 0" class="floor">
|
||||
<view class="spacing-nav-title">
|
||||
<text class="text-wrapper" :style="'color:'+(floor.color || '#333')+';'">{{floor.title}}</text>
|
||||
<text v-if="(floor.vice_title || null) != null" class="vice-name margin-left-lg cr-gray">{{floor.vice_title}}</text>
|
||||
<navigator :url="'/pages/plugins/activity/detail/detail?id=' + floor.id" hover-class="none" class="arrow-right padding-right-xxxl cr-gray fr">更多</navigator>
|
||||
</view>
|
||||
<view class="floor-list wh-auto oh">
|
||||
<view v-if="floor.keywords_arr.length > 0" class="word scroll-view-horizontal">
|
||||
<scroll-view scroll-x>
|
||||
<block v-for="(kv, ki) in floor.keywords_arr" :key="ki">
|
||||
<navigator :url="'/pages/goods-search/goods-search?keywords=' + kv" hover-class="none" class="word-icon dis-inline-block bg-main-light text-size-xs cr-main round padding-top-xs padding-bottom-xs padding-left padding-right">{{kv}}</navigator>
|
||||
</block>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view class="goods-list margin-top-lg">
|
||||
<view v-for="(goods, index2) in floor.goods_list" :key="index2" class="goods bg-white border-radius-main oh">
|
||||
<navigator :url="'/pages/goods-detail/goods-detail?goods_id=' + goods.id" hover-class="none">
|
||||
<image :src="goods.images" mode="aspectFit"></image>
|
||||
<view class="goods-base padding-left-lg padding-right-lg">
|
||||
<view class="goods-title multi-text margin-bottom-sm">{{goods.title}}</view>
|
||||
<view class="sales-price">{{currency_symbol}}{{goods.min_price}}</view>
|
||||
</view>
|
||||
</navigator>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
|
||||
<!-- 楼层数据 -->
|
||||
<block v-if="(data_list || nul) != null && data_list.length > 0">
|
||||
<!-- 数据模式0,1自动+手动、2拖拽 -->
|
||||
|
|
@ -70,19 +103,17 @@
|
|||
</block>
|
||||
<block v-else>
|
||||
<!-- 自动+手动 -->
|
||||
<view v-for="(floor, index) in data_list" :key="index" class="floor spacing-mb">
|
||||
<view v-for="(floor, index) in data_list" :key="index" class="floor">
|
||||
<view class="spacing-nav-title">
|
||||
<text class="text-wrapper">{{floor.name}}</text>
|
||||
<text v-if="floor.describe.length > 0" class="vice-name margin-left-lg cr-gray">{{floor.describe}}</text>
|
||||
<text class="text-wrapper" :style="'color:'+(floor.bg_color || '#333')+';'">{{floor.name}}</text>
|
||||
<text v-if="(floor.describe || null) != null" class="vice-name margin-left-lg cr-gray">{{floor.describe}}</text>
|
||||
<navigator :url="'/pages/goods-search/goods-search?category_id=' + floor.id" hover-class="none" class="arrow-right padding-right-xxxl cr-gray fr">更多</navigator>
|
||||
</view>
|
||||
<view class="floor-list wh-auto oh">
|
||||
<view class="word scroll-view-horizontal">
|
||||
<view v-if="floor.items.length > 0" class="word scroll-view-horizontal">
|
||||
<scroll-view scroll-x>
|
||||
<block v-if="floor.items.length > 0">
|
||||
<block v-for="(icv, icx) in floor.items" :key="icx">
|
||||
<navigator :url="'/pages/goods-search/goods-search?category_id=' + icv.id" hover-class="none" class="word-icon dis-inline-block bg-main-light text-size-xs cr-main round padding-top-xs padding-bottom-xs padding-left padding-right">{{icv.name}}</navigator>
|
||||
</block>
|
||||
<block v-for="(icv, icx) in floor.items" :key="icx">
|
||||
<navigator :url="'/pages/goods-search/goods-search?category_id=' + icv.id" hover-class="none" class="word-icon dis-inline-block bg-main-light text-size-xs cr-main round padding-top-xs padding-bottom-xs padding-left padding-right">{{icv.name}}</navigator>
|
||||
</block>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
|
@ -100,13 +131,42 @@
|
|||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</block>
|
||||
<block v-else>
|
||||
<!-- 提示信息 -->
|
||||
<component-no-data :prop-status="data_list_loding_status" :prop-msg="data_list_loding_msg"></component-no-data>
|
||||
</block>
|
||||
</block>
|
||||
|
||||
<!-- 活动信息-楼层底部 - 插件 -->
|
||||
<view v-if="(plugins_activity_data || null) != null && plugins_activity_data.length > 0" class="activity">
|
||||
<block v-for="(floor, index) in plugins_activity_data" :key="index">
|
||||
<view v-if="floor.goods_list.length > 0 && (floor.home_data_location || 0) == 1" class="floor">
|
||||
<view class="spacing-nav-title">
|
||||
<text class="text-wrapper" :style="'color:'+(floor.color || '#333')+';'">{{floor.title}}</text>
|
||||
<text v-if="(floor.vice_title || null) != null" class="vice-name margin-left-lg cr-gray">{{floor.vice_title}}</text>
|
||||
<navigator :url="'/pages/plugins/activity/detail/detail?id=' + floor.id" hover-class="none" class="arrow-right padding-right-xxxl cr-gray fr">更多</navigator>
|
||||
</view>
|
||||
<view class="floor-list wh-auto oh">
|
||||
<view v-if="floor.keywords_arr.length > 0" class="word scroll-view-horizontal">
|
||||
<scroll-view scroll-x>
|
||||
<block v-for="(kv, ki) in floor.keywords_arr" :key="ki">
|
||||
<navigator :url="'/pages/goods-search/goods-search?keywords=' + kv" hover-class="none" class="word-icon dis-inline-block bg-main-light text-size-xs cr-main round padding-top-xs padding-bottom-xs padding-left padding-right">{{kv}}</navigator>
|
||||
</block>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view class="goods-list margin-top-lg">
|
||||
<view v-for="(goods, index2) in floor.goods_list" :key="index2" class="goods bg-white border-radius-main oh">
|
||||
<navigator :url="'/pages/goods-detail/goods-detail?goods_id=' + goods.id" hover-class="none">
|
||||
<image :src="goods.images" mode="aspectFit"></image>
|
||||
<view class="goods-base padding-left-lg padding-right-lg">
|
||||
<view class="goods-title multi-text margin-bottom-sm">{{goods.title}}</view>
|
||||
<view class="sales-price">{{currency_symbol}}{{goods.min_price}}</view>
|
||||
</view>
|
||||
</navigator>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
|
||||
<!--- 底部购买记录 -->
|
||||
<!--- 底部购买记录 - 插件 -->
|
||||
<view v-if="(plugins_salerecords_data || null) != null && (plugins_salerecords_data.data || null) != null && plugins_salerecords_data.data.length > 0" class="spacing-mb plugins-salerecords">
|
||||
<view class="spacing-nav-title">
|
||||
<text class="text-wrapper">{{plugins_salerecords_data.base.home_bottom_title || '最新购买'}}</text>
|
||||
|
|
@ -142,14 +202,17 @@
|
|||
<image mode="widthFix" :src="static_url+'answer-form.jpg'" class="wh-auto border-radius-main"></image>
|
||||
</navigator>
|
||||
</view>
|
||||
|
||||
<!-- 结尾 -->
|
||||
<component-bottom-line :prop-status="data_bottom_line_status"></component-bottom-line>
|
||||
|
||||
<!-- 版权信息 -->
|
||||
<view v-if="load_status == 1">
|
||||
<component-copyright></component-copyright>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 提示信息 -->
|
||||
<component-no-data :prop-status="data_list_loding_status" :prop-msg="data_list_loding_msg"></component-no-data>
|
||||
|
||||
<!-- 结尾 -->
|
||||
<component-bottom-line :prop-status="data_bottom_line_status"></component-bottom-line>
|
||||
|
||||
<!-- 版权信息 -->
|
||||
<view v-if="load_status == 1">
|
||||
<component-copyright></component-copyright>
|
||||
</view>
|
||||
|
||||
<!-- 在线客服 -->
|
||||
|
|
@ -194,18 +257,20 @@
|
|||
common_app_is_enable_search: 0,
|
||||
common_app_is_enable_answer: 0,
|
||||
common_app_is_header_nav_fixed: 0,
|
||||
common_app_is_online_service: 0,
|
||||
common_app_is_online_service: 0,
|
||||
// 名称
|
||||
application_title: app.globalData.data.application_title,
|
||||
// 顶部+搜索样式配置
|
||||
top_content_style: 'background-image: url("'+static_url+'nav-top.png");'+'padding-top:'+(parseInt(app.globalData.get_system_info('statusBarHeight'))+5)+'px;',
|
||||
search_style: '',
|
||||
search_is_fixed: 0,
|
||||
// 限时秒杀插件
|
||||
plugins_seckill_is_valid: 0,
|
||||
plugins_seckill_data: null,
|
||||
// 购买记录插件
|
||||
plugins_salerecords_data: null,
|
||||
// 顶部+搜索样式配置
|
||||
top_content_style: 'background-image: url("'+static_url+'nav-top.png");'+'padding-top:'+(parseInt(app.globalData.get_system_info('statusBarHeight'))+5)+'px;',
|
||||
search_style: '',
|
||||
search_is_fixed: 0,
|
||||
// 名称
|
||||
application_title: app.globalData.data.application_title,
|
||||
plugins_salerecords_data: null,
|
||||
// 活动插件
|
||||
plugins_activity_data: null
|
||||
};
|
||||
},
|
||||
|
||||
|
|
@ -308,7 +373,8 @@
|
|||
data_list_loding_status: data.data_list.length == 0 ? 0 : 3,
|
||||
plugins_seckill_data: data.plugins_seckill_data || null,
|
||||
plugins_seckill_is_valid: (data.plugins_seckill_data || null) != null && (data.plugins_seckill_data.is_valid || 0) == 1 ? 1 : 0,
|
||||
plugins_salerecords_data: (data.plugins_salerecords_data || null) == null || data.plugins_salerecords_data.length <= 0 ? null : data.plugins_salerecords_data
|
||||
plugins_salerecords_data: (data.plugins_salerecords_data || null) == null || data.plugins_salerecords_data.length <= 0 ? null : data.plugins_salerecords_data,
|
||||
plugins_activity_data: (data.plugins_activity_data || null) == null || data.plugins_activity_data.length <= 0 ? null : data.plugins_activity_data
|
||||
});
|
||||
|
||||
// 导航购物车处理
|
||||
|
|
@ -320,7 +386,8 @@
|
|||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_list_loding_status: 0,
|
||||
data_list_loding_msg: res.data.msg,
|
||||
data_bottom_line_status: true
|
||||
});
|
||||
app.globalData.showToast(res.data.msg);
|
||||
|
|
@ -329,7 +396,8 @@
|
|||
fail: () => {
|
||||
uni.stopPullDownRefresh();
|
||||
this.setData({
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: '服务器请求出错',
|
||||
data_bottom_line_status: true,
|
||||
load_status: 1
|
||||
});
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
/**
|
||||
* 基础
|
||||
*/
|
||||
.base-container {
|
||||
padding: 50rpx 20rpx 50rpx 20rpx;
|
||||
}
|
||||
.base-container image {
|
||||
width: 200rpx !important;
|
||||
height: 200rpx !important;
|
||||
}
|
||||
.word-content .word-icon:not(:last-child) {
|
||||
margin-right: 20rpx;
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品列表
|
||||
*/
|
||||
.data-list .item {
|
||||
width: calc(50% - 50rpx);
|
||||
}
|
||||
.data-list .item:nth-child(2n) {
|
||||
float: right;
|
||||
}
|
||||
.data-list .item:nth-child(2n+1) {
|
||||
float: left;
|
||||
}
|
||||
.data-list .item image {
|
||||
width: 100%;
|
||||
height: 380rpx !important;
|
||||
}
|
||||
|
|
@ -0,0 +1,173 @@
|
|||
<template>
|
||||
<view>
|
||||
<view v-if="(data || null) != null">
|
||||
<view class="padding-horizontal-main padding-top-main">
|
||||
<!-- 基础信息 -->
|
||||
<view class="base-container tc border-radius-main bg-main spacing-mb" :style="'background-color:'+data.color+' !important;'">
|
||||
<image class="dis-block circle auto" :src="data.cover" mode="widthFix"></image>
|
||||
<view class="cr-white margin-top-lg">{{data.describe}}</view>
|
||||
</view>
|
||||
|
||||
<view v-if="data.keywords_arr.length > 0" class="word-content scroll-view-horizontal margin-bottom-sm">
|
||||
<scroll-view scroll-x>
|
||||
<block v-for="(kv, ki) in data.keywords_arr" :key="ki">
|
||||
<navigator :url="'/pages/goods-search/goods-search?keywords=' + kv" hover-class="none" class="word-icon dis-inline-block bg-main-light text-size-xs cr-main round padding-top-xs padding-bottom-xs padding-left padding-right">{{kv}}</navigator>
|
||||
</block>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
<!-- 推荐商品 -->
|
||||
<view v-if="(data.goods_list || null) != null && data.goods_list.length > 0">
|
||||
<view class="spacing-nav-title">
|
||||
<text class="text-wrapper">活动商品</text>
|
||||
<text class="cr-grey text-size-xs margin-left-lg">{{data.vice_title}}</text>
|
||||
<navigator url="/pages/plugins/activity/index/index" hover-class="none" class="arrow-right padding-right-xxxl cr-gray fr">更多活动</navigator>
|
||||
</view>
|
||||
<view class="data-list oh">
|
||||
<view v-for="(item, index) in data.goods_list" :key="index" class="item padding-main border-radius-main bg-white margin-bottom-main">
|
||||
<navigator :url="'/pages/goods-detail/goods-detail?goods_id=' + item.id" hover-class="none">
|
||||
<image :src="item.images" mode="aspectFit"></image>
|
||||
<view class="margin-top-sm">
|
||||
<view class="multi-text">{{item.title}}</view>
|
||||
<view class="single-text margin-top-sm">
|
||||
<text v-if="(data_base.goods_detail_icon || null) != null" class="text-size-xs bg-red cr-white round padding-left-sm padding-right-sm padding-top-xs padding-bottom-xs" :style="'background-color:'+data.color+' !important;'">{{data_base.goods_detail_icon}}</text>
|
||||
<text class="sales-price va-m">{{currency_symbol}}{{item.min_price}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</navigator>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else>
|
||||
<!-- 提示信息 -->
|
||||
<component-no-data prop-status="0" prop-msg="没有相关商品"></component-no-data>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 结尾 -->
|
||||
<component-bottom-line :prop-status="data_bottom_line_status"></component-bottom-line>
|
||||
</view>
|
||||
<view v-else>
|
||||
<!-- 提示信息 -->
|
||||
<component-no-data :prop-status="data_list_loding_status" :prop-msg="data_list_loding_msg"></component-no-data>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
const app = getApp();
|
||||
import componentNoData from "../../../../components/no-data/no-data";
|
||||
import componentBottomLine from "../../../../components/bottom-line/bottom-line";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 1,
|
||||
data_list_loding_msg: '',
|
||||
params: null,
|
||||
user: null,
|
||||
data_base: null,
|
||||
data: null,
|
||||
currency_symbol: app.globalData.data.currency_symbol
|
||||
};
|
||||
},
|
||||
|
||||
components: {
|
||||
componentNoData,
|
||||
componentBottomLine
|
||||
},
|
||||
props: {},
|
||||
|
||||
onLoad(params) {
|
||||
//params['id'] = 1;
|
||||
this.setData({
|
||||
params: params
|
||||
});
|
||||
},
|
||||
|
||||
onShow() {
|
||||
// 获取数据
|
||||
this.get_data();
|
||||
|
||||
// 显示分享菜单
|
||||
app.globalData.show_share_menu();
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.get_data();
|
||||
},
|
||||
|
||||
// 自定义分享
|
||||
onShareAppMessage() {
|
||||
var user_id = app.globalData.get_user_cache_info('id', 0) || 0;
|
||||
return {
|
||||
title: this.data.seo_title || this.data.title || '活动详情 - ' + app.globalData.data.application_title,
|
||||
desc: this.data.seo_desc || this.data.describe || '天天活动、优惠不断 - ' + app.globalData.data.application_describe,
|
||||
path: '/pages/plugins/activity/detail/detail?id=' + this.data.id + '&referrer=' + user_id
|
||||
};
|
||||
},
|
||||
|
||||
// 分享朋友圈
|
||||
onShareTimeline() {
|
||||
var user_id = app.globalData.get_user_cache_info('id', 0) || 0;
|
||||
return {
|
||||
title: this.data.seo_title || this.data.title || '活动详情 - ' + app.globalData.data.application_title,
|
||||
query: 'id=' + this.data.id + '&referrer=' + user_id,
|
||||
imageUrl: this.data.right_images || ''
|
||||
};
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 获取数据
|
||||
get_data() {
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url("detail", "index", "activity"),
|
||||
method: "POST",
|
||||
data: {
|
||||
id: this.params.id || 0
|
||||
},
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
this.setData({
|
||||
data_base: data.base || null,
|
||||
data: data.data || null,
|
||||
data_list_loding_msg: '',
|
||||
data_list_loding_status: 0,
|
||||
data_bottom_line_status: ((data.data || null) != null && (data.data.goods_list || null) != null && data.data.goods_list.length > 0)
|
||||
});
|
||||
|
||||
// 标题名称
|
||||
if ((this.data || null) != null && (this.data.title || null) != null) {
|
||||
uni.setNavigationBarTitle({
|
||||
title: this.data.title
|
||||
});
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: res.data.msg
|
||||
});
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.stopPullDownRefresh();
|
||||
this.setData({
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: '服务器请求出错'
|
||||
});
|
||||
app.globalData.showToast("服务器请求出错");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
@import './detail.css';
|
||||
</style>
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
/**
|
||||
* 分类导航
|
||||
*/
|
||||
.nav-list {
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据列表
|
||||
*/
|
||||
.scroll-box {
|
||||
height: calc(100vh - 80rpx);
|
||||
}
|
||||
.data-list .item {
|
||||
width: calc(50% - 10rpx);
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
.data-list .item:nth-child(2n) {
|
||||
float: right;
|
||||
}
|
||||
.data-list .item:nth-child(2n+1) {
|
||||
float: left;
|
||||
}
|
||||
.data-list .item image {
|
||||
width: 100%;
|
||||
height: 160rpx !important;
|
||||
}
|
||||
|
|
@ -0,0 +1,263 @@
|
|||
<template>
|
||||
<view>
|
||||
<view v-if="(data_base || null) != null">
|
||||
<!-- 轮播 -->
|
||||
<view v-if="slider_list.length > 0" class="padding-horizontal-main padding-top-main">
|
||||
<component-banner :prop-data="slider_list" prop-size="mini"></component-banner>
|
||||
</view>
|
||||
|
||||
<!-- 分类 -->
|
||||
<scroll-view v-if="(activity_category || null) != null && activity_category.length > 0" class="nav-list scroll-view-horizontal bg-white oh" scroll-x="true">
|
||||
<view :class="'item cr-gray dis-inline-block padding-horizontal-main ' + (nav_active_value == 0 ? 'cr-main' : '')" @tap="nav_event" data-value="0">全部</view>
|
||||
<block v-for="(item, index) in activity_category" :key="index">
|
||||
<view :class="'item cr-gray dis-inline-block padding-horizontal-main ' + (nav_active_value == item.id ? 'cr-main' : '')" @tap="nav_event" :data-value="item.id">{{item.name}}</view>
|
||||
</block>
|
||||
</scroll-view>
|
||||
|
||||
<!-- 列表 -->
|
||||
<scroll-view :scroll-y="true" class="scroll-box" @scrolltolower="scroll_lower" lower-threshold="30">
|
||||
<view v-if="(data_list || null) != null && data_list.length > 0" class="data-list padding-horizontal-main padding-top-main oh">
|
||||
<block v-for="(item, index) in data_list" :key="index">
|
||||
<view class="item border-radius-main bg-white oh spacing-mb">
|
||||
<navigator :url="'/pages/plugins/activity/detail/detail?id=' + item.id" hover-class="none">
|
||||
<image :src="item.cover" mode="aspectFit"></image>
|
||||
<view class="padding-main tc">
|
||||
<view class="single-text fw-b cr-base">{{item.title}}</view>
|
||||
<view class="multi-text cr-grey margin-top-sm">{{item.describe}}</view>
|
||||
</view>
|
||||
</navigator>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
<view v-else>
|
||||
<!-- 提示信息 -->
|
||||
<component-no-data :prop-status="data_list_loding_status" :prop-msg="data_list_loding_msg"></component-no-data>
|
||||
</view>
|
||||
|
||||
<!-- 结尾 -->
|
||||
<component-bottom-line :prop-status="data_bottom_line_status"></component-bottom-line>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
const app = getApp();
|
||||
import componentBanner from "../../../../components/slider/slider";
|
||||
import componentNoData from "../../../../components/no-data/no-data";
|
||||
import componentBottomLine from "../../../../components/bottom-line/bottom-line";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
data_list_loding_status: 1,
|
||||
data_list_loding_msg: '',
|
||||
data_bottom_line_status: false,
|
||||
data_list: [],
|
||||
data_total: 0,
|
||||
data_page_total: 0,
|
||||
data_page: 1,
|
||||
params: null,
|
||||
data_base: null,
|
||||
slider_list: [],
|
||||
activity_category: [],
|
||||
nav_active_value: 0
|
||||
};
|
||||
},
|
||||
|
||||
components: {
|
||||
componentBanner,
|
||||
componentNoData,
|
||||
componentBottomLine
|
||||
},
|
||||
props: {},
|
||||
|
||||
onLoad(params) {
|
||||
// 启动参数处理
|
||||
params = app.globalData.launch_params_handle(params);
|
||||
this.setData({
|
||||
params: params
|
||||
});
|
||||
|
||||
// 数据加载
|
||||
this.get_data();
|
||||
|
||||
// 显示分享菜单
|
||||
app.globalData.show_share_menu();
|
||||
},
|
||||
|
||||
// 下拉刷新
|
||||
onPullDownRefresh() {
|
||||
this.setData({
|
||||
data_page: 1
|
||||
});
|
||||
this.get_data_list(1);
|
||||
},
|
||||
|
||||
// 自定义分享
|
||||
onShareAppMessage() {
|
||||
var user_id = app.globalData.get_user_cache_info('id', 0) || 0;
|
||||
return {
|
||||
title: this.data_base.seo_title || this.data_base.application_name || app.globalData.data.application_title,
|
||||
desc: this.data_base.seo_desc || app.globalData.data.application_describe,
|
||||
path: '/pages/plugins/activity/index/index?referrer=' + user_id
|
||||
};
|
||||
},
|
||||
|
||||
// 分享朋友圈
|
||||
onShareTimeline() {
|
||||
var user_id = app.globalData.get_user_cache_info('id', 0) || 0;
|
||||
return {
|
||||
title: this.data_base.seo_title || this.data_base.application_name || app.globalData.data.application_title,
|
||||
query: 'referrer=' + user_id
|
||||
};
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 初始化
|
||||
get_data() {
|
||||
uni.showLoading({
|
||||
title: "加载中..."
|
||||
});
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url("index", "index", "activity"),
|
||||
method: "POST",
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
this.setData({
|
||||
data_base: data.base || null,
|
||||
slider_list: data.slider_list || [],
|
||||
activity_category: data.activity_category || []
|
||||
});
|
||||
|
||||
// 标题名称
|
||||
if ((this.data_base || null) != null && (this.data_base.application_name || null) != null) {
|
||||
uni.setNavigationBarTitle({
|
||||
title: this.data_base.application_name
|
||||
});
|
||||
}
|
||||
|
||||
// 获取列表数据
|
||||
this.get_data_list(1);
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_list_loding_msg: res.data.msg
|
||||
});
|
||||
app.globalData.showToast(res.data.msg);
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
this.setData({
|
||||
data_list_loding_status: 2
|
||||
});
|
||||
app.globalData.showToast("服务器请求出错");
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 获取数据列表
|
||||
get_data_list(is_mandatory) {
|
||||
// 分页是否还有数据
|
||||
if ((is_mandatory || 0) == 0) {
|
||||
if (this.data_bottom_line_status == true) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 加载loding
|
||||
uni.showLoading({
|
||||
title: "加载中..."
|
||||
});
|
||||
|
||||
// 获取数据
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url("datalist", "index", "activity"),
|
||||
method: "POST",
|
||||
data: {
|
||||
page: this.data_page,
|
||||
category_id: this.nav_active_value || 0
|
||||
},
|
||||
dataType: "json",
|
||||
success: res => {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
if (data.data.length > 0) {
|
||||
if (this.data_page <= 1) {
|
||||
var temp_data_list = data.data;
|
||||
} else {
|
||||
var temp_data_list = this.data_list;
|
||||
var temp_data = data.data;
|
||||
for (var i in temp_data) {
|
||||
temp_data_list.push(temp_data[i]);
|
||||
}
|
||||
}
|
||||
this.setData({
|
||||
data_list: temp_data_list,
|
||||
data_total: data.total,
|
||||
data_page_total: data.page_total,
|
||||
data_list_loding_status: 3,
|
||||
data_page: this.data_page + 1
|
||||
});
|
||||
|
||||
// 是否还有数据
|
||||
this.setData({
|
||||
data_bottom_line_status: (this.data_page > 1 && this.data_page > this.data_page_total)
|
||||
});
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0
|
||||
});
|
||||
if (this.data_page <= 1) {
|
||||
this.setData({
|
||||
data_list: [],
|
||||
data_bottom_line_status: false
|
||||
});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.setData({
|
||||
data_list_loding_status: 0,
|
||||
data_list_loding_msg: res.data.msg
|
||||
});
|
||||
app.globalData.showToast(res.data.msg);
|
||||
}
|
||||
},
|
||||
fail: () => {
|
||||
uni.hideLoading();
|
||||
uni.stopPullDownRefresh();
|
||||
this.setData({
|
||||
data_list_loding_status: 2
|
||||
});
|
||||
app.globalData.showToast("服务器请求出错");
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 滚动加载
|
||||
scroll_lower(e) {
|
||||
this.get_data_list();
|
||||
},
|
||||
|
||||
// 导航事件
|
||||
nav_event(e) {
|
||||
this.setData({
|
||||
nav_active_value: e.currentTarget.dataset.value || 0,
|
||||
data_page: 1
|
||||
});
|
||||
this.get_data_list(1);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
@import './index.css';
|
||||
</style>
|
||||
|
|
@ -39,6 +39,10 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else>
|
||||
<!-- 提示信息 -->
|
||||
<component-no-data prop-status="0" prop-msg="没有相关商品"></component-no-data>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 结尾 -->
|
||||
|
|
@ -135,7 +139,7 @@
|
|||
is_valid: data.is_valid || 0,
|
||||
data_list_loding_msg: '',
|
||||
data_list_loding_status: 0,
|
||||
data_bottom_line_status: true
|
||||
data_bottom_line_status: ((data.goods || null) != null && data.goods.length > 0)
|
||||
});
|
||||
} else {
|
||||
this.setData({
|
||||
|
|
|
|||
|
|
@ -21,8 +21,7 @@
|
|||
<view class="multi-text cr-grey margin-top-sm">{{item.describe}}</view>
|
||||
<view class="oh margin-top-sm br-t-dashed padding-top-main">
|
||||
<view class="fl cr-gray single-text">商品 {{item.goods_count}}</view>
|
||||
<view class="fr cr-gray single-text">销量 {{item.goods_sales_count}}
|
||||
</view>
|
||||
<view class="fr cr-gray single-text">销量 {{item.goods_sales_count}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</navigator>
|
||||
|
|
@ -87,7 +86,7 @@
|
|||
this.setData({
|
||||
data_page: 1
|
||||
});
|
||||
this.get_data();
|
||||
this.get_data_list(1);
|
||||
},
|
||||
|
||||
// 自定义分享
|
||||
|
|
@ -240,7 +239,7 @@
|
|||
|
||||
// 滚动加载
|
||||
scroll_lower(e) {
|
||||
this.get_data_list();
|
||||
this.get_data_list(1);
|
||||
},
|
||||
|
||||
// 导航事件
|
||||
|
|
@ -249,7 +248,7 @@
|
|||
nav_active_value: e.currentTarget.dataset.value || 0,
|
||||
data_page: 1
|
||||
});
|
||||
this.get_data_list(1);
|
||||
this.get_data_list(11);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -166,7 +166,6 @@
|
|||
methods: {
|
||||
// 获取数据
|
||||
get_data() {
|
||||
var self = this;
|
||||
uni.request({
|
||||
url: app.globalData.get_request_url("detail", "index", "signin"),
|
||||
method: "POST",
|
||||
|
|
@ -178,7 +177,7 @@
|
|||
uni.stopPullDownRefresh();
|
||||
if (res.data.code == 0) {
|
||||
var data = res.data.data;
|
||||
self.setData({
|
||||
this.setData({
|
||||
data_base: data.base || null,
|
||||
data: data.data || null,
|
||||
team_signin_data: data.team_signin_data || null,
|
||||
|
|
@ -189,7 +188,7 @@
|
|||
data_bottom_line_status: true
|
||||
});
|
||||
} else {
|
||||
self.setData({
|
||||
this.setData({
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: res.data.msg
|
||||
|
|
@ -198,7 +197,7 @@
|
|||
},
|
||||
fail: () => {
|
||||
uni.stopPullDownRefresh();
|
||||
self.setData({
|
||||
this.setData({
|
||||
data_bottom_line_status: false,
|
||||
data_list_loding_status: 2,
|
||||
data_list_loding_msg: '服务器请求出错'
|
||||
|
|
@ -238,7 +237,6 @@
|
|||
// 签到
|
||||
coming_event(e) {
|
||||
if (this.is_already_coming != 1 && this.init()) {
|
||||
var self = this;
|
||||
uni.showLoading({
|
||||
title: "处理中..."
|
||||
});
|
||||
|
|
@ -259,7 +257,7 @@
|
|||
});
|
||||
this.get_data();
|
||||
} else {
|
||||
if (app.globalData.is_login_check(res.data, self, 'team_request')) {
|
||||
if (app.globalData.is_login_check(res.data, this, 'team_request')) {
|
||||
app.globalData.showToast(res.data.msg);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue