Browse Source

暂存暂存

xiaodai2017 2 years ago
parent
commit
0e510b1384
42 changed files with 1314 additions and 330 deletions
  1. 25 0
      src/api/mobile/exchangeOrder.ts
  2. 46 0
      src/api/mobile/exchangeStock.ts
  3. 0 11
      src/api/mobile/order.ts
  4. 29 0
      src/api/mobile/shopOrder.ts
  5. 0 0
      src/api/mobile/shopStock.ts
  6. 0 42
      src/api/mobile/stock.ts
  7. 41 0
      src/api/operate/setComCard.ts
  8. 6 6
      src/api/operate/setComGood.ts
  9. 6 6
      src/api/operate/setService.ts
  10. 0 1
      src/components/BasicDescriptions/src/basic-descriptions.tsx
  11. 1 0
      src/components/BasicForm/src/basic-form.vue
  12. 1 0
      src/components/BasicForm/src/form-items.vue
  13. 3 1
      src/components/BasicForm/src/types.ts
  14. 12 3
      src/components/PageModalShell/src/description.vue
  15. 10 0
      src/config/status.ts
  16. 0 7
      src/utils/column-helper.ts
  17. 1 0
      src/views/interest/role/config/content.config.ts
  18. 78 21
      src/views/mobile/exchangeOrder/config/content.config.ts
  19. 18 12
      src/views/mobile/exchangeOrder/config/search.config.ts
  20. 17 24
      src/views/mobile/exchangeOrder/index.vue
  21. 3 3
      src/views/mobile/exchangeStock/config/content.config.ts
  22. 1 4
      src/views/mobile/exchangeStock/index.vue
  23. 2 4
      src/views/mobile/shopOrder/config/content.config.ts
  24. 1 1
      src/views/mobile/shopStock/config/content.config.ts
  25. 19 10
      src/views/mobile/user/config/modal.config.ts
  26. 1 28
      src/views/mobile/user/index.vue
  27. 107 0
      src/views/operate/setComCard/config/_details.ts
  28. 14 0
      src/views/operate/setComCard/config/_rules.ts
  29. 67 0
      src/views/operate/setComCard/config/content.config.ts
  30. 45 0
      src/views/operate/setComCard/config/modal.config.ts
  31. 28 0
      src/views/operate/setComCard/config/search.config.ts
  32. 122 0
      src/views/operate/setComCard/index.vue
  33. 107 0
      src/views/operate/setComGood/config/_details.ts
  34. 14 0
      src/views/operate/setComGood/config/_rules.ts
  35. 18 33
      src/views/operate/setComGood/config/search.config.ts
  36. 109 27
      src/views/operate/setComGood/index.vue
  37. 107 0
      src/views/operate/setService/config/_details.ts
  38. 76 0
      src/views/operate/setService/config/_rules.ts
  39. 36 13
      src/views/operate/setService/config/content.config.ts
  40. 56 53
      src/views/operate/setService/config/modal.config.ts
  41. 4 13
      src/views/operate/setService/config/search.config.ts
  42. 83 7
      src/views/operate/setService/index.vue

+ 25 - 0
src/api/mobile/exchangeOrder.ts

@@ -0,0 +1,25 @@
+import { loadEnv } from "@build/index";
+import { http } from "/@/utils/http";
+
+const { VITE_PROXY_DOMAIN_REAL } = loadEnv();
+
+//列表
+export async function httpList(): Promise<DataType<any>> {
+  return http.request(
+    `post`,
+    `${VITE_PROXY_DOMAIN_REAL}admin/orderExchangeList`,
+    {
+      data: {}
+    }
+  );
+}
+//详情
+export async function httpDetail(data: object): Promise<DataType<any[]>> {
+  return http.request(
+    `post`,
+    `${VITE_PROXY_DOMAIN_REAL}admin/orderExchangeRead`,
+    {
+      data
+    }
+  );
+}

+ 46 - 0
src/api/mobile/exchangeStock.ts

@@ -0,0 +1,46 @@
+import { loadEnv } from "@build/index";
+import { http } from "/@/utils/http";
+
+const { VITE_PROXY_DOMAIN_REAL } = loadEnv();
+
+//改
+export async function httpUpdate(data: object): Promise<DataType<any[]>> {
+  return http.request(
+    `post`,
+    `${VITE_PROXY_DOMAIN_REAL}/admin/inventoryExchangeEdit`,
+    {
+      data
+    }
+  );
+}
+
+//查详情
+export async function httpDetail(data: object): Promise<DataType<any[]>> {
+  return http.request(
+    `post`,
+    `${VITE_PROXY_DOMAIN_REAL}/admin/inventoryExchangeRead`,
+    {
+      data
+    }
+  );
+}
+//查列表
+export async function httpList(data: object): Promise<DataType<any[]>> {
+  return http.request(
+    `post`,
+    `${VITE_PROXY_DOMAIN_REAL}/admin/inventoryExchangeList`,
+    {
+      data
+    }
+  );
+}
+//改状态
+export async function httpLog(data: object): Promise<DataType<any[]>> {
+  return http.request(
+    `post`,
+    `${VITE_PROXY_DOMAIN_REAL}/admin/inventoryExchangeLog`,
+    {
+      data
+    }
+  );
+}

+ 0 - 11
src/api/mobile/order.ts

@@ -1,11 +0,0 @@
-import { loadEnv } from "@build/index";
-import { http } from "/@/utils/http";
-
-const { VITE_PROXY_DOMAIN_REAL } = loadEnv();
-
-//获取所有menu
-export async function httpList(): Promise<DataType<any>> {
-  return http.request(`post`, `${VITE_PROXY_DOMAIN_REAL}admin/versionlist`, {
-    data: {}
-  });
-}

+ 29 - 0
src/api/mobile/shopOrder.ts

@@ -0,0 +1,29 @@
+import { loadEnv } from "@build/index";
+import { http } from "/@/utils/http";
+
+const { VITE_PROXY_DOMAIN_REAL } = loadEnv();
+
+//获取所有menu
+export async function httpList(): Promise<DataType<any>> {
+  return http.request(`post`, `${VITE_PROXY_DOMAIN_REAL}admin/versionlist`, {
+    data: {}
+  });
+}
+//更新
+export async function httpUpdate(data: object): Promise<DataType<any[]>> {
+  return http.request(`post`, `${VITE_PROXY_DOMAIN_REAL}admin/AccoountEdit`, {
+    data
+  });
+}
+//详情
+export async function httpDetail(data: object): Promise<DataType<any[]>> {
+  return http.request(`post`, `${VITE_PROXY_DOMAIN_REAL}admin/AccoountRead`, {
+    data
+  });
+}
+//记录
+export async function httpLog(data: object): Promise<DataType<any[]>> {
+  return http.request(`post`, `${VITE_PROXY_DOMAIN_REAL}admin/AccoountRead`, {
+    data
+  });
+}

+ 0 - 0
src/api/mobile/stock1.ts → src/api/mobile/shopStock.ts


+ 0 - 42
src/api/mobile/stock.ts

@@ -1,42 +0,0 @@
-import { loadEnv } from "@build/index";
-import { http } from "/@/utils/http";
-
-const { VITE_PROXY_DOMAIN_REAL } = loadEnv();
-
-//增
-export async function httpAdd(data: object): Promise<DataType<any[]>> {
-  return http.request(`post`, `${VITE_PROXY_DOMAIN_REAL}admin/cardAdd`, {
-    data
-  });
-}
-//删
-export async function httpDelete(data: object): Promise<DataType<any[]>> {
-  return http.request(`post`, `${VITE_PROXY_DOMAIN_REAL}admin/cardDelete`, {
-    data
-  });
-}
-//改
-export async function httpUpdate(data: object): Promise<DataType<any[]>> {
-  return http.request(`post`, `${VITE_PROXY_DOMAIN_REAL}admin/cardEdit`, {
-    data
-  });
-}
-//改状态
-export async function httpStatus(data: object): Promise<DataType<any[]>> {
-  return http.request(`post`, `${VITE_PROXY_DOMAIN_REAL}admin/cardChange`, {
-    data
-  });
-}
-
-//查详情
-export async function httpDetail(data: object): Promise<DataType<any[]>> {
-  return http.request(`post`, `${VITE_PROXY_DOMAIN_REAL}admin/cardRead`, {
-    data
-  });
-}
-//查列表
-export async function httpList(data: object): Promise<DataType<any[]>> {
-  return http.request(`post`, `${VITE_PROXY_DOMAIN_REAL}admin/cardList`, {
-    data
-  });
-}

