123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- <template>
- <view class="partList-box">
- <view class="partList-title flex align_center justify_between">
- <text>配件列表</text>
- <view>
- {{list.length}}款,共<text>{{totalNums}}</text>件
- </view>
- </view>
- <view class="partList-list">
- <view class="partList-list-box" v-for="item in partList" :key="item.id">
- <view class="product flex align_center">
- <view class="checkbox"><u-checkbox v-model="item.checked" :name="item.id" @change="checkChange" size="40" shape="circle"></u-checkbox></view>
- <view class="flex align_center flex_1">
- <view class="pimgs">
- <u-image width="128" height="128" border-radius="10"></u-image>
- </view>
- <view class="pinfo">
- <view class="pname">
- {{item.productName}}
- </view>
- <view class="ptxt flex align_center justify_between">
- <view>
- <text class="pcode">{{item.productCode}}</text>
- </view>
- <view>
- 调回数量:<text class="pnums">{{item.qty}}个</text>
- </view>
- </view>
- </view>
- </view>
- </view>
- <view class="ptools flex align_center justify_between">
- <view></view>
- <view class="pcurnums">
- <text>实退数量</text>
- <u-number-box v-model="item.quitQty" :min="1" :max="item.qty"></u-number-box>
- </view>
- </view>
- </view>
- <view class="nodata" v-if="list.length==0">
- <u-empty :src="`/static/${$config('themePath')}/def_no_data@3x.png`" icon-size="120" :text="noDataText" img-width="120" mode="list"></u-empty>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- props: {
- list: {
- type: Array,
- default: function(){
- return []
- }
- },
- noDataText: {
- type: String,
- default: '暂无配件'
- }
- },
- watch: {
- list(newValue, oldValue) {
- newValue.map(item => {
- this.totalNums = this.totalNums + item.qty
- item.quitQty = item.qty
- item.checked = false
- })
- this.partList = JSON.parse(JSON.stringify(newValue))
- }
- },
- data() {
- return {
- partList: this.list,
- totalNums: 0
- }
- },
- methods: {
- // 全选
- allSelect(val){
- this.partList.map(item => {
- item.checked = val
- })
- this.partList.splice()
- },
- checkChange(e){
- const row = this.partList.find(item => item.id == e.name)
- console.log(row.checked)
- if(row){
- row.checked = !row.checked
- this.partList.splice()
- }
- // 判断是否全选
- const isAllNoChecked = this.partList.filter(item => !item.checked)
- this.$emit('allChecked',isAllNoChecked.length == 0)
- }
- }
- }
- </script>
- <style lang="less" scoped>
- .partList-box{
- .nodata{
- padding: 10vh 0;
- }
- .partList-title{
- padding: 20rpx 0;
- > text{
- font-size: 32rpx;
- color: #222222;
- }
- > view{
- font-size: 32rpx;
- text{
- color: red;
- margin: 0 5rpx;
- }
- }
- }
- .partList-list-box{
- padding: 10px 0;
- border-bottom: 2rpx solid #f5f5f5;
- &:last-child{
- border:0;
- }
- .product{
- flex-grow: 1;
- .checkbox{
- width: 60rpx;
- }
- .pinfo{
- flex-grow: 1;
- padding-left: 20rpx;
- .pname{
- font-size: 32rpx;
- color: #191919;
- font-weight: bold;
- margin-bottom: 10rpx;
- }
- .pno{
- background-color: rgba(3, 54, 146, 0.15);
- border-radius: 50rpx;
- padding: 0 20rpx;
- color: #033692;
- font-size: 24rpx;
- margin-right: 10rpx;
- }
- .ptxt{
- font-size: 28rpx;
- color: #999;
- .pnums{
- color: #222;
- }
- }
- }
- }
- .ptools{
- margin-top: 20rpx;
- .pcurnums{
- > text{
- margin-right: 20rpx;
- }
- }
- }
- }
- }
- </style>
|