Commit 9117c30c authored by 高铭波's avatar 高铭波

Merge branch 'dev' of https://git.banshouhui.com/lijundan/self-support into dev

parents 6730a468 dc9dcd1b
## 配件组件使用说明
## 配件数量调整组件使用说明
```
该组件用于仓库配件的数量调整
......
......@@ -5,7 +5,7 @@
{{info.name}}
</view>
<view class="num">
<u-number-box v-if="!disabled" v-model="info.num" :min="info.min" :max="info.max" @change="numChange"></u-number-box>
<u-number-box v-if="!disabled" v-model="info.num" :min="info.min || 0" :max="info.max || info.num" @change="numChange"></u-number-box>
<text class="nums" v-else>x{{ info.num || 1 }}</text>
</view>
</view>
......@@ -43,7 +43,6 @@
</script>
<style scoped lang="scss">
.parts{
padding: 0 20rpx;
.lists {
padding: 10rpx 0;
.name {
......
## 配件组件使用说明
## 配件选择组件使用说明
```
该组件用于仓库配件的选择与数量调整
该组件用于备件申请,数量调整
```
## API
......@@ -11,20 +11,22 @@
| 属性名 | 类型 | 默认值 | 可选值 | 说明 |
| :---------: | :-----: | :----: | :--------: | :---------------------: |
| showChecked | Boolean | false | true/false | 是否需要复选框 |
| disabled | Boolean | true | true/false | 是否禁用 |
| info | Object | {} | - | 列表数据 **格式见下文** |
### lists 格式
```json
{
"name": "正泰漏保", // 配件名称
"num": 1, // 配件数量
"min": 1, // 数量最小值
"max": 100, // 数量最大值
"desc": "NO.202006170015", // 描述
"img": "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png", // 图片地址
"checked": false // 勾选状态,如果需要回显勾选状态需传
id: 1,
name: "正泰漏保", // 名称
no: 'NO.202006170015', // 编号
desc: '这个空开盒子和其他的空开有什么不一样,这里可以写一下', // 描述
num: 1, // 默认数量
min: 1, // 数量最小值
max: 100, // 数量最大值
img: "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png", // 图片
checked: false, // 是否勾选
disabled: true // 是否禁用数量调整,如果禁用则会显示添加申请按钮
}
```
......@@ -34,6 +36,7 @@
| :-----------: | :----------: | :--------: |
| @numChange | 数量发生改变 | 改变的数量 |
| @selectChange | 勾选发生改变 | 勾选的状态 |
| @apply | 点击添加申请 | 无 |
## 组件用法
......@@ -41,12 +44,13 @@
```html
<select-parts
v-for="(item, index) in lists"
v-for="(item, index) in lists"
:key="index"
:info="item"
:show-checked="true"
@numChange="numChange"
@selectChange="selectChange"
:show-checked="false"
@numChange="numChange($event, index)"
@selectChange="selectChange($event, index)"
@apply="apply(index)"
></select-parts>
```
......@@ -60,36 +64,41 @@ export default {
return {
lists: [
{
id: 1,
name: "正泰漏保",
desc: "NO.202006170015",
num: 1,
min: 1,
max: 100,
img:
"https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png",
checked: false,
},
{
id: 2,
name: "挚达广汽充电桩",
desc: "NO.202006170014",
num: 3,
min: 1,
max: 5,
img:
"https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png",
checked: false,
},
id: 1,
name: "正泰漏保",
no: 'NO.202006170015',
desc: '这个空开盒子和其他的空开有什么不一样,这里可以写一下',
num: 1,
min: 1,
max: 100,
img: "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png",
checked: false,
disabled: true
},
{
id: 1,
name: "挚达广汽充电桩",
no: 'NO.202006170014',
desc: '这个空开盒子和其他的空开有什么不一样,这里可以写一下',
num: 3,
min: 1,
max: 5,
img: "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png",
checked: false,
disabled: true
},
],
}
},
methods: {
numChange(val) {
console.log("val", val)
apply(index) { // 添加申请
this.$set(this.lists[index], 'disabled', false)
},
numChange(val, index) { // 设置数量
this.$set(this.lists[index], 'num', val)
},
selectChange(val) {
console.log("val", val)
selectChange(val, index) { // 设置勾选状态
this.$set(this.lists[index], 'checked', val)
},
},
}
......
<template>
<view class="parts">
<uni-list-item
:title="info.name"
:note="info.desc"
:thumb="info.img"
thumb-size="lg"
:border="false"
>
<template slot="header" class="u-flex">
<view class="uni-list-item__header">
<view v-if="showChecked" class="uni-list-item__check"><u-checkbox v-model="info.checked" @change="selectChange" shape="circle"></u-checkbox></view>
<view v-if="info.img" class="uni-list-item__icon"><image :src="info.img" class="uni-list-item__icon-img" /></view>
<view class="u-flex parts">
<view class="u-flex left" v-if="showChecked">
<u-checkbox v-model="info.checked" @change="selectChange" shape="circle" width="30rpx"></u-checkbox>
</view>
<view class="u-flex right">
<view class="right-img">
<u-image :src="info.img" width="200rpx" height="200rpx" />
</view>
<view class="u-flex right-content">
<view class="right-content-name">{{ info.name }}</view>
<view class="right-content-desc">{{ info.desc }}</view>
<view class="u-flex right-content-opera">
<view class="no">
{{ info.no }}
</view>
<view class="num">
<u-number-box v-if="!info.disabled" v-model="info.num" :min="info.min || 0" :max="info.max || info.num" @change="numChange"></u-number-box>
<u-button v-if="info.disabled" type="primary" size="mini" shape="circle" @click="addApply">加入申请</u-button>
</view>
</view>
</template>
<template slot="footer" class="u-flex">
<view class="num">
<u-number-box v-if="!disabled" v-model="info.num" :min="info.min" :max="info.max" @change="numChange"></u-number-box>
<text class="nums" v-if="disabled">x{{ info.num || 1 }}</text>
</view>
</template>
</uni-list-item>
</view>
</view>
</view>
</view>
</template>
<script>
import uniListItem from "@/components/uni-list-item/uni-list-item.vue"
export default {
components: {
uniListItem,
},
props: {
info: {
info () {
......@@ -39,7 +35,7 @@
showChecked: { // 是否需要勾选
type: Boolean,
default () {
return false
return true
}
},
disabled: { // 是否可编辑数量
......@@ -54,7 +50,6 @@
}
},
created() {
console.log("this.info", this.info)
},
methods: {
selectChange(event) {
......@@ -63,35 +58,59 @@
numChange(event) {
this.$emit('numChange', event.value)
},
addApply() {
this.$emit('apply')
}
}
}
</script>
<style scoped lang="scss">
.parts{
.uni-list-item__header {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
align-items: center;
padding: 30rpx 10rpx;
border-bottom: 1px solid #F4F5F7;
.left {
width: 60rpx;
}
.uni-list-item__icon {
margin-right: 18rpx;
flex-direction: row;
justify-content: center;
align-items: center;
display: flex;
}
.uni-list-item__icon-img {
height: 80rpx;
width: 80rpx;
margin-right: 10px;
}
.num {
display: flex;
align-items: center;
.nums {
font-size: 28rpx;
.right {
flex: 1;
overflow: hidden;
.right-img {
padding-right: 20rpx;
}
.right-content {
flex: 1;
flex-direction: column;
align-items: flex-start;
overflow: hidden;
.right-content-name {
font-size: 32rpx;
color: #333;
font-weight: bold;
}
.right-content-desc {
font-size: 24rpx;
color: #999;
overflow: hidden;
line-height: 40rpx;
height: 80rpx;
margin: 10rpx 0;
}
.right-content-opera {
justify-content: space-between;
width: 100%;
.no {
font-size: 24rpx;
color: #999;
overflow: hidden;
flex: 1;
}
.num {
flex: 1;
text-align: right;
}
}
}
}
}
......
<template>
<view class="u-flex bottom">
<view class="u-flex bottom-left" v-if="showChecked">
<view class="left-list"><u-checkbox v-model="checked" @change="selectAll" shape="circle" width="30rpx" /></view>
<view class="left-list">全选</view>
</view>
<view class="u-flex bottom-center">
<view class="center-list">已选择 {{ partNum }} 种配件</view>
<view class="center-list">合计 <text class="num"> {{ num }} </text> 件</view>
</view>
<view class="u-flex bottom-right">
<button :class="['btn', btnActive]" @click="submit">{{ submitTxt }}</button>
</view>
</view>
</template>
<script>
export default {
props: {
showChecked: { // 是否显示勾选
type: Boolean,
default() {
return true
}
},
allChecked: { // 是否全选
type: Boolean,
default() {
return false
}
},
btnStatus: { // 确定按钮是否可点击
type: Boolean,
default() {
return false
}
},
partNum: { // 配件数量
type: Number,
default () {
return 0
}
},
num: { // 合计总件数
type: Number,
default () {
return 0
}
},
submitTxt: { // 提交按钮文字
type: String,
default () {
return '确定'
}
}
},
data() {
return {
checked: false
}
},
computed: {
btnActive() {
return this.btnStatus ? 'btn-active' : ''
}
},
watch: {
'allChecked': function(newValue, oldValue) {
if (this.showChecked) this.checked = newValue
}
},
created() {
if (this.showChecked) this.checked = this.allChecked
},
methods: {
selectAll(event) {
this.$emit('select', event.value)
},
submit() {
if (this.btnStatus) this.$emit('submit')
}
}
}
</script>
<style scoped lang="scss">
.bottom {
width: 100%;
height: 180rpx;
background: #fff;
justify-content: space-between;
.u-flex {
flex-direction: column;
align-items: center;
}
.bottom-left {
margin-left: 30rpx;
.left-list {
width: 100%;
&:nth-of-type(1) {
padding-left: 10rpx;
}
&:nth-of-type(2) {
padding-top: 20rpx;
}
}
}
.bottom-center {
flex: 1;
align-items: flex-start;
margin: 0 20rpx;
.center-list {
&:nth-of-type(1) {
color: #666;
font-size: 26rpx;
}
&:nth-of-type(2) {
color: #333;
font-size: 28rpx;
margin-top: 20rpx;
.num {
color: #2272FF;
padding: 0 10rpx;
}
}
}
}
.bottom-right {
width: 340rpx;
margin-right: 20rpx;
.btn {
width: 100%;
padding: 30rpx;
border-radius: 52rpx;
line-height: 44rpx;
font-size: 32rpx;
text-align: center;
background: #D1D4D4;
color: #fff;
&::after {
content: '';
height: 0;
border: none;
}
}
.btn-active {
background: #2272ff;
}
}
}
</style>
## 提交工具栏组件使用说明
```
该组件用于勾选配件,显示配件数量以及提交操作
```
## API
### Props
| 属性名 | 类型 | 默认值 | 可选值 | 说明 |
| :------: | :-----: | :----: | :--------: | :-----------------: |
| showChecked | Boolean | true | true/false | 是否显示勾选 |
| allChecked | Boolean | true | true/false | 是否全选 |
| btnStatus | Boolean | true | true/false | 确定按钮是否可点击 |
| btnStatus | Boolean | true | true/false | 确定按钮是否可点击 |
| partNum | Number | 0 | | 配件数量 |
| num | Number | 0 | | 合计总件数 |
| submitTxt | String | 确定 | | 确定按钮文字 |
### Events
| 事件称名 | 说明 | 返回值 |
| :------: | :----------------: | :------: |
| @select | 全选状态改变 | 新的状态 |
| @submit | 点击提交按钮 | |
## 组件用法
### 基础用法
```html
<submit-bar
:partNum="partNum"
:num="num"
:btnStatus="btnStatus"
:allChecked="allChecked"
@select="allSelect"
@submit="submit"
/>
```
```js
import submitBar from "@/components/submit-bar/index"
export default {
components: {
submitBar,
},
data() {
return {
}
},
computed: {
// 配件数
partNum() {
return 0
},
// 总数
num() {
return 0
},
// 按钮状态
btnStatus() {
return false
},
// 全选状态
allChecked() {
return false
}
},
methods: {
allSelect(value) {
console.log(value)
},
submit() {
console.log('submit')
}
},
}
```
......@@ -261,14 +261,14 @@
"navigationBarTitleText": "我的仓库",
"enablePullDownRefresh": false
}
},
{
"path": "warehouse/records",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": "操作记录",
"enablePullDownRefresh": false
}
},
{
"path": "warehouse/records",
"style": {
"navigationStyle": "custom",
"navigationBarTitleText": "操作记录",
"enablePullDownRefresh": false
}
},
{
"path": "superLogin/index",
......@@ -352,7 +352,7 @@
{
"path": "parts",
"style": {
"navigationBarTitleText": "备件仓可用的配件"
"navigationBarTitleText": "可用备件"
}
},
{
......
<template>
<view class="det-wrap">
<view class="u-flex det-wrap">
<view class="content">
<scroll-view v-if="lists.length > 0" style="height: 70vh;" scroll-y="true">
<scroll-view v-if="lists.length > 0" style="height: 100%;" scroll-y="true">
<select-parts
v-for="(item, index) in lists"
:key="index"
:info="item"
:show-checked="true"
@numChange="numChange"
@selectChange="selectChange"
@numChange="numChange($event, index)"
@selectChange="selectChange($event, index)"
@apply="apply(index)"
></select-parts>
</scroll-view>
<view v-else class="empty">暂无可用备件</view>
</view>
<view class="bottom" v-if="lists.length > 0">
<button class="btn" @click="submit">
<text class="button-text">保存,继续完工</text>
</button>
<view class="bar">
<submit-bar
:partNum="partNum"
:num="num"
:btnStatus="btnStatus"
:allChecked="allChecked"
@select="allSelect"
@submit="submit"
/>
</view>
</view>
</template>
<script>
import selectParts from "@/components/select-parts/index"
import submitBar from "@/components/submit-bar/index"
export default {
components: {
selectParts
selectParts,
submitBar
},
data() {
return {
......@@ -34,36 +42,81 @@
{
id: 1,
name: "正泰漏保",
desc: 'NO.202006170015',
no: 'NO.202006170015',
desc: '这个空开盒子和其他的空开有什么不一样,这里可以写一下',
num: 1,
min: 1,
max: 100,
img: "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png",
checked: false
checked: false,
disabled: true
},
{
id: 1,
name: "挚达广汽充电桩",
desc: 'NO.202006170014',
no: 'NO.202006170014',
desc: '这个空开盒子和其他的空开有什么不一样,这里可以写一下',
num: 3,
min: 1,
max: 5,
img: "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png",
checked: false
checked: false,
disabled: true
},
{
id: 1,
name: "正泰漏保",
no: 'NO.202006170015NO.202006170015',
desc: '这个充电桩的简介可以写的长一点',
num: 1,
min: 1,
max: 100,
img: "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png",
checked: false,
disabled: false
}
],
val: []
}
},
computed: {
// 配件数
partNum() {
return this.lists.reduce((counter, { checked }) => checked ? counter += 1 : counter, 0)
},
// 总数
num() {
return this.lists.reduce((counter, { checked, num }) => checked ? counter += num : counter, 0)
},
// 按钮状态
btnStatus() {
const count = this.lists.reduce((counter, { checked }) => checked ? counter += 1 : counter, 0)
return count > 0 || false
},
// 全选状态
allChecked() {
const count = this.lists.reduce((counter, { checked }) => !checked ? counter += 1 : counter, 0)
return count === 0 || false
}
},
methods: {
numChange(val) {
console.log("val", val)
apply(index) {
this.$set(this.lists[index], 'disabled', false)
},
numChange(val, index) {
this.$set(this.lists[index], 'num', val)
},
selectChange(val, index) {
this.$set(this.lists[index], 'checked', val)
},
selectChange(val) {
console.log("val", val)
allSelect(value) {
const count = this.lists.filter(v => !v.checked).length
this.lists.forEach(v => {
this.$set(v, 'checked', count !== 0 || false)
})
},
submit() {
console.log("this.val", this.val)
console.log('submit')
}
}
}
......@@ -71,39 +124,23 @@
<style lang="scss" scoped>
.det-wrap {
background: #fff;
flex-flow: column;
height: 100vh;
.content {
border-radius: 12rpx;
background: #fff;
padding: 10rpx;
min-height: 70vh;
}
.empty {
text-align: center;
font-size: 26rpx;
color: #aaa;
}
.bottom {
width: 100%;
padding: 0 40rpx;
font-size: 28rpx;
position: fixed;
bottom: 100rpx;
left: 50%;
margin-left: -50%;
.btn {
padding: 30rpx;
border-radius: 52rpx;
line-height: 44rpx;
font-size: 32rpx;
.empty {
text-align: center;
background-color: #2272ff;
color: #fff;
&::after {
content: '';
height: 0;
border: none;
}
font-size: 26rpx;
color: #aaa;
}
flex: 1;
overflow-y: auto;
}
.bar {
width: 100%;
}
}
</style>
......@@ -4,66 +4,73 @@
<u-search
:clearabled="true"
:action-style="searchStyle"
bg-color="#fff"
@custom="searchParts"
@search="searchParts"
></u-search>
</view>
<view class="categary">
<view class="u-flex u-col-center u-row-around">
<view class="label-title">品类:</view>
<view class="label-content">
<view
v-for="(item, index) in categary"
:key="index"
class="label-item"
<view class="u-flex u-col-center">
<picker mode="selector" :value="categaryIndex" range-key="label" :range="categary" @click="show = true" @change="changeCategary">
<view class="txt">{{categrayName || '请选择'}}</view>
</picker>
<u-icon class="input-icon" color="#2272FF" :name="show ? 'arrow-up' : 'arrow-down'"></u-icon>
</view>
</view>
<view class="warp u-flex">
<view class="brand u-flex">
<view class="label-content u-flex">
<scroll-view
style="width:100%;white-space: nowrap;"
scroll-x="true"
class="u-flex"
:scroll-into-view="scrollId"
>
<view
:class="['label-normal', { selected: item.id === categaryId }]"
@click="changeCategary(item)"
>
<text class="label-text">{{ item.name }}</text>
</view>
</view>
<view :id="`brand${item.id}`" :class="['label-title', { selected: item.id === brandId }]" v-for="(item, index) in brand" :key="index" @click="selectBrand(item)">{{ item.label }}</view>
</scroll-view>
</view>
<view class="more u-flex">
<picker mode="selector" :value="brandIndex" range-key="label" :range="brand" @click="show = true" @change="changeBrand">
<view class="more-text">更多</view>
</picker>
<u-icon class="input-icon" color="#2272FF" name="arrow-right"></u-icon>
</view>
</view>
<view class="u-flex u-col-center u-row-around">
<view class="label-title">品牌:</view>
<view class="label-content">
<view v-for="(item, index) in brand" :key="index" class="label-item">
<view
:class="['label-normal', { selected: item.id === brandId }]"
@click="changeBrand(item)"
>
<text class="label-text">{{ item.name }}</text>
</view>
<view class="lists">
<scroll-view
style="height:100%;"
:scroll-top="scrollTop"
scroll-y="true"
class="scroll-Y"
@scrolltolower="loadMore"
>
<select-parts
v-for="(item, index) in lists"
:key="index"
:info="item"
:show-checked="false"
@numChange="numChange($event, index)"
@apply="apply(index)"
></select-parts>
<view class="load-more">
<u-loadmore :status="loadStatus" @loadmore="loadMore" />
</view>
</view>
</scroll-view>
</view>
</view>
<view class="lists">
<scroll-view
style="height:100%;"
:scroll-top="scrollTop"
scroll-y="true"
class="scroll-Y"
@scrolltolower="loadMore"
>
<uni-list-item
v-for="(item, index) in lists"
:key="index"
:title="item.title"
:note="item.desc"
showArrow
:thumb="item.img"
thumb-size="lg"
:rightText="item.price"
/>
<view class="load-more">
<u-loadmore :status="loadStatus" @loadmore="loadMore" />
</view>
</scroll-view>
<view class="bar">
<submit-bar
:partNum="partNum"
:num="num"
:btnStatus="btnStatus"
:show-checked="false"
submit-txt="去提交"
@submit="submit"
/>
</view>
</view>
</template>
......@@ -72,38 +79,50 @@
const categary = [
{
id: 1,
name: "充电桩",
label: "充电桩",
value: 1,
children: [
{
id: 1,
parentId: 1,
name: "沃尔沃",
label: "沃尔沃",
},
{
id: 2,
parentId: 1,
name: "宝马",
label: "宝马",
},
{
id: 3,
parentId: 1,
name: "奔驰",
label: "奔驰",
},
{
id: 4,
parentId: 1,
label: "奥迪",
},
{
id: 5,
parentId: 1,
label: "保时捷",
},
],
},
{
id: 2,
name: "空调",
label: "空调",
value: 2,
children: [
{
id: 3,
parentId: 2,
name: "美的",
label: "美的",
},
{
id: 4,
parentId: 2,
name: "格力",
label: "格力",
},
],
},
......@@ -111,92 +130,98 @@ const categary = [
const lists = [
{
title: "空开盒子",
desc: "NO.202006060000",
img:
"https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png",
price: "10元",
},
{
title: "空开盒子",
desc: "NO.202006060000",
img:
"https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png",
price: "10元",
},
{
title: "空开盒子",
desc: "NO.202006060000",
img:
"https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png",
price: "10元",
},{
title: "空开盒子",
desc: "NO.202006060000",
img:
"https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png",
price: "10元",
},
{
title: "空开盒子",
desc: "NO.202006060000",
img:
"https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png",
price: "10元",
id: 1,
name: "正泰漏保",
no: 'NO.202006170015',
desc: '这个空开盒子和其他的空开有什么不一样,这里可以写一下',
num: 1,
min: 1,
max: 100,
img: "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png",
checked: false,
disabled: true
},
{
title: "空开盒子",
desc: "NO.202006060000",
img:
"https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png",
price: "10元",
id: 1,
name: "挚达广汽充电桩",
no: 'NO.202006170014',
desc: '这个空开盒子和其他的空开有什么不一样,这里可以写一下',
num: 3,
min: 1,
max: 5,
img: "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png",
checked: false,
disabled: true
},
{
title: "空开盒子",
desc: "NO.202006060000",
img:
"https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png",
price: "10元",
id: 1,
name: "正泰漏保",
no: 'NO.202006170015NO.202006170015',
desc: '这个充电桩的简介可以写的长一点',
num: 1,
min: 1,
max: 100,
img: "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png",
checked: false,
disabled: false
},
{
title: "空开盒子",
desc: "NO.202006060000",
img:
"https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png",
price: "10元",
id: 1,
name: "正泰漏保",
no: 'NO.202006170015NO.202006170015',
desc: '这个充电桩的简介可以写的长一点',
num: 1,
min: 1,
max: 100,
img: "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png",
checked: false,
disabled: false
},
{
title: "空开盒子",
desc: "NO.202006060000",
img:
"https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png",
price: "10元",
id: 1,
name: "正泰漏保",
no: 'NO.202006170015NO.202006170015',
desc: '这个充电桩的简介可以写的长一点',
num: 1,
min: 1,
max: 100,
img: "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png",
checked: false,
disabled: false
},
{
title: "空开盒子",
desc: "NO.202006060000",
img:
"https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png",
price: "10元",
id: 1,
name: "正泰漏保",
no: 'NO.202006170015NO.202006170015',
desc: '这个充电桩的简介可以写的长一点',
num: 1,
min: 1,
max: 100,
img: "https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/460d46d0-4fcc-11eb-8ff1-d5dcf8779628.png",
checked: false,
disabled: false
}
];
import uniList from "@/components/uni-list/uni-list.vue";
import uniListItem from "@/components/uni-list-item/uni-list-item.vue";
import selectParts from "@/components/select-parts/index"
import submitBar from "@/components/submit-bar/index"
export default {
components: {
uniList,
uniListItem,
selectParts,
submitBar
},
data() {
return {
show: false,
categary: categary,
brand: [],
categaryId: "",
brandId: "",
categaryIndex: 0,
brandIndex: 0,
brandId: '',
scrollId: '',
loadStatus: "loadmore",
lists: lists,
size: 10,
size: 5,
page: 1,
count: 1
};
......@@ -204,13 +229,28 @@ export default {
computed: {
searchStyle() {
return {
background: "#2272FF",
color: "#FFFFFF",
padding: "10rpx 20rpx",
width: "110rpx",
"border-radius": "10rpx",
color: "#2272FF"
};
},
categrayName() {
return this.categary[this.categaryIndex].label
},
// 配件数
partNum() {
return this.lists.reduce((counter, { checked }) => checked ? counter += 1 : counter, 0)
},
// 总数
num() {
return this.lists.reduce((counter, { checked, num }) => checked ? counter += num : counter, 0)
},
// 按钮状态
btnStatus() {
const count = this.lists.reduce((counter, { checked }) => checked ? counter += 1 : counter, 0)
return count > 0 || false
}
},
created() {
this.brand = this.categary[0].children
},
methods: {
getPartsList() {
......@@ -231,81 +271,111 @@ export default {
searchParts(val) {
console.log("val", val);
},
changeCategary(item) {
this.categaryId = item.id;
this.brand = item.children || [];
changeCategary(data) {
this.categaryIndex = data.detail.value
this.brand = this.categary[this.categaryIndex].children || []
this.brandIndex = ''
this.show = false
},
changeBrand(item) {
this.brandId = item.id;
changeBrand(data) {
this.brandIndex = data.detail.value
this.brandId = this.brand[this.brandIndex].id
this.scrollId = `brand${this.brandId}`
},
selectBrand(item) {
this.scrollId = ''
this.brandIndex = ''
this.brandId = item.id
},
loadMore() {
if (this.loadStatus !== "nomore") {
this.getPartsList();
}
},
apply(index) {
this.$set(this.lists[index], 'disabled', false)
},
numChange(val, index) {
this.$set(this.lists[index], 'num', val)
},
submit() {
console.log('submit')
}
},
};
</script>
<style lang="scss" scoped>
.content {
background: #fff;
padding: 30rpx;
flex-direction: column;
height: 100vh;
.search {
width: 100%;
padding: 30rpx;
}
.categary {
width: 100%;
padding-top: 40rpx;
.label-title {
width: 100rpx;
padding: 0 30rpx 30rpx;
.txt {
font-size: 32rpx;
color: #333;
font-weight: bold;
margin-right: 15rpx;
}
.label-content {
}
.warp {
border-radius: 30rpx 30rpx 0 0;
padding: 30rpx 30rpx 0 30rpx;
width: 100%;
background: #fff;
flex-direction: column;
align-items: center;
flex: 1;
overflow: hidden;
.brand {
width: 100%;
display: flex;
align-items: center;
overflow-x: auto;
min-height: 104rpx;
flex: 1;
.label-item {
border-bottom: 2rpx solid #F4F5F7;
padding-bottom: 20rpx;
.label-content {
flex: 1;
overflow: hidden;
padding-right: 20rpx;
flex-shrink: 0;
.label-normal {
height: 70rpx;
width: 160rpx;
font-size: 26rpx;
color: #333;
background-color: #fff;
border: 2rpx solid #797979;
border-radius: 8rpx;
padding-left: 30rpx;
padding-right: 30rpx;
text-align: center;
display: flex;
justify-content: center;
align-items: center;
.label-text {
word-break: break-all;
}
border-right: 2rpx solid #F4F5F7;
.label-title {
color:#666;
background: #F4F5F7;
padding: 12rpx 40rpx;
margin-right: 20rpx;
border-radius: 10rpx;
display:inline-block;
&.selected {
color: #fff;
background-color: #2272ff;
border-color: #2272ff;
background: #2272ff;
}
}
}
.more {
width: 100rpx;
padding-left: 20rpx;
.more-text {
color: #2272FF;
font-size: 26rpx;
}
}
}
.lists {
width: 100%;
flex: 1;
overflow-y: auto;
.load-more {
padding: 50rpx 0;
}
}
}
.lists {
.bar {
width: 100%;
flex: 1;
overflow-y: auto;
.load-more {
padding: 50rpx 0;
}
border-top: 2rpx solid #F4F5F7;
}
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment