Commit f059f16202608c600382f86c7168fcb7e36df89b

Authored by yvan.ni
2 parents 37ea7f68 d662d782

Merge branch 'work1.1_20190926' of http://git.vipzhuang.cn/wxd/MShopWeApp into work1.1_20190926

pages/goods/goodsInfo/goodsInfo.js
@@ -224,6 +224,7 @@ Page({ @@ -224,6 +224,7 @@ Page({
224 is_get_local_ok:0,//获取坐标是否完成 224 is_get_local_ok:0,//获取坐标是否完成
225 region_name:"门店分类",//区域的名字 225 region_name:"门店分类",//区域的名字
226 is_gps:1, 226 is_gps:1,
  227 + open_ind_store:0,//哪里打开的门店列表的控制属性
227 }, 228 },
228 229
229 //------初始化加载---------- 230 //------初始化加载----------
@@ -256,28 +257,7 @@ Page({ @@ -256,28 +257,7 @@ Page({
256 supportPageScroll: !0 257 supportPageScroll: !0
257 }); 258 });
258 259
259 - if(e.is_sort_storage){  
260 - wx.getLocation({  
261 - type: 'wgs84',  
262 - success: function (res) {  
263 - th.data.lat=res.latitude;  
264 - th.data.lon=res.longitude;  
265 - th.data.is_get_local_ok=1;  
266 - },  
267 - fail: function (res) {  
268 -  
269 - if (res.errCode == 2) {  
270 - th.setData({ is_gps: 0 });  
271 - } else {  
272 - th.setData({ is_gps: "3" });  
273 - }  
274 -  
275 - th.data.is_get_local_ok=1;  
276 - }  
277 - })  
278 - }else{  
279 - th.data.is_get_local_ok=1;  
280 - } 260 +
281 261
282 }) 262 })
283 263
@@ -302,6 +282,32 @@ Page({ @@ -302,6 +282,32 @@ Page({
302 },500) 282 },500)
303 283
304 }) 284 })
  285 +
  286 + if (e.is_sort_storage) {
  287 + wx.getLocation({
  288 + type: 'wgs84',
  289 + success: function (res) {
  290 + th.data.lat = res.latitude;
  291 + th.data.lon = res.longitude;
  292 + th.data.is_get_local_ok = 1;
  293 + },
  294 + fail: function (res) {
  295 + if (res.errCode == 2) {
  296 + th.setData({ is_gps: 0 });
  297 + if (th.data.is_gps == 0) {
  298 + s.showWarning("请开启GPS定位", null, 3800000, !1);
  299 + }
  300 +
  301 + } else {
  302 + th.setData({ is_gps: "3" });
  303 + }
  304 +
  305 + th.data.is_get_local_ok = 1;
  306 + }
  307 + })
  308 + } else {
  309 + th.data.is_get_local_ok = 1;
  310 + }
