xiaodai2017 2 år sedan
förälder
incheckning
515441d38a
29 ändrade filer med 197 tillägg och 903 borttagningar
  1. 20 12
      src/components/BasicForm/src/basic-form.vue
  2. 20 14
      src/components/BasicForm/src/form-items.vue
  3. 12 11
      src/components/ListModal/ListModal.vue
  4. 0 3
      src/components/PageContent/src/page-content.tsx
  5. 0 3
      src/components/PageDetail/index.ts
  6. 0 25
      src/components/PageDetail/src/index.vue
  7. 0 169
      src/components/PageListModall/columns.tsx
  8. 0 3
      src/components/PageListModall/index.ts
  9. 0 56
      src/components/PageListModall/pageListModal.vue
  10. 0 26
      src/components/PageListModall/search.config.ts
  11. 0 41
      src/components/PageListModall/types.ts
  12. 0 5
      src/components/PageModalShell/index.ts
  13. 0 24
      src/components/PageModalShell/src/description.vue
  14. 0 71
      src/components/PageModalShell/src/hooks/use-page-modal.ts
  15. 0 55
      src/components/PageModalShell/src/page-modal.vue
  16. 0 47
      src/components/PageModalShell/src/types.ts
  17. 0 11
      src/components/PageModalShell/src/utils/create-basic-title.ts
  18. 5 25
      src/config/status.ts
  19. 11 0
      src/style/index.scss
  20. 5 3
      src/views/mobile/exchangeStock/components/edit-dialog.vue
  21. 26 65
      src/views/mobile/exchangeStock/config/ListModal.config.ts
  22. 19 15
      src/views/mobile/exchangeStock/config/content.config.ts
  23. 20 0
      src/views/mobile/exchangeStock/config/search.config.ts
  24. 2 0
      src/views/mobile/exchangeStock/index.vue
  25. 5 7
      src/views/mobile/shopStock/components/edit-dialog.vue
  26. 26 65
      src/views/mobile/shopStock/config/ListModal.config.ts
  27. 13 12
      src/views/mobile/shopStock/config/content.config.ts
  28. 12 15
      src/views/mobile/shopStock/config/search.config.ts
  29. 1 120
      src/views/mobile/shopStock/index.vue

+ 20 - 12
src/components/BasicForm/src/basic-form.vue

