Commit 4d2a15a8a6ee3d8ac966937183bd04b4acac1785

Authored by yvan.ni
1 parent 2fac268b

多活动商品的优化

packageA/pages/goodsInfo/goodsInfo.js
@@ -4161,6 +4161,7 @@ Page({ @@ -4161,6 +4161,7 @@ Page({
4161 user_id: oo.user_id, 4161 user_id: oo.user_id,
4162 goods_id: a, 4162 goods_id: a,
4163 pick_id: e.data.sto_sele_id, 4163 pick_id: e.data.sto_sele_id,
  4164 + prom_type:(newd.prom_type?newd.prom_type:0),
4164 state: 0 4165 state: 0
4165 }, 4166 },
4166 success: function (re) { 4167 success: function (re) {
packageE/pages/cart/cart2/cart2.js
@@ -399,6 +399,7 @@ Page({ @@ -399,6 +399,7 @@ Page({
399 wx.hideLoading() 399 wx.hideLoading()
400 return arr 400 return arr
401 }, 401 },
  402 +
402 //计算商品预存款请求方法------------------------------------ 403 //计算商品预存款请求方法------------------------------------
403 async getGoodsAdvancesum(storageid, listform, cartList) { 404 async getGoodsAdvancesum(storageid, listform, cartList) {
404 let res = await getApp().request.promisePost(`/api/weshop/delphiapi/saveErpApi`, { 405 let res = await getApp().request.promisePost(`/api/weshop/delphiapi/saveErpApi`, {
@@ -712,15 +713,15 @@ Page({ @@ -712,15 +713,15 @@ Page({
712 //如果有购买活动 713 //如果有购买活动
713 item1.promgoodsbuynum = promgoodsbuynum; 714 item1.promgoodsbuynum = promgoodsbuynum;
714 715
715 - //如果是秒杀的时候  
716 - if (item1.prom_type == 1) {  
717 - var url = "/api/weshop/activitylist/getSJGoodsPriceNew/" + os.stoid  
718 - + "/" + item1.goods_id + "/1/" + item1.prom_id + "/" + app.globalData.user_id;  
719 - await app.request.promiseGet(url, {}).then(res => {  
720 - if (res.data.code == 0) {  
721 - console.log(res.data.data, "111");  
722 - item1.is_order_yh = res.data.data.is_order_yh;  
723 - item1.is_post_temp = res.data.data.is_post_temp; 716 + //如果是秒杀,团购的时候
  717 + if([1,2].indexOf(item1.prom_type)>-1){
  718 + var url= "/api/weshop/activitylist/getSJGoodsPriceNew/" + os.stoid
  719 + + "/" + item1.goods_id + "/"+item1.prom_type+"/" + item1.prom_id + "/" + app.globalData.user_id;
  720 + await app.request.promiseGet(url,{}).then(res=>{
  721 + if(res.data.code==0){
  722 + console.log(res.data.data,"111");
  723 + item1.is_order_yh=res.data.data.is_order_yh;
  724 + item1.is_post_temp=res.data.data.is_post_temp;
724 } 725 }
725 }) 726 })
726 } 727 }
@@ -1467,7 +1468,7 @@ Page({ @@ -1467,7 +1468,7 @@ Page({
1467 success: async function (tt) { 1468 success: async function (tt) {
1468 if (tt.data.code == 0) { 1469 if (tt.data.code == 0) {
1469 //t.data.data.shop_price = tt.data.data.prom_price; 1470 //t.data.data.shop_price = tt.data.data.prom_price;
1470 - t.data.data.shop_price = tt.data.data.prom_user_price; 1471 + gd.shop_price=t.data.data.shop_price = tt.data.data.prom_user_price;
1471 th.data.ckeck_quan_price = 0; 1472 th.data.ckeck_quan_price = 0;
1472 gd.is_xz_yh = 1; 1473 gd.is_xz_yh = 1;
1473 1474
@@ -1532,53 +1533,110 @@ Page({ @@ -1532,53 +1533,110 @@ Page({
1532 getApp().request.get("/api/weshop/goods/groupBuy/getActInfo/" + os.stoid + "/" + gd.goods_id + "/" + gd.prom_id, { 1533 getApp().request.get("/api/weshop/goods/groupBuy/getActInfo/" + os.stoid + "/" + gd.goods_id + "/" + gd.prom_id, {
1533 success: async function (tt) { 1534 success: async function (tt) {
1534 if (tt.data.code == 0) { 1535 if (tt.data.code == 0) {
1535 - //t.data.data.shop_price = tt.data.data.prom_price;  
1536 - t.data.data.shop_price = tt.data.data.price; 1536 + //获取一下主表的信息
  1537 + ut.get_active_info(2,gd.prom_id,os.stoid,function(e){
  1538 +
  1539 + //t.data.data.shop_price = tt.data.data.prom_price;
  1540 + gd.shop_price=t.data.data.shop_price = tt.data.data.price;
  1541 +
  1542 + t.data.data.fir_rate = tt.data.data.fir_rate;
  1543 + t.data.data.sec_rate = tt.data.data.sec_rate;
  1544 + t.data.data.thi_rate = tt.data.data.thi_rate;
  1545 + t.data.data.commission = tt.data.data.commission;
  1546 +
  1547 + if(e.is_order_yh){
  1548 + th.data.bn_is_order_yh=1;
  1549 + }else{
  1550 + th.data.bn_is_order_yh=0;
  1551 + }
  1552 + if(e.is_post_temp){
  1553 + th.data.bn_is_post_temp=1;
  1554 + }else{
  1555 + th.data.bn_is_post_temp=0;
  1556 + }
  1557 +
  1558 +
  1559 + //-- 计算获得佣金的金额 --
  1560 + if (getApp().globalData.userInfo.is_distribut
  1561 + && th.data.dis_config && th.data.dis_config.is_yongjin_dk) {
  1562 +
  1563 + var c_num = getApp().get_commission(th.data.dis_config, t.data.data, gg.goods_num);
  1564 +
  1565 + gd.use_commission = c_num;
  1566 + t.data.data.use_commission = c_num;
  1567 +
  1568 + }
  1569 +
  1570 +
  1571 + if (tt.data.data.isQuan) {
  1572 + th.data.ckeck_quan_price = t.data.data.shop_price * gg.goods_num;
  1573 + th.data.check_quan_price_list = t.data.data.shop_price * gg.goods_num + "";
  1574 + th.data.check_quan_ware_list = t.data.data.erpwareid + "";
  1575 + } else {
  1576 + gd.is_xz_yh = 1;
  1577 + }
  1578 +
  1579 + th.setData({
  1580 + bn_goods: gd,
  1581 + bn_pickname: gg.pick_name,
  1582 + bn_exp_type: et,
  1583 + index: m_wind,
  1584 + bn_pick: gg.pick_id,
  1585 + bn_t_exp_t: distr_t,
  1586 + bn_exp_type: et
  1587 + });
  1588 +
  1589 + //-- 计算价格 --
  1590 + th.calculatePrice2();
  1591 + //获取优惠券,如果有券的钱,就调用
  1592 + if (th.data.ckeck_quan_price > 0) th.get_buy_now_quan();
  1593 +
  1594 + })
1537 1595
1538 - t.data.data.fir_rate = tt.data.data.fir_rate;  
1539 - t.data.data.sec_rate = tt.data.data.sec_rate;  
1540 - t.data.data.thi_rate = tt.data.data.thi_rate;  
1541 - t.data.data.commission = tt.data.data.commission;  
1542 1596
1543 } else { 1597 } else {
1544 t.data.data.prom_id = 0; 1598 t.data.data.prom_id = 0;
1545 t.data.data.prom_type = 0; 1599 t.data.data.prom_type = 0;
1546 - }  
1547 1600
1548 - //-- 计算获得佣金的金额 --  
1549 - if (getApp().globalData.userInfo.is_distribut  
1550 - && th.data.dis_config && th.data.dis_config.is_yongjin_dk) {  
1551 1601
1552 - var c_num = getApp().get_commission2(th.data.dis_config, t.data.data, gg.goods_num);  
1553 1602
1554 - gd.use_commission = c_num;  
1555 - t.data.data.use_commission = c_num; 1603 + //-- 计算获得佣金的金额 --
  1604 + if (getApp().globalData.userInfo.is_distribut
  1605 + && th.data.dis_config && th.data.dis_config.is_yongjin_dk) {
  1606 + var c_num = getApp().get_commission2(th.data.dis_config, t.data.data, gg.goods_num);
1556 1607
1557 - } 1608 + gd.use_commission = c_num;
  1609 + t.data.data.use_commission = c_num;
1558 1610
  1611 + }
  1612 +
  1613 +
  1614 + if (tt.data.data.isQuan) {
  1615 + th.data.ckeck_quan_price = t.data.data.shop_price * gg.goods_num;
  1616 + th.data.check_quan_price_list = t.data.data.shop_price * gg.goods_num + "";
  1617 + th.data.check_quan_ware_list = t.data.data.erpwareid + "";
  1618 + } else {
  1619 + gd.is_xz_yh = 1;
  1620 + }
  1621 +
  1622 + th.setData({
  1623 + bn_goods: gd,
  1624 + bn_pickname: gg.pick_name,
  1625 + bn_exp_type: et,
  1626 + index: m_wind,
  1627 + bn_pick: gg.pick_id,
  1628 + bn_t_exp_t: distr_t,
  1629 + bn_exp_type: et
  1630 + });
  1631 +
  1632 + //-- 计算价格 --
  1633 + th.calculatePrice2();
  1634 + //获取优惠券,如果有券的钱,就调用
  1635 + if (th.data.ckeck_quan_price > 0) th.get_buy_now_quan();
1559 1636
1560 - if (tt.data.data.isQuan) {  
1561 - th.data.ckeck_quan_price = t.data.data.shop_price * gg.goods_num;  
1562 - th.data.check_quan_price_list = t.data.data.shop_price * gg.goods_num + "";  
1563 - th.data.check_quan_ware_list = t.data.data.erpwareid + "";  
1564 - } else {  
1565 - gd.is_xz_yh = 1;  
1566 } 1637 }
1567 1638
1568 - th.setData({  
1569 - bn_goods: gd,  
1570 - bn_pickname: gg.pick_name,  
1571 - bn_exp_type: et,  
1572 - index: m_wind,  
1573 - bn_pick: gg.pick_id,  
1574 - bn_t_exp_t: distr_t,  
1575 - bn_exp_type: et  
1576 - });  
1577 1639
1578 - //-- 计算价格 --  
1579 - th.calculatePrice2();  
1580 - //获取优惠券,如果有券的钱,就调用  
1581 - if (th.data.ckeck_quan_price > 0) th.get_buy_now_quan();  
1582 } 1640 }
1583 }); 1641 });
1584 1642
@@ -1855,7 +1913,6 @@ Page({ @@ -1855,7 +1913,6 @@ Page({
1855 }, 1913 },
1856 1914
1857 1915
1858 -  
1859 calclate_lbNum(r_data) { 1916 calclate_lbNum(r_data) {
1860 let send_lb = this.data.send_lb; 1917 let send_lb = this.data.send_lb;
1861 //g_lb_num我的礼包 g_zxlb_num专享礼包 1918 //g_lb_num我的礼包 g_zxlb_num专享礼包
@@ -2060,15 +2117,14 @@ Page({ @@ -2060,15 +2117,14 @@ Page({
2060 } 2117 }
2061 o_price += item[j].goods_price * item[j].goods_num; 2118 o_price += item[j].goods_price * item[j].goods_num;
2062 2119
2063 - //-- 秒杀的时候,判断有没有订单优惠和包邮模板的叠加 --  
2064 - if (item[j].prom_type == 1) {  
2065 - if (!item[j].is_order_yh)  
2066 - no_order_yh += item[j].goods_price * item[j].goods_num;  
2067 - if (!item[j].is_post_temp)  
2068 - no_post_temp += item[j].goods_price * item[j].goods_num;  
2069 - }  
2070 -  
2071 2120
  2121 + //-- 秒杀, 团购的时候,判断有没有订单优惠和包邮模板的叠加 --
  2122 + if( [1,2].indexOf(item[j].prom_type)>-1){
  2123 + if(!item[j].is_order_yh)
  2124 + no_order_yh+=item[j].goods_price * item[j].goods_num;
  2125 + if(!item[j].is_post_temp)
  2126 + no_post_temp+=item[j].goods_price * item[j].goods_num;
  2127 + }
2072 } 2128 }
2073 //判断是不是有组合购的金额 2129 //判断是不是有组合购的金额
2074 var f_o_price = o_price; 2130 var f_o_price = o_price;
@@ -2370,6 +2426,7 @@ Page({ @@ -2370,6 +2426,7 @@ Page({
2370 2426
2371 var order_m = 0; 2427 var order_m = 0;
2372 2428
  2429 +
2373 //么有使用券,或者活动没有限制使用优惠券 2430 //么有使用券,或者活动没有限制使用优惠券
2374 if (ord_prom && (quan_price <= 0 || !ord_prom.is_xz_yh)) { 2431 if (ord_prom && (quan_price <= 0 || !ord_prom.is_xz_yh)) {
2375 order_prom_id = ord_prom['id']; 2432 order_prom_id = ord_prom['id'];
@@ -2389,8 +2446,6 @@ Page({ @@ -2389,8 +2446,6 @@ Page({
2389 } 2446 }
2390 } 2447 }
2391 2448
2392 -  
2393 -  
2394 cart_item.order_prom_amount = 0; 2449 cart_item.order_prom_amount = 0;
2395 //--订单优惠的显示-- 2450 //--订单优惠的显示--
2396 if (order_prom_id > 0) { 2451 if (order_prom_id > 0) {
@@ -2743,7 +2798,6 @@ Page({ @@ -2743,7 +2798,6 @@ Page({
2743 if (cut_price) { 2798 if (cut_price) {
2744 var c_txt = "formData.cut_price"; 2799 var c_txt = "formData.cut_price";
2745 th.setData({ [c_txt]: cut_price, }); 2800 th.setData({ [c_txt]: cut_price, });
2746 -  
2747 } 2801 }
2748 2802
2749 //如果有线下取价的时候 2803 //如果有线下取价的时候
@@ -6454,6 +6508,4 @@ Page({ @@ -6454,6 +6508,4 @@ Page({
6454 } 6508 }
6455 6509
6456 6510
6457 -  
6458 -  
6459 }); 6511 });
pages/cart/cart2_pt/cart2_pt.js
1 var t = getApp(), app = t, a = t.request, e = require("../../../utils/common.js"), 1 var t = getApp(), app = t, a = t.request, e = require("../../../utils/common.js"),
2 - s = require("../../../utils/util.js"), ut = s, o = require("../../../utils/md5.js"), to = getApp(); 2 + s = require("../../../utils/util.js"), ut = s, o = require("../../../utils/md5.js"), to = getApp();
3 var oo = t.globalData.setting, os = oo; 3 var oo = t.globalData.setting, os = oo;
4 var regeneratorRuntime = require('../../../utils/runtime.js'); 4 var regeneratorRuntime = require('../../../utils/runtime.js');
5 var util_pay = require("../../../utils/pay.js"); 5 var util_pay = require("../../../utils/pay.js");
6 6
7 Page({ 7 Page({
  8 +
8 data: { 9 data: {
9 url: t.globalData.setting.url, 10 url: t.globalData.setting.url,
10 resourceUrl: t.globalData.setting.resourceUrl, 11 resourceUrl: t.globalData.setting.resourceUrl,
@@ -439,6 +440,17 @@ Page({ @@ -439,6 +440,17 @@ Page({
439 t.data.data.thi_rate = tt.data.data.thi_rate; 440 t.data.data.thi_rate = tt.data.data.thi_rate;
440 t.data.data.commission = tt.data.data.commission; 441 t.data.data.commission = tt.data.data.commission;
441 442
  443 + if(e.is_order_yh){
  444 + th.data.bn_is_order_yh=1;
  445 + }else{
  446 + th.data.bn_is_order_yh=0;
  447 + }
  448 +
  449 + if(e.is_post_temp){
  450 + th.data.bn_is_post_temp=1;
  451 + }else{
  452 + th.data.bn_is_post_temp=0;
  453 + }
442 454
443 if (pt_data.kttype == 3) { 455 if (pt_data.kttype == 3) {
444 t.data.data.shop_price = tt.data.data.yf_price; //用定金来购买 456 t.data.data.shop_price = tt.data.data.yf_price; //用定金来购买
@@ -632,8 +644,22 @@ Page({ @@ -632,8 +644,22 @@ Page({
632 var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; 644 var o_shipping_price = 0, goods_weight = -1, goods_piece = -1;
633 var out_of_weight = null; //超出多少重量 645 var out_of_weight = null; //超出多少重量
634 646
635 - //-----------当地址不为空,且是物流时,计算物流费用,同时阶梯团不计算拼团价格----------  
636 - if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && (th.data.kt_type != 3 || th.data.bn_goods.is_normal == 1)) { 647 + //-- 判断订单优惠的叠加 --
  648 + var ord_prom=null;
  649 + var o_condition=allpice;
  650 + if(th.data.bn_is_order_yh && th.data.kt_type != 3 ){
  651 +
  652 + await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", {
  653 + data: { store_id: os.stoid, orderAmount: o_condition, user_id: getApp().globalData.user_id }
  654 + }).then(res => {
  655 + if (res.data.code == 0) {
  656 + ord_prom = res.data.data;
  657 + }
  658 + })
  659 + }
  660 +
  661 + //-----------当地址不为空,且是物流时,计算物流费用,同时阶梯团不计算拼团价格----------
  662 + if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && (th.data.kt_type != 3 || th.data.bn_goods.is_normal == 1)) {
637 663
638 var user_addr = th.data.user_addr; 664 var user_addr = th.data.user_addr;
639 var req_d = { 665 var req_d = {
@@ -641,11 +667,16 @@ Page({ @@ -641,11 +667,16 @@ Page({
641 wuliu: parseFloat(allpice).toFixed(2), store_id: os.stoid 667 wuliu: parseFloat(allpice).toFixed(2), store_id: os.stoid
642 } 668 }
643 var back_data = null; 669 var back_data = null;
644 - await getApp().request.promisePost("/api/weshop/order/areaFreight", {  
645 - is_json: 1, data: req_d  
646 - }).then(rs => {  
647 - if (rs.data.code == 0) back_data = rs.data.data;  
648 - }); 670 +
  671 + if(!ord_prom || ord_prom.bn_is_post_temp) {
  672 + if (th.data.bn_is_post_temp || th.data.bn_goods.is_normal == 1) {
  673 + await getApp().request.promisePost("/api/weshop/order/areaFreight", {
  674 + is_json: 1, data: req_d
  675 + }).then(rs => {
  676 + if (rs.data.code == 0) back_data = rs.data.data;
  677 + });
  678 + }
  679 + }
649 680
650 var gd_arr_list = []; 681 var gd_arr_list = [];
651 gd_arr_list.push(good); 682 gd_arr_list.push(good);
@@ -771,6 +802,7 @@ Page({ @@ -771,6 +802,7 @@ Page({
771 goods_weight: gd_w 802 goods_weight: gd_w
772 } 803 }
773 804
  805 +
774 var is_next = 1; 806 var is_next = 1;
775 //获取同城配送参数 807 //获取同城配送参数
776 await getApp().request.promisePost("/api/weshop/order/sameCityExp/getMoney", { 808 await getApp().request.promisePost("/api/weshop/order/sameCityExp/getMoney", {
@@ -780,6 +812,7 @@ Page({ @@ -780,6 +812,7 @@ Page({
780 if (res.data.code == 0) { 812 if (res.data.code == 0) {
781 var wl_txt = "formData.shipping_price"; 813 var wl_txt = "formData.shipping_price";
782 th.setData({ [wl_txt]: res.data.data, }) 814 th.setData({ [wl_txt]: res.data.data, })
  815 +
783 } else { 816 } else {
784 is_next = 0; 817 is_next = 0;
785 wx.showToast({ 818 wx.showToast({
@@ -902,6 +935,41 @@ Page({ @@ -902,6 +935,41 @@ Page({
902 935
903 936
904 937
  938 + //-- 如果是订单优惠的时候,allpice要拿来减掉一些 --
  939 + var order_prom_id=0;
  940 + var order_prom_amount=0;
  941 + if(ord_prom){
  942 + order_prom_id = ord_prom['id'];
  943 + switch (ord_prom['type']) {
  944 + case 0:
  945 + allpice = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折
  946 + order_prom_amount = (o_condition - order_m).toFixed(2);
  947 + break;
  948 + case 1:
  949 + //-- 如果有优惠促销倍减的时候 --
  950 + var bs = 1;
  951 + if (ord_prom.is_bz) {
  952 + bs = Math.floor(o_condition / ord_prom.money);
  953 + }
  954 + allpice = o_condition - bs * ord_prom['expression'];//满额优惠金额
  955 + order_prom_amount = ord_prom['expression'];
  956 + break;
  957 + }
  958 + }
  959 +
  960 + //--订单优惠的显示--
  961 + var order_prom_txt1 = "formData.order_prom_id";
  962 + var order_prom_txt2 = "formData.order_prom_amount";
  963 + if (order_prom_id > 0) {
  964 + th.setData({ [order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount })
  965 + } else {
  966 + th.setData({ [order_prom_txt1]: 0, [order_prom_txt2]: 0 })
  967 + }
  968 +
  969 + //-----------------总价-----------------
  970 + var total_m = parseFloat(allpice) + parseFloat(th.data.formData.shipping_price);
  971 + total_m = parseFloat(total_m).toFixed(2);
  972 +
905 var txt = "formData.user_money"; 973 var txt = "formData.user_money";
906 var txt2 = "formData.order_amount"; 974 var txt2 = "formData.order_amount";
907 var txt4 = "formData.use_commission"; 975 var txt4 = "formData.use_commission";
@@ -1008,11 +1076,22 @@ Page({ @@ -1008,11 +1076,22 @@ Page({
1008 'order_goods': new Array(), 1076 'order_goods': new Array(),
1009 }; 1077 };
1010 1078
1011 - //如果不是阶梯团,或者是普通购买,  
1012 - if ((th.data.kt_type != 3 || th.data.bn_goods.is_normal == 1)) {  
1013 - item['shipping_code'] = th.data.bn_exp_type == 1 ? 0 : th.data.wu_arr[th.data.index].code;  
1014 - item['shipping_name'] = th.data.bn_exp_type == 1 ? '' : th.data.wu_arr[th.data.index].name;  
1015 - } 1079 +
  1080 + //--判断有没有优惠活动--
  1081 + if (th.data.formData.order_prom_amount > 0) {
  1082 + var order_prom_list = {};
  1083 + order_prom_list.order_prom_id = th.data.formData.order_prom_id;
  1084 + order_prom_list.order_prom_amount = th.data.formData.order_prom_amount;
  1085 + item.order_prom_list = order_prom_list;
  1086 + }
  1087 +
  1088 +
  1089 +
  1090 + //如果不是阶梯团,或者是普通购买,
  1091 + if ((th.data.kt_type != 3 || th.data.bn_goods.is_normal == 1)) {
  1092 + item['shipping_code'] = th.data.bn_exp_type == 1 ? 0 : th.data.wu_arr[th.data.index].code;
  1093 + item['shipping_name'] = th.data.bn_exp_type == 1 ? '' : th.data.wu_arr[th.data.index].name;
  1094 + }
1016 1095
1017 if (!th.data.bn_goods.is_normal) { 1096 if (!th.data.bn_goods.is_normal) {
1018 item.is_zsorder = th.data.kt_type + 1; //开团类型 1097 item.is_zsorder = th.data.kt_type + 1; //开团类型
@@ -1140,6 +1219,7 @@ Page({ @@ -1140,6 +1219,7 @@ Page({
1140 getApp().request.delete("/api/weshop/cart/del/" + oo.stoid + "/" + list[i].id, {}); 1219 getApp().request.delete("/api/weshop/cart/del/" + oo.stoid + "/" + list[i].id, {});
1141 } 1220 }
1142 } 1221 }
  1222 +
1143 var order_amount = 0; 1223 var order_amount = 0;
1144 pdata.forEach(function (em, ind) { 1224 pdata.forEach(function (em, ind) {
1145 order_amount += em.order_amount; 1225 order_amount += em.order_amount;
pages/cart/cart2_pt/cart2_pt.wxml
@@ -160,7 +160,6 @@ @@ -160,7 +160,6 @@
160 <view>商品金额</view> 160 <view>商品金额</view>
161 <view class="co-red">¥ {{formData.all_price}}元</view> 161 <view class="co-red">¥ {{formData.all_price}}元</view>
162 </view> 162 </view>
163 -  
164 <view class="item" wx:else> 163 <view class="item" wx:else>
165 <view>定金金额</view> 164 <view>定金金额</view>
166 <view class="co-red">¥ {{formData.all_price}}元</view> 165 <view class="co-red">¥ {{formData.all_price}}元</view>
@@ -179,6 +178,11 @@ @@ -179,6 +178,11 @@
179 <view>使用余额</view> 178 <view>使用余额</view>
180 <view class="co-red">- ¥ {{formData.user_money}}元</view> 179 <view class="co-red">- ¥ {{formData.user_money}}元</view>
181 </view> 180 </view>
  181 + <!-- 订单优惠优惠金额 -->
  182 + <view class="item" wx:if="{{formData.order_prom_amount>0}}">
  183 + <view>订单优惠</view>
  184 + <view class="co-red">- ¥ {{filters.toFix(formData.order_prom_amount,2)}}元</view>
  185 + </view>
182 186
183 </view> 187 </view>
184 </view> 188 </view>
pages/cart/cart_wk/cart_wk.js
@@ -44,7 +44,10 @@ Page({ @@ -44,7 +44,10 @@ Page({
44 show_submit:0, //不线上 44 show_submit:0, //不线上
45 45
46 dis_config: null, 46 dis_config: null,
47 - bn_use_commission: 0 //是不是使用佣金 47 + bn_use_commission: 0, //是不是使用佣金
  48 +
  49 + bn_is_order_yh:1, //是不是订单优惠
  50 + bn_is_post_temp:1, //是不是进行计算包邮模板
48 }, 51 },
49 52
50 /** 53 /**
@@ -256,7 +259,28 @@ Page({ @@ -256,7 +259,28 @@ Page({
256 }); 259 });
257 260
258 261
  262 + var act_set=null;
  263 + var url = '/api/weshop/activitylist/getActInfo1/'+os.stoid+'/6/'+order.pt_prom_id;
  264 + await getApp().promiseGet(url, {}).then(res => {
  265 + if(res.data.code==0){
  266 + act_set=res.data.data;
  267 + }
  268 + })
  269 +
  270 +
  271 + if(act_set.is_order_yh){
  272 + th.data.bn_is_order_yh=1;
  273 + }else{
  274 + th.data.bn_is_order_yh=0;
  275 + }
  276 +
  277 + if(act_set.is_post_temp){
  278 + th.data.bn_is_post_temp=1;
  279 + }else{
  280 + th.data.bn_is_post_temp=0;
  281 + }
259 282
  283 +
260 var jsarr = JSON.parse(teamgroup.jt_json); 284 var jsarr = JSON.parse(teamgroup.jt_json);
261 var count = teamgroup.jt_ct_num; 285 var count = teamgroup.jt_ct_num;
262 if(teamgroup.is_xuni_ct) count=teamlist.ct_num; 286 if(teamgroup.is_xuni_ct) count=teamlist.ct_num;
@@ -315,8 +339,6 @@ Page({ @@ -315,8 +339,6 @@ Page({
315 } 339 }
316 340
317 341
318 -  
319 -  
320 switch (distr_type) { 342 switch (distr_type) {
321 case 0: 343 case 0:
322 exp_type = 1; 344 exp_type = 1;
@@ -371,27 +393,70 @@ Page({ @@ -371,27 +393,70 @@ Page({
371 }, 393 },
372 394
373 395
374 - calculatePrice2:function(){  
375 - wx.showLoading();  
376 - var th=this;  
377 - th.setData({submit:1})  
378 - //--计算物流--  
379 - if (th.data.exp_type == 0) {  
380 - th.calculate_wuliu();  
381 - } else { 396 + calculatePrice2: async function () {
  397 + wx.showLoading();
  398 + var th = this;
  399 + th.setData({submit: 1})
382 400
  401 + var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.tail_money;
  402 + var o_condition = allpice;
  403 + var ord_prom=null;
383 404
384 - var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.tail_money;  
385 - if(th.data.bn_use_commission){  
386 - allpice-=th.data.goods.use_commission;  
387 - }  
388 - allpice = allpice.toFixed(2); 405 + if (th.data.bn_is_order_yh) {
  406 + await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", {
  407 + data: {store_id: os.stoid, orderAmount: o_condition, user_id: getApp().globalData.user_id}
  408 + }).then(res => {
  409 + if (res.data.code == 0) {
  410 + ord_prom = res.data.data;
  411 + }
  412 + })
  413 + }
389 414
  415 + th.data.ord_prom=ord_prom;
390 416
  417 + //--计算物流--
  418 + if (th.data.exp_type == 0) {
  419 + th.calculate_wuliu();
  420 + } else {
  421 +
  422 + if (ord_prom) {
  423 + order_prom_id = ord_prom['id'];
  424 + switch (ord_prom['type']) {
  425 + case 0:
  426 + allpice = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折
  427 + order_prom_amount = (o_condition - order_m).toFixed(2);
  428 + break;
  429 + case 1:
  430 + //-- 如果有优惠促销倍减的时候 --
  431 + var bs = 1;
  432 + if (ord_prom.is_bz) {
  433 + bs = Math.floor(o_condition / ord_prom.money);
  434 + }
  435 + allpice = o_condition - bs * ord_prom['expression'];//满额优惠金额
  436 + order_prom_amount = ord_prom['expression'];
  437 + break;
  438 + }
  439 + }
  440 +
  441 + //--订单优惠的显示--
  442 + var order_prom_txt1 = "formData.order_prom_id";
  443 + var order_prom_txt2 = "formData.order_prom_amount";
  444 + if (order_prom_id > 0) {
  445 + th.setData({[order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount})
  446 + } else {
  447 + th.setData({[order_prom_txt1]: 0, [order_prom_txt2]: 0})
  448 + }
391 449
392 - th.setData({ exp_price: 0, allpice: allpice,submit:0,show_submit:1 })  
393 - wx.hideLoading(); 450 + if (th.data.bn_use_commission) {
  451 + allpice -= th.data.goods.use_commission;
394 } 452 }
  453 +
  454 +
  455 + allpice = allpice.toFixed(2);
  456 +
  457 + th.setData({exp_price: 0, allpice: allpice, submit: 0, show_submit: 1})
  458 + wx.hideLoading();
  459 + }
395 }, 460 },
396 461
397 //--图片失败,默认图片-- 462 //--图片失败,默认图片--
@@ -500,6 +565,17 @@ Page({ @@ -500,6 +565,17 @@ Page({
500 dd.use_commission=th.data.goods.use_commission; 565 dd.use_commission=th.data.goods.use_commission;
501 } 566 }
502 567
  568 + if(th.data.bn_use_commission){
  569 + dd.use_commission=th.data.goods.use_commission;
  570 + }
  571 +
  572 + //--判断有没有优惠活动--
  573 + if (th.data.formData.order_prom_amount > 0) {
  574 + var order_prom_list = {};
  575 + order_prom_list.order_prom_id = th.data.formData.order_prom_id;
  576 + order_prom_list.order_prom_amount = th.data.formData.order_prom_amount;
  577 + dd.order_prom_list = order_prom_list;
  578 + }
503 579
504 var arr = []; 580 var arr = [];
505 arr.push(dd); 581 arr.push(dd);
@@ -583,173 +659,243 @@ Page({ @@ -583,173 +659,243 @@ Page({
583 //----计算物流的钱---- 659 //----计算物流的钱----
584 async calculate_wuliu() { 660 async calculate_wuliu() {
585 //让按钮变灰色 661 //让按钮变灰色
586 - this.setData({submit:1}); 662 + this.setData({submit: 1});
587 var to = getApp(), th = this; 663 var to = getApp(), th = this;
588 //to.getwuliuprice(async function (rs) { 664 //to.getwuliuprice(async function (rs) {
589 - var o_shipping_price = 0, goods_weight = -1, goods_piece = -1, good = th.data.goods;  
590 - var out_of_weight = null; //超出多少重量 665 + var o_shipping_price = 0, goods_weight = -1, goods_piece = -1, good = th.data.goods;
  666 + var out_of_weight = null; //超出多少重量
  667 +
  668 + good.buynum = th.data.order.order_goods['goods_num'];
  669 + var gd_arr_list = [];
  670 + gd_arr_list.push(good);
  671 +
  672 + var ord_prom = this.data.ord_prom;
  673 + var order_prom_id=0;
  674 + var order_prom_amount=0;
  675 + //--全部金额--
  676 + var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.pt_tail_money;
  677 + // if(th.data.bn_use_commission){
  678 + // allpice-=th.data.goods.use_commission;
  679 + // }
  680 + var o_condition=allpice;
  681 +
  682 + //-----------当地址不为空,且是物流时,计算物流费用----------
  683 + if (th.data.user_addr != null && th.data.exp_type == 0 && good.is_free_shipping == 0) {
  684 +
  685 + //订单促销的包邮模板 和 活动的包邮模板要一起判断
  686 + if ((!ord_prom || ord_prom.is_post_temp) && th.data.bn_is_post_temp) {
  687 + var user_addr = th.data.user_addr;
  688 + var req_d = {
  689 + province: user_addr.province, city: user_addr.city, district: user_addr.district,
  690 + wuliu: parseFloat(allpice).toFixed(2), store_id: os.stoid
  691 + }
  692 + var back_data = null;
  693 + await getApp().request.promisePost("/api/weshop/order/areaFreight", {
  694 + is_json: 1, data: req_d
  695 + }).then(rs => {
  696 + if (rs.data.code == 0) back_data = rs.data.data;
  697 + });
  698 + }
591 699
592 - good.buynum=th.data.order.order_goods['goods_num'];  
593 - var gd_arr_list = [];  
594 - gd_arr_list.push(good); 700 + var cut_good_weight = 0;
  701 + for (let i in gd_arr_list) {
  702 + let item = gd_arr_list[i];
595 703
  704 + if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) {
596 705
  706 + if (item['exp_sum_type'] == 2 && back_data.weight_free > 0) {
  707 + if (goods_weight < 0) goods_weight = 0;
  708 + goods_weight += item['weight'] * item['buynum'];
  709 + cut_good_weight += item['weight'] * item['buynum'];
  710 + }
  711 + if (back_data.weight_free > 0) {
  712 + out_of_weight = (back_data.weight_free * 1000) - cut_good_weight;
  713 + }
  714 + continue;
  715 + }
597 716
  717 + switch (item['exp_sum_type']) {
  718 + case 1:
  719 + //统一运费
  720 + o_shipping_price += item['uniform_exp_sum'];
  721 + break;
  722 + case 2:
  723 + if (goods_weight < 0) goods_weight = 0;
  724 + //累积商品重量 每种商品的重量 * 数量
  725 + goods_weight += item['weight'] * item['buynum'];
  726 +
  727 + if (back_data && back_data.is_by_all && !back_data.no_free_goods) {
  728 + cut_good_weight += item['weight'] * item['buynum'];
  729 + if (back_data.weight_free > 0) {
  730 + out_of_weight = (back_data.weight_free * 1000) - cut_good_weight;
  731 + }
  732 + }
  733 + break;
  734 + case 3:
  735 + if (goods_piece < 0) goods_piece = 0;
  736 + //累积商品数量
  737 + goods_piece += item['buynum'];
  738 + break;
  739 + }
  740 + }
598 741
599 - //--全部金额--  
600 - var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.pt_tail_money;  
601 - // if(th.data.bn_use_commission){  
602 - // allpice-=th.data.goods.use_commission;  
603 - // } 742 + //如果是正值的时候
  743 + if (out_of_weight >= 0) out_of_weight = -cut_good_weight;
  744 + else out_of_weight = -back_data.weight_free * 1000;
  745 +
  746 + var code = th.data.wu_arr[th.data.index].code;
  747 +
  748 + //--------------开始计算物流------------------
  749 + var shipping_price = 0;
  750 + // ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,
  751 + // goods_piece, th.data.user_addr, back_data, rs);
  752 +
  753 + var w_data = {
  754 + store_id: os.stoid, code: code,
  755 + o_shipping_price: o_shipping_price,
  756 + goods_weight: goods_weight,
  757 + out_of_weight: out_of_weight, goods_piece: goods_piece,
  758 + user_addr_province: th.data.user_addr.province,
  759 + user_addr_city: th.data.user_addr.city,
  760 + user_addr_district: th.data.user_addr.district,
  761 + is_by_all: back_data && back_data.is_by_all ? 1 : 0,
  762 + no_free_goods: back_data && back_data.no_free_goods && back_data.no_free_goods.length > 0 ? 1 : 0,
  763 + }
604 764
605 - //-----------当地址不为空,且是物流时,计算物流费用----------  
606 - if (th.data.user_addr != null && th.data.exp_type == 0 && good.is_free_shipping == 0) { 765 + var is_ok = 0;
  766 + await getApp().request.promisePost('/api/weshop/order/getOrderWuLiPrice', {
  767 + data: w_data,
  768 + is_json: 1
  769 + }).then(res => {
  770 + if (res.data.code == 0) {
  771 + shipping_price = res.data.data;
  772 + is_ok = 1;
  773 + } else {
  774 + getApp().confirmBox("计算物流错误:" + res.data.msg);
  775 + }
  776 + })
  777 + if (!is_ok) {
  778 + th.setData({show_submit: 1});
  779 + wx.hideLoading();
  780 + return false;
  781 + }
607 782
608 - var user_addr=th.data.user_addr;  
609 - var req_d = {  
610 - province: user_addr.province, city: user_addr.city, district: user_addr.district,  
611 - wuliu: parseFloat(allpice).toFixed(2), store_id: os.stoid 783 + //-- 计算一下订单促销 --
  784 + if (ord_prom) {
  785 + order_prom_id = ord_prom['id'];
  786 + switch (ord_prom['type']) {
  787 + case 0:
  788 + allpice = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折
  789 + order_prom_amount = (o_condition - order_m).toFixed(2);
  790 + break;
  791 + case 1:
  792 + //-- 如果有优惠促销倍减的时候 --
  793 + var bs = 1;
  794 + if (ord_prom.is_bz) {
  795 + bs = Math.floor(o_condition / ord_prom.money);
612 } 796 }
613 - var back_data = null;  
614 - await getApp().request.promisePost("/api/weshop/order/areaFreight", {  
615 - is_json: 1, data: req_d  
616 - }).then(rs => {  
617 - if (rs.data.code == 0) back_data = rs.data.data;  
618 - });  
619 -  
620 - var cut_good_weight = 0;  
621 - for (let i in gd_arr_list) {  
622 - let item = gd_arr_list[i];  
623 -  
624 - if (back_data && back_data['is_by_all'] && (!back_data.no_free_goods || back_data.no_free_goods.indexOf(item.goods_id) == -1)) {  
625 -  
626 - if (item['exp_sum_type'] == 2 && back_data.weight_free > 0) {  
627 - if (goods_weight < 0) goods_weight = 0;  
628 - goods_weight += item['weight'] * item['buynum'];  
629 - cut_good_weight += item['weight'] * item['buynum'];  
630 - }  
631 - if (back_data.weight_free > 0) {  
632 - out_of_weight = (back_data.weight_free * 1000) - cut_good_weight;  
633 - }  
634 - continue;  
635 - } 797 + allpice = o_condition - bs * ord_prom['expression'];//满额优惠金额
  798 + order_prom_amount = ord_prom['expression'];
  799 + break;
  800 + }
  801 + }
636 802
637 - switch (item['exp_sum_type']) {  
638 - case 1:  
639 - //统一运费  
640 - o_shipping_price += item['uniform_exp_sum'];  
641 - break;  
642 - case 2:  
643 - if (goods_weight < 0) goods_weight = 0;  
644 - //累积商品重量 每种商品的重量 * 数量  
645 - goods_weight += item['weight'] * item['buynum'];  
646 -  
647 - if (back_data && back_data.is_by_all && !back_data.no_free_goods) {  
648 - cut_good_weight += item['weight'] * item['buynum'];  
649 - if (back_data.weight_free > 0) {  
650 - out_of_weight = (back_data.weight_free * 1000) - cut_good_weight;  
651 - }  
652 - }  
653 - break;  
654 - case 3:  
655 - if (goods_piece < 0) goods_piece = 0;  
656 - //累积商品数量  
657 - goods_piece += item['buynum'];  
658 - break;  
659 - }  
660 - } 803 + //--订单优惠的显示--
  804 + var order_prom_txt1 = "formData.order_prom_id";
  805 + var order_prom_txt2 = "formData.order_prom_amount";
  806 + if (order_prom_id > 0) {
  807 + th.setData({[order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount})
  808 + } else {
  809 + th.setData({[order_prom_txt1]: 0, [order_prom_txt2]: 0})
  810 + }
661 811
662 - //如果是正值的时候  
663 - if (out_of_weight >= 0) out_of_weight = -cut_good_weight;  
664 - else out_of_weight = -back_data.weight_free * 1000;  
665 -  
666 - var code = th.data.wu_arr[th.data.index].code;  
667 -  
668 - //--------------开始计算物流------------------  
669 - var shipping_price =0;  
670 - // ut.calculatewuliu(code, o_shipping_price, goods_weight, out_of_weight,  
671 - // goods_piece, th.data.user_addr, back_data, rs);  
672 -  
673 - var w_data={  
674 - store_id:os.stoid, code:code,  
675 - o_shipping_price:o_shipping_price,  
676 - goods_weight:goods_weight,  
677 - out_of_weight:out_of_weight,goods_piece:goods_piece,  
678 - user_addr_province:th.data.user_addr.province,  
679 - user_addr_city:th.data.user_addr.city,  
680 - user_addr_district:th.data.user_addr.district,  
681 - is_by_all:back_data && back_data.is_by_all?1:0,  
682 - no_free_goods:back_data && back_data.no_free_goods && back_data.no_free_goods.length>0?1:0,  
683 - }  
684 812
685 - var is_ok=0;  
686 - await getApp().request.promisePost('/api/weshop/order/getOrderWuLiPrice', {data:w_data,is_json:1}).then(res=>{  
687 - if(res.data.code==0){  
688 - shipping_price=res.data.data; is_ok=1;  
689 - }else{  
690 - getApp().confirmBox("计算物流错误:"+res.data.msg);  
691 - }  
692 - })  
693 - if(!is_ok){  
694 - th.setData({ show_submit:1 });  
695 - wx.hideLoading();  
696 - return false;  
697 - } 813 + var exp_price = parseFloat(shipping_price).toFixed(2);
  814 + allpice = parseFloat(exp_price) + parseFloat(allpice);
698 815
699 - var exp_price = parseFloat(shipping_price).toFixed(2);  
700 - allpice = parseFloat(exp_price) + parseFloat(allpice); 816 + if (allpice < th.data.goods.use_commission) {
  817 + if (th.data.bn_use_commission) {
  818 + wx.showToast({
  819 + title: '应付金额小于本单佣金,不可使用!',
  820 + icon: 'none',
  821 + duration: 2000
  822 + })
  823 + }
701 824
702 - if( allpice<th.data.goods.use_commission){  
703 - if(th.data.bn_use_commission){  
704 - wx.showToast({  
705 - title: '应付金额小于本单佣金,不可使用!',  
706 - icon: 'none',  
707 - duration: 2000  
708 - })  
709 - } 825 + th.setData({
  826 + bn_use_commission: 0
  827 + });
  828 + }
710 829
711 - th.setData({  
712 - bn_use_commission:0  
713 - });  
714 - }  
715 830
  831 + if (th.data.bn_use_commission) {
  832 + allpice -= th.data.goods.use_commission;
  833 + }
716 834
717 - if(th.data.bn_use_commission){  
718 - allpice-=th.data.goods.use_commission;  
719 - }  
720 835
  836 + allpice = allpice.toFixed(2);
721 837
722 - allpice = allpice.toFixed(2); 838 + exp_price = parseFloat(exp_price);
  839 + th.setData({exp_price: exp_price, allpice: allpice, submit: 0, show_submit: 1})
  840 + } else {
  841 + var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.tail_money;
  842 +
  843 +
  844 + //-- 计算一下订单促销 --
  845 + if (ord_prom) {
  846 + order_prom_id = ord_prom['id'];
  847 + switch (ord_prom['type']) {
  848 + case 0:
  849 + allpice = Math.round(o_condition * ord_prom['expression']) / 100;//满额打折
  850 + order_prom_amount = (o_condition - order_m).toFixed(2);
  851 + break;
  852 + case 1:
  853 + //-- 如果有优惠促销倍减的时候 --
  854 + var bs = 1;
  855 + if (ord_prom.is_bz) {
  856 + bs = Math.floor(o_condition / ord_prom.money);
  857 + }
  858 + allpice = o_condition - bs * ord_prom['expression'];//满额优惠金额
  859 + order_prom_amount = ord_prom['expression'];
  860 + break;
  861 + }
  862 + }
723 863
724 - exp_price = parseFloat(exp_price);  
725 - th.setData({ exp_price: exp_price, allpice: allpice,submit:0,show_submit:1 })  
726 - } else {  
727 - var allpice = th.data.order.order_amount + th.data.order.user_money + th.data.order.tail_money;  
728 -  
729 - if( allpice<th.data.goods.use_commission) {  
730 - if (th.data.bn_use_commission) {  
731 - wx.showToast({  
732 - title: '应付金额小于本单佣金,不可使用!',  
733 - icon: 'none',  
734 - duration: 2000  
735 - })  
736 - } 864 + //--订单优惠的显示--
  865 + var order_prom_txt1 = "formData.order_prom_id";
  866 + var order_prom_txt2 = "formData.order_prom_amount";
  867 + if (order_prom_id > 0) {
  868 + th.setData({[order_prom_txt1]: order_prom_id, [order_prom_txt2]: order_prom_amount})
  869 + } else {
  870 + th.setData({[order_prom_txt1]: 0, [order_prom_txt2]: 0})
  871 + }
737 872
738 - th.setData({  
739 - bn_use_commission: 0  
740 - });  
741 - }  
742 873
743 - if(th.data.bn_use_commission){  
744 - allpice-=th.data.goods.use_commission;  
745 - }  
746 874
747 - allpice = allpice.toFixed(2);  
748 - th.setData({ exp_price: 0, allpice: allpice,submit:0,show_submit:1}) 875 + if (allpice < th.data.goods.use_commission) {
  876 + if (th.data.bn_use_commission) {
  877 + wx.showToast({
  878 + title: '应付金额小于本单佣金,不可使用!',
  879 + icon: 'none',
  880 + duration: 2000
  881 + })
749 } 882 }
750 883
751 - wx.hideLoading();  
752 - //}); 884 + th.setData({
  885 + bn_use_commission: 0
  886 + });
  887 + }
  888 +
  889 + if (th.data.bn_use_commission) {
  890 + allpice -= th.data.goods.use_commission;
  891 + }
  892 +
  893 + allpice = allpice.toFixed(2);
  894 + th.setData({exp_price: 0, allpice: allpice, submit: 0, show_submit: 1})
  895 + }
  896 +
  897 + wx.hideLoading();
  898 + //});
753 899
754 }, 900 },
755 901
pages/cart/cart_wk/cart_wk.wxml
@@ -96,18 +96,24 @@ @@ -96,18 +96,24 @@
96 </view> 96 </view>
97 97
98 <!--尾款--> 98 <!--尾款-->
99 -<view class='chentuan bdr14' >  
100 - <view class='ct_one jc_sb'>  
101 - <view class='ct_one_left'>尾款金额</view>  
102 - <view class='ct_one_right'><text class='redwz'>¥{{order.tail_money}}</text> 99 +<view class='chentuan bdr14'>
  100 + <view class='ct_one jc_sb'>
  101 + <view class='ct_one_left'>尾款金额</view>
  102 + <view class='ct_one_right'>
  103 + <text class='redwz'>¥{{order.tail_money}}</text>
  104 + </view>
103 </view> 105 </view>
104 - </view>  
105 -  
106 - <view class='ct_one jc_sb' wx:if="{{exp_price>0}}">  
107 - <view class='ct_one_left'>配送费用</view>  
108 - <view class='ct_one_right'><text class='redwz'>¥{{exp_price}}</text> 106 + <view class='ct_one jc_sb' wx:if="{{exp_price>0}}">
  107 + <view class='ct_one_left'>配送费用</view>
  108 + <view class='ct_one_right'>
  109 + <text class='redwz'>¥{{exp_price}}</text>
  110 + </view>
  111 + </view>
  112 + <!-- 订单优惠优惠金额 -->
  113 + <view class="ct_one jc_sb" wx:if="{{formData.order_prom_amount>0}}">
  114 + <view>订单优惠</view>
  115 + <view class="co-red">- ¥ {{filters.toFix(formData.order_prom_amount, 2)}}</view>
109 </view> 116 </view>
110 - </view>  
111 </view> 117 </view>
112 118
113 119
@@ -128,7 +134,7 @@ @@ -128,7 +134,7 @@
128 <text class='zf_left_wz'>支付合计:</text> 134 <text class='zf_left_wz'>支付合计:</text>
129 <text class='zf_left_red'>¥{{filters.toFix(order.tail_money+exp_price,2)}}</text> 135 <text class='zf_left_red'>¥{{filters.toFix(order.tail_money+exp_price,2)}}</text>
130 </view> --> 136 </view> -->
131 - <view class='zf_left'>支付合计:<text class='zf_left_red'>¥{{filters.toFix(order.tail_money+exp_price-(bn_use_commission?goods.use_commission:0) ,2)}}</text></view> 137 + <view class='zf_left'>支付合计:<text class='zf_left_red'>¥{{filters.toFix(order.tail_money+exp_price-(bn_use_commission?goods.use_commission:0)-formData.order_prom_amount ,2)}}</text></view>
132 <view class="zf_btn {{submit?'gray':''}}" bindtap="to_pay">支付尾款</view> 138 <view class="zf_btn {{submit?'gray':''}}" bindtap="to_pay">支付尾款</view>
133 </view> 139 </view>
134 140
pages/goods/goodsInfo/goodsInfo.js
@@ -1782,7 +1782,7 @@ Page({ @@ -1782,7 +1782,7 @@ Page({
1782 } 1782 }
1783 }) 1783 })
1784 1784
1785 - } else if (th.data.prom_type == 0 || th.data.prom_type == 3 || th.data.prom_type == 4 || th.data.prom_type == 5 || th.data.prom_type == 10) { 1785 + } else if (th.data.prom_type == 0 || th.data.prom_type == 3 || th.data.prom_type == 5 || th.data.prom_type == 10) {
1786 newd.prom_type = 0; 1786 newd.prom_type = 0;
1787 newd.prom_id = 0; 1787 newd.prom_id = 0;
1788 1788
@@ -7380,7 +7380,7 @@ Page({ @@ -7380,7 +7380,7 @@ Page({
7380 let item = arr_data[i]; 7380 let item = arr_data[i];
7381 //找不到活动要剔除 7381 //找不到活动要剔除
7382 if (!item.act_name) continue; 7382 if (!item.act_name) continue;
7383 - if (item.prom_type != 1) continue; 7383 + if ([1,2,6].indexOf(item.prom_type)==-1) continue;
7384 new_arr.push(item); 7384 new_arr.push(item);
7385 } 7385 }
7386 7386
@@ -7399,8 +7399,9 @@ Page({ @@ -7399,8 +7399,9 @@ Page({
7399 //-- 跳转到秒杀商品详情页 -- 7399 //-- 跳转到秒杀商品详情页 --
7400 go_more_flash: function (e) { 7400 go_more_flash: function (e) {
7401 var prom_id = e.currentTarget.dataset.id; 7401 var prom_id = e.currentTarget.dataset.id;
  7402 + var prom_type = e.currentTarget.dataset.prom_type;
7402 var goods_id = this.data.data.goods_id; 7403 var goods_id = this.data.data.goods_id;
7403 - var url = "/pages/goods/goodsInfo/goodsInfo?goods_id=" + goods_id + "&prom_id=" + prom_id + "&prom_type=1"; 7404 + var url = "/pages/goods/goodsInfo/goodsInfo?goods_id=" + goods_id + "&prom_id=" + prom_id + "&prom_type="+prom_type;
7404 getApp().goto(url); 7405 getApp().goto(url);
7405 }, 7406 },
7406 7407
pages/goods/goodsInfo/goodsInfo.wxml
@@ -106,7 +106,7 @@ @@ -106,7 +106,7 @@
106 <image class="abs" style="width: 120rpx;top: 32rpx; right: 220rpx;" mode="widthFix" src='{{iurl+"/miniapp/images/activity-time.png"}}'></image> 106 <image class="abs" style="width: 120rpx;top: 32rpx; right: 220rpx;" mode="widthFix" src='{{iurl+"/miniapp/images/activity-time.png"}}'></image>
107 107
108 <image class="secondkill-img" src='{{iurl+"/miniapp/images/group_img.png"}}'></image> 108 <image class="secondkill-img" src='{{iurl+"/miniapp/images/group_img.png"}}'></image>
109 - <view class="stop fs26 abs" style="color: #fff;" style="color: #fff;top: 22rpx"> 109 + <view class="stop fs26 abs" style="color: #fff;top: 22rpx">
110 110
111 <block wx:if="{{prom_st==0 && !prom_r_null}}">开始时间</block> 111 <block wx:if="{{prom_st==0 && !prom_r_null}}">开始时间</block>
112 <block wx:else>结束时间</block> 112 <block wx:else>结束时间</block>
@@ -600,9 +600,11 @@ @@ -600,9 +600,11 @@
600 <block wx:for="{{more_flash}}"> 600 <block wx:for="{{more_flash}}">
601 <!-- <view class="cx-frame flex" style="position: relative; height: auto" wx:if="{{item.prom_type==1}}">--> 601 <!-- <view class="cx-frame flex" style="position: relative; height: auto" wx:if="{{item.prom_type==1}}">-->
602 <view class="cx-frame flex" style="position: relative; height: auto" > 602 <view class="cx-frame flex" style="position: relative; height: auto" >
603 - <view wx:if="{{item.prom_type==1}}" class="cx-sizs wsize" style="width: 144rpx">秒杀</view>  
604 - <view wx:if="{{item.prom_type==2}}" class="cx-sizs wsize" style="width: 144rpx">团购</view> 603 + <view wx:if="{{item.prom_type==1}}" class="cx-sizs wsize" style="width: 144rpx">秒杀</view>
  604 + <view wx:if="{{item.prom_type==2}}" class="cx-sizs wsize" style="width: 144rpx">团购</view>
605 <view wx:if="{{item.prom_type==4}}" class="cx-sizs wsize" style="width: 144rpx">积分购</view> 605 <view wx:if="{{item.prom_type==4}}" class="cx-sizs wsize" style="width: 144rpx">积分购</view>
  606 + <view wx:if="{{item.prom_type==6}}" class="cx-sizs wsize" style="width: 144rpx">天天拼单</view>
  607 +
606 <!-- 中间显示层 --> 608 <!-- 中间显示层 -->
607 <view class="flex ai-center jc_sb" style="width: 570rpx" bindtap="go_more_flash" data-prom_type="{{item.prom_type}}" data-id="{{item.act_id}}"> 609 <view class="flex ai-center jc_sb" style="width: 570rpx" bindtap="go_more_flash" data-prom_type="{{item.prom_type}}" data-id="{{item.act_id}}">
608 <view class="flex"> 610 <view class="flex">
@@ -610,6 +612,8 @@ @@ -610,6 +612,8 @@
610 <view wx:if="{{item.prom_type==1}}" class="miao_lab">秒</view> 612 <view wx:if="{{item.prom_type==1}}" class="miao_lab">秒</view>
611 <view wx:if="{{item.prom_type==2}}" class="miao_lab">团</view> 613 <view wx:if="{{item.prom_type==2}}" class="miao_lab">团</view>
612 <view wx:if="{{item.prom_type==4}}" class="miao_lab">积</view> 614 <view wx:if="{{item.prom_type==4}}" class="miao_lab">积</view>
  615 + <view wx:if="{{item.prom_type==6}}" class="miao_lab">拼</view>
  616 +
613 617
614 <view class="order_hui"> 618 <view class="order_hui">
615 <view class="fs28 ellipsis-1">{{item.act_name}}</view> 619 <view class="fs28 ellipsis-1">{{item.act_name}}</view>
@@ -1168,6 +1172,7 @@ @@ -1168,6 +1172,7 @@
1168 </view> 1172 </view>
1169 </block> 1173 </block>
1170 </block> 1174 </block>
  1175 +
1171 <!-- -----积分购------ --> 1176 <!-- -----积分购------ -->
1172 <block wx:if="{{prom_type==4}}"> 1177 <block wx:if="{{prom_type==4}}">
1173 <block wx:if="{{is_shopbuy}}"> 1178 <block wx:if="{{is_shopbuy}}">
@@ -1189,13 +1194,13 @@ @@ -1189,13 +1194,13 @@
1189 </view> 1194 </view>
1190 1195
1191 </block> --> 1196 </block> -->
1192 - <view class="buy-btn-all cart-btn" style="width: 30%; margin-left:1%;" wx:if="{{can_integral}}"> 1197 + <view class="buy-btn-all cart-btn" style="width: 30%;border-radius:0rpx 55rpx 55rpx 0rpx;" wx:if="{{can_integral}}">
1193 <!-- 立即兑换 --> 1198 <!-- 立即兑换 -->
1194 <!-- <view wx:if="{{ prom_act.show_time_off}}" >即将开始</view> --> 1199 <!-- <view wx:if="{{ prom_act.show_time_off}}" >即将开始</view> -->
1195 <view wx:if="{{ prom_act.show_time_off}}" style="background-color: #aaa;">即将开始</view> 1200 <view wx:if="{{ prom_act.show_time_off}}" style="background-color: #aaa;">即将开始</view>
1196 <view bindtap="go_pay_integral" wx:else>立即兑换</view> 1201 <view bindtap="go_pay_integral" wx:else>立即兑换</view>
1197 </view> 1202 </view>
1198 - <view class="buy-btn cart-btn" style="background-color: #aaa;" wx:else>积分不足</view> 1203 + <view class="buy-btn cart-btn" style="background-color: #aaa;border-radius:0rpx 55rpx 55rpx 0rpx;" wx:else>积分不足</view>
1199 </block> 1204 </block>
1200 <block wx:else> 1205 <block wx:else>
1201 <view class="buy-btn-all cart-btn" style="width: 58%; margin-left:1%;" wx:if="{{can_integral}}"> 1206 <view class="buy-btn-all cart-btn" style="width: 58%; margin-left:1%;" wx:if="{{can_integral}}">
@@ -1552,7 +1557,7 @@ @@ -1552,7 +1557,7 @@
1552 </view> 1557 </view>
1553 </view> 1558 </view>
1554 </view> 1559 </view>
1555 -<view class="mask" catchtouchmove="true" wx:if="{{showRules}}"></view> 1560 +<view class="mask" catchtouchmove="{{true}}" wx:if="{{showRules}}"></view>
1556 1561
1557 <!-- 选择门店的弹框,1.1版最新的 --> 1562 <!-- 选择门店的弹框,1.1版最新的 -->
1558 <block wx:if="{{store==1}}"> 1563 <block wx:if="{{store==1}}">
@@ -1734,7 +1739,7 @@ @@ -1734,7 +1739,7 @@
1734 <view class="t-c fs36" style="color: #c3172d">提示</view> 1739 <view class="t-c fs36" style="color: #c3172d">提示</view>
1735 1740
1736 <block wx:for="{{more_flash}}"> 1741 <block wx:for="{{more_flash}}">
1737 - <view bindtap="go_more_flash" data-id="{{item.act_id}}" class="flex jc_sb fs28 mt20" wx:if="{{item.prom_type==1}}"> 1742 + <view bindtap="go_more_flash" data-id="{{item.act_id}}" class="flex jc_sb fs28 mt20" >
1738 <view class="ellipsis-2" style="max-width: 80%">该商品有参与{{item.act_name}} {{tool.act_type(item.prom_type)}} 活动</view> 1743 <view class="ellipsis-2" style="max-width: 80%">该商品有参与{{item.act_name}} {{tool.act_type(item.prom_type)}} 活动</view>
1739 <view class="fs26 c-7b">去参与 1744 <view class="fs26 c-7b">去参与
1740 <text class="bg_jj is_more_cx"></text> 1745 <text class="bg_jj is_more_cx"></text>
@@ -1749,6 +1754,7 @@ @@ -1749,6 +1754,7 @@
1749 </view> 1754 </view>
1750 </view> 1755 </view>
1751 1756
  1757 +
1752 <view class="rule-pop-container" wx:if="{{showRules}}"> 1758 <view class="rule-pop-container" wx:if="{{showRules}}">
1753 <view class="pop-title">规则详情 1759 <view class="pop-title">规则详情
1754 <text class="iconfont icon-guan" bindtap="closeRules"></text> 1760 <text class="iconfont icon-guan" bindtap="closeRules"></text>
pages/goods/goodsList/g_filter.wxs deleted
1 -var g_filters = {  
2 - //-- 判断是不是有等级价 --  
3 - is_has_rank:function(rank_switch,item){  
4 - if(!rank_switch) return false;  
5 - if(item.cardprice1 || item.cardprice2 || item.cardprice3) {return true}  
6 - return false;  
7 - },  
8 -  
9 - //-- 判断,不是等级会员时候,要显示的最低等级价和名称 --  
10 - get_card_price:function(goods,all_card,type){  
11 - var price1=parseFloat(goods['cardprice1']);  
12 - var price2=parseFloat(goods['cardprice2']);  
13 - var price3=parseFloat(goods['cardprice3']);  
14 - if(!all_card){  
15 - if(type==0) return 0;  
16 - return "";  
17 - }  
18 -  
19 - var arr=[];  
20 - var min_price= 0;  
21 - var min_name="";  
22 -  
23 - var min_price=null;  
24 - var min_name=null;  
25 - //---设置对应的价格名字----  
26 - for(var i=0;i<3;i++) {  
27 - var vl=all_card[i];  
28 - if(!vl) continue;  
29 - if(vl['CorrPrice']=="Price1" && price1>0)  
30 - {  
31 - if(min_price==null) {  
32 - min_price=price1;min_name=vl['CardName'];  
33 - }  
34 - else if(price1<min_price) {  
35 - min_price=price1;min_name=vl['CardName'];  
36 - }  
37 - }  
38 - if(vl['CorrPrice']=="Price2" && price2>0)  
39 - {  
40 - if(min_price==null) {  
41 - min_price=price2;min_name=vl['CardName'];  
42 - }  
43 - else if(price2<min_price) {  
44 - min_price=price2;min_name=vl['CardName'];  
45 - }  
46 - }  
47 -  
48 - if(vl['CorrPrice']=="Price3" && price3>0)  
49 - {  
50 - if(min_price==null) {  
51 - min_price=price3;min_name=vl['CardName'];  
52 - }  
53 - else if(price3<min_price) {  
54 - min_price=price3;min_name=vl['CardName'];  
55 - }  
56 - }  
57 -  
58 - }  
59 - if(min_price==null){  
60 - if(type==0) return 0;  
61 - return "";  
62 - }  
63 -  
64 - //if(type==0) return arr.length;  
65 - //--进行排序,升序---  
66 - /*---  
67 - arr.sort(function(a,b){  
68 - if (a.price < b.price) {  
69 - return -1;  
70 - } else if (a.fee == b.fee) {  
71 - return 0;  
72 - } else {  
73 - return 1;  
74 - }  
75 - })--*/  
76 - //-- 获取最下价钱,和相应的卡的名称 --  
77 - if(type==0) return min_price.toFixed(2);  
78 -  
79 - if(min_name.length>4) min_name=min_name.substring(0, 8);  
80 - return min_name;  
81 - },  
82 -  
83 - //跳转的接口  
84 - get_goods_url:function(item){  
85 - var url1="/pages/goods/goodsInfo/goodsInfo?goods_id="+item.goods_id  
86 -  
87 - if(item.prom_type == 9) {  
88 - url1 = '/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo?goods_id=' + item.goods_id + '&group_id=' + item.prom_id;  
89 - }  
90 - if(item.prom_type==8){  
91 - url1="/packageC/pages/presell/goodsInfo/goodsInfo?goods_id="+item.goods_id+"&prom_id="+item.prom_id  
92 - }  
93 - if(item.prom_type==1 && item.prom_id>0 ){  
94 - url1="/pages/goods/goodsInfo/goodsInfo?goods_id="+item.goods_id+"&prom_id="+item.prom_id+"&prom_type=1";  
95 - }  
96 - return url1;  
97 - }  
98 -}  
99 -  
100 -module.exports = {  
101 - is_has_rank:g_filters.is_has_rank,  
102 - get_card_price:g_filters.get_card_price,  
103 - get_goods_url:g_filters.get_goods_url,  
104 -}  
105 \ No newline at end of file 0 \ No newline at end of file
pages/goods/goodsList/goodsList.wxml
1 -<wxs module="g_filter" src="g_filter.wxs"></wxs> 1 +<wxs module="g_filter" src="../search/g_filter.wxs"></wxs>
2 <view class="container" wx:if="{{show_all}}"> 2 <view class="container" wx:if="{{show_all}}">
3 <view> 3 <view>
4 <block wx:for="{{prom_goods_list}}"> 4 <block wx:for="{{prom_goods_list}}">
pages/goods/search/g_filter.wxs
@@ -91,9 +91,11 @@ var g_filters = { @@ -91,9 +91,11 @@ var g_filters = {
91 url1 = "/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo?goods_id=" + item.goods_id + "&group_id=" + item.prom_id 91 url1 = "/packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo?goods_id=" + item.goods_id + "&group_id=" + item.prom_id
92 } 92 }
93 93
94 - if (item.prom_type == 1 && item.prom_id > 0) {  
95 - url1 = "/pages/goods/goodsInfo/goodsInfo?goods_id=" + item.goods_id + "&prom_id=" + item.prom_id + "&prom_type=1"; 94 + if ([1,2,6].indexOf(item.prom_type)>-1 && item.prom_id > 0) {
  95 + url1 = "/pages/goods/goodsInfo/goodsInfo?goods_id=" + item.goods_id + "&prom_id=" + item.prom_id + "&prom_type="+item.prom_type;
96 } 96 }
  97 +
  98 +
97 return url1; 99 return url1;
98 } 100 }
99 } 101 }
utils/util.js
@@ -754,6 +754,15 @@ module.exports = { @@ -754,6 +754,15 @@ module.exports = {
754 } 754 }
755 }, 755 },
756 756
  757 + get_active_info:function(prom_type, prom_id,stoid,func) {
  758 + var url = '/api/weshop/activitylist/getActInfo1/'+stoid+'/'+prom_type+'/'+prom_id;
  759 + getApp().promiseGet(url, {}).then(res => {
  760 + if(res.data.code==0){
  761 + func(res.data.data);
  762 + }
  763 + })
  764 + },
  765 +
757 unserialize: unserialize, 766 unserialize: unserialize,
758 _throttle:_throttle, 767 _throttle:_throttle,
759 unserialize_o: unserialize_o, 768 unserialize_o: unserialize_o,