| | |
| | | <script setup> |
| | | import { onMounted, ref } from 'vue' |
| | | import { getToken } from "@/utils/auth"; |
| | | import { addCustom } from '@/api/inventoryManagement/receiptManagement.js' |
| | | import { addCustom,updateCustom } from '@/api/inventoryManagement/receiptManagement.js' |
| | | import config from '@/config' |
| | | const baseUrl = config.imgUrl |
| | | const requirUrl = config.baseUrl |
| | | const pageTitle = ref('新增自定义入库') |
| | | const goodsList = ref([]) |
| | | const type = ref('add') |
| | |
| | | } |
| | | |
| | | } |
| | | let res = await addCustom(goodsList.value) |
| | | let requirApi = '' |
| | | if(type.value=='add'){ |
| | | requirApi = addCustom |
| | | }else{ |
| | | requirApi = updateCustom |
| | | } |
| | | let parames = null |
| | | if(type.value=='add'){ |
| | | parames = goodsList.value |
| | | }else{ |
| | | parames = {...goodsList.value[0]} |
| | | delete parames.createTime |
| | | delete parames.updateTime |
| | | } |
| | | let res = await requirApi(parames) |
| | | if(res.code !== 200){ |
| | | uni.showToast({ |
| | | title: res.msg, |
| | |
| | | }) |
| | | } |
| | | const delItem = (index)=>{ |
| | | console.log('xxxx') |
| | | goodsList.value.splice(index,1) |
| | | } |
| | | const UploadImage = (url, index) => { |
| | | uni.uploadFile({ |
| | | url: baseUrl + '/file/upload', // 替换为实际的上传接口 |
| | | url: requirUrl + '/file/upload', // 替换为实际的上传接口 |
| | | filePath: url, |
| | | name: 'file', |
| | | header: { Authorization: 'Bearer ' + getToken() }, |
| | | success: (res) => { |
| | | console.log(res,res.data) |
| | | const data = JSON.parse(res.data) |
| | | if (data.code === 200) { |
| | | goodsList.value[index].url = data.data.tempPath |