于继渤 2 лет назад
Родитель
Сommit
c19755c4e8
2 измененных файлов с 55 добавлено и 18 удалено
  1. 1 0
      i18n/zh-CN.js
  2. 54 18
      package-sales/pages/order-billing/order-billing.js

+ 1 - 0
i18n/zh-CN.js

@@ -35,6 +35,7 @@ const button = {
   goodsDetail: '商品明细',
   otherInfo: '其他信息',
   responsiblePerson: '责任人',
+  invalidSuccessfully: '作废成功',
 }
 
 // 资金

+ 54 - 18
package-sales/pages/order-billing/order-billing.js

@@ -118,35 +118,33 @@ Page({
         title: mixins.$t("adddressFull")
       }]
     },
-
     // 弹出按钮
     buttonList: [
-
-      {
-        name: 'saleOutBound', title: mixins.$t("saleOutBound"), formMode: Constants.formMode.other, other: { idKey: 'orderId' },
-      },
+      { name: 'saleOutBound', title: mixins.$t("saleOutBound"), formMode: Constants.formMode.other, other: { idKey: 'orderId' } },//出库
       {
         name: 'saleOrderReturn', title: mixins.$t("saleReturn"), formMode: Constants.formMode.other, other: {
           idKey: 'orderId'
-        },
-      },
-      { name: 'collection', title: mixins.$t("cusCollection") },
-      { name: 'merge', title: mixins.$t("printedBill") },
-      { name: 'cancel', title: mixins.$t("invaidOrder") }
+        }
+      },//退货
+      { name: 'collection', title: mixins.$t("cusCollection") },//收款
+      { name: 'merge', title: mixins.$t("printedBill") }, //打印
+      { name: 'invalid', title: mixins.$t("invaidOrder") } //作废
     ],
-
     buttonSaveList: [{ code: 'add', title: mixins.$t("add") }],
-    contentSaveList: [{ code: 'need', title: mixins.$t("totalAmount"), type: 'str' }, { code: 'amount', content: 2000, type: 'number' }]
+    contentSaveList: [{ code: 'need', title: mixins.$t("totalAmount"), type: 'str' }, { code: 'amount', content: 0, type: 'number' }, {
+      type: 'count',
+      code: 'count',
+      bill: 0,
+      quantity: 0
+    }]
 
   },
-  //statusName
   /**
   * @desc :   处理接口返回数据
   * @date : 2024年3月8日
-  * @author : 王英杰
+  * @author : 于继渤
   */
   handleSearchData(tableData) {
-
     tableData.forEach(res => {
       if (res.outStatus !== Constants.outStatus.unOutBound) { //处理状态
         res.statusName = res.outStatusName
@@ -158,10 +156,25 @@ Page({
     this.setData({
       tableData: tableData
     })
+    //计算底部金额
+    this.calculateTotalAmount()
   },
-  // CalculateTotalAmount
-  invalid(){
-    console.log('invalid')
+
+  /**
+  * @desc :   作废
+  * @date : 2024年3月8日
+  * @author : 于继渤
+  */
+  invalid(e) {
+    return this.excute(this.data.service, this.data.service.invalid + '/' + e.orderId, {}).then(res => {
+      if (res.data.code == 200) {
+        wx.showToast({
+          title: mixins.$t('invalidSuccessfully'),
+          image: '/static/image/success.png',
+          duration: 1000
+        })
+      }
+    })
   },
   /**
      * @desc : 加载数据
@@ -173,6 +186,29 @@ Page({
   },
 
   /**
+  * @desc :   计算底部合计金额等
+  * @date : 2024年4月8日
+  * @author : 于继渤
+  */
+  calculateTotalAmount() {
+    let tableData = this.data.tableData
+    let contentSaveList = this.data.contentSaveList
+    let sumAmount = Number(0)
+    let sumQuantity = Number(0)
+    tableData.forEach(res => {
+      sumAmount += res.sumAmount
+      sumQuantity += res.sumQuantity
+    })
+    contentSaveList[1].content = sumAmount
+    contentSaveList[2].bill = tableData.length
+    contentSaveList[2].quantity = sumQuantity
+    this.setData({
+      contentSaveList: contentSaveList
+    })
+
+  },
+
+  /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {