Commit 756e556592c7242e67d5c4eb9e387f0310b45967
1 parent
4aff0b4e
立即支付要控制不能点两次
Showing
4 changed files
with
104 additions
and
37 deletions
pages/user/order_detail/order_detail.js
... | ... | @@ -334,8 +334,11 @@ Page({ |
334 | 334 | |
335 | 335 | //--------立即支付---------- |
336 | 336 | async jumpToCart4(e) { |
337 | - | |
338 | - var th=this; | |
337 | + | |
338 | + if(this.data.paying) return false; | |
339 | + this.setData({paying:1}); | |
340 | + | |
341 | + var th=this; | |
339 | 342 | if(this.data.optionIsGoup) |
340 | 343 | wx.navigateTo({ |
341 | 344 | url: "/pages/team/team_confirm/team_confirm?orderSn=" + this.data.order.order_sn + "&orderPay=true" |
... | ... | @@ -353,6 +356,7 @@ Page({ |
353 | 356 | title: '提示', |
354 | 357 | content: '线下取价功能已经关闭或者过期!' |
355 | 358 | }); |
359 | + th.setData({paying:0}); | |
356 | 360 | return false; |
357 | 361 | } |
358 | 362 | |
... | ... | @@ -385,9 +389,10 @@ Page({ |
385 | 389 | var buyed_mum2=goodsbuynum+good.goods_num; |
386 | 390 | if (buyed_mum2 > limit && limit > 0) { |
387 | 391 | |
388 | - var content=gg.goods_name+'购买数量超出商品限购,请取消订单'; | |
389 | - th.toast(content); | |
390 | - return false; | |
392 | + var content=gg.goods_name+'购买数量超出商品限购,请取消订单'; | |
393 | + th.toast(content); | |
394 | + th.setData({paying:0}); | |
395 | + return false; | |
391 | 396 | } |
392 | 397 | //当是组合优惠的时候 |
393 | 398 | if(good.prom_type==7){ |
... | ... | @@ -421,7 +426,8 @@ Page({ |
421 | 426 | if (!isok){ |
422 | 427 | var content=gg.goods_name+'活动已经结束,请取消订单'; |
423 | 428 | th.toast(content); |
424 | - return false; | |
429 | + th.setData({paying:0}); | |
430 | + return false; | |
425 | 431 | } |
426 | 432 | |
427 | 433 | var url1 = "/api/weshop/prom/zhbuyGoods/page"; |
... | ... | @@ -450,6 +456,7 @@ Page({ |
450 | 456 | |
451 | 457 | var content= good['goods_name']+"超出活动限购\n"; |
452 | 458 | th.toast(content); |
459 | + th.setData({paying:0}); | |
453 | 460 | return false; |
454 | 461 | } |
455 | 462 | } |
... | ... | @@ -493,6 +500,7 @@ Page({ |
493 | 500 | |
494 | 501 | var content = good.goods_name + '未找到活动,请取消订单重新购买' |
495 | 502 | th.toast(content); |
503 | + th.setData({paying:0}); | |
496 | 504 | p_ok = 0; |
497 | 505 | } |
498 | 506 | }) |
... | ... | @@ -522,7 +530,9 @@ Page({ |
522 | 530 | }) |
523 | 531 | |
524 | 532 | } |
525 | - if (!p_ok) return false; | |
533 | + if (!p_ok){ | |
534 | + th.setData({paying:0});return false; | |
535 | + } | |
526 | 536 | } |
527 | 537 | |
528 | 538 | //商品的普通购买 ,不要进行判断 |
... | ... | @@ -530,7 +540,8 @@ Page({ |
530 | 540 | if(gg.prom_type!=good.prom_type && gg.prom_type>0) { |
531 | 541 | var content=gg.goods_name+'商品的活动发生了变化,请取消订单重新购买'; |
532 | 542 | th.toast(content); |
533 | - return false; | |
543 | + th.setData({paying:0}); | |
544 | + return false; | |
534 | 545 | } |
535 | 546 | }else{ |
536 | 547 | if((gg.prom_type==1 || gg.prom_type==3 || gg.prom_type==5 || gg.prom_type==6 || gg.prom_type==4) |
... | ... | @@ -581,9 +592,10 @@ Page({ |
581 | 592 | var t_now=ut.gettimestamp(); |
582 | 593 | if(prom.is_end==0 && prom.start_time<t_now && prom.end_time>t_now){ |
583 | 594 | |
584 | - var content=gg.goods_name+'商品的活动发生了变化,请取消订单重新购买'; | |
585 | - th.toast(content); | |
586 | - return false; | |
595 | + var content=gg.goods_name+'商品的活动发生了变化,请取消订单重新购买'; | |
596 | + th.toast(content); | |
597 | + th.setData({paying:0}); | |
598 | + return false; | |
587 | 599 | } |
588 | 600 | } |
589 | 601 | }else{ |
... | ... | @@ -602,7 +614,9 @@ Page({ |
602 | 614 | } |
603 | 615 | } |
604 | 616 | }) |
605 | - if(!t_ok) return false; | |
617 | + if(!t_ok) { | |
618 | + th.setData({paying:0});return false; | |
619 | + } | |
606 | 620 | } |
607 | 621 | |
608 | 622 | //-- 如果有参加线下取价 -- |
... | ... | @@ -626,7 +640,8 @@ Page({ |
626 | 640 | |
627 | 641 | var content=gg.goods_name + '商品的价格发生了变化,请取消订单重新购买22'; |
628 | 642 | th.toast(content); |
629 | - return false; | |
643 | + th.setData({paying:0}); | |
644 | + return false; | |
630 | 645 | } |
631 | 646 | } |
632 | 647 | |
... | ... | @@ -637,17 +652,18 @@ Page({ |
637 | 652 | ob=obj; |
638 | 653 | }) |
639 | 654 | if(ob.code==-1){ |
640 | - | |
641 | 655 | var content=gg.goods_name+'门店库存不足,请取消订单'; |
642 | 656 | th.toast(content); |
643 | - return false; | |
657 | + th.setData({paying:0}); | |
658 | + return false; | |
644 | 659 | } |
645 | 660 | |
646 | 661 | }else{ |
647 | 662 | if(good.goods_num>store_count){ |
648 | 663 | |
649 | - var content=gg.goods_name+'商品的库存不足,请取消订单'; | |
650 | - th.toast(content); | |
664 | + var content=gg.goods_name+'商品的库存不足,请取消订单'; | |
665 | + th.toast(content); | |
666 | + th.setData({paying:0}); | |
651 | 667 | return false; |
652 | 668 | } |
653 | 669 | |
... | ... | @@ -703,41 +719,46 @@ Page({ |
703 | 719 | |
704 | 720 | var content=goodsinfo.goods_name+'商品的活动已经结束,请取消订单重新购买'; |
705 | 721 | th.toast(content); |
722 | + th.setData({paying:0}); | |
706 | 723 | return false; |
707 | 724 | } |
708 | 725 | |
709 | 726 | buyed_mum2=promgoodsbuynum+good.goods_num; |
710 | 727 | if (buyed_mum2 > prom.buy_limit && prom.buy_limit > 0) { |
711 | - | |
712 | - var content=goodsinfo.goods_name+'购买数量超出商品活动限购,请取消订单重新购买'; | |
713 | - th.toast(content); | |
714 | - return false; | |
728 | + var content=goodsinfo.goods_name+'购买数量超出商品活动限购,请取消订单重新购买'; | |
729 | + th.toast(content); | |
730 | + th.setData({paying:0}); | |
731 | + return false; | |
715 | 732 | } |
716 | 733 | //看一下会员的秒杀价格是不是发生了变化 |
717 | 734 | if(goodsinfo.prom_type==1 && goodsinfo.goods_price!=prom.price){ |
718 | 735 | var content=goodsinfo.goods_name+'秒杀活动的价格发生了变化'; |
719 | 736 | th.toast(content); |
737 | + th.setData({paying:0}); | |
720 | 738 | return false; |
721 | 739 | } |
722 | 740 | |
723 | 741 | //看一下会员的团购价格是不是发生了变化 |
724 | 742 | if(goodsinfo.prom_type==2 && goodsinfo.goods_price!=prom.price){ |
725 | - var content=goodsinfo.goods_name+'秒杀活动的价格发生了变化'; | |
726 | - th.toast(content); | |
743 | + var content=goodsinfo.goods_name+'秒杀活动的价格发生了变化'; | |
744 | + th.toast(content); | |
745 | + th.setData({paying:0}); | |
727 | 746 | return false; |
728 | 747 | } |
729 | 748 | |
730 | 749 | if(goodsinfo.prom_type==4){ |
731 | 750 | if (good.goods_num > prom.limitqty-prom.buy_num) { |
732 | 751 | |
733 | - var content=goodsinfo.goods_name+'购买数量超出商品活动库存,请取消订单'; | |
734 | - th.toast(content); | |
735 | - return false; | |
752 | + var content=goodsinfo.goods_name+'购买数量超出商品活动库存,请取消订单'; | |
753 | + th.toast(content); | |
754 | + th.setData({paying:0}); | |
755 | + return false; | |
736 | 756 | } |
737 | 757 | }else if(goodsinfo.prom_type == 1 || goodsinfo.prom_type == 2 || goodsinfo.prom_type == 6 ) { |
738 | 758 | if(order.add_time+5*60<ut.gettimestamp()) { |
739 | 759 | var content = gg.goods_name + '该订单已经超时无法支付,请取消订单'; |
740 | 760 | th.toast(content); |
761 | + th.setData({paying:0}); | |
741 | 762 | return false; |
742 | 763 | } |
743 | 764 | } |
... | ... | @@ -751,7 +772,9 @@ Page({ |
751 | 772 | wlist=ut.sub_last(wlist); |
752 | 773 | var keyid=order.pickup_id; |
753 | 774 | var user_info=getApp().globalData.userInfo; |
754 | - if(!keyid) return false; | |
775 | + if(!keyid) { | |
776 | + th.setData({paying:0});return false; | |
777 | + } | |
755 | 778 | var offarr=null; |
756 | 779 | await getApp().request.promiseGet("/api/weshop/goods/listWarePrice", { |
757 | 780 | data:{ |
... | ... | @@ -776,8 +799,9 @@ Page({ |
776 | 799 | if(newarr[good.erpwareid] && |
777 | 800 | parseFloat(newarr[good.erpwareid].WarePrice)!=parseFloat(good.goods_price)){ |
778 | 801 | |
779 | - var content=good.goods_name + '商品的价格发生了变化,请取消订单重新购买'; | |
780 | - th.toast(content); | |
802 | + var content=good.goods_name + '商品的价格发生了变化,请取消订单重新购买'; | |
803 | + th.toast(content); | |
804 | + th.setData({paying:0}); | |
781 | 805 | return false; |
782 | 806 | } |
783 | 807 | } |
... | ... | @@ -792,9 +816,12 @@ Page({ |
792 | 816 | }, 1);--*/ |
793 | 817 | |
794 | 818 | py.pay(this.data.order.order_sn, function() { |
819 | + th.setData({paying:0}); | |
795 | 820 | wx.showToast({title: '支付成功'}) |
796 | 821 | wx.navigateBack(); |
797 | - },null,os.stoid,1); | |
822 | + },function () { | |
823 | + th.setData({paying:0}); | |
824 | + },os.stoid,1); | |
798 | 825 | |
799 | 826 | |
800 | 827 | }, | ... | ... |
pages/user/order_detail/order_detail.wxml
... | ... | @@ -150,7 +150,10 @@ |
150 | 150 | <view class="btn-wrap"> |
151 | 151 | |
152 | 152 | <view bindtap="zfwk" class="tips-btn" wx:if="{{order.pt_tail_money>0 && order.pt_status==2 }}">支付尾款</view> |
153 | - <view bindtap="jumpToCart4" class="tips-btn" hidden="{{!order.pay_btn}}">立即付款</view> | |
153 | + <view bindtap="jumpToCart4" class="tips-btn" hidden="{{!order.pay_btn}}"> | |
154 | + <text wx:if="{{paying}}">支付中</text> | |
155 | + <text wx:else>立即付款</text> | |
156 | + </view> | |
154 | 157 | |
155 | 158 | <block wx:if="{{!(order.has_rt || order.return_btn==2 || order.return_btn==4)}}"> |
156 | 159 | <navigator bindtap="confirmOrder" class="tips-btn" hidden="{{!order.receive_btn}}">收货确认</navigator> | ... | ... |
pages/user/order_list/order_list.js
... | ... | @@ -485,6 +485,9 @@ Page({ |
485 | 485 | /*----------跳转支付-----------*/ |
486 | 486 | async jumpToCart4(t) { |
487 | 487 | |
488 | + if(this.data.paying) return false; | |
489 | + this.setData({paying:1}); | |
490 | + | |
488 | 491 | var o_index = t.currentTarget.dataset.idx; |
489 | 492 | var e = this.data.orderList[o_index]; |
490 | 493 | var th = this; |
... | ... | @@ -506,6 +509,7 @@ Page({ |
506 | 509 | |
507 | 510 | if (knum <= 0) { |
508 | 511 | getApp().confirmBox("库存为0,支付失败"); |
512 | + th.setData({paying:0}); | |
509 | 513 | return false; |
510 | 514 | } |
511 | 515 | |
... | ... | @@ -520,6 +524,7 @@ Page({ |
520 | 524 | title: '提示', |
521 | 525 | content: '线下取价功能已经关闭或者过期!' |
522 | 526 | }); |
527 | + th.setData({paying:0}); | |
523 | 528 | return false; |
524 | 529 | } |
525 | 530 | |
... | ... | @@ -553,6 +558,7 @@ Page({ |
553 | 558 | if (buyed_mum2 > limit && limit > 0) { |
554 | 559 | var content = gg.goods_name + '购买数量超出商品限购,请取消订单'; |
555 | 560 | th.toast(content); |
561 | + th.setData({paying:0}); | |
556 | 562 | return false; |
557 | 563 | } |
558 | 564 | //当是组合优惠的时候 |
... | ... | @@ -587,6 +593,7 @@ Page({ |
587 | 593 | if (!isok) { |
588 | 594 | var content = gg.goods_name + '活动已经结束,请取消订单'; |
589 | 595 | th.toast(content); |
596 | + th.setData({paying:0}); | |
590 | 597 | return false; |
591 | 598 | } |
592 | 599 | |
... | ... | @@ -613,6 +620,7 @@ Page({ |
613 | 620 | if (good.goods_num + promgoodsbuynum > good['buyqty']) { |
614 | 621 | var content = good['goods_name'] + "超出活动限购\n"; |
615 | 622 | th.toast(content); |
623 | + th.setData({paying:0}); | |
616 | 624 | return false; |
617 | 625 | } |
618 | 626 | } |
... | ... | @@ -650,12 +658,14 @@ Page({ |
650 | 658 | if(good.goods_num>presellList.presell_sumqty-presellList.buy_goodnum){ |
651 | 659 | var content = good.goods_name + '购买数量超出商品库存,请取消订单'; |
652 | 660 | th.toast(content); |
661 | + th.setData({paying:0}); | |
653 | 662 | return false; |
654 | 663 | } |
655 | 664 | var buyed_mum3 = promgoodsbuynum + good.goods_num; |
656 | 665 | if (buyed_mum3 > presellList.vip_butyqty && presellList.vip_butyqty > 0) { |
657 | 666 | var content = good.goods_name + '购买数量超出商品限购,请取消订单'; |
658 | 667 | th.toast(content); |
668 | + th.setData({paying:0}); | |
659 | 669 | return false; |
660 | 670 | } |
661 | 671 | |
... | ... | @@ -729,7 +739,10 @@ Page({ |
729 | 739 | }) |
730 | 740 | |
731 | 741 | } |
732 | - if (!p_ok) return false; | |
742 | + if (!p_ok){ | |
743 | + th.setData({paying:0}); | |
744 | + return false; | |
745 | + } | |
733 | 746 | } |
734 | 747 | |
735 | 748 | //商品的普通购买 ,不要进行判断 |
... | ... | @@ -738,6 +751,7 @@ Page({ |
738 | 751 | if (gg.prom_type != good.prom_type && gg.prom_type>0) { |
739 | 752 | var content = gg.goods_name + '商品的活动发生了变化,请取消订单重新购买'; |
740 | 753 | th.toast(content); |
754 | + th.setData({paying:0}); | |
741 | 755 | return false; |
742 | 756 | } |
743 | 757 | |
... | ... | @@ -790,6 +804,7 @@ Page({ |
790 | 804 | |
791 | 805 | var content = gg.goods_name + '商品的活动发生了变化,请取消订单重新购买'; |
792 | 806 | th.toast(content); |
807 | + th.setData({paying:0}); | |
793 | 808 | return false; |
794 | 809 | } |
795 | 810 | } |
... | ... | @@ -808,7 +823,9 @@ Page({ |
808 | 823 | } |
809 | 824 | } |
810 | 825 | }) |
811 | - if (!t_ok) return false; | |
826 | + if (!t_ok){ | |
827 | + th.setData({paying:0}); return false; | |
828 | + } | |
812 | 829 | } |
813 | 830 | //-- 如果有参加线下取价 -- |
814 | 831 | if (good.offline_cut > 0) wlist += encodeURIComponent(gg.erpwareid) + ","; |
... | ... | @@ -832,6 +849,7 @@ Page({ |
832 | 849 | |
833 | 850 | var content = gg.goods_name + '商品的价格发生了变化,请取消订单重新购买1' |
834 | 851 | th.toast(content); |
852 | + th.setData({paying:0}); | |
835 | 853 | return false; |
836 | 854 | } |
837 | 855 | } |
... | ... | @@ -846,6 +864,7 @@ Page({ |
846 | 864 | |
847 | 865 | var content = gg.goods_name + '门店库存不足,请取消订单'; |
848 | 866 | th.toast(content); |
867 | + th.setData({paying:0}); | |
849 | 868 | return false; |
850 | 869 | } |
851 | 870 | |
... | ... | @@ -854,6 +873,7 @@ Page({ |
854 | 873 | |
855 | 874 | var content = gg.goods_name + '商品的库存不足,请取消订单'; |
856 | 875 | th.toast(content); |
876 | + th.setData({paying:0}); | |
857 | 877 | return false; |
858 | 878 | } |
859 | 879 | |
... | ... | @@ -905,6 +925,7 @@ Page({ |
905 | 925 | if (prom.is_end == 1 && prom.end_time < now) { |
906 | 926 | var content = goodsinfo.goods_name + '商品的活动已经结束,请取消订单' |
907 | 927 | th.toast(content); |
928 | + th.setData({paying:0}); | |
908 | 929 | return false; |
909 | 930 | } |
910 | 931 | |
... | ... | @@ -913,6 +934,7 @@ Page({ |
913 | 934 | |
914 | 935 | var content = goodsinfo.goods_name + '购买数量超出商品活动限购,请取消订单' |
915 | 936 | th.toast(content); |
937 | + th.setData({paying:0}); | |
916 | 938 | return false; |
917 | 939 | } |
918 | 940 | |
... | ... | @@ -920,6 +942,7 @@ Page({ |
920 | 942 | if(goodsinfo.prom_type==1 && goodsinfo.goods_price!=prom.price){ |
921 | 943 | var content=goodsinfo.goods_name+'秒杀活动的价格发生了变化'; |
922 | 944 | th.toast(content); |
945 | + th.setData({paying:0}); | |
923 | 946 | return false; |
924 | 947 | } |
925 | 948 | |
... | ... | @@ -927,6 +950,7 @@ Page({ |
927 | 950 | if(goodsinfo.prom_type==2 && goodsinfo.goods_price!=prom.price){ |
928 | 951 | var content=goodsinfo.goods_name+'秒杀活动的价格发生了变化'; |
929 | 952 | th.toast(content); |
953 | + th.setData({paying:0}); | |
930 | 954 | return false; |
931 | 955 | } |
932 | 956 | |
... | ... | @@ -935,12 +959,14 @@ Page({ |
935 | 959 | |
936 | 960 | var content = goodsinfo.goods_name + '购买数量超出商品活动库存,请取消订单' |
937 | 961 | th.toast(content); |
962 | + th.setData({paying:0}); | |
938 | 963 | return false; |
939 | 964 | } |
940 | 965 | } else if(goodsinfo.prom_type == 1 || goodsinfo.prom_type == 2 || goodsinfo.prom_type == 6 ) { |
941 | 966 | if(order.add_time+5*60<ut.gettimestamp()) { |
942 | 967 | var content = gg.goods_name + '该订单已经超时无法支付,请取消订单'; |
943 | 968 | th.toast(content); |
969 | + th.setData({paying:0}); | |
944 | 970 | return false; |
945 | 971 | } |
946 | 972 | } |
... | ... | @@ -953,7 +979,9 @@ Page({ |
953 | 979 | wlist = ut.sub_last(wlist); |
954 | 980 | var keyid = order.pickup_id; |
955 | 981 | var user_info = getApp().globalData.userInfo; |
956 | - if (!keyid) return false; | |
982 | + if (!keyid){ | |
983 | + th.setData({paying:0});return false; | |
984 | + } | |
957 | 985 | var offarr = null; |
958 | 986 | await getApp().request.promiseGet("/api/weshop/goods/listWarePrice", { |
959 | 987 | data: { |
... | ... | @@ -981,6 +1009,7 @@ Page({ |
981 | 1009 | |
982 | 1010 | var content = good.goods_name + '商品的价格发生了变化,请取消订单重新购买'; |
983 | 1011 | th.toast(content); |
1012 | + th.setData({paying:0}); | |
984 | 1013 | return false; |
985 | 1014 | } |
986 | 1015 | } |
... | ... | @@ -1000,13 +1029,15 @@ Page({ |
1000 | 1029 | getApp().request.post("/api/weshop/order/pay/createOrder", { |
1001 | 1030 | data: dd, |
1002 | 1031 | success: function(t) { |
1003 | - if (t.data.code == 0) { | |
1032 | + th.setData({paying:0}); | |
1033 | + if (t.data.code == 0) { | |
1004 | 1034 | th.onload(); |
1005 | 1035 | } else { |
1006 | 1036 | getApp().confirmBox(t.data.msg + "请您取消该订单"); |
1007 | 1037 | } |
1008 | 1038 | } |
1009 | 1039 | }) |
1040 | + | |
1010 | 1041 | return false; |
1011 | 1042 | } |
1012 | 1043 | |
... | ... | @@ -1018,10 +1049,13 @@ Page({ |
1018 | 1049 | });--*/ |
1019 | 1050 | |
1020 | 1051 | t.pay(e.order_sn, function() { |
1052 | + th.setData({paying:0}); | |
1021 | 1053 | wx.showToast({title: '支付成功'}) |
1022 | 1054 | th.data.orderList.splice(o_index,1); |
1023 | 1055 | th.setData({orderList:th.data.orderList}); |
1024 | - },null,os.stoid,1); | |
1056 | + },function () { | |
1057 | + th.setData({paying:0}); | |
1058 | + },os.stoid,1); | |
1025 | 1059 | |
1026 | 1060 | |
1027 | 1061 | }, | ... | ... |
pages/user/order_list/order_list.wxml
... | ... | @@ -241,7 +241,10 @@ |
241 | 241 | |
242 | 242 | |
243 | 243 | <navigator class="commodity_To_evaluate flex-level comment_go" url="/pages/cart/cart_wk/cart_wk?order_id={{item.order_id}}" data-idx="{{index}}" wx:if="{{item.pt_status==2 && item.pt_tail_money>0}}">支付尾款</navigator> |
244 | - <navigator class="commodity_To_evaluate flex-level comment_go" bindtap="jumpToCart4" data-idx="{{index}}" wx:if="{{(item.order_status==0&&item.pay_status==0)}}">立即支付</navigator> | |
244 | + <navigator class="commodity_To_evaluate flex-level comment_go" bindtap="jumpToCart4" data-idx="{{index}}" wx:if="{{(item.order_status==0&&item.pay_status==0)}}"> | |
245 | + <text wx:if="{{paying}}">支付中</text> | |
246 | + <text wx:else>立即支付</text> | |
247 | + </navigator> | |
245 | 248 | |
246 | 249 | <!-- 积分购 拼团 搭配购没有有再来一单 --> |
247 | 250 | <block wx:if="{{(item.pay_status==1 || item.order_status==3) && !item.presell && item.pt_prom_id<=0 && item.integral<=0 && item.order_goods[0].prom_type!=5 && !(item.order_goods[0].prom_type==9)}}"> | ... | ... |