storeConsumptionOrder.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <script>
  2. import {expenseDetail, expenseList, expensePay} from "../../common/api";
  3. import UCodeInput from "../../components/uview-ui/components/u-code-input/u-code-input.vue";
  4. import {getCustomerInfo} from "../../common/api/user";
  5. export default {
  6. name: "storeConsumptionOrder",
  7. components: { UCodeInput},
  8. data() {
  9. return {
  10. orderNo: '',
  11. goodsList: [
  12. {}, {}
  13. ],
  14. pwd:"",
  15. show: false,
  16. userInfo: {},
  17. customerInfo: {balance_num:0},
  18. detailDataList: [],
  19. pageParams: {
  20. page: 1,
  21. pageSize: 5,
  22. },
  23. topData: {
  24. top: 0,
  25. height: 0
  26. },
  27. }
  28. },
  29. onLoad(options) {
  30. this.orderNo = options.orderNo
  31. console.log(
  32. 'options',
  33. options
  34. )
  35. // const mData = uni.getStorageSync('selectTaskData') || undefined
  36. },
  37. onReachBottom() {
  38. this.expenseDetail()
  39. },
  40. onShow() {
  41. const topData = uni.getMenuButtonBoundingClientRect()
  42. this.topData.top = topData.top
  43. this.topData.height = topData.height
  44. const userInfo = uni.getStorageSync("userInfo");
  45. this.userInfo = JSON.parse(userInfo);
  46. this.expenseDetail(true)
  47. this.getCustomerInfo()
  48. },
  49. methods: {
  50. getCustomerInfo(){
  51. getCustomerInfo().then(res => {
  52. this.customerInfo = res.data||{}
  53. if (this.customerInfo){
  54. this.customerInfo.balance_total = this.customerInfo.balance_total ? parseFloat(this.customerInfo.balance_total) : 0;
  55. this.customerInfo.balance_used = this.customerInfo.balance_used ? parseFloat(this.customerInfo.balance_used) : 0;
  56. this.customerInfo.balance_num = this.customerInfo.balance_total - this.customerInfo.balance_used;
  57. }
  58. })
  59. },
  60. expenseDetail(initFlag) {
  61. if (!initFlag) {
  62. if (this.pageParams.page * this.pageParams.pageSize < this.total) {
  63. this.pageParams.page++
  64. } else {
  65. return
  66. }
  67. } else {
  68. this.pageParams.page = 1
  69. this.total = 0
  70. this.detailDataList = []
  71. }
  72. this.$api.expenseList(this.pageParams).then(res => {
  73. this.detailDataList = res.data.list
  74. this.total = res.data.page.total
  75. })
  76. },
  77. toHome() {
  78. uni.switchTab({
  79. url: '/pages/home/index'
  80. })
  81. },
  82. }
  83. }
  84. </script>
  85. <template>
  86. <view class="common-page">
  87. <view class="header-box" :style="{
  88. paddingTop: '60rpx',
  89. }" id="headerBox" ref="headerBox">
  90. <view class="navbar-box display-flex-content-center" :style="{
  91. height: `${topData.height}px`,
  92. paddingTop: `${topData.top}px`,
  93. paddingBottom: '30rpx',
  94. color: '#666666',
  95. fontSize: '34rpx',
  96. fontWeight: 'bold'
  97. }">
  98. <view @click="toHome" style="position: absolute;left:30rpx">
  99. <u-icon size="20" name="arrow-left" color="#666666"></u-icon>
  100. </view>
  101. <text class="page-title">消费订单</text>
  102. </view>
  103. </view>
  104. <view class="content-box">
  105. <view class="common-card">
  106. <view class="display-flex-center" style="justify-content: space-between;">
  107. <view class="display-flex-center">
  108. <image style="width: 32rpx;height: 32rpx;" :src="require('../static/store-2.png')">
  109. </image>
  110. <text style="margin-left: 16rpx" class="color-333 fs14">账户余额:</text>
  111. </view>
  112. <text style="margin-left: 16rpx" class="color-333 fw700 fs14">¥{{ customerInfo.balance_num }}</text>
  113. </view>
  114. </view>
  115. <view class="common-card">
  116. <view v-for="(item, index) in detailDataList" :key="index">
  117. <view class="display-flex-center" >
  118. <image style="width: 56rpx;height: 56rpx; margin-right: 16rpx" :src="require('../static/store-3.png')">
  119. </image>
  120. <view class="flex-center-column" style="width: 100%">
  121. <text class="color-333 lh20 fs13 fw400" style="width: 100%">消费单号:{{ item.order_no }}</text>
  122. <view class="display-flex-center mt6" style="justify-content: space-between;width: 100%">
  123. <text class="color-888 lh16 fs12 fw400 " >{{ item.created_at }}</text>
  124. <text class="color-333 lh20 fs14 fw400 " >- ¥{{ item.amount_real }}</text>
  125. </view>
  126. </view>
  127. </view>
  128. <u-divider v-if="detailDataList.length>0 && index <(detailDataList.length-1)" :dashed="true"></u-divider>
  129. </view>
  130. </view>
  131. </view>
  132. </view>
  133. </template>
  134. <style lang="scss" scoped>
  135. .page-title{
  136. font-weight: 400;
  137. font-size: 36rpx;
  138. color: #333333;
  139. line-height: 50rpx;
  140. text-align: center;
  141. font-style: normal;
  142. text-transform: none;
  143. }
  144. .common-page {
  145. height: 100vh;
  146. overflow-y: auto;
  147. // padding: 20rpx;
  148. color: #2C2C2C;
  149. padding-bottom: 188rpx;
  150. box-sizing: border-box;
  151. }
  152. .content-box {
  153. padding: 20rpx;
  154. }
  155. .navbar-box {
  156. position: relative;
  157. }
  158. </style>