zhoux пре 2 година
родитељ
комит
e0e50c5fd5
5 измењених фајлова са 205 додато и 141 уклоњено
  1. 21 0
      api/pages/mst/advertisement.js
  2. 2 1
      app.js
  3. 70 38
      pages/home-page/home-page.js
  4. 11 38
      pages/home-page/home-page.wxml
  5. 101 64
      pages/home-page/home-page.wxss

+ 21 - 0
api/pages/mst/advertisement.js

@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright(c) 2024 dongke All rights reserved. / Confidential
+ * 类的信息:
+ *		1.程序名称:
+ *		2.功能描述:广告查询方法
+ * 编辑履历:
+ *		作者				日期					版本				修改内容
+ *		周兴		    2024-4-1     1.00		       	新建
+ *******************************************************************************/
+module.exports = {
+
+  advertisementService: {
+    // 前缀
+    prefix: 'oauth-server/advertisement/',
+  },
+
+  routeUrl: {
+    advertisement: {
+    }
+  }
+};

+ 2 - 1
app.js

@@ -64,10 +64,11 @@ const menuFrequency = require('./api/pages/mst/menuFrequency.js');
 const userMenuFrequency = require('./api/pages/mst/userMenuFrequency.js');
 const comMenu = require('./api/pages/mst/comMenu.js');
 const saleOutBoundReturn = require('./api/pages/ivt/saleOutBoundReturn.js');
+const advertisement = require('./api/pages/mst/advertisement.js');
 
 // api服务路由文件
 var apiList = [common, oauth,setting, company, wechatPay,user, staff, staffRight, staffPurview, settingValue, customer, role, roleFun, org, roleSensitive, goodsBrand, goodsCategory, goodsSeries, unit, supplier, warehouse, saleChannel, goodsSku, basicData,customerMst,purchase,account,
-  receiptPayment,inbound,inboundOther,inboundProcessing,inboundPurchaseReturn,outbound,outboundOther,outboundProcessing,outboundSaleReturn,inventory,moneyAccount,intoReturn,intoReturnItem,cusFollow,order,transfer,income,saleOutBound,inboundReturn,cusReceiptPayment,menuFrequency,userMenuFrequency,comMenu,saleOutBoundReturn]
+  receiptPayment,inbound,inboundOther,inboundProcessing,inboundPurchaseReturn,outbound,outboundOther,outboundProcessing,outboundSaleReturn,inventory,moneyAccount,intoReturn,intoReturnItem,cusFollow,order,transfer,income,saleOutBound,inboundReturn,cusReceiptPayment,menuFrequency,userMenuFrequency,comMenu,saleOutBoundReturn,advertisement]
 
 const util = require('./utils/util.js')
 const baseMethod = require('./api/pages/baseMethod.js')

+ 70 - 38
pages/home-page/home-page.js

