Merge branch 'v1.6.0' of gitee.com:gongfuxiang/shopxo into v1.6.0

This commit is contained in:
devil_gong 2019-07-10 18:27:19 +08:00
commit 296f427b28
14 changed files with 230 additions and 263 deletions

View File

@ -131,13 +131,7 @@ class Plugins extends Common
return $this->fetch('public/tips_error');
}
}
$ret = $obj->$pluginsaction($params);
if(is_string($ret))
{
$this->assign('msg', $ret);
return $this->fetch('public/tips_error');
}
return $ret;
return $obj->$pluginsaction($params);
}
/**

View File

@ -125,13 +125,7 @@ class Plugins extends Common
return $this->fetch('public/tips_error');
}
}
$ret = $obj->$pluginsaction($params);
if(is_string($ret))
{
$this->assign('msg', $ret);
return $this->fetch('public/tips_error');
}
return $ret;
return $obj->$pluginsaction($params);
}
/**

View File

@ -32,5 +32,33 @@ return array (
'log_write' =>
array (
),
'plugins_css' =>
array (
0 => 'app\\plugins\\limitedtimediscount\\Hook',
),
'plugins_js' =>
array (
0 => 'app\\plugins\\limitedtimediscount\\Hook',
),
'plugins_service_navigation_header_handle' =>
array (
0 => 'app\\plugins\\limitedtimediscount\\Hook',
),
'plugins_service_goods_handle_end' =>
array (
0 => 'app\\plugins\\limitedtimediscount\\Hook',
),
'plugins_service_goods_spec_base' =>
array (
0 => 'app\\plugins\\limitedtimediscount\\Hook',
),
'plugins_view_goods_detail_base_top' =>
array (
0 => 'app\\plugins\\limitedtimediscount\\Hook',
),
'plugins_view_home_floor_top' =>
array (
0 => 'app\\plugins\\limitedtimediscount\\Hook',
),
);
?>

View File

@ -61,7 +61,7 @@ App({
// 请求地址
// request_url: "{{request_url}}",
request_url: 'http://tp5-dev.com/',
request_url: 'https://test.shopxo.net/',
//request_url: 'https://test.shopxo.net/',
// 基础信息
application_title: "{{application_title}}",

View File

@ -1,95 +0,0 @@
// components/limitedtimediscount.js
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
hours: 0,
minutes: 0,
seconds: 30,
timer_title: '距离结束',
is_show_time: true,
data_list: [
{
goods_id: 1,
goods_title: '2019新款夏装漂亮的睡衣性感女士专享',
images_url: 'https://demo.shopxo.net/static/upload/images/goods/2019/01/14/1547454702543219.jpg',
min_price: 345.23,
min_original_price: 9863.98,
},
{
goods_id: 2,
goods_title: 'MARNI Trunk 女士 中号拼色十字纹小牛皮 斜挎风琴包',
images_url: 'https://demo.shopxo.net/static/upload/images/goods/2019/01/14/1547454145355962.jpg',
min_price: 256.00,
min_original_price: 356.00,
},
{
goods_id: 3,
goods_title: 'Huawei/华为 H60-L01 荣耀6 移动4G版智能手机 安卓',
images_url: 'https://demo.shopxo.net/static/upload/images/goods/2019/01/14/1547452474332334.jpg',
min_price: 1999.99,
min_original_price: 2300.00,
}
],
},
ready: function () {
this.countdown();
},
/**
* 组件的方法列表
*/
methods: {
// 倒计时
countdown() {
if (this.data.hours > 0 || this.data.minutes > 0 || this.data.seconds > 0) {
var hours = this.data.hours;
var minutes = this.data.minutes;
var seconds = this.data.seconds;
// 秒
var self = this;
var timer = setInterval(function () {
if (seconds <= 0) {
if (minutes > 0) {
minutes--;
seconds = 59;
} else if (hours > 0) {
hours--;
minutes = 59;
seconds = 59;
}
} else {
seconds--;
}
self.setData({
hours: (hours < 10) ? 0 + hours : hours,
minutes: (minutes < 10) ? 0 + minutes : minutes,
seconds: (seconds < 10) ? 0 + seconds : seconds,
});
if (hours <= 0 && minutes <= 0 && seconds <= 0) {
// 停止时间
clearInterval(timer);
// 活动已结束
self.setData({
timer_title: '活动已结束',
is_show_time: false,
});
}
}, 1000);
}
}
}
})

