增加商品管理编辑权限验证
This commit is contained in:
@@ -1,18 +1,17 @@
|
||||
<template>
|
||||
<view class="u-p-30 safe-page min-page">
|
||||
<up-sticky v-if="option.type==='edit'" offset-top="20" zIndex="99">
|
||||
<myTabs :list="tabsList" v-model="tabsCurrent"></myTabs>
|
||||
<my-tabs :list="tabsList" v-model="tabsCurrent"></my-tabs>
|
||||
</up-sticky>
|
||||
<view class="box">
|
||||
|
||||
|
||||
<template v-if="tabsCurrent===0">
|
||||
<view class="basic">
|
||||
<uni-forms :model="FormData" :rules="rules" :border="true" label-position="top"
|
||||
err-show-type="toast" validateTrigger="submit" label-width="350" ref="Forms">
|
||||
<view class="block">
|
||||
<uni-forms-item label="商品类型" required showRequired>
|
||||
<up-radio-group :disabled="option.type=='edit'" v-model="FormData.typeEnum"
|
||||
placement="row">
|
||||
<up-radio-group v-model="FormData.typeEnum" placement="row">
|
||||
<up-radio :customStyle="{marginRight: '30px'}"
|
||||
v-for="(item, index) in pageData.types" :key="index" :label="item.name"
|
||||
:name="item.value">
|
||||
@@ -40,21 +39,28 @@
|
||||
<uni-easyinput :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
|
||||
:inputBorder="inputBorder" v-model="FormData.name" placeholder="请输入商品名称" />
|
||||
</uni-forms-item>
|
||||
<template v-if="FormData.typeEnum!='group'">
|
||||
<uni-forms-item label="所属分类" required showRequired name="categoryId">
|
||||
<uni-data-picker :clear-icon="false" :map="{text:'name',value:'id'}"
|
||||
placeholder="请选择分类" popup-title="请选择分类" :localdata="pageData.category"
|
||||
v-model="FormData.categoryId">
|
||||
</uni-data-picker>
|
||||
</uni-forms-item>
|
||||
</template>
|
||||
|
||||
<view class="border-top-0">
|
||||
<uni-forms-item label="商品描述">
|
||||
<uni-easyinput :paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
|
||||
type="textarea" v-model="FormData.shortTitle" placeholder="请填写商品简述" />
|
||||
</uni-forms-item>
|
||||
</view>
|
||||
<template v-if="FormData.typeEnum!='group'">
|
||||
<view class="u-relative">
|
||||
<uni-forms-item label="所属分类" required showRequired name="categoryId">
|
||||
<uni-data-picker :clear-icon="false" :map="{text:'name',value:'id'}"
|
||||
placeholder="请选择分类" popup-title="请选择分类" :localdata="pageData.category"
|
||||
v-model="FormData.categoryId">
|
||||
</uni-data-picker>
|
||||
</uni-forms-item>
|
||||
<view class="zhezhao u-absolute position-all" @click="canEditGoodsCategory(true)" v-if="option.type=='edit'&&disabledChangeCategory">
|
||||
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
<view class="border-top-0">
|
||||
<uni-forms-item label="单位" required showRequired name="categoryId">
|
||||
@@ -115,13 +121,13 @@
|
||||
<template v-if="skuList.list.length">
|
||||
<view class="u-text-center">
|
||||
<view class="u-flex font-bold u-m-b-12">
|
||||
<view class="u-flex-1">组合名称</view>
|
||||
<view class="u-flex-1 u-text-left">组合名称</view>
|
||||
<view class="u-flex-1">售价</view>
|
||||
<view class="u-flex-1">库存数量</view>
|
||||
</view>
|
||||
<view class="u-flex u-p-b-12 u-p-t-12" v-for="(item,index) in skuList.list"
|
||||
:key="index">
|
||||
<view class="u-flex-1">{{item.specSnap}}</view>
|
||||
<view class="u-flex-1 u-text-left">{{item.specSnap}}</view>
|
||||
<view class="u-flex-1">¥{{item.salePrice}}</view>
|
||||
<view class="u-flex-1">{{item.stockNumber}}</view>
|
||||
</view>
|
||||
@@ -207,7 +213,7 @@
|
||||
</template>
|
||||
|
||||
<template v-if="FormData.typeEnum!='sku'">
|
||||
<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="border-top-0">
|
||||
<uni-forms-item label="售价">
|
||||
@@ -224,7 +230,7 @@
|
||||
:inputBorder="inputBorder" v-model="sku.memberPrice" type="digit"
|
||||
placeholder="请输入会员价(元)" />
|
||||
</uni-forms-item>
|
||||
<!-- <uni-forms-item label="成本价(元)">
|
||||
<!-- <uni-forms-item label="成本价(元)">
|
||||
<uni-easyinput @blur="priceFormat(sku,'costPrice')" :paddingNone="inputPaddingNone"
|
||||
:placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
|
||||
v-model="sku.costPrice" type="digit" placeholder="请输入成本价(元)" />
|
||||
@@ -240,12 +246,12 @@
|
||||
:placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
|
||||
v-model="sku.suit" type="digit" placeholder="请输入起售数量" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="库存数量">
|
||||
<!-- <uni-forms-item label="库存数量">
|
||||
<uni-easyinput @blur="priceFormat(sku,'stockNumber')"
|
||||
:paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
|
||||
:inputBorder="inputBorder" v-model="sku.stockNumber" type="digit"
|
||||
placeholder="请输入库存数量" />
|
||||
</uni-forms-item>
|
||||
</uni-forms-item> -->
|
||||
<uni-forms-item label="分销金额">
|
||||
<uni-easyinput :paddingNone="inputPaddingNone"
|
||||
@blur="priceFormat(sku,'firstShared')" :placeholderStyle="placeholderStyle"
|
||||
@@ -384,7 +390,7 @@
|
||||
|
||||
<template v-if="FormData.typeEnum!='group'">
|
||||
<view class="block">
|
||||
<view class="border-top-0">
|
||||
<!-- <view class="border-top-0">
|
||||
<uni-forms-item label="上架区域">
|
||||
<view class="u-flex">
|
||||
<view class="u-m-r-30">
|
||||
@@ -393,6 +399,15 @@
|
||||
<my-radio text="小程序商城" v-model="FormData.isShowMall"></my-radio>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
</view> -->
|
||||
<view class="border-top-0">
|
||||
<uni-forms-item label="">
|
||||
<view class="u-flex u-row-between">
|
||||
<view class="label-title">上架</view>
|
||||
<my-switch disabled :openDisabledClass="false" @click="isGroundingChange"
|
||||
v-model="FormData.isGrounding"></my-switch>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
</view>
|
||||
<uni-forms-item label="">
|
||||
<view class="u-flex u-row-between">
|
||||
@@ -401,6 +416,21 @@
|
||||
</view>
|
||||
<view class="color-999 u-m-t-16 u-font-24">注:关闭则不计算出入库数据</view>
|
||||
</uni-forms-item>
|
||||
<template v-if="FormData.isStock">
|
||||
<uni-forms-item label="库存数量">
|
||||
<uni-easyinput :paddingNone="inputPaddingNone"
|
||||
:disabled="disabledStock"
|
||||
:placeholderStyle="placeholderStyle" :inputBorder="inputBorder"
|
||||
v-model="FormData.stockNumber" type="digit" placeholder="请输入库存数量" />
|
||||
</uni-forms-item>
|
||||
</template>
|
||||
|
||||
<uni-forms-item label="">
|
||||
<view class="u-flex u-row-between">
|
||||
<view class="label-title">设为推荐</view>
|
||||
<my-switch v-model="FormData.isHot"></my-switch>
|
||||
</view>
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="">
|
||||
<view class="u-flex u-row-between">
|
||||
<view class="label-title">标签打印</view>
|
||||
@@ -414,12 +444,12 @@
|
||||
:inputBorder="inputBorder" v-model="FormData.packFee" type="digit"
|
||||
placeholder="请输入打包费" />
|
||||
</uni-forms-item>
|
||||
<uni-forms-item label="虚拟销量">
|
||||
<!-- <uni-forms-item label="虚拟销量">
|
||||
<uni-easyinput @blur="priceFormat(FormData,'baseSalesNumber')"
|
||||
:paddingNone="inputPaddingNone" :placeholderStyle="placeholderStyle"
|
||||
:inputBorder="inputBorder" v-model="FormData.baseSalesNumber" type="digit"
|
||||
placeholder="请输入虚拟销量" />
|
||||
</uni-forms-item>
|
||||
</uni-forms-item> -->
|
||||
<template v-if="option.type==='edit'">
|
||||
<uni-forms-item label="排序">
|
||||
<uni-easyinput @blur="priceFormat(FormData,'sort')"
|
||||
@@ -448,7 +478,8 @@
|
||||
</template>
|
||||
|
||||
<template v-if="tabsCurrent===1">
|
||||
<edit-haocai @updateGoods="updateGoodsDetail" :goods="FormData" @cancel="changeTabsCurrent(0)"></edit-haocai>
|
||||
<edit-haocai @updateGoods="updateGoodsDetail" :goods="FormData"
|
||||
@cancel="changeTabsCurrent(0)"></edit-haocai>
|
||||
</template>
|
||||
</view>
|
||||
|
||||
@@ -489,17 +520,15 @@
|
||||
import go from '@/commons/utils/go.js';
|
||||
import color from '@/commons/color.js';
|
||||
|
||||
import myModel from '@/components/my-components/my-model'
|
||||
import chooseGoods from './components/choose-goods'
|
||||
import editHaocai from './components/edit-haocai.vue'
|
||||
import chooseGroupCategory from './components/choose-coupon-category'
|
||||
import myRadio from '@/components/my-components/my-radio'
|
||||
import myUploadFile from '@/components/my-components/my-upload-file'
|
||||
import myTabs from '@/components/my-components/my-tabs'
|
||||
import myButton from '@/components/my-components/my-button'
|
||||
import mySwitch from '@/components/my-components/my-switch.vue'
|
||||
import infoBox from "@/commons/utils/infoBox.js"
|
||||
|
||||
import {
|
||||
hasPermission
|
||||
} from '@/commons/utils/hasPermission.js';
|
||||
|
||||
import {
|
||||
$types,
|
||||
$defaultSku
|
||||
@@ -513,7 +542,10 @@
|
||||
$delProduct,
|
||||
$productSpec,
|
||||
$updateProductStatus,
|
||||
$updateGrounding
|
||||
$updateGrounding,
|
||||
$goodsIsHot,
|
||||
$tbProskuConV2,
|
||||
$updateProductData
|
||||
} from '@/http/yskApi/goods.js'
|
||||
|
||||
import {
|
||||
@@ -535,6 +567,50 @@
|
||||
nextTick
|
||||
} from 'vue';
|
||||
|
||||
async function upDateGoods(par) {
|
||||
const res = await $updateProductData([{
|
||||
id: FormData.id,
|
||||
isSku: 0,
|
||||
shopId: uni.getStorageSync('shopId'),
|
||||
...par
|
||||
}])
|
||||
uni.showToast({
|
||||
title: '修改成功',
|
||||
icon: 'none'
|
||||
})
|
||||
}
|
||||
async function isPauseSaleChange(e) {
|
||||
if (option.type == 'add') {
|
||||
FormData.isPauseSale = FormData.isPauseSale ? 0 : 1
|
||||
return
|
||||
}
|
||||
const res = await hasPermission('允许售罄商品')
|
||||
if (!res) {
|
||||
return
|
||||
}
|
||||
await upDateGoods({
|
||||
key: 'pauseSale',
|
||||
value: FormData.isPauseSale ? 0 : 1
|
||||
})
|
||||
FormData.isPauseSale = FormData.isPauseSale ? 0 : 1
|
||||
}
|
||||
|
||||
async function isGroundingChange(e) {
|
||||
if (option.type == 'add') {
|
||||
FormData.isGrounding = FormData.isGrounding ? 0 : 1
|
||||
return
|
||||
}
|
||||
const res = await hasPermission('允许上下架商品')
|
||||
if (!res) {
|
||||
return
|
||||
}
|
||||
await upDateGoods({
|
||||
key: 'grounding',
|
||||
value: FormData.isGrounding ? 0 : 1
|
||||
})
|
||||
FormData.isGrounding = FormData.isGrounding ? 0 : 1
|
||||
}
|
||||
|
||||
function toRecoders() {
|
||||
go.to('PAGES_PRODUCT_INVOICING_LIST', {
|
||||
productId: FormData.id
|
||||
@@ -932,9 +1008,11 @@
|
||||
isShowMall: 1,
|
||||
isShowCash: 1,
|
||||
isStock: 0,
|
||||
isStock: 0,
|
||||
isHot: 0,
|
||||
packFee: 0,
|
||||
specId: "",
|
||||
baseSalesNumber: 0,
|
||||
// baseSalesNumber: 0,
|
||||
sort: 0,
|
||||
groupSnap: [],
|
||||
specInfo: [],
|
||||
@@ -942,6 +1020,8 @@
|
||||
specTableHeaders: [],
|
||||
skuSnap: "",
|
||||
groupCategoryId: [],
|
||||
isGrounding: 1,
|
||||
stockNumber: 0,
|
||||
notices: {
|
||||
availableTime: "",
|
||||
bookingType: "",
|
||||
@@ -1001,14 +1081,14 @@
|
||||
url: v
|
||||
}
|
||||
})
|
||||
for(let i in res.conInfos){
|
||||
const con=res.conInfos[i]
|
||||
const item=res.skuList.find(v=>v.id==con.productSkuId)
|
||||
if(item){
|
||||
if(item.hasOwnProperty('haoCaiList')){
|
||||
for (let i in res.conInfos) {
|
||||
const con = res.conInfos[i]
|
||||
const item = res.skuList.find(v => v.id == con.productSkuId)
|
||||
if (item) {
|
||||
if (item.hasOwnProperty('haoCaiList')) {
|
||||
item.haoCaiList.push(con)
|
||||
}else{
|
||||
item.haoCaiList=[con]
|
||||
} else {
|
||||
item.haoCaiList = [con]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1054,7 +1134,7 @@
|
||||
},
|
||||
names,
|
||||
specSnap: v.specSnap,
|
||||
coverImg:v.coverImg
|
||||
coverImg: v.coverImg
|
||||
}
|
||||
}),
|
||||
specList: [],
|
||||
@@ -1161,9 +1241,10 @@
|
||||
pageData.skuList = res
|
||||
})
|
||||
}
|
||||
function updateGoodsDetail(){
|
||||
|
||||
function updateGoodsDetail() {
|
||||
getGoodsDetail()
|
||||
getProductSku()
|
||||
// getProductSku()
|
||||
}
|
||||
onLoad((params) => {
|
||||
if (isEmpty(params)) {
|
||||
@@ -1173,14 +1254,13 @@
|
||||
// getGoodsDetail()
|
||||
// getProductSku()
|
||||
}
|
||||
|
||||
console.log(option.type);
|
||||
canEditGoodsCategory()
|
||||
uni.setNavigationBarTitle({
|
||||
title: option.type === 'add' ? '添加商品' : '编辑商品'
|
||||
})
|
||||
if (option.type === 'edit') {
|
||||
getGoodsDetail()
|
||||
getProductSku()
|
||||
// getProductSku()
|
||||
}
|
||||
defaultValueInit()
|
||||
getCategory()
|
||||
@@ -1212,12 +1292,18 @@
|
||||
function settimeoutBack(time) {
|
||||
clearTimeout(timer)
|
||||
timer = setTimeout(() => {
|
||||
uni.$emit('update:productIndex')
|
||||
uni.navigateBack()
|
||||
}, time)
|
||||
}
|
||||
|
||||
//保存
|
||||
function save() {
|
||||
async function save() {
|
||||
const bol = await hasPermission('允许修改商品')
|
||||
if (!bol) {
|
||||
return
|
||||
}
|
||||
|
||||
Forms.value.validate().then(res => {
|
||||
const {
|
||||
typeEnum,
|
||||
@@ -1226,12 +1312,12 @@
|
||||
if (typeEnum === 'group' && !groupCategoryId.length) {
|
||||
return infoBox.showToast('请选择团购券分类')
|
||||
}
|
||||
|
||||
|
||||
// if(typeEnum==='sku'){
|
||||
// return infoBox.showErrorToast('请选择规格')
|
||||
// }
|
||||
const images = refFile.value.getFileList()
|
||||
if(images.length<=0){
|
||||
if (images.length <= 0) {
|
||||
return infoBox.showToast('请上传商品图片')
|
||||
}
|
||||
const skuSnap = []
|
||||
@@ -1239,8 +1325,8 @@
|
||||
...$defaultSku,
|
||||
barCode: `${uni.getStorageSync("shopId")}${dayjs().valueOf()}`
|
||||
}];
|
||||
if(typeEnum=='normal'){
|
||||
submitSkuList=skuList.list ;
|
||||
if (typeEnum == 'normal') {
|
||||
submitSkuList = skuList.list;
|
||||
}
|
||||
console.log(submitSkuList);
|
||||
if (FormData.specificationsGroup) {
|
||||
@@ -1253,6 +1339,16 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log(FormData.specificationsGroup);
|
||||
const selectSpec = FormData.typeEnum != 'sku' ? '' : JSON.stringify(FormData.specificationsGroup
|
||||
.selectSpec.map(spe => {
|
||||
return {
|
||||
...spe,
|
||||
value: spe.value.map(v => {
|
||||
return typeof v === 'string' ? v : v.text || v.value
|
||||
})
|
||||
}
|
||||
}))
|
||||
const submitData = {
|
||||
...FormData,
|
||||
images: images,
|
||||
@@ -1261,13 +1357,7 @@
|
||||
specInfo: JSON.stringify(submitSkuList),
|
||||
lowPrice: submitSkuList[0].salePrice,
|
||||
specificationsGroup: undefined,
|
||||
selectSpec: JSON.stringify(FormData.specificationsGroup.selectSpec.map(spe=>{
|
||||
return {
|
||||
...spe,value:spe.value.map(v=>{
|
||||
return typeof v==='string'?v:v.text||v.value
|
||||
})
|
||||
}
|
||||
})),
|
||||
selectSpec,
|
||||
skuSnap: JSON.stringify(skuSnap)
|
||||
}
|
||||
//编辑
|
||||
@@ -1420,15 +1510,46 @@
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
/**
|
||||
* 权限start
|
||||
*/
|
||||
|
||||
// 允许修改商品库存
|
||||
let disabledStock=ref(false)
|
||||
async function canEditGoodsStock() {
|
||||
if (option.type === 'edit') {
|
||||
const res=await hasPermission({text:'允许修改商品库存',tips:false})
|
||||
disabledStock.value=!res
|
||||
}
|
||||
}
|
||||
watch(() => FormData.isStock, (newval) => {
|
||||
if (newval) {
|
||||
canEditGoodsStock()
|
||||
}
|
||||
})
|
||||
// 允许修改商品分类
|
||||
let disabledChangeCategory=ref(false)
|
||||
async function canEditGoodsCategory(tips=false) {
|
||||
if (option.type === 'edit') {
|
||||
const res=await hasPermission({text:'允许修改分类',tips})
|
||||
disabledChangeCategory.value=!res
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 权限end
|
||||
*/
|
||||
|
||||
|
||||
watch(() => pageData.types, (newval) => {
|
||||
Forms.value.setRules(rules)
|
||||
})
|
||||
onShow(() => {
|
||||
watchSpecificationsSave()
|
||||
})
|
||||
onReady(() => {
|
||||
Forms.value && Forms.value.setRules(rules)
|
||||
})
|
||||
watch(() => pageData.types, (newval) => {
|
||||
Forms.value.setRules(rules)
|
||||
})
|
||||
</script>
|
||||
<style scoped>
|
||||
page {
|
||||
|
||||
@@ -26,8 +26,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-m-t-32 color-666">
|
||||
<view class="u-m-t-24" v-for="(item,haocaiIndex) in sku.haoCaiList"
|
||||
:key="haocaiIndex">
|
||||
<view class="u-m-t-24" v-for="(item,haocaiIndex) in sku.haoCaiList" :key="haocaiIndex">
|
||||
<view class=" u-flex">
|
||||
<view class="xuhao">{{haocaiIndex+1}}</view>
|
||||
<view class="u-flex u-flex-1 u-p-l-32 gap-20">
|
||||
@@ -42,8 +41,8 @@
|
||||
</view>
|
||||
<view class="u-flex input">
|
||||
<up-input border="none" v-model="item.surplusStock"></up-input>
|
||||
<up-icon @click="delGuigeHaocao(index,haocaiIndex)" color="#EB4F4F" :size="16"
|
||||
name="minus-circle-fill"></up-icon>
|
||||
<up-icon @click="delGuigeHaocao(index,haocaiIndex)" color="#EB4F4F"
|
||||
:size="16" name="minus-circle-fill"></up-icon>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -178,7 +177,13 @@
|
||||
import {
|
||||
$tbProskuConV2
|
||||
} from '@/http/yskApi/goods.js'
|
||||
import { cloneWith } from 'lodash';
|
||||
import {
|
||||
cloneWith
|
||||
} from 'lodash';
|
||||
|
||||
import {
|
||||
hasPermission
|
||||
} from '@/commons/utils/hasPermission.js';
|
||||
const emits = defineEmits(['cancel', 'updateGoods'])
|
||||
|
||||
function cancel() {
|
||||
@@ -276,7 +281,7 @@ import { cloneWith } from 'lodash';
|
||||
content: '是否删除该耗材',
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
if (item&&item.id) {
|
||||
if (item && item.id) {
|
||||
deletetbProskuCon([item.id]).then(res1 => {
|
||||
skuList.value[guigeIndex].haoCaiList.splice(haocaiIndex, 1)
|
||||
})
|
||||
@@ -297,25 +302,31 @@ import { cloneWith } from 'lodash';
|
||||
watch(() => props.goods.typeEnum, (newval) => {
|
||||
isBindGuige.value = isSku.value
|
||||
})
|
||||
|
||||
|
||||
|
||||
async function save() {
|
||||
const bol = await hasPermission('允许修改商品')
|
||||
if (!bol) {
|
||||
return
|
||||
}
|
||||
console.log('save');
|
||||
let isPas=false
|
||||
if(!isBindGuige.value){
|
||||
let isPas = false
|
||||
if (!isBindGuige.value) {
|
||||
//绑定至商品
|
||||
isPas = conInfos.value.every(v => {
|
||||
isPas = conInfos.value.every(v => {
|
||||
return v.conInfoId && v.conUnit && v.surplusStock > 0
|
||||
})
|
||||
}else{
|
||||
} else {
|
||||
//绑定至规格
|
||||
isPas = skuList.value.filter(v=>v.haoCaiList&&v.haoCaiList.length).every(sku => {
|
||||
isPas = skuList.value.filter(v => v.haoCaiList && v.haoCaiList.length).every(sku => {
|
||||
console.log(sku.haoCaiList);
|
||||
return sku.haoCaiList.every(v=>{
|
||||
return v.conInfoId && v.conUnit && v.surplusStock > 0
|
||||
return sku.haoCaiList.every(v => {
|
||||
return v.conInfoId && v.conUnit && v.surplusStock > 0
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
if (!isPas) {
|
||||
return infoBox.showToast('请填写全部耗材选项值')
|
||||
}
|
||||
@@ -337,10 +348,10 @@ import { cloneWith } from 'lodash';
|
||||
}
|
||||
})
|
||||
} else {
|
||||
for(let i in skuList.value){
|
||||
const haocaiList=skuList.value[i].haoCaiList||[]
|
||||
for(let k in haocaiList){
|
||||
const v=haocaiList[k]
|
||||
for (let i in skuList.value) {
|
||||
const haocaiList = skuList.value[i].haoCaiList || []
|
||||
for (let k in haocaiList) {
|
||||
const v = haocaiList[k]
|
||||
ajaxData.cons.push({
|
||||
id: v.id || '',
|
||||
conInfoId: v.conInfoId,
|
||||
|
||||
@@ -548,7 +548,7 @@
|
||||
}
|
||||
|
||||
.box {
|
||||
margin-top: 70rpx;
|
||||
// margin-top: 70rpx;
|
||||
font-size: 28rpx;
|
||||
|
||||
.block {
|
||||
|
||||
@@ -87,11 +87,11 @@
|
||||
<view class="u-flex">
|
||||
<view class="u-flex">
|
||||
<view class="u-m-r-18 color-999">售罄</view>
|
||||
<my-switch v-model="isPauseSale" @change="isPauseSaleChange"></my-switch>
|
||||
<my-switch disabled v-model="isPauseSale" :openDisabledClass="false" @click="isPauseSaleChange"></my-switch>
|
||||
</view>
|
||||
<view class="u-flex u-m-l-30">
|
||||
<view class="u-m-r-18 color-999">{{data.isGrounding?'下架产品':'上架产品' }}</view>
|
||||
<my-switch v-model="isGrounding" @change="isGroundingChange"></my-switch>
|
||||
<my-switch disabled v-model="isGrounding" :openDisabledClass="false" @click="isGroundingChange"></my-switch>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex">
|
||||
@@ -117,8 +117,8 @@
|
||||
$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 {hasPermission} from '@/commons/utils/hasPermission.js';
|
||||
import {
|
||||
ColorMain
|
||||
} from '@/commons/color.js'
|
||||
@@ -171,17 +171,24 @@
|
||||
isGrounding.value=newval
|
||||
})
|
||||
|
||||
function isPauseSaleChange(e) {
|
||||
async function isPauseSaleChange(e) {
|
||||
const res=await hasPermission('允许售罄商品')
|
||||
if(!res){
|
||||
return
|
||||
}
|
||||
upDateGoods({
|
||||
key: 'pauseSale',
|
||||
value: e
|
||||
value: isPauseSale.value?0:1
|
||||
})
|
||||
}
|
||||
|
||||
function isGroundingChange(e) {
|
||||
async function isGroundingChange(e) {
|
||||
const res=await hasPermission('允许上下架商品')
|
||||
if(!res){
|
||||
return
|
||||
}
|
||||
upDateGoods({
|
||||
key: 'grounding',
|
||||
value: e
|
||||
value: isGrounding.value?0:1
|
||||
})
|
||||
}
|
||||
|
||||
@@ -208,7 +215,11 @@
|
||||
emits('del', props.index)
|
||||
}
|
||||
|
||||
function changePrice() {
|
||||
async function changePrice() {
|
||||
const res=await hasPermission('允许修改商品')
|
||||
if(!res){
|
||||
return
|
||||
}
|
||||
emits('changePrice', props.index)
|
||||
}
|
||||
|
||||
@@ -225,10 +236,11 @@
|
||||
}
|
||||
//携带参数type edit跳转到商品添加页面,编辑与添加同一页面,根据type值来判断
|
||||
function toEdit() {
|
||||
go.to('PAGES_PRODUCT_ADD', {
|
||||
type: 'edit',
|
||||
productId: props.data.id
|
||||
})
|
||||
emits('edit', props.data.id)
|
||||
// go.to('PAGES_PRODUCT_ADD', {
|
||||
// type: 'edit',
|
||||
// productId: props.data.id
|
||||
// })
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
<template v-if="pageData.goodsList.length">
|
||||
<view class="u-m-b-32" v-for="(item,index) in pageData.goodsList" :key="index">
|
||||
<my-goods :key="item.id" @update="getGoodsList" @changePrice="changePriceShow" @changeClick="goodsChangeClick"
|
||||
@edit="toGoodsDetail"
|
||||
@editStock="changeStockShow" @guigeClick="editGuigeShow" @baosun="baosunShow"
|
||||
@radioClick="goodsRadioClick" :index="index" :data="item" @del="goodsDel"
|
||||
:showChecked="showChecked" :showDetail="pageData.showGoodsDetail"></my-goods>
|
||||
@@ -149,6 +150,7 @@
|
||||
watch
|
||||
} from 'vue';
|
||||
import go from '@/commons/utils/go.js';
|
||||
import {hasPermission} from '@/commons/utils/hasPermission.js';
|
||||
import myGoods from './components/goods.vue'
|
||||
import myControl from './components/control.vue'
|
||||
import myCategory from './components/category.vue'
|
||||
@@ -285,7 +287,11 @@
|
||||
|
||||
|
||||
// 修改库存弹窗展示
|
||||
function changeStockShow(index) {
|
||||
async function changeStockShow(index) {
|
||||
const res= await hasPermission('允许修改商品库存')
|
||||
if(!res){
|
||||
return
|
||||
}
|
||||
pageData.selGoodsIndex = index
|
||||
const goods = pageData.goodsList[index]
|
||||
goods.skuList = goods.skuList.map(v => {
|
||||
@@ -387,8 +393,15 @@
|
||||
pageData.totalElements = res.totalElements
|
||||
})
|
||||
}
|
||||
function watchEmitInit(){
|
||||
uni.$off('update:productIndex')
|
||||
uni.$on('update:productIndex',(data)=>{
|
||||
getGoodsList()
|
||||
})
|
||||
}
|
||||
onShow(() => {
|
||||
// getGoodsList()
|
||||
watchEmitInit()
|
||||
})
|
||||
onLoad(() => {
|
||||
getGoodsList()
|
||||
@@ -484,7 +497,18 @@
|
||||
pageData.totalElements=0;
|
||||
pageData.query.page=0;
|
||||
}
|
||||
|
||||
|
||||
async function toGoodsDetail(id){
|
||||
const res= await hasPermission('允许修改商品')
|
||||
if(!res){
|
||||
return
|
||||
}
|
||||
go.to('PAGES_PRODUCT_ADD', {
|
||||
type: 'edit',
|
||||
productId: id
|
||||
})
|
||||
}
|
||||
|
||||
function statesTableClick(index) {
|
||||
pageData.stateCurrent = index;
|
||||
resetQuery()
|
||||
|
||||
Reference in New Issue
Block a user