更新商品管理模块

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

@@ -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;