商品管理模块
This commit is contained in:
@@ -2,10 +2,10 @@
|
||||
<view class="content">
|
||||
<!-- 分类 -->
|
||||
<view class="tabs">
|
||||
<view class="item" :class="{'show': status == '1'}" @click="onTabs('1')">已上架</view>
|
||||
<view class="item" :class="{'show': status == '3'}" @click="onTabs('3')">已下架</view>
|
||||
<view class="item" :class="{'show': status == '0'}" @click="onTabs('0')">审核中</view>
|
||||
<view class="item" :class="{'show': status == '2'}" @click="onTabs('2')">已驳回</view>
|
||||
<view class="item" :class="{'show': status == '0'}" @click="onTabs('0')">已发布</view>
|
||||
<view class="item" :class="{'show': status == '1'}" @click="onTabs('1')">待认证</view>
|
||||
<view class="item" :class="{'show': status == '2'}" @click="onTabs('2')">审核中</view>
|
||||
<view class="item" :class="{'show': status == '3'}" @click="onTabs('3')">已驳回</view>
|
||||
</view>
|
||||
<!-- 优选商品 -->
|
||||
<goodsList :list="goods" priceType="CNY" :status='status' toast="暂无产品权证">
|
||||
@@ -14,16 +14,19 @@
|
||||
</template>
|
||||
<template v-slot:footer="goods">
|
||||
<view class="footer-btns">
|
||||
<block v-if="status == '1'">
|
||||
<block v-if="status == '0'">
|
||||
<button class="button-item" size="mini" @click="openLay(goods.value, 'goodsBurn')">燃烧</button>
|
||||
<button class="button-item" size="mini" @click="openLay(goods.value, 'goodsMint')">增发</button>
|
||||
<button class="button-item" size="mini" @click="goodsOffsale(goods.value.goods_id)">下架</button>
|
||||
</block>
|
||||
<block v-if="status == '1'">
|
||||
<button class="button-item" size="mini" @click="goodsAuth(goods.value.goods_id)">认证</button>
|
||||
<button class="button-item" size="mini" @click="goodsRemove(goods.value.goods_id)">删除</button>
|
||||
</block>
|
||||
<block v-if="status == '2'">
|
||||
<button class="button-item" size="mini" @click="goodsRemove(goods.value.goods_id)">删除</button>
|
||||
</block>
|
||||
<block v-if="status == '3'">
|
||||
<button class="button-item" size="mini" @click="goodsOnsale(goods.value.goods_id)">上架</button>
|
||||
</block>
|
||||
<block v-if="status == '0' || status == '2'">
|
||||
<button class="button-item" size="mini">修改</button>
|
||||
<button class="button-item" size="mini" @click="goodsPut(goods.value.goods_id, goods.value.reason)">驳回原因</button>
|
||||
<button class="button-item" size="mini" @click="goodsRemove(goods.value.goods_id)">删除</button>
|
||||
</block>
|
||||
</view>
|
||||
@@ -48,7 +51,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { managesGoodsIndex, managesGoodsOffsale, managesGoodsOnsale, managesGoodsBurn, managesGoodsMint, managesGoodsCreateBefore } from '@/apis/interfaces/goods'
|
||||
import { managesGoodsIndex, managesGoodsDelete, managesGoodsBurn, managesGoodsMint, managesGoodsCreateBefore } from '@/apis/interfaces/goods'
|
||||
import goodsList from '@/components/goods-list/goods-list'
|
||||
export default {
|
||||
components: {
|
||||
@@ -56,7 +59,7 @@
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
status : 1,
|
||||
status : 0,
|
||||
goods : [],
|
||||
pages : {},
|
||||
itemGoods : {},
|
||||
@@ -71,6 +74,7 @@
|
||||
// tabs
|
||||
onTabs(value){
|
||||
if(value == this.status) return
|
||||
this.goods = []
|
||||
this.status = value
|
||||
this.getList()
|
||||
},
|
||||
@@ -79,23 +83,29 @@
|
||||
managesGoodsIndex({
|
||||
status: this.status
|
||||
}).then(res => {
|
||||
console.log(res)
|
||||
this.goods = res.data
|
||||
this.pages = res.page
|
||||
})
|
||||
},
|
||||
// 下架
|
||||
goodsOffsale(id){
|
||||
let index = this.goods.findIndex(val => val.goods_id == id)
|
||||
managesGoodsOffsale(id).then(res => {
|
||||
this.goods.splice(index,1)
|
||||
if(this.goods.length === 0) this.getList()
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
icon: 'none'
|
||||
})
|
||||
// 修改产品
|
||||
goodsPut(id, text){
|
||||
uni.showModal({
|
||||
title : '驳回原因',
|
||||
content : text,
|
||||
confirmText : '编辑',
|
||||
cancelText : '确定',
|
||||
success : res => {
|
||||
if(res.confirm){
|
||||
this.$Router.push({name: 'GoodsMagAdd', params: {type: 'edit', id}})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
// 商品认证
|
||||
goodsAuth(id){
|
||||
this.$Router.push({name: 'goodsAuth', params: {id, type: 'magList'}})
|
||||
},
|
||||
// 燃烧,增发
|
||||
openLay(item, type){
|
||||
this.itemGoods = item
|
||||
@@ -142,12 +152,16 @@
|
||||
break;
|
||||
}
|
||||
},
|
||||
// 上架
|
||||
goodsOnsale(id){
|
||||
// 移出删除商品
|
||||
goodsRemove(id){
|
||||
let index = this.goods.findIndex(val => val.goods_id == id)
|
||||
managesGoodsOnsale(id).then(res => {
|
||||
this.goods.splice(index,1)
|
||||
if(this.goods.length === 0) this.getList()
|
||||
managesGoodsDelete(id).then(res => {
|
||||
this.goods.splice(index,1)
|
||||
if(this.goods.length === 0) this.getList()
|
||||
uni.showToast({
|
||||
title: '商品权证已删除',
|
||||
icon : 'none'
|
||||
})
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
title: err.message,
|
||||
@@ -157,7 +171,7 @@
|
||||
}
|
||||
},
|
||||
onNavigationBarButtonTap() {
|
||||
this.$Router.push({name: 'GoodsMagAdd'})
|
||||
this.$Router.push({name: 'addClassify'})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user