index.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  1. <template>
  2. <view class="page">
  3. <navBar title="定制我家的无主灯" :back="true" color="black" background="white" />
  4. <image :src="picUrl+'/static/other/noMain_img4.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 " :class="[currHouseIndex==index?'act':'']"
  33. 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('kj',item,index)" class="item "
  47. :class="[currHouseIndex1==index?'act':'']" v-for="(item,index) in lockTypeList">
  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('pp',item,index)" class="item "
  61. :class="[currHouseIndex2==index?'act':'']" v-for="(item,index) in brandTypeList">
  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('xl',item,index)" class="item "
  75. :class="[currHouseIndex5==index?'act':'']" v-for="(item,index) in serTypeList">
  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('bb',item,index)" class="item "
  89. :class="[currHouseIndex3==index?'act':'']" v-for="(item,index) in chuanglianTypeList">
  90. {{item.value}}
  91. </view>
  92. </view>
  93. <view class="label" style="margin-bottom: 32rpx;">
  94. 包含灯型
  95. </view>
  96. <view class="parms2">
  97. <view @click="goPreview(item.id)" class="itemLast " :class="[currHouseIndex4==index?'act':'']"
  98. v-for="(item,index) in ktTypeList">
  99. {{item.name}}
  100. </view>
  101. </view>
  102. </view>
  103. <view class="rule" @click="goRule">
  104. <image src="/static/index/ruleImg.png" mode=""></image>
  105. <view class="txt">
  106. 挑选规则
  107. </view>
  108. </view>
  109. <view class="bot">
  110. <view class="left" @click="showConfig=true">
  111. <view class="price" style="min-width: 200rpx;">
  112. ¥{{totalPrice.toFixed(2)}}
  113. </view>
  114. <image v-if="!showConfig" src="/static/index/arrDown.png" mode="" @click="showConfig=true"></image>
  115. <image v-else src="/static/index/arrUp.png" mode="" @click="showConfig=false"></image>
  116. </view>
  117. <view class="right" @click="preConfig">
  118. 预览配置
  119. </view>
  120. </view>
  121. <u-popup :show="showConfig" @close="close" @open="open" round='10'>
  122. <view class="topBar" style="">
  123. <view class="left">
  124. </view>
  125. <view class="cen">
  126. 清单
  127. </view>
  128. <view class="close" @click="showConfig=false">
  129. <u-icon name="close"></u-icon>
  130. </view>
  131. </view>
  132. <view class="pupopCon">
  133. <view class="item">
  134. <view class="top">
  135. <view class="name">
  136. 户型
  137. </view>
  138. <view class="info">
  139. {{selHx.value}}
  140. </view>
  141. </view>
  142. </view>
  143. <view class="item">
  144. <view class="top">
  145. <view class="name">
  146. 空间
  147. </view>
  148. <view class="info">
  149. {{selKj.value}}
  150. </view>
  151. </view>
  152. </view>
  153. <view class="item">
  154. <view class="top">
  155. <view class="name">
  156. 品牌
  157. </view>
  158. <view class="info">
  159. {{selPp.value}}
  160. </view>
  161. </view>
  162. </view>
  163. <view class="item">
  164. <view class="top">
  165. <view class="name">
  166. 系列
  167. </view>
  168. <view class="info">
  169. {{selXl.value}}
  170. </view>
  171. </view>
  172. </view>
  173. <view class="item">
  174. <view class="top">
  175. <view class="name">
  176. 版本
  177. </view>
  178. <view class="info">
  179. {{selBb.value}}
  180. </view>
  181. </view>
  182. </view>
  183. </view>
  184. </u-popup>
  185. </view>
  186. </template>
  187. <script>
  188. import {
  189. getIndexConfigReq,
  190. } from '@/api/test/index.js'
  191. import {
  192. getDataMoneyReq
  193. } from '@/api/index/index.js'
  194. export default {
  195. components: {
  196. },
  197. data() {
  198. return {
  199. picUrl: this.$picUrl,
  200. addOrLessIcon1: '/static/index/add.png',
  201. addOrLessIcon2: '/static/index/add.png',
  202. addOrLessIcon3: '/static/index/add.png',
  203. addOrLessIcon4: '/static/index/add.png',
  204. addOrLessIcon5: '/static/index/add.png',
  205. show1: false,
  206. show2: false,
  207. show3: false,
  208. show4: false,
  209. show5: false,
  210. showConfig: false,
  211. currHouseIndex: 0,
  212. currHouseIndex1: 0,
  213. currHouseIndex2: 0,
  214. currHouseIndex3: 0,
  215. currHouseIndex4: 0,
  216. currHouseIndex5: 0,
  217. houseTypeList: [
  218. ],
  219. brandTypeList: [
  220. ],
  221. lockTypeList: [
  222. ],
  223. chuanglianTypeList: [
  224. ],
  225. ktTypeList: [{
  226. id: 1,
  227. name: '筒灯'
  228. },
  229. {
  230. id: 2,
  231. name: '射灯'
  232. },
  233. {
  234. id: 3,
  235. name: '线性灯'
  236. },
  237. {
  238. id: 4,
  239. name: '磁吸轨道灯'
  240. }
  241. ],
  242. serTypeList: [],
  243. selHx: null,
  244. selKj: null,
  245. selPp: null,
  246. selXl: null,
  247. selBb: null,
  248. rule: '',
  249. totalPrice: 0,
  250. pConfig: -1,
  251. cutdownRatio: 1
  252. }
  253. },
  254. async onLoad(o) {
  255. let res = await getIndexConfigReq({
  256. type: 1
  257. })
  258. if (res.code == 0) {
  259. console.log('获取首页配置返回值-无主灯: ', res);
  260. this.houseTypeList = res.data.house_type
  261. this.brandTypeList = res.data.brand
  262. this.lockTypeList = res.data.space
  263. this.serTypeList = res.data.series
  264. this.chuanglianTypeList = res.data.version
  265. this.selHx = res.data.house_type[0]
  266. this.selKj = res.data.space[0]
  267. this.selPp = res.data.brand[0]
  268. this.selXl = res.data.series[0]
  269. this.selBb = res.data.version[0]
  270. this.rule = res.data.rule.content
  271. this.getPrice(1, this.selHx.id, this.selKj.id, this.selPp.id, this.selXl.id, this.selBb.id)
  272. } else {
  273. uni.showToast({
  274. title: res.message,
  275. icon: 'none'
  276. })
  277. }
  278. },
  279. onShow() {
  280. this.cutdownRatio = this.$getCutDown()
  281. },
  282. computed: {},
  283. methods: {
  284. async getPrice(type = 1, house_type, space, brand, series, version) {
  285. let res = await getDataMoneyReq({
  286. type,
  287. house_type,
  288. space,
  289. brand,
  290. series,
  291. version
  292. })
  293. if (res.code == 0) {
  294. console.log('配置价格-无主灯: ', res)
  295. this.totalPrice = res.data.money * this.cutdownRatio
  296. this.pConfig = res.data.id
  297. } else {
  298. uni.showToast({
  299. title: res.message,
  300. icon: 'none'
  301. })
  302. }
  303. },
  304. sel(type, item, index) {
  305. if (type == 'hx') {
  306. this.currHouseIndex = index
  307. this.selHx = item
  308. } else if (type == 'kj') {
  309. this.currHouseIndex1 = index
  310. this.selKj = item
  311. } else if (type == 'pp') {
  312. this.currHouseIndex2 = index
  313. this.selPp = item
  314. } else if (type == 'xl') {
  315. this.currHouseIndex5 = index
  316. this.selXl = item
  317. } else if (type == 'bb') {
  318. this.currHouseIndex3 = index
  319. this.selBb = item
  320. }
  321. this.getPrice(1, this.selHx.id, this.selKj.id, this.selPp.id, this.selXl.id, this.selBb.id)
  322. },
  323. preConfig() {
  324. getApp().selHx = this.selHx
  325. getApp().selKj = this.selKj
  326. getApp().selPp = this.selPp
  327. getApp().selXl = this.selXl
  328. getApp().selBb = this.selBb
  329. getApp().pConfig = this.pConfig
  330. getApp().totalPrice = this.totalPrice
  331. uni.navigateTo({
  332. url: '/pages/index/customNoMian_step2/index'
  333. })
  334. },
  335. goPreview(id) {
  336. uni.navigateTo({
  337. url: '/pages/index/customNoMain/index?id=' + id
  338. })
  339. },
  340. handleOpenOrClose(i) {
  341. if (this['addOrLessIcon' + i] == '/static/index/shortLine.png') {
  342. this['addOrLessIcon' + i] = '/static/index/add.png'
  343. this['show' + i] = false
  344. } else {
  345. this['addOrLessIcon' + i] = '/static/index/shortLine.png'
  346. this['show' + i] = true
  347. }
  348. },
  349. goRule() {
  350. getApp().content = this.rule
  351. uni.navigateTo({
  352. url: '/pages/index/rule/index?type=noMain'
  353. })
  354. }
  355. }
  356. }
  357. </script>
  358. <style lang="scss" scoped>
  359. @import "./index.scss";
  360. </style>