|
@@ -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>
|