需要一个普通订单列表跟详情入口

This commit is contained in:
bobobobo
2026-01-29 00:57:07 +08:00
parent 41c1e5ba89
commit 256135f15b
6 changed files with 55 additions and 10 deletions

View File

@@ -1,6 +1,6 @@
<script setup>
import { onLoad, onShow } from '@dcloudio/uni-app'
import { getProductDetail, addOrder } from '@/api/mall'
import { getProductDetail, addOrder, createOrder } from '@/api/mall'
import { reactive, ref } from 'vue'
import { formatRMB } from '@/utils'
import { getUserAddress } from '@/api'
@@ -30,7 +30,9 @@
/** 默认地址 */
address: '',
/** 可选数量 */
maxNum: 1
maxNum: 1,
/** 是否发起拼团 */
startGroup: true
})
/** 顶部地址信息 */
const topRessData = reactive({
@@ -140,10 +142,17 @@
skuId: formData.spec
}
tixian.value.close()
const res = await addOrder(data)
await refreshUserInfo()
await showToast('订单提交成功', 'success')
navigateTo('/pages/shop-together/detail', { id: res.data.groupId })
if (formData.startGroup) {
const res = await addOrder(data)
await refreshUserInfo()
await showToast('订单提交成功', 'success')
navigateTo('/pages/shop-together/detail', { id: res.data.groupId })
} else {
const res = await createOrder(data)
await refreshUserInfo()
await showToast('订单提交成功', 'success')
navigateBack()
}
}
onShow(() => {
@@ -256,6 +265,29 @@
></image>
</view>
</view>
<view
class="pay-way-item"
@click="formData.startGroup = !formData.startGroup"
>
<view class="icon">
<image
src="/static/images/public/pingtuan.png"
mode="aspectFit"
class="left-icon"
></image>
<text>发起拼团</text>
</view>
<view class="check">
<image
v-show="formData.startGroup"
src="/static/images/public/check-to-confirm.png"
mode="aspectFit"
class="check-icon"
></image>
</view>
</view>
</view>
<!-- 底部按钮 -->

View File

@@ -126,6 +126,10 @@
border-radius: 32rpx;
background: #ffffff;
margin-bottom: 110rpx;
.pay-way-item + .pay-way-item {
border-top: 2rpx solid #e6e6e6;
box-sizing: border-box;
}
.pay-way-item {
padding: 32rpx;
display: flex;