From a4ededa5173b24094bd237f8fbd074ed0252fb99 Mon Sep 17 00:00:00 2001
From: yvan.ni <765199919@qq.com>
Date: Thu, 24 Sep 2020 17:39:08 +0800
Subject: [PATCH] 1. OA单和 12点优化的内容
---
app.wxss | 4 ++--
components/diy_searchbox/diy_searchbox.js | 43 ++++++++++++++++++++++++++++++++++++-------
components/diy_searchbox/diy_searchbox.wxml | 29 ++++++++++++++++++++++-------
components/diy_searchbox/diy_searchbox.wxss | 10 ++++++----
components/goods_list/goods_list.js | 3 +--
images/share/hui_hear_pic.png | Bin 28239 -> 0 bytes
images/share/mackground.png | Bin 10653 -> 0 bytes
images/share/s_gou.png | Bin 24339 -> 0 bytes
packageA/pages/prom_list/prom_list.js | 26 +++++++++++++++++++++-----
pages/cart/cart2/cart2.js | 132 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------
pages/cart/cart2/cart2.wxml | 41 +++++++++++++++++++++++++++++++++++++++--
pages/cart/cart2/cart2.wxss | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
pages/cart/cart2_pt/cart2_pt.js | 4 ++--
pages/giftpack/birthdaygift/birthdaygift.js | 2 +-
pages/giftpack/buygiftpack/giftpackbuy.js | 2 +-
pages/giftpack/evaluategift/evaluategift.js | 2 +-
pages/giftpack/festival/festival.js | 2 +-
pages/giftpack/giftpacklist/giftpacklist.js | 2 +-
pages/giftpack/mygiftpack/mygiftpack.js | 2 +-
pages/giftpack/newvipgift/newvipgift.js | 2 +-
pages/goods/goodsInfo/goodsInfo.js | 53 +++++++++++++++++++++++++++++++++++++++--------------
pages/index/index/index.js | 6 ++++--
pages/store/index.js | 2 +-
pages/tabbar/tabbar.js | 0
pages/tabbar/tabbar.json | 3 ---
pages/tabbar/tabbar.wxml | 117 ---------------------------------------------------------------------------------------------------------------------
pages/tabbar/tabbar.wxss | 8 --------
pages/team/team_show/team_show.js | 166 ++++++++++++++++++++++++----------------------------------------------------------------------------------------------------------------------------------------------
pages/togoin/togoin.js | 182 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------
pages/togoin/togoin.json | 5 ++++-
pages/togoin/togoin.wxml | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++--------
pages/togoin/togoin.wxss | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------
pages/user/assistance/assistance.js | 2 +-
pages/user/assistance/friend_assistance.js | 4 ++--
pages/user/assistance/giftpacklist.js | 2 +-
pages/user/assistance/task_assistance.js | 2 +-
pages/user/cardinfo/cardinfo.js | 2 +-
pages/user/coupons/coupons.js | 2 +-
pages/user/deposit/deposit.js | 2 +-
pages/user/index/index.js | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------
pages/user/index/index.wxml | 7 +++++++
pages/user/integral/integral.js | 2 +-
pages/user/member/bring/bring.js | 2 +-
pages/user/member/menber.js | 2 +-
pages/user/my_service/appment_main.js | 2 +-
pages/user/order_detail/order_detail.js | 430 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
pages/user/order_detail/order_detail.wxml | 7 ++++++-
pages/user/order_list/order_list.js | 439 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
pages/user/order_list/order_list.wxml | 7 ++++++-
pages/user/plus/plus.js | 17 +++++++++++++----
pages/user/userinfo/userinfo.js | 2 +-
utils/auth.js | 45 ++++-----------------------------------------
utils/request.js | 21 +++++++++++++++++++++
utils/util.js | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
54 files changed, 1689 insertions(+), 492 deletions(-)
delete mode 100644 pages/tabbar/tabbar.js
delete mode 100644 pages/tabbar/tabbar.json
delete mode 100644 pages/tabbar/tabbar.wxml
delete mode 100644 pages/tabbar/tabbar.wxss
diff --git a/app.wxss b/app.wxss
index 447ec7f..cfd7bca 100644
--- a/app.wxss
+++ b/app.wxss
@@ -293,7 +293,6 @@ justify-content:space-around;
-
/* 7.26 */
.white{
color: #fff;
@@ -413,4 +412,5 @@ background: #ffe3e2;
.lh1 {
line-height: 1;
-}
\ No newline at end of file
+}
+
diff --git a/components/diy_searchbox/diy_searchbox.js b/components/diy_searchbox/diy_searchbox.js
index 283717d..75b51e0 100644
--- a/components/diy_searchbox/diy_searchbox.js
+++ b/components/diy_searchbox/diy_searchbox.js
@@ -5,7 +5,6 @@ var t = getApp(),
Component({
properties: {
// 这里定义了innerText属性,属性值可以在组件使用时指定
-
object: {
type: Object,
value: null,
@@ -15,19 +14,49 @@ Component({
// 这里是一些组件内部数据
yc:false,
imghost: o.imghost,
- someData: {}
+ someData: {},
+ first:1,
+ inputShowed:1,
+ inputval:'在店铺内搜索',
+ keyword:'',
},
ready: function() {
- console.log("ready");
+ var th=this;
+ getApp().getConfig2(function(e) {
+ //看有没有热搜
+ if(e.hot_keywords)
+ th.setData({keyword:e.hot_keywords});
+ })
},
methods: {
//智能跳转
go_url:function (e) {
var url=e.currentTarget.dataset.url;
getApp().goto(url);
- }
-
-
-
+ },
+ click_sear:function(){
+ //如果搜索的单词为空的时候,就要跳到搜索页
+ if(this.data.keyword!=''){
+ getApp().goto("/pages/goods/search/search");
+ return false;
+ }
+ this.setData({first:0,inputShowed:1,inputval:''});
+ },
+
+ onblur:function(){
+ var val=this.data.inputval;
+ if(val==''){
+ this.setData({first:1,});
+ }
+ },
+ set_input:function(e){
+ var val=e.detail.value;
+ this.setData({inputval:val});
+ },
+ sear:function(){
+ var url="/pages/goods/search/search?s_key="+this.data.inputval;
+ getApp().goto(url);
+ }
+
}
})
\ No newline at end of file
diff --git a/components/diy_searchbox/diy_searchbox.wxml b/components/diy_searchbox/diy_searchbox.wxml
index 2ce8ff1..6a874f3 100644
--- a/components/diy_searchbox/diy_searchbox.wxml
+++ b/components/diy_searchbox/diy_searchbox.wxml
@@ -2,12 +2,22 @@
-
-
-
- 在店铺内搜索
+
+
+
+ 在店铺内搜索
+
+
+
+
+
+
+
+
+
@@ -24,10 +34,15 @@
-
-
- 在店铺内搜索
+
+
+ 在店铺内搜索
+
+
+
+
diff --git a/components/diy_searchbox/diy_searchbox.wxss b/components/diy_searchbox/diy_searchbox.wxss
index f00f7c1..8df14d5 100644
--- a/components/diy_searchbox/diy_searchbox.wxss
+++ b/components/diy_searchbox/diy_searchbox.wxss
@@ -60,9 +60,6 @@
height: 30rpx;
margin-left: 10rpx;
margin-right: 4rpx;
- margin-bottom:-6rpx;
-margin-top:20rpx;
-
}
.s1_gk_a1{
@@ -83,4 +80,9 @@ margin-top:20rpx;
.abs_top2{
position: fixed; z-index: 10;
-}
\ No newline at end of file
+}
+
+.flex{ display: flex; align-items: center;}
+.find_img{margin: 0 20rpx; }
+.find_inp{text-align: left; width: 620rpx;}
+.find_inp2{text-align: left; width: 520rpx;}
\ No newline at end of file
diff --git a/components/goods_list/goods_list.js b/components/goods_list/goods_list.js
index ae03057..287046b 100644
--- a/components/goods_list/goods_list.js
+++ b/components/goods_list/goods_list.js
@@ -62,7 +62,7 @@ Component({
//--- 判断是等级会员,且在有效期范围内 ---
if (user.card_field && now < end) {
var card_name = ob.name_map.get(user.card_field);
- // if (card_name.length > 6) card_name = card_name.substring(0, 7);
+ if (card_name.length > 6) card_name = card_name.substring(0, 6);
th.setData({
card_field: user.card_field,
card_name: card_name,
@@ -166,7 +166,6 @@ Component({
card_name_map.set(name, plusCard[i].CardName);
new_arr.push(plusCard[i]);
-
}
}
var ob = {
diff --git a/images/share/hui_hear_pic.png b/images/share/hui_hear_pic.png
index 91144c7..9ea7b6d 100644
Binary files a/images/share/hui_hear_pic.png and b/images/share/hui_hear_pic.png differ
diff --git a/images/share/mackground.png b/images/share/mackground.png
index 6bcf62e..39396ac 100644
Binary files a/images/share/mackground.png and b/images/share/mackground.png differ
diff --git a/images/share/s_gou.png b/images/share/s_gou.png
index 5e4e765..02a8b0a 100644
Binary files a/images/share/s_gou.png and b/images/share/s_gou.png differ
diff --git a/packageA/pages/prom_list/prom_list.js b/packageA/pages/prom_list/prom_list.js
index 5fef675..6fc346f 100644
--- a/packageA/pages/prom_list/prom_list.js
+++ b/packageA/pages/prom_list/prom_list.js
@@ -770,7 +770,9 @@ Page({
data: {
store_id: o.stoid,
is_show: 1,
- pageSize: 1000
+ pageSize: 1000,
+ orderField:"sort",
+ orderType:'asc',
},
success: function(ee) {
if (ee.data.code == 0) {
@@ -795,12 +797,12 @@ Page({
//----要进行门店分组--------
for (var i = 0; i < sto_arr.length; i++) {
//找一下这个门店有没有在分类数组内
- var find2 = 0,
- find2name = "";
+ var find2 = 0, find2name = "",sort=0;
for (var m = 0; m < sto_cate.length; m++) {
if (sto_arr[i].category_id == sto_cate[m].cat_id) {
find2 = sto_cate[m].cat_id;
find2name = sto_cate[m].cat_name;
+ sort=sto_cate[m].sort;
break;
}
}
@@ -822,6 +824,7 @@ Page({
var item = {
cat_id: find2,
name: find2name,
+ sort:sort,
s_arr: arr0
};
newarr.push(item);
@@ -837,6 +840,7 @@ Page({
var item = {
cat_id: find2,
name: find2name,
+ sort:sort,
s_arr: arr0
};
newarr.push(item);
@@ -845,6 +849,18 @@ Page({
}
}
}
+
+ //门店分类要排序下
+ function compare(property){
+ return function(a,b){
+ var value1 = a[property];
+ var value2 = b[property];
+ return value1 - value2;
+ }
+ }
+ if(newarr.length>0)
+ newarr.sort(compare("sort"));
+
//----安排其他的分类-----
if (qita.length > 0) {
@@ -1135,7 +1151,7 @@ Page({
if (bconfig.is_sort_storage) {
wx.getLocation({
- type: 'wgs84',
+ type: 'gcj02',
success: function(res) {
th.data.lat = res.latitude;
@@ -1464,7 +1480,7 @@ Page({
var e = th.data.bconfig;
if (e.is_sort_storage) {
wx.getLocation({
- type: 'wgs84',
+ type: 'gcj02',
success: function(res) {
th.data.lat = res.latitude;
th.data.lon = res.longitude;
diff --git a/pages/cart/cart2/cart2.js b/pages/cart/cart2/cart2.js
index f1978fe..41e6cba 100644
--- a/pages/cart/cart2/cart2.js
+++ b/pages/cart/cart2/cart2.js
@@ -46,7 +46,9 @@ Page({
bn_exp_type:1, //0是物流 1自提
bn_pick:0, //选择的门店
bn_pickname: "", //选择的门店名称
- bn_t_exp_t:0, //判断商品和门店一起决定的物流自提的方式0 都可以 1自提 2物流
+ bn_t_exp_t:0, //判断商品和门店一起决定的物流自提的方式0 都可以 1自提 2物流
+
+ bn_plus_cut_price:0, //显示等级卡会优惠多少钱
/*------------------------*/
user_addr:null,//物流
userinfo:null, //获取会员
@@ -105,7 +107,11 @@ Page({
//-- order_prom_list --
order_prom_list_cart:null,
- ispt_goods:0, //是否平摊至单品,0要平摊 1不平摊
+ ispt_goods:0, //是否平摊至单品,0要平摊 1不平摊
+ rank_switch:0, //是不是开同等级卡
+ show_card:null, //显示的等级卡
+ card_name:'', //显示的卡的名称
+ card_cut_price:null,//减价多少钱
},
onLoad: function(t) {
@@ -113,7 +119,7 @@ Page({
wx.setNavigationBarTitle({ title: "填写订单",})
var th = this; this.setData({ is_b_now: t.is_bnow == undefined ? 0 : t.is_bnow,});
th.data.param=t;
-
+
//清空is_pick_up
getApp().request.put("/api/weshop/useraddress/updatePickUp", {
data: {user_id: getApp().globalData.user_id, is_pickup: 0},
@@ -121,15 +127,7 @@ Page({
}
});
- //先获取是否有关闭使用优惠券
- getApp().getConfig2(function (ee) {
- var json_d = JSON.parse(ee.switch_list);
- th.data.ispt_goods=json_d.ispt_goods; //是不是平摊到单品的控制参数赋值
- th.setData({ is_close_quan: json_d.is_close_quan,sales_rules:ee.sales_rules});
- //-----先获取物流,再获取用户信息,再展示页面-----
- th.get_wuliu(th.get_info(th.show_page));
- })
-
+
},
onUnload: function () { this.setData({ isclose: 1 })},
onHide: function () {
@@ -155,7 +153,6 @@ Page({
console.log("getuser_addr")
console.log(ie)
-
//地址切换要把包邮券清空
if( !th.data.user_addr || th.data.user_addr.address_id!=ie.address_id){
var using_quan=th.data.using_quan;
@@ -209,6 +206,57 @@ Page({
getApp().globalData.is_cart2_old=0;
}
}
+
+ //先获取是否有关闭使用优惠券
+ getApp().getConfig2(function (ee) {
+ var json_d = JSON.parse(ee.switch_list);
+ th.data.ispt_goods=json_d.ispt_goods; //是不是平摊到单品的控制参数赋值
+ th.setData({ is_close_quan: json_d.is_close_quan,sales_rules:ee.sales_rules,rank_switch:json_d.rank_switch});
+
+ var rank_switch=json_d.rank_switch;
+ var max_price=-1;
+ var show_card=null;
+ var name="";
+ //如果有开等级卡的时候,
+ //因为都是调接口,要返回在计算
+ if(rank_switch==2){
+ //-- 获取所有的等级卡, --
+ getApp().request.promiseGet("/api/weshop/plus/vip/mem/bership/list?storeId=" + os.stoid,
+ {}).then(res => {
+ if(res.data.code==0){
+ var plusCard = res.data.data;
+ //-- 循环判断,拿到最贵的那张卡 --
+ for(var ih in plusCard){
+ if(plusCard[ih].IsStopBuy == true){ continue; }
+ if(max_price<0){
+ max_price=plusCard[ih].CardFee;
+ name='card'+plusCard[ih]['CorrPrice'];
+ show_card=plusCard[ih];
+ }else{
+ if(max_priceitem[th.data.card_name] ){
+ item.goods_price=item[th.data.card_name];
+ carr[i].goods_price=item[th.data.card_name];
+ }
+ }else{
+ // 拼团,搭配购不计算,赠品也不计算,同时会员还未购买等级会员
+ if(item[th.data.card_name]>0 && item['prom_type']!=5 && item['prom_type']!=6 && !th.data.userinfo.card_field
+ && !item.is_gift && !item['is_collocation'] && item.goods_price>item[th.data.card_name] ){
+ item.cut_price= item.goods_price-item[th.data.card_name];
+ carr[i].cut_price=item.goods_price-item[th.data.card_name];
+ }
+
+ }
+
+
item.original_img = oo.imghost + item.original_img;
/*----接口要弄出来的,先顶着-----*/
var pcid = item.pick_id;
@@ -320,7 +391,9 @@ Page({
if (arr.length > 0) {
for (var j = 0; j < arr.length; j++) {
if (arr[j].pickup_id == pcid) {
- arr[j].goods.push(item);
+ arr[j].goods.push(item);
+ //-- 把等级卡会优惠多少钱装进去 --
+ if(item.cut_price) arr[j].card_cut_price+=arr[j].cut_price;
find = 1;break;
}
}
@@ -348,6 +421,7 @@ Page({
//如果是物流的话,全部自提的控制要弄成0
if (e_t == 0) th.setData({ is_all_zt:0});
+
var narr = new Array(); narr.push(item);
//-----------拼装购物车结算的数组,如果有默认物流时要用默认物流编号-----------------
@@ -359,9 +433,13 @@ Page({
}
var ie = {
- pickup_id: pcid, pname: pikname, goods: narr, exp_type: e_t, wind: m_wind, distr_t: dis_t,
+ pickup_id: pcid, pname: pikname, goods: narr, exp_type: e_t, wind: m_wind, distr_t: dis_t,card_cut_price:0,
goods_price: 0, shipping_price: 0, user_money: 0, total_amount: 0, order_amount: 0, user_note:0};
+
+ //-- 把等级卡会优惠多少钱装进去 --
+ if(item.cut_price) ie.card_cut_price+=item.cut_price;
arr.push(ie);
+
}
}
//深拷贝
@@ -414,6 +492,21 @@ Page({
var item=th.data.wu_arr[k]; if(def_exp_code==item.code){ m_wind=k; }
}
}
+
+ //---是不是购买等级卡成功的返回---等级卡显示的判断---
+ var is_card_back=getApp().globalData.is_card_back;
+ if(is_card_back){
+ gg.goods_price=gd[th.data.card_name];
+ getApp().globalData.is_card_back=0;
+ th.setData({card_cut_price:0});
+ }else{
+ //--- 商品不能是搭配购,商家等级卡开通的情况下, 会员不是等级会员的情况, 商品有设置等级卡价格,同时等级卡价格小于商品的价格
+ 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){
+ var cut_p= gg.goods_price-gd[th.data.card_name];
+ th.setData({card_cut_price:cut_p});
+ }
+ }
+
switch (gd.prom_type){
case 0:
case 2:
@@ -480,7 +573,6 @@ Page({
th.get_buy_now_quan();
})
-
}else{
//--看是不是搭配促销--
if(gg.prom_type==5){
@@ -2942,7 +3034,13 @@ Page({
}
}
return is_use;
- }
+ },
+
+ //跳转到购买卡
+ buycard:function(){
+ getApp().goto("/pages/user/plus/plus");
+ getApp().globalData.plus_buy_back=1;
+ }
diff --git a/pages/cart/cart2/cart2.wxml b/pages/cart/cart2/cart2.wxml
index 6f51416..0fa6006 100644
--- a/pages/cart/cart2/cart2.wxml
+++ b/pages/cart/cart2/cart2.wxml
@@ -70,9 +70,28 @@
x{{items.goods_num}}
-
-
+
+
+
+
+
+
+ image>
+ {{show_card.CardName}}
+
+ 立减 {{filters.toFix(item.card_cut_price,2) }} 元
+
+
+ vip超级会员仅需{{show_card.CardFee}}元
+
+
+
+
+ 立即开通
+
+
+
@@ -244,6 +263,24 @@
+
+
+
+
+ image>
+ {{show_card.CardName}}
+
+ 立减 {{filters.toFix(card_cut_price,2) }} 元
+
+
+ vip超级会员仅需{{show_card.CardFee}}元
+
+
+
+
+ 立即开通
+
+
diff --git a/pages/cart/cart2/cart2.wxss b/pages/cart/cart2/cart2.wxss
index 0da96cd..a3ed00c 100644
--- a/pages/cart/cart2/cart2.wxss
+++ b/pages/cart/cart2/cart2.wxss
@@ -899,3 +899,62 @@ margin-left: 20rpx;
background: none;
opacity: 1;
}
+
+
+.plus_buy{
+ background-color: #fff;
+ margin:15rpx 0;
+ padding: 20rpx 10rpx;
+ position: relative;
+}
+
+
+.card_bg {
+ box-sizing: border-box;
+ padding: 2rpx 10rpx;
+ height: 28rpx;
+ border-radius: 26rpx;
+ font-size: 18rpx;
+ line-height: 28rpx;
+ max-width: 210rpx;
+ background: #333;
+ color: #fff;
+ margin-left: 8rpx;
+ position:relative;
+ top:7rpx;
+}
+
+.card_bg image {
+ width: 19rpx;
+ height: 19rpx;
+ margin-right: 8rpx;
+}
+
+/* .card_bg .card_name {
+ max-width: 76rpx;
+ width: auto;
+ overflow: hidden;
+ white-space: nowrap;
+} */
+
+.card_name {
+ position: relative;
+ top: -4rpx;
+ margin-left: 6px;
+}
+
+.car_tri_up {
+ width: 0;height: 0;
+ border-left: 20rpx solid transparent;
+ border-right: 20rpx solid transparent;
+ border-bottom: 20rpx solid #fff;
+ position: absolute;
+ right: 20rpx;
+ top:-10rpx
+}
+.card_op{
+ position: absolute;
+ right: 20rpx;
+ top:36rpx
+}
+
diff --git a/pages/cart/cart2_pt/cart2_pt.js b/pages/cart/cart2_pt/cart2_pt.js
index c1dd1d7..f4cbce2 100644
--- a/pages/cart/cart2_pt/cart2_pt.js
+++ b/pages/cart/cart2_pt/cart2_pt.js
@@ -294,8 +294,8 @@ Page({
console.log('calculatePrice2222');
console.log(rs);
var o_shipping_price = 0, goods_weight = -1, goods_piece = -1;
- //-----------当地址不为空,且是物流时,计算物流费用----------
- if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 ){
+ //-----------当地址不为空,且是物流时,计算物流费用,同时阶梯团不计算拼团价格----------
+ if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && th.data.kt_type!=3 ){
switch (good['exp_sum_type']) {
case 1:
//统一运费
diff --git a/pages/giftpack/birthdaygift/birthdaygift.js b/pages/giftpack/birthdaygift/birthdaygift.js
index 7070465..688561f 100644
--- a/pages/giftpack/birthdaygift/birthdaygift.js
+++ b/pages/giftpack/birthdaygift/birthdaygift.js
@@ -127,7 +127,7 @@ Page({
//--先判断会员状态--
var user_info = getApp().globalData.userInfo;
if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
- getApp().goto('/pages/getphone/getphone');
+ getApp().goto('/pages/togoin/togoin');
return false;
}
this.GetList();
diff --git a/pages/giftpack/buygiftpack/giftpackbuy.js b/pages/giftpack/buygiftpack/giftpackbuy.js
index 9c60f1e..7cfb105 100644
--- a/pages/giftpack/buygiftpack/giftpackbuy.js
+++ b/pages/giftpack/buygiftpack/giftpackbuy.js
@@ -41,7 +41,7 @@ Page({
//--先判断会员状态--
var user_info = getApp().globalData.userInfo;
if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
- getApp().goto('/pages/getphone/getphone');
+ getApp().goto('/pages/togoin/togoin');
return false;
}
this.getList();
diff --git a/pages/giftpack/evaluategift/evaluategift.js b/pages/giftpack/evaluategift/evaluategift.js
index 68b985d..7e326e4 100644
--- a/pages/giftpack/evaluategift/evaluategift.js
+++ b/pages/giftpack/evaluategift/evaluategift.js
@@ -140,7 +140,7 @@ Page({
//--先判断会员状态--
var user_info = getApp().globalData.userInfo;
if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
- getApp().goto('/pages/getphone/getphone');
+ getApp().goto('/pages/togoin/togoin');
return false;
}
diff --git a/pages/giftpack/festival/festival.js b/pages/giftpack/festival/festival.js
index 6666a6a..0e8767b 100644
--- a/pages/giftpack/festival/festival.js
+++ b/pages/giftpack/festival/festival.js
@@ -133,7 +133,7 @@ Page({
//--先判断会员状态--
var user_info = getApp().globalData.userInfo;
if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
- getApp().goto('/pages/getphone/getphone');
+ getApp().goto('/pages/togoin/togoin');
return false;
}
this.is_festival();
diff --git a/pages/giftpack/giftpacklist/giftpacklist.js b/pages/giftpack/giftpacklist/giftpacklist.js
index 9f55db1..ab300ff 100644
--- a/pages/giftpack/giftpacklist/giftpacklist.js
+++ b/pages/giftpack/giftpacklist/giftpacklist.js
@@ -45,7 +45,7 @@ Page({
//--先判断会员状态--
var user_info = getApp().globalData.userInfo;
if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
- getApp().goto('/pages/getphone/getphone');
+ getApp().goto('/pages/togoin/togoin');
return false;
}
diff --git a/pages/giftpack/mygiftpack/mygiftpack.js b/pages/giftpack/mygiftpack/mygiftpack.js
index 6138b07..4cc3f63 100644
--- a/pages/giftpack/mygiftpack/mygiftpack.js
+++ b/pages/giftpack/mygiftpack/mygiftpack.js
@@ -42,7 +42,7 @@ Page({
//--先判断会员状态--
var user_info = getApp().globalData.userInfo;
if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
- getApp().goto('/pages/getphone/getphone');
+ getApp().goto('/pages/togoin/togoin');
return false;
}
this.getList();
diff --git a/pages/giftpack/newvipgift/newvipgift.js b/pages/giftpack/newvipgift/newvipgift.js
index a4c9453..467c9a0 100644
--- a/pages/giftpack/newvipgift/newvipgift.js
+++ b/pages/giftpack/newvipgift/newvipgift.js
@@ -126,7 +126,7 @@ Page({
//--先判断会员状态--
var user_info = getApp().globalData.userInfo;
if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
- getApp().goto('/pages/getphone/getphone');
+ getApp().goto('/pages/togoin/togoin');
return false;
}
this.GetList();
diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js
index 4e9f01e..f487420 100644
--- a/pages/goods/goodsInfo/goodsInfo.js
+++ b/pages/goods/goodsInfo/goodsInfo.js
@@ -347,7 +347,7 @@ Page({
//--- 判断是等级会员,且在有效期范围内 ---
if(user.card_field && now6) card_name=card_name.substring(0,7);
+ if(card_name.length>6) card_name=card_name.substring(0,6);
var is_near_date=0;
if(end-now<60*60*30*24) is_near_date=1; //如果小于30天
@@ -1345,7 +1345,7 @@ Page({
var user_info = getApp().globalData.userInfo;
if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
wx.navigateTo({
- url: '/pages/getphone/getphone',
+ url: '/pages/togoin/togoin',
})
return false;
}
@@ -1520,12 +1520,18 @@ Page({
if(getApp().globalData.user_id){
url+="&first_leader="+getApp().globalData.user_id;
}
-
- return {
+
+ var ob={
title: price + "元 " +title,
path:url,
imageUrl: img,
- }
+ };
+ if(th.data.prom_type==6){
+ title+='\n'+th.data.prom_act.share_remark;
+ ob.title=title;
+ ob.desc=th.data.prom_act.share_remark;
+ }
+ return ob;
},
@@ -1767,7 +1773,6 @@ Page({
th.setData({def_pick_store:null});
}
-
//----------获取门店----------------
getApp().request.promiseGet("/api/weshop/pickup/list", {
data: dd,
@@ -1828,7 +1833,9 @@ Page({
data: {
store_id: o.stoid,
is_show: 1,
- pageSize: 1000
+ pageSize: 1000,
+ orderField:"sort",
+ orderType:'asc',
},
success: function(ee) {
if (ee.data.code == 0) {
@@ -1853,12 +1860,12 @@ Page({
//----要进行门店分组--------
for (var i = 0; i < sto_arr.length; i++) {
//找一下这个门店有没有在分类数组内
- var find2 = 0,
- find2name = "";
+ var find2 = 0, find2name = "",sort=0;
for (var m = 0; m < sto_cate.length; m++) {
if (sto_arr[i].category_id == sto_cate[m].cat_id) {
find2 = sto_cate[m].cat_id;
find2name = sto_cate[m].cat_name;
+ sort = sto_cate[m].sort;
break;
}
}
@@ -1880,6 +1887,7 @@ Page({
var item = {
cat_id: find2,
name: find2name,
+ sort:sort,
s_arr: arr0
};
newarr.push(item);
@@ -1895,6 +1903,7 @@ Page({
var item = {
cat_id: find2,
name: find2name,
+ sort:sort,
s_arr: arr0
};
newarr.push(item);
@@ -1903,6 +1912,18 @@ Page({
}
}
}
+
+ //门店分类要排序下
+ function compare(property){
+ return function(a,b){
+ var value1 = a[property];
+ var value2 = b[property];
+ return value1 - value2;
+ }
+ }
+ if(newarr.length>0)
+ newarr.sort(compare("sort"));
+
//----安排其他的分类-----
if (qita.length > 0) {
@@ -1913,6 +1934,10 @@ Page({
};
newarr.push(item);
}
+
+
+
+
th.setData({
is_show_sto_cat: 1,
all_sto: newarr
@@ -2666,7 +2691,7 @@ Page({
var user_info = getApp().globalData.userInfo;
if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
wx.navigateTo({
- url: '/pages/getphone/getphone',
+ url: '/pages/togoin/togoin',
})
return false;
}
@@ -3168,7 +3193,7 @@ Page({
var user_info = getApp().globalData.userInfo;
if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
wx.navigateTo({
- url: '/pages/getphone/getphone',
+ url: '/pages/togoin/togoin',
})
return false;
}
@@ -3225,7 +3250,7 @@ Page({
var user_info = getApp().globalData.userInfo;
if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
//getApp().my_warnning("请先登录",0,this);
- wx.navigateTo({ url: '/pages/getphone/getphone', })
+ wx.navigateTo({ url: '/pages/togoin/togoin', })
return false;
}
@@ -3698,7 +3723,7 @@ Page({
if (bconfig.is_sort_storage) {
wx.getLocation({
- type: 'wgs84',
+ type: 'gcj02',
success: function(res) {
th.data.lat = res.latitude;
@@ -4039,7 +4064,7 @@ Page({
var e = th.data.bconfig;
if (e.is_sort_storage) {
wx.getLocation({
- type: 'wgs84',
+ type: 'gcj02',
success: function(res) {
th.data.lat = res.latitude;
th.data.lon = res.longitude;
diff --git a/pages/index/index/index.js b/pages/index/index/index.js
index bf20a88..1a2b376 100644
--- a/pages/index/index/index.js
+++ b/pages/index/index/index.js
@@ -16,6 +16,8 @@ var api = require('../../../api/api.js');
var d = getApp().globalData;
+
+
Page({
data: {
url: o.imghost,
@@ -730,8 +732,8 @@ Page({
var user_info = getApp().globalData.userInfo;
if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
wx.navigateTo({
- //url: '/pages/togoin/togoin',
- url: '/pages/getphone/getphone',
+ url: '/pages/togoin/togoin',
+ //url: '/pages/getphone/getphone',
})
return false;
}
diff --git a/pages/store/index.js b/pages/store/index.js
index 8601e17..90e5d09 100644
--- a/pages/store/index.js
+++ b/pages/store/index.js
@@ -23,7 +23,7 @@ Page({
onLoad:function(e){
var th=this;
wx.getLocation({
- type: 'wgs84',
+ type: 'gcj02',
success: function(res) {
th.data.lat = res.latitude;
th.data.lon = res.longitude;
diff --git a/pages/tabbar/tabbar.js b/pages/tabbar/tabbar.js
deleted file mode 100644
index e69de29..0000000
--- a/pages/tabbar/tabbar.js
+++ /dev/null
diff --git a/pages/tabbar/tabbar.json b/pages/tabbar/tabbar.json
deleted file mode 100644
index 8835af0..0000000
--- a/pages/tabbar/tabbar.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "usingComponents": {}
-}
\ No newline at end of file
diff --git a/pages/tabbar/tabbar.wxml b/pages/tabbar/tabbar.wxml
deleted file mode 100644
index 53a2613..0000000
--- a/pages/tabbar/tabbar.wxml
+++ /dev/null
@@ -1,117 +0,0 @@
-
-
-
-
-
-
-
-
-
- {{tabBar.cartGoodsNum}}
-
-
-
-
-
- {{item.nav_name}}
-
-
-
-
-
- {{tabBar.cartGoodsNum}}
-
-
-
-
-
- {{item.nav_name}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 首页
-
-
-
-
-
-
-
- 首页
-
-
-
-
-
-
-
-
-
-
- 分类
-
-
-
-
-
-
-
- 分类
-
-
-
-
-
-
-
-
- {{tabBar.cartGoodsNum}}
-
-
-
- 购物车
-
-
-
-
-
- {{tabBar.cartGoodsNum}}
-
-
-
- 购物车
-
-
-
-
-
-
-
-
-
- 我的
-
-
-
-
-
-
-
- 我的
-
-
-
-
-
diff --git a/pages/tabbar/tabbar.wxss b/pages/tabbar/tabbar.wxss
deleted file mode 100644
index d7bf8ae..0000000
--- a/pages/tabbar/tabbar.wxss
+++ /dev/null
@@ -1,8 +0,0 @@
-.menu_red{
-
- 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;
-}
-
-.menu_default_red{
- 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%
-}
\ No newline at end of file
diff --git a/pages/team/team_show/team_show.js b/pages/team/team_show/team_show.js
index 16591d5..2a8e884 100644
--- a/pages/team/team_show/team_show.js
+++ b/pages/team/team_show/team_show.js
@@ -148,7 +148,7 @@ Page({
//--先判断会员状态--
var user_info=getApp().globalData.userInfo;
if(user_info==null || user_info.mobile==undefined || user_info.mobile=="" || user_info.mobile==null){
- wx.navigateTo({ url: '/pages/getphone/getphone', })
+ wx.navigateTo({ url: '/pages/togoin/togoin', })
return false;
}
@@ -705,141 +705,7 @@ Page({
});
setTimeout(th.countDown2, 1000);
},
- //--获取门店---
- async get_sto(e) {
- var th = this, dd = null,i=getApp().request;
- var g_distr_type = this.data.goods.distr_type;
- if (g_distr_type != 0) {
- dd = {
- store_id: o.stoid,
- distr_type: g_distr_type,
- isstop: 0,
- pageSize: 300
- }
- } else {
- dd = {
- store_id: o.stoid,
- isstop: 0,
- pageSize: 300
- }
- }
- //----------获取门店----------------
- await getApp().request.promiseGet("/api/weshop/pickup/list", {
- data: dd,
- }).then(res => {
- var e = res;
- if (e.data.code == 0) {
- //单总量超出5个的时候
- if (e.data.data.total > 5) {
- i.get("/api/weshop/storagecategory/page", {
- data: {
- store_id: o.stoid,
- is_show: 1,
- pageSize: 300
- },
- success: function(ee) {
- if (ee.data.code == 0) {
- if (ee.data.data.pageData.length > 0) {
- var sto_cate = ee.data.data.pageData;
- var sto_arr = e.data.data.pageData;
- var newarr = new Array();
- var qita = new Array();
- //----要进行门店分组--------
- for (var i = 0; i < sto_arr.length; i++) {
- //找一下这个门店有没有在分类数组内
- var find2 = 0,
- find2name = "";
- for (var m = 0; m < sto_cate.length; m++) {
- if (sto_arr[i].category_id == sto_cate[m].cat_id) {
- find2 = sto_cate[m].cat_id;
- find2name = sto_cate[m].cat_name;
- break;
- }
- }
-
- if (newarr.length > 0) {
- var find = 0;
- //如果有找到,那门店就在这个分组内,否则,分类就要排在其他
- if (find2 != 0) {
- for (var ii = 0; ii < newarr.length; ii++) {
- if (sto_arr[i].category_id == newarr[ii].cat_id) {
- newarr[ii].s_arr.push(sto_arr[i]);
- find = 1;
- break;
- }
- }
- if (find == 0) {
- var arr0 = new Array();
- arr0.push(sto_arr[i]);
- var item = {
- cat_id: find2,
- name: find2name,
- s_arr: arr0
- };
- newarr.push(item);
- }
- } else {
- qita.push(sto_arr[i]);
- }
- } else {
- //如果有找到,那门店就在这个分组内,否则,分类就要排在其他
- if (find2 != 0) {
- var arr0 = new Array();
- arr0.push(sto_arr[i]);
- var item = {
- cat_id: find2,
- name: find2name,
- s_arr: arr0
- };
- newarr.push(item);
- } else {
- qita.push(sto_arr[i]);
- }
- }
- }
-
- //----安排其他的分类-----
- if (qita.length > 0) {
- var item = {
- cat_id: -1,
- name: "其他",
- s_arr: qita
- };
- newarr.push(item);
- }
- //--给门店赋值--
- th.setData({
- is_show_sto_cat: 1,
- ssl: newarr
- });
-
- } else {
- //--只留第二层---
- th.setData({
- is_show_sto_cat: 0,
- ssl_child: e.data.data.pageData,
- });
- }
- } else {
- //--只留第二层---
- th.setData({
- is_show_sto_cat: 0,
- ssl_child: e.data.data.pageData,
- });
- }
- }
- });
- } else {
- //--只留第二层---
- th.setData({
- is_show_sto_cat: 0,
- ssl_child: e.data.data.pageData
- });
- }
- }
- })
- },
-
+
//------去支付,购买-------
go_pay:function () {
var th=this;
@@ -1105,7 +971,7 @@ Page({
if (bconfig.is_sort_storage) {
wx.getLocation({
- type: 'wgs84',
+ type: 'gcj02',
success: function(res) {
th.data.lat = res.latitude;
@@ -1170,7 +1036,7 @@ Page({
var e = th.data.bconfig;
if (e.is_sort_storage) {
wx.getLocation({
- type: 'wgs84',
+ type: 'gcj02',
success: function(res) {
th.data.lat = res.latitude;
th.data.lon = res.longitude;
@@ -1288,7 +1154,9 @@ Page({
data: {
store_id: o.stoid,
is_show: 1,
- pageSize: 1000
+ pageSize: 1000,
+ orderField:"sort",
+ orderType:'asc',
},
success: function(ee) {
if (ee.data.code == 0) {
@@ -1313,12 +1181,12 @@ Page({
//----要进行门店分组--------
for (var i = 0; i < sto_arr.length; i++) {
//找一下这个门店有没有在分类数组内
- var find2 = 0,
- find2name = "";
+ var find2 = 0,find2name = "",sort=0;
for (var m = 0; m < sto_cate.length; m++) {
if (sto_arr[i].category_id == sto_cate[m].cat_id) {
find2 = sto_cate[m].cat_id;
find2name = sto_cate[m].cat_name;
+ sort=sto_cate[m].sort;
break;
}
}
@@ -1340,6 +1208,7 @@ Page({
var item = {
cat_id: find2,
name: find2name,
+ sort:sort,
s_arr: arr0
};
newarr.push(item);
@@ -1355,6 +1224,7 @@ Page({
var item = {
cat_id: find2,
name: find2name,
+ sort:sort,
s_arr: arr0
};
newarr.push(item);
@@ -1363,7 +1233,19 @@ Page({
}
}
}
-
+
+ //门店分类要排序下
+ function compare(property){
+ return function(a,b){
+ var value1 = a[property];
+ var value2 = b[property];
+ return value1 - value2;
+ }
+ }
+ if(newarr.length>0)
+ newarr.sort(compare("sort"));
+
+
//----安排其他的分类-----
if (qita.length > 0) {
var item = {
diff --git a/pages/togoin/togoin.js b/pages/togoin/togoin.js
index d9fd608..626f21b 100644
--- a/pages/togoin/togoin.js
+++ b/pages/togoin/togoin.js
@@ -1,40 +1,150 @@
-var t = require("../../utils/common.js"); var os = getApp().globalData.setting;
+var t = require("../../utils/common.js");
+var app=getApp();
+var os = app.globalData.setting;
+
Page({
- data: {
- store: null,
- imghots: os.imghost,
- },
- onLoad: function () {
- var th = this, app = getApp();
- app.getConfig(function (e) {
- th.setData({ store: e });
- })
- },
- onShow(){
+ data: {
+ user:null,
+ show_bind:0,
+ imghots: os.imghost,
+ store_logo:'',
+ first_leader:'', //-- 邀请人 --
+ },
+ onLoad: function (options) {
+ //--判断是否有接受到邀请人的ID--
+ if(options.first_leader){
+ this.setData({first_leader:options.first_leader});
+ }
+ var th=this;
+ app.getConfig(function (e) {
+ e.store_logo=th.data.imghots+e.store_logo;
+ th.setData({ store: e,store_logo:e.store_logo});
+ })
+ },
+ //绑定手机号
+ getphone:function (e) {
+ //接下来写业务代码登录
+ e=e.detail;
+ if (e.encryptedData==undefined){
+ return app.my_warnning("登录需要授权手机号码!", 0, this);
+ return false;
+ }
+ var th=this;
+ var sessionKey = getApp().globalData.sessionKey;
+ var openid = getApp().globalData.openid;
+ var r=getApp().globalData.getu;
+
+ th.save_the_data(r,e,sessionKey,openid)
+ },
- },
+ //-- 会员授权 --
+ bindGetUserInfo: function(ee) {
+ var that = this;
+ var user=ee.detail.userInfo;
+ //此处授权得到userInfo
+ getApp().globalData.getu = user;
+
+ //--拿下code--
+ wx.login({
+ success: function (o) {
+ var dd = {
+ js_code:o.code,
+ store_id: os.stoid,
+ nickname: app.clear_word(app.globalData.getu.nickName),
+ head_pic: app.clear_word(app.globalData.getu.avatarUrl)
+ };
+
+
+ getApp().request.get("/api/weshop/users/openidandkey", {
+ data: dd,
+ success: function (e) {
+ if(e.data.code==0){
+ that.setData({user:user})
+ //如果有会员的话,没有sessionKey
+ if(!e.data.data.sessionKey){
+ getApp().showWarning("登陆成功");
+ getApp().globalData.userInfo=e.data.data;
+ getApp().globalData.user_id=e.data.data.user_id;
+ getApp().globalData.openid = e.data.data.weapp_openid;
+
+ setTimeout(function () {
+ wx.navigateBack({ delta: 1}) //返回上一页
+ },1000)
+ }else{
+ getApp().globalData.sessionKey=e.data.data.sessionKey;
+ getApp().globalData.openid=e.data.data.openid;;
+ that.setData({show_bind:1})
+ }
+ }else{
+ getApp().confirmBox(e.data.msg);
+ }
+ }
+ });
+ }
+ })
+ },
+
+ //暂不登陆,返回上一页
+ cancle_bind:function () {
+ wx.navigateBack({ delta: 1})
+ },
+
+ close_pop:function(){
+ this.setData({show_bind:0})
+ },
+ show_bind_mobile:function(){
+ this.setData({show_bind:1})
+ },
+
+ save_the_data:function (r,e,sessionKey,openid) {
+ var app=getApp(),a=app,th=this;
+ var dd = {
+ oauth: "miniapp",
+ nickname:a.clear_word(r.nickName),
+ head_pic: r.avatarUrl,
+ sex: r.gender,
+ terminal: "miniapp",
+ sessionKey: sessionKey,
+ openid:openid,
+ encryptedData: e.encryptedData,
+ iv: e.iv,
+ store_id: getApp().globalData.setting.stoid,
+ };
+ //--如果有邀请人的时候--
+ if(th.data.first_leader){
+ dd.first_leader=th.data.first_leader;
+ }
+
+ console.log(dd);
+ app.request.get("/api/weshop/users/thirdLogin", {
+ data: dd,
+ success: function (e) {
+
+ if (e.data.code == 0) {
+ app.globalData.user_id = e.data.data.user_id;
+ } else {
+ return app.showWarning("授权登入失败!"+e.data.msg);
+ }
+
+ wx.setStorageSync("userinfo",e.data.data);
+ wx.setStorageSync("isAuth", !0), app.globalData.userInfo = e.data.data, app.globalData.userInfo.head_pic = t.getFullUrl(a.globalData.userInfo.head_pic);
+ wx.navigateBack({ delta: 1})
+
+ },
+ failStatus: function (t) {
+ return app.my_warnning("授权登入失败,请稍后再试!", 0, that);
+ },
+ fail: function (t) {
+ return i.clearAuth(), i.alertLoginErrorAndGoHome(), !1;
+ }
+ });
+ },
- bindGetUserInfo: function(e) {
- var that = this, app = getApp();
- //此处授权得到userInfo
- console.log(e.detail.userInfo);
- app.globalData.getu = e.detail.userInfo;
+ bind_bnerr:function(e){
+ var _errImg = e.target.dataset.errorimg;
+ var _errObj = {};
+ _errObj[_errImg] = this.data.imghots+"/miniapp/images/logo.png";
+ this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ;
+ }
- //接下来写业务代码
- //最后,记得返回刚才的页面
- app.auth.wxLogin_fir(function(){
- console.log("togoin");
- console.log("1");
- wx.navigateBack({
- delta: 1
- })
- })
-
- },
-
- cancle_bind:function(){
- getApp().goto('/pages/user/index/index');
- }
-
-
-});
+})
diff --git a/pages/togoin/togoin.json b/pages/togoin/togoin.json
index 97e7bd6..23b89bc 100644
--- a/pages/togoin/togoin.json
+++ b/pages/togoin/togoin.json
@@ -1,3 +1,6 @@
{
- "navigationBarTitleText": "授权登录"
+ "navigationBarTitleText": "授权登录",
+ "usingComponents": {
+ "warn": "/components/long_warn/long_warn"
+ }
}
\ No newline at end of file
diff --git a/pages/togoin/togoin.wxml b/pages/togoin/togoin.wxml
index 467f327..0330745 100644
--- a/pages/togoin/togoin.wxml
+++ b/pages/togoin/togoin.wxml
@@ -1,9 +1,53 @@
-
-
-
- {{store.store_name}}
- 为了更好的提供服务,小程序将申请获取您的头像,昵称信息
-
- 暂不授权
+
+
+
+
+
+
+
+ {{store.store_name}}
+
-
\ No newline at end of file
+
+
+
+
+
+
+
+
+
+
+
+ 暂不登陆
+
+
+
+
+
+
+
+
+
+
+
+ 请授权绑定手机号完成注册,拒绝将登陆失败
+
+
+ 拒绝
+
+
+
+
+
+
diff --git a/pages/togoin/togoin.wxss b/pages/togoin/togoin.wxss
index 35d5957..9ee2fba 100644
--- a/pages/togoin/togoin.wxss
+++ b/pages/togoin/togoin.wxss
@@ -1,42 +1,64 @@
-.all_page{
- position: fixed;
- height: 100%;
- width: 100%;
- background: #fff;
- justify-content: center;/*水平居中*/
+page{
+ border-top: 3rpx solid #EAEAEC;
+ background-color: #fff;
}
-.all_page .content{
- font-size: 30rpx;
- text-align: center;
- height: 400px;
+.logins {
width: 100%;
- position: absolute;
- top: 50%;
- margin-top:-200px;
-}
-.logo{width: 140rpx; height: 140rpx; border-radius:50% }
-.all_page .content .title{
- font-size: 36rpx; margin: 20rpx 0
+ padding-bottom: 130rpx;
+ background-position: center;
+ background-repeat: no-repeat;
+ background-size: cover
}
-.all_page .btn{
- height: 80rpx;
- line-height: 80rpx;
- width: 580rpx;
- background: #fc661f;
- color:#fff;
- font-size: 32rpx;
- margin-top: 100rpx;
- border-radius: 5rpx;
+.login_img {
+ width: 192rpx;
+ height: 192rpx;
+ border-radius: 50%;
+ position: absolute;
+}
+.phones{
+ margin-bottom: 48rpx;
+}
+.getPhoneNumber {
+ width: 600rpx;
+ height: 94rpx;
+ line-height: 94rpx;
+ background-color: #57b837;
+ border-radius: 48rpx;
+ color: rgb(255,255,255);
+ font-size: 32rpx;
+ margin-top:150rpx;
+}
+.we_chat{
+ width: 55rpx;
+ height: 45rpx;
+ margin-right: 15rpx;
+}
+.userlongin{
+ color: #767f8e;
+}
+button{
+ border:none;
+}
+.login_img_back{ width: 100%;}
+.p_content{
+ margin: 10%;
+ width: 80%;
+ height:340rpx;
+ top:50%;
+ margin-top: -180rpx;
+ background-color: #fff;
+ z-index: 12;
+ position: fixed;
}
-.all_page .btn2{
- height: 80rpx;
- line-height: 80rpx;
- width: 580rpx;
-
- color:#999;
- font-size: 32rpx;
- border-radius: 5rpx;
- margin-top: 10rpx;
-}
\ No newline at end of file
+.btn_view { height: 120rpx; line-height: 120rpx; border-top:1rpx solid #e9e9e9;}
+.p_title{ height:220rpx; padding: 0 40rpx; line-height: 50rpx;}
+.g_mobile{ background: none;line-height: normal;}
+.b_right{border-right:1rpx solid #e9e9e9;}
+
+.ali-c{align-items: center;}
+.flex-center2{ justify-content: center;}
+.f2 {
+ flex: 2 0;
+}
diff --git a/pages/user/assistance/assistance.js b/pages/user/assistance/assistance.js
index 7257d3d..e5ecf67 100644
--- a/pages/user/assistance/assistance.js
+++ b/pages/user/assistance/assistance.js
@@ -49,7 +49,7 @@ Page({
//--先判断会员状态--
var user_info = getApp().globalData.userInfo;
if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
- getApp().goto('/pages/getphone/getphone');
+ getApp().goto('/pages/togoin/togoin');
return false;
}
diff --git a/pages/user/assistance/friend_assistance.js b/pages/user/assistance/friend_assistance.js
index ac4c0f7..6d9d51e 100644
--- a/pages/user/assistance/friend_assistance.js
+++ b/pages/user/assistance/friend_assistance.js
@@ -57,7 +57,7 @@ Page({
//--先判断会员状态--
var user_info = getApp().globalData.userInfo;
if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
- getApp().goto('/pages/getphone/getphone');
+ getApp().goto('/pages/togoin/togoin');
return false;
}
@@ -117,7 +117,7 @@ Page({
var user_info = getApp().globalData.userInfo;
if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
wx.navigateTo({
- url: '/pages/getphone/getphone',
+ url: '/pages/togoin/togoin',
})
return false;
}
diff --git a/pages/user/assistance/giftpacklist.js b/pages/user/assistance/giftpacklist.js
index a7c90ff..63ad10d 100644
--- a/pages/user/assistance/giftpacklist.js
+++ b/pages/user/assistance/giftpacklist.js
@@ -71,7 +71,7 @@ Page({
//--先判断会员状态--
var user_info = getApp().globalData.userInfo;
if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
- getApp().goto('/pages/getphone/getphone');
+ getApp().goto('/pages/togoin/togoin');
return false;
}
diff --git a/pages/user/assistance/task_assistance.js b/pages/user/assistance/task_assistance.js
index 408355e..3d5b31f 100644
--- a/pages/user/assistance/task_assistance.js
+++ b/pages/user/assistance/task_assistance.js
@@ -143,7 +143,7 @@ Page({
//--先判断会员状态--
var user_info = getApp().globalData.userInfo;
if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
- getApp().goto('/pages/getphone/getphone');
+ getApp().goto('/pages/togoin/togoin');
return false;
}
diff --git a/pages/user/cardinfo/cardinfo.js b/pages/user/cardinfo/cardinfo.js
index faa64b2..6c656af 100644
--- a/pages/user/cardinfo/cardinfo.js
+++ b/pages/user/cardinfo/cardinfo.js
@@ -53,7 +53,7 @@ Page({
//--先判断会员状态--
var user_info = getApp().globalData.userInfo;
if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
- wx.navigateTo({ url: '/pages/getphone/getphone' })
+ wx.navigateTo({ url: '/pages/togoin/togoin' })
return false;
}
diff --git a/pages/user/coupons/coupons.js b/pages/user/coupons/coupons.js
index 6f08bb1..6ec46ff 100644
--- a/pages/user/coupons/coupons.js
+++ b/pages/user/coupons/coupons.js
@@ -156,7 +156,7 @@ Page({
//--先判断会员状态--
var user_info = getApp().globalData.userInfo;
if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
- wx.navigateTo({ url: '/pages/getphone/getphone', })
+ wx.navigateTo({ url: '/pages/togoin/togoin', })
return false;
}
this.init(th.myyhj,th.s_guoqi);
diff --git a/pages/user/deposit/deposit.js b/pages/user/deposit/deposit.js
index a3a29a1..2b5099b 100644
--- a/pages/user/deposit/deposit.js
+++ b/pages/user/deposit/deposit.js
@@ -20,7 +20,7 @@ Page({
// --先判断会员状态--
var user_info = getApp().globalData.userInfo;
if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
- wx.navigateTo({ url: '/pages/getphone/getphone', })
+ wx.navigateTo({ url: '/pages/togoin/togoin', })
return false;
}
wx.setNavigationBarTitle({
diff --git a/pages/user/index/index.js b/pages/user/index/index.js
index f4f66d2..e26c997 100644
--- a/pages/user/index/index.js
+++ b/pages/user/index/index.js
@@ -41,6 +41,7 @@ Page({
actImg: "",
is_assistance: 0, //助力活动
ad_img:"",
+ add_card_data:'', //等级卡的内容
},
goto_nav: function(e) {
var th = this;
@@ -49,7 +50,7 @@ Page({
getApp().goto(url);
} else {
wx.navigateTo({
- url: '/pages/getphone/getphone',
+ url: '/pages/togoin/togoin',
})
}
},
@@ -70,14 +71,17 @@ Page({
th.setData({ad_img:item.ad_code})
}
})
+
+ app.getUserFir();
+
+
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function() {
-
-
+
if (typeof this.getTabBar === 'function' && this.getTabBar()) {
var index=getApp().getPageIndex(this);
this.getTabBar().setData({
@@ -100,11 +104,27 @@ Page({
if (getApp().globalData.user_id) getApp().requestCardNum(th);
},500)
/*------会员登录------*/
- app.getUserFir(async function(e) {
- if (e != undefined && e != null && e.mobile) {
+ var e=getApp().globalData.userInfo;
+
+ if (e != undefined && e != null && e.mobile) {
s.setData({
userInfo: e
});
+
+ //-- 要调用接口,获取卡的钱 --
+ var url="/api/weshop/wxuser/getWxCardInfo?storeId="+os.stoid+"&userId="+e.user_id;
+ rq.get(url,{
+ success: function(su) {
+ if(su.data.code==0){
+ s.setData({
+ add_card_data: su.data.data,
+ });
+ }
+ }
+ });
+
+
+
/*-----统计-----*/
rq.get("/api/weshop/order/waitlist", {
data: {
@@ -312,7 +332,6 @@ Page({
//th.requestRecommend();
}
- });
var goods_list = this.selectComponent("#goods_recommend"); //组件的id
goods_list.init();
@@ -416,7 +435,7 @@ Page({
//--跳到绑定页面--
gobindtel: function() {
wx.navigateTo({
- url: '/pages/getphone/getphone',
+ url: '/pages/togoin/togoin',
})
},
@@ -655,6 +674,37 @@ Page({
if(!url || url=='') return;
if(url[0]!='/') url='/'+url;
getApp().goto(url);
+ },
+
+ //添加卡包
+ addcard:function(){
+ var res=this.data.add_card_data;
+ var arr = new Array(6)
+ arr[0] = res.code;
+ arr[1] = res.timestamp;
+ arr[2] = res.jsapiTicket;
+ arr[3] = res.openid;
+ arr[4] = res.cardid;
+ arr[5] = res.nonceStr;
+ var c=arr.sort();
+ var newstr="";
+ for (var i=0;i
我的地址
+
+
+
+
+ 收入卡包
+
+
我的服务
diff --git a/pages/user/integral/integral.js b/pages/user/integral/integral.js
index 98611ca..43181bc 100644
--- a/pages/user/integral/integral.js
+++ b/pages/user/integral/integral.js
@@ -279,7 +279,7 @@ Page({
//--先判断会员状态--
var user_info = getApp().globalData.userInfo;
if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
- wx.navigateTo({ url: '/pages/getphone/getphone', })
+ wx.navigateTo({ url: '/pages/togoin/togoin', })
return false;
}
diff --git a/pages/user/member/bring/bring.js b/pages/user/member/bring/bring.js
index e0b7d16..cb84b63 100644
--- a/pages/user/member/bring/bring.js
+++ b/pages/user/member/bring/bring.js
@@ -365,7 +365,7 @@ Page({
var user_info = getApp().globalData.userInfo;
if (user_info == null || user_info.mobile == undefined || user_info.mobile == " " || user_info.mobile == null) {
wx.navigateTo({
- url: '/pages/getphone/getphone',
+ url: '/pages/togoin/togoin',
})
return false;
}
diff --git a/pages/user/member/menber.js b/pages/user/member/menber.js
index e272cee..457d9c2 100644
--- a/pages/user/member/menber.js
+++ b/pages/user/member/menber.js
@@ -23,7 +23,7 @@ Page({
//--先判断会员状态--
var user_info = getApp().globalData.userInfo;
if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
- wx.navigateTo({ url: '/pages/getphone/getphone', })
+ wx.navigateTo({ url: '/pages/togoin/togoin', })
return false;
}
this.init_fir();
diff --git a/pages/user/my_service/appment_main.js b/pages/user/my_service/appment_main.js
index 5bc4d53..a0c4050 100644
--- a/pages/user/my_service/appment_main.js
+++ b/pages/user/my_service/appment_main.js
@@ -528,7 +528,7 @@ Page({
validay: options.Validay
})
wx.getLocation({
- type: 'wgs84',
+ type: 'gcj02',
success: function(res) {
th.data.lat = res.latitude;
th.data.lon = res.longitude;
diff --git a/pages/user/order_detail/order_detail.js b/pages/user/order_detail/order_detail.js
index b19d5de..e8a4a6c 100644
--- a/pages/user/order_detail/order_detail.js
+++ b/pages/user/order_detail/order_detail.js
@@ -665,6 +665,436 @@ Page({
}
func(ob)
},
+
+
+ //再来一单的功能的实现
+ moreOrder:function(e){
+ var th=this;
+ var item=th.data.order;
+ th.check_more_order(item);
+ },
+
+ check_more_order:async function(item){
+ var pickup=null,th=this;
+ //--------获取门店-----------
+ await getApp().request.promiseGet("/api/weshop/pickup/get/" + os.stoid + "/" + item.pickup_id, {
+
+ }).then(res=>{
+ pickup = res.data.data;
+ })
+
+ //--------获取商品----------
+ var goods_list=item.order_goods;
+ //--- 返回的内容 ---
+ var back_goods_arr=[];
+ var err_text="";
+ for(var i in goods_list){
+ var g_item=goods_list[i];
+ //--如果是赠品,不加入购物车--
+ if(g_item['is_gift']) continue;
+ if(g_item['prom_type']==4 ){
+ $err_text+= g_item['goods_name']+"积分购商品不加入购物车\n";
+ continue;
+ }
+ if(g_item['prom_type']==5){
+ $err_text+= g_item['goods_name']+"搭配购商品不加入购物车\n";
+ continue;
+ }
+ if(g_item['prom_type']==6 ){
+ $err_text+= g_item['goods_name']+"拼团商品不加入购物车\n";
+ continue;
+ }
+
+ //--获取商品--
+ var good=null;
+ await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + g_item.goods_id, {
+
+ }).then(res=>{
+ good=res.data.data;
+ })
+
+ if(!good){
+ err_text+= g_item['goods_name']+"未找到商品\n";
+ continue;
+ }
+ if (good.is_on_sale != 1) {
+ err_text+= g_item['goods_name']+"已经下架\n";
+ continue;
+ }
+
+ var timestamp = ut.gettimestamp();
+ if (good.on_time > timestamp) {
+ err_text+= g_item['goods_name']+"还未上架\n";
+ continue;
+ }
+ if (good.down_time > 0) {
+ if (good.down_time < timestamp) {
+ err_text+=g_item['goods_name']+"已经下架\n";
+ continue;
+ }
+ }
+
+ //如果商品的配送方式和门店不匹配
+ if(good['distr_type']>0 && pick_up['distr_type']>0 && good['distr_type']!=pick_up['distr_type'] ){
+ err_text+= good['goods_name']+"配送方式不一致\n";
+ continue;
+ }
+
+ var prom=null;
+ var b_item={}
+ b_item.goods_id=g_item.goods_id;
+ b_item.goods_name=g_item.goods_name;
+ b_item.goods_num=g_item.goods_num;
+ b_item.guide_id=g_item.guide_id;
+ b_item.guide_type=g_item.guide_type;
+ b_item.pickup_id=item.pickup_id;
+ b_item.price=good.shop_price;
+ b_item.goods_sn=good.goods_sn;
+ b_item.sku=good.sku;
+
+ //--判断商品当前的活动情况--
+ switch(good.prom_type){
+ case 1:
+ var flash=null;
+ getApp().request.promiseGet("/api/ms/flash_sale/get/" + os.stoid + "/" + good.prom_id, {
+ }).then(res=>{
+ if (res.data.code== 0) {
+ flash=res.data.data;
+ }
+ })
+ //----已经结束-----
+ if (flash && flash.is_end == 0 && flash.end_time > timestamp && flash.start_time > timestamp ) {
+ prom=flash;
+ b_item.price=prom.price; //
+ }
+ break;
+ case 6:
+ b_item.is_pd_normal=1; break;
+ }
+
+
+
+ //判断是不是线下库存的购买, 是不是秒杀活动
+ if(th.data.sales_rules==2 && !prom){
+
+ //-- 看一下购物车上有多少商品 --
+ var cart_num=0;
+ await getApp().request.promiseGet("/api/weshop/cart/page", {
+ data: {
+ store_id: os.stoid,
+ user_id: getApp().globalData.user_id,
+ state:0, is_gift:0,
+ goods_id:good.goods_id,
+ pick_id: b_item.pickup_id
+ }
+ }).then(res=>{
+ var num = 0;
+ if(res.data.code==0 && res.data.data && res.data.data.pageData) {
+ for (var i = 0; i < res.data.data.pageData.length; i++) {
+ num += res.data.data.pageData[i].goods_num;
+ }
+ }
+ cart_num=num;
+ })
+
+ var lock=0,plist=null;
+ //先读取门店的lock,
+ await getApp().request.promiseGet("/api/weshop/order/ware/lock/page",{
+ data:{store_id:os.stoid,wareId:good.goods_id,storageId:b_item.pickup_id,pageSize:1000}
+ }).then(res=>{
+ if(res.data.code==0 && res.data.data.total>0){
+ for(var i in res.data.data.pageData)
+ lock+=res.data.data.pageData[i].outQty
+ }
+ })
+
+ //---通过接口获取门店的线下库存信息--
+ await getApp().request.promiseGet("/api/weshop/goods/getWareStorages",{
+ data:{storageNos:pickup.pickup_no,wareIds:encodeURIComponent(good.erpwareid),storeId:os.stoid}
+ }).then(res=>{
+ if(res.data.code==0 && res.data.data.total>0){
+ plist=res.data.data.pageData[0];
+ }
+ })
+
+ if(!plist){
+ err_text+= good['goods_name']+"库存不足\n";
+ continue;
+ }
+ if(plist.CanOutQty-lock<=0){
+ err_text+= good['goods_name']+"库存不足\n";
+ continue;
+ }
+ if(b_item.goods_num>(plist.CanOutQty-lock)){
+ b_item.goods_num=plist.CanOutQty-lock;
+ }
+ var req_data={
+ store_id: os.stoid,
+ user_id: getApp().globalData.user_id,
+ goods_id: good.goods_id,
+ };
+
+ var buynum=0;
+ //---要获得商品,该用户买了多少件,同步应用---
+ await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", {
+ data: req_data,
+ }).then(res => {
+ if(res.data.code==0){
+ var buy_num_data = res.data.data;
+ buynum = buy_num_data.goodsbuynum;
+ }
+ })
+
+ //---- 要计算商品的限购 -----
+ if(good['viplimited']>0){
+ if(cart_num+buynum>good['viplimited']){
+ err_text+= good['goods_name']+"超出限购\n";
+ continue;
+ }
+ good['viplimited']-=(cart_num+buynum);
+ if(b_item.goods_num>good['viplimited']){
+ b_item.goods_num=good['viplimited'];
+ }
+ }
+
+ back_goods_arr.push(b_item); //返回商品元素
+
+ }else{
+
+ //-- 看一下购物车上有多少商品 --
+ var cart_num=0;
+ await getApp().request.promiseGet("/api/weshop/cart/page", {
+ data: {
+ store_id: os.stoid,
+ user_id: getApp().globalData.user_id,
+ state:0, is_gift:0,
+ goods_id:good.goods_id
+ }
+ }).then(res=>{
+ var num = 0;
+ if(res.data.code==0 && res.data.data && res.data.data.pageData) {
+ for (var i = 0; i < res.data.data.pageData.length; i++) {
+ num += res.data.data.pageData[i].goods_num;
+ }
+ }
+ cart_num=num;
+ })
+
+
+ if(good.store_count<=0){
+ err_text+= good['goods_name']+"库存不足\n";
+ continue;
+ }
+ if(b_item.goods_num>good.store_count)
+ b_item.goods_num=good.store_count;
+
+ var buynum=0; //商品已经购买多少件
+ var promgoodsbuynum=0; //活动已经购买多少件
+ var redis_num = 0; //redis库存
+
+ var req_data={
+ store_id: os.stoid,
+ user_id: getApp().globalData.user_id,
+ goods_id: good.goods_id,
+ };
+
+ if(prom){
+ req_data.prom_type= good.prom_type;
+ req_data.prom_id= good.prom_id;
+
+ //------判断活动是否抢光-----
+ await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" +
+ os.stoid + "/" + good.prom_type + "/" + good.prom_id, {
+ 1: 1
+ }).then(res => {
+ redis_num = res.data.data;
+ });
+ if(redis_num<=0){
+ err_text+= good['goods_name']+"活动不足\n";
+ continue;
+ }
+
+ }
+
+ //---要获得商品,该用户买了多少件,同步应用---
+ await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", {
+ data: req_data,
+ }).then(res => {
+ if(res.data.code==0){
+ var buy_num_data = res.data.data;
+ if (buy_num_data.promgoodsbuynum) promgoodsbuynum = buy_num_data.promgoodsbuynum;
+ buynum = buy_num_data.goodsbuynum;
+ }
+ })
+
+ //---- 要计算商品的限购 -----
+ if(good['viplimited']>0){
+ if(cart_num+buynum>good['viplimited']){
+ err_text+= good['goods_name']+"超出限购\n";
+ continue;
+ }
+ good['viplimited']-=(cart_num+buynum);
+ if(b_item.goods_num>good['viplimited']){
+ b_item.goods_num=good['viplimited'];
+ }
+
+ }
+
+ //-- 判断活动的库存 --
+ if(prom){
+ if(prom['goods_num']<=prom['buy_num']){
+ err_text+= good['goods_name']+"超出活动库存\n";continue;
+ }
+
+ if(b_item.goods_num>prom['goods_num']-prom['buy_num']){
+ b_item['goods_num']= b_item['goods_num']-b_item['buy_num'];
+ }
+
+ if(b_item.goods_num>redis_num){
+ b_item.goods_num=redis_num;
+ }
+
+ if(cart_num+buynum>prom['buy_limit']){
+ err_text+= good['goods_name']+"超出活动限购\n";continue;
+ }
+ prom['buy_limit'] -= (cart_num+buynum);
+ if(b_item.goods_num>prom['buy_limit']){
+ b_item.goods_num=prom['buy_limit'];
+ }
+
+ }
+ back_goods_arr.push(b_item); //返回商品元素
+ }
+ }
+
+ //有重新购买的数据是时候,就要重新生成订单
+ if(back_goods_arr.length>0){
+ th.setData({back_goods_arr:back_goods_arr});
+ if(!err_text){
+ th.more_add_cart();
+ }else{
+ // 如果没有获取用户信息
+ wx.showModal({
+ title:'确定',
+ content: err_text+',确定要买其他商品码?',
+ success(res) {
+ if (res.confirm) {
+ //跳转到登录页
+ th.more_add_cart();
+ }
+ }
+ });
+
+ }
+ }else{
+ getApp().confirmBox(err_text);
+ }
+ },
+
+ more_add_cart:async function(){
+ var back_goods_arr=this.data.back_goods_arr;
+ var err_text="";
+ var ok_num=0;
+
+ for(var i in back_goods_arr){
+ //商品ID
+ var g_item=back_goods_arr[i];
+ var newd = {
+ goods_id: g_item.goods_id,
+ goods_num: g_item.goods_num,
+ pick_id: g_item.pickup_id,
+ user_id: oo.user_id,
+ store_id: os.stoid,
+ goods_price: g_item.price,
+ member_goods_price: g_item.price,
+ goods_name: g_item.goods_name,
+ goods_sn: g_item.goods_sn,
+ sku: g_item.sku,
+ };
+
+ if(g_item.guide_id){
+ newd['guide_id']=g_item.guide_id;
+ newd['guide_type']=g_item.guide_type;
+ }
+
+ var b_cart_goods=null;
+ await getApp().request.promiseGet("/api/weshop/cart/page", {
+ data: {
+ store_id: os.stoid,
+ user_id: oo.user_id,
+ goods_id: g_item.goods_id,
+ pick_id: g_item.pickup_id,
+ },
+ }).then(res=>{
+ //-------如果购物车中有相关的数据-------
+ if (res.data.data.total > 0) {
+ b_cart_goods= res.data.data.pageData[0];
+ }
+ })
+
+ //-- 如果就加入过购物车 --
+ if(b_cart_goods){
+ var updata = {
+ id: b_cart_goods.id,
+ goods_num: newd.goods_num + b_cart_goods.goods_num,
+ goods_price: newd.goods_price,
+ member_goods_price:newd.goods_price,
+ store_id: os.stoid,
+ };
+ if(newd.guide_id){
+ updata.guide_id=newd.guide_id;
+ updata.guide_type=newd.guide_type;
+ }
+ await getApp().request.promisePut("/api/weshop/cart/update", {
+ data: updata
+ }).then(res=>{
+ if(res.data.code==0) {
+ ok_num++;
+ }else{
+ err_text+=newd.goods_name+"加入购物车失败\n";
+ }
+ })
+
+ }else{
+ await getApp().request.promisePost("/api/weshop/cart/save", {
+ data: newd
+ }).then(res=>{
+ if(res.data.code==0) {
+ ok_num++;
+ }else{
+ err_text+=newd.goods_name+"加入购物车失败\n";
+ }
+ })
+ }
+ }
+
+ if(ok_num==0){
+ //-- 如果没有获取用户信息 --
+ wx.showModal({
+ title:'提示',
+ content: err_text,
+ success(res) {}
+ });
+ }else{
+ if(err_text==""){
+ getApp().goto("/pages/cart/cart/cart");
+ }else{
+ // 如果没有获取用户信息
+ wx.showModal({
+ title:'提示',
+ content: err_text,
+ success(res) {
+ if (res.confirm) {
+ //跳转到登录页
+ getApp().goto("/pages/cart/cart/cart");
+ }
+ }
+ });
+
+ }
+
+ }
+ }
diff --git a/pages/user/order_detail/order_detail.wxml b/pages/user/order_detail/order_detail.wxml
index 2f03c70..1e3b3a7 100644
--- a/pages/user/order_detail/order_detail.wxml
+++ b/pages/user/order_detail/order_detail.wxml
@@ -160,10 +160,15 @@
退款详情
+
+
+
+ 再来一单
+
评价{{order.order_goods.length}}
+ url="/pages/user/comment/comment?status=0&order_id={{order.order_id}}">评价
去评价
diff --git a/pages/user/order_list/order_list.js b/pages/user/order_list/order_list.js
index 423a36d..7b18ff7 100644
--- a/pages/user/order_list/order_list.js
+++ b/pages/user/order_list/order_list.js
@@ -41,9 +41,12 @@ Page({
is_get: 0,
conf: null,
iscodeall: null,
+ sales_rules:1, //默认是显示线上库存
//会员的等级价位
card_field:null,
+
+ back_goods_arr:null, //返回商品的列表
},
onLoad: function(t) {
var th = this;
@@ -53,7 +56,7 @@ Page({
s.init(this, "", "orderList");
//---查看会员的等级价---
getApp().getConfig2(function(e) {
- th.setData({conf: e });
+ th.setData({conf: e,sales_rules:e.sales_rules });
//--- 看后台是不是有开通等级卡 ---
if(e.switch_list){
var s_list=JSON.parse(e.switch_list);
@@ -746,5 +749,439 @@ Page({
content: "请将二维码展示给核销员,收货更快捷"
};
qc_com.open(obj)
+ },
+
+ //再来一单的功能的实现
+ moreOrder:function(e){
+ var th=this;
+ var index=e.currentTarget.dataset.index;
+ var item=th.data.orderList[index];
+ th.check_more_order(item);
+ },
+
+ check_more_order:async function(item){
+ var pickup=null,th=this;
+ //--------获取门店-----------
+ await getApp().request.promiseGet("/api/weshop/pickup/get/" + os.stoid + "/" + item.pickup_id, {
+
+ }).then(res=>{
+ pickup = res.data.data;
+ })
+
+ //--------获取商品----------
+ var goods_list=item.order_goods;
+ //--- 返回的内容 ---
+ var back_goods_arr=[];
+ var err_text="";
+ for(var i in goods_list){
+ var g_item=goods_list[i];
+ //--如果是赠品,不加入购物车--
+ if(g_item['is_gift']) continue;
+ if(g_item['prom_type']==4 ){
+ $err_text+= g_item['goods_name']+"积分购商品不加入购物车\n";
+ continue;
+ }
+ if(g_item['prom_type']==5){
+ $err_text+= g_item['goods_name']+"搭配购商品不加入购物车\n";
+ continue;
+ }
+ if(g_item['prom_type']==6 ){
+ $err_text+= g_item['goods_name']+"拼团商品不加入购物车\n";
+ continue;
+ }
+
+ //--获取商品--
+ var good=null;
+ await getApp().request.promiseGet("/api/weshop/goods/get/" + os.stoid + "/" + g_item.goods_id, {
+
+ }).then(res=>{
+ good=res.data.data;
+ })
+
+ if(!good){
+ err_text+= g_item['goods_name']+"未找到商品\n";
+ continue;
+ }
+ if (good.is_on_sale != 1) {
+ err_text+= g_item['goods_name']+"已经下架\n";
+ continue;
+ }
+
+ var timestamp = ut.gettimestamp();
+ if (good.on_time > timestamp) {
+ err_text+= g_item['goods_name']+"还未上架\n";
+ continue;
+ }
+ if (good.down_time > 0) {
+ if (good.down_time < timestamp) {
+ err_text+=g_item['goods_name']+"已经下架\n";
+ continue;
+ }
+ }
+
+ //如果商品的配送方式和门店不匹配
+ if(good['distr_type']>0 && pick_up['distr_type']>0 && good['distr_type']!=pick_up['distr_type'] ){
+ err_text+= good['goods_name']+"配送方式不一致\n";
+ continue;
+ }
+
+ var prom=null;
+ var b_item={}
+ b_item.goods_id=g_item.goods_id;
+ b_item.goods_name=g_item.goods_name;
+ b_item.goods_num=g_item.goods_num;
+ b_item.guide_id=g_item.guide_id;
+ b_item.guide_type=g_item.guide_type;
+ b_item.pickup_id=item.pickup_id;
+ b_item.price=good.shop_price;
+ b_item.goods_sn=good.goods_sn;
+ b_item.sku=good.sku;
+
+ //--判断商品当前的活动情况--
+ switch(good.prom_type){
+ case 1:
+ var flash=null;
+ getApp().request.promiseGet("/api/ms/flash_sale/get/" + os.stoid + "/" + good.prom_id, {
+ }).then(res=>{
+ if (res.data.code== 0) {
+ flash=res.data.data;
+ }
+ })
+ //----已经结束-----
+ if (flash && flash.is_end == 0 && flash.end_time > timestamp && flash.start_time > timestamp ) {
+ prom=flash;
+ b_item.price=prom.price; //
+ }
+ break;
+ case 6:
+ b_item.is_pd_normal=1; break;
+ }
+
+
+
+ //判断是不是线下库存的购买, 是不是秒杀活动
+ if(th.data.sales_rules==2 && !prom){
+
+ //-- 看一下购物车上有多少商品 --
+ var cart_num=0;
+ await getApp().request.promiseGet("/api/weshop/cart/page", {
+ data: {
+ store_id: os.stoid,
+ user_id: getApp().globalData.user_id,
+ state:0, is_gift:0,
+ goods_id:good.goods_id,
+ pick_id: b_item.pickup_id
+ }
+ }).then(res=>{
+ var num = 0;
+ if(res.data.code==0 && res.data.data && res.data.data.pageData) {
+ for (var i = 0; i < res.data.data.pageData.length; i++) {
+ num += res.data.data.pageData[i].goods_num;
+ }
+ }
+ cart_num=num;
+ })
+
+ var lock=0,plist=null;
+ //先读取门店的lock,
+ await getApp().request.promiseGet("/api/weshop/order/ware/lock/page",{
+ data:{store_id:os.stoid,wareId:good.goods_id,storageId:b_item.pickup_id,pageSize:1000}
+ }).then(res=>{
+ if(res.data.code==0 && res.data.data.total>0){
+ for(var i in res.data.data.pageData)
+ lock+=res.data.data.pageData[i].outQty
+ }
+ })
+
+ //---通过接口获取门店的线下库存信息--
+ await getApp().request.promiseGet("/api/weshop/goods/getWareStorages",{
+ data:{storageNos:pickup.pickup_no,wareIds:encodeURIComponent(good.erpwareid),storeId:os.stoid}
+ }).then(res=>{
+ if(res.data.code==0 && res.data.data.total>0){
+ plist=res.data.data.pageData[0];
+ }
+ })
+
+ if(!plist){
+ err_text+= good['goods_name']+"库存不足\n";
+ continue;
+ }
+ if(plist.CanOutQty-lock<=0){
+ err_text+= good['goods_name']+"库存不足\n";
+ continue;
+ }
+ if(b_item.goods_num>(plist.CanOutQty-lock)){
+ b_item.goods_num=plist.CanOutQty-lock;
+ }
+ var req_data={
+ store_id: os.stoid,
+ user_id: getApp().globalData.user_id,
+ goods_id: good.goods_id,
+ };
+
+ var buynum=0;
+ //---要获得商品,该用户买了多少件,同步应用---
+ await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", {
+ data: req_data,
+ }).then(res => {
+ if(res.data.code==0){
+ var buy_num_data = res.data.data;
+ buynum = buy_num_data.goodsbuynum;
+ }
+ })
+
+ //---- 要计算商品的限购 -----
+ if(good['viplimited']>0){
+ if(cart_num+buynum>good['viplimited']){
+ err_text+= good['goods_name']+"超出限购\n";
+ continue;
+ }
+ good['viplimited']-=(cart_num+buynum);
+ if(b_item.goods_num>good['viplimited']){
+ b_item.goods_num=good['viplimited'];
+ }
+ }
+
+ back_goods_arr.push(b_item); //返回商品元素
+
+ }else{
+
+ //-- 看一下购物车上有多少商品 --
+ var cart_num=0;
+ await getApp().request.promiseGet("/api/weshop/cart/page", {
+ data: {
+ store_id: os.stoid,
+ user_id: getApp().globalData.user_id,
+ state:0, is_gift:0,
+ goods_id:good.goods_id
+ }
+ }).then(res=>{
+ var num = 0;
+ if(res.data.code==0 && res.data.data && res.data.data.pageData) {
+ for (var i = 0; i < res.data.data.pageData.length; i++) {
+ num += res.data.data.pageData[i].goods_num;
+ }
+ }
+ cart_num=num;
+ })
+
+
+ if(good.store_count<=0){
+ err_text+= good['goods_name']+"库存不足\n";
+ continue;
+ }
+ if(b_item.goods_num>good.store_count)
+ b_item.goods_num=good.store_count;
+
+ var buynum=0; //商品已经购买多少件
+ var promgoodsbuynum=0; //活动已经购买多少件
+ var redis_num = 0; //redis库存
+
+ var req_data={
+ store_id: os.stoid,
+ user_id: getApp().globalData.user_id,
+ goods_id: good.goods_id,
+ };
+
+ if(prom){
+ req_data.prom_type= good.prom_type;
+ req_data.prom_id= good.prom_id;
+
+ //------判断活动是否抢光-----
+ await getApp().request.promiseGet("/api/weshop/activitylist/getActLen/" +
+ os.stoid + "/" + good.prom_type + "/" + good.prom_id, {
+ 1: 1
+ }).then(res => {
+ redis_num = res.data.data;
+ });
+ if(redis_num<=0){
+ err_text+= good['goods_name']+"活动不足\n";
+ continue;
+ }
+
+ }
+
+ //---要获得商品,该用户买了多少件,同步应用---
+ await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", {
+ data: req_data,
+ }).then(res => {
+ if(res.data.code==0){
+ var buy_num_data = res.data.data;
+ if (buy_num_data.promgoodsbuynum) promgoodsbuynum = buy_num_data.promgoodsbuynum;
+ buynum = buy_num_data.goodsbuynum;
+ }
+ })
+
+ //---- 要计算商品的限购 -----
+ if(good['viplimited']>0){
+ if(cart_num+buynum>good['viplimited']){
+ err_text+= good['goods_name']+"超出限购\n";
+ continue;
+ }
+ good['viplimited']-=(cart_num+buynum);
+ if(b_item.goods_num>good['viplimited']){
+ b_item.goods_num=good['viplimited'];
+ }
+
+ }
+
+ //-- 判断活动的库存 --
+ if(prom){
+ if(prom['goods_num']<=prom['buy_num']){
+ err_text+= good['goods_name']+"超出活动库存\n";continue;
+ }
+
+ if(b_item.goods_num>prom['goods_num']-prom['buy_num']){
+ b_item['goods_num']= b_item['goods_num']-b_item['buy_num'];
+ }
+
+ if(b_item.goods_num>redis_num){
+ b_item.goods_num=redis_num;
+ }
+
+ if(cart_num+buynum>prom['buy_limit']){
+ err_text+= good['goods_name']+"超出活动限购\n";continue;
+ }
+ prom['buy_limit'] -= (cart_num+buynum);
+ if(b_item.goods_num>prom['buy_limit']){
+ b_item.goods_num=prom['buy_limit'];
+ }
+
+ }
+ back_goods_arr.push(b_item); //返回商品元素
+ }
+ }
+
+ //有重新购买的数据是时候,就要重新生成订单
+ if(back_goods_arr.length>0){
+ th.setData({back_goods_arr:back_goods_arr});
+ if(!err_text){
+ th.more_add_cart();
+ }else{
+ // 如果没有获取用户信息
+ wx.showModal({
+ title:'确定',
+ content: err_text+',确定要买其他商品码?',
+ success(res) {
+ if (res.confirm) {
+ //跳转到登录页
+ th.more_add_cart();
+ }
+ }
+ });
+
+ }
+ }else{
+ getApp().confirmBox(err_text);
+ }
+ },
+
+ more_add_cart:async function(){
+ var back_goods_arr=this.data.back_goods_arr;
+ var err_text="";
+ var ok_num=0;
+
+ for(var i in back_goods_arr){
+ //商品ID
+ var g_item=back_goods_arr[i];
+ var newd = {
+ goods_id: g_item.goods_id,
+ goods_num: g_item.goods_num,
+ pick_id: g_item.pickup_id,
+ user_id: oo.user_id,
+ store_id: os.stoid,
+ goods_price: g_item.price,
+ member_goods_price: g_item.price,
+ goods_name: g_item.goods_name,
+ goods_sn: g_item.goods_sn,
+ sku: g_item.sku,
+ };
+
+ if(g_item.guide_id){
+ newd['guide_id']=g_item.guide_id;
+ newd['guide_type']=g_item.guide_type;
+ }
+
+ var b_cart_goods=null;
+ await getApp().request.promiseGet("/api/weshop/cart/page", {
+ data: {
+ store_id: os.stoid,
+ user_id: oo.user_id,
+ goods_id: g_item.goods_id,
+ pick_id: g_item.pickup_id,
+ },
+ }).then(res=>{
+ //-------如果购物车中有相关的数据-------
+ if (res.data.data.total > 0) {
+ b_cart_goods= res.data.data.pageData[0];
+ }
+ })
+
+ //-- 如果就加入过购物车 --
+ if(b_cart_goods){
+ var updata = {
+ id: b_cart_goods.id,
+ goods_num: newd.goods_num + b_cart_goods.goods_num,
+ goods_price: newd.goods_price,
+ member_goods_price:newd.goods_price,
+ store_id: os.stoid,
+ };
+ if(newd.guide_id){
+ updata.guide_id=newd.guide_id;
+ updata.guide_type=newd.guide_type;
+ }
+ await getApp().request.promisePut("/api/weshop/cart/update", {
+ data: updata
+ }).then(res=>{
+ if(res.data.code==0) {
+ ok_num++;
+ }else{
+ err_text+=newd.goods_name+"加入购物车失败\n";
+ }
+ })
+
+ }else{
+ await getApp().request.promisePost("/api/weshop/cart/save", {
+ data: newd
+ }).then(res=>{
+ if(res.data.code==0) {
+ ok_num++;
+ }else{
+ err_text+=newd.goods_name+"加入购物车失败\n";
+ }
+ })
+ }
+ }
+
+ if(ok_num==0){
+ //-- 如果没有获取用户信息 --
+ wx.showModal({
+ title:'提示',
+ content: err_text,
+ success(res) {}
+ });
+ }else{
+ if(err_text==""){
+ getApp().goto("/pages/cart/cart/cart");
+ }else{
+ // 如果没有获取用户信息
+ wx.showModal({
+ title:'提示',
+ content: err_text,
+ success(res) {
+ if (res.confirm) {
+ //跳转到登录页
+ getApp().goto("/pages/cart/cart/cart");
+ }
+ }
+ });
+
+ }
+
+ }
}
+
+
+
+
});
\ No newline at end of file
diff --git a/pages/user/order_list/order_list.wxml b/pages/user/order_list/order_list.wxml
index d540fc9..5422500 100644
--- a/pages/user/order_list/order_list.wxml
+++ b/pages/user/order_list/order_list.wxml
@@ -155,7 +155,12 @@
-
+
+
+
+
+
评价
diff --git a/pages/user/plus/plus.js b/pages/user/plus/plus.js
index d14dfd5..d9b9457 100644
--- a/pages/user/plus/plus.js
+++ b/pages/user/plus/plus.js
@@ -62,7 +62,7 @@ Page({
//--先判断会员状态--
var user_info = getApp().globalData.userInfo;
if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
- wx.navigateTo({ url: '/pages/getphone/getphone?first_leader=' + fir_leader, })
+ wx.navigateTo({ url: '/pages/togoin/togoin?first_leader=' + fir_leader, })
return false;
}
//-----------商家配置信息----- 等级卡规则,是否又开邀请码,营业员------------
@@ -319,8 +319,17 @@ Page({
//--支付成功,跳转到等级卡续费页面--
success:function () {
- var u_url = "/pages/user/cardinfo/cardinfo";
- wx.reLaunch({url: u_url})
+
+ if(getApp().globalData.plus_buy_back){
+ getApp().globalData.plus_buy_back=0;
+ getApp().globalData.is_card_back=1;
+ //返回购物车购买
+ wx.navigateBack();
+ }else{
+ var u_url = "/pages/user/cardinfo/cardinfo";
+ wx.reLaunch({url: u_url})
+ }
+
},
//--绑定邀请码的输入--
@@ -370,7 +379,7 @@ Page({
//--先判断会员状态--
var user_info = getApp().globalData.userInfo;
if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) {
- wx.navigateTo({ url: '/pages/getphone/getphone?first_leader=' + fir_leader, })
+ wx.navigateTo({ url: '/pages/togoin/togoin?first_leader=' + fir_leader, })
return false;
}
}
diff --git a/pages/user/userinfo/userinfo.js b/pages/user/userinfo/userinfo.js
index 02bcf48..808626f 100644
--- a/pages/user/userinfo/userinfo.js
+++ b/pages/user/userinfo/userinfo.js
@@ -248,7 +248,7 @@ Page({
wait_for_store_config: function() {
var th = this;
wx.getLocation({
- type: 'wgs84',
+ type: 'gcj02',
success: function(res) {
th.data.lat = res.latitude;
th.data.lon = res.longitude;
diff --git a/utils/auth.js b/utils/auth.js
index 6c032a3..aa5788a 100644
--- a/utils/auth.js
+++ b/utils/auth.js
@@ -207,47 +207,10 @@ module.exports = {
//获取本地存储
var a = wx.getStorageSync("wx_user_info");
var userInfo = a.userInfo;
- if (userInfo==undefined){ //判断本地是数据是否正确
- wx.getUserInfo({
- success: function (res)
- {
- console.log('doGetWxUser');
- console.log(res);
- console.log(ind);
- //组装用户
- var ar = {'nickName':res.userInfo.nickName,
- 'avatarUrl':res.userInfo.avatarUrl,
- 'gender': res.userInfo.gender};
- //----会员记录到全局------
- n.globalData.getu = ar;
- var uu = {'userInfo': ar};
- a=uu;
-
- if(ind==1){
- a && void 0 != a ? (n.globalData.wechatUser = a, o.login_fir(t, a, e)) : o.goGetUserInfo();
- }else{
- a && void 0 != a ? (n.globalData.wechatUser = a, o.login(t, a, e)) : o.goGetUserInfo();
- }
-
- },
-
- fail: function () {
- //---获取用户信息失败后。请跳转授权页面--
- wx.showModal({
- title: '警告',
- content: '尚未进行授权,请点击确定跳转到授权页面进行授权。',
- success: function (res) {
- if (res.confirm) {
- console.log('用户点击确定')
- wx.navigateTo({
- url: '/pages/togoin/togoin',
- })
- }
- }
- })
- }
-
- })
+ if (userInfo==undefined){
+ //判断本地是数据是否正确
+ n.goto("/pages/togoin/togoin");
+
}else{
a && void 0 != a ? (n.globalData.wechatUser = a, o.login(t, a, e)) : o.goGetUserInfo();
}
diff --git a/utils/request.js b/utils/request.js
index c4b0bae..dc038a3 100644
--- a/utils/request.js
+++ b/utils/request.js
@@ -232,6 +232,27 @@ module.exports = {
})
})
},
+
+
+ //---promise的使用delete----
+ promisePut:function(url,data){
+ var th=this;
+ if(url.indexOf("http")==-1) url=getApp().globalData.setting.url +url;
+ return new Promise((resolve, reject) => {
+ data.isShowLoading && th.showLoading();
+ wx.request({
+ url,
+ method: 'PUT',
+ header: {"content-type": "application/x-www-form-urlencoded" },
+ data:data.data,
+ success(res) {
+ data.isShowLoading && th.hideLoading();
+ resolve(res);
+ },
+ fail(err) { data.isShowLoading && th.hideLoading(); reject(err); }
+ })
+ })
+ },
//--------具有时间限制的读取接口----------
time_limit_get(time,url,data){
diff --git a/utils/util.js b/utils/util.js
index 4f8b9f6..257c031 100644
--- a/utils/util.js
+++ b/utils/util.js
@@ -410,6 +410,60 @@ function ob_to_parm(ob){
return parm;
}
+function encodeUTF8(s) {
+ var i, r = [], c, x;
+ for (i = 0; i < s.length; i++)
+ if ((c = s.charCodeAt(i)) < 0x80) r.push(c);
+ else if (c < 0x800) r.push(0xC0 + (c >> 6 & 0x1F), 0x80 + (c & 0x3F));
+ else {
+ if ((x = c ^ 0xD800) >> 10 == 0) //对四字节UTF-16转换为Unicode
+ c = (x << 10) + (s.charCodeAt(++i) ^ 0xDC00) + 0x10000,
+ r.push(0xF0 + (c >> 18 & 0x7), 0x80 + (c >> 12 & 0x3F));
+ else r.push(0xE0 + (c >> 12 & 0xF));
+ r.push(0x80 + (c >> 6 & 0x3F), 0x80 + (c & 0x3F));
+ };
+ return r;
+};
+// 字符串加密成 hex 字符串
+function sha1(s) {
+ var data = new Uint8Array(encodeUTF8(s))
+ var i, j, t;
+ var l = ((data.length + 8) >>> 6 << 4) + 16, s = new Uint8Array(l << 2);
+ s.set(new Uint8Array(data.buffer)), s = new Uint32Array(s.buffer);
+ for (t = new DataView(s.buffer), i = 0; i < l; i++)s[i] = t.getUint32(i << 2);
+ s[data.length >> 2] |= 0x80 << (24 - (data.length & 3) * 8);
+ s[l - 1] = data.length << 3;
+ var w = [], f = [
+ function () { return m[1] & m[2] | ~m[1] & m[3]; },
+ function () { return m[1] ^ m[2] ^ m[3]; },
+ function () { return m[1] & m[2] | m[1] & m[3] | m[2] & m[3]; },
+ function () { return m[1] ^ m[2] ^ m[3]; }
+ ], rol = function (n, c) { return n << c | n >>> (32 - c); },
+ k = [1518500249, 1859775393, -1894007588, -899497514],
+ m = [1732584193, -271733879, null, null, -1009589776];
+ m[2] = ~m[0], m[3] = ~m[1];
+ for (i = 0; i < s.length; i += 16) {
+ var o = m.slice(0);
+ for (j = 0; j < 80; j++)
+ w[j] = j < 16 ? s[i + j] : rol(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1),
+ t = rol(m[0], 5) + f[j / 20 | 0]() + m[4] + w[j] + k[j / 20 | 0] | 0,
+ m[1] = rol(m[1], 30), m.pop(), m.unshift(t);
+ for (j = 0; j < 5; j++)m[j] = m[j] + o[j] | 0;
+ };
+ t = new DataView(new Uint32Array(m).buffer);
+ for (var i = 0; i < 5; i++)m[i] = t.getUint32(i << 2);
+
+ var hex = Array.prototype.map.call(new Uint8Array(new Uint32Array(m).buffer), function (e) {
+ return (e < 16 ? "0" : "") + e.toString(16);
+ }).join("");
+
+ return hex;
+};
+
+
+
+
+
module.exports = {
formatTime: function(e, r) {
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 = {
mergeArray:mergeArray, //数组合并
isContained:isContained, //是否包含
base64_encode:base64_encode, //64位加密
- ob_to_parm:ob_to_parm //对象变成参数
+ ob_to_parm:ob_to_parm ,//对象变成参数
+ sha1:sha1, //sha1进行签名
};
--
libgit2 0.21.4