Commit a4ededa5173b24094bd237f8fbd074ed0252fb99
1 parent
e644836f
1. OA单和 12点优化的内容
Showing
54 changed files
with
1689 additions
and
492 deletions
app.wxss
| @@ -293,7 +293,6 @@ justify-content:space-around; | @@ -293,7 +293,6 @@ justify-content:space-around; | ||
| 293 | 293 | ||
| 294 | 294 | ||
| 295 | 295 | ||
| 296 | - | ||
| 297 | /* 7.26 */ | 296 | /* 7.26 */ |
| 298 | .white{ | 297 | .white{ |
| 299 | color: #fff; | 298 | color: #fff; |
| @@ -413,4 +412,5 @@ background: #ffe3e2; | @@ -413,4 +412,5 @@ background: #ffe3e2; | ||
| 413 | 412 | ||
| 414 | .lh1 { | 413 | .lh1 { |
| 415 | line-height: 1; | 414 | line-height: 1; |
| 416 | -} | ||
| 417 | \ No newline at end of file | 415 | \ No newline at end of file |
| 416 | +} | ||
| 417 | + |
components/diy_searchbox/diy_searchbox.js
| @@ -5,7 +5,6 @@ var t = getApp(), | @@ -5,7 +5,6 @@ var t = getApp(), | ||
| 5 | Component({ | 5 | Component({ |
| 6 | properties: { | 6 | properties: { |
| 7 | // 这里定义了innerText属性,属性值可以在组件使用时指定 | 7 | // 这里定义了innerText属性,属性值可以在组件使用时指定 |
| 8 | - | ||
| 9 | object: { | 8 | object: { |
| 10 | type: Object, | 9 | type: Object, |
| 11 | value: null, | 10 | value: null, |
| @@ -15,19 +14,49 @@ Component({ | @@ -15,19 +14,49 @@ Component({ | ||
| 15 | // 这里是一些组件内部数据 | 14 | // 这里是一些组件内部数据 |
| 16 | yc:false, | 15 | yc:false, |
| 17 | imghost: o.imghost, | 16 | imghost: o.imghost, |
| 18 | - someData: {} | 17 | + someData: {}, |
| 18 | + first:1, | ||
| 19 | + inputShowed:1, | ||
| 20 | + inputval:'在店铺内搜索', | ||
| 21 | + keyword:'', | ||
| 19 | }, | 22 | }, |
| 20 | ready: function() { | 23 | ready: function() { |
| 21 | - console.log("ready"); | 24 | + var th=this; |
| 25 | + getApp().getConfig2(function(e) { | ||
| 26 | + //看有没有热搜 | ||
| 27 | + if(e.hot_keywords) | ||
| 28 | + th.setData({keyword:e.hot_keywords}); | ||
| 29 | + }) | ||
| 22 | }, | 30 | }, |
| 23 | methods: { | 31 | methods: { |
| 24 | //智能跳转 | 32 | //智能跳转 |
| 25 | go_url:function (e) { | 33 | go_url:function (e) { |
| 26 | var url=e.currentTarget.dataset.url; | 34 | var url=e.currentTarget.dataset.url; |
| 27 | getApp().goto(url); | 35 | getApp().goto(url); |
| 28 | - } | ||
| 29 | - | ||
| 30 | - | ||
| 31 | - | 36 | + }, |
| 37 | + click_sear:function(){ | ||
| 38 | + //如果搜索的单词为空的时候,就要跳到搜索页 | ||
| 39 | + if(this.data.keyword!=''){ | ||
| 40 | + getApp().goto("/pages/goods/search/search"); | ||
| 41 | + return false; | ||
| 42 | + } | ||
| 43 | + this.setData({first:0,inputShowed:1,inputval:''}); | ||
| 44 | + }, | ||
| 45 | + | ||
| 46 | + onblur:function(){ | ||
| 47 | + var val=this.data.inputval; | ||
| 48 | + if(val==''){ | ||
| 49 | + this.setData({first:1,}); | ||
| 50 | + } | ||
| 51 | + }, | ||
| 52 | + set_input:function(e){ | ||
| 53 | + var val=e.detail.value; | ||
| 54 | + this.setData({inputval:val}); | ||
| 55 | + }, | ||
| 56 | + sear:function(){ | ||
| 57 | + var url="/pages/goods/search/search?s_key="+this.data.inputval; | ||
| 58 | + getApp().goto(url); | ||
| 59 | + } | ||
| 60 | + | ||
| 32 | } | 61 | } |
| 33 | }) | 62 | }) |
| 34 | \ No newline at end of file | 63 | \ No newline at end of file |
components/diy_searchbox/diy_searchbox.wxml
| @@ -2,12 +2,22 @@ | @@ -2,12 +2,22 @@ | ||
| 2 | <block wx:if="{{object.style==1}}"> | 2 | <block wx:if="{{object.style==1}}"> |
| 3 | <view class="{{object.is_top==1?'abs_top':''}}"> | 3 | <view class="{{object.is_top==1?'abs_top':''}}"> |
| 4 | <view class='ss' > | 4 | <view class='ss' > |
| 5 | - <view bindtap='go_url' data-url="/pages/goods/search/search" class="s1_gk_a1"> | ||
| 6 | - <view class='s_ge'> | ||
| 7 | - <image src='{{imghost}}/miniapp/images/search.png'></image> | ||
| 8 | - <text>在店铺内搜索</text> | 5 | + <view bindtap='click_sear' class="s1_gk_a1" wx:if="{{first}}"> |
| 6 | + <view class='s_ge'> | ||
| 7 | + <image src='{{imghost}}/miniapp/images/search.png'></image> | ||
| 8 | + <text>在店铺内搜索</text> | ||
| 9 | + </view> | ||
| 9 | </view> | 10 | </view> |
| 11 | + <!-- 响应搜索事件 --> | ||
| 12 | + <view class="s1_gk_a1" wx:else> | ||
| 13 | + <view class='s_ge flex'> | ||
| 14 | + <image class="find_img" src='{{imghost}}/miniapp/images/search.png' bindtap='sear'></image> | ||
| 15 | + <input id="find_inp" class="find_inp" value="" | ||
| 16 | + bindconfirm="sear" bindinput='set_input' focus="{{inputShowed}}" bindblur="onblur" /> | ||
| 17 | + </view> | ||
| 10 | </view> | 18 | </view> |
| 19 | + | ||
| 20 | + | ||
| 11 | </view> | 21 | </view> |
| 12 | </view> | 22 | </view> |
| 13 | <view wx:if="{{object.is_top==1}}" style="height: 120rpx;"></view> | 23 | <view wx:if="{{object.is_top==1}}" style="height: 120rpx;"></view> |
| @@ -24,10 +34,15 @@ | @@ -24,10 +34,15 @@ | ||
| 24 | </view> | 34 | </view> |
| 25 | 35 | ||
| 26 | <view class='s2_cen' style='background-color:{{object.inner_bgcolor}}'> | 36 | <view class='s2_cen' style='background-color:{{object.inner_bgcolor}}'> |
| 27 | - <navigator url="/pages/goods/search/search" class="s1_gk_a2"> | ||
| 28 | - <image src='/public/static/images/model/select.png'></image> | ||
| 29 | - <text style='color:{{object.word_color?object.word_color:"#fff"}}'>在店铺内搜索</text> | 37 | + <navigator wx:if="{{first}}" bindtap='click_sear' class="s1_gk_a2 flex" style="height: 100%;"> |
| 38 | + <image src='/public/static/images/model/select.png'></image> | ||
| 39 | + <text style='color:{{object.word_color?object.word_color:"#fff"}}'>在店铺内搜索</text> | ||
| 30 | </navigator> | 40 | </navigator> |
| 41 | + <navigator wx:else class="s1_gk_a2 flex" style="height: 100%;"> | ||
| 42 | + <image src='/public/static/images/model/select.png' bindtap='sear'></image> | ||
| 43 | + <input id="find_inp" class="find_inp2" value="" | ||
| 44 | + bindconfirm="sear" bindinput='set_input' focus="{{inputShowed}}" bindblur="onblur" /> | ||
| 45 | + </navigator> | ||
| 31 | </view> | 46 | </view> |
| 32 | 47 | ||
| 33 | <view class='s2_right'> | 48 | <view class='s2_right'> |
components/diy_searchbox/diy_searchbox.wxss
| @@ -60,9 +60,6 @@ | @@ -60,9 +60,6 @@ | ||
| 60 | height: 30rpx; | 60 | height: 30rpx; |
| 61 | margin-left: 10rpx; | 61 | margin-left: 10rpx; |
| 62 | margin-right: 4rpx; | 62 | margin-right: 4rpx; |
| 63 | - margin-bottom:-6rpx; | ||
| 64 | -margin-top:20rpx; | ||
| 65 | - | ||
| 66 | } | 63 | } |
| 67 | 64 | ||
| 68 | .s1_gk_a1{ | 65 | .s1_gk_a1{ |
| @@ -83,4 +80,9 @@ margin-top:20rpx; | @@ -83,4 +80,9 @@ margin-top:20rpx; | ||
| 83 | 80 | ||
| 84 | .abs_top2{ | 81 | .abs_top2{ |
| 85 | position: fixed; z-index: 10; | 82 | position: fixed; z-index: 10; |
| 86 | -} | ||
| 87 | \ No newline at end of file | 83 | \ No newline at end of file |
| 84 | +} | ||
| 85 | + | ||
| 86 | +.flex{ display: flex; align-items: center;} | ||
| 87 | +.find_img{margin: 0 20rpx; } | ||
| 88 | +.find_inp{text-align: left; width: 620rpx;} | ||
| 89 | +.find_inp2{text-align: left; width: 520rpx;} | ||
| 88 | \ No newline at end of file | 90 | \ No newline at end of file |
components/goods_list/goods_list.js
| @@ -62,7 +62,7 @@ Component({ | @@ -62,7 +62,7 @@ Component({ | ||
| 62 | //--- 判断是等级会员,且在有效期范围内 --- | 62 | //--- 判断是等级会员,且在有效期范围内 --- |
| 63 | if (user.card_field && now < end) { | 63 | if (user.card_field && now < end) { |
| 64 | var card_name = ob.name_map.get(user.card_field); | 64 | var card_name = ob.name_map.get(user.card_field); |
| 65 | - // if (card_name.length > 6) card_name = card_name.substring(0, 7); | 65 | + if (card_name.length > 6) card_name = card_name.substring(0, 6); |
| 66 | th.setData({ | 66 | th.setData({ |
| 67 | card_field: user.card_field, | 67 | card_field: user.card_field, |
| 68 | card_name: card_name, | 68 | card_name: card_name, |
| @@ -166,7 +166,6 @@ Component({ | @@ -166,7 +166,6 @@ Component({ | ||
| 166 | card_name_map.set(name, plusCard[i].CardName); | 166 | card_name_map.set(name, plusCard[i].CardName); |
| 167 | new_arr.push(plusCard[i]); | 167 | new_arr.push(plusCard[i]); |
| 168 | 168 | ||
| 169 | - | ||
| 170 | } | 169 | } |
| 171 | } | 170 | } |
| 172 | var ob = { | 171 | var ob = { |
images/share/hui_hear_pic.png
images/share/mackground.png
images/share/s_gou.png
packageA/pages/prom_list/prom_list.js
| @@ -770,7 +770,9 @@ Page({ | @@ -770,7 +770,9 @@ Page({ | ||
| 770 | data: { | 770 | data: { |
| 771 | store_id: o.stoid, | 771 | store_id: o.stoid, |
| 772 | is_show: 1, | 772 | is_show: 1, |
| 773 | - pageSize: 1000 | 773 | + pageSize: 1000, |
| 774 | + orderField:"sort", | ||
| 775 | + orderType:'asc', | ||
| 774 | }, | 776 | }, |
| 775 | success: function(ee) { | 777 | success: function(ee) { |
| 776 | if (ee.data.code == 0) { | 778 | if (ee.data.code == 0) { |
| @@ -795,12 +797,12 @@ Page({ | @@ -795,12 +797,12 @@ Page({ | ||
| 795 | //----要进行门店分组-------- | 797 | //----要进行门店分组-------- |
| 796 | for (var i = 0; i < sto_arr.length; i++) { | 798 | for (var i = 0; i < sto_arr.length; i++) { |
| 797 | //找一下这个门店有没有在分类数组内 | 799 | //找一下这个门店有没有在分类数组内 |
| 798 | - var find2 = 0, | ||
| 799 | - find2name = ""; | 800 | + var find2 = 0, find2name = "",sort=0; |
| 800 | for (var m = 0; m < sto_cate.length; m++) { | 801 | for (var m = 0; m < sto_cate.length; m++) { |
| 801 | if (sto_arr[i].category_id == sto_cate[m].cat_id) { | 802 | if (sto_arr[i].category_id == sto_cate[m].cat_id) { |
| 802 | find2 = sto_cate[m].cat_id; | 803 | find2 = sto_cate[m].cat_id; |
| 803 | find2name = sto_cate[m].cat_name; | 804 | find2name = sto_cate[m].cat_name; |
| 805 | + sort=sto_cate[m].sort; | ||
| 804 | break; | 806 | break; |
| 805 | } | 807 | } |
| 806 | } | 808 | } |
| @@ -822,6 +824,7 @@ Page({ | @@ -822,6 +824,7 @@ Page({ | ||
| 822 | var item = { | 824 | var item = { |
| 823 | cat_id: find2, | 825 | cat_id: find2, |
| 824 | name: find2name, | 826 | name: find2name, |
| 827 | + sort:sort, | ||
| 825 | s_arr: arr0 | 828 | s_arr: arr0 |
| 826 | }; | 829 | }; |
| 827 | newarr.push(item); | 830 | newarr.push(item); |
| @@ -837,6 +840,7 @@ Page({ | @@ -837,6 +840,7 @@ Page({ | ||
| 837 | var item = { | 840 | var item = { |
| 838 | cat_id: find2, | 841 | cat_id: find2, |
| 839 | name: find2name, | 842 | name: find2name, |
| 843 | + sort:sort, | ||
| 840 | s_arr: arr0 | 844 | s_arr: arr0 |
| 841 | }; | 845 | }; |
| 842 | newarr.push(item); | 846 | newarr.push(item); |
| @@ -845,6 +849,18 @@ Page({ | @@ -845,6 +849,18 @@ Page({ | ||
| 845 | } | 849 | } |
| 846 | } | 850 | } |
| 847 | } | 851 | } |
| 852 | + | ||
| 853 | + //门店分类要排序下 | ||
| 854 | + function compare(property){ | ||
| 855 | + return function(a,b){ | ||
| 856 | + var value1 = a[property]; | ||
| 857 | + var value2 = b[property]; | ||
| 858 | + return value1 - value2; | ||
| 859 | + } | ||
| 860 | + } | ||
| 861 | + if(newarr.length>0) | ||
| 862 | + newarr.sort(compare("sort")); | ||
| 863 | + | ||
| 848 | 864 | ||
| 849 | //----安排其他的分类----- | 865 | //----安排其他的分类----- |
| 850 | if (qita.length > 0) { | 866 | if (qita.length > 0) { |
| @@ -1135,7 +1151,7 @@ Page({ | @@ -1135,7 +1151,7 @@ Page({ | ||
| 1135 | 1151 | ||
| 1136 | if (bconfig.is_sort_storage) { | 1152 | if (bconfig.is_sort_storage) { |
| 1137 | wx.getLocation({ | 1153 | wx.getLocation({ |
| 1138 | - type: 'wgs84', | 1154 | + type: 'gcj02', |
| 1139 | success: function(res) { | 1155 | success: function(res) { |
| 1140 | 1156 | ||
| 1141 | th.data.lat = res.latitude; | 1157 | th.data.lat = res.latitude; |
| @@ -1464,7 +1480,7 @@ Page({ | @@ -1464,7 +1480,7 @@ Page({ | ||
| 1464 | var e = th.data.bconfig; | 1480 | var e = th.data.bconfig; |
| 1465 | if (e.is_sort_storage) { | 1481 | if (e.is_sort_storage) { |
| 1466 | wx.getLocation({ | 1482 | wx.getLocation({ |
| 1467 | - type: 'wgs84', | 1483 | + type: 'gcj02', |
| 1468 | success: function(res) { | 1484 | success: function(res) { |
| 1469 | th.data.lat = res.latitude; | 1485 | th.data.lat = res.latitude; |
| 1470 | th.data.lon = res.longitude; | 1486 | th.data.lon = res.longitude; |
pages/cart/cart2/cart2.js
| @@ -46,7 +46,9 @@ Page({ | @@ -46,7 +46,9 @@ Page({ | ||
| 46 | bn_exp_type:1, //0是物流 1自提 | 46 | bn_exp_type:1, //0是物流 1自提 |
| 47 | bn_pick:0, //选择的门店 | 47 | bn_pick:0, //选择的门店 |
| 48 | bn_pickname: "", //选择的门店名称 | 48 | bn_pickname: "", //选择的门店名称 |
| 49 | - bn_t_exp_t:0, //判断商品和门店一起决定的物流自提的方式0 都可以 1自提 2物流 | 49 | + bn_t_exp_t:0, //判断商品和门店一起决定的物流自提的方式0 都可以 1自提 2物流 |
| 50 | + | ||
| 51 | + bn_plus_cut_price:0, //显示等级卡会优惠多少钱 | ||
| 50 | /*------------------------*/ | 52 | /*------------------------*/ |
| 51 | user_addr:null,//物流 | 53 | user_addr:null,//物流 |
| 52 | userinfo:null, //获取会员 | 54 | userinfo:null, //获取会员 |
| @@ -105,7 +107,11 @@ Page({ | @@ -105,7 +107,11 @@ Page({ | ||
| 105 | //-- order_prom_list -- | 107 | //-- order_prom_list -- |
| 106 | order_prom_list_cart:null, | 108 | order_prom_list_cart:null, |
| 107 | 109 | ||
| 108 | - ispt_goods:0, //是否平摊至单品,0要平摊 1不平摊 | 110 | + ispt_goods:0, //是否平摊至单品,0要平摊 1不平摊 |
| 111 | + rank_switch:0, //是不是开同等级卡 | ||
| 112 | + show_card:null, //显示的等级卡 | ||
| 113 | + card_name:'', //显示的卡的名称 | ||
| 114 | + card_cut_price:null,//减价多少钱 | ||
| 109 | 115 | ||
| 110 | }, | 116 | }, |
| 111 | onLoad: function(t) { | 117 | onLoad: function(t) { |
| @@ -113,7 +119,7 @@ Page({ | @@ -113,7 +119,7 @@ Page({ | ||
| 113 | wx.setNavigationBarTitle({ title: "填写订单",}) | 119 | wx.setNavigationBarTitle({ title: "填写订单",}) |
| 114 | var th = this; this.setData({ is_b_now: t.is_bnow == undefined ? 0 : t.is_bnow,}); | 120 | var th = this; this.setData({ is_b_now: t.is_bnow == undefined ? 0 : t.is_bnow,}); |
| 115 | th.data.param=t; | 121 | th.data.param=t; |
| 116 | - | 122 | + |
| 117 | //清空is_pick_up | 123 | //清空is_pick_up |
| 118 | getApp().request.put("/api/weshop/useraddress/updatePickUp", { | 124 | getApp().request.put("/api/weshop/useraddress/updatePickUp", { |
| 119 | data: {user_id: getApp().globalData.user_id, is_pickup: 0}, | 125 | data: {user_id: getApp().globalData.user_id, is_pickup: 0}, |
| @@ -121,15 +127,7 @@ Page({ | @@ -121,15 +127,7 @@ Page({ | ||
| 121 | } | 127 | } |
| 122 | }); | 128 | }); |
| 123 | 129 | ||
| 124 | - //先获取是否有关闭使用优惠券 | ||
| 125 | - getApp().getConfig2(function (ee) { | ||
| 126 | - var json_d = JSON.parse(ee.switch_list); | ||
| 127 | - th.data.ispt_goods=json_d.ispt_goods; //是不是平摊到单品的控制参数赋值 | ||
| 128 | - th.setData({ is_close_quan: json_d.is_close_quan,sales_rules:ee.sales_rules}); | ||
| 129 | - //-----先获取物流,再获取用户信息,再展示页面----- | ||
| 130 | - th.get_wuliu(th.get_info(th.show_page)); | ||
| 131 | - }) | ||
| 132 | - | 130 | + |
| 133 | }, | 131 | }, |
| 134 | onUnload: function () { this.setData({ isclose: 1 })}, | 132 | onUnload: function () { this.setData({ isclose: 1 })}, |
| 135 | onHide: function () { | 133 | onHide: function () { |
| @@ -155,7 +153,6 @@ Page({ | @@ -155,7 +153,6 @@ Page({ | ||
| 155 | console.log("getuser_addr") | 153 | console.log("getuser_addr") |
| 156 | console.log(ie) | 154 | console.log(ie) |
| 157 | 155 | ||
| 158 | - | ||
| 159 | //地址切换要把包邮券清空 | 156 | //地址切换要把包邮券清空 |
| 160 | if( !th.data.user_addr || th.data.user_addr.address_id!=ie.address_id){ | 157 | if( !th.data.user_addr || th.data.user_addr.address_id!=ie.address_id){ |
| 161 | var using_quan=th.data.using_quan; | 158 | var using_quan=th.data.using_quan; |
| @@ -209,6 +206,57 @@ Page({ | @@ -209,6 +206,57 @@ Page({ | ||
| 209 | getApp().globalData.is_cart2_old=0; | 206 | getApp().globalData.is_cart2_old=0; |
| 210 | } | 207 | } |
| 211 | } | 208 | } |
| 209 | + | ||
| 210 | + //先获取是否有关闭使用优惠券 | ||
| 211 | + getApp().getConfig2(function (ee) { | ||
| 212 | + var json_d = JSON.parse(ee.switch_list); | ||
| 213 | + th.data.ispt_goods=json_d.ispt_goods; //是不是平摊到单品的控制参数赋值 | ||
| 214 | + th.setData({ is_close_quan: json_d.is_close_quan,sales_rules:ee.sales_rules,rank_switch:json_d.rank_switch}); | ||
| 215 | + | ||
| 216 | + var rank_switch=json_d.rank_switch; | ||
| 217 | + var max_price=-1; | ||
| 218 | + var show_card=null; | ||
| 219 | + var name=""; | ||
| 220 | + //如果有开等级卡的时候, | ||
| 221 | + //因为都是调接口,要返回在计算 | ||
| 222 | + if(rank_switch==2){ | ||
| 223 | + //-- 获取所有的等级卡, -- | ||
| 224 | + getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?storeId=" + os.stoid, | ||
| 225 | + {}).then(res => { | ||
| 226 | + if(res.data.code==0){ | ||
| 227 | + var plusCard = res.data.data; | ||
| 228 | + //-- 循环判断,拿到最贵的那张卡 -- | ||
| 229 | + for(var ih in plusCard){ | ||
| 230 | + if(plusCard[ih].IsStopBuy == true){ continue; } | ||
| 231 | + if(max_price<0){ | ||
| 232 | + max_price=plusCard[ih].CardFee; | ||
| 233 | + name='card'+plusCard[ih]['CorrPrice']; | ||
| 234 | + show_card=plusCard[ih]; | ||
| 235 | + }else{ | ||
| 236 | + if(max_price<plusCard[ih].CardFee){ | ||
| 237 | + max_price=plusCard[ih].CardFee; | ||
| 238 | + name='card'+plusCard[ih]['CorrPrice']; | ||
| 239 | + show_card=plusCard[ih]; | ||
| 240 | + } | ||
| 241 | + } | ||
| 242 | + } | ||
| 243 | + | ||
| 244 | + if(show_card){ | ||
| 245 | + name=name.toLowerCase(); | ||
| 246 | + th.setData({card_name:name,show_card:show_card}) | ||
| 247 | + } | ||
| 248 | + } | ||
| 249 | + //-----先获取物流,再获取用户信息,再展示页面----- | ||
| 250 | + th.get_wuliu(th.get_info(th.show_page)); | ||
| 251 | + }) | ||
| 252 | + }else{ | ||
| 253 | + //-----先获取物流,再获取用户信息,再展示页面----- | ||
| 254 | + th.get_wuliu(th.get_info(th.show_page)); | ||
| 255 | + } | ||
| 256 | + | ||
| 257 | + }) | ||
| 258 | + | ||
| 259 | + | ||
| 212 | }, | 260 | }, |
| 213 | 261 | ||
| 214 | //-------------------获取物流--------------- | 262 | //-------------------获取物流--------------- |
| @@ -304,6 +352,9 @@ Page({ | @@ -304,6 +352,9 @@ Page({ | ||
| 304 | var arr = new Array(); | 352 | var arr = new Array(); |
| 305 | var carr = su.data.data.pageData; | 353 | var carr = su.data.data.pageData; |
| 306 | th.data.cartlist_y = carr; //存储原始购物车列表 | 354 | th.data.cartlist_y = carr; //存储原始购物车列表 |
| 355 | + | ||
| 356 | + //---是不是购买等级卡成功的返回---等级卡显示的判断--- | ||
| 357 | + var is_card_back=getApp().globalData.is_card_back; | ||
| 307 | 358 | ||
| 308 | for (var i = 0; i < carr.length; i++) { | 359 | for (var i = 0; i < carr.length; i++) { |
| 309 | var item = carr[i]; | 360 | var item = carr[i]; |
| @@ -311,6 +362,26 @@ Page({ | @@ -311,6 +362,26 @@ Page({ | ||
| 311 | if(item.prom_type==3 && item.is_gift!=1){ | 362 | if(item.prom_type==3 && item.is_gift!=1){ |
| 312 | await th.add_prom_goods_map(item); | 363 | await th.add_prom_goods_map(item); |
| 313 | } | 364 | } |
| 365 | + | ||
| 366 | + //-- 如果是等级会员注册返回 -- | ||
| 367 | + if(is_card_back){ | ||
| 368 | + | ||
| 369 | + // 拼团,搭配购不计算,赠品也不计算 | ||
| 370 | + if( item['prom_type']!=5 && item['prom_type']!=6 && !item.is_gift && !item['is_collocation'] && item.goods_price>item[th.data.card_name] ){ | ||
| 371 | + item.goods_price=item[th.data.card_name]; | ||
| 372 | + carr[i].goods_price=item[th.data.card_name]; | ||
| 373 | + } | ||
| 374 | + }else{ | ||
| 375 | + // 拼团,搭配购不计算,赠品也不计算,同时会员还未购买等级会员 | ||
| 376 | + if(item[th.data.card_name]>0 && item['prom_type']!=5 && item['prom_type']!=6 && !th.data.userinfo.card_field | ||
| 377 | + && !item.is_gift && !item['is_collocation'] && item.goods_price>item[th.data.card_name] ){ | ||
| 378 | + item.cut_price= item.goods_price-item[th.data.card_name]; | ||
| 379 | + carr[i].cut_price=item.goods_price-item[th.data.card_name]; | ||
| 380 | + } | ||
| 381 | + | ||
| 382 | + } | ||
| 383 | + | ||
| 384 | + | ||
| 314 | item.original_img = oo.imghost + item.original_img; | 385 | item.original_img = oo.imghost + item.original_img; |
| 315 | /*----接口要弄出来的,先顶着-----*/ | 386 | /*----接口要弄出来的,先顶着-----*/ |
| 316 | var pcid = item.pick_id; | 387 | var pcid = item.pick_id; |
| @@ -320,7 +391,9 @@ Page({ | @@ -320,7 +391,9 @@ Page({ | ||
| 320 | if (arr.length > 0) { | 391 | if (arr.length > 0) { |
| 321 | for (var j = 0; j < arr.length; j++) { | 392 | for (var j = 0; j < arr.length; j++) { |
| 322 | if (arr[j].pickup_id == pcid) { | 393 | if (arr[j].pickup_id == pcid) { |
| 323 | - arr[j].goods.push(item); | 394 | + arr[j].goods.push(item); |
| 395 | + //-- 把等级卡会优惠多少钱装进去 -- | ||
| 396 | + if(item.cut_price) arr[j].card_cut_price+=arr[j].cut_price; | ||
| 324 | find = 1;break; | 397 | find = 1;break; |
| 325 | } | 398 | } |
| 326 | } | 399 | } |
| @@ -348,6 +421,7 @@ Page({ | @@ -348,6 +421,7 @@ Page({ | ||
| 348 | 421 | ||
| 349 | //如果是物流的话,全部自提的控制要弄成0 | 422 | //如果是物流的话,全部自提的控制要弄成0 |
| 350 | if (e_t == 0) th.setData({ is_all_zt:0}); | 423 | if (e_t == 0) th.setData({ is_all_zt:0}); |
| 424 | + | ||
| 351 | var narr = new Array(); narr.push(item); | 425 | var narr = new Array(); narr.push(item); |
| 352 | 426 | ||
| 353 | //-----------拼装购物车结算的数组,如果有默认物流时要用默认物流编号----------------- | 427 | //-----------拼装购物车结算的数组,如果有默认物流时要用默认物流编号----------------- |
| @@ -359,9 +433,13 @@ Page({ | @@ -359,9 +433,13 @@ Page({ | ||
| 359 | } | 433 | } |
| 360 | 434 | ||
| 361 | var ie = { | 435 | var ie = { |
| 362 | - pickup_id: pcid, pname: pikname, goods: narr, exp_type: e_t, wind: m_wind, distr_t: dis_t, | 436 | + pickup_id: pcid, pname: pikname, goods: narr, exp_type: e_t, wind: m_wind, distr_t: dis_t,card_cut_price:0, |
| 363 | goods_price: 0, shipping_price: 0, user_money: 0, total_amount: 0, order_amount: 0, user_note:0}; | 437 | goods_price: 0, shipping_price: 0, user_money: 0, total_amount: 0, order_amount: 0, user_note:0}; |
| 438 | + | ||
| 439 | + //-- 把等级卡会优惠多少钱装进去 -- | ||
| 440 | + if(item.cut_price) ie.card_cut_price+=item.cut_price; | ||
| 364 | arr.push(ie); | 441 | arr.push(ie); |
| 442 | + | ||
| 365 | } | 443 | } |
| 366 | } | 444 | } |
| 367 | //深拷贝 | 445 | //深拷贝 |
| @@ -414,6 +492,21 @@ Page({ | @@ -414,6 +492,21 @@ Page({ | ||
| 414 | var item=th.data.wu_arr[k]; if(def_exp_code==item.code){ m_wind=k; } | 492 | var item=th.data.wu_arr[k]; if(def_exp_code==item.code){ m_wind=k; } |
| 415 | } | 493 | } |
| 416 | } | 494 | } |
| 495 | + | ||
| 496 | + //---是不是购买等级卡成功的返回---等级卡显示的判断--- | ||
| 497 | + var is_card_back=getApp().globalData.is_card_back; | ||
| 498 | + if(is_card_back){ | ||
| 499 | + gg.goods_price=gd[th.data.card_name]; | ||
| 500 | + getApp().globalData.is_card_back=0; | ||
| 501 | + th.setData({card_cut_price:0}); | ||
| 502 | + }else{ | ||
| 503 | + //--- 商品不能是搭配购,商家等级卡开通的情况下, 会员不是等级会员的情况, 商品有设置等级卡价格,同时等级卡价格小于商品的价格 | ||
| 504 | + if(gd['prom_type']!=5 && gd['prom_type']!=6 && th.data.card_name && gd[th.data.card_name]>0 && gg.goods_price>gd[th.data.card_name] && !th.data.userinfo.card_field){ | ||
| 505 | + var cut_p= gg.goods_price-gd[th.data.card_name]; | ||
| 506 | + th.setData({card_cut_price:cut_p}); | ||
| 507 | + } | ||
| 508 | + } | ||
| 509 | + | ||
| 417 | switch (gd.prom_type){ | 510 | switch (gd.prom_type){ |
| 418 | case 0: | 511 | case 0: |
| 419 | case 2: | 512 | case 2: |
| @@ -480,7 +573,6 @@ Page({ | @@ -480,7 +573,6 @@ Page({ | ||
| 480 | th.get_buy_now_quan(); | 573 | th.get_buy_now_quan(); |
| 481 | 574 | ||
| 482 | }) | 575 | }) |
| 483 | - | ||
| 484 | }else{ | 576 | }else{ |
| 485 | //--看是不是搭配促销-- | 577 | //--看是不是搭配促销-- |
| 486 | if(gg.prom_type==5){ | 578 | if(gg.prom_type==5){ |
| @@ -2942,7 +3034,13 @@ Page({ | @@ -2942,7 +3034,13 @@ Page({ | ||
| 2942 | } | 3034 | } |
| 2943 | } | 3035 | } |
| 2944 | return is_use; | 3036 | return is_use; |
| 2945 | - } | 3037 | + }, |
| 3038 | + | ||
| 3039 | + //跳转到购买卡 | ||
| 3040 | + buycard:function(){ | ||
| 3041 | + getApp().goto("/pages/user/plus/plus"); | ||
| 3042 | + getApp().globalData.plus_buy_back=1; | ||
| 3043 | + } | ||
| 2946 | 3044 | ||
| 2947 | 3045 | ||
| 2948 | 3046 |
pages/cart/cart2/cart2.wxml
| @@ -70,9 +70,28 @@ | @@ -70,9 +70,28 @@ | ||
| 70 | <view class="goods-num">x{{items.goods_num}}</view> | 70 | <view class="goods-num">x{{items.goods_num}}</view> |
| 71 | </view> | 71 | </view> |
| 72 | </navigator> | 72 | </navigator> |
| 73 | - | ||
| 74 | </view> | 73 | </view> |
| 75 | - | 74 | + |
| 75 | + | ||
| 76 | + <!-- 如果是等级卡的商品,会员没有注册,要提醒注册 --> | ||
| 77 | + <view class="plus_buy fs28" wx:if="{{item.card_cut_price>0}}"> | ||
| 78 | + <view class="flex"> | ||
| 79 | + <view class="card_bg ellipsis-1" style="margin-right: 10rpx;"> | ||
| 80 | + <image src="{{imgUrl}}/miniapp/images/plus/dj_icon.png"></ image> | ||
| 81 | + <text class="card_name">{{show_card.CardName}}</text> | ||
| 82 | + </view> | ||
| 83 | + <view>立减 <text style="color:#f23030;">{{filters.toFix(item.card_cut_price,2) }}</text> 元</view> | ||
| 84 | + </view> | ||
| 85 | + <view> | ||
| 86 | + <text style="color: #999;margin-left: 4rpx;">vip超级会员仅需{{show_card.CardFee}}元</text> | ||
| 87 | + </view> | ||
| 88 | + <!-- 三角形 --> | ||
| 89 | + <view class="car_tri_up"></view> | ||
| 90 | + <!-- 立即开通跳转 --> | ||
| 91 | + <view bindtap="buycard" class="card_op">立即开通</view> | ||
| 92 | + </view> | ||
| 93 | + | ||
| 94 | + | ||
| 76 | <!-----使用优惠券------> | 95 | <!-----使用优惠券------> |
| 77 | <view class="xc-coupon-frame flex-center" data-bn="0" bindtap="open_coupon_list" wx:if="{{(item.quan_list && item.quan_list.length>0) || get_by_quan_list_cart[item.pickup_id]!=null}}" | 96 | <view class="xc-coupon-frame flex-center" data-bn="0" bindtap="open_coupon_list" wx:if="{{(item.quan_list && item.quan_list.length>0) || get_by_quan_list_cart[item.pickup_id]!=null}}" |
| 78 | data-cind="{{pidx}}" data-pickid="{{item.pickup_id}}"> | 97 | data-cind="{{pidx}}" data-pickid="{{item.pickup_id}}"> |
| @@ -244,6 +263,24 @@ | @@ -244,6 +263,24 @@ | ||
| 244 | </view> | 263 | </view> |
| 245 | </block> | 264 | </block> |
| 246 | 265 | ||
| 266 | + <!-- 如果是等级卡的商品,会员没有注册,要提醒注册 --> | ||
| 267 | + <view class="plus_buy fs28" wx:if="{{card_cut_price>0}}"> | ||
| 268 | + <view class="flex"> | ||
| 269 | + <view class="card_bg ellipsis-1" style="margin-right: 10rpx;"> | ||
| 270 | + <image src="{{imgUrl}}/miniapp/images/plus/dj_icon.png"></ image> | ||
| 271 | + <text class="card_name">{{show_card.CardName}}</text> | ||
| 272 | + </view> | ||
| 273 | + <view>立减 <text style="color:#f23030;">{{filters.toFix(card_cut_price,2) }}</text> 元</view> | ||
| 274 | + </view> | ||
| 275 | + <view> | ||
| 276 | + <text style="color: #999;margin-left: 4rpx;">vip超级会员仅需{{show_card.CardFee}}元</text> | ||
| 277 | + </view> | ||
| 278 | + <!-- 三角形 --> | ||
| 279 | + <view class="car_tri_up"></view> | ||
| 280 | + <!-- 立即开通跳转 --> | ||
| 281 | + <view bindtap="buycard" class="card_op">立即开通</view> | ||
| 282 | + </view> | ||
| 283 | + | ||
| 247 | 284 | ||
| 248 | <view class="set-mes bdr_b-14"> | 285 | <view class="set-mes bdr_b-14"> |
| 249 | <view wx:if="{{order.store_prom}}"> | 286 | <view wx:if="{{order.store_prom}}"> |
pages/cart/cart2/cart2.wxss
| @@ -899,3 +899,62 @@ margin-left: 20rpx; | @@ -899,3 +899,62 @@ margin-left: 20rpx; | ||
| 899 | background: none; | 899 | background: none; |
| 900 | opacity: 1; | 900 | opacity: 1; |
| 901 | } | 901 | } |
| 902 | + | ||
| 903 | + | ||
| 904 | +.plus_buy{ | ||
| 905 | + background-color: #fff; | ||
| 906 | + margin:15rpx 0; | ||
| 907 | + padding: 20rpx 10rpx; | ||
| 908 | + position: relative; | ||
| 909 | +} | ||
| 910 | + | ||
| 911 | + | ||
| 912 | +.card_bg { | ||
| 913 | + box-sizing: border-box; | ||
| 914 | + padding: 2rpx 10rpx; | ||
| 915 | + height: 28rpx; | ||
| 916 | + border-radius: 26rpx; | ||
| 917 | + font-size: 18rpx; | ||
| 918 | + line-height: 28rpx; | ||
| 919 | + max-width: 210rpx; | ||
| 920 | + background: #333; | ||
| 921 | + color: #fff; | ||
| 922 | + margin-left: 8rpx; | ||
| 923 | + position:relative; | ||
| 924 | + top:7rpx; | ||
| 925 | +} | ||
| 926 | + | ||
| 927 | +.card_bg image { | ||
| 928 | + width: 19rpx; | ||
| 929 | + height: 19rpx; | ||
| 930 | + margin-right: 8rpx; | ||
| 931 | +} | ||
| 932 | + | ||
| 933 | +/* .card_bg .card_name { | ||
| 934 | + max-width: 76rpx; | ||
| 935 | + width: auto; | ||
| 936 | + overflow: hidden; | ||
| 937 | + white-space: nowrap; | ||
| 938 | +} */ | ||
| 939 | + | ||
| 940 | +.card_name { | ||
| 941 | + position: relative; | ||
| 942 | + top: -4rpx; | ||
| 943 | + margin-left: 6px; | ||
| 944 | +} | ||
| 945 | + | ||
| 946 | +.car_tri_up { | ||
| 947 | + width: 0;height: 0; | ||
| 948 | + border-left: 20rpx solid transparent; | ||
| 949 | + border-right: 20rpx solid transparent; | ||
| 950 | + border-bottom: 20rpx solid #fff; | ||
| 951 | + position: absolute; | ||
| 952 | + right: 20rpx; | ||
| 953 | + top:-10rpx | ||
| 954 | +} | ||
| 955 | +.card_op{ | ||
| 956 | + position: absolute; | ||
| 957 | + right: 20rpx; | ||
| 958 | + top:36rpx | ||
| 959 | +} | ||
| 960 | + |
pages/cart/cart2_pt/cart2_pt.js
| @@ -294,8 +294,8 @@ Page({ | @@ -294,8 +294,8 @@ Page({ | ||
| 294 | console.log('calculatePrice2222'); | 294 | console.log('calculatePrice2222'); |
| 295 | console.log(rs); | 295 | console.log(rs); |
| 296 | var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; | 296 | var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; |
| 297 | - //-----------当地址不为空,且是物流时,计算物流费用---------- | ||
| 298 | - if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 ){ | 297 | + //-----------当地址不为空,且是物流时,计算物流费用,同时阶梯团不计算拼团价格---------- |
| 298 | + if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && th.data.kt_type!=3 ){ | ||
| 299 | switch (good['exp_sum_type']) { | 299 | switch (good['exp_sum_type']) { |
| 300 | case 1: | 300 | case 1: |
| 301 | //统一运费 | 301 | //统一运费 |
pages/giftpack/birthdaygift/birthdaygift.js
| @@ -127,7 +127,7 @@ Page({ | @@ -127,7 +127,7 @@ Page({ | ||
| 127 | //--先判断会员状态-- | 127 | //--先判断会员状态-- |
| 128 | var user_info = getApp().globalData.userInfo; | 128 | var user_info = getApp().globalData.userInfo; |
| 129 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | 129 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { |
| 130 | - getApp().goto('/pages/getphone/getphone'); | 130 | + getApp().goto('/pages/togoin/togoin'); |
| 131 | return false; | 131 | return false; |
| 132 | } | 132 | } |
| 133 | this.GetList(); | 133 | this.GetList(); |
pages/giftpack/buygiftpack/giftpackbuy.js
| @@ -41,7 +41,7 @@ Page({ | @@ -41,7 +41,7 @@ Page({ | ||
| 41 | //--先判断会员状态-- | 41 | //--先判断会员状态-- |
| 42 | var user_info = getApp().globalData.userInfo; | 42 | var user_info = getApp().globalData.userInfo; |
| 43 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | 43 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { |
| 44 | - getApp().goto('/pages/getphone/getphone'); | 44 | + getApp().goto('/pages/togoin/togoin'); |
| 45 | return false; | 45 | return false; |
| 46 | } | 46 | } |
| 47 | this.getList(); | 47 | this.getList(); |
pages/giftpack/evaluategift/evaluategift.js
| @@ -140,7 +140,7 @@ Page({ | @@ -140,7 +140,7 @@ Page({ | ||
| 140 | //--先判断会员状态-- | 140 | //--先判断会员状态-- |
| 141 | var user_info = getApp().globalData.userInfo; | 141 | var user_info = getApp().globalData.userInfo; |
| 142 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | 142 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { |
| 143 | - getApp().goto('/pages/getphone/getphone'); | 143 | + getApp().goto('/pages/togoin/togoin'); |
| 144 | return false; | 144 | return false; |
| 145 | } | 145 | } |
| 146 | 146 |
pages/giftpack/festival/festival.js
| @@ -133,7 +133,7 @@ Page({ | @@ -133,7 +133,7 @@ Page({ | ||
| 133 | //--先判断会员状态-- | 133 | //--先判断会员状态-- |
| 134 | var user_info = getApp().globalData.userInfo; | 134 | var user_info = getApp().globalData.userInfo; |
| 135 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | 135 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { |
| 136 | - getApp().goto('/pages/getphone/getphone'); | 136 | + getApp().goto('/pages/togoin/togoin'); |
| 137 | return false; | 137 | return false; |
| 138 | } | 138 | } |
| 139 | this.is_festival(); | 139 | this.is_festival(); |
pages/giftpack/giftpacklist/giftpacklist.js
| @@ -45,7 +45,7 @@ Page({ | @@ -45,7 +45,7 @@ Page({ | ||
| 45 | //--先判断会员状态-- | 45 | //--先判断会员状态-- |
| 46 | var user_info = getApp().globalData.userInfo; | 46 | var user_info = getApp().globalData.userInfo; |
| 47 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | 47 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { |
| 48 | - getApp().goto('/pages/getphone/getphone'); | 48 | + getApp().goto('/pages/togoin/togoin'); |
| 49 | return false; | 49 | return false; |
| 50 | } | 50 | } |
| 51 | 51 |
pages/giftpack/mygiftpack/mygiftpack.js
| @@ -42,7 +42,7 @@ Page({ | @@ -42,7 +42,7 @@ Page({ | ||
| 42 | //--先判断会员状态-- | 42 | //--先判断会员状态-- |
| 43 | var user_info = getApp().globalData.userInfo; | 43 | var user_info = getApp().globalData.userInfo; |
| 44 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | 44 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { |
| 45 | - getApp().goto('/pages/getphone/getphone'); | 45 | + getApp().goto('/pages/togoin/togoin'); |
| 46 | return false; | 46 | return false; |
| 47 | } | 47 | } |
| 48 | this.getList(); | 48 | this.getList(); |
pages/giftpack/newvipgift/newvipgift.js
| @@ -126,7 +126,7 @@ Page({ | @@ -126,7 +126,7 @@ Page({ | ||
| 126 | //--先判断会员状态-- | 126 | //--先判断会员状态-- |
| 127 | var user_info = getApp().globalData.userInfo; | 127 | var user_info = getApp().globalData.userInfo; |
| 128 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | 128 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { |
| 129 | - getApp().goto('/pages/getphone/getphone'); | 129 | + getApp().goto('/pages/togoin/togoin'); |
| 130 | return false; | 130 | return false; |
| 131 | } | 131 | } |
| 132 | this.GetList(); | 132 | this.GetList(); |
pages/goods/goodsInfo/goodsInfo.js
| @@ -347,7 +347,7 @@ Page({ | @@ -347,7 +347,7 @@ Page({ | ||
| 347 | //--- 判断是等级会员,且在有效期范围内 --- | 347 | //--- 判断是等级会员,且在有效期范围内 --- |
| 348 | if(user.card_field && now<end){ | 348 | if(user.card_field && now<end){ |
| 349 | var card_name=ob.name_map.get(user.card_field); | 349 | var card_name=ob.name_map.get(user.card_field); |
| 350 | - // if(card_name.length>6) card_name=card_name.substring(0,7); | 350 | + if(card_name.length>6) card_name=card_name.substring(0,6); |
| 351 | 351 | ||
| 352 | var is_near_date=0; | 352 | var is_near_date=0; |
| 353 | if(end-now<60*60*30*24) is_near_date=1; //如果小于30天 | 353 | if(end-now<60*60*30*24) is_near_date=1; //如果小于30天 |
| @@ -1345,7 +1345,7 @@ Page({ | @@ -1345,7 +1345,7 @@ Page({ | ||
| 1345 | var user_info = getApp().globalData.userInfo; | 1345 | var user_info = getApp().globalData.userInfo; |
| 1346 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | 1346 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { |
| 1347 | wx.navigateTo({ | 1347 | wx.navigateTo({ |
| 1348 | - url: '/pages/getphone/getphone', | 1348 | + url: '/pages/togoin/togoin', |
| 1349 | }) | 1349 | }) |
| 1350 | return false; | 1350 | return false; |
| 1351 | } | 1351 | } |
| @@ -1520,12 +1520,18 @@ Page({ | @@ -1520,12 +1520,18 @@ Page({ | ||
| 1520 | if(getApp().globalData.user_id){ | 1520 | if(getApp().globalData.user_id){ |
| 1521 | url+="&first_leader="+getApp().globalData.user_id; | 1521 | url+="&first_leader="+getApp().globalData.user_id; |
| 1522 | } | 1522 | } |
| 1523 | - | ||
| 1524 | - return { | 1523 | + |
| 1524 | + var ob={ | ||
| 1525 | title: price + "元 " +title, | 1525 | title: price + "元 " +title, |
| 1526 | path:url, | 1526 | path:url, |
| 1527 | imageUrl: img, | 1527 | imageUrl: img, |
| 1528 | - } | 1528 | + }; |
| 1529 | + if(th.data.prom_type==6){ | ||
| 1530 | + title+='\n'+th.data.prom_act.share_remark; | ||
| 1531 | + ob.title=title; | ||
| 1532 | + ob.desc=th.data.prom_act.share_remark; | ||
| 1533 | + } | ||
| 1534 | + return ob; | ||
| 1529 | 1535 | ||
| 1530 | }, | 1536 | }, |
| 1531 | 1537 | ||
| @@ -1767,7 +1773,6 @@ Page({ | @@ -1767,7 +1773,6 @@ Page({ | ||
| 1767 | th.setData({def_pick_store:null}); | 1773 | th.setData({def_pick_store:null}); |
| 1768 | } | 1774 | } |
| 1769 | 1775 | ||
| 1770 | - | ||
| 1771 | //----------获取门店---------------- | 1776 | //----------获取门店---------------- |
| 1772 | getApp().request.promiseGet("/api/weshop/pickup/list", { | 1777 | getApp().request.promiseGet("/api/weshop/pickup/list", { |
| 1773 | data: dd, | 1778 | data: dd, |
| @@ -1828,7 +1833,9 @@ Page({ | @@ -1828,7 +1833,9 @@ Page({ | ||
| 1828 | data: { | 1833 | data: { |
| 1829 | store_id: o.stoid, | 1834 | store_id: o.stoid, |
| 1830 | is_show: 1, | 1835 | is_show: 1, |
| 1831 | - pageSize: 1000 | 1836 | + pageSize: 1000, |
| 1837 | + orderField:"sort", | ||
| 1838 | + orderType:'asc', | ||
| 1832 | }, | 1839 | }, |
| 1833 | success: function(ee) { | 1840 | success: function(ee) { |
| 1834 | if (ee.data.code == 0) { | 1841 | if (ee.data.code == 0) { |
| @@ -1853,12 +1860,12 @@ Page({ | @@ -1853,12 +1860,12 @@ Page({ | ||
| 1853 | //----要进行门店分组-------- | 1860 | //----要进行门店分组-------- |
| 1854 | for (var i = 0; i < sto_arr.length; i++) { | 1861 | for (var i = 0; i < sto_arr.length; i++) { |
| 1855 | //找一下这个门店有没有在分类数组内 | 1862 | //找一下这个门店有没有在分类数组内 |
| 1856 | - var find2 = 0, | ||
| 1857 | - find2name = ""; | 1863 | + var find2 = 0, find2name = "",sort=0; |
| 1858 | for (var m = 0; m < sto_cate.length; m++) { | 1864 | for (var m = 0; m < sto_cate.length; m++) { |
| 1859 | if (sto_arr[i].category_id == sto_cate[m].cat_id) { | 1865 | if (sto_arr[i].category_id == sto_cate[m].cat_id) { |
| 1860 | find2 = sto_cate[m].cat_id; | 1866 | find2 = sto_cate[m].cat_id; |
| 1861 | find2name = sto_cate[m].cat_name; | 1867 | find2name = sto_cate[m].cat_name; |
| 1868 | + sort = sto_cate[m].sort; | ||
| 1862 | break; | 1869 | break; |
| 1863 | } | 1870 | } |
| 1864 | } | 1871 | } |
| @@ -1880,6 +1887,7 @@ Page({ | @@ -1880,6 +1887,7 @@ Page({ | ||
| 1880 | var item = { | 1887 | var item = { |
| 1881 | cat_id: find2, | 1888 | cat_id: find2, |
| 1882 | name: find2name, | 1889 | name: find2name, |
| 1890 | + sort:sort, | ||
| 1883 | s_arr: arr0 | 1891 | s_arr: arr0 |
| 1884 | }; | 1892 | }; |
| 1885 | newarr.push(item); | 1893 | newarr.push(item); |
| @@ -1895,6 +1903,7 @@ Page({ | @@ -1895,6 +1903,7 @@ Page({ | ||
| 1895 | var item = { | 1903 | var item = { |
| 1896 | cat_id: find2, | 1904 | cat_id: find2, |
| 1897 | name: find2name, | 1905 | name: find2name, |
| 1906 | + sort:sort, | ||
| 1898 | s_arr: arr0 | 1907 | s_arr: arr0 |
| 1899 | }; | 1908 | }; |
| 1900 | newarr.push(item); | 1909 | newarr.push(item); |
| @@ -1903,6 +1912,18 @@ Page({ | @@ -1903,6 +1912,18 @@ Page({ | ||
| 1903 | } | 1912 | } |
| 1904 | } | 1913 | } |
| 1905 | } | 1914 | } |
| 1915 | + | ||
| 1916 | + //门店分类要排序下 | ||
| 1917 | + function compare(property){ | ||
| 1918 | + return function(a,b){ | ||
| 1919 | + var value1 = a[property]; | ||
| 1920 | + var value2 = b[property]; | ||
| 1921 | + return value1 - value2; | ||
| 1922 | + } | ||
| 1923 | + } | ||
| 1924 | + if(newarr.length>0) | ||
| 1925 | + newarr.sort(compare("sort")); | ||
| 1926 | + | ||
| 1906 | 1927 | ||
| 1907 | //----安排其他的分类----- | 1928 | //----安排其他的分类----- |
| 1908 | if (qita.length > 0) { | 1929 | if (qita.length > 0) { |
| @@ -1913,6 +1934,10 @@ Page({ | @@ -1913,6 +1934,10 @@ Page({ | ||
| 1913 | }; | 1934 | }; |
| 1914 | newarr.push(item); | 1935 | newarr.push(item); |
| 1915 | } | 1936 | } |
| 1937 | + | ||
| 1938 | + | ||
| 1939 | + | ||
| 1940 | + | ||
| 1916 | th.setData({ | 1941 | th.setData({ |
| 1917 | is_show_sto_cat: 1, | 1942 | is_show_sto_cat: 1, |
| 1918 | all_sto: newarr | 1943 | all_sto: newarr |
| @@ -2666,7 +2691,7 @@ Page({ | @@ -2666,7 +2691,7 @@ Page({ | ||
| 2666 | var user_info = getApp().globalData.userInfo; | 2691 | var user_info = getApp().globalData.userInfo; |
| 2667 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | 2692 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { |
| 2668 | wx.navigateTo({ | 2693 | wx.navigateTo({ |
| 2669 | - url: '/pages/getphone/getphone', | 2694 | + url: '/pages/togoin/togoin', |
| 2670 | }) | 2695 | }) |
| 2671 | return false; | 2696 | return false; |
| 2672 | } | 2697 | } |
| @@ -3168,7 +3193,7 @@ Page({ | @@ -3168,7 +3193,7 @@ Page({ | ||
| 3168 | var user_info = getApp().globalData.userInfo; | 3193 | var user_info = getApp().globalData.userInfo; |
| 3169 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | 3194 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { |
| 3170 | wx.navigateTo({ | 3195 | wx.navigateTo({ |
| 3171 | - url: '/pages/getphone/getphone', | 3196 | + url: '/pages/togoin/togoin', |
| 3172 | }) | 3197 | }) |
| 3173 | return false; | 3198 | return false; |
| 3174 | } | 3199 | } |
| @@ -3225,7 +3250,7 @@ Page({ | @@ -3225,7 +3250,7 @@ Page({ | ||
| 3225 | var user_info = getApp().globalData.userInfo; | 3250 | var user_info = getApp().globalData.userInfo; |
| 3226 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | 3251 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { |
| 3227 | //getApp().my_warnning("请先登录",0,this); | 3252 | //getApp().my_warnning("请先登录",0,this); |
| 3228 | - wx.navigateTo({ url: '/pages/getphone/getphone', }) | 3253 | + wx.navigateTo({ url: '/pages/togoin/togoin', }) |
| 3229 | return false; | 3254 | return false; |
| 3230 | } | 3255 | } |
| 3231 | 3256 | ||
| @@ -3698,7 +3723,7 @@ Page({ | @@ -3698,7 +3723,7 @@ Page({ | ||
| 3698 | 3723 | ||
| 3699 | if (bconfig.is_sort_storage) { | 3724 | if (bconfig.is_sort_storage) { |
| 3700 | wx.getLocation({ | 3725 | wx.getLocation({ |
| 3701 | - type: 'wgs84', | 3726 | + type: 'gcj02', |
| 3702 | success: function(res) { | 3727 | success: function(res) { |
| 3703 | 3728 | ||
| 3704 | th.data.lat = res.latitude; | 3729 | th.data.lat = res.latitude; |
| @@ -4039,7 +4064,7 @@ Page({ | @@ -4039,7 +4064,7 @@ Page({ | ||
| 4039 | var e = th.data.bconfig; | 4064 | var e = th.data.bconfig; |
| 4040 | if (e.is_sort_storage) { | 4065 | if (e.is_sort_storage) { |
| 4041 | wx.getLocation({ | 4066 | wx.getLocation({ |
| 4042 | - type: 'wgs84', | 4067 | + type: 'gcj02', |
| 4043 | success: function(res) { | 4068 | success: function(res) { |
| 4044 | th.data.lat = res.latitude; | 4069 | th.data.lat = res.latitude; |
| 4045 | th.data.lon = res.longitude; | 4070 | th.data.lon = res.longitude; |
pages/index/index/index.js
| @@ -16,6 +16,8 @@ var api = require('../../../api/api.js'); | @@ -16,6 +16,8 @@ var api = require('../../../api/api.js'); | ||
| 16 | var d = getApp().globalData; | 16 | var d = getApp().globalData; |
| 17 | 17 | ||
| 18 | 18 | ||
| 19 | + | ||
| 20 | + | ||
| 19 | Page({ | 21 | Page({ |
| 20 | data: { | 22 | data: { |
| 21 | url: o.imghost, | 23 | url: o.imghost, |
| @@ -730,8 +732,8 @@ Page({ | @@ -730,8 +732,8 @@ Page({ | ||
| 730 | var user_info = getApp().globalData.userInfo; | 732 | var user_info = getApp().globalData.userInfo; |
| 731 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | 733 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { |
| 732 | wx.navigateTo({ | 734 | wx.navigateTo({ |
| 733 | - //url: '/pages/togoin/togoin', | ||
| 734 | - url: '/pages/getphone/getphone', | 735 | + url: '/pages/togoin/togoin', |
| 736 | + //url: '/pages/getphone/getphone', | ||
| 735 | }) | 737 | }) |
| 736 | return false; | 738 | return false; |
| 737 | } | 739 | } |
pages/store/index.js
| @@ -23,7 +23,7 @@ Page({ | @@ -23,7 +23,7 @@ Page({ | ||
| 23 | onLoad:function(e){ | 23 | onLoad:function(e){ |
| 24 | var th=this; | 24 | var th=this; |
| 25 | wx.getLocation({ | 25 | wx.getLocation({ |
| 26 | - type: 'wgs84', | 26 | + type: 'gcj02', |
| 27 | success: function(res) { | 27 | success: function(res) { |
| 28 | th.data.lat = res.latitude; | 28 | th.data.lat = res.latitude; |
| 29 | th.data.lon = res.longitude; | 29 | th.data.lon = res.longitude; |
pages/tabbar/tabbar.js deleted
pages/tabbar/tabbar.json deleted
pages/tabbar/tabbar.wxml deleted
| 1 | - | ||
| 2 | -<!--pages/tabbar.wxml--> | ||
| 3 | - <template name="tabBar"> | ||
| 4 | - <!-- 如果是自定义的话 --> | ||
| 5 | - <view hidden="{{tabBar.iscustom=='2'}}" class="tab-bar" style="width:100%;height:{{tabBar.isIpx ? '172rpx' : '104rpx'}};position:fixed;color: {{tabBar.color}}; background: {{tabBar.backgroundColor}}; bottom: 0;z-index:9999999;"> | ||
| 6 | - <block wx:for="{{tabBar.list}}" wx:key="weappurl"> | ||
| 7 | - <block wx:if="{{!item.active}}"> | ||
| 8 | - <navigator url="{{item.weappurl}}" open-type="redirect" class="tabbar_item {{item.clas}}" style="position:relative;width:{{100 / tabBar.length}}%;height:100%;float:left;text-align:center;padding:5px 0;"> | ||
| 9 | - <view wx:if="{{item.nav_name=='购物车'}}" style="top:0;background-color: red;color: #fff;font-size: 20rpx;border-radius: 50%;width: 40rpx;line-height:40rpx;height: 40rpx;position: absolute;z-index: 100;right:30rpx;"> | ||
| 10 | - {{tabBar.cartGoodsNum}} | ||
| 11 | - </view> | ||
| 12 | - <view style="width:35%;height:58rpx;margin-left:33%;display: flex; justify-content: center;align-items: center"> | ||
| 13 | - <!--<image src="{{item.src}}" bindload="load_nav" data-index="{{ index }}" class="img" style="max-width: 100%; width:{{item.width?item.width:0}}rpx;height:{{item.height}}rpx"></image>--> | ||
| 14 | - <view class="nav_imgage" style="background-image: url({{item.src}});height: 50rpx; width: 50rpx;background-position: center;background-repeat: no-repeat;background-size: auto 85%;"></view> | ||
| 15 | - </view> | ||
| 16 | - <view style="height:20px;line-height:15px; position: relative; top: -8rpx"><text class="tabbar_text" wx:if="{{item.nav_name}}" style="font-size:0.6rem">{{item.nav_name}}</text></view> | ||
| 17 | - </navigator> | ||
| 18 | - </block> | ||
| 19 | - <block wx:else> | ||
| 20 | - <view class="tabbar_item {{item.clas}}" style="color: {{item.selectedColor? item.selectedColor :tabBar.selectedColor}};position:relative;width:{{100 / tabBar.length}}%;height:100%;float:left;text-align:center;padding:5px 0;"> | ||
| 21 | - <view wx:if="{{item.nav_name=='购物车'}}" style="top:0;background-color: red;color: #fff;font-size: 20rpx;border-radius: 50%;width: 40rpx;line-height:40rpx;height: 40rpx;position: absolute;z-index: 100;right:30rpx;"> | ||
| 22 | - {{tabBar.cartGoodsNum}} | ||
| 23 | - </view> | ||
| 24 | - <view style="width:35%;height:58rpx;margin-left:33%; display: flex; justify-content: center;align-items: center"> | ||
| 25 | - <!--<image src="{{item.src_sele}}" bindload="load_nav" data-index="{{ index }}" class="img" style="max-width: 100%;width:{{item.width?item.width:0}}rpx;height:{{item.height}}rpx"></image>--> | ||
| 26 | - <view class="nav_imgage" style="background-image: url({{item.src_sele}});height: 50rpx; width: 50rpx;background-position: center;background-repeat: no-repeat;background-size: auto 85%;"></view> | ||
| 27 | - </view> | ||
| 28 | - <view style="height:20px;line-height:15px; position: relative; top: -8rpx"><text class="tabbar_text" wx:if="{{item.nav_name}}" style="font-size:0.6rem">{{item.nav_name}}</text></view> | ||
| 29 | - </view> | ||
| 30 | - </block> | ||
| 31 | - | ||
| 32 | - </block> | ||
| 33 | - </view> | ||
| 34 | - | ||
| 35 | - | ||
| 36 | - <!-- 如果是默认的话 --> | ||
| 37 | - <view hidden="{{tabBar.iscustom=='1'}}" class="tab-bar" style="width:100%;height:{{tabBar.isIpx ? '168rpx' : '100rpx'}};position:fixed;color:#6e6d6b; background:#ffffff; bottom: 0;z-index:9999999;padding:2px 0;"> | ||
| 38 | - <!-- 1 --> | ||
| 39 | - <block wx:if="{{tabBar.active!='/pages/index/index/index'}}"> | ||
| 40 | - <navigator url="/pages/index/index/index" class="tabbar_item {{item.clas}}" open-type="redirect" style="position:relative;width:25%;height:100%;float:left;text-align:center;padding:2px 0;"> | ||
| 41 | - <view style="width:30%;height:54rpx;margin-left:35%;"> | ||
| 42 | - <image src="{{tabBar.url}}/miniapp/images/bar/index.png" class="img" style="width:100%;height:100%"></image> | ||
| 43 | - </view> | ||
| 44 | - <view style="height:40rpx;line-height:22rpx;"><text class="tabbar_text" style="font-size:0.6rem">首页</text></view> | ||
| 45 | - </navigator> | ||
| 46 | - </block> | ||
| 47 | - <block wx:else> | ||
| 48 | - <view class="tabbar_item {{item.clas}}" style="color:#f23030;position:relative;width:25%;height:100%;float:left;text-align:center;padding:2px 0;"> | ||
| 49 | - <view style="width:30%;height:54rpx;margin-left:35%;"> | ||
| 50 | - <image src="{{tabBar.url}}/miniapp/images/bar/index_on.png" class="img" style="width:100%;height:100%"></image> | ||
| 51 | - </view> | ||
| 52 | - <view style="height:40rpx;line-height:22rpx;"><text class="tabbar_text" style="font-size:0.6rem">首页</text></view> | ||
| 53 | - </view> | ||
| 54 | - </block> | ||
| 55 | - | ||
| 56 | - | ||
| 57 | - <!-- 2 --> | ||
| 58 | - <block wx:if="{{tabBar.active!='/pages/goods/categoryList/categoryList'}}"> | ||
| 59 | - <navigator url="/pages/goods/categoryList/categoryList" class="tabbar_item {{tabBar.clas}}" open-type="redirect" style="position:relative;width:25%;height:100%;float:left;text-align:center;padding:2px 0;"> | ||
| 60 | - <view style="width:30%;height:54rpx;margin-left:35%;"> | ||
| 61 | - <image src="{{tabBar.url}}/miniapp/images/bar/fl.png" class="img" style="width:100%;height:100%"></image> | ||
| 62 | - </view> | ||
| 63 | - <view style="height:40rpx;line-height:22rpx;"><text class="tabbar_text" wx:if="分类" style="font-size:0.6rem">分类</text></view> | ||
| 64 | - </navigator> | ||
| 65 | - </block> | ||
| 66 | - <block wx:else> | ||
| 67 | - <view class="tabbar_item {{tabBar.clas}}" style="color:#f23030;position:relative;width:25%;height:100%;float:left;text-align:center;padding:2px 0;"> | ||
| 68 | - <view style="width:30%;height:54rpx;margin-left:35%;"> | ||
| 69 | - <image src="{{tabBar.url}}/miniapp/images/bar/fl_on.png" class="img" style="width:100%;height:100%"></image> | ||
| 70 | - </view> | ||
| 71 | - <view style="height:40rpx;line-height:22rpx;"><text class="tabbar_text" wx:if="分类" style="font-size:0.6rem">分类</text></view> | ||
| 72 | - </view> | ||
| 73 | - </block> | ||
| 74 | - | ||
| 75 | - | ||
| 76 | - <!-- 3 --> | ||
| 77 | - <block wx:if="{{tabBar.active!='/pages/cart/cart/cart'}}"> | ||
| 78 | - <navigator url="/pages/cart/cart/cart" open-type="redirect" class="tabbar_item {{tabBar.clas}}" style="position:relative;width:25%;height:100%;float:left;text-align:center;padding:2px 0;"> | ||
| 79 | - <view style="background-color: red;color: #fff;font-size: 20rpx;border-radius: 50%;width: 40rpx;height: 40rpx;line-heith:40rpx;position: fixed;z-index: 100;left:63%;display: flex;align-items: center;justify-content: center;"> | ||
| 80 | - {{tabBar.cartGoodsNum}} | ||
| 81 | - </view><view style="width:30%;height:54rpx;margin-left:35%;"> | ||
| 82 | - <image src="{{tabBar.url}}/miniapp/images/bar/car.png" class="img" style="width:100%;height:100%"></image> | ||
| 83 | - </view> | ||
| 84 | - <view style="height:40rpx;line-height:22rpx;"><text class="tabbar_text" style="font-size:0.6rem">购物车</text></view> | ||
| 85 | - </navigator> | ||
| 86 | - </block> | ||
| 87 | - <block wx:else> | ||
| 88 | - <view class="tabbar_item {{tabBar.clas}}" style="color: #f23030;position:relative;width:25%;height:100%;float:left;text-align:center;padding:2px 0;"> | ||
| 89 | - <view style="background-color: red;color: #fff;font-size: 20rpx;border-radius: 50%;width: 40rpx;height: 40rpx;line-heith:40rpx;position: fixed;z-index: 100;left:63%;display: flex;align-items: center;justify-content: center;"> | ||
| 90 | - {{tabBar.cartGoodsNum}} | ||
| 91 | - </view><view style="width:30%;height:54rpx;margin-left:35%;"> | ||
| 92 | - <image src="{{tabBar.url}}/miniapp/images/bar/car_on.png" class="img" style="width:100%;height:100%"></image> | ||
| 93 | - </view> | ||
| 94 | - <view style="height:40rpx;line-height:22rpx;"><text class="tabbar_text" style="font-size:0.6rem">购物车</text></view> | ||
| 95 | - </view> | ||
| 96 | - </block> | ||
| 97 | - | ||
| 98 | - <!-- 4 --> | ||
| 99 | - <block wx:if="{{tabBar.active!='/pages/user/index/index'}}"> | ||
| 100 | - <navigator url="/pages/user/index/index" open-type="redirect" class="tabbar_item {{tabBar.clas}}" style="position:relative;width:25%;height:100%;float:left;text-align:center;padding:2px 0;"> | ||
| 101 | - <view style="width:30%;height:54rpx;margin-left:35%;"> | ||
| 102 | - <image src="{{tabBar.url}}/miniapp/images/bar/user.png" class="img" style="width:100%;height:100%"></image> | ||
| 103 | - </view> | ||
| 104 | - <view style="height:40rpx;line-height:22rpx;"><text class="tabbar_text" style="font-size:0.6rem">我的</text></view> | ||
| 105 | - </navigator> | ||
| 106 | - </block> | ||
| 107 | - <block wx:else> | ||
| 108 | - <view class="tabbar_item {{tabBar.clas}}" style="color: #f23030;position:relative;width:25%;height:100%;float:left;text-align:center;padding:2px 0;"> | ||
| 109 | - <view style="width:30%;height:54rpx;margin-left:35%;"> | ||
| 110 | - <image src="{{tabBar.url}}/miniapp/images/bar/user_on.png" class="img" style="width:100%;height:100%"></image> | ||
| 111 | - </view> | ||
| 112 | - <view style="height:40rpx;line-height:22rpx;"><text class="tabbar_text" style="font-size:0.6rem">我的</text></view> | ||
| 113 | - </view> | ||
| 114 | - </block> | ||
| 115 | - | ||
| 116 | - </view> | ||
| 117 | - </template> |
pages/tabbar/tabbar.wxss deleted
| 1 | -.menu_red{ | ||
| 2 | - | ||
| 3 | - top:0;background-color: red;color: #fff;font-size: 20rpx;border-radius: 50%;width: 40rpx;line-height:40rpx;height: 40rpx;position: absolute;z-index: 100;right:30rpx; | ||
| 4 | -} | ||
| 5 | - | ||
| 6 | -.menu_default_red{ | ||
| 7 | - background-color: red;color: #fff;font-size: 20rpx;border-radius: 50%;width: 40rpx;height: 40rpx;line-heith:40rpx;position: fixed;z-index: 100;left:63% | ||
| 8 | -} | ||
| 9 | \ No newline at end of file | 0 | \ No newline at end of file |
pages/team/team_show/team_show.js
| @@ -148,7 +148,7 @@ Page({ | @@ -148,7 +148,7 @@ Page({ | ||
| 148 | //--先判断会员状态-- | 148 | //--先判断会员状态-- |
| 149 | var user_info=getApp().globalData.userInfo; | 149 | var user_info=getApp().globalData.userInfo; |
| 150 | if(user_info==null || user_info.mobile==undefined || user_info.mobile=="" || user_info.mobile==null){ | 150 | if(user_info==null || user_info.mobile==undefined || user_info.mobile=="" || user_info.mobile==null){ |
| 151 | - wx.navigateTo({ url: '/pages/getphone/getphone', }) | 151 | + wx.navigateTo({ url: '/pages/togoin/togoin', }) |
| 152 | return false; | 152 | return false; |
| 153 | } | 153 | } |
| 154 | 154 | ||
| @@ -705,141 +705,7 @@ Page({ | @@ -705,141 +705,7 @@ Page({ | ||
| 705 | }); | 705 | }); |
| 706 | setTimeout(th.countDown2, 1000); | 706 | setTimeout(th.countDown2, 1000); |
| 707 | }, | 707 | }, |
| 708 | - //--获取门店--- | ||
| 709 | - async get_sto(e) { | ||
| 710 | - var th = this, dd = null,i=getApp().request; | ||
| 711 | - var g_distr_type = this.data.goods.distr_type; | ||
| 712 | - if (g_distr_type != 0) { | ||
| 713 | - dd = { | ||
| 714 | - store_id: o.stoid, | ||
| 715 | - distr_type: g_distr_type, | ||
| 716 | - isstop: 0, | ||
| 717 | - pageSize: 300 | ||
| 718 | - } | ||
| 719 | - } else { | ||
| 720 | - dd = { | ||
| 721 | - store_id: o.stoid, | ||
| 722 | - isstop: 0, | ||
| 723 | - pageSize: 300 | ||
| 724 | - } | ||
| 725 | - } | ||
| 726 | - //----------获取门店---------------- | ||
| 727 | - await getApp().request.promiseGet("/api/weshop/pickup/list", { | ||
| 728 | - data: dd, | ||
| 729 | - }).then(res => { | ||
| 730 | - var e = res; | ||
| 731 | - if (e.data.code == 0) { | ||
| 732 | - //单总量超出5个的时候 | ||
| 733 | - if (e.data.data.total > 5) { | ||
| 734 | - i.get("/api/weshop/storagecategory/page", { | ||
| 735 | - data: { | ||
| 736 | - store_id: o.stoid, | ||
| 737 | - is_show: 1, | ||
| 738 | - pageSize: 300 | ||
| 739 | - }, | ||
| 740 | - success: function(ee) { | ||
| 741 | - if (ee.data.code == 0) { | ||
| 742 | - if (ee.data.data.pageData.length > 0) { | ||
| 743 | - var sto_cate = ee.data.data.pageData; | ||
| 744 | - var sto_arr = e.data.data.pageData; | ||
| 745 | - var newarr = new Array(); | ||
| 746 | - var qita = new Array(); | ||
| 747 | - //----要进行门店分组-------- | ||
| 748 | - for (var i = 0; i < sto_arr.length; i++) { | ||
| 749 | - //找一下这个门店有没有在分类数组内 | ||
| 750 | - var find2 = 0, | ||
| 751 | - find2name = ""; | ||
| 752 | - for (var m = 0; m < sto_cate.length; m++) { | ||
| 753 | - if (sto_arr[i].category_id == sto_cate[m].cat_id) { | ||
| 754 | - find2 = sto_cate[m].cat_id; | ||
| 755 | - find2name = sto_cate[m].cat_name; | ||
| 756 | - break; | ||
| 757 | - } | ||
| 758 | - } | ||
| 759 | - | ||
| 760 | - if (newarr.length > 0) { | ||
| 761 | - var find = 0; | ||
| 762 | - //如果有找到,那门店就在这个分组内,否则,分类就要排在其他 | ||
| 763 | - if (find2 != 0) { | ||
| 764 | - for (var ii = 0; ii < newarr.length; ii++) { | ||
| 765 | - if (sto_arr[i].category_id == newarr[ii].cat_id) { | ||
| 766 | - newarr[ii].s_arr.push(sto_arr[i]); | ||
| 767 | - find = 1; | ||
| 768 | - break; | ||
| 769 | - } | ||
| 770 | - } | ||
| 771 | - if (find == 0) { | ||
| 772 | - var arr0 = new Array(); | ||
| 773 | - arr0.push(sto_arr[i]); | ||
| 774 | - var item = { | ||
| 775 | - cat_id: find2, | ||
| 776 | - name: find2name, | ||
| 777 | - s_arr: arr0 | ||
| 778 | - }; | ||
| 779 | - newarr.push(item); | ||
| 780 | - } | ||
| 781 | - } else { | ||
| 782 | - qita.push(sto_arr[i]); | ||
| 783 | - } | ||
| 784 | - } else { | ||
| 785 | - //如果有找到,那门店就在这个分组内,否则,分类就要排在其他 | ||
| 786 | - if (find2 != 0) { | ||
| 787 | - var arr0 = new Array(); | ||
| 788 | - arr0.push(sto_arr[i]); | ||
| 789 | - var item = { | ||
| 790 | - cat_id: find2, | ||
| 791 | - name: find2name, | ||
| 792 | - s_arr: arr0 | ||
| 793 | - }; | ||
| 794 | - newarr.push(item); | ||
| 795 | - } else { | ||
| 796 | - qita.push(sto_arr[i]); | ||
| 797 | - } | ||
| 798 | - } | ||
| 799 | - } | ||
| 800 | - | ||
| 801 | - //----安排其他的分类----- | ||
| 802 | - if (qita.length > 0) { | ||
| 803 | - var item = { | ||
| 804 | - cat_id: -1, | ||
| 805 | - name: "其他", | ||
| 806 | - s_arr: qita | ||
| 807 | - }; | ||
| 808 | - newarr.push(item); | ||
| 809 | - } | ||
| 810 | - //--给门店赋值-- | ||
| 811 | - th.setData({ | ||
| 812 | - is_show_sto_cat: 1, | ||
| 813 | - ssl: newarr | ||
| 814 | - }); | ||
| 815 | - | ||
| 816 | - } else { | ||
| 817 | - //--只留第二层--- | ||
| 818 | - th.setData({ | ||
| 819 | - is_show_sto_cat: 0, | ||
| 820 | - ssl_child: e.data.data.pageData, | ||
| 821 | - }); | ||
| 822 | - } | ||
| 823 | - } else { | ||
| 824 | - //--只留第二层--- | ||
| 825 | - th.setData({ | ||
| 826 | - is_show_sto_cat: 0, | ||
| 827 | - ssl_child: e.data.data.pageData, | ||
| 828 | - }); | ||
| 829 | - } | ||
| 830 | - } | ||
| 831 | - }); | ||
| 832 | - } else { | ||
| 833 | - //--只留第二层--- | ||
| 834 | - th.setData({ | ||
| 835 | - is_show_sto_cat: 0, | ||
| 836 | - ssl_child: e.data.data.pageData | ||
| 837 | - }); | ||
| 838 | - } | ||
| 839 | - } | ||
| 840 | - }) | ||
| 841 | - }, | ||
| 842 | - | 708 | + |
| 843 | //------去支付,购买------- | 709 | //------去支付,购买------- |
| 844 | go_pay:function () { | 710 | go_pay:function () { |
| 845 | var th=this; | 711 | var th=this; |
| @@ -1105,7 +971,7 @@ Page({ | @@ -1105,7 +971,7 @@ Page({ | ||
| 1105 | 971 | ||
| 1106 | if (bconfig.is_sort_storage) { | 972 | if (bconfig.is_sort_storage) { |
| 1107 | wx.getLocation({ | 973 | wx.getLocation({ |
| 1108 | - type: 'wgs84', | 974 | + type: 'gcj02', |
| 1109 | success: function(res) { | 975 | success: function(res) { |
| 1110 | 976 | ||
| 1111 | th.data.lat = res.latitude; | 977 | th.data.lat = res.latitude; |
| @@ -1170,7 +1036,7 @@ Page({ | @@ -1170,7 +1036,7 @@ Page({ | ||
| 1170 | var e = th.data.bconfig; | 1036 | var e = th.data.bconfig; |
| 1171 | if (e.is_sort_storage) { | 1037 | if (e.is_sort_storage) { |
| 1172 | wx.getLocation({ | 1038 | wx.getLocation({ |
| 1173 | - type: 'wgs84', | 1039 | + type: 'gcj02', |
| 1174 | success: function(res) { | 1040 | success: function(res) { |
| 1175 | th.data.lat = res.latitude; | 1041 | th.data.lat = res.latitude; |
| 1176 | th.data.lon = res.longitude; | 1042 | th.data.lon = res.longitude; |
| @@ -1288,7 +1154,9 @@ Page({ | @@ -1288,7 +1154,9 @@ Page({ | ||
| 1288 | data: { | 1154 | data: { |
| 1289 | store_id: o.stoid, | 1155 | store_id: o.stoid, |
| 1290 | is_show: 1, | 1156 | is_show: 1, |
| 1291 | - pageSize: 1000 | 1157 | + pageSize: 1000, |
| 1158 | + orderField:"sort", | ||
| 1159 | + orderType:'asc', | ||
| 1292 | }, | 1160 | }, |
| 1293 | success: function(ee) { | 1161 | success: function(ee) { |
| 1294 | if (ee.data.code == 0) { | 1162 | if (ee.data.code == 0) { |
| @@ -1313,12 +1181,12 @@ Page({ | @@ -1313,12 +1181,12 @@ Page({ | ||
| 1313 | //----要进行门店分组-------- | 1181 | //----要进行门店分组-------- |
| 1314 | for (var i = 0; i < sto_arr.length; i++) { | 1182 | for (var i = 0; i < sto_arr.length; i++) { |
| 1315 | //找一下这个门店有没有在分类数组内 | 1183 | //找一下这个门店有没有在分类数组内 |
| 1316 | - var find2 = 0, | ||
| 1317 | - find2name = ""; | 1184 | + var find2 = 0,find2name = "",sort=0; |
| 1318 | for (var m = 0; m < sto_cate.length; m++) { | 1185 | for (var m = 0; m < sto_cate.length; m++) { |
| 1319 | if (sto_arr[i].category_id == sto_cate[m].cat_id) { | 1186 | if (sto_arr[i].category_id == sto_cate[m].cat_id) { |
| 1320 | find2 = sto_cate[m].cat_id; | 1187 | find2 = sto_cate[m].cat_id; |
| 1321 | find2name = sto_cate[m].cat_name; | 1188 | find2name = sto_cate[m].cat_name; |
| 1189 | + sort=sto_cate[m].sort; | ||
| 1322 | break; | 1190 | break; |
| 1323 | } | 1191 | } |
| 1324 | } | 1192 | } |
| @@ -1340,6 +1208,7 @@ Page({ | @@ -1340,6 +1208,7 @@ Page({ | ||
| 1340 | var item = { | 1208 | var item = { |
| 1341 | cat_id: find2, | 1209 | cat_id: find2, |
| 1342 | name: find2name, | 1210 | name: find2name, |
| 1211 | + sort:sort, | ||
| 1343 | s_arr: arr0 | 1212 | s_arr: arr0 |
| 1344 | }; | 1213 | }; |
| 1345 | newarr.push(item); | 1214 | newarr.push(item); |
| @@ -1355,6 +1224,7 @@ Page({ | @@ -1355,6 +1224,7 @@ Page({ | ||
| 1355 | var item = { | 1224 | var item = { |
| 1356 | cat_id: find2, | 1225 | cat_id: find2, |
| 1357 | name: find2name, | 1226 | name: find2name, |
| 1227 | + sort:sort, | ||
| 1358 | s_arr: arr0 | 1228 | s_arr: arr0 |
| 1359 | }; | 1229 | }; |
| 1360 | newarr.push(item); | 1230 | newarr.push(item); |
| @@ -1363,7 +1233,19 @@ Page({ | @@ -1363,7 +1233,19 @@ Page({ | ||
| 1363 | } | 1233 | } |
| 1364 | } | 1234 | } |
| 1365 | } | 1235 | } |
| 1366 | - | 1236 | + |
| 1237 | + //门店分类要排序下 | ||
| 1238 | + function compare(property){ | ||
| 1239 | + return function(a,b){ | ||
| 1240 | + var value1 = a[property]; | ||
| 1241 | + var value2 = b[property]; | ||
| 1242 | + return value1 - value2; | ||
| 1243 | + } | ||
| 1244 | + } | ||
| 1245 | + if(newarr.length>0) | ||
| 1246 | + newarr.sort(compare("sort")); | ||
| 1247 | + | ||
| 1248 | + | ||
| 1367 | //----安排其他的分类----- | 1249 | //----安排其他的分类----- |
| 1368 | if (qita.length > 0) { | 1250 | if (qita.length > 0) { |
| 1369 | var item = { | 1251 | var item = { |
pages/togoin/togoin.js
| 1 | -var t = require("../../utils/common.js"); var os = getApp().globalData.setting; | 1 | +var t = require("../../utils/common.js"); |
| 2 | +var app=getApp(); | ||
| 3 | +var os = app.globalData.setting; | ||
| 4 | + | ||
| 2 | Page({ | 5 | Page({ |
| 3 | - data: { | ||
| 4 | - store: null, | ||
| 5 | - imghots: os.imghost, | ||
| 6 | - }, | ||
| 7 | - onLoad: function () { | ||
| 8 | - var th = this, app = getApp(); | ||
| 9 | - app.getConfig(function (e) { | ||
| 10 | - th.setData({ store: e }); | ||
| 11 | - }) | ||
| 12 | - }, | ||
| 13 | - onShow(){ | 6 | + data: { |
| 7 | + user:null, | ||
| 8 | + show_bind:0, | ||
| 9 | + imghots: os.imghost, | ||
| 10 | + store_logo:'', | ||
| 11 | + first_leader:'', //-- 邀请人 -- | ||
| 12 | + }, | ||
| 13 | + onLoad: function (options) { | ||
| 14 | + //--判断是否有接受到邀请人的ID-- | ||
| 15 | + if(options.first_leader){ | ||
| 16 | + this.setData({first_leader:options.first_leader}); | ||
| 17 | + } | ||
| 18 | + var th=this; | ||
| 19 | + app.getConfig(function (e) { | ||
| 20 | + e.store_logo=th.data.imghots+e.store_logo; | ||
| 21 | + th.setData({ store: e,store_logo:e.store_logo}); | ||
| 22 | + }) | ||
| 23 | + }, | ||
| 24 | + //绑定手机号 | ||
| 25 | + getphone:function (e) { | ||
| 26 | + //接下来写业务代码登录 | ||
| 27 | + e=e.detail; | ||
| 28 | + if (e.encryptedData==undefined){ | ||
| 29 | + return app.my_warnning("登录需要授权手机号码!", 0, this); | ||
| 30 | + return false; | ||
| 31 | + } | ||
| 32 | + var th=this; | ||
| 33 | + var sessionKey = getApp().globalData.sessionKey; | ||
| 34 | + var openid = getApp().globalData.openid; | ||
| 35 | + var r=getApp().globalData.getu; | ||
| 36 | + | ||
| 37 | + th.save_the_data(r,e,sessionKey,openid) | ||
| 38 | + }, | ||
| 14 | 39 | ||
| 15 | - }, | 40 | + //-- 会员授权 -- |
| 41 | + bindGetUserInfo: function(ee) { | ||
| 42 | + var that = this; | ||
| 43 | + var user=ee.detail.userInfo; | ||
| 44 | + //此处授权得到userInfo | ||
| 45 | + getApp().globalData.getu = user; | ||
| 46 | + | ||
| 47 | + //--拿下code-- | ||
| 48 | + wx.login({ | ||
| 49 | + success: function (o) { | ||
| 50 | + var dd = { | ||
| 51 | + js_code:o.code, | ||
| 52 | + store_id: os.stoid, | ||
| 53 | + nickname: app.clear_word(app.globalData.getu.nickName), | ||
| 54 | + head_pic: app.clear_word(app.globalData.getu.avatarUrl) | ||
| 55 | + }; | ||
| 56 | + | ||
| 57 | + | ||
| 58 | + getApp().request.get("/api/weshop/users/openidandkey", { | ||
| 59 | + data: dd, | ||
| 60 | + success: function (e) { | ||
| 61 | + if(e.data.code==0){ | ||
| 62 | + that.setData({user:user}) | ||
| 63 | + //如果有会员的话,没有sessionKey | ||
| 64 | + if(!e.data.data.sessionKey){ | ||
| 65 | + getApp().showWarning("登陆成功"); | ||
| 66 | + getApp().globalData.userInfo=e.data.data; | ||
| 67 | + getApp().globalData.user_id=e.data.data.user_id; | ||
| 68 | + getApp().globalData.openid = e.data.data.weapp_openid; | ||
| 69 | + | ||
| 70 | + setTimeout(function () { | ||
| 71 | + wx.navigateBack({ delta: 1}) //返回上一页 | ||
| 72 | + },1000) | ||
| 73 | + }else{ | ||
| 74 | + getApp().globalData.sessionKey=e.data.data.sessionKey; | ||
| 75 | + getApp().globalData.openid=e.data.data.openid;; | ||
| 76 | + that.setData({show_bind:1}) | ||
| 77 | + } | ||
| 78 | + }else{ | ||
| 79 | + getApp().confirmBox(e.data.msg); | ||
| 80 | + } | ||
| 81 | + } | ||
| 82 | + }); | ||
| 83 | + } | ||
| 84 | + }) | ||
| 85 | + }, | ||
| 86 | + | ||
| 87 | + //暂不登陆,返回上一页 | ||
| 88 | + cancle_bind:function () { | ||
| 89 | + wx.navigateBack({ delta: 1}) | ||
| 90 | + }, | ||
| 91 | + | ||
| 92 | + close_pop:function(){ | ||
| 93 | + this.setData({show_bind:0}) | ||
| 94 | + }, | ||
| 95 | + show_bind_mobile:function(){ | ||
| 96 | + this.setData({show_bind:1}) | ||
| 97 | + }, | ||
| 98 | + | ||
| 99 | + save_the_data:function (r,e,sessionKey,openid) { | ||
| 100 | + var app=getApp(),a=app,th=this; | ||
| 101 | + var dd = { | ||
| 102 | + oauth: "miniapp", | ||
| 103 | + nickname:a.clear_word(r.nickName), | ||
| 104 | + head_pic: r.avatarUrl, | ||
| 105 | + sex: r.gender, | ||
| 106 | + terminal: "miniapp", | ||
| 107 | + sessionKey: sessionKey, | ||
| 108 | + openid:openid, | ||
| 109 | + encryptedData: e.encryptedData, | ||
| 110 | + iv: e.iv, | ||
| 111 | + store_id: getApp().globalData.setting.stoid, | ||
| 112 | + }; | ||
| 113 | + //--如果有邀请人的时候-- | ||
| 114 | + if(th.data.first_leader){ | ||
| 115 | + dd.first_leader=th.data.first_leader; | ||
| 116 | + } | ||
| 117 | + | ||
| 118 | + console.log(dd); | ||
| 119 | + app.request.get("/api/weshop/users/thirdLogin", { | ||
| 120 | + data: dd, | ||
| 121 | + success: function (e) { | ||
| 122 | + | ||
| 123 | + if (e.data.code == 0) { | ||
| 124 | + app.globalData.user_id = e.data.data.user_id; | ||
| 125 | + } else { | ||
| 126 | + return app.showWarning("授权登入失败!"+e.data.msg); | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + wx.setStorageSync("userinfo",e.data.data); | ||
| 130 | + wx.setStorageSync("isAuth", !0), app.globalData.userInfo = e.data.data, app.globalData.userInfo.head_pic = t.getFullUrl(a.globalData.userInfo.head_pic); | ||
| 131 | + wx.navigateBack({ delta: 1}) | ||
| 132 | + | ||
| 133 | + }, | ||
| 134 | + failStatus: function (t) { | ||
| 135 | + return app.my_warnning("授权登入失败,请稍后再试!", 0, that); | ||
| 136 | + }, | ||
| 137 | + fail: function (t) { | ||
| 138 | + return i.clearAuth(), i.alertLoginErrorAndGoHome(), !1; | ||
| 139 | + } | ||
| 140 | + }); | ||
| 141 | + }, | ||
| 16 | 142 | ||
| 17 | - bindGetUserInfo: function(e) { | ||
| 18 | - var that = this, app = getApp(); | ||
| 19 | - //此处授权得到userInfo | ||
| 20 | - console.log(e.detail.userInfo); | ||
| 21 | - app.globalData.getu = e.detail.userInfo; | 143 | + bind_bnerr:function(e){ |
| 144 | + var _errImg = e.target.dataset.errorimg; | ||
| 145 | + var _errObj = {}; | ||
| 146 | + _errObj[_errImg] = this.data.imghots+"/miniapp/images/logo.png"; | ||
| 147 | + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; | ||
| 148 | + } | ||
| 22 | 149 | ||
| 23 | - //接下来写业务代码 | ||
| 24 | - //最后,记得返回刚才的页面 | ||
| 25 | - app.auth.wxLogin_fir(function(){ | ||
| 26 | - console.log("togoin"); | ||
| 27 | - console.log("1"); | ||
| 28 | - wx.navigateBack({ | ||
| 29 | - delta: 1 | ||
| 30 | - }) | ||
| 31 | - }) | ||
| 32 | - | ||
| 33 | - }, | ||
| 34 | - | ||
| 35 | - cancle_bind:function(){ | ||
| 36 | - getApp().goto('/pages/user/index/index'); | ||
| 37 | - } | ||
| 38 | - | ||
| 39 | - | ||
| 40 | -}); | 150 | +}) |
pages/togoin/togoin.json
pages/togoin/togoin.wxml
| 1 | -<view class="all_page"> | ||
| 2 | - <view class="content"> | ||
| 3 | - <view><image class='logo' src="{{imghots+store.store_logo}}"> </image></view> | ||
| 4 | - <view class="title">{{store.store_name}}</view> | ||
| 5 | - <view style="padding:0 40rpx">为了更好的提供服务,小程序将申请获取您的头像,昵称信息</view> | ||
| 6 | - <button class="btn" open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo">授权登录</button> | ||
| 7 | - <text class="btn2" bindtap="cancle_bind">暂不授权</text> | 1 | +<view> |
| 2 | + | ||
| 3 | + <!-- 登录图 --> | ||
| 4 | + <view > | ||
| 5 | + <view class="logins flex-center2 ali-c flex" style="position: relative;top: 120rpx;"> | ||
| 6 | + <image mode="widthFix" bindtap="go_index" class="login_img_back" src="{{imghots}}/miniapp/images/loginbg.jpg"></image> | ||
| 7 | + <image bindtap="go_index" class="login_img" src="{{store_logo}}" binderror="bind_bnerr" lazy-load="true" data-errorimg="store_logo"></image> | ||
| 8 | + <view style="position: absolute; margin-top:140rpx">{{store.store_name}}</view> | ||
| 9 | + </view> | ||
| 8 | </view> | 10 | </view> |
| 9 | -</view> | ||
| 10 | \ No newline at end of file | 11 | \ No newline at end of file |
| 12 | + | ||
| 13 | + <!-- 登录按钮 --> | ||
| 14 | + <view> | ||
| 15 | + <view class="phones"> | ||
| 16 | + <!-- 授权获取基础信息 --> | ||
| 17 | + <button hidden="{{user}}" class="getPhoneNumber" open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo"> | ||
| 18 | + <view class="flex flex-center2 ali-c"> | ||
| 19 | + <image class="we_chat" src="{{imghots}}/miniapp/images/we_chat.png"></image> | ||
| 20 | + <view>微信账号快捷登陆</view> | ||
| 21 | + </view> | ||
| 22 | + </button> | ||
| 23 | + <!-- 点击显示绑定手机的对话框 --> | ||
| 24 | + <button hidden="{{!user}}" class="getPhoneNumber" bindtap="show_bind_mobile"> | ||
| 25 | + <view class="flex flex-center2 ali-c" > | ||
| 26 | + <image class="we_chat" src="{{imghots}}/miniapp/images/we_chat.png"></image> | ||
| 27 | + <view>微信账号快捷登陆</view> | ||
| 28 | + </view> | ||
| 29 | + </button> | ||
| 30 | + </view> | ||
| 31 | + | ||
| 32 | + <view class="userlongin flex-center2 flex fs30 jc_sb" style="margin: 0 130rpx"> | ||
| 33 | + <view bindtap="cancle_bind">暂不登陆</view> | ||
| 34 | + </view> | ||
| 35 | + | ||
| 36 | + </view> | ||
| 37 | + | ||
| 38 | +</view> | ||
| 39 | + | ||
| 40 | + | ||
| 41 | +<view wx:if="{{show_bind}}"> | ||
| 42 | + <view class="cover-layer" bindtap="close_pop"></view> | ||
| 43 | + <view class="p_content"> | ||
| 44 | + <view class="p_title flex ali-c fs34"> | ||
| 45 | + 请授权绑定手机号完成注册,拒绝将登陆失败 | ||
| 46 | + </view> | ||
| 47 | + <view class="flex btn_view"> | ||
| 48 | + <view bindtap="close_pop" style="height: 100%; line-height:normal;" class="txt-center f2 flex ali-c flex-center2 fs36 b_right">拒绝</view> | ||
| 49 | + <button style="height: 100%;" class="g_mobile f2 flex ali-c flex-center2 fs36 txt-red" open-type="getPhoneNumber" bindgetphonenumber="getphone">绑定</button> | ||
| 50 | + </view> | ||
| 51 | + </view> | ||
| 52 | +</view> | ||
| 53 | + | ||
| 54 | +<warn id="warn"></warn> |
pages/togoin/togoin.wxss
| 1 | -.all_page{ | ||
| 2 | - position: fixed; | ||
| 3 | - height: 100%; | ||
| 4 | - width: 100%; | ||
| 5 | - background: #fff; | ||
| 6 | - justify-content: center;/*水平居中*/ | 1 | +page{ |
| 2 | + border-top: 3rpx solid #EAEAEC; | ||
| 3 | + background-color: #fff; | ||
| 7 | } | 4 | } |
| 8 | -.all_page .content{ | ||
| 9 | - font-size: 30rpx; | ||
| 10 | - text-align: center; | ||
| 11 | - height: 400px; | 5 | +.logins { |
| 12 | width: 100%; | 6 | width: 100%; |
| 13 | - position: absolute; | ||
| 14 | - top: 50%; | ||
| 15 | - margin-top:-200px; | ||
| 16 | -} | ||
| 17 | -.logo{width: 140rpx; height: 140rpx; border-radius:50% } | ||
| 18 | -.all_page .content .title{ | ||
| 19 | - font-size: 36rpx; margin: 20rpx 0 | 7 | + padding-bottom: 130rpx; |
| 8 | + background-position: center; | ||
| 9 | + background-repeat: no-repeat; | ||
| 10 | + background-size: cover | ||
| 20 | } | 11 | } |
| 21 | 12 | ||
| 22 | -.all_page .btn{ | ||
| 23 | - height: 80rpx; | ||
| 24 | - line-height: 80rpx; | ||
| 25 | - width: 580rpx; | ||
| 26 | - background: #fc661f; | ||
| 27 | - color:#fff; | ||
| 28 | - font-size: 32rpx; | ||
| 29 | - margin-top: 100rpx; | ||
| 30 | - border-radius: 5rpx; | 13 | +.login_img { |
| 14 | + width: 192rpx; | ||
| 15 | + height: 192rpx; | ||
| 16 | + border-radius: 50%; | ||
| 17 | + position: absolute; | ||
| 18 | +} | ||
| 19 | +.phones{ | ||
| 20 | + margin-bottom: 48rpx; | ||
| 21 | +} | ||
| 22 | +.getPhoneNumber { | ||
| 23 | + width: 600rpx; | ||
| 24 | + height: 94rpx; | ||
| 25 | + line-height: 94rpx; | ||
| 26 | + background-color: #57b837; | ||
| 27 | + border-radius: 48rpx; | ||
| 28 | + color: rgb(255,255,255); | ||
| 29 | + font-size: 32rpx; | ||
| 30 | + margin-top:150rpx; | ||
| 31 | +} | ||
| 32 | +.we_chat{ | ||
| 33 | + width: 55rpx; | ||
| 34 | + height: 45rpx; | ||
| 35 | + margin-right: 15rpx; | ||
| 36 | +} | ||
| 37 | +.userlongin{ | ||
| 38 | + color: #767f8e; | ||
| 39 | +} | ||
| 40 | +button{ | ||
| 41 | + border:none; | ||
| 42 | +} | ||
| 43 | +.login_img_back{ width: 100%;} | ||
| 44 | +.p_content{ | ||
| 45 | + margin: 10%; | ||
| 46 | + width: 80%; | ||
| 47 | + height:340rpx; | ||
| 48 | + top:50%; | ||
| 49 | + margin-top: -180rpx; | ||
| 50 | + background-color: #fff; | ||
| 51 | + z-index: 12; | ||
| 52 | + position: fixed; | ||
| 31 | } | 53 | } |
| 32 | 54 | ||
| 33 | -.all_page .btn2{ | ||
| 34 | - height: 80rpx; | ||
| 35 | - line-height: 80rpx; | ||
| 36 | - width: 580rpx; | ||
| 37 | - | ||
| 38 | - color:#999; | ||
| 39 | - font-size: 32rpx; | ||
| 40 | - border-radius: 5rpx; | ||
| 41 | - margin-top: 10rpx; | ||
| 42 | -} | ||
| 43 | \ No newline at end of file | 55 | \ No newline at end of file |
| 56 | +.btn_view { height: 120rpx; line-height: 120rpx; border-top:1rpx solid #e9e9e9;} | ||
| 57 | +.p_title{ height:220rpx; padding: 0 40rpx; line-height: 50rpx;} | ||
| 58 | +.g_mobile{ background: none;line-height: normal;} | ||
| 59 | +.b_right{border-right:1rpx solid #e9e9e9;} | ||
| 60 | + | ||
| 61 | +.ali-c{align-items: center;} | ||
| 62 | +.flex-center2{ justify-content: center;} | ||
| 63 | +.f2 { | ||
| 64 | + flex: 2 0; | ||
| 65 | +} |
pages/user/assistance/assistance.js
| @@ -49,7 +49,7 @@ Page({ | @@ -49,7 +49,7 @@ Page({ | ||
| 49 | //--先判断会员状态-- | 49 | //--先判断会员状态-- |
| 50 | var user_info = getApp().globalData.userInfo; | 50 | var user_info = getApp().globalData.userInfo; |
| 51 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | 51 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { |
| 52 | - getApp().goto('/pages/getphone/getphone'); | 52 | + getApp().goto('/pages/togoin/togoin'); |
| 53 | return false; | 53 | return false; |
| 54 | } | 54 | } |
| 55 | 55 |
pages/user/assistance/friend_assistance.js
| @@ -57,7 +57,7 @@ Page({ | @@ -57,7 +57,7 @@ Page({ | ||
| 57 | //--先判断会员状态-- | 57 | //--先判断会员状态-- |
| 58 | var user_info = getApp().globalData.userInfo; | 58 | var user_info = getApp().globalData.userInfo; |
| 59 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | 59 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { |
| 60 | - getApp().goto('/pages/getphone/getphone'); | 60 | + getApp().goto('/pages/togoin/togoin'); |
| 61 | return false; | 61 | return false; |
| 62 | } | 62 | } |
| 63 | 63 | ||
| @@ -117,7 +117,7 @@ Page({ | @@ -117,7 +117,7 @@ Page({ | ||
| 117 | var user_info = getApp().globalData.userInfo; | 117 | var user_info = getApp().globalData.userInfo; |
| 118 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | 118 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { |
| 119 | wx.navigateTo({ | 119 | wx.navigateTo({ |
| 120 | - url: '/pages/getphone/getphone', | 120 | + url: '/pages/togoin/togoin', |
| 121 | }) | 121 | }) |
| 122 | return false; | 122 | return false; |
| 123 | } | 123 | } |
pages/user/assistance/giftpacklist.js
| @@ -71,7 +71,7 @@ Page({ | @@ -71,7 +71,7 @@ Page({ | ||
| 71 | //--先判断会员状态-- | 71 | //--先判断会员状态-- |
| 72 | var user_info = getApp().globalData.userInfo; | 72 | var user_info = getApp().globalData.userInfo; |
| 73 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | 73 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { |
| 74 | - getApp().goto('/pages/getphone/getphone'); | 74 | + getApp().goto('/pages/togoin/togoin'); |
| 75 | return false; | 75 | return false; |
| 76 | } | 76 | } |
| 77 | 77 |
pages/user/assistance/task_assistance.js
| @@ -143,7 +143,7 @@ Page({ | @@ -143,7 +143,7 @@ Page({ | ||
| 143 | //--先判断会员状态-- | 143 | //--先判断会员状态-- |
| 144 | var user_info = getApp().globalData.userInfo; | 144 | var user_info = getApp().globalData.userInfo; |
| 145 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | 145 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { |
| 146 | - getApp().goto('/pages/getphone/getphone'); | 146 | + getApp().goto('/pages/togoin/togoin'); |
| 147 | return false; | 147 | return false; |
| 148 | } | 148 | } |
| 149 | 149 |
pages/user/cardinfo/cardinfo.js
| @@ -53,7 +53,7 @@ Page({ | @@ -53,7 +53,7 @@ Page({ | ||
| 53 | //--先判断会员状态-- | 53 | //--先判断会员状态-- |
| 54 | var user_info = getApp().globalData.userInfo; | 54 | var user_info = getApp().globalData.userInfo; |
| 55 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | 55 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { |
| 56 | - wx.navigateTo({ url: '/pages/getphone/getphone' }) | 56 | + wx.navigateTo({ url: '/pages/togoin/togoin' }) |
| 57 | return false; | 57 | return false; |
| 58 | } | 58 | } |
| 59 | 59 |
pages/user/coupons/coupons.js
| @@ -156,7 +156,7 @@ Page({ | @@ -156,7 +156,7 @@ Page({ | ||
| 156 | //--先判断会员状态-- | 156 | //--先判断会员状态-- |
| 157 | var user_info = getApp().globalData.userInfo; | 157 | var user_info = getApp().globalData.userInfo; |
| 158 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | 158 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { |
| 159 | - wx.navigateTo({ url: '/pages/getphone/getphone', }) | 159 | + wx.navigateTo({ url: '/pages/togoin/togoin', }) |
| 160 | return false; | 160 | return false; |
| 161 | } | 161 | } |
| 162 | this.init(th.myyhj,th.s_guoqi); | 162 | this.init(th.myyhj,th.s_guoqi); |
pages/user/deposit/deposit.js
| @@ -20,7 +20,7 @@ Page({ | @@ -20,7 +20,7 @@ Page({ | ||
| 20 | // --先判断会员状态-- | 20 | // --先判断会员状态-- |
| 21 | var user_info = getApp().globalData.userInfo; | 21 | var user_info = getApp().globalData.userInfo; |
| 22 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | 22 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { |
| 23 | - wx.navigateTo({ url: '/pages/getphone/getphone', }) | 23 | + wx.navigateTo({ url: '/pages/togoin/togoin', }) |
| 24 | return false; | 24 | return false; |
| 25 | } | 25 | } |
| 26 | wx.setNavigationBarTitle({ | 26 | wx.setNavigationBarTitle({ |
pages/user/index/index.js
| @@ -41,6 +41,7 @@ Page({ | @@ -41,6 +41,7 @@ Page({ | ||
| 41 | actImg: "", | 41 | actImg: "", |
| 42 | is_assistance: 0, //助力活动 | 42 | is_assistance: 0, //助力活动 |
| 43 | ad_img:"", | 43 | ad_img:"", |
| 44 | + add_card_data:'', //等级卡的内容 | ||
| 44 | }, | 45 | }, |
| 45 | goto_nav: function(e) { | 46 | goto_nav: function(e) { |
| 46 | var th = this; | 47 | var th = this; |
| @@ -49,7 +50,7 @@ Page({ | @@ -49,7 +50,7 @@ Page({ | ||
| 49 | getApp().goto(url); | 50 | getApp().goto(url); |
| 50 | } else { | 51 | } else { |
| 51 | wx.navigateTo({ | 52 | wx.navigateTo({ |
| 52 | - url: '/pages/getphone/getphone', | 53 | + url: '/pages/togoin/togoin', |
| 53 | }) | 54 | }) |
| 54 | } | 55 | } |
| 55 | }, | 56 | }, |
| @@ -70,14 +71,17 @@ Page({ | @@ -70,14 +71,17 @@ Page({ | ||
| 70 | th.setData({ad_img:item.ad_code}) | 71 | th.setData({ad_img:item.ad_code}) |
| 71 | } | 72 | } |
| 72 | }) | 73 | }) |
| 74 | + | ||
| 75 | + app.getUserFir(); | ||
| 76 | + | ||
| 77 | + | ||
| 73 | }, | 78 | }, |
| 74 | 79 | ||
| 75 | /** | 80 | /** |
| 76 | * 生命周期函数--监听页面显示 | 81 | * 生命周期函数--监听页面显示 |
| 77 | */ | 82 | */ |
| 78 | onShow: function() { | 83 | onShow: function() { |
| 79 | - | ||
| 80 | - | 84 | + |
| 81 | if (typeof this.getTabBar === 'function' && this.getTabBar()) { | 85 | if (typeof this.getTabBar === 'function' && this.getTabBar()) { |
| 82 | var index=getApp().getPageIndex(this); | 86 | var index=getApp().getPageIndex(this); |
| 83 | this.getTabBar().setData({ | 87 | this.getTabBar().setData({ |
| @@ -100,11 +104,27 @@ Page({ | @@ -100,11 +104,27 @@ Page({ | ||
| 100 | if (getApp().globalData.user_id) getApp().requestCardNum(th); | 104 | if (getApp().globalData.user_id) getApp().requestCardNum(th); |
| 101 | },500) | 105 | },500) |
| 102 | /*------会员登录------*/ | 106 | /*------会员登录------*/ |
| 103 | - app.getUserFir(async function(e) { | ||
| 104 | - if (e != undefined && e != null && e.mobile) { | 107 | + var e=getApp().globalData.userInfo; |
| 108 | + | ||
| 109 | + if (e != undefined && e != null && e.mobile) { | ||
| 105 | s.setData({ | 110 | s.setData({ |
| 106 | userInfo: e | 111 | userInfo: e |
| 107 | }); | 112 | }); |
| 113 | + | ||
| 114 | + //-- 要调用接口,获取卡的钱 -- | ||
| 115 | + var url="/api/weshop/wxuser/getWxCardInfo?storeId="+os.stoid+"&userId="+e.user_id; | ||
| 116 | + rq.get(url,{ | ||
| 117 | + success: function(su) { | ||
| 118 | + if(su.data.code==0){ | ||
| 119 | + s.setData({ | ||
| 120 | + add_card_data: su.data.data, | ||
| 121 | + }); | ||
| 122 | + } | ||
| 123 | + } | ||
| 124 | + }); | ||
| 125 | + | ||
| 126 | + | ||
| 127 | + | ||
| 108 | /*-----统计-----*/ | 128 | /*-----统计-----*/ |
| 109 | rq.get("/api/weshop/order/waitlist", { | 129 | rq.get("/api/weshop/order/waitlist", { |
| 110 | data: { | 130 | data: { |
| @@ -312,7 +332,6 @@ Page({ | @@ -312,7 +332,6 @@ Page({ | ||
| 312 | //th.requestRecommend(); | 332 | //th.requestRecommend(); |
| 313 | 333 | ||
| 314 | } | 334 | } |
| 315 | - }); | ||
| 316 | 335 | ||
| 317 | var goods_list = this.selectComponent("#goods_recommend"); //组件的id | 336 | var goods_list = this.selectComponent("#goods_recommend"); //组件的id |
| 318 | goods_list.init(); | 337 | goods_list.init(); |
| @@ -416,7 +435,7 @@ Page({ | @@ -416,7 +435,7 @@ Page({ | ||
| 416 | //--跳到绑定页面-- | 435 | //--跳到绑定页面-- |
| 417 | gobindtel: function() { | 436 | gobindtel: function() { |
| 418 | wx.navigateTo({ | 437 | wx.navigateTo({ |
| 419 | - url: '/pages/getphone/getphone', | 438 | + url: '/pages/togoin/togoin', |
| 420 | }) | 439 | }) |
| 421 | }, | 440 | }, |
| 422 | 441 | ||
| @@ -655,6 +674,37 @@ Page({ | @@ -655,6 +674,37 @@ Page({ | ||
| 655 | if(!url || url=='') return; | 674 | if(!url || url=='') return; |
| 656 | if(url[0]!='/') url='/'+url; | 675 | if(url[0]!='/') url='/'+url; |
| 657 | getApp().goto(url); | 676 | getApp().goto(url); |
| 677 | + }, | ||
| 678 | + | ||
| 679 | + //添加卡包 | ||
| 680 | + addcard:function(){ | ||
| 681 | + var res=this.data.add_card_data; | ||
| 682 | + var arr = new Array(6) | ||
| 683 | + arr[0] = res.code; | ||
| 684 | + arr[1] = res.timestamp; | ||
| 685 | + arr[2] = res.jsapiTicket; | ||
| 686 | + arr[3] = res.openid; | ||
| 687 | + arr[4] = res.cardid; | ||
| 688 | + arr[5] = res.nonceStr; | ||
| 689 | + var c=arr.sort(); | ||
| 690 | + var newstr=""; | ||
| 691 | + for (var i=0;i<c.length;i++) | ||
| 692 | + { | ||
| 693 | + newstr+=c[i]; | ||
| 694 | + } | ||
| 695 | + | ||
| 696 | + var sh1= ut.sha1(newstr); | ||
| 697 | + wx.addCard({ | ||
| 698 | + cardList: [ | ||
| 699 | + { | ||
| 700 | + cardId: res.cardid, | ||
| 701 | + cardExt: '{"code": "'+res.code+'", "openid": "'+res.openid+'","timestamp": "' + res.timestamp + '","nonce_str":"' + res.nonceStr + '","outer_str":"web", "signature":"' + sh1 + '"}' | ||
| 702 | + } | ||
| 703 | + | ||
| 704 | + ], | ||
| 705 | + success: function (res) {}, | ||
| 706 | + cancel: function (res) {} | ||
| 707 | + }); | ||
| 658 | } | 708 | } |
| 659 | 709 | ||
| 660 | }) | 710 | }) |
pages/user/index/index.wxml
| @@ -244,6 +244,13 @@ | @@ -244,6 +244,13 @@ | ||
| 244 | <image class="xc-center-img " src="{{iurl}}/miniapp/images/add2.png"></image> | 244 | <image class="xc-center-img " src="{{iurl}}/miniapp/images/add2.png"></image> |
| 245 | <view class="four-level-word">我的地址</view> | 245 | <view class="four-level-word">我的地址</view> |
| 246 | </view> | 246 | </view> |
| 247 | + | ||
| 248 | + <!-- 收入卡包 --> | ||
| 249 | + <view class="item t-c" bindtap="addcard" wx:if="{{add_card_data}}"> | ||
| 250 | + <image class="xc-center-img " src="{{iurl}}//miniapp/images/wx_cardbag.png"></image> | ||
| 251 | + <view class="four-level-word">收入卡包</view> | ||
| 252 | + </view> | ||
| 253 | + | ||
| 247 | <view class="item t-c" data-url="/pages/user/my_service/i_service" bindtap="goto_nav" > | 254 | <view class="item t-c" data-url="/pages/user/my_service/i_service" bindtap="goto_nav" > |
| 248 | <image class="xc-center-img " src="{{iurl}}/miniapp/images/yyservice/myservice.png"></image> | 255 | <image class="xc-center-img " src="{{iurl}}/miniapp/images/yyservice/myservice.png"></image> |
| 249 | <view class="four-level-word">我的服务</view> | 256 | <view class="four-level-word">我的服务</view> |
pages/user/integral/integral.js
| @@ -279,7 +279,7 @@ Page({ | @@ -279,7 +279,7 @@ Page({ | ||
| 279 | //--先判断会员状态-- | 279 | //--先判断会员状态-- |
| 280 | var user_info = getApp().globalData.userInfo; | 280 | var user_info = getApp().globalData.userInfo; |
| 281 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | 281 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { |
| 282 | - wx.navigateTo({ url: '/pages/getphone/getphone', }) | 282 | + wx.navigateTo({ url: '/pages/togoin/togoin', }) |
| 283 | return false; | 283 | return false; |
| 284 | } | 284 | } |
| 285 | 285 |
pages/user/member/bring/bring.js
| @@ -365,7 +365,7 @@ Page({ | @@ -365,7 +365,7 @@ Page({ | ||
| 365 | var user_info = getApp().globalData.userInfo; | 365 | var user_info = getApp().globalData.userInfo; |
| 366 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == " " || user_info.mobile == null) { | 366 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == " " || user_info.mobile == null) { |
| 367 | wx.navigateTo({ | 367 | wx.navigateTo({ |
| 368 | - url: '/pages/getphone/getphone', | 368 | + url: '/pages/togoin/togoin', |
| 369 | }) | 369 | }) |
| 370 | return false; | 370 | return false; |
| 371 | } | 371 | } |
pages/user/member/menber.js
| @@ -23,7 +23,7 @@ Page({ | @@ -23,7 +23,7 @@ Page({ | ||
| 23 | //--先判断会员状态-- | 23 | //--先判断会员状态-- |
| 24 | var user_info = getApp().globalData.userInfo; | 24 | var user_info = getApp().globalData.userInfo; |
| 25 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | 25 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { |
| 26 | - wx.navigateTo({ url: '/pages/getphone/getphone', }) | 26 | + wx.navigateTo({ url: '/pages/togoin/togoin', }) |
| 27 | return false; | 27 | return false; |
| 28 | } | 28 | } |
| 29 | this.init_fir(); | 29 | this.init_fir(); |
pages/user/my_service/appment_main.js
| @@ -528,7 +528,7 @@ Page({ | @@ -528,7 +528,7 @@ Page({ | ||
| 528 | validay: options.Validay | 528 | validay: options.Validay |
| 529 | }) | 529 | }) |
| 530 | wx.getLocation({ | 530 | wx.getLocation({ |
| 531 | - type: 'wgs84', | 531 | + type: 'gcj02', |
| 532 | success: function(res) { | 532 | success: function(res) { |
| 533 | th.data.lat = res.latitude; | 533 | th.data.lat = res.latitude; |
| 534 | th.data.lon = res.longitude; | 534 | th.data.lon = res.longitude; |
pages/user/order_detail/order_detail.js
| @@ -665,6 +665,436 @@ Page({ | @@ -665,6 +665,436 @@ Page({ | ||
| 665 | } | 665 | } |
| 666 | func(ob) | 666 | func(ob) |
| 667 | }, | 667 | }, |
| 668 | + | ||
| 669 | + | ||
| 670 | + //再来一单的功能的实现 | ||
| 671 | + moreOrder:function(e){ | ||
| 672 | + var th=this; | ||
| 673 | + var item=th.data.order; | ||
| 674 | + th.check_more_order(item); | ||
| 675 | + }, | ||
| 676 | + | ||
| 677 | + check_more_order:async function(item){ | ||
| 678 | + var pickup=null,th=this; | ||
| 679 | + //--------获取门店----------- | ||
| 680 | + await getApp().request.promiseGet("/api/weshop/pickup/get/" + os.stoid + "/" + item.pickup_id, { | ||
| 681 | + | ||
| 682 | + }).then(res=>{ | ||
| 683 | + pickup = res.data.data; | ||
| 684 | + }) | ||
| 685 | + | ||
| 686 | + //--------获取商品---------- | ||
| 687 | + var goods_list=item.order_goods; | ||
| 688 | + //--- 返回的内容 --- | ||
| 689 | + var back_goods_arr=[]; | ||
| 690 | + var err_text=""; | ||
| 691 | + for(var i in goods_list){ | ||
| 692 | + var g_item=goods_list[i]; | ||
| 693 | + //--如果是赠品,不加入购物车-- | ||
| 694 | + if(g_item['is_gift']) continue; | ||
| 695 | + if(g_item['prom_type']==4 ){ | ||
| 696 | + $err_text+= g_item['goods_name']+"积分购商品不加入购物车\n"; | ||
| 697 | + continue; | ||
| 698 | + } | ||
| 699 | + if(g_item['prom_type']==5){ | ||
| 700 | + $err_text+= g_item['goods_name']+"搭配购商品不加入购物车\n"; | ||
| 701 | + continue; | ||
| 702 | + } | ||
| 703 | + if(g_item['prom_type']==6 ){ | ||
| 704 | + $err_text+= g_item['goods_name']+"拼团商品不加入购物车\n"; | ||
| 705 | + continue; | ||
| 706 | + } | ||
| 707 | + | ||
| 708 | + //--获取商品-- | ||
| 709 | + var good=null; | ||
| 710 | + await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + g_item.goods_id, { | ||
| 711 | + | ||
| 712 | + }).then(res=>{ | ||
| 713 | + good=res.data.data; | ||
| 714 | + }) | ||
| 715 | + | ||
| 716 | + if(!good){ | ||
| 717 | + err_text+= g_item['goods_name']+"未找到商品\n"; | ||
| 718 | + continue; | ||
| 719 | + } | ||
| 720 | + if (good.is_on_sale != 1) { | ||
| 721 | + err_text+= g_item['goods_name']+"已经下架\n"; | ||
| 722 | + continue; | ||
| 723 | + } | ||
| 724 | + | ||
| 725 | + var timestamp = ut.gettimestamp(); | ||
| 726 | + if (good.on_time > timestamp) { | ||
| 727 | + err_text+= g_item['goods_name']+"还未上架\n"; | ||
| 728 | + continue; | ||
| 729 | + } | ||
| 730 | + if (good.down_time > 0) { | ||
| 731 | + if (good.down_time < timestamp) { | ||
| 732 | + err_text+=g_item['goods_name']+"已经下架\n"; | ||
| 733 | + continue; | ||
| 734 | + } | ||
| 735 | + } | ||
| 736 | + | ||
| 737 | + //如果商品的配送方式和门店不匹配 | ||
| 738 | + if(good['distr_type']>0 && pick_up['distr_type']>0 && good['distr_type']!=pick_up['distr_type'] ){ | ||
| 739 | + err_text+= good['goods_name']+"配送方式不一致\n"; | ||
| 740 | + continue; | ||
| 741 | + } | ||
| 742 | + | ||
| 743 | + var prom=null; | ||
| 744 | + var b_item={} | ||
| 745 | + b_item.goods_id=g_item.goods_id; | ||
| 746 | + b_item.goods_name=g_item.goods_name; | ||
| 747 | + b_item.goods_num=g_item.goods_num; | ||
| 748 | + b_item.guide_id=g_item.guide_id; | ||
| 749 | + b_item.guide_type=g_item.guide_type; | ||
| 750 | + b_item.pickup_id=item.pickup_id; | ||
| 751 | + b_item.price=good.shop_price; | ||
| 752 | + b_item.goods_sn=good.goods_sn; | ||
| 753 | + b_item.sku=good.sku; | ||
| 754 | + | ||
| 755 | + //--判断商品当前的活动情况-- | ||
| 756 | + switch(good.prom_type){ | ||
| 757 | + case 1: | ||
| 758 | + var flash=null; | ||
| 759 | + getApp().request.promiseGet("/api/ms/flash_sale/get/" + os.stoid + "/" + good.prom_id, { | ||
| 760 | + }).then(res=>{ | ||
| 761 | + if (res.data.code== 0) { | ||
| 762 | + flash=res.data.data; | ||
| 763 | + } | ||
| 764 | + }) | ||
| 765 | + //----已经结束----- | ||
| 766 | + if (flash && flash.is_end == 0 && flash.end_time > timestamp && flash.start_time > timestamp ) { | ||
| 767 | + prom=flash; | ||
| 768 | + b_item.price=prom.price; // | ||
| 769 | + } | ||
| 770 | + break; | ||
| 771 | + case 6: | ||
| 772 | + b_item.is_pd_normal=1; break; | ||
| 773 | + } | ||
| 774 | + | ||
| 775 | + | ||
| 776 | + | ||
| 777 | + //判断是不是线下库存的购买, 是不是秒杀活动 | ||
| 778 | + if(th.data.sales_rules==2 && !prom){ | ||
| 779 | + | ||
| 780 | + //-- 看一下购物车上有多少商品 -- | ||
| 781 | + var cart_num=0; | ||
| 782 | + await getApp().request.promiseGet("/api/weshop/cart/page", { | ||
| 783 | + data: { | ||
| 784 | + store_id: os.stoid, | ||
| 785 | + user_id: getApp().globalData.user_id, | ||
| 786 | + state:0, is_gift:0, | ||
| 787 | + goods_id:good.goods_id, | ||
| 788 | + pick_id: b_item.pickup_id | ||
| 789 | + } | ||
| 790 | + }).then(res=>{ | ||
| 791 | + var num = 0; | ||
| 792 | + if(res.data.code==0 && res.data.data && res.data.data.pageData) { | ||
| 793 | + for (var i = 0; i < res.data.data.pageData.length; i++) { | ||
| 794 | + num += res.data.data.pageData[i].goods_num; | ||
| 795 | + } | ||
| 796 | + } | ||
| 797 | + cart_num=num; | ||
| 798 | + }) | ||
| 799 | + | ||
| 800 | + var lock=0,plist=null; | ||
| 801 | + //先读取门店的lock, | ||
| 802 | + await getApp().request.promiseGet("/api/weshop/order/ware/lock/page",{ | ||
| 803 | + data:{store_id:os.stoid,wareId:good.goods_id,storageId:b_item.pickup_id,pageSize:1000} | ||
| 804 | + }).then(res=>{ | ||
| 805 | + if(res.data.code==0 && res.data.data.total>0){ | ||
| 806 | + for(var i in res.data.data.pageData) | ||
| 807 | + lock+=res.data.data.pageData[i].outQty | ||
| 808 | + } | ||
| 809 | + }) | ||
| 810 | + | ||
| 811 | + //---通过接口获取门店的线下库存信息-- | ||
| 812 | + await getApp().request.promiseGet("/api/weshop/goods/getWareStorages",{ | ||
| 813 | + data:{storageNos:pickup.pickup_no,wareIds:encodeURIComponent(good.erpwareid),storeId:os.stoid} | ||
| 814 | + }).then(res=>{ | ||
| 815 | + if(res.data.code==0 && res.data.data.total>0){ | ||
| 816 | + plist=res.data.data.pageData[0]; | ||
| 817 | + } | ||
| 818 | + }) | ||
| 819 | + | ||
| 820 | + if(!plist){ | ||
| 821 | + err_text+= good['goods_name']+"库存不足\n"; | ||
| 822 | + continue; | ||
| 823 | + } | ||
| 824 | + if(plist.CanOutQty-lock<=0){ | ||
| 825 | + err_text+= good['goods_name']+"库存不足\n"; | ||
| 826 | + continue; | ||
| 827 | + } | ||
| 828 | + if(b_item.goods_num>(plist.CanOutQty-lock)){ | ||
| 829 | + b_item.goods_num=plist.CanOutQty-lock; | ||
| 830 | + } | ||
| 831 | + var req_data={ | ||
| 832 | + store_id: os.stoid, | ||
| 833 | + user_id: getApp().globalData.user_id, | ||
| 834 | + goods_id: good.goods_id, | ||
| 835 | + }; | ||
| 836 | + | ||
| 837 | + var buynum=0; | ||
| 838 | + //---要获得商品,该用户买了多少件,同步应用--- | ||
| 839 | + await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", { | ||
| 840 | + data: req_data, | ||
| 841 | + }).then(res => { | ||
| 842 | + if(res.data.code==0){ | ||
| 843 | + var buy_num_data = res.data.data; | ||
| 844 | + buynum = buy_num_data.goodsbuynum; | ||
| 845 | + } | ||
| 846 | + }) | ||
| 847 | + | ||
| 848 | + //---- 要计算商品的限购 ----- | ||
| 849 | + if(good['viplimited']>0){ | ||
| 850 | + if(cart_num+buynum>good['viplimited']){ | ||
| 851 | + err_text+= good['goods_name']+"超出限购\n"; | ||
| 852 | + continue; | ||
| 853 | + } | ||
| 854 | + good['viplimited']-=(cart_num+buynum); | ||
| 855 | + if(b_item.goods_num>good['viplimited']){ | ||
| 856 | + b_item.goods_num=good['viplimited']; | ||
| 857 | + } | ||
| 858 | + } | ||
| 859 | + | ||
| 860 | + back_goods_arr.push(b_item); //返回商品元素 | ||
| 861 | + | ||
| 862 | + }else{ | ||
| 863 | + | ||
| 864 | + //-- 看一下购物车上有多少商品 -- | ||
| 865 | + var cart_num=0; | ||
| 866 | + await getApp().request.promiseGet("/api/weshop/cart/page", { | ||
| 867 | + data: { | ||
| 868 | + store_id: os.stoid, | ||
| 869 | + user_id: getApp().globalData.user_id, | ||
| 870 | + state:0, is_gift:0, | ||
| 871 | + goods_id:good.goods_id | ||
| 872 | + } | ||
| 873 | + }).then(res=>{ | ||
| 874 | + var num = 0; | ||
| 875 | + if(res.data.code==0 && res.data.data && res.data.data.pageData) { | ||
| 876 | + for (var i = 0; i < res.data.data.pageData.length; i++) { | ||
| 877 | + num += res.data.data.pageData[i].goods_num; | ||
| 878 | + } | ||
| 879 | + } | ||
| 880 | + cart_num=num; | ||
| 881 | + }) | ||
| 882 | + | ||
| 883 | + | ||
| 884 | + if(good.store_count<=0){ | ||
| 885 | + err_text+= good['goods_name']+"库存不足\n"; | ||
| 886 | + continue; | ||
| 887 | + } | ||
| 888 | + if(b_item.goods_num>good.store_count) | ||
| 889 | + b_item.goods_num=good.store_count; | ||
| 890 | + | ||
| 891 | + var buynum=0; //商品已经购买多少件 | ||
| 892 | + var promgoodsbuynum=0; //活动已经购买多少件 | ||
| 893 | + var redis_num = 0; //redis库存 | ||
| 894 | + | ||
| 895 | + var req_data={ | ||
| 896 | + store_id: os.stoid, | ||
| 897 | + user_id: getApp().globalData.user_id, | ||
| 898 | + goods_id: good.goods_id, | ||
| 899 | + }; | ||
| 900 | + | ||
| 901 | + if(prom){ | ||
| 902 | + req_data.prom_type= good.prom_type; | ||
| 903 | + req_data.prom_id= good.prom_id; | ||
| 904 | + | ||
| 905 | + //------判断活动是否抢光----- | ||
| 906 | + await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + | ||
| 907 | + os.stoid + "/" + good.prom_type + "/" + good.prom_id, { | ||
| 908 | + 1: 1 | ||
| 909 | + }).then(res => { | ||
| 910 | + redis_num = res.data.data; | ||
| 911 | + }); | ||
| 912 | + if(redis_num<=0){ | ||
| 913 | + err_text+= good['goods_name']+"活动不足\n"; | ||
| 914 | + continue; | ||
| 915 | + } | ||
| 916 | + | ||
| 917 | + } | ||
| 918 | + | ||
| 919 | + //---要获得商品,该用户买了多少件,同步应用--- | ||
| 920 | + await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", { | ||
| 921 | + data: req_data, | ||
| 922 | + }).then(res => { | ||
| 923 | + if(res.data.code==0){ | ||
| 924 | + var buy_num_data = res.data.data; | ||
| 925 | + if (buy_num_data.promgoodsbuynum) promgoodsbuynum = buy_num_data.promgoodsbuynum; | ||
| 926 | + buynum = buy_num_data.goodsbuynum; | ||
| 927 | + } | ||
| 928 | + }) | ||
| 929 | + | ||
| 930 | + //---- 要计算商品的限购 ----- | ||
| 931 | + if(good['viplimited']>0){ | ||
| 932 | + if(cart_num+buynum>good['viplimited']){ | ||
| 933 | + err_text+= good['goods_name']+"超出限购\n"; | ||
| 934 | + continue; | ||
| 935 | + } | ||
| 936 | + good['viplimited']-=(cart_num+buynum); | ||
| 937 | + if(b_item.goods_num>good['viplimited']){ | ||
| 938 | + b_item.goods_num=good['viplimited']; | ||
| 939 | + } | ||
| 940 | + | ||
| 941 | + } | ||
| 942 | + | ||
| 943 | + //-- 判断活动的库存 -- | ||
| 944 | + if(prom){ | ||
| 945 | + if(prom['goods_num']<=prom['buy_num']){ | ||
| 946 | + err_text+= good['goods_name']+"超出活动库存\n";continue; | ||
| 947 | + } | ||
| 948 | + | ||
| 949 | + if(b_item.goods_num>prom['goods_num']-prom['buy_num']){ | ||
| 950 | + b_item['goods_num']= b_item['goods_num']-b_item['buy_num']; | ||
| 951 | + } | ||
| 952 | + | ||
| 953 | + if(b_item.goods_num>redis_num){ | ||
| 954 | + b_item.goods_num=redis_num; | ||
| 955 | + } | ||
| 956 | + | ||
| 957 | + if(cart_num+buynum>prom['buy_limit']){ | ||
| 958 | + err_text+= good['goods_name']+"超出活动限购\n";continue; | ||
| 959 | + } | ||
| 960 | + prom['buy_limit'] -= (cart_num+buynum); | ||
| 961 | + if(b_item.goods_num>prom['buy_limit']){ | ||
| 962 | + b_item.goods_num=prom['buy_limit']; | ||
| 963 | + } | ||
| 964 | + | ||
| 965 | + } | ||
| 966 | + back_goods_arr.push(b_item); //返回商品元素 | ||
| 967 | + } | ||
| 968 | + } | ||
| 969 | + | ||
| 970 | + //有重新购买的数据是时候,就要重新生成订单 | ||
| 971 | + if(back_goods_arr.length>0){ | ||
| 972 | + th.setData({back_goods_arr:back_goods_arr}); | ||
| 973 | + if(!err_text){ | ||
| 974 | + th.more_add_cart(); | ||
| 975 | + }else{ | ||
| 976 | + // 如果没有获取用户信息 | ||
| 977 | + wx.showModal({ | ||
| 978 | + title:'确定', | ||
| 979 | + content: err_text+',确定要买其他商品码?', | ||
| 980 | + success(res) { | ||
| 981 | + if (res.confirm) { | ||
| 982 | + //跳转到登录页 | ||
| 983 | + th.more_add_cart(); | ||
| 984 | + } | ||
| 985 | + } | ||
| 986 | + }); | ||
| 987 | + | ||
| 988 | + } | ||
| 989 | + }else{ | ||
| 990 | + getApp().confirmBox(err_text); | ||
| 991 | + } | ||
| 992 | + }, | ||
| 993 | + | ||
| 994 | + more_add_cart:async function(){ | ||
| 995 | + var back_goods_arr=this.data.back_goods_arr; | ||
| 996 | + var err_text=""; | ||
| 997 | + var ok_num=0; | ||
| 998 | + | ||
| 999 | + for(var i in back_goods_arr){ | ||
| 1000 | + //商品ID | ||
| 1001 | + var g_item=back_goods_arr[i]; | ||
| 1002 | + var newd = { | ||
| 1003 | + goods_id: g_item.goods_id, | ||
| 1004 | + goods_num: g_item.goods_num, | ||
| 1005 | + pick_id: g_item.pickup_id, | ||
| 1006 | + user_id: oo.user_id, | ||
| 1007 | + store_id: os.stoid, | ||
| 1008 | + goods_price: g_item.price, | ||
| 1009 | + member_goods_price: g_item.price, | ||
| 1010 | + goods_name: g_item.goods_name, | ||
| 1011 | + goods_sn: g_item.goods_sn, | ||
| 1012 | + sku: g_item.sku, | ||
| 1013 | + }; | ||
| 1014 | + | ||
| 1015 | + if(g_item.guide_id){ | ||
| 1016 | + newd['guide_id']=g_item.guide_id; | ||
| 1017 | + newd['guide_type']=g_item.guide_type; | ||
| 1018 | + } | ||
| 1019 | + | ||
| 1020 | + var b_cart_goods=null; | ||
| 1021 | + await getApp().request.promiseGet("/api/weshop/cart/page", { | ||
| 1022 | + data: { | ||
| 1023 | + store_id: os.stoid, | ||
| 1024 | + user_id: oo.user_id, | ||
| 1025 | + goods_id: g_item.goods_id, | ||
| 1026 | + pick_id: g_item.pickup_id, | ||
| 1027 | + }, | ||
| 1028 | + }).then(res=>{ | ||
| 1029 | + //-------如果购物车中有相关的数据------- | ||
| 1030 | + if (res.data.data.total > 0) { | ||
| 1031 | + b_cart_goods= res.data.data.pageData[0]; | ||
| 1032 | + } | ||
| 1033 | + }) | ||
| 1034 | + | ||
| 1035 | + //-- 如果就加入过购物车 -- | ||
| 1036 | + if(b_cart_goods){ | ||
| 1037 | + var updata = { | ||
| 1038 | + id: b_cart_goods.id, | ||
| 1039 | + goods_num: newd.goods_num + b_cart_goods.goods_num, | ||
| 1040 | + goods_price: newd.goods_price, | ||
| 1041 | + member_goods_price:newd.goods_price, | ||
| 1042 | + store_id: os.stoid, | ||
| 1043 | + }; | ||
| 1044 | + if(newd.guide_id){ | ||
| 1045 | + updata.guide_id=newd.guide_id; | ||
| 1046 | + updata.guide_type=newd.guide_type; | ||
| 1047 | + } | ||
| 1048 | + await getApp().request.promisePut("/api/weshop/cart/update", { | ||
| 1049 | + data: updata | ||
| 1050 | + }).then(res=>{ | ||
| 1051 | + if(res.data.code==0) { | ||
| 1052 | + ok_num++; | ||
| 1053 | + }else{ | ||
| 1054 | + err_text+=newd.goods_name+"加入购物车失败\n"; | ||
| 1055 | + } | ||
| 1056 | + }) | ||
| 1057 | + | ||
| 1058 | + }else{ | ||
| 1059 | + await getApp().request.promisePost("/api/weshop/cart/save", { | ||
| 1060 | + data: newd | ||
| 1061 | + }).then(res=>{ | ||
| 1062 | + if(res.data.code==0) { | ||
| 1063 | + ok_num++; | ||
| 1064 | + }else{ | ||
| 1065 | + err_text+=newd.goods_name+"加入购物车失败\n"; | ||
| 1066 | + } | ||
| 1067 | + }) | ||
| 1068 | + } | ||
| 1069 | + } | ||
| 1070 | + | ||
| 1071 | + if(ok_num==0){ | ||
| 1072 | + //-- 如果没有获取用户信息 -- | ||
| 1073 | + wx.showModal({ | ||
| 1074 | + title:'提示', | ||
| 1075 | + content: err_text, | ||
| 1076 | + success(res) {} | ||
| 1077 | + }); | ||
| 1078 | + }else{ | ||
| 1079 | + if(err_text==""){ | ||
| 1080 | + getApp().goto("/pages/cart/cart/cart"); | ||
| 1081 | + }else{ | ||
| 1082 | + // 如果没有获取用户信息 | ||
| 1083 | + wx.showModal({ | ||
| 1084 | + title:'提示', | ||
| 1085 | + content: err_text, | ||
| 1086 | + success(res) { | ||
| 1087 | + if (res.confirm) { | ||
| 1088 | + //跳转到登录页 | ||
| 1089 | + getApp().goto("/pages/cart/cart/cart"); | ||
| 1090 | + } | ||
| 1091 | + } | ||
| 1092 | + }); | ||
| 1093 | + | ||
| 1094 | + } | ||
| 1095 | + | ||
| 1096 | + } | ||
| 1097 | + } | ||
| 668 | 1098 | ||
| 669 | 1099 | ||
| 670 | 1100 |
pages/user/order_detail/order_detail.wxml
| @@ -160,10 +160,15 @@ | @@ -160,10 +160,15 @@ | ||
| 160 | <navigator class="tips-btn" wx:if="{{order.is_all_return_status==0 || order.is_all_return_status==1}}" | 160 | <navigator class="tips-btn" wx:if="{{order.is_all_return_status==0 || order.is_all_return_status==1}}" |
| 161 | url="/pages/user/return_goods_info/return_goods_info?order_id={{order.order_id}}">退款详情</navigator> | 161 | url="/pages/user/return_goods_info/return_goods_info?order_id={{order.order_id}}">退款详情</navigator> |
| 162 | </block> | 162 | </block> |
| 163 | + | ||
| 164 | + | ||
| 165 | + <block wx:if="{{order.order_status==2 || order.order_status==4 }}"> | ||
| 166 | + <view style="background-color: #feca53;" class="tips-btn" bindtap="moreOrder" >再来一单</view> | ||
| 167 | + </block> | ||
| 163 | 168 | ||
| 164 | <block wx:if="{{order.order_status==2 && order.is_zsorder!=4}}"> | 169 | <block wx:if="{{order.order_status==2 && order.is_zsorder!=4}}"> |
| 165 | <navigator wx:if="{{order.order_goods.length>1}}" class="tips-btn" | 170 | <navigator wx:if="{{order.order_goods.length>1}}" class="tips-btn" |
| 166 | - url="/pages/user/comment/comment?status=0&order_id={{order.order_id}}">评价{{order.order_goods.length}}</navigator> | 171 | + url="/pages/user/comment/comment?status=0&order_id={{order.order_id}}">评价</navigator> |
| 167 | <navigator wx:else class="tips-btn" | 172 | <navigator wx:else class="tips-btn" |
| 168 | url="/pages/user/add_comment/add_comment?goods_id={{order.order_goods[0].goods_id}}&order_id={{order.order_id}}}">去评价</navigator> | 173 | url="/pages/user/add_comment/add_comment?goods_id={{order.order_goods[0].goods_id}}&order_id={{order.order_id}}}">去评价</navigator> |
| 169 | </block> | 174 | </block> |
pages/user/order_list/order_list.js
| @@ -41,9 +41,12 @@ Page({ | @@ -41,9 +41,12 @@ Page({ | ||
| 41 | is_get: 0, | 41 | is_get: 0, |
| 42 | conf: null, | 42 | conf: null, |
| 43 | iscodeall: null, | 43 | iscodeall: null, |
| 44 | + sales_rules:1, //默认是显示线上库存 | ||
| 44 | 45 | ||
| 45 | //会员的等级价位 | 46 | //会员的等级价位 |
| 46 | card_field:null, | 47 | card_field:null, |
| 48 | + | ||
| 49 | + back_goods_arr:null, //返回商品的列表 | ||
| 47 | }, | 50 | }, |
| 48 | onLoad: function(t) { | 51 | onLoad: function(t) { |
| 49 | var th = this; | 52 | var th = this; |
| @@ -53,7 +56,7 @@ Page({ | @@ -53,7 +56,7 @@ Page({ | ||
| 53 | s.init(this, "", "orderList"); | 56 | s.init(this, "", "orderList"); |
| 54 | //---查看会员的等级价--- | 57 | //---查看会员的等级价--- |
| 55 | getApp().getConfig2(function(e) { | 58 | getApp().getConfig2(function(e) { |
| 56 | - th.setData({conf: e }); | 59 | + th.setData({conf: e,sales_rules:e.sales_rules }); |
| 57 | //--- 看后台是不是有开通等级卡 --- | 60 | //--- 看后台是不是有开通等级卡 --- |
| 58 | if(e.switch_list){ | 61 | if(e.switch_list){ |
| 59 | var s_list=JSON.parse(e.switch_list); | 62 | var s_list=JSON.parse(e.switch_list); |
| @@ -746,5 +749,439 @@ Page({ | @@ -746,5 +749,439 @@ Page({ | ||
| 746 | content: "请将二维码展示给核销员,收货更快捷" | 749 | content: "请将二维码展示给核销员,收货更快捷" |
| 747 | }; | 750 | }; |
| 748 | qc_com.open(obj) | 751 | qc_com.open(obj) |
| 752 | + }, | ||
| 753 | + | ||
| 754 | + //再来一单的功能的实现 | ||
| 755 | + moreOrder:function(e){ | ||
| 756 | + var th=this; | ||
| 757 | + var index=e.currentTarget.dataset.index; | ||
| 758 | + var item=th.data.orderList[index]; | ||
| 759 | + th.check_more_order(item); | ||
| 760 | + }, | ||
| 761 | + | ||
| 762 | + check_more_order:async function(item){ | ||
| 763 | + var pickup=null,th=this; | ||
| 764 | + //--------获取门店----------- | ||
| 765 | + await getApp().request.promiseGet("/api/weshop/pickup/get/" + os.stoid + "/" + item.pickup_id, { | ||
| 766 | + | ||
| 767 | + }).then(res=>{ | ||
| 768 | + pickup = res.data.data; | ||
| 769 | + }) | ||
| 770 | + | ||
| 771 | + //--------获取商品---------- | ||
| 772 | + var goods_list=item.order_goods; | ||
| 773 | + //--- 返回的内容 --- | ||
| 774 | + var back_goods_arr=[]; | ||
| 775 | + var err_text=""; | ||
| 776 | + for(var i in goods_list){ | ||
| 777 | + var g_item=goods_list[i]; | ||
| 778 | + //--如果是赠品,不加入购物车-- | ||
| 779 | + if(g_item['is_gift']) continue; | ||
| 780 | + if(g_item['prom_type']==4 ){ | ||
| 781 | + $err_text+= g_item['goods_name']+"积分购商品不加入购物车\n"; | ||
| 782 | + continue; | ||
| 783 | + } | ||
| 784 | + if(g_item['prom_type']==5){ | ||
| 785 | + $err_text+= g_item['goods_name']+"搭配购商品不加入购物车\n"; | ||
| 786 | + continue; | ||
| 787 | + } | ||
| 788 | + if(g_item['prom_type']==6 ){ | ||
| 789 | + $err_text+= g_item['goods_name']+"拼团商品不加入购物车\n"; | ||
| 790 | + continue; | ||
| 791 | + } | ||
| 792 | + | ||
| 793 | + //--获取商品-- | ||
| 794 | + var good=null; | ||
| 795 | + await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + g_item.goods_id, { | ||
| 796 | + | ||
| 797 | + }).then(res=>{ | ||
| 798 | + good=res.data.data; | ||
| 799 | + }) | ||
| 800 | + | ||
| 801 | + if(!good){ | ||
| 802 | + err_text+= g_item['goods_name']+"未找到商品\n"; | ||
| 803 | + continue; | ||
| 804 | + } | ||
| 805 | + if (good.is_on_sale != 1) { | ||
| 806 | + err_text+= g_item['goods_name']+"已经下架\n"; | ||
| 807 | + continue; | ||
| 808 | + } | ||
| 809 | + | ||
| 810 | + var timestamp = ut.gettimestamp(); | ||
| 811 | + if (good.on_time > timestamp) { | ||
| 812 | + err_text+= g_item['goods_name']+"还未上架\n"; | ||
| 813 | + continue; | ||
| 814 | + } | ||
| 815 | + if (good.down_time > 0) { | ||
| 816 | + if (good.down_time < timestamp) { | ||
| 817 | + err_text+=g_item['goods_name']+"已经下架\n"; | ||
| 818 | + continue; | ||
| 819 | + } | ||
| 820 | + } | ||
| 821 | + | ||
| 822 | + //如果商品的配送方式和门店不匹配 | ||
| 823 | + if(good['distr_type']>0 && pick_up['distr_type']>0 && good['distr_type']!=pick_up['distr_type'] ){ | ||
| 824 | + err_text+= good['goods_name']+"配送方式不一致\n"; | ||
| 825 | + continue; | ||
| 826 | + } | ||
| 827 | + | ||
| 828 | + var prom=null; | ||
| 829 | + var b_item={} | ||
| 830 | + b_item.goods_id=g_item.goods_id; | ||
| 831 | + b_item.goods_name=g_item.goods_name; | ||
| 832 | + b_item.goods_num=g_item.goods_num; | ||
| 833 | + b_item.guide_id=g_item.guide_id; | ||
| 834 | + b_item.guide_type=g_item.guide_type; | ||
| 835 | + b_item.pickup_id=item.pickup_id; | ||
| 836 | + b_item.price=good.shop_price; | ||
| 837 | + b_item.goods_sn=good.goods_sn; | ||
| 838 | + b_item.sku=good.sku; | ||
| 839 | + | ||
| 840 | + //--判断商品当前的活动情况-- | ||
| 841 | + switch(good.prom_type){ | ||
| 842 | + case 1: | ||
| 843 | + var flash=null; | ||
| 844 | + getApp().request.promiseGet("/api/ms/flash_sale/get/" + os.stoid + "/" + good.prom_id, { | ||
| 845 | + }).then(res=>{ | ||
| 846 | + if (res.data.code== 0) { | ||
| 847 | + flash=res.data.data; | ||
| 848 | + } | ||
| 849 | + }) | ||
| 850 | + //----已经结束----- | ||
| 851 | + if (flash && flash.is_end == 0 && flash.end_time > timestamp && flash.start_time > timestamp ) { | ||
| 852 | + prom=flash; | ||
| 853 | + b_item.price=prom.price; // | ||
| 854 | + } | ||
| 855 | + break; | ||
| 856 | + case 6: | ||
| 857 | + b_item.is_pd_normal=1; break; | ||
| 858 | + } | ||
| 859 | + | ||
| 860 | + | ||
| 861 | + | ||
| 862 | + //判断是不是线下库存的购买, 是不是秒杀活动 | ||
| 863 | + if(th.data.sales_rules==2 && !prom){ | ||
| 864 | + | ||
| 865 | + //-- 看一下购物车上有多少商品 -- | ||
| 866 | + var cart_num=0; | ||
| 867 | + await getApp().request.promiseGet("/api/weshop/cart/page", { | ||
| 868 | + data: { | ||
| 869 | + store_id: os.stoid, | ||
| 870 | + user_id: getApp().globalData.user_id, | ||
| 871 | + state:0, is_gift:0, | ||
| 872 | + goods_id:good.goods_id, | ||
| 873 | + pick_id: b_item.pickup_id | ||
| 874 | + } | ||
| 875 | + }).then(res=>{ | ||
| 876 | + var num = 0; | ||
| 877 | + if(res.data.code==0 && res.data.data && res.data.data.pageData) { | ||
| 878 | + for (var i = 0; i < res.data.data.pageData.length; i++) { | ||
| 879 | + num += res.data.data.pageData[i].goods_num; | ||
| 880 | + } | ||
| 881 | + } | ||
| 882 | + cart_num=num; | ||
| 883 | + }) | ||
| 884 | + | ||
| 885 | + var lock=0,plist=null; | ||
| 886 | + //先读取门店的lock, | ||
| 887 | + await getApp().request.promiseGet("/api/weshop/order/ware/lock/page",{ | ||
| 888 | + data:{store_id:os.stoid,wareId:good.goods_id,storageId:b_item.pickup_id,pageSize:1000} | ||
| 889 | + }).then(res=>{ | ||
| 890 | + if(res.data.code==0 && res.data.data.total>0){ | ||
| 891 | + for(var i in res.data.data.pageData) | ||
| 892 | + lock+=res.data.data.pageData[i].outQty | ||
| 893 | + } | ||
| 894 | + }) | ||
| 895 | + | ||
| 896 | + //---通过接口获取门店的线下库存信息-- | ||
| 897 | + await getApp().request.promiseGet("/api/weshop/goods/getWareStorages",{ | ||
| 898 | + data:{storageNos:pickup.pickup_no,wareIds:encodeURIComponent(good.erpwareid),storeId:os.stoid} | ||
| 899 | + }).then(res=>{ | ||
| 900 | + if(res.data.code==0 && res.data.data.total>0){ | ||
| 901 | + plist=res.data.data.pageData[0]; | ||
| 902 | + } | ||
| 903 | + }) | ||
| 904 | + | ||
| 905 | + if(!plist){ | ||
| 906 | + err_text+= good['goods_name']+"库存不足\n"; | ||
| 907 | + continue; | ||
| 908 | + } | ||
| 909 | + if(plist.CanOutQty-lock<=0){ | ||
| 910 | + err_text+= good['goods_name']+"库存不足\n"; | ||
| 911 | + continue; | ||
| 912 | + } | ||
| 913 | + if(b_item.goods_num>(plist.CanOutQty-lock)){ | ||
| 914 | + b_item.goods_num=plist.CanOutQty-lock; | ||
| 915 | + } | ||
| 916 | + var req_data={ | ||
| 917 | + store_id: os.stoid, | ||
| 918 | + user_id: getApp().globalData.user_id, | ||
| 919 | + goods_id: good.goods_id, | ||
| 920 | + }; | ||
| 921 | + | ||
| 922 | + var buynum=0; | ||
| 923 | + //---要获得商品,该用户买了多少件,同步应用--- | ||
| 924 | + await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", { | ||
| 925 | + data: req_data, | ||
| 926 | + }).then(res => { | ||
| 927 | + if(res.data.code==0){ | ||
| 928 | + var buy_num_data = res.data.data; | ||
| 929 | + buynum = buy_num_data.goodsbuynum; | ||
| 930 | + } | ||
| 931 | + }) | ||
| 932 | + | ||
| 933 | + //---- 要计算商品的限购 ----- | ||
| 934 | + if(good['viplimited']>0){ | ||
| 935 | + if(cart_num+buynum>good['viplimited']){ | ||
| 936 | + err_text+= good['goods_name']+"超出限购\n"; | ||
| 937 | + continue; | ||
| 938 | + } | ||
| 939 | + good['viplimited']-=(cart_num+buynum); | ||
| 940 | + if(b_item.goods_num>good['viplimited']){ | ||
| 941 | + b_item.goods_num=good['viplimited']; | ||
| 942 | + } | ||
| 943 | + } | ||
| 944 | + | ||
| 945 | + back_goods_arr.push(b_item); //返回商品元素 | ||
| 946 | + | ||
| 947 | + }else{ | ||
| 948 | + | ||
| 949 | + //-- 看一下购物车上有多少商品 -- | ||
| 950 | + var cart_num=0; | ||
| 951 | + await getApp().request.promiseGet("/api/weshop/cart/page", { | ||
| 952 | + data: { | ||
| 953 | + store_id: os.stoid, | ||
| 954 | + user_id: getApp().globalData.user_id, | ||
| 955 | + state:0, is_gift:0, | ||
| 956 | + goods_id:good.goods_id | ||
| 957 | + } | ||
| 958 | + }).then(res=>{ | ||
| 959 | + var num = 0; | ||
| 960 | + if(res.data.code==0 && res.data.data && res.data.data.pageData) { | ||
| 961 | + for (var i = 0; i < res.data.data.pageData.length; i++) { | ||
| 962 | + num += res.data.data.pageData[i].goods_num; | ||
| 963 | + } | ||
| 964 | + } | ||
| 965 | + cart_num=num; | ||
| 966 | + }) | ||
| 967 | + | ||
| 968 | + | ||
| 969 | + if(good.store_count<=0){ | ||
| 970 | + err_text+= good['goods_name']+"库存不足\n"; | ||
| 971 | + continue; | ||
| 972 | + } | ||
| 973 | + if(b_item.goods_num>good.store_count) | ||
| 974 | + b_item.goods_num=good.store_count; | ||
| 975 | + | ||
| 976 | + var buynum=0; //商品已经购买多少件 | ||
| 977 | + var promgoodsbuynum=0; //活动已经购买多少件 | ||
| 978 | + var redis_num = 0; //redis库存 | ||
| 979 | + | ||
| 980 | + var req_data={ | ||
| 981 | + store_id: os.stoid, | ||
| 982 | + user_id: getApp().globalData.user_id, | ||
| 983 | + goods_id: good.goods_id, | ||
| 984 | + }; | ||
| 985 | + | ||
| 986 | + if(prom){ | ||
| 987 | + req_data.prom_type= good.prom_type; | ||
| 988 | + req_data.prom_id= good.prom_id; | ||
| 989 | + | ||
| 990 | + //------判断活动是否抢光----- | ||
| 991 | + await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" + | ||
| 992 | + os.stoid + "/" + good.prom_type + "/" + good.prom_id, { | ||
| 993 | + 1: 1 | ||
| 994 | + }).then(res => { | ||
| 995 | + redis_num = res.data.data; | ||
| 996 | + }); | ||
| 997 | + if(redis_num<=0){ | ||
| 998 | + err_text+= good['goods_name']+"活动不足\n"; | ||
| 999 | + continue; | ||
| 1000 | + } | ||
| 1001 | + | ||
| 1002 | + } | ||
| 1003 | + | ||
| 1004 | + //---要获得商品,该用户买了多少件,同步应用--- | ||
| 1005 | + await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", { | ||
| 1006 | + data: req_data, | ||
| 1007 | + }).then(res => { | ||
| 1008 | + if(res.data.code==0){ | ||
| 1009 | + var buy_num_data = res.data.data; | ||
| 1010 | + if (buy_num_data.promgoodsbuynum) promgoodsbuynum = buy_num_data.promgoodsbuynum; | ||
| 1011 | + buynum = buy_num_data.goodsbuynum; | ||
| 1012 | + } | ||
| 1013 | + }) | ||
| 1014 | + | ||
| 1015 | + //---- 要计算商品的限购 ----- | ||
| 1016 | + if(good['viplimited']>0){ | ||
| 1017 | + if(cart_num+buynum>good['viplimited']){ | ||
| 1018 | + err_text+= good['goods_name']+"超出限购\n"; | ||
| 1019 | + continue; | ||
| 1020 | + } | ||
| 1021 | + good['viplimited']-=(cart_num+buynum); | ||
| 1022 | + if(b_item.goods_num>good['viplimited']){ | ||
| 1023 | + b_item.goods_num=good['viplimited']; | ||
| 1024 | + } | ||
| 1025 | + | ||
| 1026 | + } | ||
| 1027 | + | ||
| 1028 | + //-- 判断活动的库存 -- | ||
| 1029 | + if(prom){ | ||
| 1030 | + if(prom['goods_num']<=prom['buy_num']){ | ||
| 1031 | + err_text+= good['goods_name']+"超出活动库存\n";continue; | ||
| 1032 | + } | ||
| 1033 | + | ||
| 1034 | + if(b_item.goods_num>prom['goods_num']-prom['buy_num']){ | ||
| 1035 | + b_item['goods_num']= b_item['goods_num']-b_item['buy_num']; | ||
| 1036 | + } | ||
| 1037 | + | ||
| 1038 | + if(b_item.goods_num>redis_num){ | ||
| 1039 | + b_item.goods_num=redis_num; | ||
| 1040 | + } | ||
| 1041 | + | ||
| 1042 | + if(cart_num+buynum>prom['buy_limit']){ | ||
| 1043 | + err_text+= good['goods_name']+"超出活动限购\n";continue; | ||
| 1044 | + } | ||
| 1045 | + prom['buy_limit'] -= (cart_num+buynum); | ||
| 1046 | + if(b_item.goods_num>prom['buy_limit']){ | ||
| 1047 | + b_item.goods_num=prom['buy_limit']; | ||
| 1048 | + } | ||
| 1049 | + | ||
| 1050 | + } | ||
| 1051 | + back_goods_arr.push(b_item); //返回商品元素 | ||
| 1052 | + } | ||
| 1053 | + } | ||
| 1054 | + | ||
| 1055 | + //有重新购买的数据是时候,就要重新生成订单 | ||
| 1056 | + if(back_goods_arr.length>0){ | ||
| 1057 | + th.setData({back_goods_arr:back_goods_arr}); | ||
| 1058 | + if(!err_text){ | ||
| 1059 | + th.more_add_cart(); | ||
| 1060 | + }else{ | ||
| 1061 | + // 如果没有获取用户信息 | ||
| 1062 | + wx.showModal({ | ||
| 1063 | + title:'确定', | ||
| 1064 | + content: err_text+',确定要买其他商品码?', | ||
| 1065 | + success(res) { | ||
| 1066 | + if (res.confirm) { | ||
| 1067 | + //跳转到登录页 | ||
| 1068 | + th.more_add_cart(); | ||
| 1069 | + } | ||
| 1070 | + } | ||
| 1071 | + }); | ||
| 1072 | + | ||
| 1073 | + } | ||
| 1074 | + }else{ | ||
| 1075 | + getApp().confirmBox(err_text); | ||
| 1076 | + } | ||
| 1077 | + }, | ||
| 1078 | + | ||
| 1079 | + more_add_cart:async function(){ | ||
| 1080 | + var back_goods_arr=this.data.back_goods_arr; | ||
| 1081 | + var err_text=""; | ||
| 1082 | + var ok_num=0; | ||
| 1083 | + | ||
| 1084 | + for(var i in back_goods_arr){ | ||
| 1085 | + //商品ID | ||
| 1086 | + var g_item=back_goods_arr[i]; | ||
| 1087 | + var newd = { | ||
| 1088 | + goods_id: g_item.goods_id, | ||
| 1089 | + goods_num: g_item.goods_num, | ||
| 1090 | + pick_id: g_item.pickup_id, | ||
| 1091 | + user_id: oo.user_id, | ||
| 1092 | + store_id: os.stoid, | ||
| 1093 | + goods_price: g_item.price, | ||
| 1094 | + member_goods_price: g_item.price, | ||
| 1095 | + goods_name: g_item.goods_name, | ||
| 1096 | + goods_sn: g_item.goods_sn, | ||
| 1097 | + sku: g_item.sku, | ||
| 1098 | + }; | ||
| 1099 | + | ||
| 1100 | + if(g_item.guide_id){ | ||
| 1101 | + newd['guide_id']=g_item.guide_id; | ||
| 1102 | + newd['guide_type']=g_item.guide_type; | ||
| 1103 | + } | ||
| 1104 | + | ||
| 1105 | + var b_cart_goods=null; | ||
| 1106 | + await getApp().request.promiseGet("/api/weshop/cart/page", { | ||
| 1107 | + data: { | ||
| 1108 | + store_id: os.stoid, | ||
| 1109 | + user_id: oo.user_id, | ||
| 1110 | + goods_id: g_item.goods_id, | ||
| 1111 | + pick_id: g_item.pickup_id, | ||
| 1112 | + }, | ||
| 1113 | + }).then(res=>{ | ||
| 1114 | + //-------如果购物车中有相关的数据------- | ||
| 1115 | + if (res.data.data.total > 0) { | ||
| 1116 | + b_cart_goods= res.data.data.pageData[0]; | ||
| 1117 | + } | ||
| 1118 | + }) | ||
| 1119 | + | ||
| 1120 | + //-- 如果就加入过购物车 -- | ||
| 1121 | + if(b_cart_goods){ | ||
| 1122 | + var updata = { | ||
| 1123 | + id: b_cart_goods.id, | ||
| 1124 | + goods_num: newd.goods_num + b_cart_goods.goods_num, | ||
| 1125 | + goods_price: newd.goods_price, | ||
| 1126 | + member_goods_price:newd.goods_price, | ||
| 1127 | + store_id: os.stoid, | ||
| 1128 | + }; | ||
| 1129 | + if(newd.guide_id){ | ||
| 1130 | + updata.guide_id=newd.guide_id; | ||
| 1131 | + updata.guide_type=newd.guide_type; | ||
| 1132 | + } | ||
| 1133 | + await getApp().request.promisePut("/api/weshop/cart/update", { | ||
| 1134 | + data: updata | ||
| 1135 | + }).then(res=>{ | ||
| 1136 | + if(res.data.code==0) { | ||
| 1137 | + ok_num++; | ||
| 1138 | + }else{ | ||
| 1139 | + err_text+=newd.goods_name+"加入购物车失败\n"; | ||
| 1140 | + } | ||
| 1141 | + }) | ||
| 1142 | + | ||
| 1143 | + }else{ | ||
| 1144 | + await getApp().request.promisePost("/api/weshop/cart/save", { | ||
| 1145 | + data: newd | ||
| 1146 | + }).then(res=>{ | ||
| 1147 | + if(res.data.code==0) { | ||
| 1148 | + ok_num++; | ||
| 1149 | + }else{ | ||
| 1150 | + err_text+=newd.goods_name+"加入购物车失败\n"; | ||
| 1151 | + } | ||
| 1152 | + }) | ||
| 1153 | + } | ||
| 1154 | + } | ||
| 1155 | + | ||
| 1156 | + if(ok_num==0){ | ||
| 1157 | + //-- 如果没有获取用户信息 -- | ||
| 1158 | + wx.showModal({ | ||
| 1159 | + title:'提示', | ||
| 1160 | + content: err_text, | ||
| 1161 | + success(res) {} | ||
| 1162 | + }); | ||
| 1163 | + }else{ | ||
| 1164 | + if(err_text==""){ | ||
| 1165 | + getApp().goto("/pages/cart/cart/cart"); | ||
| 1166 | + }else{ | ||
| 1167 | + // 如果没有获取用户信息 | ||
| 1168 | + wx.showModal({ | ||
| 1169 | + title:'提示', | ||
| 1170 | + content: err_text, | ||
| 1171 | + success(res) { | ||
| 1172 | + if (res.confirm) { | ||
| 1173 | + //跳转到登录页 | ||
| 1174 | + getApp().goto("/pages/cart/cart/cart"); | ||
| 1175 | + } | ||
| 1176 | + } | ||
| 1177 | + }); | ||
| 1178 | + | ||
| 1179 | + } | ||
| 1180 | + | ||
| 1181 | + } | ||
| 749 | } | 1182 | } |
| 1183 | + | ||
| 1184 | + | ||
| 1185 | + | ||
| 1186 | + | ||
| 750 | }); | 1187 | }); |
| 751 | \ No newline at end of file | 1188 | \ No newline at end of file |
pages/user/order_list/order_list.wxml
| @@ -155,7 +155,12 @@ | @@ -155,7 +155,12 @@ | ||
| 155 | <view bindtap="confirmOrder" data-zsorder="{{item.is_zsorder}}" class="commodity_To_evaluate flex-level comment_go" data-id="{{item.order_id}}" hidden="{{!(item.order_status==1&&item.pay_status==1&&item.shipping_status==1)}}">确认收货</view> | 155 | <view bindtap="confirmOrder" data-zsorder="{{item.is_zsorder}}" class="commodity_To_evaluate flex-level comment_go" data-id="{{item.order_id}}" hidden="{{!(item.order_status==1&&item.pay_status==1&&item.shipping_status==1)}}">确认收货</view> |
| 156 | <view bindtap="confirmOrder" data-zsorder="{{item.is_zsorder}}" class="commodity_To_evaluate flex-level comment_go" data-id="{{item.order_id}}" hidden="{{!(item.order_status==1&&item.pay_status==1&&item.shipping_status==2)}}">确认收货</view> | 156 | <view bindtap="confirmOrder" data-zsorder="{{item.is_zsorder}}" class="commodity_To_evaluate flex-level comment_go" data-id="{{item.order_id}}" hidden="{{!(item.order_status==1&&item.pay_status==1&&item.shipping_status==2)}}">确认收货</view> |
| 157 | </block> | 157 | </block> |
| 158 | - | 158 | + |
| 159 | + <block wx:if="{{item.order_status==2 || item.order_status==4 }}"> | ||
| 160 | + <view bindtap="moreOrder" class="commodity_To_evaluate flex-level comment_go" style="background-color: #feca53;" | ||
| 161 | + data-index="{{index}}" >再来一单</view> | ||
| 162 | + </block> | ||
| 163 | + | ||
| 159 | <block wx:if="{{item.order_status==2 && item.is_zsorder!=4}}"> | 164 | <block wx:if="{{item.order_status==2 && item.is_zsorder!=4}}"> |
| 160 | <navigator wx:if="{{item.order_goods.length>1}}" class="order-btn white red-b" | 165 | <navigator wx:if="{{item.order_goods.length>1}}" class="order-btn white red-b" |
| 161 | url="/pages/user/comment/comment?status=0&order_id={{item.order_id}}">评价</navigator> | 166 | url="/pages/user/comment/comment?status=0&order_id={{item.order_id}}">评价</navigator> |
pages/user/plus/plus.js
| @@ -62,7 +62,7 @@ Page({ | @@ -62,7 +62,7 @@ Page({ | ||
| 62 | //--先判断会员状态-- | 62 | //--先判断会员状态-- |
| 63 | var user_info = getApp().globalData.userInfo; | 63 | var user_info = getApp().globalData.userInfo; |
| 64 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | 64 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { |
| 65 | - wx.navigateTo({ url: '/pages/getphone/getphone?first_leader=' + fir_leader, }) | 65 | + wx.navigateTo({ url: '/pages/togoin/togoin?first_leader=' + fir_leader, }) |
| 66 | return false; | 66 | return false; |
| 67 | } | 67 | } |
| 68 | //-----------商家配置信息----- 等级卡规则,是否又开邀请码,营业员------------ | 68 | //-----------商家配置信息----- 等级卡规则,是否又开邀请码,营业员------------ |
| @@ -319,8 +319,17 @@ Page({ | @@ -319,8 +319,17 @@ Page({ | ||
| 319 | 319 | ||
| 320 | //--支付成功,跳转到等级卡续费页面-- | 320 | //--支付成功,跳转到等级卡续费页面-- |
| 321 | success:function () { | 321 | success:function () { |
| 322 | - var u_url = "/pages/user/cardinfo/cardinfo"; | ||
| 323 | - wx.reLaunch({url: u_url}) | 322 | + |
| 323 | + if(getApp().globalData.plus_buy_back){ | ||
| 324 | + getApp().globalData.plus_buy_back=0; | ||
| 325 | + getApp().globalData.is_card_back=1; | ||
| 326 | + //返回购物车购买 | ||
| 327 | + wx.navigateBack(); | ||
| 328 | + }else{ | ||
| 329 | + var u_url = "/pages/user/cardinfo/cardinfo"; | ||
| 330 | + wx.reLaunch({url: u_url}) | ||
| 331 | + } | ||
| 332 | + | ||
| 324 | }, | 333 | }, |
| 325 | 334 | ||
| 326 | //--绑定邀请码的输入-- | 335 | //--绑定邀请码的输入-- |
| @@ -370,7 +379,7 @@ Page({ | @@ -370,7 +379,7 @@ Page({ | ||
| 370 | //--先判断会员状态-- | 379 | //--先判断会员状态-- |
| 371 | var user_info = getApp().globalData.userInfo; | 380 | var user_info = getApp().globalData.userInfo; |
| 372 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | 381 | if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { |
| 373 | - wx.navigateTo({ url: '/pages/getphone/getphone?first_leader=' + fir_leader, }) | 382 | + wx.navigateTo({ url: '/pages/togoin/togoin?first_leader=' + fir_leader, }) |
| 374 | return false; | 383 | return false; |
| 375 | } | 384 | } |
| 376 | } | 385 | } |
pages/user/userinfo/userinfo.js
| @@ -248,7 +248,7 @@ Page({ | @@ -248,7 +248,7 @@ Page({ | ||
| 248 | wait_for_store_config: function() { | 248 | wait_for_store_config: function() { |
| 249 | var th = this; | 249 | var th = this; |
| 250 | wx.getLocation({ | 250 | wx.getLocation({ |
| 251 | - type: 'wgs84', | 251 | + type: 'gcj02', |
| 252 | success: function(res) { | 252 | success: function(res) { |
| 253 | th.data.lat = res.latitude; | 253 | th.data.lat = res.latitude; |
| 254 | th.data.lon = res.longitude; | 254 | th.data.lon = res.longitude; |
utils/auth.js
| @@ -207,47 +207,10 @@ module.exports = { | @@ -207,47 +207,10 @@ module.exports = { | ||
| 207 | //获取本地存储 | 207 | //获取本地存储 |
| 208 | var a = wx.getStorageSync("wx_user_info"); | 208 | var a = wx.getStorageSync("wx_user_info"); |
| 209 | var userInfo = a.userInfo; | 209 | var userInfo = a.userInfo; |
| 210 | - if (userInfo==undefined){ //判断本地是数据是否正确 | ||
| 211 | - wx.getUserInfo({ | ||
| 212 | - success: function (res) | ||
| 213 | - { | ||
| 214 | - console.log('doGetWxUser'); | ||
| 215 | - console.log(res); | ||
| 216 | - console.log(ind); | ||
| 217 | - //组装用户 | ||
| 218 | - var ar = {'nickName':res.userInfo.nickName, | ||
| 219 | - 'avatarUrl':res.userInfo.avatarUrl, | ||
| 220 | - 'gender': res.userInfo.gender}; | ||
| 221 | - //----会员记录到全局------ | ||
| 222 | - n.globalData.getu = ar; | ||
| 223 | - var uu = {'userInfo': ar}; | ||
| 224 | - a=uu; | ||
| 225 | - | ||
| 226 | - if(ind==1){ | ||
| 227 | - a && void 0 != a ? (n.globalData.wechatUser = a, o.login_fir(t, a, e)) : o.goGetUserInfo(); | ||
| 228 | - }else{ | ||
| 229 | - a && void 0 != a ? (n.globalData.wechatUser = a, o.login(t, a, e)) : o.goGetUserInfo(); | ||
| 230 | - } | ||
| 231 | - | ||
| 232 | - }, | ||
| 233 | - | ||
| 234 | - fail: function () { | ||
| 235 | - //---获取用户信息失败后。请跳转授权页面-- | ||
| 236 | - wx.showModal({ | ||
| 237 | - title: '警告', | ||
| 238 | - content: '尚未进行授权,请点击确定跳转到授权页面进行授权。', | ||
| 239 | - success: function (res) { | ||
| 240 | - if (res.confirm) { | ||
| 241 | - console.log('用户点击确定') | ||
| 242 | - wx.navigateTo({ | ||
| 243 | - url: '/pages/togoin/togoin', | ||
| 244 | - }) | ||
| 245 | - } | ||
| 246 | - } | ||
| 247 | - }) | ||
| 248 | - } | ||
| 249 | - | ||
| 250 | - }) | 210 | + if (userInfo==undefined){ |
| 211 | + //判断本地是数据是否正确 | ||
| 212 | + n.goto("/pages/togoin/togoin"); | ||
| 213 | + | ||
| 251 | }else{ | 214 | }else{ |
| 252 | a && void 0 != a ? (n.globalData.wechatUser = a, o.login(t, a, e)) : o.goGetUserInfo(); | 215 | a && void 0 != a ? (n.globalData.wechatUser = a, o.login(t, a, e)) : o.goGetUserInfo(); |
| 253 | } | 216 | } |
utils/request.js
| @@ -232,6 +232,27 @@ module.exports = { | @@ -232,6 +232,27 @@ module.exports = { | ||
| 232 | }) | 232 | }) |
| 233 | }) | 233 | }) |
| 234 | }, | 234 | }, |
| 235 | + | ||
| 236 | + | ||
| 237 | + //---promise的使用delete---- | ||
| 238 | + promisePut:function(url,data){ | ||
| 239 | + var th=this; | ||
| 240 | + if(url.indexOf("http")==-1) url=getApp().globalData.setting.url +url; | ||
| 241 | + return new Promise((resolve, reject) => { | ||
| 242 | + data.isShowLoading && th.showLoading(); | ||
| 243 | + wx.request({ | ||
| 244 | + url, | ||
| 245 | + method: 'PUT', | ||
| 246 | + header: {"content-type": "application/x-www-form-urlencoded" }, | ||
| 247 | + data:data.data, | ||
| 248 | + success(res) { | ||
| 249 | + data.isShowLoading && th.hideLoading(); | ||
| 250 | + resolve(res); | ||
| 251 | + }, | ||
| 252 | + fail(err) { data.isShowLoading && th.hideLoading(); reject(err); } | ||
| 253 | + }) | ||
| 254 | + }) | ||
| 255 | + }, | ||
| 235 | 256 | ||
| 236 | //--------具有时间限制的读取接口---------- | 257 | //--------具有时间限制的读取接口---------- |
| 237 | time_limit_get(time,url,data){ | 258 | time_limit_get(time,url,data){ |
utils/util.js
| @@ -410,6 +410,60 @@ function ob_to_parm(ob){ | @@ -410,6 +410,60 @@ function ob_to_parm(ob){ | ||
| 410 | return parm; | 410 | return parm; |
| 411 | } | 411 | } |
| 412 | 412 | ||
| 413 | +function encodeUTF8(s) { | ||
| 414 | + var i, r = [], c, x; | ||
| 415 | + for (i = 0; i < s.length; i++) | ||
| 416 | + if ((c = s.charCodeAt(i)) < 0x80) r.push(c); | ||
| 417 | + else if (c < 0x800) r.push(0xC0 + (c >> 6 & 0x1F), 0x80 + (c & 0x3F)); | ||
| 418 | + else { | ||
| 419 | + if ((x = c ^ 0xD800) >> 10 == 0) //对四字节UTF-16转换为Unicode | ||
| 420 | + c = (x << 10) + (s.charCodeAt(++i) ^ 0xDC00) + 0x10000, | ||
| 421 | + r.push(0xF0 + (c >> 18 & 0x7), 0x80 + (c >> 12 & 0x3F)); | ||
| 422 | + else r.push(0xE0 + (c >> 12 & 0xF)); | ||
| 423 | + r.push(0x80 + (c >> 6 & 0x3F), 0x80 + (c & 0x3F)); | ||
| 424 | + }; | ||
| 425 | + return r; | ||
| 426 | +}; | ||
| 427 | +// 字符串加密成 hex 字符串 | ||
| 428 | +function sha1(s) { | ||
| 429 | + var data = new Uint8Array(encodeUTF8(s)) | ||
| 430 | + var i, j, t; | ||
| 431 | + var l = ((data.length + 8) >>> 6 << 4) + 16, s = new Uint8Array(l << 2); | ||
| 432 | + s.set(new Uint8Array(data.buffer)), s = new Uint32Array(s.buffer); | ||
| 433 | + for (t = new DataView(s.buffer), i = 0; i < l; i++)s[i] = t.getUint32(i << 2); | ||
| 434 | + s[data.length >> 2] |= 0x80 << (24 - (data.length & 3) * 8); | ||
| 435 | + s[l - 1] = data.length << 3; | ||
| 436 | + var w = [], f = [ | ||
| 437 | + function () { return m[1] & m[2] | ~m[1] & m[3]; }, | ||
| 438 | + function () { return m[1] ^ m[2] ^ m[3]; }, | ||
| 439 | + function () { return m[1] & m[2] | m[1] & m[3] | m[2] & m[3]; }, | ||
| 440 | + function () { return m[1] ^ m[2] ^ m[3]; } | ||
| 441 | + ], rol = function (n, c) { return n << c | n >>> (32 - c); }, | ||
| 442 | + k = [1518500249, 1859775393, -1894007588, -899497514], | ||
| 443 | + m = [1732584193, -271733879, null, null, -1009589776]; | ||
| 444 | + m[2] = ~m[0], m[3] = ~m[1]; | ||
| 445 | + for (i = 0; i < s.length; i += 16) { | ||
| 446 | + var o = m.slice(0); | ||
| 447 | + for (j = 0; j < 80; j++) | ||
| 448 | + w[j] = j < 16 ? s[i + j] : rol(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1), | ||
| 449 | + t = rol(m[0], 5) + f[j / 20 | 0]() + m[4] + w[j] + k[j / 20 | 0] | 0, | ||
| 450 | + m[1] = rol(m[1], 30), m.pop(), m.unshift(t); | ||
| 451 | + for (j = 0; j < 5; j++)m[j] = m[j] + o[j] | 0; | ||
| 452 | + }; | ||
| 453 | + t = new DataView(new Uint32Array(m).buffer); | ||
| 454 | + for (var i = 0; i < 5; i++)m[i] = t.getUint32(i << 2); | ||
| 455 | + | ||
| 456 | + var hex = Array.prototype.map.call(new Uint8Array(new Uint32Array(m).buffer), function (e) { | ||
| 457 | + return (e < 16 ? "0" : "") + e.toString(16); | ||
| 458 | + }).join(""); | ||
| 459 | + | ||
| 460 | + return hex; | ||
| 461 | +}; | ||
| 462 | + | ||
| 463 | + | ||
| 464 | + | ||
| 465 | + | ||
| 466 | + | ||
| 413 | module.exports = { | 467 | module.exports = { |
| 414 | formatTime: function(e, r) { | 468 | formatTime: function(e, r) { |
| 415 | var t = e ? new Date(1e3 * e) : new Date(), n = t.getFullYear(), o = t.getMonth() + 1, a = t.getDate(), u = t.getHours(), i = t.getMinutes(), f = t.getSeconds(), s = function(e) { | 469 | var t = e ? new Date(1e3 * e) : new Date(), n = t.getFullYear(), o = t.getMonth() + 1, a = t.getDate(), u = t.getHours(), i = t.getMinutes(), f = t.getSeconds(), s = function(e) { |
| @@ -515,5 +569,6 @@ module.exports = { | @@ -515,5 +569,6 @@ module.exports = { | ||
| 515 | mergeArray:mergeArray, //数组合并 | 569 | mergeArray:mergeArray, //数组合并 |
| 516 | isContained:isContained, //是否包含 | 570 | isContained:isContained, //是否包含 |
| 517 | base64_encode:base64_encode, //64位加密 | 571 | base64_encode:base64_encode, //64位加密 |
| 518 | - ob_to_parm:ob_to_parm //对象变成参数 | 572 | + ob_to_parm:ob_to_parm ,//对象变成参数 |
| 573 | + sha1:sha1, //sha1进行签名 | ||
| 519 | }; | 574 | }; |