Przeglądaj źródła

feat(admin): add profit share receiver agreement display

- Add agreement link display in receiver detail modal
- Handle relative and absolute path for agreement file URL
- Concatenate base URL for relative paths to generate full URL
- Support direct linking for absolute paths
- Add conditional rendering for agreement section
- Ensure agreement link opens in new tab
runphp 4 miesięcy temu
rodzic
commit
e05336036f
1 zmienionych plików z 22 dodań i 0 usunięć
  1. 22 0
      resource/admin/ProfitShareReceiver.vue

+ 22 - 0
resource/admin/ProfitShareReceiver.vue

@@ -134,6 +134,15 @@
         <el-form-item label="申请时间:">
           <span>{{ detailData.create_time }}</span>
         </el-form-item>
+        <el-form-item v-if="detailData.entrust_local_path" label="合作协议:">
+          <el-link 
+            :href="detailData.entrust_local_full_url || detailData.entrust_local_path" 
+            target="_blank" 
+            type="primary"
+          >
+            查看合作协议
+          </el-link>
+        </el-form-item>
       </el-form>
       <template #footer>
         <span class="dialog-footer">
@@ -267,6 +276,19 @@ export default {
         const res = await this.axiosInstance.get(`/lakala/profit_share_receiver/${id}`)
         if (res.code === 200) {
           this.detailData = res.data
+          // 处理合作协议文件路径
+          if (this.detailData.entrust_local_path) {
+            // 如果是相对路径,则拼接VITE_API_BASE_URL
+            if (!this.detailData.entrust_local_path.startsWith('http')) {
+              const { VITE_API_BASE_URL } = this.axiosInstance.defaults.baseURL ? 
+                { VITE_API_BASE_URL: this.axiosInstance.defaults.baseURL.replace('/admin', '') } : 
+                { VITE_API_BASE_URL: '' }
+              this.detailData.entrust_local_full_url = VITE_API_BASE_URL + this.detailData.entrust_local_path
+            } else {
+              // 如果是绝对路径,直接使用
+              this.detailData.entrust_local_full_url = this.detailData.entrust_local_path
+            }
+          }
         } else {
           this.$message.error(res.msg || res.message || '获取详情失败')
         }