商品管理问题修复
This commit is contained in:
parent
61c455cdb7
commit
de6320ef6e
|
|
@ -217,7 +217,7 @@
|
||||||
<!-- <view class="u-m-t-32 u-font-32 u-m-l-10 u-m-b-32">规格属性</view> -->
|
<!-- <view class="u-m-t-32 u-font-32 u-m-l-10 u-m-b-32">规格属性</view> -->
|
||||||
<view class="block" v-for="(sku,index) in skuList.list" :key="index">
|
<view class="block" v-for="(sku,index) in skuList.list" :key="index">
|
||||||
<view class="border-top-0">
|
<view class="border-top-0">
|
||||||
<uni-forms-item label="售价" required showRequired >
|
<uni-forms-item label="售价" required showRequired>
|
||||||
<uni-easyinput :paddingNone="inputPaddingNone"
|
<uni-easyinput :paddingNone="inputPaddingNone"
|
||||||
@blur="priceFormat(sku,'salePrice')" :placeholderStyle="placeholderStyle"
|
@blur="priceFormat(sku,'salePrice')" :placeholderStyle="placeholderStyle"
|
||||||
:inputBorder="inputBorder" v-model="sku.salePrice" type="digit"
|
:inputBorder="inputBorder" v-model="sku.salePrice" type="digit"
|
||||||
|
|
@ -242,7 +242,7 @@
|
||||||
:inputBorder="inputBorder" v-model="sku.originPrice" type="digit"
|
:inputBorder="inputBorder" v-model="sku.originPrice" type="digit"
|
||||||
placeholder="请输入原价(元)" />
|
placeholder="请输入原价(元)" />
|
||||||
</uni-forms-item> -->
|
</uni-forms-item> -->
|
||||||
<uni-forms-item label="起售数量" required showRequired >
|
<uni-forms-item label="起售数量" required showRequired>
|
||||||
<uni-easyinput @blur="priceFormat(sku,'suit')" :paddingNone="inputPaddingNone"
|
<uni-easyinput @blur="priceFormat(sku,'suit')" :paddingNone="inputPaddingNone"
|
||||||
:placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
|
:placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
|
||||||
v-model="sku.suit" type="digit" placeholder="请输入起售数量" />
|
v-model="sku.suit" type="digit" placeholder="请输入起售数量" />
|
||||||
|
|
@ -418,11 +418,17 @@
|
||||||
<view class="color-999 u-m-t-16 u-font-24">注:关闭则不计算出入库数据</view>
|
<view class="color-999 u-m-t-16 u-font-24">注:关闭则不计算出入库数据</view>
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
<template v-if="FormData.isStock">
|
<template v-if="FormData.isStock">
|
||||||
<uni-forms-item label="库存数量">
|
<view class="u-relative">
|
||||||
<uni-easyinput :paddingNone="inputPaddingNone" :disabled="disabledStock"
|
<uni-forms-item label="库存数量">
|
||||||
:placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
|
<uni-easyinput
|
||||||
v-model="FormData.stockNumber" type="digit" placeholder="请输入库存数量" />
|
@blur="priceFormat(FormData,'stockNumber')"
|
||||||
</uni-forms-item>
|
:paddingNone="inputPaddingNone" :disabled="disabledStock"
|
||||||
|
:placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
|
||||||
|
v-model="FormData.stockNumber" type="digit" placeholder="请输入库存数量" />
|
||||||
|
</uni-forms-item>
|
||||||
|
<view class="u-absolute position-all" v-if="disabledStock" @click="canEditGoodsStock(true)">
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<uni-forms-item label="">
|
<uni-forms-item label="">
|
||||||
|
|
@ -588,10 +594,10 @@
|
||||||
if (!res) {
|
if (!res) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
await upDateGoods({
|
// await upDateGoods({
|
||||||
key: 'pauseSale',
|
// key: 'pauseSale',
|
||||||
value: FormData.isPauseSale ? 0 : 1
|
// value: FormData.isPauseSale ? 0 : 1
|
||||||
})
|
// })
|
||||||
FormData.isPauseSale = FormData.isPauseSale ? 0 : 1
|
FormData.isPauseSale = FormData.isPauseSale ? 0 : 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -604,10 +610,10 @@
|
||||||
if (!res) {
|
if (!res) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
await upDateGoods({
|
// await upDateGoods({
|
||||||
key: 'grounding',
|
// key: 'grounding',
|
||||||
value: FormData.isGrounding ? 0 : 1
|
// value: FormData.isGrounding ? 0 : 1
|
||||||
})
|
// })
|
||||||
FormData.isGrounding = FormData.isGrounding ? 0 : 1
|
FormData.isGrounding = FormData.isGrounding ? 0 : 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -857,7 +863,7 @@
|
||||||
title: '删除成功'
|
title: '删除成功'
|
||||||
})
|
})
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uni.$emit('del:productIndex',option.productId)
|
uni.$emit('del:productIndex', option.productId)
|
||||||
go.back()
|
go.back()
|
||||||
}, 500)
|
}, 500)
|
||||||
})
|
})
|
||||||
|
|
@ -1327,10 +1333,12 @@
|
||||||
}
|
}
|
||||||
const skuSnap = []
|
const skuSnap = []
|
||||||
let submitSkuList = skuList.list || []
|
let submitSkuList = skuList.list || []
|
||||||
if(option.type=='edit'){
|
if (option.type == 'edit') {
|
||||||
submitSkuList=submitSkuList.map(v=>{
|
submitSkuList = submitSkuList.map(v => {
|
||||||
return{
|
return {
|
||||||
...v,productId:FormData.id,shopId:uni.getStorageSync('shopId')
|
...v,
|
||||||
|
productId: FormData.id,
|
||||||
|
shopId: uni.getStorageSync('shopId')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -1366,18 +1374,22 @@
|
||||||
const lowPrice = submitSkuList[0] ? submitSkuList[0].salePrice : FormData.salePrice
|
const lowPrice = submitSkuList[0] ? submitSkuList[0].salePrice : FormData.salePrice
|
||||||
// const lowPrice = submitSkuList[0] ? submitSkuList[0].salePrice : FormData.salePrice
|
// const lowPrice = submitSkuList[0] ? submitSkuList[0].salePrice : FormData.salePrice
|
||||||
const suit = submitSkuList[0] ? submitSkuList[0].suit : 0
|
const suit = submitSkuList[0] ? submitSkuList[0].suit : 0
|
||||||
if(typeEnum=='normal'){
|
const stockNumber = FormData.stockNumber
|
||||||
if(lowPrice===''){
|
if (typeEnum == 'normal') {
|
||||||
|
if (lowPrice === '') {
|
||||||
return infoBox.showToast('请输入售价')
|
return infoBox.showToast('请输入售价')
|
||||||
}
|
}
|
||||||
if(lowPrice===''){
|
if (lowPrice === '') {
|
||||||
return infoBox.showToast('请输入售价')
|
return infoBox.showToast('请输入售价')
|
||||||
}
|
}
|
||||||
if(suit<=0){
|
if (suit <= 0) {
|
||||||
return infoBox.showToast('起售数量不能小于0!')
|
return infoBox.showToast('起售数量不能小于0!')
|
||||||
}
|
}
|
||||||
|
if(stockNumber===''){
|
||||||
|
return infoBox.showToast('请输入库存数量!')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const submitData = {
|
const submitData = {
|
||||||
...FormData,
|
...FormData,
|
||||||
images: images,
|
images: images,
|
||||||
|
|
@ -1462,6 +1474,7 @@
|
||||||
uni.setStorageSync('guige', FormData.specificationsGroup)
|
uni.setStorageSync('guige', FormData.specificationsGroup)
|
||||||
go.to('PAGES_PRODUCT_GUIGE_CHOOSE', {
|
go.to('PAGES_PRODUCT_GUIGE_CHOOSE', {
|
||||||
emitName: 'emitspecificationsSave',
|
emitName: 'emitspecificationsSave',
|
||||||
|
type:option.type,
|
||||||
productId: option.productId
|
productId: option.productId
|
||||||
})
|
})
|
||||||
// go.to('PAGES_PRODUCT_GUIGE_ADD', {
|
// go.to('PAGES_PRODUCT_GUIGE_ADD', {
|
||||||
|
|
@ -1566,11 +1579,12 @@
|
||||||
|
|
||||||
// 允许修改商品库存
|
// 允许修改商品库存
|
||||||
let disabledStock = ref(false)
|
let disabledStock = ref(false)
|
||||||
async function canEditGoodsStock() {
|
async function canEditGoodsStock(tips = false) {
|
||||||
|
console.log(tips);
|
||||||
if (option.type === 'edit') {
|
if (option.type === 'edit') {
|
||||||
const res = await hasPermission({
|
const res = await hasPermission({
|
||||||
text: '允许修改商品库存',
|
text: '允许修改商品库存',
|
||||||
tips: false
|
tips: tips
|
||||||
})
|
})
|
||||||
disabledStock.value = !res
|
disabledStock.value = !res
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -90,12 +90,17 @@
|
||||||
:placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
|
:placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
|
||||||
v-model="item.skus.suit" type="digit" placeholder="请输入起售数量" />
|
v-model="item.skus.suit" type="digit" placeholder="请输入起售数量" />
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
<uni-forms-item label="库存数量" required>
|
<view class="u-relative">
|
||||||
<uni-easyinput @blur="priceFormat(item.skus,'stockNumber')"
|
<uni-forms-item label="库存数量" required>
|
||||||
:paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
|
<uni-easyinput :disabled="disabledStock" @blur="priceFormat(item.skus,'stockNumber')"
|
||||||
:inputBorder="inputBorder" v-model="item.skus.stockNumber" type="digit"
|
:paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
|
||||||
placeholder="请输入库存数量" />
|
:inputBorder="inputBorder" v-model="item.skus.stockNumber" type="digit"
|
||||||
</uni-forms-item>
|
placeholder="请输入库存数量" />
|
||||||
|
</uni-forms-item>
|
||||||
|
<view class="u-absolute position-all" v-if="disabledStock" @click="canEditGoodsStock(true)">
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
<uni-forms-item label="分销金额" required>
|
<uni-forms-item label="分销金额" required>
|
||||||
<uni-easyinput @blur="priceFormat(item.skus,'firstShared')"
|
<uni-easyinput @blur="priceFormat(item.skus,'firstShared')"
|
||||||
:paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
|
:paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
|
||||||
|
|
@ -138,6 +143,31 @@
|
||||||
} from "@/commons/utils/format.js";
|
} from "@/commons/utils/format.js";
|
||||||
import popFastEdit from "./components/fast-edit.vue"
|
import popFastEdit from "./components/fast-edit.vue"
|
||||||
import infoBox from '@/commons/utils/infoBox.js'
|
import infoBox from '@/commons/utils/infoBox.js'
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
import go from '@/commons/utils/go.js';
|
||||||
|
import color from '@/commons/color.js';
|
||||||
|
import {
|
||||||
|
$defaultSku
|
||||||
|
} from '../goodsData.js'
|
||||||
|
import {
|
||||||
|
$productSpec
|
||||||
|
} from '@/http/yskApi/goods.js';
|
||||||
|
import {
|
||||||
|
onLoad,
|
||||||
|
onReady,
|
||||||
|
onShow
|
||||||
|
} from '@dcloudio/uni-app';
|
||||||
|
import {
|
||||||
|
onMounted,
|
||||||
|
reactive,
|
||||||
|
nextTick,
|
||||||
|
ref,
|
||||||
|
onBeforeMount,
|
||||||
|
watch
|
||||||
|
} from 'vue';
|
||||||
|
import {
|
||||||
|
hasPermission
|
||||||
|
} from '@/commons/utils/hasPermission.js';
|
||||||
const refFiles = ref([]);
|
const refFiles = ref([]);
|
||||||
//绑定文件上传元素
|
//绑定文件上传元素
|
||||||
function setRefFile(index) {
|
function setRefFile(index) {
|
||||||
|
|
@ -212,27 +242,7 @@
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
import dayjs from "dayjs";
|
|
||||||
import go from '@/commons/utils/go.js';
|
|
||||||
import color from '@/commons/color.js';
|
|
||||||
import {
|
|
||||||
$defaultSku
|
|
||||||
} from '../goodsData.js'
|
|
||||||
import {
|
|
||||||
$productSpec
|
|
||||||
} from '@/http/yskApi/goods.js';
|
|
||||||
import {
|
|
||||||
onLoad,
|
|
||||||
onReady
|
|
||||||
} from '@dcloudio/uni-app';
|
|
||||||
import {
|
|
||||||
onMounted,
|
|
||||||
reactive,
|
|
||||||
nextTick,
|
|
||||||
ref,
|
|
||||||
onBeforeMount,
|
|
||||||
watch
|
|
||||||
} from 'vue';
|
|
||||||
|
|
||||||
function updateSkuKey(arr) {
|
function updateSkuKey(arr) {
|
||||||
for (let i in FormData.result) {
|
for (let i in FormData.result) {
|
||||||
|
|
@ -446,9 +456,25 @@
|
||||||
}, '')
|
}, '')
|
||||||
return specSnap.substring(0, specSnap.length - 1)
|
return specSnap.substring(0, specSnap.length - 1)
|
||||||
}
|
}
|
||||||
|
// 允许修改商品库存
|
||||||
|
let disabledStock = ref(false)
|
||||||
|
async function canEditGoodsStock(tips = false) {
|
||||||
|
console.log(tips);
|
||||||
|
if (option.type === 'edit') {
|
||||||
|
const res = await hasPermission({
|
||||||
|
text: '允许修改商品库存',
|
||||||
|
tips: tips
|
||||||
|
})
|
||||||
|
disabledStock.value = !res
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onShow(()=>{
|
||||||
|
canEditGoodsStock()
|
||||||
|
})
|
||||||
|
|
||||||
onLoad(opt => {
|
onLoad(opt => {
|
||||||
|
Object.assign(option,opt)
|
||||||
getTbProductSpec()
|
getTbProductSpec()
|
||||||
const obj = uni.getStorageSync('guige')
|
const obj = uni.getStorageSync('guige')
|
||||||
if (obj && JSON.stringify(obj) !== '{}') {
|
if (obj && JSON.stringify(obj) !== '{}') {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue