<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%> <% Response.Expires= -1 Response.ExpiresAbsolute = Now() - 1 response.CacheControl="no-cache" server.ScriptTimeout=50000 session.Timeout=60 %> <% dim userid userid = getPassportUserId '从哪儿来啊,回哪儿去 comefrom = checkstr(request("comefrom"),2) if comefrom ="" then comefrom = request.ServerVariables("HTTP_REFERER") comefrom = lcase(comefrom) '========获取以前选的购物车项====== dim LessonIds '单科 dim DiscountIds '套餐 dim cmd getCartItem LessonIds,DiscountIds if request("buynum")<>"" then '传订单号过来 code = checkstr(request("buynum"),1) session("isOrder")="true" session("oldorder")=request("buynum") DiscountIds = "":LessonIds = "" set rs = server.CreateObject("adodb.recordset") sql = "select discount_id from Edu_IntentionDetail where order_code="&code&" and discount_id<>0 group by discount_id " rs.open sql,conn,1,3 do until rs.eof DiscountIds = DiscountIds & rs("discount_id")&"," rs.movenext loop set rs = server.CreateObject("adodb.recordset") sql = "select class_id from Edu_IntentionDetail where order_code="&code&" and discount_id=0" rs.open sql,conn,1,3 do until rs.eof LessonIds = LessonIds & rs("class_id")&"," rs.movenext loop DiscountIds = "0,"&DiscountIds&"0" LessonIds = "0,"&LessonIds&"0" end if '=========添加新选的购物车项======= newLesson = checkstr(request("classids"),2) newDiscount= checkstr(request("discountids"),2) if checkIdStr(newLesson)=false or checkIdStr(newDiscount)=false then 'response.write "错误的参数,无法完成请求,请重新操作" response.Redirect(comefrom) response.End() end if newLessons = split(newLesson,",") newDiscounts = split(newDiscount,",") if newLesson<>"" then for l=lbound(newLessons) to ubound(newLessons) if instr(LessonIds,","&newLessons(l)&",")=0 then LessonIds=replace(LessonIds,",0",","&newLessons(l)&",0") next end if if newDiscount<>"" then for d=lbound(newDiscounts) to ubound(newDiscounts) if instr(DiscountIds,","&newDiscounts(d)&",")=0 then DiscountIds=replace(DiscountIds,",0",","&newDiscounts(d)&",0") next end if actionUrl = "classresultlist.asp?comefrom="&server.URLEncode(comefrom) cmd = checkstr(request("cmd"),2) '=========删除购物车项=========== if cmd="del" then did = checkstr(request("did"),2) lid = checkstr(request("lid"),2) if did<>"" then if right(did,1)="," then did = left(did,len(did)-1) didArray = split(did,",") for d=lbound(didArray) to ubound(didArray) DiscountIds=replace(DiscountIds,","&didArray(d)&",",",") next end if if lid<>"" then if right(lid,1)="," then lid = left(lid,len(lid)-1) lidArray = split(lid,",") for l=lbound(lidArray) to ubound(lidArray) LessonIds=replace(LessonIds,","&lidArray(l)&",",",") next end if if lid<>"" and did<>"" then if right(lid,1)="," then lid = left(lid,len(lid)-1) lidArray = split(lid,",") for l=lbound(lidArray) to ubound(lidArray) LessonIds=replace(LessonIds,","&lidArray(l)&",",",") next if right(did,1)="," then did = left(did,len(did)-1) didArray = split(did,",") for d=lbound(didArray) to ubound(didArray) DiscountIds=replace(DiscountIds,","&didArray(d)&",",",") next end if setCartItem LessonIds,DiscountIds response.Redirect(actionUrl) end if emptyCartUrl = "emptyCart.asp?from="&server.URLEncode(comefrom) '=====清空购物车==== if cmd="clear" then clearCart() response.Redirect("emptyCart.asp") end if dim dShowPrice '套餐折扣价 dim ShowPrice '单选课程折扣价 dim dRealPrice '套餐中课程原价 dim RealPrice '课程单选原价 dim RealClassIds '去掉单选课程在套餐中重复出现后的id Dim DiscountClassIds '套餐中包括的课程id Dim IsOldUser '是否为老学员 dim ClassSelectNum '单选课程的数量 Dim TotalMoney '销售价格合计 Dim RealMoney '原价合计 Dim OldMoney '老学员价格合计 Dim showOPrice '显示原价 showOPrice=true '获取折扣 call getDiscountPrice(userid,LessonIds,DiscountIds) LessonIds=RealClassIds if LessonIds<>"" and LessonIds<>"0,0" then lesson=LessonIds end if if DiscountClassIds<>"" and DiscountClassIds<>"0,0" then lesson=lesson&","&DiscountClassIds end if setCartItem LessonIds,DiscountIds '如果无有效购物车项,跳转至空购物车页 if (LessonIds = "" or LessonIds="0,0") and (DiscountIds = "" or DiscountIds = "0,0") then response.Redirect emptyCartUrl '生成课程订单号 if session("buynum")="" then session("buynum")=gen_ordercode(1,conn) end if buynum=session("buynum") buyright=0 if userid>0 then userRMoney = getUserRMoney(userid) else userRMoney=0 '获取帐号学习卡余额 %> 购物车

