邪性 3 年 前
コミット
34fae1fda3
52 ファイル変更547 行追加96 行削除
  1. 21 8
      app.js
  2. 5 1
      app.json
  3. 5 1
      app.less
  4. 4 1
      app.wxss
  5. 24 1
      components/l-container/index.js
  6. 1 2
      components/l-container/index.json
  7. 3 0
      components/l-container/index.less
  8. 7 3
      components/l-container/index.wxml
  9. 3 0
      components/l-container/index.wxss
  10. 37 0
      components/l-notify/index.js
  11. 4 0
      components/l-notify/index.json
  12. 22 0
      components/l-notify/index.less
  13. 7 0
      components/l-notify/index.wxml
  14. 22 0
      components/l-notify/index.wxss
  15. 38 0
      components/l-overlay/index.js
  16. 7 0
      components/l-overlay/index.json
  17. 10 0
      components/l-overlay/index.less
  18. 9 0
      components/l-overlay/index.wxml
  19. 10 0
      components/l-overlay/index.wxss
  20. 58 0
      components/l-share/index.js
  21. 6 0
      components/l-share/index.json
  22. 2 0
      components/l-share/index.wxml
  23. 1 0
      components/l-share/index.wxss
  24. BIN
      images/qrcode.png
  25. 7 8
      node_modules/@vant/weapp/dist/notify/notify.js
  26. 4 5
      pages/adddata/adddata.js
  27. 23 4
      pages/detail/detail.js
  28. 1 1
      pages/detail/detail.wxml
  29. 7 3
      pages/index/index.js
  30. 2 1
      pages/index/index.json
  31. 3 0
      pages/index/index.less
  32. 4 3
      pages/index/index.wxml
  33. 3 0
      pages/index/index.wxss
  34. 38 9
      pages/leave/leave.js
  35. 5 1
      pages/leave/leave.json
  36. 1 1
      pages/leave/leave.less
  37. 6 3
      pages/leave/leave.wxml
  38. 6 6
      pages/leave/leave.wxss
  39. 4 11
      pages/leaveadd/leaveadd.js
  40. 2 0
      pages/leaveadd/leaveadd.less
  41. 2 0
      pages/leaveadd/leaveadd.wxss
  42. 11 9
      pages/login/login.js
  43. 51 3
      pages/order/order.js
  44. 2 1
      pages/order/order.json
  45. 11 0
      pages/order/order.less
  46. 26 4
      pages/order/order.wxml
  47. 11 0
      pages/order/order.wxss
  48. 3 3
      pages/pay/pay.js
  49. 4 1
      pages/pay/pay.wxml
  50. 3 1
      pages/sgin/sgin.js
  51. 1 1
      project.config.json
  52. 0 0
      utils/img.js

+ 21 - 8
app.js

