Przeglądaj źródła

update:信息采集

ct 1 tydzień temu
rodzic
commit
560d012b21
1 zmienionych plików z 161 dodań i 64 usunięć
  1. 161 64
      src/views/order/userInformationOrder/userInfoDetail.vue

+ 161 - 64
src/views/order/userInformationOrder/userInfoDetail.vue

@@ -86,6 +86,40 @@
       <!-- 问卷 -->
       <div class="my-title" style="margin-top: 20px;">问卷信息</div>
 
+      <div v-if="jsonInfoData && jsonInfoData.length > 0">
+        <el-descriptions :column="1" border>
+          <el-descriptions-item v-for="(item, index) in jsonInfoData" :key="index" :label="item.title">
+            <div v-if="item.value && item.value.length > 0">
+              <template v-if="Array.isArray(item.value)">
+                <div v-for="(val, valIndex) in item.value" :key="valIndex" class="json-info-item">
+                  {{ getOptionName(item.options, val) }}
+                </div>
+              </template>
+              <template v-else>
+                {{ getOptionName(item.options, item.value) }}
+              </template>
+            </div>
+            <div v-else class="json-info-empty">无</div>
+          </el-descriptions-item>
+        </el-descriptions>
+      </div>
+      <div v-else style="padding: 20px; text-align: center; color: #999;">
+        暂无采集信息
+      </div>
+
+
+      <div
+        v-for="(item, index) in detail.questionJson"
+        :key="index"
+        class="question-block"
+      >
+        <div class="question-title">{{ item.title }}</div>
+
+        <div class="question-answer">
+          {{ getSelectedOptionName(item) }}
+        </div>
+      </div>
+
       <div
         v-for="(item, index) in detail.questionJson"
         :key="index"
@@ -98,6 +132,65 @@
         </div>
       </div>
 
+      <div class="my-title" style="margin-top: 20px;">商品信息</div>
+      <div class="my-content" v-if="packageInfo">
+        <div>
+          <el-table
+            border
+            :data="productInfo"
+            size="small"
+            style="width: 100%;margin-top: 20px"
+          >
+            <el-table-column label="商品图片" width="150" align="center">
+              <template slot-scope="scope">
+                <img v-if="scope.row.image" :src="scope.row.image" style="height: 80px; max-width: 120px;">
+                <span v-else>无图片</span>
+              </template>
+            </el-table-column>
+            <el-table-column label="商品编码" width="300" align="center">
+              <template slot-scope="scope">
+                {{ scope.row.barCode || '-' }}
+              </template>
+            </el-table-column>
+            <el-table-column label="商品名称" width="300" align="center">
+              <template slot-scope="scope">
+                {{ scope.row.productName || '-' }}
+              </template>
+            </el-table-column>
+            <el-table-column label="单价" width="240" align="center">
+              <template slot-scope="scope">
+                ¥{{ Number(scope.row.price || 0).toFixed(2) }}
+              </template>
+            </el-table-column>
+            <el-table-column label="规格" width="240" align="center">
+              <template slot-scope="scope">
+                {{ scope.row.sku || scope.row.prescribeSpec || '默认' }}
+              </template>
+            </el-table-column>
+            <el-table-column label="数量" width="180" align="center">
+              <template slot-scope="scope">
+                {{ scope.row.count || scope.row.num || 0 }}
+              </template>
+            </el-table-column>
+            <el-table-column label="处方药" width="240" align="center">
+              <template slot-scope="scope">
+                {{ (scope.row.isDrug === 1 || scope.row.isPrescribe === 1) ? '是' : '否' }}
+              </template>
+            </el-table-column>
+            <el-table-column label="小计" align="center">
+              <template slot-scope="scope">
+                ¥{{ (Number(scope.row.count || 0) * Number(scope.row.price || 0)).toFixed(2) }}
+              </template>
+            </el-table-column>
+          </el-table>
+
+          <!-- 合计信息 -->
+          <div style="float: right;margin: 20px" v-if="packageInfo.totalPrice != null">
+            合计:<span class="color-danger">¥{{ Number(packageInfo.totalPrice).toFixed(2) }}</span>
+          </div>
+        </div>
+      </div>
+
       <!-- 医生建议输入框 -->
       <div style="margin-top:20px;">
         <el-form label-width="120px">
@@ -114,10 +207,16 @@
       </div>
 
       <div style="text-align:right; margin-top:20px;">
-        <el-button v-if="doctorType === 1" type="primary" :loading="confirming" @click="doctorConfirm">
+        <el-button v-if="doctorType === 1" :disabled="detail.doctorConfirm !== 0"  type="primary" :loading="confirming" @click="doctorConfirm(-1)">
+          医生拒绝
+        </el-button>
+        <el-button v-if="doctorType === 1" :disabled="detail.doctorConfirm !== 0" type="primary" :loading="confirming" @click="doctorConfirm(1)">
           医生确认
         </el-button>
-        <el-button v-if="doctorType === 2" type="primary" :loading="confirming" @click="doctorType2Confirm">
+        <el-button v-if="doctorType === 2" :disabled="detail.doctorType2Confirm !== 0" type="primary" :loading="confirming" @click="doctorType2Confirm(-1)">
+          药师拒绝
+        </el-button>
+        <el-button v-if="doctorType === 2" :disabled="detail.doctorType2Confirm !== 0" type="primary" :loading="confirming" @click="doctorType2Confirm(1)">
           药师确认
         </el-button>
       </div>
@@ -125,65 +224,7 @@
     </div>
 
 
