diff --git a/components/promate_pop/promate_pop.wxss b/components/promate_pop/promate_pop.wxss
index cdfc171..0b1f70b 100644
--- a/components/promate_pop/promate_pop.wxss
+++ b/components/promate_pop/promate_pop.wxss
@@ -261,6 +261,7 @@
.xc-hook.on {
transform: rotate(-135deg);
background-color: #d60021;
+ font-size: 24rpx
}
@import '../../app.wxss';
diff --git a/packageB/pages/evaluate/evaluate.js b/packageB/pages/evaluate/evaluate.js
index 7768331..21b48b8 100644
--- a/packageB/pages/evaluate/evaluate.js
+++ b/packageB/pages/evaluate/evaluate.js
@@ -26,7 +26,8 @@ Page({
is_act:0, //是否能购获取图片
actId:0, //活动ID
giftBagId:0, //礼包ID
- ftype:0
+ ftype:0,
+ isdg:0, //是否是导购
},
//点击星级
@@ -242,6 +243,11 @@ Page({
this.setData({ftype:parseInt(options.fromtype)}) ;
if(options.fromtype==4 || options.fromtype==1 ) th.judge_act();
}
+ if (options.isdg) {
+ this.setData({
+ isdg:options.isdg
+ })
+ }
//th.query_bea();
var userinfo=getApp().globalData.userInfo;
@@ -288,8 +294,9 @@ Page({
console.log(id,"订单", this.data.number);
var ty=this.data.ftype?this.data.ftype:2;
+ var isdg = this.data.isdg
wx.redirectTo({
- url: "/pages/giftpack/evaluategift/evaluategift?actId="+id+ "&orderType="+ty+"&orderNumber="+this.data.number+"&isdg=1"
+ url: "/pages/giftpack/evaluategift/evaluategift?actId="+id+ "&orderType="+ty+"&orderNumber="+this.data.number+"&isdg="+isdg
});
},
diff --git a/packageD/pages/user/coupons/coupons.wxml b/packageD/pages/user/coupons/coupons.wxml
index 5236229..91861d3 100644
--- a/packageD/pages/user/coupons/coupons.wxml
+++ b/packageD/pages/user/coupons/coupons.wxml
@@ -64,8 +64,8 @@
- 使用说明:{{filter.getNum(detail.Sum)}}元优惠券,{{(detail.UseObjectID==null || detail.UseObjectID=='')?"全场通用":"仅限"+(detail.UseObjectName)+"使用"}},满 {{detail.BuySum==null || detail.BuySum==''?filter.getNum(0):filter.getNum(detail.BuySum)}}元使用 {{detail.region_list_name==null || detail.region_list_name==''?"":",不包邮地区:"+region_list_name}};{{detail.Remark1}};活动名称:{{detail.ActName}}、活动编号:{{detail.ActNo}}
- 使用说明: {{filter.getNum(detail.Sum)}}元优惠券,{{(detail.UseObjectID==null || detail.UseObjectID=='')?"全场通用":"仅限"+(detail.UseObjectName)+"使用"}},满 {{detail.BuySum==null || detail.BuySum==''?filter.getNum(0):filter.getNum(detail.BuySum)}}元使用 {{detail.region_list_name==null || detail.region_list_name==''?"":",不包邮地区:"+region_list_name}};活动名称:{{detail.ActName}}、活动编号:{{detail.ActNo}}
+ 使用说明:{{filter.getNum(detail.Sum)}}元优惠券,{{(detail.UseObjectID==null || detail.UseObjectID=='')?"全场通用":"仅限"+(detail.UseObjectName)+"使用"}},满 {{detail.BuySum==null || detail.BuySum==''?filter.getNum(0):filter.getNum(detail.BuySum)}}元使用 {{detail.region_list_name==null || detail.region_list_name==''?"":",不包邮地区:"+region_list_name}};{{detail.Remark1}};活动名称:{{detail.ActName}}、活动编号:{{detail.ActNo}}、使用场景:{{ (detail.UseRange && detail.UseRange !=0) ? (detail.UseRange==1 ? '仅线下可用' : '仅线上可用') :'通用'}}
+ 使用说明: {{filter.getNum(detail.Sum)}}元优惠券,{{(detail.UseObjectID==null || detail.UseObjectID=='')?"全场通用":"仅限"+(detail.UseObjectName)+"使用"}},满 {{detail.BuySum==null || detail.BuySum==''?filter.getNum(0):filter.getNum(detail.BuySum)}}元使用 {{detail.region_list_name==null || detail.region_list_name==''?"":",不包邮地区:"+region_list_name}};活动名称:{{detail.ActName}}、活动编号:{{detail.ActNo}}、使用场景:{{(detail.UseRange && detail.UseRange !=0) ? (detail.UseRange==1 ? '仅线下可用' : '仅线上可用') :'通用'}}
diff --git a/packageE/pages/cart/cart2/cart2.js b/packageE/pages/cart/cart2/cart2.js
index 9b65a58..763ac51 100644
--- a/packageE/pages/cart/cart2/cart2.js
+++ b/packageE/pages/cart/cart2/cart2.js
@@ -1294,7 +1294,7 @@ Page({
await m_cx.cart_cx_group(th, arr[k].goods, c_item, 0, 0, (show_can_cx) => {
arr[k].show_can_cx = show_can_cx;
- })
+ },2)
} else {
var show_can_cx = this.data.cartlist[k].show_can_cx;
//-- 多促销活动的优化 --
@@ -5103,6 +5103,26 @@ Page({
}
}
+ //看一下有没有活动不参与的,要记录到order_more表中
+ let can_cx=t_item.show_can_cx;
+ let is_user_no_yhcx=null;
+ for(let iu in can_cx){
+ if(can_cx[iu].no_cj_prom){
+
+ if(!is_user_no_yhcx) is_user_no_yhcx=[];
+ is_user_no_yhcx.push({
+ prom_id:can_cx[iu].cur_act.prom_id,
+ prom_type:can_cx[iu].cur_act.prom_type,
+ })
+ break;
+ }
+ }
+ //如果有活动不参与的,要记录到order_more表中
+ if(is_user_no_yhcx){
+ item.is_user_no_yhcx=JSON.stringify(is_user_no_yhcx);
+ }
+
+
//代发商品的集合
var df_goods = [];
var df_price = 0;
@@ -5112,7 +5132,8 @@ Page({
//此单的组合活动汇总
var zh_map_count={};
var check_map = {};
- let groupchat_ids=[]
+ let groupchat_ids=[];
+
//-------------让商品添加到商品列表--------------------
for (var k = 0; k < t_item.goods.length; k++) {
@@ -5473,6 +5494,8 @@ Page({
}
// debugger
var str = JSON.stringify(pdata);
+
+
wx.showLoading({ title: "加载中" });
th.setData({ submit: 1, })
diff --git a/packageG/pages/user/my_service/cosmetology_list.js b/packageG/pages/user/my_service/cosmetology_list.js
index 5d71119..900a7c1 100644
--- a/packageG/pages/user/my_service/cosmetology_list.js
+++ b/packageG/pages/user/my_service/cosmetology_list.js
@@ -22,13 +22,13 @@ Page({
projectId:"",//项目id
},
onReachBottom: function() {
- var th = this;
- if (this.data.total <= th.data.pageSize) return;
- if (this.data.ismore) return;
- wx.showLoading({
- title: '加载中...',
- })
- th.query_cology();
+ // var th = this;
+ // if (this.data.total <= th.data.pageSize) return;
+ // if (this.data.ismore) return;
+ // wx.showLoading({
+ // title: '加载中...',
+ // })
+ // th.query_cology();
},
query_cology: function() {
var th = this;
@@ -42,27 +42,31 @@ Page({
serviceId: itemId,
storageId: storageId,
page: th.data.curpage,
- pageSize: th.data.pageSize
+ pageSize: 100
}
}).then(res => {
wx.hideLoading();
if (res.data.code == 0) {
- th.data.curpage++;
+ // th.data.curpage++;
var arr1 = th.data.cosmetology_list;
var arr2 = res.data.data;
var arr3 = [...arr1, ...arr2];
-
-
th.setData({
cosmetology_list: arr3,
total: res.data.data.total,
is_service_read: 1,
is_cosmetology_read:1
}), wx.stopPullDownRefresh(); //停止下拉刷新
+ if (arr2.length < th.data.pageSize) {
+ th.setData({
+ is_cosmetology_read:1,
+ ismore:1
+ })
+ }
} else {
th.setData({
is_cosmetology_read:1,
- ismore:1
+ ismore:1
})
}
})
diff --git a/pages/cart/cart/cart.js b/pages/cart/cart/cart.js
index 9074bc8..fdb1f8a 100644
--- a/pages/cart/cart/cart.js
+++ b/pages/cart/cart/cart.js
@@ -855,6 +855,7 @@ Page({
item.selected = 0;
item.erpwareid = good.erpwareid; //要同步下线商品的id
item.shop_price = good.shop_price; //要同步下线商品的id
+ item.init_goods_price=good.goods_price;
//-- 读出每一种商品的所有的活动,方便后面的活动切换使用 --
if (item.prom_type == 0)
@@ -1559,6 +1560,10 @@ Page({
var fir = 0;
for (var j = 0; j < item.length; j++) {
if (item[j].is_gift) continue;
+
+ //把价格还原
+ item[j].goods_price=item[j].init_goods_price;
+
var obj = JSON.parse(JSON.stringify(item[j]));
var gd_info=obj;
@@ -2078,6 +2083,7 @@ Page({
this.data.btn_click = 1;
var garr = e.data.service_data;
+ //之前没有选中,代表现在要选中
if (!a.selected) {
//如果是标记的时候
@@ -2385,7 +2391,7 @@ Page({
//不需要修改价格
await m_cx.cart_cx_group(th, ite1, car[a], 0, n_ok, (show_can_cx) => {
rd_arr.push(show_can_cx)
- },1)
+ })
}
if(car.length>1 && c_ind>-1){
@@ -2393,7 +2399,7 @@ Page({
//检验和设置商品的最终是以 取用什么活动,因为多促销
await m_cx.cart_cx_group(th, ite2, car[c_ind], 0, n_ok, (show_can_cx) => {
rd_arr[c_ind]=show_can_cx;
- },1)
+ })
}
for (var a = 0; a < car.length; a++) {
@@ -4012,7 +4018,7 @@ Page({
//如果会员是等级会员,商品有等级价,且不是活动商品
if (card_field && val[card_field] > 0 &&
- ((val.prom_type == 0 && g_arr[i].prom_type == 0) || g_arr[i].prom_type == 3 || g_arr[i].prom_type == 5 || g_arr[i].prom_type == 7 || g_arr[i].prom_type == 10)) {
+ ((val.prom_type == 0 && g_arr[i].prom_type == 0) || g_arr[i].prom_type == 5 || g_arr[i].prom_type == 7 || g_arr[i].prom_type == 10)) {
if (g_arr[i].goods_price != val[card_field]) {
isok = 0;
gname = val.goods_name;
@@ -5104,8 +5110,11 @@ Page({
var th = this;
var car = JSON.parse(JSON.stringify(this.data.requestData));
- var item = car[c_idx].goods,
- is_s_sele = 1;
+ var item = car[c_idx].goods, is_s_sele = 1;
+
+ for (var i = 0; i < item.length; i++) {
+ item[i].goods_price = item[i].init_goods_price;
+ }
var is_has_other = 0;
for (var ii = 0; ii < car.length; ii++) {
@@ -5126,15 +5135,16 @@ Page({
}
//-- 让选择进入对应 --
for (var i = 0; i < item.length; i++) {
- if (sele_arr.hasOwnProperty(i)) {
- item[i].selected = sele_arr[i];
- }
+ if (sele_arr.hasOwnProperty(i)) {
+ item[i].selected = sele_arr[i];
+ }
}
+
//-- 先批量判断一下活动的类型,同时要同步跟新 --
m_cx.cart_cx_group(this, item, car[c_idx], 0, 0, (show_can_cx) => {
car[c_idx].show_can_cx = show_can_cx;
th.cx_check_ok2(func, car);
- },1);
+ });
},
@@ -5257,6 +5267,7 @@ Page({
}
}
}
+
func({
'code': 0,
'msg': '成功'
diff --git a/pages/cart/cart/cart.wxml b/pages/cart/cart/cart.wxml
index f1a1e78..d043fd7 100644
--- a/pages/cart/cart/cart.wxml
+++ b/pages/cart/cart/cart.wxml
@@ -193,16 +193,7 @@
再买{{item.diff}}元
件
- ,
- 免{{item.content.money}}元|
- 打{{item.content.sale}}折|
- 包邮|
- 送优惠券|
- 送积分|
- 送赠品|
- 送礼包|
- 送专享礼包|
- 送每月礼包|
+ ,{{g_filter.map_str(item.content)}}
去凑单>
diff --git a/pages/cart/cart/g_filter.wxs b/pages/cart/cart/g_filter.wxs
index cb1fc35..7d66e0f 100644
--- a/pages/cart/cart/g_filter.wxs
+++ b/pages/cart/cart/g_filter.wxs
@@ -35,6 +35,22 @@ var g_filters = {
if([1,2,4,6,8,9].indexOf(items.prom_type)>-1) return false;
if(!show_can_cx) return false;
return true;
+ },
+
+ //判断一下文件末尾的|号,促销显示送的内容
+ map_str:function (content){
+ var string='';
+ if(content.is_money==1) string+='免'+content.money+'元|';
+ if(content.is_sale==1) string+="打"+content.sale+"折|";
+ if(content.is_past==1) string+= "包邮|";
+ if(content.is_coupon==1) string+="送优惠券|";
+ if(content.is_int==1) string+="送积分|";
+ if(content.is_gift==1) string+="送赠品|";
+ if(content.is_libao==1) string+="送礼包|";
+ if(content.is_zxlibao==1) string+="送专享礼包|";
+ if(content.is_monthgiftbag==1) string+="送每月礼包|";
+ string=string.substring(0,string.length-1);
+ return string
}
}
@@ -44,5 +60,6 @@ module.exports = {
end_time: g_filters.end_time,
toFix: g_filters.toFix,
is_more_act: g_filters.is_more_act,
- check_show:g_filters.check_show
+ check_show:g_filters.check_show,
+ map_str:g_filters.map_str
}
\ No newline at end of file
diff --git a/pages/giftpack/evaluategift/evaluategift.js b/pages/giftpack/evaluategift/evaluategift.js
index 1c3f013..f1ef4ee 100644
--- a/pages/giftpack/evaluategift/evaluategift.js
+++ b/pages/giftpack/evaluategift/evaluategift.js
@@ -189,6 +189,9 @@ Page({
"giftBagId": th.data.giftBagId,
"buyFrom": 2
};
+ if (th.data.isdg) {
+ json.isdg=th.data.isdg
+ }
var data = JSON.stringify(json);
var url = th.data.url + "/api/weshop/marketing/free/receive/gift/record/insert";
getApp().request.json_post(url, json,
diff --git a/pages/user/index/index.js b/pages/user/index/index.js
index 03fc753..bfaaf4e 100644
--- a/pages/user/index/index.js
+++ b/pages/user/index/index.js
@@ -174,8 +174,11 @@ Page({
if (item.is_sy == 0) {
var now = Date.parse(new Date()); now = now / 1000;
if (item.end_time < now) {
- th.setData({ is_no_plus: 0 })
+ th.setData({ is_no_plus: 0 })
+ }else{
+ th.setData({ is_no_plus: 1 })
}
+
}else if(item.is_sy == 1){
th.setData({ is_no_plus: 1 })
}
diff --git a/pages/user/order_detail/order_detail.js b/pages/user/order_detail/order_detail.js
index 6e213e3..67f3291 100644
--- a/pages/user/order_detail/order_detail.js
+++ b/pages/user/order_detail/order_detail.js
@@ -178,6 +178,7 @@ Page({
r.use_commission=res.data.data.use_commission;
r.pre_cut=res.data.data.pre_cut; //预存款
r.pre_json=res.data.data.pre_json; //预存款
+ r.is_user_no_yhcx = res.data.data.is_user_no_yhcx; //判断订单是不是优惠促销不参与
}
})
@@ -822,6 +823,17 @@ Page({
})
+ if(gg.prom_type==3){
+ var prom_pc=null;
+ await getApp().request.promiseGet("/api/weshop/promgoods/get/" + os.stoid + "/" + gg.prom_id, {}).then(res => {
+ if (res.data.code == 0) { prom_pc = res.data.data; }
+ })
+
+ if(prom_pc){
+ gg.discount_field=prom_pc.discount_field;
+ }
+ }
+
if ((gg.prom_type == 1 || gg.prom_type == 2 || gg.prom_type == 4 || gg.prom_type == 6 || gg.prom_type == 8 || gg.prom_type == 9)
&& !good.is_collocation && !good.is_gift && !good.is_integral_normal && !good.is_pd_normal) {
var prom = null;
@@ -900,6 +912,7 @@ Page({
})
+ //商品的订单列表的活动类型,和gg参与的类型不一致
if(good.prom_type != gg.prom_type && good.prom_id != gg.prom_id){
//如果商品有单独的活动的是偶
switch (gg.prom_type){
@@ -912,19 +925,66 @@ Page({
case 3:
var prom=null;
var yh_check=1;
- await getApp().request.promiseGet("/api/weshop/promgoods/get/" + os.stoid + "/" + gg.prom_id, {}).then(res => {
- if (res.data.code == 0) { prom = res.data.data; }
- })
- if (prom && prom.limit_num) {
- var limit_num = prom.limit_num;
- var user_pre_buynum = await this.getUserBuyPromNum_pre(prom.id)
- if (limit_num>0 && user_pre_buynum >= limit_num) {
+
+
+ //如果有优惠促销的普通购买的时候
+ if(order.is_user_no_yhcx && good.prom_type==0 && order.is_user_no_yhcx!='0' && order.is_user_no_yhcx!='null' ){
+ let obj=JSON.parse(order.is_user_no_yhcx);
+ //obj数组使用find函数快速查找
+ if(obj.find((item)=>{return item.prom_id==gg.prom_id && item.prom_type==3})){
yh_check=0;
}
}
+
+ //判断优惠促销活动的限购
+ if(yh_check){
+ await getApp().request.promiseGet("/api/weshop/promgoods/get/" + os.stoid + "/" + gg.prom_id, {}).then(res => {
+ if (res.data.code == 0) { prom = res.data.data; }
+ })
+ if (prom && prom.limit_num) {
+ var limit_num = prom.limit_num;
+ var user_pre_buynum = await this.getUserBuyPromNum_pre(prom.id)
+ if (limit_num>0 && user_pre_buynum >= limit_num) {
+ yh_check=0;
+ }
+ }
+ }
+
+ //--- 要判断一下优惠促销的商品的限购 ---
+ if(yh_check){
+ var pro_gd_limit_num=0;
+ var p_limit_rs= await getApp().request.promisePost('/api/weshop/promgoods/getPromGoodsLimitNum',{
+ data:{
+ store_id:os.stoid,goods_id:gg.goods_id,prom_id:gg.prom_id,prom_type:3
+ }
+ })
+ if(p_limit_rs && p_limit_rs.data.code==0){
+ pro_gd_limit_num=p_limit_rs.data.data
+ }
+ //-- 如果有商品限购的时候 --
+ if(pro_gd_limit_num>0){
+ var pro_by_num=0;
+ var lrs= {
+ store_id: os.stoid,user_id: getApp().globalData.user_id,
+ goods_id: gg.goods_id, prom_type: 3,
+ prom_id: gg.prom_id, isnew:1
+ };
+ var gd_limit_rs=await getApp().promiseGet('/api/weshop/ordergoods/getUserBuyGoodsNum',{data:lrs});
+ if(gd_limit_rs && gd_limit_rs.data.code==0){
+ pro_by_num=gd_limit_rs.data.data.promgoodsbuynum
+ }
+ if(pro_gd_limit_num 0) {
- if (good.goods_price != gg[card_field] && good.offline_cut <= 0) isok = 0;
- if (good.goods_price > gg[card_field] && good.offline_cut > 0) isok = 0; //如果线下价格比较贵,则不通过
- } else {
- if (good.goods_price != gg.shop_price && good.offline_cut <= 0) isok = 0;
- if (good.goods_price > gg.shop_price && good.offline_cut > 0) isok = 0; //如果线下价格比较贵,则不通过
+ //-- 优惠促销的时候控制取价规则 --
+ if(gg.prom_type!=3 || gg.discount_field==undefined || gg.discount_field==0 ) {
+ if (card_field && gg[card_field] > 0) {
+ if (good.goods_price != gg[card_field] && good.offline_cut <= 0) isok = 0;
+ if (good.goods_price > gg[card_field] && good.offline_cut > 0) isok = 0; //如果线下价格比较贵,则不通过
+
+ } else {
+ if (good.goods_price != gg.shop_price && good.offline_cut <= 0) isok = 0;
+ if (good.goods_price > gg.shop_price && good.offline_cut > 0) isok = 0; //如果线下价格比较贵,则不通过
+ }
+ }else{
+ if(good.prom_type==3){
+ switch (gg.discount_field){
+ case 1:
+ if (good.goods_price != gg.shop_price) isok = 0;
+ break;
+ case 2:
+ if (good.goods_price != gg.market_price) isok = 0;
+ break;
+ }
+ }
}
+
var is_h = 0;
if (!isok) {
-
var content = gg.goods_name + '商品的价格发生了变化,请取消订单重新购买1'
th.toast(content);
th.setData({ paying: 0 });
@@ -2310,8 +2392,24 @@ Page({
//-- 查看物流 --
go_wuliu:function (e) {
getApp().go_wuliu(e);
- }
+ },
+ //优惠促销用户参与次数,is_buy=1,表示只获取支付了的
+ async getUserBuyPromNum_pre(prom_id,is_buy) {
+ var userInfo = getApp().globalData.userInfo;
+ var url = `/api/weshop/ordergoods/getUserBuyPromNum?is_all=1&store_id=${os.stoid}&user_id=${userInfo.user_id}&prom_type=3&prom_id=${prom_id}`;
+ if(is_buy){
+ url = `/api/weshop/ordergoods/getUserBuyPromNum?store_id=${os.stoid}&user_id=${userInfo.user_id}&prom_type=3&prom_id=${prom_id}`;
+ }
+ let res = await getApp().request.promiseGet(url, {
+ data: {}
+ });
+ let user_pre_buynum = 0
+ if (res.data.code == 0 && res.data.data) {
+ user_pre_buynum = res.data.data.userbuynum
+ }
+ return user_pre_buynum
+ }
diff --git a/pages/user/order_list/order_list.js b/pages/user/order_list/order_list.js
index e10c404..4b57630 100644
--- a/pages/user/order_list/order_list.js
+++ b/pages/user/order_list/order_list.js
@@ -17,6 +17,8 @@ var ut = require('../../../utils/util.js');
var t = require("../../../utils/pay.js");
var t_pay = require("../../../utils/pay2.js");
+
+
Page({
data: {
url: e.globalData.setting.url,
@@ -410,6 +412,7 @@ Page({
data[ind].use_commission = res.data.data.use_commission;
data[ind].pre_cut = res.data.data.pre_cut; //是否使用预存,如果是使用预存不能单品退,只能整单退
data[ind].pre_json = res.data.data.pre_json; //是否使用预存,如果是使用预存不能单品退,只能整单退
+ data[ind].is_user_no_yhcx = res.data.data.is_user_no_yhcx; //判断订单是不是优惠促销不参与
}
})
@@ -1105,13 +1108,25 @@ Page({
return e.s_time < ut.gettimestamp() || (e.warm_uptime && e.warm_uptime < ut.gettimestamp())
})
if (arr2.length == 1) {
- gg.prom_type=arr2[0].prom_type;
- gg.prom_id=arr2[0].act_id;
+ gg.prom_type=arr2[0].prom_type;
+ gg.prom_id=arr2[0].act_id;
}
}
})
+ if(gg.prom_type==3){
+ var prom_pc=null;
+ await getApp().request.promiseGet("/api/weshop/promgoods/get/" + os.stoid + "/" + gg.prom_id, {}).then(res => {
+ if (res.data.code == 0) { prom_pc = res.data.data; }
+ })
+
+ if(prom_pc){
+ gg.discount_field=prom_pc.discount_field;
+ }
+ }
+
+
if ((gg.prom_type == 1 || gg.prom_type == 2 || gg.prom_type == 4 || gg.prom_type == 6 || gg.prom_type == 8 || gg.prom_type == 9)
&& !good.is_collocation && !good.is_gift && !good.is_integral_normal && !good.is_pd_normal) {
var prom = null;
@@ -1189,6 +1204,7 @@ Page({
})
+ //商品的订单列表的活动类型,和gg参与的类型不一致
if(good.prom_type != gg.prom_type && good.prom_id != gg.prom_id){
//如果商品有单独的活动的是偶
switch (gg.prom_type){
@@ -1201,21 +1217,69 @@ Page({
case 3:
var prom=null;
var yh_check=1;
- await getApp().request.promiseGet("/api/weshop/promgoods/get/" + os.stoid + "/" + gg.prom_id, {}).then(res => {
- if (res.data.code == 0) { prom = res.data.data; }
- })
- if (prom && prom.limit_num) {
- var limit_num = prom.limit_num;
- var user_pre_buynum = await this.getUserBuyPromNum_pre(prom.id)
- if (limit_num>0 && user_pre_buynum >= limit_num) {
- yh_check=0;
+
+
+ //如果有优惠促销的普通购买的时候
+ if(order.is_user_no_yhcx && good.prom_type==0 && order.is_user_no_yhcx!='0' && order.is_user_no_yhcx!='null' ){
+ let obj=JSON.parse(order.is_user_no_yhcx);
+ //obj数组使用find函数快速查找
+ if(obj.find((item)=>{return item.prom_id==gg.prom_id && item.prom_type==3})){
+ yh_check=0;
+ }
+ }
+
+ //判断优惠促销活动的限购
+ if(yh_check){
+ await getApp().request.promiseGet("/api/weshop/promgoods/get/" + os.stoid + "/" + gg.prom_id, {}).then(res => {
+ if (res.data.code == 0) { prom = res.data.data; }
+ })
+ if (prom && prom.limit_num) {
+ var limit_num = prom.limit_num;
+ var user_pre_buynum = await this.getUserBuyPromNum_pre(prom.id)
+ if (limit_num>0 && user_pre_buynum >= limit_num) {
+ yh_check=0;
+ }
+ }
+ }
+
+ //--- 要判断一下优惠促销的商品的限购 ---
+ if(yh_check){
+ var pro_gd_limit_num=0;
+ var p_limit_rs= await getApp().request.promisePost('/api/weshop/promgoods/getPromGoodsLimitNum',{
+ data:{
+ store_id:os.stoid,goods_id:gg.goods_id,prom_id:gg.prom_id,prom_type:3
+ }
+ })
+ if(p_limit_rs && p_limit_rs.data.code==0){
+ pro_gd_limit_num=p_limit_rs.data.data
+ }
+ //-- 如果有商品限购的时候 --
+ if(pro_gd_limit_num>0){
+ var pro_by_num=0;
+ var lrs= {
+ store_id: os.stoid,user_id: getApp().globalData.user_id,
+ goods_id: gg.goods_id, prom_type: 3,
+ prom_id: gg.prom_id, isnew:1
+ };
+ var gd_limit_rs=await getApp().promiseGet('/api/weshop/ordergoods/getUserBuyGoodsNum',{data:lrs});
+ if(gd_limit_rs && gd_limit_rs.data.code==0){
+ pro_by_num=gd_limit_rs.data.data.promgoodsbuynum
+ }
+ if(pro_gd_limit_num 0) {
- if (good.goods_price != gg[card_field] && good.offline_cut <= 0) isok = 0;
- if (good.goods_price > gg[card_field] && good.offline_cut > 0) isok = 0; //如果线下价格比较贵,则不通过
- } else {
- if (good.goods_price != gg.shop_price && good.offline_cut <= 0) isok = 0;
- if (good.goods_price > gg.shop_price && good.offline_cut > 0) isok = 0; //如果线下价格比较贵,则不通过
+
+ //-- 优惠促销的时候控制取价规则 --
+ if(gg.prom_type!=3 || gg.discount_field==undefined || gg.discount_field==0 ){
+ if (card_field && gg[card_field] > 0) {
+ if (good.goods_price != gg[card_field] && good.offline_cut <= 0) isok = 0;
+ if (good.goods_price > gg[card_field] && good.offline_cut > 0) isok = 0; //如果线下价格比较贵,则不通过
+
+ } else {
+ if (good.goods_price != gg.shop_price && good.offline_cut <= 0) isok = 0;
+ if (good.goods_price > gg.shop_price && good.offline_cut > 0) isok = 0; //如果线下价格比较贵,则不通过
+ }
+ }else{
+
+ if(good.prom_type==3){
+ switch (gg.discount_field){
+ case 1:
+ if (good.goods_price != gg.shop_price) isok = 0;
+ break;
+ case 2:
+ if (good.goods_price != gg.market_price) isok = 0;
+ break;
+ }
+ }
}
+
+
var is_h = 0;
if (!isok) {
diff --git a/utils/more_cx.js b/utils/more_cx.js
index ca5b7d6..60524a0 100644
--- a/utils/more_cx.js
+++ b/utils/more_cx.js
@@ -364,8 +364,29 @@ module.exports = {
return g_item.goods_id==ck_prom_type.goods[b].goods_id && [0,3,5,7,10].indexOf(g_item.prom_type)>-1;
})
if(fg>-1){
+
+ goods[fg].goods_price = goods[fg].init_goods_price;
goods[fg].prom_type=ck_prom_type.prom_type;
goods[fg].prom_id=ck_prom_type.prom_id;
+
+ if(ck_prom_type.prom_type==3){
+ let ffd=th.data.in_yhact[ck_prom_type.prom_id];
+ let f_price = goods[fg].goods_price;
+ if (ffd.discount_field != undefined) {
+ switch (ffd.discount_field) {
+ case 0:
+ f_price = goods[fg].goods_price;
+ break;
+ case 1:
+ f_price = goods[fg].shop_price;
+ break;
+ case 2:
+ f_price = goods[fg].goods_market_price;
+ break;
+ }
+ }
+ goods[fg].goods_price = f_price;
+ }
}
}
@@ -402,8 +423,12 @@ module.exports = {
//-- 促销活动对象表,最初的map表,包含活动类型,活动id,goods商品 ---
var cx_act_map=[];
for(var i=0; i-1){
goods[fg].prom_type=ck_prom_type.prom_type;
goods[fg].prom_id=ck_prom_type.prom_id;
+
+ if(ck_prom_type.prom_type==3 && (is_no_change!=2 || ck_prom_type.is_no_ok!=1) ){
+ let ffd=th.data.in_yhact[ck_prom_type.prom_id];
+ let f_price = goods[fg].goods_price;
+ if (ffd.discount_field != undefined) {
+ switch (ffd.discount_field) {
+ case 0:
+ f_price = goods[fg].goods_price;
+ break;
+ case 1:
+ f_price = goods[fg].shop_price;
+ break;
+ case 2:
+ f_price = goods[fg].goods_market_price;
+ break;
+ }
+ }
+ goods[fg].goods_price = f_price;
+ }
}
}
}