فهرست منبع

Merge branch 'dev2.8.5' of http://192.168.3.207:10080/qmx/jy into dev2.8.5

wangshan 5 سال پیش
والد
کامیت
e5bb1f485b
27فایلهای تغییر یافته به همراه3422 افزوده شده و 988 حذف شده
  1. 1 1
      src/config.json
  2. 76 0
      src/jfw/front/front.go
  3. 1 1
      src/jfw/front/swordfish.go
  4. 28 3
      src/jfw/front/vipsubscribe.go
  5. 6 9
      src/jfw/modules/subscribepay/src/entity/subscribeVip.go
  6. 24 16
      src/jfw/modules/subscribepay/src/service/vipRenewUpgrade.go
  7. 9 1
      src/jfw/modules/subscribepay/src/service/vipSubscribePay.go
  8. 2 0
      src/jfw/modules/subscribepay/src/service/vipSubscribeTrial.go
  9. 78 83
      src/jfw/modules/subscribepay/src/timetask/timetask.go
  10. 6 6
      src/jfw/modules/subscribepay/src/util/db.go
  11. 45 20
      src/jfw/modules/subscribepay/src/util/msgremind.go
  12. 9 5
      src/jfw/modules/weixin/src/config.json
  13. 46 9
      src/jfw/modules/weixin/src/wx/wx.go
  14. 471 222
      src/web/staticres/css/subscribe.css
  15. 3 1
      src/web/staticres/js/login.js
  16. 59 24
      src/web/staticres/vipsubscribe/css/choose_area.css
  17. BIN
      src/web/staticres/vipsubscribe/image/banxuan_disabled.png
  18. 719 0
      src/web/staticres/vipsubscribe/js/updateArea.js
  19. 777 21
      src/web/templates/pc/subscribe_new.html
  20. 17 7
      src/web/templates/weixin/dataExport/dataExport_toMyOrder.html
  21. 19 501
      src/web/templates/weixin/vipsubscribe/choose_area_upgrade.html
  22. 881 0
      src/web/templates/weixin/vipsubscribe/choose_area_upgrades.html
  23. 4 4
      src/web/templates/weixin/vipsubscribe/renew_notice.html
  24. 10 10
      src/web/templates/weixin/vipsubscribe/renew_pay.html
  25. 2 2
      src/web/templates/weixin/vipsubscribe/vip_introduce.html
  26. 1 0
      src/web/templates/weixin/vipsubscribe/vip_purchase.html
  27. 128 42
      src/web/templates/weixin/vipsubscribe/vip_upgrade.html

+ 1 - 1
src/config.json

@@ -64,7 +64,7 @@
         "followEntDetail": "/jylab/followent/detail/%s",
         "mymenu": "/front/wxMyOrder/myMenu",
 		"historypush": "/swordfish/historypush?times=%s",
