小程序优惠劵
parent
250d8fa2a1
commit
e05d4d23f0
|
|
@ -0,0 +1,58 @@
|
||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | ShopXO 国内领先企业级B2C免费开源电商系统
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2011~2019 http://shopxo.net All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: Devil
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
namespace app\api\controller;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 优惠劵
|
||||||
|
* @author Devil
|
||||||
|
* @blog http://gong.gg/
|
||||||
|
* @version 0.0.1
|
||||||
|
* @datetime 2016-12-01T21:51:08+0800
|
||||||
|
*/
|
||||||
|
class Coupon extends Common
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* [__construct 构造方法]
|
||||||
|
* @author Devil
|
||||||
|
* @blog http://gong.gg/
|
||||||
|
* @version 0.0.1
|
||||||
|
* @datetime 2016-12-03T12:39:08+0800
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
// 调用父类前置方法
|
||||||
|
parent::__construct();
|
||||||
|
|
||||||
|
// 是否登录
|
||||||
|
$this->IsLogin();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户优惠劵列表
|
||||||
|
* @author Devil
|
||||||
|
* @blog http://gong.gg/
|
||||||
|
* @version 1.0.0
|
||||||
|
* @date 2018-07-12
|
||||||
|
* @desc description
|
||||||
|
*/
|
||||||
|
public function User()
|
||||||
|
{
|
||||||
|
$coupon_params = [
|
||||||
|
'user' => $this->user,
|
||||||
|
'where' => [
|
||||||
|
'user_id' => $this->user['id'],
|
||||||
|
'is_valid' => 1,
|
||||||
|
],
|
||||||
|
];
|
||||||
|
return CallPluginsServiceMethod('coupon', 'UserCouponService', 'CouponUserList', $coupon_params);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
@ -32,5 +32,53 @@ return array (
|
||||||
'log_write' =>
|
'log_write' =>
|
||||||
array (
|
array (
|
||||||
),
|
),
|
||||||
|
'plugins_css' =>
|
||||||
|
array (
|
||||||
|
0 => 'app\\plugins\\coupon\\Hook',
|
||||||
|
),
|
||||||
|
'plugins_js' =>
|
||||||
|
array (
|
||||||
|
0 => 'app\\plugins\\coupon\\Hook',
|
||||||
|
),
|
||||||
|
'plugins_service_navigation_header_handle' =>
|
||||||
|
array (
|
||||||
|
0 => 'app\\plugins\\coupon\\Hook',
|
||||||
|
),
|
||||||
|
'plugins_service_users_center_left_menu_handle' =>
|
||||||
|
array (
|
||||||
|
0 => 'app\\plugins\\coupon\\Hook',
|
||||||
|
),
|
||||||
|
'plugins_service_header_navigation_top_right_handle' =>
|
||||||
|
array (
|
||||||
|
0 => 'app\\plugins\\coupon\\Hook',
|
||||||
|
),
|
||||||
|
'plugins_view_goods_detail_panel_bottom' =>
|
||||||
|
array (
|
||||||
|
0 => 'app\\plugins\\coupon\\Hook',
|
||||||
|
),
|
||||||
|
'plugins_view_buy_goods_bottom' =>
|
||||||
|
array (
|
||||||
|
0 => 'app\\plugins\\coupon\\Hook',
|
||||||
|
),
|
||||||
|
'plugins_service_buy_handle' =>
|
||||||
|
array (
|
||||||
|
0 => 'app\\plugins\\coupon\\Hook',
|
||||||
|
),
|
||||||
|
'plugins_view_buy_form_inside' =>
|
||||||
|
array (
|
||||||
|
0 => 'app\\plugins\\coupon\\Hook',
|
||||||
|
),
|
||||||
|
'plugins_service_buy_order_insert_success' =>
|
||||||
|
array (
|
||||||
|
0 => 'app\\plugins\\coupon\\Hook',
|
||||||
|
),
|
||||||
|
'plugins_service_order_status_change_history_success_handle' =>
|
||||||
|
array (
|
||||||
|
0 => 'app\\plugins\\coupon\\Hook',
|
||||||
|
),
|
||||||
|
'plugins_service_user_register_end' =>
|
||||||
|
array (
|
||||||
|
0 => 'app\\plugins\\coupon\\Hook',
|
||||||
|
),
|
||||||
);
|
);
|
||||||
?>
|
?>
|
||||||
|
|
@ -60,12 +60,13 @@ App({
|
||||||
"user_orderaftersale": "退款/售后",
|
"user_orderaftersale": "退款/售后",
|
||||||
"user_orderaftersale_detail": "订单售后",
|
"user_orderaftersale_detail": "订单售后",
|
||||||
"user_order_comments": "订单评论",
|
"user_order_comments": "订单评论",
|
||||||
|
"user_coupon": "优惠劵",
|
||||||
},
|
},
|
||||||
|
|
||||||
// 请求地址
|
// 请求地址
|
||||||
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}}",
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"pages": [
|
"pages": ["pages/user-coupon/user-coupon",
|
||||||
"pages/index/index",
|
"pages/index/index",
|
||||||
"pages/goods-category/goods-category",
|
"pages/goods-category/goods-category",
|
||||||
"pages/cart/cart",
|
"pages/cart/cart",
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
"pages/user-goods-browse/user-goods-browse",
|
"pages/user-goods-browse/user-goods-browse",
|
||||||
"pages/user-orderaftersale/user-orderaftersale",
|
"pages/user-orderaftersale/user-orderaftersale",
|
||||||
"pages/user-orderaftersale-detail/user-orderaftersale-detail"
|
"pages/user-orderaftersale-detail/user-orderaftersale-detail"
|
||||||
|
|
||||||
],
|
],
|
||||||
"window": {
|
"window": {
|
||||||
"navigationBarTitleText": "{{application_title}}",
|
"navigationBarTitleText": "{{application_title}}",
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,79 @@
|
||||||
|
const app = getApp();
|
||||||
|
Page({
|
||||||
|
data: {
|
||||||
|
data_bottom_line_status: false,
|
||||||
|
data_list_loding_status: 1,
|
||||||
|
data_list_loding_msg: '',
|
||||||
|
data_list: [],
|
||||||
|
},
|
||||||
|
|
||||||
|
onLoad(params) {
|
||||||
|
this.init();
|
||||||
|
},
|
||||||
|
|
||||||
|
onShow() {
|
||||||
|
wx.setNavigationBarTitle({ title: app.data.common_pages_title.user_coupon });
|
||||||
|
},
|
||||||
|
|
||||||
|
init() {
|
||||||
|
var user = app.get_user_cache_info(this, "init");
|
||||||
|
// 用户未绑定用户则转到登录页面
|
||||||
|
if (app.user_is_need_login(user)) {
|
||||||
|
wx.redirectTo({
|
||||||
|
url: "/pages/login/login?event_callback=init"
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
// 获取数据
|
||||||
|
this.get_data_list();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
get_data_list() {
|
||||||
|
var self = this;
|
||||||
|
wx.showLoading({ title: "加载中..." });
|
||||||
|
this.setData({
|
||||||
|
data_list_loding_status: 1
|
||||||
|
});
|
||||||
|
|
||||||
|
wx.request({
|
||||||
|
url: app.get_request_url("user", "coupon"),
|
||||||
|
method: "POST",
|
||||||
|
data: {},
|
||||||
|
dataType: "json",
|
||||||
|
success: res => {
|
||||||
|
wx.hideLoading();
|
||||||
|
wx.stopPullDownRefresh();
|
||||||
|
if (res.data.code == 0) {
|
||||||
|
self.setData({
|
||||||
|
data_list: res.data.data,
|
||||||
|
data_list_loding_status: 3,
|
||||||
|
data_list_loding_msg: '',
|
||||||
|
});
|
||||||
|
|
||||||
|
} else {
|
||||||
|
self.setData({
|
||||||
|
data_list_loding_status: 2,
|
||||||
|
data_list_loding_msg: res.data.msg,
|
||||||
|
});
|
||||||
|
app.showToast(res.data.msg);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: () => {
|
||||||
|
wx.hideLoading();
|
||||||
|
wx.stopPullDownRefresh();
|
||||||
|
self.setData({
|
||||||
|
data_list_loding_status: 2,
|
||||||
|
data_list_loding_msg: '服务器请求出错',
|
||||||
|
});
|
||||||
|
app.showToast("服务器请求出错");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
// 下拉刷新
|
||||||
|
onPullDownRefresh() {
|
||||||
|
this.get_data_list();
|
||||||
|
},
|
||||||
|
|
||||||
|
});
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"usingComponents": {}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
<!--pages/user-coupon/user-coupon.wxml-->
|
||||||
|
<text>pages/user-coupon/user-coupon.wxml</text>
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
/* pages/user-coupon/user-coupon.wxss */
|
||||||
Loading…
Reference in New Issue