Explorar o código

小程序:新增供应商页

panyong %!s(int64=2) %!d(string=hai) anos
pai
achega
5c64c0e573

+ 2 - 2
htmldev/wxMini/README.md

@@ -2,7 +2,7 @@
 
 - [x] 首页 home 12
   - [x] 用户消息 leavingAMessage 4
-  - 供应商 business 4
+  - [x] 供应商 business 4
     - 供应商详情 businessDetail 4
   - 采购指南 guide 6
   - 收藏 collection 4
@@ -10,7 +10,7 @@
   - VR看菜园 VR 4
   - 频道:村长说农货 media 5
     - 视频详情 mediaDetail 2
-- 优秀合作社 cooperative 4
+- 优秀合作社 partner 4
 - 农事天地 news 4
 - 我的 mine 4
 - 商品详情 goodsDetail 8

+ 3 - 2
htmldev/wxMini/app.json

@@ -7,7 +7,8 @@
     "pages/business/business",
     "pages/guide/guide",
     "pages/collection/collection",
-    "pages/news/news"
+    "pages/news/news",
+    "pages/businessDetail/businessDetail"
   ],
   "permission": {
     "scope.userLocation": {
@@ -46,4 +47,4 @@
       }
     ]
   }
-}
+}

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

@@ -3,7 +3,42 @@ Page({
   /**
    * 页面的初始数据
    */
-  data: {},
+  data: {
+    category: [{
+      name: '全部',
+      id: '1'
+    },
+      {
+        name: '分类',
+        id: '2'
+      },
+      {
+        name: '分类',
+        id: '3'
+      },
+      {
+        name: '分类',
+        id: '4'
+      },
+      {
+        name: '分类',
+        id: '5'
+      },
+      {
+        name: '分类',
+        id: '6'
+      }
+    ],
+    currentCategory: '1',
+    pagenum: 0,
+    pagesize: 20,
+    finished: false, // 所有数据是否加载完
+    isRefresh: false, // 是否下拉刷新
+    isFetchLock: false, // 接口调用加锁
+    list: [1],
+    booLock: false
+  },
+  freshing: false,
 
   /**
    * 生命周期函数--监听页面加载
@@ -59,5 +94,14 @@ Page({
    */
   onShareAppMessage() {
 
+  },
+  jumpBusinessDetail(e) {
+    const {
+      item
+    } = e.currentTarget
+
+    wx.navigateTo({
+      url: '/pages/businessDetail/businessDetail?businessId=' + item
+    })
   }
 })

+ 7 - 2
htmldev/wxMini/pages/business/business.json

@@ -1,3 +1,8 @@
 {
-  "usingComponents": {}
-}
+  "usingComponents": {
+    "van-loading": "@vant/weapp/loading/index"
+  },
+  "backgroundTextStyle": "dark",
+  "enablePullDownRefresh": true,
+  "onReachBottomDistance": 50
+}

+ 44 - 0
htmldev/wxMini/pages/business/business.wxml

@@ -0,0 +1,44 @@
+<view class="page-header-search">
+  <view class="page-header-search-warp">
+    <label for="header-search">
+      <image src=""></image>
+    </label>
+    <input placeholder-class="header-search-placeholder" value="" placeholder="搜索信息"></input>
+  </view>
+</view>
+<scroll-view class="nav-wrap" scroll-x="{{true}}">
+  <view class="nav {{currentCategory === item.id ? 'active' : ''}}" wx:for="{{category}}" wx:key="id">
+    <view class="photo">
+      <image src=""></image>
+    </view>
+    <view class="name">{{item.name}}</view>
+  </view>
+</scroll-view>
+<view class="list" wx:for="{{list}}" wx:key="index" data-item="{{item}}" bindtap="jumpBusinessDetail">
+  <view class="item-info">
+    <view class="top">
+      <view class="logo">
+        <image class="" src=""></image>
+      </view>
+      <view class="info">
+        <view class="name">名字名字名字名字名字名字名字名字</view>
+        <view class="goods-count">99999商品 9999999999人关注</view>
+      </view>
+      <button class="contact" type="default">点击联系</button>
+    </view>
+    <view class="bottom">
+      <button type="default">电话:12345678901</button>
+      <button type="default">微信:wxid_drq1i2lrkao22wxid_drq1i2lrkao22wxid_drq1i2lrkao22</button>
+    </view>
+  </view>
+</view>
+  <!-- 无数据 -->
+<view class="list-bitmap" wx:if="{{finished && list.length < 1}}">
+  <image src="system"></image>
+  <text>暂无数据</text>
+</view>
+  <!-- 上拉加载 -->
+<view class="pullup-wrapper" wx:if="{{!isRefresh}}">
+  <van-loading wx:if="{{!finished}}" size="24px" type="spinner">加载中...
+  </van-loading>
+</view>

+ 170 - 0
htmldev/wxMini/pages/business/business.wxss

