zs před 1 rokem
rodič
revize
3ef130ab53
1 změnil soubory, kde provedl 28 přidání a 4 odebrání
  1. 28 4
      src/views/order/index.vue

+ 28 - 4
src/views/order/index.vue

@@ -13,7 +13,18 @@
           </cSearch>
         </el-col>
         <el-col :span="24" class="two">
-          <cTable :fields="fields" :opera="opera" :list="list" @query="search" :total="total" @view="toView"> </cTable>
+          <cTable :fields="fields" :opera="opera" :list="list" @query="search" :total="total" @view="toView" @after="toAfter"> 
+            <template #user="{ item, row }">
+              <template v-if="item.model === 'user'">
+                <span>{{ getProps(row, 'user') }}</span>
+              </template>
+            </template>
+            <template #phone="{ item, row }">
+              <template v-if="item.model === 'phone'">
+                <span>{{ getProps(row, 'phone') }}</span>
+              </template>
+            </template>
+          </cTable>
         </el-col>
       </el-col>
     </el-row>
@@ -39,6 +50,7 @@
 
 <script setup lang="ts">
 // 基础
+import _ from 'lodash';
 import type { Ref } from 'vue';
 import { ref, onMounted, getCurrentInstance } from 'vue';
 // 接口
@@ -55,7 +67,8 @@ let total: Ref<number> = ref(0);
 let skip = 0;
 let limit: number = proxy.$limit;
 let fields: Ref<any[]> = ref([
-  { label: '用户', model: 'user.nick_name' },
+  { label: '购买者', model: 'user', isSearch: true, custom: true },
+  { label: '购买者手机号', model: 'phone', isSearch: true, custom: true },
   { label: '来源', model: 'source_name', isSearch: true },
   { label: '类型', model: 'type', type: 'select', isSearch: true, format: (i: any) => getDict(i, typeList.value) },
   { label: '金额', model: 'money' },
@@ -65,14 +78,17 @@ let fields: Ref<any[]> = ref([
   { label: '状态', model: 'status', type: 'select', isSearch: true, format: (i: any) => getDict(i, statusList.value) }
 ]);
 // 操作
-let opera: Ref<any[]> = ref([{ label: '查看', method: 'view' }]);
+let opera: Ref<any[]> = ref([
+  { label: '查看', method: 'view' },
+  { label: '售后处理', method: 'after', display: (i: any) => i.status == '5' }
+]);
 // 查询数据
 let searchForm: Ref<any> = ref({});
 // 弹框
 const dialog: Ref<any> = ref({ title: '信息管理', show: false, type: '1' });
 const form: Ref<any> = ref({ file: [] });
 const formFields: Ref<any> = ref([
-  { label: '用户', model: 'user.nick_name' },
+  { label: '用户', model: 'user', custom: true },
   { label: '来源', model: 'source', custom: true },
   { label: '类型', model: 'type', type: 'select' },
   { label: '金额', model: 'money' },
@@ -113,6 +129,10 @@ const getDict = (value: any, model: any) => {
     else return '暂无';
   }
 };
+const getProps = (row: any, model: string) => {
+  if (model == 'user') return _.get(row.user, 'nick_name' || 'name');
+  else if (model == 'phone') return _.get(row.user, 'phone');
+};
 // 查看
 const toView = async (data: any) => {
   let res: any = await orderAxios.fetch(data._id);
@@ -121,6 +141,10 @@ const toView = async (data: any) => {
     dialog.value = { title: '信息管理', show: true, type: '1' };
   }
 };
+// 售后/退款
+const toAfter = async (data: any) => {
+  console.log(data);
+};
 // 查询其他信息
 const searchOther = async () => {
   let res: IQueryResult;