diff --git a/application/api/controller/Buy.php b/application/api/controller/Buy.php
index c24eaa17c137fe73b03ba1f28d6438b73850acea..ddc7e04ccf075572d0cf1cb03dedba4f2b90d6dd 100755
--- a/application/api/controller/Buy.php
+++ b/application/api/controller/Buy.php
@@ -60,6 +60,9 @@ class Buy extends Common
// 支付方式
$payment_list = PaymentService::BuyPaymentList(['is_enable'=>1, 'is_open_user'=>1]);
+ // 当前选中的优惠劵
+ $coupon_id = isset($params['coupon_id']) ? intval($params['coupon_id']) : 0;
+
// 数据返回组装
$result = [
'goods_list' => $ret['data']['goods'],
@@ -67,6 +70,9 @@ class Buy extends Common
'base' => $ret['data']['base'],
'extension_data' => $ret['data']['extension_data'],
'common_order_is_booking' => (int) MyC('common_order_is_booking', 0),
+
+ // 优惠劵
+ 'plugins_coupon_data' => CallPluginsServiceMethod('coupon', 'BaseService', 'BuyUserCouponData', ['order_goods'=>$ret['data']['goods'], 'coupon_id'=>$coupon_id]),
];
return DataReturn('操作成功', 0, $result);
}
diff --git a/application/api/controller/Goods.php b/application/api/controller/Goods.php
index 58ee9f6b3ea6d15a4f381860ef6df6cc4f135e38..817d1d1be6b92af13be138eec4b9b31c72a8f0fb 100755
--- a/application/api/controller/Goods.php
+++ b/application/api/controller/Goods.php
@@ -126,6 +126,8 @@ 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),
];
diff --git a/public/appmini/old/weixin/app.js b/public/appmini/old/weixin/app.js
index b88af12f932fe9b5c16bfce80fd11c66acec1cb7..d6811e07f44a0a781cd1afa3cb1c643e1aa635f1 100755
--- a/public/appmini/old/weixin/app.js
+++ b/public/appmini/old/weixin/app.js
@@ -67,7 +67,7 @@ App({
// 请求地址
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 a48234485b02dcfed88a9bda55131cebb3080f31..c9b79e035e6b0326b49a6151997bcc0ac333cfc7 100755
--- a/public/appmini/old/weixin/app.json
+++ b/public/appmini/old/weixin/app.json
@@ -1,5 +1,5 @@
{
- "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",
diff --git a/public/appmini/old/weixin/pages/buy/buy.js b/public/appmini/old/weixin/pages/buy/buy.js
index d85e6c67ffa866ca3ce329e1152c4378fd57cf27..369691825fa31d25df3e3a8ea83cc1660c746127 100755
--- a/public/appmini/old/weixin/pages/buy/buy.js
+++ b/public/appmini/old/weixin/pages/buy/buy.js
@@ -15,6 +15,12 @@ Page({
extension_data: [],
payment_id: 0,
common_order_is_booking: 0,
+
+ // 优惠劵
+ plugins_coupon_data: null,
+ plugins_use_coupon_id: 0,
+ plugins_choice_coupon_value: '选择优惠劵',
+ popup_plugins_coupon_status: false,
},
onLoad(params) {
if((params.data || null) == null || app.get_length(JSON.parse(params.data)) == 0)
@@ -70,6 +76,7 @@ Page({
var data = this.data.params;
data['address_id'] = this.data.address_id;
data['payment_id'] = this.data.payment_id;
+ data['coupon_id'] = this.data.plugins_use_coupon_id;
wx.request({
url: app.get_request_url("index", "buy"),
method: "POST",
@@ -89,8 +96,21 @@ Page({
extension_data: data.extension_data || [],
data_list_loding_status: 3,
common_order_is_booking: data.common_order_is_booking || 0,
+ plugins_coupon_data: data.plugins_coupon_data || null,
});
+ // 优惠劵选择处理
+ if ((data.plugins_coupon_data || null) != null)
+ {
+ if ((data.plugins_coupon_data.coupon_choice || null) != null)
+ {
+ this.setData({ plugins_choice_coupon_value: data.plugins_coupon_data.coupon_choice.coupon.desc });
+ } else {
+ var coupon_count = ((data.plugins_coupon_data.coupon_list || null) != null) ? data.plugins_coupon_data.coupon_list.length : 0;
+ this.setData({ plugins_choice_coupon_value: (coupon_count > 0) ? '可选优惠劵' + coupon_count + '张' : '暂无可用优惠劵' });
+ }
+ }
+
// 地址
if (this.data.address == null || this.data.address_id == 0) {
if((data.base.address || null) != null) {
@@ -141,6 +161,7 @@ Page({
data['address_id'] = this.data.address_id;
data['payment_id'] = this.data.payment_id;
data['user_note'] = this.data.user_note_value;
+ data['coupon_id'] = this.data.plugins_use_coupon_id;
// 数据验证
var validation = [
@@ -203,6 +224,36 @@ Page({
}
}
this.setData({payment_list: data || []});
- }
+ },
+
+ // 优惠劵弹层开启
+ plugins_coupon_open_event(e) {
+ this.setData({ popup_plugins_coupon_status: true});
+ },
+
+ // 优惠劵弹层关闭
+ plugins_coupon_close_event(e) {
+ this.setData({ popup_plugins_coupon_status: false });
+ },
+
+ // 优惠劵选择
+ plugins_coupon_use_event(e) {
+ var index = e.currentTarget.dataset.index;
+ var value = e.currentTarget.dataset.value;
+ this.setData({
+ plugins_use_coupon_id: value,
+ popup_plugins_coupon_status: false,
+ });
+ this.init();
+ },
+
+ // 不使用优惠劵
+ plugins_coupon_not_use_event(e) {
+ this.setData({
+ plugins_use_coupon_id: 0,
+ popup_plugins_coupon_status: false,
+ });
+ this.init();
+ },
});
diff --git a/public/appmini/old/weixin/pages/buy/buy.json b/public/appmini/old/weixin/pages/buy/buy.json
index 9a5b68f9584c5ab893c297b62132798283d09ec0..7d179bfd5fd5f445a1ef926625a70f5712237393 100755
--- a/public/appmini/old/weixin/pages/buy/buy.json
+++ b/public/appmini/old/weixin/pages/buy/buy.json
@@ -1,3 +1,6 @@
{
- "enablePullDownRefresh": false
+ "enablePullDownRefresh": true,
+ "usingComponents": {
+ "component-popup": "/components/popup/popup"
+ }
}
\ No newline at end of file
diff --git a/public/appmini/old/weixin/pages/buy/buy.wxml b/public/appmini/old/weixin/pages/buy/buy.wxml
index c168e701d6129042a871f8a1d2cf1208921af783..4342024edd73cbb2c6cde63fcac3a9fd21153a49 100755
--- a/public/appmini/old/weixin/pages/buy/buy.wxml
+++ b/public/appmini/old/weixin/pages/buy/buy.wxml
@@ -44,6 +44,12 @@
+
+
+ 优惠劵
+ {{plugins_choice_coupon_value}}
+
+
@@ -79,4 +85,38 @@
-
\ No newline at end of file
+
+
+
+
+
+
\ No newline at end of file
diff --git a/public/appmini/old/weixin/pages/buy/buy.wxss b/public/appmini/old/weixin/pages/buy/buy.wxss
index 6a44f7631d27b0c0ac4fed1306ee400cbfd290eb..0f4f3bbb2e9c14f4324c3388328412d9007f2493 100755
--- a/public/appmini/old/weixin/pages/buy/buy.wxss
+++ b/public/appmini/old/weixin/pages/buy/buy.wxss
@@ -130,4 +130,32 @@
padding: 10rpx;
min-height: 10vh;
width: 100%;
+}
+
+/**
+ * 插件
+ */
+.plugins-coupon {
+ padding: 25rpx 40rpx 25rpx 10rpx;
+}
+.plugins-coupon-popup {
+ padding-top: 20rpx;
+}
+.plugins-coupon-popup .close {
+ margin-right: 20rpx;
+}
+.coupon-container {
+ max-height: 80vh;
+ overflow-y: scroll;
+ overflow-x: hidden;
+ padding-bottom: 20rpx;
+}
+.coupon-container .item,
+.coupon-container .v-right,
+.coupon-container .v-right .circle {
+ height: 230rpx;
+}
+.coupon-container .not-use-tips {
+ color: #f7b240;
+ font-size: 32rpx;
}
\ No newline at end of file
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 240e0b280c3bc4696e20ec7c8eafde19406a3f47..e0932bbafa50a75ec4a260819f021b60a05e972c 100755
--- a/public/appmini/old/weixin/pages/goods-detail/goods-detail.js
+++ b/public/appmini/old/weixin/pages/goods-detail/goods-detail.js
@@ -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();
},