availableOrder.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <!-- 可开发票订单 -->
  2. <template>
  3. <view class="order-box">
  4. <z-paging ref="paging" v-model="orderList" @query="queryList">
  5. <view class="order-box-list">
  6. <view class="order-box-list-item" v-for="(item, index) in orderList" :key="index" @click="radioClick(item)">
  7. <view class="left">
  8. <view class="left-radio small-radio">
  9. <radio value="true" :checked="currentIds.includes(item.id)" />
  10. </view>
  11. <view class="right-content">
  12. <view class="right-content-item">停车订单:{{ item.orderName }}</view>
  13. <view class="right-content-item">商户名称:{{ item.shopName }}</view>
  14. <view class="right-content-item">订单时间:{{ item.orderTime }}</view>
  15. </view>
  16. </view>
  17. <view class="right"> ¥{{ item.price }} 元 </view>
  18. </view>
  19. </view>
  20. <view class="order-box-bottom" slot="bottom">
  21. <view class="order-box-bottom-radio small-radio"> <radio value="true" :checked="checkedAll" @click="checkedChange" />全选 </view>
  22. <view class="order-box-bottom-next">
  23. <u-button type="primary" size="medium" :disabled="!currentIds.length" @click="nextStep">下一步</u-button>
  24. </view>
  25. </view>
  26. </z-paging>
  27. <u-toast ref="uToast" />
  28. </view>
  29. </template>
  30. <script>
  31. export default {
  32. data() {
  33. return {
  34. orderList: [
  35. { id: 1, orderName: '停车场订单', shopName: '商户名称', orderTime: '2023-06-12 15:00:00', price: 3.0 },
  36. { id: 2, orderName: '停车场订单', shopName: '商户名称', orderTime: '2023-06-12 15:00:00', price: 3.0 }
  37. ],
  38. currentIds: [],
  39. checkedAll: false
  40. };
  41. },
  42. watch: {
  43. currentIds(val) {
  44. this.checkedAll = val.length === this.orderList.length;
  45. }
  46. },
  47. methods: {
  48. queryList() {
  49. this.$refs.paging.complete([
  50. { id: 1, orderName: '停车场订单', shopName: '商户名称', orderTime: '2023-06-12 15:00:00', price: 3.0 },
  51. { id: 2, orderName: '停车场订单', shopName: '商户名称', orderTime: '2023-06-12 15:00:00', price: 3.0 }
  52. ]);
  53. },
  54. /**
  55. * @description: 单项条目点击
  56. * @param {*} item
  57. * @return {*}
  58. */
  59. radioClick(item) {
  60. if (this.currentIds.includes(item.id)) {
  61. const index = this.currentIds.indexOf(item.id);
  62. this.currentIds.splice(index, 1);
  63. } else {
  64. this.currentIds.push(item.id);
  65. }
  66. },
  67. /**
  68. * @description: 全选
  69. * @return {*}
  70. */
  71. checkedChange(item) {
  72. this.checkedAll = !this.checkedAll;
  73. this.currentIds = this.checkedAll ? this.orderList.map((item) => item.id) : [];
  74. },
  75. /**
  76. * @description: 下一步
  77. * @return {*}
  78. */
  79. nextStep() {
  80. if (this.currentIds.length) {
  81. this.$u.route({
  82. url: '/pages/invoiceModule/addInvoice/addInvoice',
  83. params: {
  84. orderIds: this.currentIds.join(',')
  85. }
  86. });
  87. } else {
  88. this.$refs.uToast.show({
  89. title: '请先选择订单',
  90. type: 'warning'
  91. });
  92. }
  93. }
  94. }
  95. };
  96. </script>
  97. <style lang="scss" scoped>
  98. @import './availableOrder.scss';
  99. </style>