+ 41 - 0
src/api/operate/setComCard.ts

@@ -0,0 +1,41 @@
+import { loadEnv } from "@build/index";
+import { http } from "/@/utils/http";
+
+const { VITE_PROXY_DOMAIN_REAL } = loadEnv();
+
+// 添加
+export async function httpAdd(data: object = {}): Promise<DataType<any>> {
+  return http.request("post", `${VITE_PROXY_DOMAIN_REAL}admin/groupAdd`, {
+    data
+  });
+}
+// 列表
+export async function httpList(data: object = {}): Promise<DataType<any>> {
+  return http.request("post", `${VITE_PROXY_DOMAIN_REAL}admin/groupList`, {
+    data
+  });
+}
+// 详情
+export async function httpDetail(data: object = {}): Promise<DataType<any>> {
+  return http.request("post", `${VITE_PROXY_DOMAIN_REAL}admin/groupRead`, {
+    data
+  });
+}
+// 更新
+export async function httpUpdate(data: object = {}): Promise<DataType<any>> {
+  return http.request("post", `${VITE_PROXY_DOMAIN_REAL}admin/groupEdit`, {
+    data
+  });
+}
+// 状态
+export async function httpStatus(data: object = {}): Promise<DataType<any>> {
+  return http.request("post", `${VITE_PROXY_DOMAIN_REAL}admin/groupChange`, {
+    data
+  });
+}
+// 删除
+export async function httpDelete(data: object = {}): Promise<DataType<any>> {
+  return http.request("post", `${VITE_PROXY_DOMAIN_REAL}admin/groupDelete`, {
+    data
+  });
+}

+ 6 - 6
src/api/operate/setComGood.ts

