Selaa lähdekoodia

reset Delivery page logic

Elbert Chen 1 vuosi sitten
vanhempi
commit
7da09d0549
1 muutettua tiedostoa jossa 62 lisäystä ja 64 poistoa
  1. 62 64
      store/src/views/order/Delivery.vue

+ 62 - 64
store/src/views/order/Delivery.vue

@@ -45,7 +45,7 @@
             </div>
             <a-row>
               <a-button class="search-btn" type="primary" icon="search" html-type="submit">搜索</a-button>
-              <a-button class="search-btn" type="primary" @click="expend = !expend" >{{expend?'收起全部搜索':'展开全部搜索'}}</a-button>
+              <a-button class="search-btn" type="primary" @click="expend = !expend" >{{ expend?'收起全部搜索':'展开全部搜索' }}</a-button>
               <a-button class="search-btn" type="primary" @click="orderExport">导出</a-button>
               <a-upload name="file" :multiple="false" @change="changeFile" :customRequest="customRequest">
                 <a-button class="search-btn" type="primary">导入运单号</a-button>
@@ -133,11 +133,10 @@
                       <p>{{ item.is_export == 0 ? '未导出' : '已导出' }}</p>
                     </td>
                     <td>
-                      <div class="actions" v-if="item.is_export == 1">
+                      <div class="actions">
                         <a @click="handleSplit(item)" v-if="item.total_num > 1">拆分发货</a>
                         <a @click="handleDelivery(item)">去发货</a>
                       </div>
-                      <div class="actions" v-else>---</div>
                     </td>
                   </tr>
                 </template>
@@ -209,11 +208,10 @@
                       <p>{{ item.is_export == 0 ? '未导出' : '已导出' }}</p>
                     </td>
                     <td>
-                      <div class="actions" v-if="item.is_export == 1">
+                      <div class="actions">
                         <a @click="handleSplit(item)" v-if="item.total_num > 1">拆分发货</a>
                         <a @click="handleDelivery(item)">去发货</a>
                       </div>
-                      <div class="actions" v-else>---</div>
                     </td>
                   </tr>
                 </template>
@@ -255,7 +253,7 @@ import {
   OrderStatusEnum,
   PayStatusEnum,
   PayTypeEnum,
-  ReceiptStatusEnum,
+  ReceiptStatusEnum
 } from '@/common/enum/order'
 import { DeliveryForm, CancelForm, SplitForm } from './modules'
 
