|
@@ -177,12 +177,12 @@
|
|
|
|
|
|
|
|
<!-- 协议同意 -->
|
|
<!-- 协议同意 -->
|
|
|
<view class="agreement-card">
|
|
<view class="agreement-card">
|
|
|
- <view class="agreement-item">
|
|
|
|
|
|
|
+ <!-- <view class="agreement-item">
|
|
|
<checkbox color="#1B64F0" :checked="agreed" @click="toggleAgreement" style="transform:scale(0.8)" />
|
|
<checkbox color="#1B64F0" :checked="agreed" @click="toggleAgreement" style="transform:scale(0.8)" />
|
|
|
<text class="agreement-text">我已理解并同意遵守《快件服务协议》</text>
|
|
<text class="agreement-text">我已理解并同意遵守《快件服务协议》</text>
|
|
|
- </view>
|
|
|
|
|
|
|
+ </view> -->
|
|
|
<view class="price-notice">
|
|
<view class="price-notice">
|
|
|
- 实际费用以快递员核实为准,四舍五入取整
|
|
|
|
|
|
|
+ 实际费用以快递员核实为准
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
@@ -249,7 +249,7 @@
|
|
|
|
|
|
|
|
// ==================== 物品信息 ====================
|
|
// ==================== 物品信息 ====================
|
|
|
const goodsInfo = ref('')
|
|
const goodsInfo = ref('')
|
|
|
- const weight = ref(1)
|
|
|
|
|
|
|
+ const weight = ref(0.5)
|
|
|
const volume = ref(0.001)
|
|
const volume = ref(0.001)
|
|
|
const quantity = ref(1)
|
|
const quantity = ref(1)
|
|
|
|
|
|
|
@@ -345,17 +345,17 @@
|
|
|
])
|
|
])
|
|
|
|
|
|
|
|
// ==================== 协议 ====================
|
|
// ==================== 协议 ====================
|
|
|
- const agreed = ref(false)
|
|
|
|
|
|
|
+ const agreed = ref(true)
|
|
|
|
|
|
|
|
// ==================== 表单操作 ====================
|
|
// ==================== 表单操作 ====================
|
|
|
// 重量
|
|
// 重量
|
|
|
const increaseWeight = () => {
|
|
const increaseWeight = () => {
|
|
|
- weight.value = parseFloat((weight.value + 0.5).toFixed(3))
|
|
|
|
|
|
|
+ weight.value = parseFloat((weight.value + 0.1).toFixed(3))
|
|
|
if (weight.value > 100) weight.value = 100
|
|
if (weight.value > 100) weight.value = 100
|
|
|
}
|
|
}
|
|
|
const decreaseWeight = () => {
|
|
const decreaseWeight = () => {
|
|
|
- weight.value = parseFloat((weight.value - 0.5).toFixed(3))
|
|
|
|
|
- if (weight.value < 0.5) weight.value = 0.5
|
|
|
|
|
|
|
+ weight.value = parseFloat((weight.value - 0.1).toFixed(3))
|
|
|
|
|
+ if (weight.value < 0.1) weight.value = 0.1
|
|
|
}
|
|
}
|
|
|
const handleWeightInput = (e) => {
|
|
const handleWeightInput = (e) => {
|
|
|
let value = e.detail.value.replace(/[^\d.]/g, '')
|
|
let value = e.detail.value.replace(/[^\d.]/g, '')
|
|
@@ -365,14 +365,14 @@
|
|
|
const decimal = value.split('.')[1]
|
|
const decimal = value.split('.')[1]
|
|
|
if (decimal && decimal.length > 3) value = parseFloat(value).toFixed(3)
|
|
if (decimal && decimal.length > 3) value = parseFloat(value).toFixed(3)
|
|
|
}
|
|
}
|
|
|
- const num = parseFloat(value) || 0.5
|
|
|
|
|
- weight.value = Math.max(0.5, Math.min(100, num))
|
|
|
|
|
|
|
+ const num = parseFloat(value) || 0.1
|
|
|
|
|
+ weight.value = Math.max(0.1, Math.min(100, num))
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 体积
|
|
// 体积
|
|
|
const increaseVolume = () => {
|
|
const increaseVolume = () => {
|
|
|
volume.value = parseFloat((volume.value + 0.001).toFixed(3))
|
|
volume.value = parseFloat((volume.value + 0.001).toFixed(3))
|
|
|
- if (volume.value > 10) volume.value = 10
|
|
|
|
|
|
|
+ // if (volume.value > 10) volume.value = 10
|
|
|
}
|
|
}
|
|
|
const decreaseVolume = () => {
|
|
const decreaseVolume = () => {
|
|
|
volume.value = parseFloat((volume.value - 0.001).toFixed(3))
|
|
volume.value = parseFloat((volume.value - 0.001).toFixed(3))
|
|
@@ -393,7 +393,7 @@
|
|
|
// 件数
|
|
// 件数
|
|
|
const increaseQuantity = () => {
|
|
const increaseQuantity = () => {
|
|
|
quantity.value += 1
|
|
quantity.value += 1
|
|
|
- if (quantity.value > 99) quantity.value = 99
|
|
|
|
|
|
|
+ // if (quantity.value > 99) quantity.value = 99
|
|
|
}
|
|
}
|
|
|
const decreaseQuantity = () => {
|
|
const decreaseQuantity = () => {
|
|
|
quantity.value -= 1
|
|
quantity.value -= 1
|
|
@@ -402,7 +402,7 @@
|
|
|
const handleQuantityInput = (e) => {
|
|
const handleQuantityInput = (e) => {
|
|
|
let value = e.detail.value.replace(/\D/g, '')
|
|
let value = e.detail.value.replace(/\D/g, '')
|
|
|
const int = parseInt(value) || 1
|
|
const int = parseInt(value) || 1
|
|
|
- quantity.value = Math.max(1, Math.min(99, int))
|
|
|
|
|
|
|
+ // quantity.value = Math.max(1, Math.min(99, int))
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 物品信息
|
|
// 物品信息
|
|
@@ -667,9 +667,12 @@
|
|
|
return true
|
|
return true
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ const isSubmit = ref(false)
|
|
|
// ==================== 提交订单 ====================
|
|
// ==================== 提交订单 ====================
|
|
|
const submitOrder = async () => {
|
|
const submitOrder = async () => {
|
|
|
if (!validateForm()) return
|
|
if (!validateForm()) return
|
|
|
|
|
+ if (isSubmit.value) return
|
|
|
|
|
+ isSubmit.value = true
|
|
|
|
|
|
|
|
// 构建增值服务JSON
|
|
// 构建增值服务JSON
|
|
|
const addedService = {
|
|
const addedService = {
|
|
@@ -716,35 +719,38 @@
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
uni.showLoading({
|
|
uni.showLoading({
|
|
|
- title: '提交中...'
|
|
|
|
|
|
|
+ title: '提交中...',
|
|
|
|
|
+ mask:true
|
|
|
})
|
|
})
|
|
|
try {
|
|
try {
|
|
|
const res = await createOrder(orderData)
|
|
const res = await createOrder(orderData)
|
|
|
- uni.hideLoading()
|
|
|
|
|
|
|
+ // uni.hideLoading()
|
|
|
if (res.code === 200) {
|
|
if (res.code === 200) {
|
|
|
uni.showToast({
|
|
uni.showToast({
|
|
|
title: '下单成功',
|
|
title: '下单成功',
|
|
|
icon: 'success',
|
|
icon: 'success',
|
|
|
mask: true
|
|
mask: true
|
|
|
})
|
|
})
|
|
|
- setTimeout(() => {
|
|
|
|
|
- uni.navigateTo({
|
|
|
|
|
- url: '/pages/order/index'
|
|
|
|
|
- })
|
|
|
|
|
- }, 1000)
|
|
|
|
|
|
|
+ uni.redirectTo({
|
|
|
|
|
+ url: '/pages/order/index'
|
|
|
|
|
+ })
|
|
|
} else {
|
|
} else {
|
|
|
|
|
+ isSubmit.value = false
|
|
|
uni.showToast({
|
|
uni.showToast({
|
|
|
title: res.msg || '下单失败',
|
|
title: res.msg || '下单失败',
|
|
|
icon: 'none'
|
|
icon: 'none'
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
|
|
+ isSubmit.value = false
|
|
|
uni.hideLoading()
|
|
uni.hideLoading()
|
|
|
uni.showToast({
|
|
uni.showToast({
|
|
|
title: '网络错误,请重试',
|
|
title: '网络错误,请重试',
|
|
|
icon: 'none'
|
|
icon: 'none'
|
|
|
})
|
|
})
|
|
|
console.error('订单提交失败', error)
|
|
console.error('订单提交失败', error)
|
|
|
|
|
+ } finally{
|
|
|
|
|
+ uni.hideLoading()
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -782,6 +788,9 @@
|
|
|
saveAddressToStorage('receiverAddress', data.address)
|
|
saveAddressToStorage('receiverAddress', data.address)
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
|
|
+ if(!addressSend.addressId){
|
|
|
|
|
+ fetchDefaultSenderAddress()
|
|
|
|
|
+ }
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
// 组件卸载时取消监听
|
|
// 组件卸载时取消监听
|