index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  1. <template>
  2. <view class="container" :style="{background:`url(${picUrl+'/static/other/indexB.png'}) no-repeat;`}">
  3. <navBar title="GIGESI 吉格斯" :navImg="navImg" :back="false" color="#333333" background="#FFFFFF" />
  4. <!-- 轮播和订购区 -->
  5. <view class="swiperAndBook">
  6. <view class="tab">
  7. <view class="item" v-for="(item,index) in tabList" :class="[currTabIndex==index?'itemA':'']"
  8. @click="tabChange(item,index)">
  9. {{item}}
  10. </view>
  11. </view>
  12. <view class="bottomBtn">
  13. <swiper :current="currTabIndex" @change="bindChange" class='swiperImg'>
  14. <swiper-item class="swiperImg">
  15. <image class="swiperImg" :src="picBase+bannerList11[0].cover" mode="widthFix"></image>
  16. </swiper-item class="swiperImg">
  17. <swiper-item>
  18. <image class="swiperImg" :src="picBase+bannerList22[0].cover" mode="widthFix"></image>
  19. </swiper-item>
  20. <swiper-item class="swiperImg">
  21. <image class="swiperImg" :src="picBase+bannerList33[0].cover" mode="widthFix"></image>
  22. </swiper-item>
  23. </swiper>
  24. <view class="bookingAndIndicator">
  25. <view class="btn" @click="toList">
  26. <text class="btnTxt">一键定制</text>
  27. <image :src="picUrl+'/static/other/halfRight.png'" mode="" style="width: 30rpx;height: 20rpx;">
  28. </image>
  29. </view>
  30. <view class="indicatorBox">
  31. <view class="indicator">
  32. <view class="indicator__dot" style="" v-for="(item, index) in tabList" :key="index"
  33. :class="[index === currTabIndex ?'indicator__dot--active':'']">
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. <view class="bg" style="">
  41. <view class="controlPart" @click="toPage(1)">
  42. <view class="top">
  43. <view class="left">
  44. <image src="/static/index/part1_icon.png" mode="" style="width: 56rpx;height: 28rpx;">
  45. </image>
  46. <view class="title">
  47. 智能控制系统
  48. </view>
  49. </view>
  50. <image src="/static/index/more.png" mode="" style="width: 48rpx;height: 48rpx;"></image>
  51. </view>
  52. <view class="con">
  53. <image :src="picBase+bannerList44[0].cover" mode="aspectFill"></image>
  54. </view>
  55. </view>
  56. <view class="controlPart" @click="toPage(2)">
  57. <view class="top">
  58. <view class="left">
  59. <image src="/static/index/part1_icon.png" mode="" style="width: 56rpx;height: 28rpx;">
  60. </image>
  61. <view class="title">
  62. 网络规划-全屋WiFi
  63. </view>
  64. </view>
  65. <image src="/static/index/more.png" mode="" style="width: 48rpx;height: 48rpx;"></image>
  66. </view>
  67. <view class="con">
  68. <image :src="picBase+bannerList55[0].cover" mode="aspectFill"></image>
  69. </view>
  70. </view>
  71. <!-- 产品指南 -->
  72. <view class="productLead">
  73. <view class="top" @click="toPage(3)">
  74. <view class="left">
  75. <view class="bottomEng">
  76. PRODUCT GUIDE
  77. </view>
  78. <view class="bt">
  79. <view class="title">
  80. 产品指南
  81. </view>
  82. <image src="/static/index/zhinan.png" mode="" style="width: 32rpx;height: 32rpx;">
  83. </image>
  84. </view>
  85. </view>
  86. <image src="/static/index/more.png" mode="" style="width: 48rpx;height: 48rpx;"></image>
  87. </view>
  88. <view class="con">
  89. <view class="item" v-for="(item,index) in leadList" @click="toLeadDetail(item)">
  90. <image :src="picBase+item.image" mode=""></image>
  91. <view class="bottom">
  92. {{item.title}}
  93. </view>
  94. </view>
  95. </view>
  96. </view>
  97. <!-- 展厅地址 -->
  98. <view class="productLead" style="padding-left: 0;">
  99. <view class="top" style="padding-left: 32rpx;" @click="toAddrList">
  100. <view class="left">
  101. <view class="bottomEng">
  102. ADDRESS
  103. </view>
  104. <view class="bt">
  105. <view class="title">
  106. 城市展厅
  107. </view>
  108. <image src="/static/index/addr.png" mode="" style="width: 26rpx;height: 36rpx;"></image>
  109. </view>
  110. </view>
  111. <image src="/static/index/more.png" mode="" style="width: 48rpx;height: 48rpx;"></image>
  112. </view>
  113. <view class="conLast">
  114. <u-swiper type='def' class="swiper" :defList="bannerList1" keyName="img_url" indicator
  115. indicatorMode="line" :autoplay="true" previousMargin="30" nextMargin="30" height="490rpx"
  116. radius="40rpx" imgMode="scaleToFill" bgColor="rgba(255,255,255,0)" circular
  117. @change="e => currentNum1 = e.current" @click1="jumpLink">
  118. <view slot="indicator">
  119. </view>
  120. <view slot="defCon">
  121. </view>
  122. </u-swiper>
  123. <!-- 自定义轮播图指示器 -->
  124. <view class="indicatorBox1">
  125. <view class="indicator1">
  126. <view class="indicator1__dot1" style="" v-for="(item, index) in bannerList1" :key="index"
  127. :class="[index === currentNum1 ?'indicator1__dot1--active1':'']">
  128. </view>
  129. </view>
  130. </view>
  131. </view>
  132. </view>
  133. <u-loadmore style="" loadmoreText="已经到底啦" color="#CCCCCC" lineColor="#CCCCCC" line />
  134. </view>
  135. <u-loading-page :loading="loading" image="/static/index/logo.png" loading-text="页面加载中..."></u-loading-page>
  136. <!-- 隐私弹框 -->
  137. <privacy-popup @confirmP="confirmP" @cancleP="cancleP" :showPrivateBox="showPop"></privacy-popup>
  138. </view>
  139. </template>
  140. <script>
  141. import PrivacyPopup from "@/components/privacyPopup/index.vue";
  142. import uploadUrl from '@/common/config.js'
  143. import {
  144. getBannerDataReq,
  145. getAddressDataReq,
  146. getGuideDataReq,
  147. } from '@/api/index/index.js'
  148. import {
  149. getPricePercentReq,
  150. getAfterSaleCon,
  151. getIndexTopPics,
  152. addInviteReq
  153. } from '@/api/test/index.js'
  154. export default {
  155. components: {
  156. PrivacyPopup
  157. },
  158. data() {
  159. return {
  160. showPop: false,
  161. picUrl: this.$picUrl,
  162. picBase: this.$picBase,
  163. leadList: [],
  164. bannerList11: [],
  165. bannerList22: [],
  166. bannerList33: [],
  167. bannerList44: [],
  168. bannerList55: [],
  169. bannerList66: [],
  170. bannerList1: [],
  171. currentNum: 0,
  172. currentNum1: 0,
  173. tabList: ['无主灯', '主灯', '吸顶灯'],
  174. currTabIndex: 0,
  175. navImg: require('@/static/index/logo.png'),
  176. list: [],
  177. loading: true
  178. }
  179. },
  180. async onLoad(o) {
  181. // o.inviteId = ''
  182. let res55 = await getBannerDataReq()
  183. if (res55.code == 0) {
  184. console.log('首页全局配置数据:', res55);
  185. this.bannerList11 = [res55.data.find((item, index) => {
  186. return item.title == '无主灯'
  187. })]
  188. this.bannerList22 = [res55.data.find((item, index) => {
  189. return item.title == '主灯'
  190. })]
  191. this.bannerList33 = [res55.data.find((item, index) => {
  192. return item.title == '吸顶灯'
  193. })]
  194. this.bannerList44 = [res55.data.find((item, index) => {
  195. return item.title == '智能控制系统'
  196. })]
  197. this.bannerList55 = [res55.data.find((item, index) => {
  198. return item.title == '网络规划-全屋WiFi'
  199. })]
  200. console.log('全局静态资源数据', this.bannerList11, this.bannerList22, this.bannerList33, this
  201. .bannerList44, this.bannerList55);
  202. this.loading = false
  203. } else {
  204. this.loading = false
  205. this.$toast(res55.message)
  206. }
  207. if (o.inviteId) {
  208. uni.setStorageSync('inviteId', o.inviteId)
  209. console.log('接收到的o.inviteId', o.inviteId);
  210. }
  211. if (o.scene) {
  212. uni.setStorageSync('afterSaleId', o.scene)
  213. console.log('接收到的o.afterSaleId', o.scene);
  214. }
  215. // o.scene = 'b3f48188b03b54aeb32256c825044e35'
  216. if (uni.getStorageSync('token') && o.scene) {
  217. let res88 = await getAfterSaleCon({
  218. id: o.scene
  219. })
  220. if (res88.code == 0) {
  221. console.log('测试邀请:', res88);
  222. } else {
  223. this.$toast(res88.message)
  224. }
  225. }
  226. if (uni.getStorageSync('token') && o.inviteId) {
  227. let res99 = await addInviteReq({
  228. // id: o.inviteId
  229. inviteId: o.inviteId
  230. })
  231. if (res99.code == 0) {
  232. console.log('测试邀请登录态-----o.inviteId:', res99);
  233. } else {
  234. this.$toast(res99.message)
  235. }
  236. }
  237. console.log('首页收到的o:', JSON.stringify(o));
  238. let res1 = await getAddressDataReq()
  239. if (res1.code == 0) {
  240. this.bannerList1 = res1.data
  241. console.log('地址轮播图数据', this.bannerList1);
  242. } else {
  243. this.$toast(res1.message)
  244. }
  245. let res2 = await getGuideDataReq()
  246. if (res2.code == 0) {
  247. this.leadList = res2.data
  248. console.log('首页产品指南列表返回值:', this.leadList);
  249. } else {
  250. uni.showToast({
  251. title: res2.message,
  252. icon: 'none'
  253. })
  254. }
  255. },
  256. onShow() {
  257. this.handlePrivate()
  258. if (!uni.getStorageSync('switchs')) {
  259. uni.setStorageSync('switchs', [1, 0, 0])
  260. }
  261. // if (!uni.getStorageSync('priceConfig')) {
  262. uni.request({
  263. url: uploadUrl.baseUrl + '/api/common/getPriceConfig',
  264. method: "GET",
  265. success: (res) => {
  266. if (res.data.code == 0) {
  267. console.log('index中获取的会员折扣数据', res.data.data)
  268. uni.setStorageSync('priceConfig', res.data.data)
  269. }
  270. }
  271. })
  272. // }
  273. },
  274. methods: {
  275. confirmP() {
  276. this.showPop = false
  277. uni.showTabBar({
  278. animation: true, // 是否需要滚动动画,默认false
  279. success: function(res) {
  280. }
  281. })
  282. },
  283. cancleP() {
  284. console.log('cancelP()------');
  285. this.showPop = false
  286. uni.showTabBar({
  287. animation: true, // 是否需要滚动动画,默认false
  288. success: function(res) {
  289. }
  290. })
  291. },
  292. handlePrivate() {
  293. uni.hideTabBar()
  294. let _this = this
  295. if (uni.getPrivacySetting) {
  296. uni.getPrivacySetting({
  297. success: res => {
  298. console.log("是否需要授权--首页:", res.needAuthorization, "隐私协议的名称为:", res
  299. .privacyContractName)
  300. if (res.needAuthorization) {
  301. getApp().globalData.showPrivacy = true;
  302. _this.showPop = true
  303. } else {
  304. getApp().globalData.showPrivacy = false;
  305. uni.showTabBar()
  306. }
  307. },
  308. fail: () => {},
  309. complete: () => {},
  310. })
  311. }
  312. },
  313. bindChange(e) {
  314. this.currTabIndex = e.detail.current
  315. console.log('e-----------', e.detail.current);
  316. },
  317. tabChange(item, index) {
  318. this.currTabIndex = index
  319. },
  320. toAddrList() {
  321. uni.navigateTo({
  322. url: '/pages/index/addrList/index'
  323. })
  324. },
  325. toLeadDetail(item) {
  326. getApp().Litem = item
  327. uni.navigateTo({
  328. url: '/pages/index/productLeadDetail/index'
  329. })
  330. },
  331. toList() {
  332. if (this.currTabIndex == 0) {
  333. getApp().noMainImg = this.bannerList11[0]
  334. uni.navigateTo({
  335. url: '/pages/index/customNoMian_step1/index'
  336. })
  337. } else if (this.currTabIndex == 1) {
  338. getApp().noMainImg = this.bannerList22[0]
  339. uni.navigateTo({
  340. url: '/pages/index/customMian_step1/index'
  341. })
  342. } else {
  343. getApp().noMainImg = this.bannerList33[0]
  344. uni.navigateTo({
  345. url: '/pages/index/customMian_step1/index?type=5'
  346. })
  347. }
  348. },
  349. toPage(i) {
  350. if (i == 2) {
  351. getApp().noMainImg = this.bannerList55[0]
  352. uni.navigateTo({
  353. url: '/pages/index/fullHouseWifi/index'
  354. })
  355. } else if (i == 1) {
  356. getApp().noMainImg = this.bannerList44[0]
  357. uni.navigateTo({
  358. url: '/pages/index/aiControlSys/index'
  359. })
  360. } else {
  361. uni.navigateTo({
  362. url: '/pages/index/productLead/index'
  363. })
  364. }
  365. },
  366. async testReq() {
  367. let res = await getBannerDataReq()
  368. this.$toast(res.msg)
  369. console.log('返回值', res);
  370. }
  371. }
  372. }
  373. </script>
  374. <style lang="scss" scoped>
  375. @import "./index.scss";
  376. </style>