Commit f8f77f42967d074a0530b72f242f6c7c1f17056f

Authored by yvan.ni
1 parent dfefc6ca

预售的优化

packageC/pages/presell/cart/cart.js
@@ -492,23 +492,34 @@ Page({ @@ -492,23 +492,34 @@ Page({
492 } 492 }
493 } 493 }
494 494
495 -  
496 - var g_url="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id="+order_goods.goods_id+"&pre_id="+pre_arr.id;  
497 - if(act.is_end || th.data.act.end_time<ut.gettimestamp()) {  
498 - g_url="/pages/goods/goodsInfo/goodsInfo?goods_id="+order_goods.goods_id;  
499 - getApp().request.put("/api/weshop/goods/update",  
500 - { data:{goods_id:order_goods.goods_id,store_id:os.stoid,prom_id:0,prom_type:0},  
501 - success: function(e) {}  
502 - });  
503 - }  
504 -  
505 -  
506 //---获取商品--- 495 //---获取商品---
507 await getApp().request.promiseGet("/api/weshop/goods/get/" + oo.stoid + "/" + order_goods.goods_id, {}).then(res => { 496 await getApp().request.promiseGet("/api/weshop/goods/get/" + oo.stoid + "/" + order_goods.goods_id, {}).then(res => {
508 goods = res.data.data; 497 goods = res.data.data;
509 order.market_price = goods.market_price; 498 order.market_price = goods.market_price;
510 order.show_img = oo.imghost + goods.original_img; 499 order.show_img = oo.imghost + goods.original_img;
511 }); 500 });
  501 +
  502 +
  503 + var g_url="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id="+order_goods.goods_id+"&pre_id="+pre_arr.id;
  504 + if(act.is_end || th.data.act.end_time<ut.gettimestamp()) {
  505 +
  506 + if(goods.prom_type==8 && goods.prom_id==act.id){
  507 + g_url="/pages/goods/goodsInfo/goodsInfo?goods_id="+order_goods.goods_id;
  508 + getApp().request.put("/api/weshop/goods/update",
  509 + { data:{goods_id:order_goods.goods_id,store_id:os.stoid,prom_id:0,prom_type:0},
  510 + success: function(e) {}
  511 + });
  512 + }else{
  513 + g_url="/pages/goods/goodsInfo/goodsInfo?goods_id="+order_goods.goods_id;
  514 + if(goods.prom_type==8){
  515 + g_url="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id="+order_goods.goods_id+"&prom_id="+goods.prom_id;
  516 + }
  517 +
  518 + }
  519 +
  520 + }
  521 +
  522 +
