商品管理更新修复部分已知问题

This commit is contained in:
YeMingfei666 2024-10-16 14:15:27 +08:00
parent ce6f0ef230
commit d0bb6bff46
8 changed files with 203 additions and 94 deletions

View File

@ -1228,7 +1228,7 @@
}
if (type === 'stockTips') {
modelProps = {
desc: '先保存商品基础信息',
desc: '先保存商品基础信息',
showIcon: false
}
model.value.open()

View File

@ -884,7 +884,7 @@
}
if (type === 'stockTips') {
modelProps = {
desc: '先保存商品基础信息',
desc: '先保存商品基础信息',
showIcon: false
}
model.value.open()

View File

@ -39,7 +39,7 @@
</uni-forms-item>
</view>
<view class=" u-flex">
<view class=" u-flex" v-if="item.options.length>1">
<uni-forms-item :key="optionIndex" label-width="0" label=""
:showRequired="false">
<view class="u-flex">
@ -70,13 +70,15 @@
</view>
</uni-forms-item>
<template v-if="specifications.list.length>1">
<view class="u-flex u-m-t-48 u-m-b-24" @click="delSpecificationsGroup(index)">
<view class="icon icon-reduce u-m-r-22 ">
</view>
<view class="color-red">删除规格组</view>
</view>
</template>
</view>
</uni-forms>
</view>
@ -192,6 +194,9 @@
}
//
function delSpecificationsGroup(index) {
if(specifications.list.length<=1){
return
}
specifications.list.splice(index, 1)
}
//
@ -200,6 +205,9 @@
}
//
function delOption(index, optionIndex) {
if(specifications.list[index].options.length<=1){
return
}
specifications.list[index].options.splice(optionIndex, 1)
}
//

View File

