Commit 35de5a8871f8449baebddbf9e044c452e721e659
1 parent
a857a512
预售的优化
Showing
4 changed files
with
102 additions
and
101 deletions
packageC/pages/presell/cart/cart.wxml
... | ... | @@ -319,7 +319,7 @@ |
319 | 319 | <view class="information bdr14 mgt20"> |
320 | 320 | <block wx:if="{{act.presell_type==0}}"> |
321 | 321 | <view class="item"> |
322 | - <view>阶段一:定金(待付款)</view> | |
322 | + <view>阶段一:定金</view> | |
323 | 323 | <view class="co-red">¥{{filters.toFix(pre_arr.presell_money*order.order_goods.goods_num,2)}}元</view> |
324 | 324 | </view> |
325 | 325 | <view class="item"> | ... | ... |
packageC/pages/presell/goodsInfo/goodsInfo.js
... | ... | @@ -3900,109 +3900,115 @@ Page({ |
3900 | 3900 | }, |
3901 | 3901 | |
3902 | 3902 | //获取预售的信息 |
3903 | - async get_pre_prom(func) { | |
3904 | - var th = this; | |
3905 | - var presell_id = null; | |
3906 | - var pre_arr = null; | |
3907 | - | |
3908 | - if(!th.data.pre_id){ | |
3909 | - var presell_id=th.data.presell_id; | |
3910 | - var url="/api/weshop/marketing/marketingPresellList/list" | |
3911 | - var rd={ | |
3912 | - store_id:os.stoid, | |
3913 | - presell_id:presell_id, | |
3914 | - goods_id:th.data.gid | |
3915 | - } | |
3916 | - //------获取预售从表---------- | |
3917 | - await getApp().request.promiseGet(url, { | |
3918 | - data:rd | |
3919 | - }).then(res => { | |
3920 | - if (res.data.code == 0 && res.data.data && res.data.data.length>0) { | |
3921 | - var arr =res.data.data[0]; | |
3922 | - presell_id = arr.presell_id; | |
3923 | - th.setData({ | |
3924 | - presellList: arr, | |
3925 | - }) | |
3903 | + async get_pre_prom(func) { | |
3904 | + var th = this; | |
3905 | + var presell_id = null; | |
3906 | + var pre_arr = null; | |
3907 | + | |
3908 | + if (!th.data.pre_id) { | |
3909 | + var presell_id = th.data.presell_id; | |
3910 | + var url = "/api/weshop/marketing/marketingPresellList/list" | |
3911 | + var rd = { | |
3912 | + store_id: os.stoid, | |
3913 | + presell_id: presell_id, | |
3914 | + goods_id: th.data.gid | |
3926 | 3915 | } |
3927 | - }) | |
3916 | + //------获取预售从表---------- | |
3917 | + await getApp().request.promiseGet(url, { | |
3918 | + data: rd | |
3919 | + }).then(res => { | |
3920 | + if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { | |
3921 | + var arr = res.data.data[0]; | |
3922 | + presell_id = arr.presell_id; | |
3923 | + th.setData({ | |
3924 | + presellList: arr, | |
3925 | + }) | |
3926 | + } | |
3927 | + }) | |
3928 | 3928 | |
3929 | 3929 | |
3930 | - }else{ | |
3931 | - //------获取预售从表---------- | |
3932 | - await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/get/" + os.stoid + "/" + th.data.pre_id, {}).then(res => { | |
3933 | - if (res.data.code == 0 && res.data.data) { | |
3934 | - var arr = res.data.data; | |
3935 | - presell_id = arr.presell_id; | |
3936 | - th.setData({ | |
3937 | - presellList: arr, | |
3938 | - }) | |
3939 | - } | |
3940 | - }) | |
3941 | - } | |
3930 | + } else { | |
3931 | + //------获取预售从表---------- | |
3932 | + await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/get/" + os.stoid + "/" + th.data.pre_id, {}).then(res => { | |
3933 | + if (res.data.code == 0 && res.data.data) { | |
3934 | + var arr = res.data.data; | |
3935 | + presell_id = arr.presell_id; | |
3936 | + th.setData({ | |
3937 | + presellList: arr, | |
3938 | + }) | |
3939 | + } | |
3940 | + }) | |
3941 | + } | |
3942 | 3942 | |
3943 | 3943 | |
3944 | - if (!presell_id) { | |
3945 | - wx.showToast({ title: "未找到活动商品", icon: 'none', duration: 3000 }); | |
3946 | - ut.wx_back(); | |
3947 | - return false; | |
3948 | - } | |
3949 | - //------获取预售主表---------- | |
3950 | - await getApp().request.promiseGet(`/api/weshop/marketing/marketingPresellForm/get/${os.stoid}/${presell_id}`, {}).then(res => { | |
3951 | - if (res.data.code == 0 && res.data.data) { | |
3952 | - var act_data=res.data.data; | |
3953 | - if(act_data.is_end){ | |
3954 | - wx.showToast({ title: "活动已经结束", icon: 'none', duration: 3000 }); | |
3944 | + if (!presell_id) { | |
3945 | + wx.showToast({title: "未找到活动商品", icon: 'none', duration: 3000}); | |
3955 | 3946 | ut.wx_back(); |
3956 | 3947 | return false; |
3957 | 3948 | } |
3958 | - if(act_data.isuse==0){ | |
3959 | - wx.showToast({ title: "活动未启用", icon: 'none', duration: 3000 }); | |
3960 | - ut.wx_back(); | |
3961 | - return false; | |
3962 | - } | |
3963 | - | |
3964 | - var end_time=act_data.pay_enddate; | |
3965 | - if(act_data.presell_type==1){ | |
3966 | - end_time=act_data.end_time; | |
3967 | - } | |
3968 | - if(end_time<ut.gettimestamp()){ | |
3969 | - wx.showToast({ title: "活动已经结束", icon: 'none', duration: 3000 }); | |
3970 | - ut.wx_back(); | |
3971 | - return false; | |
3972 | - } | |
3949 | + //------获取预售主表---------- | |
3950 | + await getApp().request.promiseGet(`/api/weshop/marketing/marketingPresellForm/get/${os.stoid}/${presell_id}`, {}).then(res => { | |
3951 | + if (res.data.code == 0 && res.data.data) { | |
3952 | + var act_data = res.data.data; | |
3953 | + if (act_data.is_end) { | |
3954 | + wx.showToast({title: "活动已经结束", icon: 'none', duration: 3000}); | |
3955 | + setTimeout(function () { | |
3956 | + ut.wx_back(); | |
3957 | + }, 1100) | |
3958 | + return false; | |
3959 | + } | |
3960 | + if (act_data.isuse == 0) { | |
3961 | + wx.showToast({title: "活动未启用", icon: 'none', duration: 3000}); | |
3962 | + setTimeout(function () { | |
3963 | + ut.wx_back(); | |
3964 | + }, 1100) | |
3965 | + return false; | |
3966 | + } | |
3973 | 3967 | |
3974 | - th.setData({ | |
3975 | - presellForm: res.data.data, | |
3976 | - }); | |
3977 | - th.countDown(res.data.data.end_time) | |
3978 | - } | |
3979 | - }) | |
3980 | - var userInfo = getApp().globalData.userInfo; | |
3981 | - var pre_data = { store_id: os.stoid, is_end: 0, timetype: 1, isuse: 1,prom_type:8,prom_id:presell_id }; | |
3982 | - if (userInfo) { | |
3983 | - pre_data.user_id = userInfo.user_id; | |
3984 | - } | |
3985 | - await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/page", { | |
3986 | - data: pre_data, | |
3987 | - }).then(e => { | |
3988 | - if (e.data.code == 0 && e.data.data.pageData && e.data.data.pageData.length > 0) { | |
3968 | + var end_time = act_data.pay_enddate; | |
3969 | + if (act_data.presell_type == 1) { | |
3970 | + end_time = act_data.end_time; | |
3971 | + } | |
3972 | + if (end_time < ut.gettimestamp()) { | |
3973 | + wx.showToast({title: "活动已经结束", icon: 'none', duration: 3000}); | |
3974 | + setTimeout(function () { | |
3975 | + ut.wx_back(); | |
3976 | + }, 1100) | |
3977 | + return false; | |
3978 | + } | |
3979 | + | |
3980 | + th.setData({ | |
3981 | + presellForm: res.data.data, | |
3982 | + }); | |
3983 | + th.countDown(res.data.data.end_time) | |
3984 | + } | |
3985 | + }) | |
3986 | + var userInfo = getApp().globalData.userInfo; | |
3987 | + var pre_data = {store_id: os.stoid, is_end: 0, timetype: 1, isuse: 1, prom_type: 8, prom_id: presell_id}; | |
3988 | + if (userInfo) { | |
3989 | + pre_data.user_id = userInfo.user_id; | |
3990 | + } | |
3991 | + await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/page", { | |
3992 | + data: pre_data, | |
3993 | + }).then(e => { | |
3994 | + if (e.data.code == 0 && e.data.data.pageData && e.data.data.pageData.length > 0) { | |
3989 | 3995 | |
3990 | - th.data.all_pre_goods=e.data.data.pageData; | |
3996 | + th.data.all_pre_goods = e.data.data.pageData; | |
3991 | 3997 | |
3992 | - var idx=e.data.data.pageData.findIndex(function (ele) { | |
3993 | - return ele.id== th.data.presellList.id; | |
3998 | + var idx = e.data.data.pageData.findIndex(function (ele) { | |
3999 | + return ele.id == th.data.presellList.id; | |
4000 | + }) | |
4001 | + pre_arr = e.data.data.pageData[idx]; | |
4002 | + th.setData({pre_arr: pre_arr}) | |
4003 | + th.data.prom_buy_limit = pre_arr.vip_butyqty; | |
4004 | + } | |
3994 | 4005 | }) |
3995 | - pre_arr = e.data.data.pageData[idx]; | |
3996 | - th.setData({ pre_arr: pre_arr }) | |
3997 | - th.data.prom_buy_limit=pre_arr.vip_butyqty; | |
3998 | - } | |
3999 | - }) | |
4000 | - if (!pre_arr) { | |
4001 | - wx.showToast({ title: "当前会员身份不符,无法参与", icon: 'none', duration: 3000 }) | |
4002 | - } | |
4003 | - if (func) { | |
4004 | - func(); | |
4006 | + if (!pre_arr) { | |
4007 | + wx.showToast({title: "当前会员身份不符,无法参与", icon: 'none', duration: 3000}) | |
4008 | + } | |
4009 | + if (func) { | |
4010 | + func(); | |
4011 | + } | |
4005 | 4012 | } |
4006 | - } | |
4007 | 4013 | |
4008 | 4014 | }); | ... | ... |
pages/goods/goodsList/goodsList.wxml
... | ... | @@ -55,7 +55,7 @@ |
55 | 55 | </view> |
56 | 56 | |
57 | 57 | <view class="choice_list" wx:if="{{!isToggle}}"> |
58 | - <navigator class="choice_item" url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}" wx:for="{{requestData}}" wx:key="{{index}}"> | |
58 | + <navigator class="choice_item" url="{{g_filter.get_goods_url(item)}}" wx:for="{{requestData}}" wx:key="{{index}}"> | |
59 | 59 | <view class="img-wrap"> |
60 | 60 | <image src="{{item.original_img}}" binderror="bind_bnerr2" data-url="{{url+item.original_img}}" lazy-load="true" data-errorimg="requestData[{{index}}].original_img"></image> |
61 | 61 | </view> |
... | ... | @@ -170,7 +170,7 @@ |
170 | 170 | |
171 | 171 | |
172 | 172 | <view class="choice_list on" wx:else> |
173 | - <navigator class="choice_item" url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}" wx:for="{{requestData}}" wx:key="{{index}}"> | |
173 | + <navigator class="choice_item" url="{{g_filter.get_goods_url(item)}}" wx:for="{{requestData}}" wx:key="{{index}}"> | |
174 | 174 | <view class="img-wrap"> |
175 | 175 | <image src="{{item.original_img}}" binderror="bind_bnerr2" data-url="{{url+item.original_img}}" lazy-load="true" data-errorimg="requestData[{{index}}].original_img"></image> |
176 | 176 | </view> |
... | ... | @@ -285,12 +285,8 @@ |
285 | 285 | |
286 | 286 | |
287 | 287 | |
288 | - | |
289 | - | |
290 | 288 | |
291 | 289 | |
292 | - | |
293 | - | |
294 | 290 | <view class="no-data" wx:if="{{(!requestData||requestData.length==0) && is_go}}"> |
295 | 291 | <image class="cart-image" src="{{iurl}}/miniapp/images/cart-null.png"></image> |
296 | 292 | <view class="no-data-title">暂无相关商品</view> | ... | ... |
pages/index/index/index.js
... | ... | @@ -153,7 +153,6 @@ Page({ |
153 | 153 | } |
154 | 154 | }) |
155 | 155 | } |
156 | - | |
157 | 156 | else { |
158 | 157 | th.onload_init(); |
159 | 158 | } |
... | ... | @@ -623,11 +622,11 @@ Page({ |
623 | 622 | |
624 | 623 | //--判断小程序是否过期-- |
625 | 624 | setappdata: function (t) { |
626 | - if (t.isout == 1) | |
625 | + if (t && t.isout == 1) | |
627 | 626 | wx.reLaunch({ |
628 | 627 | url: "/pages/error/error?msg=该商城已到期,暂停浏览!\r\n可联系:" + getApp().globalData.config.store_tel, |
629 | 628 | }); |
630 | - if (t.isbuy == 0) | |
629 | + if (t && t.isbuy == 0) | |
631 | 630 | wx.reLaunch({ |
632 | 631 | url: "/pages/error/error?msg=还未购买小程序", |
633 | 632 | }); | ... | ... |