k.zhang 3 years ago
parent
commit
da75d1191c

+ 2 - 1
app.json

@@ -8,7 +8,8 @@
     "pages/order/order",
     "pages/search-details/earch-details",
     "pages/friends/friends",
-    "pages/friends-list/friends-list"
+    "pages/friends-list/friends-list",
+    "pages/admin/admin"
   ],
   "window": {
     "backgroundTextStyle": "light",

+ 176 - 0
pages/admin/admin.js

@@ -0,0 +1,176 @@
+// pages/admin/admin.js
+const app = getApp()
+const link = app.globalData.url
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    page:1,
+    pageSize:10,
+    openId:"",
+    userStatus:0,
+    goodsList:[],
+    count:0
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+     //获取金额
+     var that = this
+     that.page = 1
+     that.pageSize = 10
+     that.openId = wx.getStorageSync('openId')
+     that.userStatus = 3
+
+     wx.request( { 
+      url: link + "/v1/forward/lhf", 
+      header: { 
+       "Content-Type": "application/json",
+       "function":"/v1/admin/data"
+      }, 
+      method: "POST",
+      data:  { openId: "" }, 
+      success (res) {
+        console.log(res)
+       
+        that.setData({
+          wallet: res.data.data
+         })
+        
+      }
+     })
+
+
+     wx.request( { 
+      url: link + "/v1/forward/lhf", 
+      header: { 
+       "Content-Type": "application/json",
+       "function":"/v1/user/order/list"
+      }, 
+      method: "POST",
+      data:  { openId: "o0PAf400H9fbwDN6-a8ndU4di0JI",pageIndex:that.page,pageSize: that.pageSize,userStatus:that.userStatus}, 
+      complete: function( res ) { 
+       console.log(res)
+       if( res == null || res.data == null ) { 
+        console.error( '网络请求失败' ); 
+        return; 
+       } 
+       console.log(res.data.data.rows)
+       //that.count = res.data.data.count
+       if (res.data.data.rows.orderInfo == null){
+        that.count = res.data.data.count
+        that.setData({
+          goodsList: res.data.data.rows.orderInfo,
+          lType:"end"
+        })
+       } else{
+        that.count = res.data.data.count
+        that.data.goodsList = res.data.data.rows.orderInfo
+        that.setData({
+          goodsList: that.data.goodsList,
+          lType:"false"
+        })
+       }
+ 
+      } 
+     }) 
+
+
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+    //获取数据
+   var  that = this; 
+
+   if (that.page * that.pageSize >= that.count ){
+    //提示页码到了
+  that.setData({
+    lType:"end"
+  })
+  return
+
+}
+
+   that.page +=1
+
+   
+
+  wx.request( { 
+   url: link + "/v1/forward/lhf", 
+   header: { 
+    "Content-Type": "application/json",
+    "function":"/v1/user/order/list"
+   }, 
+   method: "POST",
+   data:  { openId: "o0PAf400H9fbwDN6-a8ndU4di0JI",pageIndex:that.page,pageSize: that.pageSize,userStatus:that.userStatus}, 
+   complete: function( res ) { 
+    wx.hideLoading();
+    console.log(res)
+    
+    for (var i = 0; i < res.data.data.rows.orderInfo.length; i++) {
+      that.data.goodsList.push( res.data.data.rows.orderInfo[i]);
+    }
+    
+   that.setData({
+    goodsList: that.data.goodsList,
+  })
+
+    console.log(res.data.data.goods_search_response)
+    if( res == null || res.data == null ) { 
+     console.error( '网络请求失败' ); 
+     return; 
+    } 
+   } 
+  }) 
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+
+  }
+})

+ 24 - 0
pages/admin/admin.json

@@ -0,0 +1,24 @@
+{
+ 
+  "usingComponents": {
+    "l-avatar": "/dist/avatar/index",
+    "l-grid-item": "/dist/grid-item/index",
+    "l-grid": "/dist/grid/index",
+    "l-search-bar": "/dist/search-bar/index",
+    "l-icon":"/dist/icon/index",
+    "content-title": "/components/content-title/index",
+    "content-card": "/components/content-card/index",
+    "l-tabs": "/dist/tabs/index",
+    "l-combined-tabs": "/dist/combined-tabs/index",
+    "l-tabpanel": "/dist/tabpanel/index",
+    "l-button":"/dist/button/index",
+    "l-segment":"/dist/segment/index",
+    "l-segment-item":"/dist/segment-item/index",
+    "l-card":"/dist/card/index",
+    "l-tag":"/dist/tag/index",
+    "l-price":"/dist/price/index",
+    "l-notice":"/dist/notice-bar/index",
+    "l-loadmore": "/dist/loadmore/index"
+  },
+  "navigationBarTitleText": "管理员"
+}

