代码更新

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

@@ -77,6 +77,8 @@
} from '@/http/yskApi/requestAll.js';
import color from '@/commons/color.js';
import go from '@/commons/utils/go.js';
import { getConsGrpupList,addCons } from '@/api/cons.js';
let datas = reactive({
form: {
conWarning: 999
@@ -94,17 +96,20 @@
onMounted(() => {
gettbConsTypeList()
})
/**
* 获取耗材类别
*/
let gettbConsTypeList = () => {
datas.typelist = []
tbConsTypeList({
getConsGrpupList({
page: 0,
size: 30,
shopId: uni.getStorageSync("shopId"),
}).then(res => {
datas.list = res.content
res.content.forEach(ele => {
datas.typelist.push(ele.conTypeName)
datas.list = res
res.forEach(ele => {
datas.typelist.push(ele.name)
})
})
}
@@ -127,11 +132,11 @@
}
console.log(datas.list, 'tiaoshi1')
console.log(datas.list[datas.nowStatusIndex], 'tiaoshi1')
tbConsInfoAddlist([{
addCons({
...datas.form,
shopId: uni.getStorageSync("shopId"),
conTypeId: datas.list[datas.nowStatusIndex].id
}]).then(res => {
consGroupId: datas.list[datas.nowStatusIndex].id
}).then(res => {
// go.to('PAGES_SALES_CONSUMABLES')
go.back()
})

View File

@@ -2,11 +2,11 @@
<view class="addType">
<view v-for="item in datas.list">
<view class="">
{{item.conTypeName}}<up-icon color="#64A7FE" name="edit-pen" @tap="showoneEvent(item)"></up-icon>
{{item.name}}<up-icon color="#64A7FE" name="edit-pen" @tap="showoneEvent(item)"></up-icon>
</view>
<view class="">
是否启用 &nbsp;&nbsp;
<up-switch checked="true" activeValue="1" size="20" inactiveValue="0"
<up-switch checked="true" :activeValue="1" size="20" :inactiveValue="0"
@change="switchChangeEvent($event,item)" :modelValue="item.status" style="transform:scale(0.7)" />
</view>
</view>
@@ -24,11 +24,11 @@
<up-icon @tap="datas.showtwo=false" name="close-circle-fill"></up-icon>
</view>
<view style="margin-bottom: 28rpx;">
耗材类型名称<input type="text" v-model="datas.conTypeName" />
耗材类型名称<input type="text" v-model="datas.name" style="padding: 0 20rpx;"/>
</view>
<view class="">
<view class="" style="margin-bottom: 20rpx;">
是否禁用
<up-switch checked="true" activeValue="1" inactiveValue="0" @change="switchChange"
<up-switch checked="true" :activeValue="1" :inactiveValue="0" @change="switchChange"
:modelValue="datas.status" style="transform:scale(0.7)" />
</view>
<up-button text="确认" @tap="confirmtow" type="primary" class="buttomStyle" shape="circle"></up-button>
@@ -43,7 +43,7 @@
<up-icon @tap="datas.showone=false" name="close-circle-fill"></up-icon>
</view>
<view style="margin-bottom: 28rpx;">
耗材类型名称<input type="text" v-model="datas.conTypeName" />
耗材类型名称<input type="text" v-model="datas.name" style="padding: 0 20rpx;"/>
</view>
<up-button text="确认" @tap="confirmone" type="primary" class="buttomStyle" shape="circle"></up-button>
</view>
@@ -51,80 +51,92 @@
</template>
<script setup>
import {
onMounted,
reactive
} from 'vue';
import {
tbConsTypeList,
tbConsType,
edittbConsTypeput
} from '@/http/yskApi/requestAll.js';
import { onMounted, reactive } from 'vue';
import { getConsGrpupPage,addConsGrpup,editConsGrpup,consGrpupEnable,consGrpupDisable } from '@/api/cons.js';
let datas = reactive({
list: [],
showtwo: false,
conTypeName: "",
status: "0",
name: "",
status: 0,
showone: false,
activeData: ""
})
onMounted(() => {
gettbConsTypeList()
})
let showoneEvent = (d) => {
datas.showone = true
datas.conTypeName = d.conTypeName
datas.activeData = d
}
let switchChange = (d) => {
datas.status = d
}
let switchChangeEvent = (d, item) => {
let obj = {
...item
}
obj.status = d
edittbConsTypeput(obj).then(res => {
gettbConsTypeList()
/**
* 获取耗材类别列表
*/
let gettbConsTypeList = () => {
datas.typeLists = ['全部']
getConsGrpupPage({
page: 1,
size: 30,
}).then(res => {
datas.list = res.records
})
}
/**
* 编辑类别名称
*/
let showoneEvent = (d) => {
datas.showone = true
datas.name = d.name
datas.activeData = d
}
/**
* 启用/禁用
*/
let switchChangeEvent = (d, item) => {
console.log(d)
item.status = d
if( d == 1 ){
consGrpupEnable(item.id).then(res => {
gettbConsTypeList()
})
} else {
consGrpupDisable(item.id).then(res => {
gettbConsTypeList()
})
}
}
/**
* 添加耗材类别
*/
function confirmtow() {
tbConsType({
conTypeName: datas.conTypeName,
shopId: uni.getStorageSync("shopId"),
addConsGrpup({
name: datas.name,
status: datas.status
}).then(res => {
datas.showtwo = false
datas.conTypeName = ""
datas.name = ""
datas.status = 0
gettbConsTypeList()
})
}
/**
* 编辑耗材类别
*/
let confirmone = () => {
edittbConsTypeput({
editConsGrpup({
...datas.activeData,
conTypeName: datas.conTypeName
name: datas.name
}).then(res => {
gettbConsTypeList()
datas.showone = false
})
}
let close = () => {
datas.conName = ""
datas.status = "0"
}
let gettbConsTypeList = () => {
datas.typeLists = ['全部']
tbConsTypeList({
page: 0,
size: 30,
shopId: uni.getStorageSync("shopId"),
}).then(res => {
datas.list = res.content
})
}
</script>
<style>
page {

View File

@@ -6,7 +6,7 @@
<text style="color: red;">*</text> 供应商
</view>
<view>
<input type="text" placeholder="请输入供应商名称" v-model="datas.form.purveyorName" name="" id="">
<input type="text" placeholder="请输入供应商名称" v-model="datas.form.name" name="" id="">
</view>
</view>
<view>
@@ -14,7 +14,7 @@
<text style="color: red;">*</text> 联系电话
</view>
<view>
<input type="text" placeholder="请输入联系电话" v-model="datas.form.purveyorTelephone" name="" id="">
<input type="text" placeholder="请输入联系电话" v-model="datas.form.telephone" name="" id="">
</view>
</view>
<view>
@@ -25,6 +25,14 @@
<input type="text" placeholder="请输入地址" v-model="datas.form.address" name="" id="">
</view>
</view>
<view>
<view>
<text style="color: red;">*</text> 排序
</view>
<view>
<input type="text" placeholder="请输入排序" v-model="datas.form.sort" name="" id="">
</view>
</view>
<view>
<view>
备注
@@ -45,18 +53,10 @@
<script setup>
import {
ref,
computed,
reactive,
onMounted,
getCurrentInstance
} from 'vue';
import color from '@/commons/color.js';
import go from '@/commons/utils/go.js';
import {
tbShopPurveyorpost
} from '@/http/yskApi/requestAll.js';
import { ref, reactive, getCurrentInstance } from 'vue';
import { addVendor } from '@/api/vendor.js';
let datas = reactive({
form: {
shopId: uni.getStorageSync("shopId"),
@@ -65,23 +65,20 @@
const currentInstance = getCurrentInstance()
function sumbit() {
if (!datas.form.purveyorName || !datas.form.purveyorTelephone || !datas.form.address) {
if (!datas.form.name || !datas.form.telephone || !datas.form.address) {
currentInstance.ctx.$refs.uToastRef.show({
message: "请填写必填项",
type: 'default',
})
return
}
tbShopPurveyorpost(datas.form).then(res => {
addVendor(datas.form).then(res => {
currentInstance.ctx.$refs.uToastRef.show({
message: "添加成功",
type: 'default',
})
setTimeout(() => {
// go.to('PAGES_SUPPLIER')pageConsumables/supplier
// uni.redirectTo({url: '/pageConsumables/supplier'})
go.back()
// uni.redirectTo({url: '/pageConsumables/supplier'})
uni.navigateBack()
}, 1000)
})
}

View File

@@ -6,7 +6,7 @@
供应商
</view>
<view>
<input type="text" placeholder="请输入供应商名称" v-model="datas.form.purveyorName" name="" id="">
<input type="text" placeholder="请输入供应商名称" v-model="datas.form.name" name="" id="">
</view>
</view>
<view>
@@ -14,7 +14,7 @@
联系电话
</view>
<view>
<input type="text" placeholder="请输入联系电话" v-model="datas.form.purveyorTelephone" name="" id="">
<input type="text" placeholder="请输入联系电话" v-model="datas.form.telephone" name="" id="">
</view>
</view>
<view>
@@ -25,6 +25,14 @@
<input type="text" placeholder="请输入地址" v-model="datas.form.address" name="" id="">
</view>
</view>
<view>
<view>
排序
</view>
<view>
<input type="text" placeholder="请输入排序" v-model="datas.form.sort" name="" id="">
</view>
</view>
<view>
<view>
备注
@@ -43,20 +51,9 @@
<script setup>
import {
ref,
computed,
reactive,
onMounted
} from 'vue';
import color from '@/commons/color.js';
import go from '@/commons/utils/go.js';
import {
onLoad,
} from '@dcloudio/uni-app';
import {
tbShopPurveyorput
} from '@/http/yskApi/requestAll.js';
import { ref, reactive, } from 'vue';
import { onLoad, } from '@dcloudio/uni-app';
import { editVendor } from '@/api/vendor.js';
let datas = reactive({
form: {},
})
@@ -70,11 +67,10 @@
})
function sumbit() {
tbShopPurveyorput({
shopId: uni.getStorageSync("shopId"),
editVendor({
...datas.form
}).then(res => {
go.back()
uni.navigateBack()
})
}
</script>

View File

@@ -22,9 +22,8 @@
<view class="ConsumablesConent" v-if="datas.list.length">
<view v-for="(item,index) in datas.list" :key="index">
<view>
{{item.conName}}
<view> {{item.conTypeName}} </view>
<view> {{item.conName}}
<view> {{item.consGroupName}} </view>
</view>
<view>
<view>
@@ -37,7 +36,7 @@
</view>
<view>
<view style="color: #318AFE;">
{{item.stockNumber-item.stockConsume}}
{{item.stockNumber}}
</view>
<view>
剩余库存
@@ -110,6 +109,8 @@
tbConsType,
tbConsTypeList
} from '@/http/yskApi/requestAll.js';
import { getConsPage,getConsGrpupList } from '@/api/cons.js';
let reportDamage = ref(null)
let refMoreSheet = ref(null)
let show = ref(false)
@@ -150,6 +151,36 @@
gettbConsTypeList()
})
/**
* 获取耗材列表
*/
async function getList(d = "") {
getConsPage({
conName: datas.conName,
conTypeId: d,
size: 100,
page: 0
}).then(res => {
datas.list = res.records
})
}
/**
* 获取耗材类别
*/
let gettbConsTypeList = () => {
datas.typeLists = ['全部']
getConsGrpupList({
page: 0,
size: 30,
shopId: uni.getStorageSync("shopId"),
}).then(res => {
datas.typeList = res
res.forEach(ele => {
datas.typeLists.push(ele.name)
})
})
}
function changeNowStatusIndex(i) {
nowStatusIndex.value = i
showStatus.value = false
@@ -161,19 +192,7 @@
getList(datas.typeList[i - 1].id)
}
}
let gettbConsTypeList = () => {
datas.typeLists = ['全部']
tbConsTypeList({
page: 0,
size: 30,
shopId: uni.getStorageSync("shopId"),
}).then(res => {
datas.typeList = res.content
res.content.forEach(ele => {
datas.typeLists.push(ele.conTypeName)
})
})
}
/**
@@ -239,18 +258,7 @@
// let res = await hasPermission(d)
// return res
// }
async function getList(d = "") {
viewConInfoFlowget({
shopId: uni.getStorageSync("shopId"),
conName: datas.conName,
conTypeId: d,
size: 100,
page: 0
}).then(res => {
datas.list = res.content
})
}
function inputEvent(d) {
datas.conName = d.detail.value.replace(/\s*/g, "");
getList()

View File

@@ -2,52 +2,29 @@
<view class="warehouseEntry">
<view>
<view>
<view>
账存数量
</view>
<view>
{{datas.item.balance}}
</view>
<view> 账存数量 </view>
<view> {{datas.item.stockNumber}} </view>
</view>
<view>
<view>
实际数量
</view>
<view>
<input type="number" v-model="datas.form.balance" placeholder="输入数量" name="" id="">
</view>
<view> 实际数量 </view>
<view> <input type="number" v-model="datas.form.actualNumber" placeholder="输入数量" name="" id=""> </view>
</view>
<view>
<view>
单价
</view>
<view>
{{datas.item.price}}
</view>
<view> 单价 </view>
<view> {{datas.item.price}} </view>
</view>
<view>
<view>
盈亏数量
</view>
<view>
{{profitNumber}}
</view>
<view> 盈亏数量 </view>
<view> {{profitNumber}} </view>
</view>
<view>
<view>
总盈亏
</view>
<view>
{{profitPrice}}
</view>
<view> 总盈亏 </view>
<view> {{profitPrice}} </view>
</view>
</view>
</view>
<view class="bottombutton">
<up-button type="primary" style="background-color: #318AFE;color: #fff;" @tap="toggle" :plain="true"
text="保存"></up-button>
<!-- <up-button type="text" style="background-color: #f9f9f9;color: #999;" @tap="toggle" :plain="true"
text="取消"></up-button> -->
<up-button type="primary" style="background-color: #318AFE;color: #fff;" @tap="toggle" :plain="true" text="保存"></up-button>
</view>
</template>
@@ -64,7 +41,8 @@
import {
tbConsInfotbConCheck
} from '@/http/yskApi/requestAll.js';
let showStatus = ref(false)
import { stockCheck } from '@/api/cons.js';
const props = defineProps({
item: {
type: ''
@@ -77,64 +55,50 @@
onMounted(() => {
datas.item = JSON.parse(props.item)
datas.form = {
...datas.item
...datas.item,
actualNumber: 0
}
console.log(datas.form)
})
/**
* 总盈亏
*/
let profitPrice = computed(() => {
// 如果剩余数量为负数
if (datas.form.balance == '-') {
return (0 - datas.item.balance) * datas.item.price
if (datas.form.stockNumber < 0) {
return (0 - datas.item.stockNumber) * datas.item.price
} else {
return ((datas.form.balance - datas.item.balance) * datas.item.price).toFixed(2);
return ((datas.form.actualNumber - datas.item.stockNumber) * datas.item.price).toFixed(2);
}
})
/**
* 盈亏数量
*/
let profitNumber = computed(() => {
// 盈亏数量
if (datas.form.balance == '-') {
return 0 - datas.item.balance
if (datas.form.stockNumber < 0) {
return 0 - datas.item.stockNumber
} else {
return datas.form.balance - datas.item.balance
return datas.form.actualNumber - datas.item.stockNumber
}
})
function toggle() {
if(!datas.form.balance){
if(!datas.form.actualNumber){
return
}
tbConsInfotbConCheck({
stockNumber: datas.form.balance,
conInfoId: datas.form.id,
lpNum: profitNumber._value
stockCheck({
...datas.form,
actualNumber: datas.form.actualNumber,
conId: datas.form.id,
winLossNumber: profitNumber._value
}).then(res => {
// go.to('PAGES_SALES_CONSUMABLES')
go.back()
})
}
/**
* 保留小数n位不进行四舍五入
* num你传递过来的数字,
* decimal你保留的几位,默认保留小数后两位
* isInt 是否保留0
*/
function formatDecimal(num = 0, decimal = 2, isInt = false) {
num = num.toFixed(3).toString();
const index = num.indexOf(".");
if (index !== -1) {
num = num.substring(0, decimal + index + 1);
} else {
num = num.substring(0);
}
//截取后保留两位小数
if (isInt) {
return parseFloat(num);
} else {
return parseFloat(num).toFixed(decimal);
}
}
function showStatusToggle() {
showStatus.value = !showStatus.value
}
</script>
<style>
page {
@@ -142,26 +106,6 @@
}
</style>
<style scoped lang="less">
.df() {
display: flex;
align-items: center;
}
ul,
li {
list-style: none;
padding: 0;
}
.status {
margin: 0 32rpx;
position: absolute;
left: 0;
right: 0;
z-index: 10;
background-color: #fff;
}
.warehouseEntry {
width: 694rpx;
@@ -171,7 +115,6 @@
margin: 32rpx;
padding: 1rpx 24rpx;
box-sizing: border-box;
>view {
>view {
width: 646rpx;
@@ -179,7 +122,8 @@
background: #fcfcfc;
border: 2rpx solid #F9F9F9;
margin-top: 32rpx;
.df;
display: flex;
align-items: center;
>view:first-child {
width: 190rpx;

View File

@@ -2,102 +2,61 @@
<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
hasInput
: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="text" placeholder="请输入数量" v-model="datas.form.bodyList.inOutNumber" name="" id=""> </view>
</view>
<view>
<view>
<text style="color: red;">*</text>出库数量
</view>
<view>
<input type="text" placeholder="请输入数量" v-model="datas.form.list.stockNumber" name="" id="">
</view>
</view>
<view>
<view>
<text style="color: red;">*</text>单价
</view>
<view>
<input type="text" placeholder="请输入单价(元)" v-model="datas.form.list.price" name="" id="">
</view>
<view> <text style="color: red;">*</text>单价 </view>
<view> <input type="text" 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.unit" 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>
<!-- <li>
<view>
总价值
</view>
<view>
<input type="text" placeholder="请输入总价值(元)" name="" id="">
</view>
</li> -->
<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>
<!-- <up-button type="text" style="color: #318AFE;" @tap="toggle" :plain="true"
text="新增"></up-button> -->
<view style="color: #318AFE;width: 80rpx;text-align: center;" @tap="toggle"> 新增 </view>
</view>
</view>
<!-- <view :style="{height:showStatus?statusHeight:0}" class="tranistion status overflow-hide">
<view @tap="changeNowStatusIndex(index)" class="u-flex u-p-l-30 lh30 u-p-r-30 u-row-between"
v-for="(item,index) in datas.status" :key="index">
<view :class="{'color-main':nowStatusIndex===index}">{{item}}</view>
<uni-icons v-if="nowStatusIndex===index" type="checkmarkempty" :color="color.ColorMain"></uni-icons>
</view>
<view :style="{height: '14px'}"></view>
</view> -->
</view>
<view class="bottombutton">
<up-button type="primary" style="background-color: #318AFE;color: #fff;" @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>
@@ -105,36 +64,29 @@
<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 { stockOut } from '@/api/cons.js';
let showStatus = ref(false)
const refs = getCurrentInstance()
let datas = reactive({
show: false,
// 供应商列表
list: [],
// 供应商渲染数组
status: [],
unitList:[],
inOutDate:"",
form: {
shopId: uni.getStorageSync("shopId"),
type: "out",
list: {},
actualPayment: 0
bodyList: {},
actualPaymentAmount: 0,
inOutDate: Date.now()
},
item: ""
})
@@ -151,73 +103,80 @@
datas.form = Object.assign(datas.form, datas.item)
// 单位列表
datas.unitList = [ datas.form.conUnit,datas.form.conUnitTwo]
datas.form.list.unit=datas.form.defaultUnit
datas.form.bodyList.unit=datas.form.defaultUnit
})
onShow(() => {
onShow(() => {
getList()
})
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 changeNowStatusIndex(i) {
nowStatusIndex.value = i.detail.value
showStatus.value = false
}
function changeNowStatusIndexs(i) {
datas.form.list.unit = datas.unitList[i.detail.value]
/**
* 入库时间
* @param {Object} i
*/
function inOutDateChange(i) {
datas.inOutDate = dayjs(datas.form.inOutDate).format('YYYY-MM-DD')
}
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: "请输入必填项",
})
return
}
datas.form.list.conInfoId = props.consId
datas.form.list = [datas.form.list]
datas.form.bodyList.conId = datas.item.id
datas.form.bodyList = [datas.form.bodyList]
datas.form.inOutDate = dayjs(datas.form.inOutDate).format('YYYY-MM-DD')
tbConsInfostockInOut({
stockOut({
...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 => {
go.back()
})
}
// 获取供应商
const statusHeight = computed(() => {
return 30 * datas.status.length + 14 + 'px'
})
</script>
<style>
page {

View File

@@ -7,9 +7,9 @@
<image src="./profile.png" style="width: 64rpx;height: 64rpx;" mode=""></image>
<view style="margin-left: 16rpx;">
<view style="font-weight: 400;font-size: 28rpx;color: #333333;">
{{item.purveyorName}}
{{item.name}}
</view>
<text style="color: #999;">{{item.purveyorTelephone}}</text>
<text style="color: #999;">{{item.telephone}}</text>
</view>
</view>
@@ -38,7 +38,7 @@
</view>
<view class="df">
<span>上次进货日期</span>
<span v-if="item.lastTransactAt">{{dayjs(item.lastTransactAt).format('YYYY-MM-DD HH:mm:ss')}}</span>
<span v-if="item.lastTransactTime">{{dayjs(item.lastTransactTime).format('YYYY-MM-DD HH:mm:ss')}}</span>
</view>
<view class="df">
<span>地址</span>
@@ -69,43 +69,42 @@
</template>
<script setup>
import {
onMounted,
reactive
} from 'vue';
import {
onShow,
} from '@dcloudio/uni-app';
import { reactive } from 'vue';
import { onShow } from '@dcloudio/uni-app';
import dayjs from 'dayjs' //时间格式库
import go from '@/commons/utils/go.js';
import {
tbShopPurveyorTransact,
tbShopPurveyordelete
} from '@/http/yskApi/requestAll.js';
import { getVendorPage,delVendor } from '@/api/vendor.js';
let datas = reactive({
list: []
})
onShow(() => {
getList()
})
/**
* 获取供应商列表
*/
let getList = () => {
getVendorPage({
page: 1,
size: 999,
}).then(res => {
datas.list = res.records
})
}
/**
* 删除供应商
*/
let deleteEvent = (id) => {
tbShopPurveyordelete([id]).then(() => {
delVendor(id).then(() => {
getList()
})
}
let toUrl = (url, d) => {
go.to(url, d)
}
let getList = () => {
tbShopPurveyorTransact({
page: 0,
size: 20,
sort: 'id',
shopId: uni.getStorageSync("shopId"),
}).then(res => {
datas.list = res.content
})
}
</script>
<style>
page {

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',