代码修改后的版本,全部提交
This commit is contained in:
2
Mtxfw.shop/Sell/Order.aspx
Normal file
2
Mtxfw.shop/Sell/Order.aspx
Normal file
@@ -0,0 +1,2 @@
|
||||
<%@ Page language="c#" Codebehind="Order.aspx.cs" AutoEventWireup="True" Inherits="PeiXun.OrderBook" %>
|
||||
<FONT face="<22><><EFBFBD><EFBFBD>"></FONT>
|
||||
141
Mtxfw.shop/Sell/Order.aspx.cs
Normal file
141
Mtxfw.shop/Sell/Order.aspx.cs
Normal file
@@ -0,0 +1,141 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Drawing;
|
||||
using System.Web;
|
||||
using System.Web.SessionState;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.HtmlControls;
|
||||
using System.Globalization;
|
||||
namespace PeiXun
|
||||
{
|
||||
/// <summary>
|
||||
/// index <20><>ժҪ˵<D2AA><CBB5><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public partial class OrderBook : System.Web.UI.Page
|
||||
{
|
||||
public Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
|
||||
Mtxfw.DAL.order_info daoorder = new Mtxfw.DAL.order_info();
|
||||
Mtxfw.Model.order_info Modelorder = new Mtxfw.Model.order_info();
|
||||
Mtxfw.DAL.P_Product daoProduct = new Mtxfw.DAL.P_Product();
|
||||
protected void Page_Load(object sender, System.EventArgs e)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(Request.QueryString["ID"]))
|
||||
{
|
||||
|
||||
int ProductID = int.Parse(Request.QueryString["ID"].ToString());
|
||||
if (Session["MemberId"] != null)
|
||||
{
|
||||
int MemberId = Convert.ToInt32(Session["MemberId"].ToString());
|
||||
Mtxfw.Model.user_info model = daoUser.GetModel(MemberId);
|
||||
if (model != null)
|
||||
{
|
||||
string Contactname = "", Contacttel = "", Address = "", Zipcode = "", strProvince = "", strCity = "", strCounty = "", OrdersID = "";
|
||||
if (model.RealName == "" || model.Phone == "" || model.MailingAddress == "")
|
||||
{
|
||||
Response.Write("<script language='javascript'>alert('<27><><EFBFBD><EFBFBD><EFBFBD>ջ<EFBFBD><D5BB><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD>');location.replace('/Member_Info.aspx');</script>");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Contactname = model.RealName;
|
||||
Contacttel = model.Phone;
|
||||
Address = model.MailingAddress;
|
||||
Zipcode = model.PostalCode;
|
||||
strProvince = model.Province;
|
||||
strCity = model.City;
|
||||
strCounty = model.County;
|
||||
Mtxfw.Model.P_Product Pmodel = daoProduct.GetModel(ProductID);
|
||||
if (Pmodel != null)
|
||||
{
|
||||
if (Pmodel.P_Inventory > 0)
|
||||
{
|
||||
string prodNum = "1";
|
||||
Double SubTotal = Pmodel.P_VIP_P;
|
||||
DateTime dt = DateTime.Now;
|
||||
string OID = dt.ToString("yyyMMddhhmmssffff", DateTimeFormatInfo.InvariantInfo);
|
||||
if (Convert.ToDouble(SubTotal.ToString("f2")) <= Convert.ToDouble(model.umoney0.ToString("f2")))
|
||||
{
|
||||
Modelorder.pid = ProductID;
|
||||
Modelorder.orderid = OID;
|
||||
Modelorder.Contactname = Contactname;
|
||||
Modelorder.Contacttel = Contacttel;
|
||||
Modelorder.Province = strProvince;
|
||||
Modelorder.City = strCity;
|
||||
Modelorder.County = strCounty;
|
||||
Modelorder.Address = Address;
|
||||
Modelorder.Zipcode = Zipcode;
|
||||
Modelorder.Guests = "";
|
||||
Modelorder.Totalprice = SubTotal;
|
||||
Modelorder.Totalnum = int.Parse(prodNum);
|
||||
Modelorder.O_Submit = "1";
|
||||
Modelorder.UserID = MemberId;
|
||||
Modelorder.utype = "2";
|
||||
int OrderID = daoorder.Add(Modelorder);
|
||||
daoProduct.UpdateInventory(ProductID, -1);
|
||||
//<2F><><EFBFBD>¶<EFBFBD><C2B6><EFBFBD>Ϊ<EFBFBD>Ѹ<EFBFBD><D1B8><EFBFBD>״̬
|
||||
daoorder.UpdateqyState(0, "1", DateTime.Now, OrderID);
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
daoUser.UpdateMoney("umoney0", -SubTotal, MemberId);
|
||||
Response.Write("<script language='javascript'>alert('<27>һ<EFBFBD><D2BB>ɹ<EFBFBD><C9B9><EFBFBD>');location.replace('/Member_Orders_List.aspx');</script>");
|
||||
}
|
||||
else
|
||||
{
|
||||
Response.Write("<script language='javascript'>alert('<27><><EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>㣡');location.replace('/Member_JiangLi_List.aspx');</script>");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Response.Write("<script language='javascript'>alert('<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" + Pmodel.P_Inventory + "<22><>');location.replace('/');</script>");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Response.Write("<script language='javascript'>alert('<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>');location.replace('/');</script>");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
string RUrl = "/view-" + ProductID + ".html";
|
||||
Session["returnurl"] = RUrl;
|
||||
Response.Redirect("/login.aspx");
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Response.Write("<script language='javascript'>alert('<27><><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>');location.replace('/');</script>");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
#region Web <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɵĴ<EFBFBD><EFBFBD><EFBFBD>
|
||||
override protected void OnInit(EventArgs e)
|
||||
{
|
||||
//
|
||||
// CODEGEN: <20>õ<EFBFBD><C3B5><EFBFBD><EFBFBD><EFBFBD> ASP.NET Web <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ġ<EFBFBD>
|
||||
//
|
||||
InitializeComponent();
|
||||
base.OnInit(e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֧<EFBFBD><D6A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ķ<EFBFBD><C4B7><EFBFBD> - <20><>Ҫʹ<D2AA>ô<EFBFBD><C3B4><EFBFBD><EFBFBD>༭<EFBFBD><E0BCAD><EFBFBD><EFBFBD>
|
||||
/// <20>˷<EFBFBD><CBB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݡ<EFBFBD>
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
16
Mtxfw.shop/Sell/Order.aspx.designer.cs
generated
Normal file
16
Mtxfw.shop/Sell/Order.aspx.designer.cs
generated
Normal file
@@ -0,0 +1,16 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
// 运行库版本:2.0.50727.3615
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace PeiXun {
|
||||
|
||||
|
||||
public partial class OrderBook {
|
||||
}
|
||||
}
|
||||
431
Mtxfw.shop/Sell/UserQRGM.aspx
Normal file
431
Mtxfw.shop/Sell/UserQRGM.aspx
Normal file
@@ -0,0 +1,431 @@
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="~/Telesa.Master" EnableViewStateMac="false"
|
||||
AutoEventWireup="true" CodeBehind="UserQRGM.aspx.cs" Inherits="Mtxfw.shop.UserQRGM" %>
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="MyHead" runat="server">
|
||||
<link href="/css/shop_cart.css" rel="stylesheet" type="text/css" />
|
||||
<script type="text/javascript">
|
||||
|
||||
var ifshow = 1;
|
||||
var pid = '<%=pid %>';
|
||||
var cid = '<%=cid %>';
|
||||
var qid = '<%=qid %>';
|
||||
$(document).ready(function () {
|
||||
$('#select_p').change(function () {//获取城市
|
||||
getCity();
|
||||
});
|
||||
|
||||
$('#select_c').change(function () {//获取县区
|
||||
getCounty();
|
||||
});
|
||||
|
||||
$('#select_p').val(pid);
|
||||
getCity();
|
||||
var IFaddress = <%=IFaddress %>;
|
||||
if(IFaddress==1){
|
||||
addnewaddress();
|
||||
}
|
||||
var b=true;
|
||||
var adds = $(".addresslist ul li .selectaddress");
|
||||
for(var i=0; i<adds.length; i++){
|
||||
if($(adds[i]).attr("checked")==true){
|
||||
b=false;
|
||||
}
|
||||
}
|
||||
if(b){
|
||||
$(adds[0]).attr("checked",true);
|
||||
}
|
||||
})
|
||||
|
||||
function getCity() {
|
||||
if ($('#select_p').val() != '-1') {
|
||||
$.post("/Ajax.ashx", { action: 'GetCity', ProvinceID: $('#select_p').val(), cityIDs: cid }, function (data) {
|
||||
if (data != 'false') {
|
||||
$('#select_c').html(data);
|
||||
getCounty();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function getCounty() {
|
||||
if ($('#select_c').val() != '-1') {
|
||||
$.post("/Ajax.ashx", { action: 'GetCounty', CityID: $('#select_c').val(), countyIDs: qid }, function (data) {
|
||||
if (data != 'false')
|
||||
$('#select_q').html(data);
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
function toaddress() {
|
||||
if ($('#county').val() != 0) {
|
||||
$("#Text_MailingAddress").val($("#select_p option:selected").text() + $("#select_c option:selected").text() + $("#select_q option:selected").text());
|
||||
}
|
||||
}
|
||||
function changeTwoDecimal_f(x) {
|
||||
var f_x = parseFloat(x);
|
||||
if (isNaN(f_x)) {
|
||||
alert('function:changeTwoDecimal->parameter error');
|
||||
return false;
|
||||
}
|
||||
var f_x = Math.round(x * 100) / 100;
|
||||
var s_x = f_x.toString();
|
||||
var pos_decimal = s_x.indexOf('.');
|
||||
if (pos_decimal < 0) {
|
||||
pos_decimal = s_x.length;
|
||||
s_x += '.';
|
||||
}
|
||||
while (s_x.length <= pos_decimal + 2) {
|
||||
s_x += '0';
|
||||
}
|
||||
return s_x;
|
||||
}
|
||||
function IsNumber(what) {
|
||||
var text1 = "1234567890";
|
||||
for (i = 0; i <= what.length - 1; i++) {
|
||||
char1 = what.charAt(i);
|
||||
index = text1.indexOf(char1);
|
||||
if (index == -1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function addnewaddress() {
|
||||
if($("#addressid").val()!=""){
|
||||
$("#addressid").val("");
|
||||
$("#Text_Name").val("");
|
||||
$("#Text_Phone").val("");
|
||||
$("#Text_MailingAddress").val("");
|
||||
$("#Text_PostalCode").val("");
|
||||
$("#savebtn").val("添加新地址");
|
||||
$(".address_table").show();
|
||||
}else{
|
||||
$(".address_table").show();
|
||||
}
|
||||
$(".selectaddress").removeAttr("checked");
|
||||
}
|
||||
function saveaddress()
|
||||
{
|
||||
if ($("#Text_Name").val() == "") {
|
||||
alert('联系人不能为空');
|
||||
$("#Text_Name").focus();
|
||||
return false;
|
||||
}
|
||||
if ($("#Text_Phone").val() == "") {
|
||||
alert('联系电话不能为空');
|
||||
$("#Text_Phone").focus();
|
||||
return false;
|
||||
}
|
||||
if ($("#select_p").val() == "-1") {
|
||||
alert('所在省份必须选择');
|
||||
$("#select_p").focus();
|
||||
return false;
|
||||
}
|
||||
if ($("#select_c").val() == "-1") {
|
||||
alert('所在城市必须选择');
|
||||
$("#select_c").focus();
|
||||
return false;
|
||||
}
|
||||
if ($("#Text_MailingAddress").val() == "") {
|
||||
alert('邮寄地址不能为空');
|
||||
$("#Text_MailingAddress").focus();
|
||||
return false;
|
||||
}
|
||||
$.post("/Ajax.ashx", { action: 'saveaddress', name: escape($("#Text_Name").val()), phone: escape($("#Text_Phone").val()), province: escape($("#select_p").val()), city: escape($("#select_c").val()), county: escape($("#select_q").val()), address: escape($("#Text_MailingAddress").val()), postalcode: escape($("#Text_PostalCode").val()), addressid: escape($("#addressid").val()) }, function (data) {
|
||||
if (data == 'true') {
|
||||
alert('保存成功');
|
||||
top.location = top.location.toString();
|
||||
}else{
|
||||
alert(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
function deladdress(id)
|
||||
{
|
||||
$.post("/Ajax.ashx", { action: 'deladdress', addressid: escape(id) }, function (data) {
|
||||
if (data == 'true') {
|
||||
alert('删除成功');
|
||||
top.location = top.location.toString();
|
||||
}else{
|
||||
alert(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
function setaddress(id)
|
||||
{
|
||||
$.post("/Ajax.ashx", { action: 'setaddress', addressid: escape(id) }, function (data) {
|
||||
if (data == 'true') {
|
||||
alert('设置成功');
|
||||
top.location = top.location.toString();
|
||||
}else{
|
||||
alert(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
function editaddress(id,name,tel,province,city,county,address,zipcode){
|
||||
$(".address_table").show();
|
||||
$("#addressid").val(id);
|
||||
$("#Text_Name").val(name);
|
||||
$("#Text_Phone").val(tel);
|
||||
$("#select_p").val(province);
|
||||
$("#select_c").val(city);
|
||||
$("#select_q").val(county);
|
||||
$("#Text_MailingAddress").val(address);
|
||||
$("#Text_PostalCode").val(zipcode);
|
||||
$("#selectaddress" + id).attr("checked","true");
|
||||
$("#savebtn").val("保存编辑");
|
||||
}
|
||||
function addjg(jg,id){
|
||||
var jgTotal = $("#cart_Total").html();
|
||||
var cejg = (parseFloat(jgTotal)-parseFloat(jg));
|
||||
var cejg2 = (parseFloat(jgTotal)+parseFloat(jg));
|
||||
if ($(id).attr("checked") == true) {
|
||||
if(cejg>=0)
|
||||
{
|
||||
$(".cart_Total").html(changeTwoDecimal_f(cejg));
|
||||
}else{
|
||||
$(id).removeAttr("checked");
|
||||
}
|
||||
}else{
|
||||
$(".cart_Total").html(changeTwoDecimal_f(cejg2));
|
||||
}
|
||||
}
|
||||
function UserQRGM() {
|
||||
var b=true;
|
||||
var addressid=0;
|
||||
var IFUseXFB=0,IFUseJF=0;
|
||||
var sa = $("input.selectaddress");
|
||||
if(sa.length>0){
|
||||
var bb=true;
|
||||
for(var i=0;i<sa.length;i++){
|
||||
if ($(sa[i]).attr("checked") == true) {
|
||||
addressid=$(sa[i]).val();
|
||||
bb=false;
|
||||
}
|
||||
}
|
||||
if(bb){
|
||||
alert("请先选择配送地址");
|
||||
$(sa[0]).focus();
|
||||
b=false;
|
||||
}
|
||||
}else{
|
||||
alert("请先添加配送地址");
|
||||
$("#Text_MailingAddress").focus();
|
||||
b=false;
|
||||
}
|
||||
if(b){
|
||||
if($("#IFUseXFB").attr("checked")==true){
|
||||
IFUseXFB=1;
|
||||
if($("#txtXFB").val()==""){
|
||||
alert("消费币不能为空");
|
||||
$("#txtXFB").focus();
|
||||
b=false;
|
||||
}
|
||||
|
||||
if(parseFloat($("#txtXFB").val())>parseFloat($("#XFBYE").html())){
|
||||
alert("您的消费币余额不足");
|
||||
$("#txtXFB").focus();
|
||||
b=false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(b){
|
||||
if($("#IFUseJF").attr("checked")==true){
|
||||
IFUseJF=1;
|
||||
if($("#txtJF").val()==""){
|
||||
alert("积分不能为空");
|
||||
$("#txtJF").focus();
|
||||
b=false;
|
||||
}
|
||||
|
||||
if(parseFloat($("#txtJF").val())>parseFloat($("#JFYE").html())){
|
||||
alert("您的积分余额不足");
|
||||
$("#txtJF").focus();
|
||||
b=false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if(b){
|
||||
if(parseFloat($("#cart_Total").html())<0.00){
|
||||
alert("您的金额填写有误");
|
||||
b=false;
|
||||
}
|
||||
}
|
||||
if(b){
|
||||
$.post("/Ajax.ashx", { action: "UserQRGM", addressid:escape(addressid), IFUseJF:escape(IFUseJF), UseJF:escape($("#txtJF").val()), OrdersIDs: escape($("#OrdersIDs").val()) }, function (data) {
|
||||
if (data.indexOf("操作成功|") != -1) {
|
||||
alert("操作成功");
|
||||
location.replace(data.replace("操作成功|",""));
|
||||
}else if (data.indexOf("支付成功|") != -1) {
|
||||
alert("您已支付成功");
|
||||
location.replace(data.replace("支付成功|",""));
|
||||
}else if (data.indexOf("跳转支付|") != -1) {
|
||||
location.replace(data.replace("跳转支付|",""));
|
||||
}else{
|
||||
alert(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
function showxfb(){
|
||||
if($("#IFUseXFB").attr("checked")==true){
|
||||
$("#hidexfb").show();
|
||||
}else{
|
||||
$("#hidexfb").hide();
|
||||
}
|
||||
}
|
||||
function showjf(){
|
||||
if($("#IFUseJF").attr("checked")==true){
|
||||
$("#hidejf").show();
|
||||
}else{
|
||||
$("#hidejf").hide();
|
||||
}
|
||||
}
|
||||
function onXFB(){
|
||||
if($("#txtXFB").val()!=""){
|
||||
$("#cart_Total").html(parseFloat($("#hidTotal").val())-parseFloat($("#txtXFB").val()));
|
||||
}
|
||||
if($("#IFUseJF").attr("checked")==true){
|
||||
if($("#txtJF").val()!=""){
|
||||
$("#cart_Total").html(parseFloat($("#cart_Total").html())-parseFloat($("#txtJF").val()));
|
||||
}
|
||||
}
|
||||
if(parseFloat($("#cart_Total").html())<0.00){
|
||||
alert("消费币填写有误");
|
||||
$("#txtXFB").focus();
|
||||
}
|
||||
}
|
||||
function onJF(){
|
||||
if($("#txtJF").val()!=""){
|
||||
$("#cart_Total").html(parseFloat($("#hidTotal").val())-parseFloat($("#txtJF").val()));
|
||||
}
|
||||
if($("#IFUseXFB").attr("checked")==true){
|
||||
if($("#txtXFB").val()!=""){
|
||||
$("#cart_Total").html(parseFloat($("#cart_Total").html())-parseFloat($("#txtXFB").val()));
|
||||
}
|
||||
}
|
||||
if(parseFloat($("#cart_Total").html())<0.00){
|
||||
alert("积分填写有误");
|
||||
$("#txtJF").focus();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="MyContent" runat="server">
|
||||
<div class="contentWrapper">
|
||||
|
||||
<div id="container">
|
||||
<div id="main">
|
||||
<div id="Location"><div class="title">当前位置: <a href="/">首页</a> > 确认购买信息</div></div>
|
||||
<table style="BORDER-COLLAPSE: collapse" borderColor="#C0C0C0" height="30" cellSpacing="0"
|
||||
cellPadding="0" width="100%" align="center" bgColor="#ffffff" border="0"><input name="checks" value="<%=Request.QueryString["CartID"] %>" type="hidden" />
|
||||
<tr>
|
||||
<td height="40" class="cart_table_title">配送地址</td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left"><div class="addresslist"><!--h3>收货人信息 <a href="javascript:void()" onclick="saveaddress" target="_self">保存收货人信息</a></h3--><ul><%=addresslist%></ul></div>
|
||||
<table cellSpacing="0" class="address_table" style=" display:none;">
|
||||
<tr>
|
||||
<th>联 系 人</th>
|
||||
<td><input id="Text_Name" name="Text_Name" value="<%=strName %>" type="text"/> <span id="span_Name">联系人不能为空</span>
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>联系电话</th>
|
||||
<td><input id="Text_Phone" name="Text_Phone" value="<%=strPhone %>" type="text"/> <span id="span_Phone">联系电话不能为空</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>所在城市</th>
|
||||
<td>
|
||||
<select name="select_p" id="select_p">
|
||||
<option value="-1">--省--</option>
|
||||
<%=GetProvince() %>
|
||||
</select>
|
||||
<select name="select_c" id="select_c">
|
||||
<option value="-1">--市--</option>
|
||||
</select>
|
||||
<select name="select_q" id="select_q">
|
||||
<option value="-1">--县区--</option>
|
||||
</select> <span id="span_select">所在城市必须选择</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>邮寄地址</th>
|
||||
<td><input id="Text_MailingAddress" name="Text_MailingAddress" value="<%=strMailingAddress %>" type="text"/> <span id="span_MailingAddress">邮寄地址不能为空,不用填写省,市,县</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>邮政编码</th>
|
||||
<td><input id="Text_PostalCode" name="Text_PostalCode" value="<%=strPostalCode %>" type="text"/> <span id="span_PostalCode"></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th></th>
|
||||
<td><input type="button" id="savebtn" name="savebtn" onclick="saveaddress()" value="添加新地址"/> <input type="button" id="resetbtn" name="resetbtn" onclick="$('.address_table').hide();" value="取消"/><input type="hidden" id="addressid" value="" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td height="40" class="cart_table_title">优惠方式</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><div class="addresslist"><input type="checkbox" id="IFUseJF" name="IFUseJF" onclick="showjf()" />使用积分</div></td>
|
||||
|
||||
</tr>
|
||||
<tr id="hidejf" style=" display:none;">
|
||||
<td><div class="addresslist">积分:<input type="text" id="txtJF" name="txtJF" onblur="onJF()" />,积分余额为:<span class="red" id="JFYE"><%=JFYE %></span></div></td>
|
||||
|
||||
</tr>
|
||||
<tr class="cart_table_title">
|
||||
<td>订单信息</td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">
|
||||
<input type="hidden" id="OrdersIDs" name="OrdersIDs" value="<%=OrdersID %>" />
|
||||
<input type="hidden" id="hidTotal" name="hidTotal" value="<%=hidTotal %>" />
|
||||
<table cellSpacing="0" class="cart_table" align="center">
|
||||
<TR bgColor="#E2F2FF">
|
||||
|
||||
<TD align="center">商品名称</TD>
|
||||
<TD align="center" class="hide300">商品<%=!String.IsNullOrEmpty(Request.QueryString["id"]) ? "运费" : "单价"%></TD>
|
||||
<TD align="center">商品数量</TD>
|
||||
<TD align="center">商品小计</TD>
|
||||
</TR>
|
||||
<%=ShowConent%>
|
||||
|
||||
|
||||
|
||||
</TABLE>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript" src="/Scripts/shop_global_site_top.js" charset="utf-8"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
$("#ap_category").hide();
|
||||
|
||||
|
||||
|
||||
if (isIndex == 1) {
|
||||
|
||||
initProvince();
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
</div>
|
||||
</asp:Content>
|
||||
332
Mtxfw.shop/Sell/UserQRGM.aspx.cs
Normal file
332
Mtxfw.shop/Sell/UserQRGM.aspx.cs
Normal file
@@ -0,0 +1,332 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Drawing;
|
||||
using System.Web;
|
||||
using System.Web.SessionState;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.HtmlControls;
|
||||
using System.Text;
|
||||
namespace Mtxfw.shop
|
||||
{
|
||||
/// <summary>
|
||||
/// myShoppingCart <20><>ժҪ˵<D2AA><CBB5><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public partial class UserQRGM : Mtxfw.Utility.MemberBase
|
||||
{
|
||||
protected string UserID = "", ShowConent = "", OrdersID="";
|
||||
protected String pid = "", cid = "", qid = "", strName = "", strPhone = "", strMailingAddress = "", strPostalCode = "", addresslist = "", yunfei = "0.00", YHJlist = "", strZE = "", XFBYE = "0", JFYE = "0", hidTotal="0";
|
||||
public Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
|
||||
public Mtxfw.DAL.P_Product daoProduct = new Mtxfw.DAL.P_Product();
|
||||
protected int IFaddress = 0;
|
||||
protected Double umoney19 = 0;
|
||||
protected override void OnLoad(EventArgs e)
|
||||
{
|
||||
base.OnLoad(e);
|
||||
if (!Page.IsPostBack)
|
||||
{
|
||||
DataSet ds = new DAL.user_address().GetList("", "UserID=" + Card);
|
||||
if (ds.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
int i = 0;
|
||||
foreach (DataRow dr in ds.Tables[0].Rows)
|
||||
{
|
||||
|
||||
addresslist += "<li><input type=\"radio\" id=\"selectaddress" + dr["Id"].ToString() + "\" name=\"addressid\" value=\"" + dr["Id"].ToString() + "\" class=\"selectaddress\" onclick=\"$('.address_table').hide();$('#selectaddress').removeAttr('checked');\"";
|
||||
if (dr["IFIndex"].ToString() == "1")
|
||||
{
|
||||
addresslist += " checked=\"true\"";
|
||||
}
|
||||
addresslist += "/> " + dr["Contactname"].ToString() + " " + new DAL.province().GetProvince(dr["Province"].ToString()) + new DAL.city().GetCity(dr["City"].ToString()) + new DAL.county().GetCounty(dr["County"].ToString()) + dr["Address"].ToString() + " " + dr["Contacttel"].ToString() + " <span onclick=\"editaddress(" + dr["Id"].ToString() + ",'" + dr["Contactname"].ToString() + "','" + dr["Contacttel"].ToString() + "','" + dr["Province"].ToString() + "','" + dr["City"].ToString() + "','" + dr["County"].ToString() + "','" + dr["Address"].ToString() + "','" + dr["Zipcode"].ToString() + "')\"><3E>༭</span> <span onclick=\"deladdress(" + dr["Id"].ToString() + ")\">ɾ<><C9BE></span>";
|
||||
if (dr["IFIndex"].ToString() == "1")
|
||||
{
|
||||
addresslist += " Ĭ<>ϵ<EFBFBD>ַ";
|
||||
//yunfei = new DAL.province().GetYFmoney(dr["Province"].ToString()).ToString("f2");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
addresslist += " <span class=\"setindex\" onclick=\"setaddress(" + dr["Id"].ToString() + ")\"><3E><>ΪĬ<CEAA>ϵ<EFBFBD>ַ</span>";
|
||||
}
|
||||
addresslist += "</li>";
|
||||
i += 1;
|
||||
}
|
||||
addresslist += "<li><input type=\"radio\" id=\"selectaddress\" onclick=\"addnewaddress()\" name=\"selectaddress\" value=\"\" /> ʹ<><CAB9><EFBFBD>µ<EFBFBD>ַ</li>";
|
||||
}
|
||||
else
|
||||
{
|
||||
addresslist += "<li><input type=\"radio\" id=\"selectaddress\" checked=\"true\" onclick=\"addnewaddress()\" name=\"selectaddress\" value=\"\" /> ʹ<><CAB9><EFBFBD>µ<EFBFBD>ַ</li>";
|
||||
IFaddress = 1;
|
||||
}
|
||||
ds.Clear();
|
||||
if (Request.QueryString["CartID"] != null)
|
||||
{
|
||||
OrdersID = Mtxfw.Utility.Tools.SafeSQL(Request.QueryString["CartID"].ToString());
|
||||
|
||||
/*ds = new DAL.order_info().GetList("(Select P_NAME from P_Product b where b.P_ID=a.pid) as prodName,(Select P_images from P_Product b where b.P_ID=a.pid) as prodimg,(select P_JiangLi from P_Product c where c.P_ID=a.pid) as P_JiangLi,", "utype='2' And UserID=" + Card + " And IFDelete=0 And O_received=0");
|
||||
if (ds.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
foreach (DataRow dr in ds.Tables[0].Rows)
|
||||
{
|
||||
YHJlist += "<li><input type=\"checkbox\" id=\"YHJ" + dr["id"].ToString() + "\" onclick=\"addjg(" + Convert.ToDouble(dr["P_JiangLi"]).ToString("f2") + ",this)\" name=\"yhj\" value=\"" + dr["id"].ToString() + "\" /> " + dr["prodName"].ToString() + " <3B><><span class=\"red\">" + Convert.ToDouble(dr["P_JiangLi"]).ToString("f2") + "</span>Ԫ</li>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
YHJlist += "<li><3E><><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD>Żݾ<C5BB><DDBE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <a href=\"/shop_jifen.aspx\"><3E><><EFBFBD><EFBFBD>ר<EFBFBD><D7A8></a> <20>һ<EFBFBD><D2BB>Żݾ<C5BB></li>";
|
||||
}
|
||||
ds.Clear();*/
|
||||
myDataBind(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!String.IsNullOrEmpty(Request.QueryString["id"]))
|
||||
{
|
||||
OrdersID = Request.QueryString["id"].ToString();
|
||||
myDataBind(Convert.ToInt32(OrdersID));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private void myDataBind(int id)
|
||||
{
|
||||
Mtxfw.Model.user_info model = daoUser.GetModel(Card);
|
||||
if (model != null)
|
||||
{
|
||||
IFStores = model.IFStores;
|
||||
umoney19 = model.umoney19;
|
||||
if (model.RealName == "")
|
||||
{
|
||||
if (model.NCName == "")
|
||||
{
|
||||
strName = model.UserName;
|
||||
}
|
||||
else
|
||||
{
|
||||
strName = model.NCName;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
strName = model.RealName;
|
||||
}
|
||||
strPhone = model.Phone;
|
||||
strMailingAddress = model.MailingAddress;
|
||||
strPostalCode = model.PostalCode;
|
||||
pid = model.Province;
|
||||
cid = model.City;
|
||||
qid = model.County;
|
||||
JFYE = (model.umoney30 - model.umoney31).ToString("f0");
|
||||
string strprovince = "", strcity = "", strcounty="";
|
||||
if (Request.Cookies["province"] != null)
|
||||
{
|
||||
HttpCookie myCookie = Request.Cookies["province"];
|
||||
strprovince = HttpUtility.UrlDecode(myCookie.Value);
|
||||
}
|
||||
if (Request.Cookies["city"] != null)
|
||||
{
|
||||
HttpCookie myCookie = Request.Cookies["city"];
|
||||
strcity = HttpUtility.UrlDecode(myCookie.Value);
|
||||
}
|
||||
if (Request.Cookies["county"] != null)
|
||||
{
|
||||
HttpCookie myCookie = Request.Cookies["county"];
|
||||
strcounty = HttpUtility.UrlDecode(myCookie.Value);
|
||||
}
|
||||
if (strprovince != "" && strcity != "" && strcounty != "")
|
||||
{
|
||||
if (strprovince.IndexOf(pid) == -1 && strcity.IndexOf(cid) == -1 && strcounty.IndexOf(qid) == -1)
|
||||
{
|
||||
pid = strprovince.Split('|')[0];
|
||||
cid = strcity.Split('|')[0];
|
||||
qid = strcounty.Split('|')[0];
|
||||
strMailingAddress = "";
|
||||
}
|
||||
}
|
||||
if (yunfei == "0.00" && pid != "-1")
|
||||
{
|
||||
//yunfei = new DAL.province().GetYFmoney(pid).ToString("f2");
|
||||
}
|
||||
}
|
||||
if (id > 0)
|
||||
{
|
||||
//ShowConent += "<tr bgColor=\"#efc5ce\"><td colspan=\"4\"><3E>̼<EFBFBD><CCBC><EFBFBD><EFBFBD>ƣ<EFBFBD>";
|
||||
//ShowConent += "<22><><EFBFBD><EFBFBD>";
|
||||
Double YFmoney = 0.00;
|
||||
Mtxfw.Model.P_Product pmodel = daoProduct.GetModel(id);
|
||||
if (pmodel != null)
|
||||
{
|
||||
YFmoney = pmodel.P_YH_P;
|
||||
Double ZSubTotal = pmodel.P_VIP_P + YFmoney;
|
||||
string selcolor = "";
|
||||
//ShowConent += " <3B>˷ѣ<CBB7><D1A3><EFBFBD><span class=\"red\">" + YFmoney.ToString("f2") + "</span></td></tr>";
|
||||
ShowConent += "<tr id='tr" + pmodel.P_ID + "' " + "><td align='center' class=\"cartprodName\">";
|
||||
ShowConent += "<a href='/view-" + pmodel.P_ID + ".html' target='_blank'><img src='" + Mtxfw.Utility.Common.GetCoverPic(pmodel.P_images.Split('|')[0].Split(',')[0], "100x100", "cut") + "' width='100'><br>" + pmodel.P_NAME + (selcolor.Split('#')[0] != "" ? "[" + selcolor.Split('#')[0] + "]" : "") + "</a>";
|
||||
|
||||
ShowConent += "</td>";
|
||||
ShowConent += "<td align='center' class=\"hide300\" id='Price" + pmodel.P_ID + "'><3E><>" + YFmoney.ToString("f2") + "</td>";
|
||||
ShowConent += "<td align='center'>1</td><td align='center' id='SubTotal" + pmodel.P_ID + "'><3E><>" + (pmodel.P_VIP_P + YFmoney).ToString("f2") + "</td>";
|
||||
|
||||
ShowConent += "</tr>";
|
||||
ShowConent += "<tr><td colspan='4'><div class='cart_left'></div><div class='cart_right'><3E><>Ʒ<EFBFBD>ܼ<EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD>˷<EFBFBD>)<29><><EFBFBD><EFBFBD><span class='cart_Total' id='cart_Total'>" + ZSubTotal.ToString("f2").Replace(",", "") + "</span>Ԫ";
|
||||
hidTotal = ZSubTotal.ToString("f2").Replace(",", "");
|
||||
ShowConent += " <input type='button' class='cart_botton' value='ȷ<><C8B7><EFBFBD>ύ' onclick=\"UserQRGM()\"/></div></td></tr>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DataView dv = Mtxfw.DAL.ShoppingCart.Getprod(IFStores);
|
||||
if (dv.Count > 0)
|
||||
{
|
||||
string CFOIDs = ",";
|
||||
|
||||
for (int j = 0; j <= dv.Count - 1; j++)
|
||||
{
|
||||
string prodid = dv.Table.Rows[j]["prodid"].ToString();
|
||||
if (OrdersID.IndexOf("," + prodid + ",") != -1)
|
||||
{
|
||||
string SUserID = dv.Table.Rows[j]["SUserID"].ToString();
|
||||
if (CFOIDs == "")
|
||||
{
|
||||
CFOIDs = "," + SUserID + ",";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (CFOIDs.IndexOf("," + SUserID + ",") == -1)
|
||||
{
|
||||
CFOIDs += SUserID + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
string[] ACFOIDs = CFOIDs.Split(',');
|
||||
|
||||
Double ZSubTotal = 0.00;
|
||||
Double ZYFmoney = 0.00;
|
||||
foreach (string stra in ACFOIDs)
|
||||
{
|
||||
if (stra != "")
|
||||
{
|
||||
ShowConent += "<tr bgColor=\"#efc5ce\"><td colspan=\"4\"><3E>̼<EFBFBD><CCBC><EFBFBD><EFBFBD>ƣ<EFBFBD>";
|
||||
if (stra != "0")
|
||||
{
|
||||
string strUserName = daoUser.Getzd("UserName", "ID=" + stra).ToString();
|
||||
ShowConent += strUserName;
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowConent += "<22><><EFBFBD><EFBFBD>";
|
||||
}
|
||||
|
||||
Double YFmoney = 0.00;
|
||||
for (int j = 0; j <= dv.Count - 1; j++)
|
||||
{
|
||||
string prodid = dv.Table.Rows[j]["prodid"].ToString();
|
||||
string SUserID = dv.Table.Rows[j]["SUserID"].ToString();
|
||||
if (Request.QueryString["CartID"].ToString().IndexOf("," + prodid + ",") != -1 && stra == SUserID)
|
||||
{
|
||||
Double SPYH = Convert.ToDouble(dv.Table.Rows[j]["SPYH1"].ToString());
|
||||
if (Convert.ToDouble(YFmoney.ToString("f2")) == 0.00 && Convert.ToDouble(SPYH.ToString("f2")) > 0.00)
|
||||
{
|
||||
YFmoney = SPYH;
|
||||
}
|
||||
}
|
||||
}
|
||||
ShowConent += " <3B>˷ѣ<CBB7><D1A3><EFBFBD><span class=\"red\">" + YFmoney.ToString("f2") + "</span></td></tr>";
|
||||
ZYFmoney += YFmoney;
|
||||
for (int j = 0; j <= dv.Count - 1; j++)
|
||||
{
|
||||
string prodid = dv.Table.Rows[j]["prodid"].ToString();
|
||||
string SUserID = dv.Table.Rows[j]["SUserID"].ToString();
|
||||
if (Request.QueryString["CartID"].ToString().IndexOf("," + prodid + ",") != -1 && stra == SUserID)
|
||||
{
|
||||
string utype = dv.Table.Rows[j]["utype"].ToString();
|
||||
string strid = dv.Table.Rows[j]["id"].ToString();
|
||||
string prodName = dv.Table.Rows[j]["prodName"].ToString();
|
||||
string P_CATEGORYs = dv.Table.Rows[j]["P_CATEGORYs"].ToString();
|
||||
string selcolor = HttpUtility.UrlDecode(dv.Table.Rows[j]["selcolor"].ToString());
|
||||
string prodimg = dv.Table.Rows[j]["prodimg"].ToString().Split('|')[0].Split(',')[0];
|
||||
if (prodimg == "")
|
||||
{
|
||||
prodimg = "/Images/no_photo_s.png";
|
||||
}
|
||||
string prodPrice = Convert.ToDouble(dv.Table.Rows[j]["prodPrice"].ToString()).ToString("f2").Replace(",", "");
|
||||
string prodNum = dv.Table.Rows[j]["prodNum"].ToString();
|
||||
string TotalNum = dv.Table.Rows[j]["TotalNum"].ToString();
|
||||
string SubTotal = Convert.ToDouble(dv.Table.Rows[j]["SubTotal"].ToString()).ToString("f2").Replace(",", "");
|
||||
string IFMJCDYH = dv.Table.Rows[j]["IFMJCDYH"].ToString();
|
||||
Double XSubTotal = Convert.ToDouble(dv.Table.Rows[j]["SubTotal"].ToString());
|
||||
|
||||
ZSubTotal = ZSubTotal + XSubTotal;
|
||||
ShowConent += "<tr id='tr" + strid + "' " + (utype == "3" ? " bgColor=\"#EEEEEE\"" : "") + "><td align='center' class=\"cartprodName\">";
|
||||
if (utype == "3")
|
||||
{
|
||||
ShowConent += "" + prodName + (selcolor.Split('#')[0] != "" ? "[" + selcolor.Split('#')[0] + "]" : "") + "";
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowConent += "<a href='/view-" + prodid + ".html' target='_blank'><img src='" + Mtxfw.Utility.Common.GetCoverPic(prodimg, "100x100", "cut") + "' width='100'><br>" + prodName + (selcolor.Split('#')[0] != "" ? "[" + selcolor.Split('#')[0] + "]" : "") + "</a>";
|
||||
}
|
||||
ShowConent += "</td>";
|
||||
ShowConent += "<td align='center' class=\"hide300\" id='Price" + strid + "'><3E><>" + prodPrice + "</td>";
|
||||
ShowConent += "<td align='center'>" + prodNum + "</td><td align='center' id='SubTotal" + strid + "'><3E><>" + SubTotal + "</td>";
|
||||
/*if (IFMJCDYH == "1")
|
||||
{
|
||||
ShowConent += "<td align='center'><select name='SPYH' class=''><option value='1'>ƽ<><C6BD> " + SPYH1.ToString("c") + "</option>";
|
||||
ShowConent += "<option value='2' selected><3E><><EFBFBD><EFBFBD> " + SPYH2.ToString("c") + "</option>";
|
||||
ShowConent += "<option value='3'>EMS " + SPYH3.ToString("c") + "</option>";
|
||||
ShowConent += "</select></td>";
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowConent += "<td align='center'><select name='SPYH' class=''><option value='0'><3E><><EFBFBD>ҳе<D2B3><D0B5><EFBFBD><EFBFBD><EFBFBD></option>";
|
||||
ShowConent += "</select></td>";
|
||||
}*/
|
||||
ShowConent += "</tr>";
|
||||
if (utype == "3")
|
||||
{
|
||||
ShowConent += "<tr bgColor=\"#EEEEEE\"><td colspan=\"4\"><div class=\"taocaoproduct\"><ul>";
|
||||
System.Data.DataSet Ds_Product2 = daoProduct.GetList("", "utype='0' And charindex(',' + Convert(varchar(50),P_ID) + ',','" + P_CATEGORYs + "')>0 And P_State=N'<27>Ѵ<EFBFBD><D1B4><EFBFBD>' Order By P_Orders Desc,P_ADDATE asc");
|
||||
if (Ds_Product2.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
for (int k = 0; k < Ds_Product2.Tables[0].Rows.Count; k++)
|
||||
{
|
||||
string prodimg2 = Ds_Product2.Tables[0].Rows[k]["P_images"].ToString().Split('|')[0].Split(',')[0];
|
||||
string prodid2 = Ds_Product2.Tables[0].Rows[k]["P_ID"].ToString();
|
||||
string prodName2 = Ds_Product2.Tables[0].Rows[k]["P_NAME"].ToString();
|
||||
ShowConent += "<li><a href='/view-" + prodid2 + ".html' target='_blank'><img src='" + Mtxfw.Utility.Common.GetCoverPic(prodimg2, "100x100", "cut") + "' width='100'><br>" + prodName2 + "</a></li>";
|
||||
}
|
||||
}
|
||||
ShowConent += "</ul></div></td></tr>";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ZSubTotal += ZYFmoney;
|
||||
strZE = ZSubTotal.ToString("f0");
|
||||
ShowConent += "<tr><td colspan='4'><div class='cart_left'></div><div class='cart_right'><3E><>Ʒ<EFBFBD>ܼ<EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD>˷<EFBFBD>)<29><><EFBFBD><EFBFBD><span class='cart_Total' id='cart_Total'>" + ZSubTotal.ToString("f2").Replace(",", "") + "</span>Ԫ";
|
||||
hidTotal = ZSubTotal.ToString("f2").Replace(",", "");
|
||||
ShowConent += " <input type='button' class='cart_botton' value='ȷ<><C8B7><EFBFBD>ύ' onclick=\"UserQRGM()\"/></div></td></tr>";
|
||||
}
|
||||
dv.Table.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
protected String GetProvince()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Mtxfw.DAL.province daoPro = new Mtxfw.DAL.province();
|
||||
System.Data.DataSet Ds = daoPro.GetCacheList("", "1=1 Order by Id Asc", "Province");
|
||||
System.Data.DataTable Dt = (Ds != null && Ds.Tables[0] != null) ? Ds.Tables[0] : null;
|
||||
foreach (System.Data.DataRow Dr in Dt.Rows)
|
||||
{
|
||||
sb.Append("<option value=\"" + Dr["ProvinceID"] + "\">" + Dr["ProvinceName"] + "</option>\r\n");
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
15
Mtxfw.shop/Sell/UserQRGM.aspx.designer.cs
generated
Normal file
15
Mtxfw.shop/Sell/UserQRGM.aspx.designer.cs
generated
Normal file
@@ -0,0 +1,15 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <自动生成>
|
||||
// 此代码由工具生成。
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Mtxfw.shop {
|
||||
|
||||
|
||||
public partial class UserQRGM {
|
||||
}
|
||||
}
|
||||
211
Mtxfw.shop/Sell/myShoppingCart.aspx
Normal file
211
Mtxfw.shop/Sell/myShoppingCart.aspx
Normal file
@@ -0,0 +1,211 @@
|
||||
<%@ Page Title="" Language="C#" MasterPageFile="~/Telesa.Master" AutoEventWireup="true" CodeBehind="myShoppingCart.aspx.cs" Inherits="Mtxfw.shop.myShoppingCart" %>
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="MyHead" runat="server">
|
||||
<link href="/css/shop_cart.css" rel="stylesheet" type="text/css" />
|
||||
<script type="text/javascript">
|
||||
|
||||
function IsNumber(what) {
|
||||
var text1 = "1234567890";
|
||||
for (i = 0; i <= what.length - 1; i++) {
|
||||
char1 = what.charAt(i);
|
||||
index = text1.indexOf(char1);
|
||||
if (index == -1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function updatenum(t, cartid, strProdId, TotalNum, selcolor) {
|
||||
var Price = $("#Price" + cartid);
|
||||
var Num = $("#Num" + cartid);
|
||||
var Num2 = $("#Num2" + cartid);
|
||||
var SubTotal = $("#SubTotal" + cartid);
|
||||
var tr = $("#tr" + cartid);
|
||||
var Nums = $(".cart_table .ProdNum");
|
||||
var cart_Total = $("#cart_Total");
|
||||
var cart_Total2 = $("#cart_Total2");
|
||||
var b = true;
|
||||
if (IsNumber(Num.val())) {
|
||||
alert('请输入正确的购买数量');
|
||||
Num.val(Num2.val());
|
||||
SubTotal.html("¥" + changeTwoDecimal_f((parseFloat(Price.html().replace("¥", "").replace(",", "")) * parseInt(Num.val()))));
|
||||
b = false;
|
||||
}
|
||||
if (Num.val().toString().substring(0,1)=="0") {
|
||||
alert('购买数量必须大于0');
|
||||
Num.val(Num2.val());
|
||||
SubTotal.html("¥" + changeTwoDecimal_f((parseFloat(Price.html().replace("¥", "").replace(",", "")) * parseInt(Num.val()))));
|
||||
b = false;
|
||||
}
|
||||
if (parseInt(Num.val()) > TotalNum) {
|
||||
alert('购买数量不能大于' + TotalNum);
|
||||
Num.val(Num2.val());
|
||||
SubTotal.html("¥" + changeTwoDecimal_f((parseFloat(Price.html().replace("¥", "").replace(",", "")) * parseInt(Num.val()))));
|
||||
b = false;
|
||||
}
|
||||
if (b) {
|
||||
if (t == 1) {
|
||||
if (parseInt(Num.val()) < TotalNum) {
|
||||
Num.val(parseInt(Num.val()) + 1);
|
||||
Num2.val(parseInt(Num2.val()) + 1);
|
||||
}
|
||||
}
|
||||
if (t == 2) {
|
||||
if (parseInt(Num.val()) < 2) {
|
||||
Num.val(parseInt(Num.val()));
|
||||
Num2.val(parseInt(Num2.val()));
|
||||
}
|
||||
else {
|
||||
Num.val(parseInt(Num.val()) - 1);
|
||||
Num2.val(parseInt(Num2.val()) - 1);
|
||||
}
|
||||
}
|
||||
var NumTotal = 0.00;
|
||||
Nums.each(function (i) {
|
||||
var dPrice = parseFloat($("#Price" + Nums[i].id.replace("Num", "")).html().replace("¥", "").replace(",", ""));
|
||||
var dNum = parseInt($(this).val());
|
||||
NumTotal = NumTotal + dPrice * dNum;
|
||||
Num2.val(Num.val());
|
||||
});
|
||||
SubTotal.html("¥" + changeTwoDecimal_f((parseFloat(Price.html().replace("¥", "").replace(",", "")) * parseInt(Num.val()))));
|
||||
|
||||
cart_Total.html("¥" + changeTwoDecimal_f(NumTotal));
|
||||
cart_Total2.html("¥" + changeTwoDecimal_f(NumTotal));
|
||||
$.post("/Ajax.ashx", { action: 'updatecart', ProductID: strProdId, Num: Num.val(), selcolor:escape(selcolor)}, function (data) {
|
||||
switch (data) {
|
||||
case "0": alert('参数错误!'); break;
|
||||
//case "1": alert('参数00!'); break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
function delcart() {
|
||||
var cart_Total = $("#cart_Total");
|
||||
var checks = $(".cart_table .checks");
|
||||
var NumTotal = parseFloat($("#cart_Total").html().replace("¥", ""));
|
||||
var strProdId = "", selcolor="";
|
||||
var ifchecked = 0;
|
||||
for (var i = 0; i < checks.length; i++) {
|
||||
|
||||
if (typeof ($(checks[i]).attr("checked")) != "undefined") {
|
||||
var strA = $(checks[i]).val().split("|");
|
||||
var tr = $("#tr" + strA[0]);
|
||||
var trr = $("#trr" + strA[0]);
|
||||
var dPrice = parseFloat($("#Price" + strA[0]).html().replace("¥", ""));
|
||||
var dNum = parseInt($("#Num" + strA[0]).val());
|
||||
NumTotal = NumTotal - dPrice * dNum;
|
||||
tr.hide();
|
||||
if (trr.length > 0) {
|
||||
trr.hide();
|
||||
}
|
||||
strProdId += strA[1] + ",";
|
||||
var color = $("#selcolor" + strA[0]).val();
|
||||
selcolor += (color==""?"":escape(color)) + ",";
|
||||
ifchecked += 1;
|
||||
}
|
||||
}
|
||||
if (strProdId == "") {
|
||||
alert('请先选择');
|
||||
} else {
|
||||
$.post("/Ajax.ashx", { action: 'updatecart', ProductID: strProdId, Num: 0, selcolor: selcolor });
|
||||
cart_Total.html("¥" + changeTwoDecimal_f(NumTotal));
|
||||
if (checks.length == ifchecked) {
|
||||
var trdel = $("#trdel td");
|
||||
trdel.css("background-color", "#ffffff");
|
||||
trdel.html("<span class=\"Cart_FH\">购物车为空,<A href=\"/\">返回商城购物</A></span>");
|
||||
}
|
||||
}
|
||||
}
|
||||
function Shop_Pay() {
|
||||
|
||||
var checks = document.getElementsByName("checks");
|
||||
var Achecks = "";
|
||||
var ifchecked = false;
|
||||
for (var i = 0; i < checks.length; i++) {
|
||||
if (checks[i].checked == true) {
|
||||
var strA = checks[i].value.split("|");
|
||||
if (Achecks == "") {
|
||||
Achecks = Achecks + "," + strA[1] + ",";
|
||||
} else {
|
||||
Achecks = Achecks + strA[1] + ",";
|
||||
}
|
||||
ifchecked = true;
|
||||
}
|
||||
}
|
||||
if (ifchecked == false) {
|
||||
alert('你木有选择');
|
||||
} else {
|
||||
location.replace("/Sell/UserQRGM.aspx?CartID=" + Achecks);
|
||||
}
|
||||
}
|
||||
function UserQRGM() {
|
||||
|
||||
var checks = document.getElementsByName("qrshdz");
|
||||
if (checks.length != 0) {
|
||||
var Achecks = "";
|
||||
var ifchecked = false;
|
||||
for (var i = 0; i < checks.length; i++) {
|
||||
if (checks[i].checked == true) {
|
||||
ifchecked = true;
|
||||
}
|
||||
}
|
||||
if (ifchecked == false) {
|
||||
alert('你木有选择配送地址');
|
||||
checks[0].focus();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
alert('你木有配送地址,请先添加配送地址');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
function changeTwoDecimal_f(x) {
|
||||
var f_x = parseFloat(x);
|
||||
if (isNaN(f_x)) {
|
||||
alert('function:changeTwoDecimal->parameter error');
|
||||
return false;
|
||||
}
|
||||
var f_x = Math.round(x * 100) / 100;
|
||||
var s_x = f_x.toString();
|
||||
var pos_decimal = s_x.indexOf('.');
|
||||
if (pos_decimal < 0) {
|
||||
pos_decimal = s_x.length;
|
||||
s_x += '.';
|
||||
}
|
||||
while (s_x.length <= pos_decimal + 2) {
|
||||
s_x += '0';
|
||||
}
|
||||
return s_x;
|
||||
}
|
||||
</script>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="MyContent" runat="server">
|
||||
<div class="contentWrapper">
|
||||
<form runat="server" id="MyForm">
|
||||
<div id="main">
|
||||
<div id="Location"><div class="title">当前位置: <a href="/">首页</a> > 购物车</div></div>
|
||||
|
||||
<table cellSpacing="0" class="cart_table" align="center">
|
||||
<tr bgColor="#E2F2FF">
|
||||
<td width="40" align="center">选择</td>
|
||||
<td align="center">商品名称</td>
|
||||
<td align="center" class="hide300">商品单价</td>
|
||||
<td align="center">商品数量</td>
|
||||
<td align="center">商品小计</td>
|
||||
</tr>
|
||||
<%=ShowConent%>
|
||||
|
||||
|
||||
</TABLE>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</asp:Content>
|
||||
|
||||
105
Mtxfw.shop/Sell/myShoppingCart.aspx.cs
Normal file
105
Mtxfw.shop/Sell/myShoppingCart.aspx.cs
Normal file
@@ -0,0 +1,105 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Web;
|
||||
using System.Web.SessionState;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.HtmlControls;
|
||||
|
||||
namespace Mtxfw.shop
|
||||
{
|
||||
/// <summary>
|
||||
/// myShoppingCart <20><>ժҪ˵<D2AA><CBB5><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public partial class myShoppingCart : System.Web.UI.Page
|
||||
{
|
||||
public Mtxfw.DAL.P_Product daoProduct = new Mtxfw.DAL.P_Product();
|
||||
protected string ShowConent = "";
|
||||
public Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info();
|
||||
protected int IFStores = 0;
|
||||
protected void Page_Load(object sender, System.EventArgs e)
|
||||
{
|
||||
// <20>ڴ˴<DAB4><CBB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Գ<EFBFBD>ʼ<EFBFBD><CABC>ҳ<EFBFBD><D2B3>
|
||||
if (!Page.IsPostBack)
|
||||
{
|
||||
myDataBind();
|
||||
}
|
||||
}
|
||||
private void myDataBind()
|
||||
{
|
||||
if (Session["MemberId"] != null && Session["MemberIFStores"] != null)
|
||||
{
|
||||
IFStores = int.Parse(Session["MemberIFStores"].ToString());
|
||||
}
|
||||
DataView dv = Mtxfw.DAL.ShoppingCart.Getprod(IFStores);
|
||||
if (dv.Count > 0)
|
||||
{
|
||||
Double ZSubTotal = 0.00;
|
||||
for (int j = 0; j <= dv.Count - 1; j++)
|
||||
{
|
||||
string strid = dv.Table.Rows[j]["id"].ToString();
|
||||
string P_CATEGORYs = dv.Table.Rows[j]["P_CATEGORYs"].ToString();
|
||||
string prodName = dv.Table.Rows[j]["prodName"].ToString();
|
||||
string selcolor = HttpUtility.UrlDecode(dv.Table.Rows[j]["selcolor"].ToString());
|
||||
string prodimg = dv.Table.Rows[j]["prodimg"].ToString().Split('|')[0].Split(',')[0];
|
||||
string prodid = dv.Table.Rows[j]["prodid"].ToString();
|
||||
string prodPrice = Convert.ToDouble(dv.Table.Rows[j]["prodPrice"].ToString()).ToString("f2").Replace(",","");
|
||||
string prodNum = dv.Table.Rows[j]["prodNum"].ToString();
|
||||
string TotalNum = dv.Table.Rows[j]["TotalNum"].ToString();
|
||||
string utype = dv.Table.Rows[j]["utype"].ToString();
|
||||
string SubTotal = Convert.ToDouble(dv.Table.Rows[j]["SubTotal"].ToString()).ToString("f2").Replace(",", "");
|
||||
if (prodimg == "")
|
||||
{
|
||||
prodimg = "/Images/no_photo_s.png";
|
||||
}
|
||||
ZSubTotal = ZSubTotal + Convert.ToDouble(dv.Table.Rows[j]["SubTotal"].ToString());
|
||||
ShowConent += "<tr id='tr" + j + "' " + (utype == "3" ? " bgColor=\"#EEEEEE\"" : "") + "><td><input type='checkbox' class='checks' checked name='checks' value='" + j + "|" + prodid + "'/></td><td align='center' class=\"cartprodName\">";
|
||||
if (utype == "3")
|
||||
{
|
||||
ShowConent += "" + prodName + (selcolor.Split('#')[0] != "" ? "[" + selcolor.Split('#')[0] + "]" : "") + "";
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowConent += "<a href='/view-" + prodid + ".html' target='_blank'><img src='" + Mtxfw.Utility.Common.GetCoverPic(prodimg, "100x100", "cut") + "' width='100'><br>" + prodName + (selcolor.Split('#')[0] != "" ? "[" + selcolor.Split('#')[0] + "]" : "") + "</a>";
|
||||
}
|
||||
ShowConent += "</td>";
|
||||
ShowConent += "<td align='center' class=\"hide300\" id='Price" + j + "'><3E><>" + prodPrice + "</td>";
|
||||
ShowConent += "<td align='center'><div class=\"cart_num_ss\"><div class=\"cart_del\" title='<27><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1' onclick=\"updatenum(2,'" + j + "','" + prodid + "'," + TotalNum + ",'" + selcolor + "')\"></div><div class=\"cart_num\"><input id='Num" + j + "' name='Nums' value='" + prodNum + "' onblur=\"updatenum(0,'" + j + "','" + prodid + "'," + TotalNum + ",'" + selcolor + "')\" class='ProdNum'/><input id='Num2" + j + "' type='hidden' value='" + prodNum + "'/></div><div class=\"cart_add\" title='<27><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1' onclick=\"updatenum(1,'" + j + "','" + prodid + "'," + TotalNum + ",'" + selcolor + "')\"></div></div><input id='selcolor" + j + "' type='hidden' value='" + selcolor + "'/></td>";
|
||||
ShowConent += "<td align='center' id='SubTotal" + j + "'><3E><>" + SubTotal + "</td>";
|
||||
ShowConent += "</tr>";
|
||||
if (utype == "3")
|
||||
{
|
||||
ShowConent += "<tr bgColor=\"#EEEEEE\" id='trr" + j + "'><td colspan=\"5\"><div class=\"taocaoproduct\"><ul>";
|
||||
System.Data.DataSet Ds_Product2 = daoProduct.GetList("", "utype='0' And charindex(',' + Convert(varchar(50),P_ID) + ',','" + P_CATEGORYs + "')>0 And P_State=N'<27>Ѵ<EFBFBD><D1B4><EFBFBD>' Order By P_Orders Desc,P_ADDATE asc");
|
||||
if (Ds_Product2.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
for (int k = 0; k < Ds_Product2.Tables[0].Rows.Count; k++)
|
||||
{
|
||||
string prodimg2 = Ds_Product2.Tables[0].Rows[k]["P_images"].ToString().Split('|')[0].Split(',')[0];
|
||||
string prodid2 = Ds_Product2.Tables[0].Rows[k]["P_ID"].ToString();
|
||||
string prodName2 = Ds_Product2.Tables[0].Rows[k]["P_NAME"].ToString();
|
||||
ShowConent += "<li><a href='/view-" + prodid2 + ".html' target='_blank'><img src='" + Mtxfw.Utility.Common.GetCoverPic(prodimg2, "100x100", "cut") + "' width='100'><br>" + prodName2 + "</a></li>";
|
||||
}
|
||||
}
|
||||
ShowConent += "</ul></div></td></tr>";
|
||||
}
|
||||
}
|
||||
ShowConent += "<tr id='trdel'><td colspan='5' bgcolor='#F3F3F3'><div class='cart_total_box'><3E><>Ʒ<EFBFBD>ܼ<EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD>˷<EFBFBD>)<29><><span class='cart_Total' id='cart_Total2'><3E><>" + ZSubTotal.ToString("f2").Replace(",", "") + "</span>Ԫ</div><div class='cart_left'><span onclick=\"delcart()\" class='cart_botton'>ɾ<><C9BE><EFBFBD><EFBFBD>ѡ</span></div><div class='cart_right'><span class='hide300'><3E><>Ʒ<EFBFBD>ܼ<EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD>˷<EFBFBD>)<29><><span class='cart_Total' id='cart_Total'><3E><>" + ZSubTotal.ToString("f2").Replace(",", "") + "</span>Ԫ";
|
||||
ShowConent += " </span><span onclick=\"Shop_Pay()\" class='cart_botton'><3E><><EFBFBD>㹺<EFBFBD><E3B9BA></span></div></td></tr>";
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowConent += "<TR><TD align='center' colspan='5'><span class=\"Cart_FH\"><3E><><EFBFBD>ﳵΪ<EFB3B5>գ<EFBFBD><A href=\"/\"><3E><><EFBFBD><EFBFBD><EFBFBD>̳ǹ<CCB3><C7B9><EFBFBD></A></span></TD></TR>";
|
||||
}
|
||||
|
||||
dv.Table.Clear();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
24
Mtxfw.shop/Sell/myShoppingCart.aspx.designer.cs
generated
Normal file
24
Mtxfw.shop/Sell/myShoppingCart.aspx.designer.cs
generated
Normal file
@@ -0,0 +1,24 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <自动生成>
|
||||
// 此代码由工具生成。
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </自动生成>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Mtxfw.shop {
|
||||
|
||||
|
||||
public partial class myShoppingCart {
|
||||
|
||||
/// <summary>
|
||||
/// MyForm 控件。
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// 自动生成的字段。
|
||||
/// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm MyForm;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user