introduction.js 3.04 KB
/*
 * @Description: 
 * @Author: huyue
 * @Date: 2024-05-16 10:43:18
 * @LastEditors: huyue
 * @LastEditTime: 2024-10-22 15:22:57
 */
// packageEquity/pages/aiCheck/start/components/introduction.js
import aiApi from "~/packageStudy/aiApi"
import util from "~/utils/util"
Component({
  lifetimes: {
    attached: function () {
      let userInfo = util.getStorageSync('dj_boutique_user_info')
      let username = userInfo.name.length < 5 ? userInfo.name : userInfo.name.slice(0, 4) + '...'
      this.setData({
        username
      })
    }
  },
  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    productList: [
      {
        id: 1,
        name: '驻店延保',
        description: '模拟驻店人员向车主推销延保产品',
        type: 1,
        imgName: 'product-1',
        isAvailable: true,
        bg: 'bg1',
        eventCode: 'storeExtended_warranty'
      },
      {
        id: 2,
        name: '延保',
        description: '模拟客户在驻店售卖延保过程中的各类问题',
        type: 2,
        imgName: 'product-2',
        isAvailable: true,
        bg: 'bg2',
        eventCode: 'extended_warranty'
      },
      {
        id: 3,
        name: '安心包',
        description: '模拟客户在驻店售卖安心包过程中的各类问题',
        type: 2,
        imgName: 'product-3',
        isAvailable: true,
        bg: 'bg2',
        eventCode: 'peace_pack'
      },
      {
        id: 4,
        name: '权益升级',
        description: '快速获取车主需求,推荐权益产品',
        type: 1,
        imgName: 'product-4',
        isAvailable: false,
        bg: 'bg3',
        eventCode: 'benefit_upgrades'
      },
      {
        id: 5,
        name: '轻改升级',
        description: '通过精品礼券,引导客户到店轻改升级',
        type: 1,
        imgName: 'product-5',
        isAvailable: false,
        bg: 'bg3',
        eventCode: 'modification_upgrades'

      }
    ],
    popVisible: false,
    userName: null
  },
  /**
   * 组件的方法列表
   */
  methods: {
    // 我知道了
    confirm() {
      this.setData({
        popVisible: false
      })
    },
    toExperience: wx.$util.throttle(function (e) {
      console.log(11, e)
      const { id, available, type, eventcode } = e.currentTarget.dataset
      wx.$track.setTrackData(0, eventcode, {
        id
      }, '', 0)
      if (type == 1) {
        if (available) {
          // 调用接口
          this.setSparringVerify(id)
        } else {
          this.setData({
            popVisible: true
          })
          // wx.showToast({
          //   title: '更多功能正在开发中...',
          //   icon: 'none',
          //   duration: 2000
          // })
        }
      } else if (type == 2) {
        wx.navigateTo({
          url: `/packageStudy/pages/aiCheck/defense/defense?id=${id}`
        })
      }
    }, 1000),
    setSparringVerify(id) {
      wx.navigateTo({
        url: `/packageStudy/pages/aiCheck/scene/scene?id=${id}`
      })
    },
  }
})