@ -90,16 +90,17 @@
:placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
v-model="item.skus.suit" type="digit" placeholder="请输入起售数量" />
</uni-forms-item>
<view class="u-relative">
<!-- <view class="u-relative">
<uni-forms-item label="库存数量" required>
<uni-easyinput :disabled="disabledStock" @blur="priceFormat(item.skus,'stockNumber')"
:paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
:inputBorder="inputBorder" v-model="item.skus.stockNumber" type="digit"
placeholder="请输入库存数量" />
<uni-easyinput :disabled="disabledStock"
@blur="priceFormat(item.skus,'stockNumber')" :paddingNone="inputPaddingNone"
:placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
v-model="item.skus.stockNumber" type="digit" placeholder="请输入库存数量" />
</uni-forms-item>
<view class="u-absolute position-all" v-if="disabledStock" @click="canEditGoodsStock(true)">
</view>
<view class="u-absolute position-all" v-if="disabledStock"
@click="canEditGoodsStock(true)">
</view>
</view> -->
<uni-forms-item label="分销金额" required>
<uni-easyinput @blur="priceFormat(item.skus,'firstShared')"
@ -226,9 +227,12 @@
//number
function priceFormat(item, key) {
nextTick(() => {
const min = 0;
const max = 100000000;
let min = 0;
let max = 100000000;
console.log(item[key]);
if (key == 'suit') {
min = 1
}
const newval = formatPrice(item[key], min, max, true)
if (typeof newval !== 'number') {
item[key] = newval.value
@ -419,7 +423,16 @@
rules: [{
required: true,
errorMessage: '必填'
}]
},
{
validateFunction: function(rule, value, data, callback) {
if (value < 1) {
callback('起售数量至少为1个')
}
return true
}
}
]
}
}
@ -513,6 +526,9 @@
})
}).catch(err => {
console.log(err);
if(err.length>=1){
infoBox.showToast(err[0].errorMessage)
}
resolve({
sucees: false
})
@ -521,7 +537,7 @@
}
async function save() {
if (!FormData.result.length) {
return infoBox.showToast('先选择规格!')
return infoBox.showToast('先选择规格!')
}
let isAllPassForm = 0
for (let i in FormData.result) {
@ -529,7 +545,7 @@
isAllPassForm += res.sucees ? 1 : 0
}
if (isAllPassForm < FormData.result.length) {
return infoBox.showToast('清完善规格属性的参数!')
return
}
//
console.log('pass');

View File

@ -32,7 +32,7 @@ export const $defaultSku = {
memberPrice: '',
costPrice: '',
originPrice: '',
stockNumber: '',
// stockNumber: '',
firstShared: '',
suit: 1,
barCode: `${uni.getStorageSync("shopId")}${dayjs().valueOf()}`,

View File

@ -8,6 +8,7 @@
</view>
</view>
<view class="u-m-t-48">
<up-form labelPosition="left" :model="data" :rules="rules" ref="refForm">
<view>商品名称</view>
<view class="u-m-t-16" v-if="isSku">{{data.name}}</view>
<view class="u-m-t-38">
@ -17,11 +18,12 @@
<view>{{data.name}}</view>
<view class="u-font-24">
<text>变动金额</text>
<text class="number">{{data.lowPrice-data._lowPrice}}</text>
<text class="number">{{data.lowPrice*1-data._lowPrice*1}}</text>
</view>
</view>
<view class="u-m-t-16">
<up-input v-model="data.lowPrice">
<up-input v-model="data.lowPrice" type="number"
@change="priceFormat(data,'lowPrice',$event)">
<template #suffix>
<view></view>
</template>
@ -48,7 +50,8 @@
</view>
</view>
<view class="u-m-t-16">
<up-input v-model="item.lowPrice">
<up-input @change="priceFormat(item,'lowPrice',$event)" v-model="item.lowPrice"
type="number">
<template #suffix>
<view></view>
</template>
@ -74,6 +77,7 @@
</my-button>
</view>
</view>
</up-form>
</view>
</view>
</up-popup>
@ -84,13 +88,39 @@
computed,
reactive,
ref,
watch
watch,
nextTick
} from 'vue';
import {
returnSkuSnap,
returnTypeEnum,
returnCategory
} from '@/pageProduct/util.js'
import {
formatPrice
} from "@/commons/utils/format.js";
import {
TRUE
} from 'sass';
function priceFormat(item, key, val) {
let min = 0;
let max = 100000000;
const returnNewVal = formatPrice(val, min, max, true)
const newval = typeof returnNewVal !== 'number' ? returnNewVal.value : returnNewVal
if (typeof returnNewVal !== 'number') {
uni.showToast({
title: `请输入${min}${max}范围内的数字`,
icon: 'none'
})
}
setTimeout(() => {
item[key] = newval
}, 100)
}
const refForm = ref(null)
const props = defineProps({
show: {
type: Boolean,
@ -111,7 +141,23 @@
}
}
})
const data = ref(props.goods)
let data = ref(props.goods)
const rules = {
'lowPrice': [{
type: 'Number',
min: 0,
required: true,
message: '价格不能小于0',
trigger: ['blur', 'change']
},
{
validator: (rule, value, callback) => {
return true
},
message: ''
}
]
}
const emits = defineEmits(['update:show', 'save'])
const form = reactive({
note: ''
@ -120,7 +166,9 @@
watch(() => props.show, (newval) => {
popShow.value = newval
if (newval) {
data.value = props.goods
data.value = {
...props.goods
}
}
})
const isSku = computed(() => {
@ -139,9 +187,19 @@
}
function save() {
refForm.value.validate().then(valid => {
if (valid) {
emits('save', {
...data.value,
})
} else {
console.log(err);
}
}).catch(() => {
//
});
}
// function save() {

View File

@ -8,6 +8,7 @@
</view>
</view>
<view class="u-m-t-48">
<up-form labelPosition="left" :model="data" :rules="rules" ref="refForm" errorType="toast">
<view>商品名称</view>
<view class="u-m-t-16" v-if="isSku">{{data.name}}</view>
<view class="u-m-t-38">
@ -21,11 +22,14 @@
</view>
</view>
<view class="u-m-t-16">
<up-input v-model="data.stockNumber">
<up-form-item prop="stockNumber">
<up-input v-model="data.stockNumber" type="number">
<template #suffix>
<view>{{data.unitName||''}}</view>
</template>
</up-input>
</up-form-item>
</view>
</view>
<view class="u-m-b-32">
@ -99,6 +103,7 @@
</view>
</view>
</up-form>
</view>
</view>
</up-popup>
@ -120,6 +125,7 @@
import {
$tbShopUnit,$getProductStockDetail
} from '@/http/yskApi/goods.js'
const refForm = ref(null)
const props = defineProps({
show: {
type: Boolean,
@ -136,7 +142,15 @@
}
}
})
const rules =reactive({
'stockNumber': [{
type: 'number',
required: true,
message: '请填写库存',
trigger: ['blur', 'change']
}
]
})
function toRecodes(){
}
function changeShowRecoders(show) {
@ -189,15 +203,24 @@
function close() {
popShow.value = false
form.note=''
}
function open() {
}
function save() {
refForm.value.validate().then(valid => {
if (valid) {
emits('save', {
...data.value,
})
} else {
console.log(err);
}
}).catch(() => {
//
});
}
// function save() {
// const skuSnap = returnSkuSnap(data.value)

View File

@ -13,7 +13,9 @@
<up-icon name="arrow-down" size="16"></up-icon>
</view>
<uni-easyinput clearable class='jeepay-search' :inputBorder="false"
trim="all"
:placeholder="pageData.search.placeholder" v-model="pageData.query.name"
@clear="searchFunc"
@confirm="searchFunc">
<template #prefixIcon>
<image src="@/static/iconImg/icon-search.svg" class="input-icon" />
@ -286,6 +288,7 @@
})
}
const res = await $updateProductData(goodsArr)
infoBox.showToast('修改成功')
popup.price.show = false
getGoodsList()
}
@ -342,6 +345,7 @@
value: goods.stockNumber
}]
const res = await $updateProductData(goodsArr)
infoBox.showToast('修改成功')
popup.stock.show = false
getGoodsList()
}