Commit 3fc23ad030bbc7a14bc5e6fd4944cc574eae0ec4
1 parent
65e7275e
商品详情页面的商品已经下架优化,点击后要返回首页
Showing
3 changed files
with
82 additions
and
18 deletions
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js
| ... | ... | @@ -1020,35 +1020,55 @@ Page({ |
| 1020 | 1020 | success: function (t) { |
| 1021 | 1021 | console.log(t); |
| 1022 | 1022 | if (t.data.code == 0) { |
| 1023 | + | |
| 1024 | + var p_fail=0; | |
| 1025 | + | |
| 1023 | 1026 | if (t.data.data.is_on_sale != 1) { |
| 1027 | + p_fail=1; | |
| 1024 | 1028 | wx.showModal({ |
| 1025 | 1029 | title: '商品已经下架', |
| 1026 | 1030 | showCancel: !1, |
| 1027 | 1031 | complete: function () { |
| 1028 | - wx.navigateBack(); | |
| 1032 | + let pages = getCurrentPages(); | |
| 1033 | + if (pages[pages.length - 2]) { | |
| 1034 | + wx.navigateBack(); | |
| 1035 | + } else { | |
| 1036 | + getApp().goto('/pages/index/index/index') | |
| 1037 | + } | |
| 1029 | 1038 | } |
| 1030 | 1039 | }); |
| 1040 | + | |
| 1031 | 1041 | } |
| 1032 | 1042 | |
| 1033 | 1043 | var timestamp = Date.parse(new Date()); |
| 1034 | 1044 | timestamp = timestamp / 1000; |
| 1035 | - if (t.data.data.on_time > timestamp) { | |
| 1045 | + if (t.data.data.on_time > timestamp && !p_fail) { | |
| 1036 | 1046 | wx.showModal({ |
| 1037 | 1047 | title: '商品还未上架', |
| 1038 | 1048 | showCancel: !1, |
| 1039 | 1049 | complete: function () { |
| 1040 | - wx.navigateBack(); | |
| 1050 | + let pages = getCurrentPages(); | |
| 1051 | + if (pages[pages.length - 2]) { | |
| 1052 | + wx.navigateBack(); | |
| 1053 | + } else { | |
| 1054 | + getApp().goto('/pages/index/index/index') | |
| 1055 | + } | |
| 1041 | 1056 | } |
| 1042 | 1057 | }); |
| 1043 | 1058 | } |
| 1044 | 1059 | |
| 1045 | - if (t.data.data.down_time > 0) { | |
| 1060 | + if (t.data.data.down_time > 0 && !p_fail) { | |
| 1046 | 1061 | if (t.data.data.down_time < timestamp) { |
| 1047 | 1062 | wx.showModal({ |
| 1048 | 1063 | title: '商品已经到期下架', |
| 1049 | 1064 | showCancel: !1, |
| 1050 | 1065 | complete: function () { |
| 1051 | - wx.navigateBack(); | |
| 1066 | + let pages = getCurrentPages(); | |
| 1067 | + if (pages[pages.length - 2]) { | |
| 1068 | + wx.navigateBack(); | |
| 1069 | + } else { | |
| 1070 | + getApp().goto('/pages/index/index/index') | |
| 1071 | + } | |
| 1052 | 1072 | } |
| 1053 | 1073 | }); |
| 1054 | 1074 | } | ... | ... |
packageC/pages/presell/goodsInfo/goodsInfo.js
| ... | ... | @@ -761,34 +761,54 @@ Page({ |
| 761 | 761 | success: function (t) { |
| 762 | 762 | console.log(t); |
| 763 | 763 | if (t.data.code == 0) { |
| 764 | + | |
| 765 | + var p_fail=0; | |
| 766 | + | |
| 764 | 767 | if (t.data.data.is_on_sale != 1) { |
| 768 | + | |
| 769 | + p_fail=1; | |
| 765 | 770 | wx.showModal({ |
| 766 | 771 | title: '商品已经下架', |
| 767 | 772 | showCancel: !1, |
| 768 | 773 | complete: function () { |
| 769 | - wx.navigateBack(); | |
| 774 | + let pages = getCurrentPages(); | |
| 775 | + if (pages[pages.length - 2]) { | |
| 776 | + wx.navigateBack(); | |
| 777 | + } else { | |
| 778 | + getApp().goto('/pages/index/index/index') | |
| 779 | + } | |
| 770 | 780 | } |
| 771 | 781 | }); |
| 772 | 782 | } |
| 773 | 783 | var timestamp = Date.parse(new Date()); |
| 774 | 784 | timestamp = timestamp / 1000; |
| 775 | - if (t.data.data.on_time > timestamp) { | |
| 785 | + if (t.data.data.on_time > timestamp && !p_fail) { | |
| 776 | 786 | wx.showModal({ |
| 777 | 787 | title: '商品还未上架', |
| 778 | 788 | showCancel: !1, |
| 779 | 789 | complete: function () { |
| 780 | - wx.navigateBack(); | |
| 790 | + let pages = getCurrentPages(); | |
| 791 | + if (pages[pages.length - 2]) { | |
| 792 | + wx.navigateBack(); | |
| 793 | + } else { | |
| 794 | + getApp().goto('/pages/index/index/index') | |
| 795 | + } | |
| 781 | 796 | } |
| 782 | 797 | }); |
| 783 | 798 | } |
| 784 | 799 | |
| 785 | - if (t.data.data.down_time > 0) { | |
| 800 | + if (t.data.data.down_time > 0 && !p_fail) { | |
| 786 | 801 | if (t.data.data.down_time < timestamp) { |
| 787 | 802 | wx.showModal({ |
| 788 | 803 | title: '商品已经到期下架', |
| 789 | 804 | showCancel: !1, |
| 790 | 805 | complete: function () { |
| 791 | - wx.navigateBack(); | |
| 806 | + let pages = getCurrentPages(); | |
| 807 | + if (pages[pages.length - 2]) { | |
| 808 | + wx.navigateBack(); | |
| 809 | + } else { | |
| 810 | + getApp().goto('/pages/index/index/index') | |
| 811 | + } | |
| 792 | 812 | } |
| 793 | 813 | }); |
| 794 | 814 | } | ... | ... |
pages/goods/goodsInfo/goodsInfo.js
| ... | ... | @@ -1020,32 +1020,47 @@ Page({ |
| 1020 | 1020 | t.data.data.prom_type = 0 |
| 1021 | 1021 | } |
| 1022 | 1022 | } |
| 1023 | - if (t.data.data.is_on_sale != 1) { | |
| 1023 | + | |
| 1024 | + var p_fail=0; | |
| 1025 | + | |
| 1026 | + if (t.data.data.is_on_sale != 1 ) { | |
| 1027 | + p_fail=1; | |
| 1024 | 1028 | wx.showModal({ |
| 1025 | 1029 | title: '商品已经下架', |
| 1026 | 1030 | showCancel: !1, |
| 1027 | 1031 | complete: function () { |
| 1028 | - wx.navigateBack(); | |
| 1032 | + let pages = getCurrentPages(); | |
| 1033 | + if (pages[pages.length - 2]) { | |
| 1034 | + wx.navigateBack(); | |
| 1035 | + } else { | |
| 1036 | + getApp().goto('/pages/index/index/index') | |
| 1037 | + } | |
| 1029 | 1038 | } |
| 1030 | 1039 | }); |
| 1040 | + | |
| 1031 | 1041 | } |
| 1032 | 1042 | |
| 1033 | 1043 | ee.init(gid); |
| 1034 | 1044 | |
| 1035 | 1045 | var timestamp = Date.parse(new Date()); |
| 1036 | 1046 | timestamp = timestamp / 1000; |
| 1037 | - if (t.data.data.on_time > timestamp) { | |
| 1047 | + if (t.data.data.on_time > timestamp && !p_fail) { | |
| 1038 | 1048 | wx.showModal({ |
| 1039 | 1049 | title: '商品还未上架', |
| 1040 | 1050 | showCancel: !1, |
| 1041 | 1051 | complete: function () { |
| 1042 | - wx.navigateBack(); | |
| 1052 | + let pages = getCurrentPages(); | |
| 1053 | + if (pages[pages.length - 2]) { | |
| 1054 | + wx.navigateBack(); | |
| 1055 | + } else { | |
| 1056 | + getApp().goto('/pages/index/index/index') | |
| 1057 | + } | |
| 1043 | 1058 | } |
| 1044 | 1059 | }); |
| 1045 | 1060 | } |
| 1046 | 1061 | |
| 1047 | - if (t.data.data.down_time > 0) { | |
| 1048 | - if (t.data.data.down_time < timestamp) { | |
| 1062 | + if (t.data.data.down_time > 0 && !p_fail) { | |
| 1063 | + if (t.data.data.down_time < timestamp ) { | |
| 1049 | 1064 | wx.showModal({ |
| 1050 | 1065 | title: '商品已经到期下架', |
| 1051 | 1066 | showCancel: !1, |
| ... | ... | @@ -3927,7 +3942,10 @@ Page({ |
| 3927 | 3942 | //------------处理门店--------------- |
| 3928 | 3943 | deal_pickup(e) { |
| 3929 | 3944 | var th = this; |
| 3930 | - if (!th.data.sele_g) return false | |
| 3945 | + if (!th.data.sele_g){ | |
| 3946 | + wx.hideLoading(); | |
| 3947 | + return false | |
| 3948 | + } | |
| 3931 | 3949 | |
| 3932 | 3950 | var g_distr_type = th.data.sele_g.distr_type; |
| 3933 | 3951 | wx.hideLoading(); |
| ... | ... | @@ -4127,7 +4145,10 @@ Page({ |
| 4127 | 4145 | deal_pickup_dline(e) { |
| 4128 | 4146 | var pkno = [], |
| 4129 | 4147 | th = this; |
| 4130 | - if (!th.data.sele_g) return false; | |
| 4148 | + if (!th.data.sele_g){ | |
| 4149 | + wx.hideLoading(); | |
| 4150 | + return false; | |
| 4151 | + } | |
| 4131 | 4152 | |
| 4132 | 4153 | if (this.data.def_pick_store) { |
| 4133 | 4154 | pkno.push(this.data.def_pick_store.pickup_no); |
| ... | ... | @@ -8120,6 +8141,9 @@ Page({ |
| 8120 | 8141 | if (this.check_prom_custom(1) !== 3) { |
| 8121 | 8142 | return false; |
| 8122 | 8143 | } |
| 8144 | + | |
| 8145 | + if(!this.data.sele_g) return false; | |
| 8146 | + | |
| 8123 | 8147 | var per_price = this.data.sele_g.shop_price |
| 8124 | 8148 | if (this.data.card_field && this.data.sele_g[this.data.card_field] > 0) { |
| 8125 | 8149 | per_price = this.data.sele_g[this.data.card_field]; | ... | ... |