Browse Source

按文档修改调整页面

yanjie 4 years ago
parent
commit
2abee8fefe

+ 1 - 0
mini/custom-tab-bar/index.js

xqd
@@ -48,6 +48,7 @@ Component({
 			wx.switchTab({
 				url: url
 			});
+			console.log(url)
 		},
 
 		init() {

+ 2 - 2
mini/pages/add-inner-device/index.wxml

xqd xqd
@@ -17,7 +17,7 @@
   <view class="sg-list sg-pad">
     <inner-device-card wx:for="{{list}}" wx:key="index" index="{{index}}" item="{{item}}" showChecked="{{true}}" bind:checked="switchSelect"></inner-device-card>
   </view>
-  <van-dialog show="{{ showAdded }}" use-slot title="已添加设备" show-cancel-button bind:confirm="switchShowAdded"
+  <van-dialog show="{{ showAdded }}" use-slot title="已添加设备" confirm-button-color="#5693FC" show-cancel-button bind:confirm="switchShowAdded"
     z-index="200" data-show="{{false}}">
     <view class="sg-added-list">
       <view class="sg-item sg-pad sg-bottom-border sg-flex sg-align-center sg-space-between" wx:for="{{add_devices}}"
@@ -27,7 +27,7 @@
           <view class="sg-dates sg-font-xs sg-gray-color">
             {{item.start_date ? item.start_date + '至' + item.end_date : ''}}</view>
         </view>
-        <view class="sg-right sg-red-bg sg-white sg-pad-sm" bindtap="deleteDevice" data-index="{{index}}">删除</view>
+        <view class="sg-right sg-white sg-pad-sm" style="background-color: #efefef;color:#fff;border-radius: 20rpx;"  bindtap="deleteDevice" data-index="{{index}}">删除</view>
       </view>
     </view>
   </van-dialog>

+ 1 - 1
mini/pages/create-order-inner/index.js

xqd
@@ -11,7 +11,7 @@ Page({
    */
   data: {
     tabs: ['内部设备调用', '调用设备添加'],
-    tabIndex: 0,
+    tabIndex: 1,
     work_points: [],
     pointIndex: -1,
     id: -1,

+ 8 - 0
mini/pages/create-order-inner/index.wxss

xqd xqd
@@ -1,6 +1,10 @@
 /* pages/create-order/index.wxss */
 .sg-tabs {
   background: white;
+  position: fixed;
+  top: 0;
+  width: 100%;
+  z-index: 99;
 }
 .sg-tab {
   width: 50%;
@@ -25,6 +29,10 @@
 }
 .sg-order-box {
   background: white;
+  margin-top: 85rpx;
+}
+.sg-device-box{
+  margin-top: 85rpx;
 }
 .sg-submit-box {
   justify-content: center;

+ 11 - 0
mini/pages/create-order/index.js

xqd
@@ -356,6 +356,17 @@ Page({
     this.setData({
       [name]: val
     })
+    if (name == 'device_price') {
+      let price
+      if (/^(\d?)+(\.\d{0,2})?$/.test(val)) { //正则验证,提现金额小数点后不能大于两位数字
+        price = val;
+      } else {
+        price = val.substring(0, val.length - 1);
+      }
+      this.setData({
+        device_price: price
+      })
+    }
     if(name == 'customName' && val) {
       this.setData({
         customSpec: true,

+ 8 - 8
mini/pages/create-order/index.wxml

xqd xqd xqd xqd xqd xqd
@@ -82,11 +82,11 @@
           <view class="sg-content sg-gray-color sg-font-small">
             <view class="sg-margin-tb-sm sg-flex sg-align-center sg-space-between">
               <view>租赁单价:¥{{item.price}}</view>
-              <view>数:{{item.quantity}}</view>
+              <view>租赁计数:{{item.quantity}}</view>
             </view>
             <view class="sg-margin-tb-sm">租赁方式:{{item.rent_type ? item.rent_type.name : item.rent}}</view>
             <view class="sg-margin-tb-sm">租赁时间:<text
-                class="sg-rent-date sg-border">{{item.start_date ? (item.start_date + '至' + item.end_date) : ''}}</text>
+                class="sg-rent-date sg-border" style=" border-radius: 25rpx;padding-left:15rpx;padding-right:15rpx;">{{item.start_date ? (item.start_date + '至' + item.end_date) : ''}}</text>
             </view>
           </view>
           <view class="sg-footer sg-flex sg-align-center sg-space-between sg-margin-top-sm">
@@ -99,7 +99,7 @@
     </view>
   </view>
   <van-dialog show="{{ showAdd }}" use-slot title="{{dialog_type == 'create' ? '添加设备' : '修改设备'}}" show-cancel-button
-    bind:confirm="addDevice" z-index="1" data-show="{{false}}">
+    bind:confirm="addDevice" z-index="1" data-show="{{false}}" confirm-button-color="#5693FC">
     <view class="sg-add-device-box sg-pad sg-font-small">
       <view class="sg-form-item sg-pad-tb sg-top-border">
         <view class="sg-label">设备类型</view>
@@ -125,7 +125,7 @@
           </picker>
         </block>
         <view class="sg-custom">
-          <van-checkbox value="{{ customName }}" bind:change="onChange" data-name="customName">项目自填</van-checkbox>
+          <van-checkbox value="{{ customName }}" bind:change="onChange" data-name="customName">自填</van-checkbox>
         </view>
       </view>
       <view class="sg-form-item sg-pad-tb sg-top-border">
@@ -143,7 +143,7 @@
           </picker>
         </block>
         <view class="sg-custom">
-          <van-checkbox value="{{ customSpec }}" bind:change="onChange" data-name="customSpec">项目自填</van-checkbox>
+          <van-checkbox value="{{ customSpec }}" bind:change="onChange" data-name="customSpec">自填</van-checkbox>
         </view>
       </view>
       <view class="sg-form-item sg-pad-tb sg-top-border">
@@ -161,7 +161,7 @@
           </picker>
         </block>
         <view class="sg-custom">
-          <van-checkbox value="{{ customRent }}" bind:change="onChange" data-name="customRent">项目自填</van-checkbox>
+          <van-checkbox value="{{ customRent }}" bind:change="onChange" data-name="customRent">自填</van-checkbox>
         </view>
       </view>
       <view class="sg-form-item sg-pad-tb sg-top-border">
@@ -170,12 +170,12 @@
           disabled="true" bindtap="switchShowDate" data-show="{{true}}"></input>
       </view>
       <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>
       </view>
       <view class="sg-form-item sg-pad-tb sg-top-border">
-        <view class="sg-label">设备单价</view>
+        <view class="sg-label">租赁单价</view>
         <input value="{{device_price}}" class="sg-input" bindinput="onChange" data-name="device_price"
           placeholder="请输入设备单价" type="digit"></input>
       </view>

+ 1 - 1
mini/pages/order-detail/index.js

xqd
@@ -11,7 +11,7 @@ Page({
    */
   data: {
     tabs: ['设备租赁订单', '租赁设备添加'],
-    tabIndex: 0,
+    tabIndex: 1,
     id: -1,
     order: null,
     device_total: 0,

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

xqd xqd xqd
@@ -55,11 +55,11 @@
           <view class="sg-title sg-bold">{{index+1}}. {{item.device_type ? item.device_type.name : ''}} - {{item.device_name ? item.device_name.name : ''}} - {{item.spec ? item.spec.name : ''}}
           </view>
           <view class="sg-content sg-gray-color sg-font-small">
-            <view class="sg-margin-tb-sm">租赁方式:{{item.rent_type ? item.rent_type.name : ''}}</view>
             <view class="sg-margin-tb-sm sg-flex sg-align-center sg-space-between">
               <view>租赁单价:¥{{item.price / 100}}</view>
-              <view>数:{{item.quantity}}</view>
+              <view>租赁计数:{{item.quantity}}</view>
             </view>
+            <view class="sg-margin-tb-sm">租赁方式:{{item.rent_type ? item.rent_type.name : ''}}</view>
             <view class="sg-margin-tb-sm">租赁时间:<text
                 class="sg-rent-date sg-border">{{item.start_date ? (item.start_date + '至' + item.end_date) : ''}}</text>
             </view>
@@ -67,7 +67,7 @@
           <view class="sg-footer sg-flex sg-align-center sg-space-between sg-margin-top-sm">
             <view class="sg-font-lg sg-bold">总金额:¥{{item.price * item.quantity / 100}}</view>
             <view class="sg-btn sg-index-bg sg-pad-sm sg-white" hidden="{{!changePrice}}" bindtap="switchShowPrice"
-              data-item="{{item}}" data-show="{{true}}">更改数</view>
+              data-item="{{item}}" data-show="{{true}}">更改数</view>
           </view>
         </view>
       </block>
@@ -88,7 +88,7 @@
     </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 }}" 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>

+ 8 - 0
mini/pages/order-detail/index.wxss

xqd xqd
@@ -1,6 +1,10 @@
 /* pages/create-order/index.wxss */
 .sg-tabs {
   background: white;
+  position: fixed;
+  top: 0;
+  width: 100%;
+  z-index: 99;
 }
 .sg-tab {
   width: 50%;
@@ -25,6 +29,10 @@
 }
 .sg-order-box {
   background: white;
+  margin-top: 85rpx;
+}
+.sg-device-box{
+  margin-top: 85rpx;
 }
 .sg-submit-box {
   justify-content: center;

+ 31 - 22
mini/pages/repair/index.js

xqd xqd xqd xqd xqd xqd xqd xqd
@@ -45,14 +45,14 @@ Page({
     })
     api.getProject(this)
     api.getByName(this, 'work-points/get', 'work_points');
-    api.getByName(this, 'inner-devices/get', 'inner_devices', {project_id:id, status: 'using'});
+    api.getByName(this, 'inner-devices/get', 'inner_devices', { project_id: id, status: 'using' });
   },
 
   switchChecked(e) {
     var name = e.currentTarget.dataset.name
     var items = this.data[name]
     var index = e.currentTarget.dataset.index
-    for(var i = 0; i < items.length; ++i) {
+    for (var i = 0; i < items.length; ++i) {
       items[i].checked = false;
     }
     items[index].checked = true;
@@ -62,12 +62,12 @@ Page({
     })
   },
 
-  submit: function(e) {
+  submit: function (e) {
     // if(this.data.pointIndex < 0) {
     //   util.error('需求工点必填');
     //   return false;
     // }
-    if(this.data.deviceIndex < 0) {
+    if (this.data.deviceIndex < 0) {
       util.error('维修设备必填');
       return false;
     }
@@ -86,10 +86,10 @@ Page({
         remark: this.data.remark,
         parts: this.data.parts
       },
-      success: function(res) {
-        if(res.code == 0) {
+      success: function (res) {
+        if (res.code == 0) {
           util.success('操作成功')
-          setTimeout(function() {
+          setTimeout(function () {
             wx.navigateBack({
               delta: 0,
             })
@@ -99,13 +99,13 @@ Page({
     })
   },
 
-  switchTab: function(e) {
+  switchTab: function (e) {
     this.setData({
       tabIndex: e.currentTarget.dataset.index
     })
   },
 
-  delete: function(e) {
+  delete: function (e) {
     var parts = this.data.parts
     var index = e.currentTarget.dataset.index
     parts.splice(index, 1)
@@ -114,16 +114,16 @@ Page({
     })
   },
 
-  add: function() {
-    if(!this.data.part_name) {
+  add: function () {
+    if (!this.data.part_name) {
       util.error('维修部位必填');
       return false;
     }
-    if(!this.data.part_change) {
+    if (!this.data.part_change) {
       util.error('更换配件必填');
       return false;
     }
-    if(!this.data.part_price) {
+    if (!this.data.part_price) {
       util.error('配件价格必填');
       return false;
     }
@@ -139,21 +139,30 @@ Page({
     })
   },
 
-  onChange: function(e) {
+  onChange: function (e) {
     var name = e.currentTarget.dataset.name
     var val = e.detail.value
-    
     this.setData({
       [name]: val
     })
-
-    if(name == 'pointIndex') {
+    if (name == 'part_price') {
+      let price
+      if (/^(\d?)+(\.\d{0,2})?$/.test(val)) { //正则验证,提现金额小数点后不能大于两位数字
+        price = val;
+      } else {
+        price = val.substring(0, val.length - 1);
+      }
+      this.setData({
+        part_price: price
+      })
+    }
+    if (name == 'pointIndex') {
       var work_point = this.data.work_points[val]
       var work_point_id = work_point ? work_point.id : ''
       var that = this
       api.getByName(this, 'inner-devices/get', 'inner_devices', {
         work_point_id: work_point_id
-      }, function() {
+      }, function () {
         that.setData({
           deviceIndex: -1
         })
@@ -169,9 +178,9 @@ Page({
     })
   },
 
-  switchShowAdd: function(e) {
+  switchShowAdd: function (e) {
     var show = e.currentTarget.dataset.show
-    if(show) {
+    if (show) {
       this.setData({
         part_name: '',
         part_change: '',
@@ -184,13 +193,13 @@ Page({
     })
   },
 
-  switchShowDate: function(e) {
+  switchShowDate: function (e) {
     this.setData({
       showDate: e.currentTarget.dataset.show
     })
   },
 
-  confirmDate: function(e) {
+  confirmDate: function (e) {
     this.switchShowDate(e)
     var [start_date, end_date] = e.detail;
     start_date = util.formatDate(start_date)

+ 2 - 2
mini/pages/repair/index.wxml

xqd
@@ -88,14 +88,14 @@
               </view>
             </view>
           </view>
-          <view class="sg-right sg-red-bg sg-pad sg-flex sg-align-center" bindtap="delete" data-index="{{index}}">删除
+          <view class="sg-right  sg-pad sg-flex sg-align-center" style="background-color: #efefef;color:#fff" bindtap="delete" data-index="{{index}}">删除
           </view>
         </view>
       </block>
     </view>
   </view>
   <van-dialog show="{{ showAdd }}" use-slot title="{{dialog_type == 'create' ? '维修配件添加' : '修改设备'}}" show-cancel-button
-    bind:confirm="add" z-index="1">
+    bind:confirm="add" z-index="1" confirm-button-color="#5693FC">
     <view class="sg-add-device-box sg-pad sg-font-small">
       <view class="sg-form-item sg-pad-tb sg-top-border">
         <view class="sg-label">设备维修部位</view>