From 6422b072fcabbdffae8d85e6ed2debf971231a00 Mon Sep 17 00:00:00 2001 From: 1154079537 <1154079537@qq.com> Date: Sat, 8 Jun 2024 16:11:45 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=80=E6=AC=BE=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/shopListPopup.vue | 354 ++++++++++++++++---------------- pages/afterSales/afterSales.vue | 84 +++++--- pages/index/index.vue | 3 +- pagesOrder/order/order.vue | 262 +++++++++++++++++------ 4 files changed, 436 insertions(+), 267 deletions(-) diff --git a/components/shopListPopup.vue b/components/shopListPopup.vue index fc36a0c..3db5fa5 100644 --- a/components/shopListPopup.vue +++ b/components/shopListPopup.vue @@ -1,208 +1,212 @@ \ No newline at end of file diff --git a/pages/afterSales/afterSales.vue b/pages/afterSales/afterSales.vue index 5903335..447ded8 100644 --- a/pages/afterSales/afterSales.vue +++ b/pages/afterSales/afterSales.vue @@ -5,30 +5,30 @@ - + - + - + - 黄牛牛腩 + {{item.store_name}} - 10 + {{item.price}} - 牛腩块 + {{item.unit}} x5 @@ -53,11 +53,11 @@ 备注说明 - 0/200 + - + @@ -71,7 +71,7 @@ - + 提交申请 @@ -107,7 +107,8 @@ } from "vue"; import { orderListApi, - refundReasonListApi + refundReasonListApi, + applyRefundApi } from "@/api/order.js"; import { config @@ -128,10 +129,26 @@ refund_message: '', //退款原因 refund_num: '', //退款数量 id: '', //订单id - old_cart_id: '', //购物车id + old_cart_id: [], //购物车id refund_type: '', //0 仅退款 1 退款退货 2换货 + refund_reason_wap_img: '', + mark: '' + }); + const goodsList = ref([]); + + onLoad(() => { + getRefundReasonData(); + + // 上一个页面传递的售后参数 + const eventChannel = instance.getOpenerEventChannel(); + eventChannel.on('orderDetail', function(data) { + console.log(data); + refundForm.id = data.id; + refundForm.old_cart_id = data.old_cart_id; + refundForm.refund_type = data.refund_type; + goodsList.value = data.goodsList; + }) }); - const shopInfo = ref(null); // 图片上传 const fileList1 = ref([]); @@ -175,6 +192,9 @@ }, success: (res) => { setTimeout(() => { + if (typeof res.data == 'string') { + res.data = JSON.parse(res.data) + } resolve(res.data.data); }, 1000); }, @@ -182,23 +202,37 @@ }); }; - onLoad(() => { - getRefundReasonData(); - - const eventChannel = instance.getOpenerEventChannel(); - eventChannel.on('orderDetail', function(data) { - shopInfo.value = data; - refundForm.value.id = shopInfo.value.order_id; - refundForm.value.old_cart_id = shopInfo.value.cart_id; - }) - }); - - // 提交退款原因 + // 退款原因 const onSubmitReason = () => { show.value = false; refundForm.refund_message = refundType.value; } + // 申请提交 + const onSubmitApply = () => { + if (!refundForm.refund_message) return uni.$u.toast('请选择退款原因'); + let urls = []; + //图片 refund_reason_wap_img + if (fileList1.value.length > 0) { + fileList1.value.map(i => { + console.log(i.url.uri); + urls.push(i.url.uri); + }); + refundForm.refund_reason_wap_img = urls.join(','); + } + + applyRefundApi(refundForm).then(res => { + if (res.code == 1) { + uni.$u.toast(res.msg); + uni.$u.sleep(1500).then(res => { + uni.navigateBack(); + }) + } else { + uni.$u.toast(res.msg); + } + }) + } + // 取消原因列表 const refundReasonList = ref([]); const getRefundReasonData = () => { diff --git a/pages/index/index.vue b/pages/index/index.vue index 61fbff2..b6398e5 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -415,7 +415,8 @@ //统计商品的访问记录 productLogApi({ product_id: item.product_id, - cate_id: item.cate_id + cate_id: item.cate_id, + store_id: uni.getStorageSync('STORE_INFO').id || '' }); }; diff --git a/pagesOrder/order/order.vue b/pagesOrder/order/order.vue index 5e78aef..e438f0f 100644 --- a/pagesOrder/order/order.vue +++ b/pagesOrder/order/order.vue @@ -53,29 +53,51 @@ 售后类型 - 仅退款 - 退款退货 - 换货 + 仅退款 + 退款退货 + 换货 + 当前售后类型仅支持未备货商品 + 当前售后类型仅支持非生鲜类商品 + 当前售后类型仅支持选择单个商品 - - - - - - - - - - {{item.value}} + + + + + + + + + + + {{item.store_name}} + + 数量{{item.cart_num}} + + + {{item.price}} + + + + + + + + + - - - - - - 提交 + + + + + 提交 + @@ -188,18 +210,58 @@ }) } - const refundShow = ref(true); + // 申请售后 + const refundShow = ref(false); + const goodsList = ref([]); // 申请售后商品 + const afterSalesType = ref(''); //申请售后类型 0 1 2 + const orderId = ref(''); // 申请售后 const applyAfterSales = (item) => { + refundShow.value = true; + goodsList.value = item.goods_list; + orderId.value = item.order_id; + } + + // 跳转到申请售后 + const onPageToAfterSales = () => { + if (afterSalesType.value === '') return uni.$u.toast('请选择售后类型'); + if (!goodsList.value || goodsList.value.length == 0) return uni.$u.toast('暂无可申请售后的商品'); + let goods = goodsList.value.find(i => i.isSelected); + if (goods == undefined) return uni.$u.toast('请选择需要申请售后的商品'); + + let ids = []; + let goodsListSel = []; + goodsList.value.map(i => { + if (i.isSelected) { + ids.push(i.old_cart_id); + goodsListSel.push(i); + } + }); + uni.navigateTo({ url: "/pages/afterSales/afterSales", success(res) { - res.eventChannel.emit('orderDetail', item) + refundShow.value = false; // close modal + res.eventChannel.emit('orderDetail', { + id: orderId.value, //订单id + old_cart_id: ids, + refund_type: afterSalesType.value, + goodsList: goodsListSel + }) } }) } + // 选择物品 + const onChooseGoods = (item) => { + if (item.hasOwnProperty('isSelected')) { + item.isSelected = !item.isSelected; + } else { + item.isSelected = true; + } + } + const rePay = (e) => { rePaymentApi({ order_id: e.id, @@ -369,68 +431,136 @@ } .address-popup { - padding: 30rpx; + // padding: 30rpx; + background-color: #F6F6F6; .head-title { font-weight: bold; text-align: center; margin-bottom: 20rpx; + padding: 20rpx; } - .list-admin { - display: flex; - justify-content: space-between; - margin-bottom: 20rpx; + .afterSales-type { + margin: 0 20rpx 20rpx; + background: #FFFFFF; + border-radius: 16rpx; + padding: 20rpx; + box-sizing: border-box; - .admin-btn { + .afterSales-type-title { + font-size: 32rpx; + color: #444444; + margin-bottom: 28rpx; + } + + .afterSales-type-con { display: flex; - color: #20B128; + align-items: center; + margin-bottom: 20rpx; - .btn { - margin-left: 20rpx; + .afterSales-type-item { + width: 200rpx; + height: 70rpx; + line-height: 70rpx; + border-radius: 12rpx; + color: #777777; + border: 2rpx solid #D3D3D3; + font-size: 28rpx; + text-align: center; + + &:not(:nth-last-child(1)) { + margin-right: 24rpx; + } + } + + .fuck-active { + color: #FC452F; + border: 2rpx solid #FC452F; + font-weight: 600; + } + } + + .afterSales-type-tip { + font-size: 20rpx; + color: #FC452F; + } + } + + .scroll-wrap { + margin: 0 20rpx; + background: #FFFFFF; + border-radius: 16rpx; + padding: 20rpx 20rpx 1rpx; + box-sizing: border-box; + + .goods { + .goods-item { display: flex; align-items: center; + justify-content: space-between; + margin-bottom: 30rpx; - &:active { - color: rgba(#20B128, 0.8); - transition: background-color 0.5s; - animation: disappear 0.5s 0.5s forwards; + .goods-item-left { + display: flex; + align-items: center; + + .goods-item-left-img { + margin-right: 20rpx; + } + + .goods-item-left-info { + display: flex; + flex-direction: column; + justify-content: space-between; + height: 164rpx; + + .goods_name { + font-size: 28rpx; + color: #060606; + max-width: 400rpx; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + } + + .goods_detail { + display: flex; + align-items: center; + + .goods-detail_num { + margin-right: 30rpx; + font-size: 28rpx; + color: #333333; + } + + .goods_detail_price { + display: flex; + + .symbol { + align-self: flex-end; + font-size: 22rpx; + color: #333333; + } + + .numbers { + font-size: 32rpx; + color: #333333; + } + } + } + } + } + + .goods-item-right { + image { + width: 48rpx; + height: 48rpx; + } } } } } - - .row { - display: flex; - align-items: center; - justify-content: space-between; - padding-bottom: 20rpx; - border-bottom: 1rpx solid #f6f6f6; - margin-bottom: 20rpx; - - &:last-child { - border-bottom: none; - margin-bottom: 0; - } - - .content { - .top { - display: flex; - - view { - margin-right: 20rpx; - } - } - - .bottom {} - } - - image { - width: 40rpx; - height: 40rpx; - flex-shrink: 0; - } - } } @keyframes disappear {