result.vue 4.2 KB

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