Pārlūkot izejas kodu

新策略模板

hml 2 gadi atpakaļ
vecāks
revīzija
8760d203e5

+ 103 - 97
purchase_H5/src/views/indexMobile.vue

@@ -4,7 +4,7 @@
   </div>
 </template>
 <script>
-import { strategytemplate } from '../api'
+import { strategytemplate, detMainProduct } from '../api'
 export default {
   name: "home",
   data () {
@@ -27,106 +27,112 @@ export default {
 
 
   methods: {
+    getPorduct (productId) {
+      return detMainProduct({
+        productId: productId,
+      });
+    },
     pageData (data) {
-      console.log(data)
-      // this.getStrategytemplate(data.item.recommendStrategyIds[0])
       this.$store.commit('setTempName', data.template)
-      let mainProduct = {
-        activeType: "69",
-        bannerPics: [data.productJson.bannerImg, data.productJson.jsonImg, data.productJson.upImg, data.productJson.topImg,],
-        bgColor: [data.productJson.pageBgcol, '', data.productJson.orderBgcol, data.productJson.orderBdcol],
-        cacheSeatOne: [{
-          dongHua: data.productJson.drawVal,
-          memberUrl: "",
-          proC: {
-            e: data.productJson.hideCol,
-            s: data.productJson.pageTextcol
+      detMainProduct({
+        productId: data.item.primaryProductId,
+      }).then(res => {
+        let mainProduct = {
+          activeType: res.data.activeType,
+          bannerPics: [data.productJson.bannerImg, data.productJson.jsonImg, data.productJson.upImg, data.productJson.topImg,],
+          bgColor: [data.productJson.pageBgcol, '', data.productJson.orderBgcol, data.productJson.orderBdcol],
+          cacheSeatOne: [{
+            dongHua: data.productJson.drawVal,
+            memberUrl: res.data.cacheSeatOne[0].memberUrl,
+            proC: {
+              e: data.productJson.hideCol,
+              s: data.productJson.pageTextcol
+            },
+            productV: data.productJson.productV,
+            rushC: {
+              e: data.productJson.orderTextcol,
+              s: data.productJson.orderNumcol,
+            },
+            tabC: {
+              e: data.productJson.tabVicecol,
+              s: data.productJson.tabMaincol,
+            },
+            btnUrl: "",
+          }],
+          cpid: res.data.cpid,
+          discountInfo: null,
+          flowJumpUrl: res.data.flowJumpUrl,
+          givePhoneInfo:res.data.givePhoneInfo,
+          guidancePic: {
+            c: data.productJson.orderImg,
+            p: data.productJson.explainImg
           },
-          productV: data.productJson.productV,
-          rushC: {
-            e: data.productJson.orderTextcol,
-            s: data.productJson.orderNumcol,
-          },
-          tabC: {
-            e: data.productJson.tabVicecol,
-            s: data.productJson.tabMaincol,
-          },
-          btnUrl: "",
-        }],
-        cpid: "bilibl",
-        createTime: "2022-02-23 15:23:34",
-        discountInfo: null,
-        flowJumpUrl: "https://www.baidu.com",
-        givePhoneInfo: "<p><strong>产品</strong> 哔哩哔哩流量会员合约包</p><p><strong>资费</strong> <strong>首月0.01元,次月起25元/月</strong></p><p><strong>内容</strong> 15GB定向流量+哔哩哔哩大会员</p><p><strong>合约</strong> <strong>本产品合约期为6个月,第六个月方可退订,用户在合约期内解除合约时,<s> </s>需补足首月优惠金额,切在原合约期结束后方能再次退订</strong></p>",
-        guidancePic: {
-          c: data.productJson.orderImg,
-          p: data.productJson.explainImg
-        },
-        id: data.item.primaryProductId,
-        isCompositeProduct: 0,   //是否复合产品
-        logoPic: data.productJson.logoPic,
-        manualInfo: "活动说明",
-        memberName: "会员信息",
-        orderingInfo: "<h2><span style=\"color: rgb(0, 138, 0);\">产品订购说明</span></h2>",
-        originalPrice: 25,
-        pageTitle: data.productJson.pageTitle,
-        productName: "测试产品V2",
-        productType: null,
-        promotionPic: null,
-        pushJumpUrl: null,
-        remark: "测试V2",
-        remark1: null,
-        remark2: null,
-        remark3: data.productJson.remark3,
-        spid: "979",
-        themeColor: [data.productJson.btnTopcol, data.productJson.btnBotcol],
-      }
-      let recommend = [];
-      if (data.item.recommendStrategyIds.length > 0) {
-        data.item.recommendStrategyIds.forEach(async val => {
-          let list = await strategytemplate(val)
-          recommend.push(list.data);
-        });
-      }
-      let pageData = {
-        mainProduct: mainProduct,
-        channl: {
-          channelKey: "464c87375658",
-          channelName: "新策略H5整合测试",
-          fullCode: "173966823233",
-        },
-        recommend: recommend,
-        remarks: data.extJson, //策略信息
-        viceJson: data.viceJson, //副产品json
-        otherJson: data.otherJson, //备用json
-        strategyInfo: {
-          activityLogo: data.item.activityLogo,
-          activityType: data.item.activityType,
-          directCharge: null,
-          extJson: data.extJson,
-          id: null,
-          linkUrl: data.item.linkUrl,
-          maskText: data.item.maskText,
-          posterPhoto: data.item.posterPhoto,
-          primaryProductId: data.item.primaryProductId,
-          primarySpid: "1234",
-          productInfo: [],
-          promotePhoto: data.item.promotePhoto,
-          recommendStrategyList: data.item.recommendStrategyIds,
-          strategyName: data.item.strategyName,
-          strategyStatus: data.item.strategyStatus,
-          strategyType: data.item.strategyType,
-          templateCode: data.template,
-          templateId: data.item.templateId,
-          templateName: "",
-          testGroupId: null,
-          testId: null,
-          unsubscribeStrategyList: data.item.unsubscribeStrategyIds,
-          viceProductStrategyList: data.item.viceProductIds,
+          id: data.item.primaryProductId,
+          isCompositeProduct: 0,   //是否复合产品
+          logoPic: data.productJson.logoPic,
+          manualInfo: res.data.manualInfo,
+          memberName: res.data.memberName,
+          orderingInfo: res.data.orderingInfo,
+          originalPrice: res.data.originalPrice,
+          pageTitle: data.productJson.pageTitle,
+          productName: res.data.productName,
+          productType:res.data.productType,
+          promotionPic: res.data.promotionPic,
+          pushJumpUrl: res.data.pushJumpUrl,
+          remark: res.data.producremarktName,
+          remark1: res.data.remark1,
+          remark2: res.data.remark2,
+          remark3: data.productJson.remark3,
+          spid: res.data.spid,
+          themeColor: [data.productJson.btnTopcol, data.productJson.btnBotcol],
+        }
+        let recommend = [];
+        if (data.item.recommendStrategyIds.length > 0 && data.item.recommendStrategyIds) {
+          data.item.recommendStrategyIds.forEach(async val => {
+            let list = await strategytemplate(val)
+            recommend.push(list.data);
+          });
         }
-      };
-      console.log(pageData)
-      this.$store.commit("setPageData", pageData);
+        let pageData = {
+          mainProduct: mainProduct,
+          channl: {
+            channelKey: "464c87375658",
+            channelName: "新策略H5整合测试",
+            fullCode: "173966823233",
+          },
+          recommend: recommend,
+          remarks: data.extJson, //策略信息
+          viceJson: data.viceJson, //副产品json
+          otherJson: data.otherJson, //备用json
+          strategyInfo: {
+            activityLogo: data.item.activityLogo,
+            activityType: data.item.activityType,
+            directCharge: null,
+            extJson: data.extJson,
+            id: null,
+            linkUrl: data.item.linkUrl,
+            maskText: data.item.maskText,
+            posterPhoto: data.item.posterPhoto,
+            primaryProductId: data.item.primaryProductId,
+            primarySpid: "1234",
+            productInfo: [],
+            promotePhoto: data.item.promotePhoto,
+            recommendStrategyList: data.item.recommendStrategyIds,
+            strategyName: data.item.strategyName,
+            strategyStatus: data.item.strategyStatus,
+            strategyType: data.item.strategyType,
+            templateCode: data.template,
+            templateId: data.item.templateId,
+            templateName: "",
+            testGroupId: null,
+            testId: null,
+            unsubscribeStrategyList: data.item.unsubscribeStrategyIds,
+            viceProductStrategyList: data.item.viceProductIds,
+          }
+        };
+        this.$store.commit("setPageData", pageData);
+      })
+
     }
   },
 };

+ 1 - 1
purchase_ao/src/layout/components/Navbar.vue

@@ -45,7 +45,7 @@ export default {
     ...mapGetters(["sidebar", "avatar"]),
   },
     mounted() {
-        console.log(this.$store.state.user.name)
+        // console.log(this.$store.state.user.name)
     },
   methods: {
     toggleSideBar() {

+ 2 - 2
purchase_ao/src/router/index.js

@@ -344,9 +344,9 @@ export const constantRoutes = [{
   }, {
     path: '/strategy/add',
     component: () => import('@/views/strategy/add'),
-    name: '新增策略',
+    name: '编辑策略',
     meta: {
-      title: '新增策略'
+      title: '编辑策略'
     }
   }]
 },

+ 29 - 9
purchase_ao/src/views/strategy/add.vue

@@ -30,7 +30,8 @@
                     <span>策略名称</span>
                   </el-tooltip>
                 </template>
-                <el-input v-model="form.strategyName" placeholder="策略名称"></el-input>
+                <el-input v-if='editId===null' @blur="inputBlur" v-model="form.strategyName" placeholder="策略名称"></el-input>
+                <el-input v-else v-model="form.strategyName" placeholder="策略名称"></el-input>
               </el-form-item>
               <el-form-item>
                 <template slot="label">
@@ -647,7 +648,7 @@
                     <span>会员自动直冲</span>
                   </el-tooltip>
                 </template>
-                <el-switch v-model="extJson.isZhic" active-text="启用" inactive-text="不启用" :active-value="0" :inactive-value="1" />
+                <el-switch v-model="extJson.isZhic" active-text="启用" inactive-text="不启用" active-value="0" inactive-value="1" />
               </el-form-item>
               <el-form-item>
                 <template slot="label">
@@ -668,7 +669,7 @@
                     <span>推荐策略</span>
                   </el-tooltip>
                 </template>
-                <el-select v-model="form.recommendStrategyIds" multiple filterable placeholder="请选择推荐策略">
+                <el-select v-model="form.recommendStrategyIds" multiple filterable placeholder="请选择推荐策略" @change="recommendChnage">
                   <el-option v-for="(item, index) in strategyInfoList" :key="index" :label="item.strategyName" :value="item.id" />
                 </el-select>
               </el-form-item>
@@ -714,6 +715,7 @@
                   </el-tooltip>
                 </template>
                 <el-select v-model="form.activityType" clearable placeholder="选择活动类型">
+                  <el-option label="无活动" :value="0"></el-option>
                   <el-option label="科创活动" :value="1"></el-option>
                   <el-option label="铂原活动" :value="2"></el-option>
                 </el-select>
@@ -814,6 +816,8 @@ export default {
         privacy: "0",
         privacyText: "",
         attestation: 3,
+        maskText: "",
+        maskText2: "",
         dispose: "",
         activation: "0",
         // 回传api方式
@@ -825,7 +829,9 @@ export default {
         fitText: "",
         fitText2: "",
         btnText: "",
-        btnTextAss: ""
+        btnTextAss: "",
+        unBuyText: "",
+        isZhic: "0"
       },   //策略json
       productJson: {
         logoPic: "",   //logo图   (对应原字段)
@@ -911,6 +917,9 @@ export default {
 
   },
   methods: {
+    inputBlur () {
+      this.form.strategyName = this.form.strategyName + '-' + this.$store.state.user.name
+    },
     // 选择模板
     templateChange (e) {
       if (e) {
@@ -952,7 +961,10 @@ export default {
         this.objVal(this.viceJson, JSON.parse(this.form.productJson).viceProduct)
         this.objVal(this.otherJson, JSON.parse(this.form.otherJson))
         this.viceProductId = this.form.viceProductIds[0]
-        this.svgClick('all')
+        if (this.productJson.jsonImg !== '' && this.viceJson.jsonImg !== '') {
+          this.svgClick('all')
+        }
+
         if (this.$route.query.copy) {
           this.form.strategyName = this.form.strategyName + '-复制'
         }
@@ -986,9 +998,9 @@ export default {
           post('/strategytemplate/update/' + id, this.form).then(res => {
             if (res.code === 10000) {
               this.$message.success('编辑成功!')
-              setTimeout(() => {
-                this.$router.go(0)
-              }, 1000)
+              // setTimeout(() => {
+              //   this.$router.go(0)
+              // }, 1000)
             }
           })
         } else {
@@ -1045,11 +1057,19 @@ export default {
     //选择副产品  处理副产品
     viceChange (e) {
       if (e) {
+        this.form.viceProductIds = []
         this.form.viceProductIds.push(e)
+        console.log(this.form.viceProductIds)
       } else {
         this.form.viceProductIds = []
       }
     },
+    recommendChnage (e) {
+      console.log(e)
+      if (!e) {
+        this.form.recommendStrategyIds = []
+      }
+    },
     // 主产品  新增  编辑
     productClick (val) {
       if (val === 'edit') {
@@ -1086,7 +1106,7 @@ export default {
         if (name === '推广图') {
           this.form.promotePhoto = this.imgUrl + file.data
         } else if (name === 'logo') {
-          this.productJson.logoPic =  file.data
+          this.productJson.logoPic = file.data
         } else if (name === '主banner') {
           this.productJson.bannerImg = file.data
         } else if (name === '主jsonImg') {