-    <div class="my-content" v-if="packageInfo">
-      <div class="my-title">商品信息</div>
-
-      <div>
-        <el-table
-          border
-          :data="productInfo"
-          size="small"
-          style="width: 100%;margin-top: 20px"
-        >
-          <el-table-column label="商品图片" width="150" align="center">
-            <template slot-scope="scope">
-              <img v-if="scope.row.image" :src="scope.row.image" style="height: 80px; max-width: 120px;">
-              <span v-else>无图片</span>
-            </template>
-          </el-table-column>
-          <el-table-column label="商品编码" width="300" align="center">
-            <template slot-scope="scope">
-              {{ scope.row.barCode || '-' }}
-            </template>
-          </el-table-column>
-          <el-table-column label="商品名称" width="300" align="center">
-            <template slot-scope="scope">
-              {{ scope.row.productName || '-' }}
-            </template>
-          </el-table-column>
-          <el-table-column label="单价" width="240" align="center">
-            <template slot-scope="scope">
-              ¥{{ Number(scope.row.price || 0).toFixed(2) }}
-            </template>
-          </el-table-column>
-          <el-table-column label="规格" width="240" align="center">
-            <template slot-scope="scope">
-              {{ scope.row.sku || scope.row.prescribeSpec || '默认' }}
-            </template>
-          </el-table-column>
-          <el-table-column label="数量" width="180" align="center">
-            <template slot-scope="scope">
-              {{ scope.row.count || scope.row.num || 0 }}
-            </template>
-          </el-table-column>
-          <el-table-column label="处方药" width="240" align="center">
-            <template slot-scope="scope">
-              {{ (scope.row.isDrug === 1 || scope.row.isPrescribe === 1) ? '是' : '否' }}
-            </template>
-          </el-table-column>
-          <el-table-column label="小计" align="center">
-            <template slot-scope="scope">
-              ¥{{ (Number(scope.row.count || 0) * Number(scope.row.price || 0)).toFixed(2) }}
-            </template>
-          </el-table-column>
-        </el-table>
-
-        <!-- 合计信息 -->
-        <div style="float: right;margin: 20px" v-if="packageInfo.totalPrice != null">
-          合计:<span class="color-danger">¥{{ Number(packageInfo.totalPrice).toFixed(2) }}</span>
-        </div>
-      </div>
-    </div>
+
 
 
 
@@ -204,7 +245,8 @@ export default {
       productInfo:null,
       detail: null,
       doctorAdvice: "",
-      confirming: false
+      confirming: false,
+      jsonInfoData: []  // 新增:存储采集信息数据
     };
   },
   computed: {
@@ -285,6 +327,38 @@ export default {
           } else {
             this.detail.questionJson = [];
           }
+
+          // 解析问卷 JSON
+          if (this.detail.questionJson) {
+            if (typeof this.detail.questionJson === "string") {
+              try {
+                this.detail.questionJson = JSON.parse(this.detail.questionJson);
+              } catch (e) {
+                console.error("questionJson 解析失败", e);
+                this.detail.questionJson = [];
+              }
+            }
+          } else {
+            this.detail.questionJson = [];
+          }
+
+          // 解析采集信息 jsonInfo
+          if (this.detail.jsonInfo) {
+            try {
+              if (typeof this.detail.jsonInfo === "string") {
+                this.jsonInfoData = JSON.parse(this.detail.jsonInfo);
+              } else {
+                this.jsonInfoData = this.detail.jsonInfo;
+              }
+              // 确保按 sort 字段排序
+              this.jsonInfoData.sort((a, b) => (a.sort || 0) - (b.sort || 0));
+            } catch (e) {
+              console.error("jsonInfo 解析失败", e);
+              this.jsonInfoData = [];
+            }
+          } else {
+            this.jsonInfoData = [];
+          }
         });
       } catch (e) {
         this.$message.error("加载详情失败");
@@ -298,17 +372,25 @@ export default {
       return opt ? opt.name : "-";
     },
 
+    /** 获取采集信息选项名称 */
+    getOptionName(options, value) {
+      if (!options || value === null || value === undefined) return "-";
+      const option = options.find(opt => opt.value == value);
+      return option ? option.name : value;
+    },
+
     /** 医生开方按钮 */
     handleOpenPrescription() {
       this.$emit("open-prescription", this.detail);
     },
 
     /** 医生确认按钮 */
-    async doctorConfirm() {
+    async doctorConfirm(status) {
       if (!this.detail) return;
 
       try {
         this.detail.doctorAdvice = this.doctorAdvice;
+        this.detail.doctorConfirm = status;
         console.log(this.detail)
         doctorConfirm(this.detail).then(response => {
           this.msgSuccess("医生确认成功");
@@ -322,11 +404,12 @@ export default {
     },
 
     /** 药师确认按钮 */
-    async doctorType2Confirm() {
+    async doctorType2Confirm(status) {
       if (!this.detail) return;
 
       try {
         this.detail.doctorAdvice = this.doctorAdvice;
+        this.detail.doctorType2Confirm = status;
         console.log(this.detail)
         doctorType2Confirm(this.detail).then(response => {
           this.msgSuccess("药师确认成功");
@@ -380,4 +463,18 @@ export default {
 .question-answer {
   color: #333;
 }
+/* 采集信息样式 */
+.json-info-item {
+  padding: 4px 0;
+  border-bottom: 1px dashed #eee;
+
+  &:last-child {
+    border-bottom: none;
+  }
+}
+
+.json-info-empty {
+  color: #999;
+  font-style: italic;
+}
 </style>