Browse Source

feat:结算天数

snow 1 year ago
parent
commit
669b790ad2

+ 4 - 0
src/components/manage/src/letter/_columns.js

@@ -120,6 +120,10 @@ export const project = [
         label: '是否选中',
         _slot_:'is_check'
     },
+    {
+        prop:'settle_day',
+        label:'结算天数'
+    },
     {
         prop:mapFields.status,
         label:'状态',

+ 16 - 5
src/components/manage/src/letter/index.vue

@@ -1,14 +1,14 @@
 <template>
   <div>
     <div style="display:flex;justify-content:flex-end" v-if="!readonly">
-      <el-button size="mini" type="success" @click="onUpdateLetter(false)" v-if="type === 'project'">已有评估函在线编辑</el-button>
+      <el-button size="mini" type="success" @click="handleSelectLetter" v-if="type === 'project'">已有评估函在线编辑</el-button>
       <el-button size="mini" @click="onDownloadTemplate" v-if="type !== 'activity'">下载上传模板</el-button>
       <el-button size="mini" type="primary" @click="handleUploadModalVisible">上传模板数据</el-button>
     </div>
 
     <ex-table
       :columns="[
-        ...(isSelection ? [{ type: 'selection' }] : []),
+        ...(isSelection && type !== 'activity' ? [{ type: 'selection' }] : []),
         ...(mapColumns[type || 'budget']),
         { label: '操作', _slot_: 'action', width: readonly ? '60px' : '120px',fixed: 'right'}
       ]"
@@ -110,6 +110,11 @@
       :sitem="sitem"
       :visible.sync="previewVisible"
     />
+
+    <selection-modal 
+      :visible.sync="visible"
+      :id="id"
+    />
   </div>
 </template>
 
@@ -123,12 +128,14 @@ import { template ,mapLetterToType } from "./_template"
 import mixinPage from "@/mixins/elPaginationHandle";
 import { writeFile, utils } from "xlsx";
 
