diff --git a/components/diy_goodsGroup/diy_goodsGroup.js b/components/diy_goodsGroup/diy_goodsGroup.js
index eeaede0..94a3d36 100644
--- a/components/diy_goodsGroup/diy_goodsGroup.js
+++ b/components/diy_goodsGroup/diy_goodsGroup.js
@@ -41,34 +41,57 @@ Component({
goodscount: null,
firist_type_data: null,
firist_type_curr: 0,
+ is_nav:0,
+ nav_list:null,
+ title_index:0,
},
- ready: function () {
-
- },
-
-
+ ready: function () {},
+
lifetimes: {
- attached: function() {
+ attached: function() {
+
+ //要兼容性的写法,因为有些商家都还未更新商品分组的最新的效果~~3.0公众号的html页面所以不用兼容写法
+ var nav_item=this.data.object;
+ var nav_list= this.data.object.nav_list;
+ //最新的版本才有nav_list
+ if(nav_list){
+ nav_item=nav_list[0];
+ //要算一下商品goodsid
+ for(var ij in nav_list){
+ var item=nav_list[ij];
+ var idlist="";
+ //如果商品有手动选择的时候
+ if(item.data && item.data.length>0){
+ for(var im in item.data){
+ idlist+= item.data[im]+",";
+ }
+ }
+ if(idlist) idlist=ut.sub_last(idlist);
+ nav_list[ij].idlist=idlist;
+ }
+ this.setData({nav_list:nav_list,is_nav:this.data.object.is_nav});
+ }
+
+
// 在组件实例进入页面节点树时执行
- this.data.classstyle_id = this.data.object.classstyle;
+ this.data.classstyle_id = nav_item.classstyle;
this.data.goodscount = this.data.object.goodscount;
- this.data.wgroup = this.data.object.wgroup;
+ this.data.wgroup =nav_item.wgroup;
- this.setData({
- classstyle_id: this.data.object.classstyle
- })
- if (this.data.object.goodsclass == 1) {
+
+ if (nav_item.goodsclass == 1) {
this.data.is_recommend = 1
}
- if (this.data.object.goodsclass == 2) {
+ if (nav_item.goodsclass == 2) {
this.data.is_hot = 1
}
- if (this.data.object.goodsclass == 3) {
+ if (nav_item.goodsclass == 3) {
this.data.is_new = 1
}
+
this.data.requestData = new Array();
- this.data.g_id = this.data.object.data;
+ this.data.g_id = nav_item.data;
var arr = [];
for (var i = 0; i < this.data.g_id.length; i += this.data.goodscount) {
@@ -111,7 +134,6 @@ Component({
var os=getApp().globalData.setting;
classstyle_id = classstyle_id + "";
switch (classstyle_id) {
-
//---手动选择商品---
case "1":
var str="";
@@ -120,8 +142,9 @@ Component({
}
str=str.substring(0, str.length - 1);
app.request.get("/api/weshop/goods/getgoodslistOrdby?store_id=" + os.stoid + "&goodsidlist=" + str, {
+ isShowLoading:false,
success: function(res) {
- console.log("121212");
+
if(res.data.code==0 && res.data.data){
var rData = th.data.requestData;
if (rData == null) rData=[];
@@ -137,7 +160,18 @@ Component({
}
rData = rData.concat(new_arr);
th.data.requestData = rData;
- th.setData({ goods_array: rData });
+
+ if(th.data.object.column==5){
+ var arr = new Array();
+ //--三个三个一组---
+ for(var i=0;i< rData.length;i+=3){
+ arr.push(rData.slice(i,i+3));
+ }
+ th.setData({ goods_array: arr });
+ }else{
+ th.setData({ goods_array: rData });
+ }
+
//---控制有没有加载更多的按钮---
if (th.data.firist_type_curr == th.data.firist_type_data.length) {th.setData({ goods_btn: [] }); }
else th.setData({ goods_btn: res.data});
@@ -391,6 +425,47 @@ Component({
})
},
+ //--- 点击tab的事件 ---
+ gr_set_nav:function(e){
+
+ var title_idx=e.currentTarget.dataset.index;
+ if(title_idx==this.data.title_index) return false;
+ wx.showLoading();
+
+ var nav_item=this.data.object.nav_list[title_idx];
+
+ this.data.g_id = this.data.object.nav_list[0].data;
+ var arr = [];
+ for (var i = 0; i < this.data.g_id.length; i += this.data.goodscount) {
+ arr.push(this.data.g_id.slice(i, i + this.data.goodscount));
+ }
+ this.data.firist_type_data = arr;
+ this.data.firist_type_curr=0;
+ this.data.requestData=[];
+
+ // 在组件实例进入页面节点树时执行
+ this.data.classstyle_id = nav_item.classstyle;
+ this.data.wgroup =nav_item.wgroup;
+
+ this.data.is_recommend = this.data.is_hot=this.data.is_new=0;
+ //推荐,热卖,新品
+ if (nav_item.goodsclass == 1) {
+ this.data.is_recommend = 1
+ }
+ if (nav_item.goodsclass == 2) {
+ this.data.is_hot = 1
+ }
+ if (nav_item.goodsclass == 3) {
+ this.data.is_new = 1
+ }
+
+
+ this.data.currentPage=1;
+ this.setData({goods_array:null,total:null,title_index:title_idx});
+ //初始化
+ this.init(this.data.classstyle_id, this.data.wgroup);
+ setTimeout(function(){ wx.hideLoading();},1000)
+ }
}
})
\ No newline at end of file
diff --git a/components/diy_goodsGroup/diy_goodsGroup.wxml b/components/diy_goodsGroup/diy_goodsGroup.wxml
index 726ce9e..a89085a 100644
--- a/components/diy_goodsGroup/diy_goodsGroup.wxml
+++ b/components/diy_goodsGroup/diy_goodsGroup.wxml
@@ -1,10 +1,20 @@
+
+
+
+
+
+ {{item.title}}
+
+
+
+
-
+
-
+
@@ -293,7 +303,7 @@
-
+
@@ -430,7 +440,7 @@
-
+
@@ -562,7 +572,8 @@
-
+
+
\ No newline at end of file
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{aitem.goods_name}}
+
+
+ ¥{{aitem.prom_price}}
+ ¥{{aitem.market_price}}
+
+
+
+
+
+
+
+
+
+
+ ¥
+ {{filter.toFix(aitem[card_field],2)}}
+
+
+ {{card_name}}
+
+
+
+
+
+
+ ¥
+ {{aitem.market_price}}
+
+
+
+
+
+
+
+ ¥
+ {{filter.toFix(aitem.shop_price,2)}}
+
+
+
+
+
+ ¥
+ {{aitem.market_price}}
+
+
+
+
+
+
+
+
+
+
+ ¥
+ {{filter.toFix(aitem.shop_price,2)}}
+
+
+
+ ¥
+ {{aitem.market_price}}
+
+
+
+
+
+
+ ¥
+ {{filter.toFix(g_filter.get_card_price(aitem,card_list,0),2)}}
+
+
+ {{g_filter.get_card_price(aitem,card_list,1)}}
+
+
+
+
+
+
+
+
+ ¥
+ {{filter.toFix(aitem.shop_price,2)}}
+
+
+
+
+
+ ¥
+ {{aitem.market_price}}
+
+
+
+
+
+
+ ¥{{aitem.shop_price}}
+ ¥{{aitem.market_price}}
+
+
+
+ 销量:{{aitem.sales_sum}}件
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/diy_goodsGroup/diy_goodsGroup.wxss b/components/diy_goodsGroup/diy_goodsGroup.wxss
index fd0c351..5a84a92 100644
--- a/components/diy_goodsGroup/diy_goodsGroup.wxss
+++ b/components/diy_goodsGroup/diy_goodsGroup.wxss
@@ -6,9 +6,9 @@
.zs_goods {
width: 700rpx;
- border: 1rpx #ddd solid;
margin-bottom: 10rpx;
margin: 0 auto;
+ overflow:hidden
}
.s1_gk_a1 {
@@ -263,11 +263,11 @@
float: left;
background: #fff;
margin-left: 1%;
- border:1rpx solid rgb(214, 214, 214);
- border-radius: 25rpx;
margin-top: 10rpx;
}
+
+
.zs_goods_2l {
width: 94%;
min-height: 300rpx;
@@ -390,6 +390,7 @@
float: left;
margin-bottom: 8rpx;
background-color: white;
+ overflow: hidden;
}
.zs_goods_san {
@@ -399,9 +400,9 @@
.zs_goods_3l {
width: 236rpx;
min-height: 300rpx;
- border: 2rpx #ddd solid;
margin: 0 auto;
padding: 2rpx;
+ overflow: hidden;
}
.zs_top_3l {
@@ -571,6 +572,216 @@
white-space: nowrap;
}
+.ai-center{align-items: center;}
+
+.gr_title_list{ width:95%; margin-left:2.5%}
+.gr_title_item{ padding:0 10rpx;flex-shrink: 0;}
+
+
+.border_zhijiao{
+ border:1rpx solid rgb(214, 214, 214);
+}
+.border_yuanjiao{
+ border:1rpx solid rgb(214, 214, 214);
+ border-radius: 25rpx;
+}
+.top {
+ background-color: white;
+ height: 70rpx;
+ line-height: 70rpx;
+ color: #000;
+ border-bottom: 2rpx solid #eee;
+ padding:0rpx 20rpx;
+ display: flex;
+ justify-content: space-between;
+ font-size: 32rpx;
+}
+.s_it {
+ width: 100%;
+ display: flex;
+ background-color: white;
+}
+
+.s_prom {
+ width: 100%;
+ background-color: white;
+ min-height: 200rpx;
+}
+
+swiper {
+ display: block;
+ height: 400rpx;
+}
+
+.right_k {
+ width: 30rpx;
+}
+.right_k image{
+ width: 30rpx;
+ height: 30rpx;
+}
+ .t_left {
+ width: 10rpx;
+ height: 38rpx;
+ background: #c4182e;
+ margin-right: 10rpx;
+}
+
+
+.sp {
+ min-height: 300rpx;
+ width: 100%;
+ background-color: white;
+ padding: 18rpx;
+ display: flex;
+}
+
+.sp .sp_top {
+ height: 220rpx;
+ min-width: 30%;
+}
+
+.sp .sp_top .s_img {
+ width: 210rpx;
+ height: 100%;
+}
+
+.sp .sp_top .s_img image {
+ width: 210rpx;
+ height: 100%;
+ position: relative;
+ top: -74rpx;
+ left: 0rpx;
+}
+
+.sp .sp_top .s_top_kill {
+ background-color: #c4182e;
+ font-size: 24rpx;
+ height: 38rpx;
+ line-height: 38rpx;
+ left: 6rpx;
+ padding: 4rpx 10rpx;
+ border-radius: 10rpx;
+ z-index: 999;
+ position: relative;
+ top: -6rpx;
+ width: 210rpx;
+ color: #fff;
+ text-align: center;
+}
+
+.po {
+ position: absolute;
+}
+
+.sp .sp_top .s_foot_kill {
+ font-size: 20rpx;
+ position: relative;
+ top: -90rpx;
+ width: 210rpx;
+ height: 38rpx;
+ line-height: 38rpx;
+ color: #fff;
+ text-align: center;
+ background-color: rgba(0, 0, 0, 0.5);
+}
+
+.sp_wz {
+ width: 210rpx;
+ min-height: 100rpx;
+}
+
+.sp_wz .sp_wzi {
+ font-size: 30rpx;
+ border-bottom: 2rpx solid #dcdcdc;
+ width: 100%;
+ text-align: left;
+ padding: 4rpx 0;
+ overflow: hidden;
+ height: 48rpx;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ line-height: 48rpx;
+}
+
+.sp_wz .sp_jg {
+ color: #c4182e;
+ font-size: 30rpx;
+ overflow: hidden;
+ display: inline-block;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ margin-right: 10rpx;
+}
+
+.sp_wz .sp_jgx {
+ color: #adadad;
+ text-decoration: line-through;
+ font-size: 24rpx;
+ overflow: hidden;
+ display: inline-block;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.one {
+ margin-left: 14rpx;
+}
+
+.sp .sp_top .s_top1_kill {
+ position: absolute;
+ background-color: #c4182e;
+ font-size: 24rpx;
+ height: 38rpx;
+ line-height: 38rpx;
+ left: 265rpx;
+ top: 100rpx;
+ padding: 0 10rpx;
+ color: white;
+ border-radius: 10rpx;
+}
+
+.sp .sp_top .s_top2_kill {
+ position: absolute;
+ background-color: #c4182e;
+ font-size: 24rpx;
+ height: 38rpx;
+ line-height: 38rpx;
+ right: 146rpx;
+ top: 100rpx;
+ padding: 0 10rpx;
+ color: white;
+ border-radius: 10rpx;
+}
+
+.sp .sp_top .s_foot1_kill {
+ font-size: 20rpx;
+ position: absolute;
+ top: 270rpx;
+ width: 210rpx;
+ height: 38rpx;
+ line-height: 38rpx;
+ color: #fff;
+ text-align: center;
+ background-color: rgba(0, 0, 0, 0.5);
+}
+
+.po1 {
+ position: absolute;
+}
+
+.sp .sp_top .s_foot2_kill {
+ font-size: 20rpx;
+ position: absolute;
+ top: 270rpx;
+ width: 210rpx;
+ height: 38rpx;
+ line-height: 38rpx;
+ color: #fff;
+ text-align: center;
+ background-color: rgba(0, 0, 0, 0.5);
+}
+.t_red{ color:red;}
diff --git a/components/diy_goodsGroup/g_filter.wxs b/components/diy_goodsGroup/g_filter.wxs
index 8bba9f3..bffffae 100644
--- a/components/diy_goodsGroup/g_filter.wxs
+++ b/components/diy_goodsGroup/g_filter.wxs
@@ -8,11 +8,21 @@ var get_class = function(column,position) {
if(column==3){ return "zs_t"+position+"_3l"; }
//----列表的情况-----
if(column==4 ){ return "zs_t1_x"+position; }
-
}
var g_filters = {
+ //判断边框类型
+ get_border_type:function(type){
+ if(!type) type=0;
+ var type=parseInt(type);
+ switch(type){
+ case 0: return "border_zhijiao";
+ case 1: return "border_yuanjiao";
+ }
+ return "";
+ }
+
//-- 判断是不是有等级价 --
is_has_rank:function(rank_switch,item){
if(!rank_switch) return false;
@@ -74,6 +84,8 @@ var g_filters = {
if(min_name.length>4 ) min_name=min_name.substring(0, 4);
return min_name;
},
+
+
}
@@ -81,4 +93,5 @@ module.exports = {
get_class: get_class,
is_has_rank:g_filters.is_has_rank,
get_card_price:g_filters.get_card_price,
+ get_border_type:g_filters.get_border_type,
}
diff --git a/pages/team/team_show/team_show.js b/pages/team/team_show/team_show.js
index 3a795e9..16591d5 100644
--- a/pages/team/team_show/team_show.js
+++ b/pages/team/team_show/team_show.js
@@ -62,11 +62,33 @@ Page({
iurl:os.imghost,
- openSpecModal: !1,
- openSpecModal_pt: !1, //拼单的弹起,
+ openSpecModal: !1,
+ openSpecModal_pt: !1, //拼单的弹起,
+
+
+ //门店相关
+ ismend: 0,
+ is_sec_mend: 0,
+ sto_sele_name: "", //选中的门店名称
+ sto_sele_id: "", //选中的门店id
+ sto_sele_distr: "", //选择的门店的配送方式
+ is_show_sto_cat: 1, //是否显示门店分类
+ only_pk: null,
+ all_sto: null,
+ sec_sto: null, //选择了的门店分类
+ pickpu_list: null, //读出的所有门店list
+ def_pickpu_list: null, //一开始5个门店list
+ sec_pick_index: 0, //第二级门店选择ID
+ fir_pick_index: 0, //第一级门店选择ID
+ all_pick_list:null,//所有的门店先记录起来
+ bconfig:null,
+ def_pick_store: null, // 默认的门店
+ fir_def_store:null, //客户默认的门店的
+ lat: null, //维度
+ lon: null, //经度
+
+ is_get_local_ok: 0, //获取坐标是否完成
- showStore: true,
- selectStore: 0,
},
onLoad: function(options) {
@@ -94,20 +116,21 @@ Page({
})
}
-
this.setData({tg_id: tg_id });
- getApp().globalData.to_group=null;
+ getApp().globalData.to_group=null;
+
+ var th=this;
+ getApp().getConfig2(function(e) {
+ th.setData({ bconfig: e,});
+ th.wait_for_store_config(); //获取默认的门店
+ })
+
},
//显示加载
onShow:function(){
var tg_id = this.data.tg_id,th=this;
- this.init(tg_id);
-
- getApp().get_user_store(function (e) {
- if(e)
- th.setData({ pick_id: e.pickup_id, end_name: e.pickup_name,ii:1 })
- })
+ this.init(tg_id);
},
//c点击打开拼团弹窗
@@ -334,7 +357,8 @@ Page({
teamgroup = null, //活動从表
max_num = 0,
min_price = 0,
- th=this;
+ th=this,
+ that=th;
//获取活动从表信息team_id,listno团编号(券号)
await getApp().request.promiseGet("/api/weshop/teamgroup/get/"+os.stoid+"/"+tg_id, {
@@ -458,7 +482,21 @@ Page({
original_img = ee.data.imageurl + res.data.data.original_img,
goods = res.data.data
})
-
+
+ //显示商品规格
+ var gg = "";
+ if(goods.goods_spec=="null" || goods.goods_spec==null ) goods.goods_spec="";
+ if(goods.goods_color=="null" || goods.goods_color==null) goods.goods_color="";
+
+ if (goods.goods_spec != "" && goods.goods_color != "") {
+ gg = goods.goods_spec + "/" + goods.goods_color;
+ } else if (goods.goods_spec != "" || goods.goods_color != "") {
+ gg = goods.goods_spec + goods.goods_color;
+ } else {
+ gg = "规格1";
+ }
+ goods.gg = gg;
+
//只装5个
var ordertx2 = [], sf_num = 0, ct_nun = teamlist.ct_num;
if (max_num) {
@@ -519,7 +557,83 @@ Page({
pageteam = res.data.data.pageData;
});
- //获取下redis长度,如果团已经弄完,或者拼单已经卖完
+ //-- 获取用户的默认门店 --
+ getApp().get_user_store(function(ee) {
+ if(!ee) {
+ th.data.fir_def_store={}; //赋值空对象
+ return false;
+ }
+ //--定时器推迟一下--
+ setTimeout(function () {
+ var g_distr_type=th.data.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;
+ }
+
+ 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( appd.lat==that.data.lat && appd.lon==that.data.lon && e.distance>0 ){
+ that.data.fir_def_store=e;
+ that.setData({
+ def_pick_store: e,
+ sto_sele_name: e.pickup_name,
+ sto_sele_id: e.pickup_id,
+ sto_sele_distr: e.distr_type
+ })
+ }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){
+ appd.pk_store=e;
+ that.data.fir_def_store=e;
+ that.setData({
+ def_pick_store: e,
+ sto_sele_name: e.pickup_name,
+ sto_sele_id: e.pickup_id,
+ sto_sele_distr: e.distr_type
+ })
+ }
+
+ }
+ })
+ }
+
+ //e.distance = distance;
+ appd.lat=that.data.lat;
+ appd.lon=that.data.lon;
+
+ }else{
+ if (e) {
+ e.distance = null;
+ that.data.fir_def_store=e;
+ that.setData({
+ def_pick_store: e,
+ sto_sele_name: e.pickup_name,
+ sto_sele_id: e.pickup_id,
+ sto_sele_distr: e.distr_type
+ })
+ }
+ }
+
+ }, 500)
+ },1000)
+ });
+
+ //获取下redis长度,如果团已经弄完,或者拼单已经卖完
//设置值
ee.setData({
ordertx2: ordertx2,
@@ -533,11 +647,10 @@ Page({
sf_arr: sf_arr
});
ee.countDown2();
- //---设置门店---
- ee.get_sto();
-
+ //---设置门店---
+ ee.get_sto();
//---定时设置一下待支付的订单---
- ee.time_out();
+ ee.time_out();
},
onHide:function(){
@@ -730,6 +843,11 @@ Page({
//------去支付,购买-------
go_pay:function () {
var th=this;
+ var def_pick_store=this.data.def_pick_store;
+ if(def_pick_store) {
+ th.data.pick_id=def_pick_store.pickup_id; //选择门店
+ th.data.end_name=def_pick_store.pickup_name;
+ }
if (th.data.pick_id == 0) return s.my_warnning("请选择门店", 0, th);
//----判断起购数----
@@ -967,103 +1085,488 @@ Page({
- // 选择门店
+ //-- 选择门店。此时的门店选择与门店有关系 --
choice_store: function(ee) {
+
+ var th = this;
+ var bconfig = th.data.bconfig;
+ if(!th.data.only_pk && !th.data.def_pickpu_list){
+ getApp().confirmBox("门店库存不足", null, 25000, !1);
+ return false;
+ }
+ if(th.data.only_pk && !th.data.only_pk.length){
+ getApp().confirmBox("门店库存不足", null, 25000, !1);
+ return false;
+ }
+ if(th.data.def_pickpu_list && !th.data.def_pickpu_list.length){
+ getApp().confirmBox("门店库存不足", null, 25000, !1);
+ return false;
+ }
- // console.log('1');
- this.setData({
- // store: 1,
- yijian: false,
- showStore: false,
- });
+ if (bconfig.is_sort_storage) {
+ wx.getLocation({
+ type: 'wgs84',
+ success: function(res) {
- // var th = this;
- // var ind=ee.currentTarget.dataset.ind;
- // var bconfig = th.data.bconfig;
-
- // if(!th.data.only_pk && !th.data.def_pickpu_list){
- // getApp().confirmBox("门店库存不足", null, 25000, !1);
- // return false;
- // }
-
- // if(th.data.only_pk && !th.data.only_pk.length){
- // getApp().confirmBox("门店库存不足", null, 25000, !1);
- // return false;
- // }
- // if(th.data.def_pickpu_list && !th.data.def_pickpu_list.length){
- // getApp().confirmBox("门店库存不足", null, 25000, !1);
- // return false;
- // }
-
-
- // if (bconfig.is_sort_storage) {
- // wx.getLocation({
- // type: 'wgs84',
- // success: function(res) {
-
- // th.data.lat = res.latitude;
- // th.data.lon = res.longitude;
- // th.data.is_get_local_ok = 1;
- // th.setData({
- // is_gps: 1
- // });
- // //th.onShow();
- // th.get_sto();
- // },
- // fail: function(res) {
- // //th.onShow();
- // th.data.is_get_local_ok = 1;
- // th.get_sto();
- // if (res.errCode == 2) {
- // th.setData({
- // is_gps: 0
- // });
- // if (th.data.is_gps == 0) {
- // getApp().confirmBox("请开启GPS定位", null, 25000, !1);
- // }
- // } else {
- // th.setData({
- // is_gps: "3"
- // });
- // }
-
- // }
- // })
- // }else{
- // th.data.is_get_local_ok = 1;
- // th.get_sto();
- // }
-
- // if(ind!=undefined && ind!=null ){
- // this.setData({
- // open_ind_store: ind,
- // store: 1,
- // openSpecModal: !1,
- // openSpecModal_pt: !1
- // })
- // }else{
- // this.setData({
- // store: 1,
- // openSpecModal: !1,
- // openSpecModal_pt: !1
- // })
- // }
- },
-
+ th.data.lat = res.latitude;
+ th.data.lon = res.longitude;
+ th.data.is_get_local_ok = 1;
+ th.setData({
+ is_gps: 1
+ });
+ //th.onShow();
+ th.get_sto();
+ },
+ fail: function(res) {
+ //th.onShow();
+ th.data.is_get_local_ok = 1;
+ th.get_sto();
+ if (res.errCode == 2) {
+ th.setData({
+ is_gps: 0
+ });
+ if (th.data.is_gps == 0) {
+ getApp().confirmBox("请开启GPS定位", null, 25000, !1);
+ }
+ } else {
+ th.setData({
+ is_gps: "3"
+ });
+ }
+
+ }
+ })
+ }else{
+ th.data.is_get_local_ok = 1;
+ th.get_sto();
+ }
+ this.setData({
+ store: 1,
+ yijian: false,
+ })
+
+ },
+
//选择更多门店
more_store: function() {
- this.setData({
- selectStore: 1
- });
+ this.setData({ sort_store: 1});
},
// 返回按钮
returns: function() {
this.setData({
- selectStore: 0,
+ sort_store: 0,choice_sort_store: 0
+ });
+ },
+
+
+ //-- 等待获取定位系统 --
+ wait_for_store_config: function() {
+ var th = this;
+ var t_time = setInterval(function() {
+ if (th.data.bconfig == null) false;
+ var e = th.data.bconfig;
+ if (e.is_sort_storage) {
+ wx.getLocation({
+ type: 'wgs84',
+ success: function(res) {
+ th.data.lat = res.latitude;
+ th.data.lon = res.longitude;
+ th.data.is_get_local_ok = 1;
+ },
+ fail: function(res) {
+ if (res.errCode == 2) {
+ th.setData({
+ is_gps: 0
+ });
+ if (th.data.is_gps == 0) {
+ getApp().confirmBox("请开启GPS定位", null, 10000, !1);
+ }
+
+ } else {
+ th.setData({
+ is_gps: "3"
+ });
+ }
+
+ th.data.is_get_local_ok = 1;
+ }
+ })
+ } else {
+ th.data.is_get_local_ok = 1;
+ }
+ clearInterval(t_time);
+ }, 500)
+ },
+
+
+ //---------拿出门店分类和门店------------
+ get_sto(e) {
+ var th = this,that=this;
+ var timer_get = setInterval(function() {
+ if (th.data.is_get_local_ok == 0) return false;
+ var dd = null,
+ i = getApp().request;
+ var g_distr_type = th.data.goods.distr_type;
+ if (g_distr_type != 0) {
+ dd = {
+ store_id: o.stoid,
+ distr_type: g_distr_type,
+ isstop: 0,
+ pageSize: 2000
+ }
+ } else {
+ dd = {
+ store_id: o.stoid,
+ isstop: 0,
+ pageSize: 2000
+ }
+ }
+ //如果有距离的话
+ if (th.data.lat != null) {
+ dd.lat = th.data.lat;
+ dd.lon = th.data.lon;
+ }
+ clearInterval(timer_get);
+
+ if(th.data.def_pick_store && g_distr_type!=0 && th.data.def_pick_store.distr_type!=0 && th.data.def_pick_store.distr_type!=g_distr_type ){
+ th.setData({def_pick_store:null});
+ }
+
+ //----------获取门店----------------
+ getApp().request.promiseGet("/api/weshop/pickup/list", {
+ data: dd,
+ }).then(res => {
+ var e = res;
+ if (e.data.code == 0) {
+
+ //如果有开启距离的功能,没有设置默认门店,要用最近的门店作为默认门店
+ if(dd.lat && !th.data.def_pick_store && th.data.bconfig.is_sort_storage){
+ th.setData({
+ def_pick_store:e.data.data.pageData[0],
+ sto_sele_name: e.data.data.pageData[0].pickup_name,
+ sto_sele_id: e.data.data.pageData[0].pickup_id,
+ sto_sele_distr: e.data.data.pageData[0].distr_type
+ });
+ th.data.fir_def_store=e.data.data.pageData[0];
+ }
+
+ //-- 如果有默认选择门店的时候,要把默认门店放在第一位 --
+ if (th.data.def_pick_store && (th.data.def_pick_store.distr_type==0 || th.data.def_pick_store.distr_type==g_distr_type )){
+ for (var k = 0; k < e.data.data.pageData.length; k++) {
+ if (e.data.data.pageData[k].pickup_id == th.data.def_pick_store.pickup_id) {
+ e.data.data.pageData.splice(k, 1); //删除
+ break;
+ }
+ }
+ e.data.data.pageData.splice(0, 0, th.data.def_pick_store); //添加
+ }
+
+
+ th.setData({all_pick_list:e.data.data.pageData});
+
+
+ setTimeout(function(){
+ th.deal_pickup(e); //--普通门店排版--
+ },800)
+
+ }
+ })
+ }, 200)
+
+ },
+
+ //------------处理门店,拼团活动只有线上库存---------------
+ deal_pickup(e){
+ var th=this;
+ var g_distr_type=th.data.goods.distr_type;
+ //单总量超出5个的时候
+ if (e.data.data.total > 5) {
+ getApp().request.get("/api/weshop/storagecategory/page", {
+ data: {
+ store_id: o.stoid,
+ is_show: 1,
+ pageSize: 1000
+ },
+ success: function(ee) {
+ if (ee.data.code == 0) {
+ if (ee.data.data && ee.data.data.pageData && ee.data.data.pageData.length > 0) {
+ var def_arr = new Array();
+ var ishas = 0;
+ //-- 开始就看5个门店 --
+ for (var k = 0; k < 5; k++) {
+ if (k == e.data.data.pageData.length) break;
+ def_arr.push(e.data.data.pageData[k]);
+ }
+
+ th.setData({
+ def_pickpu_list: def_arr,
+ pickpu_list: ee.data.data.pageData
+ });
+ var sto_cate = ee.data.data.pageData;
+ var sto_arr = e.data.data.pageData;
+ var newarr = new Array();
+ var qita = new Array();
+
+ //----要进行门店分组--------
+ for (var i = 0; i < sto_arr.length; i++) {
+ //找一下这个门店有没有在分类数组内
+ var find2 = 0,
+ find2name = "";
+ for (var m = 0; m < sto_cate.length; m++) {
+ if (sto_arr[i].category_id == sto_cate[m].cat_id) {
+ find2 = sto_cate[m].cat_id;
+ find2name = sto_cate[m].cat_name;
+ break;
+ }
+ }
+
+ if (newarr.length > 0) {
+ var find = 0;
+ //如果有找到,那门店就在这个分组内,否则,分类就要排在其他
+ if (find2 != 0) {
+ for (var ii = 0; ii < newarr.length; ii++) {
+ if (sto_arr[i].category_id == newarr[ii].cat_id) {
+ newarr[ii].s_arr.push(sto_arr[i]);
+ find = 1;
+ break;
+ }
+ }
+ if (find == 0) {
+ var arr0 = new Array();
+ arr0.push(sto_arr[i]);
+ var item = {
+ cat_id: find2,
+ name: find2name,
+ s_arr: arr0
+ };
+ newarr.push(item);
+ }
+ } else {
+ qita.push(sto_arr[i]);
+ }
+ } else {
+ //如果有找到,那门店就在这个分组内,否则,分类就要排在其他
+ if (find2 != 0) {
+ var arr0 = new Array();
+ arr0.push(sto_arr[i]);
+ var item = {
+ cat_id: find2,
+ name: find2name,
+ s_arr: arr0
+ };
+ newarr.push(item);
+ } else {
+ qita.push(sto_arr[i]);
+ }
+ }
+ }
+
+ //----安排其他的分类-----
+ if (qita.length > 0) {
+ var item = {
+ cat_id: -1,
+ name: "其他",
+ s_arr: qita
+ };
+ newarr.push(item);
+ }
+ th.setData({
+ is_show_sto_cat: 1,
+ all_sto: newarr
+ });
+
+ } else {
+ th.setData({
+ is_show_sto_cat: -1,
+ only_pk: e.data.data.pageData
+ });
+ //-----如果没有默认门店,要取第一个门店作为默认店.此时没有门店分类的情况------
+ if (!th.data.def_pick_store) {
+ th.setData({def_pick_store:e.data.data.pageData[0]})
+ }
+ }
+ } else {
+ th.setData({
+ is_show_sto_cat: -1,
+ only_pk: e.data.data.pageData
+ });
+ //-----如果没有默认门店,要取第一个门店作为默认店.此时没有门店分类的情况------
+ if (!th.data.def_pick_store) {
+ th.setData({def_pick_store:e.data.data.pageData[0]})
+ }
+
+ }
+ }
+ });
+ } else {
+ th.setData({
+ is_show_sto_cat: 0,
+ only_pk: e.data.data.pageData
+ });
+ //-----如果没有默认门店,要取第一个门店作为默认店------
+ if (!th.data.def_pick_store && th.data.bconfig.is_sort_storage) {
+ th.setData({
+ def_pick_store:e.data.data.pageData[0],
+ sto_sele_name: e.data.data.pageData[0].pickup_name,
+ sto_sele_id: e.data.data.pageData[0].pickup_id,
+ sto_sele_distr: e.data.data.pageData[0].distr_type
+ })
+ }
+ }
+ },
+ //---选择分类门店---
+ choice_sort_store: function(e) {
+ var index = e.currentTarget.dataset.index;
+ var region_name = e.currentTarget.dataset.region;
+ var item = this.data.all_sto[index];
+ this.setData({
+ region_name: region_name,
+ sort_store: 0,
+ choice_sort_store: 1,
+ sec_sto: item,
+ sec_pick_index: 0
});
},
+
+ choose_for_store_fir: function(e) {
+ var index_c = e.currentTarget.dataset.ind;
+ var th=this;
+ th.setData({
+ fir_pick_index: index_c
+ })
+ },
+
+ //---点击二级之后的选择---
+ choose_for_store: function(e) {
+ var index_c = e.currentTarget.dataset.ind;
+ var th=this;
+ th.setData({
+ sec_pick_index: index_c,
+ fir_pick_index: index_c
+ })
+
+ },
+
+ //确定def_pick为选择的门店
+ sure_pick: function(e) {
+ var th = this;
+ var item = null;
+
+ if (th.data.choice_sort_store == 0) {
+ var index = th.data.fir_pick_index;
+ if (th.data.is_show_sto_cat == 1) {
+ item = th.data.def_pickpu_list[index];
+ } else {
+ item = th.data.only_pk[index]; //当没有门店分类的时候
+ }
+
+ } else {
+ var index = th.data.sec_pick_index;
+ item = th.data.sec_sto.s_arr[index];
+ }
+
+
+ th.setData({
+ def_pick_store: item,
+ sto_sele_name: item.pickup_name,
+ sto_sele_id: item.pickup_id,
+ sto_sele_distr: item.distr_type,
+ store: 0,
+ choice_sort_store: 0,
+ fir_pick_index: 0
+ });
+
+
+ th.setData({
+ yijian: 1, //打开拼团购买界面
+ store: 0, //关闭门店
+ choice_sort_store: 0, //关闭门店2级
+ sort_store: 0, //关闭门店2级
+ });
+
+
+ },
+
+
+
+ //把选择的门店设置成默认的门店def_pick
+ set_def_pick: function(e) {
+ var th = this;
+ var item = null;
+ if (th.data.choice_sort_store == 0) {
+ var index = th.data.fir_pick_index;
+ if (th.data.is_show_sto_cat == 1) {
+ item = th.data.def_pickpu_list[index];
+ } else {
+ item = th.data.only_pk[index]; //当没有门店分类的时候
+ }
+ } else {
+ var index = th.data.sec_pick_index;
+ item = th.data.sec_sto.s_arr[index];
+ }
+
+
+ var store_id = o.stoid;
+ var user_id = getApp().globalData.user_id;
+ var def_pickup_id = item.pickup_id;
+
+ getApp().request.put('/api/weshop/users/update', {
+ data: {
+ user_id,
+ def_pickup_id
+ },
+ success: function(res) {
+ if (res.data.code == 0) {
+ if (th.data.choice_sort_store == 0) th.setData({
+ fir_pick_index: 0
+ });
+ getApp().globalData.pk_store = item;
+ } else {
+ getApp().my_warnning("设置默认门店地址失败",0,th)
+ }
+
+ }
+ });
+
+ th.setData({
+ def_pick_store: item,
+ sto_sele_name: item.pickup_name,
+ sto_sele_id: item.pickup_id,
+ sto_sele_distr: item.distr_type,
+ store: 0,
+ choice_sort_store: 0
+ });
+
+ //4就是拼团
+ th.setData({
+ yijian: 1, //打开拼团购买界面
+ store: 0, //关闭门店
+ choice_sort_store: 0, //关闭门店2级
+ sort_store: 0, //关闭门店2级
+ });
+
+ },
+
+
+ //-- 关闭选择门店 --
+ close_popup: function(e) {
+ var th=this;
+ this.setData({
+ store: 0,
+ choice_sort_store: 0,
+ sort_store: 0,
+ fir_pick_index:0,
+ sec_pick_index:0,
+ yijian: 1, //打开拼团购买界面
+ })
+
+ },
+
+
+
+
})
\ No newline at end of file
diff --git a/pages/team/team_show/team_show.wxml b/pages/team/team_show/team_show.wxml
index f509501..0007b82 100644
--- a/pages/team/team_show/team_show.wxml
+++ b/pages/team/team_show/team_show.wxml
@@ -196,92 +196,55 @@
-
+
- {{sele_g.goods_name}}商品名称
-
-
-
+ {{goods.goods_name}}商品名称
+
-
-
-
- ¥ {{sele_g[card_field]}}1.00
-
-
-
-
-
-
-
-
-
- 已售:{{sele_g.sales_sum}}5
- 可售:{{sele_g.store_count}}4
+ ¥{{teamlist.kttype==3?teamlist.yf_price:teamlist.price}}
-
-
-
+
+
+ 已售:{{teamlist.buy_num}}
+ 可售:{{teamlist.goods_num-teamlist.buy_num}}
+
-
-
- {{def_pick_store.pickup_name}}美得得
-
-
- 距离:400m
-
+
+
+ {{def_pick_store.pickup_name}}
+
+
+ 距离:{{def_pick_store.distance>1000?filters.toFix(def_pick_store.distance/1000,2)+"km":filters.toFix(def_pick_store.distance,0)+"m"}}
-
-
-
+
-
- 更多门店
-
-
-
-
- 地址:泉州市
-
+
+ 地址:5{{def_pick_store.fulladdress}}
+
-
+
商品属性
-
-
- {{item.gg}}规格1
+ {{goods.gg}}
-
@@ -289,9 +252,9 @@
购买数量
- -
- 1
- +
+ -
+ 1
+ +
@@ -301,7 +264,7 @@
- 确定
+ 确定
@@ -310,78 +273,129 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
diff --git a/pages/team/team_show/team_show.wxss b/pages/team/team_show/team_show.wxss
index e40813f..8c8c4a6 100644
--- a/pages/team/team_show/team_show.wxss
+++ b/pages/team/team_show/team_show.wxss
@@ -2041,9 +2041,15 @@ page {
height: 25rpx;
}
+.choose_more{
+ margin-top: 40rpx;
+ margin-right: 20rpx;
+
+}
.choose_mores{
margin-top: 30rpx;
margin-right: 15rpx;
+
}
.bg_rights{