index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674
  1. <template>
  2. <view class="page">
  3. <navBar title="智能控制系统" :back="true" color="black" background="white" />
  4. <image :src="picBase+topPic" mode="" class="topBg"></image>
  5. <view class="content">
  6. <view class="topBox">
  7. <view class="lTxt">
  8. <image src="/static/index/water.png" mode="" class="water1"></image>
  9. <view class="main">
  10. <image src="/static/index/halfCircle_275.png" mode="" style="width: 56rpx;height: 56rpx;">
  11. </image>
  12. <text style="z-index: 3;position: relative;">定制我家的智能控制</text>
  13. </view>
  14. </view>
  15. <view class="rDes" @click="toRule">
  16. <view class="con">
  17. 详情
  18. </view>
  19. <image :src="picUrl+'/static/other/halfRight_b.png'" mode="" style="width: 25rpx;height: 15rpx;">
  20. </image>
  21. </view>
  22. </view>
  23. <view class="label" @click="handleOpenOrClose(1)"
  24. :style="{'margin-bottom':addOrLessIcon1=='/static/index/shortLine.png'?'32rpx':'0'}">
  25. <view class="txt">
  26. 户型
  27. </view>
  28. <image :src="addOrLessIcon1" mode="" class="" :style="{height:addOrLessIcon1=='/static/index/shortLine.png'
  29. ?'2rpx':'22rpx'}" style="width: 22rpx;margin-right: 56rpx;">
  30. </image>
  31. </view>
  32. <view class="parms">
  33. <view v-if="show1" @click="sel('hx', item, index)" class="item "
  34. :class="[currHouseIndex==index?'act':'']" v-for="(item,index) in houseTypeList">
  35. {{item.value}}
  36. </view>
  37. </view>
  38. <view class="label" @click="handleOpenOrClose(2)"
  39. :style="{'margin-bottom':addOrLessIcon2=='/static/index/shortLine.png'?'32rpx':'0'}">
  40. <view class="txt">
  41. 生态-品牌
  42. </view>
  43. <image :src="addOrLessIcon2" mode="" class="" :style="{height:addOrLessIcon2=='/static/index/shortLine.png'
  44. ?'2rpx':'22rpx'}" style="width: 22rpx;margin-right: 56rpx;">
  45. </image>
  46. </view>
  47. <view class="parms">
  48. <view v-if="show2" @click="sel('pp', item, index)" class="item "
  49. :class="[currHouseIndex1==index?'act':'']" v-for="(item,index) in brandTypeList">
  50. {{item.value}}
  51. </view>
  52. </view>
  53. <view class="label" @click="handleOpenOrClose(3)"
  54. :style="{'margin-bottom':addOrLessIcon3=='/static/index/shortLine.png'?'32rpx':'0'}">
  55. <view class="txt">
  56. 智能锁
  57. </view>
  58. <image :src="addOrLessIcon3" mode="" class="" :style="{height:addOrLessIcon3=='/static/index/shortLine.png'
  59. ?'2rpx':'22rpx'}" style="width: 22rpx;margin-right: 56rpx;">
  60. </image>
  61. </view>
  62. <view class="parms">
  63. <view v-if="show3" @click="sel('suo', item, index)" class="item "
  64. :class="[currHouseIndex2==index?'act':'']" v-for="(item,index) in lockTypeList">
  65. {{item.value}}
  66. </view>
  67. </view>
  68. <view class="label" @click="handleOpenOrClose(4)"
  69. :style="{'margin-bottom':addOrLessIcon4=='/static/index/shortLine.png'?'32rpx':'0'}">
  70. <view class="txt">
  71. 智能面板
  72. </view>
  73. <image :src="addOrLessIcon4" mode="" class="" :style="{height:addOrLessIcon4=='/static/index/shortLine.png'
  74. ?'2rpx':'22rpx'}" style="width: 22rpx;margin-right: 56rpx;">
  75. </image>
  76. </view>
  77. <view class="parms">
  78. <view v-if="show4" @click="sel('mb', item, index)" class="item "
  79. :class="[currHouseIndex3==index?'act':'']" v-for="(item,index) in pannelTypeList">
  80. {{item.value}}
  81. </view>
  82. </view>
  83. <view class="label" @click="handleOpenOrClose(5)"
  84. :style="{'margin-bottom':addOrLessIcon5=='/static/index/shortLine.png'?'32rpx':'0'}">
  85. <view class="txt">
  86. 智能窗帘
  87. </view>
  88. <image :src="addOrLessIcon5" mode="" class="" :style="{height:addOrLessIcon5=='/static/index/shortLine.png'
  89. ?'2rpx':'22rpx'}" style="width: 22rpx;margin-right: 56rpx;">
  90. </image>
  91. </view>
  92. <view class="parms">
  93. <view v-if="show5" @click="sel('cl', item, index)" class="item "
  94. :class="[currHouseIndex4==index?'act':'']" v-for="(item,index) in chuanglianTypeList">
  95. {{item.value}}
  96. </view>
  97. </view>
  98. <view class="label" @click="handleOpenOrClose(6)"
  99. :style="{'margin-bottom':addOrLessIcon6=='/static/index/shortLine.png'?'32rpx':'0'}">
  100. <view class="txt">
  101. 智能空调
  102. </view>
  103. <image :src="addOrLessIcon6" mode="" class="" :style="{height:addOrLessIcon6=='/static/index/shortLine.png'
  104. ?'2rpx':'22rpx'}" style="width: 22rpx;margin-right: 56rpx;">
  105. </image>
  106. </view>
  107. <view class="parms">
  108. <view v-if="show6" @click="sel('kt', item, index)" class="item "
  109. :class="[currHouseIndex5==index?'act':'']" v-for="(item,index) in ktTypeList">
  110. {{item.value}}
  111. </view>
  112. </view>
  113. </view>
  114. <view class="bot">
  115. <view class="left" @click="showConfig=true">
  116. <view class="price">
  117. ¥{{totalPrice.toFixed(0)}}
  118. </view>
  119. <image src="/static/index/arrDown.png" mode=""></image>
  120. </view>
  121. <view class="right" @click="toNext">
  122. 预览配置
  123. </view>
  124. </view>
  125. <u-popup :show="showConfig" @close="close" @open="open" round='10'>
  126. <view class="topBar" style="">
  127. <view class="left">
  128. </view>
  129. <view class="cen">
  130. 清单
  131. </view>
  132. <view class="close" @click="showConfig=false">
  133. <u-icon name="close"></u-icon>
  134. </view>
  135. </view>
  136. <view class="pupopCon">
  137. <view class="item" v-if="selHx">
  138. <view class="top">
  139. <view class="name">
  140. 户型
  141. </view>
  142. <view class="info">
  143. {{selHx.value}}
  144. </view>
  145. </view>
  146. </view>
  147. <view class="item">
  148. <view class="top" v-if="selPp">
  149. <view class="name">
  150. 品牌
  151. </view>
  152. <view class="info">
  153. {{selPp.value}}
  154. </view>
  155. </view>
  156. <view class="top" v-if="selSuo">
  157. <view class="name">
  158. 智能锁
  159. </view>
  160. <view class="info">
  161. {{selSuo.value}}
  162. </view>
  163. </view>
  164. <view class="top" v-if="selMb">
  165. <view class="name">
  166. 智能开关
  167. </view>
  168. <view class="info">
  169. {{selMb.value}}
  170. </view>
  171. </view>
  172. <view class="top" v-if="selCl">
  173. <view class="name">
  174. 智能窗帘
  175. </view>
  176. <view class="info">
  177. {{selCl.value}}
  178. </view>
  179. </view>
  180. <view class="top" v-if="selKt">
  181. <view class="name">
  182. 智能空调
  183. </view>
  184. <view class="info">
  185. {{selKt.value}}
  186. </view>
  187. </view>
  188. </view>
  189. </view>
  190. </u-popup>
  191. </view>
  192. </template>
  193. <script>
  194. import {
  195. getIndexConfigReq,
  196. getHomeDataNextReq
  197. } from '@/api/test/index.js'
  198. import {
  199. getDataMoneyReq
  200. } from '@/api/index/index.js'
  201. export default {
  202. components: {
  203. },
  204. data() {
  205. return {
  206. picUrl: this.$picUrl,
  207. picBase: this.$picBase,
  208. addOrLessIcon1: '/static/index/shortLine.png',
  209. addOrLessIcon2: '/static/index/shortLine.png',
  210. addOrLessIcon3: '/static/index/shortLine.png',
  211. addOrLessIcon4: '/static/index/shortLine.png',
  212. addOrLessIcon5: '/static/index/shortLine.png',
  213. addOrLessIcon6: '/static/index/shortLine.png',
  214. show1: true,
  215. show2: true,
  216. show3: true,
  217. show4: true,
  218. show5: true,
  219. show6: true,
  220. showConfig: false,
  221. currHouseIndex: -1,
  222. currHouseIndex1: -1,
  223. currHouseIndex2: -1,
  224. currHouseIndex3: -1,
  225. currHouseIndex4: -1,
  226. currHouseIndex5: -1,
  227. houseTypeList: [],
  228. brandTypeList: [
  229. ],
  230. lockTypeList: [
  231. ],
  232. pannelTypeList: [
  233. ],
  234. chuanglianTypeList: [
  235. ],
  236. ktTypeList: [
  237. ],
  238. rule: null,
  239. totalPrice: 0,
  240. selHx: null,
  241. selPp: null,
  242. selSuo: null,
  243. selMb: null,
  244. selCl: null,
  245. selKt: null,
  246. pConfig: -1,
  247. cutdownRatio: 1,
  248. topPic: ''
  249. }
  250. },
  251. async onLoad(options) {
  252. this.topPic = getApp().noMainImg.head_image
  253. console.log('3this.topPic', this.topPic);
  254. let res = await getIndexConfigReq({
  255. type: 3
  256. })
  257. if (res.code == 0) {
  258. console.log('获取首页配置返回值-智控: ', res);
  259. this.houseTypeList = res.data.house_type
  260. this.brandTypeList = res.data.brand
  261. this.lockTypeList = res.data.mind_lock
  262. this.pannelTypeList = res.data.mind_switch
  263. this.chuanglianTypeList = res.data.mind_curtain
  264. this.ktTypeList = res.data.mind_air_conditioner
  265. this.rule = res.data.rule.content
  266. // this.selHx = res.data.house_type[0]
  267. // this.selPp = res.data.brand[0]
  268. // this.selSuo = res.data.mind_lock[0]
  269. // this.selMb = res.data.mind_switch[0]
  270. // this.selCl = res.data.mind_curtain[0]
  271. // this.selKt = res.data.mind_air_conditioner[0]
  272. // this.getPrice(3, this.selHx.id, this.selPp.id, this.selSuo.id, this.selMb.id, this.selCl.id, this.selKt
  273. // .id)
  274. }
  275. },
  276. onShow() {
  277. this.cutdownRatio = this.$getCutDown()
  278. },
  279. methods: {
  280. async sel(type, item, index) {
  281. if (type == 'hx') {
  282. this.currHouseIndex = -1
  283. this.currHouseIndex1 = -1
  284. this.currHouseIndex2 = -1
  285. this.currHouseIndex3 = -1
  286. this.currHouseIndex4 = -1
  287. this.currHouseIndex5 = -1
  288. this.selHx = null,
  289. this.selPp = null,
  290. this.selSuo = null,
  291. this.selMb = null,
  292. this.selCl = null,
  293. this.selKt = null,
  294. this.currHouseIndex = index
  295. this.selHx = item
  296. let p = {
  297. type: 3,
  298. house_type: this.selHx.id
  299. }
  300. if (this.selHx && this.selPp && this.selSuo && this.selMb && this.selCl && this.selKt) {
  301. this.getPrice(p)
  302. } else {
  303. this.totalPrice = 0
  304. }
  305. let res = await getHomeDataNextReq(p)
  306. if (res.code == 0) {
  307. this.brandTypeList = res.data.brand
  308. this.lockTypeList = res.data.mind_lock
  309. this.pannelTypeList = res.data.mind_switch
  310. this.chuanglianTypeList = res.data.mind_curtain
  311. this.ktTypeList = res.data.mind_air_conditioner
  312. } else {
  313. uni.showToast({
  314. title: res.message,
  315. icon: 'none'
  316. })
  317. }
  318. } else if (type == 'pp') {
  319. if (!this.selHx) {
  320. return this.$toast('请先选择户型')
  321. }
  322. this.currHouseIndex1 = -1
  323. this.currHouseIndex2 = -1
  324. this.currHouseIndex3 = -1
  325. this.currHouseIndex4 = -1
  326. this.currHouseIndex5 = -1
  327. this.selPp = null,
  328. this.selSuo = null,
  329. this.selMb = null,
  330. this.selCl = null,
  331. this.selKt = null,
  332. this.currHouseIndex1 = index
  333. this.selPp = item
  334. let p = {
  335. type: 3,
  336. house_type: this.selHx.id,
  337. brand: this.selPp.id
  338. }
  339. if (this.selHx && this.selPp && this.selSuo && this.selMb && this.selCl && this.selKt) {
  340. this.getPrice(p)
  341. } else {
  342. this.totalPrice = 0
  343. }
  344. let res = await getHomeDataNextReq(p)
  345. if (res.code == 0) {
  346. this.lockTypeList = res.data.mind_lock
  347. this.pannelTypeList = res.data.mind_switch
  348. this.chuanglianTypeList = res.data.mind_curtain
  349. this.ktTypeList = res.data.mind_air_conditioner
  350. } else {
  351. uni.showToast({
  352. title: res.message,
  353. icon: 'none'
  354. })
  355. }
  356. } else if (type == 'suo') {
  357. if (!this.selHx) {
  358. return this.$toast('请先选择户型')
  359. } else if (!this.selPp) {
  360. return this.$toast('请先选择品牌')
  361. }
  362. this.currHouseIndex2 = -1
  363. this.currHouseIndex3 = -1
  364. this.currHouseIndex4 = -1
  365. this.currHouseIndex5 = -1
  366. this.selSuo = null,
  367. this.selMb = null,
  368. this.selCl = null,
  369. this.selKt = null,
  370. this.currHouseIndex2 = index
  371. this.selSuo = item
  372. let p = {
  373. type: 3,
  374. house_type: this.selHx.id,
  375. brand: this.selPp.id,
  376. mind_lock: this.selSuo.id,
  377. }
  378. if (this.selHx && this.selPp && this.selSuo && this.selMb && this.selCl && this.selKt) {
  379. this.getPrice(p)
  380. } else {
  381. this.totalPrice = 0
  382. }
  383. let res = await getHomeDataNextReq(p)
  384. if (res.code == 0) {
  385. this.pannelTypeList = res.data.mind_switch
  386. this.chuanglianTypeList = res.data.mind_curtain
  387. this.ktTypeList = res.data.mind_air_conditioner
  388. } else {
  389. uni.showToast({
  390. title: res.message,
  391. icon: 'none'
  392. })
  393. }
  394. } else if (type == 'mb') {
  395. if (!this.selHx) {
  396. return this.$toast('请先选择户型')
  397. } else if (!this.selPp) {
  398. return this.$toast('请先选择品牌')
  399. } else if (!this.selSuo) {
  400. return this.$toast('请先选择智能锁')
  401. }
  402. this.currHouseIndex3 = -1
  403. this.currHouseIndex4 = -1
  404. this.currHouseIndex5 = -1
  405. this.selMb = null,
  406. this.selCl = null,
  407. this.selKt = null,
  408. this.currHouseIndex3 = index
  409. this.selMb = item
  410. let p = {
  411. type: 3,
  412. house_type: this.selHx.id,
  413. brand: this.selPp.id,
  414. mind_lock: this.selSuo.id,
  415. mind_switch: this.selMb.id,
  416. }
  417. if (this.selHx && this.selPp && this.selSuo && this.selMb && this.selCl && this.selKt) {
  418. this.getPrice(p)
  419. } else {
  420. this.totalPrice = 0
  421. }
  422. let res = await getHomeDataNextReq(p)
  423. if (res.code == 0) {
  424. this.chuanglianTypeList = res.data.mind_curtain
  425. this.ktTypeList = res.data.mind_air_conditioner
  426. } else {
  427. uni.showToast({
  428. title: res.message,
  429. icon: 'none'
  430. })
  431. }
  432. } else if (type == 'cl') {
  433. if (!this.selHx) {
  434. return this.$toast('请先选择户型')
  435. } else if (!this.selPp) {
  436. return this.$toast('请先选择品牌')
  437. } else if (!this.selSuo) {
  438. return this.$toast('请先选择智能锁')
  439. } else if (!this.selMb) {
  440. return this.$toast('请先选择智能面板')
  441. }
  442. this.currHouseIndex4 = -1
  443. this.currHouseIndex5 = -1
  444. this.selCl = null,
  445. this.selKt = null,
  446. this.currHouseIndex4 = index
  447. this.selCl = item
  448. let p = {
  449. type: 3,
  450. house_type: this.selHx.id,
  451. brand: this.selPp.id,
  452. mind_lock: this.selSuo.id,
  453. mind_switch: this.selMb.id,
  454. mind_curtain: this.selCl.id,
  455. }
  456. if (this.selHx && this.selPp && this.selSuo && this.selMb && this.selCl && this.selKt) {
  457. this.getPrice(p)
  458. } else {
  459. this.totalPrice = 0
  460. }
  461. let res = await getHomeDataNextReq(p)
  462. if (res.code == 0) {
  463. this.ktTypeList = res.data.mind_air_conditioner
  464. } else {
  465. uni.showToast({
  466. title: res.message,
  467. icon: 'none'
  468. })
  469. }
  470. } else if (type == 'kt') {
  471. if (!this.selHx) {
  472. return this.$toast('请先选择户型')
  473. } else if (!this.selPp) {
  474. return this.$toast('请先选择品牌')
  475. } else if (!this.selSuo) {
  476. return this.$toast('请先选择智能锁')
  477. } else if (!this.selMb) {
  478. return this.$toast('请先选择智能面板')
  479. } else if (!this.selCl) {
  480. return this.$toast('请先选择智能窗帘')
  481. }
  482. this.currHouseIndex5 = -1
  483. this.selKt = null,
  484. this.currHouseIndex5 = index
  485. this.selKt = item
  486. let p = {
  487. type: 3,
  488. house_type: this.selHx.id,
  489. brand: this.selPp.id,
  490. mind_lock: this.selSuo.id,
  491. mind_switch: this.selMb.id,
  492. mind_curtain: this.selCl.id,
  493. mind_air_conditioner: this.selKt.id,
  494. }
  495. if (this.selHx && this.selPp && this.selSuo && this.selMb && this.selCl && this.selKt) {
  496. this.getPrice(p)
  497. } else {
  498. this.totalPrice = 0
  499. }
  500. let res = await getHomeDataNextReq(p)
  501. if (res.code == 0) {
  502. // this.ktTypeList = res.data.mind_air_conditioner
  503. } else {
  504. uni.showToast({
  505. title: res.message,
  506. icon: 'none'
  507. })
  508. }
  509. }
  510. // this.getPrice(prmas)
  511. },
  512. async getPrice(prmas) {
  513. let res = await getDataMoneyReq(prmas)
  514. if (res.code == 0) {
  515. console.log('配置价格-智控: ', res)
  516. this.totalPrice = res.data.money * this.cutdownRatio
  517. this.pConfig = res.data.id
  518. } else {
  519. uni.showToast({
  520. title: res.message,
  521. icon: 'none'
  522. })
  523. }
  524. },
  525. toRule() {
  526. getApp().content = this.rule
  527. uni.navigateTo({
  528. url: '/pages/index/rule/index?type=ctrl'
  529. })
  530. },
  531. toNext() {
  532. if (this.houseTypeList.length == 0 || this.brandTypeList.length == 0 || this.lockTypeList.length == 0 ||
  533. this.pannelTypeList.length == 0 || this.chuanglianTypeList.length == 0 || this.ktTypeList.length == 0
  534. ) {
  535. return this.$toast('抱歉!参数配置缺失,暂无法预览配置')
  536. }
  537. // if (!(this.selHx && this.selSuo && this.selPp && this.selMb && this.selCl && this.selKt)) {
  538. // return this.$toast('请全部选择后预览配置')
  539. // }
  540. if (!this.selHx) {
  541. return this.$toast('请选择户型')
  542. }
  543. if (!this.selPp) {
  544. return this.$toast('请选择品牌')
  545. }
  546. if (!this.selSuo) {
  547. return this.$toast('请选择智能锁')
  548. }
  549. if (!this.selMb) {
  550. return this.$toast('请选择智能面板')
  551. }
  552. if (!this.selCl) {
  553. return this.$toast('请选择智能窗帘')
  554. }
  555. if (!this.selKt) {
  556. return this.$toast('请选择智能空调')
  557. }
  558. getApp().selHx = this.selHx
  559. getApp().selPp = this.selPp
  560. getApp().selSuo = this.selSuo
  561. getApp().selMb = this.selMb
  562. getApp().selCl = this.selCl
  563. getApp().selKt = this.selKt
  564. getApp().totalPrice = this.totalPrice
  565. getApp().pConfig = this.pConfig
  566. uni.navigateTo({
  567. url: '/pages/index/aiControlSys_step2/index'
  568. })
  569. },
  570. handleOpenOrClose(i) {
  571. if (this['addOrLessIcon' + i] == '/static/index/shortLine.png') {
  572. this['addOrLessIcon' + i] = '/static/index/add.png'
  573. this['show' + i] = false
  574. } else if (this['addOrLessIcon' + i] == '/static/index/add.png') {
  575. this['addOrLessIcon' + i] = '/static/index/shortLine.png'
  576. this['show' + i] = true
  577. }
  578. },
  579. }
  580. }
  581. </script>
  582. <style lang="scss" scoped>
  583. @import "./index.scss";
  584. </style>