%@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 '获取帐号学习卡余额 %>