支持取消发货
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 } })
|
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) {
|
export function getItemCards(user_id, status) {
|
||||||
const data = {}
|
const data = {}
|
||||||
if (status !== undefined) data.status = status
|
if (status !== undefined) data.status = status
|
||||||
|
|||||||
@ -75,8 +75,11 @@
|
|||||||
<text class="batch-no" v-if="item.batch_no">{{ item.batch_no }}</text>
|
<text class="batch-no" v-if="item.batch_no">{{ item.batch_no }}</text>
|
||||||
<view class="count-badge">{{ item.count }}件商品</view>
|
<view class="count-badge">{{ item.count }}件商品</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="shipment-status" :class="getStatusClass(item.status)">
|
<view class="shipment-actions">
|
||||||
{{ getStatusText(item.status) }}
|
<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>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@ -134,7 +137,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed } from 'vue'
|
import { ref, computed } from 'vue'
|
||||||
import { onShow, onReachBottom } from '@dcloudio/uni-app'
|
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 currentTab = ref(0)
|
||||||
const aggregatedList = ref([])
|
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>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@ -1047,6 +1077,12 @@ async function onShip() {
|
|||||||
padding-bottom: 20rpx;
|
padding-bottom: 20rpx;
|
||||||
border-bottom: 1rpx solid rgba(0,0,0,0.05);
|
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 {
|
.shipment-batch {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@ -1080,6 +1116,13 @@ async function onShip() {
|
|||||||
&.status-delivered { background: #F6FFED; color: #52C41A; }
|
&.status-delivered { background: #F6FFED; color: #52C41A; }
|
||||||
&.status-cancelled { background: #F5F5F5; color: #999; }
|
&.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 {
|
.product-thumbnails {
|
||||||
margin-bottom: 24rpx;
|
margin-bottom: 24rpx;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user