Parcourir la source

添加详情页
对接列表接口
对接详情接口

lijj il y a 2 ans
Parent
commit
7b5b6c3965

+ 6 - 4
miniapp/api/dish.js

@@ -2,25 +2,27 @@ import http from '@/http/api.js'
 import {bizConst} from './biz/biz.js'
 import {clientId,tenantId} from '@/common/setting'
 
-const getDishList = () => {
+const getDishList = (current, size, vo) => {
 	return http.request({
 		url: bizConst.basicPrefix + '/famous_dish/list',
 		method: 'GET',
 		header: {
 			'Tenant-Id': tenantId
 		},
-		params: {},
+		params: {
+      current, size, ...vo
+    },
 	})
 } 
 
-const getDishDetail = () => {
+const getDishDetail = (id) => {
 	return http.request({
 		url: bizConst.basicPrefix + '/famous_dish/detail',
 		method: 'GET',
 		header: {
 			'Tenant-Id': tenantId
 		},
-		params: {},
+		params: {id},
 	})
 } 
 

+ 35 - 24
miniapp/api/location.js

@@ -1,29 +1,40 @@
 import http from '@/http/api.js'
-import {bizConst} from './biz/biz.js'
-import {clientId,tenantId} from '@/common/setting'
+import {
+  bizConst
+} from './biz/biz.js'
+import {
+  clientId,
+  tenantId
+} from '@/common/setting'
 
-const getLocationList = () => {
-	return http.request({
-		url: bizConst.basicPrefix + '/famous_location/list',
-		method: 'GET',
-		header: {
-			'Tenant-Id': tenantId
-		},
-		params: {},
-	})
-} 
+const getLocationList = (current, size, vo) => {
+  return http.request({
+    url: bizConst.basicPrefix + '/famous_location/list',
+    method: 'GET',
+    header: {
+      'Tenant-Id': tenantId
+    },
+    params: {
+      current,
+      size,
+      ...vo
+    },
+  })
+}
 
-const getLocationDetail = () => {
-	return http.request({
-		url: bizConst.basicPrefix + '/famous_location/detail',
-		method: 'GET',
-		header: {
-			'Tenant-Id': tenantId
-		},
-		params: {},
-	})
-} 
+const getLocationDetail = (id) => {
+  return http.request({
+    url: bizConst.basicPrefix + '/famous_location/detail',
+    method: 'GET',
+    header: {
+      'Tenant-Id': tenantId
+    },
+    params: {
+      id
+    },
+  })
+}
 export default {
-	getLocationList,
+  getLocationList,
   getLocationDetail
-}
+}

+ 6 - 4
miniapp/api/professional_style.js

@@ -2,24 +2,26 @@ import http from '@/http/api.js'
 import {bizConst} from './biz/biz.js'
 import {clientId,tenantId} from '@/common/setting'
 
-const getProfessionalStyleList = () => {
+const getProfessionalStyleList = (current, size, vo) => {
 	return http.request({
 		url: bizConst.basicPrefix + '/professional_style/list',
 		method: 'GET',
 		header: {
 			'Tenant-Id': tenantId
 		},
-		params: {},
+		params: {
+      current, size, ...vo
+    },
 	})
 } 
-const getProfessionalStyleDetail = () => {
+const getProfessionalStyleDetail = (id) => {
 	return http.request({
 		url: bizConst.basicPrefix + '/professional_style/detail',
 		method: 'GET',
 		header: {
 			'Tenant-Id': tenantId
 		},
-		params: {},
+		params: {id},
 	})
 } 
 

+ 32 - 23
miniapp/api/restaurant.js

@@ -1,29 +1,38 @@
 import http from '@/http/api.js'
-import {bizConst} from './biz/biz.js'
-import {clientId,tenantId} from '@/common/setting'
+import {
+  bizConst
+} from './biz/biz.js'
+import {
+  clientId,
+  tenantId
+} from '@/common/setting'
 
-const getRestaurantList = () => {
-	return http.request({
-		url: bizConst.basicPrefix + '/famous_store/list',
-		method: 'GET',
-		header: {
-			'Tenant-Id': tenantId
-		},
-		params: {},
-	})
-} 
+const getRestaurantList = (current, size, vo) => {
+  return http.request({
+    url: bizConst.basicPrefix + '/famous_store/list',
+    method: 'GET',
+    header: {
+      'Tenant-Id': tenantId
+    },
+    params: {
+      current,
+      size,
+      ...vo
+    },
+  })
+}
 const getRestaurantDetail = () => {
-	return http.request({
-		url: bizConst.basicPrefix + '/famous_store/detail',
-		method: 'GET',
-		header: {
-			'Tenant-Id': tenantId
-		},
-		params: {},
-	})
-} 
+  return http.request({
+    url: bizConst.basicPrefix + '/famous_store/detail',
+    method: 'GET',
+    header: {
+      'Tenant-Id': tenantId
+    },
+    params: {},
+  })
+}
 
 export default {
-	getRestaurantList,
+  getRestaurantList,
   getRestaurantDetail
-}
+}

+ 18 - 0
miniapp/pages.json

@@ -17,18 +17,36 @@
         "navigationBarTitleText": "名菜",
         "enablePullDownRefresh": false
       }
