Pārlūkot izejas kodu

fix: 销售政策订单调整

Howie 1 gadu atpakaļ
vecāks
revīzija
4c3d762524
1 mainītis faili ar 36 papildinājumiem un 6 dzēšanām
  1. 36 6
      src/views/supply/policy/components/retail_form.vue

+ 36 - 6
src/views/supply/policy/components/retail_form.vue

@@ -348,11 +348,12 @@
             <el-col :xs="24" :sm="12" :lg="12">
             <el-col :xs="24" :sm="12" :lg="12">
               <el-form-item label="规格型号">
               <el-form-item label="规格型号">
                 <div style="display: flex">
                 <div style="display: flex">
-                  <el-input v-model="screenForm.specification" placeholder="请输入规格型号" />
+                  <el-input v-model="screenForm.specification"    :disabled="disabled" placeholder="请输入规格型号" />
                   <el-button
                   <el-button
                     style="margin-left: 10px"
                     style="margin-left: 10px"
                     type="primary"
                     type="primary"
                     size="mini"
                     size="mini"
+                    :disabled="disabled"
                     @click="handleGetPolicyList"
                     @click="handleGetPolicyList"
                   >查询</el-button>
                   >查询</el-button>
                 </div>
                 </div>
@@ -415,7 +416,7 @@
             </el-col>
             </el-col>
           </el-row>
           </el-row>
         </el-form>
         </el-form>
-        <template v-if="!dataList.length">
+        <template v-if="policyType == 'PROVISION'">
           <div v-for="(item, index) in popDataArr" :key="index">
           <div v-for="(item, index) in popDataArr" :key="index">
             <div style="padding: 20px 0">
             <div style="padding: 20px 0">
               <div v-if="index == 0">限定机型</div>
               <div v-if="index == 0">限定机型</div>
@@ -798,7 +799,8 @@ export default {
       commercialType: false,
       commercialType: false,
       correspondName: '',
       correspondName: '',
       correspondId: '',
       correspondId: '',
-      btnLoading: false
+      btnLoading: false,
+      policyType: 'PROVISION'
     }
     }
   },
   },
 
 
@@ -1048,16 +1050,20 @@ export default {
     },
     },
     // 选择销售政策获取政策条件列表
     // 选择销售政策获取政策条件列表
     async handlePolicy(e) {
     async handlePolicy(e) {
-      console.log(e)
+      console.log(e )
       this.totalArr = []
       this.totalArr = []
       this.multipleSelections = []
       this.multipleSelections = []
       this.dataList = []
       this.dataList = []
       this.popDataArr = []
       this.popDataArr = []
       this.screenForm.saleTypeCode = ''
       this.screenForm.saleTypeCode = ''
 
 
-      const policy = this.policyList.filter(k => {
+      const policy = this.policyList.find(k => {
         return k.code === e
         return k.code === e
-      })[0]
+      })
+      if(!policy){
+        return  this.$errorMsg('政策不存在')
+      }
+
       this.commercialType = policy.commercialType
       this.commercialType = policy.commercialType
       if (this.commercialType) {
       if (this.commercialType) {
         if (this.websitNumber === 'GZ') {
         if (this.websitNumber === 'GZ') {
@@ -1068,6 +1074,7 @@ export default {
       } else {
       } else {
         this.mainForm.isPlanOrder = true
         this.mainForm.isPlanOrder = true
       }
       }
+      this.policyType = policy.type
       console.log(policy.type)
       console.log(policy.type)
       if (policy.type == 'PROVISION') {
       if (policy.type == 'PROVISION') {
         // PROVISION 配提
         // PROVISION 配提
@@ -1080,12 +1087,15 @@ export default {
         this.popArr = data[0].pop.split(':')
         this.popArr = data[0].pop.split(':')
 
 
         if (this.policyId) {
         if (this.policyId) {
+          console.log('存在')
           this.screenForm.policyId = this.policyId
           this.screenForm.policyId = this.policyId
           if (this.listItem) {
           if (this.listItem) {
             this.policyConditionId = data[0].id
             this.policyConditionId = data[0].id
             console.log('edit', this.policyConditionId)
             console.log('edit', this.policyConditionId)
           }
           }
         } else {
         } else {
+          console.log('不存在')
+
           this.screenForm.policyId = data[0].policyId
           this.screenForm.policyId = data[0].policyId
           this.policyConditionId = data[0].id
           this.policyConditionId = data[0].id
           console.log('xinz', this.policyConditionId)
           console.log('xinz', this.policyConditionId)
@@ -1098,6 +1108,7 @@ export default {
         // LIMIT 限量
         // LIMIT 限量
         this.getMaterialTypeList('sProvision')
         this.getMaterialTypeList('sProvision')
       }
       }
+      console.log(  this.screenForm.policyId , this.policyId, '政策id')
     },
     },
     hendleEdit(val, index) {
     hendleEdit(val, index) {
       this.dialogVisible = false
       this.dialogVisible = false
@@ -1138,6 +1149,7 @@ export default {
         specification: this.screenForm.specification
         specification: this.screenForm.specification
       })
       })
       this.policyList = data.records
       this.policyList = data.records
+
       if (data.records.length) {
       if (data.records.length) {
         this.handlePolicy(data.records[0].code)
         this.handlePolicy(data.records[0].code)
       }
       }
@@ -1896,6 +1908,22 @@ export default {
     },
     },
     // 保存
     // 保存
     clickSubmitForm() {
     clickSubmitForm() {
+      console.log({
+            isAllDirect: this.mainForm.isAllDirect,
+            theTime: this.mainForm.date,
+            k3ServiceId: this.mainForm.k3ServiceId,
+            k3ServiceName: this.mainForm.k3ServiceName,
+            isPlanOrder: this.mainForm.isPlanOrder,
+            commercialType: this.commercialType,
+            correspondName: this.correspondName,
+            correspondId: this.correspondId,
+            remark: this.mainForm.remark,
+            type: 2, // 1:普通零售单,2:政策零售单
+            retailOrderItemList: this.goodsList,
+            policyId: this.policyId,
+            fileNo: this.mainForm.fileNum
+          })
+          return
       this.$refs.mainForm.validate(valid => {
       this.$refs.mainForm.validate(valid => {
         if (valid) {
         if (valid) {
           // let mainName =
           // let mainName =
@@ -1904,6 +1932,7 @@ export default {
           //   ].dictValue;
           //   ].dictValue;
           this.goodsList.userList = []
           this.goodsList.userList = []
           this.goodsList.forEach(k => {
           this.goodsList.forEach(k => {
+            k.policyId = this.policyId
             delete k.userList
             delete k.userList
           })
           })
           const hasCustomerWalletId = this.goodsList.find((k, i) => {
           const hasCustomerWalletId = this.goodsList.find((k, i) => {
@@ -1947,6 +1976,7 @@ export default {
             console.log('添加成功', this.policyConditionId)
             console.log('添加成功', this.policyConditionId)
             params.retailOrderItemList.forEach(k => {
             params.retailOrderItemList.forEach(k => {
               k.id = null
               k.id = null
+              k.policyId = this.policyId
               k.policyConditionId = this.policyConditionId
               k.policyConditionId = this.policyConditionId
             })
             })
             addData(params).then(res => {
             addData(params).then(res => {