| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>估价模拟</title>
- <style>
- body{
- font-family: Arial;
- background:#f6f7f9;
- }
- .container{
- width:1100px;
- margin:20px auto;
- display:flex;
- gap:20px;
- }
- .left{
- width:65%;
- background:#fff;
- padding:20px;
- border-radius:6px;
- }
- .right{
- width:35%;
- background:#fff;
- padding:20px;
- border-radius:6px;
- }
- .step{
- margin-bottom:20px;
- }
- .prop{
- margin-bottom:12px;
- }
- .prop-title{
- font-weight:bold;
- margin-bottom:6px;
- }
- .option{
- display:block;
- margin-left:10px;
- margin-bottom:4px;
- }
- h2{
- margin-top:0;
- }
- table{
- width:100%;
- border-collapse: collapse;
- }
- td,th{
- border:1px solid #ddd;
- padding:6px;
- font-size:13px;
- }
- </style>
- </head>
- <body>
- <div class="container">
- <div class="left">
- <h2>{{ machine_name }}</h2>
- <form method="post" action="/estimate/simulate">
- <input type="hidden" name="machine_id" value="{{ machine_id }}">
- <div class="base-price-box">
- <label>
- 基准价格(可人工输入):
- <input
- type="number"
- step="0.01"
- name="base_price"
- placeholder="人工输入基准价"
- value="{{ result.base_price if result }}"
- style="width:140px;"
- >
- 元
- </label>
- </div>
- {% for step in tpl.template %}
- <div class="step">
- <h3>{{ step.stepName }}</h3>
- {% for p in step.properties %}
- <div class="prop">
- <div class="prop-title">
- {{ p.name }}
- {% if p.required %}
- <span style="color:red">*</span>
- {% endif %}
- </div>
- {% set input_type = "checkbox" if p.isMulti else "radio" %}
- {% set input_name = "option_" ~ p.id %}
- {% for v in p["values"] %}
- <label class="option">
- <input
- type="{{ input_type }}"
- name="{{ input_name }}"
- value="{{ v.valueId }}"
- {% if result and (v.valueId|string) in result.selected %}
- checked
- {% endif %}
- >
- {{ v.valueText }}
- </label>
- {% endfor %}
- </div>
- {% endfor %}
- </div>
- {% endfor %}
- <button type="submit">开始估价</button>
- </form>
- </div>
- <div class="right">
- {% if result %}
- <h3>价格计算明细</h3>
- <p>基准价(没有则为1):{{ result.base_price }} 元</p>
- <table>
- <tr>
- <th>项</th>
- <th>系数</th>
- <!-- <th>固定扣减</th>
- <th>变动</th> -->
- </tr>
- {% for d in result.details %}
- <tr>
- <td
- {% if d.option_name and (d.option_name|string).startswith('--') %}
- style="color:red;font-weight:bold;"
- {% endif %}
- >
- {{ d.option_name }}
- </td>
- <td>
- {% if d.factor %}
- {{ d.factor }}
- {% else %}
- -
- {% endif %}
- </td>
- <!-- <td>
- {% if d.absolute %}
- - {{ d.absolute }}
- {% else %}
- -
- {% endif %}
- </td>
- <td>
- {{ d.before }} → {{ d.after }}
- </td> -->
- </tr>
- {% endfor %}
- </table>
- <h3 style="margin-top:15px;">
- 最终价格:{{ result.final_price }} 元
- </h3>
- {% else %}
- <h3>请选择检测项后点击估价</h3>
- {% endif %}
- </div>
- </div>
- </body>
- </html>
|