mirror of
				https://gitee.com/hhyykk/ipms-sjy-ui.git
				synced 2025-10-31 02:08:45 +08:00 
			
		
		
		
	20230606 add trade-order and details
This commit is contained in:
		| @@ -5,10 +5,7 @@ export const getOrderList = (params: PageParam) => { | ||||
|   return request.get({ url: '/trade/order/page', params }) | ||||
| } | ||||
|  | ||||
| // // 获得交易订单详情 | ||||
| // export function getOrderDetail(id) { | ||||
| //   return request({ | ||||
| //     url: '/trade/order/get-detail?id=' + id, | ||||
| //     method: 'get' | ||||
| //   }) | ||||
| // } | ||||
| // 获得交易订单详情 | ||||
| export const getOrderDetail = (id: number) => { | ||||
|   return request.get({ url: '/trade/order/get-detail?id=' + id }) | ||||
| } | ||||
|   | ||||
| @@ -195,6 +195,22 @@ const remainingRouter: AppRouteRecordRaw[] = [ | ||||
|       noTagsView: true | ||||
|     } | ||||
|   }, | ||||
|   { | ||||
|     path: '/trade/order', | ||||
|     component: Layout, | ||||
|     name: 'order', | ||||
|     meta: { | ||||
|       hidden: true | ||||
|     }, | ||||
|     children: [ | ||||
|       { | ||||
|         path: 'detail', | ||||
|         name: 'TradeOrderDetail', | ||||
|         component: () => import('@/views/mall/trade/order/tradeOrderDetail.vue'), | ||||
|         meta: { title: '订单详情', hidden: true } | ||||
|       } | ||||
|     ] | ||||
|   }, | ||||
|   { | ||||
|     path: '/403', | ||||
|     component: () => import('@/views/Error/403.vue'), | ||||
|   | ||||
| @@ -45,7 +45,7 @@ | ||||
|         /> | ||||
|       </el-form-item> | ||||
|       <el-form-item label="订单来源" prop="terminal"> | ||||
|         <el-select class="!w-280px" v-model="queryParams.terminal" clearable placeholder="全部"> | ||||
|         <el-select class="!w-280px" v-model="queryParams.terminal" clearable placeholder="全部TODO"> | ||||
|           <el-option | ||||
|             v-for="dict in getStrDictOptions(DICT_TYPE.TERMINAL)" | ||||
|             :key="dict.value" | ||||
| @@ -66,23 +66,31 @@ | ||||
|       </el-form-item> | ||||
|  | ||||
|       <el-form-item label="订单搜索" prop="searchValue"> | ||||
|         <el-input class="!w-280px" v-model="queryParams.searchValue" clearable placeholder="请输入"> | ||||
|           <template #prepend> | ||||
|             <el-select | ||||
|               style="width: 100px" | ||||
|               v-model="queryParams.searchType" | ||||
|               clearable | ||||
|               placeholder="全部" | ||||
|             > | ||||
|               <el-option | ||||
|                 v-for="dict in searchList" | ||||
|                 :key="dict.value" | ||||
|                 :label="dict.label" | ||||
|                 :value="dict.value" | ||||
|               /> | ||||
|             </el-select> | ||||
|           </template> | ||||
|         </el-input> | ||||
|         <!-- 双item绑定2个变量用于reset时没法重置 --> | ||||
|         <el-form-item class="!w-280px" prop="searchType"> | ||||
|           <el-input | ||||
|             class="!w-280px" | ||||
|             v-model="queryParams.searchValue" | ||||
|             clearable | ||||
|             placeholder="请输入TODO" | ||||
|           > | ||||
|             <template #prepend> | ||||
|               <el-select | ||||
|                 style="width: 100px" | ||||
|                 v-model="queryParams.searchType" | ||||
|                 clearable | ||||
|                 placeholder="全部" | ||||
|               > | ||||
|                 <el-option | ||||
|                   v-for="dict in searchList" | ||||
|                   :key="dict.value" | ||||
|                   :label="dict.label" | ||||
|                   :value="dict.value" | ||||
|                 /> | ||||
|               </el-select> | ||||
|             </template> | ||||
|           </el-input> | ||||
|         </el-form-item> | ||||
|       </el-form-item> | ||||
|       <el-form-item> | ||||
|         <el-button @click="handleQuery"> | ||||
| @@ -93,13 +101,19 @@ | ||||
|           <Icon class="mr-5px" icon="ep:refresh" /> | ||||
|           重置 | ||||
|         </el-button> | ||||
|         <!-- v-hasPermi="['trade:order:export']" | ||||
|            需要将选中的数据存入orderSelect.multipleSelection中  | ||||
|           需要考虑全选时数据如何处理--> | ||||
|         <el-button type="success" plain @click="handleExport" :loading="exportLoading"> | ||||
|           <Icon icon="ep:download" class="mr-5px" /> 导出TODO | ||||
|         </el-button> | ||||
|       </el-form-item> | ||||
|     </el-form> | ||||
|   </ContentWrap> | ||||
|   <!-- 表格 --> | ||||
|   <ContentWrap> | ||||
|     <!-- 表单 --> | ||||
|     <el-table v-loading="loading" :data="list" @selection-change="handleSelectionChange"> | ||||
|     <el-table v-loading="loading" :data="list"> | ||||
|       <el-table-column type="expand" fixed="left"> | ||||
|         <template #default="scope"> | ||||
|           <el-descriptions class="mx-40"> | ||||
| @@ -117,11 +131,28 @@ | ||||
|           </el-descriptions> | ||||
|         </template> | ||||
|       </el-table-column> | ||||
|       <el-table-column label="全选" type="selection" width="55" fixed="left" /> | ||||
|       <!-- <el-table-column label="全选" type="selection" width="55" fixed="left">x</el-table-column> --> | ||||
|       <el-table-column width="100" fixed="left"> | ||||
|         <template #header> | ||||
|           <el-dropdown icon="eq:search" @command="handleDropType"> | ||||
|             <el-button link type="primary">全选({{ orderSelect.checkTotal }}) </el-button> | ||||
|  | ||||
|             <template #dropdown> | ||||
|               <el-dropdown-menu> | ||||
|                 <el-dropdown-item command="1">当前页</el-dropdown-item> | ||||
|                 <el-dropdown-item command="2">所有页</el-dropdown-item> | ||||
|               </el-dropdown-menu> | ||||
|             </template> | ||||
|           </el-dropdown> | ||||
|         </template> | ||||
|         <template #default="scope"> | ||||
|           <el-checkbox v-model="scope.row.itemSelect" @change="handcheckclick(scope.row)" /> | ||||
|         </template> | ||||
|       </el-table-column> | ||||
|  | ||||
|       <el-table-column label="订单号" align="center" min-width="110"> | ||||
|         <template #default="scope"> | ||||
|           <el-button link type="primary" @click="goOrderDetail(scope.row)">{{ | ||||
|           <el-button link type="primary" @click="showOrderDetail(scope.row)">{{ | ||||
|             scope.row.no | ||||
|           }}</el-button> | ||||
|         </template> | ||||
| @@ -218,8 +249,13 @@ | ||||
|       </el-table-column> | ||||
|       <el-table-column label="操作" align="center" fixed="right" min-width="150"> | ||||
|         <template #default="scope"> | ||||
|           <el-button link type="primary" @click="sendXX(scope.row)">发货</el-button> | ||||
|           <el-button link type="primary" @click="goOrderDetail(scope.row)">详情</el-button> | ||||
|           <el-button v-if="scope.row.status == '0'" link type="primary" @click="sendXX(scope.row)" | ||||
|             >待支付</el-button | ||||
|           > | ||||
|           <el-button v-if="scope.row.status == '10'" link type="primary" @click="sendXX(scope.row)" | ||||
|             >发货</el-button | ||||
|           > | ||||
|           <el-button link type="primary" @click="showOrderDetail(scope.row)">详情</el-button> | ||||
|         </template> | ||||
|       </el-table-column> | ||||
|     </el-table> | ||||
| @@ -242,17 +278,38 @@ | ||||
| import { DICT_TYPE, getStrDictOptions } from '@/utils/dict' | ||||
| import * as TradeOrderApi from '@/api/mall/trade/order' | ||||
| import { dateFormatter, formatDate } from '@/utils/formatTime' | ||||
| import download from '@/utils/download' | ||||
| // import TradeOrderDetail from './tradeOrderDetail.vue' | ||||
| interface CurrentType { | ||||
|   checkTotal: number //选中的数量 | ||||
|   currentType: string //页面选中类型, 0-noPage无选中页面 1-currentPage 当前页面 2-allPage所有页面 | ||||
|   selectAll: boolean //全选标识 | ||||
|   multipleSelection: [] // 选中的数据  暂未记录,需考虑全选时数据应该如何处理 ,部分选中可以使用该数据,需要登记 | ||||
|   pageNoList: [] //当前页面选中的页号 如果再次选中当前页将取消本页面的选中数据 全选时 将所有的页面list 都放进去 再次全选时 全部清空 | ||||
| } | ||||
| const orderSelect: CurrentType = reactive({ | ||||
|   checkTotal: 0, | ||||
|   currentType: '0', | ||||
|   selectAll: false, | ||||
|   multipleSelection: [], | ||||
|   pageNoList: [] | ||||
| }) | ||||
|  | ||||
| const message = useMessage() | ||||
|  | ||||
| const { push } = useRouter() | ||||
| const queryFormRef = ref() //表单搜索 | ||||
| const queryParams = ref({ | ||||
|   pageNo: 1, //首页 | ||||
|   pageSize: 10, //页面大小 | ||||
|   searchType: '', | ||||
|   searchValue: '' | ||||
|   tabIndex: 0 //详情页面数据 | ||||
| }) | ||||
|  | ||||
| const loading = ref(false) | ||||
| const exportLoading = ref(false) | ||||
| // 总记录数 | ||||
| const total = ref(0) | ||||
|  | ||||
| //表数据 | ||||
| const list = ref<any>([]) | ||||
| //订单搜索 | ||||
| @@ -284,16 +341,115 @@ const searchList = ref([ | ||||
| ]) | ||||
|  | ||||
| const imgViewVisible = ref(false) // 商品图预览 | ||||
|  | ||||
| const imageViewerList = ref<string[]>([]) // 商品图预览列表 | ||||
|  | ||||
| /**当前页 所有页  暂不考虑数据本地化 会导致选中当前页 从后台重新拉取数据时出现数据不一致*/ | ||||
| const handleDropType = (command: string) => { | ||||
|   orderSelect.currentType = command | ||||
|   let i = 0 | ||||
|   if (command === '1') { | ||||
|     // pageNoList 当前页面选中的页号 如果再次选中当前页将取消本页面的选中数据 | ||||
|     //取消本页面记录 | ||||
|     var index = orderSelect.pageNoList.indexOf(queryParams.value.pageNo) | ||||
|     if (index > -1) { | ||||
|       for (i; i < list.value.length; i++) { | ||||
|         if (list.value[i]['itemSelect'] === true) { | ||||
|           list.value[i]['itemSelect'] = false | ||||
|           orderSelect.checkTotal = orderSelect.checkTotal - 1 | ||||
|         } | ||||
|       } | ||||
|       orderSelect.pageNoList.splice(index, 1) | ||||
|     } else { | ||||
|       for (i; i < list.value.length; i++) { | ||||
|         if (list.value[i]['itemSelect'] === false) { | ||||
|           list.value[i]['itemSelect'] = true | ||||
|           orderSelect.checkTotal = orderSelect.checkTotal + 1 | ||||
|         } | ||||
|       } | ||||
|       orderSelect.pageNoList.splice(0, 0, queryParams.value.pageNo) | ||||
|     } | ||||
|   } | ||||
|   if (command === '2') { | ||||
|     orderSelect.selectAll = !orderSelect.selectAll | ||||
|     //全选时 将所有的页面list 都放进去 再次全选时 全部清空 | ||||
|     if (orderSelect.selectAll) { | ||||
|       //打勾勾 | ||||
|       for (i; i < list.value.length; i++) { | ||||
|         list.value[i]['itemSelect'] = true | ||||
|       } | ||||
|       // 初始化页面数组 | ||||
|       const array1: [] = Array.from( | ||||
|         { length: total.value / queryParams.value.pageSize + 1 }, | ||||
|         (item, idx) => idx + 1 | ||||
|       ) | ||||
|       orderSelect.pageNoList = [] //清空原有的 | ||||
|       orderSelect.pageNoList = [].concat(array1) | ||||
|       orderSelect.checkTotal = total.value | ||||
|     } else { | ||||
|       //取消勾勾 | ||||
|       for (i; i < list.value.length; i++) { | ||||
|         list.value[i]['itemSelect'] = false | ||||
|       } | ||||
|       orderSelect.pageNoList = [] //清空 | ||||
|       orderSelect.checkTotal = 0 | ||||
|     } | ||||
|   } | ||||
| } | ||||
| /***复选框选中 */ | ||||
| const handcheckclick = (row: any) => { | ||||
|   //选中增加1 | ||||
|   if (!row.itemSelect) { | ||||
|     // 取消 -1 | ||||
|     orderSelect.checkTotal = orderSelect.checkTotal - 1 | ||||
|     // | ||||
|   } else { | ||||
|     //选中 +1 | ||||
|     orderSelect.checkTotal = orderSelect.checkTotal + 1 | ||||
|   } | ||||
| } | ||||
| /** | ||||
|  * 导出数据 | ||||
|  */ | ||||
|  | ||||
| const handleExport = async () => { | ||||
|   try { | ||||
|     // 导出的二次确认 | ||||
|     await message.exportConfirm() | ||||
|     // 发起导出 | ||||
|     exportLoading.value = true | ||||
|     //TODO导出的数据是后台导出还是从前端中获取数据(全选时数据怎么打印?) | ||||
|     download.excel(orderSelect.multipleSelection as any, '订单信息.xls') // | ||||
|   } catch { | ||||
|   } finally { | ||||
|     exportLoading.value = false | ||||
|   } | ||||
|   //TODO | ||||
|   exportLoading.value = false | ||||
| } | ||||
|  | ||||
| /** 搜索按钮操作 */ | ||||
| const handleQuery = () => { | ||||
|   //选中状态初始化 | ||||
|   orderSelect.checkTotal = 0 | ||||
|   orderSelect.currentType = '0' | ||||
|   orderSelect.multipleSelection = [] | ||||
|   orderSelect.pageNoList = [] | ||||
|   orderSelect.selectAll = false | ||||
|  | ||||
|   getList() | ||||
| } | ||||
|  | ||||
| /** 重置按钮操作 */ | ||||
| const resetQuery = () => { | ||||
|   //选中状态初始化 | ||||
|   orderSelect.checkTotal = 0 | ||||
|   orderSelect.currentType = '0' | ||||
|   orderSelect.multipleSelection = [] | ||||
|   orderSelect.pageNoList = [] | ||||
|   orderSelect.selectAll = false | ||||
|  | ||||
|   queryFormRef.value.resetFields() | ||||
|   console.log(queryParams) | ||||
|   handleQuery() | ||||
| } | ||||
|  | ||||
| @@ -303,6 +459,22 @@ const getList = async () => { | ||||
|     const data = await TradeOrderApi.getOrderList(queryParams.value) | ||||
|     list.value = data.list | ||||
|     total.value = data.total | ||||
|  | ||||
|     let i = 0 | ||||
|     //给数组添加选中属性 itemSelect 默认为false 当前状态如果时全选 则新加载的页面都为选中状态 | ||||
|     if ( | ||||
|       orderSelect.currentType === '2' || //全选状态加载状态设置为选中 | ||||
|       orderSelect.pageNoList.indexOf(queryParams.value.pageNo) > -1 //已选择页面加载状态设置为默认选中,会存在选中当前页面后手动取消该页面部分数据,再重新加载该页面时设置为选中状态,但是没有增加选中的数量 | ||||
|     ) { | ||||
|       for (i; i < list.value.length; i++) { | ||||
|         list.value[i]['itemSelect'] = true | ||||
|       } | ||||
|     } else { | ||||
|       //还需要判断当前页面是否已经选中了? 而且还要出来选中的数据是否后来手动一行行取消了处理 | ||||
|       for (i; i < list.value.length; i++) { | ||||
|         list.value[i]['itemSelect'] = false //暂定为未选中状态, 实际情况需要考虑已选中状态,后期优化 | ||||
|       } | ||||
|     } | ||||
|   } finally { | ||||
|     loading.value = false | ||||
|   } | ||||
| @@ -311,8 +483,9 @@ const getList = async () => { | ||||
| /** | ||||
|  * 跳转订单详情 | ||||
|  */ | ||||
| const goOrderDetail = (row: any) => { | ||||
|   console.log('TODO Order Detail: ' + row.no) | ||||
| const showOrderDetail = (row: any) => { | ||||
|   console.log('TODO Order Detail: ' + row.id) | ||||
|   push({ name: 'TradeOrderDetail', query: { id: row.id } }) | ||||
| } | ||||
|  | ||||
| /** | ||||
| @@ -328,10 +501,6 @@ const sendXX = (row: any) => { | ||||
|   console.log('TODO Send XX: ' + row.no) | ||||
| } | ||||
|  | ||||
| const handleSelectionChange = (val: list) => { | ||||
|   multipleSelection.value = val | ||||
| } | ||||
|  | ||||
| /** | ||||
|  * 商品图预览 | ||||
|  * @param imgUrl | ||||
|   | ||||
							
								
								
									
										141
									
								
								src/views/mall/trade/order/tradeOrderDetail-crmeb.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										141
									
								
								src/views/mall/trade/order/tradeOrderDetail-crmeb.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,141 @@ | ||||
| <template> | ||||
|   <el-drawer v-model="drawerVisiable" width="50%"> | ||||
|     <el-form inline="true"> | ||||
|       <el-form-item> | ||||
|         <div> | ||||
|           <span text="普通订单:">普通订单:</span> | ||||
|           <span text="订单号: ">1111112546</span> | ||||
|         </div> | ||||
|       </el-form-item> | ||||
|       <el-form-item> <el-button type="primary" icon="search">发送货</el-button></el-form-item> | ||||
|       <el-form-item><el-button type="success" icon="search">小票打印</el-button> </el-form-item> | ||||
|       <el-form-item> | ||||
|         <el-dropdown @command="handleCommand"> | ||||
|           <el-button> ... </el-button> | ||||
|           <template #dropdown> | ||||
|             <el-dropdown-menu> | ||||
|               <el-dropdown-item command="remark">订单备注</el-dropdown-item> | ||||
|               <el-dropdown-item command="b">立即退款</el-dropdown-item> | ||||
|               <el-dropdown-item command="print">打印配货单</el-dropdown-item> | ||||
|             </el-dropdown-menu> | ||||
|           </template> | ||||
|         </el-dropdown> | ||||
|       </el-form-item> | ||||
|     </el-form> | ||||
|  | ||||
|     <el-descriptions class="m-10" direction="vertical" column="4"> | ||||
|       <el-descriptions-item label="订单状态">未发货TODO</el-descriptions-item> | ||||
|       <el-descriptions-item label="实际支付">1000 元 TODO</el-descriptions-item> | ||||
|       <el-descriptions-item label="支付方式">手机支付</el-descriptions-item> | ||||
|       <el-descriptions-item label="支付时间"> {{ formatDate(Date()) }}</el-descriptions-item> | ||||
|     </el-descriptions> | ||||
|     <el-tabs @tab-click="handleClick"> | ||||
|       <el-tab-pane label="订单信息"> | ||||
|         <el-descriptions title="订单信息"> | ||||
|           <el-descriptions-item label="用户UID: ">kooriookami</el-descriptions-item> | ||||
|           <el-descriptions-item label="用户昵称: ">18100000000</el-descriptions-item> | ||||
|           <el-descriptions-item label="绑定电话: ">Suzhou</el-descriptions-item> | ||||
|         </el-descriptions> | ||||
|         <el-divider border-style="dashed" /> | ||||
|         <el-descriptions title="收货信息" column="1"> | ||||
|           <el-descriptions-item label="收货人: ">kooriookami</el-descriptions-item> | ||||
|           <el-descriptions-item label="收货电话: ">18100000000</el-descriptions-item> | ||||
|           <el-descriptions-item label="收货地址: ">{{ detailData }}</el-descriptions-item> | ||||
|         </el-descriptions> | ||||
|         <el-divider border-style="dashed" /> | ||||
|         <el-descriptions title="供应商信息"> | ||||
|           <el-descriptions-item label="供应商: ">kooriookami</el-descriptions-item> | ||||
|           <el-descriptions-item label="供应商姓名: ">18100000000</el-descriptions-item> | ||||
|           <el-descriptions-item label="联系方式: ">Suzhou</el-descriptions-item> | ||||
|           <el-descriptions-item label="供应商邮箱: ">Suzhou</el-descriptions-item> | ||||
|         </el-descriptions> | ||||
|         <el-divider border-style="dashed" /> | ||||
|         <el-descriptions title="订单信息"> | ||||
|           <el-descriptions-item label="创建时间: "> {{ formatDate(Date()) }} </el-descriptions-item> | ||||
|           <el-descriptions-item label="商品总数: ">18100000000</el-descriptions-item> | ||||
|           <el-descriptions-item label="商品总价: ¥">200.00 元</el-descriptions-item> | ||||
|           <el-descriptions-item label="优惠券金额: ¥">200.00 元</el-descriptions-item> | ||||
|           <el-descriptions-item label="积分抵扣: ">200.00</el-descriptions-item> | ||||
|           <el-descriptions-item label="支付邮费: ¥">200.00 元</el-descriptions-item> | ||||
|           <el-descriptions-item label="会员商品优惠: ¥">200.00 元</el-descriptions-item> | ||||
|           <el-descriptions-item label="推广人: ¥">200.00 元</el-descriptions-item> | ||||
|           <el-descriptions-item label="支付时间: "> {{ formatDate(Date()) }} </el-descriptions-item> | ||||
|           <el-descriptions-item label="支付方式: ¥">200.00 元</el-descriptions-item> | ||||
|         </el-descriptions> | ||||
|         <el-divider v-if="true" border-style="dashed" /> | ||||
|         <el-descriptions v-if="true" title="订单备注"> | ||||
|           <el-descriptions-item label="备注: ">TODO</el-descriptions-item> | ||||
|         </el-descriptions> | ||||
|       </el-tab-pane> | ||||
|       <el-tab-pane label="商品信息"> | ||||
|         <el-descriptions title="商品信息"> | ||||
|           <el-descriptions-item label="用户UID: ">kooriookami</el-descriptions-item> | ||||
|           <el-descriptions-item label="用户昵称: ">18100000000</el-descriptions-item> | ||||
|           <el-descriptions-item label="绑定电话: ">Suzhou</el-descriptions-item> | ||||
|         </el-descriptions> | ||||
|       </el-tab-pane> | ||||
|       <el-tab-pane label="订单记录"> | ||||
|         <el-descriptions title="订单记录"> | ||||
|           <el-descriptions-item label="用户UID: ">kooriookami</el-descriptions-item> | ||||
|           <el-descriptions-item label="用户昵称: ">18100000000</el-descriptions-item> | ||||
|           <el-descriptions-item label="绑定电话: ">Suzhou</el-descriptions-item> | ||||
|         </el-descriptions> | ||||
|       </el-tab-pane> | ||||
|       <el-tab-pane label="发货记录"> | ||||
|         <el-descriptions title="发货记录"> | ||||
|           <el-descriptions-item label="用户UID: ">kooriookami</el-descriptions-item> | ||||
|           <el-descriptions-item label="用户昵称: ">18100000000</el-descriptions-item> | ||||
|           <el-descriptions-item label="绑定电话: ">Suzhou</el-descriptions-item> | ||||
|         </el-descriptions> | ||||
|       </el-tab-pane> | ||||
|     </el-tabs> | ||||
|   </el-drawer> | ||||
| </template> | ||||
| <script lang="ts" name="tradeOrderDetail-crmeb" setup> | ||||
| import { formatDate } from '@/utils/formatTime' | ||||
| import * as TradeOrderApi from '@/api/mall/trade/order' | ||||
| const message = useMessage() // 消息弹窗 | ||||
|  | ||||
| const drawerVisiable = ref(false) | ||||
| let detailData = reactive<any>({ | ||||
|   items: [], | ||||
|   user: {} | ||||
| }) //详情数据 | ||||
|  | ||||
| const handleClick = () => {} | ||||
|  | ||||
| const handleCommand = (command: string) => { | ||||
|   console.log(command) | ||||
| } | ||||
| //暂考虑一次性加载详情页面所有数据 | ||||
| const queryDetail = async (no: string) => { | ||||
|   try { | ||||
|     const res = await TradeOrderApi.getOrderDetail(no) | ||||
|     console.log(res) | ||||
|     detailData.value = res | ||||
|     console.log(detailData.value) | ||||
|   } catch { | ||||
|     message.error('获取详情数据失败') | ||||
|   } | ||||
| } | ||||
|  | ||||
| //显示详情 | ||||
| const show = async (no: string) => { | ||||
|   drawerVisiable.value = true | ||||
|   try { | ||||
|     queryDetail(no) | ||||
|   } finally { | ||||
|   } | ||||
| } | ||||
|  | ||||
| defineExpose({ show }) //显示详情方法 | ||||
| </script> | ||||
| <style> | ||||
| .el-dropdown-link { | ||||
|   cursor: pointer; | ||||
|   color: #409eff; | ||||
| } | ||||
| .el-icon-arrow-down { | ||||
|   font-size: 12px; | ||||
| } | ||||
| </style> | ||||
							
								
								
									
										355
									
								
								src/views/mall/trade/order/tradeOrderDetail.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										355
									
								
								src/views/mall/trade/order/tradeOrderDetail.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,355 @@ | ||||
| <template> | ||||
|   <ContentWrap> | ||||
|     <!-- 订单信息 --> | ||||
|     <el-descriptions title="订单信息"> | ||||
|       <el-descriptions-item label="订单号: ">{{ order.no }}</el-descriptions-item> | ||||
|       <el-descriptions-item label="配送方式: ">物流配送</el-descriptions-item> | ||||
|       <!-- TODO 芋艿:待实现 --> | ||||
|       <el-descriptions-item label="营销活动: ">物流配送</el-descriptions-item> | ||||
|       <!-- TODO 芋艿:待实现 --> | ||||
|       <el-descriptions-item label="订单类型: "> | ||||
|         <dict-tag :type="DICT_TYPE.TRADE_ORDER_TYPE" :value="order.type" /> | ||||
|       </el-descriptions-item> | ||||
|       <el-descriptions-item label="收货人: ">{{ order.receiverName }}</el-descriptions-item> | ||||
|       <el-descriptions-item label="买家留言: ">{{ order.userRemark }}</el-descriptions-item> | ||||
|       <el-descriptions-item label="订单来源: "> | ||||
|         <dict-tag :type="DICT_TYPE.TERMINAL" :value="order.terminal" /> | ||||
|       </el-descriptions-item> | ||||
|       <el-descriptions-item label="联系电话: ">{{ order.receiverMobile }}</el-descriptions-item> | ||||
|       <el-descriptions-item label="商家备注: ">{{ order.remark }}</el-descriptions-item> | ||||
|       <el-descriptions-item label="支付单号: ">{{ order.payOrderId }}</el-descriptions-item> | ||||
|       <el-descriptions-item label="付款方式: "> | ||||
|         <dict-tag :type="DICT_TYPE.PAY_CHANNEL_CODE_TYPE" :value="order.payChannelCode" /> | ||||
|       </el-descriptions-item> | ||||
|       <el-descriptions-item label="买家: ">{{ order.user.nickname }}</el-descriptions-item> | ||||
|       <!-- TODO 芋艿:待实现:跳转会员 --> | ||||
|       <el-descriptions-item label="收货地址: "> | ||||
|         {{ order.receiverAreaName }} " "{{ order.receiverDetailAddress }} " " | ||||
|         <el-link | ||||
|           v-clipboard:copy="order.receiverAreaName + ' ' + order.receiverDetailAddress" | ||||
|           v-clipboard:success="clipboardSuccess" | ||||
|           icon="ep:document-copy" | ||||
|           type="primary" | ||||
|         /> | ||||
|       </el-descriptions-item> | ||||
|     </el-descriptions> | ||||
|  | ||||
|     <!-- 订单状态 --> | ||||
|     <el-descriptions title="订单状态" :column="1"> | ||||
|       <el-descriptions-item label="订单状态: "> | ||||
|         <dict-tag :type="DICT_TYPE.TRADE_ORDER_STATUS" :value="order.status" /> | ||||
|       </el-descriptions-item> | ||||
|       <el-descriptions-item label-class-name="no-colon"> | ||||
|         <el-button type="primary" size="small">调整价格</el-button> | ||||
|         <!-- TODO 芋艿:待实现 --> | ||||
|         <el-button type="primary" size="small">备注</el-button> | ||||
|         <!-- TODO 芋艿:待实现 --> | ||||
|         <el-button type="primary" size="small">发货</el-button> | ||||
|         <!-- TODO 芋艿:待实现 --> | ||||
|         <el-button type="primary" size="small">关闭订单</el-button> | ||||
|         <!-- TODO 芋艿:待实现 --> | ||||
|         <el-button type="primary" size="small">修改地址</el-button> | ||||
|         <!-- TODO 芋艿:待实现 --> | ||||
|         <el-button type="primary" size="small">打印电子面单</el-button> | ||||
|         <!-- TODO 芋艿:待实现 --> | ||||
|         <el-button type="primary" size="small">打印发货单</el-button> | ||||
|         <!-- TODO 芋艿:待实现 --> | ||||
|         <el-button type="primary" size="small">确认收货</el-button> | ||||
|         <!-- TODO 芋艿:待实现 --> | ||||
|       </el-descriptions-item> | ||||
|       <el-descriptions-item> | ||||
|         <template #label><span style="color: red">提醒: </span></template> | ||||
|         买家付款成功后,货款将直接进入您的商户号(微信、支付宝)<br /> | ||||
|         请及时关注你发出的包裹状态,确保可以配送至买家手中 <br /> | ||||
|         如果买家表示没收到货或货物有问题,请及时联系买家处理,友好协商 | ||||
|       </el-descriptions-item> | ||||
|     </el-descriptions> | ||||
|  | ||||
|     <!-- 物流信息 TODO --> | ||||
|  | ||||
|     <!-- 商品信息 --> | ||||
|     <el-descriptions title="商品信息" column="6"> | ||||
|       <el-descriptions-item labelClassName="no-colon"> | ||||
|         <el-row :gutter="20"> | ||||
|           <el-col :span="10"> | ||||
|             <el-table :data="order.items" border> | ||||
|               <el-table-column prop="spuName" label="商品" width="400"> | ||||
|                 <template #default="{ row }"> | ||||
|                   {{ row.spuName }} | ||||
|                   <el-tag | ||||
|                     size="medium" | ||||
|                     v-for="property in row.properties" | ||||
|                     :key="property.propertyId" | ||||
|                   > | ||||
|                     {{ property.propertyName }}:{{ property.valueName }}</el-tag | ||||
|                   > | ||||
|                 </template> | ||||
|               </el-table-column> | ||||
|               <el-table-column prop="originalUnitPrice" label="单价(元)" width="180"> | ||||
|                 <template #default="{ row }"> | ||||
|                   ¥{{ (row.originalUnitPrice / 100.0).toFixed(2) }} | ||||
|                 </template> | ||||
|               </el-table-column> | ||||
|               <el-table-column prop="count" label="数量" width="100" /> | ||||
|               <el-table-column prop="originalPrice" label="小计(元)" width="100"> | ||||
|                 <template #default="{ row }"> | ||||
|                   ¥{{ (row.originalPrice / 100.0).toFixed(2) }} | ||||
|                 </template> | ||||
|               </el-table-column> | ||||
|               <el-table-column prop="afterSaleStatus" label="退款状态"> | ||||
|                 <template #default="{ row }"> | ||||
|                   <dict-tag | ||||
|                     :type="DICT_TYPE.TRADE_ORDER_ITEM_AFTER_SALE_STATUS" | ||||
|                     :value="row.afterSaleStatus" | ||||
|                   /> | ||||
|                 </template> | ||||
|               </el-table-column> | ||||
|             </el-table> | ||||
|           </el-col> | ||||
|           <el-col :span="10" /> | ||||
|         </el-row> | ||||
|       </el-descriptions-item> | ||||
|       <!-- 占位 --> | ||||
|       <!-- <el-descriptions-item v-for="item in 5" label-class-name="no-colon" :key="item" /> --> | ||||
|     </el-descriptions> | ||||
|     <el-descriptions column="6"> | ||||
|       <el-descriptions-item label="商品总额: " | ||||
|         >¥{{ (order.originalPrice / 100.0).toFixed(2) }}</el-descriptions-item | ||||
|       > | ||||
|       <el-descriptions-item label="运费金额: " | ||||
|         >¥{{ (order.deliveryPrice / 100.0).toFixed(2) }}</el-descriptions-item | ||||
|       > | ||||
|       <el-descriptions-item label="订单调价: " | ||||
|         >¥{{ (order.adjustPrice / 100.0).toFixed(2) }}</el-descriptions-item | ||||
|       > | ||||
|       <el-descriptions-item> | ||||
|         <template #label><span style="color: red">商品优惠: </span></template> | ||||
|         ¥{{ ((order.originalPrice - order.originalPrice) / 100.0).toFixed(2) }} | ||||
|       </el-descriptions-item> | ||||
|       <el-descriptions-item> | ||||
|         <template #label><span style="color: red">订单优惠: </span></template> | ||||
|         ¥{{ (order.discountPrice / 100.0).toFixed(2) }} | ||||
|       </el-descriptions-item> | ||||
|       <el-descriptions-item> | ||||
|         <template #label><span style="color: red">积分抵扣: </span></template> | ||||
|         ¥{{ (order.pointPrice / 100.0).toFixed(2) }} | ||||
|       </el-descriptions-item> | ||||
|  | ||||
|       <el-descriptions-item v-for="item in 5" label-class-name="no-colon" :key="item" /> | ||||
|       <!-- 占位 --> | ||||
|       <el-descriptions-item label="应付金额: "> | ||||
|         ¥{{ (order.payPrice / 100.0).toFixed(2) }} | ||||
|       </el-descriptions-item> | ||||
|     </el-descriptions> | ||||
|  | ||||
|     <div v-for="group in detailGroups" :key="group.title"> | ||||
|       <el-descriptions v-bind="group.groupProps" :title="group.title"> | ||||
|         <!-- 订单操作日志 --> | ||||
|         <el-descriptions-item v-if="group.key === 'orderLog'" labelClassName="no-colon"> | ||||
|           <el-timeline> | ||||
|             <el-timeline-item | ||||
|               v-for="activity in detailInfo[group.key]" | ||||
|               :key="activity.timestamp" | ||||
|               :timestamp="activity.timestamp" | ||||
|             > | ||||
|               {{ activity.content }} | ||||
|             </el-timeline-item> | ||||
|           </el-timeline> | ||||
|         </el-descriptions-item> | ||||
|  | ||||
|         <!-- 物流信息 --> | ||||
|         <el-descriptions-item v-if="group.key === 'expressInfo'" labelClassName="no-colon"> | ||||
|           <el-tabs type="card"> | ||||
|             <!-- 循环包裹物流信息 --> | ||||
|             <el-tab-pane | ||||
|               v-for="pkgInfo in detailInfo[group.key]" | ||||
|               :key="pkgInfo.label" | ||||
|               :label="pkgInfo.label" | ||||
|             > | ||||
|               <!-- 包裹详情 --> | ||||
|               <el-descriptions> | ||||
|                 <el-descriptions-item | ||||
|                   v-for="(pkgChild, pkgCIdx) in group.children" | ||||
|                   v-bind="pkgChild.childProps" | ||||
|                   :key="`pkgChild_${pkgCIdx}`" | ||||
|                   :label="pkgChild.label" | ||||
|                 > | ||||
|                   <!-- 包裹商品列表 --> | ||||
|                   <template v-if="pkgChild.valueKey === 'goodsList' && pkgInfo[pkgChild.valueKey]"> | ||||
|                     <div | ||||
|                       v-for="(goodInfo, goodInfoIdx) in pkgInfo[pkgChild.valueKey]" | ||||
|                       :key="`goodInfo_${goodInfoIdx}`" | ||||
|                       style="display: flex" | ||||
|                     > | ||||
|                       <el-image | ||||
|                         style="width: 100px; height: 100px; flex: none" | ||||
|                         :src="goodInfo.imgUrl" | ||||
|                       /> | ||||
|                       <el-descriptions :column="1"> | ||||
|                         <el-descriptions-item labelClassName="no-colon">{{ | ||||
|                           goodInfo.name | ||||
|                         }}</el-descriptions-item> | ||||
|                         <el-descriptions-item label="数量">{{ | ||||
|                           goodInfo.count | ||||
|                         }}</el-descriptions-item> | ||||
|                       </el-descriptions> | ||||
|                     </div> | ||||
|                   </template> | ||||
|  | ||||
|                   <!-- 包裹物流详情 --> | ||||
|                   <template v-else-if="pkgChild.valueKey === 'wlxq'"> | ||||
|                     <el-row :gutter="10"> | ||||
|                       <el-col :span="6" :offset="1"> | ||||
|                         <el-timeline> | ||||
|                           <el-timeline-item | ||||
|                             v-for="(activity, index) in pkgInfo[pkgChild.valueKey]" | ||||
|                             :key="index" | ||||
|                             :timestamp="activity.timestamp" | ||||
|                           > | ||||
|                             {{ activity.content }} | ||||
|                           </el-timeline-item> | ||||
|                         </el-timeline> | ||||
|                       </el-col> | ||||
|                     </el-row> | ||||
|                   </template> | ||||
|                   <template v-else> | ||||
|                     {{ pkgInfo[pkgChild.valueKey] }} | ||||
|                   </template> | ||||
|                 </el-descriptions-item> | ||||
|               </el-descriptions> | ||||
|             </el-tab-pane> | ||||
|           </el-tabs> | ||||
|         </el-descriptions-item> | ||||
|       </el-descriptions> | ||||
|     </div> | ||||
|   </ContentWrap> | ||||
| </template> | ||||
| <script lang="ts" name="TradeOrderDetail" setup> | ||||
| import { DICT_TYPE } from '@/utils/dict' | ||||
| import * as TradeOrderApi from '@/api/mall/trade/order' | ||||
| const message = useMessage() // 消息弹窗 | ||||
|  | ||||
| const { query } = useRoute() | ||||
| const queryParams = reactive({ | ||||
|   id: query.id | ||||
| }) | ||||
| const dialogVisible = ref(false) | ||||
| const loading = ref(false) | ||||
| const order = ref<any>({ | ||||
|   items: [], | ||||
|   user: {} | ||||
| }) //详情数据 | ||||
|  | ||||
| const detailGroups = ref([ | ||||
|   { | ||||
|     title: '物流信息', | ||||
|     key: 'expressInfo', | ||||
|     children: [ | ||||
|       { label: '发货时间: ', valueKey: 'fhsj' }, | ||||
|       { label: '物流公司: ', valueKey: 'wlgs' }, | ||||
|       { label: '运单号: ', valueKey: 'ydh' }, | ||||
|       { label: '物流状态: ', valueKey: 'wlzt', childProps: { span: 3 } }, | ||||
|       { label: '物流详情: ', valueKey: 'wlxq' } | ||||
|     ] | ||||
|   }, | ||||
|   { | ||||
|     title: '订单操作日志', | ||||
|     key: 'orderLog' | ||||
|   } | ||||
| ]) | ||||
|  | ||||
| const detailInfo = ref({ | ||||
|   expressInfo: [ | ||||
|     // 物流信息 | ||||
|     { | ||||
|       label: '包裹1', | ||||
|       name: 'bg1', | ||||
|       fhsj: '2022-11-03 16:50:45', | ||||
|       wlgs: '极兔', | ||||
|       ydh: '2132123', | ||||
|       wlzt: '不支持此快递公司', | ||||
|       wlxq: [ | ||||
|         { | ||||
|           content: '正在派送途中,请您准备签收(派件人:王涛,电话:13854563814)', | ||||
|           timestamp: '2018-04-15 15:00:16' | ||||
|         }, | ||||
|         { | ||||
|           content: '快件到达 【烟台龙口东江村委营业点】', | ||||
|           timestamp: '2018-04-13 14:54:19' | ||||
|         }, | ||||
|         { | ||||
|           content: '快件已发车', | ||||
|           timestamp: '2018-04-11 12:55:52' | ||||
|         }, | ||||
|         { | ||||
|           content: '快件已发车', | ||||
|           timestamp: '2018-04-11 12:55:52' | ||||
|         }, | ||||
|         { | ||||
|           content: '快件已发车', | ||||
|           timestamp: '2018-04-11 12:55:52' | ||||
|         } | ||||
|       ] | ||||
|     } | ||||
|   ], | ||||
|   orderLog: [ | ||||
|     // 订单操作日志 | ||||
|     { | ||||
|       content: '买家【乌鸦】关闭了订单', | ||||
|       timestamp: '2018-04-15 15:00:16' | ||||
|     }, | ||||
|     { | ||||
|       content: '买家【乌鸦】下单了', | ||||
|       timestamp: '2018-04-15 15:00:16' | ||||
|     } | ||||
|   ], | ||||
|   goodsInfo: [] // 商品详情tableData | ||||
| }) | ||||
| //暂考虑一次性加载详情页面所有数据 | ||||
| const getlist = async () => { | ||||
|   dialogVisible.value = true | ||||
|   loading.value = true | ||||
|   try { | ||||
|     const res = await TradeOrderApi.getOrderDetail(queryParams.id) | ||||
|     order.value = res | ||||
|   } catch { | ||||
|     message.error('获取详情数据失败') | ||||
|   } finally { | ||||
|     loading.value = false | ||||
|   } | ||||
| } | ||||
| onMounted(async () => { | ||||
|   await getlist() | ||||
| }) | ||||
| const clipboardSuccess = () => { | ||||
|   message.success('复制成功') | ||||
| } | ||||
| </script> | ||||
| <style lang="scss" scoped> | ||||
| :deep(.el-descriptions) { | ||||
|   &:not(:nth-child(1)) { | ||||
|     margin-top: 20px; | ||||
|   } | ||||
|   .el-descriptions__title { | ||||
|     display: flex; | ||||
|     align-items: center; | ||||
|     &::before { | ||||
|       content: ''; | ||||
|       display: inline-block; | ||||
|       margin-right: 10px; | ||||
|       width: 3px; | ||||
|       height: 20px; | ||||
|       background-color: #409eff; | ||||
|     } | ||||
|   } | ||||
|   .el-descriptions-item__container { | ||||
|     margin: 0 10px; | ||||
|     .no-colon { | ||||
|       margin: 0; | ||||
|       &::after { | ||||
|         content: ''; | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| } | ||||
| </style> | ||||
		Reference in New Issue
	
	Block a user
	 xiaobai
					xiaobai