512 //判断使用优惠券的接口需要 523 //判断使用优惠券的接口需要
513 th.data.check_quan_ware_list = goods.erpwareid; 524 th.data.check_quan_ware_list = goods.erpwareid;
514 //---获取门店--- 525 //---获取门店---
@@ -646,9 +657,9 @@ Page({ @@ -646,9 +657,9 @@ Page({
646 } 657 }
647 658
648 if(quan_price>0){ 659 if(quan_price>0){
649 - if (quan_price < o_condition) th.setData({quan_price: quan_price}) 660 + if (quan_price < th.data.tail_pay) th.setData({quan_price: quan_price})
650 else { 661 else {
651 - th.setData({quan_price: o_condition}) 662 + th.setData({quan_price: th.data.tail_pay})
652 } 663 }
653 o_condition=o_condition-quan_price; 664 o_condition=o_condition-quan_price;
654 665
@@ -659,21 +670,22 @@ Page({ @@ -659,21 +670,22 @@ Page({
659 670
660 //如果同意参与订单优惠 671 //如果同意参与订单优惠
661 if (o_condition > 0 && this.data.pre_arr.is_useorderyh) { 672 if (o_condition > 0 && this.data.pre_arr.is_useorderyh) {
662 - th.check_is_order_prom(o_condition, function () { 673 + th.check_is_order_prom(o_condition, function (ord_price) {
663 var bn_pick=th.data.pickup.pickup_id 674 var bn_pick=th.data.pickup.pickup_id
664 var order_prom_amount = 0; 675 var order_prom_amount = 0;
665 var order_prom_id = 0; 676 var order_prom_id = 0;
  677 + var o_condition1=0;
666 if (th.data.order_prom[bn_pick]) { 678 if (th.data.order_prom[bn_pick]) {
667 var ord_prom = th.data.order_prom[bn_pick]; 679 var ord_prom = th.data.order_prom[bn_pick];
668 order_prom_id = ord_prom['id']; 680 order_prom_id = ord_prom['id'];
669 switch (ord_prom['type']) { 681 switch (ord_prom['type']) {
670 case 0: 682 case 0:
671 var all_1=o_condition; 683 var all_1=o_condition;
672 - o_condition = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折  
673 - order_prom_amount = (all_1 - o_condition).toFixed(2); 684 + o_condition1 = Math.round(ord_price * ord_prom['expression']) / 100;//满额打折
  685 + order_prom_amount = (all_1 - o_condition1).toFixed(2);
674 break; 686 break;
675 case 1: 687 case 1:
676 - o_condition = o_condition - ord_prom['expression'];//满额优惠金额 688 + o_condition1 = ord_price - ord_prom['expression'];//满额优惠金额
677 order_prom_amount = ord_prom['expression']; 689 order_prom_amount = ord_prom['expression'];
678 break; 690 break;
679 } 691 }
@@ -684,9 +696,12 @@ Page({ @@ -684,9 +696,12 @@ Page({
684 var order_prom_txt2 = "order_prom_amount"; 696 var order_prom_txt2 = "order_prom_amount";
685 th.setData({[order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount}) 697 th.setData({[order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount})
686 } 698 }
687 - th.setData({ exp_price: 0, order_m: o_condition }) 699 +
  700 + o_condition1=parseFloat(o_condition1)-parseFloat(th.data.presell.presell_deposit);
  701 + th.setData({ exp_price: 0, order_m: o_condition1 })
688 }) 702 })
689 }else{ 703 }else{
  704 + o_condition=parseFloat(o_condition)-parseFloat(th.data.presell.presell_deposit);
690 th.setData({ exp_price: 0, order_m: o_condition }) 705 th.setData({ exp_price: 0, order_m: o_condition })
691 } 706 }
692 } 707 }
@@ -1679,8 +1694,10 @@ Page({ @@ -1679,8 +1694,10 @@ Page({
1679 if (res.data.code == 0) { 1694 if (res.data.code == 0) {
1680 var data = res.data.data; 1695 var data = res.data.data;
1681 th.data.order_prom[pick] = data; 1696 th.data.order_prom[pick] = data;
1682 - }  
1683 - func(); 1697 + }else{
  1698 + th.data.order_prom[pick] = null;
  1699 + }
  1700 + func(condition);
1684 }) 1701 })
1685 }, 1702 },
1686 1703
@@ -1872,9 +1889,10 @@ Page({ @@ -1872,9 +1889,10 @@ Page({
1872 }) 1889 })
1873 1890
1874 if(quan_price>0) { 1891 if(quan_price>0) {
1875 - if (quan_price < allpice) th.setData({quan_price: quan_price}) 1892 + if (quan_price <th.data.tail_pay) th.setData({quan_price:quan_price})
1876 else { 1893 else {
1877 - th.setData({quan_price: allpice}) 1894 + th.setData({quan_price: th.data.tail_pay})
  1895 + quan_price=th.data.tail_pay;
1878 } 1896 }
1879 }else{ 1897 }else{
1880 th.setData({quan_price: 0}) 1898 th.setData({quan_price: 0})
@@ -1957,7 +1975,7 @@ Page({ @@ -1957,7 +1975,7 @@ Page({
1957 if(o_condition<0) o_condition=0; 1975 if(o_condition<0) o_condition=0;
1958 //如果同意参与订单优惠 1976 //如果同意参与订单优惠
1959 if (o_condition > 0 && this.data.pre_arr.is_useorderyh) { 1977 if (o_condition > 0 && this.data.pre_arr.is_useorderyh) {
1960 - th.check_is_order_prom(o_condition, function () { 1978 + th.check_is_order_prom(o_condition, function (ord_price) {
1961 var bn_pick=th.data.pickup.pickup_id 1979 var bn_pick=th.data.pickup.pickup_id
1962 var order_prom_amount = 0; 1980 var order_prom_amount = 0;
1963 var order_prom_id = 0; 1981 var order_prom_id = 0;
@@ -1967,15 +1985,15 @@ Page({ @@ -1967,15 +1985,15 @@ Page({
1967 order_prom_id = ord_prom['id']; 1985 order_prom_id = ord_prom['id'];
1968 switch (ord_prom['type']) { 1986 switch (ord_prom['type']) {
1969 case 0: 1987 case 0:
1970 - order_m = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折  
1971 - order_prom_amount = (o_condition - order_m).toFixed(2); 1988 + order_m = Math.round(ord_price * ord_prom['expression']) / 100;//满额打折
  1989 + order_prom_amount = (ord_price - order_m).toFixed(2);
1972 break; 1990 break;
1973 case 1: 1991 case 1:
1974 - order_m = o_condition - ord_prom['expression'];//满额优惠金额 1992 + order_m = ord_price - ord_prom['expression'];//满额优惠金额
1975 order_prom_amount = ord_prom['expression']; 1993 order_prom_amount = ord_prom['expression'];
1976 break; 1994 break;
1977 } 1995 }
1978 - o_condition=order_m; 1996 + ord_price=order_m;
1979 } 1997 }
1980 1998
1981 //--订单优惠的显示-- 1999 //--订单优惠的显示--
@@ -1983,13 +2001,21 @@ Page({ @@ -1983,13 +2001,21 @@ Page({
1983 var order_prom_txt1 = "order_prom_id"; 2001 var order_prom_txt1 = "order_prom_id";
1984 var order_prom_txt2 = "order_prom_amount"; 2002 var order_prom_txt2 = "order_prom_amount";
1985 th.setData({[order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount}) 2003 th.setData({[order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount})
1986 - }  
1987 -  
1988 - th.setData({ exp_price: exp_price, order_m: parseFloat(o_condition) +parseFloat(exp_price) }) 2004 + }else{
  2005 + var order_prom_txt1 = "order_prom_id";
  2006 + var order_prom_txt2 = "order_prom_amount";
  2007 + th.setData({[order_prom_txt1]: 0, [order_prom_txt2]: 0})
  2008 + }
  2009 +
  2010 +
  2011 + ord_price=parseFloat(ord_price)-parseFloat(th.data.presell.presell_deposit);
  2012 + th.setData({ exp_price: exp_price, order_m: ord_price +parseFloat(exp_price) })
1989 2013
1990 }) 2014 })
1991 }else{ 2015 }else{
1992 - th.setData({ exp_price: exp_price, order_m: parseFloat(o_condition)+parseFloat(exp_price) }) 2016 +
  2017 + var o_condition1=parseFloat(o_condition)-parseFloat(th.data.presell.presell_deposit);
  2018 + th.setData({ exp_price: exp_price, order_m: parseFloat(o_condition1)+parseFloat(exp_price) })
1993 } 2019 }
1994 }, 2020 },
1995 2021
@@ -2110,7 +2136,7 @@ Page({ @@ -2110,7 +2136,7 @@ Page({
2110 if(th.data.user_note){ 2136 if(th.data.user_note){
2111 dd.user_note=th.data.user_note; 2137 dd.user_note=th.data.user_note;
2112 } 2138 }
2113 - dd.order_amount= parseFloat(th.data.order_m-th.data.presell.presell_deposit).toFixed(2); 2139 + dd.order_amount= parseFloat(th.data.order_m).toFixed(2);
2114 2140
2115 console.log(JSON.stringify(dd)); 2141 console.log(JSON.stringify(dd));
2116 wx.request({ 2142 wx.request({
packageC/pages/presell/cart/cart.wxml
@@ -337,7 +337,7 @@ @@ -337,7 +337,7 @@
337 <view class="btn-wrap"> 337 <view class="btn-wrap">
338 <view class="pay-amount"> 338 <view class="pay-amount">
339 <view class="payable">应付金额: 339 <view class="payable">应付金额:
340 - <text class="co-red"> <text class="fs24">¥</text>{{filters.toFix(order_m-presell.presell_deposit,2)}}</text> 340 + <text class="co-red"> <text class="fs24">¥</text>{{filters.toFix(order_m,2)}}</text>
341 </view> 341 </view>
342 </view> 342 </view>
343 <button wx:if="{{no_start || is_end || is_complete}}" class="tips-btn gray">提交订单</button> 343 <button wx:if="{{no_start || is_end || is_complete}}" class="tips-btn gray">提交订单</button>
packageC/pages/presell/goodsInfo/goodsInfo.js
@@ -2706,7 +2706,8 @@ Page({ @@ -2706,7 +2706,8 @@ Page({
2706 2706
2707 ///二微码 2707 ///二微码
2708 var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" + 2708 var path3 = os.url + "/api/wx/open/app/user/getWeAppEwm/" +
2709 - os.stoid + "?sceneValue=" + scene + "&pageValue=packageC/pages/presell/goodsInfo/goodsInfo"; 2709 + //os.stoid + "?sceneValue=" + scene + "&pageValue=packageC/pages/presell/goodsInfo/goodsInfo";
  2710 + os.stoid + "?sceneValue=" + scene + "&pageValue=pages/goods/goodsInfo/goodsInfo";
2710 2711
2711 console.log(path3); 2712 console.log(path3);
2712 2713
@@ -2801,14 +2802,20 @@ Page({ @@ -2801,14 +2802,20 @@ Page({
2801 context.setFontSize(22 * unit) 2802 context.setFontSize(22 * unit)
2802 pri0 = "¥" + th.data.data.market_price.toFixed(2); 2803 pri0 = "¥" + th.data.data.market_price.toFixed(2);
2803 var wd2 = th.data.screenWidth - ut.measureText(pri0, 22 * unit) - 25; 2804 var wd2 = th.data.screenWidth - ut.measureText(pri0, 22 * unit) - 25;
2804 - context.fillText('定金', wd2, 213 * unit);  
2805 -  
2806 - // context.setStrokeStyle('gray');  
2807 - // context.setLineWidth(1 * unit);  
2808 - // context.moveTo(wd2 - 5, 206 * unit);  
2809 - // context.lineTo(wd2 + ut.measureText(pri0, 22 * unit) + 5, 206 * unit);  
2810 - // context.stroke();  
2811 - 2805 +
  2806 + if(th.data.presellForm.presell_type==1){
  2807 + context.setStrokeStyle('gray');
  2808 + context.fillText(pri0, wd2, 213 * unit);
  2809 + context.setLineWidth(1 * unit);
  2810 + context.moveTo(wd2 - 5, 206 * unit);
  2811 + context.lineTo(wd2 + ut.measureText(pri0, 22 * unit) + 5, 206 * unit);
  2812 + context.stroke();
  2813 + }else{
  2814 + context.fillText('定金', wd2, 213 * unit);
  2815 + }
  2816 +
  2817 +
  2818 +
2812 } else { 2819 } else {
2813 context.setFillStyle("black"); 2820 context.setFillStyle("black");
2814 context.setFontSize(21.3 * unit) 2821 context.setFontSize(21.3 * unit)
@@ -2834,43 +2841,7 @@ Page({ @@ -2834,43 +2841,7 @@ Page({
2834 //---中间大图--- 2841 //---中间大图---
2835 context.drawImage(th.data.share_goods_img, 70 * unit, 250 * unit, 408 * unit, 408 * unit); 2842 context.drawImage(th.data.share_goods_img, 70 * unit, 250 * unit, 408 * unit, 408 * unit);
2836 2843
2837 - //预售  
2838 - /* if (th.data.poster && parseInt(th.data.poster.style) == 2) {  
2839 - if (parseInt(th.data.poster.show_quality)) {  
2840 - var g_path = "../../../../images/share/s_gou.png";  
2841 - context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit);  
2842 - context.setFillStyle("red")  
2843 - context.setFontSize(18 * unit)  
2844 - context.fillText("正品保证", 84 * unit, 690 * unit);  
2845 -  
2846 - context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit);  
2847 - context.setFillStyle("red")  
2848 - context.setFontSize(18 * unit)  
2849 - context.fillText("纯实体店", 246 * unit, 690 * unit);  
2850 -  
2851 - context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit);  
2852 - context.setFillStyle("red")  
2853 - context.setFontSize(18 * unit)  
2854 - context.fillText("官方验证", 420 * unit, 690 * unit);  
2855 - }  
2856 - } else {  
2857 - var g_path = "../../../../images/share/s_gou.png";  
2858 - context.drawImage(g_path, 56 * unit, 670 * unit, 22 * unit, 22 * unit);  
2859 - context.setFillStyle("red")  
2860 - context.setFontSize(18 * unit)  
2861 - context.fillText("正品保证", 84 * unit, 690 * unit);  
2862 -  
2863 - context.drawImage(g_path, 218 * unit, 670 * unit, 22 * unit, 22 * unit);  
2864 - context.setFillStyle("red")  
2865 - context.setFontSize(18 * unit)  
2866 - context.fillText("纯实体店", 246 * unit, 690 * unit);  
2867 -  
2868 - context.drawImage(g_path, 388 * unit, 670 * unit, 22 * unit, 22 * unit);  
2869 - context.setFillStyle("red")  
2870 - context.setFontSize(18 * unit)  
2871 - context.fillText("官方验证", 420 * unit, 690 * unit);  
2872 - } */  
2873 - 2844 +
2874 //---画线--- 2845 //---画线---
2875 context.setLineWidth(1 * unit) 2846 context.setLineWidth(1 * unit)
2876 context.moveTo(32 * unit, 665 * unit) 2847 context.moveTo(32 * unit, 665 * unit)
@@ -2881,14 +2852,14 @@ Page({ @@ -2881,14 +2852,14 @@ Page({
2881 context.setFillStyle("black") 2852 context.setFillStyle("black")
2882 // context.setFontSize(22 * unit) 2853 // context.setFontSize(22 * unit)
2883 context.setFontSize(24 * unit) 2854 context.setFontSize(24 * unit)
2884 - context.fillText(th.data.sto_sele_name_1, 40 * unit, 766 * unit); 2855 + context.fillText(th.data.sto_sele_name_1, 40 * unit, 730 * unit);
2885 context.setFillStyle("red") 2856 context.setFillStyle("red")
2886 context.setFontSize(20 * unit) 2857 context.setFontSize(20 * unit)
2887 var presell_price = `预售价:${th.data.presellList.presell_price}` 2858 var presell_price = `预售价:${th.data.presellList.presell_price}`
2888 - context.fillText(presell_price, 40 * unit, 801 * unit); 2859 + context.fillText(presell_price, 40 * unit, 780 * unit);
2889 context.setFillStyle("black") 2860 context.setFillStyle("black")
2890 context.setFontSize(22 * unit) 2861 context.setFontSize(22 * unit)
2891 - context.fillText("特惠好物,限时预售", 40 * unit, 836 * unit); 2862 + context.fillText("特惠好物,限时预售", 40 * unit, 826 * unit);
2892 context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 866 * unit); 2863 context.fillText("长按识别二维码,立即开始抢购", 40 * unit, 866 * unit);
2893 2864
2894 //---二维吗图--- 2865 //---二维吗图---
@@ -2899,7 +2870,7 @@ Page({ @@ -2899,7 +2870,7 @@ Page({
2899 context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit); 2870 context.drawImage(vpath, erm_x * unit, erm_y * unit, 136 * unit, 136 * unit);
2900 } else { 2871 } else {
2901 //---二维吗图--- 2872 //---二维吗图---
2902 - context.drawImage(vpath, 390 * unit, 756 * unit, 130 * unit, 116 * unit); 2873 + context.drawImage(vpath, 390 * unit, 746 * unit, 130 * unit, 116 * unit);
2903 } 2874 }
2904 2875
2905 2876