|
@@ -26,7 +26,7 @@
|
|
|
<tui-swipe-actions :actions="item.actions" @click="handlerButton($event,item)" :params="item">
|
|
|
<template v-slot:content>
|
|
|
<view class="tui-goods-item">
|
|
|
- <view class="tui-goods-checkBox" v-if="isSuperv" @click="">
|
|
|
+ <view class="tui-goods-checkBox" v-if="isSuperv">
|
|
|
<view class="checkbox iconfont" :class="[item.isChecked ?'icon-yixuanze':'icon-weixuanze']" @click="checkedSoperv(item)"></view>
|
|
|
</view>
|
|
|
<view class="tui-goods-image">
|
|
@@ -108,11 +108,11 @@
|
|
|
</view>
|
|
|
</tui-drawer>
|
|
|
<!-- 批量操作 -->
|
|
|
- <tui-bottom-popup :radius="false" :mask="false" :show="isSuperv" @close="closeSupervFn()">
|
|
|
+ <tui-bottom-popup :radius="false" :mask="false" :show="isSuperv">
|
|
|
<view class="tui-popup-box clearfix">
|
|
|
<view class="tui-right-flex tui-popup-btn" :style="{ paddingBottom :isIphoneX ? '68rpx' : '0rpx' }">
|
|
|
<view class="tui-flex-1">
|
|
|
- <view class="tui-button" :class="isProductChecked ? 'active' : ''" @click="closeSupervFn()">批量下架</view>
|
|
|
+ <view class="tui-button" :class="isProductChecked ? 'active' : ''" @click="handleAllUnder()">批量下架</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -189,6 +189,7 @@
|
|
|
OperationType:'',//操作类型
|
|
|
isCmcustomClass : 'left',
|
|
|
featuredNum:0,
|
|
|
+ productIds:'',//批量下架操作商品ID
|
|
|
|
|
|
}
|
|
|
},
|
|
@@ -227,8 +228,8 @@
|
|
|
this.listQuery.pageNum = 1
|
|
|
this.ShopService.GetSupplierPyProduct(this.listQuery).then(response =>{
|
|
|
let data = response.data.productPage
|
|
|
- this.hasNextPage = data.hasNextPage;
|
|
|
- console.log(data.results)
|
|
|
+ this.featuredNum = response.data.featuredNum
|
|
|
+ this.hasNextPage = data.hasNextPage
|
|
|
if(data.results && data.results.length > 0){
|
|
|
this.isEmpty = false;
|
|
|
this.dataList = data.results;
|
|
@@ -255,6 +256,7 @@
|
|
|
this.listQuery.pageNum += 1
|
|
|
this.ShopService.GetSupplierPyProduct(this.listQuery).then(response =>{
|
|
|
let data = response.data.productPage
|
|
|
+ this.featuredNum = response.data.featuredNum
|
|
|
this.hasNextPage = data.hasNextPage;
|
|
|
this.dataList = this.dataList.concat(data.results)
|
|
|
this.handleDataList()
|
|
@@ -271,78 +273,31 @@
|
|
|
})
|
|
|
},
|
|
|
handleDataList(){//根据商品状态set不同的tabAction返回新的数据
|
|
|
- const mapStateArr = [
|
|
|
- {
|
|
|
- val:['0','3','8','10'],
|
|
|
- actions:[
|
|
|
- {name: '无操作',color: '#fff',fontsize: 26,width: 50,background: '#e1e1e1'}
|
|
|
- ]
|
|
|
- },
|
|
|
- {
|
|
|
- val:['1','9'],
|
|
|
- actions:[
|
|
|
- {name: '查看详情',color: '#fff',fontsize: 26,width: 50,background: '#f9a94b'}
|
|
|
- ]
|
|
|
- },
|
|
|
- {
|
|
|
- val:['2'],
|
|
|
- actions:[
|
|
|
- {name: '查看详情',color: '#fff',fontsize: 26,width: 50,background: '#f9a94b'},
|
|
|
- {name: '删除主页推荐',color: '#fff',fontsize: 26,width: 50,background: '#ff7a51'},
|
|
|
- {name: '下架',color: '#fff',fontsize: 26,width: 50,background: '#fea785'}
|
|
|
- ]
|
|
|
- }
|
|
|
- ]
|
|
|
this.dataList.forEach(item =>{
|
|
|
- switch(item.validFlag){
|
|
|
- case '0':
|
|
|
- item.actions = [
|
|
|
- {name: '无操作',color: '#fff',fontsize: 26,width: 50,background: '#e1e1e1'},
|
|
|
- ]
|
|
|
- break;
|
|
|
- case '1':
|
|
|
+ if(item.validFlag === '0' || item.validFlag === '3' || item.validFlag === '8' || item.validFlag === '10'){
|
|
|
+ item.actions = [
|
|
|
+ {name: '无操作',color: '#fff',fontsize: 26,width: 50,background: '#e1e1e1'},
|
|
|
+ ]
|
|
|
+ }else if(item.validFlag === '1' || item.validFlag === '9'){
|
|
|
+ item.actions = [
|
|
|
+ {name: '查看详情',color: '#fff',fontsize: 26,width: 50,background: '#f9a94b'},
|
|
|
+ ]
|
|
|
+ }else if(item.validFlag === '2'){
|
|
|
+ if(item.featuredFlag ==='1'){
|
|
|
item.actions = [
|
|
|
{name: '查看详情',color: '#fff',fontsize: 26,width: 50,background: '#f9a94b'},
|
|
|
+ {name: '删除主页推荐',color: '#fff',fontsize: 26,width: 50,background: '#ff7a51'},
|
|
|
+ {name: '下架',color: '#fff',fontsize: 26,width: 50,background: '#fea785'},
|
|
|
]
|
|
|
- break;
|
|
|
- case '2':
|
|
|
- if(item.featuredFlag == 1){
|
|
|
- item.actions = [
|
|
|
- {name: '查看详情',color: '#fff',fontsize: 26,width: 50,background: '#f9a94b'},
|
|
|
- {name: '删除主页推荐',color: '#fff',fontsize: 26,width: 50,background: '#ff7a51'},
|
|
|
- {name: '下架',color: '#fff',fontsize: 26,width: 50,background: '#fea785'},
|
|
|
- ]
|
|
|
- }else{
|
|
|
- item.actions = [
|
|
|
- {name: '查看详情',color: '#fff',fontsize: 26,width: 50,background: '#f9a94b'},
|
|
|
- {name: '添加主页推荐',color: '#fff',fontsize: 26,width: 50,background: '#ff7a51'},
|
|
|
- {name: '下架',color: '#fff',fontsize: 26,width: 50,background: '#fea785'},
|
|
|
- ]
|
|
|
- }
|
|
|
- break;
|
|
|
- case '3':
|
|
|
- item.actions = [
|
|
|
- {name: '无操作',color: '#fff',fontsize: 26,width: 50,background: '#e1e1e1'},
|
|
|
- ]
|
|
|
- break;
|
|
|
- case '8':
|
|
|
- item.actions = [
|
|
|
- {name: '无操作',color: '#fff',fontsize: 26,width: 50,background: '#e1e1e1'},
|
|
|
- ]
|
|
|
- break;
|
|
|
- case '9':
|
|
|
+ }else{
|
|
|
item.actions = [
|
|
|
{name: '查看详情',color: '#fff',fontsize: 26,width: 50,background: '#f9a94b'},
|
|
|
+ {name: '添加主页推荐',color: '#fff',fontsize: 26,width: 50,background: '#ff7a51'},
|
|
|
+ {name: '下架',color: '#fff',fontsize: 26,width: 50,background: '#fea785'},
|
|
|
]
|
|
|
- break;
|
|
|
- case '10':
|
|
|
- item.actions = [
|
|
|
- {name: '无操作',color: '#fff',fontsize: 26,width: 50,background: '#e1e1e1'},
|
|
|
- ]
|
|
|
- break;
|
|
|
+ }
|
|
|
}
|
|
|
})
|
|
|
- console.log(this.dataList)
|
|
|
},
|
|
|
handSearchList(){//搜索
|
|
|
this.GetProductListInfo()
|
|
@@ -358,138 +313,137 @@
|
|
|
this.threeClassificationText='';
|
|
|
this.classificationTwoList = [];
|
|
|
this.classificationThreeList = [];
|
|
|
- console.log(this.listQuery)
|
|
|
},
|
|
|
handlerButton(e,item){//监听侧滑按钮点击事件
|
|
|
- switch(this.currents){
|
|
|
- case 0://全部商品列表
|
|
|
- this.handleCurrentsAll(e,item)
|
|
|
- break;
|
|
|
- case 1://上架商品列表
|
|
|
- this.handleCurrentsUpdate(e,item)
|
|
|
- break;
|
|
|
- case 2://下架商品列表
|
|
|
- this.handleCurrentsDown(e,item)
|
|
|
- break;
|
|
|
- }
|
|
|
- },
|
|
|
- handleCurrentsAll(e,item){//处理全部商品列表只做删除操作
|
|
|
- switch(e.index){
|
|
|
- case 0://删除
|
|
|
- this.handleDeleter(item)
|
|
|
- break;
|
|
|
- }
|
|
|
- },
|
|
|
- handleCurrentsUpdate(e,item){//处理上架商品列表只做下架&&删除操作
|
|
|
- switch(e.index){
|
|
|
- case 0://下架
|
|
|
- this.handleUnder(item)
|
|
|
- break;
|
|
|
- case 1://删除
|
|
|
- this.handleDeleter(item)
|
|
|
- break;
|
|
|
- }
|
|
|
- },
|
|
|
- handleCurrentsDown(e,item){//处理下架商品列表只做下架&&删除操作
|
|
|
- switch(e.index){
|
|
|
- case 0://上架
|
|
|
- this.handleGround(item)
|
|
|
- break;
|
|
|
- case 1://删除
|
|
|
- this.handleDeleter(item)
|
|
|
- break;
|
|
|
+ if(item.validFlag === '0' || item.validFlag === '3' || item.validFlag === '8' || item.validFlag === '10'){
|
|
|
+ if(e.index == 0){
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }else if(item.validFlag === '1' || item.validFlag === '9'){
|
|
|
+ if(e.index == 0){
|
|
|
+ this.$api.navigateTo(`/pages/goods/product?id=${item.productID}`)
|
|
|
+ }
|
|
|
+ }else if(item.validFlag === '2'){
|
|
|
+ switch(e.index){
|
|
|
+ case 0:
|
|
|
+ this.$api.navigateTo(`/pages/goods/product?id=${item.productID}`)
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ if(item.featuredFlag ==='1'){
|
|
|
+ this.handleDeleteShopRemb(item)
|
|
|
+ }else{
|
|
|
+ this.handleAddShopRemb(item)
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ this.handleUnder(item)
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
- handleDeleter(item){//删除操作
|
|
|
- this.OperationType = 'delete'
|
|
|
+ handleAddShopRemb(item){//添加主页推荐
|
|
|
+ console.log(this.featuredNum);
|
|
|
+ let num = 4- this.featuredNum;
|
|
|
+ console.log(num);
|
|
|
+ this.OperationType = 'add'
|
|
|
this.handlerProduct = item
|
|
|
this.modal = true;
|
|
|
- this.contentModalText = '是否删除该商品?';
|
|
|
+ this.contentModalText = `总共能添加4个主推商品,您还能添加${num}个确定将该商品添加为主推商品吗?`;
|
|
|
},
|
|
|
- handleGround(item){//上架操作
|
|
|
- this.OperationType = 'ground'
|
|
|
+
|
|
|
+ handleDeleteShopRemb(item){//删除主页推荐
|
|
|
+ this.OperationType = 'delete'
|
|
|
this.handlerProduct = item
|
|
|
this.modal = true;
|
|
|
- this.contentModalText = '是否上架该商品?';
|
|
|
+ this.contentModalText = '是否把该商品从主推商品中删除?';
|
|
|
},
|
|
|
handleUnder(item){//下架操作
|
|
|
this.OperationType = 'under'
|
|
|
this.handlerProduct = item
|
|
|
this.modal = true;
|
|
|
- this.contentModalText = '是否下架该商品?';
|
|
|
+ this.contentModalText = '确定下架该商品吗?';
|
|
|
+ },
|
|
|
+ handleAllUnder(){//批量下架操作
|
|
|
+ let isValidFlag = false
|
|
|
+ if(this.isProductChecked){
|
|
|
+ this.dataList.forEach(el => {
|
|
|
+ if(el.isChecked) {
|
|
|
+ if(el.validFlag != 2){
|
|
|
+ isValidFlag = true;
|
|
|
+ }else{
|
|
|
+ isValidFlag = false
|
|
|
+ this.productIds += el.productID+','
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if(isValidFlag){
|
|
|
+ this.$util.modal('','部分选中的商品暂未上架,不能进行下架操作','确定','',false,() =>{})
|
|
|
+ }else{
|
|
|
+ this.OperationType = 'allunder'
|
|
|
+ this.modal = true;
|
|
|
+ this.contentModalText = '确定下架选中的商品吗?';
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ return;
|
|
|
+ }
|
|
|
},
|
|
|
handleClick(e) {//弹窗提示用户操作
|
|
|
if(e.index == 1){
|
|
|
switch(this.OperationType){
|
|
|
- case 'delete'://删除商品
|
|
|
- this.UpdateDeleteStatus()
|
|
|
+ case 'delete'://删除主页推荐
|
|
|
+ this.SupplierDeleteSwitchFeatured(this.handlerProduct)
|
|
|
break;
|
|
|
- case 'ground'://上架商品
|
|
|
- this.UpdatePublishStatus(this.handlerProduct,1)
|
|
|
+ case 'add'://添加主页推荐
|
|
|
+ this.SupplierAddSwitchFeatured(this.handlerProduct)
|
|
|
break;
|
|
|
case 'under'://下架商品
|
|
|
- this.UpdatePublishStatus(this.handlerProduct,0)
|
|
|
+ this.SupplierSoldOutProduct(this.handlerProduct)
|
|
|
+ break;
|
|
|
+ case 'allunder'://批量下架
|
|
|
+ this.SupplierAllSoldOutProduct(this.productIds)
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
this.modal = false;
|
|
|
},
|
|
|
- UpdatePublishStatus(item,publishStatus){//上下架商品操作处理接口
|
|
|
- this.ProductService.ProductUpdatePublishStatus({publishStatus:publishStatus,ids:item.id}).then(response =>{
|
|
|
- this.$util.msg('操作成功',2000,true,'success');
|
|
|
+ SupplierDeleteSwitchFeatured(item){//操作删除主页推荐
|
|
|
+ this.ShopService.SupplierSwitchFeaturedyProduct({productId:item.productID,featuredFlag:0}).then(response =>{
|
|
|
+ this.$util.msg('删除成功',2000,true,'success');
|
|
|
setTimeout(() => {
|
|
|
this.GetProductListInfo()
|
|
|
- this.getOrderListCount()
|
|
|
},2000)
|
|
|
}).catch(error =>{
|
|
|
this.$util.msg(error.msg,2000)
|
|
|
})
|
|
|
},
|
|
|
- UpdateDeleteStatus(){//商品删除处理接口
|
|
|
- this.ProductService.ProductUpdateDeleteStatus({deleteStatus:1,ids:this.handlerProduct.id}).then(response =>{
|
|
|
- this.$util.msg('删除商品成功',2000,true,'success');
|
|
|
+ SupplierAddSwitchFeatured(item){//操作添加主页推荐
|
|
|
+ this.ShopService.SupplierSwitchFeaturedyProduct({productId:item.productID,featuredFlag:1}).then(response =>{
|
|
|
+ this.$util.msg('添加成功',2000,true,'success');
|
|
|
setTimeout(() => {
|
|
|
this.GetProductListInfo()
|
|
|
- this.getOrderListCount()
|
|
|
},2000)
|
|
|
}).catch(error =>{
|
|
|
this.$util.msg(error.msg,2000)
|
|
|
})
|
|
|
},
|
|
|
- tabClick(index){
|
|
|
- this.currents = index
|
|
|
- switch(index){
|
|
|
- case 0:
|
|
|
- this.listQuery.publishStatus = ''
|
|
|
- this.dataList = []
|
|
|
- this.GetProductListInfo()
|
|
|
- this.actions =[
|
|
|
- {name: '删除',color: '#fff',fontsize: 28,width: 80,background: '#ff4759'},
|
|
|
- ]
|
|
|
- break;
|
|
|
- case 1:
|
|
|
- this.listQuery.publishStatus = 1
|
|
|
- this.dataList = []
|
|
|
- this.GetProductListInfo()
|
|
|
- this.actions =[
|
|
|
- {name: '下架',color: '#fff',fontsize: 28,width: 80,background: '#ffaa33'},
|
|
|
- {name: '删除',color: '#fff',fontsize: 28,width: 80,background: '#ff4759'},
|
|
|
- ]
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- this.listQuery.publishStatus = 0
|
|
|
- this.dataList = []
|
|
|
+ SupplierSoldOutProduct(item){//操作下架商品
|
|
|
+ this.ShopService.SupplierSoldOutProduct({productIds:item.productID}).then(response =>{
|
|
|
+ this.$util.msg('下架成功',2000,true,'success');
|
|
|
+ setTimeout(() => {
|
|
|
this.GetProductListInfo()
|
|
|
- this.actions =[
|
|
|
- {name: '上架',color: '#fff',fontsize: 28,width: 80,background: '#4688fa'},
|
|
|
- {name: '删除',color: '#fff',fontsize: 28,width: 80,background: '#ff4759'},
|
|
|
- ]
|
|
|
- break;
|
|
|
-
|
|
|
- }
|
|
|
+ },2000)
|
|
|
+ }).catch(error =>{
|
|
|
+ this.$util.msg(error.msg,2000)
|
|
|
+ })
|
|
|
},
|
|
|
- bindDateChange: function(e) {//选择筛选时间
|
|
|
- this.listQuery.date = e.detail.value
|
|
|
+ SupplierAllSoldOutProduct(ids){//操作批量下架商品
|
|
|
+ this.ShopService.SupplierSoldOutProduct({productIds:ids}).then(response =>{
|
|
|
+ this.$util.msg('下架成功',2000,true,'success');
|
|
|
+ setTimeout(() => {
|
|
|
+ this.GetProductListInfo()
|
|
|
+ },2000)
|
|
|
+ }).catch(error =>{
|
|
|
+ this.$util.msg(error.msg,2000)
|
|
|
+ })
|
|
|
},
|
|
|
bindPickerChange: function(type,e) {//选择筛选条件
|
|
|
switch(type){
|