⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 classproduct.asp

📁 依蓝旅游网站管理系统Elan2008.SP2
💻 ASP
📖 第 1 页 / 共 5 页
字号:
<%
Class ClassProduct

   Private HTML, CommonRegExp, EL_Channel, ClassID, ShowClassType
   Private EL_Flag, CurrentPage, URLParameters, ReplaceKeyType

   Private Sub Class_Initialize
      Set CommonRegExp = New RegExp
	  CommonRegExp.IgnoreCase = True 
      CommonRegExp.Global = True 	
	  EL_Flag = True  
	  ReplaceKeyType = 0 '内容页字符替换模式 0:站内链接  1:字符过滤  2:两者
	  Set EL_Channel = New ClassChannel	 
	  EL_Channel.GetChannelConfig()	  
	  If EL_Channel.ErrorCode = 1 Or EL_Channel.ChannelType = 1 Then
	     EL_Common.ShowErrorMsg(EL_Common.Lang("BaseConfig.ChannelError", "频道参数错误"))
		 Call ApplicationTerminate()
	  End If
	  
	  If EL_Channel.ChannelModule <> 3 Then
	     EL_Common.ShowErrorMsg(EL_Common.Lang("BaseConfig.ChannelModuleError", "频道模块错误"))
		 Call ApplicationTerminate()
	  End If
	  
	  If EL_Channel.Disabled Then
	     EL_Common.ShowErrorMsg(EL_Common.Lang("BaseConfig.Disabled", "该频道已被禁用"))
		 Call ApplicationTerminate()
	  End If
	  CurrentPage = EL_Common.ELRequest("page", 2) 
	  ShowClassType = EL_Common.ELRequest("ShowType", 2)
	  URLParameters = request.ServerVariables("QUERY_STRING")
	  If CurrentPage<1 Then
	     CurrentPage = 1
	  Else
	     URLParameters = EL_Common.ReplaceText(URLParameters, "\&{0,}page=[0-9]*", "")
		 If URLParameters <> "" And Left(URLParameters, 1) = "&" Then URLParameters = Right(URLParameters, Len(URLParameters)-1)
	  End If	  
	  
   End Sub
   
   Private Sub Class_Terminate
      Set CommonRegExp = Nothing
	  Set EL_Channel = Nothing
   End Sub 
   
   Private Function ChannelCommonLabels(ByVal HTML)
      '频道通用标签
	  Dim TempHTML
	  
	  TempHTML = HTML
	  TempHTML = EL_Common.RegExpStaticLabel(TempHTML, "{$ChannelID}", ChannelID)
	  TempHTML = EL_Common.RegExpStaticLabel(TempHTML, "{$ChannelName}", EL_Channel.ChannelName)
	  TempHTML = EL_Common.RegExpStaticLabel(TempHTML, "{$ChannelPictrue}", EL_Channel.ChannelPictrue)
	  TempHTML = EL_Common.RegExpStaticLabel(TempHTML, "{$ChannelDir}", EL_Channel.ChannelDir)
	  TempHTML = EL_Common.RegExpStaticLabel(TempHTML, "{$ItemName}", EL_Channel.ItemName)
	  TempHTML = EL_Common.RegExpStaticLabel(TempHTML, "{$ItemUnit}", EL_Channel.ItemUnit)
	  TempHTML = EL_Common.RegExpStaticLabel(TempHTML, "{$ClassItemName}", EL_Channel.ClassItemName)
	  TempHTML = EL_Common.RegExpStaticLabel(TempHTML, "{$UploadDir}", EL_Channel.UploadDir)
	  TempHTML = EL_Common.RegExpStaticLabel(TempHTML, "{$MetaKeywords}", "<meta name=""keywords"" content="""& EL_Channel.MetaKeywords &""" />")
	  TempHTML = EL_Common.RegExpStaticLabel(TempHTML, "{$MetaDescription}", "<meta name=""description"" content="""& EL_Channel.MetaDescription &""" />")
	  TempHTML = EL_Common.RegExpStaticLabel(TempHTML, "{$ShowClassMenu}", "<script language='JavaScript1.2' type='text/JavaScript' src='"& InstallDir & EL_Channel.ChannelDir &"/Js/ShowClassMenu.js'></script>")
	  TempHTML = EL_Common.RegExpStaticLabel(TempHTML, "{$ShowSearchForm}", "<script language='JavaScript' type='text/JavaScript' src='"& InstallDir & EL_Channel.ChannelDir &"/Js/ShowSearchForm.js'></script>")

	  ChannelCommonLabels = TempHTML
   End Function
   
   Public Sub CreateIndex()	  
	  ClassID = 0
	  
	  HTML = EL_Common.Template(ChannelID, 1, 0)
	  HTML = EL_Common.ReplaceCommonLabels(HTML)	
	  
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$PageTitle}", EL_Common.Join2String(EL_Channel.ChannelName, SiteTitle, EL_Common.TitleDivide))
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$DefaultSkin}", EL_Common.Skin(ChannelID, 0, 0))
	  
	  EL_Common.ShowPath = EL_Common.ShowPath & EL_Common.Lang("BaseConfig.Path", "&nbsp;&gt;&gt;&nbsp;") & EL_Channel.ChannelName
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$ShowPath}", EL_Common.ShowPath)
	  
	  HTML = ChannelCommonLabels(HTML)
	  HTML = Label_ArrClassList(HTML)
	  HTML = Label_GetProductList(HTML)
	  HTML = Label_GetProductPhoto(HTML)	  
	  
	  Response.Write HTML
   End Sub
   
   Public Sub Booking()
	  Response.Write "<p>对不起,试用版本暂时不提供此功能! </p>"
	  Response.Write "<p>官方网站:<a href='http://www.elancom.net' target='_blank'>http://www.elancom.net</a><br><br>"
	  Response.Write "论坛交流:<a href='http://www.elancom.net/Forum/' target='_blank'>http://www.elancom.net/Forum/</a><br><br>"
	  Response.Write "在线演示功能:<a href='http://www.elancom.net/Demo/' target='_blank'>http://www.elancom.net/Demo/ </a></p>"
	  Response.Write "<p>联系方式:elancom@163.com  QQ:30735755 </p>"
   End Sub
   
   Public Sub BookSuccess()	  
      '检查页面来源
	  If CheckComeURL = False Then
	     EL_Common.ShowErrorMsg(EL_Common.Lang("BaseConfig.ComeURLError", "禁止从本站外部提交数据"))
		 Exit Sub
	  End If
	  	  
	  Dim BookCmd, rsBook
	  Dim BookID, Consume, BookNumber
	  BookID = EL_Common.ELRequest("BookID", 2)
	  
	  Call EL_Common.InitCommonCmd(BookCmd, rsBook, "EL_ProductBook", "BookNumber, PriceOfDiscount", "ChannelID="& ChannelID &" And BookID="& BookID)
	  rsBook.Close()
	  
	  If BookCmd(0) <> 1 Then
	     EL_Common.ShowErrorMsg(EL_Common.Lang("Product.Error13", "指定的订单不存在"))
		 Exit Sub
	  End If
	  
	  rsBook.Open()
	  BookNumber = rsBook(0)
	  Consume = rsBook(1)
	  rsBook.Close()
	  Set rsBook = Nothing
	  
	  HTML = EL_Common.Template(ChannelID, 31, 0)
	  HTML = EL_Common.ReplaceCommonLabels(HTML)
	  
	  Dim PageTitle, StrPath
	  PageTitle = EL_Common.Join2String(EL_Channel.ChannelName, SiteTitle, EL_Common.TitleDivide)
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$PageTitle}", PageTitle)
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$DefaultSkin}", EL_Common.Skin(ChannelID, 0, 0))
	  
	  StrPath = EL_Common.Lang("BaseConfig.Path", "&nbsp;&gt;&gt;")
	  EL_Common.ShowPath = EL_Common.ShowPath & StrPath &"<a href='"& InstallDir & EL_Channel.ChannelDir &"/Index.asp'>"& EL_Channel.ChannelName &"</a>"
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$ShowPath}", EL_Common.ShowPath)
	  HTML = ChannelCommonLabels(HTML)
	  
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$BookID}", BookID)
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$BookNumber}", BookNumber)
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$Consume}", Consume)
	  
	  Response.Write HTML
   End Sub
   
   Public Sub BookConfirm()	  
	  	  
	  Dim ProductCmd, rsProduct, i, BookType
	  Dim ProductID, LeaveDate, Person, RoomNum, TotalPrice, Price, IsDiscount, LeastPerson
	  Dim ProductName, Days, TravelDate
	  
	  BookType = EL_Common.ELRequest("BookType", 2)
	  ProductID = EL_Common.ELRequest("ProductID", 2)
	  LeaveDate = EL_Common.ELRequest("LeaveDate", 1)
	  Person = EL_Common.ELRequest("Person", 2)
	  RoomNum = EL_Common.ELRequest("RoomNum", 2)	  
	  TotalPrice = 0
	  
	  If EL_User.UserIsLogin = False And BookType = 0 Then
	     Dim TempURL
		 TempURL = InstallDir & EL_Channel.ChannelDir &"/"& EL_CurrentScriptName &"?"
		 TempURL = TempURL &"ProductID="& ProductID 
		 TempURL = TempURL &"&LeaveDate="& LeaveDate
		 TempURL = TempURL &"&Person="& Person
		 TempURL = TempURL &"&RoomNum="& RoomNum 
		 TempURL = TempURL &"&BookType=1"
		 Response.Redirect InstallDir &"User/Login.asp?url="& EL_Common.ServerURLEncode(TempURL) 
	  End If
	  
	  Call EL_Common.CheckEnableBook(EL_User.UserType)
	  
	  If Not IsDate(LeaveDate) Then
	     EL_Common.ShowErrorMsg(EL_Common.Lang("Product.Error1", "出发日期格式错误,必须以“yyyy-mm-dd”的格式提交"))
		 Exit Sub
	  End If
	  If DateDiff("d", Date(), LeaveDate)<=0 Then
	     EL_Common.ShowErrorMsg(EL_Common.Lang("Product.Error2", "出发日期必须大于现在日期"))
		 Exit Sub
	  End If
	  
	  Call EL_Common.InitCommand(ProductCmd, "EL_SP_ProductBookConfirm")
	  With ProductCmd
	     .Parameters.Append .CreateParameter("RETURN", 2, 4)
		 .Parameters.Append .CreateParameter("@ProductID", 3, 1, 4, ProductID)
		 .Parameters.Append .CreateParameter("@ChannelID", 3, 1, 4, ChannelID)
		 Set rsProduct = .Execute()
	  End With
	  rsProduct.Close()	  
	  If ProductCmd(0) <> 1 Then
	     EL_Common.ShowErrorMsg(EL_Common.Lang("Product.Error5", "指定产品不存在"))
		 Set ProductCmd = Nothing
		 Exit Sub
	  End If  	  	  
	  rsProduct.Open()
	  ProductName = rsProduct("ProductName")
	  Days = rsProduct("Days")
	  LeastPerson = rsProduct("LeastPerson")
	  TravelDate = rsProduct("TravelDate")
	  Price = rsProduct("Price")
	  IsDiscount = rsProduct("IsDiscount")
	  rsProduct.Close()
	  Set rsProduct = Nothing
	  Set ProductCmd = Nothing
	  
	  If Person < LeastPerson Then
	     EL_Common.ShowErrorMsg(EL_Common.RegExpStaticLabel(EL_Common.Lang("Product.Error3", "出行人数不能少于{$LeastPerson}"), "{$LeastPerson}", LeastPerson))
		 Exit Sub
	  End If
	  
	  If TravelDate <> "-1" Then
	     Dim w
		 w = WeekDay(LeaveDate)
		 If w = 1 Then
		    w = 7
		 Else
		    w = w - 1
		 End If
		 If EL_Common.FoundInArray(Split(Replace(TravelDate, " ", ""), ","), CStr(w)) = False Then
		    EL_Common.ShowErrorMsg(EL_Common.RegExpStaticLabel(EL_Common.Lang("Product.Error7", "选择的出发日期有误,本产品只提供周{$TravelDate}出发"), "{$TravelDate}", TravelDate))
			Exit Sub
		 End If
	  End If	  
  
	  HTML = EL_Common.Template(ChannelID, 8, 0)	
	  
	  HTML = EL_Common.ReplaceCommonLabels(HTML)  
	  
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$PageTitle}", EL_Common.Join2String(ProductName, SiteTitle, EL_Common.TitleDivide))
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$DefaultSkin}", EL_Common.Skin(ChannelID, 0, 0))
	  
	  Dim StrPath
	  StrPath = EL_Common.Lang("BaseConfig.Path", "&nbsp;&gt;&gt;&nbsp;")
	  EL_Common.ShowPath = EL_Common.ShowPath & StrPath &"<a href='"& InstallDir & EL_Channel.ChannelDir &"/Index.asp'>"& EL_Channel.ChannelName &"</a>" 
	  EL_Common.ShowPath = EL_Common.ShowPath & StrPath & EL_Common.RegExpStaticLabel(EL_Common.Lang("BaseConfig.BookPath.Book", "{$ItemName}预订"), "{$ItemName}", EL_Channel.ItemName)
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$ShowPath}", EL_Common.ShowPath)
	  
	  HTML = ChannelCommonLabels(HTML)
	  
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$ProductID}", ProductID)
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$ProductName}", ProductName)
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$Days}", Days)
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$Price}", Price)
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$LeaveDate}", LeaveDate)
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$Person}", Person)
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$RoomNum}", RoomNum)  
	  
	  TotalPrice = Price * Person
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$PriceList}", EL_Common.Lang("Sight.Price.Icon", "&#xFFE5;") & Price &" x "& Person)		  
	  HTML = EL_Common.RegExpStaticLabel(HTML, "{$TotalPrice}", TotalPrice)
	  
	  Dim DiscountHTML, TempDiscount
	  TempDiscount = 1
	  If IsDiscount Then
	     If EL_User.DiscountOfProduct = 0 Then
	        DiscountHTML = EL_Common.Lang("Product.Discount.d0", "您不可以享受折扣")
	     Else
	        DiscountHTML = EL_Common.Lang("Product.Discount.d1", "您可享受{$Discount}折优惠,折后价")
		    TempDiscount = EL_User.DiscountOfProduct / 10
		    DiscountHTML = EL_Common.RegExpStaticLabel(DiscountHTML, "{$Discount}", EL_User.DiscountOfProduct)
		    DiscountHTML = EL_Common.RegExpStaticLabel(DiscountHTML, "{$PriceOfDiscount}", TotalPrice &" x "& EL_Common.FormatDecimal(TempDiscount) &" = "& EL_Common.Lang("Product.Price.Icon", "&#xFFE5;") & EL_Common.ELRound(TempDiscount * TotalPrice))
	     End If
		 HTML = EL_Common.RegExpStaticLabel(HTML, "{$Points}", EL_Common.ELClng(TotalPrice * TempDiscount / ConsumeProportion))
	  Else
	     DiscountHTML = EL_Common.Lang("Product.NoDiscount", "此产品无打折优惠")
		 HTML = EL_Common.RegExpStaticLabel(HTML, "{$Points}", EL_Common.ELClng(TotalPrice / ConsumeProportion))
	  End If

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -