Commit 7cb563777fbfbe960986163b264e68570391b37d
1 parent
a8ed2b3d
预售的商品详情 和预售列表
Showing
5 changed files
with
390 additions
and
1290 deletions
packageC/pages/presell/goodsInfo/goodsInfo.js
1 | -var t = require("../../../../utils/util.js"), | ||
2 | - ut = t, | 1 | +var ut = require("../../../../utils/util.js"), |
3 | e = require("../../../../utils/common.js"), | 2 | e = require("../../../../utils/common.js"), |
4 | a = require("../../../../utils/wxParse/wxParse.js"), | 3 | a = require("../../../../utils/wxParse/wxParse.js"), |
5 | - s = getApp(), | 4 | + s = getApp(),app=s, |
6 | i = s.request, | 5 | i = s.request, |
7 | rq = i, | 6 | rq = i, |
8 | oo = s.globalData, | 7 | oo = s.globalData, |
@@ -210,7 +209,6 @@ Page({ | @@ -210,7 +209,6 @@ Page({ | ||
210 | 209 | ||
211 | //是否点赞中 | 210 | //是否点赞中 |
212 | iszaning: 0, | 211 | iszaning: 0, |
213 | - | ||
214 | select_store: 0, //选择更多 | 212 | select_store: 0, //选择更多 |
215 | index: 1, | 213 | index: 1, |
216 | more_store: 0, //选择门店 | 214 | more_store: 0, //选择门店 |
@@ -249,15 +247,14 @@ Page({ | @@ -249,15 +247,14 @@ Page({ | ||
249 | fir_goods: null, | 247 | fir_goods: null, |
250 | 248 | ||
251 | share_hidden: false, | 249 | share_hidden: false, |
250 | + pre_arr:null, | ||
252 | }, | 251 | }, |
253 | 252 | ||
254 | //------初始化加载---------- | 253 | //------初始化加载---------- |
255 | onLoad: function (t) { | 254 | onLoad: function (t) { |
256 | - | ||
257 | - var ee = this, | ||
258 | - that = ee, | ||
259 | - th = ee, | ||
260 | - gid =t.goods_id, | 255 | + var ee = this, that = ee, th = ee, |
256 | + pre_id=t.pre_id, | ||
257 | + gid=t.goods_id, | ||
261 | first_leader = t.first_leader, | 258 | first_leader = t.first_leader, |
262 | room_id = t.room_id, | 259 | room_id = t.room_id, |
263 | room_user_share = t.room_user_share; //如果是会员分享带有room_id的话,那么接下来会员分享就不传room_id | 260 | room_user_share = t.room_user_share; //如果是会员分享带有room_id的话,那么接下来会员分享就不传room_id |
@@ -296,18 +293,21 @@ Page({ | @@ -296,18 +293,21 @@ Page({ | ||
296 | if (gid == undefined || gid == null || gid == "") { | 293 | if (gid == undefined || gid == null || gid == "") { |
297 | var gid_str = decodeURIComponent(t.scene); | 294 | var gid_str = decodeURIComponent(t.scene); |
298 | gid_str = gid_str.split("_"); | 295 | gid_str = gid_str.split("_"); |
299 | - gid = gid_str[0]; | 296 | + pre_id = gid_str[0]; |
300 | if (gid_str.length > 1) { | 297 | if (gid_str.length > 1) { |
301 | - first_leader = gid_str[1]; | 298 | + pre_id = gid_str[1]; |
299 | + first_leader = gid_str[2]; | ||
302 | } | 300 | } |
303 | //-- 如果有room_id的获取 -- | 301 | //-- 如果有room_id的获取 -- |
304 | - if (gid_str.length > 2 && gid_str[2]) { | 302 | + if (gid_str.length > 2 && gid_str[3]) { |
305 | room_id = gid_str[2]; | 303 | room_id = gid_str[2]; |
306 | room_user_share = 1; | 304 | room_user_share = 1; |
307 | } | 305 | } |
308 | - | ||
309 | } | 306 | } |
310 | - ee.setData({ gid: gid }); | 307 | + |
308 | + this.data.gid=gid; | ||
309 | + this.data.pre_id=pre_id; | ||
310 | + | ||
311 | if (first_leader) { | 311 | if (first_leader) { |
312 | console.log("log---".first_leader); | 312 | console.log("log---".first_leader); |
313 | getApp().globalData.first_leader = first_leader; | 313 | getApp().globalData.first_leader = first_leader; |
@@ -418,68 +418,6 @@ Page({ | @@ -418,68 +418,6 @@ Page({ | ||
418 | }) | 418 | }) |
419 | } | 419 | } |
420 | }); | 420 | }); |
421 | - | ||
422 | - //获取用户的默认门店 | ||
423 | - getApp().get_user_store(function (e) { | ||
424 | - if (!e) { | ||
425 | - th.data.fir_def_store = {}; //赋值空对象 | ||
426 | - return false; | ||
427 | - } | ||
428 | - var ee = JSON.parse(JSON.stringify(e)); | ||
429 | - //--定时器推迟一下-- | ||
430 | - setTimeout(function () { | ||
431 | - if (th.data.fir_goods) var g_distr_type = th.data.fir_goods.distr_type; | ||
432 | - //--如果默认门店的配送方式不对,就不能被选择,这里不控制,如果不一样,就说明配送方式不对-- | ||
433 | - if (ee.distr_type != 0 && g_distr_type != 0 && ee.distr_type != g_distr_type) { | ||
434 | - //th.data.fir_def_store={}; //赋值空对象 | ||
435 | - //return false; | ||
436 | - //th.data.fir_def_store.is_no_dis=1; | ||
437 | - ee.is_no_dis = 1; | ||
438 | - } | ||
439 | - | ||
440 | - var appd = getApp().globalData; | ||
441 | - var w_time = setInterval(function () { | ||
442 | - if (that.data.is_get_local_ok == 0) return false; | ||
443 | - clearInterval(w_time); | ||
444 | - var distance = null; | ||
445 | - var e = JSON.parse(JSON.stringify(ee)); | ||
446 | - | ||
447 | - //如果有开启近距离的话,同时距离优不一样了 | ||
448 | - if (that.data.lat != null) { | ||
449 | - //如果经纬度有变化的话 | ||
450 | - if (e && appd.lat == that.data.lat && appd.lon == that.data.lon && e.distance > 0) { | ||
451 | - that.set_def_storage(e); | ||
452 | - | ||
453 | - } else { | ||
454 | - //要用接口是获取距离,js的计算不准 | ||
455 | - getApp().request.promiseGet("/api/weshop/pickup/list", { | ||
456 | - data: { store_id: os.stoid, pickup_id: e.pickup_id, lat: th.data.lat, lon: th.data.lon }, | ||
457 | - }).then(res => { | ||
458 | - if (res.data.code == 0) { | ||
459 | - e = res.data.data.pageData[0]; | ||
460 | - if (e) { | ||
461 | - e.is_no_dis = ee.is_no_dis; | ||
462 | - appd.pk_store = e; | ||
463 | - that.set_def_storage(e); | ||
464 | - } | ||
465 | - | ||
466 | - } | ||
467 | - }) | ||
468 | - } | ||
469 | - appd.lat = that.data.lat; | ||
470 | - appd.lon = that.data.lon; | ||
471 | - | ||
472 | - } else { | ||
473 | - if (e) { | ||
474 | - e.distance = null; | ||
475 | - | ||
476 | - that.set_def_storage(e); | ||
477 | - } | ||
478 | - } | ||
479 | - }, 500) | ||
480 | - }, 700) | ||
481 | - }); | ||
482 | - | ||
483 | //更新点击量 | 421 | //更新点击量 |
484 | getApp().request.put("/api/weshop/goods/updateClick", { | 422 | getApp().request.put("/api/weshop/goods/updateClick", { |
485 | data: { store_id: os.stoid, goods_id: gid } | 423 | data: { store_id: os.stoid, goods_id: gid } |
@@ -487,58 +425,17 @@ Page({ | @@ -487,58 +425,17 @@ Page({ | ||
487 | }, | 425 | }, |
488 | 426 | ||
489 | 427 | ||
490 | - //--- 设置一下默认库存的数量 ---- | ||
491 | - set_def_storage(ee) { | ||
492 | - var that = this, th = this; | ||
493 | - getApp().getConfig2(function (e) { | ||
494 | - var sales_rules = e.sales_rules; | ||
495 | - if (sales_rules == 2) { | ||
496 | - getApp().waitfor2(that, "wait_for_user_store", "fir_goods", function () { | ||
497 | - var lock = 0, plist = null; | ||
498 | - var gd = that.data.fir_goods; | ||
499 | - //先读取门店的lock,采用链式写法,少用await | ||
500 | - getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { | ||
501 | - data: { store_id: os.stoid, wareId: that.data.fir_goods.goods_id, storageId: ee.pickup_id, pageSize: 1000 } | ||
502 | - }).then(res => { | ||
503 | - if (res.data.code == 0 && res.data.data.total > 0) { | ||
504 | - for (var i in res.data.data.pageData) | ||
505 | - lock += res.data.data.pageData[i].outQty | ||
506 | - } | ||
507 | - //---通过接口获取门店的线下库存信息-- | ||
508 | - return getApp().request.promiseGet("/api/weshop/goods/getWareStorages", { | ||
509 | - data: { storageNos: ee.pickup_no, wareIds: encodeURIComponent(th.data.data.erpwareid), storeId: os.stoid } | ||
510 | - }) | ||
511 | - }).then(res => { | ||
512 | - if (res.data.code == 0 && res.data.data.total > 0) { | ||
513 | - plist = res.data.data.pageData[0]; | ||
514 | - } | ||
515 | - if (plist && plist.CanOutQty - lock > 0) { | ||
516 | - ee.CanOutQty = plist.CanOutQty - lock; | ||
517 | - } else { | ||
518 | - ee.CanOutQty = 0; | ||
519 | - } | ||
520 | - //--给门店赋值线下库存-- | ||
521 | - that.data.fir_def_store = ee; | ||
522 | - that.setData({ | ||
523 | - def_pick_store: ee, | ||
524 | - sto_sele_name: ee.pickup_name, | ||
525 | - sto_sele_id: ee.pickup_id, | ||
526 | - sto_sele_distr: ee.distr_type | ||
527 | - }) | ||
528 | - }) | ||
529 | - }) | ||
530 | - } else { | 428 | + //--- 设置一下默认库存的数量 ---- |
429 | + set_def_storage(ee) { | ||
430 | + var that = this, th = this; | ||
531 | that.data.fir_def_store = ee; | 431 | that.data.fir_def_store = ee; |
532 | that.setData({ | 432 | that.setData({ |
533 | - def_pick_store: ee, | ||
534 | - sto_sele_name: ee.pickup_name, | ||
535 | - sto_sele_id: ee.pickup_id, | ||
536 | - sto_sele_distr: ee.distr_type | 433 | + def_pick_store: ee, |
434 | + sto_sele_name: ee.pickup_name, | ||
435 | + sto_sele_id: ee.pickup_id, | ||
436 | + sto_sele_distr: ee.distr_type | ||
537 | }) | 437 | }) |
538 | - } | ||
539 | - }) | ||
540 | - | ||
541 | - }, | 438 | + }, |
542 | 439 | ||
543 | 440 | ||
544 | //------------程序初始化入口------------- | 441 | //------------程序初始化入口------------- |
@@ -553,36 +450,7 @@ Page({ | @@ -553,36 +450,7 @@ Page({ | ||
553 | fir_quan = null, | 450 | fir_quan = null, |
554 | mapurl = null, | 451 | mapurl = null, |
555 | mapurl_f_img = null; | 452 | mapurl_f_img = null; |
556 | - //------获取预售从表---------- | ||
557 | - await getApp().request.get("/api/weshop/marketing/marketingPresellList/page", { | ||
558 | - data: { | ||
559 | - is_end: 0, | ||
560 | - store_id: os.stoid, | ||
561 | - timetype: 1, | ||
562 | - goods_id: gid | ||
563 | - }, | ||
564 | - success: function (res) { | ||
565 | - if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length > 0) { | ||
566 | - var arr = res.data.data.pageData[0]; | ||
567 | - let presell_id=arr.presell_id; | ||
568 | - th.setData({ | ||
569 | - presellList: arr, | ||
570 | - }) | ||
571 | - //------获取预售主表---------- | ||
572 | - getApp().request.get(`/api/weshop/marketing/marketingPresellForm/get/${os.stoid}/${presell_id}`, { | ||
573 | - success: function (res) { | ||
574 | - console.log(res); | ||
575 | - if (res.data.code == 0 && res.data.data) { | ||
576 | - th.setData({ | ||
577 | - presellForm: res.data.data, | ||
578 | - }); | ||
579 | - th.countDown(res.data.data.end_time) | ||
580 | - } | ||
581 | - } | ||
582 | - }) | ||
583 | - } | ||
584 | - } | ||
585 | - }); | 453 | + |
586 | this.get_sto(); | 454 | this.get_sto(); |
587 | //------图片滚动---------- | 455 | //------图片滚动---------- |
588 | await getApp().request.promiseGet("/api/weshop/goodsimages/page", { | 456 | await getApp().request.promiseGet("/api/weshop/goodsimages/page", { |
@@ -717,12 +585,12 @@ Page({ | @@ -717,12 +585,12 @@ Page({ | ||
717 | 585 | ||
718 | //---展示--- | 586 | //---展示--- |
719 | onShow: function () { | 587 | onShow: function () { |
720 | - console.log('djfijsaoifjoisadjfoij'); | ||
721 | var goods_list = null, th = this, that = this; | 588 | var goods_list = null, th = this, that = this; |
589 | + | ||
590 | + //-- 如果是预览图片,页面不重新更新 -- | ||
722 | var show_prew_img = this.data.show_prew_img | 591 | var show_prew_img = this.data.show_prew_img |
723 | if (show_prew_img) { | 592 | if (show_prew_img) { |
724 | - show_prew_img = 0; | ||
725 | - return false; | 593 | + this.data.show_prew_img = 0; return false; |
726 | } | 594 | } |
727 | 595 | ||
728 | //优惠券要实时更新 | 596 | //优惠券要实时更新 |
@@ -743,196 +611,205 @@ Page({ | @@ -743,196 +611,205 @@ Page({ | ||
743 | }, 300) | 611 | }, 300) |
744 | 612 | ||
745 | this.data.is_timer = 1; | 613 | this.data.is_timer = 1; |
746 | - var ee = this, | ||
747 | - gid = this.data.gid, | ||
748 | - i = getApp().request; | 614 | + var ee = this,gid = this.data.gid,i = getApp().request; |
749 | 615 | ||
750 | this.wait_for_store_config(); | 616 | this.wait_for_store_config(); |
751 | - i.get("/api/weshop/goods/get/" + o.stoid + "/" + ee.data.gid, { | ||
752 | - failRollback: !0, | ||
753 | - success: function (t) { | ||
754 | - console.log(t); | ||
755 | - if (t.data.code == 0) { | ||
756 | - if (t.data.data.is_on_sale != 1) { | ||
757 | - wx.showModal({ | ||
758 | - title: '商品已经下架', | ||
759 | - showCancel: !1, | ||
760 | - complete: function () { | ||
761 | - wx.navigateBack(); | ||
762 | - } | ||
763 | - }); | ||
764 | - } | 617 | + this.get_pre_prom(function () { |
618 | + i.get("/api/weshop/goods/get/" + o.stoid + "/" + ee.data.gid, { | ||
619 | + failRollback: !0, | ||
620 | + success: function (t) { | ||
621 | + console.log(t); | ||
622 | + if (t.data.code == 0) { | ||
623 | + if (t.data.data.is_on_sale != 1) { | ||
624 | + wx.showModal({ | ||
625 | + title: '商品已经下架', | ||
626 | + showCancel: !1, | ||
627 | + complete: function () { | ||
628 | + wx.navigateBack(); | ||
629 | + } | ||
630 | + }); | ||
631 | + } | ||
632 | + var timestamp = Date.parse(new Date()); | ||
633 | + timestamp = timestamp / 1000; | ||
634 | + if (t.data.data.on_time > timestamp) { | ||
635 | + wx.showModal({ | ||
636 | + title: '商品还未上架', | ||
637 | + showCancel: !1, | ||
638 | + complete: function () { | ||
639 | + wx.navigateBack(); | ||
640 | + } | ||
641 | + }); | ||
642 | + } | ||
765 | 643 | ||
766 | - var timestamp = Date.parse(new Date()); | ||
767 | - timestamp = timestamp / 1000; | ||
768 | - if (t.data.data.on_time > timestamp) { | ||
769 | - wx.showModal({ | ||
770 | - title: '商品还未上架', | ||
771 | - showCancel: !1, | ||
772 | - complete: function () { | ||
773 | - wx.navigateBack(); | ||
774 | - } | ||
775 | - }); | ||
776 | - } | 644 | + if (t.data.data.down_time > 0) { |
645 | + if (t.data.data.down_time < timestamp) { | ||
646 | + wx.showModal({ | ||
647 | + title: '商品已经到期下架', | ||
648 | + showCancel: !1, | ||
649 | + complete: function () { | ||
650 | + wx.navigateBack(); | ||
651 | + } | ||
652 | + }); | ||
653 | + } | ||
654 | + } | ||
655 | + //动态获取商品名称 | ||
656 | + wx.setNavigationBarTitle({ | ||
657 | + title: t.data.data.goods_name, | ||
658 | + }); | ||
777 | 659 | ||
778 | - if (t.data.data.down_time > 0) { | ||
779 | - if (t.data.data.down_time < timestamp) { | ||
780 | - wx.showModal({ | ||
781 | - title: '商品已经到期下架', | ||
782 | - showCancel: !1, | ||
783 | - complete: function () { | ||
784 | - wx.navigateBack(); | ||
785 | - } | ||
786 | - }); | ||
787 | - } | ||
788 | - } | ||
789 | - //动态获取商品名称 | ||
790 | - wx.setNavigationBarTitle({ | ||
791 | - title: t.data.data.goods_name, | ||
792 | - }); | 660 | + //-- 把商品的赋值 -- |
661 | + ee.data.fir_goods = JSON.parse(JSON.stringify(t.data.data)); | ||
793 | 662 | ||
794 | - //-- 判断是不是组合购活动,必须要登录后才能判断 -- | ||
795 | - if (getApp().globalData.userInfo && t.data.data.prom_type == 7) { | ||
796 | - //获取活动信息 | ||
797 | - var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + | ||
798 | - t.data.data.prom_id + "/" + getApp().globalData.userInfo.user_id; | ||
799 | - getApp().request.get(url, { | ||
800 | - success: function (e) { | ||
801 | - if (e.data.code == 0 && e.data.data) { | ||
802 | - if (ut.gettimestamp() < e.data.data.start_time) { | ||
803 | - return false; | ||
804 | - } | ||
805 | - if (e.data.data.is_end == 0 && ut.gettimestamp() < e.data.data.end_time) { | ||
806 | - //-- 获取商品列表 -- | ||
807 | - th.setData({ zh_act: e.data.data }); | ||
808 | - } | 663 | + //获取用户的默认门店 |
664 | + getApp().get_user_store(function (e) { | ||
665 | + if (!e) { | ||
666 | + th.data.fir_def_store = {}; //赋值空对象 | ||
667 | + return false; | ||
668 | + } | ||
669 | + var ee = JSON.parse(JSON.stringify(e)); | ||
809 | 670 | ||
810 | - } | ||
811 | - } | ||
812 | - }); | ||
813 | - } | 671 | + if (th.data.fir_goods) var g_distr_type = th.data.fir_goods.distr_type; |
672 | + //--如果默认门店的配送方式不对,就不能被选择,这里不控制,如果不一样,就说明配送方式不对-- | ||
673 | + if (ee.distr_type != 0 && g_distr_type != 0 && ee.distr_type != g_distr_type) { | ||
674 | + ee.is_no_dis = 1; | ||
675 | + } | ||
814 | 676 | ||
815 | - //-- 把商品的赋值 -- | ||
816 | - ee.data.fir_goods = JSON.parse(JSON.stringify(t.data.data)); | ||
817 | - ee.check_is_youhui(ee.data.gid); | 677 | + var appd = getApp().globalData; |
678 | + var w_time = setInterval(function () { | ||
679 | + if (that.data.is_get_local_ok == 0) return false; | ||
680 | + clearInterval(w_time); | ||
681 | + var e = JSON.parse(JSON.stringify(ee)); | ||
682 | + | ||
683 | + //如果有开启近距离的话,同时距离优不一样了 | ||
684 | + if (that.data.lat != null) { | ||
685 | + //如果经纬度有变化的话 | ||
686 | + if (e && appd.lat == that.data.lat && appd.lon == that.data.lon && e.distance > 0) { | ||
687 | + that.set_def_storage(e); | ||
688 | + | ||
689 | + } else { | ||
690 | + //要用接口是获取距离,js的计算不准 | ||
691 | + getApp().request.promiseGet("/api/weshop/pickup/list", { | ||
692 | + data: { | ||
693 | + store_id: os.stoid, | ||
694 | + pickup_id: e.pickup_id, | ||
695 | + lat: th.data.lat, | ||
696 | + lon: th.data.lon | ||
697 | + }, | ||
698 | + }).then(res => { | ||
699 | + if (res.data.code == 0) { | ||
700 | + e = res.data.data.pageData[0]; | ||
701 | + if (e) { | ||
702 | + e.is_no_dis = ee.is_no_dis; | ||
703 | + appd.pk_store = e; | ||
704 | + that.set_def_storage(e); | ||
705 | + } | ||
706 | + | ||
707 | + } | ||
708 | + }) | ||
709 | + } | ||
710 | + appd.lat = that.data.lat; | ||
711 | + appd.lon = that.data.lon; | ||
712 | + | ||
713 | + } else { | ||
714 | + if (e) { | ||
715 | + e.distance = null; | ||
716 | + | ||
717 | + that.set_def_storage(e); | ||
718 | + } | ||
719 | + } | ||
720 | + }, 500) | ||
721 | + }); | ||
818 | 722 | ||
819 | - t.data.data.on_time = ut.formatTime(t.data.data.on_time, 'yyyy-MM-dd hh:mm:ss'); | ||
820 | 723 | ||
821 | - var cur_price = t.data.data.shop_price; | ||
822 | - if (getApp().globalData.userInfo && getApp().globalData.userInfo.card_field) { | ||
823 | - var cfile = getApp().globalData.userInfo.card_field; | ||
824 | - if (t.data.data[cfile]) { | ||
825 | - cur_price = t.data.data[cfile]; | ||
826 | - } | ||
827 | - } | ||
828 | - var txt = (cur_price / t.data.data.market_price * 10).toFixed(2).toString(); | ||
829 | - txt = parseFloat(txt); | ||
830 | 724 | ||
831 | - t.data.data['disc'] = txt; | 725 | + t.data.data.on_time = ut.formatTime(t.data.data.on_time, 'yyyy-MM-dd hh:mm:ss'); |
832 | 726 | ||
833 | - if (t.data.data.original_img.indexOf(o.imghost) == -1) | ||
834 | - t.data.data.original_img = o.imghost + t.data.data.original_img; | 727 | + var cur_price = t.data.data.shop_price; |
728 | + if (getApp().globalData.userInfo && getApp().globalData.userInfo.card_field) { | ||
729 | + var cfile = getApp().globalData.userInfo.card_field; | ||
730 | + if (t.data.data[cfile]) { | ||
731 | + cur_price = t.data.data[cfile]; | ||
732 | + } | ||
733 | + } | ||
734 | + var txt = (cur_price / t.data.data.market_price * 10).toFixed(2).toString(); | ||
735 | + txt = parseFloat(txt); | ||
835 | 736 | ||
836 | - if (t.data.data.goods_content == null) t.data.data.goods_content = ""; | 737 | + t.data.data['disc'] = txt; |
738 | + if (t.data.data.original_img.indexOf(o.imghost) == -1) | ||
739 | + t.data.data.original_img = o.imghost + t.data.data.original_img; | ||
837 | 740 | ||
838 | - //-----商品详情--- | ||
839 | - if (!t.data.data.goods_content) t.data.data.goods_content = " "; | ||
840 | - a.wxParse("content", "html", t.data.data.goods_content, ee, 6); | ||
841 | - e.wxParseAddFullImageUrl(ee, "content"); | 741 | + if (t.data.data.goods_content == null) t.data.data.goods_content = ""; |
842 | 742 | ||
843 | - ee.setData({ | ||
844 | - data: t.data.data, | ||
845 | - sele_g: t.data.data, | ||
846 | - userInfo: getApp().globalData.userInfo | ||
847 | - }); | 743 | + //-----商品详情--- |
744 | + if (!t.data.data.goods_content) t.data.data.goods_content = " "; | ||
745 | + a.wxParse("content", "html", t.data.data.goods_content, ee, 6); | ||
746 | + e.wxParseAddFullImageUrl(ee, "content"); | ||
848 | 747 | ||
748 | + ee.setData({ | ||
749 | + data: t.data.data, | ||
750 | + sele_g: t.data.data, | ||
751 | + userInfo: getApp().globalData.userInfo | ||
752 | + }); | ||
849 | 753 | ||
850 | - //获取统一条形码,普通商品和优惠促销的商品 | ||
851 | - if (ee.data.data.prom_type == 0 || ee.data.data.prom_type == 2 || ee.data.data.prom_type == 3 || ee.data.data.prom_type == 5 || ee.data.data.prom_type == 7) { | ||
852 | - //默认门店要拿下门店库存 | ||
853 | - if (that.data.sales_rules == 2 && that.data.is_newsales_rules) { | ||
854 | - //获取门店 | ||
855 | - ee.get_sto(); | ||
856 | - } else { | ||
857 | - //获取门店 | ||
858 | - ee.get_sto(); | ||
859 | - } | 754 | + //获取门店 |
755 | + ee.get_sto(); | ||
756 | + ee.get_sku(o.stoid, t.data.data, gid); | ||
860 | 757 | ||
861 | - ee.get_sku(o.stoid, t.data.data, gid); | ||
862 | - } | ||
863 | - else { | ||
864 | - var gg = "", item = t.data.data; | ||
865 | 758 | ||
866 | - if (item.goods_spec == "null" || item.goods_spec == null) item.goods_spec = ""; | ||
867 | - if (item.goods_color == "null" || item.goods_color == null) item.goods_color = ""; | 759 | + ee.data.g_buy_num = new Map(); |
868 | 760 | ||
869 | - if (item.goods_spec != "" && item.goods_color != "") { | ||
870 | - gg = item.goods_spec + "/" + item.goods_color; | ||
871 | - } else if (item.goods_spec != "" || item.goods_color != "") { | ||
872 | - gg = item.goods_spec + item.goods_color; | ||
873 | - } else { | ||
874 | - gg = "规格1"; | ||
875 | - } | ||
876 | - t.data.data.gg = gg; | ||
877 | - var uu = []; | ||
878 | - uu.push(t.data.data); | ||
879 | - ee.setData({ | ||
880 | - sku_g: uu, | ||
881 | - }); | ||
882 | - } | ||
883 | - ee.data.g_buy_num = new Map(); | ||
884 | - ee.check_prom(gid, ee.data.data.prom_type, ee.data.data.prom_id); | 761 | + if (ee.data.cat_name == '') { |
762 | + //过去国别,分类,品牌的名称 | ||
763 | + i.get("/api/weshop/goodscategory/get/" + o.stoid + "/" + th.data.data.cat_id, { | ||
764 | + success: function (t) { | ||
765 | + var dd = t.data.data; | ||
766 | + if (t.data.code == 0) { | ||
767 | + th.setData({ | ||
768 | + cat_name: dd.name | ||
769 | + }); | ||
770 | + } | ||
771 | + } | ||
772 | + }); | ||
773 | + //过去国别,分类,品牌的名称 | ||
774 | + i.get("/api/weshop/brand/get/" + o.stoid + "/" + th.data.data.brand_id, { | ||
775 | + success: function (t) { | ||
776 | + var dd = t.data.data; | ||
777 | + if (t.data.code == 0) { | ||
778 | + th.setData({ | ||
779 | + brand_name: dd.name | ||
780 | + }); | ||
781 | + } | ||
782 | + } | ||
783 | + }); | ||
784 | + //过去国别,分类,品牌的名称 | ||
785 | + i.get("/api/weshop/nation/get/" + o.stoid + "/" + th.data.data.nation_id, { | ||
786 | + success: function (t) { | ||
787 | + var dd = t.data.data; | ||
788 | + if (t.data.code == 0) { | ||
789 | + th.setData({ | ||
790 | + nation_name: dd.name | ||
791 | + }); | ||
792 | + } | ||
793 | + } | ||
794 | + }); | ||
795 | + } | ||
885 | 796 | ||
886 | - var th = ee; | ||
887 | - if (ee.data.cat_name == '') { | ||
888 | - //过去国别,分类,品牌的名称 | ||
889 | - i.get("/api/weshop/goodscategory/get/" + o.stoid + "/" + th.data.data.cat_id, { | ||
890 | - success: function (t) { | ||
891 | - var dd = t.data.data; | ||
892 | - if (t.data.code == 0) { | ||
893 | - th.setData({ | ||
894 | - cat_name: dd.name | ||
895 | - }); | ||
896 | } | 797 | } |
897 | - } | ||
898 | - }); | ||
899 | - //过去国别,分类,品牌的名称 | ||
900 | - i.get("/api/weshop/brand/get/" + o.stoid + "/" + th.data.data.brand_id, { | ||
901 | - success: function (t) { | ||
902 | - var dd = t.data.data; | ||
903 | - if (t.data.code == 0) { | ||
904 | - th.setData({ | ||
905 | - brand_name: dd.name | ||
906 | - }); | ||
907 | - } | ||
908 | - } | ||
909 | - }); | ||
910 | - //过去国别,分类,品牌的名称 | ||
911 | - i.get("/api/weshop/nation/get/" + o.stoid + "/" + th.data.data.nation_id, { | ||
912 | - success: function (t) { | ||
913 | - var dd = t.data.data; | ||
914 | - if (t.data.code == 0) { | ||
915 | - th.setData({ | ||
916 | - nation_name: dd.name | ||
917 | - }); | 798 | + else { |
799 | + wx.showModal({ | ||
800 | + title: t.data.msg, | ||
801 | + showCancel: !1, | ||
802 | + complete: function () { | ||
803 | + wx.navigateBack(); | ||
804 | + } | ||
805 | + }); | ||
918 | } | 806 | } |
919 | - } | ||
920 | - }); | ||
921 | - } | ||
922 | - | ||
923 | - } | ||
924 | - else { | ||
925 | - wx.showModal({ | ||
926 | - title: t.data.msg, | ||
927 | - showCancel: !1, | ||
928 | - complete: function () { | ||
929 | - wx.navigateBack(); | ||
930 | } | 807 | } |
931 | - }); | ||
932 | - } | ||
933 | - } | ||
934 | - }); | ||
935 | - this.data.enterAddressPage && (this.data.enterAddressPage = !1); | 808 | + }); |
809 | + ee.data.enterAddressPage && (this.data.enterAddressPage = !1); | ||
810 | + }) | ||
811 | + | ||
812 | + | ||
936 | 813 | ||
937 | }, | 814 | }, |
938 | enterAddress: function () { | 815 | enterAddress: function () { |
@@ -1054,127 +931,15 @@ Page({ | @@ -1054,127 +931,15 @@ Page({ | ||
1054 | var th = this; | 931 | var th = this; |
1055 | var ind = t.currentTarget.dataset.openSpecModal_ind; | 932 | var ind = t.currentTarget.dataset.openSpecModal_ind; |
1056 | if (!ind) ind = t.currentTarget.dataset.openspecmodal_ind; | 933 | if (!ind) ind = t.currentTarget.dataset.openspecmodal_ind; |
1057 | - th.setData({ | ||
1058 | - open_ind_store: ind | 934 | + th.setData({ |
935 | + open_ind_store: ind | ||
1059 | }); | 936 | }); |
1060 | - //如果是秒杀的话,要看redis够不够 | ||
1061 | - if (this.data.prom_type == 1) { | ||
1062 | - this.getactLen(function (num) { | ||
1063 | - if (num < th.data.goodsInputNum) { | ||
1064 | - getApp().my_warnning("秒杀库存不足!", 0, th); | ||
1065 | - return false; | ||
1066 | - } else { | ||
1067 | - th.add_cart_func(t); | ||
1068 | - } | ||
1069 | - }); | ||
1070 | - } else { | ||
1071 | - th.add_cart_func(t); | ||
1072 | - } | 937 | + |
938 | + th.add_cart_func(t); | ||
939 | + | ||
1073 | }, | 940 | }, |
1074 | 941 | ||
1075 | 942 | ||
1076 | - | ||
1077 | - //-- 加入购物的函数 -- | ||
1078 | - add_cart_func_inte: function (t) { | ||
1079 | - var i = getApp().request; | ||
1080 | - if (oo.user_id == null) { | ||
1081 | - return s.my_warnning("还未登录!", 0, this); | ||
1082 | - } | ||
1083 | - if (!getApp().globalData.userInfo) { | ||
1084 | - return s.my_warnning("还未登录!", 0, this); | ||
1085 | - } | ||
1086 | - | ||
1087 | - var e = this, | ||
1088 | - th = e, | ||
1089 | - a = 0, | ||
1090 | - o = this.data.data; | ||
1091 | - a = o.goods_id; | ||
1092 | - | ||
1093 | - //----------添加到购物车时,要判断限购数量,-------- | ||
1094 | - e.get_buy_num(o, function (ee) { | ||
1095 | - //---判断商品是否超出限购--- | ||
1096 | - if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) { | ||
1097 | - if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id) > th.data.sele_g.viplimited) { | ||
1098 | - wx.showModal({ | ||
1099 | - title: '提示', | ||
1100 | - content: '超出商品限购' | ||
1101 | - }); | ||
1102 | - return false; | ||
1103 | - } | ||
1104 | - } | ||
1105 | - //---判断商品是否超出活动限购--- | ||
1106 | - if (th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0) { | ||
1107 | - if (th.data.goodsInputNum + th.data.prom_buy_num > th.data.prom_buy_limit) { | ||
1108 | - wx.showModal({ | ||
1109 | - title: '提示', | ||
1110 | - content: '超出商品活动限购' | ||
1111 | - }); | ||
1112 | - return false; | ||
1113 | - } | ||
1114 | - } | ||
1115 | - | ||
1116 | - if (th.data.goodsInputNum <= 0) return s.my_warnning("商品数量不能为0", 0, th); | ||
1117 | - if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined) | ||
1118 | - this.setData({ | ||
1119 | - sto_sele_name: "" | ||
1120 | - }); | ||
1121 | - if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th); | ||
1122 | - | ||
1123 | - //--------------此时操作的数据------------ | ||
1124 | - var newd = { | ||
1125 | - goods_id: o.goods_id, | ||
1126 | - goods_num: th.data.goodsInputNum, | ||
1127 | - pick_id: th.data.sto_sele_id, | ||
1128 | - user_id: oo.user_id, | ||
1129 | - store_id: th.data.stoid, | ||
1130 | - goods_price: th.data.prom_price, | ||
1131 | - integral: th.data.prom_integral, | ||
1132 | - member_goods_price: o.shop_price, | ||
1133 | - goods_name: o.goods_name, | ||
1134 | - goods_sn: o.goods_sn, | ||
1135 | - sku: o.sku, | ||
1136 | - }; | ||
1137 | - | ||
1138 | - //---是不是从收藏夹出来的--- | ||
1139 | - if (th.data.c_guide_id) { | ||
1140 | - newd['guide_id'] = th.data.c_guide_id; | ||
1141 | - newd['guide_type'] = 2; | ||
1142 | - if ("add" == t.currentTarget.dataset.action) newd['guide_type'] = 3; | ||
1143 | - } else { | ||
1144 | - if (getApp().globalData.guide_id) { | ||
1145 | - newd['guide_id'] = getApp().globalData.guide_id; | ||
1146 | - newd['guide_type'] = 0; | ||
1147 | - if ("add" == t.currentTarget.dataset.action) newd['guide_type'] = 1; | ||
1148 | - } | ||
1149 | - } | ||
1150 | - | ||
1151 | - //让商品带上房间号 | ||
1152 | - //让商品带上房间号 | ||
1153 | - if (th.data.sys_switch.is_skuroom_id == 1) { | ||
1154 | - if (th.data.data.goods_id == getApp().globalData.room_goods_id) { | ||
1155 | - newd.room_id = getApp().globalData.room_id; | ||
1156 | - } | ||
1157 | - } else { | ||
1158 | - if (newd.goods_id == getApp().globalData.room_goods_id) newd.room_id = getApp().globalData.room_id; | ||
1159 | - } | ||
1160 | - | ||
1161 | - //如果是积分够,is_integral_normal就要有积分购普通购买字段 | ||
1162 | - //if(o.prom_type==4){ | ||
1163 | - //newd.is_integral_normal=1; | ||
1164 | - //} | ||
1165 | - | ||
1166 | - //-----如果是秒杀,团购,积分购,拼团----- | ||
1167 | - newd.prom_type = th.data.prom_type; | ||
1168 | - newd.prom_id = th.data.prom_id; | ||
1169 | - if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th); | ||
1170 | - if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th); | ||
1171 | - | ||
1172 | - | ||
1173 | - th.add_cart_next(e, t, a, o, newd); //立即购买下一步 | ||
1174 | - | ||
1175 | - }) | ||
1176 | - }, | ||
1177 | - | ||
1178 | //-- 加入购物的函数 -- | 943 | //-- 加入购物的函数 -- |
1179 | add_cart_func: function (t) { | 944 | add_cart_func: function (t) { |
1180 | var i = getApp().request; | 945 | var i = getApp().request; |
@@ -1186,12 +951,7 @@ Page({ | @@ -1186,12 +951,7 @@ Page({ | ||
1186 | return s.my_warnning("还未登录!", 0, this); | 951 | return s.my_warnning("还未登录!", 0, this); |
1187 | } | 952 | } |
1188 | 953 | ||
1189 | - var e = this, | ||
1190 | - th = e, | ||
1191 | - a = 0, | ||
1192 | - o = this.data.sele_g; | ||
1193 | - a = o.goods_id; | ||
1194 | - | 954 | + var e = this,th = e, o = this.data.sele_g,a = o.goods_id; |
1195 | //----------添加到购物车时,要判断限购数量,-------- | 955 | //----------添加到购物车时,要判断限购数量,-------- |
1196 | e.get_buy_num(o, function (ee) { | 956 | e.get_buy_num(o, function (ee) { |
1197 | //---判断商品是否超出限购--- | 957 | //---判断商品是否超出限购--- |
@@ -1234,6 +994,7 @@ Page({ | @@ -1234,6 +994,7 @@ Page({ | ||
1234 | goods_name: o.goods_name, | 994 | goods_name: o.goods_name, |
1235 | goods_sn: o.goods_sn, | 995 | goods_sn: o.goods_sn, |
1236 | sku: o.sku, | 996 | sku: o.sku, |
997 | + presell_list_id:th.data.presellList.id, | ||
1237 | }; | 998 | }; |
1238 | 999 | ||
1239 | //---是不是从收藏夹出来的--- | 1000 | //---是不是从收藏夹出来的--- |
@@ -1270,163 +1031,22 @@ Page({ | @@ -1270,163 +1031,22 @@ Page({ | ||
1270 | newd.pricing_type = o.pricing_type; | 1031 | newd.pricing_type = o.pricing_type; |
1271 | } | 1032 | } |
1272 | 1033 | ||
1273 | - //-----如果是秒杀,团购,积分购,拼团----- | ||
1274 | - if (th.data.prom_type == 1) { | ||
1275 | newd.goods_price = th.data.prom_price; | 1034 | newd.goods_price = th.data.prom_price; |
1276 | newd.member_goods_price = th.data.prom_price, | 1035 | newd.member_goods_price = th.data.prom_price, |
1277 | - newd.prom_type = th.data.prom_type; | ||
1278 | - newd.prom_id = th.data.prom_id; | 1036 | + newd.prom_type = 8; |
1037 | + newd.prom_id = o.prom_id; | ||
1279 | 1038 | ||
1280 | if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th); | 1039 | if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th); |
1281 | if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th); | 1040 | if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th); |
1282 | - | ||
1283 | th.add_cart_next(e, t, a, o, newd); //加入购物车下一步 | 1041 | th.add_cart_next(e, t, a, o, newd); //加入购物车下一步 |
1284 | 1042 | ||
1285 | - } else if (o.prom_type == 7) { | ||
1286 | - | ||
1287 | - //判断进行中的活动,是不是要判断线下库存 | ||
1288 | - th.check_zh_acting(function (ee) { | ||
1289 | - newd.prom_id = 0; | ||
1290 | - newd.prom_type = 0; | ||
1291 | - if (ee && th.data.sele_g.act) { | ||
1292 | - newd.prom_id = th.data.sele_g.act.id; | ||
1293 | - newd.prom_type = 7; | ||
1294 | - if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th); | ||
1295 | - if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th); | ||
1296 | - th.add_cart_next(e, t, a, o, newd); //加入购物车下一步 | ||
1297 | - return false; | ||
1298 | - } else { | ||
1299 | - //---如果是线下门店销售的时候--- | ||
1300 | - if (th.data.sales_rules == 2) { | ||
1301 | - var pick = th.get_pick_from_list(th.data.sto_sele_id) | ||
1302 | - //---通过接口获取门店的线下库存信息-- | ||
1303 | - getApp().request.get("/api/weshop/goods/getWareStorages", { | ||
1304 | - data: { storageNos: pick.pickup_no, wareIds: encodeURIComponent(th.data.sele_g.erpwareid), storeId: os.stoid }, | ||
1305 | - success: function (res) { | ||
1306 | - if (res.data.code == 0) { | ||
1307 | - if (res.data.data.pageData.length > 0) { | ||
1308 | - var CanOutQty = res.data.data.pageData[0].CanOutQty; | ||
1309 | - if (CanOutQty < e.data.goodsInputNum) { | ||
1310 | - return s.my_warnning("库存不足!", 0, th); | ||
1311 | - } | ||
1312 | - //在调一次接口,读取商品的预出库的数量,lock | ||
1313 | - getApp().request.get("/api/weshop/order/ware/lock/page", { | ||
1314 | - data: { store_id: os.stoid, wareId: th.data.sele_g.goods_id, storageId: pick.pickup_id, pageSize: 1000 }, | ||
1315 | - success: function (res_data) { | ||
1316 | - if (res_data.data.code == 0 && res_data.data.data.total > 0) { | ||
1317 | - | ||
1318 | - var lock = 0; | ||
1319 | - for (var i in res_data.data.data.pageData) { | ||
1320 | - lock += res_data.data.data.pageData[i].outQty; | ||
1321 | - } | ||
1322 | - | ||
1323 | - if (CanOutQty <= lock) { | ||
1324 | - return s.my_warnning("库存不足!", 0, th); | ||
1325 | - } | ||
1326 | - th.add_cart_next(e, t, a, o, newd, CanOutQty - lock); | ||
1327 | - } else { | ||
1328 | - th.add_cart_next(e, t, a, o, newd, CanOutQty); | ||
1329 | - } | ||
1330 | - } | ||
1331 | - }) | ||
1332 | - } else { | ||
1333 | - return s.my_warnning("库存不足!", 0, th); | ||
1334 | - } | ||
1335 | - | ||
1336 | - } | ||
1337 | - } | ||
1338 | - }) | ||
1339 | - } else { | ||
1340 | - if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th); | ||
1341 | - if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th); | ||
1342 | - th.add_cart_next(e, t, a, o, newd); //加入购物车下一步 | ||
1343 | - } | ||
1344 | - } | ||
1345 | - }) | ||
1346 | - | ||
1347 | - } | ||
1348 | - else if (th.data.prom_type == 0 || th.data.prom_type == 3 || th.data.prom_type == 2 || th.data.prom_type == 4 || th.data.prom_type == 5) { | ||
1349 | - newd.prom_type = 0; | ||
1350 | - newd.prom_id = 0; | ||
1351 | - | ||
1352 | - //---如果是线下门店销售的时候--- | ||
1353 | - if (th.data.sales_rules == 2) { | ||
1354 | - var pick = th.get_pick_from_list(th.data.sto_sele_id) | ||
1355 | - //---通过接口获取门店的线下库存信息-- | ||
1356 | - getApp().request.get("/api/weshop/goods/getWareStorages", { | ||
1357 | - data: { storageNos: pick.pickup_no, wareIds: encodeURIComponent(th.data.sele_g.erpwareid), storeId: os.stoid }, | ||
1358 | - success: function (res) { | ||
1359 | - if (res.data.code == 0) { | ||
1360 | - if (res.data.data.pageData.length > 0) { | ||
1361 | - var CanOutQty = res.data.data.pageData[0].CanOutQty; | ||
1362 | - if (CanOutQty < e.data.goodsInputNum) { | ||
1363 | - return s.my_warnning("库存不足!", 0, th); | ||
1364 | - } | ||
1365 | - //在调一次接口,读取商品的预出库的数量,lock | ||
1366 | - getApp().request.get("/api/weshop/order/ware/lock/page", { | ||
1367 | - data: { store_id: os.stoid, wareId: th.data.sele_g.goods_id, storageId: pick.pickup_id, pageSize: 1000 }, | ||
1368 | - success: function (res_data) { | ||
1369 | - if (res_data.data.code == 0 && res_data.data.data.total > 0) { | ||
1370 | - | ||
1371 | - var lock = 0; | ||
1372 | - for (var i in res_data.data.data.pageData) { | ||
1373 | - lock += res_data.data.data.pageData[i].outQty; | ||
1374 | - } | ||
1375 | - | ||
1376 | - if (CanOutQty <= lock) { | ||
1377 | - return s.my_warnning("库存不足!", 0, th); | ||
1378 | - } | ||
1379 | - th.add_cart_next(e, t, a, o, newd, CanOutQty - lock); | ||
1380 | - } else { | ||
1381 | - th.add_cart_next(e, t, a, o, newd, CanOutQty); | ||
1382 | - } | ||
1383 | - } | ||
1384 | - }) | ||
1385 | - } else { | ||
1386 | - return s.my_warnning("库存不足!", 0, th); | ||
1387 | - } | ||
1388 | - | ||
1389 | - } | ||
1390 | - } | ||
1391 | - }) | ||
1392 | - } else { | ||
1393 | - if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th); | ||
1394 | - if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th); | ||
1395 | - th.add_cart_next(e, t, a, o, newd); //加入购物车下一步 | ||
1396 | - } | ||
1397 | - } | 1043 | + |
1398 | }) | 1044 | }) |
1399 | }, | 1045 | }, |
1400 | 1046 | ||
1401 | //---加入购物车的最后一步--- | 1047 | //---加入购物车的最后一步--- |
1402 | add_cart_next(e, t, a, o, newd, CanOutQty) { | 1048 | add_cart_next(e, t, a, o, newd, CanOutQty) { |
1403 | var th = this, i = getApp().request; | 1049 | var th = this, i = getApp().request; |
1404 | - //---如果商品不是积分购和拼团,要判断一个是否要进行等级价的判断------ | ||
1405 | - if (o.prom_type != 1 && ((o.prom_type != 6 && o.prom_type != 4) || th.data.is_normal)) { | ||
1406 | - var conf = th.data.bconfig; | ||
1407 | - if (conf.switch_list && getApp().globalData.userInfo['card_field'] && getApp().globalData.userInfo['card_expiredate']) { | ||
1408 | - var s_list = JSON.parse(conf.switch_list); | ||
1409 | - var now = ut.gettimestamp(); | ||
1410 | - | ||
1411 | - | ||
1412 | - var str = getApp().globalData.userInfo['card_expiredate'].replace(/-/g, '/'); | ||
1413 | - var end = new Date(str); | ||
1414 | - end = Date.parse(end) / 1000; | ||
1415 | - | ||
1416 | - //--如果后台有开启等级价的功能,而且会员的等级没有过期的情况下-- | ||
1417 | - if (parseInt(s_list.rank_switch) == 2 && end > now) { | ||
1418 | - var card_price = o[getApp().globalData.userInfo['card_field']]; | ||
1419 | - //如果会员有等级价 | ||
1420 | - if (getApp().globalData.userInfo['card_field'] != undefined && getApp().globalData.userInfo['card_field'] != null | ||
1421 | - && getApp().globalData.userInfo['card_field'] != "" && card_price > 0) { | ||
1422 | - newd.goods_price = card_price; | ||
1423 | - newd.member_goods_price = card_price; | ||
1424 | - } | ||
1425 | - } | ||
1426 | - } | ||
1427 | - } | ||
1428 | - | ||
1429 | - //if (this.data.data.goods.is_virtual) return this.buyVirtualGoods(d); | ||
1430 | if ("add" == t.currentTarget.dataset.action) { | 1050 | if ("add" == t.currentTarget.dataset.action) { |
1431 | 1051 | ||
1432 | if (th.data.prom_goods) { | 1052 | if (th.data.prom_goods) { |
@@ -1506,102 +1126,29 @@ Page({ | @@ -1506,102 +1126,29 @@ Page({ | ||
1506 | }); | 1126 | }); |
1507 | } | 1127 | } |
1508 | } | 1128 | } |
1509 | - }); | ||
1510 | - | ||
1511 | - } | ||
1512 | - //else "exchange" == t.currentTarget.dataset.action ? this.exchange(d) : this.buyNow(d); | ||
1513 | - else { | ||
1514 | - | ||
1515 | - if (th.data.prom_goods) { | ||
1516 | - var prom_d = th.data.prom_goods; | ||
1517 | - for (var i in prom_d) { | ||
1518 | - //判断活动有俩种条件,0元 1件 | ||
1519 | - var condition_t = prom_d[i].prom_type; | ||
1520 | - switch (condition_t) { | ||
1521 | - case 0: //按钱 | ||
1522 | - if (newd.goods_price >= condition_t) { | ||
1523 | - newd.prom_type = 3; | ||
1524 | - newd.prom_id = prom_d[i].prom_id; | ||
1525 | - } | ||
1526 | - break | ||
1527 | - case 1://按购买数量 | ||
1528 | - if (newd.goods_num >= condition_t) { | ||
1529 | - newd.prom_type = 3; | ||
1530 | - newd.prom_id = prom_d[i].prom_id; | ||
1531 | - } | ||
1532 | - break; | ||
1533 | - } | ||
1534 | - } | ||
1535 | - | ||
1536 | - } | 1129 | + }) |
1537 | 1130 | ||
1131 | + }else { | ||
1538 | newd['pick_name'] = th.data.sto_sele_name; | 1132 | newd['pick_name'] = th.data.sto_sele_name; |
1539 | newd['pick_dis'] = th.data.sto_sele_distr; | 1133 | newd['pick_dis'] = th.data.sto_sele_distr; |
1540 | th.buyNow(newd); | 1134 | th.buyNow(newd); |
1541 | } | 1135 | } |
1542 | }, | 1136 | }, |
1543 | 1137 | ||
1544 | - | ||
1545 | - //----------购买虚拟商品------ | ||
1546 | - buyVirtualGoods: function (e) { | ||
1547 | - Object.assign(e, { | ||
1548 | - goods_name: this.data.data.goods.goods_name, | ||
1549 | - spec_name: this.data.select.specName, | ||
1550 | - price: this.data.select.price | ||
1551 | - }), wx.navigateTo({ | ||
1552 | - url: "/pages/virtual/buy_step/buy_step?" + t.Obj2Str(e) | ||
1553 | - }); | ||
1554 | - }, | ||
1555 | - //----------积分兑换--------- | ||
1556 | - exchange: function (e) { | ||
1557 | - this.data.shippingCost < 0 || this.data.select.stock <= 0 || wx.navigateTo({ | ||
1558 | - url: "/pages/cart/integral/integral?" + t.Obj2Str(e) | ||
1559 | - }); | ||
1560 | - }, | ||
1561 | - | ||
1562 | - | ||
1563 | //----------立即购买----------- | 1138 | //----------立即购买----------- |
1564 | buyNow: function (e) { | 1139 | buyNow: function (e) { |
1565 | - // this.data.shippingCost < 0 || this.data.select.stock <= 0 || (Object.assign(e, { | ||
1566 | - // action: "buy_now" | ||
1567 | - // }), | 1140 | + |
1568 | this.setData({ | 1141 | this.setData({ |
1569 | openSpecModal: 0, | 1142 | openSpecModal: 0, |
1570 | openSpecModal_inte: 0, | 1143 | openSpecModal_inte: 0, |
1571 | openSpecModal_inte_normal: 0, | 1144 | openSpecModal_inte_normal: 0, |
1572 | openSpecModal_pt: 0, | 1145 | openSpecModal_pt: 0, |
1573 | }) | 1146 | }) |
1574 | - | ||
1575 | - if (e.prom_type == 4) { | ||
1576 | - s.set_b_now(e); | ||
1577 | - var url = "/pages/cart/cart2_inte/cart2_inte?is_bnow=1&goods_id=" + e.goods_id; | ||
1578 | - getApp().goto(url); | ||
1579 | - } else { | ||
1580 | - //要判断积分购的普通购买有没有参加优惠活动 | ||
1581 | - if (e.is_integral_normal == 1) { | ||
1582 | - this.check_nor_promgood(e.goods_id, function (res) { | ||
1583 | - if (res && res.cat_id) { | ||
1584 | - e.prom_type = 3; | ||
1585 | - e.prom_id = res.cat_id | ||
1586 | - } | ||
1587 | - s.set_b_now(e); | ||
1588 | - /*-- | ||
1589 | - wx.redirectTo({ | ||
1590 | - url: "/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id, | ||
1591 | - });--*/ | ||
1592 | - getApp().goto("/packageC/pages/presell/cart/cart?is_bnow=1&goods_id=" + e.goods_id) | ||
1593 | - | ||
1594 | - }) | ||
1595 | - } else { | ||
1596 | - s.set_b_now(e); | ||
1597 | - /*-- | ||
1598 | - wx.redirectTo({ | ||
1599 | - url: "/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id, | ||
1600 | - });--*/ | ||
1601 | - getApp().goto("/packageC/pages/presell/cart/cart?is_bnow=1&goods_id=" + e.goods_id) | ||
1602 | - } | ||
1603 | - | ||
1604 | - } | 1147 | + |
1148 | + app.set_b_now(e); | ||
1149 | + getApp().goto("/packageC/pages/presell/cart/cart2_pre"); | ||
1150 | + | ||
1151 | + | ||
1605 | }, | 1152 | }, |
1606 | 1153 | ||
1607 | //----------增加购买数量----------- | 1154 | //----------增加购买数量----------- |
@@ -1654,7 +1201,7 @@ Page({ | @@ -1654,7 +1201,7 @@ Page({ | ||
1654 | } | 1201 | } |
1655 | 1202 | ||
1656 | //--判断商品是否超出活动限购-- | 1203 | //--判断商品是否超出活动限购-- |
1657 | - if (th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0 && !th.data.is_normal) { | 1204 | + if (th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0) { |
1658 | if (t + th.data.prom_buy_num > th.data.prom_buy_limit) { | 1205 | if (t + th.data.prom_buy_num > th.data.prom_buy_limit) { |
1659 | wx.showModal({ | 1206 | wx.showModal({ |
1660 | title: '超出商品活动限购', | 1207 | title: '超出商品活动限购', |
@@ -1667,24 +1214,8 @@ Page({ | @@ -1667,24 +1214,8 @@ Page({ | ||
1667 | } | 1214 | } |
1668 | } | 1215 | } |
1669 | 1216 | ||
1670 | - if (th.data.sele_g.prom_type == 1 || th.data.sele_g.prom_type == 6) { | ||
1671 | - var redis_num = 0; | ||
1672 | - //------判断活动是否抢光----- | ||
1673 | - await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + | ||
1674 | - os.stoid + "/" + th.data.sele_g.prom_type + "/" + th.data.sele_g.prom_id, { | ||
1675 | - 1: 1 | ||
1676 | - }).then(res => { | ||
1677 | - redis_num = res.data.data; | ||
1678 | - }); | ||
1679 | 1217 | ||
1680 | - if (t > redis_num) { | ||
1681 | - wx.showModal({ | ||
1682 | - title: '超出商品活动库存', | ||
1683 | - }); | ||
1684 | - th.setData({ goodsInputNum: redis_num }) | ||
1685 | - return false; | ||
1686 | - } | ||
1687 | - } | 1218 | + |
1688 | var e = th.data.sele_g.store_count; | 1219 | var e = th.data.sele_g.store_count; |
1689 | var p_type = th.data.prom_type; //&& p_type!=1 && p_type!=4 | 1220 | var p_type = th.data.prom_type; //&& p_type!=1 && p_type!=4 |
1690 | if (th.data.sales_rules == 2 && (p_type != 1 && p_type != 4 && p_type != 6 || th.data.openSpecModal_inte_normal == 1 || th.data.is_normal == 1)) { | 1221 | if (th.data.sales_rules == 2 && (p_type != 1 && p_type != 4 && p_type != 6 || th.data.openSpecModal_inte_normal == 1 || th.data.is_normal == 1)) { |
@@ -1795,7 +1326,6 @@ Page({ | @@ -1795,7 +1326,6 @@ Page({ | ||
1795 | sele_g: this.data.data, | 1326 | sele_g: this.data.data, |
1796 | gid: this.data.data.goods_id | 1327 | gid: this.data.data.goods_id |
1797 | }) | 1328 | }) |
1798 | - | ||
1799 | this.sele_spec_chech_activity(); | 1329 | this.sele_spec_chech_activity(); |
1800 | 1330 | ||
1801 | } | 1331 | } |
@@ -2173,14 +1703,13 @@ Page({ | @@ -2173,14 +1703,13 @@ Page({ | ||
2173 | 1703 | ||
2174 | //-----图片失败,默认图片----- | 1704 | //-----图片失败,默认图片----- |
2175 | bind_bnerr2: function (e) { | 1705 | bind_bnerr2: function (e) { |
2176 | - | ||
2177 | var _errImg = e.target.dataset.errorimg; | 1706 | var _errImg = e.target.dataset.errorimg; |
2178 | var _errObj = {}; | 1707 | var _errObj = {}; |
2179 | _errObj[_errImg] = this.data.iurl + "/miniapp/images/hui_hear_pic.png" | 1708 | _errObj[_errImg] = this.data.iurl + "/miniapp/images/hui_hear_pic.png" |
2180 | this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; | 1709 | this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; |
2181 | }, | 1710 | }, |
2182 | 1711 | ||
2183 | - //----------装载同一条形码的商品---------- | 1712 | + //----------装载同一活动中的商品---------- |
2184 | async get_sku(stoid, gd, g_id, is_normal, func) { | 1713 | async get_sku(stoid, gd, g_id, is_normal, func) { |
2185 | var tt = this, arrdata = null; | 1714 | var tt = this, arrdata = null; |
2186 | var now = ut.gettimestamp(); | 1715 | var now = ut.gettimestamp(); |
@@ -2192,7 +1721,9 @@ Page({ | @@ -2192,7 +1721,9 @@ Page({ | ||
2192 | isonsale: 1, | 1721 | isonsale: 1, |
2193 | is_on_sale: 1, | 1722 | is_on_sale: 1, |
2194 | pageSize: 500, | 1723 | pageSize: 500, |
2195 | - orderField: 'sort' | 1724 | + orderField: 'sort', |
1725 | + prom_id:tt.data.presellForm.id, | ||
1726 | + prom_type:8, | ||
2196 | } | 1727 | } |
2197 | }).then(res => { | 1728 | }).then(res => { |
2198 | var e = res; | 1729 | var e = res; |
@@ -2234,7 +1765,6 @@ Page({ | @@ -2234,7 +1765,6 @@ Page({ | ||
2234 | if (res.data.code == 0) prom = res.data.data; | 1765 | if (res.data.code == 0) prom = res.data.data; |
2235 | }) | 1766 | }) |
2236 | break | 1767 | break |
2237 | - | ||
2238 | } | 1768 | } |
2239 | 1769 | ||
2240 | 1770 | ||
@@ -2314,43 +1844,8 @@ Page({ | @@ -2314,43 +1844,8 @@ Page({ | ||
2314 | gid: gid | 1844 | gid: gid |
2315 | }); | 1845 | }); |
2316 | 1846 | ||
2317 | - | ||
2318 | - | ||
2319 | - that.check_is_youhui(gid, that.data.is_normal); | ||
2320 | - | ||
2321 | - var ty = 0; | ||
2322 | - this.get_sto(that.data.is_normal); | ||
2323 | - | ||
2324 | - | ||
2325 | - //默认门店要拿下门店库存 | ||
2326 | - if (that.data.sales_rules == 2 && that.data.def_pick_store) { | ||
2327 | - var lock = 0, plist = null; | ||
2328 | - //先读取门店的lock,采用链式写法,少用await | ||
2329 | - getApp().request.promiseGet("/api/weshop/order/ware/lock/page", { | ||
2330 | - data: { store_id: os.stoid, wareId: ee.data.sele_g.goods_id, storageId: that.data.def_pick_store.pickup_id, pageSize: 1000 } | ||
2331 | - }).then(res => { | ||
2332 | - if (res.data.code == 0 && res.data.data.total > 0) { | ||
2333 | - for (var i in res.data.data.pageData) | ||
2334 | - lock += res.data.data.pageData[i].outQty | ||
2335 | - } | ||
2336 | - //---通过接口获取门店的线下库存信息-- | ||
2337 | - return getApp().request.promiseGet("/api/weshop/goods/getWareStorages", { | ||
2338 | - data: { storageNos: that.data.def_pick_store.pickup_no, wareIds: encodeURIComponent(th.data.sele_g.erpwareid), storeId: os.stoid } | ||
2339 | - }) | ||
2340 | - }).then(res => { | ||
2341 | - if (res.data.code == 0 && res.data.data.total > 0) { | ||
2342 | - plist = res.data.data.pageData[0]; | ||
2343 | - } | ||
2344 | - if (plist && plist.CanOutQty - lock > 0) { | ||
2345 | - that.data.def_pick_store.CanOutQty = plist.CanOutQty - lock; | ||
2346 | - } else { | ||
2347 | - that.data.def_pick_store.CanOutQty = 0; | ||
2348 | - } | ||
2349 | - //--给门店赋值线下库存-- | ||
2350 | - th.setData({ def_pick_store: that.data.def_pick_store }); | ||
2351 | - }) | ||
2352 | - } | ||
2353 | - | 1847 | + //that.check_is_youhui(gid, that.data.is_normal); |
1848 | + this.get_sto(); | ||
2354 | 1849 | ||
2355 | this.sele_spec_chech_activity(); | 1850 | this.sele_spec_chech_activity(); |
2356 | }, | 1851 | }, |
@@ -2415,8 +1910,7 @@ Page({ | @@ -2415,8 +1910,7 @@ Page({ | ||
2415 | 1910 | ||
2416 | //---------拿出门店分类和门店------------ | 1911 | //---------拿出门店分类和门店------------ |
2417 | get_sto(e) { | 1912 | get_sto(e) { |
2418 | - var th = this, that = this; | ||
2419 | - var is_normal = e; | 1913 | + var th = this,is_normal = e; |
2420 | 1914 | ||
2421 | if (e == 1) { | 1915 | if (e == 1) { |
2422 | th.setData({ is_normal: 1 }) | 1916 | th.setData({ is_normal: 1 }) |
@@ -2891,24 +2385,11 @@ Page({ | @@ -2891,24 +2385,11 @@ Page({ | ||
2891 | //加载更多是靠这个函数 | 2385 | //加载更多是靠这个函数 |
2892 | onReachBottom: function () { | 2386 | onReachBottom: function () { |
2893 | if (this.data.activeCategoryId == 2) { | 2387 | if (this.data.activeCategoryId == 2) { |
2894 | - if (!this.data.comments_no_more) this.requestComments_new(); | ||
2895 | - } | ||
2896 | - | ||
2897 | - var goods_list = this.selectComponent("#goods_list"); //组件的id | ||
2898 | - if (goods_list) goods_list.get_list(); | ||
2899 | - }, | ||
2900 | - | ||
2901 | - //--------检查是否活动,活动是否开始,或者是否结束------- | ||
2902 | - async check_prom(gid, prom_type, prom_id) { | ||
2903 | - var ee = this, | ||
2904 | - th = ee; | ||
2905 | - if (prom_type == 3 || prom_type == 0 || prom_type == 2 || prom_type == 5 || prom_type == 7) { | ||
2906 | - this.setData({ | ||
2907 | - prom_type: 0, | ||
2908 | - isshow: 1, | ||
2909 | - }); | ||
2910 | - return false; | ||
2911 | - } | 2388 | + if (!this.data.comments_no_more) this.requestComments_new(); |
2389 | + } | ||
2390 | + | ||
2391 | + var goods_list = this.selectComponent("#goods_list"); //组件的id | ||
2392 | + if (goods_list) goods_list.get_list(); | ||
2912 | }, | 2393 | }, |
2913 | 2394 | ||
2914 | //--获取有多少人在开团-- | 2395 | //--获取有多少人在开团-- |
@@ -3107,213 +2588,6 @@ Page({ | @@ -3107,213 +2588,6 @@ Page({ | ||
3107 | }); | 2588 | }); |
3108 | }, | 2589 | }, |
3109 | 2590 | ||
3110 | - //--------拼团玩法显示详情-------- | ||
3111 | - show_pt_xx: function (e) { | ||
3112 | - this.setData({ | ||
3113 | - pd_xx: 1, | ||
3114 | - }) | ||
3115 | - }, | ||
3116 | - close_pt_xx: function () { | ||
3117 | - this.setData({ | ||
3118 | - pd_xx: 0, | ||
3119 | - }) | ||
3120 | - }, | ||
3121 | - | ||
3122 | - | ||
3123 | - //-----------------拼单生成方法--------------------- | ||
3124 | - addCart_pt: function () { | ||
3125 | - var th = this; | ||
3126 | - if (this.data.is_normal == 0) { | ||
3127 | - //看一下有没有起购数,如果有起购数,要计算起购数 | ||
3128 | - var qnum = parseFloat(th.data.prom_act.minbuynum); | ||
3129 | - if (qnum > 0 && th.data.goodsInputNum < qnum) { | ||
3130 | - getApp().confirmBox("拼团商品至少要买" + qnum + "件!"); | ||
3131 | - return false; | ||
3132 | - } | ||
3133 | - | ||
3134 | - th.addcart_pt_func(); | ||
3135 | - } else { | ||
3136 | - th.addcart_pt_func(); | ||
3137 | - } | ||
3138 | - }, | ||
3139 | - | ||
3140 | - addcart_pt_func: function () { | ||
3141 | - if (oo.user_id == null) { | ||
3142 | - s.my_warnning("还未登录!", 0, this); | ||
3143 | - return; | ||
3144 | - } | ||
3145 | - var e = this, | ||
3146 | - th = e, | ||
3147 | - o = this.data.sele_g; | ||
3148 | - if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th); | ||
3149 | - | ||
3150 | - //----------添加到购物车时,要判断限购数量,-------- | ||
3151 | - e.get_buy_num(o, async function (ee) { | ||
3152 | - | ||
3153 | - //---判断商品是否超出限购--- | ||
3154 | - if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) { | ||
3155 | - if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id) > th.data.sele_g.viplimited) { | ||
3156 | - wx.showModal({ | ||
3157 | - title: '提示', | ||
3158 | - content: '超出商品限购' | ||
3159 | - }); | ||
3160 | - | ||
3161 | - var num = th.data.prom_buy_limit - th.data.prom_buy_num; | ||
3162 | - if (num < 0) num = 0; | ||
3163 | - th.setData({ goodsInputNum: num }) | ||
3164 | - return false; | ||
3165 | - } | ||
3166 | - } | ||
3167 | - //---判断商品是否超出活动限购,拼团的普通购买不计算活动的限购--- | ||
3168 | - if (th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0 && th.data.is_normal != 1) { | ||
3169 | - if (th.data.goodsInputNum + th.data.prom_buy_num > th.data.prom_buy_limit) { | ||
3170 | - wx.showModal({ | ||
3171 | - title: '提示', | ||
3172 | - content: '超出商品活动限购' | ||
3173 | - }); | ||
3174 | - | ||
3175 | - var num = th.data.prom_buy_limit - th.data.prom_buy_num; | ||
3176 | - if (num < 0) num = 0; | ||
3177 | - th.setData({ goodsInputNum: num }) | ||
3178 | - return false; | ||
3179 | - } | ||
3180 | - } | ||
3181 | - | ||
3182 | - var redis_num = 0 | ||
3183 | - //不是普通购买的时候 | ||
3184 | - if (th.data.is_normal != 1) { | ||
3185 | - //-------判断活动是否抢光--------- | ||
3186 | - await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/6/" + th.data.sele_g.prom_id, { | ||
3187 | - 1: 1 | ||
3188 | - }).then(res => { | ||
3189 | - redis_num = res.data.data; | ||
3190 | - }) | ||
3191 | - | ||
3192 | - if (th.data.goodsInputNum > redis_num) { | ||
3193 | - wx.showModal({ | ||
3194 | - title: '提示', | ||
3195 | - content: '超出商品活动库存' | ||
3196 | - }); | ||
3197 | - | ||
3198 | - th.setData({ goodsInputNum: redis_num }) | ||
3199 | - | ||
3200 | - return false; | ||
3201 | - } | ||
3202 | - } | ||
3203 | - | ||
3204 | - if (th.data.goodsInputNum <= 0) return s.my_warnning("商品数量不能为0", 0, th); | ||
3205 | - if (th.data.goodsInputNum > o.store_count) { | ||
3206 | - th.setData({ goodsInputNum: o.store_count }) | ||
3207 | - return s.my_warnning("超出商品库存", 0, th); | ||
3208 | - } | ||
3209 | - | ||
3210 | - if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined) | ||
3211 | - this.setData({ | ||
3212 | - sto_sele_name: "" | ||
3213 | - }); | ||
3214 | - if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th); | ||
3215 | - //--------------此时操作的数据------------ | ||
3216 | - var newd = { | ||
3217 | - goods_id: o.goods_id, | ||
3218 | - goods_num: th.data.goodsInputNum, | ||
3219 | - pick_id: th.data.sto_sele_id, | ||
3220 | - user_id: oo.user_id, | ||
3221 | - store_id: th.data.stoid, | ||
3222 | - goods_price: o.shop_price, | ||
3223 | - goods_name: o.goods_name, | ||
3224 | - goods_sn: o.goods_sn, | ||
3225 | - sku: o.sku, | ||
3226 | - }; | ||
3227 | - | ||
3228 | - //---是不是从收藏夹出来的--- | ||
3229 | - if (th.data.c_guide_id) { | ||
3230 | - newd['guide_id'] = th.data.c_guide_id; | ||
3231 | - newd['guide_type'] = 2; | ||
3232 | - | ||
3233 | - } else { | ||
3234 | - if (getApp().globalData.guide_id) { | ||
3235 | - newd['guide_id'] = getApp().globalData.guide_id; | ||
3236 | - newd['guide_type'] = 0; | ||
3237 | - | ||
3238 | - } | ||
3239 | - } | ||
3240 | - | ||
3241 | - //让商品带上房间号 | ||
3242 | - if (th.data.sys_switch.is_skuroom_id == 1) { | ||
3243 | - if (th.data.data.goods_id == getApp().globalData.room_goods_id) { | ||
3244 | - newd.room_id = getApp().globalData.room_id; | ||
3245 | - } | ||
3246 | - } else { | ||
3247 | - if (newd.goods_id == getApp().globalData.room_goods_id) { | ||
3248 | - newd.room_id = getApp().globalData.room_id; | ||
3249 | - } | ||
3250 | - } | ||
3251 | - | ||
3252 | - //---如果商品不是积分购和拼团,要判断一个是否要进行等级价的判断------ | ||
3253 | - | ||
3254 | - if (th.data.is_normal == 1) { | ||
3255 | - var conf = th.data.bconfig; | ||
3256 | - if (conf.switch_list) { | ||
3257 | - var s_list = JSON.parse(conf.switch_list); | ||
3258 | - //如果后台有开启等级价的功能 | ||
3259 | - if (parseInt(s_list.rank_switch) == 2) { | ||
3260 | - var card_price = o[getApp().globalData.userInfo['card_field']]; | ||
3261 | - //如果会员有等级价 | ||
3262 | - if (getApp().globalData.userInfo['card_field'] != undefined && getApp().globalData.userInfo['card_field'] != null | ||
3263 | - && getApp().globalData.userInfo['card_field'] != "" && card_price > 0) { | ||
3264 | - newd.goods_price = card_price; | ||
3265 | - } | ||
3266 | - } | ||
3267 | - } | ||
3268 | - } | ||
3269 | - | ||
3270 | - | ||
3271 | - //-----如果是秒杀,团购,积分购,拼团,且不是普通购买----- | ||
3272 | - if (th.data.prom_type == 6 && th.data.is_normal != 1) { | ||
3273 | - newd.goods_price = th.data.prom_price; | ||
3274 | - newd.prom_type = th.data.prom_type; | ||
3275 | - newd.prom_id = th.data.prom_id; | ||
3276 | - newd.kt_type = th.data.prom_act.kttype; //开团类型 | ||
3277 | - newd.is_pt_tz = 0; | ||
3278 | - //th.data.sto_sele_distr=1; //直接用自提的方式提交 | ||
3279 | - if (newd.kt_type > 1) { | ||
3280 | - newd.is_pt_tz = 1; //开团类型 | ||
3281 | - } | ||
3282 | - if (newd.kt_type == 3) { | ||
3283 | - th.data.sto_sele_distr = 1; | ||
3284 | - } | ||
3285 | - | ||
3286 | - } else if (th.data.prom_type == 3) { | ||
3287 | - newd.prom_type = 0; | ||
3288 | - newd.prom_id = 0; | ||
3289 | - } | ||
3290 | - | ||
3291 | - newd['pick_name'] = th.data.sto_sele_name; | ||
3292 | - newd['pick_dis'] = th.data.sto_sele_distr; | ||
3293 | - newd['is_normal'] = th.data.is_normal; | ||
3294 | - | ||
3295 | - if (newd['is_normal']) { | ||
3296 | - newd['is_pd_normal'] = 1; | ||
3297 | - //判断一下有没有全局优惠活动 | ||
3298 | - th.check_nor_promgood(newd.goods_id, function (e) { | ||
3299 | - if (e && e.act_id) { | ||
3300 | - newd['prom_type'] = 3; | ||
3301 | - newd['prom_id'] = e.act_id; | ||
3302 | - } | ||
3303 | - th.buyNow(newd) | ||
3304 | - }) | ||
3305 | - } | ||
3306 | - else th.buyNow_pt(newd); | ||
3307 | - }) | ||
3308 | - }, | ||
3309 | - //----------立即购买_pt----------- | ||
3310 | - buyNow_pt: function (e) { | ||
3311 | - s.set_b_now(e); | ||
3312 | - wx.navigateTo({ | ||
3313 | - url: "/pages/cart/cart2_pt/cart2_pt?is_bnow=1&goods_id=" + e.goods_id, | ||
3314 | - }); | ||
3315 | - }, | ||
3316 | - | ||
3317 | //-------跳转pt商品------- | 2591 | //-------跳转pt商品------- |
3318 | go_to_nopay: function () { | 2592 | go_to_nopay: function () { |
3319 | var th = this; | 2593 | var th = this; |
@@ -3338,7 +2612,7 @@ Page({ | @@ -3338,7 +2612,7 @@ Page({ | ||
3338 | 2612 | ||
3339 | }, | 2613 | }, |
3340 | 2614 | ||
3341 | - //---拼团倒计时--- | 2615 | + //---倒计时--- |
3342 | countDown2() { | 2616 | countDown2() { |
3343 | if (!this.data.is_timer) return false; | 2617 | if (!this.data.is_timer) return false; |
3344 | var th = this; | 2618 | var th = this; |
@@ -3379,77 +2653,6 @@ Page({ | @@ -3379,77 +2653,6 @@ Page({ | ||
3379 | } | 2653 | } |
3380 | setTimeout(th.countDown2, 1000); | 2654 | setTimeout(th.countDown2, 1000); |
3381 | }, | 2655 | }, |
3382 | - //跳转参加团 | ||
3383 | - go_cj_team: function (e) { | ||
3384 | - var ind = e.currentTarget.dataset.ind; | ||
3385 | - var item = this.data.teamgroup[ind]; | ||
3386 | - var id = item.id; | ||
3387 | - var th = this; | ||
3388 | - | ||
3389 | - getApp().request.get("/api/weshop/order/page", { | ||
3390 | - data: { | ||
3391 | - pt_prom_id: item.team_id, | ||
3392 | - user_id: oo.user_id, | ||
3393 | - store_id: os.stoid, | ||
3394 | - pageSize: 1, | ||
3395 | - page: 1 | ||
3396 | - }, | ||
3397 | - success: function (e) { | ||
3398 | - if (e.data.code != 0) { | ||
3399 | - getApp().my_warnning("读取订单失败", 0, th); | ||
3400 | - return fasle; | ||
3401 | - } | ||
3402 | - //--跳转到已经购买的情况-- | ||
3403 | - if (e.data.data.pageData.length > 0) { | ||
3404 | - var odr = e.data.data.pageData[0]; | ||
3405 | - //还未支付 | ||
3406 | - if (odr.pt_status == 0 && (odr.order_status == 1 || odr.order_status == 0)) { | ||
3407 | - wx.showModal({ | ||
3408 | - title: "您已经购买了该商品待支付中", | ||
3409 | - success: function (a) { | ||
3410 | - if (a.confirm) { | ||
3411 | - wx.navigateTo({ | ||
3412 | - url: "/pages/user/order_detail/order_detail?order_id=" + odr.order_id, | ||
3413 | - }); | ||
3414 | - } | ||
3415 | - } | ||
3416 | - }); | ||
3417 | - } else if (odr.pt_status == 1 && odr.order_status == 1) { | ||
3418 | - | ||
3419 | - if (this.data.is_go_to_team_show) return false; | ||
3420 | - this.data.is_go_to_team_show = 1; | ||
3421 | - wx.showLoading(); | ||
3422 | - /*-- | ||
3423 | - wx.redirectTo({ | ||
3424 | - url: "/pages/team/team_success/team_success?ordersn=" + odr.order_sn, | ||
3425 | - });--*/ | ||
3426 | - | ||
3427 | - getApp().goto("/pages/team/team_success/team_success?ordersn=" + odr.order_sn); | ||
3428 | - | ||
3429 | - } else { | ||
3430 | - wx.navigateTo({ | ||
3431 | - url: "/pages/team/team_show/team_show?tg_id=" + id, | ||
3432 | - }); | ||
3433 | - } | ||
3434 | - } | ||
3435 | - //--跳转到参团-- | ||
3436 | - else { | ||
3437 | - wx.navigateTo({ | ||
3438 | - url: "/pages/team/team_show/team_show?tg_id=" + id, | ||
3439 | - }); | ||
3440 | - } | ||
3441 | - } | ||
3442 | - }) | ||
3443 | - | ||
3444 | - }, | ||
3445 | - | ||
3446 | - //跳到团更多 | ||
3447 | - go_t_more: function () { | ||
3448 | - var team_id = this.data.prom_id; | ||
3449 | - wx.navigateTo({ | ||
3450 | - url: "/pages/team/team_more/team_more?team_id=" + team_id, | ||
3451 | - }); | ||
3452 | - }, | ||
3453 | 2656 | ||
3454 | //--点赞功能-- | 2657 | //--点赞功能-- |
3455 | click_zan: function (e) { | 2658 | click_zan: function (e) { |
@@ -3877,8 +3080,6 @@ Page({ | @@ -3877,8 +3080,6 @@ Page({ | ||
3877 | context.setFontSize(22 * unit) | 3080 | context.setFontSize(22 * unit) |
3878 | context.fillText("长按识别二维码", 40 * unit, 806 * unit); | 3081 | context.fillText("长按识别二维码", 40 * unit, 806 * unit); |
3879 | context.fillText("立即开始兑换", 40 * unit, 846 * unit); | 3082 | context.fillText("立即开始兑换", 40 * unit, 846 * unit); |
3880 | - | ||
3881 | - | ||
3882 | } | 3083 | } |
3883 | 3084 | ||
3884 | //---二维吗图--- | 3085 | //---二维吗图--- |
@@ -4822,56 +4023,6 @@ Page({ | @@ -4822,56 +4023,6 @@ Page({ | ||
4822 | wx.navigateTo({ url: url, }) | 4023 | wx.navigateTo({ url: url, }) |
4823 | }, | 4024 | }, |
4824 | 4025 | ||
4825 | - //---检查有没有优惠活动--- | ||
4826 | - check_is_youhui: function (gid, is_nor) { | ||
4827 | - var th = this; | ||
4828 | - //如果是普通购买的时候,要进行调用 | ||
4829 | - if (is_nor) { | ||
4830 | - getApp().request.get("/api/weshop/goods/getGoodsPromNormal/" + os.stoid + "/" + gid, { | ||
4831 | - success: function (res) { | ||
4832 | - if (res.data.code == 0) { | ||
4833 | - var r_data = res.data.data; | ||
4834 | - th.setData({ | ||
4835 | - prom_goods: r_data.promGoodsLists, | ||
4836 | - }) | ||
4837 | - th.is_show_more_buy(); | ||
4838 | - } | ||
4839 | - }, | ||
4840 | - }) | ||
4841 | - | ||
4842 | - } else { | ||
4843 | - //调用接口判断订单优惠, | ||
4844 | - getApp().request.get("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + gid + "/0", { | ||
4845 | - success: function (res) { | ||
4846 | - if (res.data.code == 0) { | ||
4847 | - var r_data = res.data.data; | ||
4848 | - var max = 0, min = 0; | ||
4849 | - if (r_data.collocationList) { | ||
4850 | - for (var i in r_data.collocationList) { | ||
4851 | - if (max == 0) max = r_data.collocationList[i].price; | ||
4852 | - if (min == 0) min = r_data.collocationList[i].price; | ||
4853 | - | ||
4854 | - if (max < parseFloat(r_data.collocationList[i].price)) max = r_data.collocationList[i].price; | ||
4855 | - if (min > parseFloat(r_data.collocationList[i].price)) min = r_data.collocationList[i].price; | ||
4856 | - } | ||
4857 | - r_data.collocationPromList.max = (max + th.data.data.shop_price).toFixed(2); | ||
4858 | - r_data.collocationPromList.min = (min + th.data.data.shop_price).toFixed(2); | ||
4859 | - } | ||
4860 | - th.setData({ | ||
4861 | - order_prom: r_data.promOrder, | ||
4862 | - collocationGoods: r_data.collocationPromList, | ||
4863 | - prom_goods: r_data.promGoodsLists, | ||
4864 | - }) | ||
4865 | - th.is_show_more_buy(); | ||
4866 | - } | ||
4867 | - } | ||
4868 | - | ||
4869 | - }) | ||
4870 | - } | ||
4871 | - | ||
4872 | - | ||
4873 | - }, | ||
4874 | - | ||
4875 | closePoster() { | 4026 | closePoster() { |
4876 | this.setData({ | 4027 | this.setData({ |
4877 | showPoster: false, | 4028 | showPoster: false, |
@@ -5014,29 +4165,6 @@ Page({ | @@ -5014,29 +4165,6 @@ Page({ | ||
5014 | 4165 | ||
5015 | }, | 4166 | }, |
5016 | 4167 | ||
5017 | - //-- 积分购 -- | ||
5018 | - go_pay_integral: function () { | ||
5019 | - this.get_sto(0) | ||
5020 | - this.setData({ openSpecModal_inte: 1, goodsInputNum: 1 }); | ||
5021 | - }, | ||
5022 | - //-- 积分购普通购买 -- | ||
5023 | - go_pay_integral_normal: function () { | ||
5024 | - var th = this; | ||
5025 | - if (th.data.sku_g_pt) { | ||
5026 | - this.get_sto(1) | ||
5027 | - this.setData({ openSpecModal_inte_normal: 1 }); | ||
5028 | - } else { | ||
5029 | - th.get_sto(1); | ||
5030 | - th.get_sku(o.stoid, th.data.data, th.data.gid, 1, function () { | ||
5031 | - th.setData({ | ||
5032 | - is_normal: 1, | ||
5033 | - openSpecModal_inte_normal: 1 | ||
5034 | - }); | ||
5035 | - }); | ||
5036 | - } | ||
5037 | - this.check_is_youhui(th.data.gid, 1); | ||
5038 | - }, | ||
5039 | - | ||
5040 | closeSpecModal_inte: function () { | 4168 | closeSpecModal_inte: function () { |
5041 | this.setData({ openSpecModal_inte: 0 }); | 4169 | this.setData({ openSpecModal_inte: 0 }); |
5042 | }, | 4170 | }, |
@@ -5053,97 +4181,100 @@ Page({ | @@ -5053,97 +4181,100 @@ Page({ | ||
5053 | }, | 4181 | }, |
5054 | 4182 | ||
5055 | addCart_inte: function (t) { | 4183 | addCart_inte: function (t) { |
5056 | - this.add_cart_func_inte(t); | ||
5057 | - }, | ||
5058 | - | ||
5059 | - | ||
5060 | - | ||
5061 | - | ||
5062 | - onShareTimeline() { | ||
5063 | - var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : ''; | ||
5064 | - if (!store_name) | ||
5065 | - store_name = getApp().globalData.setting.appName; | ||
5066 | - return { | ||
5067 | - title: this.data.data.goods_name + '-' + store_name, | ||
5068 | - imageUrl: this.data.gallery[0].image_url, | ||
5069 | - } | 4184 | + this.add_cart_func_inte(t); |
5070 | }, | 4185 | }, |
5071 | 4186 | ||
5072 | 4187 | ||
5073 | - clickCollapse() { | ||
5074 | - this.setData({ | ||
5075 | - flag: !this.data.flag, | ||
5076 | - }) | ||
5077 | - }, | 4188 | + onShareTimeline() { |
4189 | + var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : ''; | ||
4190 | + if (!store_name) | ||
4191 | + store_name = getApp().globalData.setting.appName; | ||
4192 | + return { | ||
4193 | + title: this.data.data.goods_name + '-' + store_name, | ||
4194 | + imageUrl: this.data.gallery[0].image_url, | ||
4195 | + } | ||
4196 | + }, | ||
5078 | 4197 | ||
5079 | - clickShare() { | ||
5080 | - this.setData({ | ||
5081 | - share_hidden: true, | ||
5082 | - }); | ||
5083 | - }, | 4198 | + clickCollapse() { |
4199 | + this.setData({flag: !this.data.flag,}) | ||
4200 | + }, | ||
5084 | 4201 | ||
5085 | - send() { | ||
5086 | - this.setData({ | ||
5087 | - share_hidden: false, | ||
5088 | - }); | ||
5089 | - }, | 4202 | + clickShare() { |
4203 | + this.setData({share_hidden: true,}); | ||
4204 | + }, | ||
5090 | 4205 | ||
5091 | - cancel() { | ||
5092 | - this.setData({ | ||
5093 | - share_hidden: false, | ||
5094 | - }); | ||
5095 | - }, | 4206 | + send() { |
4207 | + this.setData({share_hidden: false,}); | ||
4208 | + }, | ||
5096 | 4209 | ||
5097 | - //积分购和拼团的普通购买的的时候,要判断有没有全场优惠活动 | ||
5098 | - check_nor_promgood(goods_id, back) { | ||
5099 | - getApp().request.get("/api/weshop/goods/getGoodsPromNormal/" + os.stoid + "/" + goods_id, { | ||
5100 | - success: function (res) { | ||
5101 | - if (res.data.code == 0 && res.data.data && res.data.data.promGoodsLists && res.data.data.promGoodsLists.length > 0) { | ||
5102 | - var obj = { | ||
5103 | - act_id: res.data.data.promGoodsLists[0].prom_id, | ||
5104 | - } | ||
5105 | - back(obj); | ||
5106 | - } else { | ||
5107 | - back(0) | ||
5108 | - } | ||
5109 | - } | ||
5110 | - }) | ||
5111 | - }, | 4210 | + cancel() { |
4211 | + this.setData({ | ||
4212 | + share_hidden: false, | ||
4213 | + }); | ||
4214 | + }, | ||
5112 | 4215 | ||
5113 | - go_zh: function (e) { | ||
5114 | - var id = e.currentTarget.dataset.id; | ||
5115 | - getApp().goto("/packageB/pages/zuhegou/index/index?id=" + id); | ||
5116 | - }, | 4216 | + //积分购和拼团的普通购买的的时候,要判断有没有全场优惠活动 |
4217 | + check_nor_promgood(goods_id, back) { | ||
4218 | + getApp().request.get("/api/weshop/goods/getGoodsPromNormal/" + os.stoid + "/" + goods_id, { | ||
4219 | + success: function (res) { | ||
4220 | + if (res.data.code == 0 && res.data.data && res.data.data.promGoodsLists && res.data.data.promGoodsLists.length > 0) { | ||
4221 | + var obj = { | ||
4222 | + act_id: res.data.data.promGoodsLists[0].prom_id, | ||
4223 | + } | ||
4224 | + back(obj); | ||
4225 | + } else { | ||
4226 | + back(0) | ||
4227 | + } | ||
4228 | + } | ||
4229 | + }) | ||
4230 | + }, | ||
5117 | 4231 | ||
5118 | - check_zh_acting: function (func) { | ||
5119 | - var isok = 1, item = this.data.sele_g; | ||
5120 | - //如果有组合购 | ||
5121 | - var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + item.prom_id + "/" + getApp().globalData.userInfo.user_id; | ||
5122 | - getApp().request.promiseGet(url, {}).then(res => { | ||
5123 | - if (res.data.code == 0 && res.data.data) { | ||
5124 | - if (res.data.data.is_show != 1) { | ||
5125 | - isok = 0; | 4232 | + async get_pre_prom(func){ |
4233 | + var th = this; | ||
4234 | + var presell_id = null; | ||
4235 | + var pre_arr = null; | ||
4236 | + //------获取预售从表---------- | ||
4237 | + await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/get/" + os.stoid + "/" + th.data.pre_id, {}).then(res => { | ||
4238 | + if (res.data.code == 0 && res.data.data) { | ||
4239 | + var arr = res.data.data; | ||
4240 | + presell_id = arr.presell_id; | ||
4241 | + th.setData({ | ||
4242 | + presellList: arr, | ||
4243 | + }) | ||
4244 | + } | ||
4245 | + }) | ||
4246 | + if (!presell_id) { | ||
4247 | + wx.showToast({title: "未找到活动商品", icon: 'none', duration: 3000}) | ||
4248 | + return false; | ||
5126 | } | 4249 | } |
5127 | - //如果活动已经结束 | ||
5128 | - if (res.data.data.is_end == 1) { | ||
5129 | - isok = 0; | 4250 | + //------获取预售主表---------- |
4251 | + await getApp().request.promiseGet(`/api/weshop/marketing/marketingPresellForm/get/${os.stoid}/${presell_id}`, {}).then(res => { | ||
4252 | + if (res.data.code == 0 && res.data.data) { | ||
4253 | + th.setData({ | ||
4254 | + presellForm: res.data.data, | ||
4255 | + }); | ||
4256 | + th.countDown(res.data.data.end_time) | ||
4257 | + } | ||
4258 | + }) | ||
4259 | + var userInfo = getApp().globalData.userInfo; | ||
4260 | + var pre_data = {store_id: os.stoid, is_end: 0, timetype: 1, isuse: 1, goods_id: th.data.gid}; | ||
4261 | + if (userInfo) { | ||
4262 | + pre_data.user_id = userInfo.user_id; | ||
5130 | } | 4263 | } |
5131 | - //已经结束 | ||
5132 | - if (ut.gettimestamp() > res.data.data.end_time) { | ||
5133 | - isok = 0; | 4264 | + await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/page", { |
4265 | + data: pre_data, | ||
4266 | + }).then(e => { | ||
4267 | + if (e.data.code == 0 && e.data.data.pageData && e.data.data.pageData.length > 0) { | ||
4268 | + pre_arr = e.data.data.pageData[0]; | ||
4269 | + th.setData({pre_arr: pre_arr}) | ||
4270 | + } | ||
4271 | + }) | ||
4272 | + if (!pre_arr) { | ||
4273 | + wx.showToast({title: "当前会员身份不符,无法参与", icon: 'none', duration: 3000}) | ||
5134 | } | 4274 | } |
5135 | - //还未开始 | ||
5136 | - if (ut.gettimestamp() < res.data.data.start_time) { | ||
5137 | - isok = 0; | 4275 | + if (func) { |
4276 | + func(); | ||
5138 | } | 4277 | } |
5139 | - | ||
5140 | - } else { | ||
5141 | - //未找到商品的活动 | ||
5142 | - isok = 0; | ||
5143 | - } | ||
5144 | - item.act = res.data.data; | ||
5145 | - func(isok); | ||
5146 | - }) | ||
5147 | - } | 4278 | + } |
5148 | 4279 | ||
5149 | }); | 4280 | }); |
packageC/pages/presell/goodsInfo/goodsInfo.wxml
@@ -151,7 +151,7 @@ | @@ -151,7 +151,7 @@ | ||
151 | </view> | 151 | </view> |
152 | <block wx:else> | 152 | <block wx:else> |
153 | <view class="no_store" wx:if="{{def_pick_store && def_pick_store.is_no_dis}}"> | 153 | <view class="no_store" wx:if="{{def_pick_store && def_pick_store.is_no_dis}}"> |
154 | - (配送不匹配) | 154 | + (配送不匹配2) |
155 | </view> | 155 | </view> |
156 | <view class="no_store" wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules==2 && prom_type==0}}"> | 156 | <view class="no_store" wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules==2 && prom_type==0}}"> |
157 | (库存不足) | 157 | (库存不足) |
@@ -494,10 +494,8 @@ | @@ -494,10 +494,8 @@ | ||
494 | <view>购物车</view> | 494 | <view>购物车</view> |
495 | </navigator> | 495 | </navigator> |
496 | </view> | 496 | </view> |
497 | - <view bindtap="openSpecModel" class="buy-btn cart-btn cart-btn-lg" wx:if="{{data.goods.is_virtual}}"> | ||
498 | - 立即购买 | ||
499 | - </view> | ||
500 | - <view class="fs24 f1 flex ai-center bg-FF4732 t-c white"> | 497 | + |
498 | + <view class="fs24 f1 flex ai-center bg-FF4732 t-c white" style="border-radius:10rpx "> | ||
501 | <view class="pdh20"> | 499 | <view class="pdh20"> |
502 | <view class="">{{filters.format_time(presellForm.end_time,2)}} 预售结束</view> | 500 | <view class="">{{filters.format_time(presellForm.end_time,2)}} 预售结束</view> |
503 | <!-- <view class="">08.30 23:59:59 开始发货</view> --> | 501 | <!-- <view class="">08.30 23:59:59 开始发货</view> --> |
@@ -527,20 +525,13 @@ | @@ -527,20 +525,13 @@ | ||
527 | <view class="spec-goods-info"> | 525 | <view class="spec-goods-info"> |
528 | <view class="spec-goods-name ellipsis-2">{{sele_g.goods_name}}</view> | 526 | <view class="spec-goods-name ellipsis-2">{{sele_g.goods_name}}</view> |
529 | <view class="flex ai_end xc-val-money"> | 527 | <view class="flex ai_end xc-val-money"> |
530 | - <view class="spec-goods-price" wx:if="{{prom_price==null}}"> | ||
531 | - <text class="fs20">¥</text> | ||
532 | - <!-- 如果是等级会员,且有等级价 --> | ||
533 | - <block wx:if="{{card_field && sele_g[card_field]>0}}">{{sele_g[card_field]}}</block> | ||
534 | - <block wx:else>{{sele_g.shop_price}}</block> | ||
535 | - </view> | ||
536 | - <view class="spec-goods-price tag" wx:else> | ||
537 | - <text class="fs20">¥</text> | ||
538 | - {{prom_price}} | 528 | + |
529 | + <view class="spec-goods-price tag"> | ||
530 | + <text class="fs20">¥</text>{{presellList.presell_money}} | ||
539 | </view> | 531 | </view> |
540 | <!-- 显示线下价格 --> | 532 | <!-- 显示线下价格 --> |
541 | <view wx:if="{{sele_g.offline_price}}" class="quan_price flex ai-center jc-center"> | 533 | <view wx:if="{{sele_g.offline_price}}" class="quan_price flex ai-center jc-center"> |
542 | - 券后¥ | ||
543 | - <text class="fs32">{{sele_g.offline_price}}</text> | 534 | + 券后¥<text class="fs32">{{sele_g.offline_price}}</text> |
544 | </view> | 535 | </view> |
545 | </view> | 536 | </view> |
546 | <block wx:if="{{prom_type==0}}"> | 537 | <block wx:if="{{prom_type==0}}"> |
@@ -589,7 +580,7 @@ | @@ -589,7 +580,7 @@ | ||
589 | <block wx:else> | 580 | <block wx:else> |
590 | <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view> | 581 | <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view> |
591 | <block wx:else> | 582 | <block wx:else> |
592 | - <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view> | 583 | + <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配1)</view> |
593 | <view wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules==2 && prom_type==0}}"> | 584 | <view wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules==2 && prom_type==0}}"> |
594 | (库存不足) | 585 | (库存不足) |
595 | </view> | 586 | </view> |
@@ -631,27 +622,21 @@ | @@ -631,27 +622,21 @@ | ||
631 | </view> | 622 | </view> |
632 | </view> | 623 | </view> |
633 | <view class="spec-cart-btns"> | 624 | <view class="spec-cart-btns"> |
634 | - <view wx:if="{{def_pick_store && def_pick_store.is_no_dis}}" class="spec-cart-btn fs32" data-action="add" style="background-color:#FF4835;color:white;" bindtap="addCart" data-openSpecModal_ind="{{openSpecModal_ind}}" data-action="buy"> | ||
635 | - 支付定金(¥9.9) | 625 | + <view wx:if="{{def_pick_store && def_pick_store.is_no_dis}}" class="spec-cart-btn fs32" data-action="add" > |
626 | + 门店的不匹配 | ||
636 | </view> | 627 | </view> |
637 | <block wx:else> | 628 | <block wx:else> |
638 | <!-- 根本就找不到门店 --> | 629 | <!-- 根本就找不到门店 --> |
639 | <block wx:if="{{!only_pk && !def_pickpu_list}}"> | 630 | <block wx:if="{{!only_pk && !def_pickpu_list}}"> |
640 | - <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;"> | ||
641 | - 库存不足 | ||
642 | - </view> | 631 | + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">未找到门店</view> |
643 | </block> | 632 | </block> |
644 | <block wx:else> | 633 | <block wx:else> |
645 | <block wx:if="{{only_pk.length && !only_pk.length}}"> | 634 | <block wx:if="{{only_pk.length && !only_pk.length}}"> |
646 | - <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;"> | ||
647 | - 库存不足 | ||
648 | - </view> | 635 | + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999;">未找到门店</view> |
649 | </block> | 636 | </block> |
650 | <block wx:else> | 637 | <block wx:else> |
651 | <block wx:if="{{def_pickpu_list && !def_pickpu_list.length}}"> | 638 | <block wx:if="{{def_pickpu_list && !def_pickpu_list.length}}"> |
652 | - <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999"> | ||
653 | - 库存不足 | ||
654 | - </view> | 639 | + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">未找到门店</view> |
655 | </block> | 640 | </block> |
656 | <block wx:else> | 641 | <block wx:else> |
657 | <block wx:if="{{!def_pick_store}}"> | 642 | <block wx:if="{{!def_pick_store}}"> |
@@ -660,44 +645,26 @@ | @@ -660,44 +645,26 @@ | ||
660 | </view> | 645 | </view> |
661 | </block> | 646 | </block> |
662 | <block wx:else> | 647 | <block wx:else> |
663 | - <!-- 如果是线下库存购买的时候,且是普通商品购买的时候 --> | ||
664 | - <block wx:if="{{sales_rules==2 && prom_type==0}}"> | ||
665 | - <block wx:if="{{!def_pick_store.CanOutQty}}"> | ||
666 | - <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999"> | ||
667 | - 库存不足 | ||
668 | - </view> | ||
669 | - </block> | ||
670 | - <block wx:else> | ||
671 | - <view wx:if="{{openSpecModal_ind==1}}" bindtap="addCart" data-openSpecModal_ind="{{openSpecModal_ind}}" class="spec-cart-btn yellow fs32" data-action="add"> | ||
672 | - 加入购物车 | ||
673 | - </view> | ||
674 | - <view wx:if="{{openSpecModal_ind==2}}" bindtap="addCart" data-openSpecModal_ind="{{openSpecModal_ind}}" class="spec-cart-btn spec-buy" data-action="buy"> | ||
675 | - {{sele_g.offline_price?"券后购买":"立即购买"}} | ||
676 | - </view> | ||
677 | - </block> | ||
678 | - </block> | ||
679 | - <!-- 线上销售 --> | ||
680 | - <block wx:else> | 648 | + |
649 | + <!-- 线上销售 --> | ||
681 | <block wx:if="{{sele_g.store_count<=0}}"> | 650 | <block wx:if="{{sele_g.store_count<=0}}"> |
682 | - <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999"> | ||
683 | - 库存不足 | ||
684 | - </view> | 651 | + <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">库存不足</view> |
685 | </block> | 652 | </block> |
686 | <block wx:else> | 653 | <block wx:else> |
687 | - <view wx:if="{{openSpecModal_ind==1}}" bindtap="addCart" data-openSpecModal_ind="{{openSpecModal_ind}}" class="spec-cart-btn yellow fs32" data-action="add"> | ||
688 | - 加入购物车 | ||
689 | - </view> | ||
690 | - <view wx:if="{{openSpecModal_ind==2}}" bindtap="addCart" data-openSpecModal_ind="{{openSpecModal_ind}}" class="spec-cart-btn spec-buy" data-action="buy"> | ||
691 | - {{sele_g.offline_price?"券后购买":"立即购买"}} | 654 | + <view wx:if="{{openSpecModal_ind==2}}" bindtap="addCart" |
655 | + data-openSpecModal_ind="{{openSpecModal_ind}}" class="spec-cart-btn spec-buy" data-action="buy"> | ||
656 | + 支付定金(¥{{presellList.presell_money}}) | ||
692 | </view> | 657 | </view> |
693 | </block> | 658 | </block> |
694 | - </block> | 659 | + |
695 | </block> | 660 | </block> |
696 | </block> | 661 | </block> |
697 | </block> | 662 | </block> |
698 | </block> | 663 | </block> |
699 | </block> | 664 | </block> |
700 | </view> | 665 | </view> |
666 | + | ||
667 | + | ||
701 | <view class="clear"></view> | 668 | <view class="clear"></view> |
702 | <!-- 选择门店的列表 --> | 669 | <!-- 选择门店的列表 --> |
703 | <view hidden="{{ismend==0}}" class="sto_v"> | 670 | <view hidden="{{ismend==0}}" class="sto_v"> |
@@ -746,38 +713,7 @@ | @@ -746,38 +713,7 @@ | ||
746 | </view> | 713 | </view> |
747 | </view> | 714 | </view> |
748 | </view> | 715 | </view> |
749 | -<!-- --弹起的-- --> | ||
750 | -<block wx:if="{{pd_xx==1}}"> | ||
751 | - <view class="bview"></view> | ||
752 | - <view class="juzhong"> | ||
753 | - <view class="xq"> | ||
754 | - <view class="title" bindtap="close_pt_xx"> | ||
755 | - 拼团玩法介绍 | ||
756 | - <image src="{{iurl}}/miniapp/images/gbi.png" class="close"></image> | ||
757 | - </view> | ||
758 | - <view> | ||
759 | - 1.开团: | ||
760 | - <text class="hs1">选择心仪商品,点击“发起X人团”按钮,付款后即为开团成功;</text> | ||
761 | - </view> | ||
762 | - <view> | ||
763 | - 2.参团: | ||
764 | - <text class="hs1">进入朋友分享的页面,点击“立即参团”按钮,付款后即为参团成功,若多人同时支付,支付成功时间较早的人获得参团资格;</text> | ||
765 | - </view> | ||
766 | - <view> | ||
767 | - 3.成团: | ||
768 | - <text class="hs1">在开团或参团成功后,点击“邀请小伙伴参团”将页面分享给好友,在有效时间内凑齐人数即为成团,此时商家会开始发货;</text> | ||
769 | - </view> | ||
770 | - <view> | ||
771 | - 4.组团失败: | ||
772 | - <text class="hs1">在有效时间内未凑齐人数,即为组团失败,此时付款项会原路退回到支付账户;</text> | ||
773 | - </view> | ||
774 | - <view> | ||
775 | - 5. | ||
776 | - <text class="hs1">组团有效期间内,拼购商品订单不允许取消。</text> | ||
777 | - </view> | ||
778 | - </view> | ||
779 | - </view> | ||
780 | -</block> | 716 | + |
781 | <!-- --弹起领券-- --> | 717 | <!-- --弹起领券-- --> |
782 | <view wx:if='{{coupon==1}}'> | 718 | <view wx:if='{{coupon==1}}'> |
783 | <view class="cover-layer flex-center" data-coupon='0' bindtap="switchCoupon"></view> | 719 | <view class="cover-layer flex-center" data-coupon='0' bindtap="switchCoupon"></view> |
@@ -985,10 +921,7 @@ | @@ -985,10 +921,7 @@ | ||
985 | <text class="iconfont icon-close"></text> | 921 | <text class="iconfont icon-close"></text> |
986 | </view> | 922 | </view> |
987 | </view> | 923 | </view> |
988 | - <!-- <view class="btn-container"> | ||
989 | - <button class="btn-share" open-type="share" bindtap="">微信好友分享</button> | ||
990 | - <button class="btn-share" bindtap="savePic">保存到相册</button> | ||
991 | - </view> --> | 924 | + |
992 | </view> | 925 | </view> |
993 | </view> | 926 | </view> |
994 | </view> | 927 | </view> |
995 | \ No newline at end of file | 928 | \ No newline at end of file |
packageC/pages/presell/list/list.js
@@ -17,10 +17,8 @@ Page({ | @@ -17,10 +17,8 @@ Page({ | ||
17 | onLoad: function (t) { | 17 | onLoad: function (t) { |
18 | var first_leader = t.first_leader; | 18 | var first_leader = t.first_leader; |
19 | var th = this; | 19 | var th = this; |
20 | - | ||
21 | - console.log("------------"); | ||
22 | - console.log(first_leader); | ||
23 | getApp().getConfig(); | 20 | getApp().getConfig(); |
21 | + this.data.act_id=t.act_id; | ||
24 | 22 | ||
25 | if (first_leader) { | 23 | if (first_leader) { |
26 | getApp().globalData.first_leader = first_leader; | 24 | getApp().globalData.first_leader = first_leader; |
@@ -52,10 +50,26 @@ Page({ | @@ -52,10 +50,26 @@ Page({ | ||
52 | } | 50 | } |
53 | }) | 51 | }) |
54 | 52 | ||
55 | - //调用列表 | ||
56 | - this.get_list(); | 53 | + var userInfo=getApp().globalData.userInfo; |
54 | + if(userInfo && goodlist.length==0){ | ||
55 | + //调用列表 | ||
56 | + this.get_list(); | ||
57 | + }else{ | ||
58 | + getApp().goto("/pages/togoin/togoin"); | ||
59 | + } | ||
60 | + }, | ||
61 | + onShow: function (t) { | ||
62 | + var userInfo=getApp().globalData.userInfo; | ||
63 | + if(userInfo && this.data.goodlist.length==0){ | ||
64 | + //调用列表 | ||
65 | + this.get_list(); | ||
66 | + }else{ | ||
67 | + if(getApp().globalData.pre_back==1){ | ||
68 | + getApp().globalData.pre_back=0; | ||
69 | + getApp().goto("/pages/index/index/index"); | ||
70 | + } | ||
71 | + } | ||
57 | }, | 72 | }, |
58 | - onShow: function (t) { }, | ||
59 | //---小于10的格式化函数---- | 73 | //---小于10的格式化函数---- |
60 | timeFormat(param) { | 74 | timeFormat(param) { |
61 | return param < 10 ? '0' + param : param; | 75 | return param < 10 ? '0' + param : param; |
@@ -105,7 +119,13 @@ Page({ | @@ -105,7 +119,13 @@ Page({ | ||
105 | pageSize: 10, | 119 | pageSize: 10, |
106 | timetype: 1 | 120 | timetype: 1 |
107 | } | 121 | } |
108 | - | 122 | + if(getApp().globalData.userInfo){ |
123 | + req.user_id=getApp().globalData.userInfo.user_id; | ||
124 | + } | ||
125 | + if(this.data.act_id){ | ||
126 | + req.prom_type=8; | ||
127 | + req.prom_id=this.data.act_id; | ||
128 | + } | ||
109 | //调用接口获取数据 | 129 | //调用接口获取数据 |
110 | getApp().request.get("/api/weshop/marketing/marketingPresellList/page", { | 130 | getApp().request.get("/api/weshop/marketing/marketingPresellList/page", { |
111 | data: req, | 131 | data: req, |
@@ -132,6 +152,9 @@ Page({ | @@ -132,6 +152,9 @@ Page({ | ||
132 | } | 152 | } |
133 | }) | 153 | }) |
134 | }, | 154 | }, |
155 | + go_index:function () { | ||
156 | + getApp().goto("/pages/index/index/index"); | ||
157 | + } | ||
135 | 158 | ||
136 | 159 | ||
137 | }); | 160 | }); |
packageC/pages/presell/list/list.wxml
@@ -32,12 +32,13 @@ | @@ -32,12 +32,13 @@ | ||
32 | 32 | ||
33 | <view class="kill-list seckill_list"> | 33 | <view class="kill-list seckill_list"> |
34 | <view class="kill-item" wx:for="{{goodlist}}"> | 34 | <view class="kill-item" wx:for="{{goodlist}}"> |
35 | - <navigator class="kill-pic rel" url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}"> | 35 | + <navigator class="kill-pic rel" url="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id={{item.goods_id}}&pre_id={{item.id}}"> |
36 | <image class="wh100" src="{{url+item.original_img}}" data-val="{{item.original_img}}" | 36 | <image class="wh100" src="{{url+item.original_img}}" data-val="{{item.original_img}}" |
37 | data-errorimg="goodlist[{{index}}].original_img" binderror="bind_bnerr2" lazy-load="true"></image> | 37 | data-errorimg="goodlist[{{index}}].original_img" binderror="bind_bnerr2" lazy-load="true"></image> |
38 | </navigator> | 38 | </navigator> |
39 | <view class="kill-cont"> | 39 | <view class="kill-cont"> |
40 | - <navigator class="goods-name ellipsis-2" url="/pages/goods/goodsInfo/goodsInfo?goods_id={{item.goods_id}}">{{item.goods_name}}</navigator> | 40 | + <navigator class="goods-name ellipsis-2" |
41 | + url="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id={{item.goods_id}}&pre_id={{item.id}}">{{item.goods_name}}</navigator> | ||
41 | <view class="flex-vertical xc-strip-frame"> | 42 | <view class="flex-vertical xc-strip-frame"> |
42 | <view class="xc-strip-blank rel"> | 43 | <view class="xc-strip-blank rel"> |
43 | 44 | ||
@@ -68,11 +69,13 @@ | @@ -68,11 +69,13 @@ | ||
68 | </view> | 69 | </view> |
69 | </view> | 70 | </view> |
70 | 71 | ||
72 | + <block wx:if="{{goodlist.length==0 && is_get}}"> | ||
73 | + <nodata nodataContainer="t-c"></nodata> | ||
74 | + <view class="bc_btn" bindtap="go_index">去首页逛逛</view> | ||
75 | + </block> | ||
76 | + <view class="no-more" wx:elif="{{no_more}}">-- 没有更多 --</view> | ||
71 | 77 | ||
72 | -<nodata wx:if="{{goodlist.length==0 && is_get}}" nodataContainer="t-c"></nodata> | ||
73 | -<view class="no-more" wx:elif="{{no_more}}">-- 没有更多 --</view> | ||
74 | - | ||
75 | - <view style="height:10rpx"></view> | 78 | + <view style="height:10rpx"></view> |
76 | </view> | 79 | </view> |
77 | 80 | ||
78 | 81 |
packageC/pages/presell/list/list.wxss
@@ -191,5 +191,15 @@ border-radius:20rpx;height:26rpx; | @@ -191,5 +191,15 @@ border-radius:20rpx;height:26rpx; | ||
191 | .xc-fill-text{ | 191 | .xc-fill-text{ |
192 | left:34%; | 192 | left:34%; |
193 | line-height: 26rpx; | 193 | line-height: 26rpx; |
194 | +} | ||
194 | 195 | ||
196 | +.bc_btn{ | ||
197 | + margin: 10rpx auto; | ||
198 | + width: 200rpx; | ||
199 | + height: 60rpx; | ||
200 | + text-align: center; | ||
201 | + line-height: 60rpx; | ||
202 | + background-color: #ff0000; | ||
203 | + color: #fff; | ||
204 | + border-radius: 10rpx; | ||
195 | } | 205 | } |
196 | \ No newline at end of file | 206 | \ No newline at end of file |