123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- <!-- 可开发票订单 -->
- <template>
- <view class="order-box">
- <z-paging ref="paging" v-model="orderList" @query="queryList">
- <view class="order-box-list">
- <view class="order-box-list-item" v-for="(item, index) in orderList" :key="index" @click="radioClick(item)">
- <view class="left">
- <view class="left-radio small-radio">
- <radio value="true" :checked="currentIds.includes(item.id)" />
- </view>
- <view class="right-content">
- <view class="right-content-item">停车订单:{{ item.orderName }}</view>
- <view class="right-content-item">商户名称:{{ item.shopName }}</view>
- <view class="right-content-item">订单时间:{{ item.orderTime }}</view>
- </view>
- </view>
- <view class="right"> ¥{{ item.price }} 元 </view>
- </view>
- </view>
- <view class="order-box-bottom" slot="bottom">
- <view class="order-box-bottom-radio small-radio"> <radio value="true" :checked="checkedAll" @click="checkedChange" />全选 </view>
- <view class="order-box-bottom-next">
- <u-button type="primary" size="medium" :disabled="!currentIds.length" @click="nextStep">下一步</u-button>
- </view>
- </view>
- </z-paging>
- <u-toast ref="uToast" />
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- orderList: [
- { id: 1, orderName: '停车场订单', shopName: '商户名称', orderTime: '2023-06-12 15:00:00', price: 3.0 },
- { id: 2, orderName: '停车场订单', shopName: '商户名称', orderTime: '2023-06-12 15:00:00', price: 3.0 }
- ],
- currentIds: [],
- checkedAll: false
- };
- },
- watch: {
- currentIds(val) {
- this.checkedAll = val.length === this.orderList.length;
- }
- },
- methods: {
- queryList() {
- this.$refs.paging.complete([
- { id: 1, orderName: '停车场订单', shopName: '商户名称', orderTime: '2023-06-12 15:00:00', price: 3.0 },
- { id: 2, orderName: '停车场订单', shopName: '商户名称', orderTime: '2023-06-12 15:00:00', price: 3.0 }
- ]);
- },
- /**
- * @description: 单项条目点击
- * @param {*} item
- * @return {*}
- */
- radioClick(item) {
- if (this.currentIds.includes(item.id)) {
- const index = this.currentIds.indexOf(item.id);
- this.currentIds.splice(index, 1);
- } else {
- this.currentIds.push(item.id);
- }
- },
- /**
- * @description: 全选
- * @return {*}
- */
- checkedChange(item) {
- this.checkedAll = !this.checkedAll;
- this.currentIds = this.checkedAll ? this.orderList.map((item) => item.id) : [];
- },
- /**
- * @description: 下一步
- * @return {*}
- */
- nextStep() {
- if (this.currentIds.length) {
- this.$u.route({
- url: '/pages/invoiceModule/addInvoice/addInvoice',
- params: {
- orderIds: this.currentIds.join(',')
- }
- });
- } else {
- this.$refs.uToast.show({
- title: '请先选择订单',
- type: 'warning'
- });
- }
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- @import './availableOrder.scss';
- </style>
|