From 64a5918a2af242d8d9b046a21597b9d574577106 Mon Sep 17 00:00:00 2001 From: Cxpller Date: Sun, 22 Oct 2023 14:49:01 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=AE=A2=E5=8D=95=E5=AF=B9=E6=8E=A570%?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/goods-list/index.js | 8 + pages/goods/result/index.js | 25 +- pages/order/order-list/index.js | 448 ++++++++++++++++++++++++++++---- services/order/getOrderList.js | 20 ++ 4 files changed, 442 insertions(+), 59 deletions(-) create mode 100644 services/order/getOrderList.js diff --git a/components/goods-list/index.js b/components/goods-list/index.js index af9d36e..7c52f96 100644 --- a/components/goods-list/index.js +++ b/components/goods-list/index.js @@ -45,6 +45,11 @@ Component({ isStock: false, isAllSelectedSku: false, selectSkuSellsPrice: 0, + selectSkuLinePrice: 0, + selectedSkuId: 0, + maxLinePrice: 0, + minSalePrice: 0, + maxSalePrice: 0, details: {}, buyNum: 1, }, @@ -181,6 +186,9 @@ Component({ }); this.selectSpecsName(selectedSkuValues.length > 0 ? selectedAttrStr : ''); if (skuItem) { + console.log(skuItem[0], '选中的item'); + console.log(skuItem[0]?.priceInfo[0]?.price, '选中的item'); + console.log(skuItem[0]?.priceInfo[1]?.price, '选中的item'); this.setData({ selectedSkuId: skuItem[0]?.skuId, selectItem: skuItem, diff --git a/pages/goods/result/index.js b/pages/goods/result/index.js index 05608d5..1f26478 100644 --- a/pages/goods/result/index.js +++ b/pages/goods/result/index.js @@ -12,14 +12,13 @@ const initFilters = { Page({ data: { goodsList: [], + layout: 0, priceSorts: '', soldSorts: '', overall: 1, show: false, minVal: '', maxVal: '', - minSalePriceFocus: false, - maxSalePriceFocus: false, filter: initFilters, hasLoaded: false, keywords: '', @@ -29,7 +28,7 @@ Page({ total: 0, pageNum: 1, - pageSize: 30, + pageSize: 10, onLoad(options) { const { @@ -56,7 +55,8 @@ Page({ pageSize } = this; const { - sorts, + priceSorts, + soldSorts, overall } = filter; const params = { @@ -66,23 +66,28 @@ Page({ goodsName: keywords, }; - if (sorts) { + if (priceSorts) { params.goodsSort = 1; - params.sortType = sorts === 'desc' ? 1 : 0; + params.goodsSortType = priceSorts === 'desc' ? 1 : 0; } + + if (soldSorts) { + params.goodsSort = 2; + params.goodsSortType = soldSorts === 'desc' ? 1 : 0; + } + if (overall) { params.goodsSort = 0; } else { params.goodsSort = 1; } + console.log(minVal, 'minVal', maxVal, 'maxVal'); if (minVal) { params.minPrice = minVal * 100 } if (maxVal) { params.maxPrice = maxVal * 100 } - // params.minPrice = minVal ? minVal * 100 : 0; - // params.maxPrice = maxVal ? maxVal * 100 : undefined; if (reset) return params; return { ...params, @@ -97,6 +102,7 @@ Page({ goodsList = [] } = this.data; const params = this.generalQueryData(reset); + console.log(params); if (loadMoreStatus !== 0) return; this.setData({ loadMoreStatus: 1, @@ -160,10 +166,11 @@ Page({ }); }, - handleSubmit() { + handleSubmit(e) { this.setData({ goodsList: [], loadMoreStatus: 0, + keywords: e.detail.value }, () => { this.init(true); diff --git a/pages/order/order-list/index.js b/pages/order/order-list/index.js index c62315b..0a9d23a 100644 --- a/pages/order/order-list/index.js +++ b/pages/order/order-list/index.js @@ -1,30 +1,54 @@ -import { OrderStatus } from '../config'; +import { + OrderStatus +} from '../config'; import { fetchOrders, fetchOrdersCount, } from '../../../services/order/orderList'; -import { cosThumb } from '../../../utils/util'; +import { + getOrderList +} from '~/services/order/getOrderList'; +import { + cosThumb +} from '../../../utils/util'; Page({ page: { - size: 5, + size: 10, num: 1, }, data: { - tabs: [ - { key: -1, text: '全部' }, - { key: OrderStatus.PENDING_PAYMENT, text: '待付款', info: '' }, - { key: OrderStatus.PENDING_DELIVERY, text: '待发货', info: '' }, - { key: OrderStatus.PENDING_RECEIPT, text: '待收货', info: '' }, - { key: OrderStatus.COMPLETE, text: '已完成', info: '' }, + tabs: [{ + key: -1, + text: '全部' + }, + { + key: OrderStatus.PENDING_PAYMENT, + text: '待付款', + info: '' + }, + { + key: OrderStatus.PENDING_DELIVERY, + text: '待发货', + info: '' + }, + { + key: OrderStatus.PENDING_RECEIPT, + text: '待收货', + info: '' + }, + { + key: OrderStatus.COMPLETE, + text: '已完成', + info: '' + }, ], curTab: -1, orderList: [], listLoading: 0, pullDownRefreshing: false, - emptyImg: - 'https://cdn-we-retail.ym.tencent.com/miniapp/order/empty-order-list.png', + emptyImg: 'https://cdn-we-retail.ym.tencent.com/miniapp/order/empty-order-list.png', backRefresh: false, status: -1, }, @@ -39,12 +63,14 @@ Page({ onShow() { if (!this.data.backRefresh) return; this.onRefresh(); - this.setData({ backRefresh: false }); + this.setData({ + backRefresh: false + }); }, onReachBottom() { if (this.data.listLoading === 0) { - this.getOrderList(this.data.curTab); + this.onGetOrderList(this.data.curTab); } }, @@ -53,15 +79,23 @@ Page({ }, onPullDownRefresh_(e) { - const { callback } = e.detail; - this.setData({ pullDownRefreshing: true }); + const { + callback + } = e.detail; + this.setData({ + pullDownRefreshing: true + }); this.refreshList(this.data.curTab) .then(() => { - this.setData({ pullDownRefreshing: false }); + this.setData({ + pullDownRefreshing: false + }); callback && callback(); }) .catch((err) => { - this.setData({ pullDownRefreshing: false }); + this.setData({ + pullDownRefreshing: false + }); Promise.reject(err); }); }, @@ -74,92 +108,401 @@ Page({ this.refreshList(status); }, - getOrderList(statusCode = -1, reset = false) { + changeOrderStatus(deliveryStatus, payStatus, orderStatus, receiptStatus) { + + }, + + onGetOrderList(statusCode, reset = false) { + let _status = -1; + switch (statusCode) { + case -1: + _status = 0 + break; + case 5: + _status = 1 + break; + case 10: + _status = 2 + break; + case 40: + _status = 3 + break; + case 50: + _status = 4 + break; + } const params = { - parameter: { - pageSize: this.page.size, - pageNum: this.page.num, - }, + pageIndex: this.page.num, + pageSize: this.page.size, + status: _status }; - if (statusCode !== -1) params.parameter.orderStatus = statusCode; - this.setData({ listLoading: 1 }); - return fetchOrders(params) - .then((res) => { + // if (statusCode !== -1) params.parameter.orderStatus = statusCode; + this.setData({ + listLoading: 1 + }); + return getOrderList(params) + .then((_res) => { + // console.log(res); + const res = { + "code": 200, + "msg": "SUCCESS", + "data": { + "pageSize": 10, + "pageIndex": 1, + "totalNum": 9, + "totalPage": 1, + "result": [{ + "orderId": 17, + "orderGuid": "1714904293930307584", + "orderNo": "Q2310191520196710002", + "goodsList": [{ + "goodsGuId": "1672964367177617408", + "thumb": "http://shop.back.aerwen.net/prod-api//Uploads/Goods/20231010/BD3521D2710CF9CD.jpg", + "title": "韩哚馨(HANDUOXIN)韩哚馨 感学院风短袖茶歇法式连衣裙子碎花长裙2023新款", + "skuId": 232, + "specifications": [{ + "specTitle": "规格", + "specValue": "常规款加绒" + }], + "price": 160.00, + "buyQuantity": 1 + }], + "goodsTotalAmoun": 160.00, + "orderAmount": 155.00, + "payPrice": 0.01, + "expressPrice": 0.00, + "payStatus": 2, + "deliveryStatus": 1, + "receiptStatus": 1, + "orderStatus": 2, + "isComment": 1, + "status": 0, + "statusName": null + }, + { + "orderId": 16, + "orderGuid": "1714900618189082624", + "orderNo": "Q2310191505433070002", + "goodsList": [{ + "goodsGuId": "1672964367177617408", + "thumb": "http://shop.back.aerwen.net/prod-api//Uploads/Goods/20231010/BD3521D2710CF9CD.jpg", + "title": "韩哚馨(HANDUOXIN)韩哚馨 感学院风短袖茶歇法式连衣裙子碎花长裙2023新款", + "skuId": 232, + "specifications": [{ + "specTitle": "规格", + "specValue": "常规款加绒" + }], + "price": 160.00, + "buyQuantity": 3 + }], + "goodsTotalAmoun": 480.00, + "orderAmount": 475.00, + "payPrice": 0.01, + "expressPrice": 0.00, + "payStatus": 2, + "deliveryStatus": 1, + "receiptStatus": 1, + "orderStatus": 1, + "isComment": 1, + "status": 2, + "statusName": "待发货" + }, + { + "orderId": 15, + "orderGuid": "1714899117605523456", + "orderNo": "Q2310191459455300002", + "goodsList": [{ + "goodsGuId": "1672961736711475200", + "thumb": "http://shop.back.aerwen.net/prod-api/Uploads/Goods/20231009/2E9F7284DE854663.jpg", + "title": "2024新款裙子夏季女法式桔梗碎花公主裙吊带连衣裙仙气仙森系 连衣裙 均码", + "skuId": 220, + "specifications": [{ + "specTitle": "颜色分类", + "specValue": "碎花【收藏优先发货】" + }, + { + "specTitle": "尺码 ", + "specValue": "S【建议70-95斤】" + } + ], + "price": 65.30, + "buyQuantity": 1 + }], + "goodsTotalAmoun": 65.30, + "orderAmount": 60.30, + "payPrice": 0.01, + "expressPrice": 0.00, + "payStatus": 2, + "deliveryStatus": 1, + "receiptStatus": 1, + "orderStatus": 1, + "isComment": 1, + "status": 2, + "statusName": "待发货" + }, + { + "orderId": 13, + "orderGuid": "1714355378755604480", + "orderNo": "Q2310180259081130005", + "goodsList": [{ + "goodsGuId": "1680467517816049664", + "thumb": "http://shop.back.aerwen.net/prod-api/Uploads/Goods/20231014/FFCD5093C92A62B1.jpg", + "title": "三只松鼠肉松饼1000g 黄金肉松饼早餐代餐休闲零食办公室点心面包量贩箱装", + "skuId": 0, + "specifications": null, + "price": 9.90, + "buyQuantity": 2 + }], + "goodsTotalAmoun": 19.80, + "orderAmount": 3001.80, + "payPrice": 19.80, + "expressPrice": 13.00, + "payStatus": 2, + "deliveryStatus": 1, + "receiptStatus": 1, + "orderStatus": 1, + "isComment": 1, + "status": 2, + "statusName": "待发货" + }, + { + "orderId": 14, + "orderGuid": "1714355379099537408", + "orderNo": "Q2310180259081130006", + "goodsList": [{ + "goodsGuId": "1673671239077597184", + "thumb": "http://shop.back.aerwen.net/prod-api/Uploads/Goods/20231014/666229CAA9F1B6AE.jpg", + "title": "三星 Galaxy S21 5G(SM-G9910)双模5G 骁龙888 超高清专业摄像 120Hz护目屏 游戏手机 8G+128G", + "skuId": 235, + "specifications": [{ + "specTitle": "颜色", + "specValue": "梵梦紫" + }], + "price": 2969.00, + "buyQuantity": 1 + }], + "goodsTotalAmoun": 2969.00, + "orderAmount": 3001.80, + "payPrice": 2969.00, + "expressPrice": 13.00, + "payStatus": 2, + "deliveryStatus": 1, + "receiptStatus": 1, + "orderStatus": 1, + "isComment": 1, + "status": 2, + "statusName": "待发货" + }, + { + "orderId": 9, + "orderGuid": "1713568156318044160", + "orderNo": "Q2310152250589130002", + "goodsList": [{ + "goodsGuId": "1672961736711475200", + "thumb": "http://shop.back.aerwen.net/prod-api/Uploads/Goods/20231009/2E9F7284DE854663.jpg", + "title": "2024新款裙子夏季女法式桔梗碎花公主裙吊带连衣裙仙气仙森系 连衣裙 均码", + "skuId": 220, + "specifications": [{ + "specTitle": "颜色分类", + "specValue": "碎花【收藏优先发货】" + }, + { + "specTitle": "尺码 ", + "specValue": "S【建议70-95斤】" + } + ], + "price": 65.30, + "buyQuantity": 2 + }], + "goodsTotalAmoun": 130.60, + "orderAmount": 130.60, + "payPrice": 2.00, + "expressPrice": 0.00, + "payStatus": 2, + "deliveryStatus": 2, + "receiptStatus": 1, + "orderStatus": 1, + "isComment": 1, + "status": 3, + "statusName": "待收货" + }, + { + "orderId": 7, + "orderGuid": "1713125767367495680", + "orderNo": "Q2310141733050100001", + "goodsList": [{ + "goodsGuId": "1672964367177617408", + "thumb": "http://shop.back.aerwen.net/prod-api//Uploads/Goods/20231010/BD3521D2710CF9CD.jpg", + "title": "韩哚馨(HANDUOXIN)韩哚馨 感学院风短袖茶歇法式连衣裙子碎花长裙2023新款", + "skuId": 231, + "specifications": [{ + "specTitle": "规格", + "specValue": "爆款加绒" + }], + "price": 199.00, + "buyQuantity": 1 + }], + "goodsTotalAmoun": 199.00, + "orderAmount": 199.00, + "payPrice": 1.00, + "expressPrice": 0.00, + "payStatus": 2, + "deliveryStatus": 1, + "receiptStatus": 1, + "orderStatus": 1, + "isComment": 1, + "status": 2, + "statusName": "待发货" + }, + { + "orderId": 6, + "orderGuid": "1713124559743488000", + "orderNo": "Q2310141728171060001", + "goodsList": [{ + "goodsGuId": "1680467515018448896", + "thumb": "http://shop.back.aerwen.net/prod-api/Uploads/Goods/20231014/EF0885623F14CA0C.jpg", + "title": "双汇 火腿肠 玉米热狗40g*8支 网兜装 出游 露营款", + "skuId": 0, + "specifications": null, + "price": 13.00, + "buyQuantity": 10 + }], + "goodsTotalAmoun": 130.00, + "orderAmount": 143.00, + "payPrice": 1.00, + "expressPrice": 13.00, + "payStatus": 2, + "deliveryStatus": 1, + "receiptStatus": 1, + "orderStatus": 1, + "isComment": 1, + "status": 2, + "statusName": "待发货" + }, + { + "orderId": 5, + "orderGuid": "1713121315600338944", + "orderNo": "Q2310141715235960001", + "goodsList": [{ + "goodsGuId": "1672964367177617408", + "thumb": "http://shop.back.aerwen.net/prod-api//Uploads/Goods/20231010/BD3521D2710CF9CD.jpg", + "title": "韩哚馨(HANDUOXIN)韩哚馨 感学院风短袖茶歇法式连衣裙子碎花长裙2023新款", + "skuId": 231, + "specifications": [{ + "specTitle": "规格", + "specValue": "爆款加绒" + }], + "price": 199.00, + "buyQuantity": 1 + }], + "goodsTotalAmoun": 199.00, + "orderAmount": 199.00, + "payPrice": 0.00, + "expressPrice": 0.00, + "payStatus": 1, + "deliveryStatus": 1, + "receiptStatus": 1, + "orderStatus": 1, + "isComment": 1, + "status": 1, + "statusName": "待付款" + } + ], + "extra": {} + } + } this.page.num++; let orderList = []; - if (res && res.data && res.data.orders) { - orderList = (res.data.orders || []).map((order) => { + if (res && res.data && res.data.result) { + orderList = (res.data.result || []).map((order) => { return { id: order.orderId, orderNo: order.orderNo, - parentOrderNo: order.parentOrderNo, + // parentOrderNo: order.parentOrderNo, storeId: order.storeId, storeName: order.storeName, status: order.orderStatus, - statusDesc: order.orderStatusName, - amount: order.paymentAmount, - totalAmount: order.totalAmount, - logisticsNo: order.logisticsVO.logisticsNo, - createTime: order.createTime, - goodsList: (order.orderItemVOs || []).map((goods) => ({ + statusDesc: order.statusName, + amount: order.payPrice, + totalAmount: order.orderAmount, + // logisticsNo: order.logisticsVO.logisticsNo, + // createTime: order.createTime, + goodsList: (order.goodsList || []).map((goods) => ({ id: goods.id, - thumb: cosThumb(goods.goodsPictureUrl, 70), - title: goods.goodsName, + thumb: goods.thumb, + title: goods.title, skuId: goods.skuId, spuId: goods.spuId, specs: (goods.specifications || []).map( (spec) => spec.specValue, ), - price: goods.tagPrice ? goods.tagPrice : goods.actualPrice, + price: goods.price, num: goods.buyQuantity, - titlePrefixTags: goods.tagText ? [{ text: goods.tagText }] : [], + titlePrefixTags: goods.tagText ? [{ + text: goods.tagText + }] : [], })), buttons: order.buttonVOs || [], groupInfoVo: order.groupInfoVo, - freightFee: order.freightFee, + freightFee: order.expressPrice, }; }); + // console.log(orderList); } return new Promise((resolve) => { if (reset) { - this.setData({ orderList: [] }, () => resolve()); + this.setData({ + orderList: [] + }, () => resolve()); } else resolve(); }).then(() => { this.setData({ orderList: this.data.orderList.concat(orderList), listLoading: orderList.length > 0 ? 0 : 2, }); + // console.log(orderList); }); }) .catch((err) => { - this.setData({ listLoading: 3 }); + this.setData({ + listLoading: 3 + }); return Promise.reject(err); }); }, onReTryLoad() { - this.getOrderList(this.data.curTab); + this.onGetOrderList(this.data.curTab); }, onTabChange(e) { - const { value } = e.detail; + console.log(e); + const { + value + } = e.detail; this.setData({ status: value, }); + console.log(value); + // console.log(value,'asdasd'); this.refreshList(value); }, getOrdersCount() { return fetchOrdersCount().then((res) => { const tabsCount = res.data || []; - const { tabs } = this.data; + const { + tabs + } = this.data; tabs.forEach((tab) => { const tabCount = tabsCount.find((c) => c.tabType === tab.key); if (tabCount) { tab.info = tabCount.orderNum; } }); - this.setData({ tabs }); + this.setData({ + tabs + }); }); }, @@ -168,10 +511,13 @@ Page({ size: this.page.size, num: 1, }; - this.setData({ curTab: status, orderList: [] }); + this.setData({ + curTab: status, + orderList: [] + }); return Promise.all([ - this.getOrderList(status, true), + this.onGetOrderList(status, true), this.getOrdersCount(), ]); }, @@ -181,9 +527,11 @@ Page({ }, onOrderCardTap(e) { - const { order } = e.currentTarget.dataset; + const { + order + } = e.currentTarget.dataset; wx.navigateTo({ url: `/pages/order/order-detail/index?orderNo=${order.orderNo}`, }); }, -}); +}); \ No newline at end of file diff --git a/services/order/getOrderList.js b/services/order/getOrderList.js new file mode 100644 index 0000000..983b0c5 --- /dev/null +++ b/services/order/getOrderList.js @@ -0,0 +1,20 @@ +import { + request +} from '../_utils/request'; + +/** 获取轮播图列表 */ +export function getOrderList(data) { + return new Promise((resolve, reject) => { + request({ + url: `OrderApi/getOrderList`, + method: 'GET', + data: data, + success: function (res) { + resolve(res); + }, + fail: function (error) { + reject(error); + } + }); + }); +} \ No newline at end of file