Browse Source

页面提交

wangkaiyue 5 years ago
parent
commit
29af49317b

+ 13 - 13
src/jfw/front/vipsubscribe.go

@@ -12,19 +12,19 @@ import (
 
 type Subscribepay struct {
 	*xweb.Action
-	introduce         xweb.Mapper `xweb:"/front/vipsubscribe/introducePage"`       //订阅收费介绍页
-	trialInfo         xweb.Mapper `xweb:"/front/vipsubscribe/trialInfo"`           //vip订阅服务-用户信息录入页面
-	toPurchasePage    xweb.Mapper `xweb:"/front/vipsubscribe/toPurchasePage/(.*)"` //订阅收费购买页面(试用用户)
-	toChooseArea      xweb.Mapper `xweb:"/front/vipsubscribe/toChooseArea"`        //订阅收费地区筛选
-	toChooseIndustry  xweb.Mapper `xweb:"/front/vipsubscribe/toChooseIndustry"`    //订阅收费行业筛选
-	toPaySuccessPage  xweb.Mapper `xweb:"/front/vipsubscribe/toPaySuccessPage"`    //订阅支付完成页面
-	toOrderDetailPage xweb.Mapper `xweb:"/front/vipsubscribe/toOrderDetailPage"`   //订阅收费支付订单详情页面
-	toSetKeyWordPage  xweb.Mapper `xweb:"/front/vipsubscribe/toSetKeyWordPage"`    //订阅收费设置关键词
-	toSetPage         xweb.Mapper `xweb:"/front/vipsubscribe/toSetPage"`           //订阅收费设置
-	toSetInfoTypePage xweb.Mapper `xweb:"/front/vipsubscribe/toSetInfoTypePage"`   //订阅收费设置信息类型
-	toSetPushSetPage  xweb.Mapper `xweb:"/front/vipsubscribe/toSetPushSetPage"`    //订阅收费推送设置
-	toSetOtherKwsPage xweb.Mapper `xweb:"/front/vipsubscribe/toSet(.*)Page"`       //订阅收费附加词和排除词设置
-	toVIPViewPage     xweb.Mapper `xweb:"/front/vipsubscribe/toVIPViewPage"`       //订阅收费预览
+	introduce         xweb.Mapper `xweb:"/front/vipsubscribe/introducePage"`     //订阅收费介绍页
+	trialInfo         xweb.Mapper `xweb:"/front/vipsubscribe/trialInfo"`         //vip订阅服务-用户信息录入页面
+	toPurchasePage    xweb.Mapper `xweb:"/weixin/pay/vipsubscribe_(.*)"`         //订阅收费购买页面(试用用户)
+	toChooseArea      xweb.Mapper `xweb:"/front/vipsubscribe/toChooseArea"`      //订阅收费地区筛选
+	toChooseIndustry  xweb.Mapper `xweb:"/front/vipsubscribe/toChooseIndustry"`  //订阅收费行业筛选
+	toPaySuccessPage  xweb.Mapper `xweb:"/front/vipsubscribe/toPaySuccessPage"`  //订阅支付完成页面
+	toOrderDetailPage xweb.Mapper `xweb:"/front/vipsubscribe/toOrderDetailPage"` //订阅收费支付订单详情页面
+	toSetKeyWordPage  xweb.Mapper `xweb:"/front/vipsubscribe/toSetKeyWordPage"`  //订阅收费设置关键词
+	toSetPage         xweb.Mapper `xweb:"/front/vipsubscribe/toSetPage"`         //订阅收费设置
+	toSetInfoTypePage xweb.Mapper `xweb:"/front/vipsubscribe/toSetInfoTypePage"` //订阅收费设置信息类型
+	toSetPushSetPage  xweb.Mapper `xweb:"/front/vipsubscribe/toSetPushSetPage"`  //订阅收费推送设置
+	toSetOtherKwsPage xweb.Mapper `xweb:"/front/vipsubscribe/toSet(.*)Page"`     //订阅收费附加词和排除词设置
+	toVIPViewPage     xweb.Mapper `xweb:"/front/vipsubscribe/toVIPViewPage"`     //订阅收费预览
 
 	//修改
 	toEditSubPage     xweb.Mapper `xweb:"/front/vipsubscribe/toEditSubPage"`     //订阅收费修改页面

+ 97 - 18
src/jfw/modules/subscribepay/src/entity/subscribeVip.go

@@ -1,6 +1,8 @@
 package entity
+
 //vip订阅公共方法
 import (
+	"encoding/json"
 	"log"
 	"time"
 	"util"
@@ -10,20 +12,97 @@ import (
 	qutil "qfw/util"
 )
 
-//设置开始试用
-func StartTrial(userId string, area *map[string]interface{}, industry []string) bool {
+type vipSubscribeStruct struct{}
+
+var JyVipSubStruct vipSubscribeStruct
+
+type VipSimpleMsg struct {
+	Id         string                  `json:"_id"`
+	Area       *map[string]interface{} `json:"area"`
+	Industry   []string                `json:"industry"`
+	Cyclecount int                     `json:"cyclecount"`
+	Cycleunit  int                     `json:"cycleunit"`
+}
+
+//支付完成回调
+func (this *vipSubscribeStruct) PayCallBack(param *CallBackParam) (ok bool) {
+	now := time.Now()
+	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", "")
+	pay_time := qutil.FormatDate(&now, qutil.Date_Full_Layout)
+	if orderdata != nil {
+		order_status := qutil.IntAll((*orderdata)["order_status"])
+		if order_status == 0 {
+			//计算时长
+			vmsg := VipSimpleMsg{}
+			filterStr := qutil.ObjToString((*orderdata)["filter"])
+			userid := qutil.ObjToString((*orderdata)["user_id"])
+			if err := json.Unmarshal([]byte(filterStr), &vmsg); err != nil {
+				log.Printf("%s vipSubscribeStruct PayCallBack Unmarshal 出错 [%s]\n", userid, filterStr)
+			}
+			startTime := time.Now()
+			var endTime time.Time
+			if vmsg.Cycleunit == 1 { //年
+				endTime = startTime.AddDate(vmsg.Cyclecount, 0, 0)
+			} else if vmsg.Cycleunit == 2 { //月
+				endTime = startTime.AddDate(0, vmsg.Cyclecount, 0)
+			}
+			update := util.Mysql.Update("dataexport_order", map[string]interface{}{
+				"order_status": 0,
+				"out_trade_no": param.OutTradeno,
+				"order_money":  param.TotalFee,
+				//"user_openid":  openid,
+			}, map[string]interface{}{
+				"pay_money":     param.CashFee,
+				"pay_time":      pay_time,
+				"order_status":  1,
+				"vip_starttime": qutil.FormatDate(&startTime, qutil.Date_Full_Layout),
+				"vip_endtime":   qutil.FormatDate(&endTime, qutil.Date_Full_Layout),
+			})
+			if update {
+				if JyVipSubStruct.StartSubVip(userid, vmsg.Area, vmsg.Industry, startTime, endTime, false) {
+					ok = true
+				}
+			}
+		} else {
+			ok = true
+		}
+	}
+	return ok
+}
+
+//设置开始使用
+func (this *vipSubscribeStruct) StartSubVip(userId string, area *map[string]interface{}, industry []string, startTime, endTime time.Time, isTrial bool) bool {
+	buyset := [3]int{-1, -1, -1}
+	//a_buyset 计算  0:省份数量 1:城市数量 2:行业数量
+	if !isTrial {
+		if len(*area) > 0 {
+			areaCount := JyVipSubStruct.GetBuyAreaCount(area);
+			buyset[0] = areaCount[0] //省份数量
+			buyset[1] = areaCount[1] //城市数量
+		} else {
+			buyset[0] = -1
+			buyset[1] = -1
+		}
+		if len(industry) > 0 {
+			buyset[2] = len(industry) //行业数量
+		} else {
+			buyset[2] = -1
+		}
+	}
+
 	//计算服务时间
-	startTime := time.Now()
-	endTime := startTime.AddDate(0, 0, 7)
 	if !util.MQFW.UpdateById("user", userId,
 		bson.M{"$set": bson.M{
-			"o_vipjy.i_trial":      -1,                //已激活试用
-			"o_vipjy.o_area":       area,              //试用设置地区
-			"o_vipjy.a_buyerclass": industry,          //试用设置行业
-			"o_vipjy.a_buyset":     []int{-1, -1, -1}, //购买内容 城市、省份、行业数量
-			"l_vip_starttime":      startTime.Unix(),  //开始时间
-			"l_vip_endtime":        endTime.Unix(),    //结束时间
-			"i_vip_status":         1,                 //1试用 2正式
+			"o_vipjy.i_trial":      -1,                      //已激活试用
+			"o_vipjy.o_area":       area,                    //试用设置地区
+			"o_vipjy.a_buyerclass": industry,                //试用设置行业
+			"o_vipjy.a_buyset":     buyset,                  //购买内容 城市、省份、行业数量
+			"l_vip_starttime":      startTime.Unix(),        //开始时间
+			"l_vip_endtime":        endTime.Unix(),          //结束时间
+			"i_vip_status":         qutil.If(isTrial, 1, 2), //1试用 2正式
 		}}) {
 		return false
 	}
@@ -31,17 +110,17 @@ func StartTrial(userId string, area *map[string]interface{}, industry []string)
 }
 
 //查询是否有试用权限
-func CanTrial(userId string) bool {
+func (this *vipSubscribeStruct) CanTrial(userId string) bool {
 	m, ok := util.MQFW.FindById("user", userId, `{"o_vipjy":1,"i_vip_status":1}`)
 	if m == nil || len(*m) == 0 || !ok {
 		return false
 	}
 	obj := qutil.ObjToMap((*m)["o_vipjy"])
-	if qutil.IntAll((*obj)["i_trial"]) != 1 {//是否有试用资格
+	if qutil.IntAll((*obj)["i_trial"]) != 1 { //是否有试用资格
 		return false
 	}
 	//是否使用过(使用过VIP订阅功能,就不能试用)
-	if qutil.IntAll((*m)["i_vip_status"])!=0{  //开启状态:0-暂不使用vip订阅 1-试用 2-正式 -1-试用到期 -2-正式到期
+	if qutil.IntAll((*m)["i_vip_status"]) != 0 { //开启状态:0-暂不使用vip订阅 1-试用 2-正式 -1-试用到期 -2-正式到期
 		return false
 	}
 	return true
@@ -49,7 +128,7 @@ func CanTrial(userId string) bool {
 
 //获取省份,城市,行业购买数量;-1为全部
 //[省份,城市,行业]
-func GetBuySet(userId string) (result [3]int) {
+func (this *vipSubscribeStruct) GetBuySet(userId string) (result [3]int) {
 	mData, ok := util.MQFW.FindById("user", userId, `{"o_vipjy":1}`)
 	if !ok || len(*mData) == 0 || mData == nil {
 		return
@@ -62,10 +141,10 @@ func GetBuySet(userId string) (result [3]int) {
 }
 
 //根据区域获取城市和省份数量
-func GetBuyAreaCount(area map[string]interface{}) (result [2]int) {
+func (this *vipSubscribeStruct) GetBuyAreaCount(area *map[string]interface{}) (result [2]int) {
 	p := []interface{}{} //省份
 	c := []interface{}{} //城市
-	for k, v := range area {
+	for k, v := range *area {
 		tmp := v.([]interface{})
 		if len(tmp) == 0 { //省份
 			result[0]++
@@ -80,7 +159,7 @@ func GetBuyAreaCount(area map[string]interface{}) (result [2]int) {
 }
 
 //计算价格
-func GetSubVipPrice(area *map[string]interface{}, industry []string, count, unit int) int {
+func (this *vipSubscribeStruct) GetSubVipPrice(area *map[string]interface{}, industry []string, count, unit int) int {
 	if len(*area) == 0 { //全国
 		if len(industry) == 1 {
 			return getSetMealPrice(0, 1, unit) * count //全国1行业套餐

+ 0 - 1
src/jfw/modules/subscribepay/src/service/orderListDetails.go

@@ -7,7 +7,6 @@ import (
 	"fmt"
 	"log"
 	qutil "qfw/util"
-	"qfw/util/jy"
 	"regexp"
 	"strconv"
 	"strings"

+ 3 - 1
src/jfw/modules/subscribepay/src/service/payCallback.go

@@ -100,7 +100,9 @@ func (p *PayCallBackAction) WxPayCallback() {
 				log.Printf("微信数据报告更新执行出错 %+v\n", thisParam)
 			}
 		} else if strings.HasPrefix(thisParam.OutTradeno, pay.WX_SUBVIP_APP) || strings.HasPrefix(thisParam.OutTradeno, pay.WX_SUBVIP_JSAPI) { //vip订阅
-
+			if update=entity.JyVipSubStruct.PayCallBack(thisParam);!update{
+				log.Printf("微信vip订阅更新执行出错 %+v\n", thisParam)
+			}
 		}
 		if insert = thisParam.SaveWxPayRecord(); !insert {
 			log.Printf("微信支付保存支付记录出错 %+v\n", thisParam)

+ 4 - 4
src/jfw/modules/subscribepay/src/service/vipSubscribeEdit.go

@@ -50,12 +50,12 @@ func (this *EditSub) GetSubBuyMsg() {
 		}
 		o_vipjy := qutil.ObjToMap((*mData)["o_vipjy"])
 		//地区 城市 数量 修改次数
-		editNum := qutil.IntAll(redis.Get("other", userId+"_SubEdit_"+time.Now().Month().String()))
+		//editNum := qutil.IntAll(redis.Get("other", userId+"_SubEdit_"+time.Now().Month().String()))
 		return &editSubResult{true, nil, map[string]interface{}{
 			"area":     (*o_vipjy)["o_area"],
 			"industry": (*o_vipjy)["a_buyerclass"],
 			"buyset":   (*o_vipjy)["a_buyset"],
-			"editNum":  editNum,
+			//"editNum":  editNum,
 		}}
 	}()
 	if r.Err != nil {
@@ -75,7 +75,7 @@ func (this *EditSub) SaveSubEdit() {
 			return &editSubResult{false, errors.New("修改次数已达上限"), nil}
 		}
 		//获取购买数量
-		buyset := entity.GetBuySet(userId)
+		buyset := entity.JyVipSubStruct.GetBuySet(userId)
 		switch doType {
 		case "area":
 			areaNew := map[string]interface{}{}
@@ -85,7 +85,7 @@ func (this *EditSub) SaveSubEdit() {
 			if err != nil {
 				return &editSubResult{false, errors.New("数据格式错误"), nil}
 			}
-			count := entity.GetBuyAreaCount(areaNew)
+			count := entity.JyVipSubStruct.GetBuyAreaCount(&areaNew)
 			if (count[0] > buyset[0] || count[1] > buyset[1]) && buyset[0] != -1 {
 				return &editSubResult{false, errors.New("非法操作"), nil}
 			}

+ 47 - 34
src/jfw/modules/subscribepay/src/service/vipSubscribePay.go

@@ -20,15 +20,14 @@ import (
 //vip订阅付费
 type SubVipPayOrder struct {
 	*xweb.Action
-	createOrder xweb.Mapper `xweb:"/jypay/vipsubscribe/createOrder"` //创建订单并支付
-	orderToPay  xweb.Mapper `xweb:"/jypay/vipsubscribe/orderToPay"`  //支付已创建订单
+	createOrder xweb.Mapper `xweb:"/vipsubscribe/createOrder"` //创建订单并支付
+	orderToPay  xweb.Mapper `xweb:"/vipsubscribe/orderToPay"`  //支付已创建订单
 }
 
 func init() {
 	xweb.AddAction(&SubVipPayOrder{})
 }
 
-
 //创建订单返回支付串
 func (this *SubVipPayOrder) CreateOrder() {
 	area := qutil.ObjToMap(this.GetString("area"))
@@ -43,6 +42,9 @@ func (this *SubVipPayOrder) CreateOrder() {
 		if len(industry) == 1 { //去掉[""]
 			industry = []string{}
 		}
+		if !(payWay == "wx_js" || payWay == "wx_app" || payWay == "ali_app") {
+			return &entity.FuncResult{false, errors.New("未知支付"), nil}
+		}
 		date_count, date_unit, err := checkReqDate(date)
 		if err != nil {
 			return &entity.FuncResult{false, err, nil}
@@ -62,39 +64,56 @@ func (this *SubVipPayOrder) CreateOrder() {
 			return &entity.FuncResult{false, errors.New("创建订单出错"), nil}
 		}
 		//计算价格
-		totalfee := entity.GetSubVipPrice(area, industry, date_count, date_unit)
+		//totalfee := entity.GetSubVipPrice(area, industry, date_count, date_unit)
+		totalfee := 1
 		//创建订单
-		tradeno, ret := pay.WxStruct.CreatePrepayOrder( "e", this.IP(), openId, "", totalfee)
-		if ret == nil || (*ret)["status"] != "1" {
-			errMsg := "创建微信订单出错"
-			if (*ret)["errcodedes"] != "" {
-				errMsg = (*ret)["errcodedes"]
-			} else if (*ret)["errcode"] != "" {
-				errMsg = (*ret)["errcode"]
+		tradeno, prepayid, payStr := "", "", ""
+
+		if payWay == "wx_js" { //微信js支付
+			var ret *map[string]string
+			tradeno, ret = pay.WxStruct.CreatePrepayOrder(pay.WX_SUBVIP_JSAPI, this.IP(), openId, "", totalfee)
+			if ret == nil || (*ret)["status"] != "1" {
+				errMsg := "创建微信订单出错"
+				if (*ret)["errcodedes"] != "" {
+					errMsg = (*ret)["errcodedes"]
+				} else if (*ret)["errcode"] != "" {
+					errMsg = (*ret)["errcode"]
+				}
+				return &entity.FuncResult{false, errors.New(errMsg), nil}
 			}
-			return &entity.FuncResult{false, errors.New(errMsg), nil}
+			prepayid = qutil.ObjToString((*ret)["prepayid"])
+			payStr = pay.GetWxJsPayStr(prepayid)
+		} else if payWay == "wx_app" {
+			var ret *map[string]string
+			tradeno, ret = pay.WxStruct.CreatePrepayOrder(pay.WX_SUBVIP_JSAPI, this.IP(), openId, "", totalfee)
+			if ret == nil || (*ret)["status"] != "1" {
+				errMsg := "创建微信订单出错"
+				if (*ret)["errcodedes"] != "" {
+					errMsg = (*ret)["errcodedes"]
+				} else if (*ret)["errcode"] != "" {
+					errMsg = (*ret)["errcode"]
+				}
+				return &entity.FuncResult{false, errors.New(errMsg), nil}
+			}
+			prepayid = qutil.ObjToString((*ret)["prepayid"])
+			payStr = pay.WxStruct.GetAppWxPayStr(prepayid)
 		}
-		//存入订单表
-		ordercode := pay.GetOrderCode(openId)
-		prepayid := qutil.ObjToString((*ret)["prepayid"])
-		jsPayParam := pay.GetWxJsPayStr(prepayid)
-
-		filter := map[string]interface{}{
-			"_id":        mog_id,
-			"area":       area,
-			"industry":   industry,
-			"cyclecount": date_count, //时长
-			"cycleunit":  date_unit,  //单位
+		filter := entity.VipSimpleMsg{
+			mog_id,
+			area,
+			industry,
+			date_count,
+			date_unit,
 		}
 		filterStr, _ := json.Marshal(filter)
-
+		ordercode := pay.GetOrderCode(userId)
 		orderid := util.Mysql.Insert("dataexport_order", map[string]interface{}{
 			"order_money":    totalfee,
 			"order_status":   0,
 			"user_nickname":  qutil.ObjToString(this.GetSession("s_nickname")),
 			"user_openid":    openId,
 			"prepay_id":      prepayid,
-			"code_url":       jsPayParam,
+			"code_url":       payStr,
 			"out_trade_no":   tradeno,
 			"order_code":     ordercode,
 			"product_type":   "VIP订阅",
@@ -109,10 +128,7 @@ func (this *SubVipPayOrder) CreateOrder() {
 		if orderid == -1 {
 			return &entity.FuncResult{false, errors.New("数据库操作异常"), nil}
 		}
-		return &entity.FuncResult{true, nil, map[string]interface{}{
-			"code": ordercode,
-			"res":  jsPayParam,
-		}}
+		return &entity.FuncResult{true, nil, map[string]interface{}{"code": ordercode, "res": payStr}}
 	}()
 	if r.Err != nil {
 		log.Printf("%s CreateOrder err:%v\n", userId, r.Err.Error())
@@ -140,9 +156,7 @@ func (this *SubVipPayOrder) OrderToPay() {
 		jsPayParam := qutil.ObjToString((*oData)["code_url"])
 		if time.Now().Before(prepayTime.Add(time.Hour*2)) && jsPayParam != "" {
 			//未过期
-			return &entity.FuncResult{true, nil, map[string]interface{}{
-				"res": jsPayParam,
-			}}
+			return &entity.FuncResult{true, nil, map[string]interface{}{"res": jsPayParam}}
 		}
 		//重新生成订单
 		openId := qutil.ObjToString((*oData)["user_openid"])
@@ -170,7 +184,7 @@ func (this *SubVipPayOrder) OrderToPay() {
 		if !ok {
 			return &entity.FuncResult{false, errors.New("数据库操作异常"), nil}
 		}
-		return &entity.FuncResult{true, nil, map[string]interface{}{"res": jsPayParam	}}
+		return &entity.FuncResult{true, nil, map[string]interface{}{"res": jsPayParam}}
 	}()
 	if r.Err != nil {
 		log.Printf("%s CreateOrder err:%v\n", userId, r.Err.Error())
@@ -200,4 +214,3 @@ func checkReqDate(dateStr string) (cyclecount, cycleunit int, err error) {
 	}
 	return -1, -1, errors.New(fmt.Sprintf("日期%s格式化出错", dateStr))
 }
-

+ 5 - 3
src/jfw/modules/subscribepay/src/service/vipSubscribeTrial.go

@@ -232,7 +232,7 @@ func (this *TrialOrder) TrialPay() {
 		if mog_id == "" {
 			return &entity.FuncResult{false, errors.New("创建订单出错"), nil}
 		}
-		if !entity.CanTrial(userId) {
+		if !entity.JyVipSubStruct.CanTrial(userId) {
 			return &entity.FuncResult{false, errors.New("无试用权限"), nil}
 		}
 		//计算价格
@@ -247,7 +247,7 @@ func (this *TrialOrder) TrialPay() {
 			"cycleunit":  date_unit,  //单位
 		}
 		filterStr, _ := json.Marshal(filter)
-
+		endTime := now.AddDate(0, 0, 7)
 		orderid := util.Mysql.Insert("dataexport_order", map[string]interface{}{
 			"order_money":    totalfee,
 			"order_status":   1,
@@ -264,11 +264,13 @@ func (this *TrialOrder) TrialPay() {
 			"user_id":        userId,
 			"filter":         string(filterStr), //筛选
 			"pay_time":       qutil.FormatDate(&now, qutil.Date_Full_Layout),
+			"vip_starttime":  qutil.FormatDate(&now, qutil.Date_Full_Layout),
+			"vip_endtime":    qutil.FormatDate(&endTime, qutil.Date_Full_Layout),
 		})
 		if orderid == -1 {
 			return &entity.FuncResult{false, errors.New("数据保存异常"), nil}
 		}
-		if !entity.StartTrial(userId, area, industry) { //设置开始试用
+		if !entity.JyVipSubStruct.StartSubVip(userId, area, industry, now, endTime,true) { //设置开始试用
 			return &entity.FuncResult{false, errors.New("开通试用异常"), nil}
 		}
 		return &entity.FuncResult{true, nil, map[string]interface{}{"code": ordercode}}

+ 1 - 0
src/web/staticres/vipsubscribe/css/choose_area.css

@@ -111,6 +111,7 @@
   line-height: .94rem;
   color: #fff;
   font-size: .34rem;
+  background-color: #fff;
 }
 
 .tips_btn .btns .save-btn,

+ 1 - 0
src/web/staticres/vipsubscribe/css/choose_industry.css

@@ -111,6 +111,7 @@
   line-height: .94rem;
   color: #fff;
   font-size: .34rem;
+  background-color: #fff;
 }
 
 .tips_btn .btns .save-btn,

+ 5 - 4
src/web/templates/weixin/vipsubscribe/edit_subscribe.html

@@ -49,9 +49,10 @@
                 <div class="item_bottom"></div>
            </a>
        </div>
+      <!--
        <div class="edit_tips">
            <div class="edit_count">总共可修改次数:<em>3</em> / 3</div>
-       </div>
+       </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>
@@ -141,14 +142,14 @@
             }
             
             //可修改次数
-            $(".edit_count em").text(this.reqData.editNum);
+            //$(".edit_count em").text(this.reqData.editNum);
           },
           initClick:function(){
             $(".edit_item").on("click",function(){
-              if(EditSub.reqData.editNum>=3){
+              /*if(EditSub.reqData.editNum>=3){
                 EditSub.showTip("已超过修改次数,不可再做修改");
                 return
-              }
+              }*/
               console.log($(this).attr("data_href"));
               window.location.href=$(this).attr("data_href");
             });

+ 1 - 1
src/web/templates/weixin/vipsubscribe/edit_subscribe_city.html

@@ -30,7 +30,7 @@
             <p>已选择:<span class="result_name">郑州市、洛阳市、淮南市、洛阳市、淮南市、洛阳市、淮南市、洛阳市、淮南市、洛阳市、淮南市</span></p>
         </div>
         <div class="form">
-            <div class="select-area-box" style="padding-bottom: 0;">
+            <div class="select-area-box">
                 <ul class="area-list">
                     <!-- <li>
                         <div class="tab whole">

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

@@ -133,8 +133,8 @@
                 </div>
         </div>
         <div class="menu">
-            <a href="/front/vipsubscribe/toPurchasePage/trial" class="try_btn">试用7天</a>
-            <a href="/front/vipsubscribe/toPurchasePage/new" class="subscribe_btn">去订阅</a>
+            <a href="/weixin/pay/vipsubscribe_trial" class="try_btn">试用7天</a>
+            <a href="/weixin/pay/vipsubscribe_new" class="subscribe_btn">去订阅</a>
         </div>
     </div>
 </body>

+ 16 - 14
src/web/templates/weixin/vipsubscribe/vip_order_detail.html

@@ -156,7 +156,7 @@ try{
         //产品类型
         if(r.data.order.product_type) $(".productType").text(r.data.order.product_type);
         //价格
-        if(r.data.order.original_price) $(".price").text(r.data.order.original_price/100);
+        $(".price").text(r.data.order.original_price/100);
         
         //订单条件        
         if(r.data.order.filter){
@@ -224,18 +224,27 @@ try{
           //支付时间
           $(".line_paytime").css("display","");
           if(r.data.order.pay_time) $(".payTime").text(r.data.order.pay_time.replace("-",".").replace("-","."));
+          
+          //有效周期
+          $(".line_cycle").css("display","");
+          //有效日期  
+          if(r.data.time.l_vip_starttime&&r.data.time.l_vip_endtime){
+            $(".serviceTime").text(formatEffectiveDate(r.data.time.l_vip_starttime,r.data.time.l_vip_endtime))
+          }
+          
           //支付方式
-          $(".line_payway").css("display","");
           if(r.data.order.pay_way.indexOf("wx")>-1){
+            $(".line_payway").css("display","");
             $(".payWay").text("微信支付");
-          }else{
+          }else if(r.data.order.pay_way.indexOf("ali")>-1){
             $(".payWay").text("支付宝支付");
+            $(".line_payway").css("display","");
+          }else{//试用用户
+            $(".invoice").css("display","none");
+            return
           }
-              
-          //支付订单号
           $(".line_transaction").css("display","");
           if(r.data.transaction_id) $(".transaction_id").text(r.data.transaction_id);
-          
           //发票
           if(r.data.order.applybill_status==0){ 
             //已支付未申请发票
@@ -245,7 +254,7 @@ try{
             });
           }else{
             //已支付已申请发票
-			$(".invoice").css("display","none");
+			      $(".invoice").css("display","none");
             switch (r.data.order.applybill_type){
             	case 0:
             	$(".person").css("display","");
@@ -257,13 +266,6 @@ try{
             	break;
             }
           } 
-          
-          //有效周期
-          $(".line_cycle").css("display","");
-          //有效日期  
-          if(r.data.time.l_vip_starttime&&r.data.time.l_vip_endtime){
-            $(".serviceTime").text(formatEffectiveDate(r.data.time.l_vip_starttime,r.data.time.l_vip_endtime))
-          }
         }else if(r.data.order.order_status==-2){
     		$("#pageTitle").text("已取消");
      		$(".invoice").css("display","none");//隐藏开发票

+ 11 - 5
src/web/templates/weixin/vipsubscribe/vip_purchase.html

@@ -64,7 +64,7 @@
             </ul>
             <div class="pay_mode">
                 {{if not .T.isTrial }}
-                <div class="select_payment choose_item" disabled="disabled">
+                <div class="select_payment choose_item">
                     <a href="javascript:;">
                         <span class="label">支付方式</span>
                         <span class="info choose_way">微信支付</span>
@@ -260,6 +260,7 @@
     <script src="/vipsubscribe/js/fastclick.js?v={{Msg "seo" "version"}}"></script>
     <script src="/vipsubscribe/js/weui.min.js?v={{Msg "seo" "version"}}"></script>
     <script src="/vipsubscribe/js/common.js?v={{Msg "seo" "version"}}"></script>
+    {{include "/common/weixin.html"}}
     <script>
       //微信支付start
       {{if not .T.isTrial }}
@@ -269,7 +270,7 @@
   			var id = {{.T._id}}
   			if(signature && signature.length == 4){
   				wx.config({
-  				    debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
+  				    debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
   				    appId: signature[0], // 必填,公众号的唯一标识
   				    timestamp:signature[1], // 必填,生成签名的时间戳
   				    nonceStr: signature[2], // 必填,生成签名的随机串
@@ -417,7 +418,7 @@
         
         
 
-        $(function () {
+        $(function () {           
             purchase.initData();
             purchase.showArea();
             purchase.showIndustry();
@@ -436,6 +437,7 @@
             })
             // 选择支付方式
             $('.select_payment .choose_way').click(function () {
+                return
                 $('#pay_way').show(200);
             })
 
@@ -487,6 +489,10 @@
                 }
                 // 判断是点击的是+ 还是-
                 if ($(e.target).hasClass('add')) {
+                    if(currentNum==11){ //12个月自动跳转1年
+                      $("#number_box_year .year_number:eq(0)").trigger("click");
+                      return
+                    }
                     // 点的+
                     // currentNum = currentNum >= 12 ? 12 : currentNum + 1;
                     currentNum = currentNum >= data.numboxMax ? data.numboxMax : currentNum + data
@@ -618,12 +624,12 @@
                     "time":$(".info:eq(2)").val().trim(),
                     "payWay":"wx_js"
                   }
-                  $DoPost("/front/vipsubscribe/createOrder",param,function(r){
+                  $DoPost("/subscribepay/vipsubscribe/createOrder",param,function(r){
                     if(r.success){
                       clearSessionStorage();
                       onBridgeReady(JSON.parse(r.data.res),r.data.code);
                     }
-                    $("#payHandle").removeAttr("disabled")                    
+                    $("#payHandle").removeAttr("disabled")  
                   })
                 {{else}} 
                   //试用用户