瀏覽代碼

fix: 销售政策 价格类型带出钱包

zh 2 年之前
父節點
當前提交
c57d58b13a

+ 30 - 2
src/views/basic_data/priceSalesType.vue

@@ -34,6 +34,16 @@
         <el-form-item label="销售类型编码" prop="saleCode">
           <el-input v-model="formData.saleCode" disabled placeholder="请选择销售类型生成" />
         </el-form-item>
+        <el-form-item label="钱包" prop="walletId">
+          <el-select v-model="formData.walletId" placeholder="请选择钱包名称" clearable filterable @change="handleWalletChange">
+            <el-option
+              v-for="item in walletList"
+              :key="item.id"
+              :label="item.name"
+              :value="item.id"
+            />
+          </el-select>
+        </el-form-item>
         <el-form-item label="状态" prop="status">
           <el-switch v-model="formData.status" :active-value="true" :inactive-value="false" />
         </el-form-item>
@@ -52,7 +62,7 @@ import TemplatePage from '@/components/template/template-page-1.vue'
 import import_mixin from '@/components/template/import_mixin.js'
 import add_callback_mixin from '@/components/template/add_callback_mixin.js'
 import Popu from '@/components/template/popu.vue'
-import { saleTypeRebateListV2 } from '@/api/policy_list'
+import { saleTypeRebateListV2, getNoRebateWalletList } from '@/api/policy_list'
 import {
   getProductPriceListV2,
   getPriceSalesRelaListV2,
@@ -120,10 +130,13 @@ export default {
         priceTypeId: '',
         saleId: '',
         saleCode: '',
+        walletId: '',
+        walletName: '',
         status: true
       },
       priceTypeList: [],
-      saleypeList: []
+      saleypeList: [],
+      walletList: []
     }
   },
   methods: {
@@ -216,6 +229,7 @@ export default {
       this.visible = true
       this.getProductPriceListV2()
       this.getSaleTypeRebateListV2()
+      this.getNoRebateWalletList()
     },
     handleChange(e) {
       if (e) {
@@ -224,6 +238,13 @@ export default {
         this.formData.saleCode = ''
       }
     },
+    handleWalletChange(e) {
+      if (e) {
+        this.formData.walletName = this.walletList.find(k => k.id === e).name
+      } else {
+        this.formData.walletName = ''
+      }
+    },
     getProductPriceListV2() {
       getProductPriceListV2({
         'pageNum': 1,
@@ -250,6 +271,13 @@ export default {
         this.saleypeList = res.data.records
       })
     },
+    getNoRebateWalletList() {
+      getNoRebateWalletList({
+        walletName: ''
+      }).then(res => {
+        this.walletList = res.data
+      })
+    },
     async getDetail(priceSaleTypeRelaId) {
       const { data } = await getPriceSalesRelaDetail({ priceSaleTypeRelaId })
       this.formData = { ...data }

+ 19 - 5
src/views/sales_policy/components/AddPolicy.vue

@@ -334,6 +334,8 @@
                   size="mini"
                   multiple
                   filterable
+                  disabled
+                  placeholder="请选择价格类型带出钱包"
                   @change="setText($event, scope.$index, scope.row, 'walletIds')"
                 >
                   <el-option v-for="item in NoRebateWalletList" :key="item.id" :label="item.name" :value="item.id" />
@@ -610,12 +612,22 @@ export default {
       })
     },
     setText(e, index, row, name) {
-      if (name === 'priceType') {
-        console.log(e, this.priceList.find(k => k.priceTypeId === e).priceTypeName)
-        this.dataList[index][name] = this.priceList.find(k => k.priceTypeId === e).priceTypeName
-        return
+      if (e) {
+        if (name === 'priceType') {
+          const item = this.priceList.find(k => k.priceTypeId === e)
+          this.dataList[index][name] = item.priceTypeName
+          this.$set(row, 'walletIds', [])
+
+          if (item.walletId) {
+            this.$set(row, 'walletIds', [...row.walletIds, item.walletId])
+          }
+          return
+        }
+        this.dataList[index][name] = row[name]
+      } else {
+        this.dataList[index][name] = ''
+        this.$set(row, 'walletIds', [])
       }
-      this.dataList[index][name] = row[name]
     },
     // 下载excel模板
     handleDownloadFiles() {
@@ -1061,6 +1073,8 @@ export default {
       })
     },
     handlePriceType(e) {
+      this.priceList = []
+
       if (e.saleTypeCode) {
         this.getPriceSalesRelaListV2(e.saleTypeCode)
       }

+ 15 - 5
src/views/sales_policy/components/editPolicy.vue

@@ -653,12 +653,21 @@ export default {
       })
     },
     setText(e, index, row, name) {
-      if (name === 'priceType') {
-        console.log(e, this.priceList.find(k => k.priceTypeId === e).priceTypeName)
-        this.dataList[index][name] = this.priceList.find(k => k.priceTypeId === e).priceTypeName
-        return
+      if (e) {
+        if (name === 'priceType') {
+          const item = this.priceList.find(k => k.priceTypeId === e)
+          this.dataList[index][name] = item.priceTypeName
+          this.$set(row, 'walletIds', [])
+          if (item.walletId) {
+            this.$set(row, 'walletIds', [...row.walletIds, item.walletId])
+          }
+          return
+        }
+        this.dataList[index][name] = row[name]
+      } else {
+        this.dataList[index][name] = ''
+        this.$set(row, 'walletIds', [])
       }
-      this.dataList[index][name] = row[name]
     },
     // 下载excel模板
     handleDownloadFiles() {
@@ -1152,6 +1161,7 @@ export default {
       })
     },
     handlePriceType(e) {
+      this.priceList = []
       if (e.saleTypeCode) {
         this.getPriceSalesRelaListV2(e.saleTypeCode)
       }