|
@@ -0,0 +1,57 @@
|
|
|
+<template>
|
|
|
+ <div id="index">
|
|
|
+ <data-form :span="12" :fields="fields" :rules="rules" v-model="form" labelWidth="150px" @save="toSave"> </data-form>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
+const { mapActions: config } = createNamespacedHelpers('config');
|
|
|
+export default {
|
|
|
+ name: 'index',
|
|
|
+ props: {},
|
|
|
+ components: {},
|
|
|
+ data: function () {
|
|
|
+ return {
|
|
|
+ fields: [
|
|
|
+ { label: '系统名称', model: 'title' },
|
|
|
+ { label: 'logo', model: 'logo', type: 'upload', limit: 1, url: '/files/point/config/upload' },
|
|
|
+ { label: '购物赠送积分', model: 'buyPoint', type: 'number' },
|
|
|
+ { label: '积分计划', model: 'pointPlan' },
|
|
|
+ { label: '分享图片', model: 'share', type: 'upload', limit: 1, url: '/files/point/config/upload' },
|
|
|
+ ],
|
|
|
+ rules: {},
|
|
|
+ form: {},
|
|
|
+ };
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ...mapState(['user']),
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.search();
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ ...config(['query', 'fetch', 'update']),
|
|
|
+ //执行查询
|
|
|
+ async search() {
|
|
|
+ const res = await this.fetch();
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ console.log(res.data);
|
|
|
+ // this.$set(this, `form`, res.data);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async toSave({ data }) {
|
|
|
+ let config = { logo: data.logo, buyPoint: data.buyPoint, pointPlan: data.pointPlan, share: data.share };
|
|
|
+ data.config = config;
|
|
|
+ console.log(data);
|
|
|
+ const res = await this.update(data);
|
|
|
+ this.$checkRes(res, '操作成功', '操作失败');
|
|
|
+ },
|
|
|
+ },
|
|
|
+ metaInfo() {
|
|
|
+ return { title: this.$route.meta.title };
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="less" scoped></style>
|