View File

@ -1,4 +0,0 @@
{
"component": true,
"usingComponents": {}
}

View File

@ -1,31 +0,0 @@
<view wx:if="{{data_list.length > 0}}" class="limitedtimediscount">
<view class="spacing-nav-title">
<image class="nav-icon" src="/components/limitedtimediscount/images/nav-icon.png" mode="aspectFit"></image>
<text class="text-wrapper">限时秒杀</text>
<view class="countdown">
<block wx:if="{{is_show_time}}">
<view class="timer-hours seconds">{{seconds}}</view>
<view class="ds">:</view>
<view class="timer-hours minutes">{{minutes}}</view>
<view class="ds">:</view>
<view class="timer-hours hours">{{hours}}</view>
</block>
<view class="timer-title">{{timer_title}}</view>
</view>
</view>
<view class="data-list">
<scroll-view scroll-x>
<view wx:for="{{data_list}}" wx:key="key" class="item">
<navigator url="/pages/goods-detail/goods-detail?id={{item.goods_id}}" hover-class="none">
<image src="{{item.images_url}}" mode="aspectFit"></image>
<view class="goods-base">
<view class="goods-title">{{item.goods_title}}</view>
<view class="goods-price">¥{{item.min_price}}</view>
<view wx:if="{{(item.min_original_price || null) != null}}" class="goods-original-price">¥{{item.min_original_price}}</view>
<button size="mini">抢购</button>
</view>
</navigator>
</view>
</scroll-view>
</view>
</view>

View File

@ -1,112 +0,0 @@
.limitedtimediscount {
background: #fff;
padding: 5rpx 10rpx 20rpx 10rpx;
margin-bottom: 20rpx;
}
/*
定时器
*/
.spacing-nav-title {
overflow: hidden;
padding: 10rpx 0;
}
.spacing-nav-title .nav-icon {
width: 45rpx;
height: 45rpx;
vertical-align: top;
margin-right: 10rpx;
}
.text-wrapper {
color: #d2364c;
font-size: 36rpx;
font-weight: bold;
}
.countdown {
line-height: 50rpx;
float: right;
}
.countdown view {
margin-right: 0;
float: right;
}
.countdown .timer-title {
color: #666;
margin-right: 10rpx;
}
.countdown .timer-hours {
padding: 0 12rpx;
-moz-border-radius: 8rpx;
border-radius: 8rpx;
background-color: #3A4145;
color: #fff;
min-width: 35rpx;
text-align: center;
}
.countdown .ds {
color: #4B5459;
padding: 0 8rpx;
font-weight: 700;
}
/*
商品
*/
.data-list {
width: 100%;
white-space: nowrap;
box-sizing: border-box;
margin-top: 5rpx;
}
.data-list .item {
width: 460rpx;
height: 605rpx;
border: 1px solid #f5f5f5;
background: white;
display: inline-block;
position: relative;
}
.data-list .item:not(:last-child) {
margin-right: 10px;
}
.data-list .item image {
width: 460rpx;
height: 460rpx;
}
.data-list .item .goods-base {
padding: 0 10rpx;
}
.data-list .goods-base .goods-title,
.data-list .goods-base .goods-price,
.data-list .goods-base .ogoods-riginal-price {
-o-text-overflow: ellipsis;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
max-width: 100%;
}
.data-list .goods-base .goods-title {
font-size: 32rpx;
}
.data-list .goods-base .goods-price {
color: #f40;
font-weight: bold;
font-size: 36rpx;
}
.data-list .goods-base .goods-original-price {
color: #999;
text-decoration: line-through;
font-size: 24rpx;
}
.data-list .goods-base button {
background: #d2364c;
border: 0;
color: #fff;
padding: 0 30rpx;
line-height: 50rpx;
font-size: 30rpx;
border-radius: 6rpx;
position: absolute;
right: 15rpx;
bottom: 15rpx;
}

View File

@ -40,7 +40,7 @@ Page({
},
onLoad(params) {
params['goods_id']=2;
//params['goods_id']=2;
this.setData({params: params});
this.init();
},

View File

@ -1,6 +1,7 @@
const app = getApp();
Page({
data: {
load_status: 0,
data_list_loding_status: 1,
data_bottom_line_status: false,
data_list: [],
@ -11,7 +12,11 @@ Page({
common_app_is_enable_answer: 1,
common_app_is_header_nav_fixed: 0,
common_app_is_online_service: 0,
load_status: 0,
// 限时秒杀插件
plugins_limitedtimediscount_data: [],
plugins_limitedtimediscount_timer_title: '距离结束',
plugins_limitedtimediscount_is_show_time: true,
},
onShow() {
@ -40,6 +45,7 @@ Page({
if (res.data.code == 0) {
var data = res.data.data;
self.setData({
data_bottom_line_status: true,
banner_list: data.banner_list || [],
navigation: data.navigation || [],
data_list: data.data_list,
@ -49,8 +55,11 @@ Page({
common_app_is_header_nav_fixed: data.common_app_is_header_nav_fixed,
data_list_loding_status: data.data_list.length == 0 ? 0 : 3,
common_app_is_online_service: data.common_app_is_online_service || 0,
data_bottom_line_status: true,
plugins_limitedtimediscount_data: data.plugins_limitedtimediscount_data || [],
});
// 限时秒杀倒计时
this.plugins_limitedtimediscount_countdown();
} else {
self.setData({
data_list_loding_status: 0,
@ -92,6 +101,54 @@ Page({
this.init();
},
// 显示秒杀插件-倒计时
plugins_limitedtimediscount_countdown() {
var hours = this.data.plugins_limitedtimediscount_data.time.hours || 0;
var minutes = this.data.plugins_limitedtimediscount_data.time.minutes || 0;
var seconds = this.data.plugins_limitedtimediscount_data.time.seconds || 0;
var self = this;
if (hours > 0 || minutes > 0 || seconds > 0) {
// 秒
var timer = setInterval(function () {
if (seconds <= 0) {
if (minutes > 0) {
minutes--;
seconds = 59;
} else if (hours > 0) {
hours--;
minutes = 59;
seconds = 59;
}
} else {
seconds--;
}
self.setData({
'plugins_limitedtimediscount_data.time.hours': (hours < 10) ? 0 + hours : hours,
'plugins_limitedtimediscount_data.time.minutes': (minutes < 10) ? 0 + minutes : minutes,
'plugins_limitedtimediscount_data.time.seconds': (seconds < 10) ? 0 + seconds : seconds,
});
if (hours <= 0 && minutes <= 0 && seconds <= 0) {
// 停止时间
clearInterval(timer);
// 活动已结束
self.setData({
plugins_limitedtimediscount_timer_title: '活动已结束',
plugins_limitedtimediscount_is_show_time: false,
});
}
}, 1000);
} else {
// 活动已结束
self.setData({
plugins_limitedtimediscount_timer_title: '活动已结束',
plugins_limitedtimediscount_is_show_time: false,
});
}
},
// 自定义分享
onShareAppMessage() {
return {

View File

@ -2,7 +2,6 @@
"enablePullDownRefresh": true,
"usingComponents": {
"component-icon-nav": "/components/icon-nav/icon-nav",
"component-banner": "/components/slider/slider",
"component-limitedtimediscount": "/components/limitedtimediscount/limitedtimediscount"
"component-banner": "/components/slider/slider"
}
}

View File

@ -19,7 +19,37 @@
<component-icon-nav prop-data="{{navigation}}"></component-icon-nav>
<!-- 限时秒杀 -->
<component-limitedtimediscount prop-data="{{banner_list}}"></component-limitedtimediscount>
<view wx:if="{{plugins_limitedtimediscount_data.goods.length > 0}}" class="limitedtimediscount">
<view class="nav-title">
<image class="nav-icon" src="/images/limitedtimediscount-nav-icon.png" mode="aspectFit"></image>
<text class="text-wrapper">限时秒杀</text>
<view class="countdown">
<block wx:if="{{plugins_limitedtimediscount_is_show_time}}">
<view class="timer-hours seconds">{{plugins_limitedtimediscount_data.time.seconds}}</view>
<view class="ds">:</view>
<view class="timer-hours minutes">{{plugins_limitedtimediscount_data.time.minutes}}</view>
<view class="ds">:</view>
<view class="timer-hours hours">{{plugins_limitedtimediscount_data.time.hours}}</view>
</block>
<view class="timer-title">{{plugins_limitedtimediscount_timer_title}}</view>
</view>
</view>
<view class="goods-list">
<scroll-view scroll-x>
<view wx:for="{{plugins_limitedtimediscount_data.goods}}" wx:key="key" class="item">
<navigator url="/pages/goods-detail/goods-detail?goods_id={{item.goods_id}}" hover-class="none">
<image class="dis-block" src="{{item.images}}" mode="aspectFit"></image>
<view class="goods-base">
<view class="goods-title single-text">{{item.title}}</view>
<view class="goods-price single-text">¥{{item.price}}</view>
<view wx:if="{{(item.original_price || null) != null}}" class="goods-original-price single-text">¥{{item.original_price}}</view>
<button size="mini">抢购</button>
</view>
</navigator>
</view>
</scroll-view>
</view>
</view>
<!-- 楼层数据 -->
<block wx:if="{{data_list.length > 0}}">

View File

@ -99,4 +99,111 @@
}
.floor-list .goods-list .goods-base .sales-price {
font-size: 30rpx;
}
.limitedtimediscount {
background: #fff;
padding: 5rpx 10rpx 20rpx 10rpx;
margin-bottom: 20rpx;
}
/*
* 限时秒杀
*/
.limitedtimediscount {
background: #fff;
padding: 5rpx 10rpx 20rpx 10rpx;
margin-bottom: 20rpx;
}
.limitedtimediscount .nav-title {
overflow: hidden;
padding: 10rpx 0;
}
.limitedtimediscount .nav-title .nav-icon {
width: 45rpx;
height: 45rpx;
vertical-align: top;
margin-right: 10rpx;
}
.limitedtimediscount .text-wrapper {
color: #d2364c;
font-size: 36rpx;
font-weight: bold;
}
.limitedtimediscount .countdown {
line-height: 50rpx;
float: right;
}
.limitedtimediscount .countdown view {
margin-right: 0;
float: right;
}
.limitedtimediscount .countdown .timer-title {
color: #666;
margin-right: 10rpx;
}
.limitedtimediscount .countdown .timer-hours {
padding: 0 12rpx;
-moz-border-radius: 8rpx;
border-radius: 8rpx;
background-color: #3A4145;
color: #fff;
min-width: 35rpx;
text-align: center;
}
.limitedtimediscount .countdown .ds {
color: #4B5459;
padding: 0 8rpx;
font-weight: 700;
}
.limitedtimediscount .goods-list {
width: 100%;
white-space: nowrap;
box-sizing: border-box;
margin-top: 5rpx;
}
.limitedtimediscount .goods-list .item {
width: 460rpx;
height: 605rpx;
border: 1px solid #f5f5f5;
background: white;
display: inline-block;
position: relative;
}
.limitedtimediscount .goods-list .item:not(:last-child) {
margin-right: 10px;
}
.limitedtimediscount .goods-list .item image {
width: 460rpx;
height: 460rpx;
}
.limitedtimediscount .goods-list .item .goods-base {
padding: 0 10rpx;
margin-top: 10rpx;
}
.limitedtimediscount .goods-list .goods-base .goods-title {
font-size: 32rpx;
}
.limitedtimediscount .goods-list .goods-base .goods-price {
color: #f40;
font-weight: bold;
font-size: 32rpx;
}
.limitedtimediscount .goods-list .goods-base .goods-original-price {
color: #999;
text-decoration: line-through;
font-size: 24rpx;
}
.limitedtimediscount .goods-list .goods-base button {
background: #d2364c;
border: 0;
color: #fff;
padding: 0 30rpx;
line-height: 50rpx;
font-size: 30rpx;
border-radius: 6rpx;
position: absolute;
right: 15rpx;
bottom: 15rpx;
}