商品管理更新修复部分已知问题
This commit is contained in:
@@ -8,47 +8,22 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-48">
|
||||
<view>商品名称</view>
|
||||
<view class="u-m-t-16" v-if="isSku">{{data.name}}</view>
|
||||
<view class="u-m-t-38">
|
||||
<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">
|
||||
<text>变动金额:</text>
|
||||
<text class="number">{{data.lowPrice-data._lowPrice}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-16">
|
||||
<up-input v-model="data.lowPrice">
|
||||
<template #suffix>
|
||||
<view>元</view>
|
||||
</template>
|
||||
</up-input>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-b-32">
|
||||
<view class="u-flex u-row-between">
|
||||
<view>备注</view>
|
||||
</view>
|
||||
<view class="u-m-t-16">
|
||||
<up-textarea :height="42" v-model="form.note" placeholder="请输入备注"></up-textarea>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<scroll-view scroll-y="true" style="max-height: 50vh;">
|
||||
<view class="u-m-b-32" v-for="(item,index) in data.skuList" :key="index">
|
||||
<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">
|
||||
<template v-if="!isSku">
|
||||
<view class="u-m-b-32">
|
||||
<view class="u-flex u-row-between">
|
||||
<view>{{item.name}}</view>
|
||||
<view>{{data.name}}</view>
|
||||
<view class="u-font-24">
|
||||
<text>变动金额:</text>
|
||||
<text class="number">{{item.lowPrice-item._lowPrice}}</text>
|
||||
<text class="number">{{data.lowPrice*1-data._lowPrice*1}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-16">
|
||||
<up-input v-model="item.lowPrice">
|
||||
<up-input v-model="data.lowPrice" type="number"
|
||||
@change="priceFormat(data,'lowPrice',$event)">
|
||||
<template #suffix>
|
||||
<view>元</view>
|
||||
</template>
|
||||
@@ -63,17 +38,46 @@
|
||||
<up-textarea :height="42" v-model="form.note" placeholder="请输入备注"></up-textarea>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</template>
|
||||
</template>
|
||||
<template v-else>
|
||||
<scroll-view scroll-y="true" style="max-height: 50vh;">
|
||||
<view class="u-m-b-32" v-for="(item,index) in data.skuList" :key="index">
|
||||
<view class="u-flex u-row-between">
|
||||
<view>{{item.name}}</view>
|
||||
<view class="u-font-24">
|
||||
<text>变动金额:</text>
|
||||
<text class="number">{{item.lowPrice-item._lowPrice}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-16">
|
||||
<up-input @change="priceFormat(item,'lowPrice',$event)" v-model="item.lowPrice"
|
||||
type="number">
|
||||
<template #suffix>
|
||||
<view>元</view>
|
||||
</template>
|
||||
</up-input>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-b-32">
|
||||
<view class="u-flex u-row-between">
|
||||
<view>备注</view>
|
||||
</view>
|
||||
<view class="u-m-t-16">
|
||||
<up-textarea :height="42" v-model="form.note" placeholder="请输入备注"></up-textarea>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</template>
|
||||
|
||||
<view class="u-m-t-60">
|
||||
<my-button type="primary" shape="circle" @tap="save">
|
||||
<view class="u-font-32">
|
||||
保存
|
||||
</view>
|
||||
</my-button>
|
||||
<view class="u-m-t-60">
|
||||
<my-button type="primary" shape="circle" @tap="save">
|
||||
<view class="u-font-32">
|
||||
保存
|
||||
</view>
|
||||
</my-button>
|
||||
</view>
|
||||
</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,
|
||||
@@ -104,14 +134,30 @@
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
lowPrice:0,
|
||||
lowPrice: 0,
|
||||
skuList: []
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
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,11 +166,13 @@
|
||||
watch(() => props.show, (newval) => {
|
||||
popShow.value = newval
|
||||
if (newval) {
|
||||
data.value = props.goods
|
||||
data.value = {
|
||||
...props.goods
|
||||
}
|
||||
}
|
||||
})
|
||||
const isSku=computed(()=>{
|
||||
return data.value.typeEnum=='多规格'
|
||||
const isSku = computed(() => {
|
||||
return data.value.typeEnum == '多规格'
|
||||
})
|
||||
watch(() => popShow.value, (newval) => {
|
||||
emits('update:show', newval)
|
||||
@@ -137,11 +185,21 @@
|
||||
function open() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
function save() {
|
||||
emits('save', {
|
||||
...data.value,
|
||||
})
|
||||
refForm.value.validate().then(valid => {
|
||||
if (valid) {
|
||||
emits('save', {
|
||||
...data.value,
|
||||
})
|
||||
} else {
|
||||
console.log(err);
|
||||
}
|
||||
}).catch(() => {
|
||||
// 处理验证错误
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
// function save() {
|
||||
|
||||
@@ -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">
|
||||
<template #suffix>
|
||||
<view>{{data.unitName||''}}</view>
|
||||
</template>
|
||||
</up-input>
|
||||
<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() {
|
||||
emits('save', {
|
||||
...data.value,
|
||||
})
|
||||
refForm.value.validate().then(valid => {
|
||||
if (valid) {
|
||||
emits('save', {
|
||||
...data.value,
|
||||
})
|
||||
} else {
|
||||
console.log(err);
|
||||
}
|
||||
}).catch(() => {
|
||||
// 处理验证错误
|
||||
});
|
||||
}
|
||||
// function save() {
|
||||
// const skuSnap = returnSkuSnap(data.value)
|
||||
|
||||
Reference in New Issue
Block a user