From 5392dc649209ff372ec276aa6cbf86b16b12a375 Mon Sep 17 00:00:00 2001
From: 周宾 <2802492122@qq.com>
Date: 星期五, 26 十二月 2025 16:41:16 +0800
Subject: [PATCH] 天津双奇点-仓储物流板块开发
---
src/pages/inventoryManagement/receiptManagement/edit.vue | 94 ++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 89 insertions(+), 5 deletions(-)
diff --git a/src/pages/inventoryManagement/receiptManagement/edit.vue b/src/pages/inventoryManagement/receiptManagement/edit.vue
index 4a2438d..2060ea8 100644
--- a/src/pages/inventoryManagement/receiptManagement/edit.vue
+++ b/src/pages/inventoryManagement/receiptManagement/edit.vue
@@ -2,15 +2,18 @@
<PageHeader :title="pageTitle" @back="goBack" />
<view class="account-detail">
<view class="box">
- <view v-if="type == 'add'">
+ <view v-if="type == 'add'" style="margin-bottom: 20rpx;">
<button class="mini-btn" type="primary" size="mini" style="margin-left: 0;margin-right: 0;"
@click="addItem">鏂板</button>
</view>
<view v-for="(item, index) in goodsList" class="form-box">
+ <button v-if="type == 'add'" class="mini-btn del-btn" type="warn" size="mini" style="margin-left: 0;margin-right: 0;"
+ @click="delItem(index)">鍒犻櫎</button>
<uni-forms :key="index" label-position="top" label-width="400rpx">
<uni-forms-item label="浜у搧鍥剧墖" required>
<view class="add-img">
- <image v-if="item.url" class="img" :src="baseUrl + item.url" mode="aspectFill" />
+ <image v-if="item.url" class="img" :src="baseUrl + item.url" mode="aspectFill"
+ @click="addImg(index)" />
<uni-icons v-else type="camera-filled" size="56" style="color: #8a8a8a"
@click="addImg(index)"></uni-icons>
</view>
@@ -33,8 +36,11 @@
<uni-forms-item label="姣忎欢鏁伴噺/鏀�" required>
<uni-number-box v-model="item.boxNum" :min="0"></uni-number-box>
</uni-forms-item>
- <uni-forms-item label="鍗曚环锛堝厓锛�/鏀�" required>
+ <uni-forms-item label="鍗曚环锛堝厓锛�/浠�" required>
<uni-number-box v-model="item.taxInclusiveUnitPrice" :min="0" :step="0.01"></uni-number-box>
+ </uni-forms-item>
+ <uni-forms-item label="鍗曚环锛堢編鍏冿級/浠�" required>
+ <uni-number-box v-model="item.dollarPrice" :min="0" :step="0.01"></uni-number-box>
</uni-forms-item>
<uni-forms-item label="鍏ュ簱鏃ユ湡" required>
<uni-datetime-picker type="date" :clear-icon="false" v-model="item.inboundDate" />
@@ -55,7 +61,7 @@
import { getToken } from "@/utils/auth";
import { addCustom } from '@/api/inventoryManagement/receiptManagement.js'
import config from '@/config'
-const baseUrl = config.baseUrl
+const baseUrl = config.imgUrl
const pageTitle = ref('鏂板鑷畾涔夊叆搴�')
const goodsList = ref([])
const type = ref('add')
@@ -73,6 +79,7 @@
taxExclusiveTotalPrice: 0,
taxInclusiveTotalPrice: 0,
taxInclusiveUnitPrice: 0,
+ dollarPrice: 0,
taxRate: 0,
unit: "",
url: "",
@@ -81,7 +88,64 @@
const goBack = () => {
uni.navigateBack()
}
+const showToast = (msg)=>{
+ uni.showToast({
+ title: msg,
+ icon: 'none',
+ duration: 1500
+ })
+}
const submitForm = async() => {
+ if (!goodsList.value.length) {
+ showToast('璇疯嚦灏戞坊鍔犱竴鏉′骇鍝佹暟鎹�')
+ return
+ }
+
+ // 楠岃瘉鑷畾涔夋坊鍔犵殑鏁版嵁蹇呭~瀛楁
+ for (let i = 0; i < goodsList.value.length; i++) {
+ const product = goodsList.value[i];
+ if (!product.productCategory || !product.specificationModel || !product.unit) {
+ showToast(`绗�${i + 1}琛屼骇鍝佹暟鎹湭濉啓瀹屾暣锛堜骇鍝併�佷骇鍝侀珮搴︺�侀珮搴﹀崟浣嶄负蹇呭~锛塦)
+ return
+ }
+ if (!product.url) {
+ showToast(`绗�${i + 1}琛屼骇鍝佹湭涓婁紶浜у搧鍥剧墖`)
+ return
+ }
+ if (!product.cartonSpecifications) {
+ showToast(`绗�${i + 1}琛屼骇鍝佹湭濉啓绾哥瑙勬牸`)
+ return
+ }
+ // if (!product.itemType) {
+ // proxy.$modal.msgError(`绗�${i + 1}琛岃閫夋嫨鐗╁搧绫诲瀷`)
+ // return
+ // }
+ const stock = Number(product?.inboundNum ?? 0);
+ if (!Number.isFinite(stock) || stock <= 0) {
+ showToast(`绗�${i + 1}琛屾湰娆″叆搴撴暟閲忛渶澶т簬0`)
+ return
+ }
+ const boxNum = Number(product?.boxNum ?? 0);
+ if (!Number.isFinite(boxNum) || boxNum <= 0) {
+ showToast(`绗�${i + 1}琛屾瘡浠舵暟閲�/鏀渶澶т簬0`)
+ return
+ }
+ const taxInclusiveUnitPrice = Number(product?.taxInclusiveUnitPrice ?? 0);
+ if (!Number.isFinite(taxInclusiveUnitPrice) || taxInclusiveUnitPrice <= 0) {
+ showToast(`绗�${i + 1}琛屽崟浠凤紙鍏冿級闇�澶т簬0`)
+ return
+ }
+ const dollarPrice = Number(product?.dollarPrice ?? 0);
+ if (!Number.isFinite(dollarPrice) || dollarPrice <= 0) {
+ showToast(`绗�${i + 1}琛屽崟浠凤紙缇庡厓锛夐渶澶т簬0`)
+ return
+ }
+ if (!product.inboundDate) {
+ showToast(`绗�${i + 1}琛岃閫夋嫨鍏ュ簱鏃ユ湡`)
+ return
+ }
+
+ }
let res = await addCustom(goodsList.value)
if(res.code !== 200){
uni.showToast({
@@ -128,6 +192,9 @@
if (e.errMsg == 'chooseMedia:fail cancel') {
return
}
+ if (e.errMsg == 'user cancel') {
+ return
+ }
uni.showToast({
title: "涓婁紶澶辫触",
icon: 'none',
@@ -135,6 +202,10 @@
})
}
})
+}
+const delItem = (index)=>{
+ console.log('xxxx')
+ goodsList.value.splice(index,1)
}
const UploadImage = (url, index) => {
uni.uploadFile({
@@ -194,8 +265,21 @@
box-sizing: border-box;
margin-bottom: 20rpx;
padding: 20rpx;
- background-color: #f5f5f5;
+ // background-color: #f5f5f5;
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
+ transition: box-shadow 0.3s ease;
border-radius: 20rpx;
+ position: relative;
+ .del-btn{
+ position: absolute;
+ right: 20rpx;
+ top: 40rpx;
+ z-index: 40;
+ }
+}
+
+.form-box:hover {
+ box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.add-img {
--
Gitblit v1.9.3