result.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <template>
  2. <view>
  3. <view class="box">
  4. <view class="title">
  5. 您的装修报价是:
  6. </view>
  7. <view class="price-box">
  8. <view class="price">
  9. {{ CNY(price.min, '') }}
  10. </view>
  11. <view class="link">
  12. ~
  13. </view>
  14. <view class="price">
  15. {{ CNY(price.max, '') }}
  16. </view>
  17. <view class="unit">
  18. </view>
  19. </view>
  20. </view>
  21. <bottomForm submitType="品质服务" :extrajson="extrajson" typemx="装修预算" />
  22. </view>
  23. </template>
  24. <script>
  25. export default {
  26. data() {
  27. return {
  28. extrajson: {},
  29. price: {
  30. min: 0,
  31. max: 0
  32. },
  33. sa_storeid: 0
  34. }
  35. },
  36. onLoad(options) {
  37. console.log("options", options)
  38. let data = JSON.parse(options.data);
  39. this.extrajson = data;
  40. uni.setNavigationBarTitle({
  41. title: '装修预算'
  42. });
  43. const systemInitIsComplete = this.$Http.systemInitIsComplete;
  44. if (!systemInitIsComplete || typeof systemInitIsComplete == 'object') {
  45. this.$Http.HomePageStartRendering = render(this)
  46. } else {
  47. render(this)
  48. }
  49. function render(that) {
  50. that.calculate(options.sa_storeid || uni.getStorageSync('shop').sa_storeid)
  51. }
  52. },
  53. methods: {
  54. calculate(sa_storeid) {
  55. this.$Http.basic({
  56. "id": 20240515131702,
  57. "content": {
  58. sa_storeid
  59. }
  60. }).then(res => {
  61. console.log("获取门店装修预算", res)
  62. if (this.cutoff(res.msg)) return;
  63. let extrajson = this.extrajson
  64. let obj = {
  65. min: 0,
  66. max: 0
  67. }
  68. res.data.forEach(v => {
  69. switch (v.type) {
  70. case "厨房":
  71. obj.min += v.min_price * 6 * extrajson.bathroom[0]
  72. obj.max += v.max_price * 6 * extrajson.bathroom[0]
  73. break;
  74. case "卫浴":
  75. let num = extrajson.bathroom[2];
  76. if (num == '>') num = 4;
  77. obj.min += v.min_price * 4 * num;
  78. obj.max += v.max_price * 4 * num;
  79. break;
  80. case "背景墙":
  81. let bjq = extrajson.wall[0];
  82. if (bjq == '>') bjq = 4;
  83. obj.min += v.min_price * 4 * bjq;
  84. obj.max += v.max_price * 4 * bjq;
  85. break;
  86. }
  87. })
  88. this.price = obj;
  89. this.sa_storeid = sa_storeid;
  90. console.log(obj)
  91. })
  92. },
  93. getSheraDate() {
  94. return {
  95. title: '您的装修报价是:', // 标题
  96. path: "/store/budget/result?data=" + JSON.stringify(this.extrajson) + '&sa_storeid=' + this.sa_storeid, // 分享路径
  97. imageUrl: ""// 分享图
  98. };
  99. }
  100. },
  101. onShareAppMessage(res) {
  102. return this.getSheraDate()
  103. },
  104. onShareTimeline() {
  105. return this.getSheraDate()
  106. }
  107. }
  108. </script>
  109. <style lang="scss" scoped>
  110. .box {
  111. width: 100vw;
  112. padding: 30px 20px;
  113. box-sizing: border-box;
  114. background: radial-gradient(100% 0% at 50% 50%, #7E7E7E 0%, #787878 100%);
  115. .title {
  116. line-height: 22px;
  117. font-family: PingFang SC, PingFang SC;
  118. font-size: 16px;
  119. color: #FFFFFF;
  120. }
  121. .price-box {
  122. display: flex;
  123. width: 100%;
  124. margin-top: 15px;
  125. align-items: center;
  126. .price {
  127. width: 146px;
  128. height: 45px;
  129. line-height: 45px;
  130. text-align: center;
  131. box-sizing: border-box;
  132. background: rgba(255, 255, 255, 0.2);
  133. border-radius: 2px;
  134. border: 1px solid rgba(255, 255, 255, 0.2);
  135. font-family: Source Han Sans SC, Source Han Sans SC;
  136. font-weight: bold;
  137. font-size: 24px;
  138. color: #FFFFFF;
  139. }
  140. .link {
  141. width: 14px;
  142. text-align: center;
  143. font-family: Source Han Sans SC, Source Han Sans SC;
  144. font-weight: bold;
  145. font-size: 24px;
  146. color: #FFFFFF;
  147. margin: 0 4px;
  148. margin-right: 6px;
  149. }
  150. .unit {
  151. font-family: PingFang SC, PingFang SC;
  152. font-size: 14px;
  153. color: #FFFFFF;
  154. margin-left: 10px;
  155. }
  156. }
  157. }
  158. </style>