+ 67 - 0
pages/admin/admin.wxml

@@ -0,0 +1,67 @@
+<!--pages/admin/admin.wxml-->
+<content-card class="content" name="管理员收益">
+      <view class="view-container">
+        <l-grid>
+          <l-grid-item key="one" slot="one">
+            <view class="num">{{wallet.userNum}}</view>
+            <view class="text">用户总数</view>
+          </l-grid-item>
+          <l-grid-item key="two" slot="two">
+            <view class="num">{{wallet.orderNum}}</view>
+            <view class="text">订单总数</view>
+          </l-grid-item>
+          <l-grid-item key="three" slot="three">
+            <view class="num">{{wallet.adminAmount}}</view>
+            <view class="text">管理员佣金预估</view>
+          </l-grid-item>
+          <l-grid-item key="four" slot="four">
+            <view class="num">{{wallet.platformAmount}}</view>
+            <view class="text">平台佣金预估</view>
+          </l-grid-item>
+          <l-grid-item key="five" slot="five">
+            <view class="num">{{wallet.adminAmountSel}}</view>
+            <view class="text">管理员结算佣金</view>
+          </l-grid-item>
+          <l-grid-item key="six" slot="six">
+            <view class="num">{{wallet.platformAmountSel}}</view>
+            <view class="text">平台结算佣金</view>
+          </l-grid-item>
+        </l-grid>
+      </view>
+    </content-card>
+
+  <view wx:for="{{goodsList}}" wx:key="msg">
+  <l-card  type="primary" l-img-class="right-card" position="left" image="{{item.order.goodsThumbnailUrl}}"
+  bindtap="goodsDetail"  data-sign="{{item.goods_sign}}" data-searchId="{{item.search_id}}"   full="true" >
+
+    <view class="super-long-test">
+      <image class="empty-icon" src="/pages/image/dd.png" ></image>
+      {{item.order.goodsName}}
+    </view>
+
+    <view class="containertag">
+      <l-tag plain="{{true}}" font-color="#d81e06" shape="circle" size="medium"  l-class="tag" class="describe" >总佣金:{{item.amount}}</l-tag>
+      <l-tag plain="{{true}}" font-color="#d81e06" shape="circle" size="medium"  l-class="tag"  class="fanli">实付:{{(item.order.orderAmount)}}</l-tag>
+     
+    </view>
+   
+    <view class="price-v">
+     <text class="price">订单状态:{{item.order.orderStatusDesc}}</text> 
+    </view>
+  
+   <text class="contentcard">
+    订单号:{{item.order.orderSn}}
+   </text>
+   <!-- <text class="contentcard">
+    订单状态:{{item.orderStatusDesc}}
+   </text> -->
+   
+  <text class="contentcard">创建时间:{{item.order.orderCreateTime}}</text>
+  </l-card>
+</view>
+
+<l-loadmore show="{{true}}" end-text="我是有底线的~" type="{{lType}}">
+  <!-- <view slot="content">
+    我是有底线的~
+  </view> -->
+</l-loadmore>

+ 311 - 0
pages/admin/admin.wxss

