dingdong-mall/components/goods-card/product-picked.vue

81 lines
2.5 KiB
Vue
Raw Permalink Normal View History

2022-04-23 23:13:29 +08:00
<template>
<view>
<view class="bg-white padding-bottom">
<horizontal-goods-card v-if="product" :ifShowServArea="true" :product="product"></horizontal-goods-card>
<view v-if="columnTitleArr.length" class="flex justify-between margin-tb-sm">
<view class="basis-df">{{columnTitleArr[0]}}</view>
<view class="flex justify-end text-center basis-sm">
2024-03-04 10:03:26 +08:00
<view v-for="(title, index) in columnTitleArr" :key="index" v-if="index >= 1" class="basis-df">{{title}}</view>
2022-04-23 23:13:29 +08:00
</view>
</view>
<view class="certern-height-with-scroll">
<view class="flex justify-between margin-tb-xs align-center" v-for="(item,index) in pickedList" :key="item.id">
<view class='cu-tag padding line-main-color basis-df'>{{item.name}}</view>
<view v-if="numberBox" class="flex justify-end basis-xs">
<uni-number-box :min="0" :max="item.maxPieces" :value="item.pickedNum"
@change="changePiecesNum($event, item)">
</uni-number-box>
2022-05-06 23:50:25 +08:00
</view>
<view v-else-if="item.valColArr && item.valColArr.length > 0" class="flex justify-end basis-sm text-center">
2024-03-04 10:03:26 +08:00
<uni-number-box class="basis-df" v-for="(valCol, index0) in item.valColArr" :key="index0" v-if="valCol.numberBox"
2022-05-06 23:50:25 +08:00
:min="0" :max="valCol.max" :value="valCol.value" @change="changePiecesNum($event, item)">
</uni-number-box>
<view class="basis-df" v-else>{{valCol.value}}</view>
2022-04-23 23:13:29 +08:00
</view>
<view v-else class="flex justify-end basis-sm text-center">
<view class="basis-df"><text v-if="!showToServNum">×</text>{{item.pickedNum}}</view>
<view class="basis-df" v-if="showToServNum">
{{item.toServNum == undefined || item.toServNum == null ? item.secondColumnNum : item.toServNum}}
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import horizontalGoodsCard from '@/components/goods-card/horizontal-goods-card.vue';
export default {
name: "product-picked",
props: {
product: {
type: Object,
default: null
},
pickedList: {
type: Array,
2024-03-04 10:03:26 +08:00
default: () => []
2022-04-23 23:13:29 +08:00
},
columnTitleArr: {
type: Array,
2024-03-04 10:03:26 +08:00
default: () => []
2022-04-23 23:13:29 +08:00
},
showToServNum: {
type: Boolean,
default: false
},
numberBox: {
type: Boolean,
default: false
}
},
components: {
horizontalGoodsCard
},
methods: {
changePiecesNum(curNum, curItem) {
uni.$emit('changePickedNum', curNum, curItem)
}
},
}
</script>
<style scoped>
.certern-height-with-scroll {
max-height: 300rpx;
overflow: scroll;
}
</style>