评论商品接口有问题
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
import { formatRMB } from '@/utils'
|
||||
import { getUserAddress } from '@/api'
|
||||
import { getUserPayPwd } from '@/api/my-index'
|
||||
import { navigateTo, redirectTo } from '@/utils/router'
|
||||
import { navigateTo, navigateBack, redirectTo } from '@/utils/router'
|
||||
import { useUI } from '@/utils/use-ui'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
|
||||
const viewData = ref({})
|
||||
|
||||
/** 分享二维码进入 拼团ID */
|
||||
const groupId = ref('')
|
||||
/** 单价 */
|
||||
const priceData = ref(0)
|
||||
const formData = reactive({
|
||||
@@ -40,6 +42,7 @@
|
||||
loading: true
|
||||
})
|
||||
const tixian = ref(null)
|
||||
const originalPrice = ref(0)
|
||||
|
||||
/** 获取用户地址 */
|
||||
const userRess = async () => {
|
||||
@@ -62,9 +65,13 @@
|
||||
const getData = async productId => {
|
||||
const res = await getProductDetail(productId)
|
||||
viewData.value = res.data
|
||||
const { id, price, stockQuantity } = res.data.skuList.find(
|
||||
v => v.isDefault == 1
|
||||
)
|
||||
const {
|
||||
id,
|
||||
price,
|
||||
stockQuantity,
|
||||
originalPrice: nub
|
||||
} = res.data.skuList.find(v => v.isDefault == 1)
|
||||
originalPrice.value = nub
|
||||
formData.maxNum = stockQuantity
|
||||
formData.spec = id
|
||||
priceData.value = price
|
||||
@@ -83,6 +90,7 @@
|
||||
formData.total = item.price
|
||||
priceData.value = item.price
|
||||
formData.maxNum = item.stockQuantity
|
||||
originalPrice.value = item.originalPrice
|
||||
}
|
||||
|
||||
// 提交订单
|
||||
@@ -104,6 +112,7 @@
|
||||
|
||||
const submit = async e => {
|
||||
const data = {
|
||||
groupId: groupId.value,
|
||||
payPassword: e.join(''),
|
||||
addressId: topRessData.id,
|
||||
productId: viewData.value.id,
|
||||
@@ -114,10 +123,8 @@
|
||||
tixian.value.close()
|
||||
const res = await addOrder(data)
|
||||
await refreshUserInfo()
|
||||
redirectTo('/pages/shop-together/detail', {
|
||||
id: res.data.groupId,
|
||||
type: 'add'
|
||||
})
|
||||
await showToast('订单提交成功', 'success')
|
||||
navigateBack()
|
||||
}
|
||||
|
||||
onShow(() => {
|
||||
@@ -125,6 +132,7 @@
|
||||
})
|
||||
|
||||
onLoad(async e => {
|
||||
groupId.value = e?.groupId || ''
|
||||
await getData(e.productId)
|
||||
})
|
||||
</script>
|
||||
@@ -165,7 +173,7 @@
|
||||
</text>
|
||||
<view class="line-box">
|
||||
<view class="rmb-box">
|
||||
<text>¥{{ viewData.originalPrice || '' }}</text>
|
||||
<text>¥{{ originalPrice }}</text>
|
||||
<text>¥{{ priceData }}</text>
|
||||
</view>
|
||||
<!-- 添加数量 -->
|
||||
|
||||
Reference in New Issue
Block a user