Commit 15c455fe5fdd63c2983210cde342948ea3453480

Authored by 后端研发-苏明海
2 parents be1ff75a 4fa642d5

Merge branch 'dev' into 'test'

Dev

See merge request !788
components/diy_pregoods/diy_pregoods.js
... ... @@ -18,9 +18,18 @@ Component({
18 18  
19 19 ready: function() {
20 20 var g_id = this.data.object.data;
  21 + this.data.g_id=g_id;
21 22 this.init(g_id);
22 23 },
23   -
  24 +
  25 + pageLifetimes: {
  26 + //游客登录后,只要更新卡的情况
  27 + show: function () {
  28 + //--初始化卡类--
  29 + this.init(this.data.g_id);
  30 + },
  31 + },
  32 +
24 33 methods: {
25 34 // 这里是一个自定义方法
26 35 init: function(g_id) {
... ... @@ -32,17 +41,32 @@ Component({
32 41 goodsidlist+=val.goodsid+",";
33 42 })
34 43 goodsidlist=ut.sub_last(goodsidlist);
  44 +
  45 + var user_id=getApp().globalData.user_id;
  46 + var pre_data={store_id:os.stoid,is_end:0,timetype:1,isuse:1};
  47 + if(user_id){
  48 + pre_data.user_id=user_id;
  49 + }
  50 +
35 51 //--调用接口,读取秒杀--
36   - app.request.promiseGet("/api/weshop/marketing/marketingPresellList/page?store_id="
37   - +os.stoid+"&goodsidlist="+goodsidlist, {
38   - data:{is_end:0,timetype:1,isuse:1}
  52 + app.request.promiseGet("/api/weshop/marketing/marketingPresellList/page?goodsidlist="+goodsidlist, {
  53 + data:pre_data
39 54 }).then(res => {
40   - //如果数组为空的时候
41   - var goodslist=res.data.data;
42   - //就算是添加的活动已经过期,就要用最新的进行中活动
43   - if(goodslist && goodslist.length>0) {
44   - th.set_goods_list(g_id,goodslist);
45   - }
  55 +
  56 + if(res.data.code==0 && res.data.data.pageData && res.data.data.pageData.length>0) {
  57 + //如果数组为空的时候
  58 + var goodslist = res.data.data.pageData;
  59 + //就算是添加的活动已经过期,就要用最新的进行中活动
  60 + if (goodslist && goodslist.length > 0) {
  61 + th.set_goods_list(g_id, goodslist);
  62 + }
  63 +
  64 + th.data.timer = setInterval(function () {
  65 + th.countDown2(th);
  66 + }, 1000);
  67 + }
  68 +
  69 +
46 70 });
47 71 }else{
48 72 th.no_gid_set();
... ... @@ -51,12 +75,21 @@ Component({
51 75  
52 76 //当是默认的情况
53 77 no_gid_set(){
54   - getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/page",
55   - {isShowLoading:1,data:{store_id:os.stoid,is_end:0,timetype:1,page:1,pageSize:9,isuse:1}}
  78 + var th=this;
  79 + var user_id=getApp().globalData.user_id;
  80 + var pre_data={store_id:os.stoid,is_end:0,timetype:1,isuse:1,page:1,pageSize:9};
  81 + if(user_id){
  82 + pre_data.user_id=user_id;
  83 + }
  84 + getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/page",{data:pre_data}
56 85 ).then(res=>{
57 86 if(res.data.code==0 && res.data.data.pageData && res.data.data.pageData.length>0) {
58 87 var goodsidlist=res.data.data.pageData;
59 88 this.set_goods_list(null,goodsidlist);
  89 +
  90 + th.data.timer = setInterval(function () {
  91 + th.countDown2(th);
  92 + }, 1000);
60 93 }
61 94 });
62 95 },
... ... @@ -100,8 +133,64 @@ Component({
100 133 wx.navigateTo({
101 134 url:"/packageC/pages/presell/list/list"
102 135 });
103   - }
  136 + },
  137 +
  138 + //----秒杀倒计时函数-----
  139 + countDown2: function (ob) {
  140 + if (ob == undefined) return false;
  141 + var ee = ob;
  142 + // 获取当前时间,同时得到活动结束时间数组
  143 + var newTime = ut.gettimestamp();
  144 + this.setData({ newTime: newTime });
  145 +
  146 + var List = ee.data.goods_array;
  147 + if (List.length == 0) return false;
  148 + for (var j = 0; j < List.length; j++) {
  149 + // 对结束时间进行处理渲染到页面
  150 + var endTimeList = List[j];
  151 + for (var i = 0; i < endTimeList.length; i++) {
  152 + var o = endTimeList[i];
  153 + var endTime = o.end_time;
  154 + if (newTime < o.start_time) endTime = o.start_time;
  155 + let obj = null;
  156 + // 如果活动未结束,对时间进行处理
  157 + if (endTime - newTime > 0) {
  158 + let time = (endTime - newTime);
  159 + // 获取天、时、分、秒
  160 + let day = parseInt(time / (60 * 60 * 24));
  161 + let hou = parseInt(time % (60 * 60 * 24) / 3600);
  162 + let min = parseInt(time % (60 * 60 * 24) % 3600 / 60);
  163 + let sec = parseInt(time % (60 * 60 * 24) % 3600 % 60);
  164 + obj = {
  165 + day: this.timeFormat(day),
  166 + hou: this.timeFormat(hou),
  167 + min: this.timeFormat(min),
  168 + sec: this.timeFormat(sec)
  169 + }
  170 + } else {
  171 + //活动已结束,全部设置为'00'
  172 + obj = {
  173 + day: '00',
  174 + hou: '00',
  175 + min: '00',
  176 + sec: '00'
  177 + }
  178 + }
  179 + var txt = "goods_array[" + j + "][" + i + "].djs";
  180 + ee.setData({
  181 + [txt]: obj
  182 + });
  183 + }
  184 + }
  185 + },
  186 + //---小于10的格式化函数----
  187 + timeFormat: function (param) {
  188 + return param < 10 ? '0' + param : param;
  189 + },
  190 +
104 191 },
105 192  
106 193  
  194 +
  195 +
107 196 })
108 197 \ No newline at end of file
... ...
components/diy_pregoods/diy_pregoods.wxml
... ... @@ -3,7 +3,7 @@
3 3 <view class='top' bindtap="go_to_skill">
4 4 <view class="flex">
5 5 <view class='t_left'></view>
6   - <view class='t_ms'>秒杀</view>
  6 + <view class='t_ms'>预售</view>
7 7 </view>
8 8 <view class='right_k'>
9 9 <image src="{{imghost}}/miniapp/images/icon-arrowdown.png" lazy-load="true"></image>
... ... @@ -12,58 +12,51 @@
12 12  
13 13 <!--商品展示-->
14 14 <swiper class="s_prom" indicator-active-color='red' indicator-dots="false" wx:if="{{object.style==1}}">
15   - <view class='sp' wx:if="{{object.style==1}}">
  15 + <view class='sp'>
16 16 <swiper-item class="s_it" wx:for="{{goods_array}}">
17 17 <block wx:for="{{item}}" wx:for-item="aitem" wx:for-index="aind">
18 18 <navigator url="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id={{aitem.goods_id}}&pre_id={{aitem.id}}" class="s1_gk_a1">
19 19 <view class='one'>
20 20 <view class='sp_top'>
21 21 <view class='po'></view>
22   - <block wx:if="{{aitem.start_time>newTime}}">
23   - <view class="rob">
24   - <span class='s_top_kill' style="background-color: #ffe718;color: #3c3b31;font-weight: bold">即将开始</span>
25   - </view>
26   - </block>
27   -
28 22 <block wx:if="{{aitem.end_time<=newTime}}">
29 23 <view class="rob">
30 24 <span class='s_top_kill gray'>活动已结束</span>
31 25 </view>
32 26 </block>
33 27 <block wx:else>
34   - <block wx:if="{{aitem.start_time<newTime && aitem.goods_num>aitem.buy_num}}">
  28 + <block wx:if="{{aitem.start_time<newTime && aitem.buy_goodnum<aitem.presell_sumqty}}">
35 29 <view class="rob">
36 30 <span class='s_top_kill'>火热进行</span>
37 31 </view>
38 32 </block>
39   - <block wx:if="{{aitem.goods_num<=aitem.buy_num}}">
  33 + <block wx:if="{{aitem.buy_goodnum>=aitem.presell_sumqty}}">
40 34 <view class="rob">
41 35 <span class='s_top_kill gray'>已抢光</span>
42 36 </view>
43 37 </block>
44 38 </block>
45   -
46   -
47 39  
48 40 <view class='clear'></view>
49 41  
50   - <view class='s_img'>
  42 + <view class='s_img' style="position: relative">
51 43 <image src="{{imghost+aitem.original_img}}" data-errorimg="goods_array[{{index}}][{{aind}}].original_img" binderror="bind_bnerr3"></image>
52   - </view>
53 44  
54   - <view class='s_foot_kill'>
55   - <text>{{aitem.djs.day}}天</text>
56   - <text>{{aitem.djs.hou}}时</text>
57   - <text>{{aitem.djs.min}}分</text>
58   - <text>{{aitem.djs.sec}}秒</text>
  45 +
  46 + <view class='s_foot_kill' style="position: absolute">
  47 + <text>{{aitem.djs.day}}天</text>
  48 + <text>{{aitem.djs.hou}}时</text>
  49 + <text>{{aitem.djs.min}}分</text>
  50 + <text>{{aitem.djs.sec}}秒</text>
  51 + </view>
  52 +
59 53 </view>
60 54 <view class='clear'></view>
61   -
62 55 </view>
63 56  
64 57 <view class='sp_wz'>
65   - <view class='sp_wzi'>{{aitem.title}}</view>
66   - <view class='sp_jg'>¥{{aitem.price}}</view>
  58 + <view class='sp_wzi'>{{aitem.act_name}}</view>
  59 + <view class='sp_jg'>¥{{aitem.presell_price}}</view>
67 60 <view class='sp_jgx'>¥{{aitem.market_price}}</view>
68 61 </view>
69 62  
... ... @@ -85,7 +78,7 @@
85 78 </view>
86 79  
87 80 <view class="o1_right">
88   - <view class="sp_wzi">{{aitem.title}}</view>
  81 + <view class="sp_wzi">{{aitem.act_name}}</view>
89 82 <view class="o1_sj_kill">
90 83 <text>{{aitem.djs.day}}</text> 天
91 84 <text>{{aitem.djs.hou}}</text> :
... ... @@ -94,28 +87,23 @@
94 87  
95 88 </view>
96 89 <view class="money">
97   - <view class='sp_jg'>¥{{aitem.price}}</view>
  90 + <view class='sp_jg'>¥{{aitem.presell_price}}</view>
98 91 <view class='sp_jgx'>¥{{aitem.market_price}}</view>
99 92 </view>
100   - <block wx:if="{{aitem.start_time>newTime}}">
101   - <view class="rob">
102   - <view class="wo" style="background-color: #adadad">正在预热</view>
103   - </view>
104   - </block>
105   -
  93 +
106 94 <block wx:if="{{aitem.end_time<newTime}}">
107 95 <view class="rob">
108 96 <view class="wo" style="background-color: #adadad">已结束</view>
109 97 </view>
110 98 </block>
111 99 <block wx:else>
112   - <block wx:if="{{aitem.start_time<newTime && aitem.goods_num>aitem.buy_num}}">
  100 + <block wx:if="{{aitem.start_time<newTime && aitem.buy_goodnum<aitem.presell_sumqty}}">
113 101 <view class="rob">
114 102 <view class="wo">我要抢</view>
115 103 </view>
116 104 </block>
117 105  
118   - <block wx:if="{{aitem.goods_num<=aitem.buy_num}}">
  106 + <block wx:if="{{aitem.buy_goodnum>=aitem.presell_sumqty}}">
119 107 <view class="rob">
120 108 <view class="wo" style="background-color: #adadad">已抢光</view>
121 109 </view>
... ...
components/diy_pregoods/diy_pregoods.wxss
... ... @@ -68,7 +68,6 @@ swiper {
68 68 width: 210rpx;
69 69 height: 100%;
70 70 position: relative;
71   - top: -74rpx;
72 71 left: 0rpx;
73 72 }
74 73  
... ... @@ -81,9 +80,9 @@ swiper {
81 80 padding: 4rpx 10rpx;
82 81 border-radius: 10rpx;
83 82 z-index: 999;
84   - position: relative;
85   - top: -6rpx;
86   - width: 210rpx;
  83 + position: absolute;
  84 + top: 0rpx;
  85 + width: 130rpx;
87 86 color: #fff;
88 87 text-align: center;
89 88 }
... ... @@ -95,7 +94,7 @@ swiper {
95 94 .sp .sp_top .s_foot_kill {
96 95 font-size: 20rpx;
97 96 position: relative;
98   - top: -90rpx;
  97 + bottom: 0rpx;
99 98 width: 210rpx;
100 99 height: 38rpx;
101 100 line-height: 38rpx;
... ... @@ -280,7 +279,6 @@ swiper {
280 279 }
281 280 .rob{
282 281 display: flex;
283   - justify-content: flex-end;
284 282 font-size: 30rpx;
285 283 }
286 284 .money{
... ...
packageA/pages/liveStream/liveStream.js
... ... @@ -245,7 +245,7 @@ Page({
245 245 pageSize: 100,
246 246 }).then((res) => {
247 247 self.setData({
248   - living: self.data.list,
  248 + living11: self.data.list,
249 249 });
250 250  
251 251 //直播中列表请求完后,请求即将开始列表
... ...
packageA/pages/liveStream/liveStream.wxml
... ... @@ -26,10 +26,10 @@
26 26  
27 27  
28 28 <!-- 直播中 -->
29   - <block wx:if="{{living.pageData.length > 0}}">
  29 + <block wx:if="{{living11.pageData.length > 0}}">
30 30 <view class="title">直播中</view>
31 31 <view class="list">
32   - <block wx:for="{{liveing.pageData}}" wx:key="item">
  32 + <block wx:for="{{living11.pageData}}" wx:key="item">
33 33 <view class="list-item" catchtap="clickItem" data-id="{{item.id}}" data-live="ing">
34 34 <view class="list-item-left">
35 35 <image src="{{item.share_img}}" class="item-pic" mode="aspectFit"></image>
... ...
packageC/pages/presell/cart/cart.js
... ... @@ -461,14 +461,18 @@ Page({
461 461 return false;
462 462 }
463 463 if(th.data.act.end_time<ut.gettimestamp()) {
464   - getApp().confirmBox("活动的定金时间已经结束");
  464 + getApp().confirmBox("活动的定金时间已经结束",function () {
  465 + ut.wx_back();
  466 + });
465 467 return false;
466 468 }
467 469  
468 470 }
469 471 if(th.data.wait_wk){
470 472 if(th.data.act.pay_enddate<ut.gettimestamp()) {
471   - getApp().confirmBox("活动的尾款时间已经结束");
  473 + getApp().confirmBox("活动的尾款时间已经结束",function () {
  474 + ut.wx_back();
  475 + });
472 476 return false;
473 477 }
474 478 }
... ... @@ -664,8 +668,9 @@ Page({
664 668 order_prom_id = ord_prom['id'];
665 669 switch (ord_prom['type']) {
666 670 case 0:
  671 + var all_1=o_condition;
667 672 o_condition = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折
668   - order_prom_amount = (o_condition - order_m).toFixed(2);
  673 + order_prom_amount = (all_1 - o_condition).toFixed(2);
669 674 break;
670 675 case 1:
671 676 o_condition = o_condition - ord_prom['expression'];//满额优惠金额
... ... @@ -2125,32 +2130,25 @@ Page({
2125 2130 function () {
2126 2131 //---用余额支付---
2127 2132 getApp().my_warnning("支付成功", 1, th);
2128   -
2129   -
2130   - var send_time=th.data.pre_arr.delivery_date;
2131   - if(th.data.pre_arr.delivery_type==2){
2132   - send_time=th.data.pre_arr.delivery_daynum*3600;
2133   - }
2134   -
2135   - setTimeout(function () {
2136   - th.setData({isclose: 0,'order.order_status':1,'order.pay_status':1,'wait_wk':0,'presell.tail_pay_state':1,'wait_sh':1,send_time:send_time});
2137   - }, 1000)
2138   -
  2133 + var send_time=th.data.pre_arr.delivery_date;
  2134 + if(th.data.pre_arr.delivery_type==2){
  2135 + send_time=th.data.pre_arr.delivery_daynum*3600;
  2136 + }
  2137 + th.setData({isclose: 0,'order.order_status':1,'order.pay_status':1,'wait_wk':0,'presell.tail_pay_state':1,'wait_fh':1,send_time:send_time});
  2138 +
2139 2139 }, function () {
2140 2140 getApp().my_warnning("支付失败", 0, th);
2141 2141 })
2142 2142 } else {
2143 2143 if (t.data.code == 0) {
2144   -
2145 2144 var send_time=th.data.pre_arr.delivery_date;
2146 2145 if(th.data.pre_arr.delivery_type==2){
2147 2146 send_time=th.data.pre_arr.delivery_daynum*3600;
2148 2147 }
2149 2148 //---用余额支付---
2150   - getApp().my_warnning("支付成功", 1, th);
2151   - setTimeout(function () {
2152   - th.setData({isclose: 0,'order.order_status':1,'order.pay_status':1,'wait_wk':0,'presell.tail_pay_state':1,'wait_sh':1,send_time:send_time});
2153   - }, 1000)
  2149 + getApp().my_warnning("支付成功", 1, th);
  2150 + th.setData({isclose: 0,'order.order_status':1,'order.pay_status':1,'wait_wk':0,'presell.tail_pay_state':1,'wait_fh':1,send_time:send_time});
  2151 +
2154 2152 } else {
2155 2153 getApp().my_warnning(t.data.msg, 1, th);
2156 2154 }
... ... @@ -2207,6 +2205,7 @@ Page({
2207 2205 })
2208 2206 var order=this.data.order;
2209 2207 var order_goods=this.data.order_goods;
  2208 + var user_id=getApp().globalData.userInfo.user_id;
2210 2209  
2211 2210 var wlist="";
2212 2211  
... ... @@ -2262,71 +2261,53 @@ Page({
2262 2261 return false;
2263 2262 }
2264 2263  
2265   - //当是组合优惠的时候
2266   - if(good.prom_type==7){
2267   - //如果有组合购
2268   - var isok = 1;
2269   - var url="/api/weshop/prom/zhbuy/get/"+os.stoid+"/"+good.prom_id+"/"+getApp().globalData.userInfo.user_id;
2270   - await getApp().request.promiseGet(url, {}).then(res => {
2271   - if(res.data.code==0 && res.data.data){
2272   - if(res.data.data.is_show!=1){
2273   - isok=0;
2274   - }
2275   - //如果活动已经结束
2276   - if(res.data.data.is_end==1){
2277   - isok=0;
2278   - }
2279   - //已经结束
2280   - if(ut.gettimestamp()>res.data.data.end_time){
2281   - isok=0;
2282   - }
2283   - //还未开始
2284   - if(ut.gettimestamp()<res.data.data.start_time){
2285   - isok=0;
2286   - }
2287 2264  
2288   - }else{
2289   - //未找到商品的活动
2290   - isok = 0;
2291   - }
2292 2265  
2293   - })
2294   - if (!isok){
2295   - var content=gg.goods_name+'活动已经结束,请取消订单';
2296   - th.toast(content);
2297   - return false;
  2266 + //如果是预售的时候,
  2267 + if(good.prom_type==8){
  2268 + await getApp().request.promiseGet("/api/weshop/order/orderPresell/countBuyGoodsSum",{
  2269 + data: {store_id: os.stoid, user_id: user_id, goods_id: good.goods_id, prom_id: good.prom_id},
  2270 + }).then(e=>{
  2271 + if (e.data.code == 0) {
  2272 + promgoodsbuynum=e.data.data.sumgoodsnum;
2298 2273 }
  2274 + })
2299 2275  
2300   - var url1 = "/api/weshop/prom/zhbuyGoods/page";
2301   - var req_data = {
2302   - page: 1,
2303   - pageSize: 1,
2304   - store_id: os.stoid,
2305   - zh_id: good.prom_id,
2306   - goods_id:good.goods_id
  2276 + var presell_id =good.prom_id;
  2277 + var presellList=null;
  2278 + var url = "/api/weshop/marketing/marketingPresellList/list"
  2279 + var rd = {
  2280 + store_id: os.stoid,
  2281 + presell_id: presell_id,
  2282 + goods_id: good.goods_id
  2283 + }
  2284 + //------获取预售从表----------
  2285 + await getApp().request.promiseGet(url, {
  2286 + data: rd
  2287 + }).then(res => {
  2288 + if (res.data.code == 0 && res.data.data && res.data.data.length > 0) {
  2289 + var arr = res.data.data[0];
  2290 + presellList=arr
2307 2291 }
2308   - await getApp().request.promiseGet(url1, {
2309   - data: req_data
2310   - }).then(res => {
2311   - if (ut.ajax_ok(res)) {
2312   - var gdlist = res.data.data.pageData[0];
2313   - good.buyqty=gdlist.buyqty;
2314   - }
2315   - })
  2292 + })
2316 2293  
2317   - var num=good['buyqty'];
2318   - console.log(1111);
2319   - console.log(num);
2320   - //---- 要计算商品的限购 -----
2321   - if(good['buyqty']>0){
2322   - if(good.goods_num+promgoodsbuynum>good['buyqty']){
  2294 + if(presellList){
2323 2295  
2324   - var content= good['goods_name']+"超出活动限购\n";
2325   - th.toast(content);
2326   - return false;
2327   - }
  2296 + if(good.goods_num>presellList.presell_sumqty-presellList.buy_goodnum){
  2297 + var content = gg.goods_name + '购买数量超出商品库存,请取消订单';
  2298 + th.toast(content);
  2299 + return false;
2328 2300 }
  2301 + var buyed_mum3 = promgoodsbuynum + good.goods_num;
  2302 + if (buyed_mum3 > presellList.vip_butyqty && presellList.vip_butyqty > 0) {
  2303 + var content = gg.goods_name + '购买数量超出商品限购,请取消订单';
  2304 + th.toast(content);
  2305 + return false;
  2306 + }
  2307 +
2329 2308 }
  2309 + }
  2310 +
2330 2311  
2331 2312 //如果优惠促销和搭配购的时候
2332 2313 if((good.prom_type==3 || good.prom_type==5) && good.is_collocation!=1 && good.is_gift!=1){
... ...
packageC/pages/presell/cart/cart.wxml
... ... @@ -13,19 +13,14 @@
13 13  
14 14 <view wx:if="{{wait_dj}}">
15 15 <view>等待买家付定金</view>
16   - <view>{{filters.format_time(presell.kw_start_time,1)}} -
17   - {{filters.format_time(presell.kw_end_time,1)}}
18   - </view>
  16 + <view>{{filters.format_time(act.start_time,1)}} - {{filters.format_time(act.end_time,1)}} </view>
19 17 </view>
20 18  
21 19 <view wx:if="{{wait_wk && no_start}}">
22 20 <view>等待尾款支付开始</view>
23   - <view>{{filters.format_time(presell.kw_start_time,1)}} -
24   - {{filters.format_time(presell.kw_end_time,1)}}
25   - </view>
  21 + <view>{{filters.format_time(act.pay_begindate,1)}} - {{filters.format_time(act.pay_enddate,1)}}</view>
26 22 </view>
27 23  
28   -
29 24 <view wx:if="{{wait_sh && !wait_fh}}">
30 25 <view>等待收货</view>
31 26 <view>{{order.order_sn}}</view>
... ... @@ -225,7 +220,7 @@
225 220 </view>
226 221  
227 222  
228   - <view class="set-mes bdr_b-14" wx:if="{{presell.deposit_pay_time>0 && presell.tail_pay_state==0 && !no_start && !wait_dj}}">
  223 + <view class="set-mes bdr_b-14" wx:if="{{presell.deposit_pay_time>0 && presell.tail_pay_state==0 && !no_start && !wait_dj && order.order_status<2}}">
229 224 <view wx:if="{{order.store_prom}}">
230 225 <icon color="#f23030" size="16" type="info"></icon>
231 226 {{order.store_prom}}
... ... @@ -441,9 +436,7 @@
441 436 <view class="flex top-frame">
442 437 <view class="frame">
443 438 <view class="coupon-wode ib flex ellipsis-2 ">
444   - <text class="xc-brand t-c ib white {{filter.setcolor(item.UseObjectType)}}">
445   - {{filter.get_type_card(item.UseObjectType)}}
446   - </text>
  439 + <text class="xc-brand t-c ib white {{filter.setcolor(item.UseObjectType)}}">{{filter.get_type_card(item.UseObjectType)}}</text>
447 440 <block>{{item.Sum}}元优惠券</block>
448 441 </view>
449 442 <view class="coupon-time">
... ...
packageC/pages/presell/cart/cart2_pre.js
... ... @@ -55,6 +55,9 @@ Page({
55 55 agree_no_ref:0
56 56 },
57 57 onLoad: function(t) {
  58 + wx.setNavigationBarTitle({
  59 + title: "填写订单",
  60 + });
58 61 var th = this; this.setData({ is_b_now: 1});
59 62 th.data.postdata=getApp().get_b_now();
60 63 th.data.param=t;
... ... @@ -611,8 +614,8 @@ Page({
611 614 //--------------------提交订单-----------------------
612 615 submitForm: function(t){
613 616 var th=this;
614   - //如果商家不同意退定义
615   - if(!this.data.act.is_refundmoney && !th.agree_no_ref){
  617 + //如果是部分定金,商家不同意退定金,
  618 + if(this.data.act.presell_type!=1 && !this.data.act.is_refundmoney && !th.agree_no_ref){
616 619 wx.showModal({
617 620 content: ' 预售商品不允许退定金!是否继续下单?',
618 621 showCancel: true,//是否显示取消按钮
... ...
packageC/pages/presell/goodsInfo/goodsInfo.js
... ... @@ -1527,24 +1527,18 @@ Page({
1527 1527 onShareAppMessage: function (t) {
1528 1528  
1529 1529 var th = this;
1530   - var price = th.data.data.shop_price;
1531   - if (th.data.prom_act) {
1532   - price = th.data.prom_act.price;
1533   -
1534   - }
1535   - var title = th.data.data.goods_name;
  1530 + var price = th.data.pre_arr.presell_price;
1536 1531 var img = th.data.data.original_img;
1537   - if (th.data.prom_type == 6 || th.data.prom_type == 1 || th.data.prom_type == 4) {
1538   - title = th.data.prom_act.share_title;
1539   - if (!title) title = th.data.prom_act.title;
1540   - if (th.data.prom_type == 4) title = th.data.prom_act.name;
  1532 + var title = th.data.presellForm.share_title;
  1533 + if (!title) title = th.data.prom_act.title;
  1534 + if (th.data.prom_type == 4) title = th.data.prom_act.name;
1541 1535  
1542   - if (th.data.prom_act.share_imgurl)
1543   - img = th.data.iurl + th.data.prom_act.share_imgurl;
1544   - }
  1536 + if (th.data.presellForm.share_img)
  1537 + img = th.data.iurl + th.data.presellForm.share_img;
1545 1538  
1546 1539  
1547   - var url = "/pages/goods/goodsInfo/goodsInfo?goods_id=" + th.data.gid;
  1540 +
  1541 + var url = "/packageC/pages/presell/goodsInfo/goodsInfo?goods_id=" + th.data.gid;
1548 1542 if (getApp().globalData.user_id) {
1549 1543 url += "&first_leader=" + getApp().globalData.user_id;
1550 1544 }
... ... @@ -1562,26 +1556,10 @@ Page({
1562 1556 path: url,
1563 1557 imageUrl: img,
1564 1558 };
1565   - if (th.data.prom_type == 6) {
1566   - title += '\n' + th.data.prom_act.share_remark;
1567   - ob.title = title;
1568   - ob.desc = th.data.prom_act.share_remark;
1569   - }
1570   -
1571   - //如果是积分购的时候
1572   - if (th.data.prom_type == 4) {
1573   - var name = th.data.prom_act.name;
1574   - //-- 积分购的 --
1575   - var pri0 = th.data.prom_act.addmoney;
1576   - var integral = th.data.prom_act.integral;
1577   - var text = "";
1578   - if (integral) { text = integral + "积分"; }
1579   - if (pri0 && integral) { text += "+"; }
1580   - if (pri0) { text += "¥" + pri0; }
1581   -
1582   - ob.title = text + " " + name;
1583   - }
  1559 +
  1560 + ob.title += '\n' + th.data.presellForm.share_remark;
1584 1561  
  1562 +
1585 1563 return ob;
1586 1564  
1587 1565 },
... ... @@ -1604,9 +1582,8 @@ Page({
1604 1582  
1605 1583 //----------装载同一活动中的商品----------
1606 1584 async get_sku(stoid, gd, g_id, is_normal, func) {
1607   - var tt = this, arrdata = null;
1608   - var now = ut.gettimestamp();
1609   -
  1585 + var tt = this, arrdata = null;
  1586 + var now = ut.gettimestamp();
1610 1587 var rq_data={
1611 1588 store_id: o.stoid,
1612 1589 sku: gd.sku,
... ... @@ -1618,7 +1595,7 @@ Page({
1618 1595 prom_type: 8,
1619 1596 };
1620 1597  
1621   - if(tt.data.presellForm && tt.data.presellForm.id){
  1598 + if(tt.data.presellForm && tt.data.presellForm.id){
1622 1599 rq_data.prom_id=tt.data.presellForm.id;
1623 1600 }
1624 1601  
... ... @@ -2845,9 +2822,10 @@ Page({
2845 2822 context.fillText(text, 38 * unit, 235 * unit);
2846 2823  
2847 2824 }
2848   - console.log(th.data.share_goods_img);
2849   - let share_goods_img=th.data.presellForm.share_img;
2850   - share_goods_img?share_goods_img:th.data.data.share_goods_img;
  2825 +
  2826 + //console.log(th.data.share_goods_img);
  2827 + //let share_goods_img=th.data.presellForm.share_img;
  2828 + //share_goods_img?share_goods_img:th.data.data.share_goods_img;
2851 2829 //---中间大图---
2852 2830 context.drawImage(th.data.share_goods_img, 70 * unit, 250 * unit, 408 * unit, 408 * unit);
2853 2831  
... ... @@ -3127,7 +3105,6 @@ Page({
3127 3105 tt();
3128 3106 return false;
3129 3107 }
3130   -
3131 3108 // var img_url = ee.data.data.original_img;
3132 3109 var img_url = ee.data.presellForm.share_img;
3133 3110 img_url?img_url:ee.data.data.original_img;
... ... @@ -3989,7 +3966,11 @@ Page({
3989 3966 }
3990 3967 })
3991 3968 if (!pre_arr) {
3992   - wx.showToast({title: "当前会员身份不符,无法参与", icon: 'none', duration: 3000})
  3969 + wx.showToast({title: "当前会员身份不符,无法参与", icon: 'none', duration: 3000});
  3970 + setTimeout(function () {
  3971 + ut.wx_back();
  3972 + }, 2000)
  3973 + return false;
3993 3974 }
3994 3975 if (func) {
3995 3976 func();
... ...
packageC/pages/presell/list/list.wxml
... ... @@ -43,7 +43,7 @@
43 43 <view class="xc-strip-blank rel">
44 44  
45 45 <view class="flex-vertical rel total">
46   - <view class="t-c abs xc-fill" style="width:{{215*(1-(item.buy_goodnum+item.virtual_qty)/(item.presell_sumqty+item.virtual_qty))}}rpx;background:#e4374d;"></view>
  46 + <view class="t-c abs xc-fill" style="width:{{215*(item.buy_goodnum+item.virtual_qty)/(item.presell_sumqty+item.virtual_qty)}}rpx;background:#e4374d;"></view>
47 47 <text class="fs20 white abs xc-fill-text">已预售{{filters.toFix((item.buy_goodnum+item.virtual_qty)/(item.presell_sumqty+item.virtual_qty)*100,0)}}%</text>
48 48 </view>
49 49  
... ...
pages/index/index/index.json
... ... @@ -18,7 +18,8 @@
18 18 "mvideo": "/components/diy_video/diy_video",
19 19 "service": "/components/diy_service/diy_service",
20 20 "scan": "/components/diy_scan/diy_scan",
21   - "store_select": "/components/diy_store_select/diy_store_select"
  21 + "store_select": "/components/diy_store_select/diy_store_select",
  22 + "presell": "/components/diy_pregoods/diy_pregoods"
22 23 },
23 24 "enablePullDownRefresh": false
24 25 }
25 26 \ No newline at end of file
... ...
pages/index/index/index.wxml
... ... @@ -435,10 +435,16 @@
435 435 <block wx:if="{{item.ename=='scan'}}">
436 436 <scan object="{{item.content}}"></scan>
437 437 </block>
438   - <!--扫一扫-->
  438 + <!-- 门店选择 -->
439 439 <block wx:if="{{item.ename=='store_select' && item.content.is_top!=1}}">
440 440 <store_select object="{{item.content}}"></store_select>
441   - </block>
  441 + </block>
  442 +
  443 + <!-- 预售 -->
  444 + <block wx:if="{{item.ename=='presale'}}">
  445 + <presell object="{{item.content}}"></presell>
  446 + </block>
  447 +
442 448 </view>
443 449  
444 450  
... ... @@ -461,9 +467,7 @@
461 467 <view class="img-box" style="position: relative;">
462 468 <image mode="widthFix" class="receive" src="{{url}}{{new_image==''?'/miniapp/images/newpeople/newreceive.png':new_image}}"></image>
463 469 </view>
464   - <!-- <view> -->
465   -
466   - <!-- </view> -->
  470 +
467 471 </navigator>
468 472 <image class="close" src="{{url}}/miniapp/images/plus/Close.png" catchtap="close_disgraceful" mode=""/>
469 473 <!-- <view class="flex-level"></view> -->
... ...
pages/index/index/index.wxss
... ... @@ -434,6 +434,7 @@
434 434 display: flex;
435 435 padding: 0 10rpx;
436 436 box-sizing: content-box;
  437 + width: 750rpx !important;
437 438 }
438 439  
439 440 .nav {
... ...
pages/template/index.json
... ... @@ -19,7 +19,8 @@
19 19 "picMax": "/components/diy_picMax/diy_picMax",
20 20 "mvideo": "/components/diy_video/diy_video",
21 21 "service": "/components/diy_service/diy_service",
22   - "scan": "/components/diy_scan/diy_scan"
  22 + "scan": "/components/diy_scan/diy_scan",
  23 + "presell": "/components/diy_pregoods/diy_pregoods"
23 24 },
24 25 "enablePullDownRefresh": false
25 26 }
26 27 \ No newline at end of file
... ...
pages/template/index.wxml
... ... @@ -61,6 +61,14 @@
61 61 <block wx:if="{{item.ename=='scan'}}">
62 62 <scan object="{{item.content}}"></scan>
63 63 </block>
  64 +
  65 + <!-- 预售 -->
  66 + <block wx:if="{{item.ename=='presale'}}">
  67 + <presell object="{{item.content}}"></presell>
  68 + </block>
  69 +
  70 +
  71 +
64 72 </view>
65 73 </block>
66 74 </view>
... ...
pages/user/order_list/order_list.js
... ... @@ -461,6 +461,7 @@ Page({
461 461 var th = this;
462 462 var order = e;
463 463 var order_goods = e.order_goods;
  464 + var user_id=getApp().globalData.userInfo.user_id;
464 465  
465 466 var wlist = "";
466 467 for (var i in order_goods) {
... ... @@ -482,7 +483,8 @@ Page({
482 483 return false;
483 484 }
484 485 //要每件每件的商品进行检查,看有么有超出库存,超出限购
485   - var good = order_goods[i], goodsbuynum = 0, promgoodsbuynum = 0, gg = null;
  486 + var good = order_goods[i], goodsbuynum = 0, promgoodsbuynum = 0, gg = null,presellList=null;
  487 +
486 488 //获取单品的现在的活动状态
487 489 await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + good.goods_id, {}).then(res => {
488 490 gg = res.data.data;
... ... @@ -512,7 +514,6 @@ Page({
512 514 th.toast(content);
513 515 return false;
514 516 }
515   -
516 517 //当是组合优惠的时候
517 518 if (good.prom_type == 7) {
518 519 //如果有组合购
... ... @@ -579,6 +580,52 @@ Page({
579 580 }
580 581 }
581 582  
  583 + //如果是预售的时候,
  584 + if(good.prom_type==8){
  585 + await getApp().request.promiseGet("/api/weshop/order/orderPresell/countBuyGoodsSum",{
  586 + data: {store_id: os.stoid, user_id: user_id, goods_id: good.goods_id, prom_id: good.prom_id},
  587 + }).then(e=>{
  588 + if (e.data.code == 0) {
  589 + promgoodsbuynum=e.data.data.sumgoodsnum;
  590 + }
  591 + })
  592 +
  593 + var presell_id =good.prom_id;
  594 + var url = "/api/weshop/marketing/marketingPresellList/list"
  595 + var rd = {
  596 + store_id: os.stoid,
  597 + presell_id: presell_id,
  598 + goods_id: good.goods_id
  599 + }
  600 + //------获取预售从表----------
  601 + await getApp().request.promiseGet(url, {
  602 + data: rd
  603 + }).then(res => {
  604 + if (res.data.code == 0 && res.data.data && res.data.data.length > 0) {
  605 + var arr = res.data.data[0];
  606 + presellList=arr
  607 + }
  608 + })
  609 +
  610 + if(presellList){
  611 +
  612 + if(good.goods_num>presellList.presell_sumqty-presellList.buy_goodnum){
  613 + var content = good.goods_name + '购买数量超出商品库存,请取消订单';
  614 + th.toast(content);
  615 + return false;
  616 + }
  617 + var buyed_mum3 = promgoodsbuynum + good.goods_num;
  618 + if (buyed_mum3 > presellList.vip_butyqty && presellList.vip_butyqty > 0) {
  619 + var content = good.goods_name + '购买数量超出商品限购,请取消订单';
  620 + th.toast(content);
  621 + return false;
  622 + }
  623 +
  624 + }
  625 + }
  626 +
  627 +
  628 +
582 629 //如果优惠促销和搭配购的时候
583 630 if ((good.prom_type == 3 || good.prom_type == 5) && good.is_gift != 1 && good.is_collocation != 1) {
584 631 var p_ok = 1;
... ...
pages/user/order_list/order_list.wxml
... ... @@ -46,8 +46,9 @@
46 46 <text wx:if="{{item.presell.tail_pay_state==2}}">尾款支付失败</text>
47 47 </block>
48 48 <block wx:else>
49   - <text wx:if="{{!item.presell.deposit_pay_time}}">待支付定金</text>
  49 + <text wx:if="{{item.presell.presell_type==0 && !item.presell.deposit_pay_time}}">待支付定金</text>
50 50 <text wx:if="{{item.presell.presell_type!=1 && item.presell.deposit_pay_time && !item.presell.tail_pay_state}}">待尾款</text>
  51 + <text wx:if="{{item.presell.presell_type==1 && item.order_status<2 && item.pay_status<1 }}">未支付</text>
51 52 </block>
52 53  
53 54 <block wx:if="{{!(item.is_all_return_status==0 || item.is_all_return_status==1)}}">
... ...