@@ -0,0 +1,170 @@
+.page-header-search {
+  padding: 20rpx 0 28rpx;
+}
+
+.page-header-search-warp {
+  width: 690rpx;
+}
+
+.nav-wrap {
+  width: 100%;
+  padding-left: 22rpx;
+  border-bottom: 1rpx solid rgba(189, 189, 189, 1);
+  white-space: nowrap;
+}
+
+.nav-wrap .nav {
+  position: relative;
+  left: 0;
+  bottom: 0;
+  display: inline-block;
+  padding: 0 22rpx 24rpx;
+  font-size: 0;
+  color: rgba(145, 179, 121, 1);
+  text-align: center;
+}
+
+.nav-wrap .nav.active {
+  color: rgba(51, 51, 51, 1);
+}
+
+.nav-wrap .nav.active .photo {
+  border: 4rpx solid rgba(145, 179, 121, 1);
+}
+
+.nav-wrap .nav.active:after {
+  position: absolute;
+  left: 50%;
+  bottom: 0;
+  content: '';
+  width: 100%;
+  height: 12rpx;
+  border-radius: 10rpx 10rpx 0 0;
+  background: rgba(145, 179, 121, 1);
+  transform: translateX(-50%);
+}
+
+.nav-wrap .photo {
+  width: 106rpx;
+  height: 106rpx;
+  border-radius: 30rpx;
+  margin: 0 auto;
+  overflow: hidden;
+}
+
+.nav-wrap .photo image {
+  display: block;
+  width: 100%;
+  height: 100%;
+  background-color: pink;
+}
+
+.nav-wrap .name {
+  margin-top: 16rpx;
+  font-size: 24rpx;
+  line-height: 36rpx;
+}
+
+.list {
+  padding: 38rpx 0;
+}
+
+.item-info {
+  width: 690rpx;
+  min-height: 222rpx;
+  padding: 32rpx 16rpx 28rpx 38rpx;
+  margin: 0 auto 20rpx;
+  border-radius: 24rpx;
+  background: rgba(255, 255, 255, 1);
+  box-shadow: 0 4rpx 8rpx 0 rgba(0, 0, 0, 0.1);
+}
+
+.item-info .top {
+  display: flex;
+  justify-content: space-between;
+}
+
+.logo {
+  width: 100rpx;
+  height: 100rpx;
+  border-radius: 5rpx;
+  overflow: hidden;
+}
+
+.logo image {
+  display: block;
+  width: 100%;
+  height: 100%;
+  background-color: pink;
+}
+
+.info {
+  width: 400rpx;
+  padding: 0 20rpx;
+}
+
+.info .name {
+  line-height: 44rpx;
+  font-size: 30rpx;
+  color: rgba(51, 51, 51, 1);
+  word-break: break-all;
+  word-wrap: break-word;
+}
+
+.info .goods-count {
+  margin-top: 22rpx;
+  font-size: 24rpx;
+  line-height: 34rpx;
+  color: rgba(102, 102, 102, 1);
+}
+
+button.contact[type="default"] {
+  width: 136rpx;
+  height: 50rpx;
+  border-radius: 16rpx;
+  border: 2rpx solid rgba(145, 179, 121, 1);
+  line-height: 46rpx;
+  font-size: 24rpx;
+  color: rgba(145, 179, 121, 1);
+  background-color: transparent;
+}
+
+.item-info .bottom {
+  display: flex;
+  align-items: center;
+  margin-top: 24rpx;
+}
+
+.item-info .bottom button[type="default"] {
+  justify-content: flex-start;
+  line-height: 38rpx;
+  font-size: 24rpx;
+  color: rgba(153, 153, 153, 1);
+  background-color: transparent;
+  white-space: nowrap;
+}
+
+.item-info .bottom button[type="default"]:nth-of-type(1) {
+  width: 228rpx;
+}
+
+.item-info .bottom button[type="default"]:nth-of-type(2) {
+  width: calc(100% - 228rpx);
+  padding-left: 84rpx;
+  overflow: hidden;
+  text-overflow: ellipsis;
+}
+
+.pullup-wrapper {
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  width: 100%;
+  height: 50px;
+}
+
+.van-loading__text {
+  color: #969799;
+  font-size: 14px;
+  line-height: 20px;
+}

+ 12 - 11
htmldev/wxMini/pages/home/home.js

@@ -34,10 +34,11 @@ Page({
         path: 'news'
       }
     ],
-    category: [{
-      name: '全部',
-      id: '1'
-    },
+    category: [
+      {
+        name: '全部',
+        id: '1'
+      },
       {
         name: '分类',
         id: '2'
@@ -59,7 +60,7 @@ Page({
         id: '6'
       }
     ],
-    currentCategory: '',
+    currentCategory: '2',
     list: [],
     leftList: [],
     rightList: []
@@ -158,12 +159,12 @@ Page({
     if (Object.prototype.toString.call(item) === '[object Object]' && item.path) {
       const path = item.path
 
-      if (path === 'news') {
-        wx.switchTab({
-          url: `/pages/${path}/${path}`
-        })
-        return
-      }
+      // if (path === 'news') {
+      //   wx.switchTab({
+      //     url: `/pages/${path}/${path}`
+      //   })
+      //   return
+      // }
       wx.navigateTo({
         url: `/pages/${path}/${path}`
       })

+ 2 - 2
htmldev/wxMini/pages/home/home.wxml

@@ -70,7 +70,6 @@
   </view>
   <view class="excellent-goods-title">优秀产品</view>
   <van-tabs
-    class="my-van-tabs"
     active="{{ currentCategory }}"
     color="transparent"
     title-active-color="#FFFFFF"
@@ -80,7 +79,8 @@
     <van-tab
       title="{{item.name}}"
       wx:for="{{category}}"
-      wx:key="id">
+      wx:key="id"
+      name="{{item.id}}">
     </van-tab>
   </van-tabs>
   <!--瀑布流-->

+ 1 - 1
htmldev/wxMini/pages/leavingAMessage/leavingAMessage.wxml

@@ -50,7 +50,7 @@
   <!-- 无数据 -->
   <view class="list-bitmap" wx:if="{{finished && list.length < 1}}">
     <image src="system"></image>
-    <text>暂无发票抬头</text>
+    <text>暂无数据</text>
   </view>
   <!-- 上拉加载 -->
   <view class="pullup-wrapper" wx:if="{{!isRefresh}}">