代码更新
This commit is contained in:
@@ -1,120 +0,0 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="category " :style="getCompouteStyle()">
|
||||
<scroll-view scroll-y="true" :style="{height:props.height+'rpx'}">
|
||||
<view class="list">
|
||||
<view v-if="showAllText" class="font-bold item border-bottom u-font-28" @tap="cateClick({id:'',name:'全部分类'})">全部分类</view>
|
||||
<view v-for="(item,index) in category.list" :key="index">
|
||||
<view class="item font-bold border-bottom" @tap="cateClick(item)">
|
||||
{{item.name}}
|
||||
</view>
|
||||
<view class="item border-bottom" @tap="cateClick(child)"
|
||||
v-for="(child,childIndex) in item.childrenList"
|
||||
:key="childIndex" >
|
||||
<text> </text>
|
||||
{{child.name}}
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref, warn, watch, watchEffect,
|
||||
onMounted,reactive
|
||||
} from 'vue';
|
||||
import {$tbShopCategory} from '@/http/yskApi/goods.js'
|
||||
const emite=defineEmits(['cateClick','change'])
|
||||
const props = defineProps({
|
||||
showAllText:{
|
||||
type:Boolean,
|
||||
default:true
|
||||
},
|
||||
width: {
|
||||
type: [Number, String],
|
||||
default: 264
|
||||
},
|
||||
height: {
|
||||
type: [Number, String],
|
||||
default: 420
|
||||
},
|
||||
right: {
|
||||
type: [Number, String],
|
||||
default: 30
|
||||
},
|
||||
bottom: {
|
||||
type: [Number, String],
|
||||
default: 0
|
||||
}
|
||||
})
|
||||
let show = ref(false)
|
||||
|
||||
watch(()=>show.value,(newval)=>{
|
||||
emite('change',newval)
|
||||
})
|
||||
|
||||
function open() {
|
||||
show.value = true
|
||||
}
|
||||
|
||||
function close() {
|
||||
show.value = false
|
||||
}
|
||||
|
||||
function toggle() {
|
||||
show.value = !show.value
|
||||
}
|
||||
|
||||
function cateClick(item){
|
||||
emite('cateClick',item)
|
||||
close()
|
||||
}
|
||||
|
||||
function getCompouteStyle() {
|
||||
return {
|
||||
width: props.width + 'rpx',
|
||||
height: props.height + 'rpx',
|
||||
right: props.right + 'rpx',
|
||||
bottom: props.bottom + 'rpx',
|
||||
transform:`scaleY(${show.value?1:0})`
|
||||
}
|
||||
}
|
||||
const category=reactive({
|
||||
list:[],
|
||||
categoryId:'',
|
||||
categoryName:'',
|
||||
|
||||
})
|
||||
onMounted(()=>{
|
||||
$tbShopCategory({
|
||||
page:0,size:200
|
||||
}).then(res=>{
|
||||
category.list=res.content
|
||||
})
|
||||
})
|
||||
defineExpose({
|
||||
open,
|
||||
close,toggle
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.category {
|
||||
background: #FFFFFF;
|
||||
box-shadow: 0rpx 6rpx 12rpx 2rpx rgba(0, 0, 0, 0.16);
|
||||
border-radius: 14rpx 14rpx 14rpx 14rpx;
|
||||
position: fixed;
|
||||
font-size: 24rpx;
|
||||
color: #333;
|
||||
.list{
|
||||
box-sizing: border-box;
|
||||
.item{
|
||||
padding: 24rpx 24rpx 24rpx 48rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -1,93 +0,0 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="category " :style="getCompouteStyle()">
|
||||
<scroll-view scroll-y="true" :style="{height:props.height+'rpx'}">
|
||||
<view class="list">
|
||||
<view class="item" @tap="cateClick(item)" v-for="(item,index) in 20" :key="index">
|
||||
分类
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref, warn, watch, watchEffect,
|
||||
onMounted
|
||||
} from 'vue';
|
||||
import {$tbShopCategory} from '@/http/yskApi/goods.js'
|
||||
const emite=defineEmits(['cateClick'])
|
||||
const props = defineProps({
|
||||
width: {
|
||||
type: [Number, String],
|
||||
default: 264
|
||||
},
|
||||
height: {
|
||||
type: [Number, String],
|
||||
default: 420
|
||||
},
|
||||
right: {
|
||||
type: [Number, String],
|
||||
default: 30
|
||||
},
|
||||
bottom: {
|
||||
type: [Number, String],
|
||||
default: 0
|
||||
}
|
||||
})
|
||||
let show = ref(false)
|
||||
|
||||
function open() {
|
||||
show.value = true
|
||||
}
|
||||
|
||||
function close() {
|
||||
show.value = false
|
||||
}
|
||||
|
||||
function toggle() {
|
||||
show.value = !show.value
|
||||
}
|
||||
|
||||
function cateClick(item){
|
||||
emite('cateClick',item)
|
||||
}
|
||||
|
||||
function getCompouteStyle() {
|
||||
return {
|
||||
width: props.width + 'rpx',
|
||||
height: props.height + 'rpx',
|
||||
right: props.right + 'rpx',
|
||||
bottom: props.bottom + 'rpx',
|
||||
transform:`scaleY(${show.value?1:0})`
|
||||
}
|
||||
}
|
||||
onMounted(()=>{
|
||||
$tbShopCategory({
|
||||
page:0,size:200
|
||||
})
|
||||
})
|
||||
defineExpose({
|
||||
open,
|
||||
close,toggle
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.category {
|
||||
background: #FFFFFF;
|
||||
box-shadow: 0rpx 6rpx 12rpx 2rpx rgba(0, 0, 0, 0.16);
|
||||
border-radius: 14rpx 14rpx 14rpx 14rpx;
|
||||
position: fixed;
|
||||
font-size: 24rpx;
|
||||
color: #333;
|
||||
.list{
|
||||
box-sizing: border-box;
|
||||
.item{
|
||||
padding: 24rpx 24rpx 24rpx 48rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -3,11 +3,8 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
ref, warn, watch, watchEffect,
|
||||
onMounted,reactive
|
||||
} from 'vue';
|
||||
import {$tbShopCategory} from '@/http/yskApi/goods.js'
|
||||
import { ref, watch,onMounted,reactive } from 'vue';
|
||||
import { getCategoryList } from '@/api/product.js'
|
||||
const emite=defineEmits(['change','update:isShow','confirm'])
|
||||
const props = defineProps({
|
||||
showAllText:{
|
||||
@@ -35,7 +32,28 @@
|
||||
default:false
|
||||
}
|
||||
})
|
||||
|
||||
const category=reactive({
|
||||
list:[],
|
||||
})
|
||||
onMounted(()=>{
|
||||
getCategoryList({
|
||||
page:1,size:200
|
||||
}).then(res=>{
|
||||
res.unshift({
|
||||
name:'全部',
|
||||
id:'',
|
||||
childrenList:[]
|
||||
})
|
||||
category.list=[res.reduce((prve, cur) => {
|
||||
prve.push(...[{
|
||||
...cur,
|
||||
name: '' + cur.name,
|
||||
childrenList:undefined
|
||||
}])
|
||||
return prve
|
||||
}, [])]
|
||||
})
|
||||
})
|
||||
let show = ref(props.isShow)
|
||||
|
||||
watch(()=>show.value,(newval)=>{
|
||||
@@ -43,49 +61,19 @@
|
||||
emite('update:isShow',newval)
|
||||
})
|
||||
watch(()=>props.isShow,(newval)=>{
|
||||
console.log(newval);
|
||||
show.value=newval
|
||||
})
|
||||
|
||||
function confirm(e){
|
||||
console.log(e.value[0]);
|
||||
show.value = false
|
||||
emite('confirm',e.value[0])
|
||||
}
|
||||
function close() {
|
||||
console.log('close');
|
||||
show.value = false
|
||||
}
|
||||
|
||||
|
||||
const category=reactive({
|
||||
list:[],
|
||||
})
|
||||
onMounted(()=>{
|
||||
$tbShopCategory({
|
||||
page:0,size:200
|
||||
}).then(res=>{
|
||||
res.content.unshift({
|
||||
name:'全部',
|
||||
id:'',
|
||||
childrenList:[]
|
||||
})
|
||||
category.list=[res.content.reduce((prve, cur) => {
|
||||
prve.push(...[{
|
||||
...cur,
|
||||
name: '' + cur.name,
|
||||
childrenList:undefined
|
||||
}, ...cur.childrenList.map(v => {
|
||||
return {
|
||||
...v,
|
||||
name: '' + v.name
|
||||
}
|
||||
})])
|
||||
return prve
|
||||
}, [])]
|
||||
console.log(category.list);
|
||||
})
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -31,23 +31,17 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
reactive,
|
||||
ref,
|
||||
watch
|
||||
} from 'vue';
|
||||
import {
|
||||
returnSkuSnap,
|
||||
returnTypeEnum,
|
||||
returnCategory
|
||||
} from '@/pageProduct/util.js'
|
||||
import { reactive, ref, watch } from 'vue';
|
||||
import {
|
||||
$updateGrounding,
|
||||
$updateProductStatus,$updateProductData,
|
||||
$tbProskuConV2
|
||||
} from '@/http/yskApi/goods.js'
|
||||
import {hasPermission} from '@/commons/utils/hasPermission.js'
|
||||
import { hasPermission } from '@/commons/utils/hasPermission.js'
|
||||
import infoBox from '@/commons/utils/infoBox.js'
|
||||
|
||||
import { productOnOff,productMarkIsSoldOut } from '@/api/product.js'
|
||||
|
||||
const props = defineProps({
|
||||
show: {
|
||||
type: Boolean,
|
||||
@@ -86,8 +80,8 @@
|
||||
watch(() => props.show, (newval) => {
|
||||
popShow.value = newval
|
||||
if (newval) {
|
||||
console.log(props.goods);
|
||||
data.value = props.goods
|
||||
console.log(props.goods)
|
||||
isPauseSale.value = props.goods.isPauseSale
|
||||
isGrounding.value = props.goods.isGrounding
|
||||
}
|
||||
@@ -131,9 +125,11 @@
|
||||
if(!canShangXiaJia.value){
|
||||
return
|
||||
}
|
||||
await upDateGoods({
|
||||
key:'grounding',
|
||||
value: e
|
||||
console.log(e);
|
||||
await productOnOff({
|
||||
id: data.value.id,
|
||||
type:'sku',
|
||||
isSale: e
|
||||
})
|
||||
emits('isGroundingChange', e)
|
||||
infoBox.showToast('更新成功')
|
||||
@@ -144,9 +140,10 @@
|
||||
return
|
||||
}
|
||||
console.log(e);
|
||||
await upDateGoods({
|
||||
key:'pauseSale',
|
||||
value: e
|
||||
await productMarkIsSoldOut({
|
||||
id: data.value.id,
|
||||
type:'sku',
|
||||
isSoldOut: e
|
||||
})
|
||||
emits('isPauseSaleChange', e)
|
||||
infoBox.showToast('更新成功')
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
</view>
|
||||
</view>
|
||||
<view>
|
||||
<!-- <text class="u-font-28 color-666" @click="changeClick">修改</text> -->
|
||||
<text class="u-font-28 color-666" @click="changePrice">改价</text>
|
||||
<text class="u-font-28 color-red u-m-l-24" @click="baosun">报损</text>
|
||||
</view>
|
||||
@@ -37,7 +36,7 @@
|
||||
custom-style="background-color: #318AFE;" :text="data.typeEnum"></uni-tag> -->
|
||||
</view>
|
||||
<view class="u-font-32">
|
||||
<text v-if="data.typeEnum=='单规格'">¥</text>
|
||||
<text v-if="data.type=='single'">¥</text>
|
||||
<text>{{data.lowPrice}}</text>
|
||||
<!-- <text>¥</text>
|
||||
<text>{{data.lowPrice}}</text>
|
||||
@@ -50,18 +49,11 @@
|
||||
<view class="u-font-24 info-p-l u-m-t-6">规格:</view>
|
||||
<view class="skd" v-for="(item,index) in data.skuList" :key="index"
|
||||
@click="guigeClick(index)">
|
||||
<text>{{item.specSnap||item.name}}</text>
|
||||
<text>{{item.specInfo}}</text>
|
||||
<view class="tag-primary tag" v-if="item.isGrounding">上架中</view>
|
||||
<view class="tag-gray tag" v-if="item.isPauseSale">已售罄</view>
|
||||
<view class="tag-gray tag" v-if="!item.isGrounding">已下架</view>
|
||||
|
||||
<!-- <template v-if="item.isPauseSale">
|
||||
<view class="tag-gray tag" >已售罄</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view class="tag-primary tag" v-if="item.isGrounding">上架中</view>
|
||||
<view class="tag-gray tag" v-else>已下架</view>
|
||||
</template> -->
|
||||
|
||||
</view>
|
||||
</view>
|
||||
@@ -89,23 +81,15 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- <view class="u-m-t-16 skus u-text-center" v-if="data.skuList.length>=2">
|
||||
<view class="u-flex u-flex-wrap skds">
|
||||
<view class="skd" v-for="(item,index) in data.skuList" :key="index"><text>{{item.specSnap}}</text>
|
||||
<view class="tag-primary tag">上架中</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
</view> -->
|
||||
<view class="u-m-t-24 u-flex u-row-between">
|
||||
<view class="u-flex">
|
||||
<view class="u-flex">
|
||||
<view class="u-m-r-18 color-999">售罄</view>
|
||||
<my-switch disabled v-model="isPauseSale" :openDisabledClass="false" @click="isPauseSaleChange"></my-switch>
|
||||
<my-switch disabled v-model="isSoldStock" :openDisabledClass="false" @click="isSoldStockChange"></my-switch>
|
||||
</view>
|
||||
<view class="u-flex u-m-l-30">
|
||||
<view class="u-m-r-18 color-999">上架产品</view>
|
||||
<my-switch disabled v-model="isGrounding" :openDisabledClass="false" @click="isGroundingChange"></my-switch>
|
||||
<my-switch disabled v-model="isSale" :openDisabledClass="false" @click="isSaleChange"></my-switch>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex">
|
||||
@@ -119,21 +103,11 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
computed,
|
||||
ref,
|
||||
watch,
|
||||
watchEffect
|
||||
} from 'vue';
|
||||
import {
|
||||
$goodsIsHot,
|
||||
$tbProskuConV2,$updateProductData
|
||||
} from '@/http/yskApi/goods.js'
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { updateProduct,productOnOff,productMarkIsSoldOut } from '@/api/product.js'
|
||||
import go from '@/commons/utils/go.js';
|
||||
import {hasPermission} from '@/commons/utils/hasPermission.js';
|
||||
import {
|
||||
ColorMain
|
||||
} from '@/commons/color.js'
|
||||
import { ColorMain } from '@/commons/color.js'
|
||||
const emits = defineEmits(['radioClick', 'changeClick', 'xiajia', 'del', 'changePrice', 'baosun', 'guigeClick','update',
|
||||
'editStock'
|
||||
])
|
||||
@@ -175,7 +149,8 @@
|
||||
const max=247;
|
||||
for(let i in props.data.skuList){
|
||||
const sku=props.data.skuList[i]
|
||||
width+=(fontSize*sku.name.length+boxWith+gap)
|
||||
console.log(sku)
|
||||
width+=(fontSize*sku.specInfo.length+boxWith+gap)
|
||||
if(width>max){
|
||||
isOne=false
|
||||
break;
|
||||
@@ -189,10 +164,8 @@
|
||||
}
|
||||
|
||||
async function upDateGoods(par) {
|
||||
const res = await $updateProductData([{
|
||||
const res = await updateProduct([{
|
||||
id: props.data.id,
|
||||
isSku: 0,
|
||||
shopId: uni.getStorageSync('shopId'),
|
||||
...par
|
||||
}])
|
||||
uni.showToast({
|
||||
@@ -202,34 +175,58 @@
|
||||
emits('update')
|
||||
}
|
||||
|
||||
let isPauseSale=ref(props.data.isPauseSale)
|
||||
let isGrounding=ref(props.data.isGrounding)
|
||||
watch(() => props.data.isPauseSale, (newval) => {
|
||||
isPauseSale.value=newval
|
||||
let isSoldStock=ref(props.data.isSoldStock)
|
||||
let isSale=ref(props.data.isSale)
|
||||
watch(() => props.data.isSoldStock, (newval) => {
|
||||
isSoldStock.value=newval
|
||||
})
|
||||
watch(() => props.data.isGrounding, (newval) => {
|
||||
isGrounding.value=newval
|
||||
watch(() => props.data.isSale, (newval) => {
|
||||
isSale.value=newval
|
||||
})
|
||||
|
||||
async function isPauseSaleChange(e) {
|
||||
|
||||
/**
|
||||
* 修改售罄
|
||||
* @param {Object} e
|
||||
*/
|
||||
async function isSoldStockChange(e) {
|
||||
const res=await hasPermission('允许售罄商品')
|
||||
if(!res){
|
||||
return
|
||||
}
|
||||
upDateGoods({
|
||||
key: 'pauseSale',
|
||||
value: isPauseSale.value?0:1
|
||||
let res2 = await productMarkIsSoldOut({
|
||||
id: props.data.id,
|
||||
type: 'product',
|
||||
isSoldOut: isSoldStock.value?0:1
|
||||
})
|
||||
uni.showToast({
|
||||
title: '修改成功',
|
||||
icon: 'none'
|
||||
})
|
||||
emits('update')
|
||||
}
|
||||
async function isGroundingChange(e) {
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 修改上下价
|
||||
* @param {Object} e
|
||||
*/
|
||||
async function isSaleChange(e) {
|
||||
const res=await hasPermission('允许上下架商品')
|
||||
if(!res){
|
||||
return
|
||||
}
|
||||
upDateGoods({
|
||||
key: 'grounding',
|
||||
value: isGrounding.value?0:1
|
||||
let res2 = await productOnOff({
|
||||
id: props.data.id,
|
||||
type: 'product',
|
||||
isSale: isSale.value?0:1
|
||||
})
|
||||
uni.showToast({
|
||||
title: '修改成功',
|
||||
icon: 'none'
|
||||
})
|
||||
emits('update')
|
||||
}
|
||||
|
||||
let checked = ref(false)
|
||||
|
||||
Reference in New Issue
Block a user