This commit is contained in:
唐明明
2021-10-26 17:26:01 +08:00
parent 422427f549
commit 89cb4bea28
17 changed files with 1540 additions and 16452 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,105 +1,105 @@
<template>
<view class="content-flex" v-if="!loding">
<scroll-view class="stair" scroll-y>
<view class="stair-item" :class="{'show': stairIndex == index}" v-for="(item, index) in category" :key="index" @click="stairIndex = index">{{item.name}}</view>
<view class="ios-bottom"></view>
</scroll-view>
<scroll-view class="second" scroll-y>
<view class="second-item" v-for="(item, index) in category[stairIndex].children" :key="index" @click="onCategory(item.category_id)">
{{item.name}}<uni-icons class="arrow-icon" type="arrowright" color="#999" size="14"></uni-icons>
</view>
<view class="ios-bottom"></view>
</scroll-view>
</view>
</template>
<script>
import { managesCategory } from '@/apis/interfaces/goods'
export default {
data() {
return {
loding : true,
category : [],
stairIndex : 0,
secondIndex : 0
};
},
created() {
managesCategory().then(res => {
this.loding = false
this.category = res
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
})
},
methods:{
// 选择分类
onCategory(cid){
this.$Router.push({name: 'goodsAdd', params: {cid, id: this.category[this.stairIndex].category_id}})
}
}
}
</script>
<style lang="scss" scoped>
.content-flex{
background-color: white;
height: 100vh;
display: flex;
font-size: $title-size-m;
.stair{
background: #F5F5F5;
width: 240rpx;
.stair-item{
text-align: center;
padding: 0 $padding;
line-height: 90rpx;
color: $text-gray;
@extend .nowrap;
&.show{
position: relative;
background: white;
color: $text-price;
font-weight: bold;
&::before{
position: absolute;
height: 40rpx;
width: 5rpx;
background: $text-price;
content: " ";
left: 0;
top: 20rpx;
}
}
}
}
.second{
width: calc(100% - 240rpx);
.second-item{
position: relative;
padding: 0 ($padding + 80) 0 $padding;
line-height: 90rpx;
color: $text-gray;
.arrow-icon{
position: absolute;
right: $padding;
}
&::after{
position: absolute;
height: 1rpx;
content: ' ';
background: $border-color;
left: $padding;
right: 0;
top: 0;
}
&:first-child::after{
display: none;
}
}
}
}
</style>
<template>
<view class="content-flex" v-if="!loding">
<scroll-view class="stair" scroll-y>
<view class="stair-item" :class="{'show': stairIndex == index}" v-for="(item, index) in category" :key="index" @click="stairIndex = index">{{item.name}}</view>
<view class="ios-bottom"></view>
</scroll-view>
<scroll-view class="second" scroll-y>
<view class="second-item" v-for="(item, index) in category[stairIndex].children" :key="index" @click="onCategory(item.category_id)">
{{item.name}}<uni-icons class="arrow-icon" type="arrowright" color="#999" size="14"></uni-icons>
</view>
<view class="ios-bottom"></view>
</scroll-view>
</view>
</template>
<script>
import { managesCategory } from '@/apis/interfaces/goods'
export default {
data() {
return {
loding : true,
category : [],
stairIndex : 0,
secondIndex : 0
};
},
created() {
managesCategory().then(res => {
this.loding = false
this.category = res
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
})
},
methods:{
// 选择分类
onCategory(cid){
this.$Router.push({name: 'goodsAdd', params: {cid, id: this.category[this.stairIndex].category_id}})
}
}
}
</script>
<style lang="scss" scoped>
.content-flex{
background-color: white;
height: 100vh;
display: flex;
font-size: $title-size-m;
.stair{
background: #F5F5F5;
width: 240rpx;
.stair-item{
text-align: center;
padding: 0 $padding;
line-height: 90rpx;
color: $text-gray;
@extend .nowrap;
&.show{
position: relative;
background: white;
color: $text-price;
font-weight: bold;
&::before{
position: absolute;
height: 40rpx;
width: 5rpx;
background: $text-price;
content: " ";
left: 0;
top: 20rpx;
}
}
}
}
.second{
width: calc(100% - 240rpx);
.second-item{
position: relative;
padding: 0 ($padding + 80) 0 $padding;
line-height: 90rpx;
color: $text-gray;
.arrow-icon{
position: absolute;
right: $padding;
}
&::after{
position: absolute;
height: 1rpx;
content: ' ';
background: $border-color;
left: $padding;
right: 0;
top: 0;
}
&:first-child::after{
display: none;
}
}
}
}
</style>

