zhengjinyi vor 1 Jahr
Ursprung
Commit
e596734611

+ 2 - 2
.env.development

@@ -4,8 +4,8 @@ ENV = 'development'
 # base api
 # base api
 # VUE_APP_BASE_API = 'http://192.168.2.67:18015'
 # VUE_APP_BASE_API = 'http://192.168.2.67:18015'
 # VUE_APP_BASE_API = 'http://localhost:18015'
 # VUE_APP_BASE_API = 'http://localhost:18015'
-# VUE_APP_BASE_API = 'http://192.168.2.102:18015'
-VUE_APP_BASE_API = 'https://mapi-b.caimei365.com'
+VUE_APP_BASE_API = 'http://192.168.2.102:18015'
+# VUE_APP_BASE_API = 'https://mapi-b.caimei365.com'
 # 图片上传,索引更新等
 # 图片上传,索引更新等
 VUE_APP_CORE_API = 'https://core-b.caimei365.com'
 VUE_APP_CORE_API = 'https://core-b.caimei365.com'
 
 

+ 12 - 25
src/views/user/customer/market-edit.vue

@@ -8,7 +8,8 @@
         <el-date-picker
         <el-date-picker
           v-model="form.reportDate"
           v-model="form.reportDate"
           type="month"
           type="month"
-          format="M月"
+          format="yyyy-MM"
+          value-format="yyyy-MM"
           placeholder="选择月份"
           placeholder="选择月份"
           style="width: 280px"
           style="width: 280px"
         />
         />
