zoukankan      html  css  js  c++  java
  • 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>

  • 相关阅读:
    MAVEN教程--01安装|创建|解释
    树、森林与二叉树的转换
    slf4j+log4j的初次使用
    DFS--障碍在指定时间会消失
    linshi18
    首次网站(域名/解析/绑定/备案)
    2017(秋)软工作业: (1)课程学习热身
    Mac 下 Java 多版本切换
    git 命令(补充篇)的本质理解
    git 命令(提高篇)的本质理解
  • 原文地址:https://www.cnblogs.com/zhang0405/p/13275471.html
Copyright © 2011-2022 走看看