From e05d4d23f017b339f25601ff2b77bf7bcacb15ed Mon Sep 17 00:00:00 2001 From: devil_gong Date: Fri, 11 Oct 2019 19:46:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E4=BC=98=E6=83=A0?= =?UTF-8?q?=E5=8A=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/controller/Coupon.php | 58 ++++++++++++++ application/tags.php | 48 +++++++++++ public/appmini/old/weixin/app.js | 3 +- public/appmini/old/weixin/app.json | 3 +- .../weixin/pages/user-coupon/user-coupon.js | 79 +++++++++++++++++++ .../weixin/pages/user-coupon/user-coupon.json | 3 + .../weixin/pages/user-coupon/user-coupon.wxml | 2 + .../weixin/pages/user-coupon/user-coupon.wxss | 1 + 8 files changed, 195 insertions(+), 2 deletions(-) create mode 100644 application/api/controller/Coupon.php create mode 100644 public/appmini/old/weixin/pages/user-coupon/user-coupon.js create mode 100644 public/appmini/old/weixin/pages/user-coupon/user-coupon.json create mode 100644 public/appmini/old/weixin/pages/user-coupon/user-coupon.wxml create mode 100644 public/appmini/old/weixin/pages/user-coupon/user-coupon.wxss diff --git a/application/api/controller/Coupon.php b/application/api/controller/Coupon.php new file mode 100644 index 000000000..068e08842 --- /dev/null +++ b/application/api/controller/Coupon.php @@ -0,0 +1,58 @@ +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); + } +} +?> \ No newline at end of file diff --git a/application/tags.php b/application/tags.php index 7fb4b4ce8..6c37827df 100755 --- a/application/tags.php +++ b/application/tags.php @@ -32,5 +32,53 @@ return array ( 'log_write' => 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', + ), ); ?> \ No newline at end of file diff --git a/public/appmini/old/weixin/app.js b/public/appmini/old/weixin/app.js index 84783366d..3a194caeb 100755 --- a/public/appmini/old/weixin/app.js +++ b/public/appmini/old/weixin/app.js @@ -60,12 +60,13 @@ App({ "user_orderaftersale": "退款/售后", "user_orderaftersale_detail": "订单售后", "user_order_comments": "订单评论", + "user_coupon": "优惠劵", }, // 请求地址 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}}", diff --git a/public/appmini/old/weixin/app.json b/public/appmini/old/weixin/app.json index c76715ec6..b9e1692d0 100755 --- a/public/appmini/old/weixin/app.json +++ b/public/appmini/old/weixin/app.json @@ -1,5 +1,5 @@ { - "pages": [ + "pages": ["pages/user-coupon/user-coupon", "pages/index/index", "pages/goods-category/goods-category", "pages/cart/cart", @@ -26,6 +26,7 @@ "pages/user-goods-browse/user-goods-browse", "pages/user-orderaftersale/user-orderaftersale", "pages/user-orderaftersale-detail/user-orderaftersale-detail" + ], "window": { "navigationBarTitleText": "{{application_title}}", diff --git a/public/appmini/old/weixin/pages/user-coupon/user-coupon.js b/public/appmini/old/weixin/pages/user-coupon/user-coupon.js new file mode 100644 index 000000000..9f988e710 --- /dev/null +++ b/public/appmini/old/weixin/pages/user-coupon/user-coupon.js @@ -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(); + }, + +}); diff --git a/public/appmini/old/weixin/pages/user-coupon/user-coupon.json b/public/appmini/old/weixin/pages/user-coupon/user-coupon.json new file mode 100644 index 000000000..8835af069 --- /dev/null +++ b/public/appmini/old/weixin/pages/user-coupon/user-coupon.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/public/appmini/old/weixin/pages/user-coupon/user-coupon.wxml b/public/appmini/old/weixin/pages/user-coupon/user-coupon.wxml new file mode 100644 index 000000000..fca1becba --- /dev/null +++ b/public/appmini/old/weixin/pages/user-coupon/user-coupon.wxml @@ -0,0 +1,2 @@ + +pages/user-coupon/user-coupon.wxml diff --git a/public/appmini/old/weixin/pages/user-coupon/user-coupon.wxss b/public/appmini/old/weixin/pages/user-coupon/user-coupon.wxss new file mode 100644 index 000000000..61124bcc5 --- /dev/null +++ b/public/appmini/old/weixin/pages/user-coupon/user-coupon.wxss @@ -0,0 +1 @@ +/* pages/user-coupon/user-coupon.wxss */ \ No newline at end of file