chenrui пре 1 година
родитељ
комит
5b819cd1b0

+ 1 - 1
src/config/router.config.js

@@ -3442,7 +3442,7 @@ export const asyncRouterMap = [
                 }
               },
               {
-                path: 'edit/:sn',
+                path: 'edit/:sn/:pageType',
                 name: 'promotionManagementEdit',
                 component: () => import(/* webpackChunkName: "promotionRulesManagement" */ '@/views/promotionRulesManagement/promotionManagement/edit.vue'),
                 meta: {

+ 69 - 94
src/views/promotionRulesManagement/promotionManagement/edit.vue

@@ -45,17 +45,7 @@
             <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
               <a-form-model-item label="封面图片" prop="imageSet" :label-col="{span:2}" :wrapper-col="{span:20}">
                 <Upload
-                  v-if="pageType==='add'"
-                  class="upload"
-                  id="promotionEdit-imageSet"
-                  v-model="form.imageSet"
-                  ref="imageSet"
-                  :fileSize="10"
-                  :maxNums="10"
-                  @change="changeImage"
-                  listType="picture-card"></Upload>
-                <Upload
-                  v-else-if="pageType==='edit'&&!isDisabled"
+                  v-if="pageType==='add'||(pageType==='edit'&&!isDisabled)"
                   class="upload"
                   id="promotionEdit-imageSet"
                   v-model="form.imageSet"
@@ -92,24 +82,17 @@
             <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
               <a-form-model-item label="内容" prop="content" v-show="form.contentType =='IMAGE_CONTENT'" :label-col="{span:2}" :wrapper-col="{span:20}">
                 <editor
-                  v-if="pageType === 'add'"
+                  v-show="pageType === 'add'||(pageType === 'edit'&&!isDisabled)"
                   id="promotionEdit-editor"
                   ref="editor"
                   class="promotionEdit-editor"
                   @on-change="editorChange"
                   :cache="false"></editor>
-                <editor
-                  v-if="pageType === 'edit'&&!isDisabled"
-                  id="promotionEdit-editor"
-                  ref="editor"
-                  class="promotionEdit-editor"
-                  @on-change="editorChange"
-                  :cache="false"></editor>
-                <div v-show="pageType === 'edit'&&isDisabled" class="box" v-html="form.content"></div>
+                <div v-show="(pageType === 'edit'||pageType === 'see')&&isDisabled" class="box" v-html="form.content"></div>
               </a-form-model-item>
-              <a-form-model-item label="上传视频" prop="content" v-show="form.contentType =='VIDEO'" :label-col="{span:3}" :wrapper-col="{span:18}">
+              <a-form-model-item label="上传视频" prop="content" v-show="form.contentType =='VIDEO'" :label-col="{span:2}" :wrapper-col="{span:20}">
                 <Upload
-                  v-if="pageType==='add'"
+                  v-if="pageType==='add'||(pageType==='edit'&&!isDisabled)"
                   class="upload"
                   id="promotionEdit-imageSet"
                   v-model="form.content"
@@ -119,36 +102,35 @@
                   :maxNums="1"
                   @change="changeVideo"
                 ></Upload>
-                <Upload
-                  v-else-if="pageType==='edit'&&!isDisabled"
-                  class="upload"
-                  id="promotionEdit-imageSet"
-                  v-model="form.content"
-                  fileType="video/mp4"
-                  ref="videoSet"
-                  :fileSize="100"
-                  :maxNums="1"
-                  @change="changeVideo"
-                ></Upload>
-                <div v-if="pageType==='edit'&&isDisabled">
+                <div v-else>
                   <video width="230" height="150" controls loop controlsList="nodownload">
                     <source :src="form.content" type="video/mp4">
                   </video>
                 </div>
                 <span class="upload-desc">说明:文件最大100M;视频:mp4.avi.flv</span>
               </a-form-model-item>
-              <a-form-model-item label="跳转链接" prop="contentLink" v-if="form.contentType =='LINK'" :label-col="{span:3}" :wrapper-col="{span:18}">
+              <a-form-model-item label="跳转链接" prop="contentLink" v-if="form.contentType =='LINK'" :label-col="{span:2}" :wrapper-col="{span:20}">
                 <a-input
+                  style="width:50%;"
                   :disabled="isDisabled"
                   id="promotionEdit-title"
                   :maxLength="100"
                   v-model.trim="form.contentLink"
                   placeholder="请输入跳转链接"
                   allowClear />
+                <a-select id="promotionEdit-title" default-value="货架促销" style="width: 120px;margin-left:10px;" v-model="form.linkType">
+                  <a-select-option value="1">
+                    货架促销
+                  </a-select-option>
+                  <a-select-option value="2">
+                    其他
+                  </a-select-option>
+                </a-select>
               </a-form-model-item>
             </a-col>
           </a-row>
-          <a-row style="width:83%;margin:0 auto 24px;">
+          <!-- 参数配置 -->
+          <a-row style="width:83%;margin:0 auto 24px;" v-if="form.contentType =='LINK'">
             <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
               <a-checkbox @change="onChangeParams">参数配置</a-checkbox>
             </a-col>
@@ -166,7 +148,7 @@
           <a-row>
             <a-col :xs="24" :sm="24" :md="24" :lg="16" :xl="16">
               <a-form-model-item label="是否发布" prop="enabledFlag" :label-col="{span:3}" :wrapper-col="{span:18}">
-                <a-radio-group button-style="solid" v-model="form.enabledFlag">
+                <a-radio-group button-style="solid" v-model="form.enabledFlag" :disabled="pageType==='see'">
                   <a-radio-button value="1">
                   </a-radio-button>
@@ -227,25 +209,6 @@ export default {
   name: 'ProductBrandEditModal',
   mixins: [commonMixin],
   components: { VSelect, Upload, Editor, promotionShowModal, setPromotion, chooseProduct },
-  props: {
-    openModal: { //  弹框显示状态
-      type: Boolean,
-      default: false
-    },
-    itemId: {
-      type: [Number, String],
-      default: ''
-    },
-    pageType: {
-      type: String,
-      default: 'add'
-    }
-  },
-  computed: {
-    modalTit () {
-      return this.pageType != 'add' ? '发布修改' : '促销发布'
-    }
-  },
   data () {
     return {
       isShow: this.openModal, //  是否打开弹框
@@ -263,8 +226,10 @@ export default {
         content: '',
         enabledFlag: '0',
         sort: undefined,
-        contentLink: ''
+        contentLink: '',
+        linkType: '1'
       },
+      pageType: undefined, // 页面类型
       showProModal: false,
       images: [],
       isShowParams: false, // 是否显示参数配置内容
@@ -322,9 +287,14 @@ export default {
     },
     //  详情
     getDetail () {
-      promoTerminalDetail({ sn: this.itemId }).then(res => {
+      // 查看按钮时,所有按钮不能编辑    编辑按钮时,state 已发布,只能编辑是否发布;state已关闭,都可以编辑
+      promoTerminalDetail({ sn: this.$route.params.sn }).then(res => {
         if (res.status == 200) {
-          this.isDisabled = res.data.state === 'PUBLISH'
+          if (this.pageType === 'edit') {
+            this.isDisabled = res.data.state === 'PUBLISH'
+          } else {
+            this.isDisabled = true
+          }
           this.form.promoActiveSn = res.data.promoActiveSn
           this.form.title = res.data.title
           this.form.contentType = res.data.contentType
@@ -393,44 +363,49 @@ export default {
     //  文本编辑器
     editorChange (html, text) {
       this.form.content = html
-    }
-  },
-  watch: {
-    //  父页面传过来的弹框状态
-    openModal (newValue, oldValue) {
-      this.isShow = newValue
     },
-    //  重定义的弹框状态
-    isShow (newValue, oldValue) {
-      if (!newValue) {
-        this.$emit('close')
-        if (this.pageType == 'add' || (this.pageType == 'edit' && !this.isDisabled)) {
-          this.$refs.imageSet.setFileList('')
-          this.$refs.videoSet.setFileList('')
-        }
-        if (this.$refs.editor) {
-          this.$refs.editor.setHtml('')
-        }
-        this.form = {
-          promoActiveSn: undefined,
-          title: '',
-          contentType: 'IMAGE_CONTENT',
-          imageSet: '',
-          showFlag: '0',
-          content: '',
-          enabledFlag: '0',
-          sort: undefined
-        }
-        this.images = []
-        this.isDisabled = false
-        this.$refs.ruleForm.resetFields()
-        this.$refs.formBox.scrollTop = 0
-      } else {
-        if (this.pageType == 'edit') {
-          this.getDetail()
-        }
+    // 重置
+    resetSearchForm () {
+      if (this.pageType == 'add' || (this.pageType == 'edit' && !this.isDisabled)) {
+        this.$refs.imageSet.setFileList('')
+        this.$refs.videoSet.setFileList('')
+      }
+      if (this.$refs.editor) {
+        this.$refs.editor.setHtml('')
       }
+      this.form = {
+        promoActiveSn: undefined,
+        title: '',
+        contentType: 'IMAGE_CONTENT',
+        imageSet: '',
+        showFlag: '0',
+        content: '',
+        enabledFlag: '0',
+        sort: undefined
+      }
+      this.images = []
+      this.isDisabled = false
+      this.$refs.ruleForm.resetFields()
+      this.$refs.formBox.scrollTop = 0
+    }
+  },
+  mounted () {
+    this.pageType = this.$route.params.pageType
+    if (this.pageType == 'edit' || this.pageType == 'see') {
+      this.getDetail()
     }
+    this.resetSearchForm()
+  },
+  activated () {
+    this.pageType = this.$route.params.pageType
+    // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
+    if (this.pageType == 'edit' || this.pageType == 'see') {
+      this.getDetail()
+    }
+    this.resetSearchForm()
+  },
+  beforeRouteEnter (to, from, next) {
+    next(vm => {})
   }
 }
 </script>

+ 13 - 10
src/views/promotionRulesManagement/promotionManagement/list.vue

@@ -116,6 +116,7 @@
             <span v-else>--</span>
           </template>
           <!-- 操作 -->
+          <!-- state状态 END已结束    CLOSE已关闭    PUBLISH  已发布    UNPUBLISH  未发布 -->
           <template slot="action" slot-scope="text, record">
             <div>
               <a-button
@@ -124,7 +125,7 @@
                 class="button-warning"
                 @click="promotionEdit(record)"
                 v-if="(record.state=='UNPUBLISH' || record.state=='CLOSE') && $hasPermissions('B_promotionManagementAdd')"
-                id="promotion-edit-btn">促销编辑</a-button>
+                id="promotion-edit-btn">编辑</a-button>
               <a-button
                 size="small"
                 type="link"
@@ -132,13 +133,20 @@
                 @click="handleRelease(record,'edit')"
                 v-if="(record.state=='PUBLISH' || record.state=='CLOSE')&&$hasPermissions('B_promotionManagementContent')"
                 id="promotion-modify-btn">发布修改</a-button>
+              <a-button
+                size="small"
+                type="link"
+                class="button-success"
+                @click="handleRelease(record,'see')"
+                v-if="(record.state=='PUBLISH')&&$hasPermissions('B_promotionManagementContent')"
+                id="promotion-modify-btn">查看</a-button>
               <a-button
                 size="small"
                 type="link"
                 class="button-info"
                 @click="handleRelease(record,'add')"
                 v-if="record.state=='UNPUBLISH'&&$hasPermissions('B_promotionManagementContent')"
-                id="promotion-release-btn">促销发布</a-button>
+                id="promotion-release-btn">发布</a-button>
               <a-button
                 size="small"
                 type="link"
@@ -238,7 +246,7 @@ export default {
         { title: '参与客户', scopedSlots: { customRender: 'joinCustomers' }, width: '12%', align: 'center' },
         { title: '促销描述', scopedSlots: { customRender: 'salesDesc' }, width: '12%', align: 'center' },
         { title: '促销展示', scopedSlots: { customRender: 'salesShow' }, width: '6%', align: 'center' },
-        { slots: { title: 'arrowFalgTitle' }, scopedSlots: { customRender: 'arrowFalg' }, width: '6%', align: 'center' },
+        // { slots: { title: 'arrowFalgTitle' }, scopedSlots: { customRender: 'arrowFalg' }, width: '6%', align: 'center' },
         { title: '促销状态', dataIndex: 'stateDictValue', width: '6%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
       ]
@@ -334,14 +342,9 @@ export default {
     handleRelease (row, type) {
       if (type === 'add') {
         this.$router.push({ name: 'promotionManagementAdd' })
-      } else {
-        this.$router.push({ name: 'promotionManagementEdit', query: { sn: row.promoActiveSn } })
+      } else { // 查看 、编辑跳转
+        this.$router.push({ name: 'promotionManagementEdit', params: { sn: row.promoActiveSn, pageType: type } })
       }
-      // this.itemId = row.promoActiveSn
-      // this.pageType = row.imageSet && row.imageSet.length > 0 ? 'edit' : type
-      // this.$nextTick(() => {
-      //   this.openPromotionEditModal = true
-      // })
     },
     // 关闭促销发布
     closePromotionEditModal () {

+ 4 - 4
src/views/promotionRulesManagement/promotionManagement/setPromotion.vue

@@ -20,12 +20,12 @@
           </a-form-model-item>
         </a-col>
         <a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
-          <a-form-model-item label="券名称" prop="title" :label-col="{span:6}" :wrapper-col="{span:18}">
+          <a-form-model-item label="券名称" prop="title" :label-col="{span:4}" :wrapper-col="{span:18}">
             <a-input id="setPromotion-title" :maxLength="20" v-model.trim="sellForm.title" placeholder="请输入券名称(最多20个字符)" allowClear />
           </a-form-model-item>
         </a-col>
         <a-col :xs="24" :sm="24" :md="12" :lg="12" :xl="12">
-          <a-form-model-item label="券副标题" :label-col="{span:4}" :wrapper-col="{span:18}">
+          <a-form-model-item label="券副标题" :label-col="{span:2}" :wrapper-col="{span:18}">
             <a-input id="setPromotion-title" :maxLength="20" v-model.trim="sellForm.title" placeholder="请输入券副标题(最多20个字符)" allowClear />
           </a-form-model-item>
         </a-col>
@@ -248,7 +248,7 @@ export default {
       SHOW_ALL,
       // form 表单label布局设置
       sellFormItemLayout: {
-        labelCol: { span: 3 }, // 文字前距离设置
+        labelCol: { span: 2 }, // 文字前距离设置
         wrapperCol: { span: 20 }// 表单后距离设置  数字越大距离越小
       },
       couponFormLayout: {
@@ -276,7 +276,7 @@ export default {
       treeData: [],
       showProModal: false,
       couponForm: {},
-      couponRules: [],
+      couponRules: {},
 
       sellRules: {
         promoBuyerList: [{