hml 2 anni fa
parent
commit
6e4b472efc

+ 6 - 15
purchase_ao/src/views/productV2/addProduct.vue

@@ -16,12 +16,6 @@
       <el-form-item label="activeType">
         <el-input style="width: 300px" v-model="form.activeType" placeholder="科创定义activeType,根据对照表填写"></el-input>
       </el-form-item>
-      <!-- <el-form-item label="直冲阈值">
-        <el-input style="width: 300px" v-model="form.threshold" placeholder="如无阈值设置,则填0"></el-input>
-        <div style="color: red">
-          直冲阈值>0,开启订购自动领取会员,当日订购成功数满足阈值则开始自动领取该产品会员
-        </div>
-      </el-form-item> -->
       <el-form-item label="产品形态">
         <el-select v-model="form.isCompositeProduct" placeholder="请选择" style="width: 300px">
           <el-option label="单产品" :value="0" />
@@ -29,8 +23,8 @@
           <el-option label="多选一" :value="2" />
         </el-select>
       </el-form-item>
-      <el-form-item label="产品价">
-        <el-input style="width: 300px" v-model="form.originalPrice" placeholder="产品价"></el-input>
+      <el-form-item label="产品价">
+        <el-input style="width: 300px" v-model="form.originalPrice" placeholder="产品价"></el-input>
       </el-form-item>
       <el-form-item label="产品备注">
         <el-input style="width: 300px" placeholder="产品备注" v-model="form.remark"></el-input>
@@ -47,17 +41,14 @@
       <!-- <el-form-item label="分享标题">
                     <el-input style="width: 500px" v-model="form.pageTitle"></el-input>
                   </el-form-item> -->
-      <el-form-item label="分享文案">
+      <!-- <el-form-item label="分享文案">
         <el-input style="width: 500px" v-model="form.remark3" placeholder="微信分享副标题"></el-input>
-      </el-form-item>
-      <el-form-item label="页面背景配色">
+      </el-form-item> -->
+      <!-- <el-form-item label="页面背景配色">
         <el-row :gutter="10">
           <el-col :span="1">
             <el-color-picker v-model="addColors.bgc.s" show-alpha />
           </el-col>
-          <!--                <el-col :span="1">-->
-          <!--                    <el-color-picker v-model="addColors.bgc.e" />-->
-          <!--                </el-col>-->
         </el-row>
       </el-form-item>
       <el-form-item label="订购窗配色">
@@ -172,7 +163,7 @@
       </el-form-item>
       <el-form-item label="动画效果">
         <el-switch v-model="productJson[0].dongHua" active-text="启用" inactive-text="不启用" active-value="1" inactive-value="0" />
-      </el-form-item>
+      </el-form-item> -->
       <!-- 富文本编辑 -->
       <el-form-item>
         <el-tabs type="border-card" style="margin-top: 20px">

+ 108 - 60
purchase_ao/src/views/strategy/add.vue

@@ -3,9 +3,9 @@
     <div class="content">
       <!-- 预览页 -->
       <div class="page">
-        <el-button class="look" size="small" type="primary"> 预览</el-button>
+        <el-button :disabled="templateList.length===0" class="look" size="small" type="primary" @click="preview"> 预览</el-button>
         <div class="ifreamBox">
-          <iframe class="ifream"  scrolling="no" src="http://localhost:8081/mobile.html#/"></iframe>
+          <iframe id="ifreamId" class="ifream" height="100%" width="100%" :src="ifreamSrc"></iframe>
         </div>
 
       </div>
@@ -61,7 +61,7 @@
                     <span>模板选择</span>
                   </el-tooltip>
                 </template>