@@ -21,9 +21,11 @@ Page({
    * 页面的初始数据
    */
   data: {
+    swiperIndex: 0,
+    advertisementList: [], // 广告数据
     // 分页flg
     pageFlag: false,
-    comMenuList:[],// 常用功能
+    comMenuList: [],// 常用功能
     companyName: '沈阳东科软件有限公司',
     transactionAmount: '¥11,850.00',
     collectionAmount: '¥10,850.00',
@@ -200,37 +202,68 @@ Page({
       },
     ],
   },
+  // 轮播特效果一
+  swiperChange(e) {
+    this.setData({
+      swiperIndex: e.detail.current
+    })
+  },
+  /**
+  * @desc : 查询广告
+  * @author : 周兴
+  * @date : 2024/4/1
+  */
+  getAdvertisement() {
+    let params = {
+      appCode: Constants.APP_CODE,
+    }
+    let service = app.globalData['advertisementService']
+    api.request(service.prefix + service.selectByCond, 'POST', params).then(res => {
+      if (res.data.code == Constants.SUCESS_CODE) {
+        console.log('res', res.data);
+        if(res.data && res.data.data){
+          let advertisementList = res.data.data
+          advertisementList.forEach(it=>{
+            it.adPath = config.image_url + it.adPath
+          })
+          this.setData({
+            advertisementList:advertisementList
+          })
+        }
+      }
+    });
+  },
   /**
   * @desc : 查询常用功能以及频率高的功能
   * @author : 周兴
   * @date : 2024/3/30
   */
- getComMenu() {
-  let staffId = app.globalData.user.staffId;
-  if(!staffId){
-    return;
-  }
-  let params = {
-    staffId: app.globalData.user.staffId,
-    appCode: Constants.APP_CODE,
-  }
-  let service = app.globalData['comMenuService']
-  api.request(service.prefix + service.selectMenu, 'POST', params).then(res => {
-    if (res.data.code == Constants.SUCESS_CODE) {
-      let comMenuList = res.data.data
-      // 增加全部列表
-      let allMenu = {
-        menuUuid:'-1',
-        menuName:'全部应用',
-        objectIcon:'customer.png'
-      }
-      comMenuList.push(allMenu);
-      this.setData({
-        comMenuList: comMenuList,
-      })
+  getComMenu() {
+    let staffId = app.globalData.user.staffId;
+    if (!staffId) {
+      return;
+    }
+    let params = {
+      staffId: staffId,
+      appCode: Constants.APP_CODE,
     }
-  });
-},
+    let service = app.globalData['comMenuService']
+    api.request(service.prefix + service.selectMenu, 'POST', params).then(res => {
+      if (res.data.code == Constants.SUCESS_CODE) {
+        let comMenuList = res.data.data
+        // 增加全部列表
+        let allMenu = {
+          menuUuid: '-1',
+          menuName: '全部应用',
+          objectIcon: 'customer.png'
+        }
+        comMenuList.push(allMenu);
+        this.setData({
+          comMenuList: comMenuList,
+        })
+      }
+    });
+  },
   /**
    * @desc : 跳转到功能页面
    * @author : 于继渤
@@ -239,7 +272,7 @@ Page({
   toApp(e) {
     let item = e.currentTarget.dataset.item
     // 如果点击全部应用跳转到应用页面
-    if(item.menuUuid == '-1'){
+    if (item.menuUuid == '-1') {
       wx.reLaunch({
         url: '/pages/index/index',
       })
@@ -251,13 +284,13 @@ Page({
     let menuList = app.globalData.menus
     if (menuList && menuList.length > 0) {
       // 查看该功能是否有权限
-      let filters = menuList.filter(it=>it.objectCode == (item.objectCode|| item.code));
-      if(filters && filters.length > 0){
+      let filters = menuList.filter(it => it.objectCode == (item.objectCode || item.code));
+      if (filters && filters.length > 0) {
         menuUuid = filters[0].menuUuid
         hasRightFlag = true;
       }
     }
-    if(!hasRightFlag){
+    if (!hasRightFlag) {
       wx.showToast({
         title: "没有该功能权限",
         image: '/static/image/warning.png',
@@ -265,13 +298,13 @@ Page({
       })
       return;
     }
-    console.log('ree',item);
+    console.log('ree', item);
     // 打开页面
-    if(item.objectPath || item.url){
+    if (item.objectPath || item.url) {
       wx.navigateTo({
-        url: item.objectPath?item.objectPath:item.url,
-        success: function(res) {
-          res.eventChannel.emit('params', { formMode:'index',menuUuid:menuUuid })
+        url: item.objectPath ? item.objectPath : item.url,
+        success: function (res) {
+          res.eventChannel.emit('params', { formMode: 'index', menuUuid: menuUuid })
         }
       })
     }
@@ -280,7 +313,6 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onShow: function name(params) {
-    console.log('ffff',app.globalData.comMenuList);
     // 获取常用菜单
     this.getComMenu();
   },
@@ -288,7 +320,6 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-
     let _this = this;
     wx.getSystemInfo({
       success: function (res) {
@@ -298,7 +329,8 @@ Page({
         })
       }
     })
-
+    // 查询广告数据
+    this.getAdvertisement();
     console.log("homepage", options);
     // options 中的 scene  
     if (options.scene) {

+ 11 - 38
pages/home-page/home-page.wxml

@@ -38,46 +38,19 @@
     </view>
   </view>
 
-  <!-- 组合套餐 -->
-  <view class="combined-card" wx:if="{{combinedList && combinedList.length > 0}}">
-    <!-- 顶部 -->
-    <view style="height: 46rpx; padding:26rpx 30rpx; display: flex;align-items: baseline;">
-      <image src="/static/img/zan.png" style="width: 30rpx;height: 30rpx;" />
-      <view class="top-big-text">热销产品</view>
-    </view>
-
-    <!-- 横向滚动 -->
-    <scroll-view scroll-x="true" class="scroll-view">
-      <view class="combined" wx:for="{{combinedList}}" data-item="{{item}}" wx:key="index">
-        <view style="padding: 28rpx;">
-          <view class="combined-imgs-view">
-            <view wx:for="{{item.imageInfo}}" data-item="{{item2}}" wx:for-item="item2" wx:key="index2">
-              <van-image show-error width="125rpx" height="125rpx" radius="15rpx;" src="{{item2.path}}" />
-            </view>
-            <van-image wx:if="{{item.imageInfo.length == 0}}" show-error width="125rpx" height="125rpx" radius="15rpx;" src="" />
-          </view>
-          <view class="combined-name">
-            {{item.priceName}}
-          </view>
-          <view class="combined-detail">
-            {{item.activityNames}}
-          </view>
-          <view class="combined-button-view">
-            <view class="combined-button">
-              搭配价
-              <view style="font-size: 15rpx;margin: 4rpx 0 0 6rpx;">¥</view>
-              <view style="font-size: 29rpx;margin-right: 6rpx;align-items: baseline;margin-bottom: 8rpx;">{{numberFormat.toThousandCents(item.sumPrice)}}</view>起
-              <van-icon name="arrow" size="18rpx" color="#FFFFFF" style="margin: 0 0 4rpx 4rpx;" />
-            </view>
-            <image src="/static/img/cart.png" style="width:40rpx;height:40rpx;" data-promotionType="2" data-item="{{item}}" catchtap="openAddItemInfo" />
-          </view>
-        </view>
-      </view>
-
-    </scroll-view>
+  <!--广告-->
+  <view wx:if="{{advertisementList && advertisementList.length > 0}}">
+    <swiper indicator-dots="{{true}}" autoplay="true" interval="3000" bindchange="swiperChange">
+      <block wx:for="{{advertisementList}}" wx:key="{{index}}" wx:for-item="item">
+        <swiper-item>
+          <image src="{{item.adPath}}" mode="aspectFill" />
+        </swiper-item>
+      </block>
+    </swiper>
   </view>
 
-  <view wx:if="{{combinedList && combinedList.length == 0}}" style="margin-top: 50rpx;"></view>
+
+  <view wx:if="{{advertisementList && advertisementList.length == 0}}" style="margin-top: 50rpx;"></view>
 
   <!-- 功能卡片 -->
 

+ 101 - 64
pages/home-page/home-page.wxss

@@ -2,53 +2,59 @@ page {
   width: 100%;
   margin: 0;
   background: #F8F9FD;
-} 
+}
+
 .head {
-  z-index: 1; 
+  z-index: 1;
   height: 340rpx;
-  width: 100%; 
+  width: 100%;
   background: #A51006;
   position: fixed;
-  top:0;
+  top: 0;
 }
-.company{
+
+.company {
   width: 100%;
   position: absolute;
   left: 40rpx;
   top: 120rpx;
   color: #F8F9FD;
 }
-.current_month_week{ 
+
+.current_month_week {
   width: 80%;
   margin-top: 40rpx;
   font-size: 28rpx;
   display: flex;
-  justify-content:space-around; 
-  align-items: center; 
+  justify-content: space-around;
+  align-items: center;
 }
-.current_month_week_amount{ 
+
+.current_month_week_amount {
   width: 80%;
   margin-top: 20rpx;
   font-size: 28rpx;
   display: flex;
-  justify-content:space-around; 
-  align-items: center; 
+  justify-content: space-around;
+  align-items: center;
 }
-.index-grid-item-text-class{
-  color:#1B365D !important;
+
+.index-grid-item-text-class {
+  color: #1B365D !important;
   font-style: normal;
   font-weight: 400;
-  font-size: 12px; 
+  font-size: 12px;
   color: #1B365D;
 }
-.combined-card{
-  margin:10px 2%;
+
+.combined-card {
+  margin: 10px 2%;
   height: 430rpx;
   background-color: #99A8E4;
   border-radius: 15rpx;
 }
 
-.top-big-text{
+.top-big-text {
   font-family: 'PingFang HK';
   font-style: normal;
   font-weight: 600;
@@ -57,7 +63,8 @@ page {
   color: #FFFFFF;
   margin-left: 18rpx;
 }
-.top-small-text{
+
+.top-small-text {
   font-family: 'PingFang HK';
   font-style: normal;
   font-weight: 400;
@@ -67,11 +74,12 @@ page {
   margin-left: 12rpx;
 }
 
-.card-bottom{
+.card-bottom {
   margin-left: 20rpx;
   margin-top: 10rpx;
 }
-.card-bottom-button{
+
+.card-bottom-button {
   width: 100%;
   /* background: #B7DBFF; */
   height: 70rpx;
@@ -80,7 +88,8 @@ page {
   justify-content: left;
   border-radius: 15rpx;
 }
-.card-bottom-button-font{
+
+.card-bottom-button-font {
   font-family: 'PingFang HK';
   font-style: normal;
   font-weight: 500;
@@ -88,21 +97,22 @@ page {
   color: #1B365D;
 }
 
-.card-bottom-button-blue{
+.card-bottom-button-blue {
   background: #B7DBFF;
   color: #1B365D;
 }
 
-.card-bottom-button-purple{
+.card-bottom-button-purple {
   background: #C3D0FF;
   color: #606EB2;
 }
 
-.scroll-view{
-  white-space: nowrap; 
+.scroll-view {
+  white-space: nowrap;
   display: flex;
 }
-.combined{
+
+.combined {
   background-color: #FFFFFF;
   border-radius: 15rpx;
   display: inline-block;
@@ -110,7 +120,8 @@ page {
   width: 75%;
   margin: 0 30rpx;
 }
-.combined-name{
+
+.combined-name {
   margin-top: 12rpx;
   font-family: 'PingFang HK';
   font-style: normal;
@@ -119,7 +130,8 @@ page {
   line-height: 28rpx;
   color: #1B365D;
 }
-.combined-detail{
+
+.combined-detail {
   font-family: 'PingFang HK';
   font-style: normal;
   font-weight: 400;
@@ -127,12 +139,14 @@ page {
   line-height: 25rpx;
   color: #CAA977;
 }
-.combined-button-view{
+
+.combined-button-view {
   margin-top: 15rpx;
   display: flex;
-  justify-content:flex-end;
+  justify-content: flex-end;
 }
-.combined-button{
+
+.combined-button {
   padding: 4rpx 17rpx 0 17rpx;
   margin-right: 17rpx;
   height: 42rpx;
@@ -148,83 +162,106 @@ page {
   align-items: center;
 }
 
-.combined-imgs-view{
+.combined-imgs-view {
   display: flex;
   align-items: center;
-  justify-content:space-between
-} 
+  justify-content: space-between
+}
 
-.func{
+.func {
   width: 100%;
-  height: 490rpx; 
+  height: 540rpx;
   background: #F8F9FD;
-  border-radius: 40rpx 40rpx 0 0; 
+  border-radius: 40rpx 40rpx 0 0;
+  margin-bottom: 20rpx;
 
 }
-.func-card-blue{
-  margin: 20rpx 10rpx;
+
+.func-card-blue {
+  margin: 20rpx 10rpx 0 10rpx;
   width: 30%;
   height: 240rpx;
   background: linear-gradient(209.99deg, #E6F2FE 14.33%, #D7EAFF 73.85%);
   border-radius: 19rpx;
 }
-.func-card-purple{
+
+.func-card-purple {
   width: 47%;
   height: 198rpx;
   background: linear-gradient(209.99deg, #E2E8FF 14.33%, #D5DDFF 73.85%);
   border-radius: 19rpx;
 }
-.card-title{
-  margin-top:24rpx;
+
+.card-title {
+  margin-top: 24rpx;
   display: flex;
   height: 54rpx;
   align-items: center;
   width: 100%;
   /* justify-content: center; */
 }
-.card-name{
+
+.card-name {
   font-family: 'PingFang HK';
   font-style: normal;
   font-weight: 600;
   font-size: 32rpx;
   line-height: 48rpx;
-  margin-left:16rpx
+  margin-left: 16rpx
 }
-.card-name-blue{
+
+.card-name-blue {
   color: #1B365D;
 }
-.card-name-purple{
+
+.card-name-purple {
   color: #606EB2;
 }
-.icon-arrow{
+
+.icon-arrow {
   width: 32rpx;
-  height:32rpx;
-  border-radius:16rpx;
-  margin-left:20rpx;
+  height: 32rpx;
+  border-radius: 16rpx;
+  margin-left: 20rpx;
   display: flex;
-  justify-content: center; 
+  justify-content: center;
   align-items: center;
 }
-.icon-blue{
-  background-color:#B7DBFF;
+
+.icon-blue {
+  background-color: #B7DBFF;
 }
-.icon-purple{
-  background-color:#C3D0FF;
+
+.icon-purple {
+  background-color: #C3D0FF;
 }
 
-.icon-title{
-  width:76rpx;
-  height:84rpx;
-  margin-top:20rpx;
-  margin-left:20rpx
+.icon-title {
+  width: 76rpx;
+  height: 84rpx;
+  margin-top: 20rpx;
+  margin-left: 20rpx
 }
-.icon-title_diamond{
+
+.icon-title_diamond {
   width: 40rpx;
   height: 40rpx;
   position: absolute;
   left: 5rpx;
-  top: -20rpx; 
+  top: -20rpx;
 }
 
-
- 
+/* 设置swiper组件的宽高 */
+swiper{
+  margin-top: 25rpx;
+  margin-bottom: 0;
+  margin-right: 2vw;
+  margin-left: 2vw;
+  width: 96vw;
+  height: 320rpx;
+}
+/* 设置swiper组件里面图片的宽高 */
+swiper image{
+  width: 100%;
+  height: 320rpx;
+}