cloudroam
2025-01-09 bf6b7af0fb6c230eb15dd09ceda3a04abf958141
pages/order/list/index.vue
@@ -1,6 +1,6 @@
<template>
  <div>
    <el-bus-crud
<!--    <el-bus-crud
      ref="crud"
      v-bind="tableConfig"
      :extra-query="{ levelDown: checkedLevelDown }"
@@ -14,7 +14,11 @@
          >未处理的质检异常订单</el-checkbox
        >
      </template>
    </el-bus-crud>
    </el-bus-crud>-->
     <el-bus-crud
      ref="crud"
      v-bind="tableConfig"
    ></el-bus-crud>
    <div id="print-container">
      <print-list ref="printList" :order-list="orderList" />
    </div>
@@ -27,7 +31,6 @@
import { dateRangeOptions } from '@/utils/options'
import CustomDateRange from '@/components/custom-date-range.vue'
import PrintList from '@/components/order/print-list'
import GoodsTableItemList from '@/components/order/goods-table-item-list.vue'
export default {
  components: {
    PrintList,
@@ -38,10 +41,14 @@
      orderList: [],
      tableConfig: {
        url: 'flower/api/order/list',
        editUrl: 'flower/api/order/page/update',
        hasNew: false,
        hasEdit: false,
        hasEdit: true,
        hasDelete: false,
        persistSelection: true,
        hasExport: true,
        exportUrl: 'flower/api/order/list/export',
        exportText: '导出订单',
        onResetView: (row) => {
          this.$router.push(`${this.$route.path}/${row.id}`)
        },
@@ -58,6 +65,17 @@
              statusComp.extraQuery = { ...params, statusBackend: '' }
              statusComp.getOtherOptions()
            }
            const abnormalOrderStatusComp = searchForm.getComponentById('abnormalOrderStatus')
            if (abnormalOrderStatusComp) {
              // 组件内部不会修改这个prop直接修改可忽略警告
              abnormalOrderStatusComp.extraQuery = { ...params, abnormalOrderStatus: '' }
              abnormalOrderStatusComp.getOtherOptions()
            }
          }
        },
        beforeOpen: (row, isNew) => {
          if (!isNew) {
            row.districtStr = this.getDistrict(row)
          }
        },
        columns: [
@@ -76,9 +94,21 @@
          },
          { label: '订单金额(元)', prop: 'totalAmount', minWidth: 150 },
          { label: '底价(元)', prop: 'supplierAmount', minWidth: 150 },
          { label: '销售扎数', prop: 'saleNum', minWidth: 150 },
          { label: '订单状态', prop: 'statusBackendStr', minWidth: 120 },
          { label: '下单时间', prop: 'createTime', minWidth: 180 },
          { label: '支付时间', prop: 'paymentTime', minWidth: 180 },
          { label: '合伙人', prop: 'partnerName', minWidth: 120 },
          { label: '库位', prop: 'warehouseLocationCode', minWidth: 120 },
          { label: '特殊需求', prop: 'specialNeedsStr', minWidth: 120 },
          {
            label: '备注',
            formatter: (row) => (
              <simple-text value={row.remarks} type="primary"></simple-text>
            ),
            minWidth: 200,
          },
          { label: '快递号', prop: 'deliveryNo', minWidth: 120 },
        ],
        searchFormAttrs: {
          labelWidth: 'auto',
@@ -106,7 +136,42 @@
                  },
                  // code: 'ORDER_STATUS_BACKEND',
                },
                default: '',
                default: this.$route.query.statusBackend || '',
                span: 24,
                searchImmediately: true,
                on: {
                  optionsChange: (e, updateForm, { currentComp }) => {
                    if (Array.isArray(e[0]) && e[0].length > 0) {
                      const totalCount = e[0].reduce((total, current) => {
                        return (total += current.orderCount)
                      }, 0)
                      // 组件内部不会修改这个prop直接修改可忽略警告
                      currentComp.props = {
                        allLabel: `不限(${totalCount})`,
                      }
                    }
                  },
                },
              },
              {
                label: '异常订单:',
                id: 'abnormalOrderStatus',
                type: 'bus-radio',
                el: {
                  hasAll: true,
                  otherInterfaceUri: 'flower/api/order/abnormal/status/count',
                  childType: 'el-radio-button',
                  filterOptions: (list) => {
                    return list.map((item) => {
                      return {
                        ...item,
                        label: `${item.label}(${item.orderCount})`,
                      }
                    })
                  },
                  // code: 'ORDER_STATUS_BACKEND',
                },
                default: this.$route.query.abnormalOrderStatus || '',
                span: 24,
                searchImmediately: true,
                on: {
@@ -147,6 +212,77 @@
                id: 'customer',
                type: 'input',
                el: { placeholder: '收货人姓名/手机号' },
              },
              { label: '收货地址:', id: 'address', type: 'input' },
              { label: '库位:', id: 'warehouseLocationCode', type: 'input' },
              {
                label: '用户账号:',
                id: 'createName',
                type: 'input',
                el: { placeholder: '用户账号' },
                rules: {
                  required: false,
                  pattern:  /^\d{1,11}$/,
                  message: '请输入合法的用户账号',
                  trigger: 'blur',
                },
              },
              {
                label: '地区',
                id: 'province',
                component: 'el-bus-select-area',
                el: {
                  clearable: true,
                },
                commonFormat: true,
                commonFormatProps: ['province', 'city', 'region'],
                customClass: 'in-bus-form',
              },
            ],
          },
        ],
        form: [
          {
            type: 'row',
            span: 12,
            items: [
              {
                label: '地区:',
                id: 'customerProvince',
                component: 'el-bus-select-area',
                span: 24,
                commonFormat: true,
                commonFormatProps: [
                  'customerProvince',
                  'customerCity',
                  'customerRegion',
                ],
                str: true,
                strKey: 'districtStr',
                rules: { required: true, message: '请选择地区' },
              },
              {
                label: '详细地址:',
                id: 'customerAddress',
                type: 'input',
                span: 24,
                rules: {
                  required: true,
                  message: '请输入详细地址且最大不超过50个汉字',
                  trigger: 'blur',
                  max: 50,
                },
              },
              {
                label: '联系方式:',
                id: 'customerTel',
                type: 'input',
                rules: {
                  required: true,
                  pattern: this.$elBusUtil.REG.MOBILEPHONE,
                  message: '请输入合法的手机号',
                  trigger: 'blur',
                },
              },
            ],
          },
@@ -193,7 +329,7 @@
                        for (const tr of trs) {
                          const tds = tr.querySelectorAll('td')
                          if (tds && tds.length > 0) {
                            tds[0].colSpan = 7
                            tds[0].colSpan = 8
                            tds[0].style.textAlign = 'center'
                          }
                        }
@@ -224,6 +360,14 @@
          },
        ],
        extraButtons: [
          {
            text: '快递号',
            show: (row) => !row.partnerName && row.statusBackend === 'SEND',
            atClick: (row) => {
              this.$refs.crud.$refs.extraDialog[1].show(row)
              return false
            },
          },
          {
            text: '发货',
            show: (row) => !row.partnerName && row.statusBackend === 'SEND',
@@ -261,9 +405,22 @@
            hiddenReverseItems: [],
            form: [
              {
                label: '物流公司:',
                id: 'logisticsCompanyCode',
                type: 'bus-select-dict',
                readonly: true,
                el: {
                  code: 'LOGISTICS_COMPANY_CODE',
                  style: 'width:100%',
                },
                str: true,
                rules: {required: true, message: '物流公司'},
              },
              {
                label: '快递号:',
                id: 'deliveryNo',
                type: 'input',
                type: 'text',
                readonly: true,
                rules: {
                  required: true,
                  message: '请输入快递号',
@@ -281,6 +438,42 @@
              }
            },
          },
          {
            title: '快递号录入',
            hiddenReverseItems: [],
            form: [
              {
                label: '物流公司:',
                id: 'logisticsCompanyCode',
                type: 'bus-select-dict',
                el: {
                  code: 'LOGISTICS_COMPANY_CODE',
                  style: 'width:100%',
                },
                str: true,
                rules: {required: true, message: '物流公司'},
              },
              {
                label: '快递号:',
                id: 'deliveryNo',
                type: 'input',
                rules: {
                  required: true,
                  message: '请输入快递号',
                  trigger: 'blur',
                },
              },
            ],
            atConfirm: async (val) => {
              const { code } = await this.$elBusHttp.request(
                'flower/api/order/list/saveDeliveryNo',
                { method: 'post', data: val }
              )
              if (code === 0) {
                this.$message.success('快递号录入成功')
              }
            },
          },
        ],
      },
    }
@@ -295,6 +488,13 @@
      this.$refs.crud.search()
    },
  },
  methods: {
    getDistrict(row) {
      return `${row.customerProvince || ''}${row.customerCity || ''}${
        row.customerRegion || ''
      }`
    },
  },
}
</script>