first
This commit is contained in:
171
pageProduct/invoicing-check/components/list-item.vue
Normal file
171
pageProduct/invoicing-check/components/list-item.vue
Normal file
@@ -0,0 +1,171 @@
|
||||
<template>
|
||||
<view class="u-m-b-30 goods">
|
||||
<view class="u-flex color-999">
|
||||
<text class="">{{data.createTime}}</text>
|
||||
</view>
|
||||
|
||||
|
||||
<view class="u-m-t-20 u-flex u-col-top ">
|
||||
<image :src="data.coverImg" lazy-load class="img"></image>
|
||||
<view class=" u-p-l-24 h-100 u-flex u-flex-1 u-col-top u-flex-col u-row-between">
|
||||
<view class="u-flex">
|
||||
<view class="color-333"> <text class="font-bold">{{data.name}}</text></view>
|
||||
<view class="price u-m-l-20">¥{{data.price}}</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between w-full">
|
||||
<view>
|
||||
<text class="color-999">盈亏数量:</text>
|
||||
<text>{{data.phaseNum}}</text>
|
||||
</view>
|
||||
<view>
|
||||
<text class="color-999">盈亏金额:</text>
|
||||
<text>{{data.phasePrice}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-row-between w-full">
|
||||
<view>
|
||||
<text class="color-999">账存库存:</text>
|
||||
<text>{{data.stock}}</text>
|
||||
</view>
|
||||
<view>
|
||||
<text class="color-999">实际库存:</text>
|
||||
<text>{{data.inventoryStock}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="u-m-t-20 u-flex " v-if="data.note">
|
||||
<view class="color-333">备注:</view>
|
||||
<view class="bg-gray u-m-l-20 u-p-t-10 u-p-b-10 u-p-l-20 u-p-r-20 color-999">{{data.note}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
watchEffect
|
||||
} from 'vue';
|
||||
import {
|
||||
$goodsIsHot
|
||||
} from '@/http/yskApi/goods.js'
|
||||
import mySwitch from '@/components/my-components/my-switch.vue'
|
||||
import go from '@/commons/utils/go.js';
|
||||
import {
|
||||
ColorMain
|
||||
} from '@/commons/color.js'
|
||||
const emits = defineEmits(['radioClick', 'xiajia', 'del'])
|
||||
const props = defineProps({
|
||||
index: {
|
||||
type: Number
|
||||
},
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
function isHotChange(e) {
|
||||
$goodsIsHot({
|
||||
id: props.data.id,
|
||||
isHot: props.data.isHot
|
||||
}).then(res => {
|
||||
uni.showToast({
|
||||
title: '修改成功',
|
||||
icon: 'none'
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
let isSellNone = ref(false)
|
||||
isSellNone.value = props.isSellNone
|
||||
|
||||
function isSellNoneChange() {
|
||||
console.log(isSellNone.value);
|
||||
console.log('isSellNoneChange');
|
||||
}
|
||||
|
||||
let checked = ref(false)
|
||||
|
||||
|
||||
function radioClick() {
|
||||
console.log(props.index);
|
||||
emits('radioClick', props.index)
|
||||
}
|
||||
|
||||
|
||||
function xiajia() {
|
||||
emits('xiajia', props.index)
|
||||
}
|
||||
|
||||
function del() {
|
||||
emits('del', props.index)
|
||||
}
|
||||
|
||||
//携带参数type edit跳转到商品添加页面,编辑与添加同一页面,根据type值来判断
|
||||
function toEdit() {
|
||||
go.to('PAGES_PRODUCT_ADD', {
|
||||
type: 'edit',
|
||||
productId: props.data.id
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
$imgSize: 126rpx;
|
||||
$price-color: #F02C45;
|
||||
|
||||
.btn {
|
||||
padding: 6rpx 28rpx;
|
||||
border-radius: 100rpx;
|
||||
border: 2rpx solid transparent;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
border-color: $my-main-color;
|
||||
;
|
||||
color: $my-main-color;
|
||||
}
|
||||
|
||||
.btn-default {
|
||||
border-color: #F4F4F4;
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.price {
|
||||
color: $price-color;
|
||||
}
|
||||
|
||||
.h-100 {
|
||||
height: $imgSize;
|
||||
}
|
||||
|
||||
.img {
|
||||
width: $imgSize;
|
||||
height: $imgSize;
|
||||
}
|
||||
|
||||
.icon-arrow-right {
|
||||
width: 32rpx;
|
||||
height: 32rpx;
|
||||
}
|
||||
|
||||
.stock {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
|
||||
.goods {
|
||||
border-radius: 10rpx 10rpx 10rpx 10rpx;
|
||||
background-color: #fff;
|
||||
padding: 24rpx 28rpx 16rpx 28rpx;
|
||||
font-size: 28rpx;
|
||||
|
||||
|
||||
}
|
||||
</style>
|
||||
203
pageProduct/invoicing-check/invoicing-check.vue
Normal file
203
pageProduct/invoicing-check/invoicing-check.vue
Normal file
@@ -0,0 +1,203 @@
|
||||
<template>
|
||||
<view class="min-page bg-gray u-p-30">
|
||||
<view v-for="(item,index) in pageData.list" :key="index">
|
||||
<list-item :data="item"></list-item>
|
||||
</view>
|
||||
<view class="u-m-t-44" v-if="pageData.totalElements>0">
|
||||
<my-pagination :size="pageData.query.size" :totalElements="pageData.totalElements"
|
||||
@change="pageChange"></my-pagination>
|
||||
<view style="height: 200rpx;"></view>
|
||||
</view>
|
||||
<template v-if="pageData.hasAjax&&!pageData.list.length">
|
||||
<my-img-empty tips="暂无数据"></my-img-empty>
|
||||
</template>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
<view class="u-fixed fixed-b">
|
||||
<my-button shape="circle" @tap="formShow">变动库存</my-button>
|
||||
</view>
|
||||
|
||||
<my-mask ref="refMask">
|
||||
<view class="u-p-30 ">
|
||||
<view class="bg-fff border-r-18 default-box-padding">
|
||||
<uni-forms :label-width="100" ref="refForm" :model="formData">
|
||||
<uni-forms-item label="账存数量" required>
|
||||
<uni-easyinput disabled v-model="formData.stock" placeholder="请输入账存数量" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="实际数量" required>
|
||||
<uni-number-box
|
||||
:max="999999999"
|
||||
v-model="formData.stocktakinNum" ></uni-number-box>
|
||||
<!-- <uni-easyinput v-model="formData.stocktakinNum" placeholder="请输入实际数量" /> -->
|
||||
</uni-forms-item>
|
||||
<view :class="{red:computedNumber<0}">
|
||||
<uni-forms-item label="盈亏数量" required>
|
||||
<uni-easyinput disabled v-model="computedNumber" placeholder="请输入盈亏数量" />
|
||||
</uni-forms-item>
|
||||
</view>
|
||||
|
||||
<uni-forms-item label="单价" required>
|
||||
<uni-easyinput disabled v-model="formData.price" placeholder="请输入单价" />
|
||||
</uni-forms-item>
|
||||
<view :class="{red:computedMoney<0}">
|
||||
<uni-forms-item label="盈亏金额" required>
|
||||
<uni-easyinput disabled v-model="computedMoney" placeholder="请输入盈亏金额" />
|
||||
</uni-forms-item>
|
||||
</view>
|
||||
|
||||
<uni-forms-item label="备注" required>
|
||||
<uni-easyinput type="textarea" v-model="formData.note" placeholder="请输入备注" />
|
||||
</uni-forms-item>
|
||||
<view class="u-flex u-m-t-30">
|
||||
<view class="u-flex-1 u-p-r-16">
|
||||
<my-button type="default" shape="circle" @tap="formHide">取消</my-button>
|
||||
</view>
|
||||
<view class="u-flex-1 u-p-l-16">
|
||||
<my-button shape="circle" @tap="addStocktakin">确定</my-button>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</uni-forms>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</my-mask>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
onLoad
|
||||
} from '@dcloudio/uni-app'
|
||||
import {
|
||||
$addStocktakin,
|
||||
$getStocktakin
|
||||
} from '@/http/yskApi/goods.js'
|
||||
import infoBox from "@/commons/utils/infoBox.js"
|
||||
import listItem from './components/list-item';
|
||||
import {
|
||||
$pageData
|
||||
} from '../goodsData.js'
|
||||
import {
|
||||
computed,
|
||||
reactive,
|
||||
ref
|
||||
} from 'vue';
|
||||
const refForm = ref(null)
|
||||
const refMask = ref(null)
|
||||
|
||||
function formShow() {
|
||||
refMask.value.open()
|
||||
}
|
||||
|
||||
function formHide() {
|
||||
formData.note=''
|
||||
refMask.value.close()
|
||||
}
|
||||
const formData = reactive({
|
||||
stock:0,
|
||||
note: '',
|
||||
price:'',
|
||||
productId:"",
|
||||
skuId:'',
|
||||
stocktakinNum:0
|
||||
})
|
||||
const computedMoney=computed(()=>{
|
||||
return (formData.stocktakinNum-formData.stock)*formData.price
|
||||
})
|
||||
|
||||
const computedNumber=computed(()=>{
|
||||
return formData.stocktakinNum-formData.stock
|
||||
})
|
||||
|
||||
const pageData = reactive({
|
||||
...$pageData,
|
||||
query: {
|
||||
...$pageData.query,
|
||||
name: '',
|
||||
skuId: '',
|
||||
sort: 'id,desc'
|
||||
}
|
||||
})
|
||||
// 页数改变事件
|
||||
function pageChange(page) {
|
||||
pageData.query.page=page-1
|
||||
init()
|
||||
}
|
||||
async function addStocktakin() {
|
||||
const res = await $addStocktakin(formData)
|
||||
infoBox.showToast('添加成功')
|
||||
formHide()
|
||||
init()
|
||||
}
|
||||
async function init() {
|
||||
const res = await $getStocktakin(pageData.query)
|
||||
pageData.hasAjax=true
|
||||
if(pageData.query.page===0&&res.content.length){
|
||||
const zero=res.content[0]
|
||||
formData.stock=zero.inventoryStock*1
|
||||
formData.stocktakinNum=formData.stock
|
||||
formData.price=zero.price
|
||||
}else{
|
||||
formData.stock=option.stock*1
|
||||
formData.stocktakinNum=formData.stock
|
||||
formData.price=option.price*1
|
||||
}
|
||||
pageData.list = res.content
|
||||
pageData.totalElements = res.totalElements
|
||||
}
|
||||
let option={}
|
||||
onLoad(opt => {
|
||||
console.log(opt);
|
||||
if (JSON.stringify(opt) !== '{}') {
|
||||
option=opt
|
||||
Object.assign(pageData.query, opt)
|
||||
formData.skuId=opt.skuId
|
||||
formData.productId=opt.productId
|
||||
init()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.form-box {
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
::v-deep.uni-forms-item {
|
||||
min-height: 100rpx;
|
||||
}
|
||||
|
||||
::v-deep.uni-forms-item .uni-forms-item__label {
|
||||
text-indent: 0;
|
||||
font-size: 28rpx !important;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
::v-deep .none-label .uni-forms-item.is-direction-top {
|
||||
padding: 0 !important;
|
||||
min-height: initial !important;
|
||||
}
|
||||
|
||||
::v-deep .none-label .uni-forms-item .uni-forms-item__label {
|
||||
padding: 0 !important;
|
||||
}
|
||||
::v-deep.is-disabled .uni-easyinput__placeholder-class{
|
||||
color: #333;
|
||||
}
|
||||
.fixed-b {
|
||||
bottom: 80rpx;
|
||||
left: 110rpx;
|
||||
right: 110rpx;
|
||||
}
|
||||
|
||||
::v-deep.uni-input-input{
|
||||
color: #333;
|
||||
}
|
||||
::v-deep .red .uni-input-input{
|
||||
color: $my-red-color;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user