支持取消发货
This commit is contained in:
parent
449a91e582
commit
a2cffa84f0
@ -94,6 +94,10 @@ export function requestShipping(user_id, ids) {
|
||||
return authRequest({ url: `/api/app/users/${user_id}/inventory/request-shipping`, method: 'POST', data: { inventory_ids: ids } })
|
||||
}
|
||||
|
||||
export function cancelShipping(user_id, batch_no) {
|
||||
return authRequest({ url: `/api/app/users/${user_id}/inventory/cancel-shipping`, method: 'POST', data: { batch_no } })
|
||||
}
|
||||
|
||||
export function getItemCards(user_id, status) {
|
||||
const data = {}
|
||||
if (status !== undefined) data.status = status
|
||||
|
||||
@ -75,8 +75,11 @@
|
||||
<text class="batch-no" v-if="item.batch_no">{{ item.batch_no }}</text>
|
||||
<view class="count-badge">{{ item.count }}件商品</view>
|
||||
</view>
|
||||
<view class="shipment-status" :class="getStatusClass(item.status)">
|
||||
{{ getStatusText(item.status) }}
|
||||
<view class="shipment-actions">
|
||||
<view class="shipment-status" :class="getStatusClass(item.status)">
|
||||
{{ getStatusText(item.status) }}
|
||||
</view>
|
||||
<text class="shipment-cancel" v-if="Number(item.status) === 1 && item.batch_no" @tap="onCancelShipping(item)">取消发货</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@ -134,7 +137,7 @@
|
||||
<script setup>
|
||||
import { ref, computed } from 'vue'
|
||||
import { onShow, onReachBottom } from '@dcloudio/uni-app'
|
||||
import { getInventory, getProductDetail, redeemInventory, requestShipping, listAddresses, getShipments } from '@/api/appUser'
|
||||
import { getInventory, getProductDetail, redeemInventory, requestShipping, cancelShipping, listAddresses, getShipments } from '@/api/appUser'
|
||||
|
||||
const currentTab = ref(0)
|
||||
const aggregatedList = ref([])
|
||||
@ -717,6 +720,33 @@ async function onShip() {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function onCancelShipping(shipment) {
|
||||
const user_id = uni.getStorageSync('user_id')
|
||||
const batchNo = shipment && shipment.batch_no
|
||||
if (!user_id || !batchNo) return
|
||||
uni.showModal({
|
||||
title: '取消发货',
|
||||
content: `确认取消发货单 ${batchNo} 吗?`,
|
||||
confirmText: '确认取消',
|
||||
success: async (res) => {
|
||||
if (!res.confirm) return
|
||||
uni.showLoading({ title: '处理中...' })
|
||||
try {
|
||||
await cancelShipping(user_id, batchNo)
|
||||
uni.showToast({ title: '已取消发货', icon: 'success' })
|
||||
page.value = 1
|
||||
hasMore.value = true
|
||||
shippedList.value = []
|
||||
await loadShipments(user_id)
|
||||
} catch (e) {
|
||||
uni.showToast({ title: e?.message || '取消失败', icon: 'none' })
|
||||
} finally {
|
||||
uni.hideLoading()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@ -1047,6 +1077,12 @@ async function onShip() {
|
||||
padding-bottom: 20rpx;
|
||||
border-bottom: 1rpx solid rgba(0,0,0,0.05);
|
||||
}
|
||||
.shipment-actions {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
gap: 10rpx;
|
||||
}
|
||||
.shipment-batch {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@ -1080,6 +1116,13 @@ async function onShip() {
|
||||
&.status-delivered { background: #F6FFED; color: #52C41A; }
|
||||
&.status-cancelled { background: #F5F5F5; color: #999; }
|
||||
}
|
||||
.shipment-cancel {
|
||||
font-size: 22rpx;
|
||||
color: $text-sub;
|
||||
padding: 6rpx 14rpx;
|
||||
border-radius: 20rpx;
|
||||
background: rgba(0,0,0,0.04);
|
||||
}
|
||||
|
||||
.product-thumbnails {
|
||||
margin-bottom: 24rpx;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user