-                <el-select v-model="form.templateId" clearable placeholder="请选择模板">
+                <el-select v-model="form.templateId" clearable placeholder="请选择模板" @change="templateChange">
                   <el-option v-for="item in templateList" :key="item.id" :label="item.templateName" :value="item.id">
                     <span style="float: left; margin-right: 10px">{{
                           item.templateName
@@ -151,7 +151,7 @@
                   </el-popover>
                 </template>
                 <el-upload class="avatar-uploader" :show-file-list="false" :action="imgapi" :on-success="((file,fileList)=>{fileSuccess(file,fileList,'推广图')})">
-                  <img v-if="form.promotePhoto!==''" :src="form.promotePhoto" class="avatar" />
+                  <img v-if="form.promotePhoto!==''" :src="imgUrl+form.promotePhoto" class="avatar" />
                   <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                 </el-upload>
                 <span v-if="form.promotePhoto!==''" style="color: #F56C6C; cursor: pointer" @click="form.promotePhoto=''">删除</span>
@@ -164,7 +164,7 @@
                   </el-popover>
                 </template>
                 <el-upload class="avatar-uploader" :show-file-list="false" :action="imgapi" :on-success="((file,fileList)=>{fileSuccess(file,fileList,'logo')})">
-                  <img v-if="productJson.logoPic !==''" :src="productJson.logoPic" class="avatar" />
+                  <img v-if="productJson.logoPic !==''" :src="imgUrl+productJson.logoPic" class="avatar" />
                   <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                 </el-upload>
                 <span v-if="productJson.logoPic!==''" @click="productJson.logoPic=''" style="color: #F56C6C; cursor: pointer">删除</span>
@@ -271,7 +271,7 @@
                       </el-tooltip>
                     </template>
                     <el-upload class="avatar-uploader" :show-file-list="false" :action="imgapi" :on-success="((file,fileList)=>{fileSuccess(file,fileList,'主banner')})">
-                      <img v-if="productJson.bannerImg" :src="productJson.bannerImg" class="avatar" />
+                      <img v-if="productJson.bannerImg" :src="imgUrl+productJson.bannerImg" class="avatar" />
                       <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                     </el-upload>
                     <span v-if="productJson.bannerImg!==''" @click="productJson.bannerImg=''" style="color: #F56C6C; cursor: pointer">删除</span>
@@ -283,7 +283,7 @@
                       </el-tooltip>
                     </template>
                     <el-upload class="avatar-uploader" :show-file-list="false" :action="imgapi" :on-success="((file,fileList)=>{fileSuccess(file,fileList,'主jsonImg')})">
-                      <img v-if="productJson.jsonImg!==''" :src="productJson.jsonImg" class="avatar" />
+                      <img v-if="productJson.jsonImg!==''" :src="imgUrl+productJson.jsonImg" class="avatar" />
                       <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                     </el-upload>
                     <span v-if="productJson.jsonImg!==''" @click="productJson.jsonImg=''" style="color: #F56C6C; cursor: pointer">删除</span>
@@ -295,7 +295,7 @@
                       </el-tooltip>
                     </template>
                     <el-upload class="avatar-uploader" :show-file-list="false" :action="imgapi" :on-success="((file,fileList)=>{fileSuccess(file,fileList,'主upImg')})">
-                      <img v-if="productJson.upImg!==''" :src="productJson.upImg" class="avatar" />
+                      <img v-if="productJson.upImg!==''" :src="imgUrl+productJson.upImg" class="avatar" />
                       <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                     </el-upload>
                     <span v-if="productJson.upImg!==''" @click="productJson.upImg=''" style="color: #F56C6C; cursor: pointer">删除</span>
@@ -307,31 +307,31 @@
                       </el-tooltip>
                     </template>
                     <el-upload class="avatar-uploader" :show-file-list="false" :action="imgapi" :on-success="((file,fileList)=>{fileSuccess(file,fileList,'主topImg')})">
-                      <img v-if="productJson.topImg!==''" :src="productJson.topImg" class="avatar" />
+                      <img v-if="productJson.topImg!==''" :src="imgUrl+productJson.topImg" class="avatar" />
                       <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                     </el-upload>
                     <span v-if="productJson.topImg!==''" @click="productJson.topImg=''" style="color: #F56C6C; cursor: pointer">删除</span>
                   </el-form-item>
                   <el-form-item>
                     <template slot="label">
-                      <el-tooltip content="订购窗配图" placement="top">
-                        <span>订购窗配图</span>
+                      <el-tooltip content="页面中产品说明配图  产品说明title配图" placement="top">
+                        <span>产品说明标题</span>
                       </el-tooltip>
                     </template>
                     <el-upload class="avatar-uploader" :show-file-list="false" :action="imgapi" :on-success="((file,fileList)=>{fileSuccess(file,fileList,'主orderImg')})">
-                      <img v-if="productJson.orderImg !==''" :src="productJson.orderImg" class="avatar" />
+                      <img v-if="productJson.orderImg !==''" :src="imgUrl+productJson.orderImg" class="avatar" />
                       <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                     </el-upload>
                     <span v-if="productJson.orderImg!==''" @click="productJson.orderImg=''" style="color: #F56C6C; cursor: pointer">删除</span>
                   </el-form-item>
                   <el-form-item>
                     <template slot="label">
-                      <el-tooltip content="页面中产品说明配图  产品说明title配图" placement="top">
-                        <span>产品说明图</span>
+                      <el-tooltip content="订购窗配图" placement="top">
+                        <span>订购窗配图</span>
                       </el-tooltip>
                     </template>
                     <el-upload class="avatar-uploader" :show-file-list="false" :action="imgapi" :on-success="((file,fileList)=>{fileSuccess(file,fileList,'主explainImg')})">
-                      <img v-if="productJson.explainImg !== ''" :src="productJson.explainImg" class="avatar" />
+                      <img v-if="productJson.explainImg !== ''" :src="imgUrl+productJson.explainImg" class="avatar" />
                       <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                     </el-upload>
                     <span v-if="productJson.explainImg!==''" @click="productJson.explainImg=''" style="color: #F56C6C; cursor: pointer">删除</span>
@@ -399,57 +399,58 @@
                       <span>banner图</span>
                     </template>
                     <el-upload class="avatar-uploader" :show-file-list="false" :action="imgapi" :on-success="((file,fileList)=>{fileSuccess(file,fileList,'副banner')})">
-                      <img v-if="viceJson.bannerImg" :src="viceJson.bannerImg" class="avatar" />
+                      <img v-if="viceJson.bannerImg" :src="imgUrl+viceJson.bannerImg" class="avatar" />
                       <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                     </el-upload>
                     <span v-if="viceJson.bannerImg!==''" @click="viceJson.bannerImg=''" style="color: #F56C6C; cursor: pointer">删除</span>
                   </el-form-item>
                   <el-form-item>
                     <template slot="label">
-                      <span>上层素材</span>
+                      <span>动态文件</span>
                     </template>
-                    <el-upload class="avatar-uploader" :show-file-list="false" :action="imgapi" :on-success="((file,fileList)=>{fileSuccess(file,fileList,'副upImg')})">
-                      <img v-if="viceJson.upImg" :src="viceJson.upImg" class="avatar" />
+                    <el-upload class="avatar-uploader" :show-file-list="false" :action="imgapi" :on-success="((file,fileList)=>{fileSuccess(file,fileList,'副jsonImg')})">
+                      <img v-if="viceJson.jsonImg" :src="imgUrl+viceJson.jsonImg" class="avatar" />
                       <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                     </el-upload>
-                    <span v-if="viceJson.upImg!==''" @click="viceJson.upImg=''" style="color: #F56C6C; cursor: pointer">删除</span>
+                    <span v-if="viceJson.jsonImg!==''" @click="viceJson.jsonImg=''" style="color: #F56C6C; cursor: pointer">删除</span>
                   </el-form-item>
                   <el-form-item>
                     <template slot="label">
-                      <span>动态文件</span>
+                      <span>上层素材</span>
                     </template>
-                    <el-upload class="avatar-uploader" :show-file-list="false" :action="imgapi" :on-success="((file,fileList)=>{fileSuccess(file,fileList,'副jsonImg')})">
-                      <img v-if="viceJson.jsonImg" :src="viceJson.jsonImg" class="avatar" />
+                    <el-upload class="avatar-uploader" :show-file-list="false" :action="imgapi" :on-success="((file,fileList)=>{fileSuccess(file,fileList,'副upImg')})">
+                      <img v-if="viceJson.upImg" :src="imgUrl+viceJson.upImg" class="avatar" />
                       <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                     </el-upload>
-                    <span v-if="viceJson.jsonImg!==''" @click="viceJson.jsonImg=''" style="color: #F56C6C; cursor: pointer">删除</span>
+                    <span v-if="viceJson.upImg!==''" @click="viceJson.upImg=''" style="color: #F56C6C; cursor: pointer">删除</span>
                   </el-form-item>
+
                   <el-form-item>
                     <template slot="label">
                       <span>顶层素材</span>
                     </template>
                     <el-upload class="avatar-uploader" :show-file-list="false" :action="imgapi" :on-success="((file,fileList)=>{fileSuccess(file,fileList,'副topImg')})">
-                      <img v-if="viceJson.topImg" :src="viceJson.topImg" class="avatar" />
+                      <img v-if="viceJson.topImg" :src="imgUrl+viceJson.topImg" class="avatar" />
                       <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                     </el-upload>
                     <span v-if="viceJson.topImg!==''" @click="viceJson.topImg=''" style="color: #F56C6C; cursor: pointer">删除</span>
                   </el-form-item>
                   <el-form-item>
                     <template slot="label">
-                      <span>订购窗配图</span>
+                      <span>产品说明标题</span>
                     </template>
                     <el-upload class="avatar-uploader" :show-file-list="false" :action="imgapi" :on-success="((file,fileList)=>{fileSuccess(file,fileList,'副orderImg')})">
-                      <img v-if="viceJson.orderImg" :src="viceJson.orderImg" class="avatar" />
+                      <img v-if="viceJson.orderImg" :src="imgUrl+viceJson.orderImg" class="avatar" />
                       <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                     </el-upload>
                     <span v-if="viceJson.orderImg!==''" @click="viceJson.orderImg=''" style="color: #F56C6C; cursor: pointer">删除</span>
                   </el-form-item>
                   <el-form-item>
                     <template slot="label">
-                      <span>产品说明图</span>
+                      <span>订购窗配图</span>
                     </template>
                     <el-upload class="avatar-uploader" :show-file-list="false" :action="imgapi" :on-success="((file,fileList)=>{fileSuccess(file,fileList,'副explainImg')})">
-                      <img v-if="viceJson.explainImg" :src="viceJson.explainImg" class="avatar" />
+                      <img v-if="viceJson.explainImg" :src="imgUrl+viceJson.explainImg" class="avatar" />
                       <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                     </el-upload>
                     <span v-if="viceJson.explainImg!==''" @click="viceJson.explainImg=''" style="color: #F56C6C; cursor: pointer">删除</span>
@@ -718,7 +719,7 @@
                   </el-tooltip>
                 </template>
                 <el-upload class="avatar-uploader" :show-file-list="false" :action="imgapi" :on-success="((file,fileList)=>{fileSuccess(file,fileList,'活动logo')})">
-                  <img v-if="form.activityLogo !==''" :src="form.activityLogo" class="avatar" />
+                  <img v-if="form.activityLogo !==''" :src="imgUrl+form.activityLogo" class="avatar" />
                   <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                 </el-upload>
                 <span v-if="form.activityLogo!==''" @click="form.activityLogo=''" style="color: #F56C6C; cursor: pointer">删除</span>
@@ -730,7 +731,7 @@
                   </el-tooltip>
                 </template>
                 <el-upload class="avatar-uploader" :show-file-list="false" :action="imgapi" :on-success="((file,fileList)=>{fileSuccess(file,fileList,'活动海报')})">
-                  <img v-if="form.posterPhoto!==''" :src="form.posterPhoto" class="avatar" />
+                  <img v-if="form.posterPhoto!==''" :src="imgUrl+form.posterPhoto" class="avatar" />
                   <i v-else class="el-icon-plus avatar-uploader-icon"></i>
                 </el-upload>
                 <span v-if="form.posterPhoto!==''" @click="form.posterPhoto=''" style="color: #F56C6C; cursor: pointer">删除</span>
@@ -753,6 +754,8 @@ import { post, get } from "@/api/common";
 export default {
   data () {
     return {
+      imgUrl: process.env.VUE_APP_BASE_IMG_URL,
+      ifreamSrc: "",
       imgapi: process.env.VUE_APP_BASE_IMG_API, //上传图片地址
       activeName: '0',
       collapseVal: ['0', '1', '4'],
@@ -805,6 +808,8 @@ export default {
         treatyText: "",
         fitText: "",
         fitText2: "",
+        btnText: "",
+        btnTextAss: ""
       },   //策略json
       productJson: {
         logoPic: "",   //logo图   (对应原字段)
@@ -870,10 +875,16 @@ export default {
       //策略列表
       strategyInfoList: [],
       editId: null,
-      copy: 0
+      copy: 0,
+      templateCode: ""
     }
   },
   created () {
+    this.getTemplate()
+    this.getProductList()
+    this.getStrategyList()
+  },
+  mounted () {
     if (this.$route.query.id) {
       let id = this.$route.query.id
       this.getStrategyId(id)
@@ -881,12 +892,41 @@ export default {
     if (this.$route.query.editId) {
       this.editId = this.$route.query.editId
     }
-  },
-  mounted () {
-    this.getTemplate()
-    this.getProductList()
+
   },
   methods: {
+    // 选择模板
+    templateChange (e) {
+      if (e) {
+        this.templateList.forEach(val => {
+          if (this.form.templateId === val.id) {
+            this.templateCode = val.templateCode
+          }
+        })
+      }
+    },
+    // 点击预览
+    preview () {
+      this.templateList.forEach(val => {
+        if (this.form.templateId === val.id) {
+          this.templateCode = val.templateCode
+        }
+      })
+      this.ifreamSrc = 'http://localhost:8081/mobile.html#/'
+      setTimeout(() => {
+        let ifream = document.getElementById('ifreamId')
+        const iframeWin = ifream.contentWindow
+        let pageData = {
+          item: this.form,
+          extJson: this.extJson,
+          productJson: this.productJson,
+          viceJson: this.viceJson,
+          template: this.templateCode
+        }
+        iframeWin.postMessage(pageData, this.ifreamSrc)
+      }, 1000)
+
+    },
     // 根据id查询策略信息
     getStrategyId (id) {
       post('/strategytemplate/' + id).then(res => {
@@ -901,7 +941,12 @@ export default {
         }
       })
     },
-
+    // 获取新策略列表
+    getStrategyList () {
+      get('/strategytemplate/list', this.form).then(res => {
+        this.strategyInfoList = res.data.list
+      })
+    },
     // 保存策略模板信息
     keepClick () {
       this.$confirm('确定保存模板信息, 是否继续?', '提示', {
@@ -917,12 +962,13 @@ export default {
         this.form.extJson = JSON.stringify(this.extJson)
         this.form.otherJson = JSON.stringify(this.otherJson)
         if (this.editId !== null) {
-          post('/strategytemplate/update/' + this.editId, this.form).then(res => {
+          let id = this.$route.query.id
+          post('/strategytemplate/update/' + id, this.form).then(res => {
             if (res.code === 10000) {
               this.$message.success('编辑成功!')
               setTimeout(() => {
-                this.$router.go(-1)
-              }, 2000)
+                this.$router.go(0)
+              }, 1000)
             }
           })
         } else {
@@ -935,6 +981,11 @@ export default {
               this.clearValue(this.otherJson)
               this.clearValue(this.viceJson)
               this.viceProductId = null
+              if (this.$route.query.copy) {
+                setTimeout(() => {
+                  this.$router.go(-1)
+                }, 2000)
+              }
             }
           })
         }
@@ -1011,40 +1062,39 @@ export default {
     },
     // 上传图片
     fileSuccess (file, fileList, name) {
-      let imgUrl = process.env.VUE_APP_BASE_IMG_URL
       if (file.code === 10000) {
         if (name === '推广图') {
-          this.form.promotePhoto = imgUrl + file.data
+          this.form.promotePhoto = file.data
         } else if (name === 'logo') {
-          this.productJson.logoPic = imgUrl + file.data
+          this.productJson.logoPic = file.data
         } else if (name === '主banner') {
-          this.productJson.bannerImg = imgUrl + file.data
+          this.productJson.bannerImg = file.data
         } else if (name === '主jsonImg') {
-          this.productJson.jsonImg = imgUrl + file.data
+          this.productJson.jsonImg = file.data
         } else if (name === '主upImg') {
-          this.productJson.upImg = imgUrl + file.data
+          this.productJson.upImg = file.data
         } else if (name === '主topImg') {
-          this.productJson.topImg = imgUrl + file.data
+          this.productJson.topImg = file.data
         } else if (name === '主orderImg') {
-          this.productJson.orderImg = imgUrl + file.data
+          this.productJson.orderImg = file.data
         } else if (name === '主explainImg') {
-          this.productJson.explainImg = imgUrl + file.data
+          this.productJson.explainImg = file.data
         } else if (name === '副banner') {
-          this.viceJson.bannerImg = imgUrl + file.data
+          this.viceJson.bannerImg = file.data
         } else if (name === '副jsonImg') {
-          this.viceJson.jsonImg = imgUrl + file.data
+          this.viceJson.jsonImg = file.data
         } else if (name === '副upImg') {
-          this.viceJson.upImg = imgUrl + file.data
+          this.viceJson.upImg = file.data
         } else if (name === '副topImg') {
-          this.viceJson.topImg = imgUrl + file.data
+          this.viceJson.topImg = file.data
         } else if (name === '副orderImg') {
-          this.viceJson.orderImg = imgUrl + file.data
+          this.viceJson.orderImg = file.data
         } else if (name === '副explainImg') {
-          this.viceJson.explainImg = imgUrl + file.data
+          this.viceJson.explainImg = file.data
         } else if (name === '活动logo') {
-          this.form.activityLogo = imgUrl + file.data
+          this.form.activityLogo = file.data
         } else if (name === '活动海报') {
-          this.form.posterPhoto = imgUrl + file.data
+          this.form.posterPhoto = file.data
         }
 
       }
@@ -1086,9 +1136,7 @@ export default {
       margin: 80px auto;
       // border: 1px solid red;
       .ifream {
-        width: 100%;
-        height: 100%;
-        overflow-y: scroll;
+        overflow: hidden;
       }
     }
   }

+ 1 - 2
purchase_ao/src/views/strategy/index.vue

@@ -95,7 +95,6 @@ export default {
     // 获取新策略列表
     getStrategyList () {
       get('/strategytemplate/list', this.form).then(res => {
-        console.log(res)
         this.loading = false
         this.datas = res.data.list
         this.total = res.data.total
@@ -104,7 +103,7 @@ export default {
       })
 
     },
-    // 新增策略
+    // 编辑策略
     addClick (val, item) {
       if (val === 'add') {
         this.$router.push('/strategy/add')