更新商品管理模块

This commit is contained in:
2024-09-28 15:07:09 +08:00
parent 3c7918211e
commit 587965020b
11 changed files with 642 additions and 532 deletions

View File

@@ -16,10 +16,10 @@
报损数量
</view>
<view class="u-m-t-16">
<up-input v-model="form.number">
<template #suffix>
<up-input v-model="form.stockNumber" type="number">
<!-- <template #suffix>
<view>{{data.unitName}}</view>
</template>
</template> -->
</up-input>
</view>
</view>
@@ -28,7 +28,7 @@
<view>备注</view>
</view>
<view class="u-m-t-16">
<up-textarea :height="42" v-model="form.note" placeholder="请输入备注"></up-textarea>
<up-textarea :height="42" v-model="form.remark" placeholder="请输入备注"></up-textarea>
</view>
</view>
<view class="u-m-b-32">
@@ -36,9 +36,7 @@
<view>上传图片</view>
</view>
<view class="u-m-t-16">
<scroll-view scroll-y="true" style="max-height: 300rpx;">
<my-up-upload v-model="form.images"></my-up-upload>
</scroll-view>
<my-up-upload :maxCount="1" :multiple="false" v-model="form.coverImg"></my-up-upload>
</view>
</view>
<view class="u-m-t-60">
@@ -67,8 +65,9 @@
returnCategory
} from '@/pageProduct/util.js'
import {
$tbShopUnit
$frmLoss
} from '@/http/yskApi/goods.js'
import infoBox from '@/commons/utils/infoBox.js'
const props = defineProps({
show: {
type: Boolean,
@@ -88,9 +87,9 @@
const data = ref(props.goods)
const emits = defineEmits(['update:show', 'save'])
const form = reactive({
note: '',
number: 1,
images: []
remark: '',
stockNumber: 1,
coverImg: []
})
let popShow = ref(props.show)
watch(() => props.show, (newval) => {
@@ -111,8 +110,21 @@
}
function save() {
console.log(form.images);
async function save() {
if (form.stockNumber <= 0) {
return infoBox.showToast('请输入正确的报损数量')
}
if (!form.remark) {
return infoBox.showToast('请输入备注')
}
console.log(form);
const res= await $frmLoss({
...form,
productId:props.goods.id,
coverImg:form.coverImg[0]?form.coverImg[0].serveUrl:''
})
infoBox.showToast('提交成功!')
popShow.value=false
}
</script>

View File

@@ -1,7 +1,7 @@
<template>
<view class="control" :style="getComputedStyle()">
<view class="u-flex control1" v-if="showControl1">
<view class="btn" @click="changeShowControl1">批量管理</view>
<!-- <view class="btn" @click="changeShowControl1">批量管理</view> -->
<view class="btn" @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>
@@ -114,8 +114,8 @@
.control {
position: fixed;
left: 30rpx;
right: 30rpx;
left: 110rpx;
right: 110rpx;
z-index: 100;
background: #3E3A3A;
border-radius: 100rpx;

View File

@@ -21,7 +21,7 @@
</view>
<view class=" u-flex u-row-between u-m-t-30">
<view>售罄</view>
<up-switch :size="20" @change="isPauseSaleChange" v-model="isPauseSale"></up-switch>
<up-switch :activeValue="1" :inactiveValue="0" :size="20" @change="isPauseSaleChange" v-model="isPauseSale"></up-switch>
</view>
</view>
</view>
@@ -40,7 +40,9 @@
returnCategory
} from '@/pageProduct/util.js'
import {
$updateGrounding, $updateProductStatus
$updateGrounding,
$updateProductStatus,$updateProductData,
$tbProskuConV2
} from '@/http/yskApi/goods.js'
import infoBox from '@/commons/utils/infoBox.js'
const props = defineProps({
@@ -73,7 +75,7 @@
// 是否上架
const isGrounding = ref(1)
const data = ref(props.goods)
const emits = defineEmits(['update:show', 'save', 'isGroundingChange','isPauseSaleChange'])
const emits = defineEmits(['update:show', 'save', 'isGroundingChange', 'isPauseSaleChange'])
const form = reactive({
note: ''
})
@@ -102,21 +104,30 @@
function save() {
emits('save')
}
function upDateGoods(par) {
return $updateProductData([{
id: data.value.id,
isSku: 1,
shopId: uni.getStorageSync('shopId'),
...par
}])
}
async function isGroundingChange(e) {
console.log(e);
await $updateGrounding({
isGrounding: e ? true : false,
skuId: props.goods.id
await upDateGoods({
key:'grounding',
value: e
})
emits('isGroundingChange', e)
infoBox.showToast('更新成功')
}
async function isPauseSaleChange(e) {
console.log(e);
await $updateProductStatus({
targetId: props.goods.id,
updateKey: "pauseSaleSku",
updateValue: e?1:0
await upDateGoods({
key:'pauseSale',
value: e
})
emits('isPauseSaleChange', e)
infoBox.showToast('更新成功')

View File

@@ -87,9 +87,10 @@
<my-step :list="recoders.list"></my-step>
</scroll-view>
<view class="color-999 u-font-24 u-flex u-row-center u-col-center">
<view class="u-flex" @click="changeShowRecoders(false)">
<view class="u-m-r-6">收起记录</view>
<up-icon name="arrow-up" :size="12"></up-icon>
<!-- <view class="u-flex" @click="changeShowRecoders(false)"> -->
<view class="u-flex" @click="toRecodes">
<view class="u-m-r-6">全部记录</view>
<up-icon name="arrow-right" :size="12"></up-icon>
</view>
</view>
</template>
@@ -117,7 +118,7 @@
returnCategory
} from '@/pageProduct/util.js'
import {
$tbShopUnit
$tbShopUnit,$getProductStockDetail
} from '@/http/yskApi/goods.js'
const props = defineProps({
show: {
@@ -135,29 +136,15 @@
}
}
})
function toRecodes(){
}
function changeShowRecoders(show) {
recoders.show = show
}
const recoders = reactive({
list: [{
title: '2024-09-15 112030',
content: '开启了库存库存由0件修改为5件'
},
{
title: '2024-09-15 ',
content: '开启了库存库存由0件修改为4件'
},
{
title: '2024-09-15 ',
content: '开启了库存库存由0件修改为3件'
},
{
title: '2024-09-15 ',
content: '开启了库存库存由0件修改为2件'
},
],
show: false,
list: [],
show: true,
active: 0
})
@@ -171,8 +158,27 @@
popShow.value = newval
if (newval) {
data.value = props.goods
getProductStockDetail()
}
})
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:[]
})
console.log(content);
recoders.list=content.map(v=>{
return {
...v,
title:v.createdAt,
content:v.type+':'+Math.abs(v.stockNumber)
}
})
}
const isSku = computed(() => {
// return data.value.typeEnum == '多规格'
return false

View File

@@ -33,17 +33,18 @@
<view class="info-p-l color-333 u-flex u-row-between">
<view class="u-flex">
<text class="u-m-r-24">{{data.name}}</text>
<!-- <uni-tag size="small" type="primary"
<!-- <uni-tag size="small" type="primary"
custom-style="background-color: #318AFE;" :text="data.typeEnum"></uni-tag> -->
</view>
<view class="u-font-32">
<text v-if="data.typeEnum=='单规格'">¥</text>
<text>{{data.lowPrice}}</text>
<!-- <text>¥</text>
<text>{{data.lowPrice}}</text>
<text v-if="data.typeEnum == '多规格'">~{{data.maxPrice }}</text> -->
</view>
</view>
<view class="u-m-t-44">
<view class="u-m-t-24">
<template v-if="data.skuList.length>=2">
<view class="u-flex u-flex-wrap w-full gap-10 u-col-top">
<view class="u-font-24 info-p-l u-m-t-14">规格</view>
@@ -64,7 +65,7 @@
</view>
</template>
<template v-else>
<view style="height: 24rpx;">
<view style="height: 44rpx;">
</view>
</template>
@@ -86,11 +87,11 @@
<view class="u-flex">
<view class="u-flex">
<view class="u-m-r-18 color-999">售罄</view>
<my-switch v-model="data.isSellNoneChange" @change="isHotChange"></my-switch>
<my-switch v-model="isPauseSale" @change="isPauseSaleChange"></my-switch>
</view>
<view class="u-flex u-m-l-30">
<view class="u-m-r-18 color-999">下架产品</view>
<my-switch v-model="data.isSellNoneChange" @change="isHotChange"></my-switch>
<view class="u-m-r-18 color-999">{{data.isGrounding?'下架产品':'上架产品' }}</view>
<my-switch v-model="isGrounding" @change="isGroundingChange"></my-switch>
</view>
</view>
<view class="u-flex">
@@ -109,17 +110,21 @@
<script setup>
import {
ref,
watch,
watchEffect
} from 'vue';
import {
$goodsIsHot
$goodsIsHot,
$tbProskuConV2,$updateProductData
} 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', 'changeClick', 'xiajia', 'del', 'changePrice', 'baosun', 'guigeClick','editStock'])
const emits = defineEmits(['radioClick', 'changeClick', 'xiajia', 'del', 'changePrice', 'baosun', 'guigeClick','update',
'editStock'
])
const props = defineProps({
index: {
type: Number
@@ -127,7 +132,8 @@
data: {
type: Object,
default: () => {
return {}
return {
}
}
},
showChecked: {
@@ -139,27 +145,44 @@
default: false
}
})
function isHotChange(e) {
$goodsIsHot({
async function upDateGoods(par) {
const res = await $updateProductData([{
id: props.data.id,
isHot: props.data.isHot
}).then(res => {
uni.showToast({
title: '修改成功',
icon: 'none'
})
isSku: 0,
shopId: uni.getStorageSync('shopId'),
...par
}])
uni.showToast({
title: '修改成功',
icon: 'none'
})
emits('update')
}
let isPauseSale=ref(props.data.isPauseSale)
let isGrounding=ref(props.data.isGrounding)
watch(() => props.data.isPauseSale, (newval) => {
isPauseSale.value=newval
})
watch(() => props.data.isGrounding, (newval) => {
isGrounding.value=newval
})
function isPauseSaleChange(e) {
upDateGoods({
key: 'pauseSale',
value: e
})
}
let isSellNone = ref(false)
isSellNone.value = props.isSellNone
function isSellNoneChange() {
console.log(isSellNone.value);
console.log('isSellNoneChange');
function isGroundingChange(e) {
upDateGoods({
key: 'grounding',
value: e
})
}
let checked = ref(false)
@@ -193,7 +216,8 @@
function guigeClick(guigeIndex) {
emits('guigeClick', props.index, guigeIndex)
}
function editStock(){
function editStock() {
emits('editStock', props.index)
}
//携带参数type edit跳转到商品添加页面编辑与添加同一页面根据type值来判断
@@ -298,7 +322,7 @@
}
.skd {
padding: 14rpx 40rpx 14rpx 20rpx;
padding: 20rpx 20rpx 14rpx 20rpx;
background: #F0F2F5;
border-radius: 4rpx;
position: relative;

View File

@@ -41,7 +41,7 @@
<view class="goods-list u-p-30">
<template v-if="pageData.goodsList.length">
<view class="u-m-b-32" v-for="(item,index) in pageData.goodsList" :key="index">
<my-goods @changePrice="changePriceShow" @changeClick="goodsChangeClick"
<my-goods :key="item.id" @update="getGoodsList" @changePrice="changePriceShow" @changeClick="goodsChangeClick"
@editStock="changeStockShow" @guigeClick="editGuigeShow" @baosun="baosunShow"
@radioClick="goodsRadioClick" :index="index" :data="item" @del="goodsDel"
:showChecked="showChecked" :showDetail="pageData.showGoodsDetail"></my-goods>
@@ -187,7 +187,9 @@
page: 0,
size: 10,
categoryId: '',
name: ''
name: '',
isPauseSale:'',
isGrounding:''
},
category: '',
categoryList: [], //分类列表
@@ -198,7 +200,12 @@
watch(() => pageData.query.categoryId, (newval) => {
getGoodsList()
})
watch(() => pageData.query.isPauseSale, (newval) => {
getGoodsList()
})
watch(() => pageData.query.isGrounding, (newval) => {
getGoodsList()
})
const popup = reactive({
price: {
show: false
@@ -362,6 +369,7 @@
}
function getGoodsList() {
pageData.hasAjax = false
$tbProductV2(pageData.query).then(res => {
pageData.hasAjax = true
console.log(res);
@@ -377,9 +385,10 @@
})
}
onShow(() => {
getGoodsList()
// getGoodsList()
})
onLoad(() => {
getGoodsList()
$tbShopCategory({
page: 0,
size: 200
@@ -464,14 +473,36 @@
function statesTableClick(index) {
pageData.stateCurrent = index
console.log(index);
if(index==0){
pageData.query.isPauseSale=''
pageData.query.isGrounding=''
return
}
if(index==1){
pageData.query.isPauseSale=1
pageData.query.isGrounding=''
return
}
if(index==2){
pageData.query.isPauseSale=''
pageData.query.isGrounding=1
return
}
if(index==3){
pageData.query.isPauseSale=''
pageData.query.isGrounding=0
return
}
}
let test = ref(false)
function tabsChange(i) {
console.log(i);
pageData.showGoodsDetail = i ? true : false
}