diff --git a/app.js b/app.js index 74e3774..459ae59 100644 --- a/app.js +++ b/app.js @@ -9,8 +9,8 @@ App({ setting: t, wechatUser: null, userInfo: null, - config: null, - config2: null, + config: null, //门店参数 + config2: null, //门店配置 code: null, heigth:0, user_id: null,// 4379287,// null,// 5682068, @@ -48,7 +48,6 @@ App({ app.globalData.user_id= app.globalData.userInfo.user_id; } } - }, //---初始化第三方---- @@ -59,6 +58,8 @@ App({ var t = wx.getExtConfigSync(), o = this.globalData.setting; console.log(t); t.appName ? (o.appName = t.appName, o.stoid = t.stoid) : tt=1; + + }, //首页的第一次登录 @@ -110,7 +111,7 @@ App({ success: function (o) { console.log('getConfig2'); if (o.data.code == 0) { - e.globalData.config = o.data.data, "function" == typeof t && t(e.globalData.config); + e.globalData.config2 = o.data.data, "function" == typeof t && t(e.globalData.config2); } } }); @@ -325,6 +326,27 @@ App({ }else{ func(this.globalData.pk_store); } - } + }, + + //-------获取购物车数量---------- + requestCardNum: function() { + var th = this; + th.request.get("/api/weshop/cart/page", { + data: { + store_id: th.globalData.setting.stoid, + user_id: th.globalData.user_id, + }, + success: function(e) { + var num = 0; + for (var i = 0; i < e.data.data.pageData.length; i++) { + num += e.data.data.pageData[i].goods_num; + } + wx.setTabBarBadge({ //tabbar右上角添加文本 + index: 2, ////tabbar下标 + text: '' + num //显示的内容 + }); + } + }); + }, }); diff --git a/app.json b/app.json index 34e5b0b..58e6904 100644 --- a/app.json +++ b/app.json @@ -68,7 +68,8 @@ "pages/user/user_spsy/user_spsy", "pages/user/user_fw/user_fw", "pages/user/user_coupon/user_coupon", - "pages/user/grow_value/grow_value" + "pages/user/grow_value/grow_value", + "pages/payment/pay_success/pay_success" ], "permission": { diff --git a/app.wxss b/app.wxss index bdd56a3..39d9668 100644 --- a/app.wxss +++ b/app.wxss @@ -220,7 +220,7 @@ justify-content:space-around; border-right: 2rpx solid ; transform: rotate(45deg); display:inline-block; - width:18rpx;height:18rpx;border-color:#da0b31;margin-top:6rpx; + width:18rpx;height:18rpx;border-color:#da0b31; } /*********************** 7.15 */ @@ -372,8 +372,9 @@ background: #ffe3e2; .fs40 { font-size: 40rpx; } - .ai_end{ align-items: flex-end; } - +.flex-wrap{ + flex-wrap:wrap; +} \ No newline at end of file diff --git a/components/qr_code/qr_code.js b/components/qr_code/qr_code.js index fbdf7c9..c46b356 100644 --- a/components/qr_code/qr_code.js +++ b/components/qr_code/qr_code.js @@ -37,7 +37,9 @@ Component({ barcode('barcode'+this.data.index,val, 620, 160,this); qrcode('qrcode'+this.data.index, val, 520, 520,this); } - } + }, + + }) \ No newline at end of file diff --git a/components/qr_code/qr_code.wxml b/components/qr_code/qr_code.wxml index 7db5902..216521c 100644 --- a/components/qr_code/qr_code.wxml +++ b/components/qr_code/qr_code.wxml @@ -1,14 +1,17 @@ + - + + + - + {{object.val}} - + {{object.content}} 有效时间:{{object.now}} 至 {{object.validay}} @@ -18,7 +21,9 @@ + + \ No newline at end of file diff --git a/components/qr_code/qr_code.wxss b/components/qr_code/qr_code.wxss index 8ff3862..e58dcd3 100644 --- a/components/qr_code/qr_code.wxss +++ b/components/qr_code/qr_code.wxss @@ -6,7 +6,11 @@ display:flex; justify-content:center; align-items:center; + } +/* page{ + overflow-y: hidden; +} */ .xc-obscuration{ position: fixed; @@ -33,28 +37,36 @@ align-items:center; height: auto; padding-bottom:20rpx; left:35rpx; + overflow: hidden; + + } /* 二维码和条形码的边框 */ .barqrcode{ width: 100%; - height: auto; + height: 100%; margin-top:30rpx; +position: relative; +top: 0rpx; +left: 0rpx; } /* 点击条形 */ .barcode { height:150rpx; width: 620rpx; - padding-left:30rpx; + text-align:center; + position:absolute; + left: 30rpx } canvas{ width:100%; height:55px; display:block; -position:relative; + } .q_code{ font-size:28rpx; @@ -66,10 +78,13 @@ letter-spacing:6rpx; /* 二维码边框*/ .qrcode_rim { width: 550rpx; - height:580rpx; + height:520rpx; display:flex; flex-direction:column; -margin-left:74rpx; + +position: absolute; +left: 74rpx; +top: 130rpx; } @@ -82,7 +97,8 @@ margin-left:74rpx; } .r-code{ font-size:28rpx; - text-align: center + padding-left: 25rpx; + } .shut{ diff --git a/pages/cart/cart/cart.js b/pages/cart/cart/cart.js index 9b8e343..db77217 100644 --- a/pages/cart/cart/cart.js +++ b/pages/cart/cart/cart.js @@ -1,86 +1,133 @@ -var t = getApp(), a = t.request, oo = t.globalData.setting, app = getApp(), rq = t.request; +var t = getApp(), + a = t.request, + oo = t.globalData.setting, + app = getApp(), + rq = t.request; var regeneratorRuntime = require('../../../utils/runtime.js'); Page({ - data: { - url: t.globalData.setting.url, - resourceUrl: t.globalData.setting.resourceUrl, - requestData: null, - checkAllToggle: 0, - total_fee:0, - allsto:null, - imgUrl:t.globalData.setting.imghost, - }, - onLoad: function() { - - wx.setNavigationBarTitle({ title: "购物车",}) - - var a = this; - t.auth.hadAuth() && t.getUserInfo(function() { - a.getCardList(); + data: { + url: t.globalData.setting.url, + resourceUrl: t.globalData.setting.resourceUrl, + iurl: t.globalData.setting.imghost, + requestData: null, + checkAllToggle: 0, + total_fee: 0, //结算金额 + total_num: 0, //结算数量 + all_num: 0, //购物车中所有商品数量 + allsto: null, + imgUrl: t.globalData.setting.imghost, + is_has_flash: 0, //是否又秒杀活动 + is_edit: 0, //是否编辑 + is_load: 0, //是否已加载 + up_dating: 0, //更新中 + isreduce: 0, //商品数量是否可减 + isadd: 0, //是否可以加商品数量 + }, + + onLoad: function() { + wx.setNavigationBarTitle({ + title: "购物车", + }) + var a = this; + //判断是否有登陆 + t.auth.hadAuth() && t.getUserInfo(function() { + a.getCardList(); + }); + }, + onShow: function() { + var th = this; + this.getCardList(); + if(getApp().globalData.user_id) getApp().requestCardNum(); + //--获取是否又秒杀活动-- + getApp().request.promiseGet("/api/ms/flash_sale/spikepage", { + data: { + store_id: oo.stoid, + timetype: 2, + is_end: 0, + is_show: 1, + pageSize: 1 + }, + }).then(res => { + if (res.data.code == 0 && res.data.data && res.data.data.pageData.length > 0) { + th.setData({ + is_has_flash: 1 + }) + } + }); + + }, + + //-------------获取购物车列表,要安装门店进行分类订单----------- + getCardList: function() { + var th = this; + //如果门店还未读出来的时候 + if (th.data.allsto == null) { + //读取门店 + app.get_allsto(function(e) { + th.setData({ + allsto: e }); - }, - onShow: function() { - this.getCardList(); - }, - - //-------------获取购物车列表,要安装门店进行分类订单----------- - getCardList: function () { - var th = this; - //如果门店还未读出来的时候 - if (th.data.allsto==null){ - //读取门店 - app.get_allsto(function(e){ - th.setData({ allsto: e}); - th.get_cart(); - }) - }else{ th.get_cart();} + th.get_cart(); + }) + } else { + th.get_cart(); + } }, //-----真的获取购物车-------- - get_cart:function(){ - var th=this; + get_cart: function() { + var th = this; var rd = Math.random().toString(36).substr(2, 15); getApp().request.get("/api/weshop/cart/list", { data: { - user_id: app.globalData.user_id, rd: rd, - store_id: oo.stoid,pageSize:600}, - success: function (su) { - console.log("333"); - console.log(th.data.allsto); - + user_id: app.globalData.user_id, + rd: rd, + store_id: oo.stoid, + pageSize: 600 + }, + success: function(su) { //按门店分类的数组 - var arr = new Array(); - var carr = su.data.data.pageData; + var arr = new Array(), + carr = su.data.data.pageData; + var all_num = 0; + for (var i = 0; i < carr.length; i++) { var item = carr[i]; + all_num += item.goods_num; item.original_img = oo.imghost + item.original_img; + item.selected = 0; - item.selected=0; - var pcid = item.pick_id; var find = 0; //---------循环查找门店--- - if (arr.length>0){ - for (var j = 0; j < arr.length; j++) { - if (arr[j].pid == pcid) { - arr[j].goods.push(item); - find = 1; - break; - } + if (arr.length > 0) { + for (var j = 0; j < arr.length; j++) { + if (arr[j].pid == pcid) { + arr[j].goods.push(item); + find = 1; + break; } + } } //------如果没有找到----- if (find == 0) { var pikname = ''; //找到门店名称 - for (var k=0;k= a.store_count)) { - var e = { - goods_num: a.goods_num + 1, - id: a.id, - goods_id:a.goods_id, - store_id:oo.stoid - }; - this.postCardList(e, t.currentTarget.dataset.item, t.currentTarget.dataset.pitems); - } - }, - //-------------减数量--------------------- - subNum: function(t) { - var a = t.currentTarget.dataset.item; - var b = t.currentTarget.dataset.pitems; - a = this.data.requestData[b].goods[a]; - - if(a.goods_num - 1<0) return false; - - if (1 != a.goods_num) { - var e = { - goods_num: a.goods_num - 1, - id: a.id, - goods_id: a.goods_id, - store_id:oo.stoid - }; - this.postCardList(e, t.currentTarget.dataset.item, t.currentTarget.dataset.pitems); + }); } - }, - //---------------全选,全选的时候要判断是否门店的匹配方式一致-------------- - checkAll: function() { - var e = this, dda = e.data.requestData, tfeel = 0,text_arr=""; - for (var i = 0; i < dda.length; i++) { - var item=dda[i].goods; - if (!e.data.checkAllToggle){ - var txt = "requestData[" +i+ "].selected"; - e.setData({ [txt]:0,}); + } + }); + }, + + //-----------------点击输入修改商品数量--------------- + valueToNum: function(t) { + var a = t.currentTarget.dataset.item; + var b = t.currentTarget.dataset.pitems; + a = this.data.requestData[b].goods[a]; + var e = a; + if (a = isNaN(t.detail.value) || t.detail.value < 1 ? 1 : parseInt(t.detail.value)) { + var s = { + goods_num: a, + goods_id: e.goods_id, + id: e.id, + store_id: oo.stoid + }; + this.postCardList(s, t.currentTarget.dataset.item, t.currentTarget.dataset.pitems); + } + }, + + //-------------加数量--------------------- + addNum: function(t) { + if (this.data.up_dating == 1) return false; + this.data.up_dating = 1; + + var a = t.currentTarget.dataset.item; + var b = t.currentTarget.dataset.pitems; + a = this.data.requestData[b].goods[a]; + + if (a.goods_num 0 ){ - - console.log(item); - for (var i = 0; i < iarr.length; i++) { - if (iarr[i].distr_type != 0) { - if (fir == 0) { fir = iarr[i].distr_type; } - else { - if (fir != iarr[i].distr_type && iarr[i].distr_type!=0 ) { isok = 0; break; } + if (text_arr != "") { + wx.showModal({ + title: '提示', + content: text_arr + '不能与门店中其他商品一起结算,配送方式不一致' + }); + return false; + } else { + e.setData({ + checkAllToggle: !e.data.checkAllToggle, + total_fee: tfeel.toFixed(2), + total_num: t_num, + }); + } + }, + + //------门店全选按钮,要判断是否门店的匹配方式一致--------- + check_th_all_item: function(ele) { + var e = this, + pitems = ele.currentTarget.dataset.pitems, + item = this.data.requestData[pitems].goods, + sele = this.data.requestData[pitems].selected; + + var isok = 1, + fir = 0, + iarr = item; + if (!sele && item.length > 0) { + for (var i = 0; i < iarr.length; i++) { + if (iarr[i].distr_type != 0) { + if (fir == 0) { + fir = iarr[i].distr_type; + } else { + if (fir != iarr[i].distr_type && iarr[i].distr_type != 0) { + isok = 0; + break; } } } - } + } + } - if (!isok) { - wx.showModal({ title: '提示', content: '同一门店自提和物流的商品不能同时结算' }); return false; - } + if (!isok) { + wx.showModal({ + title: '提示', + content: '同一门店自提和物流的商品不能同时结算' + }); + return false; + } - for(var i=0;i 1 && !a.selected){ - for (var i = 0; i < iarr.length;i++){ - //---当不是本身选择项目---- - var sel = iarr[i].selected; - if (iarr[i].distr_type != 0 && (sel || iarr[i].id==a.id)) { - if (fir == 0) { fir = iarr[i].distr_type; } - else { - if (fir != iarr[i].distr_type && iarr[i].distr_type != 0) { isok = 0; break; } - } - } + for (var i = 0; i < item.length; i++) { + var txt = "requestData[" + pitems + "].goods[" + i + "].selected"; + e.setData({ + [txt]: Number(!sele), + }); + } + var txt = "requestData[" + pitems + "].selected"; + e.setData({ + [txt]: Number(!sele), + }); + this.doCheckAll(); + }, + + //---------------单选,也要判断门店的配送方式是否一致-------------- + check_th_item: function(t) { + var e = this, + item = t.currentTarget.dataset.item, + pitems = t.currentTarget.dataset.pitems; + a = this.data.requestData[pitems].goods[item]; + var isok = 1, + fir = 0; + var iarr = e.data.requestData[pitems].goods; + + + //当数量大于1,且是选择的时候 + if (iarr.length > 1 && !a.selected) { + for (var i = 0; i < iarr.length; i++) { + //---当不是本身选择项目---- + var sel = iarr[i].selected; + if (iarr[i].distr_type != 0 && (sel || iarr[i].id == a.id)) { + if (fir == 0) { + fir = iarr[i].distr_type; + } else { + if (fir != iarr[i].distr_type && iarr[i].distr_type != 0) { + isok = 0; + break; + } } } - if(!isok){ - wx.showModal({ title: '提示', content: '同一门店自提和物流的商品不能同时结算' }); - }else{ - var txt = "requestData[" + pitems + "].goods[" + item + "].selected"; - e.setData({ - [txt]: Number(!a.selected), - }); - this.doCheckAll(); + } + } + if (!isok) { + wx.showModal({ + title: '提示', + content: '同一门店自提和物流的商品不能同时结算' + }); + } else { + var txt = "requestData[" + pitems + "].goods[" + item + "].selected"; + e.setData({ + [txt]: Number(!a.selected), + }); + this.doCheckAll(); + } + }, + //----------检查是否全选--------- + doCheckAll: function() { + var th = this, + tfeel = 0, + t_num = 0, + ischeck = 1, + car = this.data.requestData, + all_num = 0; + + for (var a = 0; a < car.length; a++) { + var item = car[a].goods, + is_s_sele = 1; + for (var c = 0; c < item.length; c++) { + all_num += item[c].goods_num; + if (item[c].selected == 0) { + ischeck = 0; + is_s_sele = 0; + } else { + tfeel += item[c].goods_num * item[c].goods_price; + t_num += item[c].goods_num; } - }, - //----------检查是否全选--------- - doCheckAll: function() { - var th=this,tfeel=0,ischeck = 1,car = this.data.requestData; - for (var a = 0; a < car.length; a++) { - var item = car[a].goods; - var is_s_sele=1; - for (var c = 0; c < item.length;c++){ - if(item[c].selected==0){ - ischeck=0; - is_s_sele=0; - } - else{ tfeel += item[c].goods_num * item[c].goods_price; } - } + } + + var txt = "requestData[" + a + "].selected"; + th.setData({ + [txt]: Number(is_s_sele) + }); + + } + this.setData({ + checkAllToggle: ischeck, + total_fee: tfeel.toFixed(2), + all_num: all_num, + total_num: t_num + }); + }, - var txt = "requestData[" + a+ "].selected"; - th.setData({ - [txt]: Number(is_s_sele), + //----------------------更新购物数量,加减,调用接口--------------------- + postCardList: function(t, item, pitem) { + var e = this; + var user_id = getApp().globalData.user_id; + console.log('update'); + console.log(t); + rq.get("/api/weshop/goods/get/" + oo.stoid + "/" + t.goods_id, { + isShowLoading: 0, + async success(d) { + var limit = d.data.data.viplimited; + var store_count = d.data.data.store_count; + + var goodsinfo = e.data.requestData[pitem].goods[item]; + var promgoodsbuynum = 0; + var goodsbuynum = 0; + + //--要获得商品,该用户买了多少件,同步应用-- + await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", { + data: { + store_id: oo.stoid, + user_id: user_id, + goods_id: goodsinfo.goods_id, + prom_type: goodsinfo.prom_type, + prom_id: goodsinfo.prom_id + }, + }).then(res => { + var buy_num_data = res.data.data; + if (buy_num_data.promgoodsbuynum) promgoodsbuynum = buy_num_data.promgoodsbuynum; + goodsbuynum = buy_num_data.goodsbuynum; + }) + + var buyed_mum2 = t.goods_num + goodsbuynum; + if (buyed_mum2 > limit && limit > 0) { + wx.showModal({ + title: '提示', + content: '购买数量超出商品限购' }); + var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; + var cbuy = limit - buyed_mum; + e.setData({ + [txt]: cbuy > 0 ? cbuy : 0, + }); + e.doCheckAll(); + return false; + } + if (t.goods_num > store_count) { + wx.showModal({ + title: '提示', + content: '购买数量超出商品库存' + }); + var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; + e.setData({ + [txt]: store_count + }); + e.doCheckAll(); + return false; } - this.setData({ - checkAllToggle: ischeck, - total_fee: tfeel.toFixed(2), - }); - }, - - //----------------------更新购物数量,加减,调用接口--------------------- - postCardList: function (t, item, pitem) { - var e = this; - var user_id=getApp().globalData.user_id; - console.log('update'); - console.log(t); - rq.get("/api/weshop/goods/get/" + oo.stoid + "/" + t.goods_id, { - async success(d) { - var limit = d.data.data.viplimited; - var store_count = d.data.data.store_count; - - var goodsinfo=e.data.requestData[pitem ].goods[item]; - var promgoodsbuynum=0; - var goodsbuynum=0; - //--要获得商品,该用户买了多少件,同步应用-- - await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum",{ - data: { - store_id: oo.stoid, - user_id: user_id, - goods_id: goodsinfo.goods_id, - prom_type:goodsinfo.prom_type, - prom_id:goodsinfo.prom_id - }, - }).then(res=>{ - var buy_num_data=res.data.data; - if(buy_num_data.promgoodsbuynum) promgoodsbuynum=buy_num_data.promgoodsbuynum; - goodsbuynum=buy_num_data.goodsbuynum; - }) - - var buyed_mum2 = t.goods_num + goodsbuynum; - if (buyed_mum2>limit && limit>0){ - wx.showModal({ title: '提示', content: '购买数量超出商品限购'}); - var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; - var cbuy = limit - buyed_mum; - e.setData({ [txt]: cbuy > 0 ? cbuy:0, }); - return false; - } - if (t.goods_num > store_count) { - wx.showModal({ title: '提示', content: '购买数量超出商品库存' }); - var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; - e.setData({ [txt]: store_count }); - return false; - } + if (goodsinfo.prom_type == 1) { + //读取秒杀 + rq.get("/api/ms/flash_sale/getFlashSaleOne/" + oo.stoid + "/" + goodsinfo.prom_id, { + isShowLoading: 0, + success: function(res_d) { + var false_data = res_d.data.data; + + //--判断库存-- + if (t.goods_num > false_data.goods_num - false_data.buy_num) { + wx.showModal({ + title: '提示', + content: '购买数量超出活动库存' + }); + var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; + e.setData({ + [txt]: false_data.goods_num - false_data.buy_num + }); + e.doCheckAll(); + return false; + } - if(goodsinfo.prom_type==1){ - //读取秒杀 - rq.get("/api/ms/flash_sale/getFlashSaleOne/" + oo.stoid + "/" + goodsinfo.prom_id, { - success: function (res_d) { - var false_data=res_d.data.data; - - //--判断库存-- - if (t.goods_num > false_data.goods_num-false_data.buy_num){ - wx.showModal({ title: '提示', content: '购买数量超出活动库存' }); - var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; - e.setData({ [txt]: false_data.goods_num-false_data.buy_num }); - return false; - } - - //--判断redis数量是否已经超出-- - if(t.goods_num >false_data.redisnum){ - wx.showModal({ title: '提示', content: '购买数量超出商品库存' }); - var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; - e.setData({ [txt]: false_data.redisnum }); - return false; - } - - //--活动的限购是不是要判断-- - if(t.goods_num+promgoodsbuynum >false_data.buy_limit && false_data.buy_limit>0){ - wx.showModal({ title: '提示', content: '购买数量超出秒杀限购' }); - var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; - e.setData({ [txt]: false_data.false_data.buy_limit }); - return false; - } - - e.update_cart(t,pitem,item); - } - }) - }else{ - e.update_cart(t,pitem,item); - } + //--判断redis数量是否已经超出-- + if (t.goods_num > false_data.redisnum) { + wx.showModal({ + title: '提示', + content: '购买数量超出商品库存' + }); + var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; + e.setData({ + [txt]: false_data.redisnum + }); + e.doCheckAll(); + return false; } - }); - }, - - //更新购物车 - update_cart:function(t,pitem,item){ - var e=this; - getApp().request.put("/api/weshop/cart/update", { - data: t, - success: function (ee) { - var txt = "requestData[" + pitem + "].goods[" + item+"].goods_num"; + + //--活动的限购是不是要判断-- + if (t.goods_num + promgoodsbuynum > false_data.buy_limit && false_data.buy_limit > 0) { + wx.showModal({ + title: '提示', + content: '购买数量超出秒杀限购' + }); + var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; e.setData({ - [txt]: t.goods_num, + [txt]: false_data.false_data.buy_limit }); e.doCheckAll(); + return false; + } + e.update_cart(t, pitem, item); } + }) + } else { + e.update_cart(t, pitem, item); + } + } + }); + }, + + //更新购物车 + update_cart: function(t, pitem, item) { + var e = this; + getApp().request.put("/api/weshop/cart/update", { + data: t, + success: function(ee) { + var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; + e.data.up_dating = 0 + e.setData({ + [txt]: t.goods_num, }); - }, - - //-------下拉刷新--------- - onPullDownRefresh: function(t) { - this.getCardList(); - }, - - //--------------去结算------------ - async checkout() { - var glist=""; //用逗号隔开的 - var map=new Map(); //使用map值键进行运算 - var map_limit=new Map(); //使用map值键进行存储限购 - var g_arr = new Array(); //已选的商品列表 - var user_id=getApp().globalData.user_id; - var th=this; - - var ab = 0;//选中 - console.log('checkout'); - for (var i=0;i{ - var buy_num_data=res.data.data; - if(buy_num_data.promgoodsbuynum) promgoodsbuynum=buy_num_data.promgoodsbuynum; - goodsbuynum=buy_num_data.goodsbuynum; - }) - var ie={promgoodsbuynum:promgoodsbuynum,goodsbuynum:goodsbuynum}; - map_limit.set(val.goods_id + "", ie); - } - - try{ - ddata.forEach(function(val,ind){ - var num = map.get(val.goods_id+""); - if (num<=0) { - isok = 0; gname = val.goods_name; - throw "购买数量不能为0";return false; - } - if ( num>val.store_count) { - isok = 0; gname = val.goods_name; - throw "超出库存"; return false; - } - if ( num>val.redisnum && val.redisnum) { - isok = 0; gname = val.goods_name; - throw "超出活动库存"; return false; - } - if ( num>val.goods_num-val.buy_num && val.goods_num) { - isok = 0; gname = val.goods_name; - throw "超出活动库存";return false; - } - - var buyed=map_limit.get(val.goods_id+""); - if (num+buyed.goodsbuynum>val.viplimited && val.viplimited>0) { - isok = 0; gname = val.goods_name; - throw "超出商品限购";return false; - } - - if (num+buyed.promgoodsbuynum>val.buy_limit && val.buy_limit>0) { - isok = 0; gname = val.goods_name; - throw "超出活动限购";return false; - } - - for (var i = 0; i < g_arr.length;i++){ - if (g_arr[i].goods_id==val.goods_id){ - if(g_arr[i].goods_price != val.shop_price && g_arr[i].goods_price!=val.prom_price){ - isok = 0; gname = val.goods_name; - throw "商品价格已经变化"; - } - rq.put("/api/weshop/cart/update", { - data: { id: g_arr[i].id, selected: 1,store_id:oo.stoid }, - success: function (ee) { - console.log(ee); - } - }); - } - } - - }) - } catch (e) { err=e;} - if (isok==0){ - if (gname.length > 10) { - gname = gname.substr(0, 10); gname+="..."; - } - t.confirmBox(gname+":"+ err); return false; + } + } + if (ab == 0) { + t.my_warnning("未选择商品", 0, th); + return false; + } + + glist = glist.substring(0, glist.length - 1); + //--取一下商品的限购 以及活动的限购,redis数量-- + rq.get("/api/weshop/goods/getGoodsListNum", { + data: { + goodsidlist: glist, + store_id: oo.stoid + }, + async success(ee) { + console.log(ee); + if (ee.data.code == 0) { + var ddata = ee.data.data, + isok = 1, + gname = "", + err = ""; + //--组装-- + for (var ij = 0; ij < ddata.length; ij++) { + var val = ddata[ij]; + var obj = map_limit.get(val.goods_id + ""); + if (obj) continue; + + var promgoodsbuynum = 0; + var goodsbuynum = 0; + //--要获得商品,该用户买了多少件,同步应用-- + await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", { + data: { + store_id: oo.stoid, + user_id: user_id, + goods_id: val.goods_id, + prom_type: val.prom_type, + prom_id: val.prom_id + }, + }).then(res => { + var buy_num_data = res.data.data; + if (buy_num_data.promgoodsbuynum) promgoodsbuynum = buy_num_data.promgoodsbuynum; + goodsbuynum = buy_num_data.goodsbuynum; + }) + var ie = { + promgoodsbuynum: promgoodsbuynum, + goodsbuynum: goodsbuynum + }; + map_limit.set(val.goods_id + "", ie); + } + + try { + ddata.forEach(function(val, ind) { + var num = map.get(val.goods_id + ""); + if (num <= 0) { + isok = 0; + gname = val.goods_name; + throw "购买数量不能为0"; + return false; + } + if (num > val.store_count) { + isok = 0; + gname = val.goods_name; + throw "超出库存"; + return false; + } + if (num > val.redisnum && val.redisnum) { + isok = 0; + gname = val.goods_name; + throw "超出活动库存"; + return false; + } + if (num > val.goods_num - val.buy_num && val.goods_num) { + isok = 0; + gname = val.goods_name; + throw "超出活动库存"; + return false; + } + + var buyed = map_limit.get(val.goods_id + ""); + if (num + buyed.goodsbuynum > val.viplimited && val.viplimited > 0) { + isok = 0; + gname = val.goods_name; + throw "超出商品限购"; + return false; + } + + if (num + buyed.promgoodsbuynum > val.buy_limit && val.buy_limit > 0) { + isok = 0; + gname = val.goods_name; + throw "超出活动限购"; + return false; + } + + for (var i = 0; i < g_arr.length; i++) { + if (g_arr[i].goods_id == val.goods_id) { + if (g_arr[i].goods_price != val.shop_price && g_arr[i].goods_price != val.prom_price) { + isok = 0; + gname = val.goods_name; + throw "商品价格已经变化"; + } + rq.put("/api/weshop/cart/update", { + data: { + id: g_arr[i].id, + selected: 1, + store_id: oo.stoid + }, + success: function(ee) { + console.log(ee); } - wx.navigateTo({ - url: "/pages/cart/cart2/cart2" - }); + }); } + } + + }) + } catch (e) { + err = e; } - }); - }, - - //结算到最后一个商品 - set_last: function (ab, isok, gname){ - if (isok == 0) { - t.my_warnning(gname + "商品超出库存",0,this); - } else { - ab ? wx.navigateTo({ - url: "/pages/cart/cart2/cart2" - }) : t.my_warnning("还没有选中商品",0,this); + if (isok == 0) { + t.confirmBox(gname + ":" + err); + return false; + } + wx.navigateTo({ + url: "/pages/cart/cart2/cart2" + }); + } } - }, + }); + }, + + //结算到最后一个商品 + set_last: function(ab, isok, gname) { + if (isok == 0) { + t.my_warnning(gname + "商品超出库存", 0, this); + } else { + ab ? wx.navigateTo({ + url: "/pages/cart/cart2/cart2" + }) : t.my_warnning("还没有选中商品", 0, this); + } + }, //图片失败,默认图片 - bind_bnerr2: function (e) { + bind_bnerr2: function(e) { var _errImg = e.target.dataset.errorimg; var _errurl = e.target.dataset.url; var ii = _errurl.indexOf(oo.imghost); if (ii != -1) { this.setData({ - [_errImg]: oo.imghost+"/miniapp/images/default_g_img.gif", + [_errImg]: oo.imghost + "/miniapp/images/default_g_img.gif", }) } + }, + //设置点击按钮为true或者false + radio_chick: function(checked, num) { + var th = this; + var requestData = th.data.requestData; + }, + + //点击编辑后的效果 + edit_cart: function(e) { + var type = parseFloat(e.currentTarget.dataset.type); + this.setData({ + is_edit: type + }); + }, + + //--多个删除购物车商品--- + check_del: function() { + var glist = ""; //用逗号隔开的 + var user_id = getApp().globalData.user_id; + var th = this; + + var ab = 0; //选中 + for (var i = 0; i < this.data.requestData.length; i++) { + var i_arr = this.data.requestData[i].goods; + for (var j = 0; j < i_arr.length; j++) { + if (i_arr[j].selected) { + glist += i_arr[j].id + ","; + ab = 1; + } + } + } + + if (ab == 0) { + t.my_warnning("未选择商品", 0, th); + return false; + } + glist = glist.substring(0, glist.length - 1); + //要删除购物车中的商品 + var url = '/api/weshop/cart/delIds/' + oo.stoid + '/' + user_id + "/" + glist; + getApp().request.delete(url, { + success: function(t) { + th.getCardList(); + } + }); + }, + //跳到首页 + goto: function(e) { + wx.switchTab({ + url: '/pages/index/index/index', + }) } -}); +}); \ No newline at end of file diff --git a/pages/cart/cart/cart.wxml b/pages/cart/cart/cart.wxml index 7518033..695a6d2 100644 --- a/pages/cart/cart/cart.wxml +++ b/pages/cart/cart/cart.wxml @@ -1,58 +1,116 @@ + + + + - + + + + + + + + + 全选 + - - - - - 总计 : {{total_fee}} - - 不包含运费 + + + + 合计: + ¥{{total_fee}} + + + 不含运费 - + + + + + + + + - - - - 购物车暂无商品 - 去逛逛 + + + + + + 购物车竟然是空的 + + + 去首页逛逛 + + + \ No newline at end of file diff --git a/pages/cart/cart/cart.wxss b/pages/cart/cart/cart.wxss index 7274c90..904cf00 100644 --- a/pages/cart/cart/cart.wxss +++ b/pages/cart/cart/cart.wxss @@ -1,145 +1,296 @@ page { - background-color: #fff; + background-color: rgb(245, 245, 245); + font-family: crosoft yahei; +} + +.padding { + padding: 0rpx 30rpx; +} + +.alend { + align-items: flex-end; +} + +.goods-price { + font-size: 18rpx; +} + +.baseline { + display: flex; + align-items: baseline; +} + +.picture { + width: 100%; + height: 220rpx; } .container { - display: flex; - height: 100%; - align-items: center; - justify-content: center; - background-color: #fff; - padding-bottom: 100rpx; + display: flex; + height: 100%; + align-items: center; + justify-content: center; + background-color: rgb(255, 255, 255); + margin-bottom: 99rpx; +} + +radio { + transform: scale(0.8); } .login-in { - width: 100%; - box-sizing: border-box; + width: 100%; + box-sizing: border-box; + background-color: rgb(255, 255, 255); } .order-item { - display: flex; - justify-content: space-around; - height: 200rpx; - padding: 10rpx 0; - border-bottom: 1px solid #ddd; + display: flex; + height: 246rpx; + border-top: 3rpx solid rgb(245, 245, 245); + align-items: center; + padding-right: 30rpx; } .goods-ico { - display: flex; - align-items: center; + display: flex; + align-items: center; + padding: 0rpx 30rpx; +} + +.order-raido { + height: 100%; + padding-left: 30rpx; + padding-right: 25rpx; } .goods-img { - width: 180rpx; - height: 180rpx; - font-size: 0; - margin-top: 10rpx; + width: 180rpx; + height: 180rpx; + font-size: 0; + overflow: hidden; + border: 2rpx solid rgb(236, 236, 236); } .goods-cont { - position: relative; - width: 430rpx; - height: 200rpx; - font-size: 28rpx; + width: 385rpx; + height: 165rpx; + font-size: 28rpx; + margin-left: 35rpx; + padding-top: 7rpx; + padding-bottom: 5rpx; } .goods-name { - width: 370rpx; - height: 64rpx; - margin: 8rpx 0; - line-height: 32rpx; - color: #333; - + line-height: 32rpx; + color: #333; + height: 125rpx; } .goods-attribute { - max-height: 52rpx; - line-height: 26rpx; - font-size: 24rpx; - color: #999; -} - -.goods-price { - height: 40rpx; - line-height: 40rpx; - margin-top: 10rpx; + max-height: 52rpx; + line-height: 26rpx; + font-size: 24rpx; + color: #999; } .btn-del { - position: absolute; - right: 0; - top: 8rpx; - width: 34rpx; - height: 34rpx; + position: absolute; + right: 0; + top: 8rpx; + width: 34rpx; + height: 34rpx; } .count { - position: absolute; - right: 0; - bottom: 5rpx; - width: 156rpx; - height: 50rpx; - border: 1px solid #ddd; + display: flex; + bottom: 5rpx; + border: 2rpx solid rgb(236, 236, 236); + margin-bottom: 3rpx; +} + +.count>view, .count>input { + width: 50rpx; + height: 40rpx; + line-height: 40rpx; + text-align: center; + display: flex; + font-size: 18rpx; + justify-content: center; + min-height: 35rpx; } -.count>view,.count>input { - float: left; - width: 50rpx; - height: 50rpx; - line-height: 50rpx; - text-align: center; +.count>.goodadd { + width: 67rpx; + font-size: 24rpx; +} + +.count>.add { + font-size: 32rpx; } .sub { - border-right: 1px solid #ddd; + border-right: 2rpx solid rgb(236, 236, 236); } .add { - border-left: 1px solid #ddd; + border-left: 2rpx solid rgb(236, 236, 236); } .pay-for { - width: 100%; - height: 100rpx; - position: fixed; - left: 0; - bottom: 0; - font-size: 28rpx; - color: #666; - background-color: #f0f2f5; - z-index: 9999999 + + width: 100%; + height: 100rpx; + position: fixed; + left: 0; + bottom: 0; + font-size: 28rpx; + color: #666; + background-color: rgb(255, 255, 255); + z-index: 2; + border-top: 1rpx solid rgb(236, 236, 236); + border-bottom: 1rpx solid rgb(236, 236, 236); + } .pay-for .pay-btn { - float: right; - width: 200rpx; - height: 100rpx; - line-height: 100rpx; - text-align: center; - background-color: #f23030; - color: #fff; - border-radius: 0; + width: 220rpx; + height: 100rpx; + line-height: 100rpx; + background-color: rgb(219, 27, 52); + color: #fff; + border-radius: 0; + font-size: 31rpx; } .pay-for .consumer { - float: right; - margin-right: 20rpx; - line-height: 50rpx; + margin-right: 23rpx; + color: rgb(0, 0, 0); + letter-spacing: 1rpx; +} + +.pay-for .consumer .total { + color: rgb(0, 0, 0); +} + +.pay-for .consumer .tips { + color: rgb(153, 153, 153); } .pay-for .checkbox { - float: left; - padding-left: 40rpx; - line-height: 100rpx; - display: flex; - align-items: center; + float: left; + padding-left: 40rpx; + line-height: 100rpx; + display: flex; + align-items: center; } .pay-for .ico-check { - display: flex; - align-items: center; - margin-right: 20rpx; + display: flex; + align-items: center; + margin-right: 20rpx; +} + +.shmd_m { + height: 80rpx; + line-height: 80rpx; + display: flex; +} + +.shmd_m image { + height: 50rpx; + width: 55rpx; + margin-left: -10rpx; } -.shmd_m{margin-left: 5rpx; height: 80rpx; line-height: 80rpx; display: flex;border-bottom: 1rpx solid #ddd} -.shmd_m .goods-ico icon{margin-top: 26rpx;} -.shmd{margin-left: 20rpx;} \ No newline at end of file + +.shmd_m .goods-ico icon { + margin-top: 26rpx; +} + +.shmd { + margin-left: 5rpx; +} + +.store { + border-bottom: 7rpx solid rgb(245, 245, 245); +} + +.login-in .Storenum { + height: 80rpx; + color: rgb(51, 51, 51); +} + +.login-in .goods_num { + margin-left: 13rpx; +} + +.allradio { + width: 600rpx; + height: 100%; +} + +.allradio .all { + color: rgb(0, 0, 0); +} + +.specifications { + padding: 3rpx 8rpx; + margin-top: 8rpx; + font-size: 22rpx; + max-width: 356rpx; + width: auto; + height: 30rpx; + line-height: 29rpx; + background-color: rgb(236, 236, 236); + border-radius: 8rpx; + white-space: nowrap; + color: rgb(63, 63, 63); + display: inline-block; + +} + +.ellipsis-2 { + max-height: 64rpx; +} + +.abs { + top: 15rpx; + left: -39rpx; + width: 154rpx; + height: 40rpx; + background-color: rgb(16, 202, 220); + transform: rotate(320deg); + color: rgb(255, 255, 255); + line-height: 40rpx; +} + +/* 购物车为空 */ + +.empty_order image { + width: 329rpx; + height: 229rpx; + margin-top: 140rpx; +} + +.empty_order .xc-ash { + margin-top: 25rpx; + font-weight: 600px; +} + +.empty_order navigator { + margin-top: 60rpx; + border-radius: 40rpx; +} + +.empty_order navigator view { + width: 247rpx; + height: 56rpx; + background-color: rgb(255, 72, 72); + border-radius: 40rpx; +} + +.icon_no_sele{ display: inline-block; width: 39rpx; height: 39rpx; border: 1rpx solid #ddd; border-radius: 50%} +.icon_no_sele2{width: 39rpx; height: 39rpx; border: 1rpx solid #ddd; border-radius: 50%; margin-top: 20rpx; + margin-left: 30rpx; margin-right: 25rpx} + +.mlr{ margin-left: 25rpx; margin-right: 20rpx} diff --git a/pages/cart/cart2/c_filter.wxs b/pages/cart/cart2/c_filter.wxs new file mode 100644 index 0000000..6a74c7e --- /dev/null +++ b/pages/cart/cart2/c_filter.wxs @@ -0,0 +1,63 @@ +var filters = { + toFix:function(val,count){ + return val.toFixed(count) + }, + format_time:function(ts,isFull) { + var d = getDate(ts*1000) + var fm=[d.getFullYear(), d.getMonth()+1, d.getDate()].join('-'); + if(isFull==1) + fm=fm + ' '+ [d.getHours(), d.getMinutes(), d.getSeconds()].join(':') + return fm; + }, + setcolor:function(ind){ + if (ind == 0 || ind ==null) return "red"; + if(ind==1 ) return "green"; + if(ind==2) return "blue"; + if(ind==11) return "green"; + if(ind==12) return "blue"; + return ""; + }, + setbgcolor: function (ind) { + if (ind == 0 || ind == null) return "#ffa1b9"; + if (ind == 1) return "#59e1d2"; + if (ind == 2) return "#a3bcff"; + if (ind == 11) return "#59e1d2"; + if (ind == 12) return "#a3bcff"; + return ""; + }, + + get_type:function(ind){ + if (ind == 0 || ind == null) return "全场通用"; + if (ind == 1) return "品牌"; + if (ind == 2) return "品类"; + if (ind == 11) return "用途"; + if (ind == 12) return "分类1"; + return ""; + }, + get_type_card:function(ind){ + if (ind == 0 || ind == null) return "全场通用"; + if (ind == 1) return "指定品牌"; + if (ind == 2) return "指定品类"; + if (ind == 11) return "指定用途"; + if (ind == 12) return "指定分类1"; + return ""; + }, + format_huiche:function (text) { + if (!text) { + return ""; + } + var reg = getRegExp('\\\\n', 'g') + return text.replace(reg, '\n') + } +} + +module.exports = { + toFix: filters.toFix, + format_time:filters.format_time, + setcolor:filters.setcolor, + setbgcolor: filters.setbgcolor, + get_type: filters.get_type, + get_split_name: filters.get_split_name, + get_type_card: filters.get_type_card, + format_huiche: filters.format_huiche, +} \ No newline at end of file diff --git a/pages/cart/cart2/cart2.js b/pages/cart/cart2/cart2.js index a98daa6..64d986e 100644 --- a/pages/cart/cart2/cart2.js +++ b/pages/cart/cart2/cart2.js @@ -2,10 +2,11 @@ var t = getApp(),app=t, a = t.request, e = require("../../../utils/common.js"), s = require("../../../utils/util.js"), o = require("../../../utils/md5.js"), to = getApp(); var oo=t.globalData.setting; var regeneratorRuntime = require('../../../utils/runtime.js'); +var util_pay = require("../../../utils/pay.js"); -Page({ +Page({ data: { - url: t.globalData.setting.url, + url: t.globalData.setting.url, resourceUrl: t.globalData.setting.resourceUrl, imgUrl: t.globalData.setting.imghost, goods: null, @@ -51,6 +52,7 @@ Page({ /*----------物流选择--------*/ wu_arr:null, index:0, + w_sele_index:0, //判断页面是返回回来的还是 首次进入的 isclose:1, @@ -71,10 +73,17 @@ Page({ //选择的券列表 selected_quan_list:null, //选择的券的门店 - selected_quan_pick:null, + selected_quan_pick:null, is_close_quan:0, disabled:0, - + open_express:0,//控制选择物流名列表 的属性 + + is_express:0, //选中物流的属性 + expres_name:"", //点击选定 + isopen:0, //券的说明 + is_coupon:null, //选择券的控制属性 + is_shipping_code:"",//插入用户默认地址 + wu_arr_txt:"", //要更新的物流的字段 }, onLoad: function(t) { @@ -89,21 +98,20 @@ Page({ } }); - //先获取是否有关闭使用优惠券 - getApp().getConfig2(function (ee) { - var json_d = JSON.parse(ee.switch_list); - th.setData({ is_close_quan: json_d.is_close_quan }); - //-----先获取物流,再获取用户信息,再展示页面----- - th.get_wuliu(th.get_info(th.show_page)); - }) + //先获取是否有关闭使用优惠券 + getApp().getConfig2(function (ee) { + var json_d = JSON.parse(ee.switch_list); + th.setData({ is_close_quan: json_d.is_close_quan }); + //-----先获取物流,再获取用户信息,再展示页面----- + th.get_wuliu(th.get_info(th.show_page)); + }) + }, onUnload: function () { this.setData({ isclose: 1 })}, //----------子页返回父页触发---------- onShow: function() { - console.log('onshow'); var th=this; - console.log(th.data.isclose); if (th.data.isclose==0){ /*--- wx.navigateTo({ @@ -115,7 +123,7 @@ Page({ }) }else{ - this.getuser_addr(function(ie){ + this.getuser_addr(function(ie){ console.log("getuser_addr") console.log(ie) @@ -137,15 +145,20 @@ Page({ },500) }); + //--更新默认地址--,看一下是不是跳到地址页面 + if(!getApp().globalData.is_cart2_old){ + this.update_code(); + }else{ + getApp().globalData.is_cart2_old=0; + } } }, //-------------------获取物流--------------- get_wuliu(func) { + var th = this; to.getwuliu(function (e) { - console.log("ws"); - console.log(e); th.setData({ wu_arr: e }) typeof func == "function" && func(); }) @@ -223,7 +236,7 @@ Page({ }); }, - //-----真的获取购物车-------- + //-----真的获取购物车,入口-------- get_cart: function () { var th = this,app=getApp(); a.get("/api/weshop/cart/list", { @@ -277,9 +290,17 @@ Page({ //如果是物流的话,全部自提的控制要弄成0 if (e_t == 0) th.setData({ is_all_zt:0}); var narr = new Array(); narr.push(item); - //-----------拼装购物车结算的数组----------------- + + //-----------拼装购物车结算的数组,如果有默认物流时要用默认物流编号----------------- + var m_wind=0,def_exp_code=getApp().globalData.userInfo.def_exp_code; + if(e_t==0 && def_exp_code){ + for(var k=0;k{ if(res.data.code==0) quanlist=res.data.data.pageData; + + }) } @@ -416,9 +447,9 @@ Page({ t.data.data.prom_id = 0; t.data.data.prom_type = 0; - + th.setData({ - bn_goods: t.data.data, bn_pickname: gg.pick_name, bn_exp_type: et, + bn_goods: t.data.data, bn_pickname: gg.pick_name, bn_exp_type: et,index:m_wind, bn_pick: gg.pick_id, bn_t_exp_t: distr_t,selected_quan_list:quanlist }); //计算价格 @@ -462,8 +493,9 @@ Page({ } } } + th.setData({ - bn_goods: t.data.data, bn_pickname: gg.pick_name, bn_exp_type: et, + bn_goods: t.data.data, bn_pickname: gg.pick_name, bn_exp_type: et,index:m_wind, bn_pick: gg.pick_id, bn_t_exp_t: distr_t,selected_quan_list:quanlist }); //计算价格 @@ -574,8 +606,7 @@ Page({ th.data.cartlist[i].shipping_price=0; } - th.data.cartlist[i].shipping_price.toFixed(2); - + th.data.cartlist[i].shipping_price=th.data.cartlist[i].shipping_price.toFixed(2); //---如果有选择优惠券的情况下--- var quan_price=0; var coupon_price=0,bn_pick=th.data.bn_pick,pickid=cart_item.pickup_id; @@ -627,7 +658,7 @@ Page({ } }else{ th.data.cartlist[i].user_money=0; - } + } th.data.cartlist[i].user_money = parseFloat(th.data.cartlist[i].user_money).toFixed(2); @@ -637,16 +668,17 @@ Page({ th.data.cartlist[i].goods_price = o_price.toFixed(2); th.data.cartlist[i].order_amount= th.data.cartlist[i].order_amount- th.data.cartlist[i].user_money; //会员使用余额 - all_price += parseFloat(o_price); - all_total_m += parseFloat(th.data.cartlist[i].total_amount); - all_shipping_m += parseFloat(th.data.cartlist[i].shipping_price); - all_order_m += parseFloat(th.data.cartlist[i].order_amount); - all_user_m += parseFloat(th.data.cartlist[i].user_money); - all_coupon_price_m+= parseFloat(th.data.cartlist[i].coupon_price); + all_price += parseFloat(o_price); + all_total_m += parseFloat(th.data.cartlist[i].total_amount); + all_shipping_m += parseFloat(th.data.cartlist[i].shipping_price); + all_order_m += parseFloat(th.data.cartlist[i].order_amount); + all_user_m += parseFloat(th.data.cartlist[i].user_money); + all_coupon_price_m+= parseFloat(th.data.cartlist[i].coupon_price); } + all_shipping_m=parseFloat(all_shipping_m).toFixed(2); all_total_m = parseFloat(all_total_m).toFixed(2); all_order_m = parseFloat(all_order_m).toFixed(2); all_price = parseFloat(all_price).toFixed(2); @@ -758,6 +790,7 @@ Page({ //--------------如果使用余额--------------------- if (th.data.bn_use_money == 1) { if (amoney> order_m) { + order_m = order_m.toFixed(2); th.setData({ [txt]: order_m, [txt2]:0,[txt3]:coupon_price }) }else{ order_m =parseFloat(order_m - amoney); @@ -949,6 +982,7 @@ Page({ } console.log(pdata); } + if (pdata.length==0) return; var str = JSON.stringify(pdata); wx.showLoading({title: "加载中"}); @@ -983,9 +1017,24 @@ Page({ //要进行判断,如果是用微信支付,就要跳转到支付界面 if (order_amount > 0) { th.setData({ isclose: 0 }); - void e.jumpToCart4({ - order_sn: data.data, - }, 1); + //void e.jumpToCart4({ + // order_sn: data.data, + //}, 1); + util_pay.pay(data.data, function() { + //app.my_warnning("支付成功",1,th); + //setTimeout(function () { + wx.navigateTo({ + url: "/pages/payment/pay_success/pay_success?type=2&order_sn="+data.data + }) + //},1000) + + }, function () { + //支付失败 + setTimeout(function () { + wx.navigateBack({ delta: 1 }) + },1000) + },oo.stoid); + } else { var dd = { parent_sn: data.data, @@ -997,13 +1046,13 @@ Page({ success: function (t) { //console.log(t); if(t.data.code==0){ - app.my_warnning("支付成功",1,th); - setTimeout(function () { + //app.my_warnning("支付成功",1,th); + //setTimeout(function () { th.setData({ isclose: 0 }); wx.navigateTo({ - url: "/pages/user/order_list/order_list" + url: "/pages/payment/pay_success/pay_success?type=2&order_sn="+data.data, }) - }, 1000) + //}, 1000) } }, fail:function () { @@ -1049,17 +1098,22 @@ Page({ }); }, enterAddressPage: function() { + getApp().globalData.is_cart_old=1; this.data.enterAddressPage = !0, wx.navigateTo({ - url: "/pages/user/address_list/address_list?is_back=1" + url: "/pages/user/address_list/address_list" }); }, - //--------立即购买时,选择自提和物流----------- + //--------购物车购买时,选择自提和物流----------- setexptype_w:function(t){ - var th=this; - var ty = t.currentTarget.dataset.t,txt = t.currentTarget.dataset.txt; + var def_exp_code= getApp().globalData.userInfo.def_exp_code,th=this; + var ty = t.currentTarget.dataset.t, txt = t.currentTarget.dataset.txt, + wl_txt = t.currentTarget.dataset.wl_txt, + ont = t.currentTarget.dataset.ont; + th.setData({ [txt]: ty }); var iszt=1; + if(ty==0){ th.setData({ is_all_zt: 0 }); }else{ @@ -1067,22 +1121,48 @@ Page({ var item = th.data.cartlist[i]; if (item.exp_type==0){ iszt=0;break;} } + th.setData({ is_all_zt: iszt }); } + //判断有没有默认的物流地址值 + if (def_exp_code != "" && def_exp_code != null && def_exp_code !=undefined) { + var wu_arr=this.data.wu_arr; + if (wu_arr!= null && wu_arr!=""){ + for(var i=0;i + +
- - + + - + + - - 门店:{{item.pname}} + + + 门店:{{item.pname}} @@ -40,70 +48,116 @@ {{items.goods_name}} - - {{items.goods_spec}}/ - {{items.goods_color==null?"":items.goods_color}} + + + + {{items.goods_spec}} + {{items.goods_color==null || items.goods_color=='' ?"":"/"+items.goods_color}} + - - - - ¥{{items.goods_price}} + + + + + {{filters.toFix(items.goods_price,2)}} x{{items.goods_num}} + + - 使用优惠券 + 优惠券 不使用 - {{using_quan[item.pickup_id].money}}元优惠券 + ¥{{using_quan[item.pickup_id].money}}元优惠券 + - {{order.store_prom}} + + + {{order.store_prom}} - - - + + + + + + + + + + + + + + 门店自提 - - - 快递邮寄 + + + + + + + + + + + 快递邮寄 + + + + + {{wu_arr[item.wind].name}} + + - - - 用户备注(50字) + + + + 留言 - - {{maxWord}}/50 + + + + - - - 使用余额 :¥{{yuer}} - + + + 使用余额 :¥{{yuer}} + + + 门店:{{bn_pickname}} @@ -113,14 +167,18 @@ {{bn_goods.goods_name}} - - {{bn_goods.goods_spec}}/{{bn_goods.goods_color}} - - - - ¥{{bn_goods.shop_price}} + + + 商品属性: + {{bn_goods.goods_spec}}/{{bn_goods.goods_color}} + + + + {{filters.toFix(bn_goods.shop_price,2)}} x{{bn_goods.buynum}} + + {{order.store_prom}} @@ -130,48 +188,32 @@ wx:if="{{selected_quan_list && selected_quan_list.length>0}}"> - 使用优惠券 + 优惠券 不使用 - {{using_quan[bn_pick].money}}元优惠券 + ¥{{using_quan[bn_pick].money}}元优惠券 - - + + + 自提 - + 物流 + + + {{wu_arr[index].name}} + - - - @@ -179,14 +221,13 @@ 使用余额 :¥{{yuer}} - - - 用户备注(50字) + + 留言 - - {{maxWord}}/50 + + @@ -238,53 +279,189 @@ - 选择优惠券 + 优惠券使用 × + + + 可使用的优惠券 + + 不使用优惠券 + + + Γ + + + + + + + - - - 不使用优惠券 - - - - - - - - - - - - {{item.Sum}}元 - 订单满{{item.BuySum?item.BuySum:0}}元使用 - 使用期限 - - {{filters.replace_time(item.BeginDate)}}至{{filters.replace_time(item.ValidDate)}} - - : 无限制 - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{item.Sum}} - + + + 无使用门槛 + + + {{UseObjectName}} + + + + + + + + + + + + {{filter.get_type_card(item.UseObjectType)}} + + 满{{item.buy_sum}}减{{item.Sum}}优惠券 + 全场通用减{{item.Sum}}优惠券 + + + + {{filters.replace_time2(item.BeginDate)}}至{{filters.replace_time2(item.BillDate)}} + + + + + + Γ + + + + + + + + + + + 优惠券使用说明 + + + + + + + + + + {{util.format(item.Remark)}} + + + + + + + + + + - 确定 + 确定 + + + + + + + + + + + + + + + 选择物流名字 + + + + × + + + + + + + Γ + + + + + {{express_list.name}} + + + + + + + 确定 + + + 设为默认 + + + + \ No newline at end of file diff --git a/pages/cart/cart2/cart2.wxss b/pages/cart/cart2/cart2.wxss index 972ae94..e010681 100644 --- a/pages/cart/cart2/cart2.wxss +++ b/pages/cart/cart2/cart2.wxss @@ -5,25 +5,26 @@ color: #444; } .user-contact { - padding: 24rpx 80rpx; + padding: 24rpx 70rpx; + font-weight: 600; } - + .location { position: relative; - padding: 0 80rpx 24rpx; + padding: 0 70rpx 24rpx; } .pos-icon { position: absolute; - left: 30rpx; - top: 0; + left: 22rpx; + top: 9rpx; width: 32rpx; - height: 32.5rpx; + height: 37.5rpx; } .border-img { width: 100%; - height: 16rpx; + height: 12rpx; } .update-logistics { @@ -50,23 +51,23 @@ .order-detail { padding: 30rpx 0; - border-bottom: 1px solid #ddd; + border-bottom: 6rpx solid #eee; color: #777; - min-height: 100rpx; + min-height: 190rpx; background-color: #fff; } .goods-img { float: left; - width: 100rpx; - height: 100rpx; + width: 191rpx; + height: 191rpx; margin: 0 20rpx; } .order-cont { float: left; - width: 400rpx; + width: 438rpx; } .goods-name { @@ -75,6 +76,8 @@ overflow: hidden; margin-bottom: 16rpx; font-size: 28rpx; + color: #333; + } .goods-color { @@ -82,29 +85,27 @@ } .order-num { - float: right; + margin-top: 25rpx; font-size: 24rpx; - margin-top: 10rpx; - margin-right: 20rpx; - text-align: right; line-height: 42rpx; } -.set-mes{background-color: #fff; margin-bottom: 20rpx;} +.set-mes{background-color: #fff; } .use-item{ display: flex; align-items: center; - height: 92rpx; + height: 80rpx; border-bottom: 1px solid #ddd; font-size: 30rpx; - padding-left: 20rpx; - + width:95%; +margin:auto; + } .use-item>view{ - display: flex;margin-right: 20rpx; + display: flex;margin-right: 12rpx; } .use-item.bfff{ background-color: #fff;} -.use-item .dp{width: 56rpx; height: 56rpx;} +.use-item .dp{width: 56rpx; height: 56rpx; margin-left: -5rpx} .set-item { justify-content: space-between; @@ -134,11 +135,14 @@ } .coupon-mes { - margin-bottom: 20rpx; + height:95rpx; padding: 0 20rpx; background-color: #fff; font-size: 30rpx; color: #444; + width: 100%; + + } .coupon-title { @@ -165,15 +169,17 @@ .leave-word { position: relative; - margin: 20rpx 0; + font-size: 24rpx; + margin-left: 20rpx; + } .word-box { - border: 1px solid #ddd; - width: 690rpx; + + width: 600rpx; padding: 10rpx; - height: 120rpx; + height: 28rpx; line-height: 40rpx; } @@ -271,18 +277,20 @@ .add_new{height: 60rpx; line-height: 60rpx;} .addr_jia{width: 45rpx; height: 45rpx; border: 1rpx solid #ddd; margin-right: 15rpx; margin-left: 20rpx; vertical-align: middle;} -.yu_er{margin-left: 15rpx;} .wuliu{margin-left: 20rpx;} +.yu_er{margin-left: 10rpx;margin-right: 60rpx;} .wuliu{margin-left: 20rpx;} /*---- 优惠券列表 -----*/ .xc-coupon-frame{ width: 100%; height: 92rpx; - border-bottom:1px solid #ddd; + } .xc-coupon-frame .work-frame{ - width: 94%; + width: 100%; height: 100%; + border-bottom:3rpx solid #eee; + } .xc-right{ @@ -292,36 +300,41 @@ border-right:2rpx solid #000; transform:rotate(45deg); display:inline-block; - margin-top:30rpx; + } -.xc-coupon-frame .work-frame .work{ font-size: 30rpx; line-height: 92rpx; color: #d81e06;} +.xc-coupon-frame .work-frame .work{ font-size: 30rpx; line-height: 92rpx; } .xc-right-frame{font-size: 30rpx;line-height: 92rpx; margin-right: 10rpx } /* 自定义弹出窗口 */ .cx-popup{ width:100%; - height: 775rpx; + height:920rpx; background: #fff; z-index: 35; - border-top-left-radius: 10rpx; - border-top-right-radius: 10rpx; + border-top-left-radius: 20rpx; + border-top-right-radius: 20rpx; position:fixed; bottom:0; + padding-bottom: 25rpx; + } .cx-popup .top{ - width:100%; + width:95%; height:100rpx; border-bottom:3rpx solid #ddd; - + margin: auto; + margin-top: 30rpx; } .xc-top-content{ - width: 88%; + width: 93%; height:85rpx; - padding-top: 20rpx; - font-size: 36rpx; + padding-top: 30rpx; + font-size: 34rpx; + font-weight: 600; + } @@ -333,35 +346,29 @@ } .xc-frame{ width: 100%; - height: 465rpx; - margin-top:20rpx; - + height:68.9%; } .xc-frame .list-frame{ - width: 90%; + width: 95%; height: 100%; overflow-y:scroll; } .xc-close-frame{ - margin-top:10rpx; - width:1%; + margin-top:-10rpx; + } .xc-close{ - width: 46rpx; -height: 46rpx; + width: 37rpx; +height: 37rpx; border-radius: 50%; -border: 5rpx solid #a5a5a7; +border: 3rpx solid #333; text-align: center; -line-height: 46rpx; -font-size: 34rpx; -font-weight: bolder; -color: #a5a5a7; -margin-top: 5rpx; - - +line-height: 34rpx; +font-size: 29rpx; +color: #333; } .xc-money{ @@ -424,16 +431,14 @@ margin-top: 5rpx; } .xc-confirm { - width: 90%; - height: 75rpx; + width: 48%; + border-radius: 50rpx; + height: 50rpx; margin:0 auto; - background:#c41830; + background:#d60021; color:#fff; - border-radius:10rpx; - font-size:30rpx; - margin-top: 50rpx; - - + font-size:28rpx; + margin-top: 28rpx; } .up{ animation: up .7s; } @@ -448,3 +453,373 @@ height: 40rpx; } +.xc-close-express{ + width: 40rpx; +height: 40rpx; +border-radius: 50%; +border: 3rpx solid #333; +text-align: center; +font-size:32rpx; +line-height: 38rpx; +color: #333; +margin-top: 5rpx; +} +.cx-popup .tops{ + width: 100%; +height: 145rpx; +border-bottom: 3rpx solid #eee; + +} +.top-content { + width: 82%; +padding-top: 33px; +height: 100%; +padding-left: 40rpx; +} +.close-frame{ + margin-top: 30rpx; + +} +.cx-popup.radius{ + +height: 650rpx; + +} +.xc-hook { +width: 33rpx; +height: 33rpx; +transform: rotate(-135deg); +line-height: 35rpx; +text-align: center; +margin-right: 20rpx + + +} +.xc-hooks { +width: 30rpx; +height: 30rpx; +border: 1rpx solid #999; +margin-right: 20rpx; +} +.express_list_frame{ + display: flex; +height: 80rpx; +align-items: center; +padding-left: 40rpx; +border-bottom: 1rpx solid #eee; + +} +.express_list{ + width: 100%; + height: 65%; + overflow-y: scroll; + overflow: hidden; +} +.xc-confirms { + width: 40%; + border-radius: 50rpx; + height: 55rpx; + margin:0 auto; + font-size:28rpx; + background: #fff; + color: #333; + border: 2rpx solid #333; + +} + + +/* 优惠券的改版样式 */ +.xc-coupon-frame{ + width: 710rpx; + height:auto; + margin: 0 auto; + +} +.xc-coupon-frame .coupon-frame{ + width: 99%; + height: 200rpx; + margin-top:10rpx; + border-bottom: 1rpx solid #eee; + +} +.xc-coupon-frame .coupon-frame .coupon-left{ + width: 215rpx; + height:100%; + overflow: hidden; +} +.xc-money-frames{ + width:96%; + margin-top: -10px; +} + +.xc-rmb-symbol{ + font-size:40rpx; + +} + +.xc-rmb-val{ + font-size:60rpx; + +} +.coupon-explain{ + font-size:25rpx; +width:100%; + + +} +.xc-valuer{ + margin-top:39rpx; + margin-left:28rpx; + font-size:25rpx; +} +.coupon-frame .oval{ + width:155rpx; + height:83rpx; + border-radius: 50%; + right:-78rpx; + top:-37rpx; +} +.coupon-right{ + width:490rpx; + height: 99%; + border-top: 1rpx solid #eaeaea; + /* //border-bottom: 1rpx solid #eaeaea; */ + border-right: 1rpx solid #eaeaea; + +} +.coupon-annotation{ + width: 95%; + height: 100%; + +} +.xc-brand{ + width:100rpx; + height:35rpx; + line-height: 35rpx; + font-size:21rpx; + border-radius:10rpx; position: relative; top:-1px; +} +.top-frame{ + width:82%; + height: 75rpx; + margin-top:10rpx; + +} +.top-frame .coupon-wode{ + font-size: 25rpx; + margin-left:10rpx; + width:340rpx; + height:88rpx; +} +.coupon-code{ + width:60rpx; + height:60rpx; + margin-top:5rpx; + +} +.frame{ + width: 100% +} +.coupon-time{ + font-size: 23rpx; + line-height:33rpx; + color: #333; +} + +.clik-get{ + width:125rpx; + height:45rpx; + border-radius: 25rpx; + line-height: 45rpx; + font-size:25rpx; + bottom:67rpx; + right:6px; +} + +.code-img{ + margin-left:20rpx; +} +.bottmo-explain{ +top:145rpx; +width:94%; +border-top:1rpx dashed #eee; +padding-top:8rpx; +height:38rpx; +line-height: 51rpx; + +} +.font-word{ + font-size: 22rpx; +} +.circle-size{ + background: #a0a0a0; + width: 27rpx; + height: 27rpx; + margin-top:13rpx; +margin-left:8rpx; +display: flex; + +align-items: center; +} +.xc-jiantou{ + /* width: 9rpx; + height: 9rpx; */ + /* border-top: 2rpx solid #fff; + border-right: 2rpx solid #fff; */ + transform: rotate(-90deg); + color: #fff; + font-size: 15rpx; + /* display:inline-block; + margin-top: 6.5rpx; */ + text-align: center; +width: 24rpx; +} +.xc-buttom{ + width:99%; +min-height:76rpx; +height:auto; +line-height:40rpx; +border-left:1rpx solid #eee; +border-right:1rpx solid #eee; +border-bottom:1rpx solid #eee; +margin-left: 6rpx; + +} +.goods-num{ + font-size: 28rpx; +color: #333; + +} +.explain-coupon{ + + font-size:25rpx; + +} +.circle-frame{ + width: 20rpx; + height: auto; + z-index:1; + left:210rpx; + +} +.circle-sawtooth{ + width: 11rpx; + height: 11rpx; + background: #fff; +} + +.red{background-color: #fe7496;} +.green{ background-color: #22c7c1;} +.blue{background-color:#5e82e3;} +.g_gray{background-color: #aaaaaa} + +.f_text{text-align: center; height:96rpx; } +.xc-hook.sn { + margin-top:12%; +width:45rpx; +height:45rpx; +font-size:28rpx; +line-height:44rpx; + + +} +.xc-hooks.on{ + margin-top:12%; +width:42rpx; +height:42rpx; +} +.may_use_coupon{ + width: 95%; + height: 68rpx; + line-height:78rpx; + margin: auto; +} +.determine-frame{ + width: 100%; + height: 130rpx; + +} +.xc-determine{ + height: 55rpx; + width: 40%; + border-radius: 50rpx; +background: #d60021; +color: #fff; +font-size: 28rpx; +margin: 0 auto; + +} +.click-buttem{ +width: 90%; +margin: auto; +} +.logistics-name{ + margin-right:20rpx; +} +.xc-border{ + border-top:8rpx solid #eee; +width: 100% +} +.main-top{ +margin-top: 20rpx; + +} +.xc-hookts{ +border: 1rpx solid #999; + +} +.xc-hookts.on{ + width:30rpx; +height:30rpx; + +} +.xc-hookt.sn{ + width: 32rpx; +height: 32rpx; +font-size: 28rpx; +line-height: 34rpx; +} +.xc-hookt{ + transform: rotate(-135deg); +text-align: center; + +} +.main-bottom{ + margin-bottom: 20rpx; + +} +.xc-hookst{ + border: 1rpx solid #999; + +} +.xc-hookst.ons{ + width: 42rpx; +height: 42rpx; +margin-left: 20rpx; + +} +.is_use_coupon{ + width: 65%; +justify-content: flex-end; +padding-top: 10rpx; + + +} +.xc-hooka{ + transform: rotate(-135deg); +text-align: center; + +} +.xc-hooka.sn{ + width: 45rpx; +height: 45rpx; +font-size: 28rpx; +line-height: 44rpx; +margin-left: 20rpx; + +} +.color-gray{ + color: #808080; +} + +.n_guige{ display: inline-block; background:rgb(236, 236, 236); color: rgb(63,63,63); padding: 3rpx 10rpx; border-radius: 3rpx } \ No newline at end of file diff --git a/pages/cart/cart2/filter.wxs b/pages/cart/cart2/filter.wxs new file mode 100644 index 0000000..c0e8d13 --- /dev/null +++ b/pages/cart/cart2/filter.wxs @@ -0,0 +1,11 @@ +var format = function (text) { + if (!text) { + return + } + var reg = getRegExp('\\\\n', 'g') + return text.replace(reg, '\n') +} + +module.exports = { + format: format +} diff --git a/pages/cart/cart2_pt/cart2_pt.js b/pages/cart/cart2_pt/cart2_pt.js index 2e733c3..e8269c1 100644 --- a/pages/cart/cart2_pt/cart2_pt.js +++ b/pages/cart/cart2_pt/cart2_pt.js @@ -2,6 +2,7 @@ var t = getApp(),app=t, a = t.request, e = require("../../../utils/common.js"), s = require("../../../utils/util.js"), o = require("../../../utils/md5.js"), to = getApp(); var oo=t.globalData.setting; var regeneratorRuntime = require('../../../utils/runtime.js'); +var util_pay = require("../../../utils/pay.js"); Page({ data: { @@ -54,7 +55,8 @@ Page({ is_pt_tz:0,//是否开团团长 qh:'', //期号 pt_listno:'',//期号 - is_normal:0 + is_normal:0, + is_express:0,//选择物流的控制器 }, onLoad: function(t) { console.log("onLoad_pt_cart"); @@ -212,18 +214,21 @@ Page({ //----------子页返回父页触发---------- onShow: function() { - console.log('onshow'); var th=this; - console.log(th.data.isclose); if (th.data.isclose==0){ wx.switchTab({ url: "/pages/index/index/index" }) - }else{ - this.getuser_addr(function(ie){ - th.setData({user_addr: ie }); - }) + this.getuser_addr(function(ie){ + th.setData({user_addr: ie }); + }) + //--更新默认地址--,看一下是不是跳到地址页面 + if(!getApp().globalData.is_cart2_old){ + this.update_code(); + }else{ + getApp().globalData.is_cart2_old=0; + } } }, //---------------检查是否有收货地址------------------- @@ -336,7 +341,6 @@ Page({ //--------------------提交订单----------------------- submitForm:function(t){ - if(this.data.is_summit_ing==1) return false; //--提交中退出-- this.data.is_summit_ing=1; @@ -457,11 +461,25 @@ Page({ }) //要进行判断,如果是用微信支付,就要跳转到支付界面 if (order_amount > 0) { - th.setData({ isclose: 0 }); - void e.jumpToCart4({ - order_sn: data.data, - type:1, - }, 1); + th.setData({ isclose: 0 }); + //void e.jumpToCart4({ + // order_sn: data.data, + // type:1, + // }, 1); + util_pay.pay(data.data, function() { + setTimeout(function () { + wx.navigateTo({ + url: "/pages/payment/pay_success/pay_success?type="+1+"&order_sn="+data.data, + }) + },1000) + }, function () { + //支付失败 + setTimeout(function () { + wx.navigateBack({ delta: 1 }) + },1000) + + },oo.stoid,1); + } else { var dd = { parent_sn: data.data, @@ -521,8 +539,9 @@ Page({ }); }, enterAddressPage: function() { + getApp().globalData.is_cart_old=1; this.data.enterAddressPage = !0, wx.navigateTo({ - url: "/pages/user/address_list/address_list?operate=select" + url: "/pages/user/address_list/address_list" }); }, @@ -646,6 +665,65 @@ Page({ var ob = {}; ob[txt] = this.data.imgUrl + "/miniapp/images/default_g_img.gif"; this.setData(ob); - } + }, + + //// 开启物流的弹窗 + show_wu_arr:function(e){ + this.setData({ open_express: 1}); + }, + + //更新下默认,在onshow里面 + update_code(){ + var th=this,m_wind=0,def_exp_code=getApp().globalData.userInfo.def_exp_code; + + var uii=setInterval(function () { + if(th.data.wu_arr){ + clearInterval(uii); + for (var k = 0; k < th.data.wu_arr.length; k++) { + var item = th.data.wu_arr[k]; + if (def_exp_code == item.code) { + m_wind = k; + } + } + //--如果是立即购买-- + th.setData({ index: m_wind, is_express: m_wind}); + } + },500) + }, + + // 关闭物流的弹窗 + close_express:function(){ + this.setData({ open_express:0 }); + }, + // 选择物流 + click_express_name:function(e){ + var express_name = e.currentTarget.dataset.name, shippingcode = e.currentTarget.dataset.shippingcode; + var index=e.currentTarget.dataset.idxe; + var ob={ is_express: index, is_shipping_code: shippingcode,index:index}; + this.setData(ob); + }, + + //点击确定物流 + determine_expres:function(e){ + this.setData({ open_express: 0}); + this.calculatePrice2(); + }, + //设置默认物流 + select_default_logistics: function () { + var th=this; + var is_shipping_code=this.data.is_shipping_code + getApp().request.put("/api/weshop/users/update",{ + data: { user_id: getApp().globalData.user_id, store_id: oo.stoid, def_exp_code: is_shipping_code}, + success:function(rse){ + if (rse.data.code==0){ + getApp().globalData.userInfo.def_exp_code=is_shipping_code; + th.setData({ open_express: 0 }); + //----计算此时购物车的价格---- + if(th.data.is_b_now==1) th.calculatePrice2(); + else th.calculatePrice(); + } + } + }) + }, }); diff --git a/pages/cart/cart2_pt/cart2_pt.wxml b/pages/cart/cart2_pt/cart2_pt.wxml index ed4506d..488abcb 100644 --- a/pages/cart/cart2_pt/cart2_pt.wxml +++ b/pages/cart/cart2_pt/cart2_pt.wxml @@ -1,14 +1,15 @@ + + + + + + + + + + + 选择物流名字 + + + + × + + + + + + + + Γ + + + + + {{express_list.name}} + + + + + + + 确定 + + + 设为默认 + + + + + diff --git a/pages/cart/cart2_pt/cart2_pt.wxss b/pages/cart/cart2_pt/cart2_pt.wxss index ef34fd0..753ef7b 100644 --- a/pages/cart/cart2_pt/cart2_pt.wxss +++ b/pages/cart/cart2_pt/cart2_pt.wxss @@ -5,20 +5,22 @@ color: #444; } .user-contact { - padding: 24rpx 80rpx; + padding: 24rpx 70rpx; + font-weight: 600; + } .location { position: relative; - padding: 0 80rpx 24rpx; + padding: 0 70rpx 24rpx; } .pos-icon { position: absolute; - left: 30rpx; - top: 0; + left: 22rpx; + top: 20rpx; width: 32rpx; - height: 32.5rpx; + height: 40rpx; } .border-img { @@ -50,17 +52,17 @@ .order-detail { padding: 30rpx 0; - border-bottom: 1px solid #ddd; + border-bottom: 7rpx solid #eee; color: #777; - min-height: 100rpx; + min-height: 190rpx; background-color: #fff; } .goods-img { float: left; - width: 100rpx; - height: 100rpx; + width: 190rpx; + height: 190rpx; margin: 0 20rpx; } @@ -75,6 +77,8 @@ overflow: hidden; margin-bottom: 16rpx; font-size: 28rpx; + color: #333; + } .goods-color { @@ -90,21 +94,21 @@ line-height: 42rpx; } -.set-mes{background-color: #fff; margin-bottom: 20rpx;} +.set-mes{background-color: #fff; } .use-item{ display: flex; align-items: center; height: 92rpx; border-bottom: 1px solid #ddd; font-size: 30rpx; - padding-left: 20rpx; - + width: 95%; + margin: auto; } .use-item>view{ - display: flex;margin-right: 20rpx; + display: flex;margin-right: 10rpx; } .use-item.bfff{ background-color: #fff;} -.use-item .dp{width: 56rpx; height: 56rpx;} +.use-item .dp{width: 56rpx; height: 56rpx; margin-left: -5rpx} .set-item { justify-content: space-between; @@ -134,11 +138,15 @@ } .coupon-mes { - margin-bottom: 20rpx; + height:95rpx; padding: 0 20rpx; background-color: #fff; font-size: 30rpx; color: #444; + width: 100%; + border-bottom: 6rpx solid #eee; + margin-bottom: 20rpx; + } .coupon-title { @@ -165,15 +173,16 @@ .leave-word { position: relative; - margin: 20rpx 0; font-size: 24rpx; + margin-left: 20rpx; + } .word-box { - border: 1px solid #ddd; - width: 690rpx; + + width: 600rpx; padding: 10rpx; - height: 120rpx; + height: 28rpx; line-height: 40rpx; } @@ -269,5 +278,291 @@ .add_new{height: 60rpx; line-height: 60rpx;} .addr_jia{width: 45rpx; height: 45rpx; border: 1rpx solid #ddd; margin-right: 15rpx; margin-left: 20rpx; vertical-align: middle;} -.yu_er{margin-left: 15rpx;} .wuliu{margin-left: 20rpx;} +.yu_er{margin-left: 15rpx;} .wuliu{margin-left: 20rpx;} + + +/* 自定义弹出窗口 */ +.cx-popup{ + width:100%; + height:920rpx; + background: #fff; + z-index: 35; + border-top-left-radius: 20rpx; + border-top-right-radius: 20rpx; + position:fixed; + bottom:0; + padding-bottom: 25rpx; + +} + +.cx-popup .top{ + width:95%; + height:100rpx; + border-bottom:3rpx solid #ddd; + margin: auto; + margin-top: 30rpx; + +} +.xc-top-content{ + width: 93%; + height:85rpx; + padding-top: 30rpx; + font-size: 34rpx; + font-weight: 600; + +} + + +.xc-valid-coupon{ + width: 90%; + height:40rpx; + padding-top: 24rpx; + overflow: hidden; +} +.xc-frame{ + width: 100%; + height:68.9%; +} + +.xc-frame .list-frame{ + width: 95%; + height: 100%; + overflow-y:scroll; + +} +.xc-close-frame{ + margin-top:-10rpx; + +} + +.xc-close{ + width: 37rpx; + height: 37rpx; + border-radius: 50%; + border: 3rpx solid #333; + text-align: center; + line-height: 34rpx; + font-size: 29rpx; + color: #333; + +} +.xc-money{ + color: #af2346; + font-size: 35rpx; +} + +.xc-money-frame{ + margin-left:35rpx; + +} +.xc-coupon-effect{ + width: 99%; + min-height: 100rpx; + border-bottom:3rpx solid #ddd; + + +} +.xc-goods-coupon{ + width: 85%; + height:100%; + +} +.xc-title{ + width:50%; + margin-left:222rpx; + +} +.xc-coupon-money0{ + color: #c91e31; + font-size: 35rpx; + line-height: 40rpx; + +} +.xc-coupon-money{ + color: #c91e31; + font-size: 35rpx; + line-height: 40rpx; + padding-top: 10px; + +} +.xc-coupon-money1{ + color: #444; + font-size: 28rpx; + line-height: 60rpx; + + +} +.xc-coupon-time{ + height: 50rpx; + font-size: 27rpx; + color: #a4a4a4; +} +.xc-coupon-time .time{ + margin-left: 15rpx; + font-size: 27rpx; +} +.xc-coupon-selection{ + height:100%; +} + +.xc-confirm { + width: 48%; + border-radius: 50rpx; + height: 50rpx; + margin:0 auto; + background:#d60021; + color:#fff; + font-size:28rpx; + margin-top: 28rpx; +} + +.up{ animation: up .7s; } +.down{ animation: down 1s; } +@keyframes up { 0% { transform: translateY(550rpx); } 100% { transform: translateY(0); } } +@keyframes down { 0% { transform: translateY(0); } 100% { transform: translateY(550rpx); } } + +.xc-not-Selection{ + width: 40rpx; + height: 40rpx; + background: #eeeeee; +} + + +.xc-close-express{ + width: 40rpx; + height: 40rpx; + border-radius: 50%; + border: 3rpx solid #333; + text-align: center; + font-size:32rpx; + line-height: 38rpx; + color: #333; + margin-top: 5rpx; +} +.cx-popup .tops{ + width: 100%; + height: 145rpx; + border-bottom: 3rpx solid #eee; + +} +.top-content { + width: 82%; + padding-top: 33px; + height: 100%; + padding-left: 40rpx; +} +.close-frame{ + margin-top: 30rpx; + +} +.cx-popup.radius{ + + height: 650rpx; + +} +.xc-hook { + width: 33rpx; + height: 33rpx; + transform: rotate(-135deg); + line-height: 35rpx; + text-align: center; + margin-right: 20rpx + + +} +.xc-hooks { + width: 30rpx; + height: 30rpx; + border: 1rpx solid #999; + margin-right: 20rpx; +} +.express_list_frame{ + display: flex; + height: 80rpx; + align-items: center; + padding-left: 40rpx; + border-bottom: 1rpx solid #eee; + +} +.express_list{ + width: 100%; + height: 65%; + overflow-y: scroll; + overflow: hidden; +} +.xc-confirms { + width: 40%; + border-radius: 50rpx; + height: 55rpx; + margin:0 auto; + font-size:28rpx; + background: #fff; + color: #333; + border: 2rpx solid #333; + +} + +.xc-right{ + width:20rpx; + height:20rpx; + border-top:2rpx solid #000; + border-right:2rpx solid #000; + transform:rotate(45deg); + display:inline-block; + margin-right: 5rpx; + margin-left: 10rpx; + +} + + +.xc-left{ + margin-left: 45rpx; +} +.xc-border{ + border-top:8rpx solid #eee; +width: 100% +} +.main-top{ +margin-top: 20rpx; + +} +.order-num { + margin-top: 25rpx; + font-size: 24rpx; + line-height: 42rpx; + width: 95%; + +} +.goods-num{ + font-size: 28rpx; +color: #333; + +} +.click-buttem{ +width: 90%; +margin: auto; +} +.xc-determine{ + height: 55rpx; + width: 40%; + border-radius: 50rpx; +background: #d60021; +color: #fff; +font-size: 28rpx; +margin: 0 auto; + +} +.xc-hookts{ +border: 1rpx solid #999; + +} +.xc-hookts.on{ + width:30rpx; +height:30rpx; + +} +.color-gray{ + color: #808080; +} +.n_guige{ display: inline-block; background:rgb(236, 236, 236); color: rgb(63,63,63); padding: 3rpx 10rpx; border-radius: 3rpx } \ No newline at end of file diff --git a/pages/cart/cart_wk/cart_wk.js b/pages/cart/cart_wk/cart_wk.js index 355498f..c4302ed 100644 --- a/pages/cart/cart_wk/cart_wk.js +++ b/pages/cart/cart_wk/cart_wk.js @@ -541,7 +541,7 @@ Page({ //------支付成功页面-------- jumpPaymentPage: function(order_sn,order_amount) { wx.setStorageSync("order:order_list:update", !0), wx.redirectTo({ - url: "/pages/payment/payment/payment?order_sn=" + order_sn + "&order_amount=" + order_amount + url: "/pages/payment/pay_success/pay_success?order_sn=" + order_sn + "&type=1", }); }, diff --git a/pages/goods/categoryList/categoryList.js b/pages/goods/categoryList/categoryList.js index 4b20b70..fd883c8 100644 --- a/pages/goods/categoryList/categoryList.js +++ b/pages/goods/categoryList/categoryList.js @@ -22,14 +22,31 @@ Page({ // 导航字母 letters: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'], + //控制新旧分类版本 + is_used_share:0, + //国家的控制属性 + is_country:1, + //品牌的控制属性 + is_brand:1, + //选择分类的控制属性 + select_classify_on:223, + index:223, + classify_name:"国家",//项目类型 + brand_list:null,//品牌列表 + + one_level_classify:[],// 新的版本左边的边分类1级 + is_level_three:0,//判断有没有3级 + cat_id:0, + pl_timer: null,//只有品类的定时器 + is_pl_time:0, }, onLoad: function(tt) { const res = wx.getSystemInfoSync(), letters = this.data.letters; var that = this; - this.requestFirstCategoris(); + this.setData({ abc: t.globalData.heigth-88-88-16, windowHeight: res.windowHeight, @@ -55,20 +72,58 @@ Page({ } this.setData({ lettersPosition: temp - }) + }); + + if (this.data.is_used_share==0){ + + this.get_nation(); + } }, onShow:function(){ var that=this; + this.requestFirstCategoris(); + if(getApp().globalData.user_id) getApp().requestCardNum(); getApp().getConfig2(function (e) { + + var data=e; + var switch_list_data = data.switch_list; + var switch_list = JSON.parse(switch_list_data); + var is_newsgoodstype = switch_list.is_newsgoodstype; + that.setData({ is_used_share :is_newsgoodstype}); if (e.categoryset.indexOf("," + 1 + ",") != -1) { that.setData({ is_show_pl: 1 }); } if (e.categoryset.indexOf("," + 3 + ",") != -1) { that.setData({ is_show_pp: 1 }); } if (e.categoryset.indexOf("," + 2 + ",") != -1) { that.setData({ is_show_gb: 1 }); } that.setData({ store_config: e,is_do:1 }); + if ( that.data.is_show_gb != 1 && that.data.is_show_pp != 1){ + + + that.data.pl_timer = setInterval(function () { + + that.requestFirstCategoris(); + console.log("8888888888888888888", that.data.one_level_classify.length); + if (that.data.one_level_classify.length>0){ + console.log("7777777777777777777777", that.data.one_level_classify); + //清除定时器 + clearInterval(that.data.pl_timer); + } + },1000); + + console.log(that.data.one_level_classify); + that.setData({ select_classify_on: 0, index: 0, goodslist: one_level_classify[0]}); + + } else if (that.data.is_show_gb != 1 ){ + + + that.setData({ select_classify_on: 220, classify_name: "品牌" }); + } + var one_level_classify = that.data.one_level_classify; + + if (that.data.is_show_pl) that.setData({ currentTab: 0 }); else if (that.data.is_show_gb){ that.setData({ currentTab: 1 });that.get_nation(); } else if (that.data.is_show_pp) {that.setData({ currentTab: 2 });that.get_brand(); } @@ -98,13 +153,17 @@ Page({ success: function(e) { var arr=new Array(); var dda = e.data.data.pageData; - console.log(dda.length); + if (dda != null && dda !=""&&dda!=undefined){ + t.setData({is_pl_time:1}); + } + + if (t.data.is_used_share == 0) {//is_used_share控制新旧版本 for(var i=0;i0){ + + if (parseInt(need_to_insert.parent_id) == parseInt(two_item[pp].items.id)) { + + arr[dd].array[pp].arrays.push(need_to_insert); arr.ishaf_three = 0; break; + } + + } + + } + } + } + + } + + console.log("现在是1级与2级所有的数据", arr) + t.setData({one_level_classify:arr}); + + } } }); }, @@ -220,9 +325,10 @@ Page({ //跳转到分类的商品列表 go_cate:function(t){ - var cid= t.currentTarget.dataset.cid; - var pid = t.currentTarget.dataset.pid; - var lurl = "/pages/goods/goodsList/goodsList?cat_id=" + cid + "&pid=" + pid; + var cid= t.currentTarget.dataset.cid; + var pid = t.currentTarget.dataset.pid; + var lurl = "/pages/goods/goodsList/goodsList?cat_id=" + cid; + lurl+="&pid="+pid; wx.navigateTo({ url: lurl}); }, @@ -239,10 +345,6 @@ Page({ var lurl = "/pages/goods/goodsList/goodsList?nation_id=" + cid; wx.navigateTo({ url: lurl }); }, - - - - //获取国别 get_nation:function(){ var s = this; @@ -254,6 +356,7 @@ Page({ }, success: function (e) { var dda = e.data.data.pageData; + console.log("国家的数据", dda); s.setData({ nationlist:dda}) } }); @@ -284,6 +387,8 @@ Page({ success: function (e) { var arr=new Array(); var dda = e.data.data.pageData; + console.log("商品数据",dda); + s.setData({brand_list:dda}); for (var i = 0; i < dda.length; i++) { dda[i].logo = oo.imghost+dda[i].logo; @@ -321,7 +426,14 @@ Page({ var _errImg = e.target.dataset.errorimg; var _errObj = {}; _errObj[_errImg] = this.data.iurl+"/miniapp/images/default_g_img.gif"; - this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; + }, + //商品图片失败,默认图片 + goods_bnerr: function (e) { + var _errImg = e.target.dataset.err; + var _errObj = {}; + _errObj[_errImg] = this.data.iurl + "/miniapp/images/no_cate_def.png"; + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; }, goseach:function(){ @@ -339,7 +451,86 @@ Page({ _errObj[_errImg] = "/public/images/category.png"; this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; - } + }, + // 新的版本分类点击一级分类 + click_classify:function(e){ + this.data.ishaf_three=0; + var indexs=e.currentTarget.dataset.index; + var name = e.currentTarget.dataset.name; + var cid = e.currentTarget.dataset.cid; + var pid = e.currentTarget.dataset.pid; + var arr = e.currentTarget.dataset.arr; + console.log("数据是什么",arr); + if (indexs==220){ + this.get_brand(); + } + + if (arr!="undefined" && arr!=undefined){ + if (arr.length==0){ + var lurl = "/pages/goods/goodsList/goodsList?cat_id=" + cid + "&pid=" + pid; + wx.navigateTo({ url: lurl }); + return false; + } + if (arr.length != 0){ + + for(var i=0;i0) { + + this.setData({ is_level_three: 1 }); + break; + } + this.setData({ is_level_three: 0 }); + } + if (this.data.is_level_three!=1) { + + + this.setData({ select_classify_on: indexs, index: indexs, classify_name: name, goodslist: arr }); + + + } else { + this.setData({ select_classify_on: indexs, index: indexs, goodslist: arr }); + + } + } + } + + this.setData({ select_classify_on: indexs, index: indexs, classify_name: name, cat_id: cid}); + + }, +// 图片失败 + bind_bnerr_xc: function (e) { + var _errImg = e.target.dataset.errorimg; + var _errurl = e.target.dataset.url; + + var _errObj = {}; + _errObj[_errImg] = "/miniapp/images/default_g_img.gif"; + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; + }, + //选择更多 + select_more:function(e){ + var cid = e.currentTarget.dataset.cid; + var pid = e.currentTarget.dataset.pid; + console.log("选择更多"+cid); + var lurl = "/pages/goods/goodsList/goodsList?cat_id=" + cid + "&pid=" + pid; + wx.navigateTo({ url: lurl }); + + }, +//扫一扫 + getScancode:function(){ + var _this = this; + // 允许从相机和相册扫码 + wx.scanCode({ + success: (res) => { + var result = res.result; + wx.navigateTo({ + url: "/pages/goods/search/search?s_key="+result, + }); + } + }) + }, + onUnload: function () { + this.destroyActivityTimer(); + }, }); \ No newline at end of file diff --git a/pages/goods/categoryList/categoryList.wxml b/pages/goods/categoryList/categoryList.wxml index 49b6bbf..f9feb6d 100644 --- a/pages/goods/categoryList/categoryList.wxml +++ b/pages/goods/categoryList/categoryList.wxml @@ -1,4 +1,4 @@ - + 国家 品牌 - + - + + @@ -28,7 +29,7 @@ - + {{fitem.items.name}} @@ -51,7 +52,7 @@ {{bitem.name}} - enname + {{bitem.enname}} @@ -67,8 +68,9 @@ - + @@ -97,3 +99,169 @@ 去逛逛 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +{{ishaf_three==1?good_list.name:classify_name}} + + + + + + + + {{bitem.name}} + + + {{bitem.enname}} + + + + + + + + + +{{classify_name}} + + + + + + + + + + + {{user.name}} + + + + + + + + + + + + +{{classify_name}} + + 更多 + + + + + + + + + {{goods.items.name}} + + + + + + + + + + + + + + + +{{goods.items.name}} + + 更多 + + + + + + + + + + {{item.name}} + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pages/goods/categoryList/categoryList.wxss b/pages/goods/categoryList/categoryList.wxss index a9d23f1..7b8606e 100644 --- a/pages/goods/categoryList/categoryList.wxss +++ b/pages/goods/categoryList/categoryList.wxss @@ -10,6 +10,7 @@ page{height: 100%; background: #fff;} flex-flow: row; justify-content: center; margin-left: 15%; + } .swiper-tab-item{ width: 30%; @@ -51,7 +52,7 @@ swiper{ border-radius: 29rpx; background-color: #fff; position: relative; - top:15rpx; + top: 15rpx; } .search-img { @@ -151,4 +152,236 @@ swiper{ .user-name { padding-left: 30rpx; } -.fenlei-list{z-index: -1;} \ No newline at end of file +.fenlei-list{z-index: -1;} + + + + + +/* 商品分类新的版本 */ +/* 分享样式*/ +.xc-search-box { + width: 100%; + height: 120rpx; + z-index: 10; + background: #fff; + border-top: 4rpx solid #eee; + border-bottom: 1rpx solid #eee; + +} + +.share-height{ + line-height: 20rpx; +margin-right: 15rpx; +margin-top: 8rpx; + +} +.scanning_black-img{ + width:50rpx; + height: 45rpx; + margin-bottom: 5rpx; + +} +.search-img.left{ + margin-left: 35rpx; +} + +.xc-search-inner { + display: flex; + align-items: center; + + width: 600rpx; + height: 58rpx; + border-radius: 29rpx; + background-color: #f2f2f2; +} +.project_height{ + height: 90%; + +} +.project_type{ + width: 33%; + height: 100%; + border-right: 1rpx solid #eee; + white-space: nowrap; +overflow: hidden; +overflow-y: scroll; + +} +.share_type{ + margin: auto; + width: 58%; + margin-top: 40rpx; +overflow: hidden; + +} +.xc-letter-spacing{ +padding-left: 29rpx; +padding-right: 29rpx; +width: 51%; +margin: auto; +margin-top: 40rpx; + + +} +.world_sn{ +white-space: nowrap; +overflow: hidden; +width: 58%; +/* letter-spacing: 60rpx; */ +margin: auto; +margin-top: 35rpx; +} +.select_classify{ + background: #d60021; +border-radius: 30rpx; +color: #fff; +height: 48rpx; +line-height: 45rpx; + +} +.select_classify.width80{ + width: 74.5%; +} + .select_classify.width80.text-indent{ + text-indent: 38rpx; + padding-right: 20px; +width: 60%; + + } + .classify_name{ + width: 90%; + margin: auto; + height: 70rpx; + border-bottom: 1rpx solid #eee; + line-height: 85rpx; + font-weight: 600; + + + } + .classify_content{ + width: 67% + + } + .classify_content-frame{ + width: 90%; + margin: auto; + flex-wrap:wrap; + max-height: 90%; + overflow-y:scroll; + overflow: hidden scroll; + padding-bottom: 25rpx; + + + } + .country_img-frame{ + width: 48%; + height: 140rpx; + + } + .country_img{ + width: 100%; + height: 100%; + } + .outer_location{ + top:0rpx; + left: 0rpx; + margin-top: 20rpx; + + } + .nation_box.box{ + top: 16%; +width:80%; +height:70%; +left: 70.5%; +overflow: hidden; + + } + .nt_1.line-height{ + line-height: 65rpx; + height: 72rpx; +margin-top: -5rpx; + + } + .nt_1_t.height{ + height: 54rpx; + } + .nt_1.height{ + height: 56rpx; +line-height: 65rpx; + } + .nt_2.line-height{ + height: 0rpx; + line-height: 0rpx; + + } + .nt_1_t.fs24{ + font-size: 24rpx; + } + .nt_2.fs24{ + font-size: 24rpx; + } + .brand_img_frame{ + width: 45%; + margin-top: 18rpx; + margin-right: 15rpx; + height: 160rpx; + } + .brand_img{ + width:200rpx; + height:86rpx; + margin-bottom: 10rpx; + margin-top: 10rpx; + + } + .type_img_frame{ + width: 30%; + height: 140rpx; + margin-top: 18rpx; + margin-right: 15rpx; + + + } + + + + .type_img{ + width:80rpx; + height:80rpx; + margin-bottom: 10rpx; + margin-top: 10rpx; + + } + .brand_img-name{ + width: 100%; + height: 80rpx; + } + .select_classify.width80.text3{ +padding-right: 20rpx; +padding-left: 20rpx; +width: 62%; + + } + .width_height{ + width: 13rpx; + height: 13rpx; + margin-top:12rpx; + } + .select_more{ +line-height: 37rpx; +height: 35rpx; +margin-top: 24rpx; + } + .divider_line{ + width: 100%; + border-bottom: 6rpx solid #eee; + } + .sort-name{ + width: 132rpx; +overflow: hidden; +margin: auto; + +} + +.nation_z_name{ max-width: 130rpx} +.nation_y_name{ max-width: 130rpx} \ No newline at end of file diff --git a/pages/goods/goodsInfo/goodsInfo.js b/pages/goods/goodsInfo/goodsInfo.js index c5e07d3..216297c 100644 --- a/pages/goods/goodsInfo/goodsInfo.js +++ b/pages/goods/goodsInfo/goodsInfo.js @@ -876,7 +876,7 @@ Page({ // action: "buy_now" // }), s.set_b_now(e); - wx.navigateTo({ + wx.redirectTo({ url: "/pages/cart/cart2/cart2?is_bnow=1&goods_id=" + e.goods_id, }); }, diff --git a/pages/goods/goodsList/goodsList.js b/pages/goods/goodsList/goodsList.js index e629d66..5f6bb82 100644 --- a/pages/goods/goodsList/goodsList.js +++ b/pages/goods/goodsList/goodsList.js @@ -25,18 +25,16 @@ Page({ var url = this.data.baseUrl; this.data.is_new=t.is_new; this.data.is_hot=t.is_hot; - - console.log(t.cat_id); - console.log(t.pid); - - if (0 != t.cat_id && t.cat_id != undefined) { - url += "&cat_id=" + t.cat_id; - if (t.pid == undefined || t.pid == null){ - url += "&parent_id=0"; - }else{ - url += "&parent_id="+t.pid; - } - } + if (0 != t.cat_id && t.cat_id != undefined) { + url += "&cat_id=" + t.cat_id; + if (t.pid == undefined || t.pid == null){ + url += "&parent_id=0"; + }else{ + if(t.pid!="three"){ + url += "&parent_id="+t.pid; + } + } + } if (0 != t.brand_id && t.brand_id != undefined) { url += "&brand_id=" + t.brand_id; } if (0 != t.nation_id && t.nation_id != undefined) { url += "&nation_id=" + t.nation_id; } diff --git a/pages/index/index/index.js b/pages/index/index/index.js index 1bebb37..ee33352 100644 --- a/pages/index/index/index.js +++ b/pages/index/index/index.js @@ -64,22 +64,20 @@ Page({ //看一下商家是否开通了权益 //--初始化是否有打勾-- getApp().request.promiseGet("/api/weshop/users/grade/vip/init/get", { - data: { storeId: os.stoid} + data: { storeId: os.stoid } }).then(res => { - if(res.data.data){ - var is_init=res.data.data.isBool; - th.setData({is_boot:is_init}); + if (res.data.data) { + var is_init = res.data.data.isBool; + th.setData({ is_boot: is_init }); } }) - - }, async onShow() { - var th=this; - + var th = this; + if(getApp().globalData.user_id) getApp().requestCardNum(); await this.init_load(); //显示的时候要开启计时器 this.data.is_timer = 1; diff --git a/pages/payment/pay_success/pay_success.js b/pages/payment/pay_success/pay_success.js new file mode 100644 index 0000000..4f5bb90 --- /dev/null +++ b/pages/payment/pay_success/pay_success.js @@ -0,0 +1,63 @@ +var e = getApp(); +var regeneratorRuntime = require('../../../utils/runtime.js'); +Page({ + /** + * 页面的初始数据 + */ + data: { + url: e.globalData.setting.imghost, + resourceUrl: e.globalData.setting.resourceUrl, + iurl: e.globalData.setting.imghost, + order:null, + type:1, + allmoney:0, + user_money:0, + order_sn:"", + pick:null, + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad:async function(options) { + wx.setNavigationBarTitle({ + title: '支付成功', + }); + + var type=options.type,order_sn=options.order_sn; + var th=this,order=null; + //如果是等1,就是单个订单的订单号 + if(type==1){ + await getApp().request.promiseGet("/api/weshop/order/page", + {data:{store_id:e.globalData.setting.stoid,order_sn:order_sn}}).then(res=>{ + order=res.data.data.pageData[0]; + th.setData({order:order,order_sn:order_sn}) + }) + }else{ + await getApp().request.promiseGet("/api/weshop/order/page", + {data:{store_id:e.globalData.setting.stoid,parent_sn:order_sn}}).then(res=>{ + + var allmoney=0; + for(var i in res.data.data.pageData){ + var item=res.data.data.pageData[i]; + allmoney+=item.order_amount; + user_money += item.user_money; + } + order=res.data.data.pageData[0]; + th.setData({ order: order, type: 2, allmoney: allmoney, order_sn: order_sn, user_money: user_money}) + }) + } + //--获取门店-- + if(order.exp_type==1) { + await getApp().request.promiseGet("/api/weshop/pickup/get/"+ e.globalData.setting.stoid+"/"+order.pickup_id, + {1:1}).then(res => { + th.setData({pick:res.data.data}) + }); + } + }, + + goto: function() { + var url= '/pages/index/index/index'; + getApp().goto(url) + }, +}) \ No newline at end of file diff --git a/pages/payment/pay_success/pay_success.json b/pages/payment/pay_success/pay_success.json new file mode 100644 index 0000000..1111654 --- /dev/null +++ b/pages/payment/pay_success/pay_success.json @@ -0,0 +1,4 @@ +{ + "navigationBarTitleText": "支付成功", + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/payment/pay_success/pay_success.wxml b/pages/payment/pay_success/pay_success.wxml new file mode 100644 index 0000000..878c01c --- /dev/null +++ b/pages/payment/pay_success/pay_success.wxml @@ -0,0 +1,88 @@ + + + + + + + + + + + 订单支付成功! + + + + + + + + 订单编号 : + {{order_sn}} + + + + + + 实付金额 : + + {{filters.toFix(order.order_amount+order.user_money+order.pt_tail_money)}}元 + {{filters.toFix(allmoney+user_money,2) }}元 + + + + + 支付方式 : + 微信支付,余额支付 + 微信支付,余额支付 + 微信支付,余额支付 + 免单 + + + + + + + + + + + + + + 收货人 : + {{order.consignee}} + {{order.mobile}} + + + 收货地址 : + {{order.more_address}} + + + + + + + 门店 : + {{pick.pickup_name}} + + + 门店地址 : + {{pick.pickup_address}} + + + + + + + + 查看订单 + + + + + 回到首页 + + + + + \ No newline at end of file diff --git a/pages/payment/pay_success/pay_success.wxss b/pages/payment/pay_success/pay_success.wxss new file mode 100644 index 0000000..f69e931 --- /dev/null +++ b/pages/payment/pay_success/pay_success.wxss @@ -0,0 +1,84 @@ +page { + border-top: 2rpx solid rgb(245, 245, 245); +} +.line { + border-top: 2rpx solid rgb(245, 245, 245); + width: 700rpx; +} + +.payradio .Success_box { + padding-top: 45rpx; + padding-bottom: 45rpx; +} + +.payradio .Success_box .Success_box_title { + margin-top: 45rpx; + color: rgb(8, 8, 8); +} + +.payradio image { + width: 140rpx; + height: 140rpx; + display: flex; +} + +.payitem_max { + padding: 0rpx 55rpx; + color: rgb(104, 104, 104); + padding-bottom: 30rpx; +} + +.payitem_max .payitem { + margin-top: 30rpx; +} + +.payitem_max .payitem .pay_nam { + width: 200rpx; +} + +.payitem_max .payitem view { + margin-right: 50rpx; +} +.pay_money{ + color: rgb(219, 27, 52); +} + +.pay_User { + padding-left: 55rpx; + color: rgb(104, 104, 104); +} + +.pay_User .payitem { + margin-top: 30rpx; +} + +.pay_User .payitem .pay_Receiving { + width: 128rpx; + margin-right: 50rpx; +} + +.pay_User .payitem .pay_name { + margin-right: 38rpx; + max-width: 250rpx; +} + +.pay_order { + margin-top: 115rpx; + color: rgb(104, 104, 104); + width: 560rpx; + height: 62rpx; + border-radius: 30rpx; + border: 3rpx solid rgb(209, 209, 209); +} + +.pay_home { + margin-top: 35rpx; + color: rgb(255, 255, 255); + width: 566rpx; + height: 68rpx; + border-radius: 30rpx; + background-color: rgb(219, 27, 52); +} +.address{ + width: 470rpx; +} \ No newline at end of file diff --git a/pages/user/address_list/address_list.js b/pages/user/address_list/address_list.js index 8e2a2dd..b5caeec 100644 --- a/pages/user/address_list/address_list.js +++ b/pages/user/address_list/address_list.js @@ -24,10 +24,11 @@ Page({ }); this.data.operate = e.operate; - var is_back=e.is_back; - if (is_back) this.setData({ is_back: is_back}) }, onShow: function () { + var is_back=getApp().globalData.is_cart_old; + if (is_back) this.setData({ is_back: is_back}) + this.data.curpage = 1; this.data.addresses = []; this.requestAddressList(); diff --git a/pages/user/index/index.js b/pages/user/index/index.js index 10bef1e..dce61a6 100644 --- a/pages/user/index/index.js +++ b/pages/user/index/index.js @@ -44,6 +44,7 @@ Page({ var stoid = app_d.setting.stoid; var s = this,th=s,need_money=0,cur_g_num=0; getApp().get_isbuy(th.setappdata); + if(getApp().globalData.user_id) getApp().requestCardNum(); /*------会员登录------*/ app.getUserFir(async function(e){ diff --git a/pages/user/order_list/order_list.js b/pages/user/order_list/order_list.js index 517a8d0..103dd9b 100644 --- a/pages/user/order_list/order_list.js +++ b/pages/user/order_list/order_list.js @@ -1,428 +1,464 @@ var t = function(t) { return t && t.__esModule ? t : { - default: t + default: t }; -}(require("../../../utils/LoadMore.js")), e = getApp(),os=e.globalData.setting,oo=e.globalData, - r = e.request,rq=r, a = require("../../../utils/common.js"), s = new t.default(); + }(require("../../../utils/LoadMore.js")), + e = getApp(), + os = e.globalData.setting, + oo = e.globalData, + r = e.request, + rq = r, + a = require("../../../utils/common.js"), + s = new t.default(); var regeneratorRuntime = require('../../../utils/runtime.js'); Page({ - data: { - url: e.globalData.setting.url, - resourceUrl: e.globalData.setting.imghost, - iurl: e.globalData.setting.imghost, - categories: [ { - name: "全部订单",id: 0 - }, { - name: "待付款",id: 1 - }, { - name: "待发货",id: 2 - }, { - name: "待收货",id: 3 - }, { - name: "待评价",id: 4 - } ], - activeCategoryId: 0, - orderList: null, - currentPage: 1, - - //已经读取过接口 - is_get:0, - conf:null, - }, - onLoad: function(t) { - var th=this; - //var e = void 0 === t.type ? this.data.activeCategoryId : t.type; - if(t.type!=undefined) this.setData({activeCategoryId:t.type}) - s.init(this, "", "orderList"); - //this.requestOrderList(e), wx.removeStorageSync("order:order_list:update"); - getApp().getConfig2(function (e) { - th.setData({conf:e}); - }) - }, - onShow: function() { - //wx.getStorageSync("order:order_list:update") && (wx.setStorageSync("order:order_list:update", !1), - this.resetData(), this.requestOrderList(this.data.activeCategoryId); - }, - changeTab: function(t) { - this.resetData(), this.requestOrderList(t.currentTarget.id); - }, - resetData: function() { - s.resetConfig(), this.data.orderList = null, this.data.currentPage = 1; - }, - - /*---------获取订单列表--------*/ - requestOrderList: function(t) { - var rd=Math.random()*100; - var e = this,th=e, r = e.data.url + "/api/weshop/order/page?rd="+rd, a = ""; - switch(t){ - case "1": - r += "&wait_status=0"; break; - case "2": - r += "&wait_status=1"; break; - case "3": - r += "&wait_status=2";break; - case "4": - r +="&order_status=2"; break; - } + data: { + url: e.globalData.setting.url, + resourceUrl: e.globalData.setting.imghost, + iurl: e.globalData.setting.imghost, + categories: [{ + name: "全部订单", + id: 0 + }, { + name: "待付款", + id: 1 + }, { + name: "待发货", + id: 2 + }, { + name: "待收货", + id: 3 + }, { + name: "待评价", + id: 4 + }], + activeCategoryId: 0, + orderList: null, + currentPage: 1, + //已经读取过接口 + is_get: 0, + conf: null, + iscodeall: null + }, + onLoad: function(t) { + var th = this; + if (t.type != undefined) this.setData({ + activeCategoryId: t.type + }) + s.init(this, "", "orderList"); + getApp().getConfig2(function(e) { + th.setData({ + conf: e + }); + }) + }, + onShow: function() { + this.resetData(), this.requestOrderList(this.data.activeCategoryId); + }, + changeTab: function(t) { + if (this.data.activeCategoryId == t.currentTarget.id) return false; + this.resetData(), this.requestOrderList(t.currentTarget.id); + }, + resetData: function() { + s.resetConfig(), this.data.orderList = null, this.data.currentPage = 1; + }, - this.setData({ activeCategoryId: t }); r = r + "&page=" + e.data.currentPage; - s.request(r, function(t) { - th.setData({is_get:1}); - var data=e.data.orderList; - data.forEach(async function (item,ind){ - var tt =null; - await getApp().request.promiseGet('/api/weshop/ordergoods/list',{ - data: {order_id: item.order_id, store_id:os.stoid,pageSize:600}, - }).then(res=>{ - tt=res; - }) + /*---------获取订单列表--------*/ + requestOrderList: function (t) { + var rd = Math.random() * 100; + var e = this, th = e, r = e.data.url + "/api/weshop/order/page?rd=" + rd, a = ""; + switch (t) { + case "1": + r += "&wait_status=0"; break; + case "2": + r += "&wait_status=1"; break; + case "3": + r += "&wait_status=2"; break; + case "4": + r += "&order_status=2"; break; + } + this.setData({ activeCategoryId: t }); r = r + "&page=" + e.data.currentPage; + s.request(r, function (t) { - //------------对比一下有没有退款记录------------ - await getApp().request.promiseGet("/api/weshop/order/returngoods/page",{ - data: { order_id: item.order_id, store_id: os.stoid, - user_id:oo.user_id, pageSize: 20 } - }).then(rs=>{ - var ttd=rs; - //--看一下订单的总数量-- - var gtype_num = tt.data.data.total; - if(ttd.data.data.pageData == undefined) return false; - var goodslist = tt.data.data.pageData; + th.setData({ is_get: 1 }); + var data = e.data.orderList; + data.forEach(async function (item, ind) { + var tt = null; + await getApp().request.promiseGet('/api/weshop/ordergoods/list', { + data: { order_id: item.order_id, store_id: os.stoid, pageSize: 600 }, + }).then(res => { + tt = res; + }) - //----没有相关的退款记录---- - if (ttd.data.data.total==0){ - data[ind]['is_all_return'] = 0; - goodslist.forEach(function (ee, ii) { - if (data[ind]['order_status'] == 1 && data[ind]['pay_status'] == 1 && gtype_num>1){ + //------------对比一下有没有退款记录------------ + await getApp().request.promiseGet("/api/weshop/order/returngoods/page", { + data: { + order_id: item.order_id, store_id: os.stoid, + user_id: oo.user_id, pageSize: 20 + } + }).then(rs => { + var ttd = rs; + //--看一下订单的总数量-- + var gtype_num = tt.data.data.total; + if (ttd.data.data.pageData == undefined) return false; + var goodslist = tt.data.data.pageData; - //empty($list.coupon_no) && empty($list.order_prom_id) && $list.order_status lt 2 && empty($list.is_prom) - //&& ($tpshop_config['refund_type'] eq 0 || ($tpshop_config['refund_type'] eq 1 && ($list['order_amount'] eq 0 - // || $list['user_money'] eq 0))) - item.goodslist=goodslist; - if(th.check_for_return_btn(item) ) { - goodslist[ii]['return_btn'] = 1; - } - } + //----没有相关的退款记录---- + if (ttd.data.data.total == 0) { + data[ind]['is_all_return'] = 0; + goodslist.forEach(function (ee, ii) { + if (data[ind]['order_status'] == 1 && data[ind]['pay_status'] == 1 && gtype_num > 1) { + item.goodslist = goodslist; + if (th.check_for_return_btn(item)) { + goodslist[ii]['return_btn'] = 1; + } + } - }); - }else{ - //--------整单退-------- - if (ttd.data.data.pageData[0]['goods_id_list'] != null - && ttd.data.data.pageData[0]['goods_id_list'] != ''){ - var eea = ttd.data.data.pageData[0]; - //1.退款正在进行中, - //2.退款被拒绝就要显示可以退款 - //3.退款已经完成 - data[ind]['is_all_return']=1; - data[ind]['is_all_return_status'] = ttd.data.data.pageData[0].status; + }); + } else { + //--------整单退-------- + if (ttd.data.data.pageData[0]['goods_id_list'] != null + && ttd.data.data.pageData[0]['goods_id_list'] != '') { + var eea = ttd.data.data.pageData[0]; + //1.退款正在进行中, + //2.退款被拒绝就要显示可以退款 + //3.退款已经完成 + data[ind]['is_all_return'] = 1; + data[ind]['is_all_return_status'] = ttd.data.data.pageData[0].status; - if (data[ind]['order_status'] == 1 && data[ind]['pay_status'] == 1) { - switch (eea.status) { - case 0: - case 1: - data[ind]['return_btn'] = 2; break; - case 2: - data[ind]['return_btn'] = 4; break; - case 3: - data[ind]['return_btn'] = 3; break; - default: - data[ind]['return_btn'] = 0; - } - } - }else{ - //1.退款正在进行中, - //2.退款被拒绝就要显示可以退款 - //3.退款已经完成 - data[ind]['is_all_return'] = 0; - var rt_ok_num=0; + if (data[ind]['order_status'] == 1 && data[ind]['pay_status'] == 1) { + switch (eea.status) { + case 0: + case 1: + data[ind]['return_btn'] = 2; break; + case 2: + data[ind]['return_btn'] = 4; break; + case 3: + data[ind]['return_btn'] = 3; break; + default: + data[ind]['return_btn'] = 0; + } + } + } else { + //1.退款正在进行中, + //2.退款被拒绝就要显示可以退款 + //3.退款已经完成 + data[ind]['is_all_return'] = 0; + var rt_ok_num = 0; + //if(data[ind]['order_status'] == 1 && data[ind]['pay_status'] == 1) { + goodslist.forEach(function (eeb, iii) { + if (data[ind]['order_status'] == 1 && data[ind]['pay_status'] == 1) + goodslist[iii]['return_btn'] = 1; //申请退款 + ttd.data.data.pageData.forEach(function (eea, ii) { + var st = eea.status; + if (eea.goods_id == eeb.goods_id) { + switch (eea.status) { + case 0: + case 1://退款处理中 + data[ind]['has_rt'] = 1; //有部分退 + goodslist[iii]['return_btn'] = 2; break; + case 2://退款完成 + goodslist[iii]['return_btn'] = 4; rt_ok_num++; break; + case 3://已拒绝,重新退款 + goodslist[iii]['return_btn'] = 3; break; + default: + if (data[ind]['order_status'] == 1 && data[ind]['pay_status'] == 1) + goodslist[iii]['return_btn'] = 1; //申请退款 + } + return; + } + }); + }); + //} + } + } - //if(data[ind]['order_status'] == 1 && data[ind]['pay_status'] == 1) { - goodslist.forEach(function (eeb, iii) { - if(data[ind]['order_status'] == 1 && data[ind]['pay_status'] == 1) - goodslist[iii]['return_btn'] = 1; //申请退款 - ttd.data.data.pageData.forEach(function (eea, ii) { - var st = eea.status; - if (eea.goods_id == eeb.goods_id){ - switch (eea.status){ - case 0: - case 1://退款处理中 - data[ind]['has_rt'] = 1; //有部分退 - goodslist[iii]['return_btn'] = 2; break; - case 2://退款完成 - goodslist[iii]['return_btn'] = 4; rt_ok_num++; break; - case 3://已拒绝,重新退款 - goodslist[iii]['return_btn'] = 3; break; - default: - if(data[ind]['order_status'] == 1 && data[ind]['pay_status'] == 1) - goodslist[iii]['return_btn'] = 1; //申请退款 - } - return; - } - }); - }); - //} - } - } + //--如果是全部退款,也就可以删除-- + if (rt_ok_num == goodslist.length) { + data[ind]['is_all_return_status'] = 2; + } - //--如果是全部退款,也就可以删除-- - if(rt_ok_num==goodslist.length){ - data[ind]['is_all_return_status']=2; - } - - data[ind]['order_goods'] = goodslist; - var g_num = 0; - goodslist.forEach(function (ee, ii) { - if(ee.return_btn!=4) - g_num += ee.goods_num; - }); - data[ind]['g_num'] = g_num; - }) - th.setData({ orderList: data, }); - }); - e.data.currentPage++, - /*--- - t.data.result.forEach(function(t, e, r) { - t.goods_sum = t.order_goods.reduce(function(t, e) { - return t + e.goods_num; - }, 0); - }),---*/ - wx.stopPullDownRefresh(); - },null,{store_id:os.stoid,user_id:oo.user_id}); - }, - onReachBottom: function() { - s.canloadMore() && this.requestOrderList(this.data.activeCategoryId); - }, - onPullDownRefresh: function(t) { - this.resetData(), this.requestOrderList(this.data.activeCategoryId); - }, + data[ind]['order_goods'] = goodslist; + var g_num = 0; + goodslist.forEach(function (ee, ii) { + if (ee.return_btn != 4) + g_num += ee.goods_num; + }); + data[ind]['g_num'] = g_num; + }) + th.setData({ orderList: data, }); - /*-----------取消订单-----------*/ - cancelOrder: function(t) { - var e = this, a = t.currentTarget.dataset.id,th=this; - var is_zsorder= parseFloat(t.currentTarget.dataset.zsorder); - var index=t.currentTarget.dataset.orderindex; - var order=th.data.orderList[index]; - var is_skill=0; - var order_goods=order.order_goods; - //--判断是不是秒杀-- - order_goods.forEach(function (val,ind) { - if(val.prom_type==1){ - is_skill=1; return false; - } + }); + e.data.currentPage++ , + wx.stopPullDownRefresh(); + }, null, { store_id: os.stoid, user_id: oo.user_id }); + }, + //滑倒底部 + onReachBottom: function() { + if (s.data.goodsLoadFinishFlag) { + this.setData({ + iscodeall: 1 }) + } + s.canloadMore() && this.requestOrderList(this.data.activeCategoryId); + }, + onPullDownRefresh: function(t) { + this.resetData(), this.requestOrderList(this.data.activeCategoryId); + }, + + /*-----------取消订单-----------*/ + cancelOrder: function(t) { + var e = this, + a = t.currentTarget.dataset.id, + th = this; + var is_zsorder = parseFloat(t.currentTarget.dataset.zsorder); + var index = t.currentTarget.dataset.orderindex; + var order = th.data.orderList[index]; + var is_skill = 0; + var order_goods = order.order_goods; + //--判断是不是秒杀-- + order_goods.forEach(function(val, ind) { + if (val.prom_type == 1) { + is_skill = 1; + return false; + } + }) - wx.showModal({ - title: "是否取消订单?", + wx.showModal({ + title: "是否取消订单?", + success: function(t) { + //如果是秒杀和拼单的商品,取消订单要返回redis,并取消订单 + if (t.confirm) { + //if(is_skill==1 || is_zsorder>=2){ + getApp().request.delete("/api/weshop/order/cancelTeamOrder/" + os.stoid + "/" + a, { + data: {}, success: function(t) { - //如果是秒杀和拼单的商品,取消订单要返回redis,并取消订单 - if(t.confirm){ - //if(is_skill==1 || is_zsorder>=2){ - getApp().request.delete("/api/weshop/order/cancelTeamOrder/"+os.stoid+"/"+a,{ - data:{}, - success: function(t) { - if(t.data.code==0) - { - 0 == e.data.activeCategoryId ? - (e.resetData(), e.requestOrderList(e.data.activeCategoryId)) : e.deleteOrderData2(a); - } - else - { - getApp().confirmBox(e.data.msg); - } - }, - }) - } + if (t.data.code == 0) { + 0 == e.data.activeCategoryId ? + (e.resetData(), e.requestOrderList(e.data.activeCategoryId)) : e.deleteOrderData2(a); + } else { + getApp().confirmBox(e.data.msg); + } + }, + }) + } + } + }); + }, + + /*-----------确认收货-----------*/ + confirmOrder: function(t) { + var e = this, + a = t.currentTarget.dataset.id; + var is_zsorder = t.currentTarget.dataset.zsorder; + var th = this; + + wx.showModal({ + title: "是否确认收货?", + success: function(t) { + t.confirm && rq.put("/api/weshop/order/updatebyId", { + data: { + order_id: a, + order_status: 2 + }, + success: function(t) { + e.deleteOrderData2(a); + //如果是会员团订单 + if (is_zsorder == 3) { + getApp().request.post("/api/weshop/order/vipTuanTebate/" + os.stoid + "/" + a, { + data: {}, + success: function() {} + }) } + } }); - }, - - /*-----------确认收货-----------*/ - confirmOrder: function(t) { - var e = this, a = t.currentTarget.dataset.id; - var is_zsorder=t.currentTarget.dataset.zsorder; - var th=this; + } + }); + }, - wx.showModal({ - title: "是否确认收货?", - success: function(t) { - t.confirm && rq.put("/api/weshop/order/updatebyId", { - data: { - order_id: a,order_status:2 - }, - success: function(t) { - e.deleteOrderData2(a); - //如果是会员团订单 - if(is_zsorder==3){ - getApp().request.post("/api/weshop/order/vipTuanTebate/"+os.stoid+"/"+a,{ - data:{}, success:function () { }}) - } - } + //-----删除订单----- + deleteOrderData: function(t) { + var th = this; + var order_id = t.currentTarget.dataset.order_id; + wx.showModal({ + title: "是否删除订单?", + success: function(tt) { + tt.confirm && rq.put("/api/weshop/order/updatebyId", { + data: { + order_id: order_id, + order_status: 5 + }, + success: function(t) { + for (var e = 0; e < th.data.orderList.length; e++) + if (th.data.orderList[e].order_id == order_id) { + th.data.orderList.splice(e, 1), th.setData({ + orderList: th.data.orderList }); - } - }); - }, + break; + } + } + }) + } + }); + }, - //-----删除订单----- - deleteOrderData: function(t) { - var th=this; - var order_id=t.currentTarget.dataset.order_id; - wx.showModal({ - title: "是否删除订单?", - success: function(tt) { - tt.confirm && rq.put("/api/weshop/order/updatebyId", { - data: { - order_id: order_id, order_status: 5 - }, - success: function (t) { - for (var e = 0; e < th.data.orderList.length; e++) if (th.data.orderList[e].order_id == order_id) { - th.data.orderList.splice(e, 1), th.setData({ - orderList: this.data.orderList - }); - break; - } - } - }) - } + deleteOrderData2: function(order_id) { + var th = this; + for (var e = 0; e < th.data.orderList.length; e++) + if (th.data.orderList[e].order_id == order_id) { + th.data.orderList.splice(e, 1), th.setData({ + orderList: this.data.orderList }); - }, + break; + } + }, - deleteOrderData2:function(order_id){ - var th=this; - for (var e = 0; e < th.data.orderList.length; e++) if (th.data.orderList[e].order_id == order_id) { - th.data.orderList.splice(e, 1), th.setData({ - orderList: this.data.orderList + //---判断是不是有退款----- + checkReturnGoodsStatus: function(t) { + var e = t.currentTarget.dataset.recid; + var oid = t.currentTarget.dataset.oid; + r.get("/api/weshop/order/returngoods/page", { + data: { + goods_id: e, + order_id: oid, + store_id: os.stoid + }, + success: function(t) { + if (t.data.code == 0) { + var r = t.data.data.total; + if (0 == r) return wx.navigateTo({ + url: "/pages/user/return_goods/return_goods?rec_id=" + e + "&order_id=" + oid, + }); + //--如果拒绝,就重新申请退款-- + if (t.data.data.pageData[0].status == 3) { + return wx.navigateTo({ + url: "/pages/user/return_goods/return_goods?rec_id=" + e + "&order_id=" + oid, }); - break; - } - }, - - //---判断是不是有退款----- - checkReturnGoodsStatus: function(t) { - var e = t.currentTarget.dataset.recid; - var oid = t.currentTarget.dataset.oid; - r.get("/api/weshop/order/returngoods/page", { - data: { - goods_id: e, - order_id:oid, - store_id:os.stoid - }, - success: function(t) { - if(t.data.code==0){ - var r = t.data.data.total; - if (0 == r) return wx.navigateTo({ - url: "/pages/user/return_goods/return_goods?rec_id=" + e + "&order_id=" + oid, - }); - //--如果拒绝,就重新申请退款-- - if (t.data.data.pageData[0].status==3){ - return wx.navigateTo({ - url: "/pages/user/return_goods/return_goods?rec_id=" + e + "&order_id=" + oid, - }); - } + } - wx.navigateTo({ - url: "/pages/user/return_goods_info/return_goods_info?id=" + r - }); - } - } - }); - }, + wx.navigateTo({ + url: "/pages/user/return_goods_info/return_goods_info?id=" + r + }); + } + } + }); + }, - /*----------跳转支付-----------*/ - jumpToCart4: function(t) { - var o_index=t.currentTarget.dataset.idx; - var e = this.data.orderList[t.currentTarget.dataset.idx]; - var th=this; + /*----------跳转支付-----------*/ + jumpToCart4: function(t) { + var o_index = t.currentTarget.dataset.idx; + var e = this.data.orderList[t.currentTarget.dataset.idx]; + var th = this; - console.log("jumpToCart4"); - console.log(e); + console.log("jumpToCart4"); + console.log(e); - if(e.order_amount==0){ - var dd = { - parent_sn: e.order_sn, - store_id: e.store_id, - type: 1, - }; - getApp().request.post("/api/weshop/order/pay/createOrder", { - data: dd, - success: function (t) { - if(t.data.code==0){ - th.onload(); - }else{ - getApp().confirmBox(t.data.msg+"请您取消该订单"); - } - } - }) - return false; + if (e.order_amount == 0) { + var dd = { + parent_sn: e.order_sn, + store_id: e.store_id, + type: 1, + }; + getApp().request.post("/api/weshop/order/pay/createOrder", { + data: dd, + success: function(t) { + if (t.data.code == 0) { + th.onload(); + } else { + getApp().confirmBox(t.data.msg + "请您取消该订单"); + } } + }) + return false; + } - a.jumpToCart4({ - order_sn: e.order_sn, - order_amount: e.order_amount, - type:1//正常单 - }); - }, - - //------图片失败,默认图片--------- - bind_bnerr: function (e) { - var _errImg = e.target.dataset.errorimg; - var _errObj = {}; - _errObj[_errImg] = "public/images/default_goods_image_240.gif"; - this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; - }, + a.jumpToCart4({ + order_sn: e.order_sn, + order_amount: e.order_amount, + type: 1 //正常单 + }); + }, - //--------跳转到退款详情----------- - gotoreturn:function(t){ - var e = t.currentTarget.dataset.recid; - var oid = t.currentTarget.dataset.oid; - var wh=""; - if(e!=undefined && e!=null && e!=""){ - wh="&goods_id="+e; - } - wx.navigateTo({ - url: "/pages/user/return_goods_info/return_goods_info?order_id=" + oid+wh, - }); - }, + //------图片失败,默认图片--------- + bind_bnerr: function(e) { + var _errImg = e.currentTarget.dataset.errorimg; + var _errObj = {}; + _errObj[_errImg] = "public/images/default_goods_image_240.gif"; + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; + }, - //-----支付尾款------ - pay_wk:function (ee) { - console.log("pay_wk"); - var order_id=ee.currentTarget.dataset.order_id; - wx.navigateTo({ - url: "/pages/cart/cart_wk/cart_wk?order_id=" + order_id, - }); + //--------跳转到退款详情----------- + gotoreturn: function(t) { + var e = t.currentTarget.dataset.recid; + var oid = t.currentTarget.dataset.oid; + var wh = ""; + if (e != undefined && e != null && e != "") { + wh = "&goods_id=" + e; + } + wx.navigateTo({ + url: "/pages/user/return_goods_info/return_goods_info?order_id=" + oid + wh, + }); + }, - }, - - //--判断是不是可以单个商品退-- - check_for_return_btn:function (item) { - if(item.coupon_no) return false; //有用优惠券 - if(item.order_prom_id) return false; //有订单优惠 - if(item.order_status>=2) return false; //订单状态>2 - var istrue=true; - //----判断是不是有优惠活动和赠送商品---- - for (var g in item.goodslist) { - var g_item=item.goodslist[g]; - if ((g_item.prom_type == 3 && g_item.discount_amount> 0) - || (g_item.prom_type== 3 && g_item.goods_price <= 0) - ) { - istrue=false; break - } - if (g_item.prom_type== 5) { - istrue=false; break - } - } - if(!istrue) return false; - var conf=this.data.conf; - //判断是不是原路退回 - if(conf.refund_type==1) return true; - else{ - if(item.order_amount==0 || item.user_money==0) return true; - } - return false; - } + //-----支付尾款------ + pay_wk: function(ee) { + console.log("pay_wk"); + var order_id = ee.currentTarget.dataset.order_id; + wx.navigateTo({ + url: "/pages/cart/cart_wk/cart_wk?order_id=" + order_id, + }); + }, + //--判断是不是可以单个商品退-- + check_for_return_btn: function(item) { + if (item.coupon_no) return false; //有用优惠券 + if (item.order_prom_id) return false; //有订单优惠 + if (item.order_status >= 2) return false; //订单状态>2 + var istrue = true; + //----判断是不是有优惠活动和赠送商品---- + for (var g in item.goodslist) { + var g_item = item.goodslist[g]; + if ((g_item.prom_type == 3 && g_item.discount_amount > 0) || + (g_item.prom_type == 3 && g_item.goods_price <= 0) + ) { + istrue = false; + break + } + if (g_item.prom_type == 5) { + istrue = false; + break + } + } + if (!istrue) return false; + var conf = this.data.conf; + //判断是不是原路退回 + if (conf.refund_type == 1) return true; + else { + if (item.order_amount == 0 || item.user_money == 0) return true; + } + return false; + }, + //跳到首页 + goto: function(e) { + wx.switchTab({ + url: '/pages/index/index/index', + }) + }, + //显示核销码 + code_show: function(e) { + var th = this; + //--获取成功的时候-- + var no = e.currentTarget.dataset.order_sn; + var qc_com = th.selectComponent("#qc_com"); //组件的id + var obj = { + val: no, + content: "请将二维码展示给核销员,收货更快捷" + }; + qc_com.open(obj) + } }); \ No newline at end of file diff --git a/pages/user/order_list/order_list.json b/pages/user/order_list/order_list.json index ee9be96..264bda9 100644 --- a/pages/user/order_list/order_list.json +++ b/pages/user/order_list/order_list.json @@ -1,3 +1,6 @@ { - "navigationBarTitleText": "我的订单" + "navigationBarTitleText": "我的订单", + "usingComponents": { + "qr_code": "/components/qr_code/qr_code" + } } \ 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 7fa46a4..7c0661e 100644 --- a/pages/user/order_list/order_list.wxml +++ b/pages/user/order_list/order_list.wxml @@ -1,110 +1,179 @@ - - - - {{item.name}} - - + + + + {{item.name}} + - - - - - 订单编号:{{item.order_sn}} - {{item.order_status_detail}} - - + + + - - - - - - {{goods.goods_name}} - {{goods.goods_color}} {{goods.goods_spec}} - ¥ {{goods.member_goods_price}} - 数量 {{goods.goods_num}} - + + + + 订单编号:{{item.order_sn}} + + + + 组团中 + 未支付 + + 待发货 + 待收货 + 待评价 + 已评价 + 已取消 + 待支付尾款 + 退款成功 + 支付尾款失败 + + 退款中 + + + + + + + + + + + + + + + 秒杀 + 团购 + + + + + + {{goods.goods_name}} + + + + {{goods.goods_color+"/"+goods.goods_spec}} + {{goods.goods_color==undefined?"":goods.goods_color}}{{goods.goods_spec==undefined?"":goods.goods_spec}} + 规格1 + + - 申请退款 - 退款中 - 重新退款 - 退款完成 - - - - 组团中 - - - 待支付尾款 + 申请退款 + 退款中 + 重新退款 + 退款完成 + + + + + + + + + {{filters.toFix(goods.member_goods_price,2)}} + x{{goods.goods_num}} + + + + + + + + + + 共{{item.g_num}}件商品 + + + + + 合计: + + {{filters.toFix(item.order_amount+item.user_money+item.pt_tail_money,2)}} + - - - 共{{item.g_num}}件, - - 金额:¥{{filters.toFix(item.order_amount+item.user_money+item.pt_tail_money,2)}} - - - 定金:¥{{filters.toFix(item.order_amount+item.user_money,2)}} - 金额:¥{{filters.toFix(item.order_amount+item.user_money,2)}} - 尾款:¥{{filters.toFix(item.pt_tail_money-item.shipping_price,2)}} - - - - + + + + 定金: + + {{filters.toFix(item.order_amount+item.user_money,2)}} + + + + 合计: + + {{filters.toFix(item.order_amount+item.user_money,2)}} + + + + 待支付尾款: + + {{filters.toFix(item.pt_tail_money-item.shipping_price,2)}} + + + + + + + - - 支付尾款 - - 已取消 - - 拼团失败 - - - - - - - - 删除订单 - 重新退款 - 退款详情 - - - - - - - - - - - 订单详情 - + 已取消 + 取消订单 + 拼团失败 + + + + + + + 删除订单 + 重新退款 + 退款详情 + + + + 订单详情 + + + + + + 支付尾款 + 立即支付 - - - 暂无订单列表 - 去逛逛 - + + + + + + + + 到底了 + + + + + + + + + 当前暂无订单 + + + 去首页逛逛 + + + + \ No newline at end of file diff --git a/pages/user/order_list/order_list.wxss b/pages/user/order_list/order_list.wxss index a286061..c5f5be2 100644 --- a/pages/user/order_list/order_list.wxss +++ b/pages/user/order_list/order_list.wxss @@ -1,150 +1,372 @@ +page { + font-family: microsoft yahei; +} + .type-navbar { - white-space: nowrap; - display: flex; - width: 100%; - height: 80rpx; - background-color: #fff; + white-space: nowrap; + display: flex; + height: 88rpx; + background-color: #fff; + justify-content: space-between; + border-top: 1rpx solid rgb(211, 211, 211); } .type-box { - width: 25%; - box-sizing: border-box; - font-size: 32rpx; - line-height: 76rpx; - padding: 0 20rpx; - text-align: center; - display: inline-block; - overflow: hidden; + box-sizing: border-box; + line-height: 84rpx; + text-align: center; + display: inline-block; + overflow: hidden; } .type-navbar-item { - border-bottom: 4rpx solid #fff; + border-bottom: 4rpx solid #fff; } .type-item-on { - border-bottom: 4rpx solid #e64340; + border-bottom: 4rpx solid #e64340; } +/* 原 */ + .goods-container { - display: flex; - justify-content: space-between; - flex-wrap: wrap; - box-sizing: content-box; - padding: 20rpx 0; + display: flex; + justify-content: space-between; + flex-wrap: wrap; + box-sizing: content-box; + padding: 20rpx 0; } .goods-box { - width: 100%; - background-color: #fff; - padding: 0 25rpx; - margin-bottom: 20rpx; - font-size: 28rpx; - border-bottom: 1rpx solid #eee; - padding-bottom: 25rpx; - + width: 100%; + background-color: #fff; + padding: 0 25rpx; + margin-bottom: 20rpx; + font-size: 28rpx; + border-bottom: 1rpx solid #eee; + padding-bottom: 25rpx; } .goods-title { - display: flex; - justify-content: space-between; - align-items: center; - height: 100rpx; + display: flex; + justify-content: space-between; + align-items: center; + height: 100rpx; } .order-number { - font-size: 32rpx; - color: #666; + font-size: 32rpx; + color: #666; } .pay-status { - color: #f23030; + color: #f23030; } .goods-cont { - padding: 20rpx 0; - display: flex; - justify-content: space-between; - position: relative; + padding: 20rpx 0; + display: flex; + justify-content: space-between; + position: relative; } .img-box { - width: 180rpx; - height: 180rpx; + width: 180rpx; + height: 180rpx; } .goods-mes { - width: 490rpx; + width: 490rpx; } .goods-name { - height: 30rpx; - margin-bottom: 16rpx; - overflow: hidden; - line-height: 30rpx; - color: #333; - word-break: keep-all; - white-space: nowrap; - text-overflow: ellipsis; - font-size: 30rpx; + height: 30rpx; + margin-bottom: 16rpx; + overflow: hidden; + line-height: 30rpx; + color: #333; + word-break: keep-all; + white-space: nowrap; + text-overflow: ellipsis; + font-size: 30rpx; } .goods-price { - color: #f23030; - padding-bottom: 20rpx; - font-size: 30rpx; + color: #f23030; + padding-bottom: 20rpx; + font-size: 30rpx; } .goods-num { - color: #999999; - font-size: 30rpx; -} - -.return-btn { - color: #999999; - position: absolute; - right: 0; - bottom: 0rpx; - height: 80rpx; - line-height: 80rpx; + color: #999; + font-size: 30rpx; } .goods-tips { - height: 60rpx; - padding: 10rpx 0; - display: flex; - justify-content: space-between; - align-items: center; + height: 60rpx; + padding: 10rpx 0; + display: flex; + justify-content: space-between; + align-items: center; } .order-total { - display: flex; - justify-content: flex-start; - font-size: 31rpx; - color: #333; + display: flex; + justify-content: flex-start; } .goods-total { - margin-right: 20rpx; - color: #f23030; + margin-right: 20rpx; } .order-btn { - width: 150rpx; - height: 50rpx; - line-height: 50rpx; - text-align: center; - border: 1px solid #eee; - margin-left: 10rpx; - float: right; - border-radius: 15rpx; + width: 150rpx; + height: 50rpx; + line-height: 50rpx; + text-align: center; + border: 1px solid #eee; + margin-left: 10rpx; + float: right; + border-radius: 15rpx; } .order-btn-pay { - color: #fff; - background-color: #f23030; - border-color: #f23030; + color: #fff; + background-color: #f23030; + border-color: #f23030; +} + +.return-btn.co-red { + color: #e02e24; } -.return-btn.co-red{color: #e02e24} -.check-btn{ + +.check-btn { margin-bottom: 20rpx; +} + +/* 新 */ + +.Commodity_number { + height: 80rpx; + border-top: 13rpx solid rgb(245, 245, 245); +} + +.Commodity_number .lin { + border-left: 2rpx solid rgb(129, 65, 81); + margin: 0rpx 15rpx; + height: 31rpx; +} + +.Commodity_number image { + width: 30rpx; + height: 32rpx; +} + +.padding { + padding: 0rpx 27rpx; +} + +/* 文字基线对齐 */ + +.baseline { + align-items: baseline; +} + +.border_bottom { + border-bottom: 4rpx solid rgb(245, 245, 245); +} + +/* 单个商品框架 */ + +.detail_commodity { + height: 231rpx; +} + +.detail_commodity image { + width: 185rpx; + height: 185rpx; +} + +.detail_commodity .goods_name { + width: 485rpx; + /* height: 75rpx; */ + line-height: 37rpx; +} + +.Commodity_content { + height: 185rpx; + margin-left: 21rpx; +} + +.Commodity_content .Commodity_goods { + height: 150rpx; +} + +.Commodity_content .Commodity_money { + font-size: 16rpx; + letter-spacing: 1rpx; +} + +/* 商品评价按钮框架 */ + +.commodity_evaluate { + padding-top: 15rpx; + padding-bottom: 15rpx; + border-bottom: 4rpx solid rgb(245, 245, 245); +} + +.commodity_evaluate .commodity_smy .commodity_money { + margin-left: 29rpx; + letter-spacing: 1rpx; +} + +.commodity_evaluate .links { + height: 92rpx; +} + +.commodity_evaluate .commodity_To_evaluate { + width: 155rpx; + height: 48rpx; + border-radius: 10rpx; + line-height: 48rpx; +} + +.commodity_evaluate .commodity_To_evaluate view { + height: 39rpx; + line-height: 39rpx; +} + +.commodity_evaluate .comment_go { + background-color: rgb(211, 28, 52); + color: rgb(255, 255, 255); + margin-left: 18rpx; + width: 155rpx; + height: 48rpx; + line-height: 48rpx; +} + +.Commodity_spec { + height: 37rpx; + line-height: 37rpx; + max-width: 160rpx; + background-color: rgb(236, 236, 236); + border-radius: 6rpx; + font-size: 22rpx; + margin-top: 10rpx; + padding:0rpx 10rpx; +} + +.Commodity_evaluation .Comment_content { + color: rgb(153, 153, 153); + letter-spacing: 1rpx; +} + +.Commodity_evaluation .starss { + height: 58rpx; + /* // line-height: 58rpx; */ + align-items: center; +} + +.Commodity_evaluation .commen { + height: 58rpx; + line-height: 58rpx; +} + +.Commodity_evaluation .starss .stars { + line-height: 58rpx; +} + +.Commodity_evaluation .starss .stars image { + width: 29rpx; + height: 26rpx; + margin-right: 5rpx; +} + +.Commodity_evaluation .Comment_images image { + width: 100rpx; + height: 100rpx; + margin-right: 8rpx; + margin-top: 18rpx; + border-radius: 6rpx; + border: 3rpx solid rgb(245, 245, 245); +} + +.commodity_evaluate .View_evaluation { + border: 1px solid #ddd; + color: rgb(0, 0, 0); + background-color: rgb(255, 255, 255); + margin-left: 18rpx; +} + +.comment_addtime { + height: 50rpx; +} + +.title_width { + width: 146rpx; + text-align: center; +} + +.After_all { + height: 80rpx; + background-color: rgb(245, 245, 245); +} + +.After_all .Line { + border-top: 1rpx solid rgb(0, 0, 0); + width: 130rpx; +} + +.After_all .end { + margin: 0rpx 15rpx; +} + +/* 无订单 */ + +.empty_order image { + width: 329rpx; + height: 229rpx; + margin-top: 202rpx; +} + +.empty_order .xc-ash { + margin-top: 10rpx; + font-weight: 600px; +} + +.empty_order navigator { + margin-top: 60rpx; + border-radius: 40rpx; +} + +.empty_order navigator view { + width: 247rpx; + height: 56rpx; + background-color: rgb(255, 72, 72); + border-radius: 40rpx; +} + +.rel { + width: 185rpx; + height: 185rpx; + overflow: hidden; + border: 2rpx solid rgb(236, 236, 236); +} + +.abs { + top: 15rpx; + left: -39rpx; + width: 154rpx; + height: 40rpx; + background-color: rgb(214, 1, 33); + transform: rotate(320deg); + color: rgb(255, 255, 255); + line-height: 40rpx; +} +.code{ + width: 55rpx; + height: 55rpx; +} +.refund{ + margin-top: 20rpx; } \ No newline at end of file