index.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399
  1. <template>
  2. <view class="page">
  3. <navBar title="智能控制系统" :back="true" color="black" background="white" />
  4. <image :src="picUrl + '/static/other/c1.png'" 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">
  16. <view class="con">
  17. 详情
  18. </view>
  19. <image src="/static/index/halfRight.png" mode="" style="width: 24rpx;height: 8rpx;">
  20. </image>
  21. </view>
  22. </view>
  23. <view class="label" @click="handleOpenOrClose(1)">
  24. <view class="txt">
  25. 户型
  26. </view>
  27. <image :src="addOrLessIcon1" mode="" class="" :style="{height:addOrLessIcon1=='/static/index/shortLine.png'
  28. ?'2rpx':'22rpx'}" style="width: 22rpx;margin-right: 56rpx;">
  29. </image>
  30. </view>
  31. <view class="parms">
  32. <view v-if="show1" @click="sel('hx', item, index)" class="item "
  33. :class="[currHouseIndex==index?'act':'']" v-for="(item,index) in houseTypeList">
  34. {{item.value}}
  35. </view>
  36. </view>
  37. <view class="label" @click="handleOpenOrClose(2)">
  38. <view class="txt">
  39. 生态-品牌
  40. </view>
  41. <image :src="addOrLessIcon2" mode="" class="" :style="{height:addOrLessIcon2=='/static/index/shortLine.png'
  42. ?'2rpx':'22rpx'}" style="width: 22rpx;margin-right: 56rpx;">
  43. </image>
  44. </view>
  45. <view class="parms">
  46. <view v-if="show2" @click="sel('pp', item, index)" class="item "
  47. :class="[currHouseIndex1==index?'act':'']" v-for="(item,index) in brandTypeList">
  48. {{item.value}}
  49. </view>
  50. </view>
  51. <view class="label" @click="handleOpenOrClose(3)">
  52. <view class="txt">
  53. 智能锁
  54. </view>
  55. <image :src="addOrLessIcon3" mode="" class="" :style="{height:addOrLessIcon3=='/static/index/shortLine.png'
  56. ?'2rpx':'22rpx'}" style="width: 22rpx;margin-right: 56rpx;">
  57. </image>
  58. </view>
  59. <view class="parms">
  60. <view v-if="show3" @click="sel('suo', item, index)" class="item "
  61. :class="[currHouseIndex2==index?'act':'']" v-for="(item,index) in lockTypeList">
  62. {{item.value}}
  63. </view>
  64. </view>
  65. <view class="label" @click="handleOpenOrClose(4)">
  66. <view class="txt">
  67. 智能面板
  68. </view>
  69. <image :src="addOrLessIcon4" mode="" class="" :style="{height:addOrLessIcon4=='/static/index/shortLine.png'
  70. ?'2rpx':'22rpx'}" style="width: 22rpx;margin-right: 56rpx;">
  71. </image>
  72. </view>
  73. <view class="parms">
  74. <view v-if="show4" @click="sel('mb', item, index)" class="item "
  75. :class="[currHouseIndex3==index?'act':'']" v-for="(item,index) in pannelTypeList">
  76. {{item.value}}
  77. </view>
  78. </view>
  79. <view class="label" @click="handleOpenOrClose(5)">
  80. <view class="txt">
  81. 智能窗帘
  82. </view>
  83. <image :src="addOrLessIcon5" mode="" class="" :style="{height:addOrLessIcon5=='/static/index/shortLine.png'
  84. ?'2rpx':'22rpx'}" style="width: 22rpx;margin-right: 56rpx;">
  85. </image>
  86. </view>
  87. <view class="parms">
  88. <view v-if="show5" @click="sel('cl', item, index)" class="item "
  89. :class="[currHouseIndex4==index?'act':'']" v-for="(item,index) in chuanglianTypeList">
  90. {{item.value}}
  91. </view>
  92. </view>
  93. <view class="label" @click="handleOpenOrClose(6)">
  94. <view class="txt">
  95. 智能空调
  96. </view>
  97. <image :src="addOrLessIcon6" mode="" class="" :style="{height:addOrLessIcon6=='/static/index/shortLine.png'
  98. ?'2rpx':'22rpx'}" style="width: 22rpx;margin-right: 56rpx;">
  99. </image>
  100. </view>
  101. <view class="parms">
  102. <view v-if="show6" @click="sel('kt', item, index)" class="item "
  103. :class="[currHouseIndex5==index?'act':'']" v-for="(item,index) in ktTypeList">
  104. {{item.value}}
  105. </view>
  106. </view>
  107. </view>
  108. <view class="rule" @click="toRule">
  109. <image src="/static/index/ruleImg.png" mode=""></image>
  110. <view class="txt">
  111. 挑选规则
  112. </view>
  113. </view>
  114. <view class="bot">
  115. <view class="left" @click="showConfig=true">
  116. <view class="price">
  117. ¥{{totalPrice.toFixed(2)}}
  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">
  138. <view class="top">
  139. <view class="name">
  140. 户型
  141. </view>
  142. <view class="info">
  143. 一室两厅
  144. </view>
  145. </view>
  146. </view>
  147. <view class="item">
  148. <view class="top">
  149. <view class="name">
  150. 类别
  151. </view>
  152. <view class="info">
  153. 3系
  154. </view>
  155. </view>
  156. <view class="bottom">
  157. <view class="name">
  158. 智能锁
  159. </view>
  160. <view class="info">
  161. 1
  162. </view>
  163. </view>
  164. <view class="bottom">
  165. <view class="name">
  166. 智能开关
  167. </view>
  168. <view class="info">
  169. 1
  170. </view>
  171. </view>
  172. <view class="bottom">
  173. <view class="name">
  174. 智能窗帘
  175. </view>
  176. <view class="info">
  177. 2
  178. </view>
  179. </view>
  180. </view>
  181. <view class="item">
  182. <view class="top">
  183. <view class="name">
  184. 品牌
  185. </view>
  186. <view class="info">
  187. 启源
  188. </view>
  189. </view>
  190. </view>
  191. </view>
  192. </u-popup>
  193. </view>
  194. </template>
  195. <script>
  196. import {
  197. getIndexConfigReq,
  198. } from '@/api/test/index.js'
  199. import {
  200. getDataMoneyReq
  201. } from '@/api/index/index.js'
  202. export default {
  203. components: {
  204. },
  205. data() {
  206. return {
  207. picUrl: this.$picUrl,
  208. picBase: this.$picBase,
  209. addOrLessIcon1: '/static/index/add.png',
  210. addOrLessIcon2: '/static/index/add.png',
  211. addOrLessIcon3: '/static/index/add.png',
  212. addOrLessIcon4: '/static/index/add.png',
  213. addOrLessIcon5: '/static/index/add.png',
  214. addOrLessIcon6: '/static/index/add.png',
  215. show1: false,
  216. show2: false,
  217. show3: false,
  218. show4: false,
  219. show5: false,
  220. show6: false,
  221. showConfig: false,
  222. currHouseIndex: 0,
  223. currHouseIndex1: 0,
  224. currHouseIndex2: 0,
  225. currHouseIndex3: 0,
  226. currHouseIndex4: 0,
  227. currHouseIndex5: 0,
  228. houseTypeList: [],
  229. brandTypeList: [
  230. ],
  231. lockTypeList: [
  232. ],
  233. pannelTypeList: [
  234. ],
  235. chuanglianTypeList: [
  236. ],
  237. ktTypeList: [
  238. ],
  239. rule: null,
  240. totalPrice: 0,
  241. selHx: null,
  242. selPp: [],
  243. selSuo: null,
  244. selMb: [],
  245. selCl: [],
  246. selkt: [],
  247. pConfig: -1
  248. }
  249. },
  250. async onLoad(options) {
  251. let res = await getIndexConfigReq({
  252. type: 3
  253. })
  254. if (res.code == 0) {
  255. console.log('获取首页配置返回值-智控: ', res);
  256. this.houseTypeList = res.data.house_type
  257. this.brandTypeList = res.data.brand
  258. this.lockTypeList = res.data.mind_lock
  259. this.pannelTypeList = res.data.mind_switch
  260. this.chuanglianTypeList = res.data.mind_curtain
  261. this.ktTypeList = res.data.mind_air_conditioner
  262. // this.rule = res.data.rule.content
  263. this.selHx = res.data.house_type[0]
  264. this.selPp = res.data.brand[0]
  265. this.selSuo = res.data.mind_lock[0]
  266. this.selMb = res.data.mind_switch[0]
  267. this.selCl = res.data.mind_curtain[0]
  268. this.selKt = res.data.mind_air_conditioner[0]
  269. this.getPrice(3, this.selHx.id, this.selPp.id, this.selSuo.id, this.selMb.id, this.selCl.id, this.selKt
  270. .id)
  271. }
  272. },
  273. methods: {
  274. sel(type, item, index) {
  275. if (type == 'hx') {
  276. this.currHouseIndex = index
  277. this.selHx = item
  278. } else if (type == 'pp') {
  279. this.currHouseIndex1 = index
  280. this.selPp = item
  281. } else if (type == 'suo') {
  282. this.currHouseIndex2 = index
  283. this.selSuo = item
  284. } else if (type == 'mb') {
  285. this.currHouseIndex3 = index
  286. this.selMb = item
  287. } else if (type == 'cl') {
  288. this.currHouseIndex4 = index
  289. this.selCl = item
  290. } else if (type == 'kt') {
  291. this.currHouseIndex5 = index
  292. this.selKt = item
  293. }
  294. this.getPrice(3, this.selHx.id, this.selPp.id, this.selSuo.id, this.selMb.id, this.selCl.id, this.selKt
  295. .id)
  296. },
  297. async getPrice(type = 3, house_type, brand, mind_lock, mind_switch, mind_curtain, mind_air_conditioner) {
  298. let res = await getDataMoneyReq({
  299. type,
  300. house_type,
  301. brand,
  302. mind_lock,
  303. mind_switch,
  304. mind_curtain,
  305. mind_air_conditioner
  306. })
  307. if (res.code == 0) {
  308. console.log('配置价格-智控: ', res)
  309. this.totalPrice = res.data.money
  310. this.pConfig = res.data.id
  311. } else {
  312. uni.showToast({
  313. title: res.message,
  314. icon: 'none'
  315. })
  316. }
  317. },
  318. toRule() {
  319. getApp().content = this.rule
  320. uni.navigateTo({
  321. url: '/pages/index/rule/index?type=ctrl'
  322. })
  323. },
  324. toNext() {
  325. getApp().selHx = this.selHx
  326. getApp().selPp = this.selPp
  327. getApp().selSuo = this.selSuo
  328. getApp().selMb = this.selMb
  329. getApp().selCl = this.selCl
  330. getApp().selKt = this.selKt
  331. getApp().totalPrice = this.totalPrice
  332. getApp().pConfig = this.pConfig
  333. uni.navigateTo({
  334. url: '/pages/index/aiControlSys_step2/index'
  335. })
  336. },
  337. handleOpenOrClose(i) {
  338. if (this['addOrLessIcon' + i] == '/static/index/shortLine.png') {
  339. this['addOrLessIcon' + i] = '/static/index/add.png'
  340. this['show' + i] = false
  341. } else if (this['addOrLessIcon' + i] == '/static/index/add.png') {
  342. this['addOrLessIcon' + i] = '/static/index/shortLine.png'
  343. this['show' + i] = true
  344. }
  345. },
  346. }
  347. }
  348. </script>
  349. <style lang="scss" scoped>
  350. @import "./index.scss";
  351. </style>