+    },{
+      "path": "pages/yuecai/dish/detail/index",
+      "style": {
+        "navigationBarTitleText": "名菜详情",
+        "enablePullDownRefresh": false
+      }
     },{
       "path": "pages/yuecai/location/index",
       "style": {
         "navigationBarTitleText": "名点",
         "enablePullDownRefresh": false
       }
+    },{
+      "path": "pages/yuecai/location/detail/index",
+      "style": {
+        "navigationBarTitleText": "名点详情",
+        "enablePullDownRefresh": false
+      }
     },{
       "path": "pages/yuecai/restaurant/index",
       "style": {
         "navigationBarTitleText": "名店",
         "enablePullDownRefresh": false
       }
+    },{
+      "path": "pages/yuecai/restaurant/detail/index",
+      "style": {
+        "navigationBarTitleText": "名店详情",
+        "enablePullDownRefresh": false
+      }
     },{
       "path": "pages/yuecai/usercenter/index",
       "style": {

+ 35 - 0
miniapp/pages/yuecai/dish/detail/index.vue

@@ -0,0 +1,35 @@
+<template>
+  <page-theme :theme="theme">
+    <template>
+      <view class="f-30 p-40 flex-dir-column flex-x-center">
+        <view>{{detailVO.address}}</view>
+        <view class="col-info-d t-c m-b-30" v-html="detailVO.content"></view>
+      </view>
+    </template>
+  </page-theme>
+</template>
+
+<script>
+  import themeMixins from '@/pages/yuecai/mixins/themeMixins.js';
+  export default {
+    mixins: [themeMixins],
+    data() {
+      return {
+        detailVO: {},
+      }
+    },
+    methods: {
+      getDishDetail(id) {
+        this.$u.api.getDishDetail(id).then(res => {
+          this.detailVO = res.data || {}
+        })
+      }
+    },
+    onLoad(options) {
+      this.getDishDetail(options.id);
+    },
+  }
+</script>
+
+<style scoped lang="scss">
+</style>

+ 73 - 18
miniapp/pages/yuecai/dish/index.vue

@@ -1,16 +1,20 @@
 <template>
-  <page-theme :theme="theme">
-    <template>
-      <u-swiper :list="list1" @click="click"></u-swiper>
-      <view class="f-30 p-40 flex-dir-column flex-x-center">
-        <view class="f-30 p-40 flex-dir-column flex-x-center">
-          <view class="col-info-d t-c m-b-30">其他内容展示</view>
-        </view>
-        <view class="col-info-d t-c m-b-30">搜索框</view>
-        <view class="col-info-d t-c m-b-30">名菜列表</view>
-      </view>
-    </template>
-  </page-theme>
+  <view class="width-100 height-100 view-page">
+    <u-swiper :list="list1" @click="click"></u-swiper>
+    <view class="p-10">
+      <u-search :clearabled="true" placeholder="请输入搜索关键字" v-model="keyword" :shape="square" search="doRefresh" @custom="doRefresh"></u-search>
+    </view>
+    <u-list @scrolltolower="scrolltolower" height="calc(100% - 180px)" lowerThreshold="10">
+      <u-list-item v-for="(item, index) in list" :key="index">
+        <u-cell :title="item.name" @click="toDetail(item.id)">
+          <u-avatar slot="icon" shape="square" size="35" :src="item.cover"
+            customStyle="margin: -3px 5px -3px 0"></u-avatar>
+        </u-cell>
+      </u-list-item>
+      <u-loadmore :status="page.status" :loading-text="page.loadingText" :loadmore-text="page.loadmoreText"
+        :nomore-text="page.nomoreText" />
+    </u-list>
+  </view>
 </template>
 
 <script>
@@ -23,21 +27,72 @@
           'https://cdn.uviewui.com/uview/swiper/swiper1.png',
           'https://cdn.uviewui.com/uview/swiper/swiper2.png',
           'https://cdn.uviewui.com/uview/swiper/swiper3.png',
-        ]
+        ],
+        page: {
+          current: 1,
+          size: 10,
+          total: 0,
+          // loadmore loading nomore
+          status: 'loadmore',
+          loadingText: '正在加载中',
+          loadmoreText: '上拉加载更多',
+          nomoreText: '没有更多了'
+        },
+        keyword: '',
+        list: []
       }
     },