305 311
306 }, 312 },
307 313
@@ -678,8 +684,10 @@ Page({ @@ -678,8 +684,10 @@ Page({
678 }, 684 },
679 685
680 //------------加入购物车-------------- 686 //------------加入购物车--------------
681 - addCart: function(t) { 687 + addCart: function(t) {
682 var th=this; 688 var th=this;
  689 + var ind = t.currentTarget.dataset.openSpecModal_ind;
  690 + th.setData({open_ind_store: ind});
683 //如果是秒杀的话,要看redis够不够 691 //如果是秒杀的话,要看redis够不够
684 if(this.data.prom_type==1){ 692 if(this.data.prom_type==1){
685 this.getactLen(function (num) { 693 this.getactLen(function (num) {
@@ -924,8 +932,10 @@ Page({ @@ -924,8 +932,10 @@ Page({
924 }); 932 });
925 }, 933 },
926 openSpecModel: function(t) { 934 openSpecModel: function(t) {
  935 + var open_store = t.currentTarget.dataset.ind;
  936 + console.log(t,"加入购物车头",open_store);
927 this.setData({ 937 this.setData({
928 - store: 0, choice_sort_store: 0, sort_store: 0 938 + store: 0, choice_sort_store: 0, sort_store: 0, open_ind_store: open_store,
929 }) 939 })
930 //--先判断会员状态-- 940 //--先判断会员状态--
931 var user_info=getApp().globalData.userInfo; 941 var user_info=getApp().globalData.userInfo;
@@ -1127,7 +1137,14 @@ Page({ @@ -1127,7 +1137,14 @@ Page({
1127 1137
1128 //-----------选择属性的按钮事件---------- 1138 //-----------选择属性的按钮事件----------
1129 sele_spec: function(e) { 1139 sele_spec: function(e) {
1130 - var gid = e.target.dataset.gid; 1140 + var gid = e.currentTarget.dataset.gid;
  1141 + var sku_g = this.data.sku_g;
  1142 + var item = null;
  1143 + for (var i in sku_g) {
  1144 + if (sku_g[i].goods_id == gid) { item = sku_g[i]; break }
  1145 + }
  1146 + if (item) this.setData({ sele_g: item, gid: gid });
  1147 +
1131 }, 1148 },
1132 //---------拿出门店分类和门店------------ 1149 //---------拿出门店分类和门店------------
1133 get_sto(e) { 1150 get_sto(e) {
@@ -2674,6 +2691,7 @@ Page({ @@ -2674,6 +2691,7 @@ Page({
2674 tt(); 2691 tt();
2675 }, 2692 },
2676 fail: function (res) { 2693 fail: function (res) {
  2694 +
2677 ee.data.share_goods_img= "../../../images/share/default_g_img.gif"; //分享的图片不能用网络的 2695 ee.data.share_goods_img= "../../../images/share/default_g_img.gif"; //分享的图片不能用网络的
2678 tt(); 2696 tt();
2679 } 2697 }
@@ -2729,25 +2747,28 @@ Page({ @@ -2729,25 +2747,28 @@ Page({
2729 }) 2747 })
2730 }, 2748 },
2731 // 选择门店 2749 // 选择门店
2732 - choice_store:function(){ 2750 + choice_store:function(ee){
2733 var th=this; 2751 var th=this;
  2752 + var ind=ee.currentTarget.dataset.ind;
  2753 + var bconfig = th.data.bconfig;
  2754 + console.log("男士水水水水水", bconfig);
  2755 + if (bconfig.is_sort_storage){
2734 wx.getLocation({ 2756 wx.getLocation({
2735 type: 'wgs84', 2757 type: 'wgs84',
2736 success: function (res) { 2758 success: function (res) {
2737 - console.log("GPS成功的回调是上面"); 2759 +
2738 th.data.lat = res.latitude; 2760 th.data.lat = res.latitude;
2739 th.data.lon = res.longitude; 2761 th.data.lon = res.longitude;
2740 th.data.is_get_local_ok = 1; 2762 th.data.is_get_local_ok = 1;
2741 th.setData({ is_gps: 1 }); 2763 th.setData({ is_gps: 1 });
  2764 + th.onShow();
2742 }, 2765 },
2743 fail: function (res) { 2766 fail: function (res) {
2744 - console.log("GPS失败的回调"); 2767 + th.onShow();
2745 if (res.errCode == 2) { 2768 if (res.errCode == 2) {
2746 - console.log("GPS失败的回调22222222222222222");  
2747 th.setData({ is_gps: 0 }); 2769 th.setData({ is_gps: 0 });
2748 - if (this.data.is_gps == 0) {  
2749 - console.log(this.data.is_gps, "GPS提示框");  
2750 - s.showWarning("请开启GPS定位", null, 1000, !1); 2770 + if (th.data.is_gps == 0) {
  2771 + s.showWarning("请开启GPS定位", null, 25000, !1);
2751 } 2772 }
2752 } else { 2773 } else {
2753 th.setData({ is_gps: "3" }); 2774 th.setData({ is_gps: "3" });
@@ -2756,17 +2777,20 @@ Page({ @@ -2756,17 +2777,20 @@ Page({
2756 th.data.is_get_local_ok = 1; 2777 th.data.is_get_local_ok = 1;
2757 } 2778 }
2758 }) 2779 })
2759 - 2780 + }
2760 this.setData({ 2781 this.setData({
  2782 + open_ind_store: ind,
2761 store:1, 2783 store:1,
2762 openSpecModal: !1, 2784 openSpecModal: !1,
2763 openSpecModal_pt: !1 2785 openSpecModal_pt: !1
2764 }) 2786 })
2765 }, 2787 },
2766 //关闭选择门店 2788 //关闭选择门店
2767 -close_popup:function(){ 2789 +close_popup:function(e){
  2790 +
2768 this.setData({ 2791 this.setData({
2769 - store: 0, choice_sort_store: 0,sort_store:0}) 2792 + store: 0, choice_sort_store: 0, sort_store: 0
  2793 + })
2770 }, 2794 },
2771 //选择更多门店 2795 //选择更多门店
2772 more_store:function(){ 2796 more_store:function(){
@@ -2799,8 +2823,32 @@ close_popup:function(){ @@ -2799,8 +2823,32 @@ close_popup:function(){
2799 }, 2823 },
2800 2824
2801 //确定def_pick为选择的门店 2825 //确定def_pick为选择的门店
2802 - sure_pick:function () { 2826 + sure_pick:function (e) {
2803 var th=this; var item=null; 2827 var th=this; var item=null;
  2828 + var openindstore = e.currentTarget.dataset.openindstore;
  2829 + console.log("加入购物车 还是立即购买,商品主页", openindstore);
  2830 + if (openindstore == 1) {
  2831 + console.log("加入购物车 ", openindstore);
  2832 + th.setData({
  2833 + openSpecModal: !0,
  2834 + openSpecModal_ind: openindstore, });
  2835 + } else if (openindstore == 2) {
  2836 + console.log("立即购买 ", openindstore);
  2837 + th.setData({
  2838 + openSpecModal: !0,
  2839 + openSpecModal_ind: openindstore, });
  2840 + } else {
  2841 + console.log("商品主页", openindstore);
  2842 + th.setData({
  2843 + store: 0, choice_sort_store: 0, sort_store: 0
  2844 + })
  2845 + }
  2846 +
  2847 +
  2848 +
  2849 +
  2850 +
  2851 +
2804 if(th.data.choice_sort_store==0 ){ 2852 if(th.data.choice_sort_store==0 ){
2805 var index=th.data.fir_pick_index; 2853 var index=th.data.fir_pick_index;
2806 if(th.data.is_show_sto_cat==1){ 2854 if(th.data.is_show_sto_cat==1){
pages/goods/goodsInfo/goodsInfo.wxml
@@ -43,7 +43,7 @@ @@ -43,7 +43,7 @@
43 </view> 43 </view>
44 <view class="xc-video-picture abs"> 44 <view class="xc-video-picture abs">
45 <view class="xc-video" data-vipi="0" bindtap="videopicture"> 45 <view class="xc-video" data-vipi="0" bindtap="videopicture">
46 - <view class=" {{videopicture==0 ? 'xc-video-button':'xc-video-buttons'}} {{videopicture==0 ? 'xc-sn':''}}"> 46 + <view class="{{videopicture==0 ? 'xc-video-button':'xc-video-buttons'}} {{videopicture==0 ? 'xc-sn':''}}">
47 视频 47 视频
48 </view> 48 </view>
49 </view> 49 </view>
@@ -308,7 +308,7 @@ @@ -308,7 +308,7 @@
308 <image class="stores-img" src="{{iurl}}/miniapp/images/stores.png"></image> 308 <image class="stores-img" src="{{iurl}}/miniapp/images/stores.png"></image>
309 <view class="fs28">选择门店</view> 309 <view class="fs28">选择门店</view>
310 </view> 310 </view>
311 - <view class="red_bb fs32" bindtap="choice_store"> 311 + <view class="red_bb fs32" bindtap="choice_store"data-ind="0">
312 更多门店 312 更多门店
313 <text class="bg_jj"></text> 313 <text class="bg_jj"></text>
314 </view> 314 </view>
@@ -320,7 +320,7 @@ @@ -320,7 +320,7 @@
320 <text class="fs32 xc-black3 shop_name">{{def_pick_store.pickup_name}}</text> 320 <text class="fs32 xc-black3 shop_name">{{def_pick_store.pickup_name}}</text>
321 321
322 </view> 322 </view>
323 - <view class="distance fs20"> 323 + <view class="distance fs20"wx:if="{{def_pick_store.distance!=null}}">
324 距离:{{filters.toFix(def_pick_store.distance,0)}}m 324 距离:{{filters.toFix(def_pick_store.distance,0)}}m
325 </view> 325 </view>
326 </view> 326 </view>
@@ -755,7 +755,7 @@ @@ -755,7 +755,7 @@
755 <view class="spec-goods"> 755 <view class="spec-goods">
756 <image class="wh100 spec-img xc-distance-bottom" src="{{data.original_img}}" binderror="pop_err_img" data-errorimg="data.original_img"></image> 756 <image class="wh100 spec-img xc-distance-bottom" src="{{data.original_img}}" binderror="pop_err_img" data-errorimg="data.original_img"></image>
757 <view class="spec-goods-info"> 757 <view class="spec-goods-info">
758 - <view class="spec-goods-name ellipsis-1">{{data.goods_name}}</view> 758 + <view class="spec-goods-name ellipsis-1">{{sele_g.goods_name}}</view>
759 <view class="flex ai_end xc-val-money"> 759 <view class="flex ai_end xc-val-money">
760 <view class="spec-goods-price" wx:if="{{prom_price==null}}"><text class="fs20">¥</text>{{sele_g.shop_price}}</view> 760 <view class="spec-goods-price" wx:if="{{prom_price==null}}"><text class="fs20">¥</text>{{sele_g.shop_price}}</view>
761 <view class="spec-goods-price" wx:else><text class="fs20">¥</text>{{prom_price}}</view> 761 <view class="spec-goods-price" wx:else><text class="fs20">¥</text>{{prom_price}}</view>
@@ -782,18 +782,18 @@ @@ -782,18 +782,18 @@
782 782
783 <view class="flex ai_end" wx:if="{{def_pick_store}}"> 783 <view class="flex ai_end" wx:if="{{def_pick_store}}">
784 <text class="fs28 xc-black3 shop_name">{{def_pick_store.pickup_name}}</text> 784 <text class="fs28 xc-black3 shop_name">{{def_pick_store.pickup_name}}</text>
785 - <view class="distance fs20 xc-ash"> 785 + <view class="distance fs20 xc-ash"wx:if="{{def_pick_store.distance!=null}}">
786 距离:{{filters.toFix(def_pick_store.distance,0)}}m 786 距离:{{filters.toFix(def_pick_store.distance,0)}}m
787 </view> 787 </view>
788 </view> 788 </view>
789 789
790 <!-- 没有门店的时候 --> 790 <!-- 没有门店的时候 -->
791 - <view class="flex" bindtap="choice_store" wx:else> 791 + <view class="flex" bindtap="choice_store"wx:else>
792 <image class="stores-img" src="{{iurl}}/miniapp/images/stores.png"></image> 792 <image class="stores-img" src="{{iurl}}/miniapp/images/stores.png"></image>
793 <view class="fs28">选择门店</view> 793 <view class="fs28">选择门店</view>
794 </view> 794 </view>
795 795
796 - <view class="red-co fs28" bindtap="choice_store"> 796 + <view class="red-co fs28" bindtap="choice_store" >
797 更多门店 797 更多门店
798 <text class="right-arrow"></text> 798 <text class="right-arrow"></text>
799 </view> 799 </view>
@@ -804,7 +804,7 @@ @@ -804,7 +804,7 @@
804 <view class="xc-goods-attribute"> 804 <view class="xc-goods-attribute">
805 <view hidden="{{ismend==1}}" class="spec-name">商品属性</view> 805 <view hidden="{{ismend==1}}" class="spec-name">商品属性</view>
806 <view hidden="{{ismend==1}}" class="flex"> 806 <view hidden="{{ismend==1}}" class="flex">
807 - <view class="spec_bt {{gid==item.goods_id?'act':''}}" bindtap="sele_spec" data-gid='item.goods_id' wx:for="{{sku_g}}" wx:key="sku_g"> 807 + <view class="spec_bt {{gid==item.goods_id?'act':''}}" bindtap="sele_spec" data-gid='{{item.goods_id}}' wx:for="{{sku_g}}" wx:key="sku_g">
808 {{item.gg}} 808 {{item.gg}}
809 </view> 809 </view>
810 </view> 810 </view>
@@ -834,8 +834,8 @@ @@ -834,8 +834,8 @@
834 <view class="spec-cart-btns"> 834 <view class="spec-cart-btns">
835 835
836 <block> 836 <block>
837 - <view wx:if="{{openSpecModal_ind==1}}" bindtap="addCart" class="spec-cart-btn yellow fs32" data-action="add">加入购物车</view>  
838 - <view wx:if="{{openSpecModal_ind==2}}" bindtap="addCart" class="spec-cart-btn spec-buy" data-action="buy">立即购买</view> 837 + <view wx:if="{{openSpecModal_ind==1}}" bindtap="addCart"data-openSpecModal_ind="{{openSpecModal_ind}}" class="spec-cart-btn yellow fs32" data-action="add">加入购物车</view>
  838 + <view wx:if="{{openSpecModal_ind==2}}" bindtap="addCart"data-openSpecModal_ind="{{openSpecModal_ind}}" class="spec-cart-btn spec-buy" data-action="buy">立即购买</view>
839 </block> 839 </block>
840 </view> 840 </view>
841 841
@@ -896,14 +896,14 @@ @@ -896,14 +896,14 @@
896 <view hidden="{{ismend==1}}" class="spec-name">商品属性</view> 896 <view hidden="{{ismend==1}}" class="spec-name">商品属性</view>
897 <block wx:if="{{is_normal==0}}"> 897 <block wx:if="{{is_normal==0}}">
898 <view hidden="{{ismend==1}}" class="flex"> 898 <view hidden="{{ismend==1}}" class="flex">
899 - <view class="spec_bt {{gid==item.goods_id?'act':''}}" bindtap="sele_spec" data-gid='item.goods_id' wx:for="{{sku_g}}" wx:key="sku_g">{{item.gg}} 899 + <view class="spec_bt {{gid==item.goods_id?'act':''}}" bindtap="sele_spec" data-gid='{{item.goods_id}}' wx:for="{{sku_g}}" wx:key="sku_g">{{item.gg}}
900 </view> 900 </view>
901 </view> 901 </view>
902 </block> 902 </block>
903 903
904 <block wx:else> 904 <block wx:else>
905 <view hidden="{{ismend==1}}" class="flex"> 905 <view hidden="{{ismend==1}}" class="flex">
906 - <view class="spec_bt {{gid==item.goods_id?'act':''}}" bindtap="sele_spec" data-gid='item.goods_id' wx:for="{{sku_g}}" wx:key="sku_g">{{item.gg}} 906 + <view class="spec_bt {{gid==item.goods_id?'act':''}}" bindtap="sele_spec" data-gid='{{item.goods_id}}' wx:for="{{sku_g}}" wx:key="sku_g">{{item.gg}}
907 </view> 907 </view>
908 </view> 908 </view>
909 </block> 909 </block>
@@ -1087,7 +1087,7 @@ @@ -1087,7 +1087,7 @@
1087 <view class="fs28 xc-black3 address_name">{{item.pickup_name}}</view> 1087 <view class="fs28 xc-black3 address_name">{{item.pickup_name}}</view>
1088 </view> 1088 </view>
1089 <view> 1089 <view>
1090 - <view class="distance fs20 address-val">距离:{{filters.toFix(item.distance,0)}}m</view> 1090 + <view class="distance fs20 address-val"wx:if="{{item.distance!=null}}">距离:{{filters.toFix(item.distance,0)}}m</view>
1091 </view> 1091 </view>
1092 </view> 1092 </view>
1093 <view class="fs20">地址:{{item.fulladdress}}</view> 1093 <view class="fs20">地址:{{item.fulladdress}}</view>
@@ -1112,7 +1112,7 @@ @@ -1112,7 +1112,7 @@
1112 <view class="fs28 xc-black3 address_name">{{item.pickup_name}}</view> 1112 <view class="fs28 xc-black3 address_name">{{item.pickup_name}}</view>
1113 </view> 1113 </view>
1114 <view> 1114 <view>
1115 - <view class="distance fs20 address-val">距离:{{filters.toFix(item.distance,0)}}m</view> 1115 + <view class="distance fs20 address-val"wx:if="{{item.distance!=null}}">距离:{{filters.toFix(item.distance,0)}}m</view>
1116 </view> 1116 </view>
1117 </view> 1117 </view>
1118 <view class="fs20">地址:{{item.fulladdress}}</view> 1118 <view class="fs20">地址:{{item.fulladdress}}</view>
@@ -1138,7 +1138,7 @@ @@ -1138,7 +1138,7 @@
1138 <view class="fs28 xc-black3 address_name">{{item.pickup_name}}</view> 1138 <view class="fs28 xc-black3 address_name">{{item.pickup_name}}</view>
1139 </view> 1139 </view>
1140 <view> 1140 <view>
1141 - <view class="distance fs20 address-val">距离:{{filters.toFix(item.distance,0)}}m</view> 1141 + <view class="distance fs20 address-val"wx:if="{{item.distance!=null}}">距离:{{filters.toFix(item.distance,0)}}m</view>
1142 </view> 1142 </view>
1143 </view> 1143 </view>
1144 <view class="fs20">地址:{{item.fulladdress}}</view> 1144 <view class="fs20">地址:{{item.fulladdress}}</view>
@@ -1152,7 +1152,8 @@ @@ -1152,7 +1152,8 @@
1152 <!-- 门店列表底部 --> 1152 <!-- 门店列表底部 -->
1153 <view class="store-bottom-frame"> 1153 <view class="store-bottom-frame">
1154 <view class="store-bottom flex-vertical-between"> 1154 <view class="store-bottom flex-vertical-between">
1155 - <view class="determine red-b fs28 white t-c" bindtap="sure_pick">确定</view> 1155 + <view class="determine red-b fs28 white t-c" bindtap="sure_pick"
  1156 + data-openindstore="{{open_ind_store}}">确定</view>
1156 <view class="default t-c fs28" bindtap="set_def_pick">设为默认</view> 1157 <view class="default t-c fs28" bindtap="set_def_pick">设为默认</view>
1157 </view> 1158 </view>
1158 </view> 1159 </view>
pages/goods/goodsInfo/goodsInfo.wxss
@@ -2348,7 +2348,7 @@ height: 70%; @@ -2348,7 +2348,7 @@ height: 70%;
2348 } 2348 }
2349 .store-list .store_choose{ 2349 .store-list .store_choose{
2350 width: 100%; 2350 width: 100%;
2351 - height: 125rpx; 2351 + height: 120rpx;
2352 line-height: 125rpx; 2352 line-height: 125rpx;
2353 border-bottom: 1rpx solid #eee; 2353 border-bottom: 1rpx solid #eee;
2354 2354
@@ -2361,10 +2361,10 @@ padding-left: 20rpx; @@ -2361,10 +2361,10 @@ padding-left: 20rpx;
2361 2361
2362 } 2362 }
2363 .xc-hook{ 2363 .xc-hook{
2364 - width: 33rpx;  
2365 - height: 33rpx; 2364 + width: 35rpx;
  2365 + height: 35rpx;
2366 transform: rotate(-145deg); 2366 transform: rotate(-145deg);
2367 -line-height: 35rpx; 2367 +line-height: 37rpx;
2368 text-align: center; 2368 text-align: center;
2369 } 2369 }
2370 .xc-hooks{ 2370 .xc-hooks{
@@ -2392,7 +2392,7 @@ line-height: 30rpx; @@ -2392,7 +2392,7 @@ line-height: 30rpx;
2392 .store-bottom{ 2392 .store-bottom{
2393 width: 85%; 2393 width: 85%;
2394 margin: auto; 2394 margin: auto;
2395 - height: 90rpx; 2395 + height: 97rpx;
2396 2396
2397 2397
2398 } 2398 }
@@ -2411,10 +2411,8 @@ line-height: 30rpx; @@ -2411,10 +2411,8 @@ line-height: 30rpx;
2411 } 2411 }
2412 .store-bottom-frame{ 2412 .store-bottom-frame{
2413 width: 95%; 2413 width: 95%;
2414 - border-top: 3rpx solid #eee;  
2415 margin: auto; 2414 margin: auto;
2416 - margin-top: 10rpx;  
2417 - 2415 +
2418 } 2416 }
2419 /* 门店分类列表 */ 2417 /* 门店分类列表 */
2420 .sort_store_list{ 2418 .sort_store_list{