Commit 0c5f40ebcd95a8ddcbaef7e78120a5e8aa23499b

Authored by yvan.ni
1 parent 366aa639

预售服务卡项的bug优化

packageA/pages/details_serviceCard/details_serviceCard.js
@@ -871,19 +871,17 @@ Page({ @@ -871,19 +871,17 @@ Page({
871 871
872 //-- 判断一下限购的计算 -- 872 //-- 判断一下限购的计算 --
873 if(act_details.vip_butyqty>0){ 873 if(act_details.vip_butyqty>0){
874 - await getApp().request.promiseGet("/api/weshop/rechargeServicelist/getUserBuyGoodsNum", { 874 + await getApp().request.promiseGet("/api/weshop/recharge/rechargePresell/countBuyGoodsSum", {
875 data: { 875 data: {
876 store_id: store_id, 876 store_id: store_id,
877 user_id: user_id, 877 user_id: user_id,
878 - card_id: it.card_id,  
879 - prom_type: it.prom_type,  
880 - prom_id: it.prom_id,  
881 - ispay:1 878 + goods_id: it.card_id,
  879 + prom_id: it.prom_id
882 } 880 }
883 }).then(res => { 881 }).then(res => {
884 if (res.data.code == 0) { 882 if (res.data.code == 0) {
885 console.log('已经购买的数量:', res.data.data); 883 console.log('已经购买的数量:', res.data.data);
886 - promcardbuynum = res.data.data.promcardbuynum; 884 + promcardbuynum = res.data.data.sumgoodsnum;
887 } 885 }
888 }) 886 })
889 let limited = act_details.buy_limit; // 限购数量a 887 let limited = act_details.buy_limit; // 限购数量a
@@ -911,7 +909,7 @@ Page({ @@ -911,7 +909,7 @@ Page({
911 }, function () { 909 }, function () {
912 app.showWarning('支付成功'); 910 app.showWarning('支付成功');
913 911
914 - if(pt_act.kttype==1){ 912 + if(pt_act && pt_act.kttype==1){
915 //--如果商家团的时候--- 913 //--如果商家团的时候---
916 getApp().request.promisePost("/api/weshop/order/pay/vipAutoTuan", { 914 getApp().request.promisePost("/api/weshop/order/pay/vipAutoTuan", {
917 data: {orderSn:order_sn,storeId:os.stoid } 915 data: {orderSn:order_sn,storeId:os.stoid }
packageC/pages/presell/cardInfo/goodsInfo.js
@@ -876,7 +876,7 @@ Page({ @@ -876,7 +876,7 @@ Page({
876 876
877 var e = this, th = e, o = this.data.sele_g, a = o.goods_id; 877 var e = this, th = e, o = this.data.sele_g, a = o.goods_id;
878 //----------添加到购物车时,要判断限购数量,-------- 878 //----------添加到购物车时,要判断限购数量,--------
879 - e.get_buy_num2(o, function (ee) { 879 + e.get_buy_num2(function (ee) {
880 //---判断商品是否超出限购--- 880 //---判断商品是否超出限购---
881 if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) { 881 if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) {
882 if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id) > th.data.sele_g.viplimited) { 882 if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id) > th.data.sele_g.viplimited) {
@@ -1058,7 +1058,7 @@ Page({ @@ -1058,7 +1058,7 @@ Page({
1058 // 如果限购数量a>redis可购买数量d,当增加数量t>d, 提示超出库存 1058 // 如果限购数量a>redis可购买数量d,当增加数量t>d, 提示超出库存
1059 // 如果限购数量a<=redis可购买数量d, 当增加数量t>a,提示超出限购 1059 // 如果限购数量a<=redis可购买数量d, 当增加数量t>a,提示超出限购
1060 let actInfo = th.data.sele_g; 1060 let actInfo = th.data.sele_g;
1061 - await th.get_buy_num2().then(function (data) { 1061 + th.get_buy_num2(function (data) {
1062 let limited = actInfo.buy_limit==0?100000:actInfo.buy_limit; // 限购数量a 1062 let limited = actInfo.buy_limit==0?100000:actInfo.buy_limit; // 限购数量a
1063 let promcardbuynum = data.data.data.promcardbuynum; 1063 let promcardbuynum = data.data.data.promcardbuynum;
1064 let buyedNum = promcardbuynum; // 自己已经购买的数量b 1064 let buyedNum = promcardbuynum; // 自己已经购买的数量b
@@ -3422,7 +3422,7 @@ Page({ @@ -3422,7 +3422,7 @@ Page({
3422 }, 3422 },
3423 3423
3424 3424
3425 - get_buy_num2: async function () { 3425 + get_buy_num2: async function (func) {
3426 // var map = this.data.g_buy_num, 3426 // var map = this.data.g_buy_num,
3427 var th = this,user_id = getApp().globalData.user_id; 3427 var th = this,user_id = getApp().globalData.user_id;
3428 // if (user_id == null) { 3428 // if (user_id == null) {
@@ -3436,46 +3436,25 @@ Page({ @@ -3436,46 +3436,25 @@ Page({
3436 // } 3436 // }
3437 3437
3438 3438
3439 - getApp().request.get("/api/weshop/order/orderPresell/countBuyGoodsSum", {  
3440 - data: { store_id: os.stoid, user_id: user_id, goods_id: gd.goods_id, prom_id: t_prom_id }, 3439 + getApp().request.get("/api/weshop/recharge/rechargePresell/countBuyGoodsSum", {
  3440 + data: { store_id: os.stoid, user_id: user_id, goods_id: th.data.options.goods_id, prom_id: th.data.options.prom_id },
3441 success: function (e) { 3441 success: function (e) {
3442 if (e.data.code == 0) { 3442 if (e.data.code == 0) {
3443 - th.setData({ prom_buy_num: e.data.data.sumgoodsnum })  
3444 - "function" == typeof func && func(); 3443 +
  3444 + th.setData({ prom_buy_num: e.data.data.sumgoodsnum,promcardbuynum: e.data.data.sumgoodsnum })
  3445 +
  3446 + let dd={promcardbuynum: e.data.data.sumgoodsnum }
  3447 +
  3448 + "function" == typeof func && func(dd);
3445 } else { 3449 } else {
3446 - th.setData({ prom_buy_num: 0, })  
3447 - "function" == typeof func && func(); 3450 + let dd={promcardbuynum: 0 }
  3451 + th.setData({ prom_buy_num: 0,promcardbuynum:0 })
  3452 + "function" == typeof func && func(dd);
3448 } 3453 }
3449 3454
3450 } 3455 }
3451 }); 3456 });
3452 -  
3453 -  
3454 - //----获取商品购买数----  
3455 -  
3456 - //----获取活动购买数----  
3457 - return await getApp().request.promiseGet("/api/weshop/rechargeServicelist/getUserBuyGoodsNum", {  
3458 - data: {  
3459 - store_id: os.stoid,  
3460 - user_id: user_id,  
3461 - card_id: th.data.options.goods_id,  
3462 - prom_type: th.data.options.prom_type,  
3463 - prom_id: th.data.options.prom_id  
3464 - },  
3465 - //-----获取-----  
3466 - success: function (tt) {  
3467 - if (tt.data.code == 0) {  
3468 - // map.set(gd.goods_id, g_buy_num);  
3469 - th.setData({  
3470 - // g_buy_num: map,  
3471 - promcardbuynum: tt.data.data.promcardbuynum,  
3472 - cardbuynum: tt.data.data.cardbuynum,  
3473 - });  
3474 - }  
3475 - }  
3476 - });  
3477 3457
3478 -  
3479 }, 3458 },
3480 3459
3481 3460
packageC/pages/presell/cart/cart2.js
@@ -221,12 +221,12 @@ Page({ @@ -221,12 +221,12 @@ Page({
221 if(fy) return false; 221 if(fy) return false;
222 util_pay.set_fir(); 222 util_pay.set_fir();
223 223
224 - let error_url="/pages/user/order_list/order_list"; 224 + let err_url="/pages/user/order_list/order_list";
225 let ok_url="/pages/payment/pay_success/pay_success?type=2&order_sn=" + this.data.ok_order_sn; 225 let ok_url="/pages/payment/pay_success/pay_success?type=2&order_sn=" + this.data.ok_order_sn;
226 226
227 if(th.data.is_fwk){ 227 if(th.data.is_fwk){
228 err_url='/pages/user/order_list/order_list?index=2&tabindex=1'; 228 err_url='/pages/user/order_list/order_list?index=2&tabindex=1';
229 - ok_url="/pages/payment/pay_success/pay_success?type=3&order_sn=" + this.data.ok_order_sn; 229 + ok_url="/pages/payment/pay_success/pay_success?card=1&order_id=" + this.data.order_id;
230 } 230 }
231 231
232 //-- 通联的第三方支付的返回优化 -- 232 //-- 通联的第三方支付的返回优化 --
@@ -247,6 +247,12 @@ Page({ @@ -247,6 +247,12 @@ Page({
247 247
248 getApp().request.promiseGet(ord_url, 248 getApp().request.promiseGet(ord_url,
249 {data:ord_req}).then(res=>{ 249 {data:ord_req}).then(res=>{
  250 +
  251 + console.log(ord_url);
  252 + console.log(ord_req);
  253 + console.log(res);
  254 +
  255 +
250 if(ut.ajax_ok(res)){ 256 if(ut.ajax_ok(res)){
251 var item=res.data.data.pageData[0]; 257 var item=res.data.data.pageData[0];
252 if(item.pay_status==1){ 258 if(item.pay_status==1){
@@ -260,7 +266,7 @@ Page({ @@ -260,7 +266,7 @@ Page({
260 //支付支付,返回首页 266 //支付支付,返回首页
261 ut.m_toast('支付失败'); 267 ut.m_toast('支付失败');
262 setTimeout(()=>{ 268 setTimeout(()=>{
263 - getApp().goto("/pages/index/index/index"); 269 + getApp().re_to(err_url);
264 },1000) 270 },1000)
265 } 271 }
266 } 272 }
@@ -1339,6 +1345,7 @@ Page({ @@ -1339,6 +1345,7 @@ Page({
1339 var data = res.data; 1345 var data = res.data;
1340 if (data.code == 0) { 1346 if (data.code == 0) {
1341 th.data.order_id = data.data.order_id; 1347 th.data.order_id = data.data.order_id;
  1348 + th.data.ok_order_sn = data.data.order_sn;
1342 // console.log('myyyyyyyyyyyyyyyyyy', data.data); 1349 // console.log('myyyyyyyyyyyyyyyyyy', data.data);
1343 if (th.data.is_cart) { 1350 if (th.data.is_cart) {
1344 var list = th.data.cartlist_y; 1351 var list = th.data.cartlist_y;
packageC/pages/presell/cart/cart2_pre.js
@@ -96,6 +96,12 @@ Page({ @@ -96,6 +96,12 @@ Page({
96 }); 96 });
97 }, 1); 97 }, 1);
98 98
  99 + var gg = getApp().get_b_now();
  100 + debugger;
  101 + if(gg.fwk){
  102 + this.setData({is_fwk: 1});
  103 + }
  104 +
99 }, 105 },
100 onUnload: function () { this.setData({ isclose: 1 }) }, 106 onUnload: function () { this.setData({ isclose: 1 }) },
101 107
@@ -365,6 +371,12 @@ Page({ @@ -365,6 +371,12 @@ Page({
365 ord_req={store_id:os.stoid,parent_sn:th.data.ok_order_sn}; 371 ord_req={store_id:os.stoid,parent_sn:th.data.ok_order_sn};
366 } 372 }
367 373
  374 +
  375 + console.log('onshow-py-1111');
  376 + console.log(ord_url);
  377 + console.log(ord_req);
  378 +
  379 +
368 getApp().request.promiseGet(ord_url, 380 getApp().request.promiseGet(ord_url,
369 {data:ord_req}).then(res=>{ 381 {data:ord_req}).then(res=>{
370 if(ut.ajax_ok(res)){ 382 if(ut.ajax_ok(res)){
@@ -925,6 +937,7 @@ Page({ @@ -925,6 +937,7 @@ Page({
925 var data = res.data; 937 var data = res.data;
926 if (data.code == 0) { 938 if (data.code == 0) {
927 th.data.order_id = data.data.order_id; 939 th.data.order_id = data.data.order_id;
  940 + th.data.ok_order_sn = data.data.order_sn;
928 941
929 var order_amount = pdata.account; 942 var order_amount = pdata.account;
930 //要进行判断,如果是用微信支付,就要跳转到支付界面 943 //要进行判断,如果是用微信支付,就要跳转到支付界面
@@ -945,11 +958,10 @@ Page({ @@ -945,11 +958,10 @@ Page({
945 duration: 2000 958 duration: 2000
946 }); 959 });
947 960
948 - var url = "/packageC/pages/presell/cart/cart?order_sn=" + data.data.order_sn;  
949 - 961 + var rurl = "/packageC/pages/presell/cart/cart?is_fwk=1&order_sn=" + data.data.order_sn;
950 setTimeout(function () { 962 setTimeout(function () {
951 wx.reLaunch({ 963 wx.reLaunch({
952 - url: "/pages/payment/pay_success/pay_success?card=1&order_id=" + th.data.order_id, 964 + url: rurl,
953 }) 965 })
954 }, 1000) 966 }, 1000)
955 967
packageC/pages/presell/cart/cart2_pre.wxml
@@ -92,7 +92,7 @@ @@ -92,7 +92,7 @@
92 </view> 92 </view>
93 93
94 <!--阶梯团是不显示的--> 94 <!--阶梯团是不显示的-->
95 - <block wx:if="{{bn_exp_type==0 && !is_default_logistics}}"> 95 + <block wx:if="{{bn_exp_type==0 && !is_default_logistics && !is_fwk}}">
96 <view class="use-item flex-space-between" wx:if="{{kt_type!=3 || is_normal==1}}"> 96 <view class="use-item flex-space-between" wx:if="{{kt_type!=3 || is_normal==1}}">
97 <view>选择物流</view> 97 <view>选择物流</view>
98 <view class="flex-vertical" bindtap="show_wu_arr" data-txt='index' style="margin-right: 8rpx;"> 98 <view class="flex-vertical" bindtap="show_wu_arr" data-txt='index' style="margin-right: 8rpx;">
@@ -143,14 +143,14 @@ @@ -143,14 +143,14 @@
143 143
144 <view class="information bdr14"> 144 <view class="information bdr14">
145 <!-----使用预存------> 145 <!-----使用预存------>
146 - <view class="set-mes" wx:if="{{bn_goods.yck_off}}"> 146 + <view class="set-mes" wx:if="{{bn_goods.yck_off && !is_fwk}}">
147 <view class="use-item" bindtap='prestore2' style="padding-left:0;padding-right:0;"> 147 <view class="use-item" bindtap='prestore2' style="padding-left:0;padding-right:0;">
148 <icon color="{{bn_goods.yck_off==2 ? 'red' : '#808080'}}" size="16" type="success"></icon> 148 <icon color="{{bn_goods.yck_off==2 ? 'red' : '#808080'}}" size="16" type="success"></icon>
149 <view class="yu_er">使用预存 </view> 149 <view class="yu_er">使用预存 </view>
150 </view> 150 </view>
151 </view> 151 </view>
152 <!-----使用余额------> 152 <!-----使用余额------>
153 - <view class="set-mes" wx:if="{{userinfo.user_money>0 && yuer>0}}"> 153 + <view class="set-mes" wx:if="{{userinfo.user_money>0 && yuer>0 && !is_fwk}}">
154 <view class="use-item" bindtap='set_bn_useyuer' style="padding-left:0;padding-right:0;"> 154 <view class="use-item" bindtap='set_bn_useyuer' style="padding-left:0;padding-right:0;">
155 <icon color="{{bn_use_money?'red':'gray'}}" size="16" type="success"></icon> 155 <icon color="{{bn_use_money?'red':'gray'}}" size="16" type="success"></icon>
156 <view class="yu_er">使用余额 :¥{{yuer}} </view> 156 <view class="yu_er">使用余额 :¥{{yuer}} </view>
pages/user/order_list/order_list.js
@@ -3158,19 +3158,17 @@ Page({ @@ -3158,19 +3158,17 @@ Page({
3158 3158
3159 //-- 判断一下限购的计算 -- 3159 //-- 判断一下限购的计算 --
3160 if(act_details.vip_butyqty>0){ 3160 if(act_details.vip_butyqty>0){
3161 - await getApp().request.promiseGet("/api/weshop/rechargeServicelist/getUserBuyGoodsNum", { 3161 + await getApp().request.promiseGet("/api/weshop/recharge/rechargePresell/countBuyGoodsSum", {
3162 data: { 3162 data: {
3163 store_id: store_id, 3163 store_id: store_id,
3164 user_id: user_id, 3164 user_id: user_id,
3165 - card_id: it.card_id,  
3166 - prom_type: it.prom_type, 3165 + goods_id: it.card_id,
3167 prom_id: it.prom_id, 3166 prom_id: it.prom_id,
3168 - ispay:1  
3169 } 3167 }
3170 }).then(res => { 3168 }).then(res => {
3171 if (res.data.code == 0) { 3169 if (res.data.code == 0) {
3172 console.log('已经购买的数量:', res.data.data); 3170 console.log('已经购买的数量:', res.data.data);
3173 - promcardbuynum = res.data.data.promcardbuynum; 3171 + promcardbuynum = res.data.data.sumgoodsnum;
3174 } 3172 }
3175 }) 3173 })
3176 let limited = act_details.buy_limit; // 限购数量a 3174 let limited = act_details.buy_limit; // 限购数量a
@@ -3203,7 +3201,7 @@ Page({ @@ -3203,7 +3201,7 @@ Page({
3203 duration: 2000 3201 duration: 2000
3204 }); 3202 });
3205 3203
3206 - if(pt_act.kttype==1){ 3204 + if(pt_act && pt_act.kttype==1){
3207 3205
3208 //--如果商家团的时候,这个要改,要用服务卡的接口--- 3206 //--如果商家团的时候,这个要改,要用服务卡的接口---
3209 getApp().request.promisePost("/api/weshop/rechargeServicelist/vipAutoTuan", { 3207 getApp().request.promisePost("/api/weshop/rechargeServicelist/vipAutoTuan", {