Kaynağa Gözat

代码提交

user5 1 yıl önce
ebeveyn
işleme
b4444cb26c

+ 64 - 0
src/api/wdt/merchantDetails/MerchantDetailsService.js

@@ -0,0 +1,64 @@
+import request from "@/utils/httpRequest";
+
+export default {
+	list: function (params) {
+		return request({
+			url: "/wdt/merchantDetails/list",
+			method: "get",
+			params: params,
+		});
+	},
+	getLimit1: function () {
+		return request({
+			url: "/wdt/merchantDetails/getLimit1",
+			method: "get",
+		});
+	},
+	save: function (inputForm) {
+		return request({
+			url: "/wdt/merchantDetails/save",
+			method: "post",
+			data: inputForm,
+		});
+	},
+	saveDataSources: function (dataSources) {
+		console.log(dataSources);
+		return request({
+			url: "/wdt/merchantDetails/saveDataSources",
+			method: "post",
+			params: { dataSources: dataSources },
+		});
+	},
+	delete: function (ids) {
+		return request({
+			url: "/wdt/merchantDetails/delete",
+			method: "delete",
+			params: { ids: ids },
+		});
+	},
+
+	exportTemplate: function () {
+		return request({
+			url: "/wdt/merchantDetails/import/template",
+			method: "get",
+			responseType: "blob",
+		});
+	},
+
+	exportExcel: function (params) {
+		return request({
+			url: "/wdt/merchantCompany/export",
+			method: "get",
+			params: params,
+			responseType: "blob",
+		});
+	},
+
+	importExcel: function (data) {
+		return request({
+			url: "/wdt/merchantCompany/import",
+			method: "post",
+			data: data,
+		});
+	},
+};

+ 246 - 0
src/views/wdt/merchantDetails/MerchantDetailsInfo.vue

