Procházet zdrojové kódy

借用单 显示金额优化

xiaohaizhao před 2 roky
rodič
revize
0d3924f79b

+ 8 - 1
packageA/borrow/detail.js

@@ -1,4 +1,9 @@
-const _Http = getApp().globalData.http;
+const _Http = getApp().globalData.http,
+    currency = require("../../utils/currency"),
+    CNY = num => currency(num, {
+        symbol: "¥",
+        precision: 2
+    }).format();
 
 Page({
     data: {
@@ -40,6 +45,8 @@ Page({
                 title: res.msg,
                 icon: "none"
             });
+
+            res.data.amount = CNY(res.data.amount);
             this.setData({
                 detail: res.data,
                 loading: false

+ 1 - 1
packageA/borrow/detail.wxml

@@ -63,7 +63,7 @@
 <view style="height: 130rpx;" />
 <view class="footer">
     <view class="count">
-        {{detail.amount}}元
+        {{detail.amount}}元
     </view>
     <view class="but-box">
         <van-button custom-class='but delete' wx:if="{{detail.status=='新建'}}" bind:click="deleteItem">删除订单</van-button>

+ 8 - 0
packageA/borrow/index.js

@@ -1,4 +1,5 @@
 const _Http = getApp().globalData.http;
+import currency from "../../utils/currency";
 
 Page({
     data: {
@@ -66,6 +67,13 @@ Page({
         }).then(res => {
             console.log("工具借用列表", res)
             this.selectComponent('#ListBox').RefreshToComplete();
+            res.data = res.data.map(v => {
+                v.amount = currency(v.amount, {
+                    symbol: "¥",
+                    precision: 2
+                }).format()
+                return v
+            })
             this.setData({
                 list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
                 "content.pageNumber": res.pageNumber + 1,

+ 1 - 1
packageA/borrow/modules/list/index.wxml

@@ -19,7 +19,7 @@
             合计数量:{{item.qty}}
         </view>
         <view class="amount">
-            合计:{{item.amount}}元
+            合计:{{item.amount}}元
         </view>
     </view>
 

+ 12 - 2
packageA/borrow/modules/product/index.js

@@ -1,8 +1,15 @@
 const _Http = getApp().globalData.http,
-    file = require("../../../../utils/FormatTheAttachment");
+    file = require("../../../../utils/FormatTheAttachment"),
+    currency = require("../../../../utils/currency"),
+    CNY = num => currency(num, {
+        symbol: "¥",
+        precision: 2
+    }).format();
+
 let queue = [],
     downCounter = null,
     Counter = null;
+
 Component({
     properties: {
         disabled: Boolean, //禁用
@@ -50,7 +57,10 @@ Component({
                         let image = value.attinfos.find(v => v.fileType == "image");
                         value.cover = image ? image.cover : "";
                     }
-                    value.amount = value.amount * obj.toolcount;
+                    value.amount =CNY(value.defaultamount);
+
+
+
                     value.qty = value.qty * obj.toolcount;
                     return value;
                 })

+ 1 - 1
packageA/borrow/modules/product/list/index.wxml

@@ -75,7 +75,7 @@
 				借用数量:{{item.qty}}<text wx:if="{{item.auxunit}}">({{item.auxunit}})</text>
 			</view>
 			<view class="money">
-				总金额:<text>{{item.amount}}元</text>
+				总金额:<text>{{item.amount}}元</text>
 			</view>
 		</view>
 	</view>