Files
LSM_OIL_SITE/packageIntegral/productList/index.vue

602 lines
12 KiB
Vue
Raw Normal View History

2024-01-26 09:28:51 +08:00
<template>
<view class="container">
<cu-custom class="main-totextbar bg-main-oil" :isBack="true" bgColor="bg-main-oil">
<block slot="backText">返回</block>
<block slot="content">商品列表</block>
</cu-custom>
<view class="options-frame">
<view v-for="item,index in optionsList" :key="index" :class="index == currentIndex ? 'active':''"
@click="selectOptions(index)">{{item.text}}<text>({{item.count}})</text></view>
</view>
<view class="search">
2024-04-12 17:09:32 +08:00
<uni-easyinput prefixIcon="search" borderColor="#DCDFE6" v-model="paramter.params.productName"
placeholder="请输入商品名称" @confirm="search" @clear="search" />
2024-01-26 09:28:51 +08:00
</view>
2024-03-28 09:43:43 +08:00
2024-01-26 09:28:51 +08:00
<scroll-view v-if="dataList.length" class="list" :scroll-y="true" @scrolltolower="lower">
2024-01-26 17:04:25 +08:00
<view class="item" v-for="item,index in dataList" :key="index">
2024-04-09 08:56:34 +08:00
<view class="header">
2024-04-12 17:09:32 +08:00
<view class="identifying" :style="{background:identifying[item.productStatus].background,
2024-03-28 09:43:43 +08:00
opacity:identifying[item.productStatus].opacity}">{{item.productStatus =='1'?'已上架':'未上架'}}</view>
2024-01-26 09:28:51 +08:00
</view>
2024-04-09 08:56:34 +08:00
<view class="introduce">
2024-03-28 09:43:43 +08:00
<image :src="item.url"></image>
2024-01-26 09:28:51 +08:00
<view>{{item.productName}}</view>
2024-04-19 13:11:55 +08:00
<view>规格{{ item.attributesTypeName }}</view>
2024-03-28 09:43:43 +08:00
<view>库存{{item.totalStock}}</view>
2024-01-26 17:04:25 +08:00
</view>
2024-03-28 09:43:43 +08:00
<view class="examine" @click="examineDetail(item)"
2024-04-12 17:09:32 +08:00
:style="{background:statusEnum[item.auditStatus].color}">{{statusEnum[item.auditStatus].value}}
</view>
2024-01-26 17:04:25 +08:00
<view class="footer">
2024-04-16 17:16:00 +08:00
<view class="button" @click="orderDelete(item)">删除</view>
2024-03-29 17:11:02 +08:00
<view class="button" @click="toEditOrder(item)">编辑</view>
2024-04-16 17:16:00 +08:00
<view class="button" @click="upDownFrame(item)">{{item.productStatus =='1'?'下架':'上架'}}</view>
2024-01-26 09:28:51 +08:00
</view>
</view>
<view style="height: 30rpx; background: #fff;"></view>
</scroll-view>
<view v-else class="empty">
<image src="https://publicxingyou.oss-cn-hangzhou.aliyuncs.com/mp-oil/yunsite-empty.png"></image>
<view>还没有订单哦~</view>
</view>
2024-02-02 13:44:55 +08:00
<uni-popup ref="detail">
<view class="determine-detail">
<view class="title">审核详情</view>
<uni-icons @click="$refs.detail.close()" color="#666666" type="closeempty" size="28"></uni-icons>
<view class="item" v-for="(item,index) in examineDetailList" :key="index">
<view>
<view class="header">审核时间</view>
<view>{{item.createTime}}</view>
</view>
2024-03-28 09:43:43 +08:00
<view class="status">
2024-02-02 13:44:55 +08:00
<view class="header">审核结果</view>
2024-03-28 09:43:43 +08:00
<view>{{statusEnum[item.auditStatus].value}}</view>
2024-02-02 13:44:55 +08:00
</view>
<view>
<view class="header">反馈详情</view>
2024-03-28 09:43:43 +08:00
<view>{{item.remark}}</view>
2024-02-02 13:44:55 +08:00
</view>
</view>
<view class="buttons">
<view @click="$refs.detail.close()">关闭</view>
</view>
</view>
</uni-popup>
2024-01-26 17:04:25 +08:00
<uni-popup ref="delete">
<view class="determine-frame">
<view class="title">是否删除该商品</view>
<view class="buttons">
<view @click="$refs.delete.close()">取消</view>
2024-04-16 17:16:00 +08:00
<view @click="deleteIntegral">确认</view>
2024-01-26 17:04:25 +08:00
</view>
</view>
</uni-popup>
2024-02-02 13:44:55 +08:00
2024-01-26 17:04:25 +08:00
<uni-popup ref="popup">
<view class="determine-frame">
2024-03-28 09:43:43 +08:00
<view class="title">是否{{productData.productStatus =='1'?'下架':'上架'}}该商品</view>
2024-01-26 17:04:25 +08:00
<view class="buttons">
<view @click="$refs.popup.close()">取消</view>
2024-03-28 09:43:43 +08:00
<view @click="submitProduct">确认</view>
2024-01-26 17:04:25 +08:00
</view>
</view>
</uni-popup>
2024-02-02 13:44:55 +08:00
2024-01-26 09:28:51 +08:00
</view>
</template>
<script>
2024-03-28 09:43:43 +08:00
import serve from '@/api/packageIntegral/productList.js'
2024-01-26 09:28:51 +08:00
export default {
options: {
styleIsolation: 'shared'
},
data() {
return {
2024-02-02 13:44:55 +08:00
2024-01-26 09:28:51 +08:00
currentIndex: 0,
code: '',
controlWindows: {
code: false
},
paramter: {
currentPage: 1,
pagesize: 20,
2024-03-28 09:43:43 +08:00
params: {},
2024-01-26 09:28:51 +08:00
},
2024-03-28 09:43:43 +08:00
dataList: [],
2024-01-26 09:28:51 +08:00
optionsList: [{
text: '全部',
count: 0,
value: ''
}, {
text: '已上架',
count: 0,
value: ''
}, {
text: '未上架',
count: 0,
value: ''
}, {
text: '待审核',
count: 0,
value: ''
}],
2024-04-12 17:09:32 +08:00
identifying: {
2024-03-28 09:43:43 +08:00
1: {
2024-01-26 17:04:25 +08:00
background: '#F83D3D',
opacity: 1,
value: "已上架"
},
2024-03-28 09:43:43 +08:00
2: {
2024-01-26 17:04:25 +08:00
background: '#F83D3D',
opacity: 0.5,
value: "待上架"
}
},
2024-01-26 09:28:51 +08:00
statusEnum: {
1: {
2024-01-26 17:04:25 +08:00
color: '#8D38FC',
value: "待审核"
2024-01-26 09:28:51 +08:00
},
2: {
2024-01-26 17:04:25 +08:00
color: '#FCB438',
value: "已审核"
2024-01-26 09:28:51 +08:00
},
2024-03-28 09:43:43 +08:00
3: {
color: '#F83D3D',
value: "已驳回"
2024-02-02 13:44:55 +08:00
},
2024-03-28 09:43:43 +08:00
},
2024-04-12 17:09:32 +08:00
examineDetailList: [],
productData: {}
2024-01-26 09:28:51 +08:00
}
},
onLoad() {
2024-03-28 09:43:43 +08:00
this.productByPage()
this.getTopInfo()
2024-01-26 09:28:51 +08:00
},
methods: {
selectOptions(index) {
this.currentIndex = index
2024-04-16 17:16:00 +08:00
this.paramter.currentPage = 1
2024-04-12 17:09:32 +08:00
if (index == 0) {
this.paramter.params = {}
} else if (index == 1) {
this.paramter.params = {}
2024-03-28 09:43:43 +08:00
this.paramter.params.productStatus = 1
2024-04-12 17:09:32 +08:00
} else if (index == 2) {
this.paramter.params = {}
2024-03-28 09:43:43 +08:00
this.paramter.params.productStatus = 2
2024-04-12 17:09:32 +08:00
} else if (index == 3) {
this.paramter.params = {}
2024-03-28 09:43:43 +08:00
this.paramter.params.auditStatus = 1
}
this.productByPage()
2024-01-26 09:28:51 +08:00
},
handler(json) {
json = json.replace(/'/g, '"')
let res = JSON.parse(json)
let values = Object.values(res)
let text = values.reduce((prev, item, index) => {
let _text = `${index == 0 ? '' :','}${item}`
return prev += _text
}, '')
return text
},
2024-04-09 08:56:34 +08:00
// toDetails(item) {
// uni.navigateTo({
// url: `../orderDetails/index?orderId=${item.id}`
// })
// },
2024-04-12 17:09:32 +08:00
getTopInfo() {
2024-03-28 09:43:43 +08:00
serve.getTopInfo(this.paramter).then(res => {
if (res.code === 20000) {
this.optionsList[0].count = res.data.count
this.optionsList[1].count = res.data.availableCount
this.optionsList[2].count = res.data.noAvailableCount
this.optionsList[3].count = res.data.auditCount
}
})
},
2024-01-26 09:28:51 +08:00
search() {
this.paramter.currentPage = 1
2024-03-28 09:43:43 +08:00
this.productByPage()
this.getTopInfo()
2024-01-26 09:28:51 +08:00
},
2024-03-28 09:43:43 +08:00
productByPage() {
serve.productByPage(this.paramter).then(res => {
2024-01-26 09:28:51 +08:00
if (res.code === 20000) {
2024-04-24 16:51:02 +08:00
if (!res.data.list.length && this.paramter.currentPage != 1) {
2024-01-26 09:28:51 +08:00
uni.showToast({
title: '没有更多订单啦~',
icon: 'none'
})
return
}
if (this.paramter.currentPage == 1) {
this.dataList = []
}
this.dataList = this.dataList.concat(res.data.list)
}
})
},
lower() {
this.paramter.currentPage += 1
2024-03-28 09:43:43 +08:00
this.productByPage()
2024-01-26 09:28:51 +08:00
},
2024-04-12 17:09:32 +08:00
examineDetail(item) {
serve.productAuditHistory({
id: item.id
}).then(res => {
2024-03-28 09:43:43 +08:00
this.examineDetailList = res.data
})
2024-02-02 13:44:55 +08:00
this.$refs.detail.open('center')
},
2024-04-16 17:16:00 +08:00
orderDelete(item) {
2024-01-26 17:04:25 +08:00
this.$refs.delete.open('center')
2024-04-16 17:16:00 +08:00
this.deleteData = item
},
2024-04-24 16:51:02 +08:00
deleteIntegral() {
serve.deleteProductById({
id: this.deleteData.id
}).then(res => {
2024-04-16 17:16:00 +08:00
uni.showToast({
title: res.msg,
icon: 'none'
})
this.$refs.delete.close()
this.search()
})
2024-01-26 17:04:25 +08:00
},
2024-04-12 17:09:32 +08:00
toEditOrder(item) {
2024-03-28 16:13:29 +08:00
uni.navigateTo({
2024-03-29 17:11:02 +08:00
url: `../productUpdate/index?id=${item.id}`
2024-03-28 16:13:29 +08:00
})
2024-04-09 08:56:34 +08:00
2024-03-28 16:13:29 +08:00
},
2024-03-28 09:43:43 +08:00
upDownFrame(item) {
this.productData = item
2024-01-26 09:28:51 +08:00
this.$refs.popup.open('center')
},
2024-04-12 17:09:32 +08:00
submitProduct() {
2024-03-28 09:43:43 +08:00
let data = {}
data.id = this.productData.id
2024-04-12 17:09:32 +08:00
if (this.productData.productStatus == 1) {
2024-03-28 09:43:43 +08:00
data.productStatus = 2
2024-04-12 17:09:32 +08:00
} else if (this.productData.productStatus == 2) {
2024-03-28 09:43:43 +08:00
data.productStatus = 1
}
2024-04-09 08:56:34 +08:00
2024-04-12 17:09:32 +08:00
serve.productStatus(data).then(res => {
2024-03-28 09:43:43 +08:00
uni.showToast({
title: res.msg,
icon: 'none'
})
if (res.code !== 20000) return
this.$refs.popup.close()
this.productByPage()
this.getTopInfo()
})
},
2024-01-26 09:28:51 +08:00
confirm() {
this.controlWindows.code = false
}
}
}
</script>
<style lang="scss" scoped>
/deep/ .uni-easyinput__content {
background: #F7F7F7 !important;
}
.container {
height: 100vh;
display: flex;
flex-direction: column;
background: #fff;
2024-03-28 09:43:43 +08:00
>.search {
margin: 50rpx auto 0;
width: 689rpx;
height: 74rpx;
background: #FFF;
}
2024-04-12 17:09:32 +08:00
2024-01-26 09:28:51 +08:00
>.options-frame {
display: flex;
justify-content: space-between;
margin-top: 43rpx;
padding: 0 31rpx;
>view {
width: 144rpx;
height: 66rpx;
font-size: 25rpx;
line-height: 66rpx;
text-align: center;
color: #000000;
background: #F7F7F7;
>text {
color: #F83D3D;
}
&.active {
color: #FFF;
background: #F83D3D;
>text {
color: #fff;
}
}
}
}
>.list {
margin-top: 35rpx;
flex: 1;
overflow-y: hidden;
.item {
position: relative;
margin-top: 20rpx;
background: #fff;
// min-height: 106rpx;
// border-bottom: 12rpx solid #F1F2F7;
&:nth-of-type(1) {
margin-top: 0
}
.header {
2024-01-26 17:04:25 +08:00
// padding: 26rpx 23rpx 0;
height: 60rpx;
2024-01-26 09:28:51 +08:00
// line-height: 83rpx;
width: 100%;
font-size: 30rpx;
color: #666;
2024-01-26 17:04:25 +08:00
border-top: 1rpx solid #D7D7D7;
2024-01-26 09:28:51 +08:00
2024-04-12 17:09:32 +08:00
.identifying {
2024-01-26 17:04:25 +08:00
width: 120rpx;
height: 60rpx;
line-height: 60rpx;
// background-color: #F83D3D;
color: #FFF;
text-align: center;
border-bottom-right-radius: 30rpx;
2024-01-26 09:28:51 +08:00
}
}
.introduce {
position: relative;
padding: 24rpx 29rpx 31rpx 268rpx;
min-height: 220rpx;
>image {
position: absolute;
top: 13rpx;
left: 34rpx;
width: 220rpx;
height: 220rpx;
// border: 1px solid #333;
}
>view {
&:nth-of-type(1) {
font-size: 28rpx;
color: #000;
}
&:nth-of-type(2),
&:nth-of-type(3) {
margin-top: 11rpx;
font-size: 24rpx;
color: #999;
}
&:nth-of-type(3) {
margin-top: 18rpx;
}
&:nth-of-type(4) {
margin-top: 11rpx;
2024-01-26 17:04:25 +08:00
font-size: 28rpx;
color: #F83D3D;
2024-01-26 09:28:51 +08:00
}
}
}
2024-04-12 17:09:32 +08:00
.examine {
2024-01-26 17:04:25 +08:00
width: 120rpx;
height: 45rpx;
color: #FFF;
text-align: center;
line-height: 45rpx;
position: absolute;
right: 50rpx;
top: 180rpx;
}
2024-01-26 09:28:51 +08:00
>.footer {
position: relative;
2024-01-26 17:04:25 +08:00
height: 58rpx;
line-height: 58rpx;
2024-01-26 09:28:51 +08:00
padding: 0 34rpx 40rpx;
font-size: 32rpx;
color: #000;
font-weight: 550;
.button {
position: absolute;
top: 0;
2024-01-26 17:04:25 +08:00
width: 128rpx;
height: 58rpx;
line-height: 58rpx;
2024-01-26 09:28:51 +08:00
text-align: center;
font-size: 28rpx;
2024-01-26 17:04:25 +08:00
color: #999;
background: #FFF;
border: 1px solid #999;
2024-01-26 09:28:51 +08:00
border-radius: 10rpx;
}
2024-02-02 13:44:55 +08:00
2024-04-12 17:09:32 +08:00
>.button {
&:nth-of-type(1) {
2024-01-26 17:04:25 +08:00
right: 360rpx;
}
2024-04-12 17:09:32 +08:00
&:nth-of-type(2) {
2024-01-26 17:04:25 +08:00
right: 200rpx;
}
2024-04-12 17:09:32 +08:00
&:nth-of-type(3) {
2024-01-26 17:04:25 +08:00
right: 40rpx;
}
2024-02-02 13:44:55 +08:00
2024-01-26 17:04:25 +08:00
}
}
}
}
2024-02-02 13:44:55 +08:00
.determine-detail {
padding: 30rpx 0;
width: 681rpx;
background: #FFFFFF;
border-radius: 15rpx;
position: relative;
>.title {
text-align: center;
font-size: 38rpx;
color: #000;
margin-bottom: 20rpx;
}
2024-04-12 17:09:32 +08:00
>uni-icons {
2024-02-02 13:44:55 +08:00
position: absolute;
top: 30rpx;
right: 30rpx;
}
2024-04-12 17:09:32 +08:00
>.item {
2024-02-02 13:44:55 +08:00
display: flex;
justify-content: space-evenly;
overflow-y: hidden;
font-size: 22rpx;
color: #666;
padding: 10rpx;
2024-04-12 17:09:32 +08:00
view {
2024-03-28 09:43:43 +08:00
width: 240rpx;
2024-02-02 13:44:55 +08:00
line-height: 46rpx;
}
2024-04-12 17:09:32 +08:00
>.status {
2024-03-28 09:43:43 +08:00
width: 160rpx;
2024-04-12 17:09:32 +08:00
>view {
2024-03-28 09:43:43 +08:00
width: 160rpx;
}
}
2024-04-09 08:56:34 +08:00
2024-04-12 17:09:32 +08:00
.header {
2024-02-02 13:44:55 +08:00
font-size: 32rpx;
color: #000;
}
}
>.buttons {
display: flex;
justify-content: space-evenly;
margin-top: 50rpx;
>view {
width: 550rpx;
height: 76rpx;
text-align: center;
line-height: 76rpx;
border-radius: 10rpx;
font-size: 28rpx;
background: #FE0505;
color: #fff;
}
}
}
2024-01-26 17:04:25 +08:00
.determine-frame {
padding-top: 85rpx;
width: 681rpx;
height: 340rpx;
background: #FFFFFF;
border-radius: 15rpx;
2024-02-02 13:44:55 +08:00
2024-01-26 17:04:25 +08:00
>.title {
text-align: center;
font-size: 38rpx;
color: #000;
2024-02-02 13:44:55 +08:00
2024-01-26 17:04:25 +08:00
}
2024-02-02 13:44:55 +08:00
2024-01-26 17:04:25 +08:00
>.buttons {
2024-02-02 13:44:55 +08:00
2024-01-26 17:04:25 +08:00
display: flex;
justify-content: space-evenly;
margin-top: 80rpx;
2024-02-02 13:44:55 +08:00
2024-01-26 17:04:25 +08:00
>view {
width: 250rpx;
height: 76rpx;
text-align: center;
line-height: 76rpx;
border-radius: 10rpx;
font-size: 28rpx;
2024-02-02 13:44:55 +08:00
2024-01-26 17:04:25 +08:00
&:nth-of-type(1) {
background: #FFFFFF;
border: 1rpx solid #B6B6B6;
color: #333;
}
2024-02-02 13:44:55 +08:00
2024-01-26 17:04:25 +08:00
&:nth-of-type(2) {
background: #FE0505;
color: #fff;
}
2024-01-26 09:28:51 +08:00
}
}
}
>.empty {
margin: 218rpx auto 0;
>image {
width: 473rpx;
height: 404rpx;
}
>view {
margin-top: 45rpx;
text-align: center;
font-size: 28rpx;
color: #999;
}
}
}
2024-04-28 14:55:30 +08:00
</style>