This commit is contained in:
2026-10-08 18:19:39 +08:00
parent 25b8d0104f
commit 75527ae81d
425 changed files with 53925 additions and 2645 deletions
+3
View File
@@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml
File diff suppressed because one or more lines are too long
+17
View File
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="cn.fjdmy.uniapp.UniappProjectDataService">
<option name="basePath" value="$PROJECT_DIR$" />
<option name="dataVersion" value="2" />
<option name="generalBasePath" value="$PROJECT_DIR$" />
<option name="manifestPath" value="$PROJECT_DIR$/manifest.json" />
<option name="manifestStamp" value="0" />
<option name="pagesPath" value="$PROJECT_DIR$/pages.json" />
<option name="scanNum" value="1" />
<option name="type" value="store" />
<option name="uniapp" value="true" />
<option name="uniappHx" value="true" />
<option name="vueVersion" value="2" />
<option name="wxAppId" value="" />
</component>
</project>
+125
View File
@@ -0,0 +1,125 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="HtmlUnknownAttribute" enabled="true" level="WARNING" enabled_by_default="true">
<option name="myValues">
<value>
<list size="2">
<item index="0" class="java.lang.String" itemvalue="class" />
<item index="1" class="java.lang.String" itemvalue="style" />
</list>
</value>
</option>
<option name="myCustomValuesEnabled" value="true" />
</inspection_tool>
<inspection_tool class="HtmlUnknownTag" enabled="true" level="WARNING" enabled_by_default="true">
<option name="myValues">
<value>
<list size="100">
<item index="0" class="java.lang.String" itemvalue="nobr" />
<item index="1" class="java.lang.String" itemvalue="noembed" />
<item index="2" class="java.lang.String" itemvalue="comment" />
<item index="3" class="java.lang.String" itemvalue="noscript" />
<item index="4" class="java.lang.String" itemvalue="embed" />
<item index="5" class="java.lang.String" itemvalue="script" />
<item index="6" class="java.lang.String" itemvalue="el-form" />
<item index="7" class="java.lang.String" itemvalue="el-input" />
<item index="8" class="java.lang.String" itemvalue="el-form-item" />
<item index="9" class="java.lang.String" itemvalue="el-button" />
<item index="10" class="java.lang.String" itemvalue="el-container" />
<item index="11" class="java.lang.String" itemvalue="el-header" />
<item index="12" class="java.lang.String" itemvalue="el-menu" />
<item index="13" class="java.lang.String" itemvalue="el-menu-item" />
<item index="14" class="java.lang.String" itemvalue="el-submenu" />
<item index="15" class="java.lang.String" itemvalue="el-breadcrumb" />
<item index="16" class="java.lang.String" itemvalue="el-breadcrumb-item" />
<item index="17" class="java.lang.String" itemvalue="el-dialog" />
<item index="18" class="java.lang.String" itemvalue="el-row" />
<item index="19" class="java.lang.String" itemvalue="el-col" />
<item index="20" class="java.lang.String" itemvalue="el-table-column" />
<item index="21" class="java.lang.String" itemvalue="el-table" />
<item index="22" class="java.lang.String" itemvalue="el-pagination" />
<item index="23" class="java.lang.String" itemvalue="el-upload" />
<item index="24" class="java.lang.String" itemvalue="el-select" />
<item index="25" class="java.lang.String" itemvalue="el-option" />
<item index="26" class="java.lang.String" itemvalue="el-date-picker" />
<item index="27" class="java.lang.String" itemvalue="el-switch" />
<item index="28" class="java.lang.String" itemvalue="u-swiper" />
<item index="29" class="java.lang.String" itemvalue="u-image" />
<item index="30" class="java.lang.String" itemvalue="u-button" />
<item index="31" class="java.lang.String" itemvalue="web-view" />
<item index="32" class="java.lang.String" itemvalue="u-avatar" />
<item index="33" class="java.lang.String" itemvalue="u-text" />
<item index="34" class="java.lang.String" itemvalue="u-grid" />
<item index="35" class="java.lang.String" itemvalue="u-grid-item" />
<item index="36" class="java.lang.String" itemvalue="u-icon" />
<item index="37" class="java.lang.String" itemvalue="u-cell-group" />
<item index="38" class="java.lang.String" itemvalue="u-cell" />
<item index="39" class="java.lang.String" itemvalue="u-tabs" />
<item index="40" class="java.lang.String" itemvalue="u-gap" />
<item index="41" class="java.lang.String" itemvalue="scroll-view" />
<item index="42" class="java.lang.String" itemvalue="u-toast" />
<item index="43" class="java.lang.String" itemvalue="u-subsection" />
<item index="44" class="java.lang.String" itemvalue="u-empty" />
<item index="45" class="java.lang.String" itemvalue="u-popup" />
<item index="46" class="java.lang.String" itemvalue="uqrcode" />
<item index="47" class="java.lang.String" itemvalue="temlate" />
<item index="48" class="java.lang.String" itemvalue="el-tree" />
<item index="49" class="java.lang.String" itemvalue="el-card" />
<item index="50" class="java.lang.String" itemvalue="el-tag" />
<item index="51" class="java.lang.String" itemvalue="u-modal" />
<item index="52" class="java.lang.String" itemvalue="rich-text" />
<item index="53" class="java.lang.String" itemvalue="u--text" />
<item index="54" class="java.lang.String" itemvalue="u-line-progress" />
<item index="55" class="java.lang.String" itemvalue="u--image" />
<item index="56" class="java.lang.String" itemvalue="page" />
<item index="57" class="java.lang.String" itemvalue="el-aside" />
<item index="58" class="java.lang.String" itemvalue="house" />
<item index="59" class="java.lang.String" itemvalue="el-dropdown" />
<item index="60" class="java.lang.String" itemvalue="arrowdown" />
<item index="61" class="java.lang.String" itemvalue="el-dropdown-menu" />
<item index="62" class="java.lang.String" itemvalue="caretleft" />
<item index="63" class="java.lang.String" itemvalue="close" />
<item index="64" class="java.lang.String" itemvalue="fold" />
<item index="65" class="java.lang.String" itemvalue="expand" />
<item index="66" class="java.lang.String" itemvalue="caretright" />
<item index="67" class="java.lang.String" itemvalue="upload" />
<item index="68" class="java.lang.String" itemvalue="el-cascader" />
<item index="69" class="java.lang.String" itemvalue="u-search" />
<item index="70" class="java.lang.String" itemvalue="u-scroll-list" />
<item index="71" class="java.lang.String" itemvalue="u-navbar" />
<item index="72" class="java.lang.String" itemvalue="u-loadmore" />
<item index="73" class="java.lang.String" itemvalue="u-parse" />
<item index="74" class="java.lang.String" itemvalue="u-number-box" />
<item index="75" class="java.lang.String" itemvalue="u-tag" />
<item index="76" class="java.lang.String" itemvalue="u-checkbox" />
<item index="77" class="java.lang.String" itemvalue="u-checkbox-group" />
<item index="78" class="java.lang.String" itemvalue="checkbox" />
<item index="79" class="java.lang.String" itemvalue="u-action-sheet" />
<item index="80" class="java.lang.String" itemvalue="u-line" />
<item index="81" class="java.lang.String" itemvalue="u-count-to" />
<item index="82" class="java.lang.String" itemvalue="u-swipe-action" />
<item index="83" class="java.lang.String" itemvalue="u-swipe-action-item" />
<item index="84" class="java.lang.String" itemvalue="u-form" />
<item index="85" class="java.lang.String" itemvalue="u-form-item" />
<item index="86" class="java.lang.String" itemvalue="u-input" />
<item index="87" class="java.lang.String" itemvalue="u-switch" />
<item index="88" class="java.lang.String" itemvalue="u-textarea" />
<item index="89" class="java.lang.String" itemvalue="u-picker" />
<item index="90" class="java.lang.String" itemvalue="u-sticky" />
<item index="91" class="java.lang.String" itemvalue="el-popover" />
<item index="92" class="java.lang.String" itemvalue="plus" />
<item index="93" class="java.lang.String" itemvalue="el-input-number" />
<item index="94" class="java.lang.String" itemvalue="el-checkbox" />
<item index="95" class="java.lang.String" itemvalue="el-checkbox-group" />
<item index="96" class="java.lang.String" itemvalue="el-radio-group" />
<item index="97" class="java.lang.String" itemvalue="el-radio-button" />
<item index="98" class="java.lang.String" itemvalue="el-collapse" />
<item index="99" class="java.lang.String" itemvalue="el-collapse-item" />
</list>
</value>
</option>
<option name="myCustomValuesEnabled" value="true" />
</inspection_tool>
</profile>
</component>
+12
View File
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
<excludeFolder url="file://$MODULE_DIR$/temp" />
<excludeFolder url="file://$MODULE_DIR$/tmp" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/jinjiuxin-admin.iml" filepath="$PROJECT_DIR$/.idea/jinjiuxin-admin.iml" />
</modules>
</component>
</project>
Generated
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
+8 -11
View File
@@ -28,19 +28,16 @@ import vkAdminUI from 'vk-unicloud-admin-ui';
import 'vk-unicloud-admin-ui/theme/index.css';
Vue.use(vkAdminUI);
// 自动注册全局组件(必须加在Vue.use(vkAdminUI);的后面)
const modulesFiles = require.context('./components', true, /\.vue$/);
modulesFiles.keys().map((modulePath, index) => {
const moduleNames = modulePath.replace(/^\.\/(.*)\.\w+$/, '$1');
const moduleSplit = moduleNames.split("/");
const moduleName = moduleSplit[0];
if (moduleSplit.length === 2 && moduleName === moduleSplit[1]) {
const value = modulesFiles(modulePath);
let moduleItem = value.default;
Vue.component(moduleName, moduleItem);
}
import VueTianditu from "vue-tianditu";
Vue.use(VueTianditu, {
v: "4.0",
tk: "bfbc6bd9e85fcda67b62788705aa6427"
});
// 自动注册全局组件(必须加在Vue.use(vkAdminUI);的后面)
import VkDataInputEditor from './components/vk-data-input-editor/vk-data-input-editor.vue';
Vue.component('vk-data-input-editor', VkDataInputEditor);
// 引入 自定义全局css 样式
import '@/common/css/app.scss';
+1
View File
@@ -5,6 +5,7 @@
"versionName" : "1.0.0",
"versionCode" : "100",
"transformPx" : false,
"sassImplementationName": "node-sass",
"app-plus" : {
"usingComponents" : true,
"nvueCompiler" : "uni-app",
+2
View File
@@ -22,6 +22,7 @@
"dependencies": {
"async-validator": "^4.2.5",
"babel-helper-vue-jsx-merge-props": "^2.0.3",
"dayjs": "^1.11.11",
"element-ui": "2.15.13",
"normalize-wheel": "^1.0.1",
"resize-observer-polyfill": "^1.5.1",
@@ -31,6 +32,7 @@
"umy-ui": "1.1.6",
"vk-unicloud-admin-ui": "^1.17.45",
"vue": "2",
"vue-tianditu": "1.2.11",
"vuedraggable": "^2.24.3",
"xe-utils": "^3.5.14"
},
+419 -131
View File
@@ -1,133 +1,421 @@
{
"pages": [
{ "path": "pages/index/index" },
{ "path": "pages/product/product-category/list" },
{ "path": "pages/product/goods/list" },
{ "path": "pages/config/site"},
{ "path": "pages/enquiry/template/list"},
{ "path": "pages/enquiry/attributes/list"},
{ "path": "pages/contract/template/list"},
{ "path": "pages/fadada/type_1"},
{ "path": "pages/fadada/type_2"},
{ "path": "pages/article/category"},
{ "path": "pages/article/list"},
{ "path": "pages/goods/category"},
{ "path": "pages/goods/list"},
{ "path": "pages/coop/config"},
{
"path": "pages/login/index",
"style": {
"topWindow": false,
"leftWindow": false,
"navigationBarTitleText": "登录"
}
}
],
"subPackages": [{
"root": "pages_plugs",
"pages": [
{ "path": "error/404", "style": { "navigationBarTitleText": "页面不存在" } },
{ "path": "error/403", "style": { "navigationBarTitleText": "无权访问" } },
{ "path": "error/500", "style": { "navigationBarTitleText": "服务器出错了" } },
{ "path": "system/user/list" },
{ "path": "system/role/list" },
{ "path": "system/permission/list" },
{ "path": "system/menu/list" },
{ "path": "system/app/list" },
{ "path": "system/app-upgrade-center/list" },
{ "path": "system_uni/vk-global-data" },
{ "path": "system_uni/uni-id-log" },
{ "path": "system_uni/opendb-admin-log" },
{ "path": "system_uni/vk-components-dynamic" },
{ "path": "system_uni/uni-id-files/list" },
{ "path": "system_uni/vk-pay-orders" }
]
},
{
"root": "pages_template/components",
"pages": [
{ "path": "icons/vk-icons" },
{ "path": "icons/element-icons" },
{ "path": "icons/vk-icons-page", "style": { "topWindow": false,"leftWindow": false } },
{ "path": "icons/element-icons-page", "style": { "topWindow": false,"leftWindow": false } },
{ "path": "table/table-basic" },
{ "path": "table/table-easy" },
{ "path": "table/table-query" },
{ "path": "table/table-expand" },
{ "path": "form/form-array-object" },
{ "path": "form/form-basic" },
{ "path": "form/form-cert" , "style": { "topWindow": false,"leftWindow": false } },
{ "path": "form/form-pay-cert" , "style": { "topWindow": false,"leftWindow": false } },
{ "path": "form/form-inline" },
{ "path": "form/form-dialog" },
{ "path": "form/form-pro" },
{ "path": "form/form-dialog-2" },
{ "path": "form/form-slot" },
{ "path": "detail/detail-basic" },
{ "path": "detail/detail-table" },
{ "path": "dialog/dialog-basic" },
{ "path": "dialog/dialog-form" },
{ "path": "dialog/dialog-table" },
{ "path": "upload/upload-basic" },
{ "path": "upload/upload-drag" },
{ "path": "input/input-address" },
{ "path": "input/input-money" },
{ "path": "input/input-number" },
{ "path": "input/input-number-box" },
{ "path": "input/input-percentage" },
{ "path": "input/input-json" },
{ "path": "input/input-province" },
{ "path": "input/input-select" },
{ "path": "input/input-remote-select" },
{ "path": "input/input" },
{ "path": "editor/editor" }
]
},
{
"root": "pages_template/element",
"pages": [
{ "path": "detail/detail" },
{ "path": "form/basic-form" },
{ "path": "form/advanced-form" },
{ "path": "form/step-form" },
{ "path": "setting/account" },
{ "path": "popup/alert" },
{ "path": "popup/dialog" },
{ "path": "popup/drawer" },
{ "path": "popup/loading" },
{ "path": "popup/message" },
{ "path": "popup/message-box" },
{ "path": "popup/notification" },
{ "path": "popup/popconfirm" },
{ "path": "popup/popover" },
{ "path": "popup/tooltip" },
{ "path": "result/fail" },
{ "path": "result/success" }
]
}
],
"globalStyle": {
"navigationStyle": "custom",
"navigationBarTextStyle": "black",
"navigationBarTitleText": "管理后台",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8"
},
"topWindow": {
"path": "windows/topWindow",
"style": {
"height": "100px"
},
"matchMedia": {
"minWidth": 0
}
},
"leftWindow": {
"path": "windows/leftWindow",
"style": {
"width": "240px"
}
}
"pages": [
{
"path": "pages/index/index"
},
{
"path": "pages/product/product-category/list"
},
{
"path": "pages/product/goods/list"
},
{
"path": "pages/product/amount/list"
},
{
"path": "pages/config/site"
},
{
"path": "pages/enquiry/template/list"
},
{
"path": "pages/enquiry/attributes/list"
},
{
"path": "pages/process/category/list"
},
{
"path": "pages/contract/template/list"
},
{
"path": "pages/fadada/type_1"
},
{
"path": "pages/fadada/type_2"
},
{
"path": "pages/article/category"
},
{
"path": "pages/article/list"
},
{
"path": "pages/otherArticle/category"
},
{
"path": "pages/otherArticle/list"
},
{
"path": "pages/otherArticle/swiper"
},
{
"path": "pages/otherArticle/ad"
},
{
"path": "pages/goods/category"
},
{
"path": "pages/goods/list"
},
{
"path": "pages/coop/config"
},
{
"path": "pages/userLevel/list"
},
{
"path": "pages/notice/list"
},
{
"path": "pages/contract/list"
},
{
"path": "pages/contract/certificate"
},
{
"path": "pages/order/enquiry"
},
{
"path": "pages/notary-union-pay/list"
},
{
"path": "pages/order/old"
},
{
"path": "pages/order/order"
},
{
"path": "pages/order/process"
},
{
"path": "pages/order/self-product/quote"
},
{
"path": "pages/order/spot"
},
{
"path": "pages/order/refund"
},
{
"path": "pages/order/invoiceOrder"
},
{
"path": "pages/stealFactory/list"
},
{
"path": "pages/dict/list"
},
{
"path": "pages/enquiry/package/list"
},
{
"path": "pages/factory/list"
},
{
"path": "pages/industry/list"
},
{
"path": "pages/oldCate/type_0"
},
{
"path": "pages/oldCate/type_1"
},
{
"path": "pages/oldCate/type_2"
},
{
"path": "pages/oldCate/type_3"
},
{
"path": "pages/order/selfSuport"
},
{
"path": "pages/config/qyb/list"
},
{
"path": "pages/config/quoteNum/list"
},
{
"path": "pages/ensureConfig/list"
},
{
"path": "pages/signOnlyUser/list"
},
{
"path": "pages/finance/balance/list"
},
{
"path": "pages/login/index",
"style": {
"topWindow": false,
"leftWindow": false,
"navigationBarTitleText": "登录"
}
}
],
"subPackages": [
{
"root": "pages_plugs",
"pages": [
{
"path": "error/404",
"style": {
"navigationBarTitleText": "页面不存在"
}
},
{
"path": "error/403",
"style": {
"navigationBarTitleText": "无权访问"
}
},
{
"path": "error/500",
"style": {
"navigationBarTitleText": "服务器出错了"
}
},
{
"path": "system/user/list"
},
{
"path": "system/role/list"
},
{
"path": "system/permission/list"
},
{
"path": "system/menu/list"
},
{
"path": "system/app/list"
},
{
"path": "system/app-upgrade-center/list"
},
{
"path": "system_uni/vk-global-data"
},
{
"path": "system_uni/uni-id-log"
},
{
"path": "system_uni/opendb-admin-log"
},
{
"path": "system_uni/vk-components-dynamic"
},
{
"path": "system_uni/uni-id-files/list"
},
{
"path": "system_uni/vk-pay-orders"
}
]
},
{
"root": "pages_template/components",
"pages": [
{
"path": "icons/vk-icons"
},
{
"path": "icons/element-icons"
},
{
"path": "icons/vk-icons-page",
"style": {
"topWindow": false,
"leftWindow": false
}
},
{
"path": "icons/element-icons-page",
"style": {
"topWindow": false,
"leftWindow": false
}
},
{
"path": "table/table-basic"
},
{
"path": "table/table-easy"
},
{
"path": "table/table-query"
},
{
"path": "table/table-expand"
},
{
"path": "form/form-array-object"
},
{
"path": "form/form-basic"
},
{
"path": "form/form-cert",
"style": {
"topWindow": false,
"leftWindow": false
}
},
{
"path": "form/form-pay-cert",
"style": {
"topWindow": false,
"leftWindow": false
}
},
{
"path": "form/form-inline"
},
{
"path": "form/form-dialog"
},
{
"path": "form/form-pro"
},
{
"path": "form/form-dialog-2"
},
{
"path": "form/form-slot"
},
{
"path": "detail/detail-basic"
},
{
"path": "detail/detail-table"
},
{
"path": "dialog/dialog-basic"
},
{
"path": "dialog/dialog-form"
},
{
"path": "dialog/dialog-table"
},
{
"path": "upload/upload-basic"
},
{
"path": "upload/upload-drag"
},
{
"path": "input/input-address"
},
{
"path": "input/input-money"
},
{
"path": "input/input-number"
},
{
"path": "input/input-number-box"
},
{
"path": "input/input-percentage"
},
{
"path": "input/input-json"
},
{
"path": "input/input-province"
},
{
"path": "input/input-select"
},
{
"path": "input/input-remote-select"
},
{
"path": "input/input"
},
{
"path": "editor/editor"
}
]
},
{
"root": "pages_template/element",
"pages": [
{
"path": "detail/detail"
},
{
"path": "form/basic-form"
},
{
"path": "form/advanced-form"
},
{
"path": "form/step-form"
},
{
"path": "setting/account"
},
{
"path": "popup/alert"
},
{
"path": "popup/dialog"
},
{
"path": "popup/drawer"
},
{
"path": "popup/loading"
},
{
"path": "popup/message"
},
{
"path": "popup/message-box"
},
{
"path": "popup/notification"
},
{
"path": "popup/popconfirm"
},
{
"path": "popup/popover"
},
{
"path": "popup/tooltip"
},
{
"path": "result/fail"
},
{
"path": "result/success"
}
]
}
],
"globalStyle": {
"navigationStyle": "custom",
"navigationBarTextStyle": "black",
"navigationBarTitleText": "管理后台",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8"
},
"topWindow": {
"path": "windows/topWindow",
"style": {
"height": "100px"
},
"matchMedia": {
"minWidth": 0
}
},
"leftWindow": {
"path": "windows/leftWindow",
"style": {
"width": "240px"
}
}
}
+365 -365
View File
@@ -1,50 +1,50 @@
<template>
<view class="page-body">
<!-- 页面内容开始 -->
<view class="page-body">
<!-- 页面内容开始 -->
<!-- 表格搜索组件开始 -->
<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"
@search="search"></vk-data-table-query>
<!-- 表格搜索组件结束 -->
<!-- 表格搜索组件开始 -->
<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"
@search="search"></vk-data-table-query>
<!-- 表格搜索组件结束 -->
<!-- 自定义按钮区域开始 -->
<view>
<el-row>
<el-button type="success" size="small" icon="el-icon-circle-plus-outline" @click="addBtn">添加
</el-button>
<!-- 批量操作 -->
<el-dropdown v-if="table1.multipleSelection" :split-button="false" trigger="click" @command="batchBtn">
<!-- <el-button type="danger" size="small" style="margin-left: 20rpx;"
:disabled="table1.multipleSelection.length === 0">
批量操作<i class="el-icon-arrow-down el-icon--right"></i>
</el-button> -->
<el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item :command="1">批量操作1</el-dropdown-item>
<el-dropdown-item :command="2">批量操作2</el-dropdown-item> -->
</el-dropdown-menu>
</el-dropdown>
</el-row>
</view>
<!-- 自定义按钮区域结束 -->
<!-- 表格组件开始 -->
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
:right-btns="['detail_auto','update','delete']" :default-expand-all="false" @update="updateBtn"
@delete="deleteBtn" @current-change="currentChange"
@selection-change="selectionChange"></vk-data-table>
<!-- 表格组件结束 -->
<!-- 添加或编辑的弹窗开始 -->
<vk-data-dialog v-model="form1.props.show" :title="form1.props.title" width="60%" mode="form"
:close-on-click-modal="false">
<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
:form-type="form1.props.formType" :columns='form1.props.columns' label-width="120px"
@success="form1.props.show = false;refresh();"></vk-data-form>
</vk-data-dialog>
<!-- 添加或编辑的弹窗结束 -->
<!-- 页面内容结束 -->
<!-- 自定义按钮区域开始 -->
<view>
<el-row>
<el-button type="success" size="small" icon="el-icon-circle-plus-outline" @click="addBtn">添加
</el-button>
<!-- 批量操作 -->
<el-dropdown v-if="table1.multipleSelection" :split-button="false" trigger="click" @command="batchBtn">
<!-- <el-button type="danger" size="small" style="margin-left: 20rpx;"
:disabled="table1.multipleSelection.length === 0">
批量操作<i class="el-icon-arrow-down el-icon--right"></i>
</el-button> -->
<el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item :command="1">批量操作1</el-dropdown-item>
<el-dropdown-item :command="2">批量操作2</el-dropdown-item> -->
</el-dropdown-menu>
</el-dropdown>
</el-row>
</view>
<!-- 自定义按钮区域结束 -->
<!-- 表格组件开始 -->
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
:right-btns="['detail_auto','update','delete']" :default-expand-all="false" @update="updateBtn"
@delete="deleteBtn" @current-change="currentChange" :pagination="true"
@selection-change="selectionChange"></vk-data-table>
<!-- 表格组件结束 -->
<!-- 添加或编辑的弹窗开始 -->
<vk-data-dialog v-model="form1.props.show" :title="form1.props.title" width="60%" mode="form"
:close-on-click-modal="false">
<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
:form-type="form1.props.formType" :columns='form1.props.columns' label-width="120px"
@success="form1.props.show = false;refresh();"></vk-data-form>
</vk-data-dialog>
<!-- 添加或编辑的弹窗结束 -->
<!-- 页面内容结束 -->
</view>
</template>
<script>
@@ -53,335 +53,335 @@ var vk = uni.vk; // vk实例
var originalForms = {}; // 表单初始化数据
export default {
data() {
// 页面数据变量
return {
// 页面是否请求中或加载中
loading: false,
// init请求返回的数据
data: {},
// 表格相关开始 -----------------------------------------------------------
table1: {
// 表格数据请求地址
action: "admin/article/list/sys/list",
// 表格字段显示规则
columns: [
// {
// key: "_id",
// title: "id",
// type: "text",
// width: 220
// },
{
key: "name",
title: "名称",
type: "text",
width: 220,
align: "left",
},
{
key: "amount",
title: "金额",
type: "text",
width: 220,
align: "left",
formatter: (val, row, column, index) => {
return val === 0 ? '免费' : `${val}元`
}
},
{
key: "category.name",
title: "分类",
type: "text",
width: 220,
},
{
key: "content",
title: "内容",
type: "html",
},
{
key: "files",
title: "附件",
type: "file",
},
{
key: "remark",
title: "备注",
type: "text",
align: "left",
width: 220
},
{
key: "viewNum",
title: "浏览量",
type: "text",
align: "left",
width: 220
},
{
key: "downloadNum",
title: "下载量",
type: "text",
align: "left",
width: 220
},
{
key: "sort",
title: "排序",
type: "number",
align: "left",
width: 80,
},
{
key: "_add_time",
title: "添加时间",
type: "time",
align: "left",
width: 160,
sortable: "custom"
},
{
key: "_add_time",
title: "距离现在",
type: "dateDiff",
align: "left",
width: 120
},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: ""
data() {
// 页面数据变量
return {
// 页面是否请求中或加载中
loading: false,
// init请求返回的数据
data: {},
// 表格相关开始 -----------------------------------------------------------
table1: {
// 表格数据请求地址
action: "admin/article/list/sys/list",
// 表格字段显示规则
columns: [
// {
// key: "_id",
// title: "id",
// type: "text",
// width: 220
// },
{
key: "name",
title: "名称",
type: "text",
width: 220,
align: "left",
},
// {
// key: "amount",
// title: "金额",
// type: "text",
// width: 220,
// align: "left",
// formatter: (val, row, column, index) => {
// return val === 0 ? '免费' : `${val}元`
// }
// },
{
key: "category.name",
title: "分类",
type: "text",
},
{
key: "content",
title: "内容",
type: "html",
show: ['detail']
},
{
key: "files",
title: "附件",
type: "file",
show: ['detail']
},
{
key: "remark",
title: "备注",
type: "text",
align: "left",
width: 220
},
{
key: "viewNum",
title: "浏览量",
type: "text",
align: "left",
width: 220
},
{
key: "downloadNum",
title: "下载量",
type: "text",
align: "left",
width: 220
},
{
key: "sort",
title: "排序",
type: "number",
align: "left",
width: 80,
},
{
key: "_add_time",
title: "添加时间",
type: "time",
align: "left",
width: 160,
sortable: "custom"
},
{
key: "_add_time_diff",
title: "距离现在",
type: "html",
align: "left",
width: 120,
formatter: (val, row) => vk.pubfn.dateDiff(row._add_time)
},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: ""
},
// 表格相关结束 -----------------------------------------------------------
// 表单相关开始 -----------------------------------------------------------
// 查询表单请求数据
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
// {
// key: "name",
// title: "名称",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "remark",
// title: "备注",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "_add_time",
// title: "添加时间",
// type: "datetimerange",
// width: 400,
// mode: "[]"
// },
]
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
sort: 0,
amount: 0,
},
// 表单属性
props: {
// 表单请求地址
action: "",
// 表单字段显示规则
columns: [
{
key: "name",
title: "名称",
type: "text",
placeholder: "请输入名称"
},
// 表格相关结束 -----------------------------------------------------------
// 表单相关开始 -----------------------------------------------------------
// 查询表单请求数据
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
// {
// key: "name",
// title: "名称",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "remark",
// title: "备注",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "_add_time",
// title: "添加时间",
// type: "datetimerange",
// width: 400,
// mode: "[]"
// },
]
// {
// key: "icon",
// title: "图标",
// type: "icon",
// placeholder: "请选择图标"
// },
{
key: "parentId",
title: "分类",
type: "select",
align: "center",
data: [
{value: "65687919466d41a5844ee57c", label: '执行标准'},
{value: "65687937f082105ea4cdd9eb", label: '实用文档'},
]
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
sort: 0,
amount: 0,
},
// 表单属性
props: {
// 表单请求地址
action: "",
// 表单字段显示规则
columns: [
{
key: "name",
title: "名称",
type: "text",
placeholder: "请输入名称"
},
// {
// key: "icon",
// title: "图标",
// type: "icon",
// placeholder: "请选择图标"
// },
{
key: "parentId",
title: "分类",
type: "tree-select",
placeholder: "请选择分类",
action: "admin/article/category/sys/list",
props: {
list: "rows",
value: "_id",
label: "name",
children: "children"
},
},
{
key: "content",
title: "内容",
type: "editor",
placeholder: "请输入内容"
},
{
key: "amount",
title: "金额",
type: "text",
placeholder: "请输入内容",
},
{
key: "files",
title: "附件",
type: "file",
},
{
key: "remark",
title: "备注",
type: "textarea",
maxlength: "99",
showWordLimit: true,
autosize: {
minRows: 2,
maxRows: 10
},
},
{
key: "sort",
title: "排序",
type: "number",
precision: 0,
placeholder: "请输入排序值",
},
],
// 表单验证规则
rules: {
sort: [{
type: 'number',
message: '排序值必须为数字'
}],
name: [
{required: true, message: '分类名称不能为空', trigger: 'blur'},
],
},
// add 代表添加 update 代表修改
formType: "",
// 是否显示表单的弹窗
show: false
}
{
key: "content",
title: "内容",
type: "editor",
placeholder: "请输入内容"
},
// 其他弹窗表单
formDatas: {},
// 表单相关结束 -----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {
},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {
},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {
},
// 函数
methods: {
// 页面数据初始化函数
init(options) {
originalForms["form1"] = vk.pubfn.copyObject(that.form1);
},
// 页面跳转
pageTo(path) {
vk.navigateTo(path);
},
// 表单重置
resetForm() {
vk.pubfn.resetForm(originalForms, that);
},
// 搜索
search() {
that.$refs.table1.search();
},
// 刷新
refresh() {
that.$refs.table1.refresh();
},
// 获取当前选中的行的数据
getCurrentRow() {
return that.$refs.table1.getCurrentRow();
},
// 监听 - 行的选中高亮事件
currentChange(val) {
that.table1.selectItem = val;
},
// 当选择项发生变化时会触发该事件
selectionChange(list) {
that.table1.multipleSelection = list;
},
// 显示添加页面
addBtn() {
that.resetForm();
that.form1.props.action = 'admin/article/list/sys/add';
that.form1.props.formType = 'add';
that.form1.props.title = '添加';
that.form1.props.show = true;
},
// 显示修改页面
updateBtn({
item
}) {
that.form1.props.action = 'admin/article/list/sys/update';
that.form1.props.formType = 'update';
that.form1.props.title = '编辑';
that.form1.props.show = true;
that.form1.data = item;
},
// 删除按钮
deleteBtn({
item,
deleteFn
}) {
deleteFn({
action: "admin/article/list/sys/delete",
data: {
_id: item._id
},
});
},
// 监听 - 批量操作的按钮点击事件
batchBtn(index) {
switch (index) {
case 1:
vk.toast("批量操作按钮1");
break;
case 2:
vk.toast("批量操作按钮2");
break;
default:
break;
}
// {
// key: "amount",
// title: "金额",
// type: "text",
// placeholder: "请输入内容",
// },
{
key: "files",
title: "附件",
type: "file",
accept: "*",
},
{
key: "remark",
title: "备注",
type: "textarea",
maxlength: "99",
showWordLimit: true,
autosize: {
minRows: 2,
maxRows: 10
},
},
{
key: "sort",
title: "排序",
type: "number",
precision: 0,
placeholder: "请输入排序值",
},
],
// 表单验证规则
rules: {
sort: [{
type: 'number',
message: '排序值必须为数字'
}],
name: [
{required: true, message: '分类名称不能为空', trigger: 'blur'},
],
},
// add 代表添加 update 代表修改
formType: "",
// 是否显示表单的弹窗
show: false
}
},
// 其他弹窗表单
formDatas: {},
// 表单相关结束 -----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {
},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {
},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {
},
// 函数
methods: {
// 页面数据初始化函数
init(options) {
originalForms["form1"] = vk.pubfn.copyObject(that.form1);
},
// 监听属性
watch: {},
// 过滤器
filters: {},
// 计算属性
computed: {}
// 页面跳转
pageTo(path) {
vk.navigateTo(path);
},
// 表单重置
resetForm() {
vk.pubfn.resetForm(originalForms, that);
},
// 搜索
search() {
that.$refs.table1.search();
},
// 刷新
refresh() {
that.$refs.table1.refresh();
},
// 获取当前选中的行的数据
getCurrentRow() {
return that.$refs.table1.getCurrentRow();
},
// 监听 - 行的选中高亮事件
currentChange(val) {
that.table1.selectItem = val;
},
// 当选择项发生变化时会触发该事件
selectionChange(list) {
that.table1.multipleSelection = list;
},
// 显示添加页面
addBtn() {
that.resetForm();
that.form1.props.action = 'admin/article/list/sys/add';
that.form1.props.formType = 'add';
that.form1.props.title = '添加';
that.form1.props.show = true;
},
// 显示修改页面
updateBtn({
item
}) {
that.form1.props.action = 'admin/article/list/sys/update';
that.form1.props.formType = 'update';
that.form1.props.title = '编辑';
that.form1.props.show = true;
that.form1.data = item;
},
// 删除按钮
deleteBtn({
item,
deleteFn
}) {
deleteFn({
action: "admin/article/list/sys/delete",
data: {
_id: item._id
},
});
},
// 监听 - 批量操作的按钮点击事件
batchBtn(index) {
switch (index) {
case 1:
vk.toast("批量操作按钮1");
break;
case 2:
vk.toast("批量操作按钮2");
break;
default:
break;
}
}
},
// 监听属性
watch: {},
// 过滤器
filters: {},
// 计算属性
computed: {}
};
</script>
<style lang="scss" scoped>
.page-body {
}
</style>
</style>
+308
View File
@@ -0,0 +1,308 @@
<template>
<view class="page-body">
<!-- 页面内容开始 -->
<!-- 表格搜索组件开始 -->
<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"
@search="search"></vk-data-table-query>
<!-- 表格搜索组件结束 -->
<!-- 自定义按钮区域开始 -->
<view>
<el-row>
<el-button type="success" size="small" icon="el-icon-circle-plus-outline" @click="addBtn">添加
</el-button>
<!-- 批量操作 -->
<el-dropdown v-if="table1.multipleSelection" :split-button="false" trigger="click" @command="batchBtn">
<!-- <el-button type="danger" size="small" style="margin-left: 20rpx;"
:disabled="table1.multipleSelection.length === 0">
批量操作<i class="el-icon-arrow-down el-icon--right"></i>
</el-button> -->
<el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item :command="1">批量操作1</el-dropdown-item>
<el-dropdown-item :command="2">批量操作2</el-dropdown-item> -->
</el-dropdown-menu>
</el-dropdown>
</el-row>
</view>
<!-- 自定义按钮区域结束 -->
<!-- 表格组件开始 -->
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
:right-btns="['detail_auto','update','delete']" :default-expand-all="false" @update="updateBtn"
@delete="deleteBtn" @current-change="currentChange" :pagination="true"
@selection-change="selectionChange"></vk-data-table>
<!-- 表格组件结束 -->
<!-- 添加或编辑的弹窗开始 -->
<vk-data-dialog v-model="form1.props.show" :title="form1.props.title" width="60%" mode="form"
:close-on-click-modal="false">
<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
:form-type="form1.props.formType" :columns='form1.props.columns' label-width="120px"
@success="form1.props.show = false;refresh();"></vk-data-form>
</vk-data-dialog>
<!-- 添加或编辑的弹窗结束 -->
<!-- 页面内容结束 -->
</view>
</template>
<script>
var that; // 当前页面对象
var vk = uni.vk; // vk实例
var originalForms = {}; // 表单初始化数据
export default {
data() {
// 页面数据变量
return {
// 页面是否请求中或加载中
loading: false,
// init请求返回的数据
data: {},
// 表格相关开始 -----------------------------------------------------------
table1: {
// 表格数据请求地址
action: "admin/quoteNumConfig/list/sys/list",
// 表格字段显示规则
columns: [
{
key: "name",
title: "名称",
type: "text",
width: 220,
align: "left",
},
{
key: "amount",
title: "价格",
type: "number",
},
{
key: "day",
title: "获得时长(天)",
type: "number",
},
{
key: "sort",
title: "排序",
type: "number",
},
{
key: "_add_time",
title: "添加时间",
type: "time",
align: "left",
width: 160,
sortable: "custom"
},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: ""
},
// 表格相关结束 -----------------------------------------------------------
// 表单相关开始 -----------------------------------------------------------
// 查询表单请求数据
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
// {
// key: "name",
// title: "名称",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "remark",
// title: "备注",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "_add_time",
// title: "添加时间",
// type: "datetimerange",
// width: 400,
// mode: "[]"
// },
]
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
sort: 0,
amount: 0,
},
// 表单属性
props: {
// 表单请求地址
action: "",
// 表单字段显示规则
columns: [
{
key: "name",
title: "名称",
type: "text",
placeholder: "请输入名称"
},
{
key: "amount",
title: "价格",
type: "number",
placeholder: "请输入价格"
},
{
key: "day",
title: "获得时长(天)",
type: "number",
placeholder: "请输入获得时长(天)"
},
{
key: "sort",
title: "排序",
type: "number",
precision: 0,
placeholder: "请输入排序值",
},
],
// 表单验证规则
rules: {
sort: [{
type: 'number',
message: '排序值必须为数字'
}],
name: [
{required: true, message: '名称不能为空', trigger: 'blur'},
],
amount: [
{required: true, message: '价格不能为空', trigger: 'blur'},
],
day: [
{required: true, message: '获得时长不能为空', trigger: 'blur'},
],
},
// add 代表添加 update 代表修改
formType: "",
// 是否显示表单的弹窗
show: false
}
},
// 其他弹窗表单
formDatas: {},
// 表单相关结束 -----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {
},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {
},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {
},
// 函数
methods: {
// 页面数据初始化函数
init(options) {
originalForms["form1"] = vk.pubfn.copyObject(that.form1);
},
// 页面跳转
pageTo(path) {
vk.navigateTo(path);
},
// 表单重置
resetForm() {
vk.pubfn.resetForm(originalForms, that);
},
// 搜索
search() {
that.$refs.table1.search();
},
// 刷新
refresh() {
that.$refs.table1.refresh();
},
// 获取当前选中的行的数据
getCurrentRow() {
return that.$refs.table1.getCurrentRow();
},
// 监听 - 行的选中高亮事件
currentChange(val) {
that.table1.selectItem = val;
},
// 当选择项发生变化时会触发该事件
selectionChange(list) {
that.table1.multipleSelection = list;
},
// 显示添加页面
addBtn() {
that.resetForm();
that.form1.props.action = 'admin/quoteNumConfig/list/sys/add';
that.form1.props.formType = 'add';
that.form1.props.title = '添加';
that.form1.props.show = true;
},
// 显示修改页面
updateBtn({
item
}) {
that.form1.props.action = 'admin/quoteNumConfig/list/sys/update';
that.form1.props.formType = 'update';
that.form1.props.title = '编辑';
that.form1.props.show = true;
that.form1.data = item;
},
// 删除按钮
deleteBtn({
item,
deleteFn
}) {
deleteFn({
action: "admin/quoteNumConfig/list/sys/delete",
data: {
_id: item._id
},
});
},
// 监听 - 批量操作的按钮点击事件
batchBtn(index) {
switch (index) {
case 1:
vk.toast("批量操作按钮1");
break;
case 2:
vk.toast("批量操作按钮2");
break;
default:
break;
}
}
},
// 监听属性
watch: {},
// 过滤器
filters: {},
// 计算属性
computed: {}
};
</script>
<style lang="scss" scoped>
.page-body {
}
</style>
+308
View File
@@ -0,0 +1,308 @@
<template>
<view class="page-body">
<!-- 页面内容开始 -->
<!-- 表格搜索组件开始 -->
<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"
@search="search"></vk-data-table-query>
<!-- 表格搜索组件结束 -->
<!-- 自定义按钮区域开始 -->
<view>
<el-row>
<el-button type="success" size="small" icon="el-icon-circle-plus-outline" @click="addBtn">添加
</el-button>
<!-- 批量操作 -->
<el-dropdown v-if="table1.multipleSelection" :split-button="false" trigger="click" @command="batchBtn">
<!-- <el-button type="danger" size="small" style="margin-left: 20rpx;"
:disabled="table1.multipleSelection.length === 0">
批量操作<i class="el-icon-arrow-down el-icon--right"></i>
</el-button> -->
<el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item :command="1">批量操作1</el-dropdown-item>
<el-dropdown-item :command="2">批量操作2</el-dropdown-item> -->
</el-dropdown-menu>
</el-dropdown>
</el-row>
</view>
<!-- 自定义按钮区域结束 -->
<!-- 表格组件开始 -->
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
:right-btns="['detail_auto','update','delete']" :default-expand-all="false" @update="updateBtn"
@delete="deleteBtn" @current-change="currentChange" :pagination="true"
@selection-change="selectionChange"></vk-data-table>
<!-- 表格组件结束 -->
<!-- 添加或编辑的弹窗开始 -->
<vk-data-dialog v-model="form1.props.show" :title="form1.props.title" width="60%" mode="form"
:close-on-click-modal="false">
<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
:form-type="form1.props.formType" :columns='form1.props.columns' label-width="120px"
@success="form1.props.show = false;refresh();"></vk-data-form>
</vk-data-dialog>
<!-- 添加或编辑的弹窗结束 -->
<!-- 页面内容结束 -->
</view>
</template>
<script>
var that; // 当前页面对象
var vk = uni.vk; // vk实例
var originalForms = {}; // 表单初始化数据
export default {
data() {
// 页面数据变量
return {
// 页面是否请求中或加载中
loading: false,
// init请求返回的数据
data: {},
// 表格相关开始 -----------------------------------------------------------
table1: {
// 表格数据请求地址
action: "admin/qyb/list/sys/list",
// 表格字段显示规则
columns: [
{
key: "name",
title: "名称",
type: "text",
width: 220,
align: "left",
},
{
key: "amount",
title: "价格",
type: "number",
},
{
key: "getNum",
title: "获得次数",
type: "number",
},
{
key: "sort",
title: "排序",
type: "number",
},
{
key: "_add_time",
title: "添加时间",
type: "time",
align: "left",
width: 160,
sortable: "custom"
},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: ""
},
// 表格相关结束 -----------------------------------------------------------
// 表单相关开始 -----------------------------------------------------------
// 查询表单请求数据
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
// {
// key: "name",
// title: "名称",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "remark",
// title: "备注",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "_add_time",
// title: "添加时间",
// type: "datetimerange",
// width: 400,
// mode: "[]"
// },
]
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
sort: 0,
amount: 0,
},
// 表单属性
props: {
// 表单请求地址
action: "",
// 表单字段显示规则
columns: [
{
key: "name",
title: "名称",
type: "text",
placeholder: "请输入名称"
},
{
key: "amount",
title: "价格",
type: "number",
placeholder: "请输入价格"
},
{
key: "getNum",
title: "获得次数",
type: "number",
placeholder: "请输入获得次数"
},
{
key: "sort",
title: "排序",
type: "number",
precision: 0,
placeholder: "请输入排序值",
},
],
// 表单验证规则
rules: {
sort: [{
type: 'number',
message: '排序值必须为数字'
}],
name: [
{required: true, message: '名称不能为空', trigger: 'blur'},
],
amount: [
{required: true, message: '价格不能为空', trigger: 'blur'},
],
getNum: [
{required: true, message: '获得次数不能为空', trigger: 'blur'},
],
},
// add 代表添加 update 代表修改
formType: "",
// 是否显示表单的弹窗
show: false
}
},
// 其他弹窗表单
formDatas: {},
// 表单相关结束 -----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {
},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {
},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {
},
// 函数
methods: {
// 页面数据初始化函数
init(options) {
originalForms["form1"] = vk.pubfn.copyObject(that.form1);
},
// 页面跳转
pageTo(path) {
vk.navigateTo(path);
},
// 表单重置
resetForm() {
vk.pubfn.resetForm(originalForms, that);
},
// 搜索
search() {
that.$refs.table1.search();
},
// 刷新
refresh() {
that.$refs.table1.refresh();
},
// 获取当前选中的行的数据
getCurrentRow() {
return that.$refs.table1.getCurrentRow();
},
// 监听 - 行的选中高亮事件
currentChange(val) {
that.table1.selectItem = val;
},
// 当选择项发生变化时会触发该事件
selectionChange(list) {
that.table1.multipleSelection = list;
},
// 显示添加页面
addBtn() {
that.resetForm();
that.form1.props.action = 'admin/qyb/list/sys/add';
that.form1.props.formType = 'add';
that.form1.props.title = '添加';
that.form1.props.show = true;
},
// 显示修改页面
updateBtn({
item
}) {
that.form1.props.action = 'admin/qyb/list/sys/update';
that.form1.props.formType = 'update';
that.form1.props.title = '编辑';
that.form1.props.show = true;
that.form1.data = item;
},
// 删除按钮
deleteBtn({
item,
deleteFn
}) {
deleteFn({
action: "admin/qyb/list/sys/delete",
data: {
_id: item._id
},
});
},
// 监听 - 批量操作的按钮点击事件
batchBtn(index) {
switch (index) {
case 1:
vk.toast("批量操作按钮1");
break;
case 2:
vk.toast("批量操作按钮2");
break;
default:
break;
}
}
},
// 监听属性
watch: {},
// 过滤器
filters: {},
// 计算属性
computed: {}
};
</script>
<style lang="scss" scoped>
.page-body {
}
</style>
+41 -8
View File
@@ -99,14 +99,47 @@
limit: 1,
placeholder: "请上传收手机站上二维码"
},
{
key: "companyGzhImage",
title: "公众号二维码",
type: "image",
limit: 1,
placeholder: "请上传公众号二维码"
},
],
{
key: "companyGzhImage",
title: "公众号二维码",
type: "image",
limit: 1,
placeholder: "请上传公众号二维码"
},
{
title: "注册页背景图",
type: "bar-title",
placeholder: ""
},
{
key: "registerPcBgImage",
title: "PC端注册页背景图",
type: "image",
limit: 1,
placeholder: "请上传PC端注册页背景图"
},
{
key: "registerH5BgImage",
title: "H5端注册页背景图",
type: "image",
limit: 1,
placeholder: "请上传H5端注册页背景图"
},
{
key: "registerSignPcBgImage",
title: "签约宝PC端注册页背景图",
type: "image",
limit: 1,
placeholder: "请上传签约宝PC端注册页背景图"
},
{
key: "registerSignH5BgImage",
title: "签约宝H5端注册页背景图",
type: "image",
limit: 1,
placeholder: "请上传签约宝H5端注册页背景图"
},
],
// 表单验证规则
rules: {
sort: [{
+552
View File
@@ -0,0 +1,552 @@
<template>
<view class="page-body">
<!-- 页面内容开始 -->
<!-- 表格搜索组件开始 -->
<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"
@search="search"></vk-data-table-query>
<!-- 表格搜索组件结束 -->
<!-- 自定义按钮区域开始 -->
<view>
<el-row>
<!-- 批量操作 -->
<el-dropdown v-if="table1.multipleSelection" :split-button="false" trigger="click" @command="batchBtn">
<!-- <el-button type="danger" size="small" style="margin-left: 20rpx;"
:disabled="table1.multipleSelection.length === 0">
批量操作<i class="el-icon-arrow-down el-icon--right"></i>
</el-button> -->
<!-- <el-dropdown-menu slot="dropdown">-->
<!-- &lt;!&ndash; <el-dropdown-item :command="1">批量操作1</el-dropdown-item>-->
<!-- <el-dropdown-item :command="2">批量操作2</el-dropdown-item> &ndash;&gt;-->
<!-- </el-dropdown-menu>-->
</el-dropdown>
</el-row>
</view>
<!-- 自定义按钮区域结束 -->
<!-- 表格组件开始 -->
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
:default-expand-all="false"
:pagination="true"
@current-change="currentChange">
<template v-slot:paymentMethod="{ row, column, index }">
<div v-if="row.paymentMethod === 'online'">在线支付</div>
<div v-else>
<span style="margin-right: 10px">公对公支付</span>
</div>
</template>
<template v-slot:action="{ row, column, index }">
<!-- <el-button size="mini" @click.native="doShowInfo(row)">详情</el-button>-->
<el-button v-if="row.paymentMethod !== 'online'" size="mini" @click.native="openPayVoucher(row)">查看支付凭证
</el-button>
<el-button v-if="row.paymentMethod !== 'online' && !row.paidConfirm" size="mini" type="primary"
@click.native="changeField(row._id, 'paidConfirm', true)">确认支付
</el-button>
</template>
</vk-data-table>
<!-- 表格组件结束 -->
<!-- 添加或编辑的弹窗开始 -->
<vk-data-dialog v-model="form1.props.show" :title="form1.props.title" width="60%" mode="form"
:close-on-click-modal="false">
<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
:form-type="form1.props.formType" :columns='form1.props.columns' label-width="120px"
@success="form1.props.show = false;refresh();">
</vk-data-form>
</vk-data-dialog>
<!-- 添加或编辑的弹窗结束 -->
<vk-data-dialog
v-model="showInfo"
:title="title"
width="60%"
top="14vh"
center
:close-on-click-modal="true"
>
<el-descriptions v-if="info" :column="2" border>
<el-descriptions-item label="合同编号">
<span>{{ info.transactionId }}</span>
</el-descriptions-item>
<el-descriptions-item label="合同类型">
{{
typeList.find(item => item.value === info.type).label
}}
</el-descriptions-item>
<el-descriptions-item label="合同名称">
<span>{{ info.docTitle }}</span>
</el-descriptions-item>
<el-descriptions-item label="合同金额">
<span>{{ info.amount }}</span>
</el-descriptions-item>
<el-descriptions-item label="发起时间">
<span>{{ info._add_time_str }}</span>
</el-descriptions-item>
<el-descriptions-item label="甲方信息">
<div v-for="(item, index) in info.userContract" :key="index">
<template v-if="item.role === 'buyer'">
<div>{{ item.user.accountType === 2 ? item.user.company.companyName : item.user.person.personName }}</div>
<div v-if="item.user.businessCard && info.user.businessCard.area">{{
item.user.businessCard.province.name
}}{{ item.user.businessCard.city.name }}{{ item.user.businessCard.area.name }}
</div>
<div>联系方式:{{
item.user.accountType === 2 ? item.user.businessCard.companyMobile : item.user.person.mobile
}}
</div>
<div>签署情况:{{ item.sign ? '已签' : '未签' }}</div>
</template>
</div>
</el-descriptions-item>
<el-descriptions-item label="乙方信息">
<div v-for="(item, index) in info.userContract" :key="index">
<template v-if="item.role === 'seller'">
<div>{{ item.user.accountType === 2 ? item.user.company.companyName : item.user.person.personName }}</div>
<div v-if="item.user.businessCard && info.user.businessCard.area">{{
item.user.businessCard.province.name
}}{{ item.user.businessCard.city.name }}{{ item.user.businessCard.area.name }}
</div>
<div>联系方式:{{
item.user.accountType === 2 ? item.user.businessCard.companyMobile : item.user.person.mobile
}}
</div>
<div>签署情况:{{ item.sign ? '已签' : '未签' }}</div>
</template>
</div>
</el-descriptions-item>
<el-descriptions-item label="第三方信息">
<div v-for="(item, index) in info.userContract" :key="index">
<template v-if="item.role === 'third'">
<div>{{ item.user.accountType === 2 ? item.user.company.companyName : item.user.person.personName }}</div>
<div v-if="item.user.businessCard && info.user.businessCard.area">{{
item.user.businessCard.province.name
}}{{ item.user.businessCard.city.name }}{{ item.user.businessCard.area.name }}
</div>
<div>联系方式:{{
item.user.accountType === 2 ? item.user.businessCard.companyMobile : item.user.person.mobile
}}
</div>
<div>签署情况:{{ item.sign ? '已签' : '未签' }}</div>
</template>
</div>
</el-descriptions-item>
<el-descriptions-item label="合同原始文件" v-if="info.contractBase">
<a target="_blank" :href="info.contractBase">点击查看</a>
</el-descriptions-item>
<el-descriptions-item label="合同签署文件" v-if="info.status > 0">
<a href="#" @click="viewContract(info._id)">点击查看</a>
</el-descriptions-item>
<el-descriptions-item label="附件">
<a target="_blank" :href="item" v-for="(item, index) in info.otherFile" :key="index">附件:{{ index + 1 }}</a>
</el-descriptions-item>
</el-descriptions>
<!-- <vk-data-detail-table-->
<!-- :data="info"-->
<!-- :columns="infoColumns"-->
<!-- size="medium"-->
<!-- label-width="150px"-->
<!-- >-->
<!-- <template v-slot:contractSign="{ row, column, index }">-->
<!-- <el-button size="mini" @click.native="viewContract(row._id)">查看</el-button>-->
<!-- </template>-->
<!-- &lt;!&ndash; <template v-slot:otherFile="{ row, column, index }">&ndash;&gt;-->
<!-- &lt;!&ndash; <el-button size="mini" @click.native="doShowInfo(row)">下载</el-button>&ndash;&gt;-->
<!-- &lt;!&ndash; </template>&ndash;&gt;-->
<!-- </vk-data-detail-table>-->
<template v-slot:footer>
<el-button @click="showInfo = false">关闭</el-button>
</template>
</vk-data-dialog>
<!-- 页面内容结束 -->
</view>
</template>
<script>
var that; // 当前页面对象
var vk = uni.vk; // vk实例
var originalForms = {}; // 表单初始化数据
export default {
data() {
// 页面数据变量
return {
showInfo: false,
info: null,
title: '',
typeList: [
{value: "enquiry", label: '询价'},
{value: "process", label: '加工'},
{value: "old", label: '旧货'},
{value: "sign", label: '金久信签约宝'},
{value: "self-support", label: '自营询价'}
],
infoColumns: [
{key: "transactionId", title: "合同编号", type: "text"},
{
key: "type", title: "合同类型", type: "select",
data: [
{value: "enquiry", label: '询价'},
{value: "process", label: '加工'},
{value: "old", label: '旧货'},
{value: "sign", label: '金久信签约宝'},
{value: "self-support", label: '自营询价'},
]
},
{key: "docTitle", title: "合同名称", type: "text"},
{key: "amount", title: "合同金额", type: "text"},
{key: "_add_time_str", title: "发起时间", type: "text"},
{key: "contract.contractBase", title: "合同原始文件", type: "html"},
{key: "contract.contractSign", title: "合同签署文件", type: "html"},
{key: "otherFile", title: "附件", type: "html"},
],
// 页面是否请求中或加载中
loading: false,
// init请求返回的数据
data: {},
// 表格相关开始 -----------------------------------------------------------
table1: {
// 表格数据请求地址
action: "admin/contractCert/sys/getList",
// 表格字段显示规则
columns: [
{
key: "contractId",
title: "合同编号",
type: "text",
align: "left",
},
{
key: "contract", title: "合同类型", type: "object", columns: [
{
key: 'type',
type: "select",
data: [
{value: "enquiry", label: '询价'},
{value: "process", label: '加工'},
{value: "old", label: '旧货'},
{value: "sign", label: '金久信签约宝'},
{value: "self-support", label: '自营询价'},
]
}
]
},
{
key: "contract", title: "合同名称", type: 'object', columns: [
{
key: "docTitle",
type: "text",
align: "left",
}
]
},
{
key: "contract", title: "合同金额", type: 'object', columns: [
{
key: "amount",
type: "text",
align: "left",
},
]
},
{
key: "contract", title: "签署情况", type: 'object', columns: [
{
key: "status",
title: "",
type: "tag",
data: [
{value: 0, label: '待创建', tagType: 'error'},
{value: 1, label: '待签署'},
{value: 2, label: '已签署', tagType: 'success'},
]
},
]
},
{
key: "paymentMethod",
title: "支付方式",
type: "html",
data: [
{value: 'online', label: '在线支付'},
{value: 'advance', label: '公对公支付'},
]
},
{
key: "status",
title: "支付状态",
type: "tag",
data: [
{value: 0, label: '未支付'},
{value: 1, label: '已支付', tagType: 'success'},
]
},
{
key: "_add_time",
title: "提交时间",
type: "time",
align: "left",
sortable: "custom"
},
{key: "action", title: "操作", type: "html", width: 260,},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: ""
},
// 表格相关结束 -----------------------------------------------------------
// 表单相关开始 -----------------------------------------------------------
// 查询表单请求数据
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
{
key: "transactionId",
title: "合同编号",
type: "text",
width: 160,
mode: "%%"
},
{
key: "type",
title: "合同类型",
type: "select",
data: [
{value: "enquiry", label: '询价'},
{value: "process", label: '加工'},
{value: "old", label: '旧货'},
{value: "sign", label: '金久信签约宝'},
{value: "self-support", label: '自营询价'},
]
},
{
key: "status",
title: "合同状态",
type: "select",
data: [
{value: 0, label: '待创建'},
{value: 1, label: '待签署'},
{value: 2, label: '已签署'},
]
},
]
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
sort: 0
},
// 表单属性
props: {
// 表单请求地址
action: "",
// 表单字段显示规则
columns: [{
key: "name",
title: "名称",
type: "text",
placeholder: "请输入分类名称"
},
{
key: "icon",
title: "图标",
type: "icon",
placeholder: "请选择图标"
},
{
key: "parent_id",
title: "上级分类",
type: "tree-select",
placeholder: "请选择上级分类",
action: "admin/spot/category/sys/getTree",
props: {
list: "rows",
value: "_id",
label: "name",
children: "children"
},
},
{
key: "remark",
title: "备注",
type: "textarea",
maxlength: "99",
showWordLimit: true,
autosize: {
minRows: 2,
maxRows: 10
},
},
{
key: "sort",
title: "排序",
type: "number",
precision: 0,
placeholder: "请输入排序值",
},
],
// 表单验证规则
rules: {
sort: [{
type: 'number',
message: '排序值必须为数字'
}],
name: [
{required: true, message: '分类名称不能为空', trigger: 'blur'},
],
},
// add 代表添加 update 代表修改
formType: "",
// 是否显示表单的弹窗
show: false
}
},
// 其他弹窗表单
formDatas: {},
// 表单相关结束 -----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {
},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {
},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {
},
// 函数
methods: {
// 页面数据初始化函数
init(options) {
originalForms["form1"] = vk.pubfn.copyObject(that.form1);
},
// 页面跳转
pageTo(path) {
vk.navigateTo(path);
},
// 表单重置
resetForm() {
vk.pubfn.resetForm(originalForms, that);
},
// 搜索
search() {
that.$refs.table1.search();
},
// 刷新
refresh() {
that.$refs.table1.refresh();
},
// 获取当前选中的行的数据
getCurrentRow() {
return that.$refs.table1.getCurrentRow();
},
// 监听 - 行的选中高亮事件
currentChange(val) {
that.table1.selectItem = val;
},
// 当选择项发生变化时会触发该事件
selectionChange(list) {
that.table1.multipleSelection = list;
},
// 显示添加页面
addBtn() {
that.resetForm();
that.form1.props.action = 'admin/contract/template/sys/add';
that.form1.props.formType = 'add';
that.form1.props.title = '添加';
that.form1.props.show = true;
},
// 显示修改页面
updateBtn({
item
}) {
that.form1.props.action = 'admin/contract/template/sys/update';
that.form1.props.formType = 'update';
that.form1.props.title = '编辑';
that.form1.props.show = true;
that.form1.data = item;
},
// 删除按钮
deleteBtn({
item,
deleteFn
}) {
deleteFn({
action: "admin/contract/template/sys/delete",
data: {
_id: item._id
},
});
},
// 监听 - 批量操作的按钮点击事件
batchBtn(index) {
switch (index) {
case 1:
vk.toast("批量操作按钮1");
break;
case 2:
vk.toast("批量操作按钮2");
break;
default:
break;
}
},
doShowInfo(info) {
this.info = info
this.title = '详情'
this.showInfo = true
},
viewContract(contractId) {
vk.callFunction({
url: 'client/contract/kh/viewContract',
title: '请求中...',
data: {
contractId
},
success: (res) => {
window.open(res.data)
this.query(1)
}
});
},
openPayVoucher(item) {
window.open(item.payVoucher)
},
changeField(id, field, value){
vk.callFunction({
url: 'admin/contractCert/sys/changeField',
title: '请求中...',
data: {
id, field, value
},
success: (res) => {
this.$refs.table1.refresh()
}
});
}
},
// 监听属性
watch: {},
// 过滤器
filters: {},
// 计算属性
computed: {}
};
</script>
<style lang="scss" scoped>
.page-body {
}
</style>
+530
View File
@@ -0,0 +1,530 @@
<template>
<view class="page-body">
<!-- 页面内容开始 -->
<!-- 表格搜索组件开始 -->
<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"
@search="search"></vk-data-table-query>
<!-- 表格搜索组件结束 -->
<!-- 自定义按钮区域开始 -->
<view>
<el-row>
<!-- 批量操作 -->
<el-dropdown v-if="table1.multipleSelection" :split-button="false" trigger="click" @command="batchBtn">
<!-- <el-button type="danger" size="small" style="margin-left: 20rpx;"
:disabled="table1.multipleSelection.length === 0">
批量操作<i class="el-icon-arrow-down el-icon--right"></i>
</el-button> -->
<!-- <el-dropdown-menu slot="dropdown">-->
<!-- &lt;!&ndash; <el-dropdown-item :command="1">批量操作1</el-dropdown-item>-->
<!-- <el-dropdown-item :command="2">批量操作2</el-dropdown-item> &ndash;&gt;-->
<!-- </el-dropdown-menu>-->
</el-dropdown>
</el-row>
</view>
<!-- 自定义按钮区域结束 -->
<!-- 表格组件开始 -->
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
:default-expand-all="false"
:pagination="true"
@current-change="currentChange">
<template v-slot:action="{ row, column, index }">
<el-button size="mini" @click.native="doShowInfo(row)">详情</el-button>
</template>
</vk-data-table>
<!-- 表格组件结束 -->
<!-- 添加或编辑的弹窗开始 -->
<vk-data-dialog v-model="form1.props.show" :title="form1.props.title" width="60%" mode="form"
:close-on-click-modal="false">
<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
:form-type="form1.props.formType" :columns='form1.props.columns' label-width="120px"
@success="form1.props.show = false;refresh();">
</vk-data-form>
</vk-data-dialog>
<!-- 添加或编辑的弹窗结束 -->
<vk-data-dialog
v-model="showInfo"
:title="title"
width="60%"
top="14vh"
center
:close-on-click-modal="true"
>
<el-descriptions v-if="info" :column="2" border>
<el-descriptions-item label="合同编号" >
<span>{{ info.transactionId }}</span>
</el-descriptions-item>
<el-descriptions-item label="合同类型" >
{{
typeList.find(item => item.value === info.type).label
}}
</el-descriptions-item>
<el-descriptions-item label="合同名称" >
<span>{{ info.docTitle }}</span>
</el-descriptions-item>
<el-descriptions-item label="合同金额" >
<span>{{ info.amount }}</span>
</el-descriptions-item>
<el-descriptions-item label="发起时间" >
<span>{{ info._add_time_str }}</span>
</el-descriptions-item>
<el-descriptions-item label="发起方信息" >
<div v-for="(item, index) in info.userContract" :key="index">
<template v-if="item.role !== 'third' && item.userId === info.userId && item.user">
<div >{{ item.user.accountType === 2 ? item.user.company.companyName : item.user.person.personName }}</div>
<div v-if="item.user.businessCard && info.user.businessCard.area">{{ item.user.businessCard.province.name }}{{ item.user.businessCard.city.name }}{{ item.user.businessCard.area.name }}</div>
<div>联系方式:{{ (item.user.accountType && item.user.businessCard) === 2 ? item.user.businessCard.companyMobile : item.user.mobile }}</div>
<div>签署情况:{{ item.sign ? '已签' : '未签' }}</div>
</template>
</div>
</el-descriptions-item>
<el-descriptions-item label="接收方信息" >
<div v-for="(item, index) in info.userContract" :key="index">
<template v-if="item.role !== 'third' && item.userId !== info.userId && item.user">
<div >{{ item.user.accountType === 2 ? item.user.company.companyName : item.user.person.personName }}</div>
<div v-if="item.user.businessCard && info.user.businessCard.area">{{ item.user.businessCard.province.name }}{{ item.user.businessCard.city.name }}{{ item.user.businessCard.area.name }}</div>
<div>联系方式:{{ (item.user.accountType && item.user.businessCard) ? item.user.businessCard.companyMobile : item.user.mobile }}</div>
<div>签署情况:{{ item.sign ? '已签' : '未签' }}</div>
</template>
</div>
</el-descriptions-item>
<el-descriptions-item label="第三方信息">
<div v-for="(item, index) in info.userContract" :key="index">
<template v-if="item.role === 'third' && item.user">
<div >{{ item.user.accountType === 2 ? item.user.company.companyName : item.user.person.personName }}</div>
<div v-if="item.user.businessCard && info.user.businessCard.area">{{ item.user.businessCard.province.name }}{{ item.user.businessCard.city.name }}{{ item.user.businessCard.area.name }}</div>
<div>联系方式:{{ (item.user.accountType && item.user.businessCard) ? item.user.businessCard.companyMobile : item.user.mobile }}</div>
<div>签署情况:{{ item.sign ? '已签' : '未签' }}</div>
</template>
</div>
</el-descriptions-item>
<el-descriptions-item label="合同原始文件" v-if="info.contractBase">
<a target="_blank" :href="info.contractBase">点击查看</a>
</el-descriptions-item>
<el-descriptions-item label="合同签署文件" v-if="info.status > 0">
<a href="#" @click="viewContract(info._id)">点击查看</a>
</el-descriptions-item>
<el-descriptions-item label="附件" >
<a target="_blank" :href="item" v-for="(item, index) in info.otherFile" :key="index">附件:{{ index + 1 }}</a>
</el-descriptions-item>
</el-descriptions>
<!-- <vk-data-detail-table-->
<!-- :data="info"-->
<!-- :columns="infoColumns"-->
<!-- size="medium"-->
<!-- label-width="150px"-->
<!-- >-->
<!-- <template v-slot:contractSign="{ row, column, index }">-->
<!-- <el-button size="mini" @click.native="viewContract(row._id)">查看</el-button>-->
<!-- </template>-->
<!-- &lt;!&ndash; <template v-slot:otherFile="{ row, column, index }">&ndash;&gt;-->
<!-- &lt;!&ndash; <el-button size="mini" @click.native="doShowInfo(row)">下载</el-button>&ndash;&gt;-->
<!-- &lt;!&ndash; </template>&ndash;&gt;-->
<!-- </vk-data-detail-table>-->
<template v-slot:footer>
<el-button @click="showInfo = false">关闭</el-button>
</template>
</vk-data-dialog>
<!-- 页面内容结束 -->
</view>
</template>
<script>
var that; // 当前页面对象
var vk = uni.vk; // vk实例
var originalForms = {}; // 表单初始化数据
export default {
data() {
// 页面数据变量
return {
showInfo: false,
info: null,
title: '',
typeList: [
{value: "enquiry", label: '询价'},
{value: "process", label: '加工'},
{value: "old", label: '旧货'},
{value: "sign", label: '金久信签约宝'},
{value: "self-support", label: '自营询价'}
],
infoColumns: [
{key: "transactionId", title: "合同编号", type: "text"},
{
key: "type", title: "合同类型", type: "select",
data: [
{value: "enquiry", label: '询价'},
{value: "process", label: '加工'},
{value: "old", label: '旧货'},
{value: "sign", label: '金久信签约宝'},
{value: "self-support", label: '自营询价'},
]
},
{key: "docTitle", title: "合同名称", type: "text"},
{key: "amount", title: "合同金额", type: "text"},
{key: "_add_time_str", title: "发起时间", type: "text"},
{
key: "userContract", title: "甲方信息", type: "html", formatter: (val, row, column, index) => {
const info = val.find(item => item.role === 'buyer');
let str = `<div>${info.user.accountType === 2 ? info.user.company.companyName : info.user.person.personName}</div>`
if (info.user) {
if (info.user.businessCard.area) {
str += `<div >${info.user.businessCard.province.name}${info.user.businessCard.city.name}${info.user.businessCard.area.name}</div>`
}
str += `<div>联系方式:${(info.user.accountType && info.user.businessCard) === 2 ? info.user.businessCard.companyMobile : info.user.mobile}</div>`
}
str += `<div>签署情况:${info.sign ? '已签' : '未签'}</div>`
return str
}
},
{
key: "userContract", title: "乙方信息", type: "html", formatter: (val, row, column, index) => {
const info = val.find(item => item.role === 'seller');
let str = `<div>${info.user.accountType === 2 ? info.user.company.companyName : info.user.person.personName}</div>`
if (info.user) {
if (info.user.businessCard.area) {
str += `<div>${info.user.businessCard.province.name}${info.user.businessCard.city.name}${info.user.businessCard.area.name}</div>`
}
str += `<div>联系方式:${(info.user.accountType && info.user.businessCard) === 2 ? info.user.businessCard.companyMobile : info.user.mobile}</div>`
}
str += `<div>签署情况:${info.sign ? '已签' : '未签'}</div>`
return str
}
},
{
key: "userContract", title: "第三方信息", type: "html", formatter: (val, row, column, index) => {
const list = val.filter(item => item.role === 'third');
let str = ''
list.forEach((info, index) => {
str += `<div>第三方${index + 1}:</div>`
str += `<div>${info.user.accountType === 2 ? info.user.company.companyName : info.user.person.personName}</div>`
if (info.user && info.user.businessCard) {
if (info.user.businessCard.area) {
str += `<div>${info.user.businessCard.province.name}${info.user.businessCard.city.name}${info.user.businessCard.area.name}</div>`
}
str += `<div>联系方式:${(info.user.accountType && info.user.businessCard) ? info.user.businessCard.companyMobile : info.user.mobile}</div>`
}
str += `<div>签署情况:${info.sign ? '已签' : '未签'}</div>`
})
return str
}
},
//
{key: "contractBase", title: "合同原始文件", type: "html"},
{key: "contractSign", title: "合同签署文件", type: "html"},
{key: "otherFile", title: "附件", type: "html"},
],
// 页面是否请求中或加载中
loading: false,
// init请求返回的数据
data: {},
// 表格相关开始 -----------------------------------------------------------
table1: {
// 表格数据请求地址
action: "admin/contract/sys/getList",
// 表格字段显示规则
columns: [
{
key: "transactionId",
title: "合同编号",
type: "text",
align: "left",
},
{
key: "type", title: "合同类型", type: "select",
data: [
{value: "enquiry", label: '询价'},
{value: "process", label: '加工'},
{value: "old", label: '旧货'},
{value: "sign", label: '金久信签约宝'},
{value: "self-support", label: '自营询价'},
]
},
{
key: "docTitle",
title: "合同名称",
type: "text",
align: "left",
},
{
key: "amount",
title: "合同金额",
type: "text",
align: "left",
},
{
key: "status",
title: "签署情况",
type: "tag",
data: [
{value: 0, label: '待创建', tagType: 'error'},
{value: 1, label: '待签署'},
{value: 2, label: '已签署', tagType: 'success'},
]
},
{
key: "_add_time",
title: "添加时间",
type: "time",
align: "left",
width: 160,
sortable: "custom"
},
{
key: "_add_time_diff",
title: "距离现在",
type: "html",
align: "left",
width: 120,
formatter: (val, row) => vk.pubfn.dateDiff(row._add_time)
},
{key: "action", title: "操作", type: "html"},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: ""
},
// 表格相关结束 -----------------------------------------------------------
// 表单相关开始 -----------------------------------------------------------
// 查询表单请求数据
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
{
key: "transactionId",
title: "合同编号",
type: "text",
width: 160,
mode: "%%"
},
{
key: "type",
title: "合同类型",
type: "select",
data: [
{value: "enquiry", label: '询价'},
{value: "process", label: '加工'},
{value: "old", label: '旧货'},
{value: "sign", label: '金久信签约宝'},
{value: "self-support", label: '自营询价'},
]
},
{
key: "status",
title: "合同状态",
type: "select",
data: [
{value: 0, label: '待创建'},
{value: 1, label: '待签署'},
{value: 2, label: '已签署'},
]
},
]
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
sort: 0
},
// 表单属性
props: {
// 表单请求地址
action: "",
// 表单字段显示规则
columns: [{
key: "name",
title: "名称",
type: "text",
placeholder: "请输入分类名称"
},
{
key: "icon",
title: "图标",
type: "icon",
placeholder: "请选择图标"
},
{
key: "parent_id",
title: "上级分类",
type: "tree-select",
placeholder: "请选择上级分类",
action: "admin/spot/category/sys/getTree",
props: {
list: "rows",
value: "_id",
label: "name",
children: "children"
},
},
{
key: "remark",
title: "备注",
type: "textarea",
maxlength: "99",
showWordLimit: true,
autosize: {
minRows: 2,
maxRows: 10
},
},
{
key: "sort",
title: "排序",
type: "number",
precision: 0,
placeholder: "请输入排序值",
},
],
// 表单验证规则
rules: {
sort: [{
type: 'number',
message: '排序值必须为数字'
}],
name: [
{required: true, message: '分类名称不能为空', trigger: 'blur'},
],
},
// add 代表添加 update 代表修改
formType: "",
// 是否显示表单的弹窗
show: false
}
},
// 其他弹窗表单
formDatas: {},
// 表单相关结束 -----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {
},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {
},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {
},
// 函数
methods: {
// 页面数据初始化函数
init(options) {
originalForms["form1"] = vk.pubfn.copyObject(that.form1);
},
// 页面跳转
pageTo(path) {
vk.navigateTo(path);
},
// 表单重置
resetForm() {
vk.pubfn.resetForm(originalForms, that);
},
// 搜索
search() {
that.$refs.table1.search();
},
// 刷新
refresh() {
that.$refs.table1.refresh();
},
// 获取当前选中的行的数据
getCurrentRow() {
return that.$refs.table1.getCurrentRow();
},
// 监听 - 行的选中高亮事件
currentChange(val) {
that.table1.selectItem = val;
},
// 当选择项发生变化时会触发该事件
selectionChange(list) {
that.table1.multipleSelection = list;
},
// 显示添加页面
addBtn() {
that.resetForm();
that.form1.props.action = 'admin/contract/template/sys/add';
that.form1.props.formType = 'add';
that.form1.props.title = '添加';
that.form1.props.show = true;
},
// 显示修改页面
updateBtn({
item
}) {
that.form1.props.action = 'admin/contract/template/sys/update';
that.form1.props.formType = 'update';
that.form1.props.title = '编辑';
that.form1.props.show = true;
that.form1.data = item;
},
// 删除按钮
deleteBtn({
item,
deleteFn
}) {
deleteFn({
action: "admin/contract/template/sys/delete",
data: {
_id: item._id
},
});
},
// 监听 - 批量操作的按钮点击事件
batchBtn(index) {
switch (index) {
case 1:
vk.toast("批量操作按钮1");
break;
case 2:
vk.toast("批量操作按钮2");
break;
default:
break;
}
},
doShowInfo(info) {
this.info = info
this.title = '详情'
this.showInfo = true
},
viewContract(contractId) {
vk.callFunction({
url: 'client/contract/kh/viewContract',
title: '请求中...',
data: {
contractId
},
success: (res) => {
window.open(res.data)
this.query(1)
}
});
},
},
// 监听属性
watch: {},
// 过滤器
filters: {},
// 计算属性
computed: {}
};
</script>
<style lang="scss" scoped>
.page-body {
}
</style>
+310 -325
View File
@@ -1,338 +1,323 @@
<template>
<view class="page-body">
<!-- 页面内容开始 -->
<view class="page-body">
<!-- 页面内容开始 -->
<!-- 表格搜索组件开始 -->
<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"
@search="search"></vk-data-table-query>
<!-- 表格搜索组件结束 -->
<!-- 表格搜索组件开始 -->
<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"
@search="search"></vk-data-table-query>
<!-- 表格搜索组件结束 -->
<!-- 自定义按钮区域开始 -->
<view>
<el-row>
<el-button type="success" size="small" icon="el-icon-circle-plus-outline" @click="addBtn">添加</el-button>
<!-- 批量操作 -->
<el-dropdown v-if="table1.multipleSelection" :split-button="false" trigger="click" @command="batchBtn">
<!-- <el-button type="danger" size="small" style="margin-left: 20rpx;"
:disabled="table1.multipleSelection.length === 0">
批量操作<i class="el-icon-arrow-down el-icon--right"></i>
</el-button> -->
<el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item :command="1">批量操作1</el-dropdown-item>
<el-dropdown-item :command="2">批量操作2</el-dropdown-item> -->
</el-dropdown-menu>
</el-dropdown>
</el-row>
</view>
<!-- 自定义按钮区域结束 -->
<!-- 自定义按钮区域开始 -->
<view>
<el-row>
<el-button type="success" size="small" icon="el-icon-circle-plus-outline" @click="addBtn">添加
</el-button>
<!-- 批量操作 -->
<el-dropdown v-if="table1.multipleSelection" :split-button="false" trigger="click" @command="batchBtn">
<!-- <el-button type="danger" size="small" style="margin-left: 20rpx;"
:disabled="table1.multipleSelection.length === 0">
批量操作<i class="el-icon-arrow-down el-icon--right"></i>
</el-button> -->
<el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item :command="1">批量操作1</el-dropdown-item>
<el-dropdown-item :command="2">批量操作2</el-dropdown-item> -->
</el-dropdown-menu>
</el-dropdown>
</el-row>
</view>
<!-- 自定义按钮区域结束 -->
<!-- 表格组件开始 -->
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
:right-btns="['detail_auto','update','delete']" :default-expand-all="false" @update="updateBtn"
@delete="deleteBtn" @current-change="currentChange" @selection-change="selectionChange"></vk-data-table>
<!-- 表格组件结束 -->
<!-- 表格组件开始 -->
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
:page-size="200"
:right-btns="['detail_auto','update','delete']" :default-expand-all="false" @update="updateBtn"
@delete="deleteBtn" @current-change="currentChange" @selection-change="selectionChange">
<template v-slot:isOn="{ row, column, index }">
<el-switch v-model="row.isOn" size="mini" @change="changeField(row._id, 'isOn', $event)"
:active-value="true"
:inactive-value="false"/>
</template>
</vk-data-table>
<!-- 表格组件结束 -->
<!-- 添加或编辑的弹窗开始 -->
<vk-data-dialog v-model="form1.props.show" :title="form1.props.title" width="60%" mode="form"
:close-on-click-modal="false">
<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
:form-type="form1.props.formType" :columns='form1.props.columns' label-width="120px"
@success="form1.props.show = false;refresh();"></vk-data-form>
</vk-data-dialog>
<!-- 添加或编辑的弹窗结束 -->
<!-- 添加或编辑的弹窗开始 -->
<vk-data-dialog v-model="form1.props.show" :title="form1.props.title" width="60%" mode="form"
:close-on-click-modal="false">
<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
:form-type="form1.props.formType" :columns='form1.props.columns' label-width="120px"
@success="form1.props.show = false;refresh();"></vk-data-form>
</vk-data-dialog>
<!-- 添加或编辑的弹窗结束 -->
<!-- 页面内容结束 -->
</view>
<!-- 页面内容结束 -->
</view>
</template>
<script>
var that; // 当前页面对象
var vk = uni.vk; // vk实例
var originalForms = {}; // 表单初始化数据
var that; // 当前页面对象
var vk = uni.vk; // vk实例
var originalForms = {}; // 表单初始化数据
export default {
data() {
// 页面数据变量
return {
// 页面是否请求中或加载中
loading: false,
// init请求返回的数据
data: {
},
// 表格相关开始 -----------------------------------------------------------
table1: {
// 表格数据请求地址
action: "admin/contract/template/sys/getList",
// 表格字段显示规则
columns: [
// {
// key: "_id",
// title: "id",
// type: "text",
// width: 220
// },
{
key: "name",
title: "名称",
type: "text",
width: 220,
align: "left",
},
// {
// key: "parent_id",
// title: "上级id",
// type: "text",
// width: 220,
// },
{
key: "remark",
title: "备注",
type: "text",
align: "left",
width: 220
},
{
key: "sort",
title: "排序",
type: "number",
align: "left",
width: 80,
},
{
key: "_add_time",
title: "添加时间",
type: "time",
align: "left",
width: 160,
sortable: "custom"
},
{
key: "_add_time",
title: "距离现在",
type: "dateDiff",
align: "left",
width: 120
},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: ""
},
// 表格相关结束 -----------------------------------------------------------
// 表单相关开始 -----------------------------------------------------------
// 查询表单请求数据
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {
},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
// {
// key: "name",
// title: "名称",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "remark",
// title: "备注",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "_add_time",
// title: "添加时间",
// type: "datetimerange",
// width: 400,
// mode: "[]"
// },
]
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
sort: 0
},
// 表单属性
props: {
// 表单请求地址
action: "",
// 表单字段显示规则
columns: [{
key: "name",
title: "名称",
type: "text",
placeholder: "请输入分类名称"
},
{
key: "icon",
title: "图标",
type: "icon",
placeholder: "请选择图标"
},
{
key: "parent_id",
title: "上级分类",
type: "tree-select",
placeholder: "请选择上级分类",
action: "admin/spot/category/sys/getTree",
props: {
list: "rows",
value: "_id",
label: "name",
children: "children"
},
},
{
key: "remark",
title: "备注",
type: "textarea",
maxlength: "99",
showWordLimit: true,
autosize: {
minRows: 2,
maxRows: 10
},
},
{
key: "sort",
title: "排序",
type: "number",
precision: 0,
placeholder: "请输入排序值",
},
],
// 表单验证规则
rules: {
sort: [{
type: 'number',
message: '排序值必须为数字'
}],
name:[
{ required:true, message:'分类名称不能为空', trigger:'blur' },
],
},
// add 代表添加 update 代表修改
formType: "",
// 是否显示表单的弹窗
show: false
}
},
// 其他弹窗表单
formDatas: {},
// 表单相关结束 -----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {},
// 函数
methods: {
// 页面数据初始化函数
init(options) {
originalForms["form1"] = vk.pubfn.copyObject(that.form1);
},
// 页面跳转
pageTo(path) {
vk.navigateTo(path);
},
// 表单重置
resetForm() {
vk.pubfn.resetForm(originalForms, that);
},
// 搜索
search() {
that.$refs.table1.search();
},
// 刷新
refresh() {
that.$refs.table1.refresh();
},
// 获取当前选中的行的数据
getCurrentRow() {
return that.$refs.table1.getCurrentRow();
},
// 监听 - 行的选中高亮事件
currentChange(val) {
that.table1.selectItem = val;
},
// 当选择项发生变化时会触发该事件
selectionChange(list) {
that.table1.multipleSelection = list;
},
// 显示添加页面
addBtn() {
that.resetForm();
that.form1.props.action = 'admin/contract/template/sys/add';
that.form1.props.formType = 'add';
that.form1.props.title = '添加';
that.form1.props.show = true;
},
// 显示修改页面
updateBtn({
item
}) {
that.form1.props.action = 'admin/contract/template/sys/update';
that.form1.props.formType = 'update';
that.form1.props.title = '编辑';
that.form1.props.show = true;
that.form1.data = item;
},
// 删除按钮
deleteBtn({
item,
deleteFn
}) {
deleteFn({
action: "admin/contract/template/sys/delete",
data: {
_id: item._id
},
});
},
// 监听 - 批量操作的按钮点击事件
batchBtn(index) {
switch (index) {
case 1:
vk.toast("批量操作按钮1");
break;
case 2:
vk.toast("批量操作按钮2");
break;
default:
break;
}
}
},
// 监听属性
watch: {
},
// 过滤器
filters: {
},
// 计算属性
computed: {
}
};
export default {
data() {
// 页面数据变量
return {
// 页面是否请求中或加载中
loading: false,
// init请求返回的数据
data: {
},
// 表格相关开始 -----------------------------------------------------------
table1: {
// 表格数据请求地址
action: "admin/contract/template/sys/getList",
// 表格字段显示规则
columns: [
// {
// key: "_id",
// title: "id",
// type: "text",
// width: 220
// },
{
key: "name",
title: "名称",
type: "text",
width: 220,
align: "left",
},
{
key: "field",
title: "变量",
type: "text",
align: "left",
width: 220
},
{
key: "isOn",
title: "是否启用",
type: "switch",
},
{
key: "_add_time",
title: "添加时间",
type: "time",
align: "left",
width: 160,
sortable: "custom"
},
{
key: "_add_time",
title: "距离现在",
type: "dateDiff",
align: "left",
width: 120
},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: ""
},
// 表格相关结束 -----------------------------------------------------------
// 表单相关开始 -----------------------------------------------------------
// 查询表单请求数据
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
// {
// key: "name",
// title: "名称",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "remark",
// title: "备注",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "_add_time",
// title: "添加时间",
// type: "datetimerange",
// width: 400,
// mode: "[]"
// },
]
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
sort: 0,
isOn: true
},
// 表单属性
props: {
// 表单请求地址
action: "",
// 表单字段显示规则
columns: [
{
key: "name",
title: "名称",
type: "text",
placeholder: "请输入名称"
},
{
key: "field",
title: "变量",
type: "text",
align: "left",
width: 220
},
{
key: "isOn",
title: "是否启用",
type: "switch",
},
],
// 表单验证规则
rules: {
sort: [{
type: 'number',
message: '排序值必须为数字'
}],
name: [
{required: true, message: '名称不能为空', trigger: 'blur'},
],
field: [
{required: true, message: '变量不能为空', trigger: 'blur'},
],
},
// add 代表添加 update 代表修改
formType: "",
// 是否显示表单的弹窗
show: false
}
},
// 其他弹窗表单
formDatas: {},
// 表单相关结束 -----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {
},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {
},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {
},
// 函数
methods: {
// 页面数据初始化函数
init(options) {
originalForms["form1"] = vk.pubfn.copyObject(that.form1);
},
// 页面跳转
pageTo(path) {
vk.navigateTo(path);
},
// 表单重置
resetForm() {
vk.pubfn.resetForm(originalForms, that);
},
// 搜索
search() {
that.$refs.table1.search();
},
// 刷新
refresh() {
that.$refs.table1.refresh();
},
// 获取当前选中的行的数据
getCurrentRow() {
return that.$refs.table1.getCurrentRow();
},
// 监听 - 行的选中高亮事件
currentChange(val) {
that.table1.selectItem = val;
},
// 当选择项发生变化时会触发该事件
selectionChange(list) {
that.table1.multipleSelection = list;
},
// 显示添加页面
addBtn() {
that.resetForm();
that.form1.props.action = 'admin/contract/template/sys/add';
that.form1.props.formType = 'add';
that.form1.props.title = '添加';
that.form1.props.show = true;
},
// 显示修改页面
updateBtn({
item
}) {
that.form1.props.action = 'admin/contract/template/sys/update';
that.form1.props.formType = 'update';
that.form1.props.title = '编辑';
that.form1.props.show = true;
that.form1.data = item;
},
// 删除按钮
deleteBtn({
item,
deleteFn
}) {
deleteFn({
action: "admin/contract/template/sys/delete",
data: {
_id: item._id
},
});
},
// 监听 - 批量操作的按钮点击事件
batchBtn(index) {
switch (index) {
case 1:
vk.toast("批量操作按钮1");
break;
case 2:
vk.toast("批量操作按钮2");
break;
default:
break;
}
},
changeField(id, field, value) {
vk.callFunction({
url: 'admin/contract/template/sys/changeField',
data: {
id, field, value
}
}).then(() => {
this.$refs.table1.refresh()
})
},
},
// 监听属性
watch: {},
// 过滤器
filters: {},
// 计算属性
computed: {}
};
</script>
<style lang="scss" scoped>
.page-body {}
.page-body {
}
</style>
+85 -6
View File
@@ -80,7 +80,9 @@ export default {
width: 220,
align: "left",
formatter: (val, row, column, index) => {
return `<div>${row.type === 0 ? '供应商实力考察' : '产品检测'}</div>`;
if (row.type === 0) return `<div>信誉实力考察</div>`;
else if (row.type === 1) return `<div>产品检测</div>`;
else if (row.type === 2) return `<div>造价询价</div>`;
}
},
{
@@ -174,12 +176,16 @@ export default {
data: [
{
value: 0,
label: "供应商实力考察"
label: "信誉实力考察"
},
{
value: 1,
label: "产品检测"
}
},
{
value: 2,
label: "造价询价"
},
]
},
{
@@ -201,7 +207,7 @@ export default {
placeholder: "请输入排序值",
},
{
key: "contents", title: "项目内容", type: "array<object>", itemWidth: 260,
key: "contents", title: "项目内容", type: "array<object>",
showAdd: true,
showClear: true,
// 新增一行时,该行的默认值
@@ -218,7 +224,47 @@ export default {
]
},
{
key: "amount", title: "价格", type: "text", placeholder: "输入价格",
key: "code", title: "业务编号", type: "text", placeholder: "输入业务编号",
rules: [
{required: true, message: "该项不能为空", trigger: ["change", "blur"]},
]
},
{
key: "amountList", title: "收费标准", type: "array<object>", width: 750,
columns: [
{
key: "title", title: "名称", type: "text",
rules: [
{required: true, message: "该项不能为空", trigger: ["change", "blur"]},
]
},
{
key: "amount", title: "价格", type: "number",
rules: [
{required: true, message: "该项不能为空", trigger: ["change", "blur"]},
]
}
]
},
],
showRule: formData => {
console.log(formData)
return formData.type !== 2
}
},
{
key: "contents", title: "项目内容", type: "array<object>",
showAdd: true,
showClear: true,
// 新增一行时,该行的默认值
defaultValue: {
label: ""
},
rightBtns: ['copy', 'delete'],
// 每行每个字段对应的渲染规则
columns: [
{
key: "title", title: "项目名称", type: "text", placeholder: "输入项目名称",
rules: [
{required: true, message: "该项不能为空", trigger: ["change", "blur"]},
]
@@ -229,8 +275,41 @@ export default {
{required: true, message: "该项不能为空", trigger: ["change", "blur"]},
]
},
{
key: "amountList", title: "收费标准", type: "array<object>", width: 750,
columns: [
{
key: "title", title: "名称", type: "text",
rules: [
{required: true, message: "该项不能为空", trigger: ["change", "blur"]},
]
},
{
key: "amount", title: "项基础收费", type: "number",
rules: [
{required: true, message: "该项不能为空", trigger: ["change", "blur"]},
]
},
{
key: "defaultNum", title: "默认清单单品项数", type: "number",
rules: [
{required: true, message: "该项不能为空", trigger: ["change", "blur"]},
]
},
{
key: "addAmount", title: "相数加价", type: "number",
rules: [
{required: true, message: "该项不能为空", trigger: ["change", "blur"]},
]
},
]
]
},
],
showRule: formData => {
console.log(formData)
return formData.type === 2
}
},
],
// 表单验证规则
+361
View File
@@ -0,0 +1,361 @@
<template>
<view class="page-body">
<!-- 页面内容开始 -->
<!-- 表格搜索组件开始 -->
<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"
@search="search"></vk-data-table-query>
<!-- 表格搜索组件结束 -->
<!-- 自定义按钮区域开始 -->
<view>
<el-row>
<el-button type="success" size="small" icon="el-icon-circle-plus-outline" @click="addBtn">添加
</el-button>
<!-- 批量操作 -->
<el-dropdown v-if="table1.multipleSelection" :split-button="false" trigger="click" @command="batchBtn">
<!-- <el-button type="danger" size="small" style="margin-left: 20rpx;"
:disabled="table1.multipleSelection.length === 0">
批量操作<i class="el-icon-arrow-down el-icon--right"></i>
</el-button> -->
<el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item :command="1">批量操作1</el-dropdown-item>
<el-dropdown-item :command="2">批量操作2</el-dropdown-item> -->
</el-dropdown-menu>
</el-dropdown>
</el-row>
</view>
<!-- 自定义按钮区域结束 -->
<!-- 表格组件开始 -->
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
:right-btns="['detail_auto','update']" :default-expand-all="false" @update="updateBtn"
:pagination="true"
@current-change="currentChange" @selection-change="selectionChange">
<template v-slot:isOn="{ row, column, index }">
<el-switch v-model="row.isOn" size="mini" @change="changeField(row._id, 'isOn', $event)"
:active-value="true"
:inactive-value="false"/>
</template>
</vk-data-table>
<!-- 表格组件结束 -->
<!-- 添加或编辑的弹窗开始 -->
<vk-data-dialog v-model="form1.props.show" :title="form1.props.title" width="60%" mode="form"
:close-on-click-modal="false">
<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
:form-type="form1.props.formType" :columns='form1.props.columns' label-width="120px"
@success="form1.props.show = false;refresh();"></vk-data-form>
</vk-data-dialog>
<!-- 添加或编辑的弹窗结束 -->
<!-- 页面内容结束 -->
</view>
</template>
<script>
var that; // 当前页面对象
var vk = uni.vk; // vk实例
var originalForms = {}; // 表单初始化数据
export default {
data() {
// 页面数据变量
return {
// 页面是否请求中或加载中
loading: false,
// init请求返回的数据
data: {},
// 表格相关开始 -----------------------------------------------------------
table1: {
// 表格数据请求地址
action: "admin/dict/sys/list",
// 表格字段显示规则
columns: [
{
key: "_id",
title: "id",
type: "text",
width: 220
},
{
key: "name",
title: "名称",
type: "text",
width: 220,
align: "left",
},
{
key: "content",
title: "内容",
type: "html",
align: "left",
formatter: (val, row, column, index) => {
if (row.type === 'text' || row.type === 'number') return `<p>${val}</p>`
else if (row.type === 'file') return `<a href="${val}" target="_blank">${val}</a>`
else if (row.type === 'rich-text') return `<div>${val}</div>`
},
show: ['detail']
},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: ""
},
// 表格相关结束 -----------------------------------------------------------
// 表单相关开始 -----------------------------------------------------------
// 查询表单请求数据
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
// {
// key: "name",
// title: "名称",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "remark",
// title: "备注",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "_add_time",
// title: "添加时间",
// type: "datetimerange",
// width: 400,
// mode: "[]"
// },
]
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
sort: 0
},
// 表单属性
props: {
// 表单请求地址
action: "",
// 表单字段显示规则
columns: [
{
key: "name",
title: "名称",
type: "text",
placeholder: "请输入名称"
},
{
key: "type",
title: "类型",
type: "select",
data: [
{
value: 'text',
label: "文字"
},
{
value: 'number',
label: "数字"
},
{
value: 'file',
label: "文件"
},
{
value: 'rich-text',
label: "富文本"
},
{
value: 'tag',
label: "列表"
},
]
},
{
key: "content",
title: "内容",
type: "text",
align: "left",
showRule: formData => {
return formData.type === 'text'
}
},
{
key: "content",
title: "内容",
type: "number",
align: "left",
showRule: formData => {
return formData.type === 'number'
}
},
{
key: "content",
title: "内容",
type: "file",
limit: 1,
align: "left",
accept: "*",
showRule: formData => {
return formData.type === 'file'
}
},
{
key: "content",
title: "内容",
type: "editor",
align: "left",
showRule: formData => {
return formData.type === 'rich-text'
}
},
{
key: "content",
title: "内容",
type: "tag",
align: "left",
showRule: formData => {
return formData.type === 'tag'
}
},
],
// 表单验证规则
rules: {
name: [
{required: true, message: '名称不能为空', trigger: 'blur'},
],
},
// add 代表添加 update 代表修改
formType: "",
// 是否显示表单的弹窗
show: false
}
},
// 其他弹窗表单
formDatas: {},
// 表单相关结束 -----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {
},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {
},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {
},
// 函数
methods: {
// 页面数据初始化函数
init(options) {
originalForms["form1"] = vk.pubfn.copyObject(that.form1);
},
// 页面跳转
pageTo(path) {
vk.navigateTo(path);
},
// 表单重置
resetForm() {
vk.pubfn.resetForm(originalForms, that);
},
// 搜索
search() {
that.$refs.table1.search();
},
// 刷新
refresh() {
that.$refs.table1.refresh();
},
// 获取当前选中的行的数据
getCurrentRow() {
return that.$refs.table1.getCurrentRow();
},
// 监听 - 行的选中高亮事件
currentChange(val) {
that.table1.selectItem = val;
},
// 当选择项发生变化时会触发该事件
selectionChange(list) {
that.table1.multipleSelection = list;
},
// 显示添加页面
addBtn() {
that.resetForm();
that.form1.props.action = 'admin/dict/sys/add';
that.form1.props.formType = 'add';
that.form1.props.title = '添加';
that.form1.props.show = true;
},
// 显示修改页面
updateBtn({
item
}) {
that.form1.props.action = 'admin/dict/sys/update';
that.form1.props.formType = 'update';
that.form1.props.title = '编辑';
that.form1.props.show = true;
that.form1.data = item;
},
// 删除按钮
deleteBtn({
item,
deleteFn
}) {
deleteFn({
action: "admin/dict/sys/delete",
data: {
_id: item._id
},
});
},
// 监听 - 批量操作的按钮点击事件
batchBtn(index) {
switch (index) {
case 1:
vk.toast("批量操作按钮1");
break;
case 2:
vk.toast("批量操作按钮2");
break;
default:
break;
}
},
changeField(id, field, value) {
vk.callFunction({
url: 'admin/dict/sys/changeField',
data: {
id, field, value
}
}).then(() => {
this.$refs.table1.refresh()
})
},
},
// 监听属性
watch: {},
// 过滤器
filters: {},
// 计算属性
computed: {}
};
</script>
<style lang="scss" scoped>
.page-body {
}
</style>
+308
View File
@@ -0,0 +1,308 @@
<template>
<view class="page-body">
<!-- 页面内容开始 -->
<!-- 表格搜索组件开始 -->
<!-- <vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"-->
<!-- @search="search"></vk-data-table-query>-->
<!-- 表格搜索组件结束 -->
<!-- 自定义按钮区域开始 -->
<view>
<el-row>
<el-button type="success" size="small" icon="el-icon-circle-plus-outline" @click="addBtn">添加</el-button>
<!-- 批量操作 -->
<el-dropdown v-if="table1.multipleSelection" :split-button="false" trigger="click" @command="batchBtn">
<!-- <el-button type="danger" size="small" style="margin-left: 20rpx;"
:disabled="table1.multipleSelection.length === 0">
批量操作<i class="el-icon-arrow-down el-icon--right"></i>
</el-button> -->
<el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item :command="1">批量操作1</el-dropdown-item>
<el-dropdown-item :command="2">批量操作2</el-dropdown-item> -->
</el-dropdown-menu>
</el-dropdown>
</el-row>
</view>
<!-- 自定义按钮区域结束 -->
<!-- 表格组件开始 -->
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
:right-btns="['detail_auto','update','delete']" :default-expand-all="false" @update="updateBtn"
@delete="deleteBtn" @current-change="currentChange" @selection-change="selectionChange"></vk-data-table>
<!-- 表格组件结束 -->
<!-- 添加或编辑的弹窗开始 -->
<vk-data-dialog v-model="form1.props.show" :title="form1.props.title" width="1000px" mode="form"
:close-on-click-modal="false">
<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
:form-type="form1.props.formType" :columns='form1.props.columns' label-width="120px"
@success="form1.props.show = false;refresh();"></vk-data-form>
</vk-data-dialog>
<!-- 添加或编辑的弹窗结束 -->
<!-- 页面内容结束 -->
</view>
</template>
<script>
var that; // 当前页面对象
var vk = uni.vk; // vk实例
var originalForms = {}; // 表单初始化数据
export default {
data() {
// 页面数据变量
return {
// 页面是否请求中或加载中
loading: false,
// init请求返回的数据
data: {
},
// 表格相关开始 -----------------------------------------------------------
table1: {
// 表格数据请求地址
action: "admin/enquiry/package/sys/getList",
// 表格字段显示规则
columns: [
// {
// key: "_id",
// title: "id",
// type: "text",
// width: 220
// },
{
key: "name",
title: "名称",
type: "text",
width: 220,
align: "left",
},
{ key: "enable", title: "启用", type: "switch", activeValue: true, inactiveValue: false },
{ key: "amount", title: "价格", type: "number"},
{ key: "num", title: "获得询价次数", type: "number"},
{ key: "isMonthly", title: "是否为包月套餐", type: "switch", activeValue: true, inactiveValue: false },
{
key: "sort",
title: "排序",
type: "number",
align: "left",
width: 80,
},
{
key: "_add_time",
title: "添加时间",
type: "time",
align: "left",
width: 160,
sortable: "custom"
},
{
key: "_add_time",
title: "距离现在",
type: "dateDiff",
align: "left",
width: 120
},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: ""
},
// 表格相关结束 -----------------------------------------------------------
// 表单相关开始 -----------------------------------------------------------
// 查询表单请求数据
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {
},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
// {
// key: "name",
// title: "名称",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "remark",
// title: "备注",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "_add_time",
// title: "添加时间",
// type: "datetimerange",
// width: 400,
// mode: "[]"
// },
]
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
sort: 0,
enable: true
},
// 表单属性
props: {
// 表单请求地址
action: "",
// 表单字段显示规则
columns: [{
key: "name",
title: "套餐名称",
type: "text",
placeholder: "请输入套餐名称"
},
{ key: "enable", title: "启用", type: "switch", activeValue: true, inactiveValue: false },
{ key: "amount", title: "价格", type: "number"},
{ key: "num", title: "获得询价次数", type: "number"},
{ key: "isMonthly", title: "是否为包月套餐", type: "switch", activeValue: true, inactiveValue: false },
{
key: "sort",
title: "排序",
type: "number",
precision: 0,
placeholder: "请输入排序值",
},
],
// 表单验证规则
rules: {
sort: [{
type: 'number',
message: '排序值必须为数字'
},{ required:true, message:'不能为空', trigger:'blur' },],
enable:[
{ required:true, message:'不能为空', trigger:'blur' },
],
name:[
{ required:true, message:'套餐名称不能为空', trigger:'blur' },
],
},
// add 代表添加 update 代表修改
formType: "",
// 是否显示表单的弹窗
show: false
}
},
// 其他弹窗表单
formDatas: {},
// 表单相关结束 -----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {},
// 函数
methods: {
// 页面数据初始化函数
init(options) {
originalForms["form1"] = vk.pubfn.copyObject(that.form1);
},
// 页面跳转
pageTo(path) {
vk.navigateTo(path);
},
// 表单重置
resetForm() {
vk.pubfn.resetForm(originalForms, that);
},
// 搜索
search() {
that.$refs.table1.search();
},
// 刷新
refresh() {
that.$refs.table1.refresh();
},
// 获取当前选中的行的数据
getCurrentRow() {
return that.$refs.table1.getCurrentRow();
},
// 监听 - 行的选中高亮事件
currentChange(val) {
that.table1.selectItem = val;
},
// 当选择项发生变化时会触发该事件
selectionChange(list) {
that.table1.multipleSelection = list;
},
// 显示添加页面
addBtn() {
that.resetForm();
that.form1.props.action = 'admin/enquiry/package/sys/add';
that.form1.props.formType = 'add';
that.form1.props.title = '添加';
that.form1.props.show = true;
},
// 显示修改页面
updateBtn({
item
}) {
that.form1.props.action = 'admin/enquiry/package/sys/update';
that.form1.props.formType = 'update';
that.form1.props.title = '编辑';
that.form1.props.show = true;
that.form1.data = item;
},
// 删除按钮
deleteBtn({
item,
deleteFn
}) {
deleteFn({
action: "admin/enquiry/package/sys/delete",
data: {
_id: item._id
},
});
},
// 监听 - 批量操作的按钮点击事件
batchBtn(index) {
switch (index) {
case 1:
vk.toast("批量操作按钮1");
break;
case 2:
vk.toast("批量操作按钮2");
break;
default:
break;
}
}
},
// 监听属性
watch: {
},
// 过滤器
filters: {
},
// 计算属性
computed: {
}
};
</script>
<style lang="scss" scoped>
.page-body {}
</style>
+317 -320
View File
@@ -1,335 +1,332 @@
<template>
<view class="page-body">
<!-- 页面内容开始 -->
<view class="page-body">
<!-- 页面内容开始 -->
<!-- 表格搜索组件开始 -->
<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"
@search="search"></vk-data-table-query>
<!-- 表格搜索组件结束 -->
<!-- 表格搜索组件开始 -->
<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"
@search="search"></vk-data-table-query>
<!-- 表格搜索组件结束 -->
<!-- 自定义按钮区域开始 -->
<view>
<el-row>
<el-button type="success" size="small" icon="el-icon-circle-plus-outline" @click="addBtn">添加</el-button>
<!-- 批量操作 -->
<el-dropdown v-if="table1.multipleSelection" :split-button="false" trigger="click" @command="batchBtn">
<!-- <el-button type="danger" size="small" style="margin-left: 20rpx;"
:disabled="table1.multipleSelection.length === 0">
批量操作<i class="el-icon-arrow-down el-icon--right"></i>
</el-button> -->
<el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item :command="1">批量操作1</el-dropdown-item>
<el-dropdown-item :command="2">批量操作2</el-dropdown-item> -->
</el-dropdown-menu>
</el-dropdown>
</el-row>
</view>
<!-- 自定义按钮区域结束 -->
<!-- 自定义按钮区域开始 -->
<view>
<el-row>
<el-button type="success" size="small" icon="el-icon-circle-plus-outline" @click="addBtn">添加
</el-button>
<!-- 批量操作 -->
<el-dropdown v-if="table1.multipleSelection" :split-button="false" trigger="click" @command="batchBtn">
<!-- <el-button type="danger" size="small" style="margin-left: 20rpx;"
:disabled="table1.multipleSelection.length === 0">
批量操作<i class="el-icon-arrow-down el-icon--right"></i>
</el-button> -->
<el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item :command="1">批量操作1</el-dropdown-item>
<el-dropdown-item :command="2">批量操作2</el-dropdown-item> -->
</el-dropdown-menu>
</el-dropdown>
</el-row>
</view>
<!-- 自定义按钮区域结束 -->
<!-- 表格组件开始 -->
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
:right-btns="['detail_auto','update','delete']" :default-expand-all="false" @update="updateBtn"
@delete="deleteBtn" @current-change="currentChange" @selection-change="selectionChange"></vk-data-table>
<!-- 表格组件结束 -->
<!-- 表格组件开始 -->
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
:right-btns="['detail_auto','update','delete']" :default-expand-all="false" @update="updateBtn"
:pagination="true"
@delete="deleteBtn" @current-change="currentChange"
@selection-change="selectionChange"></vk-data-table>
<!-- 表格组件结束 -->
<!-- 添加或编辑的弹窗开始 -->
<vk-data-dialog v-model="form1.props.show" :title="form1.props.title" width="1000px" mode="form"
:close-on-click-modal="false">
<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
:form-type="form1.props.formType" :columns='form1.props.columns' label-width="120px"
@success="form1.props.show = false;refresh();"></vk-data-form>
</vk-data-dialog>
<!-- 添加或编辑的弹窗结束 -->
<!-- 添加或编辑的弹窗开始 -->
<vk-data-dialog v-model="form1.props.show" :title="form1.props.title" width="1000px" mode="form"
:close-on-click-modal="false">
<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
:form-type="form1.props.formType" :columns='form1.props.columns' label-width="120px"
@success="form1.props.show = false;refresh();"></vk-data-form>
</vk-data-dialog>
<!-- 添加或编辑的弹窗结束 -->
<!-- 页面内容结束 -->
</view>
<!-- 页面内容结束 -->
</view>
</template>
<script>
var that; // 当前页面对象
var vk = uni.vk; // vk实例
var originalForms = {}; // 表单初始化数据
var that; // 当前页面对象
var vk = uni.vk; // vk实例
var originalForms = {}; // 表单初始化数据
export default {
data() {
// 页面数据变量
return {
// 页面是否请求中或加载中
loading: false,
// init请求返回的数据
data: {
export default {
data() {
// 页面数据变量
return {
// 页面是否请求中或加载中
loading: false,
// init请求返回的数据
data: {},
// 表格相关开始 -----------------------------------------------------------
table1: {
// 表格数据请求地址
action: "admin/enquiry/template/sys/getList",
// 表格字段显示规则
columns: [
// {
// key: "_id",
// title: "id",
// type: "text",
// width: 220
// },
{
key: "name",
title: "名称",
type: "text",
width: 220,
align: "left",
},
{key: "enable", title: "启用", type: "switch", activeValue: true, inactiveValue: false, width: 100},
// {
// key: "remark",
// title: "备注",
// type: "text",
// align: "left",
// width: 220
// },
{
key: "sort",
title: "排序",
type: "number",
align: "left",
width: 80,
},
{
key: "_add_time",
title: "添加时间",
type: "time",
align: "left",
width: 160,
sortable: "custom"
},
{
key: "_add_time",
title: "距离现在",
type: "dateDiff",
align: "left",
width: 120
},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: ""
},
// 表格相关结束 -----------------------------------------------------------
// 表单相关开始 -----------------------------------------------------------
// 查询表单请求数据
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
// {
// key: "name",
// title: "名称",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "remark",
// title: "备注",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "_add_time",
// title: "添加时间",
// type: "datetimerange",
// width: 400,
// mode: "[]"
// },
]
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
sort: 0,
enable: true
},
// 表单属性
props: {
// 表单请求地址
action: "",
// 表单字段显示规则
columns: [{
key: "name",
title: "模板名称",
type: "text",
placeholder: "请输入模板名称"
},
{key: "enable", title: "启用", type: "switch", activeValue: true, inactiveValue: false},
{
key: "sort",
title: "排序",
type: "number",
precision: 0,
placeholder: "请输入排序值",
},
{
key: "extraAttributes", title: "额外属性", type: "array<object>", itemWidth: 260,
showAdd: true,
showClear: true,
// 新增一行时,该行的默认值
defaultValue: {
label: ""
},
rightBtns: ['copy', 'delete'],
// 每行每个字段对应的渲染规则
columns: [
{
key: "label", title: "属性名称", type: "text", placeholder: "输入属性名称",
rules: [
{required: true, message: "该项不能为空", trigger: ["change", "blur"]},
]
},
{
key: "values", title: "可选值", type: "tag", placeholder: "输入可选值",
rules: [
{required: true, message: "该项不能为空", trigger: ["change", "blur"]},
]
},
},
// 表格相关开始 -----------------------------------------------------------
table1: {
// 表格数据请求地址
action: "admin/enquiry/template/sys/getList",
// 表格字段显示规则
columns: [
// {
// key: "_id",
// title: "id",
// type: "text",
// width: 220
// },
{
key: "name",
title: "名称",
type: "text",
width: 220,
align: "left",
},
{ key: "enable", title: "启用", type: "switch", activeValue: true, inactiveValue: false, width: 100 },
// {
// key: "remark",
// title: "备注",
// type: "text",
// align: "left",
// width: 220
// },
{
key: "sort",
title: "排序",
type: "number",
align: "left",
width: 80,
},
{
key: "_add_time",
title: "添加时间",
type: "time",
align: "left",
width: 160,
sortable: "custom"
},
{
key: "_add_time",
title: "距离现在",
type: "dateDiff",
align: "left",
width: 120
},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: ""
},
// 表格相关结束 -----------------------------------------------------------
// 表单相关开始 -----------------------------------------------------------
// 查询表单请求数据
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {
},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
// {
// key: "name",
// title: "名称",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "remark",
// title: "备注",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "_add_time",
// title: "添加时间",
// type: "datetimerange",
// width: 400,
// mode: "[]"
// },
]
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
sort: 0,
enable: true
},
// 表单属性
props: {
// 表单请求地址
action: "",
// 表单字段显示规则
columns: [{
key: "name",
title: "模板名称",
type: "text",
placeholder: "请输入模板名称"
},
{ key: "enable", title: "启用", type: "switch", activeValue: true, inactiveValue: false },
{
key: "sort",
title: "排序",
type: "number",
precision: 0,
placeholder: "请输入排序值",
},
{
key:"extraAttributes", title:"额外属性", type:"array<object>", itemWidth:260,
showAdd:true,
showClear:true,
// 新增一行时,该行的默认值
defaultValue:{
label:""
},
rightBtns:['copy', 'delete'],
// 每行每个字段对应的渲染规则
columns:[
{
key:"label", title:"属性名称", type:"text", placeholder:"输入属性名称",
rules:[
{ required:true, message:"该项不能为空", trigger:["change","blur"] },
]
},
{
key:"values", title:"可选值", type:"tag", placeholder:"输入可选值",
rules:[
{ required:true, message:"该项不能为空", trigger:["change","blur"] },
]
},
]
},
],
// 表单验证规则
rules: {
sort: [{
type: 'number',
message: '排序值必须为数字'
},{ required:true, message:'不能为空', trigger:'blur' },],
enable:[
{ required:true, message:'不能为空', trigger:'blur' },
],
name:[
{ required:true, message:'模板名称不能为空', trigger:'blur' },
],
},
// add 代表添加 update 代表修改
formType: "",
// 是否显示表单的弹窗
show: false
}
},
// 其他弹窗表单
formDatas: {},
// 表单相关结束 -----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {},
// 函数
methods: {
// 页面数据初始化函数
init(options) {
originalForms["form1"] = vk.pubfn.copyObject(that.form1);
},
// 页面跳转
pageTo(path) {
vk.navigateTo(path);
},
// 表单重置
resetForm() {
vk.pubfn.resetForm(originalForms, that);
},
// 搜索
search() {
that.$refs.table1.search();
},
// 刷新
refresh() {
that.$refs.table1.refresh();
},
// 获取当前选中的行的数据
getCurrentRow() {
return that.$refs.table1.getCurrentRow();
},
// 监听 - 行的选中高亮事件
currentChange(val) {
that.table1.selectItem = val;
},
// 当选择项发生变化时会触发该事件
selectionChange(list) {
that.table1.multipleSelection = list;
},
// 显示添加页面
addBtn() {
that.resetForm();
that.form1.props.action = 'admin/enquiry/template/sys/add';
that.form1.props.formType = 'add';
that.form1.props.title = '添加';
that.form1.props.show = true;
},
// 显示修改页面
updateBtn({
item
}) {
that.form1.props.action = 'admin/enquiry/template/sys/update';
that.form1.props.formType = 'update';
that.form1.props.title = '编辑';
that.form1.props.show = true;
that.form1.data = item;
},
// 删除按钮
deleteBtn({
item,
deleteFn
}) {
deleteFn({
action: "admin/enquiry/template/sys/delete",
data: {
_id: item._id
},
});
},
// 监听 - 批量操作的按钮点击事件
batchBtn(index) {
switch (index) {
case 1:
vk.toast("批量操作按钮1");
break;
case 2:
vk.toast("批量操作按钮2");
break;
default:
break;
}
}
},
// 监听属性
watch: {
]
},
],
// 表单验证规则
rules: {
sort: [{
type: 'number',
message: '排序值必须为数字'
}, {required: true, message: '不能为空', trigger: 'blur'},],
enable: [
{required: true, message: '不能为空', trigger: 'blur'},
],
name: [
{required: true, message: '模板名称不能为空', trigger: 'blur'},
],
},
// 过滤器
filters: {
},
// 计算属性
computed: {
}
};
},
// add 代表添加 update 代表修改
formType: "",
// 是否显示表单的弹窗
show: false
}
},
// 其他弹窗表单
formDatas: {},
// 表单相关结束 -----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {
},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {
},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {
},
// 函数
methods: {
// 页面数据初始化函数
init(options) {
originalForms["form1"] = vk.pubfn.copyObject(that.form1);
},
// 页面跳转
pageTo(path) {
vk.navigateTo(path);
},
// 表单重置
resetForm() {
vk.pubfn.resetForm(originalForms, that);
},
// 搜索
search() {
that.$refs.table1.search();
},
// 刷新
refresh() {
that.$refs.table1.refresh();
},
// 获取当前选中的行的数据
getCurrentRow() {
return that.$refs.table1.getCurrentRow();
},
// 监听 - 行的选中高亮事件
currentChange(val) {
that.table1.selectItem = val;
},
// 当选择项发生变化时会触发该事件
selectionChange(list) {
that.table1.multipleSelection = list;
},
// 显示添加页面
addBtn() {
that.resetForm();
that.form1.props.action = 'admin/enquiry/template/sys/add';
that.form1.props.formType = 'add';
that.form1.props.title = '添加';
that.form1.props.show = true;
},
// 显示修改页面
updateBtn({
item
}) {
that.form1.props.action = 'admin/enquiry/template/sys/update';
that.form1.props.formType = 'update';
that.form1.props.title = '编辑';
that.form1.props.show = true;
that.form1.data = item;
},
// 删除按钮
deleteBtn({
item,
deleteFn
}) {
deleteFn({
action: "admin/enquiry/template/sys/delete",
data: {
_id: item._id
},
});
},
// 监听 - 批量操作的按钮点击事件
batchBtn(index) {
switch (index) {
case 1:
vk.toast("批量操作按钮1");
break;
case 2:
vk.toast("批量操作按钮2");
break;
default:
break;
}
}
},
// 监听属性
watch: {},
// 过滤器
filters: {},
// 计算属性
computed: {}
};
</script>
<style lang="scss" scoped>
.page-body {}
.page-body {
}
</style>
+309
View File
@@ -0,0 +1,309 @@
<template>
<view class="page-body">
<!-- 页面内容开始 -->
<!-- 表格搜索组件开始 -->
<!-- <vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"-->
<!-- @search="search"></vk-data-table-query>-->
<!-- 表格搜索组件结束 -->
<!-- 自定义按钮区域开始 -->
<view>
<el-row>
<el-button type="success" size="small" icon="el-icon-circle-plus-outline" @click="addBtn">添加</el-button>
<!-- 批量操作 -->
<el-dropdown v-if="table1.multipleSelection" :split-button="false" trigger="click" @command="batchBtn">
<!-- <el-button type="danger" size="small" style="margin-left: 20rpx;"
:disabled="table1.multipleSelection.length === 0">
批量操作<i class="el-icon-arrow-down el-icon--right"></i>
</el-button> -->
<el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item :command="1">批量操作1</el-dropdown-item>
<el-dropdown-item :command="2">批量操作2</el-dropdown-item> -->
</el-dropdown-menu>
</el-dropdown>
</el-row>
</view>
<!-- 自定义按钮区域结束 -->
<!-- 表格组件开始 -->
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
:right-btns="['detail_auto','update','delete']" :default-expand-all="false" @update="updateBtn" pagination
@delete="deleteBtn" @current-change="currentChange" @selection-change="selectionChange"></vk-data-table>
<!-- 表格组件结束 -->
<!-- 添加或编辑的弹窗开始 -->
<vk-data-dialog v-model="form1.props.show" :title="form1.props.title" width="60%" mode="form"
:close-on-click-modal="false">
<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
:form-type="form1.props.formType" :columns='form1.props.columns' label-width="120px"
@success="form1.props.show = false;refresh();"></vk-data-form>
</vk-data-dialog>
<!-- 添加或编辑的弹窗结束 -->
<!-- 页面内容结束 -->
</view>
</template>
<script>
var that; // 当前页面对象
var vk = uni.vk; // vk实例
var originalForms = {}; // 表单初始化数据
export default {
data() {
// 页面数据变量
return {
// 页面是否请求中或加载中
loading: false,
// init请求返回的数据
data: {
},
// 表格相关开始 -----------------------------------------------------------
table1: {
// 表格数据请求地址
action: "admin/ensureConfig/sys/getList",
// 表格字段显示规则
columns: [
// {
// key: "_id",
// title: "id",
// type: "text",
// width: 220
// },
// {
// key: "name",
// title: "名称",
// type: "text",
// width: 220,
// align: "left",
// },
{
key: "amount",
title: "价格",
type: "number",
align: "left",
width: 220
},
{
key: "sort",
title: "排序",
type: "number",
align: "left",
width: 80,
},
{
key: "_add_time",
title: "添加时间",
type: "time",
align: "left",
width: 160,
sortable: "custom"
},
{
key: "_add_time",
title: "距离现在",
type: "dateDiff",
align: "left",
width: 120
},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: ""
},
// 表格相关结束 -----------------------------------------------------------
// 表单相关开始 -----------------------------------------------------------
// 查询表单请求数据
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {
},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
{
key: "name",
title: "名称",
type: "text",
width: 160,
mode: "%%"
},
// {
// key: "remark",
// title: "备注",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "_add_time",
// title: "添加时间",
// type: "datetimerange",
// width: 400,
// mode: "[]"
// },
]
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
sort: 0
},
// 表单属性
props: {
// 表单请求地址
action: "",
// 表单字段显示规则
columns: [
// {
// key: "name",
// title: "名称",
// type: "text",
// placeholder: "请输入名称"
// },
{
key: "amount",
title: "价格",
type: "number",
},
{
key: "sort",
title: "排序",
type: "number",
precision: 0,
placeholder: "请输入排序值",
tips: '数字越小越靠前'
},
],
// 表单验证规则
rules: {
sort: [{
type: 'number',
message: '排序值必须为数字'
}],
amount:[
{ required:true, message:'金额不能为空', trigger:'blur' },
],
},
// add 代表添加 update 代表修改
formType: "",
// 是否显示表单的弹窗
show: false
}
},
// 其他弹窗表单
formDatas: {},
// 表单相关结束 -----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {},
// 函数
methods: {
// 页面数据初始化函数
init(options) {
originalForms["form1"] = vk.pubfn.copyObject(that.form1);
},
// 页面跳转
pageTo(path) {
vk.navigateTo(path);
},
// 表单重置
resetForm() {
vk.pubfn.resetForm(originalForms, that);
},
// 搜索
search() {
that.$refs.table1.search();
},
// 刷新
refresh() {
that.$refs.table1.refresh();
},
// 获取当前选中的行的数据
getCurrentRow() {
return that.$refs.table1.getCurrentRow();
},
// 监听 - 行的选中高亮事件
currentChange(val) {
that.table1.selectItem = val;
},
// 当选择项发生变化时会触发该事件
selectionChange(list) {
that.table1.multipleSelection = list;
},
// 显示添加页面
addBtn() {
that.resetForm();
that.form1.props.action = 'admin/ensureConfig/sys/add';
that.form1.props.formType = 'add';
that.form1.props.title = '添加';
that.form1.props.show = true;
},
// 显示修改页面
updateBtn({
item
}) {
that.form1.props.action = 'admin/ensureConfig/sys/update';
that.form1.props.formType = 'update';
that.form1.props.title = '编辑';
that.form1.props.show = true;
that.form1.data = item;
},
// 删除按钮
deleteBtn({
item,
deleteFn
}) {
deleteFn({
action: "admin/ensureConfig/sys/delete",
data: {
_id: item._id
},
});
},
// 监听 - 批量操作的按钮点击事件
batchBtn(index) {
switch (index) {
case 1:
vk.toast("批量操作按钮1");
break;
case 2:
vk.toast("批量操作按钮2");
break;
default:
break;
}
}
},
// 监听属性
watch: {
},
// 过滤器
filters: {
},
// 计算属性
computed: {
}
};
</script>
<style lang="scss" scoped>
.page-body {}
</style>
+432
View File
@@ -0,0 +1,432 @@
<template>
<view class="page-body">
<!-- 页面内容开始 -->
<!-- 表格搜索组件开始 -->
<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"
@search="search"></vk-data-table-query>
<!-- 表格搜索组件结束 -->
<!-- 自定义按钮区域开始 -->
<view>
<el-row>
<!-- 批量操作 -->
<el-dropdown v-if="table1.multipleSelection" :split-button="false" trigger="click" @command="batchBtn">
<!-- <el-button type="danger" size="small" style="margin-left: 20rpx;"
:disabled="table1.multipleSelection.length === 0">
批量操作<i class="el-icon-arrow-down el-icon--right"></i>
</el-button> -->
<el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item :command="1">批量操作1</el-dropdown-item>
<el-dropdown-item :command="2">批量操作2</el-dropdown-item> -->
</el-dropdown-menu>
</el-dropdown>
</el-row>
</view>
<!-- 自定义按钮区域结束 -->
<!-- 表格组件开始 -->
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
:right-btns="['detail_auto']" :default-expand-all="false" @update="updateBtn"
@current-change="currentChange" :pagination="true"
:custom-right-btns="table1.customRightBtns"
@selection-change="selectionChange">
<template v-slot:action="{ row, column, index }">
<template v-if="row.authStatus === 0">
<el-button type="success" size="mini" @click.native="changeStatus(row._id, 1)">通过</el-button>
<el-button type="danger" size="mini" @click.native="refuse(row._id)">拒绝</el-button>
</template>
</template>
<template v-slot:isShow="{ row, column, index }">
<template v-if="row.status === 1">
<el-switch v-model="row.isShow" size="mini" @change="changeField(row._id, 'isShow', $event)"
:active-value="true"
:inactive-value="false"/>
</template>
</template>
</vk-data-table>
<!-- 表格组件结束 -->
<!-- 页面内容结束 -->
</view>
</template>
<script>
var that; // 当前页面对象
var vk = uni.vk; // vk实例
var originalForms = {}; // 表单初始化数据
export default {
data() {
// 页面数据变量
return {
// 页面是否请求中或加载中
loading: false,
// init请求返回的数据
data: {},
// 表格相关开始 -----------------------------------------------------------
table1: {
customRightBtns: [
{
title: '通过', type: 'success',
show: (item) => {
return item.status === 0
},
onClick: (item) => {
this.changeStatus(item._id, 1);
}
},
{
title: '拒绝', type: 'danger',
show: (item) => {
return item.status === 0
},
onClick: (item) => {
this.refuse(item._id)
}
},
],
// 表格数据请求地址
action: "admin/factory/list/sys/list",
// 表格字段显示规则
columns: [
// {
// key: "_id",
// title: "id",
// type: "text",
// width: 220
// },
{
key: "user.nickname",
title: "名称",
type: "text",
width: 220,
align: "left",
},
{
key: "year",
title: "成立年限",
type: "text",
width: 220,
align: "left",
},
{
key: "yearsIncome",
title: "年产值",
type: "text",
width: 220,
align: "left",
},
{
key: "employeeNum",
title: "员工人数",
type: "text",
width: 220,
align: "left",
},
{
key: "flowNum",
title: "流水线数量",
type: "text",
width: 220,
align: "left",
},
{
key: "blongTo",
title: "厂房归属",
type: "text",
width: 220,
align: "left",
},
{
key: "size",
title: "厂房面积",
type: "text",
width: 220,
align: "left",
},
{
key: "addressRegion",
title: "所在地",
type: "text",
width: 220,
align: "left",
formatter: (val, row, column, index) => {
return `${val.province.name} ${val.city.name}`
}
},
{
key: "mainProcess",
title: "主营工艺和业务范围",
type: "text",
width: 220,
align: "left",
show: ['detail']
},
{
key: "mainSpotCategory",
title: "主营类别",
type: "text",
width: 220,
align: "left",
show: ['detail'],
formatter: (val, row, column, index) => {
return val.join()
}
},
{
key: "serviceInfo",
title: "服务信息",
type: "text",
width: 220,
align: "left",
show: ['detail']
},
{
key: "deviceList",
title: "设备信息",
type: "html",
width: 220,
align: "left",
show: ['detail'],
formatter: (val, row, column, index) => {
let content = ''
val.forEach(item => {
content += `<div>${item.name}/${item.num}台/${item.source}/${item.type}/${item.brand}/${item.model}/${item.year}年/${item?.desc}</div>`
})
return content
}
},
{
key: "album",
title: "工厂实景",
type: "image",
width: 220,
align: "left",
show: ['detail']
},
{
key: "status",
title: "状态",
type: "select",
data: [
{
value: 0,
label: "待审核"
},
{
value: 1,
label: "审核通过"
},
{
value: 2,
label: "审核拒绝"
}
]
},
{
key: "isShow",
title: "显示/隐藏",
type: "html",
data: [
{
value: false,
label: "隐藏"
},
{
value: true,
label: "显示"
}
]
},
{
key: "_add_time",
title: "添加时间",
type: "time",
align: "left",
width: 160,
sortable: "custom"
},
{
key: "_add_time_diff",
title: "距离现在",
type: "html",
align: "left",
width: 120,
formatter: (val, row) => vk.pubfn.dateDiff(row._add_time)
},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: ""
},
// 表格相关结束 -----------------------------------------------------------
// 表单相关开始 -----------------------------------------------------------
// 查询表单请求数据
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
{
key: "keyword",
title: "名称",
type: "text",
width: 160,
mode: "%%"
},
// {
// key: "remark",
// title: "备注",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "_add_time",
// title: "添加时间",
// type: "datetimerange",
// width: 400,
// mode: "[]"
// },
]
},
// 其他弹窗表单
formDatas: {},
// 表单相关结束 -----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {
},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {
},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {
},
// 函数
methods: {
// 页面数据初始化函数
init(options) {
originalForms["form1"] = vk.pubfn.copyObject(that.form1);
},
// 页面跳转
pageTo(path) {
vk.navigateTo(path);
},
// 表单重置
resetForm() {
vk.pubfn.resetForm(originalForms, that);
},
// 搜索
search() {
that.$refs.table1.search();
},
// 刷新
refresh() {
that.$refs.table1.refresh();
},
// 获取当前选中的行的数据
getCurrentRow() {
return that.$refs.table1.getCurrentRow();
},
// 监听 - 行的选中高亮事件
currentChange(val) {
that.table1.selectItem = val;
},
// 当选择项发生变化时会触发该事件
selectionChange(list) {
that.table1.multipleSelection = list;
},
// 显示添加页面
addBtn() {
that.resetForm();
that.form1.props.action = 'admin/article/list/sys/add';
that.form1.props.formType = 'add';
that.form1.props.title = '添加';
that.form1.props.show = true;
},
// 显示修改页面
updateBtn({
item
}) {
that.form1.props.action = 'admin/article/list/sys/update';
that.form1.props.formType = 'update';
that.form1.props.title = '编辑';
that.form1.props.show = true;
that.form1.data = item;
},
// 删除按钮
deleteBtn({
item,
deleteFn
}) {
deleteFn({
action: "admin/article/list/sys/delete",
data: {
_id: item._id
},
});
},
// 监听 - 批量操作的按钮点击事件
batchBtn(index) {
switch (index) {
case 1:
vk.toast("批量操作按钮1");
break;
case 2:
vk.toast("批量操作按钮2");
break;
default:
break;
}
},
async refuse(id) {
const {action, value} = await this.$prompt('拒绝理由', {
showInput: true
});
if (action === 'confirm') {
this.changeStatus(id, 2, value)
}
},
changeStatus(id, status, refuseReason = null) {
vk.callFunction({
url: 'admin/factory/list/sys/changeStatus',
data: {
id, status, refuseReason
}
}).then(() => {
this.$refs.table1.refresh()
})
},
changeField(id, field, value) {
vk.callFunction({
url: 'admin/factory/list/sys/changeField',
data: {
id, field, value
}
}).then(() => {
this.$refs.table1.refresh()
})
},
},
// 监听属性
watch: {},
// 过滤器
filters: {},
// 计算属性
computed: {}
};
</script>
<style lang="scss" scoped>
.page-body {
}
</style>
+65
View File
@@ -0,0 +1,65 @@
<template>
<el-dialog title="新闻动态" :visible.sync="dialogVisible" width="60%">
<el-table :data="list" style="width: 100%">
<el-table-column prop="title" label="标题"/>
<el-table-column label="是否显示">
<template #default="{ row }">
<el-switch v-model="row.isShow" size="mini"
@change="changeShow($event, row._id)" :active-value="1"
:inactive-value="0"/>
</template>
</el-table-column>
<el-table-column prop="_add_time_str" label="发布时间"/>
<el-table-column label="详情">
<template #default="{ row }">
<el-button type="primary" size="mini" @click.native="doShowDetail(row)">查看详情</el-button>
</template>
</el-table-column>
</el-table>
<el-dialog title="新闻动态" :visible.sync="showDetail" width="60%" append-to-body="">
<div v-html="content"></div>
</el-dialog>
</el-dialog>
</template>
<script>
export default {
name: "ArticleList",
data() {
return {
dialogVisible: false,
showDetail: false,
list: [],
content: ''
}
},
methods: {
open(userId) {
this.getList(userId)
},
async getList(userId) {
const {rows} = await vk.callFunction({
url: 'admin/userArticle/list/sys/list',
data: {
userId
}
})
this.dialogVisible = true
this.list = rows
},
async changeShow(isShow, id) {
await vk.callFunction({
url: 'admin/userArticle/list/sys/changeShow',
data: {
id, isShow
}
})
},
doShowDetail(row) {
this.showDetail = true
this.content = row.content
}
}
}
</script>
@@ -0,0 +1,56 @@
<template>
<el-dialog title="授权人/法人变更历史" :visible.sync="dialogVisible" width="60%">
<el-table :data="list" style="width: 100%">
<el-table-column prop="type" label="授权人类型">
<template #default="{ row }">
{{ row.type === 1 ? '法人' : '授权人' }}
</template>
</el-table-column>
<el-table-column prop="personName" label="姓名"/>
<el-table-column prop="certType" label="证件类型">
<template #default="{ row }">
<div>{{ row.certType === 0 ? '身份证' : '护照'}}</div>
</template>
</el-table-column>
<el-table-column prop="idCard" label="证件号"/>
<el-table-column label="身份证头像面">
<template #default="{ row }">
<el-image :src="row.headPhotoPath"/>
</template>
</el-table-column>
<el-table-column label="身份证国徽面">
<template #default="{ row }">
<el-image :src="row.backgroundIdCardPath"/>
</template>
</el-table-column>
<el-table-column prop="_add_time_str" label="变更时间"/>
</el-table>
</el-dialog>
</template>
<script>
export default {
name: "ManagerChangeLog",
data() {
return {
dialogVisible: false,
list: [],
}
},
methods: {
open(userId){
this.getList(userId)
},
async getList(userId){
const {rows} = await vk.callFunction({
url: 'admin/system/user/sys/managerChangeLog',
data: {
userId
}
})
this.dialogVisible = true
this.list = rows
}
}
}
</script>
+334 -67
View File
@@ -1,75 +1,342 @@
<template>
<div>
<vk-data-table-query
v-model="queryForm1.formData"
:columns="queryForm1.columns"
@search="search"
></vk-data-table-query>
<vk-data-table
ref="table1"
:action="table1.action"
:columns="table1.columns"
:query-form-param="queryForm1"
:right-btns="[]"
:selection="true"
:row-no="true"
:pagination="true"
></vk-data-table>
</div>
<div>
<vk-data-table-query
v-model="queryForm1.formData"
:columns="queryForm1.columns"
@search="search"
></vk-data-table-query>
<view>
<el-row>
<el-button type="success" size="small" icon="el-icon-circle-plus-outline"
@click="showMultiAddQuoteNum = true">批量赠送报价次数
</el-button>
</el-row>
</view>
<vk-data-table
ref="table1"
:action="table1.action"
:columns="table1.columns"
:query-form-param="queryForm1"
:right-btns="[]"
:selection="true"
:row-no="true"
:pagination="true"
>
<template v-slot:action="{ row, column, index }">
<template v-if="row.authStatus === 0">
<el-button type="success" size="mini" @click.native="changeStatus(row._id, 1)">通过</el-button>
<el-button type="danger" size="mini" @click.native="refuse(row._id)">拒绝</el-button>
</template>
<template v-if="row.authStatus === 1 && row.businessCard && row.businessCard.status === 0">
<el-button type="success" size="mini" @click.native="cardChangeStatus(row._id, 1)">名片审核通过
</el-button>
<el-button type="danger" size="mini" @click.native="cardRefuse(row._id)">名片审核拒绝</el-button>
</template>
<el-button size="mini" @click.native="doShowInfo(row)">详情</el-button>
<el-button size="mini" @click.native="doShowBusinessCardInfo(row)">名片详情</el-button>
</template>
<template v-slot:remainQuoteNum="{ row, column, index }">
<el-input-number v-model="row.remainQuoteNum" @change="changeQuoteNum($event, row._id)"/>
</template>
<template v-slot:isNotaryBusiness="{ row, column, index }">
<el-switch v-model="row.isNotaryBusiness" size="mini"
@change="changeField(row._id, 'isNotaryBusiness', $event)"
:active-value="1"
:inactive-value="0"/>
</template>
<template v-slot:mid="{ row, column, index }">
<el-input v-model="row.mid" @change="changeField(row._id, 'mid', $event)"/>
</template>
<template v-slot:tid="{ row, column, index }">
<el-input v-model="row.tid" @change="changeField(row._id, 'tid', $event)"/>
</template>
</vk-data-table>
<vk-data-dialog
v-model="showInfo"
:title="title"
width="60%"
top="14vh"
center
:close-on-click-modal="true"
>
<vk-data-detail-table
:data="info"
:columns="infoColumns"
size="medium"
label-width="150px"
></vk-data-detail-table>
<template v-slot:footer>
<el-button @click="showInfo = false">关闭</el-button>
</template>
</vk-data-dialog>
<vk-data-dialog
v-model="showBusinessCardInfo"
:title="title"
width="60%"
top="14vh"
center
:close-on-click-modal="true"
>
<vk-data-detail-table
:data="info"
:columns="businessColumns"
size="medium"
label-width="150px"
></vk-data-detail-table>
<template v-slot:footer>
<el-button @click="showBusinessCardInfo = false">关闭</el-button>
</template>
</vk-data-dialog>
<el-dialog
title="批量赠送报价次数"
:visible.sync="showMultiAddQuoteNum"
width="50%">
<el-row :gutter="10">
<el-col :span="20">
<el-select v-model="selectedList" placeholder="点击选择账号" style="width: 100%" multiple clearable
filterable>
<el-option
v-for="(item, index) in userList"
:key="item.value"
:label="item.nickname"
:value="item._id">
</el-option>
</el-select>
</el-col>
<el-col :span="4">
<el-button type="primary" @click="selectedList = userList.map(item => item._id)">全选</el-button>
</el-col>
</el-row>
<p style="margin-top: 2rem">请输入赠送报价次数</p>
<el-input-number v-model="sendNum" placeholder="请输入报价次数"/>
<div slot="footer" class="dialog-footer">
<el-button @click="showMultiAddQuoteNum = false">取 消</el-button>
<el-button type="primary" @click="multiAddQuoteNum">确 定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
export default {
name: "index",
data() {
return {
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {
dcloud_appid: "",
type: 1
//allow_login_background : true,
},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
{key: "username", title: "用户名", type: "text", width: 160, mode: "%%"},
{key: "nickname", title: "昵称", type: "text", width: 140, mode: "%%"},
{key: "mobile", title: "手机号", type: "text", width: 140, mode: "%%"},
]
},
table1: {
// 表格数据请求地址
action: "admin/system/user/sys/getList",
// 表格字段显示规则
columns: [
{key: "mobile", title: "手机号", type: "text", width: 120, defaultValue: ""},
// {
// key: "", title: "认证类型", type: "text", width: 120, formatter: (val, row, column, index) => {
// return parseInt(row.type) === 1 ? '个人' : '企业'
// }
// },
{
key: "mobile", title: "个人信息", type: "html", defaultValue: "",
formatter: (val, row, column, index) => {
let str
str = `<view>${row.person.personName}</view>`
// str += `<view>${row.person.mobile}</view>`
return str;
}
},
{key: "authenticationSubmitTime", title: "认证时间", type: "time", width: 160, sortable: "custom"},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: "",
}
}
},
methods: {
search() {
this.$refs.table1.query();
name: "index",
data() {
return {
showInfo: false,
showBusinessCardInfo: false,
info: null,
showMultiAddQuoteNum: false,
selectedList: [],
userList: [],
sendNum: 0,
infoColumns: [
{
key: "userType", title: "用户类型", type: "html",
formatter: (val, row, column, index) => {
if (!val) return '平台交易功能用户'
else return '金久信签约宝、特产商城用户'
}
},
{key: "person.personName", title: "姓名", type: "text"},
{key: "person.address", title: "通信地址", type: "text"},
{key: "person.mainSpotCategoryNames", title: "主营业务", type: "text"},
{key: "person.mobile", title: "手机号", type: "text"},
{key: "person.businessType", title: "行业分类", type: "text"},
{key: "person.personAccount", title: "个人账号", type: "text"},
{key: "person.personBankName", title: "开户行", type: "text"},
{key: "person.accountName", title: "个人账号", type: "text"},
// {key: "person.photo", title: "金久信平台幕布照", type: "image"},
],
businessColumns: [
{key: "businessCard.logo", title: "Logo", type: "image"},
{key: "businessCard.personalWechat", title: "个人微信", type: "image"},
{key: "businessCard.position", title: "职位", type: "text"},
{key: "businessCard.companyMobile", title: "公司电话", type: "text"},
{key: "businessCard.managerMobile", title: "负责人电话", type: "text"},
{key: "businessCard.address", title: "地区", type: "address"},
{key: "businessCard.addressDetail", title: "详细地址", type: "text"},
{key: "businessCard.email", title: "邮箱", type: "text"},
{key: "businessCard.website", title: "网址", type: "text"},
{key: "businessCard.companyIntroduction", title: "企业简介", type: "editor"},
],
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {
dcloud_appid: "",
type: 1,
isSignOnly: false,
//allow_login_background : true,
},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
// {key: "username", title: "用户名", type: "text", width: 160, mode: "%%"},
{key: "nickname", title: "昵称", type: "text", width: 140, mode: "%%"},
{key: "mobile", title: "手机号", type: "text", width: 140, mode: "%%"},
{
key: "authStatus", title: "审核筛选", type: "select", width: 150, data: [
{value: 0, label: '待审核'},
{value: 1, label: '已通过'},
]
},
{
key: "businessCard.status", title: "名片审核筛选", type: "select", width: 150, data: [
{value: 0, label: '待审核'},
{value: 1, label: '已通过'},
]
},
]
},
table1: {
// 表格数据请求地址
action: "admin/system/user/sys/getList",
// 表格字段显示规则
columns: [
{key: "mobile", title: "手机号", type: "text", width: 120, defaultValue: ""},
{
key: "mobile", title: "个人信息", type: "html", defaultValue: "",
formatter: (val, row, column, index) => {
let str
str = `<view>${row.person.personName}</view>`
str += `<view>${row.mobile}</view>`
return str;
}
},
// {
// key: "authType", title: "认证类型", type: "html", defaultValue: "",
// formatter: (val, row, column, index) => {
// return `<view>${row.authType === 1 ? "法大大认证" : "平台认证"}</view>`;
// }
// },
{
key: "authStatus", title: "认证状态", type: "tag", data: [
{value: -1, label: "未认证", tagType: "warning"},
{value: 0, label: "认证中", tagType: "warning"},
{value: 1, label: "已认证", tagType: "success"},
{value: 2, label: "认证失败", tagType: "danger"},
]
},
{
key: "businessCard.status", title: "名片审核状态", type: "select", data: [
{value: 0, label: "审核中", tagType: "warning"},
{value: 1, label: "已审核", tagType: "success"},
{value: 2, label: "审核失败", tagType: "danger"},
]
},
{
key: "isNotaryBusiness", title: "金久信公证业务", type: "html", width: 160
},
{
key: "remainQuoteNum", title: "报价次数", type: "html", width: 300
},
{
key: "mid", title: "商户号", type: "html", width: 300
},
{
key: "tid", title: "终端号", type: "html", width: 300
},
{key: "authSubmitTime", title: "提交时间", type: "time", width: 160, sortable: "custom"},
{
key: "action", title: "操作", type: "html",
width: 200,
fixed: 'right'
},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: "",
}
}
},
methods: {
search() {
this.$refs.table1.query();
},
async refuse(id) {
const {action, value} = await this.$prompt('拒绝理由', {
showInput: true
});
if (action === 'confirm') {
this.changeStatus(id, 2, value)
}
},
changeStatus(id, authStatus, refuseReason = null) {
vk.callFunction({
url: 'admin/system/user/sys/changeStatus',
data: {
id, authStatus, refuseReason
}
}).then(() => {
this.$refs.table1.refresh()
})
},
doShowInfo(info) {
this.info = info
this.title = '详情'
this.showInfo = true
},
doShowBusinessCardInfo(info) {
this.info = info
this.title = '名片详情'
this.showBusinessCardInfo = true
},
async cardRefuse(id) {
const {action, value} = await this.$prompt('拒绝理由', {
showInput: true
});
if (action === 'confirm') {
this.cardChangeStatus(id, 2, value)
}
},
cardChangeStatus(id, status, refuseReason = null) {
vk.callFunction({
url: 'admin/system/user/sys/changeCardStatus',
data: {
id, status, refuseReason
}
}).then(() => {
this.$refs.table1.refresh()
})
},
changeQuoteNum(value, id) {
this.changeField(id, 'remainQuoteNum', value)
},
changeField(id, field, value) {
vk.callFunction({
url: 'admin/system/user/sys/changeField',
data: {
id, field, value
}
}).then(() => {
this.$refs.table1.refresh()
})
},
async getUserList() {
const {rows} = await vk.callFunction({
url: 'admin/system/user/sys/getList',
data: {type: 1, pageSize: 500}
})
this.userList = rows
},
async multiAddQuoteNum() {
if (!this.sendNum) return this.$message.error('请输入赠送报价次数')
if (this.selectedList.length === 0) return this.$message.error('请选择要赠送的报价用户')
await vk.callFunction({
url: 'admin/system/user/sys/multiSendQuoteNum',
data: {
list: this.selectedList,
sendNum: this.sendNum
}
})
this.selectedList = []
this.$message.success('赠送成功')
this.showMultiAddQuoteNum = false
this.$refs.table1.refresh()
}
},
onLoad() {
this.getUserList()
}
}
</script>
</script>
+535 -170
View File
@@ -1,178 +1,543 @@
<template>
<div>
<vk-data-table-query
v-model="queryForm1.formData"
:columns="queryForm1.columns"
@search="search"
></vk-data-table-query>
<vk-data-table
ref="table1"
:action="table1.action"
:columns="table1.columns"
:query-form-param="queryForm1"
:right-btns="[]"
:selection="true"
:row-no="true"
:pagination="true"
>
<template v-slot:action="{ row, column, index }">
<el-button size="mini" @click.native="doShowInfo(row)">详情</el-button>
<template v-if="row.authStatus === 0">
<el-button type="success" size="mini" @click.native="changeStatus(row._id, 1)">通过</el-button>
<el-button type="danger" size="mini" @click.native="refuse(row._id)">拒绝</el-button>
</template>
</template>
<template v-slot:isCoop="{ row, column, index }">
<el-switch v-model="row.isCoop" size="mini" @change="changeIsCoop(row._id)" :active-value="1"
:inactive-value="0"/>
</template>
</vk-data-table>
<vk-data-dialog
v-model="showInfo"
:title="title"
width="60%"
top="14vh"
center
:close-on-click-modal="true"
>
<vk-data-detail-table
:data="info"
:columns="infoColumns"
size="medium"
label-width="150px"
></vk-data-detail-table>
<template v-slot:footer>
<el-button @click="showInfo = false">关闭</el-button>
</template>
</vk-data-dialog>
</div>
<div>
<vk-data-table-query
v-model="queryForm1.formData"
:columns="queryForm1.columns"
@search="search"
></vk-data-table-query>
<view>
<el-row>
<el-button type="success" size="small" icon="el-icon-circle-plus-outline"
@click="showMultiAddQuoteNum = true">批量赠送报价次数
</el-button>
</el-row>
</view>
<vk-data-table
ref="table1"
:action="table1.action"
:columns="table1.columns"
:query-form-param="queryForm1"
:right-btns="[]"
:selection="true"
:row-no="true"
:pagination="true"
right-fixed
:right-btns-width="400"
>
<template v-slot:action="{ row, column, index }">
<el-space>
<template v-if="row.authStatus === 0">
<el-button type="success" size="mini" @click.native="changeStatus(row._id, 1)">认证通过</el-button>
<el-button type="danger" size="mini" @click.native="refuse(row._id)">认证拒绝</el-button>
</template>
<template v-if="row.authStatus === 1 && row.businessCard && row.businessCard.status === 0">
<el-button type="success" size="mini" @click.native="cardChangeStatus(row._id, 1)">名片审核通过
</el-button>
<el-button type="danger" size="mini" @click.native="cardRefuse(row._id)">名片审核拒绝</el-button>
</template>
<el-dropdown>
<span class="el-dropdown-link">
其他操作<i class="el-icon-arrow-down el-icon--right"></i>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item>
<el-button size="mini" style="width: 100%" @click.native="doShowInfo(row)">详情</el-button>
</el-dropdown-item>
<el-dropdown-item>
<el-button size="mini" style="width: 100%" @click.native="doShowBusinessCardInfo(row)">名片详情</el-button>
</el-dropdown-item>
<el-dropdown-item>
<el-button size="mini" style="width: 100%" @click.native="doManagerChangeLog(row)">委托人/法人变更历史</el-button>
</el-dropdown-item>
<el-dropdown-item>
<el-button size="mini" style="width: 100%" @click.native="showArticle(row)" v-if="row.userLevel > 1">新闻动态</el-button>
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</el-space>
</template>
<template v-slot:isCoop="{ row, column, index }">
<el-switch v-model="row.isCoop" size="mini" @change="changeIsCoop(row._id)" :active-value="1"
:inactive-value="0"/>
</template>
<template v-slot:showInYellow="{ row, column, index }">
<template v-if="row.businessCard && row.businessCard.status === 1">
<el-switch v-model="row.showInYellow" size="mini"
@change="changeShowInYellow(row._id)"
:active-value="1"
:inactive-value="0"/>
</template>
<span v-else></span>
</template>
<template v-slot:isCompanyQuote="{ row, column, index }">
<el-switch v-model="row.isCompanyQuote" size="mini"
@change="changeField(row._id, 'isCompanyQuote', $event)"
:active-value="1"
:inactive-value="0"/>
</template>
<template v-slot:isProductQuote="{ row, column, index }">
<el-switch v-model="row.isProductQuote" size="mini"
@change="changeField(row._id, 'isProductQuote', $event)"
:active-value="1"
:inactive-value="0"/>
</template>
<template v-slot:isCostQuote="{ row, column, index }">
<el-switch v-model="row.isCostQuote" size="mini"
@change="changeField(row._id, 'isCostQuote', $event)"
:active-value="1"
:inactive-value="0"/>
</template>
<template v-slot:isNotaryBusiness="{ row, column, index }">
<el-switch v-model="row.isNotaryBusiness" size="mini"
@change="changeField(row._id, 'isNotaryBusiness', $event)"
:active-value="1"
:inactive-value="0"/>
</template>
<template v-slot:merchantCode="{ row, column, index }">
<el-input v-model="row.merchantCode" size="mini"
@change="changeField(row._id, 'merchantCode', $event)"/>
</template>
<template v-slot:settleRate="{ row, column, index }">
<el-input-number :min="0" :max="100" v-model="row.settleRate" size="mini"
@change="changeField(row._id, 'settleRate', $event)"/>
</template>
<template v-slot:permissionArea="{ row, column, index }">
<vk-data-input-address v-model="row.permissionArea" placeholder="请选择省市区" :level="3"
@change="changeArea($event, row._id)"/>
</template>
<template v-slot:remainQuoteNum="{ row, column, index }">
<el-input-number v-model="row.remainQuoteNum" @change="changeQuoteNum($event, row._id)"/>
</template>
<template v-slot:mid="{ row, column, index }">
<el-input v-model="row.mid" @change="changeField(row._id, 'mid', $event)"/>
</template>
<template v-slot:merNo="{ row, column, index }">
<el-input v-model="row.merNo" placeholder="请输入企业用户号"
@change="changeField(row._id, 'merNo', $event)"/>
</template>
<template v-slot:tid="{ row, column, index }">
<el-input v-model="row.tid" @change="changeField(row._id, 'tid', $event)"/>
</template>
</vk-data-table>
<vk-data-dialog
v-model="showInfo"
:title="title"
width="60%"
top="14vh"
center
:close-on-click-modal="true"
>
<vk-data-detail-table
:data="info"
:columns="infoColumns"
size="medium"
label-width="150px"
></vk-data-detail-table>
<template v-slot:footer>
<el-button @click="showInfo = false">关闭</el-button>
</template>
</vk-data-dialog>
<vk-data-dialog
v-model="showBusinessCardInfo"
:title="title"
width="60%"
top="14vh"
center
:close-on-click-modal="true"
>
<vk-data-detail-table
:data="info"
:columns="businessColumns"
size="medium"
label-width="150px"
>
</vk-data-detail-table>
<template v-slot:footer>
<el-button @click="showBusinessCardInfo = false">关闭</el-button>
</template>
</vk-data-dialog>
<ManagerChangeLog ref="ManagerChangeLog"/>
<ArticleList ref="ArticleList"/>
<el-dialog
title="批量赠送报价次数"
:visible.sync="showMultiAddQuoteNum"
width="50%">
<el-row :gutter="10">
<el-col :span="20">
<el-select v-model="selectedList" placeholder="点击选择账号" style="width: 100%" multiple clearable
filterable>
<el-option
v-for="(item, index) in userList"
:key="item.value"
:label="item.nickname"
:value="item._id">
</el-option>
</el-select>
</el-col>
<el-col :span="4">
<el-button type="primary" @click="selectedList = userList.map(item => item._id)">全选</el-button>
</el-col>
</el-row>
<p style="margin-top: 2rem">请输入赠送报价次数</p>
<el-input-number v-model="sendNum" placeholder="请输入报价次数"/>
<div slot="footer" class="dialog-footer">
<el-button @click="showMultiAddQuoteNum = false">取 消</el-button>
<el-button type="primary" @click="multiAddQuoteNum">确 定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import ManagerChangeLog from "./components/ManagerChangeLog.vue";
import ArticleList from "./components/ArticleList.vue";
export default {
name: "index",
data() {
return {
showInfo: false,
info: null,
title: '',
infoColumns: [
{key: "company.companyName", title: "企业名称", type: "text"},
{key: "company.organization", title: "统一社会信用代码", type: "text"},
{key: "company.companyName", title: "公司所在地", type: "text"},
{key: "company.companyName", title: "详细地址", type: "text"},
{key: "company.mailAddress", title: "有效通信地址", type: "text"},
{key: "company.contactEmail", title: "有效邮箱地址", type: "text"},
{key: "company.companyAccount", title: "对公账号", type: "text"},
{key: "company.companyBankName", title: "开户行", type: "text"},
{key: "company.personAccount", title: "个人账号", type: "text"},
{key: "company.personBankName", title: "个人开户行", type: "text"},
{key: "company.accountName", title: "户名", type: "text"},
{key: "company.personBankName", title: "个人开户行", type: "text"},
{key: "company.organizationPath", title: "营业执照", type: "image"},
{key: "company.businessType", title: "经营类目", type: "text"},
{key: "company.invoiceInfo", title: "上开票资料", type: "image"},
{key: "company.taxType", title: "纳税人类型", type: "text"},
{key: "company.taxImage", title: "纳税人资格", type: "image"},
{key: "manager.personName", title: "代理人类型", type: "text"},
{
key: "manager.certType", title: "证件类型", type: "html", formatter: (val, row, column, index) => {
return `<div>${row.certType === 0 ? '身份证' : '护照'}</div>`;
}
},
{key: "manager.idCard", title: "代理人证件号", type: "text"},
{key: "manager.mobile", title: "代理人电话", type: "text"},
{key: "manager.headPhotoPath", title: "身份证正面", type: "image"},
{key: "manager.backgroundIdCardPath", title: "身份证反面", type: "image"},
],
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {
dcloud_appid: "",
type: 2
//allow_login_background : true,
},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
{key: "username", title: "用户名", type: "text", width: 160, mode: "%%"},
{key: "nickname", title: "昵称", type: "text", width: 140, mode: "%%"},
{key: "mobile", title: "手机号", type: "text", width: 140, mode: "%%"},
]
},
table1: {
// 表格数据请求地址
action: "admin/system/user/sys/getList",
// 表格字段显示规则
columns: [
// {key: "user.mobile", title: "手机号", type: "text", width: 120, defaultValue: ""},
{key: "company.companyName", title: "企业名称", type: "text"},
{key: "company.organization", title: "统一社会信用代码", type: "text"},
{key: "company.mailAddress", title: "有效通信地址", type: "text"},
{
key: "", title: "代理人", type: "html", formatter: (val, row, column, index) => {
let str
str = `<view>${row.manager.personName}</view>`
// str += `<view>${row.person.mobile}</view>`
return str;
}
},
{key: "authTime", title: "认证时间", type: "time", width: 160, sortable: "custom"},
{
key: "authStatus", title: "认证状态", type: "tag", data: [
{value: 0, label: "未认证", tagType: "warning"},
{value: 1, label: "已认证", tagType: "success"},
{value: 2, label: "认证失败", tagType: "danger"},
]
},
{key: "isCoop", title: "是否合作/联营单位", type: "html"},
{
key: "action", title: "操作", type: "html"
},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: "",
name: "index",
components: {ArticleList, ManagerChangeLog},
data() {
return {
showInfo: false,
showBusinessCardInfo: false,
showMultiAddQuoteNum: false,
selectedList: [],
userList: [],
sendNum: 0,
info: null,
title: '',
infoColumns: [
{
key: "userType", title: "用户类型", type: "html",
formatter: (val, row, column, index) => {
if (!val) return '平台交易功能用户'
else return '金久信签约宝、特产商城用户'
}
},
{key: "company.companyName", title: "企业名称", type: "text"},
{key: "company.organization", title: "统一社会信用代码", type: "text"},
{
key: "company.companyName",
title: "公司所在地",
type: "html",
formatter: (val, row, column, index) => {
const region = row.company.addressRegion
return `<div>${region.province.name}${region.city.name}${region.area.name}</div>`;
}
},
{key: "company.addressDetail", title: "详细地址", type: "text"},
{key: "company.mailAddress", title: "有效通信地址", type: "text"},
{key: "company.contactEmail", title: "有效邮箱地址", type: "text"},
{key: "company.mobile", title: "公司电话", type: "text"},
{key: "company.companyAccount", title: "对公账号", type: "text"},
{key: "company.companyBankName", title: "开户行", type: "text"},
{key: "company.personAccount", title: "个人账号", type: "text"},
{key: "company.personBankName", title: "个人开户行", type: "text"},
{key: "company.accountName", title: "户名", type: "text"},
{key: "merNo", title: "企业用户号", type: "text"},
{key: "company.personBankName", title: "个人开户行", type: "text"},
{key: "company.organizationPath", title: "营业执照", type: "image"},
{key: "company.businessType", title: "行业分类", type: "text"},
{key: "company.mainSpotCategoryNames", title: "主营业务", type: "text"},
{key: "company.invoiceInfo", title: "开票资料", type: "image"},
{key: "company.taxType", title: "纳税人类型", type: "text"},
{
key: "isNotaryBusiness", title: "金久信公证业务", type: "select", data: [
{value: 0, label: '关闭'},
{value: 1, label: '开启'},
]
},
// {key: "company.taxImage", title: "纳税人资格", type: "image"},
{
key: "manager.type", title: "授权人类型", type: "select", data: [
{value: 1, label: '法人'},
{value: 2, label: '授权人'},
]
},
{
key: "manager.certType", title: "证件类型", type: "html", formatter: (val, row, column, index) => {
return `<div>${parseInt(val) === 0 ? '身份证' : '护照'}</div>`;
}
},
{key: "manager.idCard", title: "代理人证件号", type: "text"},
{key: "manager.mobile", title: "代理人电话", type: "text"},
{key: "manager.headPhotoPath", title: "身份证头像面", type: "image"},
{key: "manager.backgroundIdCardPath", title: "身份证国徽面", type: "image"},
],
businessColumns: [
{key: "businessCard.logo", title: "Logo", type: "image"},
{key: "businessCard.personalWechat", title: "个人微信", type: "image"},
{key: "businessCard.companyWechat", title: "企业微信", type: "image"},
{key: "businessCard.companyMobile", title: "公司电话", type: "text"},
{key: "businessCard.managerMobile", title: "负责人电话", type: "text"},
{key: "businessCard.address", title: "地区", type: "address"},
{key: "businessCard.addressDetail", title: "详细地址", type: "text"},
{key: "businessCard.email", title: "邮箱", type: "text"},
{key: "businessCard.website", title: "网址", type: "text"},
{key: "businessCard.companyIntroduction", title: "企业简介", type: "editor"},
{
key: "businessCard.video", title: "视频", type: "html", formatter: (val, row, column, index) => {
let str
str = `<video src="${row.businessCard.video}" controls></video>`
// str += `<view>${row.person.mobile}</view>`
return str;
}
},
{key: "businessCard.album", title: "首页大图", type: "image"},
{key: "businessCard.productImageList", title: "产品展示", type: "image"},
{key: "businessCard.exampleImageList", title: "案例展示", type: "image"},
// {key: "map", title: "地图定位", type: "html", formatter: (val, row, column, index) => {
// let str
// str = `<view style="width: 100%; height: 300px">
// <tdt-map :center="[${row.businessCard.longitude}, ${row.businessCard.latitude}]" :zoom="12">
// <tdt-marker :position="[${row.businessCard.longitude}, ${row.businessCard.latitude}]" :draggable="false"/>
// </tdt-map>
// </view>`
// return str;
// }
// },
],
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {
dcloud_appid: "",
type: 2,
isSignOnly: false
//allow_login_background : true,
},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
// {key: "username", title: "用户名", type: "text", width: 160, mode: "%%"},
{key: "nickname", title: "昵称", type: "text", width: 140, mode: "%%"},
{key: "mobile", title: "手机号", type: "text", width: 140, mode: "%%"},
{key: "address", title: "省份筛选", type: "address", width: 300, mode: "%%", level: 1},
{
key: "authStatus", title: "审核筛选", type: "select", width: 150, data: [
{value: 0, label: '待审核'},
{value: 1, label: '已通过'},
]
},
{
key: "businessCard.status", title: "名片审核筛选", type: "select", width: 150, data: [
{value: 0, label: '待审核'},
{value: 1, label: '已通过'},
]
},
]
},
table1: {
// 表格数据请求地址
action: "admin/system/user/sys/getList",
// 表格字段显示规则
columns: [
// {key: "user.mobile", title: "手机号", type: "text", width: 120, defaultValue: ""},
{key: "company.companyName", title: "企业名称", type: "text", width: 200, fixed: 'left'},
{key: "company.organization", title: "统一社会信用代码", type: "text", width: 200},
{key: "company.mailAddress", title: "有效通信地址", type: "text", width: 200},
{key: "mobile", title: "手机号", type: "text", width: 150},
{
key: "", title: "授权人", type: "html", formatter: (val, row, column, index) => {
let str
str = `<view>${row.manager.personName}</view>`
// str += `<view>${row.person.mobile}</view>`
return str;
}
}
},
methods: {
search() {
this.$refs.table1.query();
},
async refuse(id) {
const {action, value} = await this.$prompt('拒绝理由', {
showInput: true
});
if (action === 'confirm') {
this.changeStatus(id, 2, value)
}
},
changeStatus(id, authStatus, refuseReason = null) {
vk.callFunction({
url: 'admin/system/user/sys/changeStatus',
data: {
id, authStatus, refuseReason
}
}).then(() => {
this.$refs.table1.refresh()
})
},
doShowInfo(info) {
this.info = info
this.title = '详情'
this.showInfo = true
},
changeIsCoop(id) {
vk.callFunction({
url: 'admin/system/user/sys/changeCoop',
data: {
id
}
}).then(() => {
this.$refs.table1.refresh()
})
},
},
{key: "authSubmitTime", title: "认证提交时间", type: "time", width: 160, sortable: "custom"},
// {
// key: "authType", title: "认证类型", type: "html", defaultValue: "",
// formatter: (val, row, column, index) => {
// return `<view>${val === 1 ? "法大大认证" : "平台认证"}</view>`;
// }
// },
{
key: "authStatus", title: "认证状态", type: "tag", data: [
{value: -1, label: "未认证", tagType: "warning"},
{value: 0, label: "认证中", tagType: "warning"},
{value: 1, label: "已认证", tagType: "success"},
{value: 2, label: "认证失败", tagType: "danger"},
]
},
{
key: "businessCard.status", title: "名片审核状态", type: "select", width: 200, data: [
{value: 0, label: "审核中", tagType: "warning"},
{value: 1, label: "已审核", tagType: "success"},
{value: 2, label: "审核失败", tagType: "danger"},
]
},
{key: "isCoop", title: "是否合作商", type: "html", width: 140},
{
key: "showInYellow", title: "是否在黄页显示", type: "html", width: 140
},
{
key: "isCompanyQuote", title: "是否考察商", type: "html", width: 140
},
{
key: "isProductQuote", title: "是否检测商", type: "html", width: 140
},
{
key: "isCostQuote", title: "是否造价询价商", type: "html", width: 140
},
{
key: "isNotaryBusiness", title: "金久信公证业务", type: "html", width: 160
},
{
key: "settleRate", title: "结算比例", type: "html", width: 150
},
{
key: "company.addressRegion", title: "权限区域", type: "address", width: 230
},
{
key: "remainQuoteNum", title: "报价次数", type: "html", width: 300
},
{
key: "mid", title: "商户号", type: "html", width: 300
},
{
key: "merNo", title: "企业用户号", type: "html", width: 300
},
{
key: "tid", title: "终端号", type: "html", width: 300
},
{
key: "action", title: "操作", type: "html",
width: 200,
fixed: 'right'
},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: "",
}
}
},
methods: {
search() {
this.$refs.table1.query();
},
async refuse(id) {
const {action, value} = await this.$prompt('拒绝理由', {
showInput: true
});
if (action === 'confirm') {
this.changeStatus(id, 2, value)
}
},
changeStatus(id, authStatus, refuseReason = null) {
vk.callFunction({
url: 'admin/system/user/sys/changeStatus',
data: {
id, authStatus, refuseReason
}
}).then(() => {
this.$refs.table1.refresh()
})
},
doShowInfo(info) {
this.info = info
this.title = '详情'
this.showInfo = true
},
doShowBusinessCardInfo(info) {
this.info = info
this.title = '名片详情'
this.showBusinessCardInfo = true
},
changeIsCoop(id) {
vk.callFunction({
url: 'admin/system/user/sys/changeCoop',
data: {
id
}
}).then(() => {
this.$refs.table1.refresh()
})
},
changeShowInYellow(id) {
vk.callFunction({
url: 'admin/system/user/sys/changeShowInYellow',
data: {
id
}
}).then(() => {
this.$refs.table1.refresh()
})
},
async cardRefuse(id) {
const {action, value} = await this.$prompt('拒绝理由', {
showInput: true
});
if (action === 'confirm') {
this.cardChangeStatus(id, 2, value)
}
},
cardChangeStatus(id, status, refuseReason = null) {
vk.callFunction({
url: 'admin/system/user/sys/changeCardStatus',
data: {
id, status, refuseReason
}
}).then(() => {
this.$refs.table1.refresh()
})
},
changeArea(permissionArea, id) {
this.changeField(id, 'permissionArea', permissionArea)
},
changeQuoteNum(value, id) {
this.changeField(id, 'remainQuoteNum', value)
},
changeField(id, field, value) {
vk.callFunction({
url: 'admin/system/user/sys/changeField',
data: {
id, field, value
}
}).then(() => {
this.$refs.table1.refresh()
})
},
doManagerChangeLog({_id}) {
this.$refs.ManagerChangeLog.open(_id)
},
showArticle({_id}) {
this.$refs.ArticleList.open(_id)
},
async getUserList() {
const {rows} = await vk.callFunction({
url: 'admin/system/user/sys/getList',
data: {type: 2, pageSize: 500}
})
this.userList = rows.filter(item => item.company && item.company.companyName !== '' && item.company.companyName)
},
async multiAddQuoteNum() {
if (!this.sendNum) return this.$message.error('请输入赠送报价次数')
if (this.selectedList.length === 0) return this.$message.error('请选择要赠送的报价用户')
await vk.callFunction({
url: 'admin/system/user/sys/multiSendQuoteNum',
data: {
list: this.selectedList,
sendNum: this.sendNum
}
})
this.selectedList = []
this.$message.success('赠送成功')
this.showMultiAddQuoteNum = false
this.$refs.table1.refresh()
}
},
onLoad() {
this.getUserList()
}
}
</script>
</script>
<style scoped>
.mapDiv {
width: 100%;
height: 300px;
}
</style>
+574
View File
@@ -0,0 +1,574 @@
<template>
<view class="page-body">
<view class="overview-card">
<view class="overview-header">
<view class="summary-main">
<view class="summary-label">总余额</view>
<view class="summary-amount">¥{{ formatMoney(totalBalance) }}</view>
<view class="summary-time" v-if="balanceInfo.updateTime">最近更新时间:{{ balanceInfo.updateTime }}</view>
</view>
<el-button type="text" class="toggle-button" @click="toggleMerchantList">
{{ merchantExpanded ? "收起明细" : "展开明细" }}
</el-button>
</view>
<view class="merchant-list" v-show="merchantExpanded">
<view class="merchant-row" v-for="item in balanceInfoList" :key="item.accNo">
<view class="merchant-info">
<view class="merchant-name">{{ item.merchantName }}</view>
<view class="merchant-meta">{{ item.accNo }}</view>
<view class="merchant-meta" v-if="item.updateTime">更新时间:{{ item.updateTime }}</view>
</view>
<view class="merchant-side">
<view class="merchant-balance">¥{{ formatMoney(item.balance) }}</view>
<view class="summary-actions">
<el-button size="small" :loading="balanceQuery[item.accNo]" @click="queryBalance(item)">查询余额</el-button>
<el-button type="warning" size="small" icon="el-icon-wallet"
:disabled="Number(item.balance || 0) <= 0"
@click="openWithdrawDialog(item)">提现</el-button>
</view>
</view>
</view>
</view>
</view>
<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"
@search="search"></vk-data-table-query>
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
:pagination="true"
@current-change="currentChange"
@selection-change="selectionChange">
<template v-slot:action="{ row }">
<el-button v-if="row.srcReqId" type="primary" size="mini" @click="queryActionLog(row)">查询状态</el-button>
</template>
</vk-data-table>
<el-dialog title="提现" :visible.sync="withdrawDialog.show" width="520px" :close-on-click-modal="false">
<el-form label-width="90px">
<el-form-item label="提现企业">
<view class="withdraw-company">{{ withdrawDialog.form.merchantName || "-" }}</view>
</el-form-item>
<el-form-item label="提现账号">
<view class="withdraw-company">{{ withdrawDialog.form.merchantId || "-" }}</view>
</el-form-item>
<el-form-item label="当前余额">
<view class="withdraw-balance">¥{{ formatMoney(withdrawDialog.form.balance) }}</view>
</el-form-item>
<el-form-item label="提现金额" required>
<el-input-number v-model="withdrawDialog.form.amount" :min="0" :precision="2" :step="100"
controls-position="right" style="width: 100%;"></el-input-number>
</el-form-item>
<el-form-item label="说明">
<el-input v-model="withdrawDialog.form.description" type="textarea" :rows="4" maxlength="100"
show-word-limit placeholder="请输入提现说明"></el-input>
</el-form-item>
</el-form>
<template v-slot:footer>
<el-button @click="withdrawDialog.show = false">取消</el-button>
<el-button type="primary" :loading="withdrawDialog.loading" @click="submitWithdraw">确认提现</el-button>
</template>
</el-dialog>
</view>
</template>
<script>
var that;
var vk = uni.vk;
const typeData = [
{ value: "income", label: "收入" },
{ value: "expense", label: "支出" }
];
const merchantOptions = [
{ value: "zg000002466577", accNo: "zg000002466577", label: "广西金久信电子商务有限公司" },
{ value: "zg000002460927", accNo: "zg000002460927", label: "南宁亿利通钢管有限公司" },
{ value: "zg000002494918", accNo: "zg000002494918", label: "广西冀旺贸易有限公司" },
{ value: "zg000002459804", accNo: "zg000002459804", label: "广西金久信电子商务有限公司" }
];
export default {
computed: {
totalBalance() {
return this.balanceInfoList.reduce((total, item) => {
return total + Number(item.balance || 0);
}, 0);
}
},
data() {
return {
loading: false,
data: {},
merchantOptions,
balanceInfo: {
balance: 0,
updateTime: ""
},
merchantExpanded: true,
balanceInfoList: merchantOptions.map(item => ({
accNo: item.accNo,
merchantName: item.label,
balance: 0,
updateTime: ""
})),
table1: {
action: "admin/finance/balance/sys/getList",
columns: [
{
key: "description",
title: "说明",
type: "text",
align: "left",
minWidth: 240
},
{
key: "type",
title: "类型",
type: "select",
width: 120,
data: typeData
},
{
key: "amount",
title: "金额",
type: "text",
width: 140,
formatter: (val, row) => {
const sign = row.type === "income" ? "+" : "-";
return `${sign}¥${that.formatMoney(val)}`;
}
},
{
key: "logTime",
title: "时间",
type: "time",
width: 180,
sortable: "custom"
},
{
key: "_add_time",
title: "创建时间",
type: "time",
width: 180,
sortable: "custom"
},
{
key: "status",
title: "状态",
type: "text",
width: 120,
formatter: (val) => {
return that.formatStatus(val);
}
},
{
key: "action",
title: "操作",
type: "html",
width: 140
}
],
multipleSelection: [],
selectItem: ""
},
queryForm1: {
formData: {},
columns: [
{
key: "type",
title: "类型",
type: "select",
mode: "=",
data: typeData
},
{
key: "logTime",
title: "时间",
type: "datetimerange",
width: 380,
mode: "[]"
}
]
},
withdrawDialog: {
show: false,
loading: false,
form: {
merchantId: "",
merchantName: "",
balance: 0,
amount: 0,
description: ""
}
},
balanceQuery: merchantOptions.reduce((map, item) => {
map[item.accNo] = false;
return map;
}, {})
};
},
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
methods: {
init() {
that.getBalanceSummary();
},
search() {
that.$refs.table1.search();
that.getBalanceSummary();
},
refresh() {
that.$refs.table1.refresh();
that.getBalanceSummary();
},
toggleMerchantList() {
that.merchantExpanded = !that.merchantExpanded;
},
currentChange(val) {
that.table1.selectItem = val;
},
selectionChange(list) {
that.table1.multipleSelection = list;
},
async getBalanceSummary() {
const { data = {} } = await vk.callFunction({
url: "admin/finance/balance/sys/getSummary",
data: {}
});
that.balanceInfo = {
balance: 0,
updateTime: data.updateTime || ""
};
const serverList = Array.isArray(data.balanceInfoList) ? data.balanceInfoList : [];
const serverMap = serverList.reduce((map, item) => {
map[item.accNo] = item;
return map;
}, {});
that.balanceInfoList = merchantOptions.map(item => {
const current = serverMap[item.accNo] || {};
return {
accNo: item.accNo,
merchantName: current.merchantName || item.label,
balance: Number(current.balance || 0),
updateTime: current.updateTime || ""
};
});
},
async queryBalance(item) {
const accNo = item && item.accNo;
if (!accNo) {
vk.toast("未配置提现账号");
return;
}
that.balanceQuery[accNo] = true;
try {
await vk.callFunction({
url: "admin/finance/balance/sys/getInfo",
data: {
accNo
}
});
await that.getBalanceSummary();
vk.toast(`${item.merchantName}余额已更新`);
} finally {
that.balanceQuery[accNo] = false;
}
},
openWithdrawDialog(item) {
if (Number(item.balance || 0) <= 0) {
vk.toast("当前企业余额小于等于0,无法提现");
return;
}
that.withdrawDialog.form = {
merchantId: item.accNo,
merchantName: item.merchantName,
balance: Number(item.balance || 0),
amount: 0,
description: ""
};
that.withdrawDialog.show = true;
},
async queryActionLog(row) {
const accNo = String(row && (row.merchantId || row.accNo) || "").trim();
const reqJournalNo = String(row && row.srcReqId || "").trim();
const reqDate = that.formatReqDate(row && row._add_time);
if (!accNo) {
vk.toast("账号不能为空");
return;
}
if (!reqJournalNo) {
vk.toast("srcReqId不能为空");
return;
}
if (!reqDate) {
vk.toast("日期格式不正确");
return;
}
try {
const res = await vk.request({
method: "POST",
url: "http://jjx-union-pay.gxwebsoft.com/api/union-pay-jjx/getActionLog",
header: {
"content-type": "application/json; charset=utf-8"
},
data: {
accNo,
reqDate,
reqJournalNo
},
timeout: 60000
});
const code = Number(res && res.code);
const success = res && (
code === 0 ||
code === 200 ||
res.success === true ||
(typeof res.code === "undefined" && !res.msg && !res.message)
);
if (!success) {
throw new Error(
(res && (res.msg || res.message)) ||
(res && res.content && (res.content.msg || res.content.message)) ||
"查询状态失败"
);
}
const status = that.getActionStatusValue(res);
const statusText = that.formatStatus(status);
if (status !== "" && row && row._id) {
row.status = status;
}
vk.toast(statusText || "未识别到状态");
console.log("getActionLog", res);
} catch (err) {
vk.toast((err && err.message) || "查询状态失败");
}
},
async submitWithdraw() {
const { amount, description, merchantId, balance } = that.withdrawDialog.form;
if (!merchantId) {
vk.toast("提现账号不能为空");
return;
}
if (!amount || Number(amount) <= 0) {
vk.toast("提现金额必须大于0");
return;
}
if (Number(balance || 0) <= 0) {
vk.toast("当前企业余额小于等于0,无法提现");
return;
}
if (Number(amount) > Number(balance || 0)) {
vk.toast("提现金额不能大于当前企业余额");
return;
}
that.withdrawDialog.loading = true;
try {
await vk.callFunction({
url: "admin/finance/balance/sys/withdraw",
data: {
merchantId,
amount: Number(amount),
description
}
});
that.withdrawDialog.show = false;
that.refresh();
vk.toast("提现成功");
} finally {
that.withdrawDialog.loading = false;
}
},
formatMoney(value) {
const amount = Number(value || 0);
return amount.toFixed(2);
},
formatReqDate(value) {
const raw = value || "";
const date = typeof raw === "number"
? new Date(raw)
: new Date(String(raw).replace(/-/g, "/"));
if (Number.isNaN(date.getTime())) {
return "";
}
return vk.pubfn.timeFormat(date, "yyyyMMdd");
},
getActionStatusValue(res) {
const orderSet = this.pickOrderSet(res);
if (!orderSet) {
return "";
}
let orderList = [];
try {
orderList = JSON.parse(orderSet);
} catch (err) {
console.log("orderSet parse error", err, orderSet);
return "";
}
if (!Array.isArray(orderList) || !orderList.length) {
return "";
}
const firstOrder = orderList[0] || {};
const status = Number(firstOrder.status);
return Number.isFinite(status) ? status : "";
},
formatStatus(status) {
const statusMap = {
1: "处理中",
2: "成功",
3: "处理失败",
5: "退票",
6: "退票重提"
};
return statusMap[Number(status)] || "";
},
pickOrderSet(res) {
const candidates = [
res && res.orderSet,
res && res.data && res.data.orderSet,
res && res.info && res.info.orderSet,
res && res.content && res.content.orderSet,
res && res.data && Array.isArray(res.data) && res.data[0] && res.data[0].orderSet,
res && res.list && Array.isArray(res.list) && res.list[0] && res.list[0].orderSet,
res && res.rows && Array.isArray(res.rows) && res.rows[0] && res.rows[0].orderSet,
res && res.data && res.data.list && Array.isArray(res.data.list) && res.data.list[0] && res.data.list[0].orderSet,
res && res.data && res.data.rows && Array.isArray(res.data.rows) && res.data.rows[0] && res.data.rows[0].orderSet
];
for (let i = 0; i < candidates.length; i++) {
if (typeof candidates[i] === "string" && candidates[i]) {
return candidates[i];
}
}
return "";
}
}
};
</script>
<style lang="scss" scoped>
.page-body {
.overview-card {
display: flex;
flex-direction: column;
padding: 24rpx 32rpx;
margin-bottom: 24rpx;
border-radius: 16rpx;
background: linear-gradient(135deg, #fff7e6 0%, #fff1d6 100%);
border: 1px solid #f7d8a8;
}
.overview-header {
width: 100%;
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 24rpx;
padding-bottom: 24rpx;
margin-bottom: 24rpx;
border-bottom: 1px solid rgba(194, 106, 0, 0.12);
}
.toggle-button {
flex-shrink: 0;
padding: 0;
}
.merchant-list {
display: flex;
flex-direction: column;
gap: 20rpx;
width: 100%;
}
.merchant-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 24rpx;
padding: 20rpx 0;
border-bottom: 1px solid rgba(194, 106, 0, 0.12);
}
.merchant-row:last-child {
padding-bottom: 0;
border-bottom: none;
}
.merchant-info {
min-width: 0;
flex: 1;
}
.merchant-side {
display: flex;
flex-direction: column;
align-items: flex-end;
gap: 12rpx;
flex-shrink: 0;
}
.summary-main {
display: flex;
flex-direction: column;
gap: 8rpx;
}
.summary-actions {
display: flex;
align-items: center;
gap: 16rpx;
flex-shrink: 0;
}
.summary-label {
font-size: 26rpx;
color: #8c6b2f;
}
.merchant-name {
font-size: 28rpx;
font-weight: 600;
color: #8c6b2f;
}
.merchant-meta {
font-size: 24rpx;
color: #9f8252;
word-break: break-all;
}
.summary-amount {
font-size: 52rpx;
line-height: 1.1;
font-weight: 700;
color: #c26a00;
}
.merchant-balance {
font-size: 34rpx;
line-height: 1.1;
font-weight: 700;
color: #c26a00;
}
.summary-time {
font-size: 24rpx;
color: #9f8252;
}
.withdraw-balance {
font-size: 32rpx;
font-weight: 600;
color: #c26a00;
}
.withdraw-company {
color: #8c6b2f;
word-break: break-all;
}
}
</style>
+59
View File
@@ -188,6 +188,65 @@
// children: "children"
// },
// },
{
key: "ad", title: "广告位", type: "array<object>", itemWidth: 260,
showAdd: true,
showClear: true,
// 新增一行时,该行的默认值
defaultValue: {
pos: null
},
rightBtns: ['delete'],
// 每行每个字段对应的渲染规则
columns: [
{
key: "adKey",
title: "广告位",
type: "select",
placeholder: "请选择广告位",
data: [
{value: 27, label: "特产商城广告位1"},
{value: 28, label: "特产商城广告位2"},
{value: 29, label: "特产商城广告位3"},
{value: 30, label: "特产商城广告位4"},
{value: 31, label: "特产商城广告位5"},
]
},
{
key: "swiper", title: "图片", type: "image", limit: 1,
rules: [
{required: true, message: "请上传轮播图", trigger: ["change", "blur"]},
]
},
{
key: "companyId",
title: "指定公司",
type: "remote-select",
showAll: true,
placeholder: "请选择指定公司",
action: "admin/system/user/sys/getList",
actionData: {
pageIndex: 1,
pageSize: 500,
type: 2
},
props: {
list: "rows",
value: "_id",
label: "name",
},
dataPreprocess: (list) => {
list = list.filter(item => (item.company && item.company.companyName && item.company.companyName !== ''))
list.map((item, index) => {
item.name = `${item.company.companyName}(${item.mobile})`
return item
});
return list;
}
},
]
},
{
key: "remark",
title: "备注",
+489 -365
View File
@@ -1,50 +1,56 @@
<template>
<view class="page-body">
<!-- 页面内容开始 -->
<view class="page-body">
<!-- 页面内容开始 -->
<!-- 表格搜索组件开始 -->
<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"
@search="search"></vk-data-table-query>
<!-- 表格搜索组件结束 -->
<!-- 表格搜索组件开始 -->
<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"
@search="search"></vk-data-table-query>
<!-- 表格搜索组件结束 -->
<!-- 自定义按钮区域开始 -->
<view>
<el-row>
<el-button type="success" size="small" icon="el-icon-circle-plus-outline" @click="addBtn">添加
</el-button>
<!-- 批量操作 -->
<el-dropdown v-if="table1.multipleSelection" :split-button="false" trigger="click" @command="batchBtn">
<!-- <el-button type="danger" size="small" style="margin-left: 20rpx;"
:disabled="table1.multipleSelection.length === 0">
批量操作<i class="el-icon-arrow-down el-icon--right"></i>
</el-button> -->
<el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item :command="1">批量操作1</el-dropdown-item>
<el-dropdown-item :command="2">批量操作2</el-dropdown-item> -->
</el-dropdown-menu>
</el-dropdown>
</el-row>
</view>
<!-- 自定义按钮区域结束 -->
<!-- 表格组件开始 -->
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
:right-btns="['detail_auto','update','delete']" :default-expand-all="false" @update="updateBtn"
@delete="deleteBtn" @current-change="currentChange"
@selection-change="selectionChange"></vk-data-table>
<!-- 表格组件结束 -->
<!-- 添加或编辑的弹窗开始 -->
<vk-data-dialog v-model="form1.props.show" :title="form1.props.title" width="60%" mode="form"
:close-on-click-modal="false">
<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
:form-type="form1.props.formType" :columns='form1.props.columns' label-width="120px"
@success="form1.props.show = false;refresh();"></vk-data-form>
</vk-data-dialog>
<!-- 添加或编辑的弹窗结束 -->
<!-- 页面内容结束 -->
<!-- 自定义按钮区域开始 -->
<view>
<el-row>
<el-button type="success" size="small" icon="el-icon-circle-plus-outline" @click="addBtn">添加
</el-button>
<!-- 批量操作 -->
<el-dropdown v-if="table1.multipleSelection" :split-button="false" trigger="click" @command="batchBtn">
<!-- <el-button type="danger" size="small" style="margin-left: 20rpx;"
:disabled="table1.multipleSelection.length === 0">
批量操作<i class="el-icon-arrow-down el-icon--right"></i>
</el-button> -->
<el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item :command="1">批量操作1</el-dropdown-item>
<el-dropdown-item :command="2">批量操作2</el-dropdown-item> -->
</el-dropdown-menu>
</el-dropdown>
</el-row>
</view>
<!-- 自定义按钮区域结束 -->
<!-- 表格组件开始 -->
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
:right-btns="['detail_auto','update','delete']" :default-expand-all="false" @update="updateBtn"
@delete="deleteBtn" @current-change="currentChange"
@selection-change="selectionChange">
<template v-slot:recommend="{ row, column, index }">
<el-switch v-model="row.recommend" size="mini" @change="changeField(row._id, 'recommend', $event)"
:active-value="1"
:inactive-value="0"/>
</template>
</vk-data-table>
<!-- 表格组件结束 -->
<!-- 添加或编辑的弹窗开始 -->
<vk-data-dialog v-model="form1.props.show" :title="form1.props.title" width="60%" mode="form"
:close-on-click-modal="false">
<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
:form-type="form1.props.formType" :columns='form1.props.columns' label-width="120px"
@success="form1.props.show = false;refresh();"></vk-data-form>
</vk-data-dialog>
<!-- 添加或编辑的弹窗结束 -->
<!-- 页面内容结束 -->
</view>
</template>
<script>
@@ -53,336 +59,454 @@ var vk = uni.vk; // vk实例
var originalForms = {}; // 表单初始化数据
export default {
data() {
// 页面数据变量
return {
// 页面是否请求中或加载中
loading: false,
// init请求返回的数据
data: {},
// 表格相关开始 -----------------------------------------------------------
table1: {
// 表格数据请求地址
action: "admin/goods/list/sys/list",
// 表格字段显示规则
columns: [
// {
// key: "_id",
// title: "id",
// type: "text",
// width: 220
// },
{
key: "name",
title: "名称",
type: "text",
width: 220,
align: "left",
},
{
key: "cover",
title: "封面",
type: "text",
width: 220,
align: "left",
},
{
key: "desc",
title: "简介",
type: "text",
width: 220,
align: "left",
},
{
key: "amount",
title: "零售价",
type: "text",
width: 220,
align: "left",
},
{
key: "category.name",
title: "分类",
type: "text",
width: 220,
},
{
key: "address",
title: "地区",
type: "text",
width: 220,
},
{
key: "remark",
title: "备注",
type: "text",
align: "left",
width: 220
},
{
key: "viewNum",
title: "浏览量",
type: "text",
align: "left",
width: 220
},
{
key: "sort",
title: "排序",
type: "number",
align: "left",
width: 80,
},
{
key: "_add_time",
title: "添加时间",
type: "time",
align: "left",
width: 160,
sortable: "custom"
},
{
key: "_add_time",
title: "距离现在",
type: "dateDiff",
align: "left",
width: 120
},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: ""
data() {
// 页面数据变量
return {
// 页面是否请求中或加载中
loading: false,
// init请求返回的数据
data: {},
// 表格相关开始 -----------------------------------------------------------
table1: {
// 表格数据请求地址
action: "admin/goods/list/sys/list",
// 表格字段显示规则
columns: [
// {
// key: "_id",
// title: "id",
// type: "text",
// width: 220
// },
{
key: "name",
title: "名称",
type: "text",
width: 220,
align: "left",
},
{
key: "cover",
title: "封面",
type: "image",
width: 160,
align: "center",
},
// {
// key: "desc",
// title: "简介",
// type: "text",
// width: 220,
// align: "left",
// },
{
key: "amount",
title: "零售价",
type: "text",
// width: 220,
align: "left",
},
// {
// key: "category.name",
// title: "分类",
// type: "text",
// width: 100,
// },
{
key: "address",
title: "地区",
type: "address",
width: 220,
},
// {
// key: "remark",
// title: "备注",
// type: "text",
// align: "left",
// width: 220
// },
{
key: "viewNum",
title: "浏览量",
type: "text",
align: "left",
},
{
key: "recommend",
title: "是否平台推荐",
type: "html",
width: 180
},
{
key: "sort",
title: "排序",
type: "number",
align: "left",
width: 80,
},
{
key: "_add_time",
title: "添加时间",
type: "time",
align: "left",
width: 160,
sortable: "custom"
},
{
key: "_add_time_diff",
title: "距离现在",
type: "html",
align: "left",
width: 120,
formatter: (val, row) => vk.pubfn.dateDiff(row._add_time)
},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: ""
},
// 表格相关结束 -----------------------------------------------------------
// 表单相关开始 -----------------------------------------------------------
// 查询表单请求数据
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
{
key: "name",
title: "名称",
type: "text",
width: 160,
mode: "%%"
},
// {
// key: "parentId",
// title: "分类",
// type: "select",
// width: 160,
// action: "admin/goods/category/sys/list",
// props: {
// list: "rows",
// value: "_id",
// label: "name",
// children: "children"
// },
// },
{
key: "address",
title: "地区",
type: "address",
width: 160,
},
]
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
sort: 0,
amount: 0,
},
// 表单属性
props: {
// 表单请求地址
action: "",
// 表单字段显示规则
columns: [
{
key: "name",
title: "名称",
type: "text",
placeholder: "请输入名称"
},
// 表格相关结束 -----------------------------------------------------------
// 表单相关开始 -----------------------------------------------------------
// 查询表单请求数据
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
// {
// key: "name",
// title: "名称",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "remark",
// title: "备注",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "_add_time",
// title: "添加时间",
// type: "datetimerange",
// width: 400,
// mode: "[]"
// },
]
{
key: "desc",
title: "简介",
type: "text",
placeholder: "请输入简介"
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
sort: 0,
amount: 0,
{
key: "cover",
title: "封面",
type: "image",
limit: 1
},
{
key: "album",
title: "相册",
type: "image",
},
{
key: "video",
title: "视频",
type: "file",
limit: 1,
accept: ".mp4",
tips: '建议尺寸:1200*400'
},
{
key: "parentId",
title: "分类",
type: "tree-select",
placeholder: "请选择分类",
action: "admin/goods/category/sys/list",
props: {
list: "rows",
value: "_id",
label: "name",
children: "children"
},
},
{
key: "companyId",
title: "绑定公司",
type: "remote-select",
showAll: true,
placeholder: "请选择绑定公司",
action: "admin/system/user/sys/getList",
actionData: {
pageIndex: 1,
pageSize: 500,
type: 2
},
props: {
list: "rows",
value: "_id",
label: "name",
},
dataPreprocess: (list) => {
list = list.filter(item => (item.company && item.company.companyName && item.company.companyName !== ''))
list.map((item, index) => {
item.name = `${item.company.companyName}(${item.mobile})`
return item
});
return list;
}
},
{
key: "content", title: "内容", type: "editor", placeholder: "请输入内容"
},
{
key: "amount", title: "零售价", type: "number", placeholder: "请输入零售价",
},
{
key: "sku", title: "规格", type: "array<object>", itemWidth: 260,
showAdd: true,
showClear: true,
// 新增一行时,该行的默认值
defaultValue: {
label: ""
},
rightBtns: ['copy', 'delete'],
// 每行每个字段对应的渲染规则
columns: [
{
key: "image", title: "图片", type: "image", placeholder: "请上传图片", limit: 1,
rules: [
{required: true, message: "请上传图片", trigger: ["change", "blur"]},
]
},
// 表单属性
props: {
// 表单请求地址
action: "",
// 表单字段显示规则
columns: [
{
key: "name",
title: "名称",
type: "text",
placeholder: "请输入名称"
},
{
key: "desc",
title: "简介",
type: "text",
placeholder: "请输入简介"
},
{
key: "cover",
title: "封面",
type: "image",
limit: 1
},
{
key: "album",
title: "相册",
type: "image",
},
{
key: "parentId",
title: "分类",
type: "tree-select",
placeholder: "请选择分类",
action: "admin/goods/category/sys/list",
props: {
list: "rows",
value: "_id",
label: "name",
children: "children"
},
},
{
key: "content",
title: "内容",
type: "editor",
placeholder: "请输入内容"
},
{
key: "amount",
title: "零售价",
type: "text",
placeholder: "请输入零售价",
},
{
key: "address",
title: "所属地区",
type: "address",
placeholder: "请输入零售价",
},
{
key: "sort",
title: "排序",
type: "number",
precision: 0,
placeholder: "请输入排序值",
},
],
// 表单验证规则
rules: {
sort: [{
type: 'number',
message: '排序值必须为数字'
}],
name: [
{required: true, message: '分类名称不能为空', trigger: 'blur'},
],
},
// add 代表添加 update 代表修改
formType: "",
// 是否显示表单的弹窗
show: false
}
},
// 其他弹窗表单
formDatas: {},
// 表单相关结束 -----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {
},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {
},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {
},
// 函数
methods: {
// 页面数据初始化函数
init(options) {
originalForms["form1"] = vk.pubfn.copyObject(that.form1);
},
// 页面跳转
pageTo(path) {
vk.navigateTo(path);
},
// 表单重置
resetForm() {
vk.pubfn.resetForm(originalForms, that);
},
// 搜索
search() {
that.$refs.table1.search();
},
// 刷新
refresh() {
that.$refs.table1.refresh();
},
// 获取当前选中的行的数据
getCurrentRow() {
return that.$refs.table1.getCurrentRow();
},
// 监听 - 行的选中高亮事件
currentChange(val) {
that.table1.selectItem = val;
},
// 当选择项发生变化时会触发该事件
selectionChange(list) {
that.table1.multipleSelection = list;
},
// 显示添加页面
addBtn() {
that.resetForm();
that.form1.props.action = 'admin/goods/list/sys/add';
that.form1.props.formType = 'add';
that.form1.props.title = '添加';
that.form1.props.show = true;
},
// 显示修改页面
updateBtn({
item
}) {
that.form1.props.action = 'admin/goods/list/sys/update';
that.form1.props.formType = 'update';
that.form1.props.title = '编辑';
that.form1.props.show = true;
that.form1.data = item;
},
// 删除按钮
deleteBtn({
item,
deleteFn
}) {
deleteFn({
action: "admin/goods/list/sys/delete",
data: {
_id: item._id
{
key: "label", title: "规格名称", type: "text", placeholder: "输入规格名称",
rules: [
{required: true, message: "该项不能为空", trigger: ["change", "blur"]},
]
},
});
},
// 监听 - 批量操作的按钮点击事件
batchBtn(index) {
switch (index) {
case 1:
vk.toast("批量操作按钮1");
break;
case 2:
vk.toast("批量操作按钮2");
break;
default:
break;
}
{
key: "values", title: "金额", type: "number", placeholder: "输入金额",
rules: [
{required: true, message: "该项不能为空", trigger: ["change", "blur"]},
]
},
]
},
{
key: "address",
title: "所属地区",
type: "address",
placeholder: "请输入零售价",
},
{
key: "sort",
title: "排序",
type: "number",
precision: 0,
placeholder: "请输入排序值",
},
{
key: "recommend",
title: "是否平台推荐",
type: "switch",
activeValue: 1,
inactiveValue: 0,
activeText: '推荐',
inactiveText: '不推荐'
},
{
key: "express",
title: "快递单位",
type: "text",
placeholder: "",
},
{
key: "deliverDate",
title: "承诺发货时间",
type: "text",
placeholder: "",
},
{
key: "expressAmount",
title: "运费",
type: "number",
placeholder: "0为免运费",
},
{
key: "ensureService",
title: "质保服务",
type: "textarea",
placeholder: "",
},
],
// 表单验证规则
rules: {
sort: [{
type: 'number',
message: '排序值必须为数字'
}],
name: [
{required: true, message: '商品名称不能为空', trigger: 'blur'},
],
companyId: [
{required: true, message: '请选择绑定公司', trigger: 'blur'},
],
},
// add 代表添加 update 代表修改
formType: "",
// 是否显示表单的弹窗
show: false
}
},
// 其他弹窗表单
formDatas: {},
// 表单相关结束 -----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {
},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {
},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {
},
// 函数
methods: {
// 页面数据初始化函数
init(options) {
originalForms["form1"] = vk.pubfn.copyObject(that.form1);
},
// 监听属性
watch: {},
// 过滤器
filters: {},
// 计算属性
computed: {}
// 页面跳转
pageTo(path) {
vk.navigateTo(path);
},
// 表单重置
resetForm() {
vk.pubfn.resetForm(originalForms, that);
},
// 搜索
search() {
that.$refs.table1.search();
},
// 刷新
refresh() {
that.$refs.table1.refresh();
},
// 获取当前选中的行的数据
getCurrentRow() {
return that.$refs.table1.getCurrentRow();
},
// 监听 - 行的选中高亮事件
currentChange(val) {
that.table1.selectItem = val;
},
// 当选择项发生变化时会触发该事件
selectionChange(list) {
that.table1.multipleSelection = list;
},
// 显示添加页面
addBtn() {
that.resetForm();
that.form1.props.action = 'admin/goods/list/sys/add';
that.form1.props.formType = 'add';
that.form1.props.title = '添加';
that.form1.props.show = true;
},
// 显示修改页面
updateBtn({
item
}) {
that.form1.props.action = 'admin/goods/list/sys/update';
that.form1.props.formType = 'update';
that.form1.props.title = '编辑';
that.form1.props.show = true;
that.form1.data = item;
},
// 删除按钮
deleteBtn({
item,
deleteFn
}) {
deleteFn({
action: "admin/goods/list/sys/delete",
data: {
_id: item._id
},
});
},
// 监听 - 批量操作的按钮点击事件
batchBtn(index) {
switch (index) {
case 1:
vk.toast("批量操作按钮1");
break;
case 2:
vk.toast("批量操作按钮2");
break;
default:
break;
}
},
changeField(id, field, value) {
vk.callFunction({
url: 'admin/goods/list/sys/changeField',
data: {
id, field, value
}
}).then(() => {
this.$refs.table1.refresh()
})
},
},
// 监听属性
watch: {},
// 过滤器
filters: {},
// 计算属性
computed: {}
};
</script>
<style lang="scss" scoped>
.page-body {
}
</style>
</style>
+340
View File
@@ -0,0 +1,340 @@
<template>
<view class="page-body">
<!-- 页面内容开始 -->
<!-- 表格搜索组件开始 -->
<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"
@search="search"></vk-data-table-query>
<!-- 表格搜索组件结束 -->
<!-- 自定义按钮区域开始 -->
<view>
<el-row>
<el-button type="success" size="small" icon="el-icon-circle-plus-outline" @click="addBtn">添加</el-button>
<!-- 批量操作 -->
<el-dropdown v-if="table1.multipleSelection" :split-button="false" trigger="click" @command="batchBtn">
<!-- <el-button type="danger" size="small" style="margin-left: 20rpx;"
:disabled="table1.multipleSelection.length === 0">
批量操作<i class="el-icon-arrow-down el-icon--right"></i>
</el-button> -->
<el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item :command="1">批量操作1</el-dropdown-item>
<el-dropdown-item :command="2">批量操作2</el-dropdown-item> -->
</el-dropdown-menu>
</el-dropdown>
</el-row>
</view>
<!-- 自定义按钮区域结束 -->
<!-- 表格组件开始 -->
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
:right-btns="['detail_auto','update','delete']" :default-expand-all="false" @update="updateBtn" pagination
@delete="deleteBtn" @current-change="currentChange" @selection-change="selectionChange"></vk-data-table>
<!-- 表格组件结束 -->
<!-- 添加或编辑的弹窗开始 -->
<vk-data-dialog v-model="form1.props.show" :title="form1.props.title" width="60%" mode="form"
:close-on-click-modal="false">
<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
:form-type="form1.props.formType" :columns='form1.props.columns' label-width="120px"
@success="form1.props.show = false;refresh();"></vk-data-form>
</vk-data-dialog>
<!-- 添加或编辑的弹窗结束 -->
<!-- 页面内容结束 -->
</view>
</template>
<script>
var that; // 当前页面对象
var vk = uni.vk; // vk实例
var originalForms = {}; // 表单初始化数据
export default {
data() {
// 页面数据变量
return {
// 页面是否请求中或加载中
loading: false,
// init请求返回的数据
data: {
},
// 表格相关开始 -----------------------------------------------------------
table1: {
// 表格数据请求地址
action: "admin/industry/sys/getList",
// 表格字段显示规则
columns: [
// {
// key: "_id",
// title: "id",
// type: "text",
// width: 220
// },
{
key: "name",
title: "名称",
type: "text",
width: 220,
align: "left",
},
// {
// key: "parent_id",
// title: "上级id",
// type: "text",
// width: 220,
// },
{
key: "remark",
title: "备注",
type: "text",
align: "left",
width: 220
},
{
key: "sort",
title: "排序",
type: "number",
align: "left",
width: 80,
},
{
key: "_add_time",
title: "添加时间",
type: "time",
align: "left",
width: 160,
sortable: "custom"
},
{
key: "_add_time_diff",
title: "距离现在",
type: "html",
align: "left",
width: 120,
formatter: (val, row) => vk.pubfn.dateDiff(row._add_time)
},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: ""
},
// 表格相关结束 -----------------------------------------------------------
// 表单相关开始 -----------------------------------------------------------
// 查询表单请求数据
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {
},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
{
key: "name",
title: "名称",
type: "text",
width: 160,
mode: "%%"
},
// {
// key: "remark",
// title: "备注",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "_add_time",
// title: "添加时间",
// type: "datetimerange",
// width: 400,
// mode: "[]"
// },
]
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
sort: 0
},
// 表单属性
props: {
// 表单请求地址
action: "",
// 表单字段显示规则
columns: [{
key: "name",
title: "名称",
type: "text",
placeholder: "请输入分类名称"
},
// {
// key: "icon",
// title: "图标",
// type: "icon",
// placeholder: "请选择图标"
// },
// {
// key: "parent_id",
// title: "上级分类",
// type: "tree-select",
// placeholder: "请选择上级分类",
// action: "admin/spot/category/sys/getTree",
// props: {
// list: "rows",
// value: "_id",
// label: "name",
// children: "children"
// },
// },
{
key: "remark",
title: "备注",
type: "textarea",
maxlength: "99",
showWordLimit: true,
autosize: {
minRows: 2,
maxRows: 10
},
},
{
key: "sort",
title: "排序",
type: "number",
precision: 0,
placeholder: "请输入排序值",
tips: '数字越小越靠前'
},
],
// 表单验证规则
rules: {
sort: [{
type: 'number',
message: '排序值必须为数字'
}],
name:[
{ required:true, message:'分类名称不能为空', trigger:'blur' },
],
},
// add 代表添加 update 代表修改
formType: "",
// 是否显示表单的弹窗
show: false
}
},
// 其他弹窗表单
formDatas: {},
// 表单相关结束 -----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {},
// 函数
methods: {
// 页面数据初始化函数
init(options) {
originalForms["form1"] = vk.pubfn.copyObject(that.form1);
},
// 页面跳转
pageTo(path) {
vk.navigateTo(path);
},
// 表单重置
resetForm() {
vk.pubfn.resetForm(originalForms, that);
},
// 搜索
search() {
that.$refs.table1.search();
},
// 刷新
refresh() {
that.$refs.table1.refresh();
},
// 获取当前选中的行的数据
getCurrentRow() {
return that.$refs.table1.getCurrentRow();
},
// 监听 - 行的选中高亮事件
currentChange(val) {
that.table1.selectItem = val;
},
// 当选择项发生变化时会触发该事件
selectionChange(list) {
that.table1.multipleSelection = list;
},
// 显示添加页面
addBtn() {
that.resetForm();
that.form1.props.action = 'admin/industry/sys/add';
that.form1.props.formType = 'add';
that.form1.props.title = '添加';
that.form1.props.show = true;
},
// 显示修改页面
updateBtn({
item
}) {
that.form1.props.action = 'admin/industry/sys/update';
that.form1.props.formType = 'update';
that.form1.props.title = '编辑';
that.form1.props.show = true;
that.form1.data = item;
},
// 删除按钮
deleteBtn({
item,
deleteFn
}) {
deleteFn({
action: "admin/industry/sys/delete",
data: {
_id: item._id
},
});
},
// 监听 - 批量操作的按钮点击事件
batchBtn(index) {
switch (index) {
case 1:
vk.toast("批量操作按钮1");
break;
case 2:
vk.toast("批量操作按钮2");
break;
default:
break;
}
}
},
// 监听属性
watch: {
},
// 过滤器
filters: {
},
// 计算属性
computed: {
}
};
</script>
<style lang="scss" scoped>
.page-body {}
</style>
+110
View File
@@ -0,0 +1,110 @@
<template>
<div class="page-body">
<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns" @search="search"/>
<vk-data-table
ref="table1"
:action="table1.action"
:columns="table1.columns"
:query-form-param="queryForm1"
:pagination="true"
>
<template v-slot:action="{ row }">
<el-button size="mini" type="success" @click.native="changeStatus(row._id, 1)" v-if="row.profileStatus === 0 || row.profileStatus === 1">通过</el-button>
<el-button size="mini" type="danger" @click.native="refuse(row._id)" v-if="row.profileStatus === 0 || row.profileStatus === 1">拒绝</el-button>
</template>
<template v-slot:profileStatus="{ row }">
<el-tag v-if="row.profileStatus === 1" type="success">已通过</el-tag>
<el-tag v-else-if="row.profileStatus === 2" type="danger">已拒绝</el-tag>
<el-tag v-else-if="row.profileStatus === 0" type="warning">审核中</el-tag>
<el-tag v-else type="info">未提交</el-tag>
</template>
<template v-slot:files="{ row }">
<div v-if="row.notaryUnionPayProfile">
<div v-if="row.notaryUnionPayProfile.businessLicenseFile"><a href="javascript:;" @click="previewFile(row.notaryUnionPayProfile.businessLicenseFile)">营业执照</a></div>
<div v-if="row.notaryUnionPayProfile.legalIdCardFront"><a href="javascript:;" @click="previewFile(row.notaryUnionPayProfile.legalIdCardFront)">法人身份证正面</a></div>
<div v-if="row.notaryUnionPayProfile.legalIdCardBack"><a href="javascript:;" @click="previewFile(row.notaryUnionPayProfile.legalIdCardBack)">法人身份证反面</a></div>
</div>
</template>
</vk-data-table>
<el-dialog title="图片预览" :visible.sync="showImagePreview" width="80%" append-to-body>
<img v-if="previewImageUrl" class="preview-image" :src="previewImageUrl" alt="资料文件" @error="openPreviewFile"/>
</el-dialog>
</div>
</template>
<script>
export default {
data() {
return {
queryForm1: {
formData: {
onlyNotaryUnionPayProfile: true
},
columns: [
{key: 'nickname', title: '昵称', type: 'text', width: 160, mode: '%%'},
{key: 'mobile', title: '手机号', type: 'text', width: 160, mode: '%%'},
{key: 'profileStatus', title: '审核状态', type: 'select', width: 140, data: [
{value: -1, label: '未提交'},
{value: 0, label: '审核中'},
{value: 1, label: '已通过'},
{value: 2, label: '已拒绝'}
]}
]
},
table1: {
action: 'admin/system/user/sys/getList',
columns: [
{key: 'nickname', title: '昵称', type: 'text', width: 150},
{key: 'mobile', title: '手机号', type: 'text', width: 150},
{key: 'company.companyName', title: '企业名称', type: 'text', width: 220},
{key: 'profileStatus', title: '审核状态', type: 'html', width: 120},
{key: 'notaryUnionPayProfile.submitTime', title: '提交时间', type: 'text', width: 170},
{key: 'notaryUnionPayProfile.reviewTime', title: '审核时间', type: 'text', width: 170},
{key: 'files', title: '资料文件', type: 'html', width: 260},
{key: 'action', title: '操作', type: 'html', width: 200, fixed: 'right'}
]
},
showImagePreview: false,
previewImageUrl: ''
}
},
methods: {
search() {
this.$refs.table1.search()
},
changeStatus(id, status, refuseReason = null) {
vk.callFunction({
url: 'admin/system/user/sys/changeNotaryUnionPayProfileStatus',
data: {id, status, refuseReason}
}).then(() => {
this.$refs.table1.refresh()
})
},
refuse(id) {
this.$prompt('拒绝理由', {showInput: true}).then(({value, action}) => {
if (action === 'confirm') this.changeStatus(id, 2, value)
})
},
previewFile(url) {
if (!url) return
this.previewImageUrl = url
this.showImagePreview = true
},
openPreviewFile() {
const url = this.previewImageUrl
this.showImagePreview = false
this.previewImageUrl = ''
if (url) window.open(url, '_blank')
}
}
}
</script>
<style scoped>
.preview-image {
display: block;
max-width: 100%;
max-height: 75vh;
margin: 0 auto;
}
</style>
+344
View File
@@ -0,0 +1,344 @@
<template>
<view class="page-body">
<!-- 页面内容开始 -->
<!-- 表格搜索组件开始 -->
<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"
@search="search"></vk-data-table-query>
<!-- 表格搜索组件结束 -->
<!-- 自定义按钮区域开始 -->
<view>
<el-row>
<el-button type="success" size="small" icon="el-icon-circle-plus-outline" @click="addBtn">添加
</el-button>
<!-- 批量操作 -->
<el-dropdown v-if="table1.multipleSelection" :split-button="false" trigger="click" @command="batchBtn">
<!-- <el-button type="danger" size="small" style="margin-left: 20rpx;"
:disabled="table1.multipleSelection.length === 0">
批量操作<i class="el-icon-arrow-down el-icon--right"></i>
</el-button> -->
<el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item :command="1">批量操作1</el-dropdown-item>
<el-dropdown-item :command="2">批量操作2</el-dropdown-item> -->
</el-dropdown-menu>
</el-dropdown>
</el-row>
</view>
<!-- 自定义按钮区域结束 -->
<!-- 表格组件开始 -->
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
:right-btns="['detail_auto','update','delete']" :default-expand-all="false" @update="updateBtn"
@delete="deleteBtn" @current-change="currentChange"
@selection-change="selectionChange"></vk-data-table>
<!-- 表格组件结束 -->
<!-- 添加或编辑的弹窗开始 -->
<vk-data-dialog v-model="form1.props.show" :title="form1.props.title" width="60%" mode="form"
:close-on-click-modal="false">
<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
:form-type="form1.props.formType" :columns='form1.props.columns' label-width="120px"
@success="form1.props.show = false;refresh();"></vk-data-form>
</vk-data-dialog>
<!-- 添加或编辑的弹窗结束 -->
<!-- 页面内容结束 -->
</view>
</template>
<script>
var that; // 当前页面对象
var vk = uni.vk; // vk实例
var originalForms = {}; // 表单初始化数据
export default {
data() {
// 页面数据变量
return {
// 页面是否请求中或加载中
loading: false,
// init请求返回的数据
data: {},
// 表格相关开始 -----------------------------------------------------------
table1: {
// 表格数据请求地址
action: "admin/notice/list/sys/list",
// 表格字段显示规则
columns: [
// {
// key: "_id",
// title: "id",
// type: "text",
// width: 220
// },
{
key: "name",
title: "名称",
type: "text",
width: 220,
align: "left",
},
{
key: "address",
title: "区域",
type: "address",
width: 220,
},
// {
// key: "content",
// title: "内容",
// type: "html",
// },
{
key: "cover",
title: "封面",
type: "image",
},
{
key: "viewNum",
title: "浏览量",
type: "text",
align: "left",
width: 220
},
{
key: "sort",
title: "排序",
type: "number",
align: "left",
width: 80,
},
{
key: "_add_time",
title: "添加时间",
type: "time",
align: "left",
width: 160,
sortable: "custom"
},
{
key: "_add_time",
title: "距离现在",
type: "dateDiff",
align: "left",
width: 120
},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: ""
},
// 表格相关结束 -----------------------------------------------------------
// 表单相关开始 -----------------------------------------------------------
// 查询表单请求数据
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
// {
// key: "name",
// title: "名称",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "remark",
// title: "备注",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "_add_time",
// title: "添加时间",
// type: "datetimerange",
// width: 400,
// mode: "[]"
// },
]
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
sort: 0,
amount: 0,
},
// 表单属性
props: {
// 表单请求地址
action: "",
// 表单字段显示规则
columns: [
{
key: "name",
title: "名称",
type: "text",
placeholder: "请输入名称"
},
{
key: "cover",
title: "封面",
type: "image",
},
{
key: "address",
title: "区域",
type: "address",
placeholder: "请输入名称"
},
{
key: "content",
title: "内容",
type: "editor",
placeholder: "请输入内容"
},
{
key: "remark",
title: "备注",
type: "textarea",
maxlength: "99",
showWordLimit: true,
autosize: {
minRows: 2,
maxRows: 10
},
},
{
key: "sort",
title: "排序",
type: "number",
precision: 0,
placeholder: "请输入排序值",
},
],
// 表单验证规则
rules: {
sort: [{
type: 'number',
message: '排序值必须为数字'
}],
name: [
{required: true, message: '分类名称不能为空', trigger: 'blur'},
],
},
// add 代表添加 update 代表修改
formType: "",
// 是否显示表单的弹窗
show: false
}
},
// 其他弹窗表单
formDatas: {},
// 表单相关结束 -----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {
},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {
},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {
},
// 函数
methods: {
// 页面数据初始化函数
init(options) {
originalForms["form1"] = vk.pubfn.copyObject(that.form1);
},
// 页面跳转
pageTo(path) {
vk.navigateTo(path);
},
// 表单重置
resetForm() {
vk.pubfn.resetForm(originalForms, that);
},
// 搜索
search() {
that.$refs.table1.search();
},
// 刷新
refresh() {
that.$refs.table1.refresh();
},
// 获取当前选中的行的数据
getCurrentRow() {
return that.$refs.table1.getCurrentRow();
},
// 监听 - 行的选中高亮事件
currentChange(val) {
that.table1.selectItem = val;
},
// 当选择项发生变化时会触发该事件
selectionChange(list) {
that.table1.multipleSelection = list;
},
// 显示添加页面
addBtn() {
that.resetForm();
that.form1.props.action = 'admin/notice/list/sys/add';
that.form1.props.formType = 'add';
that.form1.props.title = '添加';
that.form1.props.show = true;
},
// 显示修改页面
updateBtn({
item
}) {
that.form1.props.action = 'admin/notice/list/sys/update';
that.form1.props.formType = 'update';
that.form1.props.title = '编辑';
that.form1.props.show = true;
that.form1.data = item;
},
// 删除按钮
deleteBtn({
item,
deleteFn
}) {
deleteFn({
action: "admin/notice/list/sys/delete",
data: {
_id: item._id
},
});
},
// 监听 - 批量操作的按钮点击事件
batchBtn(index) {
switch (index) {
case 1:
vk.toast("批量操作按钮1");
break;
case 2:
vk.toast("批量操作按钮2");
break;
default:
break;
}
}
},
// 监听属性
watch: {},
// 过滤器
filters: {},
// 计算属性
computed: {}
};
</script>
<style lang="scss" scoped>
.page-body {
}
</style>
+368
View File
@@ -0,0 +1,368 @@
<template>
<view class="page-body">
<!-- 页面内容开始 -->
<!-- 表格搜索组件开始 -->
<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"
@search="search"></vk-data-table-query>
<!-- 表格搜索组件结束 -->
<!-- 自定义按钮区域开始 -->
<view>
<el-row>
<el-button type="success" size="small" icon="el-icon-circle-plus-outline" @click="addBtn">添加
</el-button>
<!-- 批量操作 -->
<el-dropdown v-if="table1.multipleSelection" :split-button="false" trigger="click" @command="batchBtn">
<!-- <el-button type="danger" size="small" style="margin-left: 20rpx;"
:disabled="table1.multipleSelection.length === 0">
批量操作<i class="el-icon-arrow-down el-icon--right"></i>
</el-button> -->
<el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item :command="1">批量操作1</el-dropdown-item>
<el-dropdown-item :command="2">批量操作2</el-dropdown-item> -->
</el-dropdown-menu>
</el-dropdown>
</el-row>
</view>
<!-- 自定义按钮区域结束 -->
<!-- 表格组件开始 -->
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
:right-btns="['detail_auto','update','delete']" :default-expand-all="false" @update="updateBtn"
@delete="deleteBtn" @current-change="currentChange"
@selection-change="selectionChange"></vk-data-table>
<!-- 表格组件结束 -->
<!-- 添加或编辑的弹窗开始 -->
<vk-data-dialog v-model="form1.props.show" :title="form1.props.title" width="60%" mode="form"
:close-on-click-modal="false">
<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
:form-type="form1.props.formType" :columns='form1.props.columns' label-width="120px"
@success="form1.props.show = false;refresh();"></vk-data-form>
</vk-data-dialog>
<!-- 添加或编辑的弹窗结束 -->
<!-- 页面内容结束 -->
</view>
</template>
<script>
var that; // 当前页面对象
var vk = uni.vk; // vk实例
var originalForms = {}; // 表单初始化数据
export default {
data() {
// 页面数据变量
return {
// 页面是否请求中或加载中
loading: false,
// init请求返回的数据
data: {
},
// 表格相关开始 -----------------------------------------------------------
table1: {
// 表格数据请求地址
action: "admin/old/category/sys/getTree",
// 表格字段显示规则
columns: [
// {
// key: "_id",
// title: "id",
// type: "text",
// width: 220
// },
{
key: "name",
title: "名称",
type: "text",
width: 220,
align: "left",
},
// {
// key: "parent_id",
// title: "上级id",
// type: "text",
// width: 220,
// },
{
key: "remark",
title: "备注",
type: "text",
align: "left",
width: 220
},
{
key: "sort",
title: "排序",
type: "number",
align: "left",
width: 80,
},
{
key: "_add_time",
title: "添加时间",
type: "time",
align: "left",
width: 160,
sortable: "custom"
},
{
key: "_add_time",
title: "距离现在",
type: "dateDiff",
align: "left",
width: 120
},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: ""
},
// 表格相关结束 -----------------------------------------------------------
// 表单相关开始 -----------------------------------------------------------
// 查询表单请求数据
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {
type: 0
},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
// {
// key: "name",
// title: "名称",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "remark",
// title: "备注",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "_add_time",
// title: "添加时间",
// type: "datetimerange",
// width: 400,
// mode: "[]"
// },
]
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
type: 0
},
// 表单属性
props: {
// 表单请求地址
action: "",
// 表单字段显示规则
columns: [
{
key: "name",
title: "名称",
type: "text",
placeholder: "请输入分类名称"
},
// {
// key: "icon",
// title: "图标",
// type: "icon",
// placeholder: "请选择图标"
// },
{
key: "parent_id",
title: "上级分类",
type: "tree-select",
placeholder: "请选择上级分类",
action: (obj={})=>{
let {
success, // 成功回调
fail, // 失败回调
complete, // 成功回调
} = obj;
// 发起http请求
vk.callFunction({
url: `admin/old/category/sys/getTree`,
data: {type: 0, level: 0},
success: (res) => {
if (typeof success === "function") {
success({
rows: res.rows
});
}
},
fail: (res) => {
if (typeof fail === "function") fail(res);
},
complete: (res) => {
if (typeof complete === "function") complete(res);
}
});
},
props: {
list: "rows",
value: "_id",
label: "name",
children: "children"
},
},
{
key: "remark",
title: "备注",
type: "textarea",
maxlength: "99",
showWordLimit: true,
autosize: {
minRows: 2,
maxRows: 10
},
},
{
key: "sort",
title: "排序",
type: "number",
precision: 0,
placeholder: "请输入排序值",
},
],
// 表单验证规则
rules: {
sort: [
{
type: 'number',
message: '排序值必须为数字'
}
],
name: [
{required: true, message: '分类名称不能为空', trigger: 'blur'},
],
type: [
{required: true, message: '请选择类型', trigger: 'blur'},
],
},
// add 代表添加 update 代表修改
formType: "",
// 是否显示表单的弹窗
show: false
}
},
// 其他弹窗表单
formDatas: {},
// 表单相关结束 -----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {
},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {
},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {
},
// 函数
methods: {
// 页面数据初始化函数
init(options) {
originalForms["form1"] = vk.pubfn.copyObject(that.form1);
},
// 页面跳转
pageTo(path) {
vk.navigateTo(path);
},
// 表单重置
resetForm() {
vk.pubfn.resetForm(originalForms, that);
},
// 搜索
search() {
that.$refs.table1.search();
},
// 刷新
refresh() {
that.$refs.table1.refresh();
},
// 获取当前选中的行的数据
getCurrentRow() {
return that.$refs.table1.getCurrentRow();
},
// 监听 - 行的选中高亮事件
currentChange(val) {
that.table1.selectItem = val;
},
// 当选择项发生变化时会触发该事件
selectionChange(list) {
that.table1.multipleSelection = type_0;
},
// 显示添加页面
addBtn() {
that.resetForm();
that.form1.props.action = 'admin/old/category/sys/add';
that.form1.props.formType = 'add';
that.form1.props.title = '添加';
that.form1.props.show = true;
},
// 显示修改页面
updateBtn({
item
}) {
that.form1.props.action = 'admin/old/category/sys/update';
that.form1.props.formType = 'update';
that.form1.props.title = '编辑';
that.form1.props.show = true;
that.form1.data = item;
},
// 删除按钮
deleteBtn({
item,
deleteFn
}) {
deleteFn({
action: "admin/old/category/sys/delete",
data: {
_id: item._id
},
});
},
// 监听 - 批量操作的按钮点击事件
batchBtn(index) {
switch (index) {
case 1:
vk.toast("批量操作按钮1");
break;
case 2:
vk.toast("批量操作按钮2");
break;
default:
break;
}
}
},
// 监听属性
watch: {},
// 过滤器
filters: {},
// 计算属性
computed: {}
};
</script>
<style lang="scss" scoped>
.page-body {
}
</style>
+368
View File
@@ -0,0 +1,368 @@
<template>
<view class="page-body">
<!-- 页面内容开始 -->
<!-- 表格搜索组件开始 -->
<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"
@search="search"></vk-data-table-query>
<!-- 表格搜索组件结束 -->
<!-- 自定义按钮区域开始 -->
<view>
<el-row>
<el-button type="success" size="small" icon="el-icon-circle-plus-outline" @click="addBtn">添加
</el-button>
<!-- 批量操作 -->
<el-dropdown v-if="table1.multipleSelection" :split-button="false" trigger="click" @command="batchBtn">
<!-- <el-button type="danger" size="small" style="margin-left: 20rpx;"
:disabled="table1.multipleSelection.length === 0">
批量操作<i class="el-icon-arrow-down el-icon--right"></i>
</el-button> -->
<el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item :command="1">批量操作1</el-dropdown-item>
<el-dropdown-item :command="2">批量操作2</el-dropdown-item> -->
</el-dropdown-menu>
</el-dropdown>
</el-row>
</view>
<!-- 自定义按钮区域结束 -->
<!-- 表格组件开始 -->
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
:right-btns="['detail_auto','update','delete']" :default-expand-all="false" @update="updateBtn"
@delete="deleteBtn" @current-change="currentChange"
@selection-change="selectionChange"></vk-data-table>
<!-- 表格组件结束 -->
<!-- 添加或编辑的弹窗开始 -->
<vk-data-dialog v-model="form1.props.show" :title="form1.props.title" width="60%" mode="form"
:close-on-click-modal="false">
<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
:form-type="form1.props.formType" :columns='form1.props.columns' label-width="120px"
@success="form1.props.show = false;refresh();"></vk-data-form>
</vk-data-dialog>
<!-- 添加或编辑的弹窗结束 -->
<!-- 页面内容结束 -->
</view>
</template>
<script>
var that; // 当前页面对象
var vk = uni.vk; // vk实例
var originalForms = {}; // 表单初始化数据
export default {
data() {
// 页面数据变量
return {
// 页面是否请求中或加载中
loading: false,
// init请求返回的数据
data: {
},
// 表格相关开始 -----------------------------------------------------------
table1: {
// 表格数据请求地址
action: "admin/old/category/sys/getTree",
// 表格字段显示规则
columns: [
// {
// key: "_id",
// title: "id",
// type: "text",
// width: 220
// },
{
key: "name",
title: "名称",
type: "text",
width: 220,
align: "left",
},
// {
// key: "parent_id",
// title: "上级id",
// type: "text",
// width: 220,
// },
{
key: "remark",
title: "备注",
type: "text",
align: "left",
width: 220
},
{
key: "sort",
title: "排序",
type: "number",
align: "left",
width: 80,
},
{
key: "_add_time",
title: "添加时间",
type: "time",
align: "left",
width: 160,
sortable: "custom"
},
{
key: "_add_time",
title: "距离现在",
type: "dateDiff",
align: "left",
width: 120
},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: ""
},
// 表格相关结束 -----------------------------------------------------------
// 表单相关开始 -----------------------------------------------------------
// 查询表单请求数据
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {
type: 1
},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
// {
// key: "name",
// title: "名称",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "remark",
// title: "备注",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "_add_time",
// title: "添加时间",
// type: "datetimerange",
// width: 400,
// mode: "[]"
// },
]
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
type: 1
},
// 表单属性
props: {
// 表单请求地址
action: "",
// 表单字段显示规则
columns: [
{
key: "name",
title: "名称",
type: "text",
placeholder: "请输入分类名称"
},
// {
// key: "icon",
// title: "图标",
// type: "icon",
// placeholder: "请选择图标"
// },
{
key: "parent_id",
title: "上级分类",
type: "tree-select",
placeholder: "请选择上级分类",
action: (obj={})=>{
let {
success, // 成功回调
fail, // 失败回调
complete, // 成功回调
} = obj;
// 发起http请求
vk.callFunction({
url: `admin/old/category/sys/getTree`,
data: {type: 1, level: 0},
success: (res) => {
if (typeof success === "function") {
success({
rows: res.rows
});
}
},
fail: (res) => {
if (typeof fail === "function") fail(res);
},
complete: (res) => {
if (typeof complete === "function") complete(res);
}
});
},
props: {
list: "rows",
value: "_id",
label: "name",
children: "children"
},
},
{
key: "remark",
title: "备注",
type: "textarea",
maxlength: "99",
showWordLimit: true,
autosize: {
minRows: 2,
maxRows: 10
},
},
{
key: "sort",
title: "排序",
type: "number",
precision: 0,
placeholder: "请输入排序值",
},
],
// 表单验证规则
rules: {
sort: [
{
type: 'number',
message: '排序值必须为数字'
}
],
name: [
{required: true, message: '分类名称不能为空', trigger: 'blur'},
],
type: [
{required: true, message: '请选择类型', trigger: 'blur'},
],
},
// add 代表添加 update 代表修改
formType: "",
// 是否显示表单的弹窗
show: false
}
},
// 其他弹窗表单
formDatas: {},
// 表单相关结束 -----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {
},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {
},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {
},
// 函数
methods: {
// 页面数据初始化函数
init(options) {
originalForms["form1"] = vk.pubfn.copyObject(that.form1);
},
// 页面跳转
pageTo(path) {
vk.navigateTo(path);
},
// 表单重置
resetForm() {
vk.pubfn.resetForm(originalForms, that);
},
// 搜索
search() {
that.$refs.table1.search();
},
// 刷新
refresh() {
that.$refs.table1.refresh();
},
// 获取当前选中的行的数据
getCurrentRow() {
return that.$refs.table1.getCurrentRow();
},
// 监听 - 行的选中高亮事件
currentChange(val) {
that.table1.selectItem = val;
},
// 当选择项发生变化时会触发该事件
selectionChange(list) {
that.table1.multipleSelection = type_0;
},
// 显示添加页面
addBtn() {
that.resetForm();
that.form1.props.action = 'admin/old/category/sys/add';
that.form1.props.formType = 'add';
that.form1.props.title = '添加';
that.form1.props.show = true;
},
// 显示修改页面
updateBtn({
item
}) {
that.form1.props.action = 'admin/old/category/sys/update';
that.form1.props.formType = 'update';
that.form1.props.title = '编辑';
that.form1.props.show = true;
that.form1.data = item;
},
// 删除按钮
deleteBtn({
item,
deleteFn
}) {
deleteFn({
action: "admin/old/category/sys/delete",
data: {
_id: item._id
},
});
},
// 监听 - 批量操作的按钮点击事件
batchBtn(index) {
switch (index) {
case 1:
vk.toast("批量操作按钮1");
break;
case 2:
vk.toast("批量操作按钮2");
break;
default:
break;
}
}
},
// 监听属性
watch: {},
// 过滤器
filters: {},
// 计算属性
computed: {}
};
</script>
<style lang="scss" scoped>
.page-body {
}
</style>
+368
View File
@@ -0,0 +1,368 @@
<template>
<view class="page-body">
<!-- 页面内容开始 -->
<!-- 表格搜索组件开始 -->
<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"
@search="search"></vk-data-table-query>
<!-- 表格搜索组件结束 -->
<!-- 自定义按钮区域开始 -->
<view>
<el-row>
<el-button type="success" size="small" icon="el-icon-circle-plus-outline" @click="addBtn">添加
</el-button>
<!-- 批量操作 -->
<el-dropdown v-if="table1.multipleSelection" :split-button="false" trigger="click" @command="batchBtn">
<!-- <el-button type="danger" size="small" style="margin-left: 20rpx;"
:disabled="table1.multipleSelection.length === 0">
批量操作<i class="el-icon-arrow-down el-icon--right"></i>
</el-button> -->
<el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item :command="1">批量操作1</el-dropdown-item>
<el-dropdown-item :command="2">批量操作2</el-dropdown-item> -->
</el-dropdown-menu>
</el-dropdown>
</el-row>
</view>
<!-- 自定义按钮区域结束 -->
<!-- 表格组件开始 -->
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
:right-btns="['detail_auto','update','delete']" :default-expand-all="false" @update="updateBtn"
@delete="deleteBtn" @current-change="currentChange"
@selection-change="selectionChange"></vk-data-table>
<!-- 表格组件结束 -->
<!-- 添加或编辑的弹窗开始 -->
<vk-data-dialog v-model="form1.props.show" :title="form1.props.title" width="60%" mode="form"
:close-on-click-modal="false">
<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
:form-type="form1.props.formType" :columns='form1.props.columns' label-width="120px"
@success="form1.props.show = false;refresh();"></vk-data-form>
</vk-data-dialog>
<!-- 添加或编辑的弹窗结束 -->
<!-- 页面内容结束 -->
</view>
</template>
<script>
var that; // 当前页面对象
var vk = uni.vk; // vk实例
var originalForms = {}; // 表单初始化数据
export default {
data() {
// 页面数据变量
return {
// 页面是否请求中或加载中
loading: false,
// init请求返回的数据
data: {
},
// 表格相关开始 -----------------------------------------------------------
table1: {
// 表格数据请求地址
action: "admin/old/category/sys/getTree",
// 表格字段显示规则
columns: [
// {
// key: "_id",
// title: "id",
// type: "text",
// width: 220
// },
{
key: "name",
title: "名称",
type: "text",
width: 220,
align: "left",
},
// {
// key: "parent_id",
// title: "上级id",
// type: "text",
// width: 220,
// },
{
key: "remark",
title: "备注",
type: "text",
align: "left",
width: 220
},
{
key: "sort",
title: "排序",
type: "number",
align: "left",
width: 80,
},
{
key: "_add_time",
title: "添加时间",
type: "time",
align: "left",
width: 160,
sortable: "custom"
},
{
key: "_add_time",
title: "距离现在",
type: "dateDiff",
align: "left",
width: 120
},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: ""
},
// 表格相关结束 -----------------------------------------------------------
// 表单相关开始 -----------------------------------------------------------
// 查询表单请求数据
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {
type: 2
},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
// {
// key: "name",
// title: "名称",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "remark",
// title: "备注",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "_add_time",
// title: "添加时间",
// type: "datetimerange",
// width: 400,
// mode: "[]"
// },
]
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
type: 2
},
// 表单属性
props: {
// 表单请求地址
action: "",
// 表单字段显示规则
columns: [
{
key: "name",
title: "名称",
type: "text",
placeholder: "请输入分类名称"
},
// {
// key: "icon",
// title: "图标",
// type: "icon",
// placeholder: "请选择图标"
// },
{
key: "parent_id",
title: "上级分类",
type: "tree-select",
placeholder: "请选择上级分类",
action: (obj={})=>{
let {
success, // 成功回调
fail, // 失败回调
complete, // 成功回调
} = obj;
// 发起http请求
vk.callFunction({
url: `admin/old/category/sys/getTree`,
data: {type: 2, level: 0},
success: (res) => {
if (typeof success === "function") {
success({
rows: res.rows
});
}
},
fail: (res) => {
if (typeof fail === "function") fail(res);
},
complete: (res) => {
if (typeof complete === "function") complete(res);
}
});
},
props: {
list: "rows",
value: "_id",
label: "name",
children: "children"
},
},
{
key: "remark",
title: "备注",
type: "textarea",
maxlength: "99",
showWordLimit: true,
autosize: {
minRows: 2,
maxRows: 10
},
},
{
key: "sort",
title: "排序",
type: "number",
precision: 0,
placeholder: "请输入排序值",
},
],
// 表单验证规则
rules: {
sort: [
{
type: 'number',
message: '排序值必须为数字'
}
],
name: [
{required: true, message: '分类名称不能为空', trigger: 'blur'},
],
type: [
{required: true, message: '请选择类型', trigger: 'blur'},
],
},
// add 代表添加 update 代表修改
formType: "",
// 是否显示表单的弹窗
show: false
}
},
// 其他弹窗表单
formDatas: {},
// 表单相关结束 -----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {
},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {
},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {
},
// 函数
methods: {
// 页面数据初始化函数
init(options) {
originalForms["form1"] = vk.pubfn.copyObject(that.form1);
},
// 页面跳转
pageTo(path) {
vk.navigateTo(path);
},
// 表单重置
resetForm() {
vk.pubfn.resetForm(originalForms, that);
},
// 搜索
search() {
that.$refs.table1.search();
},
// 刷新
refresh() {
that.$refs.table1.refresh();
},
// 获取当前选中的行的数据
getCurrentRow() {
return that.$refs.table1.getCurrentRow();
},
// 监听 - 行的选中高亮事件
currentChange(val) {
that.table1.selectItem = val;
},
// 当选择项发生变化时会触发该事件
selectionChange(list) {
that.table1.multipleSelection = type_0;
},
// 显示添加页面
addBtn() {
that.resetForm();
that.form1.props.action = 'admin/old/category/sys/add';
that.form1.props.formType = 'add';
that.form1.props.title = '添加';
that.form1.props.show = true;
},
// 显示修改页面
updateBtn({
item
}) {
that.form1.props.action = 'admin/old/category/sys/update';
that.form1.props.formType = 'update';
that.form1.props.title = '编辑';
that.form1.props.show = true;
that.form1.data = item;
},
// 删除按钮
deleteBtn({
item,
deleteFn
}) {
deleteFn({
action: "admin/old/category/sys/delete",
data: {
_id: item._id
},
});
},
// 监听 - 批量操作的按钮点击事件
batchBtn(index) {
switch (index) {
case 1:
vk.toast("批量操作按钮1");
break;
case 2:
vk.toast("批量操作按钮2");
break;
default:
break;
}
}
},
// 监听属性
watch: {},
// 过滤器
filters: {},
// 计算属性
computed: {}
};
</script>
<style lang="scss" scoped>
.page-body {
}
</style>
+368
View File
@@ -0,0 +1,368 @@
<template>
<view class="page-body">
<!-- 页面内容开始 -->
<!-- 表格搜索组件开始 -->
<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"
@search="search"></vk-data-table-query>
<!-- 表格搜索组件结束 -->
<!-- 自定义按钮区域开始 -->
<view>
<el-row>
<el-button type="success" size="small" icon="el-icon-circle-plus-outline" @click="addBtn">添加
</el-button>
<!-- 批量操作 -->
<el-dropdown v-if="table1.multipleSelection" :split-button="false" trigger="click" @command="batchBtn">
<!-- <el-button type="danger" size="small" style="margin-left: 20rpx;"
:disabled="table1.multipleSelection.length === 0">
批量操作<i class="el-icon-arrow-down el-icon--right"></i>
</el-button> -->
<el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item :command="1">批量操作1</el-dropdown-item>
<el-dropdown-item :command="2">批量操作2</el-dropdown-item> -->
</el-dropdown-menu>
</el-dropdown>
</el-row>
</view>
<!-- 自定义按钮区域结束 -->
<!-- 表格组件开始 -->
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
:right-btns="['detail_auto','update','delete']" :default-expand-all="false" @update="updateBtn"
@delete="deleteBtn" @current-change="currentChange"
@selection-change="selectionChange"></vk-data-table>
<!-- 表格组件结束 -->
<!-- 添加或编辑的弹窗开始 -->
<vk-data-dialog v-model="form1.props.show" :title="form1.props.title" width="60%" mode="form"
:close-on-click-modal="false">
<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
:form-type="form1.props.formType" :columns='form1.props.columns' label-width="120px"
@success="form1.props.show = false;refresh();"></vk-data-form>
</vk-data-dialog>
<!-- 添加或编辑的弹窗结束 -->
<!-- 页面内容结束 -->
</view>
</template>
<script>
var that; // 当前页面对象
var vk = uni.vk; // vk实例
var originalForms = {}; // 表单初始化数据
export default {
data() {
// 页面数据变量
return {
// 页面是否请求中或加载中
loading: false,
// init请求返回的数据
data: {
},
// 表格相关开始 -----------------------------------------------------------
table1: {
// 表格数据请求地址
action: "admin/old/category/sys/getTree",
// 表格字段显示规则
columns: [
// {
// key: "_id",
// title: "id",
// type: "text",
// width: 220
// },
{
key: "name",
title: "名称",
type: "text",
width: 220,
align: "left",
},
// {
// key: "parent_id",
// title: "上级id",
// type: "text",
// width: 220,
// },
{
key: "remark",
title: "备注",
type: "text",
align: "left",
width: 220
},
{
key: "sort",
title: "排序",
type: "number",
align: "left",
width: 80,
},
{
key: "_add_time",
title: "添加时间",
type: "time",
align: "left",
width: 160,
sortable: "custom"
},
{
key: "_add_time",
title: "距离现在",
type: "dateDiff",
align: "left",
width: 120
},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: ""
},
// 表格相关结束 -----------------------------------------------------------
// 表单相关开始 -----------------------------------------------------------
// 查询表单请求数据
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {
type: 3
},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
// {
// key: "name",
// title: "名称",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "remark",
// title: "备注",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "_add_time",
// title: "添加时间",
// type: "datetimerange",
// width: 400,
// mode: "[]"
// },
]
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
type: 3
},
// 表单属性
props: {
// 表单请求地址
action: "",
// 表单字段显示规则
columns: [
{
key: "name",
title: "名称",
type: "text",
placeholder: "请输入分类名称"
},
// {
// key: "icon",
// title: "图标",
// type: "icon",
// placeholder: "请选择图标"
// },
{
key: "parent_id",
title: "上级分类",
type: "tree-select",
placeholder: "请选择上级分类",
action: (obj={})=>{
let {
success, // 成功回调
fail, // 失败回调
complete, // 成功回调
} = obj;
// 发起http请求
vk.callFunction({
url: `admin/old/category/sys/getTree`,
data: {type: 3, level: 0},
success: (res) => {
if (typeof success === "function") {
success({
rows: res.rows
});
}
},
fail: (res) => {
if (typeof fail === "function") fail(res);
},
complete: (res) => {
if (typeof complete === "function") complete(res);
}
});
},
props: {
list: "rows",
value: "_id",
label: "name",
children: "children"
},
},
{
key: "remark",
title: "备注",
type: "textarea",
maxlength: "99",
showWordLimit: true,
autosize: {
minRows: 2,
maxRows: 10
},
},
{
key: "sort",
title: "排序",
type: "number",
precision: 0,
placeholder: "请输入排序值",
},
],
// 表单验证规则
rules: {
sort: [
{
type: 'number',
message: '排序值必须为数字'
}
],
name: [
{required: true, message: '分类名称不能为空', trigger: 'blur'},
],
type: [
{required: true, message: '请选择类型', trigger: 'blur'},
],
},
// add 代表添加 update 代表修改
formType: "",
// 是否显示表单的弹窗
show: false
}
},
// 其他弹窗表单
formDatas: {},
// 表单相关结束 -----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {
},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {
},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {
},
// 函数
methods: {
// 页面数据初始化函数
init(options) {
originalForms["form1"] = vk.pubfn.copyObject(that.form1);
},
// 页面跳转
pageTo(path) {
vk.navigateTo(path);
},
// 表单重置
resetForm() {
vk.pubfn.resetForm(originalForms, that);
},
// 搜索
search() {
that.$refs.table1.search();
},
// 刷新
refresh() {
that.$refs.table1.refresh();
},
// 获取当前选中的行的数据
getCurrentRow() {
return that.$refs.table1.getCurrentRow();
},
// 监听 - 行的选中高亮事件
currentChange(val) {
that.table1.selectItem = val;
},
// 当选择项发生变化时会触发该事件
selectionChange(list) {
that.table1.multipleSelection = type_0;
},
// 显示添加页面
addBtn() {
that.resetForm();
that.form1.props.action = 'admin/old/category/sys/add';
that.form1.props.formType = 'add';
that.form1.props.title = '添加';
that.form1.props.show = true;
},
// 显示修改页面
updateBtn({
item
}) {
that.form1.props.action = 'admin/old/category/sys/update';
that.form1.props.formType = 'update';
that.form1.props.title = '编辑';
that.form1.props.show = true;
that.form1.data = item;
},
// 删除按钮
deleteBtn({
item,
deleteFn
}) {
deleteFn({
action: "admin/old/category/sys/delete",
data: {
_id: item._id
},
});
},
// 监听 - 批量操作的按钮点击事件
batchBtn(index) {
switch (index) {
case 1:
vk.toast("批量操作按钮1");
break;
case 2:
vk.toast("批量操作按钮2");
break;
default:
break;
}
}
},
// 监听属性
watch: {},
// 过滤器
filters: {},
// 计算属性
computed: {}
};
</script>
<style lang="scss" scoped>
.page-body {
}
</style>
+135
View File
@@ -0,0 +1,135 @@
<template>
<div>
<el-dialog title="报价明细" :visible.sync="dialogVisible" width="60%">
<el-table :data="list" style="width: 100%">
<el-table-column prop="subjectName" label="报价方"/>
<el-table-column prop="subjectMobile" label="联系方式"/>
<el-table-column prop="totalPrice" label="金额"/>
<el-table-column label="附件">
<template v-slot="{ row }">
<a
style="margin-right: 10px"
v-for="(item, index) in row.files"
:key="index"
href="javascript:;"
@click="previewFile(item)"
>预览: 文件{{ index + 1 }}</a>
</template>
</el-table-column>
<el-table-column prop="remark" label="备注"/>
<el-table-column prop="_add_time_str" label="报价时间"/>
</el-table>
</el-dialog>
<el-dialog title="图片预览" :visible.sync="showImagePreview" width="80%" append-to-body>
<img v-if="previewImageUrl" class="preview-image" :src="previewImageUrl" alt="附件预览"/>
</el-dialog>
<el-dialog title="PDF预览" :visible.sync="showPdfPreview" width="80%" append-to-body @closed="revokePdfPreviewUrl">
<iframe v-if="pdfPreviewUrl" class="pdf-preview-frame" :src="pdfPreviewUrl"></iframe>
</el-dialog>
</div>
</template>
<script>
export default {
name: "EnquiryQuoteList",
data() {
return {
dialogVisible: false,
list: [],
showImagePreview: false,
previewImageUrl: '',
showPdfPreview: false,
pdfPreviewUrl: '',
pdfObjectUrl: '',
}
},
beforeDestroy() {
this.revokePdfPreviewUrl()
},
methods: {
open(sheetId){
this.getList(sheetId)
},
async getList(sheetId){
const {rows} = await vk.callFunction({
url: 'admin/enquiry/quote/kh/getList',
data: {
sheetId
}
})
this.dialogVisible = true
this.list = rows
},
getFileExt(url = "") {
const cleanUrl = String(url).split("?")[0].split("#")[0]
const match = cleanUrl.match(/\.([a-z0-9]+)$/i)
return match ? match[1].toLowerCase() : ""
},
isImageFile(url) {
return ["png", "jpg", "jpeg", "gif", "webp", "bmp", "svg"].includes(this.getFileExt(url))
},
isPdfFile(url) {
return this.getFileExt(url) === "pdf"
},
isOfficeFile(url) {
return ["doc", "docx", "xls", "xlsx", "ppt", "pptx"].includes(this.getFileExt(url))
},
getOfficePreviewUrl(url) {
return `https://view.officeapps.live.com/op/view.aspx?src=${encodeURIComponent(url)}`
},
revokePdfPreviewUrl() {
if (this.pdfObjectUrl) {
URL.revokeObjectURL(this.pdfObjectUrl)
this.pdfObjectUrl = ''
}
this.pdfPreviewUrl = ''
},
async previewPdfFile(url) {
this.revokePdfPreviewUrl()
try {
const response = await fetch(url)
if (!response.ok) throw new Error('PDF加载失败')
const blob = await response.blob()
this.pdfObjectUrl = URL.createObjectURL(new Blob([blob], {type: 'application/pdf'}))
this.pdfPreviewUrl = this.pdfObjectUrl
} catch (e) {
this.pdfPreviewUrl = `https://mozilla.github.io/pdf.js/web/viewer.html?file=${encodeURIComponent(url)}`
}
this.showPdfPreview = true
},
previewFile(url) {
if (!url) return
if (this.isImageFile(url)) {
this.previewImageUrl = url
this.showImagePreview = true
return
}
if (this.isPdfFile(url)) {
this.previewPdfFile(url)
return
}
if (this.isOfficeFile(url)) {
window.open(this.getOfficePreviewUrl(url), "_blank")
return
}
window.open(url, "_blank")
}
}
}
</script>
<style scoped>
.preview-image {
display: block;
max-width: 100%;
max-height: 75vh;
margin: 0 auto;
}
.pdf-preview-frame {
display: block;
width: 100%;
height: 75vh;
border: 0;
}
</style>
+140
View File
@@ -0,0 +1,140 @@
<template>
<div>
<el-dialog title="报价明细" :visible.sync="dialogVisible" width="60%">
<el-table :data="list" style="width: 100%">
<el-table-column prop="subjectName" label="报价方"/>
<el-table-column label="联系方式">
<template #default="{ row }">
<span v-if="row.user.accountType === 2">{{ row.user.company.mobile }}</span>
<span v-else>{{ row.user.person.mobile }}</span>
</template>
</el-table-column>
<el-table-column prop="totalPrice" label="金额"/>
<el-table-column label="附件">
<template #default="{ row }">
<a
href="javascript:;"
style="margin-right: 10px"
v-for="(item, index) in row.files"
:key="index"
@click="previewFile(item)"
>附件:{{ index + 1 }}</a>
</template>
</el-table-column>
<el-table-column prop="remark" label="备注"/>
<el-table-column prop="_add_time_str" label="报价时间"/>
</el-table>
</el-dialog>
<el-dialog title="图片预览" :visible.sync="showImagePreview" width="80%" append-to-body>
<img v-if="previewImageUrl" class="preview-image" :src="previewImageUrl" alt="附件预览"/>
</el-dialog>
<el-dialog title="PDF预览" :visible.sync="showPdfPreview" width="80%" append-to-body @closed="revokePdfPreviewUrl">
<iframe v-if="pdfPreviewUrl" class="pdf-preview-frame" :src="pdfPreviewUrl"></iframe>
</el-dialog>
</div>
</template>
<script>
export default {
name: "OldQuoteList",
data() {
return {
dialogVisible: false,
list: [],
showImagePreview: false,
previewImageUrl: '',
showPdfPreview: false,
pdfPreviewUrl: '',
pdfObjectUrl: '',
}
},
beforeDestroy() {
this.revokePdfPreviewUrl()
},
methods: {
open(sheetId) {
this.getList(sheetId)
},
async getList(sheetId) {
const {rows} = await vk.callFunction({
url: 'admin/old/quote/kh/getList',
data: {
sheetId
}
})
this.dialogVisible = true
this.list = rows
},
getFileExt(url = "") {
const cleanUrl = String(url).split("?")[0].split("#")[0]
const match = cleanUrl.match(/\.([a-z0-9]+)$/i)
return match ? match[1].toLowerCase() : ""
},
isImageFile(url) {
return ["png", "jpg", "jpeg", "gif", "webp", "bmp", "svg"].includes(this.getFileExt(url))
},
isPdfFile(url) {
return this.getFileExt(url) === "pdf"
},
isOfficeFile(url) {
return ["doc", "docx", "xls", "xlsx", "ppt", "pptx"].includes(this.getFileExt(url))
},
getOfficePreviewUrl(url) {
return `https://view.officeapps.live.com/op/view.aspx?src=${encodeURIComponent(url)}`
},
revokePdfPreviewUrl() {
if (this.pdfObjectUrl) {
URL.revokeObjectURL(this.pdfObjectUrl)
this.pdfObjectUrl = ''
}
this.pdfPreviewUrl = ''
},
async previewPdfFile(url) {
this.revokePdfPreviewUrl()
try {
const response = await fetch(url)
if (!response.ok) throw new Error('PDF加载失败')
const blob = await response.blob()
this.pdfObjectUrl = URL.createObjectURL(new Blob([blob], {type: 'application/pdf'}))
this.pdfPreviewUrl = this.pdfObjectUrl
} catch (e) {
this.pdfPreviewUrl = `https://mozilla.github.io/pdf.js/web/viewer.html?file=${encodeURIComponent(url)}`
}
this.showPdfPreview = true
},
previewFile(url) {
if (!url) return
if (this.isImageFile(url)) {
this.previewImageUrl = url
this.showImagePreview = true
return
}
if (this.isPdfFile(url)) {
this.previewPdfFile(url)
return
}
if (this.isOfficeFile(url)) {
window.open(this.getOfficePreviewUrl(url), "_blank")
return
}
window.open(url, "_blank")
}
}
}
</script>
<style scoped>
.preview-image {
display: block;
max-width: 100%;
max-height: 75vh;
margin: 0 auto;
}
.pdf-preview-frame {
display: block;
width: 100%;
height: 75vh;
border: 0;
}
</style>
+80
View File
@@ -0,0 +1,80 @@
<template>
<div>
<el-descriptions border :column="2">
<el-descriptions-item label="商品列表">
<div v-for="(item, index) in info.goods" :key="index" style="
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: flex-start;">
<p>商品名称: {{ item.goodsName }}</p>
<p v-if="info.type === 0 && formatSku(item.sku)">规格: {{ formatSku(item.sku) }}</p>
<p>数量: x{{ item.num }}</p>
<p>单价: {{ item.goodsPrice }}元</p>
<p v-if="info.type === 0">所属公司: {{ item.company.company.companyName }}</p>
<el-divider v-if="index < info.goods.length - 1"/>
</div>
</el-descriptions-item>
<el-descriptions-item label="用户信息">
<p>用户名: {{ info.user.nickname }}</p>
<p>手机号: {{ info.user.mobile }}</p>
</el-descriptions-item>
<el-descriptions-item label="买家信息">
<p>收件人: {{ info.name }}</p>
<p>收件人联系方式: {{ info.phone }}</p>
<p>收件地址: {{ info.addressRegion.province.name }}{{
info.addressRegion.city.name
}}{{ info.addressRegion.area.name }}{{ info.addressDetail }}</p>
</el-descriptions-item>
<el-descriptions-item label="物流信息">
<p>物流公司: {{ info.expressName }}</p>
<p>物流单号: {{ info.expressNo }}</p>
<p>备注: {{ info.remark }}</p>
<el-image v-for="(item, index) in info.expressPhoto" :key="index" :src="item"
class="mr-10 mb-10"
:preview-src-list="info.expressPhoto" style="width: 100px;height: 100px"/>
</el-descriptions-item>
<template v-if="info.orderStatus >= 5">
<el-descriptions-item label="退款信息">
<p>退款原因: {{ info.refundReason }}</p>
<div>
<span>退款附件: </span>
<a style="margin-right: 1rem" v-for="(file, fileIndex) in info.refundPhotos" :key="fileIndex" :href="file"
target="_blank">预览:文件{{ fileIndex + 1 }}</a>
</div>
</el-descriptions-item>
</template>
</el-descriptions>
<div style="margin-top: 2rem; text-align: center">
<el-button plain @click.native="cancel">关闭</el-button>
</div>
</div>
</template>
<script>
export default {
name: "OrderInfo",
props: {
info: {
type: Object
}
},
data() {
return {}
},
methods: {
formatSku(sku) {
if (!sku) return ''
if (typeof sku === 'string') return sku
return sku.label || sku.name || sku.title || sku.specName || ''
},
cancel() {
this.$emit('close')
},
},
mounted() {
// this.getList()
}
}
</script>
+82
View File
@@ -0,0 +1,82 @@
<template>
<el-dialog title="支付明细" :visible.sync="dialogVisible" width="60%">
<view v-for="(item, index) in payList" :key="index" class="py-20 border-bottom">
<el-descriptions :title="item.type" :column="2" border :labelStyle="{width: '120px'}">
<template slot="extra">
<div class="flex justify-start items-center">
<template v-if="!item.buyerRefuse">
<el-button plain type="primary" size="mini" @click="showPay(item)"
v-if="item.status === 0 && item.isBuyer && !item.hasPaid">上传支付凭证
</el-button>
<el-button type="primary" size="mini" class="mx-20" @click="confirmPay(item)"
v-if="item.hasPaid && item.isSeller && !item.sellerConfirm">
确认收款
</el-button>
<el-button plain type="primary" size="mini" class="mx-20" @click="paidRefuse(item)"
v-if="item.isBuyer && item.status === 0 && !item.paidVoucher">
驳回
</el-button>
</template>
</div>
</template>
<el-descriptions-item label="支付金额">{{ item.amount }}</el-descriptions-item>
<el-descriptions-item label="支付凭证">
<template v-if="!item.buyerRefuse">
<span v-if="item.isSeller && !item.hasPaid">待买方支付</span>
<view v-else-if="item.paidVoucher">
<el-image :src="item.paidVoucher[0]" style="width: 80px; height: 80px" fit="cover"
:preview-src-list="item.paidVoucher"/>
</view>
<view v-else-if="!item.paidVoucher">
<span>未上传凭证</span>
</view>
</template>
<span v-else class="text-main">买家已拒绝: {{ item.refuseReason }}</span>
</el-descriptions-item>
<el-descriptions-item label="交货凭证">
<el-image v-for="(photo, photoIndex) in item.expressPhoto" :key="photoIndex" :src="photo"
style="width: 80px; height: 80px" fit="cover"
:preview-src-list="item.expressPhoto"/>
</el-descriptions-item>
<el-descriptions-item label="备注">
<text>{{ item.remark ? item.remark : '无' }}</text>
</el-descriptions-item>
<el-descriptions-item label="买家备注">
<text>{{ item.buyerRemark ? item.buyerRemark : '无' }}</text>
</el-descriptions-item>
<el-descriptions-item label="图片">
<template v-if="item.photos && item.photos.length > 0">
<el-image v-for="(photo, photoIndex) in item.photos" :key="photoIndex" :src="photo"
style="width: 80px; height: 80px" fit="cover"
:preview-src-list="item.photos"/>
</template>
<span v-else>无</span>
</el-descriptions-item>
<el-descriptions-item label="状态">
<span v-if="!item.hasPaid && !item.buyerRefuse">待上传凭证</span>
<span v-if="!item.sellerConfirm && item.hasPaid">待确认收款</span>
<span v-if="item.sellerConfirm && item.hasPaid">已完成</span>
</el-descriptions-item>
</el-descriptions>
</view>
</el-dialog>
</template>
<script>
export default {
name: "PayList",
data() {
return {
dialogVisible: false,
payList: [],
}
},
methods: {
open(payList) {
this.payList = payList
this.dialogVisible = true
},
}
}
</script>
+146
View File
@@ -0,0 +1,146 @@
<template>
<div>
<el-dialog title="报价列表" :visible.sync="dialogVisible" width="60%">
<el-table :data="list" style="width: 100%">
<el-table-column label="报价方">
<template #default="{ row }">
<span v-if="row.user.accountType === 2">{{ row.user.company.companyName }}</span>
<span v-else>{{ row.user.person.personName }}</span>
</template>
</el-table-column>
<el-table-column label="联系方式">
<template #default="{ row }">
<span v-if="row.user.accountType === 2">{{ row.user.company.mobile }}</span>
<span v-else>{{ row.user.person.mobile }}</span>
</template>
</el-table-column>
<el-table-column prop="totalPrice" label="金额"/>
<el-table-column label="附件">
<template #default="{ row }">
<a
href="javascript:;"
style="margin-right: 10px"
v-for="(item, index) in row.files"
:key="index"
@click="previewFile(item)"
>附件:{{ index + 1 }}</a>
</template>
</el-table-column>
<el-table-column prop="remark" label="报价单详情"/>
<el-table-column prop="supplierExt" label="合同补充条款"/>
<el-table-column prop="_add_time_str" label="报价时间"/>
</el-table>
</el-dialog>
<el-dialog title="图片预览" :visible.sync="showImagePreview" width="80%" append-to-body>
<img v-if="previewImageUrl" class="preview-image" :src="previewImageUrl" alt="附件预览"/>
</el-dialog>
<el-dialog title="PDF预览" :visible.sync="showPdfPreview" width="80%" append-to-body @closed="revokePdfPreviewUrl">
<iframe v-if="pdfPreviewUrl" class="pdf-preview-frame" :src="pdfPreviewUrl"></iframe>
</el-dialog>
</div>
</template>
<script>
export default {
name: "ProcessQuoteList",
data() {
return {
dialogVisible: false,
list: [],
showImagePreview: false,
previewImageUrl: '',
showPdfPreview: false,
pdfPreviewUrl: '',
pdfObjectUrl: '',
}
},
beforeDestroy() {
this.revokePdfPreviewUrl()
},
methods: {
open(sheetId) {
this.getList(sheetId)
},
async getList(sheetId) {
const {rows} = await vk.callFunction({
url: 'admin/process/quote/kh/getList',
data: {
sheetId
}
})
this.dialogVisible = true
this.list = rows
},
getFileExt(url = "") {
const cleanUrl = String(url).split("?")[0].split("#")[0]
const match = cleanUrl.match(/\.([a-z0-9]+)$/i)
return match ? match[1].toLowerCase() : ""
},
isImageFile(url) {
return ["png", "jpg", "jpeg", "gif", "webp", "bmp", "svg"].includes(this.getFileExt(url))
},
isPdfFile(url) {
return this.getFileExt(url) === "pdf"
},
isOfficeFile(url) {
return ["doc", "docx", "xls", "xlsx", "ppt", "pptx"].includes(this.getFileExt(url))
},
getOfficePreviewUrl(url) {
return `https://view.officeapps.live.com/op/view.aspx?src=${encodeURIComponent(url)}`
},
revokePdfPreviewUrl() {
if (this.pdfObjectUrl) {
URL.revokeObjectURL(this.pdfObjectUrl)
this.pdfObjectUrl = ''
}
this.pdfPreviewUrl = ''
},
async previewPdfFile(url) {
this.revokePdfPreviewUrl()
try {
const response = await fetch(url)
if (!response.ok) throw new Error('PDF加载失败')
const blob = await response.blob()
this.pdfObjectUrl = URL.createObjectURL(new Blob([blob], {type: 'application/pdf'}))
this.pdfPreviewUrl = this.pdfObjectUrl
} catch (e) {
this.pdfPreviewUrl = `https://mozilla.github.io/pdf.js/web/viewer.html?file=${encodeURIComponent(url)}`
}
this.showPdfPreview = true
},
previewFile(url) {
if (!url) return
if (this.isImageFile(url)) {
this.previewImageUrl = url
this.showImagePreview = true
return
}
if (this.isPdfFile(url)) {
this.previewPdfFile(url)
return
}
if (this.isOfficeFile(url)) {
window.open(this.getOfficePreviewUrl(url), "_blank")
return
}
window.open(url, "_blank")
}
}
}
</script>
<style scoped>
.preview-image {
display: block;
max-width: 100%;
max-height: 75vh;
margin: 0 auto;
}
.pdf-preview-frame {
display: block;
width: 100%;
height: 75vh;
border: 0;
}
</style>
+161
View File
@@ -0,0 +1,161 @@
<template>
<div>
<el-descriptions border :column="2" v-if="info">
<el-descriptions-item label="服务">
<div v-for="(item, index) in goods" :key="index">
<p>{{ item.goodsName }}</p>
<template v-if="orderInfo.subType === 2 && item.amountItem">
<p>项基础收费: {{ item.amountItem.amount }}元</p>
<p v-if="item.costNum">清单单品项数: {{ item.costNum }}</p>
<p>项数加价: {{ item.amountItem.addAmount }}元</p>
<p>建议收费: {{ item.amountItem.amount + (item.costNum * item.amountItem.addAmount) }}元</p>
</template>
</div>
</el-descriptions-item>
<el-descriptions-item label="考察对象" v-if="info.type === 0">
<div v-for="(item, index) in info.contentList" :key="index">
<span>类型:{{ item.type }},</span>
<span>{{ item.name }}</span>
<template v-if="item.type && item.type === '个人'">
<span>({{ item.code }})</span>
<span>--{{ item.addressRegion.province.name }}{{
item.addressRegion.city.name
}}{{ item.addressRegion.area.name }}{{ item.address }}</span>
</template>
</div>
</el-descriptions-item>
<el-descriptions-item label="考察产品" v-else>
<p style="margin-bottom: .5rem" v-for="(item, index) in info.contentList" :key="index">{{
item.name
}}--{{ item.addressRegion.province.name }}{{
item.addressRegion.city.name
}}{{ item.addressRegion.area.name }}{{ item.address }}</p>
</el-descriptions-item>
<el-descriptions-item label="文档">
<div v-for="(item, index) in info.contentList" :key="index">
<template v-if="item.files">
<a v-for="(file, fileIndex) in item.files" :key="fileIndex" :href="file"
target="_blank">预览:文件{{ fileIndex + 1 }}</a>
</template>
</div>
</el-descriptions-item>
<el-descriptions-item label="接收文件电子邮箱">
<span>{{ info.email }}</span>
</el-descriptions-item>
<el-descriptions-item label="接收文件微信">
<span>{{ info.wechat }}</span>
</el-descriptions-item>
<el-descriptions-item label="接收文件寄件地址">
<span v-if="info.receiveAddressRegion.province">{{
info.receiveAddressRegion.province.name
}}{{ info.receiveAddressRegion.city.name }}{{
info.receiveAddressRegion.area.name
}}{{ info.receiveAddress }}</span>
</el-descriptions-item>
<el-descriptions-item label="申请人">
<span>{{ info.requestName }}</span>
</el-descriptions-item>
<el-descriptions-item label="业务联系人">
<span>{{ info.contactName }}</span>
</el-descriptions-item>
<el-descriptions-item label="业务联系方式">
<span>{{ info.contact }}</span>
</el-descriptions-item>
<el-descriptions-item label="用户备注">
<span>{{ info.remark ? info.remark : '' }}</span>
</el-descriptions-item>
<el-descriptions-item label="接单公司" v-if="info.companyId">
<span>{{ info.company.company.companyName }}</span>
</el-descriptions-item>
<el-descriptions-item label="结果文件" v-if="orderInfo && orderInfo.resultFiles">
<div v-for="(item, index) in orderInfo.resultFiles" :key="index">
<a :href="item"
target="_blank">预览:文件{{ index + 1 }}</a>
</div>
</el-descriptions-item>
<el-descriptions-item label="发送途径" v-if="orderInfo && orderInfo.sendMethod"><span>{{
orderInfo.sendMethod
}}</span>
</el-descriptions-item>
</el-descriptions>
<template v-if="info && !info.companyId && isSet">
<p style="margin-top: 2rem">接单公司</p>
<el-row :gutter="10">
<el-col :span="6">
<el-select v-model="companyId" placeholder="请选择接单公司" style="width: 100%">
<el-option
v-for="(item, index) in companyList"
:disabled="item._id === info.uid"
:key="item.value"
:label="item.company.companyName"
:value="item._id">
</el-option>
</el-select>
</el-col>
<el-col :span="2">
<el-button type="primary" @click.native="setCompany" :disabled="!companyId">确定</el-button>
</el-col>
</el-row>
</template>
</div>
</template>
<script>
export default {
name: "selfProductInfo",
props: {
orderInfo: null,
orderId: null,
goods: null,
isSet: false,
},
data() {
return {
info: null,
companyId: null,
companyList: [],
}
},
methods: {
async getInfo() {
const {data} = await vk.callFunction({
url: 'admin/selfProduct/order/sys/getDetail',
data: {
orderId: this.orderId
}
})
this.info = data
},
async getCompanyList() {
const data = {type: 2, pageSize: 500}
if (this.info.type === 0) data.isCompanyQuote = true
else if (this.info.type === 1) data.isProductQuote = true
else if (this.info.type === 2) data.isCostQuote = true
const {rows} = await vk.callFunction({
url: 'admin/system/user/sys/getList',
data
})
this.companyList = rows.filter(item => item.company && item.company.companyName !== '' && item.company.companyName)
},
async setCompany() {
if (!this.companyId) return this.$message.error('请选择接单公司')
await vk.callFunction({
url: 'admin/selfProduct/order/sys/setCompany',
data: {
orderId: this.info.orderId,
companyId: this.companyId
}
})
this.close()
},
close() {
this.$emit('close')
}
},
async mounted() {
console.log(this.orderInfo)
await this.getInfo()
if (this.isSet) await this.getCompanyList()
}
}
</script>
+91
View File
@@ -0,0 +1,91 @@
<template>
<el-form ref="form" label-width="80px">
<template>
<el-form-item label="订单号">
{{ info.orderNo }}
</el-form-item>
<el-form-item label="收件人">
{{ info.name }}({{ info.phone }})
</el-form-item>
<el-form-item label="收货地址" v-if="info.address.area">
{{ info.address.province.name }} {{ info.address.city.name }} {{ info.address.area.name }} {{
info.address.addressDetail
}}
</el-form-item>
</template>
<el-form-item label="物流公司" required>
<el-input v-model="expressName" placeholder="请输入物流公司"/>
</el-form-item>
<el-form-item label="物流单号" required>
<el-input v-model="expressNo" placeholder="请输入物流单号"/>
</el-form-item>
<el-form-item label="发货单" required>
<vk-data-upload v-model="expressPhoto"></vk-data-upload>
</el-form-item>
<el-form-item label="备注">
<el-input v-model="remark" placeholder="请输入备注"/>
</el-form-item>
<div class="mt-20 flex justify-center items-center text-center">
<el-button type="primary" size="small" plain @click.native="cancel">取消</el-button>
<el-button type="primary" size="small" @click.native="confirm">确定</el-button>
</div>
</el-form>
</template>
<script>
export default {
name: "setExpress",
props: {
info: Object
},
data() {
return {
expressName: null,
expressNo: null,
remark: null,
expressPhoto: [],
}
},
methods: {
close() {
this.$emit('close')
},
cancel() {
this.expressName = null
this.expressNo = null
this.remark = null
this.expressPhoto = []
this.close()
},
async confirm() {
if (!this.expressName) return this.$message({
type: 'error',
message: '请填写物流公司'
})
if (!this.expressNo) return this.$message({
type: 'error',
message: '请填写物流单号'
})
if (this.expressPhoto.length === 0) return this.$message({
type: 'error',
message: '请上传发货单'
})
await vk.callFunction({
url: 'admin/order/sys/setExpress',
data: {
id: this.info._id,
expressName: this.expressName,
expressNo: this.expressNo,
remark: this.remark,
expressPhoto: this.expressPhoto
}
})
this.$emit('close')
this.$message({
type: 'success',
message: '发货成功'
})
}
}
}
</script>
+68
View File
@@ -0,0 +1,68 @@
<template>
<el-form ref="form" label-width="80px">
<template>
<el-form-item label="选择服务公司">
{{ info.orderNo }}
</el-form-item>
</template>
<div class="mt-20 flex justify-center items-center text-center">
<el-button type="primary" size="small" plain @click.native="cancel">取消</el-button>
<el-button type="primary" size="small" @click.native="confirm">确定</el-button>
</div>
</el-form>
</template>
<script>
export default {
name: "setSelfSupport",
props: {
info: Object
},
data() {
return {
sheet: null,
expressNo: null,
remark: null,
expressPhoto: [],
}
},
methods: {
async getInfo() {
const {data} = await vk.callFunction({
url: 'admin/selfProduct/order/sys/getDetail',
data: {
orderId: this.info.orderId
}
})
this.sheet = data
},
close() {
this.$emit('close')
},
cancel() {
this.close()
},
async confirm() {
await vk.callFunction({
url: 'admin/order/sys/setExpress',
data: {
id: this.info._id,
expressName: this.expressName,
expressNo: this.expressNo,
remark: this.remark,
expressPhoto: this.expressPhoto
}
})
this.$emit('close')
this.$message({
type: 'success',
message: '发货成功'
})
}
},
mounted() {
this.getInfo()
}
}
</script>
+836
View File
@@ -0,0 +1,836 @@
<template>
<view class="page-body">
<!-- 页面内容开始 -->
<!-- 表格搜索组件开始 -->
<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"
@search="search"></vk-data-table-query>
<!-- 表格搜索组件结束 -->
<!-- 自定义按钮区域开始 -->
<view>
<el-row>
</el-row>
</view>
<!-- 自定义按钮区域结束 -->
<!-- 表格组件开始 -->
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
:pagination="true" @current-change="currentChange"
>
<template v-slot:action="{ row, column, index }">
<el-button size="mini" @click.native="doShowInfo(row)">详情</el-button>
<el-button size="mini" @click.native="showQuoteList(row)" v-if="row.quoteNum > 0">报价列表</el-button>
<el-button size="mini" @click.native="showPayList(row)" v-if="row.payList">支付明细</el-button>
</template>
<template v-slot:isShow="{ row, column, index }">
<el-switch v-if="row.status === 0" v-model="row.isShow" size="mini"
@change="changeField(row._id, 'isShow', $event)"
:active-value="1"
:inactive-value="0"/>
<span v-else></span>
</template>
<template v-slot:quoteAmount="{ row, column, index }">
<el-input-number v-model="row.quoteAmount" @change="changeQuoteAmount($event, row._id)"/>
</template>
<template v-slot:notaryServiceRate="{ row, column, index }">
<view v-if="row.tradeMethod === 1" class="flex justify-start items-center">
<el-input-number style="width: 150px"
v-model="row.notaryServiceRate"
:min="0"
:precision="3"
:step="0.1"
:controls="false"
@change="changeNotaryServiceRate($event, row)"
/>
<text class="ml-10">%</text>
</view>
<span v-else></span>
</template>
<template v-slot:orderAmount="{ row, column, index }">
<p v-if="row.order">报价金额: ¥{{ row.order.amount }}</p>
<p v-if="row.payList">实付金额: ¥{{
row.payList.reduce((pre, cur) => (cur.hasPaid && !cur.buyerRefuse && cur.sellerConfirm) ? parseFloat(pre) + parseFloat(cur.amount) : pre, 0)
}}</p>
</template>
</vk-data-table>
<!-- 表格组件结束 -->
<!-- 添加或编辑的弹窗开始 -->
<vk-data-dialog v-model="form1.props.show" :title="form1.props.title" width="60%" mode="form"
:close-on-click-modal="false">
<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
:form-type="form1.props.formType" :columns='form1.props.columns' label-width="120px"
@success="form1.props.show = false;refresh();"></vk-data-form>
</vk-data-dialog>
<!-- 添加或编辑的弹窗结束 -->
<!-- 页面内容结束 -->
<vk-data-dialog
v-model="showInfo"
:title="title"
width="60%"
top="14vh"
center
:close-on-click-modal="true"
>
<vk-data-detail-table
:data="info"
:columns="infoColumns"
size="medium"
label-width="150px"
>
</vk-data-detail-table>
</vk-data-dialog>
<el-dialog title="图片预览" :visible.sync="showImagePreview" width="80%" append-to-body>
<img v-if="previewImageUrl" class="preview-image" :src="previewImageUrl" alt="附件预览"/>
</el-dialog>
<el-dialog title="PDF预览" :visible.sync="showPdfPreview" width="80%" append-to-body @closed="revokePdfPreviewUrl">
<iframe v-if="pdfPreviewUrl" class="pdf-preview-frame" :src="pdfPreviewUrl"></iframe>
</el-dialog>
<EnquiryQuoteList ref="EnquiryQuoteList"/>
<PayList ref="PayList"/>
</view>
</template>
<script>
import EnquiryQuoteList from "./components/EnquiryQuoteList.vue";
var that; // 当前页面对象
var vk = uni.vk; // vk实例
var originalForms = {}; // 表单初始化数据
import provinces from "@/uni_modules/vk-uview-ui/libs/address/provinces.json";
import citys from "@/uni_modules/vk-uview-ui/libs/address/citys.json";
import areas from "@/uni_modules/vk-uview-ui/libs/address/areas.json";
import PayList from "./components/PayList.vue";
import dayjs from "dayjs";
const DEFAULT_NOTARY_SERVICE_RATE = 0.1;
function formatNotaryServiceRate(rate, tradeMethod) {
if (tradeMethod !== 1) return "";
if (rate === undefined || rate === null || rate === "") return `${DEFAULT_NOTARY_SERVICE_RATE}%`;
return typeof rate === "string" && rate.includes("%") ? rate : `${rate}%`;
}
function getEnquiryProductList(row = {}, val = []) {
const otherCate = row.otherCate ? String(row.otherCate).trim() : "";
if (otherCate) {
return [{
goodsName: otherCate,
procureNumber: row.procureNumber,
procureUnit: row.procureUnit
}];
}
return Array.isArray(val) ? val : [];
}
function formatProductNames(val = [], row = {}) {
return getEnquiryProductList(row, val)
.map(item => `${item.goodsName || ""}${item.materialQuality ? `(${item.materialQuality})` : ""}`)
.filter(Boolean)
.join("/");
}
function formatProductAmount(val = [], row = {}) {
return getEnquiryProductList(row, val)
.map(item => `${item.procureNumber ? item.procureNumber : ""}${item.procureUnit ? item.procureUnit : ""}`)
.filter(Boolean)
.join("/");
}
function escapeHtml(value = "") {
return String(value)
.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;")
.replace(/'/g, "&#39;");
}
function formatPreviewLinks(files = []) {
if (!Array.isArray(files)) return "";
return files
.filter(Boolean)
.map((item, itemIndex) => {
const url = encodeURIComponent(item);
const label = escapeHtml(`预览:文件${itemIndex + 1}`);
return `<a href="javascript:;" onclick="window.__previewEnquiryFile && window.__previewEnquiryFile('${url}')">${label}</a> `;
})
.join("");
}
export default {
components: {PayList, EnquiryQuoteList},
data() {
// 页面数据变量
return {
showInfo: false,
info: null,
title: '',
showImagePreview: false,
previewImageUrl: '',
showPdfPreview: false,
pdfPreviewUrl: '',
pdfObjectUrl: '',
provinceData: provinces,
cityData: citys,
areaData: areas,
infoColumns: [
{key: "title", title: "标题", type: "text"},
{
key: "productList", title: "询价内容", type: "html",
formatter: (val = [], row, column, index) => {
let content = ''
getEnquiryProductList(row, val).forEach((item, itemIndex) => {
content += `<p>${item.goodsName} ${item.procureNumber}${item.procureUnit}`
if (item.deliverService) content += ` ,${item.deliverService}`
if (item.pricingForm) content += ` ,${item.pricingForm}`
if (item.loadPaidBy) content += ` ,${item.loadPaidBy}`
content += `</p>`
})
return content
}
},
{
key: "productList", title: "材质", type: "html",
formatter: (val = [], row, column, index) => {
let content = ''
val.forEach(item => {
content += `<div style="border-bottom: 1px solid gray;padding: 1rem 0">${item.goodsName}`
item.model.forEach(model => {
content += `<p>${model.label}: ${model.value}</p> `
})
content += '</div>'
})
return content
},
showRule: formData => {
return formData.fillType === 0
}
},
{
key: "files", title: "附件", type: "html",
formatter: (val = [], row, column, index) => {
return formatPreviewLinks(val)
}
},
{key: "remark", title: "采购商其他要求", type: "text"},
{
key: "multiFiles", title: "采购商其他要求(附件)", type: "html",
formatter: (val = [], row, column, index) => {
return formatPreviewLinks(val)
}
},
{
key: "invoice", title: "是否含税", type: "radio", data: [
{label: "含税", value: true},
{label: "不含税", value: false}
]
},
{
key: "writeInvoiceTime", title: "开票时间", type: "radio", data: [
{label: "付款当月(限20号之前付款,20号之后付款次月开票)", value: 0},
{label: "付款后次月", value: 1},
{label: "付款前", value: 2}
]
},
// {
// key: "invoiceType", title: "发票种类", type: "radio", data: [
// {label: "增值税专用发票13%", value: 0},
// {label: "增值税普通发票", value: 1},
// {label: "普通发票", value: 2}
// ]
// },
{
key: "taxType", title: "纳税人身份", type: "text", showRule: formData => {
return !!formData.invoiceOther
}
},
{
key: "invoiceType", title: "发票种类", type: "text", showRule: formData => {
return !!formData.invoiceOther
}
},
{
key: "taxRate", title: "税率", type: "text", showRule: formData => {
return !!formData.invoiceOther
}
},
{
key: "invoiceOther", title: "手动填写税票要求", type: "text", showRule: formData => {
console.log(formData)
return !!formData.taxType
}
},
{
key: "transportDocuments", title: "随货资料", type: "text", formatter: (val = [], row, column, index) => {
return val.join('、')
}
},
{key: "otherTransportDocuments", title: "运输其他要求", type: "text"},
{
key: "transportLimit", title: "运输限制", type: "radio", data: [
{label: "有", value: true},
{label: "无", value: false}
]
},
{
key: "tradeMethod", title: "交易模式", type: "radio", data: [
{label: "自主交易", value: 0},
{label: "金久信公证", value: 1},
]
},
{
key: "notaryServiceRate",
title: "公证服务费比例",
type: "text",
formatter: (val, row) => {
return formatNotaryServiceRate(val, row.tradeMethod)
},
showRule: formData => {
return formData.tradeMethod === 1
}
},
{
key: "payMethod", title: "付款方式", type: "radio", data: [
{label: "预付", value: 0},
{label: "货到验收后付款", value: 1},
{label: "提货付全款", value: 2},
{label: "信誉采购,货到签单后账期", value: 3},
{label: "其他付款方式", value: 4},
]
},
{
key: "offerType", title: "报价形式", type: "radio", data: [
{label: "整单报价", value: 0},
{label: "可分项报价", value: 1}
]
},
{
key: "answerStartTime", title: "报价时限(开始)", type: "text",
formatter: (val, row, column, index) => {
console.log(val)
return dayjs(val).format("YYYY-MM-DD HH:mm:ss")
}
},
{
key: "answerEndTime", title: "报价时限(结束)", type: "text",
formatter: (val, row, column, index) => {
return dayjs(val).format("YYYY-MM-DD HH:mm:ss")
}
},
{
key: "earnestMoney", title: "交保证金要求", type: "text",
formatter: (val, row, column, index) => {
return val === 'NaN' ? '' : val
}
},
{
key: "signMethod", title: "签约模式", type: "radio", data: [
{label: "线上签约-标准合同", value: 0},
{label: "线下签约", value: 1},
{label: "线上签约-双方协商合同", value: 2},
]
},
{key: "supplementary", title: "采购方补充条款", type: "text"},
{
key: "contract", title: "合同文件", type: "html",
formatter: (val = [], row, column, index) => {
return formatPreviewLinks(row.contract && row.contract.contractBase)
},
showRule: formData => {
return formData.signMethod === 2
}
},
// {
// key: "", title: "项目地址", type: "text"
// },
{
key: "companyName", title: "公司信息", type: "text"
},
{
key: "companyMobile", title: "公司联系方式", type: "text"
},
{
key: "businessName", title: "授权业务咨询人", type: "text"
},
{
key: "businessMobile", title: "业务咨询联系方式", type: "text"
},
{
key: "signName", title: "授权业务签收人", type: "text"
},
{
key: "signMobile", title: "授权业务签收人联系方式", type: "text"
},
{
key: "signIdCard", title: "授权业务签收人身份证号", type: "text"
},
],
// 页面是否请求中或加载中
loading: false,
// init请求返回的数据
data: {},
// 表格相关开始 -----------------------------------------------------------
table1: {
// 表格数据请求地址
action: "admin/enquiry/sys/getList",
// 表格字段显示规则
columns: [
{
key: "productList",
title: "品名/材质",
type: "text",
align: "left",
formatter: (val = [], row, column, index) => {
return formatProductNames(val, row);
}
},
{
key: "enquiryNo",
title: "单号",
type: "text",
align: "left",
width: 200,
},
{
key: "productList",
title: "采购量",
type: "text",
align: "left",
formatter: (val = [], row, column, index) => {
return formatProductAmount(val, row);
}
},
{
key: "addressRegion",
title: "收货地",
type: "text",
align: "left",
width: 200,
formatter: (val = [], row, column, index) => {
let fullAddress = ''
if (val && val.province) fullAddress = `${val.province.name}${val.city.name}${val.area.name}`
if (row.addressDetail) fullAddress = fullAddress + row.addressDetail
return fullAddress;
}
},
{
key: "",
title: "采购企业",
type: "text",
align: "left",
width: 220,
formatter: (val = [], row, column, index) => {
return row.user.accountType === 1 ? row.user.person.personName : row.user.company.companyName;
}
},
{
key: "",
title: "报价情况",
type: "text",
align: "left",
formatter: (val = [], row, column, index) => {
return `${row.quoteNum}家`
}
},
{
key: "status",
title: "状态",
type: "tag",
data: [
{value: 0, label: '待选商', tagType: 'danger'},
{value: 1, label: '已选商', tagType: 'primary'},
{value: 2, label: '已完成', tagType: 'success'},
]
},
{
key: "orderAmount",
title: "订单金额",
type: "html",
width: 160
},
{
key: "notaryServiceRate",
title: "公证服务费比例",
type: "html",
width: 200,
},
{key: "isShow", title: "是否显示", type: "html"},
{key: "quoteAmount", title: "单次报价金额", type: "html", width: 210,},
{
key: "_add_time",
title: "发布时间",
type: "time",
align: "left",
width: 160,
sortable: "custom"
},
{
key: "_add_time_diff",
title: "距离现在",
type: "html",
align: "left",
width: 120,
formatter: (val, row) => vk.pubfn.dateDiff(row._add_time)
},
{key: "action", title: "操作", type: "html", width: 280},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: ""
},
// 表格相关结束 -----------------------------------------------------------
// 表单相关开始 -----------------------------------------------------------
// 查询表单请求数据
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
{
key: "title",
title: "标题",
type: "text",
width: 160,
mode: "%%"
},
{
key: "status",
title: "状态",
type: "select",
width: 160,
data: [
{value: 0, label: '未选商'},
{value: 1, label: '已选商'},
{value: 2, label: '已完成'},
]
},
{
key: "signMethod",
title: "签约方式",
type: "select",
data: [
{value: 0, label: '线上签约-标准合同'},
{value: 1, label: '线下签约'},
{value: 2, label: '线上签约-双方协商合同'},
]
},
// {
// key: "remark",
// title: "备注",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "_add_time",
// title: "添加时间",
// type: "datetimerange",
// width: 400,
// mode: "[]"
// },
]
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
sort: 0
},
// 表单属性
props: {
// 表单请求地址
action: "",
// 表单字段显示规则
columns: [{
key: "name",
title: "名称",
type: "text",
placeholder: "请输入分类名称"
},
{
key: "icon",
title: "图标",
type: "icon",
placeholder: "请选择图标"
},
{
key: "parent_id",
title: "上级分类",
type: "tree-select",
placeholder: "请选择上级分类",
action: "admin/spot/category/sys/getTree",
props: {
list: "rows",
value: "_id",
label: "name",
children: "children"
},
},
{
key: "remark",
title: "备注",
type: "textarea",
maxlength: "99",
showWordLimit: true,
autosize: {
minRows: 2,
maxRows: 10
},
},
{
key: "sort",
title: "排序",
type: "number",
precision: 0,
placeholder: "请输入排序值",
},
],
// 表单验证规则
rules: {
sort: [{
type: 'number',
message: '排序值必须为数字'
}],
name: [
{required: true, message: '分类名称不能为空', trigger: 'blur'},
],
},
// add 代表添加 update 代表修改
formType: "",
// 是否显示表单的弹窗
show: false
}
},
// 其他弹窗表单
formDatas: {},
// 表单相关结束 -----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.registerFilePreviewHandler();
that.init(options);
},
onUnload() {
this.unregisterFilePreviewHandler();
},
beforeDestroy() {
this.unregisterFilePreviewHandler();
this.revokePdfPreviewUrl();
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {
},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {
},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {
},
// 函数
methods: {
// 页面数据初始化函数
init(options) {
originalForms["form1"] = vk.pubfn.copyObject(that.form1);
},
registerFilePreviewHandler() {
if (typeof window === "undefined") return
window.__previewEnquiryFile = encodedUrl => {
this.previewFile(decodeURIComponent(encodedUrl))
}
},
unregisterFilePreviewHandler() {
if (typeof window === "undefined") return
if (window.__previewEnquiryFile) delete window.__previewEnquiryFile
},
// 页面跳转
pageTo(path) {
vk.navigateTo(path);
},
// 表单重置
resetForm() {
vk.pubfn.resetForm(originalForms, that);
},
// 搜索
search() {
that.$refs.table1.search();
},
// 刷新
refresh() {
that.$refs.table1.refresh();
},
// 获取当前选中的行的数据
getCurrentRow() {
return that.$refs.table1.getCurrentRow();
},
// 监听 - 行的选中高亮事件
currentChange(val) {
that.table1.selectItem = val;
},
// 当选择项发生变化时会触发该事件
selectionChange(list) {
that.table1.multipleSelection = list;
},
// 显示添加页面
addBtn() {
that.resetForm();
that.form1.props.action = 'admin/contract/template/sys/add';
that.form1.props.formType = 'add';
that.form1.props.title = '添加';
that.form1.props.show = true;
},
// 显示修改页面
updateBtn({
item
}) {
that.form1.props.action = 'admin/contract/template/sys/update';
that.form1.props.formType = 'update';
that.form1.props.title = '编辑';
that.form1.props.show = true;
that.form1.data = item;
},
// 删除按钮
deleteBtn({
item,
deleteFn
}) {
deleteFn({
action: "admin/contract/template/sys/delete",
data: {
_id: item._id
},
});
},
// 监听 - 批量操作的按钮点击事件
batchBtn(index) {
switch (index) {
case 1:
vk.toast("批量操作按钮1");
break;
case 2:
vk.toast("批量操作按钮2");
break;
default:
break;
}
},
changeField(id, field, value) {
vk.callFunction({
url: 'admin/enquiry/sys/changeField',
data: {
id, field, value
}
}).then(() => {
this.$refs.table1.refresh()
})
},
doShowInfo(info) {
this.info = info
this.title = '详情'
this.showInfo = true
},
showQuoteList({_id}) {
this.$refs.EnquiryQuoteList.open(_id)
},
showPayList(row) {
this.$refs.PayList.open(row.payList)
},
changeQuoteAmount(value, id) {
this.changeField(id, 'quoteAmount', value)
},
changeNotaryServiceRate(value, row) {
const nextValue = value === undefined || value === null || value === '' ? DEFAULT_NOTARY_SERVICE_RATE : value
row.notaryServiceRate = nextValue
this.changeField(row._id, 'notaryServiceRate', nextValue)
},
getFileExt(url = "") {
const cleanUrl = String(url).split("?")[0].split("#")[0]
const match = cleanUrl.match(/\.([a-z0-9]+)$/i)
return match ? match[1].toLowerCase() : ""
},
isImageFile(url) {
return ["png", "jpg", "jpeg", "gif", "webp", "bmp", "svg"].includes(this.getFileExt(url))
},
isPdfFile(url) {
return this.getFileExt(url) === "pdf"
},
isOfficeFile(url) {
return ["doc", "docx", "xls", "xlsx", "ppt", "pptx"].includes(this.getFileExt(url))
},
getOfficePreviewUrl(url) {
return `https://view.officeapps.live.com/op/view.aspx?src=${encodeURIComponent(url)}`
},
revokePdfPreviewUrl() {
if (this.pdfObjectUrl) {
URL.revokeObjectURL(this.pdfObjectUrl)
this.pdfObjectUrl = ''
}
this.pdfPreviewUrl = ''
},
async previewPdfFile(url) {
this.revokePdfPreviewUrl()
try {
const response = await fetch(url)
if (!response.ok) throw new Error('PDF加载失败')
const blob = await response.blob()
this.pdfObjectUrl = URL.createObjectURL(new Blob([blob], {type: 'application/pdf'}))
this.pdfPreviewUrl = this.pdfObjectUrl
} catch (e) {
this.pdfPreviewUrl = `https://mozilla.github.io/pdf.js/web/viewer.html?file=${encodeURIComponent(url)}`
}
this.showPdfPreview = true
},
previewFile(url) {
if (!url) return
if (this.isImageFile(url)) {
this.previewImageUrl = url
this.showImagePreview = true
return
}
if (this.isPdfFile(url)) {
this.previewPdfFile(url)
return
}
if (this.isOfficeFile(url)) {
window.open(this.getOfficePreviewUrl(url), "_blank")
return
}
window.open(url, "_blank")
},
},
// 监听属性
watch: {},
// 过滤器
filters: {},
// 计算属性
computed: {}
};
</script>
<style lang="scss" scoped>
.page-body {
}
.preview-image {
display: block;
max-width: 100%;
max-height: 75vh;
margin: 0 auto;
}
.pdf-preview-frame {
display: block;
width: 100%;
height: 75vh;
border: 0;
}
</style>
+546
View File
@@ -0,0 +1,546 @@
<template>
<view class="page-body">
<!-- 页面内容开始 -->
<!-- 表格搜索组件开始 -->
<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"
@search="search"></vk-data-table-query>
<!-- 表格搜索组件结束 -->
<!-- 自定义按钮区域开始 -->
<view>
<el-row>
</el-row>
</view>
<!-- 自定义按钮区域结束 -->
<!-- 表格组件开始 -->
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
:pagination="true" @current-change="currentChange"
>
<template v-slot:action="{ row, column, index }">
<el-button type="primary" @click.native="showInvoice(row)">上传/查看发票</el-button>
</template>
<template v-slot:isInvoice="{ row, column, index }">
<el-switch v-model="row.isInvoice" :inactive-value="1" :active-value="2" active-text="已开" inactive-text="未开"
@change="changeField(row._id, 'isInvoice', $event)"></el-switch>
</template>
<template v-slot:invoice="{ row, column, index }">
<p>名称: {{ row.name }}</p>
<p>税号: {{ row.code }}</p>
<p>手机号: {{ row.phone }}</p>
<!-- <p>电子邮箱: {{ row.email }}</p>-->
<p>开户行: {{ row.bankName }}</p>
<p>银行账号: {{ row.bankAccount }}</p>
<!-- <p>单位地址: {{ row.address }}</p>-->
</template>
</vk-data-table>
<!-- 表格组件结束 -->
<!-- 添加或编辑的弹窗开始 -->
<vk-data-dialog v-model="form1.props.show" :title="form1.props.title" width="60%" mode="form"
:close-on-click-modal="false">
<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
:form-type="form1.props.formType" :columns='form1.props.columns' label-width="120px"
@success="form1.props.show = false;refresh();"></vk-data-form>
</vk-data-dialog>
<!-- 添加或编辑的弹窗结束 -->
<!-- 页面内容结束 -->
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="60%">
<set-express :info="clickInfo" @close="refresh" v-if="dialogVisible && dialogType === 'express'"/>
<order-info :info="clickInfo" @close="refresh" v-if="dialogVisible && dialogType === 'info'"/>
<self-product-info :order-info="clickInfo" :order-id="clickInfo._id" :goods="clickInfo.goods"
v-if="dialogVisible && dialogType === 'self-product'"/>
<template v-if="dialogVisible && dialogType === 'invoice'">
<vk-data-upload v-model="invoice" upload-type="file" list-type="text" :show-file-list="false"
:on-success="beforeUpload" accept=".pdf"></vk-data-upload>
<a href="javascript:;" v-if="clickInfo.invoiceUrl" style="margin-top: 10px" @click="previewFile(clickInfo.invoiceUrl)">预览</a>
</template>
</el-dialog>
<el-dialog title="图片预览" :visible.sync="showImagePreview" width="80%" append-to-body>
<img v-if="previewImageUrl" class="preview-image" :src="previewImageUrl" alt="发票预览"/>
</el-dialog>
</view>
</template>
<script>
import SetExpress from "./components/setExpress.vue";
import SelfProductInfo from "./components/selfProductInfo.vue";
import OrderInfo from "./components/OrderInfo.vue";
import dayjs from 'dayjs'
var that; // 当前页面对象
var vk = uni.vk; // vk实例
var originalForms = {}; // 表单初始化数据
export default {
components: {SelfProductInfo, SetExpress, OrderInfo},
data() {
// 页面数据变量
return {
showInfo: false,
dialogTitle: null,
dialogType: null,
dialogVisible: false,
showImagePreview: false,
previewImageUrl: '',
info: null,
clickInfo: null,
title: '',
infoColumns: [],
// 页面是否请求中或加载中
loading: false,
// init请求返回的数据
data: {},
invoice: [],
// 表格相关开始 -----------------------------------------------------------
table1: {
// 表格数据请求地址
action: "admin/order/sys/getList",
// 表格字段显示规则
columns: [
{
key: "orderNo",
title: "订单号",
type: "text",
},
{
key: "type",
title: "订单类型",
type: "select",
align: "center",
data: [
{value: 0, label: '商城订单'},
{value: 1, label: '金久信自营订单'},
{value: 2, label: '保证金'},
{value: 3, label: '会员升级'},
{value: 4, label: '询价订单'},
{value: 5, label: '加工订单'},
{value: 6, label: '旧货订单'},
{value: 7, label: '报价次数'},
{value: 8, label: '现货广告'},
{value: 9, label: '旧货加急'},
{value: 10, label: '旧货次数'},
{value: 11, label: '金久信学堂下载次数'},
{value: 12, label: '司法调证'},
{value: 13, label: '金久信签约宝次数'},
{value: 14, label: '金久信签约宝'},
{value: 15, label: '金久信自营询价'},
]
},
{
key: "amount",
title: "订单金额",
type: "html",
formatter: (val = [], row, column, index) => {
let content
if (row.type !== 14) {
content = `<div>订单金额:¥` + row.amount + `</div>`
content += `<div>应付金额:¥${row.offAmount}</div>`
if (row.type < 4 && row.payAmount) {
content += `<div>实付金额:¥${row.payAmount ? row.payAmount : ''}</div>`
}
} else {
content = `<div>订单累计金额:¥` + row.amount + `</div>`
}
return content
}
},
{
key: "orderStatus",
title: "订单状态",
type: "text",
align: "center",
formatter: (val = [], row, column, index) => {
const orderStatusList = [
'待支付',
'待发货',
'待收货',
'待完成',
'已完成',
'退款审核中',
'退款成功',
'退款拒绝',
'',
'',
'待报价',
'已派单待完成',
]
let str = orderStatusList[val]
if (val === 7) str += `: ${row.refundRefuseReason}`
return str
}
},
{
key: "isInvoice",
title: "开票状态",
type: "select",
data: [
{value: 1, label: '待开票'},
{value: 2, label: '已开票'},
]
},
{
key: "invoice",
title: "开票信息",
type: "html",
},
{
key: "action",
title: "操作",
type: "html",
}
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: ""
},
// 表格相关结束 -----------------------------------------------------------
// 表单相关开始 -----------------------------------------------------------
// 查询表单请求数据
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {
isInvoice: 1
},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
{
key: "orderNo",
title: "订单号",
type: "text",
width: 160,
mode: "%%"
},
{
key: "type",
title: "订单类型",
type: "select",
data: [
{value: 0, label: '商城订单'},
{value: 1, label: '金久信自营订单'},
{value: 2, label: '保证金'},
{value: 3, label: '会员升级'},
{value: 4, label: '询价订单'},
{value: 5, label: '加工订单'},
{value: 6, label: '旧货订单'},
{value: 7, label: '报价次数'},
{value: 8, label: '现货广告'},
{value: 9, label: '旧货加急'},
{value: 10, label: '旧货次数'},
{value: 11, label: '金久信学堂下载次数'},
{value: 12, label: '司法调证'},
{value: 13, label: '金久信签约宝次数'},
{value: 14, label: '金久信签约宝'},
{value: 15, label: '金久信自营询价'},
]
},
{
key: "isInvoice",
title: "开票状态",
type: "select",
data: [
{value: 1, label: '待开票'},
{value: 2, label: '已开票'},
]
},
]
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
invoiceUrl: ''
},
// 表单属性
props: {
// 表单请求地址
action: "",
// 表单字段显示规则
columns: [
{
key: "orderNo",
title: "订单号",
type: "text",
placeholder: "请输入分类名称"
},
{
key: "icon",
title: "图标",
type: "icon",
placeholder: "请选择图标"
},
{
key: "parent_id",
title: "上级分类",
type: "tree-select",
placeholder: "请选择上级分类",
action: "admin/spot/category/sys/getTree",
props: {
list: "rows",
value: "_id",
label: "name",
children: "children"
},
},
{
key: "remark",
title: "备注",
type: "textarea",
maxlength: "99",
showWordLimit: true,
autosize: {
minRows: 2,
maxRows: 10
},
},
{
key: "sort",
title: "排序",
type: "number",
precision: 0,
placeholder: "请输入排序值",
},
],
// 表单验证规则
rules: {
sort: [{
type: 'number',
message: '排序值必须为数字'
}],
name: [
{required: true, message: '分类名称不能为空', trigger: 'blur'},
],
},
// add 代表添加 update 代表修改
formType: "",
// 是否显示表单的弹窗
show: false
}
},
// 其他弹窗表单
formDatas: {},
// 表单相关结束 -----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {
},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {
},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {
},
// 函数
methods: {
dayjs,
// 页面数据初始化函数
init(options) {
originalForms["form1"] = vk.pubfn.copyObject(that.form1);
},
// 页面跳转
pageTo(path) {
vk.navigateTo(path);
},
// 表单重置
resetForm() {
vk.pubfn.resetForm(originalForms, that);
},
// 搜索
search() {
that.$refs.table1.search();
},
// 刷新
refresh() {
that.$refs.table1.refresh();
this.dialogVisible = false
},
// 获取当前选中的行的数据
getCurrentRow() {
return that.$refs.table1.getCurrentRow();
},
// 监听 - 行的选中高亮事件
currentChange(val) {
that.table1.selectItem = val;
},
// 当选择项发生变化时会触发该事件
selectionChange(list) {
that.table1.multipleSelection = list;
},
// 显示添加页面
addBtn() {
that.resetForm();
that.form1.props.action = 'admin/contract/template/sys/add';
that.form1.props.formType = 'add';
that.form1.props.title = '添加';
that.form1.props.show = true;
},
// 显示修改页面
updateBtn({
item
}) {
that.form1.props.action = 'admin/contract/template/sys/update';
that.form1.props.formType = 'update';
that.form1.props.title = '编辑';
that.form1.props.show = true;
that.form1.data = item;
},
// 删除按钮
deleteBtn({
item,
deleteFn
}) {
deleteFn({
action: "admin/contract/template/sys/delete",
data: {
_id: item._id
},
});
},
// 监听 - 批量操作的按钮点击事件
batchBtn(index) {
switch (index) {
case 1:
vk.toast("批量操作按钮1");
break;
case 2:
vk.toast("批量操作按钮2");
break;
default:
break;
}
},
changeField(id, field, value) {
vk.callFunction({
url: 'admin/order/sys/changeField',
data: {
id, field, value
}
}).then(() => {
this.$refs.table1.refresh()
})
},
doShowInfo(info) {
this.info = info
this.title = '详情'
this.showInfo = true
},
setExpress(item) {
this.clickInfo = item
this.dialogType = 'express'
this.dialogTitle = '发货'
this.dialogVisible = true
},
showSelfProductInfo(item) {
this.clickInfo = item
this.dialogType = 'self-product'
this.dialogTitle = '自营订单详情'
this.dialogVisible = true
},
showOrderInfo(item) {
this.clickInfo = item
this.dialogType = 'info'
this.dialogTitle = '订单详情'
this.dialogVisible = true
},
showInvoice(item) {
this.clickInfo = item
this.invoice = (this.clickInfo.invoiceUrl) ? [this.clickInfo.invoiceUrl] : []
this.dialogType = 'invoice'
this.dialogTitle = '发票'
this.dialogVisible = true
},
changeOrderStatus(id, value) {
vk.callFunction({
url: 'admin/order/sys/changeField',
data: {
id,
field: 'orderStatus',
value
}
}).then(() => {
this.$refs.table1.refresh()
})
},
beforeUpload(file) {
vk.callFunction({
url: 'admin/order/sys/changeField',
data: {
id: this.clickInfo._id,
field: 'invoiceUrl',
value: this.invoice[this.invoice.length - 1]
}
})
this.dialogVisible = false
this.$message.success('上传成功')
this.$refs.table1.refresh()
},
uploadInvoice(row) {
console.log(row)
},
getFileExt(url = "") {
const cleanUrl = String(url).split("?")[0].split("#")[0]
const match = cleanUrl.match(/\.([a-z0-9]+)$/i)
return match ? match[1].toLowerCase() : ""
},
isImageFile(url) {
return ["png", "jpg", "jpeg", "gif", "webp", "bmp", "svg"].includes(this.getFileExt(url))
},
isPdfFile(url) {
return this.getFileExt(url) === "pdf"
},
isOfficeFile(url) {
return ["doc", "docx", "xls", "xlsx", "ppt", "pptx"].includes(this.getFileExt(url))
},
getOfficePreviewUrl(url) {
return `https://view.officeapps.live.com/op/view.aspx?src=${encodeURIComponent(url)}`
},
previewFile(url) {
if (!url) return
if (this.isImageFile(url)) {
this.previewImageUrl = url
this.showImagePreview = true
return
}
if (this.isPdfFile(url)) {
window.open(url, "_blank")
return
}
if (this.isOfficeFile(url)) {
window.open(this.getOfficePreviewUrl(url), "_blank")
return
}
window.open(url, "_blank")
}
},
// 监听属性
watch: {},
// 过滤器
filters: {},
// 计算属性
computed: {}
};
</script>
<style lang="scss" scoped>
.page-body {
}
.preview-image {
display: block;
max-width: 100%;
max-height: 75vh;
margin: 0 auto;
}
</style>
+898
View File
@@ -0,0 +1,898 @@
<template>
<view class="page-body">
<!-- 页面内容开始 -->
<!-- 表格搜索组件开始 -->
<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"
@search="search"></vk-data-table-query>
<!-- 表格搜索组件结束 -->
<!-- 自定义按钮区域开始 -->
<view>
<el-row>
</el-row>
</view>
<!-- 自定义按钮区域结束 -->
<!-- 表格组件开始 -->
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
:pagination="true" @current-change="currentChange"
>
<template v-slot:action="{ row, column, index }">
<el-button size="mini" @click.native="doShowInfo(row)">详情</el-button>
<el-button size="mini" @click.native="showQuoteList(row)" v-if="row.quoteNum > 0">报价列表</el-button>
</template>
<template v-slot:isShow="{ row, column, index }">
<el-switch v-if="row.status === 0" v-model="row.isShow" size="mini"
@change="changeField(row._id, 'isShow', $event)" :active-value="1"
:inactive-value="0"/>
<span v-else></span>
</template>
<template v-slot:isUrgent="{ row, column, index }">
<el-switch v-if="row.status === 0" v-model="row.isUrgent" size="mini"
@change="changeField(row._id, 'isUrgent', $event)" :active-value="true"
:inactive-value="false"/>
<span v-else></span>
</template>
<template v-slot:quoteAmount="{ row, column, index }">
<el-input-number v-model="row.quoteAmount" @change="changeQuoteAmount($event, row._id)"/>
</template>
</vk-data-table>
<!-- 表格组件结束 -->
<!-- 添加或编辑的弹窗开始 -->
<vk-data-dialog v-model="form1.props.show" :title="form1.props.title" width="60%" mode="form"
:close-on-click-modal="false">
<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
:form-type="form1.props.formType" :columns='form1.props.columns' label-width="120px"
@success="form1.props.show = false;refresh();"></vk-data-form>
</vk-data-dialog>
<!-- 添加或编辑的弹窗结束 -->
<!-- 页面内容结束 -->
<vk-data-dialog
v-model="showInfo"
:title="title"
width="60%"
top="14vh"
center
:close-on-click-modal="true"
>
<div style="display: flex;align-items: flex-start;flex-direction: column;justify-content: flex-start;"
v-if="showInfo && info">
<div class="row">
<span class="title">类型</span>
<span v-if="info.type === 0">拍卖</span>
<span v-if="info.type === 1">采购</span>
<span v-if="info.type === 2">租赁</span>
<span v-if="info.type === 3">物资回收</span>
</div>
<div class="row" v-if="info.type === 2">
<span class="title">租赁类型</span>
<span v-if="info.rentType === 0">承租信息</span>
<span v-if="info.rentType === 1">出租信息</span>
</div>
<div class="row">
<span class="title">分类</span>
<span>{{ info.category }}</span>
</div>
<div class="row">
<span class="title">标题</span>
<span>{{ info.title }}</span>
</div>
<div class="row">
<span class="title">详情</span>
<span>{{ info.desc }}</span>
</div>
<div class="row">
<span class="title">附件</span>
<a href="javascript:;" v-for="(item, index) in info.files" :key="index" @click="previewFile(item)">预览:文件{{ index + 1 }}</a>
</div>
<div class="row">
<span class="title">物资所在地</span>
<span>{{
(info.addressRegion && info.addressRegion.province && info.addressRegion.province.name) ? `${info.addressRegion.province.name}${info.addressRegion.city.name}${info.addressRegion.area.name}` : ''
}}</span>
</div>
<div class="row">
<span class="title">物资交货地</span>
<span>{{
(info.deliverAddressRegion && info.deliverAddressRegion.province && info.deliverAddressRegion.province.name) ? `${info.deliverAddressRegion.province.name}${info.deliverAddressRegion.city.name}${info.deliverAddressRegion.area.name}` : ''
}}</span>
</div>
<div class="row">
<span class="title">报价区域</span>
<span>{{
(info.offerAddressRegion && info.offerAddressRegion.province && info.offerAddressRegion.province.name) ? `${info.offerAddressRegion.province.name}${info.offerAddressRegion.city.name}${info.offerAddressRegion.area.name}` : ''
}}</span>
</div>
<div class="row">
<span class="title">起拍计价单位</span>
<span>{{ info.unit }}</span>
</div>
<div class="row">
<span class="title">起拍人民币单价</span>
<span>{{ info.startAmount }}</span>
</div>
<div class="row">
<span class="title">拍卖信息失效时间</span>
<span>{{ dayjs(info.expiredTime).format('YYYY-MM-DD HH:mm:ss') }}</span>
</div>
<div class="row">
<span class="title">付款方式</span>
<span>{{ info.payMethod }}</span>
</div>
<div class="row">
<span class="title">预付比例</span>
<span>{{ info.prePayRate }}%</span>
</div>
<div class="row">
<span class="title">是否含税</span>
<span v-if="info.invoice">含税</span>
<span v-else>不含税</span>
</div>
<div class="row">
<span class="title">开票时间</span>
<span v-if="info.writeInvoiceTime === 0">付款当月(限20号之前付款,20号之后付款次月开票)</span>
<span v-if="info.writeInvoiceTime === 1">付款后次月</span>
<span v-if="info.writeInvoiceTime === 2">付款前</span>
</div>
<template v-if="!info.invoiceOther">
<div class="row">
<span class="title">纳税人身份</span>
<span>{{ info.taxType }}</span>
</div>
<div class="row">
<span class="title">发票种类</span>
<span>{{ info.invoiceType }}</span>
</div>
<div class="row">
<span class="title">税率</span>
<span>{{ info.taxRate }}</span>
</div>
</template>
<div class="row">
<span class="title">手动填写税票要求</span>
<span>{{ info.invoiceOther }}</span>
</div>
<div class="row">
<span class="title">报价详情</span>
<span>{{ info.invoiceDetail }}</span>
</div>
<div class="row">
<span class="title">报价失效时间</span>
<span>{{ info.offerExpiredTime }}</span>
</div>
<div class="row">
<span class="title">报价形式</span>
<span v-if="info.offerType === 0">整单报价</span>
<span v-if="info.offerType === 1">可分项报价</span>
</div>
<div class="row">
<span class="title">签约模式</span>
<span v-if="info.signMethod === 0">线上签约-标准合同</span>
<span v-if="info.signMethod === 1">线下签约</span>
<span v-if="info.signMethod === 2">线上签约-双方协商合同</span>
</div>
<div class="row" v-if="info.signMethod === 2">
<span class="title">合同文件</span>
<template v-if="info.contract && info.contract.contractBase">
<a href="javascript:;" v-for="(item, index) in getFileList(info.contract.contractBase)" :key="index" @click="previewFile(item)">预览文件{{ getFileList(info.contract.contractBase).length > 1 ? index + 1 : '' }}</a>
</template>
</div>
<template v-if="info.type !== 2">
<div class="row">
<span class="title">供应商信息</span>
<span>{{ info.supplier ? info.supplier.companyName : '' }}</span>
</div>
<div class="row">
<span class="title">供应商联系方式</span>
<span>{{ info.supplier ? info.supplier.contract : '' }}</span>
</div>
<div class="row">
<span class="title">供应商授权人姓名</span>
<span>{{ info.supplier ? info.supplier.managerName : '' }}</span>
</div>
<div class="row">
<span class="title">供应商授权联系方式</span>
<span>{{ info.supplier ? info.supplier.managerContract : ''}}</span>
</div>
<div class="row">
<span class="title">采购商信息</span>
<span>{{ info.buyer? info.buyer.companyName : '' }}</span>
</div>
<div class="row">
<span class="title">采购商联系方式</span>
<span>{{ info.buyer ? info.buyer.contract : '' }}</span>
</div>
<div class="row">
<span class="title">采购授权人姓名</span>
<span>{{ info.buyer ? info.buyer.managerName : '' }}</span>
</div>
<div class="row">
<span class="title">采购商授权联系方式</span>
<span>{{ info.buyer ? info.buyer.managerContract : ''}}</span>
</div>
</template>
<template v-else>
<div class="row">
<span class="title">{{ info.rentType === 0 ? '承租方' : '出租方' }}信息</span>
<span>{{ info.supplier? info.supplier.companyName : '' }}</span>
</div>
<div class="row">
<span class="title">{{ info.rentType === 0 ? '承租方' : '出租方' }}联系方式</span>
<span>{{ info.supplier ? info.supplier.contract : '' }}</span>
</div>
<div class="row">
<span class="title">{{ info.rentType === 0 ? '承租方' : '出租方' }}授权人姓名</span>
<span>{{ info.supplier ? info.supplier.managerName : '' }}</span>
</div>
<div class="row">
<span class="title">{{ info.rentType === 0 ? '承租方' : '出租方' }}授权联系方式</span>
<span>{{ info.supplier ? info.supplier.managerContract : '' }}</span>
</div>
</template>
</div>
<!-- <vk-data-detail-table-->
<!-- :data="info"-->
<!-- size="medium"-->
<!-- label-width="150px"-->
<!-- >-->
<!-- <template v-slot:columns="{ column, index }"> -->
<!-- </template>-->
<!-- </vk-data-detail-table>-->
</vk-data-dialog>
<el-dialog title="图片预览" :visible.sync="showImagePreview" width="80%" append-to-body>
<img v-if="previewImageUrl" class="preview-image" :src="previewImageUrl" alt="附件预览"/>
</el-dialog>
<el-dialog title="PDF预览" :visible.sync="showPdfPreview" width="80%" append-to-body @closed="revokePdfPreviewUrl">
<iframe v-if="pdfPreviewUrl" class="pdf-preview-frame" :src="pdfPreviewUrl"></iframe>
</el-dialog>
<OldQuoteList ref="OldQuoteList"/>
</view>
</template>
<script>
import OldQuoteList from "./components/OldQuoteList.vue";
import dayjs from "dayjs";
var that; // 当前页面对象
var vk = uni.vk; // vk实例
var originalForms = {}; // 表单初始化数据
function escapeHtml(value = "") {
return String(value)
.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;")
.replace(/'/g, "&#39;");
}
function formatPreviewLinks(files = []) {
const list = Array.isArray(files) ? files : (files ? [files] : []);
return list
.filter(Boolean)
.map((item, itemIndex) => {
const url = encodeURIComponent(item);
const label = escapeHtml(`预览:文件${itemIndex + 1}`);
return `<a href="javascript:;" onclick="window.__previewOldFile && window.__previewOldFile('${url}')">${label}</a> `;
})
.join("");
}
export default {
components: {OldQuoteList},
data() {
// 页面数据变量
return {
showInfo: false,
info: null,
title: '',
showImagePreview: false,
previewImageUrl: '',
showPdfPreview: false,
pdfPreviewUrl: '',
pdfObjectUrl: '',
infoColumns: [
{
key: "type", title: "类型", type: "select",
data: [
{value: 0, label: '拍卖'},
{value: 1, label: '采购'},
{value: 2, label: '租赁'},
{value: 3, label: '物资回收'},
]
},
{
key: "rentType", title: "租赁类型", type: "select",
data: [
{value: 0, label: '拍卖'},
{value: 1, label: '采购'},
{value: 2, label: '租赁'},
{value: 3, label: '物资回收'},
],
show: formData => {
return formData.type === 2
}
},
{
key: "category", title: "分类", type: "array",
},
{key: "title", title: "标题", type: "text"},
{key: "desc", title: "详情", type: "text"},
{
key: "files", title: "附件", type: "html",
formatter: (val = [], row, column, index) => {
return formatPreviewLinks(val)
}
},
{
key: "addressRegion",
title: "物资所在地",
type: "address",
formatter: (val, row, column, index) => {
return `${val.province.name}`
}
},
{
key: "deliverAddressRegion",
title: "物资交货地",
type: "text",
formatter: (val, row, column, index) => {
return `${val.province.name} ${val.city.name} ${val.area.name} ${row.deliverAddressDetail}`
},
showRule: formData => {
return [1, 2].includes(formData.type)
}
},
{
key: "offerAddressRegion",
title: "报价区域",
type: "address"
},
{
key: "unit", title: "起拍计价单位", type: "text",
// formatter: (val, row, column, index) => {
// return `${row.startNum ? row.startNum : ''} ${row.unit ? row.unit : ''}`
// },
},
{
key: "startAmount", title: "起拍人民币单价", type: "text",
formatter: (val, row, column, index) => {
return val ? `${val}元` : ''
},
},
{key: "expiredTime", title: "拍卖信息失效时间", type: "text"},
{
key: "payMethod", title: "付款方式", type: "text",
},
{
key: "prePayRate", title: "预付比例", type: "text",
},
{
key: "invoice", title: "是否含税", type: "radio", data: [
{label: "含税", value: true},
{label: "不含税", value: false}
]
},
{
key: "writeInvoiceTime", title: "开票时间", type: "radio", data: [
{label: "付款当月(限20号之前付款,20号之后付款次月开票)", value: 0},
{label: "付款后次月", value: 1},
{label: "付款前", value: 2}
]
},
// {
// key: "invoiceType", title: "发票种类", type: "radio", data: [
// {label: "增值税专用发票13%", value: 0},
// {label: "增值税普通发票", value: 1},
// {label: "普通发票", value: 2}
// ]
// },
// {key: "invoiceOther", title: "发票其他要求", type: "text"},
{
key: "taxType", title: "纳税人身份", type: "text", showRule: formData => {
return !!formData.invoiceOther
}
},
{
key: "invoiceType", title: "发票种类", type: "text", showRule: formData => {
return !!formData.invoiceOther
}
},
{
key: "taxRate", title: "税率", type: "text", showRule: formData => {
return !!formData.invoiceOther
}
},
{
key: "invoiceOther", title: "手动填写税票要求", type: "text", showRule: formData => {
console.log(formData)
return !!formData.taxType
}
},
{key: "invoiceDetail", title: "报价详情", type: "text"},
{key: "offerExpiredTime", title: "报价失效时间", type: "time"},
{
key: "offerType", title: "报价形式", type: "radio", data: [
{label: "整单报价", value: 0},
{label: "可分项报价", value: 1}
]
},
{
key: "signMethod", title: "签约模式", type: "radio", data: [
{label: "线上签约-标准合同", value: 0},
{label: "线下签约", value: 1},
{label: "线上签约-双方协商合同", value: 2},
]
},
{key: "supplier.companyName", title: "供应商信息", type: "text"},
{key: "supplier.contract", title: "供应商联系方式", type: "text"},
{key: "supplier.managerName", title: "供应商授权人姓名", type: "text"},
{key: "supplier.managerContract", title: "供应商授权联系方式", type: "text"},
{key: "buyer.companyName", title: "采购商信息", type: "text"},
{key: "buyer.contract", title: "采购商联系方式", type: "text"},
{key: "buyer.managerName", title: "采购授权人姓名", type: "text"},
{key: "buyer.managerContract", title: "采购商授权联系方式", type: "text"},
],
// 页面是否请求中或加载中
loading: false,
// init请求返回的数据
data: {},
// 表格相关开始 -----------------------------------------------------------
table1: {
// 表格数据请求地址
action: "admin/old/sys/getList",
// 表格字段显示规则
columns: [
{
key: "title",
title: "标题",
type: "text",
align: "left",
width: 200
},
{
key: "type",
title: "类型",
type: "select",
data: [
{value: 0, label: '拍卖'},
{value: 1, label: '采购'},
{value: 2, label: '租赁'},
{value: 3, label: '物资回收'},
]
},
{
key: "rentType", title: "租赁类型", type: "select",
data: [
{value: 0, label: '承租信息'},
{value: 1, label: '出租信息'},
],
showRow: (row) => {
return row.type === 2
}
},
{
key: "category",
title: "分类",
type: "text",
align: "left",
width: 180,
formatter: (val, row, column, index) => {
return val[1]
}
},
{
key: "",
title: "报价情况",
type: "text",
align: "left",
formatter: (val = [], row, column, index) => {
return `${row.quoteNum}家`
}
},
{
key: "status",
title: "状态",
type: "tag",
data: [
{value: 0, label: '未选商'},
{value: 1, label: '已选商', tagType: 'danger'},
{value: 2, label: '已完成', tagType: 'success'},
]
},
{key: "isUrgent", title: "是否加急", type: "html"},
{key: "isShow", title: "是否显示", type: "html"},
{key: "quoteAmount", title: "单次报价金额", type: "html", width: 210,},
{
key: "_add_time",
title: "添加时间",
type: "time",
align: "left",
width: 160,
sortable: "custom"
},
{
key: "_add_time_diff",
title: "距离现在",
type: "html",
align: "left",
width: 120,
formatter: (val, row) => vk.pubfn.dateDiff(row._add_time)
},
{key: "action", title: "操作", type: "html", width: 220,},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: ""
},
// 表格相关结束 -----------------------------------------------------------
// 表单相关开始 -----------------------------------------------------------
// 查询表单请求数据
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
{
key: "title",
title: "标题",
type: "text",
width: 160,
mode: "%%"
},
{
key: "type",
title: "类型",
type: "select",
data: [
{value: 0, label: '拍卖'},
{value: 1, label: '采购'},
{value: 2, label: '租赁'},
{value: 3, label: '物资回收'},
]
},
{
key: "rentType", title: "租赁类型", type: "select",
data: [
{value: 0, label: '承租信息'},
{value: 1, label: '出租信息'},
],
showRow: (row) => {
return row.type === 2
}
},
{
key: "status",
title: "状态",
type: "select",
data: [
{value: 0, label: '未选商'},
{value: 1, label: '已选商'},
{value: 2, label: '已完成'},
]
},
{
key: "signMethod",
title: "签约方式",
type: "select",
data: [
{value: 0, label: '线上签约-标准合同'},
{value: 1, label: '线下签约'},
{value: 2, label: '线上签约-双方协商合同'},
]
},
]
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
sort: 0
},
// 表单属性
props: {
// 表单请求地址
action: "",
// 表单字段显示规则
columns: [{
key: "name",
title: "名称",
type: "text",
placeholder: "请输入分类名称"
},
{
key: "icon",
title: "图标",
type: "icon",
placeholder: "请选择图标"
},
{
key: "parent_id",
title: "上级分类",
type: "tree-select",
placeholder: "请选择上级分类",
action: "admin/spot/category/sys/getTree",
props: {
list: "rows",
value: "_id",
label: "name",
children: "children"
},
},
{
key: "remark",
title: "备注",
type: "textarea",
maxlength: "99",
showWordLimit: true,
autosize: {
minRows: 2,
maxRows: 10
},
},
{
key: "sort",
title: "排序",
type: "number",
precision: 0,
placeholder: "请输入排序值",
},
],
// 表单验证规则
rules: {
sort: [{
type: 'number',
message: '排序值必须为数字'
}],
name: [
{required: true, message: '分类名称不能为空', trigger: 'blur'},
],
},
// add 代表添加 update 代表修改
formType: "",
// 是否显示表单的弹窗
show: false
}
},
// 其他弹窗表单
formDatas: {},
// 表单相关结束 -----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.registerFilePreviewHandler();
that.init(options);
},
onUnload() {
this.unregisterFilePreviewHandler();
},
beforeDestroy() {
this.unregisterFilePreviewHandler();
this.revokePdfPreviewUrl();
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {
},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {
},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {
},
// 函数
methods: {
dayjs,
// 页面数据初始化函数
init(options) {
originalForms["form1"] = vk.pubfn.copyObject(that.form1);
},
registerFilePreviewHandler() {
if (typeof window === "undefined") return
window.__previewOldFile = encodedUrl => {
this.previewFile(decodeURIComponent(encodedUrl))
}
},
unregisterFilePreviewHandler() {
if (typeof window === "undefined") return
if (window.__previewOldFile) delete window.__previewOldFile
},
getFileList(files) {
return Array.isArray(files) ? files : (files ? [files] : [])
},
// 页面跳转
pageTo(path) {
vk.navigateTo(path);
},
// 表单重置
resetForm() {
vk.pubfn.resetForm(originalForms, that);
},
// 搜索
search() {
that.$refs.table1.search();
},
// 刷新
refresh() {
that.$refs.table1.refresh();
},
// 获取当前选中的行的数据
getCurrentRow() {
return that.$refs.table1.getCurrentRow();
},
// 监听 - 行的选中高亮事件
currentChange(val) {
that.table1.selectItem = val;
},
// 当选择项发生变化时会触发该事件
selectionChange(list) {
that.table1.multipleSelection = list;
},
// 显示添加页面
addBtn() {
that.resetForm();
that.form1.props.action = 'admin/contract/template/sys/add';
that.form1.props.formType = 'add';
that.form1.props.title = '添加';
that.form1.props.show = true;
},
// 显示修改页面
updateBtn({
item
}) {
that.form1.props.action = 'admin/contract/template/sys/update';
that.form1.props.formType = 'update';
that.form1.props.title = '编辑';
that.form1.props.show = true;
that.form1.data = item;
},
// 删除按钮
deleteBtn({
item,
deleteFn
}) {
deleteFn({
action: "admin/contract/template/sys/delete",
data: {
_id: item._id
},
});
},
// 监听 - 批量操作的按钮点击事件
batchBtn(index) {
switch (index) {
case 1:
vk.toast("批量操作按钮1");
break;
case 2:
vk.toast("批量操作按钮2");
break;
default:
break;
}
},
changeField(id, field, value) {
vk.callFunction({
url: 'admin/old/sys/changeField',
data: {
id, field, value
}
}).then(() => {
this.$refs.table1.refresh()
})
},
doShowInfo(info) {
this.info = info
this.title = '详情'
this.showInfo = true
},
showQuoteList({_id}) {
this.$refs.OldQuoteList.open(_id)
},
changeQuoteAmount(value, id) {
this.changeField(id, 'quoteAmount', value)
},
getFileExt(url = "") {
const cleanUrl = String(url).split("?")[0].split("#")[0]
const match = cleanUrl.match(/\.([a-z0-9]+)$/i)
return match ? match[1].toLowerCase() : ""
},
isImageFile(url) {
return ["png", "jpg", "jpeg", "gif", "webp", "bmp", "svg"].includes(this.getFileExt(url))
},
isPdfFile(url) {
return this.getFileExt(url) === "pdf"
},
isOfficeFile(url) {
return ["doc", "docx", "xls", "xlsx", "ppt", "pptx"].includes(this.getFileExt(url))
},
getOfficePreviewUrl(url) {
return `https://view.officeapps.live.com/op/view.aspx?src=${encodeURIComponent(url)}`
},
revokePdfPreviewUrl() {
if (this.pdfObjectUrl) {
URL.revokeObjectURL(this.pdfObjectUrl)
this.pdfObjectUrl = ''
}
this.pdfPreviewUrl = ''
},
async previewPdfFile(url) {
this.revokePdfPreviewUrl()
try {
const response = await fetch(url)
if (!response.ok) throw new Error('PDF加载失败')
const blob = await response.blob()
this.pdfObjectUrl = URL.createObjectURL(new Blob([blob], {type: 'application/pdf'}))
this.pdfPreviewUrl = this.pdfObjectUrl
} catch (e) {
this.pdfPreviewUrl = `https://mozilla.github.io/pdf.js/web/viewer.html?file=${encodeURIComponent(url)}`
}
this.showPdfPreview = true
},
previewFile(url) {
if (!url) return
if (this.isImageFile(url)) {
this.previewImageUrl = url
this.showImagePreview = true
return
}
if (this.isPdfFile(url)) {
this.previewPdfFile(url)
return
}
if (this.isOfficeFile(url)) {
window.open(this.getOfficePreviewUrl(url), "_blank")
return
}
window.open(url, "_blank")
},
},
// 监听属性
watch: {},
// 过滤器
filters: {},
// 计算属性
computed: {}
};
</script>
<style lang="scss" scoped>
.row {
display: flex;
align-items: center;
justify-content: flex-start;
border: 1px solid #F5F7F9;
width: 100%;
* {
padding: 20px;
}
.title {
font-weight: bold;
background-color: #F5F7F9;
width: 300px;
}
}
.preview-image {
display: block;
max-width: 100%;
max-height: 75vh;
margin: 0 auto;
}
.pdf-preview-frame {
display: block;
width: 100%;
height: 75vh;
border: 0;
}
</style>
+539
View File
@@ -0,0 +1,539 @@
<template>
<view class="page-body">
<!-- 页面内容开始 -->
<!-- 表格搜索组件开始 -->
<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"
@search="search"></vk-data-table-query>
<!-- 表格搜索组件结束 -->
<!-- 自定义按钮区域开始 -->
<view>
<el-row>
</el-row>
</view>
<!-- 自定义按钮区域结束 -->
<!-- 表格组件开始 -->
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
:pagination="true" @current-change="currentChange"
>
<template v-slot:action="{ row, column, index }">
<template v-if="row.type === 0 && row.orderStatus === 1">
<!-- <el-button type="success" size="mini" @click.native="setExpress(row)">发货</el-button>-->
</template>
<template v-if="row.type === 0">
<el-button size="mini" @click.native="showOrderInfo(row)">详情</el-button>
<!-- <template v-if="[5, 7].includes(row.orderStatus)">-->
<!-- <el-button size="mini" type="success" @click.native="changeOrderStatus(row._id, 6)">同意退款-->
<!-- </el-button>-->
<!-- <el-button size="mini" type="danger" @click.native="changeOrderStatus(row._id, 7)">拒绝退款-->
<!-- </el-button>-->
<!-- </template>-->
</template>
<template v-if="row.type === 1">
<el-button size="mini" plain @click.native="showSelfProductInfo(row)">详情</el-button>
</template>
</template>
<template v-slot:goods="{ row, column, index }">
<div v-for="(item, index) in row.goods" :key="index" style="
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: flex-start;">
<p>商品名称: {{ item.goodsName }}</p>
<p v-if="row.type === 0 && formatSku(item.sku)">规格: {{ formatSku(item.sku) }}</p>
<p>数量: x{{ item.num }}</p>
<p>单价: {{ item.goodsPrice }}元</p>
<template v-if="row.type === 7 && item.isSingleQuote">
<view v-if="item.type === 'enquiry'">报价类型:找买家</view>
<view v-if="item.type === 'old'">报价类型:旧货交易</view>
<view v-if="item.type === 'process'">报价类型:找加工</view>
<view>报价内容:{{ item.sheet.title }}</view>
</template>
<template v-if="row.type === 7 && !item.isSingleQuote">
<view class="flex justify-start items-center">
<span>{{ item.goodsName }}</span>
<span class="text-main">(过期时间:{{
dayjs(row.user.quoteExpiredAt).format('YYYY-MM-DD HH:mm:ss')
}})</span>
</view>
</template>
<p v-if="row.type === 0 && item.company">所属公司: {{ item.company.company.companyName }}</p>
<el-divider v-if="index < row.goods.length - 1"/>
</div>
</template>
</vk-data-table>
<!-- 表格组件结束 -->
<!-- 添加或编辑的弹窗开始 -->
<vk-data-dialog v-model="form1.props.show" :title="form1.props.title" width="60%" mode="form"
:close-on-click-modal="false">
<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
:form-type="form1.props.formType" :columns='form1.props.columns' label-width="120px"
@success="form1.props.show = false;refresh();"></vk-data-form>
</vk-data-dialog>
<!-- 添加或编辑的弹窗结束 -->
<!-- 页面内容结束 -->
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="60%">
<set-express :info="clickInfo" @close="refresh" v-if="dialogVisible && dialogType === 'express'"/>
<order-info :info="clickInfo" @close="refresh" v-if="dialogVisible && dialogType === 'info'"/>
<self-product-info :order-info="clickInfo" :order-id="clickInfo._id" :goods="clickInfo.goods"
v-if="dialogVisible && dialogType === 'self-product'"/>
</el-dialog>
</view>
</template>
<script>
import SetExpress from "./components/setExpress.vue";
import SelfProductInfo from "./components/selfProductInfo.vue";
import OrderInfo from "./components/OrderInfo.vue";
import dayjs from 'dayjs'
var that; // 当前页面对象
var vk = uni.vk; // vk实例
var originalForms = {}; // 表单初始化数据
export default {
components: {SelfProductInfo, SetExpress, OrderInfo},
data() {
// 页面数据变量
return {
showInfo: false,
dialogTitle: null,
dialogType: null,
dialogVisible: false,
info: null,
clickInfo: null,
title: '',
infoColumns: [],
// 页面是否请求中或加载中
loading: false,
// init请求返回的数据
data: {},
// 表格相关开始 -----------------------------------------------------------
table1: {
// 表格数据请求地址
action: "admin/order/sys/getList",
// 表格字段显示规则
columns: [
{
key: "orderNo",
title: "订单号",
type: "text",
},
{
key: "type",
title: "订单类型",
type: "select",
align: "center",
data: [
{value: 0, label: '商城订单'},
{value: 1, label: '金久信自营订单'},
{value: 2, label: '保证金'},
{value: 3, label: '会员升级'},
{value: 4, label: '询价订单'},
{value: 5, label: '加工订单'},
{value: 6, label: '旧货订单'},
{value: 7, label: '报价次数'},
{value: 8, label: '现货广告'},
{value: 9, label: '旧货加急'},
{value: 10, label: '旧货次数'},
{value: 11, label: '金久信学堂下载次数'},
{value: 12, label: '司法调证'},
{value: 13, label: '金久信签约宝次数'},
{value: 14, label: '金久信签约宝'},
{value: 15, label: '金久信自营询价'},
]
},
{
key: "amount",
title: "订单金额",
type: "html",
formatter: (val = [], row, column, index) => {
let content
if (row.type !== 14) {
content = `<div>订单金额:¥` + row.amount + `</div>`
content += `<div>应付金额:¥${row.offAmount}</div>`
if (row.type < 4 && row.payAmount) {
content += `<div>实付金额:¥${row.payAmount ? row.payAmount : ''}</div>`
}
} else {
content = `<div>订单累计金额:¥` + row.amount + `</div>`
}
return content
}
},
{
key: "orderStatus",
title: "订单状态",
type: "text",
align: "center",
formatter: (val = [], row, column, index) => {
const orderStatusList = [
'待支付',
'待发货',
'待收货',
'待完成',
'已完成',
'退款审核中',
'退款成功',
'退款拒绝',
'',
'',
'待报价',
'已派单待完成',
]
let str = orderStatusList[val]
if (val === 7) str += `: ${row.refundRefuseReason}`
return str
}
},
{
key: "user",
title: "买方",
type: "html",
formatter: (val = [], row, column, index) => {
console.log(val.accountType === 2, val.company.companyName)
let content = `<p>` + val.mobile + `</p>`
content += `<p>` + (val.accountType === 2 ? val.company.companyName : val.person.personName) + `</p>`
console.log(content)
return content
}
},
{
key: "goods",
title: "商品列表",
type: "html",
},
{
key: "remark",
title: "用户备注",
type: "text",
},
{
key: "_add_time",
title: "下单时间",
type: "time",
align: "left",
width: 160,
sortable: "custom"
},
// {
// key: "_add_time",
// title: "距离现在",
// type: "dateDiff",
// align: "left",
// width: 120
// },
{
key: "action",
title: "操作",
type: "html",
}
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: ""
},
// 表格相关结束 -----------------------------------------------------------
// 表单相关开始 -----------------------------------------------------------
// 查询表单请求数据
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
{
key: "orderNo",
title: "订单号",
type: "text",
width: 160,
mode: "%%"
},
{
key: "type",
title: "订单类型",
type: "select",
data: [
{value: 0, label: '商城订单'},
{value: 1, label: '金久信自营订单'},
{value: 2, label: '保证金'},
{value: 3, label: '会员升级'},
{value: 4, label: '询价订单'},
{value: 5, label: '加工订单'},
{value: 6, label: '旧货订单'},
{value: 7, label: '报价次数'},
{value: 8, label: '现货广告'},
{value: 9, label: '旧货加急'},
{value: 10, label: '旧货次数'},
{value: 11, label: '金久信学堂下载次数'},
{value: 12, label: '司法调证'},
{value: 13, label: '金久信签约宝次数'},
{value: 14, label: '金久信签约宝'},
{value: 15, label: '金久信自营询价'},
]
},
{
key: "orderStatus",
title: "订单状态",
type: "select",
data: [
{value: 0, label: '待支付'},
{value: 1, label: '待发货'},
{value: 2, label: '待收货'},
{value: 3, label: '待完成'},
{value: 4, label: '已完成'},
{value: 5, label: '退款审核中'},
{value: 6, label: '退款成功'},
{value: 7, label: '退款失败'},
{value: 10, label: '待报价'},
{value: 11, label: '已派单待完成'},
]
},
{
key: "_add_time",
title: "下单时间",
type: "datetimerange",
width: 400,
mode: "[]"
},
]
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
sort: 0
},
// 表单属性
props: {
// 表单请求地址
action: "",
// 表单字段显示规则
columns: [
{
key: "orderNo",
title: "订单号",
type: "text",
placeholder: "请输入分类名称"
},
{
key: "icon",
title: "图标",
type: "icon",
placeholder: "请选择图标"
},
{
key: "parent_id",
title: "上级分类",
type: "tree-select",
placeholder: "请选择上级分类",
action: "admin/spot/category/sys/getTree",
props: {
list: "rows",
value: "_id",
label: "name",
children: "children"
},
},
{
key: "remark",
title: "备注",
type: "textarea",
maxlength: "99",
showWordLimit: true,
autosize: {
minRows: 2,
maxRows: 10
},
},
{
key: "sort",
title: "排序",
type: "number",
precision: 0,
placeholder: "请输入排序值",
},
],
// 表单验证规则
rules: {
sort: [{
type: 'number',
message: '排序值必须为数字'
}],
name: [
{required: true, message: '分类名称不能为空', trigger: 'blur'},
],
},
// add 代表添加 update 代表修改
formType: "",
// 是否显示表单的弹窗
show: false
}
},
// 其他弹窗表单
formDatas: {},
// 表单相关结束 -----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {
},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {
},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {
},
// 函数
methods: {
dayjs,
formatSku(sku) {
if (!sku) return ''
if (typeof sku === 'string') return sku
return sku.label || sku.name || sku.title || sku.specName || ''
},
// 页面数据初始化函数
init(options) {
originalForms["form1"] = vk.pubfn.copyObject(that.form1);
},
// 页面跳转
pageTo(path) {
vk.navigateTo(path);
},
// 表单重置
resetForm() {
vk.pubfn.resetForm(originalForms, that);
},
// 搜索
search() {
that.$refs.table1.search();
},
// 刷新
refresh() {
that.$refs.table1.refresh();
this.dialogVisible = false
},
// 获取当前选中的行的数据
getCurrentRow() {
return that.$refs.table1.getCurrentRow();
},
// 监听 - 行的选中高亮事件
currentChange(val) {
that.table1.selectItem = val;
},
// 当选择项发生变化时会触发该事件
selectionChange(list) {
that.table1.multipleSelection = list;
},
// 显示添加页面
addBtn() {
that.resetForm();
that.form1.props.action = 'admin/contract/template/sys/add';
that.form1.props.formType = 'add';
that.form1.props.title = '添加';
that.form1.props.show = true;
},
// 显示修改页面
updateBtn({
item
}) {
that.form1.props.action = 'admin/contract/template/sys/update';
that.form1.props.formType = 'update';
that.form1.props.title = '编辑';
that.form1.props.show = true;
that.form1.data = item;
},
// 删除按钮
deleteBtn({
item,
deleteFn
}) {
deleteFn({
action: "admin/contract/template/sys/delete",
data: {
_id: item._id
},
});
},
// 监听 - 批量操作的按钮点击事件
batchBtn(index) {
switch (index) {
case 1:
vk.toast("批量操作按钮1");
break;
case 2:
vk.toast("批量操作按钮2");
break;
default:
break;
}
},
changeField(id, field, value) {
vk.callFunction({
url: 'admin/old/sys/changeField',
data: {
id, field, value
}
}).then(() => {
this.$refs.table1.refresh()
})
},
doShowInfo(info) {
this.info = info
this.title = '详情'
this.showInfo = true
},
setExpress(item) {
this.clickInfo = item
this.dialogType = 'express'
this.dialogTitle = '发货'
this.dialogVisible = true
},
showSelfProductInfo(item) {
this.clickInfo = item
this.dialogType = 'self-product'
this.dialogTitle = '自营订单详情'
this.dialogVisible = true
},
showOrderInfo(item) {
this.clickInfo = item
this.dialogType = 'info'
this.dialogTitle = '订单详情'
this.dialogVisible = true
},
changeOrderStatus(id, value) {
vk.callFunction({
url: 'admin/order/sys/changeField',
data: {
id,
field: 'orderStatus',
value
}
}).then(() => {
this.$refs.table1.refresh()
})
},
},
// 监听属性
watch: {},
// 过滤器
filters: {},
// 计算属性
computed: {}
};
</script>
<style lang="scss" scoped>
.page-body {
}
</style>
+697
View File
@@ -0,0 +1,697 @@
<template>
<view class="page-body">
<!-- 页面内容开始 -->
<!-- 表格搜索组件开始 -->
<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"
@search="search"></vk-data-table-query>
<!-- 表格搜索组件结束 -->
<!-- 自定义按钮区域开始 -->
<view>
<el-row>
</el-row>
</view>
<!-- 自定义按钮区域结束 -->
<!-- 表格组件开始 -->
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
:pagination="true" @current-change="currentChange"
>
<template v-slot:action="{ row, column, index }">
<el-button size="mini" @click.native="doShowInfo(row)">详情</el-button>
<el-button size="mini" @click.native="showQuoteList(row)" v-if="row.quoteNum > 0">报价列表</el-button>
<el-button size="mini" @click.native="showPayList(row)" v-if="row.payList">支付明细</el-button>
<el-button size="mini" @click.native="changeField(row._id, 'showInAdmin', 0)"
v-if="row.showInAdmin === 1" type="danger">删除
</el-button>
<el-button size="mini" @click.native="changeField(row._id, 'showInAdmin', 1)"
v-if="row.showInAdmin === 0" type="danger">恢复
</el-button>
</template>
<template v-slot:isShow="{ row, column, index }">
<el-switch v-if="row.status === 0" v-model="row.isShow" size="mini"
@change="changeField(row._id, 'isShow', $event)"
:active-value="1"
:inactive-value="0"/>
<span v-else></span>
</template>
<template v-slot:quoteAmount="{ row, column, index }">
<el-input-number v-model="row.quoteAmount" @change="changeQuoteAmount($event, row._id)"/>
</template>
<template v-slot:orderAmount="{ row, column, index }">
<p v-if="row.quote">报价金额: ¥{{ row.quote.totalPrice }}</p>
<p v-if="row.payList">实付金额: ¥{{
row.payList.reduce((pre, cur) => (cur.hasPaid && !cur.buyerRefuse && cur.sellerConfirm) ? parseFloat(pre) + parseFloat(cur.amount) : pre, 0)
}}</p>
</template>
</vk-data-table>
<!-- 表格组件结束 -->
<!-- 添加或编辑的弹窗开始 -->
<vk-data-dialog v-model="form1.props.show" :title="form1.props.title" width="60%" mode="form"
:close-on-click-modal="false">
<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
:form-type="form1.props.formType" :columns='form1.props.columns' label-width="120px"
@success="form1.props.show = false;refresh();"></vk-data-form>
</vk-data-dialog>
<!-- 添加或编辑的弹窗结束 -->
<!-- 页面内容结束 -->
<vk-data-dialog
v-model="showInfo"
:title="title"
width="60%"
top="14vh"
center
:close-on-click-modal="true"
>
<vk-data-detail-table
:data="info"
:columns="infoColumns"
size="medium"
label-width="150px"
>
</vk-data-detail-table>
</vk-data-dialog>
<el-dialog title="图片预览" :visible.sync="showImagePreview" width="80%" append-to-body>
<img v-if="previewImageUrl" class="preview-image" :src="previewImageUrl" alt="附件预览"/>
</el-dialog>
<el-dialog title="PDF预览" :visible.sync="showPdfPreview" width="80%" append-to-body @closed="revokePdfPreviewUrl">
<iframe v-if="pdfPreviewUrl" class="pdf-preview-frame" :src="pdfPreviewUrl"></iframe>
</el-dialog>
<ProcessQuoteList ref="ProcessQuoteList"/>
<PayList ref="PayList"/>
</view>
</template>
<script>
import ProcessQuoteList from "./components/ProcessQuoteList.vue";
var that; // 当前页面对象
var vk = uni.vk; // vk实例
var originalForms = {}; // 表单初始化数据
import provinces from "@/uni_modules/vk-uview-ui/libs/address/provinces.json";
import citys from "@/uni_modules/vk-uview-ui/libs/address/citys.json";
import areas from "@/uni_modules/vk-uview-ui/libs/address/areas.json";
import PayList from "./components/PayList.vue";
function escapeHtml(value = "") {
return String(value)
.replace(/&/g, "&amp;")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;")
.replace(/'/g, "&#39;");
}
function formatPreviewLinks(files = []) {
const list = Array.isArray(files) ? files : (files ? [files] : []);
return list
.filter(Boolean)
.map((item, itemIndex) => {
const url = encodeURIComponent(item);
const label = escapeHtml(`预览:文件${itemIndex + 1}`);
return `<a href="javascript:;" onclick="window.__previewProcessFile && window.__previewProcessFile('${url}')">${label}</a> `;
})
.join("");
}
export default {
components: {PayList, ProcessQuoteList},
data() {
// 页面数据变量
return {
showInfo: false,
info: null,
title: '',
showImagePreview: false,
previewImageUrl: '',
showPdfPreview: false,
pdfPreviewUrl: '',
pdfObjectUrl: '',
provinceData: provinces,
cityData: citys,
areaData: areas,
infoColumns: [
{key: "title", title: "主要商品", type: "text"},
{key: "detail", title: "加工产品简述", type: "text"},
{key: "num", title: "加工量", type: "text"},
{
key: "files", title: "附件", type: "html",
formatter: (val = [], row, column, index) => {
return formatPreviewLinks(val)
}
},
{key: "remark", title: "采购商其他要求", type: "text"},
{
key: "multiFiles", title: "采购商其他要求(附件)", type: "html",
formatter: (val = [], row, column, index) => {
return formatPreviewLinks(val)
}
},
{
key: "addressRegion", title: "加工交货地址", type: "text",
formatter: (val = [], row, column, index) => {
return `${val.province.name} ${val.city.name} ${val.area.name} ${row.addressDetail}`
}
},
{
key: "invoice", title: "是否含税", type: "radio", data: [
{label: "含税", value: true},
{label: "不含税", value: false}
]
},
{
key: "writeInvoiceTime", title: "开票时间", type: "radio", data: [
{label: "付款当月(限20号之前付款,20号之后付款次月开票)", value: 0},
{label: "付款后次月", value: 1},
{label: "付款前", value: 2}
]
},
// {
// key: "invoiceType", title: "发票种类", type: "radio", data: [
// {label: "增值税专用发票13%", value: 0},
// {label: "增值税普通发票", value: 1},
// {label: "普通发票", value: 2}
// ]
// },
// {key: "invoiceOther", title: "发票其他要求", type: "text"},
{
key: "taxType", title: "纳税人身份", type: "text", showRule: formData => {
return !!formData.invoiceOther
}
},
{
key: "invoiceType", title: "发票种类", type: "text", showRule: formData => {
return !!formData.invoiceOther
}
},
{
key: "taxRate", title: "税率", type: "text", showRule: formData => {
return !!formData.invoiceOther
}
},
{
key: "invoiceOther", title: "手动填写税票要求", type: "text", showRule: formData => {
console.log(formData)
return !!formData.taxType
}
},
{key: "transportDocuments", title: "随货资料", type: "text"},
{key: "otherTransportDocuments", title: "运输其他要求", type: "text"},
{
key: "transportLimit", title: "运输限制", type: "radio", data: [
{label: "有", value: true},
{label: "无", value: false}
]
},
{
key: "tradeMethod", title: "交易模式", type: "radio", data: [
{label: "自主交易", value: 0},
{label: "金久信公证", value: 1},
]
},
{
key: "payMethod", title: "付款方式", type: "radio", data: [
{label: "预付", value: 0},
{label: "加工验收合格后付全款", value: 1},
// {label: "提货付全款", value: 2},
{label: "加工验收合格后X天内支付全款", value: 3},
{label: "其他付款方式", value: 4},
]
},
{key: "advancePayRate", title: "预付比例(%)", type: "text"},
{key: "reputationPayDay", title: "账期天数", type: "text"},
{key: "otherPayMethod", title: "其他付款方式", type: "text"},
{
key: "offerType", title: "报价形式", type: "radio", data: [
{label: "整单报价", value: 0},
{label: "可分项报价", value: 1}
]
},
{
key: "answerStartTime", title: "报价时限(开始)", type: "time"
},
{
key: "answerEndTime", title: "报价时限(结束)", type: "time"
},
{key: "earnestMoney", title: "交保证金要求", type: "text",
formatter: (val, row, column, index) => {
return val === 'NaN' ? '' : val
}},
{
key: "signMethod", title: "签约模式", type: "radio", data: [
{label: "线上签约-标准合同", value: 0},
{label: "线下签约", value: 1},
{label: "线上签约-双方协商合同", value: 2},
]
},
{
key: "contract", title: "合同文件", type: "html",
formatter: (val = [], row, column, index) => {
return formatPreviewLinks(row.contract && row.contract.contractBase)
},
showRule: formData => {
return formData.signMethod === 2
}
},
{key: "supplementary", title: "采购商补充条款", type: "text"},
{key: "companyName", title: "公司信息", type: "text"},
{key: "companyMobile", title: "公司联系方式", type: "text"},
{key: "businessName", title: "授权业务咨询人", type: "text"},
{key: "businessMobile", title: "业务咨询联系方式", type: "text"},
],
// 页面是否请求中或加载中
loading: false,
// init请求返回的数据
data: {},
// 表格相关开始 -----------------------------------------------------------
table1: {
// 表格数据请求地址
action: "admin/process/sys/getList",
// 表格字段显示规则
columns: [
{
key: "title",
title: "标题",
type: "text",
align: "left",
width: 200
},
{
key: "num",
title: "加工量",
type: "text",
align: "left",
},
{
key: "",
title: "采购企业",
type: "text",
align: "left",
width: 220,
formatter: (val = [], row, column, index) => {
return row.user.accountType === 1 ? row.user.person.personName : row.user.company.companyName;
}
},
{
key: "",
title: "报价情况",
type: "text",
align: "left",
formatter: (val = [], row, column, index) => {
return `${row.quoteNum}家`
}
},
{
key: "status",
title: "状态",
type: "tag",
data: [
{value: 0, label: '待选商', tagType: 'warning'},
{value: 1, label: '已选商', tagType: 'danger'},
{value: 2, label: '已完成', tagType: 'success'},
]
},
{
key: "orderAmount",
title: "订单金额",
type: "html",
width: 200
},
{key: "isShow", title: "是否显示", type: "html"},
{key: "quoteAmount", title: "单次报价金额", type: "html", width: 210,},
{
key: "_add_time",
title: "发布时间",
type: "time",
align: "left",
width: 160,
sortable: "custom"
},
{
key: "_add_time_diff",
title: "距离现在",
type: "html",
align: "left",
width: 120,
formatter: (val, row) => vk.pubfn.dateDiff(row._add_time)
},
{
key: "action", title: "操作", type: "html",
width: 380
},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: ""
},
// 表格相关结束 -----------------------------------------------------------
// 表单相关开始 -----------------------------------------------------------
// 查询表单请求数据
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
{
key: "title",
title: "标题",
type: "text",
width: 160,
mode: "%%"
},
{
key: "status",
title: "选商状态",
type: "select",
data: [
{value: 0, label: '未选商'},
{value: 1, label: '已选商'},
{value: 2, label: '已完成'},
]
},
{
key: "showInAdmin",
title: "删除状态",
type: "select",
data: [
{value: 1, label: '未删除'},
{value: 0, label: '已删除'},
]
},
{
key: "signMethod",
title: "签约方式",
type: "select",
data: [
{value: 0, label: '线上签约-标准合同'},
{value: 1, label: '线下签约'},
{value: 2, label: '线上签约-双方协商合同'},
]
},
// {
// key: "_add_time",
// title: "添加时间",
// type: "datetimerange",
// width: 400,
// mode: "[]"
// },
]
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
sort: 0
},
// 表单属性
props: {
// 表单请求地址
action: "",
// 表单字段显示规则
columns: [{
key: "name",
title: "名称",
type: "text",
placeholder: "请输入分类名称"
},
{
key: "icon",
title: "图标",
type: "icon",
placeholder: "请选择图标"
},
{
key: "parent_id",
title: "上级分类",
type: "tree-select",
placeholder: "请选择上级分类",
action: "admin/spot/category/sys/getTree",
props: {
list: "rows",
value: "_id",
label: "name",
children: "children"
},
},
{
key: "remark",
title: "备注",
type: "textarea",
maxlength: "99",
showWordLimit: true,
autosize: {
minRows: 2,
maxRows: 10
},
},
{
key: "sort",
title: "排序",
type: "number",
precision: 0,
placeholder: "请输入排序值",
},
],
// 表单验证规则
rules: {
sort: [{
type: 'number',
message: '排序值必须为数字'
}],
name: [
{required: true, message: '分类名称不能为空', trigger: 'blur'},
],
},
// add 代表添加 update 代表修改
formType: "",
// 是否显示表单的弹窗
show: false
}
},
// 其他弹窗表单
formDatas: {},
// 表单相关结束 -----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.registerFilePreviewHandler();
that.init(options);
},
onUnload() {
this.unregisterFilePreviewHandler();
},
beforeDestroy() {
this.unregisterFilePreviewHandler();
this.revokePdfPreviewUrl();
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {
},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {
},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {
},
// 函数
methods: {
// 页面数据初始化函数
init(options) {
originalForms["form1"] = vk.pubfn.copyObject(that.form1);
},
registerFilePreviewHandler() {
if (typeof window === "undefined") return
window.__previewProcessFile = encodedUrl => {
this.previewFile(decodeURIComponent(encodedUrl))
}
},
unregisterFilePreviewHandler() {
if (typeof window === "undefined") return
if (window.__previewProcessFile) delete window.__previewProcessFile
},
// 页面跳转
pageTo(path) {
vk.navigateTo(path);
},
// 表单重置
resetForm() {
vk.pubfn.resetForm(originalForms, that);
},
// 搜索
search() {
that.$refs.table1.search();
},
// 刷新
refresh() {
that.$refs.table1.refresh();
},
// 获取当前选中的行的数据
getCurrentRow() {
return that.$refs.table1.getCurrentRow();
},
// 监听 - 行的选中高亮事件
currentChange(val) {
that.table1.selectItem = val;
},
// 当选择项发生变化时会触发该事件
selectionChange(list) {
that.table1.multipleSelection = list;
},
// 显示添加页面
addBtn() {
that.resetForm();
that.form1.props.action = 'admin/contract/template/sys/add';
that.form1.props.formType = 'add';
that.form1.props.title = '添加';
that.form1.props.show = true;
},
// 显示修改页面
updateBtn({
item
}) {
that.form1.props.action = 'admin/contract/template/sys/update';
that.form1.props.formType = 'update';
that.form1.props.title = '编辑';
that.form1.props.show = true;
that.form1.data = item;
},
// 删除按钮
deleteBtn({
item,
deleteFn
}) {
deleteFn({
action: "admin/contract/template/sys/delete",
data: {
_id: item._id
},
});
},
// 监听 - 批量操作的按钮点击事件
batchBtn(index) {
switch (index) {
case 1:
vk.toast("批量操作按钮1");
break;
case 2:
vk.toast("批量操作按钮2");
break;
default:
break;
}
},
changeField(id, field, value) {
vk.callFunction({
url: 'admin/process/sys/changeField',
data: {
id, field, value
}
}).then(() => {
this.$refs.table1.refresh()
})
},
doShowInfo(info) {
this.info = info
this.title = '详情'
this.showInfo = true
},
showQuoteList({_id}) {
this.$refs.ProcessQuoteList.open(_id)
},
changeQuoteAmount(value, id) {
this.changeField(id, 'quoteAmount', value)
},
showPayList(row) {
this.$refs.PayList.open(row.payList)
},
getFileExt(url = "") {
const cleanUrl = String(url).split("?")[0].split("#")[0]
const match = cleanUrl.match(/\.([a-z0-9]+)$/i)
return match ? match[1].toLowerCase() : ""
},
isImageFile(url) {
return ["png", "jpg", "jpeg", "gif", "webp", "bmp", "svg"].includes(this.getFileExt(url))
},
isPdfFile(url) {
return this.getFileExt(url) === "pdf"
},
isOfficeFile(url) {
return ["doc", "docx", "xls", "xlsx", "ppt", "pptx"].includes(this.getFileExt(url))
},
getOfficePreviewUrl(url) {
return `https://view.officeapps.live.com/op/view.aspx?src=${encodeURIComponent(url)}`
},
revokePdfPreviewUrl() {
if (this.pdfObjectUrl) {
URL.revokeObjectURL(this.pdfObjectUrl)
this.pdfObjectUrl = ''
}
this.pdfPreviewUrl = ''
},
async previewPdfFile(url) {
this.revokePdfPreviewUrl()
try {
const response = await fetch(url)
if (!response.ok) throw new Error('PDF加载失败')
const blob = await response.blob()
this.pdfObjectUrl = URL.createObjectURL(new Blob([blob], {type: 'application/pdf'}))
this.pdfPreviewUrl = this.pdfObjectUrl
} catch (e) {
this.pdfPreviewUrl = `https://mozilla.github.io/pdf.js/web/viewer.html?file=${encodeURIComponent(url)}`
}
this.showPdfPreview = true
},
previewFile(url) {
if (!url) return
if (this.isImageFile(url)) {
this.previewImageUrl = url
this.showImagePreview = true
return
}
if (this.isPdfFile(url)) {
this.previewPdfFile(url)
return
}
if (this.isOfficeFile(url)) {
window.open(this.getOfficePreviewUrl(url), "_blank")
return
}
window.open(url, "_blank")
},
},
// 监听属性
watch: {},
// 过滤器
filters: {},
// 计算属性
computed: {}
};
</script>
<style lang="scss" scoped>
.page-body {
}
.preview-image {
display: block;
max-width: 100%;
max-height: 75vh;
margin: 0 auto;
}
.pdf-preview-frame {
display: block;
width: 100%;
height: 75vh;
border: 0;
}
</style>
+454
View File
@@ -0,0 +1,454 @@
<template>
<view class="page-body">
<!-- 页面内容开始 -->
<!-- 表格搜索组件开始 -->
<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"
@search="search"></vk-data-table-query>
<!-- 表格搜索组件结束 -->
<!-- 自定义按钮区域开始 -->
<view>
<el-row>
</el-row>
</view>
<!-- 自定义按钮区域结束 -->
<!-- 表格组件开始 -->
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
:pagination="true" @current-change="currentChange"
>
<template v-slot:action="{ row, column, index }">
<template v-if="row.orderStatus === 5">
<el-button type="success" size="mini" @click.native="refundPass(row)">通过</el-button>
<el-button type="danger" size="mini" @click.native="refundRefuse(row)">拒绝</el-button>
</template>
</template>
<template v-slot:goods="{ row, column, index }">
<div v-for="(item, index) in row.goods" :key="index">
<p>商品名称: {{ item.goodsName }}</p>
<p>数量: {{ item.num }}</p>
<p>单价: {{ item.goodsPrice }}</p>
<el-divider v-if="index < row.goods.length - 1"/>
</div>
</template>
</vk-data-table>
<!-- 表格组件结束 -->
<!-- 添加或编辑的弹窗开始 -->
<vk-data-dialog v-model="form1.props.show" :title="form1.props.title" width="60%" mode="form"
:close-on-click-modal="false">
<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
:form-type="form1.props.formType" :columns='form1.props.columns' label-width="120px"
@success="form1.props.show = false;refresh();"></vk-data-form>
</vk-data-dialog>
<!-- 添加或编辑的弹窗结束 -->
<!-- 页面内容结束 -->
</view>
</template>
<script>
var that; // 当前页面对象
var vk = uni.vk; // vk实例
var originalForms = {}; // 表单初始化数据
export default {
data() {
// 页面数据变量
return {
showInfo: false,
info: null,
title: '',
infoColumns: [],
// 页面是否请求中或加载中
loading: false,
// init请求返回的数据
data: {},
// 表格相关开始 -----------------------------------------------------------
table1: {
// 表格数据请求地址
action: "admin/order/sys/getList",
// 表格字段显示规则
columns: [
{
key: "orderNo",
title: "订单号",
type: "text",
},
{
key: "type",
title: "订单类型",
type: "select",
align: "center",
data: [
{value: 0, label: '商城订单'},
{value: 1, label: '金久信自营订单'},
{value: 2, label: '保证金'},
{value: 3, label: '会员升级'},
{value: 4, label: '询价订单'},
{value: 5, label: '加工订单'},
{value: 6, label: '旧货订单'},
]
},
{
key: "amount",
title: "订单金额",
type: "html",
formatter: (val = [], row, column, index) => {
let content = `<div>订单金额:¥` + row.amount + `</div>`
content += `<div>应付金额:¥${row.offAmount}</div>`
if (row.type < 4 && row.payAmount) {
content += `<div>实付金额:¥${row.payAmount ? row.payAmount : ''}</div>`
}
return content
}
},
{
key: "orderStatus",
title: "订单状态",
type: "text",
align: "center",
formatter: (val = [], row, column, index) => {
const orderStatusList = [
'待支付',
'待发货',
'待收货',
'待完成',
'已完成',
'退款审核中',
'退款成功',
'退款失败',
]
let str = orderStatusList[val]
if (val === 7) str += `: ${row.refundRefuseReason}`
return str
}
},
{
key: "user",
title: "买方",
type: "html",
formatter: (val = [], row, column, index) => {
let content = `<div>` + val.mobile + `</div>`
content += `<div>` + val.accountType === 2 ? val.company.companyName : val.person.personName + `</div>`
return content
}
},
{
key: "goods",
title: "商品列表",
type: "html",
},
{
key: "refundReason",
title: "申请原因",
type: "text",
},
{
key: "refundPhotos",
title: "用户附件",
type: "image",
},
{
key: "refundRequestAt",
title: "申请时间",
type: "text",
align: "left",
width: 160,
sortable: "custom"
},
{
key: "action",
title: "操作",
type: "html",
}
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: ""
},
// 表格相关结束 -----------------------------------------------------------
// 表单相关开始 -----------------------------------------------------------
// 查询表单请求数据
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {
orderStatus: [5, 6, 7]
},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
{
key: "orderNo",
title: "订单号",
type: "text",
width: 160,
mode: "%%"
},
{
key: "type",
title: "订单类型",
type: "select",
align: "center",
data: [
{value: 0, label: '商城订单'},
{value: 1, label: '金久信自营订单'},
{value: 2, label: '保证金'},
{value: 3, label: '会员升级'},
{value: 4, label: '询价订单'},
{value: 5, label: '加工订单'},
{value: 6, label: '旧货订单'},
]
},
// {
// key: "orderStatus",
// title: "退款状态",
// type: "select",
// align: "center",
// data: [
// {value: [5,6,7], label: '全部状态'},
// {value: 5, label: '待审核'},
// {value: 6, label: '退款成功'},
// {value: 7, label: '退款拒绝'},
// ]
// },
// {
// key: "_add_time",
// title: "下单时间",
// type: "datetimerange",
// width: 400,
// mode: "[]"
// },
]
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
sort: 0
},
// 表单属性
props: {
// 表单请求地址
action: "",
// 表单字段显示规则
columns: [
{
key: "orderNo",
title: "订单号",
type: "text",
placeholder: "请输入分类名称"
},
{
key: "icon",
title: "图标",
type: "icon",
placeholder: "请选择图标"
},
{
key: "parent_id",
title: "上级分类",
type: "tree-select",
placeholder: "请选择上级分类",
action: "admin/spot/category/sys/getTree",
props: {
list: "rows",
value: "_id",
label: "name",
children: "children"
},
},
{
key: "remark",
title: "备注",
type: "textarea",
maxlength: "99",
showWordLimit: true,
autosize: {
minRows: 2,
maxRows: 10
},
},
{
key: "sort",
title: "排序",
type: "number",
precision: 0,
placeholder: "请输入排序值",
},
],
// 表单验证规则
rules: {
sort: [{
type: 'number',
message: '排序值必须为数字'
}],
name: [
{required: true, message: '分类名称不能为空', trigger: 'blur'},
],
},
// add 代表添加 update 代表修改
formType: "",
// 是否显示表单的弹窗
show: false
}
},
// 其他弹窗表单
formDatas: {},
// 表单相关结束 -----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {
},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {
},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {
},
// 函数
methods: {
// 页面数据初始化函数
init(options) {
originalForms["form1"] = vk.pubfn.copyObject(that.form1);
},
// 页面跳转
pageTo(path) {
vk.navigateTo(path);
},
// 表单重置
resetForm() {
vk.pubfn.resetForm(originalForms, that);
},
// 搜索
search() {
if (!that.queryForm1.formData.orderStatus) {
that.queryForm1.formData.orderStatus = [5,6,7]
}
that.$refs.table1.search();
},
// 刷新
refresh() {
that.$refs.table1.refresh();
},
// 获取当前选中的行的数据
getCurrentRow() {
return that.$refs.table1.getCurrentRow();
},
// 监听 - 行的选中高亮事件
currentChange(val) {
that.table1.selectItem = val;
},
// 当选择项发生变化时会触发该事件
selectionChange(list) {
that.table1.multipleSelection = list;
},
// 显示添加页面
addBtn() {
that.resetForm();
that.form1.props.action = 'admin/contract/template/sys/add';
that.form1.props.formType = 'add';
that.form1.props.title = '添加';
that.form1.props.show = true;
},
// 显示修改页面
updateBtn({
item
}) {
that.form1.props.action = 'admin/contract/template/sys/update';
that.form1.props.formType = 'update';
that.form1.props.title = '编辑';
that.form1.props.show = true;
that.form1.data = item;
},
// 删除按钮
deleteBtn({
item,
deleteFn
}) {
deleteFn({
action: "admin/contract/template/sys/delete",
data: {
_id: item._id
},
});
},
// 监听 - 批量操作的按钮点击事件
batchBtn(index) {
switch (index) {
case 1:
vk.toast("批量操作按钮1");
break;
case 2:
vk.toast("批量操作按钮2");
break;
default:
break;
}
},
changeField(id, field, value) {
vk.callFunction({
url: 'admin/old/sys/changeField',
data: {
id, field, value
}
}).then(() => {
this.$refs.table1.refresh()
})
},
doShowInfo(info) {
this.info = info
this.title = '详情'
this.showInfo = true
},
async refundPass({_id}) {
await vk.callFunction({
url: 'admin/order/sys/refund',
data: {
id: _id,
orderStatus: 6
}
})
this.$message.success('操作成功')
this.$refs.table1.refresh()
},
async refundRefuse({_id}) {
const {action, value} = await this.$prompt('拒绝理由', {
showInput: true
});
if (action === 'confirm') {
await vk.callFunction({
url: 'admin/order/sys/refund',
data: {
id: _id,
orderStatus: 7,
refundRefuseReason: value
}
})
this.$message.success('操作成功')
this.$refs.table1.refresh()
}
},
},
// 监听属性
watch: {},
// 过滤器
filters: {},
// 计算属性
computed: {}
};
</script>
<style lang="scss" scoped>
.page-body {
}
</style>
@@ -0,0 +1,119 @@
<template>
<div>
<el-table :data="list" style="width: 100%">
<el-table-column prop="user.company.companyName" label="企业"/>
<el-table-column prop="desc" label="产品描述"/>
<el-table-column prop="amount" label="报价"/>
<el-table-column label="附件">
<template v-slot="{ row }">
<p v-for="(item, index) in row.files" :key="index">
<a :href="item" target="_blank">预览:文件{{ index + 1 }}</a>
</p>
</template>
</el-table-column>
<el-table-column prop="remark" label="备注"/>
<el-table-column label="状态">
<template v-slot="{ row }">
<span v-if="row.status === 0">待选商</span>
<span v-if="row.status === 1">已选</span>
</template>
</el-table-column>
<el-table-column label="操作">
<template v-slot="{ row }">
<el-button type="primary" size="small" v-if="info.status === 1" @click="edit(row)" plain>编辑</el-button>
<el-button type="primary" size="small" v-if="info.status === 1" :disabled="!row.amount" @click="confirm(row._id)">选商
</el-button>
</template>
</el-table-column>
</el-table>
<div style="margin-top: 2rem; text-align: center">
<el-button plain @click.native="cancel">关闭</el-button>
</div>
<el-dialog title="编辑报价" :visible.sync="dialogVisible" width="50%" append-to-body>
<el-form ref="form" :model="form" label-width="80px">
<el-form-item label="报价">
<el-input v-model="form.amount" placeholder="请输入报价"/>
</el-form-item>
<el-form-item label="备注">
<el-input v-model="form.remark" placeholder="请输入备注"/>
</el-form-item>
<el-form-item label="附件">
<vk-data-upload accept="*" list-type="text" v-model="form.files"/>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">取 消</el-button>
<el-button type="primary" @click="doEdit">确 定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
export default {
name: "SelectQuote",
props: {
info: {
type: Object
}
},
data() {
return {
list: [],
clickedInfo: null,
dialogVisible: null,
form: {
_id: null,
amount: null,
remark: null,
files: [],
}
}
},
methods: {
async getList() {
const {rows} = await vk.callFunction({
url: 'admin/selfProduct/quote/sys/getQuoteList',
data: {pageSize: 500, quoteId: this.info._id}
})
this.list = rows
},
cancel() {
this.$emit('cancel')
},
async confirm(quoteId) {
await vk.callFunction({
url: 'admin/selfProduct/quote/sys/confirmQuote',
data: {
quoteId,
sheetId: this.info._id
}
})
this.cancel()
},
edit(info) {
this.form = {
_id: info._id,
amount: info.amount,
remark: info.remark,
files: info.files ?? []
}
this.dialogVisible = true
},
doEdit(){
vk.callFunction({
url: 'admin/selfProduct/quote/sys/editQuote',
data: this.form
}).then(() => {
this.dialogVisible = false
this.getList()
})
}
},
mounted() {
this.getList()
}
}
</script>
@@ -0,0 +1,68 @@
<template>
<div>
<p>公司选择:</p>
<el-select v-model="selectedList" placeholder="点击选择报价公司" style="margin-top: 1rem; width: 90%" multiple clearable filterable>
<el-option
v-for="(item, index) in companyList"
:key="item.value"
:label="item.nickname"
:value="item._id">
</el-option>
</el-select>
<p style="margin-top: 2rem;">产品描述:</p>
<el-input type="textarea" v-model="desc" placeholder="请输入" style="margin-top: 1rem; width: 90%"></el-input>
<div style="margin-top: 2rem; text-align: center">
<el-button plain @click.native="cancel">取消</el-button>
<el-button type="primary" :disabled="selectedList.length === 0" @click.native="confirm">确定</el-button>
</div>
</div>
</template>
<script>
export default {
name: "SetEnquiry",
props: {
info: {
type: Object
}
},
data() {
return {
selectedList: [],
companyList: [],
desc: ''
}
},
methods: {
async getCompanyList() {
const {rows} = await vk.callFunction({
url: 'admin/system/user/sys/getList',
data: {type: 2, pageSize: 500}
// data: {pageSize: 500}
})
// this.companyList = rows.filter(item => item.company && item.company.companyName !== '' && item.company.companyName)
this.companyList = rows
},
cancel(){
this.$emit('cancel')
},
async confirm(){
await vk.callFunction({
url: 'admin/selfProduct/quote/sys/setCompany',
data: {
list: this.selectedList,
quoteId: this.info._id,
desc: this.desc,
}
})
this.cancel()
}
},
mounted() {
this.desc = this.info.desc
this.getCompanyList()
}
}
</script>
+418
View File
@@ -0,0 +1,418 @@
<template>
<view class="page-body">
<!-- 页面内容开始 -->
<!-- 表格搜索组件开始 -->
<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"
@search="search"></vk-data-table-query>
<!-- 表格搜索组件结束 -->
<!-- 自定义按钮区域开始 -->
<view>
<el-row>
</el-row>
</view>
<!-- 自定义按钮区域结束 -->
<!-- 表格组件开始 -->
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
:pagination="true" @current-change="currentChange"
>
<template v-slot:action="{ row, column, index }">
<el-button size="mini" @click.native="setEnquiry(row)" v-if="[0, 1].includes(row.status)">询价</el-button>
<el-button size="mini" @click.native="selectQuote(row)" v-if="row.status === 1" type="success">选商</el-button>
<el-button size="mini" @click.native="selectQuote(row)" v-if="row.status === 2" type="success">报价列表</el-button>
<el-button size="mini" @click.native="showPayList(row)" v-if="row.payList">支付明细</el-button>
</template>
<template v-slot:orderAmount="{ row, column, index }">
<p v-if="row.quote && row.quote.amount">报价金额: ¥{{ row.quote.amount }}</p>
<p v-if="row.payList">实付金额: ¥{{
row.payList.reduce((pre, cur) => (cur.hasPaid && !cur.buyerRefuse && cur.sellerConfirm) ? parseFloat(pre) + parseFloat(cur.amount) : pre, 0)
}}</p>
</template>
</vk-data-table>
<!-- 表格组件结束 -->
<!-- 添加或编辑的弹窗开始 -->
<vk-data-dialog v-model="form1.props.show" :title="form1.props.title" width="60%" mode="form"
:close-on-click-modal="false">
<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
:form-type="form1.props.formType" :columns='form1.props.columns' label-width="120px"
@success="form1.props.show = false;refresh();"></vk-data-form>
</vk-data-dialog>
<!-- 添加或编辑的弹窗结束 -->
<!-- 页面内容结束 -->
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="70%">
<set-enquiry v-if="dialogVisible && dialogType === 'set-enquiry'" :info="clickInfo" @cancel="closeDialog"/>
<select-quote v-if="dialogVisible && dialogType === 'select-quote'" :info="clickInfo" @cancel="closeDialog"/>
</el-dialog>
<PayList ref="PayList"/>
</view>
</template>
<script>
import SetExpress from "../components/setExpress.vue";
import SelfProductInfo from "../components/selfProductInfo.vue";
import SetEnquiry from "./components/SetEnquiry.vue";
import SelectQuote from "./components/SelectQuote.vue";
import PayList from "../components/PayList.vue";
var that; // 当前页面对象
var vk = uni.vk; // vk实例
var originalForms = {}; // 表单初始化数据
export default {
components: {PayList, SelectQuote, SetEnquiry, SelfProductInfo, SetExpress},
data() {
// 页面数据变量
return {
dialogTitle: null,
dialogType: null,
dialogVisible: false,
clickInfo: null,
showInfo: false,
info: null,
title: '',
// 页面是否请求中或加载中
loading: false,
// init请求返回的数据
data: {},
// 表格相关开始 -----------------------------------------------------------
table1: {
// 表格数据请求地址
action: "admin/selfProduct/quote/sys/getList",
// 表格字段显示规则
columns: [
{
key: "",
title: "询价地区",
type: "text",
align: "left",
formatter: (val = [], row, column, index) => {
return `${row.province.name}${row.city.name}`;
}
},
{
key: "name",
title: "联系人",
type: "text",
align: "center",
},
{
key: "phone",
title: "联系方式",
type: "text",
align: "center",
},
{
key: "company",
title: "公司名称",
type: "text",
align: "center",
},
{
key: "status",
title: "状态",
type: "select",
align: "center",
data: [
{value: 0, label: '待操作'},
{value: 1, label: '待选商'},
{value: 2, label: '已选商'},
]
},
{
key: "orderAmount",
title: "订单金额",
type: "html",
},
{
key: "files", title: "附件", type: "html",
formatter: (val = [], row, column, index) => {
let content = ''
val.forEach((item, itemIndex) => {
content += `<a href="${item}" target="_blank">预览:文件${itemIndex + 1}</a> `
})
return content
}
},
{
key: "_add_time",
title: "添加时间",
type: "time",
align: "left",
width: 160,
sortable: "custom"
},
{
key: "_add_time_diff",
title: "距离现在",
type: "html",
align: "left",
width: 120,
formatter: (val, row) => vk.pubfn.dateDiff(row._add_time)
},
{key: "action", title: "操作", type: "html", width: 240},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: ""
},
// 表格相关结束 -----------------------------------------------------------
// 表单相关开始 -----------------------------------------------------------
// 查询表单请求数据
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
{
key: "address",
title: "询价地区",
type: "address",
align: "left",
level: 2
},
// {
// key: "name",
// title: "名称",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "remark",
// title: "备注",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "_add_time",
// title: "添加时间",
// type: "datetimerange",
// width: 400,
// mode: "[]"
// },
]
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
sort: 0
},
// 表单属性
props: {
// 表单请求地址
action: "",
// 表单字段显示规则
columns: [{
key: "name",
title: "名称",
type: "text",
placeholder: "请输入分类名称"
},
{
key: "icon",
title: "图标",
type: "icon",
placeholder: "请选择图标"
},
{
key: "parent_id",
title: "上级分类",
type: "tree-select",
placeholder: "请选择上级分类",
action: "admin/spot/category/sys/getTree",
props: {
list: "rows",
value: "_id",
label: "name",
children: "children"
},
},
{
key: "remark",
title: "备注",
type: "textarea",
maxlength: "99",
showWordLimit: true,
autosize: {
minRows: 2,
maxRows: 10
},
},
{
key: "sort",
title: "排序",
type: "number",
precision: 0,
placeholder: "请输入排序值",
},
],
// 表单验证规则
rules: {
sort: [{
type: 'number',
message: '排序值必须为数字'
}],
name: [
{required: true, message: '分类名称不能为空', trigger: 'blur'},
],
},
// add 代表添加 update 代表修改
formType: "",
// 是否显示表单的弹窗
show: false
}
},
// 其他弹窗表单
formDatas: {},
// 表单相关结束 -----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {
},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {
},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {
},
// 函数
methods: {
// 页面数据初始化函数
init(options) {
originalForms["form1"] = vk.pubfn.copyObject(that.form1);
},
// 页面跳转
pageTo(path) {
vk.navigateTo(path);
},
// 表单重置
resetForm() {
vk.pubfn.resetForm(originalForms, that);
},
// 搜索
search() {
that.$refs.table1.search();
},
// 刷新
refresh() {
that.$refs.table1.refresh();
},
// 获取当前选中的行的数据
getCurrentRow() {
return that.$refs.table1.getCurrentRow();
},
// 监听 - 行的选中高亮事件
currentChange(val) {
that.table1.selectItem = val;
},
// 当选择项发生变化时会触发该事件
selectionChange(list) {
that.table1.multipleSelection = list;
},
// 显示添加页面
addBtn() {
that.resetForm();
that.form1.props.action = 'admin/contract/template/sys/add';
that.form1.props.formType = 'add';
that.form1.props.title = '添加';
that.form1.props.show = true;
},
// 显示修改页面
updateBtn({
item
}) {
that.form1.props.action = 'admin/contract/template/sys/update';
that.form1.props.formType = 'update';
that.form1.props.title = '编辑';
that.form1.props.show = true;
that.form1.data = item;
},
// 删除按钮
deleteBtn({
item,
deleteFn
}) {
deleteFn({
action: "admin/contract/template/sys/delete",
data: {
_id: item._id
},
});
},
// 监听 - 批量操作的按钮点击事件
batchBtn(index) {
switch (index) {
case 1:
vk.toast("批量操作按钮1");
break;
case 2:
vk.toast("批量操作按钮2");
break;
default:
break;
}
},
changeField(id, field, value) {
vk.callFunction({
url: 'admin/old/sys/changeField',
data: {
id, field, value
}
}).then(() => {
this.$refs.table1.refresh()
})
},
doShowInfo(info) {
this.info = info
this.dialogTitle = '详情'
this.showInfo = true
},
setEnquiry(info) {
this.clickInfo = info
this.dialogType = 'set-enquiry'
this.dialogTitle = '询价'
this.dialogVisible = true
},
selectQuote(info) {
this.clickInfo = info
this.dialogType = 'select-quote'
this.dialogTitle = '选商'
this.dialogVisible = true
},
closeDialog(){
this.dialogVisible = false
this.$refs.table1.refresh()
},
showPayList(row) {
this.$refs.PayList.open(row.payList)
},
},
// 监听属性
watch: {},
// 过滤器
filters: {},
// 计算属性
computed: {}
};
</script>
<style lang="scss" scoped>
.page-body {
}
</style>
+476
View File
@@ -0,0 +1,476 @@
<template>
<view class="page-body">
<!-- 页面内容开始 -->
<!-- 表格搜索组件开始 -->
<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"
@search="search"></vk-data-table-query>
<!-- 表格搜索组件结束 -->
<!-- 自定义按钮区域开始 -->
<view>
<el-row>
</el-row>
</view>
<!-- 自定义按钮区域结束 -->
<!-- 表格组件开始 -->
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
:pagination="true" @current-change="currentChange"
>
<template v-slot:action="{ row, column, index }">
<template v-if="row.orderStatus === 1">
<el-button type="success" size="mini" @click.native="setExpress(row)">派单</el-button>
</template>
<template v-if="row.type === 1">
<el-button size="mini" plain @click.native="showSelfProductInfo(row)">详情</el-button>
</template>
<template v-if="row.orderStatus === 10">
<el-button size="mini" type="success" @click.native="setPrice(row)">报价</el-button>
</template>
</template>
<template v-slot:goods="{ row, column, index }">
<div v-for="(item, index) in row.goods" :key="index" style="
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: flex-start;">
<p>商品名称: {{ item.goodsName }}</p>
<p>数量: {{ item.num }}</p>
<p v-if="row.orderStatus !== 10">单价: {{ item.goodsPrice }}</p>
<template v-if="row.subType === 2 && item.amountItem">
<p>项基础收费: {{ item.amountItem.amount }}元</p>
<p v-if="item.costNum">清单单品项数: {{ item.costNum }}</p>
<p>项数加价: {{ item.amountItem.addAmount }}元</p>
<p>建议收费: {{ item.amountItem.amount + (item.costNum * item.amountItem.addAmount) }}元</p>
</template>
<el-divider v-if="index < row.goods.length - 1"/>
</div>
</template>
</vk-data-table>
<!-- 表格组件结束 -->
<!-- 添加或编辑的弹窗开始 -->
<vk-data-dialog v-model="form1.props.show" :title="form1.props.title" width="60%" mode="form"
:close-on-click-modal="false">
<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
:form-type="form1.props.formType" :columns='form1.props.columns' label-width="120px"
@success="form1.props.show = false;refresh();"></vk-data-form>
</vk-data-dialog>
<!-- 添加或编辑的弹窗结束 -->
<!-- 页面内容结束 -->
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="60%">
<self-product-info :order-info="clickInfo" :order-id="clickInfo._id" :goods="clickInfo.goods"
:is-set="isSet"
v-if="dialogVisible && dialogType === 'self-product'" @close="refresh"/>
</el-dialog>
</view>
</template>
<script>
import SelfProductInfo from "./components/selfProductInfo.vue";
import SetSelfSupport from "./components/setSelfSupport.vue";
var that; // 当前页面对象
var vk = uni.vk; // vk实例
var originalForms = {}; // 表单初始化数据
export default {
components: {SetSelfSupport, SelfProductInfo},
data() {
// 页面数据变量
return {
showInfo: false,
dialogTitle: null,
dialogType: null,
dialogVisible: false,
info: null,
clickInfo: null,
title: '',
isSet: false,
infoColumns: [],
// 页面是否请求中或加载中
loading: false,
// init请求返回的数据
data: {},
// 表格相关开始 -----------------------------------------------------------
table1: {
// 表格数据请求地址
action: "admin/order/sys/getList",
// 表格字段显示规则
columns: [
{
key: "orderNo",
title: "订单号",
type: "text",
},
{
key: "amount",
title: "订单金额",
type: "html",
formatter: (val = [], row, column, index) => {
let content = `<div>订单金额:¥` + row.amount + `</div>`
content += `<div>应付金额:¥${row.offAmount}</div>`
if (row.type < 4 && row.payAmount) {
content += `<div>实付金额:¥${row.payAmount ? row.payAmount : ''}</div>`
}
return content
}
},
{
key: "orderStatus",
title: "订单状态",
type: "text",
align: "center",
formatter: (val = [], row, column, index) => {
const orderStatusList = [
'待支付',
'待发货',
'待收货',
'待确认',
'已完成',
'退款审核中',
'退款成功',
'退款失败',
'',
'',
'待报价',
'已派单待完成',
]
let str = orderStatusList[val]
if (val === 7) str += `: ${row.refundRefuseReason}`
return str
}
},
{
key: "user",
title: "买方",
type: "html",
formatter: (val = [], row, column, index) => {
let content = `<div>` + val.mobile + `</div>`
content += `<div>` + val.accountType === 2 ? val.company.companyName : val.person.personName + `</div>`
return content
}
},
{
key: "goods",
title: "商品列表",
type: "html",
},
{
key: "_add_time",
title: "下单时间",
type: "time",
align: "left",
width: 160,
sortable: "custom"
},
{
key: "_add_time_diff",
title: "距离现在",
type: "html",
align: "left",
width: 120,
formatter: (val, row) => vk.pubfn.dateDiff(row._add_time)
},
{
key: "action",
title: "操作",
type: "html",
}
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: ""
},
// 表格相关结束 -----------------------------------------------------------
// 表单相关开始 -----------------------------------------------------------
// 查询表单请求数据
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {
type: 1
},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
{
key: "type",
title: "类型",
type: "text",
hidden: true
},
{
key: "subType",
title: "服务类型",
type: "select",
data: [
{value: 0, label: '考察服务'},
{value: 1, label: '产品考察服务'},
{value: 2, label: '造价询价服务'},
]
},
{
key: "orderNo",
title: "订单号",
type: "text",
width: 160,
mode: "%%"
},
{
key: "orderStatus",
title: "订单状态",
type: "select",
data: [
{value: 0, label: '待支付'},
{value: 1, label: '待发货'},
{value: 2, label: '待收货'},
{value: 3, label: '待确认'},
{value: 4, label: '已完成'},
{value: 5, label: '退款审核中'},
{value: 6, label: '退款成功'},
{value: 7, label: '退款失败'},
{value: 10, label: '待报价'},
{value: 11, label: '已派单待完成'},
]
},
{
key: "_add_time",
title: "下单时间",
type: "datetimerange",
width: 400,
mode: "[]"
},
]
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
sort: 0
},
// 表单属性
props: {
// 表单请求地址
action: "",
// 表单字段显示规则
columns: [
{
key: "orderNo",
title: "订单号",
type: "text",
placeholder: "请输入分类名称"
},
{
key: "icon",
title: "图标",
type: "icon",
placeholder: "请选择图标"
},
{
key: "parent_id",
title: "上级分类",
type: "tree-select",
placeholder: "请选择上级分类",
action: "admin/spot/category/sys/getTree",
props: {
list: "rows",
value: "_id",
label: "name",
children: "children"
},
},
{
key: "remark",
title: "备注",
type: "textarea",
maxlength: "99",
showWordLimit: true,
autosize: {
minRows: 2,
maxRows: 10
},
},
{
key: "sort",
title: "排序",
type: "number",
precision: 0,
placeholder: "请输入排序值",
},
],
// 表单验证规则
rules: {
sort: [{
type: 'number',
message: '排序值必须为数字'
}],
name: [
{required: true, message: '分类名称不能为空', trigger: 'blur'},
],
},
// add 代表添加 update 代表修改
formType: "",
// 是否显示表单的弹窗
show: false
}
},
// 其他弹窗表单
formDatas: {},
// 表单相关结束 -----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.options.type = 1
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {
},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {
},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {
},
// 函数
methods: {
// 页面数据初始化函数
init(options) {
originalForms["form1"] = vk.pubfn.copyObject(that.form1);
},
// 页面跳转
pageTo(path) {
vk.navigateTo(path);
},
// 表单重置
resetForm() {
vk.pubfn.resetForm(originalForms, that);
},
// 搜索
search() {
that.$refs.table1.search();
},
// 刷新
refresh() {
that.$refs.table1.refresh();
this.dialogVisible = false
},
// 获取当前选中的行的数据
getCurrentRow() {
return that.$refs.table1.getCurrentRow();
},
// 监听 - 行的选中高亮事件
currentChange(val) {
that.table1.selectItem = val;
},
// 当选择项发生变化时会触发该事件
selectionChange(list) {
that.table1.multipleSelection = list;
},
// 显示添加页面
addBtn() {
that.resetForm();
that.form1.props.action = 'admin/contract/template/sys/add';
that.form1.props.formType = 'add';
that.form1.props.title = '添加';
that.form1.props.show = true;
},
// 显示修改页面
updateBtn({
item
}) {
that.form1.props.action = 'admin/contract/template/sys/update';
that.form1.props.formType = 'update';
that.form1.props.title = '编辑';
that.form1.props.show = true;
that.form1.data = item;
},
// 删除按钮
deleteBtn({
item,
deleteFn
}) {
deleteFn({
action: "admin/contract/template/sys/delete",
data: {
_id: item._id
},
});
},
// 监听 - 批量操作的按钮点击事件
batchBtn(index) {
switch (index) {
case 1:
vk.toast("批量操作按钮1");
break;
case 2:
vk.toast("批量操作按钮2");
break;
default:
break;
}
},
changeField(id, field, value) {
vk.callFunction({
url: 'admin/old/sys/changeField',
data: {
id, field, value
}
}).then(() => {
this.$refs.table1.refresh()
})
},
doShowInfo(info) {
this.info = info
this.title = '详情'
this.showInfo = true
},
setExpress(item) {
this.clickInfo = item
this.dialogType = 'self-product'
this.dialogTitle = '自营订单派单'
this.isSet = true
this.dialogVisible = true
},
showSelfProductInfo(item) {
this.clickInfo = item
this.dialogType = 'self-product'
this.dialogTitle = '自营订单详情'
this.isSet = false
this.dialogVisible = true
},
setPrice(row) {
this.$prompt('请输入价格', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
}).then(({value}) => {
vk.callFunction({
url: 'admin/order/sys/setPrice',
data: {
_id: row._id,
amount: value
}
}).then(() => {
this.$refs.table1.refresh()
})
})
}
},
// 监听属性
watch: {},
// 过滤器
filters: {},
// 计算属性
computed: {}
};
</script>
<style lang="scss" scoped>
.page-body {
}
</style>
+387
View File
@@ -0,0 +1,387 @@
<template>
<view class="page-body">
<!-- 页面内容开始 -->
<!-- 表格搜索组件开始 -->
<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"
@search="search"></vk-data-table-query>
<!-- 表格搜索组件结束 -->
<!-- 自定义按钮区域开始 -->
<view>
<el-row>
</el-row>
</view>
<!-- 自定义按钮区域结束 -->
<!-- 表格组件开始 -->
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
:pagination="true" @current-change="currentChange"
>
<template v-slot:action="{ row, column, index }">
<!-- <el-button size="mini" @click.native="doShowInfo(row)">详情</el-button>-->
</template>
<template v-slot:isShow="{ row, column, index }">
<el-switch v-if="row.status === 0" v-model="row.isShow" size="mini"
@change="changeField(row._id, 'isShow', $event)"
:active-value="1"
:inactive-value="0"/>
<span v-else></span>
</template>
</vk-data-table>
<!-- 表格组件结束 -->
<!-- 添加或编辑的弹窗开始 -->
<vk-data-dialog v-model="form1.props.show" :title="form1.props.title" width="60%" mode="form"
:close-on-click-modal="false">
<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
:form-type="form1.props.formType" :columns='form1.props.columns' label-width="120px"
@success="form1.props.show = false;refresh();"></vk-data-form>
</vk-data-dialog>
<!-- 添加或编辑的弹窗结束 -->
<!-- 页面内容结束 -->
</view>
</template>
<script>
var that; // 当前页面对象
var vk = uni.vk; // vk实例
var originalForms = {}; // 表单初始化数据
import provinces from "@/uni_modules/vk-uview-ui/libs/address/provinces.json";
import citys from "@/uni_modules/vk-uview-ui/libs/address/citys.json";
import areas from "@/uni_modules/vk-uview-ui/libs/address/areas.json";
export default {
data() {
// 页面数据变量
return {
showInfo: false,
info: null,
title: '',
provinceData: provinces,
cityData: citys,
areaData: areas,
infoColumns: [
{key: "company.companyName", title: "企业名称", type: "text"},
{key: "company.organization", title: "统一社会信用代码", type: "text"},
{key: "company.companyName", title: "公司所在地", type: "text"},
{key: "company.companyName", title: "详细地址", type: "text"},
{key: "company.mailAddress", title: "有效通信地址", type: "text"},
{key: "company.contactEmail", title: "有效邮箱地址", type: "text"},
{key: "company.companyAccount", title: "对公账号", type: "text"},
{key: "company.companyBankName", title: "开户行", type: "text"},
{key: "company.personAccount", title: "个人账号", type: "text"},
{key: "company.personBankName", title: "个人开户行", type: "text"},
{key: "company.accountName", title: "户名", type: "text"},
{key: "company.personBankName", title: "个人开户行", type: "text"},
{key: "company.organizationPath", title: "营业执照", type: "image"},
{key: "company.businessType", title: "经营类目", type: "text"},
{key: "company.invoiceInfo", title: "上开票资料", type: "image"},
{key: "company.taxType", title: "纳税人类型", type: "text"},
{key: "company.taxImage", title: "纳税人资格", type: "image"},
{key: "manager.personName", title: "代理人类型", type: "text"},
{
key: "manager.certType", title: "证件类型", type: "html", formatter: (val, row, column, index) => {
return `<div>${row.certType === 0 ? '身份证' : '护照'}</div>`;
}
},
{key: "manager.idCard", title: "代理人证件号", type: "text"},
{key: "manager.mobile", title: "代理人电话", type: "text"},
{key: "manager.headPhotoPath", title: "身份证头像面", type: "image"},
{key: "manager.backgroundIdCardPath", title: "身份证国徽面", type: "image"},
],
// 页面是否请求中或加载中
loading: false,
// init请求返回的数据
data: {},
// 表格相关开始 -----------------------------------------------------------
table1: {
// 表格数据请求地址
action: "admin/spot/sys/getList",
// 表格字段显示规则
columns: [
{
key: "name",
title: "标题",
type: "text",
align: "left",
},
{
key: "stock",
title: "现货库存",
type: "text",
align: "left",
formatter: (val , row, column, index) => {
return `${val}吨`
}
},
{
key: "address",
title: "收货地",
type: "text",
align: "left",
formatter: (val = [], row, column, index) => {
return val.province.name + "-" + val.city.name + "-" + val.area.name;
}
},
{
key: "",
title: "供货企业",
type: "text",
align: "left",
formatter: (val = [], row, column, index) => {
return row.user.accountType === 1 ? row.user.person.personName : row.user.company.companyName;
}
},
{key: "isShow", title: "是否显示", type: "html"},
{
key: "_add_time",
title: "发布时间",
type: "time",
align: "left",
width: 160,
sortable: "custom"
},
{
key: "_add_time",
title: "距离现在",
type: "dateDiff",
align: "left",
width: 120
},
{key: "action", title: "操作", type: "html"},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: ""
},
// 表格相关结束 -----------------------------------------------------------
// 表单相关开始 -----------------------------------------------------------
// 查询表单请求数据
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
// {
// key: "name",
// title: "名称",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "remark",
// title: "备注",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "_add_time",
// title: "添加时间",
// type: "datetimerange",
// width: 400,
// mode: "[]"
// },
]
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
sort: 0
},
// 表单属性
props: {
// 表单请求地址
action: "",
// 表单字段显示规则
columns: [{
key: "name",
title: "名称",
type: "text",
placeholder: "请输入分类名称"
},
{
key: "icon",
title: "图标",
type: "icon",
placeholder: "请选择图标"
},
{
key: "parent_id",
title: "上级分类",
type: "tree-select",
placeholder: "请选择上级分类",
action: "admin/spot/category/sys/getTree",
props: {
list: "rows",
value: "_id",
label: "name",
children: "children"
},
},
{
key: "remark",
title: "备注",
type: "textarea",
maxlength: "99",
showWordLimit: true,
autosize: {
minRows: 2,
maxRows: 10
},
},
{
key: "sort",
title: "排序",
type: "number",
precision: 0,
placeholder: "请输入排序值",
},
],
// 表单验证规则
rules: {
sort: [{
type: 'number',
message: '排序值必须为数字'
}],
name: [
{required: true, message: '分类名称不能为空', trigger: 'blur'},
],
},
// add 代表添加 update 代表修改
formType: "",
// 是否显示表单的弹窗
show: false
}
},
// 其他弹窗表单
formDatas: {},
// 表单相关结束 -----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {
},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {
},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {
},
// 函数
methods: {
// 页面数据初始化函数
init(options) {
originalForms["form1"] = vk.pubfn.copyObject(that.form1);
},
// 页面跳转
pageTo(path) {
vk.navigateTo(path);
},
// 表单重置
resetForm() {
vk.pubfn.resetForm(originalForms, that);
},
// 搜索
search() {
that.$refs.table1.search();
},
// 刷新
refresh() {
that.$refs.table1.refresh();
},
// 获取当前选中的行的数据
getCurrentRow() {
return that.$refs.table1.getCurrentRow();
},
// 监听 - 行的选中高亮事件
currentChange(val) {
that.table1.selectItem = val;
},
// 当选择项发生变化时会触发该事件
selectionChange(list) {
that.table1.multipleSelection = list;
},
// 显示添加页面
addBtn() {
that.resetForm();
that.form1.props.action = 'admin/contract/template/sys/add';
that.form1.props.formType = 'add';
that.form1.props.title = '添加';
that.form1.props.show = true;
},
// 显示修改页面
updateBtn({
item
}) {
that.form1.props.action = 'admin/contract/template/sys/update';
that.form1.props.formType = 'update';
that.form1.props.title = '编辑';
that.form1.props.show = true;
that.form1.data = item;
},
// 删除按钮
deleteBtn({
item,
deleteFn
}) {
deleteFn({
action: "admin/contract/template/sys/delete",
data: {
_id: item._id
},
});
},
// 监听 - 批量操作的按钮点击事件
batchBtn(index) {
switch (index) {
case 1:
vk.toast("批量操作按钮1");
break;
case 2:
vk.toast("批量操作按钮2");
break;
default:
break;
}
},
changeField(id, field, value) {
vk.callFunction({
url: 'admin/spot/sys/changeField',
data: {
id, field, value
}
}).then(() => {
this.$refs.table1.refresh()
})
},
doShowInfo(info) {
this.info = info
this.title = '详情'
this.showInfo = true
},
},
// 监听属性
watch: {},
// 过滤器
filters: {},
// 计算属性
computed: {}
};
</script>
<style lang="scss" scoped>
.page-body {
}
</style>
+836
View File
@@ -0,0 +1,836 @@
<template>
<view class="page-body">
<!-- 页面内容开始 -->
<!-- 表格搜索组件开始 -->
<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"
@search="search"></vk-data-table-query>
<!-- 表格搜索组件结束 -->
<!-- 自定义按钮区域开始 -->
<view>
<el-row>
<el-button type="success" size="small" icon="el-icon-circle-plus-outline" @click="addBtn">添加
</el-button>
<!-- 批量操作 -->
<el-dropdown v-if="table1.multipleSelection" :split-button="false" trigger="click" @command="batchBtn">
<!-- <el-button type="danger" size="small" style="margin-left: 20rpx;"
:disabled="table1.multipleSelection.length === 0">
批量操作<i class="el-icon-arrow-down el-icon--right"></i>
</el-button> -->
<el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item :command="1">批量操作1</el-dropdown-item>
<el-dropdown-item :command="2">批量操作2</el-dropdown-item> -->
</el-dropdown-menu>
</el-dropdown>
</el-row>
</view>
<!-- 自定义按钮区域结束 -->
<!-- 表格组件开始 -->
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
:right-btns="['detail_auto','update','delete']" :default-expand-all="false" @update="updateBtn"
@delete="deleteBtn" @current-change="currentChange" :pagination="true"
@selection-change="selectionChange"></vk-data-table>
<!-- 表格组件结束 -->
<!-- 添加或编辑的弹窗开始 -->
<vk-data-dialog v-model="form1.props.show" :title="form1.props.title" width="60%" mode="form"
:close-on-click-modal="false">
<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
:before-action="form1.props.beforeAction"
:form-type="form1.props.formType" :columns='form1.props.columns' label-width="120px"
@success="form1.props.show = false;refresh();"></vk-data-form>
</vk-data-dialog>
<!-- 添加或编辑的弹窗结束 -->
<!-- 页面内容结束 -->
</view>
</template>
<script>
var that; // 当前页面对象
var vk = uni.vk; // vk实例
var originalForms = {}; // 表单初始化数据
export default {
data() {
// 页面数据变量
return {
// 页面是否请求中或加载中
loading: false,
// init请求返回的数据
data: {},
// 表格相关开始 -----------------------------------------------------------
table1: {
// 表格数据请求地址
action: "admin/ad/sys/list",
// 表格字段显示规则
columns: [
{
key: "_id",
title: "id",
type: "text",
width: 220
},
{
key: "adKey",
title: "广告位",
type: "tag",
data: [
{value: 3, label: "首页优秀厂家广告位3"},
{value: 4, label: "首页优秀厂家广告位4"},
{value: 5, label: "首页推广广告位5"},
{value: 6, label: "首页推广广告位6"},
{value: 7, label: "首页推广广告位7"},
{value: 8, label: "首页推广广告位8"},
{value: 9, label: "现货底端小图广告位9"},
{value: 10, label: "现货底端小图广告位10"},
{value: 11, label: "找供应厂家广告位11-1"},
{value: 112, label: "找供应厂家广告位11-2"},
{value: 12, label: "加工厂列表广告位12"},
{value: 122, label: "加工厂列表广告位12-2"},
{value: 13, label: "找加工首页广告位13"},
{value: 14, label: "找加工首页广告位14"},
{value: 15, label: "旧货拍卖信息广告位15"},
{value: 16, label: "旧货拍卖信息广告位16"},
{value: 17, label: "旧货采购信息广告位17"},
{value: 18, label: "旧货采购信息广告位18"},
{value: 19, label: "旧货租赁信息广告位19"},
{value: 20, label: "旧货租赁信息广告位20"},
{value: 21, label: "旧货物资回收信息广告位21"},
{value: 22, label: "旧货物资回收信息广告位22"},
{value: 23, label: "黄页底端小图广告位23"},
{value: 24, label: "黄页底端小图广告位24"},
{value: 25, label: "黄页底端小图广告位25"},
{value: 26, label: "黄页底端小图广告位26"},
{value: 27, label: "特产商城广告位1"},
{value: 28, label: "特产商城广告位2"},
{value: 29, label: "特产商城广告位3"},
{value: 30, label: "特产商城广告位4"},
{value: 31, label: "特产商城广告位5"},
{value: 32, label: "自营合作广告位27(1200*100/600*100)"},
{value: 33, label: "自营合作广告位28(1200*100/600*100)"},
{value: 34, label: "自营合作广告位29(1200*100/600*100)"},
{value: 35, label: "自营合作广告位30(1200*100/600*100)"},
{value: 36, label: "现货单品广告位36"},
{value: 37, label: "找供应单品广告位37"},
{value: 38, label: "加工厂单品广告位38"},
]
},
{
key: "swiper",
title: "图片",
type: "image",
},
{
key: "region",
title: "区域",
type: "address",
},
{
key: "company",
type: "text",
title: "指定公司",
formatter: (val, row, column, index) => {
if (val) return val.company.companyName
}
},
{
key: "spotGoods",
type: "text",
title: "指定现货",
formatter: (val, row, column, index) => {
if (val) return val.name
}
},
{
key: "_add_time",
title: "添加时间",
type: "time",
align: "left",
width: 160,
sortable: "custom"
},
{
key: "_add_time_diff",
title: "距离现在",
type: "html",
align: "left",
width: 120,
formatter: (val, row) => vk.pubfn.dateDiff(row._add_time)
},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: ""
},
// 表格相关结束 -----------------------------------------------------------
// 表单相关开始 -----------------------------------------------------------
// 查询表单请求数据
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
{
key: "adKey",
title: "广告位",
type: "select",
filterable: true,
clearable: true,
data: [
{value: 3, label: "首页优秀厂家广告位3"},
{value: 4, label: "首页优秀厂家广告位4"},
{value: 5, label: "首页推广广告位5"},
{value: 6, label: "首页推广广告位6"},
{value: 7, label: "首页推广广告位7"},
{value: 8, label: "首页推广广告位8"},
{value: 9, label: "现货底端小图广告位9"},
{value: 10, label: "现货底端小图广告位10"},
{value: 11, label: "找供应厂家广告位11-1"},
{value: 112, label: "找供应厂家广告位11-2"},
{value: 12, label: "加工厂列表广告位12"},
{value: 122, label: "加工厂列表广告位12-2"},
{value: 13, label: "找加工首页广告位13"},
{value: 14, label: "找加工首页广告位14"},
{value: 15, label: "旧货拍卖信息广告位15"},
{value: 16, label: "旧货拍卖信息广告位16"},
{value: 17, label: "旧货采购信息广告位17"},
{value: 18, label: "旧货采购信息广告位18"},
{value: 19, label: "旧货租赁信息广告位19"},
{value: 20, label: "旧货租赁信息广告位20"},
{value: 21, label: "旧货物资回收信息广告位21"},
{value: 22, label: "旧货物资回收信息广告位22"},
{value: 23, label: "黄页底端小图广告位23"},
{value: 24, label: "黄页底端小图广告位24"},
{value: 25, label: "黄页底端小图广告位25"},
{value: 26, label: "黄页底端小图广告位26"},
{value: 27, label: "特产商城广告位1"},
{value: 28, label: "特产商城广告位2"},
{value: 29, label: "特产商城广告位3"},
{value: 30, label: "特产商城广告位4"},
{value: 31, label: "特产商城广告位5"},
{value: 32, label: "自营合作广告位27(1200*100/600*100)"},
{value: 33, label: "自营合作广告位28(1200*100/600*100)"},
{value: 34, label: "自营合作广告位29(1200*100/600*100)"},
{value: 35, label: "自营合作广告位30(1200*100/600*100)"},
{value: 36, label: "现货单品广告位36"},
{value: 37, label: "找供应单品广告位37"},
{value: 38, label: "加工厂单品广告位38"},
]
},
// {
// key: "name",
// title: "名称",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "remark",
// title: "备注",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "_add_time",
// title: "添加时间",
// type: "datetimerange",
// width: 400,
// mode: "[]"
// },
]
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
sort: 0,
amount: 0,
type: 'company',
filterMode: 'region',
regionSelector: [],
regionProvinceSelector: {},
categoryIds: [],
categoryNames: []
},
// 表单属性
props: {
// 表单请求地址
action: "",
beforeAction: formData => {
const data = vk.pubfn.copyObject(formData);
data.region = this.getSubmitRegion(data);
const categoryInfo = this.getSubmitCategory(data);
data.categoryIds = categoryInfo.categoryIds;
data.categoryNames = categoryInfo.categoryNames;
data.categoryId = categoryInfo.categoryIds[0] || '';
data.categoryName = categoryInfo.categoryNames[0] || '';
delete data.regionSelector;
delete data.regionProvinceSelector;
return data;
},
// 表单字段显示规则
columns: [
{
key: "adKey",
title: "广告位",
type: "select",
placeholder: "请选择广告位",
filterable: true,
clearable: true,
data: [
{value: 3, label: "首页优秀厂家广告位3(600*100)"},
{value: 4, label: "首页优秀厂家广告位4(600*100)"},
{value: 5, label: "首页推广广告位5(600*100)"},
{value: 6, label: "首页推广广告位6(600*100)"},
{value: 7, label: "首页推广广告位7(600*100)"},
{value: 8, label: "首页推广广告位8(600*100)"},
{value: 9, label: "现货底端小图广告位9(600*100)"},
{value: 10, label: "现货底端小图广告位10(600*100)"},
{value: 11, label: "找供应厂家广告位11-1(600*100)"},
{value: 112, label: "找供应厂家广告位11-2(600*100)"},
{value: 12, label: "加工厂列表广告位12(600*100)"},
{value: 122, label: "加工厂列表广告位12-2(600*100)"},
{value: 13, label: "找加工首页广告位13(600*100)"},
{value: 14, label: "找加工首页广告位14(600*100)"},
{value: 15, label: "旧货拍卖信息广告位15(1200*100/600*100)"},
{value: 16, label: "旧货拍卖信息广告位16(1200*100/600*100)"},
{value: 17, label: "旧货采购信息广告位17(1200*100/600*100)"},
{value: 18, label: "旧货采购信息广告位18(1200*100/600*100)"},
{value: 19, label: "旧货租赁信息广告位19(1200*100/600*100)"},
{value: 20, label: "旧货租赁信息广告位20(1200*100/600*100)"},
{value: 21, label: "旧货物资回收信息广告位21(1200*100/600*100)"},
{value: 22, label: "旧货物资回收信息广告位22(1200*100/600*100)"},
{value: 23, label: "黄页底端小图广告位23(1200*100/600*100)"},
{value: 24, label: "黄页底端小图广告位24(1200*100/600*100)"},
{value: 25, label: "黄页底端小图广告位25(1200*100/600*100)"},
{value: 26, label: "黄页底端小图广告位26(1200*100/600*100)"},
{value: 27, label: "特产商城广告位1(1200*150)"},
{value: 28, label: "特产商城广告位2(1200*150)"},
{value: 29, label: "特产商城广告位3(1200*150)"},
{value: 30, label: "特产商城广告位4(1200*150)"},
{value: 31, label: "特产商城广告位5(1200*150)"},
{value: 32, label: "自营合作广告位27(1200*100/600*100)"},
{value: 33, label: "自营合作广告位28(1200*100/600*100)"},
{value: 34, label: "自营合作广告位29(1200*100/600*100)"},
{value: 35, label: "自营合作广告位30(1200*100/600*100)"},
{value: 36, label: "现货单品广告位36"},
{value: 37, label: "找供应单品广告位37"},
{value: 38, label: "加工厂单品广告位38"},
]
},
{
key: "swiper",
title: "图片",
type: "image",
limit: 1
},
{
key: "filterMode",
title: "筛选方式",
type: "select",
data: [
{value: 'region', label: "按区域"},
{value: 'category', label: "按分类"},
],
showRule: formData => {
return this.supportsCategoryFilterAd(formData.adKey)
}
},
{
key: "regionSelector",
title: "区域",
type: "cascader",
placeholder: "请选择区域",
filterable: true,
data: () => this.getFlexibleRegionOptions(),
props: {
checkStrictly: true,
emitPath: true,
value: "code",
label: "name",
children: "children"
},
showRule: formData => {
return !this.isSpotGoodsAd(formData.adKey) && this.isFlexibleRegionAd(formData.adKey)
}
},
{
key: "regionProvinceSelector",
title: "区域",
type: "province",
placeholder: "请选择省份",
showRule: formData => {
return !this.isSpotGoodsAd(formData.adKey) && !this.isFlexibleRegionAd(formData.adKey) && !this.isCategoryFilterMode(formData)
}
},
{
key: "categoryIds",
title: "分类",
type: "select",
placeholder: "请选择分类",
multiple: true,
filterable: true,
clearable: true,
data: () => this.getCategoryOptions(this.form1.data.adKey),
showRule: formData => {
return this.isCategoryFilterMode(formData)
}
},
{
key: "type",
title: "类型",
type: "select",
data: [
{value: 'company', label: "公司"},
{value: 'goods', label: "商品"},
],
showRule: formData => {
return !this.isSpotGoodsAd(formData.adKey)
}
},
{
key: "companyId",
title: "指定公司",
type: "remote-select",
showAll: true,
filterable: true,
placeholder: "请选择指定公司",
action: "admin/system/user/sys/getList",
actionData: {
pageIndex: 1,
pageSize: 500,
type: 2
},
props: {
list: "rows",
value: "_id",
label: "name",
},
dataPreprocess: (list) => {
list = list.filter(item => (item.company && item.company.companyName && item.company.companyName !== ''))
list.map((item, index) => {
item.name = `${item.company.companyName}(${item.mobile})`
return item
});
return list;
},
showRule: formData => {
return !this.isSpotGoodsAd(formData.adKey) && (formData.type === 'company' || !formData.type)
}
},
{
key: "goodsId",
title: "指定商品",
type: "remote-select",
showAll: true,
placeholder: "请选择指定商品",
action: "admin/goods/list/sys/list",
actionData: {
pageIndex: 1,
pageSize: 500,
type: 2
},
props: {
list: "rows",
value: "_id",
label: "name",
},
showRule: formData => {
return !this.isSpotGoodsAd(formData.adKey) && formData.type === 'goods'
}
},
{
key: "spotGoodsId",
title: "指定现货",
type: "remote-select",
showAll: true,
placeholder: "请选择指定现货",
action: "admin/spot/goods/sys/getList",
actionData: {
pageIndex: 1,
pageSize: 500,
},
props: {
list: "rows",
value: "_id",
label: "name",
},
dataPreprocess: (list) => {
list.map(item => {
const address = item.address && item.address.province ? `${item.address.province.name}${item.address.city.name}${item.address.area.name}` : ''
item.name = `${item.name}${address ? `(${address})` : ''}`
return item
})
return list
},
showRule: formData => {
return this.isSpotGoodsAd(formData.adKey)
}
},
],
// 表单验证规则
rules: {
adKey: [
{required: true, message: '请选择广告位', trigger: 'blur'},
],
swiper: [
{required: true, message: '请上传图片', trigger: 'blur'},
],
companyId: [
{
validator: (rule, value, callback) => {
const formData = this.form1.data || {}
if (!this.isSpotGoodsAd(formData.adKey) && !this.isCategoryFilterMode(formData) && (formData.type === 'company' || !formData.type) && !value) {
callback(new Error('请选择指定公司'))
return
}
callback()
}, trigger: 'blur'
},
],
goodsId: [
{
validator: (rule, value, callback) => {
const formData = this.form1.data || {}
if (!this.isSpotGoodsAd(formData.adKey) && !this.isCategoryFilterMode(formData) && formData.type === 'goods' && !value) {
callback(new Error('请选择指定商品'))
return
}
callback()
}, trigger: 'blur'
},
],
categoryIds: [
{
validator: (rule, value, callback) => {
const formData = this.form1.data || {}
if (this.isCategoryFilterMode(formData) && (!Array.isArray(value) || value.length === 0)) {
callback(new Error('请选择分类'))
return
}
callback()
}, trigger: 'blur'
}
],
regionSelector: [
{
validator: (rule, value, callback) => {
const formData = this.form1.data || {}
if (this.isCategoryFilterMode(formData) && (!Array.isArray(value) || value.length === 0)) {
callback(new Error('请选择区域'))
return
}
callback()
}, trigger: 'blur'
}
],
spotGoodsId: [
{
validator: (rule, value, callback) => {
const formData = this.form1.data || {}
if (this.isSpotGoodsAd(formData.adKey) && !value) {
callback(new Error('请选择指定现货'))
return
}
callback()
}, trigger: 'blur'
},
],
},
// add 代表添加 update 代表修改
formType: "",
// 是否显示表单的弹窗
show: false
}
},
// 其他弹窗表单
formDatas: {},
// 表单相关结束 -----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {
},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {
},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {
},
// 函数
methods: {
isSpotGoodsAd(adKey) {
const spotGoodsAdKeys = [36, 37, 38];
return spotGoodsAdKeys.includes(parseInt(adKey));
},
supportsCategoryFilterAd(adKey) {
const categoryFilterAdKeys = [9, 10, 11, 12, 13, 14, 112, 122];
return categoryFilterAdKeys.includes(parseInt(adKey));
},
isCategoryFilterMode(formData = {}) {
return this.supportsCategoryFilterAd(formData.adKey) && formData.filterMode === 'category';
},
isFlexibleRegionAd(adKey) {
const flexibleRegionAdKeys = [9, 10, 11, 112, 12, 122, 13, 14];
return flexibleRegionAdKeys.includes(parseInt(adKey));
},
getCategoryOptions(adKey) {
const targetAdKey = parseInt(adKey);
if (![9, 10].includes(targetAdKey)) {
if ([11, 112].includes(targetAdKey)) return this.getSpotCategoryOptions();
if ([12, 13, 14, 122].includes(targetAdKey)) return this.getProcessCategoryOptions();
return [];
}
return this.getSpotCategoryOptions();
},
getSpotCategoryOptions() {
return (this.data.spotCategoryOptions || []).map(item => ({
value: item._id,
label: `${item.parentName ? `${item.parentName} / ` : ''}${item.name}`,
rawName: item.name
}));
},
getProcessCategoryOptions() {
return (this.data.processCategoryOptions || []).map(item => ({
value: item._id,
label: item.name,
rawName: item.name
}));
},
getFlexibleRegionOptions() {
return vk.addressUtil.getPcaCode();
},
getRegionSelectorFromRegion(region) {
const selector = [];
if (region && region.province && region.province.code) {
selector.push(region.province.code);
if (region.city && region.city.code) {
selector.push(region.city.code);
if (region.area && region.area.code) {
selector.push(region.area.code);
}
}
}
return selector;
},
getProvinceSelectorFromRegion(region) {
if (region && region.province && region.province.code) {
return vk.pubfn.copyObject(region.province);
}
return {};
},
buildFlexibleRegion(selector = []) {
if (!Array.isArray(selector) || selector.length === 0) return {};
const options = this.getFlexibleRegionOptions();
const [provinceCode, cityCode, areaCode] = selector;
const province = options.find(item => item.code === provinceCode);
if (!province) return {};
const region = {
province: {
code: province.code,
name: province.name
}
};
if (cityCode && Array.isArray(province.children)) {
const city = province.children.find(item => item.code === cityCode);
if (city) {
region.city = {
code: city.code,
name: city.name
};
if (areaCode && Array.isArray(city.children)) {
const area = city.children.find(item => item.code === areaCode);
if (area) {
region.area = {
code: area.code,
name: area.name
};
}
}
}
}
return region;
},
buildProvinceRegion(province) {
if (province && province.code) {
return {
province: vk.pubfn.copyObject(province)
};
}
return {};
},
getSubmitCategory(formData = {}) {
if (!this.isCategoryFilterMode(formData)) {
return {
categoryIds: [],
categoryNames: []
};
}
const options = this.getCategoryOptions(formData.adKey);
const categoryIds = Array.isArray(formData.categoryIds)
? formData.categoryIds.filter(item => item !== '' && item !== null && item !== undefined)
: (vk.pubfn.isNotNull(formData.categoryId) ? [formData.categoryId] : []);
const categoryNames = Array.isArray(formData.categoryNames)
? formData.categoryNames.filter(item => item !== '' && item !== null && item !== undefined)
: (vk.pubfn.isNotNull(formData.categoryName) ? [formData.categoryName] : []);
const targetNames = categoryIds.map(categoryId => {
const target = options.find(item => item.value === categoryId);
return target ? (target.rawName || target.label) : '';
}).filter(Boolean);
return {
categoryIds,
categoryNames: targetNames.length ? targetNames : categoryNames
};
},
getSubmitRegion(formData = {}) {
if (this.isSpotGoodsAd(formData.adKey)) {
return formData.region;
}
if (this.isCategoryFilterMode(formData)) {
if (this.isFlexibleRegionAd(formData.adKey)) {
return this.buildFlexibleRegion(formData.regionSelector);
}
return this.buildProvinceRegion(formData.regionProvinceSelector);
}
if (this.isFlexibleRegionAd(formData.adKey)) {
return this.buildFlexibleRegion(formData.regionSelector);
}
return this.buildProvinceRegion(formData.regionProvinceSelector);
},
normalizeFormData(item = {}) {
const formData = vk.pubfn.copyObject(item);
if (!formData.filterMode) formData.filterMode = 'region';
formData.regionSelector = this.getRegionSelectorFromRegion(formData.region);
formData.regionProvinceSelector = this.getProvinceSelectorFromRegion(formData.region);
formData.categoryIds = Array.isArray(formData.categoryIds)
? formData.categoryIds
: (vk.pubfn.isNotNull(formData.categoryId) ? [formData.categoryId] : []);
formData.categoryNames = Array.isArray(formData.categoryNames)
? formData.categoryNames
: (vk.pubfn.isNotNull(formData.categoryName) ? [formData.categoryName] : []);
return formData;
},
// 页面数据初始化函数
init(options) {
originalForms["form1"] = vk.pubfn.copyObject(that.form1);
this.loadCategoryOptions();
},
async loadCategoryOptions() {
const [{rows: spotRows}, {rows: processRows}] = await Promise.all([
vk.callFunction({
url: 'client/spot/category/pub/getTree',
title: '请求中...'
}),
vk.callFunction({
url: 'client/process/category/pub/getTree',
title: '请求中...'
}),
]);
this.data.spotCategoryOptions = [];
(spotRows || []).forEach(parent => {
(parent.children || []).forEach(child => {
this.data.spotCategoryOptions.push({
...child,
parentName: parent.name
});
});
});
this.data.processCategoryOptions = processRows || [];
},
// 页面跳转
pageTo(path) {
vk.navigateTo(path);
},
// 表单重置
resetForm() {
vk.pubfn.resetForm(originalForms, that);
},
// 搜索
search() {
that.$refs.table1.search();
},
// 刷新
refresh() {
that.$refs.table1.refresh();
},
// 获取当前选中的行的数据
getCurrentRow() {
return that.$refs.table1.getCurrentRow();
},
// 监听 - 行的选中高亮事件
currentChange(val) {
that.table1.selectItem = val;
},
// 当选择项发生变化时会触发该事件
selectionChange(list) {
that.table1.multipleSelection = list;
},
// 显示添加页面
addBtn() {
that.resetForm();
that.form1.data = that.normalizeFormData(that.form1.data);
that.form1.props.action = 'admin/ad/sys/add';
that.form1.props.formType = 'add';
that.form1.props.title = '添加';
that.form1.props.show = true;
},
// 显示修改页面
updateBtn({
item
}) {
that.form1.props.action = 'admin/ad/sys/update';
that.form1.props.formType = 'update';
that.form1.props.title = '编辑';
that.form1.props.show = true;
that.form1.data = that.normalizeFormData(item);
},
// 删除按钮
deleteBtn({
item,
deleteFn
}) {
deleteFn({
action: "admin/ad/sys/delete",
data: {
_id: item._id
},
});
},
// 监听 - 批量操作的按钮点击事件
batchBtn(index) {
switch (index) {
case 1:
vk.toast("批量操作按钮1");
break;
case 2:
vk.toast("批量操作按钮2");
break;
default:
break;
}
}
},
// 监听属性
watch: {},
// 过滤器
filters: {},
// 计算属性
computed: {}
};
</script>
<style lang="scss" scoped>
.page-body {
}
</style>
+339
View File
@@ -0,0 +1,339 @@
<template>
<view class="page-body">
<!-- 页面内容开始 -->
<!-- 表格搜索组件开始 -->
<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"
@search="search"></vk-data-table-query>
<!-- 表格搜索组件结束 -->
<!-- 自定义按钮区域开始 -->
<view>
<el-row>
<el-button type="success" size="small" icon="el-icon-circle-plus-outline" @click="addBtn">添加
</el-button>
<!-- 批量操作 -->
<el-dropdown v-if="table1.multipleSelection" :split-button="false" trigger="click" @command="batchBtn">
<!-- <el-button type="danger" size="small" style="margin-left: 20rpx;"
:disabled="table1.multipleSelection.length === 0">
批量操作<i class="el-icon-arrow-down el-icon--right"></i>
</el-button> -->
<el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item :command="1">批量操作1</el-dropdown-item>
<el-dropdown-item :command="2">批量操作2</el-dropdown-item> -->
</el-dropdown-menu>
</el-dropdown>
</el-row>
</view>
<!-- 自定义按钮区域结束 -->
<!-- 表格组件开始 -->
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
:right-btns="['detail_auto','update','delete']" :default-expand-all="false" @update="updateBtn"
@delete="deleteBtn" @current-change="currentChange" :page-size="100"
:pagination="true"
@selection-change="selectionChange" pagination></vk-data-table>
<!-- 表格组件结束 -->
<!-- 添加或编辑的弹窗开始 -->
<vk-data-dialog v-model="form1.props.show" :title="form1.props.title" width="60%" mode="form"
:close-on-click-modal="false">
<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
:form-type="form1.props.formType" :columns='form1.props.columns' label-width="120px"
@success="form1.props.show = false;refresh();"></vk-data-form>
</vk-data-dialog>
<!-- 添加或编辑的弹窗结束 -->
<!-- 页面内容结束 -->
</view>
</template>
<script>
var that; // 当前页面对象
var vk = uni.vk; // vk实例
var originalForms = {}; // 表单初始化数据
export default {
data() {
// 页面数据变量
return {
// 页面是否请求中或加载中
loading: false,
// init请求返回的数据
data: {
pageSize: 100
},
// 表格相关开始 -----------------------------------------------------------
table1: {
// 表格数据请求地址
action: "admin/otherArticle/category/sys/list",
// 表格字段显示规则
columns: [
{
key: "_id",
title: "id",
type: "text",
width: 220
},
{
key: "name",
title: "名称",
type: "text",
width: 220,
align: "left",
},
// {
// key: "parent_id",
// title: "上级id",
// type: "text",
// width: 220,
// },
{
key: "remark",
title: "备注",
type: "text",
align: "left",
width: 220
},
{
key: "sort",
title: "排序",
type: "number",
align: "left",
width: 80,
},
{
key: "_add_time",
title: "添加时间",
type: "time",
align: "left",
width: 160,
sortable: "custom"
},
{
key: "_add_time_diff",
title: "距离现在",
type: "html",
align: "left",
width: 120,
formatter: (val, row) => vk.pubfn.dateDiff(row._add_time)
},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: ""
},
// 表格相关结束 -----------------------------------------------------------
// 表单相关开始 -----------------------------------------------------------
// 查询表单请求数据
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
{
key: "name",
title: "名称",
type: "text",
width: 160,
mode: "%%"
},
// {
// key: "remark",
// title: "备注",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "_add_time",
// title: "添加时间",
// type: "datetimerange",
// width: 400,
// mode: "[]"
// },
]
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
sort: 0
},
// 表单属性
props: {
// 表单请求地址
action: "",
// 表单字段显示规则
columns: [
{
key: "name",
title: "名称",
type: "text",
placeholder: "请输入分类名称"
},
// {
// key: "icon",
// title: "图标",
// type: "icon",
// placeholder: "请选择图标"
// },
// {
// key: "parent_id",
// title: "上级分类",
// type: "tree-select",
// placeholder: "请选择上级分类",
// action: "admin/otherArticle/category/sys/list",
// props: {
// list: "rows",
// value: "_id",
// label: "name",
// children: "children"
// },
// },
{
key: "remark",
title: "备注",
type: "textarea",
maxlength: "99",
showWordLimit: true,
autosize: {
minRows: 2,
maxRows: 10
},
},
{
key: "sort",
title: "排序",
type: "number",
precision: 0,
placeholder: "请输入排序值",
},
],
// 表单验证规则
rules: {
sort: [{
type: 'number',
message: '排序值必须为数字'
}],
name: [
{required: true, message: '分类名称不能为空', trigger: 'blur'},
],
},
// add 代表添加 update 代表修改
formType: "",
// 是否显示表单的弹窗
show: false
}
},
// 其他弹窗表单
formDatas: {},
// 表单相关结束 -----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {
},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {
},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {
},
// 函数
methods: {
// 页面数据初始化函数
init(options) {
originalForms["form1"] = vk.pubfn.copyObject(that.form1);
},
// 页面跳转
pageTo(path) {
vk.navigateTo(path);
},
// 表单重置
resetForm() {
vk.pubfn.resetForm(originalForms, that);
},
// 搜索
search() {
that.$refs.table1.search();
},
// 刷新
refresh() {
that.$refs.table1.refresh();
},
// 获取当前选中的行的数据
getCurrentRow() {
return that.$refs.table1.getCurrentRow();
},
// 监听 - 行的选中高亮事件
currentChange(val) {
that.table1.selectItem = val;
},
// 当选择项发生变化时会触发该事件
selectionChange(list) {
that.table1.multipleSelection = list;
},
// 显示添加页面
addBtn() {
that.resetForm();
that.form1.props.action = 'admin/otherArticle/category/sys/add';
that.form1.props.formType = 'add';
that.form1.props.title = '添加';
that.form1.props.show = true;
},
// 显示修改页面
updateBtn({
item
}) {
that.form1.props.action = 'admin/otherArticle/category/sys/update';
that.form1.props.formType = 'update';
that.form1.props.title = '编辑';
that.form1.props.show = true;
that.form1.data = item;
},
// 删除按钮
deleteBtn({
item,
deleteFn
}) {
deleteFn({
action: "admin/otherArticle/category/sys/delete",
data: {
_id: item._id
},
});
},
// 监听 - 批量操作的按钮点击事件
batchBtn(index) {
switch (index) {
case 1:
vk.toast("批量操作按钮1");
break;
case 2:
vk.toast("批量操作按钮2");
break;
default:
break;
}
}
},
// 监听属性
watch: {},
// 过滤器
filters: {},
// 计算属性
computed: {}
};
</script>
<style lang="scss" scoped>
.page-body {
}
</style>
+451
View File
@@ -0,0 +1,451 @@
<template>
<view class="page-body">
<!-- 页面内容开始 -->
<!-- 表格搜索组件开始 -->
<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"
@search="search"></vk-data-table-query>
<!-- 表格搜索组件结束 -->
<!-- 自定义按钮区域开始 -->
<view>
<el-row>
<el-button type="success" size="small" icon="el-icon-circle-plus-outline" @click="addBtn">添加
</el-button>
<!-- 批量操作 -->
<el-dropdown v-if="table1.multipleSelection && table1.multipleSelection.length > 0" :split-button="false" trigger="click" @command="batchBtn">
<el-button type="danger" size="small" style="margin-left: 20rpx;"
:disabled="table1.multipleSelection.length === 0">
批量操作<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
<el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item :command="1">批量操作1</el-dropdown-item>
<el-dropdown-item :command="2">批量操作2</el-dropdown-item> -->
</el-dropdown-menu>
</el-dropdown>
</el-row>
</view>
<!-- 自定义按钮区域结束 -->
<!-- 表格组件开始 -->
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
:right-btns="['detail_auto','update','delete']" :default-expand-all="false" @update="updateBtn"
@delete="deleteBtn" @current-change="currentChange" :pagination="true"
:default-sort="{ name: '_add_time', prop: '_add_time', order: 'descending' }"
@selection-change="selectionChange"></vk-data-table>
<!-- 表格组件结束 -->
<!-- 添加或编辑的弹窗开始 -->
<vk-data-dialog v-model="form1.props.show" :title="form1.props.title" width="60%" mode="form"
:close-on-click-modal="false">
<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
:form-type="form1.props.formType" :columns='form1.props.columns' label-width="120px"
:before-action="beforeFormAction"
@success="form1.props.show = false;refresh();"></vk-data-form>
</vk-data-dialog>
<!-- 添加或编辑的弹窗结束 -->
<!-- 页面内容结束 -->
</view>
</template>
<script>
var that; // 当前页面对象
var vk = uni.vk; // vk实例
var originalForms = {}; // 表单初始化数据
export default {
data() {
// 页面数据变量
return {
// 页面是否请求中或加载中
loading: false,
// init请求返回的数据
data: {},
// 表格相关开始 -----------------------------------------------------------
table1: {
// 表格数据请求地址
action: "admin/otherArticle/list/sys/list",
// 表格字段显示规则
columns: [
{
key: "_id",
title: "id",
type: "text",
width: 220
},
{
key: "name",
title: "名称",
type: "text",
width: 220,
align: "left",
},
{
key: "category.name",
title: "分类",
type: "text",
width: 220,
},
// {
// key: "content",
// title: "内容",
// type: "html",
// },
{
key: "remark",
title: "备注",
type: "text",
align: "left",
width: 220
},
{
key: "viewNum",
title: "浏览量",
type: "text",
align: "left",
width: 220
},
{
key: "sort",
title: "排序",
type: "number",
align: "left",
width: 80,
},
{
key: "_update_time",
title: "更新时间",
type: "time",
align: "left",
width: 160,
sortable: "custom"
},
{
key: "_add_time",
title: "创建时间",
type: "time",
align: "left",
width: 160,
sortable: "custom"
}
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: ""
},
// 表格相关结束 -----------------------------------------------------------
// 表单相关开始 -----------------------------------------------------------
// 查询表单请求数据
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
{
key: "name",
title: "标题",
type: "text",
width: 200,
mode: "%%"
},
{
key: "parentId",
title: "分类",
type: "select",
placeholder: "分类筛选",
data: [
{
value: '6583be98189f86d49ba89960',
label: "交易模式"
},
{
value: '657694397ad52d34476e16be',
label: "增值服务收费标准"
},
{
value: '65761c6a09664c4f4a325a05',
label: "金久信金融"
},
{
value: '65761c619755e36c0976fe36',
label: "金久信学堂"
},
{
value: '65761c49a09a9b1767464f4f',
label: "找加工"
},
{
value: '65761c40466d41a58495c9ae',
label: "旧货交易"
},
{
value: '65761c33e0ec19b504d81f90',
label: "关于金久信"
},
{
value: '65761c229755e36c0976fb82',
label: "平台服务"
},
{
value: '657458db9755e36c09375be8',
label: "交易流程"
},
{
value: '657457b621821b5c0fca456a',
label: "帮助中心"
},
{
value: '657457acf082105ea4d467f0',
label: "常见问题"
},
{
value: '6574521499c62431df5b562c',
label: "行业动态"
},
{
value: '6574520a7ad52d34471a9582',
label: "行情分析"
},
{
value: '65745200337a9f07565fb08d',
label: "期货信息"
},
{
value: '657451bb6e5d2d335ab78b3a',
label: "市场信息"
},
{
value: '6573fb906e5d2d335aa676ed',
label: "旧货交易加急公告"
},
{
value: '6573d7c3e0ec19b5047ffa8c',
label: "买家指南"
},
{
value: '6573d7bde0ec19b5047ff941',
label: "卖家指南"
},
{
value: '6573d70c21392942007c0521',
label: "基础知识"
},
{
value: '6573d704862066d070e8f7be',
label: "执行标准"
},
{
value: '6573d6fcf082105ea4bb5d09',
label: "技术论坛"
},
]
},
// },
// {
// key: "remark",
// title: "备注",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "_add_time",
// title: "添加时间",
// type: "datetimerange",
// width: 400,
// mode: "[]"
// },
]
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
sort: 0,
amount: 0,
},
// 表单属性
props: {
// 表单请求地址
action: "",
// 表单字段显示规则
columns: [
{
key: "name",
title: "名称",
type: "text",
placeholder: "请输入名称"
},
{
key: "parentId",
title: "分类",
type: "tree-select",
placeholder: "请选择分类",
action: "admin/otherArticle/category/sys/list",
props: {
list: "rows",
value: "_id",
label: "name",
children: "children",
},
},
{
key: "content",
title: "内容",
type: "editor",
placeholder: "请输入内容"
},
{
key: "remark",
title: "备注",
type: "textarea",
maxlength: "99",
showWordLimit: true,
autosize: {
minRows: 2,
maxRows: 10
},
},
{
key: "sort",
title: "排序",
type: "number",
precision: 0,
placeholder: "请输入排序值",
},
],
// 表单验证规则
rules: {
sort: [{
type: 'number',
message: '排序值必须为数字'
}],
name: [
{required: true, message: '分类名称不能为空', trigger: 'blur'},
],
},
// add 代表添加 update 代表修改
formType: "",
// 是否显示表单的弹窗
show: false
}
},
// 其他弹窗表单
formDatas: {},
// 表单相关结束 -----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {
},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {
},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {
},
// 函数
methods: {
// 页面数据初始化函数
init(options) {
originalForms["form1"] = vk.pubfn.copyObject(that.form1);
},
// 页面跳转
pageTo(path) {
vk.navigateTo(path);
},
// 表单重置
resetForm() {
vk.pubfn.resetForm(originalForms, that);
},
// 搜索
search() {
that.$refs.table1.search();
},
beforeFormAction() {
const now = new Date();
return {
_update_time: now.getTime(),
_update_time_str: vk.pubfn.timeFormat(now, "yyyy-MM-dd hh:mm:ss")
};
},
// 刷新
refresh() {
that.$refs.table1.refresh();
},
// 获取当前选中的行的数据
getCurrentRow() {
return that.$refs.table1.getCurrentRow();
},
// 监听 - 行的选中高亮事件
currentChange(val) {
that.table1.selectItem = val;
},
// 当选择项发生变化时会触发该事件
selectionChange(list) {
that.table1.multipleSelection = list;
},
// 显示添加页面
addBtn() {
that.resetForm();
that.form1.props.action = 'admin/otherArticle/list/sys/add';
that.form1.props.formType = 'add';
that.form1.props.title = '添加';
that.form1.props.show = true;
},
// 显示修改页面
updateBtn({
item
}) {
that.form1.props.action = 'admin/otherArticle/list/sys/update';
that.form1.props.formType = 'update';
that.form1.props.title = '编辑';
that.form1.props.show = true;
that.form1.data = item;
},
// 删除按钮
deleteBtn({
item,
deleteFn
}) {
deleteFn({
action: "admin/otherArticle/list/sys/delete",
data: {
_id: item._id
},
});
},
// 监听 - 批量操作的按钮点击事件
batchBtn(index) {
switch (index) {
case 1:
vk.toast("批量操作按钮1");
break;
case 2:
vk.toast("批量操作按钮2");
break;
default:
break;
}
}
},
// 监听属性
watch: {},
// 过滤器
filters: {},
// 计算属性
computed: {}
};
</script>
<style lang="scss" scoped>
.page-body {
}
</style>
+364
View File
@@ -0,0 +1,364 @@
<template>
<view class="page-body">
<!-- 页面内容开始 -->
<!-- 表格搜索组件开始 -->
<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"
@search="search"></vk-data-table-query>
<!-- 表格搜索组件结束 -->
<!-- 自定义按钮区域开始 -->
<view>
<el-row>
<el-button type="success" size="small" icon="el-icon-circle-plus-outline" @click="addBtn">添加
</el-button>
<!-- 批量操作 -->
<el-dropdown v-if="table1.multipleSelection" :split-button="false" trigger="click" @command="batchBtn">
<!-- <el-button type="danger" size="small" style="margin-left: 20rpx;"
:disabled="table1.multipleSelection.length === 0">
批量操作<i class="el-icon-arrow-down el-icon--right"></i>
</el-button> -->
<el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item :command="1">批量操作1</el-dropdown-item>
<el-dropdown-item :command="2">批量操作2</el-dropdown-item> -->
</el-dropdown-menu>
</el-dropdown>
</el-row>
</view>
<!-- 自定义按钮区域结束 -->
<!-- 表格组件开始 -->
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
:right-btns="['detail_auto','update','delete']" :default-expand-all="false" @update="updateBtn"
@delete="deleteBtn" @current-change="currentChange" :pagination="true"
@selection-change="selectionChange"></vk-data-table>
<!-- 表格组件结束 -->
<!-- 添加或编辑的弹窗开始 -->
<vk-data-dialog v-model="form1.props.show" :title="form1.props.title" width="60%" mode="form"
:close-on-click-modal="false">
<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
:form-type="form1.props.formType" :columns='form1.props.columns' label-width="120px"
@success="form1.props.show = false;refresh();"></vk-data-form>
</vk-data-dialog>
<!-- 添加或编辑的弹窗结束 -->
<!-- 页面内容结束 -->
</view>
</template>
<script>
var that; // 当前页面对象
var vk = uni.vk; // vk实例
var originalForms = {}; // 表单初始化数据
export default {
data() {
// 页面数据变量
return {
// 页面是否请求中或加载中
loading: false,
// init请求返回的数据
data: {},
// 表格相关开始 -----------------------------------------------------------
table1: {
// 表格数据请求地址
action: "admin/album/sys/list",
// 表格字段显示规则
columns: [
{
key: "_id",
title: "id",
type: "text",
width: 220
},
{
key: "page",
title: "页面",
type: "tag",
data: [
{value: 'index', label: "首页"},
{value: 'self-support-index', label: "金久信自营首页"},
{value: 'self-support', label: "金久信自营"},
{value: 'self-support-main', label: "金久信自营服务大图"},
{value: 'self-support-company', label: "合作对象考察服务"},
{value: 'self-support-product', label: "监督检测化考察服务"},
{value: 'self-support-quote', label: "造价询价服务"},
{value: 'self-support-company-swiper', label: "合作对象考察服务--轮播"},
{value: 'self-support-product-swiper', label: "监督检测化考察服务--轮播"},
{value: 'self-support-quote-swiper', label: "造价询价服务--轮播"},
{value: 'spot', label: "现货"},
{value: 'spot-mine', label: "现货-我的询价单"},
{value: 'enquiry', label: "找买家"},
{value: 'enquiry-mine', label: "找买家-我的询价单"},
{value: 'process', label: "找加工"},
{value: 'process-mine', label: "找加工-我的询价单"},
{value: 'old', label: "旧货交易"},
{value: 'old-mine', label: "旧货交易-我发布的"},
{value: 'yellowPage', label: "黄页"},
{value: 'article', label: "学堂"},
{value: 'shop', label: "特产商城"},
{value: 'factory', label: "加工厂"},
{value: 'qyb', label: "金久信签约宝"},
]
},
{
key: "swiper",
title: "图片",
type: "image",
},
{
key: "company",
type: "text",
title: "指定公司",
formatter: (val, row, column, index) => {
if (val) return val.company.companyName
}
},
{
key: "_add_time",
title: "添加时间",
type: "time",
align: "left",
width: 160,
sortable: "custom"
},
{
key: "_add_time_diff",
title: "距离现在",
type: "html",
align: "left",
width: 120,
formatter: (val, row) => vk.pubfn.dateDiff(row._add_time)
},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: ""
},
// 表格相关结束 -----------------------------------------------------------
// 表单相关开始 -----------------------------------------------------------
// 查询表单请求数据
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
// {
// key: "name",
// title: "名称",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "remark",
// title: "备注",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "_add_time",
// title: "添加时间",
// type: "datetimerange",
// width: 400,
// mode: "[]"
// },
]
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
sort: 0,
amount: 0,
},
// 表单属性
props: {
// 表单请求地址
action: "",
// 表单字段显示规则
columns: [
{
key: "page",
title: "页面",
type: "select",
placeholder: "请选择所属页面",
data: [
{value: 'index', label: "首页"},
{value: 'self-support-index', label: "金久信自营首页"},
{value: 'self-support', label: "金久信自营"},
{value: 'self-support-main', label: "金久信自营服务大图"},
{value: 'self-support-company', label: "合作对象考察服务"},
{value: 'self-support-product', label: "监督检测化考察服务"},
{value: 'self-support-quote', label: "造价询价服务"},
{value: 'self-support-company-swiper', label: "合作对象考察服务--轮播"},
{value: 'self-support-product-swiper', label: "监督检测化考察服务--轮播"},
{value: 'self-support-quote-swiper', label: "造价询价服务--轮播"},
{value: 'spot', label: "现货"},
{value: 'spot-mine', label: "现货-我的询价单"},
{value: 'enquiry', label: "找买家"},
{value: 'enquiry-mine', label: "找买家-我的询价单"},
{value: 'process', label: "找加工"},
{value: 'process-mine', label: "找加工-我的询价单"},
{value: 'old', label: "旧货交易"},
{value: 'old-mine', label: "旧货交易-我发布的"},
{value: 'yellowPage', label: "黄页"},
{value: 'article', label: "学堂"},
{value: 'shop', label: "特产商城"},
{value: 'factory', label: "加工厂"},
{value: 'qyb', label: "金久信签约宝"},
]
},
{
key: "swiper",
title: "图片",
type: "image",
},
{
key: "companyId",
title: "指定公司",
type: "remote-select",
showAll: true,
placeholder: "请选择指定公司",
action: "admin/system/user/sys/getList",
actionData: {
pageIndex: 1,
pageSize: 500,
type: 2
},
props: {
list: "rows",
value: "_id",
label: "name",
},
dataPreprocess: (list) => {
list = list.filter(item => (item.company && item.company.companyName && item.company.companyName !== ''))
list.map((item, index) => {
item.name = `${item.company.companyName}(${item.mobile})`
return item
});
return list;
}
},
],
// 表单验证规则
rules: {},
// add 代表添加 update 代表修改
formType: "",
// 是否显示表单的弹窗
show: false
}
},
// 其他弹窗表单
formDatas: {},
// 表单相关结束 -----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {
},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {
},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {
},
// 函数
methods: {
// 页面数据初始化函数
init(options) {
originalForms["form1"] = vk.pubfn.copyObject(that.form1);
},
// 页面跳转
pageTo(path) {
vk.navigateTo(path);
},
// 表单重置
resetForm() {
vk.pubfn.resetForm(originalForms, that);
},
// 搜索
search() {
that.$refs.table1.search();
},
// 刷新
refresh() {
that.$refs.table1.refresh();
},
// 获取当前选中的行的数据
getCurrentRow() {
return that.$refs.table1.getCurrentRow();
},
// 监听 - 行的选中高亮事件
currentChange(val) {
that.table1.selectItem = val;
},
// 当选择项发生变化时会触发该事件
selectionChange(list) {
that.table1.multipleSelection = list;
},
// 显示添加页面
addBtn() {
that.resetForm();
that.form1.props.action = 'admin/album/sys/add';
that.form1.props.formType = 'add';
that.form1.props.title = '添加';
that.form1.props.show = true;
},
// 显示修改页面
updateBtn({
item
}) {
that.form1.props.action = 'admin/album/sys/update';
that.form1.props.formType = 'update';
that.form1.props.title = '编辑';
that.form1.props.show = true;
that.form1.data = item;
},
// 删除按钮
deleteBtn({
item,
deleteFn
}) {
deleteFn({
action: "admin/album/sys/delete",
data: {
_id: item._id
},
});
},
// 监听 - 批量操作的按钮点击事件
batchBtn(index) {
switch (index) {
case 1:
vk.toast("批量操作按钮1");
break;
case 2:
vk.toast("批量操作按钮2");
break;
default:
break;
}
}
},
// 监听属性
watch: {},
// 过滤器
filters: {},
// 计算属性
computed: {}
};
</script>
<style lang="scss" scoped>
.page-body {
}
</style>
+334
View File
@@ -0,0 +1,334 @@
<template>
<view class="page-body">
<!-- 页面内容开始 -->
<!-- 表格搜索组件开始 -->
<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"
@search="search"></vk-data-table-query>
<!-- 表格搜索组件结束 -->
<!-- 自定义按钮区域开始 -->
<view>
<el-row>
<el-button type="success" size="small" icon="el-icon-circle-plus-outline" @click="addBtn">添加
</el-button>
<!-- 批量操作 -->
<el-dropdown v-if="table1.multipleSelection" :split-button="false" trigger="click" @command="batchBtn">
<!-- <el-button type="danger" size="small" style="margin-left: 20rpx;"
:disabled="table1.multipleSelection.length === 0">
批量操作<i class="el-icon-arrow-down el-icon--right"></i>
</el-button> -->
<el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item :command="1">批量操作1</el-dropdown-item>
<el-dropdown-item :command="2">批量操作2</el-dropdown-item> -->
</el-dropdown-menu>
</el-dropdown>
</el-row>
</view>
<!-- 自定义按钮区域结束 -->
<!-- 表格组件开始 -->
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
:right-btns="['detail_auto','update','delete']" :default-expand-all="false" @update="updateBtn"
@delete="deleteBtn" @current-change="currentChange"
@selection-change="selectionChange"></vk-data-table>
<!-- 表格组件结束 -->
<!-- 添加或编辑的弹窗开始 -->
<vk-data-dialog v-model="form1.props.show" :title="form1.props.title" width="60%" mode="form"
:close-on-click-modal="false">
<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
:form-type="form1.props.formType" :columns='form1.props.columns' label-width="120px"
@success="form1.props.show = false;refresh();"></vk-data-form>
</vk-data-dialog>
<!-- 添加或编辑的弹窗结束 -->
<!-- 页面内容结束 -->
</view>
</template>
<script>
var that; // 当前页面对象
var vk = uni.vk; // vk实例
var originalForms = {}; // 表单初始化数据
export default {
data() {
// 页面数据变量
return {
// 页面是否请求中或加载中
loading: false,
// init请求返回的数据
data: {},
// 表格相关开始 -----------------------------------------------------------
table1: {
// 表格数据请求地址
action: "admin/process/category/sys/list",
// 表格字段显示规则
columns: [
// {
// key: "_id",
// title: "id",
// type: "text",
// width: 220
// },
{
key: "name",
title: "名称",
type: "text",
width: 220,
align: "left",
},
{
key: "parent.name",
title: "上级",
type: "text",
width: 220,
},
{
key: "remark",
title: "备注",
type: "text",
align: "left",
width: 220
},
{
key: "sort",
title: "排序",
type: "number",
align: "left",
width: 80,
},
{
key: "_add_time",
title: "添加时间",
type: "time",
align: "left",
width: 160,
sortable: "custom"
},
{
key: "_add_time",
title: "距离现在",
type: "dateDiff",
align: "left",
width: 120
},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: ""
},
// 表格相关结束 -----------------------------------------------------------
// 表单相关开始 -----------------------------------------------------------
// 查询表单请求数据
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
{
key: "name",
title: "名称",
type: "text",
width: 160,
mode: "%%"
},
// {
// key: "remark",
// title: "备注",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "_add_time",
// title: "添加时间",
// type: "datetimerange",
// width: 400,
// mode: "[]"
// },
]
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
sort: 0
},
// 表单属性
props: {
// 表单请求地址
action: "",
// 表单字段显示规则
columns: [{
key: "name",
title: "名称",
type: "text",
placeholder: "请输入分类名称"
},
// {
// key: "icon",
// title: "图标",
// type: "icon",
// placeholder: "请选择图标"
// },
{
key: "parent_id",
title: "上级分类",
type: "tree-select",
placeholder: "请选择上级分类",
action: "admin/process/category/sys/getTree",
props: {
list: "rows",
value: "_id",
label: "name",
children: "children"
},
},
{
key: "remark",
title: "备注",
type: "textarea",
maxlength: "99",
showWordLimit: true,
autosize: {
minRows: 2,
maxRows: 10
},
},
{
key: "sort",
title: "排序",
type: "number",
precision: 0,
placeholder: "请输入排序值",
},
],
// 表单验证规则
rules: {
sort: [{
type: 'number',
message: '排序值必须为数字'
}],
name: [
{required: true, message: '分类名称不能为空', trigger: 'blur'},
],
},
// add 代表添加 update 代表修改
formType: "",
// 是否显示表单的弹窗
show: false
}
},
// 其他弹窗表单
formDatas: {},
// 表单相关结束 -----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {
},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {
},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {
},
// 函数
methods: {
// 页面数据初始化函数
init(options) {
originalForms["form1"] = vk.pubfn.copyObject(that.form1);
},
// 页面跳转
pageTo(path) {
vk.navigateTo(path);
},
// 表单重置
resetForm() {
vk.pubfn.resetForm(originalForms, that);
},
// 搜索
search() {
that.$refs.table1.search();
},
// 刷新
refresh() {
that.$refs.table1.refresh();
},
// 获取当前选中的行的数据
getCurrentRow() {
return that.$refs.table1.getCurrentRow();
},
// 监听 - 行的选中高亮事件
currentChange(val) {
that.table1.selectItem = val;
},
// 当选择项发生变化时会触发该事件
selectionChange(list) {
that.table1.multipleSelection = list;
},
// 显示添加页面
addBtn() {
that.resetForm();
that.form1.props.action = 'admin/process/category/sys/add';
that.form1.props.formType = 'add';
that.form1.props.title = '添加';
that.form1.props.show = true;
},
// 显示修改页面
updateBtn({
item
}) {
that.form1.props.action = 'admin/process/category/sys/update';
that.form1.props.formType = 'update';
that.form1.props.title = '编辑';
that.form1.props.show = true;
that.form1.data = item;
},
// 删除按钮
deleteBtn({
item,
deleteFn
}) {
deleteFn({
action: "admin/process/category/sys/delete",
data: {
_id: item._id
},
});
},
// 监听 - 批量操作的按钮点击事件
batchBtn(index) {
switch (index) {
case 1:
vk.toast("批量操作按钮1");
break;
case 2:
vk.toast("批量操作按钮2");
break;
default:
break;
}
}
},
// 监听属性
watch: {},
// 过滤器
filters: {},
// 计算属性
computed: {}
};
</script>
<style lang="scss" scoped>
.page-body {
}
</style>
+321
View File
@@ -0,0 +1,321 @@
<template>
<view class="page-body">
<!-- 页面内容开始 -->
<!-- 表格搜索组件开始 -->
<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"
@search="search"></vk-data-table-query>
<!-- 表格搜索组件结束 -->
<!-- 自定义按钮区域开始 -->
<view>
<el-row>
<el-button type="success" size="small" icon="el-icon-circle-plus-outline" @click="addBtn">添加
</el-button>
<!-- 批量操作 -->
<el-dropdown v-if="table1.multipleSelection" :split-button="false" trigger="click" @command="batchBtn">
<!-- <el-button type="danger" size="small" style="margin-left: 20rpx;"
:disabled="table1.multipleSelection.length === 0">
批量操作<i class="el-icon-arrow-down el-icon--right"></i>
</el-button> -->
<el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item :command="1">批量操作1</el-dropdown-item>
<el-dropdown-item :command="2">批量操作2</el-dropdown-item> -->
</el-dropdown-menu>
</el-dropdown>
</el-row>
</view>
<!-- 自定义按钮区域结束 -->
<!-- 表格组件开始 -->
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
:right-btns="['update','delete', ]" :default-expand-all="false"
@update="updateBtn"
@delete="deleteBtn" @current-change="currentChange" :pagination="true"
:right-btns-more="table1.rightBtnsMore"
@selection-change="selectionChange"></vk-data-table>
<!-- 表格组件结束 -->
<!-- 添加或编辑的弹窗开始 -->
<vk-data-dialog v-model="form1.props.show" :title="form1.props.title" width="1000px" mode="form"
:close-on-click-modal="false">
<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
:form-type="form1.props.formType" :columns='form1.props.columns' label-width="120px"
@success="form1.props.show = false;refresh();"></vk-data-form>
</vk-data-dialog>
<!-- 添加或编辑的弹窗结束 -->
<!-- 页面内容结束 -->
<vk-data-dialog v-model="showCoopList" title="报价列表" width="1000px" mode="form"
:close-on-click-modal="false">
<vk-data-table ref="table1" :data="coopList" :columns="coopColumns" ></vk-data-table>
<template v-slot:footer>
<el-button @click="showCoopList = false">关闭</el-button>
</template>
</vk-data-dialog>
</view>
</template>
<script>
var that; // 当前页面对象
var vk = uni.vk; // vk实例
var originalForms = {}; // 表单初始化数据
export default {
data() {
// 页面数据变量
return {
showCoopList: false,
coopList: [],
coopColumns: [
{
key: "name",
title: "联系人",
type: "text",
align: "left",
},
{
key: "mobile",
title: "联系方式",
type: "text",
align: "left",
},
{
key: "_add_time_str",
title: "报价时间",
type: "text",
align: "left",
},
],
// 页面是否请求中或加载中
loading: false,
// init请求返回的数据
data: {},
// 表格相关开始 -----------------------------------------------------------
table1: {
// 表格数据请求地址
action: "admin/spot/amount/sys/getList",
// 表格字段显示规则
columns: [
// {
// key: "_id",
// title: "id",
// type: "text",
// width: 220
// },
{
key: "address",
title: "地区",
type: "address",
align: "left",
},
{
key: "amount",
title: "价格",
type: "number",
align: "left",
},
{
key: "_add_time",
title: "添加时间",
type: "time",
align: "left",
sortable: "custom"
},
{
key: "_add_time",
title: "距离现在",
type: "dateDiff",
align: "left",
},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: "",
},
// 表格相关结束 -----------------------------------------------------------
// 表单相关开始 -----------------------------------------------------------
// 查询表单请求数据
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
{
key: "address",
title: "地区",
type: "address",
},
// {
// key: "remark",
// title: "备注",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "_add_time",
// title: "添加时间",
// type: "datetimerange",
// width: 400,
// mode: "[]"
// },
]
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
sort: 0,
name: ''
},
// 表单属性
props: {
// 表单请求地址
action: "",
// 表单字段显示规则
columns: [
{
key: "address",
title: "省",
type: "address",
align: "left",
level: 1,
},
{
key: "amount",
title: "价格",
type: "number",
align: "left",
},
],
// 表单验证规则
rules: {
amount: [
{required: true, message: '价格不能为空', trigger: 'blur'},
],
},
// add 代表添加 update 代表修改
formType: "",
// 是否显示表单的弹窗
show: false
}
},
// 其他弹窗表单
formDatas: {},
// 表单相关结束 -----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {
},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {
},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {
},
// 函数
methods: {
// 页面数据初始化函数
init(options) {
originalForms["form1"] = vk.pubfn.copyObject(that.form1);
},
// 页面跳转
pageTo(path) {
vk.navigateTo(path);
},
// 表单重置
resetForm() {
vk.pubfn.resetForm(originalForms, that);
},
// 搜索
search() {
that.$refs.table1.search();
},
// 刷新
refresh() {
that.$refs.table1.refresh();
},
// 获取当前选中的行的数据
getCurrentRow() {
return that.$refs.table1.getCurrentRow();
},
// 监听 - 行的选中高亮事件
currentChange(val) {
that.table1.selectItem = val;
},
// 当选择项发生变化时会触发该事件
selectionChange(list) {
that.table1.multipleSelection = list;
},
// 显示添加页面
addBtn() {
that.resetForm();
that.form1.props.action = 'admin/spot/amount/sys/add';
that.form1.props.formType = 'add';
that.form1.props.title = '添加';
that.form1.props.show = true;
},
// 显示修改页面
updateBtn({
item
}) {
that.form1.props.action = 'admin/spot/amount/sys/update';
that.form1.props.formType = 'update';
that.form1.props.title = '编辑';
that.form1.props.columns[0].disabled = true;
that.form1.props.show = true;
that.form1.props.show = true;
that.form1.data = item;
},
// 删除按钮
deleteBtn({
item,
deleteFn
}) {
deleteFn({
action: "admin/product/category/sys/delete",
data: {
_id: item._id
},
});
},
// 监听 - 批量操作的按钮点击事件
batchBtn(index) {
switch (index) {
case 1:
vk.toast("批量操作按钮1");
break;
case 2:
vk.toast("批量操作按钮2");
break;
default:
break;
}
}
},
// 监听属性
watch: {},
// 过滤器
filters: {},
// 计算属性
computed: {}
};
</script>
<style lang="scss" scoped>
.page-body {
}
/deep/ .el-checkbox-group .direction-row {
flex-wrap: wrap;
}
</style>
+451 -351
View File
@@ -1,364 +1,464 @@
<template>
<view class="page-body">
<!-- 页面内容开始 -->
<view class="page-body">
<!-- 页面内容开始 -->
<!-- 表格搜索组件开始 -->
<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"
@search="search"></vk-data-table-query>
<!-- 表格搜索组件结束 -->
<!-- 表格搜索组件开始 -->
<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"
@search="search"></vk-data-table-query>
<!-- 表格搜索组件结束 -->
<!-- 自定义按钮区域开始 -->
<view>
<el-row>
<el-button type="success" size="small" icon="el-icon-circle-plus-outline" @click="addBtn">添加</el-button>
<!-- 批量操作 -->
<el-dropdown v-if="table1.multipleSelection" :split-button="false" trigger="click" @command="batchBtn">
<!-- <el-button type="danger" size="small" style="margin-left: 20rpx;"
:disabled="table1.multipleSelection.length === 0">
批量操作<i class="el-icon-arrow-down el-icon--right"></i>
</el-button> -->
<el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item :command="1">批量操作1</el-dropdown-item>
<el-dropdown-item :command="2">批量操作2</el-dropdown-item> -->
</el-dropdown-menu>
</el-dropdown>
</el-row>
</view>
<!-- 自定义按钮区域结束 -->
<!-- 自定义按钮区域开始 -->
<view>
<el-row>
<el-button type="success" size="small" icon="el-icon-circle-plus-outline" @click="addBtn">添加
</el-button>
<!-- 批量操作 -->
<el-dropdown v-if="table1.multipleSelection" :split-button="false" trigger="click" @command="batchBtn">
<!-- <el-button type="danger" size="small" style="margin-left: 20rpx;"
:disabled="table1.multipleSelection.length === 0">
批量操作<i class="el-icon-arrow-down el-icon--right"></i>
</el-button> -->
<el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item :command="1">批量操作1</el-dropdown-item>
<el-dropdown-item :command="2">批量操作2</el-dropdown-item> -->
</el-dropdown-menu>
</el-dropdown>
</el-row>
</view>
<!-- 自定义按钮区域结束 -->
<!-- 表格组件开始 -->
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
:right-btns="['detail_auto','update','delete']" :default-expand-all="false" @update="updateBtn"
@delete="deleteBtn" @current-change="currentChange" @selection-change="selectionChange"></vk-data-table>
<!-- 表格组件结束 -->
<!-- 表格组件开始 -->
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
:right-btns="['detail_auto','update','delete', 'more']" :default-expand-all="false"
@update="updateBtn"
@delete="deleteBtn" @current-change="currentChange" :pagination="true"
:right-btns-more="table1.rightBtnsMore"
@selection-change="selectionChange">
<template v-slot:isOn="{ row, column, index }">
<el-switch v-model="row.isOn" size="mini" @change="changeField(row._id, 'isOn', $event)"
:active-value="1"
:inactive-value="0"/>
</template>
</vk-data-table>
<!-- 表格组件结束 -->
<!-- 添加或编辑的弹窗开始 -->
<vk-data-dialog v-model="form1.props.show" :title="form1.props.title" width="1000px" mode="form"
:close-on-click-modal="false">
<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
:form-type="form1.props.formType" :columns='form1.props.columns' label-width="120px"
@success="form1.props.show = false;refresh();"></vk-data-form>
</vk-data-dialog>
<!-- 添加或编辑的弹窗结束 -->
<!-- 添加或编辑的弹窗开始 -->
<vk-data-dialog v-model="form1.props.show" :title="form1.props.title" width="1000px" mode="form"
:close-on-click-modal="false">
<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
:form-type="form1.props.formType" :columns='form1.props.columns' label-width="120px"
@success="form1.props.show = false;refresh();"></vk-data-form>
</vk-data-dialog>
<!-- 添加或编辑的弹窗结束 -->
<!-- 页面内容结束 -->
</view>
<!-- 页面内容结束 -->
<vk-data-dialog v-model="showCoopList" title="报价列表" width="1000px" mode="form"
:close-on-click-modal="false">
<vk-data-table ref="table1" :data="coopList" :columns="coopColumns"></vk-data-table>
<template v-slot:footer>
<el-button @click="showCoopList = false">关闭</el-button>
</template>
</vk-data-dialog>
</view>
</template>
<script>
var that; // 当前页面对象
var vk = uni.vk; // vk实例
var originalForms = {}; // 表单初始化数据
var that; // 当前页面对象
var vk = uni.vk; // vk实例
var originalForms = {}; // 表单初始化数据
export default {
data() {
// 页面数据变量
return {
// 页面是否请求中或加载中
loading: false,
// init请求返回的数据
data: {
},
// 表格相关开始 -----------------------------------------------------------
table1: {
// 表格数据请求地址
action: "admin/spot/goods/sys/getList",
// 表格字段显示规则
columns: [
// {
// key: "_id",
// title: "id",
// type: "text",
// width: 220
// },
{
key: "name",
title: "名称",
type: "text",
width: 220,
align: "left",
},
{
key: "address",
title: "供货地",
type: "address",
width: 220,
align: "left",
},
{
key: "sort",
title: "排序",
type: "number",
align: "left",
width: 80,
},
{
key: "files",
title: "附件",
type: "file",
// align: "left",
width: 220
},
{
key: "_add_time",
title: "添加时间",
type: "time",
align: "left",
width: 160,
sortable: "custom"
},
{
key: "_add_time",
title: "距离现在",
type: "dateDiff",
align: "left",
width: 120
},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: ""
},
// 表格相关结束 -----------------------------------------------------------
// 表单相关开始 -----------------------------------------------------------
// 查询表单请求数据
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {
},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
// {
// key: "name",
// title: "名称",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "remark",
// title: "备注",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "_add_time",
// title: "添加时间",
// type: "datetimerange",
// width: 400,
// mode: "[]"
// },
]
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
sort: 0,
name: ''
},
// 表单属性
props: {
// 表单请求地址
action: "",
// 表单字段显示规则
columns: [
{
key: "name",
title: "名称",
type: "text",
placeholder: "请输入分类名称",
disabled: true
},
{
key: "categoryIds",
title: "分类",
type: "checkbox",
placeholder: "请选分类",
action: "admin/spot/category/sys/getList",
actionData: {level: 2},
min:1,
max: 5,
props: {
list: "rows",
value: "_id",
label: "name",
children: "children"
},
watch: (obj)=> {
console.log(obj);
this.form1.data.name = obj.option.map(item => item.name).join("、")
}
},
{
key: "address",
title: "所属用户",
type: "select",
placeholder: "请输入供货地",
},
{
key: "address",
title: "供货地",
type: "address",
placeholder: "请输入供货地",
},
{
key: "files",
title: "附件",
type: "file",
},
{
key: "remark",
title: "备注",
type: "textarea",
maxlength: "99",
showWordLimit: true,
autosize: {
minRows: 2,
maxRows: 10
},
},
{
key: "sort",
title: "排序",
type: "number",
precision: 0,
placeholder: "请输入排序值",
},
],
// 表单验证规则
rules: {
sort: [{
type: 'number',
message: '排序值必须为数字'
}],
name:[
{ required:true, message:'分类名称不能为空', trigger:'blur' },
],
},
// add 代表添加 update 代表修改
formType: "",
// 是否显示表单的弹窗
show: false
}
},
// 其他弹窗表单
formDatas: {},
// 表单相关结束 -----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {},
// 函数
methods: {
// 页面数据初始化函数
init(options) {
originalForms["form1"] = vk.pubfn.copyObject(that.form1);
},
// 页面跳转
pageTo(path) {
vk.navigateTo(path);
},
// 表单重置
resetForm() {
vk.pubfn.resetForm(originalForms, that);
},
// 搜索
search() {
that.$refs.table1.search();
},
// 刷新
refresh() {
that.$refs.table1.refresh();
},
// 获取当前选中的行的数据
getCurrentRow() {
return that.$refs.table1.getCurrentRow();
},
// 监听 - 行的选中高亮事件
currentChange(val) {
that.table1.selectItem = val;
},
// 当选择项发生变化时会触发该事件
selectionChange(list) {
that.table1.multipleSelection = list;
},
// 显示添加页面
addBtn() {
that.resetForm();
that.form1.props.action = 'admin/spot/goods/sys/add';
that.form1.props.formType = 'add';
that.form1.props.title = '添加';
that.form1.props.show = true;
},
// 显示修改页面
updateBtn({
item
}) {
that.form1.props.action = 'admin/spot/goods/sys/update';
that.form1.props.formType = 'update';
that.form1.props.title = '编辑';
that.form1.props.show = true;
that.form1.data = item;
},
// 删除按钮
deleteBtn({
item,
deleteFn
}) {
deleteFn({
action: "admin/product/category/sys/delete",
data: {
_id: item._id
},
});
},
// 监听 - 批量操作的按钮点击事件
batchBtn(index) {
switch (index) {
case 1:
vk.toast("批量操作按钮1");
break;
case 2:
vk.toast("批量操作按钮2");
break;
default:
break;
}
}
},
// 监听属性
watch: {
},
// 过滤器
filters: {
},
// 计算属性
computed: {
}
};
export default {
data() {
// 页面数据变量
return {
showCoopList: false,
coopList: [],
coopColumns: [
{
key: "user.company.companyName",
title: "企业",
type: "text",
align: "left",
},
{
key: "name",
title: "联系人",
type: "text",
align: "left",
},
{
key: "remark",
title: "合作留言",
type: "text",
align: "left",
},
{
key: "mobile",
title: "联系方式",
type: "text",
align: "left",
},
{
key: "files",
title: "附件",
type: "html",
formatter: (val = [], row, column, index) => {
let content = ''
val.forEach((item, itemIndex) => {
content += `<a href="${item}" target="_blank">预览:文件${itemIndex + 1}</a> `
})
return content
}
},
{
key: "_add_time_str",
title: "报价时间",
type: "text",
align: "left",
},
],
// 页面是否请求中或加载中
loading: false,
// init请求返回的数据
data: {},
// 表格相关开始 -----------------------------------------------------------
table1: {
// 表格数据请求地址
action: "admin/spot/goods/sys/getList",
// 表格字段显示规则
columns: [
// {
// key: "_id",
// title: "id",
// type: "text",
// width: 220
// },
{
key: "name",
title: "名称",
type: "text",
align: "left",
},
{
key: "user.nickname",
title: "发布者",
type: "text",
align: "left",
},
{
key: "address",
title: "供货地",
type: "address",
align: "left",
},
{
key: "quoteNum",
title: "报价数",
type: "number",
align: "left",
},
{
key: "files",
title: "产品规格单价",
type: "file",
},
{
key: "images",
title: "产品现场图片",
type: "image",
},
{
key: "user.topExpiredAt",
title: "特别推荐过期时间",
type: "time",
align: "left",
},
{
key: "answerEndTime",
title: "报价有效期",
type: "time",
align: "left",
},
{
key: "isOn",
title: "启用",
type: "switch",
activeValue: 1,
inactiveValue: 0,
activeText: '启用',
inactiveText: '关闭'
},
{
key: "_add_time",
title: "添加时间",
type: "time",
align: "left",
sortable: "custom"
},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: "",
rightBtnsMore: [
{
title: '报价列表',
disabled: (item) => {
return item.quoteNum === 0
},
onClick: (item) => {
this.coopList = item.cooperateList
this.showCoopList = true
}
}
]
},
// 表格相关结束 -----------------------------------------------------------
// 表单相关开始 -----------------------------------------------------------
// 查询表单请求数据
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
{
key: "name",
title: "名称",
type: "text",
width: 160,
mode: "%%"
},
// {
// key: "remark",
// title: "备注",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "_add_time",
// title: "添加时间",
// type: "datetimerange",
// width: 400,
// mode: "[]"
// },
]
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
sort: 0,
name: ''
},
// 表单属性
props: {
// 表单请求地址
action: "",
// 表单字段显示规则
columns: [
{
key: "name",
title: "名称",
type: "text",
placeholder: "请输入分类名称",
disabled: true
},
{
key: "categoryIds",
title: "分类",
type: "checkbox",
placeholder: "请选分类",
action: "admin/spot/category/sys/getListWithData",
actionData: {
whereJson: {level: 2}
},
min: 1,
max: 5,
props: {
list: "data",
value: "_id",
label: "name",
children: "children"
},
watch: (obj) => {
console.log(obj);
this.form1.data.name = obj.option.map(item => item.name).join("、")
}
},
{
key: "address",
title: "供货地",
type: "address",
placeholder: "请输入供货地",
},
{
key: "files",
title: "产品规格单价",
type: "file",
},
{
key: "images",
title: "产品现场图片",
type: "image",
},
{
key: "remark",
title: "备注",
type: "textarea",
maxlength: "99",
showWordLimit: true,
autosize: {
minRows: 2,
maxRows: 10
},
},
{
key: "sort",
title: "排序",
type: "number",
precision: 0,
placeholder: "请输入排序值",
},
],
// 表单验证规则
rules: {
sort: [{
type: 'number',
message: '排序值必须为数字'
}],
name: [
{required: true, message: '分类名称不能为空', trigger: 'blur'},
],
},
// add 代表添加 update 代表修改
formType: "",
// 是否显示表单的弹窗
show: false
}
},
// 其他弹窗表单
formDatas: {},
// 表单相关结束 -----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {
},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {
},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {
},
// 函数
methods: {
// 页面数据初始化函数
init(options) {
originalForms["form1"] = vk.pubfn.copyObject(that.form1);
},
// 页面跳转
pageTo(path) {
vk.navigateTo(path);
},
// 表单重置
resetForm() {
vk.pubfn.resetForm(originalForms, that);
},
// 搜索
search() {
that.$refs.table1.search();
},
// 刷新
refresh() {
that.$refs.table1.refresh();
},
// 获取当前选中的行的数据
getCurrentRow() {
return that.$refs.table1.getCurrentRow();
},
// 监听 - 行的选中高亮事件
currentChange(val) {
that.table1.selectItem = val;
},
// 当选择项发生变化时会触发该事件
selectionChange(list) {
that.table1.multipleSelection = list;
},
// 显示添加页面
addBtn() {
that.resetForm();
that.form1.props.action = 'admin/spot/goods/sys/add';
that.form1.props.formType = 'add';
that.form1.props.title = '添加';
that.form1.props.show = true;
},
// 显示修改页面
updateBtn({
item
}) {
that.form1.props.action = 'admin/spot/goods/sys/update';
that.form1.props.formType = 'update';
that.form1.props.title = '编辑';
that.form1.props.show = true;
that.form1.data = item;
},
// 删除按钮
deleteBtn({
item,
deleteFn
}) {
deleteFn({
action: "admin/spot/goods/sys/delete",
data: {
_id: item._id
},
});
},
// 监听 - 批量操作的按钮点击事件
batchBtn(index) {
switch (index) {
case 1:
vk.toast("批量操作按钮1");
break;
case 2:
vk.toast("批量操作按钮2");
break;
default:
break;
}
},
changeField(id, field, value) {
vk.callFunction({
url: 'admin/spot/goods/sys/changeField',
data: {
id, field, value
}
}).then(() => {
this.$refs.table1.refresh()
})
},
},
// 监听属性
watch: {},
// 过滤器
filters: {},
// 计算属性
computed: {}
};
</script>
<style lang="scss" scoped>
.page-body {}
/deep/.el-checkbox-group .direction-row{
flex-wrap: wrap;
}
.page-body {
}
/deep/ .el-checkbox-group .direction-row {
flex-wrap: wrap;
}
</style>
+12 -10
View File
@@ -130,13 +130,13 @@
},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
// {
// key: "name",
// title: "名称",
// type: "text",
// width: 160,
// mode: "%%"
// },
{
key: "name",
title: "名称",
type: "text",
width: 160,
mode: "%%"
},
// {
// key: "remark",
// title: "备注",
@@ -172,8 +172,9 @@
{
key: "icon",
title: "图标",
type: "icon",
placeholder: "请选择图标"
type: "image",
placeholder: "请上传图标",
limit: 1
},
{
key: "parent_id",
@@ -205,6 +206,7 @@
type: "number",
precision: 0,
placeholder: "请输入排序值",
tips: '数字越小越靠前'
},
],
// 表单验证规则
@@ -299,7 +301,7 @@
deleteFn
}) {
deleteFn({
action: "admin/product/category/sys/delete",
action: "admin/spot/category/sys/delete",
data: {
_id: item._id
},
+160
View File
@@ -0,0 +1,160 @@
<template>
<vk-data-dialog
v-model="value.show"
:title="page.title"
:top="page.top"
:width="page.width"
mode="form"
@open="onOpen"
@closed="onClose"
>
<!-- 页面主体内容开始 -->
<vk-data-form
ref="form1"
:form-type="value.mode"
v-loading="page.loading"
v-model="form1.data"
:rules="form1.props.rules"
:action="form1.props.action"
:columns="form1.props.columns"
:loading.sync="form1.props.loading"
:labelWidth="form1.props.labelWidth"
:show-cancel="page.showCancel"
:cancel-text="page.cancelText"
:submit-text="page.submitText"
@success="onFormSuccess"
>
<template v-slot:user_id>
<view style="display: flex;align-items: center;">
<el-avatar v-if="data.avatar" :src="data.avatar" fit="cover"></el-avatar>
<text style="margin-left: 10px;">{{ data.nickname }}(ID:{{ data._id }})</text>
</view>
</template>
</vk-data-form>
<!-- 页面主体内容结束 -->
</vk-data-dialog>
</template>
<script>
var that; // 当前页面对象
var vk = uni.vk; // vk实例
export default {
props: {
value: {
Type: Object,
default: function() {
return {
show: false,
mode: "",
item: ""
};
}
}
},
data: function() {
// 组件创建时,进行数据初始化
return {
// 页面基础数据
page: {
title: "角色绑定",
submitText: "绑定",
cancelText: "关闭",
showCancel: true,
top: "7vh",
width:"820px",
loading: false
},
data:{
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
user_id: "",
roleList: [],
reset: true
},
// 表单属性
props: {
// 表单请求地址
action: "admin/system/user/sys/bindRole",
// 表单字段显示规则
columns: [
{ key:"user_id", title:"用户", type:"text" },
{
key: "roleList", title: "角色列表", type: "table-select", placeholder:"选择角色",
action:"admin/system/role/sys/getList",
columns:[
{ key:"role_name", title:"角色昵称", type:"text", nameKey:true },
{ key:"role_id", title:"角色标识", type:"text", idKey:true },
{ key:"comment", title:"备注", type:"text" },
],
formData:{
enable:true
},
queryColumns:[
{ key: "role_name", title: "角色昵称", type: "text", width: 150, mode: "%%" },
{ key: "role_id", title: "角色标识", type: "text", width: 150, mode: "%%" },
{ key: "enable", type: "text", mode: "=", hidden:true }
],
multiple:true,
pageSize:10, // 只有5和10可以选
},
],
// 表单验证规则
rules: {
user_id: [
{ "required": true, "message": "user_id不能为空", "trigger": "change" }
]
},
// label宽度
labelWidth:"100px",
// label对其方式
labelPosition:"left",
}
}
};
},
mounted() {
that = this;
that.init();
},
methods: {
// 初始化
init() {
let { value } = that;
that.$emit("input", value);
},
// 监听 - 页面打开
onOpen() {
that = this;
let { value } = that;
let { role = [], _id } = value.item;
that.data = value.item;
that.form1.props.show = true;
that.form1.data.user_id = _id;
that.form1.data.roleList = role;
},
// 监听 - 页面关闭
onClose() {
that.$refs.form1.resetForm(); // 关闭时,重置表单
},
// 表单提交成功后
onFormSuccess() {
that.$set(that.value.item, "role", that.form1.data.roleList);
that.value.show = false; // 关闭页面
that.$emit("success");
}
},
// 监听属性
watch: {
},
// 计算属性
computed: {}
};
</script>
<style lang="scss" scoped>
</style>
+146
View File
@@ -0,0 +1,146 @@
<template>
<vk-data-dialog
v-model="value.show"
:title="page.title"
:top="page.top"
:width="page.width"
mode="form"
@open="onOpen"
@closed="onClose"
>
<!-- 页面主体内容开始 -->
<vk-data-form
ref="form1"
:form-type="value.mode"
v-loading="page.loading"
v-model="form1.data"
:rules="form1.props.rules"
:action="form1.props.action"
:columns="form1.props.columns"
:loading.sync="form1.props.loading"
:labelWidth="form1.props.labelWidth"
:show-cancel="page.showCancel"
:cancel-text="page.cancelText"
:submit-text="page.submitText"
@success="onFormSuccess"
>
<template v-slot:user_id>
<view style="display: flex;align-items: center;">
<el-avatar v-if="data.avatar" :src="data.avatar" fit="cover"></el-avatar>
<text style="margin-left: 10px;">{{ data.nickname }}(ID:{{ data._id }})</text>
</view>
</template>
</vk-data-form>
<!-- 页面主体内容结束 -->
</vk-data-dialog>
</template>
<script>
var that; // 当前页面对象
var vk = uni.vk; // vk实例
export default {
props: {
value: {
Type: Object,
default: function() {
return {
show: false,
mode: "",
item: ""
};
}
}
},
data: function() {
// 组件创建时,进行数据初始化
return {
// 页面基础数据
page: {
title: "重置密码",
submitText: "修改",
cancelText: "关闭",
showCancel: true,
top: "7vh",
width:"600px",
loading: false
},
data:{
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
user_id: "",
password:""
},
// 表单属性
props: {
// 表单请求地址
action: "admin/system/user/sys/resetPassword",
// 表单字段显示规则
columns: [
{ key:"user_id", title:"用户", type:"text" },
{ key:"password", title:"新密码", type:"password", showPassword:true },
],
// 表单验证规则
rules: {
user_id: [
{ "required": true, "message": "user_id不能为空", "trigger": "change" }
],
password:[
{ required:true, message:'新密码不能为空', trigger:'change' },
{ validator:vk.pubfn.validator("password"), message: '密码长度在6~18之间,只能包含字母、数字和下划线', trigger: 'change' }
],
},
// label宽度
labelWidth:"100px",
// label对其方式
labelPosition:"left",
}
}
};
},
mounted() {
that = this;
that.init();
},
methods: {
// 初始化
init() {
let { value } = that;
that.$emit("input", value);
},
// 监听 - 页面打开
onOpen() {
that = this;
let { item={} } = that.value;
let data = vk.pubfn.copyObject(item);
that.data = data;
that.form1.data = {
user_id: data._id,
password: ""
};
},
// 监听 - 页面关闭
onClose() {
that.$refs.form1.resetForm(); // 关闭时,重置表单
},
// 表单提交成功后
onFormSuccess() {
that.value.show = false; // 关闭页面
that.$emit("success");
},
},
// 监听属性
watch: {
},
// 计算属性
computed: {}
};
</script>
<style lang="scss" scoped>
</style>
@@ -0,0 +1,178 @@
<template>
<vk-data-dialog
v-model="value.show"
:title="page.title"
:top="page.top"
:width="page.width"
:close-on-click-modal="true"
mode="form"
@open="onOpen"
@closed="onClose"
>
<!-- 页面主体内容开始 -->
<vk-data-form
ref="form1"
v-model="form1.data"
:form-type="value.mode"
:rules="form1.props.rules"
:action="form1.props.action"
:columns="form1.props.columns"
:loading.sync="form1.props.loading"
:labelWidth="form1.props.labelWidth"
:before-action="form1.props.beforeAction"
:show-cancel="page.showCancel"
:cancel-text="page.cancelText"
:submit-text="page.submitText"
@success="onFormSuccess"
></vk-data-form>
<!-- 页面主体内容结束 -->
</vk-data-dialog>
</template>
<script>
var that; // 当前页面对象
var vk = uni.vk; // vk实例
export default {
props: {
value: {
Type: Object,
default: function() {
return {
show: false,
mode: "",
item: {}
};
}
}
},
data: function() {
// 组件创建时,进行数据初始化
return {
page: {
title: "标题",
submitText: "确定",
cancelText: "关闭",
showCancel: true,
top: "7vh",
width: "800px"
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
login_appid_type:1,
mode:1
},
// 表单属性
props: {
// 表单请求地址
action: "admin/system/user/sys/batchUpdateAppLogin",
// 表单字段显示规则
columns: [
{
key:"login_appid_type", title:"登录权限", type:"radio",
optionType:"button",
data:[
{ value:1, label:"部分应用" },
{ value:0, label:"全部应用" }
]
},
{
key:"mode", title:"模式", type:"radio",
optionType:"button",
data:[
{ value:1, label:"覆盖" },
{ value:2, label:"新增" },
{ value:3, label:"移除" }
],
showRule:"login_appid_type=1",
},
{
key:"dcloud_appid", title:"可登录的应用", type:"checkbox",
border:true,
itemWidth:100,
data:[],
props:{ value:"appid", label:"name" },
showRule:"login_appid_type=1&&mode=1"
},
{
key:"dcloud_appid", title:"可登录的应用", type:"radio",
border:true,
itemWidth:100,
data:[],
props:{ value:"appid", label:"name" },
showRule:"login_appid_type=1&&mode!=1"
},
],
// 表单验证规则
rules: {
},
// 左侧label的宽度
labelWidth: "100px",
// 提交前执行
beforeAction:function(formData){
let allow_login_background = false;
if(!formData.login_appid_type){
allow_login_background = true;
}else{
if(typeof formData.dcloud_appid === "object"){
formData.dcloud_appid.map((appid, index) => {
let item = vk.pubfn.getListItem(that.value.item.dcloudAppidData, "appid", appid);
if(item.type === "admin"){
allow_login_background = true;
}
});
}else{
let item = vk.pubfn.getListItem(that.value.item.dcloudAppidData, "appid", formData.dcloud_appid);
if(item.type === "admin"){
allow_login_background = true;
}
}
}
formData.user_ids = that.value.item.user_ids;
formData.allow_login_background = allow_login_background;
return formData;
}
}
}
};
},
mounted() {
that = this;
that.init();
},
methods: {
// 初始化
init() {
let { value } = that;
that.$emit("input", value);
},
// 监听 - 页面打开
onOpen() {
that = this;
let { item={} } = that.value;
// 每次打开时,重新设置表单的值 = value.item 的值,item通过 vk.pubfn.openForm('表单名',{ item:{ _id:"1" } }) 传递值
that.form1.props.columns[2].data = item.dcloudAppidData;
that.form1.props.columns[3].data = item.dcloudAppidData;
},
// 监听 - 页面关闭
onClose() {
//that.$refs.form1.resetForm(); // 关闭时,重置表单
},
// 监听 - 提交成功后
onFormSuccess() {
that.value.show = false; // 关闭页面
that.$emit("success");
}
},
// 监听属性
watch: {
},
// 计算属性
computed: {}
};
</script>
<style lang="scss" scoped></style>
+619
View File
@@ -0,0 +1,619 @@
<template>
<view class="page-body">
<!-- 请不要修改此页面的代码,因为更新后会覆盖,你自己系统的用户管理不应该在这个页面上开发,你应该复制整个页面,在别的目录创建用户管理。 -->
<!-- 请不要修改此页面的代码,因为更新后会覆盖,你自己系统的用户管理不应该在这个页面上开发,你应该复制整个页面,在别的目录创建用户管理。 -->
<!-- 请不要修改此页面的代码,因为更新后会覆盖,你自己系统的用户管理不应该在这个页面上开发,你应该复制整个页面,在别的目录创建用户管理。 -->
<!-- 请不要修改此页面的代码,因为更新后会覆盖,你自己系统的用户管理不应该在这个页面上开发,你应该复制整个页面,在别的目录创建用户管理。 -->
<!-- 请不要修改此页面的代码,因为更新后会覆盖,你自己系统的用户管理不应该在这个页面上开发,你应该复制整个页面,在别的目录创建用户管理。 -->
<!-- 请不要修改此页面的代码,因为更新后会覆盖,你自己系统的用户管理不应该在这个页面上开发,你应该复制整个页面,在别的目录创建用户管理。 -->
<!-- 页面内容开始 -->
<!-- 表格搜索组件开始 -->
<vk-data-table-query
v-model="queryForm1.formData"
:columns="queryForm1.columns"
@search="search"
></vk-data-table-query>
<!-- 表格搜索组件结束 -->
<!-- 自定义按钮区域开始 -->
<view class="vk-table-button-box">
<!-- <el-button type="success" size="small" icon="el-icon-circle-plus-outline" @click="addBtn">添加</el-button>-->
<!-- 批量操作 -->
<!-- <el-dropdown v-if="table1.multipleSelection" :split-button="false" trigger="click" @command="batchBtn">-->
<!-- <el-button type="danger" size="small"-->
<!-- :disabled="table1.multipleSelection.length === 0"-->
<!-- >-->
<!-- 批量操作<i class="el-icon-arrow-down el-icon&#45;&#45;right"></i>-->
<!-- </el-button>-->
<!-- <el-dropdown-menu slot="dropdown">-->
<!-- <el-dropdown-item :command="1">账号批量解冻</el-dropdown-item>-->
<!-- <el-dropdown-item :command="2">账号批量冻结</el-dropdown-item>-->
<!-- <el-dropdown-item :command="3">批量设置可登录的应用</el-dropdown-item>-->
<!-- </el-dropdown-menu>-->
<!-- </el-dropdown>-->
<el-button type="primary" size="small" icon="el-icon-s-tools" :disabled="!table1.selectItem"
@click="bindRoleBtn">角色绑定
</el-button>
<el-button type="primary" size="small" icon="el-icon-warning-outline" :disabled="!table1.selectItem"
@click="resetPasswordBtn">重置密码
</el-button>
</view>
<!-- 自定义按钮区域结束 -->
<!-- 表格组件开始 -->
<vk-data-table
ref="table1"
:action="table1.action"
:columns="table1.columns"
:query-form-param="queryForm1"
:right-btns="['detail_auto','update','delete', 'more']"
:right-btns-more="table1.rightBtnsMore"
:row-no="true"
:pagination="true"
@update="updateBtn"
@delete="deleteBtn"
@current-change="currentChange"
@selection-change="selectionChange"
></vk-data-table>
<!-- 表格组件结束 -->
<!-- 添加或编辑的弹窗开始 -->
<vk-data-dialog
v-model="form1.props.show"
:title="form1.props.title"
width="60%"
top="4vh"
mode="form"
>
<vk-data-form
ref="form1"
v-model="form1.data"
:rules="form1.props.rules"
:action="form1.props.action"
:form-type="form1.props.formType"
:columns='form1.props.columns'
label-width="120px"
max-height="700px"
@success="form1.props.show = false;refresh();"
></vk-data-form>
</vk-data-dialog>
<!-- 添加或编辑的弹窗结束 -->
<!-- 用户角色授权弹窗 -->
<bindRole v-model="formDatas.bindRole"></bindRole>
<!-- 重置密码弹窗 -->
<resetPassword v-model="formDatas.resetPassword"></resetPassword>
<!-- 批量设置用户允许登录的客户端 -->
<setAuthorizedAppLogin v-model="formDatas.setAuthorizedAppLogin" @success="refresh"></setAuthorizedAppLogin>
<!-- 页面内容结束 -->
<vk-data-dialog
v-model="showInviteList"
title="邀请列表"
width="60%"
top="14vh"
center
:close-on-click-modal="true"
>
<el-row :gutter="10">
<el-col :span="4">昵称</el-col>
<el-col :span="4">手机号</el-col>
<el-col :span="4">累计交易</el-col>
</el-row>
<el-row :gutter="10" v-for="(item, index) in inviteList" :key="index">
<el-col :span="4">{{ item.nickname }}</el-col>
<el-col :span="4">{{ item.mobile }}</el-col>
<el-col :span="4">{{ item.transactionAmount }}元</el-col>
</el-row>
<template v-slot:footer>
<el-button @click="showInviteList = false">关闭</el-button>
</template>
</vk-data-dialog>
</view>
</template>
<script>
var that; // 当前页面对象
var vk = uni.vk; // vk实例
var originalForms = {}; // 表单初始化数据
var genderData = [
{value: 1, label: "男"},
{value: 2, label: "女"},
{value: 0, label: "保密"}
];
var dcloudAppidData = [];
import bindRole from './form/bindRole'
import resetPassword from './form/resetPassword'
import setAuthorizedAppLogin from './form/setAuthorizedAppLogin'
export default {
components: {
bindRole,
resetPassword,
setAuthorizedAppLogin
},
data() {
// 页面数据变量
return {
showInviteList: false,
inviteList: [],
// 页面是否请求中或加载中
loading: false,
// init请求返回的数据
data: {},
// 表格相关开始 -----------------------------------------------------------
table1: {
rightBtnsMore: [
{
title: "邀请列表",
onClick: function ({_id}) {
vk.callFunction({
url: 'admin/system/user/sys/getInviteList',
data: {userId: _id},
success: ({rows}) => {
if (rows.length === 0) return vk.toast("无邀请记录");
that.showInviteList = true
that.inviteList = rows
}
});
}
}
],
// 表格数据请求地址
action: "admin/system/user/sys/getList",
// 表格字段显示规则
columns: [
{key: "avatar", title: "头像", type: "avatar", width: 80},
// {key: "username", title: "用户名", type: "text", width: 180, defaultValue: '未设置'},
{key: "nickname", title: "昵称", type: "text", width: 180, defaultValue: '未设置'},
{key: "mobile", title: "手机号", type: "text", width: 120, defaultValue: "未绑定"},
{key: "qybBuyNum", title: "累计购买次数", type: "text", width: 120, defaultValue: 0},
{key: "qybUsedNum", title: "已消费次数", type: "text", width: 120, defaultValue: 0},
{key: "qybNum", title: "剩余签约次数", type: "text", width: 120, defaultValue: 0},
{key: "qybGiftNum", title: "优惠政策赠送次数", type: "text", width: 150, defaultValue: 0},
{
key: "userLevel",
title: "用户等级",
type: "text",
width: 120,
formatter: function (val, row, column, index) {
switch (val) {
case 0:
return "认证用户";
case 1:
return "黄金VIP";
case 2:
return "铂金VIP";
case 3:
return "钻石VIP";
case 4:
return "实力厂家";
case 5:
return "实力加工厂";
case 6:
return "实力供货商";
case 7:
return "实力采购商";
default:
return "普通用户";
}
}
},
{
key: "authStatus",
title: "认证状态",
type: "text",
formatter: function (val, row, column, index) {
switch (val) {
case -1:
return "未认证";
case 1:
return "已通过";
case 2:
return "已拒绝";
case 0:
return "待审核";
}
}
},
{
key: "parent",
title: "推荐人",
type: "text",
width: 240,
formatter: function (val, row, column, index) {
return `${val.nickname}/${val.mobile}(${val.my_invite_code})`
}
},
{key: "my_invite_code", title: "邀请码", type: "text"},
{
key: "isService", title: "是否业务员", type: "select",
data: [
{value: true, label: "是"},
{value: false, label: "否"}
]
},
{key: "serviceCode", title: "业务员编号", type: "text"},
{key: "register_date", title: "注册时间", type: "time", width: 160, sortable: "custom"},
{
key: "last_login_date",
title: "最后登录时间",
type: "dateDiff",
width: 130,
defaultValue: '从未登录过',
sortable: "custom"
},
{key: "last_login_ip", title: "最后登录ip", type: "text", width: 120, defaultValue: '从未登录过'},
{key: "_id", title: "id", type: "text", width: 280},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: "",
},
// 表格相关结束 -----------------------------------------------------------
// 表单相关开始-----------------------------------------------------------
// 查询表单请求数据
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {
dcloud_appid: "",
isSignOnly: true,
//allow_login_background : true,
},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
{
key: "dcloud_appid", title: "所属应用", type: "select", width: 160, mode: "custom",
data: [],
props: {value: "appid", label: "name"}
},
// {key: "my_invite_code", title: "邀请码", type: "text", width: 160, mode: "%%"},
{key: "nickname", title: "昵称", type: "text", width: 140, mode: "%%"},
{key: "mobile", title: "手机号", type: "text", width: 140, mode: "%%"},
{
key: "isService", title: "是否业务员", type: "select", mode: "=",
data: [
{value: true, label: "是"},
{value: false, label: "否"}
]
},
{key: "_id", title: "ID", type: "text", width: 140, mode: "="},
{key: "register_date", title: "注册时间", type: "datetimerange", width: 380, mode: "[]"},
{key: "allow_login_background", hidden: true, mode: "="},
{
key: "userLevel", title: "用户等级", type: "select", mode: "=", data: [
{value: -1, label: "普通用户"},
{value: 0, label: "认证用户"},
{value: 1, label: "黄金VIP"},
{value: 2, label: "铂金VIP"},
{value: 3, label: "钻石VIP"},
{value: 4, label: "实力厂家"},
{value: 5, label: "实力加工厂"},
{value: 6, label: "实力供货商"},
{value: 7, label: "实力采购商"},
]
},
]
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
gender: 0,
login_appid_type: 1,
allow_login_background: false,
isSignOnly: true,
allowArea: []
},
// 表单属性
props: {
// 表单请求地址
action: "",
// 表单字段显示规则
columns: [
{key: "username", title: "用户名", type: "text", show: ["add"]},
{key: "nickname", title: "昵称", type: "text"},
{key: "my_invite_code", title: "邀请码", type: "text"},
{
key: "isService", title: "是否业务员", type: "select", mode: "=",
data: [
{value: true, label: "是"},
{value: false, label: "否"}
]
},
// {
// key: "gender", title: "性别", type: "radio",
// data: genderData
// },
{
key: "password",
title: "密码",
type: "text",
tips: "若密码为空,则默认为234567",
show: ["add"]
},
{key: "mobile", title: "手机号", type: "text"},
{
key: "allowArea", title: "可查看的区域", type: "array<object>",
showAdd: true,
showClear: true,
columns: [{
key: "area",
title: "城市",
type: "address",
level: 2,
}
]
},
{
key: "login_appid_type", title: "登录权限", type: "radio",
optionType: "button",
data: [
{value: 1, label: "部分应用"},
{value: 0, label: "全部应用"}
],
onChange: function (val, formData, column, index, option) {
if (val === 1) {
that.form1.data.allow_login_background = false
} else {
that.form1.data.allow_login_background = true;
}
}
},
{
key: "dcloud_appid", title: "可登录的应用", type: "checkbox",
border: true,
itemWidth: 100,
data: [],
props: {value: "appid", label: "name"},
showRule: "login_appid_type=1",
onChange: function (val, formData, column, index, option = []) {
let allow_login_background = false;
option.map((item = {}, index) => {
if (item.type && item.type.indexOf("admin") > -1) {
allow_login_background = true;
}
});
if (that.form1.data.login_appid_type === 1) {
that.form1.data.allow_login_background = allow_login_background;
} else {
that.form1.data.allow_login_background = true;
}
}
},
{
key: "allow_login_background", title: "允许登录后台?", type: "switch",
tips: "只有同时设置可登录的应用有管理端以及允许登后台,该用户才能登录管理端"
},
{
key: "comment", title: "备注", type: "textarea",
maxlength: "99", showWordLimit: true, autosize: {minRows: 2, maxRows: 10},
},
],
// 表单对应的验证规则
rules: {
username: [
{
required: true,
validator: vk.pubfn.validator("username"),
message: '用户名以字母开头,长度在6~18之间,只能包含字母、数字和下划线',
trigger: 'blur'
}
],
nickname: [
{required: true, message: '昵称为必填字段', trigger: 'blur'},
{min: 2, max: 20, message: '昵称长度在 2 到 20 个字符', trigger: 'blur'}
],
password: [
{
validator: vk.pubfn.validator("password"),
message: '密码长度在6~18之间,只能包含字母、数字和下划线',
trigger: 'blur'
}
],
mobile: [
{validator: vk.pubfn.validator("mobile"), message: '手机号格式错误', trigger: 'blur'}
]
},
// add 代表添加 update 代表修改
formType: '',
// 是否显示表单1 的弹窗
show: false,
}
},
// 其他表单属性容器(请勿修改)
formDatas: {},
// 表单相关结束-----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {
},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {
},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {
},
// 函数
methods: {
// 页面数据初始化函数
init(options) {
originalForms["form1"] = vk.pubfn.copyObject(that.form1);
that.getAppList();
},
// 获取应用列表
getAppList(obj) {
// 请在store/modules/$app.js文件里增加代码 appList: lifeData.$app.appList || []
vk.callFunction({
url: 'admin/system/app/sys/getList',
data: {},
success: function (data) {
dcloudAppidData = data.rows;
let dcloudAppidData1 = vk.pubfn.copyObject(data.rows);
let dcloudAppidData2 = vk.pubfn.copyObject(data.rows);
let index1 = vk.pubfn.getListIndex(that.form1.props.columns, "key", "dcloud_appid");
that.form1.props.columns[index1].data = dcloudAppidData1;
dcloudAppidData2.unshift({
appid: "___error___",
name: "不存在的应用"
});
dcloudAppidData2.unshift({
appid: "___empty-array___",
name: "未绑定应用"
});
dcloudAppidData2.unshift({
appid: "___non-existent___",
name: "全部应用"
});
let index2 = vk.pubfn.getListIndex(that.queryForm1.columns, "key", "dcloud_appid");
that.queryForm1.columns[index2].data = dcloudAppidData2;
let appids = [];
dcloudAppidData.map((item, index) => {
appids.push(item.appid);
});
that.queryForm1.formData.appids = appids;
}
});
},
// 页面跳转
pageTo(path) {
vk.navigateTo(path);
},
// 表单重置
resetForm() {
vk.pubfn.resetForm(originalForms, that);
},
// 搜索
search() {
that.$refs.table1.query();
},
// 刷新
refresh() {
that.$refs.table1.refresh();
},
// 获取当前选中的行的数据
getCurrentRow(key) {
return that.$refs.table1.getCurrentRow(key);
},
// 监听 - 行的选中高亮事件
currentChange(val) {
that.table1.selectItem = val;
},
// 当选择项发生变化时会触发该事件
selectionChange(list) {
that.table1.multipleSelection = list;
},
// 显示添加页面
addBtn() {
that.resetForm();
that.form1.props.action = 'admin/system/user/sys/add';
that.form1.props.formType = 'add';
that.form1.props.title = '添加';
that.form1.props.show = true;
},
// 显示修改页面
updateBtn({item}) {
that.form1.props.action = 'admin/system/user/sys/update';
that.form1.props.formType = 'update';
that.form1.props.title = '编辑';
that.form1.props.show = true;
item.login_appid_type = typeof item.dcloud_appid === "undefined" ? 0 : 1;
that.form1.data = item;
},
// 删除按钮
deleteBtn({item, deleteFn}) {
deleteFn({
action: "admin/system/user/sys/delete",
data: {
_id: item._id
}
});
},
// 监听 - 批量操作的按钮点击事件
batchBtn(index) {
switch (index) {
case 1:
that.frozen(0);
break;
case 2:
that.frozen(1);
break;
case 3:
that.setAuthorizedAppLogin();
break;
default:
break;
}
},
// 角色绑定按钮
bindRoleBtn() {
let item = that.getCurrentRow(true);
vk.pubfn.openForm('bindRole', {item});
},
// 重置密码按钮
resetPasswordBtn() {
let item = that.getCurrentRow(true);
vk.pubfn.openForm('resetPassword', {item});
},
//账户批量冻结/解冻
frozen(status) {
let user_ids = [];
that.table1.multipleSelection.map((item, index) => {
user_ids.push(item._id);
});
vk.callFunction({
url: 'admin/system/user/sys/batchUpdateStatus',
title: '请求中...',
data: {
user_ids,
status
},
success: function (data) {
that.$notify({
message: '批量操作成功!',
type: 'success'
});
that.refresh();
}
});
},
// 批量设置允许登录的客户端
setAuthorizedAppLogin() {
let user_ids = [];
that.table1.multipleSelection.map((item, index) => {
user_ids.push(item._id);
});
that.formDatas.setAuthorizedAppLogin = {
show: true,
item: {
user_ids,
dcloudAppidData
}
};
}
},
// 监听属性
watch: {},
// 过滤器
filters: {},
// 计算属性
computed: {}
};
</script>
<style lang="scss" scoped>
</style>
+305
View File
@@ -0,0 +1,305 @@
<template>
<view class="page-body">
<!-- 页面内容开始 -->
<!-- 表格搜索组件开始 -->
<vk-data-table-query v-model="queryForm1.formData" :columns="queryForm1.columns"
@search="search"></vk-data-table-query>
<!-- 表格搜索组件结束 -->
<!-- 自定义按钮区域开始 -->
<view>
<el-row>
<el-button type="success" size="small" icon="el-icon-circle-plus-outline" @click="addBtn">添加
</el-button>
<!-- 批量操作 -->
<el-dropdown v-if="table1.multipleSelection" :split-button="false" trigger="click" @command="batchBtn">
<!-- <el-button type="danger" size="small" style="margin-left: 20rpx;"
:disabled="table1.multipleSelection.length === 0">
批量操作<i class="el-icon-arrow-down el-icon--right"></i>
</el-button> -->
<el-dropdown-menu slot="dropdown">
<!-- <el-dropdown-item :command="1">批量操作1</el-dropdown-item>
<el-dropdown-item :command="2">批量操作2</el-dropdown-item> -->
</el-dropdown-menu>
</el-dropdown>
</el-row>
</view>
<!-- 自定义按钮区域结束 -->
<!-- 表格组件开始 -->
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
:right-btns="['detail_auto','update','delete']" :default-expand-all="false" @update="updateBtn"
@delete="deleteBtn" @current-change="currentChange" :pagination="true"
@selection-change="selectionChange"></vk-data-table>
<!-- 表格组件结束 -->
<!-- 添加或编辑的弹窗开始 -->
<vk-data-dialog v-model="form1.props.show" :title="form1.props.title" width="60%" mode="form"
:close-on-click-modal="false">
<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
:form-type="form1.props.formType" :columns='form1.props.columns' label-width="120px"
@success="form1.props.show = false;refresh();"></vk-data-form>
</vk-data-dialog>
<!-- 添加或编辑的弹窗结束 -->
<!-- 页面内容结束 -->
</view>
</template>
<script>
var that; // 当前页面对象
var vk = uni.vk; // vk实例
var originalForms = {}; // 表单初始化数据
export default {
data() {
// 页面数据变量
return {
// 页面是否请求中或加载中
loading: false,
// init请求返回的数据
data: {},
// 表格相关开始 -----------------------------------------------------------
table1: {
// 表格数据请求地址
action: "admin/stealFactory/list/sys/list",
// 表格字段显示规则
columns: [
// {
// key: "_id",
// title: "id",
// type: "text",
// width: 220
// },
{
key: "name",
title: "名称",
type: "text",
width: 220,
align: "left",
},
{
key: "sort",
title: "排序",
type: "number",
align: "left",
width: 80,
},
{
key: "_add_time",
title: "添加时间",
type: "time",
align: "left",
width: 160,
sortable: "custom"
},
{
key: "_add_time_diff",
title: "距离现在",
type: "html",
align: "left",
width: 120,
formatter: (val, row) => vk.pubfn.dateDiff(row._add_time)
},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: ""
},
// 表格相关结束 -----------------------------------------------------------
// 表单相关开始 -----------------------------------------------------------
// 查询表单请求数据
queryForm1: {
// 查询表单数据源,可在此设置默认值
formData: {},
// 查询表单的字段规则 fieldName:指定数据库字段名,不填默认等于key
columns: [
// {
// key: "name",
// title: "名称",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "remark",
// title: "备注",
// type: "text",
// width: 160,
// mode: "%%"
// },
// {
// key: "_add_time",
// title: "添加时间",
// type: "datetimerange",
// width: 400,
// mode: "[]"
// },
]
},
form1: {
// 表单请求数据,此处可以设置默认值
data: {
sort: 0,
amount: 0,
},
// 表单属性
props: {
// 表单请求地址
action: "",
// 表单字段显示规则
columns: [
{
key: "name",
title: "名称",
type: "text",
placeholder: "请输入名称"
},
{
key: "remark",
title: "备注",
type: "textarea",
maxlength: "99",
showWordLimit: true,
autosize: {
minRows: 2,
maxRows: 10
},
},
{
key: "sort",
title: "排序",
type: "number",
precision: 0,
placeholder: "请输入排序值",
},
],
// 表单验证规则
rules: {
sort: [{
type: 'number',
message: '排序值必须为数字'
}],
name: [
{required: true, message: '分类名称不能为空', trigger: 'blur'},
],
},
// add 代表添加 update 代表修改
formType: "",
// 是否显示表单的弹窗
show: false
}
},
// 其他弹窗表单
formDatas: {},
// 表单相关结束 -----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {
},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {
},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {
},
// 函数
methods: {
// 页面数据初始化函数
init(options) {
originalForms["form1"] = vk.pubfn.copyObject(that.form1);
},
// 页面跳转
pageTo(path) {
vk.navigateTo(path);
},
// 表单重置
resetForm() {
vk.pubfn.resetForm(originalForms, that);
},
// 搜索
search() {
that.$refs.table1.search();
},
// 刷新
refresh() {
that.$refs.table1.refresh();
},
// 获取当前选中的行的数据
getCurrentRow() {
return that.$refs.table1.getCurrentRow();
},
// 监听 - 行的选中高亮事件
currentChange(val) {
that.table1.selectItem = val;
},
// 当选择项发生变化时会触发该事件
selectionChange(list) {
that.table1.multipleSelection = list;
},
// 显示添加页面
addBtn() {
that.resetForm();
that.form1.props.action = 'admin/stealFactory/list/sys/add';
that.form1.props.formType = 'add';
that.form1.props.title = '添加';
that.form1.props.show = true;
},
// 显示修改页面
updateBtn({
item
}) {
that.form1.props.action = 'admin/stealFactory/list/sys/update';
that.form1.props.formType = 'update';
that.form1.props.title = '编辑';
that.form1.props.show = true;
that.form1.data = item;
},
// 删除按钮
deleteBtn({
item,
deleteFn
}) {
deleteFn({
action: "admin/stealFactory/list/sys/delete",
data: {
_id: item._id
},
});
},
// 监听 - 批量操作的按钮点击事件
batchBtn(index) {
switch (index) {
case 1:
vk.toast("批量操作按钮1");
break;
case 2:
vk.toast("批量操作按钮2");
break;
default:
break;
}
}
},
// 监听属性
watch: {},
// 过滤器
filters: {},
// 计算属性
computed: {}
};
</script>
<style lang="scss" scoped>
.page-body {
}
</style>
+381
View File
@@ -0,0 +1,381 @@
<template>
<view class="page-body">
<!-- 自定义按钮区域开始 -->
<view>
<el-row>
<el-button type="success" size="small" icon="el-icon-circle-plus-outline" @click="addBtn">添加
</el-button>
</el-row>
</view>
<!-- 自定义按钮区域结束 -->
<!-- 表格组件开始 -->
<vk-data-table ref="table1" :action="table1.action" :columns="table1.columns" :query-form-param="queryForm1"
:right-btns="['detail_auto','update','delete']" :default-expand-all="false" @update="updateBtn"
@delete="deleteBtn" @current-change="currentChange"
@selection-change="selectionChange"></vk-data-table>
<!-- 表格组件结束 -->
<!-- 添加或编辑的弹窗开始 -->
<vk-data-dialog v-model="form1.props.show" :title="form1.props.title" width="60%" mode="form"
:close-on-click-modal="false">
<vk-data-form v-model="form1.data" :rules="form1.props.rules" :action="form1.props.action"
:form-type="form1.props.formType" :columns='form1.props.columns' label-width="120px"
@success="form1.props.show = false;refresh();"></vk-data-form>
</vk-data-dialog>
<!-- 添加或编辑的弹窗结束 -->
<!-- 页面内容结束 -->
</view>
</template>
<script>
var that; // 当前页面对象
var vk = uni.vk; // vk实例
var originalForms = {}; // 表单初始化数据
export default {
data() {
// 页面数据变量
return {
// 页面是否请求中或加载中
loading: false,
// init请求返回的数据
data: {},
// 表格相关开始 -----------------------------------------------------------
table1: {
// 表格数据请求地址
action: "admin/userLevel/sys/list",
// 表格字段显示规则
columns: [
// {
// key: "_id",
// title: "id",
// type: "text",
// width: 220
// },
// {
// key: "level",
// title: "等级标识",
// type: "text",
// width: 220,
// align: "left",
// },
{
key: "name",
title: "名称",
type: "text",
width: 100,
align: "left",
},
{
key: "icon",
title: "图标",
type: "image",
placeholder: "请选择图标"
},
{
key: "amount",
title: "金额",
type: "number",
placeholder: "请输入内容",
},
{
key: "ensureAmount",
title: "保证金金额",
type: "number",
placeholder: "请输入保证金金额",
},
{
key: "upgradeAmount",
title: "升级交易额",
type: "number",
placeholder: "请输入升级交易额",
},
{
key: "showMsg",
title: "消息推送模板",
type: "switch",
},
{
key: "offerOffRate",
title: "报价折扣(%)",
type: "number",
formatter: (val, row, column, index) => {
return val === 0 ? '不限,免费' : `${val / 10}折`
}
},
{
key: "enquiryNum",
title: "每月询价次数",
type: "number",
},
{
key: "valueAddRate",
title: "增值服务折扣(%)",
type: "number",
},
{
key: "adRate",
title: "广告位折扣(%)",
type: "number",
},
{
key: "recommendUpgrade",
title: "推荐多少黄金会员可升级",
type: "number",
},
{
key: "upgradeDesc",
title: "邀请说明",
type: "text",
},
{
key: "factoryPicNum",
title: "加工厂可上传图片数",
type: "number",
},
{
key: "upgradeDescImg",
title: "权益说明图",
type: "image",
limit: 1,
showRule: () => {
return false
}
},
],
// 多选框选中的值
multipleSelection: [],
// 当前高亮的记录
selectItem: ""
},
// 表格相关结束 -----------------------------------------------------------
form1: {
// 表单请求数据,此处可以设置默认值
data: {},
// 表单属性
props: {
// 表单请求地址
action: "",
// 表单字段显示规则
columns: [
{
key: "level",
title: "等级标识",
type: "number",
placeholder: "请输入等级标识"
},
{
key: "name",
title: "名称",
type: "text",
placeholder: "请输入名称"
},
{
key: "icon",
title: "图标",
type: "image",
placeholder: "请选择图标"
},
{
key: "amount",
title: "金额",
type: "number",
placeholder: "请输入内容",
},
{
key: "ensureAmount",
title: "保证金金额",
type: "number",
placeholder: "请输入保证金金额",
},
{
key: "upgradeAmount",
title: "升级交易额",
type: "number",
placeholder: "请输入升级交易额",
},
{
key: "showMsg",
title: "消息推送模板",
type: "switch",
},
{
key: "offerOffRate",
title: "报价折扣(%)",
type: "number",
placeholder: '0为不限次数,免费'
},
{
key: "enquiryNum",
title: "每月询价次数",
type: "number",
},
{
key: "valueAddRate",
title: "增值服务折扣(%)",
type: "number",
},
{
key: "adRate",
title: "广告位折扣(%)",
type: "number",
},
{
key: "recommendUpgrade",
title: "推荐多少黄金会员可升级",
type: "number",
},
{
key: "factoryPicNum",
title: "加工厂可上传图片数",
type: "number",
},
// {
// key: "upgradeDesc",
// title: "自主交易",
// type: "text",
// },
{
key: "upgradeDesc",
title: "邀请说明",
type: "text",
},
{
key: "upgradeDescImg",
title: "权益说明图",
type: "image",
limit: 1
},
],
// 表单验证规则
rules: {
sort: [{
type: 'number',
message: '排序值必须为数字'
}],
name: [
{required: true, message: '分类名称不能为空', trigger: 'blur'},
],
},
// add 代表添加 update 代表修改
formType: "",
// 是否显示表单的弹窗
show: false
}
},
// 其他弹窗表单
formDatas: {},
// 表单相关结束 -----------------------------------------------------------
};
},
// 监听 - 页面每次【加载时】执行(如:前进)
onLoad(options = {}) {
that = this;
vk = that.vk;
that.options = options;
that.init(options);
},
// 监听 - 页面【首次渲染完成时】执行。注意如果渲染速度快,会在页面进入动画完成前触发
onReady() {
},
// 监听 - 页面每次【显示时】执行(如:前进和返回) (页面每次出现在屏幕上都触发,包括从下级页面点返回露出当前页面)
onShow() {
},
// 监听 - 页面每次【隐藏时】执行(如:返回)
onHide() {
},
// 函数
methods: {
// 页面数据初始化函数
init(options) {
originalForms["form1"] = vk.pubfn.copyObject(that.form1);
},
// 页面跳转
pageTo(path) {
vk.navigateTo(path);
},
// 表单重置
resetForm() {
vk.pubfn.resetForm(originalForms, that);
},
// 搜索
search() {
that.$refs.table1.search();
},
// 刷新
refresh() {
that.$refs.table1.refresh();
},
// 获取当前选中的行的数据
getCurrentRow() {
return that.$refs.table1.getCurrentRow();
},
// 监听 - 行的选中高亮事件
currentChange(val) {
that.table1.selectItem = val;
},
// 当选择项发生变化时会触发该事件
selectionChange(list) {
that.table1.multipleSelection = list;
},
// 显示添加页面
addBtn() {
that.resetForm();
that.form1.props.action = 'admin/userLevel/sys/add';
that.form1.props.formType = 'add';
that.form1.props.title = '添加';
that.form1.props.show = true;
},
// 显示修改页面
updateBtn({
item
}) {
that.form1.props.action = 'admin/userLevel/sys/update';
that.form1.props.formType = 'update';
that.form1.props.title = '编辑';
that.form1.props.show = true;
that.form1.data = item;
},
// 删除按钮
deleteBtn({
item,
deleteFn
}) {
deleteFn({
action: "admin/userLevel/sys/delete",
data: {
_id: item._id
},
});
},
// 监听 - 批量操作的按钮点击事件
batchBtn(index) {
switch (index) {
case 1:
vk.toast("批量操作按钮1");
break;
case 2:
vk.toast("批量操作按钮2");
break;
default:
break;
}
}
},
// 监听属性
watch: {},
// 过滤器
filters: {},
// 计算属性
computed: {}
};
</script>
<style lang="scss" scoped>
.page-body {
}
</style>
File diff suppressed because it is too large Load Diff
@@ -10,17 +10,17 @@
<el-table :data="certList" style="width: 100%">
<el-table-column prop="tips" label="说明" minWidth="300"> </el-table-column>
<el-table-column prop="name" label="选择证书" minWidth="300">
<template slot-scope="scope">
<text style="margin-right: 20px;">{{ scope.row.name }}</text>
<el-button type="success" @click="upload(scope.row)" size="mini" plain> {{ scope.row.content ? '已' : ''}}选择 {{ scope.row.file }} </el-button>
<text style="margin-left: 20px;color: #c2e7b0;" v-if="scope.row.content && scope.row.file === scope.row.name"> √ </text>
<text style="margin-left: 20px;color: red;" v-if="scope.row.content && scope.row.file !== scope.row.name"> × </text>
<template v-slot="{ row }">
<text style="margin-right: 20px;">{{ row.name }}</text>
<el-button type="success" @click="upload(row)" size="mini" plain> {{ row.content ? '已' : ''}}选择 {{ row.file }} </el-button>
<text style="margin-left: 20px;color: #c2e7b0;" v-if="row.content && row.file === row.name"> √ </text>
<text style="margin-left: 20px;color: red;" v-if="row.content && row.file !== row.name"> × </text>
</template>
</el-table-column>
<el-table-column prop="key4" label="选择后可复制" minWidth="200" >
<template slot-scope="scope">
<!-- <el-button type="success" @click="copy(scope.row.name)" size="mini" plain v-if="scope.row.content && scope.row.file === scope.row.name"> 复制 </el-button> -->
<el-button type="success" size="mini" plain v-if="scope.row.content && scope.row.file === scope.row.name"> 请复制下方证书内容 </el-button>
<template v-slot="{ row }">
<!-- <el-button type="success" @click="copy(row.name)" size="mini" plain v-if="row.content && row.file === row.name"> 复制 </el-button> -->
<el-button type="success" size="mini" plain v-if="row.content && row.file === row.name"> 请复制下方证书内容 </el-button>
</template>
</el-table-column>
</el-table>
+257
View File
@@ -0,0 +1,257 @@
lockfileVersion: 5.4
specifiers:
async-validator: ^4.2.5
babel-helper-vue-jsx-merge-props: ^2.0.3
dayjs: ^1.11.11
element-ui: 2.15.13
normalize-wheel: ^1.0.1
resize-observer-polyfill: ^1.5.1
sortablejs: ^1.15.0
throttle-debounce: ^1.1.0
umy-table: ^1.1.8
umy-ui: 1.1.6
vk-unicloud-admin-ui: ^1.17.45
vue: '2'
vue-tianditu: 1.2.11
vuedraggable: ^2.24.3
xe-utils: ^3.5.14
dependencies:
async-validator: 4.2.5
babel-helper-vue-jsx-merge-props: 2.0.3
dayjs: 1.11.11
element-ui: 2.15.13_vue@2.7.15
normalize-wheel: 1.0.1
resize-observer-polyfill: 1.5.1
sortablejs: 1.15.0
throttle-debounce: 1.1.0
umy-table: 1.1.8_vue@2.7.15+xe-utils@3.5.14
umy-ui: 1.1.6_vue@2.7.15+xe-utils@3.5.14
vk-unicloud-admin-ui: 1.17.52
vue: 2.7.15
vue-tianditu: 1.2.11
vuedraggable: 2.24.3
xe-utils: 3.5.14
packages:
/@babel/helper-string-parser/7.23.4:
resolution: {integrity: sha512-803gmbQdqwdf4olxrX4AJyFBV/RTr3rSmOj0rKwesmzlfhYNDEs+/iOcznzpNWlJlIlTJC2QfPFcHB6DlzdVLQ==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/@babel/helper-string-parser/-/helper-string-parser-7.23.4.tgz}
engines: {node: '>=6.9.0'}
dev: false
/@babel/helper-validator-identifier/7.22.20:
resolution: {integrity: sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz}
engines: {node: '>=6.9.0'}
dev: false
/@babel/parser/7.23.4:
resolution: {integrity: sha512-vf3Xna6UEprW+7t6EtOmFpHNAuxw3xqPZghy+brsnusscJRW5BMUzzHZc5ICjULee81WeUV2jjakG09MDglJXQ==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/@babel/parser/-/parser-7.23.4.tgz}
engines: {node: '>=6.0.0'}
hasBin: true
dependencies:
'@babel/types': 7.23.4
dev: false
/@babel/types/7.23.4:
resolution: {integrity: sha512-7uIFwVYpoplT5jp/kVv6EF93VaJ8H+Yn5IczYiaAi98ajzjfoZfslet/e0sLh+wVBjb2qqIut1b0S26VSafsSQ==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/@babel/types/-/types-7.23.4.tgz}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/helper-string-parser': 7.23.4
'@babel/helper-validator-identifier': 7.22.20
to-fast-properties: 2.0.0
dev: false
/@vue/compiler-sfc/2.7.15:
resolution: {integrity: sha512-FCvIEevPmgCgqFBH7wD+3B97y7u7oj/Wr69zADBf403Tui377bThTjBvekaZvlRr4IwUAu3M6hYZeULZFJbdYg==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/@vue/compiler-sfc/-/compiler-sfc-2.7.15.tgz}
dependencies:
'@babel/parser': 7.23.4
postcss: 8.4.31
source-map: 0.6.1
dev: false
/async-validator/1.11.5:
resolution: {integrity: sha512-XNtCsMAeAH1pdLMEg1z8/Bb3a8cdCbui9QbJATRFHHHW5kT6+NPI3zSVQUXgikTFITzsg+kYY5NTWhM2Orwt9w==}
dev: false
/async-validator/1.8.5:
resolution: {integrity: sha512-tXBM+1m056MAX0E8TL2iCjg8WvSyXu0Zc8LNtYqrVeyoL3+esHRZ4SieE9fKQyyU09uONjnMEjrNBMqT0mbvmA==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/async-validator/-/async-validator-1.8.5.tgz}
dependencies:
babel-runtime: 6.26.0
dev: false
/async-validator/4.2.5:
resolution: {integrity: sha512-7HhHjtERjqlNbZtqNqy2rckN/SpOOlmDliet+lP7k+eKZEjPk3DgyeU9lIXLdeLz0uBbbVp+9Qdow9wJWgwwfg==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/async-validator/-/async-validator-4.2.5.tgz}
dev: false
/babel-helper-vue-jsx-merge-props/2.0.3:
resolution: {integrity: sha512-gsLiKK7Qrb7zYJNgiXKpXblxbV5ffSwR0f5whkPAaBAR4fhi6bwRZxX9wBlIc5M/v8CCkXUbXZL4N/nSE97cqg==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/babel-helper-vue-jsx-merge-props/-/babel-helper-vue-jsx-merge-props-2.0.3.tgz}
dev: false
/babel-runtime/6.26.0:
resolution: {integrity: sha512-ITKNuq2wKlW1fJg9sSW52eepoYgZBggvOAHC0u/CYu/qxQ9EVzThCgR69BnSXLHjy2f7SY5zaQ4yt7H9ZVxY2g==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/babel-runtime/-/babel-runtime-6.26.0.tgz}
dependencies:
core-js: 2.6.12
regenerator-runtime: 0.11.1
dev: false
/core-js/2.6.12:
resolution: {integrity: sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/core-js/-/core-js-2.6.12.tgz}
deprecated: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
requiresBuild: true
dev: false
/core-js/3.37.0:
resolution: {integrity: sha512-fu5vHevQ8ZG4og+LXug8ulUtVxjOcEYvifJr7L5Bfq9GOztVqsKd9/59hUk2ZSbCrS3BqUr3EpaYGIYzq7g3Ug==}
requiresBuild: true
dev: false
/csstype/3.1.2:
resolution: {integrity: sha512-I7K1Uu0MBPzaFKg4nI5Q7Vs2t+3gWWW648spaF+Rg7pI9ds18Ugn+lvg4SHczUdKlHI5LWBXyqfS8+DufyBsgQ==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/csstype/-/csstype-3.1.2.tgz}
dev: false
/dayjs/1.11.11:
resolution: {integrity: sha512-okzr3f11N6WuqYtZSvm+F776mB41wRZMhKP+hc34YdW+KmtYYK9iqvHSwo2k9FEH3fhGXvOPV6yz2IcSrfRUDg==}
dev: false
/deepmerge/1.5.2:
resolution: {integrity: sha512-95k0GDqvBjZavkuvzx/YqVLv/6YYa17fz6ILMSf7neqQITCPbnfEnQvEgMPNjH4kgobe7+WIL0yJEHku+H3qtQ==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/deepmerge/-/deepmerge-1.5.2.tgz}
engines: {node: '>=0.10.0'}
dev: false
/element-ui/2.15.13_vue@2.7.15:
resolution: {integrity: sha512-LJoatEYX6WV74FqXBss8Xfho9fh9rjDSzrDrTyREdGb1h1R3uRvmLh5jqp2JU137aj4/BgqA3K06RQpQBX33Bg==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/element-ui/-/element-ui-2.15.13.tgz}
peerDependencies:
vue: ^2.5.17
dependencies:
async-validator: 1.8.5
babel-helper-vue-jsx-merge-props: 2.0.3
deepmerge: 1.5.2
normalize-wheel: 1.0.1
resize-observer-polyfill: 1.5.1
throttle-debounce: 1.1.0
vue: 2.7.15
dev: false
/nanoid/3.3.7:
resolution: {integrity: sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/nanoid/-/nanoid-3.3.7.tgz}
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
hasBin: true
dev: false
/normalize-wheel/1.0.1:
resolution: {integrity: sha512-1OnlAPZ3zgrk8B91HyRj+eVv+kS5u+Z0SCsak6Xil/kmgEia50ga7zfkumayonZrImffAxPU/5WcyGhzetHNPA==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/normalize-wheel/-/normalize-wheel-1.0.1.tgz}
dev: false
/picocolors/1.0.0:
resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/picocolors/-/picocolors-1.0.0.tgz}
dev: false
/postcss/8.4.31:
resolution: {integrity: sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/postcss/-/postcss-8.4.31.tgz}
engines: {node: ^10 || ^12 || >=14}
dependencies:
nanoid: 3.3.7
picocolors: 1.0.0
source-map-js: 1.0.2
dev: false
/regenerator-runtime/0.11.1:
resolution: {integrity: sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz}
dev: false
/resize-observer-polyfill/1.5.1:
resolution: {integrity: sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz}
dev: false
/sortablejs/1.10.2:
resolution: {integrity: sha512-YkPGufevysvfwn5rfdlGyrGjt7/CRHwvRPogD/lC+TnvcN29jDpCifKP+rBqf+LRldfXSTh+0CGLcSg0VIxq3A==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/sortablejs/-/sortablejs-1.10.2.tgz}
dev: false
/sortablejs/1.15.0:
resolution: {integrity: sha512-bv9qgVMjUMf89wAvM6AxVvS/4MX3sPeN0+agqShejLU5z5GX4C75ow1O2e5k4L6XItUyAK3gH6AxSbXrOM5e8w==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/sortablejs/-/sortablejs-1.15.0.tgz}
dev: false
/source-map-js/1.0.2:
resolution: {integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/source-map-js/-/source-map-js-1.0.2.tgz}
engines: {node: '>=0.10.0'}
dev: false
/source-map/0.6.1:
resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/source-map/-/source-map-0.6.1.tgz}
engines: {node: '>=0.10.0'}
dev: false
/throttle-debounce/1.1.0:
resolution: {integrity: sha512-XH8UiPCQcWNuk2LYePibW/4qL97+ZQ1AN3FNXwZRBNPPowo/NRU5fAlDCSNBJIYCKbioZfuYtMhG4quqoJhVzg==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/throttle-debounce/-/throttle-debounce-1.1.0.tgz}
engines: {node: '>=4'}
dev: false
/to-fast-properties/2.0.0:
resolution: {integrity: sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz}
engines: {node: '>=4'}
dev: false
/umy-table/1.1.8_vue@2.7.15+xe-utils@3.5.14:
resolution: {integrity: sha512-yqPMFwZ6MUNqI73KamsNKBTbHRA7VuVZDEWobaySghtf4n/s7INuTNQoADB/ROVK57WOXr99Xpnol0aMqGlASA==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/umy-table/-/umy-table-1.1.8.tgz}
peerDependencies:
vue: '>= 2.6.0 < 3'
xe-utils: '>= 3'
dependencies:
async-validator: 1.8.5
deepmerge: 1.5.2
normalize-wheel: 1.0.1
resize-observer-polyfill: 1.5.1
throttle-debounce: 1.1.0
vue: 2.7.15
vuedraggable: 2.24.3
xe-utils: 3.5.14
dev: false
/umy-ui/1.1.6_vue@2.7.15+xe-utils@3.5.14:
resolution: {integrity: sha512-wX0S29B5sFn8q0MvU9PEl8DGZeQmZXOJlLrwaCJ2UHiIQZCANWgXMBjjQgpaequ1gRZ8BekEu7Sn7hJccm9YMQ==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/umy-ui/-/umy-ui-1.1.6.tgz}
peerDependencies:
vue: '>= 2.6.0 < 3'
xe-utils: '>= 3'
dependencies:
async-validator: 1.8.5
deepmerge: 1.5.2
normalize-wheel: 1.0.1
resize-observer-polyfill: 1.5.1
throttle-debounce: 1.1.0
umy-table: 1.1.8_vue@2.7.15+xe-utils@3.5.14
vue: 2.7.15
vuedraggable: 2.24.3
xe-utils: 3.5.14
dev: false
/vk-unicloud-admin-ui/1.17.52:
resolution: {integrity: sha512-nNzN5EOFDYIp2TF6dQT7kcfxEVZJzBeRR8FuLLyeKkoHnglOa5pKjgAdWf1/RzgxZfv3Aje9sV1zvNH33Jt8ww==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/vk-unicloud-admin-ui/-/vk-unicloud-admin-ui-1.17.52.tgz}
dev: false
/vue-tianditu/1.2.11:
resolution: {integrity: sha512-yE80uENFI3be2Fh9gIjQ7R+H5y0fl7sNw8+MhkUpB7VDEnwiT4som93n+1kroMs9fNwMiSVXAMeBsJ+YrmGjIg==}
dependencies:
async-validator: 1.11.5
core-js: 3.37.0
element-ui: 2.15.13_vue@2.7.15
vue: 2.7.15
dev: false
/vue/2.7.15:
resolution: {integrity: sha512-a29fsXd2G0KMRqIFTpRgpSbWaNBK3lpCTOLuGLEDnlHWdjB8fwl6zyYZ8xCrqkJdatwZb4mGHiEfJjnw0Q6AwQ==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/vue/-/vue-2.7.15.tgz}
dependencies:
'@vue/compiler-sfc': 2.7.15
csstype: 3.1.2
dev: false
/vuedraggable/2.24.3:
resolution: {integrity: sha512-6/HDXi92GzB+Hcs9fC6PAAozK1RLt1ewPTLjK0anTYguXLAeySDmcnqE8IC0xa7shvSzRjQXq3/+dsZ7ETGF3g==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/vuedraggable/-/vuedraggable-2.24.3.tgz}
dependencies:
sortablejs: 1.10.2
dev: false
/xe-utils/3.5.14:
resolution: {integrity: sha512-Xq6mS8dWwHBQsQUEBXcZYSaBV0KnNLoVWd0vRRDI3nKpbNxfs/LSCK0W21g1edLFnXYfKqg7hh5dakr3RtYY0A==, registry: https://registry.npm.taobao.org/, tarball: https://registry.npm.taobao.org/xe-utils/-/xe-utils-3.5.14.tgz}
dev: false
File diff suppressed because one or more lines are too long
+22
View File
@@ -54,6 +54,28 @@
"hidden_tab": true
}
]
},
{
"menu_id": "jjx-finance",
"name": "资金管理",
"icon": "el-icon-wallet",
"children": [{
"menu_id": "jjx-finance-balance",
"name": "资金明细",
"url": "/pages/finance/balance/list"
}
]
},
{
"menu_id": "jjx-notary",
"name": "公证管理",
"icon": "el-icon-document",
"children": [{
"menu_id": "jjx-notary-union-pay",
"name": "银联资料审核",
"url": "/pages/notary-union-pay/list"
}
]
}
]
}]
+3 -2
View File
@@ -20,8 +20,9 @@
<link rel="stylesheet" href="<%= BASE_URL %>static/plugs/element/index.css"/>
<!-- 手动引入quill相关的文件-->
<link rel="stylesheet" href="<%= BASE_URL %>static/plugs/quill/index.css"/>
<script async src="<%= BASE_URL %>static/plugs/quill/quill.min.js"></script>
<script async src="<%= BASE_URL %>static/plugs/quill/image-resize.min.js"></script>
<script src="<%= BASE_URL %>static/plugs/quill/highlight.min.js"></script>
<script src="<%= BASE_URL %>static/plugs/quill/quill.min.js"></script>
<script src="<%= BASE_URL %>static/plugs/quill/image-resize.min.js"></script>
</head>
<body>
@@ -0,0 +1,35 @@
'use strict';
module.exports = {
/**
* 查询余额明细
* @url admin/finance/balance/sys/getFlow 前端调用的url参数地址
* data 请求参数
* @param {String} accNo 账号
* @param {String} transDate 交易日期,格式:yyyy-MM-dd
*/
main: async (event) => {
let { data = {}, util } = event;
let { vk } = util;
let { accNo, transDate } = data;
if (!accNo) return { code: -1, msg: "accNo不能为空" };
if (!transDate) return { code: -1, msg: "transDate不能为空" };
let res = { code: 0, msg: "" };
let requestRes = await vk.request({
url: "http://jjx-union-pay.gxwebsoft.com/api/union-pay-jjx/getFlow",
method: "POST",
dataType: "json",
header: {
"content-type": "application/json; charset=utf-8"
},
data: {
accNo,
transDate
}
});
res = requestRes;
if (res && typeof res === "object" && typeof res.code === "undefined") {
res.code = 0;
}
return res;
}
}
@@ -0,0 +1,33 @@
'use strict';
module.exports = {
/**
* 查询余额
* @url admin/finance/balance/sys/getInfo 前端调用的url参数地址
* data 请求参数
* @param {String} accNo 账号
*/
main: async (event) => {
let { data = {}, userInfo, util, originalParam } = event;
let { config, vk } = util;
let { accNo } = data;
if (!accNo) return { code: -1, msg: "accNo不能为空" };
let res = { code: 0, msg: "" };
// 业务逻辑开始-----------------------------------------------------------
let requestRes = await vk.request({
url: "http://jjx-union-pay.gxwebsoft.com/api/union-pay-jjx/getInfo",
method: "POST",
dataType: "json",
header: {
"content-type": "application/json; charset=utf-8"
},
data: {
accNo
}
});
res = requestRes;
if (res && typeof res === "object" && typeof res.code === "undefined") {
res.code = 0;
}
return res;
}
}

Some files were not shown because too many files have changed in this diff Show More