manage.vue 7.44 KB
Newer Older
qkx's avatar
qkx committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298
<template>
  <div>
    <div class="container">
      <div class="search_wraper">
        <van-search
          style="flex: 1;"
          v-model="searchForm.inputValue"
          placeholder="客官你要搜索点什么"
          shape="round"
          @search="onSearch"
        >
        </van-search>
        <van-icon name="wap-nav" @click="showFilter"/>
      </div>
        <div class="list">
          <div class="good" v-for="good in goodsList" :key="good.id">
            <div class="left">
              <img :src="good.logo" />
            </div>
            <div class="center">
              <div class="name">{{good.name}}</div>
              <div class="descri">{{good.descri}}</div>
              <div class="commission">佣金:¥{{good.commission}}</div>
            </div>
            <div class="right">
              <h3>{{good.price}}</h3>
              <div class="right_btn">
                <div class="sj" style="margin-right: 8px;" color="#75B2FD" @click="toConfig(good.id)">配置</div>
                <div v-if="good.status === 1" class="sj" color="#75B2FD" @click="lowShelf(good.id)">下架</div>
                <div v-if="good.status === 2" class="sj" color="#75B2FD" @click="upShelf(good.id)" >上架</div>
              </div>
            </div>
          </div>
        </div>
    </div>
    <van-popup
      closeable
      v-model="rightShow"
      position="right"
      :style="{ width: '70%', height: '100%', padding: '10% 3%' }"
    >
      <div class="config_label">状态</div>
      <div class="config_status_wraper">
        <van-button
          v-for="status in statusData"
          :key="status.value"
          plain
          round
          size="small"
          :type="status.isCheck ? 'info' : 'default'"
          style="margin: 0 10px 20px 0;"
          @click="handleStatus(status.value, status.isCheck)"
        >
          {{ status.name }}
        </van-button>
      </div>
      <div class="config_label">排序</div>
      <div class="config_sort_wraper">
        <van-button
          v-for="sort in sortData"
          :key="sort.value"
          plain
          round
          size="small"
          :type="sort.isCheck ? 'info' : 'default'"
          style="margin-right: 10px;"
          @click="handleSort(sort.value, sort.isCheck)"
        >
          {{ sort.name }}
        </van-button>
      </div>
    </van-popup>
    <van-popup
      closeable
      v-model="bottomShow"
      position="bottom"
      :style="{ height: '32%', padding: '10% 5%' }"
    >
      <van-form @submit="configConfirm">
        <van-field name="radio" label="佣金类型">
          <template #input>
            <van-radio-group v-model="configForm.type" direction="horizontal">
              <van-radio name="1">固定金额</van-radio>
              <van-radio name="2">成交价比例</van-radio>
            </van-radio-group>
          </template>
        </van-field>
        <van-field name="stepper" :label="configForm.type === '1' ? '固定金额' : '成交价比例%'">
          <template #input>
            <van-stepper v-model="configForm.count" />
          </template>
        </van-field>
        <div style="text-align:center">
          <van-button type="info" size="small" native-type="submit">确定</van-button>
          <van-button type="default" size="small" style="margin-left: 20px">取消</van-button>
        </div>
      </van-form>
    </van-popup>
    
  </div>
</template>

<script>
export default {
  data() {
    return {
      // 搜索项
      searchForm: {
        inputValue: "",
        status: '',
        sortBy: ''
      },
      // 商品列表
      goodsList: [
        {
          id: 1,
          name: '女式大衣成熟的参数电池多少困难成熟的参数电池是的成熟的参数电池',
          logo: require('../../../public/img/goods.png'),
          price: '588',
          descri: '冬季长款卡其色S号适合秋冬季节基础上达成城市的基础上达成村上春树的吃大餐',
          commission: '30',
          status: 1
        }, {
          id: 2,
          name: '女式大衣',
          logo: require('../../../public/img/goods.png'),
          price: '588',
          descri: '冬季长款卡其色S号适合秋冬季节',
          commission: '30',
          status: 2
        }, {
          id: 3,
          name: '女式大衣',
          logo: require('../../../public/img/goods.png'),
          price: '588',
          descri: '冬季长款卡其色S号适合秋冬季节',
          commission: '30',
          status: 1
        }
      ],
      // 是否底部弹出
      bottomShow: false,
      // 是否右侧弹出
      rightShow: false,
      // 配置表单
      configForm: {
        type: '1',
        count: 0,
      },
      // 状态数据
      statusData: [
        { value: '1', name: '已上架', isCheck: true },
        { value: '2', name: '已下架', isCheck: false }
      ],
      // 排序数据
      sortData: [
        { value: '1', name: '价格', isCheck: true },
        { value: '2', name: '佣金', isCheck: false },
        { value: '3', name: '日期', isCheck: false },
      ]
    }
  },
  methods: {
    onSearch() {},
    // 显示筛选项model
    showFilter() {
      this.rightShow = true
    },
    // 排序
    handleSort(value, isCheck) {
      if (!isCheck) {
        this.sortData.map(item => {
          item.isCheck = item.value === value
        })
      }
    },
    // 筛选状态
    handleStatus(value, isCheck) {
      const currentStatus = this.statusData.filter(item => item.value === value)[0]
      currentStatus.isCheck = !currentStatus.isCheck
    },
    // 配置
    toConfig(id) {
      this.bottomShow = true
    },
    // 下架
    lowShelf(id) {
      this.$toast('商品下架成功!')
    },
    // 上架
    upShelf(id) {
      this.$toast('商品上架成功!')
    },
    // 佣金配置确定
    configConfirm() {
      this.bottomShow = false
    },
    // 佣金配置取消
    configCancel() {
      this.bottomShow = false
    }
  }
};
</script>

<style scoped>
.sj {
  font-size: 14px;
  font-weight: bold;
  color: rgba(117, 178, 253, 1);
}
h3 {
  font-size: 14px;
  color: rgba(208, 2, 27, 1);
  margin-top: 18px;
}
.name {
  font-size: 14px;
  font-weight: bold;
  color: rgba(45, 71, 106, 1);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  overflow: hidden;
}
.descri {
  font-size: 12px;
  color: rgba(45, 71, 106, 1);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.config_label {
  font-size: 14px;
}
.commission {
  font-size: 12px;
  font-weight: bold;
  color: rgba(208, 2, 27, 1);
}
.good {
  height: 108px;
  border-bottom: 1px solid rgba(238, 238, 238, 1);
  width: 100%;
  padding: 12px 0;
  display: flex;
  justify-content: space-between;
}
.list {
  padding: 0 16px;
  box-sizing: border-box;
}
.left,
.right,
.center {
  height: 80px;
}
.left {
  width: 80px;
  border-radius:6px;
}
.left img {
  width: 100%;
}
.center {
  width: 50%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.right {
  width: 20%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
}
.right_btn {
  display: flex;
}
.container {
  height: auto;
  min-height: 100%;
  background-color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}
.search_wraper {
  display: flex;
  align-items: center;
  padding: 12px 16px;
}
.active {
  background-color: #75b2fd;
}
</style>