| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332 |
- <template>
- <view class="page">
- <navBar :backType="navBarTitle" :title="navBarTitle?navBarTitle:'智能控制系统'" :back="true" color="black"
- background="white" />
- <image class="topImg" :src="picUrl + '/static/other/c2.png'" 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">
- <view class="con">
- <view class="top">
- <view class="item">
- <view class="name">
- 收货人
- </view>
- <view class="des">
- {{shareCon.name}}
- </view>
- </view>
- <view class="item">
- <view class="name">
- 电话
- </view>
- <view class="des">
- {{shareCon.phone}}
- </view>
- </view>
- <view class="item">
- <view class="name">
- 收货地址
- </view>
- <view class="des">
- {{shareCon.address}}
- </view>
- </view>
- <view class="item">
- <view class="name">
- 备注
- </view>
- <view class="des">
- {{shareCon.remark}}
- </view>
- </view>
- </view>
- </view>
- </view>
- <!-- <image v-if="!navBarTitle" @click="back" src="/static/index/backBtnImg.png" mode="" class="rule_img"></image> -->
- <view class="bot" v-if="!navBarTitle">
- <!-- <view class="left" @click="showPreviewConfig=true"> -->
- <view class="left" @click="">
- <view class="price">
- ¥{{totalPrice.toFixed(2)}}
- </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">
- <button open-type="share" v-if="orderSuc" class="btn" :plain="true">
- 分享
- </button>
- <view class="btn" v-else @click="showFixInfo=true">
- 确认配置
- </view>
- <view class="btn" v-if="!navBarTitle" @click="back" style="margin-left: 20rpx;">
- 返回
- </view>
- </view>
- </view>
- <u-popup :show="showFixInfo" @close="close" @open="open" round='10'>
- <view class="topBar" style="">
- <view class="left">
- </view>
- <view class="cen">
- 信息填写
- </view>
- <view class="close" @click="showFixInfo=false">
- <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>
- <u-button text="确认下单" color="#333" @click="postOrder"></u-button>
- </view>
- </u-popup>
- </view>
- </template>
- <script>
- import {
- postOrderReq,
- getOrderDetailReq
- } from '@/api/test/index.js'
- export default {
- components: {
- },
- data() {
- return {
- picUrl: this.$picUrl,
- 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) {
- // o.orderId = '43c43ced14b312fb69d80cedbd7b23f4'
- 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
- this.selSuo = res.data.config.mind_lock
- this.selMb = res.data.config.mind_switch
- this.selCl = res.data.config.mind_curtain
- this.selKt = res.data.config.mind_air_conditioner
- } 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
- }
- },
- onShareAppMessage(params) {
- if (params.from === 'button' || params.from === 'menu') {
- return {
- title: '定制我家的智能控制系统',
- imageUrl: this.picUrl + '/static/other/c2.png',
- path: '/pages/index/aiControlSys_step2/index?orderId=' + this.orderId,
- mpId: this.$appId,
- type: this.$shareType,
- }
- }
- },
- methods: {
- 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>
|