Ver Fonte

政策编辑功能

howie há 3 anos atrás
pai
commit
8da4e9d884

+ 21 - 42
src/views/sales_policy/components/TabelTransfer.vue

@@ -159,19 +159,11 @@
 </template>
 
 <script>
-import {
-  deleteCondition,
-  deleteMaterialPolicy,
-  getConditionList,
-  getCrList,
-  getCustomerList,
-  toExamine
-} from '@/api/policy_list'
+import { deleteCondition, deleteMaterialPolicy, getConditionList, getCrList, getCustomerList } from '@/api/policy_list'
 import { downloadFiles, handleImport } from '@/utils/util'
 import EditCondition from './EditCondition'
 import ImageUpload from '@/components/Common/image-upload.vue'
 import Minxin from '@/mixin'
-import { mapState } from 'vuex'
 
 export default {
   name: 'Examine',
@@ -180,10 +172,12 @@ export default {
     ImageUpload
   },
   mixins: [Minxin],
+  // eslint-disable-next-line vue/require-prop-types
+  props: ['code'],
   data() {
     return {
-      keyword:'',
-      region:'',
+      keyword: '',
+      region: '',
       baseURL: '',
       dcurrentPage: 1,
       dpageSize: 10,
@@ -237,17 +231,23 @@ export default {
           value: 'LIMIT',
           label: '限量'
         }
-      ]
+      ],
+      comCode: ''
     }
   },
-  computed: {
-    ...mapState({
-      comCode: (state) => state.sales.code ,
-    }),
+  created() {
+      this.comCode = this.code
+    console.log(this.code,'kkkkk')
+      this.getCond()
+  },
+  updated() {
+    this.comCode = this.code
+    console.log(this.code,'kkkkk')
   },
   methods: {
     getList() {
       this.getCrList()
+      this.getCond()
     },
     getCrList() {
       const customerParams = {
@@ -306,13 +306,11 @@ export default {
           confirmButtonText: '确定'
         })
         for (let i = 0; i < result.data.length; i++) {
-          result.data[i].customerNumber =  result.data[i].number
+          result.data[i].customerNumber = result.data[i].number
           result.data[i].customerName = result.data[i].name
         }
         if (this.custoList.length) {
-
           this.custoList = [...this.custoList, ...this.resArr(this.custoList, result.data)]
-
         } else {
           this.custoList = result.data
         }
@@ -339,39 +337,23 @@ export default {
       )
     },
     getCond() {
+      console.log(this.code , 'hhjkhkj',this.comCode,'999999')
       this.listLoading = true
       const custoParams = {
         pageNum: this.currentPages,
         pageSize: this.pageSizes,
-        policyId: this.comCode
+        policyId: this.comCode || this.code
       }
       getCustomerList(custoParams).then((res) => {
         this.custoList = res.data.records
-        console.log(this.custoList,'已选的')
+        console.log(this.custoList, '已选的')
         this.clistTotals = res.data.total
         this.listLoading = false
         // this.getCrList()
       })
     },
-    handleSubmit() {
-      toExamine({
-        examineStatus: this.examineStatus,
-        policyId: this.$parent.id,
-        examineRemark: this.remark
-      }).then((res) => {
-        this.$successMsg('已提交审核')
-        this.$parent.isShow = 1
-        this.$parent.getList()
-      })
-    },
-
     handleCondition(id, index) {
       deleteCondition({ id }).then((res) => {
-        // this.conditionList.splice(index, 1);
-        // Object.assign(
-        //   this.$children[9].$data,
-        //   this.$children[9].$options.data()
-        // );
         this.getConditionList()
         this.$successMsg('删除成功')
       })
@@ -389,7 +371,6 @@ export default {
       const params = { policyMaterialId: id }
       deleteMaterialPolicy(params).then((res) => {
         this.$successMsg('删除成功')
-
       })
     },
     /**
@@ -487,12 +468,10 @@ export default {
               this.$set(this.dataL[i], 'disabled', false)
               // this.dataL[i].disabled = false
             }
-
           }
         }
         const arr = this.resArr(this.custoList, this.rightData)
         this.custoList = arr
-
       } else {
         this.$errorMsg('请选择要删除的经销商')
       }
@@ -504,7 +483,7 @@ export default {
     // 提交数据
 
     async handleSave() {
-        this.$emit('handlEditPolicy', this.custoList)
+      this.$emit('handlEditPolicy', this.custoList)
     },
     handleReset() {
       this.dataR = this.rightData = []

+ 9 - 20
src/views/sales_policy/components/editPolicy.vue

@@ -405,12 +405,12 @@
             </el-row>
             <el-divider />
           </el-row>
-          <TabelTransfer @handlEditPolicy="handlEditPolicy" @handleReset="handleReset"/>
+          <TabelTransfer v-if="detail && detail.code" :code="detail.code" @handlEditPolicy="handlEditPolicy" @handleReset="handleReset" />
         </div>
       </div>
     </div>
     <AddCondition
-      v-show="isCondition == 1"
+      v-show="isCondition === 1"
       @handleSubmitCon="handleSubmitCon"
     />
   </div>
@@ -509,7 +509,8 @@ export default {
       NoRebateWalletList: [],
       sleectBox: { currentPage: 1 },
       dpageSize: 10,
-      dcurrentPage: 1
+      dcurrentPage: 1,
+      detail:{}
     }
   },
   computed: {
@@ -687,7 +688,6 @@ export default {
     getList() {
       getPolicyDetail({ policyId: this.$parent.id }).then((res) => {
         this.detail = res.data
-
         this.searchForm = {
           code: this.detail.code,
           endTime: this.detail.endTime,
@@ -710,7 +710,6 @@ export default {
         this.handletwoList()
         // 获取条件政策
         this.handleSubmitCon()
-        this.getCond()
       })
       if (this.$parent.isFlag) {
         this.handletwoList()
@@ -797,9 +796,9 @@ export default {
         var arr = []
         policyCustomers.forEach((el) => {
           arr.push({
-            customerId: el.id,
-            customerName: el.name,
-            customerNumber: el.number,
+            customerId: el.customerId || el.customerId,
+            customerName: el.name || el.customerName,
+            customerNumber: el.number || el.customerNumber,
             lastOrderTime: '',
             limitTakeNum: 0,
             policyId: this.searchForm.code,
@@ -813,20 +812,10 @@ export default {
         //   }
         // });
         const params = {
-          adminCompanyId: '',
-          code: '',
-          customerCount: 0,
-          examineBy: '',
-          examineRemark: '',
-          examineStatus: '',
-          id: this.detail.id,
-          policyCustomers: arr,
-          remark: '',
-          status: true,
-          title: '',
-          type: '',
+          ...this.detail,
           ...this.searchForm,
           endTime: this.searchForm.endTime || '2100-01-01 00:00:00',
+          policyCustomers: arr,
           imgSrc: this.fileList.length ? this.fileList[0].url : ''
         }
         console.log(this.fileList)