Sfoglia il codice sorgente

feat: 销售政策

zh 2 anni fa
parent
commit
e4e9910d1a

+ 13 - 9
src/views/sales_policy/components/AddCondition.vue

@@ -1,7 +1,7 @@
 <template>
-  <el-container class="app-container mymian-container">
+  <el-container class="">
     <el-header height="50px" class="header">
-      <el-page-header @back="handleBack" :content="!id ? (!edit ? '新增' : '编辑') : '详情页面'"> </el-page-header>
+      <el-page-header @back="handleBack" :content="content"> </el-page-header>
     </el-header>
     <div class="line">
       <el-divider></el-divider>
@@ -438,17 +438,20 @@ export default {
   },
 
   computed: mapState({
-    comCode: state => state.sales.code
+    comCode: state => state.sales.code,
+    content() {
+      const textArr = ['新增', '编辑', '详情']
+      const isShow = this.$parent.$parent.$parent.$parent.isShow - 2
+      let len = isShow ? 2 : isShow
+      return textArr[len]
+    }
   }),
   methods: {
     getList() {},
     handleBack() {
-      if (this.$parent.$parent.$parent.$parent.isShow == 10) {
-        this.$parent.$parent.$parent.$parent.isShow = 8
-      } else if (this.$parent.$parent.$parent.$parent.isShow == 12) {
-        this.$parent.$parent.$parent.$parent.isShow = 4
-      } else if (this.$parent.$parent.$parent.isShow == 12) {
-        this.$parent.$parent.$parent.isShow = 4
+      const isShow = this.$parent.$parent.$parent.$parent.isShow
+      if ([4, 5].includes(isShow)) {
+        this.$parent.isEdit = 1
       } else {
         this.$parent.isCondition = 0
         Object.assign(this.$data, this.$options.data())
@@ -484,6 +487,7 @@ export default {
         const res = await getConditionMaterialDetail({
           id: this.policyId || policyId || this.id
         })
+        console.log()
         this.pop = res.data.pop
         let pop = res.data.pop.split(':')
         this.conditionBox = []

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

@@ -1,5 +1,5 @@
 <template>
-  <div class="app-container">
+  <div>
     <div v-show="isCondition == 0">
       <!-- <el-header height="50px" class="header">
         <el-page-header content="新增" @back=";($parent.isShow = 1), ($parent.isFlag = '')" />
@@ -842,7 +842,6 @@ export default {
     },
     // 提交审核
     handleAddPolicy(policyCustomers, region) {
-      console.log(region, 'jkjkj')
       if (!this.searchForm.title) {
         this.$errorMsg('请输入说明')
         return
@@ -899,9 +898,7 @@ export default {
         addPoliy(params).then(res => {
           console.log(res)
           this.$successMsg('新增成功')
-          // this.$parent.getList()
-          this.$parent.$parent.$refs.pageRef.refreshList()
-          this.$parent.$parent.isShow = 1
+          this.$emit('close')
         })
       }
 

+ 14 - 75
src/views/sales_policy/components/Examine.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="app-container">
+  <div class="">
     <div v-if="isEdit == 1">
       <!-- <el-header height="50px" class="header">
         <el-page-header :content="funTitle()" @back=";($parent.isShow = 1), ($parent.id = '')" />
@@ -86,7 +86,7 @@
             </el-col>
           </el-row>
 
-          <el-row v-if="detail.imgSrc && $parent.$parent.$parent.isShow !== 5" class="img-box">
+          <el-row v-if="detail.imgSrc" class="img-box">
             <el-col :span="24" class="item">
               <div class="label" style="height: 150px">政策封面图</div>
               <div class="value" style="height: 150px">
@@ -116,14 +116,6 @@
               </div>
             </el-col>
           </el-row>
-          <el-row v-if="$parent.$parent.$parent.isShow == 5">
-            <el-col :span="24" class="item">
-              <div class="label" style="height: 150px">政策封面图</div>
-              <div class="value" style="height: 150px">
-                <ImageUpload :file-list="fileList" :multiple="false" />
-              </div>
-            </el-col>
-          </el-row>
           <el-row v-if="this.$parent.$parent.$parent.isShow == 4">
             <el-col :span="8" class="item">
               <div class="label">审核人</div>
@@ -174,17 +166,6 @@
                   ex-text="导出货品"
                   :ex-params="{ policyId: detail.code }"
                 />
-
-                <el-upload
-                  v-if="$parent.$parent.$parent.isShow == 5"
-                  class="import-btn"
-                  :action="baseURL + 'student/import'"
-                  :http-request="handleImport"
-                  :file-list="importFileList"
-                  :show-file-list="false"
-                >
-                  <el-button size="small">导入货品价格表</el-button>
-                </el-upload>
               </el-col>
               <el-col :span="12" class="tr">
                 <!-- <el-button size="small" @click="$parent.isShow = 10"
@@ -266,30 +247,6 @@
                 {{ scope.row.status ? '启用' : '作废' }}
               </template>
             </el-table-column>
-            <!-- <el-table-column
-              label="操作"
-              align="left"
-              width="150"
-              v-if="$parent.isShow == 5 && detail.examineStatus == 'SAVE'"
-            >
-              <template slot-scope="scope">
-                <el-popconfirm
-                  confirm-button-text="好的"
-                  cancel-button-text="不用了"
-                  icon="el-icon-info"
-                  icon-color="red"
-                  title="内容确定删除吗?"
-                  @onConfirm="hanleDelete(scope.row.id)"
-                >
-                  <el-button
-                    slot="reference"
-                    type="text"
-                    class="textColor el-popover-left"
-                    >删除</el-button
-                  >
-                </el-popconfirm>
-              </template>
-            </el-table-column> -->
           </el-table>
           <!-- 分页 -->
           <div style="margin: 20px 0">
@@ -321,28 +278,10 @@
             </el-table-column>
             <el-table-column label="操作" align="left" width="150">
               <template slot-scope="scope">
-                <template v-if="$parent.$parent.$parent.isShow == 5">
-                  <el-button type="text" size="small" @click="getCommonApi(scope.row)">编辑</el-button>
-                  <el-popconfirm
-                    confirm-button-text="好的"
-                    cancel-button-text="不用了"
-                    icon="el-icon-info"
-                    icon-color="red"
-                    title="内容确定删除吗?"
-                    @onConfirm="handleCondition(scope.row.id, scope.$index)"
-                  >
-                    <el-button slot="reference" type="text" class="textColor el-popover-left">删除</el-button>
-                  </el-popconfirm>
-                </template>
                 <el-button
-                  v-else
                   type="text"
                   size="small"
-                  @click="
-                    ;($parent.$parent.$parent.isShow = 10),
-                      ($parent.$parent.$parent.policyId = scope.row.id),
-                      $parent.$parent.$parent.isShow === 8 ? (detailFang = false) : (detailFang = true)
-                  "
+                  @click="getCommonApi(scope.row)"
                   >查看条件</el-button
                 >
               </template>
@@ -608,7 +547,7 @@
             </div>
           </div>
           <div
-            v-if="$parent.$parent.$parent.isShow == 8 && detail.examineStatus == 'WAIT'"
+            v-if="$parent.$parent.$parent.isShow == 5 && detail.examineStatus == 'WAIT'"
             class="descriptions diy-table-1"
           >
             <el-row>
@@ -635,14 +574,9 @@
             </el-row>
           </div>
         </div>
-        <div>
-          <el-button v-if="$parent.$parent.$parent.isShow == 5" type="primary" size="default" @click="handleSave"
-            >保存</el-button
-          >
-        </div>
       </div>
     </div>
-    <EditCondition v-else :id="cid" :policy-id="cpolicyId" />
+    <AddCondition v-else :id="cid" @close="handleConditionClose"/>
   </div>
 </template>
 
@@ -659,7 +593,7 @@ import {
   updatePolicy,
   getPolicyList
 } from '@/api/policy_list'
-import EditCondition from './EditCondition'
+import AddCondition from './AddCondition'
 import ImageUpload from '@/components/Common/image-upload.vue'
 
 import { handleImport } from '@/utils/util'
@@ -675,7 +609,7 @@ export default {
     }
   },
   components: {
-    EditCondition,
+    AddCondition,
     ImageUpload
   },
   mixins: [Minxin],
@@ -767,6 +701,9 @@ export default {
   },
   created() {},
   methods: {
+    handleConditionClose(){
+      this.isEdit = 1
+    },
     funTitle() {
       console.log()
       let title = '详情页'
@@ -862,6 +799,7 @@ export default {
     },
     // 检查文件类型
     checkFileType(url) {
+
       if (!url) return ''
       const fileSuffix = url.substring(url.lastIndexOf('.') + 1)
 
@@ -901,8 +839,9 @@ export default {
       this.handletwoList()
     },
     getCommonApi(row) {
-      ;(this.isEdit = 2), (this.cid = row.id), (this.cpolicyId = row.policyId)
-      console.log(this.cpolicyId, this.detail.code, this.cpolicyId == this.detail.code)
+     this.isEdit = 2
+     this.cid = row.id
+     this.cpolicyId = row.policyId
     },
     getCond() {
       this.listLoading = true

+ 11 - 13
src/views/sales_policy/components/details.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="app-container mymain-container">
+  <div class="">
     <div v-if="isEdit == 1">
       <!-- <el-header height="50px" class="header">
         <el-page-header :content="funTitle()" @back=";($parent.isShow = 1), ($parent.id = '')" />
@@ -348,13 +348,7 @@
                       <el-button slot="reference" type="text" class="textColor el-popover-left">删除</el-button>
                     </el-popconfirm>
                   </template>
-                  <el-button
-                    v-else
-                    type="text"
-                    size="mini"
-                    @click=";($parent.$parent.$parent.isShow = 12), ($parent.$parent.$parent.policyId = scope.row.id)"
-                    >查看条件</el-button
-                  >
+                  <el-button v-else type="text" size="mini" @click="getCommonApi(scope.row)">查看条件</el-button>
                 </template>
               </el-table-column>
             </el-table>
@@ -694,7 +688,7 @@
         </div>
       </div>
     </div>
-    <EditCondition v-else :id="cid" :policy-id="cpolicyId" />
+    <AddCondition v-else :id="cid" @close="handleConditionClose" />
   </div>
 </template>
 
@@ -711,7 +705,7 @@ import {
   updatePolicy,
   getPolicyList
 } from '@/api/policy_list'
-import EditCondition from './EditCondition'
+import AddCondition from './AddCondition'
 import ImageUpload from '@/components/Common/image-upload.vue'
 
 import { handleImport } from '@/utils/util'
@@ -721,7 +715,7 @@ import Minxin from '@/mixin'
 export default {
   name: 'Examine',
   components: {
-    EditCondition,
+    AddCondition,
     ImageUpload
   },
   mixins: [Minxin],
@@ -817,6 +811,9 @@ export default {
   },
   created() {},
   methods: {
+    handleConditionClose() {
+      this.isEdit = 1
+    },
     funTitle() {
       const title = '详情页'
       return title
@@ -934,8 +931,9 @@ export default {
       this.handletwoList()
     },
     getCommonApi(row) {
-      ;(this.isEdit = 2), (this.cid = row.id), (this.cpolicyId = row.policyId)
-      console.log(this.cpolicyId, this.detail.code, this.cpolicyId == this.detail.code)
+      this.isEdit = 2
+      this.cid = row.id
+      this.cpolicyId = row.policyId
     },
     getCond() {
       this.listLoading = true

+ 2 - 6
src/views/sales_policy/components/editPolicy.vue

@@ -1,6 +1,6 @@
 <template>
   <div>
-    <div v-show="isCondition == 0" class="app-container mymain-container">
+    <div v-show="isCondition == 0" class="">
       <!-- <el-header height="50px" class="header">
         <el-page-header content="编辑" @back=";($parent.isShow = 1), ($parent.isFlag = '')" />
       </el-header> -->
@@ -950,13 +950,9 @@ export default {
           policyCustomers: arr,
           imgSrc: imgUrl.join(',')
         }
-        console.log(this.fileList)
         updatePolicy(params).then(res => {
-          console.log(res)
           this.$successMsg('编辑成功')
-          // this.$parent.getList()
-          this.$parent.$parent.$parent.$refs.pageRef.refreshList()
-          this.isShow = 1
+          this.$emit('close')
         })
       }
 

+ 15 - 43
src/views/sales_policy/policy_list.vue

@@ -1,10 +1,4 @@
 <template>
-  <!-- <AddPolicy v-else-if="isShow === 2" />
-  <AddCondition v-else-if="isShow === 10 || isShow === 12" :id="id" :policy-id="policyId" />
-  <EditPolicy v-else-if="isShow === 5" />
-  <Details v-else-if="isShow === 4" />
-  <Examine v-else /> -->
-
   <template-page
     ref="pageRef"
     :getList="getList"
@@ -17,11 +11,10 @@
   >
     <Popu v-if="isShow !== 1">
       <el-page-header slot="head" :content="content" @back="handleClose" />
-      <AddPolicy v-if="isShow === 2" />
-      <AddCondition v-if="isShow === 10 || isShow === 12" :id="id" :policy-id="policyId" />
-      <EditPolicy v-if="isShow === 5" :id="id" />
-      <Details v-if="isShow === 4" />
-      <Examine v-if="isShow === 8" />
+      <AddPolicy v-if="isShow === 2" @close="handleClose" />
+      <EditPolicy v-if="isShow === 3" :id="id" @close="handleClose" />
+      <Details v-if="isShow === 4" @close="handleClose" />
+      <Examine v-if="isShow === 5" @close="handleClose" />
     </Popu>
   </template-page>
 </template>
@@ -61,19 +54,6 @@ export default {
   data() {
     return {
       showPage: true,
-      // content: '商用工程信息单',
-      // 关闭新增弹窗
-      handleClose: this.addOff(() => {
-        if (this.isShow === 2 || this.isShow === 5) {
-          this.isShow = 1
-        }
-        if (this.isShow === 8 || this.isShow == 4 || this.isShow == 10 || this.isShow == 12) {
-          this.isShow = 1
-          this.id = ''
-        }
-        this.showPage = true
-        this.$refs.pageRef.refreshList()
-      }),
       // 事件组合
       optionsEvensGroup: [
         [
@@ -169,23 +149,8 @@ export default {
   computed: mapState({
     comCode: state => state.sales.code,
     content() {
-      let title = ''
-      if (this.isShow === 10 || this.isShow === 12) {
-        title = '条件'
-      }
-      if (this.isShow === 2) {
-        title = '添加'
-      }
-      if (this.isShow === 5) {
-        title = '编辑'
-      }
-      if (this.isShow === 4) {
-        title = '详情'
-      }
-      if (this.isShow === 8) {
-        title = '审核'
-      }
-      return title
+      const textArr = ['新增', '编辑', '详情', '审核']
+      return textArr[this.isShow - 2]
     }
   }),
   methods: {
@@ -201,6 +166,13 @@ export default {
     selectionChange(data) {
       this.recordSelected = data
     },
+    handleClose() {
+      this.addOff(() => {
+        this.isShow = 1
+        this.showPage = true
+        this.$refs.pageRef.refreshList()
+      })()
+    },
     operation() {
       return (h, { row, index, column }) => {
         return (
@@ -210,7 +182,7 @@ export default {
                 size="mini"
                 type="text"
                 onClick={async () => {
-                  this.isShow = 5
+                  this.isShow = 3
                   this.id = row.id
                 }}
               >
@@ -237,7 +209,7 @@ export default {
                 size="mini"
                 type="text"
                 onClick={async () => {
-                  this.isShow = 8
+                  this.isShow = 5
                   this.id = row.id
                   this.code = row.code
                   this.policyId = row.policyId