e 5 anni fa
parent
commit
04fae42e21

+ 4 - 4
src/layout/components/TagsView/index.vue

@@ -17,10 +17,10 @@
       </router-link>
     </scroll-pane>
     <ul v-show="visible" :style="{left:left+'px',top:top+'px'}" class="contextmenu">
-      <li @click="refreshSelectedTag(selectedTag)">Refresh</li>
-      <li v-if="!isAffix(selectedTag)" @click="closeSelectedTag(selectedTag)">Close</li>
-      <li @click="closeOthersTags">Close Others</li>
-      <li @click="closeAllTags(selectedTag)">Close All</li>
+      <li @click="refreshSelectedTag(selectedTag)">刷新</li>
+      <li v-if="!isAffix(selectedTag)" @click="closeSelectedTag(selectedTag)">关闭</li>
+      <li @click="closeOthersTags">关闭其他</li>
+      <li @click="closeAllTags(selectedTag)">全部关闭</li>
     </ul>
   </div>
 </template>

+ 0 - 1
src/views/dashboard/admin/index.vue

@@ -210,7 +210,6 @@ export default {
         day = '0' + day
       }
       const startTime = date.getFullYear() + '-' + month + '-' + day
-      console.log(startTime)
       return startTime
     },
     getCurrentMonthLast() {

+ 30 - 31
src/views/goods/category-create.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="app-container">
     <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal">
-      <el-menu-item index="1"><router-link to="/goods/category">商品分类</router-link></el-menu-item>
+      <el-menu-item index="1" @click="backToList">商品分类</el-menu-item>
       <el-menu-item index="2">添加分类</el-menu-item>
     </el-menu>
     <el-form ref="dataForm" :rules="rules" :model="temp" label-position="left" label-width="120px" style="width:400px; margin:30px 0 0 50px;">
@@ -15,13 +15,10 @@
         <div class="form-el-upload">
           <el-upload
             class="avatar-uploader"
-            accept="image/jpeg,image/gif,image/png"
-            action="https://www-b.caimei365.com/register/imageUpload.action"
+            :action="action"
             :show-file-list="false"
             :on-success="handleAvatarSuccess"
             :before-upload="beforeAvatarUpload"
-            :multiple="false"
-            :limit="1"
           >
             <img v-if="temp.classifyImage" :src="temp.classifyImage" class="avatar">
             <i v-else class="el-icon-plus avatar-uploader-icon" />
@@ -53,10 +50,11 @@
 
 <script>
 import { saveClassify } from '@/api/goods-classify'
+import { uploadFile, getBase64 } from '@/api/other'
 export default {
   data() {
     return {
-      msg: '编辑分类',
+      msg: '添加分类',
       activeIndex: '2',
       rules: {
         classifyName: [{ required: true, message: '分类名称不能为空', trigger: 'blur' }],
@@ -99,39 +97,40 @@ export default {
         }
       })
     },
+    // 上传图标事件
     handleAvatarSuccess(res, file) {
-      this.getBase64(file.raw).then(res => {
-        console.log(res)
+      getBase64(file.raw).then(res => {
+        uploadFile({ imgStr: res }).then(response => {
+          console.log(response)
+          if (response.code === '1') {
+            this.temp.classifyImage = response.data
+          } else {
+            this.$message.error('上传图片失败')
+          }
+        })
       })
-      const fileName = file.name
-      const regex = /(.jpg|.jpeg|.gif|.png|.bmp)$/
-      if (regex.test(fileName.toLowerCase())) {
-        this.form.imageUrl = URL.createObjectURL(file.raw)
-      } else {
-        this.$message.error('请选择图片文件')
-      }
     },
+    // 对上传图片的大小、格式进行限制
     beforeAvatarUpload(file) {
+      const isJPG = file.type === 'image/jpeg'
+      const isJPG2 = file.type === 'image/jpg'
+      const isPNG = file.type === 'image/png'
       const isLt5M = file.size / 1024 / 1024 < 5
+      if (!isJPG && !isJPG2 && !isPNG) {
+        this.$message.error('只支持jpg或png格式图片')
+      }
       if (!isLt5M) {
-        this.$message.error('上传头像图片大小不能超过 5MB!')
+        this.$message.error('上传5MB以内的图片!')
       }
-      return isLt5M
+      return (isJPG || isJPG2 || isPNG) && isLt5M
     },
-    getBase64(file) {
-      return new Promise(function(resolve, reject) {
-        const reader = new FileReader()
-        let imgResult = ''
-        reader.readAsDataURL(file)
-        reader.onload = function() {
-          imgResult = reader.result
-        }
-        reader.onerror = function(error) {
-          reject(error)
-        }
-        reader.onloadend = function() {
-          resolve(imgResult)
-        }
+    backToList() {
+      this.$store.dispatch('tagsView/delView', this.$route).then(() => {
+        this.$nextTick(() => {
+          this.$router.replace({
+            path: '/goods/category'
+          })
+        })
       })
     }
   }

+ 10 - 1
src/views/goods/category-edit.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="app-container">
     <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal">
-      <el-menu-item index="1"><router-link to="/goods/category">商品分类</router-link></el-menu-item>
+      <el-menu-item index="1" @click="backToList">商品分类</el-menu-item>
       <el-menu-item index="2">编辑分类</el-menu-item>
     </el-menu>
     <el-form ref="dataForm" :rules="rules" :model="temp" label-position="left" label-width="120px" style="width:400px; margin:30px 0 0 50px;">
@@ -135,6 +135,15 @@ export default {
         this.$message.error('请上传5MB以内的图片!')
       }
       return (isJPG || isJPG2 || isPNG) && isLt5M
+    },
+    backToList() {
+      this.$store.dispatch('tagsView/delView', this.$route).then(() => {
+        this.$nextTick(() => {
+          this.$router.replace({
+            path: '/goods/category'
+          })
+        })
+      })
     }
   }
 }

+ 19 - 1
src/views/goods/list-select.vue

@@ -142,7 +142,25 @@ export default {
           type: response.code * 1 === 1 ? 'success' : 'error',
           duration: 2000
         })
-        this.fetchData()
+        this.$store.dispatch('tagsView/delView', this.$route).then(() => {
+          let parentPath = ''
+          switch (this.moduleId) {
+            case 1:
+              parentPath = '/goods/list/preferred'
+              break
+            case 2:
+              parentPath = '/goods/list/preferential'
+              break
+            case 3:
+              parentPath = '/goods/list/commonly'
+              break
+          }
+          if (parentPath) {
+            this.$nextTick(() => {
+              this.$router.replace({ path: parentPath })
+            })
+          }
+        })
       }).catch(() => {
         this.fetchData()
       })

