提交 b416af4c 编写于 作者: D devil_gong

优惠劵

上级 3bea0b22
......@@ -52,7 +52,7 @@ class Coupon extends Common
'is_user_receive' => 1,
],
'm' => 0,
'n' => 1000000,
'n' => 0,
'is_sure_receive' => 1,
'user' => $this->user,
];
......
......@@ -126,6 +126,7 @@ class Goods extends Common
'common_app_is_limitedtimediscount' => (int) MyC('common_app_is_limitedtimediscount'),
'common_app_is_good_thing' => (int) MyC('common_app_is_good_thing'),
'common_app_is_poster_share' => (int) MyC('common_app_is_poster_share'),
'plugins_coupon_data' => $this->PluginsCouponGoods($goods_id),
];
// 秒杀
......@@ -140,6 +141,43 @@ class Goods extends Common
return DataReturn('success', 0, $result);
}
/**
* 商品详情优惠劵
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2019-10-17
* @desc description
* @param [int] $goods_id [商品id]
*/
private function PluginsCouponGoods($goods_id)
{
// 获取基础配置信息
$base = CallPluginsData('coupon');
// 优惠劵列表
$coupon_params = [
'where' => [
'is_enable' => 1,
'is_user_receive' => 1,
],
'm' => 0,
'n' => 0,
'is_sure_receive' => 1,
'user' => $this->user,
];
$ret = CallPluginsServiceMethod('coupon', 'CouponService', 'CouponList', $coupon_params);
// 排除商品不支持的活动
$ret['data'] = CallPluginsServiceMethod('coupon', 'BaseService', 'CouponListGoodsExclude', ['data'=>$ret['data'], 'goods_id'=>$goods_id]);
// 返回数据
return [
'base' => $base['data'],
'data' => $ret['data'],
];
}
/**
* 用户商品收藏
* @author Devil
......
{
"pages": [
"pages": ["pages/goods-detail/goods-detail",
"pages/index/index",
"pages/goods-category/goods-category",
"pages/cart/cart",
......@@ -8,7 +8,7 @@
"pages/login/login",
"pages/paytips/paytips",
"pages/goods-search/goods-search",
"pages/goods-detail/goods-detail",
"pages/goods-comment/goods-comment",
"pages/goods-attribute/goods-attribute",
"pages/buy/buy",
......
......@@ -59,9 +59,9 @@ Page({
// 海报分享
common_app_is_poster_share: 0,
},
on_error(e) {
console.log(e)
// 优惠劵
plugins_coupon_data: null,
},
onLoad(params) {
......@@ -69,7 +69,7 @@ Page({
params = app.launch_params_handle(params);
// 参数赋值,初始化
//params['goods_id']=2;
params['goods_id']=2;
this.setData({params: params});
this.init();
},
......@@ -151,6 +151,7 @@ Page({
'share_product.brand_info.name': data.goods.brand_name,
common_app_is_poster_share: data.common_app_is_poster_share || 0,
plugins_coupon_data: data.plugins_coupon_data || null,
});
// 限时秒杀倒计时
......
......@@ -64,6 +64,29 @@
</view>
</view>
<!-- 优惠劵 -->
<view wx:if="{{(plugins_coupon_data || null) != null && plugins_coupon_data.data.length > 0}}" class="coupon-container wh-auto spacing-mt bg-white">
<scroll-view scroll-x="true">
<block wx:for="{{plugins_coupon_data.data}}" wx:key="item">
<view class="item bg-white {{item.is_operable == 0 ? 'item-disabled' : ''}}" style="border:1px solid {{item.bg_color_value}};">
<view class="v-left fl">
<view class="base single-text" style="color:{{item.bg_color_value}};">
<text class="symbol">¥</text>
<text class="price">{{item.discount_value}}</text>
<text class="unit">{{item.type == 0 ? '元' : '折'}}</text>
<text wx:if="{{(item.desc || null) != null}}" class="desc cr-888">{{item.desc}}</text>
</view>
<view wx:if="{{(item.use_limit_type_name || null) != null}}" class="base-tips cr-666 single-text">{{item.use_limit_type_name}}</view>
</view>
<view class="v-right fr" bindtap="receive_event" data-index="{{index}}" data-value="{{item.id}}" style="background:{{item.bg_color_value}};">
<text class="circle"></text>
<text>{{item.is_operable_name}}</text>
</view>
</view>
</block>
</scroll-view>
</view>
<!-- 属性导航 -->
<!-- <view wx:if="{{false}}" class="spacing">
<view class="goods-attr-show-title bg-white arrow-right cr-666" bindtap="good_attribute_nav_event">
......
......@@ -290,4 +290,18 @@
}
.limitedtimediscount .countdown .ds {
padding: 0 4rpx;
}
.coupon-container {
white-space: nowrap;
box-sizing: border-box;
padding: 20rpx 10rpx;
}
.coupon-container .item {
display: inline-block;
}
.coupon-container .item:not(:last-child) {
margin-right: 20rpx;
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册