@@ -0,0 +1,246 @@
+<template>
+	<el-container class="userInfo">
+
+		<el-main style="padding: 0">
+			<el-card shadow="never" body-style="height:600px">
+				<template #header>
+					<div class="card-header">
+						<span>
+							<label class="person-text">入驻详情数据来源:</label>
+
+							<el-switch
+								v-model="isShow"
+								@click="statusChange"
+								active-value="1"
+								inactive-value="0"
+								active-text="商户汇总"
+								inactive-text="入驻详情">
+					</el-switch>
+						</span>
+					</div>
+				</template>
+				<el-tabs tab-position="top">
+					<el-tab-pane label="基本信息">
+						<el-form
+							:model="generalForm"
+							ref="generalForm"
+							label-width="150px"
+						>
+							<el-form-item label="入驻企业数" prop="settledEnterpriseNumber"
+							>
+								<el-input onkeyup="value=value.replace(/[^\d]/g,0)" v-model="generalForm.settledEnterpriseNumber"></el-input>
+							</el-form-item>
+							<el-form-item label="电商从业人数"  prop="practitionerCount">
+								<el-input onkeyup="value=value.replace(/[^\d]/g,0)"
+										  v-model="generalForm.practitionerCount"></el-input>
+							</el-form-item>
+							<el-form-item label="年交易额(元)" prop="annualSales">
+								<el-input v-on:input="generalForm.annualSales=generalForm.annualSales.replace(/[^-0-9.]/g,'')
+												.replace(/^\./g,'')
+												.replace(/\.{2,}/g,'.')
+												.replace('.','$#$').replace(/\./g,'').replace('$#$','.')
+												.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
+									v-model="generalForm.annualSales"
+								></el-input>
+							</el-form-item>
+							<el-form-item label="网络零售额(元)" prop="onlineRetailSales">
+								<el-input v-on:input="generalForm.onlineRetailSales=generalForm.onlineRetailSales.replace(/[^-0-9.]/g,'')
+												.replace(/^\./g,'')
+												.replace(/\.{2,}/g,'.')
+												.replace('.','$#$').replace(/\./g,'').replace('$#$','.')
+												.replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3')"
+									v-model="generalForm.onlineRetailSales"
+								></el-input>
+							</el-form-item>
+							<el-form-item label="抖音入驻(家)" prop="enterNumber">
+								<el-input onkeyup="value=value.replace(/[^\d]/g,0)"
+										  v-model="generalForm.enterNumber"
+								></el-input>
+							</el-form-item>
+							<el-form-item>
+								<el-button
+									el-button
+									type="primary"
+									@click="submitGeneralForm()"
+								>保存</el-button
+								>
+							</el-form-item>
+						</el-form>
+					</el-tab-pane>
+
+
+				</el-tabs>
+			</el-card>
+		</el-main>
+	</el-container>
+</template>
+
+<script>
+	import colorTool from "@/utils/color";
+	import merchantDetailsService from "@/api/wdt/merchantDetails/MerchantDetailsService";
+	export default {
+		data() {
+			var validatePass2 = (rule, value, callback) => {
+				if (value !== this.pwdForm.newPassword) {
+					callback(new Error("两次输入密码不一致!"));
+				} else {
+					callback();
+				}
+			};
+			return {
+				isShow: false,
+				type: "1",
+				colorList: [
+					"#409EFF",
+					"#009688",
+					"#536dfe",
+					"#ff5c93",
+					"#c62f2f",
+					"#fd726d",
+				],
+				config: {
+					lang: this.$TOOL.data.get("APP_LANG") || this.$CONFIG.LANG,
+					theme: this.$TOOL.data.get("APP_THEME") || "default",
+					colorPrimary:
+						this.$TOOL.data.get("APP_COLOR") ||
+						this.$CONFIG.COLOR ||
+						"#409EFF",
+				},
+				userInfo: {},
+				generalForm: {
+					id: "",
+					settledEnterpriseNumber: "",
+					practitionerCount: "",
+					annualSales: "",
+					onlineRetailSales: "",
+					enterNumber: "",
+				},
+				tablePage: {
+					total: 0,
+					currentPage: 1,
+					pageSize: 10,
+					orders: [{ column: "a.create_time", asc: false }],
+				},
+				loading: false,
+				rule: [
+					{ required: true, message: "必填项不能为空", trigger: "blur" },
+					{ validator: validatePass2, trigger: "blur" },
+				],
+			};
+		},
+		created() {
+			this.userInfo = this.$TOOL.data.get("USER_INFO");
+			merchantDetailsService.getLimit1().then((data) => {
+				if(data.dataSourcesType){
+					this.isShow = data.dataSourcesType
+				}else{
+					this.isShow = false
+				}
+				this.recover(this.generalForm, data);
+			});
+			this.refreshList();
+		},
+		watch: {
+			"config.theme"(val) {
+				document.body.setAttribute("data-theme", val);
+				this.$TOOL.data.set("APP_THEME", val);
+			},
+			"config.lang"(val) {
+				this.$i18n.locale = val;
+				this.$TOOL.data.set("APP_LANG", val);
+			},
+			"config.colorPrimary"(val) {
+				colorTool.setAppColors(val);
+				this.$TOOL.data.set("APP_COLOR", val);
+			},
+		},
+		methods: {
+			async submitGeneralForm() {
+				let valid = await this.$refs["generalForm"].validate();
+				if (valid) {
+					const loading = this.$loading();
+					let data = await merchantDetailsService.save(this.generalForm);
+					loading.close();
+					this.$message.success(data);
+				}
+			},
+			// 获取数据列表
+			refreshList() {
+				this.loading = true;
+			},
+			changeLog(index) {
+				this.type = index;
+				this.refreshList();
+			},
+			// 当前页
+			currentChangeHandle({ currentPage, pageSize }) {
+				this.tablePage.currentPage = currentPage;
+				this.tablePage.pageSize = pageSize;
+				this.refreshList();
+			},
+			// 排序
+			sortChangeHandle(obj) {
+				this.tablePage.orders = [];
+				if (obj.order != null) {
+					this.tablePage.orders.push({
+						column:
+							obj.column.sortBy || this.$utils.toLine(obj.property),
+						asc: obj.order === "asc",
+					});
+				} else {
+					this.tablePage.orders = [
+						{ column: "a.create_time", asc: false },
+					];
+				}
+				this.refreshList();
+			},
+			// 是否显示
+			statusChange () {
+				this.loading = true
+				merchantDetailsService.saveDataSources(this.isShow).then((data) => {
+					this.$message({
+						message: data,
+						type: 'success',
+						duration: 1500
+					})
+					this.loading = false
+					this.refreshList()
+				})
+			},
+		},
+	};
+</script>
+
+<style lang="less">
+	.userInfo {
+		padding: 8px 12px;
+		.aside {
+			width: 500px;
+			margin-right: 20px;
+		}
+		.el-card__header {
+			padding: calc(var(--el-card-padding) - 2px) var(--el-card-padding);
+			border-bottom: 1px solid var(--el-card-border-color);
+			box-sizing: border-box;
+		}
+		.person-bg {
+			color: rgb(24, 144, 255);
+			background-color: rgb(230, 247, 255);
+			width: 24px;
+			height: 24px;
+			border-radius: 50%;
+			text-align: center;
+			vertical-align: middle;
+			display: inline-block;
+		}
+		.person-text {
+			font-size: 15px;
+			margin-left: 5px;
+			font-weight: 400;
+		}
+	}
+
+	.adminui-topbar + .userInfo {
+		padding: 12px 12px 8px 12px;
+	}
+</style>

