Browse Source

供销社列表 详情

wangzhe 1 year ago
parent
commit
aadb372e45
3 changed files with 52 additions and 52 deletions
  1. 6 14
      api/cooperative/cooperative.js
  2. 22 27
      pages/cooperative/cooperative.vue
  3. 24 11
      pages/cooperative/details.vue

+ 6 - 14
api/cooperative/cooperative.js

@@ -1,26 +1,18 @@
-import upload from '@/utils/upload'
 import request from '@/utils/request'
 
 // 查询合作社列表
-export function getCooperative(query) {
+export function getList(query) {
   return request({
-    url: '/system/cooperative/list',
+    url: '/high/server/cooperative/list',
     method: 'get',
-    params: query
-  })
-}
-export function getCooperative() {
-  return request({
-    url: '/system/user/listAll',
-    method: 'get'
+    params: {}
   })
 }
 
 // 查询合作社详情
-export function updateUserProfile(data) {
+export function getDetails(id) {
   return request({
-    url: '/system/user/profile',
-    method: 'put',
-    data: data
+    url: '/high/server/cooperative/' + id,
+    method: 'get'
   })
 }

+ 22 - 27
pages/cooperative/cooperative.vue

@@ -1,16 +1,16 @@
 <template>
     <view class="container">
         <!-- 供销社列表 -->
-        <view class="rnwdList" @tap="goDetails" v-for="(item, index) in list" :key="index">
-            <view class="cooperativeImgBox">
-                <image :src="loadImgSrc('/snbj.png')" class="cooperativeImg" @tap="goDetails"></image>
+        <view class="rnwdList" v-for="(item, index) in list" :key="index">
+            <view @tap="goDetails(item.id)" class="cooperativeImgBox">
+                <image :src="loadImgSrc('/snbj.png')" class="cooperativeImg"></image>
             </view>
-            <view class="cooperativeBox">
+            <view @tap="goDetails(item.id)" class="cooperativeBox">
                 <view class="list">
                     <span class="listTitle">{{ item.name }}</span>
                     <view class="jlSj">
                         <span class="jf">
-                            {{ item.address }}
+                            {{ item.address?item.address:'' }}
                         </span>
                     </view>
                 </view>
@@ -21,30 +21,17 @@
 </template>
 
 <script>
+import { getList, getDetails } from '@/api/cooperative/cooperative';
 export default {
     data() {
         return {
             list: [
                 {
-                    name:"供销社1",
-                    address:"供销社地址1",
-                    chargePeople:"负责人1",
-                    chargePhone:"13103215236",
-                    imgUrl:"/profile/upload/2024/03/01/nacos_20240301145836A002.png"
-                },
-                {
-                    name:"供销社2",
-                    address:"供销社地址2",
-                    chargePeople:"负责人2",
-                    chargePhone:"09876543210",
-                    imgUrl:"/profile/upload/2024/03/01/nacos_20240301145836A002.png"
-                },
-                {
-                    name:"供销社3",
-                    address:"供销社地址3",
-                    chargePeople:"负责人3",
-                    chargePhone:"12345678910",
-                    imgUrl:"/profile/upload/2024/03/01/nacos_20240301145836A002.png"
+                    name:"-",
+                    address:"-",
+                    chargePeople:"-",
+                    chargePhone:"-",
+                    imgUrl:"-"
                 }
             ],
         };
@@ -53,12 +40,20 @@ export default {
      * 生命周期函数--监听页面加载
      */,
     onLoad(options) {
-
+        this.getList();
     },
     methods: {
-        goDetails() {
+        /** 查询列表 */
+        getList(type) {
+            this.loading = true;
+            getList().then(response => {
+                this.list = response.rows;
+            });
+        },
+        /** 查询详情 */
+        goDetails(id) {
             uni.navigateTo({
-                url: '/pages/cooperative/details'
+                url: '/pages/cooperative/details?id='+id
             });
         }
     }

+ 24 - 11
pages/cooperative/details.vue

@@ -10,7 +10,7 @@
                     {{ item.title }}:
                 </span>
                 <span>
-                    {{ item.content }}
+                    {{ item.content?item.content:'' }}
                 </span>
             </view>
         </view>
@@ -18,31 +18,32 @@
 </template>
 
 <script>
-export default {
+    import { getDetails } from '@/api/cooperative/cooperative';
+    export default {
     data() {
         return {
             list: [
                 {
                     title: "名称",
-                    content: "第十三号供销社",
+                    content: "-",
                 },
                 {
                     title: "地址",
-                    content: "十三号街区地下研究所",
+                    content: "-",
                 },
                 {
                     title: "负责人",
-                    content: "高耀",
+                    content: "-",
                 },
                 {
                     title: "负责人电话",
-                    content: "13178945612",
+                    content: "-",
                 }
             ],
             cooperative: {
-                name:"供销社1",
-                address:"供销社地址1",
-                chargePeople:"负责人1",
+                name:"第十三号供销社",
+                address:"十三号街区地下研究所",
+                chargePeople:"高耀",
                 chargePhone:"13103215236",
                 imgUrl:"/profile/upload/2024/03/01/nacos_20240301145836A002.png"
             }
@@ -52,10 +53,22 @@ export default {
      * 生命周期函数--监听页面加载
      */,
     onLoad(options) {
-        console.log(666)
+        this.getDetails(options.id);
     },
     methods: {
-
+        /** 详情 */
+        getDetails(id) {
+            getDetails(id).then(response => {
+                let details = response.data;
+                console.log(response.data)
+                let list = [];
+                list.push({ title:"名称", content:details.name });
+                list.push({ title:"地址", content:details.address });
+                list.push({ title:"负责人", content:details.chargePeople });
+                list.push({ title:"负责人电话", content:details.chargePhone });
+                this.list = list;
+            });
+        },
     }
 };
 </script>