| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392 |
- <template>
- <view class="page">
- <navBar :backType="navBarTitle" :title="navBarTitle?navBarTitle:'智能控制系统'" :back="true" color="black"
- background="white" />
- <image class="topImg" :src="picBase + topPic" mode=""></image>
- <view class="cen">
- <image class="water" src="/static/index/water.png" mode=""></image>
- <image class="halfC" src="/static/index/halfCircle_275.png" mode=""></image>
- 定制我家的智能控制系统
- </view>
- <view class="parmasBox">
- <view class="con">
- <view class="top">
- <view class="item">
- <view class="name">
- 户型
- </view>
- <view class="des">
- {{selHx.value}}
- </view>
- </view>
- <view class="item">
- <view class="name">
- 品牌
- </view>
- <view class="des">
- {{selPp.value}}
- </view>
- </view>
- <view class="item">
- <view class="name">
- 智能锁
- </view>
- <view class="des">
- {{selSuo.value}}
- </view>
- </view>
- <view class="item">
- <view class="name">
- 智能开关
- </view>
- <view class="des">
- {{selMb.value}}
- </view>
- </view>
- <view class="item">
- <view class="name">
- 智能窗帘
- </view>
- <view class="des">
- {{selCl.value}}
- </view>
- </view>
- <view class="item">
- <view class="name">
- 智能空调
- </view>
- <view class="des">
- {{selKt.value}}
- </view>
- </view>
- </view>
- </view>
- </view>
- <view class="parmasBox" v-if="navBarTitle&&(shareCon.name||shareCon.phone||shareCon.address||shareCon.remark)">
- <view class="con">
- <view class="top">
- <view class="item" v-if="shareCon.name">
- <view class="name">
- 收货人
- </view>
- <view class="des">
- {{shareCon.name}}
- </view>
- </view>
- <view class="item" v-if="shareCon.phone">
- <view class="name">
- 电话
- </view>
- <view class="des">
- {{shareCon.phone}}
- </view>
- </view>
- <view class="item" v-if="shareCon.address">
- <view class="name">
- 收货地址
- </view>
- <view class="des">
- {{shareCon.address}}
- </view>
- </view>
- <view class="item" v-if="shareCon.remark">
- <view class="name">
- 备注
- </view>
- <view class="des">
- {{shareCon.remark}}
- </view>
- </view>
- </view>
- </view>
- </view>
- <view class="bot" v-if="!navBarTitle">
- <view class="left">
- <view class="price">
- ¥{{totalPrice.toFixed(0)}}
- </view>
- <image v-if="!showPreviewConfig" src="/static/index/arrDown.png" mode=""
- @click="showPreviewConfig=true"></image>
- <image v-else src="/static/index/arrUp.png" mode="" @click="showPreviewConfig=false"></image>
- </view>
- <view class="right">
- <view class="btn" @click.stop="openInfoBox">
- 确认配置
- </view>
- <view class="btn" v-if="!navBarTitle" @click="back" style="margin-left: 20rpx;">
- 返回
- </view>
- </view>
- </view>
- <u-popup :show="showFixInfo" @close="" @open="" round='10'>
- <view class="topBar" style="">
- <view class="left">
- </view>
- <view class="cen">
- 信息填写
- </view>
- <view class="close" @click="closeInfoBox">
- <u-icon name="close"></u-icon>
- </view>
- </view>
- <view class="pupopCon">
- <view class="item">
- <view class="label">
- 收货人
- </view>
- <u--input clearable placeholder="请输入收货人" border="surround" v-model="name"
- @change="change"></u--input>
- </view>
- <view class="item">
- <view class="label">
- 电话
- </view>
- <u--input clearable placeholder="请输入电话" border="surround" v-model="phone"
- @change="change"></u--input>
- </view>
- <view class="item" style="margin-bottom: 24rpx;height: auto;">
- <view class="label">
- 收货地址
- </view>
- <u--textarea v-model="addr" placeholder="请输入收货地址"></u--textarea>
- </view>
- <view class="item" style="margin-bottom: 64rpx;">
- <view class="label">
- 备注
- </view>
- <u--input clearable placeholder="请输入备注" border="surround" v-model="remark"
- @change="change"></u--input>
- </view>
- <button open-type="share" class="orderBtn" :plain="true">
- 确认下单
- </button>
- </view>
- </u-popup>
- </view>
- </template>
- <script>
- import {
- postOrderReq,
- getOrderDetailReq
- } from '@/api/test/index.js'
- import {
- getBannerDataReq,
- } from '@/api/index/index.js'
- export default {
- components: {
- },
- data() {
- return {
- picUrl: this.$picUrl,
- picBase: this.$picBase,
- topPic: '',
- showFixInfo: false,
- showPreviewConfig: false,
- selHx: null,
- selPp: null,
- selSuo: null,
- selMb: null,
- selCl: null,
- selKt: null,
- totalPrice: null,
- name: '',
- phone: '',
- addr: '',
- remark: '',
- orderId: '',
- pConfig: -1,
- shareCon: null,
- navBarTitle: '',
- orderSuc: false,
- }
- },
- async onLoad(o) {
- let res11 = await getBannerDataReq()
- if (res11.code == 0) {
- console.log('1-----图片配置数据', res11);
- this.topPic = res11.data.find((item, index) => {
- return item.title == '智能控制系统'
- }).head_image
- } else {
- this.$toast(res11.message)
- }
- // o.orderId = 'f0b8c1bb32008715f63d1dfd8876c50f'
- if (o.orderId) {
- this.orderId = o.orderId
- this.navBarTitle = '首页'
- console.log('o.orderId', o.orderId);
- let res = await getOrderDetailReq({
- orderId: o.orderId
- })
- if (res.code == 0) {
- console.log('邀请订单详情返回值-智能控制系统: ', res);
- this.shareCon = res.data
- this.selHx = res.data.config.house_type_data
- this.selPp = res.data.config.brand_data
- this.selSuo = res.data.config.mind_lock_data
- this.selMb = res.data.config.mind_switch_data
- this.selCl = res.data.config.mind_curtain_data
- this.selKt = res.data.config.mind_air_conditioner_data
- } else {
- uni.showToast({
- title: res.message,
- icon: 'none'
- })
- }
- } else {
- this.selHx = getApp().selHx
- this.selPp = getApp().selPp
- this.selSuo = getApp().selSuo
- this.selMb = getApp().selMb
- this.selCl = getApp().selCl
- this.selKt = getApp().selKt
- this.totalPrice = getApp().totalPrice
- this.pConfig = getApp().pConfig
- }
- },
- async onShareAppMessage(params) {
- if (params.from === 'button' || params.from === 'menu') {
- let phoneReg = /^[1][3,4,5,7,8,9][0-9]{9}$/
- // if (!this.name) {
- // return this.$toast('请填写收货人')
- // }
- // if (!this.phone) {
- // return this.$toast('请填写电话')
- // }
- // if (!phoneReg.test(this.phone)) {
- // return this.$toast('手机号格式不正确')
- // }
- // if (!this.addr) {
- // return this.$toast('请填写收货地址')
- // }
- // if (!this.remark) {
- // return this.$toast('请填写备注')
- // }
- if (this.phone && !phoneReg.test(this.phone)) {
- return this.$toast('手机号格式不正确')
- }
- let res = await postOrderReq({
- address: this.addr,
- phone: this.phone,
- name: this.name,
- remark: this.remark,
- config_id: this.pConfig,
- type: 3
- })
- if (res.code == 0) {
- console.log('提交订单返回值: ', res);
- this.orderId = res.data.orderId
- this.showFixInfo = false
- return {
- title: '定制我家的智能控制系统',
- imageUrl: this.picBase + this.topPic,
- path: '/pages/index/aiControlSys_step2/index?orderId=' + this.orderId,
- mpId: this.$appId,
- type: this.$shareType,
- }
- } else {
- uni.showToast({
- title: res.message,
- icon: 'none'
- })
- }
- }
- },
- methods: {
- openInfoBox() {
- this.showFixInfo = true
- },
- closeInfoBox() {
- this.showFixInfo = false
- },
- async postOrder() {
- let phoneReg = /^[1][3,4,5,7,8,9][0-9]{9}$/
- if (!this.name) {
- return this.$toast('请填写收货人')
- }
- if (!this.phone) {
- return this.$toast('请填写电话')
- }
- if (!phoneReg.test(this.phone)) {
- return this.$toast('手机号格式不正确')
- }
- if (!this.addr) {
- return this.$toast('请填写收货地址')
- }
- if (!this.remark) {
- return this.$toast('请填写备注')
- }
- console.log('智控下单参数', {
- address: this.addr,
- phone: this.phone,
- name: this.name,
- remark: this.remark,
- config_id: this.selHx.id + ',' + this.selPp.id + ',' + this.selSuo.id + ',' + this.selMb
- .id + ',' + this.selCl.id + ',' + this.selKt.id,
- type: 3
- });
- let res = await postOrderReq({
- address: this.addr,
- phone: this.phone,
- name: this.name,
- remark: this.remark,
- // config_id: this.selHx.id + ',' + this.selPp.id + ',' + this.selSuo.id + ',' + this.selMb
- // .id + ',' + this.selCl.id + ',' + this.selKt.id,
- config_id: this.pConfig,
- type: 3
- })
- if (res.code == 0) {
- console.log('提交订单返回值: ', res);
- this.$toast('提交成功')
- this.orderId = res.data.orderId
- this.showFixInfo = false
- this.orderSuc = true
- } else {
- uni.showToast({
- title: res.message,
- icon: 'none'
- })
- }
- },
- back() {
- uni.navigateBack()
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- @import "./index.scss";
- </style>
|