diff --git a/packageC/pages/presell/goodsInfo/goodsInfo.js b/packageC/pages/presell/goodsInfo/goodsInfo.js
index 8ccc19d..d69e5c1 100644
--- a/packageC/pages/presell/goodsInfo/goodsInfo.js
+++ b/packageC/pages/presell/goodsInfo/goodsInfo.js
@@ -1,8 +1,7 @@
-var t = require("../../../../utils/util.js"),
- ut = t,
+var ut = require("../../../../utils/util.js"),
e = require("../../../../utils/common.js"),
a = require("../../../../utils/wxParse/wxParse.js"),
- s = getApp(),
+ s = getApp(),app=s,
i = s.request,
rq = i,
oo = s.globalData,
@@ -210,7 +209,6 @@ Page({
//是否点赞中
iszaning: 0,
-
select_store: 0, //选择更多
index: 1,
more_store: 0, //选择门店
@@ -249,15 +247,14 @@ Page({
fir_goods: null,
share_hidden: false,
+ pre_arr:null,
},
//------初始化加载----------
onLoad: function (t) {
-
- var ee = this,
- that = ee,
- th = ee,
- gid =t.goods_id,
+ var ee = this, that = ee, th = ee,
+ pre_id=t.pre_id,
+ gid=t.goods_id,
first_leader = t.first_leader,
room_id = t.room_id,
room_user_share = t.room_user_share; //如果是会员分享带有room_id的话,那么接下来会员分享就不传room_id
@@ -296,18 +293,21 @@ Page({
if (gid == undefined || gid == null || gid == "") {
var gid_str = decodeURIComponent(t.scene);
gid_str = gid_str.split("_");
- gid = gid_str[0];
+ pre_id = gid_str[0];
if (gid_str.length > 1) {
- first_leader = gid_str[1];
+ pre_id = gid_str[1];
+ first_leader = gid_str[2];
}
//-- 如果有room_id的获取 --
- if (gid_str.length > 2 && gid_str[2]) {
+ if (gid_str.length > 2 && gid_str[3]) {
room_id = gid_str[2];
room_user_share = 1;
}
-
}
- ee.setData({ gid: gid });
+
+ this.data.gid=gid;
+ this.data.pre_id=pre_id;
+
if (first_leader) {
console.log("log---".first_leader);
getApp().globalData.first_leader = first_leader;
@@ -418,68 +418,6 @@ Page({
})
}
});
-
- //获取用户的默认门店
- getApp().get_user_store(function (e) {
- if (!e) {
- th.data.fir_def_store = {}; //赋值空对象
- return false;
- }
- var ee = JSON.parse(JSON.stringify(e));
- //--定时器推迟一下--
- setTimeout(function () {
- if (th.data.fir_goods) var g_distr_type = th.data.fir_goods.distr_type;
- //--如果默认门店的配送方式不对,就不能被选择,这里不控制,如果不一样,就说明配送方式不对--
- if (ee.distr_type != 0 && g_distr_type != 0 && ee.distr_type != g_distr_type) {
- //th.data.fir_def_store={}; //赋值空对象
- //return false;
- //th.data.fir_def_store.is_no_dis=1;
- ee.is_no_dis = 1;
- }
-
- var appd = getApp().globalData;
- var w_time = setInterval(function () {
- if (that.data.is_get_local_ok == 0) return false;
- clearInterval(w_time);
- var distance = null;
- var e = JSON.parse(JSON.stringify(ee));
-
- //如果有开启近距离的话,同时距离优不一样了
- if (that.data.lat != null) {
- //如果经纬度有变化的话
- if (e && appd.lat == that.data.lat && appd.lon == that.data.lon && e.distance > 0) {
- that.set_def_storage(e);
-
- } else {
- //要用接口是获取距离,js的计算不准
- getApp().request.promiseGet("/api/weshop/pickup/list", {
- data: { store_id: os.stoid, pickup_id: e.pickup_id, lat: th.data.lat, lon: th.data.lon },
- }).then(res => {
- if (res.data.code == 0) {
- e = res.data.data.pageData[0];
- if (e) {
- e.is_no_dis = ee.is_no_dis;
- appd.pk_store = e;
- that.set_def_storage(e);
- }
-
- }
- })
- }
- appd.lat = that.data.lat;
- appd.lon = that.data.lon;
-
- } else {
- if (e) {
- e.distance = null;
-
- that.set_def_storage(e);
- }
- }
- }, 500)
- }, 700)
- });
-
//更新点击量
getApp().request.put("/api/weshop/goods/updateClick", {
data: { store_id: os.stoid, goods_id: gid }
@@ -487,58 +425,17 @@ Page({
},
- //--- 设置一下默认库存的数量 ----
- set_def_storage(ee) {
- var that = this, th = this;
- getApp().getConfig2(function (e) {
- var sales_rules = e.sales_rules;
- if (sales_rules == 2) {
- getApp().waitfor2(that, "wait_for_user_store", "fir_goods", function () {
- var lock = 0, plist = null;
- var gd = that.data.fir_goods;
- //先读取门店的lock,采用链式写法,少用await
- getApp().request.promiseGet("/api/weshop/order/ware/lock/page", {
- data: { store_id: os.stoid, wareId: that.data.fir_goods.goods_id, storageId: ee.pickup_id, pageSize: 1000 }
- }).then(res => {
- if (res.data.code == 0 && res.data.data.total > 0) {
- for (var i in res.data.data.pageData)
- lock += res.data.data.pageData[i].outQty
- }
- //---通过接口获取门店的线下库存信息--
- return getApp().request.promiseGet("/api/weshop/goods/getWareStorages", {
- data: { storageNos: ee.pickup_no, wareIds: encodeURIComponent(th.data.data.erpwareid), storeId: os.stoid }
- })
- }).then(res => {
- if (res.data.code == 0 && res.data.data.total > 0) {
- plist = res.data.data.pageData[0];
- }
- if (plist && plist.CanOutQty - lock > 0) {
- ee.CanOutQty = plist.CanOutQty - lock;
- } else {
- ee.CanOutQty = 0;
- }
- //--给门店赋值线下库存--
- that.data.fir_def_store = ee;
- that.setData({
- def_pick_store: ee,
- sto_sele_name: ee.pickup_name,
- sto_sele_id: ee.pickup_id,
- sto_sele_distr: ee.distr_type
- })
- })
- })
- } else {
+ //--- 设置一下默认库存的数量 ----
+ set_def_storage(ee) {
+ var that = this, th = this;
that.data.fir_def_store = ee;
that.setData({
- def_pick_store: ee,
- sto_sele_name: ee.pickup_name,
- sto_sele_id: ee.pickup_id,
- sto_sele_distr: ee.distr_type
+ def_pick_store: ee,
+ sto_sele_name: ee.pickup_name,
+ sto_sele_id: ee.pickup_id,
+ sto_sele_distr: ee.distr_type
})
- }
- })
-
- },
+ },
//------------程序初始化入口-------------
@@ -553,36 +450,7 @@ Page({
fir_quan = null,
mapurl = null,
mapurl_f_img = null;
- //------获取预售从表----------
- await getApp().request.get("/api/weshop/marketing/marketingPresellList/page", {
- data: {
- is_end: 0,
- store_id: os.stoid,
- timetype: 1,
- goods_id: gid
- },
- success: function (res) {
- if (res.data.code == 0 && res.data.data && res.data.data.pageData && res.data.data.pageData.length > 0) {
- var arr = res.data.data.pageData[0];
- let presell_id=arr.presell_id;
- th.setData({
- presellList: arr,
- })
- //------获取预售主表----------
- getApp().request.get(`/api/weshop/marketing/marketingPresellForm/get/${os.stoid}/${presell_id}`, {
- success: function (res) {
- console.log(res);
- if (res.data.code == 0 && res.data.data) {
- th.setData({
- presellForm: res.data.data,
- });
- th.countDown(res.data.data.end_time)
- }
- }
- })
- }
- }
- });
+
this.get_sto();
//------图片滚动----------
await getApp().request.promiseGet("/api/weshop/goodsimages/page", {
@@ -717,12 +585,12 @@ Page({
//---展示---
onShow: function () {
- console.log('djfijsaoifjoisadjfoij');
var goods_list = null, th = this, that = this;
+
+ //-- 如果是预览图片,页面不重新更新 --
var show_prew_img = this.data.show_prew_img
if (show_prew_img) {
- show_prew_img = 0;
- return false;
+ this.data.show_prew_img = 0; return false;
}
//优惠券要实时更新
@@ -743,196 +611,205 @@ Page({
}, 300)
this.data.is_timer = 1;
- var ee = this,
- gid = this.data.gid,
- i = getApp().request;
+ var ee = this,gid = this.data.gid,i = getApp().request;
this.wait_for_store_config();
- i.get("/api/weshop/goods/get/" + o.stoid + "/" + ee.data.gid, {
- failRollback: !0,
- success: function (t) {
- console.log(t);
- if (t.data.code == 0) {
- if (t.data.data.is_on_sale != 1) {
- wx.showModal({
- title: '商品已经下架',
- showCancel: !1,
- complete: function () {
- wx.navigateBack();
- }
- });
- }
+ this.get_pre_prom(function () {
+ i.get("/api/weshop/goods/get/" + o.stoid + "/" + ee.data.gid, {
+ failRollback: !0,
+ success: function (t) {
+ console.log(t);
+ if (t.data.code == 0) {
+ if (t.data.data.is_on_sale != 1) {
+ wx.showModal({
+ title: '商品已经下架',
+ showCancel: !1,
+ complete: function () {
+ wx.navigateBack();
+ }
+ });
+ }
+ var timestamp = Date.parse(new Date());
+ timestamp = timestamp / 1000;
+ if (t.data.data.on_time > timestamp) {
+ wx.showModal({
+ title: '商品还未上架',
+ showCancel: !1,
+ complete: function () {
+ wx.navigateBack();
+ }
+ });
+ }
- var timestamp = Date.parse(new Date());
- timestamp = timestamp / 1000;
- if (t.data.data.on_time > timestamp) {
- wx.showModal({
- title: '商品还未上架',
- showCancel: !1,
- complete: function () {
- wx.navigateBack();
- }
- });
- }
+ if (t.data.data.down_time > 0) {
+ if (t.data.data.down_time < timestamp) {
+ wx.showModal({
+ title: '商品已经到期下架',
+ showCancel: !1,
+ complete: function () {
+ wx.navigateBack();
+ }
+ });
+ }
+ }
+ //动态获取商品名称
+ wx.setNavigationBarTitle({
+ title: t.data.data.goods_name,
+ });
- if (t.data.data.down_time > 0) {
- if (t.data.data.down_time < timestamp) {
- wx.showModal({
- title: '商品已经到期下架',
- showCancel: !1,
- complete: function () {
- wx.navigateBack();
- }
- });
- }
- }
- //动态获取商品名称
- wx.setNavigationBarTitle({
- title: t.data.data.goods_name,
- });
+ //-- 把商品的赋值 --
+ ee.data.fir_goods = JSON.parse(JSON.stringify(t.data.data));
- //-- 判断是不是组合购活动,必须要登录后才能判断 --
- if (getApp().globalData.userInfo && t.data.data.prom_type == 7) {
- //获取活动信息
- var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" +
- t.data.data.prom_id + "/" + getApp().globalData.userInfo.user_id;
- getApp().request.get(url, {
- success: function (e) {
- if (e.data.code == 0 && e.data.data) {
- if (ut.gettimestamp() < e.data.data.start_time) {
- return false;
- }
- if (e.data.data.is_end == 0 && ut.gettimestamp() < e.data.data.end_time) {
- //-- 获取商品列表 --
- th.setData({ zh_act: e.data.data });
- }
+ //获取用户的默认门店
+ getApp().get_user_store(function (e) {
+ if (!e) {
+ th.data.fir_def_store = {}; //赋值空对象
+ return false;
+ }
+ var ee = JSON.parse(JSON.stringify(e));
- }
- }
- });
- }
+ if (th.data.fir_goods) var g_distr_type = th.data.fir_goods.distr_type;
+ //--如果默认门店的配送方式不对,就不能被选择,这里不控制,如果不一样,就说明配送方式不对--
+ if (ee.distr_type != 0 && g_distr_type != 0 && ee.distr_type != g_distr_type) {
+ ee.is_no_dis = 1;
+ }
- //-- 把商品的赋值 --
- ee.data.fir_goods = JSON.parse(JSON.stringify(t.data.data));
- ee.check_is_youhui(ee.data.gid);
+ var appd = getApp().globalData;
+ var w_time = setInterval(function () {
+ if (that.data.is_get_local_ok == 0) return false;
+ clearInterval(w_time);
+ var e = JSON.parse(JSON.stringify(ee));
+
+ //如果有开启近距离的话,同时距离优不一样了
+ if (that.data.lat != null) {
+ //如果经纬度有变化的话
+ if (e && appd.lat == that.data.lat && appd.lon == that.data.lon && e.distance > 0) {
+ that.set_def_storage(e);
+
+ } else {
+ //要用接口是获取距离,js的计算不准
+ getApp().request.promiseGet("/api/weshop/pickup/list", {
+ data: {
+ store_id: os.stoid,
+ pickup_id: e.pickup_id,
+ lat: th.data.lat,
+ lon: th.data.lon
+ },
+ }).then(res => {
+ if (res.data.code == 0) {
+ e = res.data.data.pageData[0];
+ if (e) {
+ e.is_no_dis = ee.is_no_dis;
+ appd.pk_store = e;
+ that.set_def_storage(e);
+ }
+
+ }
+ })
+ }
+ appd.lat = that.data.lat;
+ appd.lon = that.data.lon;
+
+ } else {
+ if (e) {
+ e.distance = null;
+
+ that.set_def_storage(e);
+ }
+ }
+ }, 500)
+ });
- t.data.data.on_time = ut.formatTime(t.data.data.on_time, 'yyyy-MM-dd hh:mm:ss');
- var cur_price = t.data.data.shop_price;
- if (getApp().globalData.userInfo && getApp().globalData.userInfo.card_field) {
- var cfile = getApp().globalData.userInfo.card_field;
- if (t.data.data[cfile]) {
- cur_price = t.data.data[cfile];
- }
- }
- var txt = (cur_price / t.data.data.market_price * 10).toFixed(2).toString();
- txt = parseFloat(txt);
- t.data.data['disc'] = txt;
+ t.data.data.on_time = ut.formatTime(t.data.data.on_time, 'yyyy-MM-dd hh:mm:ss');
- if (t.data.data.original_img.indexOf(o.imghost) == -1)
- t.data.data.original_img = o.imghost + t.data.data.original_img;
+ var cur_price = t.data.data.shop_price;
+ if (getApp().globalData.userInfo && getApp().globalData.userInfo.card_field) {
+ var cfile = getApp().globalData.userInfo.card_field;
+ if (t.data.data[cfile]) {
+ cur_price = t.data.data[cfile];
+ }
+ }
+ var txt = (cur_price / t.data.data.market_price * 10).toFixed(2).toString();
+ txt = parseFloat(txt);
- if (t.data.data.goods_content == null) t.data.data.goods_content = "";
+ t.data.data['disc'] = txt;
+ if (t.data.data.original_img.indexOf(o.imghost) == -1)
+ t.data.data.original_img = o.imghost + t.data.data.original_img;
- //-----商品详情---
- if (!t.data.data.goods_content) t.data.data.goods_content = " ";
- a.wxParse("content", "html", t.data.data.goods_content, ee, 6);
- e.wxParseAddFullImageUrl(ee, "content");
+ if (t.data.data.goods_content == null) t.data.data.goods_content = "";
- ee.setData({
- data: t.data.data,
- sele_g: t.data.data,
- userInfo: getApp().globalData.userInfo
- });
+ //-----商品详情---
+ if (!t.data.data.goods_content) t.data.data.goods_content = " ";
+ a.wxParse("content", "html", t.data.data.goods_content, ee, 6);
+ e.wxParseAddFullImageUrl(ee, "content");
+ ee.setData({
+ data: t.data.data,
+ sele_g: t.data.data,
+ userInfo: getApp().globalData.userInfo
+ });
- //获取统一条形码,普通商品和优惠促销的商品
- if (ee.data.data.prom_type == 0 || ee.data.data.prom_type == 2 || ee.data.data.prom_type == 3 || ee.data.data.prom_type == 5 || ee.data.data.prom_type == 7) {
- //默认门店要拿下门店库存
- if (that.data.sales_rules == 2 && that.data.is_newsales_rules) {
- //获取门店
- ee.get_sto();
- } else {
- //获取门店
- ee.get_sto();
- }
+ //获取门店
+ ee.get_sto();
+ ee.get_sku(o.stoid, t.data.data, gid);
- ee.get_sku(o.stoid, t.data.data, gid);
- }
- else {
- var gg = "", item = t.data.data;
- if (item.goods_spec == "null" || item.goods_spec == null) item.goods_spec = "";
- if (item.goods_color == "null" || item.goods_color == null) item.goods_color = "";
+ ee.data.g_buy_num = new Map();
- if (item.goods_spec != "" && item.goods_color != "") {
- gg = item.goods_spec + "/" + item.goods_color;
- } else if (item.goods_spec != "" || item.goods_color != "") {
- gg = item.goods_spec + item.goods_color;
- } else {
- gg = "规格1";
- }
- t.data.data.gg = gg;
- var uu = [];
- uu.push(t.data.data);
- ee.setData({
- sku_g: uu,
- });
- }
- ee.data.g_buy_num = new Map();
- ee.check_prom(gid, ee.data.data.prom_type, ee.data.data.prom_id);
+ if (ee.data.cat_name == '') {
+ //过去国别,分类,品牌的名称
+ i.get("/api/weshop/goodscategory/get/" + o.stoid + "/" + th.data.data.cat_id, {
+ success: function (t) {
+ var dd = t.data.data;
+ if (t.data.code == 0) {
+ th.setData({
+ cat_name: dd.name
+ });
+ }
+ }
+ });
+ //过去国别,分类,品牌的名称
+ i.get("/api/weshop/brand/get/" + o.stoid + "/" + th.data.data.brand_id, {
+ success: function (t) {
+ var dd = t.data.data;
+ if (t.data.code == 0) {
+ th.setData({
+ brand_name: dd.name
+ });
+ }
+ }
+ });
+ //过去国别,分类,品牌的名称
+ i.get("/api/weshop/nation/get/" + o.stoid + "/" + th.data.data.nation_id, {
+ success: function (t) {
+ var dd = t.data.data;
+ if (t.data.code == 0) {
+ th.setData({
+ nation_name: dd.name
+ });
+ }
+ }
+ });
+ }
- var th = ee;
- if (ee.data.cat_name == '') {
- //过去国别,分类,品牌的名称
- i.get("/api/weshop/goodscategory/get/" + o.stoid + "/" + th.data.data.cat_id, {
- success: function (t) {
- var dd = t.data.data;
- if (t.data.code == 0) {
- th.setData({
- cat_name: dd.name
- });
}
- }
- });
- //过去国别,分类,品牌的名称
- i.get("/api/weshop/brand/get/" + o.stoid + "/" + th.data.data.brand_id, {
- success: function (t) {
- var dd = t.data.data;
- if (t.data.code == 0) {
- th.setData({
- brand_name: dd.name
- });
- }
- }
- });
- //过去国别,分类,品牌的名称
- i.get("/api/weshop/nation/get/" + o.stoid + "/" + th.data.data.nation_id, {
- success: function (t) {
- var dd = t.data.data;
- if (t.data.code == 0) {
- th.setData({
- nation_name: dd.name
- });
+ else {
+ wx.showModal({
+ title: t.data.msg,
+ showCancel: !1,
+ complete: function () {
+ wx.navigateBack();
+ }
+ });
}
- }
- });
- }
-
- }
- else {
- wx.showModal({
- title: t.data.msg,
- showCancel: !1,
- complete: function () {
- wx.navigateBack();
}
- });
- }
- }
- });
- this.data.enterAddressPage && (this.data.enterAddressPage = !1);
+ });
+ ee.data.enterAddressPage && (this.data.enterAddressPage = !1);
+ })
+
+
},
enterAddress: function () {
@@ -1054,127 +931,15 @@ Page({
var th = this;
var ind = t.currentTarget.dataset.openSpecModal_ind;
if (!ind) ind = t.currentTarget.dataset.openspecmodal_ind;
- th.setData({
- open_ind_store: ind
+ th.setData({
+ open_ind_store: ind
});
- //如果是秒杀的话,要看redis够不够
- if (this.data.prom_type == 1) {
- this.getactLen(function (num) {
- if (num < th.data.goodsInputNum) {
- getApp().my_warnning("秒杀库存不足!", 0, th);
- return false;
- } else {
- th.add_cart_func(t);
- }
- });
- } else {
- th.add_cart_func(t);
- }
+
+ th.add_cart_func(t);
+
},
-
- //-- 加入购物的函数 --
- add_cart_func_inte: 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.data;
- 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) {
- 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: th.data.prom_price,
- integral: th.data.prom_integral,
- member_goods_price: o.shop_price,
- goods_name: o.goods_name,
- goods_sn: o.goods_sn,
- sku: o.sku,
- };
-
- //---是不是从收藏夹出来的---
- 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;
- //}
-
- //-----如果是秒杀,团购,积分购,拼团-----
- 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); //立即购买下一步
-
- })
- },
-
//-- 加入购物的函数 --
add_cart_func: function (t) {
var i = getApp().request;
@@ -1186,12 +951,7 @@ Page({
return s.my_warnning("还未登录!", 0, this);
}
- var e = this,
- th = e,
- a = 0,
- o = this.data.sele_g;
- a = o.goods_id;
-
+ var e = this,th = e, o = this.data.sele_g,a = o.goods_id;
//----------添加到购物车时,要判断限购数量,--------
e.get_buy_num(o, function (ee) {
//---判断商品是否超出限购---
@@ -1234,6 +994,7 @@ Page({
goods_name: o.goods_name,
goods_sn: o.goods_sn,
sku: o.sku,
+ presell_list_id:th.data.presellList.id,
};
//---是不是从收藏夹出来的---
@@ -1270,163 +1031,22 @@ Page({
newd.pricing_type = o.pricing_type;
}
- //-----如果是秒杀,团购,积分购,拼团-----
- if (th.data.prom_type == 1) {
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;
+ newd.prom_type = 8;
+ newd.prom_id = o.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 == 2 || th.data.prom_type == 4 || th.data.prom_type == 5) {
- 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); //加入购物车下一步
- }
- }
+
})
},
//---加入购物车的最后一步---
add_cart_next(e, t, a, o, newd, CanOutQty) {
var th = this, i = getApp().request;
- //---如果商品不是积分购和拼团,要判断一个是否要进行等级价的判断------
- if (o.prom_type != 1 && ((o.prom_type != 6 && o.prom_type != 4) || 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) {
@@ -1506,102 +1126,29 @@ Page({
});
}
}
- });
-
- }
- //else "exchange" == t.currentTarget.dataset.action ? this.exchange(d) : this.buyNow(d);
- else {
-
- 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;
- }
- }
-
- }
+ })
+ }else {
newd['pick_name'] = th.data.sto_sele_name;
newd['pick_dis'] = th.data.sto_sele_distr;
th.buyNow(newd);
}
},
-
- //----------购买虚拟商品------
- buyVirtualGoods: function (e) {
- Object.assign(e, {
- goods_name: this.data.data.goods.goods_name,
- spec_name: this.data.select.specName,
- price: this.data.select.price
- }), wx.navigateTo({
- url: "/pages/virtual/buy_step/buy_step?" + t.Obj2Str(e)
- });
- },
- //----------积分兑换---------
- exchange: function (e) {
- this.data.shippingCost < 0 || this.data.select.stock <= 0 || wx.navigateTo({
- url: "/pages/cart/integral/integral?" + t.Obj2Str(e)
- });
- },
-
-
//----------立即购买-----------
buyNow: function (e) {
- // this.data.shippingCost < 0 || this.data.select.stock <= 0 || (Object.assign(e, {
- // action: "buy_now"
- // }),
+
this.setData({
openSpecModal: 0,
openSpecModal_inte: 0,
openSpecModal_inte_normal: 0,
openSpecModal_pt: 0,
})
-
- if (e.prom_type == 4) {
- s.set_b_now(e);
- var url = "/pages/cart/cart2_inte/cart2_inte?is_bnow=1&goods_id=" + e.goods_id;
- getApp().goto(url);
- } else {
- //要判断积分购的普通购买有没有参加优惠活动
- if (e.is_integral_normal == 1) {
- this.check_nor_promgood(e.goods_id, function (res) {
- if (res && res.cat_id) {
- e.prom_type = 3;
- e.prom_id = res.cat_id
- }
- s.set_b_now(e);
- /*--
- wx.redirectTo({
- url: "/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id,
- });--*/
- getApp().goto("/packageC/pages/presell/cart/cart?is_bnow=1&goods_id=" + e.goods_id)
-
- })
- } else {
- s.set_b_now(e);
- /*--
- wx.redirectTo({
- url: "/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id,
- });--*/
- getApp().goto("/packageC/pages/presell/cart/cart?is_bnow=1&goods_id=" + e.goods_id)
- }
-
- }
+
+ app.set_b_now(e);
+ getApp().goto("/packageC/pages/presell/cart/cart2_pre");
+
+
},
//----------增加购买数量-----------
@@ -1654,7 +1201,7 @@ Page({
}
//--判断商品是否超出活动限购--
- if (th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0 && !th.data.is_normal) {
+ if (th.data.prom_buy_num != -1 && th.data.prom_buy_limit > 0) {
if (t + th.data.prom_buy_num > th.data.prom_buy_limit) {
wx.showModal({
title: '超出商品活动限购',
@@ -1667,24 +1214,8 @@ Page({
}
}
- if (th.data.sele_g.prom_type == 1 || th.data.sele_g.prom_type == 6) {
- 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)) {
@@ -1795,7 +1326,6 @@ Page({
sele_g: this.data.data,
gid: this.data.data.goods_id
})
-
this.sele_spec_chech_activity();
}
@@ -2173,14 +1703,13 @@ Page({
//-----图片失败,默认图片-----
bind_bnerr2: function (e) {
-
var _errImg = e.target.dataset.errorimg;
var _errObj = {};
_errObj[_errImg] = this.data.iurl + "/miniapp/images/hui_hear_pic.png"
this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
},
- //----------装载同一条形码的商品----------
+ //----------装载同一活动中的商品----------
async get_sku(stoid, gd, g_id, is_normal, func) {
var tt = this, arrdata = null;
var now = ut.gettimestamp();
@@ -2192,7 +1721,9 @@ Page({
isonsale: 1,
is_on_sale: 1,
pageSize: 500,
- orderField: 'sort'
+ orderField: 'sort',
+ prom_id:tt.data.presellForm.id,
+ prom_type:8,
}
}).then(res => {
var e = res;
@@ -2234,7 +1765,6 @@ Page({
if (res.data.code == 0) prom = res.data.data;
})
break
-
}
@@ -2314,43 +1844,8 @@ Page({
gid: gid
});
-
-
- that.check_is_youhui(gid, that.data.is_normal);
-
- var ty = 0;
- this.get_sto(that.data.is_normal);
-
-
- //默认门店要拿下门店库存
- if (that.data.sales_rules == 2 && that.data.def_pick_store) {
- var lock = 0, plist = null;
- //先读取门店的lock,采用链式写法,少用await
- getApp().request.promiseGet("/api/weshop/order/ware/lock/page", {
- data: { store_id: os.stoid, wareId: ee.data.sele_g.goods_id, storageId: that.data.def_pick_store.pickup_id, pageSize: 1000 }
- }).then(res => {
- if (res.data.code == 0 && res.data.data.total > 0) {
- for (var i in res.data.data.pageData)
- lock += res.data.data.pageData[i].outQty
- }
- //---通过接口获取门店的线下库存信息--
- return getApp().request.promiseGet("/api/weshop/goods/getWareStorages", {
- data: { storageNos: that.data.def_pick_store.pickup_no, wareIds: encodeURIComponent(th.data.sele_g.erpwareid), storeId: os.stoid }
- })
- }).then(res => {
- if (res.data.code == 0 && res.data.data.total > 0) {
- plist = res.data.data.pageData[0];
- }
- if (plist && plist.CanOutQty - lock > 0) {
- that.data.def_pick_store.CanOutQty = plist.CanOutQty - lock;
- } else {
- that.data.def_pick_store.CanOutQty = 0;
- }
- //--给门店赋值线下库存--
- th.setData({ def_pick_store: that.data.def_pick_store });
- })
- }
-
+ //that.check_is_youhui(gid, that.data.is_normal);
+ this.get_sto();
this.sele_spec_chech_activity();
},
@@ -2415,8 +1910,7 @@ Page({
//---------拿出门店分类和门店------------
get_sto(e) {
- var th = this, that = this;
- var is_normal = e;
+ var th = this,is_normal = e;
if (e == 1) {
th.setData({ is_normal: 1 })
@@ -2891,24 +2385,11 @@ Page({
//加载更多是靠这个函数
onReachBottom: function () {
if (this.data.activeCategoryId == 2) {
- if (!this.data.comments_no_more) this.requestComments_new();
- }
-
- var goods_list = this.selectComponent("#goods_list"); //组件的id
- if (goods_list) goods_list.get_list();
- },
-
- //--------检查是否活动,活动是否开始,或者是否结束-------
- async check_prom(gid, prom_type, prom_id) {
- var ee = this,
- th = ee;
- if (prom_type == 3 || prom_type == 0 || prom_type == 2 || prom_type == 5 || prom_type == 7) {
- this.setData({
- prom_type: 0,
- isshow: 1,
- });
- return false;
- }
+ if (!this.data.comments_no_more) this.requestComments_new();
+ }
+
+ var goods_list = this.selectComponent("#goods_list"); //组件的id
+ if (goods_list) goods_list.get_list();
},
//--获取有多少人在开团--
@@ -3107,213 +2588,6 @@ Page({
});
},
- //--------拼团玩法显示详情--------
- show_pt_xx: function (e) {
- this.setData({
- pd_xx: 1,
- })
- },
- close_pt_xx: function () {
- this.setData({
- pd_xx: 0,
- })
- },
-
-
- //-----------------拼单生成方法---------------------
- addCart_pt: function () {
- var th = this;
- if (this.data.is_normal == 0) {
- //看一下有没有起购数,如果有起购数,要计算起购数
- var qnum = parseFloat(th.data.prom_act.minbuynum);
- if (qnum > 0 && th.data.goodsInputNum < qnum) {
- getApp().confirmBox("拼团商品至少要买" + qnum + "件!");
- return false;
- }
-
- th.addcart_pt_func();
- } else {
- th.addcart_pt_func();
- }
- },
-
- addcart_pt_func: function () {
- if (oo.user_id == null) {
- s.my_warnning("还未登录!", 0, this);
- return;
- }
- var e = this,
- th = e,
- o = this.data.sele_g;
- if (o.store_count <= 0) return s.my_warnning("库存已为空!", 0, th);
-
- //----------添加到购物车时,要判断限购数量,--------
- e.get_buy_num(o, async 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: '超出商品限购'
- });
-
- 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.prom_buy_num != -1 && th.data.prom_buy_limit > 0 && th.data.is_normal != 1) {
- if (th.data.goodsInputNum + th.data.prom_buy_num > th.data.prom_buy_limit) {
- wx.showModal({
- title: '提示',
- content: '超出商品活动限购'
- });
-
- var num = th.data.prom_buy_limit - th.data.prom_buy_num;
- if (num < 0) num = 0;
- th.setData({ goodsInputNum: num })
- return false;
- }
- }
-
- var redis_num = 0
- //不是普通购买的时候
- if (th.data.is_normal != 1) {
- //-------判断活动是否抢光---------
- await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + os.stoid + "/6/" + th.data.sele_g.prom_id, {
- 1: 1
- }).then(res => {
- redis_num = res.data.data;
- })
-
- if (th.data.goodsInputNum > redis_num) {
- wx.showModal({
- title: '提示',
- content: '超出商品活动库存'
- });
-
- th.setData({ goodsInputNum: redis_num })
-
- return false;
- }
- }
-
- if (th.data.goodsInputNum <= 0) return s.my_warnning("商品数量不能为0", 0, th);
- if (th.data.goodsInputNum > o.store_count) {
- th.setData({ goodsInputNum: o.store_count })
- return s.my_warnning("超出商品库存", 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,
- goods_name: o.goods_name,
- goods_sn: o.goods_sn,
- sku: o.sku,
- };
-
- //---是不是从收藏夹出来的---
- if (th.data.c_guide_id) {
- newd['guide_id'] = th.data.c_guide_id;
- newd['guide_type'] = 2;
-
- } else {
- if (getApp().globalData.guide_id) {
- newd['guide_id'] = getApp().globalData.guide_id;
- newd['guide_type'] = 0;
-
- }
- }
-
- //让商品带上房间号
- 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;
- }
- }
-
- //---如果商品不是积分购和拼团,要判断一个是否要进行等级价的判断------
-
- if (th.data.is_normal == 1) {
- var conf = th.data.bconfig;
- if (conf.switch_list) {
- var s_list = JSON.parse(conf.switch_list);
- //如果后台有开启等级价的功能
- if (parseInt(s_list.rank_switch) == 2) {
- 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;
- }
- }
- }
- }
-
-
- //-----如果是秒杀,团购,积分购,拼团,且不是普通购买-----
- if (th.data.prom_type == 6 && th.data.is_normal != 1) {
- newd.goods_price = th.data.prom_price;
- newd.prom_type = th.data.prom_type;
- newd.prom_id = th.data.prom_id;
- newd.kt_type = th.data.prom_act.kttype; //开团类型
- newd.is_pt_tz = 0;
- //th.data.sto_sele_distr=1; //直接用自提的方式提交
- if (newd.kt_type > 1) {
- newd.is_pt_tz = 1; //开团类型
- }
- if (newd.kt_type == 3) {
- th.data.sto_sele_distr = 1;
- }
-
- } else if (th.data.prom_type == 3) {
- newd.prom_type = 0;
- newd.prom_id = 0;
- }
-
- newd['pick_name'] = th.data.sto_sele_name;
- newd['pick_dis'] = th.data.sto_sele_distr;
- newd['is_normal'] = th.data.is_normal;
-
- if (newd['is_normal']) {
- newd['is_pd_normal'] = 1;
- //判断一下有没有全局优惠活动
- th.check_nor_promgood(newd.goods_id, function (e) {
- if (e && e.act_id) {
- newd['prom_type'] = 3;
- newd['prom_id'] = e.act_id;
- }
- th.buyNow(newd)
- })
- }
- else th.buyNow_pt(newd);
- })
- },
- //----------立即购买_pt-----------
- buyNow_pt: function (e) {
- s.set_b_now(e);
- wx.navigateTo({
- url: "/pages/cart/cart2_pt/cart2_pt?is_bnow=1&goods_id=" + e.goods_id,
- });
- },
-
//-------跳转pt商品-------
go_to_nopay: function () {
var th = this;
@@ -3338,7 +2612,7 @@ Page({
},
- //---拼团倒计时---
+ //---倒计时---
countDown2() {
if (!this.data.is_timer) return false;
var th = this;
@@ -3379,77 +2653,6 @@ Page({
}
setTimeout(th.countDown2, 1000);
},
- //跳转参加团
- go_cj_team: function (e) {
- var ind = e.currentTarget.dataset.ind;
- var item = this.data.teamgroup[ind];
- var id = item.id;
- var th = this;
-
- getApp().request.get("/api/weshop/order/page", {
- data: {
- pt_prom_id: item.team_id,
- user_id: oo.user_id,
- store_id: os.stoid,
- pageSize: 1,
- page: 1
- },
- success: function (e) {
- if (e.data.code != 0) {
- getApp().my_warnning("读取订单失败", 0, th);
- return fasle;
- }
- //--跳转到已经购买的情况--
- if (e.data.data.pageData.length > 0) {
- var odr = e.data.data.pageData[0];
- //还未支付
- if (odr.pt_status == 0 && (odr.order_status == 1 || odr.order_status == 0)) {
- wx.showModal({
- title: "您已经购买了该商品待支付中",
- success: function (a) {
- if (a.confirm) {
- wx.navigateTo({
- url: "/pages/user/order_detail/order_detail?order_id=" + odr.order_id,
- });
- }
- }
- });
- } else if (odr.pt_status == 1 && odr.order_status == 1) {
-
- if (this.data.is_go_to_team_show) return false;
- this.data.is_go_to_team_show = 1;
- wx.showLoading();
- /*--
- wx.redirectTo({
- url: "/pages/team/team_success/team_success?ordersn=" + odr.order_sn,
- });--*/
-
- getApp().goto("/pages/team/team_success/team_success?ordersn=" + odr.order_sn);
-
- } else {
- wx.navigateTo({
- url: "/pages/team/team_show/team_show?tg_id=" + id,
- });
- }
- }
- //--跳转到参团--
- else {
- wx.navigateTo({
- url: "/pages/team/team_show/team_show?tg_id=" + id,
- });
- }
- }
- })
-
- },
-
- //跳到团更多
- go_t_more: function () {
- var team_id = this.data.prom_id;
- wx.navigateTo({
- url: "/pages/team/team_more/team_more?team_id=" + team_id,
- });
- },
//--点赞功能--
click_zan: function (e) {
@@ -3877,8 +3080,6 @@ Page({
context.setFontSize(22 * unit)
context.fillText("长按识别二维码", 40 * unit, 806 * unit);
context.fillText("立即开始兑换", 40 * unit, 846 * unit);
-
-
}
//---二维吗图---
@@ -4822,56 +4023,6 @@ Page({
wx.navigateTo({ url: url, })
},
- //---检查有没有优惠活动---
- check_is_youhui: function (gid, is_nor) {
- var th = this;
- //如果是普通购买的时候,要进行调用
- if (is_nor) {
- getApp().request.get("/api/weshop/goods/getGoodsPromNormal/" + os.stoid + "/" + gid, {
- success: function (res) {
- if (res.data.code == 0) {
- var r_data = res.data.data;
- th.setData({
- prom_goods: r_data.promGoodsLists,
- })
- th.is_show_more_buy();
- }
- },
- })
-
- } else {
- //调用接口判断订单优惠,
- getApp().request.get("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + gid + "/0", {
- success: function (res) {
- if (res.data.code == 0) {
- var r_data = res.data.data;
- var max = 0, min = 0;
- if (r_data.collocationList) {
- for (var i in r_data.collocationList) {
- if (max == 0) max = r_data.collocationList[i].price;
- if (min == 0) min = r_data.collocationList[i].price;
-
- if (max < parseFloat(r_data.collocationList[i].price)) max = r_data.collocationList[i].price;
- if (min > parseFloat(r_data.collocationList[i].price)) min = r_data.collocationList[i].price;
- }
- r_data.collocationPromList.max = (max + th.data.data.shop_price).toFixed(2);
- r_data.collocationPromList.min = (min + th.data.data.shop_price).toFixed(2);
- }
- th.setData({
- order_prom: r_data.promOrder,
- collocationGoods: r_data.collocationPromList,
- prom_goods: r_data.promGoodsLists,
- })
- th.is_show_more_buy();
- }
- }
-
- })
- }
-
-
- },
-
closePoster() {
this.setData({
showPoster: false,
@@ -5014,29 +4165,6 @@ Page({
},
- //-- 积分购 --
- go_pay_integral: function () {
- this.get_sto(0)
- this.setData({ openSpecModal_inte: 1, goodsInputNum: 1 });
- },
- //-- 积分购普通购买 --
- go_pay_integral_normal: function () {
- var th = this;
- if (th.data.sku_g_pt) {
- this.get_sto(1)
- this.setData({ openSpecModal_inte_normal: 1 });
- } else {
- th.get_sto(1);
- th.get_sku(o.stoid, th.data.data, th.data.gid, 1, function () {
- th.setData({
- is_normal: 1,
- openSpecModal_inte_normal: 1
- });
- });
- }
- this.check_is_youhui(th.data.gid, 1);
- },
-
closeSpecModal_inte: function () {
this.setData({ openSpecModal_inte: 0 });
},
@@ -5053,97 +4181,100 @@ Page({
},
addCart_inte: function (t) {
- this.add_cart_func_inte(t);
- },
-
-
-
-
- onShareTimeline() {
- var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : '';
- if (!store_name)
- store_name = getApp().globalData.setting.appName;
- return {
- title: this.data.data.goods_name + '-' + store_name,
- imageUrl: this.data.gallery[0].image_url,
- }
+ this.add_cart_func_inte(t);
},
- clickCollapse() {
- this.setData({
- flag: !this.data.flag,
- })
- },
+ onShareTimeline() {
+ var store_name = getApp().globalData.config ? getApp().globalData.config.store_name : '';
+ if (!store_name)
+ store_name = getApp().globalData.setting.appName;
+ return {
+ title: this.data.data.goods_name + '-' + store_name,
+ imageUrl: this.data.gallery[0].image_url,
+ }
+ },
- clickShare() {
- this.setData({
- share_hidden: true,
- });
- },
+ clickCollapse() {
+ this.setData({flag: !this.data.flag,})
+ },
- send() {
- this.setData({
- share_hidden: false,
- });
- },
+ clickShare() {
+ this.setData({share_hidden: true,});
+ },
- cancel() {
- this.setData({
- share_hidden: false,
- });
- },
+ send() {
+ this.setData({share_hidden: false,});
+ },
- //积分购和拼团的普通购买的的时候,要判断有没有全场优惠活动
- check_nor_promgood(goods_id, back) {
- getApp().request.get("/api/weshop/goods/getGoodsPromNormal/" + os.stoid + "/" + goods_id, {
- success: function (res) {
- if (res.data.code == 0 && res.data.data && res.data.data.promGoodsLists && res.data.data.promGoodsLists.length > 0) {
- var obj = {
- act_id: res.data.data.promGoodsLists[0].prom_id,
- }
- back(obj);
- } else {
- back(0)
- }
- }
- })
- },
+ cancel() {
+ this.setData({
+ share_hidden: false,
+ });
+ },
- go_zh: function (e) {
- var id = e.currentTarget.dataset.id;
- getApp().goto("/packageB/pages/zuhegou/index/index?id=" + id);
- },
+ //积分购和拼团的普通购买的的时候,要判断有没有全场优惠活动
+ check_nor_promgood(goods_id, back) {
+ getApp().request.get("/api/weshop/goods/getGoodsPromNormal/" + os.stoid + "/" + goods_id, {
+ success: function (res) {
+ if (res.data.code == 0 && res.data.data && res.data.data.promGoodsLists && res.data.data.promGoodsLists.length > 0) {
+ var obj = {
+ act_id: res.data.data.promGoodsLists[0].prom_id,
+ }
+ back(obj);
+ } else {
+ back(0)
+ }
+ }
+ })
+ },
- check_zh_acting: function (func) {
- var isok = 1, item = this.data.sele_g;
- //如果有组合购
- var url = "/api/weshop/prom/zhbuy/get/" + os.stoid + "/" + item.prom_id + "/" + getApp().globalData.userInfo.user_id;
- getApp().request.promiseGet(url, {}).then(res => {
- if (res.data.code == 0 && res.data.data) {
- if (res.data.data.is_show != 1) {
- isok = 0;
+ async get_pre_prom(func){
+ var th = this;
+ var presell_id = null;
+ var pre_arr = null;
+ //------获取预售从表----------
+ await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/get/" + os.stoid + "/" + th.data.pre_id, {}).then(res => {
+ if (res.data.code == 0 && res.data.data) {
+ var arr = res.data.data;
+ presell_id = arr.presell_id;
+ th.setData({
+ presellList: arr,
+ })
+ }
+ })
+ if (!presell_id) {
+ wx.showToast({title: "未找到活动商品", icon: 'none', duration: 3000})
+ return false;
}
- //如果活动已经结束
- if (res.data.data.is_end == 1) {
- isok = 0;
+ //------获取预售主表----------
+ await getApp().request.promiseGet(`/api/weshop/marketing/marketingPresellForm/get/${os.stoid}/${presell_id}`, {}).then(res => {
+ if (res.data.code == 0 && res.data.data) {
+ th.setData({
+ presellForm: res.data.data,
+ });
+ th.countDown(res.data.data.end_time)
+ }
+ })
+ var userInfo = getApp().globalData.userInfo;
+ var pre_data = {store_id: os.stoid, is_end: 0, timetype: 1, isuse: 1, goods_id: th.data.gid};
+ if (userInfo) {
+ pre_data.user_id = userInfo.user_id;
}
- //已经结束
- if (ut.gettimestamp() > res.data.data.end_time) {
- isok = 0;
+ await getApp().request.promiseGet("/api/weshop/marketing/marketingPresellList/page", {
+ data: pre_data,
+ }).then(e => {
+ if (e.data.code == 0 && e.data.data.pageData && e.data.data.pageData.length > 0) {
+ pre_arr = e.data.data.pageData[0];
+ th.setData({pre_arr: pre_arr})
+ }
+ })
+ if (!pre_arr) {
+ wx.showToast({title: "当前会员身份不符,无法参与", icon: 'none', duration: 3000})
}
- //还未开始
- if (ut.gettimestamp() < res.data.data.start_time) {
- isok = 0;
+ if (func) {
+ func();
}
-
- } else {
- //未找到商品的活动
- isok = 0;
- }
- item.act = res.data.data;
- func(isok);
- })
- }
+ }
});
diff --git a/packageC/pages/presell/goodsInfo/goodsInfo.wxml b/packageC/pages/presell/goodsInfo/goodsInfo.wxml
index c0ed359..9db2c73 100644
--- a/packageC/pages/presell/goodsInfo/goodsInfo.wxml
+++ b/packageC/pages/presell/goodsInfo/goodsInfo.wxml
@@ -151,7 +151,7 @@
- (配送不匹配)
+ (配送不匹配2)
(库存不足)
@@ -494,10 +494,8 @@
购物车
-
- 立即购买
-
-
+
+
{{filters.format_time(presellForm.end_time,2)}} 预售结束
@@ -527,20 +525,13 @@
{{sele_g.goods_name}}
-
- ¥
-
- {{sele_g[card_field]}}
- {{sele_g.shop_price}}
-
-
- ¥
- {{prom_price}}
+
+
+ ¥{{presellList.presell_money}}
- 券后¥
- {{sele_g.offline_price}}
+ 券后¥{{sele_g.offline_price}}
@@ -589,7 +580,7 @@
(库存不足)
- (配送不匹配)
+ (配送不匹配1)
(库存不足)
@@ -631,27 +622,21 @@
-
- 支付定金(¥9.9)
+
+ 门店的不匹配
-
- 库存不足
-
+ 未找到门店
-
- 库存不足
-
+ 未找到门店
-
- 库存不足
-
+ 未找到门店
@@ -660,44 +645,26 @@
-
-
-
-
- 库存不足
-
-
-
-
- 加入购物车
-
-
- {{sele_g.offline_price?"券后购买":"立即购买"}}
-
-
-
-
-
+
+
-
- 库存不足
-
+ 库存不足
-
- 加入购物车
-
-
- {{sele_g.offline_price?"券后购买":"立即购买"}}
+
+ 支付定金(¥{{presellList.presell_money}})
-
+
+
+
@@ -746,38 +713,7 @@
-
-
-
-
-
-
- 拼团玩法介绍
-
-
-
- 1.开团:
- 选择心仪商品,点击“发起X人团”按钮,付款后即为开团成功;
-
-
- 2.参团:
- 进入朋友分享的页面,点击“立即参团”按钮,付款后即为参团成功,若多人同时支付,支付成功时间较早的人获得参团资格;
-
-
- 3.成团:
- 在开团或参团成功后,点击“邀请小伙伴参团”将页面分享给好友,在有效时间内凑齐人数即为成团,此时商家会开始发货;
-
-
- 4.组团失败:
- 在有效时间内未凑齐人数,即为组团失败,此时付款项会原路退回到支付账户;
-
-
- 5.
- 组团有效期间内,拼购商品订单不允许取消。
-
-
-
-
+
@@ -985,10 +921,7 @@
-
+
\ No newline at end of file
diff --git a/packageC/pages/presell/list/list.js b/packageC/pages/presell/list/list.js
index adbf04d..d6a0eaa 100644
--- a/packageC/pages/presell/list/list.js
+++ b/packageC/pages/presell/list/list.js
@@ -17,10 +17,8 @@ Page({
onLoad: function (t) {
var first_leader = t.first_leader;
var th = this;
-
- console.log("------------");
- console.log(first_leader);
getApp().getConfig();
+ this.data.act_id=t.act_id;
if (first_leader) {
getApp().globalData.first_leader = first_leader;
@@ -52,10 +50,26 @@ Page({
}
})
- //调用列表
- this.get_list();
+ var userInfo=getApp().globalData.userInfo;
+ if(userInfo && goodlist.length==0){
+ //调用列表
+ this.get_list();
+ }else{
+ getApp().goto("/pages/togoin/togoin");
+ }
+ },
+ onShow: function (t) {
+ var userInfo=getApp().globalData.userInfo;
+ if(userInfo && this.data.goodlist.length==0){
+ //调用列表
+ this.get_list();
+ }else{
+ if(getApp().globalData.pre_back==1){
+ getApp().globalData.pre_back=0;
+ getApp().goto("/pages/index/index/index");
+ }
+ }
},
- onShow: function (t) { },
//---小于10的格式化函数----
timeFormat(param) {
return param < 10 ? '0' + param : param;
@@ -105,7 +119,13 @@ Page({
pageSize: 10,
timetype: 1
}
-
+ if(getApp().globalData.userInfo){
+ req.user_id=getApp().globalData.userInfo.user_id;
+ }
+ if(this.data.act_id){
+ req.prom_type=8;
+ req.prom_id=this.data.act_id;
+ }
//调用接口获取数据
getApp().request.get("/api/weshop/marketing/marketingPresellList/page", {
data: req,
@@ -132,6 +152,9 @@ Page({
}
})
},
+ go_index:function () {
+ getApp().goto("/pages/index/index/index");
+ }
});
diff --git a/packageC/pages/presell/list/list.wxml b/packageC/pages/presell/list/list.wxml
index 332fd6a..6adcd1a 100644
--- a/packageC/pages/presell/list/list.wxml
+++ b/packageC/pages/presell/list/list.wxml
@@ -32,12 +32,13 @@
-
+
- {{item.goods_name}}
+ {{item.goods_name}}
@@ -68,11 +69,13 @@
+
+
+ 去首页逛逛
+
+ -- 没有更多 --
-
--- 没有更多 --
-
-
+
diff --git a/packageC/pages/presell/list/list.wxss b/packageC/pages/presell/list/list.wxss
index ce46633..d59852e 100644
--- a/packageC/pages/presell/list/list.wxss
+++ b/packageC/pages/presell/list/list.wxss
@@ -191,5 +191,15 @@ border-radius:20rpx;height:26rpx;
.xc-fill-text{
left:34%;
line-height: 26rpx;
+}
+.bc_btn{
+ margin: 10rpx auto;
+ width: 200rpx;
+ height: 60rpx;
+ text-align: center;
+ line-height: 60rpx;
+ background-color: #ff0000;
+ color: #fff;
+ border-radius: 10rpx;
}
\ No newline at end of file