From 6539c9b3a458c53aa58e591e97cf88831ddd3e69 Mon Sep 17 00:00:00 2001 From: yvan.ni <765199919@qq.com> Date: Wed, 9 Oct 2019 19:40:53 +0800 Subject: [PATCH] 购物车批量删除的接口联通, 我的订单界面的完成 --- pages/cart/cart/cart.js | 27 +++++++++++++++++---------- pages/cart/cart/cart.wxml | 8 ++++---- pages/cart/cart/cart.wxss | 10 +++------- pages/user/order_list/order_list.js | 764 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- pages/user/order_list/order_list.json | 5 ++++- pages/user/order_list/order_list.wxml | 252 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------------------- pages/user/order_list/order_list.wxss | 400 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------------------- 7 files changed, 931 insertions(+), 535 deletions(-) diff --git a/pages/cart/cart/cart.js b/pages/cart/cart/cart.js index 11ef20b..32e07b0 100644 --- a/pages/cart/cart/cart.js +++ b/pages/cart/cart/cart.js @@ -20,6 +20,7 @@ Page({ is_has_flash:0, //是否又秒杀活动 is_edit:0, //是否编辑 is_load:0, //是否已加载 + up_dating:0 //更新中 }, onLoad: function() { wx.setNavigationBarTitle({title: "购物车", }) @@ -172,6 +173,10 @@ Page({ //-------------加数量--------------------- 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]; @@ -185,6 +190,11 @@ Page({ }; isShowLoading: 0; this.postCardList(e, t.currentTarget.dataset.item, t.currentTarget.dataset.pitems); + }else{ + wx.showModal({ + title: '提示', + content: '购买的数量不能超出库存数量', + }); } }, //-------------减数量--------------------- @@ -390,6 +400,7 @@ Page({ var goodsinfo = e.data.requestData[pitem].goods[item]; var promgoodsbuynum = 0; var goodsbuynum = 0; + //--要获得商品,该用户买了多少件,同步应用-- await getApp().request.promiseGet("/api/weshop/ordergoods/getUserBuyGoodsNum", { data: { @@ -492,8 +503,10 @@ Page({ var e = this; getApp().request.put("/api/weshop/cart/update", { data: t, + isShowLoading:0, success: function(ee) { var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num"; + e.data.up_dating=0 e.setData({ [txt]: t.goods_num, }); @@ -725,25 +738,19 @@ Page({ 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].i_arr[j].id + ","; + glist += i_arr[j].id + ","; ab = 1; } } } - if (ab == 0) { - t.my_warnning("未选择商品", 0, th);return false; - } - + if (ab == 0) { t.my_warnning("未选择商品", 0, th);return false; } glist = glist.substring(0, glist.length - 1); //要删除购物车中的商品 - var url = '/api/weshop/cart/del/' + oo.stoid + '/' + glist; + var url = '/api/weshop/cart/delIds/' + oo.stoid + '/' +user_id+"/"+ glist; getApp().request.delete(url, { - success: function(t) { - th.getCardList(); - } + success: function(t) { th.getCardList();} }); - } }); \ No newline at end of file diff --git a/pages/cart/cart/cart.wxml b/pages/cart/cart/cart.wxml index 6402813..0b82851 100644 --- a/pages/cart/cart/cart.wxml +++ b/pages/cart/cart/cart.wxml @@ -24,7 +24,7 @@ checked="{{checkAllToggle||item.selected}}" data-pitems="{{pidx}}"> - {{item.pname}} + {{item.pname}} @@ -39,11 +39,11 @@ - {{items.goods_name}} + {{items.goods_name}} - + {{items.goods_color}}{{items.goods_color?"/":''}}{{items.goods_spec}} - 规格1 + 规格1 diff --git a/pages/cart/cart/cart.wxss b/pages/cart/cart/cart.wxss index e315198..a8f033e 100644 --- a/pages/cart/cart/cart.wxss +++ b/pages/cart/cart/cart.wxss @@ -202,13 +202,9 @@ radio { margin-top: 26rpx; } -.shmd { - margin-left: 5rpx; -} +.shmd { margin-left: 5rpx;} -.store { - border-top: 7rpx solid rgb(245, 245, 245); -} +.store{ border-top: 7rpx solid rgb(245, 245, 245);} .login-in .Storenum { height: 80rpx; @@ -231,7 +227,7 @@ radio { .Specifications { padding: 3rpx 5rpx; margin-top: 8rpx; - font-size: 20rpx; + font-size: 22rpx; max-width: 105rpx; height: 30rpx; line-height: 29rpx; diff --git a/pages/user/order_list/order_list.js b/pages/user/order_list/order_list.js index 310ecec..7a5aa92 100644 --- a/pages/user/order_list/order_list.js +++ b/pages/user/order_list/order_list.js @@ -1,371 +1,465 @@ 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, + 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, - }, - onLoad: function(t) { - //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"); - }, - 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; - } - this.setData({ activeCategoryId: t }); r = r + "&page=" + e.data.currentPage; - s.request(r, function(t) { + //已经读取过接口 + 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; + }, - 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; + } - //------------对比一下有没有退款记录------------ - 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; - //----没有相关的退款记录---- - 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) - 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; + this.setData({ activeCategoryId: t }); r = r + "&page=" + e.data.currentPage; + s.request(r, function (t) { - 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; + 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(data[ind]['order_status'] == 1 && data[ind]['pay_status'] == 1) { - goodslist.forEach(function (eeb, iii) { - goodslist[iii]['return_btn'] = 1; - ttd.data.data.pageData.forEach(function (eea, ii) { - var st = eea.status; - if (eea.goods_id == eeb.goods_id){ - data[ind]['has_rt'] = 1; //有部分退 - switch (eea.status){ - case 0: - case 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: - goodslist[iii]['return_btn'] = 1; //申请退款 - } - return; - } - }); - }); - } - } - } + //------------对比一下有没有退款记录------------ + 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; - //--如果是全部退款,也就可以删除-- - 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, }); + //----没有相关的退款记录---- + 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; + } + } }); - 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); - }, + } 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; - /*-----------取消订单-----------*/ - 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; - } - }) + 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; - 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) { - if(t.data.code==0) - { - 0 == e.data.activeCategoryId ? - (e.resetData(), e.requestOrderList(e.data.activeCategoryId)) : e.deleteOrderData(a); - } - else - { - getApp().confirmBox(e.data.msg); - } - }, - }) - } + //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; + } + }); + }); + //} } - }); - }, - - /*-----------确认收货-----------*/ - confirmOrder: function(t) { - var e = this, a = t.currentTarget.dataset.id; - var is_zsorder=t.currentTarget.dataset.zsorder; + } - console.log("confirmOrder"); - console.log(is_zsorder); + //--如果是全部退款,也就可以删除-- + if (rt_ok_num == goodslist.length) { + data[ind]['is_all_return_status'] = 2; + } - wx.showModal({ - title: "是否确认收货?", + 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++ , + 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: "是否取消订单?", + 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) { - t.confirm && rq.put("/api/weshop/order/updatebyId", { - data: { - order_id: a,order_status:2 - }, - success: function(t) { - e.deleteOrderData(a); - //如果是会员团订单 - if(is_zsorder==3){ - getApp().request.post("/api/weshop/order/vipTuanTebate/"+os.stoid+"/"+a,{ - data:{}, success:function () { }}) - } - } - }); - } - }); - }, + 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); + } + }, + }) + } + } + }); + }, - //-----删除订单----- - 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; - } - } - }) + /*-----------确认收货-----------*/ + 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() {} + }) } + } }); - }, + } + }); + }, - //---判断是不是有退款----- - 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, - }); - } + //-----删除订单----- + 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; + } + } + }) + } + }); + }, - wx.navigateTo({ - url: "/pages/user/return_goods_info/return_goods_info?id=" + r - }); - } - } + 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; + } + }, - /*----------跳转支付-----------*/ - jumpToCart4: function(t) { - var o_index=t.currentTarget.dataset.idx; - var e = this.data.orderList[t.currentTarget.dataset.idx]; - var th=this; + //---判断是不是有退款----- + 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, + }); + } - console.log("jumpToCart4"); - console.log(e); + wx.navigateTo({ + url: "/pages/user/return_goods_info/return_goods_info?id=" + r + }); + } + } + }); + }, - 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; + /*----------跳转支付-----------*/ + 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); + + 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//正常单 - }); - }, + 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) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; - }, + //------图片失败,默认图片--------- + bind_bnerr: function(e) { + var _errImg = e.currentTarget.dataset.errorimg; + var _errObj = {}; + _errObj[_errImg] = "public/images/default_goods_image_240.gif"; + this.setData(_errObj) //注意这里的赋值方式,只是将数据列表中的此项图片路径值替换掉 ; + }, - //--------跳转到退款详情----------- - 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, - }); - }, + //--------跳转到退款详情----------- + 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, + }); + }, - //-----支付尾款------ - 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, - }); + //-----支付尾款------ + 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 83cb7b6..790ff33 100644 --- a/pages/user/order_list/order_list.wxml +++ b/pages/user/order_list/order_list.wxml @@ -1,108 +1,182 @@ - - - - {{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.length>1 && goods.goods_spec.length>1?goods.goods_color+"/"+goods.goods_spec:goods.goods_color.length>1 || goods.goods_spec.length>1?goods.goods_color+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..a8760e4 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 -- libgit2 0.21.4