代码更新
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)
|
||||
|
||||
@@ -2,9 +2,6 @@
|
||||
<view class="safe-page min-page">
|
||||
<up-sticky>
|
||||
<view class="bg-fff u-p-l-30 u-p-b-30">
|
||||
<!-- <view class="myTabs ">
|
||||
<myTabs :list="tabsList" @change="tabsChange"></myTabs>
|
||||
</view> -->
|
||||
<view class="input-wrapper">
|
||||
<view class="input-main">
|
||||
<view class="u-flex u-p-r-30 u-font-28" @click="onCategoryShowChange(true)">
|
||||
@@ -36,7 +33,7 @@
|
||||
</view>
|
||||
<view class="u-flex u-col-center" @click="go.to('PAGES_PRODUCT_SPECIF_TEMPLATE')">
|
||||
<image src="/pageProduct/static/images/icon-guige.svg" class="icon-guige" />
|
||||
<text class="color-666 u-m-l-12 u-font-24">规格模版</text>
|
||||
<text class="color-666 u-m-l-12 u-font-24">规格</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@@ -56,7 +53,7 @@
|
||||
<my-img-empty tips="未找到相关商品"></my-img-empty>
|
||||
</template>
|
||||
<template v-if="pageData.goodsList.length">
|
||||
<my-pagination :page="pageData.query.page+1" :totalElements="pageData.totalElements" :size="pageData.query.size"
|
||||
<my-pagination :page="pageData.query.page" :totalElements="pageData.totalElements" :size="pageData.query.size"
|
||||
@change="pageChange"></my-pagination>
|
||||
</template>
|
||||
|
||||
@@ -77,7 +74,7 @@
|
||||
<view>
|
||||
<view class="">排序:</view>
|
||||
<view class="u-m-t-24">
|
||||
<uni-easyinput v-model="goodsStockData.sort" placeholder="请输入排序"></uni-easyinput>
|
||||
<uni-easyinput v-model="goodsStockData.orderBy" placeholder="请输入排序"></uni-easyinput>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-m-t-32">
|
||||
@@ -95,13 +92,13 @@
|
||||
<view class="u-flex u-m-t-32">
|
||||
<view class="">售罄:</view>
|
||||
<view class="u-m-l-46 ">
|
||||
<my-switch v-model="goodsStockData.isPauseSale"></my-switch>
|
||||
<my-switch v-model="goodsStockData.isSoldStock"></my-switch>
|
||||
</view>
|
||||
</view>
|
||||
<view class="u-flex u-m-t-32">
|
||||
<view class="">上架:</view>
|
||||
<view class="u-m-l-46 ">
|
||||
<my-switch v-model="goodsStockData.isGrounding"></my-switch>
|
||||
<my-switch v-model="goodsStockData.isSale"></my-switch>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
@@ -176,6 +173,11 @@
|
||||
$tbProductV2,
|
||||
$updateProductData
|
||||
} from "@/http/yskApi/goods.js"
|
||||
import {
|
||||
getProductList,
|
||||
getCategoryList
|
||||
} from '@/api/product.js'
|
||||
|
||||
import {
|
||||
returnAllCategory
|
||||
} from '@/pageProduct/util.js'
|
||||
@@ -195,15 +197,13 @@
|
||||
totalPage: 0,
|
||||
goodsList: [],
|
||||
query: {
|
||||
page: 0,
|
||||
page: 1,
|
||||
size: 10,
|
||||
createdAt: [],
|
||||
id: "",
|
||||
categoryId: '',
|
||||
name: '',
|
||||
isPauseSale: '',
|
||||
sort: "createdAt,desc",
|
||||
isGrounding: ''
|
||||
orderBy: "create_time desc",
|
||||
isSoldStock: '',
|
||||
isSale: ''
|
||||
},
|
||||
category: '',
|
||||
categoryList: [], //分类列表
|
||||
@@ -214,10 +214,10 @@
|
||||
watch(() => pageData.query.categoryId, (newval) => {
|
||||
getGoodsList()
|
||||
})
|
||||
watch(() => pageData.query.isPauseSale, (newval) => {
|
||||
watch(() => pageData.query.isSoldStock, (newval) => {
|
||||
getGoodsList()
|
||||
})
|
||||
watch(() => pageData.query.isGrounding, (newval) => {
|
||||
watch(() => pageData.query.isSale, (newval) => {
|
||||
getGoodsList()
|
||||
})
|
||||
const popup = reactive({
|
||||
@@ -237,7 +237,47 @@
|
||||
show: false
|
||||
}
|
||||
})
|
||||
|
||||
onShow(() => {
|
||||
// getGoodsList()
|
||||
watchEmitInit()
|
||||
})
|
||||
onLoad(() => {
|
||||
getGoodsList()
|
||||
getCategory()
|
||||
})
|
||||
|
||||
/**
|
||||
* 获取商品列表
|
||||
*/
|
||||
function getGoodsList() {
|
||||
pageData.hasAjax = false
|
||||
getProductList(pageData.query).then(res => {
|
||||
pageData.hasAjax = true
|
||||
pageData.goodsList = res.records.map(v => {
|
||||
return {
|
||||
...v,
|
||||
isSellNone: false,
|
||||
checked: false,
|
||||
showDetail: false
|
||||
}
|
||||
})
|
||||
pageData.totalElements = res.totalRow
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品分类列表
|
||||
*/
|
||||
function getCategory () {
|
||||
getCategoryList({
|
||||
page: 1,
|
||||
size: 200
|
||||
}).then(res => {
|
||||
pageData.categoryList = returnAllCategory(res)
|
||||
console.log(pageData.categoryList);
|
||||
})
|
||||
}
|
||||
|
||||
//报损弹窗展示
|
||||
function baosunShow(index) {
|
||||
pageData.selGoodsIndex = index
|
||||
@@ -246,17 +286,22 @@
|
||||
popup.baosun.show = true
|
||||
}
|
||||
|
||||
// 修改价格弹窗展示
|
||||
/**
|
||||
* 修改价格弹窗展示
|
||||
* @param {Object} index
|
||||
*/
|
||||
function changePriceShow(index) {
|
||||
pageData.selGoodsIndex = index
|
||||
const goods = pageData.goodsList[index]
|
||||
console.log(goods)
|
||||
goods.skuList = goods.skuList.map(v => {
|
||||
return {
|
||||
...v,
|
||||
_lowPrice: v.lowPrice
|
||||
}
|
||||
})
|
||||
const lowPrice = goods.lowPrice.replace('¥', '') * 1
|
||||
console.log(goods)
|
||||
const lowPrice = goods.lowPrice.toString().replace('¥', '') * 1
|
||||
pageData.selGoods = {
|
||||
...goods,
|
||||
lowPrice,
|
||||
@@ -354,27 +399,31 @@
|
||||
|
||||
//修改规格上下架,售罄
|
||||
function editGuigeShow(goodsIndex, guigeIndex) {
|
||||
console.log(goodsIndex, guigeIndex);
|
||||
const goodsGuige = pageData.goodsList[goodsIndex].skuList[guigeIndex]
|
||||
console.log(goodsIndex, guigeIndex);
|
||||
popup.guige.data = goodsGuige
|
||||
popup.guige.goodsIndex = goodsIndex
|
||||
popup.guige.guigeIndex = guigeIndex
|
||||
popup.guige.show = true
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 规格上下架
|
||||
* @param {Object} e
|
||||
*/
|
||||
function isGroundingChange(e) {
|
||||
const {
|
||||
goodsIndex,
|
||||
guigeIndex
|
||||
} = popup.guige
|
||||
const { goodsIndex, guigeIndex } = popup.guige
|
||||
console.log(goodsIndex,guigeIndex)
|
||||
pageData.goodsList[goodsIndex].skuList[guigeIndex].isGrounding = e
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 规格已售罄
|
||||
* @param {Object} e
|
||||
*/
|
||||
function isPauseSaleChange(e) {
|
||||
const {
|
||||
goodsIndex,
|
||||
guigeIndex
|
||||
} = popup.guige
|
||||
const { goodsIndex, guigeIndex } = popup.guige
|
||||
console.log(goodsIndex,guigeIndex)
|
||||
pageData.goodsList[goodsIndex].skuList[guigeIndex].isPauseSale = e
|
||||
}
|
||||
|
||||
@@ -388,22 +437,6 @@
|
||||
pageData.categoryName = category.name
|
||||
}
|
||||
|
||||
function getGoodsList() {
|
||||
pageData.hasAjax = false
|
||||
$tbProductV2(pageData.query).then(res => {
|
||||
pageData.hasAjax = true
|
||||
console.log(res);
|
||||
pageData.goodsList = res.content.map(v => {
|
||||
return {
|
||||
...v,
|
||||
isSellNone: false,
|
||||
checked: false,
|
||||
showDetail: false
|
||||
}
|
||||
})
|
||||
pageData.totalElements = res.totalElements
|
||||
})
|
||||
}
|
||||
|
||||
function watchEmitInit() {
|
||||
uni.$off('update:productIndex')
|
||||
@@ -419,20 +452,7 @@
|
||||
})
|
||||
|
||||
}
|
||||
onShow(() => {
|
||||
// getGoodsList()
|
||||
watchEmitInit()
|
||||
})
|
||||
onLoad(() => {
|
||||
getGoodsList()
|
||||
$tbShopCategory({
|
||||
page: 0,
|
||||
size: 200
|
||||
}).then(res => {
|
||||
pageData.categoryList = returnAllCategory(res.content)
|
||||
console.log(pageData.categoryList);
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
const tabsList = ['简洁', '详情']
|
||||
const statesTabsList = ['全部', '已售罄', '在售中', '已下架']
|
||||
@@ -451,7 +471,7 @@
|
||||
sort: 0,
|
||||
isStock: false,
|
||||
isDistribute: false,
|
||||
isPauseSale: false,
|
||||
isSoldStock: false,
|
||||
isGrounding: false,
|
||||
stockNumber: 0,
|
||||
})
|
||||
@@ -516,7 +536,7 @@
|
||||
|
||||
function resetQuery() {
|
||||
pageData.totalElements = 0;
|
||||
pageData.query.page = 0;
|
||||
pageData.query.page = 1;
|
||||
}
|
||||
|
||||
async function toGoodsDetail(id) {
|
||||
@@ -535,23 +555,23 @@
|
||||
resetQuery()
|
||||
console.log(index);
|
||||
if (index == 0) {
|
||||
pageData.query.isPauseSale = ''
|
||||
pageData.query.isGrounding = ''
|
||||
pageData.query.isSoldStock = ''
|
||||
pageData.query.isSale = ''
|
||||
return
|
||||
}
|
||||
if (index == 1) {
|
||||
pageData.query.isPauseSale = 1
|
||||
pageData.query.isGrounding = ''
|
||||
pageData.query.isSoldStock = 1
|
||||
pageData.query.isSale = ''
|
||||
return
|
||||
}
|
||||
if (index == 2) {
|
||||
pageData.query.isPauseSale = ''
|
||||
pageData.query.isGrounding = 1
|
||||
pageData.query.isSoldStock = ''
|
||||
pageData.query.isSale = 1
|
||||
return
|
||||
}
|
||||
if (index == 3) {
|
||||
pageData.query.isPauseSale = ''
|
||||
pageData.query.isGrounding = 0
|
||||
pageData.query.isSoldStock = ''
|
||||
pageData.query.isSale = 0
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -638,7 +658,7 @@
|
||||
// 页数改变事件
|
||||
function pageChange(page) {
|
||||
console.log(page);
|
||||
pageData.query.page = page - 1
|
||||
pageData.query.page = page
|
||||
getGoodsList()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user