CY_ECommercePlatform/CY.WebForm/Pages/business/Waixiefukuanshenqing.aspx
@@ -42,6 +42,31 @@
                    <td class="ali03">订单金额:</td>
                    <td> <span id="ordernjine" runat="server" ></span></td>
                </tr>
                 <tr>
             <td class="ali03 w100px">
                    审批证明:
                </td>
                <td>
                     <input type="file" id="file1" name="__hetongFile" keepdefaultstyle="true" runat="server" text="请选择文件" />
                   <input type="button" value="上传图片" onclick="checkSelFile();" />
                </td>
             </tr>
                   <tr    class="AddTab" style="display:none;" >
                                <td class="ali03 w100px">
                </td>
                <td>
                     <input type="hidden" name="HideKeyidFapiao" value="0"   />
                      <input type="hidden" name="HideAttachmentFapiao" value=""   />
                    <a title="查看图片" name="HrefAttachmentFapiao"   target="view_window" href="0">
                               图片
                            </a>
                     <a    name="shanchuAttachmentFapiao"    href="#" onclick="deletefujian(this);" >
                               X
                            </a>
                </td>
                                    </tr>
                <tr>
                    <td colspan="2"></td>
                </tr>
@@ -154,5 +179,71 @@
                alert('请输入有效的正负金额,例如  45.67');
            }
        }
        //查看
        function checkSelFile() {
                var oFile = document.getElementById('file1');
                if (oFile.value == "") {
                    alertMsg('没有选择文件');
                    return;
                }
                var formData = new FormData();
                formData.append('file', oFile.files[0]); // this.files[0]是文件对象
                $.ajax({
                    url: 'https://yocaisim.51zhengcai.com/api/UpFile/UpdateFile', // 替换为你的服务器端点
                    type: 'POST',
                    data: formData,
                    contentType: false,
                    processData: false,
                    async: false,        // 设置为同步
                    success: function (response) {
                        console.log('File uploaded successfully:', response);
                        if (response.code == 1) {
                            $(".AddTab").last().after($(".AddTab").last().clone(true));
                            $(".AddTab").last().show();
                            $("input[name='HideKeyidFapiao']").last().val("");
                            $("input[name='HideAttachmentFapiao']").last().val(response.data);
                            $('a[name="HrefAttachmentFapiao"]').last().attr("href", response.data);
                            $('a[name="HrefAttachmentFapiao"]').last().html('<img src="' + response.data+'" width="20" height="20" />');
                            alertMsg('上传成功');
                        } else {
                            alertMsg('上传失败');
                        }
                    },
                    error: function (xhr, status, error) {
                        console.error('File upload failed:', status, error);
                        alertMsg('上传失败');
                    }
                });
        }
        function deletefujian(obj) {
            if (confirm("是否删除选中数据?")) {
                $(obj).parent().parent().remove()
            }
        }
    </script>
</html>