评论需要添加功能,提交订单有问题
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<script setup>
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app'
|
||||
import { getProductDetail } from '@/api/mall'
|
||||
import { reactive, ref } from 'vue'
|
||||
import { formatRMB } from '@/utils'
|
||||
@@ -24,16 +24,33 @@
|
||||
/** 可选数量 */
|
||||
maxNum: 1
|
||||
})
|
||||
/** 顶部地址信息 */
|
||||
const topRessData = reactive({
|
||||
name: '',
|
||||
houseNum: '',
|
||||
id: '',
|
||||
phone: '',
|
||||
state: false,
|
||||
loading: true
|
||||
})
|
||||
|
||||
/** 获取用户地址 */
|
||||
const userRess = async () => {
|
||||
const res = await getUserAddress()
|
||||
console.log(res)
|
||||
topRessData.loading = true
|
||||
const res = await getUserAddress({ pageNum: 1, pageSize: 99 }, false)
|
||||
const data = res.rows.find(v => v.defaultAddress == 1)
|
||||
console.log(data, '地址数据===')
|
||||
topRessData.state = !data?.id
|
||||
topRessData.name = data?.name || ''
|
||||
topRessData.houseNum = data?.houseNum || ''
|
||||
topRessData.id = data?.id || ''
|
||||
topRessData.phone = data?.phone || ''
|
||||
topRessData.loading = false
|
||||
}
|
||||
|
||||
/** 用户地址跳转 */
|
||||
const onRess = () => {
|
||||
navigateTo('/pages/address/add')
|
||||
navigateTo('/pages/address/index')
|
||||
}
|
||||
|
||||
const getData = async productId => {
|
||||
@@ -46,6 +63,7 @@
|
||||
formData.spec = id
|
||||
priceData.value = price
|
||||
formData.total = price
|
||||
console.log('111111111111111111111')
|
||||
}
|
||||
|
||||
/** 数量切换 */
|
||||
@@ -63,10 +81,20 @@
|
||||
}
|
||||
|
||||
// 提交订单
|
||||
const onConfirm = () => {}
|
||||
const onConfirm = () => {
|
||||
const data = {
|
||||
addressId: topRessData.id,
|
||||
productId: viewData.value.id,
|
||||
quantity: formData.num
|
||||
}
|
||||
console.log(data, '提交订单')
|
||||
}
|
||||
|
||||
onShow(() => {
|
||||
userRess()
|
||||
})
|
||||
|
||||
onLoad(async e => {
|
||||
await userRess()
|
||||
await getData(e.productId)
|
||||
})
|
||||
</script>
|
||||
@@ -75,16 +103,16 @@
|
||||
<view class="mall-confirm-order">
|
||||
<!-- 地址 -->
|
||||
<view class="address-box" @click="onRess">
|
||||
<view class="left-name">
|
||||
<text class="adres">重庆沙坪坝龙湖光年4号楼3009</text>
|
||||
<text v-if="topRessData.state" class="wu-adres">
|
||||
暂无收货/默认地址(点击添加)
|
||||
</text>
|
||||
<view v-else class="left-name">
|
||||
<text class="adres">{{ topRessData.houseNum }}</text>
|
||||
<view class="bottom-name">
|
||||
<text>名字</text>
|
||||
<text>137******</text>
|
||||
<text>{{ topRessData.name }}</text>
|
||||
<text>{{ topRessData.phone }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <text class="wu-adres">
|
||||
暂无收货地址(点击添加)
|
||||
</text> -->
|
||||
<image
|
||||
src="/static/images/public/right-arrow.png"
|
||||
mode="heightFix"
|
||||
|
||||
Reference in New Issue
Block a user