Sfoglia il codice sorgente

业务员服务申请单添加产品默认数量1,可编辑产品数量

xiaohaizhao 1 anno fa
parent
commit
7a8bab66e5

+ 19 - 0
Eservice/components/productCard/index.js

@@ -24,12 +24,31 @@ Component({
       this.data.data.qty = e.detail.value
       this.triggerEvent("input", this.data.data);
     },
+    newOnBlur(e) {
+      let value = e.detail.value,
+        data = this.data.data,
+        that = this;
+      if (data.oldQty == value) return;
+      wx.showModal({
+        title: `提示`,
+        content: `是否确定修改“${data.itemname}”数量为:${value}`,
+        complete: (res) => {
+          if (res.cancel) {
+            that.setData({
+              "data.qty": data.oldQty
+            })
+          }
+          if (res.confirm) that.triggerEvent("changeItem", data)
+        }
+      })
+    },
     onBlur(e) {
       let {
         value
       } = e.detail,
         data = this.data.data,
         name = e.currentTarget.dataset.name;
+      console.log(data)
       if (data[name] == value) return;
       if (name == 'qty' && value <= 0) {
         wx.showToast({

+ 1 - 1
Eservice/components/productCard/index.wxml

@@ -12,7 +12,7 @@
       </view>
       <block wx:if="{{model==1}}">
         <view wx:if="{{changeQty}}" class="small flex-align-center">
-          数量:<input value="{{data.qty}}" bindinput="inputChange" placeholder="输入数量"></input>
+          数量:<input value="{{data.qty}}" bindinput="inputChange" bindblur="newOnBlur" placeholder="输入数量"></input>
         </view>
         <view wx:else="{{changeQty}}" class="small flex-align-center">
           数量:{{data.qty?data.qty:0}}

+ 28 - 3
Eservice/saler/serviceBillDetail/index.js

@@ -66,14 +66,36 @@ Page({
           return {
             "sa_serviceorderitemsid": 0,
             "itemid": e,
-            "reason": ""
+            "reason": "",
+            "qty": 1
           }
         })
       }
     })
     this.productmx()
   },
-
+  async changeItem({
+    detail
+  }) {
+    const res = await api._post({
+      "id": "20230206161803",
+      "version": 1,
+      "content": {
+        "sa_serviceorderid": this.data.id,
+        "iteminfos": [{
+          "sa_serviceorderitemsid": detail.sa_serviceorderitemsid,
+          "itemid": detail.sa_serviceorderitemsid,
+          "reason": detail.reason,
+          "qty": detail.qty
+        }]
+      }
+    })
+    wx.showToast({
+      title: res.msg == '成功' ? '修改成功' : res.msg,
+      icon: "none"
+    })
+    this.productmx()
+  },
   async productmx() {
     const res = await api._post({
       "id": "20230206161903",
@@ -83,7 +105,10 @@ Page({
       }
     })
     this.setData({
-      list: res.data
+      list: res.data.map(v => {
+        v.oldQty = v.qty;
+        return v
+      })
     })
   },
 

+ 1 - 1
Eservice/saler/serviceBillDetail/index.wxml

@@ -66,7 +66,7 @@
           </t-button>
         </view>
         <view wx:for="{{list}}" wx:key="{{itemid}}">
-          <product-card data="{{item}}" isdelete="{{true}}" bind:delete="onDelete"></product-card>
+          <product-card data="{{item}}" isdelete="{{orderMainData.status == '新建'}}" changeQty='{{orderMainData.status == "新建"}}' bind:delete="onDelete" bind:changeItem="changeItem" />
         </view>
 
       </view>