index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <template>
  2. <view class="search-page">
  3. <view class="search-wrap">
  4. <view class="search-input">
  5. <input
  6. v-model="searchValue"
  7. type="text"
  8. placeholder="请输入订单编号或手机号码进行查询"
  9. clearable
  10. placeholder-class="input-placeholder"
  11. @input="handInput"
  12. @blur="handSearch"
  13. style="height: 56rpx;background-color: #FFF;font-size: 28rpx;"
  14. :customStyle="inputCustomStyle"
  15. maxlength="50">
  16. </input>
  17. </view>
  18. <u-icon name="search" size="28" color="#6c6c6c" @click="handSearch"></u-icon>
  19. </view>
  20. <view class="result-num">共{{ orderList.length }}个结果</view>
  21. <view class="result-list">
  22. <item v-for="item in orderList" @loadOrder="loadData" :item="item" :key="item.id" />
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. import item from '@/pages/components/order.vue'
  28. import {mapState} from 'vuex';
  29. export default {
  30. components: {
  31. item
  32. },
  33. data () {
  34. return {
  35. listUrl: '/storeOrderApi/getOrderListForStoreSearch',
  36. inputCustomStyle: {
  37. height: '30px',
  38. background: '#fff',
  39. border: 'none'
  40. },
  41. searchValue: '',
  42. orderList: []
  43. }
  44. },
  45. computed: {
  46. ...mapState(['storeInfo'])
  47. },
  48. methods: {
  49. handInput (e) {
  50. this.searchValue = e.detail.value
  51. },
  52. handSearch () {
  53. if (!this.searchValue) {
  54. uni.showToast({
  55. title: "请输入搜索条件",
  56. icon: "none"
  57. })
  58. return
  59. }
  60. this.loadData();
  61. },
  62. loadData() {
  63. var dateStr = (new Date()).getTime();
  64. var sign = this.getSign(dateStr);
  65. uni.showLoading({
  66. title: '加载中'
  67. });
  68. let that = this;
  69. this.requst({
  70. url: this.listUrl,
  71. data: {
  72. timestamp: dateStr,
  73. sign: sign,
  74. storeId: this.storeInfo.storeId,
  75. searchValue2: this.searchValue,
  76. },
  77. success: res => {
  78. if (res.data.rtnBean.rtnCode == 0) {
  79. uni.hideLoading();
  80. this.orderList = res.data.list;
  81. } else {
  82. if (res.data.rtnBean.rtnMsg != '') {
  83. uni.hideLoading();
  84. this.$api.msg(res.data.rtnBean.rtnMsg);
  85. }
  86. }
  87. },
  88. fail: (e) => {
  89. console.log("接口调用失败:" + JSON.stringify(e));
  90. uni.hideLoading();
  91. },
  92. })
  93. },
  94. },
  95. onLoad (opt) {
  96. if (opt.no) {
  97. this.searchValue = opt.no
  98. this.handSearch()
  99. }
  100. }
  101. }
  102. </script>
  103. <style lang="scss" scoped>
  104. /deep/ .input-placeholder {
  105. font-size: 23rpx;
  106. color: #666666
  107. }
  108. .search-page {
  109. background-color: #f5f5f5;
  110. min-height: 100vh;
  111. border-top: 2rpx solid #f5f5f5;
  112. }
  113. .search-wrap {
  114. @include between;
  115. padding: 0 20rpx;
  116. box-sizing: border-box;
  117. margin: 20rpx 0;
  118. .search-input {
  119. height: 60rpx;
  120. flex: 1;
  121. margin-right: 40rpx;
  122. }
  123. }
  124. .result-num {
  125. padding: 0 20rpx;
  126. box-sizing: border-box;
  127. font-size: $font-base;
  128. color: $text-color;
  129. }
  130. </style>