From 204261ac3cef6b52ace4393fd6c77b24f9af2fc8 Mon Sep 17 00:00:00 2001
From: sx <2427911852@qq.com>
Date: Tue, 21 Jan 2025 22:33:44 +0800
Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=B9=B6=E4=BB=A3=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
jiuyi2/api/shop.js | 13 +
jiuyi2/common/js/order.js | 14 +-
jiuyi2/components/shop/detail/makeOrder.vue | 142 +++++++++++
jiuyi2/components/shop/order/logistics.vue | 2 +-
jiuyi2/pages/shop/collect.vue | 55 ++--
.../components/jy-commodity-foot/index.vue | 8 +-
jiuyi2/pages/shop/order/detail.vue | 3 +-
jiuyi2/pages/shop/order/index.vue | 19 +-
jiuyi2/pages/shop/order/logistics.vue | 64 ++---
jiuyi2/pages/shop/order/refundStar.vue | 237 +++++++++++++++---
jiuyi2/vite.config.js | 2 +-
11 files changed, 456 insertions(+), 103 deletions(-)
create mode 100644 jiuyi2/components/shop/detail/makeOrder.vue
diff --git a/jiuyi2/api/shop.js b/jiuyi2/api/shop.js
index f8763317..e398172b 100644
--- a/jiuyi2/api/shop.js
+++ b/jiuyi2/api/shop.js
@@ -344,6 +344,19 @@ const shop = {
load: true,
})
},
+
+ /**
+ * 订单取消
+ * @param {Object} param
+ */
+ orderAfterSales(param) {
+ return util.request({
+ url: `/shopify/appRefundOrder/addRefund`,
+ data: param.data,
+ method: 'POST',
+ load: true,
+ })
+ },
}
export default shop
\ No newline at end of file
diff --git a/jiuyi2/common/js/order.js b/jiuyi2/common/js/order.js
index adca2aa6..c8f0de5b 100644
--- a/jiuyi2/common/js/order.js
+++ b/jiuyi2/common/js/order.js
@@ -43,7 +43,19 @@ const order = {
orderId: event.id,
})
})
- }
+ },
+
+ /**
+ * 申请售后
+ * @param {Object} event 事件对象
+ */
+ orderAfterSales(event) {
+ uni.navigateTo({
+ url: util.setUrl('/pages/shop/order/refundStar', {
+ orderId: event.id,
+ })
+ })
+ },
}
export default order
\ No newline at end of file
diff --git a/jiuyi2/components/shop/detail/makeOrder.vue b/jiuyi2/components/shop/detail/makeOrder.vue
new file mode 100644
index 00000000..ec6be2bf
--- /dev/null
+++ b/jiuyi2/components/shop/detail/makeOrder.vue
@@ -0,0 +1,142 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ 暂无默认地址
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 单价
+ ¥
+ {{detail.price}}
+
+
+
+ 已选: {{currentSpec.sku}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{item.sku}}
+
+
+
+
+
+ 立即下单 ¥{{total}}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jiuyi2/components/shop/order/logistics.vue b/jiuyi2/components/shop/order/logistics.vue
index d9e02992..45c64eb2 100644
--- a/jiuyi2/components/shop/order/logistics.vue
+++ b/jiuyi2/components/shop/order/logistics.vue
@@ -39,7 +39,7 @@
function link(url) {
uni.navigateTo({
url: util.setUrl('/pages/shop/order/logistics', {
- //
+ orderId: props.detail.id,
})
})
}
diff --git a/jiuyi2/pages/shop/collect.vue b/jiuyi2/pages/shop/collect.vue
index 68dba176..d502feaa 100644
--- a/jiuyi2/pages/shop/collect.vue
+++ b/jiuyi2/pages/shop/collect.vue
@@ -2,7 +2,8 @@
// 商品收藏
import {
- ref
+ ref,
+ reactive,
} from 'vue';
import apex from '@/components/header/apex'
import {
@@ -18,6 +19,10 @@
import util from '@/common/js/util';
//
const setting = ref(false)
+ // 收藏列表
+ const list = reactive({
+ data: [],
+ })
onLoad(() => {
// 获取列表
@@ -28,8 +33,24 @@
function getList() {
api.shop.getCollectList({}).then(res => {
console.log(res)
+ if (res.code == 200) {
+ list.data = res.data
+ return
+ }
+ util.alert({
+ content: res.msg,
+ showCancel: false,
+ })
})
}
+
+ /**
+ * 规格选择
+ * @param {Object} secItem
+ */
+ function handleSpec(secItem) {
+ //
+ }
@@ -44,17 +65,16 @@
-
+
-
- 家纺专营店
+ {{item.name}}
-
+
@@ -66,26 +86,26 @@
-
- 靠枕 纯棉靠枕 车载居家 纯棉100% 卡通靠枕 人体工学
+
+ {{item.name}}
+
+
+ 已选规格: 升级款/小熊
+
¥
- 89
+ {{secItem.price}}
- 销量:0
+ 销量:{{secItem.sales}}
-
-
- 已选规格: 升级款/小熊
-
@@ -111,5 +131,10 @@
.line+.line {
border-top: 2rpx solid #eee;
}
+
+ // 规格
+ .spec {
+ border: 2rpx solid #ddd;
+ }
}
\ No newline at end of file
diff --git a/jiuyi2/pages/shop/commodity/components/jy-commodity-foot/index.vue b/jiuyi2/pages/shop/commodity/components/jy-commodity-foot/index.vue
index 65a7cb63..77a9c503 100644
--- a/jiuyi2/pages/shop/commodity/components/jy-commodity-foot/index.vue
+++ b/jiuyi2/pages/shop/commodity/components/jy-commodity-foot/index.vue
@@ -13,7 +13,6 @@
//
import api from '@/api/index.js'
- import JyPopup from '@/components/public/jy-popup'
// 地址
import JyCommodityAddress from '@/components/public/jy-commodity-address'
//
@@ -210,19 +209,20 @@
-
+
立即购买
-
+
+
-
+
暂无默认地址
diff --git a/jiuyi2/pages/shop/order/detail.vue b/jiuyi2/pages/shop/order/detail.vue
index 1b205515..7bca1ad2 100644
--- a/jiuyi2/pages/shop/order/detail.vue
+++ b/jiuyi2/pages/shop/order/detail.vue
@@ -12,7 +12,6 @@
onPullDownRefresh,
onPageScroll
} from '@dcloudio/uni-app';
-
// 订单方法
import order from '@/common/js/order.js'
// api
@@ -212,7 +211,7 @@
继续付款
- 申请退款
+ 申请退款
diff --git a/jiuyi2/pages/shop/order/index.vue b/jiuyi2/pages/shop/order/index.vue
index 6942417f..f6b44308 100644
--- a/jiuyi2/pages/shop/order/index.vue
+++ b/jiuyi2/pages/shop/order/index.vue
@@ -39,16 +39,17 @@
},
{
id: 4,
- name: '已收货'
+ name: '待收货'
},
{
id: 5,
- name: '待收货'
+ name: '已收货'
},
{
id: 6,
name: '已完成'
- }, {
+ },
+ {
id: 9,
name: '已取消'
}
@@ -132,6 +133,8 @@
if (list.pageNum == 1) list.data.length = 0
list.data.push(...res.rows.map(item => {
item.status = Number(item.status)
+ if(item.refundStatus != 0) item.status_text = '售后'
+ // item.status_text =
return item
}))
list.total = res.total
@@ -212,16 +215,16 @@
- 申请退款
+
-
- 申请退款
+
+
查看物流
确认收货
-
- 申请退款
+
+ 申请退款
评价
diff --git a/jiuyi2/pages/shop/order/logistics.vue b/jiuyi2/pages/shop/order/logistics.vue
index 8ef5b221..89d7d3b1 100644
--- a/jiuyi2/pages/shop/order/logistics.vue
+++ b/jiuyi2/pages/shop/order/logistics.vue
@@ -5,12 +5,18 @@
reactive,
computed,
} from 'vue';
- // 产品列表
- import productList from '@/components/shop/productList/productList.vue';
import {
onLoad,
onUnload,
} from '@dcloudio/uni-app';
+ // 工具库
+ import util from '@/common/js/util.js'
+ // api
+ import api from '@/api/index.js'
+ // 产品列表
+ import productList from '@/components/shop/productList/productList.vue';
+ // 地址
+ import JyCommodityAddress from '@/components/public/jy-commodity-address'
// 订单详情
const detail = reactive({
@@ -19,36 +25,25 @@
// 订单商品列表信息
orderDetailList: [],
// 物流信息
- logistics: {
- info: [],
- },
+ logistics: {},
})
// 物流信息
- const logistics = computed(() => detail.logistics.info ? detail.logistics.info[0] : {})
+ const logistics = computed(() => detail.logistics.info ? detail.logistics.info[0] : {
+ logisticsTraceDetailList: []
+ })
// 订单id
const orderId = ref('')
-
- // 物流状态
- const flow = reactive([{
- content: '您的宝贝正在运输中',
- },
- {
- content: '您的快递正在由普通快递运送,预计三日后到达',
- },
- {
- content: '您的宝贝已被普通快递捡收',
- },
- {
- content: '您的宝贝已出仓',
- },
- ])
// 查看更多订单信息
const showMore = ref(false)
+ // 物流状态
+ const flow = computed(() => {
+ return []
+ })
// 物流状态
const formatFlow = computed(() => {
- let result = [...flow]
- if (!showMore.value) result.length = Math.min(flow.length, 2)
+ let result = [...logistics.value.logisticsTraceDetailList]
+ if (!showMore.value) result.length = Math.min(logistics.value.logisticsTraceDetailList.length, 2)
return result
})
@@ -90,30 +85,23 @@
-
-
-
-
- 山东省济南市槐荫区绿地新城商务大厦
-
- 海棠的秋
- 15666006592
-
-
+
+
+
- 快递公司:普通快递
- 复制
+ 快递公司:{{logistics.logisticsCompanyName}}
+ 复制
- 订单编号:kd11111111111
- 复制
+ 订单编号:{{detail.logistics.orderNo}}
+ 复制
@@ -126,7 +114,7 @@
- {{item.content}}
+ {{item.desc}}
2024-03-05 13:24:00
diff --git a/jiuyi2/pages/shop/order/refundStar.vue b/jiuyi2/pages/shop/order/refundStar.vue
index 626a4d28..8158a965 100644
--- a/jiuyi2/pages/shop/order/refundStar.vue
+++ b/jiuyi2/pages/shop/order/refundStar.vue
@@ -3,19 +3,55 @@
import {
reactive,
- ref
+ ref,
+ computed,
} from 'vue';
+ import {
+ onLoad,
+ onUnload,
+ onReachBottom,
+ onPullDownRefresh,
+ onPageScroll
+ } from '@dcloudio/uni-app';
+ import {
+ useStore
+ } from 'vuex';
+ // api
+ import api from '@/api/index.js'
+ // util
+ import util from '@/common/js/util';
// 物流信息
- import logistics from '@/components/shop/order/logistics';
+ import logisticsVue from '@/components/shop/order/logistics';
+ // 仓库
+ const store = useStore();
+ // 订单详情
+ const detail = reactive({
+ createTime: '',
+ coutDownTime: '',
+ // 订单商品列表信息
+ orderDetailList: [],
+ // 物流信息
+ logistics: {
+ info: [],
+ },
+ })
+ // 物流信息
+ const logistics = computed(() => detail.logistics.info ? detail.logistics.info[0] : {
+ logisticsTraceDetailList: []
+ })
+ // 订单id
+ const orderId = ref('')
// 当前模式 select选择 form表单
const mode = ref('select')
// 类型列表
const typeList = reactive([{
+ type: 1,
name: '我要退款(无需退货)',
- text: '未收到货,活鱼商家协商之后申请',
+ text: '未收到货,或与商家协商之后申请',
},
{
+ type: 2,
name: '已收到货,我要退货退款',
text: '已收到货,需要退还已收到的货物',
},
@@ -23,14 +59,62 @@
// 退款列表
const typeIndex = ref('')
// 申请原因列表
- const reasonList = reactive([{
- name: '不想要了',
- }, {
- name: '买错了',
- }])
+ const reasonList = reactive([])
// 申请原因下标
const reasonIndex = ref('')
+ // 表单
+ const form = reactive({
+ // 退款说明
+ refundReasonContent: '',
+ // 退款图片
+ refundReasonWapImg: [],
+ })
+ // 用户信息
+ const userinfo = computed(() => store.state.userinfo)
+ onLoad((option) => {
+ if (option.orderId) orderId.value = option.orderId
+ // 获取订单详情
+ getDetail()
+ // 获取分类字典
+ getDictList()
+ })
+
+ // 获取分类字典
+ function getDictList() {
+ api.getDict({
+ path: ['refund_reason'],
+ }).then(res => {
+ if (res.code == 200) {
+ Object.assign(reasonList, {}, res.data)
+ return
+ }
+ util.alert({
+ content: res.msg,
+ showCancel: false,
+ })
+ })
+ }
+
+ // 获取订单详情
+ function getDetail() {
+ api.shop.getOrderDetail({
+ query: {
+ id: orderId.value
+ }
+ }).then(res => {
+ if (res.code == 200) {
+ let result = res.data
+ result.status = Number(result.status)
+ Object.assign(detail, {}, result)
+ return
+ }
+ util.alert({
+ content: res.msg,
+ showCancel: false,
+ })
+ })
+ }
/**
* 选择售后
* @param {Object} index 选择的下标
@@ -43,13 +127,97 @@
title: '申请售后',
})
}
+
+ /**
+ * 原因切换
+ * @param {Object} event 默认事件
+ */
+ function handleReason(event) {
+ let index = event.detail.value
+ if (reasonIndex.value === index) return
+ reasonIndex.value = index
+ }
+
+ // 图片上传
+ function uploadImg() {
+ util.upload_image({
+ count: 1,
+ success: (res) => {
+ form.refundReasonWapImg.push(res.value)
+ }
+ })
+ }
+
+ /**
+ * @param {Object} index
+ */
+ function handleRemoveImg(index) {
+ util.alert({
+ content: '确定删除该图片吗?',
+ success: (res) => {
+ if (!res.confirm) return
+ form.refundReasonWapImg.splice(index, 1)
+ }
+ })
+ }
+
+ /**
+ * 订单发起售后
+ * @param {Object} event 事件对象
+ */
+ function handleSubmit() {
+ const data = {
+ ...form
+ }
+
+ // 验证必填项
+ if (reasonIndex.value === '') {
+ util.alert('请选择退款原因')
+ return
+ }
+ if (!data.refundReasonContent) {
+ util.alert('申请说明不能为空')
+ return
+ }
+ // 图片
+ if (data.refundReasonWapImg) data.refundReasonWapImg = data.refundReasonWapImg.join(',')
+
+ //
+ api.shop.orderAfterSales({
+ data: {
+ // 订单
+ orderId: detail.id,
+ // 售后类型:1-仅退款,2-退货退款
+ afterSalesType: typeList[typeIndex.value].type,
+ // 退款原因-数据字典refund_reason
+ refundReasonWap: reasonList[reasonIndex.value].dictLabel,
+ // 退款图片
+ refundReasonWapImg: data.refundReasonWapImg,
+ // 退款内容
+ refundReasonContent: data.refundReasonContent,
+ },
+ }).then(res => {
+ return
+ if (res.code == 200) {
+ // 触发自定义事件
+ uni.$off('updateOrderList')
+ uni.$off('updateOrderDetail')
+ uni.navigateBack()
+ return
+ }
+ util.alert({
+ content: res.msg,
+ showCancel: false,
+ })
+ })
+ }
-
+
@@ -67,33 +235,29 @@
-
-
-
+
+
+
+
+
+ {{item.productName}}
+ 升级款 {{item.sku}}
-
-
-
- 靠枕 纯棉靠枕 车载居家 纯棉100% 卡通靠枕 人体工学
- 款式:普通款 小熊
-
-
-
+
-
+
¥
- 89
+ {{item.price}}
- x 1
+ x{{item.payNum}}
-
+
申请类型
{{typeList[typeIndex].name}}
@@ -103,11 +267,11 @@
-
+
申请原因
- {{reasonList[reasonIndex].name}}
+ {{reasonList[reasonIndex].dictLabel}}
点击选择申请原因
@@ -121,7 +285,8 @@
申请金额
¥
-
+ {{detail.totalPrice}}
+
@@ -129,10 +294,16 @@
申请说明
+ v-model="form.refundReasonContent" placeholder-class="placeholderStyle" auto-height="true" />
-
+
+
+
+
+
+
+
@@ -141,14 +312,14 @@
联系电话
- 13979897890
+ {{userinfo.phoneNumber}}
- 提交申请
+ 提交申请
diff --git a/jiuyi2/vite.config.js b/jiuyi2/vite.config.js
index 79477fbd..693b5bfd 100644
--- a/jiuyi2/vite.config.js
+++ b/jiuyi2/vite.config.js
@@ -5,7 +5,7 @@ import uni from '@dcloudio/vite-plugin-uni';
//
// let target = 'http://101.35.80.139:8080'
-let target = 'http://2h34ni.natappfree.cc'
+let target = 'http://8ii5rt.natappfree.cc'
export default defineConfig({
plugins: [uni()],