+ 10 - 1
src/views/order/detail.vue

@@ -2,7 +2,7 @@
   <div class="app-container">
 
     <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal">
-      <el-menu-item index="1"><router-link to="/order/list">订单列表</router-link></el-menu-item>
+      <el-menu-item index="1" @click="backToList">订单列表</el-menu-item>
       <el-menu-item index="2">订单详情</el-menu-item>
     </el-menu>
 
@@ -189,6 +189,15 @@ export default {
       })
       this.dialogRemarksOrderId = id
       this.dialogRemarksVisible = true
+    },
+    backToList() {
+      this.$store.dispatch('tagsView/delView', this.$route).then(() => {
+        this.$nextTick(() => {
+          this.$router.replace({
+            path: '/order/list'
+          })
+        })
+      })
     }
   }
 }

+ 18 - 3
src/views/order/logistics.vue

@@ -2,9 +2,7 @@
   <div class="app-container">
     <div class="app-header-top" style="width: 100%;float: right;margin-bottom: 10px;">
       <div class="app-title">发货记录</div>
-      <router-link :to="'/order/list/'">
-        <el-button type="primary" icon="el-icon-back" style="float: right;">返回</el-button>
-      </router-link>
+      <el-button type="primary" icon="el-icon-back" style="float: right;" @click="backToList">返回</el-button>
     </div>
     <el-card class="box-card">
       <div v-for="(data,index) in logisticsInfoVos" :key="index" class="order-item">
@@ -68,6 +66,23 @@ export default {
       }).catch(() => {
         this.listLoading = false
       })
+    },
+    backToList() {
+      let parentPath = '/order/list'
+      const parentView = this.$store.getters.visitedViews.slice(-2)[0]
+      if (parentView) {
+        const oid = parentView.fullPath.split('/').reverse()[0] * 1
+        if (this.orderID === oid) {
+          parentPath = parentView.fullPath
+        }
+      }
+      this.$store.dispatch('tagsView/delView', this.$route).then(() => {
+        this.$nextTick(() => {
+          this.$router.replace({
+            path: parentPath
+          })
+        })
+      })
     }
   }
 }

+ 12 - 3
src/views/order/refund-detail.vue

@@ -2,7 +2,7 @@
   <div class="app-container">
 
     <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal">
-      <el-menu-item index="1"><router-link to="/order/refund">用户退款列表</router-link></el-menu-item>
+      <el-menu-item index="1" @click="backToList">用户退款列表</el-menu-item>
       <el-menu-item index="2">用户退款详情</el-menu-item>
     </el-menu>
 
