Browse Source

fix: 置换单调整

zh 2 years ago
parent
commit
cd6807af5f
1 changed files with 191 additions and 27 deletions
  1. 191 27
      src/views/supply/displace/displace_list.vue

+ 191 - 27
src/views/supply/displace/displace_list.vue

@@ -62,7 +62,7 @@
     <div class="main-title">
       <div class="title">可置换产品信息</div>
       <div>
-        <!-- <el-radio-group v-model="isEquivalent" :disabled="orderList.length">
+        <el-radio-group v-model="isEquivalent" :disabled="!!orderList.length" @change="handleRadioChange">
           <el-radio
             v-for="item in [
               { label: '同价置换', value: 0 },
@@ -70,9 +70,8 @@
             ]"
             :key="item.value"
             :label="item.value"
-            >{{ item.label }}</el-radio
-          >
-        </el-radio-group> -->
+          >{{ item.label }}</el-radio>
+        </el-radio-group>
         <el-button size="mini" type="primary" @click="openKeGoodsDialog">选择机型</el-button>
       </div>
     </div>
@@ -218,7 +217,168 @@
       </div>
     </div>
     <div class="table">
-      <el-table :data="orderList" border fit highlight-current-row stripe>
+      <el-table v-show="isEquivalent === 0" :data="orderList" border fit highlight-current-row stripe>
+        <el-table-column align="left" label="订单号" prop="id" min-width="120" show-overflow-tooltip />
+        <el-table-column align="left" label="经销商信息" prop="displaceOrderId" min-width="250" show-overflow-tooltip>
+          <template slot-scope="scope">
+            {{ scope.row.customerName + '(' + scope.row.customerNumber + ')' }}
+          </template>
+        </el-table-column>
+        <el-table-column align="center" label="被置换机型" prop="displaceOrderId" min-width="160" show-overflow-tooltip>
+          <el-table-column
+            align="left"
+            label="销售类型"
+            prop="saleTypeName"
+            min-width="100"
+            show-overflow-tooltip
+          />
+          <el-table-column
+            align="left"
+            label="产品名称"
+            prop="materialName"
+            min-width="160"
+            show-overflow-tooltip
+          />
+          <el-table-column
+            align="left"
+            label="规格型号"
+            prop="specification"
+            min-width="250"
+            show-overflow-tooltip
+          />
+          <el-table-column
+            align="right"
+            label="单价"
+            prop="price"
+            min-width="100"
+            show-overflow-tooltip
+          />
+          <el-table-column
+            align="right"
+            label="可被置换数量"
+            prop="refundableQty"
+            min-width="100"
+            show-overflow-tooltip
+          />
+          <el-table-column
+            align="left"
+            label="返利类型"
+            prop="rebateWalletName"
+            min-width="100"
+            show-overflow-tooltip
+          />
+          <el-table-column
+            align="right"
+            label="使用返利金额"
+            prop="payRebateAmount"
+            min-width="100"
+            show-overflow-tooltip
+          />
+          <el-table-column
+            align="right"
+            label="格力折扣"
+            prop="totalDiscAmount"
+            min-width="100"
+            show-overflow-tooltip
+          />
+          <el-table-column
+            align="left"
+            label="现金钱包"
+            prop="walletName"
+            min-width="100"
+            show-overflow-tooltip
+          />
+          <el-table-column
+            align="right"
+            label="实付金额"
+            prop="payAmount"
+            min-width="100"
+            show-overflow-tooltip
+          />
+        </el-table-column>
+        <el-table-column align="center" label="置换机型" prop="displaceOrderId" min-width="160" show-overflow-tooltip>
+          <el-table-column
+            align="left"
+            label="销售类型"
+            prop="saleTypeName"
+            min-width="160"
+            show-overflow-tooltip
+          />
+          <el-table-column
+            align="left"
+            label="产品名称"
+            prop="ke_materialName"
+            min-width="160"
+            show-overflow-tooltip
+          />
+          <el-table-column
+            align="left"
+            label="规格型号"
+            prop="ke_specification"
+            min-width="350"
+            show-overflow-tooltip
+          />
+          <el-table-column
+            align="right"
+            label="单价"
+            prop="price"
+            min-width="100"
+            show-overflow-tooltip
+          />
+          <el-table-column align="right" label="置换数量" prop="ke_refundableQty" min-width="100" show-overflow-tooltip>
+            <template slot-scope="scope">
+              <el-input v-model="scope.row.ke_refundableQty" size="mini" type="number" />
+            </template>
+          </el-table-column>
+          <el-table-column
+            align="left"
+            label="返利类型"
+            prop="rebateWalletName"
+            min-width="100"
+            show-overflow-tooltip
+          />
+          <el-table-column
+            align="right"
+            label="使用返利金额"
+            prop="singleRebateAmount"
+            min-width="100"
+            show-overflow-tooltip
+          >
+            <template slot-scope="scope">
+              {{ scope.row.singleRebateAmount * scope.row.ke_refundableQty }}
+            </template>
+          </el-table-column>
+          <el-table-column
+            align="right"
+            label="格力折扣"
+            prop="discAmount"
+            min-width="100"
+            show-overflow-tooltip
+          />
+          <el-table-column
+            align="left"
+            label="现金钱包"
+            prop="walletName"
+            min-width="100"
+            show-overflow-tooltip
+          />
+          <el-table-column align="right" label="实付金额" prop="payAmount" min-width="100" show-overflow-tooltip>
+            <template slot-scope="scope">
+              {{
+                scope.row.price * scope.row.ke_refundableQty -
+                  scope.row.singleRebateAmount * scope.row.ke_refundableQty -
+                  scope.row.discAmount
+              }}
+            </template>
+          </el-table-column>
+        </el-table-column>
+        <el-table-column align="center" label="操作" min-width="100" fixed="right">
+          <template slot-scope="scope">
+            <el-button type="text" @click="deleteOrderList(scope.$index)">删除</el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+      <el-table v-show="isEquivalent === 1" :data="orderList" border fit highlight-current-row stripe>
         <el-table-column align="left" label="订单号" prop="id" min-width="120" show-overflow-tooltip />
         <el-table-column align="left" label="经销商信息" prop="displaceOrderId" min-width="250" show-overflow-tooltip>
           <template slot-scope="scope">
