myCollection.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. <template>
  2. <view class="">
  3. <customNav :shownav="true" :title="title" titledetl=""></customNav>
  4. <view class="contentColumnC" style="margin-top: 16rpx;">
  5. <view class="item_content" v-for="(item,index) in mendianList" @click="mendianxuanze(item.id)">
  6. <view class="contentInRowS">
  7. <netImage width="130" height="130" bradius="65" :mysrc="item.logo" mymode="scaleToFill"></netImage>
  8. <view class="contentColumn" style="width:520rpx ;">
  9. <text class="text2row" style="font-size: 30rpx;">{{item.posName}}</text>
  10. <view class="contentInRowS">
  11. <text v-if="item.pingf" style="font-size: 26rpx;color: brown;">{{item.pingf}}分</text>
  12. <text v-if="item.ddsl" style="font-size: 26rpx;color: green;">月售{{item.ddsl}}+</text>
  13. </view>
  14. <view class="contentInRowS">
  15. <text style="font-size: 26rpx;color:dimgrey;">{{item.posPrice}}起送</text>
  16. <text v-if="item.juli" style="font-size: 26rpx;">距离{{item.juli}}Km</text>
  17. </view>
  18. <view class="contentInRowL">
  19. <text class="notTextA" style="font-size: 28rpx;">新客优惠</text>
  20. <text class="notTextA" style="font-size: 28rpx;">超好吃</text>
  21. </view>
  22. </view>
  23. </view>
  24. <view class="">
  25. <scroll-view scroll-view scroll-x="true" >
  26. <view class="item_list">
  27. <view v-for="(item1, index) in item.foodList">
  28. <view class="itemA_content">
  29. <netImage width="130" height="130" :mysrc="item1.image" mymode="scaleToFill"></netImage>
  30. <view class="contentColumnC title">
  31. <text class="text2row" >{{item1.name}}</text>
  32. <text>{{item1.price}}</text>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </scroll-view>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. </template>
  43. <script>
  44. import api from "@/pages/api/api.js"
  45. export default {
  46. components: {},
  47. data() {
  48. return {
  49. title:'',
  50. formData: {
  51. status: 'loading', // 加载状态
  52. },
  53. tipShow: false ,// 是否显示顶部提示框
  54. mendianList:{},
  55. status:'more',
  56. loading:true,
  57. listType:'',
  58. clickable:true,
  59. page:1
  60. };
  61. },
  62. onLoad(option) {
  63. console.log('option',option);
  64. this.listType=option.listType;
  65. if(this.listType==1){
  66. this.title = this.$t('user.wodeshouc');
  67. }
  68. else if(this.listType==2){
  69. this.title = this.$t('user.wodezuji')
  70. }
  71. },
  72. onShow(){
  73. if(this.listType==1){
  74. this.page=1;
  75. this.getcollectlist(1);
  76. }
  77. else if(this.listType==2){
  78. this.page=1;
  79. this.getuserfootlist(1);
  80. }
  81. this.status = 'more';
  82. this.formData.status = 'loading'
  83. },
  84. methods: {
  85. gotoDetail(e){
  86. console.log(e);
  87. uni.navigateTo({
  88. url:'/pages/shanpinxungou/shangjia/merchantdetail?id='+e
  89. })
  90. },
  91. getuserfootlist(page){
  92. this.tipShow = true;
  93. var data={
  94. page:page,
  95. size:10
  96. };
  97. api('getuserfootlist',data,
  98. r=>{
  99. console.log('getuserfootlist:',r);
  100. if(this.page==1){
  101. this.mendianList=r.data.data.records;
  102. }
  103. else{
  104. if(r.data.data.records.length>0){
  105. var temp = this.mendianList;
  106. for(var i=0;i<r.data.data.records.length;i++){
  107. temp.push(r.data.data.records[i]);
  108. }
  109. this.mendianList=temp;
  110. }
  111. else{
  112. this.status = 'noMore';
  113. }
  114. }
  115. uni.stopPullDownRefresh()
  116. this.tipShow = false
  117. },failc=>{
  118. uni.stopPullDownRefresh()
  119. this.tipShow = false
  120. })
  121. },
  122. getcollectlist(page){
  123. this.tipShow = true;
  124. var data={
  125. page:page,
  126. size:10
  127. };
  128. api('getcollectlist',data,
  129. r=>{
  130. console.log('getcollectlist:',r);
  131. if(this.page==1){
  132. this.mendianList=r.data.data.records;
  133. }
  134. else{
  135. if(r.data.data.records.length>0){
  136. var temp = this.mendianList;
  137. for(var i=0;i<r.data.data.records.length;i++){
  138. temp.push(r.data.data.records[i]);
  139. }
  140. this.mendianList=temp;
  141. }
  142. else{
  143. this.status = 'noMore';
  144. }
  145. }
  146. uni.stopPullDownRefresh()
  147. this.tipShow = false
  148. },failc=>{
  149. uni.stopPullDownRefresh()
  150. this.tipShow = false
  151. })
  152. },
  153. },
  154. /**
  155. * 下拉刷新回调函数
  156. */
  157. onPullDownRefresh() {
  158. if(this.listType==1){
  159. this.page=1;
  160. this.getcollectlist(1);
  161. this.status = 'more';
  162. }
  163. else if(this.listType==2){
  164. this.page=1;
  165. this.getuserfootlist(1);
  166. this.status = 'more';
  167. }
  168. this.formData.status = 'loading'
  169. },
  170. /**
  171. * 上拉加载回调函数
  172. */
  173. onReachBottom() {
  174. this.page = this.page+1;
  175. if(this.listType==1){
  176. this.getcollectlist(this.page);
  177. //this.status = 'more';
  178. }
  179. else if(this.listType==2){
  180. this.getuserfootlist(this.page);
  181. //this.status = 'more';
  182. }
  183. },
  184. };
  185. </script>
  186. <style lang="scss">
  187. @import '@/common/uni-ui.scss';
  188. page {
  189. display: flex;
  190. flex-direction: column;
  191. box-sizing: border-box;
  192. background-color: #efeff4;
  193. min-height: 100%;
  194. height: auto;
  195. }
  196. .item_content{
  197. background: white;
  198. width: 660rpx;
  199. margin-bottom: 30rpx;
  200. padding: 16rpx;
  201. border-radius: 16rpx;
  202. }
  203. .item_list{
  204. padding-left: 40rpx;
  205. display: flex;
  206. flex-direction: row;
  207. justify-content: flex-start;
  208. }
  209. .itemA_content{
  210. width: 150rpx;
  211. height: 220rpx;
  212. margin: 16rpx 0;
  213. padding: 14rpx;
  214. box-sizing: border-box;
  215. image{
  216. width: 130rpx;
  217. height:130rpx;
  218. background-color:whitesmoke;
  219. display: block;
  220. }
  221. .title{
  222. width: 100%;
  223. text-align: center;
  224. font-size: 24rpx;
  225. line-height: 30rpx;
  226. padding-top: 4rpx;
  227. }
  228. }
  229. </style>