@@ -268,96 +266,96 @@ const columns = [
   {
     title: '商品名称',
     align: 'center',
-    ellipsis: true,
+    ellipsis: true
   },
   {
     title: '商品规格',
-    align: 'center',
+    align: 'center'
   },
   {
     title: '数量',
-    align: 'center',
+    align: 'center'
   },
   {
     title: '收件人',
-    align: 'center',
+    align: 'center'
   },
   {
     title: '联系方式',
-    align: 'center',
+    align: 'center'
   },
   {
     title: '收货地址',
-    align: 'center',
+    align: 'center'
   },
   {
     title: '下单时间',
-    align: 'center',
+    align: 'center'
   },
   {
     title: '导出状态',
-    align: 'center',
+    align: 'center'
   },
   {
     title: '操作',
     dataIndex: 'action',
-    scopedSlots: { customRender: 'action' },
-  },
+    scopedSlots: { customRender: 'action' }
+  }
 ]
 const comboColumns = [
   {
     title: '商品SKU',
-    align: 'center',
+    align: 'center'
   },
   {
     title: '商品名称',
     align: 'center',
-    ellipsis: true,
+    ellipsis: true
   },
   {
     title: '商品规格',
-    align: 'center',
+    align: 'center'
   },
   {
     title: '商品数量',
-    align: 'center',
+    align: 'center'
   },
   {
     title: '收件人',
-    align: 'center',
+    align: 'center'
   },
   {
     title: '联系方式',
-    align: 'center',
+    align: 'center'
   },
   {
     title: '收货地址',
-    align: 'center',
+    align: 'center'
   },
   {
     title: '供应商',
-    align: 'center',
+    align: 'center'
   },
   {
     title: '门店',
-    align: 'center',
+    align: 'center'
   },
   {
     title: '导出状态',
-    align: 'center',
+    align: 'center'
   },
   {
     title: '操作',
     dataIndex: 'action',
-    scopedSlots: { customRender: 'action' },
-  },
+    scopedSlots: { customRender: 'action' }
+  }
 ]
 
 // 搜索关键词类型枚举
 const SearchTypeEnum = [
   { name: '订单号', value: 10 },
   { name: '会员昵称', value: 20 },
-  { name: '会员ID', value: 30 },
+  { name: '会员ID', value: 30 }
 ]
 
 export default {
@@ -365,9 +363,9 @@ export default {
   components: {
     DeliveryForm,
     CancelForm,
-    SplitForm,
+    SplitForm
   },
-  data() {
+  data () {
     return {
       // 订单类型
       dataType: this.getDataType(),
@@ -388,10 +386,10 @@ export default {
       checkedList: [],
       isExport: -1,
       mode: '1',
-      expend: false, // 是否展开全部搜索条件
+      expend: false // 是否展开全部搜索条件
     }
   },
-  beforeCreate() {
+  beforeCreate () {
     // 批量给当前实例赋值
     assignment(this, {
       inArray,
@@ -403,28 +401,28 @@ export default {
       PayTypeEnum,
       ReceiptStatusEnum,
       SearchTypeEnum,
-      simpleImage: Empty.PRESENTED_IMAGE_SIMPLE,
+      simpleImage: Empty.PRESENTED_IMAGE_SIMPLE
     })
   },
-  created() {
+  created () {
     // 初始化页面
     this.init()
   },
   watch: {
     // 监听路由变化
-    $route() {
+    $route () {
       this.init()
-    },
+    }
   },
   methods: {
     // 导出
-    orderExport() {
-      let that = this
+    orderExport () {
+      const that = this
       if (this.checkedList.length <= 0) {
         this.$message.error('请勾选需要导出的订单', 1.5)
         return
       }
-      let orderGoodsIds = this.checkedList
+      const orderGoodsIds = this.checkedList
       Api.orderExport({ order_goods_id: orderGoodsIds, gtype: this.mode })
         .then((res) => {
           let link = document.createElement('a')
@@ -439,8 +437,8 @@ export default {
         })
         .finally((result) => {})
     },
-    //导入
-    changeFile(info) {
+    // 导入
+    changeFile (info) {
       console.log(info)
       if (info.file.status !== 'uploading') {
         console.log(info.file, info.fileList)
@@ -451,7 +449,7 @@ export default {
         this.$message.error(`${info.file.name} 上传失败.`)
       }
     },
-    customRequest(data) {
+    customRequest (data) {
       // 上传提交
       const formData = new FormData()
       formData.append('file', data.file)
@@ -466,7 +464,7 @@ export default {
         .finally(() => {})
     },
     // 初始化页面
-    init() {
+    init () {
       this.dataType = this.getDataType()
       this.searchForm.resetFields()
       this.queryParam = {}
@@ -481,12 +479,12 @@ export default {
     },
 
     // 获取当前标签
-    getDataType() {
+    getDataType () {
       return this.$route.path.split('/')[3]
     },
 
     // 获取列表数据
-    getList() {
+    getList () {
       const { dataType, queryParam, page } = this
       this.isLoading = true
       return Api.deliverylList({ dataType, ...queryParam, page, gtype: this.mode })
@@ -502,13 +500,13 @@ export default {
     },
 
     // 渲染订单状态标签颜色
-    renderOrderStatusColor(orderStatus) {
+    renderOrderStatusColor (orderStatus) {
       const { OrderStatusEnum } = this
       const ColorEnum = {
         [OrderStatusEnum.NORMAL.value]: '',
         [OrderStatusEnum.CANCELLED.value]: 'red',
         [OrderStatusEnum.APPLY_CANCEL.value]: 'red',
-        [OrderStatusEnum.COMPLETED.value]: 'green',
+        [OrderStatusEnum.COMPLETED.value]: 'green'
       }
       return ColorEnum[orderStatus]
     },
@@ -517,13 +515,13 @@ export default {
      * 刷新列表
      * @param Boolean bool 强制刷新到第一页
      */
-    handleRefresh(bool = false) {
+    handleRefresh (bool = false) {
       bool && (this.page = 1)
       this.getList()
     },
 
     // 确认搜索
-    handleSearch(e) {
+    handleSearch (e) {
       e.preventDefault()
       this.searchForm.validateFields((error, values) => {
         if (!error) {
@@ -534,32 +532,32 @@ export default {
     },
 
     // 重置搜索表单
-    handleReset() {
+    handleReset () {
       this.searchForm.resetFields()
       this.queryParam = {}
       this.searchForm.resetFields()
     },
 
     // 翻页事件
-    onChangePage(current) {
+    onChangePage (current) {
       this.page = current
       this.handleRefresh()
     },
 
     // 订单发货
-    handleDelivery(record) {
+    handleDelivery (record) {
       this.$refs.DeliveryForm.show(record)
     },
 
     // 审核取消订单
-    handleCancel(record) {
+    handleCancel (record) {
       this.$refs.CancelForm.show(record)
     },
     // 全选
-    onCheckAllChange() {
+    onCheckAllChange () {
       this.checkedList = []
       if (this.checkAll) {
-        //取消全选
+        // 取消全选
         this.checkAll = false
         this.orderList.data.forEach((item) => {
           item.checked = false
@@ -580,18 +578,18 @@ export default {
       //   }
       // })
     },
-    onChange(item) {
-      let that = this
+    onChange (item) {
+      const that = this
       item.checked = !item.checked
       if (item.checked) {
-        //勾选
+        // 勾选
         this.orderList.data.forEach((v) => {
           if (item == v) {
             that.checkedList.push(item.order_goods_id)
           }
         })
       } else {
-        let index = that.checkedList.indexOf(item.order_goods_id)
+        const index = that.checkedList.indexOf(item.order_goods_id)
         that.checkedList.splice(index, 1)
       }
       this.$forceUpdate()
@@ -602,14 +600,14 @@ export default {
       }
     },
     // 拆分发货
-    handleSplit(record) {
+    handleSplit (record) {
       this.$refs.SplitForm.show(record)
     },
-    chooseTab(type) {
+    chooseTab (type) {
       this.mode = type
       this.handleRefresh(true)
-    },
-  },
+    }
+  }
 }
 </script>
 <style lang="less" scoped>