@@ -0,0 +1,311 @@
+/* pages/admin/admin.wxss */
+.userinfo {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  color: #aaa;
+}
+
+.userinfo-avatar {
+  overflow: hidden;
+  width: 128rpx;
+  height: 128rpx;
+  margin: 20rpx;
+  border-radius: 50%;
+}
+
+.usermotto {
+  margin-top: 200px;
+}
+
+.logo-container {
+  width           : 690rpx;
+  margin          : 30rpx auto;
+  background-color: #fff;
+  display         : flex;
+  flex-direction  : column;
+  align-items     : center;
+  padding         : 40rpx 0;
+  box-sizing      : border-box;
+  margin-bottom   : 30rpx;
+}
+
+.logo-img {
+  width : 220rpx;
+  height: 100rpx;
+}
+
+.logo-txt {
+  color    : #596c8e;
+  font-size: 28rpx;
+}
+
+.version-container {
+  display   : flex;
+  margin-top: 15rpx;
+}
+
+.container {
+  display       : flex;
+  flex-direction: column;
+  align-items   : center;
+}
+
+
+.num {
+  color: #fc6517;
+  font-size: 42rpx;
+  
+}
+
+.text {
+  height: 30rpx;
+  font-size: 22rpx;
+  font-family: PingFangSC-Regular;
+  font-weight: 400;
+  color: rgba(102, 102, 102, 1);
+  line-height: 30rpx;
+  margin-top: 9rpx;
+}
+
+.grid-item {
+  height: 200rpx;
+} 
+
+
+
+.content-name {
+  font-size: 28rpx;
+  font-family: PingFangSC-Regular;
+  font-weight: 400;
+  color: rgba(69, 82, 107, 1);
+  line-height: 20px;
+  margin-left: 8px;
+}
+
+.icon-container{
+  display: flex;
+  flex-direction: row;
+  align-items: center
+}
+
+.city{
+  font-size: 28rpx;
+  color: #333;
+  margin-right: 10rpx;
+}
+
+.aa{
+  margin-top: 20rpx;
+}
+
+.bb{
+  width: 500rpx !important; 
+}
+
+
+.header{
+  position: fixed;
+  top: 0;
+  left: 0;
+}
+
+.content {
+  /* height: 400rpx; */
+  position: relative;
+}
+
+.tab-content {
+  min-height: 140rpx;
+  height: 100%;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  font-size: 28rpx;
+  color: rgba(140, 152, 174, 1);
+}
+
+.toggle-button {
+  position: absolute !important;
+  top: -80rpx;
+  right: 20rpx;
+  min-width: 72rpx !important;
+  padding: 0 !important;
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  border-radius: 50% !important;
+  background: transparent !important;
+}
+
+.swipeable-header {
+  margin: 0 auto;
+  width: 327rpx !important;
+  border: 0 !important;
+}
+
+.swipeable-class-inactive {
+  border-width: 8rpx !important;
+}
+
+.swipeable-class-active {
+  font-weight: 900 !important;
+  font-size: 34rpx !important;
+  border-width: 6rpx !important;
+}
+
+.line-tabs {
+  background: rgba(90, 120, 158, 1) !important;
+}
+
+.tab-image {
+  width: 44rpx !important;
+  height: 44rpx !important;
+}
+
+.line-class {
+  width: 30rpx !important;
+}
+
+
+.card {
+  margin: 10rpx auto !important;
+}
+
+.right-card {
+  height: 250rpx !important;
+  width: 250rpx !important;
+  border-radius: 12rpx !important;
+}
+
+.card-dot {
+  width: 18rpx;
+  height: 18rpx;
+  border-radius: 50%;
+  border: 6rpx solid #3963bc;
+  margin-left: 26rpx;
+}
+
+.card-top {
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  width: 750rpx;
+  height: 100rpx;
+}
+
+
+.contentcard-name {
+  font-size: 28rpx;
+  font-family: PingFangSC-Regular;
+  font-weight: 400;
+  color: rgba(69, 82, 107, 1);
+  line-height: 20px;
+  margin-left: 8px;
+}
+
+.contentcard {
+  margin:5rpx 0rpx 0rpx 0rpx;   
+  color: #666;
+  font-size: 25rpx;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  display: -webkit-box;
+  -webkit-box-orient: vertical;
+  -webkit-line-clamp: 5;
+}
+
+.avter-contentcard {
+  margin-top: 10rpx;
+  color: #333;
+  font-size: 26rpx;
+  overflow: hidden;
+  text-overflow: ellipsis;
+  display: -webkit-box;
+  -webkit-box-orient: vertical;
+  -webkit-line-clamp: 5;
+}
+
+
+.super-long-test{
+  display: -webkit-box;
+ word-break: break-all;
+ text-overflow: ellipsis;
+ font-size: 30rpx;
+ overflow: hidden;
+ -webkit-box-orient: vertical;
+ -webkit-line-clamp:2;
+}
+
+
+.empty-icon{
+  width: 30rpx;
+  height: 30rpx;
+  background-color:rgb(252, 248, 248);
+}
+
+
+.containertag{
+  display: flex;
+  flex-direction: row;
+  align-items: flex-end;
+  flex-wrap: wrap;
+}
+
+.btn{
+  margin-bottom: 5rpx;
+}
+.describe{
+  color: #f4f4f5;
+    font-size: 28rpx;
+    
+}
+
+.fanli{
+  position: absolute;
+  right: 10rpx;
+  
+}
+
+.l-tag {
+  padding: 0 16rpx;
+ 
+  display: inline-flex;
+  align-items: center;
+  justify-content: center;
+  flex-direction: row;
+  color: #fff;
+  background-color: #3963bc;
+  margin-left: 15rpx;
+}
+.tag{
+  margin: 6rpx 15rpx 6rpx 0 !important;
+}
+.price-container{
+  display: flex;
+  flex-direction: row;
+  align-items: center;
+  margin-left: 10rpx;
+}
+
+
+.price{
+  color:#d81e06;
+  font-size: 30rpx;
+ 
+ 
+  position: absolute;
+  
+}
+.yprice{
+  position: absolute;
+  right: 30rpx;
+  color: #999;
+  font-size: 25rpx;
+  text-decoration:line-through;
+
+  
+}
+.price-v{
+  margin:5rpx 0rpx 10rpx 0rpx;   
+}

