宇宙无敌M1处理器的MacBook Pro 4 vuotta sitten
vanhempi
commit
15f4244db6

+ 41 - 5
mini/pages/data/index.js

xqd xqd xqd xqd xqd xqd
@@ -133,7 +133,10 @@ Page({
     },
     detail_data: [],
     orderBy: 'asc',
-    recordX: 0
+    recordX: 0,
+    year_list: [],
+    yearsdata: "",
+    is_years_status: false
   },
 
   /**
@@ -144,6 +147,16 @@ Page({
     api.getByName(this, 'projects/getAll', 'projects', {
       type: 'drop_menu'
     });
+    http({
+      url: 'data/getProjectYears',
+      success: (res) => {
+        if (res.code == 0) {
+          this.setData({
+            year_list: res.data
+          })
+        }
+      }
+    })
   },
 
   // startX(e) {
@@ -221,13 +234,21 @@ Page({
   getChartData: function () {
     var chartIndex = this.data.chartIndex
     var that = this
+    let yearnum = ""
+    if (this.data.year_list.length != 0 && this.data.yearsdata != "") {
+      yearnum = (this.data.year_list.find((item) => {
+        return item.value == this.data.yearsdata
+      }).text).split("年")[0]
+    }
     var data = {
       date: this.data.date,
       orderBy: this.data.orderBy,
       chartIndex: chartIndex,
       project_id: this.data.project_id,
-      sort_type: this.data.sort_type
+      sort_type: this.data.sort_type,
+      project_year: yearnum
     }
+    console.log(data)
     data = Object.assign({}, data, this.data.filter)
     http({
       url: 'data/projectStat',
@@ -248,6 +269,15 @@ Page({
     this.setData({
       [name]: val
     })
+    if (this.data.sort_type == 'month') {
+      this.setData({
+        is_years_status: true
+      })
+    } else {
+      this.setData({
+        is_years_status: false
+      })
+    }
     this.getChartData()
   },
   updateChart: function () {
@@ -264,8 +294,14 @@ Page({
         bottom: 40
       }
       var title = '设备租赁费用明细'
-      var date = this.data.date
-      date = date.length > 7 ? date.substr(0, 4) + '年' : ''
+      var date = ""
+      if (this.data.year_list.find((item) => {
+          return item.value == this.data.yearsdata
+        }).text != '请选择年份') {
+        date = this.data.year_list.find((item) => {
+          return item.value == this.data.yearsdata
+        }).text
+      }
       title = (data.project ? data.project.name + '\n' + '\n' : '-') + date + title
       option.title = {
         text: title,
@@ -373,7 +409,7 @@ Page({
         data: data.legends,
         bottom: 40
       }
-      var title = '设备最大单价费用排行'
+      var title = '设备租赁单价排行'
       title = (data.info.length != 0 ? (data.info[0] != null ? data.info[0] + '-' : '') + (data.info[1] != null ? data.info[1] + '-' : '') + (data.info[2] != null ? data.info[2] + '-' : '') + (data.info[3] != null ? data.info[3] : '') : '') + '\n' + '\n' + title
       console.log(data)
       option.title = {

+ 4 - 2
mini/pages/data/index.wxml

xqd xqd
@@ -6,6 +6,8 @@
         data-name="project_id" />
       <van-dropdown-item value="{{ sort_type }}" options="{{ sort_types }}" bind:change="onChange"
         data-name="sort_type" />
+        <van-dropdown-item wx:if="{{is_years_status}}" value="{{ yearsdata }}" options="{{ year_list }}" bind:change="onChange"
+        data-name="yearsdata" />
     </van-dropdown-menu>
     <view class="sg-pad sg-flex sg-align-center sg-space-between">
       <view class="" style="width:300rpx">
@@ -22,14 +24,14 @@
     <view class="sg-center">
       <view class="sg-font-lg">{{year_money}}</view>
       <view class="sg-font-xs sg-pad-tb-sm">
-        <view style="margin-bottom:10rpx">当年公司租赁设备</view>
+        <view style="margin-bottom:10rpx">当年租赁费用</view>
         <view>费用总和</view>
       </view>
     </view>
     <view class="sg-center">
       <view class="sg-font-lg">{{month_money}}</view>
       <view class="sg-font-xs sg-pad-tb-sm">
-        <view style="margin-bottom:10rpx">当月公司租赁设备</view>
+        <view style="margin-bottom:10rpx">当月租赁费用</view>
         <view>费用总和</view>
       </view>
     </view>

+ 7 - 8
mini/pages/note-detail/index.js

xqd xqd
@@ -21,13 +21,6 @@ Page({
     this.setData({
       id
     })
-    var that = this;
-    api.getByName(this, 'notifications/detail', 'note', {id: id}, function() {
-      var order = that.data.note ? that.data.note.order : null
-      if(order) {
-        api.getByName(that, 'orders/getRole', 'role', {id: order.project_id});
-      }
-    });
   },
 
   /**
@@ -41,7 +34,13 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow: function () {
-
+    var that = this;
+    api.getByName(this, 'notifications/detail', 'note', {id: this.data.id}, function() {
+      var order = that.data.note ? that.data.note.order : null
+      if(order) {
+        api.getByName(that, 'orders/getRole', 'role', {id: order.project_id});
+      }
+    });
   },
 
   /**

+ 26 - 19
mini/pages/order-detail/index.js

xqd xqd xqd xqd xqd xqd xqd
@@ -37,7 +37,7 @@ Page({
     this.init()
   },
 
-  onChange: function(e) {
+  onChange: function (e) {
     var name = e.currentTarget.dataset.name
     this.setData({
       [name]: e.detail.value
@@ -56,10 +56,10 @@ Page({
       that.updateDeviceTotal()
       api.getByName(that, 'orders/getRole', 'role', {
         id: that.data.order ? that.data.order.project_id : ''
-      }, function() {
+      }, function () {
         that.updateActionType()
       });
-      
+
     });
   },
 
@@ -69,9 +69,9 @@ Page({
     var order = this.data.order
     var changePrice = false
     if (order.level == role.level) {
-      if(['checking', 'checked'].indexOf(order.status_key) != -1 && role && role.rights && role.rights.rentCheck) actionType = 'check';
-      else if(order.status_key == 'checked' && role.key == 'work') actionType = 'pass'
-      else if(order.status_key == 'reject' && role.key == 'work') actionType = 're-submit'
+      if (['checking', 'checked'].indexOf(order.status_key) != -1 && role && role.rights && role.rights.rentCheck) actionType = 'check';
+      else if (order.status_key == 'checked' && role.key == 'work') actionType = 'pass'
+      else if (order.status_key == 'reject' && role.key == 'work') actionType = 're-submit'
 
       changePrice = role && role.rights && role.rights.rentMoneyChange
     }
@@ -81,7 +81,7 @@ Page({
     })
   },
 
-  changePrice: function() {
+  changePrice: function () {
     var order_device = this.data.order_device
     var quantity = this.data.device_quantity
     var that = this
@@ -93,17 +93,24 @@ Page({
       },
       success: function (res) {
         if (res.code == 0) {
+          that.setData({
+            showPrice: false
+          })
           that.init()
         }
       }
     })
   },
-
-  switchShowPrice: function(e) {
-    var data =  e.currentTarget.dataset
+  closeshow: function () {
+    this.setData({
+      showPrice: false
+    })
+  },
+  switchShowPrice: function (e) {
+    var data = e.currentTarget.dataset
     var show = data.show
     var item = data.item
-    if(show) {
+    if (show) {
       this.setData({
         order_device: item,
         device_quantity: item.quantity
@@ -130,19 +137,19 @@ Page({
     })
   },
 
-  check: function(e) {
+  check: function (e) {
     var type = e.currentTarget.dataset.type
     var that = this
     var msg = '确认通过审核吗?'
-    if(type == 'reject') msg = '确认驳回申请吗?'
-    else if(type == 'pass' || type == 're-submit') msg = '确认提交吗?'
+    if (type == 'reject') msg = '确认驳回申请吗?'
+    else if (type == 'pass' || type == 're-submit') msg = '确认提交吗?'
     Dialog.confirm({
-      title: '提示',
-      message: msg,
-    })
+        title: '提示',
+        message: msg,
+      })
       .then(() => {
         that.submitCheck(e)
-      }).catch(()=>{
+      }).catch(() => {
         Dialog.close()
       })
   },
@@ -160,7 +167,7 @@ Page({
         if (res.code == 0) {
           Dialog.close()
           util.success('操作成功')
-          setTimeout(function() {
+          setTimeout(function () {
             that.init()
           }, 1000)
         }

+ 3 - 3
mini/pages/order-detail/index.wxml

xqd
@@ -88,12 +88,12 @@
     </block>
   </view>
   <van-dialog id="van-dialog" />
-  <van-dialog show="{{ showPrice }}" use-slot title="更改计数" show-cancel-button bind:confirm="changePrice" z-index="1">
+  <van-dialog show="{{ showPrice }}" bind:cancel="closeshow" use-slot title="更改计数" show-cancel-button bind:confirm="changePrice" z-index="1">
     <view class="sg-box sg-pad">
       <view class="sg-form-item sg-pad-tb sg-top-border">
-        <view class="sg-label">设备数量</view>
+        <view class="sg-label">租赁计数</view>
         <input value="{{device_quantity}}" class="sg-input" bindinput="onChange" data-name="device_quantity"
-          placeholder="请输入设备数量" type="number"></input>
+          placeholder="请输入租赁计数" type="number"></input>
       </view>
     </view>
   </van-dialog>

+ 3 - 3
mini/utils/env.js

xqd
@@ -1,5 +1,5 @@
-const isTest = false;
+const isTest = true;
 //172.31.31.35
 //172.31.31.92
-export const baseUrl = isTest ? 'http://172.31.31.35/api/mini/' : 'https://t18.9026.com/api/mini/';
-export const imgHost = isTest ? 'http://172.31.31.35/images/' : 'https://t18.9026.com/images/'
+export const baseUrl = isTest ? 'http://172.31.31.92/api/mini/' : 'https://t18.9026.com/api/mini/';
+export const imgHost = isTest ? 'http://172.31.31.92/images/' : 'https://t18.9026.com/images/'