This commit is contained in:
gongfuxiang 2018-11-20 01:10:30 +08:00
parent bd8e395564
commit 8cfd312a9d
6 changed files with 62 additions and 51 deletions

View File

@ -44,8 +44,8 @@ App({
},
// 请求地址
//request_url: "http://demo.shopxo.net/",
request_url: 'http://localhost/project/shopxo/service/',
request_url: "https://demo.shopxo.net/",
//request_url: 'http://localhost/project/shopxo/service/',
// 基础信息
application_title: "ShopXO电商系统",

View File

@ -1,5 +1,5 @@
<view a:if="{{data_list.length > 0}}">
<view class="data-list">
<view class="data-list bg-white spacing-mb">
<view class="items" a:for="{{data_list}}">
<view class="items-content" style="background-color:{{item.bg_color}}" data-value="{{item.event_value}}" data-type="{{item.event_type}}" onTap="nav_event">
<image class="wh-auto" src="{{item.images_url}}" mode="aspectFit" />

View File

@ -1,23 +1,16 @@
.floor {
}
.floor, .floor-list, .floor-left {
.floor-list, .floor-left {
overflow: hidden;
position: relative;
}
.floor .nav-name {
font-size: 34rpx;
font-weight: 500;
text-align: center;
padding: 10rpx 0;
}
.floor .vice-name {
top: 20rpx;
left: 20rpx;
color: #fff;
margin-top: 20rpx;
padding: 0 10rpx;
font-size: 34rpx;
line-height: 48rpx;
}
.floor-left {
width: 40%;
float: left;
height: 660rpx;
}
.floor-left image {
@ -27,32 +20,36 @@
}
.floor .vice-name,
.floor-left image,
.goods-list .goods:nth-child(1),
.goods-list .goods:nth-child(2) {
.goods-list .goods:nth-child(2),
.goods-list .goods:nth-child(1) .goods-base,
.goods-list .goods:nth-child(2) .goods-base {
position: absolute;
}
.goods-list .goods {
height: 330rpx;
background-color: #fff;
overflow: hidden;
}
.goods-list .goods image {
width: 100%;
height: 330rpx;
}
.goods-list .goods:nth-child(1),
.goods-list .goods:nth-child(2) {
width: 60%;
height: 330rpx;
}
.goods-list .goods:nth-child(1) .goods-base,
.goods-list .goods:nth-child(2) .goods-base {
float: left;
padding-left: 10rpx;
width: calc(40% - 10rpx);
bottom: 20rpx;
}
.goods-list .goods:nth-child(1) image,
.goods-list .goods:nth-child(2) image {
width: 60%;
height: 330rpx;
float: right;
}
.goods-list .goods:nth-child(1) {
@ -67,6 +64,17 @@
.goods-list .goods:nth-child(4),
.goods-list .goods:nth-child(5),
.goods-list .goods:nth-child(6) {
margin-top: 330rpx;
width: 50%;
height: 430rpx;
float: left;
}
.goods-list .goods-base {
padding: 0 10rpx;
}
.goods-base .goods-title {
line-height: 52rpx;
font-size: 32rpx;
}
.goods-base .sales-price {
font-size: 30rpx;
}

View File

@ -5,11 +5,11 @@
<component-home-nav />
<!-- 楼层数据 -->
<block a:if="{{data_list.length > 0}}">
<view a:for="{{data_list}}" a:for-item="floor" class="floor">
<view class="nav-name">
{{floor.name}}
<view a:for="{{data_list}}" a:for-item="floor" class="floor spacing-mb">
<view class="spacing-nav-title">
<text class="line"></text>
<text class="text-wrapper">{{floor.name}}</text>
</view>
<view class="floor-list" style="background-color:{{floor.bg_color}}">
<view class="floor-left">
@ -17,24 +17,27 @@
<image src="{{floor.big_images}}" mode="aspectFit" />
</view>
<view class="goods-list" a:if="{{floor.goods.length > 0}}">
<view a:for="{{floor.goods}}" a:for-item="goods" class="goods">
<image src="{{goods.home_recommended_images}}" mode="aspectFit" />
<view class="goods-base">
<view class="goods-itle">{{goods.title}}</view>
</view>
<view a:for="{{floor.goods}}" a:for-item="goods" class="goods bg-white">
<navigator url="/pages/goods-detail/goods-detail?goods_id={{goods.id}}" hover-class="none">
<image src="{{goods.home_recommended_images}}" mode="aspectFit" />
<view class="goods-base">
<view class="goods-title single-text">{{goods.title}}</view>
<view class="sales-price">¥{{goods.price}}</view>
</view>
</navigator>
</view>
</view>
</view>
</view>
</block>
<!-- 留言 -->
<view a:if="{{load_status == 1}}" class="spacing-10">
<navigator url="/pages/answer-form/answer-form" hover-class="none" class="bg-white">
<image class="wh-auto" mode="widthFix" src="/images/home-consulting-image.jpg" />
</navigator>
</view>
<!-- 结尾 -->
<import src="/pages/common/bottom_line.axml" />
<template is="bottom_line" data="{{status: data_bottom_line_status}}"></template>

View File

@ -44,7 +44,8 @@ class GoodsService
*/
public static function GoodsCategory($params = [])
{
$data = self::GoodsCategoryList(['pid'=>0]);
$where = empty($params['where']) ? ['pid'=>0] : $params['where'];
$data = self::GoodsCategoryList($where);
if(!empty($data))
{
foreach($data as &$v)
@ -69,13 +70,13 @@ class GoodsService
* @version 1.0.0
* @date 2018-08-29
* @desc description
* @param [array] $params [输入参数]
* @param [array] $where [条件]
*/
public static function GoodsCategoryList($params = [])
public static function GoodsCategoryList($where = [])
{
$pid = isset($params['pid']) ? intval($params['pid']) : 0;
$where['is_enable'] = 1;
$field = 'id,pid,icon,name,vice_name,describe,bg_color,big_images,sort,is_home_recommended';
$data = M('GoodsCategory')->field($field)->where(['is_enable'=>1, 'pid'=>$pid])->order('sort asc')->select();
$data = M('GoodsCategory')->field($field)->where($where)->order('sort asc')->select();
return self::GoodsCategoryDataDealWith($data);
}
@ -124,13 +125,14 @@ class GoodsService
public static function HomeFloorList($params = [])
{
// 商品大分类
$goods_category = self::GoodsCategory();
$params['where'] = ['pid'=>0, 'is_home_recommended'=>1];
$goods_category = self::GoodsCategory($params);
if(!empty($goods_category))
{
foreach($goods_category as &$v)
{
$category_ids = self::GoodsCategoryItemsIds(['category_id'=>$v['id']]);
$v['goods'] = self::GoodsList(['where'=>['gci.category_id'=>['in', $category_ids], 'is_home_recommended'=>1], 'm'=>0, 'n'=>6, 'field'=>'g.title,g.title_color,g.images,g.home_recommended_images,g.original_price,g.price,g.inventory,g.buy_min_number,g.buy_max_number']);
$v['goods'] = self::GoodsList(['where'=>['gci.category_id'=>['in', $category_ids], 'is_home_recommended'=>1], 'm'=>0, 'n'=>6, 'field'=>'g.id,g.title,g.title_color,g.images,g.home_recommended_images,g.original_price,g.price,g.inventory,g.buy_min_number,g.buy_max_number']);
}
}
return $goods_category;

File diff suppressed because one or more lines are too long