index.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816
  1. <template>
  2. <view class="page">
  3. <navBar :title="type ? '定制我家的吸顶灯' : '定制我家的主灯'" :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;">{{type ? '定制我家的吸顶灯' : '定制我家的主灯'}}</text>
  13. </view>
  14. </view>
  15. <view class="rDes" @click="goRule">
  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)" style="padding-top: 64rpx;"
  24. :style="{'padding-bottom':addOrLessIcon1=='/static/index/add.png'?'64rpx':'32rpx'}">
  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="handleSel1('hx',item,index)" class="item "
  34. :class="[currHouseIndex1==index?'act':'']" v-for="(item,index) in houseTypeList">
  35. {{item.value}}
  36. </view>
  37. </view>
  38. <view class="label" @click="handleOpenOrClose(2)" style="padding-top: 64rpx;"
  39. :style="{'padding-bottom':addOrLessIcon1=='/static/index/add.png'?'64rpx':'32rpx'}">
  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="handleSel1('xl',item,index)" class="item "
  49. :class="[currHouseIndex2==index?'act':'']" v-for="(item,index) in serTypeList">
  50. {{item.value}}
  51. </view>
  52. </view>
  53. <view class="label" style="margin-bottom:32rpx;" @click="toSel('挑选客厅灯',1)">
  54. <view class="txt">
  55. 挑选客厅灯
  56. </view>
  57. <image src="/static/index/more.png" mode="" class="" style="width: 44rpx;height: 44rpx;">
  58. </image>
  59. </view>
  60. <view class="parms3">
  61. <!-- <image @click="goDetail(item,index,'挑选客厅灯')" class="item3 " :src="picBase+item.cover"
  62. :class="[selKt.includes(item)?'act3':'']" v-for="(item,index) in brandTypeList.slice(0,4)">
  63. </image> -->
  64. <image @click="goDetail(item,index,'挑选客厅灯')" class="item3 " :src="picBase+item.cover"
  65. :class="[selKtIndex==index?'act3':'']" v-for="(item,index) in brandTypeList.slice(0,4)">
  66. </image>
  67. </view>
  68. <view class="label" style="margin-bottom:32rpx;" @click="toSel('挑选餐厅灯',2)">
  69. <view class="txt">
  70. 挑选餐厅灯
  71. </view>
  72. <image src="/static/index/more.png" mode="" class="" style="width: 44rpx;height: 44rpx;">
  73. </image>
  74. </view>
  75. <view class="parms3">
  76. <!-- <image @click="goDetail(item,index,'挑选餐厅灯')" class="item3 " :src="picBase+item.cover"
  77. :class="[selCt.includes(item)?'act3':'']" v-for="(item,index) in lockTypeList.slice(0,4)">
  78. </image> -->
  79. <image @click="goDetail(item,index,'挑选餐厅灯')" class="item3 " :src="picBase+item.cover"
  80. :class="[selCtIndex==index?'act3':'']" v-for="(item,index) in lockTypeList.slice(0,4)">
  81. </image>
  82. </view>
  83. <view class="label" style="margin-bottom:32rpx;" @click="toSel('挑选卧室灯',3)">
  84. <view class="txt">
  85. 挑选卧室灯
  86. </view>
  87. <image src="/static/index/more.png" mode="" class="" style="width: 44rpx;height: 44rpx;">
  88. </image>
  89. </view>
  90. <view class="parms3">
  91. <!-- <image @click="goDetail(item,index,'挑选卧室灯')" class="item3 " :src="picBase+item.cover"
  92. :class="[selWs.includes(item)?'act3':'']" v-for="(item,index) in chuanglianTypeList.slice(0,4)">
  93. </image> -->
  94. <image @click="goDetail(item,index,'挑选卧室灯')" class="item3 " :src="picBase+item.cover"
  95. v-for="(item,index) in chuanglianTypeList.slice(0,4)"
  96. :class="[selWsIndex.indexOf(index)!=-1?'act3':'']">
  97. </image>
  98. </view>
  99. <view class="label" style="margin-bottom:32rpx;" @click="toSel('挑选阳台灯',4)">
  100. <view class="txt">
  101. 挑选阳台灯
  102. </view>
  103. <image src="/static/index/more.png" mode="" class="" style="width: 44rpx;height: 44rpx;">
  104. </image>
  105. </view>
  106. <view class="parms3">
  107. <!-- <image @click="goDetail(item,index,'挑选阳台灯')" class="item3 " :src="picBase+item.cover"
  108. :class="[selYt.includes(item)?'act3':'']" v-for="(item,index) in pannelTypeList.slice(0,4)">
  109. </image> -->
  110. <image @click="goDetail(item,index,'挑选阳台灯')" class="item3 " :src="picBase+item.cover"
  111. :class="[selYtIndex==index?'act3':'']" v-for="(item,index) in pannelTypeList.slice(0,4)">
  112. </image>
  113. </view>
  114. </view>
  115. <view class="bot">
  116. <view class="left" @click="showConfig=true">
  117. <view class="price">
  118. ¥{{totalPrice.toFixed(0)}}
  119. </view>
  120. <!-- <image src="/static/index/arrDown.png" mode=""></image> -->
  121. <image v-if="!showConfig" src="/static/index/arrDown.png" mode="" @click="showConfig=true"></image>
  122. <image v-else src="/static/index/arrUp.png" mode="" @click="showConfig=false"></image>
  123. </view>
  124. <view class="right" @click="previewConfig">
  125. 预览配置
  126. </view>
  127. </view>
  128. <u-popup :show="showConfig" @close="close" @open="open" round='10'>
  129. <view class="topBar" style="">
  130. <view class="left">
  131. </view>
  132. <view class="cen">
  133. 清单
  134. </view>
  135. <view class="close" @click="showConfig=false">
  136. <u-icon name="close"></u-icon>
  137. </view>
  138. </view>
  139. <view class="pupopCon">
  140. <view class="item" v-if="selHx">
  141. <view class="top">
  142. <view class="name">
  143. 户型
  144. </view>
  145. <view class="info">
  146. {{selHx.value}}
  147. </view>
  148. </view>
  149. </view>
  150. <view class="item" v-if="selXl">
  151. <view class="top">
  152. <view class="name">
  153. 系列
  154. </view>
  155. <view class="info">
  156. {{selXl.value}}
  157. </view>
  158. </view>
  159. </view>
  160. <view class="item" v-if="selKt.length!=0">
  161. <view class="top">
  162. <view class="name">
  163. 客厅灯
  164. </view>
  165. <view class="info">
  166. {{selKt.length}}
  167. </view>
  168. </view>
  169. </view>
  170. <view class="item" v-if="selCt.length!=0">
  171. <view class="top">
  172. <view class="name">
  173. 餐厅灯
  174. </view>
  175. <view class="info">
  176. {{selCt.length}}
  177. </view>
  178. </view>
  179. </view>
  180. <view class="item" v-if="selWs.length!=0">
  181. <view class="top">
  182. <view class="name">
  183. 卧室灯
  184. </view>
  185. <view class="info">
  186. {{selWs.length}}
  187. </view>
  188. </view>
  189. </view>
  190. <view class="item" v-if="selYt.length!=0">
  191. <view class="top">
  192. <view class="name">
  193. 阳台灯
  194. </view>
  195. <view class="info">
  196. {{selCt.length}}
  197. </view>
  198. </view>
  199. </view>
  200. </view>
  201. </u-popup>
  202. <u-modal :show="showHuxing" @confirm="showHuxing=false" title="户型" :content='content' confirmColor="#F7790C">
  203. <view class="tipContent">
  204. <view class="card">
  205. <view class="item">
  206. <view class="left">
  207. {{selHx.extend.title}}
  208. </view>
  209. <view class="right">
  210. ¥{{selHx.extend.money}}
  211. </view>
  212. </view>
  213. <view class="item">
  214. <view class="left" style="font-weight: normal;">
  215. 灯具
  216. </view>
  217. <view class="right">
  218. {{selHx.extend.lampCount}}
  219. </view>
  220. </view>
  221. </view>
  222. <view class="tip">
  223. <image :src="picUrl+ '/static/other/info.png'" mode="" style="margin-top: 5rpx;"></image>
  224. {{selHx.extend.remark}}
  225. </view>
  226. </view>
  227. </u-modal>
  228. <u-modal :show="showMissItem" title="提示" @confirm="showMissItem=false" content='' confirmColor="#F7790C">
  229. <view class="tip2">
  230. {{tipTxt}}
  231. </view>
  232. </u-modal>
  233. </view>
  234. </template>
  235. <script>
  236. import {
  237. getIndexConfigReq,
  238. getHomeDataNextReq
  239. } from '@/api/test/index.js'
  240. import {
  241. getDataMoneyReq
  242. } from '@/api/index/index.js'
  243. export default {
  244. components: {
  245. },
  246. data() {
  247. return {
  248. picUrl: this.$picUrl,
  249. picBase: this.$picBase,
  250. addOrLessIcon1: '/static/index/shortLine.png',
  251. addOrLessIcon2: '/static/index/shortLine.png',
  252. addOrLessIcon3: '/static/index/shortLine.png',
  253. addOrLessIcon4: '/static/index/shortLine.png',
  254. addOrLessIcon5: '/static/index/shortLine.png',
  255. // lessIcon: require('/static/index/shortLine.png'),
  256. show1: true,
  257. show2: true,
  258. show3: true,
  259. show4: true,
  260. show5: true,
  261. showConfig: false,
  262. showHuxing: false,
  263. showMissItem: false,
  264. seledKetingItem: null,
  265. currHouseIndex1: -1,
  266. currHouseIndex2: -1,
  267. houseTypeList: [],
  268. brandTypeList: [],
  269. lockTypeList: [],
  270. pannelTypeList: [],
  271. chuanglianTypeList: [],
  272. serTypeList: [
  273. ],
  274. rule: null,
  275. selHx: null,
  276. selXl: null,
  277. selKt: [],
  278. selCt: [],
  279. selWs: [],
  280. selYt: [],
  281. selKtIndex: -1,
  282. selCtIndex: -1,
  283. selWsIndex: [],
  284. selYtIndex: -1,
  285. totalPrice: 0,
  286. pConfig: -1,
  287. cutdownRatio: 1,
  288. type: 0,
  289. tipTxt: '',
  290. topPic: ''
  291. }
  292. },
  293. async onLoad(o) {
  294. this.topPic = getApp().noMainImg.head_image
  295. console.log('2this.topPic', this.topPic);
  296. if (o.type) {
  297. this.type = o.type
  298. }
  299. let res = await getIndexConfigReq({
  300. type: o.type ? Number(o.type) : 2
  301. })
  302. if (res.code == 0) {
  303. console.log('获取首页配置返回值-主灯: ', res);
  304. this.houseTypeList = res.data.house_type
  305. this.brandTypeList = res.data.living_room
  306. this.lockTypeList = res.data.dining_room_light
  307. this.serTypeList = res.data.series
  308. this.chuanglianTypeList = res.data.bedroom_lamp
  309. this.pannelTypeList = res.data.balcony_light
  310. this.rule = res.data.rule.content
  311. let wsIds1 = []
  312. this.selKt.forEach((item, index) => {
  313. wsIds1.push(item.id)
  314. })
  315. let wsIds2 = []
  316. this.selCt.forEach((item, index) => {
  317. wsIds2.push(item.id)
  318. })
  319. let wsIds3 = []
  320. this.selWs.forEach((item, index) => {
  321. wsIds3.push(item.id)
  322. })
  323. let wsIds4 = []
  324. this.selYt.forEach((item, index) => {
  325. wsIds4.push(item.id)
  326. })
  327. } else {
  328. uni.showToast({
  329. title: res.message,
  330. icon: 'none'
  331. })
  332. }
  333. },
  334. onShow() {
  335. this.cutdownRatio = this.$getCutDown()
  336. console.log('哪种折扣价格', this.cutdownRatio);
  337. console.log('确定选择的那一项', getApp().chooseItem_kt, getApp().index_kt, getApp().chooseType);
  338. if (getApp().chooseItem_kt) {
  339. console.log('121112122-------------');
  340. let index = getApp().index_kt
  341. let item = getApp().chooseItem_kt
  342. let type = ''
  343. if (getApp().chooseType == '挑选客厅灯') {
  344. type = 'kt'
  345. } else if (getApp().chooseType == '挑选餐厅灯') {
  346. type = 'ct'
  347. } else if (getApp().chooseType == '挑选卧室灯') {
  348. type = 'ws'
  349. } else {
  350. type = 'yt'
  351. }
  352. this.handleSel(type, item, index, 2)
  353. getApp().chooseItem_kt = null
  354. getApp().index_kt = null
  355. getApp().chooseType = null
  356. }
  357. },
  358. methods: {
  359. goDetail(item, index, name) {
  360. if (this.houseTypeList.length == 0 || this.serTypeList.length == 0) {
  361. this.showMissItem = true
  362. this.tipTxt = '抱歉!参数配置缺失,暂无法预览配置'
  363. return
  364. }
  365. if (!this.selHx) {
  366. return this.$toast('请选择户型')
  367. }
  368. if (!this.selXl) {
  369. return this.$toast('请选择系列')
  370. }
  371. if (name == '挑选卧室灯') {
  372. // if (this.selHx.value == '一室一厅' && this.selWs.length == 1) {
  373. // this.showHuxing = true
  374. // return
  375. // } else if (this.selHx.value == '两室两厅' && this.selWs.length == 2) {
  376. // this.showHuxing = true
  377. // return
  378. // } else if (this.selHx.value == '三室两厅' && this.selWs.length == 3) {
  379. // this.showHuxing = true
  380. // return
  381. // }
  382. if (this.selHx.value == '一室一厅' && this.selWs.length == 1) {
  383. // this.showHuxing = true
  384. this.showMissItem = true
  385. this.tipTxt = '一室一厅户型应该选择1盏卧室灯!'
  386. return
  387. } else if (this.selHx.value == '两室两厅' && this.selWs.length == 2) {
  388. // this.showHuxing = true
  389. this.showMissItem = true
  390. this.tipTxt = '两室两厅户型应该选择2盏卧室灯!'
  391. return
  392. } else if (this.selHx.value == '三室两厅' && this.selWs.length == 3) {
  393. // this.showHuxing = true
  394. this.showMissItem = true
  395. this.tipTxt = '三室两厅户型应该选择3盏卧室灯!'
  396. return
  397. }
  398. }
  399. getApp().ktItem = item
  400. getApp().ktIndex = index
  401. getApp().ktName = name
  402. // getApp().mianFromType = 'pic'
  403. uni.navigateTo({
  404. url: '/pages/index/mainDetail/index?mianFromType=1'
  405. })
  406. },
  407. async getPrice(parmas) {
  408. let res = await getDataMoneyReq(parmas)
  409. if (res.code == 0) {
  410. console.log('配置价格-主灯: ', res)
  411. this.totalPrice = res.data.money * this.cutdownRatio
  412. this.pConfig = res.data.id ? res.data.id : -1
  413. } else {
  414. uni.showToast({
  415. title: res.message,
  416. icon: 'none'
  417. })
  418. }
  419. },
  420. goRule() {
  421. getApp().content = this.rule
  422. uni.navigateTo({
  423. url: '/pages/index/rule/index?type=main'
  424. })
  425. },
  426. toSel(name, type) {
  427. console.log('name, type', name, type);
  428. if (this.houseTypeList.length == 0 || this.serTypeList.length == 0) {
  429. this.showMissItem = true
  430. this.tipTxt = '抱歉!参数配置缺失,暂无法预览配置'
  431. return
  432. }
  433. if (!this.selHx) {
  434. return this.$toast('请选择户型')
  435. }
  436. if (!this.selXl) {
  437. return this.$toast('请选择系列')
  438. }
  439. if (type == 3) {
  440. // if (this.selHx.value == '一室两厅' && this.selWs.length == 1) {
  441. // this.showHuxing = true
  442. // return
  443. // } else if (this.selHx.value == '两室两厅' && this.selWs.length == 2) {
  444. // this.showHuxing = true
  445. // return
  446. // } else if (this.selHx.value == '三室两厅' && this.selWs.length == 3) {
  447. // this.showHuxing = true
  448. // return
  449. // }
  450. if (this.selHx.value == '一室一厅' && this.selWs.length == 1) {
  451. // this.showHuxing = true
  452. this.showMissItem = true
  453. this.tipTxt = '一室一厅户型应该选择1盏卧室灯!'
  454. return
  455. } else if (this.selHx.value == '两室两厅' && this.selWs.length == 2) {
  456. // this.showHuxing = true
  457. this.showMissItem = true
  458. this.tipTxt = '两室两厅户型应该选择2盏卧室灯!'
  459. return
  460. } else if (this.selHx.value == '三室两厅' && this.selWs.length == 3) {
  461. // this.showHuxing = true
  462. this.showMissItem = true
  463. this.tipTxt = '三室两厅户型应该选择3盏卧室灯!'
  464. return
  465. }
  466. }
  467. if (type == 1) {
  468. getApp().typeList = this.brandTypeList
  469. } else if (type == 2) {
  470. getApp().typeList = this.lockTypeList
  471. } else if (type == 3) {
  472. getApp().typeList = this.chuanglianTypeList
  473. } else {
  474. getApp().typeList = this.pannelTypeList
  475. }
  476. uni.navigateTo({
  477. url: '/pages/index/mainList/index?name=' + name
  478. })
  479. },
  480. handleOpenOrClose(i) {
  481. if (this['addOrLessIcon' + i] == '/static/index/shortLine.png') {
  482. this['addOrLessIcon' + i] = '/static/index/add.png'
  483. this['show' + i] = false
  484. } else if (this['addOrLessIcon' + i] == '/static/index/add.png') {
  485. this['addOrLessIcon' + i] = '/static/index/shortLine.png'
  486. this['show' + i] = true
  487. }
  488. },
  489. // 仅选择户型和系列
  490. async handleSel1(type, item, index) {
  491. if (type == 'hx') {
  492. this.currHouseIndex1 = -1
  493. this.currHouseIndex2 = -1
  494. this.selXl = null
  495. this.selHx = null
  496. this.currHouseIndex1 = index
  497. this.selHx = item
  498. console.log('selHx---------------', this.selHx);
  499. let p = {
  500. type: this.type ? this.type : 2,
  501. house_type: this.selHx.id
  502. }
  503. let res = await getHomeDataNextReq(p)
  504. console.log('确定选择的户型项-----------', this.selHx);
  505. if (res.code == 0) {
  506. console.log('新户型返回值', res);
  507. this.serTypeList = res.data.series
  508. this.selKt = []
  509. this.selCt = []
  510. this.selWs = []
  511. this.selYt = []
  512. this.selKtIndex = -1
  513. this.selCtIndex = -1
  514. this.selWsIndex = []
  515. this.selYtIndex = -1
  516. } else {
  517. uni.showToast({
  518. title: res.message,
  519. icon: 'none'
  520. })
  521. }
  522. } else {
  523. if (!this.selHx) {
  524. return this.$toast('请先选择户型')
  525. }
  526. this.currHouseIndex2 = -1
  527. this.selXl = null
  528. this.currHouseIndex2 = index
  529. this.selXl = item
  530. }
  531. let wsIds1 = []
  532. this.selKt.forEach((item, index) => {
  533. wsIds1.push(item.id)
  534. })
  535. let wsIds2 = []
  536. this.selCt.forEach((item, index) => {
  537. wsIds2.push(item.id)
  538. })
  539. let wsIds3 = []
  540. this.selWs.forEach((item, index) => {
  541. wsIds3.push(item.id)
  542. })
  543. let wsIds4 = []
  544. this.selYt.forEach((item, index) => {
  545. wsIds4.push(item.id)
  546. })
  547. if (this.selHx && this.selXl && this.selKt.length != 0 && this.selCt.length != 0 && this
  548. .selWs.length != 0 && this.selYt.length != 0) {
  549. this.getPrice({
  550. type: this.type ? this.type : 2,
  551. house_type: this.selHx.id,
  552. series: this.selXl.id,
  553. drawing_lamp: wsIds1.sort().join(','),
  554. canteen_lamp: wsIds2.sort().join(','),
  555. bedroom_lamp: wsIds3.sort().join(','),
  556. balcony_lamp: wsIds4.sort().join(',')
  557. })
  558. } else {
  559. this.totalPrice = 0
  560. }
  561. },
  562. handleSel(type, item, index, mode = 1) {
  563. // 卧室灯数量校验
  564. if (type == 'kt') {
  565. // 只能单选
  566. this.selKt = [item]
  567. this.selKtIndex = index
  568. // 支持对选与取消当前选择
  569. // if (!this.selKt.includes(item)) {
  570. // this.selKt.push(item)
  571. // } else {
  572. // if (mode == 1) {
  573. // let i = this.selKt.findIndex((item1, index1) => {
  574. // return item1 == item
  575. // })
  576. // this.selKt.splice(i, 1)
  577. // }
  578. // }
  579. } else if (type == 'ct') {
  580. this.selCt = [item]
  581. this.selCtIndex = index
  582. // if (!this.selCt.includes(item)) {
  583. // this.selCt.push(item)
  584. // } else {
  585. // if (mode == 1) {
  586. // let i = this.selCt.findIndex((item1, index1) => {
  587. // return item1 == item
  588. // })
  589. // this.selCt.splice(i, 1)
  590. // }
  591. // }
  592. } else if (type == 'ws') {
  593. // this.selWs = [item]
  594. if (!this.selWsIndex.includes(index)) {
  595. this.selWs.push(item)
  596. this.selWsIndex.push(index)
  597. } else {
  598. if (mode == 1) {
  599. let i = this.selWs.findIndex((item1, index1) => {
  600. return item1 == item
  601. })
  602. this.selWs.splice(i, 1)
  603. this.selWsIndex.splice(i, 1)
  604. }
  605. }
  606. } else if (type == 'yt') {
  607. this.selYt = [item]
  608. this.selYtIndex = index
  609. // if (!this.selYt.includes(item)) {
  610. // this.selYt.push(item)
  611. // } else {
  612. // if (mode == 1) {
  613. // let i = this.selYt.findIndex((item1, index1) => {
  614. // return item1 == item
  615. // })
  616. // this.selYt.splice(i, 1)
  617. // }
  618. // }
  619. }
  620. console.log('kt-----', this.selKt);
  621. console.log('ct-----', this.selCt);
  622. console.log('ws-----', this.selWs);
  623. console.log('yt-----', this.selYt);
  624. let wsIds1 = []
  625. this.selKt.forEach((item, index) => {
  626. wsIds1.push(item.id)
  627. })
  628. let wsIds2 = []
  629. this.selCt.forEach((item, index) => {
  630. wsIds2.push(item.id)
  631. })
  632. let wsIds3 = []
  633. this.selWs.forEach((item, index) => {
  634. wsIds3.push(item.id)
  635. })
  636. let wsIds4 = []
  637. this.selYt.forEach((item, index) => {
  638. wsIds4.push(item.id)
  639. })
  640. if (this.selHx && this.selXl && this.selKt.length != 0 && this.selCt.length != 0 && this
  641. .selWs.length != 0 && this.selYt.length != 0) {
  642. this.getPrice({
  643. type: this.type ? this.type : 2,
  644. house_type: this.selHx.id,
  645. series: this.selXl.id,
  646. drawing_lamp: wsIds1.sort().join(','),
  647. canteen_lamp: wsIds2.sort().join(','),
  648. bedroom_lamp: wsIds3.sort().join(','),
  649. balcony_lamp: wsIds4.sort().join(',')
  650. })
  651. } else {
  652. this.totalPrice = 0
  653. }
  654. },
  655. previewConfig() {
  656. if (this.houseTypeList.length == 0 || this.serTypeList.length == 0) {
  657. this.showMissItem = true
  658. this.tipTxt = '抱歉!参数配置缺失,暂无法预览配置'
  659. return
  660. }
  661. if (!this.selHx) {
  662. return this.$toast('请选择户型')
  663. }
  664. if (!this.selXl) {
  665. return this.$toast('请选择系列')
  666. }
  667. if (this.selKt.length == 0) {
  668. this.showMissItem = true
  669. this.tipTxt = '客厅灯至少选1盏!'
  670. return
  671. }
  672. if (this.selCt.length == 0) {
  673. this.showMissItem = true
  674. this.tipTxt = '餐厅灯至少选1盏!'
  675. return
  676. }
  677. console.log('fffffffffffffffffffff', this.selHx.value, this.selWs.length);
  678. if (this.selHx.value == '一室一厅' && this.selWs.length != 1) {
  679. // this.showHuxing = true
  680. this.showMissItem = true
  681. this.tipTxt = '一室一厅户型应该选择1盏卧室灯!'
  682. return
  683. } else if (this.selHx.value == '两室两厅' && this.selWs.length != 2) {
  684. // this.showHuxing = true
  685. this.showMissItem = true
  686. this.tipTxt = '两室两厅户型应该选择2盏卧室灯!'
  687. return
  688. } else if (this.selHx.value == '三室两厅' && this.selWs.length != 3) {
  689. // this.showHuxing = true
  690. this.showMissItem = true
  691. this.tipTxt = '三室两厅户型应该选择3盏卧室灯!'
  692. return
  693. }
  694. if (this.selYt.length == 0) {
  695. this.showMissItem = true
  696. this.tipTxt = '阳台灯至少选1盏!'
  697. return
  698. }
  699. if (this.selYt.length == 0 || this.selKt.length == 0 || this.selCt.length == 0 || this.selWs.length == 0 ||
  700. !this.selHx || !this.selXl) {
  701. this.showMissItem = true
  702. this.tipTxt = '所有选项请确认是否选择完整'
  703. return
  704. }
  705. getApp().mainPreviewInfo = {
  706. hx: this.selHx,
  707. xl: this.selXl,
  708. kt: this.selKt,
  709. ct: this.selCt,
  710. ws: this.selWs,
  711. yt: this.selYt,
  712. price: this.totalPrice
  713. }
  714. getApp().pConfig = this.pConfig
  715. console.log('getApp().pConfig', getApp().pConfig);
  716. // getApp().dType = 5
  717. uni.navigateTo({
  718. url: '/pages/index/customMian/index?dType=' + this.type
  719. })
  720. }
  721. }
  722. }
  723. </script>
  724. <style lang="scss" scoped>
  725. @import "./index.scss";
  726. </style>