@@ -5,37 +5,37 @@ const { VITE_PROXY_DOMAIN_REAL } = loadEnv();
 
 // 添加
 export async function httpAdd(data: object = {}): Promise<DataType<any>> {
-  return http.request("post", `${VITE_PROXY_DOMAIN_REAL}admin/companyAdd`, {
+  return http.request("post", `${VITE_PROXY_DOMAIN_REAL}admin/groupAdd`, {
     data
   });
 }
 // 列表
 export async function httpList(data: object = {}): Promise<DataType<any>> {
-  return http.request("post", `${VITE_PROXY_DOMAIN_REAL}admin/companylist`, {
+  return http.request("post", `${VITE_PROXY_DOMAIN_REAL}admin/groupList`, {
     data
   });
 }
 // 详情
 export async function httpDetail(data: object = {}): Promise<DataType<any>> {
-  return http.request("post", `${VITE_PROXY_DOMAIN_REAL}admin/companyRead`, {
+  return http.request("post", `${VITE_PROXY_DOMAIN_REAL}admin/groupRead`, {
     data
   });
 }
 // 更新
 export async function httpUpdate(data: object = {}): Promise<DataType<any>> {
-  return http.request("post", `${VITE_PROXY_DOMAIN_REAL}admin/companyEdit`, {
+  return http.request("post", `${VITE_PROXY_DOMAIN_REAL}admin/groupEdit`, {
     data
   });
 }
 // 状态
 export async function httpStatus(data: object = {}): Promise<DataType<any>> {
-  return http.request("post", `${VITE_PROXY_DOMAIN_REAL}admin/companyChange`, {
+  return http.request("post", `${VITE_PROXY_DOMAIN_REAL}admin/groupChange`, {
     data
   });
 }
 // 删除
 export async function httpDelete(data: object = {}): Promise<DataType<any>> {
-  return http.request("post", `${VITE_PROXY_DOMAIN_REAL}admin/companyDelete`, {
+  return http.request("post", `${VITE_PROXY_DOMAIN_REAL}admin/groupDelete`, {
     data
   });
 }

+ 6 - 6
src/api/operate/setService.ts

@@ -5,37 +5,37 @@ const { VITE_PROXY_DOMAIN_REAL } = loadEnv();
 
 // 添加
 export async function httpAdd(data: object = {}): Promise<DataType<any>> {
-  return http.request("post", `${VITE_PROXY_DOMAIN_REAL}admin/companyAdd`, {
+  return http.request("post", `${VITE_PROXY_DOMAIN_REAL}admin/serviceAdd`, {
     data
   });
 }
 // 列表
 export async function httpList(data: object = {}): Promise<DataType<any>> {
-  return http.request("post", `${VITE_PROXY_DOMAIN_REAL}admin/companylist`, {
+  return http.request("post", `${VITE_PROXY_DOMAIN_REAL}admin/serviceList`, {
     data
   });
 }
 // 详情
 export async function httpDetail(data: object = {}): Promise<DataType<any>> {
-  return http.request("post", `${VITE_PROXY_DOMAIN_REAL}admin/companyRead`, {
+  return http.request("post", `${VITE_PROXY_DOMAIN_REAL}admin/serviceRead`, {
     data
   });
 }
 // 更新
 export async function httpUpdate(data: object = {}): Promise<DataType<any>> {
-  return http.request("post", `${VITE_PROXY_DOMAIN_REAL}admin/companyEdit`, {
+  return http.request("post", `${VITE_PROXY_DOMAIN_REAL}admin/serviceEdit`, {
     data
   });
 }
 // 状态
 export async function httpStatus(data: object = {}): Promise<DataType<any>> {
-  return http.request("post", `${VITE_PROXY_DOMAIN_REAL}admin/companyChange`, {
+  return http.request("post", `${VITE_PROXY_DOMAIN_REAL}admin/serviceStatus`, {
     data
   });
 }
 // 删除
 export async function httpDelete(data: object = {}): Promise<DataType<any>> {
-  return http.request("post", `${VITE_PROXY_DOMAIN_REAL}admin/companyDelete`, {
+  return http.request("post", `${VITE_PROXY_DOMAIN_REAL}admin/serviceDelete`, {
     data
   });
 }

+ 0 - 1
src/components/BasicDescriptions/src/basic-descriptions.tsx

@@ -9,7 +9,6 @@ const BasicDescriptions = defineComponent({
   setup(props, { slots }) {
     return () => {
       const { title, colNumber, columns, data, labelWidth, show } = props;
-
       return show ? (
         <ElDescriptions
           title={title}

+ 1 - 0
src/components/BasicForm/src/basic-form.vue

@@ -77,6 +77,7 @@ defineExpose({
               <el-input-number
                 style="width: 100%"
                 v-model="formData[item.field]"
+                v-bind="item.otherOptions"
                 :placeholder="item.placeholder"
                 clearable
               />

+ 1 - 0
src/components/BasicForm/src/form-items.vue

@@ -66,6 +66,7 @@ onMounted(() => {
           <el-input-number
             style="width: 100%"
             v-model="formData[item.field]"
+            v-bind="item.otherOptions"
             :placeholder="item.placeholder"
             clearable
           />

+ 3 - 1
src/components/BasicForm/src/types.ts

@@ -1,6 +1,6 @@
 import { FormItemRule } from "element-plus";
 import { PropType } from "vue";
-
+import { VNode } from "vue";
 export type FormItemType =
   | "input"
   | "textarea"
@@ -32,6 +32,8 @@ export type FormItem = {
   span?: number;
   type_field?: string;
   slot?: string;
+  showSpan?: number;
+  render?: (data: any, context: any) => VNode | string;
 };
 
 export type FormGorup = {

+ 12 - 3
src/components/PageModalShell/src/description.vue

@@ -7,9 +7,18 @@ defineProps(descritonProps);
 <template>
   <el-descriptions :column="1" border>
     <template v-for="(item, index) in config.formItems" :key="index">
-      <el-descriptions-item :label="item.label" align="center">{{
-        defaultInfo[item.field]
-      }}</el-descriptions-item>
+      <el-descriptions-item
+        :label="item.label"
+        :span="item.showSpan ? item.showSpan : 24"
+        :width="item.labelWidth ? item.labelWidth : '180px'"
+      >
+        <template v-if="item.render">
+          {{ item.render(defaultInfo[item.field], defaultInfo) }}
+        </template>
+        <template v-else>
+          {{ defaultInfo[item.field] }}
+        </template>
+      </el-descriptions-item>
     </template>
   </el-descriptions>
 </template>

+ 10 - 0
src/config/status.ts

@@ -62,6 +62,16 @@ export const BATCH_USER_OPTIONS = [
   { id: "3", label: "处理成功", value: "2", type: "success" },
   { id: "4", label: "处理失败", value: "2", type: "error" }
 ];
+export const ONLINE_OPTIONS = [
+  { id: "1", label: "已上架", value: "1", type: "success" },
+  { id: "0", label: "已下架", value: "0", type: "warning" }
+];
+export const ORDER_OPTIONS = [
+  { id: "0", label: "未发货", value: "0", type: "warning" },
+  { id: "1", label: "已发货", value: "1", type: "primary" },
+  { id: "2", label: "已收货", value: "2", type: "success" }
+];
+
 export const POWERS = [
   "001",
   "002",

+ 0 - 7
src/utils/column-helper.ts

@@ -46,13 +46,6 @@ export function renderImage(prop = "image") {
     }
   };
 }
-// <el-image
-//       style="width: 100px; height: 100px"
-//       :src="url"
-//       :preview-src-list="src"
-//       :initial-index="4"
-//       fit="cover"
-//     />
 
 export function convertOptions(source: any[], prop = "id") {
   return source.map(item => ({ value: item[prop], label: item.label }));

+ 1 - 0
src/views/interest/role/config/content.config.ts

@@ -31,6 +31,7 @@ const columns = [
     label: "状态",
     prop: "status",
     ...renderStatus(STATUS_OPTIONS)
+    
   },
   {
     label: "角色等级",

+ 78 - 21
src/views/mobile/exchangeOrder/config/content.config.ts

@@ -1,9 +1,9 @@
 import { isString } from "@pureadmin/utils";
 import { h } from "vue";
 import { ContentConfig } from "/@/components/PageContent";
-import { httpDelete, httpStatus, httpList } from "/@/api/mobile/order";
-import { renderStatus } from "/@/utils/column-helper";
-import { STATUS_OPTIONS } from "/@/config/status";
+import { httpList } from "/@/api/mobile/exchangeOrder";
+import { renderStatus, renderImage } from "/@/utils/column-helper";
+import { ORDER_OPTIONS } from "/@/config/status";
 import { ElTag } from "element-plus";
 
 const columns = [
@@ -13,30 +13,91 @@ const columns = [
     hide: ({ checkList }) => !checkList.includes("勾选列")
   },
   {
-    prop: "id",
-    label: "ID",
-    width: "70px"
+    prop: "orderCode",
+    label: "订单编号",
+    width: "180px"
   },
   {
     prop: "status",
     label: "状态",
     minWidth: "90px",
-    ...renderStatus(STATUS_OPTIONS)
+    ...renderStatus(ORDER_OPTIONS)
   },
   {
-    prop: "video_name",
-    label: "视频名称",
-    minWidth: "250px"
+    prop: "company_title",
+    label: "企业名称",
+    width: "150px"
   },
   {
-    prop: "remark",
-    label: "视频描述"
+    prop: "card_title",
+    label: "卡类型",
+    width: "100px"
+  },
+  {
+    prop: "name",
+    label: "客户名称",
+    width: "100px"
+  },
+  {
+    prop: "username",
+    label: "账号/卡号",
+    width: "100px"
+  },
+  {
+    prop: "good_code",
+    label: "商品编码",
+    width: "100px"
+  },
+  {
+    prop: "good_cover_img",
+    label: "图片",
+    width: "100px",
+    ...renderImage("good_cover_img")
+  },
+  {
+    prop: "good_name",
+    label: "商品名称",
+    width: "100px"
+  },
+  {
+    prop: "num",
+    label: "数量",
+    width: "110px"
+  },
+  {
+    prop: "contactor",
+    label: "收货联系人",
+    width: "160px"
+  },
+  {
+    prop: "mobile",
+    label: "联系电话",
+    width: "160px"
+  },
+  {
+    prop: "addr_name",
+    label: "收货省市区",
+    width: "160px"
+  },
+  {
+    prop: "addr",
+    label: "详细地址",
+    width: "160px"
+  },
+  {
+    prop: "post_name",
+    label: "物流公司",
+    width: "160px"
+  },
+  {
+    prop: "post_code",
+    label: "物流单号",
+    width: "160px"
   },
-
   {
     prop: "addtime",
-    label: "创建时间",
-    minWidth: "160px"
+    label: "购买时间",
+    width: "160px"
   },
 
   {
@@ -47,14 +108,10 @@ const columns = [
   }
 ];
 const contentConfig: ContentConfig = {
-  title: "账号管理",
+  title: "兑换商品订单管理",
   columns,
   apis: {
-    httpAdd: true,
-    httpDelete,
-    httpStatus,
-    httpList,
-    httpUpdate: true
+    httpList
   },
   notPreview: false
 };

+ 18 - 12
src/views/mobile/exchangeOrder/config/search.config.ts

@@ -1,29 +1,35 @@
 import { FormConfig } from "/@/components/PageSearch";
-import { STATUS_OPTIONS } from "/@/config/status";
+import { ORDER_OPTIONS } from "/@/config/status";
 import { convertOptions } from "/@/utils/column-helper";
 
 const searchFormConfig: FormConfig = {
   formItems: [
     {
-      field: "status",
-      type: "select",
-      placeholder: "视频状态",
-      options: convertOptions(STATUS_OPTIONS)
+      field: "timer",
+      type: "date_picker",
+      otherOptions: {
+        type: "daterange",
+        startProp: "start_date",
+        endProp: "end_date",
+        startPlaceholder: "开始时间",
+        endPlaceholder: "结束时间"
+      }
     },
     {
-      field: "video_name",
-      type: "input",
-      placeholder: "视频名称"
+      field: "status",
+      type: "select",
+      placeholder: "订单状态",
+      options: convertOptions(ORDER_OPTIONS)
     },
     {
-      field: "video_url",
+      field: "name",
       type: "input",
-      placeholder: "视频地址"
+      placeholder: "客户名称"
     },
     {
-      field: "video_sn",
+      field: "username",
       type: "input",
-      placeholder: "视频编号"
+      placeholder: "用户卡号"
     }
   ]
 };

+ 17 - 24
src/views/mobile/exchangeOrder/index.vue

@@ -19,35 +19,28 @@ const { push } = useRouter();
 const hooks: Hooks = {
   pageSearchHook: () => usePageSearch(undefined, undefined, searchConfig)
 };
-const {
-  pageModalRef,
-  // handleUpdateData,
-  handleCreateData,
-  handlePreviewData,
-  handleConfrim,
-  defaultInfo
-} = usePageModal({ pageContentRef });
+const { pageModalRef, handlePreviewData, handleConfrim, defaultInfo } =
+  usePageModal({ pageContentRef });
 const events: Events = {
   content: {
-    preview: row => handlePreviewData(row),
-    create: row => handleCreateData(row)
+    preview: row => handlePreviewData(row)
   }
 };
 </script>
 
 <template>
-  <PageAuth :pageName="pageName">
-    <PageContainer
-      :hooks="hooks"
-      :events="events"
-      :search-config="searchConfig"
-      :content-config="contentConfig"
-    />
-    <PageModal
-      ref="pageModalRef"
-      :modal-config="modalConfig"
-      :default-info="defaultInfo"
-      @confirm-btn-click="handleConfrim"
-    />
-  </PageAuth>
+  <!-- <PageAuth :pageName="pageName"> -->
+  <PageContainer
+    :hooks="hooks"
+    :events="events"
+    :search-config="searchConfig"
+    :content-config="contentConfig"
+  />
+  <PageModal
+    ref="pageModalRef"
+    :modal-config="modalConfig"
+    :default-info="defaultInfo"
+    @confirm-btn-click="handleConfrim"
+  />
+  <!-- </PageAuth> -->
 </template>

+ 3 - 3
src/views/mobile/exchangeStock/config/content.config.ts

@@ -1,7 +1,7 @@
 import { isString } from "@pureadmin/utils";
 import { h } from "vue";
 import { ContentConfig } from "/@/components/PageContent";
-import { httpDelete, httpStatus, httpList } from "/@/api/mobile/stock";
+import { httpDelete, httpStatus, httpList } from "/@/api/mobile/exchangeStock";
 import { renderStatus } from "/@/utils/column-helper";
 import { STATUS_OPTIONS } from "/@/config/status";
 import { ElTag } from "element-plus";
@@ -51,8 +51,8 @@ const contentConfig: ContentConfig = {
   columns,
   apis: {
     httpAdd: true,
-    httpDelete,
-    httpStatus,
+    // httpDelete,
+    // httpStatus,
     httpList,
     httpUpdate: true
   }

+ 1 - 4
src/views/mobile/exchangeStock/index.vue

@@ -29,10 +29,7 @@ const {
 } = usePageModal({ pageContentRef });
 const events: Events = {
   content: {
-    preview: row => handlePreviewData(row),
-    create: () => {
-      console.log("1111");
-    }
+    preview: row => handlePreviewData(row)
   }
 };
 </script>

+ 2 - 4
src/views/mobile/shopOrder/config/content.config.ts

@@ -1,7 +1,7 @@
 import { isString } from "@pureadmin/utils";
 import { h } from "vue";
 import { ContentConfig } from "/@/components/PageContent";
-import { httpDelete, httpStatus, httpList } from "/@/api/mobile/order";
+import { httpDelete, httpStatus, httpList } from "/@/api/mobile/shopOrder";
 import { renderStatus } from "/@/utils/column-helper";
 import { STATUS_OPTIONS } from "/@/config/status";
 import { ElTag } from "element-plus";
@@ -50,11 +50,9 @@ const contentConfig: ContentConfig = {
   title: "账号管理",
   columns,
   apis: {
-    httpAdd: true,
     httpDelete,
     httpStatus,
-    httpList,
-    httpUpdate: true
+    httpList
   },
   notPreview: false
 };

+ 1 - 1
src/views/mobile/shopStock/config/content.config.ts

@@ -1,7 +1,7 @@
 import { isString } from "@pureadmin/utils";
 import { h } from "vue";
 import { ContentConfig } from "/@/components/PageContent";
-import { httpDelete, httpStatus, httpList } from "/@/api/mobile/stock";
+import { httpDelete, httpStatus, httpList } from "/@/api/mobile/exchangeStock";
 import { renderStatus } from "/@/utils/column-helper";
 import { STATUS_OPTIONS } from "/@/config/status";
 import { ElTag } from "element-plus";

+ 19 - 10
src/views/mobile/user/config/modal.config.ts

@@ -1,5 +1,5 @@
 import { ModalConfig } from "/@/components/PageModal/src/types";
-import { h } from "vue";
+import { h, unref } from "vue";
 import { ElTag, ElImage } from "element-plus";
 const modalConfig: ModalConfig = {
   title: "账号",
@@ -11,7 +11,6 @@ const modalConfig: ModalConfig = {
       field: "username",
       type: "input",
       label: "账号",
-      labelWidth: "120px",
       placeholder: "账号"
     },
 
@@ -19,7 +18,6 @@ const modalConfig: ModalConfig = {
       field: "company_title",
       type: "input",
       label: "公司",
-      labelWidth: "120px",
       placeholder: "公司"
     },
 
@@ -27,7 +25,6 @@ const modalConfig: ModalConfig = {
       field: "card_title",
       type: "input",
       label: "卡类型",
-      labelWidth: "120px",
       placeholder: "卡类型"
     },
 
@@ -35,21 +32,18 @@ const modalConfig: ModalConfig = {
       field: "name",
       type: "input",
       label: "客户姓名",
-      labelWidth: "120px",
       placeholder: "客户姓名"
     },
     {
       field: "mobile",
       type: "input",
       label: "手机号",
-      labelWidth: "120px",
       placeholder: "手机号"
     },
     {
       field: "addtime",
       type: "input",
       label: "创建时间",
-      labelWidth: "120px",
       placeholder: "创建时间"
     },
 
@@ -57,15 +51,30 @@ const modalConfig: ModalConfig = {
       field: "video_list",
       type: "array",
       label: "直播视频",
-      labelWidth: "120px",
+      slot: "status",
       placeholder: "直播视频",
-      span: 24
+      span: 24,
+      render: video_list => {
+        const list =
+          video_list && video_list.length > 0
+            ? JSON.parse(JSON.stringify(video_list))
+            : [];
+        console.log(list);
+        //需要优化
+        return "111";
+        // list
+        //   ? list?.map(tag =>
+        //       h(ElTag, null, {
+        //         default: () => tag.video_name
+        //       })
+        //     )
+        //   : "";
+      }
     },
     {
       field: "remark",
       type: "input",
       label: "备注",
-      labelWidth: "120px",
       placeholder: "备注",
       span: 24
     }

+ 1 - 28
src/views/mobile/user/index.vue

@@ -21,7 +21,6 @@ import {
 } from "/@/components/BasicForm";
 import { Video } from "/@/components/RemoteSelect";
 import { ElForm } from "element-plus";
-// import dayjs from "dayjs";
 const { formItems } = projectFormConfig;
 const formData = ref<Record<string, any>>(createDefaultData(formItems));
 const pageContentRef = ref<PageContentInstance | null>(null);
@@ -38,7 +37,6 @@ const {
 const { handleResetClick, handleSearchClick } = usePageSearch();
 const responseHandle = useResponseHandle();
 const Video_id = ref("");
-let columnsData = null;
 async function handleDetailData(row, type) {
   const { id } = row;
   const { code, data, message } = await httpDetail({ id: id });
@@ -86,17 +84,6 @@ function videoChange(e) {
     }
   }
 }
-async function handleDelete() {
-  // const { config, row, prop } = props;
-  // const { code, message } = await config.api({
-  //   ...(prop ? { [prop]: row[prop] } : { id: row.id })
-  // });
-  // responseHandle({
-  //   code,
-  //   message,
-  //   handler: () => emit("reload")
-  // });
-}
 </script>
 
 <template>
@@ -112,21 +99,7 @@ async function handleDelete() {
     @preview-btn-click="row => handleDetailData(row, 'preview')"
     @update-btn-click="row => handleDetailData(row, 'update')"
   />
-  <!-- <template #operation>
-      <el-popconfirm
-        title="是否确认删除"
-        placement="top"
-        @onConfirm="handleDelete"
-      >
-        <el-button
-          class="reset-margin"
-          link
-          type="primary"
-          :icon="useRenderIcon('RefreshLeft')"
-        />
-      </el-popconfirm>
-    </template>
-  </PageContent> -->
+  <!--需要优化 添加修改密码和重置密码功能 PageContent-->
   <PageModal
     ref="pageModalRef"
     :modal-config="modalConfig"

+ 107 - 0
src/views/operate/setComCard/config/_details.ts

@@ -0,0 +1,107 @@
+/* eslint-disable prettier/prettier */
+import { FormConfig } from "/@/components/PageSearch";
+export const projectFormConfig: FormConfig = {
+  formItems: [
+    {
+      label: "公司",
+      field: "company_id",
+      placeholder: "公司",
+      span: 24,
+
+      slot: "company_id"
+    },
+    {
+      label: "卡类型",
+      field: "card_id",
+      placeholder: "卡类型",
+      span: 24,
+
+      slot: "card_id"
+    },
+    {
+      label: "服务名称",
+      field: "title",
+      type: "input",
+      placeholder: "服务名称",
+      span: 24
+    },
+    {
+      label: "原价",
+      field: "original_price",
+      type: "number",
+      placeholder: "原价",
+      otherOptions: {
+        precision: 2,
+        step: 1,
+        "controls-position": "right",
+        min: 0,
+        max: 99999999
+      },
+      span: 12
+    },
+    {
+      label: "活动价",
+      field: "activity_price",
+      type: "number",
+      placeholder: "活动价",
+      otherOptions: {
+        precision: 2,
+        step: 1,
+        "controls-position": "right",
+        min: 0,
+        max: 99999999
+      },
+      span: 12
+    },
+
+    {
+      label: "活动开始日期",
+      field: "starttime",
+      type: "date_picker",
+      otherOptions: {
+        type: "date",
+        format: "YYYY-MM-DD"
+      },
+      placeholder: "活动开始日期",
+      span: 12
+    },
+    {
+      label: "活动结束日期",
+      field: "endtime",
+      type: "date_picker",
+
+      otherOptions: {
+        type: "date",
+        format: "YYYY-MM-DD"
+      },
+      placeholder: "活动结束日期",
+      span: 12
+    },
+    {
+      label: "服务到期日期",
+      field: "expiretime",
+      type: "date_picker",
+
+      otherOptions: {
+        type: "date",
+        format: "YYYY-MM-DD"
+      },
+      placeholder: "服务到期日期",
+      span: 24
+    },
+    {
+      label: "服务介绍",
+      field: "content",
+      type: "textarea",
+      placeholder: "服务介绍",
+      span: 24
+    },
+    {
+      label: "备注",
+      field: "remark",
+      type: "textarea",
+      placeholder: "备注",
+      span: 24
+    }
+  ]
+};

+ 14 - 0
src/views/operate/setComCard/config/_rules.ts

@@ -0,0 +1,14 @@
+import { FormRules } from "element-plus";
+import { isArray, validUpperCase } from "/@/utils/validate";
+export const projectFormRules: FormRules = {
+  company_id: {
+    trigger: "change",
+    required: true,
+    message: "请选择公司"
+  },
+  card_id: {
+    trigger: "change",
+    required: true,
+    message: "请选择卡类型"
+  }
+};

+ 67 - 0
src/views/operate/setComCard/config/content.config.ts

@@ -0,0 +1,67 @@
+import { ContentConfig } from "/@/components/PageContent";
+import {
+  httpList,
+  httpAdd,
+  httpUpdate,
+  httpStatus,
+  httpDelete
+} from "/@/api/operate/setComCard";
+import { renderStatus } from "/@/utils/column-helper";
+import { STATUS_OPTIONS } from "/@/config/status";
+
+const columns = [
+  {
+    type: "selection",
+    width: 55,
+    hide: ({ checkList }) => !checkList.includes("勾选列")
+  },
+
+  {
+    prop: "id",
+    label: "ID"
+  },
+  {
+    prop: "title",
+    label: "卡类型"
+  },
+
+  {
+    prop: "status",
+    label: "状态",
+    ...renderStatus(STATUS_OPTIONS)
+  },
+  {
+    prop: "contacts",
+    label: "联系人"
+  },
+  {
+    prop: "mobile",
+    label: "联系方式"
+  },
+  {
+    prop: "addtime",
+    label: "创建时间",
+    sortable: true
+  },
+
+  {
+    label: "操作",
+    fixed: "right",
+    width: 160,
+    slot: "operation"
+  }
+];
+
+const contentConfig: ContentConfig = {
+  title: "商品管理",
+  columns,
+  apis: {
+    httpAdd,
+    httpList,
+    httpUpdate,
+    httpStatus,
+    httpDelete
+  }
+};
+
+export default contentConfig;

+ 45 - 0
src/views/operate/setComCard/config/modal.config.ts

@@ -0,0 +1,45 @@
+import { ModalConfig } from "/@/components/PageModal/src/types";
+import { httpList as httpCompanylist } from "/@/api/parameter/company";
+import { httpList as httpCardlist } from "/@/api/parameter/card";
+const modalConfig: ModalConfig = {
+  title: "企业商品",
+  colLayout: { span: 24 },
+  itemStyle: {},
+  contact: "setComCard",
+  labelWidth: "85px",
+  formItems: [
+    {
+      field: "id",
+      type: "remote-select",
+      label: "业务企业",
+      placeholder: "业务企业",
+      otherOptions: {
+        api: httpCompanylist,
+        requesetProp: "title",
+        responseLabelProp: "title",
+        responseValPro: "id",
+        prop: "list"
+      },
+      span: 12,
+      rules: [{ required: true, trigger: "change", message: "请选择业务企业" }]
+    },
+    {
+      field: "name2",
+      type: "remote-select",
+      label: "卡类型",
+      placeholder: "卡类型",
+      otherOptions: {
+        api: httpCardlist,
+        responseLabelProp: "title",
+        responseValPro: "id",
+        requesetProp: "",
+        isRoot: false,
+        prop: "list"
+      },
+      span: 12,
+      rules: [{ required: true, trigger: "change", message: "请选择卡类型" }]
+    }
+  ]
+};
+
+export default modalConfig;

+ 28 - 0
src/views/operate/setComCard/config/search.config.ts

@@ -0,0 +1,28 @@
+import { ModalConfig } from "/@/components/PageModal/src/types";
+import { isLicense } from "/@/utils/validate";
+
+const modalConfig: ModalConfig = {
+  title: "服务",
+  colLayout: { span: 24 },
+  itemStyle: {},
+  contact: "setService",
+  labelWidth: "100px",
+  width: "700px",
+  formItems: [
+    {
+      field: "company_title",
+      type: "input",
+      label: "公司",
+      placeholder: "公司"
+    },
+
+    {
+      field: "card_title",
+      type: "input",
+      label: "卡类型",
+      placeholder: "卡类型"
+    }
+  ]
+};
+
+export default modalConfig;

+ 122 - 0
src/views/operate/setComCard/index.vue

@@ -0,0 +1,122 @@
+<script setup lang="ts">
+import { PageSearch, usePageSearch } from "/@/components/PageSearch";
+import searchConfig from "./config/search.config";
+import contentConfig from "./config/content.config";
+import PageAuth from "/@/components/PageAuth";
+import { PageModal, usePageModal } from "/@/components/PageModalShell";
+import modalConfig from "./config/modal.config";
+import { PageContent } from "/@/components/PageContent";
+import type { PageContentInstance } from "/@/components/PageContent";
+import { Company, Card } from "/@/components/RemoteSelect";
+import { projectFormConfig } from "./config/_details";
+import { projectFormRules } from "./config/_rules";
+import {
+  BasicForm,
+  transform,
+  createDefaultData
+} from "/@/components/BasicForm";
+import { ElImage } from "element-plus";
+import { httpDetail } from "/@/api/operate/setService";
+import { ElForm } from "element-plus";
+import { ref, unref } from "vue";
+import dayjs from "dayjs";
+import { useResponseHandle } from "/@/hooks/useAsync";
+const responseHandle = useResponseHandle();
+// import { httpDetail } from "/@/api/parameter/video";
+const pageContentRef = ref<PageContentInstance | null>(null);
+const {
+  pageModalRef,
+  handleUpdateData,
+  handleCreateData,
+  handlePreviewData,
+  handleConfrim,
+  defaultInfo
+} = usePageModal({
+  pageContentRef
+});
+const { handleResetClick, handleSearchClick } = usePageSearch();
+const { formItems } = projectFormConfig;
+
+const basicFormRef = ref<InstanceType<typeof ElForm>>(null);
+const formData = ref<Record<string, any>>(createDefaultData(formItems));
+function handleCreate() {
+  basicFormRef.value.validate(isValid => {
+    if (!isValid) return;
+    const params = unref(formData);
+    const { starttime, endtime, expiretime } = params;
+    params.starttime = starttime ? dayjs(starttime).format("YYYY-MM-DD") : "";
+    params.endtime = endtime ? dayjs(endtime).format("YYYY-MM-DD") : "";
+    params.expiretime = expiretime
+      ? dayjs(expiretime).format("YYYY-MM-DD")
+      : "";
+    if (
+      new Date(params.starttime).valueOf() >= new Date(params.endtime).valueOf()
+    ) {
+      ElImage.warning("活动开始日期不能大于活动结束日期!");
+      return;
+    }
+    handleConfrim("create", params);
+  });
+}
+async function handleDetailData(row, type) {
+  const { id } = row;
+  const { code, data, message } = await httpDetail({ id: id });
+  responseHandle({
+    code,
+    message,
+    handler: () => {
+      if (type === "preview") {
+        handlePreviewData(data);
+      }
+      if (type === "update") {
+        formData.value = transform(formItems, data, {});
+        handleUpdateData(data);
+      }
+    }
+  });
+}
+</script>
+
+<template>
+  <!-- <PageAuth :pageName="pageName"> -->
+  <PageSearch
+    :form-config="searchConfig"
+    @search-btn-click="handleSearchClick"
+    @reset-btn-click="handleResetClick"
+  />
+  <PageContent
+    ref="pageContentRef"
+    :content-config="contentConfig"
+    @create-btn-click="handleCreateData"
+    @preview-btn-click="row => handleDetailData(row, 'preview')"
+    @update-btn-click="row => handleDetailData(row, 'update')"
+  />
+  <PageModal
+    ref="pageModalRef"
+    :modal-config="modalConfig"
+    :default-info="defaultInfo"
+    @confirm-btn-click="handleConfrim"
+  >
+    <BasicForm
+      ref="basicFormRef"
+      v-bind="projectFormConfig"
+      :form-data="formData"
+      :rules="projectFormRules"
+      :disabled="false"
+      label-width="120px"
+    >
+      <template #company_id>
+        <Company v-model="formData.company_id" placeholder="公司" />
+      </template>
+      <template #card_id>
+        <Card v-model="formData.card_id" placeholder="卡类型" />
+      </template>
+      <template #footer>
+        <div class="w-full flex justify-end">
+          <ElButton type="primary" @click="handleCreate">保存</ElButton>
+        </div>
+      </template>
+    </BasicForm>
+  </PageModal>
+  <!-- </PageAuth> -->
+</template>

+ 107 - 0
src/views/operate/setComGood/config/_details.ts

@@ -0,0 +1,107 @@
+/* eslint-disable prettier/prettier */
+import { FormConfig } from "/@/components/PageSearch";
+export const projectFormConfig: FormConfig = {
+  formItems: [
+    {
+      label: "公司",
+      field: "company_id",
+      placeholder: "公司",
+      span: 24,
+
+      slot: "company_id"
+    },
+    {
+      label: "卡类型",
+      field: "card_id",
+      placeholder: "卡类型",
+      span: 24,
+
+      slot: "card_id"
+    },
+    {
+      label: "服务名称",
+      field: "title",
+      type: "input",
+      placeholder: "服务名称",
+      span: 24
+    },
+    {
+      label: "原价",
+      field: "original_price",
+      type: "number",
+      placeholder: "原价",
+      otherOptions: {
+        precision: 2,
+        step: 1,
+        "controls-position": "right",
+        min: 0,
+        max: 99999999
+      },
+      span: 12
+    },
+    {
+      label: "活动价",
+      field: "activity_price",
+      type: "number",
+      placeholder: "活动价",
+      otherOptions: {
+        precision: 2,
+        step: 1,
+        "controls-position": "right",
+        min: 0,
+        max: 99999999
+      },
+      span: 12
+    },
+
+    {
+      label: "活动开始日期",
+      field: "starttime",
+      type: "date_picker",
+      otherOptions: {
+        type: "date",
+        format: "YYYY-MM-DD"
+      },
+      placeholder: "活动开始日期",
+      span: 12
+    },
+    {
+      label: "活动结束日期",
+      field: "endtime",
+      type: "date_picker",
+
+      otherOptions: {
+        type: "date",
+        format: "YYYY-MM-DD"
+      },
+      placeholder: "活动结束日期",
+      span: 12
+    },
+    {
+      label: "服务到期日期",
+      field: "expiretime",
+      type: "date_picker",
+
+      otherOptions: {
+        type: "date",
+        format: "YYYY-MM-DD"
+      },
+      placeholder: "服务到期日期",
+      span: 24
+    },
+    {
+      label: "服务介绍",
+      field: "content",
+      type: "textarea",
+      placeholder: "服务介绍",
+      span: 24
+    },
+    {
+      label: "备注",
+      field: "remark",
+      type: "textarea",
+      placeholder: "备注",
+      span: 24
+    }
+  ]
+};

+ 14 - 0
src/views/operate/setComGood/config/_rules.ts

@@ -0,0 +1,14 @@
+import { FormRules } from "element-plus";
+import { isArray, validUpperCase } from "/@/utils/validate";
+export const projectFormRules: FormRules = {
+  company_id: {
+    trigger: "change",
+    required: true,
+    message: "请选择公司"
+  },
+  card_id: {
+    trigger: "change",
+    required: true,
+    message: "请选择卡类型"
+  }
+};

+ 18 - 33
src/views/operate/setComGood/config/search.config.ts

@@ -1,43 +1,28 @@
-import { FormConfig } from "/@/components/PageSearch";
-import { STATUS_OPTIONS } from "/@/config/status";
-import { convertOptions } from "/@/utils/column-helper";
-import { httpList as httpCompanylist } from "/@/api/parameter/company";
-const searchFormConfig: FormConfig = {
+import { ModalConfig } from "/@/components/PageModal/src/types";
+import { isLicense } from "/@/utils/validate";
+
+const modalConfig: ModalConfig = {
+  title: "服务",
+  colLayout: { span: 24 },
+  itemStyle: {},
+  contact: "setService",
+  labelWidth: "100px",
+  width: "700px",
   formItems: [
     {
-      field: "status",
-      type: "select",
-      placeholder: "状态",
-      options: convertOptions(STATUS_OPTIONS)
-    },
-    {
-      field: "id",
-      type: "remote-select",
-      placeholder: "业务企业",
-      otherOptions: {
-        api: httpCompanylist,
-        requesetProp: "title",
-        responseLabelProp: "title",
-        responseValPro: "id",
-        prop: "list"
-      }
-    },
-    {
-      field: "title",
+      field: "company_title",
       type: "input",
-      placeholder: "企业名称"
-    },
-    {
-      field: "contacts",
-      type: "input",
-      placeholder: "联系人"
+      label: "公司",
+      placeholder: "公司"
     },
+
     {
-      field: "mobile",
+      field: "card_title",
       type: "input",
-      placeholder: "联系方式"
+      label: "卡类型",
+      placeholder: "卡类型"
     }
   ]
 };
 
-export default searchFormConfig;
+export default modalConfig;

+ 109 - 27
src/views/operate/setComGood/index.vue

@@ -1,40 +1,122 @@
 <script setup lang="ts">
-import { usePageSearch } from "/@/components/PageSearch";
+import { PageSearch, usePageSearch } from "/@/components/PageSearch";
 import searchConfig from "./config/search.config";
 import contentConfig from "./config/content.config";
 import PageAuth from "/@/components/PageAuth";
-import { useRouter } from "vue-router";
+import { PageModal, usePageModal } from "/@/components/PageModalShell";
+import modalConfig from "./config/modal.config";
+import { PageContent } from "/@/components/PageContent";
+import type { PageContentInstance } from "/@/components/PageContent";
+import { Company, Card } from "/@/components/RemoteSelect";
+import { projectFormConfig } from "./config/_details";
+import { projectFormRules } from "./config/_rules";
+import {
+  BasicForm,
+  transform,
+  createDefaultData
+} from "/@/components/BasicForm";
+import { ElImage } from "element-plus";
+import { httpDetail } from "/@/api/operate/setService";
+import { ElForm } from "element-plus";
+import { ref, unref } from "vue";
+import dayjs from "dayjs";
+import { useResponseHandle } from "/@/hooks/useAsync";
+const responseHandle = useResponseHandle();
+// import { httpDetail } from "/@/api/parameter/video";
+const pageContentRef = ref<PageContentInstance | null>(null);
+const {
+  pageModalRef,
+  handleUpdateData,
+  handleCreateData,
+  handlePreviewData,
+  handleConfrim,
+  defaultInfo
+} = usePageModal({
+  pageContentRef
+});
+const { handleResetClick, handleSearchClick } = usePageSearch();
+const { formItems } = projectFormConfig;
 
-import PageContainer, {
-  type Events,
-  type Hooks
-} from "/@/components/PageContainer";
-
-const pageName = "setComGood";
-
-const basePath = "/operate/setComGoodDetail";
-
-const { push } = useRouter();
-
-const hooks: Hooks = {
-  pageSearchHook: () => usePageSearch(undefined, undefined, searchConfig)
-};
-
-const events: Events = {
-  content: {
-    preview: ({ projectNo }) => push(`${basePath}?id=${projectNo}`),
-    create: () => push(basePath)
-  }
-};
+const basicFormRef = ref<InstanceType<typeof ElForm>>(null);
+const formData = ref<Record<string, any>>(createDefaultData(formItems));
+function handleCreate() {
+  basicFormRef.value.validate(isValid => {
+    if (!isValid) return;
+    const params = unref(formData);
+    const { starttime, endtime, expiretime } = params;
+    params.starttime = starttime ? dayjs(starttime).format("YYYY-MM-DD") : "";
+    params.endtime = endtime ? dayjs(endtime).format("YYYY-MM-DD") : "";
+    params.expiretime = expiretime
+      ? dayjs(expiretime).format("YYYY-MM-DD")
+      : "";
+    if (
+      new Date(params.starttime).valueOf() >= new Date(params.endtime).valueOf()
+    ) {
+      ElImage.warning("活动开始日期不能大于活动结束日期!");
+      return;
+    }
+    handleConfrim("create", params);
+  });
+}
+async function handleDetailData(row, type) {
+  const { id } = row;
+  const { code, data, message } = await httpDetail({ id: id });
+  responseHandle({
+    code,
+    message,
+    handler: () => {
+      if (type === "preview") {
+        handlePreviewData(data);
+      }
+      if (type === "update") {
+        formData.value = transform(formItems, data, {});
+        handleUpdateData(data);
+      }
+    }
+  });
+}
 </script>
 
 <template>
   <!-- <PageAuth :pageName="pageName"> -->
-  <PageContainer
-    :hooks="hooks"
-    :events="events"
-    :search-config="searchConfig"
+  <PageSearch
+    :form-config="searchConfig"
+    @search-btn-click="handleSearchClick"
+    @reset-btn-click="handleResetClick"
+  />
+  <PageContent
+    ref="pageContentRef"
     :content-config="contentConfig"
+    @create-btn-click="handleCreateData"
+    @preview-btn-click="row => handleDetailData(row, 'preview')"
+    @update-btn-click="row => handleDetailData(row, 'update')"
   />
+  <PageModal
+    ref="pageModalRef"
+    :modal-config="modalConfig"
+    :default-info="defaultInfo"
+    @confirm-btn-click="handleConfrim"
+  >
+    <BasicForm
+      ref="basicFormRef"
+      v-bind="projectFormConfig"
+      :form-data="formData"
+      :rules="projectFormRules"
+      :disabled="false"
+      label-width="120px"
+    >
+      <template #company_id>
+        <Company v-model="formData.company_id" placeholder="公司" />
+      </template>
+      <template #card_id>
+        <Card v-model="formData.card_id" placeholder="卡类型" />
+      </template>
+      <template #footer>
+        <div class="w-full flex justify-end">
+          <ElButton type="primary" @click="handleCreate">保存</ElButton>
+        </div>
+      </template>
+    </BasicForm>
+  </PageModal>
   <!-- </PageAuth> -->
 </template>

+ 107 - 0
src/views/operate/setService/config/_details.ts

@@ -0,0 +1,107 @@
+/* eslint-disable prettier/prettier */
+import { FormConfig } from "/@/components/PageSearch";
+export const projectFormConfig: FormConfig = {
+  formItems: [
+    {
+      label: "公司",
+      field: "company_id",
+      placeholder: "公司",
+      span: 24,
+
+      slot: "company_id"
+    },
+    {
+      label: "卡类型",
+      field: "card_id",
+      placeholder: "卡类型",
+      span: 24,
+
+      slot: "card_id"
+    },
+    {
+      label: "服务名称",
+      field: "title",
+      type: "input",
+      placeholder: "服务名称",
+      span: 24
+    },
+    {
+      label: "原价",
+      field: "original_price",
+      type: "number",
+      placeholder: "原价",
+      otherOptions: {
+        precision: 2,
+        step: 1,
+        "controls-position": "right",
+        min: 0,
+        max: 99999999
+      },
+      span: 12
+    },
+    {
+      label: "活动价",
+      field: "activity_price",
+      type: "number",
+      placeholder: "活动价",
+      otherOptions: {
+        precision: 2,
+        step: 1,
+        "controls-position": "right",
+        min: 0,
+        max: 99999999
+      },
+      span: 12
+    },
+
+    {
+      label: "活动开始日期",
+      field: "starttime",
+      type: "date_picker",
+      otherOptions: {
+        type: "date",
+        format: "YYYY-MM-DD"
+      },
+      placeholder: "活动开始日期",
+      span: 12
+    },
+    {
+      label: "活动结束日期",
+      field: "endtime",
+      type: "date_picker",
+
+      otherOptions: {
+        type: "date",
+        format: "YYYY-MM-DD"
+      },
+      placeholder: "活动结束日期",
+      span: 12
+    },
+    {
+      label: "服务到期日期",
+      field: "expiretime",
+      type: "date_picker",
+
+      otherOptions: {
+        type: "date",
+        format: "YYYY-MM-DD"
+      },
+      placeholder: "服务到期日期",
+      span: 24
+    },
+    {
+      label: "服务介绍",
+      field: "content",
+      type: "textarea",
+      placeholder: "服务介绍",
+      span: 24
+    },
+    {
+      label: "备注",
+      field: "remark",
+      type: "textarea",
+      placeholder: "备注",
+      span: 24
+    }
+  ]
+};

+ 76 - 0
src/views/operate/setService/config/_rules.ts

@@ -0,0 +1,76 @@
+import { FormRules } from "element-plus";
+import { isArray, validUpperCase } from "/@/utils/validate";
+export const projectFormRules: FormRules = {
+  company_id: {
+    trigger: "change",
+    required: true,
+    message: "请选择公司"
+  },
+  card_id: {
+    trigger: "change",
+    required: true,
+    message: "请选择卡类型"
+  },
+  title: {
+    trigger: "change",
+    required: true,
+    message: "请输入服务名称"
+  },
+  original_price: {
+    trigger: "change",
+    required: true,
+    validator(_, value) {
+      if (typeof value != "number") return new Error("请输入原价");
+      const num = Number(value + "");
+      if (num < 0) return new Error("原价不能低于0");
+      return true;
+    }
+  },
+  activity_price: {
+    trigger: "change",
+    required: true,
+    validator(_, value) {
+      if (typeof value != "number") return new Error("请输入活动价");
+      const num = Number(value + "");
+      if (num < 0) return new Error("原价不能低于0");
+      return true;
+    }
+  },
+  starttime: {
+    trigger: "change",
+    required: true,
+    validator(_, value) {
+      const val = value ?? "";
+      if (val === "") return new Error("请选择活动开始日期");
+      return true;
+    }
+  },
+  endtime: {
+    trigger: "change",
+    required: true,
+    validator(_, value) {
+      const val = value ?? "";
+      if (val === "") return new Error("请选择活动结束日期");
+      return true;
+    }
+  },
+  expiretime: {
+    trigger: "change",
+    required: true,
+    validator(_, value) {
+      const val = value ?? "";
+      if (val === "") return new Error("请选择服务到期日期");
+      return true;
+    }
+  },
+
+  content: {
+    trigger: "change",
+    required: true,
+    validator(_, value) {
+      const val = value ?? "";
+      if (val === "") return new Error("请输入服务介绍");
+      return true;
+    }
+  }
+};

+ 36 - 13
src/views/operate/setService/config/content.config.ts

@@ -6,8 +6,8 @@ import {
   httpStatus,
   httpDelete
 } from "/@/api/operate/setService";
-import { renderStatus } from "/@/utils/column-helper";
-import { STATUS_OPTIONS } from "/@/config/status";
+import { renderStatus, timeInterval } from "/@/utils/column-helper";
+import { ONLINE_OPTIONS } from "/@/config/status";
 
 const columns = [
   {
@@ -18,30 +18,53 @@ const columns = [
 
   {
     prop: "id",
-    label: "ID"
+    label: "ID",
+    width: "90px"
   },
   {
     prop: "title",
-    label: "卡类型"
+    label: "服务名称",
+    minWidth: "180px"
   },
-
   {
     prop: "status",
     label: "状态",
-    ...renderStatus(STATUS_OPTIONS)
+    ...renderStatus(ONLINE_OPTIONS),
+    width: "100px"
+  },
+  {
+    prop: "company_title",
+    label: "公司名称",
+    minWidth: "150px"
+  },
+
+  {
+    prop: "card_title",
+    label: "卡类型",
+    width: "120px"
   },
   {
-    prop: "contacts",
-    label: "联系人"
+    prop: "original_price",
+    label: "原价",
+    width: "110px"
   },
   {
-    prop: "mobile",
-    label: "联系方式"
+    prop: "activity_price",
+    label: "活动价",
+    width: "110px"
   },
+  {
+    prop: "starttime",
+    label: "活动时间",
+    ...timeInterval(["starttime", "endtime"], "~"),
+    width: "200px"
+  },
+
   {
     prop: "addtime",
     label: "创建时间",
-    sortable: true
+    sortable: true,
+    width: "160px"
   },
 
   {
@@ -53,11 +76,11 @@ const columns = [
 ];
 
 const contentConfig: ContentConfig = {
-  title: "商品管理",
+  title: "服务管理",
   columns,
   apis: {
-    httpAdd,
     httpList,
+    httpAdd,
     httpUpdate,
     httpStatus,
     httpDelete

+ 56 - 53
src/views/operate/setService/config/modal.config.ts

@@ -1,84 +1,87 @@
 import { ModalConfig } from "/@/components/PageModal/src/types";
-import { httpList as httpCompanylist } from "/@/api/parameter/company";
-import { httpList as httpCardlist } from "/@/api/parameter/card";
+import { isLicense } from "/@/utils/validate";
+
 const modalConfig: ModalConfig = {
-  title: "企业商品",
+  title: "服务",
   colLayout: { span: 24 },
   itemStyle: {},
   contact: "setService",
-  labelWidth: "85px",
+  labelWidth: "100px",
+  width: "700px",
   formItems: [
     {
-      field: "name",
-      type: "remote-select",
-      label: "业务企业",
-      placeholder: "业务企业",
-      otherOptions: {
-        api: httpCompanylist,
-        responseLabelProp: "title",
-        responseValPro: "id",
-        requesetProp: "",
-        isRoot: false,
-        prop: "list"
-      },
-      span: 24,
-      rules: [{ required: true, trigger: "change", message: "请选择业务企业" }]
+      field: "company_title",
+      type: "input",
+      label: "公司",
+      placeholder: "公司"
     },
+
     {
-      field: "name2",
-      type: "remote-select",
+      field: "card_title",
+      type: "input",
       label: "卡类型",
-      placeholder: "卡类型",
-      otherOptions: {
-        api: httpCardlist,
-        responseLabelProp: "title",
-        responseValPro: "id",
-        requesetProp: "",
-        isRoot: false,
-        prop: "list"
-      },
-      span: 24,
-      rules: [{ required: true, trigger: "change", message: "请选择卡类型" }]
+      placeholder: "卡类型"
     },
+
     {
       field: "title",
       type: "input",
       label: "服务名称",
-      placeholder: "服务名称",
-      span: 24,
-      rules: [{ required: true, trigger: "bulr", message: "请输入服务名称" }]
+      placeholder: "服务名称"
     },
     {
-      field: "title",
+      field: "original_price",
       type: "number",
       label: "原价",
-      placeholder: "原价",
-      span: 8,
-      rules: [{ required: true, trigger: "bulr", message: "请输入原价" }]
+      placeholder: "原价"
     },
     {
-      field: "title1",
+      field: "activity_price",
       type: "number",
       label: "活动价",
-      placeholder: "活动价",
-      span: 8,
-      rules: [{ required: true, trigger: "bulr", message: "请输入原价" }]
+      placeholder: "活动价"
     },
+
     {
-      field: "title1",
-      type: "number",
-      label: "到期时间",
-      placeholder: "到期时间",
-      span: 8,
-      rules: [{ required: true, trigger: "change", message: "请选择到期时间" }]
+      field: "starttime",
+      type: "date_picker",
+      label: "活动开始日期",
+      placeholder: "活动开始日期",
+      span: 24
     },
     {
-      field: "title2",
+      field: "endtime",
       type: "date_picker",
-      label: "活动时间",
-      placeholder: "活动时间",
-      span: 8,
-      rules: [{ required: true, trigger: "change", message: "请选择到期时间" }]
+      label: "活动结束日期",
+      placeholder: "活动结束日期",
+      span: 24
+    },
+    {
+      field: "expiretime",
+      type: "date_picker",
+      label: "服务到期日期",
+      placeholder: "服务到期日期",
+      span: 24
+    },
+    {
+      field: "content",
+      type: "textarea",
+      label: "服务介绍",
+      placeholder: "服务介绍",
+      span: 24
+    },
+    {
+      field: "remark",
+      type: "textarea",
+      label: "备注",
+      placeholder: "备注",
+      span: 24
+    },
+    {
+      field: "addtime",
+      type: "input",
+      label: "创建时间",
+      placeholder: "创建时间"
     }
   ]
 };

+ 4 - 13
src/views/operate/setService/config/search.config.ts

@@ -1,29 +1,20 @@
 import { FormConfig } from "/@/components/PageSearch";
-import { STATUS_OPTIONS } from "/@/config/status";
-import { convertOptions } from "/@/utils/column-helper";
-
 const searchFormConfig: FormConfig = {
   formItems: [
-    {
-      field: "status",
-      type: "select",
-      placeholder: "状态",
-      options: convertOptions(STATUS_OPTIONS)
-    },
     {
       field: "title",
       type: "input",
       placeholder: "企业名称"
     },
     {
-      field: "contacts",
+      field: "company_title",
       type: "input",
-      placeholder: "联系人"
+      placeholder: "企业名称"
     },
     {
-      field: "mobile",
+      field: "card_title",
       type: "input",
-      placeholder: "联系方式"
+      placeholder: "卡类型名称"
     }
   ]
 };

+ 83 - 7
src/views/operate/setService/index.vue

@@ -1,15 +1,29 @@
 <script setup lang="ts">
-import { ref } from "vue";
 import { PageSearch, usePageSearch } from "/@/components/PageSearch";
 import searchConfig from "./config/search.config";
 import contentConfig from "./config/content.config";
+import PageAuth from "/@/components/PageAuth";
+import { PageModal, usePageModal } from "/@/components/PageModalShell";
 import modalConfig from "./config/modal.config";
-import { PageModal, usePageModal } from "/@/components/PageModal";
 import { PageContent } from "/@/components/PageContent";
-
 import type { PageContentInstance } from "/@/components/PageContent";
+import { Company, Card } from "/@/components/RemoteSelect";
+import { projectFormConfig } from "./config/_details";
+import { projectFormRules } from "./config/_rules";
+import {
+  BasicForm,
+  transform,
+  createDefaultData
+} from "/@/components/BasicForm";
+import { ElImage } from "element-plus";
+import { httpDetail } from "/@/api/operate/setService";
+import { ElForm } from "element-plus";
+import { ref, unref } from "vue";
+import dayjs from "dayjs";
+import { useResponseHandle } from "/@/hooks/useAsync";
+const responseHandle = useResponseHandle();
+// import { httpDetail } from "/@/api/parameter/video";
 const pageContentRef = ref<PageContentInstance | null>(null);
-const pageName = "good";
 const {
   pageModalRef,
   handleUpdateData,
@@ -21,6 +35,46 @@ const {
   pageContentRef
 });
 const { handleResetClick, handleSearchClick } = usePageSearch();
+const { formItems } = projectFormConfig;
+
+const basicFormRef = ref<InstanceType<typeof ElForm>>(null);
+const formData = ref<Record<string, any>>(createDefaultData(formItems));
+function handleCreate() {
+  basicFormRef.value.validate(isValid => {
+    if (!isValid) return;
+    const params = unref(formData);
+    const { starttime, endtime, expiretime } = params;
+    params.starttime = starttime ? dayjs(starttime).format("YYYY-MM-DD") : "";
+    params.endtime = endtime ? dayjs(endtime).format("YYYY-MM-DD") : "";
+    params.expiretime = expiretime
+      ? dayjs(expiretime).format("YYYY-MM-DD")
+      : "";
+    if (
+      new Date(params.starttime).valueOf() >= new Date(params.endtime).valueOf()
+    ) {
+      ElImage.warning("活动开始日期不能大于活动结束日期!");
+      return;
+    }
+    handleConfrim("create", params);
+  });
+}
+async function handleDetailData(row, type) {
+  const { id } = row;
+  const { code, data, message } = await httpDetail({ id: id });
+  responseHandle({
+    code,
+    message,
+    handler: () => {
+      if (type === "preview") {
+        handlePreviewData(data);
+      }
+      if (type === "update") {
+        formData.value = transform(formItems, data, {});
+        handleUpdateData(data);
+      }
+    }
+  });
+}
 </script>
 
 <template>
@@ -34,14 +88,36 @@ const { handleResetClick, handleSearchClick } = usePageSearch();
     ref="pageContentRef"
     :content-config="contentConfig"
     @create-btn-click="handleCreateData"
-    @preview-btn-click="row => handlePreviewData(row)"
-    @update-btn-click="row => handleUpdateData(row)"
+    @preview-btn-click="row => handleDetailData(row, 'preview')"
+    @update-btn-click="row => handleDetailData(row, 'update')"
   />
+  <!--需要优化 上架/下架提示优化-->
   <PageModal
     ref="pageModalRef"
     :modal-config="modalConfig"
     :default-info="defaultInfo"
     @confirm-btn-click="handleConfrim"
-  />
+  >
+    <BasicForm
+      ref="basicFormRef"
+      v-bind="projectFormConfig"
+      :form-data="formData"
+      :rules="projectFormRules"
+      :disabled="false"
+      label-width="120px"
+    >
+      <template #company_id>
+        <Company v-model="formData.company_id" placeholder="公司" />
+      </template>
+      <template #card_id>
+        <Card v-model="formData.card_id" placeholder="卡类型" />
+      </template>
+      <template #footer>
+        <div class="w-full flex justify-end">
+          <ElButton type="primary" @click="handleCreate">保存</ElButton>
+        </div>
+      </template>
+    </BasicForm>
+  </PageModal>
   <!-- </PageAuth> -->
 </template>