diff --git a/packageA/pages/goodsInfo/buy_flash_normal.wxml b/packageA/pages/goodsInfo/buy_flash_normal.wxml
new file mode 100644
index 0000000..638a9da
--- /dev/null
+++ b/packageA/pages/goodsInfo/buy_flash_normal.wxml
@@ -0,0 +1,141 @@
+
+
+
+
+
+
+
+ {{data.goods_name}}
+
+ ¥{{data.shop_price}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{def_pick_store.pickup_name}}
+
+ 距离:{{def_pick_store.distance>1000?filters.toFix(def_pick_store.distance/1000,2)+"km":filters.toFix(def_pick_store.distance,0)+"m"}}
+
+
+
+
+
+
+
+ 选择门店
+
+
+ 更多门店
+
+ (库存不足)
+
+ (库存不足)
+
+ (配送不匹配)
+ (库存不足)
+
+
+ 地址:{{def_pick_store.fulladdress}}
+
+
+
+
+
+
+ 购买数量
+
+ -
+
+ +
+
+
+
+
+
+
+
+ 再买{{hui_condition.need}}
+ ,免{{hui_condition.money}}元
+ ,打{{hui_condition.sale}}折
+ ,包邮
+ ,送{{hui_condition.intValue}}积分
+ ,送优惠券
+ ,送赠品
+ ,送礼包
+ ,送专享礼包
+
+
+
+
+
+
+
+
+ 配送不匹配
+
+
+
+
+ 库存不足
+
+
+
+
+
+ 库存不足
+
+
+
+ 库存不足
+
+
+
+ 请先选择门店
+
+
+
+ 库存不足
+
+
+
+ 加入购物车
+ 立即购买
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/packageA/pages/goodsInfo/goodsInfo.js b/packageA/pages/goodsInfo/goodsInfo.js
index 1473296..9022cbf 100644
--- a/packageA/pages/goodsInfo/goodsInfo.js
+++ b/packageA/pages/goodsInfo/goodsInfo.js
@@ -207,7 +207,7 @@ Page({
sto_sele_name_1:'',//分享的门店名称
// 秒杀
- prom_st: 1,
+ prom_st: 0,
prom_r_null: 0,
hiddenCS: true, //控制客服操作菜单显示和控制
@@ -700,6 +700,7 @@ Page({
that.setData({
'data.goods_name': t.data.data.serviceName,
'data.shop_price': t.data.data.money,
+ 'data.show_price': t.data.data.show_price,
'data.validDays': t.data.data.validDays,
'data.serviceContent': t.data.data.serviceContent,
'data.image_url': t.data.data.imgUrl,
@@ -877,20 +878,20 @@ Page({
//000000
- if(this.data.options.prom_type == 1) {
- var t = th.data.goodsInputNum;
+ if(this.data.options.prom_type == 1 && !this.data.prom_act.is_shop_buy) {
+ var t = th.data.goodsInputNum + 1;
th.data.sele_g.viplimited = th.data.sele_g.buy_limit;
if (th.data.sele_g.viplimited > 0) {
var gd_buy_num = th.data.sele_g.buy_num;
- if (t + gd_buy_num >= th.data.sele_g.viplimited) {
+ if (t + gd_buy_num > th.data.sele_g.viplimited) {
wx.showModal({
title: '超出商品限购',
});
- // var num = th.data.sele_g.viplimited - gd_buy_num;
- // if (num < 0) num = th.data.sele_g.viplimited;
- th.setData({goodsInputNum: 0});
+ let num = th.data.sele_g.viplimited - gd_buy_num;
+ if (num < 0) num = 0;
+ th.setData({goodsInputNum: num});
return false;
}
};
@@ -919,7 +920,12 @@ Page({
newd['prom_type'] = this.data.prom_type;
newd['prom_id'] = this.data.prom_id;
newd['prom_price'] = this.data.prom_price;
- }
+ };
+
+ if(this.data.prom_act.is_shop_buy) {
+ newd['prom_type'] = 0;
+ newd['prom_price'] = this.data.data.shop_price;
+ };
// console.log('newd++++++++', newd);
th.buyNow(newd);
@@ -1025,90 +1031,107 @@ Page({
//------检查数量是不是超出限购------
checkCartNum: function(t) {
- if(t<=0) return false;
- var th = this;
- th.setData({goodsInputNum:t});
-
-
var th = this;
- this.get_buy_num(this.data.sele_g, async function () {
- th.data.sele_g.viplimited = th.data.sele_g.buy_limit;
-
- //--判断商品是否超出限购--
- // if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) {
- if (th.data.sele_g.viplimited > 0) {
- var gd_buy_num = th.data.sele_g.buy_num;
-
- if (t + gd_buy_num > th.data.sele_g.viplimited) {
- wx.showModal({
- title: '超出商品限购',
- });
- var num = th.data.sele_g.viplimited - gd_buy_num;
- if (num < 0) num = 0;
- th.setData({goodsInputNum: num})
- return false;
- }
- }
-
- //如果是普通购买的情况下
- if(th.data.openSpecModal_flash_normal) th.data.is_normal=1;
+ // if(this.data.prom_act.is_shop_buy && this.data.options.prom_type != 1) {
+ // if(th.data.is_normal) {
+
+ if(t<=0) return false;
+ th.setData({goodsInputNum:t});
+ // } else {
- //--判断商品是否超出活动限购--
- if (th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0 && !th.data.is_normal) {
- if (t + th.data.prom_buy_num > th.data.prom_buy_limit) {
- wx.showModal({
- title: '超出商品活动限购',
- });
+ if(this.data.options.prom_type == 1 && !this.data.openSpecModal_flash_normal) {
+
+ this.get_buy_num(this.data.sele_g, async function () {
+ th.data.sele_g.viplimited = th.data.sele_g.buy_limit;
+
+ //--判断商品是否超出限购--
+ // if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) {
+ if(!th.data.prom_act.is_shop_buy) {
+
+ if (th.data.sele_g.viplimited > 0) {
+ var gd_buy_num = th.data.sele_g.buy_num;
+
+ if (t + gd_buy_num> th.data.sele_g.viplimited) {
+ wx.showModal({
+ title: '超出商品限购',
+ });
+
+ var num = th.data.sele_g.viplimited - gd_buy_num;
+ if (num < 0) num = 0;
+ th.setData({goodsInputNum: num})
+ return false;
+ }
+ }
+
+ };
+
+
+ //如果是普通购买的情况下
+ if(th.data.openSpecModal_flash_normal) th.data.is_normal=1;
+
+ //--判断商品是否超出活动限购--
+ if (th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0 && !th.data.is_normal) {
+ if (t + th.data.prom_buy_num > th.data.prom_buy_limit) {
+ wx.showModal({
+ title: '超出商品活动限购',
+ });
+
+ var num = th.data.prom_buy_limit - th.data.prom_buy_num;
+ if (num < 0) num = 0;
+ th.setData({goodsInputNum: num})
+ return false;
+ }
+ }
+
+ if (th.data.sele_g.prom_type == 1 && !th.data.is_normal) {
+ var redis_num = 0;
+ //------判断活动是否抢光-----
+ await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" +
+ os.stoid + "/" + th.data.sele_g.prom_type + "/" + th.data.sele_g.prom_id, {
+ 1: 1
+ }).then(res => {
+ redis_num = res.data.data;
+ });
+
+ if (t > redis_num) {
+ wx.showModal({
+ title: '超出商品活动库存',
+ });
+ th.setData({goodsInputNum: redis_num})
+ return false;
+ }
+ }
+ var e = th.data.sele_g.store_count;
+ var p_type = th.data.prom_type; //&& p_type!=1 && p_type!=4
+ if (th.data.sales_rules == 2 && (p_type != 1 && p_type != 4 && p_type != 6 || th.data.openSpecModal_inte_normal == 1 || th.data.is_normal == 1)) {
+ if (!th.data.def_pick_store) {
+ wx.showModal({title: '请选择门店',});
+ return false;
+ } else {
+ e = th.data.def_pick_store.CanOutQty;
+ }
+ }
+ if (!e) e = 0;
+ //库存不足,不增加
+ if (e < t) {
+ wx.showModal({title: '库存不足',});
+ if (e < 0) e = 0;
+ th.setData({goodsInputNum: e});
+ return false;
+ }
+ t > e || 0 == e ? t = e : t < 1 && (t = 1);
+ th.setData({goodsInputNum: t});
+ // th.is_show_more_buy();
+
+ })
+
+ };
+
- var num = th.data.prom_buy_limit - th.data.prom_buy_num;
- if (num < 0) num = 0;
- th.setData({goodsInputNum: num})
- return false;
- }
- }
- if ((th.data.sele_g.prom_type == 1 || th.data.sele_g.prom_type == 6) && !th.data.is_normal) {
- var redis_num = 0;
- //------判断活动是否抢光-----
- await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" +
- os.stoid + "/" + th.data.sele_g.prom_type + "/" + th.data.sele_g.prom_id, {
- 1: 1
- }).then(res => {
- redis_num = res.data.data;
- });
- if (t > redis_num) {
- wx.showModal({
- title: '超出商品活动库存',
- });
- th.setData({goodsInputNum: redis_num})
- return false;
- }
- }
- var e = th.data.sele_g.store_count;
- var p_type = th.data.prom_type; //&& p_type!=1 && p_type!=4
- if (th.data.sales_rules == 2 && (p_type != 1 && p_type != 4 && p_type != 6 || th.data.openSpecModal_inte_normal == 1 || th.data.is_normal == 1)) {
- if (!th.data.def_pick_store) {
- wx.showModal({title: '请选择门店',});
- return false;
- } else {
- e = th.data.def_pick_store.CanOutQty;
- }
- }
- if (!e) e = 0;
- //库存不足,不增加
- if (e < t) {
- wx.showModal({title: '库存不足',});
- if (e < 0) e = 0;
- th.setData({goodsInputNum: e});
- return false;
- }
- t > e || 0 == e ? t = e : t < 1 && (t = 1);
- th.setData({goodsInputNum: t});
- // th.is_show_more_buy();
- })
},
@@ -3151,14 +3174,10 @@ Page({
var em = res;
if (em.data.code == 0) {
- if (em.data.data <= 0) {
- wx.showModal({
- title: '来晚了,已被抢光!',
- });
-
- ee.setData({
+ if (em.data.data <= 0) {
+ th.setData({
prom_r_null: 1,
- goodsInputNum: 0
+ goodsInputNum: res.data.data,
});
// th.setData({goodsInputNum: redis_num})
@@ -3212,7 +3231,7 @@ Page({
var endTime1 = t.data.data.start_time;
if (endTime1 > newTime) {
ee.setData({
- prom_time_text: '距秒杀开始还有'
+ prom_time_text: '距秒杀开始还有',
})
ee.countDown(endTime1, 0);
} else {
@@ -3430,18 +3449,22 @@ Page({
this.data.g_buy_num = new Map();
var th = this;
this.setData({open_ind_store: 5, goodsInputNum: 1});//拼团直接给4
- if (th.data.sku_g_pt) {
- this.get_sto(1)
- this.setData({openSpecModal_flash_normal: 1});
- } else {
- th.get_sto(1);
- th.get_sku(o.stoid, th.data.data, th.data.gid, 1, function () {
- th.setData({
- openSpecModal_flash_normal: 1
- });
- });
- }
- this.check_is_youhui(th.data.gid, 1);
+
+ this.setData({openSpecModal_flash_normal: 1});
+
+
+ // if (th.data.sku_g_pt) {
+ // // this.get_sto(1)
+ // this.setData({openSpecModal_flash_normal: 1});
+ // } else {
+ // th.get_sto(1);
+ // th.get_sku(o.stoid, th.data.data, th.data.gid, 1, function () {
+ // th.setData({
+ // openSpecModal_flash_normal: 1
+ // });
+ // });
+ // }
+ // this.check_is_youhui(th.data.gid, 1);
},
closeSpecModal_flash_normal: function () {
@@ -3475,11 +3498,502 @@ Page({
this.setData({
hiddenCS: true,
});
- }
+ },
-
+
+
+
+
+ //-- 加入购物的函数 --
+ add_cart_func: function (t) {
+ var i = getApp().request;
+ if (oo.user_id == null) {
+ return s.my_warnning("还未登录!", 0, this);
+ }
+
+ if (!getApp().globalData.userInfo) {
+ return s.my_warnning("还未登录!", 0, this);
+ }
+
+ var e = this,
+ th = e,
+ a = 0,
+ o = this.data.sele_g;
+ a = o.goods_id;
+
+ //----------添加到购物车时,要判断限购数量,--------
+ e.get_buy_num(o, function (ee) {
+ //---判断商品是否超出限购---
+ if (th.data.g_buy_num != null && th.data.sele_g.viplimited > 0) {
+ if (th.data.goodsInputNum + th.data.g_buy_num.get(th.data.sele_g.goods_id) > th.data.sele_g.viplimited) {
+ wx.showModal({
+ title: '提示',
+ content: '超出商品限购'
+ });
+ return false;
+ }
+ }
+ //---判断商品是否超出活动限购---
+ if ((th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0) && !th.data.is_normal) {
+ if (th.data.goodsInputNum + th.data.prom_buy_num > th.data.prom_buy_limit) {
+ wx.showModal({
+ title: '提示',
+ content: '超出商品活动限购'
+ });
+ return false;
+ }
+ }
+
+ if (th.data.goodsInputNum <= 0) return s.my_warnning("商品数量不能为0", 0, th);
+ if (th.data.sto_sele_name == null || th.data.sto_sele_name == undefined)
+ this.setData({
+ sto_sele_name: ""
+ });
+ if (th.data.sto_sele_name == "") return s.my_warnning("请选择门店", 0, th);
+
+ //--------------此时操作的数据------------
+ var newd = {
+ goods_id: o.goods_id,
+ goods_num: th.data.goodsInputNum,
+ pick_id: th.data.sto_sele_id,
+ user_id: oo.user_id,
+ store_id: th.data.stoid,
+ goods_price: o.shop_price,
+ member_goods_price: o.shop_price,
+ goods_name: o.goods_name,
+ goods_sn: o.goods_sn,
+ sku: o.sku,
+ prom_id: th.data.sele_g.prom_id,
+ prom_type: th.data.sele_g.prom_type,
+ };
+
+ //---是不是从收藏夹出来的---
+ if (th.data.c_guide_id) {
+ newd['guide_id'] = th.data.c_guide_id;
+ newd['guide_type'] = 2;
+ if ("add" == t.currentTarget.dataset.action) newd['guide_type'] = 3;
+ } else {
+ if (getApp().globalData.guide_id) {
+ newd['guide_id'] = getApp().globalData.guide_id;
+ newd['guide_type'] = 0;
+ if ("add" == t.currentTarget.dataset.action) newd['guide_type'] = 1;
+ }
+ }
+
+ //让商品带上房间号
+ //让商品带上房间号
+ if (th.data.sys_switch.is_skuroom_id == 1) {
+ if (th.data.data.goods_id == getApp().globalData.room_goods_id) {
+ newd.room_id = getApp().globalData.room_id;
+ }
+ } else {
+ if (newd.goods_id == getApp().globalData.room_goods_id) newd.room_id = getApp().globalData.room_id;
+ }
+
+ //如果是积分够,is_integral_normal就要有积分购普通购买字段
+ if (o.prom_type == 4) {
+ newd.is_integral_normal = 1;
+ }
+
+ //如果有线下取价
+ if (o.offline_price) {
+ newd.offline_price = o.offline_price;
+ newd.pricing_type = o.pricing_type;
+ }
+
+ //-----如果是秒杀,团购,积分购,拼团-----
+ if (th.data.prom_type == 1 || th.data.prom_type == 2) {
+
+ if (th.data.openSpecModal_flash_normal) {
+
+ newd.prom_type = 0;
+ newd.prom_id = 0;
+
+ //---如果是线下门店销售的时候---
+ if (th.data.sales_rules == 2) {
+ var pick = th.get_pick_from_list(th.data.sto_sele_id)
+ //---通过接口获取门店的线下库存信息--
+ getApp().request.get("/api/weshop/goods/getWareStorages", {
+ data: {
+ storageNos: pick.pickup_no,
+ wareIds: encodeURIComponent(th.data.sele_g.erpwareid),
+ storeId: os.stoid
+ },
+ success: function (res) {
+ if (res.data.code == 0) {
+ if (res.data.data.pageData.length > 0) {
+ var CanOutQty = res.data.data.pageData[0].CanOutQty;
+ if (CanOutQty < e.data.goodsInputNum) {
+ return s.my_warnning("库存不足!", 0, th);
+ }
+ //在调一次接口,读取商品的预出库的数量,lock
+ getApp().request.get("/api/weshop/order/ware/lock/page", {
+ data: {
+ store_id: os.stoid,
+ wareId: th.data.sele_g.goods_id,
+ storageId: pick.pickup_id,
+ pageSize: 1000
+ },
+ success: function (res_data) {
+ if (res_data.data.code == 0 && res_data.data.data.total > 0) {
+
+ var lock = 0;
+ for (var i in res_data.data.data.pageData) {
+ lock += res_data.data.data.pageData[i].outQty;
+ }
+
+ if (CanOutQty <= lock) {
+ return s.my_warnning("库存不足!", 0, th);
+ }
+ th.add_cart_next(e, t, a, o, newd, CanOutQty - lock);
+ } else {
+ th.add_cart_next(e, t, a, o, newd, CanOutQty);
+ }
+ }
+ })
+ } else {
+ return s.my_warnning("库存不足!", 0, th);
+ }
+
+ }
+ }
+ })
+ } else {
+ if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th);
+ if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th);
+ th.add_cart_next(e, t, a, o, newd); //加入购物车下一步
+ }
+
+ return false;
+ }
+
+
+ newd.goods_price = th.data.prom_price;
+ newd.member_goods_price = th.data.prom_price,
+ newd.prom_type = th.data.prom_type;
+ newd.prom_id = th.data.prom_id;
+
+ if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th);
+ if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th);
+
+ th.add_cart_next(e, t, a, o, newd); //加入购物车下一步
+
+ } else if (o.prom_type == 7) {
+
+ //判断进行中的活动,是不是要判断线下库存
+ th.check_zh_acting(function (ee) {
+ newd.prom_id = 0;
+ newd.prom_type = 0;
+ if (ee && th.data.sele_g.act) {
+ newd.prom_id = th.data.sele_g.act.id;
+ newd.prom_type = 7;
+ if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th);
+ if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th);
+ th.add_cart_next(e, t, a, o, newd); //加入购物车下一步
+ return false;
+ } else {
+ //---如果是线下门店销售的时候---
+ if (th.data.sales_rules == 2) {
+ var pick = th.get_pick_from_list(th.data.sto_sele_id)
+ //---通过接口获取门店的线下库存信息--
+ getApp().request.get("/api/weshop/goods/getWareStorages", {
+ data: {
+ storageNos: pick.pickup_no,
+ wareIds: encodeURIComponent(th.data.sele_g.erpwareid),
+ storeId: os.stoid
+ },
+ success: function (res) {
+ if (res.data.code == 0) {
+ if (res.data.data.pageData.length > 0) {
+ var CanOutQty = res.data.data.pageData[0].CanOutQty;
+ if (CanOutQty < e.data.goodsInputNum) {
+ return s.my_warnning("库存不足!", 0, th);
+ }
+ //在调一次接口,读取商品的预出库的数量,lock
+ getApp().request.get("/api/weshop/order/ware/lock/page", {
+ data: {
+ store_id: os.stoid,
+ wareId: th.data.sele_g.goods_id,
+ storageId: pick.pickup_id,
+ pageSize: 1000
+ },
+ success: function (res_data) {
+ if (res_data.data.code == 0 && res_data.data.data.total > 0) {
+
+ var lock = 0;
+ for (var i in res_data.data.data.pageData) {
+ lock += res_data.data.data.pageData[i].outQty;
+ }
+
+ if (CanOutQty <= lock) {
+ return s.my_warnning("库存不足!", 0, th);
+ }
+ th.add_cart_next(e, t, a, o, newd, CanOutQty - lock);
+ } else {
+ th.add_cart_next(e, t, a, o, newd, CanOutQty);
+ }
+ }
+ })
+ } else {
+ return s.my_warnning("库存不足!", 0, th);
+ }
+
+ }
+ }
+ })
+ } else {
+ if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th);
+ if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th);
+ th.add_cart_next(e, t, a, o, newd); //加入购物车下一步
+ }
+ }
+ })
+
+ }
+ 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) {
+ newd.prom_type = 0;
+ newd.prom_id = 0;
+
+ if (th.data.prom_type == 10) {
+ newd.prom_type = th.data.prom_type;
+ newd.prom_id = th.data.prom_id;
+ }
+
+ //---如果是线下门店销售的时候---
+ if (th.data.sales_rules == 2) {
+ var pick = th.get_pick_from_list(th.data.sto_sele_id)
+ //---通过接口获取门店的线下库存信息--
+ getApp().request.get("/api/weshop/goods/getWareStorages", {
+ data: {
+ storageNos: pick.pickup_no,
+ wareIds: encodeURIComponent(th.data.sele_g.erpwareid),
+ storeId: os.stoid
+ },
+ success: function (res) {
+ if (res.data.code == 0) {
+ if (res.data.data.pageData.length > 0) {
+ var CanOutQty = res.data.data.pageData[0].CanOutQty;
+ if (CanOutQty < e.data.goodsInputNum) {
+ return s.my_warnning("库存不足!", 0, th);
+ }
+ //在调一次接口,读取商品的预出库的数量,lock
+ getApp().request.get("/api/weshop/order/ware/lock/page", {
+ data: {
+ store_id: os.stoid,
+ wareId: th.data.sele_g.goods_id,
+ storageId: pick.pickup_id,
+ pageSize: 1000
+ },
+ success: function (res_data) {
+ if (res_data.data.code == 0 && res_data.data.data.total > 0) {
+
+ var lock = 0;
+ for (var i in res_data.data.data.pageData) {
+ lock += res_data.data.data.pageData[i].outQty;
+ }
+
+ if (CanOutQty <= lock) {
+ return s.my_warnning("库存不足!", 0, th);
+ }
+ th.add_cart_next(e, t, a, o, newd, CanOutQty - lock);
+ } else {
+ th.add_cart_next(e, t, a, o, newd, CanOutQty);
+ }
+ }
+ })
+ } else {
+ return s.my_warnning("库存不足!", 0, th);
+ }
+
+ }
+ }
+ })
+ } else {
+ if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th);
+ if (o.store_count < e.data.goodsInputNum) return s.my_warnning("库存不足!", 0, th);
+ th.add_cart_next(e, t, a, o, newd); //加入购物车下一步
+ }
+ }
+ })
+ },
+
+ //---加入购物车的最后一步---
+ add_cart_next(e, t, a, o, newd, CanOutQty) {
+ var th = this, i = getApp().request;
+ //---如果商品不是积分购和拼团,要判断一个是否要进行等级价的判断------
+ if ((o.prom_type != 1 || o.prom_id <= 0) && ((o.prom_type != 6 && o.prom_type != 4 && o.prom_type != 2 ) || th.data.is_normal)) {
+ var conf = th.data.bconfig;
+ if (conf.switch_list && getApp().globalData.userInfo['card_field'] && getApp().globalData.userInfo['card_expiredate']) {
+ var s_list = JSON.parse(conf.switch_list);
+ var now = ut.gettimestamp();
+
+
+ var str = getApp().globalData.userInfo['card_expiredate'].replace(/-/g, '/');
+ var end = new Date(str);
+ end = Date.parse(end) / 1000;
+
+ //--如果后台有开启等级价的功能,而且会员的等级没有过期的情况下--
+ if (parseInt(s_list.rank_switch) == 2 && end > now) {
+ var card_price = o[getApp().globalData.userInfo['card_field']];
+ //如果会员有等级价
+ if (getApp().globalData.userInfo['card_field'] != undefined && getApp().globalData.userInfo['card_field'] != null
+ && getApp().globalData.userInfo['card_field'] != "" && card_price > 0) {
+ newd.goods_price = card_price;
+ newd.member_goods_price = card_price;
+ }
+ }
+ }
+ }
+
+ //if (this.data.data.goods.is_virtual) return this.buyVirtualGoods(d);
+ if ("add" == t.currentTarget.dataset.action) {
+
+ if (th.data.prom_goods) {
+ newd.prom_type = 3;
+ newd.prom_id = th.data.prom_goods[0].prom_id;
+ }
+
+ //----先看会员在购物车中是否加入了该商品-----
+ i.get("/api/weshop/cart/page", {
+ data: {
+ store_id: e.data.stoid,
+ user_id: oo.user_id,
+ goods_id: a,
+ pick_id: e.data.sto_sele_id,
+ state: 0
+ },
+ success: function (re) {
+
+ //-------如果购物车中有相关的数据---------
+ if (re.data.data.total > 0) {
+
+ var item = re.data.data.pageData[0];
+
+ //判断数量,要看下购物车中有没有该商品
+ if (CanOutQty) {
+ if (item.goods_num + th.data.goodsInputNum > CanOutQty) {
+ return s.my_warnning("库存不足!", 0, th);
+ }
+ } else {
+ if (item.goods_num + th.data.goodsInputNum > o.store_count) {
+ return s.my_warnning("库存不足!", 0, th);
+ }
+ }
+
+ var updata = {
+ id: item.id,
+ goods_num: e.data.goodsInputNum + item.goods_num,
+ goods_price: newd.goods_price,
+ member_goods_price: newd.goods_price,
+ store_id: th.data.stoid,
+ };
+
+ //---是不是从收藏夹出来的---
+ if (th.data.c_guide_id) {
+ updata['guide_id'] = th.data.c_guide_id;
+ updata['guide_type'] = 3; //加入购物车之后就变成了3
+ } else {
+ if (getApp().globalData.guide_id) {
+ updata['guide_id'] = getApp().globalData.guide_id;
+ updata['guide_type'] = 0;
+ }
+ }
+
+ i.put("/api/weshop/cart/update", {
+ data: updata,
+ success: function (t) {
+ getApp().my_warnning('加入购物车成功', 1, th, 450);
+ var c_num = th.data.cartGoodsNum + th.data.goodsInputNum;
+ th.setData({
+ cartGoodsNum: c_num
+ });
+ th.closeSpecModal();
+ }
+ });
+ } else {
+
+
+ i.post("/api/weshop/cart/save", {
+ data: newd,
+ success: function (t) {
+ getApp().my_warnning('加入购物车成功', 1, th, 450);
+ var c_num = th.data.cartGoodsNum + e.data.goodsInputNum;
+ th.setData({
+ cartGoodsNum: c_num
+ });
+ th.closeSpecModal();
+ }
+ });
+ }
+ }
+ });
+
+ }
+ else {
+
+ //这一步主要是要让立即购买 走 购物车的逻辑 参与活动
+ if (newd.prom_type == 10 || newd.prom_type == 7) {
+ //----先看会员在购物车中是否加入了该商品,立即购买的-----
+ getApp().request.get("/api/weshop/cart/page", {
+ data: {
+ store_id: e.data.stoid,
+ user_id: oo.user_id,
+ state: 1
+ },
+ success: function (res) {
+ //-------如果购物车中有相关的数据---------
+ if (res.data.code == 0 && res.data.data.total > 0) {
+ for (let j in res.data.data.pageData) {
+ let item_j = res.data.data.pageData[j];
+ var url = '/api/weshop/cart/del/' + e.data.stoid + '/' + item_j.id;
+ getApp().request.delete(url, {});
+ }
+ }
+ newd.state = 1;
+ getApp().request.post("/api/weshop/cart/save", {
+ data: newd,
+ success: function (t) {
+ th.closeSpecModal();
+ getApp().goto("/pages/cart/cart2/cart2?state=1");
+ }
+ });
+ }
+ })
+ return false;
+ }
+
+ if (th.data.prom_goods) {
+ var prom_d = th.data.prom_goods;
+ for (var i in prom_d) {
+ //判断活动有俩种条件,0元 1件
+ var condition_t = prom_d[i].prom_type;
+ switch (condition_t) {
+ case 0: //按钱
+ if (newd.goods_price >= condition_t) {
+ newd.prom_type = 3;
+ newd.prom_id = prom_d[i].prom_id;
+ }
+ break
+ case 1://按购买数量
+ if (newd.goods_num >= condition_t) {
+ newd.prom_type = 3;
+ newd.prom_id = prom_d[i].prom_id;
+ }
+ break;
+ }
+ }
+
+ }
+
+ newd['pick_name'] = th.data.sto_sele_name;
+ newd['pick_dis'] = th.data.sto_sele_distr;
+ th.buyNow(newd);
+ }
+ },
+
+
diff --git a/packageA/pages/goodsInfo/goodsInfo.wxml b/packageA/pages/goodsInfo/goodsInfo.wxml
index 5af7826..64b0378 100644
--- a/packageA/pages/goodsInfo/goodsInfo.wxml
+++ b/packageA/pages/goodsInfo/goodsInfo.wxml
@@ -548,41 +548,45 @@
-
-
-
- 加入购物车
- 立即抢购
-
+
+
+
+ 加入购物车
+ 立即抢购
+
-
-
-
- 单独购买
- 即将开始
-
-
- 即将开始
-
-
+
+
+
+
+
+ 单独购买
+ 即将开始
+
+
+ 即将开始
+
+
-
-
- 单独购买
- 已抢光
-
- 已抢光
-
-
-
-
- 单独购买
- 活动已经结束
-
- 活动已经结束
-
-
+
+
+
+ 单独购买
+ 已抢光
+
+ 已抢光
+
+
+
+
+
+ 单独购买
+ 活动已经结束
+
+ 活动已经结束
+
+
@@ -590,15 +594,9 @@
加入购物车
立即购买
-
-
-
+
-
-
-
-
@@ -907,6 +905,11 @@
+
+
+
+
+
diff --git a/packageA/pages/goodsInfo/goodsInfo.wxss b/packageA/pages/goodsInfo/goodsInfo.wxss
index 4800210..c365d9a 100644
--- a/packageA/pages/goodsInfo/goodsInfo.wxss
+++ b/packageA/pages/goodsInfo/goodsInfo.wxss
@@ -562,7 +562,7 @@ view.cart-btn-lg {
.spec-model {
position: fixed;
bottom: 0;
- z-index: 20;
+ z-index: 19;
background: white;
width: 100%;
/* padding: 0 30rpx; */
diff --git a/utils/weapp-icon.wxss b/utils/weapp-icon.wxss
index 7d685e4..3f3937b 100644
--- a/utils/weapp-icon.wxss
+++ b/utils/weapp-icon.wxss
@@ -13,13 +13,6 @@
background: url(data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%3Csvg%20version%3D%221.1%22%20width%3D%27100%25%27%20height%3D%27100%25%27%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20id%3D%22t-icon-gowudai%22%20viewBox%3D%220%200%201024%201024%22%3E%3Cpath%20d%3D%22M150.72-1.06666667l-5.86666667%20169.49333334%20738.13333334%2016.53333333L870.4-1.06666667z%22%20fill%3D%22%23cdcdcd%22%20%3E%3C%2Fpath%3E%3Cpath%20d%3D%22M150.72-1.06666667l72.64%2049.38666667-78.50666667%20106.56z%22%20fill%3D%22%23A2A2A2%22%20%3E%3C%2Fpath%3E%3Cpath%20d%3D%22M120.64%201025.70666667L69.33333333%20969.49333333h884.37333334l-54.29333334%2056.21333334z%22%20fill%3D%22%23bfbfbf%22%20%3E%3C%2Fpath%3E%3Cpath%20d%3D%22M223.36%2047.36l-20.37333333%20113.38666667-103.57333334-8.74666667z%22%20fill%3D%22%23AEADAD%22%20%3E%3C%2Fpath%3E%3Cpath%20d%3D%22M870.4-1.06666667l-71.68%2049.38666667%2084.26666667%20108.48z%22%20fill%3D%22%23A2A2A2%22%20%3E%3C%2Fpath%3E%3Cpath%20d%3D%22M798.72%2048.32l20.37333333%20112.42666667%20105.49333334-8.74666667z%22%20fill%3D%22%23AEADAD%22%20%3E%3C%2Fpath%3E%3Cpath%20d%3D%22M99.41333333%20152h825.17333334L954.66666667%20969.49333333H69.33333333z%22%20fill%3D%22%23dbdbdb%22%20%3E%3C%2Fpath%3E%3Cpath%20d%3D%22M718.82666667%20256.10666667H770.13333333v255.68c0%20141.22666667-114.45333333%20255.68-255.68%20255.68S258.66666667%20653.01333333%20258.66666667%20511.78666667V256.10666667h51.30666666v255.68c0%20112.85333333%2091.52%20204.37333333%20204.37333334%20204.37333333s204.37333333-91.52%20204.37333333-204.37333333V256.10666667z%22%20fill%3D%22%23A5A5A5%22%20%3E%3C%2Fpath%3E%3Cpath%20d%3D%22M718.82666667%20312.32H770.13333333v149.12c0%20141.22666667-114.45333333%20255.68-255.68%20255.68S258.66666667%20602.66666667%20258.66666667%20461.44V312.32h51.30666666v149.12c0%20112.85333333%2091.52%20204.37333333%20204.37333334%20204.37333333s204.37333333-91.52%20204.37333333-204.37333333V312.32z%22%20fill%3D%22%23FFFFFF%22%20%3E%3C%2Fpath%3E%3C%2Fsvg%3E);
}
-/* .t-icon-liwu {
- background: url(data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%3Csvg%20version%3D%221.1%22%20width%3D%27100%25%27%20height%3D%27100%25%27%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20id%3D%22t-icon-liwu%22%20viewBox%3D%220%200%201024%201024%22%3E%3Cpath%20d%3D%22M85.93%20950.016c0%2024.576%207.126%2031.317%2029.44%2031.317h353.366V511.744H85.931v438.272z%20m469.334%2031.317h353.365c22.358%200%2029.44-6.698%2029.44-31.317V511.744H555.221v469.59zM938.667%20256H725.333c51.499-11.733%20105.899-49.707%20112.598-94.293%207.85-50.859-52.566-127.958-125.654-118.187-87.424%2012.117-151.509%2089.259-196.736%20149.077C470.656%20133.931%20412.16%2065.408%20328.363%2045.483c-81.152-19.2-136.747%2064.938-135.254%20116.992%201.451%2044.245%2052.608%2081.834%20105.558%2093.525H85.333c-26.368%200-42.666%2014.848-42.666%2042.667v170.581l426.666%200.085V256h85.334v213.333l426.666-0.085V298.667c0-27.819-16.341-42.667-42.666-42.667z%20m-687.019-77.824c-14.763-16.427-4.779-38.741%204.48-55.595%2017.024-29.696%2040.747-47.744%2081.152-30.933%2056.32%2023.51%2097.792%2073.216%20131.584%20117.803-71.552%207.893-178.304%2010.965-217.216-31.275z%20m311.296%2030.507c34.816-44.63%2075.221-89.942%20131.157-117.803%2058.582-28.97%20113.024%2049.323%2085.206%2086.912-21.419%2028.544-89.259%2031.232-125.91%2032.853-30.08%201.536-60.501%200.811-90.453-1.962z%22%20fill%3D%22%22%20%3E%3C%2Fpath%3E%3C%2Fsvg%3E);
-}
-
-.t-icon-echarts {
- background: url(data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%3Csvg%20version%3D%221.1%22%20width%3D%27100%25%27%20height%3D%27100%25%27%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20id%3D%22t-icon-echarts%22%20viewBox%3D%220%200%201024%201024%22%3E%3Cpath%20d%3D%22M436.59925293%20533.33333333c0-65.04312613%2035.34952507-123.72333775%2088.37381267-153.41693881l-206.44122641-353.49525068c-282.79620057%20159.07286282-376.82593725%20518.22403753-217.75307443%20801.02023808l359.15117471-206.44122642c-11.31184801-22.62369604-23.33068654-52.31729711-23.33068654-87.66682217z%22%20fill%3D%22%23DADADA%22%20%3E%3C%2Fpath%3E%3Cpath%20d%3D%22M613.34687829%20356.58570799c65.04312613%200%20123.72333775%2035.34952507%20153.41693879%2088.37381266l253.1025995-147.05402428C890.48715482%2073.78950741%20602.03503025-2.56546674%20377.91904132%20126.81379502l147.05402428%20253.1025995c24.03767705-11.31184801%2059.38720211-23.33068654%2088.37381269-23.33068653z%22%20fill%3D%22%23EBEBEB%22%20%3E%3C%2Fpath%3E%3Cpath%20d%3D%22M701.72069095%20686.75027214c-23.33068654%2017.67476253-58.68021163%2023.33068654-88.37381266%2023.33068653-65.04312613%200-123.72333775-35.34952507-153.41693882-88.37381266L201.17141596%20775.12408481c41.00544908%2070.69905013%20100.3926512%20129.37926176%20171.09170135%20171.09170134%20153.41693881%2088.37381268%20335.82048816%2082.71788866%20477.21858844-5.65592402l-147.7610148-253.80958999z%22%20fill%3D%22%23B8B8B8%22%20%3E%3C%2Fpath%3E%3Cpath%20d%3D%22M920.18075589%20356.58570799L766.76381708%20444.95952065c12.01883853%2029.69360106%2023.33068654%2058.68021163%2023.33068654%2088.37381268%200%2065.04312613-35.34952507%20123.72333775-88.37381267%20153.41693881l88.37381267%20153.41693881c171.09170134-100.3926512%20229.77191295-312.48980161%20130.08625227-483.58150296z%22%20fill%3D%22%23C7C7C7%22%20%3E%3C%2Fpath%3E%3C%2Fsvg%3E);
-} */
.t-icon-sort-up {
background: url(data:image/svg+xml,%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22utf-8%22%3F%3E%3Csvg%20version%3D%221.1%22%20width%3D%27100%25%27%20height%3D%27100%25%27%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20id%3D%22t-icon-sort-up%22%20viewBox%3D%220%200%201024%201024%22%3E%3Cpath%20d%3D%22M-109.37837037-109.37837037h1242.75674074v1242.75674074H-109.37837037z%22%20fill%3D%22%23FFFFFF%22%20fill-opacity%3D%220%22%20%3E%3C%2Fpath%3E%3Cpath%20d%3D%22M242.7360391%20615.56306132h538.5279218a20.71261275%2020.71261275%200%200%201%2016.57008947%2033.14018016l-269.2639609%20359.05313542a20.71261275%2020.71261275%200%200%201-33.14017894%200L226.16594963%20648.70324148A20.71261275%2020.71261275%200%200%201%20242.7360391%20615.56306132z%22%20fill%3D%22%23C7C7C7%22%20%3E%3C%2Fpath%3E%3Cpath%20d%3D%22M528.57008947%2016.2436231l269.2639609%20359.05313542A20.71261275%2020.71261275%200%200%201%20781.2639609%20408.43693868H242.7360391a20.71261275%2020.71261275%200%200%201-16.57008947-33.14018016l269.2639609-359.05313542a20.71261275%2020.71261275%200%200%201%2033.14017894%200z%22%20fill%3D%22%235A5A5A%22%20%3E%3C%2Fpath%3E%3C%2Fsvg%3E);