123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211 |
- <template>
- <div class="createPost-container">
- <el-form ref="postForm" :label-position="labelPosition" :model="postForm" :rules="rules" class="form-container" label-width="200px">
- <div class="createPost-main-container">
- <el-form-item prop="old_partner" label="老店合同人姓名">
- <el-input v-model="postForm.old_partner" placeholder="" style="width: 300px;" />
- </el-form-item>
- <el-form-item prop="mobile" label="手机号">
- <el-input v-model="postForm.mobile" placeholder="" style="width: 300px;" />
- </el-form-item>
- <el-form-item prop="old_store_name" label="老店店名">
- <el-input v-model="postForm.old_store_name" placeholder="" style="width: 300px;" />
- </el-form-item>
- <el-form-item prop="store_name" label="店号">
- <el-input v-model="postForm.store_name" placeholder="" style="width: 300px;" />
- </el-form-item>
- <el-form-item prop="store_num" label="申请第几家店">
- <el-input v-model="postForm.store_num" placeholder="" style="width: 600px;" />
- </el-form-item>
- <el-form-item prop="address" label="意向开店位置">
- <el-input v-model="postForm.address" placeholder="" style="width: 300px;" />
- </el-form-item>
- <el-form-item prop="staff_num" label="分店有几位员工">
- <el-input v-model="postForm.staff_num" placeholder="" style="width: 300px;" />
- </el-form-item>
- <el-form-item prop="manager" label="分店管理者">
- <el-input v-model="postForm.manager" placeholder="" style="width: 300px;" />
- </el-form-item>
- <el-form-item prop="old_order_rate" label="老店小程序点单占比">
- <el-input v-model="postForm.old_order_rate" placeholder="" style="width: 300px;" />
- </el-form-item>
- <el-form-item prop="old_profit" label="老店月净利润">
- <el-input v-model="postForm.old_profit" placeholder="" style="width: 300px;" />
- </el-form-item>
- <el-form-item prop="old_take_out" label="老店外卖评分">
- <el-input v-model="postForm.old_take_out" placeholder="" style="width: 300px;" />
- </el-form-item>
- <el-row>
- <el-button v-if="!isEdit" v-loading="loading" type="success" @click="submitForm">
- 查看
- </el-button>
- <el-button v-if="isEdit" v-loading="loading" type="success" @click="updateArticle">
- 返回
- </el-button>
- </el-row>
- </div>
- </el-form>
- </div>
- </template>
- <script>
- // import Upload from '@/components/Upload/SingleImage3'
- // import Sticky from '@/components/Sticky' // 粘性header组件
- // import { validURL } from '@/utils/validate'
- import { fetchBranchJoin } from '@/api/branchJoin'
- // import Warning from './Warning'
- // import { CommentDropdown, PlatformDropdown, SourceUrlDropdown } from './Dropdown'
- const defaultForm = {
- // status: 'draft',
- redirect: '', // 文章题目
- status: true, // 文章内容
- position: 1, // 文章摘要
- url: '', // 文章外链
- cover_img: '', // 文章图片
- display_time: undefined, // 前台展示时间
- id: undefined,
- platforms: ['a-platform'],
- comment_disabled: false,
- importance: 0
- }
- export default {
- name: 'ArticleDetail',
- components: { },
- props: {
- isEdit: {
- type: Boolean,
- default: false
- }
- },
- data() {
- return {
- postForm: Object.assign({}, defaultForm),
- loading: false,
- userListOptions: [],
- rules: {
- },
- tempRoute: {},
- labelPosition: 'left'
- }
- },
- computed: {
- },
- created() {
- if (this.isEdit) {
- const id = this.$route.params && this.$route.params.id
- this.fetchData(id)
- }
- // Why need to make a copy of this.$route here?
- // Because if you enter this page and quickly switch tag, may be in the execution of the setTagsViewTitle function, this.$route is no longer pointing to the current page
- // https://github.com/PanJiaChen/vue-element-admin/issues/1221
- this.tempRoute = Object.assign({}, this.$route)
- },
- methods: {
- fetchData(id) {
- fetchBranchJoin(id).then(response => {
- this.postForm = response.data.info
- // set tags view title
- // this.setTagsViewTitle()
- // set page title
- // this.setPageTitle()
- }).catch(err => {
- console.log(err)
- })
- },
- setPageTitle() {
- const title = 'Edit Article'
- document.title = `${title} - ${this.postForm.id}`
- },
- submitForm() {
- this.$refs.postForm.validate(valid => {
- if (valid) {
- this.loading = true
- } else {
- console.log('error submit!!')
- return false
- }
- })
- },
- updateArticle() {
- console.log(this.postForm)
- this.$router.push(`/branchJoin/list`)
- },
- draftForm() {
- if (this.postForm.content.length === 0 || this.postForm.title.length === 0) {
- this.$message({
- message: '请填写必要的标题和内容',
- type: 'warning'
- })
- return
- }
- this.$message({
- message: '保存成功',
- type: 'success',
- showClose: true,
- duration: 1000
- })
- this.postForm.status = 'draft'
- },
- formatCreatePosition(position) {
- switch (position) {
- case 1:
- return 'HOME'
- case 2:
- return 'ACTIVITY'
- }
- },
- editPosition(position) {
- switch (position) {
- case 'HOME':
- return 1
- case 'ACTIVITY':
- return 2
- }
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- @import "~@/styles/mixin.scss";
- .createPost-container {
- position: relative;
- .createPost-main-container {
- padding: 40px 45px 20px 50px;
- .postInfo-container {
- position: relative;
- @include clearfix;
- margin-bottom: 10px;
- .postInfo-container-item {
- float: left;
- }
- }
- }
- .word-counter {
- width: 40px;
- position: absolute;
- right: 10px;
- top: 0px;
- }
- }
- .article-textarea ::v-deep {
- textarea {
- padding-right: 40px;
- resize: none;
- border: none;
- border-radius: 0px;
- border-bottom: 1px solid #bfcbd9;
- }
- }
- </style>
|