View File

@@ -77,7 +77,6 @@
};
},
created() {
console.log(typeof this.$Route.query.edit)
if(this.$Route.query.edit === 'true' || this.$Route.query.edit ){
managesGoodsExtends(this.$Route.query.id).then(res => {
this.productedAt = res.producted_at

View File

@@ -1,297 +1,323 @@
<template>
<view class="content">
<!-- 分类 -->
<view class="tabs">
<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="暂无产品权证">
<template v-slot:statistics="goods">
<view>库存{{goods.value.stock}}</view>
</template>
<template v-slot:footer="goods">
<view class="footer-btns">
<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>
</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="goodsPut(goods.value.goods_id, goods.value.reason)">驳回原因</button>
<button class="button-item" size="mini" @click="goodsRemove(goods.value.goods_id)">删除</button>
</block>
</view>
</template>
</goodsList>
<!-- 燃烧 增发 弹窗 -->
<uni-popup ref="popupLay" :safe-area="true" background-color="#ffffff">
<view class="popup">
<view class="title">库存{{stockType == 'goodsMint' ? '增发': '燃烧'}}</view>
<view class="des">
剩余库存
<text>{{itemGoods.stock}}</text>
</view>
<view class="des">
数量
<uni-number-box v-model='stock' :min="1" :max="stockType == 'goodsBurn' ? itemGoods.stock : 9999"></uni-number-box>
</view>
<view class="btn" @click="additionalOrBurning">确认</view>
</view>
</uni-popup>
</view>
</template>
<script>
import { managesGoodsIndex, managesGoodsDelete, managesGoodsBurn, managesGoodsMint, managesGoodsCreateBefore } from '@/apis/interfaces/goods'
import goodsList from '@/components/goods-list/goods-list'
export default {
components: {
goodsList
},
data() {
return {
status : 0,
goods : [],
pages : {},
itemGoods : {},
stock : 1,
stockType : ''
};
},
onShow() {
this.getList()
},
methods: {
// tabs
onTabs(value){
if(value == this.status) return
this.goods = []
this.status = value
this.getList()
},
// 权证列表
getList(){
managesGoodsIndex({
status: this.status
}).then(res => {
this.goods = res.data
this.pages = res.page
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
})
},
// 修改产品
goodsPut(id, text){
uni.showModal({
title : '驳回原因',
content : text,
confirmText : '编辑',
cancelText : '确定',
success : res => {
if(res.confirm){
console.log(res.confirm)
this.$Router.push({name: 'goodsAdd', params: {type: 'edit', id}})
}
}
})
},
// 商品认证
goodsAuth(id){
this.$Router.push({name: 'goodsAddAuth', params: {id, type: 'magList'}})
},
// 燃烧,增发
openLay(item, type){
this.itemGoods = item
this.stockType = type
this.stock = 1
this.$refs.popupLay.open('bottom')
},
// 提交燃烧,增发
additionalOrBurning(){
let data = {
id : this.itemGoods.goods_id,
stock: this.stock
}
switch (this.stockType){
case 'goodsBurn':
managesGoodsBurn({...data}).then(res => {
let goodsIndex = this.goods.findIndex(val => val.goods_id === this.itemGoods.goods_id)
this.itemGoods.stock -= data.stock
this.$refs.popupLay.close()
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
})
break;
case 'goodsMint':
managesGoodsMint({...data}).then(res => {
let goodsIndex = this.goods.findIndex(val => val.goods_id === this.itemGoods.goods_id)
this.itemGoods.stock += data.stock
this.$refs.popupLay.close()
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
})
break;
default:
uni.showToast({
title: '类型错误',
icon : 'none'
})
break;
}
},
// 移出删除商品
goodsRemove(id){
let index = this.goods.findIndex(val => val.goods_id == id)
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,
icon: 'none'
})
})
}
},
onNavigationBarButtonTap() {
this.$Router.push({name: 'goodsaddClassify'})
}
}
</script>
<style lang="scss" scoped>
.basics-content{
padding-bottom: ($padding*3) + 90;
}
// 按钮组
.basisc-btn{
position: fixed;
bottom: 0;
left: 0;
right: 0;
padding: $padding;
background: white;
box-shadow: 0 0 4rpx 4rpx rgba($color: #000000, $alpha: .02);
.btn {
background: $mian-color;
color: white;
border-radius: 0;
font-size: $title-size-lg;
line-height: 88rpx;
height: 88rpx;
&::after {
border: none;
}
&[disabled] {
background: rgba($color: $mian-color, $alpha: .6);
}
}
}
.content{
padding-top: 90rpx;
}
// tabs
.tabs{
position: fixed;
top: 0;
//#ifdef H5
top: 90rpx;
// #endif
left: 0;
right: 0;
z-index: 99;
display: flex;
justify-content: space-around;
background: white;
padding: 15rpx 0;
font-size: $title-size-lg;
color: $text-gray;
.item{
height: 60rpx;
line-height: 60rpx;
&.show{
color: $text-price;
border-bottom: solid 4rpx $text-price;
}
}
}
// 按钮组
.footer-btns{
display: flex;
justify-content: space-between;
padding-top: $padding/2;
margin-left: -10rpx;
margin-right: -10rpx;
.button-item[size='mini']{
padding: 0;
margin: 0 10rpx;
height: 60rpx;
line-height: 60rpx;
border-radius: 0;
flex: 1;
background: $border-color-lg;
color: $text-gray;
&::after{
border: none;
}
}
}
// 增发燃烧弹窗
.popup {
width: 100%;
background-color: #fff;
padding-bottom: $padding;
.title {
font-size: 36rpx;
text-align: center;
padding: 50rpx 30rpx 30rpx 30rpx;
font-weight: bold;
}
.btn {
background-color: $text-price;
height: 90rpx;
line-height: 90rpx;
text-align: center;
color: #fff;
font-weight: bold;
font-size: $title-size;
margin: $padding * 2;
}
.des {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: $padding $padding * 2;
color: $text-gray;
text{
color: $text-color;
}
}
}
</style>
<template>
<view class="content">
<!-- 分类 -->
<view class="tabs">
<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="暂无产品权证">
<template v-slot:statistics="goods">
<view>库存{{goods.value.stock}}</view>
</template>
<template v-slot:footer="goods">
<view class="footer-btns">
<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>
</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="goodsPut(goods.value.goods_id, goods.value.reason)">驳回原因</button>
<button class="button-item" size="mini" @click="goodsRemove(goods.value.goods_id)">删除</button>
</block>
</view>
</template>
</goodsList>
<!-- 燃烧 增发 弹窗 -->
<uni-popup ref="popupLay" :safe-area="true" background-color="#ffffff">
<view class="popup">
<view class="title">库存{{stockType == 'goodsMint' ? '增发': '燃烧'}}</view>
<view class="des">
剩余库存
<text>{{itemGoods.stock}}</text>
</view>
<view class="des">
数量
<uni-number-box v-model='stock' :min="1" :max="stockType == 'goodsBurn' ? itemGoods.stock : 9999"></uni-number-box>
</view>
<view class="btn" @click="additionalOrBurning">确认</view>
</view>
</uni-popup>
</view>
</template>
<script>
import { managesGoodsIndex, managesGoodsDelete, managesGoodsBurn, managesGoodsMint, managesGoodsCreateBefore } from '@/apis/interfaces/goods'
import goodsList from '@/components/goods-list/goods-list'
export default {
components: {
goodsList
},
data() {
return {
status : 0,
goods : [],
pages : {},
itemGoods : {},
stock : 1,
stockType : '',
page:1,
has_more :true,
};
},
onLoad() {
this.getList()
},
onShow() {
if(uni.getStorageSync('refresh')){
this.goods = []
this.page = 1
this.has_more = true
this.getList()
}
},
onReachBottom() {
if(this.has_more){
this.page = this.page + 1
this.getList()
}else{
uni.showToast({
title:'我是有底线的~',
icon:'none'
})
}
},
methods: {
// tabs
onTabs(value){
if(value == this.status) return
this.goods = []
this.page =1,
this.has_more = true
this.status = value
this.getList()
},
// 权证列表
getList(){
managesGoodsIndex({
status: this.status,
page:this.page
}).then(res => {
this.goods = this.goods.concat(res.data)
this.pages = res.page
this.has_more = res.page.has_more
uni.setStorageSync('refresh',false)
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
})
},
// 修改产品
goodsPut(id, text){
uni.showModal({
title : '驳回原因',
content : text,
confirmText : '编辑',
cancelText : '确定',
success : res => {
if(res.confirm){
console.log(res.confirm)
this.$Router.push({name: 'goodsAdd', params: {type: 'edit', id}})
}
}
})
},
// 商品认证
goodsAuth(id){
this.$Router.push({name: 'goodsAddAuth', params: {id, type: 'magList'}})
},
// 燃烧,增发
openLay(item, type){
this.itemGoods = item
this.stockType = type
this.stock = 1
this.$refs.popupLay.open('bottom')
},
// 提交燃烧,增发
additionalOrBurning(){
let data = {
id : this.itemGoods.goods_id,
stock: this.stock
}
switch (this.stockType){
case 'goodsBurn':
managesGoodsBurn({...data}).then(res => {
let goodsIndex = this.goods.findIndex(val => val.goods_id === this.itemGoods.goods_id)
this.itemGoods.stock -= data.stock
this.$refs.popupLay.close()
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
})
break;
case 'goodsMint':
managesGoodsMint({...data}).then(res => {
let goodsIndex = this.goods.findIndex(val => val.goods_id === this.itemGoods.goods_id)
this.itemGoods.stock += data.stock
this.$refs.popupLay.close()
}).catch(err => {
uni.showToast({
title: err.message,
icon : 'none'
})
})
break;
default:
uni.showToast({
title: '类型错误',
icon : 'none'
})
break;
}
},
// 移出删除商品
goodsRemove(id){
let index = this.goods.findIndex(val => val.goods_id == id)
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,
icon: 'none'
})
})
}
},
onNavigationBarButtonTap() {
this.$Router.push({name: 'goodsaddClassify'})
}
}
</script>
<style lang="scss" scoped>
.basics-content{
padding-bottom: ($padding*3) + 90;
}
// 按钮组
.basisc-btn{
position: fixed;
bottom: 0;
left: 0;
right: 0;
padding: $padding;
background: white;
box-shadow: 0 0 4rpx 4rpx rgba($color: #000000, $alpha: .02);
.btn {
background: $mian-color;
color: white;
border-radius: 0;
font-size: $title-size-lg;
line-height: 88rpx;
height: 88rpx;
&::after {
border: none;
}
&[disabled] {
background: rgba($color: $mian-color, $alpha: .6);
}
}
}
.content{
padding-top: 90rpx;
}
// tabs
.tabs{
position: fixed;
top: 0;
//#ifdef H5
top: 90rpx;
// #endif
left: 0;
right: 0;
z-index: 99;
display: flex;
justify-content: space-around;
background: white;
padding: 15rpx 0;
font-size: $title-size-lg;
color: $text-gray;
.item{
height: 60rpx;
line-height: 60rpx;
&.show{
color: $text-price;
border-bottom: solid 4rpx $text-price;
}
}
}
// 按钮组
.footer-btns{
display: flex;
justify-content: space-between;
padding-top: $padding/2;
margin-left: -10rpx;
margin-right: -10rpx;
.button-item[size='mini']{
padding: 0;
margin: 0 10rpx;
height: 60rpx;
line-height: 60rpx;
border-radius: 0;
flex: 1;
background: $border-color-lg;
color: $text-gray;
&::after{
border: none;
}
}
}
// 增发燃烧弹窗
.popup {
width: 100%;
background-color: #fff;
padding-bottom: $padding;
.title {
font-size: 36rpx;
text-align: center;
padding: 50rpx 30rpx 30rpx 30rpx;
font-weight: bold;
}
.btn {
background-color: $text-price;
height: 90rpx;
line-height: 90rpx;
text-align: center;
color: #fff;
font-weight: bold;
font-size: $title-size;
margin: $padding * 2;
}
.des {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: $padding $padding * 2;
color: $text-gray;
text{
color: $text-color;
}
}
}
</style>