Browse Source

小程序:首页接口对接

panyong 2 years ago
parent
commit
f0f6063687

+ 14 - 0
htmldev/wxMini/api/common.js

@@ -102,3 +102,17 @@ export const getProductBrandList = () => request({
   method: 'POST',
   showLoading: true
 })
+
+/**
+ * 供应商详情
+ * @param shopId
+ * @returns {Promise<*>}
+ */
+export const getShopDetail = (shopId) => request({
+  url: '/api/user/home/shop/detail',
+  method: 'POST',
+  data: {
+    shop_id: shopId
+  },
+  showLoading: true
+})

+ 1 - 1
htmldev/wxMini/pages/business/business.js

@@ -121,7 +121,7 @@ Page({
     const { item } = e.currentTarget.dataset
 
     wx.navigateTo({
-      url: '/pages/businessDetail/businessDetail?businessId=' + item.id
+      url: '/pages/businessDetail/businessDetail?shop_id=' + item.id
     })
   }
 })

+ 6 - 2
htmldev/wxMini/pages/businessApply/businessApply.js

@@ -1,6 +1,7 @@
 const uploadJS = require('../../mixin/upload.js')
 const { userApplyShop, mockData } = require('./api/index')
 const { isMobile } = require('../../utils/validate')
+const app = getApp()
 
 Page({
 
@@ -26,7 +27,8 @@ Page({
       'shop_remark': '', // 备注
       ...mockData
     },
-    booLock: false
+    booLock: false,
+    userInfo: {}
   },
   tempFormKey: '',
   tempPostData: {},
@@ -48,7 +50,9 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow() {
-
+    this.setData({
+      userInfo: app.globalData.userInfo
+    })
   },
 
   /**

+ 0 - 15
htmldev/wxMini/pages/businessDetail/api/index.js

@@ -1,15 +0,0 @@
-const { request } = require('../../../api/request')
-
-/**
- * 供应商详情
- * @param id
- * @returns {Promise<*>}
- */
-export const getShopDetail = (businessId) => request({
-  url: '/api/user/home/shop/detail',
-  method: 'POST',
-  data: {
-    shop_id: businessId
-  },
-  showLoading: true
-})

+ 3 - 3
htmldev/wxMini/pages/businessDetail/businessDetail.js

@@ -1,5 +1,5 @@
 const pages = require('../../mixin/pages')
-const { getShopDetail } = require('./api/index')
+const { getShopDetail } = require('../../api/common')
 let leftHeight = 0
 let rightHeight = 0
 let query = null
@@ -35,9 +35,9 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad(options) {
-    const { businessId } = options
+    const { shop_id } = options
     this.setData({
-      'searchForm.shop_id': businessId
+      'searchForm.shop_id': shop_id
     }, () => {
       this.fetchShopDetail()
       this.fetchOrderList()

+ 7 - 2
htmldev/wxMini/pages/mine/mine.js

@@ -20,7 +20,11 @@ Page({
     booNickname: false,
     booLogout: false,
     booLock: false,
-    sessionId: ''
+    sessionId: '',
+    userInfo: {
+      // 'shop_status': 0, // 状态(0审核中1审核通过审核失败)
+      // 'user_shop_id': 0 //店铺ID(0代表无店铺)
+    }
   },
 
   /**
@@ -47,7 +51,8 @@ Page({
     this.getTabBar().init()
 
     this.setData({
-      sessionId: wx.getStorageSync(sessionStorageKey)
+      sessionId: wx.getStorageSync(sessionStorageKey),
+      userInfo: app.globalData.userInfo
     })
   },
 

+ 2 - 7
htmldev/wxMini/pages/mine/mine.wxml

@@ -43,7 +43,7 @@
   <view class="main">
     <view
       class="business-account"
-      wx:if="{{true}}">
+      wx:if="{{userInfo === 2}}">
       <image src="../../image/mine/bg.png"></image>
       <view>
         <view class="describe">已有商家账号</view>
@@ -66,7 +66,7 @@
     </view>
     <view
       class="list"
-      wx:if="{{false}}"
+      wx:if="{{userInfo !== 2}}"
       data-page="businessApply"
       bind:tap="jump">
       <image class="label" src="../../image/mine/user.png"></image>
@@ -76,11 +76,6 @@
       class="list"
       data-page="collection"
       bind:tap="jump">
-      <image class="label" src=""></image>
-      <text class="value">农产品收藏</text>
-    </view>
-    <!-- todo -->
-    <view class="list">
       <image class="label" src="../../image/mine/star.png"></image>
       <text class="value">农户收藏</text>
     </view>

+ 1 - 1
htmldev/wxMini/pages/partner/partner.js

@@ -79,7 +79,7 @@ Page({
     const { item } = e.currentTarget.dataset
 
     wx.navigateTo({
-      url: '/pages/businessDetail/businessDetail?businessId=' + item.id
+      url: '/pages/businessDetail/businessDetail?shop_id=' + item.id
     })
   }
 })