Commit a0f92b13 by luyt

feat:看产品接口

1 parent 53dc6d7f
...@@ -5,7 +5,7 @@ import api from '~/utils/request/request' ...@@ -5,7 +5,7 @@ import api from '~/utils/request/request'
// const common = 'scrm.api.carlife.common.' // const common = 'scrm.api.carlife.common.'
const serverApi = { const serverApi = {
// 拓客户 // 拓客户
productByscene:'scrm.api.busassistant.activity.productByscene' productByscene:'scrm.api.busassistant.activity.findSceneProductStatus'
} }
......
...@@ -38,8 +38,14 @@ Page({ ...@@ -38,8 +38,14 @@ Page({
isShow: true, isShow: true,
}); });
}, },
onRouter(options) { onRoute(options) {
console.log("options: ", options); // console.log("options: ", options);
//选中场景的index,和产品的index
let {actNum,activeNavIdx} = options
this.setData({
actNum,
activeNavIdx
})
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
......
...@@ -41,7 +41,7 @@ Component({ ...@@ -41,7 +41,7 @@ Component({
[678, 1266, 1398, 830, 490, 1666], [678, 1266, 1398, 830, 490, 1666],
], ],
posterUrl: "", //海报url posterUrl: "", //海报url
// imgList noVideoimgList:[]
// imgList:[ // imgList:[
// { // {
// src:`${IMG_URL}index/scene${actNum}1.png`, // src:`${IMG_URL}index/scene${actNum}1.png`,
...@@ -57,6 +57,9 @@ Component({ ...@@ -57,6 +57,9 @@ Component({
`${IMG_URL}index/scene${actNum + 1}4.png`, `${IMG_URL}index/scene${actNum + 1}4.png`,
`${IMG_URL}index/scene${actNum + 1}5.png`, `${IMG_URL}index/scene${actNum + 1}5.png`,
]; ];
this.setData({
noVideoimgList:imgList
});
if (actNum != 2) { if (actNum != 2) {
imgList.push(`${IMG_URL}index/scene${actNum + 1}6.png`); imgList.push(`${IMG_URL}index/scene${actNum + 1}6.png`);
} }
......
...@@ -13,14 +13,15 @@ ...@@ -13,14 +13,15 @@
top: 20%; top: 20%;
left: 50%; left: 50%;
transform: translateX(-50%); transform: translateX(-50%);
width: 225px; // width: 225px;
width: 60%;
height: 311px; height: 311px;
// background-color: red; // background-color: red;
overflow: auto; overflow: auto;
.img { .img {
width: 100%; width: 100%;
// height: auto; // height: auto;
height: 60%; // height: 60%;
background-color: #fff; background-color: #fff;
} }
} }
......
<!-- pages/tab/index/components/shareModel/shareModel.wxml --> <!-- pages/tab/index/components/shareModel/shareModel.wxml -->
<view class="share-wrap" wx:if="{{isShow}}"> <view class="share-wrap" wx:if="{{isShow}}">
<view class="img-wrap"> <view class="img-wrap">
<image class="img" style="height:{{imgHeight}}px" src="{{IMG_URL}}/longpic{{actNum+1}}.png" bindload="onloadFn" /> <!-- <image class="img" style="height:{{imgHeight}}px" src="{{IMG_URL}}/longpic{{actNum+1}}.png" bindload="onloadFn" /> -->
<!-- <block wx:for="{{imgList}}" wx:key="*this"> <block wx:for="{{imgList}}" wx:key="*this">
<image class="img" src="{{item}}"/> <image mode="widthFix" class="img" src="{{item}}"/>
</block> --> </block>
</view> </view>
<button></button> <button></button>
<view class="btns"> <view class="btns">
......
import { IMG_URL } from "~/utils/constantData.js";
var senceData = [ var senceData = [
{ {
name: '新车洽谈场景', name: '新车洽谈场景',
img: 'scene_talk.png', img: 'scene_talk.png',
active: 'icon-car11', active: 'icon-car11',
playImg: 'img1', playImg: 'img1',
src: `${IMG_URL}index/car1.png`,
// name: "新车洽谈场景",
msg: "1.0 新车权益销售",
productList: [ productList: [
{ {
img: 'product-img1', img: 'product-img1',
...@@ -46,6 +51,9 @@ var senceData = [ ...@@ -46,6 +51,9 @@ var senceData = [
img: 'scene_delivery.png', img: 'scene_delivery.png',
active: 'icon-car21', active: 'icon-car21',
playImg: 'img2', playImg: 'img2',
src: `${IMG_URL}index/car2.png`,
// name: "新车交付场景",
msg: "1.1 新车精品升级",
productList: [ productList: [
{ {
img: 'product-img2', img: 'product-img2',
...@@ -72,6 +80,9 @@ var senceData = [ ...@@ -72,6 +80,9 @@ var senceData = [
img: 'scene_within_12mth.png', img: 'scene_within_12mth.png',
active: 'icon-car21', active: 'icon-car21',
playImg: 'img2', playImg: 'img2',
src: `${IMG_URL}index/car3.png`,
// name: "0-12个月",
msg: "1.2 新车线上转化",
productList: [ productList: [
{ {
img: 'product-img3', img: 'product-img3',
...@@ -102,6 +113,9 @@ var senceData = [ ...@@ -102,6 +113,9 @@ var senceData = [
img: 'scene_more_12mth.png', img: 'scene_more_12mth.png',
active: 'icon-car31', active: 'icon-car31',
playImg: 'img3', playImg: 'img3',
src: `${IMG_URL}index/car4.png`,
// name: "12个月以上",
msg: "1.3 存量用户众筹",
productList: [ productList: [
{ {
img: 'product-img5', img: 'product-img5',
......
const navStyle = "background-color: transparent;"; const navStyle = "background-color: transparent;";
import { IMG_URL } from "~/utils/constantData.js"; import { IMG_URL } from "~/utils/constantData.js";
import {senceData} from "./constant/data"; import { senceData } from "./constant/data";
// `${IMG_URL}index/car2.png`, // `${IMG_URL}index/car2.png`,
//本地图片路径 //本地图片路径
let IMG_URLLocal = "../../../images/"; let IMG_URLLocal = "../../../images/";
import {productBysceneApi} from '~/api/index.js'; import { productBysceneApi } from "~/api/index.js";
Page({ Page({
// behaviors: [kfMixin], // behaviors: [kfMixin],
...@@ -41,6 +41,7 @@ Page({ ...@@ -41,6 +41,7 @@ Page({
msg: "1.3 存量用户众筹", msg: "1.3 存量用户众筹",
}, },
], ],
apiData: [],
actNum: 0, //car 场景选择 actNum: 0, //car 场景选择
tabIndx: 1, tabIndx: 1,
navList: ["看线索", "看产品"], navList: ["看线索", "看产品"],
...@@ -162,7 +163,7 @@ Page({ ...@@ -162,7 +163,7 @@ Page({
// tabList: pageData.tabList, // tabList: pageData.tabList,
// 定义数据 // 定义数据
senceData, senceData,
isShow:false, isShow: false,
}, },
//引导图 //引导图
...@@ -300,7 +301,7 @@ Page({ ...@@ -300,7 +301,7 @@ Page({
console.log(name, profit); console.log(name, profit);
this.setData({ this.setData({
[name]: profit, [name]: profit,
[sale]:sales [sale]: sales,
}); });
} }
}); });
...@@ -409,17 +410,52 @@ Page({ ...@@ -409,17 +410,52 @@ Page({
*/ */
onLoad: function (options) { onLoad: function (options) {
// console.log('options: ', options); // console.log('options: ', options);
let {sessionId} = wx.$storage.get() let { sessionId } = wx.$storage.get();
console.log('sessionId: ', sessionId); // console.log("sessionId: ", sessionId);
let param = { let param = {
sessionId sessionId,
} };
// productBysceneApi(param).then((res) => { productBysceneApi(param).then((res) => {
// console.log('res: ', res); let { code, data } = res;
// }) if (code == 0) {
this.setData({
apiData: data,
});
this.compositionData(senceData,this.data.apiData)
this.getFirstSenceIndex()
}
});
}, },
//接口数据,本地数据对接
compositionData(localData, apiData) {
localData.forEach((item, index) => {
apiData.forEach((inner,idx)=>{
if(item.name == inner.stage){
item.sceneStatus = inner.sceneStatus
item.productList.forEach((outChild,outIndex)=>{
inner.productList.forEach((innerChild,innerIndex)=>{
if(outChild.proName == innerChild.productName){
outChild.productStatus = innerChild.productStatus
}
})
})
}
})
})
// console.log('localData, apiData: ', localData);
this.setData({
senceData:localData
})
},
getFirstSenceIndex(){
let actTndex = this.data.apiData.findIndex(item =>item.sceneStatus == 1)
// console.log('actTndex: ', actTndex);
this.setData({
actNum:actTndex
})
},
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
...@@ -535,5 +571,5 @@ Page({ ...@@ -535,5 +571,5 @@ Page({
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
onShareAppMessage: function () {}, onShareAppMessage: function () {},
onShareTimeline:function () {}, onShareTimeline: function () {},
}); });
...@@ -237,13 +237,13 @@ page { ...@@ -237,13 +237,13 @@ page {
.scene { .scene {
margin: 0 10px 16px; margin: 0 10px 16px;
display: flex; display: flex;
justify-content: space-between; // justify-content: space-between;
.item-wrap { .item-wrap {
margin-right: 4px;
position: relative; position: relative;
width: 86px; width: 86px;
height: 90px; height: 90px;
border-radius:10px; border-radius:10px;
} }
.item { .item {
// padding-top: 10px; // padding-top: 10px;
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<!-- 托客户内容 --> <!-- 托客户内容 -->
<view class="content" wx:if="{{tabIndx == 1 }}" hover-class="none" hover-stop-propagation="false"> <view class="content" wx:if="{{tabIndx == 1 }}" hover-class="none" hover-stop-propagation="false">
<view class="scene"> <view class="scene">
<view class="item-wrap {{actNum== index ? 'act':''}}" data-num="{{index}}" bindtap="selectCar" wx:for="{{dataArr}}" wx:key="name"> <view class="item-wrap {{actNum== index ? 'act':''}}" wx:if="{{item.sceneStatus == 1}}" data-num="{{index}}" bindtap="selectCar" wx:for="{{senceData}}" wx:key="name">
<view class="item"> <view class="item">
<image class="img" src="{{item.src}}" /> <image class="img" src="{{item.src}}" />
<view class="name">{{item.name}}</view> <view class="name">{{item.name}}</view>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!