购物车

<%if (DiscountIds<>"" and DiscountIds <> "0,0") or (LessonIds<>"" and LessonIds<>"0,0") then%>
<%'====显示套餐==== isCanUseCard=true '是否可用学习卡支付 lids = "0,0" '套餐和班级的课程id if DiscountIds<>"" and DiscountIds<>"0,0" then dcount = 0 set rs=server.CreateObject("adodb.recordset") sql="select * from Edu_discount where Id in ("&DiscountIds&")" rs.open sql,conn,3 do while not rs.eof dcount = dcount+1 if rs("iscard") or rs("isself")=false then isCanUseCard=false if rs("lesson_id")<>"" and instr(lids,","&rs("lesson_id")&",")=0 then lids=replace(lids,",0",","&rs("lesson_id")&",0") %> " checked="checked"> <% rs.movenext loop end if '========显示单科课程====== if LessonIds<>"" and LessonIds<>"0,0" then lcount = 0 set rs=server.CreateObject("adodb.recordset") sql="select a.class_id,a.lesson_up,a.lesson_id,a.classnum,a.price,a.r_price,a.o_price,a.d_Price,b.lesson,a.no_percent,c.class_type_name from classset a left outer join lessonset b on b.lesson_id=a.lesson_id left outer join hqfs_class_type c on c.class_type_id=a.classnum where a.class_id in ("&LessonIds&") order by a.lesson_id asc,a.classnum asc" rs.open sql,conn,3 do while not rs.eof lcount = lcount+1 up_id=rs("lesson_up") if rs("no_percent")=false then if IsOldUser=1 then if ClassSelectNum>2 then classprice=rs("d_Price") else classprice=rs("O_Price") else if ClassSelectNum>2 then classprice=rs("o_price") else classprice=rs("r_price") end if else classprice=rs("r_price") end if if rs("lesson_id")<>"" and instr(lids,","&rs("lesson_id")&",")=0 then lids=replace(lids,",0",","&rs("lesson_id")&",0") %> " checked="checked"> <% rs.movenext loop end if%>

合计:<%=Formatcurrency(TotalMoney,2)%>

<%if isCanCardPay then%> 结算 <%else%> 结算 <%end if%>
<%if request.ServerVariables("HTTP_HOST")="m.edu24ol.com" then%>
/>
<%end if%>
<% end if '========页面上存在数据库无效的套餐id号。只在没有一个有效的套餐时有效========= if DiscountIds<>"" and DiscountIds<>"0,0" and dcount=0 then alertError("套餐") if LessonIds<>"" and LessonIds<>"0,0" and lcount=0 then alertError("课程") function alertError(msg) 'response.write "" end function function subStr(str,length) if len(str)>length then subStr = mid(str,1,length)&"..." else subStr = str end if end function%>