Browse Source

装修预算报价

xiaohaizhao 1 year ago
parent
commit
f31d46c2b6
3 changed files with 176 additions and 1 deletions
  1. 6 1
      components/bottomModules/bottom2.vue
  2. 2 0
      pages.json
  3. 168 0
      store/budget/result.vue

+ 6 - 1
components/bottomModules/bottom2.vue

@@ -39,7 +39,7 @@
                     :name="item.name" />
             </u-radio-group>
         </view>
-        <view class="submit" hover-class="navigator-hover">
+        <view class="submit" hover-class="navigator-hover" @click="toEstimate">
             立即估算报价 <text class="iconfont icon-a-wodetiaozhuan" />
         </view>
         <view class="evenMore">
@@ -101,6 +101,11 @@ export default {
         onInput(e) {
             this.submitData.area = e.detail.value;
             console.log("submitData", this.submitData)
+        },
+        toEstimate() {
+            uni.navigateTo({
+                url: '/store/budget/result?data=' + JSON.stringify(this.submitData)
+            });
         }
     },
 }

+ 2 - 0
pages.json

@@ -68,6 +68,8 @@
 			"path": "orderForm/insert"
 		}, {
 			"path": "budget/changePrice"
+		}, {
+			"path": "budget/result"
 		}, {
 			"path": "storeQRCode/index"
 		}]

+ 168 - 0
store/budget/result.vue

@@ -0,0 +1,168 @@
+<template>
+    <view>
+        <view class="box">
+            <view class="title">
+                您的装修报价是:
+            </view>
+
+            <view class="price-box">
+                <view class="price">
+                    {{ CNY(price.min, '') }}
+                </view>
+                <view class="link">
+                    ~
+                </view>
+                <view class="price">
+                    {{ CNY(price.max, '') }}
+                </view>
+                <view class="unit">
+                    元
+                </view>
+            </view>
+        </view>
+        <bottomForm submitType="品质服务" :extrajson="extrajson" />
+    </view>
+</template>
+
+<script>
+export default {
+    data() {
+        return {
+            extrajson: {},
+            price: {
+                min: 0,
+                max: 0
+            },
+            sa_storeid: 0
+        }
+    },
+    onLoad(options) {
+        console.log("options", options)
+        let data = JSON.parse(options.data);
+        this.extrajson = data;
+
+        uni.setNavigationBarTitle({
+            title: '装修预算'
+        });
+        const systemInitIsComplete = this.$Http.systemInitIsComplete;
+        if (!systemInitIsComplete || typeof systemInitIsComplete == 'object') {
+            this.$Http.HomePageStartRendering = render(this)
+        } else {
+            render(this)
+        }
+        function render(that) {
+            that.calculate(options.sa_storeid || uni.getStorageSync('shop').sa_storeid)
+        }
+    },
+    methods: {
+        calculate(sa_storeid) {
+            this.$Http.basic({
+                "id": 20240515131702,
+                "content": {
+                    sa_storeid
+                }
+            }).then(res => {
+                console.log("获取门店装修预算", res)
+                if (this.cutoff(res.msg)) return;
+                let extrajson = this.extrajson
+                let obj = {
+                    min: 0,
+                    max: 0
+                }
+                res.data.forEach(v => {
+                    switch (v.type) {
+                        case "厨房":
+                            obj.min += v.min_price * 6 * extrajson.bathroom[0]
+                            obj.max += v.max_price * 6 * extrajson.bathroom[0]
+                            break;
+                        case "卫浴":
+                            let num = extrajson.bathroom[2];
+                            if (num == '>') num = 4;
+                            obj.min += v.min_price * 4 * num;
+                            obj.max += v.max_price * 4 * num;
+                            break;
+                        case "背景墙":
+                            let bjq = extrajson.wall[0];
+                            if (bjq == '>') bjq = 4;
+                            obj.min += v.min_price * 4 * bjq;
+                            obj.max += v.max_price * 4 * bjq;
+                            break;
+                    }
+                })
+                this.price = obj;
+                this.sa_storeid = sa_storeid;
+                console.log(obj)
+            })
+        },
+        getSheraDate() {
+            return {
+                title: '您的装修报价是:', // 标题
+                path: "/store/budget/result?data=" + JSON.stringify(this.extrajson) + '&sa_storeid=' + this.sa_storeid, // 分享路径
+                imageUrl: ""// 分享图
+            };
+        }
+    },
+    onShareAppMessage(res) {
+        return this.getSheraDate()
+    },
+    onShareTimeline() {
+        return this.getSheraDate()
+    }
+}
+</script>
+
+<style lang="scss" scoped>
+.box {
+    width: 100vw;
+    padding: 30px 20px;
+    box-sizing: border-box;
+    background: radial-gradient(100% 0% at 50% 50%, #7E7E7E 0%, #787878 100%);
+
+    .title {
+        line-height: 22px;
+        font-family: PingFang SC, PingFang SC;
+        font-size: 16px;
+        color: #FFFFFF;
+    }
+
+    .price-box {
+        display: flex;
+        width: 100%;
+        margin-top: 15px;
+        align-items: center;
+
+        .price {
+            width: 146px;
+            height: 45px;
+            line-height: 45px;
+            text-align: center;
+            box-sizing: border-box;
+            background: rgba(255, 255, 255, 0.2);
+            border-radius: 2px;
+            border: 1px solid rgba(255, 255, 255, 0.2);
+            font-family: Source Han Sans SC, Source Han Sans SC;
+            font-weight: bold;
+            font-size: 24px;
+            color: #FFFFFF;
+        }
+
+        .link {
+            width: 14px;
+            text-align: center;
+            font-family: Source Han Sans SC, Source Han Sans SC;
+            font-weight: bold;
+            font-size: 24px;
+            color: #FFFFFF;
+            margin: 0 4px;
+            margin-right: 6px;
+        }
+
+        .unit {
+            font-family: PingFang SC, PingFang SC;
+            font-size: 14px;
+            color: #FFFFFF;
+            margin-left: 10px;
+        }
+    }
+}
+</style>