@@ -36,6 +36,7 @@ App({
         app.globalData.axios({
           url: "/account/code2Session/",
           method: "post",
+          token: false,
           data: { code, appid },
           success (res) {
             wx.setStorage({
@@ -59,11 +60,11 @@ App({
       })
     }
     user(this).then(res => login(this)).then(res => {
-      if (!!res) {
-        // this.globalData({})
-        console.log(this.globalData)
-      }
-    }).catch(res => this.globalData.error(res))
+      this.globalData.codeSession = true;
+    }).catch(res => wx.lxd.Notify({
+      message: res,
+      icon: "warn-o"
+    }))
   },
   globalData: {
     // 定义tabber
@@ -94,17 +95,23 @@ App({
       id: null
     },
     // 全局请求方法
-    axios ({ url: _url = '', method: _method = 'post', data: _data = {}, success: _success = () => { }, complete: _complete = () => { } }) {
+    axios ({ url: _url = '', token: _token = true, method: _method = 'post', data: _data = {}, success: _success = () => { }, complete: _complete = () => { } }) {
       let globalurl = "http://192.168.2.45:8887", error = (data) => {
-        console.log(data)
+        wx.lxd.Notify({
+          message: data,
+          icon: "warn-o"
+        })
       };
+      globalurl = "https://lsr.zzly.vip";
+      let header_token = {};
+      if (_token) header_token = { 'Authorization': !wx.getStorageSync('token') ? '' : wx.getStorageSync('token') };
       return new Promise(resolve => {
         wx.request({
           url: globalurl + _url,
           method: _method,
           header: {
             'Content-Type': 'application/x-www-form-urlencoded',
-            'Authorization': !wx.getStorageSync('token') ? '' : wx.getStorageSync('token')
+            ...header_token
           },
           success (res) {
             if (!!res.data.msg) {
@@ -124,5 +131,11 @@ App({
         })
       })
     },
+    // 用户登录状态
+    token () {
+      let state = wx.getStorageSync('token');
+      if (!!state) return true;
+      return false
+    }
   }
 })

+ 5 - 1
app.json

@@ -20,8 +20,12 @@
   },
   "usingComponents": {
     "l-container": "./components/l-container",
+    "l-overlay": "./components/l-overlay",
+    "l-notify": "./components/l-notify",
+    "l-share": "./components/l-share",
     "van-button": "@vant/weapp/button/index",
-    "van-image": "@vant/weapp/image/index"
+    "van-image": "@vant/weapp/image/index",
+    "van-icon": "@vant/weapp/icon/index"
   },
   "sitemapLocation": "sitemap.json"
 }

+ 5 - 1
app.less

@@ -4,10 +4,14 @@ page{
   --themeNavBg: white;
   /* nav可以改动 */
   --themeNavColor1: white;
-  --themeNavBg1: #1989fa;
+  --themeNavBg1: #99CCFF;
   // 容器
   --themeCtrBg:#eee;
   background-color:var(--themeCtrBg);
+  // 成功 失败 警告
+  --themeSuccess:#0c0;
+  --themeDanger:#f03;
+  --themeWarm:#f90;
 }
 .globstyle{
     margin-bottom: 150rpx;

+ 4 - 1
app.wxss

@@ -4,9 +4,12 @@ page {
   --themeNavBg: white;
   /* nav可以改动 */
   --themeNavColor1: white;
-  --themeNavBg1: #1989fa;
+  --themeNavBg1: #99CCFF;
   --themeCtrBg: #eee;
   background-color: var(--themeCtrBg);
+  --themeSuccess: #0c0;
+  --themeDanger: #f03;
+  --themeWarm: #f90;
 }
 .globstyle {
   margin-bottom: 150rpx;

+ 24 - 1
components/l-container/index.js

@@ -1,8 +1,10 @@
+
 // components/l-nav-bar/index.js
 const app = getApp();
 Component({
   attached () { this._init(); this.dom() },
-  pageLifetimes: { show () { this._init(), this.dom(); } },
+  detached: function () { },
+  pageLifetimes: { show () { this._init(), this.tong(); this.dom(); } },
   /**
    * 组件的属性列表
    */
@@ -74,6 +76,27 @@ Component({
       this.setData({
         MarginTop
       })
+    },
+    // 必须执行的函数
+    tong () {
+      // 去除全局方法过慢问题
+      function bugfunc () {
+        if (!!app.globalData.codeSession) return false;
+        wx.lxd.Overlay({
+          show: true,
+          type: 'loading'
+        })
+        const time = setInterval(() => {
+          if (!!app.globalData.codeSession) {
+            clearInterval(time)
+            wx.lxd.HideOverlay();
+            var page = getCurrentPages().pop(); //当前页面
+            if (page == undefined || page == null) return;
+            page.onShow();
+          }
+        }, 100)
+      }
+      bugfunc();
     }
   }
 })

+ 1 - 2
components/l-container/index.json

@@ -4,7 +4,6 @@
     "van-dialog": "@vant/weapp/dialog/index",
     "van-nav-bar": "@vant/weapp/nav-bar/index",
     "van-tabbar": "@vant/weapp/tabbar/index",
-    "van-tabbar-item": "@vant/weapp/tabbar-item/index",
-    "van-icon": "@vant/weapp/icon/index"
+    "van-tabbar-item": "@vant/weapp/tabbar-item/index"
   }
 }

+ 3 - 0
components/l-container/index.less

@@ -1,4 +1,7 @@
 // 默认
+.custom{
+  z-index: 100;
+}
 .nav-custom {
     background-color: var(--themeNavBg);
     .nav-title {

+ 7 - 3
components/l-container/index.wxml

@@ -1,7 +1,11 @@
-<!-- 弹出框 -->
-<van-dialog id="van-dialog" />
+<!-- 加载 -->
+<l-overlay />
+<!-- 消息通知 -->
+<l-notify />
+<!-- 分享栏 -->
+<l-share />
 <!-- 导航栏 -->
-<van-nav-bar custom-class="{{bgc ? 'nav-custom1':'nav-custom'}}" bind:click-left="NavSuccess" fixed="{{fixed}}"
+<van-nav-bar custom-class="custom {{bgc ? 'nav-custom1':'nav-custom'}}" bind:click-left="NavSuccess" fixed="{{fixed}}"
   title-class="nav-title" title="{{title}}">
   <van-icon wx:if='{{back}}' size="24" name="arrow-left" slot="left" />
 </van-nav-bar>

+ 3 - 0
components/l-container/index.wxss

@@ -1,3 +1,6 @@
+.custom {
+  z-index: 100;
+}
 .nav-custom {
   background-color: var(--themeNavBg);
 }

+ 37 - 0
components/l-notify/index.js

@@ -0,0 +1,37 @@
+Component({
+  attached () { this._init(); },
+  pageLifetimes: { show () { this._init() } },
+  properties: {
+
+  },
+
+  /**
+   * 组件的初始数据
+   */
+  data: {
+    durations: { enter: 300, leave: 1000 },
+    time: 3000,
+  },
+
+  /**
+   * 组件的方法列表
+   */
+  methods: {
+    // 定义调用组件的js方法
+    _init () {
+      wx.lxd = wx.lxd || {}, wx.lxd.Notify = e => {
+        e.show = true;
+        console.warn(e)
+        this.setData({
+          ...e
+        })
+        if (!!e.show) {
+          const time = setTimeout(() => {
+            this.setData({ show: false })
+            clearTimeout(time)
+          }, this.data.time)
+        }
+      }
+    },
+  }
+})

+ 4 - 0
components/l-notify/index.json

@@ -0,0 +1,4 @@
+{
+  "component": true,
+  "usingComponents": {}
+}

+ 22 - 0
components/l-notify/index.less

@@ -0,0 +1,22 @@
+/* components/l-notify/index.wxss */
+.box{
+  position: fixed;
+  width: 100%;
+  z-index: 10;
+  background-color: #fff;
+}
+.container{
+  width: 100%;
+  text-align: center;
+  color: #fff;
+  padding: 10rpx 5rpx;
+}
+.success{
+  background-color: var(--themeSuccess);
+}
+.warm{
+  background-color: var(--themeWarm);
+}
+.danger{
+  background-color: var(--themeDanger);
+}

+ 7 - 0
components/l-notify/index.wxml

@@ -0,0 +1,7 @@
+<view hidden="{{!show}}" class="box">
+  <van-transition name="slide-down" show="{{ show }}" duration="{{ durations }}">
+    <view class="container {{type=='success' ? 'success' : type=='warm' ? 'warm' : 'danger'}}">
+      <van-icon name="{{icon}}" />{{message}}
+    </view>
+  </van-transition>
+</view>

+ 22 - 0
components/l-notify/index.wxss

@@ -0,0 +1,22 @@
+/* components/l-notify/index.wxss */
+.box {
+  position: fixed;
+  width: 100%;
+  z-index: 10;
+  background-color: #fff;
+}
+.container {
+  width: 100%;
+  text-align: center;
+  color: #fff;
+  padding: 10rpx 5rpx;
+}
+.success {
+  background-color: var(--themeSuccess);
+}
+.warm {
+  background-color: var(--themeWarm);
+}
+.danger {
+  background-color: var(--themeDanger);
+}

+ 38 - 0
components/l-overlay/index.js

@@ -0,0 +1,38 @@
+// components/l-overlay/index.js
+Component({
+  attached () { this._init(); },
+  pageLifetimes: { show () { this._init() } },
+  properties: {
+
+  },
+
+  /**
+   * 组件的初始数据
+   */
+  data: {
+    hide: false
+  },
+  /**
+   * 组件的方法列表
+   */
+  methods: {
+    // 定义调用组件的js方法
+    _init () {
+      wx.lxd = wx.lxd || {}, wx.lxd.Overlay = e => {
+        // tabber
+        this.setData({
+          //  app.js 固定定义
+          // 页面传参
+          ...e,
+        })
+      }
+      wx.lxd = wx.lxd || {}, wx.lxd.HideOverlay = () => {
+        this.setData({ show: false })
+      }
+    },
+    // 隐藏函数
+    hidefunc () {
+      this.setData({ show: false })
+    }
+  }
+})

+ 7 - 0
components/l-overlay/index.json

@@ -0,0 +1,7 @@
+{
+  "component": true,
+  "usingComponents": {
+    "van-overlay": "@vant/weapp/overlay/index",
+    "van-loading": "@vant/weapp/loading/index"
+  }
+}

+ 10 - 0
components/l-overlay/index.less

@@ -0,0 +1,10 @@
+.wrapper {
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  height: 100%;
+  .loading{
+    text-align: center;
+    color: #fff;
+  }
+}

+ 9 - 0
components/l-overlay/index.wxml

@@ -0,0 +1,9 @@
+<van-overlay show="{{ show }}" bind:click="{{hide ? 'hidefunc' : ''}}">
+  <!-- loading类型 -->
+  <view class="wrapper">
+    <view wx:if="{{type=='loading'}}" class="loading">
+      <van-loading type="spinner" />
+      <view class="load">加载中...</view>
+    </view>
+  </view>
+</van-overlay>

+ 10 - 0
components/l-overlay/index.wxss

@@ -0,0 +1,10 @@
+.wrapper {
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  height: 100%;
+}
+.wrapper .loading {
+  text-align: center;
+  color: #fff;
+}

+ 58 - 0
components/l-share/index.js

@@ -0,0 +1,58 @@
+// components/l-share/index.js
+import { wechat, qrcode } from '../../utils/img';
+Component({
+  attached () { this._init(); },
+  pageLifetimes: { show () { this._init() } },
+  properties: {
+
+  },
+
+  /**
+   * 组件的初始数据
+   */
+  data: {
+    show: false,
+    options: [
+      [{ name: '微信', icon: 'wechat', openType: "share" }]
+      // [
+      //   { name: '微信', icon: 'wechat', openType: "share" },
+      //   { name: '朋友圈', icon: wechat },
+      //   { name: '微博', icon: 'weibo' },
+      //   { name: 'QQ', icon: 'qq' },
+      // ],
+      // [
+      //   { name: '复制链接', icon: 'link' },
+      //   { name: '分享海报', icon: 'poster' },
+      //   { name: '小程序码', icon: qrcode },
+      //   { name: '二维码', icon: 'qrcode' },
+      // ],
+    ],
+  },
+
+  /**
+   * 组件的方法列表
+   */
+  methods: {
+    _init () {
+      wx.lxd = wx.lxd || {}, wx.lxd.Share = e => {
+        this.setData({
+          ...e,
+        })
+      }
+    },
+    select (e) {
+      let { name } = e.detail;
+      switch (name) {
+        case '朋友圈':
+          break
+        default:
+          break
+      }
+    },
+    cancel () {
+      this.setData({
+        show: false
+      })
+    }
+  }
+})

+ 6 - 0
components/l-share/index.json

@@ -0,0 +1,6 @@
+{
+  "component": true,
+  "usingComponents": {
+    "van-share-sheet": "@vant/weapp/share-sheet/index"
+  }
+}

+ 2 - 0
components/l-share/index.wxml

@@ -0,0 +1,2 @@
+<van-share-sheet bind:cancel="cancel" bind:select="select" bind:click-overlay="cancel" show="{{show}}" title="立即分享给好友"
+  options="{{ options }}" />

+ 1 - 0
components/l-share/index.wxss

@@ -0,0 +1 @@
+/* components/l-share/index.wxss */

BIN
images/qrcode.png


+ 7 - 8
node_modules/@vant/weapp/dist/notify/notify.js

@@ -1,4 +1,3 @@
-import { WHITE } from '../common/color';
 const defaultOptions = {
   selector: '#van-notify',
   type: 'danger',
@@ -7,23 +6,23 @@ const defaultOptions = {
   duration: 3000,
   zIndex: 110,
   top: 0,
-  color: WHITE,
+  color: "#fff",
   safeAreaInsetTop: false,
-  onClick: () => {},
-  onOpened: () => {},
-  onClose: () => {},
+  onClick: () => { },
+  onOpened: () => { },
+  onClose: () => { },
 };
-function parseOptions(message) {
+function parseOptions (message) {
   if (message == null) {
     return {};
   }
   return typeof message === 'string' ? { message } : message;
 }
-function getContext() {
+function getContext () {
   const pages = getCurrentPages();
   return pages[pages.length - 1];
 }
-export default function Notify(options) {
+export default function Notify (options) {
   options = Object.assign(
     Object.assign({}, defaultOptions),
     parseOptions(options)

+ 4 - 5
pages/adddata/adddata.js

@@ -26,11 +26,11 @@ Page({
             address: [item.school_text, item.grade_text, item.classes_text].join(" "),
             classes,
           })
-          that.setData({
-            datalist
-          })
-          wx.stopPullDownRefresh();
         })
+        that.setData({
+          datalist
+        })
+        wx.stopPullDownRefresh();
       }
     })
   },
@@ -64,7 +64,6 @@ Page({
       method: 'delete',
       url: `/option/student/${item.id}/`,
       success (res) {
-        console.log(res)
         that.AdddataRequest();
       }
     })

+ 23 - 4
pages/detail/detail.js

@@ -1,6 +1,6 @@
 // pages/detail/detail.js
 const app = getApp()
-const { axios } = app.globalData;
+const { axios, token } = app.globalData;
 Page({
   /**
    * 页面的初始数据
@@ -11,13 +11,24 @@ Page({
   },
   // 点击图标事件
   onClickIcon (e) {
-    console.log("点击图标", e)
+    let { type } = e.currentTarget.dataset;
+    if (type == 'share') {
+      wx.lxd.Share({
+        show: true,
+      })
+    }
   },
   // 点击按钮事件
   onClickButton (e) {
     let { type } = e.currentTarget.dataset;
     // 点击立即购买
     if (type == "buy") {
+      if (!token()) {
+        wx.navigateTo({
+          url: '/pages/sgin/sgin',
+        })
+        return false
+      }
       let { id, shopdetail } = this.data;
       wx.navigateTo({
         url: `/pages/pay/pay?data=${JSON.stringify({ id, shopdetail })}`,
@@ -32,7 +43,6 @@ Page({
       url: `/commodity/wx_commodity_detail/${id}/`,
       method: "get",
       success (res) {
-        console.log(res)
         let { amount: price, detail_images: detaillist, introduce: desc, main_image: img, name } = res.data.data;
         shopdetail = {
           name, price, detaillist, desc, img
@@ -108,6 +118,15 @@ Page({
    * 用户点击右上角分享
    */
   onShareAppMessage: function () {
-
+    return {
+      title: this.data.shopdetail.name,
+      path: `/pages/detail/detail?data=${JSON.stringify({ id: this.data.id })}`
+    }
+  },
+  onShareTimeline: function (res) {
+    return {
+      title: this.data.shopdetail.name,
+      query: `data=${JSON.stringify({ id: this.data.id })}`
+    }
   }
 })

+ 1 - 1
pages/detail/detail.wxml

@@ -26,7 +26,7 @@
     </view>
     <!-- 功能条 -->
     <van-goods-action>
-      <van-goods-action-icon icon="chat-o" text="客服" bind:click="onClickIcon" />
+      <van-goods-action-icon data-type="share" icon="share-o" text="分享" bind:click="onClickIcon" />
       <van-goods-action-button data-type="buy" text="立即购买" bind:click="onClickButton" />
     </van-goods-action>
   </view>

+ 7 - 3
pages/index/index.js

@@ -15,7 +15,7 @@ Page({
     })
   },
   //加载商品数据 模拟5条
-  PageCount: 3,//总页数
+  PageCount: 1,//总页数
   Page: 1,//当前页数
   ShopRequest () {
     if (this.Page > this.PageCount) return false;
@@ -40,10 +40,10 @@ Page({
             title: item.name
           })
         })
+        wx.stopPullDownRefresh();
         that.setData({
           shoplist
         })
-        wx.stopPullDownRefresh();
       }
     })
   },
@@ -67,7 +67,8 @@ Page({
    */
   onPullDownRefresh: function () {
     this.PageCount = 1;
-    this.Page++;
+    this.Page = 1;
+    this.setData({ shoplist: [] })
     this.ShopRequest();
   },
 
@@ -83,5 +84,8 @@ Page({
    */
   onShareAppMessage: function () {
 
+  },
+  onShareTimeline: function (res) {
+
   }
 })

+ 2 - 1
pages/index/index.json

@@ -1,6 +1,7 @@
 {
   "enablePullDownRefresh": true,
   "usingComponents": {
-    "van-card": "@vant/weapp/card/index"
+    "van-card": "@vant/weapp/card/index",
+    "van-empty": "@vant/weapp/empty/index"
   }
 }

+ 3 - 0
pages/index/index.less

@@ -1,4 +1,7 @@
 .index{
+  .card{
+    border-bottom: 1px solid #eee;
+  }
     .card-desc{
         display: -webkit-box;
        -webkit-box-orient: vertical;

+ 4 - 3
pages/index/index.wxml

@@ -1,7 +1,8 @@
 <l-container>
   <view class="globstyle index">
-    <van-card bindtap="ShopSuccess" data-id="{{item.id}}" desc-class="card-desc" wx:for="{{shoplist}}" wx:key="index"
-      tag="{{item.tag}}" thumb="{{item.imgurl}}" title="{{item.title}}" desc="{{item.desc}}" price="{{item.price}}"
-      num="{{item.num}}" />
+    <van-card custom-class="card" lazy-load='true' bindtap="ShopSuccess" data-id="{{item.id}}" desc-class="card-desc"
+      wx:for="{{shoplist}}" wx:key="index" tag="{{item.tag}}" thumb="{{item.imgurl}}" title="{{item.title}}"
+      desc="{{item.desc}}" price="{{item.price}}" num="{{item.num}}" />
+    <van-empty wx:if="{{shoplist.length==0}}" description="暂无商品" />
   </view>
 </l-container>

+ 3 - 0
pages/index/index.wxss

@@ -1,3 +1,6 @@
+.index .card {
+  border-bottom: 1px solid #eee;
+}
 .index .card-desc {
   display: -webkit-box;
   -webkit-box-orient: vertical;

+ 38 - 9
pages/leave/leave.js

@@ -1,4 +1,6 @@
 // pages/leave/leave.js
+const app = getApp();
+const { axios } = app.globalData;
 Page({
 
   /**
@@ -7,7 +9,40 @@ Page({
   data: {
 
   },
-
+  // 请求管理数据
+  AdddataRequest () {
+    let that = this;
+    axios({
+      url: "/order/student_leave/", method: 'get', success (res) {
+        console.log(res)
+        let { data } = res.data, datalist = [];
+        data.forEach(item => {
+          let { student_text: name, id } = item;
+          datalist.push({
+            id,
+            name,
+            tel: [item.school_text, item.grade_text, item.class_text].join(" "),
+            createdata: item.create_time_f,
+            enddata: item.leave_date,
+            data: item.order_text
+          })
+        })
+        that.setData({
+          datalist
+        })
+        wx.stopPullDownRefresh();
+      }
+    })
+  },
+  // 删除
+  Del (e) {
+    let { item } = e.currentTarget.dataset, that = this;
+    axios({
+      url: `/order/student_leave/${item.id}/`, method: 'delete', success (res) {
+        that.AdddataRequest();
+      }
+    })
+  },
   /**
    * 生命周期函数--监听页面加载
    */
@@ -35,7 +70,7 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow: function () {
-
+    this.AdddataRequest()
   },
 
   /**
@@ -56,7 +91,7 @@ Page({
    * 页面相关事件处理函数--监听用户下拉动作
    */
   onPullDownRefresh: function () {
-
+    this.AdddataRequest()
   },
 
   /**
@@ -66,10 +101,4 @@ Page({
 
   },
 
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function () {
-
-  }
 })

+ 5 - 1
pages/leave/leave.json

@@ -1,3 +1,7 @@
 {
-  "usingComponents": {}
+  "enablePullDownRefresh": true,
+  "usingComponents": {
+    "van-tag": "@vant/weapp/tag/index",
+    "van-icon": "@vant/weapp/icon/index"
+  }
 }

+ 1 - 1
pages/leave/leave.less

@@ -1,5 +1,5 @@
 /* pages/adddata/adddata.wxss */
-.adddata{
+.leave{
   .adddata-data{
     background-color: white;
     padding: 10rpx 16rpx;

+ 6 - 3
pages/leave/leave.wxml

@@ -1,5 +1,5 @@
 <l-container>
-  <view class="globstyle adddata">
+  <view class="globstyle leave">
     <!-- 自定义 -->
     <!-- 列表 -->
     <view class="adddata-data">
@@ -8,10 +8,13 @@
           <view class="left-h1">{{item.name}} {{item.tel}} <van-tag wx:if="{{item.lock}}" round type="danger">默认
             </van-tag>
           </view>
-          <view class="left-h2">{{item.address}}</view>
+          <view class="left-h2">
+            <view class="h-item">申请时间:{{item.createdata}}</view>
+            <view class="h-item">请假日期:{{item.enddata}}</view>
+            <view class="h-item">请假内容:{{item.data}}</view>
+          </view>
         </view>
         <view class="flex-right">
-          <van-icon catchtap="Update" data-item="{{item}}" size="25" class="right-icon" name="edit" />
           <van-icon catchtap="Del" data-item="{{item}}" size="25" class="right-icon" name="delete-o" />
         </view>
       </view>

+ 6 - 6
pages/leave/leave.wxss

@@ -1,29 +1,29 @@
 /* pages/adddata/adddata.wxss */
-.adddata .adddata-data {
+.leave .adddata-data {
   background-color: white;
   padding: 10rpx 16rpx;
 }
-.adddata .adddata-data .item-flex {
+.leave .adddata-data .item-flex {
   display: flex;
   justify-content: space-between;
   align-items: center;
   padding: 20rpx 0;
   border-bottom: 1rpx solid #e6e6e6;
 }
-.adddata .adddata-data .item-flex .flex-left .left-h1 {
+.leave .adddata-data .item-flex .flex-left .left-h1 {
   font-weight: 600;
 }
-.adddata .adddata-data .item-flex .flex-left .left-h2 {
+.leave .adddata-data .item-flex .flex-left .left-h2 {
   max-width: 85vw;
   overflow: hidden;
   text-overflow: ellipsis;
   white-space: nowrap;
 }
-.adddata .adddata-data .item-flex .flex-right .right-icon {
+.leave .adddata-data .item-flex .flex-right .right-icon {
   display: block;
   margin: 10rpx;
 }
-.adddata .adddata-button {
+.leave .adddata-button {
   position: fixed;
   bottom: 0;
   width: 100%;

+ 4 - 11
pages/leaveadd/leaveadd.js

@@ -16,7 +16,7 @@ Page({
   onLoad: function (options) {
     wx.lxd.Ctr({
       // nav
-      title: "新增", //标题
+      title: "请假申请", //标题
       back: true,//返回按钮,tabber必须false(除非会改)
     });
   },
@@ -54,7 +54,7 @@ Page({
     })
     if (arr.length <= 0) {
       wx.showToast({
-        title: '请选择请假日期',
+        title: '请选择日期',
         icon: "error"
       })
       return false;
@@ -64,7 +64,7 @@ Page({
     })
     if (brr.length <= 0) {
       wx.showToast({
-        title: '请选择请假内容',
+        title: '请选择内容',
         icon: "error"
       })
       return false;
@@ -98,7 +98,7 @@ Page({
   onShow: function () {
     let { useraddress } = app.globalData, datas = [], type = [], that = this;
     if (!useraddress.id) {
-      useraddress["name"] = "请选学生"
+      useraddress["name"] = "请选学生"
     } else {
       axios({
         url: `/order/student_leave/get_info/?student=${useraddress.id}`,
@@ -147,11 +147,4 @@ Page({
   onReachBottom: function () {
 
   },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function () {
-
-  }
 })

+ 2 - 0
pages/leaveadd/leaveadd.less

@@ -20,11 +20,13 @@
       margin: 10rpx 20rpx;
       padding: 5rpx 15rpx;
       color: black;
+      border: 1rpx solid #eee;
     }
     .block{
       background-color: #1989fa;
       color: #fff;
       border-radius: 10rpx;
+      border:0;
     }
   }
   .button{

+ 2 - 0
pages/leaveadd/leaveadd.wxss

@@ -18,11 +18,13 @@
   margin: 10rpx 20rpx;
   padding: 5rpx 15rpx;
   color: black;
+  border: 1rpx solid #eee;
 }
 .leaveadd .flex .block {
   background-color: #1989fa;
   color: #fff;
   border-radius: 10rpx;
+  border: 0;
 }
 .leaveadd .button {
   margin-top: 50rpx;

+ 11 - 9
pages/login/login.js

@@ -40,10 +40,11 @@ Page({
       return false;
     }
     if (require) {
-      console.log("请登录");
+      wx.navigateTo({
+        url: '/pages/sgin/sgin',
+      })
       return false;
     }
-    console.log("普通触发")
   },
   /**
    * 生命周期函数--监听页面加载
@@ -68,9 +69,8 @@ Page({
   // 更新资料
   newbtn () {
     if (!this.state) {
-      wx.showToast({
-        title: '请先登录!',
-        icon: "none"
+      wx.navigateTo({
+        url: '/pages/sgin/sgin',
       })
       return false;
     }
@@ -85,8 +85,10 @@ Page({
           let { face, name } = res.data.data;
           user = { ...user, face, name };
           app.globalData["user"] = user;
-          wx.showToast({
-            title: '更新完毕',
+          wx.lxd.Notify({
+            message: "更新完毕",
+            type: "success",
+            icon: 'certificate'
           })
           that.setData({
             user
@@ -121,9 +123,9 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow: function () {
-    let { user } = app.globalData;
+    let { user, token } = app.globalData;
     this.setData({ user });
-    this.state = user.lock;
+    this.state = token();
   },
 
   /**

+ 51 - 3
pages/order/order.js

@@ -10,7 +10,42 @@ Page({
     active: 0,
     orderlist: [[], [], [], []],
   },
-
+  // 付款
+  pay (e) {
+    let { item } = e.currentTarget.dataset, obj = {}, id = null, shopdetail = {};
+    let { appid, user } = app.globalData, { openid } = user;
+    axios({
+      url: `/order/${item.id}/pay_order/`,
+      method: 'post',
+      data: {
+        appid, openid
+      },
+      success (res) {
+        let { data } = res.data;
+        wx.requestPayment({
+          timeStamp: data.timeStamp,
+          nonceStr: data.nonceStr,
+          package: data.package,
+          signType: data.signType,
+          paySign: data.paySign,
+          success: function (res) {
+            wx.lxd.Notify({
+              message: "付款成功",
+              type: 'success',
+              icon: "certificate"
+            })
+            this.orderRequest()
+          },
+          fail: function () {
+            wx.lxd.Notify({
+              message: "取消付款",
+              icon: "warn-o"
+            })
+          },
+        })
+      }
+    })
+  },
   /**
    * 生命周期函数--监听页面加载
    */
@@ -58,7 +93,7 @@ Page({
         let { totalPage, data } = res.data;
         orderlist[active] = [...orderlist[active], ...data];
         that.setData({ orderlist });
-        console.log(orderlist)
+        wx.stopPullDownRefresh();
         that.orderlist[active]["totalPage"] = totalPage;
         that.orderlist[active]["currentPage"]++;
       }
@@ -102,7 +137,20 @@ Page({
     this.setData({
       orderlist: [[], [], [], []],
     })
-    this.orderRequest()
+    this.orderlist = [{
+      totalPage: 1,
+      currentPage: 1,
+    }, {
+      totalPage: 1,
+      currentPage: 1,
+    }, {
+      totalPage: 1,
+      currentPage: 1,
+    }, {
+      totalPage: 1,
+      currentPage: 1,
+    }],
+      this.orderRequest()
   },
 
   /**

+ 2 - 1
pages/order/order.json

@@ -3,6 +3,7 @@
   "usingComponents": {
     "van-cell": "@vant/weapp/cell/index",
     "van-tab": "@vant/weapp/tab/index",
-    "van-tabs": "@vant/weapp/tabs/index"
+    "van-tabs": "@vant/weapp/tabs/index",
+    "van-empty": "@vant/weapp/empty/index"
   }
 }

+ 11 - 0
pages/order/order.less

@@ -23,5 +23,16 @@
     .price{
       .txt{color: #f03;}
     }
+    .btns{
+      display: flex;
+      justify-content: flex-end;
+      align-items: center;
+    }
+    .cell{
+      padding-top: 0;
+    }
+    .cells{
+      padding-bottom: 0;
+    }
   }
 }

+ 26 - 4
pages/order/order.wxml

@@ -3,8 +3,9 @@
     <van-tabs nav-class="nav" bind:click="tabs" active="{{ active }}">
       <van-tab title="全部">
         <view wx:for="{{orderlist[0]}}" wx:key="index" class="item">
-          <van-cell title="{{item.no}}" title-class="title" value-class="value" use-label-slot
-            value="{{item.status_text}}">
+          <van-cell custom-class="cells {{item.status_text=='待付款' ? false : true}}"
+            border="{{item.status_text=='待付款' ? false : true}}" title="{{item.no}}" title-class="title"
+            value-class="value" use-label-slot value="{{item.status_text}}">
             <view slot="label" class="label">
               <view class="g name">名称:{{item.commodity_text}}</view>
               <view class="g date">下单时间:{{item.create_time_f}}</view>
@@ -14,12 +15,22 @@
               </view>
             </view>
           </van-cell>
+          <view wx:if="{{item.status_text=='待付款'}}">
+            <van-cell custom-class="cell" use-label-slot>
+              <view class="btns" slot="label">
+                <van-button bind:click="pay" data-item="{{item}}" round type="primary" size="small">付款
+                </van-button>
+              </view>
+            </van-cell>
+          </view>
         </view>
+        <van-empty wx:if="{{orderlist[0].length==0}}" description="暂无订单" />
       </van-tab>
       <van-tab title="待付款">
         <view wx:for="{{orderlist[1]}}" wx:key="index" class="item">
-          <van-cell title="{{item.no}}" title-class="title" value-class="value" use-label-slot
-            value="{{item.status_text}}">
+          <van-cell custom-class="cells {{item.status_text=='待付款' ? false : true}}"
+            border="{{item.status_text=='待付款' ? false : true}}" title="{{item.no}}" title-class="title"
+            value-class="value" use-label-slot value="{{item.status_text}}">
             <view slot="label" class="label">
               <view class="g name">名称:{{item.commodity_text}}</view>
               <view class="g date">下单时间:{{item.create_time_f}}</view>
@@ -29,7 +40,16 @@
               </view>
             </view>
           </van-cell>
+          <view wx:if="{{item.status_text=='待付款'}}">
+            <van-cell custom-class="cell" use-label-slot>
+              <view class="btns" slot="label">
+                <van-button bind:click="pay" data-item="{{item}}" round type="primary" size="small">付款
+                </van-button>
+              </view>
+            </van-cell>
+          </view>
         </view>
+        <van-empty wx:if="{{orderlist[1].length==0}}" description="暂无订单" />
       </van-tab>
       <van-tab title="已付款">
         <view wx:for="{{orderlist[2]}}" wx:key="index" class="item">
@@ -45,6 +65,7 @@
             </view>
           </van-cell>
         </view>
+        <van-empty wx:if="{{orderlist[2].length==0}}" description="暂无订单" />
       </van-tab>
       <van-tab title="已取消">
         <view wx:for="{{orderlist[3]}}" wx:key="index" class="item">
@@ -60,6 +81,7 @@
             </view>
           </van-cell>
         </view>
+        <van-empty wx:if="{{orderlist[3].length==0}}" description="暂无订单" />
       </van-tab>
     </van-tabs>
   </view>

+ 11 - 0
pages/order/order.wxss

@@ -21,3 +21,14 @@
 .order .item .price .txt {
   color: #f03;
 }
+.order .item .btns {
+  display: flex;
+  justify-content: flex-end;
+  align-items: center;
+}
+.order .item .cell {
+  padding-top: 0;
+}
+.order .item .cells {
+  padding-bottom: 0;
+}

+ 3 - 3
pages/pay/pay.js

@@ -17,7 +17,7 @@ Page({
     let { id: commodity, message: notes, useraddress } = this.data, { id: student } = useraddress, that = this;
     if (!student) {
       wx.showToast({
-        title: '请选学生',
+        title: '请选学生',
         icon: 'error'
       })
       return false;
@@ -55,7 +55,7 @@ Page({
     pay().then(
       res => {
         that.setData({ loadding: false, disabled: true })
-        wx.navigateTo({
+        wx.redirectTo({
           url: '/pages/order/order',
         })
       }
@@ -103,7 +103,7 @@ Page({
   onShow: function () {
     let { useraddress } = app.globalData;
     if (!useraddress.id) {
-      useraddress["name"] = "请选学生"
+      useraddress["name"] = "请选学生"
     }
     this.setData({ useraddress })
   },

+ 4 - 1
pages/pay/pay.wxml

@@ -35,7 +35,10 @@
       <van-radio-group value="{{ paytype }}" bind:change="onChange">
         <van-cell border="{{false}}">
           <view class="type" slot="title">
-            <view class="str">微信支付</view>
+            <view class="str">
+              <van-icon name="wechat-pay" color="green" size="16" />
+              微信支付
+            </view>
             <view class="radio">
               <van-radio name="1" />
             </view>

+ 3 - 1
pages/sgin/sgin.js

@@ -32,9 +32,11 @@ Page({
           method: "post",
           success (res) {
             let { data } = res.data;
+            let { user } = app.globalData;
             user = {
+              ...user,
               lock: !!data.token,
-              ...data
+              ...data,
             }
             app.globalData = { ...app.globalData, user };
             wx.setStorage({

+ 1 - 1
project.config.json

@@ -4,7 +4,7 @@
     "ignore": []
   },
   "setting": {
-    "urlCheck": true,
+    "urlCheck": false,
     "es6": true,
     "enhance": true,
     "postcss": true,

ファイルの差分が大きいため隠しています
+ 0 - 0
utils/img.js


この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません