| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589 |
- <template>
- <view class="page">
- <navBar title="定制我家的主灯" :back="true" color="black" background="white" />
- <image :src="picUrl+'/static/other/noMain_img3.png'" mode="" class="topBg"></image>
- <view class="content">
- <view class="topBox">
- <view class="lTxt">
- <image src="/static/index/water.png" mode="" class="water1"></image>
- <view class="main">
- <image src="/static/index/halfCircle_275.png" mode="" style="width: 56rpx;height: 56rpx;">
- </image>
- <text style="z-index: 3;position: relative;">定制我家的主灯</text>
- </view>
- </view>
- <view class="rDes">
- <view class="con">
- 详情
- </view>
- <image src="/static/index/halfRight.png" mode="" style="width: 24rpx;height: 8rpx;">
- </image>
- </view>
- </view>
- <view class="label" @click="handleOpenOrClose(1)">
- <view class="txt">
- 户型
- </view>
- <image :src="addOrLessIcon1" mode="" class="" :style="{height:addOrLessIcon1=='/static/index/shortLine.png'
- ?'2rpx':'22rpx'}" style="width: 22rpx;margin-right: 56rpx;">
- </image>
- </view>
- <view class="parms">
- <view v-if="show1" @click="handleSel1('hx',item,index)" class="item "
- :class="[currHouseIndex==index?'act':'']" v-for="(item,index) in houseTypeList">
- {{item.value}}
- </view>
- </view>
- <view class="label" @click="handleOpenOrClose(2)">
- <view class="txt">
- 系列
- </view>
- <image :src="addOrLessIcon2" mode="" class="" :style="{height:addOrLessIcon2=='/static/index/shortLine.png'
- ?'2rpx':'22rpx'}" style="width: 22rpx;margin-right: 56rpx;">
- </image>
- </view>
- <view class="parms">
- <view v-if="show2" @click="handleSel1('xl',item,index)" class="item "
- :class="[currHouseIndex5==index?'act':'']" v-for="(item,index) in serTypeList">
- {{item.value}}
- </view>
- </view>
- <view class="label" style="margin-bottom:32rpx;" @click="toSel('挑选客厅灯',1)">
- <view class="txt">
- 挑选客厅灯
- </view>
- <image src="/static/index/more.png" mode="" class="" style="width: 44rpx;height: 44rpx;">
- </image>
- </view>
- <view class="parms3">
- <image @click="handleSel('kt',item,index)" class="item3 " :src="picBase+item.cover"
- :class="[selKt.includes(item)?'act3':'']" v-for="(item,index) in brandTypeList">
- </image>
- </view>
- <view class="label" style="margin-bottom:32rpx;" @click="toSel('挑选餐厅灯',2)">
- <view class="txt">
- 挑选餐厅灯
- </view>
- <image src="/static/index/more.png" mode="" class="" style="width: 44rpx;height: 44rpx;">
- </image>
- </view>
- <view class="parms3">
- <image @click="handleSel('ct',item,index)" class="item3 " :src="picBase+item.cover"
- :class="[selCt.includes(item)?'act3':'']" v-for="(item,index) in lockTypeList">
- </image>
- </view>
- <view class="label" style="margin-bottom:32rpx;" @click="toSel('挑选卧室灯',3)">
- <view class="txt">
- 挑选卧室灯
- </view>
- <image src="/static/index/more.png" mode="" class="" style="width: 44rpx;height: 44rpx;">
- </image>
- </view>
- <view class="parms3">
- <image @click="handleSel('ws',item,index)" class="item3 " :src="picBase+item.cover"
- :class="[selWs.includes(item)?'act3':'']" v-for="(item,index) in chuanglianTypeList">
- </image>
- </view>
- <view class="label" style="margin-bottom:32rpx;" @click="toSel('挑选阳台灯',4)">
- <view class="txt">
- 挑选阳台灯
- </view>
- <image src="/static/index/more.png" mode="" class="" style="width: 44rpx;height: 44rpx;">
- </image>
- </view>
- <view class="parms3">
- <image @click="handleSel('yt',item,index)" class="item3 " :src="picBase+item.cover"
- :class="[selYt.includes(item)?'act3':'']" v-for="(item,index) in pannelTypeList">
- </image>
- </view>
- </view>
- <view class="rule" @click="goRule">
- <image src="/static/index/ruleImg.png" mode=""></image>
- <view class="txt">
- 挑选规则
- </view>
- </view>
- <view class="bot">
- <view class="left" @click="showConfig=true">
- <view class="price">
- ¥{{totalPrice.toFixed(2)}}
- </view>
- <!-- <image src="/static/index/arrDown.png" mode=""></image> -->
- <image v-if="!showConfig" src="/static/index/arrDown.png" mode="" @click="showConfig=true"></image>
- <image v-else src="/static/index/arrUp.png" mode="" @click="showConfig=false"></image>
- </view>
- <view class="right" @click="previewConfig">
- 预览配置
- </view>
- </view>
- <u-popup :show="showConfig" @close="close" @open="open" round='10'>
- <view class="topBar" style="">
- <view class="left">
- </view>
- <view class="cen">
- 清单
- </view>
- <view class="close" @click="showConfig=false">
- <u-icon name="close"></u-icon>
- </view>
- </view>
- <view class="pupopCon">
- <view class="item">
- <view class="top">
- <view class="name">
- 户型
- </view>
- <view class="info">
- {{selHx.value}}
- </view>
- </view>
- </view>
- <view class="item">
- <view class="top">
- <view class="name">
- 系列
- </view>
- <view class="info">
- {{selXl.value}}
- </view>
- </view>
- </view>
- <view class="item">
- <view class="top">
- <view class="name">
- 客厅灯
- </view>
- <view class="info">
- {{selKt?1:0}}
- </view>
- </view>
- </view>
- <view class="item">
- <view class="top">
- <view class="name">
- 餐厅灯
- </view>
- <view class="info">
- {{selCt?1:0}}
- </view>
- </view>
- </view>
- <view class="item">
- <view class="top">
- <view class="name">
- 卧室灯
- </view>
- <view class="info">
- {{selWs.length}}
- </view>
- </view>
- </view>
- <view class="item">
- <view class="top">
- <view class="name">
- 阳台灯
- </view>
- <view class="info">
- {{selYt?1:0}}
- </view>
- </view>
- </view>
- </view>
- </u-popup>
- <u-modal :show="showHuxing" @confirm="showHuxing=false" title="户型" :content='content' confirmColor="#F7790C">
- <view class="tipContent">
- <view class="card">
- <view class="item">
- <view class="left">
- {{selHx.extend.title}}
- </view>
- <view class="right">
- ¥{{selHx.extend.money}}
- </view>
- </view>
- <view class="item">
- <view class="left" style="font-weight: normal;">
- 灯具
- </view>
- <view class="right">
- {{selHx.extend.lampCount}}
- </view>
- </view>
- </view>
- <view class="tip">
- <image src="/static/index/more.png" mode=""></image>
- {{selHx.extend.remark}}
- </view>
- </view>
- </u-modal>
- <u-modal :show="showMissItem" title="提示" @confirm="showMissItem=false" content='' confirmColor="#F7790C">
- <view class="tip2">
- 客厅灯具少选1盏!
- </view>
- </u-modal>
- </view>
- </template>
- <script>
- import {
- getIndexConfigReq,
- } from '@/api/test/index.js'
- import {
- getDataMoneyReq
- } from '@/api/index/index.js'
- export default {
- components: {
- },
- data() {
- return {
- picUrl: this.$picUrl,
- picBase: this.$picBase,
- addOrLessIcon1: '/static/index/add.png',
- addOrLessIcon2: '/static/index/add.png',
- addOrLessIcon3: '/static/index/add.png',
- addOrLessIcon4: '/static/index/add.png',
- addOrLessIcon5: '/static/index/add.png',
- // lessIcon: require('/static/index/shortLine.png'),
- show1: false,
- show2: false,
- show3: false,
- show4: false,
- show5: false,
- showConfig: false,
- showHuxing: false,
- showMissItem: false,
- seledKetingItem: null,
- currHouseIndex: 0,
- currHouseIndex1: 0,
- currHouseIndex2: 0,
- currHouseIndex3: 0,
- currHouseIndex4: 0,
- currHouseIndex5: 0,
- currHouseIndex6: 0,
- houseTypeList: [],
- brandTypeList: [],
- lockTypeList: [],
- pannelTypeList: [],
- chuanglianTypeList: [],
- serTypeList: [
- ],
- rule: null,
- selHx: null,
- selXl: null,
- selKt: [],
- selCt: [],
- selWs: [],
- selYt: [],
- totalPrice: 0,
- pConfig: -1,
- cutdownRatio: 1
- }
- },
- async onLoad(o) {
- let res = await getIndexConfigReq({
- type: 2
- })
- if (res.code == 0) {
- console.log('获取首页配置返回值-主灯: ', res);
- this.houseTypeList = res.data.house_type
- this.brandTypeList = res.data.living_room
- this.lockTypeList = res.data.dining_room_light
- this.serTypeList = res.data.series
- this.chuanglianTypeList = res.data.bedroom_lamp
- this.pannelTypeList = res.data.balcony_light
- // this.rule = res.data.rule.content
- this.selHx = res.data.house_type[0]
- this.selXl = res.data.series[0]
- this.selKt = [res.data.living_room[0]]
- this.selCt = [res.data.dining_room_light[0]]
- this.selWs = [res.data.bedroom_lamp[0]]
- this.selYt = [res.data.balcony_light[0]]
- let wsIds1 = []
- this.selKt.forEach((item, index) => {
- wsIds1.push(item.id)
- })
- let wsIds2 = []
- this.selCt.forEach((item, index) => {
- wsIds2.push(item.id)
- })
- let wsIds3 = []
- this.selWs.forEach((item, index) => {
- wsIds3.push(item.id)
- })
- let wsIds4 = []
- this.selYt.forEach((item, index) => {
- wsIds4.push(item.id)
- })
- this.getPrice(2, this.selHx.id, this.selXl.id, wsIds1.sort().join(','), wsIds2.sort().join(','), wsIds3
- .sort().join(','),
- wsIds4.sort().join(','))
- } else {
- uni.showToast({
- title: res.message,
- icon: 'none'
- })
- }
- },
- onShow() {
- this.cutdownRatio = this.$getCutDown()
- console.log('哪种折扣价格', this.cutdownRatio);
- console.log('确定选择的那一项', getApp().chooseItem_kt);
- if (getApp().chooseItem_kt) {
- let index = getApp().index_kt
- let item = getApp().chooseItem_kt
- let type = ''
- if (getApp().chooseType == '挑选客厅灯') {
- type = 'kt'
- } else if (getApp().chooseType == '挑选餐厅灯') {
- type = 'ct'
- } else if (getApp().chooseType == '挑选卧室灯') {
- type = 'ws'
- } else {
- type = 'yt'
- }
- this.handleSel(type, item, index, 2)
- getApp().chooseItem_kt = null
- getApp().index_kt = null
- getApp().chooseType = null
- }
- },
- methods: {
- async getPrice(type = 2, house_type, series, drawing_lamp, canteen_lamp, bedroom_lamp, balcony_lamp) {
- let res = await getDataMoneyReq({
- type,
- house_type,
- series,
- drawing_lamp,
- canteen_lamp,
- bedroom_lamp,
- balcony_lamp
- })
- if (res.code == 0) {
- console.log('配置价格-主灯: ', res)
- this.totalPrice = res.data.money * this.cutdownRatio
- this.pConfig = res.data.id
- } else {
- uni.showToast({
- title: res.message,
- icon: 'none'
- })
- }
- },
- goRule() {
- getApp().content = this.rule
- uni.navigateTo({
- url: '/pages/index/rule/index?type=main'
- })
- },
- toSel(name, type) {
- if (type == 1) {
- getApp().typeList = this.brandTypeList
- } else if (type == 2) {
- getApp().typeList = this.lockTypeList
- } else if (type == 3) {
- getApp().typeList = this.chuanglianTypeList
- } else {
- getApp().typeList = this.pannelTypeList
- }
- uni.navigateTo({
- url: '/pages/index/mainList/index?name=' + name
- })
- },
- handleOpenOrClose(i) {
- if (this['addOrLessIcon' + i] == '/static/index/shortLine.png') {
- this['addOrLessIcon' + i] = '/static/index/add.png'
- this['show' + i] = false
- } else if (this['addOrLessIcon' + i] == '/static/index/add.png') {
- this['addOrLessIcon' + i] = '/static/index/shortLine.png'
- this['show' + i] = true
- }
- },
- handleSel1(type, item, index) {
- if (type == 'hx') {
- this.currHouseIndex = index
- this.selHx = item
- } else {
- this.currHouseIndex5 = index
- this.selXl = item
- }
- let wsIds1 = []
- this.selKt.forEach((item, index) => {
- wsIds1.push(item.id)
- })
- let wsIds2 = []
- this.selCt.forEach((item, index) => {
- wsIds2.push(item.id)
- })
- let wsIds3 = []
- this.selWs.forEach((item, index) => {
- wsIds3.push(item.id)
- })
- let wsIds4 = []
- this.selYt.forEach((item, index) => {
- wsIds4.push(item.id)
- })
- this.getPrice(2, this.selHx.id, this.selXl.id, wsIds1.sort().join(','), wsIds2.sort().join(','), wsIds3
- .sort().join(','),
- wsIds4.sort().join(','))
- },
- handleSel(type, item, index, mode = 1) {
- if (type == 'kt') {
- this.currHouseIndex3 = index
- if (!this.selKt.includes(item)) {
- this.selKt.push(item)
- } else {
- if (mode == 1) {
- let i = this.selKt.findIndex((item1, index1) => {
- return item1 == item
- })
- this.selKt.splice(i, 1)
- }
- }
- } else if (type == 'ct') {
- this.currHouseIndex2 = index
- if (!this.selCt.includes(item)) {
- this.selCt.push(item)
- } else {
- if (mode == 1) {
- let i = this.selCt.findIndex((item1, index1) => {
- return item1 == item
- })
- this.selCt.splice(i, 1)
- }
- }
- } else if (type == 'ws') {
- this.currHouseIndex4 = index
- if (!this.selWs.includes(item)) {
- this.selWs.push(item)
- } else {
- if (mode == 1) {
- let i = this.selWs.findIndex((item1, index1) => {
- return item1 == item
- })
- this.selWs.splice(i, 1)
- }
- }
- } else if (type == 'yt') {
- this.currHouseIndex6 = index
- if (!this.selYt.includes(item)) {
- this.selYt.push(item)
- } else {
- if (mode == 1) {
- let i = this.selYt.findIndex((item1, index1) => {
- return item1 == item
- })
- this.selYt.splice(i, 1)
- }
- }
- }
- let wsIds1 = []
- this.selKt.forEach((item, index) => {
- wsIds1.push(item.id)
- })
- let wsIds2 = []
- this.selCt.forEach((item, index) => {
- wsIds2.push(item.id)
- })
- let wsIds3 = []
- this.selWs.forEach((item, index) => {
- wsIds3.push(item.id)
- })
- let wsIds4 = []
- this.selYt.forEach((item, index) => {
- wsIds4.push(item.id)
- })
- this.getPrice(2, this.selHx.id, this.selXl.id, wsIds1.sort().join(','), wsIds2.sort().join(','), wsIds3
- .sort().join(','),
- wsIds4.sort().join(','))
- },
- previewConfig() {
- if (!this.selKt) {
- this.showMissItem = true
- return
- }
- if (this.selHx.value == '一室两厅' && this.selWs.length < 1) {
- this.showHuxing = true
- return
- } else if (this.selHx.value == '两室两厅' && this.selWs.length < 2) {
- this.showHuxing = true
- return
- } else if (this.selHx.value == '三室两厅' && this.selWs.length < 3) {
- this.showHuxing = true
- return
- }
- getApp().mainPreviewInfo = {
- hx: this.selHx,
- xl: this.selXl,
- kt: this.selKt,
- ct: this.selCt,
- ws: this.selWs,
- yt: this.selYt,
- price: this.totalPrice
- }
- getApp().pConfig = this.pConfig
- uni.navigateTo({
- url: '/pages/index/customMian/index'
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- @import "./index.scss";
- </style>
|