Explorar o código

feat(order): update

gemercheung %!s(int64=3) %!d(string=hai) anos
pai
achega
6437521786

BIN=BIN
public/resource/img/pic_bg@2x.png


+ 15 - 0
src/api/product/category.ts

@@ -1,5 +1,6 @@
 import { defHttp } from '/@/utils/http/axios';
 import { PageParams, updateItem, RentListGetResultModel } from './model';
+import { Result, UploadFileParams } from '/#/axios';
 
 enum Api {
   category = '/basic-api/category/queryAll',
@@ -7,6 +8,7 @@ enum Api {
   delete = '/basic-api/specification/delete',
   update = '/basic-api/specification/update',
   save = '/basic-api/specification/save',
+  uploadBanner = '/basic-api/sys/oss/upload',
 }
 
 /**
@@ -62,3 +64,16 @@ export const attributeDleteApi = (params: string) =>
       ignoreCancelToken: true,
     },
   });
+
+export function uploadBannerApi(
+  params: UploadFileParams,
+  onUploadProgress: (progressEvent: ProgressEvent) => void,
+) {
+  return defHttp.uploadFile<Result>(
+    {
+      url: Api.uploadBanner,
+      onUploadProgress,
+    },
+    params,
+  );
+}

+ 1 - 0
src/utils/treeUtils.ts

@@ -5,6 +5,7 @@ export interface TreeNode {
   parentId: number;
   name: string;
   key?: string;
+  level?: string;
   children?: TreeNode[];
 }
 export interface TreeMenuNode {

+ 1 - 0
src/views/order/list.vue

@@ -284,6 +284,7 @@
         showIndexColumn: false,
         rowKey: 'id',
         pagination: { pageSize: 20 },
+        ellipsis: false,
         fetchSetting: {
           pageField: 'page',
           sizeField: 'limit',

+ 164 - 0
src/views/product/addCategoryModal.vue

@@ -0,0 +1,164 @@
+<!-- bannerUrl: ""
+iconUrl: ""
+imgUrl: ""
+isShow: "0"
+level: "L1"
+name: "test"
+type: 0
+wapBannerUrl: "https://4dkk.4dage.com/shop/huafa/20220302/23135195983e96.png?x-oss-process=image/resize,m_fixed,w_100,h_100" -->
+<template>
+  <BasicModal v-bind="$attrs" @register="register" title="新 增" @ok="handleOk">
+    <div class="pt-3px pr-3px">
+      <BasicForm @register="registerForm" :model="model" />
+    </div>
+  </BasicModal>
+</template>
+<script lang="ts">
+  import { defineComponent, ref } from 'vue';
+  import { categoryApi, uploadBannerApi } from '/@/api/product/category';
+  import { TreeNode } from '/@/utils/treeUtils';
+  import { BasicModal, useModalInner } from '/@/components/Modal';
+  import { BasicForm, FormSchema, useForm } from '/@/components/Form/index';
+
+  const isLevel2 = (type: string) => type === 'L2';
+  const schemas: FormSchema[] = [
+    {
+      field: 'name',
+      component: 'Input',
+      label: '分类名称',
+      colProps: {
+        span: 24,
+      },
+      required: true,
+    },
+    {
+      field: 'level',
+      component: 'RadioGroup',
+      label: '级别',
+      defaultValue: 'L1',
+      colProps: {
+        span: 24,
+      },
+      componentProps: {
+        options: [
+          {
+            label: '一级分类',
+            value: 'L1',
+          },
+          {
+            label: '二级分类',
+            value: 'L2',
+          },
+        ],
+      },
+    },
+
+    {
+      field: 'parent_id',
+      component: 'ApiSelect',
+      label: '上级分类',
+      ifShow: ({ values }) => isLevel2(values.level),
+      colProps: {
+        span: 18,
+      },
+      componentProps: {
+        api: async function (params) {
+          console.log('params', params);
+          const res = (await categoryApi(params)) as any as TreeNode[];
+          // const treeData = makeTree(res);
+          return res.filter((i) => i.level === 'L2');
+        },
+        labelField: 'name',
+        valueField: 'id',
+      },
+    },
+    {
+      field: 'isShow',
+      component: 'RadioGroup',
+      label: '是否显示',
+      defaultValue: '1',
+      colProps: {
+        span: 24,
+      },
+      componentProps: {
+        options: [
+          {
+            label: '不显示',
+            value: '0',
+          },
+          {
+            label: '显示',
+            value: '1',
+          },
+        ],
+      },
+    },
+    {
+      field: 'type',
+      component: 'InputNumber',
+      label: '排序',
+      defaultValue: 1,
+      colProps: {
+        span: 24,
+      },
+    },
+    {
+      field: 'wapBannerUrl',
+      component: 'Upload',
+      label: '主图',
+      rules: [{ required: true, message: '请选择上传文件' }],
+      componentProps: {
+        api: uploadBannerApi,
+        maxNumber: 1,
+        afterFetch: function (data) {
+          Reflect.set(data, 'url', data.message.url);
+          return data;
+        },
+      },
+      required: true,
+    },
+  ];
+  export default defineComponent({
+    components: { BasicModal, BasicForm },
+    props: {
+      userData: { type: Object },
+    },
+    setup() {
+      const modelRef = ref({});
+      const [
+        registerForm,
+        {
+          // setFieldsValue,
+          getFieldsValue,
+        },
+      ] = useForm({
+        labelWidth: 120,
+        schemas,
+        showActionButtonGroup: false,
+        actionColOptions: {
+          span: 24,
+        },
+      });
+
+      const [register, { closeModal }] = useModalInner((data) => {
+        data && onDataReceive(data);
+      });
+
+      function onDataReceive(data) {
+        console.log('Data Received', data);
+
+        modelRef.value = { field2: data.data, field1: data.info };
+      }
+
+      async function handleOk() {
+        let data = getFieldsValue();
+        console.log('data', data);
+        // let res = await saveItemApi(data);
+
+        closeModal();
+      }
+
+      return { register, schemas, registerForm, model: modelRef, handleOk };
+    },
+  });
+</script>

+ 36 - 26
src/views/product/category.vue

@@ -1,29 +1,32 @@
 <template>
-  <BasicTable @register="registerTable">
-    <template #toolbar>
-      <a-button primary color="error" @click="handleCreate"> 新增商品分类</a-button>
-      <a-button ghost color="warning" @click="expandAll">展开全部</a-button>
-      <a-button type="primary" @click="collapseAll">折叠全部</a-button>
-    </template>
-    <template #action="{ record }">
-      <TableAction
-        :actions="[
-          {
-            icon: 'clarity:note-edit-line',
-            onClick: handleEdit.bind(null, record),
-          },
-          {
-            icon: 'ant-design:delete-outlined',
-            color: 'error',
-            popConfirm: {
-              title: '是否确认删除',
-              confirm: handleDelete.bind(null, record),
+  <div>
+    <BasicTable @register="registerTable">
+      <template #toolbar>
+        <a-button primary color="error" @click="handleCreate"> 新增商品分类</a-button>
+        <a-button ghost color="warning" @click="expandAll">展开全部</a-button>
+        <a-button type="primary" @click="collapseAll">折叠全部</a-button>
+      </template>
+      <template #action="{ record }">
+        <TableAction
+          :actions="[
+            {
+              icon: 'clarity:note-edit-line',
+              onClick: handleEdit.bind(null, record),
             },
-          },
-        ]"
-      />
-    </template>
-  </BasicTable>
+            {
+              icon: 'ant-design:delete-outlined',
+              color: 'error',
+              popConfirm: {
+                title: '是否确认删除',
+                confirm: handleDelete.bind(null, record),
+              },
+            },
+          ]"
+        />
+      </template>
+    </BasicTable>
+    <addCategoryModal @register="registeraddCategoryModal" />
+  </div>
 </template>
 
 <script lang="ts">
@@ -36,8 +39,11 @@
   import { useMessage } from '/@/hooks/web/useMessage';
   import { makeTree } from '/@/utils/treeUtils';
 
+  import addCategoryModal from './addCategoryModal.vue';
+  import { useModal } from '/@/components/Modal';
+
   export default defineComponent({
-    components: { BasicTable, TableAction },
+    components: { BasicTable, TableAction, addCategoryModal },
     setup() {
       const { createMessage } = useMessage();
 
@@ -84,6 +90,7 @@
           width: 180,
         },
       ];
+      const [registeraddCategoryModal, { openModal }] = useModal();
 
       const [registerTable, { expandAll, collapseAll }] = useTable({
         title: '商品分类',
@@ -111,7 +118,9 @@
         },
       });
 
-      function handleCreate() {}
+      function handleCreate(record: Recordable) {
+        openModal(true, record);
+      }
       function handleEdit() {}
       function handleDelete() {}
       return {
@@ -123,6 +132,7 @@
         handleDelete,
         expandAll,
         collapseAll,
+        registeraddCategoryModal,
       };
     },
   });

+ 0 - 48
src/views/product/list.vue

@@ -1,51 +1,3 @@
-<!-- 
-ddTime: 1631589637000
-appExclusivePrice: null
-attributeCategory: null
-attributeCategoryName: null
-attributeEntityList: []
-brandId: 1046505
-brandName: "0907更新部署直播间"
-categoryId: 1036110
-categoryName: "6041分类"
-counterPrice: null
-createUserDeptId: 176
-createUserId: 247
-extraPrice: null
-ggContent: "[{\"value\":\"32\",\"picUrl\":\"https://4dkk.4dage.com/shop/huafa/20210914/11201310556ed1.png\",\"uuid\":\"1-1\",\"specificationId\":50,\"inputVal\":{\"goodsNumber\":\"\",\"goodsSn\":\"\",\"retailPrice\":\"\",\"marketPrice\":\"\"}}]"
-goodsBrief: null
-goodsDesc: ""
-goodsImgList: []
-goodsNumber: 45
-goodsSimpleDesc: "1234"
-goodsSn: "2314"
-goodsSpecificationList: []
-goodsUnit: null
-guigeArr: "[{\"name\":\"test数据\",\"val\":[{\"name\":\"32\",\"picUrl\":\"https://4dkk.4dage.com/shop/huafa/20210914/11201310556ed1.png\",\"uuid\":\"1-1\"}],\"show\":false,\"picUrl\":\"\",\"specificationId\":50}]"
-id: 77006332
-isAppExclusive: 0
-isDelete: 0
-isHot: 0
-isLimited: 0
-isNew: 1
-isOnSale: 0
-keywords: null
-listPicUrl: "https://4dkk.4dage.com/shop/huafa/20210914/11203269611dc.png?x-oss-process=image/resize,m_fixed,w_400,h_400"
-marketPrice: 1233
-name: "3214"
-primaryPicUrl: "https://4dkk.4dage.com/shop/huafa/20210914/112028835f7db0.png?x-oss-process=image/resize,m_fixed,w_300,h_300"
-primaryProductId: null
-productList: []
-promotionDesc: null
-promotionTag: null
-realShopUrl: null
-retailPrice: 1233
-sellVolume: null
-sortOrder: null
-unitPrice: null
-updateTime: 1631589637000
-updateUserId: 247 
--->
 <template>
   <div>
     <BasicTable

+ 1 - 0
src/views/scenes/bindModal.vue

@@ -146,6 +146,7 @@
         tableSetting: { fullScreen: true },
         showIndexColumn: false,
         immediate: false,
+        isCanResizeParent: true,
         rowKey: 'id',
         pagination: false,
         clickToRowSelect: false,

+ 25 - 10
src/views/scenes/list.vue

@@ -1,11 +1,19 @@
 <template>
   <div class="p-4">
-    <BasicTable @register="registerTable">
-      <template #toolbar> </template>
-      <template #cover="{ record }">
-        <TableImg :size="150" :simpleShow="true" :imgList="[record.cover]" />
+    <BasicTable @register="registerTable" :rowSelection="{ type: 'checkbox' }">
+      <template #toolbar>
+        <a-button type="primary" @click="() => {}"> 新增</a-button>
+        <a-button type="primary" color="warning" @click="() => {}"> 编辑</a-button>
+        <a-button type="primary" color="error" @click="() => {}"> 删除</a-button>
       </template>
 
+      <template #cover="{ record }">
+        <TableImg
+          :size="120"
+          :simpleShow="true"
+          :imgList="[record.appListPicUrl || '/resource/img/pic_bg@2x.png']"
+        />
+      </template>
       <template #action="{ record }">
         <TableAction
           :actions="[
@@ -68,12 +76,12 @@
       const { t } = useI18n();
 
       const columns: BasicColumn[] = [
-        // {
-        //   title: 'ID',
-        //   dataIndex: 'id',
-        //   fixed: 'left',
-        //   width: 80,
-        // },
+        {
+          title: 'ID',
+          dataIndex: 'id',
+          width: 80,
+          defaultHidden: true,
+        },
         {
           title: t('routes.scenes.sceneName'),
           dataIndex: 'sceneName',
@@ -93,6 +101,12 @@
           width: 180,
         },
         {
+          title: t('routes.scenes.appListPicUrl'),
+          dataIndex: 'appListPicUrl',
+          slots: { customRender: 'cover' },
+          width: 150,
+        },
+        {
           title: t('routes.scenes.childName'),
           dataIndex: 'childName',
           width: 120,
@@ -181,6 +195,7 @@
         formConfig: searchForm,
         showTableSetting: true,
         tableSetting: { fullScreen: true },
+        clickToRowSelect: false,
         showIndexColumn: false,
         rowKey: 'id',
         //TODO

+ 26 - 16
src/views/scenes/live.vue

@@ -1,7 +1,11 @@
 <template>
   <div class="p-4">
-    <BasicTable @register="registerTable">
-      <template #toolbar> </template>
+    <BasicTable @register="registerTable" :rowSelection="{ type: 'checkbox' }">
+      <template #toolbar>
+        <a-button type="primary" @click="() => {}"> 新增</a-button>
+        <!-- <a-button type="primary" color="warning" @click="() => {}"> 编辑</a-button> -->
+        <!-- <a-button type="primary" color="error" @click="() => {}"> 删除</a-button> -->
+      </template>
       <template #cover="{ record }">
         <TableImg
           v-if="record.appListPicUrl"
@@ -19,21 +23,26 @@
             {
               icon: 'eos-icons:role-binding',
               label: t('routes.scenes.bindAnchor'),
-              color: 'warning',
+              color: 'success',
               onClick: handleBindAnchor.bind(null, record),
             },
-
-            // {
-            //   icon: 'ant-design:delete-outlined',
-            //   color: 'error',
-            //   label: '删除',
-            //   popConfirm: {
-            //     title: '是否确认删除',
-            //     confirm: () => {
-            //       createMessage.info(`暂未接入`);
-            //     },
-            //   },
-            // },
+            {
+              icon: 'ant-design:delete-outlined',
+              color: 'warning',
+              label: '编辑',
+              onClick: () => {},
+            },
+            {
+              icon: 'ant-design:delete-outlined',
+              color: 'error',
+              label: '删除',
+              popConfirm: {
+                title: '是否确认删除',
+                confirm: () => {
+                  createMessage.info(`暂未接入`);
+                },
+              },
+            },
           ]"
         />
       </template>
@@ -150,7 +159,7 @@
           title: t('common.operation'),
           dataIndex: '',
           slots: { customRender: 'action' },
-          width: 120,
+          width: 230,
           fixed: 'right',
         },
       ];
@@ -243,6 +252,7 @@
         showIndexColumn: false,
         rowKey: 'id',
         pagination: { pageSize: 20 },
+        clickToRowSelect: false,
         fetchSetting: {
           pageField: 'page',
           sizeField: 'limit',