+ 124 - 0
src/views/wdt/merchantDetails/SettledPlatformForm.vue

@@ -0,0 +1,124 @@
+<template>
+  <div>
+    <el-dialog
+      :title="title"
+      :close-on-click-modal="false"
+	  draggable
+      @close="close"
+      @keyup.enter.native="doSubmit"
+      v-model="visible">
+      <el-form :model="inputForm" ref="inputForm" v-loading="loading" :class="method==='view'?'readonly':''"  :disabled="method==='view'"
+               label-width="120px" @submit.native.prevent>
+        <el-row  :gutter="15">
+          <el-col :span="12">
+            <el-form-item label="入驻平台名称" prop="name"
+                          :rules="[
+                          {required: true, message:'入驻平台名称不能为空', trigger:'blur'}
+                 ]">
+              <el-input v-model="inputForm.name" placeholder="请填写入驻平台名称"></el-input>
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="排序" prop="sort"
+                          :rules="[
+                          {required: true, message:'排序不能为空', trigger:'blur'}
+                 ]">
+              <el-input-number v-model="inputForm.sort"
+							   style="width:100%;"
+							   :min="0"
+							   placeholder="请填写排序"
+			  ></el-input-number>
+            </el-form-item>
+          </el-col>
+          <el-col :span="24">
+            <el-form-item label="备注" prop="remarks"
+                          :rules="[
+                 ]">
+              <el-input type="textarea" maxlength="255" v-model="inputForm.remarks" placeholder="请填写备注"  show-word-limit   ></el-input>
+            </el-form-item>
+          </el-col>
+        </el-row>
+      </el-form>
+		<template #footer>
+			<span class="dialog-footer">
+			  <el-button @click="close()" icon="el-icon-circle-close">关闭</el-button>
+			  <el-button type="primary" v-if="method != 'view'" @click="doSubmit()" icon="el-icon-circle-check" v-noMoreClick>确定</el-button>
+			</span>
+		</template>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+  import settledPlatformService from '@/api/wdt/settledPlatform/SettledPlatformService'
+  export default {
+    data () {
+      return {
+        title: '',
+        method: '',
+        visible: false,
+        loading: false,
+        inputForm: {
+			name: '',
+			sort: 0,
+         	remarks: '',
+        }
+      }
+    },
+    created () {
+    },
+    methods: {
+      init (method, id) {
+        this.method = method
+        this.inputForm = {
+          name: '',
+          sort: '',
+          remarks: '',
+          parentId: ''
+        }
+        if (method === 'add') {
+          this.title = `新增入驻平台信息`
+        } else if (method === 'edit') {
+          this.inputForm.id = id
+          this.title = '修改入驻平台信息'
+        } else if (method === 'view') {
+          this.inputForm.id = id
+          this.title = '查看入驻平台信息'
+        }
+        this.visible = true
+        this.loading = false
+        this.$nextTick(() => {
+          this.$refs.inputForm.resetFields()
+          if (method === 'edit' || method === 'view') { // 修改或者查看
+            this.loading = true
+			  settledPlatformService.queryById(this.inputForm.id).then((data) => {
+              this.inputForm = this.recover(this.inputForm, data)
+              this.inputForm = JSON.parse(JSON.stringify(this.inputForm))
+              this.loading = false
+            })
+          }
+        })
+      },
+      // 表单提交
+      doSubmit () {
+        this.$refs['inputForm'].validate((valid) => {
+          if (valid) {
+            this.loading = true
+			  settledPlatformService.save(this.inputForm).then((data) => {
+              this.close()
+              this.$message.success(data)
+              this.$emit('refreshDataList')
+              this.loading = false
+            }).catch(() => {
+              this.loading = false
+            })
+          }
+        })
+      },
+      close () {
+        this.$refs.inputForm.resetFields()
+        this.visible = false
+      }
+    }
+  }
+</script>