@@ -56,13 +56,13 @@
     <el-card v-if="order" class="box-card">
       <el-row :gutter="24" class="box-row">
         <el-col :span="6"><b>订单编号(ID):</b> {{ order.orderNo + '(' + order.orderID + ')' }}</el-col>
-        <el-col :span="6"><b>下单时间:</b> <template v-if="refund.returnTime">{{ order.orderTime | parseTime('{y}-{m}-{d} {h}:{i}') }}</template></el-col>
+        <el-col :span="6"><b>下单时间:</b> <template v-if="order.orderTime">{{ order.orderTime | parseTime('{y}-{m}-{d} {h}:{i}') }}</template></el-col>
         <el-col :span="6"><b>订单状态:</b>
           <template v-if="['11','12','13','21','22','23','31','32','33'].indexOf(order.status)>=0">
             <el-tag type="success" size="small">{{ '交易中('+statusObj[order.status]+')' }}</el-tag>
           </template>
           <template v-else>
-            <el-tag :type="row.status*1===6?'info':''" size="small">{{ statusObj[order.status] }}</el-tag>
+            <el-tag :type="order.status*1===6?'info':''" size="small">{{ statusObj[order.status] }}</el-tag>
           </template>
         </el-col>
         <el-col v-if="order.bpOrderUserinfo" :span="6"><b>买家:</b> {{ order.bpOrderUserinfo.name }}</el-col>
@@ -247,6 +247,15 @@ export default {
       }).catch(() => {
         this.listLoading = false
       })
+    },
+    backToList() {
+      this.$store.dispatch('tagsView/delView', this.$route).then(() => {
+        this.$nextTick(() => {
+          this.$router.replace({
+            path: '/order/refund'
+          })
+        })
+      })
     }
   }
 }

+ 11 - 2
src/views/order/refund-record.vue

@@ -2,7 +2,7 @@
   <div class="app-container">
 
     <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal">
-      <el-menu-item index="1"><router-link to="/order/list">订单列表</router-link></el-menu-item>
+      <el-menu-item index="1" @click="backToList">订单列表</el-menu-item>
       <el-menu-item index="2">收退款记录</el-menu-item>
     </el-menu>
 
@@ -17,7 +17,7 @@
             <el-tag type="success" size="small">{{ '交易中('+statusObj[order.status]+')' }}</el-tag>
           </template>
           <template v-else>
-            <el-tag :type="row.status*1===6?'info':''" size="small">{{ statusObj[order.status] }}</el-tag>
+            <el-tag :type="order.status*1===6?'info':''" size="small">{{ statusObj[order.status] }}</el-tag>
           </template>
         </el-col>
         <el-col :span="6"><b>收款状态:</b>
@@ -172,6 +172,15 @@ export default {
       }).catch(() => {
         this.listLoading = false
       })
+    },
+    backToList() {
+      this.$store.dispatch('tagsView/delView', this.$route).then(() => {
+        this.$nextTick(() => {
+          this.$router.replace({
+            path: '/order/list'
+          })
+        })
+      })
     }
   }
 }

+ 11 - 2
src/views/order/refund-return.vue

@@ -2,7 +2,7 @@
   <div class="app-container">
 
     <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal">
-      <el-menu-item index="1"><router-link to="/order/list">订单列表</router-link></el-menu-item>
+      <el-menu-item index="1" @click="backToList">订单列表</el-menu-item>
       <el-menu-item index="2">退款退货详情</el-menu-item>
     </el-menu>
 
@@ -101,7 +101,7 @@
             <el-tag type="success" size="small">{{ '交易中('+statusObj[order.status]+')' }}</el-tag>
           </template>
           <template v-else>
-            <el-tag :type="row.status*1===6?'info':''" size="small">{{ statusObj[order.status] }}</el-tag>
+            <el-tag :type="order.status*1===6?'info':''" size="small">{{ statusObj[order.status] }}</el-tag>
           </template>
         </el-col>
         <el-col v-if="order.bpOrderUserinfo" :span="6"><b>买家:</b> {{ order.bpOrderUserinfo.name }}</el-col>
@@ -212,6 +212,15 @@ export default {
       }).catch(() => {
         this.listLoading = false
       })
+    },
+    backToList() {
+      this.$store.dispatch('tagsView/delView', this.$route).then(() => {
+        this.$nextTick(() => {
+          this.$router.replace({
+            path: '/order/list'
+          })
+        })
+      })
     }
   }
 }