Commit c74d8634f9d33451c638194650e7758885ab45ee

Authored by yvan.ni
1 parent 8f93926e

搭配购的优化

packageE/pages/cart/cart2/cart2.js
@@ -1305,7 +1305,6 @@ Page({ @@ -1305,7 +1305,6 @@ Page({
1305 1305
1306 //-- 判断是不是可以收藏 -- 1306 //-- 判断是不是可以收藏 --
1307 if (gd.prom_type == 5 && !th.data.all_collocation_list.length) { 1307 if (gd.prom_type == 5 && !th.data.all_collocation_list.length) {
1308 -  
1309 await th.set_collection(gd); 1308 await th.set_collection(gd);
1310 } 1309 }
1311 1310
@@ -1488,7 +1487,7 @@ Page({ @@ -1488,7 +1487,7 @@ Page({
1488 1487
1489 1488
1490 //--搭配促销也是按照购物车的方式来计算优惠券-- 1489 //--搭配促销也是按照购物车的方式来计算优惠券--
1491 - if (gg.prom_type == 5) { 1490 + if (gg.prom_type == 5 && th.data.collocation_goods && th.data.collocation_goods.length>0 ) {
1492 var frozenQuan = null; 1491 var frozenQuan = null;
1493 var url0 = "/api/weshop/users/frozenQuan/listFrozenQuan/" + app.globalData.user_id; 1492 var url0 = "/api/weshop/users/frozenQuan/listFrozenQuan/" + app.globalData.user_id;
1494 app.request.promiseGet(url0, { 1: 1 }).then(res => { 1493 app.request.promiseGet(url0, { 1: 1 }).then(res => {
pages/goods/goodsInfo/goodsInfo.js
@@ -1469,6 +1469,7 @@ Page({ @@ -1469,6 +1469,7 @@ Page({
1469 }) 1469 })
1470 // return userbuynum 1470 // return userbuynum
1471 }, 1471 },
  1472 +
1472 //-- 加入购物的函数 -- 1473 //-- 加入购物的函数 --
1473 add_cart_func: function (t) { 1474 add_cart_func: function (t) {
1474 var i = getApp().request; 1475 var i = getApp().request;
@@ -1731,7 +1732,10 @@ Page({ @@ -1731,7 +1732,10 @@ Page({
1731 } 1732 }
1732 }) 1733 })
1733 1734
1734 - } else if (th.data.prom_type == 0 || th.data.prom_type == 3 || th.data.prom_type == 5 || th.data.prom_type == 10) { 1735 + }
  1736 +
  1737 + //要包含积分购的普通购买
  1738 + else if (th.data.prom_type == 0 || th.data.prom_type == 3 || newd.is_integral_normal || th.data.prom_type == 5 || th.data.prom_type == 10) {
1735 newd.prom_type = 0; 1739 newd.prom_type = 0;
1736 newd.prom_id = 0; 1740 newd.prom_id = 0;
1737 1741
@@ -2184,6 +2188,8 @@ Page({ @@ -2184,6 +2188,8 @@ Page({
2184 if(th.data.collocationGoods && newd.prom_type==0){ 2188 if(th.data.collocationGoods && newd.prom_type==0){
2185 newd.prom_type = 5; 2189 newd.prom_type = 5;
2186 newd.prom_id = th.data.collocationGoods.id; 2190 newd.prom_id = th.data.collocationGoods.id;
  2191 + newd.is_coupon= th.data.collocationGoods.is_coupon;
  2192 +
2187 } 2193 }
2188 2194
2189 //如果有搭配购的时候的时候 2195 //如果有搭配购的时候的时候
@@ -5075,6 +5081,12 @@ Page({ @@ -5075,6 +5081,12 @@ Page({
5075 if (e && e.act_id) { 5081 if (e && e.act_id) {
5076 newd['prom_type'] = e.prom_type; 5082 newd['prom_type'] = e.prom_type;
5077 newd['prom_id'] = e.act_id; 5083 newd['prom_id'] = e.act_id;
  5084 +
  5085 + //搭配购要把是否使用券带入
  5086 + if( newd['prom_type']==5 ){
  5087 + newd['is_coupon']=e.is_coupon;
  5088 + }
  5089 +
5078 } 5090 }
5079 5091
5080 if(e.prom_type==10){ 5092 if(e.prom_type==10){
@@ -7149,57 +7161,7 @@ Page({ @@ -7149,57 +7161,7 @@ Page({
7149 var th = this; 7161 var th = this;
7150 var user_id = getApp().globalData.user_id; 7162 var user_id = getApp().globalData.user_id;
7151 if (!user_id) user_id = 0; 7163 if (!user_id) user_id = 0;
7152 - //如果是普通购买的时候,要进行调用  
7153 - if (is_nor) {  
7154 - getApp().request.get("/api/weshop/goods/getGoodsPromNormal/" + os.stoid + "/" + gid, {  
7155 - success: function (res) {  
7156 - if (res.data.code == 0) {  
7157 - var r_data = res.data.data;  
7158 -  
7159 - //如果有  
7160 - if (r_data.ladderLists) {  
7161 - var act_id = r_data.ladderLists[0].form_id;  
7162 - //-- 判断会员能不能参与阶梯促销 --  
7163 - getApp().request.promiseGet("/api/weshop/prom/ladderForm/getNew/" + os.stoid + "/" + user_id + "/" + act_id, {}).then(res => {  
7164 - if (res.data.code == 0 && res.data.data) {  
7165 - var prom_content = "";  
7166 - for (let jj in r_data.ladderLists) {  
7167 - if (r_data.ladderLists[jj].discount == 10) {  
7168 - prom_content += "第" + (parseInt(jj) + 1) + "件原价,";  
7169 - } else {  
7170 - prom_content += "第" + (parseInt(jj) + 1) + "件" + r_data.ladderLists[jj].discount + "折,";  
7171 - }  
7172 - }  
7173 -  
7174 - //暂定优惠促销还不能重叠  
7175 - if(res.data.data.good_object==0 && (r_data.promGoodsLists || th.data.zh_act)){  
7176 - return false;  
7177 - }  
7178 -  
7179 - if(res.data.data.good_object==1){  
7180 - r_data.promGoodsLists=null;  
7181 - }  
7182 -  
7183 - prom_content = ut.sub_last(prom_content);  
7184 - th.data.prom_type = 10;  
7185 - th.data.prom_id = act_id;  
7186 - th.setData({  
7187 - jieti_prom: prom_content,  
7188 - ladder_act_id: act_id  
7189 - })  
7190 - }  
7191 - })  
7192 - }  
7193 -  
7194 - th.setData({  
7195 - prom_goods: r_data.promGoodsLists,  
7196 - })  
7197 - th.is_show_more_buy();  
7198 - }  
7199 - },  
7200 - })  
7201 7164
7202 - } else {  
7203 //调用接口判断订单优惠, 7165 //调用接口判断订单优惠,
7204 getApp().request.get("/api/weshop/goods/getGoodsPromListNew1/" + os.stoid + "/" + gid + "/0" + "/" + user_id, { 7166 getApp().request.get("/api/weshop/goods/getGoodsPromListNew1/" + os.stoid + "/" + gid + "/0" + "/" + user_id, {
7205 success: async function (res) { 7167 success: async function (res) {
@@ -7277,7 +7239,7 @@ Page({ @@ -7277,7 +7239,7 @@ Page({
7277 } 7239 }
7278 } 7240 }
7279 }) 7241 })
7280 - } 7242 +
7281 }, 7243 },
7282 7244
7283 closePoster() { 7245 closePoster() {
@@ -7443,6 +7405,74 @@ Page({ @@ -7443,6 +7405,74 @@ Page({
7443 7405
7444 //积分购和拼团的普通购买的的时候,要判断有没有全场优惠活动 7406 //积分购和拼团的普通购买的的时候,要判断有没有全场优惠活动
7445 check_nor_promgood(goods_id, back) { 7407 check_nor_promgood(goods_id, back) {
  7408 + var th=this;
  7409 + var user_id=getApp().globalData.user_id;
  7410 + //调用接口判断订单优惠,
  7411 + getApp().request.get("/api/weshop/goods/getGoodsPromListNew1/" + os.stoid + "/" + goods_id + "/0" + "/" + user_id, {
  7412 + success: async function (res) {
  7413 + if (res.data.code == 0 && res.data.data) {
  7414 +
  7415 + var obj = {};
  7416 + var r_data = res.data.data;
  7417 + //暂时积分够 不和 优惠,阶梯重叠
  7418 + if(th.data.zh_act){
  7419 + obj = {
  7420 + act_id: th.data.zh_act.id,
  7421 + prom_type:3
  7422 + }
  7423 + back(obj);
  7424 + return false;
  7425 + }
  7426 +
  7427 + if (r_data.collocationList) {
  7428 + obj = {
  7429 + act_id: r_data.collocationList[0].prom_id,
  7430 + prom_type:5
  7431 + }
  7432 + obj.is_coupon=r_data.collocationPromList.is_coupon;
  7433 + back(obj);
  7434 + return false;
  7435 + }
  7436 +
  7437 + if (r_data.ladderLists) {
  7438 + var act_id = r_data.ladderLists[0].form_id;
  7439 + //-- 判断会员能不能参与阶梯促销 --
  7440 + await getApp().request.promiseGet("/api/weshop/prom/ladderForm/getNew/" + os.stoid + "/" + user_id + "/" + act_id, {}).then(res => {
  7441 + if (res.data.code == 0 && res.data.data) {
  7442 + var prom_content = "";
  7443 + //暂定优惠促销还不能重叠
  7444 + if(res.data.data.good_object==0 && (r_data.promGoodsLists || th.data.zh_act)){
  7445 + return false;
  7446 + }
  7447 +
  7448 + if(res.data.data.good_object==1){
  7449 + r_data.promGoodsLists=null;
  7450 + }
  7451 + obj = {
  7452 + act_id: act_id,
  7453 + prom_type:10
  7454 + }
  7455 + back(obj);
  7456 + return false;
  7457 + }
  7458 + })
  7459 + }
  7460 +
  7461 + if(r_data.promGoodsLists){
  7462 + obj = {
  7463 + act_id: r_data.promGoodsLists[0].prom_id,
  7464 + prom_type:3
  7465 + }
  7466 + back(obj);
  7467 + return false;
  7468 + }
  7469 +
  7470 + }
  7471 + }
  7472 + })
  7473 +
  7474 +
  7475 +
7446 getApp().request.get("/api/weshop/goods/getGoodsPromNormal/" + os.stoid + "/" + goods_id, { 7476 getApp().request.get("/api/weshop/goods/getGoodsPromNormal/" + os.stoid + "/" + goods_id, {
7447 success: function (res) { 7477 success: function (res) {
7448 if (res.data.code == 0 && res.data.data) { 7478 if (res.data.code == 0 && res.data.data) {