Selaa lähdekoodia

1、列表组件增加收款金额

zhoux 2 vuotta sitten
vanhempi
commit
2dfa178732

+ 4 - 0
components/dkbase/dk-list/dk-list.js

@@ -83,6 +83,10 @@ Component({
     routeObjName: {
       type: String
     },
+    // 收款金额字段
+    collectCol:{
+      type:String
+    }
   },
 
   /**

+ 14 - 0
components/dkbase/dk-list/dk-list.wxml

@@ -79,6 +79,20 @@
           </view>
         </view>
       </view>
+
+      <!-- 收款状态和收款 -->
+      <view wx:if="{{!!item.collectStatus}}" class="bottom-bar" style="background-color:white;border-radius: 0px  0px 15rpx 15rpx;">
+        <view class="bottom-title-class">
+          {{$t[item.collectStatus]}}
+        </view>
+
+        <view class="collect-class">
+          <!-- <dk-cell height="46rpx" spaceWidth="15rpx" fontSize="15" contentColor="#CAA977" fontWeight="" title="已收款" content="{{item.sumCollectedAmount ? item.sumCollectedAmount : 0}}"></dk-cell> -->
+          <view>{{$t['collect']}}</view>
+          <view class="sign-class">¥</view>
+          <view>{{wxmlUtil.toThousandCents(item[collectCol] ? item[collectCol] : 0)}}</view>
+        </view>
+      </view>
     </view>
   </view>
 </view>

+ 77 - 37
components/dkbase/dk-list/dk-list.wxss

@@ -2,33 +2,36 @@
   margin: 10px 32rpx 10px 32rpx;
   margin-top: 10px;
   border-radius: 15rpx;
-  box-shadow:2px 2px 5px #e5e5e6;
+  box-shadow: 2px 2px 5px #e5e5e6;
 }
 
 .main-foot {
   background: #fff;
   width: 100%;
-  border-radius: 15rpx 15rpx 0px  0px;
+  border-radius: 15rpx 15rpx 0px 0px;
   background: linear-gradient(180deg, #E2ECFF 0%, #FAFCFF 100%), #fff;
   background-repeat: no-repeat;
   background-size: 100% 46px;
 }
 
-.table-content{
+.table-content {
   width: 100%;
 }
-.table-content-row{
+
+.table-content-row {
   padding: 10px 32rpx 10px 32rpx;
 }
-.table-content-row-font{
+
+.table-content-row-font {
   font-size: 14px;
-  color: #95A8CB; 
+  color: #95A8CB;
   padding-right: 32rpx;
-  white-space:nowrap;
+  white-space: nowrap;
 }
-.table-content-class{
+
+.table-content-class {
   font-size: 13px;
-  font-weight:500;
+  font-weight: 500;
   color: #1B365D;
   word-break: break-all;
 }
@@ -39,7 +42,7 @@
   justify-content: space-around;
 }
 
-.table-content-row-title{
+.table-content-row-title {
   display: flex;
   margin-left: 70rpx;
   width: calc(100% - 70rpx);
@@ -54,20 +57,20 @@
   color: #1989fa;
 }
 
-.title-class{
-  width:calc(70% - 39rpx);
-  display:flex;
+.title-class {
+  width: calc(70% - 39rpx);
+  display: flex;
   padding-left: 14rpx;
   font-size: 30rpx;
 }
 
-.status-class{
+.status-class {
   width: 40%;
   height: 49rpx;
-  padding-right:4rpx;
+  padding-right: 4rpx;
 }
 
-.status-detail-class{
+.status-detail-class {
   height: 49rpx;
   line-height: 49rpx;
   border-radius: 6rpx;
@@ -78,13 +81,13 @@
   color: #fff;
 }
 
-.status-font-class{
+.status-font-class {
   font-size: 13px;
-  color:  #FFFFFF;
+  color: #FFFFFF;
 }
 
 /**品类*/
-.category-class{
+.category-class {
   width: 40%;
   font-size: 15px;
   color: #95A8CB;
@@ -94,21 +97,21 @@
 
 
 /**合计金额*/
-.totalamount-class{
+.totalamount-class {
   width: 100%;
   text-align: right !important;
 }
 
 /**副标题*/
-.sub-title-class{
-  display: flex; 
+.sub-title-class {
+  display: flex;
   width: 100%;
   text-align: right;
   height: 47rpx;
   justify-content: flex-end;
 }
 
-.sub-title-detail-class{
+.sub-title-detail-class {
   height: 47rpx;
   line-height: 47rpx;
   background-color: #EAF1FF;
@@ -122,7 +125,7 @@
 .corner-view {
   position: absolute;
   /* 扇形弧度 */
-  border-radius: 0 0 100rpx 0; 
+  border-radius: 0 0 100rpx 0;
   /* 左上弧度 */
   border-top-left-radius: 15rpx;
   /* 位置 */
@@ -131,27 +134,28 @@
   padding: 14rpx;
   width: 70rpx;
   height: 56rpx;
-  background-color: #E3DCD1; 
+  background-color: #E3DCD1;
 
 }
-.corner-view-text{
+
+.corner-view-text {
   transform: rotate(-45deg);
-    /* 字体颜色 */
-    color: #B19264;
-    font-size: 24rpx;
-    font-weight: 600;
-    font-size: 26rpx;
+  /* 字体颜色 */
+  color: #B19264;
+  font-size: 24rpx;
+  font-weight: 600;
+  font-size: 26rpx;
 }
 
 
 /**功能pop*/
-.function-pop-class{
+.function-pop-class {
   /* height:40% !important; */
-  padding-bottom:130rpx !important;
-  width:100%;
-  z-index:10;
+  padding-bottom: 130rpx !important;
+  width: 100%;
+  z-index: 10;
   border-radius: 30rpx 30rpx 0rpx 0rpx !important;
-  padding-top: 20rpx; 
+  padding-top: 20rpx;
 }
 
 .function-cell-group {
@@ -161,7 +165,7 @@
 }
 
 /**功能菜单的图标样式*/
-.function-pop-image{
+.function-pop-image {
   width: 80rpx;
   height: 80rpx;
   display: flex;
@@ -181,4 +185,40 @@
   padding-top: 15rpx;
   background: #fff;
   height: 100rpx;
+}
+
+.bottom-bar {
+  display: flex;
+  justify-content: space-between;
+  background: #FBF6EF !important;
+  border-radius: 0px 0px 12rpx 12rpx;
+  align-items: center;
+  height: 115rpx;
+}
+
+.bottom-title-class {
+  color: #1B365D;
+  margin-left: 30rpx;
+  font-size: 13px;
+}
+
+/**收款*/
+.collect-class {
+  height: 70rpx;
+  line-height: 70rpx;
+  background: #F2E0BC;
+  border-radius: 10px;
+  text-align: center;
+  display: flex;
+  padding: 0 20rpx;
+  font-size: 15px;
+  color: #CAA977;
+  margin-right: 30rpx;
+}
+
+.sign-class{
+  padding-left: 10rpx;
+  padding-right:5rpx;
+  padding-top: 5rpx;
+  font-size: 10px;
 }

+ 2 - 1
i18n/zh-CN.js

@@ -23,7 +23,8 @@ const columns = {
   addressFull:'收货地址',
   makingTime:'采购日期',
   deliveryTime:'预计发货日期',
- 
+  noCollect:'未收款',
+  collect:'已收款'
 }
 //销售订单
 const saleOrder = {

+ 1 - 1
package-basic-data/pages/test/test.js

@@ -23,7 +23,7 @@ Page({
     pullMenuList: [{ code: 'outStatus', pullType: 'mSelect', typeName: 'outStatus' }, { code: 'receiveStatus', pullType: 'mSelect', typeName: 'receiveStatus' }, { code: 'followCount', dataType: 'number' }, { code: 'nextFollowTime', dataType: 'date' }],
 
     // 假数据
-    dataList: [{ salesChannelName: '零售', customerId: 11, customerName: '张三', displayStatus: '成交',backgroundColor:'red', orderNo: 'SA-LWYD-ZOO-202401300SBG', customerPhone: '15659741980', addressFull: '辽宁省沈阳市浑南区沈阳市浑南区人民政府(新聪街西)1', orgName: '零售部', staffName: '薛玉', tsumAmount: 3000, categoryQuantity: 1, tsumQuantity: 1, makeTime: '2023-1-3' }, { salesChannelName: '分销', customerName: '李四', displayStatus: '未成交', orderNo: 'SA-LWYD-ZOO-202401300SBD', customerPhone: '15659741980', addressFull: '辽宁省沈阳市浑南区沈阳市浑南区人民政府(新聪街西)2', orgName: '零售部', staffName: '薛玉', tsumAmount: 4000, categoryQuantity: 2, tsumQuantity: 2, makeTime: '2023-12-3' }],
+    dataList: [{ salesChannelName: '零售', customerId: 11, customerName: '张三', displayStatus: '成交',backgroundColor:'red', orderNo: 'SA-LWYD-ZOO-202401300SBG', customerPhone: '15659741980', addressFull: '辽宁省沈阳市浑南区沈阳市浑南区人民政府(新聪街西)1', orgName: '零售部', staffName: '薛玉', tsumAmount: 3000, categoryQuantity: 1, tsumQuantity: 1, makeTime: '2023-1-3' ,collectStatus:'noCollect',collectAmount:1000}, { salesChannelName: '分销', customerName: '李四', displayStatus: '未成交', orderNo: 'SA-LWYD-ZOO-202401300SBD', customerPhone: '15659741980', addressFull: '辽宁省沈阳市浑南区沈阳市浑南区人民政府(新聪街西)2', orgName: '零售部', staffName: '薛玉', tsumAmount: 4000, categoryQuantity: 2, tsumQuantity: 2, makeTime: '2023-12-3' }],
 
     // 列表区(脚部金额)
     footerAmount: { name: 'tsumAmount', title: '合计金额' },

+ 1 - 1
package-basic-data/pages/test/test.wxml

@@ -11,7 +11,7 @@
 <van-empty wx:if="{{dataList.length<=0}}" description="暂无数据" />
 
 <!-- 列表区 -->
-<dk-list list="{{dataList}}" titleCorner="salesChannelName" title="customerName" status="displayStatus" subTitle="makeTime" content="{{contentList}}" contentObj="{{contentObj}}" contentCol="displayStatus" footerAmount="{{footerAmount}}" footerInfo="{{footerInfo}}" bind:toDetail="toDetail" bind:toTitle="toTitle" bind:toStatus="toStatus" bind:toPoint="toPoint" routeObjName="{{routeObjName}}" buttonList="{{buttonList}}" bind:open="open"></dk-list>
+<dk-list list="{{dataList}}" titleCorner="salesChannelName" title="customerName" status="displayStatus" collectCol="collectAmount" subTitle="makeTime" content="{{contentList}}" contentObj="{{contentObj}}" contentCol="displayStatus" footerAmount="{{footerAmount}}" footerInfo="{{footerInfo}}" bind:toDetail="toDetail" bind:toTitle="toTitle" bind:toStatus="toStatus" bind:toPoint="toPoint" routeObjName="{{routeObjName}}" buttonList="{{buttonList}}" bind:open="open"></dk-list>
 
 <van-divider wx:if="{{noMore}}" contentPosition="center" borderColor="#DCDCDC">到底了~</van-divider>
 <view style="height: 135rpx;"></view>

+ 7 - 0
utils/Constants.js

@@ -93,6 +93,13 @@ module.exports = {
     }
   ],
 
+  // 收款状态
+  receiveStatus:{
+    no:'未收款',
+    part:'部分收款',
+    all:'收款完成'
+  },
+
   // 收款进度
   receiveStatusList: [{ name: '未收款',code:'收款状态-未收', id: 0, infotype: 'default' },
   { name: '部分收款',code:'收款状态-部分', id: 1, infotype: 'default' },

+ 37 - 0
utils/wxmlUtil.wxs

@@ -207,9 +207,46 @@ function setPlaceholder(lang,name,searchFlag=false) {
 }
 
 /**
+ * @desc : 前台实现千分位
+ * @date : 2024/2/18 16:49
+ * @author : 周兴
+ */
+function toThousandCents(num) {
+  if (num == undefined) {
+      return 0;
+  }
+  var num = num + '';
+  var d = '';
+  if (num.slice(0, 1) == '-') {
+      d = num.slice(0, 1);
+      num = num.slice(1);
+  }
+  var len = num.length;
+  var index = num.indexOf('.');
+  if (index == -1) {
+      num = num + '.00';
+  } else if ((index + 2) == len) {
+      num = num + '0';
+  }
+  var index = num.indexOf('.'); // 字符出现的位置
+  var num2 = num.slice(-3);
+  num = num.slice(0, index)
+  var result = '';
+  while (num.length > 3) {
+      result = ',' + num.slice(-3) + result;
+      num = num.slice(0, num.length - 3);
+  }
+  if (num) {
+      result = num + result;
+  }
+  return d + (result + num2)
+}
+
+/**
  * 暴露接口调用
  */
 module.exports = {
+  toThousandCents:toThousandCents,
   setItemValue: setItemValue,
   setFooterItemValue: setFooterItemValue,
   setSearchPlaceholder: setSearchPlaceholder,