agent.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <template>
  2. <view>
  3. <view class="bg-white echo-agent-list">
  4. <block v-for="(item,index) in plist" :key="index">
  5. <view class="flex solid-bottom padding justify-between echo-item" @tap="goDetail(item.id)">
  6. <image class="radius echo-tilpic" mode="aspectFill" :src="item.tilpic"></image>
  7. <view class="echo-content">
  8. <view class="echo-title text-lg text-black text-bold text-cut">{{item.title}}</view>
  9. <view class="echo-tags text-gray text-cut">
  10. <text class="cuIcon-location padding-right-xs"></text> {{item.address}}
  11. </view>
  12. <view class="flex justify-between align-end text-gray">
  13. <view class="echo-wagall">距离:{{item.juli}} Km</view>
  14. </view>
  15. </view>
  16. </view>
  17. </block>
  18. </view>
  19. <view class="padding-tb-lg text-center text-gray">
  20. 线下服务店过多,仅显示附近{{psize}}个门店。
  21. </view>
  22. <!-- <uni-load-more :status="pstatus"></uni-load-more> -->
  23. </view>
  24. </template>
  25. <script>
  26. import uniLoadMore from "@/components/uni-load-more/uni-load-more.vue";
  27. var _this;
  28. export default {
  29. components: {
  30. uniLoadMore
  31. },
  32. data() {
  33. return {
  34. pstatus: 'more',
  35. psize: 5,
  36. plist: [],
  37. lat: 0.00,
  38. lng: 0.00
  39. };
  40. },
  41. onLoad: function(){
  42. _this = this;
  43. uni.getLocation({
  44. type: 'gcj02',
  45. success: function(res) {
  46. _this.lat = res.latitude;
  47. _this.lng = res.longitude;
  48. _this.getMore();
  49. }
  50. });
  51. },
  52. onPullDownRefresh: function() {
  53. _this.pstatus = 'more';
  54. _this.plist = [];
  55. _this.getMore();
  56. },
  57. onShareAppMessage: function(res) {
  58. return {
  59. title: "代理门店",
  60. path: "/pages/agent/agent"
  61. }
  62. },
  63. methods: {
  64. getMore: function() {
  65. _this.$req.ajax({
  66. path: "agent/listagent",
  67. data: {
  68. psize: _this.psize,
  69. lat: _this.lat,
  70. lng: _this.lng
  71. }
  72. }).then((data) => {
  73. _this.pstatus = data.pstatus;
  74. _this.plist = _this.plist.concat(data.plist);
  75. uni.stopPullDownRefresh();
  76. }).catch((err) => {
  77. uni.showModal({
  78. title: '信息提示',
  79. content: err,
  80. showCancel: false
  81. });
  82. });
  83. },
  84. goDetail: function(agentid) {
  85. uni.navigateTo({
  86. url: '/pages/agent/detail?agentid=' + agentid
  87. });
  88. }
  89. }
  90. }
  91. </script>
  92. <style>
  93. </style>