-		"expireTip": "/front/vipsubscribe/renewPage/%s?orderId=%s&startTime=%s&endTime=%s"
+		"msgremind": "/front/vipsubscribe/msgremind?%s"
     },
     "jy_activeset": {
         "activitystartcode": "3201000000",

+ 76 - 0
src/jfw/front/front.go

@@ -1,6 +1,7 @@
 package front
 
 import (
+	"encoding/hex"
 	"fmt"
 	"jfw/config"
 	"jfw/filter"
@@ -135,6 +136,8 @@ type Front struct {
 	dataService xweb.Mapper `xweb:"/front/dataService.html"`
 	//打赏页面
 	payIndex xweb.Mapper `xweb:"/weixin/reward/index"` //微信支付页面
+	//订阅付费消息提醒中转
+	msgremind xweb.Mapper `xweb:"/front/vipsubscribe/msgremind"`
 }
 
 var sewx util.SimpleEncrypt //微信的加密方法
@@ -624,6 +627,7 @@ func (f *Front) HasSign() error {
 
 //用户注销
 func (f *Front) SignOut() error {
+	log.Println("userId----1", f.GetSession("userId"))
 	f.DelSession("rpcBackUserInfo")
 	f.DelSession("user")
 	f.DelSession("s_nickname")
@@ -633,6 +637,7 @@ func (f *Front) SignOut() error {
 	f.DelSession("DataExportVerifyEmail_val")
 	f.DelSession("DataExportVerifyPhone_val")
 	f.ServeJson("ok")
+	log.Println("userId----2", f.GetSession("userId"))
 	//sess := f.GetSession("user")
 	//if user, ok := sess.(map[string]interface{}); ok {
 	//shareid := fmt.Sprint(user["shareid"])
@@ -664,6 +669,9 @@ func (f *Front) GetLoginNum(prestr string) error {
 	f.SetSession("Rref", Rref)
 	shareid, shareidot := qrmanager.QrCodeManager.GetQRCode(oid, prestr, f.Session(), f.Request)
 	//log.Println("登录获取shareid:", shareid)
+	if prestr == config.Seoconfig["jydyy"].(string) { //订阅页面扫码回复信息
+		redis.Put("sso", "pc_subscribe_reply_"+shareidot, "1", 15*60)
+	}
 	f.ServeJson(map[string]string{
 		"num":   se.EncodeString(shareid),
 		"numot": se.EncodeString(shareidot),
@@ -1406,3 +1414,71 @@ func (s *Front) UpdateShareStatus() error {
 func (s *Front) StaticPage(pagename string) error {
 	return s.Render("/staticpage/" + pagename)
 }
+
+//
+func (f *Front) Msgremind() error {
+	param := map[string]string{}
+	if array := strings.Split(f.Url(), "?"); len(array) == 2 {
+		decode, _ := hex.DecodeString(array[1])
+		for _, v := range strings.Split(string(decode), "&") {
+			if vv := strings.Split(v, "="); len(vv) == 2 {
+				param[vv[0]] = vv[1]
+			}
+		}
+	}
+	userId, _ := f.GetSession("userId").(string)
+	if userId == "" {
+		return f.Render("_error.html")
+	}
+	user, ok := public.MQFW.FindById("user", userId, `{"i_vip_status":1,"l_vip_endtime":1}`)
+	i_vip_status := util.IntAll((*user)["i_vip_status"])
+	if !ok || user == nil || len(*user) == 0 {
+		return f.Render("_error.html")
+	}
+	myLastOrderCode := func(user_id string) string {
+		order := public.Mysql.FindOne("dataexport_order", map[string]interface{}{
+			"user_id":      user_id,
+			"order_status": 1,
+			"product_type": "VIP订阅",
+		}, "id,order_code", "pay_time desc")
+		if order != nil && len(*order) > 0 {
+			return util.ObjToString((*order)["order_code"])
+		} else {
+			return ""
+		}
+	}
+	t := param["type"]
+	if t == "unpaid" { //未支付 已支付
+		return f.Redirect("/weixin/pay/toOrderDetailPage?orderCode=" + param["ordercode"])
+	} else if t == "paid" {
+		if i_vip_status > 0 {
+			return f.Redirect("/front/vipsubscribe/toSetPage")
+		} else {
+			return f.Redirect("/weixin/pay/vipsubscribe_new?orderCode=" + myLastOrderCode(userId))
+		}
+	} else if t == "ontrial_soonexprie" || t == "ontrial_expried" || t == "soonexprie" || t == "expried" { //试用即将到期 试用已到期 即将到期 已到期
+		if t == "ontrial_soonexprie" || t == "ontrial_expried" {
+			if i_vip_status == 2 {
+				return f.Redirect("/front/vipsubscribe/toSetPage")
+			} else {
+				return f.Redirect("/weixin/pay/vipsubscribe_willExpire")
+			}
+		} else if t == "soonexprie" || t == "expried" {
+			now_unix := time.Now().Unix()
+			l_vip_endtime := util.Int64All((*user)["l_vip_endtime"])
+			if now_unix < l_vip_endtime-259200 {
+				//已续费
+				return f.Redirect("/front/vipsubscribe/toSetPage")
+			} else {
+				if now_unix > l_vip_endtime {
+					//未续费已到期,跳转到再次购买页面
+					return f.Redirect("/weixin/pay/vipsubscribe_new?orderCode=" + myLastOrderCode(userId))
+				} else {
+					//未续费未到期,跳转到续费页面
+					return f.Redirect("/weixin/pay/renewPayPage")
+				}
+			}
+		}
+	}
+	return f.Render("_error.html")
+}

+ 1 - 1
src/jfw/front/swordfish.go

@@ -2526,7 +2526,7 @@ func (m *Front) Subscribe() error {
 	m.T["nickname"] = mynickname
 	m.T["avatar"] = myavatar
 	m.T["signature"] = wx.SignJSSDK(m.Site() + m.Url())
-	return m.Render("/pc/subscribe.html", &m.T)
+	return m.Render("/pc/subscribe_new.html", &m.T)
 }
 
 //获取高级查询所需的参数

+ 28 - 3
src/jfw/front/vipsubscribe.go

@@ -1,8 +1,12 @@
 package front
 
 import (
+	"fmt"
+	"jfw/config"
+	"jfw/jyutil"
 	"jfw/public"
 	"jfw/wx"
+	"net/url"
 	"qfw/util"
 	"time"
 
@@ -112,13 +116,34 @@ func (s *Subscribepay) ToSetPage() {
 func (s *Subscribepay) Introduce() error {
 	userId := util.ObjToString(s.GetSession("userId"))
 	if userId == "" {
-		return s.Redirect("/swordfish/about")
+		if s.GetString("state") == "wx" {
+			//微信跳回来的
+			code := s.GetString("code")
+			if code != "" {
+				openid := jyutil.Getopenid(code)
+				if openid != "" {
+					isSubscribe := CheckUserIsSubscribe(openid)
+					if isSubscribe {
+						FindUserAndCreateSess(openid, s.Session())
+					}
+				}
+			}
+		} else {
+			if public.CheckWxBrowser(s.Request) {
+				//所有参数都不再使用,跳到微信验证用户
+				return s.Redirect(fmt.Sprintf(config.Wxoauth, url.QueryEscape(s.Site()+s.Url()), "wx"), 302)
+			}
+			return s.Redirect("/swordfish/about")
+		}
 	}
-	m, _ := public.MQFW.FindById("user", userId, `{"o_vipjy":1,"i_vip_status":1}`)
-	if len(*m) == 0 {
+	m, ok := public.MQFW.FindById("user", userId, `{"o_vipjy":1,"i_vip_status":1}`)
+	if !ok {
 		return s.Redirect("/swordfish/about")
 	}
 	obj := util.ObjToMap((*m)["o_vipjy"])
+	if util.IntAll((*m)["i_vip_status"]) > 0 {
+		return s.Redirect("/front/vipsubscribe/toSetPage")
+	}
 	s.T["notShowTrial"] = util.IntAll((*obj)["i_trial"]) == -1 || (*m)["i_vip_status"] != nil
 	s.T["signature"] = wx.SignJSSDK(s.Site() + s.Url())
 	return s.Render("/weixin/vipsubscribe/vip_introduce.html")

+ 6 - 9
src/jfw/modules/subscribepay/src/entity/subscribeVip.go

@@ -76,7 +76,7 @@ func (this *vipSubscribeStruct) PayCallBack(param *CallBackParam) bool {
 	orderdata := util.Mysql.FindOne("dataexport_order", map[string]interface{}{
 		"out_trade_no": param.OutTradeno,
 		"order_money":  param.TotalFee,
-	}, "id,filter,order_code,order_status,user_id,vip_starttime,vip_endtime", "")
+	}, "id,filter,order_code,order_status,user_id,vip_starttime,vip_endtime,vip_type,prepay_time", "")
 	pay_time := qutil.FormatDate(&now, qutil.Date_Full_Layout)
 	if orderdata == nil {
 		log.Println("未找到订单")
@@ -142,8 +142,11 @@ func (this *vipSubscribeStruct) PayCallBack(param *CallBackParam) bool {
 		//	} else if vmsg.OrderType == 6 { //下月升级未生效再次升级
 		//		flag = JyVipSubStruct.UpgradeSubVipTwo(userid, vmsg, qutil.ObjToString((*orderdata)["vip_endtime"]), false)
 	}
-	//支付成功后 其他未支付vip订阅订单 变为已取消
+	//支付成功后
 	if flag {
+		//支付提醒
+		util.MsgRemind.PaySuccess(qutil.IntAll((*orderdata)["id"]), qutil.ObjToString((*orderdata)["order_code"]), qutil.ObjToString((*orderdata)["user_id"]), qutil.ObjToString((*orderdata)["prepay_time"]), qutil.IntAllDef((*orderdata)["vip_type"], -1))
+		//其他未支付vip订阅订单 变为已取消
 		go PayCancel(userid)
 	}
 	return flag
@@ -151,13 +154,7 @@ func (this *vipSubscribeStruct) PayCallBack(param *CallBackParam) bool {
 
 //设置开始使用vip订阅
 func (this *vipSubscribeStruct) StartSubVip(userId string, vmsg VipSimpleMsg, startTime, endTime time.Time, isTrial bool) bool {
-	buyset := &SubvipBuySet{}
-	if !isTrial { //购买
-		buyset = JyVipSubStruct.NewBuySet(vmsg.Area, vmsg.Industry)
-	} else { //试用
-		buyset.AreaCount = -1       //城市数量
-		buyset.BuyerclassCount = -1 //行业数量
-	}
+	buyset := JyVipSubStruct.NewBuySet(vmsg.Area, vmsg.Industry)
 	if !util.MQFW.UpdateById("user", userId,
 		bson.M{"$set": bson.M{
 			"o_vipjy.i_trial":      -1,                      //已激活试用

+ 24 - 16
src/jfw/modules/subscribepay/src/service/vipRenewUpgrade.go

@@ -86,12 +86,21 @@ func (this *RenewUpgrade) RenewUpgradeCreateOrder() {
 	areaArr := this.GetString("area")
 	var area *map[string]interface{}
 	if areaArr != "no" {
-		area = qutil.ObjToMap(this.GetString("area")) //新增区域
+		area = qutil.ObjToMap(this.GetString("area")) //新增订阅区域
 	} else {
 		area = &map[string]interface{}{
 			"no": "no",
 		}
 	}
+	areas_arr := this.GetString("areas_arr")
+	var addBuyArea *map[string]interface{}
+	if areas_arr != "no" {
+		addBuyArea = qutil.ObjToMap(this.GetString("areas_arr")) //新增购买区域
+	} else {
+		addBuyArea = &map[string]interface{}{
+			"no": "no",
+		}
+	}
 	industryArr := this.GetString("industry")
 	var industry []string
 	if industryArr != "no" {
@@ -226,18 +235,12 @@ func (this *RenewUpgrade) RenewUpgradeCreateOrder() {
 			addIndustry := qutil.ObjArrToStringArr(vipjy["a_buyerclass"].([]interface{}))
 			buyerclasscount := vipjy["o_buyset"].(map[string]interface{})["buyerclasscount"]
 			if len(addIndustry) != 0 {
-				log.Println("buyerclasscount", buyerclasscount)
-				log.Println("addIndustry", addIndustry)
 				reduce := qutil.IntAll(buyerclasscount) - len(addIndustry)
-				log.Println("reduce", reduce)
 				if reduce > 0 {
-					log.Println("industry", industry)
 					Leng := len(industry) - reduce
 					if len(industry) > 0 {
 						if industry[0] != "no" {
-							log.Println("industry", industry)
 							industry = industry[0:Leng]
-							log.Println("industry", industry)
 						}
 					}
 				}
@@ -249,18 +252,18 @@ func (this *RenewUpgrade) RenewUpgradeCreateOrder() {
 			oldAreaM := 0
 			addIndustryY := 0
 			addIndustryM := 0
-			if (*area)["no"] != "no" && len(industry) > 0 {
+			if (*addBuyArea)["no"] != "no" && len(industry) > 0 {
 				if industry[0] != "no" {
-					addAreaY = entity.JyVipSubStruct.GetSubVipPrice(area, industry, upgradeYear, 1)
-					addAreaM = entity.JyVipSubStruct.GetSubVipPrice(area, industry, upgradeMonth, 2)
+					addAreaY = entity.JyVipSubStruct.GetSubVipPrice(addBuyArea, industry, upgradeYear, 1)
+					addAreaM = entity.JyVipSubStruct.GetSubVipPrice(addBuyArea, industry, upgradeMonth, 2)
 				}
-			} else if (*area)["no"] != "no" && len(industry) == 0 {
-				addAreaY = entity.JyVipSubStruct.GetSubVipPrice(area, industry, upgradeYear, 1)
-				addAreaM = entity.JyVipSubStruct.GetSubVipPrice(area, industry, upgradeMonth, 2)
+			} else if (*addBuyArea)["no"] != "no" && len(industry) == 0 {
+				addAreaY = entity.JyVipSubStruct.GetSubVipPrice(addBuyArea, industry, upgradeYear, 1)
+				addAreaM = entity.JyVipSubStruct.GetSubVipPrice(addBuyArea, industry, upgradeMonth, 2)
 			}
-			if (*area)["no"] != "no" {
-				oldAreaY = entity.JyVipSubStruct.GetSubVipPrice(area, industrys, upgradeYear, 1)
-				oldAreaM = entity.JyVipSubStruct.GetSubVipPrice(area, industrys, upgradeMonth, 2)
+			if (*addBuyArea)["no"] != "no" {
+				oldAreaY = entity.JyVipSubStruct.GetSubVipPrice(addBuyArea, industrys, upgradeYear, 1)
+				oldAreaM = entity.JyVipSubStruct.GetSubVipPrice(addBuyArea, industrys, upgradeMonth, 2)
 			}
 			if len(industry) > 0 {
 				if industry[0] != "no" {
@@ -362,6 +365,11 @@ func (this *RenewUpgrade) RenewUpgradeCreateOrder() {
 		if orderid == -1 {
 			return &entity.FuncResult{false, errors.New("数据库操作异常"), nil}
 		}
+		if isRenew {
+			util.MsgRemind.Add(qutil.IntAll(orderid), totalfee, 1, 0, ordercode, userId, now.Unix())
+		} else {
+			util.MsgRemind.Add(qutil.IntAll(orderid), totalfee, 2, 0, ordercode, userId, now.Unix())
+		}
 		return &entity.FuncResult{true, nil, map[string]interface{}{"code": ordercode, "res": payStr}}
 	}()
 	if r.Err != nil {

+ 9 - 1
src/jfw/modules/subscribepay/src/service/vipSubscribePay.go

@@ -146,6 +146,8 @@ func (this *SubVipPayOrder) CreateOrder() {
 		if orderid == -1 {
 			return &entity.FuncResult{false, errors.New("数据库操作异常"), nil}
 		}
+		//支付提醒
+		util.MsgRemind.Add(qutil.IntAll(orderid), totalfee, -1, 0, ordercode, userId, now.Unix())
 		return &entity.FuncResult{true, nil, map[string]interface{}{"code": ordercode, "res": payStr}}
 	}()
 	if r.Err != nil {
@@ -172,7 +174,7 @@ func (this *SubVipPayOrder) OrderToPay() {
 			"order_code":   orderCode,
 			"order_status": 0,
 		}
-		oData := util.Mysql.FindOne("dataexport_order", query, "code_url,prepay_time,pay_way,order_money", "")
+		oData := util.Mysql.FindOne("dataexport_order", query, "id,code_url,prepay_time,pay_way,order_money,vip_type", "")
 		if oData == nil || len(*oData) == 0 {
 			return &entity.FuncResult{false, errors.New("未知订单"), nil}
 		}
@@ -233,6 +235,12 @@ func (this *SubVipPayOrder) OrderToPay() {
 		if !ok {
 			return &entity.FuncResult{false, errors.New("数据库操作异常"), nil}
 		}
+		vip_type := qutil.IntAll((*oData)["vip_type"])
+		if vip_type == 0 {
+			vip_type = -1
+		}
+		//刷新支付提醒
+		util.MsgRemind.Add(qutil.IntAll((*oData)["id"]), totalfee, vip_type, 0, orderCode, userId, now.Unix())
 		return &entity.FuncResult{true, nil, map[string]interface{}{"res": jsPayParam}}
 	}()
 	if r.Err != nil {

+ 2 - 0
src/jfw/modules/subscribepay/src/service/vipSubscribeTrial.go

@@ -324,6 +324,8 @@ func (this *TrialOrder) TrialPay() {
 		if !entity.JyVipSubStruct.StartSubVip(userId, filter, now, endTime, true) { //设置开始试用
 			return &entity.FuncResult{false, errors.New("开通试用异常"), nil}
 		}
+		//支付提醒
+		util.MsgRemind.PaySuccess(qutil.IntAll(orderid), ordercode, userId, qutil.FormatDate(&now, qutil.Date_Full_Layout), 0)
 		return &entity.FuncResult{true, nil, map[string]interface{}{"code": ordercode}}
 	}()
 	if r.Err != nil {

+ 78 - 83
src/jfw/modules/subscribepay/src/timetask/timetask.go

@@ -2,6 +2,7 @@ package timetask
 
 import (
 	. "config"
+	"encoding/hex"
 	"fmt"
 	"log"
 	qutil "qfw/util"
@@ -71,7 +72,7 @@ func syncVipUpgrade() {
 
 //每天0点 检查试用、vip服务是否到期
 func checkIsExpire() {
-	crontab(true, TimeTaskConfig.CheckIsExpire, func() {
+	crontab(false, TimeTaskConfig.CheckIsExpire, func() {
 		log.Println("定时任务,开始更新vip状态")
 		now_unix := time.Now().Unix()
 		sess := util.MQFW.GetMgoConn()
@@ -96,6 +97,7 @@ func checkIsExpire() {
 						"i_vip_status":     -i_vip_status,
 						"i_vip_expire_tip": 2,
 						"i_vip_subtips":    0,
+						"i_vip_fastimport": 0,
 					},
 				})
 				delSess := util.MQFW.GetMgoConn()
@@ -125,7 +127,7 @@ func checkIsExpire() {
 
 //即将到期或者已到期发推送消息
 func expireRemind() {
-	crontab(true, TimeTaskConfig.ExpireRemind, func() {
+	crontab(false, TimeTaskConfig.ExpireRemind, func() {
 		log.Println("定时任务,到期提醒,开始推送消息")
 		sess := util.MQFW.GetMgoConn()
 		defer util.MQFW.DestoryMongoConn(sess)
@@ -151,90 +153,83 @@ func expireRemind() {
 			i_vip_status := qutil.IntAll(m["i_vip_status"])
 			i_vip_expire_tip := qutil.IntAll(m["i_vip_expire_tip"])
 			wxPushOk, appPushOk := false, false
-			if i_vip_expire_tip == 1 || i_vip_expire_tip == 2 {
-				tp := "will"
-				if i_vip_expire_tip == 2 {
-					tp = "exprie"
+			if i_vip_expire_tip != 1 && i_vip_expire_tip != 2 {
+				continue
+			}
+			l_vip_starttime := qutil.Int64All(m["l_vip_starttime"])
+			l_vip_endtime := qutil.Int64All(m["l_vip_endtime"])
+			s_m_openid := qutil.ObjToString(m["s_m_openid"])
+			isPushWx := qutil.IntAllDef(m["i_ispush"], 1)
+			s_jpushid := qutil.ObjToString(m["s_jpushid"])
+			s_opushid := qutil.ObjToString(m["s_opushid"])
+			s_appponetype := qutil.ObjToString(m["s_appponetype"])
+			log.Println("到期提醒,推送消息", _id, "i_vip_status", i_vip_status, "l_vip_starttime", l_vip_starttime, "l_vip_endtime", l_vip_endtime, "i_vip_expire_tip", i_vip_expire_tip, "s_m_openid", s_m_openid, "isPushWx", isPushWx, "s_appponetype", s_appponetype, "s_jpushid", s_jpushid, "s_opushid", s_opushid)
+			tp := ""
+			tplId, first_value, keyword1_value, keyword2_value, keyword3_value, keyword4_value, remark := "", "", "", "", "", "", ""
+			switch i_vip_status {
+			case 1, -1:
+				if i_vip_expire_tip == 1 {
+					tp = "ontrial_soonexprie"
+					tplId = MessageConfig.WxTpl_OnTrial_SoonExpire.Id
+					first_value = MessageConfig.WxTpl_OnTrial_SoonExpire.First.Value
+					remark = MessageConfig.WxTpl_OnTrial_SoonExpire.Remark.Value
+				} else if i_vip_expire_tip == 2 {
+					tp = "ontrial_expried"
+					tplId = MessageConfig.WxTpl_OnTrial_Expired.Id
+					first_value = MessageConfig.WxTpl_OnTrial_Expired.First.Value
+					remark = MessageConfig.WxTpl_OnTrial_Expired.Remark.Value
 				}
-				l_vip_starttime := qutil.Int64All(m["l_vip_starttime"])
-				l_vip_endtime := qutil.Int64All(m["l_vip_endtime"])
-				s_m_openid := qutil.ObjToString(m["s_m_openid"])
-				isPushWx := qutil.IntAllDef(m["i_ispush"], 1)
-				s_jpushid := qutil.ObjToString(m["s_jpushid"])
-				s_opushid := qutil.ObjToString(m["s_opushid"])
-				s_appponetype := qutil.ObjToString(m["s_appponetype"])
-				order := util.Mysql.FindOne("dataexport_order", map[string]interface{}{
-					"user_id":      _id,
-					"order_status": 1,
-					"product_type": "VIP订阅",
-				}, "id", "pay_time desc")
-				orderId := ""
-				if order != nil && len(*order) > 0 {
-					orderId = fmt.Sprint((*order)["id"])
+				keyword1_value = qutil.ObjToString(m["s_nickname"])
+				keyword2_value = qutil.FormatDateByInt64(&l_vip_endtime, qutil.Date_Short_Layout)
+				break
+			case 2, -2:
+				if i_vip_expire_tip == 1 {
+					tp = "soonexprie"
+					tplId = MessageConfig.WxTpl_SoonExpire.Id
+					first_value = MessageConfig.WxTpl_SoonExpire.First.Value
+					keyword2_value = MessageConfig.WxTpl_SoonExpire.Keyword2.Value
+					keyword3_value = MessageConfig.WxTpl_SoonExpire.Keyword3.Value
+					remark = MessageConfig.WxTpl_SoonExpire.Remark.Value
+				} else if i_vip_expire_tip == 2 {
+					tp = "expried"
+					tplId = MessageConfig.WxTpl_Expired.Id
+					first_value = MessageConfig.WxTpl_Expired.First.Value
+					keyword2_value = MessageConfig.WxTpl_Expired.Keyword2.Value
+					keyword3_value = MessageConfig.WxTpl_Expired.Keyword3.Value
+					remark = MessageConfig.WxTpl_Expired.Remark.Value
 				}
-				log.Println("到期提醒,推送消息", _id, "i_vip_status", i_vip_status, "orderId", orderId, "l_vip_starttime", l_vip_starttime, "l_vip_endtime", l_vip_endtime, "i_vip_expire_tip", i_vip_expire_tip, "s_m_openid", s_m_openid, "isPushWx", isPushWx, "s_appponetype", s_appponetype, "s_jpushid", s_jpushid, "s_opushid", s_opushid)
-				if isPushWx == 1 && s_m_openid != "" {
-					tplId, first_value, keyword1_value, keyword2_value, keyword3_value, keyword4_value, remark := "", "", "", "", "", "", ""
-					switch i_vip_status {
-					case 1, -1:
-						if i_vip_expire_tip == 1 {
-							tplId = MessageConfig.WxTpl_OnTrial_SoonExpire.Id
-							first_value = MessageConfig.WxTpl_OnTrial_SoonExpire.First.Value
-							remark = MessageConfig.WxTpl_OnTrial_SoonExpire.Remark.Value
-						} else if i_vip_expire_tip == 2 {
-							tplId = MessageConfig.WxTpl_OnTrial_Expired.Id
-							first_value = MessageConfig.WxTpl_OnTrial_Expired.First.Value
-							remark = MessageConfig.WxTpl_OnTrial_Expired.Remark.Value
-						}
-						keyword1_value = qutil.ObjToString(m["s_nickname"])
-						keyword2_value = qutil.FormatDateByInt64(&l_vip_endtime, qutil.Date_Short_Layout)
-						break
-					case 2, -2:
-						if i_vip_expire_tip == 1 {
-							tplId = MessageConfig.WxTpl_SoonExpire.Id
-							first_value = MessageConfig.WxTpl_SoonExpire.First.Value
-							keyword2_value = MessageConfig.WxTpl_SoonExpire.Keyword2.Value
-							keyword3_value = MessageConfig.WxTpl_SoonExpire.Keyword3.Value
-							remark = MessageConfig.WxTpl_SoonExpire.Remark.Value
-						} else if i_vip_expire_tip == 2 {
-							tplId = MessageConfig.WxTpl_Expired.Id
-							first_value = MessageConfig.WxTpl_Expired.First.Value
-							keyword2_value = MessageConfig.WxTpl_Expired.Keyword2.Value
-							keyword3_value = MessageConfig.WxTpl_Expired.Keyword3.Value
-							remark = MessageConfig.WxTpl_Expired.Remark.Value
-						}
-						keyword1_value = qutil.ObjToString(m["s_nickname"])
-						keyword4_value = qutil.FormatDateByInt64(&l_vip_endtime, qutil.Date_Short_Layout)
-						break
-					}
-					tmplData := map[string]*qrpc.TmplItem{
-						"first": &qrpc.TmplItem{
-							Value: first_value,
-						},
-						"keyword1": &qrpc.TmplItem{
-							Value: keyword1_value,
-						},
-						"keyword2": &qrpc.TmplItem{
-							Value: keyword2_value,
-						},
-						"keyword3": &qrpc.TmplItem{
-							Value: keyword3_value,
-						},
-						"keyword4": &qrpc.TmplItem{
-							Value: keyword4_value,
-						},
-						"remark": &qrpc.TmplItem{
-							Value: remark,
-						},
-					}
-					wxPushOk, _ = qrpc.WxSendTmplMsg(Config.Weixinrpc, &qrpc.WxTmplMsg{
-						OpenId:   s_m_openid,
-						TplId:    tplId,
-						TmplData: tmplData,
-						Url:      Config.WebDomain + "/front/sess/" + util.Se_Topnet.EncodeString(s_m_openid+",uid,"+strconv.Itoa(int(time.Now().Unix()))+",msgremind") + "__" + fmt.Sprint("type=%s&orderid=%d", tp, orderId),
-					})
-					log.Println("到期提醒,微信推送", _id, wxPushOk)
+				keyword1_value = qutil.ObjToString(m["s_nickname"])
+				keyword4_value = qutil.FormatDateByInt64(&l_vip_endtime, qutil.Date_Short_Layout)
+				break
+			}
+			if isPushWx == 1 && s_m_openid != "" {
+				tmplData := map[string]*qrpc.TmplItem{
+					"first": &qrpc.TmplItem{
+						Value: first_value,
+					},
+					"keyword1": &qrpc.TmplItem{
+						Value: keyword1_value,
+					},
+					"keyword2": &qrpc.TmplItem{
+						Value: keyword2_value,
+					},
+					"keyword3": &qrpc.TmplItem{
+						Value: keyword3_value,
+					},
+					"keyword4": &qrpc.TmplItem{
+						Value: keyword4_value,
+					},
+					"remark": &qrpc.TmplItem{
+						Value: remark,
+					},
 				}
+				wxPushOk, _ = qrpc.WxSendTmplMsg(Config.Weixinrpc, &qrpc.WxTmplMsg{
+					OpenId:   s_m_openid,
+					TplId:    tplId,
+					TmplData: tmplData,
+					Url:      Config.WebDomain + "/front/sess/" + util.Se_Topnet.EncodeString(s_m_openid+",uid,"+strconv.Itoa(int(time.Now().Unix()))+",msgremind") + "__" + hex.EncodeToString([]byte(fmt.Sprintf("type=%s", tp))),
+				})
+				log.Println("到期提醒,微信推送", _id, wxPushOk)
 			}
 			if wxPushOk || appPushOk {
 				util.MQFW.UpdateById("user", _id, map[string]interface{}{

+ 6 - 6
src/jfw/modules/subscribepay/src/util/db.go

@@ -17,12 +17,12 @@ var Ca_Log = &ca.Cassandra{}
 
 func init() {
 	//初始化cassandra
-	// Ca_Log.ViewCacheLen = true
-	// Ca_Log.InitCassandra("jianyu",
-	// 	Config.Cassandra.Size,
-	// 	Config.Cassandra.Host,
-	// 	map[string]int{"port": Config.Cassandra.Port},
-	// )
+	Ca_Log.ViewCacheLen = true
+	Ca_Log.InitCassandra("jianyu",
+		Config.Cassandra.Size,
+		Config.Cassandra.Host,
+		map[string]int{"port": Config.Cassandra.Port},
+	)
 	//初始化elastic
 	elastic.InitElasticSize(
 		Config.Elasticsearch,

+ 45 - 20
src/jfw/modules/subscribepay/src/util/msgremind.go

@@ -3,6 +3,7 @@ package util
 
 import (
 	. "config"
+	"encoding/hex"
 	"fmt"
 	"log"
 	"math"
@@ -26,7 +27,7 @@ type unpaidOrder struct {
 	orderId      int    //订单id
 	orderCode    string //订单编号
 	userId       string //用户id
-	createTime   int64  //下单时间
+	prepayTime   int64  //下单时间
 	remindStatus int    //1-下单时间2小时提醒 2-剩余2小时自动关闭时再次提醒
 	vipType      int    //-1:直接购买 0:试用 1:续费 2:升级
 	orderMoney   int    //订单金额
@@ -39,14 +40,14 @@ type unpaidOrder struct {
  *@param remindStatus 1-下单时间2小时提醒 2-剩余2小时自动关闭时再次提醒
  *@param orderCode 订单编号
  *@param userId 用户id
- *@param createTime 购买时间
+ *@param prepayTime 购买时间
  */
-func (m *msgRemind) Add(orderId, orderMoney, vipType, remindStatus int, orderCode, userId string, createTime int64) {
-	log.Println("未支付待提醒订单加入", orderId, orderCode, userId, createTime)
+func (m *msgRemind) Add(orderId, orderMoney, vipType, remindStatus int, orderCode, userId string, prepayTime int64) {
+	log.Println("未支付待提醒订单加入", orderId, orderCode, userId, prepayTime)
 	m.unpaidOrders.Store(orderId, &unpaidOrder{
 		orderCode:    orderCode,
 		userId:       userId,
-		createTime:   createTime,
+		prepayTime:   prepayTime,
 		orderId:      orderId,
 		orderMoney:   orderMoney,
 		vipType:      vipType,
@@ -59,13 +60,13 @@ func (m *msgRemind) Add(orderId, orderMoney, vipType, remindStatus int, orderCod
  *@param orderId 订单id
  *@param orderCode 订单编号
  *@param userId 用户id
- *@param createTime 购买时间
+ *@param prepayTime 购买时间
  *@param vipType -1:直接购买 0:试用 1:续费 2:升级
  */
-func (m *msgRemind) PaySuccess(orderId int, orderCode, userId, createTime string, vipType int) {
+func (m *msgRemind) PaySuccess(orderId int, orderCode, userId, prepayTime string, vipType int) {
 	go func() {
 		defer util.Catch()
-		log.Println("支付成功以后,消息提醒处理", orderId, orderCode, userId, createTime)
+		log.Println("支付成功以后,消息提醒处理", orderId, orderCode, userId, prepayTime)
 		m.unpaidOrders.Delete(orderId)
 		user, ok := MQFW.FindById("user", userId, `{"s_m_openid":1,"s_jpushid":1,"s_opushid":1,"s_appponetype":1,"i_ispush":1,"l_vip_endtime":1}`)
 		if !ok || user == nil || len(*user) == 0 {
@@ -94,19 +95,29 @@ func (m *msgRemind) PaySuccess(orderId int, orderCode, userId, createTime string
 						Value: orderCode,
 					},
 					"keyword3": &qrpc.TmplItem{
-						Value: strings.Split(createTime, " ")[0],
+						Value: strings.Split(prepayTime, " ")[0],
 					},
 					"keyword4": &qrpc.TmplItem{
 						Value: expireTime,
 					},
 				},
-				Url: Config.WebDomain + "/front/sess/" + Se_Topnet.EncodeString(s_m_openid+",uid,"+strconv.Itoa(int(time.Now().Unix()))+",msgremind") + "__" + fmt.Sprintf("type=paid&orderid=%d", orderId),
+				Url: Config.WebDomain + "/front/sess/" + Se_Topnet.EncodeString(s_m_openid+",uid,"+strconv.Itoa(int(time.Now().Unix()))+",msgremind") + "__" + hex.EncodeToString([]byte(fmt.Sprintf("type=paid"))),
 			})
 			log.Println("支付成功,微信推送", userId, wxPushOk)
 		}
 	}()
 }
 
+func (m *msgRemind) getExpireTime() int64 {
+	order_countdown := Config.OrderCountdown //配置文件读取
+	if strings.Contains(util.ObjToString(order_countdown), "h") {
+		onehour, _ := time.ParseDuration(util.ObjToString(order_countdown))
+		return int64(onehour.Seconds())
+	} else {
+		return util.Int64All(order_countdown) * 24 * 60 * 60
+	}
+}
+
 func (m *msgRemind) getVipType(vipType int) string {
 	switch vipType {
 	case 0:
@@ -130,9 +141,9 @@ func (m *msgRemind) run() {
 			now_unix := time.Now().Unix()
 			remind_status := 0
 			//剩余2小时
-			if unpaidOrder.remindStatus != 2 && now_unix >= unpaidOrder.createTime+259200-TimeTaskConfig.UnpaidRemind.BeforeExpire {
+			if unpaidOrder.remindStatus != 2 && unpaidOrder.prepayTime+m.getExpireTime() < now_unix && now_unix >= unpaidOrder.prepayTime+m.getExpireTime()-TimeTaskConfig.UnpaidRemind.BeforeExpire {
 				remind_status = 2
-			} else if unpaidOrder.remindStatus == 0 && now_unix > unpaidOrder.createTime+TimeTaskConfig.UnpaidRemind.AfterOrder { //下单时间后2小时未支付
+			} else if unpaidOrder.remindStatus == 0 && now_unix > unpaidOrder.prepayTime+TimeTaskConfig.UnpaidRemind.AfterOrder { //下单时间后2小时未支付
 				remind_status = 1
 			}
 			if remind_status == 0 {
@@ -155,7 +166,7 @@ func (m *msgRemind) run() {
 						Value: fmt.Sprintf(MessageConfig.WxTpl_Unpaid.First.Value, unpaidOrder.orderCode),
 					},
 					"keyword1": &qrpc.TmplItem{
-						Value: util.FormatDateByInt64(&unpaidOrder.createTime, util.Date_Short_Layout),
+						Value: util.FormatDateByInt64(&unpaidOrder.prepayTime, util.Date_Short_Layout),
 					},
 					"keyword2": &qrpc.TmplItem{
 						Value: unpaidOrder.orderCode,
@@ -176,7 +187,7 @@ func (m *msgRemind) run() {
 					OpenId:   s_m_openid,
 					TplId:    MessageConfig.WxTpl_Unpaid.Id,
 					TmplData: tmplData,
-					Url:      Config.WebDomain + "/front/sess/" + Se_Topnet.EncodeString(s_m_openid+",uid,"+strconv.Itoa(int(time.Now().Unix()))+",msgremind") + "__" + fmt.Sprintf("type=unpaid&orderid=%d", orderId),
+					Url:      Config.WebDomain + "/front/sess/" + Se_Topnet.EncodeString(s_m_openid+",uid,"+strconv.Itoa(int(time.Now().Unix()))+",msgremind") + "__" + hex.EncodeToString([]byte(fmt.Sprintf("type=unpaid&ordercode=%s", unpaidOrder.orderCode))),
 				})
 				log.Println("未支付订单,微信推送", unpaidOrder.userId, wxPushOk)
 			}
@@ -198,12 +209,25 @@ func (m *msgRemind) run() {
 		m.run()
 	})
 }
-
+func (m *msgRemind) gc() {
+	log.Println(m.getExpireTime())
+	time.AfterFunc(5*time.Minute, func() {
+		defer util.Catch()
+		m.unpaidOrders.Range(func(k interface{}, v interface{}) bool {
+			unpaidOrder, _ := v.(*unpaidOrder)
+			if time.Now().Unix() > unpaidOrder.prepayTime+m.getExpireTime() {
+				m.unpaidOrders.Delete(k)
+			}
+			return true
+		})
+		m.gc()
+	})
+}
 func init() {
 	go func() {
 		log.Println("开始加载72小时内的订单到内存中。。。")
 		startTime := time.Now().Local().AddDate(0, 0, -3).Format(util.Date_Full_Layout)
-		list := Mysql.SelectBySql("select id,order_code,order_money,user_id,create_time,remind_status,vip_type from dataexport_order where create_time>=? and product_type='VIP订阅' and order_status=0 and (remind_status<>2 or remind_status is null)", startTime)
+		list := Mysql.SelectBySql("select id,order_code,order_money,user_id,prepay_time,remind_status,vip_type from dataexport_order where prepay_time>=? and product_type='VIP订阅' and order_status=0 and (remind_status<>2 or remind_status is null)", startTime)
 		if list == nil {
 			log.Println("加载72小时内的订单到内存中失败")
 			return
@@ -211,18 +235,19 @@ func init() {
 		for _, v := range *list {
 			order_code, _ := v["order_code"].(string)
 			user_id, _ := v["user_id"].(string)
-			create_time, _ := v["create_time"].(string)
-			if order_code == "" || user_id == "" || create_time == "" {
+			prepay_time, _ := v["prepay_time"].(string)
+			if order_code == "" || user_id == "" || prepay_time == "" {
 				continue
 			}
-			createTime, err := time.ParseInLocation(util.Date_Full_Layout, create_time, time.Local)
+			prepayTime, err := time.ParseInLocation(util.Date_Full_Layout, prepay_time, time.Local)
 			if err != nil {
 				continue
 			}
 			orderId := util.IntAll(v["id"])
-			MsgRemind.Add(orderId, util.IntAll(v["order_money"]), util.IntAllDef(v["vip_type"], -1), util.IntAll(v["remind_status"]), order_code, user_id, createTime.Unix())
+			MsgRemind.Add(orderId, util.IntAll(v["order_money"]), util.IntAllDef(v["vip_type"], -1), util.IntAll(v["remind_status"]), order_code, user_id, prepayTime.Unix())
 		}
 		log.Println("加载72小时内的订单到内存中结束。。。", len(*list))
 	}()
 	MsgRemind.run()
+	MsgRemind.gc()
 }

+ 9 - 5
src/jfw/modules/weixin/src/config.json

@@ -8,11 +8,11 @@
     "weixinrpcport": "8083",
     "webrpcport": "127.0.0.1:8084",
     "jyop_webrpcport": "127.0.0.1:8012",
-    "webdomain": "http://web-jydev-wky.jianyu360.cn",
-    "appid": "wx79f2cc873dbea989",
-    "apptoken": "top2016top2016",
-    "appsecret": "fb3f77e9c6725811b5c39f6d58bd58a3",
-    "proxysess": "http://web-jydev-wky.jianyu360.cn/front/sess/%s",
+    "webdomain": "http://web-jydev-xzh.jianyu360.cn",
+    "appid": "wx41a95e706276804d",
+    "apptoken": "topnet2018topnet2018",
+    "appsecret": "1b385c7dd14274c5e0898b9b208580b7",
+    "proxysess": "http://web-jydev-xzh.jianyu360.cn/front/sess/%s",
     "followCompany": 10,
     "welcomemsg": "用剑鱼标讯,所有功能完全免费,\n和传统的会员制说再见!\n\n<a href='%s'>点击这里</a>设置关键词,或直接回复“订阅 关键词”,如“订阅 教学设备”,您将随时随地接收招标信息!\n\n剑鱼标讯,让投标无限可能!",
     "tpl_subscribe_push_id": "IY_RWWzMlwDK6hcd6RAzTec6qre8n5r8PNOOUM_hgk0",
@@ -55,6 +55,10 @@
         "project_success": "已为您添加关注项目 “%s”。<a href='%s'>点击此处查看该项目的最新信息。</a>",
         "project_repeat": "您已关注过此项目 “%s”。<a href='%s'>点击此处查看我关注的项目列表信息。</a>",
         "project_fail": "抱歉!无法添加项目“%s”,<a href='%s'>因为您关注的项目,达到了系统上限,您可以点击此处删除多余的项目,然后重新添加。</a>"
+    },
+	"vipSubscribeReply": {
+        "href":"/front/vipsubscribe/introducePage",
+        "content":"<a href='%s'>点击立即体验VIP订阅。</a>"
     },
     "company": {
         "company_success": "已为您添加关注企业 “%s”。<a href='%s'>点击此处查看该企业的最新信息。</a>",

+ 46 - 9
src/jfw/modules/weixin/src/wx/wx.go

@@ -319,8 +319,16 @@ func pcSetUserKeys(user map[string]interface{}, shareid, pccodepre string) (map[
 			}
 			result = "ok"
 		}
+		//pc端订阅页面 扫码回复vip连接也需要用此码
+		if pccodepre == "11" {
+			redis.Del("sso", "pc_subscribe_"+shareid)
+		}
 	} else {
 		subkey = ""
+		//如果vip订阅扫码
+		if pccodepre == "11" && util.ObjToString(redis.Get("sso", "pc_subscribe_reply_"+shareid)) == "1" {
+			result = "vipsubscribe##reply"
+		}
 	}
 	return user, result, fmt.Sprint(subkey)
 }
@@ -498,6 +506,9 @@ func saveUser(u *UserInfo, source, pre, RSource string) (bool, string, string) {
 				}
 				fg = true
 			}
+			if pcresult == "vipsubscribe##reply" {
+				fg = true
+			}
 			updateIsPush(util.ObjToString(tuser["s_m_openid"]), 1)
 		}
 	}
@@ -633,6 +644,12 @@ func Subscribe(w ResponseWriter, r *Request) {
 				fastSubscribeText := config.Sysconfig["fastSubscribe"].(map[string]interface{})
 				exists := fastSubscribeText["exists"].(string)
 				w.ReplyText(fmt.Sprintf(exists, subkey, fastSubscribeText["skill"].(string)))
+			} else if pcresult == "vipsubscribe##reply" { //关注
+				vipsubReply := config.Sysconfig["vipSubscribeReply"].(map[string]interface{})
+				time.AfterFunc(time.Second/2, func() {
+					w.PostText(fmt.Sprintf(fmt.Sprint(vipsubReply["content"]), config.Sysconfig["webdomain"].(string)+vipsubReply["href"].(string)))
+				})
+				isAutoRepl = true
 			} else {
 				if subkey != "" {
 					w.ReplyText(fmt.Sprintf(fmt.Sprint(pchints["key_fail"]), subkey, autoReplUrl))
@@ -924,9 +941,15 @@ func ScanHandler(w ResponseWriter, r *Request) {
 			if err != nil {
 				log.Println(err)
 			} else {
-				if b, _, _ := saveUser(user, r.EventKey, pccodepre, RSource); b {
+				if b, pcresult, _ := saveUser(user, r.EventKey, pccodepre, RSource); b {
 					url := fmt.Sprintf(config.Sysconfig["proxysess"].(string), se.EncodeString(openid+","+user.UnionId+","+strconv.Itoa(int(time.Now().Unix()))+",rssset"))
 					w.ReplyText(fmt.Sprintf(config.Sysconfig["welcomemsg"].(string), url))
+					if pcresult == "vipsubscribe##reply" { //新用户扫码
+						vipsubReply := config.Sysconfig["vipSubscribeReply"].(map[string]interface{})
+						time.AfterFunc(time.Second/2, func() {
+							w.PostText(fmt.Sprintf(fmt.Sprint(vipsubReply["content"]), config.Sysconfig["webdomain"].(string)+vipsubReply["href"].(string)))
+						})
+					}
 				}
 			}
 		} else {
@@ -964,15 +987,26 @@ func ScanHandler(w ResponseWriter, r *Request) {
 				if (*m)["i_vip_status"] != nil && util.IntAll((*m)["i_vip_status"]) > 0 {
 					shareid := util.ObjToString(r.EventKey)
 					subkey = util.ObjToString(redis.Get("sso", "pc_subscribe_"+shareid))
-					resNum := 0
-					resNum, subkey, _ = vipFastSubscribe(m, subkey, openid)
-					if resNum == -2 {
-						pcresult = "repeat"
-					} else if resNum == -3 {
-						pcresult = "fail"
-					} else if resNum == 1 {
-						pcresult = "ok"
+					if subkey != "" {
+						resNum := 0
+						resNum, subkey, _ = vipFastSubscribe(m, subkey, openid)
+						if resNum == -2 {
+							pcresult = "repeat"
+						} else if resNum == -3 {
+							pcresult = "fail"
+						} else if resNum == 1 {
+							pcresult = "ok"
+						}
+						//pc端订阅页面 扫码回复vip连接也需要用此码
+						if pccodepre == "11" && resNum != -3 {
+							redis.Del("sso", "pc_subscribe_"+shareid)
+						}
+					} else {
+						if util.ObjToString(redis.Get("sso", "pc_subscribe_reply_"+shareid)) == "1" {
+							pcresult = "vipsubscribe##reply"
+						}
 					}
+
 				} else {
 					pcUser, pcresult, subkey = pcSetUserKeys(*m, r.EventKey, pccodepre)
 					go tools.MQFW.Update("user", &map[string]interface{}{
@@ -996,6 +1030,9 @@ func ScanHandler(w ResponseWriter, r *Request) {
 					pchints := config.Sysconfig["pchints"].(map[string]interface{})
 					url := fmt.Sprintf(config.Sysconfig["proxysess"].(string), se.EncodeString(openid+","+user.UnionId+","+strconv.Itoa(int(time.Now().Unix()))+",rssset"))
 					w.ReplyText(fmt.Sprintf(fmt.Sprint(pchints["key_fail"]), subkey, url))
+				} else if pcresult == "vipsubscribe##reply" { //老用户扫码
+					vipsubReply := config.Sysconfig["vipSubscribeReply"].(map[string]interface{})
+					w.ReplyText(fmt.Sprintf(fmt.Sprint(vipsubReply["content"]), config.Sysconfig["webdomain"].(string)+vipsubReply["href"].(string)))
 				}
 			} else if pccodepre == "18" { //关注企业
 				company := redis.GetStr("sso", "pc_subscribe_"+r.EventKey) //企业名称

+ 471 - 222
src/web/staticres/css/subscribe.css

@@ -1,407 +1,656 @@
 /* banner图板块 */
-.tender-1{
+.tender-1 {
     width: 100%;
     height: 475px;
 }
-.tender-1 .imgauto{
+
+.tender-1 .imgauto {
     width: 100%;
     height: 100%;
     /* margin: 0 auto; */
 }
-.tender-1 .imgauto img{
+
+.tender-1 .imgauto img {
     width: 100%;
     z-index: 1;
 }
 
 /* 订阅模式选择板块 */
 
-.subscription{
+.subscription {
     width: 100%;
     height: 268px;
-    margin-top: 30px;
+    margin-top: -110px;
 }
-.subscription .sub-center{
+
+.subscription .sub-center {
     width: 840px;
     height: 268px;
     margin: 0 auto;
     display: flex;
+    justify-content: center;
 }
-.subscription .sub-center .sub-free{
-    width: 354px;
-    height: 214px;
-    padding: 27px;
+
+.subscription .sub-center .sub-free {
+    width: 402px;
+    height: 250px;
     background: url('/images/subscribe/free.png') no-repeat;
 }
-.subscription .sub-center .sub-free .free-title{
-    width: 100%;
+
+.subscription .sub-center .sub-free .free-title {
+    width: 402px;
     height: 26px;
-    margin-top: 28px;
+    margin-top: 57px;
     text-align: center;
-    font-size:20px;
-    font-family:Microsoft YaHei;
-    font-weight:400;
-    line-height:26px;
-    color:rgba(255,255,255,1);
-    opacity:1;
-}
-.subscription .sub-center .sub-free .free-btn{
-    width:180px;
-    height:46px;
-    background:rgba(44,183,202,1);
-    opacity:1;
-    border-radius:6px;
+    font-size: 20px;
+    font-family: Microsoft YaHei;
+    font-weight: 400;
+    line-height: 26px;
+    color: rgba(255, 255, 255, 1);
+    opacity: 1;
+}
+
+.subscription .sub-center .sub-free .free-btn {
+    width: 180px;
+    height: 46px;
+    background: rgba(44, 183, 202, 1);
+    opacity: 1;
+    border-radius: 6px;
     margin: 76px auto;
     display: block;
     text-align: center;
-    font-size:18px;
-    font-family:Microsoft YaHei;
-    font-weight:400;
-    line-height:46px;
-    color:rgba(255,255,255,1);
-    opacity:1;
-}
-.subscription .sub-center .sub-vip{
-    width: 354px;
-    height: 214px;
-    padding: 27px;
+    font-size: 18px;
+    font-family: Microsoft YaHei;
+    font-weight: 400;
+    line-height: 46px;
+    color: rgba(255, 255, 255, 1);
+    opacity: 1;
+}
+
+.subscription .sub-center .sub-vip {
+    width: 402px;
+    height: 250px;
     background: url('/images/subscribe/vip.png') no-repeat;
+    background-position-x: center;
+    /* margin-left: 54px; */
 }
 
-.subscription .sub-center .sub-vip .vip-logo{
-    width: 100%;
+.subscription .sub-center .sub-vip .vip-logo {
+    width: 402px;
     height: 38px;
-    margin-top: 22px;
+    margin-top: 57px;
     display: flex;
     justify-content: center;
     align-items: center;
 }
-.subscription .sub-center .sub-vip .vip-logo img{
+
+.subscription .sub-center .sub-vip .vip-logo img {
     width: 38px;
     height: 38px;
     margin-right: 10px;
 }
-.subscription .sub-center .sub-vip .vip-logo .vip-title{
-    font-size:20px;
-    font-family:Microsoft YaHei;
-    font-weight:400;
-    line-height:26px;
-    color:rgba(255,218,177,1);
-    opacity:1;
-}
-.subscription .sub-center .sub-vip .vip-btn{
-    width:180px;
-    height:46px;
-    background:rgba(52,53,90,1);
+
+.subscription .sub-center .sub-vip .vip-logo .vip-title {
+    font-size: 20px;
+    font-family: Microsoft YaHei;
+    font-weight: 400;
+    line-height: 26px;
+    color: rgba(255, 218, 177, 1);
+    opacity: 1;
+}
+
+.subscription .sub-center .sub-vip .vip-btn {
+    width: 180px;
+    height: 46px;
+    background: rgba(52, 53, 90, 1);
     margin: 69px auto;
-    opacity:1;
-    border-radius:6px;
+    opacity: 1;
+    border-radius: 6px;
     display: block;
     text-align: center;
-    font-size:18px;
-    font-family:Microsoft YaHei;
-    font-weight:400;
-    line-height:46px;
-    color:rgba(255,218,177,1);
+    font-size: 18px;
+    font-family: Microsoft YaHei;
+    font-weight: 400;
+    line-height: 46px;
+    color: rgba(255, 218, 177, 1);
 }
+
 /* 订阅模式对比板块 */
-.sub-contrast{
+.sub-contrast {
     width: 100%;
     height: 666px;
     margin-top: 79px;
 }
-.sub-contrast .contrast-header{
+
+.sub-contrast .contrast-header {
     width: 100%;
     height: 31px;
 }
-.sub-contrast .contrast-header .header-title{
+
+.sub-contrast .contrast-header .header-title {
     width: 331px;
     height: 31px;
     line-height: 31px;
     margin: 0 auto;
     background: url('/images/subscribe/line.png') no-repeat;
-    font-size:24px;
-    font-family:Microsoft YaHei;
-    font-weight:400;
-    color:rgba(29,29,29,1);
-    opacity:1;
+    font-size: 24px;
+    font-family: Microsoft YaHei;
+    font-weight: 400;
+    color: rgba(29, 29, 29, 1);
+    opacity: 1;
     text-align: center;
     background-position: center;
 }
-.sub-contrast .contrast-main{
+
+.sub-contrast .contrast-main {
     width: 100%;
     height: 422px;
     margin-top: 85px;
 }
-.sub-contrast .contrast-main .contrast-main-center{
+
+.sub-contrast .contrast-main .contrast-main-center {
     width: 960px;
     height: 422px;
     margin: 0 auto;
     display: flex;
-    border: 1px solid rgba(224,224,224,1);
+    /* border: 1px solid rgba(224,224,224,1); */
 }
+
 /* 功能/价格 */
 /* li+li表示选中除第一个li其他所有的li */
-.sub-contrast .contrast-main .contrast-main-center .center-left{
-    width: 201px;
+.sub-contrast .contrast-main .contrast-main-center .center-left {
+    width: 200px;
     height: 422px;
+
 }
-.sub-contrast .contrast-main .contrast-main-center .center-left>ul{
-    width: 201px;
+
+.sub-contrast .contrast-main .contrast-main-center .center-left > ul {
+    width: 200px;
     height: 422px;
     margin: 0;
 }
-.sub-contrast .contrast-main .contrast-main-center .center-left>ul li+li{
+
+.sub-contrast .contrast-main .contrast-main-center .center-left > ul .modify-left {
+    border-left: 1px solid rgba(224, 224, 224, 1);
+    border-top: 1px solid rgba(224, 224, 224, 1);
+    width: 100%;
+}
+
+.sub-contrast .contrast-main .contrast-main-center .center-left > ul li + li {
     width: 200px;
     height: 58px;
     text-align: center;
     line-height: 60px;
-    font-size:16px;
-    font-family:Microsoft YaHei;
-    font-weight:400;
-    color:rgba(29,29,29,1);
-    opacity:1;
-    border-bottom: 1px solid rgba(224,224,224,1);
-    border-right: 1px solid rgba(224,224,224,1);
+    font-size: 16px;
+    font-family: Microsoft YaHei;
+    font-weight: 400;
+    color: rgba(29, 29, 29, 1);
+    opacity: 1;
+    border-left: 1px solid rgba(224, 224, 224, 1);
+    border-bottom: 1px solid rgba(224, 224, 224, 1);
+    border-right: 1px solid rgba(224, 224, 224, 1);
 }
+
 /* 免费版 */
-.sub-contrast .contrast-main .contrast-main-center .center-center{
+.sub-contrast .contrast-main .contrast-main-center .center-center {
     width: 259px;
     height: 422px;
-    transition:all 0.5s;
+    transition: all 0.5s;
 }
-.sub-contrast .contrast-main .contrast-main-center .center-center>ul{
+
+.sub-contrast .contrast-main .contrast-main-center .center-center > ul {
     width: 259px;
-    transition:all 0.5s;
+    transition: all 0.5s;
     height: 422px;
     margin: 0;
 }
 
-.sub-contrast .contrast-main .contrast-main-center .center-center>ul li+li{
-    transition:all 0.5s;
-    width: 258px;
+.sub-contrast .contrast-main .contrast-main-center .center-center > ul li + li {
+    transition: all 0.5s;
+    width: 259px;
     height: 58px;
     text-align: center;
     line-height: 60px;
-    font-size:16px;
-    font-family:Microsoft YaHei;
-    font-weight:400;
-    color:rgba(29,29,29,1);
-    opacity:1;
-    border-bottom: 1px solid rgba(224,224,224,1);
-    border-right: 1px solid rgba(224,224,224,1);
-}
-.sub-contrast .contrast-main .contrast-main-center .center-center>ul li:nth-child(7){
+    font-size: 16px;
+    font-family: Microsoft YaHei;
+    font-weight: 400;
+    color: rgba(29, 29, 29, 1);
+    opacity: 1;
+    border-bottom: 1px solid rgba(224, 224, 224, 1);
+    border-right: 1px solid rgba(224, 224, 224, 1);
+}
+
+.sub-contrast .contrast-main .contrast-main-center .center-center > ul li:nth-child(7) {
     background-color: rgba(246, 246, 246, 1);
-    border-right: 1px solid rgba(224,224,224,1) ;
+    border-right: 1px solid rgba(224, 224, 224, 1);
     display: flex;
-    transition:all 0.5s;
+    transition: all 0.5s;
     justify-content: center;
     align-items: center;
 }
-.sub-contrast .contrast-main .contrast-main-center .center-center ul li:nth-child(7) .btn-free{
+
+.sub-contrast .contrast-main .contrast-main-center .center-center ul li:nth-child(7) .btn-free {
     display: block;
     cursor: pointer;
-    transition:all 0.5s;
-    width:90px;
-    height:30px;
-    background:rgba(246,246,246,1);
-    opacity:1;
-    border-radius:4px;
-    font-size:16px;
-    font-family:Microsoft YaHei;
-    font-weight:400;
-    line-height:26px;
-    color:rgba(104,104,104,1);
+    transition: all 0.5s;
+    width: 90px;
+    height: 30px;
+    background: rgba(246, 246, 246, 1);
+    opacity: 1;
+    border-radius: 4px;
+    font-size: 16px;
+    font-family: Microsoft YaHei;
+    font-weight: 400;
+    line-height: 26px;
+    color: rgba(104, 104, 104, 1);
 }
+
 /* 免费版滑过特效 */
-.sub-contrast .contrast-main .contrast-main-center .center-center:hover ul{
-    height: 463px;
+.sub-contrast .contrast-main .contrast-main-center .center-center:hover ul {
+    height: 460px;
     /* transform: scaleY(1.1); */
     transition: 0.5s;
-    box-shadow: 0px 0px 20px rgba(0,0,0,0.2);
+    box-shadow: 0px 0px 20px rgba(0, 0, 0, 0.2);
     margin-top: -22px;
 }
-.sub-contrast .contrast-main .contrast-main-center .center-center:hover ul .modify-center{
+
+.sub-contrast .contrast-main .contrast-main-center .center-center:hover ul .modify-center {
     height: 90px;
     line-height: 90px;
     transition: 0.5s;
 }
-.sub-contrast .contrast-main .contrast-main-center .center-center:hover ul li:nth-child(7){
+
+.sub-contrast .contrast-main .contrast-main-center .center-center:hover ul li:nth-child(7) {
     height: 80px;
-    width: 258px;
+    width: 259px;
     transition: 0.5s;
     line-height: 80px;
     display: flex;
     justify-content: center;
     align-items: center;
 }
-.sub-contrast .contrast-main .contrast-main-center .center-center:hover ul li:nth-child(7) .btn-free{
+
+.sub-contrast .contrast-main .contrast-main-center .center-center:hover ul li:nth-child(7) .btn-free {
     transition: 0.5s;
-    background:rgba(44,183,202,1);
+    background: rgba(44, 183, 202, 1);
     color: white;
 }
+
 /* VIP订阅专属服务 */
-.sub-contrast .contrast-main .contrast-main-center .center-right{
+.sub-contrast .contrast-main .contrast-main-center .center-right {
     width: 500px;
     height: 422px;
-    transition:all 0.5s;
+    transition: all 0.5s;
 }
-.sub-contrast .contrast-main .contrast-main-center .center-right>ul{
+
+.sub-contrast .contrast-main .contrast-main-center .center-right > ul {
     width: 500px;
     height: 422px;
     margin: 0;
-    transition:all 0.5s;
+    transition: all 0.5s;
 }
-.sub-contrast .contrast-main .contrast-main-center .center-right>ul li+li{
+
+.sub-contrast .contrast-main .contrast-main-center .center-right > ul li + li {
     width: 500px;
     height: 58px;
     text-align: center;
-    transition:all 0.5s;
+    transition: all 0.5s;
     line-height: 60px;
-    font-size:16px;
-    font-family:Microsoft YaHei;
-    font-weight:400;
-    color:rgba(29,29,29,1);
-    opacity:1;
-    border-bottom: 1px solid rgba(224,224,224,1);
-}
-.sub-contrast .contrast-main .contrast-main-center .center-right>ul li:nth-child(7){
+    font-size: 16px;
+    font-family: Microsoft YaHei;
+    font-weight: 400;
+    color: rgba(29, 29, 29, 1);
+    opacity: 1;
+    border-bottom: 1px solid rgba(224, 224, 224, 1);
+}
+
+.sub-contrast .contrast-main .contrast-main-center .center-right > ul li:nth-child(7) {
     background-color: #FBF2EA;
     display: flex;
     justify-content: center;
     align-items: center;
-    transition:all 0.5s;
-}
-.sub-contrast .contrast-main .contrast-main-center .center-right>ul li:nth-child(7) .On-trial{
-    width:90px;
-    height:30px;
-    border:1px solid rgba(207,173,137,1);
-    transition:all 0.5s;
-    opacity:1;
-    border-radius:4px;
+    transition: all 0.5s;
+}
+
+.sub-contrast .contrast-main .contrast-main-center .center-right > ul li:nth-child(7) .On-trial {
+    width: 90px;
+    height: 30px;
+    border: 1px solid rgba(207, 173, 137, 1);
+    transition: all 0.5s;
+    opacity: 1;
+    border-radius: 4px;
     display: block;
     text-align: center;
     line-height: 30px;
-    font-size:14px;
-    font-family:MicrosoftYaHei;
-    color:rgba(207,173,137,1);
+    font-size: 14px;
+    font-family: MicrosoftYaHei;
+    color: rgba(207, 173, 137, 1);
     margin-left: 16px;
 }
+
 /* VIP订阅滑过特效 */
-.sub-contrast .contrast-main .contrast-main-center .center-right:hover ul{
-    height: 463px;
+.sub-contrast .contrast-main .contrast-main-center .center-right:hover ul {
+    height: 460px;
     margin-top: -22px;
-    box-shadow: 0px 0px 20px rgba(0,0,0,0.2);
-    transition:all 0.5s;
+    box-shadow: 0px 0px 20px rgba(0, 0, 0, 0.2);
+    transition: all 0.5s;
 }
-.sub-contrast .contrast-main .contrast-main-center .center-right:hover ul .modify-right{
+
+.sub-contrast .contrast-main .contrast-main-center .center-right:hover ul .modify-right {
     height: 90px;
     line-height: 90px;
-    transition:all 0.5s;
+    transition: all 0.5s;
 }
-.sub-contrast .contrast-main .contrast-main-center .center-right:hover ul li:nth-child(7){
-    height:80px;
+
+.sub-contrast .contrast-main .contrast-main-center .center-right:hover ul li:nth-child(7) {
+    height: 80px;
     line-height: 80px;
-    transition:all 0.5s;
-}
-.sub-contrast .contrast-main .contrast-main-center .center-right:hover ul li:nth-child(7) .On-trial{
-    background:#34355A;
-    font-size:14px;
-    font-family:MicrosoftYaHei;
-    line-height:30px;
-    color:rgba(255,218,177,1);
-    transition:all 0.5s;
-    opacity:1;
+    transition: all 0.5s;
+}
+
+.sub-contrast .contrast-main .contrast-main-center .center-right:hover ul li:nth-child(7) .On-trial {
+    background: #34355A;
+    font-size: 14px;
+    font-family: MicrosoftYaHei;
+    line-height: 30px;
+    color: rgba(255, 218, 177, 1);
+    transition: all 0.5s;
+    opacity: 1;
     text-decoration: none;
 }
-.sub-contrast .contrast-main .contrast-main-center ul .top-title{
+
+.sub-contrast .contrast-main .contrast-main-center ul .top-title {
     height: 68px;
     text-align: center;
-    transition:all 0.5s;
+    transition: all 0.5s;
     line-height: 68px;
-    font-size:20px;
-    font-family:Microsoft YaHei;
-    font-weight:400;
-    color:rgba(29,29,29,1);
-    opacity:1;
-    border-bottom: 1px solid rgba(224,224,224,1);
-    border-right: 1px solid rgba(224,224,224,1);
+    font-size: 20px;
+    font-family: Microsoft YaHei;
+    font-weight: 400;
+    color: rgba(29, 29, 29, 1);
+    opacity: 1;
+    /* border-left: 1px solid rgba(224,224,224,1); */
+    border-bottom: 1px solid rgba(224, 224, 224, 1);
+    /* border-right: 1px solid rgba(224,224,224,1); */
 }
+
 /* 选中免费版 */
-.sub-contrast .contrast-main .contrast-main-center ul .modify-center{
+.sub-contrast .contrast-main .contrast-main-center ul .modify-center {
     background: rgba(238, 238, 238, 1);
+    width: 100%;
 }
+
 /* 选中VIP订阅专属服务 */
-.sub-contrast .contrast-main .contrast-main-center ul .modify-right{
-    background:rgba(52,53,90,1);
-    color:rgba(255,218,177,1);
+.sub-contrast .contrast-main .contrast-main-center ul .modify-right {
+    background: rgba(52, 53, 90, 1);
+    color: rgba(255, 218, 177, 1);
     position: relative;
     border-right: 0;
+    width: 100%;
 }
-.sub-contrast .contrast-main .contrast-main-center ul .modify-right img{
-    background:rgba(52,53,90,1);
-    color:rgba(255,218,177,1);
+
+.sub-contrast .contrast-main .contrast-main-center ul .modify-right img {
+    background: rgba(52, 53, 90, 1);
+    color: rgba(255, 218, 177, 1);
     position: absolute;
     right: 0;
     bottom: 0;
     width: 174px;
 }
+
 /* 选中关键词设置颜色 */
-.sub-contrast .contrast-main .contrast-main-center ul li>span{
+.sub-contrast .contrast-main .contrast-main-center ul li > span {
     color: #CFAD89;
 }
 
 /* VIP弹窗 */
+.modal-dialog-subvip {
+    width: 335px !important;
+    height: 390px;
+    margin-top: 40px !important;
+    margin: 30px auto;
+}
 
-.hide{
-    display:none;
-}
-.modal{
-    position:fixed;
-    left:50%;
-    top:50%;
-    width:335px;
-    height:395px;
-    margin-left:-200px;
-    margin-top:-250px;
-    z-index:10;
-    background-color:white;
-}
-.modal .modal-dialog{
+.modal-content {
     width: 335px;
-    height: 395px;
+    height: 400px;
     position: relative;
 }
-.modal .modal-dialog img{
-    margin-top: -48px;
+
+.modal-content > img {
+    margin: -46px 0 0 -1px;
+    /* height: 447px; */
 }
-.modal .modal-dialog .vip-code{
+
+.modal-content .vip-code {
     position: absolute;
     width: 170px;
     height: 197px;
     left: 30%;
-    bottom: 0%;
-}
-.modal .modal-dialog .vip-code .vip-text{
-    width:170px;
-    height:21px;
-    font-size:16px;
-    font-family:MicrosoftYaHei;
-    line-height:24px;
-    color:rgba(59,33,5,1);
-    opacity:1;
+    bottom: 10%;
+}
+
+.modal-content .vip-code .vip-text {
+    width: 170px;
+    height: 21px;
+    font-size: 16px;
+    font-family: MicrosoftYaHei;
+    line-height: 24px;
+    color: rgba(59, 33, 5, 1);
+    opacity: 1;
     margin: 20px 0 0 -15px;
 }
-.shade{
-    position:fixed;
-    left:0;
-    right:0;
-    top:0;
-    bottom:0;
-    opacity:0.6;
-    background-color:black;
-    z-index:9;
+
+.modal-open {
+    overflow: auto !important;
+    padding-right: 0 !important;
+}
+
+/*扫码框样式*/
+.jy_province li > font > a {
+    font-size: 14px !important;
+}
+
+#jydialog {
+    position: fixed;
+    background-color: rgba(0, 0, 0, 0.7);
+    top: 50%;
+    color: #fff;
+    z-index: 999;
+    border-radius: 5px;
+    text-align: center;
+    padding: 20px;
+    left: 50%;
+    margin-top: -50px;
+    margin-left: -145px;
+}
+
+.s-com-1 {
+    min-width: 1200px;
+    margin: 0 auto;
+    position: relative;
+    -webkit-font-smoothing: antialiased;
+    width: 100%;
+    overflow: hidden;
+    height: 600px;
+}
+
+.s-com-1-con {
+    width: 1920px;
+    overflow: hidden;
+    left: 50%;
+    margin-left: -960px !important;
+    position: absolute;
 }
-.vip-text{
-    text-align:center;
+
+.j-text {
+    width: 1200px;
+    height: 250px;
+    position: absolute;
+    left: 50%;
+    top: 50%;
+    margin-top: -125px;
+    text-align: center;
+    color: #fff;
+    margin-left: -600;
+}
+
+.j-text-1 {
+    font-family: 微软雅黑;
+    font-weight: bold;
+    font-size: 36px;
 }
+
+.j-text-1 span {
+    color: #ffcc00;
+}
+
+.j-text-2 {
+    font-family: "Microsoft YaHei";
+    font-size: 34px;
+    margin: 8px auto 36px;
+    font-weight: bold;
+}
+
+.j-text-3 {
+    font-family: 微软雅黑;
+    font-size: 18px;
+    line-height: 32px;
+    margin-top: 32px;
+}
+
+.j-text-4 #scfree {
+    font-family: 微软雅黑;
+    font-size: 18px;
+    color: #2cb7ca;
+    background-color: rgba(255, 255, 255, 1);
+    border: 1px solid #fff;
+    margin-top: 50px;
+    padding: 10px 43px;
+    border-radius: 6px;
+    font-weight: bold;
+}
+
+.j-com-2-1 {
+    min-width: 1200px;
+    margin: 0 auto;
+    -webkit-font-smoothing: antialiased;
+    width: 100%;
+    overflow: hidden;
+    height: 760px;
+}
+
+.inner-left {
+    width: 1200px;
+    margin: auto;
+    left: 42%;
+    height: 760px;
+    margin-left: -600px
+}
+
+.divnext {
+    position: absolute;
+    left: 1150px;
+    top: 587px;
+    width: 120px;
+    height: 120px;
+    z-index: 9999;
+    border-radius: 60px;
+    cursor: pointer;
+}
+
+.divprev {
+    position: absolute;
+    left: 1150px;
+    top: 36px;
+    width: 120px;
+    height: 120px;
+    z-index: 9999;
+    border-radius: 60px;
+    cursor: pointer;
+}
+
+/*j-wx-code Start*/
+.j-wx-code {
+    width: 335px;
+    height: 355px;
+    background-color: #fff;
+    -webkit-border-radius: 6px;
+    -moz-border-radius: 6px;
+    border-radius: 6px;
+    position: relative;
+    /*margin: 100px auto;*/
+}
+
+.j-wx-code > .code-close {
+    width: 40px;
+    height: 40px;
+    position: absolute;
+    right: -20px;
+    top: -20px;
+    cursor: pointer;
+    -webkit-transition: all 1s;
+    -o-transition: all 1s;
+    -moz-transition: all 1s;
+    transition: all 1s;
+}
+
+.j-wx-code > .code-close:hover {
+    -webkit-transform: scale(1.2);
+    -moz-transform: scale(1.2);
+    -ms-transform: scale(1.2);
+    -o-transform: scale(1.2);
+    transform: scale(1.2);
+}
+
+.j-wx-code > .code-title {
+    height: 82px;
+    background: url(/images/j-wx-code-title.png) center center no-repeat;
+    -webkit-animation: moveYun 15s infinite linear both;
+    -moz-animation: moveYun 15s infinite linear both;
+    -o-animation: moveYun 15s infinite linear both;
+    animation: moveYun 15s infinite linear both;
+}
+
+.j-wx-code > .code-wxm {
+    text-align: center;
+    margin-bottom: -6px;
+    margin-top: -16px;
+
+}
+
+.j-wx-code > .code-wxm > img {
+    width: 200px;
+    height: 200px;
+    margin-top: -5px;
+}
+
+.j-wx-code > .code-text {
+    font: 16px "microsoft yahei";
+    text-align: center;
+    color: #252627;
+}
+
+.j-wx-code > .code-bottom {
+    width: 470px;
+    height: 211px;
+    position: absolute;
+    bottom: -113px;
+    left: -73px;
+    background: url(/images/j-wx-code-bottom.png) 0 0 no-repeat;
+}
+
+.j-wx-code > .code-bottom > img {
+    position: absolute;
+    left: 280px;
+    top: 88px;
+    -webkit-animation: codeWxMove 10s linear both;
+    -moz-animation: codeWxMove 10s linear both;
+    -o-animation: codeWxMove 10s linear both;
+    animation: codeWxMove 10s linear both;
+    -webkit-animation-fill-mode: forwards;
+    -moz-animation-fill-mode: forwards;
+    -o-animation-fill-mode: forwards;
+    animation-fill-mode: forwards
+}
+

+ 3 - 1
src/web/staticres/js/login.js

@@ -208,6 +208,7 @@ var getNewShareId = function(num){
 					$("#dyym-1 img").attr("src","/front/share/"+kopshareid);
 					$("#dyym-2").attr("src","/front/share/"+pageshareid);
 					$(".secondleft img").attr("src","/front/share/"+pageshareid);
+					$("#vipCode").attr("src","/front/share/"+kopshareid);
 					break;
 				case "12"://搜索列表页
 					$("#layerImg").attr("src","/front/share/"+pageshareid);
@@ -369,7 +370,8 @@ var processpage = function(shareid,num){
 //			}
 			break;
 		case "11"://11订阅页面
-			$("#myModal-01").click();
+			//$("#myModal-01").click();
+			$(".modal").click();
 			break;
 		case "12"://12搜索列表
 			var ful = $("#myModal").attr("aria-hidden");

+ 59 - 24
src/web/staticres/vipsubscribe/css/choose_area.css

@@ -63,13 +63,11 @@
 }
 
 .tips_btn {
-    display: flex;
-    flex-direction: column;
-    align-items: center;
-    justify-content: space-between;
-    position: fixed;
-    width: 100%;
-    bottom: 0;
+  display: flex;
+  position: relative;
+  flex-direction: column;
+  align-items: center;
+  justify-content: space-between;
 }
 
 .tips_btn .tips_discount {
@@ -111,7 +109,6 @@
   line-height: .94rem;
   color: #fff;
   font-size: .34rem;
-  background-color: #fff;
 }
 
 .tips_btn .btns .save-btn,
@@ -382,6 +379,38 @@
   margin: 0;
 }
 
+.jymobile-tab-triangle {
+  position: relative;
+}
+
+.jymobile-tab-triangle:after {
+  content: '';
+  position: absolute;
+  top: 50%;
+  right: 0;
+  width: 0;
+  height: 0;
+  font-size: 0;
+  line-height: 0;
+  border-style: solid;
+  border-width: .1rem;
+  border-color: #aaa transparent transparent transparent;
+  transform: translate(140%, -30%);
+}
+
+.jymobile-tab-triangle.active:after {
+  border-color: transparent transparent #2cb7ca transparent;
+  transform: translate(140%, -70%);
+}
+
+.jymobile-tab-triangle.current {
+  color: #2cb7ca;
+}
+
+.jymobile-tab-triangle.current:after {
+  border-color: #2cb7ca transparent transparent transparent;
+}
+
 #choose_area {
   display: flex;
   justify-content: space-between;
@@ -395,36 +424,29 @@
   overflow-y: scroll;
 }
 
-#choose_area .optional_count {
+#choose_area .optional_count, #choose_area .all_area {
   background: #fff;
   height: .88rem;
   line-height: .88rem;
   padding: 0 .3rem;
   font-size: .3rem;
   color: #1d1d1d;
-  position: fixed;
-  top: 0;
-  width: 100%;
-  z-index:999;
 }
 
-#choose_area .optional_count em {
+#choose_area .optional_count em, #choose_area .all_area em {
   color: #2cb7ca;
 }
 
 #choose_area .result {
-  position: fixed;
+  position: relative;
   padding: .2rem .3rem;
   font-size: .26rem;
   text-align: justify;
-  width:100%;
-  background:rgba(245,244,249,1);
-  z-index:999;
 }
 
 #choose_area .result .result_text {
   position: relative;
-  min-height: 0.38rem;
+  min-height: 19px;
 }
 
 #choose_area .result .line_two {
@@ -462,7 +484,7 @@
 }
 
 #choose_area .select-area-box {
-  padding-bottom: 1.44rem;
+  padding-bottom: .94rem;
 }
 
 #choose_area .select-area-box .tab {
@@ -498,18 +520,30 @@
   background-size: 100% 100%;
 }
 
-#choose_area .select-area-box .tab .province .checkbox[disabled] {
+#choose_area .select-area-box .tab .province .checkbox:checked[disabled] {
   border: 0;
   background: url(/vipsubscribe/image/active_disabled.png) no-repeat center center;
   background-size: 100% 100%;
 }
 
-#choose_area .select-area-box .tab .province .checkbox.half:checked {
+#choose_area .select-area-box .tab .province .checkbox.half {
   border: 0 !important;
   background: url(/vipsubscribe/image/banxuan.png) no-repeat center center !important;
   background-size: cover !important;
 }
 
+#choose_area .select-area-box .tab .province .checkbox.half[disabled] {
+  border: 0 !important;
+  background: url(/vipsubscribe/image/banxuan.png) no-repeat center center;
+  background-size: cover !important;
+}
+
+#choose_area .select-area-box .tab .optional {
+  color: #2CB7CA;
+  font-size: 0.28rem;
+  margin-left: -2.8rem;
+}
+
 #choose_area .select-area-box label::after {
   font-size: 14px;
   float: right;
@@ -537,10 +571,10 @@
   color: #fff;
 }
 
-/*#choose_area .select-area-box .tab_content .active[disabled] {
+#choose_area .select-area-box .tab_content .active[disabled] {
   background: #BFBFC3;
   color: #fff;
-}*/
+}
 
 #choose_area .select-area-box .tab_content .city[disabled] {
   background: #BFBFC3;
@@ -571,5 +605,6 @@
 }
 
 #choose_area .slide a {
+  width: 100%;
   margin-bottom: .1rem;
 }

BIN
src/web/staticres/vipsubscribe/image/banxuan_disabled.png


+ 719 - 0
src/web/staticres/vipsubscribe/js/updateArea.js

@@ -0,0 +1,719 @@
+$(function () {
+    // 后端数据结构
+//  var areaData = {
+//      'data': {
+//          // 选择的数量
+//          'area': {
+//              '北京': [],
+//              '河南': [
+//                  '洛阳市',
+//                  '驻马店市',
+//                  '周口市',
+//                  '郑州市'
+//              ],
+//              '湖南':['长沙市'],
+//              '澳门': [],
+//              '甘肃': []
+//          },
+//          'buyset': {
+//              // 购买的全省的数量(不带市)
+//              'areacount': 7,
+//              'buyerclasscount': 11,
+//              // 购买的城市
+//              'citys': {
+//                  '河南': 4,
+//                  '湖南': 3,
+//                  '吉林': 2
+//              }
+//          }
+//      },
+//      'errMsg': '',
+//      'success': true
+//  };
+    var areaData = {
+        'data': {
+            // 选择的数量
+            'area': {},
+            'buyset': {
+                // 购买的全省的数量(不带市)
+                'areacount': 7,
+                'buyerclasscount': 11,
+                // 购买的城市
+                'citys': {}
+            }
+        },
+        'errMsg': '',
+        'success': true
+    };
+    
+
+    // 已经购买过的城市数量
+    let alreadyBuy = {
+        province: {
+            totalCount: 0,
+            selectedCount: 0
+        },
+        city: {
+            totalCount: 0,
+            selectedCount: 0
+        }
+    }
+    // 新增城市数量(排除修改的数量)
+    let newlyAdded = {
+        province: 0,
+        city: 0
+    }
+	
+    // ----------------- 以下定义功能函数 ----------------------------
+    function createMoreCity(arr) {
+        var tempHtml = arr.map(function (v) {
+            return '<button class="city">' + v.name + '</button>'
+        }).join('')
+        return tempHtml
+    }
+
+    // 新增求值 ---- 统计数量,不做视图操作
+    function getResult(callback) {
+        if (areaData.data.buyset.areacount === -1) {
+            $('.result_text.add_new .added-info').hide()
+            return
+        }
+        // 升级新增清空
+        $('.result_text.add_new .added-info').text('')
+
+        let isWholeSelected = $('.tab.whole input').is(':checked')
+        let isWholeDisabled = $('.tab.whole input').prop('disabled')
+        
+        // 已购买省份改变的数量
+        let dBuySetProvinceCount = 0
+        // 已购买省份改变的数量
+        let dAddedProvinceCount = 0
+        
+        // 已购买城市改变的数量
+        let dBuySetCityCount = 0
+        // 新增城市的数量
+        let dAddedCityCount = 0
+        $('.area-list li:not(.index)').each(function(i, dom){
+            if ($(dom).children('.tab').hasClass('whole')) return true
+            // 统计非全国的数量
+            // 没有'data-buy-city-count'属性的 $(dom).attr('data-buy-city-count') 为undefined
+            if ($(dom).attr('data-buy-city-count')) {
+                /********  此处判断的是已购买的城市下的  ********************/
+                // 获取购买城市的数量
+                let buyCount = $(dom).attr('data-buy-city-count') - 0   // 隐式转换成Number
+                // 获取城市不可点击的数量
+                let alreadySelectedCount = $(dom).find('button[disabled]').length
+                // 选择城市的数量(包括不可点击的)
+                let hasActiveCount = $(dom).find('button.active').length
+
+                if (hasActiveCount > buyCount) {
+                    dBuySetCityCount += buyCount
+                    dAddedCityCount += (hasActiveCount - buyCount)
+                } else {
+                    // 操作已购买的数量
+                    dBuySetCityCount += hasActiveCount
+                }
+            } else {
+                // 是不是直辖市或自治区,在有data-buy-count没必要判断
+                let hasCities = $(dom).find('.tab').hasClass('municipality')
+                // 是否购买过该省份(还需要判断该省份下面的城市是否全部disabled --- 同时满足才算购买过全省)
+                let provinceInput = $(dom).find('input')
+                // 循环着的当前的省份是否可选 和 是否被选中
+                let isBoughtProvince = provinceInput.prop('disabled')
+                let isChecked = provinceInput.is(':checked')
+
+                // 可得到已经购买的省份的数量(循环完成后可得到,循环过程中的值可能不全)
+
+                // 判断是否为购买过的城市
+                if (isBoughtProvince) {
+                    // 将已购买(选中但不能单击的)城市选中
+                    if (isChecked) {
+                        dBuySetProvinceCount ++
+                    }
+                } else {
+                    // 判断是否是直辖市或自治区(省份下面没有城市的和有城市的分开计算)
+                    if (hasCities) {
+                        // 直辖市、自治区 -----直接进行省份的操作
+                        // 并且没有购买过该省的,并且选中的
+                        if (isChecked) {
+                            dAddedProvinceCount ++
+                        }
+                    } else {
+                        // 带有市的省份城市(该省份下以前没有购买过任何城市)
+                        // 两种情况:1. 全选    2. 不全选
+                        let allCityLength = $(dom).find('button').length
+                        let otherTotalAddCount = $(dom).find('button.active').length
+
+                        if (allCityLength === otherTotalAddCount && isChecked) {
+                            // 选中了省份下的所有城市
+                            dAddedProvinceCount ++
+                        } else {
+                            // 对城市做新增操作
+                            dAddedCityCount += otherTotalAddCount
+                        }
+                    }
+                }
+            }
+        })
+
+        // 循环完成判断已经选择的省份数量 是否 大于购买过的数量
+        if (dBuySetProvinceCount + dAddedProvinceCount > alreadyBuy.province.totalCount) {
+            // 如果已选择的数量和新增的数量大于已购买过的数量,说明我有购买新的城市
+            dAddedProvinceCount -= (alreadyBuy.province.totalCount - dBuySetProvinceCount)
+            dBuySetProvinceCount = alreadyBuy.province.totalCount
+        } else {
+            dBuySetProvinceCount += dAddedProvinceCount
+            dAddedProvinceCount = 0
+        }
+
+        // 已购买城市下选项改变,状态更新
+        alreadyBuy.city.selectedCount = dBuySetCityCount
+        newlyAdded.city = dAddedCityCount
+
+        alreadyBuy.province.selectedCount = dBuySetProvinceCount
+        newlyAdded.province = dAddedProvinceCount
+
+        callback && callback()
+
+        setDataInResult()
+
+        // 全国被选中了
+        if (isWholeSelected && !isWholeDisabled) {
+            $('.result_text.add_new .added-info').text('全国')
+            $('.result_text.add_new').show()
+            isLockedTipButtons(false)
+        }
+    }
+
+    function setDataInResult() {
+        let buySetInfo = {
+            p: `省级区域${alreadyBuy.province.selectedCount}/${alreadyBuy.province.totalCount}、`,
+            c: `地市${alreadyBuy.city.selectedCount}/${alreadyBuy.city.totalCount}`
+        }
+        let addedInfo = {
+            p: `省级区域 ${newlyAdded.province}、`,
+            c: `地市 ${newlyAdded.city}`
+        }
+
+        // 修改数量并进行重新赋值
+        $('.result_text.already .buy-set-info').text(buySetInfo.p + buySetInfo.c)
+        // 升级新增赋值
+        $('.result_text.add_new .added-info').text(addedInfo.p + addedInfo.c)
+
+        if (newlyAdded.province !== 0 || newlyAdded.city !== 0) {
+            $('.result_text.add_new').show()
+            isLockedTipButtons(false)
+        } else {
+            $('.result_text.add_new').hide()
+            isLockedTipButtons(true)
+        }
+    }
+
+    // 求需要M的数量
+    function getResultWithMCount() {
+        let added = {
+            country: 0,
+            province: 0,
+            city: {
+                // '河南': 1,
+                // '吉林': 1
+            }
+        }
+        // 购买过的省份数量
+        let buySetProvinceCount = $('.area-list').attr('data-buy-province-count') - 0  // 隐式转换成Number
+        
+        $('.area-list li:not(.index)').each(function(i, dom) {
+            if ($(dom).children('.tab').hasClass('whole')) {
+                // 判断是否被选中
+                if ($(dom).find('input.other').is(':checked')) {
+                    added.country = -1
+                    added.province = 0
+                    added.city = {}
+                    return false
+                }
+            } else {
+                added.country = 0
+                let pName = $(dom).find('.province').text().replace(/\s+ | [\r\n]/g, '')
+                // 获取当前dom下有几个按钮有active样式
+                let activeButtonLength = $(dom).find('button.active').length
+
+                // 判断该省是否有购买过的城市
+                if ($(dom).attr('data-buy-city-count')) {
+                    let buyCityCount = $(dom).attr('data-buy-city-count') - 0
+                    let aCityCount = activeButtonLength - buyCityCount
+                    if (aCityCount > 0) {
+                        added.city[pName] = aCityCount
+                    } else {
+                        // 选不到购买的个数
+                    }
+                } else {
+                    // 判断是否是直辖市
+                    let isMunicipality = $(dom).find('.tab').hasClass('municipality')
+                    let allCitylength = $(dom).find('button').length
+
+                    if (isMunicipality) {
+                        if ($(dom).find('input').is(':checked')) {
+                            added.province ++
+                        }
+                    } else {
+                        if (activeButtonLength === allCitylength) {
+                            added.province ++
+                        } else {
+                            if (activeButtonLength !== 0) added.city[pName] = activeButtonLength
+                        }
+                    }
+                }
+            }
+        })
+
+        // 循环完成判断计算省份
+        let aProvinceCount = added.province - buySetProvinceCount
+        if (aProvinceCount > 0) {
+            added.province = aProvinceCount
+        } else {
+            added.province = 0
+        }
+        return added
+    }
+
+    // 点亮的城市数量详情(需要省和城市名称)
+    function getActiveCityDetail(state = '') {
+        let isWholeCountry = $('.tab.whole input').is(':checked')
+        if (isWholeCountry) {
+            // 选择全国
+            let str = $('.area-list li .tab.whole .province').text().replace(/\s+ | [\r\n]/g, '')
+            let obj = {}
+            obj[str] = []
+            return obj
+        } else {
+            let arr = []
+            $('.area-list li:not(.index)').each(function(i, dom) {
+                if ($(dom).children('.tab').hasClass('whole')) return
+                let isMunicipality = $(dom).find('.tab').hasClass('municipality')
+                let pName = $(dom).find('.province').text().replace(/\s+ | [\r\n]/g, '')
+                let selectedObj = {
+                    name: pName,
+                    children: []
+                }
+                
+                // 是否是直辖市或自治区
+                if (isMunicipality) {
+                    if ($(dom).find('input:not([disabled])').is(':checked')) {
+                        arr.push(selectedObj)
+                    }
+                } else {
+                    let allCitylength = $(dom).find('button').length
+
+                    if (state === 'disabled') {
+                        // 判断是否全省被选中
+                        if ($(dom).find('button.active').length === allCitylength) {
+                            // 判断省下有没有不可点击的按钮
+                            if ($(dom).attr('data-buy-city-count')) {
+                                $(dom).find('button.active').each(function(c, dom) {
+                                    let cName = $(dom).text().replace(/\s+ | [\r\n]/g, '')
+                                    selectedObj.children.push(cName)
+                                })
+                                if (selectedObj.children.length) {
+                                    arr.push(selectedObj)
+                                }
+                            } else {
+                                arr.push(selectedObj)
+                            }
+                        } else {
+                            $(dom).find('button.active').each(function(c, dom) {
+                                let cName = $(dom).text().replace(/\s+ | [\r\n]/g, '')
+                                selectedObj.children.push(cName)
+                            })
+                            if (selectedObj.children.length) {
+                                arr.push(selectedObj)
+                            }
+                        }
+                    } else {
+                        // 判断是否全省被选中
+                        if ($(dom).find('button.active:not([disabled])').length === allCitylength) {
+                            arr.push(selectedObj)
+                        } else {
+                            $(dom).find('button.active:not([disabled])').each(function(c, dom) {
+                                let cName = $(dom).text().replace(/\s+ | [\r\n]/g, '')
+                                selectedObj.children.push(cName)
+                            })
+                            if (selectedObj.children.length) {
+                                arr.push(selectedObj)
+                            }
+                        }
+                    }
+                }
+            })
+
+            // 处理arr
+            // [
+            //     {
+            //         name: '安徽',
+            //         children: ["合肥市", "蚌埠市", "阜阳市"]
+            //     },
+            //     {
+            //         name: '海南',
+            //         children: ["三亚市", "文昌市"]
+            //     },
+            //     {
+            //         name: '河南',
+            //         children: ["郑州市", "信阳市"]
+            //     }
+            // ]
+            let selectedCityDetail = {}
+            arr.forEach(function(item, i) {
+                selectedCityDetail[item.name] = item.children
+            })
+            return selectedCityDetail
+        }
+    }
+
+    // 初始选择的城市恢复,根据传入的p恢复为Disabled灰色按钮
+    function renderSelectedCityDisabled(p = {}) {
+        for (const k in p) {
+            if (p[k].length == 0) {
+                // 购买的省份
+                $('.province').each(function () {
+                    let t = $(this).text().trim();
+                    if (k == t) {
+                        $(this).children('.checkbox').prop('checked',true).attr('disabled',true);
+                        $(this).parents('li').children('.tab_content').find('.city').addClass('active').attr('disabled',true);
+                    }
+                })
+            } else {
+                $('.city').each(function () {
+                    let t = $(this).text().trim();
+                    p[k].forEach(v =>{
+                        if(v !== t) return
+                        // let that = $(this).parents('li').find('.tab:not(.municipality)');
+                        // 改变状态按钮
+                        $(this).addClass('active').attr('disabled',true).parent().siblings('.tab').find('input').addClass('half').attr('disabled',true);
+                    })
+                })
+            }
+        }
+    }
+
+    // 初始选择的城市恢复,根据传入的p恢复为Active蓝色按钮
+    // 需要放到init之后
+    function renderSelectedCityActive(p = {}) {
+        for (const k in p) {
+            if (k === '全国') {
+                $('.area-list li:not(.index):eq(0)').find('input').trigger('click')
+                return
+            }
+            
+            if (p[k].length == 0) {
+                // 购买的省份
+                $('.province').each(function () {
+                    let t = $(this).text().trim();
+                    if (k == t && p[k].length == 0) {
+                        $(this).parent().siblings().find('.city').trigger('click')
+                    }
+                })
+            } else {
+                $('.city').each(function () {
+                    let t = $(this).text().trim();
+                    p[k].forEach(v =>{
+                        if(v !== t) return
+                        // let that = $(this).parents('li').find('.tab:not(.municipality)');
+                        // 改变状态按钮
+                        $(this).trigger('click')
+                    })
+                })
+            }
+        }
+        getResult()
+    }
+
+    function isLockedTipButtons(f) {
+        $('.tips_btn button').prop('disabled', f)
+    }
+
+    // 根据数据进行求总数 --- 上方提示数据信息的初始化
+    function initAlreadyBuy(p, buyset, citys) {
+        // 此处在数据返回后根据数据进行求值
+        if (buyset.areacount === -1) {
+            $('.result_text.already .buy-set-info').text('全国')
+            $('.result_text.add_new .added-info').hide().text('')
+        }
+
+        // 选择的省和市的数量
+        for (let a in p) {
+            if (p[a].length) {
+                // 已经选择的市的数量
+                alreadyBuy.city.selectedCount += p[a].length
+            } else {
+                // 已经选择的省的数量
+                alreadyBuy.province.selectedCount ++
+            }
+        }
+
+        // 购买的全省的数量(不包含市)
+        alreadyBuy.province.totalCount = buyset.areacount;
+        // 购买的城市数量
+        for (const c in citys) {
+            alreadyBuy.city.totalCount += citys[c]
+        }
+        // console.log(alreadyBuy)
+        let buySetInfo = {
+            p: `省级区域${alreadyBuy.province.selectedCount}/${alreadyBuy.province.totalCount}、`,
+            c: `地市${alreadyBuy.city.selectedCount}/${alreadyBuy.city.totalCount}`
+        }
+        $('.result_text.already .buy-set-info').text(buySetInfo.p + buySetInfo.c)
+        $('.result_text.add_new .added-info').text('')
+    }
+
+    // 初始化方法
+    function init() {
+        let data = areaData.data
+        let buyset = data.buyset;
+        let citys = buyset.citys;
+        initAlreadyBuy(data.area, buyset, citys)
+        // 1.根据返回数据进行渲染
+        if (buyset.areacount === -1) {
+            // 购买全国
+            if (Object.keys(data.area).length === 0) {
+                // 选中全国
+                // 不能操作
+                $('.checkbox.other').prop('disabled', true).prop('checked', true)
+                $('.checkbox:not(.other)').prop('disabled', true)
+                $('.city').attr('disabled', true)
+            } else {
+                renderSelectedCityDisabled(data.area)
+            }
+            isLockedTipButtons(true)
+            $('.result_text.already .buy-set-info').text('全国')
+        } else {
+            // 购买的非全国
+            renderSelectedCityDisabled(data.area)
+        }
+        // 2.根据数据绑定data-buy-count,并赋值
+        // area-list上绑定购买的省份数量
+        $('.area-list').attr('data-buy-province-count', buyset.areacount)
+        $('.area-list li:not(.index)').each(function(i, dom){
+            if ($(dom).children('.tab').hasClass('whole')) return
+            // 获取省的名字,并去空格.回车.换行
+            let provinceName = $(dom).find('.province').text().replace(/\s+ | [\r\n]/g, '')
+            for (let c in citys) {
+                if (c === provinceName) {
+                    $(dom).attr('data-buy-city-count', citys[c])
+                }
+            }
+        })
+        $('.add_new').hide()
+        getResult()
+    }
+
+    // ----------------- 以下绑定事件 ----------------------------
+    // 0.渲染城市列表
+    $(".select-area-box ul li:not('.index')").each(function () {
+        var text = $(this).find(".province").text().trim()
+        var data = null
+        chinaMapJSON.some(function (v) {
+            data = v
+            return v.name.indexOf(text) !== -1
+        })
+        var box = $(this).find('div.tab_content')
+        var html = createMoreCity(data.city)
+        box.html(html)
+    })
+    // fastClick初始化: https://github.com/ftlabs/fastclick
+	//  FastClick.attach(document.body)
+    // 1.省下拉市
+    let isAnimating = false
+    $(".select-area-box .tab:not(.municipality)").on('click', function (event) {
+        if (isAnimating) return
+        isAnimating = true
+        if ($(this).next('.tab_content:not(:animated)').css("display") == "block") {
+            $(this).children().children('i').css({
+                "display": "inline-block",
+                "transform": "rotate(0)"
+            })
+        } else {
+            $(this).children().children('i').css({
+                "display": "inline-block",
+                "transform": "rotate(-180deg)"
+            })
+        }
+        $(this).toggleClass('selected').next('.tab_content:not(:animated)').slideToggle(500)
+        $(this).parent().siblings().children('.tab').removeClass('selected');
+        setTimeout(() => {
+            isAnimating = false
+        }, 500)
+    })
+    // 2.点击全国按钮onchange事件;
+    $('.checkbox.other').on('change', function () {
+        let isChecked = $(this).is(':checked')
+        if(isChecked){
+            $(this).prop('checked',true);
+            $('.checkbox:not(.other):not([disabled])').prop('checked',false).removeClass('half');
+            $('.city:not([disabled])').removeClass('active');
+            $('.tab_content').slideUp();
+        }
+        getResult()
+    })
+    // 3.点击非全国按钮onchange事件
+    $('.checkbox:not(.other)').on('change', function () {
+        $('.checkbox.other').prop('checked',false);
+        let isChecked = $(this).is(':checked');
+        if(isChecked){
+            $(this).prop('checked',true).removeClass('half');
+            $(this).parents('li').find('.city').addClass('active');
+            // 控制点击checkbox时候是否展开下方的城市列表
+            // $(this).parent().parent('.tab:not(.municipality)').siblings('.tab_content').slideDown();
+        }else{
+            $(this).prop('checked',false);
+            $(this).parents('li').find('.city').removeClass('active');
+        }
+        showOther();
+        getResult();
+    })
+    // 4.点击半选按钮触发的事件
+//  $('.checkbox.half').on('change', function () {
+//      $('.checkbox.other').prop('checked', false)
+//      let isChecked = $(this).is(':checked')
+//      $(this).prop('checked', isChecked).removeClass('half')
+//      console.log("!1")
+//      getResult();
+//  })
+    // 5.点击城市按钮触发的事件
+    $('.tab_content').on('click', '.city', function () {
+        // 全国取消选中
+        $('.checkbox.other').prop('checked',false);
+        $(this).toggleClass('active')
+        // 省下所有选中的地市数量
+        let activeCityLength = $(this).parent().find('.city.active').length;
+        // 省下一共有几个城市
+        let cityLength = $(this).parent().find('.city').length;
+        let oInput = $(this).parents('li').find('input.checkbox')
+        
+        if (activeCityLength === cityLength) {//当选中的城市数量等于该省下所有城市总数时,即为全选
+            if ($(this).siblings('.city[disabled]').length === 0) {
+                oInput.removeClass('half').prop('checked', true)
+            }
+        } else if (activeCityLength === 0){
+            oInput.prop('checked', false).removeClass('half')
+        } else {//半选
+            oInput.prop("checked",false).addClass('half')
+        }
+        showCityTips(this)
+        getResult();
+    })
+    // 6. 重置按钮点击事件
+    $('.reset-btn').on('click', function() {
+        // alreadyBuy = {
+        //     province: {
+        //         totalCount: 0,
+        //         selectedCount: 0
+        //     },
+        //     city: {
+        //         totalCount: 0,
+        //         selectedCount: 0
+        //     }
+        // }
+        // newlyAdded = {
+        //     province: 0,
+        //     city: 0
+        // }
+
+        // 数组置0,在重新从数据中计算初始状态结果并返回
+        for (let i in alreadyBuy) {
+            for(let ii in alreadyBuy[i]) {
+                alreadyBuy[i][ii] = 0
+            }
+        }
+        for (let j in newlyAdded) {
+            newlyAdded[j] = 0
+        }
+
+        $('.checkbox').prop('checked', false).removeAttr('disabled');
+        $('.city').removeClass('active');
+        $('input').removeClass('half')
+        $('.tab_content').slideUp();
+        $('.optional').remove()
+        init();
+        $(".tips_d_text").hide();
+    })
+
+    // 7.锚点跳转
+    $("body").on('click', '.slide a', function () {
+        var s = $(this).html()
+        if (s == '#') {
+            return;
+        }
+        document.querySelector('#' + s).scrollIntoView({
+            block: 'center'
+        });
+    })
+    // 阻止input checkbox选中取消 触发父元素下拉事件
+    $('.checkbox').click(function (e) {  
+        e.stopPropagation();
+    })
+
+	function showCityTips(dom){
+		let activeCityLength = $(dom).parent().find('.city.active').length;
+		let selectedCityLength = $(dom).parent().find('.city.active:not([disabled])').length;
+		let cityLength = $(dom).parent().find('.city').length;
+		if(selectedCityLength > 2){
+			$(".tips_d_text").text("已选择"+selectedCityLength+"个市,建议购买“全省”");
+			$(".tips_d_text").show();
+		}else{
+			$(".tips_d_text").hide();
+		}
+		if(selectedCityLength === cityLength){
+			showOther();
+		}
+	}
+	
+	function showOther(){
+		let provinceLength = $(".area-list .checkbox:not(.other):not([disabled]):checked").length;
+		if(provinceLength > 9){
+			$(".tips_d_text").text("已选择"+provinceLength+"个省,建议购买“全国”")
+			$(".tips_d_text").show();
+		}else{
+			$(".tips_d_text").hide();
+		}
+	}
+
+    // ----------------------- 以下数据交互 ------------------
+    $DoPost("/subscribepay/renewUpgrade/getBuyMsg", {}, function (data) {
+    	if(data){
+        	areaData["data"] = {
+        		"area" : data.area,
+        		"buyset" : data.buyset, 
+        	}
+        	init();
+    	}
+    }, false);
+    // 确认按钮事件
+    $('.save-btn').on('click', function(){
+        // 获取added城市详情
+        var activeCityDetail = getActiveCityDetail()
+        let areaCount = getResultWithMCount()
+//      console.log("111",areaCount)
+//      console.log(JSON.stringify(activeCityDetail))
+//      console.log(activeCityDetail)
+//      console.log(areaData)
+//      console.log(alreadyBuy)
+//      console.log(newlyAdded)
+        sessionStorage.vipSubSelectCity = newlyAdded.city
+        sessionStorage.vipSubSelectAreaUpgrade = JSON.stringify(activeCityDetail);
+        sessionStorage.vipSubSelectAreaAdd = JSON.stringify(areaCount);
+        history.go(-1);
+    })
+	//
+	if(sessionStorage.vipSubSelectAreaUpgrade!==undefined&&sessionStorage.vipSubSelectAreaUpgrade!==""){
+		let areaObj = JSON.parse(sessionStorage.vipSubSelectAreaUpgrade);
+		renderSelectedCityActive(areaObj);
+	}
+    // 求需要M的城市数量
+    // getResultWithMCount()
+    // 获取点亮的城市的列表详情(带省名和城市名)
+    // getActiveCityDetail()
+
+    // 回显为蓝色激活样式
+    // renderSelectedCityActive()
+    // 回显为灰色不可点击样式
+    // renderSelectedCityDisabled()
+})

+ 777 - 21
src/web/templates/pc/subscribe_new.html

@@ -15,7 +15,7 @@
     <link rel="stylesheet" type="text/css"
           href="{{Msg "seo" "cdn"}}/pccss/public-nav-1200.css?v={{Msg "seo" "version"}}"/>
     <script type="text/javascript" src="{{Msg "seo" "cdn"}}/js/public-nav.js?v={{Msg "seo" "version"}}"></script>
-    <script src="{{Msg "seo" "cdn"}}/js/jquery.cookie.js"></script>
+    <script src="{{Msg "seo" "cdn"}}/js/jquery.cookie.js?v={{Msg "seo" "version"}}"></script>
     <script>
         $(function () {
             $(window).scroll(function () {
@@ -33,7 +33,7 @@
 <!-- banner图板块 -->
 <div class="tender-1">
     <div class="imgauto">
-        <img src="/images/subscribe/banner.png" alt="">
+        <img src="{{Msg "seo" "cdn"}}/images/subscribe/banner.png?v={{Msg "seo" "version"}}" alt="">
     </div>
 </div>
 <!-- 订阅模式选择板块 -->
@@ -41,28 +41,38 @@
     <div class="sub-center">
         <div class="sub-free">
             <h3 class="free-title">免费版订阅</h3>
-            <button class="free-btn">立即免费订阅</button>
+            <button class="free-btn scfree">立即免费订阅</button>
         </div>
         <div class="sub-vip">
             <div class="vip-logo">
-                <img src="/images/subscribe/vip-logo.png" alt="">
+                <img src="{{Msg "seo" "cdn"}}/images/subscribe/vip-logo.png?v={{Msg "seo" "version"}}" alt="">
                 <h3 class="vip-title">VIP订阅</h3>
             </div>
-            <button class="vip-btn btn btn-primary">免费试用</button>
+            <button class="vip-btn" data-toggle="modal" data-target=".bs-example-modal-sm">免费试用</button>
         </div>
     </div>
 </div>
 <!-- VIP弹窗 -->
-<div class="modal hide">
-    <div class="modal-dialog">
-        <img src="/images/subscribe/vip_tanchuang.png" alt="">
-        <div class="vip-code">
-            <img src="/images/subscribe/QR_code.png" alt="">
-            <p class="vip-text">扫描二维码体验VIP订阅</p>
+
+<div class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel">
+    <div class="modal-dialog modal-dialog-subvip modal-sm" role="document">
+        <div class="modal-content">
+            <img src="{{Msg "seo" "cdn"}}/images/subscribe/vip_tanchuang.png?v={{Msg "seo" "version"}}" alt="">
+            <div class="vip-code">
+                <img id="vipCode" alt="" style="width: 139px;height: 139px">
+                <p class="vip-text">扫描二维码体验VIP订阅</p>
+            </div>
         </div>
     </div>
 </div>
-<div class="shade hide"></div>
+
+<!-- <div class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel">
+    <div class="modal-dialog modal-sm" role="document">
+        <div class="modal-content">
+
+        </div>
+    </div>
+</div> -->
 <!-- 订阅模式对比板块 -->
 <div class="sub-contrast">
     <div class="contrast-header">
@@ -91,14 +101,14 @@
                     <li>10组关键词</li>
                     <li>仅支持标题匹配</li>
                     <li>订阅区域精确到省</li>
-                    <li><i class="btn-free">免费</i></li>
+                    <li><i class="btn-free scfree">免费</i></li>
                 </ul>
             </div>
             <div class="center-right">
                 <ul>
                     <li class="top-title modify-right">
                         VIP订阅专属服务
-                        <img src="/images/subscribe/mengban.png" alt="">
+                        <img src="{{Msg "seo" "cdn"}}/images/subscribe/mengban.png?v={{Msg "seo" "version"}}" alt="">
                     </li>
                     <li><span>匹配项目信息</span>,为你推送所匹配项目后续的全部动态</li>
                     <li>按采购单位类型订阅,无需繁琐关键词设置</li>
@@ -106,15 +116,122 @@
                     <li>支持<span>标题匹配+全文匹配</span>,信息筛选更灵活</li>
                     <li>订阅区域<span>精确到地级市</span>,只看你最关注的</li>
                     <li>低至5.8元/月
-                        <a href="javascript:;" class="On-trial vip-btn">免费试用</a>
+                        <a href="#" class="On-trial vip-btn" data-toggle="modal"
+                           data-target=".bs-example-modal-sm">免费试用</a>
                     </li>
                 </ul>
             </div>
         </div>
     </div>
 </div>
+<button class="btn hidden" id="cb-01" data-toggle="modal" data-target="#myModal-01"></button>
 <!--内容-->
 
+<!--免费订阅弹框-->
+<div class="modal fade" id="myModal-01" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
+    <div class="modal-dialog">
+        <div id="firstPopup" class="modal-content" style="width: 800px;margin: auto;height: 515px;">
+            <div class="modal-header">
+            </div>
+            <div class="modal-body">
+                <div class="firstleft">
+                    <div class="floorone">
+                        <div class="lineleft"></div>
+                        <div class="lineright"></div>
+                        <div class="firstdrop"></div>
+                        <div class="seconddrop"></div>
+                        <div class="thriddrop"></div>
+                    </div>
+                    <div class="floortwo">
+                        <span>欢迎使用剑鱼标讯!请选择您的行业,可多选</span>
+                    </div>
+                    <div class="floorthree">
+                        <ul>
+                        </ul>
+                    </div>
+                    <div class="floorfour">
+                        <div class="noSub">
+                            <button type="button" class="btn" id="noSub" data-dismiss="modal">我不需要订阅</button>
+                        </div>
+                        <div class="firstNext">
+                            <button type="button" class="btn" id="firstNext" onclick="next(1)">下一步</button>
+                        </div>
+                        <div style="clear:both;"></div>
+                    </div>
+                </div>
+                <div class="secondleft">
+                    <img src="/front/share/{{.T.shareid}}"/>
+                    <br>
+                    <span>老用户请到剑鱼标讯公众号<br>进行订阅操作</span>
+                </div>
+                <div style="clear:both;"></div>
+            </div>
+            <div class="modal-footer">
+            </div>
+        </div><!-- /.modal-content -->
+        <div id="secondPopup" class="modal-content hidden" style="width: 488px;margin: auto;height: 506px;">
+            <div class="modal-header">
+            </div>
+            <div class="modal-body">
+                <div class="floorone">
+                    <div class="lineleft"></div>
+                    <div class="lineright"></div>
+                    <div class="firstdrop"></div>
+                    <div class="seconddrop"></div>
+                    <div class="thriddrop"></div>
+                </div>
+                <div class="floortwo">
+                    <span>请输入关键词,比如:“教学设备”、“税务局 软件”</span>
+                </div>
+                <div class="floorthree">
+                    <input type="text" class="form-control" id="kword" placeholder="请输入关键词">
+                </div>
+                <div class="floorfour">
+
+                </div>
+            </div>
+            <div class="modal-footer">
+                <button type="button" class="btn" id="noSub" data-dismiss="modal">我不需要订阅</button>
+                <button type="button" class="btn" id="firstPage" onclick="prev(2)">上一步</button>
+                <button type="button" class="btn" id="secondNext" onclick="next(2)">下一步</button>
+            </div>
+        </div><!-- /.modal-content -->
+        <div id="thirdPopup" class="modal-content hidden" style="width: 488px;margin: auto;height: 440px;">
+            <div class="modal-header">
+            </div>
+            <div class="modal-body" style="height:330px;">
+                <div class="floorone" id="dyym-1">
+                    <img src="/front/share/{{.T.shareid}}"/>
+                </div>
+                <div class="floortwo">
+                    <span>微信扫一扫,订阅关键词:“<span id="thirdkw">办公室 绿化;净化器;中央空调</span>”</span>
+                </div>
+            </div>
+            <div class="modal-footer">
+                <button type="button" class="btn" id="noSub" data-dismiss="modal">我不需要订阅</button>
+                <button type="button" class="btn" id="secondPage" onclick="prev(3)">上一步</button>
+            </div>
+        </div><!-- /.modal-content -->
+        <div id="fourthPopup" class="modal-content hidden" style="width: 488px;margin: auto;height: 320px;">
+            <div class="modal-header">
+                <button style="margin-top:-25px;margin-right:-15px;" type="button" class="close" data-dismiss="modal"
+                        aria-hidden="true">&times;
+                </button>
+            </div>
+            <div class="modal-body" style="height: 240px;">
+                <div class="floorone" style="text-align: center;">
+                    <img style="width:180px;height:180px;"
+                         src="{{Msg "seo" "cdn"}}/images/swordfish/sf_01_01.png?v={{Msg "seo" "version"}}"/>
+                </div>
+                <div class="floortwo" style="padding: 20px 30px;">
+                    <span>请微信扫码进行订阅操作</span>
+                </div>
+            </div>
+            <div class="modal-footer">
+            </div>
+        </div><!-- /.modal-content -->
+    </div><!-- /.modal -->
+</div>
 
 <!--百度统计start-->
 {{include "/common/pcbottom.html"}}
@@ -122,14 +239,653 @@
 <!--百度统计end-->
 
 <script>
+    //关键词不合规范提示
+    var hintcon = ["您订阅的关键词较多,<br>可能会收不到推送信息。", "您订阅的关键词字数过多,<br>可能会收不到推送信息。", "您订阅的关键词包含特殊符号,<br>可能会收不到推送信息。"]
+    var Guide = {
+        industry_keyword: {
+            "工程建筑": ["道路", "桥梁", "房屋", "钢结构", "土方", "建筑工程", "混凝土", "钢材", "勘察", "设计", "施工", "监理", "装修", "安装"],
+            "水利水电": ["水利工程", "水利设施", "水电工程", "水电站", "水电安装", "给水", "给排水", "水库", "节水", "电力", "配电", "闸门", "水泵"],
+            "能源化工": ["太阳能", "光伏", "新能源", "煤炭", "石油", "皮带机", "电网", "水电", "风电", "电缆", "线路迁改", "开关"],
+            "弱电安防": ["安防", "弱电", "机房", "楼宇对讲", "智能家居", "入侵检测", "门禁", "报警器", "电子围栏", "一卡通", "监控", "综合布线", "物联网"],
+            "信息技术": ["软件", "网络", "信息化", "系统集成", "交换机", "路由器", "基站", "服务器", "网站", "视频", "云计算", "虚拟化", "大数据", "VPN", "UPS", "存储", "无人机"],
+            "办公用具": ["图书", "课桌椅", "体育器材", "篮球架", "健身器材", "会议桌", "办公桌", "沙发", "电脑桌", "座椅", "耗材", "家具", "办公设备"],
+            "机械设备": ["工程机械", "搅拌站", "压路机", "塔吊", "起重机", "发电机", "养护机械", "机械设备", "挖掘机", "自卸车", "机器人"],
+            "交通运输": ["交通运输", "铁路", "轨道", "车辆", "隧道", "仓储", "道路", "护栏", "公交车", "高速公路", "信号灯", "标识牌"],
+            "医疗卫生": ["监测仪", "分析仪", "核磁共振", "供氧材料", "注射器", "心电图", "呼吸机", "彩超", "CT", "医疗设备", "医疗器械"],
+            "市政设施": ["城市道路", "地下通道", "涵洞", "过街天桥", "防洪排水", "景观照明", "绿化", "洗扫车", "管网", "路灯", "排污管道"],
+            "其它": ["翻译", "物业服务", "法律咨询", "法律服务"]
+        },
+        //所选的行业
+        selectIndustrys: [],
+        selectLastData: [],
+        action: 1,
+        sst: '',
+        clientH: 0
+    }
+    //
+    $(function () {
+        selcetIndexNav(1);
+        //setTimeout("$('#inerPre').click()",1000);
+        $("#inerNextDiv").click(function () {
+            $('#inerNext').click();
+            $(this).addClass("hidden");
+            setTimeout(function () {
+                $("#inerNextDiv").removeClass("hidden");
+            }, 500)
+        })
+        $("#inerPreDiv").click(function () {
+            $('#inerPre').click();
+            $(this).addClass("hidden");
+            setTimeout(function () {
+                $("#inerPreDiv").removeClass("hidden");
+            }, 500)
+        })
+        haslogin({{.T.logid}});
+        //saveuserlogs({{.T.shareid}});
+        Guide.clientH = document.body.clientHeight;
+        //
+        $(".scfree").click(function () {
+            //判断用户是否登录
+            OrLogin()
+        })
+        //头部导航
+        $(".j-nav .j-nav-link:eq(4)").addClass("active");
+        //动画开始
+        var rollflag = true
+
+        $(window).scroll(function () {
+            if ($(this).scrollTop() > 900) {
+                if (rollflag) {
+                    startAnimation();
+                    rollflag = false;
+                }
+            }
+        });
+        //加载行业
+        var html = "";
+        for (var i in Guide.industry_keyword) {
+            html += '<li>' + i + '</li>';
+        }
+        $("#firstPopup .floorthree ul").html(html)
+        //
+        $("#firstPopup .floorthree li").click(function () {
+            $(this).toggleClass("active");
+        })
+        //
+        $("#kword").bind("input propertychange", function () {
+            setTimeout(function () {
+                if (!$(this).prop('comStart')) {
+                    saveKeyWord(this.value);
+                    new RecomKWs().loadSubscribeRecom();
+                }
+            }, 500)
+        }).on('compositionstart', function () {
+            $(this).prop('comStart', true);
+        }).on('compositionend', function () {
+            $(this).prop('comStart', false);
+        });
+        //
+        new RecomKWs().structureHtml("");
+        //
+        $("#myModal-01").click(function () {
+            $("body").css("overflow", "");
+            setTimeout(function () {
+                var aria = $("#myModal-01").attr("aria-hidden");
+                if (aria == "true") {
+                    behaviorRecord();
+                }
+            }, 500)
+        })
+        //
+        $("#myModal").click(function () {
+            $("body").css("overflow", "hidden");
+            setTimeout(function () {
+                $("body").css("overflow", "");
+                $("body").addClass("modal-open");
+            }, 500)
+        })
+    })
+    //是否登录
+    var OrLogin = function () {
+        $("#fourthPopup").addClass("hidden");
+        $("#secondPopup").addClass("hidden");
+        $("#thirdPopup").addClass("hidden");
+        if (loginflag) {
+            $("#fourthPopup").removeClass("hidden");
+            $("#firstPopup").addClass("hidden");
+            $("#myModal-01 .modal-dialog").css("width", "488px");
+            $("#thirdPopup").css("margin-top", (Guide.clientH - 320) / 2);
+        } else {
+            $("#firstPopup").removeClass("hidden");
+            $("#fourthPopup").addClass("hidden");
+            Guide.action = 1;
+            $("#myModal-01 .modal-dialog").css("width", "800px");
+            $("#myModal-01 .modal-dialog").css("margin-top", "100px;");
+            $("#firstPopup").css("margin-top", (Guide.clientH - 515) / 2);
+        }
+        $("#cb-01").click();
+    }
+    //动画开始
+    var startAnimation = function () {
+        var liLength = $(".warp-progress li").length;
+        var liWidth = $(".container-page").width();
+        var t = null;
+        /*初始化宽度*/
+        $(".warp-container").css({
+            width: liLength * liWidth
+        })
+
+        $('.warp-progress-items').on('animationend', function () {
+            $(this).addClass('active stop')
+            if ($(this).next().html() != undefined) {
+                $(this).next().trigger("click");
+            } else {
+                $('.warp-progress-items').removeClass("active stop");
+                t = setTimeout(function () {
+                    $(".warp-progress-items").eq(0).trigger("click")
+                }, 100)
+                return false;
+            }
+            ;
+        })
+        $(".warp-progress-items").on("click", function () {
+            var _this = $(this)
+            $(".container-page").find(".container-page-title").stop(false, true).css({
+                top: 800
+            })
+            $('.warp-progress-items').each(function (i) {
+                if (i < $(_this).index()) {
+                    $(this).addClass("active stop");
+                } else {
+                    $(this).removeClass('active stop')
+                }
+            })
+            $(this).addClass('active');
+            $(".container-page").stop(false, false).animate({
+                left: -$(this).index() * liWidth
+            }, 1000, function () {
+                $(".container-page").find(".container-page-title").eq(_this.index()).stop(false, false).animate({
+                    top: 240
+                }, 800)
+            })
+            return false;
+        })
+        t = setTimeout(function () {
+            $(".warp-progress-items").eq(0).trigger("click")
+        }, 100)
+    }
+    //记录用户行为
+    var behaviorRecord = function () {
+        var bevalue = ''
+        if (Guide.action == 1) {
+            bevalue += '第一弹出框,行业:'
+            $("#firstPopup .floorthree li.active").each(function () {
+                bevalue += $(this).text() + ";";
+            });
+        } else if (Guide.action == 2) {
+            bevalue += '第二弹出框,关键词:'
+            $("#secondPopup .floorfour li.active").each(function () {
+                bevalue += $(this).text() + ";";
+            });
+            bevalue += $("#kword").val();
+        } else if (Guide.action == 3) {
+            bevalue += '第三弹出框,扫码操作。'
+        }
+        $("#kword").val("");
+        clearInterval(Guide.sst);
+        $.post("/member/behaviorRecord", {"source": "pc", "value": bevalue, "type": "subscribe_pc"});
+    }
+    //下一页
+    var next = function (index) {
+        if (index == 1) {
+            Guide.selectIndustrys = [];
+            $("#firstPopup .floorthree li.active").each(function () {
+                Guide.selectIndustrys.push($(this).text());
+            });
+            new RecomKWs().loadIndustryRecom();
+            $("#firstPopup").addClass("hidden");
+            $("#secondPopup").removeClass("hidden");
+            $("#thirdPopup").addClass("hidden");
+            $("#myModal-01 .modal-dialog").css("width", "488px");
+            $("#secondPopup").css("margin-top", (Guide.clientH - 506) / 2);
+            $("#kword").val("");
+            Guide.action = 2;
+        } else if (index == 2) {
+            Guide.action = 3;
+            $("#myModal-01 .modal-dialog").css("width", "488px");
+            $("#firstPopup").addClass("hidden");
+            $("#secondPopup").addClass("hidden");
+            $("#thirdPopup").removeClass("hidden");
+            $("#thirdPopup").css("margin-top", (Guide.clientH - 440) / 2);
+            generateQR();
+        }
+    }
+    //上一页
+    var prev = function (index) {
+        if (index == 2) {
+            $("#firstPopup").removeClass("hidden");
+            $("#secondPopup").addClass("hidden");
+            $("#thirdPopup").addClass("hidden");
+            $("#myModal-01 .modal-dialog").css("width", "800px");
+            Guide.action = 1;
+        } else if (index == 3) {
+            $("#firstPopup").addClass("hidden");
+            $("#secondPopup").removeClass("hidden");
+            $("#thirdPopup").addClass("hidden");
+            $("#myModal-01 .modal-dialog").css("width", "488px");
+            Guide.action = 2;
+        }
+
+    }
+    var generateQR = function () {
+        var selectKW = []
+        $("#secondPopup .floorfour li.active").each(function () {
+            selectKW.push($(this).text());
+        });
+        selectKW.push($("#kword").val());
+        var strkw = selectKW.join(";")
+        if ($("#kword").val() == "") {
+            strkw = strkw.substring(0, strkw.length - 1)
+        }
+        $("#thirdkw").text(strkw)
+        var shareid = kopshareid;
+        //$.post("/front/getLoginNum/101",function(data){
+        //	if(data&&data.num){
+        //		$("#thirdPopup .floorone img").attr("src","/front/share/"+data.num);
+        saveStKw(strkw, shareid)
+        //setSubscribeTimes(30,data.num)
+        //	}
+        //},'json');
+    }
+    //
+    var saveStKw = function (skw, num) {
+        if (skw != "" && num != "") {
+            $.post("/front/rediskw", {"skw": skw, "num": num});
+        }
+    }
+    //
+    var spkw = function (t) {
+        $(t).toggleClass("active");
+    }
+    //
+    var RecomKWs = function () {
+        this.count = 6;
+        //根据选择的行业,获取对应的关键词,目的去重
+        this.getIndustrys = function () {
+            var industry_keyword = {};
+            for (var i in Guide.selectIndustrys) {
+                industry_keyword[Guide.selectIndustrys[i]] = Guide.industry_keyword[Guide.selectIndustrys[i]];
+            }
+            for (var i in industry_keyword) {
+                var keywords = [];
+                for (var k in industry_keyword[i]) {
+                    var isExists = false;
+                    var kWord = industry_keyword[i][k];
+                    for (var m in industry_keyword) {
+                        if (isExists) {
+                            break;
+                        }
+                        for (var n in industry_keyword[m]) {
+                            var nWord = industry_keyword[m][n];
+                            if (i == m && k == n) {
+                                continue;
+                            }
+                            if (kWord == nWord) {
+                                isExists = true;
+                                break;
+                            }
+                        }
+                    }
+                    if (!isExists) {
+                        keywords.push(kWord);
+                    }
+                }
+                industry_keyword[i] = keywords;
+            }
+            return industry_keyword;
+        }
+        //加载行业对应的关键词
+        this.loadIndustryRecom = function () {
+            var industry_keyword = this.getIndustrys();
+            var lastData = [];
+            var dataTemp = [];
+            var datalength = 0;
+            for (var i in industry_keyword) {
+                if (datalength < industry_keyword[i].length) {
+                    datalength = industry_keyword[i].length
+                }
+            }
+            for (var k = 0; k < datalength; k++) {
+                for (var key in industry_keyword) {
+                    if (industry_keyword[key][k]) {
+                        dataTemp.push({
+                            "index": key,
+                            "value": industry_keyword[key][k]
+                        });
+                    }
+                }
+            }
+            dataTemp = dataTemp.slice(0, this.count);
+            for (var i in dataTemp) {
+                lastData.push(dataTemp[i]["value"]);
+            }
+            Guide.selectLastData = lastData
+            this.structureHtml(lastData);
+        }
+        this.loadSubscribeRecom = function () {
+            var valueArray = [];
+            var inputValue = $.trim($("#kword").val()).replace(/\s+/g, "+");
+            if (inputValue != "") {
+                valueArray.push(inputValue);
+                this.getData(valueArray, 6);
+            } else {
+                this.structureHtml(Guide.selectLastData);
+            }
+        }
+        this.getData = function (valueArray, reqCount) {
+            var thisClass = this;
+            $.post("/member/getRecomKWs", {
+                count: reqCount + 1,
+                value: valueArray.join(" ").toUpperCase()
+            }, function (r) {
+                if (typeof (r) == "undefined" || r == null || r.length == 0) {
+                    r = [];
+                }
+                r = thisClass.filterRecomDatas(r, valueArray);
+                thisClass.processKWdata(r.slice(0, 6));
+            });
+        }
+        this.processKWdata = function (r) {
+            var lastData = [];
+            if (r.length == 0) {
+                lastData = Guide.selectLastData
+            } else {
+                for (var i in r) {
+                    lastData.push(r[i]["word"]);
+                }
+            }
+            this.structureHtml(lastData);
+        }
+        //过滤
+        this.filterRecomDatas = function (words, valueArrayTemp) {
+            var newWords = [];
+            for (var i in words) {
+                var isDel = false;
+                var currentWord = $.trim(words[i]["word"]).toUpperCase();
+                //已订阅的关键词
+                if (!isDel) {
+                    for (var n = 0; n < valueArrayTemp.length; n++) {
+                        if (isDel) {
+                            break;
+                        }
+                        var vat = valueArrayTemp[n].split("+");
+                        for (var m = 0; m < vat.length; m++) {
+                            if (currentWord == vat[m].toUpperCase()) {
+                                isDel = true;
+                                break;
+                            }
+                        }
+                    }
+                }
+                //数字和一个字的不显示
+                if (!isDel) {
+                    if (/^(-?\d+)(\.\d+)?$/.test(currentWord) || /^[0-9]*$/.test(currentWord) || currentWord.length == 1 || currentWord == "" || currentWord.indexOf("�") > -1) {
+                        isDel = true;
+                    }
+                }
+                if (!isDel) {
+                    //去重
+                    for (var k in words) {
+                        if (isDel) {
+                            break;
+                        }
+                        if (i == k) {
+                            continue;
+                        }
+                        if (currentWord == words[k]["word"].toUpperCase()) {
+                            isDel = true;
+                            break;
+                        }
+                    }
+                }
+                if (!isDel) {
+                    newWords.push(words[i]);
+                }
+            }
+            newWords.sort(function (a, b) {
+                if (a.sim < b.sim) {
+                    return 1;
+                } else if (a.sim > b.sim) {
+                    return -1;
+                } else {
+                    return 0;
+                }
+            });
+            return newWords;
+        }
+        this.structureHtml = function (data) {
+            var shtml = '<div>剑鱼标讯为您推荐以下关键词</div>';
+            if (data.length != 0) {
+                shtml += '<ul>'
+                for (var i = 0; i < data.length; i++) {
+                    shtml += '<li class="active" onclick="spkw(this)">' + data[i] + '</li>'
+                }
+                shtml += '</ul>';
+                $("#secondPopup .floorfour").html(shtml);
+            } else if (data == "") {
+                this.hotWord();
+            }
+
+        }
+
+        //最热推荐词
+        this.hotWord = function () {
+            $.ajax({
+                type: "POST",
+                url: "/front/gethotkey",
+                data: {},
+                success: function (r) {
+                    var shtml = '<div>剑鱼标讯为您推荐以下关键词</div><ul>';
+                    if (r.length != 0) {
+                        for (var i = 0; i < r.length; i++) {
+                            shtml += '<li class="active" onclick="spkw(this)">' + r[i] + '</li>';
+                        }
+                    } else {
+                        var m = 0;
+                        for (var i in Guide.industry_keyword) {
+                            m++
+                            if (m < 7) {
+                                shtml += '<li class="active" onclick="spkw(this)">' + i + '</li>';
+                            } else {
+                                break
+                            }
+                        }
+
+                    }
+                    shtml += '</ul>'
+                    $("#secondPopup .floorfour").html(shtml);
+                }
+            })
+        }
+    }
+    //
+    var JYAlert = function (T) {
+        if (T != "") {
+            $(".jyhead_mask").html(T)
+            //$("#jydialog").css({"left":"50%","margin-top":"-50px","margin-left":"-120px"});
+            $("#myModal").modal("show");
+        }
+    }
+    //
+    var saveKeyWord = function (text) {
+        if (typeof (text) != "undefined") {
+            text = $.trim(text);
+            if (text != "") {
+                if (text.match(/[^0-9a-zA-Z\u4E00-\u9FFF\s]/g)) {
+                    JYAlert(hintcon[2]);
+                } else {
+                    text = text.replace(/\s+/g, " ");
+                    texts = text.split(" ")
+                    for (k = 0; k < texts.length; k++) {
+                        if (k > 1) {
+                            JYAlert(hintcon[0]);
+                        } else {
+                            if (texts[k].length > 19) {
+                                JYAlert(hintcon[1]);
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    //
+    $(function () {
+        var rotateInner = function () {
+            var $pre = $('#inerPre'),
+                $next = $('#inerNext'),
+                $inner = $('#inner'),
+                $ulLists = $('#inner ul li'),
+                /*度数*/
+                num = 0,
+                /*索引*/
+                index = null,
+                /*圈数*/
+                circle = null;
+
+            return {
+
+                next: function () {
+                    $next.on('click', function () {
+                        num = num + 24;
+                        setTimeout(rotateInner.nowActive, 100)
+
+                        $inner.css({
+                            "transform": "rotate(" + (-num) + "deg)"
+                        })
+                    })
+                },
+                pre: function () {
+                    $pre.on('click', function () {
+                        num = num - 24;
+                        setTimeout(rotateInner.nowActive, 100)
+                        $inner.css({
+                            "transform": "rotate(" + (-num) + "deg)"
+                        })
+                    })
+                },
+                nowActive: function () {
+                    /*获取圈数*/
+                    circle = Math.floor(num / 360);
+                    /*获取索引*/
+                    index = (num - circle * 360) / 24;
+                    /*左边图片*/
+                    var $leftImg = $('.inner-left img');
+
+                    /*active时的图片路径*/
+                    var imgSrc = $ulLists.eq(index).find(".icon").attr('acTimg');
+
+                    /*当前索引添加class*/
+                    $ulLists.eq(index).addClass("nowImg").siblings().removeClass('nowImg');
+                    $.each($ulLists, function (i) {
+                        if ($($ulLists[i]).hasClass("nowImg")) {
+                            $($ulLists[i]).find(".icon").attr({
+                                "src": imgSrc
+                            }).removeClass("animteOpacity").addClass("animteOpacity");
+                        } else {
+                            /*原图片路径*/
+                            var imgSrc_src = $($ulLists[i]).find(".icon").attr('srcImg');
+                            $($ulLists[i]).find(".icon").attr({
+                                "src": imgSrc_src
+                            }).removeClass("animteOpacity");
+                        }
+                    });
+
+                    /*给当前索引的 数字添加类名 删除其他类名*/
+                    $ulLists.eq(index).find("i").addClass('active').end().siblings().find("i").removeClass('active');
+                    /*显示frText和隐藏*/
+                    $ulLists.eq(index).find(".frText").stop().fadeIn(1000).end().siblings().find(".frText").stop().fadeOut(10);
+                    /*左边图片显示*/
+                    $leftImg.eq(index).stop().animate({
+                        "opacity": "1",
+                        "top": "90px"
+                    }, 1000).siblings().stop().css({
+                        "opacity": "0",
+                        "top": "400px"
+                    })
+                },
+                tigerClick: function () {
+                    var $innerBtn = $('.innerBtn');
+
+                    t = setInterval(tirclick, 8000);
+
+                    //$inner.on('mouseover', function() {
+                    //	clearInterval(t)
+                    //});
+                    $innerBtn.on('mouseover', function () {
+                        clearInterval(t)
+                    });
+
+                    //$inner.on('mouseout', function() {
+                    //	t = setInterval(tirclick, 8000);
+                    //});
+                    $innerBtn.on('mouseout', function () {
+                        t = setInterval(tirclick, 8000);
+                    });
+
+                    function tirclick() {
+                        $pre.triggerHandler('click');
+                    }
+
+                    $(document).on('visibilitychange', function () {
+                        //document.title = document.hidden? "你走了":"你回来了";
+                        document.hidden ? clearInterval(t) : t = setInterval(tirclick, 8000);
+                    })
+                }
+            }
+        }()
+        /*调用*/
+        rotateInner.next()
+        rotateInner.pre()
+
+        var rollnext = true
+        var thisHeight = window.screen.height;
+        if (thisHeight > 800) {
+            if (rollnext) {
+                setTimeout(function () {
+                    $('#inerPre').click()
+                }, 1000);
+                rotateInner.tigerClick()
+                rollnext = false;
+            }
+        } else {
+            $(window).scroll(function () {
+                if ($(this).scrollTop() > 200) {
+                    if (rollnext) {
+                        setTimeout(function () {
+                            $('#inerPre').click()
+                        }, 1000);
+                        rotateInner.tigerClick()
+                        rollnext = false;
+                    }
+                }
+            });
+        }
+    })
+
     $('.vip-btn').click(function () {
-        $('.hide').fadeIn(300);
-        $('.modal,.shade').slideDown(300);
-        // $('.hide').removeClass('hide');
+        $('.madal').css('display', 'block');
+        $('body').removeClass('modal-open')
+        setTimeout(() => {
+            $('.modal-backdrop').attr('id', 'modalhide')
+        }, 100)
     })
-    $('.shade').click(function () {
-        $('.hide').fadeOut(300);
-        $('.modal,.shade').slideUp(300);
+    console.log($('#modalhide'))
+    $('#modalhide').click(function () {
+        $('modal-backdrop').attr('id')
+        $('.modal-backdrop').fadeOut(200);
+        $('.modal').slideUp(200);
     })
 </script>
 </body>

+ 17 - 7
src/web/templates/weixin/dataExport/dataExport_toMyOrder.html

@@ -611,7 +611,7 @@
 			}
 			//续费 1 再次购买 2
 			function renewalOrBuyAgain(pattern,e){
-				sessionStorage.orderTabActive=$("ul .active").index();
+				setSessionStorage();
 				var orderCode = $(e).parent(".card-footer").prev(".card-content").find("a").attr("eid");
 				if (pattern==1){
 					var checkOrder_bl=checkOrder()
@@ -756,12 +756,13 @@
 				sessionStorage.removeItem("applysuccess");
 				sessionStorage.removeItem("companyName");
 				sessionStorage.removeItem("taxNumer");
-				$("#order_list").on('scroll' ,function(){
-					scrollTop=$(".main")[0].scrollTop
-					console.log(scrollTop)
-					console.log(this)
-				});
+//				$("#order_list").on('scroll' ,function(){
+//					scrollTop=$(".main")[0].scrollTop
+//					console.log(scrollTop)
+//					console.log(this)
+//				});
 				//var i=0
+				
 				$(".buttons-tab .tab-link").each(function() {
 					$(".loading_").hide();
 					var index = $(this).index();
@@ -803,7 +804,16 @@
 						
 					}
 				}else{
-					queryOrder(0,10);
+					//后续版本用
+					var active=getParam("active");
+					if (active){
+						$(".buttons-tab .tab-link").eq(active).addClass("active").siblings().removeClass("active");
+						$(".tabs>.tab").eq(active).show().siblings().hide();
+						$(".card_lists").empty();
+						queryOrder(active,10);
+					}else{
+						queryOrder(0,10);
+					}
 				}
 			})
 			

+ 19 - 501
src/web/templates/weixin/vipsubscribe/choose_area_upgrade.html

@@ -7,32 +7,31 @@
     <meta name="viewport" content="initial-scale=1, maximum-scale=1">
     <meta name="apple-mobile-web-app-capable" content="yes">
     <meta name="apple-mobile-web-app-status-bar-style" content="black">
-    <script src="/vipsubscribe/js/rem.js?v={{Msg "seo" "version"}}"></script>
-    <link rel="stylesheet" href="/vipsubscribe/css/weui.min.css?v={{Msg "seo" "version"}}">
-    <link rel="stylesheet" type="text/css" href="/vipsubscribe/css/base.css?v={{Msg "seo" "version"}}" />
-    <link rel="stylesheet" type="text/css" href="/vipsubscribe/iconfont/iconfont.css?v={{Msg "seo" "version"}}" />
-    <link rel="stylesheet" href="/vipsubscribe/css/public.css?v={{Msg "seo" "version"}}">
-    <link rel="stylesheet" href="/vipsubscribe/css/choose_area.css?v={{Msg "seo" "version"}}4">
-	{{include "/common/weixin.html"}}
-	<!--<script src="{{Msg "seo" "cdn"}}/wxswordfish/share.js?v={{Msg "seo" "version"}}"></script>-->
+    <script src="/vipsubscribe/js/rem.js"></script>
+    <link rel="stylesheet" href="/vipsubscribe/css/weui.min.css">
+    <link rel="stylesheet" type="text/css" href="/vipsubscribe/css/base.css" />
+    <link rel="stylesheet" type="text/css" href="/vipsubscribe/iconfont/iconfont.css" />
+    <link rel="stylesheet" href="/vipsubscribe/css/public.css">
+    <link rel="stylesheet" href="/vipsubscribe/css/choose_area.css">
+    {{include "/common/weixin.html"}}
 	<script src="/vipsubscribe/js/share.js?v={{Msg "seo" "version"}}"></script>
 </head>
 <style type="text/css">
 	body,html {
 		height: 100%;
 	}
+	#choose_area .select-area-box .tab .province .checkbox.half[disabled]{
+        border: 0!important;
+        background: url(/vipsubscribe/image/banxuan_disabled.png) no-repeat center center!important;
+        background-size:cover!important;
+    }
 </style>
 <body>
-	<script type="text/javascript">
-		initShare({{.T.signature}},{{.T.openid}},2,"jy_extend",{{.T.nickname}},{{.T.avatar}});
-	</script>
     <div id="choose_area" >
         <div class="result">
             <!-- 首次购买 显示"已选择" -----  升级订阅显示"已新增" -->
-            <p class="result_text line_two"> 已新增:<span class="result_name"></span>
-                <a href="javascript:;" class="detail">详情</a>
-            </p>
-            <a href="javascript:;" class="packup" style="display: none;">收起</a>
+            <p class="result_text already"><span>已购买:</span><span class="buy-set-info"></span></p>
+            <p class="result_text add_new"><span>升级新增:</span><span class="added-info"></span></p>
         </div>
         <div class="form">
             <div class="select-area-box">
@@ -364,13 +363,12 @@
         </div>
         <div class="tips_btn">
             <div class="tips_discount">
-                <!--<div class="tips_d_money" style="display: block">&yen;38</div>-->
-                <div class="tips_d_text citys">已选择4个市,建议购买“全省”。</div>
-                <div class="tips_d_text all">已选择10个省,建议购买“全国”。</div>
+                <!--<div class="tips_d_money" style="display: block">&yen;1</div>-->
+                <div class="tips_d_text">已选择3个市,建议购买“全省”</div>
             </div>
             <div class="btns">
-                <button class="reset-btn">重置</button>
-                <button class="save-btn">确认</button>
+                <button class="reset-btn" disabled>重置</button>
+                <button class="save-btn" disabled>确认</button>
             </div>
         </div>
         <div class="slide">
@@ -393,489 +391,9 @@
         </div>
     </div>
     <script src="/vipsubscribe/js/jquery-2.1.4.js?v={{Msg "seo" "version"}}"></script>
-    <!--<script src="/vipsubscribe/js/fastclick.js?v={{Msg "seo" "version"}}"></script>-->
     <script src="/vipsubscribe/js/mapJSON.js?v={{Msg "seo" "version"}}"></script>
     <script src="/vipsubscribe/js/common.js?v={{Msg "seo" "version"}}"></script>
-    <script>
-    	//已购买
-    	var buystr = "";
-    	var areaData = {};
-        $DoPost("/subscribepay/renewUpgrade/getBuyMsg", {}, function (data) {
-        	if(data){
-            	buystr = data.area;
-            	areaData["data"] = {
-            		"area" : data.area,
-            		"buyset" : data.buyset, 
-            	}
-            	console.log(areaData)
-        	}
-        }, false);
-//      console.log(buystr)
-      var AreaChoose={
-        selectObj:{},//已选择,未购买城市;
-        buyObj:{},//已购买
-        selectedIndustryArr:["一个行业"],//计算价格临时变量
-        timeSelect:[1,2],//计算价格临时变量 timeSelect[0]时长  timeSelect[1] 1:年 2:月
-        vipSubisTrial:false,
-        inintData:function(){
-          //已选择
-          try{
-            let select =sessionStorage.getItem("vipSubSelectAreaUpgrade");
-            if(select){
-              this.selectObj=JSON.parse(select);
-            }
-            if(sessionStorage.getItem("vipSubSelectIndustryUpgrade")){
-              this.selectedIndustryArr=JSON.parse(sessionStorage.getItem("vipSubSelectIndustryUpgrade"));
-            }
-            if(sessionStorage.getItem("vipSubSelectTime")){
-              this.timeSelect=JSON.parse(sessionStorage.getItem("vipSubSelectTime"));
-            }
-            //
-            this.buyObj = buystr;
-            if(checkObj(buystr)){
-            	this.buyObj = {"全国":[]}
-            }
-//          console.log(this.buyObj)
-            //是否试用界面
-            if(sessionStorage.getItem("vipSubisTrial")) this.vipSubisTrial=true;
-          }catch(e){
-            console.log(e);
-            this.selectObj={};
-          }
-        },
-        inintPage:function(){//初始化省份城市选项   
-          $(".select-area-box ul li:not('.index')").each(function () {
-              var text = $(this).find(".province").text().trim()
-              var data = null
-              chinaMapJSON.some(function (v) {
-                  data = v
-                  return v.name.indexOf(text) !== -1
-              })
-              var box = $(this).find('div.tab_content')
-              var html = AreaChoose.createMoreCity(data.city)
-              box.html(html)
-          })
-        },
-        createMoreCity:function(arr){
-          var tempHtml = arr.map(function (v) {
-                return '<button class="city">' + v.name + '</button>'
-            }).join('')
-            return tempHtml
-        },
-        showSelected:function(canClick){ //回显已选择
-        	var ran = "";
-            if(canClick){
-            	ran = this.selectObj;
-            }else{
-            	ran = this.buyObj;
-            }    
-            for(var province in ran) {
-      			let citys=ran[province]
-	            if(citys.length>0){//地市
-	                this.selectCity(citys,canClick)
-	            }else{//省份
-	                this.selectProvince(province,canClick)
-	            }
-	        }
-        },
-        selectProvince:function(province,canClick){ //设置选中省份 province 省份
-          $($('.tab .province')).each(function (index, dom) {
-            if (province == $.trim($(dom).text())) {
-              $(".checkbox.other").attr("checked", false); //取消全国选中
-              $(dom).children('.checkbox').attr({"checked": true,"disabled":!canClick});//选中此省份
-              if(canClick){
-              	$(dom).parents().siblings('.tab_content').find(".city").addClass("active").attr({"disabled":!canClick});
-              }else{
-              	$(dom).parents().siblings('.tab_content').find(".city").attr({"disabled":!canClick});
-              }
-            }
-            if(!canClick){
-            	if(province === "全国"){
-	            	$('.tab .province').each(function(){
-	            		$(this).children('.checkbox').attr({"checked": true,"disabled":!canClick});//选中此省份
-	            	});
-	            	$('.tab_content .city').each(function(){
-	            		$(this).attr("disabled",!canClick);
-	            	});
-	            }
-            }
-          })
-        },
-        selectCity:function(citys,canClick){ //设置选中城市
-          citys.forEach(v => {
-            $($('.tab_content .city')).each(function (index, dom) {
-                if (v == $(dom).text()) {
-                    $(".checkbox.other").attr("checked", false); //取消全国选中
-                    if(canClick){
-                    	$(dom).addClass('active').attr('disabled', !canClick).parents().siblings('.tab')
-                        .addClass('selected').children('.province').children('.checkbox').attr({
-                            "checked": true
-                        })
-                    }else{
-                    	$(dom).attr('disabled', !canClick).parents().siblings('.tab')
-                        .addClass('selected').children('.province').children('.checkbox').attr({
-                            "checked": true,
-                            "disabled": "disabled"
-                        })
-                        $(dom).parents().slideDown(500);
-                    }
-                }
-            })
-          })
-        },
-        getResult:function(){   /* 选中结果 */
-          //如果选中所有,则转为全国
-          if($(".city").length==$(".city.active").length){
-            $(".checkbox.other").trigger("click");
-            return
-          }
-          this.selectObj = {};
-          $('.result_name').empty()
-          var data = []; //定义一个总数组
-          var cityArr =[]; //定义一个选中城市数组
-          var provincesArr = [];
-          var val = $('.other').parents('.province').text().trim();
-          if ($('.other').is(':checked')) {
-            // data.push(val)
-            data =[{name:val,children:[]}] //全国
-          }
-          $(".tab_content").find(".city.active:not('[disabled]')").each(function () {
-              var length = $(this).parent('.tab_content').find('.city').length; //省份下城市的length
-              var activeLeng = $(this).parent('.tab_content').find('.city.active').length; //省份下选中城市的length
-              let arr =[];
-              // 判断省份下的城市是否等于选中的城市长度,相等就是全部选中
-              if (length == activeLeng) {
-                  $('.tips_btn .tips_d_text.citys').hide();
-                  // data.push($(this).parent('.tab_content').siblings('.tab:not(.whole)').children('.province').text().trim())
-                  let province = $(this).parent('.tab_content').siblings('.tab:not(.whole)').children('.province').text().trim();
-                  data.push({
-                      name:province,
-                      children:[]
-                  });
-                  provincesArr.push(province);
-              } else { 
-                  let province = $(this).parent('.tab_content').siblings('.tab:not(.whole)').children('.province').text().trim();
-                  let city = $(this).html()
-                  arr.push({name:city,parent:province})
-                  for(let i =0;i<arr.length;i++){
-                      let obj ={};
-                      obj.name = arr[i].name;
-                      obj.parent = arr[i].parent;
-                      cityArr.push(obj)
-                  }
-                  data.push({
-                      name:province,
-                      children:cityArr
-                  })
-              }
-              if(activeLeng > 0){
-              	$(".tips_btn .btns .reset-btn").removeAttr("disabled");
-              	$(".tips_btn .btns .save-btn").removeAttr("disabled");
-              }
-          })
-          //数组对象去重
-          let obj = {};
-          data = data.reduce((cur,next) =>{
-              obj[next.name] ? "" : obj[next.name] = true && cur.push(next);
-              return cur
-          },[]);
-          
-          // 数组筛选
-          let result = data.map(v =>{
-              let filterArr = v.children.filter(s =>{
-                 return s.parent === v.name
-              })
-              return {
-                  name:v.name,
-                  children:filterArr
-              }
-          })
-          var html = '';
-          for (var i = 0; i < result.length; i++) {
-              let children = result[i].children;
-              if( children.length >0){
-                  // 判断每个省份下选中的城市长度,当大于等于4的时候 弹出"选择全省更划算的弹窗"
-                  let childrenArr=[];
-                  if (children.length >= 3 && !this.vipSubisTrial) {
-                      $('.tips_btn .tips_d_text.citys').text("已选择"+children.length+"个市,建议购买“全省”");
-                      $('.tips_btn .tips_d_text.citys').show();
-                  }else{
-                  		$('.tips_btn .tips_d_text.citys').hide();
-                  }
-                  html += `${result[i].name}(`
-                  for(var j = 0;j < children.length;j++){
-                      childrenArr.push(children[j].name)
-                      if (j != children.length - 1) {
-                          html += `${children[j].name}、`
-                      } else {
-                          html += `${children[j].name}`
-                      }
-                  }
-                  if(i !=result.length -1){
-                      html += `)、`
-                  }else{
-                      html += `)`
-                  }
-                  this.selectObj[result[i].name]=childrenArr;//
-              }else{
-                  if(i !=result.length -1){
-                      html += `${result[i].name}、`
-                  }else{
-                      html += `${result[i].name}`
-                  }
-                  this.selectObj[result[i].name]=[];//
-              }
-          }
-          	for (var x = 0; x < provincesArr.length; x++) {
-	            for (var j =x+1; j <provincesArr.length; ) {
-	                if (provincesArr[x] === provincesArr[j]){
-	                    provincesArr.splice(j, 1);
-	                }
-	                else j++;
-	            }
-	        }
-          	if(provincesArr.length > 9){
-          		$('.tips_d_text.all').text("已选择"+provincesArr.length+"个省,建议购买“全国”");
-          		$('.tips_d_text.all').show();
-          		$('.tips_d_text.citys').hide();
-          	}else{
-          		$('.tips_d_text.all').hide();
-          	}
-//        console.log("this.selectObj:",this.selectObj)
-          $('.result_name').append(html)
-          AreaChoose.isOpen()
-        },
-        submitArea:function(){
-          let addCity = $('.result_name').text(); //新增的城市
-          sessionStorage.setItem("vipSubSelectAreaUpgrade",JSON.stringify(AreaChoose.selectObj));
-          history.go(-1);
-        },
-        isAllSelected:function(){
-          var _f = true
-          $($('.tab_content .city')).each(function (index, dom) {
-              if ($(dom).hasClass('active')) {
-                  _f = false
-                  $('.other').prop('checked', false);
-              }
-          })
-          // 如果循环结束仍为true说明 没有全部都被选中
-          if (_f) {
-//            $('.other').prop('checked', true);
-				$(".tips_btn .btns .reset-btn").attr("disabled","disabled");
-        		$(".tips_btn .btns .save-btn").attr("disabled","disabled");
-          }
-        },
-        isOpen:function(){
-          let pHeight = $('.result_text').height()
-          let minHeight = $('.result_text').css('min-height')
-          let rows = Math.round(Math.round(pHeight)/ parseFloat(minHeight));
-          $(".select-area-box .area-list").css("margin-top",$('.result_text').height()+20);
-//        console.log("高度:"+ pHeight,"最小高度"+ minHeight,"行数:" + rows)
-          if(rows == 1){
-              if(length >= 50){
-                  $('.detail').show()
-                  $('.packup').hide()
-              }else{
-                  $('.detail').hide()
-                  $('.packup').hide()
-              }
-          }else if(rows == 2){
-//            console.log($('.result_name').html().trim().length)
-              let length = $('.result_name').html().trim().length;
-              if(length >= 50){
-                  $('.detail').show()
-                  $('.packup').hide()
-              }else{
-                  $('.detail').hide()
-                  $('.packup').hide()
-              }
-              
-          } else{
-              $('.packup').show()
-              $('.detail').hide()
-          }
-        },
-        inintClick:function(){
-//      	$('.tab_content').each(function(){
-//        		AreaChoose.showSelected(false);
-//      	})
-          $('.detail').click(function () {  
-                $('.result_text').removeClass('line_two')
-                $(".result").css("padding-bottom","0.3rem")
-                $(this).hide();
-                $('.packup').show()
-                $(".select-area-box .area-list").css("margin-top",$('.result_text').height()+20);
-            })
-            $('.packup').click(function () { 
-                $(".result").css("padding-bottom","0.2rem")
-                $('.result_text').addClass('line_two')
-                $(this).hide();
-                $('.detail').show()
-                $(".select-area-box .area-list").css("margin-top",$('.result_text').height()+20);
-            })
-            $("body").on('click','.slide a',function(){
-                var s = $(this).html()
-                if(s == '#'){
-                    return;
-                }
-                document.querySelector('#' + s).scrollIntoView({block:'center'});
-            })
-          $(".select-area-box .tab:not(.municipality)").on('click', function (event) {
-                if($(this).next('.tab_content:not(:animated)').css("display") == "block"){
-                    $(this).children().children('i').css({
-                        "display":"inline-block",
-                        "transform":"rotate(0)"
-                    })
-                }else{
-                    $(this).children().children('i').css({
-                        "display":"inline-block",
-                        "transform":"rotate(-180deg)"
-                    })
-                }
-                $(this).toggleClass('selected').next('.tab_content:not(:animated)').stop(true, true).slideToggle()
-                $(this).parent().siblings().children('.tab').removeClass('selected');
-                
-            })
-            $('.checkbox').click(function (e) {  
-                e.stopPropagation();
-            })
-            $('.province .checkbox:not(.other)').on('change', function () {
-                var isCheckded = $(this).is(':checked')
-                if (isCheckded) {
-                    $(this).parents('.tab').siblings('.tab_content').find('.city').addClass('active')
-                    $(this).parents('.tab').siblings('.tab_content').find('.city[disabled]').removeClass('active')
-                    AreaChoose.isAllSelected()
-                    AreaChoose.getResult() 
-                    AreaChoose.showSelected(false);
-                } else {
-                    $(this).parents('.tab').siblings('.tab_content').find('.city').removeClass(
-                        'active')
-                    $(this).parents('.tab').siblings('.tab_content').find('.city').attr('disabled',false);    
-                    AreaChoose.isAllSelected()
-                    AreaChoose.getResult() 
-                    AreaChoose.showSelected(false);
-                }
-            })
-
-            //执行已购买城市函操作dom函数
-            $('.tab_content').on('click', '.city', function () {
-            	AreaChoose.showSelected(false);
-                $(this).toggleClass('active')
-                var isActive = $(this).parent().find('.city.active').length
-                if (isActive) {
-                    var input = $(this).parents('li').find('input.checkbox')
-                    window.input = input
-                    input.prop('checked', true)
-                    AreaChoose.isAllSelected()
-                    AreaChoose.getResult() 
-                } else {
-                    $(this).parent('div').siblings('.tab').children().children('.checkbox').prop(
-                        'checked', false)
-                    AreaChoose.isAllSelected()
-                    AreaChoose.getResult() 
-                }
-            })
-
-            $('.other').on('change', function () { //选择全国
-              	AreaChoose.reset();
-            })
-
-            $('.save-btn').click(function () {  // 提交
-                AreaChoose.submitArea();              
-            })
-            $('.reset-btn').click(function () {  //重置
-//            if(!$(".other").is(':checked')){
-//              $(".other").trigger("click");
-//            }
-				$('.tab:not(.whole):not(.tab[disabled])').removeClass('selected').children('.province').find(
-                    'input').prop({
-                    'checked': false,
-                    "disabled": false
-                });
-                $('.tab_content').find('.city:not(.city[disabled])').removeClass('active').attr({
-                    "disabled": false,
-                    "checked": false
-                })
-				AreaChoose.showSelected(false);
-				AreaChoose.getResult();
-				sessionStorage.removeItem("vipSubSelectAreaUpgrade");
-            })
-            //
-            if(sessionStorage.vipSubSelectAreaUpgrade!==undefined&&sessionStorage.vipSubSelectAreaUpgrade!==""){
-            	let areas = JSON.parse(sessionStorage.vipSubSelectAreaUpgrade);
-            	for(var province in areas){
-            		if(province === "全国"){
-              			$(".other").prop("checked",true);
-              			AreaChoose.reset();
-            		}
-            	}
-            }
-        },
-        reset:function(){
-           var checked = $(".other").is(':checked');
-            if (checked) {
-                $('.tab_content').slideUp(500)
-                $('.tab span i').css({
-                    "display":"inline-block",
-                    "transform":"rotate(0)"
-                })
-                $('.tab:not(.whole):not(.tab[disabled])').removeClass('selected').children('.province').find(
-                    'input').prop({
-                    'checked': false,
-                    "disabled": false
-                });
-                $('.tab_content').find('.city:not(.city[disabled])').removeClass('active').attr({
-                    "disabled": false,
-                    "checked": false
-                })
-                AreaChoose.getResult();
-                $(".tips_btn .btns .reset-btn").removeAttr("disabled");
-            	$(".tips_btn .btns .save-btn").removeAttr("disabled");
-            }else{
-            	AreaChoose.showSelected(false);
-                AreaChoose.getResult();
-                $(".tips_btn .btns .reset-btn").attr("disabled","disabled");
-            	$(".tips_btn .btns .save-btn").attr("disabled","disabled");
-            }
-        }
-      }
-      
-      $(function () {
-            AreaChoose.isOpen()
-            AreaChoose.inintData(); //初始化 已选择和已购买数据
-            AreaChoose.inintPage(); //初始化城市数据
-            AreaChoose.showSelected(false);
-            AreaChoose.showSelected(true);//回显已选择
-            /* 判断已购买的城市 在不在 全部城市里面,在,将按钮置灰,不可点击 */
-
-            AreaChoose.getResult();
-            AreaChoose.inintClick();
-        })
-      //
-        //
-	    function checkObj(obj) {
-		    //检验数组
-		    if (Array.prototype.isPrototypeOf(obj) && obj.length === 0) {
-		        return true;
-		    }
-		    //检验对象
-		    if (Object.prototype.isPrototypeOf(obj) && Object.keys(obj).length === 0) {
-		        return true;
-		    }
-		    return false;
-		}
-	    //
-	    if($(".result_name").text()===""){
-	    	$(".tips_btn .btns .reset-btn").attr("disabled","disabled");
-        	$(".tips_btn .btns .save-btn").attr("disabled","disabled");
-	    }
-	    
-	    if(sessionStorage.vipSubSelectAreaUpgrade!==undefined && sessionStorage.vipSubSelectAreaUpgrade!==""){
-	    	$(".tips_btn .btns .reset-btn").removeAttr("disabled");
-            $(".tips_btn .btns .save-btn").removeAttr("disabled");
-	    }
-
-    </script>
+    <script src="/vipsubscribe/js/updateArea.js?v={{Msg "seo" "version"}}14"></script>
 </body>
 
 </html>

+ 881 - 0
src/web/templates/weixin/vipsubscribe/choose_area_upgrades.html

@@ -0,0 +1,881 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+    <meta charset="utf-8">
+    <title>区域选择</title>
+    <meta name="viewport" content="initial-scale=1, maximum-scale=1">
+    <meta name="apple-mobile-web-app-capable" content="yes">
+    <meta name="apple-mobile-web-app-status-bar-style" content="black">
+    <script src="/vipsubscribe/js/rem.js?v={{Msg "seo" "version"}}"></script>
+    <link rel="stylesheet" href="/vipsubscribe/css/weui.min.css?v={{Msg "seo" "version"}}">
+    <link rel="stylesheet" type="text/css" href="/vipsubscribe/css/base.css?v={{Msg "seo" "version"}}" />
+    <link rel="stylesheet" type="text/css" href="/vipsubscribe/iconfont/iconfont.css?v={{Msg "seo" "version"}}" />
+    <link rel="stylesheet" href="/vipsubscribe/css/public.css?v={{Msg "seo" "version"}}">
+    <link rel="stylesheet" href="/vipsubscribe/css/choose_area.css?v={{Msg "seo" "version"}}4">
+	{{include "/common/weixin.html"}}
+	<!--<script src="{{Msg "seo" "cdn"}}/wxswordfish/share.js?v={{Msg "seo" "version"}}"></script>-->
+	<script src="/vipsubscribe/js/share.js?v={{Msg "seo" "version"}}"></script>
+</head>
+<style type="text/css">
+	body,html {
+		height: 100%;
+	}
+</style>
+<body>
+	<script type="text/javascript">
+		initShare({{.T.signature}},{{.T.openid}},2,"jy_extend",{{.T.nickname}},{{.T.avatar}});
+	</script>
+    <div id="choose_area" >
+        <div class="result">
+            <!-- 首次购买 显示"已选择" -----  升级订阅显示"已新增" -->
+            <p class="result_text line_two"> 已新增:<span class="result_name"></span>
+                <a href="javascript:;" class="detail">详情</a>
+            </p>
+            <a href="javascript:;" class="packup" style="display: none;">收起</a>
+        </div>
+        <div class="form">
+            <div class="select-area-box">
+                <ul class="area-list">
+                    <li>
+                        <div class="tab whole">
+                            <div class="province">
+                                <input type="checkbox" class="checkbox other">全国
+                            </div>
+                        </div>
+                    </li>
+                    <li class="index" id="A">A</li>
+                    <li>
+                        <div class="tab">
+                            <div class="province">
+                                <input type="checkbox" class="checkbox">安徽
+                            </div>
+                            <span><i class="icon iconfont">&#xe600;</i></span>
+                        </div>
+                        <div class="tab_content clearfix"></div>
+                    </li>
+                    <li>
+                        <div class="tab municipality">
+                            <div class="province">
+                                <input type="checkbox" class="checkbox">澳门
+                            </div>
+                        </div>
+                        <div class="tab_content clearfix"></div>
+                    </li>
+                    <li class="index" id="B">B</li>
+                    <li>
+                        <div class="tab municipality">
+                            <div class="province">
+                                <input type="checkbox" class="checkbox">北京
+                            </div>
+                        </div>
+                        <div class="tab_content clearfix"></div>
+                    </li>
+                    <li class="index" id="C">C</li>
+                    <li>
+                        <div class="tab municipality">
+                            <div class="province">
+                                <input type="checkbox" class="checkbox">重庆
+                            </div>
+                        </div>
+                        <div class="tab_content clearfix"></div>
+                    </li>
+                    <li class="index" id="F">F</li>
+                    <li>
+                        <div class="tab">
+                            <div class="province">
+                                <input type="checkbox" class="checkbox">福建
+                            </div>
+                            <span><i class="icon iconfont">&#xe600;</i></span>
+                        </div>
+                        <div class="tab_content clearfix"></div>
+                    </li>
+                    <li class="index" id="G">G</li>
+                    <li>
+                        <div class="tab">
+                            <div class="province">
+                                <input type="checkbox" class="checkbox">广东
+                            </div>
+                            <span><i class="icon iconfont">&#xe600;</i></span>
+                        </div>
+                        <div class="tab_content clearfix"></div>
+                    </li>
+                    <li>
+                        <div class="tab">
+                            <div class="province">
+                                <input type="checkbox" class="checkbox">广西
+                            </div>
+                            <span><i class="icon iconfont">&#xe600;</i></span>
+                        </div>
+                        <div class="tab_content clearfix"></div>
+                    </li>
+                    <li>
+                        <div class="tab">
+                            <div class="province">
+                                <input type="checkbox" class="checkbox">贵州
+                            </div>
+                            <span><i class="icon iconfont">&#xe600;</i></span>
+                        </div>
+                        <div class="tab_content clearfix"></div>
+                    </li>
+                    <li>
+                        <div class="tab">
+                            <div class="province">
+                                <input type="checkbox" class="checkbox">甘肃
+                            </div>
+                            <span><i class="icon iconfont">&#xe600;</i></span>
+                        </div>
+                        <div class="tab_content clearfix"></div>
+                    </li>
+                    <li class="index" id="H">H</li>
+                    <li>
+                        <div class="tab">
+                            <div class="province">
+                                <input type="checkbox" class="checkbox">河北
+                            </div>
+                            <span><i class="icon iconfont">&#xe600;</i></span>
+                        </div>
+                        <div class="tab_content clearfix"></div>
+                    </li>
+                    <li>
+                        <div class="tab">
+                            <div class="province">
+                                <input type="checkbox" class="checkbox">湖北
+                            </div>
+                            <span><i class="icon iconfont">&#xe600;</i></span>
+                        </div>
+                        <div class="tab_content clearfix"></div>
+                    </li>
+                    <li>
+                        <div class="tab">
+                            <div class="province">
+                                <input type="checkbox" class="checkbox">黑龙江
+                            </div>
+                            <span><i class="icon iconfont">&#xe600;</i></span>
+                        </div>
+                        <div class="tab_content clearfix"></div>
+                    </li>
+                    <li>
+                        <div class="tab">
+                            <div class="province">
+                                <input type="checkbox" class="checkbox">海南
+                            </div>
+                            <span><i class="icon iconfont">&#xe600;</i></span>
+                        </div>
+                        <div class="tab_content clearfix"></div>
+                    </li>
+                    <li>
+                        <div class="tab">
+                            <div class="province">
+                                <input type="checkbox" class="checkbox">河南
+                            </div>
+                            <span><i class="icon iconfont">&#xe600;</i></span>
+                        </div>
+                        <div class="tab_content clearfix"></div>
+                    </li>
+                    <li>
+                        <div class="tab">
+                            <div class="province">
+                                <input type="checkbox" class="checkbox">湖南
+                            </div>
+                            <span><i class="icon iconfont">&#xe600;</i></span>
+                        </div>
+                        <div class="tab_content clearfix"></div>
+                    </li>
+                    <p class="index" id="J">J</p>
+                    <li>
+                        <div class="tab">
+                            <div class="province">
+                                <input type="checkbox" class="checkbox">吉林
+                            </div>
+                            <span><i class="icon iconfont">&#xe600;</i></span>
+                        </div>
+                        <div class="tab_content clearfix"></div>
+                    </li>
+                    <li>
+                        <div class="tab">
+                            <div class="province">
+                                <input type="checkbox" class="checkbox">江苏
+                            </div>
+                            <span><i class="icon iconfont">&#xe600;</i></span>
+                        </div>
+                        <div class="tab_content clearfix"></div>
+                    </li>
+                    <li>
+                        <div class="tab">
+                            <div class="province">
+                                <input type="checkbox" class="checkbox">江西
+                            </div>
+                            <span><i class="icon iconfont">&#xe600;</i></span>
+                        </div>
+                        <div class="tab_content clearfix"></div>
+                    </li>
+                    <li class="index" id="L">L</li>
+                    <li>
+                        <div class="tab">
+                            <div class="province">
+                                <input type="checkbox" class="checkbox">辽宁
+                            </div>
+                            <span><i class="icon iconfont">&#xe600;</i></span>
+                        </div>
+                        <div class="tab_content clearfix"></div>
+                    </li>
+                    <li class="index" id="N">N</li>
+                    <li>
+                        <div class="tab">
+                            <div class="province">
+                                <input type="checkbox" class="checkbox">内蒙古
+                            </div>
+                            <span><i class="icon iconfont">&#xe600;</i></span>
+                        </div>
+                        <div class="tab_content clearfix"></div>
+                    </li>
+                    <li>
+                        <div class="tab">
+                            <div class="province">
+                                <input type="checkbox" class="checkbox">宁夏
+                            </div>
+                            <span><i class="icon iconfont">&#xe600;</i></span>
+                        </div>
+                        <div class="tab_content clearfix"></div>
+                    </li>
+                    <li class="index" id="Q">Q</li>
+                    <li>
+                        <div class="tab">
+                            <div class="province">
+                                <input type="checkbox" class="checkbox">青海
+                            </div>
+                            <span><i class="icon iconfont">&#xe600;</i></span>
+                        </div>
+                        <div class="tab_content clearfix"></div>
+                    </li>
+                    <li class="index" id="S">S</li>
+                    <li>
+                        <div class="tab">
+                            <div class="province">
+                                <input type="checkbox" class="checkbox">山西
+                            </div>
+                            <span><i class="icon iconfont">&#xe600;</i></span>
+                        </div>
+                        <div class="tab_content clearfix"></div>
+                    </li>
+                    <li>
+                        <div class="tab">
+                            <div class="province">
+                                <input type="checkbox" class="checkbox">陕西
+                            </div>
+                            <span><i class="icon iconfont">&#xe600;</i></span>
+                        </div>
+                        <div class="tab_content clearfix"></div>
+                    </li>
+                    <li>
+                        <div class="tab municipality">
+                            <div class="province">
+                                <input type="checkbox" class="checkbox">上海
+                            </div>
+                        </div>
+                        <div class="tab_content clearfix"></div>
+                    </li>
+                    <li>
+                        <div class="tab">
+                            <div class="province">
+                                <input type="checkbox" class="checkbox">山东
+                            </div>
+                            <span><i class="icon iconfont">&#xe600;</i></span>
+                        </div>
+                        <div class="tab_content clearfix"></div>
+                    </li>
+                    <li>
+                        <div class="tab">
+                            <div class="province">
+                                <input type="checkbox" class="checkbox">四川
+                            </div>
+                            <span><i class="icon iconfont">&#xe600;</i></span>
+                        </div>
+                        <div class="tab_content clearfix"></div>
+                    </li>
+                    <li class="index" id="T">T</li>
+                    <li>
+                        <div class="tab municipality">
+                            <div class="province">
+                                <input type="checkbox" class="checkbox">天津
+                            </div>
+                        </div>
+                        <div class="tab_content clearfix"></div>
+                    </li>
+                    <li>
+                        <div class="tab municipality">
+                            <div class="province">
+                                <input type="checkbox" class="checkbox">台湾
+                            </div>
+                        </div>
+                        <div class="tab_content clearfix"></div>
+                    </li>
+                    <li class="index" id="X">X</li>
+                    <li>
+                        <div class="tab">
+                            <div class="province">
+                                <input type="checkbox" class="checkbox">西藏
+                            </div>
+                            <span><i class="icon iconfont">&#xe600;</i></span>
+                        </div>
+                        <div class="tab_content clearfix"></div>
+                    </li>
+                    <li>
+                        <div class="tab">
+                            <div class="province">
+                                <input type="checkbox" class="checkbox">新疆
+                            </div>
+                            <span><i class="icon iconfont">&#xe600;</i></span>
+                        </div>
+                        <div class="tab_content clearfix"></div>
+                    </li>
+                    <li>
+                        <div class="tab municipality">
+                            <div class="province">
+                                <input type="checkbox" class="checkbox">香港
+                            </div>
+                        </div>
+                        <div class="tab_content clearfix"></div>
+                    </li>
+                    <li class="index" id="Y">Y</li>
+                    <li>
+                        <div class="tab">
+                            <div class="province">
+                                <input type="checkbox" class="checkbox">云南
+                            </div>
+                            <span><i class="icon iconfont">&#xe600;</i></span>
+                        </div>
+                        <div class="tab_content clearfix"></div>
+                    </li>
+                    <li class="index" id="Z">Z</li>
+                    <li>
+                        <div class="tab">
+                            <div class="province">
+                                <input type="checkbox" class="checkbox">浙江
+                            </div>
+                            <span class="down-icon"><i class="icon iconfont">&#xe600;</i></span>
+                        </div>
+                        <div class="tab_content clearfix"></div>
+                    </li>
+                </ul>
+                
+            </div>
+        </div>
+        <div class="tips_btn">
+            <div class="tips_discount">
+                <!--<div class="tips_d_money" style="display: block">&yen;38</div>-->
+                <div class="tips_d_text citys">已选择4个市,建议购买“全省”。</div>
+                <div class="tips_d_text all">已选择10个省,建议购买“全国”。</div>
+            </div>
+            <div class="btns">
+                <button class="reset-btn">重置</button>
+                <button class="save-btn">确认</button>
+            </div>
+        </div>
+        <div class="slide">
+            <a href="javascript:;">#</a>
+            <a href="javascript:;">A</a>
+            <a href="javascript:;">B</a>
+            <a href="javascript:;">C</a>
+            <a href="javascript:;">F</a>
+            <a href="javascript:;">G</a>
+            <a href="javascript:;">H</a>
+            <a href="javascript:;">J</a>
+            <a href="javascript:;">L</a>
+            <a href="javascript:;">N</a>
+            <a href="javascript:;">Q</a>
+            <a href="javascript:;">S</a>
+            <a href="javascript:;">T</a>
+            <a href="javascript:;">X</a>
+            <a href="javascript:;">Y</a>
+            <a href="javascript:;">Z</a>
+        </div>
+    </div>
+    <script src="/vipsubscribe/js/jquery-2.1.4.js?v={{Msg "seo" "version"}}"></script>
+    <!--<script src="/vipsubscribe/js/fastclick.js?v={{Msg "seo" "version"}}"></script>-->
+    <script src="/vipsubscribe/js/mapJSON.js?v={{Msg "seo" "version"}}"></script>
+    <script src="/vipsubscribe/js/common.js?v={{Msg "seo" "version"}}"></script>
+    <script>
+    	//已购买
+    	var buystr = "";
+    	var areaData = {};
+        $DoPost("/subscribepay/renewUpgrade/getBuyMsg", {}, function (data) {
+        	if(data){
+            	buystr = data.area;
+            	areaData["data"] = {
+            		"area" : data.area,
+            		"buyset" : data.buyset, 
+            	}
+            	console.log(areaData)
+        	}
+        }, false);
+//      console.log(buystr)
+      var AreaChoose={
+        selectObj:{},//已选择,未购买城市;
+        buyObj:{},//已购买
+        selectedIndustryArr:["一个行业"],//计算价格临时变量
+        timeSelect:[1,2],//计算价格临时变量 timeSelect[0]时长  timeSelect[1] 1:年 2:月
+        vipSubisTrial:false,
+        inintData:function(){
+          //已选择
+          try{
+            let select =sessionStorage.getItem("vipSubSelectAreaUpgrade");
+            if(select){
+              this.selectObj=JSON.parse(select);
+            }
+            if(sessionStorage.getItem("vipSubSelectIndustryUpgrade")){
+              this.selectedIndustryArr=JSON.parse(sessionStorage.getItem("vipSubSelectIndustryUpgrade"));
+            }
+            if(sessionStorage.getItem("vipSubSelectTime")){
+              this.timeSelect=JSON.parse(sessionStorage.getItem("vipSubSelectTime"));
+            }
+            //
+            this.buyObj = buystr;
+            if(checkObj(buystr)){
+            	this.buyObj = {"全国":[]}
+            }
+//          console.log(this.buyObj)
+            //是否试用界面
+            if(sessionStorage.getItem("vipSubisTrial")) this.vipSubisTrial=true;
+          }catch(e){
+            console.log(e);
+            this.selectObj={};
+          }
+        },
+        inintPage:function(){//初始化省份城市选项   
+          $(".select-area-box ul li:not('.index')").each(function () {
+              var text = $(this).find(".province").text().trim()
+              var data = null
+              chinaMapJSON.some(function (v) {
+                  data = v
+                  return v.name.indexOf(text) !== -1
+              })
+              var box = $(this).find('div.tab_content')
+              var html = AreaChoose.createMoreCity(data.city)
+              box.html(html)
+          })
+        },
+        createMoreCity:function(arr){
+          var tempHtml = arr.map(function (v) {
+                return '<button class="city">' + v.name + '</button>'
+            }).join('')
+            return tempHtml
+        },
+        showSelected:function(canClick){ //回显已选择
+        	var ran = "";
+            if(canClick){
+            	ran = this.selectObj;
+            }else{
+            	ran = this.buyObj;
+            }    
+            for(var province in ran) {
+      			let citys=ran[province]
+	            if(citys.length>0){//地市
+	                this.selectCity(citys,canClick)
+	            }else{//省份
+	                this.selectProvince(province,canClick)
+	            }
+	        }
+        },
+        selectProvince:function(province,canClick){ //设置选中省份 province 省份
+          $($('.tab .province')).each(function (index, dom) {
+            if (province == $.trim($(dom).text())) {
+              $(".checkbox.other").attr("checked", false); //取消全国选中
+              $(dom).children('.checkbox').attr({"checked": true,"disabled":!canClick});//选中此省份
+              if(canClick){
+              	$(dom).parents().siblings('.tab_content').find(".city").addClass("active").attr({"disabled":!canClick});
+              }else{
+              	$(dom).parents().siblings('.tab_content').find(".city").attr({"disabled":!canClick});
+              }
+            }
+            if(!canClick){
+            	if(province === "全国"){
+	            	$('.tab .province').each(function(){
+	            		$(this).children('.checkbox').attr({"checked": true,"disabled":!canClick});//选中此省份
+	            	});
+	            	$('.tab_content .city').each(function(){
+	            		$(this).attr("disabled",!canClick);
+	            	});
+	            }
+            }
+          })
+        },
+        selectCity:function(citys,canClick){ //设置选中城市
+          citys.forEach(v => {
+            $($('.tab_content .city')).each(function (index, dom) {
+                if (v == $(dom).text()) {
+                    $(".checkbox.other").attr("checked", false); //取消全国选中
+                    if(canClick){
+                    	$(dom).addClass('active').attr('disabled', !canClick).parents().siblings('.tab')
+                        .addClass('selected').children('.province').children('.checkbox').attr({
+                            "checked": true
+                        })
+                    }else{
+                    	$(dom).attr('disabled', !canClick).parents().siblings('.tab')
+                        .addClass('selected').children('.province').children('.checkbox').attr({
+                            "checked": true,
+                            "disabled": "disabled"
+                        })
+                        $(dom).parents().slideDown(500);
+                    }
+                }
+            })
+          })
+        },
+        getResult:function(){   /* 选中结果 */
+          //如果选中所有,则转为全国
+          if($(".city").length==$(".city.active").length){
+            $(".checkbox.other").trigger("click");
+            return
+          }
+          this.selectObj = {};
+          $('.result_name').empty()
+          var data = []; //定义一个总数组
+          var cityArr =[]; //定义一个选中城市数组
+          var provincesArr = [];
+          var val = $('.other').parents('.province').text().trim();
+          if ($('.other').is(':checked')) {
+            // data.push(val)
+            data =[{name:val,children:[]}] //全国
+          }
+          $(".tab_content").find(".city.active:not('[disabled]')").each(function () {
+              var length = $(this).parent('.tab_content').find('.city').length; //省份下城市的length
+              var activeLeng = $(this).parent('.tab_content').find('.city.active').length; //省份下选中城市的length
+              let arr =[];
+              // 判断省份下的城市是否等于选中的城市长度,相等就是全部选中
+              if (length == activeLeng) {
+                  $('.tips_btn .tips_d_text.citys').hide();
+                  // data.push($(this).parent('.tab_content').siblings('.tab:not(.whole)').children('.province').text().trim())
+                  let province = $(this).parent('.tab_content').siblings('.tab:not(.whole)').children('.province').text().trim();
+                  data.push({
+                      name:province,
+                      children:[]
+                  });
+                  provincesArr.push(province);
+              } else { 
+                  let province = $(this).parent('.tab_content').siblings('.tab:not(.whole)').children('.province').text().trim();
+                  let city = $(this).html()
+                  arr.push({name:city,parent:province})
+                  for(let i =0;i<arr.length;i++){
+                      let obj ={};
+                      obj.name = arr[i].name;
+                      obj.parent = arr[i].parent;
+                      cityArr.push(obj)
+                  }
+                  data.push({
+                      name:province,
+                      children:cityArr
+                  })
+              }
+              if(activeLeng > 0){
+              	$(".tips_btn .btns .reset-btn").removeAttr("disabled");
+              	$(".tips_btn .btns .save-btn").removeAttr("disabled");
+              }
+          })
+          //数组对象去重
+          let obj = {};
+          data = data.reduce((cur,next) =>{
+              obj[next.name] ? "" : obj[next.name] = true && cur.push(next);
+              return cur
+          },[]);
+          
+          // 数组筛选
+          let result = data.map(v =>{
+              let filterArr = v.children.filter(s =>{
+                 return s.parent === v.name
+              })
+              return {
+                  name:v.name,
+                  children:filterArr
+              }
+          })
+          var html = '';
+          for (var i = 0; i < result.length; i++) {
+              let children = result[i].children;
+              if( children.length >0){
+                  // 判断每个省份下选中的城市长度,当大于等于4的时候 弹出"选择全省更划算的弹窗"
+                  let childrenArr=[];
+                  if (children.length >= 3 && !this.vipSubisTrial) {
+                      $('.tips_btn .tips_d_text.citys').text("已选择"+children.length+"个市,建议购买“全省”");
+                      $('.tips_btn .tips_d_text.citys').show();
+                  }else{
+                  		$('.tips_btn .tips_d_text.citys').hide();
+                  }
+                  html += `${result[i].name}(`
+                  for(var j = 0;j < children.length;j++){
+                      childrenArr.push(children[j].name)
+                      if (j != children.length - 1) {
+                          html += `${children[j].name}、`
+                      } else {
+                          html += `${children[j].name}`
+                      }
+                  }
+                  if(i !=result.length -1){
+                      html += `)、`
+                  }else{
+                      html += `)`
+                  }
+                  this.selectObj[result[i].name]=childrenArr;//
+              }else{
+                  if(i !=result.length -1){
+                      html += `${result[i].name}、`
+                  }else{
+                      html += `${result[i].name}`
+                  }
+                  this.selectObj[result[i].name]=[];//
+              }
+          }
+          	for (var x = 0; x < provincesArr.length; x++) {
+	            for (var j =x+1; j <provincesArr.length; ) {
+	                if (provincesArr[x] === provincesArr[j]){
+	                    provincesArr.splice(j, 1);
+	                }
+	                else j++;
+	            }
+	        }
+          	if(provincesArr.length > 9){
+          		$('.tips_d_text.all').text("已选择"+provincesArr.length+"个省,建议购买“全国”");
+          		$('.tips_d_text.all').show();
+          		$('.tips_d_text.citys').hide();
+          	}else{
+          		$('.tips_d_text.all').hide();
+          	}
+//        console.log("this.selectObj:",this.selectObj)
+          $('.result_name').append(html)
+          AreaChoose.isOpen()
+        },
+        submitArea:function(){
+          let addCity = $('.result_name').text(); //新增的城市
+          sessionStorage.setItem("vipSubSelectAreaUpgrade",JSON.stringify(AreaChoose.selectObj));
+          history.go(-1);
+        },
+        isAllSelected:function(){
+          var _f = true
+          $($('.tab_content .city')).each(function (index, dom) {
+              if ($(dom).hasClass('active')) {
+                  _f = false
+                  $('.other').prop('checked', false);
+              }
+          })
+          // 如果循环结束仍为true说明 没有全部都被选中
+          if (_f) {
+//            $('.other').prop('checked', true);
+				$(".tips_btn .btns .reset-btn").attr("disabled","disabled");
+        		$(".tips_btn .btns .save-btn").attr("disabled","disabled");
+          }
+        },
+        isOpen:function(){
+          let pHeight = $('.result_text').height()
+          let minHeight = $('.result_text').css('min-height')
+          let rows = Math.round(Math.round(pHeight)/ parseFloat(minHeight));
+          $(".select-area-box .area-list").css("margin-top",$('.result_text').height()+20);
+//        console.log("高度:"+ pHeight,"最小高度"+ minHeight,"行数:" + rows)
+          if(rows == 1){
+              if(length >= 50){
+                  $('.detail').show()
+                  $('.packup').hide()
+              }else{
+                  $('.detail').hide()
+                  $('.packup').hide()
+              }
+          }else if(rows == 2){
+//            console.log($('.result_name').html().trim().length)
+              let length = $('.result_name').html().trim().length;
+              if(length >= 50){
+                  $('.detail').show()
+                  $('.packup').hide()
+              }else{
+                  $('.detail').hide()
+                  $('.packup').hide()
+              }
+              
+          } else{
+              $('.packup').show()
+              $('.detail').hide()
+          }
+        },
+        inintClick:function(){
+//      	$('.tab_content').each(function(){
+//        		AreaChoose.showSelected(false);
+//      	})
+          $('.detail').click(function () {  
+                $('.result_text').removeClass('line_two')
+                $(".result").css("padding-bottom","0.3rem")
+                $(this).hide();
+                $('.packup').show()
+                $(".select-area-box .area-list").css("margin-top",$('.result_text').height()+20);
+            })
+            $('.packup').click(function () { 
+                $(".result").css("padding-bottom","0.2rem")
+                $('.result_text').addClass('line_two')
+                $(this).hide();
+                $('.detail').show()
+                $(".select-area-box .area-list").css("margin-top",$('.result_text').height()+20);
+            })
+            $("body").on('click','.slide a',function(){
+                var s = $(this).html()
+                if(s == '#'){
+                    return;
+                }
+                document.querySelector('#' + s).scrollIntoView({block:'center'});
+            })
+          $(".select-area-box .tab:not(.municipality)").on('click', function (event) {
+                if($(this).next('.tab_content:not(:animated)').css("display") == "block"){
+                    $(this).children().children('i').css({
+                        "display":"inline-block",
+                        "transform":"rotate(0)"
+                    })
+                }else{
+                    $(this).children().children('i').css({
+                        "display":"inline-block",
+                        "transform":"rotate(-180deg)"
+                    })
+                }
+                $(this).toggleClass('selected').next('.tab_content:not(:animated)').stop(true, true).slideToggle()
+                $(this).parent().siblings().children('.tab').removeClass('selected');
+                
+            })
+            $('.checkbox').click(function (e) {  
+                e.stopPropagation();
+            })
+            $('.province .checkbox:not(.other)').on('change', function () {
+                var isCheckded = $(this).is(':checked')
+                if (isCheckded) {
+                    $(this).parents('.tab').siblings('.tab_content').find('.city').addClass('active')
+                    $(this).parents('.tab').siblings('.tab_content').find('.city[disabled]').removeClass('active')
+                    AreaChoose.isAllSelected()
+                    AreaChoose.getResult() 
+                    AreaChoose.showSelected(false);
+                } else {
+                    $(this).parents('.tab').siblings('.tab_content').find('.city').removeClass(
+                        'active')
+                    $(this).parents('.tab').siblings('.tab_content').find('.city').attr('disabled',false);    
+                    AreaChoose.isAllSelected()
+                    AreaChoose.getResult() 
+                    AreaChoose.showSelected(false);
+                }
+            })
+
+            //执行已购买城市函操作dom函数
+            $('.tab_content').on('click', '.city', function () {
+            	AreaChoose.showSelected(false);
+                $(this).toggleClass('active')
+                var isActive = $(this).parent().find('.city.active').length
+                if (isActive) {
+                    var input = $(this).parents('li').find('input.checkbox')
+                    window.input = input
+                    input.prop('checked', true)
+                    AreaChoose.isAllSelected()
+                    AreaChoose.getResult() 
+                } else {
+                    $(this).parent('div').siblings('.tab').children().children('.checkbox').prop(
+                        'checked', false)
+                    AreaChoose.isAllSelected()
+                    AreaChoose.getResult() 
+                }
+            })
+
+            $('.other').on('change', function () { //选择全国
+              	AreaChoose.reset();
+            })
+
+            $('.save-btn').click(function () {  // 提交
+                AreaChoose.submitArea();              
+            })
+            $('.reset-btn').click(function () {  //重置
+//            if(!$(".other").is(':checked')){
+//              $(".other").trigger("click");
+//            }
+				$('.tab:not(.whole):not(.tab[disabled])').removeClass('selected').children('.province').find(
+                    'input').prop({
+                    'checked': false,
+                    "disabled": false
+                });
+                $('.tab_content').find('.city:not(.city[disabled])').removeClass('active').attr({
+                    "disabled": false,
+                    "checked": false
+                })
+				AreaChoose.showSelected(false);
+				AreaChoose.getResult();
+				sessionStorage.removeItem("vipSubSelectAreaUpgrade");
+            })
+            //
+            if(sessionStorage.vipSubSelectAreaUpgrade!==undefined&&sessionStorage.vipSubSelectAreaUpgrade!==""){
+            	let areas = JSON.parse(sessionStorage.vipSubSelectAreaUpgrade);
+            	for(var province in areas){
+            		if(province === "全国"){
+              			$(".other").prop("checked",true);
+              			AreaChoose.reset();
+            		}
+            	}
+            }
+        },
+        reset:function(){
+           var checked = $(".other").is(':checked');
+            if (checked) {
+                $('.tab_content').slideUp(500)
+                $('.tab span i').css({
+                    "display":"inline-block",
+                    "transform":"rotate(0)"
+                })
+                $('.tab:not(.whole):not(.tab[disabled])').removeClass('selected').children('.province').find(
+                    'input').prop({
+                    'checked': false,
+                    "disabled": false
+                });
+                $('.tab_content').find('.city:not(.city[disabled])').removeClass('active').attr({
+                    "disabled": false,
+                    "checked": false
+                })
+                AreaChoose.getResult();
+                $(".tips_btn .btns .reset-btn").removeAttr("disabled");
+            	$(".tips_btn .btns .save-btn").removeAttr("disabled");
+            }else{
+            	AreaChoose.showSelected(false);
+                AreaChoose.getResult();
+                $(".tips_btn .btns .reset-btn").attr("disabled","disabled");
+            	$(".tips_btn .btns .save-btn").attr("disabled","disabled");
+            }
+        }
+      }
+      
+      $(function () {
+            AreaChoose.isOpen()
+            AreaChoose.inintData(); //初始化 已选择和已购买数据
+            AreaChoose.inintPage(); //初始化城市数据
+            AreaChoose.showSelected(false);
+            AreaChoose.showSelected(true);//回显已选择
+            /* 判断已购买的城市 在不在 全部城市里面,在,将按钮置灰,不可点击 */
+
+            AreaChoose.getResult();
+            AreaChoose.inintClick();
+        })
+      //
+        //
+	    function checkObj(obj) {
+		    //检验数组
+		    if (Array.prototype.isPrototypeOf(obj) && obj.length === 0) {
+		        return true;
+		    }
+		    //检验对象
+		    if (Object.prototype.isPrototypeOf(obj) && Object.keys(obj).length === 0) {
+		        return true;
+		    }
+		    return false;
+		}
+	    //
+	    if($(".result_name").text()===""){
+	    	$(".tips_btn .btns .reset-btn").attr("disabled","disabled");
+        	$(".tips_btn .btns .save-btn").attr("disabled","disabled");
+	    }
+	    
+	    if(sessionStorage.vipSubSelectAreaUpgrade!==undefined && sessionStorage.vipSubSelectAreaUpgrade!==""){
+	    	$(".tips_btn .btns .reset-btn").removeAttr("disabled");
+            $(".tips_btn .btns .save-btn").removeAttr("disabled");
+	    }
+
+    </script>
+</body>
+
+</html>

+ 4 - 4
src/web/templates/weixin/vipsubscribe/renew_notice.html

@@ -154,8 +154,8 @@
 			}else{
 				$DoPost("/subscribepay/renewUpgrade/getBuyMsg", {}, function (data) {
 					if(data){
-						var area = data.area;
-					    var buyerclass = data.buyerclass;
+						var area = data.allarea;
+					    var buyerclass = data.allindustry;
 					    var startTime = data.start;
 					    var endTime = data.end;
 					    var exprie = {{.T.exprie}};
@@ -234,10 +234,10 @@
 				if(flags){
 					return
 				};
-				window.location.href = "/weixin/pay/renewPayPage";
+				window.location.replace("/weixin/pay/renewPayPage");
 			});
 			$(".aginBuy").on("click",function(){
-				window.location.href = "/weixin/pay/vipsubscribe_new?orderCode="+orderCode;
+				window.location.replace("/weixin/pay/vipsubscribe_new?orderCode="+orderCode);
 			});
 	        //
 		    function checkObj(obj) {

+ 10 - 10
src/web/templates/weixin/vipsubscribe/renew_pay.html

@@ -48,11 +48,11 @@
             <ul class="chooseList">
                 <li class="detail_item">
                         <div class="item_info item_area">
-                            <span class="label">已订阅区域:</span>
+                            <span class="label">已购买区域:</span>
                             <span class="label_for">河南省、郑州市、洛阳市、淮南市</span>
                         </div>
                         <div class="item_info item_industry">
-                            <span class="label">已订阅行业:</span>
+                            <span class="label">已购买行业:</span>
                             <span class="label_for">保监、城管保监</span>
                         </div>
                         <div class="item_info item_cycle">
@@ -607,9 +607,9 @@
 			    var buyerclassHtml = "";
 			    var dateName = "";
 			    var dateHtml = "";
-			    if (area !== "" && area !== undefined){
-			    	for(var province in area){
-			    		var citys = area[province]
+			    if (areas !== "" && areas !== undefined){
+			    	for(var province in areas){
+			    		var citys = areas[province]
 		//	    		console.log(citys);
 			    		if(citys.length===0){
 			    			provinceArr.push(province);
@@ -624,18 +624,18 @@
 			 		var cityLen = cityArr.length;
 			    	areaHtml = provinceLen+"个省级区域、"+cityLen+"个市";
 			    	
-					if(checkObj(area)){
+					if(checkObj(areas)){
 						areaHtml = "全国";
 					}
 			    	$(".item_area .label_for").text(areaHtml);
 			    }
-			    if(buyerclass !== "" && buyerclass !== undefined){
-			    	for(var i in buyerclass){
-			    		var industry = buyerclass[i];
+			    if(industrys !== "" && industrys !== undefined){
+			    	for(var i in industrys){
+			    		var industry = industrys[i];
 			    		buyerclassArr.push(industry);
 			    		buyerclassHtml = buyerclassArr.length+"个行业";
 			    	}
-			    	if(checkObj(buyerclass)){
+			    	if(checkObj(industrys)){
 			    		buyerclassHtml = "全行业";
 			    	}
 			    	$(".item_industry .label_for").text(buyerclassHtml);

+ 2 - 2
src/web/templates/weixin/vipsubscribe/vip_introduce.html

@@ -127,9 +127,9 @@
         </div>
         <div class="menu">
             {{if not .T.notShowTrial }}
-            <a onclick="window.location.replace('/front/vipsubscribe/trialInfo')" class="try_btn">试用7天</a>
+            <a onclick="window.location.href='/front/vipsubscribe/trialInfo'" class="try_btn">试用7天</a>
             {{end}}
-            <a onclick="window.location.replace('/weixin/pay/vipsubscribe_new')"  class="subscribe_btn">去订阅</a>
+            <a onclick="window.location.href='/weixin/pay/vipsubscribe_new'"  class="subscribe_btn">去订阅</a>
         </div>
     </div>
     {{include "/common/weixin.html"}}

+ 1 - 0
src/web/templates/weixin/vipsubscribe/vip_purchase.html

@@ -755,6 +755,7 @@
             sessionStorage.removeItem("vipSubSelectIndustry");
             sessionStorage.removeItem("vipSubSelectTime");
             sessionStorage.removeItem("vipSub_read");
+            sessionStorage.removeItem("historypushDataCache");
         }
 
         /******* 获取url参数(正则)********/

+ 128 - 42
src/web/templates/weixin/vipsubscribe/vip_upgrade.html

@@ -788,44 +788,52 @@
         	$("#buy").prop("checked", bCheck);
         }
         //新增区域
-	    if(sessionStorage.vipSubSelectAreaUpgrade!==""&&sessionStorage.vipSubSelectAreaUpgrade!==undefined){
-			var vipSubSelectArea = JSON.parse(sessionStorage.vipSubSelectAreaUpgrade);
-			var provinceArr = [];
-			var cityArr = [];
-			var isAll = "";
-			$(".area-list").show();
-			for (var province in vipSubSelectArea){
-				if(vipSubSelectArea[province].length > 0){
-					var citys = vipSubSelectArea[province];
-					for (var i in citys){
-						var city = citys[i];
-						cityArr.push(city);
-					}
-				}else{
-					provinceArr.push(province);
-				}
-				if(province === "全国"){
-					isAll = "all";
-				}
-			}
-			var provinceLen = provinceArr.length;
-			var cityLen = cityArr.length;
-			var areaHtml = "";
-			if(isAll === ""){
-				areaHtml = "已新增 "+ provinceLen +" 个省级区域、"+ cityLen +" 个地市";
-				$("#area").attr("placeholder", areaHtml);
-			}else{
+	    if(sessionStorage.vipSubSelectAreaAdd!==""&&sessionStorage.vipSubSelectAreaAdd!==undefined&&sessionStorage.vipSubSelectCity!==undefined&&sessionStorage.vipSubSelectCity!==""){
+			var vipSubSelectArea = JSON.parse(sessionStorage.vipSubSelectAreaAdd);
+			let cityLen = sessionStorage.vipSubSelectCity;
+			if(vipSubSelectArea.country === -1){
 				areaHtml = "已新增全国";
 				$("#area").attr("placeholder", areaHtml);
-			}
-			if(provinceLen === 0 && cityLen === 0){
-				areaHtml = "选择升级区域";
+			}else{
+				areaHtml = "已新增 "+ vipSubSelectArea.province +" 个省级区域、"+ cityLen +" 个地市";
 				$("#area").attr("placeholder", areaHtml);
 			}
+//			var provinceArr = [];
+//			var cityArr = [];
+//			var isAll = "";
+//			$(".area-list").show();
+//			for (var province in vipSubSelectArea){
+//				if(vipSubSelectArea[province].length > 0){
+//					var citys = vipSubSelectArea[province];
+//					for (var i in citys){
+//						var city = citys[i];
+//						cityArr.push(city);
+//					}
+//				}else{
+//					provinceArr.push(province);
+//				}
+//				if(province === "全国"){
+//					isAll = "all";
+//				}
+//			}
+//			var provinceLen = provinceArr.length;
+//			var cityLen = cityArr.length;
+//			var areaHtml = "";
+//			if(isAll === ""){
+//				areaHtml = "已新增 "+ provinceLen +" 个省级区域、"+ cityLen +" 个地市";
+//				$("#area").attr("placeholder", areaHtml);
+//			}else{
+//				areaHtml = "已新增全国";
+//				$("#area").attr("placeholder", areaHtml);
+//			}
+//			if(provinceLen === 0 && cityLen === 0){
+//				areaHtml = "选择升级区域";
+//				$("#area").attr("placeholder", areaHtml);
+//			}
 	    }
 	    //新增行业
-	    if(sessionStorage.vipSubSelectIndustryUpgrade!==""&&sessionStorage.vipSubSelectIndustryUpgrade!==undefined){
-	    	var vipSubSelectIndustry = JSON.parse(sessionStorage.vipSubSelectIndustryUpgrade);
+	    if(sessionStorage.vipSubSelectIndustryAdd!==""&&sessionStorage.vipSubSelectIndustryAdd!==undefined){
+	    	var vipSubSelectIndustry = JSON.parse(sessionStorage.vipSubSelectIndustryAdd);
 	    	var industryArr = [];
 	    	var isAll = "";
 	    	var industryHtml = "";
@@ -1003,6 +1011,7 @@
         var oldYearPrice = 0;
         var oldMonthPrice = 0;
         var areasArr = {};
+        var areas_arr = {};
 	    var industrysArr = [];
 	    var allArea = {};
 	    var allIndustry = [];
@@ -1036,19 +1045,16 @@
 				for(let province in vipArea){
 		    		let citys = vipArea[province];
 		    		if(citys.length===0){
-						areasArr[province] = [];
+						areas_arr[province] = [];
 		    		}else{
-		    			areasArr[province] = citys;
+		    			areas_arr[province] = citys;
 		    		}
 		    	}
 				for(let province in vipArea){
 		    		if(province === "全国"){
-						areasArr = {"全国":[]};
+						areas_arr = {"全国":[]};
 					}
 		    	}
-				if(buyCheck){
-					$(".save_upgrade").removeAttr("disabled");
-				}
 				if(area !== ""&&area !== undefined){
 					for(let province in area){
 			    		let citys = area[province];
@@ -1087,8 +1093,17 @@
 						}
 					}
 				}
+				if(sessionStorage.vipSubSelectAreaAdd!==""&&sessionStorage.vipSubSelectAreaAdd!==undefined){
+					areasArr = addAreaObj();
+				}else{
+					areasArr = null;
+				}
+				if(buyCheck){
+					$(".save_upgrade").removeAttr("disabled");
+				}
 			}else{
-				areasArr = null;
+				areas_arr = null
+				areasArr = null
 				if(buyArea !== ""&&buyArea !== undefined){
 					for(let province in buyArea){
 			    		let citys = buyArea[province];
@@ -1100,6 +1115,19 @@
 			    	}
 				}
 			}
+			//
+			if(sessionStorage.vipSubSelectIndustryAdd!==""&&sessionStorage.vipSubSelectIndustryAdd!==undefined){
+				var vipIndustry = JSON.parse(sessionStorage.vipSubSelectIndustryAdd);
+				for(let i in vipIndustry){
+		    		let industry = vipIndustry[i];
+		    		industrysArr.push(industry);
+		        }
+				for(let i in vipIndustry){
+					if(industry === "全部行业"){
+						industrysArr = ["全部行业"];
+					}
+				}
+			}
 //			if(sessionStorage.vipSubSelectAreaUpgrade!==""&&sessionStorage.vipSubSelectAreaUpgrade!==undefined){
 //				var vipArea = JSON.parse(sessionStorage.vipSubSelectAreaUpgrade);
 //				if(area !== ""&&area !== undefined){
@@ -1169,6 +1197,8 @@
 						industrysArr = ["全部行业"];
 					}
 				}
+			}else{
+				industrysArr = null;
 			}
 			
 			if(sessionStorage.vipSubSelectIndustryUpgrade!==""&&sessionStorage.vipSubSelectIndustryUpgrade!==undefined){
@@ -1190,7 +1220,6 @@
 					$(".save_upgrade").removeAttr("disabled");
 				}
 			}else{
-				industrysArr = null;
 				if(buyIndustry!==""&&buyIndustry!==undefined){
 					for(let i in buyIndustry){
 			    		let industry = buyIndustry[i];
@@ -1402,6 +1431,9 @@
 					sessionStorage.upgrade_price = "¥"+price;
 					sessionStorage.proPrice = price;
 				}else if(sessionStorage.upgrade_cycleunit === "2"){
+					if(Number(sessionStorage.upgrade_cyclecount)>10){
+						sessionStorage.upgrade_cyclecount = 10;
+					}
 					let price = (Number(sessionStorage.upgrade_cyclecount)*completeMonth).toFixed(1);
 					sessionStorage.upgrade_price = "¥"+price;
 					sessionStorage.proPrice = price;
@@ -1420,7 +1452,7 @@
 //			if(effect === "notnow"){
 //				cPrice = cPrice -(completeMonth - oldMonthPrice);
 //			}
-			if(cPrice < 0){
+			if(cPrice <= 0){
 				cPrice = 0;
 			}
 			$(".finally_price").html("¥"+cPrice);
@@ -1480,6 +1512,18 @@
         	}else{
         		industryArr = "no";
         	}
+        	//
+        	if(areas_arr["全国"]){
+                areas_arr={};
+            }
+        	if(areas_arr !== null){
+        		if(areas_arr["全国"]){
+	                areas_arr={};
+	            }
+        		areas_arr = JSON.stringify(areas_arr);
+        	}else{
+        		areas_arr = "no";
+        	}
             //
             let areaarr = buyArea;
         	let industryarr = buyIndustry;
@@ -1499,9 +1543,10 @@
             }
             //
 	    	var param = {
-	    		"area": areaArr,
+	    		"area": areas_arr,
 	    		"industry": industryArr,
 	    		"areas": JSON.stringify(areaarr),
+	    		"areas_arr": areaArr,
 	    		"industryarr": industryarr.join(","),
 	    		"allArea": JSON.stringify(allAreaArr),
 	    		"allIndustry": allIndustryArr.join(","),
@@ -1547,6 +1592,47 @@
 		    }
 		    return false;
 		}
+	    //
+	    function addAreaObj(){
+	    	let areaObj = JSON.parse(sessionStorage.vipSubSelectAreaUpgrade)
+	    	let buyset = JSON.parse(sessionStorage.vipSubSelectAreaAdd)
+	    	//
+	    	let provinceArr = [];
+	    	let areasObj = {};
+	    	if(buyset.country === -1){
+	    		areasObj["全国"] = [];
+	    	}else{
+	    		for(let province in areaObj){
+	//	    		console.log("666666",buyset.citys[province]);
+					let cityLen = areaObj[province].length
+		    		if(cityLen === 0){
+		    			provinceArr.push(province);
+		    		}else{
+		    			let citys = areaObj[province];
+		    			for(let i in buyset.city){
+		    				let cityCount = buyset.city[i];
+		    				if(province === i){
+		    					if(cityLen > cityCount){
+					    			let reduce = cityLen - cityCount;
+					    			areasObj[province] = citys.slice(0, -reduce);
+					    		}
+		    				}
+		    			}
+		    		}
+		    	}
+	    		if(provinceArr.length > buyset.province){
+	    			let reduce = provinceArr.length - buyset.province;
+	    			provinceArr = provinceArr.slice(0, -reduce);
+	    		}
+	    		console.log(provinceArr)
+	    		for(let a in provinceArr){
+	    			let province = provinceArr[a];
+	    			areasObj[province] = [];
+	    		}
+	    		console.log(areasObj)
+	    	}
+	    	return areasObj
+	    }
 	    
     </script>
 </body>