diff --git a/pages/mine/mineorders/mineorders.vue b/pages/mine/mineorders/mineorders.vue index d268cb9..7ca6ad5 100644 --- a/pages/mine/mineorders/mineorders.vue +++ b/pages/mine/mineorders/mineorders.vue @@ -1,136 +1,108 @@ + + + +const changeTab = (tab) => { + if (tab === '全部') { + Status.value.displayedOrders = Status.value.orders; + } else { + Status.value.displayedOrders = Status.value.orders.filter(order => { + switch (tab) { + case '待支付': + for(let i in Status.value.orders){ + return Status.value.orders[i].orderStatus === '待支付';} + case '代发货': + for(let i in Status.value.orders){ + return Status.value.orders[i].orderStatus === '代发货';} + case '已发货': + for(let i in Status.value.orders){ + return Status.value.orders[i].orderStatus === '已发货';} + case '售后': + for(let i in Status.value.orders){ + return Status.value.orders[i].orderStatus === '售后';} + default: + return false; + } + }); + } +} diff --git a/unpackage/dist/dev/mp-weixin/pages/mine/mineorders/mineorders.js b/unpackage/dist/dev/mp-weixin/pages/mine/mineorders/mineorders.js index d016cdd..e156057 100644 --- a/unpackage/dist/dev/mp-weixin/pages/mine/mineorders/mineorders.js +++ b/unpackage/dist/dev/mp-weixin/pages/mine/mineorders/mineorders.js @@ -1,63 +1,48 @@ "use strict"; const common_vendor = require("../../../common/vendor.js"); const api_request = require("../../../api/request.js"); -if (!Array) { - const _component_template = common_vendor.resolveComponent("template"); - _component_template(); -} const _sfc_main = { __name: "mineorders", setup(__props) { - const currentColor = common_vendor.ref(0); - const sort = common_vendor.ref([{}]); - const headerList = common_vendor.ref([{}]); - const productList = common_vendor.ref([{}]); + common_vendor.ref(0); common_vendor.onMounted(async () => { - await Getsort(); - await changeTypes(sort.value[0], 0); await Getorder(); Status.displayedOrders = Status.orders; }); common_vendor.ref({ - userInfo: common_vendor.wx$1.getStorageSync("userInfo") + userInfo: common_vendor.index.getStorageSync("userInfo") }); const Getorder = async () => { const res = await common_vendor.index.request({ url: api_request.baseUrl + "/order/list", method: "POST", data: { - // id:userInfo.value.userInfo.id , + // id:userInfo.value.userInfo.id, id: 215 } }); if (res.data.code === 1) { Status.value.orders = res.data.data; - for (let key in res.data.data) { - Status.value.orders[key] = res.data.data[key]; - } - console.log(Status.value.orders[0].orderStatus); - console.log(res.data.data[0].orderStatus); } else { console.log("没拿到用户数据"); } }; const Status = common_vendor.ref({ orderStatus: "全部", - orders: [ - {} - ], + orders: [], displayedOrders: [] }); const changeTab = (tab) => { if (tab === "全部") { Status.value.displayedOrders = Status.value.orders; + Status.value.orderStatus = "全部"; } else { Status.value.displayedOrders = Status.value.orders.filter((order) => { switch (tab) { case "待支付": - return order.orderStatus === "代支付"; - case "代发货": - return order.orderStatus === "代发货"; + return order.orderStatus === "待支付"; + case "待发货": + return order.orderStatus === "待发货"; case "已发货": return order.orderStatus === "已发货"; case "售后": @@ -66,89 +51,64 @@ const _sfc_main = { return false; } }); + Status.value.orderStatus = tab; } }; - const Getsort = async () => { - const res = await common_vendor.index.request({ - url: api_request.testUrl + "/category/list", - method: "POST" - }); - if (res.data.code === 1) { - for (let key in res.data.data) { - sort.value[key] = { - //类别列表 - name: res.data.data[key].typeName, - imgurl: res.data.data[key].typeUrl, - id: res.data.data[key].id - }; - headerList.value[key] = { - name: res.data.data[key].typeName, - typeIntro: res.data.data[key].typeIntro - }; - } - } else { - common_vendor.index.showToast({ - //提示请求错误 - title: "请求商品分类错误", - icon: "none", - duration: 2e3 - }); - } - }; - const changeTypes = async (item, index) => { - currentColor.value = index; - const res = await common_vendor.index.request({ - url: api_request.testUrl + "/category/list/type", - method: "POST", - data: { - id: item.id - } - }); - if (res.data.code === 1) { - productList.value = res.data.data[item.id]; - } else { - common_vendor.index.showToast({ - //商品请求错误 - title: "更改类别错误", - icon: "none", - duration: 2e3 - }); - } - }; + const isSelected = (tab) => Status.value.orderStatus === tab; return (_ctx, _cache) => { return { a: _ctx.orderStatus === "全部" ? 1 : "", - b: common_vendor.o(($event) => changeTab("全部")), - c: _ctx.orderStatus === "代支付" ? 1 : "", - d: common_vendor.o(($event) => changeTab("代支付")), - e: _ctx.orderStatus === "代发货" ? 1 : "", - f: common_vendor.o(($event) => changeTab("代发货")), - g: _ctx.orderStatus === "已发货" ? 1 : "", - h: common_vendor.o(($event) => changeTab("已发货")), - i: _ctx.orderStatus === "售后" ? 1 : "", - j: common_vendor.o(($event) => changeTab("售后")), - k: common_vendor.f(Status.value.orders, (order, k0, i0) => { - return { - a: common_vendor.f(order.orderItemList, (item, k1, i1) => { - return { - a: common_vendor.t(item.goodSnapshot.name), - b: item.id - }; - }), + b: isSelected("全部") ? 1 : "", + c: common_vendor.o(($event) => changeTab("全部")), + d: _ctx.orderStatus === "待支付" ? 1 : "", + e: isSelected("待支付") ? 1 : "", + f: common_vendor.o(($event) => changeTab("待支付")), + g: _ctx.orderStatus === "待发货" ? 1 : "", + h: isSelected("待发货") ? 1 : "", + i: common_vendor.o(($event) => changeTab("待发货")), + j: _ctx.orderStatus === "已发货" ? 1 : "", + k: isSelected("已发货") ? 1 : "", + l: common_vendor.o(($event) => changeTab("已发货")), + m: _ctx.orderStatus === "售后" ? 1 : "", + n: isSelected("售后") ? 1 : "", + o: common_vendor.o(($event) => changeTab("售后")), + p: common_vendor.f(Status.value.displayedOrders, (order, k0, i0) => { + return common_vendor.e({ + a: common_vendor.t(order.orderStatus), b: common_vendor.f(order.orderItemList, (item, k1, i1) => { return { - a: common_vendor.t(item.goodSnapshot.type), + a: item.goodSnapshot.goodImg, b: item.id }; }), c: common_vendor.f(order.orderItemList, (item, k1, i1) => { + return { + a: common_vendor.t(item.goodSnapshot.name), + b: item.id + }; + }), + d: common_vendor.f(order.orderItemList, (item, k1, i1) => { + return { + a: common_vendor.t(item.goodSnapshot.type), + b: item.id + }; + }), + e: common_vendor.f(order.orderItemList, (item, k1, i1) => { return { a: common_vendor.t(item.goodSnapshot.price), b: item.id }; }), - d: order.id - }; + f: order.orderStatus === "待支付" + }, order.orderStatus === "待支付" ? {} : {}, { + g: order.orderStatus === "待发货" + }, order.orderStatus === "待发货" ? {} : {}, { + h: order.orderStatus === "已发货" + }, order.orderStatus === "已发货" ? {} : {}, { + i: order.orderStatus === "售后" + }, order.orderStatus === "售后" ? {} : {}, { + j: order.id + }); }) }; }; diff --git a/unpackage/dist/dev/mp-weixin/pages/mine/mineorders/mineorders.json b/unpackage/dist/dev/mp-weixin/pages/mine/mineorders/mineorders.json deleted file mode 100644 index a0812ee..0000000 --- a/unpackage/dist/dev/mp-weixin/pages/mine/mineorders/mineorders.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "navigationBarTitleText": "", - "usingComponents": {} -} \ No newline at end of file diff --git a/unpackage/dist/dev/mp-weixin/pages/mine/mineorders/mineorders.wxml b/unpackage/dist/dev/mp-weixin/pages/mine/mineorders/mineorders.wxml index 9144741..29200aa 100644 --- a/unpackage/dist/dev/mp-weixin/pages/mine/mineorders/mineorders.wxml +++ b/unpackage/dist/dev/mp-weixin/pages/mine/mineorders/mineorders.wxml @@ -1 +1 @@ -全部代支付代发货已发货售后{{item.a}}{{item.a}}{{item.a}} \ No newline at end of file + 全部 待支付 待发货 已发货 售后 {{order.a}} {{item.a}}{{item.a}}{{item.a}}去支付取消订单确认收货售后详情 \ No newline at end of file diff --git a/unpackage/dist/dev/mp-weixin/pages/mine/mineorders/mineorders.wxss b/unpackage/dist/dev/mp-weixin/pages/mine/mineorders/mineorders.wxss index e35aa47..66a0456 100644 --- a/unpackage/dist/dev/mp-weixin/pages/mine/mineorders/mineorders.wxss +++ b/unpackage/dist/dev/mp-weixin/pages/mine/mineorders/mineorders.wxss @@ -402,7 +402,7 @@ text.data-v-7d0f2622 { margin-top: 187.5rpx; } .container.data-v-7d0f2622 { - padding: 20px; + padding-bottom: 20px; } .order-tabs.data-v-7d0f2622 { display: flex; @@ -416,10 +416,13 @@ text.data-v-7d0f2622 { } .tab-item.active.data-v-7d0f2622 { color: blue; - border-bottom: 2px solid blue; +} +.tab-item.selected.data-v-7d0f2622 { + background-color: brown; + color: white; } .order-list.data-v-7d0f2622 { - margin-top: 20px; + margin: 10px 10px 0 10px; } .order-item.data-v-7d0f2622 { border: 1px solid #ccc; diff --git a/unpackage/dist/dev/mp-weixin/project.private.config.json b/unpackage/dist/dev/mp-weixin/project.private.config.json index 2633c30..18dcd82 100644 --- a/unpackage/dist/dev/mp-weixin/project.private.config.json +++ b/unpackage/dist/dev/mp-weixin/project.private.config.json @@ -21,6 +21,13 @@ "launchMode": "default", "scene": null }, + { + "name": "pages/mine/mineorders/mineorders", + "pathName": "pages/mine/mineorders/mineorders", + "query": "", + "launchMode": "default", + "scene": null + }, { "name": "pages/store-home/main/main", "pathName": "pages/store-home/main/main",