invoiceList.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <template>
  2. <view class="curpage">
  3. <view class="search" style="margin-bottom: 24rpx;">
  4. <u-search placeholder="请输入单号" v-model="keyword" borderColor="#A8A8A8" height="64rpx"></u-search>
  5. </view>
  6. <view class="list" v-for="(item,index) in bill " :key="index">
  7. <view class="content">
  8. <view class="flextop">
  9. <view class="">
  10. 单号 {{item.code}}
  11. </view>
  12. <view class="price">
  13. 订单金额 <text style="font-weight: 700;font-size: 28rpx;margin-left: 10rpx;">¥{{item.amount}}</text>
  14. </view>
  15. </view>
  16. <view class="detail">
  17. <radio color="#1E9F6A" style="font-size: 26rpx;" :checked="item.checked" :value="index"
  18. @click="checkbox(index)"></radio>
  19. <!-- <u-checkbox iconSize=32 style="padding: 0 100rpx;" activeColor="#1E9F6A" :key="index" :name="item.amount"></u-checkbox> -->
  20. <view class="" style="margin-left: 30rpx;">
  21. <view class="" style="font-weight: 700;font-size: 36rpx;">
  22. 夕阳红康养团7日游
  23. </view>
  24. <view class="" style="margin: 24rpx 0;">
  25. 日期:{{item.start_at}} ~ {{item.end_at}}
  26. </view>
  27. <view class="">
  28. 数量 {{item.number}}
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. <view class="navbar">
  35. <view class="navbar-item">
  36. 总金额 ¥{{total}}
  37. </view>
  38. <view class="navbar-item want" @click="choose">
  39. 选择抬头
  40. </view>
  41. </view>
  42. <view v-show="bill.length==0" class="more"><text>暂无更多</text></view>
  43. </view>
  44. </template>
  45. <script>
  46. export default {
  47. data() {
  48. return {
  49. bill: [],
  50. keyword: '',
  51. checkboxValue1: [],
  52. ids:[]
  53. }
  54. },
  55. onUnload(event){ //监听是否跳转页面
  56. if(this.tjzt){
  57. //tjzt为变量
  58. }else{
  59. uni.navigateTo({
  60. url:"/pages/userCenter/invoice"
  61. })
  62. }
  63. },
  64. onLoad() {
  65. this.loadLsit()
  66. },
  67. computed:{
  68. total(){
  69. let allprice=0
  70. this.bill.forEach(item=>{
  71. if(item.checked){
  72. allprice+=Number(item.price)
  73. }
  74. })
  75. return allprice
  76. }
  77. },
  78. methods: {
  79. loadLsit() {
  80. this.$showLoadding("加载中")
  81. uni.$u.http.post('/api/order/bill', {
  82. custom: {
  83. auth: true
  84. }
  85. }).then((res) => {
  86. uni.hideLoading()
  87. let nawarr = res
  88. nawarr.forEach(item => {
  89. item.checked = false
  90. })
  91. this.bill = nawarr
  92. }).catch((err) => {
  93. uni.hideLoading()
  94. console.log(err)
  95. })
  96. },
  97. checkbox(n) {
  98. let data = this.bill
  99. if (data[n].checked) {
  100. data[n].checked = false;
  101. } else {
  102. data[n].checked = true;
  103. }
  104. this.ids=[]
  105. data.forEach(item=>{
  106. if(item.checked){
  107. this.ids.push(item.id)
  108. }
  109. })
  110. console.log('ids',this.ids);
  111. },
  112. // 跳转抬头管理
  113. choose() {
  114. let order={
  115. ids:this.ids,
  116. total:this.total
  117. }
  118. uni.setStorageSync("order",order)
  119. uni.navigateTo({
  120. url: "/pages/invoice/applyInvoice"
  121. })
  122. }
  123. }
  124. }
  125. </script>
  126. <style lang="less">
  127. page {
  128. background-color: #F4F4F4;
  129. font-size: 26rpx;
  130. }
  131. .curpage {
  132. padding: 24rpx 30rpx;
  133. .list {
  134. box-shadow: 0px 2rpx 4rpx 0px rgba(0, 0, 0, 0.02);
  135. border-radius: 8rpx 8rpx 8rpx 32rpx;
  136. background-color: #fff;
  137. margin-bottom: 20rpx;
  138. .flextop {
  139. display: flex;
  140. justify-content: space-between;
  141. border-bottom: 1rpx solid #E3E3E3;
  142. padding: 30rpx;
  143. }
  144. .detail {
  145. padding: 30rpx;
  146. display: flex;
  147. align-items: center;
  148. }
  149. }
  150. .navbar {
  151. display: flex;
  152. font-size: 30rpx;
  153. align-items: center;
  154. bottom: 0;
  155. left: 0;
  156. position: fixed;
  157. width: 100%;
  158. height: 104rpx;
  159. background: #1E9F6A;
  160. border-radius: 16rpx 16rpx 0px 0px;
  161. color: #ffffff;
  162. .navbar-item {
  163. flex: 1;
  164. text-align: center;
  165. }
  166. .want {
  167. border-left: 1rpx solid #FFFFFF;
  168. }
  169. }
  170. }
  171. </style>