+import SelectionModal from "./selectionModal.vue"
+
 export default {
   name:'Letter',
   mixins:[mixinPage],
   /* type:budget预算函  activity活动方案  project计划 **/
   props:['title', 'requsetMethod', 'status', 'id', 'isSelection', 'readonly','type', 'beforeModalVisible', 'isFile', 'updateLoading'],
-  components:{ ExcelUploadModal, PreviewModal },
+  components:{ ExcelUploadModal, PreviewModal, SelectionModal },
   data(){
     return {
       table: {
@@ -155,8 +162,9 @@ export default {
       mapTitle,
       mapColumns,
       tableData:[],
-      xlsxVisible:false,
-      previewVisible:false
+      xlsxVisible: false,
+      previewVisible: false,
+      visible: false
     }
   },
   watch:{
@@ -169,6 +177,9 @@ export default {
     }
   },
   methods:{
+    handleSelectLetter(){
+      this.visible = true
+    },
     linkToLetterDetail(id){
       this.$router.push(`/customerService/letterEditing?id=${id}&&readonly=1`)
     },

+ 182 - 0
src/components/manage/src/letter/selectionModal.vue

@@ -0,0 +1,182 @@
+<template>
+  <el-dialog title="选择活动方案" :close-on-click-modal="false" :visible="innerVisible" width="1024px" @close="handleClose" center>
+    <ex-table
+      v-loading="loading"
+      :columns="[{ type: 'selection' }, ...(mapColumns[type || 'budget'])]"
+      @page-curr-change="handlePageChange"
+      @page-size-change="handleSizeChange"
+      :noPagination="noPagination"
+      :page="pageInfo"
+      :sizes="['15']"
+      @screen-reset="
+        pageInfo.curr = 1;
+        parmValue.page = 1;
+        searchList();
+      "
+      @screen-submit="
+        pageInfo.curr = 1;
+        parmValue.page = 1;
+        searchList();
+        "
+      @selection="handleSelection"
+      :table="table"
+      :data="tableData"
+      style="margin: 15px 0 0 0"
+    >
+
+      <template #letter="{scope}">
+        <a v-if="scope.row.plan_file" :href="scope.row.plan_file">{{getFileNameWithUrl(scope.row.plan_file)}}</a>
+        <p v-else>--</p>
+      </template>
+      
+      <template #is_check="{scope}">
+        <el-tag size="mini" :type="Number(scope.row.is_check) === mapCheck[type || 'budget'].ok ? '' :'warning'">
+         {{ Number(scope.row.is_check) === mapCheck[type || 'budget'].ok  ?  "已选择" : "未选择" }}
+        </el-tag>
+      </template>
+
+      <template #status="{scope}">
+        <el-tag size="mini" :type="Number(scope.row.status) === 2 ? '' :'info'">
+          {{(statusOptions.find(({value}) => Number(scope.row.status) === value) || {}).label || '--'}}
+        </el-tag>
+      </template>
+    </ex-table>
+    <div class="flex-end" style="margin-top:10px">
+      <el-button type="primary" :size="'mini'" @click="onActivitySubmit">提交</el-button>
+    </div>
+
+    <settle-day-modal :visible.sync="dayVisible" @change="handleChange" />
+  </el-dialog>
+</template>
+
+<script>
+import { mapColumns, mapCheck, mapTitle } from "./_columns"
+import asyncRequest from "@/apis/components/letter"
+import SettleDayModal from "./settleDayModel.vue"
+
+export default {
+  props: ['visible', 'title', 'requsetMethod', 'isFile', 'type', 'id'],
+  components:{ SettleDayModal },
+  data() {
+    return {
+      table: {
+        stripe: true,
+        border: true,
+        'max-height': '800px'
+      },
+      statusOptions:[
+        { value:1,label:'草稿'},
+        { value:2,label:'已发布'}
+      ],
+      noPagination:false,
+      parmValue:{
+        page: 1, // 页码
+        size: 15, // 每页显示条数
+      },
+      selected: [],
+      pageInfo: {
+        size: 15,
+        curr: 1,
+        total: 0,
+      },
+      sitem: {},
+      mapCheck,
+      mapTitle,
+      mapColumns,
+      tableData:[],
+      dayVisible: false,
+      loading: false
+    }
+  },
+  computed: {
+    innerVisible: {
+      get() {
+        return this.visible
+      },
+      set(newVal) {
+        this.$emit('update:visible', newVal)
+      }
+    }
+  },
+  watch:{
+    visible(){
+      if(!this.visible) return
+      this.searchList()
+    }
+  },
+  methods: {
+    handleClose(){
+      this.tableData = []
+      this.loading = false
+      this.file_url = ""
+      this.innerVisible = false
+      this.dayVisible = false
+    },
+    handleSelection({list}){
+      this.selected = list
+    },
+    async handleChange(settle_day){
+      console.log(this.selected)
+      const { id } = this.selected[0]
+      const { code, data } = await asyncRequest.detail({id})
+      
+      if(code !== 1) {
+        this.loading = false
+        return
+      }
+
+      const { planinfo = [], req_id, store_id, plan_file } = data;
+
+      const plan_info =  planinfo.map(
+        ({ name,service_cat,unit,price,num,remark,total_fee,tax,pay_fee,tax_fee  }) =>
+        ({ name,service_cat,unit,price,num,remark,total_fee,tax,pay_fee,tax_fee  })
+      )
+
+      const letter = await asyncRequest.create({
+        plan_type: 3,
+        file:plan_file,
+        settle_day,
+        plan_info,
+        store_id,
+        req_id
+      })
+
+      this.loading = false
+
+      if(letter.code === 0){
+        this.$emit('abnormal')
+      }
+
+      if(letter.code !== 1) return
+      //创建获取获取新id进入编辑页...
+      this.$router.push(`/customerService/letterEditing?id=${letter.data.id}&from=${3}&type=create`)
+    },
+    async onActivitySubmit(){
+      if(this.selected.length === 0){
+        this.$message.warning('请选择一个活动方案')
+        return
+      }
+
+      if(this.selected.length > 1){
+        this.$message.warning('只能选择一个活动方案')
+        return
+      }
+
+      this.dayVisible = true
+    },
+    async searchList(){
+      this.loading = true
+      const { code, data } = await asyncRequest.list({ 
+          plan_type: 2, 
+          req_id: this.id ,
+          ...this.parmValue
+        })
+      this.loading = false
+      if(code !== 1) return
+      this.tableData = data.list
+      this.noPagination = Number(data.count) <= 15
+      this.pageInfo.total = Number(data.count)
+    }
+  }
+}
+</script>

+ 77 - 0
src/components/manage/src/letter/settleDayModel.vue

@@ -0,0 +1,77 @@
+<template>
+  <el-dialog title="输入结算天数" 
+    center 
+    width="400px"
+    :visible="_visible" 
+    :append-to-body="true" 
+    :close-on-click-modal="false"
+     @close="handleClose"
+     style="z-index:999999"
+    >
+    <el-form label-width="0"
+     size="mini"
+    >
+      <el-form-item prop="settle_day">
+        <digital-input
+            :values="ruleForm.settle_day"
+            :placeholder="'结算天数'"
+            :min="0"
+            :max="100000000000"
+            :position="'right'"
+            :precision="0"
+            :size="'mini'"
+            :controls="false"
+            :append="'天'"
+            @reschange="number_change($event)"
+          />
+      </el-form-item>
+
+      <el-form-item class="flex-end">
+        <el-button type="primary" @click="onSubmit">保存</el-button>
+      </el-form-item>
+    </el-form>
+
+  </el-dialog>
+</template>
+
+<script>
+export default {
+  name: 'SettleDayModal',
+  props: ['visible'],
+  data(){
+    return {
+      ruleForm:{
+       settle_day: 0 
+      },
+    }
+  },
+  computed:{
+    _visible:{
+      get(){
+        return this.visible
+      },
+      set(newValue){
+        this.$emit('update:visible',newValue)
+      }
+    }
+  },
+  methods:{
+    handleClose(){
+      this.ruleForm.settle_day = 0
+      this._visible = false
+    },
+    number_change(day){
+      this.ruleForm.settle_day = Number(day)
+    },
+    onSubmit(){
+      if(Number(this.ruleForm.settle_day) === 0){
+        this.$message.warning('结算天数不能为零!')
+        return
+      }
+
+      this.$emit('change', this.ruleForm.settle_day)
+      this._visible = false
+    }
+  }
+}
+</script>

+ 30 - 1
src/components/manage/src/letter/xlsxUploadModal.vue

@@ -9,6 +9,26 @@
       <search-store size="mini" :value.sync="storeId" :openOptionDisbaled="true" />
     </div>
 
+    <div style="display:flex;align-items:center;margin-right:10px" v-if="type === 'project'">
+        <div style="margin-right:10px;display:flex"> 
+            <span style="color:red"> * </span>
+            <p style="display:inline-block;width:60px;margin-left:5px">结算天数:</p>
+        </div>
+
+          <digital-input
+            :values="settle_day"
+            :placeholder="'结算天数'"
+            :min="0"
+            :max="100000000000"
+            :position="'right'"
+            :precision="0"
+            :size="'mini'"
+            :controls="false"
+            :append="'天'"
+            @reschange="number_change($event)"
+          />
+    </div>
+
     <div style="display:flex;align-items:center" v-if="type === 'activity'">
       <p style="margin-right:10px"><span style="color:red"> * </span>{{mapTitle[type]}}文件:</p>
       <div v-if="file_url && isFile">
@@ -103,6 +123,7 @@ export default {
       file_name:"",
       file_url:"",
       isInit:true,
+      settle_day:0,
       mapTitle,
       table: {
         stripe: true,
@@ -201,6 +222,9 @@ export default {
       this.file_url = url;
       // this.$message.success("文件成功!");
     },
+    number_change(day){
+      this.settle_day = Number(day)
+    },
     isValueNotNull(value){
       if(!value) return
       const _value = String(value)
@@ -301,6 +325,11 @@ export default {
         return
       }
 
+      if(this.type === 'project' && Number(this.settle_day) === 0){
+        this.$message.warning('结算天数不能为零!')
+        return
+      }
+
       if(this.type === "budget" && !this.storeId){
         this.$message.warning('请选择店铺!')
         return
@@ -327,7 +356,7 @@ export default {
       }), {}))
 
       this.loading = true
-      const { code } = await this.requsetMethod(planinfo, this.file_url, this.storeId)
+      const { code } = await this.requsetMethod(planinfo, this.file_url, this.storeId, this.settle_day)
       this.loading = false
 
       if(code === 0){

+ 5 - 5
src/views/customerService/demandOrder/components/manageProjectLetter.vue

@@ -84,6 +84,11 @@ export default {
            minWidth: '120px',
            _slot_:'is_check'
        },
+       {
+        label:'结算天数',
+        prop:'settle_day',
+        minWidth:'80px'
+       },
        {
            prop: "plan_file",
            label: '计划预算函预览',
@@ -105,11 +110,6 @@ export default {
            label: '方案上传公司',
            minWidth: '156px',
        },
-       {
-           prop: "nickname",
-           label: '创建人',
-           width: '150px',
-       },
        {
            prop: "create_time",
            label: '创建时间',

+ 2 - 1
src/views/customerService/workbench/detail.vue

@@ -358,9 +358,10 @@ export default {
       const letters = ['evaLetter','actLetter','proLetter']
       letters.forEach(letter => letter !== currentRef && this.$refs[letter].searchList())
     },
-    async requsetProjectLetter(plan_info, file, store_id){
+    async requsetProjectLetter(plan_info, file, store_id, settle_day){
       const params = {
         file,
+        settle_day,
         store_id,
         plan_info,
         plan_type: 3,