更换正式环境,测试修改
This commit is contained in:
@@ -679,7 +679,7 @@
|
||||
})
|
||||
|
||||
res.skuList = (res.skuList.length ? res.skuList : [])
|
||||
|
||||
|
||||
$goodsData = res
|
||||
skuList.list = res.skuList
|
||||
Object.assign(FormData, res)
|
||||
@@ -1185,8 +1185,6 @@
|
||||
coverImg: v.coverImg || ''
|
||||
}
|
||||
})
|
||||
|
||||
console.log(skuList.list);
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -16,13 +16,9 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
formatPrice
|
||||
} from "@/commons/utils/format.js";
|
||||
import {
|
||||
ref,
|
||||
watch,nextTick
|
||||
} from 'vue';
|
||||
import { ref,reactive,watch,nextTick } from 'vue';
|
||||
import { formatPrice } from "@/commons/utils/format.js";
|
||||
|
||||
const props = defineProps({
|
||||
inputType:{
|
||||
type:String,
|
||||
@@ -48,8 +44,8 @@
|
||||
default: '请输入'
|
||||
}
|
||||
})
|
||||
let number = ref(props.modelValue)
|
||||
|
||||
|
||||
let number = ref(props.modelValue*1)
|
||||
function changeNumber(type) {
|
||||
const newval = number.value + props.step * (type == 'add' ? 1 : -1)
|
||||
if (newval < props.min) {
|
||||
@@ -63,12 +59,12 @@
|
||||
|
||||
function priceFormat(e) {
|
||||
nextTick(() => {
|
||||
const min = props
|
||||
.min;
|
||||
const min = props.min;
|
||||
const max = props.max;
|
||||
if (e === '') {
|
||||
return
|
||||
}
|
||||
console.log(e)
|
||||
const newval = formatPrice(e, min, max, true)
|
||||
if (typeof newval !== 'number') {
|
||||
number.value = newval.value
|
||||
@@ -82,7 +78,7 @@
|
||||
})
|
||||
}
|
||||
watch(() => props.modelValue, (newval) => {
|
||||
number.value = newval
|
||||
number.value = newval*1
|
||||
})
|
||||
const emits = defineEmits(['update:modelValue'])
|
||||
watch(() => number.value, (newval) => {
|
||||
|
||||
@@ -110,6 +110,7 @@
|
||||
const res= await productReportDamage(par)
|
||||
infoBox.showToast('提交成功!')
|
||||
popShow.value=false
|
||||
emits('save')
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,38 +1,13 @@
|
||||
<template>
|
||||
<view class="control" :style="getComputedStyle()">
|
||||
<view class="u-flex control1" v-if="showControl1">
|
||||
<!-- <view class="btn" @click="changeShowControl1">批量管理</view> -->
|
||||
<view class="u-flex control1">
|
||||
<view class="btn add font-bold u-font-28 color-fff" @tap="go.to('PAGES_PRODUCT_ADD')">商品添加</view>
|
||||
<!-- <view class="color-999 btn u-flex u-row-center" @click="emitToggleCategory">
|
||||
<text class="u-m-r-10">{{categoryName||'选择分类'}}</text>
|
||||
<view class="arrow-down" :class="{'up':categoryShow}">
|
||||
<uni-icons type="right" size="16" color="#999"></uni-icons>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
<view class="u-flex control2 u-row-between" v-else>
|
||||
<view class="u-flex btn">
|
||||
<view class="u-m-r-58">
|
||||
<label class="radio" @click="changeIsSelectAll">
|
||||
<radio class="scale7" @tap.stop="changeIsSelectAll" :color="ColorMain" value="" :checked="isSelectAll" />
|
||||
<text>全选</text>
|
||||
</label>
|
||||
</view>
|
||||
<view class="u-p-l-30 u-p-r-30 my-bg-main" @click="changeShowControl1">取消</view>
|
||||
<view class="u-p-l-60 u-p-r-60 borde-r" @click="offShelf">下架</view>
|
||||
</view>
|
||||
<view class=" u-flex u-row-center btn" @click="emitToggleCategory">
|
||||
<text class="u-m-r-10">分类至</text>
|
||||
<uni-icons type="right" size="16" color="#fff"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {$tbShopCategory} from '@/http/yskApi/goods.js'
|
||||
import go from '@/commons/utils/go.js';
|
||||
import {ColorMain} from '@/commons/color.js'
|
||||
import {
|
||||
onMounted,
|
||||
reactive,
|
||||
@@ -43,53 +18,18 @@
|
||||
type: [Number, String],
|
||||
default: 30
|
||||
},
|
||||
categoryName:{
|
||||
type:String,
|
||||
default:''
|
||||
},
|
||||
categoryShow:{
|
||||
type:Boolean,
|
||||
default:false
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
let showControl1 = ref(true)
|
||||
const emits = defineEmits(['toggleCategory','controlChange','allCheckedChange','offShelf','categoryChange'])
|
||||
|
||||
function emitToggleCategory() {
|
||||
emits('toggleCategory')
|
||||
}
|
||||
|
||||
function changeShowControl1() {
|
||||
showControl1.value = !showControl1.value
|
||||
emits('controlChange',!showControl1.value)
|
||||
}
|
||||
|
||||
let isSelectAll = ref(false)
|
||||
|
||||
function changeIsSelectAll() {
|
||||
isSelectAll.value = !isSelectAll.value
|
||||
emits('allCheckedChange',isSelectAll.value)
|
||||
}
|
||||
|
||||
function getComputedStyle() {
|
||||
return {
|
||||
bottom: props.bottom + 'rpx'
|
||||
}
|
||||
}
|
||||
//设置是否全选
|
||||
function setisSelectAll(checked){
|
||||
isSelectAll.value =checked
|
||||
}
|
||||
defineExpose({
|
||||
setisSelectAll
|
||||
})
|
||||
|
||||
//下架
|
||||
function offShelf(){
|
||||
emits('offShelf')
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
<template v-if="!isSku">
|
||||
<view class="u-m-b-32" >
|
||||
<view class="u-flex u-row-between">
|
||||
<view>{{data.name}}</view>
|
||||
<view class="u-font-24">
|
||||
<view class="up-line-1" style="width: 60%;">{{data.name}}</view>
|
||||
<view class="u-font-24" style="flex-shrink: 1;">
|
||||
<text>变动数量:</text>
|
||||
<text class="number">{{data.stockNumber-data._stockNumber}}</text>
|
||||
</view>
|
||||
@@ -48,7 +48,7 @@
|
||||
<view>{{item.name}}</view>
|
||||
<view class="u-font-24">
|
||||
<text>变动数量:</text>
|
||||
<text class="number">{{item.stockNumber-item._stockNumber}}</text>
|
||||
<text class="number">{{(item.stockNumber-item._stockNumber).toFixed(2)}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-16">
|
||||
@@ -110,21 +110,10 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
reactive,
|
||||
ref,
|
||||
watch,
|
||||
onMounted,
|
||||
computed
|
||||
} from 'vue';
|
||||
import {
|
||||
returnSkuSnap,
|
||||
returnTypeEnum,
|
||||
returnCategory
|
||||
} from '@/pageProduct/util.js'
|
||||
import {
|
||||
$tbShopUnit,$getProductStockDetail
|
||||
} from '@/http/yskApi/goods.js'
|
||||
import { reactive, ref, watch, onMounted, computed } from 'vue';
|
||||
|
||||
import { $invoicingType } from '@/commons/goodsData.js'
|
||||
import { productStockFlow } from '@/http/api/product.js'
|
||||
import go from '@/commons/utils/go.js'
|
||||
const refForm = ref(null)
|
||||
const props = defineProps({
|
||||
@@ -156,7 +145,6 @@
|
||||
]
|
||||
})
|
||||
function toRecodes(){
|
||||
console.log(props.goods.id);
|
||||
go.to('PAGES_PRODUCT_INVOICING_LIST',{
|
||||
productId:props.goods.id
|
||||
})
|
||||
@@ -185,26 +173,27 @@
|
||||
getProductStockDetail()
|
||||
}
|
||||
})
|
||||
let getTypeName = (type) => {
|
||||
let item = $invoicingType.filter(item=> item.value == type)[0]
|
||||
return item?item.text:''
|
||||
}
|
||||
async function getProductStockDetail(){
|
||||
const {content}=await $getProductStockDetail({
|
||||
page:0,
|
||||
size:2,
|
||||
productId:props.goods.id,
|
||||
column:'/api/tbProductStockDetail/stock/count',
|
||||
shopId:uni.getStorageSync('shopId'),
|
||||
createdAt:[]
|
||||
const { records }=await productStockFlow({
|
||||
page: 1,
|
||||
size: 2,
|
||||
productId: props.goods.id,
|
||||
})
|
||||
console.log(content);
|
||||
recoders.list=content.map(v=>{
|
||||
console.log(records);
|
||||
recoders.list = records.map(v=>{
|
||||
return {
|
||||
...v,
|
||||
title:v.createdAt,
|
||||
content:v.type+':'+Math.abs(v.stockNumber)
|
||||
title: v.createTime,
|
||||
content: getTypeName(v.inOutItem)+':'+Math.abs(v.inOutNumber)
|
||||
}
|
||||
})
|
||||
}
|
||||
const isSku = computed(() => {
|
||||
// return data.value.typeEnum == '多规格'
|
||||
// return data.value.type == 'sku'
|
||||
return false
|
||||
})
|
||||
watch(() => popShow.value, (newval) => {
|
||||
@@ -223,6 +212,7 @@
|
||||
refForm.value.validate().then(valid => {
|
||||
if (valid) {
|
||||
emits('save', {
|
||||
remark: form.note,
|
||||
...data.value,
|
||||
})
|
||||
} else {
|
||||
@@ -232,28 +222,7 @@
|
||||
// 处理验证错误
|
||||
});
|
||||
}
|
||||
// function save() {
|
||||
// const skuSnap = returnSkuSnap(data.value)
|
||||
// let typeEnum = returnTypeEnum(data.value.typeEnum)
|
||||
// let lowPrice = undefined
|
||||
// typeEnum = typeEnum ? typeEnum : 'normal'
|
||||
// const findCategory = returnCategory(data.value.categoryName, props.category)
|
||||
// console.log(typeEnum);
|
||||
// console.log(findCategory);
|
||||
// const categoryId = findCategory ? findCategory.id : ''
|
||||
// if (typeEnum == 'normal') {
|
||||
// // 单规格
|
||||
// lowPrice = data.value.skuList[0].salePrice
|
||||
// }
|
||||
// emits('save', {
|
||||
// ...data.value,
|
||||
// lowPrice,
|
||||
// typeEnum,
|
||||
// images: data.value.images ? data.value.images : [data.value.coverImg],
|
||||
// categoryId,
|
||||
// skuSnap: JSON.stringify(skuSnap)
|
||||
// })
|
||||
// }
|
||||
|
||||
|
||||
onMounted(()=>{
|
||||
// #ifndef H5
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<text class="u-font-28 color-666" @click="changePrice">改价</text>
|
||||
<!-- <text class="u-font-28 color-666" @click="changePrice">改价</text> -->
|
||||
<text class="u-font-28 color-red u-m-l-24" @click="baosun">报损</text>
|
||||
</view>
|
||||
</view>
|
||||
@@ -90,7 +90,6 @@
|
||||
</view>
|
||||
<view class="u-flex">
|
||||
<!-- <view class="btn-default btn" @tap="xiajia">下架商品</view> -->
|
||||
<!-- <view class="btn-default btn" @tap="del">删除</view> -->
|
||||
<view class="btn-primary btn u-m-l-38" @click="toEdit">编辑</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -104,7 +103,7 @@
|
||||
import go from '@/commons/utils/go.js';
|
||||
import {hasPermission} from '@/commons/utils/hasPermission.js';
|
||||
import { ColorMain } from '@/commons/color.js'
|
||||
const emits = defineEmits(['radioClick', 'changeClick', 'xiajia', 'del', 'changePrice', 'baosun', 'guigeClick','update',
|
||||
const emits = defineEmits(['radioClick', 'xiajia', 'del', 'changePrice', 'baosun', 'guigeClick','update',
|
||||
'editStock'
|
||||
])
|
||||
const props = defineProps({
|
||||
@@ -145,7 +144,6 @@
|
||||
const max=247;
|
||||
for(let i in props.data.skuList){
|
||||
const sku=props.data.skuList[i]
|
||||
console.log(sku)
|
||||
width+=(fontSize*sku.specInfo.length+boxWith+gap)
|
||||
if(width>max){
|
||||
isOne=false
|
||||
@@ -232,10 +230,6 @@
|
||||
console.log(props.index);
|
||||
emits('radioClick', props.index)
|
||||
}
|
||||
|
||||
function changeClick() {
|
||||
emits('changeClick', props.index)
|
||||
}
|
||||
|
||||
function reportDamage () {
|
||||
emits('reportDamage', props.index)
|
||||
|
||||
@@ -43,9 +43,9 @@
|
||||
<template v-if="pageData.goodsList.length">
|
||||
<view class="u-m-b-32" v-for="(item,index) in pageData.goodsList" :key="index">
|
||||
<my-goods :key="item.id" @update="getGoodsList" @changePrice="changePriceShow"
|
||||
@changeClick="goodsChangeClick" @edit="toGoodsDetail" @editStock="changeStockShow"
|
||||
@guigeClick="editGuigeShow" @baosun="baosunShow" @radioClick="goodsRadioClick" :index="index"
|
||||
:data="item" @del="goodsDel" :showChecked="showChecked"
|
||||
@edit="toGoodsDetail" @editStock="changeStockShow"
|
||||
@guigeClick="editGuigeShow" @baosun="baosunShow" :index="index"
|
||||
:data="item"
|
||||
:showDetail="pageData.showGoodsDetail"></my-goods>
|
||||
</view>
|
||||
</template>
|
||||
@@ -61,39 +61,11 @@
|
||||
</view>
|
||||
|
||||
<my-control ref="control" :categoryShow="pageData.categoryShow" :categoryName="pageData.categoryName"
|
||||
@offShelf="offShelf" @allCheckedChange="allCheckedChange" @controlChange="controlChange"
|
||||
@toggleCategory="toggleCategory" :bottom="pageData.componentBottom"></my-control>
|
||||
<!-- <my-category ref="category" @change="onCategoryShowChange" @cateClick="cateClick"
|
||||
:bottom="pageData.componentBottom+100"></my-category> -->
|
||||
:bottom="pageData.componentBottom"></my-control>
|
||||
|
||||
|
||||
<!-- 下架弹窗 -->
|
||||
<my-model :desc="pageData.modelDesc" ref="model" @confirm="modelConfirm"></my-model>
|
||||
<!-- 商品库存修改弹窗 -->
|
||||
<my-model ref="goodsStockModel" title="商品修改" @close="goodsStockModelClose">
|
||||
<template #desc>
|
||||
<view class="u-p-40 u-text-left">
|
||||
<view>
|
||||
<view class="">排序:</view>
|
||||
<view class="u-m-t-24">
|
||||
<uni-easyinput v-model="goodsStockData.orderBy" placeholder="请输入排序"></uni-easyinput>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-m-t-32">
|
||||
<view class="">库存开关:</view>
|
||||
<view class="u-m-l-46 ">
|
||||
<my-switch v-model="goodsStockData.isStock"></my-switch>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
<template #btn>
|
||||
<view class="stock-btns u-p-b-40">
|
||||
<my-button shape="circle" @tap="goodsStockModelSave">保存</my-button>
|
||||
<my-button shape="circle" type="default" @tap="goodsStockModelCancel">取消</my-button>
|
||||
</view>
|
||||
</template>
|
||||
</my-model>
|
||||
|
||||
<!-- 分类 -->
|
||||
<my-category v-model:isShow="pageData.categoryShow" @confirm="setCategory"></my-category>
|
||||
<!-- 修改价格弹窗 -->
|
||||
@@ -107,7 +79,7 @@
|
||||
:goods="popup.guige.data"></edit-guige>
|
||||
<!-- 报损 -->
|
||||
<baosun-vue :category="pageData.categoryList" v-model:show="popup.baosun.show"
|
||||
:goods="pageData.selGoods"></baosun-vue>
|
||||
:goods="pageData.selGoods" @save="getGoodsList"></baosun-vue>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
@@ -115,34 +87,21 @@
|
||||
<script setup>
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
||||
import { reactive, ref, watch } from 'vue';
|
||||
|
||||
import go from '@/commons/utils/go.js';
|
||||
import { hasPermission } from '@/commons/utils/hasPermission.js';
|
||||
|
||||
import myGoods from './components/goods.vue'
|
||||
import myControl from './components/control.vue'
|
||||
import myCategory from './components/category.vue'
|
||||
import infoBox from "@/commons/utils/infoBox.js"
|
||||
import editPrice from './components/edit-price.vue';
|
||||
import editGuige from './components/edit-guige.vue';
|
||||
import editStock from './components/edit-stock.vue';
|
||||
import baosunVue from './components/baosun.vue';
|
||||
import {
|
||||
$updateProduct,
|
||||
$getProductDetail,
|
||||
$delProduct,
|
||||
$tbShopCategory,
|
||||
$updateProductStatus,
|
||||
$tbProductV2,
|
||||
$updateProductData
|
||||
} from "@/http/yskApi/goods.js"
|
||||
import {
|
||||
getProductPage,
|
||||
getCategoryList,
|
||||
updateProduct
|
||||
} from '@/http/api/product.js'
|
||||
|
||||
import { getProductPage, getCategoryList, updateProduct, productModifyStock } from '@/http/api/product.js'
|
||||
|
||||
import {
|
||||
returnAllCategory
|
||||
} from '@/pageProduct/util.js'
|
||||
import { returnAllCategory } from '@/pageProduct/util.js'
|
||||
|
||||
const pageData = reactive({
|
||||
modelDesc: '是否下架',
|
||||
@@ -181,8 +140,6 @@
|
||||
const tabsList = ['简洁', '详情']
|
||||
const control = ref(null)
|
||||
const model = ref(null)
|
||||
const goodsStockModel = ref(null)
|
||||
let reportDamage = ref(null) //报损组件
|
||||
watch(() => pageData.query.categoryId, (newval) => {
|
||||
getGoodsList()
|
||||
})
|
||||
@@ -250,7 +207,10 @@
|
||||
})
|
||||
}
|
||||
|
||||
//报损弹窗展示
|
||||
/**
|
||||
* 报损弹窗展示
|
||||
* @param {Object} index
|
||||
*/
|
||||
function baosunShow(index) {
|
||||
pageData.selGoodsIndex = index
|
||||
const goods = pageData.goodsList[index]
|
||||
@@ -290,7 +250,6 @@
|
||||
* @param {Object} goods
|
||||
*/
|
||||
async function changePriceConfirm(goods) {
|
||||
|
||||
let goodsArr = []
|
||||
if (goods.type == 'sku') {
|
||||
goodsArr = goods.skuList.map(v => {
|
||||
@@ -313,13 +272,15 @@
|
||||
}]
|
||||
}
|
||||
const res = await updateProduct(goodsArr)
|
||||
infoBox.showToast('修改成功')
|
||||
uni.$utils.showToast('修改成功')
|
||||
popup.price.show = false
|
||||
getGoodsList()
|
||||
}
|
||||
|
||||
|
||||
// 修改库存弹窗展示
|
||||
/**
|
||||
* 修改库存弹窗展示
|
||||
* @param {Object} index
|
||||
*/
|
||||
async function changeStockShow(index) {
|
||||
const res = await hasPermission('允许修改商品库存')
|
||||
if (!res) {
|
||||
@@ -341,26 +302,29 @@
|
||||
}
|
||||
popup.stock.show = true
|
||||
}
|
||||
async function changeStockConfirm(goods) {
|
||||
let goodsArr = []
|
||||
|
||||
goodsArr = [{
|
||||
shopId: uni.getStorageSync('shopId'),
|
||||
isSku: false,
|
||||
/**
|
||||
* 库存修改确认
|
||||
* @param {Object} goods
|
||||
*/
|
||||
async function changeStockConfirm(goods) {
|
||||
const res = await productModifyStock({
|
||||
id: goods.id,
|
||||
key: 'stockNumber',
|
||||
value: goods.stockNumber
|
||||
}]
|
||||
const res = await $updateProductData(goodsArr)
|
||||
infoBox.showToast('修改成功')
|
||||
stockNumber: goods.stockNumber,
|
||||
remark: goods.remark
|
||||
})
|
||||
uni.$utils.showToast('修改成功')
|
||||
popup.stock.show = false
|
||||
getGoodsList()
|
||||
}
|
||||
|
||||
//修改规格上下架,售罄
|
||||
/**
|
||||
* 修改规格上下架,售罄
|
||||
* @param {Object} goodsIndex
|
||||
* @param {Object} guigeIndex
|
||||
*/
|
||||
function editGuigeShow(goodsIndex, guigeIndex) {
|
||||
const goodsGuige = pageData.goodsList[goodsIndex].skuList[guigeIndex]
|
||||
console.log(goodsIndex, guigeIndex);
|
||||
popup.guige.data = goodsGuige
|
||||
popup.guige.goodsIndex = goodsIndex
|
||||
popup.guige.guigeIndex = guigeIndex
|
||||
@@ -373,7 +337,6 @@
|
||||
*/
|
||||
function isGroundingChange(e) {
|
||||
const { goodsIndex, guigeIndex } = popup.guige
|
||||
console.log(goodsIndex,guigeIndex)
|
||||
pageData.goodsList[goodsIndex].skuList[guigeIndex].isGrounding = e
|
||||
}
|
||||
|
||||
@@ -383,15 +346,21 @@
|
||||
*/
|
||||
function isPauseSaleChange(e) {
|
||||
const { goodsIndex, guigeIndex } = popup.guige
|
||||
console.log(goodsIndex,guigeIndex)
|
||||
pageData.goodsList[goodsIndex].skuList[guigeIndex].isPauseSale = e
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 分类筛选打开
|
||||
* @param {Object} show
|
||||
*/
|
||||
function onCategoryShowChange(show) {
|
||||
console.log(show);
|
||||
pageData.categoryShow = show
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 分类筛选确定
|
||||
* @param {Object} category
|
||||
*/
|
||||
function setCategory(category) {
|
||||
pageData.query.categoryId = category.id
|
||||
pageData.categoryName = category.name
|
||||
@@ -413,88 +382,10 @@
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 商品报损
|
||||
function reportDamageClick(index) {
|
||||
pageData.reportData = pageData.goodsList[index]
|
||||
reportDamage.value.open();
|
||||
}
|
||||
|
||||
function returnGoodsStockData() {
|
||||
return reactive({
|
||||
sort: 0,
|
||||
isStock: false,
|
||||
isDistribute: false,
|
||||
isSoldStock: false,
|
||||
isGrounding: false,
|
||||
stockNumber: 0,
|
||||
})
|
||||
}
|
||||
let goodsStockData = returnGoodsStockData()
|
||||
|
||||
function goodsStockModelClose() {
|
||||
console.log('goodsStockModelClose');
|
||||
goodsStockData = returnGoodsStockData()
|
||||
}
|
||||
|
||||
function goodsStockModelCancel() {
|
||||
console.log('goodsStockModelCancel');
|
||||
goodsStockModel.value.close()
|
||||
goodsStockData = returnGoodsStockData()
|
||||
}
|
||||
|
||||
async function goodsStockModelSave() {
|
||||
const item = pageData.goodsList[pageData.selGoodsIndex]
|
||||
const goods = await $getProductDetail(item.id, false)
|
||||
$updateProduct({
|
||||
...goods,
|
||||
sort: goodsStockData.sort,
|
||||
isStock: goodsStockData.isStock
|
||||
}).then(res => {
|
||||
item.sort = goodsStockData.sort
|
||||
item.isStock = goodsStockData.isStock
|
||||
item.stockNumber = goodsStockData.stockNumber
|
||||
goodsStockModelCancel()
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
//点击修改按钮弹出修改商品弹窗
|
||||
function goodsChangeClick(index) {
|
||||
pageData.selGoodsIndex = index
|
||||
const goods = pageData.goodsList[index]
|
||||
Object.assign(goodsStockData, goods)
|
||||
goodsStockModel.value.open()
|
||||
}
|
||||
|
||||
//删除商品
|
||||
function goodsDel(index) {
|
||||
const goods = pageData.goodsList[index]
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '确认删除该商品',
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
$delProduct([goods.id]).then(res => {
|
||||
uni.showToast({
|
||||
title: '删除成功',
|
||||
icon: 'none'
|
||||
})
|
||||
pageData.goodsList.splice(index, 1)
|
||||
})
|
||||
} else if (res.cancel) {}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function resetQuery() {
|
||||
pageData.totalElements = 0;
|
||||
pageData.query.page = 1;
|
||||
getGoodsList()
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品修改
|
||||
* @param {Object} id
|
||||
*/
|
||||
async function toGoodsDetail(id) {
|
||||
const res = await hasPermission('允许修改商品')
|
||||
if (!res) {
|
||||
@@ -513,109 +404,35 @@
|
||||
function statesTableClick(index) {
|
||||
pageData.stateCurrent = index;
|
||||
pageData.query.status = pageData.statesTabsList[index].value
|
||||
resetQuery()
|
||||
}
|
||||
let test = ref(false)
|
||||
|
||||
function tabsChange(i) {
|
||||
console.log(i);
|
||||
pageData.showGoodsDetail = i ? true : false
|
||||
|
||||
}
|
||||
|
||||
|
||||
//改变商品的选中状态
|
||||
function changeGoodsChecked(checked, index) {
|
||||
if (index !== undefined) {
|
||||
pageData.goodsList[index].checked = checked
|
||||
} else {
|
||||
pageData.goodsList.map(v => {
|
||||
v.checked = checked
|
||||
})
|
||||
}
|
||||
control.value.setisSelectAll(isAllChecked() ? true : false)
|
||||
}
|
||||
|
||||
|
||||
// 获取已经选中的商品
|
||||
function getChechkedGoodsList() {
|
||||
return pageData.goodsList.filter(v => v.checked)
|
||||
}
|
||||
//是否全部选中
|
||||
function isAllChecked() {
|
||||
return getChechkedGoodsList().length === pageData.goodsList.length
|
||||
}
|
||||
// 是否有商品选中
|
||||
function isHasChekdGoods() {
|
||||
return getChechkedGoodsList().length ? true : false
|
||||
searchFunc()
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索
|
||||
*/
|
||||
function searchFunc() {
|
||||
console.log('searchFunc');
|
||||
resetQuery()
|
||||
pageData.totalElements = 0;
|
||||
pageData.query.page = 1;
|
||||
getGoodsList()
|
||||
}
|
||||
|
||||
let showChecked = ref(false)
|
||||
|
||||
//商品start
|
||||
|
||||
function goodsRadioClick(index) {
|
||||
var checked = !pageData.goodsList[index].checked
|
||||
changeGoodsChecked(checked, index)
|
||||
}
|
||||
|
||||
|
||||
//下架
|
||||
function offShelf() {
|
||||
const hasCheckedArr = getChechkedGoodsList()
|
||||
const hasChecked = isHasChekdGoods()
|
||||
if (!hasChecked) {
|
||||
return infoBox.showToast('您还没有选中商品!')
|
||||
}
|
||||
model.value.open()
|
||||
}
|
||||
//下架确认
|
||||
/**
|
||||
* 下架确认
|
||||
*/
|
||||
function modelConfirm() {
|
||||
console.log('confirm');
|
||||
model.value.close()
|
||||
}
|
||||
|
||||
//商品end
|
||||
|
||||
//控制条
|
||||
function controlChange(bol) {
|
||||
showChecked.value = bol
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 全选
|
||||
function allCheckedChange(checked) {
|
||||
changeGoodsChecked(checked)
|
||||
}
|
||||
|
||||
// 页数改变事件
|
||||
/**
|
||||
* 页数改变事件
|
||||
* @param {Object} page
|
||||
*/
|
||||
function pageChange(page) {
|
||||
console.log(page);
|
||||
pageData.query.page = page
|
||||
getGoodsList()
|
||||
}
|
||||
|
||||
//分类
|
||||
const category = ref(null)
|
||||
|
||||
function toggleCategory() {
|
||||
category.value.toggle()
|
||||
}
|
||||
|
||||
function cateClick(cate) {
|
||||
console.log(cate);
|
||||
pageData.query.categoryId = cate.id
|
||||
pageData.categoryName = cate.name
|
||||
pageData.category = cate
|
||||
getGoodsList()
|
||||
}
|
||||
</script>
|
||||
<style scoped>
|
||||
page {
|
||||
|
||||
@@ -1,171 +0,0 @@
|
||||
<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>
|
||||
@@ -1,204 +0,0 @@
|
||||
<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 '@/commons/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>
|
||||
@@ -2,37 +2,17 @@
|
||||
<view class="item bg-fff border-r-12">
|
||||
<view class="u-flex u-text-left u-row-between border-bottom u-p-b-30">
|
||||
<view class="">
|
||||
<uni-dateformat format="yyyy-MM-dd hh:mm:ss" :date="data.createdAt"></uni-dateformat>
|
||||
<uni-dateformat format="yyyy-MM-dd hh:mm:ss" :date="data.createTime"></uni-dateformat>
|
||||
</view>
|
||||
<view class="tag">{{data.type}}</view>
|
||||
<view class="tag">{{getTypeName(data.inOutItem)}}</view>
|
||||
</view>
|
||||
<view class="u-flex u-text-left u-row-left u-m-t-30">
|
||||
<view class="name">{{data.productName}}</view>
|
||||
<!-- <view class="category u-flex u-m-l-10">
|
||||
<view class="tag">分类</view>
|
||||
</view> -->
|
||||
<view class="id color-999 u-font-24 bg-gray u-m-l-10">
|
||||
ID:{{data.id}}
|
||||
</view>
|
||||
<view class="name up-line-1">{{data.productName}}</view>
|
||||
<view class="id color-999 u-font-24 bg-gray u-m-l-10"> ID:{{data.id}} </view>
|
||||
</view>
|
||||
<view class="info u-flex bg-gray u-p-24 u-m-t-20 u-row-between">
|
||||
<view class="u-text-right">
|
||||
<!-- <view>
|
||||
<text>总价值</text>
|
||||
<text class="u-m-l-10">3</text>
|
||||
</view>
|
||||
<view class="u-m-t-10">
|
||||
<text>单价</text>
|
||||
<text class="u-m-l-10">2</text>
|
||||
</view>
|
||||
<view class="u-m-t-10">
|
||||
<text>货品编码</text>
|
||||
<text class="u-m-l-10">2</text>
|
||||
</view>
|
||||
<view class="u-m-t-10">
|
||||
<text>供应商名称</text>
|
||||
<text class="u-m-l-10">2</text>
|
||||
</view> -->
|
||||
|
||||
<view class="u-flex">
|
||||
<view class="text-ming-w">订单号</view>
|
||||
<text class="u-m-l-10 u-font-24 color-main">{{data.orderNo||''}}</text>
|
||||
@@ -40,59 +20,41 @@
|
||||
<view class="u-m-t-10 u-flex u-relative">
|
||||
<view class="text-ming-w">库存</view>
|
||||
<view class="u-relative">
|
||||
<text class="u-m-l-10">{{data.leftNumber}}</text>
|
||||
<text class="u-m-l-10">{{data.beforeNumber}}</text>
|
||||
<view class="u-absolute u-flex addNumber">
|
||||
<uni-icons type="arrow-right" :color="color.ColorMain" size="16"></uni-icons>
|
||||
<text class="color-main u-m-l-10">{{data.leftNumber+data.stockNumber}}</text>
|
||||
<uni-icons type="arrow-right" :color="$utils.ColorMain" size="16"></uni-icons>
|
||||
<text class="color-main u-m-l-10">{{data.afterNumber}}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
<view class="u-m-t-10 u-flex">
|
||||
<view class="text-ming-w">剩余库存</view>
|
||||
<view class="u-m-l-10 color-main">{{data.leftNumber+data.stockNumber}}{{data.unitName}}</view>
|
||||
<view class="u-m-l-10 color-main">{{data.afterNumber}}{{data.unitName}}</view>
|
||||
</view>
|
||||
<view class="u-m-t-10 u-flex" v-if="data.remark" style="align-items: flex-start;">
|
||||
<view class="text-ming-w">备注</view>
|
||||
<view class="u-m-l-10" style="text-align: left;">{{data.remark}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex-1 u-flex u-row-right">
|
||||
<view>
|
||||
<view class="no-wrap">
|
||||
<text class="color-main font-bold" v-if="data.stockNumber>0">{{data.stockNumber}}</text>
|
||||
<text class="color-red font-bold" v-else>{{data.stockNumber}}</text>
|
||||
<text class="color-main font-bold" v-if="data.inOutNumber > 0">{{data.inOutNumber}}</text>
|
||||
<text class="color-red font-bold" v-else>{{data.inOutNumber}}</text>
|
||||
<text>{{data.unitName}}</text>
|
||||
</view>
|
||||
<!-- <view class="u-m-t-10">剩余库存</view> -->
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- <view class="u-flex u-row-right u-m-t-20">
|
||||
<view class="u-flex u-m-r-30">
|
||||
<my-button shape="circle" height="70" type="default" @tap="del">
|
||||
<view class="u-p-l-30 u-p-r-30">
|
||||
删除
|
||||
</view>
|
||||
</my-button>
|
||||
</view>
|
||||
<view class="u-flex">
|
||||
<my-button shape="circle" height="70" plain type="primary" @tap="more">更多操作</my-button>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive } from 'vue';
|
||||
import go from '@/commons/utils/go.js'
|
||||
import color from '@/commons/color.js'
|
||||
|
||||
function del() {
|
||||
console.log('del');
|
||||
}
|
||||
import { $invoicingType } from '@/commons/goodsData.js'
|
||||
const props = defineProps({
|
||||
index: {
|
||||
type: Number
|
||||
},
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
@@ -100,11 +62,13 @@
|
||||
}
|
||||
}
|
||||
})
|
||||
const emits = defineEmits(['more'])
|
||||
|
||||
function more() {
|
||||
emits('more', props.index)
|
||||
|
||||
let getTypeName = (type) => {
|
||||
let item = $invoicingType.filter(item=> item.value == type)[0]
|
||||
return item?item.text:''
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<view class=" bg-fff u-flex u-p-l-30 u-row-between">
|
||||
<view class="u-flex ">
|
||||
<view class="u-flex u-p-t-30 u-p-b-30 u-flex-1 u-row-center" @tap="timeToggle">
|
||||
<text class="u-m-r-12 no-wrap" :class="{'color-main':filters.time.start&&filters.time.end}">筛选时间</text>
|
||||
<text class="u-m-r-12 no-wrap" :class="{'color-main':pageData.query.beginDate&&pageData.query.endDate}">筛选时间</text>
|
||||
<image src="/pageProduct/static/images/icon-arrow-down-fill.svg" class="icon-arrow-down-fill"
|
||||
mode="">
|
||||
</image>
|
||||
@@ -22,7 +22,7 @@
|
||||
<view @tap="changeTypesActive(index)" class="u-flex u-p-l-30 lh30 u-p-r-30 u-row-between"
|
||||
v-for="(item,index) in types.list" :key="index">
|
||||
<view>{{item.text}}</view>
|
||||
<uni-icons v-if="types.active===index" type="checkmarkempty" :color="color.ColorMain"></uni-icons>
|
||||
<uni-icons v-if="types.active===index" type="checkmarkempty" :color="$utils.ColorMain"></uni-icons>
|
||||
</view>
|
||||
<view :style="{height: types.bottomHeight+'px'}"></view>
|
||||
</view>
|
||||
@@ -31,26 +31,18 @@
|
||||
|
||||
|
||||
<view class=" min-page bg-gray list u-p-30">
|
||||
<view class="u-flex u-m-b-30" v-if="filters.time.start&&filters.time.end">
|
||||
<view class="u-flex u-m-b-30" v-if="pageData.query.beginDate&&pageData.query.endDate">
|
||||
<view class="time-area u-font-24 color-main u-flex">
|
||||
<uni-dateformat format="yyyy-MM-dd hh:mm:ss" :date="filters.time.start"></uni-dateformat>
|
||||
<uni-dateformat format="yyyy-MM-dd hh:mm:ss" :date="pageData.query.beginDate"></uni-dateformat>
|
||||
<text class="u-p-l-10 u-p-r-10">至</text>
|
||||
<uni-dateformat format="yyyy-MM-dd hh:mm:ss" :date="filters.time.end"></uni-dateformat>
|
||||
<uni-dateformat format="yyyy-MM-dd hh:mm:ss" :date="pageData.query.endDate"></uni-dateformat>
|
||||
<view class="u-m-l-10 u-flex" @tap="clearTime">
|
||||
<uni-icons type="clear" size="18" :color="color.ColorMain"></uni-icons>
|
||||
<uni-icons type="clear" size="18" :color="$utils.ColorMain"></uni-icons>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- <view class="recoreds color-fff ">
|
||||
<view class="u-font-32">详情记录</view>
|
||||
<view class="u-flex u-row-between u-m-t-48">
|
||||
<view class="u-flex u-flex-col u-row-center u-col-center">
|
||||
<view>变动数量</view>
|
||||
<view class="u-font-32 u-m-t-10 font-bold">{{pageData.changeSum}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<template v-if="pageData.list.length">
|
||||
<view class="u-m-b-28 " v-for="(item,index) in pageData.list" :key="index">
|
||||
<my-list-item :data="item" ></my-list-item>
|
||||
@@ -74,28 +66,15 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
onLoad,
|
||||
onReady,
|
||||
onShow,
|
||||
onPageScroll,
|
||||
onPullDownRefresh
|
||||
} from '@dcloudio/uni-app';
|
||||
import color from '@/commons/color';
|
||||
import { onLoad, onReady, onShow, onPageScroll, onPullDownRefresh } from '@dcloudio/uni-app';
|
||||
import { ref, reactive, computed, watch } from 'vue';
|
||||
|
||||
import myListItem from './components/list-item.vue';
|
||||
import {
|
||||
ref,
|
||||
reactive,
|
||||
computed,
|
||||
watch
|
||||
} from 'vue';
|
||||
import {
|
||||
$getProductDetail,
|
||||
$getProductStockDetail,$getProductStockDetailSum
|
||||
} from '@/http/yskApi/goods.js'
|
||||
import {
|
||||
$invoicingType
|
||||
} from '@/commons/goodsData.js'
|
||||
|
||||
import { $invoicingType } from '@/commons/goodsData.js'
|
||||
import { productStockFlow } from '@/http/api/product.js'
|
||||
|
||||
|
||||
const search = reactive({
|
||||
keyword: '',
|
||||
show: false
|
||||
@@ -135,75 +114,39 @@
|
||||
|
||||
function changeTypesActive(i) {
|
||||
types.active = i
|
||||
pageData.query.inOutItem = types.list[i].value
|
||||
types.show = false
|
||||
toggleMask()
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 类型选择
|
||||
*/
|
||||
function showTypesToggle() {
|
||||
types.show = !types.show
|
||||
maskShow()
|
||||
}
|
||||
|
||||
// 页数改变事件
|
||||
function pageChange(page) {
|
||||
pageData.query.page=page-1
|
||||
init()
|
||||
}
|
||||
|
||||
|
||||
const filters = reactive({
|
||||
time: {
|
||||
start: '',
|
||||
end: ''
|
||||
}
|
||||
})
|
||||
|
||||
function resetQuery(){
|
||||
pageData.query.page=0
|
||||
pageData.query.page = 1
|
||||
}
|
||||
function clearTime() {
|
||||
filters.time.start = ''
|
||||
filters.time.end = ''
|
||||
pageData.query.beginDate = ''
|
||||
pageData.query.endDate = ''
|
||||
resetQuery()
|
||||
init()
|
||||
}
|
||||
|
||||
const datePicker = ref(null)
|
||||
function datePickerConfirm(e) {
|
||||
filters.time.start = e.start
|
||||
filters.time.end = e.end
|
||||
resetQuery()
|
||||
init()
|
||||
}
|
||||
|
||||
function timeToggle() {
|
||||
datePicker.value.toggle()
|
||||
}
|
||||
|
||||
|
||||
const mask = ref(null)
|
||||
|
||||
function toggleMask(show) {
|
||||
mask.value.toggle()
|
||||
}
|
||||
|
||||
function maskShow() {
|
||||
mask.value.open()
|
||||
}
|
||||
|
||||
function maskHide() {
|
||||
mask.value.close()
|
||||
}
|
||||
|
||||
|
||||
const pageData = reactive({
|
||||
query: {
|
||||
page: 0,
|
||||
page: 1,
|
||||
size: 10,
|
||||
productId:'',
|
||||
column:'/api/tbProductStockDetail/stock/count',
|
||||
shopId:uni.getStorageSync('shopId'),
|
||||
createdAt:[]
|
||||
inOutItem:'',
|
||||
beginDate:'',
|
||||
endDate:'',
|
||||
},
|
||||
totalElements: 0,
|
||||
list: [],
|
||||
@@ -211,23 +154,6 @@
|
||||
hasAjax:false,
|
||||
changeSum:0
|
||||
})
|
||||
async function init() {
|
||||
const createdAt=(filters.time.start&&filters.time.end)?[filters.time.start,filters.time.end ]:[]
|
||||
const res = await $getProductStockDetail({
|
||||
...pageData.query,
|
||||
type:types.active!==''?types.list[types.active].value:'',
|
||||
createdAt
|
||||
})
|
||||
pageData.hasAjax=true
|
||||
pageData.list = res.content
|
||||
pageData.totalElements = res.totalElements
|
||||
}
|
||||
async function getSum(){
|
||||
const res = await $getProductStockDetailSum({
|
||||
productId: pageData.query.productId
|
||||
})
|
||||
pageData.changeSum = res.exchange
|
||||
}
|
||||
watch(()=>types.active,(newval)=>{
|
||||
resetQuery()
|
||||
init()
|
||||
@@ -237,8 +163,40 @@
|
||||
console.log(opt);
|
||||
Object.assign(pageData.query,opt)
|
||||
init()
|
||||
// getSum()
|
||||
})
|
||||
async function init() {
|
||||
const res = await productStockFlow(pageData.query)
|
||||
pageData.hasAjax=true
|
||||
pageData.list = res.records
|
||||
pageData.totalElements = res.totalRow
|
||||
}
|
||||
function timeToggle() {
|
||||
datePicker.value.toggle()
|
||||
}
|
||||
function datePickerConfirm(e) {
|
||||
pageData.query.beginDate = e.start
|
||||
pageData.query.endDate = e.end
|
||||
resetQuery()
|
||||
init()
|
||||
}
|
||||
|
||||
function toggleMask(show) {
|
||||
mask.value.toggle()
|
||||
}
|
||||
|
||||
function maskShow() {
|
||||
mask.value.open()
|
||||
}
|
||||
|
||||
function maskHide() {
|
||||
mask.value.close()
|
||||
}
|
||||
|
||||
// 页数改变事件
|
||||
function pageChange(page) {
|
||||
pageData.query.page = page
|
||||
init()
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
Reference in New Issue
Block a user