代码更新

This commit is contained in:
GaoHao
2025-02-26 19:46:20 +08:00
parent 7519ffced3
commit b4a0393d2d
413 changed files with 7483 additions and 60762 deletions

View File

@@ -2,85 +2,53 @@
<view class="warehouseEntry">
<view>
<view>
<view>
耗材名称
</view>
<view>
{{datas.item.conName}}
<view> 耗材名称 </view>
<view> {{datas.item.conName}} </view>
</view>
<view>
<view> 现有库存 </view>
<view> {{datas.item.stockNumber}} </view>
</view>
<view>
<view> <text style="color: red;">*</text> 入库时间 </view>
<view >
<input type="text" @click="datas.show=true" placeholder="选择入库时间" v-model="datas.inOutDate" readonly >
<up-datetime-picker
border='none'
:show="datas.show"
v-model="datas.form.inOutDate"
mode="date"
@change="inOutDateChange"
></up-datetime-picker>
</view>
</view>
<view>
<view>
现有库存
</view>
<view>
{{datas.item.stockNumber-datas.item.stockConsume}}
</view>
<view> <text style="color: red;">*</text> 入库数量 </view>
<view> <input type="number" placeholder="请输入数量" v-model="datas.form.bodyList.inOutNumber" name="" id=""> </view>
</view>
<view>
<view>
<text style="color: red;">*</text> 入库数量
</view>
<view>
<input type="number" placeholder="请输入数量" v-model="datas.form.list.stockNumber" name="" id="">
</view>
</view>
<view>
<view>
<text style="color: red;">*</text>单价
</view>
<view>
<input type="number" placeholder="请输入单价(元)" v-model="datas.form.list.price" name="" id="">
</view>
<view> <text style="color: red;">*</text>单价 </view>
<view> <input type="number" placeholder="请输入单价(元)" v-model="datas.form.bodyList.purchasePrice" name="" id=""> </view>
</view>
<view style="justify-content: space-between;">
<view>
单位
</view>
<picker @change="changeNowStatusIndexs" :range="datas.unitList">
<view class="color-333" style="height: 84rpx;line-height: 84rpx;">
{{datas.form.list.unit}}
</view>
</picker>
<!-- defaultUnit -->
<uni-icons type="bottom" size="16"></uni-icons>
<view> 单位 </view>
<view> <input type="text" placeholder="请输入单位" v-model="datas.form.bodyList.conUnit" name="" id=""> </view>
</view>
<view>
<view>
应付金额
</view>
<view>
{{datas.form.list.stockNumber*datas.form.list.price|0}}
</view>
<view> 应付金额 </view>
<view> {{datas.form.bodyList.inOutNumber*datas.form.bodyList.purchasePrice|0}} </view>
</view>
<view>
<view>
实付金额
</view>
<view>
<input placeholder="请输入现有库存" type="text" v-model="datas.form.actualPayment" />
</view>
<view> 实付金额 </view>
<view> <input placeholder="请输入现有库存" type="text" v-model="datas.form.actualPaymentAmount" /> </view>
</view>
<!-- <view>
<view>
总价值
</view>
<view>
<input type="text" placeholder="请输入总价值(元)" name="" id="">
</view>
</view> -->
<view style="justify-content: space-between;align-items: center;">
<view>
供应商
</view>
<view> 供应商 </view>
<picker @change="changeNowStatusIndex" :value="nowStatusIndex" :range="datas.status">
<view class="color-333" style="height: 84rpx;line-height: 84rpx;">{{datas.status[nowStatusIndex]}}
</view>
<view class="color-333" style="height: 84rpx;line-height: 84rpx;">{{datas.status[nowStatusIndex]}}</view>
</picker>
<uni-icons type="bottom" size="16"></uni-icons>
<view style="color: #318AFE;width: 80rpx;text-align: center;" @tap="toggle">
新增
</view>
<view style="color: #318AFE;width: 80rpx;text-align: center;" @tap="toggle"> 新增 </view>
</view>
</view>
@@ -90,45 +58,36 @@
<view class="bottombutton">
<up-button type="primary" style="background-color: #318AFE;color: #fff;width: 100%!important;" @tap="sumbit"
:plain="true" text="保存"></up-button>
<!-- <up-button type="text" style="background-color: #f9f9f9;color: #999;" @tap="toggle" :plain="true"
text="取消"></up-button> -->
</view>
<!-- 消息提示 -->
<up-toast ref="uToastRef"></up-toast>
</template>
<script setup>
import {
ref,
computed,
reactive,
onMounted,
getCurrentInstance
} from 'vue';
import {
onShow,
} from '@dcloudio/uni-app';
import { ref, computed, reactive, onMounted, getCurrentInstance } from 'vue';
import { onShow } from '@dcloudio/uni-app';
import color from '@/commons/color.js';
import go from '@/commons/utils/go.js';
import {
tbConsInfostockInOut,
tbConsInfoList,
tbShopPurveyor
} from '@/http/yskApi/requestAll.js';
import dayjs from 'dayjs';
import { getVendorPage } from '@/api/vendor.js';
import { consStockIn } from '@/api/cons.js';
let showStatus = ref(false)
let datas = reactive({
show: false,
// 供应商列表
list: [],
// 供应商渲染数组
status: [],
// 单位列表
unitList: [],
inOutDate: '',
form: {
shopId: uni.getStorageSync("shopId"),
type: "in",
list: {},
actualPayment: 0
bodyList: {},
actualPaymentAmount: 0,
inOutDate: ""
},
item: ""
})
@@ -143,55 +102,66 @@
onMounted(() => {
datas.item = JSON.parse(props.item)
datas.form = Object.assign(datas.form, datas.item)
console.log(datas.form)
// 单位列表
datas.unitList = [ datas.form.conUnit,datas.form.conUnitTwo]
datas.form.list.unit=datas.form.defaultUnit
datas.unitList = [ datas.form.conUnit, datas.form.conUnitTwo]
datas.form.bodyList.unit = datas.form.defaultUnit
})
onShow(() => {
getList()
})
const refs = getCurrentInstance()
function toggle() {
go.to('PAGES_ADD_SUPPLIER')
}
/**
* 获取供应商列表
*/
function getList() {
tbShopPurveyor({
shopId: uni.getStorageSync("shopId"),
page: 0,
getVendorPage({
page: 1,
size: 100,
}).then(res => {
datas.list = res.content
res.content.forEach(ele => {
datas.status.push(ele.purveyorName)
datas.list = res.records
res.records.forEach(ele => {
datas.status.push(ele.name)
})
})
}
function showStatusToggle() {
showStatus.value = !showStatus.value
}
let nowStatusIndex = ref(0)
/**
* 入库时间
* @param {Object} i
*/
function inOutDateChange(i) {
datas.inOutDate = dayjs(datas.form.inOutDate).format('YYYY-MM-DD')
}
/**
* 供应商选择
* @param {Object} i
*/
function changeNowStatusIndex(i) {
nowStatusIndex.value = i.detail.value
console.log(nowStatusIndex.value)
showStatus.value = false
}
function changeNowStatusIndexs(i) {
datas.form.list.unit = datas.unitList[i.detail.value]
}
function sumbit() {
if (!datas.form.list.stockNumber) {
if (!datas.form.bodyList.inOutNumber) {
refs.ctx.$refs.uToastRef.show({
type: 'default',
message: "请输入必填项",
})
return
}
if (!datas.form.list.price) {
if (!datas.form.bodyList.purchasePrice) {
refs.ctx.$refs.uToastRef.show({
type: 'default',
message: "请输入必填项",
@@ -205,13 +175,14 @@
})
return
}
datas.form.list.conInfoId = datas.item.id
datas.form.list = [datas.form.list]
tbConsInfostockInOut({
datas.form.bodyList.conId = datas.item.id
datas.form.bodyList = [datas.form.bodyList]
datas.form.inOutDate = dayjs(datas.form.inOutDate).format('YYYY-MM-DD')
consStockIn({
...datas.form,
// 供应商id
supplierId: datas.list[nowStatusIndex.value].id,
accountsPayable: datas.form.list[0].stockNumber * datas.form.list[0].price,
vendorId: datas.list[nowStatusIndex.value].id,
amountPayable: datas.form.bodyList[0].inOutNumber * datas.form.bodyList[0].purchasePrice,
}).then(res => {
refs.ctx.$refs.uToastRef.show({
type: 'default',