• MVC退单



    @{
    ViewBag.Title = "SaleIndex";
    }

    <h2>SaleIndex</h2>
    <script>
    var UId = 0;
    var OId = 0;
    var GId = 0;
    $(function () {
    //判断是否从详情页面过来的
    if (this.location.search.split("?") == null) {
    this.location.href = '/Sale/LoginIndex';
    }
    else {
    UId = location.search.split("?")[1].split("&")[0].split("=")[1];
    OId = location.search.split("?")[1].split("&")[1].split("=")[1];
    }
    DataBound();
    })
    function DataBound() {
    $.ajax({
    url: "http://localhost:57190/api/Sale/GetOrdersInfos",
    data: { UId: UId, OId: OId },
    type: "get",
    dataType: "json",
    success: function (d) {
    $(d).each(function (i, n) {
    $("#OId").text(n.OId);
    })

    }
    })
    }
    function SaleReturn() {
    var formData = new FormData();
    var file = document.getElementById("SImg").files[0];
    formData.append("fileInfo", file);
    $.ajax({
    url: "http://localhost:57190/api/Sale/UpLoad",
    type: "POST",
    data: formData,
    contentType: false,//必须false才会自动加上正确的Content-Type
    processData: false,//必须false才会避开jQuery对 formdata 的默认处理,XMLHttpRequest会对 formdata 进行正确的处理
    success: function (data) {
    if (data.Code < 0)
    alert(data.Msg)
    else {
    var obj = {
    UId: UId,
    OId: OId,
    SaleCase: $("#SaleCase").val(),
    SImg: data.Url
    }
    $.ajax({
    url: "http://localhost:57190/api/Sale/SaleReturn",
    contentType: 'application/json',
    data: obj,
    type: "get",
    dataType: "json",
    success: function (d) {
    if (d > 0) {
    alert('退单成功');
    }
    else {
    alert('退单失败');
    }
    }
    })
    }
    },
    error: function (data) {
    alert("上传失败!");
    }
    });


    }
    </script>
    <table class="table">
    <thead>
    <tr>
    <td>订单编号:</td>
    <td><label id="OId"></label></td>
    </tr>
    <tr>
    <td>退回原因:</td>
    <td><input id="SaleCase" type="text" /></td>
    </tr>
    <tr>
    <td>退货照片</td>
    <td><input id="SImg" type="file" /></td>
    </tr>
    <tr>
    <td colspan="2"><input id="Button1" type="button" value="退单" onclick="SaleReturn()" /></td>

    </tr>
    </thead>
    </table>

  • 相关阅读:
    C# 开发Chrome内核浏览器(WebKit.net)
    SQL 存储过程语句拼接愁人的时间类型
    Linux简介
    揭秘Node.js深受欢迎的原因
    6个强大的AngularJS扩展应用
    ElasticSearch NEST
    web中的各种打印方案
    配置问题总结
    leetcode -day29 Binary Tree Inorder Traversal &amp; Restore IP Addresses
    HBase高速导入数据--BulkLoad
  • 原文地址:https://www.cnblogs.com/zhang0405/p/13275471.html
Copyright © 2020-2023  润新知