Browse Source

修改tag-apply 弹出框

gongwencan 8 months ago
parent
commit
1e08951f0f

+ 22 - 9
src/components/DialogTagApplyDetail.vue

@@ -86,9 +86,16 @@
               align="center"
             >
                 <template slot-scope="scope">
-                    <integer-input v-model="scope.row.number"></integer-input>
+                    <el-input v-model="scope.row.number" :class="{ 'input-error': scope.row.number === '' }" @input="handleInput" :disabled="oData.tagApplyStateId !='0' && oData.tagApplyStateId != '1'"></el-input>
                 </template>
             </el-table-column>
+            <el-table-column
+                label="单价(元)"
+                prop="unitPrice"
+                align="right"
+                min-width="70"
+                header-align="center"
+              ></el-table-column>
             <el-table-column
                 label="费用(元)"
                 prop="amount"
@@ -186,13 +193,8 @@ export default {
         cancelButtonClass: 'confirm-dialog-cancel-btn',
         type: 'warning'
       }).then(() => {
-        for (let i = 0; i < this.oData.details.length; i++) {
-          if (this.oData.details[i].id === data.id) {
-            this.oData.details.splice(i, 1)
-            break
-          }
-        }
-        this.list = this.oData.details
+        this.list = this.list.filter(item => item.id !== data.id)
+        this.oData.details = this.list
       }).catch(() => {})
     },
     onCloseBtnClick () {
@@ -201,10 +203,21 @@ export default {
     onOkBtnClick () {
       this.$$request(this.api, this.oData).then(() => {
         this.close()
+        this.$emit('saved')
       }).catch(console.error).finally(() => {})
+    },
+    handleInput (value) {
+      let sanitizedValue = value.replace(/[^0-9]/g, '')
+      sanitizedValue = sanitizedValue.replace(/^0+/, '')
+      this.selectedData.number = sanitizedValue === '' ? '' : sanitizedValue
+      this.selectedData.amount = sanitizedValue === '' ? 0 : (sanitizedValue * this.selectedData.unitPrice).toFixed(2)
     }
   }
 }
 </script>
 
-<style lang="scss"></style>
+<style lang="scss">
+.input-error .el-input__inner {
+  border-color: red;
+}
+</style>

+ 8 - 1
src/components/DialogTagDistributeDetail.vue

@@ -3,7 +3,7 @@
       :visible.sync="visible"
       :title="`订单详情 ${oData && oData.orderNo ? oData.orderNo : ''}`"
       append-to-body
-      width="900px"
+      width="1200px"
     >
       <div class="flex column" style="padding-bottom:20px;height:600px">
         <div class="flex-1 fit-size">
@@ -67,6 +67,13 @@
               header-align="center"
               align="center"
             ></el-table-column>
+            <el-table-column
+                label="单价(元)"
+                prop="unitPrice"
+                align="right"
+                min-width="70"
+                header-align="center"
+              ></el-table-column>
             <el-table-column
                 label="费用(元)"
                 prop="amount"