+ 12 - 1
pages/boutique/outique.js

@@ -117,7 +117,7 @@ Page({
        "function":"/v1/set"
       }, 
       method: "POST",
-      data:  { version: "1.0.4" }, 
+      data:  { version: "1.0.5" }, 
       complete: function( res ) { 
        console.log(res)
        if( res == null || res.data == null ) { 
@@ -191,6 +191,15 @@ Page({
       }
     })
 
+    if (options.goodsSign != undefined){
+      var goodsSign = options.goodsSign
+      var searchId = options.searchId
+      wx.navigateTo({
+        url: `/pages/details/details?goodsSign=${goodsSign}&searchId=${searchId}`,
+       // url: `/pages/goods-detail/index`,
+       })
+    }
+
   },
   search: function(options){
     wx.navigateTo({
@@ -328,6 +337,8 @@ Page({
   goodsDetail:function(e){
     const goodsSign=e.currentTarget.dataset.sign;
     const searchId=e.currentTarget.dataset.searchid;
+
+    console.log(e)
       
       wx.navigateTo({
        url: `/pages/details/details?goodsSign=${goodsSign}&searchId=${searchId}`,

+ 8 - 1
pages/details/details.js

@@ -19,6 +19,9 @@ Page({
     var that=this
     const goodsSign=options.goodsSign
     const searchId=options.searchId
+    that.search_id = options.searchId
+    that.goods_sign = options.goodsSign
+    console.log(options)
     //const pid = "9112489_209622235"
     var pid = "9112489_212035116"
     var opneId = wx.getStorageSync('openId')
@@ -178,12 +181,16 @@ Page({
    * 用户点击右上角分享
    */
   onShareAppMessage: function () {
+    var that = this
     var openId = wx.getStorageSync('openId')
+    var goodsSign = that.goods_sign
+    var searchId = that.search_id
     return {
       title: '电商内部优惠券',
      // imageUrl:"../image/yhq.jpg",
       desc: '优惠券小程序',
-      path: 'pages/boutique/outique?openId=' + openId // 路径,传递参数到指定页面。
+      path: `pages/boutique/outique?openId=${openId}&goodsSign=${goodsSign}&searchId=${searchId}` // 路径,传递参数到指定页面。
+      //url: `/pages/details/details?goodsSign=${goodsSign}&searchId=${searchId}`,
      }
   }
 })

+ 54 - 9
pages/index/index.js

@@ -39,6 +39,41 @@ Page({
     //   text: '扫一扫'
     // }, 
   ],
+  grids2: [{
+    image: 'order',
+    text: '我的订单'
+  }, {
+    image: 'user',
+    text: '好友列表'
+  }, {
+    image: 'help',
+    text: '帮助中心'
+  }, {
+    image: 'add',
+    text: '邀请好友'
+  }, {
+    image: 'to-top',
+    text: '手动同步订单'
+  }, {
+    image: 'customer-service',
+    text: '联系客服'
+  }, {
+    image: 'setting',
+    text: '设置'
+  },
+   {
+    image: 'success',
+    text: '提现'
+  }, 
+  {
+    image: 'phone',
+    text: '管理员'
+  }, 
+  //{
+  //   image: 'scan',
+  //   text: '扫一扫'
+  // }, 
+],
     // grids2: [{
     //   image: 'cart',
     //   text: '我的购物车'
@@ -72,6 +107,7 @@ Page({
     var that = this
     var opneId = wx.getStorageSync('openId')
     var nickName = wx.getStorageSync('nickName')
+    //var admin = wx.getStorageSync('admin')
     if (wx.getUserProfile) {
       this.setData({
         canIUseGetUserProfile: true
@@ -97,7 +133,7 @@ Page({
      }) 
      
      console.log(nickName)
-     if (nickName == ''){
+    //  if (nickName == '' ){
       wx.request( { 
         url: link + "/v1/forward/lhf", 
         header: { 
@@ -108,20 +144,25 @@ Page({
         data:  { openId: opneId }, 
         success (res) {
           console.log(res)
+          var admin = false
           wx.setStorageSync('nickName', res.data.data.user.nickName)  
           wx.setStorageSync('userId', res.data.data.user.id) 
+          if (res.data.data.user.admin == 1){
+            admin = true
+          }
           that.setData({
-            userId: res.data.data.user.id
+            userId: res.data.data.user.id,
+            admin:admin
            })
         }
        }) 
-    } else{
-      var userId = wx.getStorageSync('userId')
-      console.log(userId)
-      that.setData({
-        userId: userId
-       })
-    }
+    // } else{
+    //   var userId = wx.getStorageSync('userId')
+    //   console.log(userId)
+    //   that.setData({
+    //     userId: userId
+    //    })
+    // }
 
 
   },
@@ -184,6 +225,10 @@ Page({
       wx.navigateTo({
         url:"/pages/friends-list/friends-list"
       })
+    } else if (e.detail.cell.text == "管理员"){
+      wx.navigateTo({
+        url:"/pages/admin/admin"
+      })
     }
     
     else {

+ 9 - 1
pages/index/index.wxml

@@ -51,7 +51,15 @@
     </content-card> -->
 
     <content-card class="content" name="功能">
-      <view class="view-container">
+      <view class="view-container" wx:if="{{admin}}">
+        <l-grid show-border="{{true}}">
+          <l-grid-item wx:for="{{grids2}}" wx:key="index" key="{{index}}" slot="{{index}}" bind:linitemtap="getUserProfile" cell="{{item}}" l-grid-item="grid-item">
+            <l-icon name="{{item.image}}" />
+            <view class="text">{{item.text}}</view>
+          </l-grid-item>
+        </l-grid>
+      </view>
+      <view class="view-container" wx:else>
         <l-grid show-border="{{true}}">
           <l-grid-item wx:for="{{grids1}}" wx:key="index" key="{{index}}" slot="{{index}}" bind:linitemtap="getUserProfile" cell="{{item}}" l-grid-item="grid-item">
             <l-icon name="{{item.image}}" />

File diff suppressed because it is too large
+ 1 - 1
pages/search-details/earch-details.js


+ 5 - 12
project.config.json

@@ -20,23 +20,16 @@
     "checkInvalidKey": true,
     "checkSiteMap": true,
     "uploadWithSourceMap": true,
-    "compileHotReLoad": false,
-    "lazyloadPlaceholderEnable": false,
-    "useMultiFrameRuntime": true,
-    "useApiHook": true,
-    "useApiHostProcess": true,
     "babelSetting": {
       "ignore": [],
       "disablePlugins": [],
       "outputPath": ""
     },
-    "enableEngineNative": false,
-    "useIsolateContext": true,
-    "userConfirmedBundleSwitch": false,
-    "packNpmManually": false,
-    "packNpmRelationList": [],
-    "minifyWXSS": true,
-    "showES6CompileOption": false
+    "useCompilerModule": false,
+    "userConfirmedUseCompilerModuleSwitch": false,
+    "useMultiFrameRuntime": true,
+    "useApiHook": true,
+    "useApiHostProcess": true
   },
   "compileType": "miniprogram",
   "libVersion": "2.17.0",