Commit f5bb8dd52d1b8a8c56e5e207877f594acc4f3b05

Authored by 前端研发-钱巧玲
1 parent b3162824

礼包详情购买和兑换的bug修改以及图片显示问题

pages/giftpack/giftpacklist/giftpacklist.js
@@ -33,8 +33,6 @@ Page({ @@ -33,8 +33,6 @@ Page({
33 var th = this; 33 var th = this;
34 th.setData({ 34 th.setData({
35 isBuy: options.isBuy, 35 isBuy: options.isBuy,
36 - getStorageID: a.stoid,  
37 - getUserID: d.user_id,  
38 getGiftID: options.lbId, 36 getGiftID: options.lbId,
39 orderSn: options.orderSn 37 orderSn: options.orderSn
40 }) 38 })
@@ -43,9 +41,6 @@ Page({ @@ -43,9 +41,6 @@ Page({
43 } else { 41 } else {
44 th.GetBuyGiftList(); 42 th.GetBuyGiftList();
45 } 43 }
46 - th.setData({  
47 - giftRemark: th.data.giftRemark.replace(/<p><img/gi, "<p class='img'><img")  
48 - })  
49 th.close(); 44 th.close();
50 }, 45 },
51 onShow: function() { 46 onShow: function() {
@@ -55,6 +50,7 @@ Page({ @@ -55,6 +50,7 @@ Page({
55 var that = this.data; 50 var that = this.data;
56 var th = this; 51 var th = this;
57 // var id = e.currentTarget.dataset.id;//活动id 52 // var id = e.currentTarget.dataset.id;//活动id
  53 + var money = e.currentTarget.dataset.money;
58 var my_confirm = th.selectComponent("#my_confirm"); //组件的id 54 var my_confirm = th.selectComponent("#my_confirm"); //组件的id
59 my_confirm.open( 55 my_confirm.open(
60 "是否确定购买该礼包", 56 "是否确定购买该礼包",
@@ -69,9 +65,9 @@ Page({ @@ -69,9 +65,9 @@ Page({
69 "actId": '', //活动Id 65 "actId": '', //活动Id
70 "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 66 "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销
71 "buyType": '2', //1=积分兑换 2=余额购买 67 "buyType": '2', //1=积分兑换 2=余额购买
72 - "lbId": that.getGiftID, //礼包Id  
73 - "storeId": that.getStorageID, //商家Id  
74 - "userId": that.getUserID, //用户ID 68 + "giftBagId": that.getGiftID, //礼包Id
  69 + "storeId": a.stoid, //商家Id
  70 + "userId": d.user_id, //用户ID
75 "buyFrom": 2 71 "buyFrom": 2
76 }; 72 };
77 var data = JSON.stringify(json); 73 var data = JSON.stringify(json);
@@ -85,18 +81,20 @@ Page({ @@ -85,18 +81,20 @@ Page({
85 }, // 设置请求的 header 81 }, // 设置请求的 header
86 success: function(res) { 82 success: function(res) {
87 if (res.data.code == 0) { 83 if (res.data.code == 0) {
88 - res = res.data.data; 84 + var res = res.data.data;
  85 + var order_sn = res.orderSn;
  86 + var url = "/pages/giftpack/payment/payment?money=" + money + "&order_sn=" + order_sn;
89 wx.requestPayment({ 87 wx.requestPayment({
90 - timeStamp: String(res.timeStamp),  
91 - nonceStr: res.nonceStr,  
92 - package: res.packageValue,  
93 - signType: res.signType,  
94 - paySign: res.paySign, 88 + timeStamp: String(res.result.timeStamp),
  89 + nonceStr: res.result.nonceStr,
  90 + package: res.result.packageValue,
  91 + signType: res.result.signType,
  92 + paySign: res.result.paySign,
95 success: function(n) { 93 success: function(n) {
96 - 94 + getApp().goto(url);
97 }, 95 },
98 fail: function(n) { 96 fail: function(n) {
99 - 97 + getApp().my_confirm("取消支付", 0, th);
100 } 98 }
101 }); 99 });
102 } else { 100 } else {
@@ -130,9 +128,9 @@ Page({ @@ -130,9 +128,9 @@ Page({
130 "actId": '', //活动Id 128 "actId": '', //活动Id
131 "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 129 "actType": '', //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销
132 "buyType": '1', //1=积分兑换 2=余额购买 130 "buyType": '1', //1=积分兑换 2=余额购买
133 - "lbId": that.getGiftID, //礼包Id  
134 - "storeId": that.getStorageID, //商家Id  
135 - "userId": that.getUserID //用户ID 131 + "giftBagId": that.getGiftID, //礼包Id
  132 + "storeId": a.stoid, //商家ID
  133 + "userId": d.user_id, //用户ID
136 }; 134 };
137 var data = JSON.stringify(json); 135 var data = JSON.stringify(json);
138 var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert"; 136 var url = that.url + "/api/weshop/marketing/buy/receive/gift/record/insert";
@@ -161,8 +159,8 @@ Page({ @@ -161,8 +159,8 @@ Page({
161 var th = this; 159 var th = this;
162 getApp().request.get('/api/weshop/marketing/my/giftbag/detail/get', { 160 getApp().request.get('/api/weshop/marketing/my/giftbag/detail/get', {
163 data: { 161 data: {
164 - "storeId": th.data.getStorageID, //商家ID  
165 - "userId": th.data.getUserID, //用户ID 162 + "storeId": a.stoid, //商家ID
  163 + "userId": d.user_id, //用户ID
166 "orderSn": th.data.orderSn 164 "orderSn": th.data.orderSn
167 }, 165 },
168 success: function success(res) { 166 success: function success(res) {
@@ -177,7 +175,7 @@ Page({ @@ -177,7 +175,7 @@ Page({
177 }) 175 })
178 } else { 176 } else {
179 th.setData({ 177 th.setData({
180 - giftRemark: res.data.data.giftRemark 178 + giftRemark: res.data.data.giftRemark.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block"')
181 }) 179 })
182 } 180 }
183 181
@@ -228,8 +226,8 @@ Page({ @@ -228,8 +226,8 @@ Page({
228 var th = this.data; 226 var th = this.data;
229 getApp().request.get('/api/weshop/marketing/giftbag/detail/get', { 227 getApp().request.get('/api/weshop/marketing/giftbag/detail/get', {
230 data: { 228 data: {
231 - "storeId": th.getStorageID, //商家ID  
232 - "userId": th.getUserID, //用户ID 229 + "storeId": a.stoid, //商家ID
  230 + "userId": d.user_id, //用户ID
233 "giftBagId": th.getGiftID 231 "giftBagId": th.getGiftID
234 }, 232 },
235 success: function success(res) { 233 success: function success(res) {
@@ -239,13 +237,12 @@ Page({ @@ -239,13 +237,12 @@ Page({
239 giftTitle: res.data.data.giftTitle 237 giftTitle: res.data.data.giftTitle
240 }) 238 })
241 if (res.data.data.giftRemark == '') { 239 if (res.data.data.giftRemark == '') {
242 -  
243 _this2.setData({ 240 _this2.setData({
244 giftRemark: '暂无详情......' 241 giftRemark: '暂无详情......'
245 }) 242 })
246 } else { 243 } else {
247 _this2.setData({ 244 _this2.setData({
248 - giftRemark: res.data.data.giftRemark 245 + giftRemark: res.data.data.giftRemark.replace(/\<img/gi, '<img style="max-width:100%;height:auto;display:block"')
249 }) 246 })
250 } 247 }
251 248
pages/giftpack/giftpacklist/giftpacklist.wxml
@@ -95,14 +95,14 @@ @@ -95,14 +95,14 @@
95 <text class="data-v-3a5b7e36">活动说明</text> 95 <text class="data-v-3a5b7e36">活动说明</text>
96 </view> 96 </view>
97 <view class="foot_box_remark data-v-3a5b7e36"> 97 <view class="foot_box_remark data-v-3a5b7e36">
98 - <rich-text nodes="{{giftRemark}}"></rich-text> 98 + <rich-text nodes="{{giftRemark}}" style="word-break:break-all;word-wrap:break-word"></rich-text>
99 </view> 99 </view>
100 </view> 100 </view>
101 <view class="foot_empty data-v-3a5b7e36"></view> 101 <view class="foot_empty data-v-3a5b7e36"></view>
102 <block wx:if="{{isBuy==1}}"> 102 <block wx:if="{{isBuy==1}}">
103 <view class="foot_button data-v-3a5b7e36"> 103 <view class="foot_button data-v-3a5b7e36">
104 <block wx:if="{{giftPrice>0&&giftIntegral>0}}"> 104 <block wx:if="{{giftPrice>0&&giftIntegral>0}}">
105 - <view class="foot_button_left data-v-3a5b7e36" data-id="{{lbId}}" bindtap="GetBuyPrice"> 105 + <view class="foot_button_left data-v-3a5b7e36" data-money="{{giftPrice}}" data-id="{{lbId}}" bindtap="GetBuyPrice">
106 <text class="data-v-3a5b7e36">立即购买</text> 106 <text class="data-v-3a5b7e36">立即购买</text>
107 </view> 107 </view>
108 </block> 108 </block>
@@ -112,7 +112,7 @@ @@ -112,7 +112,7 @@
112 </view> 112 </view>
113 </block> 113 </block>
114 <block wx:if="{{giftPrice>0 && giftIntegral<=0}}"> 114 <block wx:if="{{giftPrice>0 && giftIntegral<=0}}">
115 - <view class="foot_button_buy data-v-3a5b7e36" bindtap="GetBuyPrice" data-id="{{lbId}}"> 115 + <view class="foot_button_buy data-v-3a5b7e36" data-money="{{giftPrice}}" bindtap="GetBuyPrice" data-id="{{lbId}}">
116 <text class="data-v-3a5b7e36">立即购买</text> 116 <text class="data-v-3a5b7e36">立即购买</text>
117 </view> 117 </view>
118 </block> 118 </block>