123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- <template>
- <view class="content">
- <view class="top hflex acenter jbetween">
- <view class="left">共<span class="text_red">{{length}}</span>件商品</view>
- <view class="left" :class="is_manager?'text_blue':''" @click="manager">{{is_manager?'完成':'编辑'}}</view>
- </view>
- <view class="box">
- <block v-for="(item,index) in pageList" :key="index">
- <view class="item hflex acenter">
- <u-checkbox-group v-if="is_manager == 1" placement="column" @change="checkboxChange(index)">
- <u-checkbox v-model="item.id" :value="item.id" :checked="item.checked" shape="circle"></u-checkbox>
- </u-checkbox-group>
- <view class="">
- <image :src="item.img" class="img"></image>
- </view>
- <view class="vflex" style="margin-left: 24rpx;">
- <view class="name">{{item.name}}</view>
- <view class="price">¥{{item.price}}</view>
- </view>
- </view>
- </block>
- </view>
- <view class="bottom hflex acenter jbetween" v-if="is_manager == 1">
- <view>
- <u-checkbox-group placement="column" @change="checkboxAll2">
- <u-checkbox :value="all" :checked="isAllSelected" shape="circle" label="全选"></u-checkbox>
- </u-checkbox-group>
- </view>
- <view class="hflex aend">
- <view class="btn2">删除</view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import $api from '@/static/js/api.js'
- var that = ''
- export default {
- data() {
- return {
- length: 0,
- pageList: [
- {
- img: '/static/images/mine/avatar1.jpg',
- name: '兰蔻小黑瓶50ml全新肌底液精华液化妆品护肤全套礼盒…',
- price: 1298
- },
- {
- img: '/static/images/index/class_img4.png',
- name: '兰蔻小黑瓶50ml全新肌底液精华液化妆品护肤全套礼盒…',
- price: 1298
- }
- ],
- is_manager: 0,
- all: '',
- isAllSelected: false,
- }
- },
- onLoad() {
- that = this
- that.totalLength()
- },
- methods: {
- // 统计商品数量
- totalLength() {
- that.length = that.pageList.length
- },
- // 编辑
- manager() {
- if(that.is_manager == 0) {
- that.is_manager = 1
- } else {
- that.is_manager = 0
- }
- },
- // 全选
- checkboxAll2() {
- that.isAllSelected = !that.isAllSelected
- if(that.isAllSelected) {
- for(var i = 0;i<that.pageList.length;i++) {
- that.$set(that.pageList[i],'checked',true)
- }
-
- } else {
- for(var i = 0;i<that.pageList.length;i++) {
- that.$set(that.pageList[i],'checked',false)
- }
- }
- },
- // 单选
- checkboxChange(index) {
- console.log(index);
- }
- },
- }
- </script>
- <style lang="scss" scoped>
- .content {
- background: #F5F5F5;
- .top {
- width: 100%;
- box-sizing: border-box;
- padding: 20rpx 30rpx;
- .left {
- font-size: 32rpx;
- font-weight: 400;
- color: #555555;
- line-height: 44rpx;
- }
- .text_red {
- color: #FF5E5E;
- }
- .text_blue {
- color: #506DFF;
- }
- }
- .box {
- width: 100%;
- box-sizing: border-box;
- padding: 0 30rpx;
- background: #FFFFFF;
- .item {
- width: 100%;
- padding: 20rpx 0 32rpx;
- border-bottom: 1rpx solid #F4F4F4;
- .img {
- width: 196rpx;
- height: 196rpx;
- border-radius: 16rpx;
- }
- .name {
- font-size: 32rpx;
- font-weight: 400;
- color: #222222;
- line-height: 44rpx;
- text-overflow: ellipsis;
- overflow: hidden;
- display: -webkit-box;
- -webkit-box-orient: vertical;
- box-orient: vertical;
- line-clamp: 2;
- -webkit-line-clamp: 2;
- }
- .price {
- font-size: 44rpx;
- font-weight: bold;
- color: #FF5E5E;
- line-height: 52rpx;
- padding-top: 32rpx;
- }
- }
- .item:nth-last-child(1) {
- border: none;
- }
- }
- .bottom {
- width: 100%;
- z-index: 9;
- position: fixed;
- bottom: 0;
- height: 166rpx;
- background: #FFFFFF;
- box-sizing: border-box;
- padding: 8rpx 30rpx 74rpx;
- .btn2 {
- width: 200rpx;
- height: 80rpx;
- border-radius: 44rpx;
- border: 1px solid #506DFF;
- font-size: 36rpx;
- font-weight: 500;
- color: #506DFF;
- line-height: 80rpx;
- text-align: center;
- }
- }
- }
- </style>
|