| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603 |
- <template>
- <view class="product">
- <view class="head">
- <view class="handle">
- <view class="head_left">
- <span class="cuIcon-back" @click="back"></span>
- </view>
- <span class="center">商品管理</span>
- <view class="head_right">
- <span class="cuIcon-search" @click="goSearch"></span>
- <view class="manage" @click="manage">
- {{isManage?'退出管理':'管理'}}
- </view>
- </view>
- </view>
- <view class="type">
- <view class="type_item" :class="currentIndex == index?'active':''" v-for="(item,index) in typeList" :key="index"
- @click="selectType(item,index)">
- {{item.type}}({{item.num}})
- <span class="line" v-if="currentIndex == index"></span>
- </view>
- </view>
- </view>
- <view class="list">
- <view class="product_item" v-for="(item,index) in productList" :key="index" @click="goDetails(item)">
- <view class="status">
- <span class="round" v-if="item.productStatus =='1'">售卖中</span>
- <span class="round no" v-if="item.productStatus =='0'" style="color:#666666 ;">未上架</span>
- <span class="line"></span>
- <span v-if="item.saleStartDate">{{item.saleStartDate.slice(0,10)}}-{{item.saleEndDate.slice(0,10)}}</span>
-
- <!-- <span>已售:{{item.num}}</span>
- <span>库存:{{item.inventory}}</span> -->
- </view>
- <view class="details">
- <view class="img">
- <image :src="item.url" mode=""></image>
- </view>
- <view class="data">
- <span>{{item.productName}}</span>
- <!-- <span>售卖时间:{{item.time}}</span> -->
- <view class="repertory">库存:不限 <span></span> 销量:{{item.soldQuantity}}</view>
- <view class="price">
- <span style="font-size: 22rpx;margin: 0px;">¥</span>{{item.soldPrice}}
- <span style="color:#999 ;font-size: 22rpx; text-decoration: line-through;">¥{{item.price}}</span>
- </view>
- </view>
- <view class="tag" v-if="isManage" @click.stop="select(item)">
- <!-- <span>组合套餐</span> -->
- <!-- <span class="frame"></span> -->
- <image src="/static/product/select.png" mode="" v-if="item.select"></image>
- <image src="/static/product/round.png" mode="" v-else></image>
- </view>
- </view>
- <view class="btn_box">
- <view class="delist">
- 下架
- </view>
- <view class="edit delist">
- 编辑
- </view>
- </view>
- </view>
- </view>
- <view class="creat">
- <view class="operate" v-if="isManage">
- <view class="all" @click="allSelect">
- <image src="/static/product/select.png" mode="" v-if="isAll"></image>
- <image src="/static/product/round.png" mode="" v-else></image>
- 全选
- </view>
- <view class="delete">删除</view>
- <view class="delete delist">下架</view>
- </view>
- <view class="btn" @click="creatProduct" v-else>
- <image src="/static/product/product.png" mode=""></image>
- 创建商品
- </view>
- </view>
- <view class="popup" v-if="isDelete">
- <view class="content">
- <view class="title">
- <span>删除商品</span>
- </view>
- <view class="center">
- <image src="/static/index/close.png" mode="" v-if="canBeDelete"></image>
- <image src="/static/product/error.png" mode="" v-else></image>
- <view class="error" v-if="canBeDelete">
- 确定要删除?
- </view>
- <view class="error" v-else>
- 当前门店还存在有效服务券<br />
- <span style="margin-top: 12rpx;">暂时无法关闭门店</span>
- </view>
- </view>
- <view class="sub" @click="isSuccess = false">
- <view class="button">
- 确定
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- isManage: false,
- currentIndex: 0,
- productStatus:0,//商品状态,默认1售卖中,0未上架,2审核中,3未通过
- isAll: false,
- isDelete: false,
- canBeDelete: true,
- typeList: [{
- type: '售卖中',
- num: 21
- },
- {
- type: '待上架',
- num: 8
- },
- {
- type: '审核中',
- num: 0
- },
- {
- type: '未通过',
- num: 6
- }
- ],
- productList: []
- }
- },
- methods: {
- //返回
- back() {
- uni.navigateBack({
- delta: 1
- });
- },
- //切换分类
- selectType(item, index) {
- this.currentIndex = index
- },
- //是否管理商品
- manage() {
- this.isManage = !this.isManage
- },
- // 跳转至搜索页面
- goSearch() {
- uni.navigateTo({
- url: '/pages/product/search'
- })
- },
- //跳转至详情
- goDetails(item) {
- uni.navigateTo({
- url: '/pages/product/details'
- })
- },
- //跳转至创建商品
- creatProduct() {
- uni.navigateTo({
- url: '/pages/product/creatProduct'
- })
- },
- select(item) {
- item.select = !item.select
- },
- allSelect() {
- if (this.isAll) {
- this.isAll = false
- this.productList.forEach(item => {
- item.select = false
- })
- } else {
- this.isAll = true
- this.productList.forEach(item => {
- item.select = true
- })
- }
- },
- getProductList() {
- this.$http.get("/app/product/list?merchantId=" + '111' + "&productStatus=" + this.productStatus, ).then(res => {
- if (res.data.code == 200) {
- res.data.result.records.forEach((item) => {
- item.select = false;
- })
- this.productList = res.data.result.records
- console.log(this.productList)
- }
- })
- }
- },
- mounted() {
- this.getProductList()
- }
- }
- </script>
- <style lang="scss" scoped>
- .product {
- width: 100%;
- height: 100vh;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- background: #F7F8FC;
- .head {
- width: 100%;
- background: linear-gradient(87deg, #FFFFFF 0%, #A3CDFF 100%), linear-gradient(360deg, #FFFFFF 0%, rgba(255, 255, 255, 0) 100%);
- .handle {
- height: 112rpx;
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 0px 24rpx;
- position: relative;
- .head_left {
- font-size: 40rpx;
- }
- .center {
- position: absolute;
- left: 50%;
- top: 50%;
- transform: translate(-50%, -50%);
- font-size: 36rpx;
- font-weight: 600;
- }
- .head_right {
- display: flex;
- justify-content: space-between;
- align-items: center;
- span {
- width: 40rpx;
- height: 40rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- }
- .manage {
- // width: 150rpx;
- margin-left: 28rpx;
- }
- }
- }
- .type {
- display: flex;
- background-color: #fff;
- .type_item {
- width: 25%;
- height: 75rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- font-size: 26rpx;
- color: #888888;
- position: relative;
- .line {
- position: absolute;
- bottom: 10rpx;
- width: 53rpx;
- height: 8rpx;
- background: #449AFF;
- border-radius: 7rpx;
- }
- }
- .active {
- color: #333;
- }
- }
- }
- .list {
- width: 100%;
- flex: 1;
- // padding: 0px 20rpx;
- overflow-y: auto;
- .product_item {
- width: 100%;
- background-color: #fff;
- border-radius: 20rpx;
- padding: 20rpx 40rpx;
- margin-top: 20rpx;
- .status {
- display: flex;
- align-items: center;
- .round {
- display: flex;
- align-items: center;
- color: #49A03F;
- }
- .round::before {
- content: "";
- display: inline-block;
- width: 9rpx;
- height: 9rpx;
- background: #49A03F;
- border-radius: 50%;
- margin-right: 8rpx;
- }
- .no {
- color: #666666;
- }
- .no::before {
- content: "";
- display: inline-block;
- width: 9rpx;
- height: 9rpx;
- background: #666666;
- border-radius: 50%;
- margin-right: 8rpx;
- }
- .line {
- display: block;
- width: 1rpx;
- height: 20rpx;
- background: #d9d9d9;
- margin: 0 12rpx;
- }
- }
- .details {
- width: 100%;
- height: auto;
- min-height: 132rpx;
- height: 132rpx;
- display: flex;
- align-items: center;
- margin-top: 20rpx;
- .img {
- margin-right: 16rpx;
- image {
- width: 132rpx;
- height: 132rpx;
- }
- }
- .data {
- flex: 1;
- height: 100%;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- font-weight: 600;
- font-style: 28rpx;
- .repertory {
- font-size: 24rpx;
- display: flex;
- align-items: center;
- color: #666;
- font-weight: 400;
- span {
- display: block;
- width: 1rpx;
- height: 20rpx;
- background: #d9d9d9;
- margin: 0 12rpx;
- }
- }
- .price {
- display: flex;
- align-items: center;
- font-size: 30rpx;
- font-weight: 600;
- span {
- font-size: 26rpx;
- margin-left: 20rpx;
- font-weight: 400;
- }
- }
- }
- .tag {
- width: 40rpx;
- height: 40rpx;
- display: flex;
- flex-direction: column;
- align-items: center;
- image {
- width: 40rpx;
- height: 40rpx;
- }
- }
- }
- .btn_box {
- width: 100%;
- display: flex;
- justify-content: end;
- align-items: center;
- margin-top: 20rpx;
- .delist {
- width: 100rpx;
- height: 50rpx;
- border-radius: 8rpx;
- border: 1px solid #CCCCCC;
- display: flex;
- justify-content: center;
- align-items: center;
- font-size: 26rpx;
- color: #666666;
- }
- .edit {
- margin-left: 20rpx;
- background: rgba(68, 154, 255, 0.05);
- border: 1px solid #449AFF;
- color: #449AFF;
- }
- }
- }
- }
- .creat {
- width: 100%;
- height: 100rpx;
- background-color: #fff;
- display: flex;
- justify-content: center;
- align-items: center;
- .btn {
- width: 672rpx;
- height: 76rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- background: linear-gradient(90deg, #77B6FF 0%, #449AFF 100%);
- border-radius: 75rpx;
- font-size: 28rpx;
- color: #FFFFFF;
- image {
- width: 40rpx;
- height: 40rpx;
- margin-right: 10rpx;
- }
- }
- .operate {
- width: 100%;
- display: flex;
- // justify-content: space-between;
- align-items: center;
- padding: 0px 20rpx;
- .delete {
- width: 205rpx;
- height: 76rpx;
- background: linear-gradient(90deg, #77B6FF 0%, #449AFF 100%);
- border-radius: 49rpx;
- font-size: 28rpx;
- color: #FFFFFF;
- display: flex;
- justify-content: center;
- align-items: center;
- margin-right: 24rpx;
- margin-left: 140rpx;
- }
- .delist {
- margin-left: 0rpx;
- background: linear-gradient(90deg, #FFA05B 0%, #FF7918 100%);
- }
- .all {
- width: 25%;
- // height: 60rpx;
- // border: 1px solid #999;
- display: flex;
- justify-content: center;
- align-items: center;
- image {
- width: 40rpx;
- height: 40rpx;
- margin-right: 10rpx;
- }
- }
- }
- }
- .popup {
- width: 100vw;
- height: 100vh;
- position: fixed;
- top: 0;
- left: 0;
- background: rgba(0, 0, 0, 0.4);
- display: flex;
- align-items: center;
- justify-content: center;
- .content {
- width: 570rpx;
- background: #FFFFFF;
- border-radius: 16rpx;
- padding: 0px 24rpx;
- padding-bottom: 16rpx;
- .title {
- width: 100%;
- height: 86rpx;
- font-size: 32rpx;
- color: #333333;
- font-weight: 600;
- border-bottom: 1px solid #EEEEEE;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .center {
- font-size: 30rpx;
- color: #333333;
- line-height: 35rpx;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- padding-top: 28rpx;
- border-bottom: 1px solid #EEEEEE;
- padding-bottom: 40rpx;
- margin-bottom: 16rpx;
- .error {
- text-align: center;
- }
- image {
- width: 100rpx;
- height: 100rpx;
- margin-bottom: 10rpx;
- }
- }
- .sub {
- width: 320rpx;
- height: 68rpx;
- border-radius: 66rpx;
- font-size: 28rpx;
- color: #FFFFFF;
- display: flex;
- align-items: center;
- justify-content: center;
- margin: 0rpx auto;
- .button {
- width: 320rpx;
- height: 68rpx;
- background: #449AFF;
- border-radius: 66rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- }
- .start {
- background: #53CC48;
- }
- .rest {
- background: #FF8024;
- }
- }
- }
- }
- </style>
|