1004749546@qq.com vor 4 Jahren
Ursprung
Commit
9c2dd35cc0
1 geänderte Dateien mit 11 neuen und 59 gelöschten Zeilen
  1. 11 59
      src/views/recoveryManage/recoveryPriceSet.vue

+ 11 - 59
src/views/recoveryManage/recoveryPriceSet.vue

@@ -17,29 +17,23 @@
       :scroll="{ y: 650 }"
       :loading="loadingPage"
       bordered>
-      <!-- 序号 -->
-      <template slot="no">
-        <span>{{ }}</span>
-      </template>
       <!-- 门店结算价 -->
       <template slot="advicePrice" slot-scope="text, record" >
         <a-input-number
           id="storeSettlementPrice-price"
-          :value="record.advicePrice"
+          v-model="record.advicePrice"
           :precision="2"
           :min="0"
           :max="999"
           style="width: 70%;"
           placeholder="请输入回收价格"
-          @change="e => handleChange(e, record.id)" />
-        <!-- <template v-else> {{ record.accountPrice }} </template> -->
+        />
       </template>
       <!-- 操作 -->
-      <template slot="action" slot-scope="text,index, record">
+      <template slot="action" slot-scope="text, record">
         <div class="editable-row-operations">
           <span >
-            <!-- <a @click="() => save(record.id, record.accountPrice)" style="margin-right: 8px;">保存</a> -->
-            <a-popconfirm title="确定要保存吗?" @confirm="() => save(record.id,record.advicePrice)" @cancel="cancel(record,index)">
+            <a-popconfirm title="确定要保存吗?" @confirm="() => save(record.id,record.advicePrice)" @cancel="record.advicePrice = record.currentValue">
               <template slot="title">
                 <p> 保存</p>
                 <p> 取消 </p>
@@ -47,10 +41,6 @@
               <a>保存</a>
             </a-popconfirm>
           </span>
-          <!-- <span v-else>
-            <a v-if="$hasPermissions('B_store_jsj_edit')" :disabled="editingId !== ''" @click="() => edit(record.id)">编辑</a>
-            <span v-else>--</span>
-          </span> -->
         </div>
       </template>
     </a-table>
@@ -63,7 +53,7 @@ export default {
   data () {
     return {
       loadingPage: false, // 列表加载状态
-      type: '',
+      type: '1',
       // 表头
       columns: [
         { title: '序号', dataIndex: 'no', width: 60, align: 'center' },
@@ -77,77 +67,39 @@ export default {
     }
   },
   mounted () {
+	  this.type = 1
+	  this.loadData = []
     this.getListData()
   },
   methods: {
     callback (key) {
       this.type = key
-      gePriceList({ adviceType: key }).then(res => {
-        if (res.status == 200) {
-          this.loadData = res.data
-          this.loadData.forEach((item, index) => {
-            item.no = index + 1
-            item.currentValue = item.advicePrice
-          })
-        }
-      })
+	  this.getListData()
       // this.save()
       console.log(key, this.type)
     },
     getListData () {
-      gePriceList({ adviceType: '1' }).then(res => {
+      gePriceList({ adviceType: this.type }).then(res => {
         if (res.status == 200) {
           this.loadData = res.data
           this.loadData.forEach((item, index) => {
             item.no = index + 1
-            item.currentValue = item.advicePrice
+            item.currentValue = item.advicePrice || ''
           })
         }
       })
     },
-    // 改变回收价格
-    handleChange (value, id) {
-      console.log(value)
-      const newData = [...this.loadData]
-      const target = newData.filter(item => id === item.id)[0]
-      console.log(target, '-----------')
-      if (target) {
-        target['advicePrice'] = value
-        this.loadData = newData
-      }
-    },
     // 保存价格
     save (id, advicePrice) {
       savPrice({ adviceType: this.type ? this.type : 1, id: id, advicePrice: advicePrice }).then(res => {
         if (res.status == 200) {
           this.$message.success(res.message)
-          gePriceList({ adviceType: this.type ? this.type : 1 }).then(res => {
-            if (res.status == 200) {
-              this.loadData = res.data
-              this.loadData.forEach((item, index) => {
-                item.no = index + 1
-                item.currentValue = item.advicePrice
-              })
-            }
-          })
+		  this.getListData()
         } else {
           this.$message.warning(res.message)
         }
       })
-    },
-    cancel (item, index) {
-      console.log(index, this.loadData, '------lllllllll')
-      if (item.currentValue) {
-        item.advicePrice = item.currentValue
-      } else {
-        this.$nextTick(() => {
-          item.advicePrice = ''
-          this.loadData[index].advicePrice = ''
-          console.log(item.advicePrice, '-----pppppp')
-        })
-      }
     }
-
   }
 }
 </script>