storeList.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <template>
  2. <view class="content-store">
  3. <view class="input-search">
  4. <u-search placeholder="请输入店铺名称/电话号码" class="search" :show-action="false" input-align="center" v-model="searchVal" @input="getRow()"></u-search>
  5. </view>
  6. <scroll-view scroll-y class="list" @scrolltolower="onreachBottom">
  7. <view class="list-item flex align_center" v-for="item in list" :key="item.id" @click="addStore(item.id)">
  8. <u-image src="/static/home_shop.png" width="160" height="160"></u-image>
  9. <view class="item-right flex_1 flex justify_between align_center">
  10. <view class="right-item">
  11. <view sty>百果园</view>
  12. <view>18292887584</view>
  13. <view>西安市未央区华帝金座</view>
  14. </view>
  15. <u-icon name="arrow-right" color="#9DA8B5" font-size="30"></u-icon>
  16. </view>
  17. </view>
  18. <view class="nodata" v-if="list.length==0 && status!='loading'">
  19. <u-empty src="/static/def_result.png" :text="noDataText" icon-size="260" ></u-empty>
  20. </view>
  21. <view v-if="index==current" style="padding: 20upx;">
  22. <u-loadmore v-if="total>pageSize || status=='loading'" :status="status" />
  23. </view>
  24. </scroll-view>
  25. <view class="footer" @click="addStore()">
  26. <view class="add-btn flex justify_center align_center">新增店铺</view>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. import { historyOrderQuery } from '@/api/order.js'
  32. export default {
  33. data() {
  34. return {
  35. list: [], // 列表数据
  36. pageNo: 1, // 当前页码
  37. pageSize: 10, // 每页条数
  38. total: 0, // 数据总条数
  39. noDataText: '暂无数据', // 列表请求状态提示语
  40. status: 'loadmore', // 加载中状态
  41. }
  42. },
  43. onLoad() {
  44. this.pageInit()
  45. // 开启分享
  46. uni.showShareMenu({
  47. withShareTicket: true,
  48. menus: ['shareAppMessage', 'shareTimeline']
  49. })
  50. },
  51. methods: {
  52. pageInit() {
  53. this.pageNo = 1
  54. this.pageSize = 10
  55. this.total = 0
  56. this.list = []
  57. this.getRow(1)
  58. },
  59. // 打电话
  60. callPhone(phone) {
  61. uni.makePhoneCall({
  62. phoneNumber: phone
  63. });
  64. },
  65. // 进入详情
  66. intoDetail(item) {
  67. uni.navigateTo({
  68. url: '/pages/order/hisOrderDetail?orderNo='+item.orderReserveNo
  69. })
  70. },
  71. // scroll-view到底部加载更多
  72. onreachBottom() {
  73. this.action = 'onreachBottom'
  74. if (this.list.length < this.total) {
  75. this.pageNo += 1
  76. this.getRow()
  77. } else {
  78. if(this.list.length) {
  79. uni.showToast({
  80. title: '已经到底了',
  81. icon: 'none'
  82. });
  83. }
  84. this.status = "nomore"
  85. }
  86. },
  87. // 查询列表
  88. getRow(pageNo) {
  89. this.status = "loadmore"
  90. if (pageNo) {
  91. this.pageNo = pageNo
  92. }
  93. let params = {
  94. pageNo: this.pageNo,
  95. pageSize: this.pageSize,
  96. }
  97. this.noDataText = '暂无数据'
  98. this.status = "loading"
  99. historyOrderQuery(params).then(res => {
  100. if (res.status == 200) {
  101. if (this.pageNo > 1) {
  102. this.list = this.list.concat(res.data.list || [])
  103. } else {
  104. this.list = res.data.list || []
  105. }
  106. this.total = res.data.count || 0
  107. } else {
  108. this.list = []
  109. this.total = 0
  110. this.noDataText = res.message
  111. }
  112. this.status = "loadmore"
  113. })
  114. },
  115. // 新增店铺
  116. addStore(id){
  117. const storeId=id ? id : ''
  118. uni.navigateTo({
  119. url:`/pages/store/addStore?id={storeId}`
  120. })
  121. }
  122. }
  123. }
  124. </script>
  125. <style lang="less">
  126. .content-store{
  127. width: 100%;
  128. height: 100vh;
  129. background: #F5F5F5;
  130. box-sizing: border-box;
  131. display: flex;
  132. flex-direction: column;
  133. .input-search{
  134. width: 100%;
  135. height: 86upx;
  136. background-color: #fff;
  137. border-bottom: 1px solid #e5e5e5;
  138. // position: fixed;
  139. // top:0;
  140. // left:0;
  141. padding:14upx 32upx ;
  142. .search{
  143. width: 100%;
  144. border-radius: 18px;
  145. }
  146. }
  147. .list{
  148. flex: 1;
  149. .list-item{
  150. padding: 32upx;
  151. background-color: #fff;
  152. .item-right{
  153. margin-left:16upx;
  154. border-bottom: 1px solid #e5e5e5;
  155. .right-item{
  156. height: 160upx;
  157. view{
  158. height: 33%;
  159. }
  160. }
  161. }
  162. }
  163. }
  164. .footer{
  165. width: 100%;
  166. padding: 14upx 32upx 32upx;
  167. background-color: #fff;
  168. color: #fff;
  169. font-weight: 500;
  170. .add-btn{
  171. height: 84upx;
  172. background: #1995FF;
  173. opacity: 1;
  174. border-radius: 16upx;
  175. }
  176. }
  177. }
  178. </style>