From b54a94b098a5a0a3375bab0d6493bacf45dd0a58 Mon Sep 17 00:00:00 2001
From: 周宾 <2802492122@qq.com>
Date: 星期五, 26 十二月 2025 18:08:55 +0800
Subject: [PATCH] 天津双奇点-仓储物流增加产品名称搜索
---
src/pages/inventoryManagement/receiptManagement/procurement-edit.vue | 274 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 274 insertions(+), 0 deletions(-)
diff --git a/src/pages/inventoryManagement/receiptManagement/procurement-edit.vue b/src/pages/inventoryManagement/receiptManagement/procurement-edit.vue
new file mode 100644
index 0000000..d9c4976
--- /dev/null
+++ b/src/pages/inventoryManagement/receiptManagement/procurement-edit.vue
@@ -0,0 +1,274 @@
+<template>
+ <PageHeader :title="pageTitle" @back="goBack" />
+ <view class="account-detail">
+ <view class="box">
+ <view style="margin-bottom: 20rpx;">
+ <uni-data-select v-model="ledgerVlaue" :localdata="ledgerList" placeholder="璇烽�夋嫨閲囪喘璁㈠崟鍙�"
+ :disabled="type == 'edit'" @change="switchLedger"></uni-data-select>
+ </view>
+ <view v-for="(item, index) in goodsList" class="form-box" :key="index">
+ <checkbox-group v-if="type == 'add'" @change="switchCheck(index)">
+ <checkbox value="cb" style="transform:scale(0.7)" />
+ </checkbox-group>
+ <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"
+ @click="addImg(index)" />
+ <uni-icons v-else type="camera-filled" size="56" style="color: #8a8a8a"
+ @click="addImg(index)"></uni-icons>
+ </view>
+ </uni-forms-item> -->
+ <uni-forms-item label="鍚嶇О" required>
+ <uni-easyinput v-model="item.productCategory" placeholder="璇疯緭鍏ュ悕绉�" disabled />
+ </uni-forms-item>
+ <uni-forms-item label="楂樺害" required>
+ <uni-easyinput v-model="item.specificationModel" type="number" placeholder="璇疯緭鍏ラ珮搴�" disabled />
+ </uni-forms-item>
+ <uni-forms-item label="楂樺害鍗曚綅" required>
+ <uni-easyinput v-model="item.unit" placeholder="璇疯緭鍏ラ珮搴﹀崟浣�" disabled />
+ </uni-forms-item>
+ <uni-forms-item label="绾哥瑙勬牸" required>
+ <uni-easyinput v-model="item.cartonSpecifications" placeholder="璇疯緭鍏ョ焊绠辫鏍�"
+ :disabled="type == 'edit'" />
+ </uni-forms-item>
+ <uni-forms-item label="寰呭叆搴撴暟閲�/浠�" required>
+ <uni-number-box v-model="item.quantity0" :min="0" disabled></uni-number-box>
+ </uni-forms-item>
+ <uni-forms-item label="鍏ュ簱鏁伴噺/浠�" required>
+ <uni-number-box v-model="item.quantityStock" :min="0" :max="item.quantity0"></uni-number-box>
+ </uni-forms-item>
+ <uni-forms-item label="姣忎欢鏁伴噺/鏀�" required>
+ <uni-number-box v-model="item.boxNum" :min="0" :disabled="type == 'edit'"></uni-number-box>
+ </uni-forms-item>
+ <uni-forms-item label="鍗曚环锛堝厓锛�/浠�" required>
+ <uni-number-box v-model="item.taxInclusiveUnitPrice" :min="0" :step="0.01"
+ disabled></uni-number-box>
+ </uni-forms-item>
+ <uni-forms-item label="鍗曚环锛堢編鍏冿級/浠�" required>
+ <uni-number-box v-model="item.dollarPrice" :min="0" :step="0.01"
+ :disabled="type == 'edit'"></uni-number-box>
+ </uni-forms-item>
+ </uni-forms>
+ </view>
+ <view style="display: flex;justify-content: flex-end;">
+ <button class="mini-btn" type="primary" size="mini"
+ style="margin-left: 0;margin-right: 0;margin-right: 20rpx;" @click="submitForm">纭畾</button>
+ <button class="mini-btn" size="mini" style="margin-left: 0;margin-right: 0;" @click="goBack">鍙栨秷</button>
+ </view>
+ </view>
+ </view>
+</template>
+
+<script setup>
+import { onMounted, ref } from 'vue'
+import { ledgerListPage, productlist, stockinAdd, stockinUpdate } from '@/api/inventoryManagement/receiptManagement.js'
+import useUserStore from '@/store/modules/user'
+const userStore = useUserStore()
+const pageTitle = ref('鏂板鑷畾涔夊叆搴�')
+const goodsList = ref([])
+const type = ref('add')
+const props = defineProps(['goods'])
+const defaultGoods = {
+ boxNum: 0,
+ cartonSpecifications: "",
+ id: null,
+ inboundDate: "",
+ quantityStock: 0,
+ itemType: "",
+ productCategory: "",
+ specificationModel: "",
+ supplierName: "",
+ taxExclusiveTotalPrice: 0,
+ taxInclusiveTotalPrice: 0,
+ taxInclusiveUnitPrice: 0,
+ dollarPrice: 0,
+ taxRate: 0,
+ unit: "",
+ url: "",
+}
+const switchCheck = (index) => {
+ goodsList.value[index].checked = !goodsList.value[index].checked
+}
+const goBack = () => {
+ uni.navigateBack()
+}
+const submitForm = async () => {
+ let _list = []
+ goodsList.value.map(item => {
+ if (item.checked && type.value == 'add') {
+ item.inboundQuantity = item.quantityStock
+ item.unitPrice = item.taxInclusiveUnitPrice
+ _list.push(item)
+ }
+ if (type.value == 'edit') {
+ _list.push({ ...item, quantityStock: item.inboundNum })
+ }
+ })
+ if (_list.length === 0) {
+ uni.showToast({
+ title: '璇烽�夋嫨瑕佸叆搴撶殑浜у搧',
+ icon: 'none'
+ })
+ return
+ }
+ let pamaes = {
+ }
+ let supplierName = ''
+ ledgerList.value.map((item) => {
+ if (ledgerVlaue.value == item.value) {
+ supplierName = item.supplierName
+ }
+ })
+ if (type.value == 'add') {
+ pamaes = {
+ entryDate: getCurrentDate(),
+ purchaseContractNumber: ledgerVlaue.value,
+ inboundBatch: '',
+ inboundTime: formatDateTime(),
+ nickName: userStore.nickName,
+ remark: '',
+ supplierId: null,
+ supplierName: supplierName,
+ recorderName: userStore.name,
+ id: null,
+ details: _list
+ }
+ } else {
+ pamaes = {
+ id: _list[0].id,
+ quantityStock: _list[0].quantityStock
+ }
+ }
+ console.log('pamaes', pamaes)
+ let requiredApi = ''
+ if (type.value == 'add') {
+ requiredApi = stockinAdd
+ } else {
+ requiredApi = stockinUpdate
+ }
+ let res = await requiredApi(pamaes)
+ if (res.code !== 200) {
+ uni.showToast({
+ title: res.msg,
+ icon: 'none'
+ })
+ return
+ }
+ uni.showToast({
+ title: '鏂板鎴愬姛',
+ icon: 'none'
+ })
+ goBack()
+}
+
+function getCurrentDate() {
+ return formatDateTime(new Date(), false);
+}
+function formatDateTime(date = new Date(), includeTime = true) {
+ const d = new Date(date);
+ const year = d.getFullYear();
+ const month = String(d.getMonth() + 1).padStart(2, '0');
+ const day = String(d.getDate()).padStart(2, '0');
+
+ if (!includeTime) {
+ return `${year}-${month}-${day}`;
+ }
+
+ const hours = String(d.getHours()).padStart(2, '0');
+ const minutes = String(d.getMinutes()).padStart(2, '0');
+ const seconds = String(d.getSeconds()).padStart(2, '0');
+
+ return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
+}
+
+//閲囪喘璁㈠崟鍙风浉鍏�
+
+const ledgerList = ref([])
+const ledgerVlaue = ref(0)
+const getLedgerList = async (_goods) => {
+ let res = await ledgerListPage({ current: -1, size: -1 })
+ if (res.code !== 200) return
+ ledgerList.value = res.data?.records || []
+ ledgerList.value = ledgerList.value.map(item => {
+ return {
+ text: item.purchaseContractNumber + '路' + item.supplierName,
+ value: item.purchaseContractNumber,
+ supplierName: item.supplierName
+ }
+ })
+ if (_goods.id) {
+ ledgerList.value.map(item => {
+ if (item.value == _goods.purchaseContractNumber) {
+ ledgerVlaue.value = _goods.purchaseContractNumber
+ switchLedger(_goods.purchaseContractNumber)
+ }
+
+ })
+ }
+}
+
+const switchLedger = (purchaseContractNumber) => {
+ getGoodsList(purchaseContractNumber)
+}
+const getGoodsList = async (purchaseContractNumber) => {
+ let res = await productlist({ purchaseContractNumber })
+ if (res.code !== 200) return
+ if (type.value == 'edit') {
+ goodsList.value.map((el) => {
+ res.data.map(item => {
+ if (el.id == item.recordId) {
+ el.quantity0 = item.quantity0
+ }
+ })
+ })
+ } else {
+ goodsList.value = res.data.map(item => {
+ return { ...defaultGoods, ...item }
+ })
+ }
+
+}
+onMounted(() => {
+ let _goods = JSON.parse(props.goods)
+ if (_goods.id) {
+ pageTitle.value = '缂栬緫鑷畾涔夊叆搴�'
+ type.value = 'edit'
+ goodsList.value.push({ ...defaultGoods, ..._goods })
+ }
+ getLedgerList(_goods)
+ userStore.getInfo()
+})
+</script>
+<style lang="scss" scoped>
+.box {
+ background-color: #fff;
+ box-sizing: border-box;
+ padding: 20rpx;
+ min-height: 80rpx;
+ padding-bottom: calc(30rpx + env(safe-area-inset-bottom));
+}
+
+.form-box {
+ box-sizing: border-box;
+ margin-bottom: 20rpx;
+ padding: 20rpx;
+ // background-color: #f5f5f5;
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
+ transition: box-shadow 0.3s ease;
+ border-radius: 20rpx;
+}
+
+.form-box:hover {
+ box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
+}
+
+.add-img {
+ .img {
+ background-color: #efefef;
+ border-radius: 10rpx;
+ width: 200rpx;
+ height: 200rpx;
+ }
+}
+</style>
\ No newline at end of file
--
Gitblit v1.9.3