+    onShow() {
+      this.keyword = '';
+      this.doRefresh();
+    },
     methods: {
+      scrolltolower() {
+        this.loadmore()
+      },
+      loadmore() {
+        this.page.current++;
+        this.getDishList();
+      },
+      doRefresh() {
+        this.page.current = 1;
+        this.page.status = 'loadmore'
+        this.list = [];
+        this.getDishList();
+      },
       getDishList() {
-        this.$u.api.getDishList().then(res => {
-          //res.data.records
+
+        if (this.page.status == 'loading' || this.page.status == 'nomore') {
+          // 防止重复下拉
+          return;
+        }
+        this.page.status = 'loading';
+        //
+        this.$u.api.getDishList(this.page.current, this.page.size, {
+          name: this.keyword || ''
+        }).then(res => {
+          if (res.data.records && res.data.records.length > 0) {
+            this.list.push(...res.data.records)
+          }
+          this.page.total = res.data.total || 0;
+          if (this.page.size * this.page.current >= res.data.total) {
+            this.page.status = 'nomore'
+          } else {
+            this.page.status = 'loadmore'
+          }
+        })
+      },
+      toDetail(id) {
+        uni.navigateTo({
+          url: "/pages/yuecai/dish/detail/index?id=" + id,
         })
       }
     },
-    onLoad(options) {
-      this.getDishList();
-    },
   }
 </script>
 
 <style scoped lang="scss">
+  .view-page {
+    overflow: hidden;
+  }
 </style>

+ 2 - 1
miniapp/pages/yuecai/home/index.vue

@@ -22,7 +22,8 @@
         ]
       }
     },
-    methods: {},
+    methods: {
+    },
     onLoad(options) {},
   }
 </script>

+ 35 - 0
miniapp/pages/yuecai/location/detail/index.vue

@@ -0,0 +1,35 @@
+<template>
+  <page-theme :theme="theme">
+    <template>
+      <view class="f-30 p-40 flex-dir-column flex-x-center">
+        <view>{{detailVO.address}}</view>
+        <view class="col-info-d t-c m-b-30" v-html="detailVO.content"></view>
+      </view>
+    </template>
+  </page-theme>
+</template>
+
+<script>
+  import themeMixins from '@/pages/yuecai/mixins/themeMixins.js';
+  export default {
+    mixins: [themeMixins],
+    data() {
+      return {
+        detailVO: {},
+      }
+    },
+    methods: {
+      getLocationDetail() {
+        this.$u.api.getLocationDetail().then(res => {
+          this.detailVO = res.data || {}
+        })
+      }
+    },
+    onLoad(options) {
+      this.getLocationDetail(options.id);
+    },
+  }
+</script>
+
+<style scoped lang="scss">
+</style>

+ 48 - 5
miniapp/pages/yuecai/location/index.vue

@@ -1,9 +1,16 @@
 <template>
   <page-theme :theme="theme">
     <template>
-      <view class="f-30 p-40 flex-dir-column flex-x-center">
+      <view class="f-30 p-t-20 p-b-20">
         <view class="col-info-d t-c m-b-30">搜索框</view>
-        <view class="col-info-d t-c m-b-30">名点列表</view>
+        <u-list @scrolltolower="scrolltolower">
+          <u-list-item v-for="(item, index) in list" :key="index">
+            <u-cell :title="item.name" @click="toDetail(item.id)">
+              <u-avatar slot="icon" shape="square" size="35" :src="item.cover"
+                customStyle="margin: -3px 5px -3px 0"></u-avatar>
+            </u-cell>
+          </u-list-item>
+        </u-list>
       </view>
     </template>
   </page-theme>