@@ -47,16 +48,14 @@ import { saveMarketReport, saveReport, getMarketReportById } from '@/api/user/cu
 export default {
 export default {
   name: 'MarketEdit',
   name: 'MarketEdit',
   data() {
   data() {
-    const defaultForm = () => {
-      return {
+    return {
+      form: {
+        marketId: this.$route.query.marketId,
         id: '',
         id: '',
         filePath: '', // 数据文件
         filePath: '', // 数据文件
         reportDate: '', // 报表月份
         reportDate: '', // 报表月份
         reportName: '' // 报表月份
         reportName: '' // 报表月份
-      }
-    }
-    return {
-      form: defaultForm(),
+      },
       loadImgLoading: false,
       loadImgLoading: false,
       fileList: [],
       fileList: [],
       rules: {
       rules: {
@@ -104,27 +103,13 @@ export default {
     async saveReport() {
     async saveReport() {
       try {
       try {
         await saveReport(this.form)
         await saveReport(this.form)
+        this.fileList = []
         this.$message.success('数据报表保存成功')
         this.$message.success('数据报表保存成功')
+        this.backToList()
       } catch (error) {
       } catch (error) {
         console.log(error)
         console.log(error)
       }
       }
     },
     },
-    onSubmit(formName) {
-      this.$refs[formName].validate((valid) => {
-        if (valid) {
-          this.$confirm('是否提交保存信息', '提示', {
-            confirmButtonText: '确定',
-            cancelButtonText: '取消',
-            type: 'warning'
-          }).then(() => {
-            console.log('form', this.form)
-            this.saveShopPopUp(this.form)
-          })
-        } else {
-          return false
-        }
-      })
-    },
     // 文件上传成功
     // 文件上传成功
     handleUploadSuccess(response, file, fileList) {
     handleUploadSuccess(response, file, fileList) {
       this.form.filePath = response.url
       this.form.filePath = response.url
@@ -146,7 +131,6 @@ export default {
       if (!file) return
       if (!file) return
       try {
       try {
         const formData = new FormData()
         const formData = new FormData()
-        this.fileList = []
         formData.append('reportFile', file.raw)
         formData.append('reportFile', file.raw)
         const res = await saveMarketReport(formData)
         const res = await saveMarketReport(formData)
         this.form.filePath = res.data
         this.form.filePath = res.data
@@ -157,7 +141,10 @@ export default {
     backToList() {
     backToList() {
       this.$store.dispatch('tagsView/delView', this.$route).then(() => {
       this.$store.dispatch('tagsView/delView', this.$route).then(() => {
         this.$nextTick(() => {
         this.$nextTick(() => {
-          this.$router.replace({ path: '/user/customer/list' })
+          this.$router.replace({
+            path: '/user/customer/market-report-list',
+            query: { marketId: this.$route.query.marketId, shopName: this.$route.query.shopName }
+          })
         })
         })
       })
       })
     }
     }

+ 13 - 15
src/views/user/customer/market-report-list.vue

@@ -26,17 +26,17 @@
       <el-table-column label="序号" align="center" width="60">
       <el-table-column label="序号" align="center" width="60">
         <template slot-scope="scope">{{ scope.$index + 1 }}</template>
         <template slot-scope="scope">{{ scope.$index + 1 }}</template>
       </el-table-column>
       </el-table-column>
-      <el-table-column prop="time" label="报表数据日期" align="center" width="200" />
-      <el-table-column prop="title" label="报表名称" align="center" />
-      <el-table-column prop="endTime" label="添加时间" align="center" width="200">
+      <el-table-column prop="reportDate" label="报表数据日期" align="center" width="200" />
+      <el-table-column prop="reportName" label="报表名称" align="center" />
+      <el-table-column prop="addTime" label="添加时间" align="center" width="200">
         <template slot-scope="{ row }">
         <template slot-scope="{ row }">
-          {{ row.endTime ? row.endTime : '---' }}
+          {{ row.addTime ? row.addTime : '---' }}
         </template>
         </template>
       </el-table-column>
       </el-table-column>
       <el-table-column label="操作" align="center">
       <el-table-column label="操作" align="center">
         <template slot-scope="{ row }">
         <template slot-scope="{ row }">
-          <el-button type="primary" size="mini" style="margin: 2px" @click="handleUpdate('edit', row)"> 编辑</el-button>
           <el-button type="primary" size="mini" style="margin: 2px" @click="handleSitting(row)">生成报表</el-button>
           <el-button type="primary" size="mini" style="margin: 2px" @click="handleSitting(row)">生成报表</el-button>
+          <el-button type="primary" size="mini" style="margin: 2px" @click="handleUpdate('edit', row)"> 编辑</el-button>
           <el-button type="success" size="mini" style="margin: 2px" @click="handlePreview(row)">预览</el-button>
           <el-button type="success" size="mini" style="margin: 2px" @click="handlePreview(row)">预览</el-button>
           <el-button type="danger" size="mini" style="margin: 2px" @click="handleDeleteTag(row)">删除</el-button>
           <el-button type="danger" size="mini" style="margin: 2px" @click="handleDeleteTag(row)">删除</el-button>
         </template>
         </template>
@@ -102,15 +102,13 @@ export default {
     },
     },
     // 生成报表
     // 生成报表
     handleSitting(row) {
     handleSitting(row) {
-      this.renewCustome.id = row.id
-      this.renewCustome.followUpStatus = row.followUpStatus
-      this.updateVisible()
+      this.updateVisible({ id: row.id })
     },
     },
     // 调用生成报表API
     // 调用生成报表API
     async updateVisible(params) {
     async updateVisible(params) {
       try {
       try {
         await updateVisible(params)
         await updateVisible(params)
-        this.$message.success('操作成功')
+        this.$message.success('报表生成成功')
         this.getList()
         this.getList()
       } catch (error) {
       } catch (error) {
         console.log(error)
         console.log(error)
@@ -124,16 +122,16 @@ export default {
           cancelButtonText: '取消',
           cancelButtonText: '取消',
           type: 'warning'
           type: 'warning'
         })
         })
-        this.deleteMarketReport(row)
+        this.deleteMarketReport({ id: row.id })
       } catch (error) {
       } catch (error) {
         this.$message.info('已取消删除操作')
         this.$message.info('已取消删除操作')
       }
       }
     },
     },
     // 调用删除报备
     // 调用删除报备
-    async deleteMarketReport(row) {
+    async deleteMarketReport(params) {
       try {
       try {
-        await deleteMarketReport(row.reportId)
-        this.$message.success('操作成功')
+        await deleteMarketReport(params)
+        this.$message.success('报表删除成功')
         this.getList()
         this.getList()
       } catch (error) {
       } catch (error) {
         console.log(error)
         console.log(error)
@@ -154,12 +152,12 @@ export default {
       if (type === 'add') {
       if (type === 'add') {
         this.$router.push({
         this.$router.push({
           path: '/user/customer/market-edit',
           path: '/user/customer/market-edit',
-          query: { type: type }
+          query: { marketId: this.listQuery.marketId, type: type, shopName: this.$route.query.shopName }
         })
         })
       } else {
       } else {
         this.$router.push({
         this.$router.push({
           path: '/user/customer/market-edit',
           path: '/user/customer/market-edit',
-          query: { type: type, id: row.id }
+          query: { marketId: this.listQuery.marketId, type: type, id: row.id, shopName: this.$route.query.shopName }
         })
         })
       }
       }
     }
     }