提交 e2559041 编写于 作者: D devil_gong

微信小程序好物推荐

上级 acfcdacb
...@@ -5,4 +5,7 @@ ...@@ -5,4 +5,7 @@
<li {{if $nav_type eq 'app'}}class="am-active"{{/if}} data-type="app"> <li {{if $nav_type eq 'app'}}class="am-active"{{/if}} data-type="app">
<a href="{{:MyUrl('admin/appconfig/index', ['nav_type'=>'app'])}}">APP/小程序</a> <a href="{{:MyUrl('admin/appconfig/index', ['nav_type'=>'app'])}}">APP/小程序</a>
</li> </li>
<li {{if $nav_type eq 'weixinmini'}}class="am-active"{{/if}} data-type="weixinmini">
<a href="{{:MyUrl('admin/appconfig/index', ['nav_type'=>'weixinmini'])}}">微信小程序</a>
</li>
</ul> </ul>
\ No newline at end of file
{{include file="public/header" /}}
<!-- right content start -->
<div class="content-right">
<div class="content">
<!-- table nav start -->
{{include file="appconfig/nav" /}}
<!-- table nav end -->
<!-- form start -->
<form class="am-form form-validation view-save" action="{{:MyUrl('admin/appconfig/save')}}" method="POST" request-type="ajax-url" request-value="{{:MyUrl('admin/appconfig/index', ['nav_type'=>'weixinmini'])}}" enctype="multipart/form-data">
<div class="am-form-group">
<label>{{$data.common_app_is_good_thing.name}}<span class="am-form-group-label-tips">{{$data.common_app_is_good_thing.describe}}</span></label>
<select name="{{$data.common_app_is_good_thing.only_tag}}" class="am-radius chosen-select c-p" data-validation-message="{{$data.common_app_is_good_thing.error_tips}}" required>
{{foreach $common_is_text_list as $v}}
<option value="{{$v.id}}" {{if isset($data['common_app_is_good_thing']['value']) and $data['common_app_is_good_thing']['value'] eq $v['id']}}selected{{/if}}>{{$v.name}}</option>
{{/foreach}}
</select>
</div>
<div class="am-form-group am-form-group-refreshing">
<input type="hidden" name="nav_type" value="{{$nav_type}}" />
<button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm am-btn-block" data-am-loading="{loadingText:'处理中...'}">保存</button>
</div>
</form>
<!-- form end -->
</div>
</div>
<!-- right content end -->
<!-- footer start -->
{{include file="public/footer" /}}
<!-- footer end
\ No newline at end of file
...@@ -107,13 +107,18 @@ class Goods extends Common ...@@ -107,13 +107,18 @@ class Goods extends Common
// 用户商品浏览 // 用户商品浏览
GoodsService::GoodsBrowseSave(['goods_id'=>$goods_id, 'user'=>$this->user]); GoodsService::GoodsBrowseSave(['goods_id'=>$goods_id, 'user'=>$this->user]);
// 商品所属分类名称
$category = GoodsService::GoodsCategoryNames($goods_id);
$ret['data'][0]['category_names'] = $category['data'];
// 数据返回 // 数据返回
$result = [ $result = [
'goods' => $ret['data'][0], 'goods' => $ret['data'][0],
'common_order_is_booking' => (int) MyC('common_order_is_booking', 0), 'common_order_is_booking' => (int) MyC('common_order_is_booking'),
'common_app_is_use_mobile_detail' => $is_use_mobile_detail, 'common_app_is_use_mobile_detail' => $is_use_mobile_detail,
'common_app_is_online_service' => (int) MyC('common_app_is_online_service', 0), 'common_app_is_online_service' => (int) MyC('common_app_is_online_service'),
'common_app_is_limitedtimediscount' => (int) MyC('common_app_is_limitedtimediscount'), 'common_app_is_limitedtimediscount' => (int) MyC('common_app_is_limitedtimediscount'),
'common_app_is_good_thing' => (int) MyC('common_app_is_good_thing'),
]; ];
// 秒杀 // 秒杀
......
...@@ -26,10 +26,15 @@ function CallPluginsServiceMethod($plugins, $service, $method, $params = null) ...@@ -26,10 +26,15 @@ function CallPluginsServiceMethod($plugins, $service, $method, $params = null)
{ {
$plugins_class = 'app\plugins\\'.$plugins.'\service\\'.$service; $plugins_class = 'app\plugins\\'.$plugins.'\service\\'.$service;
if(class_exists($plugins_class)) if(class_exists($plugins_class))
{
if(method_exists($plugins_class, $method))
{ {
return $plugins_class::$method($params); return $plugins_class::$method($params);
} else {
return DataReturn('类方法未定义['.$plugins.'-'.$service.'-'.$method.']', -1);
}
} }
return DataReturn('类未定义', -1); return DataReturn('类未定义['.$plugins.'-'.$service.']', -1);
} }
/** /**
......
...@@ -2203,5 +2203,20 @@ class GoodsService ...@@ -2203,5 +2203,20 @@ class GoodsService
} }
return DataReturn('删除失败', -100); return DataReturn('删除失败', -100);
} }
/**
* 根据商品id获取分类名称
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-08-29
* @desc description
* @param [int] $goods_id [商品id]
*/
public static function GoodsCategoryNames($goods_id)
{
$data = Db::name('GoodsCategory')->alias('gc')->join(['__GOODS_CATEGORY_JOIN__'=>'gci'], 'gc.id=gci.category_id')->where(['gci.goods_id'=>$goods_id])->column('gc.name');
return DataReturn('获取成功', 0, $data);
}
} }
?> ?>
\ No newline at end of file
此差异已折叠。
...@@ -62,7 +62,7 @@ App({ ...@@ -62,7 +62,7 @@ App({
// 请求地址 // 请求地址
// request_url: "{{request_url}}", // request_url: "{{request_url}}",
request_url: 'http://tp5-dev.com/', request_url: 'http://tp5-dev.com/',
request_url: 'https://test.shopxo.net/', //request_url: 'https://test.shopxo.net/',
// 基础信息 // 基础信息
application_title: "{{application_title}}", application_title: "{{application_title}}",
......
...@@ -63,6 +63,12 @@ ...@@ -63,6 +63,12 @@
"request": 10000, "request": 10000,
"downloadFile": 10000 "downloadFile": 10000
}, },
"plugins": {
"goodsSharePlugin": {
"version": "3.1.1",
"provider": "wx56c8f077de74b07c"
}
},
"debug": true, "debug": true,
"sitemapLocation": "sitemap.json" "sitemapLocation": "sitemap.json"
} }
\ No newline at end of file
...@@ -42,6 +42,21 @@ Page({ ...@@ -42,6 +42,21 @@ Page({
plugins_limitedtimediscount_data: null, plugins_limitedtimediscount_data: null,
plugins_limitedtimediscount_is_show_time: true, plugins_limitedtimediscount_is_show_time: true,
plugins_limitedtimediscount_time_millisecond: 0, plugins_limitedtimediscount_time_millisecond: 0,
// 好物圈分享信息
common_app_is_good_thing : 0,
share_product: {
"item_code": "",
"title": "",
"desc": "",
"category_list": [],
"image_list": [],
"src_mini_program_path": "",
"brand_info": {},
},
},
on_error(e) {
console.log(e)
}, },
onLoad(params) { onLoad(params) {
...@@ -116,6 +131,15 @@ Page({ ...@@ -116,6 +131,15 @@ Page({
common_app_is_limitedtimediscount: data.common_app_is_limitedtimediscount || 0, common_app_is_limitedtimediscount: data.common_app_is_limitedtimediscount || 0,
plugins_limitedtimediscount_data: data.plugins_limitedtimediscount_data || null, plugins_limitedtimediscount_data: data.plugins_limitedtimediscount_data || null,
common_app_is_good_thing: data.common_app_is_good_thing || 0,
'share_product.item_code': data.goods.id.toString(),
'share_product.title': data.goods.title,
'share_product.image_list': data.goods.photo.map(function (v) { return v.images;}),
'share_product.desc': data.goods.simple_desc,
'share_product.category_list': data.goods.category_names || [],
'share_product.src_mini_program_path': '/pages/goods-detail/goods-detail?goods_id='+data.goods.id,
'share_product.brand_info.name': data.goods.brand_name,
}); });
// 限时秒杀倒计时 // 限时秒杀倒计时
......
{ {
"enablePullDownRefresh": true, "enablePullDownRefresh": true,
"usingComponents": { "usingComponents": {
"component-popup": "/components/popup/popup" "component-popup": "/components/popup/popup",
"share-button": "plugin://goodsSharePlugin/share-button"
} }
} }
\ No newline at end of file
...@@ -175,9 +175,11 @@ ...@@ -175,9 +175,11 @@
</view> </view>
</view> </view>
<view class="share-popup-content"> <view class="share-popup-content">
<view class="share-items oh"> <view wx:if="{{common_app_is_good_thing == 1}}" class="share-items oh">
<share-button product="{{share_product}}" type="3" class="dis-block oh">
<image class="fl" src="/images/share-recomend-icon.png" mode="scaleToFill" /> <image class="fl" src="/images/share-recomend-icon.png" mode="scaleToFill" />
<view class="cr-888 single-text fl">好物推荐、和大家一起分享你发现的宝贝</view> <view class="cr-888 single-text fl">好物推荐、和大家一起分享你发现的宝贝</view>
</share-button>
</view> </view>
<view class="share-items oh"> <view class="share-items oh">
<button class="dis-block" type="default" size="mini" open-type="share" hover-class="none"> <button class="dis-block" type="default" size="mini" open-type="share" hover-class="none">
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册