Explorar el Código

feat: p20分销: 订单传参来识别是否分享订单

cuiyalong hace 5 años
padre
commit
8f93e52e56
Se han modificado 3 ficheros con 33 adiciones y 3 borrados
  1. 9 1
      src/views/buy/Buy.vue
  2. 12 1
      src/views/main/Home.vue
  3. 12 1
      src/views/main/ReportDetail.vue

+ 9 - 1
src/views/buy/Buy.vue

@@ -156,6 +156,9 @@ export default class BuyReport extends Vue {
     '购买、售后等问题,请联系剑鱼标讯客服电话:400-108-6670'
   ]
 
+  // 分享码
+  disWord: any = ''
+
   // 订单金额等数据
   orderInfo = {
     reportId: '',
@@ -266,6 +269,8 @@ export default class BuyReport extends Vue {
     this.orderInfo.reportId = this.$route.params.id
     this.orderInfo.price = reportInfo.price
     this.orderInfo.before_price = reportInfo.before_price
+
+    this.disWord = this.$route.query.disWord
   }
 
   mounted () {
@@ -393,12 +398,15 @@ export default class BuyReport extends Vue {
   }
 
   onSubmit () {
-    const data = {
+    const data: any = {
       email: this.userInfo.email,
       phone: this.userInfo.phone,
       company: this.userInfo.company,
       reportId: this.orderInfo.reportId
     }
+    if (this.disWord) {
+      data.disWord = this.disWord
+    }
     this.$toast.loading({
       message: '加载中...',
       forbidClick: true,

+ 12 - 1
src/views/main/Home.vue

@@ -81,6 +81,9 @@ export default class Home extends Vue {
 
   defaultListState = JSON.parse(JSON.stringify(this.listState))
 
+  // 分享码
+  disWord: any = ''
+
   beforeRouteEnter (to, from, next) {
     if (from.name === 'detail') {
       to.meta.isBack = true
@@ -90,6 +93,10 @@ export default class Home extends Vue {
     next()
   }
 
+  created () {
+    this.disWord = this.$route.query.disWord
+  }
+
   activated () {
     if (!this.$route.meta.isBack) {
       for (const key in this.defaultListState) {
@@ -154,7 +161,11 @@ export default class Home extends Vue {
   }
 
   goDetail (item) {
-    this.$router.push(`/detail/${item.id}`)
+    if (this.disWord) {
+      this.$router.push(`/detail/${item.id}?disWord=${this.disWord}`)
+    } else {
+      this.$router.push(`/detail/${item.id}`)
+    }
   }
 
   onRefresh () {

+ 12 - 1
src/views/main/ReportDetail.vue

@@ -83,6 +83,9 @@ export default class Home extends Vue {
   //   content: '<p>城际高速铁路是指在人口稠密的都市圈或者城市带(城市群)中,规划和修建的高速铁路客运专线运输系统,主要运营于城市群或城市带,线路总长一般不超过200千米,允许列车行驶的最大速度在250km/h以上。城际轨道交通是指以城际运输为主的轨道交通客运系统,相当于低速版的城际高铁。凭借人均能耗低、承载量大、互通互联等诸多优点,成为助力绿色出行、创建智慧城市、缓解拥堵等的重要手段。<br> 城际高速铁路和城际轨道交通产业链可分为上游(施工准备)、中游(建设施工)以及下游(运营维护)。上游施工准备主要包括设计咨询、原材料、机械设备;中游建设施工主要包括建筑施工和智能化设备;下游运营维护主要包括运营维护,产业应用于检修设备及运营。</p>'
   // }
 
+  // 分享码
+  disWord: any = ''
+
   detail = {
     id: 12,
     title: '',
@@ -93,6 +96,10 @@ export default class Home extends Vue {
     content: ''
   }
 
+  created () {
+    this.disWord = this.$route.query.disWord
+  }
+
   mounted () {
     // 清除购买页面用户填写的信息
     this.clearBuyState()
@@ -106,7 +113,11 @@ export default class Home extends Vue {
 
   goBuy (id) {
     this.saveReportInfo(this.detail)
-    this.$router.push(`/buy/${id}`)
+    if (this.disWord) {
+      this.$router.push(`/buy/${id}?disWord=${this.disWord}`)
+    } else {
+      this.$router.push(`/buy/${id}`)
+    }
   }
 }
 </script>