@@ -202,18 +202,26 @@ defineExpose({
             </template>
 
             <template v-if="item.type === 'range'">
-              <div flex gap-2 w-full>
-                <el-input
-                  v-model="formData[item.field][0]"
-                  :placeholder="item.otherOptions?.startPlaceholder"
-                />
-
-                <span>至</span>
-
-                <el-input
-                  v-model="formData[item.field][1]"
-                  :placeholder="item.otherOptions?.endPlaceholder"
-                />
+              <div class="flex-ul clear">
+                <div class="fl flex-li">
+                  <el-input-number
+                    style="width: 100%"
+                    v-model="formData[item.field][0]"
+                    :precision="item.otherOptions?.precision"
+                    :controls="false"
+                    :placeholder="item.otherOptions?.startPlaceholder"
+                  />
+                </div>
+                <div class="fl flex-li-middle">至</div>
+                <div class="fl flex-li">
+                  <el-input-number
+                    style="width: 100%"
+                    v-model="formData[item.field][1]"
+                    :precision="item.otherOptions?.precision"
+                    :controls="false"
+                    :placeholder="item.otherOptions?.endPlaceholder"
+                  />
+                </div>
               </div>
             </template>
           </el-form-item>

+ 20 - 14
src/components/BasicForm/src/form-items.vue

@@ -124,7 +124,6 @@ onMounted(() => {
         </template>
 
         <template v-if="item.type === 'img_upload'">
-          <!-- <ImgUpload class="el-avatar" /> -->
           <ImageUpload
             v-model:url="formData[item.field]"
             :descs="['小于1Mb']"
@@ -138,7 +137,6 @@ onMounted(() => {
             :disabled="disabled"
             :types="['png', 'jpg', 'jpeg']"
           />
-          <!-- <el-upload class="el-avatar" /> -->
         </template>
 
         <template v-if="item.type === 'checkbox'">
@@ -189,18 +187,26 @@ onMounted(() => {
         </template>
 
         <template v-if="item.type === 'range'">
-          <div flex gap-2 w-full>
-            <el-input
-              v-model="formData[item.field][0]"
-              :placeholder="item.otherOptions?.startPlaceholder"
-            />
-
-            <span>至</span>
-
-            <el-input
-              v-model="formData[item.field][1]"
-              :placeholder="item.otherOptions?.endPlaceholder"
-            />
+          <div class="flex-ul clear">
+            <div class="fl flex-li">
+              <el-input-number
+                style="width: 100%"
+                v-model="formData[item.field][0]"
+                :precision="item.otherOptions?.precision"
+                :controls="false"
+                :placeholder="item.otherOptions?.startPlaceholder"
+              />
+            </div>
+            <div class="fl flex-li-middle">至</div>
+            <div class="fl flex-li">
+              <el-input-number
+                style="width: 100%"
+                v-model="formData[item.field][1]"
+                :precision="item.otherOptions?.precision"
+                :controls="false"
+                :placeholder="item.otherOptions?.endPlaceholder"
+              />
+            </div>
           </div>
         </template>
       </el-form-item>

+ 12 - 11
src/components/ListModal/ListModal.vue

@@ -1,9 +1,9 @@
 <script setup lang="ts">
-import { computed, ref, unref } from "vue";
+import { computed, nextTick, ref } from "vue";
 import { PageSearch, usePageSearch } from "/@/components/PageSearch";
 import { modalProps } from "./types";
-import { ElMessage } from "element-plus";
 import { PageContent } from "/@/components/PageContent";
+
 const props = defineProps(modalProps);
 const modelTitle = computed(() => props.modalConfig.title);
 const searchConfig = computed(() => props.modalConfig.searchConfig);
@@ -13,18 +13,19 @@ const { pageContentRef, handleResetClick, handleSearchClick } = usePageSearch(
   undefined,
   searchConfig
 );
+
+// console.log(modelTitle);
+// console.log(searchConfig);
+// console.log(contentConfig);
 const dialogVisible = ref(false);
-function handleConfirmClick() {}
 async function show(id) {
-  console.log(id);
-  // modelFormItems.value.forEach(item => {
-  //   if (item.field === "id") {
-  //     formData.value[item.field] = id;
-  //   } else {
-  //     formData.value[item.field] = "";
-  //   }
-  // });
   dialogVisible.value = true;
+  nextTick(() => {
+    if (pageContentRef.value) {
+      console.log("value" + id);
+      pageContentRef.value.getPageData({ id: id });
+    }
+  });
 }
 defineExpose({
   show

+ 0 - 3
src/components/PageContent/src/page-content.tsx

@@ -32,10 +32,7 @@ const PageConent = defineComponent({
   setup(props, { expose, emit, slots }) {
     //根据传入的api决定表格需要的操作
     const action = createOperation(props.contentConfig.apis);
-    console.log(action);
-
     const tableRef = ref<InstanceType<typeof PureTable>>(null);
-
     const {
       loading,
       dataList,

+ 0 - 3
src/components/PageDetail/index.ts

@@ -1,3 +0,0 @@
-import PageDetail from "./src/index.vue";
-
-export default PageDetail;

+ 0 - 25
src/components/PageDetail/src/index.vue

@@ -1,25 +0,0 @@
-<template>
-  <div class="container">
-    <ElScrollbar>
-      <div class="page-detail__container">
-        <slot />
-      </div>
-    </ElScrollbar>
-  </div>
-</template>
-
-<style lang="scss" scoped>
-.container {
-  margin: 0 !important;
-  min-height: calc(100vh - 48px);
-}
-
-.page-detail__container {
-  padding: 10px;
-  max-width: calc(100vw - 54px);
-  // min-width: calc(100vw - 210px);
-  background-color: #fff;
-  margin: 0px !important;
-  min-height: 100vh;
-}
-</style>

+ 0 - 169
src/components/PageListModall/columns.tsx

@@ -1,169 +0,0 @@
-import { ref } from "vue";
-import dayjs from "dayjs";
-import { GOOD_OPTIONS } from "/@/config/status";
-import { renderImage, renderStatus } from "/@/utils/column-helper";
-// import { send_status_list } from "/@/utils/status";
-export function useColumns() {
-  const columns = ref([
-    {
-      type: "selection",
-      width: 30
-    },
-    {
-      label: "商品编号",
-      prop: "good_code",
-      width: 160,
-      showOverflowTooltip: true
-    },
-    {
-      label: "商品类型",
-      prop: "type",
-      width: 85,
-      showOverflowTooltip: true,
-      ...renderStatus(GOOD_OPTIONS, "type")
-    },
-    {
-      label: "图片",
-      prop: "good_cover_img",
-      width: 60,
-      showOverflowTooltip: true,
-      ...renderImage("good_cover_img")
-    },
-    {
-      label: "商品名称",
-      prop: "good_name",
-      minWidth: 160
-    },
-    {
-      label: "单位",
-      prop: "unit",
-      width: 80,
-      showOverflowTooltip: true
-    },
-    {
-      label: "起订量",
-      prop: "moq",
-      width: 80,
-      showOverflowTooltip: true
-    },
-    {
-      label: "步长",
-      prop: "step",
-      width: 80,
-      showOverflowTooltip: true
-    },
-    {
-      label: "售价",
-      prop: "price",
-      width: 110,
-      showOverflowTooltip: true
-    }
-  ]);
-
-  return {
-    columns
-  };
-}
-
-export const order_detail_columns = [
-  {
-    field: "sequenceNo",
-    label: "确认单编号"
-  },
-  {
-    field: "ownerName",
-    label: "销售员"
-  },
-  {
-    field: "department",
-    label: "平台名称"
-  },
-  {
-    field: "companyName",
-    label: "业务公司名称"
-  },
-  {
-    field: "customerName",
-    label: "客户名称"
-  },
-  {
-    field: "goodNum",
-    label: "商品数量"
-  },
-  {
-    field: "goodPrice",
-    label: "商品单价"
-  },
-  {
-    field: "goodName",
-    label: "商品名称"
-  },
-
-  {
-    field: "inv_fee",
-    label: "开票中"
-  },
-  {
-    field: "ainv_fee",
-    label: "已开票"
-  },
-  {
-    field: "winv_num",
-    label: "未开票数量"
-  },
-  {
-    field: "winv_fee",
-    label: "未开票"
-  }
-];
-
-/**
- * @invoice_addr 公司注册地址
- * @invoice_people  法人
- * @invoice_mobile 联系方式
- * @invoice_code 纳税识别号
- * @invoice_bank 开户行
- * @invoice_bankNo 开户账户
- */
-export const convertInvoiceTitle = (title: Record<string, string>) => {
-  const { company_address, mobile, company_license, bank_name, bankNo } = title;
-
-  return {
-    invoice_addr: company_address,
-    invoice_mobile: mobile,
-    invoice_code: company_license,
-    invoice_bank: bank_name,
-    invoice_bankNo: bankNo
-  };
-};
-
-export const convertInvoiceTitleData = (title: Record<string, string>) => {
-  const {
-    invoice_addr,
-    invoice_mobile,
-    invoice_code,
-    invoice_bank,
-    invoice_bankNo
-  } = title;
-
-  return {
-    invoice_code,
-    addrAndmobile: invoice_addr + " " + invoice_mobile,
-    bankAndBankNo: invoice_bank + " " + invoice_bankNo
-  };
-};
-
-export const invoice_columns = [
-  {
-    label: "纳税人识别号",
-    field: "invoice_code"
-  },
-  {
-    label: "地址、电话",
-    field: "addrAndmobile"
-  },
-  {
-    label: "开户行及账号",
-    field: "bankAndBankNo"
-  }
-];

+ 0 - 3
src/components/PageListModall/index.ts

@@ -1,3 +0,0 @@
-import pageListModal from "./pageListModal.vue";
-
-export default pageListModal;

+ 0 - 56
src/components/PageListModall/pageListModal.vue

@@ -1,56 +0,0 @@
-<script setup lang="ts">
-import { computed, ref } from "vue";
-import { PageContent } from "/@/components/PageContent";
-import { PageSearch, usePageSearch } from "/@/components/PageSearch";
-import { modalProps } from "./types";
-// import type { PageContentInstance } from "/@/components/PageContent";
-
-const props = defineProps(modalProps);
-const { modalConfig } = props;
-const { title, searchConfig, contentConfig } = modalConfig;
-const { pageContentRef, handleResetClick, handleSearchClick } = usePageSearch(
-  undefined,
-  undefined,
-  searchConfig
-);
-// const emit = defineEmits(["confirmBtnClick"]);
-
-const dialogVisible = ref(false);
-
-async function show(_group_id) {
-  dialogVisible.value = true;
-  console.log(pageContentRef);
-  pageContentRef.value.getPageData({ id: _group_id });
-}
-defineExpose({
-  show
-});
-</script>
-
-<template>
-  <el-dialog
-    :title="title"
-    v-model="dialogVisible"
-    center
-    top="8vh"
-    destroy-on-close
-    width="1040px"
-  >
-    <PageSearch
-      :form-config="searchConfig"
-      @search-btn-click="handleSearchClick"
-      @reset-btn-click="handleResetClick"
-    />
-    <PageContent ref="pageContentRef" :content-config="contentConfig" />
-  </el-dialog>
-</template>
-
-<style lang="scss" scoped>
-:deep(.el-pagination) {
-  justify-content: flex-start !important;
-}
-
-.search {
-  padding: 0px !important;
-}
-</style>

+ 0 - 26
src/components/PageListModall/search.config.ts

@@ -1,26 +0,0 @@
-import { FormConfig } from "/@/components/PageSearch";
-// import { INV_OPEN_STATUS } from "/@/utils/details/inv-open";
-
-const searchFormConfig: FormConfig = {
-  colLayout: { span: 8 },
-  formItems: [
-    {
-      field: "status",
-      type: "input",
-      placeholder: "发票申请状态",
-      options: []
-    },
-    {
-      field: "inv_type",
-      type: "select",
-      placeholder: "发票类型"
-    },
-    {
-      field: "customer",
-      type: "input",
-      placeholder: "客户名称"
-    }
-  ]
-};
-
-export default searchFormConfig;

+ 0 - 41
src/components/PageListModall/types.ts

@@ -1,41 +0,0 @@
-import pageModal from "./page-modal.vue";
-import { FormConfig as searchFormConfig } from "/@/components/PageSearch";
-import { ContentConfig } from "/@/components/PageContent";
-
-export type PageModalInstance = typeof pageModal & {
-  dialogVisible: boolean;
-  // confirmLoading: boolean;
-  // type: ActionType;
-};
-
-export interface ModalConfig {
-  title: string;
-  searchConfig?: searchFormConfig;
-  contentConfig?: ContentConfig;
-}
-
-export const modalProps = {
-  modalConfig: {
-    type: Object as PropType<ModalConfig>,
-    required: true
-  },
-  prviewDescription: {
-    type: Boolean,
-    default: false
-  },
-  defaultInfo: {
-    type: Object,
-    required: true
-  }
-};
-
-export const descritonProps = {
-  config: {
-    type: Object as PropType<ModalConfig>,
-    required: true
-  },
-  defaultInfo: {
-    type: Object,
-    required: true
-  }
-};

+ 0 - 5
src/components/PageModalShell/index.ts

@@ -1,5 +0,0 @@
-import PageModal from "./src/page-modal.vue";
-
-export { usePageModal } from "./src/hooks/use-page-modal";
-
-export { PageModal };

+ 0 - 24
src/components/PageModalShell/src/description.vue

@@ -1,24 +0,0 @@
-<script setup lang="ts">
-import { descritonProps } from "./types";
-
-defineProps(descritonProps);
-</script>
-
-<template>
-  <el-descriptions :column="1" border>
-    <template v-for="(item, index) in config.formItems" :key="index">
-      <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>

+ 0 - 71
src/components/PageModalShell/src/hooks/use-page-modal.ts

@@ -1,71 +0,0 @@
-import { Ref, ref } from "vue";
-import { PageModalInstance } from "../types";
-import {
-  ActionType,
-  PageContentInstance
-} from "/@/components/PageContent/src/types";
-
-type CallbackType = () => any;
-
-type Config = {
-  createCallback?: CallbackType;
-  updateCallback?: CallbackType;
-  previewCallback?: CallbackType;
-  confirmCallback?: (data: any) => any;
-  pageContentRef: Ref<PageContentInstance>;
-};
-
-export function usePageModal({
-  createCallback,
-  updateCallback,
-  confirmCallback,
-  previewCallback,
-  pageContentRef
-}: Config) {
-  const pageModalRef = ref<PageModalInstance>(null);
-  const defaultInfo = ref<Record<string, string>>({});
-
-  function handleCreateData() {
-    defaultInfo.value = {};
-    pageModalRef.value.type = "create";
-    createCallback && createCallback();
-    pageModalRef.value.dialogVisible = true;
-  }
-
-  function handleUpdateData(item: any) {
-    defaultInfo.value = { ...item };
-    pageModalRef.value.type = "update";
-    updateCallback && updateCallback();
-    pageModalRef.value.dialogVisible = true;
-  }
-
-  function handlePreviewData(item: any) {
-    defaultInfo.value = { ...item };
-    pageModalRef.value.type = "preview";
-    previewCallback && previewCallback();
-    pageModalRef.value.dialogVisible = true;
-  }
-
-  function handleConfrim(type: ActionType, data: any) {
-    const result = confirmCallback ? confirmCallback(data) : {};
-    pageModalRef.value.confirmLoading = true;
-    const params = {
-      ...(type === "update" ? { id: defaultInfo.value.id } : {}),
-      ...(result ? result : {}),
-      ...data
-    };
-    pageContentRef.value.onBeforeAction(type, params, () => {
-      pageModalRef.value.confirmLoading = false;
-      pageModalRef.value.dialogVisible = false;
-    });
-  }
-
-  return {
-    handleCreateData,
-    handleUpdateData,
-    handlePreviewData,
-    handleConfrim,
-    defaultInfo,
-    pageModalRef
-  };
-}

+ 0 - 55
src/components/PageModalShell/src/page-modal.vue

@@ -1,55 +0,0 @@
-<script setup lang="ts">
-import { computed, ref } from "vue";
-import Description from "./description.vue";
-import { ActionType } from "/@/components/PageContent";
-import { createBasicTitle } from "./utils/create-basic-title";
-import { modalProps } from "./types";
-
-const props = defineProps(modalProps);
-// const emit = defineEmits(["confirmBtnClick"]);
-
-const type = ref<ActionType>("preview");
-const dialogVisible = ref(false);
-const confirmLoading = ref(false);
-
-//状态是否处于预览详情
-const isPreview = computed(() => type.value === "preview");
-
-const title = computed(() => {
-  const basicTitle = createBasicTitle(type.value);
-  return type.value === "preview"
-    ? props.modalConfig.title + basicTitle
-    : basicTitle + props.modalConfig.title;
-});
-
-const width = computed(() => {
-  return props.modalConfig.width;
-});
-
-defineExpose({
-  dialogVisible,
-  confirmLoading,
-  type
-});
-</script>
-
-<template>
-  <el-dialog
-    :title="title"
-    v-model="dialogVisible"
-    center
-    top="8vh"
-    destroy-on-close
-    :width="width ? width : '1024px'"
-  >
-    <!--插槽  -->
-    <template v-if="!isPreview">
-      <slot />
-    </template>
-    <Description
-      v-if="isPreview"
-      :config="modalConfig"
-      :default-info="defaultInfo"
-    />
-  </el-dialog>
-</template>

+ 0 - 47
src/components/PageModalShell/src/types.ts

@@ -1,47 +0,0 @@
-import { ActionType } from "../../PageContent";
-import { FormGorup, FormItem } from "../../BasicForm";
-import pageModal from "./page-modal.vue";
-
-export type PageModalInstance = typeof pageModal & {
-  dialogVisible: boolean;
-  confirmLoading: boolean;
-  type: ActionType;
-};
-
-export interface ModalConfig {
-  title: string;
-  width?: string;
-  formItems?: Array<FormItem>;
-  formGroup?: Array<FormGorup>;
-  colLayout?: any;
-  itemStyle?: Record<string, string>;
-  labelWidth?: string;
-  contact?: string;
-  divider?: boolean;
-}
-
-export const modalProps = {
-  modalConfig: {
-    type: Object as PropType<ModalConfig>,
-    required: true
-  },
-  prviewDescription: {
-    type: Boolean,
-    default: false
-  },
-  defaultInfo: {
-    type: Object,
-    required: true
-  }
-};
-
-export const descritonProps = {
-  config: {
-    type: Object as PropType<ModalConfig>,
-    required: true
-  },
-  defaultInfo: {
-    type: Object,
-    required: true
-  }
-};

+ 0 - 11
src/components/PageModalShell/src/utils/create-basic-title.ts

@@ -1,11 +0,0 @@
-import { ActionType } from "/@/components/PageContent";
-
-const mapActionToBasicTitle = {
-  update: "编辑",
-  create: "新增",
-  preview: "详情"
-};
-
-export function createBasicTitle(type: ActionType) {
-  return mapActionToBasicTitle[type];
-}

+ 5 - 25
src/config/status.ts

@@ -1,27 +1,3 @@
-//订单来源 - 销售
-export const XS_ORDER_SOURCE_OPTIONS = [
-  { id: "1", label: "库存品" },
-  { id: "2", label: "非库存品" },
-  { id: "3", label: "采购反馈" }
-];
-
-//商品来源 - 销售
-export const XS_GOOD_SOURCE_OPTIONS = [
-  // { id: "0", label: "备库单" },
-  { id: "1", label: "直接下单" },
-  { id: "2", label: "竞价转单" },
-  { id: "3", label: "项目转单" },
-  { id: "4", label: "平台导入" },
-  { id: "5", label: "有赞平台" },
-  { id: "6", label: "售后补换货" }
-];
-
-export const CG_ORDER_TYPE_OPTIONS = [
-  { id: "1", label: "备库单" },
-  { id: "2", label: "非库存品" },
-  { id: "3", label: "采反" }
-];
-
 export const STATUS_OPTIONS = [
   { id: "1", label: "启用", value: "1", type: "success" },
   { id: "0", label: "禁用", value: "0", type: "warning" }
@@ -81,9 +57,13 @@ export const JUMP_OPTIONS = [
   { id: "3", label: "外部跳转", value: "3", type: "success" }
 ];
 export const FLAG_OPTIONS = [
-  { id: "1", label: "增加", value: "1", type: "warning" },
+  { id: "1", label: "增加", value: "1", type: "success" },
   { id: "-1", label: "减少", value: "-1", type: "primary" }
 ];
+export const FLAG_SOURCE_OPTIONS = [
+  { id: "1", label: "管理后台", value: "1", type: "success" },
+  { id: "2", label: "客户兑换", value: "2", type: "primary" }
+];
 export const SYS_TYPE_OPTIONS = [
   { id: "MSG", label: "公告", value: "MSG", type: "warning" },
   { id: "VER", label: "版本", value: "VER", type: "primary" }

+ 11 - 0
src/style/index.scss

@@ -59,4 +59,15 @@
   
 .el-dialog__body .el-form>.el-form-item.asterisk-left {
   margin: 0 0 18px 0 !important;
+}
+.flex-ul{
+width: 100%; 
+.flex-li-middle{
+  width:28px;
+  text-align: center;
+}
+.flex-li{
+  width:  calc(50% - 14px );
+}
+  
 }

+ 5 - 3
src/views/mobile/exchangeStock/components/edit-dialog.vue

@@ -41,8 +41,10 @@ const initData = async () => {
       Object.keys(ruleForm.value).forEach(key => {
         if (key === "flag") {
           ruleForm.value[key] = "1";
-        } else {
+        } else if (key === "id") {
           ruleForm.value[key] = data[key] ? data[key] + "" : "";
+        } else {
+          ruleForm.value[key] = data[key] ? Number(data[key] + "") : 0;
         }
       });
       inventory.value = Number(data.inventory);
@@ -161,10 +163,10 @@ defineExpose({
           </el-form-item>
         </el-col>
         <el-col :span="6" v-if="TYPE !== 'view'">
-          <el-form-item label="变动状态" prop="flag">
+          <el-form-item label="变动类型" prop="flag">
             <el-select
               v-model="ruleForm.flag"
-              placeholder="变动状态"
+              placeholder="变动类型"
               :disabled="TYPE === 'view'"
               style="width: 100%"
             >

+ 26 - 65
src/views/mobile/exchangeStock/config/ListModal.config.ts

@@ -1,99 +1,60 @@
 import { ModalConfig } from "/@/components/ListModal";
 import { httpLog } from "/@/api/mobile/exchangeStock";
-import { renderImage } from "/@/utils/column-helper";
 import { FormConfig } from "/@/components/PageSearch";
+import { ContentConfig } from "/@/components/PageContent";
+import { FLAG_OPTIONS, FLAG_SOURCE_OPTIONS } from "/@/config/status";
+import { renderStatus } from "/@/utils/column-helper";
 const searchFormConfig: FormConfig = {
   isHide: true,
   formItems: []
 };
 const columns = [
-  {
-    type: "selection",
-    width: 55,
-    hide: ({ checkList }) => !checkList.includes("勾选列")
-  },
-  // {
-  //   prop: "id",
-  //   label: "ID"
-  // },
-
-  {
-    prop: "account_username",
-    label: "账户"
-  },
-  {
-    prop: "account_name",
-    label: "账户姓名"
-  },
   {
     prop: "good_code",
     label: "商品编码",
     width: 160
   },
-  {
-    label: "图片",
-    prop: "good_cover_img",
-    width: 60,
-    showOverflowTooltip: true,
-    ...renderImage("good_cover_img")
-  },
   {
     label: "商品名称",
     prop: "good_name",
     minWidth: 160
   },
+
   {
-    prop: "inventory",
-    label: "库存",
+    prop: "before_inventory",
+    label: "修改前库存",
     width: "110px"
   },
   {
-    label: "单位",
-    prop: "unit",
-    width: 80,
-    showOverflowTooltip: true
-  },
-  {
-    label: "起订量",
-    prop: "moq",
-    width: 80,
-    showOverflowTooltip: true
-  },
-  {
-    label: "步长",
-    prop: "step",
-    width: 80,
-    showOverflowTooltip: true
+    prop: "flag",
+    label: "修改方式",
+    ...renderStatus(FLAG_OPTIONS, "flag"),
+    width: "70px"
   },
   {
-    label: "售价",
-    prop: "price",
-    width: 110,
-    showOverflowTooltip: true
+    prop: "after_inventory",
+    label: "修改后库存",
+    width: "110px"
   },
-
   {
-    prop: "updatetime",
-    label: "更新时间",
-    width: "160px"
+    prop: "source",
+    label: "操作来源",
+    ...renderStatus(FLAG_SOURCE_OPTIONS, "source"),
+    width: "110px"
   },
 
   {
-    label: "操作",
-    fixed: "right",
-    width: 120,
-    slot: "operation"
+    prop: "addtime",
+    label: "操作时间",
+    width: "140px"
   }
 ];
-const contentConfig = {
-  title: "兑换商品",
-  searchConfig: { formItems: [] },
-  contentConfig: {
-    title: "卡类型管理2",
-    columns,
-    apis: {
-      httpList: httpLog
-    }
+const contentConfig: ContentConfig = {
+  title: "卡类型管理",
+  notReuqiredInit: true,
+  columns,
+  apis: {
+    httpList: httpLog
   }
 };
 

+ 19 - 15
src/views/mobile/exchangeStock/config/content.config.ts

@@ -2,9 +2,6 @@ import { ContentConfig } from "/@/components/PageContent";
 import { httpList } from "/@/api/mobile/exchangeStock";
 import { renderImage } from "/@/utils/column-helper";
 const columns = [
- 
- 
-
   {
     prop: "account_username",
     label: "账户",
@@ -14,10 +11,16 @@ const columns = [
     prop: "account_name",
     label: "账户姓名"
   },
+  {
+    prop: "mobile",
+    label: "手机号",
+    width: 100
+  },
+
   {
     prop: "good_code",
     label: "商品编码",
-    width: 160
+    width: 140
   },
   {
     label: "图片",
@@ -31,46 +34,47 @@ const columns = [
     prop: "good_name",
     minWidth: 160
   },
+
   {
     prop: "inventory",
     label: "库存数",
     width: "110px"
   },
+  {
+    label: "售价",
+    prop: "price",
+    width: 110,
+    showOverflowTooltip: true
+  },
   {
     label: "单位",
     prop: "unit",
-    width: 80,
+    width: 50,
     showOverflowTooltip: true
   },
   {
     label: "起订量",
     prop: "moq",
-    width: 80,
+    width: 60,
     showOverflowTooltip: true
   },
   {
     label: "步长",
     prop: "step",
-    width: 80,
-    showOverflowTooltip: true
-  },
-  {
-    label: "售价",
-    prop: "price",
-    width: 110,
+    width: 50,
     showOverflowTooltip: true
   },
 
   {
     prop: "updatetime",
     label: "更新时间",
-    width: "160px"
+    width: "140px"
   },
 
   {
     label: "操作",
     fixed: "right",
-    width: 120,
+    width: 110,
     slot: "operation"
   }
 ];

+ 20 - 0
src/views/mobile/exchangeStock/config/search.config.ts

@@ -10,6 +10,26 @@ const searchFormConfig: FormConfig = {
       placeholder: "账号状态",
       options: convertOptions(ACCOUNT_STATUS_OPTIONS)
     },
+    {
+      field: ["inventory_start", "inventory_end"],
+      type: "range",
+      otherOptions: {
+        startPlaceholder: "库存起始值",
+        endPlaceholder: "库存结束值",
+        precision: 0
+      }
+    },
+
+    {
+      field: "good_name",
+      type: "input",
+      placeholder: "商品编号"
+    },
+    {
+      field: "good_name",
+      type: "input",
+      placeholder: "商品名称"
+    },
     {
       field: "username",
       type: "input",

+ 2 - 0
src/views/mobile/exchangeStock/index.vue

@@ -20,6 +20,8 @@ const { pageContentRef, handleResetClick, handleSearchClick } = usePageSearch(
   searchConfig
 );
 
+console.log(searchConfig);
+console.log(contentConfig);
 const ListModalRef = ref<InstanceType<typeof ListModal>>(null);
 
 function showLog(id) {

+ 5 - 7
src/views/mobile/shopStock/components/edit-dialog.vue

@@ -41,8 +41,10 @@ const initData = async () => {
       Object.keys(ruleForm.value).forEach(key => {
         if (key === "flag") {
           ruleForm.value[key] = "1";
-        } else {
+        } else if (key === "id") {
           ruleForm.value[key] = data[key] ? data[key] + "" : "";
+        } else {
+          ruleForm.value[key] = data[key] ? Number(data[key] + "") : 0;
         }
       });
       inventory.value = Number(data.inventory);
@@ -161,10 +163,10 @@ defineExpose({
           </el-form-item>
         </el-col>
         <el-col :span="6" v-if="TYPE !== 'view'">
-          <el-form-item label="变动状态" prop="flag">
+          <el-form-item label="变动类型" prop="flag">
             <el-select
               v-model="ruleForm.flag"
-              placeholder="变动状态"
+              placeholder="变动类型"
               :disabled="TYPE === 'view'"
               style="width: 100%"
             >
@@ -206,10 +208,6 @@ defineExpose({
           >
           <el-button @click="showModel = false">取消</el-button>
         </el-col>
-        <el-col :span="24">
-          <el-form-item label="账号信息"> 111 </el-form-item>
-        </el-col>
-
         <el-col :span="24">
           <el-form-item label="商品信息"> 22 </el-form-item>
         </el-col>

+ 26 - 65
src/views/mobile/shopStock/config/ListModal.config.ts

@@ -1,99 +1,60 @@
 import { ModalConfig } from "/@/components/ListModal";
 import { httpLog } from "/@/api/mobile/shopStock";
-import { renderImage } from "/@/utils/column-helper";
 import { FormConfig } from "/@/components/PageSearch";
+import { ContentConfig } from "/@/components/PageContent";
+import { FLAG_OPTIONS, FLAG_SOURCE_OPTIONS } from "/@/config/status";
+import { renderStatus } from "/@/utils/column-helper";
 const searchFormConfig: FormConfig = {
   isHide: true,
   formItems: []
 };
 const columns = [
-  {
-    type: "selection",
-    width: 55,
-    hide: ({ checkList }) => !checkList.includes("勾选列")
-  },
-  // {
-  //   prop: "id",
-  //   label: "ID"
-  // },
-
-  {
-    prop: "account_username",
-    label: "账户"
-  },
-  {
-    prop: "account_name",
-    label: "账户姓名"
-  },
   {
     prop: "good_code",
     label: "商品编码",
     width: 160
   },
-  {
-    label: "图片",
-    prop: "good_cover_img",
-    width: 60,
-    showOverflowTooltip: true,
-    ...renderImage("good_cover_img")
-  },
   {
     label: "商品名称",
     prop: "good_name",
     minWidth: 160
   },
+
   {
-    prop: "inventory",
-    label: "库存",
+    prop: "before_inventory",
+    label: "修改前库存",
     width: "110px"
   },
   {
-    label: "单位",
-    prop: "unit",
-    width: 80,
-    showOverflowTooltip: true
-  },
-  {
-    label: "起订量",
-    prop: "moq",
-    width: 80,
-    showOverflowTooltip: true
-  },
-  {
-    label: "步长",
-    prop: "step",
-    width: 80,
-    showOverflowTooltip: true
+    prop: "flag",
+    label: "修改方式",
+    ...renderStatus(FLAG_OPTIONS, "flag"),
+    width: "70px"
   },
   {
-    label: "售价",
-    prop: "price",
-    width: 110,
-    showOverflowTooltip: true
+    prop: "after_inventory",
+    label: "修改后库存",
+    width: "110px"
   },
-
   {
-    prop: "updatetime",
-    label: "更新时间",
-    width: "160px"
+    prop: "source",
+    label: "操作来源",
+    ...renderStatus(FLAG_SOURCE_OPTIONS, "source"),
+    width: "110px"
   },
 
   {
-    label: "操作",
-    fixed: "right",
-    width: 120,
-    slot: "operation"
+    prop: "addtime",
+    label: "操作时间",
+    width: "140px"
   }
 ];
-const contentConfig = {
-  title: "兑换商品",
-  searchConfig: { formItems: [] },
-  contentConfig: {
-    title: "卡类型管理2",
-    columns,
-    apis: {
-      httpList: httpLog
-    }
+const contentConfig: ContentConfig = {
+  title: "卡类型管理",
+  notReuqiredInit: true,
+  columns,
+  apis: {
+    httpList: httpLog
   }
 };
 

+ 13 - 12
src/views/mobile/shopStock/config/content.config.ts

@@ -5,7 +5,7 @@ const columns = [
   {
     prop: "good_code",
     label: "商品编码",
-    width: 160
+    width: 140
   },
   {
     label: "图片",
@@ -24,41 +24,42 @@ const columns = [
     label: "库存数",
     width: "110px"
   },
+  {
+    label: "售价",
+    prop: "price",
+    width: 110,
+    showOverflowTooltip: true
+  },
+
   {
     label: "单位",
     prop: "unit",
-    width: 80,
+    width: 50,
     showOverflowTooltip: true
   },
   {
     label: "起订量",
     prop: "moq",
-    width: 80,
+    width: 60,
     showOverflowTooltip: true
   },
   {
     label: "步长",
     prop: "step",
-    width: 80,
-    showOverflowTooltip: true
-  },
-  {
-    label: "售价",
-    prop: "price",
-    width: 110,
+    width: 50,
     showOverflowTooltip: true
   },
 
   {
     prop: "updatetime",
     label: "更新时间",
-    width: "160px"
+    width: "140px"
   },
 
   {
     label: "操作",
     fixed: "right",
-    width: 120,
+    width: 110,
     slot: "operation"
   }
 ];

+ 12 - 15
src/views/mobile/shopStock/config/search.config.ts

@@ -1,29 +1,26 @@
 import { FormConfig } from "/@/components/PageSearch";
-import { ACCOUNT_STATUS_OPTIONS } from "/@/config/status";
-import { convertOptions } from "/@/utils/column-helper";
 
 const searchFormConfig: FormConfig = {
   formItems: [
     {
-      field: "status",
-      type: "select",
-      placeholder: "账号状态",
-      options: convertOptions(ACCOUNT_STATUS_OPTIONS)
-    },
-    {
-      field: "username",
-      type: "input",
-      placeholder: "账号"
+      field: ["inventory_start", "inventory_end"],
+      type: "range",
+      otherOptions: {
+        startPlaceholder: "库存起始值",
+        endPlaceholder: "库存结束值",
+        precision: 0
+      }
     },
+
     {
-      field: "nickname",
+      field: "good_name",
       type: "input",
-      placeholder: "客户姓名"
+      placeholder: "商品编号"
     },
     {
-      field: "mobile",
+      field: "good_name",
       type: "input",
-      placeholder: "客户手机号"
+      placeholder: "商品名称"
     }
   ]
 };

+ 1 - 120
src/views/mobile/shopStock/index.vue

@@ -1,7 +1,6 @@
 <script setup lang="ts">
 import { ref } from "vue";
 import { usePermission } from "/@/hooks/usePermission";
-
 import { PageSearch, usePageSearch } from "/@/components/PageSearch";
 import { PageContent } from "/@/components/PageContent";
 import searchConfig from "./config/search.config";
@@ -9,101 +8,20 @@ import contentConfig from "./config/content.config";
 import EditModel from "./components/edit-dialog.vue";
 import AddModel from "./components/add-dialog.vue";
 import ListModalConfig from "./config/ListModal.config";
-// import { PageModal, usePageModal } from "/@/components/PageModalShell";
-// import modalConfig from "./config/modal.config";
-
-// import { projectFormConfig } from "./config/_details";
-// import { projectFormRules } from "./config/_rules";
 
-// import {
-//   BasicForm,
-//   transform,
-//   createDefaultData
-// } from "/@/components/BasicForm";
-
-// import addModel from "./components/addModel.vue";
-// import { useResponseHandle } from "/@/hooks/useAsync";
-// import LadderTable from "./components/ladder-table.vue";
-// import { ComCard } from "/@/components/RemoteSelect";
-// import OrderDialog from "/@/components/PageListModal";
-// import { ElForm, ElMessage } from "element-plus";
 import ListModal from "/@/components/ListModal";
 const pageName = "shopStock";
 const { hasPermissionWithCode, permissions } = usePermission(pageName);
 const modelEditRef = ref<InstanceType<typeof EditModel>>(null);
 const modelAddRef = ref<InstanceType<typeof AddModel>>(null);
-// const responseHandle = useResponseHandle();
-// const modelOrderRef = ref<InstanceType<typeof OrderDialog>>(null);
-// const actionModalRef = ref<InstanceType<typeof addModel>>(null);
 const { pageContentRef, handleResetClick, handleSearchClick } = usePageSearch(
   undefined,
   undefined,
   searchConfig
 );
-// const { pageModalRef, handleCreateData, handleConfrim, defaultInfo } =
-//   usePageModal({
-//     pageContentRef
-//   });
-const ListModalRef = ref<InstanceType<typeof ListModal>>(null);
-// 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 { group_id, list } = formData.value;
-//     const params = {
-//       group_id,
-//       list: []
-//     };
-//     let isok = true;
-//     list.forEach(item => {
-//       const num = Number(item.inventory ?? "");
-//       const model = {
-//         good_id: item.id,
-//         inventory: num
-//       };
-//       params.list.push(model);
-//       if (num === 0) {
-//         isok = false;
-//       }
-//     });
-//     if (!isok) {
-//       ElMessage.warning("库存数不能为空!");
-//       return;
-//     }
 
-//     handleConfrim("create", params);
-//     // emit("create", params);
-//   });
-// }
-// async function handleDetailData(id, type) {
-//   actionModalRef.value.onShow("兑换商品库存", type, id);
-// }
-// function modularShow() {
-//   if (!formData.value.group_id) return ElMessage.warning("请选择公司卡类型!");
-//   modelOrderRef.value.show(formData.value.group_id, "1");
-// }
-// function handleAddOrder(list) {
-//   console.log(list);
-//   list.forEach(item => {
-//     const { id } = item;
-//     let findex = formData.value.list.findIndex(e => e.id + "" == id + "");
-//     if (findex == -1) {
-//       let model = Object.assign(item, {
-//         img: item.good_cover_img,
-//         good_id: item.id,
-//         jump_type: "2",
-//         jump_param: `/good?id=${item.id}`,
-//         style_type: "",
-//         title: ""
-//       });
-//       formData.value.list.push(model);
-//     }
-//   });
-// }
+const ListModalRef = ref<InstanceType<typeof ListModal>>(null);
 function showLog(id) {
-  console.log(id);
   ListModalRef.value.show(id);
 }
 function handleAddChangeCheck(item: any, id: string, type: string) {
@@ -140,45 +58,8 @@ function handleAddChangeCheck(item: any, id: string, type: string) {
       @update-btn-click="row => handleAddChangeCheck(row, row.id, 'edit')"
       @log-btn-click="({ id }) => showLog(id)"
     />
-
-    <!-- <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 #group_id>
-          <ComCard v-model="formData.group_id" placeholder="公司卡类型" />
-        </template>
-        
-        <template #list>
-          <LadderTable
-            :readonly="false"
-            :ladder="formData.list"
-            @choose="() => modularShow()"
-            @update="({ data, index }) => formData.list.splice(index, 1)"
-            @delete="index => formData.list.splice(index, 1)"
-          />
-        </template>
-        <template #footer>
-          <div class="w-full flex justify-end">
-            <ElButton type="primary" @click="handleCreate">保存</ElButton>
-          </div>
-        </template>
-      </BasicForm>
-    </PageModal> -->
     <AddModel ref="modelAddRef" @reload="pageContentRef.onSearch()" />
     <EditModel ref="modelEditRef" @reload="pageContentRef.onSearch()" />
-    <!-- <OrderDialog ref="modelOrderRef" @save-btn-click="handleAddOrder" /> -->
-    <!-- <addModel ref="actionModalRef" @submitOk="Create" /> -->
     <ListModal ref="ListModalRef" :modalConfig="ListModalConfig" />
   </PageAuth>
 </template>