@@ -14,10 +21,46 @@
   export default {
     mixins: [themeMixins],
     data() {
-      return {}
+      return {
+        page: {
+          current: 1,
+          size: 10,
+          total: 0
+        },
+        searchKey: '',
+        list: []
+      }
+    },
+    methods: {
+      doSearch() {
+        this.page.current = 1;
+        this.list = [];
+        this.getLocationList();
+      },
+      scrolltolower() {
+        this.loadmore()
+      },
+      loadmore() {
+        this.page.current++;
+        this.getLocationList();
+      },
+      getLocationList() {
+        this.$u.api.getLocationList().then(res => {
+          if (res.data.records && res.data.records.length > 0) {
+            this.list.push(...res.data.records)
+          }
+          this.page.total = res.data.total || 0;
+        })
+      },
+      toDetail(id) {
+        uni.navigateTo({
+          url: "/pages/yuecai/location/detail/index?id=" + id
+        })
+      }
+    },
+    onLoad(options) {
+      this.getLocationList()
     },
-    methods: {},
-    onLoad(options) {},
   }
 </script>
 

+ 35 - 0
miniapp/pages/yuecai/restaurant/detail/index.vue

@@ -0,0 +1,35 @@
+<template>
+  <page-theme :theme="theme">
+    <template>
+      <view class="f-30 p-40 flex-dir-column flex-x-center">
+        <view>{{detailVO.address}}</view>
+        <view class="col-info-d t-c m-b-30" v-html="detailVO.content"></view>
+      </view>
+    </template>
+  </page-theme>
+</template>
+
+<script>
+  import themeMixins from '@/pages/yuecai/mixins/themeMixins.js';
+  export default {
+    mixins: [themeMixins],
+    data() {
+      return {
+        detailVO: {},
+      }
+    },
+    methods: {
+      getRestaurantDetail() {
+        this.$u.api.getRestaurantDetail().then(res => {
+          this.detailVO = res.data || {}
+        })
+      }
+    },
+    onLoad(options) {
+      this.getRestaurantDetail(options.id);
+    },
+  }
+</script>
+
+<style scoped lang="scss">
+</style>

+ 48 - 5
miniapp/pages/yuecai/restaurant/index.vue

@@ -1,9 +1,16 @@
 <template>
   <page-theme :theme="theme">
     <template>
-      <view class="f-30 p-40 flex-dir-column flex-x-center">
+      <view class="f-30 p-t-20 p-b-20">
         <view class="col-info-d t-c m-b-30">搜索框</view>
-        <view class="col-info-d t-c m-b-30">名店列表</view>
+        <u-list @scrolltolower="scrolltolower">
+          <u-list-item v-for="(item, index) in list" :key="index">
+            <u-cell :title="item.name" @click="toDetail(item.id)">
+              <u-avatar slot="icon" shape="square" size="35" :src="item.cover"
+                customStyle="margin: -3px 5px -3px 0"></u-avatar>
+            </u-cell>
+          </u-list-item>
+        </u-list>
       </view>
     </template>
   </page-theme>
@@ -14,10 +21,46 @@
   export default {
     mixins: [themeMixins],
     data() {
-      return {}
+      return {
+        page: {
+          current: 1,
+          size: 10,
+          total: 0
+        },
+        searchKey: '',
+        list: []
+      }
+    },
+    methods: {
+      doSearch() {
+        this.page.current = 1;
+        this.list = [];
+        this.getDishList();
+      },
+      scrolltolower() {
+        this.loadmore()
+      },
+      loadmore() {
+        this.page.current++;
+        this.getDishList();
+      },
+      getRestaurantList() {
+        this.$u.api.getRestaurantList().then(res => {
+          if (res.data.records && res.data.records.length > 0) {
+            this.list.push(...res.data.records)
+          }
+          this.page.total = res.data.total || 0;
+        })
+      },
+      toDetail(id) {
+        uni.navigateTo({
+          url: "/pages/yuecai/restaurant/detail/index?id=" + id
+        })
+      }
+    },
+    onLoad(options) {
+      this.getRestaurantList()
     },
-    methods: {},
-    onLoad(options) {},
   }
 </script>