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 224 is_get_local_ok:0,//获取坐标是否完成
225 225 region_name:"门店分类",//区域的名字
226 226 is_gps:1,
  227 + open_ind_store:0,//哪里打开的门店列表的控制属性
227 228 },
228 229  
229 230 //------初始化加载----------
... ... @@ -256,28 +257,7 @@ Page({
256 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 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 684 },
679 685  
680 686 //------------加入购物车--------------
681   - addCart: function(t) {
  687 + addCart: function(t) {
682 688 var th=this;
  689 + var ind = t.currentTarget.dataset.openSpecModal_ind;
  690 + th.setData({open_ind_store: ind});
683 691 //如果是秒杀的话,要看redis够不够
684 692 if(this.data.prom_type==1){
685 693 this.getactLen(function (num) {
... ... @@ -924,8 +932,10 @@ Page({
924 932 });
925 933 },
926 934 openSpecModel: function(t) {
  935 + var open_store = t.currentTarget.dataset.ind;
  936 + console.log(t,"加入购物车头",open_store);
927 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 941 var user_info=getApp().globalData.userInfo;
... ... @@ -1127,7 +1137,14 @@ Page({
1127 1137  
1128 1138 //-----------选择属性的按钮事件----------
1129 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 1150 get_sto(e) {
... ... @@ -2674,6 +2691,7 @@ Page({
2674 2691 tt();
2675 2692 },
2676 2693 fail: function (res) {
  2694 +
2677 2695 ee.data.share_goods_img= "../../../images/share/default_g_img.gif"; //分享的图片不能用网络的
2678 2696 tt();
2679 2697 }
... ... @@ -2729,25 +2747,28 @@ Page({
2729 2747 })
2730 2748 },
2731 2749 // 选择门店
2732   - choice_store:function(){
  2750 + choice_store:function(ee){
2733 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 2756 wx.getLocation({
2735 2757 type: 'wgs84',
2736 2758 success: function (res) {
2737   - console.log("GPS成功的回调是上面");
  2759 +
2738 2760 th.data.lat = res.latitude;
2739 2761 th.data.lon = res.longitude;
2740 2762 th.data.is_get_local_ok = 1;
2741 2763 th.setData({ is_gps: 1 });
  2764 + th.onShow();
2742 2765 },
2743 2766 fail: function (res) {
2744   - console.log("GPS失败的回调");
  2767 + th.onShow();
2745 2768 if (res.errCode == 2) {
2746   - console.log("GPS失败的回调22222222222222222");
2747 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 2773 } else {
2753 2774 th.setData({ is_gps: "3" });
... ... @@ -2756,17 +2777,20 @@ Page({
2756 2777 th.data.is_get_local_ok = 1;
2757 2778 }
2758 2779 })
2759   -
  2780 + }
2760 2781 this.setData({
  2782 + open_ind_store: ind,
2761 2783 store:1,
2762 2784 openSpecModal: !1,
2763 2785 openSpecModal_pt: !1
2764 2786 })
2765 2787 },
2766 2788 //关闭选择门店
2767   -close_popup:function(){
  2789 +close_popup:function(e){
  2790 +
2768 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 2796 more_store:function(){
... ... @@ -2799,8 +2823,32 @@ close_popup:function(){
2799 2823 },
2800 2824  
2801 2825 //确定def_pick为选择的门店
2802   - sure_pick:function () {
  2826 + sure_pick:function (e) {
2803 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 2852 if(th.data.choice_sort_store==0 ){
2805 2853 var index=th.data.fir_pick_index;
2806 2854 if(th.data.is_show_sto_cat==1){
... ...
pages/goods/goodsInfo/goodsInfo.wxml
... ... @@ -43,7 +43,7 @@
43 43 </view>
44 44 <view class="xc-video-picture abs">
45 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 48 </view>
49 49 </view>
... ... @@ -308,7 +308,7 @@
308 308 <image class="stores-img" src="{{iurl}}/miniapp/images/stores.png"></image>
309 309 <view class="fs28">选择门店</view>
310 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 313 <text class="bg_jj"></text>
314 314 </view>
... ... @@ -320,7 +320,7 @@
320 320 <text class="fs32 xc-black3 shop_name">{{def_pick_store.pickup_name}}</text>
321 321  
322 322 </view>
323   - <view class="distance fs20">
  323 + <view class="distance fs20"wx:if="{{def_pick_store.distance!=null}}">
324 324 距离:{{filters.toFix(def_pick_store.distance,0)}}m
325 325 </view>
326 326 </view>
... ... @@ -755,7 +755,7 @@
755 755 <view class="spec-goods">
756 756 <image class="wh100 spec-img xc-distance-bottom" src="{{data.original_img}}" binderror="pop_err_img" data-errorimg="data.original_img"></image>
757 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 759 <view class="flex ai_end xc-val-money">
760 760 <view class="spec-goods-price" wx:if="{{prom_price==null}}"><text class="fs20">¥</text>{{sele_g.shop_price}}</view>
761 761 <view class="spec-goods-price" wx:else><text class="fs20">¥</text>{{prom_price}}</view>
... ... @@ -782,18 +782,18 @@
782 782  
783 783 <view class="flex ai_end" wx:if="{{def_pick_store}}">
784 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 786 距离:{{filters.toFix(def_pick_store.distance,0)}}m
787 787 </view>
788 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 792 <image class="stores-img" src="{{iurl}}/miniapp/images/stores.png"></image>
793 793 <view class="fs28">选择门店</view>
794 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 798 <text class="right-arrow"></text>
799 799 </view>
... ... @@ -804,7 +804,7 @@
804 804 <view class="xc-goods-attribute">
805 805 <view hidden="{{ismend==1}}" class="spec-name">商品属性</view>
806 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 808 {{item.gg}}
809 809 </view>
810 810 </view>
... ... @@ -834,8 +834,8 @@
834 834 <view class="spec-cart-btns">
835 835  
836 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 839 </block>
840 840 </view>
841 841  
... ... @@ -896,14 +896,14 @@
896 896 <view hidden="{{ismend==1}}" class="spec-name">商品属性</view>
897 897 <block wx:if="{{is_normal==0}}">
898 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 900 </view>
901 901 </view>
902 902 </block>
903 903  
904 904 <block wx:else>
905 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 907 </view>
908 908 </view>
909 909 </block>
... ... @@ -1087,7 +1087,7 @@
1087 1087 <view class="fs28 xc-black3 address_name">{{item.pickup_name}}</view>
1088 1088 </view>
1089 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 1091 </view>
1092 1092 </view>
1093 1093 <view class="fs20">地址:{{item.fulladdress}}</view>
... ... @@ -1112,7 +1112,7 @@
1112 1112 <view class="fs28 xc-black3 address_name">{{item.pickup_name}}</view>
1113 1113 </view>
1114 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 1116 </view>
1117 1117 </view>
1118 1118 <view class="fs20">地址:{{item.fulladdress}}</view>
... ... @@ -1138,7 +1138,7 @@
1138 1138 <view class="fs28 xc-black3 address_name">{{item.pickup_name}}</view>
1139 1139 </view>
1140 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 1142 </view>
1143 1143 </view>
1144 1144 <view class="fs20">地址:{{item.fulladdress}}</view>
... ... @@ -1152,7 +1152,8 @@
1152 1152 <!-- 门店列表底部 -->
1153 1153 <view class="store-bottom-frame">
1154 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 1157 <view class="default t-c fs28" bindtap="set_def_pick">设为默认</view>
1157 1158 </view>
1158 1159 </view>
... ...
pages/goods/goodsInfo/goodsInfo.wxss
... ... @@ -2348,7 +2348,7 @@ height: 70%;
2348 2348 }
2349 2349 .store-list .store_choose{
2350 2350 width: 100%;
2351   - height: 125rpx;
  2351 + height: 120rpx;
2352 2352 line-height: 125rpx;
2353 2353 border-bottom: 1rpx solid #eee;
2354 2354  
... ... @@ -2361,10 +2361,10 @@ padding-left: 20rpx;
2361 2361  
2362 2362 }
2363 2363 .xc-hook{
2364   - width: 33rpx;
2365   - height: 33rpx;
  2364 + width: 35rpx;
  2365 + height: 35rpx;
2366 2366 transform: rotate(-145deg);
2367   -line-height: 35rpx;
  2367 +line-height: 37rpx;
2368 2368 text-align: center;
2369 2369 }
2370 2370 .xc-hooks{
... ... @@ -2392,7 +2392,7 @@ line-height: 30rpx;
2392 2392 .store-bottom{
2393 2393 width: 85%;
2394 2394 margin: auto;
2395   - height: 90rpx;
  2395 + height: 97rpx;
2396 2396  
2397 2397  
2398 2398 }
... ... @@ -2411,10 +2411,8 @@ line-height: 30rpx;
2411 2411 }
2412 2412 .store-bottom-frame{
2413 2413 width: 95%;
2414   - border-top: 3rpx solid #eee;
2415 2414 margin: auto;
2416   - margin-top: 10rpx;
2417   -
  2415 +
2418 2416 }
2419 2417 /* 门店分类列表 */
2420 2418 .sort_store_list{
... ...