diff --git a/components/diy_picMax/diy_picMax.wxml b/components/diy_picMax/diy_picMax.wxml
index f19db22..bfda429 100644
--- a/components/diy_picMax/diy_picMax.wxml
+++ b/components/diy_picMax/diy_picMax.wxml
@@ -24,6 +24,11 @@
+
+
+
+
+
diff --git a/packageA/pages/myGift/myGift.js b/packageA/pages/myGift/myGift.js
index ab53025..c1e8126 100644
--- a/packageA/pages/myGift/myGift.js
+++ b/packageA/pages/myGift/myGift.js
@@ -61,7 +61,8 @@ Page({
/**
* 生命周期函数--监听页面初次渲染完成
*/
- onReady: function () {},
+ onReady: function () {
+ },
/**
* 生命周期函数--监听页面显示
@@ -75,6 +76,7 @@ Page({
userInfo: app.globalData.userInfo,
imghost: app.globalData.setting.imghost,
isLogin: true,
+ now:Date.parse(new Date()) / 1000,
});
var index=this.data.currentIndex;
@@ -91,7 +93,7 @@ Page({
if(index == 0) {
url = '/api/weshop/libao/libaoForm/page';
- data.timetype=1;
+ data.timetype=2;
} else if(index == 1) {
url = '/api/weshop/libao/libaoFormvip/page';
};
diff --git a/packageA/pages/myGift/myGift.wxml b/packageA/pages/myGift/myGift.wxml
index 9fb2f5b..731944e 100644
--- a/packageA/pages/myGift/myGift.wxml
+++ b/packageA/pages/myGift/myGift.wxml
@@ -5,11 +5,11 @@
-
+
-
+
@@ -23,11 +23,11 @@
{{filter.toFix(item.lbprice,2)}}/{{item.lbintegral}}积分
-
- {{filter.toFix(item.lbprice,2) }}
+
+ {{filter.toFix(item.lbprice,2) }}
- {{item.lbintegral}}积分
+ {{item.lbintegral}}积分
@@ -36,20 +36,28 @@
已售{{item.salenum+item.virtualsales}}件
- 活动结束日期 {{filter.format_time(item.endtime)}}
+ 活动开始日期 {{filter.format_time(item.startime)}}
+ 活动结束日期 {{filter.format_time(item.endtime)}}
-
- 立即兑换
- 立即购买
-
+
+ 活动还未开始
+
+
+
+ 立即兑换
+ 立即购买
+
+
-
+
-
+
+
+
@@ -63,7 +71,7 @@
-
+
—— 已经到底了 ——
@@ -75,7 +83,7 @@
-
+
活动说明:
{{pop_remark_text}}
diff --git a/packageA/pages/myGift/myGift.wxss b/packageA/pages/myGift/myGift.wxss
index 1e961aa..05f5d37 100644
--- a/packageA/pages/myGift/myGift.wxss
+++ b/packageA/pages/myGift/myGift.wxss
@@ -52,6 +52,16 @@ page {
font-weight: bold;
}
+.btn1 {
+ padding: 20rpx;
+ flex: 1;
+ text-align: center;
+}
+
+.btn1.gray{
+ background-color: #cccccc;
+ color:#fff
+}
.tab-title-item::after {
position: absolute;
diff --git a/packageD/pages/user/deposit/deposit.js b/packageD/pages/user/deposit/deposit.js
index 78c8c9b..c4f0bd2 100644
--- a/packageD/pages/user/deposit/deposit.js
+++ b/packageD/pages/user/deposit/deposit.js
@@ -1,3 +1,11 @@
+/*
+ * @Author: your name
+ * @Date: 2022-03-26 11:41:08
+ * @LastEditTime: 2022-04-13 14:28:30
+ * @LastEditors: your name
+ * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
+ * @FilePath: \MShopWeApp\packageD\pages\user\deposit\deposit.js
+ */
var t = getApp(),
a = t.request,
o = t.globalData.setting,
@@ -24,7 +32,7 @@ Page({
return false;
}
wx.setNavigationBarTitle({
- title: "预存款",
+ title: "储值款",
})
var th = this;
diff --git a/packageD/pages/user/deposit/deposit.wxml b/packageD/pages/user/deposit/deposit.wxml
index 2fdc92f..4e81dd0 100644
--- a/packageD/pages/user/deposit/deposit.wxml
+++ b/packageD/pages/user/deposit/deposit.wxml
@@ -1,6 +1,6 @@
- 预存款
+ 储值款
¥{{yucun_money}}
@@ -9,20 +9,20 @@
- 预存款充值
+ 储值款充值
- 预存款余额
+ 储值款余额
- 暂无任何预存款
+ 暂无任何储值款
diff --git a/pages/cart/cart2/cart2.js b/pages/cart/cart2/cart2.js
index 6cf052b..e4d7082 100644
--- a/pages/cart/cart2/cart2.js
+++ b/pages/cart/cart2/cart2.js
@@ -130,8 +130,9 @@ Page({
ladder_map: {}, //阶梯促销的map表
is_no_past: 1,
state: 0, //阶梯促销的的立即购买也走购物车流程state=1
- show_duo_gift:0,
- send_gf:{}, //多赠品的计算
+ show_duo_gift: 0,
+ send_gf: {}, //多赠品的计算
+ send_lb: {},
},
onLoad: function (t) {
wx.setNavigationBarTitle({ title: "填写订单", })
@@ -171,7 +172,8 @@ Page({
isget_by_quan: {},
is_no_by: {},
is_by: {},
- send_gf:{}
+ send_gf: {},
+ send_lb:{},
})
},
@@ -188,7 +190,6 @@ Page({
} else {
this.getuser_addr(function (ie) {
-
console.log("getuser_addr")
console.log(ie)
//地址切换要把包邮券清空
@@ -381,7 +382,7 @@ Page({
to.get_allsto(function (e) {
th.setData({ allsto: e });
//-------获取购物车已经选择的商品--------
- console.log('购物车结算');
+ console.log('购物车结算');
th.get_cart();
})
@@ -408,7 +409,7 @@ Page({
//-----真的获取购物车,入口--------
get_cart: function () {
- var th = this, app = getApp();
+ var th = this, app = getApp();
var state = 0;
if (th.data.state) state = 1;
a.get("/api/weshop/cart/list", {
@@ -452,6 +453,7 @@ Page({
//要把优惠活动加入,prom_goods_map中,赠品不要运算
if (item1.prom_type == 3 && item1.is_gift != 1) {
+ th.check_is_youhui(item1.goods_id, item1.pick_id);
await th.add_prom_goods_map(item1);
}
@@ -719,7 +721,7 @@ Page({
ie.wind = parseInt(th.data.cartlist[kj].wind);
//-- 是不是全部自提清空 --
- if(ie.exp_type==0) th.setData({ is_all_zt: 0 });
+ if (ie.exp_type == 0) th.setData({ is_all_zt: 0 });
break;
}
@@ -859,7 +861,6 @@ Page({
et = th.data.bn_exp_type;
m_wind = th.data.index;
}
-
//---是不是购买等级卡成功的返回---等级卡显示的判断---
var is_card_back = getApp().globalData.is_card_back;
if (is_card_back) {
@@ -915,12 +916,13 @@ Page({
t.data.data.prom_id = gg.prom_id;
t.data.data.prom_type = 3;
//如果是优惠活动,就要调用活动,计算价格
+ th.check_is_youhui(gg.goods_id,gg.pick_id);
th.buy_now_prom_goods(gg.prom_id, t.data.data, function (data) {
//判断一下购买商品的数量是不是超过
- if (data.gift_goods_id && (!data.zp_mode || parseInt(data.zp_mode)==0) ) {
- var num =data.zp_num?data.zp_num:1;
+ if (data.gift_goods_id && (!data.zp_mode || parseInt(data.zp_mode) == 0)) {
+ var num = data.zp_num ? data.zp_num : 1;
if (data.is_bz == 1) {
- num = num*data.bs;
+ num = num * data.bs;
if (num > data.gift_limit_num) num = 0;
}
//如果赠品数量超出礼品库存,就取消
@@ -943,9 +945,9 @@ Page({
ob.exp_sum_type = data.gift_exp_sum_type; //商品的物流计算方式
ob.uniform_exp_sum = data.gift_uniform_exp_sum //统一运费的金额
- var arr_gf=[];
+ var arr_gf = [];
arr_gf.push(ob);
- th.setData({ buy_now_gift_goods: arr_gf});
+ th.setData({ buy_now_gift_goods: arr_gf });
}
}
@@ -1174,8 +1176,8 @@ Page({
},
calc_per: async function (c_arr) {
- var send_gf={};
- var duo_zp_num_arr={};
+ var send_gf = {};
+ var duo_zp_num_arr = {};
var th = this;
//-- 循环处理 --
for (var i in c_arr) {
@@ -1197,7 +1199,7 @@ Page({
//等待,获取一下优惠活动的信息
await getApp().request.promiseGet("/api/weshop/goods/getDiscount", {
data: {
- price:parseFloat(item_map.price).toFixed(2),prom_id:item_map.prom_id,
+ price: parseFloat(item_map.price).toFixed(2), prom_id: item_map.prom_id,
goods_num: item_map.goods_num, user_id: getApp().globalData.user_id,
is_bz: item_map.is_bz
}
@@ -1213,10 +1215,10 @@ Page({
item_map.s_coupon_num = get_data.coupon_num;
- if (get_data.gift_id && parseInt(get_data.zp_mode)!=1
- && get_data.zp_num* item_map.bs<=get_data.limit_num
- && get_data.zp_num* item_map.bs<=get_data.gift_storecount
- ){
+ if (get_data.gift_id && parseInt(get_data.zp_mode) != 1
+ && get_data.zp_num * item_map.bs <= get_data.limit_num
+ && get_data.zp_num * item_map.bs <= get_data.gift_storecount
+ ) {
item_map.gift_id = get_data.gift_id;
item_map.gift_goods_id = get_data.goods_id;
@@ -1238,21 +1240,21 @@ Page({
item_map.zx_libao = get_data.zxlibao;
item_map.zx_lb_num = get_data.zxlb_num;
- if(parseInt(get_data.zp_mode)==1){
- if(!send_gf[pickid]) send_gf[pickid]=[];
+ if (parseInt(get_data.zp_mode) == 1) {
+ if (!send_gf[pickid]) send_gf[pickid] = [];
- var can_zp_num=0;
- for(let iy in get_data.giftsinfo){
- let item=get_data.giftsinfo[iy];
- can_zp_num+= parseInt(item.gift_storecount)>parseInt(item.limit_num)?parseInt(item.limit_num):parseInt(item.gift_storecount);
+ var can_zp_num = 0;
+ for (let iy in get_data.giftsinfo) {
+ let item = get_data.giftsinfo[iy];
+ can_zp_num += parseInt(item.gift_storecount) > parseInt(item.limit_num) ? parseInt(item.limit_num) : parseInt(item.gift_storecount);
}
- var t_zp_num=parseInt(get_data.zp_num)*parseInt(get_data.bs);
- if(duo_zp_num_arr[item_map.prom_id]){
- t_zp_num+=duo_zp_num_arr[item_map.prom_id];
+ var t_zp_num = parseInt(get_data.zp_num) * parseInt(get_data.bs);
+ if (duo_zp_num_arr[item_map.prom_id]) {
+ t_zp_num += duo_zp_num_arr[item_map.prom_id];
}
- if(can_zp_num>=t_zp_num) {
+ if (can_zp_num >= t_zp_num) {
send_gf[pickid].push({
pickup_id: pickid,
giftsinfo: get_data.giftsinfo,
@@ -1261,7 +1263,7 @@ Page({
prom_id: item_map.prom_id
});
- duo_zp_num_arr[item_map.prom_id]=t_zp_num;
+ duo_zp_num_arr[item_map.prom_id] = t_zp_num;
}
}
}
@@ -1325,7 +1327,7 @@ Page({
for (var j = 0; j < ord_goods.length; j++) {
if (ord_goods[j].is_gift) continue;
if (ord_goods[j].prom_type == 3 && ord_goods[j].prom_id == item_map.prom_id) {
- ord_goods[j].is_xz_yh =ord_goods[j].is_xz_yh?ord_goods[j].is_xz_yh:item_map.is_xz_yh;
+ ord_goods[j].is_xz_yh = ord_goods[j].is_xz_yh ? ord_goods[j].is_xz_yh : item_map.is_xz_yh;
ord_goods[j].is_past = item_map.is_past;
ord_goods[j].account_fir = th.item_map_get_goods(ord_goods[j].goods_id, item_map).account_fir;
ord_goods[j].account_yu_fir = th.item_map_get_goods(ord_goods[j].goods_id, item_map).account_yu_fir;
@@ -1373,11 +1375,11 @@ Page({
if (item_map.zx_libao) {
if (!cart_item.zx_libao) {
cart_item.zx_libao = item_map.zx_libao + "";
- cart_item.g_zxlb_num = [{'l_id': item_map.zx_libao, "num": item_map.zx_lb_num}];
+ cart_item.g_zxlb_num = [{ 'l_id': item_map.zx_libao, "num": item_map.zx_lb_num }];
}
else {
cart_item.zx_libao += "," + item_map.zx_libao;
- cart_item.g_zxlb_num.push({'l_id': item_map.zx_libao, "num": item_map.zx_lb_num})
+ cart_item.g_zxlb_num.push({ 'l_id': item_map.zx_libao, "num": item_map.zx_lb_num })
}
}
}
@@ -1387,12 +1389,12 @@ Page({
var arr = Object.keys(send_gf);
var arr2 = Object.keys(th.data.send_gf);
- if(arr2.length>0) return false;
+ if (arr2.length > 0) return false;
- if(arr.length>0){
- th.setData({send_gf:send_gf})
- }else{
- th.setData({send_gf:{}})
+ if (arr.length > 0) {
+ th.setData({ send_gf: send_gf })
+ } else {
+ th.setData({ send_gf: {} })
}
},
@@ -1404,12 +1406,12 @@ Page({
to.getwuliuprice(async function (rs) {
wx.showLoading({ title: "处理中." })
//是不是区域包邮
- th.data.is_area_by=0;
+ th.data.is_area_by = 0;
//当不是区域不包邮的时候,没有不包邮商品的时候
- th.data.free1=0;
- th.data.cut_o_shipping_price=0;
- th.data.cut_goods_piece=0;
- th.data.cut_goods_weight=0;
+ th.data.free1 = 0;
+ th.data.cut_o_shipping_price = 0;
+ th.data.cut_goods_piece = 0;
+ th.data.cut_goods_weight = 0;
var all_price = 0; //所有的商品总价
var all_shipping_m = 0; //所有的物流总价
@@ -1424,7 +1426,7 @@ Page({
var umoney = th.data.userinfo.user_money - th.data.txmon - (th.data.userinfo.frozen_money ? th.data.userinfo.frozen_money : 0);
var freight_free = ee.freight_free; //全场满多少包邮
- var free1=freight_free;
+ var free1 = freight_free;
var weight_free = ee.weight_free; //多少kg内包邮
var no_ex_id = ee.no_ex_id;
@@ -1596,7 +1598,7 @@ Page({
if (by_qc.region_list != "" && by_qc.region_list != null && by_qc.region_list != undefined) {
if (th.check_by_area(by_qc.region_list)) {
freight_free = 0;
- th.data.is_area_by=1;
+ th.data.is_area_by = 1;
//goods_weight = -1;
//out_of_weight = 0;
th.data.is_no_by[pickid] = 1;
@@ -1615,36 +1617,36 @@ Page({
- var is_in_no_ex_goods_arr=0;
- var by_g_weight=0;
+ var is_in_no_ex_goods_arr = 0;
+ var by_g_weight = 0;
//--------循环计算商品总物流-----------
for (var jo = 0; jo < item.length; jo++) {
//----------------如果是选择了物流---------------------
- if (cart_item.exp_type == 0 && item[jo].is_free_shipping == 0 && th.data.user_addr != null){
+ if (cart_item.exp_type == 0 && item[jo].is_free_shipping == 0 && th.data.user_addr != null) {
//判断是否有设置限制重量包邮,先看商品有没有包邮
- if(!no_ex_good_arr || no_ex_good_arr.indexOf(item[jo].goods_id + '')== -1){
- if(!th.data.is_area_by) th.data.free1=free1;
+ if (!no_ex_good_arr || no_ex_good_arr.indexOf(item[jo].goods_id + '') == -1) {
+ if (!th.data.is_area_by) th.data.free1 = free1;
//此时是 模板里面没有不包邮商品列表或者是 该商品没有再不包邮商品列表礼包
if (item[jo]['is_past'] !== 1 && item[jo]['exp_sum_type'] == 2) {
if (goods_weight < 0) goods_weight = 0;
//累积商品重量 每种商品的重量 * 数量
goods_weight += item[jo]['weight'] * item[jo]['goods_num'];
- by_g_weight+=item[jo]['weight'] * item[jo]['goods_num'];
+ by_g_weight += item[jo]['weight'] * item[jo]['goods_num'];
- if(free1>0){
+ if (free1 > 0) {
if (weight_free > 0) {
out_of_weight = (weight_free * 1000) - by_g_weight;
- }else{
- out_of_weight= -by_g_weight;
+ } else {
+ out_of_weight = -by_g_weight;
}
}
}
}
//这个是在不包邮列表礼包
- else if(no_ex_good_arr.indexOf(item[jo].goods_id + '') > -1){
- is_in_no_ex_goods_arr=1;
+ else if (no_ex_good_arr.indexOf(item[jo].goods_id + '') > -1) {
+ is_in_no_ex_goods_arr = 1;
if (item[jo]['is_past'] !== 1 && item[jo]['exp_sum_type'] == 2) {
if (goods_weight < 0) goods_weight = 0;
//累积商品重量 每种商品的重量 * 数量
@@ -1655,7 +1657,7 @@ Page({
}
}
- if(free1>0) {
+ if (free1 > 0) {
//当商品没有超出的时候
if (out_of_weight >= 0) {
out_of_weight = -by_g_weight;
@@ -1665,7 +1667,7 @@ Page({
}
//所有的商品都不在不包邮商品列表,freight_free为0的时候,以及不是区域包邮
- if(!is_in_no_ex_goods_arr && !freight_free && !th.data.is_area_by) freight_free=free1;
+ if (!is_in_no_ex_goods_arr && !freight_free && !th.data.is_area_by) freight_free = free1;
//--如果是物流,且选择了地址,就要开始显示包邮券,且包邮券也已经优惠了优惠活动的金额--
if (cart_item.exp_type == 0 && th.data.user_addr != null && !cart_item.is_xz_yh) {
@@ -1751,7 +1753,7 @@ Page({
if (no_ex_good) {
is_good_no_by = th.check_by_goods(no_ex_good, item[j].goods_id);
}
-
+
//--如果是包邮券使用的情况下,如果商品是包邮的,那么就不进行计算--
if (th.data.using_quan[pickid] && th.data.using_quan[pickid].isby == 1 && !is_good_no_by) {
continue;
@@ -1777,7 +1779,7 @@ Page({
}
- if(!no_ex_good_arr || no_ex_good_arr.indexOf(item[j].goods_id + '')== -1){
+ if (!no_ex_good_arr || no_ex_good_arr.indexOf(item[j].goods_id + '') == -1) {
switch (item[j]['exp_sum_type']) {
case 1:
//统一运费
@@ -1791,7 +1793,7 @@ Page({
}
- }else{
+ } else {
/*--
if(item[j]['exp_sum_type']==2 && out_of_weight!==0){
goods_weight = -1;
@@ -1839,7 +1841,7 @@ Page({
var order_m = 0;
//---判断是不是有订单优惠---
await getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", {
- data: { store_id: os.stoid, orderAmount: o_condition,user_id:getApp().globalData.user_id}
+ data: { store_id: os.stoid, orderAmount: o_condition, user_id: getApp().globalData.user_id }
}).then(res => {
if (res.data.code == 0) {
var ord_prom = res.data.data;
@@ -2284,9 +2286,9 @@ Page({
var l_txt = "formData.give_zxlb_id";
//这个是json格式的
var l_txt1 = "formData.g_zxlb_num";
- var ob = [{"num": good.zx_lb_num, "l_id": good.zx_libao}];
+ var ob = [{ "num": good.zx_lb_num, "l_id": good.zx_libao }];
ob = JSON.stringify(ob);
- th.setData({[l_txt]: good.zx_libao, [l_txt1]: ob});
+ th.setData({ [l_txt]: good.zx_libao, [l_txt1]: ob });
}
})
} else {
@@ -2343,7 +2345,7 @@ Page({
var l_txt1 = "formData.g_lb_num";
var ob = [{ "num": good.s_lb_num, "l_id": good.s_libao }];
ob = JSON.stringify(ob);
- th.setData({[l_txt]: good.s_libao, [l_txt1]: ob});
+ th.setData({ [l_txt]: good.s_libao, [l_txt1]: ob });
}
//专享礼包
@@ -2351,9 +2353,9 @@ Page({
var l_txt = "formData.give_zxlb_id";
//这个是json格式的
var l_txt1 = "formData.g_zxlb_num";
- var ob = [{"num": good.zx_lb_num, "l_id": good.zx_libao}];
+ var ob = [{ "num": good.zx_lb_num, "l_id": good.zx_libao }];
ob = JSON.stringify(ob);
- th.setData({[l_txt]: good.zx_libao, [l_txt1]: ob});
+ th.setData({ [l_txt]: good.zx_libao, [l_txt1]: ob });
}
}
@@ -2388,7 +2390,7 @@ Page({
}
})
this.setData({
- submit:1,
+ submit: 1,
})
},
@@ -2523,8 +2525,8 @@ Page({
'prom_id': th.data.bn_goods.prom_id, //促销活动id
};
- if(getApp().globalData.skinface_id){
- goods.skinface_id=getApp().globalData.skinface_id;
+ if (getApp().globalData.skinface_id) {
+ goods.skinface_id = getApp().globalData.skinface_id;
}
//-- 把导购的信息填入--
@@ -2613,8 +2615,8 @@ Page({
//--如果有赠品的时候,赠品也要提交---
if (th.data.buy_now_gift_goods) {
var gift_gg_arr = th.data.buy_now_gift_goods;
- for(let i in gift_gg_arr){
- let gift_gg=gift_gg_arr[i];
+ for (let i in gift_gg_arr) {
+ let gift_gg = gift_gg_arr[i];
var g_goods = {
'goods_id': gift_gg.goods_id,
'goods_name': gift_gg.goods_name,
@@ -2759,11 +2761,11 @@ Page({
order_prom_list.g_zxlb_num = JSON.stringify(t_item.g_zxlb_num);
}
- if (Object.keys(order_prom_list).length > 0){
- if(order_prom_list.discount_amount)
- order_prom_list.discount_amount= parseFloat(order_prom_list.discount_amount).toFixed(2);
- if(order_prom_list.order_prom_amount)
- order_prom_list.order_prom_amount= parseFloat(order_prom_list.order_prom_amount).toFixed(2);
+ if (Object.keys(order_prom_list).length > 0) {
+ if (order_prom_list.discount_amount)
+ order_prom_list.discount_amount = parseFloat(order_prom_list.discount_amount).toFixed(2);
+ if (order_prom_list.order_prom_amount)
+ order_prom_list.order_prom_amount = parseFloat(order_prom_list.order_prom_amount).toFixed(2);
item.order_prom_list = order_prom_list;
}
@@ -2809,8 +2811,8 @@ Page({
'store_id': oo.stoid,
};
- if(getApp().globalData.skinface_id){
- goods.skinface_id=getApp().globalData.skinface_id;
+ if (getApp().globalData.skinface_id) {
+ goods.skinface_id = getApp().globalData.skinface_id;
}
//-- 线下取价也要写入,组合购的商品不能去线下价格 --
@@ -2913,7 +2915,7 @@ Page({
if (pdata.length == 0) return;
var str = JSON.stringify(pdata);
-
+
wx.showLoading({ title: "加载中" });
wx.request({
url: oo.url + '/api/weshop/order/createWxdOrder',
@@ -3036,7 +3038,7 @@ Page({
},
complete: function () {
th.setData({
- submit:0,
+ submit: 0,
})
}
})
@@ -3232,8 +3234,8 @@ Page({
//------超出重量----------
if (out_of_weight < 0 && o_price >= freight_free && !th.data.is_no_by[pickid]) {
- goods_weight=goods_weight+ out_of_weight;
- if(goods_weight==0) goods_weight=-1;
+ goods_weight = goods_weight + out_of_weight;
+ if (goods_weight == 0) goods_weight = -1;
}
@@ -3247,12 +3249,12 @@ Page({
}
}
- if(th.data.free1 && freight_free<=0) freight_free=th.data.free1;
+ if (th.data.free1 && freight_free <= 0) freight_free = th.data.free1;
//当有包邮和不包邮混合在一起的时候,件数要重新计算
- if(freight_free>0 && o_price >= freight_free && goods_piece>0 && th.data.cut_goods_piece)
- goods_piece=goods_piece-th.data.cut_goods_piece;
+ if (freight_free > 0 && o_price >= freight_free && goods_piece > 0 && th.data.cut_goods_piece)
+ goods_piece = goods_piece - th.data.cut_goods_piece;
//------按件数----------
if (goods_piece > 0 && item['piecemoney']) {
fp_price = parseFloat(item['piecemoney']);
@@ -3263,7 +3265,7 @@ Page({
}
}
//当有包邮和不包邮混合在一起的时候,统一运费要重新计算
- if(freight_free>0 && o_price >= freight_free && th.data.cut_o_shipping_price && price>0) price=price-th.data.cut_o_shipping_price;
+ if (freight_free > 0 && o_price >= freight_free && th.data.cut_o_shipping_price && price > 0) price = price - th.data.cut_o_shipping_price;
var rspice = parseFloat(price + fw_price + fp_price);
return rspice;
@@ -3481,7 +3483,6 @@ Page({
},
-
/*----- 点击选择包邮券 -----*/
sele_quan_item_by: function (e) {
var no_use = e.currentTarget.dataset.no;
@@ -3936,7 +3937,7 @@ Page({
arr[ind].check_quan_ware_list = check_quan_ware_list;
arr[ind].check_quan_price_list = check_quan_price_list;
//是否关闭使用优惠券
- if (th.data.is_close_quan != 1 ) {
+ if (th.data.is_close_quan != 1) {
//--调用接口,获取优惠券的列表,3秒钟内控制接口请求--
var url = "/api/weshop/couponList/getUseCouponList";
await app.request.promiseGet(url, {
@@ -4045,7 +4046,7 @@ Page({
},
//立即购买获取优惠活动的内容
buy_now_prom_goods: function (prom_id, arr, func) {
- var th=this;
+ var th = this;
var price = arr.shop_price * arr.goods_num;
var prom = null;
var gg = to.get_b_now();
@@ -4068,7 +4069,7 @@ Page({
if (res.data.code == 0) {
var get_data = res.data.data;
arr.is_bz = prom.is_bz; //是不是倍增
- arr.is_xz_yh =arr.is_xz_yh?arr.is_xz_yh:prom.is_xz_yh; //是不是优惠
+ arr.is_xz_yh = arr.is_xz_yh ? arr.is_xz_yh : prom.is_xz_yh; //是不是优惠
arr.bs = get_data.bs; //是不是倍数
arr.is_past = get_data.is_past; //是不是包邮
arr.prom_price = get_data.price >= 0 ? get_data.price : price;
@@ -4076,13 +4077,13 @@ Page({
arr.s_coupon_id = get_data.coupon_id;
arr.s_coupon_num = get_data.coupon_num;
arr.zp_mode = get_data.zp_mode;
- arr.zp_num = get_data.zp_num?get_data.zp_num:1; //确保默认一个
+ arr.zp_num = get_data.zp_num ? get_data.zp_num : 1; //确保默认一个
//-- 看是不是有赠品 --
- if (get_data.gift_id && parseInt(get_data.zp_mode)!=1
- && get_data.zp_num* arr.bs<=get_data.limit_num
- && get_data.zp_num* arr.bs<=get_data.gift_storecount
- ){
+ if (get_data.gift_id && parseInt(get_data.zp_mode) != 1
+ && get_data.zp_num * arr.bs <= get_data.limit_num
+ && get_data.zp_num * arr.bs <= get_data.gift_storecount
+ ) {
arr.gift_id = get_data.gift_id;
arr.gift_goods_id = get_data.goods_id;
arr.gift_goods_name = get_data.goods_name;
@@ -4104,28 +4105,27 @@ Page({
arr.prom_id = prom_id;
- var send_gf={};
- var pickid=gg.pick_id;
- if(parseInt(get_data.zp_mode)==1){
- if(!send_gf[pickid]) send_gf[pickid]=[];
-
- var a_stock_num=0;
- var a_limit_num=0;
- for(let iy in get_data.giftsinfo){
- let item=get_data.giftsinfo[iy];
- a_stock_num+= parseInt(item.gift_storecount);
- a_limit_num+=parseInt(item.limit_num);
+ var send_gf = {};
+ var pickid = gg.pick_id;
+ if (parseInt(get_data.zp_mode) == 1) {
+ if (!send_gf[pickid]) send_gf[pickid] = [];
+
+ var a_stock_num = 0;
+ var a_limit_num = 0;
+ for (let iy in get_data.giftsinfo) {
+ let item = get_data.giftsinfo[iy];
+ a_stock_num += parseInt(item.gift_storecount);
+ a_limit_num += parseInt(item.limit_num);
}
- var t_zp_num=parseInt(get_data.zp_num)*parseInt(get_data.bs);
- if(a_limit_num>= t_zp_num && a_stock_num>=t_zp_num ){
+ var t_zp_num = parseInt(get_data.zp_num) * parseInt(get_data.bs);
+ if (a_limit_num >= t_zp_num && a_stock_num >= t_zp_num) {
send_gf[pickid].push({
- pickup_id:pickid,giftsinfo:get_data.giftsinfo,zp_num:get_data.zp_num*get_data.bs,
- gf_pr_name:prom.name,prom_id:prom.prom_id});
-
+ pickup_id: pickid, giftsinfo: get_data.giftsinfo, zp_num: get_data.zp_num * get_data.bs,
+ gf_pr_name: prom.name, prom_id: prom.prom_id
+ });
}
-
- th.setData({send_gf:send_gf});
+ th.setData({ send_gf: send_gf });
}
}
func(arr);
@@ -4137,7 +4137,7 @@ Page({
if (this.data.is_b_now == 1) pick = this.data.bn_pick;
//---获取订单优惠---
getApp().request.promiseGet("/api/weshop/promorder/getOrderPromotion", {
- data: { store_id: os.stoid, orderAmount: condition,user_id:getApp().globalData.user_id }
+ data: { store_id: os.stoid, orderAmount: condition, user_id: getApp().globalData.user_id }
}).then(res => {
if (res.data.code == 0) {
var data = res.data.data;
@@ -4202,6 +4202,89 @@ Page({
}
},
+ //---检查有没有优惠活动---
+ check_is_youhui: function (gid, pick_id) {
+ let th = this;
+ let user_id = getApp().globalData.user_id;
+ let send_lb = th.data.send_lb;
+ if (!user_id) user_id = 0;
+ //调用接口判断订单优惠,
+ getApp().request.get("/api/weshop/goods/getGoodsPromList/" + os.stoid + "/" + gid + "/0" + "/" + user_id, {
+ success: function (res) {
+ if (res.data.code == 0 && res.data.data) {
+ let r_data = res.data.data.promGoodsLists.filter(lb => {
+ return lb.lb_id ?? lb.zxlb_id;
+ });
+ r_data.forEach(item => {
+ if (send_lb[pick_id]) {
+ for (let i = 0; i < send_lb[pick_id].length; i++) {
+ let sends = send_lb[pick_id][i];
+ if (item.lb_id) {
+ if (sends.id === item.lb_id) {
+ sends['num']++;
+ } else {
+ let send_arr1 = send_lb[pick_id].filter(ii=>ii.id === item.lb_id);
+ if (send_arr1.length == 0) {
+ if (item.lb_id) {
+ let ob = {};
+ ob.num = 1;
+ ob.title = item.lbtitle;
+ ob.id = item.lb_id;
+ send_lb[pick_id].push(ob);
+ break;
+ }
+ }
+
+ }
+ }
+ if (item.zxlb_id) {
+ if (sends.id === item.zxlb_id) {
+ sends['num']++;
+ } else {
+ let send_arr = send_lb[pick_id].filter(ii=>ii.id === item.zxlb_id);
+ if (send_arr.length == 0) {
+ if (item.zxlb_id) {
+ let ob = {};
+ ob.num = 1;
+ ob.flag = 1;
+ ob.title = item.zxlbtitle;
+ ob.id = item.zxlb_id;
+ send_lb[pick_id].push(ob);
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ } else {
+ let arr = new Array();
+ if (item.lb_id) {
+ let ob = {};
+ ob.num = 1;
+ ob.title = item.lbtitle;
+ ob.id = item.lb_id;
+ arr.push(ob);
+ }
+ if (item.zxlb_id) {
+ let ob = {};
+ ob.num = 1;
+ ob.flag = 1;
+ ob.title = item.zxlbtitle;
+ ob.id = item.zxlb_id;
+ arr.push(ob);
+ }
+ send_lb[pick_id] = arr;
+ }
+ })
+ th.setData({
+ send_lb,
+ })
+
+ }
+ }
+ })
+ },
//计算立即购买赠品的物流费用
get_now_gift_goods_wuliu: function (code, o_shipping_price, user_addr, gift_freight_free, out_of_weight, allpice, rs, shipping_price, no_by_data, goods_weight1, goods_piece1) {
@@ -4209,8 +4292,7 @@ Page({
var goods_weight = -1, goods_piece = -1;
var gift_shipping_price = 0;
- if (shipping_price)
- {
+ if (shipping_price) {
gift_shipping_price = shipping_price;
}
var th = this;
@@ -4226,8 +4308,8 @@ Page({
}
}
- for(var i in good_arr) {
- var good=good_arr[i];
+ for (var i in good_arr) {
+ var good = good_arr[i];
switch (good['exp_sum_type']) {
case 1:
//统一运费
@@ -4247,7 +4329,7 @@ Page({
case 3:
if (goods_piece < 0) goods_piece = 0;
//累积商品数量
- goods_piece += parseInt(good['buynum']) ;
+ goods_piece += parseInt(good['buynum']);
if (goods_piece1) {
goods_piece += goods_piece1;
}
@@ -4259,14 +4341,14 @@ Page({
if (th.check_by_goods(no_by_data.goods_list, good.goods_id)) {
gift_freight_free = 0;
// out_of_weight = 0
- th.data.is_no_by[th.data.bn_pick]=1;
+ th.data.is_no_by[th.data.bn_pick] = 1;
}
}
}
var t_shipping_price =
this.calculatewuliu(code, gift_shipping_price, goods_weight, out_of_weight,
- goods_piece, user_addr, gift_freight_free, allpice, rs,th.data.bn_pick);
+ goods_piece, user_addr, gift_freight_free, allpice, rs, th.data.bn_pick);
return t_shipping_price;
},
@@ -4334,6 +4416,20 @@ Page({
this.setData({ is_offline_show: 1, show_off_price: off_price.toFixed(2), is_get_offline: is_get_offline });
},
+ // 促销 -> 送礼包 -> 查看详情
+ viewLbDetails(e) {
+ let id = e.currentTarget.dataset.id; // 获取礼包id
+ let flag = e.currentTarget.dataset.flag;
+ let url = '';
+ if (flag == 1) { // flag =1 控制跳转到专享礼包
+ url = `/pages/giftpack/giftpacklist/giftpacklist?lbId=${id}&flag=1`;
+ } else {
+ url = `/packageA/pages/myGiftDetails/myGiftDetails?btn=0&index=0&id=${id}`; // btn=0 控制跳转到的页面不显示按钮
+ };
+ // console.log('myurl', url);
+ getApp().goto(url);
+ },
+
//确定使用线下取价
sure_offline: function () {
var bn_goods = this.data.bn_goods;
@@ -4459,7 +4555,7 @@ Page({
},
//订阅消息提醒
sendsm: function (func) {
- let th =this;
+ let th = this;
var template_id = this.data.template_id;
// //授权订阅
wx.requestSubscribeMessage({
@@ -4467,417 +4563,417 @@ Page({
success(res) {
func();
th.setData({
- submit:0,
+ submit: 0,
})
},
fail(res) {
func();
th.setData({
- submit:0,
+ submit: 0,
})
}
})
},
- setexptype2: function(e) {
- this.debounce(this.setexptype.bind(this, e),400)();
- },
-
- setexptype_w2: function(e) {
- this.debounce(this.setexptype_w.bind(this, e),400)();
- },
-
- // 函数防抖
- debounce: function (func, wait) {
- return () => {
- clearTimeout(timer);
- timer = setTimeout(func, wait);
- };
- },
-
-
- //-- 判断是不是选中 --
- check_th_item:function (e) {
- var th=this;
- var idx=e.currentTarget.dataset.item;
- var check=e.currentTarget.dataset.check;
- var txt="giftsinfo["+idx+"].selected";
- var gift_item=this.data.giftsinfo[idx];
-
- if(check){
- th.setData({[txt]:0});
- }else{
-
- var is_true=th.check_out_num_cart(gift_item,this.data.gift_pkid,gift_item.goods_num);
- if(!is_true){ return false; }
-
- th.setData({[txt]:1});
- }
- },
-
-
- //输入框输入数量的时候
- valueToNum:function (e){
- var th=this;
- var idx=e.currentTarget.dataset.item;
- var gift_item=this.data.giftsinfo[idx];
- var num=parseInt(e.detail.value);
- var txt="giftsinfo["+idx+"].goods_num";
- var is_true=th.check_out_num_cart(gift_item,this.data.gift_pkid,num);
- if(!is_true){
- th.setData({[txt]:1});
- return false;
- }
- th.setData({[txt]:num});
+ setexptype2: function (e) {
+ this.debounce(this.setexptype.bind(this, e), 400)();
+ },
- },
+ setexptype_w2: function (e) {
+ this.debounce(this.setexptype_w.bind(this, e), 400)();
+ },
+
+ // 函数防抖
+ debounce: function (func, wait) {
+ return () => {
+ clearTimeout(timer);
+ timer = setTimeout(func, wait);
+ };
+ },
+ //-- 判断是不是选中 --
+ check_th_item: function (e) {
+ var th = this;
+ var idx = e.currentTarget.dataset.item;
+ var check = e.currentTarget.dataset.check;
+ var txt = "giftsinfo[" + idx + "].selected";
+ var gift_item = this.data.giftsinfo[idx];
- addNum:function (e) {
- var th=this;
- var idx=e.currentTarget.dataset.item;
- var txt="giftsinfo["+idx+"].goods_num";
- var num=th.data.giftsinfo[idx].goods_num+1;
- var gift_item=this.data.giftsinfo[idx];
- var is_true=th.check_out_num_cart(gift_item,this.data.gift_pkid,num);
- if(!is_true){ return false; }
- th.setData({[txt]:num});
- },
-
- subNum:function (e) {
- var th=this;
- var idx=e.currentTarget.dataset.item;
- var txt="giftsinfo["+idx+"].goods_num";
- var num=th.data.giftsinfo[idx].goods_num-1;
- var gift_item=this.data.giftsinfo[idx];
- var is_true=th.check_out_num_cart(gift_item,this.data.gift_pkid,num);
- if(!is_true){
- return false;
- }
- if(num<1) return false;
- th.setData({[txt]:num});
- },
+ if (check) {
+ th.setData({ [txt]: 0 });
+ } else {
+
+ var is_true = th.check_out_num_cart(gift_item, this.data.gift_pkid, gift_item.goods_num);
+ if (!is_true) { return false; }
+
+ th.setData({ [txt]: 1 });
+ }
+ },
+
+
+ //输入框输入数量的时候
+ valueToNum: function (e) {
+ var th = this;
+ var idx = e.currentTarget.dataset.item;
+ var gift_item = this.data.giftsinfo[idx];
+ var num = parseInt(e.detail.value);
+ var txt = "giftsinfo[" + idx + "].goods_num";
+ var is_true = th.check_out_num_cart(gift_item, this.data.gift_pkid, num);
+ if (!is_true) {
+ th.setData({ [txt]: 1 });
+ return false;
+ }
+ th.setData({ [txt]: num });
+
+ },
+
+
+
+ addNum: function (e) {
+ var th = this;
+ var idx = e.currentTarget.dataset.item;
+ var txt = "giftsinfo[" + idx + "].goods_num";
+ var num = th.data.giftsinfo[idx].goods_num + 1;
+ var gift_item = this.data.giftsinfo[idx];
+ var is_true = th.check_out_num_cart(gift_item, this.data.gift_pkid, num);
+ if (!is_true) { return false; }
+ th.setData({ [txt]: num });
+ },
+
+ subNum: function (e) {
+ var th = this;
+ var idx = e.currentTarget.dataset.item;
+ var txt = "giftsinfo[" + idx + "].goods_num";
+ var num = th.data.giftsinfo[idx].goods_num - 1;
+ var gift_item = this.data.giftsinfo[idx];
+ var is_true = th.check_out_num_cart(gift_item, this.data.gift_pkid, num);
+ if (!is_true) {
+ return false;
+ }
+ if (num < 1) return false;
+ th.setData({ [txt]: num });
+ },
//-- 点击选中赠品 --
- show_sele_gift:function (e) {
- var index=e.currentTarget.dataset.index;
- var pk=e.currentTarget.dataset.pk;
- var giftsinfo=this.data.send_gf[pk][index].giftsinfo;
-
- for(let i in giftsinfo){
- let item=giftsinfo[i];
- if(!item.goods_num) giftsinfo[i].goods_num=1;
+ show_sele_gift: function (e) {
+ var index = e.currentTarget.dataset.index;
+ var pk = e.currentTarget.dataset.pk;
+ var giftsinfo = this.data.send_gf[pk][index].giftsinfo;
+
+ for (let i in giftsinfo) {
+ let item = giftsinfo[i];
+ if (!item.goods_num) giftsinfo[i].goods_num = 1;
}
this.setData({
- show_duo_gift:1,
- giftsinfo:giftsinfo,
- gf_pr_name:this.data.send_gf[pk][index].gf_pr_name,
- zp_num:this.data.send_gf[pk][index].zp_num,
- gift_pkid:pk,
- gf_prom_id:this.data.send_gf[pk][index].prom_id,
- send_gf_index:index
+ show_duo_gift: 1,
+ giftsinfo: giftsinfo,
+ gf_pr_name: this.data.send_gf[pk][index].gf_pr_name,
+ zp_num: this.data.send_gf[pk][index].zp_num,
+ gift_pkid: pk,
+ gf_prom_id: this.data.send_gf[pk][index].prom_id,
+ send_gf_index: index
})
},
- close_sele_gift:function () {
- this.setData({show_duo_gift:0})
+ close_sele_gift: function () {
+ this.setData({ show_duo_gift: 0 })
},
//购物车赠品有咩有超出库存。有灭有超出限购
- check_out_num_cart:function(discount,pick_id,num) {
- var prom_id= discount.prom_id;
- var alllist=this.data.cartlist;
- var all_num=num;
- var all_limit_num=num;
- var gift_id=discount.gift_id;
- for (var i in alllist) {
- var list_item = alllist[i];
- //-- 门店相同,活动相同的时候 --
- if(pick_id==list_item.pickup_id && prom_id==list_item.prom_id) continue;
- for (var j in list_item.goods) {
- //如果赠品的ID一样,要进行统计数量
- if (list_item.goods[j].is_gift == 1 &&
- list_item.goods[j].gift_id == gift_id) {
- all_num += list_item.goods[j].goods_num;
- }
- if (list_item.goods[j].is_gift == 1 && list_item.goods[j].gift_id ==gift_id && list_item.goods[j].prom_id == prom_id) {
- all_limit_num += list_item.goods[j].limit_num;
- }
- }
- }
- //-- 赠品的数量超出库存数量和会员的限制,
- // 这里是保证所有的赠品部会超出 --
- if (discount.gift_storecount < all_num ) {
- wx.showToast({
- title: "赠品库存不足",
- icon: 'none',
- duration: 2000
- });
- return false;
- }
- if (discount.limit_num < all_limit_num) {
- wx.showToast({
- title:"超出赠品限购",
- icon: 'none',
- duration: 2000
- });
- return false;
- }
- return true;
- },
-
- //-- 确定赠品 --
- sure_this_gift:async function () {
- var th = this;
- var gf_pickup_id = this.data.gift_pkid;
-
- var zp_num = this.data.zp_num;
- var giftsinfo = this.data.giftsinfo;
- var all_num = 0;
- for (let i in giftsinfo) {
- let item = giftsinfo[i];
- if (!item.selected) continue;
- all_num += item.goods_num;
- }
- if (all_num > zp_num) {
- wx.showToast({
- title: "超出活动赠品赠送的数量" + zp_num + "件",
- icon: 'none',
- duration: 2000
- });
- return false;
- }
- if (all_num < zp_num) {
- wx.showToast({
- title: "您还可以加" + (zp_num - all_num) + "件",
- icon: 'none',
- duration: 2000
- });
- return false;
- }
-
- //-- 当是购物车购买的时候 --
- if(this.data.cartlist && this.data.cartlist.length>0){
- var alllist = this.data.cartlist;
- var index = alllist.findIndex(function (e) {
- return e.pickup_id == gf_pickup_id
- });
- var pk_list_goods = alllist[index].goods;
-
- var url = "/api/weshop/cart/delGift?store_id=" + os.stoid + "&user_id="
- + getApp().globalData.user_id + "&is_gift=1&pick_id=" + this.data.gift_pkid + "&prom_id=" + this.data.prom_id;
- await getApp().request.promiseDelete(url, {});
-
- var new_pk_list_goods = [];
- for (let i in pk_list_goods) {
- let item = pk_list_goods[i];
- if (item.is_gift && item.prom_id == this.data.gf_prom_id) {
- continue;
- }
- new_pk_list_goods.push(item)
- }
-
- //-- 循环把赠品添加进去 --
- for (var i = 0; i < giftsinfo.length; i++) {
- var gf_item = giftsinfo[i];
- if (!gf_item.selected) continue;
- var add_data = null;
- var newd = {
- goods_id: gf_item.goodsinfo.goods_id,
- goods_num: gf_item.goods_num,
- pick_id: gf_pickup_id,
- user_id: app.globalData.user_id,
- store_id: os.stoid,
- goods_price: 0,
- member_goods_price: 0,
- goods_name: gf_item.goodsinfo.goods_name,
- goods_sn: gf_item.goodsinfo.goods_sn,
- sku: gf_item.goodsinfo.sku,
- is_gift: 1,
- prom_id: th.data.gf_prom_id,
- prom_type: 3,
- selected: 1,
- gift_id: gf_item.gift_id,
- original_img: th.data.imgUrl + gf_item.goodsinfo.original_img,
- exp_sum_type: gf_item.goodsinfo.exp_sum_type,
- is_free_shipping: gf_item.goodsinfo.is_free_shipping,
- weight: gf_item.goodsinfo.weight,
- uniform_exp_sum: gf_item.goodsinfo.uniform_exp_sum,
- goods_spec: gf_item.goodsinfo.goods_spec,
- goods_color: gf_item.goodsinfo.goods_color,
- };
-
- await getApp().request.promisePost("/api/weshop/cart/save", {
- data: newd
- }).then(res => {
- if (res.data.code == 0) {
- add_data = res.data.data;
- }
- })
- if (add_data) {
- newd.id = add_data.id;
- new_pk_list_goods.push(newd);
- }
- }
-
- var set_data = this.data.send_gf[gf_pickup_id][this.data.send_gf_index];
- set_data.selected = 1;
- var txt9 = "cartlist[" + index + "].goods";
-
- th.setData({[txt9]: new_pk_list_goods, send_gf: this.data.send_gf});
- this.data.old_cartlist[index].goods = new_pk_list_goods;
-
-
- console.log(this.data.send_gf,"----");
-
- th.calculatePrice();
- }else{
- var new_pk_list_goods=[];
- //-- 当是立即购买的时候 --
- for (var i = 0; i < giftsinfo.length; i++) {
- var gf_item = giftsinfo[i];
- if (!gf_item.selected) continue;
- var newd = {
- goods_id: gf_item.goodsinfo.goods_id,
- buynum: gf_item.goods_num,
- pick_id: gf_pickup_id,
- user_id: app.globalData.user_id,
- store_id: os.stoid,
- goods_price: 0,
- member_goods_price: 0,
- goods_name: gf_item.goodsinfo.goods_name,
- goods_sn: gf_item.goodsinfo.goods_sn,
- sku: gf_item.goodsinfo.sku,
- is_gift: 1,
- prom_id: th.data.gf_prom_id,
- prom_type: 3,
- selected: 1,
- gift_id: gf_item.gift_id,
- original_img: th.data.imgUrl + gf_item.goodsinfo.original_img,
- exp_sum_type: gf_item.goodsinfo.exp_sum_type,
- is_free_shipping: gf_item.goodsinfo.is_free_shipping,
- weight: gf_item.goodsinfo.weight,
- uniform_exp_sum: gf_item.goodsinfo.uniform_exp_sum,
- uniform_exp_sum: gf_item.goodsinfo.uniform_exp_sum,
- goods_spec: gf_item.goodsinfo.goods_spec,
- goods_color: gf_item.goodsinfo.goods_color,
- };
- new_pk_list_goods.push(newd);
- }
- var set_data = this.data.send_gf[th.data.bn_pick][this.data.send_gf_index];
- set_data.selected = 1;
- var txt1 = "send_gf[" + gf_pickup_id + "][" + this.data.send_gf_index + "]";
-
- th.setData({buy_now_gift_goods:new_pk_list_goods,[txt1]:set_data});
- th.calculatePrice2();
-
- }
- th.close_sele_gift();
- },
-
- //获取输入
- getInput:function (e) {
- this.data.gift_sear=e.detail.value;
- },
- //-- 搜索赠品 --
- submitSearch:function () {
- var giftsinfo=this.data.giftsinfo;
- if(!this.data.gift_sear){
- for(let i in giftsinfo){
- let item=giftsinfo[i];
- item.hide_div=0;
- }
- }else{
- for(let i in giftsinfo){
- let item=giftsinfo[i];
- item.hide_div=0;
- if(item.goods_name.indexOf(this.data.gift_sear)==-1){
- item.hide_div=1;
- }
- }
- }
- this.setData({giftsinfo:giftsinfo})
-
- },
-
- //-- 赠品的验证 --
- sub_check_gift(func){
- var th=this;
- if(th.data.send_gf){
- var error_arr=[];
- for(let io in th.data.send_gf){
- let item_arr=th.data.send_gf[io];
- for(let ip in item_arr){
- var gf_pr_name=item_arr[ip].gf_pr_name;
- var zp_num=item_arr[ip].zp_num;
- var giftsinfo=item_arr[ip].giftsinfo;
- var limit_all=0;
- var stock_all=0;
- for(let iu in giftsinfo){
- let gf_item=giftsinfo[iu];
- limit_all+=gf_item.limit_num;
- stock_all+=gf_item.gift_storecount;
- }
- if(limit_all zp_num) {
+ wx.showToast({
+ title: "超出活动赠品赠送的数量" + zp_num + "件",
+ icon: 'none',
+ duration: 2000
+ });
+ return false;
+ }
+ if (all_num < zp_num) {
+ wx.showToast({
+ title: "您还可以加" + (zp_num - all_num) + "件",
+ icon: 'none',
+ duration: 2000
+ });
+ return false;
+ }
+
+ //-- 当是购物车购买的时候 --
+ if (this.data.cartlist && this.data.cartlist.length > 0) {
+ var alllist = this.data.cartlist;
+ var index = alllist.findIndex(function (e) {
+ return e.pickup_id == gf_pickup_id
+ });
+ var pk_list_goods = alllist[index].goods;
+
+ var url = "/api/weshop/cart/delGift?store_id=" + os.stoid + "&user_id="
+ + getApp().globalData.user_id + "&is_gift=1&pick_id=" + this.data.gift_pkid + "&prom_id=" + this.data.prom_id;
+ await getApp().request.promiseDelete(url, {});
+
+ var new_pk_list_goods = [];
+ for (let i in pk_list_goods) {
+ let item = pk_list_goods[i];
+ if (item.is_gift && item.prom_id == this.data.gf_prom_id) {
+ continue;
+ }
+ new_pk_list_goods.push(item)
+ }
+
+ //-- 循环把赠品添加进去 --
+ for (var i = 0; i < giftsinfo.length; i++) {
+ var gf_item = giftsinfo[i];
+ if (!gf_item.selected) continue;
+ var add_data = null;
+ var newd = {
+ goods_id: gf_item.goodsinfo.goods_id,
+ goods_num: gf_item.goods_num,
+ pick_id: gf_pickup_id,
+ user_id: app.globalData.user_id,
+ store_id: os.stoid,
+ goods_price: 0,
+ member_goods_price: 0,
+ goods_name: gf_item.goodsinfo.goods_name,
+ goods_sn: gf_item.goodsinfo.goods_sn,
+ sku: gf_item.goodsinfo.sku,
+ is_gift: 1,
+ prom_id: th.data.gf_prom_id,
+ prom_type: 3,
+ selected: 1,
+ gift_id: gf_item.gift_id,
+ original_img: th.data.imgUrl + gf_item.goodsinfo.original_img,
+ exp_sum_type: gf_item.goodsinfo.exp_sum_type,
+ is_free_shipping: gf_item.goodsinfo.is_free_shipping,
+ weight: gf_item.goodsinfo.weight,
+ uniform_exp_sum: gf_item.goodsinfo.uniform_exp_sum,
+ goods_spec: gf_item.goodsinfo.goods_spec,
+ goods_color: gf_item.goodsinfo.goods_color,
+ };
+
+ await getApp().request.promisePost("/api/weshop/cart/save", {
+ data: newd
+ }).then(res => {
+ if (res.data.code == 0) {
+ add_data = res.data.data;
+ }
+ })
+ if (add_data) {
+ newd.id = add_data.id;
+ new_pk_list_goods.push(newd);
+ }
+ }
+
+ var set_data = this.data.send_gf[gf_pickup_id][this.data.send_gf_index];
+ set_data.selected = 1;
+ var txt9 = "cartlist[" + index + "].goods";
+
+ th.setData({ [txt9]: new_pk_list_goods, send_gf: this.data.send_gf });
+ this.data.old_cartlist[index].goods = new_pk_list_goods;
+
+
+ console.log(this.data.send_gf, "----");
+
+ th.calculatePrice();
+ } else {
+ var new_pk_list_goods = [];
+ //-- 当是立即购买的时候 --
+ for (var i = 0; i < giftsinfo.length; i++) {
+ var gf_item = giftsinfo[i];
+ if (!gf_item.selected) continue;
+ var newd = {
+ goods_id: gf_item.goodsinfo.goods_id,
+ buynum: gf_item.goods_num,
+ pick_id: gf_pickup_id,
+ user_id: app.globalData.user_id,
+ store_id: os.stoid,
+ goods_price: 0,
+ member_goods_price: 0,
+ goods_name: gf_item.goodsinfo.goods_name,
+ goods_sn: gf_item.goodsinfo.goods_sn,
+ sku: gf_item.goodsinfo.sku,
+ is_gift: 1,
+ prom_id: th.data.gf_prom_id,
+ prom_type: 3,
+ selected: 1,
+ gift_id: gf_item.gift_id,
+ original_img: th.data.imgUrl + gf_item.goodsinfo.original_img,
+ exp_sum_type: gf_item.goodsinfo.exp_sum_type,
+ is_free_shipping: gf_item.goodsinfo.is_free_shipping,
+ weight: gf_item.goodsinfo.weight,
+ uniform_exp_sum: gf_item.goodsinfo.uniform_exp_sum,
+ uniform_exp_sum: gf_item.goodsinfo.uniform_exp_sum,
+ goods_spec: gf_item.goodsinfo.goods_spec,
+ goods_color: gf_item.goodsinfo.goods_color,
+ };
+ new_pk_list_goods.push(newd);
+ }
+ var set_data = this.data.send_gf[th.data.bn_pick][this.data.send_gf_index];
+ set_data.selected = 1;
+ var txt1 = "send_gf[" + gf_pickup_id + "][" + this.data.send_gf_index + "]";
+
+ th.setData({ buy_now_gift_goods: new_pk_list_goods, [txt1]: set_data });
+ th.calculatePrice2();
+
+ }
+ th.close_sele_gift();
+ },
+
+ //获取输入
+ getInput: function (e) {
+ this.data.gift_sear = e.detail.value;
+ },
+ //-- 搜索赠品 --
+ submitSearch: function () {
+ var giftsinfo = this.data.giftsinfo;
+ if (!this.data.gift_sear) {
+ for (let i in giftsinfo) {
+ let item = giftsinfo[i];
+ item.hide_div = 0;
+ }
+ } else {
+ for (let i in giftsinfo) {
+ let item = giftsinfo[i];
+ item.hide_div = 0;
+ if (item.goods_name.indexOf(this.data.gift_sear) == -1) {
+ item.hide_div = 1;
+ }
+ }
+ }
+ this.setData({ giftsinfo: giftsinfo })
+
+ },
+
+ //-- 赠品的验证 --
+ sub_check_gift(func) {
+ var th = this;
+ if (th.data.send_gf) {
+ var error_arr = [];
+ for (let io in th.data.send_gf) {
+ let item_arr = th.data.send_gf[io];
+ for (let ip in item_arr) {
+ var gf_pr_name = item_arr[ip].gf_pr_name;
+ var zp_num = item_arr[ip].zp_num;
+ var giftsinfo = item_arr[ip].giftsinfo;
+ var limit_all = 0;
+ var stock_all = 0;
+ for (let iu in giftsinfo) {
+ let gf_item = giftsinfo[iu];
+ limit_all += gf_item.limit_num;
+ stock_all += gf_item.gift_storecount;
+ }
+ if (limit_all < zp_num) {
+ error_arr.push(gf_pr_name + "限购不足");
+ }
+ if (stock_all < zp_num) {
+ error_arr.push(gf_pr_name + "赠品库存不足");
+ }
+ }
+ }
+
+ //-- 有赠品错误的时候,是不是继续下单 --
+ if (error_arr.length) {
+ var err = error_arr.join(",");
+ wx.showModal({
+ title: '提示',
+ content: err + ',无法赠送赠品,是否继续下单',
+ success(res) {
+ if (res.confirm) {
+ func();
+ } else if (res.cancel) {
+ console.log('用户点击取消');
+ th.setData({
+ submit: 0,
+ })
+ }
+ }
+ })
+ } else {
+
+ var is_ok = 1;
+ var error_arr = [];
+ for (let io in th.data.send_gf) {
+ let item_arr1 = th.data.send_gf[io];
+ for (let ip1 in item_arr1) {
+ var item_b = item_arr1[ip1];
+ if (!item_b.selected) {
+ is_ok = 0;
+ break;
+ }
+ }
+ if (!is_ok) break;
+ }
+
+ if (!is_ok) {
+ getApp().confirmBox("请选择赠品");
+ th.setData({
+ submit: 0,
+ })
+ return false;
+ }
+ func();
+ }
+
+
+ } else {
+ func();
+ }
+ }
diff --git a/pages/cart/cart2/cart2.wxml b/pages/cart/cart2/cart2.wxml
index 6588255..9526ed4 100644
--- a/pages/cart/cart2/cart2.wxml
+++ b/pages/cart/cart2/cart2.wxml
@@ -8,24 +8,20 @@
- 门店自提
+ 门店自提
- 快递邮寄
+ 快递邮寄
-
+
- 门店自提
+ 门店自提
- 快递邮寄
+ 快递邮寄
@@ -82,7 +78,7 @@
-
+
{{items.goods_name}}
@@ -104,8 +100,9 @@
- image>
- {{show_card.CardName}}
+
+ image>
+ {{show_card.CardName}}
立减 {{filters.toFix(item.card_cut_price,2) }} 元
@@ -119,19 +116,7 @@
-
-
-
- 优惠券{{item.can_num}}张可用
-
- 不使用
- ¥{{using_quan[item.pickup_id].money}}元优惠券
- 包邮券
-
-
-
-
+
@@ -142,9 +127,8 @@
-
-
+
+
@@ -166,14 +150,13 @@
- 快递邮寄
+ 快递邮寄
-
+
{{wu_arr[item.wind].name}}
@@ -181,69 +164,92 @@
-
-
-
- 选择物流
-
- {{wu_arr[item.wind].name}}
-
+
+
+
+ 选择物流
+
+ {{wu_arr[item.wind].name}}
+
+
-
+
+
+
+
+
+ 赠{{send.title}}
+
+
+
+ x{{send.num}}
+
+
+
+
-
-
- 赠{{iter.name}} 可选赠品{{iter.zp_num}}个
-
+
+
+ 赠{{iter.name}} 可选赠品{{iter.zp_num}}个
+
-
- 已选择
-
+
+ 已选择
+
-
+
未选择
-
+
-
+
+
+
+
+ 优惠券{{item.can_num}}张可用
+
+ 不使用
+ ¥{{using_quan[item.pickup_id].money}}元优惠券
+ 包邮券
+
+
+
+
+
留言
-
+
-
-
- 店铺优惠
-
- 省{{filters.toFix(item.offline_price,2)}}元
-
-
- -¥{{filters.toFix(item.offline_price,2)}}
-
-
- 不使用优惠
-
-
-
-
+
+
+ 店铺优惠
+
+ 省{{filters.toFix(item.offline_price,2)}}元
+
+
+ -¥{{filters.toFix(item.offline_price,2)}}
+
+
+ 不使用优惠
+
+
+
+
@@ -286,27 +292,27 @@
-
-
-
+
+
+
-
-
-
- {{item.goods_name}}
-
-
-
- {{filters.show_gui_ge(item.goods_spec,item.goods_color)}}
-
-
-
-
- ¥0
- x{{item.buynum}}
+
-
-
+
+ {{item.goods_name}}
+
+
+
+ {{filters.show_gui_ge(item.goods_spec,item.goods_color)}}
+
+
+
+
+ ¥0
+ x{{item.buynum}}
+
+
+
@@ -333,12 +339,13 @@
-
+
- image>
- {{show_card.CardName}}
+
+ image>
+ {{show_card.CardName}}
立减 {{filters.toFix(card_cut_price,2) }} 元
@@ -351,6 +358,45 @@
立即开通
+
+
+
+
+
+ 赠{{send.title}}
+
+
+
+ x{{send.num}}
+
+
+
+
+
+
+
+
+
+
+
+ 赠{{iter.name}} 可选赠品{{iter.zp_num}}个
+
+
+
+ 已选择
+
+
+
+ 未选择
+
+
+
+
+
+
+
+
+
@@ -377,41 +423,20 @@
选择物流
- {{wu_arr[index].name}}
-
+ {{wu_arr[index].name}}
+
-
-
-
-
-
- 赠{{iter.name}} 可选赠品{{iter.zp_num}}个
-
-
-
- 已选择
-
-
-
- 未选择
-
-
-
-
留言
-
+
@@ -422,10 +447,10 @@
省{{filters.toFix(bn_goods.shop_price-bn_goods.offline_price,2)}}元
- -¥{{filters.toFix(bn_goods.shop_price-bn_goods.offline_price,2)}}
+ -¥{{filters.toFix(bn_goods.shop_price-bn_goods.offline_price,2)}}
- 不使用优惠
+ 不使用优惠
@@ -487,7 +512,7 @@
应付金额:¥{{formData.order_amount}}
-
+
@@ -519,8 +544,7 @@
-
+
@@ -561,8 +585,7 @@
-
+
@@ -605,8 +628,7 @@
-
+
@@ -672,8 +694,7 @@
-
+
Γ
@@ -703,77 +724,77 @@
店铺优惠
- 优惠¥{{show_off_price}}
-
- 不用优惠
-
+ 优惠¥{{show_off_price}}
+
+
+ 不用优惠
+
+
-
+
-
+
-
+
-
+
{{gf_pr_name}},可任选{{zp_num}}件商品为赠品
-
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+ {{items.goods_name}}
-
-
-
-
-
- {{items.goods_name}}
-
-
-
- {{items.goodsinfo.goods_color}}{{items.goodsinfo.goods_color?"/":''}}{{items.goodsinfo.goods_spec}}
- 规格1
+
+
+ {{items.goodsinfo.goods_color}}{{items.goodsinfo.goods_color?"/":''}}{{items.goodsinfo.goods_spec}}
+ 规格1
+
-
-
+
¥
{{items.goodsinfo.shop_price}}
一
-
- +
+
+ +
+
-
-
+
-
+
-
-
+
\ No newline at end of file
diff --git a/pages/giftpack/buygiftpack/giftpackbuy.js b/pages/giftpack/buygiftpack/giftpackbuy.js
index 11fd6c8..cd914f8 100644
--- a/pages/giftpack/buygiftpack/giftpackbuy.js
+++ b/pages/giftpack/buygiftpack/giftpackbuy.js
@@ -70,6 +70,7 @@ Page({
onLoad: function (options) {
this.setData({
params: options,
+ now:Date.parse(new Date()) / 1000,
})
},
diff --git a/pages/giftpack/buygiftpack/giftpackbuy.wxml b/pages/giftpack/buygiftpack/giftpackbuy.wxml
index 338b8a4..6c467ff 100644
--- a/pages/giftpack/buygiftpack/giftpackbuy.wxml
+++ b/pages/giftpack/buygiftpack/giftpackbuy.wxml
@@ -1,118 +1,122 @@
-
+
-
+
-
-
-
-
-
-
-
-
- 礼包列表
-
-
-
- 我的礼包
-
-
-
-
-
-
-
-
-
-
-
- {{items.giftTitle}}
-
-
-
- {{"¥"+items.payMoney}}
-
-
- /
-
-
-
- {{items.payIntegral}}
- 积分
-
-
-
-
- {{"零售价:¥"+items.giftPosPrice}}
-
-
- {{"活动结束时间:"+items.endTime}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
- 到底了
-
-
+
+
+
+ 礼包列表
+
+
+
+ 我的礼包
+
+
+
+
+
+
+
+
+
+
+
+ {{items.giftTitle}}
+
+
+
+ {{"¥"+items.payMoney}}
+
+
+ /
+
+
+
+ {{items.payIntegral}}
+ 积分
+
+
+
+
+ {{"零售价:¥"+items.giftPosPrice}}
+
+
+ {{"活动结束时间:"+items.endTime}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 活动还未开始
+
+
+
+
+
+
+
+
+
+
+
+ 到底了
+
+
diff --git a/pages/goods/search/search.js b/pages/goods/search/search.js
index 419fab8..bbf575e 100644
--- a/pages/goods/search/search.js
+++ b/pages/goods/search/search.js
@@ -1,9 +1,9 @@
-var t = function(t) {
+var t = function (t) {
return t && t.__esModule ? t : {
default: t
};
}(require("../../../utils/LoadMore.js")), ut = require("../../../utils/util.js"),
- a = getApp(), e = new t.default(), rq = a.request, oo = a.globalData.setting;
+ a = getApp(), e = new t.default(), rq = a.request, oo = a.globalData.setting;
Page({
data: {
@@ -18,31 +18,32 @@ Page({
requestUrl: "",
//hotWords: [ [ "手机", "小米", "iphone" ], [ "三星", "华为", "冰箱" ] ]
hotWords: null,
- is_no_plus:1,
+ is_no_plus: 1,
tabname: "sort", //排序的字段
adname: "asc", //升降的字段
- rq_data:null,
- searchRecord: [],
- keyword: '',
- is_his:0,
- hiddenClear: true,
+ rq_data: null,
+ searchRecord: [],
+ keyword: '',
+ is_his: 0,
+ hiddenClear: true,
+ fliter_flag: false,
},
-
- onLoad: function(t) {
- this.data.rq_data=t;
- if(t.o) {
- this.data.rq_data.o = JSON.parse(t.o);
- };
-
-
+
+ onLoad: function (t) {
+ this.data.rq_data = t;
+ if (t.o) {
+ this.data.rq_data.o = JSON.parse(t.o);
+ };
+
+
//接受有没有导购的参数
- var first_leader=t.first_leader;
- if(first_leader){
- getApp().globalData.first_leader=first_leader;
+ var first_leader = t.first_leader;
+ if (first_leader) {
+ getApp().globalData.first_leader = first_leader;
//调用接口判断是不是会员
- getApp().request.promiseGet("/api/weshop/shoppingGuide/get/"+oo.stoid+"/"+first_leader,{}).then(res=>{
- if(res.data.code==0){
- getApp().globalData.guide_id=res.data.data.id;
+ getApp().request.promiseGet("/api/weshop/shoppingGuide/get/" + oo.stoid + "/" + first_leader, {}).then(res => {
+ if (res.data.code == 0) {
+ getApp().globalData.guide_id = res.data.data.id;
}
})
}
@@ -63,145 +64,145 @@ Page({
}
})
- var th=this;
- a.getConfig2(function(rs) {
- var arr=new Array(),arr2=new Array();
- if (rs.hot_keywords != null && ut.trim(rs.hot_keywords)!="" ){
- var arr1 = rs.hot_keywords.split('|');
- for (var i = 0; i < arr1.length;i++){
- if(i%5==0 && i!=0){
- arr.push(arr2);
- arr2=[];
- }else{
- arr2.push(arr1[i]);
+ var th = this;
+ a.getConfig2(function (rs) {
+ var arr = new Array(), arr2 = new Array();
+ if (rs.hot_keywords != null && ut.trim(rs.hot_keywords) != "") {
+ var arr1 = rs.hot_keywords.split('|');
+ for (var i = 0; i < arr1.length; i++) {
+ if (i % 5 == 0 && i != 0) {
+ arr.push(arr2);
+ arr2 = [];
+ } else {
+ arr2.push(arr1[i]);
+ }
}
+ if (arr2.length > 0) arr.push(arr2);
+ th.setData({ hotWords: arr });
}
- if (arr2.length > 0) arr.push(arr2);
- th.setData({ hotWords: arr});
- }
-
-
- //计算等级价相关
- var swithc_list=rs.switch_list;
- var sw_arr=JSON.parse(swithc_list);
- //---如果后台又开等级卡的开关---
- if(sw_arr.rank_switch && sw_arr.rank_switch=="2"){
- th.setData({rank_switch:true});
- var user=getApp().globalData.userInfo;
- var ti=setInterval(function(){
- if(!user) return false;
- clearInterval(ti);
- //---回调卡的列表---
- th.getPlusCardType(function(ob){
- th.setData({card_list:ob.card_list});
- if(user.card_field ){
- var str = user['card_expiredate'].replace(/-/g, '/');
- var end = new Date(str);
- end = Date.parse(end) / 1000;
- var now = ut.gettimestamp();
-
- //--- 判断是等级会员,且在有效期范围内 ---
- if(user.card_field && now7) card_name=card_name.substring(0,8);
- th.setData({card_field:user.card_field,card_name:card_name,card_list:ob.card_list});
- }
- }
- })
- },500)
- }
-
-
-
- })
- //e.init(this, "", "requestData");
- var url = this.data.baseUrl;
-
- //扫一扫过来,显示搜索的内容
- var s_key = t.s_key;
- if (s_key){
- s_key=s_key.trim();
- this.search(s_key); this.openSearchModal();
- return;
- }
-
- if (0 != t.brand_id && t.brand_id!=undefined){ url += "&brand_id=" + t.brand_id;}
- if (0 != t.nation_id && t.nation_id!=undefined) { url += "&nation_id=" + t.nation_id;}
- if (0 != t.max_price && t.max_price!=undefined) { url += "&min_pirce=" + t.min_pirce + "&max_price=" + t.max_price;}
- if (0 != t.ladder_id && t.ladder_id != undefined) {
- url += "&ladder_id=" + t.ladder_id;
- this.setData({
- baseUrl:url,
+
+
+ //计算等级价相关
+ var swithc_list = rs.switch_list;
+ var sw_arr = JSON.parse(swithc_list);
+ //---如果后台又开等级卡的开关---
+ if (sw_arr.rank_switch && sw_arr.rank_switch == "2") {
+ th.setData({ rank_switch: true });
+ var user = getApp().globalData.userInfo;
+ var ti = setInterval(function () {
+ if (!user) return false;
+ clearInterval(ti);
+ //---回调卡的列表---
+ th.getPlusCardType(function (ob) {
+ th.setData({ card_list: ob.card_list });
+ if (user.card_field) {
+ var str = user['card_expiredate'].replace(/-/g, '/');
+ var end = new Date(str);
+ end = Date.parse(end) / 1000;
+ var now = ut.gettimestamp();
+
+ //--- 判断是等级会员,且在有效期范围内 ---
+ if (user.card_field && now < end) {
+ var card_name = ob.name_map.get(user.card_field);
+ if (card_name && card_name.length > 7) card_name = card_name.substring(0, 8);
+ th.setData({ card_field: user.card_field, card_name: card_name, card_list: ob.card_list });
+ }
+ }
+ })
+ }, 500)
+ }
+
+
+
})
- }
- if (url != this.data.baseUrl) return this.requestSearch(url);
- this.openSearchModal();
+ //e.init(this, "", "requestData");
+ var url = this.data.baseUrl;
+
+ //扫一扫过来,显示搜索的内容
+ var s_key = t.s_key;
+ if (s_key) {
+ s_key = s_key.trim();
+ this.search(s_key); this.openSearchModal();
+ return;
+ }
+
+ if (0 != t.brand_id && t.brand_id != undefined) { url += "&brand_id=" + t.brand_id; }
+ if (0 != t.nation_id && t.nation_id != undefined) { url += "&nation_id=" + t.nation_id; }
+ if (0 != t.max_price && t.max_price != undefined) { url += "&min_pirce=" + t.min_pirce + "&max_price=" + t.max_price; }
+ if (0 != t.ladder_id && t.ladder_id != undefined) {
+ url += "&ladder_id=" + t.ladder_id;
+ this.setData({
+ baseUrl: url,
+ })
+ }
+ if (url != this.data.baseUrl) return this.requestSearch(url);
+ this.openSearchModal();
// 获取历史搜索记录
- this.getHistorySearch();
+ this.getHistorySearch();
},
- onShow:function () {
+ onShow: function () {
getApp().check_can_share();
},
- changeTab: function(t) {
- var ord = t.currentTarget.dataset.href;
- var ad = t.currentTarget.dataset.ad;
+ changeTab: function (t) {
+ var ord = t.currentTarget.dataset.href;
+ var ad = t.currentTarget.dataset.ad;
- var url = this.data.requestUrl;
+ var url = this.data.requestUrl;
- if (this.data.tabname != ord) {
- this.setData({ tabname: ord, adname: "desc" });
- } else {
- ad = ad == "desc" ? "asc" : "desc";
- this.setData({ adname: ad });
- }
- this.resetData(), this.requestSearch(url);
+ if (this.data.tabname != ord) {
+ this.setData({ tabname: ord, adname: "desc" });
+ } else {
+ ad = ad == "desc" ? "asc" : "desc";
+ this.setData({ adname: ad });
+ }
+ this.resetData(), this.requestSearch(url);
},
//-----------真的调用地址进行搜索------------
- requestSearch: function(t) {
- // console.log('t===>', t);
- if(this.data.loading) return false;
- this.data.loading=1;
- var e = this,th=e;
- if(getApp().globalData.userInfo) {
- t += "&user_id=" + getApp().globalData.userInfo.user_id;
- }
+ requestSearch: function (t) {
+ // console.log('t===>', t);
+ if (this.data.loading) return false;
+ this.data.loading = 1;
+ var e = this, th = e;
+ if (getApp().globalData.userInfo) {
+ t += "&user_id=" + getApp().globalData.userInfo.user_id;
+ }
this.data.requestUrl = t;
- var user_id=getApp().globalData.user_id;
- if(!user_id) user_id=0;
- let data = {
- is_mainshow: 1,
- isonsale: 1,
- store_id: oo.stoid,
- orderField: e.data.tabname,
- orderType: e.data.adname,
- page: e.data.currentPage,
- };
-
- let o = this.data.rq_data.o;
- if(o) {
- if(o.cat_id) data.cat_id = o.cat_id;
- if(o.pid && o.pid != 'three') data.parent_id = o.pid;
- if(o.nation_id) data.nation_id = o.nation_id;
- if(o.brand_id) data.brand_id = o.brand_id;
- };
-
-
- getApp().request.promiseGet(t, {data:data}).then(async res=>{
- th.data.loading=0;
- if(ut.ajax_ok(res)){
- if(!e.data.requestData) {
- // e.data.requestData=[];
- e.setData({
- requestData: [],
- });
- };
- for(let i in res.data.data.pageData){
- let item=res.data.data.pageData[i];
+ var user_id = getApp().globalData.user_id;
+ if (!user_id) user_id = 0;
+ let data = {
+ is_mainshow: 1,
+ isonsale: 1,
+ store_id: oo.stoid,
+ orderField: e.data.tabname,
+ orderType: e.data.adname,
+ page: e.data.currentPage,
+ };
+
+ let o = this.data.rq_data.o;
+ if (o) {
+ if (o.cat_id) data.cat_id = o.cat_id;
+ if (o.pid && o.pid != 'three') data.parent_id = o.pid;
+ if (o.nation_id) data.nation_id = o.nation_id;
+ if (o.brand_id) data.brand_id = o.brand_id;
+ };
+
+
+ getApp().request.promiseGet(t, { data: data }).then(async res => {
+ th.data.loading = 0;
+ if (ut.ajax_ok(res)) {
+ if (!e.data.requestData) {
+ // e.data.requestData=[];
+ e.setData({
+ requestData: [],
+ });
+ };
+ for (let i in res.data.data.pageData) {
+ let item = res.data.data.pageData[i];
item.original_img = th.data.url + item.original_img;
/*--
@@ -218,48 +219,48 @@ Page({
})--*/
var prom_type = item.prom_type; //0普通商品 1秒杀 6拼单 2团购 4积分购
- var prom_id=item.prom_id;
- var now=ut.gettimestamp();
+ var prom_id = item.prom_id;
+ var now = ut.gettimestamp();
var url = "";
- switch (prom_type){
+ switch (prom_type) {
case 1:
- url = "/api/ms/flash_sale/getNew/" +oo.stoid + "/" +user_id+"/"+ prom_id;
+ url = "/api/ms/flash_sale/getNew/" + oo.stoid + "/" + user_id + "/" + prom_id;
break;
case 2:
- url ="/api/weshop/goods/groupBuy/getActInfo/" +oo.stoid + "/" +item.goods_id+"/"+ prom_id
+ url = "/api/weshop/goods/groupBuy/getActInfo/" + oo.stoid + "/" + item.goods_id + "/" + prom_id
break;
case 4:
- url ="/api/weshop/integralbuy/get/"+oo.stoid +"/"+prom_id;
+ url = "/api/weshop/integralbuy/get/" + oo.stoid + "/" + prom_id;
break;
case 6:
url = "/api/weshop/teamlist/get/" + oo.stoid + "/" + prom_id;
- await getApp().request.promiseGet("/api/weshop/teamlist/pageteam/1",{
- data:{
- store_id: oo.stoid,
- is_end: 0,
- is_show: 1,
- user_id: getApp().globalData.user_id,
- pageSize:1000,
+ await getApp().request.promiseGet("/api/weshop/teamlist/pageteam/1", {
+ data: {
+ store_id: oo.stoid,
+ is_end: 0,
+ is_show: 1,
+ user_id: getApp().globalData.user_id,
+ pageSize: 1000,
}
- }).then(pd=>{
- let pd_list=pd.data.data.pageData;
- if(res.data.code==0 && pd_list.length>0){
- var flag = pd_list.some(pd=>{
- return pd.goods_id==item.goods_id
- })
-
- if(!flag){
- item.prom_type=0;
- item.prom_id=0;
- item.prom_price=null;
- }
+ }).then(pd => {
+ let pd_list = pd.data.data.pageData;
+ if (res.data.code == 0 && pd_list.length > 0) {
+ var flag = pd_list.some(pd => {
+ return pd.goods_id == item.goods_id
+ })
+
+ if (!flag) {
+ item.prom_type = 0;
+ item.prom_id = 0;
+ item.prom_price = null;
+ }
}
- })
+ })
break;
case 8:
var presell_id = prom_id;
var url1 = "/api/weshop/marketing/marketingPresellList/list";
- var rd= {
+ var rd = {
store_id: oo.stoid,
presell_id: presell_id,
goods_id: item.goods_id
@@ -271,287 +272,303 @@ Page({
if (res.data.code == 0 && res.data.data && res.data.data.length > 0) {
var arr = res.data.data[0];
item.prom_price = arr.luck_goods_price;
- item.sales_sum=arr.buy_goodnum+(arr.virtual_qty?arr.virtual_qty:0);
+ item.sales_sum = arr.buy_goodnum + (arr.virtual_qty ? arr.virtual_qty : 0);
}
})
break;
default:
break;
};
- if(url!=null && url!=''){
+ if (url != null && url != '') {
await getApp().request.promiseGet(url, {}).then(async res => {
- var prom =null;
- if(res.data.code==0 && res.data.data){
- prom=res.data.data;
+ var prom = null;
+ if (res.data.code == 0 && res.data.data) {
+ prom = res.data.data;
- if (prom != null && prom.is_end==0 && prom.end_time>now && (prom.start_time now && (prom.start_time < now || (prom.show_time && prom.show_time < now))) {
item.prom_price = res.data.data.price;
- if(res.data.data.user_price) item.prom_price=res.data.data.user_price;
- var vNum=prom.virtual_num?prom.virtual_num:0;
- var vNum1=prom.virtualNum?prom.virtualNum:0;
- var vNum2=prom.virtual?prom.virtual:0;
- item.sales_sum=prom.buy_num+(vNum+vNum1+vNum2);
- }else{
- item.prom_type=0;
- item.prom_id=0;
- item.prom_price=null;
+ if (res.data.data.user_price) item.prom_price = res.data.data.user_price;
+ var vNum = prom.virtual_num ? prom.virtual_num : 0;
+ var vNum1 = prom.virtualNum ? prom.virtualNum : 0;
+ var vNum2 = prom.virtual ? prom.virtual : 0;
+ item.sales_sum = prom.buy_num + (vNum + vNum1 + vNum2);
+ } else {
+ item.prom_type = 0;
+ item.prom_id = 0;
+ item.prom_price = null;
}
}
})
};
- if(!th.data.requestData) th.data.requestData=[];
+ if (!th.data.requestData) th.data.requestData = [];
th.data.requestData.push(item);
- e.setData({requestData: e.data.requestData});
+ e.setData({ requestData: e.data.requestData });
}
}
e.closeSearchModal();
})
},
- onReachBottom: function() {
- console.log('触发上滑加载事件');
+ onReachBottom: function () {
+ console.log('触发上滑加载事件');
this.data.currentPage++
- console.log('触发上滑加载事件currentPage',this.data.currentPage);
+ console.log('触发上滑加载事件currentPage', this.data.currentPage);
this.data.openSearchModal || e.canloadMore() && this.requestSearch(this.data.requestUrl);
},
-
-
- openFilterModal: function() {
+
+
+ openFilterModal: function () {
this.setData({
openFilterModal: !0
});
},
- closeFilterModal: function() {
+ closeFilterModal: function () {
this.setData({
openFilterModal: !1
});
},
- filterGoods: function(t) {
+ filterGoods: function (t) {
this.resetData(), this.requestSearch(t.currentTarget.dataset.href), this.closeFilterModal();
},
-
-
-
- resetData: function() {
- e.resetConfig(),
- // this.data.requestData = null,
- this.data.currentPage = 1;
- this.setData({
- requestData: null,
- });
+
+
+
+ resetData: function () {
+ e.resetConfig(),
+ // this.data.requestData = null,
+ this.data.currentPage = 1;
+ this.setData({
+ requestData: null,
+ });
},
//---回复最初的设置---显示全部分类--
- restoreData: function() {
+ restoreData: function () {
this.setData({
requestData: this.data.allData,
});
- this.data.currentPage=2;
+ this.data.currentPage = 2;
},
- openSearchModal: function() {
+ openSearchModal: function () {
this.setData({
openSearchModal: !0
});
},
- closeSearchModal: function() {
+ closeSearchModal: function () {
this.setData({
openSearchModal: !1
});
},
-
- submitSearch: function(t) {
- var val=t.detail.value.word;
- if(val==undefined) val=t.detail.value;
- val=val?val.trim():'';
- if(!val){
- a.showWarning("请输入关键词");
- }
- this.search(val);
+
+ submitSearch: function (t) {
+ var val = t.detail.value.word;
+ if (val == undefined) val = t.detail.value;
+ val = val ? val.trim() : '';
+ if (!val) {
+ a.showWarning("请输入关键词");
+ }
+ this.search(val);
},
//热搜关键字
- searchHotWord: function(t) {
- var word = t.currentTarget.dataset.word;
- if(word) {
- this.setData({
- keyword: word,
- hiddenClear: false,
- });
- };
- this.historyRecord(word);
- this.search(word);
+ searchHotWord: function (t) {
+ var word = t.currentTarget.dataset.word;
+ if (word) {
+ this.setData({
+ keyword: word,
+ hiddenClear: false,
+ });
+ };
+ this.historyRecord(word);
+ this.search(word);
},
//-----点击搜索按钮----
- search: function(t) {
+ search: function (t) {
if ("string" != typeof t || "" == t) return a.showWarning("请输入关键词");
- this.data.key_str=t;
+ this.data.key_str = t;
this.resetData();
- this.requestSearch(this.data.baseUrl + "&key_str=" + encodeURIComponent(t));
- this.historyRecord();
+ this.requestSearch(this.data.baseUrl + "&key_str=" + encodeURIComponent(t));
+ this.historyRecord();
},
//---------分享配置--------
onShareAppMessage: function (e) {
- getApp().globalData.no_clear=1;
- var curPage=this;
+ getApp().globalData.no_clear = 1;
+ var curPage = this;
var pagePath = curPage.route; //当前页面url
if (pagePath.indexOf('/') != 0) {
pagePath = '/' + pagePath;
}
- if(this.data.key_str) {
+ if (this.data.key_str) {
pagePath += "?s_key=" + this.data.key_str;
}
- if(getApp().globalData.user_id){
+ if (getApp().globalData.user_id) {
- if(pagePath.indexOf("?")>0){
- pagePath+="&first_leader="+getApp().globalData.user_id;
- }else{
- pagePath+="?first_leader="+getApp().globalData.user_id;
+ if (pagePath.indexOf("?") > 0) {
+ pagePath += "&first_leader=" + getApp().globalData.user_id;
+ } else {
+ pagePath += "?first_leader=" + getApp().globalData.user_id;
}
}
// console.log("11-11"+pagePath);
return {
title: "商品搜索",
- path:pagePath,
+ path: pagePath,
}
},
//---------图片失败,默认图片--------
bind_bnerr: function (e) {
- var _errImg = e.target.dataset.errorimg;
- var _errObj = {};
- _errObj[_errImg] = this.data.url+ "/miniapp/images/default_g_img.gif";
- this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
+ var _errImg = e.target.dataset.errorimg;
+ var _errObj = {};
+ _errObj[_errImg] = this.data.url + "/miniapp/images/default_g_img.gif";
+ this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
},
-
- //--- 获取卡类列表 ---
- getPlusCardType: function (func) {
- var storid = oo.stoid;
- var th = this;
- getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + storid, {}).then(res => {
- var plusCard = res.data.data;
- var arr = [1219, 2089, 3031];
- var new_arr = new Array();
- var card_name_map=new Map();
- var user = getApp().globalData.userInfo;
-
- for (var i = 0; i < plusCard.length; i++) {
- if ((!user || user.card_field==null || user.card_field=="") && (plusCard[i].IsStopBuy==true)) {
- continue;
- }
- var name="card"+plusCard[i].CorrPrice.toLowerCase();
- card_name_map.set(name,plusCard[i].CardName);
- new_arr.push(plusCard[i]);
-
- }
-
- var ob={"card_list":new_arr,"name_map":card_name_map};
- func(ob);
- })
- },
-
-
- getInput(e) {
- let val = e.detail.value;
- if(val) {
- this.setData({
- keyword: e.detail.value,
- hiddenClear: false,
- });
- } else {
- this.setData({
- hiddenClear: true,
- });
- }
-
- },
-
- historyRecord(w) {
- let keyword =w;
- let self = this;
- if(!keyword){
- keyword = this.data.key_str.trim();
- }
- let searchRecord = this.data.searchRecord;
- if(!searchRecord || searchRecord.length==0) searchRecord=wx.getStorageSync('searchRecord') || [];
-
- if(keyword) {
-
- var index=searchRecord.indexOf(keyword);
- if(index > -1) {
- // 已经存在该值
- searchRecord.splice(index,1);
- searchRecord.unshift(keyword);
-
- // 将历史记录添加到缓存中
- wx.setStorage({
- key: 'searchRecord',
- data: searchRecord,
- success: function(res) {
- self.setData({
- searchRecord,
- })
- }
- })
-
- return;
- } else {
- if(searchRecord.length >= 10) {
- searchRecord.pop(); // 删除最早的一条记录
- };
- searchRecord.unshift(keyword);
-
- // // 将历史记录添加到缓存中
- wx.setStorage({
- key: 'searchRecord',
- data: searchRecord,
- success: function(res) {
- self.setData({
- searchRecord,
- })
- }
- })
- };
- };
- },
-
-
-
- // 获取历史搜索记录
- getHistorySearch() {
- this.setData({
- searchRecord: wx.getStorageSync('searchRecord') || [] //若无存储则为空
- });
- },
-
- // 清除历史搜素记录
- clearSearchRecord() {
- wx.clearStorageSync('searchRecord');
- this.setData({
- searchRecord: []
- });
- },
-
- go_url:function (e) {
- var url=e.currentTarget.dataset.url;
+
+ //--- 获取卡类列表 ---
+ getPlusCardType: function (func) {
+ var storid = oo.stoid;
+ var th = this;
+ getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?" + "storeId=" + storid, {}).then(res => {
+ var plusCard = res.data.data;
+ var arr = [1219, 2089, 3031];
+ var new_arr = new Array();
+ var card_name_map = new Map();
+ var user = getApp().globalData.userInfo;
+
+ for (var i = 0; i < plusCard.length; i++) {
+ if ((!user || user.card_field == null || user.card_field == "") && (plusCard[i].IsStopBuy == true)) {
+ continue;
+ }
+ var name = "card" + plusCard[i].CorrPrice.toLowerCase();
+ card_name_map.set(name, plusCard[i].CardName);
+ new_arr.push(plusCard[i]);
+
+ }
+
+ var ob = { "card_list": new_arr, "name_map": card_name_map };
+ func(ob);
+ })
+ },
+
+
+ getInput(e) {
+ let val = e.detail.value;
+ if (val) {
+ this.setData({
+ keyword: e.detail.value,
+ hiddenClear: false,
+ });
+ } else {
+ this.setData({
+ hiddenClear: true,
+ });
+ }
+
+ },
+
+ historyRecord(w) {
+ let keyword = w;
+ let self = this;
+ if (!keyword) {
+ keyword = this.data.key_str.trim();
+ }
+ let searchRecord = this.data.searchRecord;
+ if (!searchRecord || searchRecord.length == 0) searchRecord = wx.getStorageSync('searchRecord') || [];
+
+ if (keyword) {
+
+ var index = searchRecord.indexOf(keyword);
+ if (index > -1) {
+ // 已经存在该值
+ searchRecord.splice(index, 1);
+ searchRecord.unshift(keyword);
+
+ // 将历史记录添加到缓存中
+ wx.setStorage({
+ key: 'searchRecord',
+ data: searchRecord,
+ success: function (res) {
+ self.setData({
+ searchRecord,
+ })
+ }
+ })
+
+ return;
+ } else {
+ if (searchRecord.length >= 10) {
+ searchRecord.pop(); // 删除最早的一条记录
+ };
+ searchRecord.unshift(keyword);
+
+ // // 将历史记录添加到缓存中
+ wx.setStorage({
+ key: 'searchRecord',
+ data: searchRecord,
+ success: function (res) {
+ self.setData({
+ searchRecord,
+ })
+ }
+ })
+ };
+ };
+ },
+
+ closePoster() {
+ this.setData({
+ fliter_flag: false,
+ });
+ },
+
+ show_fliter() {
+ this.setData({
+ fliter_flag: true
+ })
+ },
+ fliter_close() {
+ this.setData({
+ fliter_flag: false,
+ })
+ },
+
+
+ // 获取历史搜索记录
+ getHistorySearch() {
+ this.setData({
+ searchRecord: wx.getStorageSync('searchRecord') || [] //若无存储则为空
+ });
+ },
+
+ // 清除历史搜素记录
+ clearSearchRecord() {
+ wx.clearStorageSync('searchRecord');
+ this.setData({
+ searchRecord: []
+ });
+ },
+
+ go_url: function (e) {
+ var url = e.currentTarget.dataset.url;
getApp().goto(url);
},
-
- clearInput() {
- this.setData({
- keyword: '',
- hiddenClear: true,
- openSearchModal: true,
- });
- },
-
- inputFocus() {
- this.setData({
- openSearchModal: true,
- });
- },
+
+ clearInput() {
+ this.setData({
+ keyword: '',
+ hiddenClear: true,
+ openSearchModal: true,
+ });
+ },
+
+ inputFocus(e) {
+ this.setData({
+ openSearchModal: true,
+ });
+ },
});
\ No newline at end of file
diff --git a/pages/goods/search/search.json b/pages/goods/search/search.json
index 0aa7add..d700074 100644
--- a/pages/goods/search/search.json
+++ b/pages/goods/search/search.json
@@ -2,6 +2,10 @@
"navigationBarTitleText": "商品搜索",
"enablePullDownRefresh": false,
"usingComponents": {
- "share_box": "/components/share_box/share_box"
- }
+ "share_box": "/components/share_box/share_box",
+ "van-popup":"/packageB/components/vant_ui/popup"
+ },
+ "componentPlaceholder": {
+ "van-popup": "view"
+ }
}
\ No newline at end of file
diff --git a/pages/goods/search/search.wxml b/pages/goods/search/search.wxml
index c645425..34b8305 100644
--- a/pages/goods/search/search.wxml
+++ b/pages/goods/search/search.wxml
@@ -6,7 +6,7 @@