+ 243 - 0
src/views/wdt/merchantDetails/SettledPlatformList.vue

@@ -0,0 +1,243 @@
+<template>
+	<div class="page">
+		<el-form :inline="true" class="query-form m-b-10" v-if="searchVisible" ref="searchForm" :model="searchForm" @keyup.enter.native="refreshList()" @submit.native.prevent>
+			<!-- 搜索框-->
+			<el-form-item label="入驻平台名称" prop="name">
+				<el-input v-model="searchForm.name" placeholder="请输入入驻平台名称" clearable></el-input>
+			</el-form-item>
+			<el-form-item label="创建时间" prop="dates">
+				<el-date-picker
+					style=""
+					placement="bottom-start"
+					value-format="YYYY-MM-DD HH:mm:ss"
+					v-model="searchForm.dates"
+					type="datetimerange"
+					range-separator="至"
+					start-placeholder="开始日期"
+					end-placeholder="结束日期">
+				</el-date-picker>
+			</el-form-item>
+
+			<el-form-item>
+				<el-button type="primary" @click="refreshList()" icon="el-icon-search">查询</el-button>
+				<el-button @click="resetSearch()" icon="el-icon-refresh-right">重置</el-button>
+			</el-form-item>
+		</el-form>
+
+		<div class="jp-table top" style="">
+			<vxe-toolbar :refresh="{query: refreshList}" ref="toolbarRef" custom>
+				<template #buttons>
+					<el-button v-if="hasPermission('wdt:settledPlatform:add')" type="primary" icon="el-icon-plus" @click="add()">新建</el-button>
+					<el-button v-if="hasPermission('wdt:settledPlatform:del')" type="danger"  icon="el-icon-delete" @click="del()" :disabled="$refs.infoTable && $refs.infoTable.getCheckboxRecords().length === 0" plain>删除</el-button>
+				</template>
+			</vxe-toolbar>
+			<div style="height: calc(100% - 80px)">
+				<vxe-table
+					border="inner"
+					auto-resize
+					resizable
+					height="auto"
+					:loading="loading"
+					ref="infoTable"
+					show-header-overflow
+					show-overflow
+					highlight-hover-row
+					:menu-config="{}"
+					:sort-config="{remote:true}"
+					:export-config="{
+                    remote: true,
+                    filename: `入驻平台数据${moment(new Date()).format('YYYY-MM-DD')}`,
+                    sheetName: `入驻平台数据${moment(new Date()).format('YYYY-MM-DD')}`,
+                    exportMethod: exportMethod,
+                    types: ['xlsx'],
+                    modes: ['current', 'selected', 'all']
+                  }"
+					:data="dataList"
+					:checkbox-config="{}">
+					<vxe-column type="seq" width="60" title="序号"></vxe-column>
+					<vxe-column type="checkbox" width="60" ></vxe-column>
+					<vxe-column min-width="130" title="入驻平台名称" field="name" align="center">
+						<template #default="scope">
+							<el-link  type="primary" :underline="false" v-if="hasPermission('wdt:settledPlatform:view')" @click="view(scope.row.id)">{{scope.row.name}}</el-link>
+							<span v-else>{{scope.row.no}}</span>
+						</template>
+					</vxe-column>
+					<vxe-column width="120" title="排序" field="sort" align="center"></vxe-column>
+					<vxe-column width="180" title="创建时间" field="createTime" align="center"></vxe-column>
+
+					<vxe-column title="操作" width="130px" fixed="right" align="center">
+						<template  #default="scope">
+							<el-button v-if="hasPermission('wdt:settledPlatform:edit')" text type="primary" @click="edit(scope.row)">修改</el-button>
+							<el-button v-if="hasPermission('wdt:settledPlatform:del')" text type="primary"  @click="del(scope.row.id)">删除</el-button>
+						</template>
+					</vxe-column>
+				</vxe-table>
+				<vxe-pager
+					background
+					:current-page="tablePage.currentPage"
+					:page-size="tablePage.pageSize"
+					:total="tablePage.total"
+					:page-sizes="[10, 20, 100, 1000, {label: '全量数据', value: 1000000}]"
+					:layouts="['PrevPage', 'JumpNumber', 'NextPage', 'FullJump', 'Sizes', 'Total']"
+					@page-change="currentChangeHandle">
+				</vxe-pager>
+
+				<SettledPlatformForm  ref="settledPlatformForm" @refreshDataList="refreshList"></SettledPlatformForm>
+			</div>
+		</div>
+	</div>
+</template>
+
+<script>
+	import settledPlatformService from '@/api/wdt/settledPlatform/SettledPlatformService'
+	import SettledPlatformForm from './SettledPlatformForm'
+	export default {
+		data () {
+			return {
+				searchVisible: true,
+				num: 0,
+				visable: false,
+				gridData: [],
+				searchForm: {
+					name: '',
+					dates: [],
+					type: [],
+				},
+				dataList: [],
+				tablePage: {
+					total: 0,
+					currentPage: 1,
+					pageSize: 10,
+					orders: []
+				},
+				loading: false,
+				isAdmin: false
+			}
+		},
+		created () {
+		},
+		components: {
+			SettledPlatformForm
+		},
+		mounted () {
+			this.$nextTick(() => {
+				//将表格和工具栏进行关联
+				const $table = this.$refs.infoTable;
+				const $toolbar = this.$refs.toolbarRef;
+				$table.connect($toolbar);
+			})
+			this.refreshList()
+		},
+		activated () {
+			this.refreshList()
+		},
+		computed: {
+			userName () {
+				return this.$store.state.user.name
+			},
+			user () {
+				this.create = this.$store.state.user.id
+				console.log('createId', this.create)
+				return this.$store.state.user
+			}
+		},
+		methods: {
+			// 新增
+			add () {
+				this.$refs.settledPlatformForm.init('add', '')
+			},
+
+			// 查看
+			view (id) {
+				this.$refs.settledPlatformForm.init('view', id)
+			},
+			edit (row) {
+				this.$refs.settledPlatformForm.init('edit', row.id)
+			},
+			// 获取数据列表
+			refreshList () {
+				this.loading = true
+				settledPlatformService.list({
+					'current': this.tablePage.currentPage,
+					'size': this.tablePage.pageSize,
+					'orders': this.tablePage.orders,
+					...this.searchForm
+				}).then((data) => {
+					this.dataList = data.records
+					this.tablePage.total = data.total
+					this.loading = false
+				})
+			},
+			// 删除
+			del (id) {
+				let ids = id || this.$refs.infoTable.getCheckboxRecords().map(item => {
+					return item.id
+				}).join(',')
+				this.$confirm(`确定删除所选项吗?`, '提示', {
+					confirmButtonText: '确定',
+					cancelButtonText: '取消',
+					type: 'warning'
+				}).then(() => {
+					this.loading = true
+					settledPlatformService.remove(ids).then((data) => {
+						this.$message.success(data)
+						this.refreshList()
+						this.loading = false
+					})
+				})
+			},
+			resetSearch () {
+				this.$refs.searchForm.resetFields()
+				this.refreshList()
+			},
+			// 下载文档
+			exportFile () {
+				this.loading = true
+				settledPlatformService.exportFile({
+					'itemType': '1',
+					...this.searchForm
+				}).then((res) => {
+					// 将二进制流文件写入excel表,以下为重要步骤
+					this.$utils.downloadExcel(res, '入驻商家信息表')
+					this.loading = false
+				}).catch(function (err) {
+					this.loading = false
+					if (err.response) {
+						console.log(err.response)
+					}
+				})
+			},
+			// 当前页
+			currentChangeHandle ({ currentPage, pageSize }) {
+				this.tablePage.currentPage = currentPage
+				this.tablePage.pageSize = pageSize
+				this.refreshList()
+			},
+			// 自定义服务端导出
+			exportMethod ({ options }) {
+				// 传给服务端的参数
+				const params = {
+					'current': this.tablePage.currentPage,
+					'size': this.tablePage.pageSize,
+					'orders': this.tablePage.orders,
+					...this.searchForm,
+					filename: options.filename,
+					sheetName: options.sheetName,
+					isHeader: options.isHeader,
+					original: options.original,
+					mode: options.mode,
+					selectIds: options.mode === 'selected' ? options.map(item => item.id) : [],
+					exportFields: options.columns.map(column => column.property)
+				}
+				return settledPlatformService.exportFile(params).then((res) => {
+					// 将二进制流文件写入excel表,以下为重要步骤
+					this.$utils.downloadExcel(res, options.filename)
+				}).catch(function (err) {
+					if (err.response) {
+						console.log(err.response)
+					}
+				})
+			},
+		}
+	}
+</script>