@@ -949,7 +1109,7 @@ export default {
         { label: '家用产品价格表', value: '2' },
         { label: '商用产品价格表', value: '3' }
       ],
-      isEquivalent: 1,
+      isEquivalent: 0,
       saleList: [],
       rebateSaletypelist: [],
       priceTypeLilst: []
@@ -959,8 +1119,7 @@ export default {
     keGoodsList: {
       deep: true,
       handler: function(val, oal) {
-        if (this.orderList.length && this.type === 2) {
-
+        if (this.orderList.length && this.type === 2 && this.isEquivalent === 1) {
           this.orderList.forEach(item => {
             item.ke_materialName = val[0].name
             item.ke_specification = val[0].specification
@@ -973,9 +1132,7 @@ export default {
             item.ke_walletRebateId = val[0].walletRebateId
             item.ke_discAmount = val[0].discAmount
             item.ke_rebateRate = val[0].rebateRate
-
           })
-
         }
       }
     }
@@ -1021,6 +1178,7 @@ export default {
           this.$set(row, 'rebateWalletName', item.name)
           this.$set(row, 'walletRebateId', item.walletRebateId)
           this.$set(row, 'rebateRate', item.rebateRate)
+          console.log( item.rebateRate)
         }
       } else {
         this.$set(row, 'rebateWalletName', '')
@@ -1231,14 +1389,16 @@ export default {
       }
       // 批量置换(单选)
       else {
-        this.$set(item, 'saleTypeName', '')
-        this.$set(item, 'saleTypeCode', '')
-        this.$set(item, 'saleTypeId', '')
-        this.$set(item, 'price', 0)
-        this.$set(item, 'discAmount', 0)
-        this.$set(item, 'rebateWalletName', '')
-        this.$set(item, 'walletRebateId', '')
-        this.$set(item, 'rebateRate', '')
+        if (this.isEquivalent === 1) {
+          this.$set(item, 'saleTypeName', '')
+          this.$set(item, 'saleTypeCode', '')
+          this.$set(item, 'saleTypeId', '')
+          this.$set(item, 'price', 0)
+          this.$set(item, 'discAmount', 0)
+          this.$set(item, 'rebateWalletName', '')
+          this.$set(item, 'walletRebateId', '')
+          this.$set(item, 'rebateRate', '')
+        }
 
         this.keGoodsList = [item]
       }
@@ -1337,14 +1497,16 @@ export default {
           item.ke_materialName = this.keGoodsList[0].name
           item.ke_specification = this.keGoodsList[0].specification
           item.ke_refundableQty = ''
-          item.ke_saleTypeName = this.keGoodsList[0].saleTypeName
-          item.ke_saleTypeCode = this.keGoodsList[0].saleTypeCode
-          item.ke_saleTypeId = this.keGoodsList[0].saleTypeId
-          item.ke_price = this.keGoodsList[0].price
-          item.ke_rebateWalletName = this.keGoodsList[0].rebateWalletName
-          item.ke_walletRebateId = this.keGoodsList[0].walletRebateId
-          item.ke_discAmount = this.keGoodsList[0].discAmount
-          item.ke_rebateRate = this.keGoodsList[0].rebateRate
+          if (this.isEquivalent === 1) {
+            item.ke_saleTypeName = this.keGoodsList[0].saleTypeName
+            item.ke_saleTypeCode = this.keGoodsList[0].saleTypeCode
+            item.ke_saleTypeId = this.keGoodsList[0].saleTypeId
+            item.ke_price = this.keGoodsList[0].price
+            item.ke_rebateWalletName = this.keGoodsList[0].rebateWalletName
+            item.ke_walletRebateId = this.keGoodsList[0].walletRebateId
+            item.ke_discAmount = this.keGoodsList[0].discAmount
+            item.ke_rebateRate = this.keGoodsList[0].rebateRate
+          }
         })
         this.orderList = this.orderList.concat(orderList)
       }
@@ -1390,7 +1552,6 @@ export default {
           }
         })
       }
-      console.log(params, 999)
       addDisplace(params).then(res => {
         this.$successMsg('提交成功')
         this.resetForm()
@@ -1402,6 +1563,9 @@ export default {
       this.beiGoodsList = []
       this.keGoodsList = []
       this.orderList = []
+    },
+    handleRadioChange() {
+      this.keGoodsList = []
     }
   }
 }