商品列表修改,商品修改去掉库存相关东西,增加退菜是否退库存的选项,分类增加退菜是否退库存的选项,店铺增加退菜退库存模式配置,增加退款退菜是否退库存弹窗,增加购物车重复物品提示弹窗
This commit is contained in:
@@ -18,6 +18,12 @@
|
||||
<view>预警值</view>
|
||||
<view><input type="number" placeholder="请输入预警值" v-model="datas.form.conWarning" name="" id="" /></view>
|
||||
</view>
|
||||
<view>
|
||||
<view>是否检测耗材</view>
|
||||
<up-switch size="20" :inactive-value="0" :active-value="1" v-model="datas.form.isStock"></up-switch>
|
||||
</view>
|
||||
|
||||
|
||||
<view v-if="!datas.form.id" style="justify-content: space-between">
|
||||
<view>耗材类型</view>
|
||||
<view style="width: 54%" @tap="datas.show = !datas.show">
|
||||
@@ -55,7 +61,8 @@
|
||||
<view class="label">默认入库单位</view>
|
||||
<view class="ipt">
|
||||
<u-radio-group v-model="datas.form.defaultUnit">
|
||||
<u-radio :name="item" :label="item" v-for="(item, index) in unitList" :key="index"></u-radio>
|
||||
<u-radio :name="item" :label="item" v-for="(item, index) in unitList"
|
||||
:key="index"></u-radio>
|
||||
</u-radio-group>
|
||||
</view>
|
||||
</view>
|
||||
@@ -63,226 +70,252 @@
|
||||
</view>
|
||||
</template>
|
||||
<view class="bottombutton">
|
||||
<up-button type="primary" style="background-color: #318afe; color: #fff" @tap="sumbit" :plain="true" text="保存"></up-button>
|
||||
<up-button type="primary" style="background-color: #318afe; color: #fff" @tap="sumbit" :plain="true"
|
||||
text="保存"></up-button>
|
||||
</view>
|
||||
<up-picker :show="datas.show" :columns="datas.typeList" keyName="name" @cancel="datas.show = false" @confirm="confirmConsGroup"></up-picker>
|
||||
<up-picker :show="datas.show" :columns="datas.typeList" keyName="name" @cancel="datas.show = false"
|
||||
@confirm="confirmConsGroup"></up-picker>
|
||||
<!-- 消息提示 -->
|
||||
<up-toast ref="uToastRef"></up-toast>
|
||||
<u-picker :show="unitShow" :columns="unitList"></u-picker>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive } from 'vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import {
|
||||
ref,
|
||||
reactive
|
||||
} from 'vue';
|
||||
import {
|
||||
onLoad
|
||||
} from '@dcloudio/uni-app';
|
||||
|
||||
import { getConsGrpupList, addCons, editCons } from '@/http/api/cons.js';
|
||||
import {
|
||||
getConsGrpupList,
|
||||
addCons,
|
||||
editCons
|
||||
} from '@/http/api/cons.js';
|
||||
|
||||
let datas = reactive({
|
||||
show: false,
|
||||
form: {
|
||||
conUnit: '',
|
||||
conName: '',
|
||||
price: '',
|
||||
conWarning: 999,
|
||||
consGroupId: null,
|
||||
conUnitTwo: '', // 第二单位
|
||||
conUnitTwoConvert: '', // 第二单位转换数量
|
||||
defaultUnit: ''
|
||||
},
|
||||
consGroupName: '',
|
||||
typeList: []
|
||||
});
|
||||
|
||||
onLoad((options) => {
|
||||
if (options && options.item) {
|
||||
let obj = JSON.parse(decodeURIComponent(options.item));
|
||||
datas.form = obj;
|
||||
|
||||
unitList.value = [];
|
||||
if (datas.form.conUnit !== '') {
|
||||
unitList.value.push(datas.form.conUnit);
|
||||
}
|
||||
if (datas.form.conUnitTwo !== '') {
|
||||
unitList.value.push(datas.form.conUnitTwo);
|
||||
}
|
||||
console.log('datas.form', datas.form);
|
||||
console.log('unitList.value', unitList.value);
|
||||
} else {
|
||||
gettbConsTypeList();
|
||||
}
|
||||
uni.setNavigationBarTitle({
|
||||
title: !datas.form.id ? '添加耗材' : '编辑耗材'
|
||||
let datas = reactive({
|
||||
show: false,
|
||||
form: {
|
||||
conUnit: '',
|
||||
conName: '',
|
||||
price: '',
|
||||
conWarning: 999,
|
||||
consGroupId: null,
|
||||
conUnitTwo: '', // 第二单位
|
||||
conUnitTwoConvert: '', // 第二单位转换数量
|
||||
defaultUnit: '',
|
||||
isStock: 1,
|
||||
},
|
||||
consGroupName: '',
|
||||
typeList: []
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* 获取耗材类别
|
||||
*/
|
||||
let gettbConsTypeList = () => {
|
||||
getConsGrpupList({
|
||||
page: 1,
|
||||
size: 30
|
||||
}).then((res) => {
|
||||
datas.typeList = [res];
|
||||
onLoad((options) => {
|
||||
if (options && options.item) {
|
||||
let obj = JSON.parse(decodeURIComponent(options.item));
|
||||
datas.form = obj;
|
||||
|
||||
unitList.value = [];
|
||||
if (datas.form.conUnit !== '') {
|
||||
unitList.value.push(datas.form.conUnit);
|
||||
}
|
||||
if (datas.form.conUnitTwo !== '') {
|
||||
unitList.value.push(datas.form.conUnitTwo);
|
||||
}
|
||||
console.log('datas.form', datas.form);
|
||||
console.log('unitList.value', unitList.value);
|
||||
} else {
|
||||
gettbConsTypeList();
|
||||
}
|
||||
uni.setNavigationBarTitle({
|
||||
title: !datas.form.id ? '添加耗材' : '编辑耗材'
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
function confirmConsGroup(e) {
|
||||
datas.show = false;
|
||||
datas.form.consGroupId = e.value[0].id;
|
||||
datas.consGroupName = e.value[0].name;
|
||||
}
|
||||
/**
|
||||
* 获取耗材类别
|
||||
*/
|
||||
let gettbConsTypeList = () => {
|
||||
getConsGrpupList({
|
||||
page: 1,
|
||||
size: 30
|
||||
}).then((res) => {
|
||||
datas.typeList = [res];
|
||||
});
|
||||
};
|
||||
|
||||
let sumbit = async () => {
|
||||
let conUnitdata = datas.form.conUnit.replace(/(^\s*)|(\s*$)/g, '');
|
||||
if (!conUnitdata) {
|
||||
uni.$utils.showToast('单位不能为空');
|
||||
return;
|
||||
function confirmConsGroup(e) {
|
||||
datas.show = false;
|
||||
datas.form.consGroupId = e.value[0].id;
|
||||
datas.consGroupName = e.value[0].name;
|
||||
}
|
||||
if (!datas.form.price) {
|
||||
uni.$utils.showToast('价格不能为空');
|
||||
return;
|
||||
}
|
||||
if (!datas.form.consGroupId) {
|
||||
uni.$utils.showToast('耗材类型不能为空');
|
||||
return;
|
||||
}
|
||||
if (!datas.form.id) {
|
||||
await addCons({ ...datas.form });
|
||||
} else {
|
||||
await editCons({ ...datas.form });
|
||||
}
|
||||
uni.navigateBack();
|
||||
};
|
||||
|
||||
// 显示选择单位
|
||||
const unitShow = ref(false);
|
||||
// 单位列表
|
||||
const unitList = ref([]);
|
||||
let sumbit = async () => {
|
||||
let conUnitdata = datas.form.conUnit.replace(/(^\s*)|(\s*$)/g, '');
|
||||
if (!conUnitdata) {
|
||||
uni.$utils.showToast('单位不能为空');
|
||||
return;
|
||||
}
|
||||
if (!datas.form.price) {
|
||||
uni.$utils.showToast('价格不能为空');
|
||||
return;
|
||||
}
|
||||
if (!datas.form.consGroupId) {
|
||||
uni.$utils.showToast('耗材类型不能为空');
|
||||
return;
|
||||
}
|
||||
if (!datas.form.id) {
|
||||
await addCons({
|
||||
...datas.form
|
||||
});
|
||||
} else {
|
||||
await editCons({
|
||||
...datas.form
|
||||
});
|
||||
}
|
||||
uni.navigateBack();
|
||||
};
|
||||
|
||||
// 显示选择单位
|
||||
const unitShow = ref(false);
|
||||
// 单位列表
|
||||
const unitList = ref([]);
|
||||
</script>
|
||||
<style>
|
||||
page {
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
page {
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
</style>
|
||||
<style scoped lang="less">
|
||||
.topTitle {
|
||||
font-weight: 400;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
margin: 32rpx 28rpx;
|
||||
}
|
||||
.topTitle {
|
||||
font-weight: 400;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
margin: 32rpx 28rpx;
|
||||
}
|
||||
|
||||
.addConsumables {
|
||||
width: 694rpx;
|
||||
background: #ffffff;
|
||||
border-radius: 18rpx 18rpx 18rpx 18rpx;
|
||||
margin: 32rpx;
|
||||
padding: 24rpx;
|
||||
box-sizing: border-box;
|
||||
.addConsumables {
|
||||
width: 694rpx;
|
||||
background: #ffffff;
|
||||
border-radius: 18rpx 18rpx 18rpx 18rpx;
|
||||
margin: 32rpx;
|
||||
padding: 24rpx;
|
||||
box-sizing: border-box;
|
||||
|
||||
> view {
|
||||
> view {
|
||||
width: 646rpx;
|
||||
height: 84rpx;
|
||||
background: #fcfcfc;
|
||||
border: 2rpx solid #f9f9f9;
|
||||
margin-top: 32rpx;
|
||||
.df;
|
||||
|
||||
> view:first-child {
|
||||
width: 190rpx;
|
||||
>view {
|
||||
>view {
|
||||
width: 646rpx;
|
||||
height: 84rpx;
|
||||
line-height: 84rpx;
|
||||
// text-align: left;
|
||||
padding-left: 24rpx;
|
||||
background: #f9f9f9;
|
||||
border-radius: 8rpx 0rpx 0rpx 8rpx;
|
||||
background: #fcfcfc;
|
||||
border: 2rpx solid #f9f9f9;
|
||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||
font-weight: 400;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
margin-top: 32rpx;
|
||||
.df;
|
||||
|
||||
>view:first-child {
|
||||
width: 240rpx;
|
||||
height: 84rpx;
|
||||
line-height: 84rpx;
|
||||
// text-align: left;
|
||||
padding-left: 24rpx;
|
||||
background: #f9f9f9;
|
||||
border-radius: 8rpx 0rpx 0rpx 8rpx;
|
||||
border: 2rpx solid #f9f9f9;
|
||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||
font-weight: 400;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.bottombutton {
|
||||
margin-top: 84rpx;
|
||||
padding: 0 24rpx;
|
||||
.bottombutton {
|
||||
margin-top: 84rpx;
|
||||
padding: 0 24rpx;
|
||||
|
||||
> button {
|
||||
width: 530rpx;
|
||||
height: 80rpx;
|
||||
border-radius: 56rpx 56rpx 56rpx 56rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.status {
|
||||
margin: 0 32rpx;
|
||||
position: absolute;
|
||||
// top: 100%;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 10;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.df() {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.tips-wrap {
|
||||
--pColor: #e6a23c;
|
||||
--iColor: #fdf6ec;
|
||||
padding: 0 28upx;
|
||||
.content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 28upx;
|
||||
background-color: var(--iColor);
|
||||
|
||||
.info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding-left: 10px;
|
||||
gap: 8upx;
|
||||
.t1 {
|
||||
font-size: 32upx;
|
||||
color: var(--pColor);
|
||||
}
|
||||
.t2 {
|
||||
font-size: 24upx;
|
||||
color: var(--pColor);
|
||||
}
|
||||
>button {
|
||||
width: 530rpx;
|
||||
height: 80rpx;
|
||||
border-radius: 56rpx 56rpx 56rpx 56rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
.form-wrap {
|
||||
padding: 28upx 28upx 0;
|
||||
.form {
|
||||
padding: 28upx;
|
||||
|
||||
.status {
|
||||
margin: 0 32rpx;
|
||||
position: absolute;
|
||||
// top: 100%;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 10;
|
||||
background-color: #fff;
|
||||
border-radius: 16upx;
|
||||
}
|
||||
.row {
|
||||
height: 84upx;
|
||||
|
||||
.df() {
|
||||
display: flex;
|
||||
gap: 20upx;
|
||||
align-items: center;
|
||||
background-color: #fcfcfc;
|
||||
padding: 0 20upx;
|
||||
&:not(:last-child) {
|
||||
margin-bottom: 28upx;
|
||||
}
|
||||
.label {
|
||||
font-size: 32upx;
|
||||
color: #333;
|
||||
}
|
||||
.ipt {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.tips-wrap {
|
||||
--pColor: #e6a23c;
|
||||
--iColor: #fdf6ec;
|
||||
padding: 0 28upx;
|
||||
|
||||
.content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 28upx;
|
||||
background-color: var(--iColor);
|
||||
|
||||
.info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding-left: 10px;
|
||||
gap: 8upx;
|
||||
|
||||
.t1 {
|
||||
font-size: 32upx;
|
||||
color: var(--pColor);
|
||||
}
|
||||
|
||||
.t2 {
|
||||
font-size: 24upx;
|
||||
color: var(--pColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
.form-wrap {
|
||||
padding: 28upx 28upx 0;
|
||||
|
||||
.form {
|
||||
padding: 28upx;
|
||||
background-color: #fff;
|
||||
border-radius: 16upx;
|
||||
}
|
||||
|
||||
.row {
|
||||
height: 84upx;
|
||||
display: flex;
|
||||
gap: 20upx;
|
||||
align-items: center;
|
||||
background-color: #fcfcfc;
|
||||
padding: 0 20upx;
|
||||
|
||||
&:not(:last-child) {
|
||||
margin-bottom: 28upx;
|
||||
}
|
||||
|
||||
.label {
|
||||
font-size: 32upx;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.ipt {
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -11,26 +11,26 @@
|
||||
</view>
|
||||
<view>
|
||||
<view> <text style="color: red;">*</text> 入库时间 </view>
|
||||
<view >
|
||||
<up-datetime-picker
|
||||
hasInput
|
||||
v-model="datas.form.inOutDate"
|
||||
mode="date"
|
||||
|
||||
></up-datetime-picker>
|
||||
<view>
|
||||
<up-datetime-picker hasInput v-model="datas.form.inOutDate" mode="date"></up-datetime-picker>
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<view> <text style="color: red;">*</text> 入库数量 </view>
|
||||
<view> <input type="number" placeholder="请输入数量" v-model="datas.form.bodyList.inOutNumber" @change="datas.form.bodyList.inOutNumber = $utils.isNumber(datas.form.bodyList.inOutNumber)" name="" id=""> </view>
|
||||
<view> <input type="number" placeholder="请输入数量" v-model="datas.form.bodyList.inOutNumber"
|
||||
@change="datas.form.bodyList.inOutNumber = $utils.isNumber(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.bodyList.purchasePrice" @change="datas.form.bodyList.purchasePrice = $utils.isMoney(datas.form.bodyList.purchasePrice)" name="" id=""> </view>
|
||||
<view> <input type="number" placeholder="请输入单价(元)" v-model="datas.form.bodyList.purchasePrice"
|
||||
@change="datas.form.bodyList.purchasePrice = $utils.isMoney(datas.form.bodyList.purchasePrice)"
|
||||
name="" id=""> </view>
|
||||
</view>
|
||||
<view style="justify-content: space-between;">
|
||||
<view> 单位 </view>
|
||||
<view> <input type="text" placeholder="请输入单位" v-model="datas.form.bodyList.conUnit" name="" id=""> </view>
|
||||
<view> <input type="text" placeholder="请输入单位" v-model="datas.form.bodyList.conUnit" name="" id="">
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<view> 应付金额 </view>
|
||||
@@ -43,7 +43,8 @@
|
||||
<view style="justify-content: space-between;align-items: center;">
|
||||
<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>
|
||||
@@ -57,21 +58,32 @@
|
||||
<up-button type="primary" style="background-color: #318AFE;color: #fff;width: 100%!important;" @tap="sumbit"
|
||||
:plain="true" text="保存"></up-button>
|
||||
</view>
|
||||
|
||||
|
||||
<!-- 消息提示 -->
|
||||
<up-toast ref="uToastRef"></up-toast>
|
||||
</template>
|
||||
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, reactive } from 'vue';
|
||||
import { onShow, onLoad } from '@dcloudio/uni-app';
|
||||
import {
|
||||
ref,
|
||||
computed,
|
||||
reactive
|
||||
} from 'vue';
|
||||
import {
|
||||
onShow,
|
||||
onLoad
|
||||
} from '@dcloudio/uni-app';
|
||||
import go from '@/commons/utils/go.js';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import { getVendorPage } from '@/http/api/vendor.js';
|
||||
import { consStockIn } from '@/http/api/cons.js';
|
||||
|
||||
|
||||
import {
|
||||
getVendorPage
|
||||
} from '@/http/api/vendor.js';
|
||||
import {
|
||||
consStockIn
|
||||
} from '@/http/api/cons.js';
|
||||
|
||||
let showStatus = ref(false)
|
||||
let datas = reactive({
|
||||
show: false,
|
||||
@@ -89,13 +101,13 @@
|
||||
},
|
||||
item: ""
|
||||
})
|
||||
|
||||
|
||||
onLoad((options) => {
|
||||
console.log(options)
|
||||
datas.item = JSON.parse(options.item)
|
||||
datas.form = Object.assign(datas.form, datas.item)
|
||||
// 单位列表
|
||||
datas.unitList = [ datas.form.conUnit, datas.form.conUnitTwo]
|
||||
datas.unitList = [datas.form.conUnit, datas.form.conUnitTwo]
|
||||
datas.form.bodyList.unit = datas.form.defaultUnit
|
||||
datas.form.bodyList.conName = datas.form.conName
|
||||
datas.form.bodyList.unitName = datas.form.unitName
|
||||
@@ -107,7 +119,7 @@
|
||||
function toggle() {
|
||||
go.to('PAGES_ADD_SUPPLIER')
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取供应商列表
|
||||
*/
|
||||
@@ -122,9 +134,9 @@
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
let nowStatusIndex = ref(0)
|
||||
|
||||
|
||||
/**
|
||||
* 入库时间
|
||||
* @param {Object} i
|
||||
@@ -132,7 +144,7 @@
|
||||
function inOutDateChange(i) {
|
||||
datas.inOutDate = dayjs(datas.form.inOutDate).format('YYYY-MM-DD')
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 供应商选择
|
||||
* @param {Object} i
|
||||
@@ -153,14 +165,15 @@
|
||||
uni.$utils.showToast("请输入必填项")
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
vendorId: datas.list[nowStatusIndex.value].id,
|
||||
vendorId: datas.list[nowStatusIndex.value]?datas.list[nowStatusIndex.value].id:'',
|
||||
amountPayable: datas.form.bodyList[0].inOutNumber * datas.form.bodyList[0].purchasePrice,
|
||||
}).then(res => {
|
||||
uni.$utils.showToast("保存成功")
|
||||
@@ -168,7 +181,7 @@
|
||||
go.back()
|
||||
}, 1000)
|
||||
})
|
||||
},1000)
|
||||
}, 1000)
|
||||
// 获取供应商
|
||||
const statusHeight = computed(() => {
|
||||
return 30 * datas.status.length + 14 + 'px'
|
||||
@@ -194,9 +207,11 @@
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
::v-deep.u-input{
|
||||
border: none!important;
|
||||
|
||||
::v-deep.u-input {
|
||||
border: none !important;
|
||||
}
|
||||
|
||||
.status {
|
||||
margin: 0 32rpx;
|
||||
position: absolute;
|
||||
|
||||
Reference in New Issue
Block a user