From 81a5bca78d4bc8134bcadf6bb72b7bba478c1bd2 Mon Sep 17 00:00:00 2001 From: devil_gong Date: Thu, 17 Oct 2019 15:18:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E4=BC=98=E6=83=A0=E5=8A=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/service/PluginsService.php | 1 + public/appmini/old/alipay/app.acss | 70 ++++++++++ public/appmini/old/alipay/app.js | 2 + public/appmini/old/alipay/app.json | 4 +- .../old/alipay/pages/coupon/coupon.acss | 0 .../old/alipay/pages/coupon/coupon.axml | 30 ++++ .../appmini/old/alipay/pages/coupon/coupon.js | 131 ++++++++++++++++++ .../old/alipay/pages/coupon/coupon.json | 3 + .../pages/goods-detail/goods-detail.acss | 30 ++++ .../pages/goods-detail/goods-detail.axml | 23 +++ .../alipay/pages/goods-detail/goods-detail.js | 49 +++++++ .../alipay/pages/user-coupon/user-coupon.acss | 35 +++++ .../alipay/pages/user-coupon/user-coupon.axml | 87 ++++++++++++ .../alipay/pages/user-coupon/user-coupon.js | 108 +++++++++++++++ .../alipay/pages/user-coupon/user-coupon.json | 3 + public/appmini/old/baidu/app.css | 70 ++++++++++ public/appmini/old/baidu/app.js | 2 + public/appmini/old/baidu/app.json | 4 +- .../appmini/old/baidu/pages/coupon/coupon.css | 0 .../appmini/old/baidu/pages/coupon/coupon.js | 129 +++++++++++++++++ .../old/baidu/pages/coupon/coupon.json | 3 + .../old/baidu/pages/coupon/coupon.swan | 30 ++++ .../baidu/pages/goods-detail/goods-detail.css | 30 ++++ .../baidu/pages/goods-detail/goods-detail.js | 50 ++++++- .../pages/goods-detail/goods-detail.swan | 23 +++ .../baidu/pages/user-coupon/user-coupon.css | 35 +++++ .../baidu/pages/user-coupon/user-coupon.js | 104 ++++++++++++++ .../baidu/pages/user-coupon/user-coupon.json | 3 + .../baidu/pages/user-coupon/user-coupon.swan | 87 ++++++++++++ public/appmini/old/weixin/app.wxss | 1 - .../appmini/old/weixin/pages/coupon/coupon.js | 15 +- .../weixin/pages/goods-detail/goods-detail.js | 4 +- .../pages/goods-detail/goods-detail.wxss | 2 - .../weixin/pages/user-coupon/user-coupon.wxml | 4 +- 34 files changed, 1156 insertions(+), 16 deletions(-) create mode 100644 public/appmini/old/alipay/pages/coupon/coupon.acss create mode 100644 public/appmini/old/alipay/pages/coupon/coupon.axml create mode 100644 public/appmini/old/alipay/pages/coupon/coupon.js create mode 100644 public/appmini/old/alipay/pages/coupon/coupon.json create mode 100644 public/appmini/old/alipay/pages/user-coupon/user-coupon.acss create mode 100644 public/appmini/old/alipay/pages/user-coupon/user-coupon.axml create mode 100644 public/appmini/old/alipay/pages/user-coupon/user-coupon.js create mode 100644 public/appmini/old/alipay/pages/user-coupon/user-coupon.json create mode 100644 public/appmini/old/baidu/pages/coupon/coupon.css create mode 100644 public/appmini/old/baidu/pages/coupon/coupon.js create mode 100644 public/appmini/old/baidu/pages/coupon/coupon.json create mode 100644 public/appmini/old/baidu/pages/coupon/coupon.swan create mode 100644 public/appmini/old/baidu/pages/user-coupon/user-coupon.css create mode 100644 public/appmini/old/baidu/pages/user-coupon/user-coupon.js create mode 100644 public/appmini/old/baidu/pages/user-coupon/user-coupon.json create mode 100644 public/appmini/old/baidu/pages/user-coupon/user-coupon.swan diff --git a/application/service/PluginsService.php b/application/service/PluginsService.php index 3a83967f5..7335df767 100755 --- a/application/service/PluginsService.php +++ b/application/service/PluginsService.php @@ -36,6 +36,7 @@ class PluginsService public static function PluginsData($plugins, $attachment_field = [], $is_cache = true) { // 从缓存获取数据 + $data = []; $key = config('shopxo.cache_plugins_data_key').$plugins; if($is_cache === true) { diff --git a/public/appmini/old/alipay/app.acss b/public/appmini/old/alipay/app.acss index 56959c491..7fa3fe4f5 100644 --- a/public/appmini/old/alipay/app.acss +++ b/public/appmini/old/alipay/app.acss @@ -337,4 +337,74 @@ textarea { width: 210rpx; height: 210rpx; border: 1px dashed #e9e9e9; +} + +/* + * 优惠劵 - 插件 + */ +.coupon-container { + padding: 0 10rpx; +} +.coupon-container .item { + overflow: hidden; + height: 180rpx; + border: 1px solid #D2364C; +} +.coupon-container .v-left { + width: calc(100% - 140rpx); + padding: 30rpx 0 30rpx 20rpx; + box-sizing:border-box; + -moz-box-sizing:border-box; + -webkit-box-sizing:border-box; +} +.coupon-container .v-left .base { + color: #D2364C; +} +.coupon-container .v-left .base .symbol { + font-family: Verdana, Tahoma; + font-size: 48rpx; + font-weight: 400; +} +.coupon-container .v-left .base .price { + font-weight: 700; + font-family: arial; + font-size: 76rpx; +} +.coupon-container .v-left .base .desc { + margin-left: 20rpx; +} +.coupon-container .v-left base-tips, .coupon-container .v-left .base-time { + margin-top: 10rpx; +} +.coupon-container .v-right { + background: #d2364c; + width: 140rpx; + height: 180rpx; + color: #fff; + font-weight: 500; + position: relative; + text-align: center; +} +.coupon-container .v-right:before { + content: ''; + display: inline-block; + height: 100%; + vertical-align: middle; +} +.coupon-container .v-right .circle { + display: block; + position: absolute; + left: -1px; + top: -3px; + width: 3px; + height: 180rpx; + background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAACpCAYAAADur4c3AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3NpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNS1jMDE0IDc5LjE1MTQ4MSwgMjAxMy8wMy8xMy0xMjowOToxNSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXg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vEM2gBmZswrmnA1AzAXiaJPhHC1k58BNQ3bBTGTOR2QD/iJzFsH8Mw/kHxBHggzn2KA7BxzWyC5Yisz5imwACmc2LLY7QbEN4nCS4ZwAIGZFds5lUEpEdsF6nKn3PTJnAsiAV0BcBsSM5GamFCDmQXYOOJ8iu2Anzrz9HKU8ABlwDYgTKcnbo0XNaFEzWtQgipqOYVLUAAQYAKPWa4c8cIHnAAAAAElFTkSuQmCC) no-repeat; +} +.coupon-container .item-disabled .v-right { + background: #dfdfdf !important; + color: #c0c0c0 !important; + cursor: no-drop !important; +} +.coupon-container .item-disabled { + border: 1px solid #dfdfdf !important; } \ No newline at end of file diff --git a/public/appmini/old/alipay/app.js b/public/appmini/old/alipay/app.js index 45d762b0c..347436d59 100644 --- a/public/appmini/old/alipay/app.js +++ b/public/appmini/old/alipay/app.js @@ -60,6 +60,8 @@ App({ "user_orderaftersale": "退款/售后", "user_orderaftersale_detail": "订单售后", "user_order_comments": "订单评论", + "coupon": "领劵中心", + "user_coupon": "优惠劵", }, // 请求地址 diff --git a/public/appmini/old/alipay/app.json b/public/appmini/old/alipay/app.json index 522812671..ae2b02648 100644 --- a/public/appmini/old/alipay/app.json +++ b/public/appmini/old/alipay/app.json @@ -25,7 +25,9 @@ "pages/user-integral/user-integral", "pages/user-goods-browse/user-goods-browse", "pages/user-orderaftersale/user-orderaftersale", - "pages/user-orderaftersale-detail/user-orderaftersale-detail" + "pages/user-orderaftersale-detail/user-orderaftersale-detail", + "pages/coupon/coupon", + "pages/user-coupon/user-coupon" ], "window": { "defaultTitle": "shopxo", diff --git a/public/appmini/old/alipay/pages/coupon/coupon.acss b/public/appmini/old/alipay/pages/coupon/coupon.acss new file mode 100644 index 000000000..e69de29bb diff --git a/public/appmini/old/alipay/pages/coupon/coupon.axml b/public/appmini/old/alipay/pages/coupon/coupon.axml new file mode 100644 index 000000000..24037eb5b --- /dev/null +++ b/public/appmini/old/alipay/pages/coupon/coupon.axml @@ -0,0 +1,30 @@ + + + + + + + + + + {{item.discount_value}} + {{item.type_unit}} + {{item.desc}} + + {{item.use_limit_type_name}} + + + + {{item.is_operable_name}} + + + + + + + + + + + + \ No newline at end of file diff --git a/public/appmini/old/alipay/pages/coupon/coupon.js b/public/appmini/old/alipay/pages/coupon/coupon.js new file mode 100644 index 000000000..248242976 --- /dev/null +++ b/public/appmini/old/alipay/pages/coupon/coupon.js @@ -0,0 +1,131 @@ +const app = getApp(); +Page({ + data: { + data_bottom_line_status: false, + data_list_loding_status: 1, + data_list_loding_msg: '', + data_list: [], + data_base: null, + }, + + onLoad(params) { + this.init(); + }, + + onShow() { + my.setNavigationBar({title: app.data.common_pages_title.coupon }); + }, + + init() { + // 获取数据 + this.get_data_list(); + }, + + // 获取数据 + get_data_list() { + var self = this; + my.showLoading({ title: "加载中..." }); + if (self.data.data_list.length <= 0) + { + self.setData({ + data_list_loding_status: 1 + }); + } + + my.request({ + url: app.get_request_url("index", "coupon"), + method: "POST", + data: {}, + dataType: "json", + success: res => { + my.hideLoading(); + my.stopPullDownRefresh(); + if (res.data.code == 0) { + var data = res.data.data; + var status = ((data.data || []).length > 0); + this.setData({ + data_base: data.base || null, + data_list: data.data || [], + data_list_loding_msg: '', + data_list_loding_status: status ? 3 : 0, + data_bottom_line_status: status, + }); + + // 导航名称 + if ((data.base || null) != null && (data.base.application_name || null) != null) + { + my.setNavigationBar({title: data.base.application_name }); + } + } else { + self.setData({ + data_bottom_line_status: false, + data_list_loding_status: 2, + data_list_loding_msg: res.data.msg, + }); + app.showToast(res.data.msg); + } + }, + fail: () => { + my.hideLoading(); + my.stopPullDownRefresh(); + self.setData({ + data_bottom_line_status: false, + data_list_loding_status: 2, + data_list_loding_msg: '服务器请求出错', + }); + app.showToast("服务器请求出错"); + } + }); + }, + + // 优惠劵领取事件 + coupon_receive_event(e) { + var user = app.get_user_info(this, "coupon_receive_event"); + // 用户未绑定用户则转到登录页面 + if (app.user_is_need_login(user)) { + my.redirectTo({ + url: "/pages/login/login?event_callback=coupon_receive_event" + }); + return false; + } else { + var self = this; + var index = e.currentTarget.dataset.index; + var value = e.currentTarget.dataset.value; + var temp_list = this.data.data_list; + if (temp_list[index]['is_operable'] != 0) { + my.showLoading({ title: "处理中..." }); + my.request({ + url: app.get_request_url("receive", "coupon"), + method: "POST", + data: { "coupon_id": value }, + dataType: "json", + header: { 'content-type': 'application/x-www-form-urlencoded' }, + success: res => { + my.hideLoading(); + if (res.data.code == 0) { + app.showToast(res.data.msg, "success"); + if (self.data.data_base != null && self.data.data_base.is_repeat_receive != 1) + { + temp_list[index]['is_operable'] = 0; + temp_list[index]['is_operable_name'] = '已领取'; + self.setData({ data_list: temp_list }); + } + } else { + app.showToast(res.data.msg); + } + }, + fail: () => { + my.hideLoading(); + app.showToast("服务器请求出错"); + } + }); + } + } + }, + + // 下拉刷新 + onPullDownRefresh() { + this.get_data_list(); + }, + +}); diff --git a/public/appmini/old/alipay/pages/coupon/coupon.json b/public/appmini/old/alipay/pages/coupon/coupon.json new file mode 100644 index 000000000..ed3a57db1 --- /dev/null +++ b/public/appmini/old/alipay/pages/coupon/coupon.json @@ -0,0 +1,3 @@ +{ + "pullRefresh": true +} \ No newline at end of file diff --git a/public/appmini/old/alipay/pages/goods-detail/goods-detail.acss b/public/appmini/old/alipay/pages/goods-detail/goods-detail.acss index 338e4b8e6..0895ec716 100644 --- a/public/appmini/old/alipay/pages/goods-detail/goods-detail.acss +++ b/public/appmini/old/alipay/pages/goods-detail/goods-detail.acss @@ -266,4 +266,34 @@ } .limitedtimediscount .countdown .ds { padding: 0 4rpx; +} + +/* + * 优惠劵 - 插件 + */ +.coupon-container { + white-space: nowrap; + box-sizing: border-box; + padding: 20rpx 10rpx; +} +.coupon-container scroll-view { + height: 174rpx; +} +.coupon-container .item { + display: inline-block; + width: 60vw; +} +.coupon-container .v-left { + padding: 20rpx 0 20rpx 20rpx; +} +.coupon-container .item:not(:last-child) { + margin-right: 20rpx; +} +.coupon-container .item, +.coupon-container .v-right, +.coupon-container .v-right .circle { + height: 170rpx; +} +.coupon-container .v-left .base .price { + font-size: 46rpx; } \ No newline at end of file diff --git a/public/appmini/old/alipay/pages/goods-detail/goods-detail.axml b/public/appmini/old/alipay/pages/goods-detail/goods-detail.axml index 86cf0f05e..e470bf911 100644 --- a/public/appmini/old/alipay/pages/goods-detail/goods-detail.axml +++ b/public/appmini/old/alipay/pages/goods-detail/goods-detail.axml @@ -55,6 +55,29 @@ + + + + + + + + + {{item.discount_value}} + {{item.type_unit}} + + {{item.use_limit_type_name}} + {{item.desc}} + + + + {{item.is_operable_name}} + + + + + + + + + {{item.name}} + + + + + + + + + + + + + {{item.coupon.discount_value}} + {{item.coupon.type_unit}} + {{item.coupon.desc}} + + {{item.coupon.use_limit_type_name}} + {{item.time_start_text}} 至 {{item.time_end_text}} + + + + + 去使用 + + + + + + + + + + + + + + {{item.coupon.discount_value}} + {{item.type_unit}} + {{item.coupon.desc}} + + {{item.coupon.use_limit_type_name}} + 使用 {{item.use_time_text}} + + + + 已使用 + + + + + + + + + + + + + {{item.coupon.discount_value}} + {{item.type_unit}} + {{item.coupon.desc}} + + {{item.coupon.use_limit_type_name}} + 过期 {{item.time_end_text}} + + + + 已过期 + + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/appmini/old/alipay/pages/user-coupon/user-coupon.js b/public/appmini/old/alipay/pages/user-coupon/user-coupon.js new file mode 100644 index 000000000..9762ceb3f --- /dev/null +++ b/public/appmini/old/alipay/pages/user-coupon/user-coupon.js @@ -0,0 +1,108 @@ +const app = getApp(); +Page({ + data: { + data_bottom_line_status: false, + data_list_loding_status: 1, + data_list_loding_msg: '', + data_list: null, + + nav_tabs_list: [ + { name: "未使用", value: "not_use" }, + { name: "已使用", value: "already_use" }, + { name: "已过期", value: "already_expire" }, + ], + nav_tabs_value: 'not_use', + }, + + onLoad(params) { + this.init(); + }, + + onShow() { + my.setNavigationBar({title: app.data.common_pages_title.user_coupon }); + }, + + init() { + var user = app.get_user_info(this, "init"); + // 用户未绑定用户则转到登录页面 + if (app.user_is_need_login(user)) { + my.redirectTo({ + url: "/pages/login/login?event_callback=init" + }); + return false; + } else { + // 获取数据 + this.get_data_list(); + } + }, + + // 获取数据 + get_data_list() { + var self = this; + my.showLoading({ title: "加载中..." }); + if (this.data.data_list == null || (this.data.data_list[this.data.nav_tabs_value] || null) == null || this.data.data_list[this.data.nav_tabs_value].length <= 0) { + this.setData({ + data_list_loding_status: 1 + }); + } + + my.request({ + url: app.get_request_url("user", "coupon"), + method: "POST", + data: {}, + dataType: "json", + success: res => { + my.hideLoading(); + my.stopPullDownRefresh(); + if (res.data.code == 0) { + self.setData({ + data_list: res.data.data || null, + data_list_loding_msg: '', + }); + self.data_view_handle(); + } else { + self.setData({ + data_bottom_line_status: false, + data_list_loding_status: 2, + data_list_loding_msg: res.data.msg, + }); + app.showToast(res.data.msg); + } + }, + fail: () => { + my.hideLoading(); + my.stopPullDownRefresh(); + self.setData({ + data_bottom_line_status: false, + data_list_loding_status: 2, + data_list_loding_msg: '服务器请求出错', + }); + app.showToast("服务器请求出错"); + } + }); + }, + + // 数据处理 + data_view_handle() { + var status = 0; + if (this.data.data_list != null && (this.data.data_list[this.data.nav_tabs_value] || null) != null && this.data.data_list[this.data.nav_tabs_value].length > 0) { + status = 3; + } + this.setData({ + data_list_loding_status: status, + data_bottom_line_status: (status == 3), + }); + }, + + // 导航事件 + nav_tabs_event(e) { + this.setData({ nav_tabs_value: e.currentTarget.dataset.value}); + this.data_view_handle(); + }, + + // 下拉刷新 + onPullDownRefresh() { + this.get_data_list(); + }, + +}); diff --git a/public/appmini/old/alipay/pages/user-coupon/user-coupon.json b/public/appmini/old/alipay/pages/user-coupon/user-coupon.json new file mode 100644 index 000000000..ed3a57db1 --- /dev/null +++ b/public/appmini/old/alipay/pages/user-coupon/user-coupon.json @@ -0,0 +1,3 @@ +{ + "pullRefresh": true +} \ No newline at end of file diff --git a/public/appmini/old/baidu/app.css b/public/appmini/old/baidu/app.css index 93c2bc256..4fe08e418 100755 --- a/public/appmini/old/baidu/app.css +++ b/public/appmini/old/baidu/app.css @@ -405,4 +405,74 @@ button[disabled].bg-primary { width: 210rpx; height: 210rpx; border: 1px dashed #e9e9e9; +} + +/* + * 优惠劵 - 插件 + */ +.coupon-container { + padding: 0 10rpx; +} +.coupon-container .item { + overflow: hidden; + height: 180rpx; + border: 1px solid #D2364C; +} +.coupon-container .v-left { + width: calc(100% - 140rpx); + padding: 30rpx 0 30rpx 20rpx; + box-sizing:border-box; + -moz-box-sizing:border-box; + -webkit-box-sizing:border-box; +} +.coupon-container .v-left .base { + color: #D2364C; +} +.coupon-container .v-left .base .symbol { + font-family: Verdana, Tahoma; + font-size: 48rpx; + font-weight: 400; +} +.coupon-container .v-left .base .price { + font-weight: 700; + font-family: arial; + font-size: 76rpx; +} +.coupon-container .v-left .base .desc { + margin-left: 20rpx; +} +.coupon-container .v-left base-tips, .coupon-container .v-left .base-time { + margin-top: 10rpx; +} +.coupon-container .v-right { + background: #d2364c; + width: 140rpx; + height: 180rpx; + color: #fff; + font-weight: 500; + position: relative; + text-align: center; +} +.coupon-container .v-right:before { + content: ''; + display: inline-block; + height: 100%; + vertical-align: middle; +} +.coupon-container .v-right .circle { + display: block; + position: absolute; + left: -1px; + top: -3px; + width: 3px; + height: 180rpx; + background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAACpCAYAAADur4c3AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3NpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNS1jMDE0IDc5LjE1MTQ4MSwgMjAxMy8wMy8xMy0xMjowOToxNSAgICAgICAgIj4gPHJkZjpSREYgeG1sbn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MyNb2oLMeYVsADcyZwPMObuBWBTEsQFpI9E54sjO+QvEc0F+YoHKJgHxJ2TnvEM2gBmZswrmnA1AzAXiaJPhHC1k58BNQ3bBTGTOR2QD/iJzFsH8Mw/kHxBHggzn2KA7BxzWyC5Yisz5imwACmc2LLY7QbEN4nCS4ZwAIGZFds5lUEpEdsF6nKn3PTJnAsiAV0BcBsSM5GamFCDmQXYOOJ8iu2Anzrz9HKU8ABlwDYgTKcnbo0XNaFEzWtQgipqOYVLUAAQYAKPWa4c8cIHnAAAAAElFTkSuQmCC) no-repeat; +} +.coupon-container .item-disabled .v-right { + background: #dfdfdf !important; + color: #c0c0c0 !important; + cursor: no-drop !important; +} +.coupon-container .item-disabled { + border: 1px solid #dfdfdf !important; } \ No newline at end of file diff --git a/public/appmini/old/baidu/app.js b/public/appmini/old/baidu/app.js index c60b5c06b..0cae405a0 100755 --- a/public/appmini/old/baidu/app.js +++ b/public/appmini/old/baidu/app.js @@ -55,6 +55,8 @@ App({ "user_orderaftersale": "退款/售后", "user_orderaftersale_detail": "订单售后", "user_order_comments": "订单评论", + "coupon": "领劵中心", + "user_coupon": "优惠劵", }, // 请求地址 diff --git a/public/appmini/old/baidu/app.json b/public/appmini/old/baidu/app.json index 1c43ee16a..5caf4d933 100755 --- a/public/appmini/old/baidu/app.json +++ b/public/appmini/old/baidu/app.json @@ -25,7 +25,9 @@ "pages/user-integral/user-integral", "pages/user-goods-browse/user-goods-browse", "pages/user-orderaftersale/user-orderaftersale", - "pages/user-orderaftersale-detail/user-orderaftersale-detail" + "pages/user-orderaftersale-detail/user-orderaftersale-detail", + "pages/coupon/coupon", + "pages/user-coupon/user-coupon" ], "window": { "navigationBarTitleText": "{{application_title}}", diff --git a/public/appmini/old/baidu/pages/coupon/coupon.css b/public/appmini/old/baidu/pages/coupon/coupon.css new file mode 100644 index 000000000..e69de29bb diff --git a/public/appmini/old/baidu/pages/coupon/coupon.js b/public/appmini/old/baidu/pages/coupon/coupon.js new file mode 100644 index 000000000..d3137fdee --- /dev/null +++ b/public/appmini/old/baidu/pages/coupon/coupon.js @@ -0,0 +1,129 @@ +const app = getApp(); +Page({ + data: { + data_bottom_line_status: false, + data_list_loding_status: 1, + data_list_loding_msg: '', + data_list: [], + data_base: null + }, + + onLoad(params) { + this.init(); + }, + + onShow() { + swan.setNavigationBarTitle({ title: app.data.common_pages_title.coupon }); + }, + + init() { + // 获取数据 + this.get_data_list(); + }, + + // 获取数据 + get_data_list() { + var self = this; + swan.showLoading({ title: "加载中..." }); + if (self.data.data_list.length <= 0) + { + self.setData({ + data_list_loding_status: 1 + }); + } + + swan.request({ + url: app.get_request_url("index", "coupon"), + method: "POST", + data: {}, + dataType: "json", + success: res => { + swan.hideLoading(); + swan.stopPullDownRefresh(); + if (res.data.code == 0) { + var data = res.data.data; + var status = (data.data || []).length > 0; + this.setData({ + data_base: data.base || null, + data_list: data.data || [], + data_list_loding_msg: '', + data_list_loding_status: status ? 3 : 0, + data_bottom_line_status: status + }); + + // 导航名称 + if ((data.base || null) != null && (data.base.application_name || null) != null) { + swan.setNavigationBarTitle({ title: data.base.application_name }); + } + } else { + self.setData({ + data_bottom_line_status: false, + data_list_loding_status: 2, + data_list_loding_msg: res.data.msg + }); + app.showToast(res.data.msg); + } + }, + fail: () => { + swan.hideLoading(); + swan.stopPullDownRefresh(); + self.setData({ + data_bottom_line_status: false, + data_list_loding_status: 2, + data_list_loding_msg: '服务器请求出错' + }); + app.showToast("服务器请求出错"); + } + }); + }, + + // 优惠劵领取事件 + coupon_receive_event(e) { + var user = app.get_user_cache_info(this, "coupon_receive_event"); + // 用户未绑定用户则转到登录页面 + if (app.user_is_need_login(user)) { + swan.redirectTo({ + url: "/pages/login/login?event_callback=coupon_receive_event" + }); + return false; + } else { + var self = this; + var index = e.currentTarget.dataset.index; + var value = e.currentTarget.dataset.value; + var temp_list = this.data.data_list; + if (temp_list[index]['is_operable'] != 0) { + swan.showLoading({ title: "处理中..." }); + swan.request({ + url: app.get_request_url("receive", "coupon"), + method: "POST", + data: { "coupon_id": value }, + dataType: "json", + header: { 'content-type': 'application/x-www-form-urlencoded' }, + success: res => { + swan.hideLoading(); + if (res.data.code == 0) { + app.showToast(res.data.msg, "success"); + if (self.data.data_base != null && self.data.data_base.is_repeat_receive != 1) { + temp_list[index]['is_operable'] = 0; + temp_list[index]['is_operable_name'] = '已领取'; + self.setData({ data_list: temp_list }); + } + } else { + app.showToast(res.data.msg); + } + }, + fail: () => { + swan.hideLoading(); + app.showToast("服务器请求出错"); + } + }); + } + } + }, + + // 下拉刷新 + onPullDownRefresh() { + this.get_data_list(); + } + +}); \ No newline at end of file diff --git a/public/appmini/old/baidu/pages/coupon/coupon.json b/public/appmini/old/baidu/pages/coupon/coupon.json new file mode 100644 index 000000000..331ad4f3d --- /dev/null +++ b/public/appmini/old/baidu/pages/coupon/coupon.json @@ -0,0 +1,3 @@ +{ + "enablePullDownRefresh": true +} \ No newline at end of file diff --git a/public/appmini/old/baidu/pages/coupon/coupon.swan b/public/appmini/old/baidu/pages/coupon/coupon.swan new file mode 100644 index 000000000..578f9a557 --- /dev/null +++ b/public/appmini/old/baidu/pages/coupon/coupon.swan @@ -0,0 +1,30 @@ + + + + + + + + + + {{item.discount_value}} + {{item.type_unit}} + {{item.desc}} + + {{item.use_limit_type_name}} + + + + {{item.is_operable_name}} + + + + + + + + + + + + \ No newline at end of file diff --git a/public/appmini/old/baidu/pages/goods-detail/goods-detail.css b/public/appmini/old/baidu/pages/goods-detail/goods-detail.css index cb8b4a63a..bfbaf1910 100755 --- a/public/appmini/old/baidu/pages/goods-detail/goods-detail.css +++ b/public/appmini/old/baidu/pages/goods-detail/goods-detail.css @@ -295,4 +295,34 @@ } .limitedtimediscount .countdown .ds { padding: 0 4rpx; +} + +/* + * 优惠劵 - 插件 + */ +.coupon-container { + white-space: nowrap; + box-sizing: border-box; + padding: 20rpx 10rpx; +} +.coupon-container scroll-view { + height: 174rpx; +} +.coupon-container .item { + display: inline-block; + width: 60vw; +} +.coupon-container .v-left { + padding: 20rpx 0 20rpx 20rpx; +} +.coupon-container .item:not(:last-child) { + margin-right: 20rpx; +} +.coupon-container .item, +.coupon-container .v-right, +.coupon-container .v-right .circle { + height: 170rpx; +} +.coupon-container .v-left .base .price { + font-size: 46rpx; } \ No newline at end of file diff --git a/public/appmini/old/baidu/pages/goods-detail/goods-detail.js b/public/appmini/old/baidu/pages/goods-detail/goods-detail.js index 469b85856..888541e67 100755 --- a/public/appmini/old/baidu/pages/goods-detail/goods-detail.js +++ b/public/appmini/old/baidu/pages/goods-detail/goods-detail.js @@ -41,6 +41,9 @@ Page({ plugins_limitedtimediscount_time_millisecond: 0, plugins_limitedtimediscount_timer: null, plugins_limitedtimediscount_timers: null, + + // 优惠劵 + plugins_coupon_data: null, }, onLoad(params) { @@ -112,7 +115,8 @@ Page({ common_app_is_use_mobile_detail: data.common_app_is_use_mobile_detail || 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, + plugins_coupon_data: data.plugins_coupon_data || null, }); // 限时秒杀倒计时 @@ -662,6 +666,50 @@ Page({ clearInterval(this.data.plugins_limitedtimediscount_timers); }, + // 优惠劵领取事件 + coupon_receive_event(e) { + var user = app.get_user_cache_info(this, "coupon_receive_event"); + // 用户未绑定用户则转到登录页面 + if (app.user_is_need_login(user)) { + swan.redirectTo({ + url: "/pages/login/login?event_callback=coupon_receive_event" + }); + return false; + } else { + var self = this; + var index = e.currentTarget.dataset.index; + var value = e.currentTarget.dataset.value; + var temp_list = this.data.plugins_coupon_data.data; + if (temp_list[index]['is_operable'] != 0) { + swan.showLoading({ title: "处理中..." }); + swan.request({ + url: app.get_request_url("receive", "coupon"), + method: "POST", + data: { "coupon_id": value }, + dataType: "json", + header: { 'content-type': 'application/x-www-form-urlencoded' }, + success: res => { + swan.hideLoading(); + if (res.data.code == 0) { + app.showToast(res.data.msg, "success"); + if (self.data.plugins_coupon_data.base != null && self.data.plugins_coupon_data.base.is_repeat_receive != 1) { + temp_list[index]['is_operable'] = 0; + temp_list[index]['is_operable_name'] = '已领取'; + self.setData({ 'plugins_coupon_data.data': temp_list }); + } + } else { + app.showToast(res.data.msg); + } + }, + fail: () => { + swan.hideLoading(); + app.showToast("服务器请求出错"); + } + }); + } + } + }, + // 自定义分享 onShareAppMessage() { var user = app.get_user_cache_info(this, 'onShareAppMessage') || null; diff --git a/public/appmini/old/baidu/pages/goods-detail/goods-detail.swan b/public/appmini/old/baidu/pages/goods-detail/goods-detail.swan index 1bf5bf2e0..ae92f3bc4 100755 --- a/public/appmini/old/baidu/pages/goods-detail/goods-detail.swan +++ b/public/appmini/old/baidu/pages/goods-detail/goods-detail.swan @@ -59,6 +59,29 @@ + + + + + + + + + {{item.discount_value}} + {{item.type_unit}} + + {{item.use_limit_type_name}} + {{item.desc}} + + + + {{item.is_operable_name}} + + + + + + + + + {{item.name}} + + + + + + + + + + + + + {{item.coupon.discount_value}} + {{item.coupon.type_unit}} + {{item.coupon.desc}} + + {{item.coupon.use_limit_type_name}} + {{item.time_start_text}} 至 {{item.time_end_text}} + + + + + 去使用 + + + + + + + + + + + + + + {{item.coupon.discount_value}} + {{item.coupon.type_unit}} + {{item.coupon.desc}} + + {{item.coupon.use_limit_type_name}} + 使用 {{item.use_time_text}} + + + + 已使用 + + + + + + + + + + + + + {{item.coupon.discount_value}} + {{item.coupon.type_unit}} + {{item.coupon.desc}} + + {{item.coupon.use_limit_type_name}} + 过期 {{item.time_end_text}} + + + + 已过期 + + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/appmini/old/weixin/app.wxss b/public/appmini/old/weixin/app.wxss index d0fb71f17..5a853961d 100755 --- a/public/appmini/old/weixin/app.wxss +++ b/public/appmini/old/weixin/app.wxss @@ -445,7 +445,6 @@ button[disabled].bg-primary { .coupon-container .v-left base-tips, .coupon-container .v-left .base-time { margin-top: 10rpx; } - .coupon-container .v-right { background: #d2364c; width: 140rpx; diff --git a/public/appmini/old/weixin/pages/coupon/coupon.js b/public/appmini/old/weixin/pages/coupon/coupon.js index 8c52f184f..a6b8e1318 100644 --- a/public/appmini/old/weixin/pages/coupon/coupon.js +++ b/public/appmini/old/weixin/pages/coupon/coupon.js @@ -25,9 +25,12 @@ Page({ get_data_list() { var self = this; wx.showLoading({ title: "加载中..." }); - this.setData({ - data_list_loding_status: 1 - }); + if (self.data.data_list.length <= 0) + { + self.setData({ + data_list_loding_status: 1 + }); + } wx.request({ url: app.get_request_url("index", "coupon"), @@ -76,12 +79,12 @@ Page({ }, // 优惠劵领取事件 - receive_event(e) { - var user = app.get_user_cache_info(this, "receive_event"); + coupon_receive_event(e) { + var user = app.get_user_cache_info(this, "coupon_receive_event"); // 用户未绑定用户则转到登录页面 if (app.user_is_need_login(user)) { wx.redirectTo({ - url: "/pages/login/login?event_callback=receive_event" + url: "/pages/login/login?event_callback=coupon_receive_event" }); return false; } else { diff --git a/public/appmini/old/weixin/pages/goods-detail/goods-detail.js b/public/appmini/old/weixin/pages/goods-detail/goods-detail.js index 76595254d..e0932bbaf 100755 --- a/public/appmini/old/weixin/pages/goods-detail/goods-detail.js +++ b/public/appmini/old/weixin/pages/goods-detail/goods-detail.js @@ -789,11 +789,11 @@ Page({ // 优惠劵领取事件 coupon_receive_event(e) { - var user = app.get_user_cache_info(this, "receive_event"); + var user = app.get_user_cache_info(this, "coupon_receive_event"); // 用户未绑定用户则转到登录页面 if (app.user_is_need_login(user)) { wx.redirectTo({ - url: "/pages/login/login?event_callback=receive_event" + url: "/pages/login/login?event_callback=coupon_receive_event" }); return false; } else { diff --git a/public/appmini/old/weixin/pages/goods-detail/goods-detail.wxss b/public/appmini/old/weixin/pages/goods-detail/goods-detail.wxss index 381a66842..7da1b3dda 100755 --- a/public/appmini/old/weixin/pages/goods-detail/goods-detail.wxss +++ b/public/appmini/old/weixin/pages/goods-detail/goods-detail.wxss @@ -292,11 +292,9 @@ padding: 0 4rpx; } - /* * 优惠劵 - 插件 */ - .coupon-container { white-space: nowrap; box-sizing: border-box; diff --git a/public/appmini/old/weixin/pages/user-coupon/user-coupon.wxml b/public/appmini/old/weixin/pages/user-coupon/user-coupon.wxml index 53ccd76bf..23e148f57 100644 --- a/public/appmini/old/weixin/pages/user-coupon/user-coupon.wxml +++ b/public/appmini/old/weixin/pages/user-coupon/user-coupon.wxml @@ -40,7 +40,7 @@ {{item.coupon.discount_value}} - {{item.coupon.type == 0 ? '元' : '折'}} + {{item.coupon.type_unit}} {{item.coupon.desc}} {{item.coupon.use_limit_type_name}} @@ -62,7 +62,7 @@ {{item.coupon.discount_value}} - {{item.coupon.type == 0 ? '元' : '折'}} + {{item.coupon.type_unit}} {{item.coupon.desc}} {{item.coupon.use_limit_type_name}} -- GitLab