混了业务逻辑,谨慎观看
html 代码
<view>
<scroll-view :style="{ height: clientHeight + 'px' }" :scroll-top="scrollTop" scroll-y="true"
@scrolltoupper="upper" @scrolltolower="lower" @scroll="scroll">
<checkbox-group @change="checkboxChange">
<view v-for="(item, index) in pendingList" :key="index">
<uni-card :title="item.deliveryCode" :extra="item.dbilldate.substring(0,10)">
<view class="checkbox_collapse">
<checkbox :value="item.checkboxValue" :checked="item.checked" color="#1d99ff" />
<view style="margin-left: 10px;width: 100%;">
<view v-for="(array,index3) in item.detail" :key="index3">
<u-row>
<u-col span="1" v-if="item.detail.length > 1">
{{index3+1}}
u-col>
<u-col span="11">
<view class="uni-body order_detail_product_name">
{{array.materialName}}
{{array.castUnit}}
view>
<view class="uni-body order_detail_product_name">
<text style="color: #5d5d5d;">订单:text>
{{array.saleCode}}
view>
<view class="uni-body order_detail_product_name bottom-border">
<text style="color: #5d5d5d;">单项金额:text>
¥{{array.norigtaxmny}}
view>
u-col>
u-row>
view>
<view class="order_detail">
<view style="color: black;">¥{{item.totalPrice}}view>
view>
view>
view>
uni-card>
view>
checkbox-group>
scroll-view>
<view class="foot_view">
<u-row>
<u-col>
<u-row>
<u-col span="5" class="foot_view_checkbox">
<checkbox-group placement="column" @change="groupChange">
<checkbox :value="allRadio.name" :checked="allRadio.checked" color="#1d99ff"
style="margin-left: 25px;">全选
checkbox>
checkbox-group>
u-col>
<u-col span="9" justify="end">
<view class="foot_view_but_box">
<button type="primary" class="foot_view_but" @click="submitTicket">提交申请button>
view>
u-col>
u-row>
u-col>
u-row>
view>
view>
- 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
JS 代码
export default {
name: "pending",
data() {
return {
pendingList: [],
scrollTop: 0,
allRadio: {
name: '全选',
checked: false
},
selectPending: [],
selectPendingCode: [],
dealerRadio: false,
dealerRadioList: [],
selectDealerRadio: '',
totalAmount: 0,
showDealerRadio: false,
}
},
methods: {
checkboxChange(e) {
this.totalAmount = 0
this.selectPending = []
this.selectPendingCode = []
let dealerList = new Set()
let selectData = e.detail.value
for (var i = 0, lenI = this.pendingList.length; i < lenI; ++i) {
const item = this.pendingList[i]
if (selectData.includes(item.checkboxValue)) {
this.$set(this.pendingList[i], 'checked', true)
} else {
this.$set(this.pendingList[i], 'checked', false)
}
}
var offCarArr = []
this.pendingList.forEach(item => item.whether == true ? offCarArr.push(item) : '')
let allChecks = offCarArr.every(item => item.checked == true)
allChecks ? this.$set(this.allRadio, 'checked', true) : this.$set(this.allRadio, 'checked', false)
for (let ii in selectData) {
this.selectPendingCode.push(selectData[ii])
const temp = selectData[ii].split('-')
for (let i in this.pendingList) {
if (temp[0] === this.pendingList[i].deliveryCode) {
this.totalAmount += this.pendingList[i].totalPrice
for (let j in this.pendingList[i].detail) {
let item = this.pendingList[i].detail[j]
const str = item.invoiceCustCode + '-' + item.invoiceCustName
dealerList.add(str)
}
}
}
}
this.selectPending = [...dealerList]
},
groupChange(n) {
if (n.detail.value.length == 0) {
this.pendingList.map(item => this.$set(item, 'checked', false))
this.$set(this.allRadio, 'checked', false)
this.totalAmount = 0
this.selectPending = []
this.selectPendingCode = []
} else {
for (var i in this.pendingList) {
this.$set(this.pendingList[i], 'checked', true)
}
this.$set(this.allRadio, 'checked', true)
this.totalAmount = 0
this.selectPending = []
this.selectPendingCode = []
let dealerList = new Set()
for (let i in this.pendingList) {
if (this.pendingList[i].checked) {
this.selectPendingCode.push(this.pendingList[i].checkboxValue)
this.totalAmount += this.pendingList[i].totalPrice
for (let j in this.pendingList[i].detail) {
let item = this.pendingList[i].detail[j]
const str = item.invoiceCustCode + '-' + item.invoiceCustName
dealerList.add(str)
}
}
}
this.selectPending = [...dealerList]
}
},
}
}
- 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